Oscar Plaisant f91c506a9e update
2025-03-16 18:05:45 +01:00

185 lines
1.1 MiB

/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Time: Thu, 23 Jan 2025 15:54:09 GMT
Version: 1.3.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 H7=Object.create;var sd=Object.defineProperty;var G7=Object.getOwnPropertyDescriptor;var W7=Object.getOwnPropertyNames;var Y7=Object.getPrototypeOf,j7=Object.prototype.hasOwnProperty;var ai=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Z7=(t,e)=>{for(var r in e)sd(t,r,{get:e[r],enumerable:!0})},LC=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of W7(e))!j7.call(t,i)&&i!==r&&sd(t,i,{get:()=>e[i],enumerable:!(n=G7(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?H7(Y7(t)):{},LC(e||!t||!t.__esModule?sd(r,"default",{value:t,enumerable:!0}):r,t)),J7=t=>LC(sd({},"__esModule",{value:!0}),t);var dp=ai((Yx,Sc)=>{(function(t,e){typeof Yx=="object"&&typeof Sc<"u"?Sc.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Yx,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(g){t=g}function n(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function i(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function a(g,S){return Object.prototype.hasOwnProperty.call(g,S)}function o(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var S;for(S in g)if(a(g,S))return!1;return!0}function s(g){return g===void 0}function l(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function u(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function c(g,S){var I=[],$,H=g.length;for($=0;$<H;++$)I.push(S(g[$],$));return I}function f(g,S){for(var I in S)a(S,I)&&(g[I]=S[I]);return a(S,"toString")&&(g.toString=S.toString),a(S,"valueOf")&&(g.valueOf=S.valueOf),g}function m(g,S,I,$){return gC(g,S,I,$,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function d(g){return g._pf==null&&(g._pf=p()),g._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(g){var S=Object(this),I=S.length>>>0,$;for($=0;$<I;$++)if($ in S&&g.call(this,S[$],$,S))return!0;return!1};function x(g){var S=null,I=!1,$=g._d&&!isNaN(g._d.getTime());if($&&(S=d(g),I=h.call(S.parsedDateParts,function(H){return H!=null}),$=S.overflow<0&&!S.empty&&!S.invalidEra&&!S.invalidMonth&&!S.invalidWeekday&&!S.weekdayMismatch&&!S.nullInput&&!S.invalidFormat&&!S.userInvalidated&&(!S.meridiem||S.meridiem&&I),g._strict&&($=$&&S.charsLeftOver===0&&S.unusedTokens.length===0&&S.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(g))g._isValid=$;else return $;return g._isValid}function b(g){var S=m(NaN);return g!=null?f(d(S),g):d(S).userInvalidated=!0,S}var T=e.momentProperties=[],v=!1;function A(g,S){var I,$,H,oe=T.length;if(s(S._isAMomentObject)||(g._isAMomentObject=S._isAMomentObject),s(S._i)||(g._i=S._i),s(S._f)||(g._f=S._f),s(S._l)||(g._l=S._l),s(S._strict)||(g._strict=S._strict),s(S._tzm)||(g._tzm=S._tzm),s(S._isUTC)||(g._isUTC=S._isUTC),s(S._offset)||(g._offset=S._offset),s(S._pf)||(g._pf=d(S)),s(S._locale)||(g._locale=S._locale),oe>0)for(I=0;I<oe;I++)$=T[I],H=S[$],s(H)||(g[$]=H);return g}function w(g){A(this,g),this._d=new Date(g._d!=null?g._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),v===!1&&(v=!0,e.updateOffset(this),v=!1)}function y(g){return g instanceof w||g!=null&&g._isAMomentObject!=null}function E(g){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+g)}function D(g,S){var I=!0;return f(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,g),I){var $=[],H,oe,Me,dt=arguments.length;for(oe=0;oe<dt;oe++){if(H="",typeof arguments[oe]=="object"){H+=`
[`+oe+"] ";for(Me in arguments[0])a(arguments[0],Me)&&(H+=Me+": "+arguments[0][Me]+", ");H=H.slice(0,-2)}else H=arguments[oe];$.push(H)}E(g+`
Arguments: `+Array.prototype.slice.call($).join("")+`
`+new Error().stack),I=!1}return S.apply(this,arguments)},S)}var _={};function 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 P(g){var S,I;for(I in g)a(g,I)&&(S=g[I],N(S)?this[I]=S:this["_"+I]=S);this._config=g,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function R(g,S){var I=f({},g),$;for($ in S)a(S,$)&&(i(g[$])&&i(S[$])?(I[$]={},f(I[$],g[$]),f(I[$],S[$])):S[$]!=null?I[$]=S[$]:delete I[$]);for($ in g)a(g,$)&&!a(S,$)&&i(g[$])&&(I[$]=f({},I[$]));return I}function L(g){g!=null&&this.set(g)}var V;Object.keys?V=Object.keys:V=function(g){var S,I=[];for(S in g)a(g,S)&&I.push(S);return I};var k={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function B(g,S,I){var $=this._calendar[g]||this._calendar.sameElse;return N($)?$.call(S,I):$}function W(g,S,I){var $=""+Math.abs(g),H=S-$.length,oe=g>=0;return(oe?I?"+":"":"-")+Math.pow(10,Math.max(0,H)).toString().substr(1)+$}var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Q=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ie={},X={};function U(g,S,I,$){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])}),I&&(X[I]=function(){return this.localeData().ordinal(H.apply(this,arguments),g)})}function pe(g){return g.match(/\[[\s\S]/)?g.replace(/^\[|\]$/g,""):g.replace(/\\/g,"")}function we(g){var S=g.match(O),I,$;for(I=0,$=S.length;I<$;I++)X[S[I]]?S[I]=X[S[I]]:S[I]=pe(S[I]);return function(H){var oe="",Me;for(Me=0;Me<$;Me++)oe+=N(S[Me])?S[Me].call(H,g):S[Me];return oe}}function se(g,S){return g.isValid()?(S=be(S,g.localeData()),ie[S]=ie[S]||we(S),ie[S](g)):g.localeData().invalidDate()}function be(g,S){var I=5;function $(H){return S.longDateFormat(H)||H}for(Q.lastIndex=0;I>=0&&Q.test(g);)g=g.replace(Q,$),Q.lastIndex=0,I-=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],I=this._longDateFormat[g.toUpperCase()];return S||!I?S:(this._longDateFormat[g]=I.match(O).map(function($){return $==="MMMM"||$==="MM"||$==="DD"||$==="dddd"?$.slice(1):$}).join(""),this._longDateFormat[g])}var ne="Invalid date";function de(){return this._invalidDate}var fe="%d",Se=/\d{1,2}/;function _e(g){return this._ordinal.replace("%d",g)}var G={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function J(g,S,I,$){var H=this._relativeTime[I];return N(H)?H(g,S,I,$):H.replace(/%d/i,g)}function ge(g,S){var I=this._relativeTime[g>0?"future":"past"];return N(I)?I(S):I.replace(/%s/i,S)}var xe={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Ee(g){return typeof g=="string"?xe[g]||xe[g.toLowerCase()]:void 0}function Be(g){var S={},I,$;for($ in g)a(g,$)&&(I=Ee($),I&&(S[I]=g[$]));return S}var Ue={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 et(g){var S=[],I;for(I in g)a(g,I)&&S.push({unit:I,priority:Ue[I]});return S.sort(function($,H){return $.priority-H.priority}),S}var St=/\d/,Ye=/\d\d/,ur=/\d{3}/,Jt=/\d{4}/,yr=/[+-]?\d{6}/,Oe=/\d\d?/,j=/\d\d\d\d?/,he=/\d\d\d\d\d\d?/,me=/\d{1,3}/,Fe=/\d{1,4}/,ke=/[+-]?\d{1,6}/,Ae=/\d+/,Xe=/[+-]?\d+/,F=/Z|[+-]\d\d:?\d\d/gi,Y=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[+-]?\d+(\.\d{1,3})?/,Ce=/[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,tt=/^[1-9]\d?/,vt=/^([1-9]\d|\d)/,_r;_r={};function ze(g,S,I){_r[g]=N(S)?S:function($,H){return $&&I?I:S}}function Ti(g,S){return a(_r,g)?_r[g](S._strict,S._locale):new RegExp(Gi(g))}function Gi(g){return un(g.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(S,I,$,H,oe){return I||$||H||oe}))}function un(g){return g.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function jn(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function hr(g){var S=+g,I=0;return S!==0&&isFinite(S)&&(I=jn(S)),I}var cu={};function $r(g,S){var I,$=S,H;for(typeof g=="string"&&(g=[g]),l(S)&&($=function(oe,Me){Me[S]=hr(oe)}),H=g.length,I=0;I<H;I++)cu[g[I]]=$}function aa(g,S){$r(g,function(I,$,H,oe){H._w=H._w||{},S(I,H._w,H,oe)})}function eo(g,S,I){S!=null&&a(cu,g)&&cu[g](S,I._a,I,g)}function Da(g){return g%4===0&&g%100!==0||g%400===0}var Bn=0,Zn=1,oa=2,hn=3,ii=4,kn=5,sa=6,Kf=7,lc=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"),ze("Y",Xe),ze("YY",Oe,Ye),ze("YYYY",Fe,Jt),ze("YYYYY",ke,yr),ze("YYYYYY",ke,yr),$r(["YYYYY","YYYYYY"],Bn),$r("YYYY",function(g,S){S[Bn]=g.length===2?e.parseTwoDigitYear(g):hr(g)}),$r("YY",function(g,S){S[Bn]=e.parseTwoDigitYear(g)}),$r("Y",function(g,S){S[Bn]=parseInt(g,10)});function bs(g){return Da(g)?366:365}e.parseTwoDigitYear=function(g){return hr(g)+(hr(g)>68?1900:2e3)};var ws=Ko("FullYear",!0);function cc(){return Da(this.year())}function Ko(g,S){return function(I){return I!=null?(fc(this,g,I),e.updateOffset(this,S),this):Mo(this,g)}}function Mo(g,S){if(!g.isValid())return NaN;var I=g._d,$=g._isUTC;switch(S){case"Milliseconds":return $?I.getUTCMilliseconds():I.getMilliseconds();case"Seconds":return $?I.getUTCSeconds():I.getSeconds();case"Minutes":return $?I.getUTCMinutes():I.getMinutes();case"Hours":return $?I.getUTCHours():I.getHours();case"Date":return $?I.getUTCDate():I.getDate();case"Day":return $?I.getUTCDay():I.getDay();case"Month":return $?I.getUTCMonth():I.getMonth();case"FullYear":return $?I.getUTCFullYear():I.getFullYear();default:return NaN}}function fc(g,S,I){var $,H,oe,Me,dt;if(!(!g.isValid()||isNaN(I))){switch($=g._d,H=g._isUTC,S){case"Milliseconds":return void(H?$.setUTCMilliseconds(I):$.setMilliseconds(I));case"Seconds":return void(H?$.setUTCSeconds(I):$.setSeconds(I));case"Minutes":return void(H?$.setUTCMinutes(I):$.setMinutes(I));case"Hours":return void(H?$.setUTCHours(I):$.setHours(I));case"Date":return void(H?$.setUTCDate(I):$.setDate(I));case"FullYear":break;default:return}oe=I,Me=g.month(),dt=g.date(),dt=dt===29&&Me===1&&!Da(oe)?28:dt,H?$.setUTCFullYear(oe,Me,dt):$.setFullYear(oe,Me,dt)}}function pc(g){return g=Ee(g),N(this[g])?this[g]():this}function ep(g,S){if(typeof g=="object"){g=Be(g);var I=et(g),$,H=I.length;for($=0;$<H;$++)this[I[$].unit](g[I[$].unit])}else if(g=Ee(g),N(this[g]))return this[g](S);return this}function tp(g,S){return(g%S+S)%S}var ln;Array.prototype.indexOf?ln=Array.prototype.indexOf:ln=function(g){var S;for(S=0;S<this.length;++S)if(this[S]===g)return S;return-1};function q(g,S){if(isNaN(g)||isNaN(S))return NaN;var I=tp(S,12);return g+=(S-I)/12,I===1?Da(g)?29:28:31-I%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)}),ze("M",Oe,tt),ze("MM",Oe,Ye),ze("MMM",function(g,S){return S.monthsShortRegex(g)}),ze("MMMM",function(g,S){return S.monthsRegex(g)}),$r(["M","MM"],function(g,S){S[Zn]=hr(g)-1}),$r(["MMM","MMMM"],function(g,S,I,$){var H=I._locale.monthsParse(g,$,I._strict);H!=null?S[Zn]=H:d(I).invalidMonth=g});var re="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ne="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ke=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ge=Ce,qt=Ce;function Or(g,S){return g?n(this._months)?this._months[g.month()]:this._months[(this._months.isFormat||Ke).test(S)?"format":"standalone"][g.month()]:n(this._months)?this._months:this._months.standalone}function Rn(g,S){return g?n(this._monthsShort)?this._monthsShort[g.month()]:this._monthsShort[Ke.test(S)?"format":"standalone"][g.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Ln(g,S,I){var $,H,oe,Me=g.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],$=0;$<12;++$)oe=m([2e3,$]),this._shortMonthsParse[$]=this.monthsShort(oe,"").toLocaleLowerCase(),this._longMonthsParse[$]=this.months(oe,"").toLocaleLowerCase();return I?S==="MMM"?(H=ln.call(this._shortMonthsParse,Me),H!==-1?H:null):(H=ln.call(this._longMonthsParse,Me),H!==-1?H:null):S==="MMM"?(H=ln.call(this._shortMonthsParse,Me),H!==-1?H:(H=ln.call(this._longMonthsParse,Me),H!==-1?H:null)):(H=ln.call(this._longMonthsParse,Me),H!==-1?H:(H=ln.call(this._shortMonthsParse,Me),H!==-1?H:null))}function _s(g,S,I){var $,H,oe;if(this._monthsParseExact)return Ln.call(this,g,S,I);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),$=0;$<12;$++){if(H=m([2e3,$]),I&&!this._longMonthsParse[$]&&(this._longMonthsParse[$]=new RegExp("^"+this.months(H,"").replace(".","")+"$","i"),this._shortMonthsParse[$]=new RegExp("^"+this.monthsShort(H,"").replace(".","")+"$","i")),!I&&!this._monthsParse[$]&&(oe="^"+this.months(H,"")+"|^"+this.monthsShort(H,""),this._monthsParse[$]=new RegExp(oe.replace(".",""),"i")),I&&S==="MMMM"&&this._longMonthsParse[$].test(g))return $;if(I&&S==="MMM"&&this._shortMonthsParse[$].test(g))return $;if(!I&&this._monthsParse[$].test(g))return $}}function iC(g,S){if(!g.isValid())return g;if(typeof S=="string"){if(/^\d+$/.test(S))S=hr(S);else if(S=g.localeData().monthsParse(S),!l(S))return g}var I=S,$=g.date();return $=$<29?$:Math.min($,q(g.year(),I)),g._isUTC?g._d.setUTCMonth(I,$):g._d.setMonth(I,$),g}function aC(g){return g!=null?(iC(this,g),e.updateOffset(this,!0),this):Mo(this,"Month")}function D9(){return q(this.year(),this.month())}function M9(g){return this._monthsParseExact?(a(this,"_monthsRegex")||oC.call(this),g?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=Ge),this._monthsShortStrictRegex&&g?this._monthsShortStrictRegex:this._monthsShortRegex)}function C9(g){return this._monthsParseExact?(a(this,"_monthsRegex")||oC.call(this),g?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=qt),this._monthsStrictRegex&&g?this._monthsStrictRegex:this._monthsRegex)}function oC(){function g(tr,Dr){return Dr.length-tr.length}var S=[],I=[],$=[],H,oe,Me,dt;for(H=0;H<12;H++)oe=m([2e3,H]),Me=un(this.monthsShort(oe,"")),dt=un(this.months(oe,"")),S.push(Me),I.push(dt),$.push(dt),$.push(Me);S.sort(g),I.sort(g),$.sort(g),this._monthsRegex=new RegExp("^("+$.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+S.join("|")+")","i")}function N9(g,S,I,$,H,oe,Me){var dt;return g<100&&g>=0?(dt=new Date(g+400,S,I,$,H,oe,Me),isFinite(dt.getFullYear())&&dt.setFullYear(g)):dt=new Date(g,S,I,$,H,oe,Me),dt}function rp(g){var S,I;return g<100&&g>=0?(I=Array.prototype.slice.call(arguments),I[0]=g+400,S=new Date(Date.UTC.apply(null,I)),isFinite(S.getUTCFullYear())&&S.setUTCFullYear(g)):S=new Date(Date.UTC.apply(null,arguments)),S}function Jm(g,S,I){var $=7+S-I,H=(7+rp(g,0,$).getUTCDay()-S)%7;return-H+$-1}function sC(g,S,I,$,H){var oe=(7+I-$)%7,Me=Jm(g,$,H),dt=1+7*(S-1)+oe+Me,tr,Dr;return dt<=0?(tr=g-1,Dr=bs(tr)+dt):dt>bs(g)?(tr=g+1,Dr=dt-bs(g)):(tr=g,Dr=dt),{year:tr,dayOfYear:Dr}}function np(g,S,I){var $=Jm(g.year(),S,I),H=Math.floor((g.dayOfYear()-$-1)/7)+1,oe,Me;return H<1?(Me=g.year()-1,oe=H+As(Me,S,I)):H>As(g.year(),S,I)?(oe=H-As(g.year(),S,I),Me=g.year()+1):(Me=g.year(),oe=H),{week:oe,year:Me}}function As(g,S,I){var $=Jm(g,S,I),H=Jm(g+1,S,I);return(bs(g)-$+H)/7}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),ze("w",Oe,tt),ze("ww",Oe,Ye),ze("W",Oe,tt),ze("WW",Oe,Ye),aa(["w","ww","W","WW"],function(g,S,I,$){S[$.substr(0,1)]=hr(g)});function F9(g){return np(g,this._week.dow,this._week.doy).week}var I9={dow:0,doy:6};function P9(){return this._week.dow}function B9(){return this._week.doy}function k9(g){var S=this.localeData().week(this);return g==null?S:this.add((g-S)*7,"d")}function $9(g){var S=np(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"),ze("d",Oe),ze("e",Oe),ze("E",Oe),ze("dd",function(g,S){return S.weekdaysMinRegex(g)}),ze("ddd",function(g,S){return S.weekdaysShortRegex(g)}),ze("dddd",function(g,S){return S.weekdaysRegex(g)}),aa(["dd","ddd","dddd"],function(g,S,I,$){var H=I._locale.weekdaysParse(g,$,I._strict);H!=null?S.d=H:d(I).invalidWeekday=g}),aa(["d","e","E"],function(g,S,I,$){S[$]=hr(g)});function O9(g,S){return typeof g!="string"?g:isNaN(g)?(g=S.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function R9(g,S){return typeof g=="string"?S.weekdaysParse(g)%7||7:isNaN(g)?null:g}function vx(g,S){return g.slice(S,7).concat(g.slice(0,S))}var L9="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),uC="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),V9="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),U9=Ce,q9=Ce,z9=Ce;function H9(g,S){var I=n(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(S)?"format":"standalone"];return g===!0?vx(I,this._week.dow):g?I[g.day()]:I}function G9(g){return g===!0?vx(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function W9(g){return g===!0?vx(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function Y9(g,S,I){var $,H,oe,Me=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],$=0;$<7;++$)oe=m([2e3,1]).day($),this._minWeekdaysParse[$]=this.weekdaysMin(oe,"").toLocaleLowerCase(),this._shortWeekdaysParse[$]=this.weekdaysShort(oe,"").toLocaleLowerCase(),this._weekdaysParse[$]=this.weekdays(oe,"").toLocaleLowerCase();return I?S==="dddd"?(H=ln.call(this._weekdaysParse,Me),H!==-1?H:null):S==="ddd"?(H=ln.call(this._shortWeekdaysParse,Me),H!==-1?H:null):(H=ln.call(this._minWeekdaysParse,Me),H!==-1?H:null):S==="dddd"?(H=ln.call(this._weekdaysParse,Me),H!==-1||(H=ln.call(this._shortWeekdaysParse,Me),H!==-1)?H:(H=ln.call(this._minWeekdaysParse,Me),H!==-1?H:null)):S==="ddd"?(H=ln.call(this._shortWeekdaysParse,Me),H!==-1||(H=ln.call(this._weekdaysParse,Me),H!==-1)?H:(H=ln.call(this._minWeekdaysParse,Me),H!==-1?H:null)):(H=ln.call(this._minWeekdaysParse,Me),H!==-1||(H=ln.call(this._weekdaysParse,Me),H!==-1)?H:(H=ln.call(this._shortWeekdaysParse,Me),H!==-1?H:null))}function j9(g,S,I){var $,H,oe;if(this._weekdaysParseExact)return Y9.call(this,g,S,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),$=0;$<7;$++){if(H=m([2e3,1]).day($),I&&!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[$]||(oe="^"+this.weekdays(H,"")+"|^"+this.weekdaysShort(H,"")+"|^"+this.weekdaysMin(H,""),this._weekdaysParse[$]=new RegExp(oe.replace(".",""),"i")),I&&S==="dddd"&&this._fullWeekdaysParse[$].test(g))return $;if(I&&S==="ddd"&&this._shortWeekdaysParse[$].test(g))return $;if(I&&S==="dd"&&this._minWeekdaysParse[$].test(g))return $;if(!I&&this._weekdaysParse[$].test(g))return $}}function Z9(g){if(!this.isValid())return g!=null?this:NaN;var S=Mo(this,"Day");return g!=null?(g=O9(g,this.localeData()),this.add(g-S,"d")):S}function J9(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 X9(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var S=R9(g,this.localeData());return this.day(this.day()%7?S:S-7)}else return this.day()||7}function Q9(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||yx.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=U9),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function K9(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||yx.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=q9),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function eq(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||yx.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=z9),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function yx(){function g(Wi,Ms){return Ms.length-Wi.length}var S=[],I=[],$=[],H=[],oe,Me,dt,tr,Dr;for(oe=0;oe<7;oe++)Me=m([2e3,1]).day(oe),dt=un(this.weekdaysMin(Me,"")),tr=un(this.weekdaysShort(Me,"")),Dr=un(this.weekdays(Me,"")),S.push(dt),I.push(tr),$.push(Dr),H.push(dt),H.push(tr),H.push(Dr);S.sort(g),I.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("^("+I.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+S.join("|")+")","i")}function xx(){return this.hours()%12||12}function tq(){return this.hours()||24}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,xx),U("k",["kk",2],0,tq),U("hmm",0,0,function(){return""+xx.apply(this)+W(this.minutes(),2)}),U("hmmss",0,0,function(){return""+xx.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 lC(g,S){U(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),S)})}lC("a",!0),lC("A",!1);function cC(g,S){return S._meridiemParse}ze("a",cC),ze("A",cC),ze("H",Oe,vt),ze("h",Oe,tt),ze("k",Oe,tt),ze("HH",Oe,Ye),ze("hh",Oe,Ye),ze("kk",Oe,Ye),ze("hmm",j),ze("hmmss",he),ze("Hmm",j),ze("Hmmss",he),$r(["H","HH"],hn),$r(["k","kk"],function(g,S,I){var $=hr(g);S[hn]=$===24?0:$}),$r(["a","A"],function(g,S,I){I._isPm=I._locale.isPM(g),I._meridiem=g}),$r(["h","hh"],function(g,S,I){S[hn]=hr(g),d(I).bigHour=!0}),$r("hmm",function(g,S,I){var $=g.length-2;S[hn]=hr(g.substr(0,$)),S[ii]=hr(g.substr($)),d(I).bigHour=!0}),$r("hmmss",function(g,S,I){var $=g.length-4,H=g.length-2;S[hn]=hr(g.substr(0,$)),S[ii]=hr(g.substr($,2)),S[kn]=hr(g.substr(H)),d(I).bigHour=!0}),$r("Hmm",function(g,S,I){var $=g.length-2;S[hn]=hr(g.substr(0,$)),S[ii]=hr(g.substr($))}),$r("Hmmss",function(g,S,I){var $=g.length-4,H=g.length-2;S[hn]=hr(g.substr(0,$)),S[ii]=hr(g.substr($,2)),S[kn]=hr(g.substr(H))});function rq(g){return(g+"").toLowerCase().charAt(0)==="p"}var nq=/[ap]\.?m?\.?/i,iq=Ko("Hours",!0);function aq(g,S,I){return g>11?I?"pm":"PM":I?"am":"AM"}var fC={calendar:k,longDateFormat:ee,invalidDate:ne,ordinal:fe,dayOfMonthOrdinalParse:Se,relativeTime:G,months:re,monthsShort:Ne,week:I9,weekdays:L9,weekdaysMin:V9,weekdaysShort:uC,meridiemParse:nq},gn={},ip={},ap;function oq(g,S){var I,$=Math.min(g.length,S.length);for(I=0;I<$;I+=1)if(g[I]!==S[I])return I;return $}function pC(g){return g&&g.toLowerCase().replace("_","-")}function sq(g){for(var S=0,I,$,H,oe;S<g.length;){for(oe=pC(g[S]).split("-"),I=oe.length,$=pC(g[S+1]),$=$?$.split("-"):null;I>0;){if(H=Xm(oe.slice(0,I).join("-")),H)return H;if($&&$.length>=I&&oq(oe,$)>=I-1)break;I--}S++}return ap}function uq(g){return!!(g&&g.match("^[^/\\\\]*$"))}function Xm(g){var S=null,I;if(gn[g]===void 0&&typeof Sc<"u"&&Sc&&Sc.exports&&uq(g))try{S=ap._abbr,I=require,I("./locale/"+g),fu(S)}catch{gn[g]=null}return gn[g]}function fu(g,S){var I;return g&&(s(S)?I=Ss(g):I=bx(g,S),I?ap=I:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),ap._abbr}function bx(g,S){if(S!==null){var I,$=fC;if(S.abbr=g,gn[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."),$=gn[g]._config;else if(S.parentLocale!=null)if(gn[S.parentLocale]!=null)$=gn[S.parentLocale]._config;else if(I=Xm(S.parentLocale),I!=null)$=I._config;else return ip[S.parentLocale]||(ip[S.parentLocale]=[]),ip[S.parentLocale].push({name:g,config:S}),null;return gn[g]=new L(R($,S)),ip[g]&&ip[g].forEach(function(H){bx(H.name,H.config)}),fu(g),gn[g]}else return delete gn[g],null}function lq(g,S){if(S!=null){var I,$,H=fC;gn[g]!=null&&gn[g].parentLocale!=null?gn[g].set(R(gn[g]._config,S)):($=Xm(g),$!=null&&(H=$._config),S=R(H,S),$==null&&(S.abbr=g),I=new L(S),I.parentLocale=gn[g],gn[g]=I),fu(g)}else gn[g]!=null&&(gn[g].parentLocale!=null?(gn[g]=gn[g].parentLocale,g===fu()&&fu(g)):gn[g]!=null&&delete gn[g]);return gn[g]}function Ss(g){var S;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return ap;if(!n(g)){if(S=Xm(g),S)return S;g=[g]}return sq(g)}function cq(){return V(gn)}function wx(g){var S,I=g._a;return I&&d(g).overflow===-2&&(S=I[Zn]<0||I[Zn]>11?Zn:I[oa]<1||I[oa]>q(I[Bn],I[Zn])?oa:I[hn]<0||I[hn]>24||I[hn]===24&&(I[ii]!==0||I[kn]!==0||I[sa]!==0)?hn:I[ii]<0||I[ii]>59?ii:I[kn]<0||I[kn]>59?kn:I[sa]<0||I[sa]>999?sa:-1,d(g)._overflowDayOfYear&&(S<Bn||S>oa)&&(S=oa),d(g)._overflowWeeks&&S===-1&&(S=Kf),d(g)._overflowWeekday&&S===-1&&(S=lc),d(g).overflow=S),g}var fq=/^\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)?)?$/,pq=/^\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)?)?$/,mq=/Z|[+-]\d\d(?::?\d\d)?/,Qm=[["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]],_x=[["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/]],dq=/^\/?Date\((-?\d+)/i,hq=/^(?:(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}))$/,gq={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 mC(g){var S,I,$=g._i,H=fq.exec($)||pq.exec($),oe,Me,dt,tr,Dr=Qm.length,Wi=_x.length;if(H){for(d(g).iso=!0,S=0,I=Dr;S<I;S++)if(Qm[S][1].exec(H[1])){Me=Qm[S][0],oe=Qm[S][2]!==!1;break}if(Me==null){g._isValid=!1;return}if(H[3]){for(S=0,I=Wi;S<I;S++)if(_x[S][1].exec(H[3])){dt=(H[2]||" ")+_x[S][0];break}if(dt==null){g._isValid=!1;return}}if(!oe&&dt!=null){g._isValid=!1;return}if(H[4])if(mq.exec(H[4]))tr="Z";else{g._isValid=!1;return}g._f=Me+(dt||"")+(tr||""),Sx(g)}else g._isValid=!1}function vq(g,S,I,$,H,oe){var Me=[yq(g),Ne.indexOf(S),parseInt(I,10),parseInt($,10),parseInt(H,10)];return oe&&Me.push(parseInt(oe,10)),Me}function yq(g){var S=parseInt(g,10);return S<=49?2e3+S:S<=999?1900+S:S}function xq(g){return g.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function bq(g,S,I){if(g){var $=uC.indexOf(g),H=new Date(S[0],S[1],S[2]).getDay();if($!==H)return d(I).weekdayMismatch=!0,I._isValid=!1,!1}return!0}function wq(g,S,I){if(g)return gq[g];if(S)return 0;var $=parseInt(I,10),H=$%100,oe=($-H)/100;return oe*60+H}function dC(g){var S=hq.exec(xq(g._i)),I;if(S){if(I=vq(S[4],S[3],S[2],S[5],S[6],S[7]),!bq(S[1],I,g))return;g._a=I,g._tzm=wq(S[8],S[9],S[10]),g._d=rp.apply(null,g._a),g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),d(g).rfc2822=!0}else g._isValid=!1}function _q(g){var S=dq.exec(g._i);if(S!==null){g._d=new Date(+S[1]);return}if(mC(g),g._isValid===!1)delete g._isValid;else return;if(dC(g),g._isValid===!1)delete g._isValid;else return;g._strict?g._isValid=!1:e.createFromInputFallback(g)}e.createFromInputFallback=D("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 mc(g,S,I){return g??S??I}function Aq(g){var S=new Date(e.now());return g._useUTC?[S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()]:[S.getFullYear(),S.getMonth(),S.getDate()]}function Ax(g){var S,I,$=[],H,oe,Me;if(!g._d){for(H=Aq(g),g._w&&g._a[oa]==null&&g._a[Zn]==null&&Sq(g),g._dayOfYear!=null&&(Me=mc(g._a[Bn],H[Bn]),(g._dayOfYear>bs(Me)||g._dayOfYear===0)&&(d(g)._overflowDayOfYear=!0),I=rp(Me,0,g._dayOfYear),g._a[Zn]=I.getUTCMonth(),g._a[oa]=I.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[hn]===24&&g._a[ii]===0&&g._a[kn]===0&&g._a[sa]===0&&(g._nextDay=!0,g._a[hn]=0),g._d=(g._useUTC?rp:N9).apply(null,$),oe=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[hn]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==oe&&(d(g).weekdayMismatch=!0)}}function Sq(g){var S,I,$,H,oe,Me,dt,tr,Dr;S=g._w,S.GG!=null||S.W!=null||S.E!=null?(oe=1,Me=4,I=mc(S.GG,g._a[Bn],np(cn(),1,4).year),$=mc(S.W,1),H=mc(S.E,1),(H<1||H>7)&&(tr=!0)):(oe=g._locale._week.dow,Me=g._locale._week.doy,Dr=np(cn(),oe,Me),I=mc(S.gg,g._a[Bn],Dr.year),$=mc(S.w,Dr.week),S.d!=null?(H=S.d,(H<0||H>6)&&(tr=!0)):S.e!=null?(H=S.e+oe,(S.e<0||S.e>6)&&(tr=!0)):H=oe),$<1||$>As(I,oe,Me)?d(g)._overflowWeeks=!0:tr!=null?d(g)._overflowWeekday=!0:(dt=sC(I,$,H,oe,Me),g._a[Bn]=dt.year,g._dayOfYear=dt.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Sx(g){if(g._f===e.ISO_8601){mC(g);return}if(g._f===e.RFC_2822){dC(g);return}g._a=[],d(g).empty=!0;var S=""+g._i,I,$,H,oe,Me,dt=S.length,tr=0,Dr,Wi;for(H=be(g._f,g._locale).match(O)||[],Wi=H.length,I=0;I<Wi;I++)oe=H[I],$=(S.match(Ti(oe,g))||[])[0],$&&(Me=S.substr(0,S.indexOf($)),Me.length>0&&d(g).unusedInput.push(Me),S=S.slice(S.indexOf($)+$.length),tr+=$.length),X[oe]?($?d(g).empty=!1:d(g).unusedTokens.push(oe),eo(oe,$,g)):g._strict&&!$&&d(g).unusedTokens.push(oe);d(g).charsLeftOver=dt-tr,S.length>0&&d(g).unusedInput.push(S),g._a[hn]<=12&&d(g).bigHour===!0&&g._a[hn]>0&&(d(g).bigHour=void 0),d(g).parsedDateParts=g._a.slice(0),d(g).meridiem=g._meridiem,g._a[hn]=Eq(g._locale,g._a[hn],g._meridiem),Dr=d(g).era,Dr!==null&&(g._a[Bn]=g._locale.erasConvertYear(Dr,g._a[Bn])),Ax(g),wx(g)}function Eq(g,S,I){var $;return I==null?S:g.meridiemHour!=null?g.meridiemHour(S,I):(g.isPM!=null&&($=g.isPM(I),$&&S<12&&(S+=12),!$&&S===12&&(S=0)),S)}function Tq(g){var S,I,$,H,oe,Me,dt=!1,tr=g._f.length;if(tr===0){d(g).invalidFormat=!0,g._d=new Date(NaN);return}for(H=0;H<tr;H++)oe=0,Me=!1,S=A({},g),g._useUTC!=null&&(S._useUTC=g._useUTC),S._f=g._f[H],Sx(S),x(S)&&(Me=!0),oe+=d(S).charsLeftOver,oe+=d(S).unusedTokens.length*10,d(S).score=oe,dt?oe<$&&($=oe,I=S):($==null||oe<$||Me)&&($=oe,I=S,Me&&(dt=!0));f(g,I||S)}function Dq(g){if(!g._d){var S=Be(g._i),I=S.day===void 0?S.date:S.day;g._a=c([S.year,S.month,I,S.hour,S.minute,S.second,S.millisecond],function($){return $&&parseInt($,10)}),Ax(g)}}function Mq(g){var S=new w(wx(hC(g)));return S._nextDay&&(S.add(1,"d"),S._nextDay=void 0),S}function hC(g){var S=g._i,I=g._f;return g._locale=g._locale||Ss(g._l),S===null||I===void 0&&S===""?b({nullInput:!0}):(typeof S=="string"&&(g._i=S=g._locale.preparse(S)),y(S)?new w(wx(S)):(u(S)?g._d=S:n(I)?Tq(g):I?Sx(g):Cq(g),x(g)||(g._d=null),g))}function Cq(g){var S=g._i;s(S)?g._d=new Date(e.now()):u(S)?g._d=new Date(S.valueOf()):typeof S=="string"?_q(g):n(S)?(g._a=c(S.slice(0),function(I){return parseInt(I,10)}),Ax(g)):i(S)?Dq(g):l(S)?g._d=new Date(S):e.createFromInputFallback(g)}function gC(g,S,I,$,H){var oe={};return(S===!0||S===!1)&&($=S,S=void 0),(I===!0||I===!1)&&($=I,I=void 0),(i(g)&&o(g)||n(g)&&g.length===0)&&(g=void 0),oe._isAMomentObject=!0,oe._useUTC=oe._isUTC=H,oe._l=I,oe._i=g,oe._f=S,oe._strict=$,Mq(oe)}function cn(g,S,I,$){return gC(g,S,I,$,!1)}var Nq=D("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=cn.apply(null,arguments);return this.isValid()&&g.isValid()?g<this?this:g:b()}),Fq=D("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=cn.apply(null,arguments);return this.isValid()&&g.isValid()?g>this?this:g:b()});function vC(g,S){var I,$;if(S.length===1&&n(S[0])&&(S=S[0]),!S.length)return cn();for(I=S[0],$=1;$<S.length;++$)(!S[$].isValid()||S[$][g](I))&&(I=S[$]);return I}function Iq(){var g=[].slice.call(arguments,0);return vC("isBefore",g)}function Pq(){var g=[].slice.call(arguments,0);return vC("isAfter",g)}var Bq=function(){return Date.now?Date.now():+new Date},op=["year","quarter","month","week","day","hour","minute","second","millisecond"];function kq(g){var S,I=!1,$,H=op.length;for(S in g)if(a(g,S)&&!(ln.call(op,S)!==-1&&(g[S]==null||!isNaN(g[S]))))return!1;for($=0;$<H;++$)if(g[op[$]]){if(I)return!1;parseFloat(g[op[$]])!==hr(g[op[$]])&&(I=!0)}return!0}function $q(){return this._isValid}function Oq(){return Co(NaN)}function Km(g){var S=Be(g),I=S.year||0,$=S.quarter||0,H=S.month||0,oe=S.week||S.isoWeek||0,Me=S.day||0,dt=S.hour||0,tr=S.minute||0,Dr=S.second||0,Wi=S.millisecond||0;this._isValid=kq(S),this._milliseconds=+Wi+Dr*1e3+tr*6e4+dt*1e3*60*60,this._days=+Me+oe*7,this._months=+H+$*3+I*12,this._data={},this._locale=Ss(),this._bubble()}function ed(g){return g instanceof Km}function Ex(g){return g<0?Math.round(-1*g)*-1:Math.round(g)}function Rq(g,S,I){var $=Math.min(g.length,S.length),H=Math.abs(g.length-S.length),oe=0,Me;for(Me=0;Me<$;Me++)(I&&g[Me]!==S[Me]||!I&&hr(g[Me])!==hr(S[Me]))&&oe++;return oe+H}function yC(g,S){U(g,0,0,function(){var I=this.utcOffset(),$="+";return I<0&&(I=-I,$="-"),$+W(~~(I/60),2)+S+W(~~I%60,2)})}yC("Z",":"),yC("ZZ",""),ze("Z",Y),ze("ZZ",Y),$r(["Z","ZZ"],function(g,S,I){I._useUTC=!0,I._tzm=Tx(Y,g)});var Lq=/([\+\-]|\d\d)/gi;function Tx(g,S){var I=(S||"").match(g),$,H,oe;return I===null?null:($=I[I.length-1]||[],H=($+"").match(Lq)||["-",0,0],oe=+(H[1]*60)+hr(H[2]),oe===0?0:H[0]==="+"?oe:-oe)}function Dx(g,S){var I,$;return S._isUTC?(I=S.clone(),$=(y(g)||u(g)?g.valueOf():cn(g).valueOf())-I.valueOf(),I._d.setTime(I._d.valueOf()+$),e.updateOffset(I,!1),I):cn(g).local()}function Mx(g){return-Math.round(g._d.getTimezoneOffset())}e.updateOffset=function(){};function Vq(g,S,I){var $=this._offset||0,H;if(!this.isValid())return g!=null?this:NaN;if(g!=null){if(typeof g=="string"){if(g=Tx(Y,g),g===null)return this}else Math.abs(g)<16&&!I&&(g=g*60);return!this._isUTC&&S&&(H=Mx(this)),this._offset=g,this._isUTC=!0,H!=null&&this.add(H,"m"),$!==g&&(!S||this._changeInProgress?_C(this,Co(g-$,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?$:Mx(this)}function Uq(g,S){return g!=null?(typeof g!="string"&&(g=-g),this.utcOffset(g,S),this):-this.utcOffset()}function qq(g){return this.utcOffset(0,g)}function zq(g){return this._isUTC&&(this.utcOffset(0,g),this._isUTC=!1,g&&this.subtract(Mx(this),"m")),this}function Hq(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var g=Tx(F,this._i);g!=null?this.utcOffset(g):this.utcOffset(0,!0)}return this}function Gq(g){return this.isValid()?(g=g?cn(g).utcOffset():0,(this.utcOffset()-g)%60===0):!1}function Wq(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Yq(){if(!s(this._isDSTShifted))return this._isDSTShifted;var g={},S;return A(g,this),g=hC(g),g._a?(S=g._isUTC?m(g._a):cn(g._a),this._isDSTShifted=this.isValid()&&Rq(g._a,S.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function jq(){return this.isValid()?!this._isUTC:!1}function Zq(){return this.isValid()?this._isUTC:!1}function xC(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Jq=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Xq=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Co(g,S){var I=g,$=null,H,oe,Me;return ed(g)?I={ms:g._milliseconds,d:g._days,M:g._months}:l(g)||!isNaN(+g)?(I={},S?I[S]=+g:I.milliseconds=+g):($=Jq.exec(g))?(H=$[1]==="-"?-1:1,I={y:0,d:hr($[oa])*H,h:hr($[hn])*H,m:hr($[ii])*H,s:hr($[kn])*H,ms:hr(Ex($[sa]*1e3))*H}):($=Xq.exec(g))?(H=$[1]==="-"?-1:1,I={y:ol($[2],H),M:ol($[3],H),w:ol($[4],H),d:ol($[5],H),h:ol($[6],H),m:ol($[7],H),s:ol($[8],H)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(Me=Qq(cn(I.from),cn(I.to)),I={},I.ms=Me.milliseconds,I.M=Me.months),oe=new Km(I),ed(g)&&a(g,"_locale")&&(oe._locale=g._locale),ed(g)&&a(g,"_isValid")&&(oe._isValid=g._isValid),oe}Co.fn=Km.prototype,Co.invalid=Oq;function ol(g,S){var I=g&&parseFloat(g.replace(",","."));return(isNaN(I)?0:I)*S}function bC(g,S){var I={};return I.months=S.month()-g.month()+(S.year()-g.year())*12,g.clone().add(I.months,"M").isAfter(S)&&--I.months,I.milliseconds=+S-+g.clone().add(I.months,"M"),I}function Qq(g,S){var I;return g.isValid()&&S.isValid()?(S=Dx(S,g),g.isBefore(S)?I=bC(g,S):(I=bC(S,g),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function wC(g,S){return function(I,$){var H,oe;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."),oe=I,I=$,$=oe),H=Co(I,$),_C(this,H,g),this}}function _C(g,S,I,$){var H=S._milliseconds,oe=Ex(S._days),Me=Ex(S._months);g.isValid()&&($=$??!0,Me&&iC(g,Mo(g,"Month")+Me*I),oe&&fc(g,"Date",Mo(g,"Date")+oe*I),H&&g._d.setTime(g._d.valueOf()+H*I),$&&e.updateOffset(g,oe||Me))}var Kq=wC(1,"add"),ez=wC(-1,"subtract");function AC(g){return typeof g=="string"||g instanceof String}function tz(g){return y(g)||u(g)||AC(g)||l(g)||nz(g)||rz(g)||g===null||g===void 0}function rz(g){var S=i(g)&&!o(g),I=!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,oe,Me=$.length;for(H=0;H<Me;H+=1)oe=$[H],I=I||a(g,oe);return S&&I}function nz(g){var S=n(g),I=!1;return S&&(I=g.filter(function($){return!l($)&&AC(g)}).length===0),S&&I}function iz(g){var S=i(g)&&!o(g),I=!1,$=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],H,oe;for(H=0;H<$.length;H+=1)oe=$[H],I=I||a(g,oe);return S&&I}function az(g,S){var I=g.diff(S,"days",!0);return I<-6?"sameElse":I<-1?"lastWeek":I<0?"lastDay":I<1?"sameDay":I<2?"nextDay":I<7?"nextWeek":"sameElse"}function oz(g,S){arguments.length===1&&(arguments[0]?tz(arguments[0])?(g=arguments[0],S=void 0):iz(arguments[0])&&(S=arguments[0],g=void 0):(g=void 0,S=void 0));var I=g||cn(),$=Dx(I,this).startOf("day"),H=e.calendarFormat(this,$)||"sameElse",oe=S&&(N(S[H])?S[H].call(this,I):S[H]);return this.format(oe||this.localeData().calendar(H,this,cn(I)))}function sz(){return new w(this)}function uz(g,S){var I=y(g)?g:cn(g);return this.isValid()&&I.isValid()?(S=Ee(S)||"millisecond",S==="millisecond"?this.valueOf()>I.valueOf():I.valueOf()<this.clone().startOf(S).valueOf()):!1}function lz(g,S){var I=y(g)?g:cn(g);return this.isValid()&&I.isValid()?(S=Ee(S)||"millisecond",S==="millisecond"?this.valueOf()<I.valueOf():this.clone().endOf(S).valueOf()<I.valueOf()):!1}function cz(g,S,I,$){var H=y(g)?g:cn(g),oe=y(S)?S:cn(S);return this.isValid()&&H.isValid()&&oe.isValid()?($=$||"()",($[0]==="("?this.isAfter(H,I):!this.isBefore(H,I))&&($[1]===")"?this.isBefore(oe,I):!this.isAfter(oe,I))):!1}function fz(g,S){var I=y(g)?g:cn(g),$;return this.isValid()&&I.isValid()?(S=Ee(S)||"millisecond",S==="millisecond"?this.valueOf()===I.valueOf():($=I.valueOf(),this.clone().startOf(S).valueOf()<=$&&$<=this.clone().endOf(S).valueOf())):!1}function pz(g,S){return this.isSame(g,S)||this.isAfter(g,S)}function mz(g,S){return this.isSame(g,S)||this.isBefore(g,S)}function dz(g,S,I){var $,H,oe;if(!this.isValid())return NaN;if($=Dx(g,this),!$.isValid())return NaN;switch(H=($.utcOffset()-this.utcOffset())*6e4,S=Ee(S),S){case"year":oe=td(this,$)/12;break;case"month":oe=td(this,$);break;case"quarter":oe=td(this,$)/3;break;case"second":oe=(this-$)/1e3;break;case"minute":oe=(this-$)/6e4;break;case"hour":oe=(this-$)/36e5;break;case"day":oe=(this-$-H)/864e5;break;case"week":oe=(this-$-H)/6048e5;break;default:oe=this-$}return I?oe:jn(oe)}function td(g,S){if(g.date()<S.date())return-td(S,g);var I=(S.year()-g.year())*12+(S.month()-g.month()),$=g.clone().add(I,"months"),H,oe;return S-$<0?(H=g.clone().add(I-1,"months"),oe=(S-$)/($-H)):(H=g.clone().add(I+1,"months"),oe=(S-$)/(H-$)),-(I+oe)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function hz(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function gz(g){if(!this.isValid())return null;var S=g!==!0,I=S?this.clone().utc():this;return I.year()<0||I.year()>9999?se(I,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",se(I,"Z")):se(I,S?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function vz(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",S="",I,$,H,oe;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",S="Z"),I="["+g+'("]',$=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",H="-MM-DD[T]HH:mm:ss.SSS",oe=S+'[")]',this.format(I+$+H+oe)}function yz(g){g||(g=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var S=se(this,g);return this.localeData().postformat(S)}function xz(g,S){return this.isValid()&&(y(g)&&g.isValid()||cn(g).isValid())?Co({to:this,from:g}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function bz(g){return this.from(cn(),g)}function wz(g,S){return this.isValid()&&(y(g)&&g.isValid()||cn(g).isValid())?Co({from:this,to:g}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function _z(g){return this.to(cn(),g)}function SC(g){var S;return g===void 0?this._locale._abbr:(S=Ss(g),S!=null&&(this._locale=S),this)}var EC=D("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 TC(){return this._locale}var rd=1e3,dc=60*rd,nd=60*dc,DC=(365*400+97)*24*nd;function hc(g,S){return(g%S+S)%S}function MC(g,S,I){return g<100&&g>=0?new Date(g+400,S,I)-DC:new Date(g,S,I).valueOf()}function CC(g,S,I){return g<100&&g>=0?Date.UTC(g+400,S,I)-DC:Date.UTC(g,S,I)}function Az(g){var S,I;if(g=Ee(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?CC:MC,g){case"year":S=I(this.year(),0,1);break;case"quarter":S=I(this.year(),this.month()-this.month()%3,1);break;case"month":S=I(this.year(),this.month(),1);break;case"week":S=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":S=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":S=I(this.year(),this.month(),this.date());break;case"hour":S=this._d.valueOf(),S-=hc(S+(this._isUTC?0:this.utcOffset()*dc),nd);break;case"minute":S=this._d.valueOf(),S-=hc(S,dc);break;case"second":S=this._d.valueOf(),S-=hc(S,rd);break}return this._d.setTime(S),e.updateOffset(this,!0),this}function Sz(g){var S,I;if(g=Ee(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?CC:MC,g){case"year":S=I(this.year()+1,0,1)-1;break;case"quarter":S=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":S=I(this.year(),this.month()+1,1)-1;break;case"week":S=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":S=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":S=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":S=this._d.valueOf(),S+=nd-hc(S+(this._isUTC?0:this.utcOffset()*dc),nd)-1;break;case"minute":S=this._d.valueOf(),S+=dc-hc(S,dc)-1;break;case"second":S=this._d.valueOf(),S+=rd-hc(S,rd)-1;break}return this._d.setTime(S),e.updateOffset(this,!0),this}function Ez(){return this._d.valueOf()-(this._offset||0)*6e4}function Tz(){return Math.floor(this.valueOf()/1e3)}function Dz(){return new Date(this.valueOf())}function Mz(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function Cz(){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 Nz(){return this.isValid()?this.toISOString():null}function Fz(){return x(this)}function Iz(){return f({},d(this))}function Pz(){return d(this).overflow}function Bz(){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"),ze("N",Cx),ze("NN",Cx),ze("NNN",Cx),ze("NNNN",Gz),ze("NNNNN",Wz),$r(["N","NN","NNN","NNNN","NNNNN"],function(g,S,I,$){var H=I._locale.erasParse(g,$,I._strict);H?d(I).era=H:d(I).invalidEra=g}),ze("y",Ae),ze("yy",Ae),ze("yyy",Ae),ze("yyyy",Ae),ze("yo",Yz),$r(["y","yy","yyy","yyyy"],Bn),$r(["yo"],function(g,S,I,$){var H;I._locale._eraYearOrdinalRegex&&(H=g.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?S[Bn]=I._locale.eraYearOrdinalParse(g,H):S[Bn]=parseInt(g,10)});function kz(g,S){var I,$,H,oe=this._eras||Ss("en")._eras;for(I=0,$=oe.length;I<$;++I){switch(typeof oe[I].since){case"string":H=e(oe[I].since).startOf("day"),oe[I].since=H.valueOf();break}switch(typeof oe[I].until){case"undefined":oe[I].until=1/0;break;case"string":H=e(oe[I].until).startOf("day").valueOf(),oe[I].until=H.valueOf();break}}return oe}function $z(g,S,I){var $,H,oe=this.eras(),Me,dt,tr;for(g=g.toUpperCase(),$=0,H=oe.length;$<H;++$)if(Me=oe[$].name.toUpperCase(),dt=oe[$].abbr.toUpperCase(),tr=oe[$].narrow.toUpperCase(),I)switch(S){case"N":case"NN":case"NNN":if(dt===g)return oe[$];break;case"NNNN":if(Me===g)return oe[$];break;case"NNNNN":if(tr===g)return oe[$];break}else if([Me,dt,tr].indexOf(g)>=0)return oe[$]}function Oz(g,S){var I=g.since<=g.until?1:-1;return S===void 0?e(g.since).year():e(g.since).year()+(S-g.offset)*I}function Rz(){var g,S,I,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(I=this.clone().startOf("day").valueOf(),$[g].since<=I&&I<=$[g].until||$[g].until<=I&&I<=$[g].since)return $[g].name;return""}function Lz(){var g,S,I,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(I=this.clone().startOf("day").valueOf(),$[g].since<=I&&I<=$[g].until||$[g].until<=I&&I<=$[g].since)return $[g].narrow;return""}function Vz(){var g,S,I,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(I=this.clone().startOf("day").valueOf(),$[g].since<=I&&I<=$[g].until||$[g].until<=I&&I<=$[g].since)return $[g].abbr;return""}function Uz(){var g,S,I,$,H=this.localeData().eras();for(g=0,S=H.length;g<S;++g)if(I=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())*I+H[g].offset;return this.year()}function qz(g){return a(this,"_erasNameRegex")||Nx.call(this),g?this._erasNameRegex:this._erasRegex}function zz(g){return a(this,"_erasAbbrRegex")||Nx.call(this),g?this._erasAbbrRegex:this._erasRegex}function Hz(g){return a(this,"_erasNarrowRegex")||Nx.call(this),g?this._erasNarrowRegex:this._erasRegex}function Cx(g,S){return S.erasAbbrRegex(g)}function Gz(g,S){return S.erasNameRegex(g)}function Wz(g,S){return S.erasNarrowRegex(g)}function Yz(g,S){return S._eraYearOrdinalRegex||Ae}function Nx(){var g=[],S=[],I=[],$=[],H,oe,Me,dt,tr,Dr=this.eras();for(H=0,oe=Dr.length;H<oe;++H)Me=un(Dr[H].name),dt=un(Dr[H].abbr),tr=un(Dr[H].narrow),S.push(Me),g.push(dt),I.push(tr),$.push(Me),$.push(dt),$.push(tr);this._erasRegex=new RegExp("^("+$.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+S.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+g.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+I.join("|")+")","i")}U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100});function id(g,S){U(0,[g,g.length],0,S)}id("gggg","weekYear"),id("ggggg","weekYear"),id("GGGG","isoWeekYear"),id("GGGGG","isoWeekYear"),ze("G",Xe),ze("g",Xe),ze("GG",Oe,Ye),ze("gg",Oe,Ye),ze("GGGG",Fe,Jt),ze("gggg",Fe,Jt),ze("GGGGG",ke,yr),ze("ggggg",ke,yr),aa(["gggg","ggggg","GGGG","GGGGG"],function(g,S,I,$){S[$.substr(0,2)]=hr(g)}),aa(["gg","GG"],function(g,S,I,$){S[$]=e.parseTwoDigitYear(g)});function jz(g){return NC.call(this,g,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Zz(g){return NC.call(this,g,this.isoWeek(),this.isoWeekday(),1,4)}function Jz(){return As(this.year(),1,4)}function Xz(){return As(this.isoWeekYear(),1,4)}function Qz(){var g=this.localeData()._week;return As(this.year(),g.dow,g.doy)}function Kz(){var g=this.localeData()._week;return As(this.weekYear(),g.dow,g.doy)}function NC(g,S,I,$,H){var oe;return g==null?np(this,$,H).year:(oe=As(g,$,H),S>oe&&(S=oe),e7.call(this,g,S,I,$,H))}function e7(g,S,I,$,H){var oe=sC(g,S,I,$,H),Me=rp(oe.year,0,oe.dayOfYear);return this.year(Me.getUTCFullYear()),this.month(Me.getUTCMonth()),this.date(Me.getUTCDate()),this}U("Q",0,"Qo","quarter"),ze("Q",St),$r("Q",function(g,S){S[Zn]=(hr(g)-1)*3});function t7(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}U("D",["DD",2],"Do","date"),ze("D",Oe,tt),ze("DD",Oe,Ye),ze("Do",function(g,S){return g?S._dayOfMonthOrdinalParse||S._ordinalParse:S._dayOfMonthOrdinalParseLenient}),$r(["D","DD"],oa),$r("Do",function(g,S){S[oa]=hr(g.match(Oe)[0])});var FC=Ko("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),ze("DDD",me),ze("DDDD",ur),$r(["DDD","DDDD"],function(g,S,I){I._dayOfYear=hr(g)});function r7(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"),ze("m",Oe,vt),ze("mm",Oe,Ye),$r(["m","mm"],ii);var n7=Ko("Minutes",!1);U("s",["ss",2],0,"second"),ze("s",Oe,vt),ze("ss",Oe,Ye),$r(["s","ss"],kn);var i7=Ko("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}),ze("S",me,St),ze("SS",me,Ye),ze("SSS",me,ur);var pu,IC;for(pu="SSSS";pu.length<=9;pu+="S")ze(pu,Ae);function a7(g,S){S[sa]=hr(("0."+g)*1e3)}for(pu="S";pu.length<=9;pu+="S")$r(pu,a7);IC=Ko("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");function o7(){return this._isUTC?"UTC":""}function s7(){return this._isUTC?"Coordinated Universal Time":""}var Ze=w.prototype;Ze.add=Kq,Ze.calendar=oz,Ze.clone=sz,Ze.diff=dz,Ze.endOf=Sz,Ze.format=yz,Ze.from=xz,Ze.fromNow=bz,Ze.to=wz,Ze.toNow=_z,Ze.get=pc,Ze.invalidAt=Pz,Ze.isAfter=uz,Ze.isBefore=lz,Ze.isBetween=cz,Ze.isSame=fz,Ze.isSameOrAfter=pz,Ze.isSameOrBefore=mz,Ze.isValid=Fz,Ze.lang=EC,Ze.locale=SC,Ze.localeData=TC,Ze.max=Fq,Ze.min=Nq,Ze.parsingFlags=Iz,Ze.set=ep,Ze.startOf=Az,Ze.subtract=ez,Ze.toArray=Mz,Ze.toObject=Cz,Ze.toDate=Dz,Ze.toISOString=gz,Ze.inspect=vz,typeof Symbol<"u"&&Symbol.for!=null&&(Ze[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ze.toJSON=Nz,Ze.toString=hz,Ze.unix=Tz,Ze.valueOf=Ez,Ze.creationData=Bz,Ze.eraName=Rz,Ze.eraNarrow=Lz,Ze.eraAbbr=Vz,Ze.eraYear=Uz,Ze.year=ws,Ze.isLeapYear=cc,Ze.weekYear=jz,Ze.isoWeekYear=Zz,Ze.quarter=Ze.quarters=t7,Ze.month=aC,Ze.daysInMonth=D9,Ze.week=Ze.weeks=k9,Ze.isoWeek=Ze.isoWeeks=$9,Ze.weeksInYear=Qz,Ze.weeksInWeekYear=Kz,Ze.isoWeeksInYear=Jz,Ze.isoWeeksInISOWeekYear=Xz,Ze.date=FC,Ze.day=Ze.days=Z9,Ze.weekday=J9,Ze.isoWeekday=X9,Ze.dayOfYear=r7,Ze.hour=Ze.hours=iq,Ze.minute=Ze.minutes=n7,Ze.second=Ze.seconds=i7,Ze.millisecond=Ze.milliseconds=IC,Ze.utcOffset=Vq,Ze.utc=qq,Ze.local=zq,Ze.parseZone=Hq,Ze.hasAlignedHourOffset=Gq,Ze.isDST=Wq,Ze.isLocal=jq,Ze.isUtcOffset=Zq,Ze.isUtc=xC,Ze.isUTC=xC,Ze.zoneAbbr=o7,Ze.zoneName=s7,Ze.dates=D("dates accessor is deprecated. Use date instead.",FC),Ze.months=D("months accessor is deprecated. Use month instead",aC),Ze.years=D("years accessor is deprecated. Use year instead",ws),Ze.zone=D("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Uq),Ze.isDSTShifted=D("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Yq);function u7(g){return cn(g*1e3)}function l7(){return cn.apply(null,arguments).parseZone()}function PC(g){return g}var Rr=L.prototype;Rr.calendar=B,Rr.longDateFormat=Z,Rr.invalidDate=de,Rr.ordinal=_e,Rr.preparse=PC,Rr.postformat=PC,Rr.relativeTime=J,Rr.pastFuture=ge,Rr.set=P,Rr.eras=kz,Rr.erasParse=$z,Rr.erasConvertYear=Oz,Rr.erasAbbrRegex=zz,Rr.erasNameRegex=qz,Rr.erasNarrowRegex=Hz,Rr.months=Or,Rr.monthsShort=Rn,Rr.monthsParse=_s,Rr.monthsRegex=C9,Rr.monthsShortRegex=M9,Rr.week=F9,Rr.firstDayOfYear=B9,Rr.firstDayOfWeek=P9,Rr.weekdays=H9,Rr.weekdaysMin=W9,Rr.weekdaysShort=G9,Rr.weekdaysParse=j9,Rr.weekdaysRegex=Q9,Rr.weekdaysShortRegex=K9,Rr.weekdaysMinRegex=eq,Rr.isPM=rq,Rr.meridiem=aq;function ad(g,S,I,$){var H=Ss(),oe=m().set($,S);return H[I](oe,g)}function BC(g,S,I){if(l(g)&&(S=g,g=void 0),g=g||"",S!=null)return ad(g,S,I,"month");var $,H=[];for($=0;$<12;$++)H[$]=ad(g,$,I,"month");return H}function Fx(g,S,I,$){typeof g=="boolean"?(l(S)&&(I=S,S=void 0),S=S||""):(S=g,I=S,g=!1,l(S)&&(I=S,S=void 0),S=S||"");var H=Ss(),oe=g?H._week.dow:0,Me,dt=[];if(I!=null)return ad(S,(I+oe)%7,$,"day");for(Me=0;Me<7;Me++)dt[Me]=ad(S,(Me+oe)%7,$,"day");return dt}function c7(g,S){return BC(g,S,"months")}function f7(g,S){return BC(g,S,"monthsShort")}function p7(g,S,I){return Fx(g,S,I,"weekdays")}function m7(g,S,I){return Fx(g,S,I,"weekdaysShort")}function d7(g,S,I){return Fx(g,S,I,"weekdaysMin")}fu("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,I=hr(g%100/10)===1?"th":S===1?"st":S===2?"nd":S===3?"rd":"th";return g+I}}),e.lang=D("moment.lang is deprecated. Use moment.locale instead.",fu),e.langData=D("moment.langData is deprecated. Use moment.localeData instead.",Ss);var Es=Math.abs;function h7(){var g=this._data;return this._milliseconds=Es(this._milliseconds),this._days=Es(this._days),this._months=Es(this._months),g.milliseconds=Es(g.milliseconds),g.seconds=Es(g.seconds),g.minutes=Es(g.minutes),g.hours=Es(g.hours),g.months=Es(g.months),g.years=Es(g.years),this}function kC(g,S,I,$){var H=Co(S,I);return g._milliseconds+=$*H._milliseconds,g._days+=$*H._days,g._months+=$*H._months,g._bubble()}function g7(g,S){return kC(this,g,S,1)}function v7(g,S){return kC(this,g,S,-1)}function $C(g){return g<0?Math.floor(g):Math.ceil(g)}function y7(){var g=this._milliseconds,S=this._days,I=this._months,$=this._data,H,oe,Me,dt,tr;return g>=0&&S>=0&&I>=0||g<=0&&S<=0&&I<=0||(g+=$C(Ix(I)+S)*864e5,S=0,I=0),$.milliseconds=g%1e3,H=jn(g/1e3),$.seconds=H%60,oe=jn(H/60),$.minutes=oe%60,Me=jn(oe/60),$.hours=Me%24,S+=jn(Me/24),tr=jn(OC(S)),I+=tr,S-=$C(Ix(tr)),dt=jn(I/12),I%=12,$.days=S,$.months=I,$.years=dt,this}function OC(g){return g*4800/146097}function Ix(g){return g*146097/4800}function x7(g){if(!this.isValid())return NaN;var S,I,$=this._milliseconds;if(g=Ee(g),g==="month"||g==="quarter"||g==="year")switch(S=this._days+$/864e5,I=this._months+OC(S),g){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(S=this._days+Math.round(Ix(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 Ts(g){return function(){return this.as(g)}}var RC=Ts("ms"),b7=Ts("s"),w7=Ts("m"),_7=Ts("h"),A7=Ts("d"),S7=Ts("w"),E7=Ts("M"),T7=Ts("Q"),D7=Ts("y"),M7=RC;function C7(){return Co(this)}function N7(g){return g=Ee(g),this.isValid()?this[g+"s"]():NaN}function sl(g){return function(){return this.isValid()?this._data[g]:NaN}}var F7=sl("milliseconds"),I7=sl("seconds"),P7=sl("minutes"),B7=sl("hours"),k7=sl("days"),$7=sl("months"),O7=sl("years");function R7(){return jn(this.days()/7)}var Ds=Math.round,gc={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function L7(g,S,I,$,H){return H.relativeTime(S||1,!!I,g,$)}function V7(g,S,I,$){var H=Co(g).abs(),oe=Ds(H.as("s")),Me=Ds(H.as("m")),dt=Ds(H.as("h")),tr=Ds(H.as("d")),Dr=Ds(H.as("M")),Wi=Ds(H.as("w")),Ms=Ds(H.as("y")),mu=oe<=I.ss&&["s",oe]||oe<I.s&&["ss",oe]||Me<=1&&["m"]||Me<I.m&&["mm",Me]||dt<=1&&["h"]||dt<I.h&&["hh",dt]||tr<=1&&["d"]||tr<I.d&&["dd",tr];return I.w!=null&&(mu=mu||Wi<=1&&["w"]||Wi<I.w&&["ww",Wi]),mu=mu||Dr<=1&&["M"]||Dr<I.M&&["MM",Dr]||Ms<=1&&["y"]||["yy",Ms],mu[2]=S,mu[3]=+g>0,mu[4]=$,L7.apply(null,mu)}function U7(g){return g===void 0?Ds:typeof g=="function"?(Ds=g,!0):!1}function q7(g,S){return gc[g]===void 0?!1:S===void 0?gc[g]:(gc[g]=S,g==="s"&&(gc.ss=S-1),!0)}function z7(g,S){if(!this.isValid())return this.localeData().invalidDate();var I=!1,$=gc,H,oe;return typeof g=="object"&&(S=g,g=!1),typeof g=="boolean"&&(I=g),typeof S=="object"&&($=Object.assign({},gc,S),S.s!=null&&S.ss==null&&($.ss=S.s-1)),H=this.localeData(),oe=V7(this,!I,$,H),I&&(oe=H.pastFuture(+this,oe)),H.postformat(oe)}var Px=Math.abs;function vc(g){return(g>0)-(g<0)||+g}function od(){if(!this.isValid())return this.localeData().invalidDate();var g=Px(this._milliseconds)/1e3,S=Px(this._days),I=Px(this._months),$,H,oe,Me,dt=this.asSeconds(),tr,Dr,Wi,Ms;return dt?($=jn(g/60),H=jn($/60),g%=60,$%=60,oe=jn(I/12),I%=12,Me=g?g.toFixed(3).replace(/\.?0+$/,""):"",tr=dt<0?"-":"",Dr=vc(this._months)!==vc(dt)?"-":"",Wi=vc(this._days)!==vc(dt)?"-":"",Ms=vc(this._milliseconds)!==vc(dt)?"-":"",tr+"P"+(oe?Dr+oe+"Y":"")+(I?Dr+I+"M":"")+(S?Wi+S+"D":"")+(H||$||g?"T":"")+(H?Ms+H+"H":"")+($?Ms+$+"M":"")+(g?Ms+Me+"S":"")):"P0D"}var Cr=Km.prototype;Cr.isValid=$q,Cr.abs=h7,Cr.add=g7,Cr.subtract=v7,Cr.as=x7,Cr.asMilliseconds=RC,Cr.asSeconds=b7,Cr.asMinutes=w7,Cr.asHours=_7,Cr.asDays=A7,Cr.asWeeks=S7,Cr.asMonths=E7,Cr.asQuarters=T7,Cr.asYears=D7,Cr.valueOf=M7,Cr._bubble=y7,Cr.clone=C7,Cr.get=N7,Cr.milliseconds=F7,Cr.seconds=I7,Cr.minutes=P7,Cr.hours=B7,Cr.days=k7,Cr.weeks=R7,Cr.months=$7,Cr.years=O7,Cr.humanize=z7,Cr.toISOString=od,Cr.toString=od,Cr.toJSON=od,Cr.locale=SC,Cr.localeData=TC,Cr.toIsoString=D("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",od),Cr.lang=EC,U("X",0,0,"unix"),U("x",0,0,"valueOf"),ze("x",Xe),ze("X",ae),$r("X",function(g,S,I){I._d=new Date(parseFloat(g)*1e3)}),$r("x",function(g,S,I){I._d=new Date(hr(g))});return e.version="2.30.1",r(cn),e.fn=Ze,e.min=Iq,e.max=Pq,e.now=Bq,e.utc=m,e.unix=u7,e.months=c7,e.isDate=u,e.locale=fu,e.invalid=b,e.duration=Co,e.isMoment=y,e.weekdays=p7,e.parseZone=l7,e.localeData=Ss,e.isDuration=ed,e.monthsShort=f7,e.weekdaysMin=d7,e.defineLocale=bx,e.updateLocale=lq,e.locales=cq,e.weekdaysShort=m7,e.normalizeUnits=Ee,e.relativeTimeRounding=U7,e.relativeTimeThreshold=q7,e.calendarFormat=az,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 Fd=ai(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.P_HELPERS=la.ParserHelpers=la.validateRegexFlags=la.validateRange=la.getIndex=la.arrayUnion=void 0;var Jx=Id();function cH(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}la.arrayUnion=cH;function fH(t){return t===void 0?-1:t.index}la.getIndex=fH;function pH(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}].`)}la.validateRange=pH;function mH(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'.`)}la.validateRegexFlags=mH;var Nd=class{followedBy(e){return new Jx.Parser(function(n){return e.p(n.copy())})}notFollowedBy(e){return new Jx.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 Jx.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}`)})}};la.ParserHelpers=Nd;la.P_HELPERS=new Nd});var oF=ai(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.ParserContext=void 0;var Xx=Fd(),Qx=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,Xx.getIndex)(e.furthest),i=(0,Xx.getIndex)(r.furthest);if(i>n)return r;let a=i===n?(0,Xx.arrayUnion)(e.expected,r.expected):e.expected;return r.furthest=e.furthest,r.expected=a,r}};Pd.ParserContext=Qx});var Ma=ai(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.P_UTILS=void 0;var Bd=Id(),en=ca(),Kx=class t{static position(){return new Bd.Parser(e=>e.succeed(e.getPosition()))}static any(){return new Bd.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new Bd.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new Bd.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return en.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return en.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return en.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return en.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return en.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return en.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return en.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return en.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return en.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return en.P.regexp(/^\s+/).describe("whitespace")}static cr(){return en.P.string("\r")}static lf(){return en.P.string(`
`)}static crlf(){return en.P.string(`\r
`)}static newline(){return en.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,r,n){return en.P.sequenceMap((i,a)=>i.reduce((o,s)=>n(s,o),a),e.many(),r)}static postfix(e,r,n){return en.P.sequenceMap((i,a)=>a.reduce((o,s)=>n(s,o),i),r,e.many())}static binaryRight(e,r,n){return en.P.sequenceMap((i,a)=>i.reverse().reduce((o,s)=>{let[l,u]=s;return n(l,u,o)},a),en.P.sequence(r,e.trim(this.optionalWhitespace())).many(),r)}static binaryLeft(e,r,n){return en.P.sequenceMap((i,a)=>a.reduce((o,s)=>{let[l,u]=s;return n(o,l,u)},i),r,en.P.sequence(e.trim(this.optionalWhitespace()),r).many())}static binaryRightRange(e,r,n){return en.P.sequenceMap((i,a,o)=>i.reverse().reduce((s,l)=>{let[u,c,f]=l;return n({from:u,to:o},c,f,s)},a),en.P.sequence(t.position(),r,e.trim(this.optionalWhitespace())).many(),r,t.position())}static binaryLeftRange(e,r,n){return en.P.sequenceMap((i,a,o)=>o.reduce((s,l)=>{let[u,c,f]=l;return n({from:i,to:f},s,u,c)},a),t.position(),r,en.P.sequence(e.trim(this.optionalWhitespace()),r,t.position()).many())}static func(e,r,n){let i=typeof e=="string"?en.P.string(e):e;return en.P.sequenceMap((a,o,s,l,u,c)=>n(a,l),i,en.P.string("("),this.optionalWhitespace(),r,this.optionalWhitespace(),en.P.string(")"))}};kd.P_UTILS=Kx});var uF=ai(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.ParsingError=Tc.createParsingErrorMessage=void 0;function sF(t,e,r){let n=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${n} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(r){let o=t.split(`
`)[e.furthest.line-1],s=`${e.furthest.line} | `;i+=`
${s}${o}`,i+=`
${" ".repeat(e.furthest.column-1+s.length)}^ (${n})`}return i}Tc.createParsingErrorMessage=sF;var eb=class extends Error{constructor(e,r){super(sF(e,r,!0))}};Tc.ParsingError=eb});var Id=ai($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});$d.Parser=void 0;var dH=oF(),no=ca(),tb=Fd(),Dc=Ma(),hH=uF(),rb=class t{constructor(e){this.p=e}tryParse(e){return this.p(new dH.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let r=this.tryParse(e);if(r.success)return r.value;throw new hH.ParsingError(e,r)}or(e){return no.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(no.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(no.P.string(e),no.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 no.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,tb.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 no.P.sequenceMap((r,n)=>r.concat(n),this.repeat(e,e),this.many())}separateBy(e){return no.P.separateBy(this,e)}separateByNotEmpty(e){return no.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 no.P.sequenceMap(function(r,n,i){return{value:n,range:{from:r,to:i}}},Dc.P_UTILS.position(),this,Dc.P_UTILS.position())}namedMarker(e){return no.P.sequenceMap(function(n,i,a){return{value:i,name:e,range:{from:n,to:a}}},Dc.P_UTILS.position(),this,Dc.P_UTILS.position())}node(e){return no.P.sequenceMap(function(n,i,a){return e(i,{from:n,to:a})},Dc.P_UTILS.position(),this,Dc.P_UTILS.position())}followedBy(e){return this.skip(tb.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(tb.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(no.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})}};$d.Parser=rb});var ca=ai(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.P=void 0;var Ca=Id(),Od=Fd(),nb=class t{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Ca.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let l=e[o].p(n);if(i=n.merge(i,l),!i.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 Ca.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 Ca.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 Ca.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,Od.validateRegexFlags)(e.flags);let n=e.source;return r!==void 0?new Ca.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 Ca.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 Ca.Parser(function(n){return n.succeed(e)})}static fail(e){return new Ca.Parser(function(n){return n.fail(e)})}static oneOf(e){return Od.P_HELPERS.test(function(n){return e.includes(n)}).describe(`one character of '${e}'`)}static noneOf(e){return Od.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 Ca.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 Ca.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 Ca.Parser(e)}static range(e,r){let n=e.charCodeAt(0),i=r.charCodeAt(0);return Od.P_HELPERS.test(function(o){let s=o.charCodeAt(0);return n<=s&&s<=i}).describe(`${e}-${r}`)}static takeWhile(e){return new Ca.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 Ca.Parser(function(n){return e().p(n)})}};Rd.P=nb});var k0=ai((P0,B0)=>{(function(t,e){typeof P0=="object"&&typeof B0<"u"?B0.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t["'typed'"]=e())})(P0,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 he=u.get(j);if(he)return he;let me='Unknown type "'+j+'"',Fe=j.toLowerCase(),ke;for(ke of c)if(ke.toLowerCase()===Fe){me+='. Did you mean "'+ke+'" ?';break}throw new TypeError(me)}function d(j){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",me=he?p(he).index:c.length,Fe=[];for(let Ae=0;Ae<j.length;++Ae){if(!j[Ae]||typeof j[Ae].name!="string"||typeof j[Ae].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let Xe=j[Ae].name;if(u.has(Xe))throw new TypeError('Duplicate type name "'+Xe+'"');Fe.push(Xe),u.set(Xe,{name:Xe,test:j[Ae].test,isAny:j[Ae].isAny,index:me+Ae,conversionsTo:[]})}let ke=c.slice(me);c=c.slice(0,me).concat(Fe).concat(ke);for(let Ae=me+Fe.length;Ae<c.length;++Ae)u.get(c[Ae]).index=Ae}function h(){u=new Map,c=[],f=0,d([l],!1)}h(),d(s);function x(){let j;for(j of c)u.get(j).conversionsTo=[];f=0}function b(j){let he=c.filter(me=>{let Fe=u.get(me);return!Fe.isAny&&Fe.test(j)});return he.length?he:["any"]}function T(j){return j&&typeof j=="function"&&"_typedFunctionData"in j}function v(j,he,me){if(!T(j))throw new TypeError(n);let Fe=me&&me.exact,ke=Array.isArray(he)?he.join(","):he,Ae=C(ke),Xe=y(Ae);if(!Fe||Xe in j.signatures){let Ce=j._typedFunctionData.signatureMap.get(Xe);if(Ce)return Ce}let F=Ae.length,Y;if(Fe){Y=[];let Ce;for(Ce in j.signatures)Y.push(j._typedFunctionData.signatureMap.get(Ce))}else Y=j._typedFunctionData.signatures;for(let Ce=0;Ce<F;++Ce){let tt=Ae[Ce],vt=[],_r;for(_r of Y){let ze=L(_r.params,Ce);if(!(!ze||tt.restParam&&!ze.restParam)){if(!ze.hasAny){let Ti=_(ze);if(tt.types.some(Gi=>!Ti.has(Gi.name)))continue}vt.push(_r)}}if(Y=vt,Y.length===0)break}let ae;for(ae of Y)if(ae.params.length<=F)return ae;throw new TypeError("Signature not found (signature: "+(j.name||"unnamed")+"("+y(Ae,", ")+"))")}function A(j,he,me){return v(j,he,me).implementation}function w(j,he){let me=p(he);if(me.test(j))return j;let Fe=me.conversionsTo;if(Fe.length===0)throw new Error("There are no conversions to "+he+" defined.");for(let ke=0;ke<Fe.length;ke++)if(p(Fe[ke].from).test(j))return Fe[ke].convert(j);throw new Error("Cannot convert "+j+" to "+he)}function y(j){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return j.map(me=>me.name).join(he)}function E(j){let he=j.indexOf("...")===0,Fe=(he?j.length>3?j.slice(3):"any":j).split("|").map(F=>p(F.trim())),ke=!1,Ae=he?"...":"";return{types:Fe.map(function(F){return ke=F.isAny||ke,Ae+=F.name+"|",{name:F.name,typeIndex:F.index,test:F.test,isAny:F.isAny,conversion:null,conversionIndex:-1}}),name:Ae.slice(0,-1),hasAny:ke,hasConversion:!1,restParam:he}}function D(j){let he=j.types.map(Xe=>Xe.name),me=U(he),Fe=j.hasAny,ke=j.name,Ae=me.map(function(Xe){let F=p(Xe.from);return Fe=F.isAny||Fe,ke+="|"+Xe.from,{name:Xe.from,typeIndex:F.index,test:F.test,isAny:F.isAny,conversion:Xe,conversionIndex:Xe.index}});return{types:j.types.concat(Ae),name:ke,hasAny:Fe,hasConversion:Ae.length>0,restParam:j.restParam}}function _(j){return j.typeSet||(j.typeSet=new Set,j.types.forEach(he=>j.typeSet.add(he.name))),j.typeSet}function C(j){let he=[];if(typeof j!="string")throw new TypeError("Signatures must be strings");let me=j.trim();if(me==="")return he;let Fe=me.split(",");for(let ke=0;ke<Fe.length;++ke){let Ae=E(Fe[ke].trim());if(Ae.restParam&&ke!==Fe.length-1)throw new SyntaxError('Unexpected rest parameter "'+Fe[ke]+'": only allowed for the last parameter');if(Ae.types.length===0)return null;he.push(Ae)}return he}function N(j){let he=G(j);return he?he.restParam:!1}function P(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 he=p(j.types[0].name).test,me=p(j.types[1].name).test;return function(ke){return he(ke)||me(ke)}}else{let he=j.types.map(function(me){return p(me.name).test});return function(Fe){for(let ke=0;ke<he.length;ke++)if(he[ke](Fe))return!0;return!1}}}function R(j){let he,me,Fe;if(N(j)){he=_e(j).map(P);let ke=he.length,Ae=P(G(j)),Xe=function(F){for(let Y=ke;Y<F.length;Y++)if(!Ae(F[Y]))return!1;return!0};return function(Y){for(let ae=0;ae<he.length;ae++)if(!he[ae](Y[ae]))return!1;return Xe(Y)&&Y.length>=ke+1}}else return j.length===0?function(Ae){return Ae.length===0}:j.length===1?(me=P(j[0]),function(Ae){return me(Ae[0])&&Ae.length===1}):j.length===2?(me=P(j[0]),Fe=P(j[1]),function(Ae){return me(Ae[0])&&Fe(Ae[1])&&Ae.length===2}):(he=j.map(P),function(Ae){for(let Xe=0;Xe<he.length;Xe++)if(!he[Xe](Ae[Xe]))return!1;return Ae.length===he.length})}function L(j,he){return he<j.length?j[he]:N(j)?G(j):null}function V(j,he){let me=L(j,he);return me?_(me):new Set}function k(j){return j.conversion===null||j.conversion===void 0}function B(j,he){let me=new Set;return j.forEach(Fe=>{let ke=V(Fe.params,he),Ae;for(Ae of ke)me.add(Ae)}),me.has("any")?["any"]:Array.from(me)}function W(j,he,me){let Fe,ke,Ae=j||"unnamed",Xe=me,F;for(F=0;F<he.length;F++){let tt=[];if(Xe.forEach(vt=>{let _r=L(vt.params,F),ze=P(_r);(F<vt.params.length||N(vt.params))&&ze(he[F])&&tt.push(vt)}),tt.length===0){if(ke=B(Xe,F),ke.length>0){let vt=b(he[F]);return Fe=new TypeError("Unexpected type of argument in function "+Ae+" (expected: "+ke.join(" or ")+", actual: "+vt.join(" | ")+", index: "+F+")"),Fe.data={category:"wrongType",fn:Ae,index:F,actual:vt,expected:ke},Fe}}else Xe=tt}let Y=Xe.map(function(tt){return N(tt.params)?1/0:tt.params.length});if(he.length<Math.min.apply(null,Y))return ke=B(Xe,F),Fe=new TypeError("Too few arguments in function "+Ae+" (expected: "+ke.join(" or ")+", index: "+he.length+")"),Fe.data={category:"tooFewArgs",fn:Ae,index:he.length,expected:ke},Fe;let ae=Math.max.apply(null,Y);if(he.length>ae)return Fe=new TypeError("Too many arguments in function "+Ae+" (expected: "+ae+", actual: "+he.length+")"),Fe.data={category:"tooManyArgs",fn:Ae,index:he.length,expectedLength:ae},Fe;let Ce=[];for(let tt=0;tt<he.length;++tt)Ce.push(b(he[tt]).join("|"));return Fe=new TypeError('Arguments of type "'+Ce.join(", ")+'" do not match any of the defined signatures of function '+Ae+"."),Fe.data={category:"mismatch",actual:Ce},Fe}function O(j){let he=c.length+1;for(let me=0;me<j.types.length;me++)k(j.types[me])&&(he=Math.min(he,j.types[me].typeIndex));return he}function Q(j){let he=f+1;for(let me=0;me<j.types.length;me++)k(j.types[me])||(he=Math.min(he,j.types[me].conversionIndex));return he}function ie(j,he){if(j.hasAny){if(!he.hasAny)return 1}else if(he.hasAny)return-1;if(j.restParam){if(!he.restParam)return 1}else if(he.restParam)return-1;if(j.hasConversion){if(!he.hasConversion)return 1}else if(he.hasConversion)return-1;let me=O(j)-O(he);if(me<0)return-1;if(me>0)return 1;let Fe=Q(j)-Q(he);return Fe<0?-1:Fe>0?1:0}function X(j,he){let me=j.params,Fe=he.params,ke=G(me),Ae=G(Fe),Xe=N(me),F=N(Fe);if(Xe&&ke.hasAny){if(!F||!Ae.hasAny)return 1}else if(F&&Ae.hasAny)return-1;let Y=0,ae=0,Ce;for(Ce of me)Ce.hasAny&&++Y,Ce.hasConversion&&++ae;let tt=0,vt=0;for(Ce of Fe)Ce.hasAny&&++tt,Ce.hasConversion&&++vt;if(Y!==tt)return Y-tt;if(Xe&&ke.hasConversion){if(!F||!Ae.hasConversion)return 1}else if(F&&Ae.hasConversion)return-1;if(ae!==vt)return ae-vt;if(Xe){if(!F)return 1}else if(F)return-1;let _r=(me.length-Fe.length)*(Xe?-1:1);if(_r!==0)return _r;let ze=[],Ti=0;for(let un=0;un<me.length;++un){let jn=ie(me[un],Fe[un]);ze.push(jn),Ti+=jn}if(Ti!==0)return Ti;let Gi;for(Gi of ze)if(Gi!==0)return Gi;return 0}function U(j){if(j.length===0)return[];let he=j.map(p);j.length>1&&he.sort((ke,Ae)=>ke.index-Ae.index);let me=he[0].conversionsTo;if(j.length===1)return me;me=me.concat([]);let Fe=new Set(j);for(let ke=1;ke<he.length;++ke){let Ae;for(Ae of he[ke].conversionsTo)Fe.has(Ae.from)||(me.push(Ae),Fe.add(Ae.from))}return me}function pe(j,he){let me=he;if(j.some(ke=>ke.hasConversion)){let ke=N(j),Ae=j.map(we);me=function(){let F=[],Y=ke?arguments.length-1:arguments.length;for(let ae=0;ae<Y;ae++)F[ae]=Ae[ae](arguments[ae]);return ke&&(F[Y]=arguments[Y].map(Ae[Y])),he.apply(this,F)}}let Fe=me;if(N(j)){let ke=j.length-1;Fe=function(){return me.apply(this,J(arguments,0,ke).concat([J(arguments,ke)]))}}return Fe}function we(j){let he,me,Fe,ke,Ae=[],Xe=[];switch(j.types.forEach(function(F){F.conversion&&(Ae.push(p(F.conversion.from).test),Xe.push(F.conversion.convert))}),Xe.length){case 0:return function(Y){return Y};case 1:return he=Ae[0],Fe=Xe[0],function(Y){return he(Y)?Fe(Y):Y};case 2:return he=Ae[0],me=Ae[1],Fe=Xe[0],ke=Xe[1],function(Y){return he(Y)?Fe(Y):me(Y)?ke(Y):Y};default:return function(Y){for(let ae=0;ae<Xe.length;ae++)if(Ae[ae](Y))return Xe[ae](Y);return Y}}}function se(j){function he(me,Fe,ke){if(Fe<me.length){let Ae=me[Fe],Xe=[];if(Ae.restParam){let F=Ae.types.filter(k);F.length<Ae.types.length&&Xe.push({types:F,name:"..."+F.map(Y=>Y.name).join("|"),hasAny:F.some(Y=>Y.isAny),hasConversion:!1,restParam:!0}),Xe.push(Ae)}else Xe=Ae.types.map(function(F){return{types:[F],name:F.name,hasAny:F.isAny,hasConversion:F.conversion,restParam:!1}});return xe(Xe,function(F){return he(me,Fe+1,ke.concat([F]))})}else return[ke]}return he(j,0,[])}function be(j,he){let me=Math.max(j.length,he.length);for(let F=0;F<me;F++){let Y=V(j,F),ae=V(he,F),Ce=!1,tt;for(tt of ae)if(Y.has(tt)){Ce=!0;break}if(!Ce)return!1}let Fe=j.length,ke=he.length,Ae=N(j),Xe=N(he);return Ae?Xe?Fe===ke:ke>=Fe:Xe?Fe>=ke:Fe===ke}function ee(j){return j.map(he=>St(he)?Ue(he.referToSelf.callback):et(he)?Be(he.referTo.references,he.referTo.callback):he)}function Z(j,he,me){let Fe=[],ke;for(ke of j){let Ae=me[ke];if(typeof Ae!="number")throw new TypeError('No definition for referenced signature "'+ke+'"');if(Ae=he[Ae],typeof Ae!="function")return!1;Fe.push(Ae)}return Fe}function ne(j,he,me){let Fe=ee(j),ke=new Array(Fe.length).fill(!1),Ae=!0;for(;Ae;){Ae=!1;let Xe=!0;for(let F=0;F<Fe.length;++F){if(ke[F])continue;let Y=Fe[F];if(St(Y))Fe[F]=Y.referToSelf.callback(me),Fe[F].referToSelf=Y.referToSelf,ke[F]=!0,Xe=!1;else if(et(Y)){let ae=Z(Y.referTo.references,Fe,he);ae?(Fe[F]=Y.referTo.callback.apply(this,ae),Fe[F].referTo=Y.referTo,ke[F]=!0,Xe=!1):Ae=!0}}if(Xe&&Ae)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return Fe}function de(j){let he=/\bthis(\(|\.signatures\b)/;Object.keys(j).forEach(me=>{let Fe=j[me];if(he.test(Fe.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 fe(j,he){if(m.createCount++,Object.keys(he).length===0)throw new SyntaxError("No signatures provided");m.warnAgainstDeprecatedThis&&de(he);let me=[],Fe=[],ke={},Ae=[],Xe;for(Xe in he){if(!Object.prototype.hasOwnProperty.call(he,Xe))continue;let Ge=C(Xe);if(!Ge)continue;me.forEach(function(Ln){if(be(Ln,Ge))throw new TypeError('Conflicting signatures "'+y(Ln)+'" and "'+y(Ge)+'".')}),me.push(Ge);let qt=Fe.length;Fe.push(he[Xe]);let Or=Ge.map(D),Rn;for(Rn of se(Or)){let Ln=y(Rn);Ae.push({params:Rn,name:Ln,fn:qt}),Rn.every(_s=>!_s.hasConversion)&&(ke[Ln]=qt)}}Ae.sort(X);let F=ne(Fe,ke,Ke),Y;for(Y in ke)Object.prototype.hasOwnProperty.call(ke,Y)&&(ke[Y]=F[ke[Y]]);let ae=[],Ce=new Map;for(Y of Ae)Ce.has(Y.name)||(Y.fn=F[Y.fn],ae.push(Y),Ce.set(Y.name,Y));let tt=ae[0]&&ae[0].params.length<=2&&!N(ae[0].params),vt=ae[1]&&ae[1].params.length<=2&&!N(ae[1].params),_r=ae[2]&&ae[2].params.length<=2&&!N(ae[2].params),ze=ae[3]&&ae[3].params.length<=2&&!N(ae[3].params),Ti=ae[4]&&ae[4].params.length<=2&&!N(ae[4].params),Gi=ae[5]&&ae[5].params.length<=2&&!N(ae[5].params),un=tt&&vt&&_r&&ze&&Ti&&Gi;for(let Ge=0;Ge<ae.length;++Ge)ae[Ge].test=R(ae[Ge].params);let jn=tt?P(ae[0].params[0]):e,hr=vt?P(ae[1].params[0]):e,cu=_r?P(ae[2].params[0]):e,$r=ze?P(ae[3].params[0]):e,aa=Ti?P(ae[4].params[0]):e,eo=Gi?P(ae[5].params[0]):e,Da=tt?P(ae[0].params[1]):e,Bn=vt?P(ae[1].params[1]):e,Zn=_r?P(ae[2].params[1]):e,oa=ze?P(ae[3].params[1]):e,hn=Ti?P(ae[4].params[1]):e,ii=Gi?P(ae[5].params[1]):e;for(let Ge=0;Ge<ae.length;++Ge)ae[Ge].implementation=pe(ae[Ge].params,ae[Ge].fn);let kn=tt?ae[0].implementation:r,sa=vt?ae[1].implementation:r,Kf=_r?ae[2].implementation:r,lc=ze?ae[3].implementation:r,bs=Ti?ae[4].implementation:r,ws=Gi?ae[5].implementation:r,cc=tt?ae[0].params.length:-1,Ko=vt?ae[1].params.length:-1,Mo=_r?ae[2].params.length:-1,fc=ze?ae[3].params.length:-1,pc=Ti?ae[4].params.length:-1,ep=Gi?ae[5].params.length:-1,tp=un?6:0,ln=ae.length,q=ae.map(Ge=>Ge.test),re=ae.map(Ge=>Ge.implementation),Ne=function(){for(let qt=tp;qt<ln;qt++)if(q[qt](arguments))return re[qt].apply(this,arguments);return m.onMismatch(j,arguments,ae)};function Ke(Ge,qt){return arguments.length===cc&&jn(Ge)&&Da(qt)?kn.apply(this,arguments):arguments.length===Ko&&hr(Ge)&&Bn(qt)?sa.apply(this,arguments):arguments.length===Mo&&cu(Ge)&&Zn(qt)?Kf.apply(this,arguments):arguments.length===fc&&$r(Ge)&&oa(qt)?lc.apply(this,arguments):arguments.length===pc&&aa(Ge)&&hn(qt)?bs.apply(this,arguments):arguments.length===ep&&eo(Ge)&&ii(qt)?ws.apply(this,arguments):Ne.apply(this,arguments)}try{Object.defineProperty(Ke,"name",{value:j})}catch{}return Ke.signatures=ke,Ke._typedFunctionData={signatures:ae,signatureMap:Ce},Ke}function Se(j,he,me){throw W(j,he,me)}function _e(j){return J(j,0,j.length-1)}function G(j){return j[j.length-1]}function J(j,he,me){return Array.prototype.slice.call(j,he,me)}function ge(j,he){for(let me=0;me<j.length;me++)if(he(j[me]))return j[me]}function xe(j,he){return Array.prototype.concat.apply([],j.map(he))}function Ee(){let j=_e(arguments).map(me=>y(C(me))),he=G(arguments);if(typeof he!="function")throw new TypeError("Callback function expected as last argument");return Be(j,he)}function Be(j,he){return{referTo:{references:j,callback:he}}}function Ue(j){if(typeof j!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:j}}}function et(j){return j&&typeof j.referTo=="object"&&Array.isArray(j.referTo.references)&&typeof j.referTo.callback=="function"}function St(j){return j&&typeof j.referToSelf=="object"&&typeof j.referToSelf.callback=="function"}function Ye(j,he){if(!j)return he;if(he&&he!==j){let me=new Error("Function names do not match (expected: "+j+", actual: "+he+")");throw me.data={actual:he,expected:j},me}return j}function ur(j){let he;for(let me in j)Object.prototype.hasOwnProperty.call(j,me)&&(T(j[me])||typeof j[me].signature=="string")&&(he=Ye(he,j[me].name));return he}function Jt(j,he){let me;for(me in he)if(Object.prototype.hasOwnProperty.call(he,me)){if(me in j&&he[me]!==j[me]){let Fe=new Error('Signature "'+me+'" is defined twice');throw Fe.data={signature:me,sourceFunction:he[me],destFunction:j[me]},Fe}j[me]=he[me]}}let yr=m;m=function(j){let he=typeof j=="string",me=he?1:0,Fe=he?j:"",ke={};for(let Ae=me;Ae<arguments.length;++Ae){let Xe=arguments[Ae],F={},Y;if(typeof Xe=="function"?(Y=Xe.name,typeof Xe.signature=="string"?F[Xe.signature]=Xe:T(Xe)&&(F=Xe.signatures)):o(Xe)&&(F=Xe,he||(Y=ur(Xe))),Object.keys(F).length===0){let ae=new TypeError("Argument to 'typed' at index "+Ae+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw ae.data={index:Ae,argument:Xe},ae}he||(Fe=Ye(Fe,Y)),Jt(ke,F)}return fe(Fe||"",ke)},m.create=i,m.createCount=yr.createCount,m.onMismatch=Se,m.throwMismatchError=Se,m.createError=W,m.clear=h,m.clearConversions=x,m.addTypes=d,m._findType=p,m.referTo=Ee,m.referToSelf=Ue,m.convert=w,m.findSignature=v,m.find=A,m.isTypedFunction=T,m.warnAgainstDeprecatedThis=!0,m.addType=function(j,he){let me="any";he!==!1&&u.has("Object")&&(me="Object"),m.addTypes([j],me)};function Oe(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 he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};Oe(j);let me=p(j.to),Fe=me.conversionsTo.find(ke=>ke.from===j.from);if(Fe)if(he&&he.override)m.removeConversion({from:Fe.from,to:j.to,convert:Fe.convert});else throw new Error('There is already a conversion from "'+j.from+'" to "'+me.name+'"');me.conversionsTo.push({from:j.from,convert:j.convert,index:f++})},m.addConversions=function(j,he){j.forEach(me=>m.addConversion(me,he))},m.removeConversion=function(j){Oe(j);let he=p(j.to),me=ge(he.conversionsTo,ke=>ke.from===j.from);if(!me)throw new Error("Attempt to remove nonexistent conversion from "+j.from+" to "+j.to);if(me.convert!==j.convert)throw new Error("Conversion to remove does not match existing conversion");let Fe=he.conversionsTo.indexOf(me);he.conversionsTo.splice(Fe,1)},m.resolve=function(j,he){if(!T(j))throw new TypeError(n);let me=j._typedFunctionData.signatures;for(let Fe=0;Fe<me.length;++Fe)if(me[Fe].test(he))return me[Fe];return null},m}var a=i();return a})});var i$=ai((FLe,n$)=>{n$.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,x;if(d){if(p<d)return-1;if(p>d)return 1}for(var b=0,T=Math.max(f.length,m.length);b<T;b++){if(h=!(f[b]||"").match(s)&&parseFloat(f[b])||f[b]||0,x=!(m[b]||"").match(s)&&parseFloat(m[b])||m[b]||0,isNaN(h)!==isNaN(x))return isNaN(h)?1:-1;if(typeof h!=typeof x&&(h+="",x+=""),h<x)return-1;if(h>x)return 1}return 0}});var uO=ai((K5e,sO)=>{"use strict";var wS=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},ure={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},lre={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},cre=function(e,r){return wS({},e,r)};sO.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?cre:i,o=String(t),s="",l=a(wS({},ure),n?wS({},lre):{}),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 LV=ai((RV,_E)=>{(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})(RV,typeof _E=="object"&&_E,typeof define=="function"&&define)});var UV=ai((VV,AE)=>{(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})(VV,typeof AE=="object"&&AE,typeof define=="function"&&define)});var zV=ai((qV,SE)=>{(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})(qV,typeof SE=="object"&&SE,typeof define=="function"&&define)});var GV=ai((HV,EE)=>{(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})(HV,typeof EE=="object"&&EE,typeof define=="function"&&define)});var YV=ai((WV,TE)=>{(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,x=[],b=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,b=Math.max(b,c.length)),p=0,d=-32;d<b;++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=x[d&127]^=m+h,p=f==0?p+1:0);for(p>=128&&(x[(c&&c.length||0)&127]=-1),p=127,d=4*128;d>0;--d)m=x[p+34&127],f=x[p=p+1&127],m^=m<<13,f^=f<<17,m^=m>>>15,f^=f>>>12,x[p]=m^f;u.w=h,u.X=x,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})(WV,typeof TE=="object"&&TE,typeof define=="function"&&define)});var ZV=ai((jV,DE)=>{(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})(jV,typeof DE=="object"&&DE,typeof define=="function"&&define)});var XV=ai((JV,Lv)=>{(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 y=[];A=A==!0?{entropy:!0}:A||{};var E=x(h(A.entropy?[v,T(e)]:v??b(),3),y),D=new p(y),_=function(){for(var C=D.g(i),N=s,P=0;C<l;)C=(C+P)*n,N*=n,P=D.g(1);for(;C>=u;)C/=2,N/=2,P>>>=1;return(C+P)/N};return _.int32=function(){return D.g(4)|0},_.quick=function(){return D.g(4)/4294967296},_.double=_,x(T(D.S),e),(A.pass||w||function(C,N,P,R){return R&&(R.S&&d(R,D),C.state=function(){return d(D,{})}),P?(r[o]=C,N):C})(_,E,"global"in A?A.global:this==r,A.state)}function p(v){var A,w=v.length,y=this,E=0,D=y.i=y.j=0,_=y.S=[];for(w||(v=[w++]);E<n;)_[E]=E++;for(E=0;E<n;E++)_[E]=_[D=c&D+v[E%w]+(A=_[E])],_[D]=A;(y.g=function(C){for(var N,P=0,R=y.i,L=y.j,V=y.S;C--;)N=V[R=c&R+1],P=P*n+V[c&(V[R]=V[L=c&L+N])+(V[L]=N)];return y.i=R,y.j=L,P})(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=[],y=typeof v,E;if(A&&y=="object")for(E in v)try{w.push(h(v[E],A-1))}catch{}return w.length?w:y=="string"?v:v+"\0"}function x(v,A){for(var w=v+"",y,E=0;E<w.length;)A[c&E]=c&(y^=A[c&E]*19)+w.charCodeAt(E++);return T(A)}function b(){try{var v;return f&&(v=f.randomBytes)?v=v(n):(v=new Uint8Array(n),(t.crypto||t.msCrypto).getRandomValues(v)),T(v)}catch{var A=t.navigator,w=A&&A.plugins;return[+new Date,t,w,t.screen,T(e)]}}function T(v){return String.fromCharCode.apply(0,v)}if(x(r.random(),e),typeof Lv=="object"&&Lv.exports){Lv.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:JV,[],Math)});var KV=ai((_Qe,QV)=>{var Dne=LV(),Mne=UV(),Cne=zV(),Nne=GV(),Fne=YV(),Ine=ZV(),tc=XV();tc.alea=Dne;tc.xor128=Mne;tc.xorwow=Cne;tc.xorshift7=Nne;tc.xor4096=Fne;tc.tychei=Ine;QV.exports=tc});var gse={};Z7(gse,{MetaBindBuild:()=>nC,default:()=>gx});module.exports=J7(gse);var xs=require("obsidian");var Yi=(r=>(r.INLINE="inline",r.BLOCK="block",r))(Yi||{}),yc=(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))(yc||{}),du=class{constructor(e){this.linePosition=e}getPosition(){return this.linePosition}};function ud(t){return t==="INPUT"||t==="VIEW"||t==="BUTTON_GROUP"}var hu=(y=>(y.TOGGLE="toggle",y.SLIDER="slider",y.TEXT="text",y.TEXT_AREA="textArea",y.SELECT="select",y.MULTI_SELECT="multiSelect",y.DATE="date",y.TIME="time",y.DATE_PICKER="datePicker",y.NUMBER="number",y.SUGGESTER="suggester",y.EDITOR="editor",y.IMAGE_SUGGESTER="imageSuggester",y.PROGRESS_BAR="progressBar",y.INLINE_SELECT="inlineSelect",y.LIST="list",y.LIST_SUGGESTER="listSuggester",y.INLINE_LIST_SUGGESTER="inlineListSuggester",y.INLINE_LIST="inlineList",y.IMAGE_LIST_SUGGESTER="imageListSuggester",y.DATE_TIME="dateTime",y.INVALID="invalid",y))(hu||{}),fn=(T=>(T.CLASS="class",T.ADD_LABELS="addLabels",T.MIN_VALUE="minValue",T.MAX_VALUE="maxValue",T.STEP_SIZE="stepSize",T.OPTION="option",T.TITLE="title",T.OPTION_QUERY="optionQuery",T.SHOWCASE="showcase",T.ON_VALUE="onValue",T.OFF_VALUE="offValue",T.DEFAULT_VALUE="defaultValue",T.PLACEHOLDER="placeholder",T.USE_LINKS="useLinks",T.LIMIT="limit",T.MULTI_LINE="multiLine",T.ALLOW_OTHER="allowOther",T.INVALID="invalid",T))(fn||{}),ld={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 Nr={addLabels:{type:"addLabels",allowedFieldTypes:["slider","progressBar"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},class:{type:"class",allowedFieldTypes:[],values:[[{name:"className",allowed:[],description:"the name of the css class to add"}]],allowMultiple:!0},defaultValue:{type:"defaultValue",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},maxValue:{type:"maxValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the maximally allowed value"}]],allowMultiple:!1},minValue:{type:"minValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the minimally allowed value"}]],allowMultiple:!1},stepSize:{type:"stepSize",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the step size for sliders"}]],allowMultiple:!1},offValue:{type:"offValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},onValue:{type:"onValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},option:{type:"option",allowedFieldTypes:["select","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}},sp=(a=>(a.MATH="math",a.TEXT="text",a.LINK="link",a.IMAGE="image",a.INVALID="invalid",a))(sp||{}),ul=(i=>(i.RENDER_MARKDOWN="renderMarkdown",i.HIDDEN="hidden",i.CLASS="class",i.INVALID="invalid",i))(ul||{}),xc={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}},cd=8;var Jn=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)}},Ht=class extends Jn{getErrorType(){return"MB_INTERNAL"}},No=class extends Jn{getErrorType(){return"MB_PARSING"}},Cs=class extends Jn{getErrorType(){return"MB_VALIDATION"}},fd=class extends Jn{getErrorType(){return"MB_BIND_TARGET"}};var Hr=class extends Jn{getErrorType(){return"MB_ARGUMENT"}},Fo=class extends Jn{getErrorType(){return"MB_JS"}},ll=class extends Jn{getErrorType(){return"MB_EXPRESSION"}};var up=class extends Jn{getErrorType(){return"MB_EXAMPLE"}};var Ns=class extends Jn{getErrorType(){return"MB_BUTTON"}},cl=class extends Jn{getErrorType(){return"MB_DEPENDENCY"}};var to=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 bc=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 Ht({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 Ht({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 Ht({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 to.setAndCreate(n.data,r.storageProp,e),n}writeEntireCache(e,r){r.data=e}readCache(e){if(e.storageType!==this.id)throw new Ht({errorLevel:"ERROR",effect:"can not read cache",cause:`Source "${e.storageType}" does not match`});let r=this.getCacheItemForStoragePath(e.storagePath);return r===void 0?to.tryGet(this.readExternal(e.storagePath),e.storageProp):this.readCacheItem(r,e.storageProp)}readCacheItem(e,r){return to.tryGet(e.data,r)}readEntireCacheItem(e){return e.data}};function Xn(t,e){let r=t.thenEof().tryParse(e);if(r.success)return r.value;throw new lp("ERROR","parsiNOM parser",e,r)}var lp=class extends Jn{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}},Vn=class extends Jn{constructor(e,r,n,i,a,o){super({errorLevel:e,effect:"Failed to validate the result of the parser.",cause:n,docs:o}),this.str=i,this.position=a,this.source=r,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`,this.str&&this.position){let r=this.str.split(`
`)[this.position.from.line-1],n=`${this.position.from.line} | `;this.positionContext=`${n}${r}`,this.positionContext+=`
${this.getUnderline(n.length,r.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,r){if(this.position===void 0)return"";let n=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:r,a="^".repeat(i-this.position.from.column);return n+a}};var pd=class extends bc{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}syncExternal(e){}},md=class{constructor(e,r){this.id=e,this.manager=r,this.cache={data:{},...this.manager.getDefaultCacheItem()}}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,r,n,i){if(r)throw new Vn("ERROR","Bind target validator","Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.",n,e.position);return""}deleteCache(e){}getCacheItemForStoragePath(e){return this.cache}iterateCacheItems(){return[this.cache][Symbol.iterator]()}onCycle(e){}readCache(e){return this.readCacheItem(this.cache,e.storageProp)}readCacheItem(e,r){return to.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 to.setAndCreate(this.cache.data,r.storageProp,e),this.cache}writeEntireCache(e,r){r.data=e}readEntireCacheItem(e){return e.data}},dd=class{constructor(e,r){this.id=e,this.manager=r}getOrCreateCacheItem(e){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}validateStoragePath(e,r,n,i){if(r)throw new Vn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",n,e.position);return""}deleteCache(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,r){}shouldDelete(e){return!0}subscribe(e){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}syncExternal(e){}unsubscribe(e){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeCache(e,r){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeEntireCache(e,r){}readEntireCacheItem(e){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};var vn=class extends Error{},cp=class extends Error{};var VC=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},X7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function Q7(t,e,r){let n=r;for(let i of Lr(t))n=e(n,i);return n}function K7(t,e,r){return VC(this,void 0,void 0,function*(){var n,i,a,o;let s=r;try{for(var l=!0,u=X7(Vr(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 Bx(t){switch(!0){case t instanceof Array:return t.length;case es(t):return t.length;case t instanceof Set:return t.size;case t instanceof Map:return t.size}return Q7(t,e=>e+1,0)}function UC(t){return VC(this,void 0,void 0,function*(){switch(!0){case t instanceof Array:case es(t):case t instanceof Set:case t instanceof Map:return Bx(t)}return yield K7(t,e=>e+1,0)})}var qC={chunkwise:nN,chunkwiseOverlap:gd,compress:GC,dropWhile:YC,enumerate:sN,filter:tN,flatMap:KC,flatten:kx,groupBy:vN,keys:fN,limit:aN,map:HC,pairwise:fl,repeat:XC,skip:mN,slice:lN,sort:xN,takeWhile:ZC,values:hN,chunkwiseAsync:iN,chunkwiseOverlapAsync:vd,compressAsync:WC,dropWhileAsync:jC,enumerateAsync:uN,filterAsync:rN,flatMapAsync:eN,flattenAsync:$x,groupByAsync:yN,keysAsync:pN,limitAsync:oN,mapAsync:hd,pairwiseAsync:fp,repeatAsync:QC,skipAsync:dN,sliceAsync:cN,sortAsync:bN,takeWhileAsync:JC,valuesAsync:gN};var zC={allMatch:wN,allUnique:AN,anyMatch:EN,exactlyN:DN,isEmpty:CN,isAsyncIterable:Fs,isIterable:ua,isIterator:ro,isReversed:FN,isSorted:PN,isString:es,noneMatch:kN,same:ON,sameCount:LN,allMatchAsync:_N,allUniqueAsync:SN,anyMatchAsync:TN,exactlyNAsync:MN,isEmptyAsync:NN,isReversedAsync:IN,isSortedAsync:BN,noneMatchAsync:$N,sameAsync:RN,sameCountAsync:VN};var wc=function(t){return this instanceof wc?(this.v=t,this):new wc(t)},eH=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(x,b){a.push([p,h,x,b])>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 wc?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])}},Io;(function(t){t[t.SHORTEST=0]="SHORTEST",t[t.LONGEST=1]="LONGEST",t[t.STRICT_EQUAL=2]="STRICT_EQUAL"})(Io||(Io={}));function*Ox(t,e,...r){if(r.length===0)return;let n=[];for(let i of r)n.push(UN(i));e:for(;;){let i=qC.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 Io.SHORTEST:break e;case Io.STRICT_EQUAL:throw new cp("Iterators must have equal lengths")}if(!s)break;yield a}}function Rx(t,e,...r){return eH(this,arguments,function*(){if(r.length===0)return yield wc(void 0);let i=[];for(let a of r)i.push(qN(a));e:for(;;){let a=[];for(let u of i){let c=yield wc(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 Io.SHORTEST:break e;case Io.STRICT_EQUAL:throw new cp("Iterators must have equal lengths")}if(!l)break;yield yield wc(o)}})}var gu=function(t){return this instanceof gu?(this.v=t,this):new gu(t)},tH=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)}},rH=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(x,b){a.push([p,h,x,b])>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 gu?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 Lr(t)){let i=e(n);r.has(i)||(yield n,r.add(i))}}}function zN(t,e){return rH(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 gu(yield gu(f));else{e===void 0&&(e=f=>f);try{for(var l=!0,u=tH(Vr(t)),c;c=yield gu(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o,m=e(f);s.has(m)||(yield yield gu(f),s.add(m))}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield gu(a.call(u)))}finally{if(i)throw i.error}}}})}var $n=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)}},it=function(t){return this instanceof it?(this.v=t,this):new it(t)},Qn=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(x,b){a.push([p,h,x,b])>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 it?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*HC(t,e){for(let r of Lr(t))yield e(r)}function hd(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(Vr(t)),u;u=yield it(l.next()),n=u.done,!n;s=!0)o=u.value,s=!1,yield yield it(yield it(e(o)))}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*GC(t,e){for(let[r,n]of _c(t,e))n&&(yield r)}function WC(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(HN(t,e)),u;u=yield it(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let[c,f]=o;f&&(yield yield it(c))}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*YC(t,e){let r=!0;for(let n of Lr(t)){if(r){if(!e(n)){r=!1,yield n;continue}continue}yield n}}function jC(t,e){return Qn(this,arguments,function*(){var n,i,a,o;let s=!0;try{for(var l=!0,u=$n(Vr(t)),c;c=yield it(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o;if(s){if(!(yield it(e(f)))){s=!1,yield yield it(f);continue}continue}yield yield it(f)}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield it(a.call(u)))}finally{if(i)throw i.error}}})}function*ZC(t,e){for(let r of Lr(t))if(e(r))yield r;else break}function JC(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(Vr(t)),u;u=yield it(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let c=o;if(yield it(e(c)))yield yield it(c);else break}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*XC(t,e){if(e<0)throw new vn(`Number of repetitions cannot be negative: ${e}`);for(let r=e;r>0;--r)yield t}function QC(t,e){return Qn(this,arguments,function*(){if(e<0)throw new vn(`Number of repetitions cannot be negative: ${e}`);let n=yield it(t);for(let i=e;i>0;--i)yield yield it(n)})}function*KC(t,e){for(let r of Lr(t)){let n=e(r,e);if(ua(n))for(let i of Lr(n))yield i;else yield n}}function eN(t,e){return Qn(this,arguments,function*(){var n,i,a,o,s,l,u,c;try{for(var f=!0,m=$n(Vr(t)),p;p=yield it(m.next()),n=p.done,!n;f=!0){o=p.value,f=!1;let T=yield it(e(o,e));if(ua(T)||Fs(T))try{for(var d=!0,h=(l=void 0,$n(Vr(T))),x;x=yield it(h.next()),s=x.done,!s;d=!0)c=x.value,d=!1,yield yield it(c)}catch(v){l={error:v}}finally{try{!d&&!s&&(u=h.return)&&(yield it(u.call(h)))}finally{if(l)throw l.error}}else yield yield it(T)}}catch(b){i={error:b}}finally{try{!f&&!n&&(a=m.return)&&(yield it(a.call(m)))}finally{if(i)throw i.error}}})}function*kx(t,e=1/0){if(e<1){for(let r of Lr(t))t instanceof Map&&(r=r[1]),yield r;return}for(let r of Lr(t))if(t instanceof Map&&(r=r[1]),(ua(r)||ro(r))&&!es(r))for(let n of kx(r,e-1))yield n;else yield r}function $x(t){return Qn(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 x=!0,b=$n(Vr(r)),T;T=yield it(b.next()),i=T.done,!i;x=!0){s=T.value,x=!1;let _=s;r instanceof Map&&(_=_[1]),yield yield it(_)}}catch(_){a={error:_}}finally{try{!x&&!i&&(o=b.return)&&(yield it(o.call(b)))}finally{if(a)throw a.error}}return yield it(void 0)}try{for(var v=!0,A=$n(Vr(r)),w;w=yield it(A.next()),l=w.done,!l;v=!0){f=w.value,v=!1;let _=f;if(r instanceof Map&&(_=_[1]),(Fs(_)||ua(_)||ro(_))&&!es(_))try{for(var y=!0,E=(p=void 0,$n($x(_,n-1))),D;D=yield it(E.next()),m=D.done,!m;y=!0)h=D.value,y=!1,yield yield it(h)}catch(C){p={error:C}}finally{try{!y&&!m&&(d=E.return)&&(yield it(d.call(E)))}finally{if(p)throw p.error}}else yield yield it(_)}}catch(_){u={error:_}}finally{try{!v&&!l&&(c=A.return)&&(yield it(c.call(A)))}finally{if(u)throw u.error}}})}function*tN(t,e){for(let r of Lr(t))e(r)&&(yield r)}function rN(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(Vr(t)),u;u=yield it(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let c=o;(yield it(e(c)))&&(yield yield it(c))}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*gd(t,e,r,n=!0){if(e<1)throw new vn(`Chunk size must be \u2265 1. Got ${e}`);if(r>=e)throw new vn("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of Lr(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 vd(t,e,r){return Qn(this,arguments,function*(i,a,o,s=!0){var l,u,c,f;if(a<1)throw new vn(`Chunk size must be \u2265 1. Got ${a}`);if(o>=a)throw new vn("Overlap size must be less than chunk size");let m=[],p=!1;try{for(var d=!0,h=$n(Vr(i)),x;x=yield it(h.next()),l=x.done,!l;d=!0){f=x.value,d=!1;let b=f;p=!1,m.push(b),m.length===a&&(yield yield it(m),m=m.slice(a-o),p=!0)}}catch(b){u={error:b}}finally{try{!d&&!l&&(c=h.return)&&(yield it(c.call(h)))}finally{if(u)throw u.error}}!p&&m.length>0&&s&&(yield yield it(m))})}function*nN(t,e){for(let r of gd(t,e,0))yield r}function iN(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(vd(t,e,0)),u;u=yield it(l.next()),n=u.done,!n;s=!0)o=u.value,s=!1,yield yield it(o)}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*fl(t){let e=gd(t,2,1,!1);for(let r of e)yield r}function fp(t){return Qn(this,arguments,function*(){var r,n,i,a;let o=vd(t,2,1,!1);try{for(var s=!0,l=$n(o),u;u=yield it(l.next()),r=u.done,!r;s=!0)a=u.value,s=!1,yield yield it(a)}catch(c){n={error:c}}finally{try{!s&&!r&&(i=l.return)&&(yield it(i.call(l)))}finally{if(n)throw n.error}}})}function*aN(t,e){if(e<0)throw new vn(`Limit must be \u2265 0. Got ${e}`);let r=0;for(let n of Lr(t)){if(r>=e)return;yield n,++r}}function oN(t,e){return Qn(this,arguments,function*(){var n,i,a,o;if(e<0)throw new vn(`Limit must be \u2265 0. Got ${e}`);let s=0;try{for(var l=!0,u=$n(Vr(t)),c;c=yield it(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o;if(s>=e)return yield it(void 0);yield yield it(f),++s}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield it(a.call(u)))}finally{if(i)throw i.error}}})}function*sN(t){let e=0;for(let r of Lr(t))yield[e++,r]}function uN(t){return Qn(this,arguments,function*(){var r,n,i,a;let o=0;try{for(var s=!0,l=$n(Vr(t)),u;u=yield it(l.next()),r=u.done,!r;s=!0){a=u.value,s=!1;let c=a;yield yield it([o++,c])}}catch(c){n={error:c}}finally{try{!s&&!r&&(i=l.return)&&(yield it(i.call(l)))}finally{if(n)throw n.error}}})}function*lN(t,e=0,r,n=1){if(e<0)throw new vn("Parameter 'start' cannot be negative");if(r!==void 0&&r<0)throw new vn("Parameter 'count' cannot be negative");if(n<=0)throw new vn("Parameter 'step' must be positive");let i=0,a=0;for(let o of Lr(t))if(!(i++<e||(i-e-1)%n!==0)){if(a++===r&&r!==void 0)break;yield o}}function cN(t){return Qn(this,arguments,function*(r,n=0,i,a=1){var o,s,l,u;if(n<0)throw new vn("Parameter 'start' cannot be negative");if(i!==void 0&&i<0)throw new vn("Parameter 'count' cannot be negative");if(a<=0)throw new vn("Parameter 'step' must be positive");let c=0,f=0;try{for(var m=!0,p=$n(Vr(r)),d;d=yield it(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 it(h)}}}catch(h){s={error:h}}finally{try{!m&&!o&&(l=p.return)&&(yield it(l.call(p)))}finally{if(s)throw s.error}}})}function*fN(t){for(let[e]of Lr(t))yield e}function pN(t){return Qn(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=$n(Vr(t)),l;l=yield it(s.next()),r=l.done,!r;o=!0){a=l.value,o=!1;let[u]=a;yield yield it(u)}}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield it(i.call(s)))}finally{if(n)throw n.error}}})}function*mN(t,e,r=0){if(e<0||r<0)throw new vn;let n=-r;for(let i of Lr(t))(n<0||n>=e)&&(yield i),++n}function dN(t,e){return Qn(this,arguments,function*(n,i,a=0){var o,s,l,u;if(i<0||a<0)throw new vn;let c=-a;try{for(var f=!0,m=$n(Vr(n)),p;p=yield it(m.next()),o=p.done,!o;f=!0){u=p.value,f=!1;let d=u;(c<0||c>=i)&&(yield yield it(d)),++c}}catch(d){s={error:d}}finally{try{!f&&!o&&(l=m.return)&&(yield it(l.call(m)))}finally{if(s)throw s.error}}})}function*hN(t){for(let[,e]of Lr(t))yield e}function gN(t){return Qn(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=$n(Vr(t)),l;l=yield it(s.next()),r=l.done,!r;o=!0){a=l.value,o=!1;let[,u]=a;yield yield it(u)}}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield it(i.call(s)))}finally{if(n)throw n.error}}})}function*vN(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 Lr(t)){let o=e(a),s=r!==void 0?r(a):void 0,l=(ua(o)||ro(o))&&!es(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 yN(t,e,r){return Qn(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=$n(Vr(t)),x;x=yield it(h.next()),i=x.done,!i;d=!0){s=x.value,d=!1;let A=s,w=yield it(e(A)),y=r!==void 0?yield it(r(A)):void 0,E=(Fs(w)||ua(w)||ro(w))&&!es(w)?w:[w];try{for(var b=!0,T=(u=void 0,$n(zN(E))),v;v=yield it(T.next()),l=v.done,!l;b=!0){f=v.value,b=!1;let D=f;p(D),y===void 0?m.get(D).push(A):m.get(D)[y]=A}}catch(D){u={error:D}}finally{try{!b&&!l&&(c=T.return)&&(yield it(c.call(T)))}finally{if(u)throw u.error}}}}catch(A){a={error:A}}finally{try{!d&&!i&&(o=h.return)&&(yield it(o.call(h)))}finally{if(a)throw a.error}}for(let A of m)yield yield it(A)})}function*xN(t,e){let r=Vx(t);e!==void 0?r.sort(e):r.sort();for(let n of r)yield n}function bN(t,e){return Qn(this,arguments,function*(){let n=yield it(pp(t));e!==void 0?n.sort(e):n.sort();for(let i of n)yield yield it(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())})},Is=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 wN(t,e){for(let r of Lr(t))if(!e(r))return!1;return!0}function _N(t,e){return Po(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=Is(Vr(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 AN(t){let e=new Set;for(let r of Lr(t)){if(e.has(r))return!1;e.add(r)}return!0}function SN(t){return Po(this,void 0,void 0,function*(){var e,r,n,i;let a=new Set;try{for(var o=!0,s=Is(Vr(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 EN(t,e){for(let r of Lr(t))if(e(r))return!0;return!1}function TN(t,e){return Po(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=Is(Vr(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 DN(t,e,r){if(e<0)return!1;r===void 0&&(r=i=>!!i);let n=0;for(let i of Lr(t))if(r(i)&&(n++,n>e))return!1;return n===e}function MN(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=Is(Vr(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 CN(t){for(let e of Lr(t))return!1;return!0}function NN(t){return Po(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=Is(Vr(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 ua(t){return t==null?!1:typeof t[Symbol.iterator]=="function"}function Fs(t){return t==null?!1:typeof t[Symbol.asyncIterator]=="function"}function ro(t){return t==null?!1:t.next!==void 0&&typeof t.next=="function"}function FN(t){for(let[e,r]of fl(Lr(t)))if(e<r)return!1;return!0}function IN(t){return Po(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=Is(fp(Vr(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 PN(t){for(let[e,r]of fl(Lr(t)))if(e>r)return!1;return!0}function BN(t){return Po(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=Is(fp(Vr(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 es(t){return typeof t=="string"||t instanceof String}function kN(t,e){for(let r of Lr(t))if(e(r))return!1;return!0}function $N(t,e){return Po(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=Is(Vr(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 ON(...t){try{for(let e of GN(...t))for(let[r,n]of fl(e))if(r!==n)return!1}catch{return!1}return!0}function RN(...t){return Po(this,void 0,void 0,function*(){var e,r,n,i;try{try{for(var a=!0,o=Is(WN(...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 fl(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 LN(...t){if(t.length<=1)return!0;let e=t.map(r=>Bx(r));return new Set(e).size===1}function VN(...t){return Po(this,void 0,void 0,function*(){if(t.length<=1)return!0;let e=yield hd(t,r=>Po(this,void 0,void 0,function*(){return yield UC(r)}));return new Set(yield pp(e)).size===1})}var nH=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())})},ts=function(t){return this instanceof ts?(this.v=t,this):new ts(t)},Ux=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(x,b){a.push([p,h,x,b])>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 ts?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])}},YN=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 Lr(t){if(ua(t))return t;if(ro(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 vn("Given collection is not iterable or iterator.")}function Vr(t){if(Fs(t))return t;if(ro(t))return{[Symbol.asyncIterator](){return Ux(this,arguments,function*(){for(;;){let r=yield ts(t.next());if(r.done)return yield ts(void 0);yield yield ts(r.value)}})}};if(typeof t=="object"&&t!==null&&(t=Lr(t)),ua(t))return{[Symbol.asyncIterator](){return Ux(this,arguments,function*(){for(let r of t)yield yield ts(r)})}};throw new vn("Given collection is not async iterable or iterator.")}function UN(t){if(ro(t))return t;if(ua(t))return function*(){for(let e of t)yield e}();throw new vn("Given collection is not iterable or iterator.")}function qN(t){if((ro(t)||ua(t))&&(t=Vr(t)),Fs(t))return function(){return Ux(this,arguments,function*(){var e,r,n,i;try{for(var a=!0,o=YN(t),s;s=yield ts(o.next()),e=s.done,!e;a=!0)i=s.value,a=!1,yield yield ts(i)}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield ts(n.call(o)))}finally{if(r)throw r.error}}})}();throw new vn("Given collection is not iterable or iterator.")}function Vx(t){let e=[];for(let r of Lr(t))e.push(r);return e}function pp(t){return nH(this,void 0,void 0,function*(){var e,r,n,i;let a=[];try{for(var o=!0,s=YN(Vr(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 jN=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)}},Ps=function(t){return this instanceof Ps?(this.v=t,this):new Ps(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(x,b){a.push([p,h,x,b])>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 Ps?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*_c(...t){for(let e of Ox(Io.SHORTEST,void 0,...t))yield e}function HN(...t){return ZN(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=jN(Rx(Io.SHORTEST,void 0,...t)),l;l=yield Ps(s.next()),r=l.done,!r;o=!0)a=l.value,o=!1,yield yield Ps(a)}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield Ps(i.call(s)))}finally{if(n)throw n.error}}})}function*GN(...t){for(let e of Ox(Io.STRICT_EQUAL,void 0,...t))yield e}function WN(...t){return ZN(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=jN(Rx(Io.STRICT_EQUAL,void 0,...t)),l;l=yield Ps(s.next()),r=l.done,!r;o=!0)a=l.value,o=!1,yield yield Ps(a)}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield Ps(i.call(s)))}finally{if(n)throw n.error}}})}function mp(t,e,r){return Math.min(Math.max(t,e),r)}function xd(t,e,r){return t!==void 0?Math.min(Math.max(t,e),r):void 0}function qx(t,e,r,n,i){return(t-e)/(r-e)*(i-n)+n}function zx(t,e){return(t%e+e)%e}function yd(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(!yd(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(!yd(t[i],e[i]))return!1;return!0}return t===e}function Hx(t){return!!t}function Gx(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")&&Gx(n)}return Object.freeze(t)}function JN(t){return structuredClone(t)}function Fr(){return window.crypto.randomUUID()}function Ac(t){try{return new URL(t),!0}catch{return!1}}function bd(t){window.open(t,"_blank")}function XN(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 Di(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 pt=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 wd(...t){let e=t[0];for(let r=1;r<t.length;r++){let n=e.endsWith("/"),i=t[r].startsWith("/");n&&i?e=e.substring(0,e.length-1):!n&&!i&&(e+="/"),e+=t[r]}return e}function _d(t,e){return e=e.startsWith(".")?e:"."+e,t.endsWith(e)?t:t+e}function Ad(t){return t===void 0?[]:Array.isArray(t)?t:[t]}var Sd=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 _c(this.dependencies,this.dependencySignals)){let n=this.uuid+"/"+Fr();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();this.bindTarget&&this.metadataManager.write(e,this.bindTarget,this.uuid)}catch(e){let r=e instanceof Error?e:String(e);console.warn(new Ht({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){}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var Ed=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 _c(this.dependencies,this.dependencySignals)){let n=this.uuid+"/"+Fr();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 Ht({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){}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){this.uuid=e,this.callbackSignal=r,this.metadataManager=n,this.bindTarget=i,this.onDelete=a,this.deleted=!1}unsubscribe(){this.metadataManager.unsubscribe(this)}write(e){this.metadataManager.write(e,this.bindTarget,this.uuid)}onUpdate(e){try{this.callbackSignal.set(e)}catch(r){let n=r instanceof Error?r:String(r);console.warn(new Ht({errorLevel:"ERROR",effect:"Failed to notify subscription of updated value in the cache",cause:n}))}}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}};var iH=5,aH=5*60;function Wx(t,e){return t===void 0||e===void 0||t.storageType!==e.storageType||t.storagePath!==e.storagePath?!1:QN(t.storageProp,e.storageProp,e.listenToChildren)}function QN(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 oH(t){return t===void 0?"undefined":`${t.storagePath}#${t.storageProp.toString()}`}var Dd=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 Ht({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 Td(e,r,this,n,i);return this.subscribeSubscription(a),a}subscribeDerived(e,r,n,i,a,o){let s=new Sd(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 Ed(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 Ht({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 Ht({errorLevel:"ERROR",effect:"can not subscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=r.subscribe(e);n.cyclesWithoutListeners=0,e.onUpdate(r.readCacheItem(n,e.bindTarget.storageProp))}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(Wx(r.bindTarget,n.bindTarget))throw new fd({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${oH(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)Wx(i.bindTarget,e)&&n.push(i);return r.subscriptions.filter(i=>Wx(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>aH&&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 Ht({errorLevel:"ERROR",effect:"can not write to cache",cause:`Source "${r.storageType}" does not exist`});let a=i.writeCache(e,r);a.dirty=!0,a.externalWriteLock=iH,this.notifyListeners(r,n)}read(e){let r=this.getSource(e.storageType);if(r===void 0)throw new Ht({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 Ht({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)&&QN(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;let a=e.readEntireCacheItem(i);e.writeEntireCache(n,i);for(let o of i.subscriptions){if(o.bindTarget===void 0)continue;let s=o.bindTarget.storageProp,l=to.tryGet(n,s),u=to.tryGet(a,s);l!==u&&o.onUpdate(l)}}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,r){this.deleteCachesForStoragePath(e)}};var Md=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 jx=zr(dp()),oi=class t{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,jx.default)(e,t.dateFormat)}static getDefaultDate(){return(0,jx.default)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var KN=["January","February","March","April","May","June","July","August","September","October","November","December"],pl=[{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"}],Bo={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",firstWeekday:pl[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:["templates"]};var eF=zr(dp());var Zx=pl[1];function tF(t){Zx=t}function rF(t){return KN[t]}function nF(t,e){let r=(0,eF.default)(new Date(e,t)).daysInMonth(),n=new Array(42).fill(0),i=sH(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 sH(t){return zx(t.getDay()-Zx.index,7)}function iF(){return pl.map(e=>({index:zx(e.index-Zx.index,7),name:e.name,shortName:e.shortName})).sort((e,r)=>e.index-r.index).map(e=>e.shortName)}function aF(){let t=0;return()=>++t}function Cd(t){var e=t.statementIndent,r=t.jsonld,n=t.json||r,i=t.typescript,a=t.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function q(Rn){return{type:Rn,style:"keyword"}}var re=q("keyword a"),Ne=q("keyword b"),Ke=q("keyword c"),Ge=q("keyword d"),qt=q("operator"),Or={type:"atom",style:"atom"};return{if:q("if"),while:re,with:re,else:Ne,do:Ne,try:Ne,finally:Ne,return:Ge,break:Ge,continue:Ge,new:q("new"),delete:Ke,void:Ke,throw:Ke,debugger:q("debugger"),var:q("var"),const:q("var"),let:q("var"),function:q("function"),catch:q("catch"),for:q("for"),switch:q("switch"),case:q("case"),default:q("default"),in:qt,typeof:qt,instanceof:qt,true:Or,false:Or,null:Or,undefined:Or,NaN:Or,Infinity:Or,this:q("this"),class:q("class"),super:q("atom"),yield:Ke,export:q("export"),import:q("import"),extends:Ke,await:Ke}}(),s=/[+\-*&%=<>!?|~^@]/,l=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function u(q){for(var re=!1,Ne,Ke=!1;(Ne=q.next())!=null;){if(!re){if(Ne=="/"&&!Ke)return;Ne=="["?Ke=!0:Ke&&Ne=="]"&&(Ke=!1)}re=!re&&Ne=="\\"}}var c,f;function m(q,re,Ne){return c=q,f=Ne,re}function p(q,re){var Ne=q.next();if(Ne=='"'||Ne=="'")return re.tokenize=d(Ne),re.tokenize(q,re);if(Ne=="."&&q.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return m("number","number");if(Ne=="."&&q.match(".."))return m("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(Ne))return m(Ne);if(Ne=="="&&q.eat(">"))return m("=>","operator");if(Ne=="0"&&q.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return m("number","number");if(/\d/.test(Ne))return q.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),m("number","number");if(Ne=="/")return q.eat("*")?(re.tokenize=h,h(q,re)):q.eat("/")?(q.skipToEnd(),m("comment","comment")):ln(q,re,1)?(u(q),q.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),m("regexp","string.special")):(q.eat("="),m("operator","operator",q.current()));if(Ne=="`")return re.tokenize=x,x(q,re);if(Ne=="#"&&q.peek()=="!")return q.skipToEnd(),m("meta","meta");if(Ne=="#"&&q.eatWhile(a))return m("variable","property");if(Ne=="<"&&q.match("!--")||Ne=="-"&&q.match("->")&&!/\S/.test(q.string.slice(0,q.start)))return q.skipToEnd(),m("comment","comment");if(s.test(Ne))return(Ne!=">"||!re.lexical||re.lexical.type!=">")&&(q.eat("=")?(Ne=="!"||Ne=="=")&&q.eat("="):/[<>*+\-|&?]/.test(Ne)&&(q.eat(Ne),Ne==">"&&q.eat(Ne))),Ne=="?"&&q.eat(".")?m("."):m("operator","operator",q.current());if(a.test(Ne)){q.eatWhile(a);var Ke=q.current();if(re.lastType!="."){if(o.propertyIsEnumerable(Ke)){var Ge=o[Ke];return m(Ge.type,Ge.style,Ke)}if(Ke=="async"&&q.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return m("async","keyword",Ke)}return m("variable","variable",Ke)}}function d(q){return function(re,Ne){var Ke=!1,Ge;if(r&&re.peek()=="@"&&re.match(l))return Ne.tokenize=p,m("jsonld-keyword","meta");for(;(Ge=re.next())!=null&&!(Ge==q&&!Ke);)Ke=!Ke&&Ge=="\\";return Ke||(Ne.tokenize=p),m("string","string")}}function h(q,re){for(var Ne=!1,Ke;Ke=q.next();){if(Ke=="/"&&Ne){re.tokenize=p;break}Ne=Ke=="*"}return m("comment","comment")}function x(q,re){for(var Ne=!1,Ke;(Ke=q.next())!=null;){if(!Ne&&(Ke=="`"||Ke=="$"&&q.eat("{"))){re.tokenize=p;break}Ne=!Ne&&Ke=="\\"}return m("quasi","string.special",q.current())}var b="([{}])";function T(q,re){re.fatArrowAt&&(re.fatArrowAt=null);var Ne=q.string.indexOf("=>",q.start);if(!(Ne<0)){if(i){var Ke=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(q.string.slice(q.start,Ne));Ke&&(Ne=Ke.index)}for(var Ge=0,qt=!1,Or=Ne-1;Or>=0;--Or){var Rn=q.string.charAt(Or),Ln=b.indexOf(Rn);if(Ln>=0&&Ln<3){if(!Ge){++Or;break}if(--Ge==0){Rn=="("&&(qt=!0);break}}else if(Ln>=3&&Ln<6)++Ge;else if(a.test(Rn))qt=!0;else if(/["'\/`]/.test(Rn))for(;;--Or){if(Or==0)return;var _s=q.string.charAt(Or-1);if(_s==Rn&&q.string.charAt(Or-2)!="\\"){Or--;break}}else if(qt&&!Ge){++Or;break}}qt&&!Ge&&(re.fatArrowAt=Or)}}var v={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function A(q,re,Ne,Ke,Ge,qt){this.indented=q,this.column=re,this.type=Ne,this.prev=Ge,this.info=qt,Ke!=null&&(this.align=Ke)}function w(q,re){for(var Ne=q.localVars;Ne;Ne=Ne.next)if(Ne.name==re)return!0;for(var Ke=q.context;Ke;Ke=Ke.prev)for(var Ne=Ke.vars;Ne;Ne=Ne.next)if(Ne.name==re)return!0}function y(q,re,Ne,Ke,Ge){var qt=q.cc;for(E.state=q,E.stream=Ge,E.marked=null,E.cc=qt,E.style=re,q.lexical.hasOwnProperty("align")||(q.lexical.align=!0);;){var Or=qt.length?qt.pop():n?we:U;if(Or(Ne,Ke)){for(;qt.length&&qt[qt.length-1].lex;)qt.pop()();return E.marked?E.marked:Ne=="variable"&&w(q,Ke)?"variableName.local":re}}}var E={state:null,column:null,marked:null,cc:null};function D(){for(var q=arguments.length-1;q>=0;q--)E.cc.push(arguments[q])}function _(){return D.apply(null,arguments),!0}function C(q,re){for(var Ne=re;Ne;Ne=Ne.next)if(Ne.name==q)return!0;return!1}function N(q){var re=E.state;if(E.marked="def",re.context){if(re.lexical.info=="var"&&re.context&&re.context.block){var Ne=P(q,re.context);if(Ne!=null){re.context=Ne;return}}else if(!C(q,re.localVars)){re.localVars=new V(q,re.localVars);return}}t.globalVars&&!C(q,re.globalVars)&&(re.globalVars=new V(q,re.globalVars))}function P(q,re){if(re)if(re.block){var Ne=P(q,re.prev);return Ne?Ne==re.prev?re:new L(Ne,re.vars,!0):null}else return C(q,re.vars)?re:new L(re.prev,new V(q,re.vars),!1);else return null}function R(q){return q=="public"||q=="private"||q=="protected"||q=="abstract"||q=="readonly"}function L(q,re,Ne){this.prev=q,this.vars=re,this.block=Ne}function V(q,re){this.name=q,this.next=re}var k=new V("this",new V("arguments",null));function B(){E.state.context=new L(E.state.context,E.state.localVars,!1),E.state.localVars=k}function W(){E.state.context=new L(E.state.context,E.state.localVars,!0),E.state.localVars=null}B.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(q,re){var Ne=function(){var Ke=E.state,Ge=Ke.indented;if(Ke.lexical.type=="stat")Ge=Ke.lexical.indented;else for(var qt=Ke.lexical;qt&&qt.type==")"&&qt.align;qt=qt.prev)Ge=qt.indented;Ke.lexical=new A(Ge,E.stream.column(),q,null,Ke.lexical,re)};return Ne.lex=!0,Ne}function ie(){var q=E.state;q.lexical.prev&&(q.lexical.type==")"&&(q.indented=q.lexical.indented),q.lexical=q.lexical.prev)}ie.lex=!0;function X(q){function re(Ne){return Ne==q?_():q==";"||Ne=="}"||Ne==")"||Ne=="]"?D():_(re)}return re}function U(q,re){return q=="var"?_(Q("vardef",re),_r,X(";"),ie):q=="keyword a"?_(Q("form"),be,U,ie):q=="keyword b"?_(Q("form"),U,ie):q=="keyword d"?E.stream.match(/^\s*$/,!1)?_():_(Q("stat"),Z,X(";"),ie):q=="debugger"?_(X(";")):q=="{"?_(Q("}"),W,Jt,ie,O):q==";"?_():q=="if"?(E.state.lexical.info=="else"&&E.state.cc[E.state.cc.length-1]==ie&&E.state.cc.pop()(),_(Q("form"),be,U,ie,hr)):q=="function"?_(eo):q=="for"?_(Q("form"),W,cu,U,O,ie):q=="class"||i&&re=="interface"?(E.marked="keyword",_(Q("form",q=="class"?q:re),hn,ie)):q=="variable"?i&&re=="declare"?(E.marked="keyword",_(U)):i&&(re=="module"||re=="enum"||re=="type")&&E.stream.match(/^\s*\w/,!1)?(E.marked="keyword",re=="enum"?_(pc):re=="type"?_(Bn,X("operator"),me,X(";")):_(Q("form"),ze,X("{"),Q("}"),Jt,ie,ie)):i&&re=="namespace"?(E.marked="keyword",_(Q("form"),we,U,ie)):i&&re=="abstract"?(E.marked="keyword",_(U)):_(Q("stat"),Ee):q=="switch"?_(Q("form"),be,X("{"),Q("}","switch"),W,Jt,ie,ie,O):q=="case"?_(we,X(":")):q=="default"?_(X(":")):q=="catch"?_(Q("form"),B,pe,U,ie,O):q=="export"?_(Q("stat"),Kf,ie):q=="import"?_(Q("stat"),bs,ie):q=="async"?_(U):re=="@"?_(we,U):D(Q("stat"),we,X(";"),ie)}function pe(q){if(q=="(")return _(Zn,X(")"))}function we(q,re){return ee(q,re,!1)}function se(q,re){return ee(q,re,!0)}function be(q){return q!="("?D():_(Q(")"),Z,X(")"),ie)}function ee(q,re,Ne){if(E.state.fatArrowAt==E.stream.start){var Ke=Ne?G:_e;if(q=="(")return _(B,Q(")"),Ye(Zn,")"),ie,X("=>"),Ke,O);if(q=="variable")return D(B,ze,X("=>"),Ke,O)}var Ge=Ne?de:ne;return v.hasOwnProperty(q)?_(Ge):q=="function"?_(eo,Ge):q=="class"||i&&re=="interface"?(E.marked="keyword",_(Q("form"),oa,ie)):q=="keyword c"||q=="async"?_(Ne?se:we):q=="("?_(Q(")"),Z,X(")"),ie,Ge):q=="operator"||q=="spread"?_(Ne?se:we):q=="["?_(Q("]"),fc,ie,Ge):q=="{"?ur(Ue,"}",null,Ge):q=="quasi"?D(fe,Ge):q=="new"?_(J(Ne)):_()}function Z(q){return q.match(/[;\}\)\],]/)?D():D(we)}function ne(q,re){return q==","?_(Z):de(q,re,!1)}function de(q,re,Ne){var Ke=Ne==!1?ne:de,Ge=Ne==!1?we:se;if(q=="=>")return _(B,Ne?G:_e,O);if(q=="operator")return/\+\+|--/.test(re)||i&&re=="!"?_(Ke):i&&re=="<"&&E.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?_(Q(">"),Ye(me,">"),ie,Ke):re=="?"?_(we,X(":"),Ge):_(Ge);if(q=="quasi")return D(fe,Ke);if(q!=";"){if(q=="(")return ur(se,")","call",Ke);if(q==".")return _(Be,Ke);if(q=="[")return _(Q("]"),Z,X("]"),ie,Ke);if(i&&re=="as")return E.marked="keyword",_(me,Ke);if(q=="regexp")return E.state.lastType=E.marked="operator",E.stream.backUp(E.stream.pos-E.stream.start-1),_(Ge)}}function fe(q,re){return q!="quasi"?D():re.slice(re.length-2)!="${"?_(fe):_(Z,Se)}function Se(q){if(q=="}")return E.marked="string.special",E.state.tokenize=x,_(fe)}function _e(q){return T(E.stream,E.state),D(q=="{"?U:we)}function G(q){return T(E.stream,E.state),D(q=="{"?U:se)}function J(q){return function(re){return re=="."?_(q?xe:ge):re=="variable"&&i?_(Ce,q?de:ne):D(q?se:we)}}function ge(q,re){if(re=="target")return E.marked="keyword",_(ne)}function xe(q,re){if(re=="target")return E.marked="keyword",_(de)}function Ee(q){return q==":"?_(ie,U):D(ne,X(";"),ie)}function Be(q){if(q=="variable")return E.marked="property",_()}function Ue(q,re){if(q=="async")return E.marked="property",_(Ue);if(q=="variable"||E.style=="keyword"){if(E.marked="property",re=="get"||re=="set")return _(et);var Ne;return i&&E.state.fatArrowAt==E.stream.start&&(Ne=E.stream.match(/^\s*:\s*/,!1))&&(E.state.fatArrowAt=E.stream.pos+Ne[0].length),_(St)}else{if(q=="number"||q=="string")return E.marked=r?"property":E.style+" property",_(St);if(q=="jsonld-keyword")return _(St);if(i&&R(re))return E.marked="keyword",_(Ue);if(q=="[")return _(we,yr,X("]"),St);if(q=="spread")return _(se,St);if(re=="*")return E.marked="keyword",_(Ue);if(q==":")return D(St)}}function et(q){return q!="variable"?D(St):(E.marked="property",_(eo))}function St(q){if(q==":")return _(se);if(q=="(")return D(eo)}function Ye(q,re,Ne){function Ke(Ge,qt){if(Ne?Ne.indexOf(Ge)>-1:Ge==","){var Or=E.state.lexical;return Or.info=="call"&&(Or.pos=(Or.pos||0)+1),_(function(Rn,Ln){return Rn==re||Ln==re?D():D(q)},Ke)}return Ge==re||qt==re?_():Ne&&Ne.indexOf(";")>-1?D(q):_(X(re))}return function(Ge,qt){return Ge==re||qt==re?_():D(q,Ke)}}function ur(q,re,Ne){for(var Ke=3;Ke<arguments.length;Ke++)E.cc.push(arguments[Ke]);return _(Q(re,Ne),Ye(q,re),ie)}function Jt(q){return q=="}"?_():D(U,Jt)}function yr(q,re){if(i){if(q==":")return _(me);if(re=="?")return _(yr)}}function Oe(q,re){if(i&&(q==":"||re=="in"))return _(me)}function j(q){if(i&&q==":")return E.stream.match(/^\s*\w+\s+is\b/,!1)?_(we,he,me):_(me)}function he(q,re){if(re=="is")return E.marked="keyword",_()}function me(q,re){if(re=="keyof"||re=="typeof"||re=="infer"||re=="readonly")return E.marked="keyword",_(re=="typeof"?se:me);if(q=="variable"||re=="void")return E.marked="type",_(ae);if(re=="|"||re=="&")return _(me);if(q=="string"||q=="number"||q=="atom")return _(ae);if(q=="[")return _(Q("]"),Ye(me,"]",","),ie,ae);if(q=="{")return _(Q("}"),ke,ie,ae);if(q=="(")return _(Ye(Y,")"),Fe,ae);if(q=="<")return _(Ye(me,">"),me);if(q=="quasi")return D(Xe,ae)}function Fe(q){if(q=="=>")return _(me)}function ke(q){return q.match(/[\}\)\]]/)?_():q==","||q==";"?_(ke):D(Ae,ke)}function Ae(q,re){if(q=="variable"||E.style=="keyword")return E.marked="property",_(Ae);if(re=="?"||q=="number"||q=="string")return _(Ae);if(q==":")return _(me);if(q=="[")return _(X("variable"),Oe,X("]"),Ae);if(q=="(")return D(Da,Ae);if(!q.match(/[;\}\)\],]/))return _()}function Xe(q,re){return q!="quasi"?D():re.slice(re.length-2)!="${"?_(Xe):_(me,F)}function F(q){if(q=="}")return E.marked="string.special",E.state.tokenize=x,_(Xe)}function Y(q,re){return q=="variable"&&E.stream.match(/^\s*[?:]/,!1)||re=="?"?_(Y):q==":"?_(me):q=="spread"?_(Y):D(me)}function ae(q,re){if(re=="<")return _(Q(">"),Ye(me,">"),ie,ae);if(re=="|"||q=="."||re=="&")return _(me);if(q=="[")return _(me,X("]"),ae);if(re=="extends"||re=="implements")return E.marked="keyword",_(me);if(re=="?")return _(me,X(":"),me)}function Ce(q,re){if(re=="<")return _(Q(">"),Ye(me,">"),ie,ae)}function tt(){return D(me,vt)}function vt(q,re){if(re=="=")return _(me)}function _r(q,re){return re=="enum"?(E.marked="keyword",_(pc)):D(ze,yr,un,jn)}function ze(q,re){if(i&&R(re))return E.marked="keyword",_(ze);if(q=="variable")return N(re),_();if(q=="spread")return _(ze);if(q=="[")return ur(Gi,"]");if(q=="{")return ur(Ti,"}")}function Ti(q,re){return q=="variable"&&!E.stream.match(/^\s*:/,!1)?(N(re),_(un)):(q=="variable"&&(E.marked="property"),q=="spread"?_(ze):q=="}"?D():q=="["?_(we,X("]"),X(":"),Ti):_(X(":"),ze,un))}function Gi(){return D(ze,un)}function un(q,re){if(re=="=")return _(se)}function jn(q){if(q==",")return _(_r)}function hr(q,re){if(q=="keyword b"&&re=="else")return _(Q("form","else"),U,ie)}function cu(q,re){if(re=="await")return _(cu);if(q=="(")return _(Q(")"),$r,ie)}function $r(q){return q=="var"?_(_r,aa):q=="variable"?_(aa):D(aa)}function aa(q,re){return q==")"?_():q==";"?_(aa):re=="in"||re=="of"?(E.marked="keyword",_(we,aa)):D(we,aa)}function eo(q,re){if(re=="*")return E.marked="keyword",_(eo);if(q=="variable")return N(re),_(eo);if(q=="(")return _(B,Q(")"),Ye(Zn,")"),ie,j,U,O);if(i&&re=="<")return _(Q(">"),Ye(tt,">"),ie,eo)}function Da(q,re){if(re=="*")return E.marked="keyword",_(Da);if(q=="variable")return N(re),_(Da);if(q=="(")return _(B,Q(")"),Ye(Zn,")"),ie,j,O);if(i&&re=="<")return _(Q(">"),Ye(tt,">"),ie,Da)}function Bn(q,re){if(q=="keyword"||q=="variable")return E.marked="type",_(Bn);if(re=="<")return _(Q(">"),Ye(tt,">"),ie)}function Zn(q,re){return re=="@"&&_(we,Zn),q=="spread"?_(Zn):i&&R(re)?(E.marked="keyword",_(Zn)):i&&q=="this"?_(yr,un):D(ze,yr,un)}function oa(q,re){return q=="variable"?hn(q,re):ii(q,re)}function hn(q,re){if(q=="variable")return N(re),_(ii)}function ii(q,re){if(re=="<")return _(Q(">"),Ye(tt,">"),ie,ii);if(re=="extends"||re=="implements"||i&&q==",")return re=="implements"&&(E.marked="keyword"),_(i?me:we,ii);if(q=="{")return _(Q("}"),kn,ie)}function kn(q,re){if(q=="async"||q=="variable"&&(re=="static"||re=="get"||re=="set"||i&&R(re))&&E.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return E.marked="keyword",_(kn);if(q=="variable"||E.style=="keyword")return E.marked="property",_(sa,kn);if(q=="number"||q=="string")return _(sa,kn);if(q=="[")return _(we,yr,X("]"),sa,kn);if(re=="*")return E.marked="keyword",_(kn);if(i&&q=="(")return D(Da,kn);if(q==";"||q==",")return _(kn);if(q=="}")return _();if(re=="@")return _(we,kn)}function sa(q,re){if(re=="!"||re=="?")return _(sa);if(q==":")return _(me,un);if(re=="=")return _(se);var Ne=E.state.lexical.prev,Ke=Ne&&Ne.info=="interface";return D(Ke?Da:eo)}function Kf(q,re){return re=="*"?(E.marked="keyword",_(Mo,X(";"))):re=="default"?(E.marked="keyword",_(we,X(";"))):q=="{"?_(Ye(lc,"}"),Mo,X(";")):D(U)}function lc(q,re){if(re=="as")return E.marked="keyword",_(X("variable"));if(q=="variable")return D(se,lc)}function bs(q){return q=="string"?_():q=="("?D(we):q=="."?D(ne):D(ws,cc,Mo)}function ws(q,re){return q=="{"?ur(ws,"}"):(q=="variable"&&N(re),re=="*"&&(E.marked="keyword"),_(Ko))}function cc(q){if(q==",")return _(ws,cc)}function Ko(q,re){if(re=="as")return E.marked="keyword",_(ws)}function Mo(q,re){if(re=="from")return E.marked="keyword",_(we)}function fc(q){return q=="]"?_():D(Ye(se,"]"))}function pc(){return D(Q("form"),ze,X("{"),Q("}"),Ye(ep,"}"),ie,ie)}function ep(){return D(ze,un)}function tp(q,re){return q.lastType=="operator"||q.lastType==","||s.test(re.charAt(0))||/[,.]/.test(re.charAt(0))}function ln(q,re,Ne){return re.tokenize==p&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(re.lastType)||re.lastType=="quasi"&&/\{\s*$/.test(q.string.slice(0,q.pos-(Ne||0)))}return{name:t.name,startState:function(q){var re={tokenize:p,lastType:"sof",cc:[],lexical:new A(-q,0,"block",!1),localVars:t.localVars,context:t.localVars&&new L(null,null,!1),indented:0};return t.globalVars&&typeof t.globalVars=="object"&&(re.globalVars=t.globalVars),re},token:function(q,re){if(q.sol()&&(re.lexical.hasOwnProperty("align")||(re.lexical.align=!1),re.indented=q.indentation(),T(q,re)),re.tokenize!=h&&q.eatSpace())return null;var Ne=re.tokenize(q,re);return c=="comment"?Ne:(re.lastType=c=="operator"&&(f=="++"||f=="--")?"incdec":c,y(re,Ne,c,f,q))},indent:function(q,re,Ne){if(q.tokenize==h||q.tokenize==x)return null;if(q.tokenize!=p)return 0;var Ke=re&&re.charAt(0),Ge=q.lexical,qt;if(!/^\s*else\b/.test(re))for(var Or=q.cc.length-1;Or>=0;--Or){var Rn=q.cc[Or];if(Rn==ie)Ge=Ge.prev;else if(Rn!=hr&&Rn!=O)break}for(;(Ge.type=="stat"||Ge.type=="form")&&(Ke=="}"||(qt=q.cc[q.cc.length-1])&&(qt==ne||qt==de)&&!/^[,\.=+\-*:?[\(]/.test(re));)Ge=Ge.prev;e&&Ge.type==")"&&Ge.prev.type=="stat"&&(Ge=Ge.prev);var Ln=Ge.type,_s=Ke==Ln;return Ln=="vardef"?Ge.indented+(q.lastType=="operator"||q.lastType==","?Ge.info.length+1:0):Ln=="form"&&Ke=="{"?Ge.indented:Ln=="form"?Ge.indented+Ne.unit:Ln=="stat"?Ge.indented+(tp(q,re)?e||Ne.unit:0):Ge.info=="switch"&&!_s&&t.doubleIndentSwitch!=!1?Ge.indented+(/^(?:case|default)\b/.test(re)?Ne.unit:2*Ne.unit):Ge.align?Ge.column+(_s?0:1):Ge.indented+(_s?0:Ne.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:n?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var hp=Cd({name:"javascript"}),Bue=Cd({name:"json",json:!0}),kue=Cd({name:"json",jsonld:!0}),$ue=Cd({name:"typescript",typescript:!0});var uH=["true","false","on","off","yes","no"],lH=new RegExp("\\b(("+uH.join(")|(")+"))$","i"),gp={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(lH))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:"#"}}};var Ec=class{constructor(e,r){this.range=e,this.tokenClass=r}};var ib=zr(ca());var Rt=class t{static sequence(...e){return ib.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 Ec(i,r)])}static highlightStr(e,r){return t.highlight(ib.P.string(e),r)}};var Bs=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 Ec({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};function lF(t){if(!t.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",r=>({startState:()=>gp.startState?.(4),blankLine:i=>gp.blankLine?.(i,4),copyState:i=>gp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${gp.token?.(i,a)}`})),window.CodeMirror.defineMode("meta-bind-js-view",r=>({startState:()=>hp.startState?.(4),blankLine:i=>hp.blankLine?.(i,4),copyState:i=>hp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${hp.token?.(i,a)}`}));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 Bs(a.str,[]):(a.fieldType=f,a.highlights=t.api.syntaxHighlighting.highlight(a.str,a.fieldType,!0))}let s=a.highlights.getHighlights().filter(l=>l.range.from.line===a.line).find(l=>l.range.from.column===i.pos+1);return s===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<s.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${s.tokenClass}`)}}))}var ab=require("@codemirror/language"),ml=require("@codemirror/view");var Ld=require("obsidian");var cF=require("obsidian");var ks=class{static checkSelectionOverlap(e,r,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=r&&i.from<=n)return!0;return!1}static checkRangeOverlap(e,r,n,i){return e<=i&&n<=r}static getContent(e,r,n){return e.sliceDoc(r,n)}static getCurrentFile(e){return e.state.field(cF.editorInfoField).file}static existsDecorationBetween(e,r,n){let i=!1;return e.between(r,n,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,r,n,i){let a=!1;return e.between(n,i,(o,s,l)=>{l.spec.mb_widgetType===r&&(a=!0)}),a}};function fF(t){return ml.ViewPlugin.fromClass(class{constructor(e){this.component=new Ld.Component,this.component.load(),this.decorations=this.renderWidgets(e)??ml.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(Ld.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(r,n,i)=>zC.anyMatch(e.visibleRanges,o=>ks.checkRangeOverlap(r,n,o.from,o.to))?!0:(i.spec.mb_unload?.(),!1)});for(let{from:r,to:n}of e.visibleRanges)(0,ab.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(ks.existsDecorationOfTypeBetween(this.decorations,n,o,s))return;let l=ks.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=ks.checkSelectionOverlap(e.state.selection,r.from-1,r.to+1),a=this.readNode(e,r.from,r.to),o=this.isLivePreview(e.state),s=!i&&o;return{shouldRender:s,shouldHighlight:!s&&t.settings.enableSyntaxHighlighting,content:a.content,widgetType:a.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,r,n){let i=ks.getContent(e.state,r,n);return{content:i,widgetType:t.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let r=ks.getCurrentFile(e);if(!r)return;let n=[];for(let i of e.visibleRanges)(0,ab.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 ml.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 ml.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{o.renderChild?.unload()}}).range(e.from-1,e.to+1)}else return t.api.syntaxHighlighting.highlight(i,r,!1).getHighlights().map(s=>ml.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 Qt=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof Jn?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 vp=zr(Ma()),yp=zr(ca());var vH=yp.P.sequenceMap((t,e,r,n)=>{let i=parseInt(t),a=parseInt(e),o=parseInt(r);return new Na(i,a,o,n)},vp.P_UTILS.digits().skip(yp.P.string(".")),vp.P_UTILS.digits().skip(yp.P.string(".")),vp.P_UTILS.digits(),yp.P.string("-").then(vp.P_UTILS.remaining()).optional()),Na=class t{constructor(e,r,n,i){this.major=e,this.minor=r,this.patch=n,this.prerelease=i}static fromString(e){return Xn(vH,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 Vd=class{constructor(e,r){this.plugin=e,this.dependencies=r}getDependency(e){let r=this.dependencies.find(n=>n.pluginId===e);if(r===void 0)throw new cl({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.plugin.app.plugins.getPlugin(e)}throwPluginNotFound(e){throw new cl({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e} is required, but not installed. Please install the plugin.`})}checkDependencyVersion(e,r){if(Na.lessThan(r,e.minVersion))throw new cl({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${r}. Please update the plugin.`});if(e.maxVersion!==void 0&&(Na.greaterThan(r,e.maxVersion)||Na.equals(r,e.maxVersion)))throw new cl({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`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=Na.fromString(n.manifest.version);return this.checkDependencyVersion(r,i),n}checkDependencyOnStartup(e){let r=this.getDependency(e);if(!this.plugin.app.plugins.enabledPlugins.has(e))throw this.throwPluginNotFound(e),Error("unreachable");let n=Na.fromString(this.plugin.app.plugins.manifests[e].version);this.checkDependencyVersion(r,n)}checkDependenciesOnStartup(){let e=new Qt("Dependency Validation");for(let r of this.dependencies)if(r.checkOnStartup)try{this.checkDependencyOnStartup(r.pluginId)}catch(n){e.add(n)}return e.hasErrors()?(this.plugin.internal.openErrorCollectionViewModal({text:"The following errors were detected during dependency validation. The plugin won't load until these errors have been resolved. Please install the required plugins and restart Obsidian.",errorCollection:e}),!0):!1}};var gF=require("obsidian");var pF={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:""},ob={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 mF(t){let e=[];for(let[r,n]of Object.entries(pF)){if(n==="")continue;let i=t.api.inputFieldParser.fromString(`INPUT[${n}]`),a=t.api.inputFieldParser.fromSimpleDeclaration({inputFieldType:void 0,templateName:void 0,bindTarget:void 0,arguments:[{name:"showcase",value:["true"]},{name:"title",value:[r]}]});i=t.api.inputFieldParser.merge(i,a),i.declarationString=`INPUT[${n}]`;let o=t.api.inputFieldParser.validate(i,"",void 0);e.push([r,o])}return e}function dF(t){let e=[];for(let[r,n]of Object.entries(pF)){if(n==="")continue;let i=r,a="";ld[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 hF(t){let e=[];for(let r of Object.values(ob))for(let n of r)e.push([n.title,`\`${n.display}\``]);return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function vF(t,e,r){let n=dF(r),i=hF(r);t.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(s=>{s.setTitle("Input Field");let l=s.setSubmenu();for(let[u,c]of n)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Ud(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(()=>Ud(e,c))})}),o.addItem(s=>{s.setTitle("Inline Button"),s.onClick(()=>{Ud(e,"`BUTTON[example-id]`")})}),o.addItem(s=>{s.setTitle("Button"),s.onClick(()=>{r.internal.openButtonBuilderModal({onOkay:l=>{Ud(e,`\`\`\`meta-bind-button
${(0,gF.stringifyYaml)(l)}
\`\`\``)},submitText:"Insert"})})})})}function Ud(t,e){t.replaceSelection(e)}var m9=require("obsidian");var NF=zr(Ma());var Sn=zr(Ma()),cb=zr(ca());var _F=zr(Ma()),Zi=zr(ca());var xp=zr(Ma()),Fa=zr(ca()),Mi=Fa.P.sequence(Fa.P.or(xp.P_UTILS.unicodeLetter(),Fa.P.oneOf("_$")),Fa.P.or(xp.P_UTILS.unicodeAlphanumeric(),Fa.P.oneOf("-_$")).many()).map(t=>t[0]+t[1].join("")).describe("identifier"),yF=Fa.P.sequenceMap((t,e)=>t+e.map(r=>r[0]+r[1]).join(""),Mi,Fa.P.sequence(xp.P_UTILS.optionalWhitespace(),Mi).many()).describe("identifier with spaces"),yH=Fa.P.string("\\").then(xp.P_UTILS.any()).map(t=>t==="'"?"'":t==="\\"?"\\":"\\"+t);function xF(t){return Fa.P.or(yH,Fa.P.noneOf(t+"\\")).many().map(e=>e.join("")).trim(Fa.P.string(t))}var qd=xF("'"),bF=xF('"'),Mc=Fa.P.manyNotOf("{}[]#^|:?").box("file path");function ji(t,e){return{value:t,position:e}}function Ia(t){if(t!==void 0)return typeof t=="string"?{value:t}:t}var hl=(r=>(r.OBJECT="object",r.ARRAY="array",r))(hl||{}),zd=class{constructor(e,r,n){this.parent=e,this.access=r,this.child=n}};function xH(t,e){return t[e]}function wF(t,e,r){t[e]=r}var dl=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 zd(e,this,xH(e,this.prop))}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");return new zd(e,this,e[this.index])}}set(e,r){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");wF(e,this.prop,r)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=r}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");wF(e,this.prop,void 0)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=void 0}}};var AF=Mi.node((t,e)=>({type:"object",prop:ji(t,e)})),sb=Zi.P.or(_F.P_UTILS.digits().wrap(Zi.P.string("["),Zi.P.string("]")).node((t,e)=>({type:"array",prop:ji(t,e)})),bF.wrap(Zi.P.string("["),Zi.P.string("]")).node((t,e)=>({type:"object",prop:ji(t,e)}))),bH=Zi.P.or(Zi.P.sequenceMap(t=>({storagePath:void 0,listenToChildren:!1,storageProp:t}),sb.atLeast(1)),Zi.P.sequenceMap((t,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[t,...e]}),AF,sb.many())),wH=Zi.P.sequenceMap((t,e)=>[t,...e],AF,sb.many()),ub=Zi.P.sequenceMap((t,e)=>(t.storageProp=t.storageProp.concat(e.flat()),t),bH,Zi.P.string(".").then(wH).many()),rs=Zi.P.sequenceMap((t,e,r)=>(r.storageType=t,r.storagePath=e,r),Mi.describe("storage type").node(ji).skip(Zi.P.string("^").describe('storage type separator "^"')).optional(),Mc.describe("storage path").node(ji).skip(Zi.P.string("#").describe('storage/file path separator "#"')).optional(),ub.describe("property path")).box("bind target");var Hd=zr(Ma()),ns=zr(ca());var lb=ns.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),_H=ns.P.or(qd,lb).node(ji),AH=ns.P.separateBy(_H,ns.P.string(",").describe('argument value separator ","').trim(Hd.P_UTILS.optionalWhitespace())),SH=ns.P.sequenceMap((t,e)=>({name:t,value:e}),Mi.node(ji),AH.trim(Hd.P_UTILS.optionalWhitespace()).wrap(ns.P.string("(").describe('argument value paren "("'),ns.P.string(")").describe('argument value paren ")"')).optional([])),bp=ns.P.separateBy(SH,ns.P.string(",").describe('argument separator ","').trim(Hd.P_UTILS.optionalWhitespace()));var fa=zr(Ma()),Un=zr(ca());var EH=Un.P.string("\\").then(fa.P_UTILS.any()).map(t=>t==="["?"[":t==="]"?"]":t==="{"?"{":t==="}"?"}":t==="\\"?"\\":"\\"+t),Gd=Un.P.sequenceMap((t,e)=>t+e.flat().join(""),Un.P.manyNotOf("{}[]\\"),Un.P.sequence(EH,Un.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),TH=Un.P.sequenceMap((t,e)=>[t,...e.flat()],Gd,Un.P.sequence(rs.wrapString("{","}"),Gd).many()),DH=Un.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{viewFieldType:t,writeToBindTarget:n,arguments:e,templateDeclaration:void 0}},Mi.node(ji).trim(fa.P_UTILS.optionalWhitespace()).optional().describe("input field type"),bp.trim(fa.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(fa.P_UTILS.optionalWhitespace()).optional([]),Un.P.sequence(Un.P.string(":").trim(fa.P_UTILS.optionalWhitespace()),rs).trim(fa.P_UTILS.optionalWhitespace()).optional()),SF=Un.P.sequenceMap((t,e,r,n)=>n===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(n.templateDeclaration=e,n),Un.P.string("VIEW"),TH.wrapString("[","]"),fa.P_UTILS.optionalWhitespace(),DH.wrapString("[","]").optional(),fa.P_UTILS.eof()),MH=Un.P.sequenceMap((t,e,r,n)=>(e!==void 0&&(t.listenToChildren=!0),{bindTarget:t,name:n}),rs.wrapString("{","}"),Un.P.string(" and children").optional(),Un.P.string(" as "),Mi),EF=Un.P.sequenceMap((t,e,r,n)=>({bindTargetMappings:t,writeToBindTarget:e,hidden:r!==void 0,code:n}),MH.separateBy(fa.P_UTILS.whitespace()).skip(fa.P_UTILS.whitespace()),Un.P.string("save to ").then(rs.wrapString("{","}")).skip(fa.P_UTILS.whitespace()).optional(),Un.P.string("hidden").skip(fa.P_UTILS.whitespace()).optional(),Un.P.string("---").then(fa.P_UTILS.remaining()));var fb=Rt.highlight(Mi,"ident"),Wd=Rt.highlight(Mi,"keyword"),pb=Rt.highlightStr(",","control"),Yd=Rt.highlightStr("(","control"),jd=Rt.highlightStr(")","control"),Cc=Rt.highlightStr("[","control"),Nc=Rt.highlightStr("]","control"),CH=Rt.highlight(qd,"string"),NH=Rt.highlight(lb,"ident"),FH=cb.P.or(NH,CH),IH=Rt.separateBy(FH,pb.trim(Sn.P_UTILS.optionalWhitespace())),PH=Rt.sequence(Wd,Rt.sequence(Yd,IH.trim(Sn.P_UTILS.optionalWhitespace()),jd).optional()),mb=Rt.separateBy(PH,pb.trim(Sn.P_UTILS.optionalWhitespace())),Fc=Rt.sequence(Rt.sequence(fb,Rt.highlightStr("^","control")).optional(),Rt.sequence(Rt.highlight(Mc,"ident"),Rt.highlightStr("#","control")).optional(),Rt.highlight(ub,"ident")),BH=Rt.sequence(Wd.trim(Sn.P_UTILS.optionalWhitespace()),Rt.sequence(Yd,mb.trim(Sn.P_UTILS.optionalWhitespace()),jd).trim(Sn.P_UTILS.optionalWhitespace()).optional(),Rt.sequence(Rt.highlightStr(":","control").trim(Sn.P_UTILS.optionalWhitespace()),Fc).trim(Sn.P_UTILS.optionalWhitespace()).optional()),kH=Rt.sequence(Wd.trim(Sn.P_UTILS.optionalWhitespace()).optional(),Rt.sequence(Yd,mb.trim(Sn.P_UTILS.optionalWhitespace()),jd).trim(Sn.P_UTILS.optionalWhitespace()).optional(),Rt.sequence(Rt.highlightStr(":","control").trim(Sn.P_UTILS.optionalWhitespace()),Fc).trim(Sn.P_UTILS.optionalWhitespace()).optional()),DF=cb.P.or(Rt.sequence(Rt.highlightStr("INPUT","control"),Cc,fb.trim(Sn.P_UTILS.optionalWhitespace()),Nc.skip(Sn.P_UTILS.optionalWhitespace()),Cc,kH,Nc),Rt.sequence(Rt.highlightStr("INPUT","control"),Cc,BH,Nc)),TF=Rt.highlight(Gd,"ident"),$H=Rt.sequence(Rt.highlightStr("{","string"),Fc,Rt.highlightStr("}","string")),OH=Rt.sequence(TF,Rt.sequence($H,TF).many()),RH=Rt.sequence(Wd.trim(Sn.P_UTILS.optionalWhitespace()).optional(),Rt.sequence(Yd,mb.trim(Sn.P_UTILS.optionalWhitespace()).optional(),jd).trim(Sn.P_UTILS.optionalWhitespace()).optional(),Rt.sequence(Rt.highlightStr(":","control").trim(Sn.P_UTILS.optionalWhitespace()),Fc).trim(Sn.P_UTILS.optionalWhitespace()).optional()),MF=Rt.sequence(Rt.highlightStr("VIEW","control"),Cc,OH,Nc,Rt.sequence(Cc.skip(Sn.P_UTILS.optionalWhitespace()),RH,Nc).optional()),CF=Rt.sequence(Rt.highlightStr("BUTTON","control"),Cc,Rt.separateBy(fb,pb.trim(Sn.P_UTILS.optionalWhitespace())),Nc);var Zd=class{constructor(e){this.plugin=e}highlightInputFieldDeclaration(e,r){return this.highlightWithParser(e,r,DF)}highlightViewFieldDeclaration(e,r){return this.highlightWithParser(e,r,MF)}highlightInlineButtonDeclaration(e,r){return this.highlightWithParser(e,r,CF)}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,Fc)}highlightWithParser(e,r,n){try{return r?new Bs(e,Xn(n.trim(NF.P_UTILS.optionalWhitespace()).thenEof(),e)):new Bs(e,Xn(n.thenEof(),e))}catch(i){return i instanceof lp?new Bs(e,[],i):(console.error(i),new Bs(e,[]))}}};var rn=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(rn||{}),Kn=(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))(Kn||{});var Ir;(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})(Ir||(Ir={}));var hb;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(hb||(hb={}));var mt=Ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Os=t=>{switch(typeof t){case"undefined":return mt.undefined;case"string":return mt.string;case"number":return isNaN(t)?mt.nan:mt.number;case"boolean":return mt.boolean;case"function":return mt.function;case"bigint":return mt.bigint;case"symbol":return mt.symbol;case"object":return Array.isArray(t)?mt.array:t===null?mt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?mt.promise:typeof Map<"u"&&t instanceof Map?mt.map:typeof Set<"u"&&t instanceof Set?mt.set:typeof Date<"u"&&t instanceof Date?mt.date:mt.object;default:return mt.unknown}},qe=Ir.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"]),LH=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Pa=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,Ir.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()}};Pa.create=t=>new Pa(t);var Bc=(t,e)=>{let r;switch(t.code){case qe.invalid_type:t.received===mt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case qe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ir.jsonStringifyReplacer)}`;break;case qe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ir.joinValues(t.keys,", ")}`;break;case qe.invalid_union:r="Invalid input";break;case qe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ir.joinValues(t.options)}`;break;case qe.invalid_enum_value:r=`Invalid enum value. Expected ${Ir.joinValues(t.options)}, received '${t.received}'`;break;case qe.invalid_arguments:r="Invalid function arguments";break;case qe.invalid_return_type:r="Invalid function return type";break;case qe.invalid_date:r="Invalid date";break;case qe.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}"`:Ir.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case qe.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 qe.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 qe.custom:r="Invalid input";break;case qe.invalid_intersection_types:r="Intersection results could not be merged";break;case qe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case qe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ir.assertNever(t)}return{message:r}},PF=Bc;function VH(t){PF=t}function Xd(){return PF}var Qd=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}},UH=[];function lt(t,e){let r=Xd(),n=Qd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Bc?void 0:Bc].filter(i=>!!i)});t.common.issues.push(n)}var Ci=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 Zt;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 Zt;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}}},Zt=Object.freeze({status:"aborted"}),Pc=t=>({status:"dirty",value:t}),Ji=t=>({status:"valid",value:t}),gb=t=>t.status==="aborted",vb=t=>t.status==="dirty",gl=t=>t.status==="valid",Ap=t=>typeof Promise<"u"&&t instanceof Promise;function Kd(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 BF(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 Mt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Mt||(Mt={}));var wp,_p,ao=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}},FF=(t,e)=>{if(gl(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 Pa(t.common.issues);return this._error=r,this._error}}};function pr(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 mr=class{get description(){return this._def.description}_getType(e){return Os(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Os(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ci,ctx:{common:e.parent.common,data:e.data,parsedType:Os(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ap(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:Os(e)},a=this._parseSync({data:e,path:i.path,parent:i});return FF(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:Os(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:i});return gl(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=>gl(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:Os(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Ap(i)?i:Promise.resolve(i));return FF(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:qe.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 Ba({schema:this,typeName:Gt.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 io.create(this,this._def)}nullable(){return as.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ls.create(this)}promise(){return xu.create(this,this._def)}or(e){return Al.create([this,e],this._def)}and(e){return Sl.create(this,e,this._def)}transform(e){return new Ba({...pr(this._def),schema:this,typeName:Gt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Cl({...pr(this._def),innerType:this,defaultValue:r,typeName:Gt.ZodDefault})}brand(){return new Sp({typeName:Gt.ZodBranded,type:this,...pr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Nl({...pr(this._def),innerType:this,catchValue:r,typeName:Gt.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ep.create(this,e)}readonly(){return Fl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qH=/^c[^\s-]{8,}$/i,zH=/^[0-9a-z]+$/,HH=/^[0-9A-HJKMNP-TV-Z]{26}$/i,GH=/^[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,WH=/^[a-z0-9_-]{21}$/i,YH=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jH=/^[-+]?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)?)??$/,ZH=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",db,XH=/^(?:(?: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])$/,QH=/^(?:(?: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])$/,KH=/^(([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]))$/,eG=/^(([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])$/,tG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kF="((\\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])))",nG=new RegExp(`^${kF}$`);function $F(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function iG(t){return new RegExp(`^${$F(t)}$`)}function OF(t){let e=`${kF}T${$F(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 aG(t,e){return!!((e==="v4"||!e)&&XH.test(t)||(e==="v6"||!e)&&KH.test(t))}function oG(t,e){if(!YH.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 sG(t,e){return!!((e==="v4"||!e)&&QH.test(t)||(e==="v6"||!e)&&eG.test(t))}var vu=class t extends mr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==mt.string){let a=this._getOrReturnCtx(e);return lt(a,{code:qe.invalid_type,expected:mt.string,received:a.parsedType}),Zt}let n=new Ci,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),lt(i,{code:qe.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),lt(i,{code:qe.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?lt(i,{code:qe.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&lt(i,{code:qe.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ZH.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"email",code:qe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")db||(db=new RegExp(JH,"u")),db.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"emoji",code:qe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")GH.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"uuid",code:qe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")WH.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"nanoid",code:qe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")qH.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"cuid",code:qe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")zH.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"cuid2",code:qe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")HH.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"ulid",code:qe.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),lt(i,{validation:"url",code:qe.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),lt(i,{validation:"regex",code:qe.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),lt(i,{code:qe.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),lt(i,{code:qe.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),lt(i,{code:qe.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?OF(a).test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{code:qe.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?nG.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{code:qe.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?iG(a).test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{code:qe.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?jH.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"duration",code:qe.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?aG(e.data,a.version)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"ip",code:qe.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?oG(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"jwt",code:qe.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?sG(e.data,a.version)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"cidr",code:qe.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?tG.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"base64",code:qe.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?rG.test(e.data)||(i=this._getOrReturnCtx(e,i),lt(i,{validation:"base64url",code:qe.invalid_string,message:a.message}),n.dirty()):Ir.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:qe.invalid_string,...Mt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Mt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Mt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Mt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Mt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Mt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Mt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Mt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Mt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Mt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Mt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Mt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Mt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Mt.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,...Mt.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,...Mt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Mt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Mt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Mt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Mt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Mt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Mt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Mt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Mt.errToObj(r)})}nonempty(e){return this.min(1,Mt.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}};vu.create=t=>{var e;return new vu({checks:[],typeName:Gt.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...pr(t)})};function uG(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 vl=class t extends mr{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)!==mt.number){let a=this._getOrReturnCtx(e);return lt(a,{code:qe.invalid_type,expected:mt.number,received:a.parsedType}),Zt}let n,i=new Ci;for(let a of this._def.checks)a.kind==="int"?Ir.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),lt(n,{code:qe.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),lt(n,{code:qe.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),lt(n,{code:qe.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?uG(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),lt(n,{code:qe.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),lt(n,{code:qe.not_finite,message:a.message}),i.dirty()):Ir.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Mt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Mt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Mt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Mt.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mt.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Mt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Mt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Mt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Mt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Mt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Mt.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"&&Ir.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)}};vl.create=t=>new vl({checks:[],typeName:Gt.ZodNumber,coerce:t?.coerce||!1,...pr(t)});var yl=class t extends mr{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)!==mt.bigint)return this._getInvalidInput(e);let n,i=new Ci;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),lt(n,{code:qe.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),lt(n,{code:qe.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),lt(n,{code:qe.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ir.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return lt(r,{code:qe.invalid_type,expected:mt.bigint,received:r.parsedType}),Zt}gte(e,r){return this.setLimit("min",e,!0,Mt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Mt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Mt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Mt.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mt.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:Mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Mt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Mt.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}};yl.create=t=>{var e;return new yl({checks:[],typeName:Gt.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...pr(t)})};var xl=class extends mr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==mt.boolean){let n=this._getOrReturnCtx(e);return lt(n,{code:qe.invalid_type,expected:mt.boolean,received:n.parsedType}),Zt}return Ji(e.data)}};xl.create=t=>new xl({typeName:Gt.ZodBoolean,coerce:t?.coerce||!1,...pr(t)});var bl=class t extends mr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==mt.date){let a=this._getOrReturnCtx(e);return lt(a,{code:qe.invalid_type,expected:mt.date,received:a.parsedType}),Zt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return lt(a,{code:qe.invalid_date}),Zt}let n=new Ci,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),lt(i,{code:qe.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),lt(i,{code:qe.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ir.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:Mt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Mt.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}};bl.create=t=>new bl({checks:[],coerce:t?.coerce||!1,typeName:Gt.ZodDate,...pr(t)});var kc=class extends mr{_parse(e){if(this._getType(e)!==mt.symbol){let n=this._getOrReturnCtx(e);return lt(n,{code:qe.invalid_type,expected:mt.symbol,received:n.parsedType}),Zt}return Ji(e.data)}};kc.create=t=>new kc({typeName:Gt.ZodSymbol,...pr(t)});var wl=class extends mr{_parse(e){if(this._getType(e)!==mt.undefined){let n=this._getOrReturnCtx(e);return lt(n,{code:qe.invalid_type,expected:mt.undefined,received:n.parsedType}),Zt}return Ji(e.data)}};wl.create=t=>new wl({typeName:Gt.ZodUndefined,...pr(t)});var _l=class extends mr{_parse(e){if(this._getType(e)!==mt.null){let n=this._getOrReturnCtx(e);return lt(n,{code:qe.invalid_type,expected:mt.null,received:n.parsedType}),Zt}return Ji(e.data)}};_l.create=t=>new _l({typeName:Gt.ZodNull,...pr(t)});var yu=class extends mr{constructor(){super(...arguments),this._any=!0}_parse(e){return Ji(e.data)}};yu.create=t=>new yu({typeName:Gt.ZodAny,...pr(t)});var Rs=class extends mr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ji(e.data)}};Rs.create=t=>new Rs({typeName:Gt.ZodUnknown,...pr(t)});var ko=class extends mr{_parse(e){let r=this._getOrReturnCtx(e);return lt(r,{code:qe.invalid_type,expected:mt.never,received:r.parsedType}),Zt}};ko.create=t=>new ko({typeName:Gt.ZodNever,...pr(t)});var $c=class extends mr{_parse(e){if(this._getType(e)!==mt.undefined){let n=this._getOrReturnCtx(e);return lt(n,{code:qe.invalid_type,expected:mt.void,received:n.parsedType}),Zt}return Ji(e.data)}};$c.create=t=>new $c({typeName:Gt.ZodVoid,...pr(t)});var Ls=class t extends mr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==mt.array)return lt(r,{code:qe.invalid_type,expected:mt.array,received:r.parsedType}),Zt;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(lt(r,{code:o?qe.too_big:qe.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&&(lt(r,{code:qe.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&&(lt(r,{code:qe.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 ao(r,o,r.path,s)))).then(o=>Ci.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new ao(r,o,r.path,s)));return Ci.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Mt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Mt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Mt.toString(r)}})}nonempty(e){return this.min(1,e)}};Ls.create=(t,e)=>new Ls({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Gt.ZodArray,...pr(e)});function Ic(t){if(t instanceof pa){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=io.create(Ic(n))}return new pa({...t._def,shape:()=>e})}else return t instanceof Ls?new Ls({...t._def,type:Ic(t.element)}):t instanceof io?io.create(Ic(t.unwrap())):t instanceof as?as.create(Ic(t.unwrap())):t instanceof is?is.create(t.items.map(e=>Ic(e))):t}var pa=class t extends mr{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=Ir.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==mt.object){let u=this._getOrReturnCtx(e);return lt(u,{code:qe.invalid_type,expected:mt.object,received:u.parsedType}),Zt}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ko&&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 ao(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ko){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&&(lt(i,{code:qe.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 ao(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=>Ci.mergeObjectSync(n,u)):Ci.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Mt.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=Mt.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:Gt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Ir.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 Ir.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return Ic(this)}partial(e){let r={};return Ir.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 Ir.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof io;)a=a._def.innerType;r[n]=a}}),new t({...this._def,shape:()=>r})}keyof(){return RF(Ir.objectKeys(this.shape))}};pa.create=(t,e)=>new pa({shape:()=>t,unknownKeys:"strip",catchall:ko.create(),typeName:Gt.ZodObject,...pr(e)});pa.strictCreate=(t,e)=>new pa({shape:()=>t,unknownKeys:"strict",catchall:ko.create(),typeName:Gt.ZodObject,...pr(e)});pa.lazycreate=(t,e)=>new pa({shape:t,unknownKeys:"strip",catchall:ko.create(),typeName:Gt.ZodObject,...pr(e)});var Al=class extends mr{_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 Pa(s.ctx.common.issues));return lt(r,{code:qe.invalid_union,unionErrors:o}),Zt}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 Pa(l));return lt(r,{code:qe.invalid_union,unionErrors:s}),Zt}}get options(){return this._def.options}};Al.create=(t,e)=>new Al({options:t,typeName:Gt.ZodUnion,...pr(e)});var $s=t=>t instanceof El?$s(t.schema):t instanceof Ba?$s(t.innerType()):t instanceof Tl?[t.value]:t instanceof Dl?t.options:t instanceof Ml?Ir.objectValues(t.enum):t instanceof Cl?$s(t._def.innerType):t instanceof wl?[void 0]:t instanceof _l?[null]:t instanceof io?[void 0,...$s(t.unwrap())]:t instanceof as?[null,...$s(t.unwrap())]:t instanceof Sp||t instanceof Fl?$s(t.unwrap()):t instanceof Nl?$s(t._def.innerType):[],eh=class t extends mr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==mt.object)return lt(r,{code:qe.invalid_type,expected:mt.object,received:r.parsedType}),Zt;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}):(lt(r,{code:qe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Zt)}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=$s(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:Gt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...pr(n)})}};function yb(t,e){let r=Os(t),n=Os(e);if(t===e)return{valid:!0,data:t};if(r===mt.object&&n===mt.object){let i=Ir.objectKeys(e),a=Ir.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=yb(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===mt.array&&n===mt.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=yb(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===mt.date&&n===mt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Sl=class extends mr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(gb(a)||gb(o))return Zt;let s=yb(a.value,o.value);return s.valid?((vb(a)||vb(o))&&r.dirty(),{status:r.value,value:s.data}):(lt(n,{code:qe.invalid_intersection_types}),Zt)};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}))}};Sl.create=(t,e,r)=>new Sl({left:t,right:e,typeName:Gt.ZodIntersection,...pr(r)});var is=class t extends mr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==mt.array)return lt(n,{code:qe.invalid_type,expected:mt.array,received:n.parsedType}),Zt;if(n.data.length<this._def.items.length)return lt(n,{code:qe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Zt;!this._def.rest&&n.data.length>this._def.items.length&&(lt(n,{code:qe.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 ao(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>Ci.mergeArray(r,o)):Ci.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};is.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new is({items:t,typeName:Gt.ZodTuple,rest:null,...pr(e)})};var th=class t extends mr{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!==mt.object)return lt(n,{code:qe.invalid_type,expected:mt.object,received:n.parsedType}),Zt;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new ao(n,s,n.path,s)),value:o._parse(new ao(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ci.mergeObjectAsync(r,i):Ci.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof mr?new t({keyType:e,valueType:r,typeName:Gt.ZodRecord,...pr(n)}):new t({keyType:vu.create(),valueType:e,typeName:Gt.ZodRecord,...pr(r)})}},Oc=class extends mr{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!==mt.map)return lt(n,{code:qe.invalid_type,expected:mt.map,received:n.parsedType}),Zt;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],u)=>({key:i._parse(new ao(n,s,n.path,[u,"key"])),value:a._parse(new ao(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 Zt;(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 Zt;(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:Gt.ZodMap,...pr(r)});var Rc=class t extends mr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==mt.set)return lt(n,{code:qe.invalid_type,expected:mt.set,received:n.parsedType}),Zt;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(lt(n,{code:qe.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&&(lt(n,{code:qe.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 Zt;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 ao(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:Mt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Mt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Rc.create=(t,e)=>new Rc({valueType:t,minSize:null,maxSize:null,typeName:Gt.ZodSet,...pr(e)});var rh=class t extends mr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==mt.function)return lt(r,{code:qe.invalid_type,expected:mt.function,received:r.parsedType}),Zt;function n(s,l){return Qd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Xd(),Bc].filter(u=>!!u),issueData:{code:qe.invalid_arguments,argumentsError:l}})}function i(s,l){return Qd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Xd(),Bc].filter(u=>!!u),issueData:{code:qe.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof xu){let s=this;return Ji(async function(...l){let u=new Pa([]),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 Ji(function(...l){let u=s._def.args.safeParse(l,a);if(!u.success)throw new Pa([n(l,u.error)]);let c=Reflect.apply(o,this,u.data),f=s._def.returns.safeParse(c,a);if(!f.success)throw new Pa([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:is.create(e).rest(Rs.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||is.create([]).rest(Rs.create()),returns:r||Rs.create(),typeName:Gt.ZodFunction,...pr(n)})}},El=class extends mr{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})}};El.create=(t,e)=>new El({getter:t,typeName:Gt.ZodLazy,...pr(e)});var Tl=class extends mr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return lt(r,{received:r.data,code:qe.invalid_literal,expected:this._def.value}),Zt}return{status:"valid",value:e.data}}get value(){return this._def.value}};Tl.create=(t,e)=>new Tl({value:t,typeName:Gt.ZodLiteral,...pr(e)});function RF(t,e){return new Dl({values:t,typeName:Gt.ZodEnum,...pr(e)})}var Dl=class t extends mr{constructor(){super(...arguments),wp.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return lt(r,{expected:Ir.joinValues(n),received:r.parsedType,code:qe.invalid_type}),Zt}if(Kd(this,wp,"f")||BF(this,wp,new Set(this._def.values),"f"),!Kd(this,wp,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return lt(r,{received:r.data,code:qe.invalid_enum_value,options:n}),Zt}return Ji(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})}};wp=new WeakMap;Dl.create=RF;var Ml=class extends mr{constructor(){super(...arguments),_p.set(this,void 0)}_parse(e){let r=Ir.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==mt.string&&n.parsedType!==mt.number){let i=Ir.objectValues(r);return lt(n,{expected:Ir.joinValues(i),received:n.parsedType,code:qe.invalid_type}),Zt}if(Kd(this,_p,"f")||BF(this,_p,new Set(Ir.getValidEnumValues(this._def.values)),"f"),!Kd(this,_p,"f").has(e.data)){let i=Ir.objectValues(r);return lt(n,{received:n.data,code:qe.invalid_enum_value,options:i}),Zt}return Ji(e.data)}get enum(){return this._def.values}};_p=new WeakMap;Ml.create=(t,e)=>new Ml({values:t,typeName:Gt.ZodNativeEnum,...pr(e)});var xu=class extends mr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==mt.promise&&r.common.async===!1)return lt(r,{code:qe.invalid_type,expected:mt.promise,received:r.parsedType}),Zt;let n=r.parsedType===mt.promise?r.data:Promise.resolve(r.data);return Ji(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};xu.create=(t,e)=>new xu({type:t,typeName:Gt.ZodPromise,...pr(e)});var Ba=class extends mr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Gt.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=>{lt(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 Zt;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?Zt:l.status==="dirty"||r.value==="dirty"?Pc(l.value):l});{if(r.value==="aborted")return Zt;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Zt:s.status==="dirty"||r.value==="dirty"?Pc(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"?Zt:(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"?Zt:(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(!gl(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=>gl(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):o);Ir.assertNever(i)}};Ba.create=(t,e,r)=>new Ba({schema:t,typeName:Gt.ZodEffects,effect:e,...pr(r)});Ba.createWithPreprocess=(t,e,r)=>new Ba({schema:e,effect:{type:"preprocess",transform:t},typeName:Gt.ZodEffects,...pr(r)});var io=class extends mr{_parse(e){return this._getType(e)===mt.undefined?Ji(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};io.create=(t,e)=>new io({innerType:t,typeName:Gt.ZodOptional,...pr(e)});var as=class extends mr{_parse(e){return this._getType(e)===mt.null?Ji(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};as.create=(t,e)=>new as({innerType:t,typeName:Gt.ZodNullable,...pr(e)});var Cl=class extends mr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===mt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Cl.create=(t,e)=>new Cl({innerType:t,typeName:Gt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...pr(e)});var Nl=class extends mr{_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 Ap(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Pa(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Pa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Nl.create=(t,e)=>new Nl({innerType:t,typeName:Gt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...pr(e)});var Lc=class extends mr{_parse(e){if(this._getType(e)!==mt.nan){let n=this._getOrReturnCtx(e);return lt(n,{code:qe.invalid_type,expected:mt.nan,received:n.parsedType}),Zt}return{status:"valid",value:e.data}}};Lc.create=t=>new Lc({typeName:Gt.ZodNaN,...pr(t)});var lG=Symbol("zod_brand"),Sp=class extends mr{_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}},Ep=class t extends mr{_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"?Zt:a.status==="dirty"?(r.dirty(),Pc(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"?Zt: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:Gt.ZodPipeline})}},Fl=class extends mr{_parse(e){let r=this._def.innerType._parse(e),n=i=>(gl(i)&&(i.value=Object.freeze(i.value)),i);return Ap(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fl.create=(t,e)=>new Fl({innerType:t,typeName:Gt.ZodReadonly,...pr(e)});function LF(t,e={},r){return t?yu.create().superRefine((n,i)=>{var a,o;if(!t(n)){let s=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(o=(a=s.fatal)!==null&&a!==void 0?a:r)!==null&&o!==void 0?o:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):yu.create()}var cG={object:pa.lazycreate},Gt;(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"})(Gt||(Gt={}));var fG=(t,e={message:`Input not instance of ${t.name}`})=>LF(r=>r instanceof t,e),VF=vu.create,UF=vl.create,pG=Lc.create,mG=yl.create,qF=xl.create,dG=bl.create,hG=kc.create,gG=wl.create,vG=_l.create,yG=yu.create,xG=Rs.create,bG=ko.create,wG=$c.create,_G=Ls.create,AG=pa.create,SG=pa.strictCreate,EG=Al.create,TG=eh.create,DG=Sl.create,MG=is.create,CG=th.create,NG=Oc.create,FG=Rc.create,IG=rh.create,PG=El.create,BG=Tl.create,kG=Dl.create,$G=Ml.create,OG=xu.create,IF=Ba.create,RG=io.create,LG=as.create,VG=Ba.createWithPreprocess,UG=Ep.create,qG=()=>VF().optional(),zG=()=>UF().optional(),HG=()=>qF().optional(),GG={string:t=>vu.create({...t,coerce:!0}),number:t=>vl.create({...t,coerce:!0}),boolean:t=>xl.create({...t,coerce:!0}),bigint:t=>yl.create({...t,coerce:!0}),date:t=>bl.create({...t,coerce:!0})},WG=Zt,ve=Object.freeze({__proto__:null,defaultErrorMap:Bc,setErrorMap:VH,getErrorMap:Xd,makeIssue:Qd,EMPTY_PATH:UH,addIssueToContext:lt,ParseStatus:Ci,INVALID:Zt,DIRTY:Pc,OK:Ji,isAborted:gb,isDirty:vb,isValid:gl,isAsync:Ap,get util(){return Ir},get objectUtil(){return hb},ZodParsedType:mt,getParsedType:Os,ZodType:mr,datetimeRegex:OF,ZodString:vu,ZodNumber:vl,ZodBigInt:yl,ZodBoolean:xl,ZodDate:bl,ZodSymbol:kc,ZodUndefined:wl,ZodNull:_l,ZodAny:yu,ZodUnknown:Rs,ZodNever:ko,ZodVoid:$c,ZodArray:Ls,ZodObject:pa,ZodUnion:Al,ZodDiscriminatedUnion:eh,ZodIntersection:Sl,ZodTuple:is,ZodRecord:th,ZodMap:Oc,ZodSet:Rc,ZodFunction:rh,ZodLazy:El,ZodLiteral:Tl,ZodEnum:Dl,ZodNativeEnum:Ml,ZodPromise:xu,ZodEffects:Ba,ZodTransformer:Ba,ZodOptional:io,ZodNullable:as,ZodDefault:Cl,ZodCatch:Nl,ZodNaN:Lc,BRAND:lG,ZodBranded:Sp,ZodPipeline:Ep,ZodReadonly:Fl,custom:LF,Schema:mr,ZodSchema:mr,late:cG,get ZodFirstPartyTypeKind(){return Gt},coerce:GG,any:yG,array:_G,bigint:mG,boolean:qF,date:dG,discriminatedUnion:TG,effect:IF,enum:kG,function:IG,instanceof:fG,intersection:DG,lazy:PG,literal:BG,map:NG,nan:pG,nativeEnum:$G,never:bG,null:vG,nullable:LG,number:UF,object:AG,oboolean:HG,onumber:zG,optional:RG,ostring:qG,pipeline:UG,preprocess:VG,promise:OG,record:CG,set:FG,strictObject:SG,string:VF,symbol:hG,transformer:IF,tuple:MG,undefined:gG,union:EG,unknown:xG,void:wG,NEVER:WG,ZodIssueCode:qe,quotelessJson:LH,ZodError:Pa});function GF(t,e){return(r,n)=>r[t]===void 0==(r[e]===void 0)?(n.addIssue({code:ve.ZodIssueCode.custom,message:`Either ${t} or ${e} must be used, but not both.`}),!1):!0}function $t(){return function(t){return t}}function pn(t,e){let r=t.safeParse(e);if(!r.success)throw new Ht({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 WF(t,e){return t.safeParse(e,{errorMap:ZG})}var zF=["zeroth","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],HF=["twent","thirt","fort","fift","sixt","sevent","eight","ninet"];function jG(t){return t<20?zF[t]:t%10===0?HF[Math.floor(t/10)-2]+"ieth":HF[Math.floor(t/10)-2]+"y-"+zF[t%10]}var ZG=(t,e)=>({message:`At '${t.path.map(n=>typeof n=="string"?n:jG(n+1)+" element").join(" > ")}'. ${e.defaultError}`});function nh(t,e,r){return ve.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 si(t,e,r){return ve.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 Vs(t,e,r){return ve.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 JG=$t()(ve.object({type:ve.literal("command"),command:si("command","command","command to run")})),XG=$t()(ve.object({type:ve.literal("js"),file:si("js","file","file path to the file to run"),args:ve.record(ve.unknown()).optional()})),QG=$t()(ve.object({type:ve.literal("open"),link:si("open","link","link to open"),newTab:Vs("open","newTab","").optional()})),KG=$t()(ve.object({type:ve.literal("input"),str:si("input","str","value to input")})),eW=$t()(ve.object({type:ve.literal("sleep"),ms:nh("sleep","ms","duration")})),tW=$t()(ve.object({type:ve.literal("templaterCreateNote"),templateFile:si("templaterCreateNote","templateFile","template file path"),folderPath:si("templaterCreateNote","folderPath","folder path").optional(),fileName:si("templaterCreateNote","fileName","file name").optional(),openNote:Vs("templaterCreateNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:Vs("templaterCreateNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),rW=$t()(ve.object({type:ve.literal("runTemplaterFile"),templateFile:si("runTemplaterFile","templateFile","template file path")})),nW=$t()(ve.object({type:ve.literal("updateMetadata"),bindTarget:si("updateMetadata","bindTarget","bind target to the metadata to update"),evaluate:Vs("updateMetadata","evaluate","value for whether to evaluate the value as a JavaScript expression"),value:ve.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."})})),iW=$t()(ve.object({type:ve.literal("createNote"),folderPath:si("createNote","folderPath","folder path").optional(),fileName:si("createNote","fileName","file name"),openNote:Vs("createNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:Vs("createNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),aW=$t()(ve.object({type:ve.literal("replaceInNote"),fromLine:nh("replaceInNote","fromLine","line to replace from"),toLine:nh("replaceInNote","toLine","line to replace to"),replacement:si("replaceInNote","replacement","replacement string"),templater:Vs("replaceInNote","templater","value for whether to use Templater").optional()})),oW=$t()(ve.object({type:ve.literal("replaceSelf"),replacement:si("replaceSelf","replacement","replacement string"),templater:Vs("replaceSelf","templater","value for whether to use Templater").optional()})),sW=$t()(ve.object({type:ve.literal("regexpReplaceInNote"),regexp:si("regexpReplaceInNote","regexp","search regular expression"),regexpFlags:si("regexpReplaceInNote","regexpFlags","regular expression flags string").optional(),replacement:si("regexpReplaceInNote","replacement","replacement string")})),uW=$t()(ve.object({type:ve.literal("insertIntoNote"),line:nh("insertIntoNote","line","line to insert at"),value:si("insertIntoNote","value","string to insert"),templater:Vs("insertIntoNote","templater","value for whether to use Templater").optional()})),lW=$t()(ve.object({type:ve.literal("inlineJS"),code:si("inlineJS","code","code string to run"),args:ve.record(ve.unknown()).optional()})),YF=$t()(ve.discriminatedUnion("type",[JG,XG,QG,KG,eW,tW,nW,iW,aW,oW,sW,uW,lW,rW])),cW=ve.nativeEnum(rn),Vc=$t()(ve.object({label:ve.string(),icon:ve.string().optional(),style:cW,class:ve.string().optional(),cssStyle:ve.string().optional(),backgroundImage:ve.string().optional(),tooltip:ve.string().optional(),id:ve.string().optional(),hidden:ve.boolean().optional(),action:YF.optional(),actions:YF.array().optional()}).superRefine(GF("action","actions")));var Ni=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 qn=class extends Ni{constructor(e,r,n){super(),this.plugin=e,this.filePath=n,this.uuid=r}getUuid(){return this.uuid}getFilePath(){return this.filePath}onMount(e){this.plugin.mountableManager.registerMountable(this)}onUnmount(e){this.plugin.mountableManager.unregisterMountable(this)}};var Uc=class{constructor(e){this.scope=e}};var bu=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 ih=class{constructor(){this.listeners=[]}registerListener(e){let r=e;return r.uuid=Fr(),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 Ht({errorLevel:"ERROR",effect:"error while calling listener callback",cause:i}))}}},yn=class extends ih{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},ah=class extends ih{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 $a=$t()(ve.string()),qc=$t()(ve.nativeEnum(Yi)),Tp=$t()(ve.nativeEnum(yc)),ZF=$t()(ve.nativeEnum(hu)),JF=$t()(ve.instanceof(HTMLElement)),zc=$t()(ve.instanceof(Uc)),vce=$t()(ve.instanceof(yn)),yce=$t()(ve.function().args().returns(ve.void())),xce=$t()(ve.instanceof(qn)),XF=$t()(ve.instanceof(Ni)),QF=$t()(ve.instanceof(du)),jF=$t()(ve.object({index:ve.number(),line:ve.number(),column:ve.number()})),fW=$t()(ve.object({from:jF,to:jF})),wu=$t()(ve.object({value:ve.string(),position:fW.optional()})),KF=$t()(ve.object({name:wu,value:wu.array()})),pW=$t()(ve.object({type:ve.nativeEnum(hl),prop:wu})),xb=$t()(ve.object({storageType:wu.optional(),storagePath:wu.optional(),storageProp:pW.array(),listenToChildren:ve.boolean()})),bce=$t()(ve.object({declarationString:ve.string().optional(),inputFieldType:wu.optional(),templateName:wu.optional(),bindTarget:xb.optional(),arguments:KF.array(),errorCollection:ve.instanceof(Qt)})),wce=$t()(ve.object({declarationString:ve.string().optional(),templateDeclaration:ve.array(ve.union([ve.string(),xb])).optional(),viewFieldType:wu.optional(),arguments:KF.array(),writeToBindTarget:xb.optional(),errorCollection:ve.instanceof(Qt)})),ka=$t()(ve.object({storageType:ve.string(),storagePath:ve.string(),storageProp:ve.instanceof(bu),listenToChildren:ve.boolean()})),eI=$t()(ve.object({name:ve.string(),value:ve.string().array()})),_ce=$t()(ve.object({type:ve.nativeEnum(hl),prop:ve.string()})),tI=$t()(ve.object({inputFieldType:ZF.optional(),templateName:ve.string().optional(),bindTarget:ka.optional(),arguments:eI.array().optional()})),rI=$t()(ve.object({viewFieldType:ZF.optional(),templateDeclaration:ve.union([ve.string(),ka]).array().optional(),arguments:eI.array().optional(),writeToBindTarget:ka.optional()})),mW=$t()(ve.object({bindTarget:ka,name:ve.string()})),dW=$t()(ve.object({bindTargetMappings:mW.array(),writeToBindTarget:ka.optional(),code:ve.string()})),hW=$t()(ve.object({referencedButtonIds:ve.string().array()})),nI=$t()(ve.object({renderChildType:qc,declaration:ve.union([ve.string(),tI]),scope:zc.optional()})),iI=$t()(ve.object({renderChildType:qc,declaration:ve.union([ve.string(),rI]),scope:zc.optional()})),aI=$t()(ve.object({declaration:ve.union([ve.string(),dW])})),oI=$t()(ve.object({bindTarget:ka,tableHead:ve.string().array(),columns:ve.array(ve.union([tI,rI,ve.string()]))})),sI=$t()(ve.object({renderChildType:qc,declaration:ve.union([ve.string(),hW]),position:QF.optional()})),uI=$t()(ve.object({declaration:ve.union([ve.string(),Vc]),position:QF.optional(),isPreview:ve.boolean()})),lI=$t()(ve.object({depth:ve.number(),content:ve.string()}));var jr=class{constructor(e,r){this.actionType=e,this.plugin=r}};var oh=class extends jr{constructor(e){super("command",e)}async run(e,r,n,i,a){this.plugin.internal.executeCommandById(r.command)}create(){return{type:"command",command:""}}getActionLabel(){return"Run a command"}};var sh=class extends jr{constructor(e){super("createNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists){let o=_d(wd(r.folderPath??"",r.fileName),"md");if(await this.plugin.internal.file.exists(o)){this.plugin.internal.file.open(o,"",!1);return}}await this.plugin.internal.file.create(r.folderPath??"",r.fileName,"md",r.openNote??!1)}create(){return{type:"createNote",folderPath:"/",fileName:"Untitled",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note"}};var uh=class extends jr{constructor(e){super("inlineJS",e)}async run(e,r,n,i,a){if(!this.plugin.settings.enableJs)throw new Fo({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.plugin.internal.jsEngineRunCode(r.code,n,o))()}create(){return{type:"inlineJS",code:'console.log("Hello world")',args:{}}}getActionLabel(){return"Run JavaScript code"}};var lh=class extends jr{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 ch=class extends jr{constructor(e){super("insertIntoNote",e)}async run(e,r,n,i,a){let o=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.value),n):r.value;await this.plugin.internal.file.atomicModify(n,s=>{let l=s.split(`
`);if(r.line<1||r.line>l.length+1)throw new Error("Line number out of bounds");return l=[...l.slice(0,r.line-1),o,...l.slice(r.line-1)],l.join(`
`)})}create(){return{type:"insertIntoNote",line:0,value:"Some text",templater:!1}}getActionLabel(){return"Insert text into the note"}};var fh=class extends jr{constructor(e){super("js",e)}async run(e,r,n,i,a){if(!this.plugin.settings.enableJs)throw new Fo({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.plugin.internal.jsEngineRunFile(r.file,n,o))()}create(){return{type:"js",file:"",args:{}}}getActionLabel(){return"Run a JavaScript file"}};var cI=zr(Ma()),ui=zr(ca());var fI=ui.P.sequence(Mc,ui.P.or(ui.P.string("#").then(ui.P.manyNotOf("[]#|:")),ui.P.string("#").result(void 0),ui.P.succeed(void 0)),ui.P.string("|").then(ui.P.manyNotOf("[]")).optional()),ph=ui.P.or(ui.P.sequenceMap((t,e)=>new Il(t!==void 0,e[0],e[1],e[2],!0),ui.P.string("!").optional(),fI.wrapString("[[","]]")),ui.P.sequenceMap((t,e,r)=>{let n=!Ac(r);return new Il(t!==void 0,r,void 0,e,n)},ui.P.string("!").optional(),ui.P.manyNotOf("[]").wrapString("[","]"),ui.P.manyNotOf("()").wrapString("(",")"))),gW=ui.P.separateBy(ph,ui.P.string(",").trim(cI.P_UTILS.optionalWhitespace())),Il=class t{constructor(e,r,n,i,a){this.isEmbed=e,this.target=r,this.block=n,this.alias=i,this.internal=a??!0}static fromUrl(e){return new t(!1,e.href,void 0,e.hostname,!1)}fullTarget(){return this.block?`${this.target}#${this.block}`:this.target}open(e,r,n){this.internal?e.internal.file.open(this.fullTarget(),r,n):bd(this.target)}toString(){let e=this.isEmbed?"!":"";if(this.internal){let r=this.alias?`|${this.alias}`:"";return`${e}[[${this.fullTarget()}${r}]]`}else{let r=this.alias??this.fullTarget();return`${e}[${r}](${this.fullTarget()})`}}},Cn=class t{static parseLink(e){return Xn(ph.thenEof(),e)}static parseLinkList(e){return Xn(gW.thenEof(),e)}static isLink(e){return ph.thenEof().tryParse(e).success}static urlToLink(e){return Il.fromUrl(e)}static parseLinkOrUrl(e){return Ac(e)?t.urlToLink(new URL(e)):t.parseLink(e)}static interpretAsLink(e){let r=ph.thenEof().tryParse(e);if(r.success)return r.value;let n=fI.thenEof().tryParse(e);if(n.success)return new Il(!1,n.value[0],n.value[1],n.value[2],!0);if(Ac(e)){let i=new URL(e);return Il.fromUrl(i)}}};var mh=class extends jr{constructor(e){super("open",e)}async run(e,r,n,i,a){let o=a.type==="middle"||a.ctrlKey||(r.newTab??!1),s=Cn.interpretAsLink(r.link);if(!s)throw new Error("Invalid link");s.open(this.plugin,n,o)}create(){return{type:"open",link:"",newTab:!0}}getActionLabel(){return"Open a link"}};var dh=class extends jr{constructor(e){super("regexpReplaceInNote",e)}async run(e,r,n,i,a){if(r.regexp==="")throw new Error("Regexp cannot be empty");await this.plugin.internal.file.atomicModify(n,o=>o.replace(new RegExp(r.regexp,r.regexpFlags??"g"),r.replacement))}create(){return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text",regexpFlags:"g"}}getActionLabel(){return"Replace text in note using regexp"}};var hh=class extends jr{constructor(e){super("replaceInNote",e)}async run(e,r,n,i,a){if(r.fromLine>r.toLine)throw new Error("From line cannot be greater than to line");let o=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.replacement),n):r.replacement;await this.plugin.internal.file.atomicModify(n,s=>{let l=s.split(`
`);if(r.fromLine<0||r.toLine>l.length+1)throw new Error("Line numbers out of bounds");return l=[...l.slice(0,r.fromLine-1),o,...l.slice(r.toLine)],l.join(`
`)})}create(){return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace text in note"}};var gh=class extends jr{constructor(e){super("replaceSelf",e)}async run(e,r,n,i,a){if(i.isInline)throw new Error("Replace self action not supported for inline buttons");if(i.position===void 0)throw new Error("Position of the button in the note is unknown");if(i.position.lineStart>i.position.lineEnd)throw new Error("Position of the button in the note is invalid");let o=i.position,s=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.replacement),n):r.replacement;await this.plugin.internal.file.atomicModify(n,l=>{let u=l.split(`
`);if(o.lineStart<0||o.lineEnd>u.length+1)throw new Error("Position of the button in the note is out of bounds");return u=[...u.slice(0,o.lineStart),s,...u.slice(o.lineEnd+1)],u.join(`
`)})}create(){return{type:"replaceSelf",replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace button with text"}};var vh=class extends jr{constructor(e){super("runTemplaterFile",e)}async run(e,r,n,i,a){let o=this.plugin.api.buttonActionRunner.resolveFilePath(r.templateFile);await this.plugin.internal.evaluateTemplaterTemplate(o,o)}create(){return{type:"runTemplaterFile",templateFile:""}}getActionLabel(){return"Run a templater file"}};var yh=class extends jr{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 xh=class extends jr{constructor(e){super("templaterCreateNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists&&r.fileName){let o=_d(wd(r.folderPath??"",r.fileName),"md");if(await this.plugin.internal.file.exists(o)){this.plugin.internal.file.open(o,"",!1);return}}await this.plugin.internal.createNoteWithTemplater(r.templateFile,r.folderPath,r.fileName,r.openNote)}create(){return{type:"templaterCreateNote",templateFile:"",folderPath:"/",fileName:"",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note using Templater"}};var Dp=zr(Ma()),_u=zr(ca());var dI=_u.P.sequenceMap((t,e)=>t===void 0?e:-e,_u.P.string("-").optional(),_u.P.or(_u.P.sequenceMap((t,e,r)=>Number(t+e+r),Dp.P_UTILS.digits(),_u.P.string("."),Dp.P_UTILS.digits()),Dp.P_UTILS.digits().map(t=>Number(t)))).thenEof(),hI=_u.P.sequenceMap((t,e)=>t===void 0?e:-e,_u.P.string("-").optional(),Dp.P_UTILS.digits().map(t=>Number(t))).thenEof();function Oa(t){if(t.toLowerCase()==="null")return null;if(t==="true")return!0;if(t==="false")return!1;{let e=dI.tryParse(t);return e.success?e.value:t}}function $o(t){return t===void 0||t===null?"":typeof t=="string"?t:typeof t=="boolean"?t?"true":"false":t.toString()}function Au(t){return t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"}function oo(t){if(t!=null){if(Au(t))return[t];if(typeof t=="object"&&Array.isArray(t))return t.filter(e=>Au(e))}}function Hc(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=dI.tryParse(t);if(e.success)return e.value}}function os(t){return Au(t)?$o(t):void 0}function Su(t){return Au(t)?t:void 0}function Pl(t,e){return Array.isArray(t)?t.map(r=>bb(r,e)).filter(r=>r!=="").join(", "):bb(t,e)}function bb(t,e){return t==null?e?"":"null":typeof t=="function"?"<function>":typeof t=="object"||Array.isArray(t)?JSON.stringify(t):t.toString()}function gI(t,e){return Array.isArray(t)?t.map(r=>mI(r,e)).filter(r=>r!==""):mI(t,e)}function mI(t,e){return typeof t=="string"?Cn.isLink(t)?Cn.parseLink(t):Ac(t)?Cn.urlToLink(new URL(t)):t:bb(t,e)}var bh=class extends jr{constructor(e){super("updateMetadata",e)}async run(e,r,n,i,a){let o=this.plugin.api.bindTargetParser.fromStringAndValidate(r.bindTarget,n);if(r.evaluate){if(!this.plugin.settings.enableJs)throw new Fo({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let s=new Function("x","getMetadata",`return ${r.value};`);this.plugin.api.updateMetadata(o,l=>s(l,u=>this.plugin.api.getMetadata(this.plugin.api.parseBindTarget(u,n))))}else this.plugin.api.setMetadata(o,Oa(r.value))}create(){return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""}}getActionLabel(){return"Update metadata"}};var wh=class{constructor(e){this.plugin=e,this.actionContexts={command:new oh(e),open:new mh(e),js:new fh(e),input:new lh(e),sleep:new yh(e),templaterCreateNote:new xh(e),updateMetadata:new bh(e),createNote:new sh(e),replaceInNote:new hh(e),replaceSelf:new gh(e),regexpReplaceInNote:new dh(e),insertIntoNote:new ch(e),inlineJS:new uh(e),runTemplaterFile:new vh(e)}}resolveFilePath(e,r){let n=Cn.isLink(e)?Cn.parseLink(e).target:e,i=this.plugin.internal.file.getPathByName(n,r);if(i===void 0)throw new No({errorLevel:"ERROR",cause:`Could not find a file that matches "${e}".`,effect:`Could not resolve path or link "${e}" relative to "${r}".`});return i}createDefaultButtonConfig(){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.plugin.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()}mouseEventToClickContext(e,r){return{type:r,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey}}};var vI="5";typeof window<"u"&&(window.__svelte||={v:new Set}).v.add(vI);var Gc="[",Bl="[!",kl="]",Eu={};var zn=Symbol(),Xi=Symbol("filename"),yI=Symbol("hmr");var vW=["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"];var jfe=[...vW,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject"];var yW=["touchstart","touchmove"];function xI(t){return yW.includes(t)}var Je=!1;var so=Array.isArray,bI=Array.prototype.indexOf,Mp=Array.from,wb=Object.keys,gi=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,_b=Object.getOwnPropertyDescriptors,_h=Object.prototype,wI=Array.prototype,Tu=Object.getPrototypeOf;var Ra=()=>{};function Cp(t){for(var e=0;e<t.length;e++)t[e]()}var La=Symbol("$state"),$l=Symbol("$state metadata"),Ah=Symbol("legacy props"),_I=Symbol("");function Sh(t){return t===this.v}function Eh(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Wc(t){return!Eh(t,this.v)}function Ab(){if(Je){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 AI(){if(Je){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 SI(t){if(Je){let e=new Error(`effect_in_teardown
\`${t}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function EI(){if(Je){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function TI(t){if(Je){let e=new Error(`effect_orphan
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function DI(){if(Je){let t=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function MI(){if(Je){let t=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function CI(){if(Je){let t=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/invalid_snippet")}function NI(t){if(Je){let e=new Error(`props_invalid_value
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function FI(t){if(Je){let e=new Error(`props_rest_readonly
Rest element properties of \`$props()\` such as \`${t}\` are readonly
https://svelte.dev/e/props_rest_readonly`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_rest_readonly")}function II(t){if(Je){let e=new Error(`rune_outside_svelte
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function PI(){if(Je){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function BI(){if(Je){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function kI(){if(Je){let t=new Error("state_unsafe_local_read\nReading state that was created inside the same derived is forbidden. Consider using `untrack` to read locally created state\nhttps://svelte.dev/e/state_unsafe_local_read");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function $I(){if(Je){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 Us=!1,ss=!1;var bW="font-weight: bold",wW="font-weight: normal";function Sb(t){Je?console.warn(`%c[svelte] state_snapshot_uncloneable
%c${t?`The following properties cannot be cloned with \`$state.snapshot\` \u2014 the return value contains the originals:
${t}`:"Value cannot be cloned with `$state.snapshot` \u2014 the original value was returned"}
https://svelte.dev/e/state_snapshot_uncloneable`,bW,wW):console.warn("https://svelte.dev/e/state_snapshot_uncloneable")}var _W=[];function li(t,e=!1){if(Je&&!e){let r=[],n=Np(t,new Map,"",r);if(r.length===1&&r[0]==="")Sb();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`),Sb(o)}return n}return Np(t,new Map,"",_W)}function Np(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(so(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]=Np(l,e,Je?`${r}[${s}]`:r,n))}return o}if(Tu(t)===_h){o={},e.set(t,o),i!==null&&e.set(i,o);for(var u in t)o[u]=Np(t[u],e,Je?`${r}.${u}`:r,n);return o}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function")return Np(t.toJSON(),e,Je?`${r}.toJSON()`:r,n,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return Je&&n.push(r),t}}var Fp=null;function qs(t){let e=Error(),r=e.stack;if(r){let n=r.split(`
`),i=[`
`];for(let a=0;a<n.length;a++){let o=n[a];if(o!=="Error"){if(o.includes("validate_each_keys"))return null;o.includes("svelte/src/internal")||i.push(o)}}if(i.length===1)return null;gi(e,"stack",{value:i.join(`
`)}),gi(e,"name",{value:`${t}Error`})}return e}var Ol=new Set;function Tb(t){Ol=t}function Hn(t,e){var r={f:0,v:t,reactions:null,equals:Sh,rv:0,wv:0};return Je&&ss&&(r.created=e??qs("CreatedAt"),r.debug=null),r}function yt(t){return SW(Hn(t))}function Du(t,e=!1){let r=Hn(t);return e||(r.equals=Wc),Us&&xr!==null&&xr.l!==null&&(xr.l.s??=[]).push(r),r}function SW(t){return vr!==null&&vr.f&2&&(Ro===null?LI([t]):Ro.push(t)),t}function $e(t,e){return vr!==null&&Hs()&&vr.f&18&&(Ro===null||!Ro.includes(t))&&$I(),Zc(t,e)}function Zc(t,e){if(!t.equals(e)){var r=t.v;if(t.v=e,t.wv=Pp(),Je&&ss&&(t.updated=qs("UpdatedAt"),rr!=null&&(t.trace_need_increase=!0,t.trace_v??=r)),RI(t,2048),Hs()&&rr!==null&&rr.f&1024&&!(rr.f&96)&&(us===null?VI([t]):us.push(t)),Je&&Ol.size>0){let i=Array.from(Ol);var n=zs;Yc(!0);try{for(let a of i)a.f&1024&&Qi(a,4096),Mu(a)&&Rl(a)}finally{Yc(n)}Ol.clear()}}return e}function RI(t,e){var r=t.reactions;if(r!==null)for(var n=Hs(),i=r.length,a=0;a<i;a++){var o=r[a],s=o.f;if(!(s&2048)&&!(!n&&o===rr)){if(Je&&s&262144){Ol.add(o);continue}Qi(o,e),s&1280&&(s&2?RI(o,4096):Bp(o))}}}var kp="font-weight: bold",$p="font-weight: normal";function UI(t,e,r){Je?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`,kp,$p):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Jc(t){Je?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`,kp,$p):console.warn("https://svelte.dev/e/hydration_mismatch")}function qI(){Je?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,kp,$p):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Db(t,e){Je?console.warn(`%c[svelte] ownership_invalid_mutation
%c${t?`${t} mutated a value owned by ${e}. This is strongly discouraged. Consider passing values to child components with \`bind:\`, or use a callback instead`:"Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead"}
https://svelte.dev/e/ownership_invalid_mutation`,kp,$p):console.warn("https://svelte.dev/e/ownership_invalid_mutation")}function Th(t){Je?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`,kp,$p):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}var Bt=!1;function ma(t){Bt=t}var Kt;function En(t){if(t===null)throw Jc(),Eu;return Kt=t}function Fi(){return En(Ii(Kt))}function ce(t){if(Bt){if(Ii(Kt)!==null)throw Jc(),Eu;Kt=t}}function Et(t=1){if(Bt){for(var e=t,r=Kt;e--;)r=Ii(r);Kt=r}}function Xc(){for(var t=0,e=Kt;;){if(e.nodeType===8){var r=e.data;if(r===kl){if(t===0)return e;t-=1}else(r===Gc||r===Bl)&&(t+=1)}var n=Ii(e);e.remove(),e=n}}var EW={},TW=/at (?:.+ \()?(.+):(\d+):(\d+)\)?$/,DW=/@(.+):(\d+):(\d+)$/;function MW(){let t=new Error().stack;if(!t)return null;let e=[];for(let r of t.split(`
`)){let n=TW.exec(r)??DW.exec(r);n&&e.push({file:n[1],line:+n[2],column:+n[3]})}return e}function zI(){let t=MW()?.slice(4);if(!t)return null;for(let e=0;e<t.length;e++){let r=t[e],n=EW[r.file];if(!n){if(e===0)return null;continue}for(let i of n){if(i.end==null)return null;if(i.start.line<r.line&&i.end.line>r.line)return i.component}}return null}var CW=Symbol("ADD_OWNER");function Mb(t,e){if(e.owners!==null)for(;t;){if(t.owners===null){e.owners=null;break}for(let r of t.owners)e.owners.add(r);t=t.parent}}function HI(t,e){return t.owners===null?!0:t.owners.has(e)||t.parent!==null&&HI(t.parent,e)}function GI(t){return t?.owners?.values().next().value??GI(t.parent)}var NW=!1;function WI(t){if(NW)return;let e=zI();if(e&&!HI(t,e)){let r=GI(t);r[Xi]!==e[Xi]?Db(e[Xi],r[Xi]):Db()}}function Ve(t,e=null,r){var n=null;if(Je&&ss&&(n=qs("CreatedAt")),typeof t!="object"||t===null||La in t)return t;let i=Tu(t);if(i!==_h&&i!==wI)return t;var a=new Map,o=so(t),s=Hn(0);o&&a.set("length",Hn(t.length,n));var l;if(Je)if(l={parent:e,owners:null},r){let u=r.v?.[$l]?.owners;l.owners=u?new Set(u):null}else l.owners=e===null?xr!==null?new Set([xr.function]):null:new Set;return new Proxy(t,{defineProperty(u,c,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&PI();var m=a.get(c);return m===void 0?(m=Hn(f.value,n),a.set(c,m)):$e(m,Ve(f.value,l)),!0},deleteProperty(u,c){var f=a.get(c);if(f===void 0)c in u&&a.set(c,Hn(zn,n));else{if(o&&typeof c=="string"){var m=a.get("length"),p=Number(c);Number.isInteger(p)&&p<m.v&&$e(m,p)}$e(f,zn),YI(s)}return!0},get(u,c,f){if(Je&&c===$l)return l;if(c===La)return t;var m=a.get(c),p=c in u;if(m===void 0&&(!p||Oo(u,c)?.writable)&&(m=Hn(Ve(p?u[c]:zn,l),n),a.set(c,m)),m!==void 0){var d=z(m);if(Je){var h=d?.[$l];h&&h?.parent!==l&&Mb(l,h)}return d===zn?void 0:d}return Reflect.get(u,c,f)},getOwnPropertyDescriptor(u,c){var f=Reflect.getOwnPropertyDescriptor(u,c);if(f&&"value"in f){var m=a.get(c);m&&(f.value=z(m))}else if(f===void 0){var p=a.get(c),d=p?.v;if(p!==void 0&&d!==zn)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(u,c){if(Je&&c===$l||c===La)return!0;var f=a.get(c),m=f!==void 0&&f.v!==zn||Reflect.has(u,c);if(f!==void 0||rr!==null&&(!m||Oo(u,c)?.writable)){f===void 0&&(f=Hn(m?Ve(u[c],l):zn,n),a.set(c,f));var p=z(f);if(p===zn)return!1}return m},set(u,c,f,m){var p=a.get(c),d=c in u;if(o&&c==="length")for(var h=f;h<p.v;h+=1){var x=a.get(h+"");x!==void 0?$e(x,zn):h in u&&(x=Hn(zn,n),a.set(h+"",x))}if(p===void 0?(!d||Oo(u,c)?.writable)&&(p=Hn(void 0,n),$e(p,Ve(f,l)),a.set(c,p)):(d=p.v!==zn,$e(p,Ve(f,l))),Je){var b=f?.[$l];b&&b?.parent!==l&&Mb(l,b),WI(l)}var T=Reflect.getOwnPropertyDescriptor(u,c);if(T?.set&&T.set.call(m,f),!d){if(o&&typeof c=="string"){var v=a.get("length"),A=Number(c);Number.isInteger(A)&&A>=v.v&&$e(v,A+1)}YI(s)}return!0},ownKeys(u){z(s);var c=Reflect.ownKeys(u).filter(p=>{var d=a.get(p);return d===void 0||d.v!==zn});for(var[f,m]of a)m.v!==zn&&!(f in u)&&c.push(f);return c},setPrototypeOf(){BI()}})}function YI(t,e=1){$e(t,t.v+e)}function Qc(t){return t!==null&&typeof t=="object"&&La in t?t[La]:t}function Cb(t,e){return Object.is(Qc(t),Qc(e))}function jI(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:n,includes:i}=t;t.indexOf=function(a,o){let s=r.call(this,a,o);if(s===-1){for(let l=o??0;l<this.length;l+=1)if(Qc(this[l])===a){Th("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(Qc(this[l])===a){Th("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(Qc(this[l])===a){Th("array.includes(...)");break}}return s},Array.__svelte_cleanup=()=>{t.indexOf=r,t.lastIndexOf=n,t.includes=i}}var Gs,ZI,JI,XI;function Mh(){if(Gs===void 0){Gs=window,ZI=document;var t=Element.prototype,e=Node.prototype;JI=Oo(e,"firstChild").get,XI=Oo(e,"nextSibling").get,t.__click=void 0,t.__className="",t.__attributes=null,t.__styles=null,t.__e=void 0,Text.prototype.__t=void 0,Je&&(t.__svelte_meta=null,jI())}}function ha(t=""){return document.createTextNode(t)}function Nn(t){return JI.call(t)}function Ii(t){return XI.call(t)}function ye(t,e){if(!Bt)return Nn(t);var r=Nn(Kt);if(r===null)r=Kt.appendChild(ha());else if(e&&r.nodeType!==3){var n=ha();return r?.before(n),En(n),n}return En(r),r}function je(t,e){if(!Bt){var r=Nn(t);return r instanceof Comment&&r.data===""?Ii(r):r}if(e&&Kt?.nodeType!==3){var n=ha();return Kt?.before(n),En(n),n}return Kt}function le(t,e=1,r=!1){let n=Bt?Kt:t;for(var i;e--;)i=n,n=Ii(n);if(!Bt)return n;var a=n?.nodeType;if(r&&a!==3){var o=ha();return n===null?i?.after(o):n.before(o),En(o),o}return En(n),n}function Kc(t){t.textContent=""}function Lt(t){var e=2050;rr===null?e|=256:rr.f|=1048576;var r=vr!==null&&vr.f&2?vr:null;let n={children:null,ctx:xr,deps:null,equals:Sh,f:e,fn:t,reactions:null,rv:0,v:null,wv:0,parent:r??rr};return Je&&ss&&(n.created=qs("CreatedAt")),r!==null&&(r.children??=[]).push(n),n}function Op(t){let e=Lt(t);return e.equals=Wc,e}function Fb(t){var e=t.children;if(e!==null){t.children=null;for(var r=0;r<e.length;r+=1){var n=e[r];n.f&2?Rp(n):yi(n)}}}var Nb=[];function FW(t){for(var e=t.parent;e!==null;){if(!(e.f&2))return e;e=e.parent}return null}function Pb(t){var e,r=rr;if(ei(FW(t)),Je){let n=Ol;Tb(new Set);try{Nb.includes(t)&&AI(),Nb.push(t),Fb(t),e=Ch(t)}finally{ei(r),Tb(n),Nb.pop()}}else try{Fb(t),e=Ch(t)}finally{ei(r)}return e}function Bb(t){var e=Pb(t),r=(Ws||t.f&256)&&t.deps!==null?4096:1024;Qi(t,r),t.equals(e)||(t.v=e,t.wv=Pp())}function Rp(t){Fb(t),Ll(t,0),Qi(t,16384),t.v=t.children=t.deps=t.ctx=t.reactions=null}function e2(t){rr===null&&vr===null&&TI(t),vr!==null&&vr.f&256&&EI(),Fh&&SI(t)}function IW(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Vl(t,e,r,n=!0){var i=(t&64)!==0,a=rr;if(Je)for(;a!==null&&a.f&262144;)a=a.parent;var o={ctx:xr,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:t|2048,first:null,fn:e,last:null,next:null,parent:i?null:a,prev:null,teardown:null,transitions:null,wv:0};if(Je&&(o.component_function=fo),r){var s=zs;try{Yc(!0),Rl(o),o.f|=32768}catch(c){throw yi(o),c}finally{Yc(s)}}else e!==null&&Bp(o);var l=r&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&1048704)===0;if(!l&&!i&&n&&(a!==null&&IW(o,a),vr!==null&&vr.f&2)){var u=vr;(u.children??=[]).push(o)}return o}function mo(t){let e=Vl(8,null,!1);return Qi(e,1024),e.teardown=t,e}function ga(t){e2("$effect");var e=rr!==null&&(rr.f&32)!==0&&xr!==null&&!xr.m;if(Je&&gi(t,"name",{value:"$effect"}),e){var r=xr;(r.e??=[]).push({fn:t,effect:rr,reaction:vr})}else{var n=va(t);return n}}function Ob(t){let e=Vl(64,t,!0);return()=>{yi(e)}}function t2(t){let e=Vl(64,t,!0);return(r={})=>new Promise(n=>{r.outro?Vo(e,()=>{yi(e),n(void 0)}):(yi(e),n(void 0))})}function va(t){return Vl(4,t,!1)}function da(t){return Vl(8,t,!0)}function Le(t){return Je&&gi(t,"name",{value:"{expression}"}),ea(t)}function ea(t,e=0){return Vl(24|e,t,!0)}function xi(t,e=!0){return Vl(40,t,!0,e)}function Rb(t){var e=t.teardown;if(e!==null){let r=Fh,n=vr;kb(!0),Ki(null);try{e.call(null)}finally{kb(r),Ki(n)}}}function Lb(t){var e=t.deriveds;if(e!==null){t.deriveds=null;for(var r=0;r<e.length;r+=1)Rp(e[r])}}function Vb(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var n=r.next;yi(r,e),r=n}}function r2(t){for(var e=t.first;e!==null;){var r=e.next;e.f&32||yi(e),e=r}}function yi(t,e=!0){var r=!1;if((e||t.f&524288)&&t.nodes_start!==null){for(var n=t.nodes_start,i=t.nodes_end;n!==null;){var a=n===i?null:Ii(n);n.remove(),n=a}r=!0}Vb(t,e&&!r),Lb(t),Ll(t,0),Qi(t,16384);var o=t.transitions;if(o!==null)for(let l of o)l.stop();Rb(t);var s=t.parent;s!==null&&s.first!==null&&Ub(t),Je&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function Ub(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 Vo(t,e){var r=[];Nh(t,r,!0),qb(r,()=>{yi(t),e&&e()})}function qb(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function Nh(t,e,r){if(!(t.f&8192)){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;Nh(n,e,a?r:!1),n=i}}}function Nu(t){n2(t,!0)}function n2(t,e){if(t.f&8192){Mu(t)&&Rl(t),t.f^=8192;for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;n2(r,i?e:!1),r=n}if(t.transitions!==null)for(let a of t.transitions)(a.is_global||e)&&a.in()}}var PW=typeof requestIdleCallback>"u"?t=>setTimeout(t,1):requestIdleCallback,Ih=!1,Ph=!1,zb=[],Hb=[];function i2(){Ih=!1;let t=zb.slice();zb=[],Cp(t)}function a2(){Ph=!1;let t=Hb.slice();Hb=[],Cp(t)}function ho(t){Ih||(Ih=!0,queueMicrotask(i2)),zb.push(t)}function o2(t){Ph||(Ph=!0,PW(a2)),Hb.push(t)}function s2(){Ih&&i2(),Ph&&a2()}function Lp(t){if(Je){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 m2=0,$W=1,u2=new WeakSet,Bh=!1,kh=m2,Vp=!1,rf=null,zs=!1,Fh=!1;function Yc(t){zs=t}function kb(t){Fh=t}var Ul=[],nf=0,Up=[],vr=null;function Ki(t){vr=t}var rr=null;function ei(t){rr=t}var Ro=null;function LI(t){Ro=t}var ya=null,qa=0,us=null;function VI(t){us=t}var d2=1,Oh=0,Ws=!1,Ip=null;var xr=null;var fo=null;function Pp(){return++d2}function Hs(){return!Us||xr!==null&&xr.l===null}function Mu(t){var e=t.f;if(e&2048)return!0;if(e&4096){var r=t.deps,n=(e&256)!==0;if(r!==null){var i,a,o=(e&512)!==0,s=n&&rr!==null&&!Ws,l=r.length;if(o||s){for(i=0;i<l;i++)a=r[i],(o||!a?.reactions?.includes(t))&&(a.reactions??=[]).push(t);o&&(t.f^=512)}for(i=0;i<l;i++)if(a=r[i],Mu(a)&&Bb(a),a.wv>t.wv)return!0}(!n||rr!==null&&!Ws)&&Qi(t,1024)}return!1}function l2(t,e){for(var r=e;r!==null;){if(r.f&128)try{r.fn(t);return}catch{r.f^=128}r=r.parent}throw Bh=!1,t}function c2(t){return(t.f&16384)===0&&(t.parent===null||(t.parent.f&128)===0)}function af(t,e,r,n){if(Bh){if(r===null&&(Bh=!1),c2(e))throw t;return}if(r!==null&&(Bh=!0),!Je||n===null||!(t instanceof Error)||u2.has(t)){l2(t,e);return}u2.add(t);let i=[],a=e.fn?.name;a&&i.push(a);let o=n;for(;o!==null;){if(Je){var s=o.function?.[Xi];if(s){let c=s.split("/").pop();i.push(c)}}o=o.p}let l=/Firefox/.test(navigator.userAgent)?" ":" ";gi(t,"message",{value:t.message+`
${i.map(c=>`
${l}in ${c}`).join("")}
`}),gi(t,"component_stack",{value:i});let u=t.stack;if(u){let c=u.split(`
`),f=[];for(let m=0;m<c.length;m++){let p=c[m];p.includes("svelte/src/internal")||f.push(p)}gi(t,"stack",{value:f.join(`
`)})}if(l2(t,e),c2(e))throw t}function h2(t,e,r=0){var n=t.reactions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];a.f&2?h2(a,e,r+1):e===a&&(r===0?Qi(a,2048):a.f&1024&&Qi(a,4096),Bp(a))}}function Ch(t){var e=ya,r=qa,n=us,i=vr,a=Ws,o=Ro,s=xr,l=t.f;ya=null,qa=0,us=null,vr=l&96?null:t,Ws=!zs&&(l&256)!==0,Ro=null,xr=t.ctx,Oh++;try{var u=(0,t.fn)(),c=t.deps;if(ya!==null){var f;if(Ll(t,qa),c!==null&&qa>0)for(c.length=qa+ya.length,f=0;f<ya.length;f++)c[qa+f]=ya[f];else t.deps=c=ya;if(!Ws)for(f=qa;f<c.length;f++)(c[f].reactions??=[]).push(t)}else c!==null&&qa<c.length&&(Ll(t,qa),c.length=qa);if(Hs()&&us!==null&&!(t.f&6146))for(f=0;f<us.length;f++)h2(us[f],t);return i!==null&&Oh++,u}finally{ya=e,qa=r,us=n,vr=i,Ws=a,Ro=o,xr=s}}function OW(t,e){let r=e.reactions;if(r!==null){var n=bI.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}r===null&&e.f&2&&(ya===null||!ya.includes(e))&&(Qi(e,4096),e.f&768||(e.f^=512),Ll(e,0))}function Ll(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)OW(t,r[n])}function Rl(t){var e=t.f;if(!(e&16384)){Qi(t,1024);var r=rr,n=xr;if(rr=t,Je){var i=fo;fo=t.component_function}try{e&16?r2(t):Vb(t),Lb(t),Rb(t);var a=Ch(t);t.teardown=typeof a=="function"?a:null,t.wv=d2;var o=t.deps;if(Je&&ss&&t.f&2048&&o!==null)for(let l=0;l<o.length;l++){var s=o[l];s.trace_need_increase&&(s.wv=Pp(),s.trace_need_increase=void 0,s.trace_v=void 0)}Je&&Up.push(t)}catch(l){af(l,t,r,n||t.ctx)}finally{rr=r,Je&&(fo=i)}}}function f2(){console.error("Last ten effects were: ",Up.slice(-10).map(t=>t.fn)),Up=[]}function g2(){if(nf>1e3){nf=0;try{DI()}catch(t){if(Je&&gi(t,"stack",{value:""}),rf!==null)if(Je)try{af(t,rf,null,null)}catch(e){throw f2(),e}else af(t,rf,null,null);else throw Je&&f2(),t}}nf++}function v2(t){var e=t.length;if(e!==0){g2();var r=zs;zs=!0;try{for(var n=0;n<e;n++){var i=t[n];i.f&1024||(i.f^=1024);var a=[];y2(i,a),RW(a)}}finally{zs=r}}}function RW(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];if(!(n.f&24576))try{Mu(n)&&(Rl(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Ub(n):n.fn=null))}catch(i){af(i,n,null,n.ctx)}}}function LW(){if(Vp=!1,nf>1001)return;let t=Ul;Ul=[],v2(t),Vp||(nf=0,rf=null,Je&&(Up=[]))}function Bp(t){kh===m2&&(Vp||(Vp=!0,queueMicrotask(LW))),rf=t;for(var e=t;e.parent!==null;){e=e.parent;var r=e.f;if(r&96){if(!(r&1024))return;e.f^=1024}}Ul.push(e)}function y2(t,e){var r=t.first,n=[];e:for(;r!==null;){var i=r.f,a=(i&32)!==0,o=a&&(i&1024)!==0,s=r.next;if(!o&&!(i&8192))if(i&8){if(a)r.f^=1024;else try{Mu(r)&&Rl(r)}catch(f){af(f,r,null,r.ctx)}var l=r.first;if(l!==null){r=l;continue}}else i&4&&n.push(r);if(s===null){let f=r.parent;for(;f!==null;){if(t===f)break e;var u=f.next;if(u!==null){r=u;continue e}f=f.parent}}r=s}for(var c=0;c<n.length;c++)l=n[c],e.push(l),y2(l,e)}function of(t){var e=kh,r=Ul;try{g2();let i=[];kh=$W,Ul=i,Vp=!1,v2(r);var n=t?.();return s2(),(Ul.length>0||i.length>0)&&of(),nf=0,rf=null,Je&&(Up=[]),n}finally{kh=e,Ul=r}}function z(t){var e=t.f,r=(e&2)!==0;if(r&&e&16384){var n=Pb(t);return Rp(t),n}if(Ip!==null&&Ip.add(t),vr!==null){Ro!==null&&Ro.includes(t)&&kI();var i=vr.deps;t.rv<Oh&&(t.rv=Oh,ya===null&&i!==null&&i[qa]===t?qa++:ya===null?ya=[t]:ya.push(t))}else if(r&&t.deps===null)for(var a=t,o=a.parent,s=a;o!==null;)if(o.f&2){var l=o;s=l,o=l.parent}else{var u=o;u.deriveds?.includes(s)||(u.deriveds??=[]).push(s);break}if(r&&(a=t,Mu(a)&&Bb(a)),Je&&ss&&Fp!==null&&vr!==null&&Fp.reaction===vr){if(t.debug)t.debug();else if(t.created){var c=Fp.entries.get(t);c===void 0&&(c={read:[]},Fp.entries.set(t,c)),c.read.push(qs("TracedAt"))}}return t.v}function xn(t){let e=vr;try{return vr=null,t()}finally{vr=e}}var VW=-7169;function Qi(t,e){t.f=t.f&VW|e}function Te(t,e=!1,r){xr={p:xr,c:null,e:null,m:!1,s:t,x:null,l:null},Us&&!e&&(xr.l={s:null,u:null,r1:[],r2:Hn(!1)}),Je&&(xr.function=r,fo=r)}function De(t){let e=xr;if(e!==null){t!==void 0&&(e.x=t);let o=e.e;if(o!==null){var r=rr,n=vr;e.e=null;try{for(var i=0;i<o.length;i++){var a=o[i];ei(a.effect),Ki(a.reaction),va(a.fn)}}finally{ei(r),Ki(n)}}xr=e.p,Je&&(fo=e.p?.function??null),e.m=!0}return t||{}}if(Je){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;II(e)},set:n=>{r=n}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function On(t){Bt&&Nn(t)!==null&&Kc(t)}var x2=!1;function Rh(){x2||(x2=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(let e of t.target.elements)e.__on_r?.()})},{capture:!0}))}function Lh(t){var e=vr,r=rr;Ki(null),ei(null);try{return t()}finally{Ki(e),ei(r)}}function Vh(t,e,r,n=r){t.addEventListener(e,()=>Lh(r));let i=t.__on_r;i?t.__on_r=()=>{i(),n(!0)}:t.__on_r=()=>n(!0),Rh()}var Gb=new Set,Uh=new Set;function b2(t,e,r,n){function i(a){if(n.capture||sf.call(e,a),!a.cancelBubble)return Lh(()=>r.call(this,a))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?ho(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function Pi(t,e,r,n,i){var a={capture:n,passive:i},o=b2(t,e,r,a);(e===document.body||e===window||e===document)&&mo(()=>{e.removeEventListener(t,o,a)})}function Nt(t){for(var e=0;e<t.length;e++)Gb.add(t[e]);for(var r of Uh)r(t)}function sf(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){gi(t,"currentTarget",{configurable:!0,get(){return a||r}});var c=vr,f=rr;Ki(null),ei(null);try{for(var m,p=[];a!==null;){var d=a.assignedSlot||a.parentNode||a.host||null;try{var h=a["__"+n];if(h!==void 0&&!a.disabled)if(so(h)){var[x,...b]=h;x.apply(a,[t,...b])}else h.call(a,t)}catch(T){m?p.push(T):m=T}if(t.cancelBubble||d===e||d===null)break;a=d}if(m){for(let T of p)queueMicrotask(()=>{throw T});throw m}}finally{t.__root=e,delete t.currentTarget,Ki(c),ei(f)}}}var qW;function w2(){qW=void 0}function qp(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function ta(t,e){var r=rr;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function ue(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,a=!t.startsWith("<!>");return()=>{if(Bt)return ta(Kt,null),Kt;i===void 0&&(i=qp(a?t:"<!>"+t),r||(i=Nn(i)));var o=n?document.importNode(i,!0):i.cloneNode(!0);if(r){var s=Nn(o),l=o.lastChild;ta(s,l)}else ta(o,o);return o}}function qh(t,e,r="svg"){var n=!t.startsWith("<!>"),i=(e&1)!==0,a=`<${r}>${n?t:"<!>"+t}</${r}>`,o;return()=>{if(Bt)return ta(Kt,null),Kt;if(!o){var s=qp(a),l=Nn(s);if(i)for(o=document.createDocumentFragment();Nn(l);)o.appendChild(Nn(l));else o=Nn(l)}var u=o.cloneNode(!0);if(i){var c=Nn(u),f=u.lastChild;ta(c,f)}else ta(u,u);return u}}function Wt(t=""){if(!Bt){var e=ha(t+"");return ta(e,e),e}var r=Kt;return r.nodeType!==3&&(r.before(r=ha()),En(r)),ta(r,r),r}function Gr(){if(Bt)return ta(Kt,null),Kt;var t=document.createDocumentFragment(),e=document.createComment(""),r=ha();return t.append(e,r),ta(e,r),t}function K(t,e){if(Bt){rr.nodes_end=Kt,Fi();return}t!==null&&t.before(e)}var Wb=!0;function xt(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=r==null?"":r+"")}function Ur(t,e){return A2(t,e)}function jb(t,e){Mh(),e.intro=e.intro??!1;let r=e.target,n=Bt,i=Kt;try{for(var a=Nn(r);a&&(a.nodeType!==8||a.data!==Gc);)a=Ii(a);if(!a)throw Eu;ma(!0),En(a),Fi();let o=A2(t,{...e,anchor:a});if(Kt===null||Kt.nodeType!==8||Kt.data!==kl)throw Jc(),Eu;return ma(!1),o}catch(o){if(o===Eu)return e.recover===!1&&MI(),Mh(),Kc(r),ma(!1),Ur(t,e);throw o}finally{ma(n),En(i),w2()}}var uf=new Map;function A2(t,{target:e,anchor:r,props:n={},events:i,context:a,intro:o=!0}){Mh();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=xI(p);e.addEventListener(p,sf,{passive:d});var h=uf.get(p);h===void 0?(document.addEventListener(p,sf,{passive:d}),uf.set(p,1)):uf.set(p,h+1)}}};l(Mp(Gb)),Uh.add(l);var u=void 0,c=t2(()=>{var f=r??e.appendChild(ha());return xi(()=>{if(a){Te({});var m=xr;m.c=a}i&&(n.$$events=i),Bt&&ta(f,null),Wb=o,u=t(f,n)||{},Wb=!0,Bt&&(rr.nodes_end=Kt),a&&De()}),()=>{for(var m of s){e.removeEventListener(m,sf);var p=uf.get(m);--p===0?(document.removeEventListener(m,sf),uf.delete(m)):uf.set(m,p)}Uh.delete(l),f!==r&&f.parentNode?.removeChild(f)}});return Yb.set(u,c),u}var Yb=new WeakMap;function Pr(t,e){let r=Yb.get(t);return r?(Yb.delete(t),r(e)):(Je&&qI(),Promise.resolve())}function at(t,e,r=!1){Bt&&Fi();var n=t,i=null,a=null,o=zn,s=r?65536:0,l=!1;let u=(f,m=!0)=>{l=!0,c(m,f)},c=(f,m)=>{if(o===(o=f))return;let p=!1;if(Bt){let d=n.data===Bl;!!o===d&&(n=Xc(),En(n),ma(!1),p=!0)}o?(i?Nu(i):m&&(i=xi(()=>m(n))),a&&Vo(a,()=>{a=null})):(a?Nu(a):m&&(a=xi(()=>m(n))),i&&Vo(i,()=>{i=null})),p&&ma(!0)};ea(()=>{l=!1,e(u),l||c(null,null)},s),Bt&&(n=Kt)}var zp=null;function er(t,e){return e}function ZW(t,e,r,n){for(var i=[],a=e.length,o=0;o<a;o++)Nh(e[o].e,i,!0);var s=a>0&&i.length===0&&r!==null;if(s){var l=r.parentNode;Kc(l),l.append(r),n.clear(),Fu(t,e[0].prev,e[a-1].next)}qb(i,()=>{for(var u=0;u<a;u++){var c=e[u];s||(n.delete(c.k),Fu(t,c.prev,c.next)),yi(c.e,!s)}})}function Yt(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=Bt?En(Nn(u)):u.appendChild(ha())}Bt&&Fi();var c=null,f=!1,m=Op(()=>{var p=r();return so(p)?p:p==null?[]:Mp(p)});ea(()=>{var p=z(m),d=p.length;if(f&&d===0)return;f=d===0;let h=!1;if(Bt){var x=o.data===Bl;x!==(d===0)&&(o=Xc(),En(o),ma(!1),h=!0)}if(Bt){for(var b=null,T,v=0;v<d;v++){if(Kt.nodeType===8&&Kt.data===kl){o=Kt,h=!0,ma(!1);break}var A=p[v],w=n(A,v);T=T2(Kt,s,b,null,A,w,v,i,e,r),s.items.set(w,T),b=T}d>0&&En(Xc())}if(!Bt){var y=vr;JW(p,s,o,i,e,(y.f&8192)!==0,n,r)}a!==null&&(d===0?c?Nu(c):c=xi(()=>a(o)):c!==null&&Vo(c,()=>{c=null})),h&&ma(!0),z(m)}),Bt&&(o=Kt)}function JW(t,e,r,n,i,a,o,s){var l=(i&8)!==0,u=(i&3)!==0,c=t.length,f=e.items,m=e.first,p=m,d,h=null,x,b=[],T=[],v,A,w,y;if(l)for(y=0;y<c;y+=1)v=t[y],A=o(v,y),w=f.get(A),w!==void 0&&(w.a?.measure(),(x??=new Set).add(w));for(y=0;y<c;y+=1){if(v=t[y],A=o(v,y),w=f.get(A),w===void 0){var E=p?p.e.nodes_start:r;h=T2(E,e,h,h===null?e.first:h.next,v,A,y,n,i,s),f.set(A,h),b=[],T=[],p=h.next;continue}if(u&&XW(w,v,y,i),w.e.f&8192&&(Nu(w.e),l&&(w.a?.unfix(),(x??=new Set).delete(w))),w!==p){if(d!==void 0&&d.has(w)){if(b.length<T.length){var D=T[0],_;h=D.prev;var C=b[0],N=b[b.length-1];for(_=0;_<b.length;_+=1)S2(b[_],D,r);for(_=0;_<T.length;_+=1)d.delete(T[_]);Fu(e,C.prev,N.next),Fu(e,h,C),Fu(e,N,D),p=D,h=N,y-=1,b=[],T=[]}else d.delete(w),S2(w,p,r),Fu(e,w.prev,w.next),Fu(e,w,h===null?e.first:h.next),Fu(e,h,w),h=w;continue}for(b=[],T=[];p!==null&&p.k!==A;)(a||!(p.e.f&8192))&&(d??=new Set).add(p),T.push(p),p=p.next;if(p===null)continue;w=p}b.push(w),h=w,p=w.next}if(p!==null||d!==void 0){for(var P=d===void 0?[]:Mp(d);p!==null;)(a||!(p.e.f&8192))&&P.push(p),p=p.next;var R=P.length;if(R>0){var L=i&4&&c===0?r:null;if(l){for(y=0;y<R;y+=1)P[y].a?.measure();for(y=0;y<R;y+=1)P[y].a?.fix()}ZW(e,P,L,f)}}l&&ho(()=>{if(x!==void 0)for(w of x)w.a?.apply()}),rr.first=e.first&&e.first.e,rr.last=h&&h.e}function XW(t,e,r,n){n&1&&Zc(t.v,e),n&2?Zc(t.i,r):t.i=r}function T2(t,e,r,n,i,a,o,s,l,u){var c=zp,f=(l&1)!==0,m=(l&16)===0,p=f?m?Du(i):Hn(i):i,d=l&2?Hn(o):o;Je&&f&&(p.debug=()=>{var x=typeof d=="number"?o:d.v;u()[x]});var h={i:d,v:p,k:a,a:null,e:null,prev:r,next:n};zp=h;try{return h.e=xi(()=>s(t,p,d),Bt),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{zp=c}}function S2(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=Ii(a);i.before(a),a=o}}function Fu(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 go(t,e,...r){var n=t,i=Ra,a;ea(()=>{i!==(i=e())&&(a&&(yi(a),a=null),Je&&i==null&&CI(),a=xi(()=>i(n,...r)))},65536),Bt&&(n=Kt)}function M2(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=M2(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function C2(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=M2(t))&&(n&&(n+=" "),n+=e);return n}function Ys(t){return typeof t=="object"?C2(t):t??""}function Tt(t){if(Bt){var e=!1,r=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;wt(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;wt(t,"checked",null),t.checked=i}}};t.__on_r=r,o2(r),Rh()}}function Qb(t,e){var r=t.__attributes??={};r.value===(r.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!=="PROGRESS")||(t.value=e)}function js(t,e){var r=t.__attributes??={};r.checked!==(r.checked=e??void 0)&&(t.checked=e)}function wt(t,e,r,n){var i=t.__attributes??={};if(Bt&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){n||tY(t,e,r??"");return}i[e]!==(i[e]=r)&&(e==="style"&&"__styles"in t&&(t.__styles={}),e==="loading"&&(t[_I]=r),r==null?t.removeAttribute(e):typeof r!="string"&&eY(t).includes(e)?t[e]=r:t.setAttribute(e,r))}var N2=new Map;function eY(t){var e=N2.get(t.nodeName);if(e)return e;N2.set(t.nodeName,e=[]);for(var r,n=t,i=Element.prototype;i!==n;){r=_b(n);for(var a in r)r[a].set&&e.push(a);n=Tu(n)}return e}function tY(t,e,r){Je&&(e==="srcset"&&rY(t,r)||Xb(t.getAttribute(e)??"",r)||UI(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function Xb(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function F2(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function rY(t,e){var r=F2(t.srcset),n=F2(e);return n.length===r.length&&n.every(([i,a],o)=>a===r[o][1]&&(Xb(r[o][0],i)||Xb(i,r[o][0])))}function xa(t,e,r){var n=t.__className,i=nY(e,r);Bt&&t.className===i?t.__className=i:(n!==i||Bt&&t.className!==i)&&(e==null&&!r?t.removeAttribute("class"):t.className=i,t.__className=i)}function nY(t,e){return(t??"")+(e?" "+e:"")}function tn(t,e,r){if(r){if(t.classList.contains(e))return;t.classList.add(e)}else{if(!t.classList.contains(e))return;t.classList.remove(e)}}function Kb(t,e,r,n){var i=t.__styles??={};i[e]!==r&&(i[e]=r,r==null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":""))}function _t(t,e,r=e){var n=Hs();Vh(t,"input",i=>{Je&&t.type==="checkbox"&&Ab();var a=i?t.defaultValue:t.value;if(a=e0(t)?t0(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))}}),(Bt&&t.defaultValue!==t.value||xn(e)==null&&t.value)&&r(e0(t)?t0(t.value):t.value),da(()=>{Je&&t.type==="checkbox"&&Ab();var i=e();e0(t)&&i===t0(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function e0(t){var e=t.type;return e==="number"||e==="range"}function t0(t){return t===""?null:+t}function Hh(t,e,r){if(t.multiple)return oY(t,e);for(var n of t.options){var i=Hp(n);if(Cb(i,e)){n.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function I2(t,e){let r=!0;va(()=>{e&&Hh(t,xn(e),r),r=!1;var n=new MutationObserver(()=>{var i=t.__value;Hh(t,i)});return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{n.disconnect()}})}function lf(t,e,r=e){var n=!0;Vh(t,"change",i=>{var a=i?"[selected]":":checked",o;if(t.multiple)o=[].map.call(t.querySelectorAll(a),Hp);else{var s=t.querySelector(a)??t.querySelector("option:not([disabled])");o=s&&Hp(s)}r(o)}),va(()=>{var i=e();if(Hh(t,i,n),n&&i===void 0){var a=t.querySelector(":checked");a!==null&&(i=Hp(a),r(i))}t.__value=i,n=!1}),I2(t)}function oY(t,e){for(var r of t.options)r.selected=~e.indexOf(Hp(r))}function Hp(t){return"__value"in t?t.__value:t.value}function P2(t,e){return t===e||t?.[La]===e}function Uo(t={},e,r,n){return va(()=>{var i,a;return da(()=>{i=a,a=n?.()||[],xn(()=>{t!==r(...a)&&(e(t,...a),i&&P2(r(...i),t)&&e(null,...i))})}),()=>{ho(()=>{a&&P2(r(...a),t)&&e(null,...a)})}}),t}function r0(t){xr===null&&Lp("onMount"),Us&&xr.l!==null?pY(xr).m.push(t):ga(()=>{let e=xn(t);if(typeof e=="function")return e})}function cf(t){xr===null&&Lp("onDestroy"),r0(()=>()=>xn(t))}function pY(t){var e=t.l;return e.u??={a:[],b:[],m:[]}}var Gh=!1,Hye=Symbol();function n0(t){var e=Gh;try{return Gh=!1,[t(),Gh]}finally{Gh=e}}var bY={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return Je&&FI(`${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 or(t,e,r){return new Proxy(Je?{props:t,exclude:e,name:r,other:{},to_proxy:[]}:{props:t,exclude:e},bY)}function B2(t){for(var e=rr,r=rr;e!==null&&!(e.f&96);)e=e.parent;try{return ei(e),t()}finally{ei(r)}}function ut(t,e,r,n){var i=(r&1)!==0,a=!Us||(r&2)!==0,o=(r&8)!==0,s=(r&16)!==0,l=!1,u;o?[u,l]=n0(()=>t[e]):u=t[e];var c=La in t||Ah in t,f=o&&(Oo(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=xn(n):m=n),m);u===void 0&&n!==void 0&&(f&&a&&NI(e),u=h(),f&&f(u));var x;if(a)x=()=>{var E=t[e];return E===void 0?h():(p=!0,d=!1,E)};else{var b=B2(()=>(i?Lt:Op)(()=>t[e]));b.f|=131072,x=()=>{var E=z(b);return E!==void 0&&(m=void 0),E===void 0?m:E}}if(!(r&4))return x;if(f){var T=t.$$legacy;return function(E,D){return arguments.length>0?((!a||!D||T||l)&&f(D?x():E),E):x()}}var v=!1,A=!1,w=Du(u),y=B2(()=>Lt(()=>{var E=x(),D=z(w);return v?(v=!1,A=!0,D):(A=!1,w.v=E)}));return i||(y.equals=Wc),function(E,D){if(Ip!==null&&(v=A,x(),z(w)),arguments.length>0){let _=D?z(y):a&&o?Ve(E):E;return y.equals(_)||(v=!0,$e(w,_),d&&m!==void 0&&(m=_),xn(()=>z(y))),E}return z(y)}}function k2(t){return new i0(t)}var i0=class{#t;#e;constructor(e){var r=new Map,n=(a,o)=>{var s=Du(o);return r.set(a,s),s};let i=new Proxy({...e.props||{},$$events:{}},{get(a,o){return z(r.get(o)??n(o,Reflect.get(a,o)))},has(a,o){return o===Ah?!0:(z(r.get(o)??n(o,Reflect.get(a,o))),Reflect.has(a,o))},set(a,o,s){return $e(r.get(o)??n(o,s),s),Reflect.set(a,o,s)}});this.#e=(e.hydrate?jb:Ur)(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)&&of(),this.#t=i.$$events;for(let a of Object.keys(this.#e))a==="$set"||a==="$destroy"||a==="$on"||gi(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=()=>{Pr(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 DY;typeof HTMLElement=="function"&&(DY=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=MY(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]=a0(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=k2({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Ob(()=>{da(()=>{this.$$r=!0;for(let n of wb(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=a0(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]=a0(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 wb(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function a0(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 MY(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}var NY=ue('<div class="mb-icon-wrapper"></div>');function Wr(t,e){Te(e,!0);let r=ut(e,"iconName",3,""),n=yt(void 0);ga(()=>z(n)?e.plugin.internal.setIcon(z(n),r()):void 0);var i=Gr(),a=je(i);{var o=s=>{var l=NY();Uo(l,u=>$e(n,u),()=>z(n)),K(s,l)};at(a,s=>{r().length>0&&s(o)})}K(t,i),De()}var FY=(t,e)=>e(t,"left"),IY=ue('<button class="mb-button-inner"><!> </button>');function Gp(t,e){Te(e,!0);let r=ut(e,"variant",19,()=>"default"),n=ut(e,"disabled",7,!1),i=ut(e,"tooltip",3,""),a=ut(e,"label",3,""),o=ut(e,"icon",3,""),s=ut(e,"cssStyle",3,""),l=ut(e,"backgroundImage",3,""),u=ut(e,"error",3,!1),c=ut(e,"onclick",3,()=>{}),f=ut(e,"onauxclick",3,()=>{});async function m(b,T){if(!n()){n(!0);try{T==="left"?await c()(b):T==="middle"&&await f()(b)}catch(v){console.warn("failed to run button component on click",v)}finally{n(!1)}}}var p=IY();p.__click=[FY,m];var d=ye(p);{var h=b=>{Wr(b,{get plugin(){return e.plugin},get iconName(){return o()}})};at(d,b=>{o()&&b(h)})}var x=le(d);ce(p),Le(()=>{wt(p,"style",s()),wt(p,"aria-label",i()),p.disabled=n(),tn(p,"mod-cta",r()==="primary"),tn(p,"mod-warning",r()==="destructive"),tn(p,"mod-plain",r()==="plain"),tn(p,"disabled",n()),tn(p,"mb-error",u()),Kb(p,"background-image",l()?`url("${l()}")`:void 0),xt(x,` ${a()??""}`)}),Pi("auxclick",p,b=>m(b,"middle")),K(t,p),De()}Nt(["click"]);var Iu=class extends Ni{constructor(e,r,n,i,a,o,s){super(),this.plugin=e,this.config=r,this.filePath=n,this.isInline=i==="inline",this.position=a,this.isInGroup=o,this.isPreview=s}onMount(e){pt.empty(e),pt.removeAllClasses(e),pt.addClasses(e,["mb-button",this.isInline?"mb-button-inline":"mb-button-block"]),!(!this.isInline&&!this.isPreview&&!this.isInGroup&&(this.config.id&&this.plugin.api.buttonManager.addButton(this.filePath,this.config),this.config.hidden))&&(this.config.class&&pt.addClasses(e,this.config.class.split(" ").filter(r=>r!=="")),this.buttonComponent=Ur(Gp,{target:e,props:{plugin:this.plugin,icon:this.config.icon,variant:this.config.style,label:this.config.label,tooltip:Hx(this.config.tooltip)?this.config.tooltip:void 0,cssStyle:this.config.cssStyle,backgroundImage:Hx(this.config.backgroundImage)?this.plugin.internal.imagePathToUri(this.config.backgroundImage):void 0,onclick:async r=>{await this.plugin.api.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),this.plugin.api.buttonActionRunner.mouseEventToClickContext(r,"left"))},onauxclick:async r=>{await this.plugin.api.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),this.plugin.api.buttonActionRunner.mouseEventToClickContext(r,"middle"))}}}))}getContext(){return{position:this.position?.getPosition(),isInGroup:this.isInGroup,isInline:this.isInline}}onUnmount(){this.buttonComponent&&Pr(this.buttonComponent),!this.isInline&&!this.isPreview&&this.config?.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.config.id)}};var Wh=class extends Ni{constructor(e,r,n,i,a){super(),this.plugin=e,this.referencedIds=r,this.filePath=n,this.renderChildType=i,this.notePosition=a}renderInitialButton(e,r){return pt.removeAllClasses(e),pt.addClasses(e,["mb-button",this.renderChildType==="inline"?"mb-button-inline":"mb-button-block"]),Ur(Gp,{target:e,props:{plugin:this.plugin,variant:"default",label:"Button ID not Found",tooltip:`No button with id '${r}' found`,error:!0,onclick:async()=>{}}})}onMount(e){pt.empty(e),pt.addClasses(e,["mb-button-group",this.renderChildType==="inline"?"mb-button-group-inline":"mb-button-group-block"]);for(let r of this.referencedIds){let n=pt.createElement(e,"span"),i=this.renderInitialButton(n,r),a,o=this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,r,s=>{i&&Pr(i),i=void 0,a=new Iu(this.plugin,s,this.filePath,this.renderChildType,this.notePosition,!0,!1),a.mount(n)});this.registerUnmountCb(()=>{i&&Pr(i),i=void 0,a?.unmount(),o()})}}onUnmount(e){pt.empty(e)}};var Yh=class extends qn{constructor(e,r,n,i,a,o){super(e,r,n),this.declaration=i,this.errorCollection=new Qt(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.renderChildType=a,this.position=o}onMount(e){if(super.onMount(e),pt.removeAllClasses(e),this.declaration.errorCollection.isEmpty())try{this.buttonField=new Wh(this.plugin,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.plugin.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(),Di(e,"inline button")}};var jh=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 Zh=class{constructor(e){this.plugin=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let r=new Set,n=new Qt("ButtonManager");this.buttonTemplates.clear();for(let i of e)i.id===void 0||i.id===""?n.add(new Ns({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 Ns({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=Fr();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 jh(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 Jh=class extends qn{constructor(e,r,n,i,a,o){super(e,r,n),this.declaration=i,this.position=a,this.isPreview=o,this.errorCollection=new Qt(this.getUuid()),this.errorCollection.merge(i.errorCollection)}onMount(e){if(super.onMount(e),pt.removeAllClasses(e),this.declaration.config&&this.declaration.errorCollection.isEmpty())try{this.buttonField=new Iu(this.plugin,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.plugin.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(),Di(e,"button")}};var Xh=class extends qn{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=Cn.parseLink(r);if(!n.internal)return{error:`${r} is not an internal link`};let i=this.plugin.internal.file.getPathByName(n.target,this.getFilePath());return i===void 0?{error:`"${n.target}" is not created yet`}:{content:await this.plugin.internal.file.read(i)}}exceedsMaxDepth(){return this.depth>cd}createEmbedMessage(e,r){e.createSpan({text:r,cls:"mb-embed-message"})}async renderContent(e){try{if(this.exceedsMaxDepth()){this.createEmbedMessage(e,"Max embed depth exceeded");return}let r=await this.parseContent();if(r.error){this.createEmbedMessage(e,r.error);return}if(r.content===void 0){this.createEmbedMessage(e,"Embed content not found");return}let n=r.content.replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=await this.plugin.internal.renderMarkdown(n,e,this.getFilePath())}catch(r){let n=new Qt("Embed");n.add(r),this.plugin.internal.createErrorIndicator(e,{errorCollection:n})}}onMount(e){super.onMount(e),e.addClass("mb-embed"),this.renderContent(e)}onUnmount(e){super.onUnmount(e),e.removeClass("mb-embed"),this.markdownUnloadCallback?.(),Di(e,"Embed")}};var Qh=class extends qn{constructor(e,r,n){super(e,r,n)}onMount(e){super.onMount(e),pt.empty(e),pt.createElement(e,"span",{text:"[META_BIND] This folder has been excluded in the settings",class:"mb-error"})}onUnmount(e){super.onUnmount(e),pt.empty(e),Di(e,"Excluded")}};var Kh=class{constructor(e,r,n){this.plugin=e,this.mounted=!1,this.svelteComponent=r,this.onValueChange=n}setValue(e){this.svelteComponentInstance?.setValue(e)}getInstance(){return this.svelteComponentInstance}mount(e,r,n={}){let i=Object.assign({plugin:this.plugin,value:r,onValueChange:this.onValueChange},n);this.svelteComponentInstance=Ur(this.svelteComponent,{target:e,props:i}),this.mounted=!0}unmount(){this.svelteComponentInstance&&Pr(this.svelteComponentInstance),this.mounted=!1}isMounted(){return this.mounted}};var lr=class extends Ni{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.svelteWrapper=new Kh(this.plugin,this.getSvelteComponent(),r=>{this.updateDataAttributes(r),this.notifySubscription(this.mapValue(r))}),this.inputSignal=new ah(void 0,r=>{let n=this.filterValue(r);return n!==void 0?n:this.getDefaultValue()})}reverseMapValue(e){let r=this.rawReverseMapValue(e);if(r!==void 0)return r;let n=this.rawReverseMapValue(this.getDefaultValue());return n!==void 0?n:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.inputSignal.get()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.inputSignal.setDirect(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){this.metadataSubscription?.write(e)}getDefaultValue(){let e=this.mountable.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let r=this.filterValue(e.value);return r!==void 0?r:this.mapValue(this.getFallbackDefaultValue())}updateDataAttributes(e){this.mountTarget&&(this.mountTarget.dataset.internalValue=JSON.stringify(e))}getMountArgs(){return{}}onMount(e){this.mountTarget=e,this.inputSignal.registerListener({callback:n=>this.svelteWrapper.setValue(this.reverseMapValue(n))}),this.inputSignal.registerListener({callback:n=>{this.updateDataAttributes(this.reverseMapValue(n))}});let r=this.mountable.getBindTarget();r&&(this.metadataSubscription=this.mountable.plugin.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,r,()=>this.mountable.unmount())),this.svelteWrapper.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.mountTarget=void 0,this.inputSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.svelteWrapper.unmount()}};var PY=(t,e,r,n)=>r.onValueChange(z(n)),BY=ue('<input type="date">');function o0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(o){$e(n,Ve(o))}var a=BY();return Tt(a),a.__input=[PY,r,e,n],_t(a,()=>z(n),o=>$e(n,o)),K(t,a),De({setValue:i})}Nt(["input"]);var eg=class extends lr{filterValue(e){return os(e)}getFallbackDefaultValue(){return oi.stringify(oi.getDefaultDate())}getSvelteComponent(){return o0}rawMapValue(e){return e}rawReverseMapValue(e){return e}};function kY(t,e,r){r.showDatePicker()}function $Y(t,e,r){t.key===" "&&r.showDatePicker()}var OY=ue('<div class="mb-date-picker-input" role="button" tabindex="0"><span class="mb-date-picker-text"> </span> <!></div>');function s0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(u){$e(n,Ve(u))}var a=OY();a.__click=[kY,r,e],a.__keydown=[$Y,r,e];var o=ye(a),s=ye(o,!0);Le(()=>xt(s,z(n)?z(n).format(e.dateFormat):"none")),ce(o);var l=le(o,2);return Wr(l,{get plugin(){return e.plugin},iconName:"calendar"}),ce(a),K(t,a),De({setValue:i})}Nt(["click","keydown"]);var tg=class extends lr{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=oi.parse(e);if(r.isValid())return oi.stringify(r)}getFallbackDefaultValue(){return oi.getDefaultDate()}getSvelteComponent(){return s0}rawMapValue(e){return e===null?null:(console.log("value",e,oi.stringify(e),oi.dateFormat),oi.stringify(e))}rawReverseMapValue(e){if(e===null)return null;let r=oi.parse(e);if(r.isValid())return r}getMountArgs(){return{dateFormat:this.mountable.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.mountable.plugin.internal.openDatePickerModal(this)}}}};var RY=(t,e,r,n)=>r.onValueChange(z(n)),LY=ue('<input type="datetime-local">');function u0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(o){$e(n,Ve(o))}var a=LY();return Tt(a),a.__input=[RY,r,e,n],_t(a,()=>z(n),o=>$e(n,o)),K(t,a),De({setValue:i})}Nt(["input"]);var rg=class extends lr{filterValue(e){return os(e)}getFallbackDefaultValue(){return oi.stringify(oi.getDefaultDate())}getSvelteComponent(){return u0}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var VY=ue("<div></div>");function l0(t,e){Te(e,!0);let r,n;cf(()=>{n?.()});async function i(o){n?.(),n=await e.plugin.internal.renderMarkdown(o,r,e.filePath)}ga(()=>void i(e.value));var a=VY();Uo(a,o=>r=o,()=>r),K(t,a),De()}var UY=(t,e)=>e(),qY=(t,e)=>e(),zY=(t,e,r,n)=>r.onValueChange(z(n)),HY=ue("<textarea></textarea>"),GY=ue('<div class="mb-editor-input card" role="button" tabindex="0"><!></div>');function c0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value)),i=yt(!1);function a(p){$e(n,Ve(p))}function o(){$e(i,!1)}function s(){$e(i,!0)}function l(p){p.key===" "&&s()}var u=GY();u.__click=[UY,s];var c=ye(u);{var f=p=>{var d=HY();On(d),d.__focusout=[qY,o],d.__input=[zY,r,e,n],_t(d,()=>z(n),h=>$e(n,h)),K(p,d)},m=p=>{l0(p,{get value(){return z(n)},get plugin(){return e.plugin},get filePath(){return e.filePath}})};at(c,p=>{z(i)?p(f):p(m,!1)})}return ce(u),Pi("keypress",u,p=>l(p)),K(t,u),De({setValue:a})}Nt(["click","focusout","input"]);var ng=class extends lr{filterValue(e){return Au(e)?e?.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return c0}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.plugin.internal.renderMarkdown(r,e,this.mountable.getFilePath())}onUnmount(){super.onUnmount(),this.mdUnloadCallback?.()}};var WY=ue("<button><!></button>");function bt(t,e){Te(e,!0);let r=ut(e,"variant",19,()=>"default"),n=ut(e,"disabled",3,!1),i=ut(e,"tooltip",3,""),a=ut(e,"classes",3,""),o=ut(e,"onclick",3,()=>{});var s=WY();s.__click=function(...u){o()?.apply(this,u)};var l=ye(s);go(l,()=>e.children),ce(s),Le(()=>{xa(s,`mb-button-inner ${a()??""}`),wt(s,"aria-label",i()),s.disabled=n(),tn(s,"mod-cta",r()==="primary"),tn(s,"mod-warning",r()==="destructive"),tn(s,"mod-plain",r()==="plain"),tn(s,"disabled",n())}),K(t,s),De()}Nt(["click"]);var YY=ue('<div class="mb-image-card" role="listitem"><img class="mb-image-card-image"></div>'),jY=ue('<div class="mb-image-card-grid"></div> <div class="mb-list-input"><!></div>',1);function f0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(m){$e(n,Ve(m))}function a(m){z(n).push(m),e.onValueChange(z(n))}function o(m){z(n).splice(m,1),e.onValueChange(z(n))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=z(n)[p-1];z(n)[p-1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),p<z(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=z(n)[p+1];z(n)[p+1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),d.push({name:"Copy image path",icon:"copy",onclick:()=>{let h=z(n)[p];navigator.clipboard.writeText(h).then(()=>{e.plugin.internal.showNotice("Image path copied to clipboard")}).catch(()=>{e.plugin.internal.showNotice("Failed to copy image path to clipboard")})}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.plugin.internal.createContextMenu(d).showWithEvent(m)}var l=jY(),u=je(l);Yt(u,21,()=>z(n),er,(m,p,d)=>{var h=YY();h.__contextmenu=b=>s(b,d);var x=ye(h);Le(()=>wt(x,"src",e.plugin.internal.imagePathToUri(z(p)))),ce(h),Le(()=>{wt(x,"alt",z(p)),wt(x,"aria-label",z(p))}),K(m,h)}),ce(u);var c=le(u,2),f=ye(c);return bt(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(m,p)=>{Et();var d=Wt("Add new image");K(m,d)},$$slots:{default:!0}}),ce(c),K(t,l),De({setValue:i,pushValue:a})}Nt(["contextmenu"]);var ig=class extends lr{filterValue(e){return oo(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return f0}rawMapValue(e){return e}rawReverseMapValue(e){return e.map(r=>$o(r)).filter(r=>r!==void 0)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,!1,e=>{e!==void 0&&this.svelteWrapper.getInstance()?.pushValue(e)})}};var ZY=(t,e)=>e(t),JY=ue('<div class="mb-image-card"><img class="mb-image-card-image"> <!></div>'),XY=ue('<div class="mb-image-empty"><!></div>');function p0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(c){$e(n,Ve(c))}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.plugin.internal.createContextMenu(f).showWithEvent(c)}var o=Gr(),s=je(o);{var l=c=>{var f=JY();f.__contextmenu=[ZY,a];var m=ye(f);Le(()=>wt(m,"src",e.plugin.internal.imagePathToUri(z(n))));var p=le(m,2);bt(p,{get variant(){return"plain"},onclick:d=>a(d),classes:"mb-image-card-button",children:(d,h)=>{Wr(d,{iconName:"ellipsis-vertical",get plugin(){return e.plugin}})},$$slots:{default:!0}}),ce(f),Le(()=>{wt(m,"alt",z(n)),wt(m,"aria-label",z(n))}),K(c,f)},u=c=>{var f=XY(),m=ye(f);bt(m,{get variant(){return"plain"},onclick:()=>e.showSuggester(),tooltip:"Select image",children:(p,d)=>{Et();var h=Wt("No image selected. Click to select.");K(p,h)},$$slots:{default:!0}}),ce(f),K(c,f)};at(s,c=>{z(n)?c(l):c(u,!1)})}return K(t,o),De({setValue:i})}Nt(["contextmenu"]);var ag=class extends lr{filterValue(e){return Au(e)?e:void 0}getFallbackDefaultValue(){}getSvelteComponent(){return p0}rawMapValue(e){return e}rawReverseMapValue(e){return $o(e)}getMountArgs(){return{showSuggester:()=>this.openModal(),clear:()=>this.setInternalValue(void 0)}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,!0,e=>this.setInternalValue(e))}};var QY=ue('<a target="_blank" rel="noopener"> </a>'),KY=ue('<a target="_blank" rel="noopener"> </a>');function Zs(t,e){Te(e,!0);let r=Lt(()=>e.mdLink.block?`${e.mdLink.target}#${e.mdLink.block}`:e.mdLink.target),n=Lt(()=>e.mdLink.internal?"internal-link":"external-link");var i=Gr(),a=je(i);{var o=l=>{var u=QY(),c=ye(u,!0);ce(u),Le(()=>{wt(u,"data-href",z(r)),wt(u,"href",z(r)),xa(u,Ys(z(n))),wt(u,"aria-label",z(r)),xt(c,e.mdLink.alias)}),K(l,u)},s=l=>{var u=KY(),c=ye(u,!0);ce(u),Le(()=>{wt(u,"data-href",z(r)),wt(u,"href",z(r)),xa(u,Ys(z(n))),xt(c,z(r))}),K(l,u)};at(a,l=>{e.mdLink.alias?l(o):l(s,!1)})}K(t,i),De()}var ej=ue("<!><span>,</span> <span></span>",1),tj=ue("<!> <!>",1);function Wp(t,e){Te(e,!0);let r=ut(e,"elements",19,()=>[]);var n=tj(),i=je(n);Yt(i,17,()=>r().slice(0,r().length-1),er,(o,s)=>{var l=ej(),u=je(l);go(u,()=>e.children,()=>z(s)),Et(3),K(o,l)});var a=le(i,2);go(a,()=>e.children,()=>r()[r().length-1]),K(t,n),De()}var rj=ue('<span class="mb-whitespace-pre"> </span>'),nj=ue("<span> </span>"),ij=ue("<span><!></span>"),aj=ue("<span><!></span>");function za(t,e){Te(e,!0);let r=ut(e,"value",3,void 0),n=Lt(()=>gI(r(),!1));var i=Gr(),a=je(i);{var o=l=>{var u=rj(),c=ye(u,!0);ce(u),Le(()=>xt(c,z(n))),K(l,u)},s=l=>{var u=Gr(),c=je(u);{var f=p=>{var d=ij(),h=ye(d);Wp(h,{get elements(){return z(n)},children:(b,T=Ra)=>{var v=Gr(),A=je(v);{var w=E=>{var D=nj(),_=ye(D,!0);ce(D),Le(()=>xt(_,T())),K(E,D)},y=E=>{Zs(E,{get mdLink(){return T()}})};at(A,E=>{typeof T()=="string"?E(w):E(y,!1)})}K(b,v)},$$slots:{default:!0}}),ce(d),K(p,d)},m=p=>{var d=aj(),h=ye(d);Zs(h,{get mdLink(){return z(n)}}),ce(d),K(p,d)};at(c,p=>{Array.isArray(z(n))?p(f):p(m,!1)},!0)}K(l,u)};at(a,l=>{typeof z(n)=="string"?l(o):l(s,!1)})}K(t,i),De()}function oj(t,e,r){t.key===" "&&r.showInput()}var sj=ue('<div class="mb-inline-list-item" role="listitem"><!></div>'),uj=(t,e,r)=>r.showInput(),lj=ue('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function m0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(m){$e(n,Ve(m))}function a(m){z(n).push(m),e.onValueChange(z(n))}function o(m){z(n).splice(m,1),e.onValueChange(z(n))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=z(n)[p-1];z(n)[p-1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),p<z(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=z(n)[p+1];z(n)[p+1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),d.push({name:"Edit",icon:"pencil",onclick:()=>{e.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:$o(z(n)[p]),multiline:!1,onSubmit:h=>{z(n)[p]=h,e.onValueChange(z(n))},onCancel:()=>{}})}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.plugin.internal.createContextMenu(d).showWithEvent(m)}var l=lj(),u=ye(l);Yt(u,17,()=>z(n),er,(m,p,d)=>{var h=sj();h.__contextmenu=b=>s(b,d);var x=ye(h);za(x,{get value(){return z(p)}}),ce(h),K(m,h)});var c=le(u,2);c.__click=[uj,r,e],c.__keydown=[oj,r,e];var f=le(ye(c),2);return Wr(f,{get plugin(){return e.plugin},iconName:"plus"}),ce(c),ce(l),K(t,l),De({setValue:i,pushValue:a})}Nt(["contextmenu","click","keydown"]);var og=class extends lr{filterValue(e){return oo(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return m0}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showInput:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{this.svelteWrapper.getInstance()?.pushValue(e)},onCancel:()=>{}})}};function cj(t,e,r){if(!r.allowOther){r.showSuggester();return}r.plugin.internal.createContextMenu([{name:"From Options",onclick:()=>r.showSuggester()},{name:"From Text",onclick:()=>r.showTextPrompt()}]).showWithEvent(t)}function fj(t,e,r){t.key===" "&&r.showSuggester()}var pj=ue('<div class="mb-inline-list-item" role="listitem"><!></div>'),mj=ue('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function d0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(m){$e(n,Ve(m))}function a(m){z(n).push(m),e.onValueChange(z(n))}function o(m){z(n).splice(m,1),e.onValueChange(z(n))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=z(n)[p-1];z(n)[p-1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),p<z(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=z(n)[p+1];z(n)[p+1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.plugin.internal.createContextMenu(d).showWithEvent(m)}var l=mj(),u=ye(l);Yt(u,17,()=>z(n),er,(m,p,d)=>{var h=pj();h.__contextmenu=b=>s(b,d);var x=ye(h);za(x,{get value(){return z(p)}}),ce(h),K(m,h)});var c=le(u,2);c.__click=[cj,r,e],c.__keydown=[fj,r,e];var f=le(ye(c),2);return Wr(f,{get plugin(){return e.plugin},iconName:"plus"}),ce(c),ce(l),K(t,l),De({setValue:i,pushValue:a})}Nt(["contextmenu","click","keydown"]);var sg=class extends lr{filterValue(e){return oo(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return d0}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.plugin.internal.openSuggesterModal(this,e=>{this.svelteWrapper.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.plugin.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 dj=(t,e)=>e(),hj=ue("<option> </option>"),gj=ue('<select class="dropdown"></select>');function h0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(s){$e(n,Ve(s))}function a(){e.onValueChange(z(n))}var o=gj();return o.__change=[dj,a],Yt(o,21,()=>e.options,er,(s,l)=>{var u=hj(),c={},f=ye(u,!0);ce(u),Le(()=>{c!==(c=z(l).value)&&(u.value=(u.__value=z(l).value)==null?"":z(l).value),xt(f,z(l).name)}),K(s,u)}),ce(o),lf(o,()=>z(n),s=>$e(n,s)),K(t,o),De({setValue:i})}Nt(["change"]);var ug=class extends lr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Su(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return h0}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var vj=ue('<div class="mb-list-item" role="listitem"><!></div>'),yj=ue('<span class="mb-list-empty">Empty</span>'),xj=ue('<textarea tabindex="0"></textarea>'),bj=(t,e,r)=>{t.key==="Enter"&&z(e).length>0&&r()},wj=ue('<input type="text" tabindex="0">'),_j=ue("<span> </span>"),Aj=ue('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!> <!></div>',1);function g0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value)),i=yt("");function a(A){$e(n,Ve(A))}function o(){z(n).push(z(i)),e.onValueChange(z(n)),$e(i,"")}function s(A){z(n).splice(A,1),e.onValueChange(z(n))}function l(A,w){let y=w.toString();return`${A.toString().padStart(y.length,"0")}/${y}`}function u(A,w){let y=[];w>0&&y.push({name:"Move up",icon:"arrow-up",onclick:()=>{let E=z(n)[w-1];z(n)[w-1]=z(n)[w],z(n)[w]=E,e.onValueChange(z(n))}}),w<z(n).length-1&&y.push({name:"Move down",icon:"arrow-down",onclick:()=>{let E=z(n)[w+1];z(n)[w+1]=z(n)[w],z(n)[w]=E,e.onValueChange(z(n))}}),y.push({name:"Edit",icon:"pencil",onclick:()=>{e.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:$o(z(n)[w]),multiline:e.multiLine,onSubmit:E=>{z(n)[w]=E,e.onValueChange(z(n))},onCancel:()=>{}})}}),y.push({name:"Remove",icon:"x",warning:!0,onclick:()=>s(w)}),e.plugin.internal.createContextMenu(y).showWithEvent(A)}var c=Aj(),f=je(c);Yt(f,21,()=>z(n),er,(A,w,y)=>{var E=vj();E.__contextmenu=_=>u(_,y);var D=ye(E);za(D,{get value(){return z(w)}}),ce(E),K(A,E)},A=>{var w=yj();K(A,w)}),ce(f);var m=le(f,2),p=ye(m);{var d=A=>{var w=xj();On(w),Le(()=>{wt(w,"placeholder",e.placeholder),wt(w,"maxlength",e.limit)}),_t(w,()=>z(i),y=>$e(i,y)),K(A,w)},h=A=>{var w=wj();Tt(w),w.__keyup=[bj,i,o],Le(()=>{wt(w,"placeholder",e.placeholder),wt(w,"maxlength",e.limit)}),_t(w,()=>z(i),y=>$e(i,y)),K(A,w)};at(p,A=>{e.multiLine?A(d):A(h,!1)})}var x=le(p,2);{var b=A=>{var w=_j(),y=ye(w,!0);Le(()=>xt(y,l(z(n).length,e.limit))),ce(w),Le(()=>xa(w,`mb-content-limit-indicator ${z(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`)),K(A,w)};at(x,A=>{e.limit!==void 0&&A(b)})}var T=le(x,2),v=Lt(()=>!z(i));return bt(T,{onclick:()=>o(),get disabled(){return z(v)},children:(A,w)=>{Wr(A,{get plugin(){return e.plugin},iconName:"plus"})},$$slots:{default:!0}}),ce(m),K(t,c),De({setValue:a})}Nt(["contextmenu","keyup"]);var lg=class extends lr{filterValue(e){return oo(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return g0}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 Sj=ue('<div class="mb-list-item" role="listitem"><!></div>'),Ej=ue('<span class="mb-list-empty">Empty</span>'),Tj=ue('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!></div>',1);function v0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(d){$e(n,Ve(d))}function a(d){z(n).push(d),e.onValueChange(z(n))}function o(d){z(n).splice(d,1),e.onValueChange(z(n))}function s(d,h){let x=[];h>0&&x.push({name:"Move up",icon:"arrow-up",onclick:()=>{let b=z(n)[h-1];z(n)[h-1]=z(n)[h],z(n)[h]=b,e.onValueChange(z(n))}}),h<z(n).length-1&&x.push({name:"Move down",icon:"arrow-down",onclick:()=>{let b=z(n)[h+1];z(n)[h+1]=z(n)[h],z(n)[h]=b,e.onValueChange(z(n))}}),x.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(h)}),e.plugin.internal.createContextMenu(x).showWithEvent(d)}var l=Tj(),u=je(l);Yt(u,21,()=>z(n),er,(d,h,x)=>{var b=Sj();b.__contextmenu=v=>s(v,x);var T=ye(b);za(T,{get value(){return z(h)}}),ce(b),K(d,b)},d=>{var h=Ej();K(d,h)}),ce(u);var c=le(u,2),f=ye(c);bt(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(d,h)=>{Et();var x=Wt("Add new item");K(d,x)},$$slots:{default:!0}});var m=le(f,2);{var p=d=>{bt(d,{get variant(){return"default"},onclick:()=>e.showTextPrompt(),children:(h,x)=>{Et();var b=Wt("Add other item");K(h,b)},$$slots:{default:!0}})};at(m,d=>{e.allowOther&&d(p)})}return ce(c),K(t,l),De({setValue:i,pushValue:a})}Nt(["contextmenu"]);var cg=class extends lr{filterValue(e){return oo(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return v0}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.plugin.internal.openSuggesterModal(this,e=>{this.svelteWrapper.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.plugin.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 Dj=(t,e,r)=>{t.target instanceof HTMLInputElement||e(z(r).value)},Mj=(t,e,r)=>e(z(r).value),Cj=ue('<div class="mb-select-input-element mb-mod-multi" role="button" tabindex="0"><input type="checkbox"> <!></div>');function y0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(u){$e(n,Ve(u))}function a(u){z(n).includes(u)?$e(n,Ve(z(n).filter(c=>c!==u))):z(n).push(u),e.onValueChange(z(n))}function o(u,c){u.key===" "&&a(c)}var s=Gr(),l=je(s);return Yt(l,17,()=>e.options,er,(u,c)=>{var f=Cj();f.__click=[Dj,a,c];let m=Lt(()=>z(n).includes(z(c).value));Le(()=>tn(f,"is-selected",z(m)));var p=ye(f);Tt(p),Le(()=>js(p,z(n).includes(z(c).value))),p.__input=[Mj,a,c];var d=le(p,2);za(d,{get value(){return z(c).name}}),ce(f),Pi("keypress",f,h=>o(h,z(c).value)),K(u,f)}),K(t,s),De({setValue:i})}Nt(["click","input"]);var fg=class extends lr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return oo(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return y0}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var Nj=(t,e,r,n)=>r.onValueChange(z(n)),Fj=ue('<input type="number" tabindex="0">');function x0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(o){$e(n,Ve(o))}var a=Fj();return Tt(a),a.__input=[Nj,r,e,n],Le(()=>wt(a,"placeholder",e.placeholder)),_t(a,()=>z(n),o=>$e(n,o)),K(t,a),De({setValue:i})}Nt(["input"]);var pg=class extends lr{filterValue(e){return Hc(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return x0}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Number"}}};function $2(t,e,r){e(),r(t)}var Ij=ue('<span class="mb-progress-bar-value"> </span> <span class="mb-progress-bar-label-left"> </span> <span class="mb-progress-bar-label-right"> </span>',1),Pj=ue('<div class="mb-progress-bar-input" tabindex="0" role="button"><div class="mb-progress-bar-progress" role="slider" tabindex="0"></div> <!></div>');function b0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value)),i=!1,a,o=0,s;function l(y){$e(n,Ve(y))}function u(y){$e(n,Ve(y)),e.onValueChange(y)}function c(y){return y=mp(y,e.minValue,e.maxValue),qx(y,e.minValue,e.maxValue,0,100)}function f(){i=!0}function m(){i=!1}function p(y){if(!i)return;y.stopPropagation&&y.stopPropagation(),y.preventDefault&&y.preventDefault();let E=y instanceof TouchEvent?y.touches[0].clientX:y.clientX;d(E)}function d(y){let E=a.getBoundingClientRect();y=mp(y,E.left,E.right);let D=qx(y,E.left,E.right,e.minValue,e.maxValue);D=h(D,e.stepSize),u(D)}function h(y,E){return Number.parseFloat((Math.round(y/E)*E).toFixed(10))}function x(y){o<50&&(o+=1);let E=Math.ceil(o/5);if(y.key==="ArrowUp"||y.key==="ArrowRight"){let D=mp(z(n)+E,e.minValue,e.maxValue);u(D)}if(y.key==="ArrowDown"||y.key==="ArrowLeft"){let D=mp(z(n)-E,e.minValue,e.maxValue);u(D)}window.clearTimeout(s),s=window.setTimeout(()=>o=1,100)}var b=Pj();Pi("touchmove",Gs,p,void 0,!1),Pi("touchcancel",Gs,m),Pi("touchend",Gs,m),Pi("mousemove",Gs,p),Pi("mouseup",Gs,m),b.__keydown=x,b.__mousedown=[$2,f,p],b.__touchstart=[$2,f,p];var T=ye(b);let v=Lt(()=>`width: ${c(z(n))}%`);Le(()=>wt(T,"aria-label",z(n).toString()));var A=le(T,2);{var w=y=>{var E=Ij(),D=je(E),_=ye(D,!0);ce(D);var C=le(D,2),N=ye(C,!0);ce(C);var P=le(C,2),R=ye(P,!0);ce(P),Le(()=>{xt(_,z(n)),xt(N,e.minValue),xt(R,e.maxValue)}),K(y,E)};at(A,y=>{e.addLabels&&y(w)})}return ce(b),Uo(b,y=>a=y,()=>a),Le(()=>{wt(T,"style",z(v)),wt(T,"aria-valuemin",e.minValue),wt(T,"aria-valuemax",e.maxValue),wt(T,"aria-valuenow",z(n))}),Pi("dragstart",T,()=>i=!0),K(t,b),De({setValue:l})}Nt(["keydown","mousedown","touchstart"]);var mg=class extends lr{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 Hr({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return xd(Hc(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return b0}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 Bj=(t,e,r)=>{t.target instanceof HTMLInputElement||e(z(r).value)},kj=(t,e,r)=>e(z(r).value),$j=ue('<div class="mb-select-input-element" role="button" tabindex="0"><input type="checkbox"> <!></div>');function w0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(u){$e(n,Ve(u))}function a(u){z(n)===u?$e(n,null):$e(n,Ve(u)),e.onValueChange(z(n))}function o(u,c){u.key===" "&&a(c)}var s=Gr(),l=je(s);return Yt(l,17,()=>e.options,er,(u,c)=>{var f=$j();f.__click=[Bj,a,c];var m=ye(f);Tt(m),m.__input=[kj,a,c];var p=le(m,2);za(p,{get value(){return z(c).name}}),ce(f),Le(()=>{tn(f,"is-selected",z(c).value===z(n)),js(m,z(c).value===z(n))}),Pi("keypress",f,d=>o(d,z(c).value)),K(u,f)}),K(t,s),De({setValue:i})}Nt(["click","input"]);var dg=class extends lr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Su(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return w0}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var Oj=ue('<span class="mb-slider-input-label"> </span>'),Rj=(t,e,r,n)=>r.onValueChange(z(n)),Lj=ue('<span class="mb-slider-input-label"> </span>'),Vj=ue('<!> <input class="mb-slider-input slider" type="range" tabindex="0"> <!>',1);function _0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(f){$e(n,Ve(f))}var a=Vj(),o=je(a);{var s=f=>{var m=Oj(),p=ye(m,!0);ce(m),Le(()=>xt(p,e.minValue)),K(f,m)};at(o,f=>{e.addLabels&&f(s)})}var l=le(o,2);Tt(l),l.__input=[Rj,r,e,n];var u=le(l,2);{var c=f=>{var m=Lj(),p=ye(m,!0);ce(m),Le(()=>xt(p,e.maxValue)),K(f,m)};at(u,f=>{e.addLabels&&f(c)})}return Le(()=>{wt(l,"min",e.minValue),wt(l,"max",e.maxValue),wt(l,"step",e.stepSize)}),_t(l,()=>z(n),f=>$e(n,f)),K(t,a),De({setValue:i})}Nt(["input"]);var hg=class extends lr{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 Hr({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return xd(Hc(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return _0}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 Uj=ue("<span> </span>"),qj=ue('<div class="mb-suggest-input"><div class="mb-suggest-text"><!></div> <!> <!></div>');function A0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(h){$e(n,Ve(h))}let a=Lt(()=>z(n)?.toString()??"null"),o=Lt(()=>{if(Cn.isLink(z(a)))try{return Cn.parseLink(z(a))}catch(h){console.warn(h)}});var s=qj(),l=ye(s),u=ye(l);{var c=h=>{Zs(h,{get mdLink(){return z(o)}})},f=h=>{var x=Uj(),b=ye(x,!0);ce(x),Le(()=>xt(b,z(a))),K(h,x)};at(u,h=>{z(o)!==void 0?h(c):h(f,!1)})}ce(l);var m=le(l,2);bt(m,{get variant(){return"plain"},get onclick(){return e.showSuggester},children:(h,x)=>{Wr(h,{get plugin(){return e.plugin},iconName:"list"})},$$slots:{default:!0}});var p=le(m,2);{var d=h=>{bt(h,{get variant(){return"plain"},get onclick(){return e.showTextPrompt},children:(x,b)=>{Wr(x,{get plugin(){return e.plugin},iconName:"pencil"})},$$slots:{default:!0}})};at(p,h=>{e.allowOther&&h(d)})}return ce(s),K(t,s),De({setValue:i})}var gg=class extends lr{filterValue(e){return Su(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return A0}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.plugin.internal.openSuggesterModal(this,e=>this.setInternalValue(e.value))}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind Suggester",subTitle:"Set the suggester value.",value:"",multiline:!1,onSubmit:e=>{this.setInternalValue(e)},onCancel:()=>{}})}};var zj=(t,e,r,n)=>r.onValueChange(z(n)),Hj=ue("<span> </span>"),Gj=ue('<input type="text" tabindex="0"> <!>',1);function S0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(c){$e(n,Ve(c))}function a(c,f){let m=f.toString();return`${c.toString().padStart(m.length,"0")}/${m}`}var o=Gj(),s=je(o);Tt(s),s.__input=[zj,r,e,n];var l=le(s,2);{var u=c=>{var f=Hj(),m=ye(f,!0);Le(()=>xt(m,a(z(n).length,e.limit))),ce(f),Le(()=>xa(f,`mb-content-limit-indicator ${z(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`)),K(c,f)};at(l,c=>{e.limit!==void 0&&c(u)})}return Le(()=>{wt(s,"placeholder",e.placeholder),wt(s,"maxlength",e.limit)}),_t(s,()=>z(n),c=>$e(n,c)),K(t,o),De({setValue:i})}Nt(["input"]);var vg=class extends lr{filterValue(e){return os(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return S0}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var Wj=(t,e,r,n)=>r.onValueChange(z(n)),Yj=ue('<textarea class="mb-input-textarea" tabindex="0"></textarea>');function E0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(o){$e(n,Ve(o))}var a=Yj();return On(a),a.__input=[Wj,r,e,n],Le(()=>{wt(a,"placeholder",e.placeholder),wt(a,"maxlength",e.limit)}),_t(a,()=>z(n),o=>$e(n,o)),K(t,a),De({setValue:i})}Nt(["input"]);var yg=class extends lr{filterValue(e){return os(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return E0}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var jj=(t,e,r,n)=>r.onValueChange(z(n)),Zj=ue('<input type="time">');function T0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(o){$e(n,Ve(o))}var a=Zj();return Tt(a),a.__input=[jj,r,e,n],_t(a,()=>z(n),o=>$e(n,o)),K(t,a),De({setValue:i})}Nt(["input"]);var xg=class extends lr{filterValue(e){return os(e)}getFallbackDefaultValue(){return"00:00"}getSvelteComponent(){return T0}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var Jj=(t,e)=>e(),Xj=(t,e)=>e(t),Qj=ue('<div class="checkbox-container" role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function D0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=yt(Ve(e.value));function i(u){$e(n,Ve(u))}function a(){$e(n,!z(n)),e.onValueChange(z(n))}function o(u){u.key===" "&&a()}var s=Qj();s.__click=[Jj,a],s.__keydown=[Xj,o];var l=ye(s);return Tt(l),ce(s),Le(()=>{wt(s,"aria-checked",z(n)),tn(s,"is-enabled",z(n)),js(l,z(n))}),K(t,s),De({setValue:i})}Nt(["click","keydown"]);var bg=class extends lr{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?Su(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return D0}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};var jt=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){bd(e)}};var wg=class{constructor(e){this.plugin=e}createInputField(e){let r=e.declaration.inputFieldType,n=e.renderChildType;if(r!=="invalid"&&this.checkRenderChildTypeAllowed(r,n),r==="toggle")return new bg(e);if(r==="slider")return new hg(e);if(r==="text")return new vg(e);if(r==="textArea")return new yg(e);if(r==="select")return new dg(e);if(r==="multiSelect")return new fg(e);if(r==="datePicker")return new tg(e);if(r==="number")return new pg(e);if(r==="suggester")return new gg(e);if(r==="editor")return new ng(e);if(r==="progressBar")return new mg(e);if(r==="inlineSelect")return new ug(e);if(r==="imageSuggester")return new ag(e);if(r==="list")return new lg(e);if(r==="listSuggester")return new cg(e);if(r==="date")return new eg(e);if(r==="time")return new xg(e);if(r==="inlineListSuggester")return new sg(e);if(r==="inlineList")return new og(e);if(r==="imageListSuggester")return new ig(e);if(r==="dateTime")return new rg(e);}checkRenderChildTypeAllowed(e,r){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let n=ld[e];if(r==="block"&&!n.allowInBlock)throw new No({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[jt.linkToInputField(e)]});if(r==="inline"&&!n.allowInline)throw new No({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[jt.linkToInputField(e)]})}};var ff=class extends qn{constructor(e,r,n,i,a){super(e,r,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Qt(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 Ht({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=pt.createElement(e,"div");pt.addClass(r,"mb-card");let n=this.getArgument("title");return n&&pt.createElement(r,"h3",{text:n.value}),r}return e}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){let n=pt.createElement(e,"code",{class:"mb-none"}),i=pt.createElement(n,"a",{text:this.declarationString,class:"mb-no-link"});i.href=jt.linkToInputField(this.declaration.inputFieldType)}}createInputField(){if(!this.errorCollection.hasErrors())try{this.inputField=this.plugin.api.inputFieldFactory.createInputField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new Ht({errorLevel:"CRITICAL",effect:"can't render input field",cause:"input field is undefined"}))}createErrorIndicator(e){this.plugin.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),pt.empty(e),pt.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let r=this.createContainer(e);this.createErrorIndicator(r);let n=pt.createElement(r,"div",{class:"mb-input-wrapper"});this.inputField?.mount(n);let i=this.getArguments("class");for(let a of i)pt.addClasses(n,a.value);pt.addClass(n,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType==="block"?pt.addClass(e,"mb-input-block"):pt.addClass(e,"mb-input-inline"),this.addShowcase(r)}onUnmount(e){super.onUnmount(e),this.inputField?.unmount(),Di(e,"input field")}};var Kj=ue("<div></div>");function Pu(t,e){Te(e,!0);let r,n;ga(()=>{n?.unmount(),n=e.mountable,n.mount(r)}),cf(()=>{n?.unmount()});var i=Kj();Uo(i,a=>r=a,()=>r),K(t,i),De()}var eZ=ue("<th> </th>"),tZ=ue("<td><!></td>"),rZ=ue('<td class="meta-bind-error">invalid data</td>'),nZ=ue('<tr><!><td class="mb-html-table-button-cell"><!></td></tr>'),iZ=ue('<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 M0(t,e){Te(e,!0);let r=ut(e,"tableHead",19,()=>[]),n=yt(Ve([]));function i(p){$e(n,Ve(p))}var a=iZ(),o=je(a),s=ye(o),l=ye(s),u=ye(l),c=ye(u);Yt(c,17,r,er,(p,d)=>{var h=eZ(),x=ye(h,!0);ce(h),Le(()=>xt(x,z(d))),K(p,h)}),Et(),ce(u),ce(l);var f=le(l);Yt(f,21,()=>z(n),p=>p.index,(p,d)=>{var h=nZ(),x=ye(h);{var b=w=>{var y=Gr(),E=je(y);Yt(E,17,()=>z(d).cells,er,(D,_)=>{var C=tZ(),N=ye(C);Pu(N,{get mountable(){return z(_)}}),ce(C),K(D,C)}),K(w,y)},T=w=>{var y=rZ();Le(()=>wt(y,"colspan",r().length)),K(w,y)};at(x,w=>{z(d).isValid?w(b):w(T,!1)})}var v=le(x),A=ye(v);bt(A,{onclick:()=>e.table.removeColumn(z(d).index),children:(w,y)=>{Wr(w,{get plugin(){return e.table.plugin},iconName:"x"})},$$slots:{default:!0}}),ce(v),ce(h),K(p,h)}),ce(f),ce(s),ce(o);var m=le(o,2);return bt(m,{onclick:()=>e.table.addColumn(),children:(p,d)=>{Et();var h=Wt("Add Row");K(p,h)},$$slots:{default:!0}}),K(t,a),De({updateTable:i})}function _g(t){return new bu(t.map(e=>hI.tryParse(e).success?new dl("array",e):new dl("object",e)))}var Ag=class extends qn{constructor(e,r,n,i,a,o){super(e,r,n),this.bindTarget=i,this.tableHead=a,this.columns=o,this.inputSignal=new yn(void 0),this.outputSignal=new yn(void 0),this.value=void 0}registerSelfToMetadataManager(){this.metadataManagerOutputSignalListener=this.outputSignal.registerListener({callback:this.updateMetadataManager.bind(this)}),this.metadataSubscription=this.plugin.metadataManager.subscribe(this.getUuid(),this.inputSignal,this.bindTarget,()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataManagerOutputSignalListener&&this.outputSignal.unregisterListener(this.metadataManagerOutputSignalListener),this.metadataSubscription?.unsubscribe()}updateMetadataManager(e){this.metadataSubscription?.write(e)}updateDisplayValue(e){e=e??[];let r=[];for(let n=0;n<e.length;n++)if(typeof e[n]=="object"){let i=new Uc({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(_g([n.toString()])),storagePath:this.bindTarget.storagePath,listenToChildren:!1}),a=this.columns.map(o=>typeof o=="string"?this.plugin.api.createInlineFieldFromString(o,this.getFilePath(),i,"inline"):"inputFieldType"in o?this.plugin.api.createInputFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"}):this.plugin.api.createViewFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"}));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)}createCell(e,r){return e.mount(r),()=>e.unmount()}removeColumn(e){this.value=this.value??[],this.value.splice(e,1),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}addColumn(){this.value=this.value??[],this.value.push({}),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}onMount(e){super.onMount(e),this.tableComponent=Ur(M0,{target:e,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:r=>{this.value=r,this.updateDisplayValue(r)}}),this.registerSelfToMetadataManager()}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),this.tableComponent&&Pr(this.tableComponent),Di(e,"table")}};var Sg=class extends qn{constructor(e,r,n,i){super(e,r,n),this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new Qt(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 yn(void 0),uuid:Fr(),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.plugin.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.plugin.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),pt.addClass(e,"mb-view"),pt.empty(e),this.plugin.internal.isJsEngineAvailable()||this.errorCollection.add(new Fo({errorLevel:"ERROR",effect:"can not create js view field",cause:"The JS Engine plugin is not installed and enabled."})),this.plugin.settings.enableJs||this.errorCollection.add(new Fo({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");pt.addClass(r,"mb-view-wrapper"),this.jsRenderer=this.plugin.internal.createJsRenderer(r,this.getFilePath(),this.declaration.code,this.declaration.hidden),this.registerSelfToMetadataManager(),e.appendChild(r)}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),Di(e,"js view field")}};var fs=class extends Ni{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.variables=[],this.hidden=!1}async initialRender(e){pt.addClass(e,"mb-view-text"),this.hidden=this.mountable.getArgument("hidden")?.value??!1,this.hidden&&pt.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.plugin.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 aZ=ue('<div class="mb-image-card"><img class="mb-image-card-image"></div>');function C0(t,e){Te(e,!0);let r=ut(e,"internal",3,!0),n=Lt(()=>r()?e.plugin.internal.imagePathToUri(e.image):e.image);var i=aZ(),a=ye(i);ce(i),Le(()=>{wt(a,"src",z(n)),wt(a,"alt",e.image)}),K(t,i),De()}var oZ=ue("<span>No images</span>"),sZ=ue('<div class="mb-image-card-grid"></div>');function N0(t,e){Te(e,!0);let r=ut(e,"images",23,()=>[]);function n(a){console.warn("updating images"),r(a)}var i=sZ();return Yt(i,21,r,er,(a,o)=>{C0(a,{get plugin(){return e.plugin},get image(){return z(o).link},get internal(){return z(o).internal}})},a=>{var o=oZ();K(a,o)}),ce(i),K(t,i),De({updateImages:n})}var Eg=class extends fs{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(n=>typeof n=="string"?n:!0);if(e.length!==1)throw new Cs({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 Cs({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 yn(void 0),uuid:Fr(),contextName:"MB_VAR_0"},this.variables.push(this.linkVariable)}computeValue(){let e=this.linkVariable.metadataSignal.get();if(typeof e=="string"){let r=Cn.interpretAsLink(e);return r===void 0?void 0:[r]}else return Array.isArray(e)?e.filter(r=>typeof r=="string").map(r=>Cn.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=Ur(N0,{target:e,props:{images:[],plugin:this.mountable.plugin}})}async onRerender(e,r){this.component?.updateImages(Ad(r).map(n=>({link:n.target,internal:n.internal})))}onUnmount(){super.onUnmount(),this.component&&Pr(this.component)}};var uZ=ue("<span></span>");function F0(t,e){Te(e,!0);let r=ut(e,"mdLinkList",7);function n(l){r(l)}var i=Gr(),a=je(i);{var o=l=>{var u=uZ();K(l,u)},s=l=>{var u=Gr(),c=je(u);{var f=p=>{Zs(p,{get mdLink(){return r()[0]}})},m=p=>{Wp(p,{get elements(){return r()},children:(h,x=Ra)=>{Zs(h,{get mdLink(){return x()}})},$$slots:{default:!0}})};at(c,p=>{r().length===1?p(f):p(m,!1)},!0)}K(l,u)};at(a,l=>{r().length===0?l(o):l(s,!1)})}return K(t,i),De({updateList:n})}var Tg=class extends fs{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 Cs({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 Cs({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 yn(void 0),uuid:Fr(),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 Cs({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 yn(void 0),uuid:Fr(),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 yn(void 0),uuid:Fr(),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:Pl(this.aliasVariable.metadataSignal.get(),this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)}computeValue(){let e=this.linkVariable.metadataSignal.get(),r=this.getAlias();if(typeof e=="string"){let n=Cn.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=>Cn.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=Ur(F0,{target:e,props:{mdLinkList:[]}})}async onRerender(e,r){this.component?.updateList(Ad(r))}onUnmount(){super.onUnmount(),this.component&&Pr(this.component)}};function sn(){return sn=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},sn.apply(null,arguments)}var I0={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function nn(t,e){if(Yp(t,e))return t[e];throw typeof t[e]=="function"&&Dg(t,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function ps(t,e,r){if(Yp(t,e))return t[e]=r,r;throw new Error('No access to property "'+e+'"')}function Yp(t,e){return!lZ(t)&&!Array.isArray(t)?!1:ot(cZ,e)?!0:!(e in Object.prototype||e in Function.prototype)}function O2(t,e){if(!Dg(t,e))throw new Error('No access to method "'+e+'"');return t[e]}function Dg(t,e){return t==null||typeof t[e]!="function"||ot(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t)?!1:ot(fZ,e)?!0:!(e in Object.prototype||e in Function.prototype)}function lZ(t){return typeof t=="object"&&t&&t.constructor===Object}var cZ={length:!0,name:!0},fZ={toString:!0,valueOf:!0,toLocaleString:!0};var Bu=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 nn(this.wrappedObject,e)}set(e,r){return ps(this.wrappedObject,e,r),this}has(e){return Yp(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return R2(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){Yp(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}},pf=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 R2(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 R2(t,e){return{next:()=>{var r=t.next();return r.done?r:{value:e(r.value),done:!1}}}}function ku(){return new Map}function Js(t){if(!t)return ku();if(Mg(t))return t;if($u(t))return new Bu(t);throw new Error("createMap can create maps from objects or Maps")}function L2(t){if(t instanceof Bu)return t.wrappedObject;var e={};for(var r of t.keys()){var n=t.get(r);ps(e,r,n)}return e}function At(t){return typeof t=="number"}function ct(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 V2(t){return typeof t=="bigint"}function ra(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isComplex===!0||!1}function Xs(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isFraction===!0||!1}function bi(t){return t&&t.constructor.prototype.isUnit===!0||!1}function bn(t){return typeof t=="string"}var gr=Array.isArray;function rt(t){return t&&t.constructor.prototype.isMatrix===!0||!1}function Tn(t){return Array.isArray(t)||rt(t)}function ql(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function qo(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function mf(t){return t&&t.constructor.prototype.isRange===!0||!1}function Ou(t){return t&&t.constructor.prototype.isIndex===!0||!1}function U2(t){return typeof t=="boolean"}function q2(t){return t&&t.constructor.prototype.isResultSet===!0||!1}function Cg(t){return t&&t.constructor.prototype.isHelp===!0||!1}function z2(t){return typeof t=="function"}function H2(t){return t instanceof Date}function G2(t){return t instanceof RegExp}function $u(t){return!!(t&&typeof t=="object"&&t.constructor===Object&&!ra(t)&&!Xs(t))}function Mg(t){return t?t instanceof Map||t instanceof Bu||typeof t.set=="function"&&typeof t.get=="function"&&typeof t.keys=="function"&&typeof t.has=="function":!1}function W2(t){return t===null}function Y2(t){return t===void 0}function Ha(t){return t&&t.isAccessorNode===!0&&t.constructor.prototype.isNode===!0||!1}function wi(t){return t&&t.isArrayNode===!0&&t.constructor.prototype.isNode===!0||!1}function j2(t){return t&&t.isAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function Z2(t){return t&&t.isBlockNode===!0&&t.constructor.prototype.isNode===!0||!1}function J2(t){return t&&t.isConditionalNode===!0&&t.constructor.prototype.isNode===!0||!1}function zt(t){return t&&t.isConstantNode===!0&&t.constructor.prototype.isNode===!0||!1}function jp(t){return zt(t)||Qr(t)&&t.args.length===1&&zt(t.args[0])&&"-+~".includes(t.op)}function ms(t){return t&&t.isFunctionAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function na(t){return t&&t.isFunctionNode===!0&&t.constructor.prototype.isNode===!0||!1}function vo(t){return t&&t.isIndexNode===!0&&t.constructor.prototype.isNode===!0||!1}function nr(t){return t&&t.isNode===!0&&t.constructor.prototype.isNode===!0||!1}function Ru(t){return t&&t.isObjectNode===!0&&t.constructor.prototype.isNode===!0||!1}function Qr(t){return t&&t.isOperatorNode===!0&&t.constructor.prototype.isNode===!0||!1}function _i(t){return t&&t.isParenthesisNode===!0&&t.constructor.prototype.isNode===!0||!1}function X2(t){return t&&t.isRangeNode===!0&&t.constructor.prototype.isNode===!0||!1}function Q2(t){return t&&t.isRelationalNode===!0&&t.constructor.prototype.isNode===!0||!1}function Yr(t){return t&&t.isSymbolNode===!0&&t.constructor.prototype.isNode===!0||!1}function Ng(t){return t&&t.constructor.prototype.isChain===!0||!1}function cr(t){var e=typeof t;return e==="object"?t===null?"null":ct(t)?"BigNumber":t.constructor&&t.constructor.name?t.constructor.name:"Object":e}function gt(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 gt(r)});if(t instanceof Date)return new Date(t.valueOf());if(ct(t))return t;if($u(t))return pZ(t,gt);if(e==="function")return t;throw new TypeError("Cannot clone: unknown type of value (value: ".concat(t,")"))}function pZ(t,e){var r={};for(var n in t)ot(t,n)&&(r[n]=e(t[n]));return r}function Fg(t,e){for(var r in e)ot(e,r)&&(t[r]=e[r]);return t}function ba(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(!ba(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)||!ba(t[r],e[r]))return!1;for(r in e)if(!(r in t))return!1;return!0}else return t===e}}function K2(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 ot(t,e){return t&&Object.hasOwnProperty.call(t,e)}function eP(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 tP=["Matrix","Array"],rP=["number","BigNumber","Fraction"];var Ie=function(e){if(e)throw new Error(`The global config is readonly.
Please create a mathjs instance if you want to change the default configuration.
Example:
import { create, all } from 'mathjs';
const mathjs = create(all);
mathjs.config({ number: 'BigNumber' });
`);return Object.freeze(I0)};sn(Ie,I0,{MATRIX_OPTIONS:tP,NUMBER_OPTIONS:rP});var L0=zr(k0(),1);function M(t,e,r,n){function i(a){var o=eP(a,e.map(hZ));return mZ(t,e,a),r(o)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function mZ(t,e,r){var n=e.filter(a=>!dZ(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 dZ(t){return t&&t[0]==="?"}function hZ(t){return t&&t[0]==="?"?t.slice(1):t}function Qe(t){return typeof t=="boolean"?!0:isFinite(t)?t===Math.round(t):!1}function gZ(t){return/^-?\d+$/.test(t)}function Bi(t,e){return e.number==="bigint"&&!gZ(t)?e.numberFallback:e.number}var yo=Math.sign||function(t){return t>0?1:t<0?-1:0},aP=Math.log2||function(e){return Math.log(e)/Math.LN2},oP=Math.log10||function(e){return Math.log(e)/Math.LN10},Ig=Math.log1p||function(t){return Math.log(t+1)},sP=Math.cbrt||function(e){if(e===0)return e;var r=e<0,n;return r&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,r?-n:n},uP=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function $0(t,e,r){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!Qe(r))throw new Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!Qe(t))throw new Error("Value must be an integer");t<0&&(t=t+2**r),a="i".concat(r)}var o="";return t<0&&(t=-t,o="-"),"".concat(o).concat(i).concat(t.toString(e)).concat(a)}function zo(t,e){if(typeof e=="function")return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:r,precision:n,wordSize:i}=O0(e);switch(r){case"fixed":return R0(t,n);case"exponential":return lP(t,n);case"engineering":return vZ(t,n);case"bin":return $0(t,2,i);case"oct":return $0(t,8,i);case"hex":return $0(t,16,i);case"auto":return yZ(t,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function O0(t){var e="auto",r,n;if(t!==void 0)if(At(t))r=t;else if(ct(t))r=t.toNumber();else if($u(t))t.precision!==void 0&&(r=nP(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),t.wordSize!==void 0&&(n=nP(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(e=t.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:r,wordSize:n}}function hf(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 vZ(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=hf(t),n=Pg(r,e),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(At(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var s=Math.abs(i-o)-(a.length-1),l=0;l<s;l++)a.push(0);for(var u=Math.abs(i-o),c=1;u>0;)c++,u--;var f=a.slice(c).join(""),m=At(e)&&f.length||f.match(/[1-9]/)?"."+f:"",p=a.slice(0,c).join("")+m+"e"+(i>=0?"+":"")+o.toString();return n.sign+p}function R0(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=hf(t),n=typeof e=="number"?Pg(r,r.exponent+1+e):r,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(df(o-i.length))),a<0&&(i=df(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function lP(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=hf(t),n=e?Pg(r,e):r,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(df(e-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function yZ(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=iP(r?.lowerExp,-3),i=iP(r?.upperExp,5),a=hf(t),o=e?Pg(a,e):a;if(o.exponent<n||o.exponent>=i)return lP(t,e);var s=o.coefficients,l=o.exponent;s.length<e&&(s=s.concat(df(e-s.length))),s=s.concat(df(l-s.length+1+(s.length<e?e-s.length:0))),s=df(-l).concat(s);var u=l>0?l:0;return u<s.length-1&&s.splice(u+1,0,"."),o.sign+s.join("")}function Pg(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 df(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}function cP(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var ODe=Number.EPSILON||2220446049250313e-31;function Kr(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 fP=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},pP=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},mP=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},Bg=Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))/2},dP=Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2},kg=Math.tanh||function(t){var e=Math.exp(2*t);return(e-1)/(e+1)};function hP(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 nP(t,e){if(At(t))return t;if(ct(t))return t.toNumber();e()}function iP(t,e){return At(t)?t:ct(t)?t.toNumber():e}var gP=function(){return gP=L0.default.create,L0.default},xZ=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],V0=M("typed",xZ,function(e){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=e,o=gP();return o.clear(),o.addTypes([{name:"number",test:At},{name:"Complex",test:ra},{name:"BigNumber",test:ct},{name:"bigint",test:V2},{name:"Fraction",test:Xs},{name:"Unit",test:bi},{name:"identifier",test:s=>bn&&/^(?:[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:bn},{name:"Chain",test:Ng},{name:"Array",test:gr},{name:"Matrix",test:rt},{name:"DenseMatrix",test:ql},{name:"SparseMatrix",test:qo},{name:"Range",test:mf},{name:"Index",test:Ou},{name:"boolean",test:U2},{name:"ResultSet",test:q2},{name:"Help",test:Cg},{name:"function",test:z2},{name:"Date",test:H2},{name:"RegExp",test:G2},{name:"null",test:W2},{name:"undefined",test:Y2},{name:"AccessorNode",test:Ha},{name:"ArrayNode",test:wi},{name:"AssignmentNode",test:j2},{name:"BlockNode",test:Z2},{name:"ConditionalNode",test:J2},{name:"ConstantNode",test:zt},{name:"FunctionNode",test:na},{name:"FunctionAssignmentNode",test:ms},{name:"IndexNode",test:vo},{name:"Node",test:nr},{name:"ObjectNode",test:Ru},{name:"OperatorNode",test:Qr},{name:"ParenthesisNode",test:_i},{name:"RangeNode",test:X2},{name:"RelationalNode",test:Q2},{name:"SymbolNode",test:Yr},{name:"Map",test:Mg},{name:"Object",test:$u}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(r||$g(l),cP(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||Og(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||Og(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||$g(l),new r(l.toString())}},{from:"bigint",to:"Fraction",convert:function(l){return a||Rg(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||Og(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){a||Rg(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||$g(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||Rg(l);try{return new a(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||Og(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||$g(l),new r(+l)}},{from:"boolean",to:"bigint",convert:function(l){return BigInt(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return a||Rg(l),new a(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||bZ(),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&&Tn(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&&Tn(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 $g(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function Og(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function bZ(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Rg(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var wZ="ResultSet",_Z=[],U0=M(wZ,_Z,()=>{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 gf=9e15,qu=1e9,q0="0123456789abcdef",Vg="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ug="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",z0={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-gf,maxE:gf,crypto:!1},bP,Qs,ir=!0,zg="[DecimalError] ",Uu=zg+"Invalid argument: ",wP=zg+"Precision limit exceeded",_P=zg+"crypto unavailable",AP="[object Decimal]",ki=Math.floor,ti=Math.pow,AZ=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,SZ=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,EZ=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,SP=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Go=1e7,Vt=7,TZ=9007199254740991,DZ=Vg.length-1,H0=Ug.length-1,Re={toStringTag:AP};Re.absoluteValue=Re.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ft(t)};Re.ceil=function(){return Ft(new this.constructor(this),this.e+1,2)};Re.clampedTo=Re.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(Uu+e);return r=n.cmp(t),r<0?t:n.cmp(e)>0?e:new i(n)};Re.comparedTo=Re.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};Re.cosine=Re.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())+Vt,n.rounding=1,r=MZ(n,CP(n,r)),n.precision=t,n.rounding=e,Ft(Qs==2||Qs==3?r.neg():r,t,e,!0)):new n(1):new n(NaN)};Re.cubeRoot=Re.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(ir=!1,a=c.s*ti(c.s*c,1/3),!a||Math.abs(a)==1/0?(r=Ai(c.d),t=c.e,(a=(t-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=ti(r,1/3),t=ki((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=an(u.plus(c).times(s),u.plus(l),o+2,1),Ai(s.d).slice(0,o)===(r=Ai(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ft(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")&&(Ft(n,t+1,1),e=!n.times(n).times(n).eq(c));break}return ir=!0,Ft(n,t,f.rounding,e)};Re.decimalPlaces=Re.dp=function(){var t,e=this.d,r=NaN;if(e){if(t=e.length-1,r=(t-ki(this.e/Vt))*Vt,t=e[t],t)for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r};Re.dividedBy=Re.div=function(t){return an(this,new this.constructor(t))};Re.dividedToIntegerBy=Re.divToInt=function(t){var e=this,r=e.constructor;return Ft(an(e,new r(t),0,1,1),r.precision,r.rounding)};Re.equals=Re.eq=function(t){return this.cmp(t)===0};Re.floor=function(){return Ft(new this.constructor(this),this.e+1,3)};Re.greaterThan=Re.gt=function(t){return this.cmp(t)>0};Re.greaterThanOrEqualTo=Re.gte=function(t){var e=this.cmp(t);return e==1||e===0};Re.hyperbolicCosine=Re.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/Gg(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),a=vf(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 Ft(a,o.precision=r,o.rounding=n,!0)};Re.hyperbolicSine=Re.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=vf(a,2,i,i,!0);else{t=1.4*Math.sqrt(n),t=t>16?16:t|0,i=i.times(1/Gg(5,t)),i=vf(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,Ft(i,e,r,!0)};Re.hyperbolicTangent=Re.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,an(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)};Re.inverseCosine=Re.acos=function(){var t,e=this,r=e.constructor,n=e.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?n===0?e.isNeg()?Ho(r,i,a):new r(0):new r(NaN):e.isZero()?Ho(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,e=e.asin(),t=Ho(r,i+4,a).times(.5),r.precision=i,r.rounding=a,t.minus(e))};Re.inverseHyperbolicCosine=Re.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,ir=!1,r=r.times(r).minus(1).sqrt().plus(r),ir=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)};Re.inverseHyperbolicSine=Re.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,ir=!1,r=r.times(r).plus(1).sqrt().plus(r),ir=!0,n.precision=t,n.rounding=e,r.ln())};Re.inverseHyperbolicTangent=Re.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?Ft(new a(i),t,e,!0):(a.precision=r=n-i.e,i=an(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)};Re.inverseSine=Re.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=Ho(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)))};Re.inverseTangent=Re.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<=H0)return o=Ho(c,f+4,m).times(.25),o.s=u.s,o}else{if(!u.s)return new c(NaN);if(f+4<=H0)return o=Ho(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/Vt+2|0),t=r;t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ir=!1,e=Math.ceil(s/Vt),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)),ir=!0,Ft(o,c.precision=f,c.rounding=m,!0)};Re.isFinite=function(){return!!this.d};Re.isInteger=Re.isInt=function(){return!!this.d&&ki(this.e/Vt)>this.d.length-2};Re.isNaN=function(){return!this.s};Re.isNegative=Re.isNeg=function(){return this.s<0};Re.isPositive=Re.isPos=function(){return this.s>0};Re.isZero=function(){return!!this.d&&this.d[0]===0};Re.lessThan=Re.lt=function(t){return this.cmp(t)<0};Re.lessThanOrEqualTo=Re.lte=function(t){return this.cmp(t)<1};Re.logarithm=Re.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(ir=!1,s=f+p,o=Vu(u,s),n=e?qg(c,s+10):Vu(t,s),l=an(o,n,s,1),Zp(l.d,i=f,m))do if(s+=10,o=Vu(u,s),n=e?qg(c,s+10):Vu(t,s),l=an(o,n,s,1),!a){+Ai(l.d).slice(i+1,i+15)+1==1e14&&(l=Ft(l,f+1,0));break}while(Zp(l.d,i+=10,m));return ir=!0,Ft(l,f,m)};Re.minus=Re.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 ir?Ft(t,s,l):t}if(r=ki(t.e/Vt),c=ki(p.e/Vt),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/Vt),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]=Go-1;--u[i],u[n]+=Go}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=Hg(u,r),ir?Ft(t,s,l):t):new d(l===3?-0:0)};Re.modulo=Re.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]?Ft(new n(r),n.precision,n.rounding):(ir=!1,n.modulo==9?(e=an(r,t.abs(),0,3,1),e.s*=t.s):e=an(r,t,0,n.modulo,1),e=e.times(t),ir=!0,r.minus(e))};Re.naturalExponential=Re.exp=function(){return G0(this)};Re.naturalLogarithm=Re.ln=function(){return Vu(this)};Re.negated=Re.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ft(t)};Re.plus=Re.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)),ir?Ft(t,s,l):t;if(a=ki(f.e/Vt),n=ki(t.e/Vt),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/Vt),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)/Go|0,u[i]%=Go;for(e&&(u.unshift(e),++n),o=u.length;u[--o]==0;)u.pop();return t.d=u,t.e=Hg(u,n),ir?Ft(t,s,l):t};Re.precision=Re.sd=function(t){var e,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Uu+t);return r.d?(e=EP(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e};Re.round=function(){var t=this,e=t.constructor;return Ft(new e(t),t.e+1,e.rounding)};Re.sine=Re.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())+Vt,n.rounding=1,r=NZ(n,CP(n,r)),n.precision=t,n.rounding=e,Ft(Qs>2?r.neg():r,t,e,!0)):new n(NaN)};Re.squareRoot=Re.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(ir=!1,u=Math.sqrt(+o),u==0||u==1/0?(e=Ai(s),(e.length+l)%2==0&&(e+="0"),u=Math.sqrt(e),l=ki((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(an(o,a,r+2,1)).times(.5),Ai(a.d).slice(0,r)===(e=Ai(n.d)).slice(0,r))if(e=e.slice(r-3,r+1),e=="9999"||!i&&e=="4999"){if(!i&&(Ft(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")&&(Ft(n,l+1,1),t=!n.times(n).eq(o));break}return ir=!0,Ft(n,l,c.rounding,t)};Re.tangent=Re.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=an(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Ft(Qs==2||Qs==4?r.neg():r,t,e,!0)):new n(NaN)};Re.times=Re.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=ki(c.e/Vt)+ki(t.e/Vt),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%Go|0,e=s/Go|0;a[i]=(a[i]+e)%Go|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=Hg(a,r),ir?Ft(t,f.precision,f.rounding):t};Re.toBinary=function(t,e){return Y0(this,2,t,e)};Re.toDecimalPlaces=Re.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(wa(t,0,qu),e===void 0?e=n.rounding:wa(e,0,8),Ft(r,t+r.e+1,e))};Re.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ds(n,!0):(wa(t,0,qu),e===void 0?e=i.rounding:wa(e,0,8),n=Ft(new i(n),t+1,e),r=ds(n,!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r};Re.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?r=ds(i):(wa(t,0,qu),e===void 0?e=a.rounding:wa(e,0,8),n=Ft(new a(i),t+i.e+1,e),r=ds(n,!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};Re.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=EP(d)-p.e-1,o=a%Vt,e.d[0]=ti(10,o<0?Vt+o:o),t==null)t=a>0?e:u;else{if(s=new h(t),!s.isInt()||s.lt(u))throw Error(Uu+s);t=s.gt(e)?a>0?e:u:s}for(ir=!1,s=new h(Ai(d)),c=h.precision,h.precision=a=d.length*Vt*2;f=an(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=an(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=an(u,n,a,1).minus(p).abs().cmp(an(l,r,a,1).minus(p).abs())<1?[u,n]:[l,r],h.precision=c,ir=!0,m};Re.toHexadecimal=Re.toHex=function(t,e){return Y0(this,16,t,e)};Re.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:wa(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]?(ir=!1,r=an(r,t,0,e,1).times(t),ir=!0,Ft(r)):(t.s=r.s,r=t),r};Re.toNumber=function(){return+this};Re.toOctal=function(t,e){return Y0(this,8,t,e)};Re.toPower=Re.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(ti(+s,u));if(s=new l(s),s.eq(1))return s;if(n=l.precision,a=l.rounding,t.eq(1))return Ft(s,n,a);if(e=ki(t.e/Vt),e>=t.d.length-1&&(r=u<0?-u:u)<=TZ)return i=TP(l,s,r,n),t.s<0?new l(1).div(i):Ft(i,n,a);if(o=s.s,o<0){if(e<t.d.length-1)return new l(NaN);if(t.d[e]&1||(o=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=o,s}return r=ti(+s,u),e=r==0||!isFinite(r)?ki(u*(Math.log("0."+Ai(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):(ir=!1,l.rounding=s.s=1,r=Math.min(12,(e+"").length),i=G0(t.times(Vu(s,n+r)),n),i.d&&(i=Ft(i,n+5,1),Zp(i.d,n,a)&&(e=n+10,i=Ft(G0(t.times(Vu(s,e+r)),e),e+5,1),+Ai(i.d).slice(n+1,n+15)+1==1e14&&(i=Ft(i,n+1,0)))),i.s=o,ir=!0,l.rounding=a,Ft(i,n,a))};Re.toPrecision=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ds(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(wa(t,1,qu),e===void 0?e=i.rounding:wa(e,0,8),n=Ft(new i(n),t,e),r=ds(n,t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r};Re.toSignificantDigits=Re.toSD=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(wa(t,1,qu),e===void 0?e=n.rounding:wa(e,0,8)),Ft(new n(r),t,e)};Re.toString=function(){var t=this,e=t.constructor,r=ds(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};Re.truncated=Re.trunc=function(){return Ft(new this.constructor(this),this.e+1,1)};Re.valueOf=Re.toJSON=function(){var t=this,e=t.constructor,r=ds(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};function Ai(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=Vt-n.length,r&&(a+=Lu(r)),a+=n;o=t[e],n=o+"",r=Vt-n.length,r&&(a+=Lu(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function wa(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Uu+t)}function Zp(t,e,r,n){var i,a,o,s;for(a=t[0];a>=10;a/=10)--e;return--e<0?(e+=Vt,i=0):(i=Math.ceil((e+1)/Vt),e%=Vt),a=ti(10,Vt-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)==ti(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)==ti(10,e-3)-1,o}function Lg(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]+=q0.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 MZ(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?(r=Math.ceil(n/3),i=(1/Gg(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=vf(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 an=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,x,b,T,v,A,w,y,E,D,_,C,N,P,R=n.constructor,L=n.s==i.s?1:-1,V=n.d,k=i.d;if(!V||!V[0]||!k||!k[0])return new R(!n.s||!i.s||(V?k&&V[0]==k[0]:!k)?NaN:V&&V[0]==0||!k?L*0:L/0);for(l?(p=1,c=n.e-i.e):(l=Go,p=Vt,c=ki(n.e/p)-ki(i.e/p)),N=k.length,_=V.length,b=new R(L),T=b.d=[],f=0;k[f]==(V[f]||0);f++);if(k[f]>(V[f]||0)&&c--,a==null?(y=a=R.precision,o=R.rounding):s?y=a+(n.e-i.e)+1:y=a,y<0)T.push(1),d=!0;else{if(y=y/p+2|0,f=0,N==1){for(m=0,k=k[0],y++;(f<_||m)&&y--;f++)E=m*l+(V[f]||0),T[f]=E/k|0,m=E%k|0;d=m||f<_}else{for(m=l/(k[0]+1)|0,m>1&&(k=t(k,m,l),V=t(V,m,l),N=k.length,_=V.length),D=N,v=V.slice(0,N),A=v.length;A<N;)v[A++]=0;P=k.slice(),P.unshift(0),C=k[0],k[1]>=l/2&&++C;do m=0,u=e(k,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(k,m,l),x=h.length,A=v.length,u=e(h,v,x,A),u==1&&(m--,r(h,N<x?P:k,x,l))):(m==0&&(u=m=1),h=k.slice()),x=h.length,x<A&&h.unshift(0),r(v,h,A,l),u==-1&&(A=v.length,u=e(k,v,N,A),u<1&&(m++,r(v,N<A?P:k,A,l))),A=v.length):u===0&&(m++,v=[0]),T[f++]=m,u&&v[0]?v[A++]=V[D]||0:(v=[V[D]],A=1);while((D++<_||v[0]!==void 0)&&y--);d=v[0]!==void 0}T[0]||T.shift()}if(p==1)b.e=c,bP=d;else{for(f=1,m=T[0];m>=10;m/=10)f++;b.e=f+c*p-1,Ft(b,s?a+b.e+1:a,o,d)}return b}}();function Ft(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+=Vt,o=e,c=f[m=0],l=c/ti(10,i-o-1)%10|0;else if(m=Math.ceil((a+1)/Vt),s=f.length,m>=s)if(n){for(;s++<=m;)f.push(0);c=l=0,i=1,a%=Vt,o=a-Vt+1}else break e;else{for(c=s=f[m],i=1;s>=10;s/=10)i++;a%=Vt,o=a-Vt+i,l=o<0?0:c/ti(10,i-o-1)%10|0}if(n=n||e<0||f[m+1]!==void 0||(o<0?c:c%ti(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/ti(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]=ti(10,(Vt-e%Vt)%Vt),t.e=-e||0):f[0]=t.e=0,t;if(a==0?(f.length=m,s=1,m--):(f.length=m+1,s=ti(10,Vt-a),f[m]=o>0?(c/ti(10,i-o)%ti(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]==Go&&(f[0]=1));break}else{if(f[m]+=s,f[m]!=Go)break;f[m--]=0,s=1}for(a=f.length;f[--a]===0;)f.pop()}return ir&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function ds(t,e,r){if(!t.isFinite())return MP(t);var n,i=t.e,a=Ai(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+Lu(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(t.e<0?"e":"e+")+t.e):i<0?(a="0."+Lu(-i-1)+a,r&&(n=r-o)>0&&(a+=Lu(n))):i>=o?(a+=Lu(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+Lu(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=Lu(n))),a}function Hg(t,e){var r=t[0];for(e*=Vt;r>=10;r/=10)e++;return e}function qg(t,e,r){if(e>DZ)throw ir=!0,r&&(t.precision=r),Error(wP);return Ft(new t(Vg),e,1,!0)}function Ho(t,e,r){if(e>H0)throw Error(wP);return Ft(new t(Ug),e,r,!0)}function EP(t){var e=t.length-1,r=e*Vt+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 Lu(t){for(var e="";t--;)e+="0";return e}function TP(t,e,r,n){var i,a=new t(1),o=Math.ceil(n/Vt+4);for(ir=!1;;){if(r%2&&(a=a.times(e),yP(a.d,o)&&(i=!0)),r=ki(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}e=e.times(e),yP(e.d,o)}return ir=!0,a}function vP(t){return t.d[t.d.length-1]&1}function DP(t,e,r){for(var n,i=new t(e[0]),a=0;++a<e.length;)if(n=new t(e[a]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function G0(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?(ir=!1,l=d):l=e,s=new m(.03125);t.e>-2;)t=t.times(s),f+=5;for(n=Math.log(ti(2,f))/Math.LN10*2+5|0,l+=n,r=a=o=new m(1),m.precision=l;;){if(a=Ft(a.times(t),l,1),r=r.times(++c),s=o.plus(an(a,r,l,1)),Ai(s.d).slice(0,l)===Ai(o.d).slice(0,l)){for(i=f;i--;)o=Ft(o.times(o),l,1);if(e==null)if(u<3&&Zp(o.d,l-n,p,u))m.precision=l+=10,r=a=s=new m(1),c=0,u++;else return Ft(o,m.precision=d,p,ir=!0);else return m.precision=d,o}o=s}}function Vu(t,e){var r,n,i,a,o,s,l,u,c,f,m,p=1,d=10,h=t,x=h.d,b=h.constructor,T=b.rounding,v=b.precision;if(h.s<0||!x||!x[0]||!h.e&&x[0]==1&&x.length==1)return new b(x&&!x[0]?-1/0:h.s!=1?NaN:x?0:h);if(e==null?(ir=!1,c=v):c=e,b.precision=c+=d,r=Ai(x),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=Ai(h.d),n=r.charAt(0),p++;a=h.e,n>1?(h=new b("0."+r),a++):h=new b(n+"."+r.slice(1))}else return u=qg(b,c+2,v).times(a+""),h=Vu(new b(n+"."+r.slice(1)),c-d).plus(u),b.precision=v,e==null?Ft(h,v,T,ir=!0):h;for(f=h,l=o=h=an(h.minus(1),h.plus(1),c,1),m=Ft(h.times(h),c,1),i=3;;){if(o=Ft(o.times(m),c,1),u=l.plus(an(o,new b(i),c,1)),Ai(u.d).slice(0,c)===Ai(l.d).slice(0,c))if(l=l.times(2),a!==0&&(l=l.plus(qg(b,c+2,v).times(a+""))),l=an(l,new b(p),c,1),e==null)if(Zp(l.d,c-d,T,s))b.precision=c+=d,u=o=h=an(f.minus(1),f.plus(1),c,1),m=Ft(h.times(h),c,1),i=s=1;else return Ft(l,b.precision=v,T,ir=!0);else return b.precision=v,l;l=u,i+=2}}function MP(t){return String(t.s*t.s/0)}function W0(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)%Vt,r<0&&(n+=Vt),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=Vt;n<i;)t.d.push(+e.slice(n,n+=Vt));e=e.slice(n),n=Vt-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),ir&&(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 CZ(t,e){var r,n,i,a,o,s,l,u,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),SP.test(e))return W0(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(SZ.test(e))r=16,e=e.toLowerCase();else if(AZ.test(e))r=2;else if(EZ.test(e))r=8;else throw Error(Uu+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=TP(n,new n(r),a,a*2)),u=Lg(e,r,Go),c=u.length-1,a=c;u[a]===0;--a)u.pop();return a<0?new n(t.s*0):(t.e=Hg(u,c),t.d=u,ir=!1,o&&(t=an(t,i,s*4)),l&&(t=t.times(Math.abs(l)<54?ti(2,l):Jp.pow(2,l))),ir=!0,t)}function NZ(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:vf(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:r|0,e=e.times(1/Gg(5,r)),e=vf(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 vf(t,e,r,n,i){var a,o,s,l,u=1,c=t.precision,f=Math.ceil(c/Vt);for(ir=!1,l=r.times(r),s=new t(n);;){if(o=an(s.times(l),new t(e++*e++),c,1),s=i?n.plus(o):n.minus(o),n=an(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 ir=!0,o.d.length=f+1,o}function Gg(t,e){for(var r=t;--e;)r*=t;return r}function CP(t,e){var r,n=e.s<0,i=Ho(t,t.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return Qs=n?4:1,e;if(r=e.divToInt(i),r.isZero())Qs=n?3:2;else{if(e=e.minus(r.times(i)),e.lte(a))return Qs=vP(r)?n?2:3:n?4:1,e;Qs=vP(r)?n?1:4:n?3:2}return e.minus(i).abs()}function Y0(t,e,r,n){var i,a,o,s,l,u,c,f,m,p=t.constructor,d=r!==void 0;if(d?(wa(r,1,qu),n===void 0?n=p.rounding:wa(n,0,8)):(r=p.precision,n=p.rounding),!t.isFinite())c=MP(t);else{for(c=ds(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=Lg(ds(m),10,i),m.e=m.d.length),f=Lg(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=an(t,m,r,n,0,i),f=t.d,a=t.e,u=bP),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+=q0.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=Lg(c,i,e),l=f.length;!f[l-1];--l);for(o=1,c="1.";o<l;o++)c+=q0.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 yP(t,e){if(t.length>e)return t.length=e,!0}function FZ(t){return new this(t).abs()}function IZ(t){return new this(t).acos()}function PZ(t){return new this(t).acosh()}function BZ(t,e){return new this(t).plus(e)}function kZ(t){return new this(t).asin()}function $Z(t){return new this(t).asinh()}function OZ(t){return new this(t).atan()}function RZ(t){return new this(t).atanh()}function LZ(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=Ho(this,a,1).times(e.s>0?.25:.75),r.s=t.s):!e.d||t.isZero()?(r=e.s<0?Ho(this,n,i):new this(0),r.s=t.s):!t.d||e.isZero()?(r=Ho(this,a,1).times(.5),r.s=t.s):e.s<0?(this.precision=a,this.rounding=1,r=this.atan(an(t,e,a,1)),e=Ho(this,a,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(an(t,e,a,1)),r}function VZ(t){return new this(t).cbrt()}function UZ(t){return Ft(t=new this(t),t.e+1,2)}function qZ(t,e,r){return new this(t).clamp(e,r)}function zZ(t){if(!t||typeof t!="object")throw Error(zg+"Object expected");var e,r,n,i=t.defaults===!0,a=["precision",1,qu,"rounding",0,8,"toExpNeg",-gf,0,"toExpPos",0,gf,"maxE",0,gf,"minE",-gf,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(r=a[e],i&&(this[r]=z0[r]),(n=t[r])!==void 0)if(ki(n)===n&&n>=a[e+1]&&n<=a[e+2])this[r]=n;else throw Error(Uu+r+": "+n);if(r="crypto",i&&(this[r]=z0[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(_P);else this[r]=!1;else throw Error(Uu+r+": "+n);return this}function HZ(t){return new this(t).cos()}function GZ(t){return new this(t).cosh()}function NP(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,xP(a)){u.s=a.s,ir?!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++;ir?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}else if(a*0!==0){a||(u.s=NaN),u.e=NaN,u.d=null;return}return W0(u,a.toString())}else if(l!=="string")throw Error(Uu+a);return(s=a.charCodeAt(0))===45?(a=a.slice(1),u.s=-1):(s===43&&(a=a.slice(1)),u.s=1),SP.test(a)?W0(u,a):CZ(u,a)}if(i.prototype=Re,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=zZ,i.clone=NP,i.isDecimal=xP,i.abs=FZ,i.acos=IZ,i.acosh=PZ,i.add=BZ,i.asin=kZ,i.asinh=$Z,i.atan=OZ,i.atanh=RZ,i.atan2=LZ,i.cbrt=VZ,i.ceil=UZ,i.clamp=qZ,i.cos=HZ,i.cosh=GZ,i.div=WZ,i.exp=YZ,i.floor=jZ,i.hypot=ZZ,i.ln=JZ,i.log=XZ,i.log10=KZ,i.log2=QZ,i.max=eJ,i.min=tJ,i.mod=rJ,i.mul=nJ,i.pow=iJ,i.random=aJ,i.round=oJ,i.sign=sJ,i.sin=uJ,i.sinh=lJ,i.sqrt=cJ,i.sub=fJ,i.sum=pJ,i.tan=mJ,i.tanh=dJ,i.trunc=hJ,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 WZ(t,e){return new this(t).div(e)}function YZ(t){return new this(t).exp()}function jZ(t){return Ft(t=new this(t),t.e+1,3)}function ZZ(){var t,e,r=new this(0);for(ir=!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 ir=!0,new this(1/0);r=e}return ir=!0,r.sqrt()}function xP(t){return t instanceof Jp||t&&t.toStringTag===AP||!1}function JZ(t){return new this(t).ln()}function XZ(t,e){return new this(t).log(e)}function QZ(t){return new this(t).log(2)}function KZ(t){return new this(t).log(10)}function eJ(){return DP(this,arguments,"lt")}function tJ(){return DP(this,arguments,"gt")}function rJ(t,e){return new this(t).mod(e)}function nJ(t,e){return new this(t).mul(e)}function iJ(t,e){return new this(t).pow(e)}function aJ(t){var e,r,n,i,a=0,o=new this(1),s=[];if(t===void 0?t=this.precision:wa(t,1,qu),n=Math.ceil(t/Vt),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(_P);else for(;a<n;)s[a++]=Math.random()*1e7|0;for(n=s[--a],t%=Vt,n&&t&&(i=ti(10,Vt-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-=Vt)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<Vt&&(r-=Vt-n)}return o.e=r,o.d=s,o}function oJ(t){return Ft(t=new this(t),t.e+1,this.rounding)}function sJ(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function uJ(t){return new this(t).sin()}function lJ(t){return new this(t).sinh()}function cJ(t){return new this(t).sqrt()}function fJ(t,e){return new this(t).sub(e)}function pJ(){var t=0,e=arguments,r=new this(e[t]);for(ir=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return ir=!0,Ft(r,this.precision,this.rounding)}function mJ(t){return new this(t).tan()}function dJ(t){return new this(t).tanh()}function hJ(t){return Ft(t=new this(t),t.e+1,1)}Re[Symbol.for("nodejs.util.inspect.custom")]=Re.toString;Re[Symbol.toStringTag]="Decimal";var Jp=Re.constructor=NP(z0);Vg=new Jp(Vg);Ug=new Jp(Ug);var zl=Jp;var gJ="BigNumber",vJ=["?on","config"],j0=M(gJ,vJ,t=>{var{on:e,config:r}=t,n=zl.clone({precision:r.precision,modulo:zl.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},xo=Math.sinh||function(t){return Math.abs(t)<1e-9?t:(Math.exp(t)-Math.exp(-t))*.5},yJ=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)},Z0=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))},yf=function(){throw SyntaxError("Invalid Param")};function J0(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 xJ={re:0,im:0},Hl=function(t,e){let r=xJ;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 Pe.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 Pe.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]):yf();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&&yf();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&&yf(),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))&&yf(),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&&yf();break;case"number":r.im=0,r.re=t;break;default:yf()}return isNaN(r.re)||isNaN(r.im),r};function Pe(t,e){if(!(this instanceof Pe))return new Pe(t,e);let r=Hl(t,e);this.re=r.re,this.im=r.im}Pe.prototype={re:0,im:0,sign:function(){let t=Z0(this.re,this.im);return new Pe(this.re/t,this.im/t)},add:function(t,e){let r=Hl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pe.NAN:Pe.INFINITY:new Pe(this.re+r.re,this.im+r.im)},sub:function(t,e){let r=Hl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pe.NAN:Pe.INFINITY:new Pe(this.re-r.re,this.im-r.im)},mul:function(t,e){let r=Hl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;return n&&o||i&&a?Pe.NAN:n||i?Pe.INFINITY:r.im===0&&this.im===0?new Pe(this.re*r.re,0):new Pe(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){let r=Hl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;if(a&&o||n&&i)return Pe.NAN;if(o||n)return Pe.INFINITY;if(a||i)return Pe.ZERO;if(r.im===0)return new Pe(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let s=r.re/r.im,l=r.re*s+r.im;return new Pe((this.re*s+this.im)/l,(this.im*s-this.re)/l)}else{let s=r.im/r.re,l=r.im*s+r.re;return new Pe((this.re+this.im*s)/l,(this.im-this.re*s)/l)}},pow:function(t,e){let r=Hl(t,e),n=this.re===0&&this.im===0;if(r.re===0&&r.im===0)return Pe.ONE;if(r.im===0){if(this.im===0&&this.re>0)return new Pe(Math.pow(this.re,r.re),0);if(this.re===0)switch((r.re%4+4)%4){case 0:return new Pe(Math.pow(this.im,r.re),0);case 1:return new Pe(0,Math.pow(this.im,r.re));case 2:return new Pe(-Math.pow(this.im,r.re),0);case 3:return new Pe(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return Pe.ZERO;let a=Math.atan2(this.im,this.re),o=J0(this.re,this.im),s=Math.exp(r.re*o-r.im*a),l=r.im*o+r.re*a;return new Pe(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){let t=this.re,e=this.im;if(e===0)return t>=0?new Pe(Math.sqrt(t),0):new Pe(0,Math.sqrt(-t));let r=Z0(t,e),n=Math.sqrt(.5*(r+Math.abs(t))),i=Math.abs(e)/(2*n);return t>=0?new Pe(n,e<0?-i:i):new Pe(i,e<0?-n:n)},exp:function(){let t=Math.exp(this.re);return this.im===0?new Pe(t,0):new Pe(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t=this.re,e=this.im;return new Pe(Math.expm1(t)*Math.cos(e)+yJ(e),Math.exp(t)*Math.sin(e))},log:function(){let t=this.re,e=this.im;return e===0&&t>0?new Pe(Math.log(t),0):new Pe(J0(t,e),Math.atan2(e,t))},abs:function(){return Z0(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,e=this.im;return new Pe(Math.sin(t)*$i(e),Math.cos(t)*xo(e))},cos:function(){let t=this.re,e=this.im;return new Pe(Math.cos(t)*$i(e),-Math.sin(t)*xo(e))},tan:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)+$i(e);return new Pe(Math.sin(t)/r,xo(e)/r)},cot:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)-$i(e);return new Pe(-Math.sin(t)/r,xo(e)/r)},sec:function(){let t=this.re,e=this.im,r=.5*$i(2*e)+.5*Math.cos(2*t);return new Pe(Math.cos(t)*$i(e)/r,Math.sin(t)*xo(e)/r)},csc:function(){let t=this.re,e=this.im,r=.5*$i(2*e)-.5*Math.cos(2*t);return new Pe(Math.sin(t)*$i(e)/r,-Math.cos(t)*xo(e)/r)},asin:function(){let t=this.re,e=this.im,r=new Pe(e*e-t*t+1,-2*t*e).sqrt(),n=new Pe(r.re-e,r.im+t).log();return new Pe(n.im,-n.re)},acos:function(){let t=this.re,e=this.im,r=new Pe(e*e-t*t+1,-2*t*e).sqrt(),n=new Pe(r.re-e,r.im+t).log();return new Pe(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,e=this.im;if(t===0){if(e===1)return new Pe(0,1/0);if(e===-1)return new Pe(0,-1/0)}let r=t*t+(1-e)*(1-e),n=new Pe((1-e*e-t*t)/r,-2*t/r).log();return new Pe(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,e=this.im;if(e===0)return new Pe(Math.atan2(1,t),0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).atan():new Pe(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 Pe(0,1/0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).acos():new Pe(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 Pe(Math.PI/2,1/0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).asin():new Pe(t!==0?t/0:0,e!==0?-e/0:0).asin()},sinh:function(){let t=this.re,e=this.im;return new Pe(xo(t)*Math.cos(e),$i(t)*Math.sin(e))},cosh:function(){let t=this.re,e=this.im;return new Pe($i(t)*Math.cos(e),xo(t)*Math.sin(e))},tanh:function(){let t=2*this.re,e=2*this.im,r=$i(t)+Math.cos(e);return new Pe(xo(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 Pe(xo(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 Pe(-2*xo(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 Pe(2*$i(t)*Math.cos(e)/r,-2*xo(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 Pe((i*n-e*e)/a,(e*n+i*e)/a):new Pe(t!==-1?t/0:0,e!==0?e/0:0),s=o.re;return o.re=J0(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 Pe(0,Math.PI/2);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).atanh():new Pe(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 Pe(t!==0?Math.log(t+Math.sqrt(t*t+1)):1/0,0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).asinh():new Pe(t!==0?t/0:0,e!==0?-e/0:0).asinh()},asech:function(){let t=this.re,e=this.im;if(this.isZero())return Pe.INFINITY;let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).acosh():new Pe(t!==0?t/0:0,e!==0?-e/0:0).acosh()},inverse:function(){if(this.isZero())return Pe.INFINITY;if(this.isInfinite())return Pe.ZERO;let t=this.re,e=this.im,r=t*t+e*e;return new Pe(t/r,-e/r)},conjugate:function(){return new Pe(this.re,-this.im)},neg:function(){return new Pe(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new Pe(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new Pe(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new Pe(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,e){let r=Hl(t,e);return Math.abs(r.re-this.re)<=Pe.EPSILON&&Math.abs(r.im-this.im)<=Pe.EPSILON},clone:function(){return new Pe(this.re,this.im)},toString:function(){let t=this.re,e=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(t)<Pe.EPSILON&&(t=0),Math.abs(e)<Pe.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()}};Pe.ZERO=new Pe(0,0);Pe.ONE=new Pe(1,0);Pe.I=new Pe(0,1);Pe.PI=new Pe(Math.PI,0);Pe.E=new Pe(Math.E,0);Pe.INFINITY=new Pe(1/0,1/0);Pe.NAN=new Pe(NaN,NaN);Pe.EPSILON=1e-15;var bJ="Complex",wJ=[],X0=M(bJ,wJ,()=>(Object.defineProperty(Pe,"name",{value:"Complex"}),Pe.prototype.constructor=Pe,Pe.prototype.type="Complex",Pe.prototype.isComplex=!0,Pe.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Pe.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Pe.prototype.format=function(t){var e="",r=this.im,n=this.re,i=zo(this.re,t),a=zo(this.im,t),o=At(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},Pe.fromPolar=function(t){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return Pe(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(At(r)){if(bi(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),At(n))return new Pe({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")}},Pe.prototype.valueOf=Pe.prototype.toString,Pe.fromJSON=function(t){return new Pe(t)},Pe.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},Pe),{isClass:!0});typeof BigInt>"u"&&(BigInt=function(t){if(isNaN(t))throw new Error("");return t});var It=BigInt(0),dr=BigInt(1),Xp=BigInt(2),Q0=BigInt(5),_a=BigInt(10),_J=2e3,st={s:dr,n:It,d:dr};function Ks(t,e){try{t=BigInt(t)}catch{throw zu()}return t*e}function Wo(t){return typeof t=="bigint"?t:Math.floor(t)}function wn(t,e){if(e===It)throw K0();let r=Object.create(Ga.prototype);r.s=t<It?-dr:dr,t=t<It?-t:t;let n=Gl(t,e);return r.n=t/n,r.d=e/n,r}function xf(t){let e={},r=t,n=Xp,i=Q0-dr;for(;i<=r;){for(;r%n===It;)r/=n,e[n]=(e[n]||It)+dr;i+=dr+Xp*n++}return r!==t?r>1&&(e[r]=(e[r]||It)+dr):e[t]=(e[t]||It)+dr,e}var fi=function(t,e){let r=It,n=dr,i=dr;if(t!=null)if(e!==void 0){if(typeof t=="bigint")r=t;else{if(isNaN(t))throw zu();if(t%1!==0)throw FP();r=BigInt(t)}if(typeof e=="bigint")n=e;else{if(isNaN(e))throw zu();if(e%1!==0)throw FP();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 zu();i=r*n}else if(typeof t=="number"){if(isNaN(t))throw zu();if(t<0&&(i=-dr,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=It,s=It,l=It,u=dr,c=dr,f=t.replace(/_/g,"").match(/\d+|./g);if(f===null)throw zu();if(f[a]==="-"?(i=-dr,a++):f[a]==="+"&&a++,f.length===a+1?s=Ks(f[a++],i):f[a+1]==="."||f[a]==="."?(f[a]!=="."&&(o=Ks(f[a++],i)),a++,(a+1===f.length||f[a+1]==="("&&f[a+3]===")"||f[a+1]==="'"&&f[a+3]==="'")&&(s=Ks(f[a],i),u=_a**BigInt(f[a].length),a++),(f[a]==="("&&f[a+2]===")"||f[a]==="'"&&f[a+2]==="'")&&(l=Ks(f[a+1],i),c=_a**BigInt(f[a+1].length)-dr,a+=3)):f[a+1]==="/"||f[a+1]===":"?(s=Ks(f[a],i),u=Ks(f[a+2],dr),a+=3):f[a+3]==="/"&&f[a+1]===" "&&(o=Ks(f[a],i),s=Ks(f[a+2],i),u=Ks(f[a+4],dr),a+=5),f.length<=a)n=u*c,i=r=l+n*o+c*s;else throw zu()}else if(typeof t=="bigint")r=t,i=t,n=dr;else throw zu();if(n===It)throw K0();st.s=i<It?-dr:dr,st.n=r<It?-r:r,st.d=n<It?-n:n};function AJ(t,e,r){let n=dr;for(;e>It;t=t*t%r,e>>=dr)e&dr&&(n=n*t%r);return n}function SJ(t,e){for(;e%Xp===It;e/=Xp);for(;e%Q0===It;e/=Q0);if(e===dr)return It;let r=_a%e,n=1;for(;r!==dr;n++)if(r=r*_a%e,n>_J)return It;return BigInt(n)}function EJ(t,e,r){let n=dr,i=AJ(_a,r,e);for(let a=0;a<300;a++){if(n===i)return BigInt(a);n=n*_a%e,i=i*_a%e}return 0}function Gl(t,e){if(!t)return e;if(!e)return t;for(;;){if(t%=e,!t)return e;if(e%=t,!e)return t}}function Ga(t,e){if(fi(t,e),this instanceof Ga)t=Gl(st.d,st.n),this.s=st.s,this.n=st.n/t,this.d=st.d/t;else return wn(st.s*st.n,st.d)}var K0=function(){return new Error("Division by Zero")},zu=function(){return new Error("Invalid argument")},FP=function(){return new Error("Parameters must be integer")};Ga.prototype={s:dr,n:It,d:dr,abs:function(){return wn(this.n,this.d)},neg:function(){return wn(-this.s*this.n,this.d)},add:function(t,e){return fi(t,e),wn(this.s*this.n*st.d+st.s*this.d*st.n,this.d*st.d)},sub:function(t,e){return fi(t,e),wn(this.s*this.n*st.d-st.s*this.d*st.n,this.d*st.d)},mul:function(t,e){return fi(t,e),wn(this.s*st.s*this.n*st.n,this.d*st.d)},div:function(t,e){return fi(t,e),wn(this.s*st.s*this.n*st.d,this.d*st.n)},clone:function(){return wn(this.s*this.n,this.d)},mod:function(t,e){if(t===void 0)return wn(this.s*this.n%this.d,dr);if(fi(t,e),It===st.n*this.d)throw K0();return wn(this.s*(st.d*this.n)%(st.n*this.d),st.d*this.d)},gcd:function(t,e){return fi(t,e),wn(Gl(st.n,this.n)*Gl(st.d,this.d),st.d*this.d)},lcm:function(t,e){return fi(t,e),st.n===It&&this.n===It?wn(It,dr):wn(st.n*this.n,Gl(st.n,this.n)*Gl(st.d,this.d))},inverse:function(){return wn(this.s*this.d,this.n)},pow:function(t,e){if(fi(t,e),st.d===dr)return st.s<It?wn((this.s*this.d)**st.n,this.n**st.n):wn((this.s*this.n)**st.n,this.d**st.n);if(this.s<It)return null;let r=xf(this.n),n=xf(this.d),i=dr,a=dr;for(let o in r)if(o!=="1"){if(o==="0"){i=It;break}if(r[o]*=st.n,r[o]%st.d===It)r[o]/=st.d;else return null;i*=BigInt(o)**r[o]}for(let o in n)if(o!=="1"){if(n[o]*=st.n,n[o]%st.d===It)n[o]/=st.d;else return null;a*=BigInt(o)**n[o]}return st.s<It?wn(a,i):wn(i,a)},log:function(t,e){if(fi(t,e),this.s<=It||st.s<=It)return null;let r={},n=xf(st.n),i=xf(st.d),a=xf(this.n),o=xf(this.d);for(let u in i)n[u]=(n[u]||It)-i[u];for(let u in o)a[u]=(a[u]||It)-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]||It,f=a[u]||It;if(c===It){if(f!==It)return null;continue}let m=f,p=c,d=Gl(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?wn(s,l):null},equals:function(t,e){return fi(t,e),this.s*this.n*st.d===st.s*st.n*this.d},lt:function(t,e){return fi(t,e),this.s*this.n*st.d<st.s*st.n*this.d},lte:function(t,e){return fi(t,e),this.s*this.n*st.d<=st.s*st.n*this.d},gt:function(t,e){return fi(t,e),this.s*this.n*st.d>st.s*st.n*this.d},gte:function(t,e){return fi(t,e),this.s*this.n*st.d>=st.s*st.n*this.d},compare:function(t,e){fi(t,e);let r=this.s*this.n*st.d-st.s*st.n*this.d;return(It<r)-(r<It)},ceil:function(t){return t=_a**BigInt(t||0),wn(Wo(this.s*t*this.n/this.d)+(t*this.n%this.d>It&&this.s>=It?dr:It),t)},floor:function(t){return t=_a**BigInt(t||0),wn(Wo(this.s*t*this.n/this.d)-(t*this.n%this.d>It&&this.s<It?dr:It),t)},round:function(t){return t=_a**BigInt(t||0),wn(Wo(this.s*t*this.n/this.d)+this.s*((this.s>=It?dr:It)+Xp*(t*this.n%this.d)>this.d?dr:It),t)},roundTo:function(t,e){fi(t,e);let r=this.n*st.d,n=this.d*st.n,i=r%n,a=Wo(r/n);return i+i>=n&&a++,wn(this.s*a*st.n,st.d)},divisible:function(t,e){return fi(t,e),!(!(st.n*this.d)||this.n*st.d%(st.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=SJ(e,r),i=EJ(e,r,n),a=this.s<It?"-":"";if(a+=Wo(e/r),e%=r,e*=_a,e&&(a+="."),n){for(let o=i;o--;)a+=Wo(e/r),e%=r,e*=_a;a+="(";for(let o=n;o--;)a+=Wo(e/r),e%=r,e*=_a;a+=")"}else for(let o=t;e&&o--;)a+=Wo(e/r),e%=r,e*=_a;return a},toFraction:function(t){let e=this.n,r=this.d,n=this.s<It?"-":"";if(r===dr)n+=e;else{let i=Wo(e/r);t&&i>It&&(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<It?"-":"";if(r===dr)n+=e;else{let i=Wo(e/r);t&&i>It&&(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(Wo(t/e));let n=t%e;t=e,e=n}while(t!==dr);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=wn(n[i-1],dr);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 TJ="Fraction",DJ=[],ew=M(TJ,DJ,()=>(Object.defineProperty(Ga,"name",{value:"Fraction"}),Ga.prototype.constructor=Ga,Ga.prototype.type="Fraction",Ga.prototype.isFraction=!0,Ga.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},Ga.fromJSON=function(t){return new Ga(t)},Ga),{isClass:!0});var MJ="Range",CJ=[],tw=M(MJ,CJ,()=>{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(ct(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(ct(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter end must be a number")}if(o){if(ct(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(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 yo(n)===yo(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=zo(this.start,e);return this.step!==1&&(r+=":"+zo(this.step,e)),r+=":"+zo(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 NJ="Matrix",FJ=[],rw=M(NJ,FJ,()=>{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 nw(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(!Qe(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 BP(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}=O0(e);switch(r){case"fixed":return PJ(t,n);case"exponential":return IP(t,n);case"engineering":return IJ(t,n);case"bin":return nw(t,2,i);case"oct":return nw(t,8,i);case"hex":return nw(t,16,i);case"auto":{var a=PP(e?.lowerExp,-3),o=PP(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=IP(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 IJ(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 IP(t,e){return e!==void 0?t.toExponential(e-1):t.toExponential()}function PJ(t,e){return t.toFixed(e)}function PP(t,e){return At(t)?t:ct(t)?t.toNumber():e}function $P(t,e){var r=t.length-e.length,n=t.length;return t.substring(r,n)===e}function Dt(t,e){var r=BJ(t,e);return e&&typeof e=="object"&&"truncate"in e&&r.length>e.truncate?r.substring(0,e.truncate-3)+"...":r}function BJ(t,e){if(typeof t=="number")return zo(t,e);if(ct(t))return BP(t,e);if(kJ(t))return!e||e.fraction!=="decimal"?"".concat(t.s*t.n,"/").concat(t.d):t.toString();if(Array.isArray(t))return OP(t,e);if(bn(t))return Wl(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=>Wl(n)+": "+Dt(t[n],e));return"{"+r.join(", ")+"}"}return String(t)}function Wl(t){for(var e=String(t),r="",n=0;n<e.length;){var i=e.charAt(n);r+=i in kP?kP[i]:i,n++}return'"'+r+'"'}var kP={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function ri(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 OP(t,e){if(Array.isArray(t)){for(var r="[",n=t.length,i=0;i<n;i++)i!==0&&(r+=", "),r+=OP(t[i],e);return r+="]",r}else return Dt(t,e)}function kJ(t){return t&&typeof t=="object"&&typeof t.s=="bigint"&&typeof t.n=="bigint"&&typeof t.d=="bigint"||!1}function Wg(t,e){if(!bn(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+cr(t)+", index: 0)");if(!bn(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+cr(e)+", index: 1)");return t===e?0:t>e?1:-1}function Ct(t,e,r){if(!(this instanceof Ct))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}Ct.prototype=new RangeError;Ct.prototype.constructor=RangeError;Ct.prototype.name="DimensionError";Ct.prototype.isDimensionError=!0;function Si(t,e,r){if(!(this instanceof Si))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}Si.prototype=new RangeError;Si.prototype.constructor=RangeError;Si.prototype.name="IndexError";Si.prototype.isIndexError=!0;function ft(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function RP(t,e,r){var n,i=t.length;if(i!==e[r])throw new Ct(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 Ct(e.length-1,e.length,"<");RP(t[n],e,a)}}else for(n=0;n<i;n++)if(Array.isArray(t[n]))throw new Ct(e.length+1,e.length,">")}function aw(t,e){var r=e.length===0;if(r){if(Array.isArray(t))throw new Ct(t.length,0)}else RP(t,e,0)}function Qp(t,e){var r=t.isMatrix?t._size:ft(t),n=e._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==r[a])throw new Ct(i,r[a])})}function kr(t,e){if(t!==void 0){if(!At(t)||!Qe(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||typeof e=="number"&&t>=e)throw new Si(t,e)}}function Yl(t){for(var e=0;e<t._dimensions.length;++e){var r=t._dimensions[e];if(r._data&&gr(r._data)){if(r._size[0]===0)return!0}else if(r.isRange){if(r.start===r.end)return!0}else if(bn(r)&&r.length===0)return!0}return!1}function Yo(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(!At(i)||!Qe(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(e)+")")}),(At(t)||ct(t))&&(t=[t]);var n=r!==void 0?r:0;return iw(t,e,0,n),t}function iw(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),iw(a,e,u,n);for(i=l;i<s;i++)a=[],t[i]=a,iw(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 Kp(t,e){var r=Ot(t),n=r.length;if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Ct(0,n,"!=");e=em(e,n);var i=LP(e);if(n!==i)throw new Ct(i,n,"!=");try{return $J(r,e)}catch(a){throw a instanceof Ct?new Ct(i,n,"!="):a}}function em(t,e){var r=LP(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 LP(t){return t.reduce((e,r)=>e*r,1)}function $J(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 bf(t,e){for(var r=e||ft(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=VP(t,n,0),r.length=n),t}function VP(t,e,r){var n,i;if(r<e){var a=r+1;for(n=0,i=t.length;n<i;n++)t[n]=VP(t[n],e,a)}else for(;Array.isArray(t);)t=t[0];return t}function Yg(t,e,r,n){var i=n||ft(t);if(r)for(var a=0;a<r;a++)t=[t],i.unshift(1);for(t=UP(t,e,0);i.length<e;)i.push(1);return t}function UP(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]=UP(t[n],e,a)}else for(var o=r;o<e;o++)t=[t];return t}function Ot(t){if(!Array.isArray(t))return t;var e=[];return t.forEach(function r(n){Array.isArray(n)?n.forEach(r):e.push(n)}),e}function bo(t,e){return Array.prototype.map.call(t,e)}function jg(t,e){Array.prototype.forEach.call(t,e)}function qP(t,e){if(ft(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,e)}function ow(t,e){if(ft(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,r=>e.test(r))}function sw(t,e){return Array.prototype.join.call(t,e)}function eu(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 wf(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 jl(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?jl(a,e):e(a);if(r===void 0)r=s;else if(r!==s)return"mixed"}return r}function zP(t,e,r,n){if(n<r){if(t.length!==e.length)throw new Ct(t.length,e.length);for(var i=[],a=0;a<t.length;a++)i[a]=zP(t[a],e[a],r,n+1);return i}else return t.concat(e)}function uw(){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 zP(r,n,e,0)},t[0]);throw new Error("Wrong number of arguments in function concat")}function tm(){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++)HP(e[f],a);return a}function HP(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 missmatch: missmatch 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 hs(t,e){var r=ft(t);if(ba(r,e))return t;HP(r,e);var n=tm(r,e),i=n.length,a=[...Array(i-r.length).fill(1),...r],o=RJ(t);r.length<i&&(o=Kp(o,a),r=ft(o));for(var s=0;s<i;s++)r[s]<n[s]&&(o=OJ(o,n[s],s),r=ft(o));return o}function OJ(t,e,r){return uw(...Array(e).fill(t),r)}function _f(t,e){if(!Array.isArray(t))throw new Error("Array expected");var r=ft(t);if(e.length!==r.length)throw new Ct(e.length,r.length);for(var n=0;n<e.length;n++)kr(e[n],r[n]);return e.reduce((i,a)=>i[a],t)}function rm(t,e,r,n){return Array.isArray(t)?t.map(function(i,a){return rm(i,e.concat(a),r,n)}):n(t,e,r)}function RJ(t){return sn([],t)}var lw=zr(k0(),1);function wo(t,e,r){if(lw.default.isTypedFunction(t)){var n=(e.isMatrix?e.size():ft(e)).map(()=>0),i=e.isMatrix?e.get(n):_f(e,n),a=Object.keys(t.signatures).length===1,o=LJ(t,i,n,e),s=a?Object.values(t.signatures)[0]:t;return o>=1&&o<=3?function(){for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];return GP(s,u.slice(0,o),r,t.name)}:function(){for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];return GP(s,u,r,t.name)}}return t}function LJ(t,e,r,n){for(var i=[e,r,n],a=3;a>0;a--){var o=i.slice(0,a);if(lw.default.resolve(t,o)!==null)return a}}function GP(t,e,r,n){try{return t(...e)}catch(i){VJ(i,e,r,n)}}function VJ(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(cr(e[0]))),e.length>=2&&a.push("index: ".concat(cr(e[1]))),e.length>=3&&a.push("array: ".concat(cr(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 UJ="DenseMatrix",qJ=["Matrix"],cw=M(UJ,qJ,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&&!bn(f))throw new Error("Invalid datatype: "+f);if(rt(c))c.type==="DenseMatrix"?(this._data=gt(c._data),this._size=gt(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&gr(c.data)&&gr(c.size))this._data=c.data,this._size=c.size,aw(this._data,this._size),this._datatype=f||c.datatype;else if(gr(c))this._data=u(c),this._size=ft(this._data),aw(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+cr(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 jl(this._data,cr)},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 _f(this._data,c)},r.prototype.set=function(c,f,m){if(!gr(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new Ct(c.length,this._size.length,"<");var p,d,h,x=c.map(function(T){return T+1});l(this,x,m);var b=this._data;for(p=0,d=c.length-1;p<d;p++)h=c[p],kr(h,b.length),b=b[h];return h=c[c.length-1],kr(h,b.length),b[h]=f,this};function n(c,f){if(!Ou(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 Ct(p.length,c._size.length);for(var d=f.min(),h=f.max(),x=0,b=c._size.length;x<b;x++)kr(d[x],c._size[x]),kr(h[x],c._size[x]);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(x){return kr(x,c.length),c[x]}).valueOf():h.map(function(x){kr(x,c.length);var b=c[x];return i(b,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(),x;if(rt(m)?(x=m.size(),m=m.valueOf()):x=ft(m),h){if(x.length!==0)throw new TypeError("Scalar expected");c.set(f.min(),m,p)}else{if(!ba(x,d))try{x.length===0?m=hs([m],d):m=hs(m,d),x=ft(m)}catch{}if(d.length<c._size.length)throw new Ct(d.length,c._size.length,"<");if(x.length<d.length){for(var b=0,T=0;d[b]===1&&x[b]===1;)b++;for(;d[b]===1;)T++,b++;m=Yg(m,d.length,T,x)}if(!ba(d,x))throw new Ct(d,x,">");var v=f.max().map(function(y){return y+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,x=f.dimension(d);h?x.forEach(function(b,T){kr(b),c[b]=m[T[0]]}):x.forEach(function(b,T){kr(b),o(c[b],f,m[T[0]],p,d+1)})}r.prototype.resize=function(c,f,m){if(!Tn(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;gr(p);)p=p[0];return p}return c._size=f.slice(0),c._data=Yo(c._data,c._size,m),c}r.prototype.reshape=function(c,f){var m=f?this.clone():this;m._data=Kp(m._data,c);var p=m._size.reduce((d,h)=>d*h);return m._size=em(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,x=f.length;h<x;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:gt(this._data),size:gt(this._size),datatype:this._datatype});return c},r.prototype.size=function(){return this._size.slice(0)},r.prototype._forEach=function(c){var f=this,m=f.size();if(m.length===1){for(var p=0;p<m[0];p++)c(f._data,p,[p]);return}var d=Array(m.length).fill(0),h=Array(m.length-1),x=h.length-1;h[0]=f._data[0];for(var b=0;b<x;b++)h[b+1]=h[b][0];for(d[x]=-1;;){var T=void 0;for(T=x;T>=0;T--){if(d[T]++,d[T]===m[T]){d[T]=0;continue}h[T]=T===0?f._data[d[T]]:h[T-1][d[T]];for(var v=T;v<x;v++)h[v+1]=h[v][0];for(var A=0;A<m[h.length];A++)d[h.length]=A,c(h[x],A,d.slice(0));break}if(T===-1)break}},r.prototype.map=function(c){var f=this,m=new r(f),p=wo(c,f._data,"map");return m._forEach(function(d,h,x){d[h]=p(d[h],x,f)}),m},r.prototype.forEach=function(c){var f=this,m=wo(c,f._data,"map");f._forEach(function(p,d,h){m(p[d],h,f)})},r.prototype[Symbol.iterator]=function*(){var c=function*(m,p){if(gr(m))for(var d=0;d<m.length;d++)yield*c(m[d],p.concat(d));else yield{value:m,index:p}};yield*c(this._data,[])},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(b){var T=p.map(v=>[v[b]]);f.push(new r(T,c._datatype))},h=0;h<m[1];h++)d(h);return f},r.prototype.toArray=function(){return gt(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(ct(c)&&(c=c.toNumber()),!At(c)||!Qe(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),x=[],b=0;b<h;b++)x[b]=this._data[b+m][b+f];return new r({data:x,size:[h],datatype:this._datatype})},r.diagonal=function(c,f,m,p){if(!gr(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(ct(E)&&(E=E.toNumber()),!At(E)||!Qe(E)||E<1)throw new Error("Size values must be positive integers");return E}),m){if(ct(m)&&(m=m.toNumber()),!At(m)||!Qe(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,x=c[0],b=c[1],T=Math.min(x-h,b-d),v;if(gr(f)){if(f.length!==T)throw new Error("Invalid value array length");v=function(D){return f[D]}}else if(rt(f)){var A=f.size();if(A.length!==1||A[0]!==T)throw new Error("Invalid matrix length");v=function(D){return f.get([D])}}else v=function(){return f};p||(p=ct(v(0))?v(0).mul(0):0);var w=[];if(c.length>0){w=Yo(w,c,p);for(var y=0;y<T;y++)w[y+h][y+d]=v(y)}return new r({data:w,size:[x,b]})},r.fromJSON=function(c){return new r(c)},r.prototype.swapRows=function(c,f){if(!At(c)||!Qe(c)||!At(f)||!Qe(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 kr(c,this._size[0]),kr(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 rt(c)?u(c.valueOf()):gr(c)?c.map(u):c}return r},{isClass:!0});var WP="clone",zJ=["typed"],fw=M(WP,zJ,t=>{var{typed:e}=t;return e(WP,{any:gt})});function Zg(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 _o(t){for(var e=0;e<t.length;e++)if(Tn(t[e]))return!0;return!1}function Oi(t,e){rt(t)&&(t=t.valueOf());for(var r=0,n=t.length;r<n;r++){var i=t[r];Array.isArray(i)?Oi(i,e):e(i)}}function nt(t,e,r){return t&&typeof t.map=="function"?t.map(function(n){return nt(n,e,r)}):e(t)}function Hu(t,e,r){var n=Array.isArray(t)?ft(t):t.size();if(e<0||e>=n.length)throw new Si(e,n.length);return rt(t)?t.create(Jg(t.valueOf(),e,r),t.datatype()):Jg(t,e,r)}function Jg(t,e,r){var n,i,a,o;if(e<=0)if(Array.isArray(t[0])){for(o=Zg(t),i=[],n=0;n<o.length;n++)i[n]=Jg(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]=Jg(t[n],e-1,r);return i}}function pw(t,e,r,n,i,a,o,s,l,u,c){var f=t._values,m=t._index,p=t._ptr,d,h,x,b;if(n)for(h=p[e],x=p[e+1],d=h;d<x;d++)b=m[d],r[b]!==a?(r[b]=a,o.push(b),u?(n[b]=l?s(f[d],c):s(c,f[d]),i[b]=a):n[b]=f[d]):(n[b]=l?s(f[d],n[b]):s(n[b],f[d]),i[b]=a);else for(h=p[e],x=p[e+1],d=h;d<x;d++)b=m[d],r[b]!==a?(r[b]=a,o.push(b)):i[b]=a}var YP="isInteger",HJ=["typed"],mw=M(YP,HJ,t=>{var{typed:e}=t;return e(YP,{number:Qe,BigNumber:function(n){return n.isInt()},bigint:function(n){return!0},Fraction:function(n){return n.d===1n},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var Aa="number",tu="number, number";function dw(t){return Math.abs(t)}dw.signature=Aa;function hw(t,e){return t+e}hw.signature=tu;function gw(t,e){return t-e}gw.signature=tu;function vw(t,e){return t*e}vw.signature=tu;function GJ(t,e){return t/e}GJ.signature=tu;function yw(t){return-t}yw.signature=Aa;function xw(t){return t}xw.signature=Aa;function Af(t){return sP(t)}Af.signature=Aa;function bw(t){return t*t*t}bw.signature=Aa;function ww(t){return Math.exp(t)}ww.signature=Aa;function _w(t){return uP(t)}_w.signature=Aa;function WJ(t,e){if(!Qe(t)||!Qe(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}WJ.signature=tu;function Aw(t,e){if(!Qe(t)||!Qe(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)}Aw.signature=tu;function jP(t,e){return e?Math.log(t)/Math.log(e):Math.log(t)}function Sw(t){return oP(t)}Sw.signature=Aa;function Ew(t){return aP(t)}Ew.signature=Aa;function YJ(t){return Ig(t)}YJ.signature=Aa;function jJ(t,e){return e===0?t:t-e*Math.floor(t/e)}jJ.signature=tu;function Tw(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 Xg(t){return yo(t)}Xg.signature=Aa;function ZJ(t){return Math.sqrt(t)}ZJ.signature=Aa;function Dw(t){return t*t}Dw.signature=Aa;function Mw(t,e){var r,n,i,a=0,o=1,s=1,l=0;if(!Qe(t)||!Qe(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}Mw.signature=tu;function Cw(t,e){return t*t<1&&e===1/0||t*t>1&&e===-1/0?0:Math.pow(t,e)}Cw.signature=tu;function Sf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Qe(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(R0(t,e))}function JJ(t){return Math.abs(t)}JJ.signature=Aa;var XJ="number",Ef="number, number";function Nw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function bitAnd");return t&e}Nw.signature=Ef;function Fw(t){if(!Qe(t))throw new Error("Integer expected in function bitNot");return~t}Fw.signature=XJ;function Iw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function bitOr");return t|e}Iw.signature=Ef;function Pw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function bitXor");return t^e}Pw.signature=Ef;function Bw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function leftShift");return t<<e}Bw.signature=Ef;function kw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function rightArithShift");return t>>e}kw.signature=Ef;function $w(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function rightLogShift");return t>>>e}$w.signature=Ef;function Wa(t,e){if(e<t)return 1;if(e===t)return e;var r=e+t>>1;return Wa(t,r)*Wa(r+1,e)}function Ow(t,e){if(!Qe(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(!Qe(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/=Wa(a,o)),n}Ow.signature="number, number";var ZP=Math.PI,JP=2*Math.PI,XP=Math.E,QP=1.618033988749895;var QJ="number",Rw="number, number";function Lw(t){return!t}Lw.signature=QJ;function Qg(t,e){return!!(t||e)}Qg.signature=Rw;function Kg(t,e){return!!t!=!!e}Kg.signature=Rw;function ev(t,e){return!!(t&&e)}ev.signature=Rw;function nm(t){var e;if(Qe(t))return t<=0?isFinite(t)?1/0:NaN:t>171?1/0:Wa(1,t-1);if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*nm(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=Zl[0];for(var o=1;o<Zl.length;++o)e+=Zl[o]/(t+o);var s=t+Vw+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,t+.5)*Math.exp(-s)*e}nm.signature="number";var Vw=4.7421875,Zl=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Uw=.9189385332046728,KJ=5,eX=7,KP=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function im(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))-im(1-t);t=t-1;for(var e=t+KJ+.5,r=KP[0],n=eX-1;n>=1;n--)r+=KP[n]/(t+n);return Uw+(t+.5)*Math.log(e)-e+Math.log(r)}im.signature="number";var _n="number",tX="number, number";function rX(t){return Math.acos(t)}rX.signature=_n;function qw(t){return fP(t)}qw.signature=_n;function zw(t){return Math.atan(1/t)}zw.signature=_n;function Hw(t){return isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0}Hw.signature=_n;function Gw(t){return Math.asin(1/t)}Gw.signature=_n;function Ww(t){var e=1/t;return Math.log(e+Math.sqrt(e*e+1))}Ww.signature=_n;function Yw(t){return Math.acos(1/t)}Yw.signature=_n;function jw(t){var e=1/t,r=Math.sqrt(e*e-1);return Math.log(r+e)}jw.signature=_n;function nX(t){return Math.asin(t)}nX.signature=_n;function Zw(t){return pP(t)}Zw.signature=_n;function iX(t){return Math.atan(t)}iX.signature=_n;function aX(t,e){return Math.atan2(t,e)}aX.signature=tX;function Jw(t){return mP(t)}Jw.signature=_n;function oX(t){return Math.cos(t)}oX.signature=_n;function sX(t){return Bg(t)}sX.signature=_n;function Xw(t){return 1/Math.tan(t)}Xw.signature=_n;function Qw(t){var e=Math.exp(2*t);return(e+1)/(e-1)}Qw.signature=_n;function Kw(t){return 1/Math.sin(t)}Kw.signature=_n;function e_(t){return t===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*yo(t)}e_.signature=_n;function t_(t){return 1/Math.cos(t)}t_.signature=_n;function r_(t){return 2/(Math.exp(t)+Math.exp(-t))}r_.signature=_n;function uX(t){return Math.sin(t)}uX.signature=_n;function n_(t){return dP(t)}n_.signature=_n;function lX(t){return Math.tan(t)}lX.signature=_n;function cX(t){return kg(t)}cX.signature=_n;var am="number";function fX(t){return Qe(t)}fX.signature=am;function i_(t){return t<0}i_.signature=am;function a_(t){return t>0}a_.signature=am;function pX(t){return t===0}pX.signature=am;function o_(t){return Number.isNaN(t)}o_.signature=am;function mn(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 eB="isNegative",mX=["typed","config"],s_=M(eB,mX,t=>{var{typed:e,config:r}=t;return e(eB,{number:n=>Kr(n,0,r.relTol,r.absTol)?!1:i_(n),BigNumber:n=>mn(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=>nt(i,n))})});var tB="isNumeric",dX=["typed"],u_=M(tB,dX,t=>{var{typed:e}=t;return e(tB,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var rB="hasNumericValue",hX=["typed","isNumeric"],l_=M(rB,hX,t=>{var{typed:e,isNumeric:r}=t;return e(rB,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var nB="isPositive",gX=["typed","config"],c_=M(nB,gX,t=>{var{typed:e,config:r}=t;return e(nB,{number:n=>Kr(n,0,r.relTol,r.absTol)?!1:a_(n),BigNumber:n=>mn(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=>nt(i,n))})});var iB="isZero",vX=["typed","equalScalar"],f_=M(iB,vX,t=>{var{typed:e,equalScalar:r}=t;return e(iB,{"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=>nt(i,n))})});var aB="isNaN",yX=["typed"],p_=M(aB,yX,t=>{var{typed:e}=t;return e(aB,{number:o_,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=>nt(n,r))})});var oB="typeOf",xX=["typed"],m_=M(oB,xX,t=>{var{typed:e}=t;return e(oB,{any:cr})});function sB(t,e,r,n){return Kr(t.re,e.re,r,n)&&Kr(t.im,e.im,r,n)}var Ao=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 tv="equalScalar",bX=["typed","config"],d_=M(tv,bX,t=>{var{typed:e,config:r}=t,n=Ao({typed:e});return e(tv,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Kr(a,o,r.relTol,r.absTol)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||mn(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 sB(a,o,r.relTol,r.absTol)}},n)}),KCe=M(tv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(tv,{"number, number":function(i,a){return Kr(i,a,r.relTol,r.absTol)}})});var wX="SparseMatrix",_X=["typed","equalScalar","Matrix"],h_=M(wX,_X,t=>{var{typed:e,equalScalar:r,Matrix:n}=t;function i(h,x){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(x&&!bn(x))throw new Error("Invalid datatype: "+x);if(rt(h))a(this,h,x);else if(h&&gr(h.index)&&gr(h.ptr)&&gr(h.size))this._values=h.values,this._index=h.index,this._ptr=h.ptr,this._size=h.size,this._datatype=x||h.datatype;else if(gr(h))o(this,h,x);else{if(h)throw new TypeError("Unsupported type of data ("+cr(h)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=x}}function a(h,x,b){x.type==="SparseMatrix"?(h._values=x._values?gt(x._values):void 0,h._index=gt(x._index),h._ptr=gt(x._ptr),h._size=gt(x._size),h._datatype=b||x._datatype):o(h,x.valueOf(),b||x._datatype)}function o(h,x,b){h._values=[],h._index=[],h._ptr=[],h._datatype=b;var T=x.length,v=0,A=r,w=0;if(bn(b)&&(A=e.find(r,[b,b])||r,w=e.convert(0,b)),T>0){var y=0;do{h._ptr.push(h._index.length);for(var E=0;E<T;E++){var D=x[E];if(gr(D)){if(y===0&&v<D.length&&(v=D.length),y<D.length){var _=D[y];A(_,w)||(h._values.push(_),h._index.push(E))}}else y===0&&v<1&&(v=1),A(D,w)||(h._values.push(D),h._index.push(E))}y++}while(y<v)}h._ptr.push(h._index.length),h._size=[T,v]}i.prototype=new n,i.prototype.createSparseMatrix=function(h,x){return new i(h,x)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return jl(this._values,cr)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(h,x){return new i(h,x)},i.prototype.density=function(){var h=this._size[0],x=this._size[1];return h!==0&&x!==0?this._index.length/(h*x):0},i.prototype.subset=function(h,x,b){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,x,b);default:throw new SyntaxError("Wrong number of arguments")}};function s(h,x){if(!Ou(x))throw new TypeError("Invalid index");var b=x.isScalar();if(b)return h.get(x.min());var T=x.size();if(T.length!==h._size.length)throw new Ct(T.length,h._size.length);var v,A,w,y,E=x.min(),D=x.max();for(v=0,A=h._size.length;v<A;v++)kr(E[v],h._size[v]),kr(D[v],h._size[v]);var _=h._values,C=h._index,N=h._ptr,P=x.dimension(0),R=x.dimension(1),L=[],V=[];P.forEach(function(O,Q){V[O]=Q[0],L[O]=!0});var k=_?[]:void 0,B=[],W=[];return R.forEach(function(O){for(W.push(B.length),w=N[O],y=N[O+1];w<y;w++)v=C[w],L[v]===!0&&(B.push(V[v]),k&&k.push(_[w]))}),W.push(B.length),new i({values:k,index:B,ptr:W,size:T,datatype:h._datatype})}function l(h,x,b,T){if(!x||x.isIndex!==!0)throw new TypeError("Invalid index");var v=x.size(),A=x.isScalar(),w;if(rt(b)?(w=b.size(),b=b.toArray()):w=ft(b),A){if(w.length!==0)throw new TypeError("Scalar expected");h.set(x.min(),b,T)}else{if(v.length!==1&&v.length!==2)throw new Ct(v.length,h._size.length,"<");if(w.length<v.length){for(var y=0,E=0;v[y]===1&&w[y]===1;)y++;for(;v[y]===1;)E++,y++;b=Yg(b,v.length,E,w)}if(!ba(v,w))throw new Ct(v,w,">");if(v.length===1){var D=x.dimension(0);D.forEach(function(N,P){kr(N),h.set([N,0],b[P[0]],T)})}else{var _=x.dimension(0),C=x.dimension(1);_.forEach(function(N,P){kr(N),C.forEach(function(R,L){kr(R),h.set([N,R],b[P[0]][L[0]],T)})})}}return h}i.prototype.get=function(h){if(!gr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Ct(h.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var x=h[0],b=h[1];kr(x,this._size[0]),kr(b,this._size[1]);var T=u(x,this._ptr[b],this._ptr[b+1],this._index);return T<this._ptr[b+1]&&this._index[T]===x?this._values[T]:0},i.prototype.set=function(h,x,b){if(!gr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Ct(h.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var T=h[0],v=h[1],A=this._size[0],w=this._size[1],y=r,E=0;bn(this._datatype)&&(y=e.find(r,[this._datatype,this._datatype])||r,E=e.convert(0,this._datatype)),(T>A-1||v>w-1)&&(m(this,Math.max(T+1,A),Math.max(v+1,w),b),A=this._size[0],w=this._size[1]),kr(T,A),kr(v,w);var D=u(T,this._ptr[v],this._ptr[v+1],this._index);return D<this._ptr[v+1]&&this._index[D]===T?y(x,E)?c(D,v,this._values,this._index,this._ptr):this._values[D]=x:y(x,E)||f(D,T,v,x,this._values,this._index,this._ptr),this};function u(h,x,b,T){if(b-x===0)return b;for(var v=x;v<b;v++)if(T[v]===h)return v;return x}function c(h,x,b,T,v){b.splice(h,1),T.splice(h,1);for(var A=x+1;A<v.length;A++)v[A]--}function f(h,x,b,T,v,A,w){v.splice(h,0,T),A.splice(h,0,x);for(var y=b+1;y<w.length;y++)w[y]++}i.prototype.resize=function(h,x,b){if(!Tn(h))throw new TypeError("Array or Matrix expected");var T=h.valueOf().map(A=>Array.isArray(A)&&A.length===1?A[0]:A);if(T.length!==2)throw new Error("Only two dimensions matrix are supported");T.forEach(function(A){if(!At(A)||!Qe(A)||A<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(T)+")")});var v=b?this.clone():this;return m(v,T[0],T[1],x)};function m(h,x,b,T){var v=T||0,A=r,w=0;bn(h._datatype)&&(A=e.find(r,[h._datatype,h._datatype])||r,w=e.convert(0,h._datatype),v=e.convert(v,h._datatype));var y=!A(v,w),E=h._size[0],D=h._size[1],_,C,N;if(b>D){for(C=D;C<b;C++)if(h._ptr[C]=h._values.length,y)for(_=0;_<E;_++)h._values.push(v),h._index.push(_);h._ptr[b]=h._values.length}else b<D&&(h._ptr.splice(b+1,D-b),h._values.splice(h._ptr[b],h._values.length),h._index.splice(h._ptr[b],h._index.length));if(D=b,x>E){if(y){var P=0;for(C=0;C<D;C++){h._ptr[C]=h._ptr[C]+P,N=h._ptr[C+1]+P;var R=0;for(_=E;_<x;_++,R++)h._values.splice(N+R,0,v),h._index.splice(N+R,0,_),P++}h._ptr[D]=h._values.length}}else if(x<E){var L=0;for(C=0;C<D;C++){h._ptr[C]=h._ptr[C]-L;var V=h._ptr[C],k=h._ptr[C+1]-L;for(N=V;N<k;N++)_=h._index[N],_>x-1&&(h._values.splice(N,1),h._index.splice(N,1),L++)}h._ptr[C]=h._values.length}return h._size[0]=x,h._size[1]=b,h}i.prototype.reshape=function(h,x){if(!gr(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(!At(O)||!Qe(O)||O<=-2||O===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Dt(h)+")")});var b=this._size[0]*this._size[1];h=em(h,b);var T=h[0]*h[1];if(b!==T)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var v=x?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 y=0;y<v._ptr[w+1]-v._ptr[w];y++)A.push(w);for(var E=v._values.slice(),D=v._index.slice(),_=0;_<v._index.length;_++){var C=D[_],N=A[_],P=C*v._size[1]+N;A[_]=P%h[1],D[_]=Math.floor(P/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=D[L],k=A[L],B=E[L],W=u(V,v._ptr[k],v._ptr[k+1],v._index);f(W,V,k,B,v._values,v._index,v._ptr)}return v},i.prototype.clone=function(){var h=new i({values:this._values?gt(this._values):void 0,index:gt(this._index),ptr:gt(this._ptr),size:gt(this._size),datatype:this._datatype});return h},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(h,x){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var b=this,T=this._size[0],v=this._size[1],A=wo(h,b,"map"),w=function(E,D,_){return A(E,[D,_],b)};return p(this,0,T-1,0,v-1,w,x)};function p(h,x,b,T,v,A,w){var y=[],E=[],D=[],_=r,C=0;bn(h._datatype)&&(_=e.find(r,[h._datatype,h._datatype])||r,C=e.convert(0,h._datatype));for(var N=function(U,pe,we){var se=A(U,pe,we);_(se,C)||(y.push(se),E.push(pe))},P=T;P<=v;P++){D.push(y.length);var R=h._ptr[P],L=h._ptr[P+1];if(w)for(var V=R;V<L;V++){var k=h._index[V];k>=x&&k<=b&&N(h._values[V],k-x,P-T)}else{for(var B={},W=R;W<L;W++){var O=h._index[W];B[O]=h._values[W]}for(var Q=x;Q<=b;Q++){var ie=Q in B?B[Q]:0;N(ie,Q-x,P-T)}}}return D.push(y.length),new i({values:y,index:E,ptr:D,size:[b-x+1,v-T+1]})}i.prototype.forEach=function(h,x){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var b=this,T=this._size[0],v=this._size[1],A=wo(h,b,"forEach"),w=0;w<v;w++){var y=this._ptr[w],E=this._ptr[w+1];if(x)for(var D=y;D<E;D++){var _=this._index[D];A(this._values[D],[_,w],b)}else{for(var C={},N=y;N<E;N++){var P=this._index[N];C[P]=this._values[N]}for(var R=0;R<T;R++){var L=R in C?C[R]:0;A(L,[R,w],b)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var h=this._size[1],x=0;x<h;x++)for(var b=this._ptr[x],T=this._ptr[x+1],v=b;v<T;v++){var A=this._index[v];yield{value:this._values[v],index:[A,x]}}},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,x,b,T,v){var A=T[0],w=T[1],y=[],E,D;for(E=0;E<A;E++)for(y[E]=[],D=0;D<w;D++)y[E][D]=0;for(D=0;D<w;D++)for(var _=b[D],C=b[D+1],N=_;N<C;N++)E=x[N],y[E][D]=h?v?gt(h[N]):h[N]:1;return y}return i.prototype.format=function(h){for(var x=this._size[0],b=this._size[1],T=this.density(),v="Sparse Matrix ["+Dt(x,h)+" x "+Dt(b,h)+"] density: "+Dt(T,h)+`
`,A=0;A<b;A++)for(var w=this._ptr[A],y=this._ptr[A+1],E=w;E<y;E++){var D=this._index[E];v+=`
(`+Dt(D,h)+", "+Dt(A,h)+") ==> "+(this._values?Dt(this._values[E],h):"X")}return v},i.prototype.toString=function(){return Dt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(h){if(h){if(ct(h)&&(h=h.toNumber()),!At(h)||!Qe(h))throw new TypeError("The parameter k must be an integer number")}else h=0;var x=h>0?h:0,b=h<0?-h:0,T=this._size[0],v=this._size[1],A=Math.min(T-b,v-x),w=[],y=[],E=[];E[0]=0;for(var D=x;D<v&&w.length<A;D++)for(var _=this._ptr[D],C=this._ptr[D+1],N=_;N<C;N++){var P=this._index[N];if(P===D-x+b){w.push(this._values[N]),y[w.length-1]=P-b;break}}return E.push(w.length),new i({values:w,index:y,ptr:E,size:[A,1]})},i.fromJSON=function(h){return new i(h)},i.diagonal=function(h,x,b,T,v){if(!gr(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(ct(O)&&(O=O.toNumber()),!At(O)||!Qe(O)||O<1)throw new Error("Size values must be positive integers");return O}),b){if(ct(b)&&(b=b.toNumber()),!At(b)||!Qe(b))throw new TypeError("The parameter k must be an integer number")}else b=0;var A=r,w=0;bn(v)&&(A=e.find(r,[v,v])||r,w=e.convert(0,v));var y=b>0?b:0,E=b<0?-b:0,D=h[0],_=h[1],C=Math.min(D-E,_-y),N;if(gr(x)){if(x.length!==C)throw new Error("Invalid value array length");N=function(Q){return x[Q]}}else if(rt(x)){var P=x.size();if(P.length!==1||P[0]!==C)throw new Error("Invalid matrix length");N=function(Q){return x.get([Q])}}else N=function(){return x};for(var R=[],L=[],V=[],k=0;k<_;k++){V.push(R.length);var B=k-y;if(B>=0&&B<C){var W=N(B);A(W,w)||(L.push(B+E),R.push(W))}}return V.push(R.length),new i({values:R,index:L,ptr:V,size:[D,_]})},i.prototype.swapRows=function(h,x){if(!At(h)||!Qe(h)||!At(x)||!Qe(x))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return kr(h,this._size[0]),kr(x,this._size[0]),i._swapRows(h,x,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(h,x,b,T,v){for(var A=T[h],w=T[h+1],y=A;y<w;y++)v(b[y],x[y])},i._swapRows=function(h,x,b,T,v,A){for(var w=0;w<b;w++){var y=A[w],E=A[w+1],D=u(h,y,E,v),_=u(x,y,E,v);if(D<E&&_<E&&v[D]===h&&v[_]===x){if(T){var C=T[D];T[D]=T[_],T[_]=C}continue}if(D<E&&v[D]===h&&(_>=E||v[_]!==x)){var N=T?T[D]:void 0;v.splice(_,0,x),T&&T.splice(_,0,N),v.splice(_<=D?D+1:D,1),T&&T.splice(_<=D?D+1:D,1);continue}if(_<E&&v[_]===x&&(D>=E||v[D]!==h)){var P=T?T[_]:void 0;v.splice(D,0,h),T&&T.splice(D,0,P),v.splice(D<=_?_+1:_,1),T&&T.splice(D<=_?_+1:_,1)}}},i},{isClass:!0});var AX="number",SX=["typed"];function EX(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 TX(t){for(var e=parseInt(t.integerPart,t.radix),r=0,n=0;n<t.fractionalPart.length;n++){var i=parseInt(t.fractionalPart[n],t.radix);r+=i/Math.pow(t.radix,n+1)}var a=e+r;if(isNaN(a))throw new SyntaxError('String "'+t.input+'" is not a valid number');return a}var g_=M(AX,SX,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=EX(i);if(a)return TX(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},bigint:function(i){return Number(i)},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var DX="bigint",MX=["typed"],v_=M(DX,MX,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=>nt(i,n))});return r.fromJSON=function(n){return BigInt(n.value)},r});var uB="string",CX=["typed"],y_=M(uB,CX,t=>{var{typed:e}=t;return e(uB,{"":function(){return""},number:zo,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r)),any:function(n){return String(n)}})});var lB="boolean",NX=["typed"],x_=M(lB,NX,t=>{var{typed:e}=t;return e(lB,{"":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=>nt(n,r))})});var FX="bignumber",IX=["typed","BigNumber"],b_=M(FX,IX,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=>nt(i,n))})});var PX="complex",BX=["typed","Complex"],w_=M(PX,BX,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=>nt(i,n))})});var kX="fraction",$X=["typed","Fraction"],__=M(kX,$X,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=>nt(i,n))})});var cB="matrix",OX=["typed","Matrix","DenseMatrix","SparseMatrix"],A_=M(cB,OX,t=>{var{typed:e,Matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(cB,{"":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 fB="matrixFromFunction",RX=["typed","matrix","isZero"],S_=M(fB,RX,t=>{var{typed:e,matrix:r,isZero:n}=t;return e(fB,{"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 pB="matrixFromRows",LX=["typed","matrix","flatten","size"],E_=M(pB,LX,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(pB,{"...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 mB="matrixFromColumns",VX=["typed","matrix","flatten","size"],T_=M(mB,VX,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(mB,{"...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 dB="splitUnit",UX=["typed"],D_=M(dB,UX,t=>{var{typed:e}=t;return e(dB,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var hB="unaryMinus",qX=["typed"],M_=M(hB,qX,t=>{var{typed:e}=t;return e(hB,{number:yw,"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=>nt(n,r,!0))})});var gB="unaryPlus",zX=["typed","config","numeric"],C_=M(gB,zX,t=>{var{typed:e,config:r,numeric:n}=t;return e(gB,{number:xw,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=>nt(a,i,!0)),boolean:function(a){return n(a?1:0,r.number)},string:function(a){return n(a,Bi(a,r))}})});var vB="abs",HX=["typed"],N_=M(vB,HX,t=>{var{typed:e}=t;return e(vB,{number:dw,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),bigint:r=>r<0n?-r:r,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r,!0))})});var yB="apply",GX=["typed","isInteger"],Jl=M(yB,GX,t=>{var{typed:e,isInteger:r}=t;return e(yB,{"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)?ft(i):i.size();if(a<0||a>=s.length)throw new Si(a,s.length);return rt(i)?i.create(rv(i.valueOf(),a,o),i.datatype()):rv(i,a,o)}})});function rv(t,e,r){var n,i,a;if(e<=0)if(Array.isArray(t[0])){for(a=WX(t),i=[],n=0;n<a.length;n++)i[n]=rv(a[n],e-1,r);return i}else return r(t);else{for(i=[],n=0;n<t.length;n++)i[n]=rv(t[n],e-1,r);return i}}function WX(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 xB="addScalar",YX=["typed"],F_=M(xB,YX,t=>{var{typed:e}=t;return e(xB,{"number, number":hw,"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 bB="subtractScalar",jX=["typed"],I_=M(bB,jX,t=>{var{typed:e}=t;return e(bB,{"number, number":gw,"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 wB="cbrt",ZX=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],P_=M(wB,ZX,t=>{var{config:e,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=t;return r(wB,{number:Af,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(Af(d),0).mul(new o(0,p).exp());if(m){var x=[h,new o(Af(d),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(Af(d),0).mul(new o(0,p-Math.PI*2/3).exp())];return e.matrix==="Array"?x:a(x)}else return h}function c(f){if(f.value&&ra(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;ct(f.value)?d=new s(1).div(3):Xs(f.value)?d=new l(1,3):d=1/3;var h=f.pow(d);return p&&(h.value=i(h.value)),h}}});var JX="matAlgo11xS0s",XX=["typed","equalScalar"],Br=M(JX,XX,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,x=r,b=0,T=o;typeof m=="string"&&(h=m,x=e.find(r,[h,h]),b=e.convert(0,h),a=e.convert(a,h),T=e.find(o,[h,h]));for(var v=[],A=[],w=[],y=0;y<d;y++){w[y]=A.length;for(var E=c[y],D=c[y+1],_=E;_<D;_++){var C=u[_],N=s?T(a,l[_]):T(l[_],a);x(N,b)||(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 QX="matAlgo12xSfs",KX=["typed","DenseMatrix"],wr=M(QX,KX,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,x=o;typeof m=="string"&&(h=m,a=e.convert(a,h),x=e.find(o,[h,h]));for(var b=[],T=[],v=[],A=0;A<d;A++){for(var w=A+1,y=c[A],E=c[A+1],D=y;D<E;D++){var _=u[D];T[_]=l[D],v[_]=w}for(var C=0;C<p;C++)A===0&&(b[C]=[]),v[C]===w?b[C][A]=s?x(a,T[C]):x(T[C],a):b[C][A]=s?x(a,0):x(0,a)}return new r({data:b,size:[p,d],datatype:h})}});var eQ="matAlgo14xDs",tQ=["typed"],Fn=M(eQ,tQ,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:gt(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 B_="ceil",rQ=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],nQ=M(B_,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;return e(B_,{number:function(a){return Kr(a,n(a),r.relTol,r.absTol)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Kr(a,n(a,o),r.relTol,r.absTol))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.ceil(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),k_=M(B_,rQ,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=t,l=Br({typed:e,equalScalar:a}),u=wr({typed:e,DenseMatrix:s}),c=Fn({typed:e}),f=nQ({typed:e,config:r,round:n});return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,d){return p.ceil(d)},"Complex, BigNumber":function(p,d){return p.ceil(d.toNumber())},BigNumber:function(p){return mn(p,n(p),r.relTol,r.absTol)?n(p):p.ceil()},"BigNumber, BigNumber":function(p,d){return mn(p,n(p,d),r.relTol,r.absTol)?n(p,d):p.toDecimalPlaces(d.toNumber(),zl.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,d){return p.ceil(d)},"Fraction, BigNumber":function(p,d){return p.ceil(d.toNumber())},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var x=p.toNumeric(h);return h.multiply(m(x,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)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(p,m,!0)),"Array, number | BigNumber":e.referToSelf(m=>(p,d)=>nt(p,h=>m(h,d),!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)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,d)=>c(i(d),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,d)=>a(p,0)?o(d.size(),d.storage()):d.storage()==="dense"?c(d,p,m,!0):u(d,p,m,!0))})});var _B="cube",iQ=["typed"],$_=M(_B,iQ,t=>{var{typed:e}=t;return e(_B,{number:bw,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 AB="exp",aQ=["typed"],O_=M(AB,aQ,t=>{var{typed:e}=t;return e(AB,{number:ww,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var SB="expm1",oQ=["typed","Complex"],R_=M(SB,oQ,t=>{var{typed:e,Complex:r}=t;return e(SB,{number:_w,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 L_="fix",sQ=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],uQ=M(L_,["typed","ceil","floor"],t=>{var{typed:e,ceil:r,floor:n}=t;return e(L_,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),V_=M(L_,sQ,t=>{var{typed:e,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:l}=t,u=wr({typed:e,DenseMatrix:l}),c=Fn({typed:e}),f=uQ({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)},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 x=p.toNumeric(h);return h.multiply(m(x,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)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(p,m,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(m=>(p,d)=>nt(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 U_="floor",lQ=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],cQ=M(U_,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;return e(U_,{number:function(a){return Kr(a,n(a),r.relTol,r.absTol)?n(a):Math.floor(a)},"number, number":function(a,o){if(Kr(a,n(a,o),r.relTol,r.absTol))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.floor(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),om=M(U_,lQ,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=t,l=Br({typed:e,equalScalar:a}),u=wr({typed:e,DenseMatrix:s}),c=Fn({typed:e}),f=cQ({typed:e,config:r,round:n});return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,d){return p.floor(d)},"Complex, BigNumber":function(p,d){return p.floor(d.toNumber())},BigNumber:function(p){return mn(p,n(p),r.relTol,r.absTol)?n(p):p.floor()},"BigNumber, BigNumber":function(p,d){return mn(p,n(p,d),r.relTol,r.absTol)?n(p,d):p.toDecimalPlaces(d.toNumber(),zl.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,d){return p.floor(d)},"Fraction, BigNumber":function(p,d){return p.floor(d.toNumber())},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var x=p.toNumeric(h);return h.multiply(m(x,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)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(p,m,!0)),"Array, number | BigNumber":e.referToSelf(m=>(p,d)=>nt(p,h=>m(h,d),!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)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,d)=>c(i(d),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,d)=>a(p,0)?o(d.size(),d.storage()):d.storage()==="dense"?c(d,p,m,!0):u(d,p,m,!0))})});var fQ="matAlgo02xDS0",pQ=["typed","equalScalar"],In=M(fQ,pQ,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 Ct(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 x=u[0],b=u[1],T,v=r,A=0,w=o;typeof c=="string"&&c===h&&c!=="mixed"&&(T=c,v=e.find(r,[T,T]),A=e.convert(0,T),w=e.find(o,[T,T]));for(var y=[],E=[],D=[],_=0;_<b;_++){D[_]=E.length;for(var C=p[_],N=p[_+1],P=C;P<N;P++){var R=m[P],L=s?w(f[P],l[R][_]):w(l[R][_],f[P]);v(L,A)||(E.push(R),y.push(L))}}return D[b]=E.length,a.createSparseMatrix({values:y,index:E,ptr:D,size:[x,b],datatype:c===i._datatype&&h===a._datatype?T:void 0})}});var mQ="matAlgo03xDSf",dQ=["typed"],Zr=M(mQ,dQ,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 Ct(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],x=l[1],b,T=0,v=a;typeof u=="string"&&u===d&&u!=="mixed"&&(b=u,T=e.convert(0,b),v=e.find(a,[b,b]));for(var A=[],w=0;w<h;w++)A[w]=[];for(var y=[],E=[],D=0;D<x;D++){for(var _=D+1,C=m[D],N=m[D+1],P=C;P<N;P++){var R=f[P];y[R]=o?v(c[P],s[R][D]):v(s[R][D],c[P]),E[R]=_}for(var L=0;L<h;L++)E[L]===_?A[L][D]=y[L]:A[L][D]=o?v(T,s[L][D]):v(s[L][D],T)}return n.createDenseMatrix({data:A,size:[h,x],datatype:u===n._datatype&&d===i._datatype?b:void 0})}});var hQ="matAlgo05xSfSf",gQ=["typed","equalScalar"],Gu=M(hQ,gQ,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,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(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 b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));var E=s&&m?[]:void 0,D=[],_=[],C=E?[]:void 0,N=E?[]:void 0,P=[],R=[],L,V,k,B;for(V=0;V<T;V++){_[V]=D.length;var W=V+1;for(k=u[V],B=u[V+1];k<B;k++)L=l[k],D.push(L),P[L]=W,C&&(C[L]=s[k]);for(k=d[V],B=d[V+1];k<B;k++)L=p[k],P[L]!==W&&D.push(L),R[L]=W,N&&(N[L]=m[k]);if(E)for(k=_[V];k<D.length;){L=D[k];var O=P[L],Q=R[L];if(O===W||Q===W){var ie=O===W?C[L]:w,X=Q===W?N[L]:w,U=y(ie,X);A(U,w)?D.splice(k,1):(E.push(U),k++)}}}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var vQ="matAlgo13xDD",yQ=["typed"],EB=M(vQ,yQ,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 Ct(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,x=o;typeof u=="string"&&u===m&&(h=u,x=e.find(o,[h,h]));var b=p.length>0?r(x,0,p,p[0],s,c):[];return i.createDenseMatrix({data:b,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 ni(t,e){if(ba(t.size(),e.size()))return[t,e];var r=tm(t.size(),e.size());return[t,e].map(n=>xQ(n,r))}function xQ(t,e){return ba(t.size(),e)?t:t.create(hs(t.valueOf(),e),t.datatype())}var bQ="matrixAlgorithmSuite",wQ=["typed","matrix"],Pt=M(bQ,wQ,t=>{var{typed:e,matrix:r}=t,n=EB({typed:e}),i=Fn({typed:e});return function(o){var s=o.elop,l=o.SD||o.DS,u;s?(u={"DenseMatrix, DenseMatrix":(p,d)=>n(...ni(p,d),s),"Array, Array":(p,d)=>n(...ni(r(p),r(d)),s).valueOf(),"Array, DenseMatrix":(p,d)=>n(...ni(r(p),d),s),"DenseMatrix, Array":(p,d)=>n(...ni(p,r(d)),s)},o.SS&&(u["SparseMatrix, SparseMatrix"]=(p,d)=>o.SS(...ni(p,d),s,!1)),o.DS&&(u["DenseMatrix, SparseMatrix"]=(p,d)=>o.DS(...ni(p,d),s,!1),u["Array, SparseMatrix"]=(p,d)=>o.DS(...ni(r(p),d),s,!1)),l&&(u["SparseMatrix, DenseMatrix"]=(p,d)=>l(...ni(d,p),s,!0),u["SparseMatrix, Array"]=(p,d)=>l(...ni(r(d),p),s,!0))):(u={"DenseMatrix, DenseMatrix":e.referToSelf(p=>(d,h)=>n(...ni(d,h),p)),"Array, Array":e.referToSelf(p=>(d,h)=>n(...ni(r(d),r(h)),p).valueOf()),"Array, DenseMatrix":e.referToSelf(p=>(d,h)=>n(...ni(r(d),h),p)),"DenseMatrix, Array":e.referToSelf(p=>(d,h)=>n(...ni(d,r(h)),p))},o.SS&&(u["SparseMatrix, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.SS(...ni(d,h),p,!1))),o.DS&&(u["DenseMatrix, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.DS(...ni(d,h),p,!1)),u["Array, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.DS(...ni(r(d),h),p,!1))),l&&(u["SparseMatrix, DenseMatrix"]=e.referToSelf(p=>(d,h)=>l(...ni(h,d),p,!0)),u["SparseMatrix, Array"]=e.referToSelf(p=>(d,h)=>l(...ni(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&&Fg(u,s.signatures),u}});var TB="mod",_Q=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],sm=M(TB,_Q,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:l}=t,u=om({typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),c=In({typed:e,equalScalar:a}),f=Zr({typed:e}),m=Gu({typed:e,equalScalar:a}),p=Br({typed:e,equalScalar:a}),d=wr({typed:e,DenseMatrix:s}),h=Pt({typed:e,matrix:i,concat:l});return e(TB,{"number, number":x,"BigNumber, BigNumber":function(T,v){return v.isZero()?T:T.sub(v.mul(u(T.div(v))))},"bigint, bigint":function(T,v){if(v===0n)return T;if(T<0){var A=T%v;return A===0n?A:A+v}return T%v},"Fraction, Fraction":function(T,v){return v.equals(0)?T:T.sub(v.mul(u(T.div(v))))}},h({SS:m,DS:f,SD:c,Ss:p,sS:d}));function x(b,T){return T===0?b:b-T*u(b/T)}});var AQ="matAlgo01xDSid",SQ=["typed"],Ri=M(AQ,SQ,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 Ct(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],x=l[1],b=typeof u=="string"&&u!=="mixed"&&u===d?u:void 0,T=b?e.find(a,[b,b]):a,v,A,w=[];for(v=0;v<h;v++)w[v]=[];var y=[],E=[];for(A=0;A<x;A++){for(var D=A+1,_=m[A],C=m[A+1],N=_;N<C;N++)v=f[N],y[v]=o?T(c[N],s[v][A]):T(s[v][A],c[N]),E[v]=D;for(v=0;v<h;v++)E[v]===D?w[v][A]=y[v]:w[v][A]=s[v][A]}return n.createDenseMatrix({data:w,size:[h,x],datatype:u===n._datatype&&d===i._datatype?b:void 0})}});var EQ="matAlgo04xSidSid",TQ=["typed","equalScalar"],Tf=M(EQ,TQ,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,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(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 b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));var E=s&&m?[]:void 0,D=[],_=[],C=s&&m?[]:void 0,N=s&&m?[]:void 0,P=[],R=[],L,V,k,B,W;for(V=0;V<T;V++){_[V]=D.length;var O=V+1;for(B=u[V],W=u[V+1],k=B;k<W;k++)L=l[k],D.push(L),P[L]=O,C&&(C[L]=s[k]);for(B=d[V],W=d[V+1],k=B;k<W;k++)if(L=p[k],P[L]===O){if(C){var Q=y(C[L],m[k]);A(Q,w)?P[L]=null:C[L]=Q}}else D.push(L),R[L]=O,N&&(N[L]=m[k]);if(C&&N)for(k=_[V];k<D.length;)L=D[k],P[L]===O?(E[k]=C[L],k++):R[L]===O?(E[k]=N[L],k++):D.splice(k,1)}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var DQ="matAlgo10xSids",MQ=["typed","DenseMatrix"],Sa=M(DQ,MQ,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,x=o;typeof m=="string"&&(h=m,a=e.convert(a,h),x=e.find(o,[h,h]));for(var b=[],T=[],v=[],A=0;A<d;A++){for(var w=A+1,y=c[A],E=c[A+1],D=y;D<E;D++){var _=u[D];T[_]=l[D],v[_]=w}for(var C=0;C<p;C++)A===0&&(b[C]=[]),v[C]===w?b[C][A]=s?x(a,T[C]):x(T[C],a):b[C][A]=a}return new r({data:b,size:[p,d],datatype:h})}});function ru(t,e,r,n){if(!(this instanceof ru))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}ru.prototype=new Error;ru.prototype.constructor=Error;ru.prototype.name="ArgumentsError";ru.prototype.isArgumentsError=!0;var DB="gcd",CQ=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],q_="number | BigNumber | Fraction | Matrix | Array",NQ="".concat(q_,", ").concat(q_,", ...").concat(q_);function MB(t){return!t.some(e=>Array.isArray(e))}var z_=M(DB,CQ,t=>{var{typed:e,matrix:r,config:n,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:l,concat:u}=t,c=sm({typed:e,config:n,round:i,matrix:r,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}),f=Ri({typed:e}),m=Tf({typed:e,equalScalar:a}),p=Sa({typed:e,DenseMatrix:l}),d=Pt({typed:e,matrix:r,concat:u});return e(DB,{"number, number":h,"BigNumber, BigNumber":x,"Fraction, Fraction":(b,T)=>b.gcd(T)},d({SS:m,DS:f,Ss:p}),{[NQ]:e.referToSelf(b=>(T,v,A)=>{for(var w=b(T,v),y=0;y<A.length;y++)w=b(w,A[y]);return w}),Array:e.referToSelf(b=>T=>{if(T.length===1&&Array.isArray(T[0])&&MB(T[0]))return b(...T[0]);if(MB(T))return b(...T);throw new ru("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(b=>T=>b(T.toArray()))});function h(b,T){if(!Qe(b)||!Qe(T))throw new Error("Parameters in function gcd must be integer numbers");for(var v;T!==0;)v=c(b,T),b=T,T=v;return b<0?-b:b}function x(b,T){if(!b.isInt()||!T.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var v=new s(0);!T.isZero();){var A=c(b,T);b=T,T=A}return b.lt(v)?b.neg():b}});var FQ="matAlgo06xS0S0",IQ=["typed","equalScalar"],Wu=M(FQ,IQ,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 Ct(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,x=r,b=0,T=o;typeof u=="string"&&u===m&&u!=="mixed"&&(h=u,x=e.find(r,[h,h]),b=e.convert(0,h),T=e.find(o,[h,h]));for(var v=s&&c?[]:void 0,A=[],w=[],y=v?[]:void 0,E=[],D=[],_=0;_<d;_++){w[_]=A.length;var C=_+1;if(pw(i,_,E,y,D,C,A,T),pw(a,_,E,y,D,C,A,T),y)for(var N=w[_];N<A.length;){var P=A[N];if(D[P]===C){var R=y[P];x(R,b)?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];D[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 CB="lcm",PQ=["typed","matrix","equalScalar","concat"],H_=M(CB,PQ,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=In({typed:e,equalScalar:n}),o=Wu({typed:e,equalScalar:n}),s=Br({typed:e,equalScalar:n}),l=Pt({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 x=m(p,d),b=0;b<h.length;b++)x=m(x,h[b]);return x}),e(CB,{"number, number":Aw,"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()}});var NB="log10",BQ=["typed","config","Complex"],G_=M(NB,BQ,t=>{var{typed:e,config:r,Complex:n}=t;return e(NB,{number:function(a){return a>=0||r.predictable?Sw(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||r.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>nt(a,i))})});var FB="log2",kQ=["typed","config","Complex"],W_=M(FB,kQ,t=>{var{typed:e,config:r,Complex:n}=t;return e(FB,{number:function(o){return o>=0||r.predictable?Ew(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||r.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>nt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var $Q="multiplyScalar",OQ=["typed"],Y_=M($Q,OQ,t=>{var{typed:e}=t;return e("multiplyScalar",{"number, number":vw,"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 IB="multiply",RQ=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],j_=M(IB,RQ,t=>{var{typed:e,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=t,s=Br({typed:e,equalScalar:a}),l=Fn({typed:e});function u(w,y){switch(w.length){case 1:switch(y.length){case 1:if(w[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(w[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+w[0]+") must match Matrix rows ("+y[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+y.length+" dimensions)")}break;case 2:switch(y.length){case 1:if(w[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+w[1]+") must match Vector length ("+y[0]+")");break;case 2:if(w[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+w[1]+") must match Matrix B rows ("+y[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+y.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,y,E){if(E===0)throw new Error("Cannot multiply two empty vectors");return o(w,y)}function f(w,y){if(y.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return m(w,y)}function m(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),C=y._data,N=y._size,P=y._datatype||y.getDataType(),R=D[0],L=N[1],V,k=n,B=i;_&&P&&_===P&&typeof _=="string"&&_!=="mixed"&&(V=_,k=e.find(n,[V,V]),B=e.find(i,[V,V]));for(var W=[],O=0;O<L;O++){for(var Q=B(E[0],C[0][O]),ie=1;ie<R;ie++)Q=k(Q,B(E[ie],C[ie][O]));W[O]=Q}return w.createDenseMatrix({data:W,size:[L],datatype:_===w._datatype&&P===y._datatype?V:void 0})}var p=e("_multiplyMatrixVector",{"DenseMatrix, any":h,"SparseMatrix, any":T}),d=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":x,"DenseMatrix, SparseMatrix":b,"SparseMatrix, DenseMatrix":v,"SparseMatrix, SparseMatrix":A});function h(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),C=y._data,N=y._datatype||y.getDataType(),P=D[0],R=D[1],L,V=n,k=i;_&&N&&_===N&&typeof _=="string"&&_!=="mixed"&&(L=_,V=e.find(n,[L,L]),k=e.find(i,[L,L]));for(var B=[],W=0;W<P;W++){for(var O=E[W],Q=k(O[0],C[0]),ie=1;ie<R;ie++)Q=V(Q,k(O[ie],C[ie]));B[W]=Q}return w.createDenseMatrix({data:B,size:[P],datatype:_===w._datatype&&N===y._datatype?L:void 0})}function x(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),C=y._data,N=y._size,P=y._datatype||y.getDataType(),R=D[0],L=D[1],V=N[1],k,B=n,W=i;_&&P&&_===P&&typeof _=="string"&&_!=="mixed"&&_!=="mixed"&&(k=_,B=e.find(n,[k,k]),W=e.find(i,[k,k]));for(var O=[],Q=0;Q<R;Q++){var ie=E[Q];O[Q]=[];for(var X=0;X<V;X++){for(var U=W(ie[0],C[0][X]),pe=1;pe<L;pe++)U=B(U,W(ie[pe],C[pe][X]));O[Q][X]=U}}return w.createDenseMatrix({data:O,size:[R,V],datatype:_===w._datatype&&P===y._datatype?k:void 0})}function b(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),C=y._values,N=y._index,P=y._ptr,R=y._size,L=y._datatype||y._data===void 0?y._datatype:y.getDataType();if(!C)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var V=D[0],k=R[1],B,W=n,O=i,Q=a,ie=0;_&&L&&_===L&&typeof _=="string"&&_!=="mixed"&&(B=_,W=e.find(n,[B,B]),O=e.find(i,[B,B]),Q=e.find(a,[B,B]),ie=e.convert(0,B));for(var X=[],U=[],pe=[],we=y.createSparseMatrix({values:X,index:U,ptr:pe,size:[V,k],datatype:_===w._datatype&&L===y._datatype?B:void 0}),se=0;se<k;se++){pe[se]=U.length;var be=P[se],ee=P[se+1];if(ee>be)for(var Z=0,ne=0;ne<V;ne++){for(var de=ne+1,fe=void 0,Se=be;Se<ee;Se++){var _e=N[Se];Z!==de?(fe=O(E[ne][_e],C[Se]),Z=de):fe=W(fe,O(E[ne][_e],C[Se]))}Z===de&&!Q(fe,ie)&&(U.push(ne),X.push(fe))}}return pe[k]=U.length,we}function T(w,y){var E=w._values,D=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=y._data,P=y._datatype||y.getDataType(),R=w._size[0],L=y._size[0],V=[],k=[],B=[],W,O=n,Q=i,ie=a,X=0;C&&P&&C===P&&typeof C=="string"&&C!=="mixed"&&(W=C,O=e.find(n,[W,W]),Q=e.find(i,[W,W]),ie=e.find(a,[W,W]),X=e.convert(0,W));var U=[],pe=[];B[0]=0;for(var we=0;we<L;we++){var se=N[we];if(!ie(se,X))for(var be=_[we],ee=_[we+1],Z=be;Z<ee;Z++){var ne=D[Z];pe[ne]?U[ne]=O(U[ne],Q(se,E[Z])):(pe[ne]=!0,k.push(ne),U[ne]=Q(se,E[Z]))}}for(var de=k.length,fe=0;fe<de;fe++){var Se=k[fe];V[fe]=U[Se]}return B[1]=k.length,w.createSparseMatrix({values:V,index:k,ptr:B,size:[R,1],datatype:C===w._datatype&&P===y._datatype?W:void 0})}function v(w,y){var E=w._values,D=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=y._data,P=y._datatype||y.getDataType(),R=w._size[0],L=y._size[0],V=y._size[1],k,B=n,W=i,O=a,Q=0;C&&P&&C===P&&typeof C=="string"&&C!=="mixed"&&(k=C,B=e.find(n,[k,k]),W=e.find(i,[k,k]),O=e.find(a,[k,k]),Q=e.convert(0,k));for(var ie=[],X=[],U=[],pe=w.createSparseMatrix({values:ie,index:X,ptr:U,size:[R,V],datatype:C===w._datatype&&P===y._datatype?k:void 0}),we=[],se=[],be=0;be<V;be++){U[be]=X.length;for(var ee=be+1,Z=0;Z<L;Z++){var ne=N[Z][be];if(!O(ne,Q))for(var de=_[Z],fe=_[Z+1],Se=de;Se<fe;Se++){var _e=D[Se];se[_e]!==ee?(se[_e]=ee,X.push(_e),we[_e]=W(ne,E[Se])):we[_e]=B(we[_e],W(ne,E[Se]))}}for(var G=U[be],J=X.length,ge=G;ge<J;ge++){var xe=X[ge];ie[ge]=we[xe]}}return U[V]=X.length,pe}function A(w,y){var E=w._values,D=w._index,_=w._ptr,C=w._datatype||w._data===void 0?w._datatype:w.getDataType(),N=y._values,P=y._index,R=y._ptr,L=y._datatype||y._data===void 0?y._datatype:y.getDataType(),V=w._size[0],k=y._size[1],B=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 ie=B?[]:void 0,X=[],U=[],pe=w.createSparseMatrix({values:ie,index:X,ptr:U,size:[V,k],datatype:C===w._datatype&&L===y._datatype?W:void 0}),we=B?[]:void 0,se=[],be,ee,Z,ne,de,fe,Se,_e,G=0;G<k;G++){U[G]=X.length;var J=G+1;for(de=R[G],fe=R[G+1],ne=de;ne<fe;ne++)if(_e=P[ne],B)for(ee=_[_e],Z=_[_e+1],be=ee;be<Z;be++)Se=D[be],se[Se]!==J?(se[Se]=J,X.push(Se),we[Se]=Q(N[ne],E[be])):we[Se]=O(we[Se],Q(N[ne],E[be]));else for(ee=_[_e],Z=_[_e+1],be=ee;be<Z;be++)Se=D[be],se[Se]!==J&&(se[Se]=J,X.push(Se));if(B)for(var ge=U[G],xe=X.length,Ee=ge;Ee<xe;Ee++){var Be=X[Ee];ie[Ee]=we[Be]}}return U[k]=X.length,pe}return e(IB,i,{"Array, Array":e.referTo("Matrix, Matrix",w=>(y,E)=>{u(ft(y),ft(E));var D=w(r(y),r(E));return rt(D)?D.valueOf():D}),"Matrix, Matrix":function(y,E){var D=y.size(),_=E.size();return u(D,_),D.length===1?_.length===1?c(y,E,D[0]):f(y,E):_.length===1?p(y,E):d(y,E)},"Matrix, Array":e.referTo("Matrix,Matrix",w=>(y,E)=>w(y,r(E))),"Array, Matrix":e.referToSelf(w=>(y,E)=>w(r(y,E.storage()),E)),"SparseMatrix, any":function(y,E){return s(y,E,i,!1)},"DenseMatrix, any":function(y,E){return l(y,E,i,!1)},"any, SparseMatrix":function(y,E){return s(E,y,i,!0)},"any, DenseMatrix":function(y,E){return l(E,y,i,!0)},"Array, any":function(y,E){return l(r(y),E,i,!1).valueOf()},"any, Array":function(y,E){return l(r(E),y,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(w=>(y,E,D)=>{for(var _=w(y,E),C=0;C<D.length;C++)_=w(_,D[C]);return _})})});var PB="nthRoot",LQ=["typed","matrix","equalScalar","BigNumber","concat"],Z_=M(PB,LQ,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,concat:a}=t,o=Ri({typed:e}),s=In({typed:e,equalScalar:n}),l=Wu({typed:e,equalScalar:n}),u=Br({typed:e,equalScalar:n}),c=Pt({typed:e,matrix:r,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(PB,{number:Tw,"number, number":Tw,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,x=i.clone({precision:h+2}),b=new i(0),T=new x(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 x(1/0):0;if(!p.isFinite())return v?b:p;var A=p.abs().pow(T.div(d));return A=p.isNeg()?A.neg():A,new i((v?T.div(A):A).toPrecision(h))}});var BB="sign",VQ=["typed","BigNumber","Fraction","complex"],J_=M(BB,VQ,t=>{var{typed:e,BigNumber:r,complex:n,Fraction:i}=t;return e(BB,{number:Xg,Complex:function(o){return o.im===0?n(Xg(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=>nt(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 UQ="sqrt",qQ=["config","typed","Complex"],X_=M(UQ,qQ,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 kB="square",zQ=["typed"],Q_=M(kB,zQ,t=>{var{typed:e}=t;return e(kB,{number:Dw,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 $B="subtract",HQ=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],K_=M($B,HQ,t=>{var{typed:e,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=t,l=Ri({typed:e}),u=Zr({typed:e}),c=Gu({typed:e,equalScalar:n}),f=Sa({typed:e,DenseMatrix:o}),m=wr({typed:e,DenseMatrix:o}),p=Pt({typed:e,matrix:r,concat:s});return e($B,{"any, any":i},p({elop:i,SS:c,DS:l,SD:u,Ss:m,sS:f}))});var OB="xgcd",GQ=["typed","config","matrix","BigNumber"],e1=M(OB,GQ,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(OB,{"number, number":function(s,l){var u=Mw(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,x=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=x.minus(u.times(h)),x=l,o=s,s=c;var b;return o.lt(f)?b=[o.neg(),d.neg(),x.neg()]:b=[o,o.isZero()?0:d,x],r.matrix==="Array"?b:n(b)}});var RB="invmod",WQ=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],t1=M(RB,WQ,t=>{var{typed:e,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=t;return e(RB,{"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 YQ="matAlgo09xS0Sf",jQ=["typed","equalScalar"],nv=M(YQ,jQ,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,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(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 b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));var E=s&&m?[]:void 0,D=[],_=[],C=E?[]:void 0,N=[],P,R,L,V,k;for(R=0;R<T;R++){_[R]=D.length;var B=R+1;if(C)for(V=d[R],k=d[R+1],L=V;L<k;L++)P=p[L],N[P]=B,C[P]=m[L];for(V=u[R],k=u[R+1],L=V;L<k;L++)if(P=l[L],C){var W=N[P]===B?C[P]:w,O=y(s[L],W);A(O,w)||(D.push(P),E.push(O))}else D.push(P)}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var LB="dotMultiply",ZQ=["typed","matrix","equalScalar","multiplyScalar","concat"],r1=M(LB,ZQ,t=>{var{typed:e,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=t,o=In({typed:e,equalScalar:n}),s=nv({typed:e,equalScalar:n}),l=Br({typed:e,equalScalar:n}),u=Pt({typed:e,matrix:r,concat:a});return e(LB,u({elop:i,SS:s,DS:o,Ss:l}))});function VB(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 n1(t,e,function(n,i){return n&i})}function Df(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 UB(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:n1(t,e,function(i,a){return i|a})}function n1(t,e,r){var n=t.constructor,i,a,o=+(t.s<0),s=+(e.s<0);if(o){i=iv(Df(t));for(var l=0;l<i.length;++l)i[l]^=1}else i=iv(t);if(s){a=iv(Df(e));for(var u=0;u<a.length;++u)a[u]^=1}else a=iv(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,x=new n(h^1),b=new n(1),T=new n(2),v=n.precision;for(n.config({precision:1e9});p>0;)r(c[--p],f[--d])===h&&(x=x.plus(b)),b=b.times(T);for(;d>0;)r(m,f[--d])===h&&(x=x.plus(b)),b=b.times(T);return n.config({precision:v}),h===0&&(x.s=-x.s),x}function iv(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 qB(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)?Df(e):e.eq(n)?Df(t):!t.isFinite()||!e.isFinite()?!t.isFinite()&&!e.isFinite()?n:new r(t.isNegative()===e.isNegative()?1/0:-1/0):n1(t,e,function(i,a){return i^a})}function zB(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 HB(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 GB="bitAnd",JQ=["typed","matrix","equalScalar","concat"],um=M(GB,JQ,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=In({typed:e,equalScalar:n}),o=Wu({typed:e,equalScalar:n}),s=Br({typed:e,equalScalar:n}),l=Pt({typed:e,matrix:r,concat:i});return e(GB,{"number, number":Nw,"BigNumber, BigNumber":VB,"bigint, bigint":(u,c)=>u&c},l({SS:o,DS:a,Ss:s}))});var WB="bitNot",XQ=["typed"],i1=M(WB,XQ,t=>{var{typed:e}=t;return e(WB,{number:Fw,BigNumber:Df,bigint:r=>~r,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var YB="bitOr",QQ=["typed","matrix","equalScalar","DenseMatrix","concat"],lm=M(YB,QQ,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=Ri({typed:e}),s=Tf({typed:e,equalScalar:n}),l=Sa({typed:e,DenseMatrix:i}),u=Pt({typed:e,matrix:r,concat:a});return e(YB,{"number, number":Iw,"BigNumber, BigNumber":UB,"bigint, bigint":(c,f)=>c|f},u({SS:s,DS:o,Ss:l}))});var KQ="matAlgo07xSSf",eK=["typed","SparseMatrix"],Gn=M(KQ,eK,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 Ct(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,x=s;typeof u=="string"&&u===f&&u!=="mixed"&&(d=u,h=e.convert(0,d),x=e.find(s,[d,d]));for(var b=[],T=[],v=new Array(p+1).fill(0),A=[],w=[],y=[],E=[],D=0;D<p;D++){var _=D+1,C=0;n(a,D,y,A,_),n(o,D,E,w,_);for(var N=0;N<m;N++){var P=y[N]===_?A[N]:h,R=E[N]===_?w[N]:h,L=x(P,R);L!==0&&L!==!1&&(T.push(N),b.push(L),C++)}v[D+1]=v[D]+C}return new r({values:b,index:T,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 jB="bitXor",tK=["typed","matrix","DenseMatrix","concat","SparseMatrix"],a1=M(jB,tK,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:a}=t,o=Zr({typed:e}),s=Gn({typed:e,SparseMatrix:a}),l=wr({typed:e,DenseMatrix:n}),u=Pt({typed:e,matrix:r,concat:i});return e(jB,{"number, number":Pw,"BigNumber, BigNumber":qB,"bigint, bigint":(c,f)=>c^f},u({SS:s,DS:o,Ss:l}))});var ZB="arg",rK=["typed"],o1=M(ZB,rK,t=>{var{typed:e}=t;return e(ZB,{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=>nt(n,r))})});var JB="conj",nK=["typed"],s1=M(JB,nK,t=>{var{typed:e}=t;return e(JB,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var XB="im",iK=["typed"],u1=M(XB,iK,t=>{var{typed:e}=t;return e(XB,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var QB="re",aK=["typed"],l1=M(QB,aK,t=>{var{typed:e}=t;return e(QB,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var KB="not",oK=["typed"],c1=M(KB,oK,t=>{var{typed:e}=t;return e(KB,{"null | undefined":()=>!0,number:Lw,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=>nt(n,r))})});var ek="or",sK=["typed","matrix","equalScalar","DenseMatrix","concat"],cm=M(ek,sK,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=Zr({typed:e}),s=Gu({typed:e,equalScalar:n}),l=wr({typed:e,DenseMatrix:i}),u=Pt({typed:e,matrix:r,concat:a});return e(ek,{"number, number":Qg,"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":Qg,"Unit, Unit":e.referToSelf(c=>(f,m)=>c(f.value||0,m.value||0))},u({SS:s,DS:o,Ss:l}))});var tk="xor",uK=["typed","matrix","DenseMatrix","concat","SparseMatrix"],f1=M(tk,uK,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:a}=t,o=Zr({typed:e}),s=Gn({typed:e,SparseMatrix:a}),l=wr({typed:e,DenseMatrix:n}),u=Pt({typed:e,matrix:r,concat:i});return e(tk,{"number, number":Kg,"Complex, Complex":function(f,m){return(f.re!==0||f.im!==0)!=(m.re!==0||m.im!==0)},"bigint, bigint":Kg,"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 rk="concat",lK=["typed","matrix","isInteger"],fm=M(rk,lK,t=>{var{typed:e,matrix:r,isInteger:n}=t;return e(rk,{"...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(rt(m)&&(c=!0),At(m)||ct(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 Si(l,u+1)}else{var p=gt(m).valueOf(),d=ft(p);if(f[o]=p,u=l,l=d.length-1,o>0&&l!==u)throw new Ct(u+1,l+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var h=f.shift();f.length;)h=uw(h,f.shift(),l);return c?r(h):h},"...string":function(a){return a.join("")}})});var nk="column",cK=["typed","Index","matrix","range"],pm=M(nk,cK,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(nk,{"Matrix, number":a,"Array, number":function(s,l){return a(n(gt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");kr(s,o.size()[1]);var l=i(0,o.size()[0]),u=new r(l,s),c=o.subset(u);return rt(c)?c:n([[c]])}});var ik="count",fK=["typed","size","prod"],p1=M(ik,fK,t=>{var{typed:e,size:r,prod:n}=t;return e(ik,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var ak="cross",pK=["typed","matrix","subtract","multiply"],m1=M(ak,pK,t=>{var{typed:e,matrix:r,subtract:n,multiply:i}=t;return e(ak,{"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(ft(o).length,ft(s).length);o=bf(o),s=bf(s);var u=ft(o),c=ft(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 ok="diag",mK=["typed","matrix","DenseMatrix","SparseMatrix"],d1=M(ok,mK,t=>{var{typed:e,matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(ok,{Array:function(u){return a(u,0,ft(u),null)},"Array, number":function(u,c){return a(u,c,ft(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),ft(u),null)},"Array, string":function(u,c){return a(u,0,ft(u),c)},"Array, number, string":function(u,c,f){return a(u,c,ft(u),f)},"Array, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),ft(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(!Qe(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(rt(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),x=[],b=0;b<h;b++)x[b]=l[b+m][b+p];return c!==null?r(x):x}});var dK="filter",hK=["typed"],mm=M(dK,hK,t=>{var{typed:e}=t;return e("filter",{"Array, function":sk,"Matrix, function":function(n,i){return n.create(sk(n.valueOf(),i),n.datatype())},"Array, RegExp":ow,"Matrix, RegExp":function(n,i){return n.create(ow(n.valueOf(),i),n.datatype())}})});function sk(t,e){var r=wo(e,t,"filter");return qP(t,function(n,i,a){return r(n,[i],a)})}var uk="flatten",gK=["typed"],h1=M(uk,gK,t=>{var{typed:e}=t;return e(uk,{Array:function(n){return Ot(n)},Matrix:function(n){return n.create(Ot(n.toArray()),n.datatype())}})});var g1="forEach",vK=["typed"],dm=M(g1,vK,t=>{var{typed:e}=t;return e(g1,{"Array, function":yK,"Matrix, function":function(n,i){n.forEach(i)}})});function yK(t,e){rm(t,[],t,wo(e,t,g1))}var lk="getMatrixDataType",xK=["typed"],v1=M(lk,xK,t=>{var{typed:e}=t;return e(lk,{Array:function(n){return jl(n,cr)},Matrix:function(n){return n.getDataType()}})});var ck="identity",bK=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],y1=M(ck,bK,t=>{var{typed:e,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=t;return e(ck,{"":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=ct(u)||ct(c)?i:null;if(ct(u)&&(u=u.toNumber()),ct(c)&&(c=c.toNumber()),!Qe(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!Qe(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 x=Yo([],h,d),b=u<c?u:c,T=0;T<b;T++)x[T][T]=p;return x}});var fk="kron",wK=["typed","matrix","multiplyScalar"],x1=M(fk,wK,t=>{var{typed:e,matrix:r,multiplyScalar:n}=t;return e(fk,{"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(ft(a).length===1&&(a=[a]),ft(o).length===1&&(o=[o]),ft(a).length>2||ft(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 b1="map",_K=["typed"],hm=M(b1,_K,t=>{var{typed:e}=t;return e(b1,{"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=tm(...i.map(A=>A.isMatrix?A.size():ft(A))),l=o?(A,w)=>A.get(w):_f,u=o?i.map(A=>A.isMatrix?A.create(hs(A.toArray(),s),A.datatype()):i[0].create(hs(A.valueOf(),s))):i.map(A=>A.isMatrix?hs(A.toArray(),s):hs(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=b(p)}else{var d=i.length,h=T(a,d);c=b(h)}var x=(A,w)=>c([A,...u.slice(1).map(y=>l(y,w))],w);if(o)return u[0].map(x);return n(u[0],x);function b(A){switch(A){case 0:return w=>a(...w);case 1:return(w,y)=>a(...w,y);case 2:return(w,y)=>a(...w,y,...u)}}function T(A,w){return A.length>w+1?2:A.length===w+1?1:0}function v(A,w,y,E){return e.resolve(A,[...w,y,...E])!==null?2:e.resolve(A,[...w,y])!==null?1:(e.resolve(A,w)!==null,0)}}function n(i,a){return rm(i,[],i,wo(a,i,b1))}});var pk="diff",AK=["typed","matrix","subtract","number"],gm=M(pk,AK,t=>{var{typed:e,matrix:r,subtract:n,number:i}=t;return e(pk,{"Array | Matrix":function(c){return rt(c)?r(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!Qe(f))throw new RangeError("Dimension must be a whole number");return rt(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(rt(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){rt(u)&&(u=u.toArray()),rt(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 SK="ones",EK=["typed","config","matrix","BigNumber"],w1=M(SK,EK,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?Yo(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,m){ct(c)&&(u=!0,m[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!Qe(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function Mf(){throw new Error('No "bignumber" implementation available')}function av(){throw new Error('No "fraction" implementation available')}function ov(){throw new Error('No "matrix" implementation available')}var mk="range",TK=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],vm=M(mk,TK,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(mk,{string:m,"string, boolean":m,"number, number":function(x,b){return f(p(x,b,1,!1))},"number, number, number":function(x,b,T){return f(p(x,b,T,!1))},"number, number, boolean":function(x,b,T){return f(p(x,b,1,T))},"number, number, number, boolean":function(x,b,T,v){return f(p(x,b,T,v))},"BigNumber, BigNumber":function(x,b){var T=x.constructor;return f(p(x,b,new T(1),!1))},"BigNumber, BigNumber, BigNumber":function(x,b,T){return f(p(x,b,T,!1))},"BigNumber, BigNumber, boolean":function(x,b,T){var v=x.constructor;return f(p(x,b,new v(1),T))},"BigNumber, BigNumber, BigNumber, boolean":function(x,b,T,v){return f(p(x,b,T,v))},"Unit, Unit, Unit":function(x,b,T){return f(p(x,b,T,!1))},"Unit, Unit, Unit, boolean":function(x,b,T,v){return f(p(x,b,T,v))}});function f(h){return r.matrix==="Matrix"?n?n(h):ov():h}function m(h,x){var b=d(h);if(!b)throw new SyntaxError('String "'+h+'" is no valid range');return r.number==="BigNumber"?(i===void 0&&Mf(),f(p(i(b.start),i(b.end),i(b.step)),x)):f(p(b.start,b.end,b.step,x))}function p(h,x,b,T){for(var v=[],A=c(b)?T?o:a:T?l:s,w=h;A(w,x);)v.push(w),w=u(w,b);return v}function d(h){var x=h.split(":"),b=x.map(function(v){return Number(v)}),T=b.some(function(v){return isNaN(v)});if(T)return null;switch(b.length){case 2:return{start:b[0],end:b[1],step:1};case 3:return{start:b[0],end:b[2],step:b[1]};default:return null}}});var dk="reshape",DK=["typed","isInteger","matrix"],_1=M(dk,DK,t=>{var{typed:e,isInteger:r}=t;return e(dk,{"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)}),Kp(i,a)}})});var MK="resize",CK=["config","matrix"],A1=M(MK,CK,t=>{var{config:e,matrix:r}=t;return function(a,o,s){if(arguments.length!==2&&arguments.length!==3)throw new ru("resize",arguments.length,2,3);if(rt(o)&&(o=o.valueOf()),ct(o[0])&&(o=o.map(function(c){return ct(c)?c.toNumber():c})),rt(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 gt(a)}else{Array.isArray(a)||(a=[a]),a=gt(a);var u=Yo(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 Ct(a.length,1);var s=a[0];if(typeof s!="number"||!Qe(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 hk="rotate",NK=["typed","multiply","rotationMatrix"],S1=M(hk,NK,t=>{var{typed:e,multiply:r,rotationMatrix:n}=t;return e(hk,{"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)?ft(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 gk="rotationMatrix",FK=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],E1=M(gk,FK,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(gk,{"":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),b(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 b(v,A,w)},"number | BigNumber | Complex | Unit, Array, string":function(v,A,w){var y=l(A);return d(y),b(v,y,w)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,A,w){return d(A),b(v,A,w)}});function p(T,v){var A=ct(T),w=A?new s(-1):-1,y=f(T),E=m(T),D=[[y,n(w,E)],[E,y]];return x(D,v)}function d(T){var v=T.size();if(v.length<1||v[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function h(T){return T.reduce((v,A)=>n(v,A))}function x(T,v){if(v){if(v==="sparse")return new c(T);if(v==="dense")return new u(T);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return T}function b(T,v,A){var w=o(v);if(w===0)throw new RangeError("Rotation around zero vector");var y=ct(T)?s:null,E=y?new y(1):1,D=y?new y(-1):-1,_=y?new y(v.get([0])/w):v.get([0])/w,C=y?new y(v.get([1])/w):v.get([1])/w,N=y?new y(v.get([2])/w):v.get([2])/w,P=f(T),R=i(E,a(P)),L=m(T),V=i(P,h([_,_,R])),k=i(h([_,C,R]),h([D,N,L])),B=i(h([_,N,R]),h([C,L])),W=i(h([_,C,R]),h([N,L])),O=i(P,h([C,C,R])),Q=i(h([C,N,R]),h([D,_,L])),ie=i(h([_,N,R]),h([D,C,L])),X=i(h([C,N,R]),h([_,L])),U=i(P,h([N,N,R])),pe=[[V,k,B],[W,O,Q],[ie,X,U]];return x(pe,A)}});var vk="row",IK=["typed","Index","matrix","range"],ym=M(vk,IK,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(vk,{"Matrix, number":a,"Array, number":function(s,l){return a(n(gt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");kr(s,o.size()[0]);var l=i(0,o.size()[1]),u=new r(s,l),c=o.subset(u);return rt(c)?c:n([[c]])}});var yk="size",PK=["typed","config","?matrix"],T1=M(yk,PK,t=>{var{typed:e,config:r,matrix:n}=t;return e(yk,{Matrix:function(a){return a.create(a.size(),"number")},Array:ft,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"):ov()}})});var xk="squeeze",BK=["typed"],D1=M(xk,BK,t=>{var{typed:e}=t;return e(xk,{Array:function(n){return bf(gt(n))},Matrix:function(n){var i=bf(n.toArray());return Array.isArray(i)?n.create(i,n.datatype()):i},any:function(n){return gt(n)}})});var bk="subset",kK=["typed","matrix","zeros","add"],xm=M(bk,kK,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t;return e(bk,{"Matrix, Index":function(s,l){return Yl(l)?r():(Qp(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":OK,"string, Index":$K,"Matrix, Index, any, any":function(s,l,u,c){return Yl(l)?s:(Qp(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":wk,"string, Index, string, string":wk,"Object, Index, any":RK});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 $K(t,e){if(!Ou(e))throw new TypeError("Index expected");if(Yl(e))return"";if(Qp(Array.from(t),e),e.size().length!==1)throw new Ct(e.size().length,1);var r=t.length;kr(e.min()[0],r),kr(e.max()[0],r);var n=e.dimension(0),i="";return n.forEach(function(a){i+=t.charAt(a)}),i}function wk(t,e,r,n){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Yl(e))return t;if(Qp(Array.from(t),e),e.size().length!==1)throw new Ct(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 Ct(i.size()[0],r.length);var o=t.length;kr(e.min()[0]),kr(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 OK(t,e){if(!Yl(e)){if(e.size().length!==1)throw new Ct(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 nn(t,r)}}function RK(t,e,r){if(Yl(e))return t;if(e.size().length!==1)throw new Ct(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=gt(t);return ps(i,n,r),i}var _k="transpose",LK=["typed","matrix"],M1=M(_k,LK,t=>{var{typed:e,matrix:r}=t;return e(_k,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:gt});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]=gt(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=[],x=0;x<s;x++)h[x]=0;var b,T,v;for(b=0,T=c.length;b<T;b++)h[c[b]]++;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 y=f[v],E=f[v+1],D=y;D<E;D++){var _=h[c[D]]++;p[_]=v,u&&(m[_]=gt(u[D]))}return o.createSparseMatrix({values:m,index:p,ptr:d,size:[l,s],datatype:o._datatype})}});var Ak="ctranspose",VK=["typed","transpose","conj"],C1=M(Ak,VK,t=>{var{typed:e,transpose:r,conj:n}=t;return e(Ak,{any:function(a){return n(r(a))}})});var Sk="zeros",UK=["typed","config","matrix","BigNumber"],N1=M(Sk,UK,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(Sk,{"":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?Yo(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,m){ct(c)&&(u=!0,m[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!Qe(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}});var Ek="fft",qK=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],F1=M(Ek,qK,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(Ek,{Array:d,Matrix:function(v){return v.create(d(v.valueOf()),v.datatype())}});function d(T){var v=ft(T);return v.length===1?b(T,v[0]):h(T.map(A=>d(A,v.slice(1))),0)}function h(T,v){var A=ft(T);if(v!==0)return new Array(A[0]).fill(0).map((y,E)=>h(T[E],v-1));if(A.length===1)return b(T);function w(y){var E=ft(y);return new Array(E[1]).fill(0).map((D,_)=>new Array(E[0]).fill(0).map((C,N)=>y[N][_]))}return w(h(w(T),1))}function x(T){for(var v=T.length,A=o(a(i(-1,i(l,s)),v)),w=[],y=1-v;y<v;y++)w.push(f(A,a(f(y,2),2)));for(var E=f(2,m(p(v+v-1))),D=[...new Array(v).fill(0).map((k,B)=>i(T[B],w[v-1+B])),...new Array(E-v).fill(0)],_=[...new Array(v+v-1).fill(0).map((k,B)=>a(1,w[B])),...new Array(E-(v+v-1)).fill(0)],C=b(D),N=b(_),P=new Array(E).fill(0).map((k,B)=>i(C[B],N[B])),R=u(c(d(c(P))),E),L=[],V=v-1;V<v+v-1;V++)L.push(i(R[V],w[V]));return L}function b(T){var v=T.length;if(v===1)return[T[0]];if(v%2===0){for(var A=[...b(T.filter((D,_)=>_%2===0),v/2),...b(T.filter((D,_)=>_%2===1),v/2)],w=0;w<v/2;w++){var y=A[w],E=i(A[w+v/2],o(i(i(s,l),a(-w,v))));A[w]=n(y,E),A[w+v/2]=n(y,i(-1,E))}return A}else return x(T)}});var Tk="ifft",zK=["typed","fft","dotDivide","conj"],I1=M(Tk,zK,t=>{var{typed:e,fft:r,dotDivide:n,conj:i}=t;return e(Tk,{"Array | Matrix":function(o){var s=rt(o)?o.size():ft(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})});function Xl(t){"@babel/helpers - typeof";return Xl=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},Xl(t)}function Dk(t,e){if(Xl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mk(t){var e=Dk(t,"string");return Xl(e)=="symbol"?e:e+""}function Er(t,e,r){return(e=Mk(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ck(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 HK(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ck(Object(r),!0).forEach(function(n){Er(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ck(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var GK="solveODE",WK=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],P1=M(GK,WK,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 x(D){return function(_,C,N,P){var R=!(C.length===2&&(C.every(y)||C.every(bi)));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],k=f(V,L),B=P.firstStep;if(B!==void 0&&!u(B))throw new Error('"firstStep" must be positive');var W=P.maxStep;if(W!==void 0&&!u(W))throw new Error('"maxStep" must be positive');var O=P.minStep;if(O&&c(O))throw new Error('"minStep" must be positive or zero');var Q=[L,V,B,O,W].filter(St=>St!==void 0);if(!(Q.every(y)||Q.every(bi)))throw new Error('Inconsistent type of "t" dependant variables');for(var ie=1,X=P.tol?P.tol:1e-4,U=P.minDelta?P.minDelta:.2,pe=P.maxDelta?P.maxDelta:5,we=P.maxIter?P.maxIter:1e4,se=[L,V,...N,W,O].some(ct),[be,ee,Z,ne]=se?[d(D.a),d(D.c),d(D.b),d(D.bp)]:[D.a,D.c,D.b,D.bp],de=B?k?B:h(B):a(n(V,L),ie),fe=[L],Se=[N],_e=n(Z,ne),G=0,J=0,ge=A(k),xe=w(k);ge(fe[G],V);){var Ee=[];de=xe(fe[G],V,de),Ee.push(_(fe[G],Se[G]));for(var Be=1;Be<ee.length;++Be)Ee.push(_(r(fe[G],i(ee[Be],de)),r(Se[G],i(de,be[Be],Ee))));var Ue=o(l(s(i(_e,Ee),St=>bi(St)?St.value:St)));Ue<X&&X/Ue>1/4&&(fe.push(r(fe[G],de)),Se.push(r(Se[G],i(de,Z,Ee))),G++);var et=.84*(X/Ue)**(1/5);if(m(et,U)?et=U:f(et,pe)&&(et=pe),et=se?d(et):et,de=i(de,et),W&&f(l(de),W)?de=k?W:h(W):O&&m(l(de),O)&&(de=k?O:h(O)),J++,J>we)throw new Error("Maximum number of iterations reached, try changing options")}return{t:fe,y:Se}}}function b(D,_,C,N){var P=[[],[.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],k={a:P,c:R,b:L,bp:V};return x(k)(D,_,C,N)}function T(D,_,C,N){var P=[[],[.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],k={a:P,c:R,b:L,bp:V};return x(k)(D,_,C,N)}function v(D,_,C,N){var P=N.method?N.method:"RK45",R={RK23:b,RK45:T};if(P.toUpperCase()in R){var L=HK({},N);return delete L.method,R[P.toUpperCase()](D,_,C,L)}else{var V=Object.keys(R).map(B=>'"'.concat(B,'"')),k="".concat(V.slice(0,-1).join(", ")," and ").concat(V.slice(-1));throw new Error('Unavailable method "'.concat(P,'". Available methods are ').concat(k))}}function A(D){return D?m:f}function w(D){var _=D?f:m;return function(C,N,P){var R=r(C,P);return _(R,N)?n(N,C):P}}function y(D){return ct(D)||At(D)}function E(D,_,C,N){var P=v(D,_.toArray(),C.toArray(),N);return{t:p(P.t),y:p(P.y)}}return e("solveODE",{"function, Array, Array, Object":v,"function, Matrix, Matrix, Object":E,"function, Array, Array":(D,_,C)=>v(D,_,C,{}),"function, Matrix, Matrix":(D,_,C)=>E(D,_,C,{}),"function, Array, number | BigNumber | Unit":(D,_,C)=>{var N=v(D,_,[C],{});return{t:N.t,y:N.y.map(P=>P[0])}},"function, Matrix, number | BigNumber | Unit":(D,_,C)=>{var N=v(D,_.toArray(),[C],{});return{t:p(N.t),y:p(N.y.map(P=>P[0]))}},"function, Array, number | BigNumber | Unit, Object":(D,_,C,N)=>{var P=v(D,_,[C],N);return{t:P.t,y:P.y.map(R=>R[0])}},"function, Matrix, number | BigNumber | Unit, Object":(D,_,C,N)=>{var P=v(D,_.toArray(),[C],N);return{t:p(P.t),y:p(P.y.map(R=>R[0]))}}})});var YK="erf",jK=["typed"],B1=M(YK,jK,t=>{var{typed:e}=t;return e("name",{number:function(o){var s=Math.abs(o);return s>=XK?yo(o):s<=ZK?yo(o)*r(s):s<=4?yo(o)*(1-n(s)):yo(o)*(1-i(s))},"Array | Matrix":e.referToSelf(a=>o=>nt(o,a))});function r(a){var o=a*a,s=nu[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+nu[0][u])*o,l=(l+Cf[0][u])*o;return a*(s+nu[0][3])/(l+Cf[0][3])}function n(a){var o=nu[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+nu[1][l])*a,s=(s+Cf[1][l])*a;var u=(o+nu[1][7])/(s+Cf[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=nu[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+nu[2][u])*o,l=(l+Cf[2][u])*o;var c=o*(s+nu[2][4])/(l+Cf[2][4]);c=(JK-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),ZK=.46875,JK=.5641895835477563,nu=[[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]],Cf=[[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]],XK=Math.pow(2,53);var Nk="zeta",QK=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],k1=M(Nk,QK,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:x}=t;return e(Nk,{number:y=>b(y,E=>E,()=>20),BigNumber:y=>b(y,E=>new h(E),()=>Math.abs(Math.log10(r.relTol))),Complex:T});function b(y,E,D){return s(y,0)?E(-.5):s(y,1)?E(NaN):isFinite(y)?v(y,E,D,_=>_):u(y)?E(NaN):E(1)}function T(y){return y.re===0&&y.im===0?new d(-.5):y.re===1?new d(NaN,NaN):y.re===1/0&&y.im===0?new d(1):y.im===1/0||y.re===-1/0?new d(NaN,NaN):v(y,E=>E,E=>Math.round(1.3*15+.9*Math.abs(E.im)),E=>E.re)}function v(y,E,D,_){var C=D(y);if(_(y)>-(C-1)/2)return w(y,E(C),E);var N=n(i(2,y),i(E(x),m(y,1)));return N=n(N,f(n(a(E(x),2),y))),N=n(N,c(m(1,y))),n(N,v(m(1,y),E,D,_))}function A(y,E){for(var D=y,_=y;l(_,E);_=p(_,1)){var C=a(n(o(p(E,m(_,1))),i(4,_)),n(o(m(E,_)),o(n(2,_))));D=p(D,C)}return n(E,D)}function w(y,E,D){for(var _=a(1,n(A(D(0),E),m(1,i(2,m(1,y))))),C=D(0),N=D(1);l(N,E);N=p(N,1))C=p(C,a(n((-1)**(N-1),A(N,E)),i(N,y)));return n(_,C)}});var Fk="mode",KK=["typed","isNaN","isNumeric"],$1=M(Fk,KK,t=>{var{typed:e,isNaN:r,isNumeric:n}=t;return e(Fk,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=Ot(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 An(t,e,r){var n;return String(t).includes("Unexpected type")?(n=arguments.length>2?" (type: "+cr(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: "+cr(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):t}var Ik="prod",eee=["typed","config","multiplyScalar","numeric"],O1=M(Ik,eee,t=>{var{typed:e,config:r,multiplyScalar:n,numeric:i}=t;return e(Ik,{"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 An(u,"prod",l)}}),typeof s=="string"&&(s=i(s,Bi(s,r))),s===void 0)throw new Error("Cannot calculate prod of an empty array");return s}});var Pk="format",tee=["typed"],R1=M(Pk,tee,t=>{var{typed:e}=t;return e(Pk,{any:Dt,"any, Object | function | number | BigNumber":Dt})});var Bk="bin",ree=["typed","format"],L1=M(Bk,ree,t=>{var{typed:e,format:r}=t;return e(Bk,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var kk="oct",nee=["typed","format"],V1=M(kk,nee,t=>{var{typed:e,format:r}=t;return e(kk,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var $k="hex",iee=["typed","format"],U1=M($k,iee,t=>{var{typed:e,format:r}=t;return e($k,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var sv=/\$([\w.]+)/g;var Ok="print",aee=["typed"],bm=M(Ok,aee,t=>{var{typed:e}=t;return e(Ok,{"string, Object | Array":Rk,"string, Object | Array, number | Object":Rk})});function Rk(t,e,r){return t.replace(sv,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?bn(o)?o:Dt(o,r):n})}var Lk="to",oee=["typed","matrix","concat"],q1=M(Lk,oee,t=>{var{typed:e,matrix:r,concat:n}=t,i=Pt({typed:e,matrix:r,concat:n});return e(Lk,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var Vk="isPrime",see=["typed"],z1=M(Vk,see,t=>{var{typed:e}=t;return e(Vk,{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(T,v,A){for(var w=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),T=T.mul(T).mod(A)):(v=v.sub(1),w=T.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(T=>T<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 x=0,b=h;!b.eq(n.sub(1));x+=1,b=b.mul(b).mod(n))if(x===l-1)return!1}}return!0},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var uee="numeric",lee=["number","?bignumber","?fraction"],H1=M(uee,lee,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):Mf,bigint:o=>BigInt(o),Fraction:n?o=>n(o):av};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=cr(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 Uk="divideScalar",cee=["typed","numeric"],G1=M(Uk,cee,t=>{var{typed:e,numeric:r}=t;return e(Uk,{"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 qk="pow",fee=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],W1=M(qk,fee,t=>{var{typed:e,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=t;return e(qk,{"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 x=d.pow(h);if(x!=null)return x;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&&!Qe(d)&&p<0)try{var h=l(d),x=s(h);if((d===x||Math.abs((d-x)/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:Qe(d)||p>=0||r.predictable?Cw(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(!Qe(d))throw new TypeError("For A^b, b must be an integer (value is "+d+")");var h=ft(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(T){throw T.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+")"):T}for(var x=n(h[0]).valueOf(),b=p;d>=1;)(d&1)===1&&(x=i(b,x)),d>>=1,b=i(b,b);return x}function m(p,d){return a(f(p.valueOf(),d))}});var Nf="Number of decimals in function round must be an integer",zk="round",pee=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Y1=M(zk,pee,t=>{var{typed:e,config:r,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=t,l=Br({typed:e,equalScalar:i}),u=wr({typed:e,DenseMatrix:s}),c=Fn({typed:e});function f(m){return Math.abs(hf(m).exponent)}return e(zk,{number:function(p){var d=Sf(p,f(r.relTol)),h=Kr(p,d,r.relTol,r.absTol)?d:p;return Sf(h)},"number, number":function(p,d){var h=f(r.relTol);if(d>=h)return Sf(p,d);var x=Sf(p,h),b=Kr(p,x,r.relTol,r.absTol)?x:p;return Sf(b,d)},"number, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Nf);return new o(p).toDecimalPlaces(d.toNumber())},Complex:function(p){return p.round()},"Complex, number":function(p,d){if(d%1)throw new TypeError(Nf);return p.round(d)},"Complex, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Nf);var h=d.toNumber();return p.round(h)},BigNumber:function(p){var d=new o(p).toDecimalPlaces(f(r.relTol)),h=mn(p,d,r.relTol,r.absTol)?d:p;return h.toDecimalPlaces(0)},"BigNumber, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Nf);var h=f(r.relTol);if(d>=h)return p.toDecimalPlaces(d.toNumber());var x=p.toDecimalPlaces(h),b=mn(p,x,r.relTol,r.absTol)?x:p;return b.toDecimalPlaces(d.toNumber())},Fraction:function(p){return p.round()},"Fraction, number":function(p,d){if(d%1)throw new TypeError(Nf);return p.round(d)},"Fraction, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Nf);return p.round(d.toNumber())},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var x=p.toNumeric(h);return h.multiply(m(x,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)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(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 Hk="log",mee=["config","typed","typeOf","divideScalar","Complex"],j1=M(Hk,mee,t=>{var{typed:e,typeOf:r,config:n,divideScalar:i,Complex:a}=t;return e(Hk,{number:function(s){return s>=0||n.predictable?jP(s):new a(s,0).log()},Complex:function(s){return s.log()},BigNumber:function(s){return!s.isNegative()||n.predictable?s.ln():new a(s.toNumber(),0).log()},"any, any":e.referToSelf(o=>(s,l)=>{if(r(s)==="Fraction"&&r(l)==="Fraction"){var u=s.log(l);if(u!==null)return u}return i(o(s),o(l))})})});var Gk="log1p",dee=["typed","config","divideScalar","log","Complex"],Z1=M(Gk,dee,t=>{var{typed:e,config:r,divideScalar:n,log:i,Complex:a}=t;return e(Gk,{number:function(l){return l>=-1||r.predictable?Ig(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=>nt(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 Wk="nthRoots",hee=["config","typed","divideScalar","Complex"],J1=M(Wk,hee,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 x=(c+4*h)/l;if(x===Math.round(x)){p.push(a[x%4](d));continue}p.push(new i({r:d,phi:(f+2*Math.PI*h)/l}))}return p}return e(Wk,{Complex:function(l){return o(l,2)},"Complex, number":o})});var Yk="dotPow",gee=["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],X1=M(Yk,gee,t=>{var{typed:e,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=Zr({typed:e}),u=Gn({typed:e,SparseMatrix:s}),c=Br({typed:e,equalScalar:r}),f=wr({typed:e,DenseMatrix:a}),m=Pt({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(Yk,m({elop:h,SS:u,DS:l,Ss:c,sS:f}))});var jk="dotDivide",vee=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],Q1=M(jk,vee,t=>{var{typed:e,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=In({typed:e,equalScalar:n}),u=Zr({typed:e}),c=Gn({typed:e,SparseMatrix:s}),f=Br({typed:e,equalScalar:n}),m=wr({typed:e,DenseMatrix:a}),p=Pt({typed:e,matrix:r,concat:o});return e(jk,p({elop:i,SS:c,DS:u,SD:l,Ss:f,sS:m}))});function gs(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(rt(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(ql(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(qo(i)){for(var d=0;d<s;d++)u[d]=[0];for(var h=i._values,x=i._index,b=i._ptr,T=b[1],v=b[0];v<T;v++){var A=x[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(gr(i)){var w=ft(i);if(w.length===1){if(w[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var y=0;y<s;y++)u[y]=[i[y]];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 Zk="lsolve",yee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],K1=M(Zk,yee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Zk,{"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],x=[],b=f._data,T=0;T<h;T++){var v=p[T][0]||0,A=void 0;if(o(v,0))A=0;else{var w=b[T][T];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");A=n(v,w);for(var y=T+1;y<d;y++)p[y]=[a(p[y][0]||0,i(A,b[y][T]))]}x[T]=[A]}return new s({data:x,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],x=f._values,b=f._index,T=f._ptr,v=[],A=0;A<h;A++){var w=p[A][0]||0;if(o(w,0))v[A]=[0];else{for(var y=0,E=[],D=[],_=T[A],C=T[A+1],N=_;N<C;N++){var P=b[N];P===A?y=x[N]:P>A&&(E.push(x[N]),D.push(P))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(w,y),L=0,V=D.length;L<V;L++){var k=D[L];p[k]=[a(p[k][0]||0,i(R,E[L]))]}v[A]=[R]}}return new s({data:v,size:[d,1]})}});var Jk="usolve",xee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],eA=M(Jk,xee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Jk,{"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],x=[],b=f._data,T=h-1;T>=0;T--){var v=p[T][0]||0,A=void 0;if(o(v,0))A=0;else{var w=b[T][T];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");A=n(v,w);for(var y=T-1;y>=0;y--)p[y]=[a(p[y][0]||0,i(A,b[y][T]))]}x[T]=[A]}return new s({data:x,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],x=f._values,b=f._index,T=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 y=0,E=[],D=[],_=T[A],C=T[A+1],N=C-1;N>=_;N--){var P=b[N];P===A?y=x[N]:P<A&&(E.push(x[N]),D.push(P))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(w,y),L=0,V=D.length;L<V;L++){var k=D[L];p[k]=[a(p[k][0],i(R,E[L]))]}v[A]=[R]}}return new s({data:v,size:[d,1]})}});var Xk="lsolveAll",bee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],tA=M(Xk,bee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Xk,{"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(x=>x.valueOf())}});function u(f,m){for(var p=[l(f,m,!0)._data.map(D=>D[0])],d=f._data,h=f._size[0],x=f._size[1],b=0;b<x;b++)for(var T=p.length,v=0;v<T;v++){var A=p[v];if(o(d[b][b],0))if(o(A[b],0)){if(v===0){var y=[...A];y[b]=1;for(var E=b+1;E<x;E++)y[E]=a(y[E],d[E][b]);p.push(y)}}else{if(v===0)return[];p.splice(v,1),v-=1,T-=1}else{A[b]=n(A[b],d[b][b]);for(var w=b+1;w<x;w++)A[w]=a(A[w],i(A[b],d[w][b]))}}return p.map(D=>new s({data:D.map(_=>[_]),size:[h,1]}))}function c(f,m){for(var p=[l(f,m,!0)._data.map(ie=>ie[0])],d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=0;v<h;v++)for(var A=p.length,w=0;w<A;w++){for(var y=p[w],E=[],D=[],_=T[v],C=T[v+1],N=0,P=_;P<C;P++){var R=b[P];R===v?N=x[P]:R>v&&(E.push(x[P]),D.push(R))}if(o(N,0))if(o(y[v],0)){if(w===0){var B=[...y];B[v]=1;for(var W=0,O=D.length;W<O;W++){var Q=D[W];B[Q]=a(B[Q],E[W])}p.push(B)}}else{if(w===0)return[];p.splice(w,1),w-=1,A-=1}else{y[v]=n(y[v],N);for(var L=0,V=D.length;L<V;L++){var k=D[L];y[k]=a(y[k],i(y[v],E[L]))}}}return p.map(ie=>new s({data:ie.map(X=>[X]),size:[d,1]}))}});var Qk="usolveAll",wee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],rA=M(Qk,wee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Qk,{"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(x=>x.valueOf())}});function u(f,m){for(var p=[l(f,m,!0)._data.map(D=>D[0])],d=f._data,h=f._size[0],x=f._size[1],b=x-1;b>=0;b--)for(var T=p.length,v=0;v<T;v++){var A=p[v];if(o(d[b][b],0))if(o(A[b],0)){if(v===0){var y=[...A];y[b]=1;for(var E=b-1;E>=0;E--)y[E]=a(y[E],d[E][b]);p.push(y)}}else{if(v===0)return[];p.splice(v,1),v-=1,T-=1}else{A[b]=n(A[b],d[b][b]);for(var w=b-1;w>=0;w--)A[w]=a(A[w],i(A[b],d[w][b]))}}return p.map(D=>new s({data:D.map(_=>[_]),size:[h,1]}))}function c(f,m){for(var p=[l(f,m,!0)._data.map(ie=>ie[0])],d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=h-1;v>=0;v--)for(var A=p.length,w=0;w<A;w++){for(var y=p[w],E=[],D=[],_=T[v],C=T[v+1],N=0,P=C-1;P>=_;P--){var R=b[P];R===v?N=x[P]:R<v&&(E.push(x[P]),D.push(R))}if(o(N,0))if(o(y[v],0)){if(w===0){var B=[...y];B[v]=1;for(var W=0,O=D.length;W<O;W++){var Q=D[W];B[Q]=a(B[Q],E[W])}p.push(B)}}else{if(w===0)return[];p.splice(w,1),w-=1,A-=1}else{y[v]=n(y[v],N);for(var L=0,V=D.length;L<V;L++){var k=D[L];y[k]=a(y[k],i(y[v],E[L]))}}}return p.map(ie=>new s({data:ie.map(X=>[X]),size:[d,1]}))}});var _ee="matAlgo08xS0Sid",Aee=["typed","equalScalar"],Ff=M(_ee,Aee,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,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(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 b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));for(var E=[],D=[],_=[],C=[],N=[],P,R,L,V,k=0;k<T;k++){_[k]=D.length;var B=k+1;for(R=u[k],L=u[k+1],P=R;P<L;P++)V=l[P],N[V]=B,C[V]=s[P],D.push(V);for(R=d[k],L=d[k+1],P=R;P<L;P++)V=p[P],N[V]===B&&(C[V]=y(C[V],m[P]));for(P=_[k];P<D.length;){V=D[P];var W=C[V];A(W,w)?D.splice(P,1):(E.push(W),P++)}}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var If=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 Kk="leftShift",See=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],nA=M(Kk,See,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ri({typed:e}),l=In({typed:e,equalScalar:n}),u=Ff({typed:e,equalScalar:n}),c=Sa({typed:e,DenseMatrix:a}),f=Br({typed:e,equalScalar:n}),m=Fn({typed:e}),p=Pt({typed:e,matrix:r,concat:o}),d=If({typed:e,matrix:r});return e(Kk,{"number, number":Bw,"BigNumber, BigNumber":zB,"bigint, bigint":(h,x)=>h<<x,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():f(x,b,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():m(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):c(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):m(b,x,h,!0))},d,p({SS:u,DS:s,SD:l}))});var e$="rightArithShift",Eee=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],iA=M(e$,Eee,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ri({typed:e}),l=In({typed:e,equalScalar:n}),u=Ff({typed:e,equalScalar:n}),c=Sa({typed:e,DenseMatrix:a}),f=Br({typed:e,equalScalar:n}),m=Fn({typed:e}),p=Pt({typed:e,matrix:r,concat:o}),d=If({typed:e,matrix:r});return e(e$,{"number, number":kw,"BigNumber, BigNumber":HB,"bigint, bigint":(h,x)=>h>>x,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():f(x,b,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():m(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):c(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):m(b,x,h,!0))},d,p({SS:u,DS:s,SD:l}))});var t$="rightLogShift",Tee=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],aA=M(t$,Tee,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ri({typed:e}),l=In({typed:e,equalScalar:n}),u=Ff({typed:e,equalScalar:n}),c=Sa({typed:e,DenseMatrix:a}),f=Br({typed:e,equalScalar:n}),m=Fn({typed:e}),p=Pt({typed:e,matrix:r,concat:o}),d=If({typed:e,matrix:r});return e(t$,{"number, number":$w,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():f(x,b,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():m(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):c(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):m(b,x,h,!0))},d,p({SS:u,DS:s,SD:l}))});var r$="and",Dee=["typed","matrix","equalScalar","zeros","not","concat"],wm=M(r$,Dee,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=In({typed:e,equalScalar:n}),l=Wu({typed:e,equalScalar:n}),u=Br({typed:e,equalScalar:n}),c=Fn({typed:e}),f=Pt({typed:e,matrix:r,concat:o});return e(r$,{"number, number":ev,"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":ev,"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 uv="compare",Mee=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],oA=M(uv,Mee,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=t,u=Zr({typed:e}),c=Gu({typed:e,equalScalar:n}),f=wr({typed:e,DenseMatrix:s}),m=Pt({typed:e,matrix:i,concat:l}),p=Ao({typed:e});return e(uv,Cee({typed:e,config:r}),{"boolean, boolean":function(h,x){return h===x?0:h>x?1:-1},"BigNumber, BigNumber":function(h,x){return mn(h,x,r.relTol,r.absTol)?new a(0):new a(h.cmp(x))},"bigint, bigint":function(h,x){return h===x?0n:h>x?1n:-1n},"Fraction, Fraction":function(h,x){return new o(h.compare(x))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,m({SS:c,DS:u,Ss:f}))}),Cee=M(uv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(uv,{"number, number":function(i,a){return Kr(i,a,r.relTol,r.absTol)?0:i>a?1:-1}})});var Ql=zr(i$(),1);var a$="compareNatural",Nee=["typed","compare"],sA=M(a$,Nee,t=>{var{typed:e,compare:r}=t,n=r.signatures["boolean,boolean"];return e(a$,{"any, any":i});function i(l,u){var c=cr(l),f=cr(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,Ql.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,Ql.default)(c,f);if(c!==f)return(0,Ql.default)(c,f);if(c==="Complex")return Fee(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,Ql.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 qo(u)&&qo(c)?o(l,u.toJSON().values,c.toJSON().values):qo(u)?a(l,u.toArray(),c):qo(c)?a(l,u,c.toArray()):ql(u)?a(l,u.toJSON().data,c):ql(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(Ql.default),m.sort(Ql.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 Fee(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 o$="compareText",Iee=["typed","matrix","concat"];Wg.signature="any, any";var uA=M(o$,Iee,t=>{var{typed:e,matrix:r,concat:n}=t,i=Pt({typed:e,matrix:r,concat:n});return e(o$,Wg,i({elop:Wg,Ds:!0}))});var lv="equal",Pee=["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],lA=M(lv,Pee,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Zr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:r,concat:a});return e(lv,Bee({typed:e,equalScalar:n}),c({elop:n,SS:l,DS:s,Ss:u}))}),Bee=M(lv,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(lv,{"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 s$="equalText",kee=["typed","compareText","isZero"],cA=M(s$,kee,t=>{var{typed:e,compareText:r,isZero:n}=t;return e(s$,{"any, any":function(a,o){return n(r(a,o))}})});var cv="smaller",$ee=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],fA=M(cv,$ee,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Zr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=Ao({typed:e});return e(cv,Oee({typed:e,config:r}),{"boolean, boolean":(m,p)=>m<p,"BigNumber, BigNumber":function(p,d){return p.lt(d)&&!mn(p,d,r.relTol,r.absTol)},"bigint, bigint":(m,p)=>m<p,"Fraction, Fraction":(m,p)=>m.compare(p)===-1,"Complex, Complex":function(p,d){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:l,DS:s,Ss:u}))}),Oee=M(cv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(cv,{"number, number":function(i,a){return i<a&&!Kr(i,a,r.relTol,r.absTol)}})});var fv="smallerEq",Ree=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],pA=M(fv,Ree,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Zr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=Ao({typed:e});return e(fv,Lee({typed:e,config:r}),{"boolean, boolean":(m,p)=>m<=p,"BigNumber, BigNumber":function(p,d){return p.lte(d)||mn(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}))}),Lee=M(fv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(fv,{"number, number":function(i,a){return i<=a||Kr(i,a,r.relTol,r.absTol)}})});var pv="larger",Vee=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],mA=M(pv,Vee,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Zr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=Ao({typed:e});return e(pv,Uee({typed:e,config:r}),{"boolean, boolean":(m,p)=>m>p,"BigNumber, BigNumber":function(p,d){return p.gt(d)&&!mn(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}))}),Uee=M(pv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(pv,{"number, number":function(i,a){return i>a&&!Kr(i,a,r.relTol,r.absTol)}})});var mv="largerEq",qee=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],dA=M(mv,qee,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=Zr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=Ao({typed:e});return e(mv,zee({typed:e,config:r}),{"boolean, boolean":(m,p)=>m>=p,"BigNumber, BigNumber":function(p,d){return p.gte(d)||mn(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}))}),zee=M(mv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(mv,{"number, number":function(i,a){return i>=a||Kr(i,a,r.relTol,r.absTol)}})});var u$="deepEqual",Hee=["typed","equal"],hA=M(u$,Hee,t=>{var{typed:e,equal:r}=t;return e(u$,{"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 dv="unequal",Gee=["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],gA=M(dv,Gee,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=Zr({typed:e}),u=Gn({typed:e,SparseMatrix:s}),c=wr({typed:e,DenseMatrix:a}),f=Pt({typed:e,matrix:i,concat:o});return e(dv,Wee({typed:e,equalScalar:n}),f({elop:m,SS:u,DS:l,Ss:c}));function m(p,d){return!n(p,d)}}),Wee=M(dv,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(dv,{"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 l$="partitionSelect",Yee=["typed","isNumeric","isNaN","compare"],vA=M(l$,Yee,t=>{var{typed:e,isNumeric:r,isNaN:n,compare:i}=t,a=i,o=(u,c)=>-i(u,c);return e(l$,{"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(!Qe(c)||c<0)throw new Error("k must be a non-negative integer");if(rt(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,x=d,b=u[Math.floor(Math.random()*(d-p+1))+p];h<x;)if(f(u[h],b)>=0){var T=u[x];u[x]=u[h],u[h]=T,--x}else++h;f(u[h],b)>0&&--h,c<=h?d=h:p=h+1}return u[c]}});var c$="sort",jee=["typed","matrix","compare","compareNatural"],yA=M(c$,jee,t=>{var{typed:e,matrix:r,compare:n,compareNatural:i}=t,a=n,o=(c,f)=>-n(c,f);return e(c$,{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(ft(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 f$="max",Zee=["typed","config","numeric","larger"],_m=M(f$,Zee,t=>{var{typed:e,config:r,numeric:n,larger:i}=t;return e(f$,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Hu(l,u.valueOf(),a)},"...":function(l){if(_o(l))throw new TypeError("Scalar values expected in function max");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw An(u,"max",l)}}function o(s){var l;if(Oi(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw An(c,"max",u)}}),l===void 0)throw new Error("Cannot calculate max of an empty array");return typeof l=="string"&&(l=n(l,Bi(l,r))),l}});var p$="min",Jee=["typed","config","numeric","smaller"],Am=M(p$,Jee,t=>{var{typed:e,config:r,numeric:n,smaller:i}=t;return e(p$,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Hu(l,u.valueOf(),a)},"...":function(l){if(_o(l))throw new TypeError("Scalar values expected in function min");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw An(u,"min",l)}}function o(s){var l;if(Oi(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw An(c,"min",u)}}),l===void 0)throw new Error("Cannot calculate min of an empty array");return typeof l=="string"&&(l=n(l,Bi(l,r))),l}});var Xee="ImmutableDenseMatrix",Qee=["smaller","DenseMatrix"],xA=M(Xee,Qee,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&&!bn(a))throw new Error("Invalid datatype: "+a);if(rt(i)||gr(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&&gr(i.data)&&gr(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 ("+cr(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 rt(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:gt(this._data),size:gt(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 Kee="Index",ete=["ImmutableDenseMatrix","getMatrixDataType"],bA=M(Kee,ete,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=gr(l),c=rt(l),f=null;if(mf(l))this._dimensions.push(l),this._isScalar=!1;else if(u||c){var m=void 0;r(l)==="boolean"?(u&&(m=i(m$(l).valueOf())),c&&(m=i(m$(l._data).valueOf())),f=l.valueOf().length):m=i(l.valueOf()),this._dimensions.push(m);var p=m.size();(p.length!==1||p[0]!==1||f!==null)&&(this._isScalar=!1)}else if(typeof l=="number")this._dimensions.push(i([l]));else if(typeof l=="string")this._dimensions.push(l);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(f)}}n.prototype.type="Index",n.prototype.isIndex=!0;function i(a){for(var o=0,s=a.length;o<s;o++)if(typeof a[o]!="number"||!Qe(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=gt(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 m$(t){var e=[];return t.forEach((r,n)=>{r&&e.push(n)}),e}var tte="FibonacciHeap",rte=["smaller","larger"],wA=M(tte,rte,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 x;d>0;){for(var b=h.degree,T=h.right;x=p[b],!!x;){if(r(h.key,x.key)){var v=x;x=h,h=v}l(x,h),p[b]=null,b++}p[b]=h,h=T,d--}c=null;for(var A=0;A<m;A++)x=p[A],x&&(c?(x.left.right=x.right,x.right.left=x.left,x.left=c,x.right=c.right,c.right=x,x.right.left=x,e(x.key,c.key)&&(c=x)):c=x);return c}return i},{isClass:!0});var nte="Spa",ite=["addScalar","equalScalar","FibonacciHeap"],_A=M(nte,ite,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 d$(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 Kl(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:d$(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 h$=Kl(function(t){return new t(1).exp()},{hasher:hv}),g$=Kl(function(t){return new t(1).plus(new t(5).sqrt()).div(2)},{hasher:hv}),Sm=Kl(function(t){return t.acos(-1)},{hasher:hv}),v$=Kl(function(t){return Sm(t).times(2)},{hasher:hv});function hv(t){return t[0].precision}function y$(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 AA(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?y$(Object(r),!0).forEach(function(n){Er(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y$(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ate="Unit",ote=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],SA=M(ate,ote,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:x,Fraction:b}=t,T=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)||ra(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(xe=>0);else if(typeof J=="string"){var ge=v.parse(J);this.units=ge.units,this.dimensions=ge.dimensions}else if(bi(J)&&J.value===null)this.fixPrefix=J.fixPrefix,this.skipAutomaticSimplification=J.skipAutomaticSimplification,this.dimensions=J.dimensions.slice(0),this.units=J.units.map(xe=>sn({},xe));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,y;function E(){for(;y===" "||y===" ";)C()}function D(G){return G>="0"&&G<="9"||G==="."}function _(G){return G>="0"&&G<="9"}function C(){w++,y=A.charAt(w)}function N(G){w=G,y=A.charAt(w)}function P(){var G="",J=w;if(y==="+"?C():y==="-"&&(G+=y,C()),!D(y))return N(J),null;if(y==="."){if(G+=y,C(),!_(y))return N(J),null}else{for(;_(y);)G+=y,C();y==="."&&(G+=y,C())}for(;_(y);)G+=y,C();if(y==="E"||y==="e"){var ge="",xe=w;if(ge+=y,C(),(y==="+"||y==="-")&&(ge+=y,C()),!_(y))return N(xe),G;for(G=G+ge;_(y);)G+=y,C()}return G}function R(){for(var G="";_(y)||v.isValidAlpha(y);)G+=y,C();var J=G.charAt(0);return v.isValidAlpha(J)?G:null}function L(G){return y===G?(C(),G):null}v.parse=function(G,J){if(J=J||{},A=G,w=-1,y="",typeof A!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var ge=new v;ge.units=[];var xe=1,Ee=!1;C(),E();var Be=P(),Ue=null;if(Be){if(r.number==="BigNumber")Ue=new x(Be);else if(r.number==="Fraction")try{Ue=new b(Be)}catch{Ue=parseFloat(Be)}else Ue=parseFloat(Be);E(),L("*")?(xe=1,Ee=!0):L("/")&&(xe=-1,Ee=!0)}for(var et=[],St=1;;){for(E();y==="(";)et.push(xe),St*=xe,xe=1,C(),E();var Ye=void 0;if(y){var ur=y;if(Ye=R(),Ye===null)throw new SyntaxError('Unexpected "'+ur+'" in "'+A+'" at index '+w.toString())}else break;var Jt=V(Ye);if(Jt===null)throw new SyntaxError('Unit "'+Ye+'" not found.');var yr=xe*St;if(E(),L("^")){E();var Oe=P();if(Oe===null)throw new SyntaxError('In "'+G+'", "^" must be followed by a floating-point number');yr*=Oe}ge.units.push({unit:Jt.unit,prefix:Jt.prefix,power:yr});for(var j=0;j<W.length;j++)ge.dimensions[j]+=(Jt.unit.dimensions[j]||0)*yr;for(E();y===")";){if(et.length===0)throw new SyntaxError('Unmatched ")" in "'+A+'" at index '+w.toString());St/=et.pop(),C(),E()}if(Ee=!1,L("*")?(xe=1,Ee=!0):L("/")?(xe=-1,Ee=!0):xe=1,Jt.unit.base){var he=Jt.unit.base.key;se.auto[he]={unit:Jt.unit,prefix:Jt.prefix}}}if(E(),y)throw new SyntaxError('Could not parse: "'+G+'"');if(Ee)throw new SyntaxError('Trailing characters: "'+G+'"');if(et.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=Ue!==void 0?ge._normalize(Ue):null,ge},v.prototype.clone=function(){var G=new v;G.fixPrefix=this.fixPrefix,G.skipAutomaticSimplification=this.skipAutomaticSimplification,G.value=gt(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])ot(this.units[J],ge)&&(G.units[J][ge]=this.units[J][ge])}return G},v.prototype.valueType=function(){return cr(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(cr(G)),xe=0;xe<this.units.length;xe++){var Ee=ge(this.units[xe].unit.value),Be=ge(this.units[xe].prefix.value),Ue=ge(this.units[xe].power);J=a(J,s(a(Ee,Be),Ue))}return J},v.prototype._denormalize=function(G,J){if(G==null||this.units.length===0)return G;for(var ge=G,xe=v._getNumberConverter(cr(G)),Ee=0;Ee<this.units.length;Ee++){var Be=xe(this.units[Ee].unit.value),Ue=xe(this.units[Ee].prefix.value),et=xe(this.units[Ee].power);ge=o(ge,s(a(Be,Ue),et))}return ge};var V=Kl(G=>{if(ot(U,G)){var J=U[G],ge=J.prefixes[""];return{unit:J,prefix:ge}}for(var xe in U)if(ot(U,xe)&&$P(G,xe)){var Ee=U[xe],Be=G.length-xe.length,Ue=G.substring(0,Be),et=ot(Ee.prefixes,Ue)?Ee.prefixes[Ue]:void 0;if(et!==void 0)return{unit:Ee,prefix:et}}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=bi(G)?G:new v(G),xe=0;xe<W.length;xe++)J.dimensions[xe]=(this.dimensions[xe]||0)+(ge.dimensions[xe]||0);for(var Ee=0;Ee<ge.units.length;Ee++){var Be=AA({},ge.units[Ee]);J.units.push(Be)}if(this.value!==null||ge.value!==null){var Ue=this.value===null?this._normalize(1):this.value,et=ge.value===null?ge._normalize(1):ge.value;J.value=a(Ue,et)}else J.value=null;return bi(G)&&(J.skipAutomaticSimplification=!1),k(J)},v.prototype.divideInto=function(G){return new v(G).divide(this)},v.prototype.divide=function(G){for(var J=this.clone(),ge=bi(G)?G:new v(G),xe=0;xe<W.length;xe++)J.dimensions[xe]=(this.dimensions[xe]||0)-(ge.dimensions[xe]||0);for(var Ee=0;Ee<ge.units.length;Ee++){var Be=AA(AA({},ge.units[Ee]),{},{power:-ge.units[Ee].power});J.units.push(Be)}if(this.value!==null||ge.value!==null){var Ue=this.value===null?this._normalize(1):this.value,et=ge.value===null?ge._normalize(1):ge.value;J.value=o(Ue,et)}else J.value=null;return bi(G)&&(J.skipAutomaticSimplification=!1),k(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 xe=0;xe<J.units.length;xe++)J.units[xe].power*=G;return J.value!==null?J.value=s(J.value,G):J.value=null,J.skipAutomaticSimplification=!1,k(J)};function k(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),xe=J(G.units[0].unit.offset),Ee=a(ge,xe);G.value=i(l(n(G.value,Ee)),Ee)}for(var Be in G.units)(G.units[Be].unit.name==="VA"||G.units[Be].unit.name==="VAR")&&(G.units[Be].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(bi(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=gt(J);else{var xe=v._getNumberConverter(cr(J)),Ee=this.units[0].unit.value,Be=this.units[0].unit.offset,Ue=a(Ee,Be),et=ge.units[0].unit.value,St=ge.units[0].unit.offset,Ye=a(et,St);ge.value=n(J,xe(i(Ue,Ye)))}return ge.fixPrefix=!0,ge.skipAutomaticSimplification=!0,ge},v.prototype.toNumber=function(G){return T(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 xe in be)if(ot(be,xe)&&G.hasBase(O[xe])){ge=xe;break}if(ge==="NONE")G.units=[];else{var Ee;if(ge&&ot(be,ge)&&(Ee=be[ge]),Ee)G.units=[{unit:Ee.unit,prefix:Ee.prefix,power:1}];else{for(var Be=!1,Ue=0;Ue<W.length;Ue++){var et=W[Ue];Math.abs(G.dimensions[Ue]||0)>1e-12&&(ot(be,et)?J.push({unit:be[et].unit,prefix:be[et].prefix,power:G.dimensions[Ue]||0}):Be=!0)}J.length<G.units.length&&!Be&&(G.units=J)}}return G},v.prototype.toSI=function(){for(var G=this.clone(),J=[],ge=0;ge<W.length;ge++){var xe=W[ge];if(Math.abs(G.dimensions[ge]||0)>1e-12)if(ot(se.si,xe))J.push({unit:se.si[xe].unit,prefix:se.si[xe].prefix,power:G.dimensions[ge]||0});else throw new Error("Cannot express custom unit "+xe+" 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,xe=0,Ee=0;Ee<this.units.length;Ee++)this.units[Ee].power>0?(ge++,G+=" "+this.units[Ee].prefix.name+this.units[Ee].unit.name,Math.abs(this.units[Ee].power-1)>1e-15&&(G+="^"+this.units[Ee].power)):this.units[Ee].power<0&&xe++;if(xe>0)for(var Be=0;Be<this.units.length;Be++)this.units[Be].power<0&&(ge>0?(J+=" "+this.units[Be].prefix.name+this.units[Be].unit.name,Math.abs(this.units[Be].power+1)>1e-15&&(J+="^"+-this.units[Be].power)):(J+=" "+this.units[Be].prefix.name+this.units[Be].unit.name,J+="^"+this.units[Be].power));G=G.substr(1),J=J.substr(1),ge>1&&xe>0&&(G="("+G+")"),xe>1&&ge>0&&(J="("+J+")");var Ue=G;return ge>0&&xe>0&&(Ue+=" / "),Ue+=J,Ue},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&&ra(J.value)&&(ge=Math.abs(J.value.re)<1e-14);for(var xe in J.units)ot(J.units,xe)&&J.units[xe].unit&&(J.units[xe].unit.name==="VA"&&ge?J.units[xe].unit=U.VAR:J.units[xe].unit.name==="VAR"&&!ge&&(J.units[xe].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 Ee=J._denormalize(J.value),Be=J.value!==null?p(Ee,G||{}):"",Ue=J.formatUnits();return J.value&&ra(J.value)&&(Be="("+Be+")"),Ue.length>0&&Be.length>0&&(Be+=" "),Be+=Ue,Be},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 xe=this.units[0].power,Ee=Math.log(G/Math.pow(ge.value*J,xe))/Math.LN10-1.2;if(Ee>-2.200001&&Ee<1.800001)return ge;Ee=Math.abs(Ee);var Be=this.units[0].unit.prefixes;for(var Ue in Be)if(ot(Be,Ue)){var et=Be[Ue];if(et.scientific){var St=Math.abs(Math.log(G/Math.pow(et.value*J,xe))/Math.LN10-1.2);(St<Ee||St===Ee&&et.name.length<ge.name.length)&&(ge=et,Ee=St)}}return ge},v.prototype.splitUnit=function(G){for(var J=this.clone(),ge=[],xe=0;xe<G.length&&(J=J.to(G[xe]),xe!==G.length-1);xe++){var Ee=J.toNumeric(),Be=c(Ee),Ue=void 0,et=f(Be,Ee);et?Ue=Be:Ue=u(J.toNumeric());var St=new v(Ue,G[xe].toString());ge.push(St),J=i(J,St)}for(var Ye=0,ur=0;ur<ge.length;ur++)Ye=n(Ye,ge[ur].value);return f(Ye,this.value)&&(J.value=0),ge.push(J),ge};var B={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}}};B.SHORTLONG=sn({},B.SHORT,B.LONG),B.BINARY_SHORT=sn({},B.BINARY_SHORT_SI,B.BINARY_SHORT_IEC),B.BINARY_LONG=sn({},B.BINARY_LONG_SI,B.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)ot(O,Q)&&(O[Q].key=Q);var ie={},X={name:"",base:ie,value:1,offset:0,dimensions:W.map(G=>0)},U={meter:{name:"meter",base:O.LENGTH,prefixes:B.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:B.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:B.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:B.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:B.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:B.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:B.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:B.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:B.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:B.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:B.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:B.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:B.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:B.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:B.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:B.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:B.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:B.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:B.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:B.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:B.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:B.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:B.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:B.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:B.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:B.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:B.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:B.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:B.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:B.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:B.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:B.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:B.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:B.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:B.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:B.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:B.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:B.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:B.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:B.NONE,value:61611519921875e-21,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:B.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:B.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:B.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:B.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:B.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:B.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:B.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:B.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:B.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:B.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:B.NONE,value:.238480942392,offset:0},g:{name:"g",base:O.MASS,prefixes:B.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:B.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:B.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:B.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:B.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:B.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:B.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:B.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:B.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:B.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:B.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:B.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:B.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:B.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:B.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:B.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:B.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:B.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:B.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:B.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:B.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:B.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:B.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:B.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:B.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:B.NONE,value:7*86400,offset:0},month:{name:"month",base:O.TIME,prefixes:B.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:B.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:B.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:B.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:B.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:B.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:B.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:B.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:B.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:B.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:B.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:B.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:B.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:B.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:B.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:B.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:B.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:B.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:B.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:B.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:B.SHORT,value:new b(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:B.SHORT,value:new b(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:B.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:B.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:B.LONG,value:new b(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:B.LONG,value:new b(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:B.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:B.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:B.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:B.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:B.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:B.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:B.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:B.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:B.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:B.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:B.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:B.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:B.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:B.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:B.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:B.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:B.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:B.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:B.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:B.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:B.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:B.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:B.SHORT,value:h.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:B.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:B.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:B.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:B.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:B.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:B.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:B.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:B.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:B.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:B.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:B.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:B.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:B.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:B.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:B.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:B.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:B.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:B.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:B.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:B.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:B.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:B.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:B.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:B.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:B.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:B.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:B.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:B.BINARY_LONG,value:8,offset:0}},pe={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 we(G){if(G.number==="BigNumber"){var J=Sm(x);U.rad.value=new x(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}we(r),e&&e("config",function(G,J){G.number!==J.number&&we(G)});var se={si:{NONE:{unit:X,prefix:B.NONE[""]},LENGTH:{unit:U.m,prefix:B.SHORT[""]},MASS:{unit:U.g,prefix:B.SHORT.k},TIME:{unit:U.s,prefix:B.SHORT[""]},CURRENT:{unit:U.A,prefix:B.SHORT[""]},TEMPERATURE:{unit:U.K,prefix:B.SHORT[""]},LUMINOUS_INTENSITY:{unit:U.cd,prefix:B.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:U.mol,prefix:B.SHORT[""]},ANGLE:{unit:U.rad,prefix:B.SHORT[""]},BIT:{unit:U.bits,prefix:B.SHORT[""]},FORCE:{unit:U.N,prefix:B.SHORT[""]},ENERGY:{unit:U.J,prefix:B.SHORT[""]},POWER:{unit:U.W,prefix:B.SHORT[""]},PRESSURE:{unit:U.Pa,prefix:B.SHORT[""]},ELECTRIC_CHARGE:{unit:U.C,prefix:B.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:U.F,prefix:B.SHORT[""]},ELECTRIC_POTENTIAL:{unit:U.V,prefix:B.SHORT[""]},ELECTRIC_RESISTANCE:{unit:U.ohm,prefix:B.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:U.H,prefix:B.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:U.S,prefix:B.SHORT[""]},MAGNETIC_FLUX:{unit:U.Wb,prefix:B.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:U.T,prefix:B.SHORT[""]},FREQUENCY:{unit:U.Hz,prefix:B.SHORT[""]}}};se.cgs=JSON.parse(JSON.stringify(se.si)),se.cgs.LENGTH={unit:U.m,prefix:B.SHORT.c},se.cgs.MASS={unit:U.g,prefix:B.SHORT[""]},se.cgs.FORCE={unit:U.dyn,prefix:B.SHORT[""]},se.cgs.ENERGY={unit:U.erg,prefix:B.NONE[""]},se.us=JSON.parse(JSON.stringify(se.si)),se.us.LENGTH={unit:U.ft,prefix:B.NONE[""]},se.us.MASS={unit:U.lbm,prefix:B.NONE[""]},se.us.TEMPERATURE={unit:U.degF,prefix:B.NONE[""]},se.us.FORCE={unit:U.lbf,prefix:B.NONE[""]},se.us.ENERGY={unit:U.BTU,prefix:B.BTU[""]},se.us.POWER={unit:U.hp,prefix:B.NONE[""]},se.us.PRESSURE={unit:U.psi,prefix:B.NONE[""]},se.auto=JSON.parse(JSON.stringify(se.si));var be=se.auto;v.setUnitSystem=function(G){if(ot(se,G))be=se[G];else throw new Error("Unit system "+G+" does not exist. Choices are: "+Object.keys(se).join(", "))},v.getUnitSystem=function(){for(var G in se)if(ot(se,G)&&se[G]===be)return G},v.typeConverters={BigNumber:function(J){return J!=null&&J.isFraction?new x(String(J.n)).div(String(J.d)).times(String(J.s)):new x(J+"")},Fraction:function(J){return new b(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(ot(U,ee)){var Z=U[ee];Z.dimensions=Z.base.dimensions}for(var ne in pe)if(ot(pe,ne)){var de=U[pe[ne]],fe={};for(var Se in de)ot(de,Se)&&(fe[Se]=de[Se]);fe.name=ne,U[ne]=fe}v.isValidAlpha=function(J){return/^[a-zA-Z]$/.test(J)};function _e(G){for(var J=0;J<G.length;J++){if(y=G.charAt(J),J===0&&!v.isValidAlpha(y))throw new Error('Invalid unit name (must begin with alpha character): "'+G+'"');if(J>0&&!(v.isValidAlpha(y)||_(y)))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(ot(G,ge)&&v.deleteUnit(ge),G[ge].aliases)for(var xe=0;xe<G[ge].aliases.length;xe++)v.deleteUnit(G[ge].aliases[xe])}var Ee;for(var Be in G)ot(G,Be)&&(Ee=v.createUnitSingle(Be,G[Be]));return Ee},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(ot(U,G))throw new Error('Cannot create unit "'+G+'": a unit with that name already exists');_e(G);var ge=null,xe=[],Ee=0,Be,Ue,et;if(J&&J.type==="Unit")ge=J.clone();else if(typeof J=="string")J!==""&&(Be=J);else if(typeof J=="object")Be=J.definition,Ue=J.prefixes,Ee=J.offset,et=J.baseName,J.aliases&&(xe=J.aliases.valueOf());else throw new TypeError('Cannot create unit "'+G+'" from "'+J.toString()+'": expecting "string" or "Unit" or "Object"');if(xe){for(var St=0;St<xe.length;St++)if(ot(U,xe[St]))throw new Error('Cannot create alias "'+xe[St]+'": a unit with that name already exists')}if(Be&&typeof Be=="string"&&!ge)try{ge=v.parse(Be,{allowNoUnits:!0})}catch(Y){throw Y.message='Could not create unit "'+G+'" from "'+Be+'": '+Y.message,Y}else Be&&Be.type==="Unit"&&(ge=Be.clone());xe=xe||[],Ee=Ee||0,Ue&&Ue.toUpperCase?Ue=B[Ue.toUpperCase()]||B.NONE:Ue=B.NONE;var Ye={};if(ge){Ye={name:G,value:ge.value,dimensions:ge.dimensions.slice(0),prefixes:Ue,offset:Ee};var Oe=!1;for(var j in O)if(ot(O,j)){for(var he=!0,me=0;me<W.length;me++)if(Math.abs((Ye.dimensions[me]||0)-(O[j].dimensions[me]||0))>1e-12){he=!1;break}if(he){Oe=!0,Ye.base=O[j];break}}if(!Oe){et=et||G+"_STUFF";var Fe={dimensions:ge.dimensions.slice(0)};Fe.key=et,O[et]=Fe,be[et]={unit:Ye,prefix:B.NONE[""]},Ye.base=O[et]}}else{if(et=et||G+"_STUFF",W.indexOf(et)>=0)throw new Error('Cannot create new base unit "'+G+'": a base unit with that name already exists (and cannot be overridden)');W.push(et);for(var ur in O)ot(O,ur)&&(O[ur].dimensions[W.length-1]=0);for(var Jt={dimensions:[]},yr=0;yr<W.length;yr++)Jt.dimensions[yr]=0;Jt.dimensions[W.length-1]=1,Jt.key=et,O[et]=Jt,Ye={name:G,value:1,dimensions:O[et].dimensions.slice(0),prefixes:Ue,offset:Ee,base:O[et]},be[et]={unit:Ye,prefix:B.NONE[""]}}v.UNITS[G]=Ye;for(var ke=0;ke<xe.length;ke++){var Ae=xe[ke],Xe={};for(var F in Ye)ot(Ye,F)&&(Xe[F]=Ye[F]);Xe.name=Ae,v.UNITS[Ae]=Xe}return delete V.cache,new v(null,G)},v.deleteUnit=function(G){delete v.UNITS[G],delete V.cache},v.PREFIXES=B,v.BASE_DIMENSIONS=W,v.BASE_UNITS=O,v.UNIT_SYSTEMS=se,v.UNITS=U,v},{isClass:!0});var x$="unit",ste=["typed","Unit"],EA=M(x$,ste,t=>{var{typed:e,Unit:r}=t;return e(x$,{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=>nt(i,n))})});var b$="sparse",ute=["typed","SparseMatrix"],TA=M(b$,ute,t=>{var{typed:e,SparseMatrix:r}=t;return e(b$,{"":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 w$="createUnit",lte=["typed","Unit"],DA=M(w$,lte,t=>{var{typed:e,Unit:r}=t;return e(w$,{"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 _$="acos",cte=["typed","config","Complex"],MA=M(_$,cte,t=>{var{typed:e,config:r,Complex:n}=t;return e(_$,{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 A$="acosh",fte=["typed","config","Complex"],CA=M(A$,fte,t=>{var{typed:e,config:r,Complex:n}=t;return e(A$,{number:function(a){return a>=1||r.predictable?qw(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 S$="acot",pte=["typed","BigNumber"],NA=M(S$,pte,t=>{var{typed:e,BigNumber:r}=t;return e(S$,{number:zw,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var E$="acoth",mte=["typed","config","Complex","BigNumber"],FA=M(E$,mte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(E$,{number:function(o){return o>=1||o<=-1||r.predictable?Hw(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var T$="acsc",dte=["typed","config","Complex","BigNumber"],IA=M(T$,dte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(T$,{number:function(o){return o<=-1||o>=1||r.predictable?Gw(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var D$="acsch",hte=["typed","BigNumber"],PA=M(D$,hte,t=>{var{typed:e,BigNumber:r}=t;return e(D$,{number:Ww,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var M$="asec",gte=["typed","config","Complex","BigNumber"],BA=M(M$,gte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(M$,{number:function(o){return o<=-1||o>=1||r.predictable?Yw(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var C$="asech",vte=["typed","config","Complex","BigNumber"],kA=M(C$,vte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(C$,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return jw(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 N$="asin",yte=["typed","config","Complex"],$A=M(N$,yte,t=>{var{typed:e,config:r,Complex:n}=t;return e(N$,{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 xte="asinh",bte=["typed"],OA=M(xte,bte,t=>{var{typed:e}=t;return e("asinh",{number:Zw,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var wte="atan",_te=["typed"],RA=M(wte,_te,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 F$="atan2",Ate=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],LA=M(F$,Ate,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=t,s=In({typed:e,equalScalar:n}),l=Zr({typed:e}),u=nv({typed:e,equalScalar:n}),c=Br({typed:e,equalScalar:n}),f=wr({typed:e,DenseMatrix:a}),m=Pt({typed:e,matrix:r,concat:o});return e(F$,{"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 I$="atanh",Ste=["typed","config","Complex"],VA=M(I$,Ste,t=>{var{typed:e,config:r,Complex:n}=t;return e(I$,{number:function(a){return a<=1&&a>=-1||r.predictable?Jw(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var So=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 P$="cos",Ete=["typed"],UA=M(P$,Ete,t=>{var{typed:e}=t,r=So({typed:e});return e(P$,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var B$="cosh",Tte=["typed"],qA=M(B$,Tte,t=>{var{typed:e}=t;return e(B$,{number:Bg,"Complex | BigNumber":r=>r.cosh()})});var k$="cot",Dte=["typed","BigNumber"],zA=M(k$,Dte,t=>{var{typed:e,BigNumber:r}=t,n=So({typed:e});return e(k$,{number:Xw,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var $$="coth",Mte=["typed","BigNumber"],HA=M($$,Mte,t=>{var{typed:e,BigNumber:r}=t;return e($$,{number:Qw,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var O$="csc",Cte=["typed","BigNumber"],GA=M(O$,Cte,t=>{var{typed:e,BigNumber:r}=t,n=So({typed:e});return e(O$,{number:Kw,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var R$="csch",Nte=["typed","BigNumber"],WA=M(R$,Nte,t=>{var{typed:e,BigNumber:r}=t;return e(R$,{number:e_,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var L$="sec",Fte=["typed","BigNumber"],YA=M(L$,Fte,t=>{var{typed:e,BigNumber:r}=t,n=So({typed:e});return e(L$,{number:t_,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var V$="sech",Ite=["typed","BigNumber"],jA=M(V$,Ite,t=>{var{typed:e,BigNumber:r}=t;return e(V$,{number:r_,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var U$="sin",Pte=["typed"],ZA=M(U$,Pte,t=>{var{typed:e}=t,r=So({typed:e});return e(U$,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var q$="sinh",Bte=["typed"],JA=M(q$,Bte,t=>{var{typed:e}=t;return e(q$,{number:n_,"Complex | BigNumber":r=>r.sinh()})});var z$="tan",kte=["typed"],XA=M(z$,kte,t=>{var{typed:e}=t,r=So({typed:e});return e(z$,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var $te="tanh",Ote=["typed"],QA=M($te,Ote,t=>{var{typed:e}=t;return e("tanh",{number:kg,"Complex | BigNumber":r=>r.tanh()})});var H$="setCartesian",Rte=["typed","size","subset","compareNatural","Index","DenseMatrix"],KA=M(H$,Rte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(H$,{"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=Ot(Array.isArray(l)?l:l.toArray()).sort(i),m=Ot(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 G$="setDifference",Lte=["typed","size","subset","compareNatural","Index","DenseMatrix"],eS=M(G$,Lte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(G$,{"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 Ot(l.toArray());var f=eu(Ot(Array.isArray(l)?l:l.toArray()).sort(i)),m=eu(Ot(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)?wf(c):new o(wf(c))}})});var W$="setDistinct",Vte=["typed","size","subset","compareNatural","Index","DenseMatrix"],tS=M(W$,Vte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(W$,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=Ot(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 Y$="setIntersect",Ute=["typed","size","subset","compareNatural","Index","DenseMatrix"],rS=M(Y$,Ute,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(Y$,{"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=eu(Ot(Array.isArray(l)?l:l.toArray()).sort(i)),m=eu(Ot(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)?wf(c):new o(wf(c))}})});var j$="setIsSubset",qte=["typed","size","subset","compareNatural","Index"],nS=M(j$,qte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(j$,{"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=eu(Ot(Array.isArray(s)?s:s.toArray()).sort(i)),c=eu(Ot(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 Z$="setMultiplicity",zte=["typed","size","subset","compareNatural","Index"],iS=M(Z$,zte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(Z$,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=Ot(Array.isArray(l)?l:l.toArray()),c=0,f=0;f<u.length;f++)i(u[f],s)===0&&c++;return c}})});var J$="setPowerset",Hte=["typed","size","subset","compareNatural","Index"],aS=M(J$,Hte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(J$,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=Ot(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 X$="setSize",Gte=["typed","compareNatural"],oS=M(X$,Gte,t=>{var{typed:e,compareNatural:r}=t;return e(X$,{"Array | Matrix":function(i){return Array.isArray(i)?Ot(i).length:Ot(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?Ot(i).length:Ot(i.toArray()).length;for(var o=Ot(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 Q$="setSymDifference",Wte=["typed","size","concat","subset","setDifference","Index"],sS=M(Q$,Wte,t=>{var{typed:e,size:r,concat:n,subset:i,setDifference:a,Index:o}=t;return e(Q$,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return Ot(u);if(i(r(u),new o(0))===0)return Ot(l);var c=Ot(l),f=Ot(u);return n(a(c,f),a(f,c))}})});var K$="setUnion",Yte=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],uS=M(K$,Yte,t=>{var{typed:e,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=t;return e(K$,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return Ot(c);if(i(r(c),new s(0))===0)return Ot(u);var f=Ot(u),m=Ot(c);return n(o(f,m),a(f,m))}})});var eO="add",jte=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],lS=M(eO,jte,t=>{var{typed:e,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=t,l=Ri({typed:e}),u=Tf({typed:e,equalScalar:i}),c=Sa({typed:e,DenseMatrix:a}),f=Pt({typed:e,matrix:r,concat:s});return e(eO,{"any, any":n,"any, any, ...any":e.referToSelf(m=>(p,d,h)=>{for(var x=m(p,d),b=0;b<h.length;b++)x=m(x,h[b]);return x})},f({elop:n,DS:l,SS:u,Ss:c}))});var tO="hypot",Zte=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],cS=M(tO,Zte,t=>{var{typed:e,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:l}=t;return e(tO,{"... number | BigNumber":u,Array:u,Matrix:c=>u(Ot(c.toArray()))});function u(c){for(var f=0,m=0,p=0;p<c.length;p++){if(ra(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 rO="norm",Jte=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],fS=M(rO,Jte,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(rO,{number:Math.abs,Complex:function(D){return D.abs()},BigNumber:function(D){return D.abs()},boolean:function(D){return Math.abs(D)},Array:function(D){return y(f(D),2)},Matrix:function(D){return y(D,2)},"Array, number | BigNumber | string":function(D,_){return y(f(D),_)},"Matrix, number | BigNumber | string":function(D,_){return y(D,_)}});function d(E){var D=0;return E.forEach(function(_){var C=r(_);u(C,D)&&(D=C)},!0),D}function h(E){var D;return E.forEach(function(_){var C=r(_);(!D||c(C,D))&&(D=C)},!0),D||0}function x(E,D){if(D===Number.POSITIVE_INFINITY||D==="inf")return d(E);if(D===Number.NEGATIVE_INFINITY||D==="-inf")return h(E);if(D==="fro")return y(E,2);if(typeof D=="number"&&!isNaN(D)){if(!l(D,0)){var _=0;return E.forEach(function(C){_=n(i(r(C),D),_)},!0),i(_,1/D)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function b(E){var D=0;return E.forEach(function(_,C){D=n(D,s(_,a(_)))}),r(o(D))}function T(E){var D=[],_=0;return E.forEach(function(C,N){var P=N[1],R=n(D[P]||0,r(C));u(R,_)&&(_=R),D[P]=R},!0),_}function v(E){var D=E.size();if(D[0]!==D[1])throw new RangeError("Invalid matrix dimensions");var _=m(E),C=s(_,E),N=p(C).values.toArray(),P=N[N.length-1];return r(o(P))}function A(E){var D=[],_=0;return E.forEach(function(C,N){var P=N[0],R=n(D[P]||0,r(C));u(R,_)&&(_=R),D[P]=R},!0),_}function w(E,D){if(D===1)return T(E);if(D===Number.POSITIVE_INFINITY||D==="inf")return A(E);if(D==="fro")return b(E);if(D===2)return v(E);throw new Error("Unsupported parameter value "+D)}function y(E,D){var _=E.size();if(_.length===1)return x(E,D);if(_.length===2){if(_[0]&&_[1])return w(E,D);throw new RangeError("Invalid matrix dimensions")}}});var nO="dot",Xte=["typed","addScalar","multiplyScalar","conj","size"],pS=M(nO,Xte,t=>{var{typed:e,addScalar:r,multiplyScalar:n,conj:i,size:a}=t;return e(nO,{"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=rt(c)?c._data:c,d=rt(c)?c._datatype||c.getDataType():void 0,h=rt(f)?f._data:f,x=rt(f)?f._datatype||f.getDataType():void 0,b=u(c).length===2,T=u(f).length===2,v=r,A=n;if(d&&x&&d===x&&typeof d=="string"&&d!=="mixed"){var w=d;v=e.find(r,[w,w]),A=e.find(n,[w,w])}if(!b&&!T){for(var y=A(i(p[0]),h[0]),E=1;E<m;E++)y=v(y,A(i(p[E]),h[E]));return y}if(!b&&T){for(var D=A(i(p[0]),h[0][0]),_=1;_<m;_++)D=v(D,A(i(p[_]),h[_][0]));return D}if(b&&!T){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(b&&T){for(var P=A(i(p[0][0]),h[0][0]),R=1;R<m;R++)P=v(P,A(i(p[R][0]),h[R][0]));return P}}function l(c,f){o(c,f);for(var m=c._index,p=c._values,d=f._index,h=f._values,x=0,b=r,T=n,v=0,A=0;v<m.length&&A<d.length;){var w=m[v],y=d[A];if(w<y){v++;continue}if(w>y){A++;continue}w===y&&(x=b(x,T(p[v],h[A])),v++,A++)}return x}function u(c){return rt(c)?c.size():a(c)}});var Qte="trace",Kte=["typed","matrix","add"],mS=M(Qte,Kte,t=>{var{typed:e,matrix:r,add:n}=t;return e("trace",{Array:function(s){return i(r(s))},SparseMatrix:a,DenseMatrix:i,any:gt});function i(o){var s=o._size,l=o._data;switch(s.length){case 1:if(s[0]===1)return gt(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],x=u[d+1],b=h;b<x;b++){var T=l[b];if(T===d){p=n(p,s[b]);break}if(T>d)break}return p}throw new RangeError("Matrix must be square (size: "+Dt(c)+")")}});var iO="index",ere=["typed","Index"],dS=M(iO,ere,t=>{var{typed:e,Index:r}=t;return e(iO,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(s){return ct(s)?s.toNumber():gr(s)||rt(s)?s.map(function(l){return ct(l)?l.toNumber():l}):s}),o=new r;return r.apply(o,a),o}})});var gv=new Set(["end"]);var tre="Node",rre=["mathWithTransform"],hS=M(tre,rre,t=>{var{mathWithTransform:e}=t;function r(i){for(var a of[...gv])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=Js(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(!nr(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&&ba(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 Jr(t){return t&&t.isIndexError?new Si(t.index+1,t.min+1,t.max!==void 0?t.max+1:void 0):t}function vv(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 nn(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Jr(a)}}}var yv="AccessorNode",nre=["subset","Node"],gS=M(yv,nre,t=>{var{subset:e,Node:r}=t,n=vv({subset:e});function i(o){return!(Ha(o)||wi(o)||zt(o)||na(o)||Ru(o)||_i(o)||Yr(o))}class a extends r{constructor(s,l){if(super(),!nr(s))throw new TypeError('Node expected for parameter "object"');if(!vo(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 yv}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 nn(u(p,d,h),f)}}else return function(p,d,h){var x=u(p,d,h),b=c(p,d,x);return n(x,b)}}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:yv,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return Er(a,"name",yv),a},{isClass:!0,isNode:!0});var xv="ArrayNode",ire=["Node"],vS=M(xv,ire,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(nr))throw new TypeError("Array containing Nodes expected")}get type(){return xv}get isArrayNode(){return!0}_compile(i,a){var o=bo(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(bo(o,function(p){return p(c,f,m)}))}}else return function(c,f,m){return bo(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:xv,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(wi)&&!o.every(wi),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 Er(r,"name",xv),r},{isClass:!0,isNode:!0});function aO(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 ps(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(l){throw Jr(l)}}}var Eo=[{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 bv(t,e){if(!e||e!=="auto")return t;for(var r=t;_i(r);)r=r.content;return r}function Mr(t,e,r,n){var i=t;e!=="keep"&&(i=t.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<Eo.length;s++)if(a in Eo[s]){o=s;break}if(a==="OperatorNode:multiply"&&i.implicit&&r!=="show"){var l=bv(i.args[0],e);!(zt(l)&&n&&n.getIdentifier()==="OperatorNode:divide"&&jp(bv(n.args[0],e)))&&!(l.getIdentifier()==="OperatorNode:divide"&&jp(bv(l.args[0],e))&&zt(bv(l.args[1])))&&(o+=1)}return o}function Pf(t,e){var r=t;e!=="keep"&&(r=t.getContent());var n=r.getIdentifier(),i=Mr(r,e);if(i===null)return null;var a=Eo[i][n];if(ot(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 wv(t,e,r){var n=r!=="keep"?t.getContent():t,i=r!=="keep"?t.getContent():e,a=n.getIdentifier(),o=i.getIdentifier(),s=Mr(n,r);if(s===null)return null;var l=Eo[s][a];if(ot(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 oO(t){var e="OperatorNode:"+t;for(var r of Eo)if(e in r)return r[e].op;return null}var _v="AssignmentNode",are=["subset","?matrix","Node"],yS=M(_v,are,t=>{var{subset:e,matrix:r,Node:n}=t,i=vv({subset:e}),a=aO({subset:e,matrix:r});function o(l,u,c){u||(u="keep");var f=Mr(l,u,c),m=Mr(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,!Yr(u)&&!Ha(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Yr(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!vo(this.index))throw new TypeError('IndexNode expected as "index"');if(!nr(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 _v}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,y){var E=f(A,w,y),D=p(A,w,y);return ps(E,h,D),D}}else{if(Yr(this.object))return function(A,w,y){var E=f(A,w,y),D=p(A,w,y),_=m(A,w,E);return A.set(d,a(E,_,D)),D};var x=this.object.object._compile(u,c);if(this.object.index.isObjectProperty()){var b=this.object.index.getObjectProperty();return function(A,w,y){var E=x(A,w,y),D=nn(E,b),_=m(A,w,D),C=p(A,w,y);return ps(E,b,a(D,_,C)),C}}else{var T=this.object.index._compile(u,c);return function(A,w,y){var E=x(A,w,y),D=T(A,w,E),_=i(E,D),C=m(A,w,_),N=p(A,w,y);return a(E,D,a(_,C,N)),N}}}else{if(!Yr(this.object))throw new TypeError("SymbolNode expected as object");return function(A,w,y){var E=p(A,w,y);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:_v,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 Er(s,"name",_v),s},{isClass:!0,isNode:!0});var Av="BlockNode",ore=["ResultSet","Node"],xS=M(Av,ore,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(!nr(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 Av}get isBlockNode(){return!0}_compile(a,o){var s=bo(this.blocks,function(l){return{evaluate:l.node._compile(a,o),visible:l.visible}});return function(u,c,f){var m=[];return jg(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:Av,blocks:this.blocks}}static fromJSON(a){return new n(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
`)}}return Er(n,"name",Av),n},{isClass:!0,isNode:!0});var Sv="ConditionalNode",sre=["Node"],bS=M(Sv,sre,t=>{var{Node:e}=t;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(ct(i))return!i.isZero();if(ra(i))return!!(i.re||i.im);if(bi(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+cr(i)+'"')}class n extends e{constructor(a,o,s){if(super(),!nr(a))throw new TypeError("Parameter condition must be a Node");if(!nr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!nr(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return Sv}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(f,m,p){return r(s(f,m,p))?l(f,m,p):u(f,m,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.condition.toString(a),u=Mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),f=Mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c="("+c+")");var m=this.falseExpr.toString(a),p=Mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m="("+m+")"),l+" ? "+c+" : "+m}toJSON(){return{mathjs:Sv,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=Mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=Mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var m=this.falseExpr.toHTML(a),p=Mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+m}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return Er(n,"name",Sv),n},{isClass:!0,isNode:!0});var cO=zr(uO(),1);var _S={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},Ar={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"},AS={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Ar.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(Ar.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Ar.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Ar.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Ar.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Ar.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Ar.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(Ar.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(Ar.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Ar.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Ar.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Ar.bitAnd,"${args[1]}\\right)")},bitNot:{1:Ar.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Ar.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Ar.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Ar.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Ar.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Ar.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(Ar.and,"${args[1]}\\right)")},not:{1:Ar.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Ar.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Ar.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Ar.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(Ar.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Ar.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Ar.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Ar.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Ar.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Ar.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Ar.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Ar.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Ar.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(Ar.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(_S.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)"}},fO="\\mathrm{${name}}\\left(${args}\\right)",lO={deg:"^\\circ"};function Ev(t){return(0,cO.default)(t,{preserveFormatting:!0})}function Tv(t,e){return e=typeof e>"u"?!1:e,e?ot(lO,t)?lO[t]:"\\mathrm{"+Ev(t)+"}":ot(_S,t)?_S[t]:Ev(t)}var Dv="ConstantNode",fre=["Node"],SS=M(Dv,fre,t=>{var{Node:e}=t;class r extends e{constructor(i){super(),this.value=i}get type(){return Dv}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(cr(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:Dv,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i),o=cr(this.value);switch(o){case"string":return"\\mathtt{"+Ev(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 Er(r,"name",Dv),r},{isClass:!0,isNode:!0});var Mv="FunctionAssignmentNode",pre=["typed","Node"],ES=M(Mv,pre,t=>{var{typed:e,Node:r}=t;function n(a,o,s){var l=Mr(a,o,s),u=Mr(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(!nr(l))throw new TypeError('Node expected for parameter "expr"');if(gv.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 Mv}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);jg(this.params,function(d){l[d]=!0});var u=this.expr._compile(o,l),c=this.name,f=this.params,m=sw(this.types,","),p=c+"("+sw(this.params,", ")+")";return function(h,x,b){var T={};T[m]=function(){for(var A=Object.create(x),w=0;w<f.length;w++)A[f[w]]=arguments[w];return u(h,A,b)};var v=e(c,T);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:Mv,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">'+ri(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">'+ri(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(Tv).join(",")+"\\right)="+l}}return Er(i,"name",Mv),i},{isClass:!0,isNode:!0});var Cv="IndexNode",mre=["Node","size"],TS=M(Cv,mre,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(nr))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 Cv}get isIndexNode(){return!0}_compile(a,o){var s=bo(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,x,b){if(!rt(b)&&!gr(b)&&!bn(b))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+cr(b));var T=r(b).valueOf(),v=Object.create(x);return v.end=T[c],p(h,v,b)}}else return u._compile(a,o)}),l=nn(a,"index");return function(c,f,m){var p=bo(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&&zt(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:Cv,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">'+ri(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 Er(n,"name",Cv),n},{isClass:!0,isNode:!0});var Nv="ObjectNode",dre=["Node"],DS=M(Nv,dre,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 nr(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Nv}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(ot(this.properties,s)){var l=Wl(s),u=JSON.parse(l),c=nn(this.properties,s);o[u]=c._compile(i,a)}return function(m,p,d){var h={};for(var x in o)ot(o,x)&&(h[x]=o[x](m,p,d));return h}}forEach(i){for(var a in this.properties)ot(this.properties,a)&&i(this.properties[a],"properties["+Wl(a)+"]",this)}map(i){var a={};for(var o in this.properties)ot(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Wl(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)ot(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)ot(this.properties,o)&&a.push(Wl(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Nv,properties:this.properties}}static fromJSON(i){return new r(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)ot(this.properties,o)&&a.push('<span class="math-symbol math-property">'+ri(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)ot(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 Er(r,"name",Nv),r},{isClass:!0,isNode:!0});function ec(t,e){return new pf(t,new Bu(e),new Set(Object.keys(e)))}var Fv="OperatorNode",hre=["Node"],MS=M(Fv,hre,t=>{var{Node:e}=t;function r(a,o){var s=a;if(o==="auto")for(;_i(s);)s=s.content;return zt(s)?!0:Qr(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=Mr(a,o,s),f=Pf(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=Mr(l[0],o,s,a);if(u&&p!==null){var d,h;if(o==="keep"?(d=l[0].getIdentifier(),h=a.getIdentifier()):(d=l[0].getContent().getIdentifier(),h=a.getContent().getIdentifier()),Eo[c][h].latexLeftParens===!1){m=[!1];break}if(Eo[p][d].latexParens===!1){m=[!1];break}}if(p===null){m=[!1];break}if(p<=c){m=[!0];break}m=[!1]}break;case 2:{var x,b=Mr(l[0],o,s,a),T=wv(a,l[0],o);b===null?x=!1:b===c&&f==="right"&&!T||b<c?x=!0:x=!1;var v,A=Mr(l[1],o,s,a),w=wv(a,l[1],o);if(A===null?v=!1:A===c&&f==="left"&&!w||A<c?v=!0:v=!1,u){var y,E,D;o==="keep"?(y=a.getIdentifier(),E=a.args[0].getIdentifier(),D=a.args[1].getIdentifier()):(y=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),D=a.args[1].getContent().getIdentifier()),b!==null&&(Eo[c][y].latexLeftParens===!1&&(x=!1),Eo[b][E].latexParens===!1&&(x=!1)),A!==null&&(Eo[c][y].latexRightParens===!1&&(v=!1),Eo[A][D].latexParens===!1&&(v=!1))}m=[x,v]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(m=l.map(function(C){var N=Mr(C,o,s,a),P=wv(a,C,o),R=Pf(C,o);return N===null?!1:c===N&&f===R&&!P?!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"||!_i(l[_-1]))&&(m[_]=!0);return m}class i extends e{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(nr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return Fv}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!Dg(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=nn(o,this.fn),u=bo(this.args,function(d){return d._compile(o,s)});if(typeof l=="function"&&l.rawArgs===!0){var c=this.args;return function(h,x,b){return l(c,o,ec(h,x))}}else if(u.length===1){var f=u[0];return function(h,x,b){return l(f(h,x,b))}}else if(u.length===2){var m=u[0],p=u[1];return function(h,x,b){return l(m(h,x,b),p(h,x,b))}}else return function(h,x,b){return l.apply(null,bo(u,function(T){return T(h,x,b)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=Pf(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 x=u.map(function(b,T){return b=b.toString(o),c[T]&&(b="("+b+")"),b});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?x.join(" "):x.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Fv,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=Pf(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">'+ri(this.op)+"</span>"+m:m+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+ri(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">'+ri(this.op)+"</span>"+d}else{var h=u.map(function(x,b){return x=x.toHTML(o),c[b]&&(x='<span class="math-parenthesis math-round-parenthesis">(</span>'+x+'<span class="math-parenthesis math-round-parenthesis">)</span>'),x});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">'+ri(this.op)+"</span>"):'<span class="math-function">'+ri(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=Ar[this.fn];if(f=typeof f>"u"?this.op:f,u.length===1){var m=Pf(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 x=u[1],b=x.toTex(o);c[1]&&(b="\\left(".concat(b,"\\right)"));var T;switch(s==="keep"?T=d.getIdentifier():T=d.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+h+"}{"+b+"}";case"OperatorNode:pow":switch(h="{"+h+"}",b="{"+b+"}",T){case"ConditionalNode":case"OperatorNode:divide":h="\\left(".concat(h,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&l==="hide")return h+"~"+b}return h+f+b}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 Er(i,"name",Fv),i},{isClass:!0,isNode:!0});var Iv="ParenthesisNode",gre=["Node"],CS=M(Iv,gre,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),!nr(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return Iv}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:Iv,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 Er(r,"name",Iv),r},{isClass:!0,isNode:!0});var Pv="RangeNode",vre=["Node"],NS=M(Pv,vre,t=>{var{Node:e}=t;function r(i,a,o){var s=Mr(i,a,o),l={},u=Mr(i.start,a,o);if(l.start=u!==null&&u<=s||a==="all",i.step){var c=Mr(i.step,a,o);l.step=c!==null&&c<=s||a==="all"}var f=Mr(i.end,a,o);return l.end=f!==null&&f<=s||a==="all",l}class n extends e{constructor(a,o,s){if(super(),!nr(a))throw new TypeError("Node expected");if(!nr(o))throw new TypeError("Node expected");if(s&&!nr(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 Pv}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Yr(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:Pv,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 Er(n,"name",Pv),n},{isClass:!0,isNode:!0});var Bv="RelationalNode",yre=["Node"],FS=M(Bv,yre,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 Bv}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 x=nn(a,s.conditionals[h]);if(!x(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=Mr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=Mr(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:Bv,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=Mr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=Mr(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">'+ri(r[this.conditionals[c]])+"</span>"+l[c+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=Mr(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+=Ar[this.conditionals[c]]+l[c+1];return u}}return Er(n,"name",Bv),n},{isClass:!0,isNode:!0});var xre="SymbolNode",bre=["math","?Unit","Node"],IS=M(xre,bre,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 nn(m,u)};if(u in s)return function(f,m,p){return f.has(u)?f.get(u):nn(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=ri(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=Tv(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});var kv="FunctionNode",wre=["math","Node","SymbolNode"],PS=M(kv,wre,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(nr(h))f+=h.toTex(c);else if(Array.isArray(h))f+=h.map(function(x,b){if(nr(x))return x.toTex(c);throw new TypeError("Template: "+d[1]+"["+b+"] 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(nr(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)),!nr(u))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(nr))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 kv}get isFunctionNode(){return!0}_compile(u,c){var f=this.args.map(D=>D._compile(u,c));if(Yr(this.fn)){var m=this.fn.name;if(c[m]){var b=this.args;return function(_,C,N){var P=nn(C,m);if(typeof P!="function")throw new TypeError("Argument '".concat(m,"' was not a function; received: ").concat(a(P)));if(P.rawArgs)return P(b,u,ec(_,C));var R=f.map(L=>L(_,C,N));return P.apply(P,R)}}else{var p=m in u?nn(u,m):void 0,d=typeof p=="function"&&p.rawArgs===!0,h=D=>{var _;if(D.has(m))_=D.get(m);else if(m in u)_=nn(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 x=this.args;return function(_,C,N){var P=h(_);if(P.rawArgs===!0)return P(x,u,ec(_,C));var R=f.map(L=>L(_,C,N));return P(...R)}}else switch(f.length){case 0:return function(_,C,N){var P=h(_);return P()};case 1:return function(_,C,N){var P=h(_),R=f[0];return P(R(_,C,N))};case 2:return function(_,C,N){var P=h(_),R=f[0],L=f[1];return P(R(_,C,N),L(_,C,N))};default:return function(_,C,N){var P=h(_),R=f.map(L=>L(_,C,N));return P(...R)}}}}else if(Ha(this.fn)&&vo(this.fn.index)&&this.fn.index.isObjectProperty()){var T=this.fn.object._compile(u,c),v=this.fn.index.getObjectProperty(),A=this.args;return function(_,C,N){var P=T(_,C,N),R=O2(P,v);if(R!=null&&R.rawArgs)return R(A,u,ec(_,C));var L=f.map(V=>V(_,C,N));return R.apply(P,L)}}else{var w=this.fn.toString(),y=this.fn._compile(u,c),E=this.args;return function(_,C,N){var P=y(_,C,N);if(typeof P!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+`
`.concat(a(P)));if(P.rawArgs)return P(E,u,ec(_,C));var R=f.map(L=>L(_,C,N));return P.apply(P,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"&&ot(u.handler,f)&&(c=u.handler[f](this,u)),typeof c<"u"?c:super.toString(u)}_toString(u){var c=this.args.map(function(m){return m.toString(u)}),f=ms(this.fn)?"("+this.fn.toString(u)+")":this.fn.toString(u);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:kv,fn:this.fn,args:this.args}}_toHTML(u){var c=this.args.map(function(f){return f.toHTML(u)});return'<span class="math-function">'+ri(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(u){var c;return u&&typeof u.handler=="object"&&ot(u.handler,this.name)&&(c=u.handler[this.name](this,u)),typeof c<"u"?c:super.toTex(u)}_toTex(u){var c=this.args.map(function(p){return p.toTex(u)}),f;AS[this.name]&&(f=AS[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(f=r[this.name].toTex);var m;switch(typeof f){case"function":m=f(this,u);break;case"string":m=o(f,this,u);break;case"object":switch(typeof f[c.length]){case"function":m=f[c.length](this,u);break;case"string":m=o(f[c.length],this,u);break}}return typeof m<"u"?m:o(fO,this,u)}getIdentifier(){return this.type+":"+this.name}}return e=s,Er(s,"name",kv),Er(s,"onUndefinedFunction",function(l){throw new Error("Undefined function "+l)}),Er(s,"fromJSON",function(l){return new e(l.fn,l.args)}),s},{isClass:!0,isNode:!0});var pO="parse",_re=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],BS=M(pO,_re,t=>{var{typed:e,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:m,ObjectNode:p,OperatorNode:d,ParenthesisNode:h,RangeNode:x,RelationalNode:b,SymbolNode:T}=t,v=e(pO,{string:function(Y){return ie(Y,{})},"Array | Matrix":function(Y){return A(Y,{})},"string, Object":function(Y,ae){var Ce=ae.nodes!==void 0?ae.nodes:{};return ie(Y,Ce)},"Array | Matrix, Object":A});function A(F){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=Y.nodes!==void 0?Y.nodes:{};return nt(F,function(Ce){if(typeof Ce!="string")throw new TypeError("String expected");return ie(Ce,ae)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},y={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},D={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"],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 P(F,Y){return F.expression.substr(F.index,Y)}function R(F){return P(F,1)}function L(F){F.index++}function V(F){return F.expression.charAt(F.index-1)}function k(F){return F.expression.charAt(F.index+1)}function B(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),ae=P(F,2),Ce=P(F,3);if(Ce.length===3&&y[Ce]){F.tokenType=w.DELIMITER,F.token=Ce,L(F),L(F),L(F);return}if(ae.length===2&&y[ae]){F.tokenType=w.DELIMITER,F.token=ae,L(F),L(F);return}if(y[Y]){F.tokenType=w.DELIMITER,F.token=Y,L(F);return}if(v.isDigitDot(Y)){F.tokenType=w.NUMBER;var tt=P(F,2);if(tt==="0b"||tt==="0o"||tt==="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),k(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(k(F))||k(F)==="-"||k(F)==="+"){if(F.token+=R(F),L(F),(R(F)==="+"||R(F)==="-")&&(F.token+=R(F),L(F)),!v.isDigit(R(F)))throw Ae(F,'Digit expected, got "'+R(F)+'"');for(;v.isDigit(R(F));)F.token+=R(F),L(F);if(v.isDecimalMark(R(F),k(F)))throw Ae(F,'Digit expected, got "'+R(F)+'"')}else if(k(F)===".")throw L(F),Ae(F,'Digit expected, got "'+R(F)+'"')}return}if(v.isAlpha(R(F),V(F),k(F))){for(;v.isAlpha(R(F),V(F),k(F))||v.isDigit(R(F));)F.token+=R(F),L(F);ot(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 Ae(F,'Syntax error in part "'+F.token+'"')}function W(F){do B(F);while(F.token===`
`)}function O(F){F.nestingLevel++}function Q(F){F.nestingLevel--}v.isAlpha=function(Y,ae,Ce){return v.isValidLatinOrGreek(Y)||v.isValidMathSymbol(Y,Ce)||v.isValidMathSymbol(ae,Y)},v.isValidLatinOrGreek=function(Y){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Y)},v.isValidMathSymbol=function(Y,ae){return/^[\uD835]$/.test(Y)&&/^[\uDC00-\uDFFF]$/.test(ae)&&/^[^\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(ae)},v.isWhitespace=function(Y,ae){return Y===" "||Y===" "||Y===`
`&&ae>0},v.isDecimalMark=function(Y,ae){return Y==="."&&ae!=="/"&&ae!=="*"&&ae!=="^"},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 ie(F,Y){var ae=N();sn(ae,{expression:F,extraNodes:Y}),B(ae);var Ce=X(ae);if(ae.token!=="")throw ae.tokenType===w.DELIMITER?Xe(ae,"Unexpected operator "+ae.token):Ae(ae,'Unexpected part "'+ae.token+'"');return Ce}function X(F){var Y,ae=[],Ce;for(F.token!==""&&F.token!==`
`&&F.token!==";"&&(Y=U(F),F.comment&&(Y.comment=F.comment));F.token===`
`||F.token===";";)ae.length===0&&Y&&(Ce=F.token!==";",ae.push({node:Y,visible:Ce})),B(F),F.token!==`
`&&F.token!==";"&&F.token!==""&&(Y=U(F),F.comment&&(Y.comment=F.comment),Ce=F.token!==";",ae.push({node:Y,visible:Ce}));return ae.length>0?new s(ae):(Y||(Y=new u(void 0),F.comment&&(Y.comment=F.comment)),Y)}function U(F){var Y,ae,Ce,tt,vt=pe(F);if(F.token==="="){if(Yr(vt))return Y=vt.name,W(F),Ce=U(F),new o(new T(Y),Ce);if(Ha(vt))return W(F),Ce=U(F),new o(vt.object,vt.index,Ce);if(na(vt)&&Yr(vt.fn)&&(tt=!0,ae=[],Y=vt.name,vt.args.forEach(function(_r,ze){Yr(_r)?ae[ze]=_r.name:tt=!1}),tt))return W(F),Ce=U(F),new c(Y,ae,Ce);throw Ae(F,"Invalid left hand side of assignment operator =")}return vt}function pe(F){for(var Y=we(F);F.token==="?";){var ae=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,W(F);var Ce=Y,tt=U(F);if(F.token!==":")throw Ae(F,"False part of conditional expression expected");F.conditionalLevel=null,W(F);var vt=U(F);Y=new l(Ce,tt,vt),F.conditionalLevel=ae}return Y}function we(F){for(var Y=se(F);F.token==="or";)W(F),Y=new d("or","or",[Y,se(F)]);return Y}function se(F){for(var Y=be(F);F.token==="xor";)W(F),Y=new d("xor","xor",[Y,be(F)]);return Y}function be(F){for(var Y=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=ne(F);F.token==="^|";)W(F),Y=new d("^|","bitXor",[Y,ne(F)]);return Y}function ne(F){for(var Y=de(F);F.token==="&";)W(F),Y=new d("&","bitAnd",[Y,de(F)]);return Y}function de(F){for(var Y=[fe(F)],ae=[],Ce={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};ot(Ce,F.token);){var tt={name:F.token,fn:Ce[F.token]};ae.push(tt),W(F),Y.push(fe(F))}return Y.length===1?Y[0]:Y.length===2?new d(ae[0].name,ae[0].fn,Y):new b(ae.map(vt=>vt.fn),Y)}function fe(F){var Y,ae,Ce,tt;Y=Se(F);for(var vt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};ot(vt,F.token);)ae=F.token,Ce=vt[ae],W(F),tt=[Y,Se(F)],Y=new d(ae,Ce,tt);return Y}function Se(F){var Y,ae,Ce,tt;Y=_e(F);for(var vt={to:"to",in:"to"};ot(vt,F.token);)ae=F.token,Ce=vt[ae],W(F),ae==="in"&&F.token===""?Y=new d("*","multiply",[Y,new T("in")],!0):(tt=[Y,_e(F)],Y=new d(ae,Ce,tt));return Y}function _e(F){var Y,ae=[];if(F.token===":"?Y=new u(1):Y=G(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(ae.push(Y);F.token===":"&&ae.length<3;)W(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?ae.push(new T("end")):ae.push(G(F));ae.length===3?Y=new x(ae[0],ae[2],ae[1]):Y=new x(ae[0],ae[1])}return Y}function G(F){var Y,ae,Ce,tt;Y=J(F);for(var vt={"+":"add","-":"subtract"};ot(vt,F.token);){ae=F.token,Ce=vt[ae],W(F);var _r=J(F);_r.isPercentage?tt=[Y,new d("*","multiply",[Y,_r])]:tt=[Y,_r],Y=new d(ae,Ce,tt)}return Y}function J(F){var Y,ae,Ce,tt;Y=ge(F),ae=Y;for(var vt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};ot(vt,F.token);)if(Ce=F.token,tt=vt[Ce],W(F),Ce==="%"&&F.tokenType===w.DELIMITER&&F.token!=="(")if(F.token!==""&&vt[F.token]){var _r=new d("/","divide",[Y,new u(100)],!1,!0);Ce=F.token,tt=vt[Ce],W(F),ae=ge(F),Y=new d(Ce,tt,[_r,ae])}else Y=new d("/","divide",[Y,new u(100)],!1,!0);else ae=ge(F),Y=new d(Ce,tt,[Y,ae]);return Y}function ge(F){var Y,ae;for(Y=xe(F),ae=Y;F.tokenType===w.SYMBOL||F.token==="in"&&zt(Y)||F.token==="in"&&Qr(Y)&&Y.fn==="unaryMinus"&&zt(Y.args[0])||F.tokenType===w.NUMBER&&!zt(ae)&&(!Qr(ae)||ae.op==="!")||F.token==="(";)ae=xe(F),Y=new d("*","multiply",[Y,ae],!0);return Y}function xe(F){for(var Y=Ee(F),ae=Y,Ce=[];F.token==="/"&&jp(ae);)if(Ce.push(sn({},F)),W(F),F.tokenType===w.NUMBER)if(Ce.push(sn({},F)),W(F),F.tokenType===w.SYMBOL||F.token==="("||F.token==="in")sn(F,Ce.pop()),Ce.pop(),ae=Ee(F),Y=new d("/","divide",[Y,ae]);else{Ce.pop(),sn(F,Ce.pop());break}else{sn(F,Ce.pop());break}return Y}function Ee(F){var Y,ae,Ce,tt={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return ot(tt,F.token)?(Ce=tt[F.token],Y=F.token,W(F),ae=[Ee(F)],new d(Y,Ce,ae)):Be(F)}function Be(F){var Y,ae,Ce,tt;return Y=Ue(F),(F.token==="^"||F.token===".^")&&(ae=F.token,Ce=ae==="^"?"pow":"dotPow",W(F),tt=[Y,Ee(F)],Y=new d(ae,Ce,tt)),Y}function Ue(F){var Y,ae,Ce,tt;Y=et(F);for(var vt={"!":"factorial","'":"ctranspose"};ot(vt,F.token);)ae=F.token,Ce=vt[ae],B(F),tt=[Y],Y=new d(ae,Ce,tt),Y=Ye(F,Y);return Y}function et(F){var Y=[];if(F.tokenType===w.SYMBOL&&ot(F.extraNodes,F.token)){var ae=F.extraNodes[F.token];if(B(F),F.token==="("){if(Y=[],O(F),B(F),F.token!==")")for(Y.push(U(F));F.token===",";)B(F),Y.push(U(F));if(F.token!==")")throw Ae(F,"Parenthesis ) expected");Q(F),B(F)}return new ae(Y)}return St(F)}function St(F){var Y,ae;return F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E?(ae=F.token,B(F),ot(D,ae)?Y=new u(D[ae]):_.includes(ae)?Y=new u(r(ae,"number")):Y=new T(ae),Y=Ye(F,Y),Y):ur(F)}function Ye(F,Y,ae){for(var Ce;(F.token==="("||F.token==="["||F.token===".")&&(!ae||ae.includes(F.token));)if(Ce=[],F.token==="(")if(Yr(Y)||Ha(Y)){if(O(F),B(F),F.token!==")")for(Ce.push(U(F));F.token===",";)B(F),Ce.push(U(F));if(F.token!==")")throw Ae(F,"Parenthesis ) expected");Q(F),B(F),Y=new f(Y,Ce)}else return Y;else if(F.token==="["){if(O(F),B(F),F.token!=="]")for(Ce.push(U(F));F.token===",";)B(F),Ce.push(U(F));if(F.token!=="]")throw Ae(F,"Parenthesis ] expected");Q(F),B(F),Y=new i(Y,new m(Ce))}else{B(F);var tt=F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E;if(!tt)throw Ae(F,"Property name expected after dot");Ce.push(new u(F.token)),B(F);var vt=!0;Y=new i(Y,new m(Ce,vt))}return Y}function ur(F){var Y,ae;return F.token==='"'||F.token==="'"?(ae=Jt(F,F.token),Y=new u(ae),Y=Ye(F,Y),Y):yr(F)}function Jt(F,Y){for(var ae="";R(F)!==""&&R(F)!==Y;)if(R(F)==="\\"){L(F);var Ce=R(F),tt=C[Ce];if(tt!==void 0)ae+=tt,F.index+=1;else if(Ce==="u"){var vt=F.expression.slice(F.index+1,F.index+5);if(/^[0-9A-Fa-f]{4}$/.test(vt))ae+=String.fromCharCode(parseInt(vt,16)),F.index+=5;else throw Ae(F,"Invalid unicode character \\u".concat(vt))}else throw Ae(F,"Bad escape character \\".concat(Ce))}else ae+=R(F),L(F);if(B(F),F.token!==Y)throw Ae(F,"End of string ".concat(Y," expected"));return B(F),ae}function yr(F){var Y,ae,Ce,tt;if(F.token==="["){if(O(F),B(F),F.token!=="]"){var vt=Oe(F);if(F.token===";"){for(Ce=1,ae=[vt];F.token===";";)B(F),F.token!=="]"&&(ae[Ce]=Oe(F),Ce++);if(F.token!=="]")throw Ae(F,"End of matrix ] expected");Q(F),B(F),tt=ae[0].items.length;for(var _r=1;_r<Ce;_r++)if(ae[_r].items.length!==tt)throw Xe(F,"Column dimensions mismatch ("+ae[_r].items.length+" !== "+tt+")");Y=new a(ae)}else{if(F.token!=="]")throw Ae(F,"End of matrix ] expected");Q(F),B(F),Y=vt}}else Q(F),B(F),Y=new a([]);return Ye(F,Y)}return j(F)}function Oe(F){for(var Y=[U(F)],ae=1;F.token===",";)B(F),F.token!=="]"&&F.token!==";"&&(Y[ae]=U(F),ae++);return new a(Y)}function j(F){if(F.token==="{"){O(F);var Y,ae={};do if(B(F),F.token!=="}"){if(F.token==='"'||F.token==="'")Y=Jt(F,F.token);else if(F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E)Y=F.token,B(F);else throw Ae(F,"Symbol or string expected as object key");if(F.token!==":")throw Ae(F,"Colon : expected after object key");B(F),ae[Y]=U(F)}while(F.token===",");if(F.token!=="}")throw Ae(F,"Comma , or bracket } expected after object value");Q(F),B(F);var Ce=new p(ae);return Ce=Ye(F,Ce),Ce}return he(F)}function he(F){var Y;if(F.tokenType===w.NUMBER){Y=F.token,B(F);var ae=Bi(Y,n),Ce=r(Y,ae);return new u(Ce)}return me(F)}function me(F){var Y;if(F.token==="("){if(O(F),B(F),Y=U(F),F.token!==")")throw Ae(F,"Parenthesis ) expected");return Q(F),B(F),Y=new h(Y),Y=Ye(F,Y),Y}return Fe(F)}function Fe(F){throw F.token===""?Ae(F,"Unexpected end of expression"):Ae(F,"Value expected")}function ke(F){return F.index-F.token.length+1}function Ae(F,Y){var ae=ke(F),Ce=new SyntaxError(Y+" (char "+ae+")");return Ce.char=ae,Ce}function Xe(F,Y){var ae=ke(F),Ce=new SyntaxError(Y+" (char "+ae+")");return Ce.char=ae,Ce}return e.addConversion({from:"string",to:"Node",convert:v}),v});var mO="compile",Are=["typed","parse"],kS=M(mO,Are,t=>{var{typed:e,parse:r}=t;return e(mO,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return nt(i,function(a){return r(a).compile()})}})});var dO="evaluate",Sre=["typed","parse"],$S=M(dO,Sre,t=>{var{typed:e,parse:r}=t;return e(dO,{string:function(i){var a=ku();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=ku();return nt(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return nt(i,function(o){return r(o).compile().evaluate(a)})}})});var Ere="Parser",Tre=["evaluate","parse"],OS=M(Ere,Tre,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:ku(),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 L2(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 hO="parser",Dre=["typed","Parser"],RS=M(hO,Dre,t=>{var{typed:e,Parser:r}=t;return e(hO,{"":function(){return new r}})});var gO="lup",Mre=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],LS=M(gO,Mre,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(gO,{DenseMatrix:function(b){return d(b)},SparseMatrix:function(b){return h(b)},Array:function(b){var T=r(b),v=d(T);return{L:v.L.valueOf(),U:v.U.valueOf(),p:v.p}}});function d(x){var b=x._size[0],T=x._size[1],v=Math.min(b,T),A=gt(x._data),w=[],y=[b,v],E=[],D=[v,T],_,C,N,P=[];for(_=0;_<b;_++)P[_]=_;for(C=0;C<T;C++){if(C>0)for(_=0;_<b;_++){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,k=0,B=0;for(_=C;_<b;_++){var W=A[_][C],O=n(W);l(O,k)&&(V=_,k=O,B=W)}if(C!==V&&(P[C]=[P[V],P[V]=P[C]][0],f._swapRows(C,V,A)),C<b)for(_=C+1;_<b;_++){var Q=A[_][C];u(Q,0)||(A[_][C]=a(A[_][C],B))}}for(C=0;C<T;C++)for(_=0;_<b;_++){if(C===0&&(_<T&&(E[_]=[]),w[_]=[]),_<C){_<T&&(E[_][C]=A[_][C]),C<b&&(w[_][C]=0);continue}if(_===C){_<T&&(E[_][C]=A[_][C]),C<b&&(w[_][C]=1);continue}_<T&&(E[_][C]=0),C<b&&(w[_][C]=A[_][C])}var ie=new f({data:w,size:y}),X=new f({data:E,size:D}),U=[];for(_=0,v=P.length;_<v;_++)U[P[_]]=_;return{L:ie,U:X,p:U,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function h(x){var b=x._size[0],T=x._size[1],v=Math.min(b,T),A=x._values,w=x._index,y=x._ptr,E=[],D=[],_=[],C=[b,v],N=[],P=[],R=[],L=[v,T],V,k,B,W=[],O=[];for(V=0;V<b;V++)W[V]=V,O[V]=V;var Q=function(U,pe){var we=O[U],se=O[pe];W[we]=pe,W[se]=U,O[U]=se,O[pe]=we},ie=function(){var U=new p;k<b&&(_.push(E.length),E.push(1),D.push(k)),R.push(N.length);var pe=y[k],we=y[k+1];for(B=pe;B<we;B++)V=w[B],U.set(W[V],A[B]);k>0&&U.forEach(0,k-1,function(Z,ne){m._forEachRow(Z,E,D,_,function(de,fe){de>Z&&U.accumulate(de,c(o(fe,ne)))})});var se=k,be=U.get(k),ee=n(be);U.forEach(k+1,b-1,function(Z,ne){var de=n(ne);l(de,ee)&&(se=Z,ee=de,be=ne)}),k!==se&&(m._swapRows(k,se,C[1],E,D,_),m._swapRows(k,se,L[1],N,P,R),U.swap(k,se),Q(k,se)),U.forEach(0,b-1,function(Z,ne){Z<=k?(N.push(ne),P.push(Z)):(ne=a(ne,be),u(ne,0)||(E.push(ne),D.push(Z)))})};for(k=0;k<T;k++)ie();return R.push(N.length),_.push(E.length),{L:new m({values:E,index:D,ptr:_,size:C}),U:new m({values:N,index:P,ptr:R,size:L}),p:W,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var vO="qr",Cre=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],VS=M(vO,Cre,t=>{var{typed:e,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:s,sqrt:l,conj:u,unaryMinus:c,addScalar:f,divideScalar:m,multiplyScalar:p,subtractScalar:d,complex:h}=t;return sn(e(vO,{DenseMatrix:function(A){return b(A)},SparseMatrix:function(A){return T(A)},Array:function(A){var w=r(A),y=b(w);return{Q:y.Q.valueOf(),R:y.R.valueOf()}}}),{_denseQRimpl:x});function x(v){var A=v._size[0],w=v._size[1],y=i([A],"dense"),E=y._data,D=v.clone(),_=D._data,C,N,P,R=n([A],"");for(P=0;P<Math.min(w,A);++P){var L=_[P][P],V=c(o(L,0)?1:s(L)),k=u(V),B=0;for(C=P;C<A;C++)B=f(B,p(_[C][P],u(_[C][P])));var W=p(V,l(B));if(!a(W)){var O=d(L,W);for(R[P]=1,C=P+1;C<A;C++)R[C]=m(_[C][P],O);var Q=c(u(m(O,W))),ie=void 0;for(N=P;N<w;N++){for(ie=0,C=P;C<A;C++)ie=f(ie,p(u(R[C]),_[C][N]));for(ie=p(ie,Q),C=P;C<A;C++)_[C][N]=p(d(_[C][N],p(R[C],ie)),k)}for(C=0;C<A;C++){for(ie=0,N=P;N<A;N++)ie=f(ie,p(E[C][N],R[N]));for(ie=p(ie,Q),N=P;N<A;++N)E[C][N]=m(d(E[C][N],p(ie,u(R[N]))),k)}}}return{Q:y,R:D,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function b(v){var A=x(v),w=A.R._data;if(v._data.length>0)for(var y=w[0][0].type==="Complex"?h(0):0,E=0;E<w.length;++E)for(var D=0;D<E&&D<(w[0]||[]).length;++D)w[E][D]=y;return A}function T(v){throw new Error("qr not implemented for sparse matrices yet")}});function yO(t,e,r,n){for(var i=t._values,a=t._index,o=t._ptr,s=t._size,l=t._datatype,u=s[0],c=s[1],f=n&&t._values?[]:null,m=[],p=[],d=0,h=0;h<c;h++){p[h]=d;for(var x=r?r[h]:h,b=o[x],T=o[x+1],v=b;v<T;v++){var A=e?e[a[v]]:a[v];m[d]=A,f&&(f[d]=i[v]),d++}}return p[c]=d,t.createSparseMatrix({values:f,index:m,ptr:p,size:[u,c],datatype:l})}function $v(t,e,r,n,i,a,o){var s=0;for(r[o]=t;s>=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[e++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return e}function xO(t,e){if(!t)return null;var r=0,n,i=[],a=[],o=0,s=e,l=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)t[n]!==-1&&(a[s+n]=a[o+t[n]],a[o+t[n]]=n);for(n=0;n<e;n++)t[n]===-1&&(r=$v(n,r,a,o,s,i,l));return i}function bO(t,e){if(!t)return null;var r=t._index,n=t._ptr,i=t._size,a=i[0],o=i[1],s=[],l=[],u=0,c=o,f,m;if(e)for(f=0;f<a;f++)l[c+f]=-1;for(var p=0;p<o;p++){s[p]=-1,l[u+p]=-1;for(var d=n[p],h=n[p+1],x=d;x<h;x++){var b=r[x];for(f=e?l[c+b]:b;f!==-1&&f<p;f=m)m=l[u+f],l[u+f]=p,m===-1&&(s[f]=p);e&&(l[c+b]=p)}}return s}function wO(t,e,r){for(var n=t._values,i=t._index,a=t._ptr,o=t._size,s=o[1],l=0,u=0;u<s;u++){var c=a[u];for(a[u]=l;c<a[u+1];c++)e(i[c],u,n?n[c]:1,r)&&(i[l]=i[c],n&&(n[l]=n[c]),l++)}return a[s]=l,i.splice(l,i.length-l),n&&n.splice(l,n.length-l),l}function jo(t){return-t-2}var Nre="csAmd",Fre=["add","multiply","transpose"],_O=M(Nre,Fre,t=>{var{add:e,multiply:r,transpose:n}=t;return function(c,f){if(!f||c<=0||c>3)return null;var m=f._size,p=m[0],d=m[1],h=0,x=Math.max(16,10*Math.sqrt(d));x=Math.min(d-2,x);var b=i(c,f,p,d,x);wO(b,l,null);for(var T=b._index,v=b._ptr,A=v[d],w=[],y=[],E=0,D=d+1,_=2*(d+1),C=3*(d+1),N=4*(d+1),P=5*(d+1),R=6*(d+1),L=7*(d+1),V=w,k=a(d,v,y,E,C,V,_,L,D,R,N,P),B=o(d,v,y,P,N,R,x,D,C,V,_),W=0,O,Q,ie,X,U,pe,we,se,be,ee,Z,ne,de,fe,Se,_e;B<d;){for(ie=-1;W<d&&(ie=y[C+W])===-1;W++);y[_+ie]!==-1&&(V[y[_+ie]]=-1),y[C+W]=y[_+ie];var G=y[N+ie],J=y[D+ie];B+=J;var ge=0;y[D+ie]=-J;var xe=v[ie],Ee=G===0?xe:A,Be=Ee;for(X=1;X<=G+1;X++){for(X>G?(pe=ie,we=xe,se=y[E+ie]-G):(pe=T[xe++],we=v[pe],se=y[E+pe]),U=1;U<=se;U++)O=T[we++],!((be=y[D+O])<=0)&&(ge+=be,y[D+O]=-be,T[Be++]=O,y[_+O]!==-1&&(V[y[_+O]]=V[O]),V[O]!==-1?y[_+V[O]]=y[_+O]:y[C+y[P+O]]=y[_+O]);pe!==ie&&(v[pe]=jo(ie),y[R+pe]=0)}for(G!==0&&(A=Be),y[P+ie]=ge,v[ie]=Ee,y[E+ie]=Be-Ee,y[N+ie]=-2,k=s(k,h,y,R,d),ee=Ee;ee<Be;ee++)if(O=T[ee],!((Z=y[N+O])<=0)){be=-y[D+O];var Ue=k-be;for(xe=v[O],ne=v[O]+Z-1;xe<=ne;xe++)pe=T[xe],y[R+pe]>=k?y[R+pe]-=be:y[R+pe]!==0&&(y[R+pe]=y[P+pe]+Ue)}for(ee=Ee;ee<Be;ee++){for(O=T[ee],ne=v[O],de=ne+y[N+O]-1,fe=ne,Se=0,_e=0,xe=ne;xe<=de;xe++)if(pe=T[xe],y[R+pe]!==0){var et=y[R+pe]-k;et>0?(_e+=et,T[fe++]=pe,Se+=pe):(v[pe]=jo(ie),y[R+pe]=0)}y[N+O]=fe-ne+1;var St=fe,Ye=ne+y[E+O];for(xe=de+1;xe<Ye;xe++){Q=T[xe];var ur=y[D+Q];ur<=0||(_e+=ur,T[fe++]=Q,Se+=Q)}_e===0?(v[O]=jo(ie),be=-y[D+O],ge-=be,J+=be,B+=be,y[D+O]=0,y[N+O]=-1):(y[P+O]=Math.min(y[P+O],_e),T[fe]=T[St],T[St]=T[ne],T[ne]=ie,y[E+O]=fe-ne+1,Se=(Se<0?-Se:Se)%d,y[_+O]=y[L+Se],y[L+Se]=O,V[O]=Se)}for(y[P+ie]=ge,h=Math.max(h,ge),k=s(k+h,h,y,R,d),ee=Ee;ee<Be;ee++)if(O=T[ee],!(y[D+O]>=0))for(Se=V[O],O=y[L+Se],y[L+Se]=-1;O!==-1&&y[_+O]!==-1;O=y[_+O],k++){for(se=y[E+O],Z=y[N+O],xe=v[O]+1;xe<=v[O]+se-1;xe++)y[R+T[xe]]=k;var Jt=O;for(Q=y[_+O];Q!==-1;){var yr=y[E+Q]===se&&y[N+Q]===Z;for(xe=v[Q]+1;yr&&xe<=v[Q]+se-1;xe++)y[R+T[xe]]!==k&&(yr=0);yr?(v[Q]=jo(O),y[D+O]+=y[D+Q],y[D+Q]=0,y[N+Q]=-1,Q=y[_+Q],y[_+Jt]=Q):(Jt=Q,Q=y[_+Q])}}for(xe=Ee,ee=Ee;ee<Be;ee++)O=T[ee],!((be=-y[D+O])<=0)&&(y[D+O]=be,_e=y[P+O]+ge-be,_e=Math.min(_e,d-B-be),y[C+_e]!==-1&&(V[y[C+_e]]=O),y[_+O]=y[C+_e],V[O]=-1,y[C+_e]=O,W=Math.min(W,_e),y[P+O]=_e,T[xe++]=O);y[D+ie]=J,(y[E+ie]=xe-Ee)===0&&(v[ie]=-1,y[R+ie]=0),G!==0&&(A=xe)}for(O=0;O<d;O++)v[O]=jo(v[O]);for(Q=0;Q<=d;Q++)y[C+Q]=-1;for(Q=d;Q>=0;Q--)y[D+Q]>0||(y[_+Q]=y[C+v[Q]],y[C+v[Q]]=Q);for(pe=d;pe>=0;pe--)y[D+pe]<=0||v[pe]!==-1&&(y[_+pe]=y[C+v[pe]],y[C+v[pe]]=pe);for(ie=0,O=0;O<=d;O++)v[O]===-1&&(ie=$v(O,ie,y,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,x=d._ptr,b=0,T=0;T<f;T++){var v=x[T];if(x[T]=b,!(x[T+1]-v>p))for(var A=x[T+1];v<A;v++)h[b++]=h[v]}return x[f]=b,c=n(d),r(d,c)}return r(d,c)}function a(u,c,f,m,p,d,h,x,b,T,v,A){for(var w=0;w<u;w++)f[m+w]=c[w+1]-c[w];f[m+u]=0;for(var y=0;y<=u;y++)f[p+y]=-1,d[y]=-1,f[h+y]=-1,f[x+y]=-1,f[b+y]=1,f[T+y]=1,f[v+y]=0,f[A+y]=f[m+y];var E=s(0,0,f,T,u);return f[v+u]=-2,c[u]=-1,f[T+u]=0,E}function o(u,c,f,m,p,d,h,x,b,T,v){for(var A=0,w=0;w<u;w++){var y=f[m+w];if(y===0)f[p+w]=-2,A++,c[w]=-1,f[d+w]=0;else if(y>h)f[x+w]=0,f[p+w]=-1,A++,c[w]=jo(u),f[x+u]++;else{var E=f[b+y];E!==-1&&(T[E]=w),f[v+w]=f[b+y],f[b+y]=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 AO(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 Ire="csCounts",Pre=["transpose"],SO=M(Ire,Pre,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,x=4*l+(a?l+s+1:0),b=[],T=0,v=l,A=2*l,w=3*l,y=4*l,E=5*l+1;for(f=0;f<x;f++)b[f]=-1;var D=[],_=e(r),C=_._index,N=_._ptr;for(f=0;f<l;f++)for(c=i[f],D[c]=b[w+c]===-1?1:0;c!==-1&&b[w+c]===-1;c=n[c])b[w+c]=f;if(a){for(f=0;f<l;f++)b[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,b[C[p]]);b[E+u]=b[y+f],b[y+f]=u}}for(u=0;u<l;u++)b[T+u]=u;for(f=0;f<l;f++){for(c=i[f],n[c]!==-1&&D[n[c]]--,m=a?b[y+f]:c;m!==-1;m=a?b[E+m]:-1)for(p=N[m];p<N[m+1];p++){u=C[p];var P=AO(u,c,b,w,v,A,T);P.jleaf>=1&&D[c]++,P.jleaf===2&&D[P.q]--}n[c]!==-1&&(b[T+c]=n[c])}for(c=0;c<l;c++)n[c]!==-1&&(D[n[c]]+=D[c]);return D}});var Bre="csSqr",kre=["add","multiply","transpose"],EO=M(Bre,kre,t=>{var{add:e,multiply:r,transpose:n}=t,i=_O({add:e,multiply:r,transpose:n}),a=SO({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 x=l?yO(u,null,h.q,0):u;h.parent=bO(x,1);var b=xO(h.parent,p);if(h.cp=a(x,h.parent,b,1),x&&h.parent&&h.cp&&o(x,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,x=l.leftmost,b=[],T=0,v=m,A=m+p,w=m+2*p,y,E,D,_,C;for(E=0;E<p;E++)b[v+E]=-1,b[A+E]=-1,b[w+E]=0;for(y=0;y<m;y++)x[y]=-1;for(E=p-1;E>=0;E--)for(_=u[E],C=u[E+1],D=_;D<C;D++)x[c[D]]=E;for(y=m-1;y>=0;y--)h[y]=-1,E=x[y],E!==-1&&(b[w+E]++===0&&(b[A+E]=y),b[T+y]=b[v+E],b[v+E]=y);for(l.lnz=0,l.m2=m,E=0;E<p;E++)if(y=b[v+E],l.lnz++,y<0&&(y=l.m2++),h[y]=E,!(--w[E]<=0)){l.lnz+=b[w+E];var N=d[E];N!==-1&&(b[w+N]===0&&(b[A+N]=b[A+E]),b[T+b[A+E]]=b[v+N],b[v+N]=b[T+y],b[w+N]+=b[w+E])}for(y=0;y<m;y++)h[y]<0&&(h[y]=E++);return!0}});function Em(t,e){return t[e]<0}function Ov(t,e){t[e]=jo(t[e])}function US(t){return t<0?jo(t):t}function TO(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;Em(o,t)||(Ov(o,t),n[l+m]=p<0?0:US(o[p]));var d=1;for(c=n[l+m],f=p<0?0:US(o[p+1]);c<f;c++)if(u=a[c],!Em(o,u)){n[l+m]=c,n[++m]=u,d=0;break}d&&(m--,n[--r]=t)}return r}function DO(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];Em(a,d)||(p=TO(d,t,p,n,i))}for(c=p;c<u;c++)Ov(a,n[c]);return p}var $re="csSpsolve",Ore=["divideScalar","multiply","subtract"],MO=M($re,Ore,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,x=h[1],b=o._values,T=o._index,v=o._ptr,A,w,y,E,D=DO(a,o,s,l,c);for(A=D;A<x;A++)u[l[A]]=0;for(w=v[s],y=v[s+1],A=w;A<y;A++)u[T[A]]=b[A];for(var _=D;_<x;_++){var C=l[_],N=c?c[C]:C;if(!(N<0))for(w=d[N],y=d[N+1],u[C]=e(u[C],m[f?w:y-1]),A=f?w+1:w,E=f?y:y-1;A<E;A++){var P=p[A];u[P]=n(u[P],r(m[A],u[C]))}}return D}});var Rre="csLu",Lre=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],CO=M(Rre,Lre,t=>{var{abs:e,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=t,l=MO({divideScalar:r,multiply:n,subtract:i});return function(c,f,m){if(!c)return null;var p=c._size,d=p[1],h,x=100,b=100;f&&(h=f.q,x=f.lnz||x,b=f.unz||b);var T=[],v=[],A=[],w=new s({values:T,index:v,ptr:A,size:[d,d]}),y=[],E=[],D=[],_=new s({values:y,index:E,ptr:D,size:[d,d]}),C=[],N,P,R=[],L=[];for(N=0;N<d;N++)R[N]=0,C[N]=-1,A[N+1]=0;x=0,b=0;for(var V=0;V<d;V++){A[V]=x,D[V]=b;var k=h?h[V]:V,B=l(w,c,k,L,R,C,1),W=-1,O=-1;for(P=B;P<d;P++)if(N=L[P],C[N]<0){var Q=e(R[N]);a(Q,O)&&(O=Q,W=N)}else E[b]=C[N],y[b++]=R[N];if(W===-1||O<=0)return null;C[k]<0&&o(e(R[k]),n(O,m))&&(W=k);var ie=R[W];for(E[b]=V,y[b++]=ie,C[W]=V,v[x]=W,T[x++]=1,P=B;P<d;P++)N=L[P],C[N]<0&&(v[x]=N,T[x++]=r(R[N],ie)),R[N]=0}for(A[d]=x,D[d]=b,P=0;P<x;P++)v[P]=C[v[P]];return T.splice(x,T.length-x),v.splice(x,v.length-x),y.splice(b,y.length-b),E.splice(b,E.length-b),{L:w,U:_,pinv:C}}});var NO="slu",Vre=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],qS=M(NO,Vre,t=>{var{typed:e,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:l,largerEq:u,SparseMatrix:c}=t,f=EO({add:n,multiply:i,transpose:a}),m=CO({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return e(NO,{"SparseMatrix, number, number":function(d,h,x){if(!Qe(h)||h<0||h>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(x<0||x>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var b=f(h,d,!1),T=m(d,b,x);return{L:T.L,U:T.U,p:T.pinv,q:b.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function zS(t,e){var r,n=e.length,i=[];if(t)for(r=0;r<n;r++)i[t[r]]=e[r];else for(r=0;r<n;r++)i[r]=e[r];return i}var FO="lusolve",Ure=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],HS=M(FO,Ure,t=>{var{typed:e,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(FO,{"Array, Array | Matrix":function(m,p){m=r(m);var d=n(m),h=c(d.L,d.U,d.p,null,p);return h.valueOf()},"DenseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(m,p,d,h){var x=i(m,d,h);return c(x.L,x.U,x.p,x.q,p)},"Object, Array | Matrix":function(m,p){return c(m.L,m.U,m.p,m.q,p)}});function u(f){if(rt(f))return f;if(gr(f))return r(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,m,p,d,h){f=u(f),m=u(m),p&&(h=l(f,h,!0),h._data=zS(p,h._data));var x=o(f,h),b=a(m,x);return d&&(b._data=zS(d,b._data)),b}});var IO="polynomialRoot",qre=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],GS=M(IO,qre,t=>{var{typed:e,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:f,im:m,re:p}=t;return e(IO,{"number|Complex, ...number|Complex":(d,h)=>{for(var x=[d,...h];x.length>0&&r(x[x.length-1]);)x.pop();if(x.length<2)throw new RangeError("Polynomial [".concat(d,", ").concat(h,"] must have a non-zero non-constant coefficient"));switch(x.length){case 2:return[u(s(x[0],x[1]))];case 3:{var[b,T,v]=x,A=o(2,v),w=o(T,T),y=o(4,v,b);if(n(w,y))return[s(u(T),A)];var E=l(a(w,y));return[s(a(E,T),A),s(a(u(E),T),A)]}case 4:{var[D,_,C,N]=x,P=u(o(3,N)),R=o(C,C),L=o(3,N,_),V=i(o(2,C,C,C),o(27,N,N,D)),k=o(9,N,C,_);if(n(R,L)&&n(V,k))return[s(C,P)];var B=a(R,L),W=a(V,k),O=i(o(18,N,C,_,D),o(C,C,_,_)),Q=i(o(4,C,C,C,D),o(4,N,_,_,_),o(27,N,N,D,D));if(n(O,Q))return[s(a(o(4,N,C,_),i(o(9,N,N,D),o(C,C,C))),o(N,B)),s(a(o(9,N,D),o(C,_)),o(2,B))];var ie;n(R,L)?ie=W:ie=s(i(W,l(a(o(W,W),o(4,B,B,B)))),2);var X=!0,U=c(ie,X).toArray().map(pe=>s(i(C,pe,s(B,pe)),P));return U.map(pe=>f(pe)==="Complex"&&n(p(pe),p(pe)+m(pe))?p(pe):pe)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(x))}}})});var zre="Help",Hre=["evaluate"],WS=M(zre,Hre,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&&!Cg(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=gt(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 Gre="Chain",Wre=["?on","math","typed"],YS=M(Gre,Wre,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");Ng(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Dt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){K2(i.prototype,u,function(){var m=c();if(typeof m=="function")return s(m)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(n.isTypedFunction(u)){var m=n.resolve(u,c);if(m.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(m.implementation.apply(u,c))}return new i(u.apply(u,c))}}i.createProxy=function(u,c){if(typeof u=="string")a(u,c);else{var f=function(d){ot(u,d)&&l[d]===void 0&&o(d,()=>u[d])};for(var m in u)f(m)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),e&&e("import",function(u,c,f){f||o(u,c)}),i},{isClass:!0});var jS={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};var PO={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var BO={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};var kO={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};var $O={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var OO={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var RO={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var LO={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};var VO={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var UO={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var qO={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]};var ZS={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};var zO={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var HO={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var GO={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 WO={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var YO={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var jO={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 ZO={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 JO={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 XO={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 QO={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 KO={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 eR={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 tR={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 rR={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 nR={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 iR={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 aR={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 oR={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 sR={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 uR={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 lR={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 cR={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 fR={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 pR={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 mR={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 dR={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 hR={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 gR={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 vR={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 yR={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 xR={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 bR={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 wR={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 _R={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 AR={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 SR={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 ER={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 TR={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 DR={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var MR={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 CR={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 NR={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 FR={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 IR={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 PR={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 BR={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 kR={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 $R={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 OR={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 RR={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 LR={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 VR={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 UR={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 qR={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 zR={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 HR={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 GR={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 WR={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 YR={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 jR={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 ZR={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 JR={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 XR={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 QR={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 KR={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 eL={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 tL={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 rL={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var nL={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 iL={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 aL={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 oL={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 sL={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 uL={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 lL={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 cL={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 fL={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var pL={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 mL={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 dL={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 hL={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 gL={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 vL={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 yL={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 xL={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 bL={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 wL={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 _L={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 AL={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 SL={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 EL={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 TL={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 DL={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 ML={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 CL={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 NL={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 FL={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 IL={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 PL={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 BL={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 kL={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 $L={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 OL={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 RL={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 LL={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 VL={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 UL={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 qL={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 zL={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 HL={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 GL={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 WL={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 YL={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 jL={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 ZL={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 JL={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 XL={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 QL={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 KL={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 e3={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 t3={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 r3={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 n3={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 i3={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 a3={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 o3={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 s3={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 u3={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 l3={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 c3={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 f3={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 p3={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 m3={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 d3={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 h3={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 g3={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 v3={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 y3={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 x3={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var b3={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var w3={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 _3={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 A3={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 S3={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 E3={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 T3={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 D3={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 M3={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 C3={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 N3={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 F3={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 I3={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 P3={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 B3={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 k3={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 $3={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 O3={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 R3={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var L3={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 V3={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var U3={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 q3={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 z3={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 H3={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 G3={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 W3={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 Y3={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 j3={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 Z3={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 J3={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 X3={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 Q3={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 K3={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 e4={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 t4={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 r4={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 n4={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 i4={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var a4={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 o4={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 s4={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var u4={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 l4={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 c4={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 f4={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var p4={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var m4={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var d4={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var h4={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var g4={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var v4={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var y4={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var x4={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var b4={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var w4={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var _4={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var A4={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var S4={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 E4={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 T4={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 D4={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 M4={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 C4={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 N4={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 F4={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 I4={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 P4={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 B4={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 k4={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 $4={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 O4={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 R4={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var L4={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 V4={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 U4={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 q4={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var z4={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 H4={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 G4={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 W4={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var Y4={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 j4={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 Z4={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 J4={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 X4={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 Q4={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 K4={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 eV={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 tV={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var rV={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 nV={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 iV={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 aV={bignumber:jO,bigint:ZO,boolean:JO,complex:XO,createUnit:QO,fraction:KO,index:eR,matrix:tR,number:rR,sparse:nR,splitUnit:iR,string:aR,unit:oR,e:jS,E:jS,false:PO,i:BO,Infinity:kO,LN2:OO,LN10:$O,LOG2E:LO,LOG10E:RO,NaN:VO,null:UO,pi:ZS,PI:ZS,phi:qO,SQRT1_2:zO,SQRT2:HO,tau:GO,true:WO,version:YO,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:cR,lsolve:pR,lsolveAll:mR,lup:dR,lusolve:hR,leafCount:fR,polynomialRoot:gR,resolve:xR,simplify:bR,simplifyConstant:wR,simplifyCore:_R,symbolicEqual:SR,rationalize:yR,slu:AR,usolve:ER,usolveAll:TR,qr:vR,abs:DR,add:MR,cbrt:CR,ceil:NR,cube:FR,divide:IR,dotDivide:PR,dotMultiply:BR,dotPow:kR,exp:$R,expm:OR,expm1:RR,fix:LR,floor:VR,gcd:UR,hypot:qR,lcm:HR,log:GR,log2:jR,log1p:YR,log10:WR,mod:ZR,multiply:JR,norm:XR,nthRoot:QR,nthRoots:KR,pow:eL,round:tL,sign:rL,sqrt:nL,sqrtm:iL,square:uL,subtract:lL,unaryMinus:cL,unaryPlus:fL,xgcd:pL,invmod:zR,bitAnd:mL,bitNot:dL,bitOr:hL,bitXor:gL,leftShift:vL,rightArithShift:yL,rightLogShift:xL,bellNumbers:bL,catalan:wL,composition:_L,stirlingS2:AL,config:sR,import:uR,typed:lR,arg:SL,conj:EL,re:DL,im:TL,evaluate:ML,help:CL,distance:NL,intersect:FL,and:IL,not:PL,or:BL,xor:kL,concat:OL,count:RL,cross:LL,column:$L,ctranspose:VL,det:UL,diag:qL,diff:zL,dot:HL,getMatrixDataType:ZL,identity:JL,filter:WL,flatten:YL,forEach:jL,inv:XL,pinv:QL,eigs:GL,kron:KL,matrixFromFunction:r3,matrixFromRows:n3,matrixFromColumns:t3,map:e3,ones:i3,partitionSelect:a3,range:o3,resize:u3,reshape:s3,rotate:l3,rotationMatrix:c3,row:f3,size:p3,sort:m3,squeeze:d3,subset:h3,trace:g3,transpose:v3,zeros:y3,fft:x3,ifft:b3,sylvester:aL,schur:oL,lyap:sL,solveODE:iV,combinations:w3,combinationsWithRep:_3,factorial:A3,gamma:S3,kldivergence:T3,lgamma:E3,multinomial:D3,permutations:M3,pickRandom:C3,random:N3,randomInt:F3,compare:I3,compareNatural:P3,compareText:B3,deepEqual:k3,equal:$3,equalText:O3,larger:R3,largerEq:L3,smaller:V3,smallerEq:U3,unequal:q3,setCartesian:z3,setDifference:H3,setDistinct:G3,setIntersect:W3,setIsSubset:Y3,setMultiplicity:j3,setPowerset:Z3,setSize:J3,setSymDifference:X3,setUnion:Q3,zpk2tf:K3,freqz:e4,erf:t4,zeta:r4,cumsum:p4,mad:n4,max:i4,mean:a4,median:o4,min:s4,mode:u4,prod:l4,quantileSeq:c4,std:f4,sum:m4,variance:d4,corr:h4,acos:g4,acosh:v4,acot:y4,acoth:x4,acsc:b4,acsch:w4,asec:_4,asech:A4,asin:S4,asinh:E4,atan:T4,atanh:M4,atan2:D4,cos:C4,cosh:N4,cot:F4,coth:I4,csc:P4,csch:B4,sec:k4,sech:$4,sin:O4,sinh:R4,tan:L4,tanh:V4,to:U4,clone:z4,format:H4,bin:q4,oct:tV,hex:W4,isNaN:j4,isInteger:Y4,isNegative:Z4,isNumeric:J4,hasNumericValue:G4,isPositive:X4,isPrime:Q4,isZero:K4,print:rV,typeOf:nV,numeric:eV};var oV="help",Yre=["typed","mathWithTransform","Help"],JS=M(oV,Yre,t=>{var{typed:e,mathWithTransform:r,Help:n}=t;return e(oV,{any:function(a){var o,s=a;if(typeof a!="string"){for(o in r)if(ot(r,o)&&a===r[o]){s=o;break}}var l=nn(aV,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})});var sV="chain",jre=["typed","Chain"],XS=M(sV,jre,t=>{var{typed:e,Chain:r}=t;return e(sV,{"":function(){return new r},any:function(i){return new r(i)}})});var uV="det",Zre=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],QS=M(uV,Zre,t=>{var{typed:e,matrix:r,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=t;return e(uV,{any:function(c){return gt(c)},"Array | Matrix":function(c){var f;switch(rt(c)?f=c.size():Array.isArray(c)?(c=r(c),f=c.size()):f=[],f.length){case 0:return gt(c);case 1:if(f[0]===1)return gt(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 gt(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,D)=>D),d=0;d<c;d++){var h=p[d];if(o(u[h][d])){var x=void 0;for(x=d+1;x<c;x++)if(!o(u[p[x]][d])){h=p[x],p[x]=p[d],p[d]=h,m=!m;break}if(x===c)return u[h][d]}for(var b=u[h][d],T=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],b),i(u[A][d],u[h][w])),T)}var y=u[p[c-1]][c-1];return m?s(y):y}});var lV="inv",Jre=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],KS=M(lV,Jre,t=>{var{typed:e,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:l,abs:u}=t;return e(lV,{"Array | Matrix":function(m){var p=rt(m)?m.size():ft(m);switch(p.length){case 1:if(p[0]===1)return rt(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 rt(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,x,b,T;if(m===1){if(b=f[0][0],b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,b)]]}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(),y=0;y<p;y++){var E=u(A[y][y]),D=y;for(d=y+1;d<m;)u(A[d][y])>E&&(E=u(A[d][y]),D=d),d++;if(E===0)throw Error("Cannot calculate inverse, determinant is zero");d=D,d!==y&&(T=A[y],A[y]=A[d],A[d]=T,T=w[y],w[y]=w[d],w[d]=T);var _=A[y],C=w[y];for(d=0;d<m;d++){var N=A[d],P=w[d];if(d!==y){if(N[y]!==0){for(x=n(o(N[y]),_[y]),h=y;h<p;h++)N[h]=i(N[h],a(x,_[h]));for(h=0;h<p;h++)P[h]=i(P[h],a(x,C[h]))}}else{for(x=_[y],h=y;h<p;h++)N[h]=n(N[h],x);for(h=0;h<p;h++)P[h]=n(P[h],x)}}}return w}}});var cV="pinv",Xre=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],eE=M(cV,Xre,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(cV,{"Array | Matrix":function(v){var A=rt(v)?v.size():ft(v);switch(A.length){case 1:return b(v)?l(v):A[0]===1?n(v):o(l(v),s(v,v));case 2:{if(b(v))return l(v);var w=A[0],y=A[1];if(w===y)try{return n(v)}catch(E){if(!(E instanceof Error&&E.message.match(/Cannot calculate inverse, determinant is zero/)))throw E}return rt(v)?r(p(v.valueOf(),w,y),v.storage()):p(v,w,y)}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(A)+")")}},any:function(v){return a(v,0)?gt(v):u(1,v)}});function p(T,v,A){var{C:w,F:y}=h(T,v,A),E=c(n(c(l(w),w)),l(w)),D=c(l(y),n(c(y,l(y))));return c(D,E)}function d(T,v,A){for(var w=gt(T),y=0,E=0;E<v;E++){if(A<=y)return w;for(var D=E;x(w[D][y]);)if(D++,v===D&&(D=E,y++,A===y))return w;[w[D],w[E]]=[w[E],w[D]];for(var _=w[E][y],C=0;C<A;C++)w[E][C]=o(w[E][C],_);for(var N=0;N<v;N++)if(N!==E){_=w[N][y];for(var P=0;P<A;P++)w[N][P]=f(w[N][P],c(-1,c(_,w[E][P])))}y++}return w}function h(T,v,A){var w=d(T,v,A),y=T.map((D,_)=>D.filter((C,N)=>N<v&&!x(s(w[N],w[N])))),E=w.filter((D,_)=>!x(s(w[_],w[_])));return{C:y,F:E}}function x(T){return a(f(T,m(1,1)),f(0,m(1,1)))}function b(T){return i(f(T,m(1,1)),f(c(T,0),m(1,1)))}});function fV(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:x,equal:b,complex:T,larger:v,smaller:A,matrixFromColumns:w,dot:y}=t;function E(X,U,pe,we){var se=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,be=D(X,U,pe,we,se);_(X,U,pe,we,se,be);var{values:ee,C:Z}=C(X,U,pe,we,se);if(se){var ne=N(X,U,Z,be,ee,pe,we);return{values:ee,eigenvectors:ne}}return{values:ee}}function D(X,U,pe,we,se){var be=we==="BigNumber",ee=we==="Complex",Z=be?u(0):0,ne=be?u(1):ee?T(1):1,de=be?u(1):1,fe=be?u(10):2,Se=a(fe,fe),_e;se&&(_e=Array(U).fill(ne));for(var G=!1;!G;){G=!0;for(var J=0;J<U;J++){for(var ge=Z,xe=Z,Ee=0;Ee<U;Ee++)J!==Ee&&(ge=e(ge,l(X[Ee][J])),xe=e(xe,l(X[J][Ee])));if(!b(ge,0)&&!b(xe,0)){for(var Be=de,Ue=ge,et=o(xe,fe),St=a(xe,fe);A(Ue,et);)Ue=a(Ue,Se),Be=a(Be,fe);for(;v(Ue,St);)Ue=o(Ue,Se),Be=o(Be,fe);var Ye=A(o(e(Ue,xe),Be),a(e(ge,xe),.95));if(Ye){G=!1;for(var ur=o(1,Be),Jt=0;Jt<U;Jt++)J!==Jt&&(X[J][Jt]=a(X[J][Jt],ur),X[Jt][J]=a(X[Jt][J],Be));se&&(_e[J]=a(_e[J],ur))}}}}return se?c(_e):null}function _(X,U,pe,we,se,be){var ee=we==="BigNumber",Z=we==="Complex",ne=ee?u(0):Z?T(0):0;ee&&(pe=u(pe));for(var de=0;de<U-2;de++){for(var fe=0,Se=ne,_e=de+1;_e<U;_e++){var G=X[_e][de];A(l(Se),l(G))&&(Se=G,fe=_e)}if(!A(l(Se),pe)){if(fe!==de+1){var J=X[fe];X[fe]=X[de+1],X[de+1]=J;for(var ge=0;ge<U;ge++){var xe=X[ge][fe];X[ge][fe]=X[ge][de+1],X[ge][de+1]=xe}if(se){var Ee=be[fe];be[fe]=be[de+1],be[de+1]=Ee}}for(var Be=de+2;Be<U;Be++){var Ue=o(X[Be][de],Se);if(Ue!==0){for(var et=0;et<U;et++)X[Be][et]=r(X[Be][et],a(Ue,X[de+1][et]));for(var St=0;St<U;St++)X[St][de+1]=e(X[St][de+1],a(Ue,X[St][Be]));if(se)for(var Ye=0;Ye<U;Ye++)be[Be][Ye]=r(be[Be][Ye],a(Ue,be[de+1][Ye]))}}}}return be}function C(X,U,pe,we,se){var be=we==="BigNumber",ee=we==="Complex",Z=be?u(1):ee?T(1):1;be&&(pe=u(pe));for(var ne=gt(X),de=[],fe=U,Se=[],_e=se?c(Array(U).fill(Z)):void 0,G=se?c(Array(fe).fill(Z)):void 0,J=0;J<=100;){J+=1;for(var ge=ne[fe-1][fe-1],xe=0;xe<fe;xe++)ne[xe][xe]=r(ne[xe][xe],ge);var{Q:Ee,R:Be}=d(ne);ne=i(Be,Ee);for(var Ue=0;Ue<fe;Ue++)ne[Ue][Ue]=e(ne[Ue][Ue],ge);if(se&&(G=i(G,Ee)),fe===1||A(l(ne[fe-1][fe-2]),pe)){J=0,de.push(ne[fe-1][fe-1]),se&&(Se.unshift([[1]]),L(G,U),_e=i(_e,G),fe>1&&(G=c(Array(fe-1).fill(Z)))),fe-=1,ne.pop();for(var et=0;et<fe;et++)ne[et].pop()}else if(fe===2||A(l(ne[fe-2][fe-3]),pe)){J=0;var St=P(ne[fe-2][fe-2],ne[fe-2][fe-1],ne[fe-1][fe-2],ne[fe-1][fe-1]);de.push(...St),se&&(Se.unshift(R(ne[fe-2][fe-2],ne[fe-2][fe-1],ne[fe-1][fe-2],ne[fe-1][fe-1],St[0],St[1],pe,we)),L(G,U),_e=i(_e,G),fe>2&&(G=c(Array(fe-2).fill(Z)))),fe-=2,ne.pop(),ne.pop();for(var Ye=0;Ye<fe;Ye++)ne[Ye].pop(),ne[Ye].pop()}if(fe===0)break}if(de.sort((yr,Oe)=>+r(l(yr),l(Oe))),J>100){var ur=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+de.join(", "));throw ur.values=de,ur.vectors=[],ur}var Jt=se?i(_e,V(Se,U)):void 0;return{values:de,C:Jt}}function N(X,U,pe,we,se,be,ee){var Z=p(pe),ne=i(Z,X,pe),de=ee==="BigNumber",fe=ee==="Complex",Se=de?u(0):fe?T(0):0,_e=de?u(1):fe?T(1):1,G=[],J=[];for(var ge of se){var xe=k(G,ge,b);xe===-1?(G.push(ge),J.push(1)):J[xe]+=1}for(var Ee=[],Be=G.length,Ue=Array(U).fill(Se),et=c(Array(U).fill(_e)),St=function(){var Jt=G[Ye],yr=r(ne,i(Jt,et)),Oe=x(yr,Ue);for(Oe.shift();Oe.length<J[Ye];){var j=B(yr,U,Oe,be,ee);if(j===null)break;Oe.push(j)}var he=i(p(we),pe);Oe=Oe.map(me=>i(he,me)),Ee.push(...Oe.map(me=>({value:Jt,vector:n(me)})))},Ye=0;Ye<Be;Ye++)St();return Ee}function P(X,U,pe,we){var se=e(X,we),be=r(a(X,we),a(U,pe)),ee=a(se,.5),Z=a(s(r(a(se,se),a(4,be))),.5);return[e(ee,Z),r(ee,Z)]}function R(X,U,pe,we,se,be,ee,Z){var ne=Z==="BigNumber",de=Z==="Complex",fe=ne?u(0):de?T(0):0,Se=ne?u(1):de?T(1):1;if(A(l(pe),ee))return[[Se,fe],[fe,Se]];if(v(l(r(se,be)),ee))return[[r(se,we),r(be,we)],[pe,pe]];var _e=r(X,se),G=r(we,se);return A(l(U),ee)&&A(l(G),ee)?[[_e,Se],[pe,fe]]:[[U,fe],[G,Se]]}function L(X,U){for(var pe=0;pe<X.length;pe++)X[pe].push(...Array(U-X[pe].length).fill(0));for(var we=X.length;we<U;we++)X.push(Array(U).fill(0)),X[we][we]=1;return X}function V(X,U){for(var pe=[],we=0;we<U;we++)pe[we]=Array(U).fill(0);var se=0;for(var be of X){for(var ee=be.length,Z=0;Z<ee;Z++)for(var ne=0;ne<ee;ne++)pe[se+Z][se+ne]=be[Z][ne];se+=ee}return pe}function k(X,U,pe){for(var we=0;we<X.length;we++)if(pe(X[we],U))return we;return-1}function B(X,U,pe,we,se){for(var be=se==="BigNumber"?u(1e3):1e3,ee,Z=0;Z<5;++Z){ee=W(U,pe,se);try{ee=h(X,ee)}catch{continue}if(v(Q(ee),be))break}if(Z>=5)return null;for(Z=0;;){var ne=h(X,ee);if(A(Q(O(ee,[ne])),we))break;if(++Z>=10)return null;ee=ie(ne)}return ee}function W(X,U,pe){var we=pe==="BigNumber",se=pe==="Complex",be=Array(X).fill(0).map(ee=>2*Math.random()-1);return we&&(be=be.map(ee=>u(ee))),se&&(be=be.map(ee=>T(ee))),be=O(be,U),ie(be,pe)}function O(X,U){var pe=f(X);for(var we of U)we=m(we,pe),X=r(X,i(o(y(we,X),y(we,we)),we));return X}function Q(X){return l(s(y(X,X)))}function ie(X,U){var pe=U==="BigNumber",we=U==="Complex",se=pe?u(1):we?T(1):1;return i(o(se,Q(X)),X)}return E}function pV(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,P=arguments.length>3?arguments[3]:void 0,R=arguments.length>4?arguments[4]:void 0;if(P==="number")return d(_,N,R);if(P==="BigNumber")return h(_,N,R);throw TypeError("Unsupported data type: "+P)}function d(_,C,N){var P=_.length,R=Math.abs(C/P),L,V;if(N){V=new Array(P);for(var k=0;k<P;k++)V[k]=Array(P).fill(0),V[k][k]=1}for(var B=y(_);Math.abs(B[1])>=Math.abs(R);){var W=B[0][0],O=B[0][1];L=x(_[W][W],_[O][O],_[W][O]),_=w(_,L,W,O),N&&(V=T(V,L,W,O)),B=y(_)}for(var Q=Array(P).fill(0),ie=0;ie<P;ie++)Q[ie]=_[ie][ie];return D(gt(Q),V,N)}function h(_,C,N){var P=_.length,R=i(C/P),L,V;if(N){V=new Array(P);for(var k=0;k<P;k++)V[k]=Array(P).fill(0),V[k][k]=1}for(var B=E(_);i(B[1])>=i(R);){var W=B[0][0],O=B[0][1];L=b(_[W][W],_[O][O],_[W][O]),_=A(_,L,W,O),N&&(V=v(V,L,W,O)),B=E(_)}for(var Q=Array(P).fill(0),ie=0;ie<P;ie++)Q[ie]=_[ie][ie];return D(gt(Q),V,N)}function x(_,C,N){var P=C-_;return Math.abs(P)<=e.relTol?Math.PI/4:.5*Math.atan(2*N/(C-_))}function b(_,C,N){var P=n(C,_);return i(P)<=e.relTol?c(-1).acos().div(4):l(.5,a(f(2,N,u(P))))}function T(_,C,N,P){for(var R=_.length,L=Math.cos(C),V=Math.sin(C),k=Array(R).fill(0),B=Array(R).fill(0),W=0;W<R;W++)k[W]=L*_[W][N]-V*_[W][P],B[W]=V*_[W][N]+L*_[W][P];for(var O=0;O<R;O++)_[O][N]=k[O],_[O][P]=B[O];return _}function v(_,C,N,P){for(var R=_.length,L=o(C),V=s(C),k=Array(R).fill(c(0)),B=Array(R).fill(c(0)),W=0;W<R;W++)k[W]=n(l(L,_[W][N]),l(V,_[W][P])),B[W]=r(l(V,_[W][N]),l(L,_[W][P]));for(var O=0;O<R;O++)_[O][N]=k[O],_[O][P]=B[O];return _}function A(_,C,N,P){for(var R=_.length,L=c(o(C)),V=c(s(C)),k=l(L,L),B=l(V,V),W=Array(R).fill(c(0)),O=Array(R).fill(c(0)),Q=f(c(2),L,V,_[N][P]),ie=r(n(l(k,_[N][N]),Q),l(B,_[P][P])),X=m(l(B,_[N][N]),Q,l(k,_[P][P])),U=0;U<R;U++)W[U]=n(l(L,_[N][U]),l(V,_[P][U])),O[U]=r(l(V,_[N][U]),l(L,_[P][U]));_[N][N]=ie,_[P][P]=X,_[N][P]=c(0),_[P][N]=c(0);for(var pe=0;pe<R;pe++)pe!==N&&pe!==P&&(_[N][pe]=W[pe],_[pe][N]=W[pe],_[P][pe]=O[pe],_[pe][P]=O[pe]);return _}function w(_,C,N,P){for(var R=_.length,L=Math.cos(C),V=Math.sin(C),k=L*L,B=V*V,W=Array(R).fill(0),O=Array(R).fill(0),Q=k*_[N][N]-2*L*V*_[N][P]+B*_[P][P],ie=B*_[N][N]+2*L*V*_[N][P]+k*_[P][P],X=0;X<R;X++)W[X]=L*_[N][X]-V*_[P][X],O[X]=V*_[N][X]+L*_[P][X];_[N][N]=Q,_[P][P]=ie,_[N][P]=0,_[P][N]=0;for(var U=0;U<R;U++)U!==N&&U!==P&&(_[N][U]=W[U],_[U][N]=W[U],_[P][U]=O[U],_[U][P]=O[U]);return _}function y(_){for(var C=_.length,N=0,P=[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]),P=[R,L]);return[P,N]}function E(_){for(var C=_.length,N=0,P=[0,1],R=0;R<C;R++)for(var L=R+1;L<C;L++)i(N)<i(_[R][L])&&(N=i(_[R][L]),P=[R,L]);return[P,N]}function D(_,C,N){var P=_.length,R=Array(P),L;if(N){L=Array(P);for(var V=0;V<P;V++)L[V]=Array(P)}for(var k=0;k<P;k++){for(var B=0,W=_[0],O=0;O<_.length;O++)i(_[O])<i(W)&&(B=O,W=_[B]);if(R[k]=_.splice(B,1)[0],N)for(var Q=0;Q<P;Q++)L[k][Q]=C[Q][B],C[Q].splice(B,1)}if(!N)return{values:R};var ie=L.map((X,U)=>({value:R[U],vector:X}));return{values:R,eigenvectors:ie}}return p}var Qre="eigs",Kre=["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"],tE=M(Qre,Kre,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:x,larger:b,column:T,flatten:v,number:A,complex:w,sqrt:y,diag:E,size:D,reshape:_,qr:C,usolve:N,usolveAll:P,im:R,re:L,smaller:V,matrixFromColumns:k,dot:B}=t,W=pV({config:e,addScalar:i,subtract:a,column:T,flatten:v,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,inv:p,bignumber:d,complex:w,multiply:h,add:x}),O=fV({config:e,addScalar:i,subtract:a,multiply:h,multiplyScalar:f,flatten:v,divideScalar:m,sqrt:y,abs:s,bignumber:d,diag:E,size:D,reshape:_,qr:C,inv:p,usolve:N,usolveAll:P,equal:o,complex:w,larger:b,smaller:V,matrixFromColumns:k,dot:B});return r("eigs",{Array:function(be){return Q(n(be))},"Array, number|BigNumber":function(be,ee){return Q(n(be),{precision:ee})},"Array, Object"(se,be){return Q(n(se),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 sn(Z,ee),Q(be,Z)}});function Q(se){var be,ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z="eigenvectors"in ee?ee.eigenvectors:!0,ne=(be=ee.precision)!==null&&be!==void 0?be:e.relTol,de=ie(se,ne,Z);return ee.matricize&&(de.values=n(de.values),Z&&(de.eigenvectors=de.eigenvectors.map(fe=>{var{value:Se,vector:_e}=fe;return{value:Se,vector:n(_e)}}))),Z&&Object.defineProperty(de,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),de}function ie(se,be,ee){var Z=se.toArray(),ne=se.size();if(ne.length!==2||ne[0]!==ne[1])throw new RangeError("Matrix must be square (size: ".concat(Dt(ne),")"));var de=ne[0];if(U(Z,de,be)&&(pe(Z,de),X(Z,de,be))){var fe=we(se,Z,de);return W(Z,de,be,fe,ee)}var Se=we(se,Z,de);return O(Z,de,be,Se,ee)}function X(se,be,ee){for(var Z=0;Z<be;Z++)for(var ne=Z;ne<be;ne++)if(b(d(s(a(se[Z][ne],se[ne][Z]))),ee))return!1;return!0}function U(se,be,ee){for(var Z=0;Z<be;Z++)for(var ne=0;ne<be;ne++)if(b(d(s(R(se[Z][ne]))),ee))return!1;return!0}function pe(se,be){for(var ee=0;ee<be;ee++)for(var Z=0;Z<be;Z++)se[ee][Z]=L(se[ee][Z])}function we(se,be,ee){var Z=se.datatype();if(Z==="number"||Z==="BigNumber"||Z==="Complex")return Z;for(var ne=!1,de=!1,fe=!1,Se=0;Se<ee;Se++)for(var _e=0;_e<ee;_e++){var G=be[Se][_e];if(At(G)||Xs(G))ne=!0;else if(ct(G))de=!0;else if(ra(G))fe=!0;else throw TypeError("Unsupported type in Matrix: "+cr(G))}if(de&&fe&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),fe){for(var J=0;J<ee;J++)for(var ge=0;ge<ee;ge++)be[J][ge]=w(be[J][ge]);return"Complex"}if(de){for(var xe=0;xe<ee;xe++)for(var Ee=0;Ee<ee;Ee++)be[xe][Ee]=d(be[xe][Ee]);return"BigNumber"}if(ne){for(var Be=0;Be<ee;Be++)for(var Ue=0;Ue<ee;Ue++)be[Be][Ue]=A(be[Be][Ue]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var mV="expm",ene=["typed","abs","add","identity","inv","multiply"],rE=M(mV,ene,t=>{var{typed:e,abs:r,add:n,identity:i,inv:a,multiply:o}=t;return e(mV,{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),x=l(h,d),b=x.q,T=x.j,v=o(f,Math.pow(2,-T)),A=i(p),w=i(p),y=1,E=v,D=-1,_=1;_<=b;_++)_>1&&(E=o(E,v),D=-D),y=y*(b-_+1)/((2*b-_+1)*_),A=n(A,o(y,E)),w=n(w,o(y*D,E));for(var C=o(a(w),A),N=0;N<T;N++)C=o(C,C);return qo(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,x=f+1;x<=2*f;x++)h*=x;var b=h*(2*f+1);return 8*Math.pow(c/Math.pow(2,m),2*f)*p*p/(h*b)}});var dV="sqrtm",tne=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],nE=M(dV,tne,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 x,b=0,T=h,v=f(u(h));do{var A=T;if(T=i(.5,n(A,l(v))),v=i(.5,n(v,l(A))),x=c(r(s(T,A))),x>p&&++b>m)throw new Error("computing square root of matrix: iterative method could not converge")}while(x>p);return T}return e(dV,{"Array | Matrix":function(x){var b=rt(x)?x.size():ft(x);switch(b.length){case 1:if(b[0]===1)return a(x,o);throw new RangeError("Matrix must be square (size: "+Dt(b)+")");case 2:{var T=b[0],v=b[1];if(T===v)return d(x);throw new RangeError("Matrix must be square (size: "+Dt(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Dt(b)+")")}}})});var hV="sylvester",rne=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],iE=M(hV,rne,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(hV,{"Matrix, Matrix, Matrix":x,"Array, Matrix, Matrix":function(T,v,A){return x(i(T),v,A)},"Array, Array, Matrix":function(T,v,A){return x(i(T),i(v),A)},"Array, Matrix, Array":function(T,v,A){return x(i(T),v,i(A))},"Matrix, Array, Matrix":function(T,v,A){return x(T,i(v),A)},"Matrix, Array, Array":function(T,v,A){return x(T,i(v),i(A))},"Matrix, Matrix, Array":function(T,v,A){return x(T,v,i(A))},"Array, Array, Array":function(T,v,A){return x(i(T),i(v),i(A)).toArray()}});function x(b,T,v){for(var A=T.size()[0],w=b.size()[0],y=r(b),E=y.T,D=y.U,_=r(a(-1,T)),C=_.T,N=_.U,P=a(a(l(D),v),N),R=o(0,w),L=[],V=(fe,Se)=>s(fe,Se,1),k=(fe,Se)=>s(fe,Se,0),B=0;B<A;B++)if(B<A-1&&h(c(C,u(B+1,B)))>1e-5){for(var W=k(c(P,u(R,B)),c(P,u(R,B+1))),O=0;O<B;O++)W=f(W,k(a(L[O],c(C,u(O,B))),a(L[O],c(C,u(O,B+1)))));var Q=a(p(w),a(-1,c(C,u(B,B)))),ie=a(p(w),a(-1,c(C,u(B+1,B)))),X=a(p(w),a(-1,c(C,u(B,B+1)))),U=a(p(w),a(-1,c(C,u(B+1,B+1)))),pe=k(V(f(E,Q),ie),V(X,f(E,U))),we=d(pe,W);L[B]=we.subset(u(o(0,w),0)),L[B+1]=we.subset(u(o(w,2*w),0)),B++}else{for(var se=c(P,u(R,B)),be=0;be<B;be++)se=f(se,a(L[be],c(C,u(be,B))));var ee=c(C,u(B,B)),Z=m(E,a(ee,p(w)));L[B]=d(Z,se)}var ne=i(n(...L)),de=a(D,a(ne,l(N)));return de}});var gV="schur",nne=["typed","matrix","identity","multiply","qr","norm","subtract"],aE=M(gV,nne,t=>{var{typed:e,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:s}=t;return e(gV,{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),x=h.Q,b=h.R;if(f=i(b,x),m=i(m,x),p++>100)break}while(o(s(f,d))>1e-4);return{U:m,T:f}}});var vV="lyap",ine=["typed","matrix","sylvester","multiply","transpose"],oE=M(vV,ine,t=>{var{typed:e,matrix:r,sylvester:n,multiply:i,transpose:a}=t;return e(vV,{"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 ane="divide",one=["typed","matrix","multiply","equalScalar","divideScalar","inv"],sE=M(ane,one,t=>{var{typed:e,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=t,s=Br({typed:e,equalScalar:i}),l=Fn({typed:e});return e("divide",Fg({"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 yV="distance",sne=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],uE=M(yV,sne,t=>{var{typed:e,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:l}=t;return e(yV,{"Array, Array, Array":function(w,y,E){if(w.length===2&&y.length===2&&E.length===2){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(y))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(y,E))throw new TypeError("LinePoint1 should not be same with LinePoint2");var D=n(E[1],y[1]),_=n(y[0],E[0]),C=n(i(E[0],y[1]),i(y[0],E[1]));return x(w[0],w[1],D,_,C)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(w,y,E){if(Object.keys(w).length===2&&Object.keys(y).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(y))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(y),d(E)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in w&&"pointY"in w&&"lineOnePtX"in y&&"lineOnePtY"in y&&"lineTwoPtX"in E&&"lineTwoPtY"in E){var D=n(E.lineTwoPtY,y.lineOnePtY),_=n(y.lineOnePtX,E.lineTwoPtX),C=n(i(E.lineTwoPtX,y.lineOnePtY),i(y.lineOnePtX,E.lineTwoPtY));return x(w.pointX,w.pointY,D,_,C)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(w,y){if(w.length===2&&y.length===3){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(y))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return x(w[0],w[1],y[0],y[1],y[2])}else if(w.length===3&&y.length===6){if(!f(w))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(y))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return b(w[0],w[1],w[2],y[0],y[1],y[2],y[3],y[4],y[5])}else if(w.length===y.length&&w.length>0){if(!m(w))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(y))throw new TypeError("All values of an array should be numbers or BigNumbers");return T(w,y)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(w,y){if(Object.keys(w).length===2&&Object.keys(y).length===3){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(y))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"xCoeffLine"in y&&"yCoeffLine"in y&&"constant"in y)return x(w.pointX,w.pointY,y.xCoeffLine,y.yCoeffLine,y.constant);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(y).length===6){if(!f(w))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(y))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 y&&"y0"in y&&"z0"in y&&"a"in y&&"b"in y&&"c"in y)return b(w.pointX,w.pointY,w.pointZ,y.x0,y.y0,y.z0,y.a,y.b,y.c);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===2&&Object.keys(y).length===2){if(!c(w))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(y))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointTwoX"in y&&"pointTwoY"in y)return T([w.pointOneX,w.pointOneY],[y.pointTwoX,y.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(y).length===3){if(!f(w))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(y))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 y&&"pointTwoY"in y&&"pointTwoZ"in y)return T([w.pointOneX,w.pointOneY,w.pointOneZ],[y.pointTwoX,y.pointTwoY,y.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"||ct(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),y=[],E=0;E<w.length;E++)y.push(A[w[E]]);return y}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 x(A,w,y,E,D){var _=l(r(r(i(y,A),i(E,w)),D)),C=s(r(i(y,y),i(E,E)));return a(_,C)}function b(A,w,y,E,D,_,C,N,P){var R=[n(i(n(D,w),P),i(n(_,y),N)),n(i(n(_,y),C),i(n(E,A),P)),n(i(n(E,A),N),i(n(D,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(P,P)));return a(R,L)}function T(A,w){for(var y=A.length,E=0,D=0,_=0;_<y;_++)D=n(A[_],w[_]),E=r(i(D,D),E);return s(E)}function v(A){for(var w=[],y=[],E=[],D=0;D<A.length-1;D++)for(var _=D+1;_<A.length;_++)A[0].length===2?(y=[A[D][0],A[D][1]],E=[A[_][0],A[_][1]]):A[0].length===3&&(y=[A[D][0],A[D][1],A[D][2]],E=[A[_][0],A[_][1],A[_][2]]),w.push(T(y,E));return w}});var une="intersect",lne=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],lE=M(une,lne,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":x,"Array, Array, Array, Array":b,"Matrix, Matrix, Matrix":function(N,P,R){var L=x(N.valueOf(),P.valueOf(),R.valueOf());return L===null?null:o(L)},"Matrix, Matrix, Matrix, Matrix":function(N,P,R,L){var V=b(N.valueOf(),P.valueOf(),R.valueOf(),L.valueOf());return V===null?null:o(V)}});function x(C,N,P){if(C=T(C),N=T(N),P=T(P),!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(P))throw new TypeError("Array with 4 numbers expected as third argument");return _(C[0],C[1],C[2],N[0],N[1],N[2],P[0],P[1],P[2],P[3])}function b(C,N,P,R){if(C=T(C),N=T(N),P=T(P),R=T(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(P))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 y(C,N,P,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(P))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 D(C[0],C[1],C[2],N[0],N[1],N[2],P[0],P[1],P[2],R[0],R[1],R[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function T(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 y(C,N,P,R){var L=C,V=P,k=c(L,N),B=c(V,R),W=c(l(k[0],B[1]),l(B[0],k[1]));if(d(W)||f(n(W),r.relTol))return null;var O=l(B[0],L[1]),Q=l(B[1],L[0]),ie=l(B[0],V[1]),X=l(B[1],V[0]),U=u(a(c(c(O,Q),ie),X),W);return i(s(k,U),L)}function E(C,N,P,R,L,V,k,B,W,O,Q,ie){var X=l(c(C,N),c(P,R)),U=l(c(L,V),c(k,B)),pe=l(c(W,O),c(Q,ie));return a(a(X,U),pe)}function D(C,N,P,R,L,V,k,B,W,O,Q,ie){var X=E(C,k,O,k,N,B,Q,B,P,W,ie,W),U=E(O,k,R,C,Q,B,L,N,ie,W,V,P),pe=E(C,k,R,C,N,B,L,N,P,W,V,P),we=E(O,k,O,k,Q,B,Q,B,ie,W,ie,W),se=E(R,C,R,C,L,N,L,N,V,P,V,P),be=c(l(X,U),l(pe,we)),ee=c(l(se,we),l(U,U));if(d(ee))return null;var Z=u(be,ee),ne=u(a(X,l(Z,U)),we),de=a(C,l(Z,c(R,C))),fe=a(N,l(Z,c(L,N))),Se=a(P,l(Z,c(V,P))),_e=a(k,l(ne,c(O,k))),G=a(B,l(ne,c(Q,B))),J=a(W,l(ne,c(ie,W)));return m(de,_e)&&m(fe,G)&&m(Se,J)?[de,fe,Se]:null}function _(C,N,P,R,L,V,k,B,W,O){var Q=l(C,k),ie=l(R,k),X=l(N,B),U=l(L,B),pe=l(P,W),we=l(V,W),se=c(c(c(O,Q),X),pe),be=c(c(c(a(a(ie,U),we),Q),X),pe),ee=u(se,be),Z=a(C,l(ee,c(R,C))),ne=a(N,l(ee,c(L,N))),de=a(P,l(ee,c(V,P)));return[Z,ne,de]}});var xV="sum",cne=["typed","config","add","numeric"],Tm=M(xV,cne,t=>{var{typed:e,config:r,add:n,numeric:i}=t;return e(xV,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(l){if(_o(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 An(c,"sum",u)}}),l===void 0&&(l=i(0,r.number)),typeof l=="string"&&(l=i(l,Bi(l,r))),l}function o(s,l){try{var u=Hu(s,l,n);return u}catch(c){throw An(c,"sum")}}});var Rv="cumsum",fne=["typed","add","unaryPlus"],Dm=M(Rv,fne,t=>{var{typed:e,add:r,unaryPlus:n}=t;return e(Rv,{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(_o(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 An(u,Rv)}}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=ft(l);if(u<0||u>=c.length)throw new Si(u,c.length);try{return s(l,u)}catch(f){throw An(f,Rv)}}function s(l,u){var c,f,m;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(m=Zg(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 bV="mean",pne=["typed","add","divide"],Mm=M(bV,pne,t=>{var{typed:e,add:r,divide:n}=t;return e(bV,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(s){if(_o(s))throw new TypeError("Scalar values expected in function mean");return a(s)}});function i(o,s){try{var l=Hu(o,s,r),u=Array.isArray(o)?ft(o):o.size();return n(l,u[s])}catch(c){throw An(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 An(c,"mean",u)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(s,l)}});var wV="median",mne=["typed","add","divide","compare","partitionSelect"],cE=M(wV,mne,t=>{var{typed:e,add:r,divide:n,compare:i,partitionSelect:a}=t;function o(u){try{u=Ot(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(x){throw An(x,"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(wV,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(_o(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var _V="mad",dne=["typed","abs","map","median","subtract"],fE=M(_V,dne,t=>{var{typed:e,abs:r,map:n,median:i,subtract:a}=t;return e(_V,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=Ot(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")):An(u,"mad")}}});var pE="unbiased",AV="variance",hne=["typed","add","subtract","multiply","divide","apply","isNaN"],Cm=M(AV,hne,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=t;return e(AV,{"Array | Matrix":function(f){return l(f,pE)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(f,m){return u(f,m,pE)},"Array | Matrix, number | BigNumber, string":u,"...":function(f){return l(f,pE)}});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(x){try{m=m===void 0?x:r(m,x),p++}catch(b){throw An(b,"variance",x)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var d=a(m,p);if(m=void 0,Oi(c,function(x){var b=n(x,d);m=m===void 0?i(b,b):r(m,i(b,b))}),s(m))return m;switch(f){case"uncorrected":return a(m,p);case"biased":return a(m,p+1);case"unbiased":{var h=ct(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 An(p,"variance")}}});var SV="quantileSeq",gne=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Nm=M(SV,gne,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}=t,p=Jl({typed:e,isInteger:u});return e(SV,{"Array | Matrix, number | BigNumber":(T,v)=>h(T,v,!1),"Array | Matrix, number | BigNumber, number":(T,v,A)=>d(T,v,!1,A,h),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(T,v,A,w)=>d(T,v,A,w,h),"Array | Matrix, Array | Matrix":(T,v)=>x(T,v,!1),"Array | Matrix, Array | Matrix, number":(T,v,A)=>d(T,v,!1,A,x),"Array | Matrix, Array | Matrix, boolean":x,"Array | Matrix, Array | Matrix, boolean, number":(T,v,A,w)=>d(T,v,A,w,x)});function d(T,v,A,w,y){return p(T,w,E=>y(E,v,A))}function h(T,v,A){var w,y=T.valueOf();if(c(v,0))throw new Error("N/prob must be non-negative");if(f(v,1))return At(v)?b(y,v,A):r(b(y,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 D=0;c(D,v);D++){var _=a(D+1,E);w.push(b(y,_,A))}return At(v)?w:r(w)}}function x(T,v,A){for(var w=T.valueOf(),y=v.valueOf(),E=[],D=0;D<y.length;++D)E.push(b(w,y[D],A));return E}function b(T,v,A){var w=Ot(T),y=w.length;if(y===0)throw new Error("Cannot calculate quantile of an empty sequence");var E=At(v)?v*(y-1):v.times(y-1),D=At(v)?Math.floor(E):E.floor().toNumber(),_=At(v)?E%1:E.minus(D);if(u(E))return A?w[E]:s(w,At(v)?E:E.valueOf());var C,N;if(A)C=w[D],N=w[D+1];else{N=s(w,D+1),C=w[D];for(var P=0;P<D;++P)l(w[P],C)>0&&(C=w[P])}return n(o(C,i(1,_)),o(N,_))}});var EV="std",vne=["typed","map","sqrt","variance"],Fm=M(EV,vne,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t;return e(EV,{"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 Tn(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 TV="corr",yne=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],mE=M(TV,yne,t=>{var{typed:e,matrix:r,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:l,divide:u}=t;return e(TV,{"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),x=i(p),b=m.reduce((y,E,D)=>a(y,s(E,p[D])),0),T=i(m.map(y=>l(y,2))),v=i(p.map(y=>l(y,2))),A=o(s(d,b),s(h,x)),w=n(s(o(s(d,T),l(h,2)),o(s(d,v),l(x,2))));return u(A,w)}});var DV="combinations",xne=["typed"],dE=M(DV,xne,t=>{var{typed:e}=t;return e(DV,{"number, number":Ow,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!MV(n)||!MV(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 MV(t){return t.isInteger()&&t.gte(0)}var CV="combinationsWithRep",bne=["typed"],hE=M(CV,bne,t=>{var{typed:e}=t;return e(CV,{"number, number":function(n,i){if(!Qe(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Qe(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=Wa(n,n+i-1);return a/Wa(1,i)}var o=Wa(i+1,n+i-1);return o/Wa(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=new a(1),u=n.minus(l);if(!NV(n)||!NV(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 NV(t){return t.isInteger()&&t.gte(0)}var FV="gamma",wne=["typed","config","multiplyScalar","pow","BigNumber","Complex"],gE=M(FV,wne,t=>{var{typed:e,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=t;function s(u){if(u.im===0)return nm(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(Zl[0],0),p=1;p<Zl.length;++p){var d=new o(Zl[p],0);m=m.add(d.div(u.add(p)))}var h=new o(u.re+Vw+.5,u.im),x=Math.sqrt(2*Math.PI),b=h.pow(u.add(.5)),T=h.neg().exp();return m.mul(x).mul(b).mul(T)}return e(FV,{number:nm,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 IV="lgamma",_ne=["Complex","typed"],vE=M(IV,_ne,t=>{var{Complex:e,typed:r}=t,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(IV,{number:im,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(im(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=m){var p=hP(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(Uw),f=new e(1,0).div(u),m=f.div(u),p=a[0],d=a[1],h=2*m.re,x=m.re*m.re+m.im*m.im,b=2;b<8;b++){var T=d;d=-x*p+a[b],p=h*p+T}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 PV="factorial",Ane=["typed","gamma"],yE=M(PV,Ane,t=>{var{typed:e,gamma:r}=t;return e(PV,{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=>nt(i,n))})});var BV="kldivergence",Sne=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],xE=M(BV,Sne,t=>{var{typed:e,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=t;return e(BV,{"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 x=i(m);if(x===0)throw new Error("Sum of elements in second object must be non zero");var b=n(f,i(f)),T=n(m,i(m)),v=i(a(b,o(s(b,T),A=>l(A))));return u(v)?v:Number.NaN}});var kV="multinomial",Ene=["typed","add","divide","multiply","factorial","isInteger","isPositive"],bE=M(kV,Ene,t=>{var{typed:e,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=t;return e(kV,{"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 $V="permutations",Tne=["typed","factorial"],wE=M($V,Tne,t=>{var{typed:e,factorial:r}=t;return e($V,{"number | BigNumber":r,"number, number":function(i,a){if(!Qe(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!Qe(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 Wa(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,s;if(!OV(i)||!OV(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 OV(t){return t.isInteger()&&t.gte(0)}var ME=zr(KV(),1),Pne=(0,ME.default)(Date.now());function iu(t){var e;function r(i){e=i===null?Pne:(0,ME.default)(String(i))}r(t);function n(){return e()}return n}var eU="pickRandom",Bne=["typed","config","?on"],CE=M(eU,Bne,t=>{var{typed:e,config:r,on:n}=t,i=iu(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=iu(o.randomSeed))}),e(eU,{"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=rt(o)?o.create:rt(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),c===!0&&(o=Ot(o),u=Ot(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(!At(u[d])||u[d]<0)throw new Error("Weights must be an array of positive numbers");p+=u[d]}}for(var x=o.length,b=[],T;b.length<l;){if(typeof u>"u")T=o[Math.floor(i()*x)];else for(var v=i()*p,A=0,w=o.length;A<w;A++)if(v-=u[A],v<0){T=o[A];break}b.push(T)}return f?b[0]:m?m(b):b}});function Im(t,e){var r=[];if(t=t.slice(0),t.length>1)for(var n=0,i=t.shift();n<i;n++)r.push(Im(t,e));else for(var a=0,o=t.shift();a<o;a++)r.push(e());return r}var tU="random",kne=["typed","config","?on"],NE=M(tU,kne,t=>{var{typed:e,config:r,on:n}=t,i=iu(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=iu(s.randomSeed))}),e(tU,{"":()=>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=Im(s.valueOf(),()=>o(l,u));return rt(s)?s.create(c,"number"):c}function o(s,l){return s+i()*(l-s)}});var rU="randomInt",$ne=["typed","config","?on"],FE=M(rU,$ne,t=>{var{typed:e,config:r,on:n}=t,i=iu(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=iu(s.randomSeed))}),e(rU,{"":()=>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=Im(s.valueOf(),()=>o(l,u));return rt(s)?s.create(c,"number"):c}function o(s,l){return Math.floor(s+i()*(l-s))}});var nU="stirlingS2",One=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],IE=M(nU,One,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(nU,{"number | BigNumber, number | BigNumber":function(b,T){if(!c(b)||u(b)||!c(T)||u(T))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(T,b))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(At(b)&&At(T)),A=v?h:d,w=v?m:f,y=f(b),E=f(T);if(A[y]&&A[y].length>E)return A[y][E];for(var D=0;D<=y;++D)if(A[D]||(A[D]=[w(D===0?1:0)]),D!==0)for(var _=A[D],C=A[D-1],N=_.length;N<=D&&N<=E;++N)N===D?_[N]=1:_[N]=r(i(w(N),C[N]),C[N-1]);return A[y][E]}})});var iU="bellNumbers",Rne=["typed","addScalar","isNegative","isInteger","stirlingS2"],PE=M(iU,Rne,t=>{var{typed:e,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=t;return e(iU,{"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 aU="catalan",Lne=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],BE=M(aU,Lne,t=>{var{typed:e,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=t;return e(aU,{"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 oU="composition",Vne=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],kE=M(oU,Vne,t=>{var{typed:e,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=t;return e(oU,{"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 sU="leafCount",Une=["parse","typed"],$E=M(sU,Une,t=>{var{parse:e,typed:r}=t;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(sU,{Node:function(a){return n(a)}})});function OE(t){return zt(t)||Qr(t)&&t.isUnary()&&zt(t.args[0])}function Pm(t){return!!(zt(t)||(na(t)||Qr(t))&&t.args.every(Pm)||_i(t)&&Pm(t.content))}function uU(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 RE(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?uU(Object(r),!0).forEach(function(n){Er(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):uU(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var qne="simplifyUtil",zne=["FunctionNode","OperatorNode","SymbolNode"],Bf=M(qne,zne,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,y=o;if(typeof v=="string"?y=v:Qr(v)?y=v.fn.toString():na(v)?y=v.name:_i(v)&&(y="paren"),ot(w,y)){var E=w[y];if(ot(E,A))return E[A];if(ot(s,y))return s[y][A]}if(ot(w,o)){var D=w[o];return ot(D,A)?D[A]:s[o][A]}if(ot(s,y)){var _=s[y];if(ot(_,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=RE({},v);for(var y in A)ot(v,y)?w[y]=RE(RE({},A[y]),v[y]):w[y]=A[y];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,y=[],E=function(_){for(var C=0;C<_.args.length;C++){var N=_.args[C];Qr(N)&&w===N.op?E(N):y.push(N)}};return m(v,A)?(w=v.op,E(v),y):v.args}function x(v,A){if(!(!v.args||v.args.length===0)){for(var w=T(v),y=v.args.length,E=0;E<y;E++)x(v.args[E],A);if(y>2&&m(v,A)){for(var D=v.args.pop();v.args.length>0;)D=w([v.args.pop(),D]);v.args=D.args}}}function b(v,A){if(!(!v.args||v.args.length===0)){for(var w=T(v),y=v.args.length,E=0;E<y;E++)b(v.args[E],A);if(y>2&&m(v,A)){for(var D=v.args.shift();v.args.length>0;)D=w([D,v.args.shift()]);v.args=D.args}}}function T(v){return Qr(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:T,hasProperty:c,isCommutative:f,isAssociative:m,mergeContext:p,flatten:d,allChildren:h,unflattenr:x,unflattenl:b,defaultContext:s,realContext:l,positiveContext:u}});var Hne="simplify",Gne=["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],LE=M(Hne,Gne,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:x}=t,{hasProperty:b,isCommutative:T,isAssociative:v,mergeContext:A,flatten:w,unflattenr:y,unflattenl:E,createMakeNodeFunction:D,defaultContext:_,realContext:C,positiveContext:N}=Bf({FunctionNode:c,OperatorNode:p,SymbolNode:h});e.addConversion({from:"Object",to:"Map",convert:Js});var P=e("simplify",{Node:O,"Node, Map":(ee,Z)=>O(ee,!1,Z),"Node, Map, Object":(ee,Z,ne)=>O(ee,!1,Z,ne),"Node, Array":O,"Node, Array, Map":O,"Node, Array, Map, Object":O});e.removeConversion({from:"Object",to:"Map",convert:Js}),P.defaultContext=_,P.realContext=C,P.positiveContext=N;function R(ee){return ee.transform(function(Z){return _i(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};P.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 ne={};if(ee.s){var de=ee.s.split("->");if(de.length===2)ne.l=de[0],ne.r=de[1];else throw SyntaxError("Could not parse rule: "+ee.s)}else ne.l=ee.l,ne.r=ee.r;ne.l=R(r(ne.l)),ne.r=R(r(ne.r));for(var fe of["imposeContext","repeat","assuming"])fe in ee&&(ne[fe]=ee[fe]);if(ee.evaluate&&(ne.evaluate=r(ee.evaluate)),v(ne.l,Z)){var Se=!T(ne.l,Z),_e;Se&&(_e=W());var G=D(ne.l),J=W();ne.expanded={},ne.expanded.l=G([ne.l,J]),w(ne.expanded.l,Z),y(ne.expanded.l,Z),ne.expanded.r=G([ne.r,J]),Se&&(ne.expandedNC1={},ne.expandedNC1.l=G([_e,ne.l]),ne.expandedNC1.r=G([_e,ne.r]),ne.expandedNC2={},ne.expandedNC2.l=G([_e,ne.expanded.l]),ne.expandedNC2.r=G([_e,ne.expanded.r]))}return ne}function k(ee,Z){for(var ne=[],de=0;de<ee.length;de++){var fe=ee[de],Se=void 0,_e=typeof fe;switch(_e){case"string":fe={s:fe};case"object":Se=V(fe,Z);break;case"function":Se=fe;break;default:throw TypeError("Unsupported type of rule: "+_e)}ne.push(Se)}return ne}var B=0;function W(){return new h("_p"+B++)}function O(ee,Z){var ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ku(),de=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},fe=de.consoleDebug;Z=k(Z||P.rules,de.context);var Se=i(ee,ne);Se=R(Se);for(var _e={},G=Se.toString({parenthesis:"all"});!_e[G];){_e[G]=!0,B=0;var J=G;fe&&console.log("Working on: ",G);for(var ge=0;ge<Z.length;ge++){var xe="";if(typeof Z[ge]=="function"?(Se=Z[ge](Se,de),fe&&(xe=Z[ge].name)):(w(Se,de.context),Se=ie(Se,Z[ge],de.context),fe&&(xe="".concat(Z[ge].l.toString()," -> ").concat(Z[ge].r.toString()))),fe){var Ee=Se.toString({parenthesis:"all"});Ee!==J&&(console.log("Applying",xe,"produced",Ee),J=Ee)}E(Se,de.context)}G=Se.toString({parenthesis:"all"})}return Se}function Q(ee,Z,ne){var de=ee;if(ee)for(var fe=0;fe<ee.length;++fe){var Se=ie(ee[fe],Z,ne);Se!==ee[fe]&&(de===ee&&(de=ee.slice()),de[fe]=Se)}return de}function ie(ee,Z,ne){if(Z.assuming){for(var de in Z.assuming)for(var fe in Z.assuming[de])if(b(de,fe,ne)!==Z.assuming[de][fe])return ee}var Se=A(Z.imposeContext,ne),_e=ee;if(_e instanceof p||_e instanceof c){var G=Q(_e.args,Z,ne);G!==_e.args&&(_e=_e.clone(),_e.args=G)}else if(_e instanceof d){if(_e.content){var J=ie(_e.content,Z,ne);J!==_e.content&&(_e=new d(J))}}else if(_e instanceof l){var ge=Q(_e.items,Z,ne);ge!==_e.items&&(_e=new l(ge))}else if(_e instanceof s){var xe=_e.object;_e.object&&(xe=ie(_e.object,Z,ne));var Ee=_e.index;_e.index&&(Ee=ie(_e.index,Z,ne)),(xe!==_e.object||Ee!==_e.index)&&(_e=new s(xe,Ee))}else if(_e instanceof f){var Be=Q(_e.dimensions,Z,ne);Be!==_e.dimensions&&(_e=new f(Be))}else if(_e instanceof m){var Ue=!1,et={};for(var St in _e.properties)et[St]=ie(_e.properties[St],Z,ne),et[St]!==_e.properties[St]&&(Ue=!0);Ue&&(_e=new m(et))}var Ye=Z.r,ur=se(Z.l,_e,Se)[0];if(!ur&&Z.expanded&&(Ye=Z.expanded.r,ur=se(Z.expanded.l,_e,Se)[0]),!ur&&Z.expandedNC1&&(Ye=Z.expandedNC1.r,ur=se(Z.expandedNC1.l,_e,Se)[0],ur||(Ye=Z.expandedNC2.r,ur=se(Z.expandedNC2.l,_e,Se)[0])),ur){var Jt=_e.implicit;_e=Ye.clone(),Jt&&"implicit"in Ye&&(_e.implicit=!0),_e=_e.transform(function(yr){return yr.isSymbolNode&&ot(ur.placeholders,yr.name)?ur.placeholders[yr.name].clone():yr})}return Z.repeat&&_e!==ee&&(_e=ie(_e,Z,ne)),_e}function X(ee,Z){var ne=[],de,fe,Se=D(ee);if(T(ee,Z))for(var _e=0;_e<ee.args.length;_e++)fe=ee.args.slice(0),fe.splice(_e,1),de=fe.length===1?fe[0]:Se(fe),ne.push(Se([ee.args[_e],de]));else for(var G=1;G<ee.args.length;G++){var J=ee.args[0];G>1&&(J=Se(ee.args.slice(0,G))),fe=ee.args.slice(G),de=fe.length===1?fe[0]:Se(fe),ne.push(Se([J,de]))}return ne}function U(ee,Z){var ne={placeholders:{}};if(!ee.placeholders&&!Z.placeholders)return ne;if(ee.placeholders){if(!Z.placeholders)return ee}else return Z;for(var de in ee.placeholders)if(ot(ee.placeholders,de)&&(ne.placeholders[de]=ee.placeholders[de],ot(Z.placeholders,de)&&!be(ee.placeholders[de],Z.placeholders[de])))return null;for(var fe in Z.placeholders)ot(Z.placeholders,fe)&&(ne.placeholders[fe]=Z.placeholders[fe]);return ne}function pe(ee,Z){var ne=[];if(ee.length===0||Z.length===0)return ne;for(var de,fe=0;fe<ee.length;fe++)for(var Se=0;Se<Z.length;Se++)de=U(ee[fe],Z[Se]),de&&ne.push(de);return ne}function we(ee){if(ee.length===0)return ee;for(var Z=ee.reduce(pe),ne=[],de={},fe=0;fe<Z.length;fe++){var Se=JSON.stringify(Z[fe],x);de[Se]||(de[Se]=!0,ne.push(Z[fe]))}return ne}function se(ee,Z,ne,de){var fe=[{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,ne)&&Z.args.length===ee.args.length||de){for(var Se=[],_e=0;_e<ee.args.length;_e++){var G=se(ee.args[_e],Z.args[_e],ne);if(G.length===0)break;Se.push(G)}if(Se.length!==ee.args.length){if(!T(Z,ne)||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=se(ee.args[0],Z.args[1],ne);if(J.length===0)return[];var ge=se(ee.args[1],Z.args[0],ne);if(ge.length===0)return[];Se=[J,ge]}fe=we(Se)}else if(Z.args.length>=2&&ee.args.length===2){for(var xe=X(Z,ne),Ee=[],Be=0;Be<xe.length;Be++){var Ue=se(ee,xe[Be],ne,!0);Ee=Ee.concat(Ue)}return Ee}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":fe[0].placeholders[ee.name]=Z;break;case"c":case"cl":if(zt(Z))fe[0].placeholders[ee.name]=Z;else return[];break;case"v":if(!zt(Z))fe[0].placeholders[ee.name]=Z;else return[];break;case"vl":if(Yr(Z))fe[0].placeholders[ee.name]=Z;else return[];break;case"cd":if(OE(Z))fe[0].placeholders[ee.name]=Z;else return[];break;case"vd":if(!OE(Z))fe[0].placeholders[ee.name]=Z;else return[];break;case"ce":if(Pm(Z))fe[0].placeholders[ee.name]=Z;else return[];break;case"ve":if(!Pm(Z))fe[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 fe}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 ne=0;ne<ee.args.length;ne++)if(!be(ee.args[ne],Z.args[ne]))return!1}else return!1;return!0}return P});var Wne="simplifyConstant",Yne=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],VE=M(Wne,Yne,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:x,allChildren:b,createMakeNodeFunction:T}=Bf({FunctionNode:c,OperatorNode:p,SymbolNode:d}),v=e("simplifyConstant",{Node:V=>E(L(V,{})),"Node, Object":function(k,B){return E(L(k,B))}});function A(V){return Xs(V)?V.valueOf():V instanceof Array?V.map(A):rt(V)?i(A(V.valueOf())):V}function w(V,k,B){try{return n[V].apply(null,k)}catch{return k=k.map(A),_(n[V].apply(null,k),B)}}var y=e({Fraction:N,number:function(k){return k<0?C(new u(-k)):new u(k)},BigNumber:function(k){return k<0?C(new u(-k)):new u(k)},bigint:function(k){return k<0n?C(new u(-k)):new u(k)},Complex:function(k){throw new Error("Cannot convert Complex number to Node")},string:function(k){return new u(k)},Matrix:function(k){return new l(k.valueOf().map(B=>y(B)))}});function E(V){return nr(V)?V:y(V)}function D(V,k){var B=k&&k.exactFractions!==!1;if(B&&isFinite(V)&&a){var W=a(V),O=k&&typeof k.fractionsLimit=="number"?k.fractionsLimit:1/0;if(W.valueOf()===V&&W.n<O&&W.d<O)return W}return V}var _=e({"string, Object":function(k,B){var W=Bi(k,r);if(W==="BigNumber")return o===void 0&&Mf(),o(k);if(W==="bigint")return BigInt(k);if(W==="Fraction")return a===void 0&&av(),a(k);var O=parseFloat(k);return D(O,B)},"Fraction, Object":function(k,B){return k},"BigNumber, Object":function(k,B){return k},"number, Object":function(k,B){return D(k,B)},"bigint, Object":function(k,B){return k},"Complex, Object":function(k,B){return k.im!==0?k:D(k.re,B)},"Matrix, Object":function(k,B){return i(D(k.valueOf()))},"Array, Object":function(k,B){return k.map(D)}});function C(V){return new p("-","unaryMinus",[V])}function N(V){var k=O=>r.number==="BigNumber"&&o?o(O):Number(O),B=V.s*V.n,W=B<0n?new p("-","unaryMinus",[new u(-k(B))]):new u(k(B));return V.d===1n?W:new p("/","divide",[W,new u(k(V.d))])}function P(V,k,B){if(!vo(k))return new s(E(V),E(k));if(wi(V)||rt(V)){for(var W=Array.from(k.dimensions);W.length>0;)if(zt(W[0])&&typeof W[0].value!="string"){var O=_(W.shift().value,B);wi(V)?V=V.items[O-1]:(V=V.valueOf()[O-1],V instanceof Array&&(V=i(V)))}else if(W.length>1&&zt(W[1])&&typeof W[1].value!="string"){var Q=_(W[1].value,B),ie=[],X=wi(V)?V.items:V.valueOf();for(var U of X)if(wi(U))ie.push(U.items[Q-1]);else if(rt(V))ie.push(U[Q-1]);else break;if(ie.length===X.length)wi(V)?V=new l(ie):V=i(ie),W.splice(1,1);else break}else break;return W.length===k.dimensions.length?new s(E(V),k):W.length>0?(k=new f(W),new s(E(V),k)):V}if(Ru(V)&&k.dimensions.length===1&&zt(k.dimensions[0])){var pe=k.dimensions[0].value;return pe in V.properties?V.properties[pe]:new u}return new s(E(V),k)}function R(V,k,B,W){var O=k.shift(),Q=k.reduce((ie,X)=>{if(!nr(X)){var U=ie.pop();if(nr(U))return[U,X];try{return ie.push(w(V,[U,X],W)),ie}catch{ie.push(U)}}ie.push(E(ie.pop()));var pe=ie.length===1?ie[0]:B(ie);return[B([pe,E(X)])]},[O]);return Q.length===1?Q[0]:B([Q[0],y(Q[1])])}function L(V,k){switch(V.type){case"SymbolNode":return V;case"ConstantNode":switch(typeof V.value){case"number":return _(V.value,k);case"bigint":return _(V.value,k);case"string":return V.value;default:if(!isNaN(V.value))return _(V.value,k)}return V;case"FunctionNode":if(n[V.name]&&n[V.name].rawArgs)return V;{var B=["add","multiply"];if(!B.includes(V.name)){var W=V.args.map(de=>L(de,k));if(!W.some(nr))try{return w(V.name,W,k)}catch{}if(V.name==="size"&&W.length===1&&wi(W[0])){for(var O=[],Q=W[0];wi(Q);)O.push(Q.items.length),Q=Q.items[0];return i(O)}return new c(V.name,W.map(E))}}case"OperatorNode":{var ie=V.fn.toString(),X,U,pe=T(V);if(Qr(V)&&V.isUnary())X=[L(V.args[0],k)],nr(X[0])?U=pe(X):U=w(ie,X,k);else if(x(V,k.context))if(X=b(V,k.context),X=X.map(de=>L(de,k)),h(ie,k.context)){for(var we=[],se=[],be=0;be<X.length;be++)nr(X[be])?se.push(X[be]):we.push(X[be]);we.length>1?(U=R(ie,we,pe,k),se.unshift(U),U=R(ie,se,pe,k)):U=R(ie,X,pe,k)}else U=R(ie,X,pe,k);else X=V.args.map(de=>L(de,k)),U=R(ie,X,pe,k);return U}case"ParenthesisNode":return L(V.content,k);case"AccessorNode":return P(L(V.object,k),L(V.index,k),k);case"ArrayNode":{var ee=V.items.map(de=>L(de,k));return ee.some(nr)?new l(ee.map(E)):i(ee)}case"IndexNode":return new f(V.dimensions.map(de=>v(de,k)));case"ObjectNode":{var Z={};for(var ne in V.properties)Z[ne]=v(V.properties[ne],k);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 lU="simplifyCore",jne=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],UE=M(lU,jne,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:x,ParenthesisNode:b,SymbolNode:T}=t,v=new m(0),A=new m(1),w=new m(!0),y=new m(!1);function E(N){return Qr(N)&&["and","not","or"].includes(N.op)}var{hasProperty:D,isCommutative:_}=Bf({FunctionNode:p,OperatorNode:x,SymbolNode:T});function C(N){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=P?P.context:void 0;if(D(N,"trivial",R)){if(na(N)&&N.args.length===1)return C(N.args[0],P);var L=!1,V=0;if(N.forEach(se=>{++V,V===1&&(L=C(se,P))}),V===1)return L}var k=N;if(na(k)){var B=oO(k.name);if(B){if(k.args.length>2&&D(k,"associative",R))for(;k.args.length>2;){var W=k.args.pop(),O=k.args.pop();k.args.push(new x(B,k.name,[W,O]))}k=new x(B,k.name,k.args)}else return new p(C(k.fn),k.args.map(se=>C(se,P)))}if(Qr(k)&&k.isUnary()){var Q=C(k.args[0],P);if(k.op==="~"&&Qr(Q)&&Q.isUnary()&&Q.op==="~"||k.op==="not"&&Qr(Q)&&Q.isUnary()&&Q.op==="not"&&E(Q.args[0]))return Q.args[0];var ie=!0;if(k.op==="-"&&Qr(Q)&&(Q.isBinary()&&Q.fn==="subtract"&&(k=new x("-","subtract",[Q.args[1],Q.args[0]]),ie=!1),Q.isUnary()&&Q.op==="-"))return Q.args[0];if(ie)return new x(k.op,k.fn,[Q])}if(Qr(k)&&k.isBinary()){var X=C(k.args[0],P),U=C(k.args[1],P);if(k.op==="+"){if(zt(X)&&i(X.value))return U;if(zt(U)&&i(U.value))return X;Qr(U)&&U.isUnary()&&U.op==="-"&&(U=U.args[0],k=new x("-","subtract",[X,U]))}if(k.op==="-")return Qr(U)&&U.isUnary()&&U.op==="-"?C(new x("+","add",[X,U.args[0]]),P):zt(X)&&i(X.value)?C(new x("-","unaryMinus",[U])):zt(U)&&i(U.value)?X:new x(k.op,k.fn,[X,U]);if(k.op==="*"){if(zt(X)){if(i(X.value))return v;if(n(X.value,1))return U}if(zt(U)){if(i(U.value))return v;if(n(U.value,1))return X;if(_(k,R))return new x(k.op,k.fn,[U,X],k.implicit)}return new x(k.op,k.fn,[X,U],k.implicit)}if(k.op==="/")return zt(X)&&i(X.value)?v:zt(U)&&n(U.value,1)?X:new x(k.op,k.fn,[X,U]);if(k.op==="^"&&zt(U)){if(i(U.value))return A;if(n(U.value,1))return X}if(k.op==="and"){if(zt(X))if(X.value){if(E(U))return U;if(zt(U))return U.value?w:y}else return y;if(zt(U))if(U.value){if(E(X))return X}else return y}if(k.op==="or"){if(zt(X)){if(X.value)return w;if(E(U))return U}if(zt(U)){if(U.value)return w;if(E(X))return X}}return new x(k.op,k.fn,[X,U])}if(Qr(k))return new x(k.op,k.fn,k.args.map(se=>C(se,P)));if(wi(k))return new f(k.items.map(se=>C(se,P)));if(Ha(k))return new c(C(k.object,P),C(k.index,P));if(vo(k))return new d(k.dimensions.map(se=>C(se,P)));if(Ru(k)){var pe={};for(var we in k.properties)pe[we]=C(k.properties[we],P);return new h(pe)}return k}return e(lU,{Node:C,"Node,Object":C})});var Zne="resolve",Jne=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],qE=M(Zne,Jne,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(Yr(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(nr(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(Qr(l)){var d=l.args.map(function(x){return s(x,u,c)});return new a(l.op,l.fn,d,l.implicit)}else{if(_i(l))return new o(s(l.content,u,c));if(na(l)){var h=l.args.map(function(x){return s(x,u,c)});return new i(l.name,h)}}return l.map(x=>s(x,u,c))}return e("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(l,u)=>s(l,Js(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,Js(c))),"Matrix, Object":e.referTo("Matrix,Map",l=>(u,c)=>l(u,Js(c))),"Array | Matrix, Map":e.referToSelf(l=>(u,c)=>u.map(f=>l(f,c)))})});var cU="symbolicEqual",Xne=["parse","simplify","typed","OperatorNode"],zE=M(cU,Xne,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 zt(c)&&!c.value}return n(cU,{"Node, Node":a,"Node, Node, Object":a})});var fU="derivative",Qne=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],HE=M(fU,Qne,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 y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},E=new Map,D=w.name;function _(N){var P=E.get(N);if(P!==void 0)return P;var R=b(_,N,D);return E.set(N,R),R}var C=T(A,_);return y.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(fU,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p,"Node, string":(A,w)=>p(A,d(w)),"Node, string, Object":(A,w,y)=>p(A,d(w),y)});h._simplify=!0,h.toTex=function(A){return x.apply(null,A.args)};var x=e("_derivTex",{"Node, SymbolNode":function(w,y){return zt(w)&&cr(w.value)==="string"?x(n(w.value).toString(),y.toString(),1):x(w.toTex(),y.toString(),1)},"Node, ConstantNode":function(w,y){if(cr(y.value)==="string")return x(w,n(y.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(w,y,E){return x(w.toString(),y.name,E.value)},"string, string, number":function(w,y,E){var D;return E===1?D="{d\\over d"+y+"}":D="{d^{"+E+"}\\over d"+y+"^{"+E+"}}",D+"\\left[".concat(w,"\\right]")}}),b=e("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(w,y,E){return y.name!==E},"function, ParenthesisNode, string":function(w,y,E){return w(y.content,E)},"function, FunctionAssignmentNode, string":function(w,y,E){return y.params.includes(E)?w(y.expr,E):!0},"function, FunctionNode | OperatorNode, string":function(w,y,E){return y.args.every(D=>w(D,E))}}),T=e("_derivative",{"ConstantNode, function":function(){return v(0)},"SymbolNode, function":function(w,y){return y(w)?v(0):v(1)},"ParenthesisNode, function":function(w,y){return new f(T(w.content,y))},"FunctionAssignmentNode, function":function(w,y){return y(w)?v(0):T(w.expr,y)},"FunctionNode, function":function(w,y){if(y(w))return v(0);var E=w.args[0],D,_=!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 D=new c("/","divide",[v(1),w.args[1]]),T(new c("^","pow",[E,D]),y);break;case"log10":D=v(10);case"log":if(!D&&w.args.length===1)N=E.clone(),_=!0;else if(w.args.length===1&&D||w.args.length===2&&y(w.args[1]))N=new c("*","multiply",[E.clone(),new u("log",[D||w.args[1]])]),_=!0;else if(w.args.length===2)return T(new c("/","divide",[new u("log",[E]),new u("log",[w.args[1]])]),y);break;case"pow":if(w.args.length===2)return T(new c("^","pow",[E,w.args[1]]),y);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 P,R;_?(P="/",R="divide"):(P="*",R="multiply");var L=T(E,y);return C&&(L=new c("-","unaryMinus",[L])),new c(P,R,[L,N])},"OperatorNode, function":function(w,y){if(y(w))return v(0);if(w.op==="+")return new c(w.op,w.fn,w.args.map(function(k){return T(k,y)}));if(w.op==="-"){if(w.isUnary())return new c(w.op,w.fn,[T(w.args[0],y)]);if(w.isBinary())return new c(w.op,w.fn,[T(w.args[0],y),T(w.args[1],y)])}if(w.op==="*"){var E=w.args.filter(function(k){return y(k)});if(E.length>0){var D=w.args.filter(function(k){return!y(k)}),_=D.length===1?D[0]:new c("*","multiply",D),C=E.concat(T(_,y));return new c("*","multiply",C)}return new c("+","add",w.args.map(function(k){return new c("*","multiply",w.args.map(function(B){return B===k?T(B,y):B.clone()}))}))}if(w.op==="/"&&w.isBinary()){var N=w.args[0],P=w.args[1];return y(P)?new c("/","divide",[T(N,y),P]):y(N)?new c("*","multiply",[new c("-","unaryMinus",[N]),new c("/","divide",[T(P,y),new c("^","pow",[P.clone(),v(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[T(N,y),P.clone()]),new c("*","multiply",[N.clone(),T(P,y)])]),new c("^","pow",[P.clone(),v(2)])])}if(w.op==="^"&&w.isBinary()){var R=w.args[0],L=w.args[1];if(y(R))return zt(R)&&(o(R.value)||a(R.value,1))?v(0):new c("*","multiply",[w,new c("*","multiply",[new u("log",[R.clone()]),T(L.clone(),y)])]);if(y(L)){if(zt(L)){if(o(L.value))return v(0);if(a(L.value,1))return T(R,y)}var V=new c("^","pow",[R.clone(),new c("-","subtract",[L,v(1)])]);return new c("*","multiply",[L.clone(),new c("*","multiply",[T(R,y),V])])}return new c("*","multiply",[new c("^","pow",[R.clone(),L.clone()]),new c("+","add",[new c("*","multiply",[T(R,y),new c("/","divide",[L.clone(),R.clone()])]),new c("*","multiply",[T(L,y),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||Bi(String(A),r)))}return h});var pU="rationalize",Kne=["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"],GE=M(pU,Kne,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:x,matrix:b,AccessorNode:T,ArrayNode:v,ConstantNode:A,FunctionNode:w,IndexNode:y,ObjectNode:E,OperatorNode:D,SymbolNode:_,ParenthesisNode:C}=t;function N(k){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=R(),Q=P(k,B,!0,O.firstRules),ie=Q.variables.length,X={exactFractions:!1},U={exactFractions:!0};if(k=Q.expression,ie>=1){k=L(k);var pe,we,se=!0,be=!1;k=p(k,O.firstRules,{},X);for(var ee;we=se?O.distrDivRules:O.sucDivRules,k=p(k,we,{},U),se=!se,ee=k.toString(),ee!==pe;)be=!0,pe=ee;be&&(k=p(k,O.firstRulesAgain,{},X)),k=p(k,O.finalRules,{},X)}var Z=[],ne={};return k.type==="OperatorNode"&&k.isBinary()&&k.op==="/"?(ie===1&&(k.args[0]=V(k.args[0],Z),k.args[1]=V(k.args[1])),W&&(ne.numerator=k.args[0],ne.denominator=k.args[1])):(ie===1&&(k=V(k,Z)),W&&(ne.numerator=k,ne.denominator=null)),W?(ne.coefficients=Z,ne.variables=Q.variables,ne.expression=k,ne):k}return r(pU,{Node:N,"Node, boolean":(k,B)=>N(k,{},B),"Node, Object":N,"Node, Object, boolean":N});function P(k,B,W,O){var Q=[],ie=p(k,O,B,{exactFractions:!1});W=!!W;var X="+-*"+(W?"/":"");pe(ie);var U={};return U.expression=ie,U.variables=Q,U;function pe(we){var se=we.type;if(se==="FunctionNode")throw new Error("There is an unsolved function call");if(se==="OperatorNode")if(we.op==="^"){if(we.args[1].type!=="ConstantNode"||!Qe(parseFloat(we.args[1].value)))throw new Error("There is a non-integer exponent");pe(we.args[0])}else{if(!X.includes(we.op))throw new Error("Operator "+we.op+" invalid in polynomial expression");for(var be=0;be<we.args.length;be++)pe(we.args[be])}else if(se==="SymbolNode"){var ee=we.name,Z=Q.indexOf(ee);Z===-1&&Q.push(ee)}else if(se==="ParenthesisNode")pe(we.content);else if(se!=="ConstantNode")throw new Error("type "+se+" is not allowed in polynomial expression")}}function R(){var k=[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"}],B=[{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=k.concat(B,O),Q.distrDivRules=W,Q.sucDivRules=O,Q.firstRulesAgain=k.concat(B),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(k,B,W){var O=k.type,Q=arguments.length>1;if(O==="OperatorNode"&&k.isBinary()){var ie=!1,X;if(k.op==="^"&&(k.args[0].type==="ParenthesisNode"||k.args[0].type==="OperatorNode")&&k.args[1].type==="ConstantNode"&&(X=parseFloat(k.args[1].value),ie=X>=2&&Qe(X)),ie){if(X>2){var U=k.args[0],pe=new D("^","pow",[k.args[0].cloneDeep(),new A(X-1)]);k=new D("*","multiply",[U,pe])}else k=new D("*","multiply",[k.args[0],k.args[0].cloneDeep()]);Q&&(W==="content"?B.content=k:B.args[W]=k)}}if(O==="ParenthesisNode")L(k.content,k,"content");else if(O!=="ConstantNode"&&O!=="SymbolNode")for(var we=0;we<k.args.length;we++)L(k.args[we],k,we);if(!Q)return k}function V(k,B){B===void 0&&(B=[]),B[0]=0;var W={};W.cte=1,W.oper="+",W.fire="";var O=0,Q="";ee(k,null,W),O=B.length-1;for(var ie=!0,X,U=O;U>=0;U--)if(B[U]!==0){var pe=new A(ie?B[U]:Math.abs(B[U])),we=B[U]<0?"-":"+";if(U>0){var se=new _(Q);if(U>1){var be=new A(U);se=new D("^","pow",[se,be])}B[U]===-1&&ie?pe=new D("-","unaryMinus",[se]):Math.abs(B[U])===1?pe=se:pe=new D("*","multiply",[pe,se])}ie?X=pe:we==="+"?X=new D("+","add",[X,pe]):X=new D("-","subtract",[X,pe]),ie=!1}if(ie)return new A(0);return X;function ee(Z,ne,de){var fe=Z.type;if(fe==="FunctionNode")throw new Error("There is an unsolved function call");if(fe==="OperatorNode"){if(!"+-*^".includes(Z.op))throw new Error("Operator "+Z.op+" invalid");if(ne!==null){if((Z.fn==="unaryMinus"||Z.fn==="pow")&&ne.fn!=="add"&&ne.fn!=="subtract"&&ne.fn!=="multiply")throw new Error("Invalid "+Z.op+" placing");if((Z.fn==="subtract"||Z.fn==="add"||Z.fn==="multiply")&&ne.fn!=="add"&&ne.fn!=="subtract")throw new Error("Invalid "+Z.op+" placing");if((Z.fn==="subtract"||Z.fn==="add"||Z.fn==="unaryMinus")&&de.noFil!==0)throw new Error("Invalid "+Z.op+" placing")}(Z.op==="^"||Z.op==="*")&&(de.fire=Z.op);for(var Se=0;Se<Z.args.length;Se++)Z.fn==="unaryMinus"&&(de.oper="-"),(Z.op==="+"||Z.fn==="subtract")&&(de.fire="",de.cte=1,de.oper=Se===0?"+":Z.op),de.noFil=Se,ee(Z.args[Se],Z,de)}else if(fe==="SymbolNode"){if(Z.name!==Q&&Q!=="")throw new Error("There is more than one variable");if(Q=Z.name,ne===null){B[1]=1;return}if(ne.op==="^"&&de.noFil!==0)throw new Error("In power the variable should be the first parameter");if(ne.op==="*"&&de.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(de.fire===""||de.fire==="*")&&(O<1&&(B[1]=0),B[1]+=de.cte*(de.oper==="+"?1:-1),O=Math.max(1,O))}else if(fe==="ConstantNode"){var _e=parseFloat(Z.value);if(ne===null){B[0]=_e;return}if(ne.op==="^"){if(de.noFil!==1)throw new Error("Constant cannot be powered");if(!Qe(_e)||_e<=0)throw new Error("Non-integer exponent is not allowed");for(var G=O+1;G<_e;G++)B[G]=0;_e>O&&(B[_e]=0),B[_e]+=de.cte*(de.oper==="+"?1:-1),O=Math.max(_e,O);return}de.cte=_e,de.fire===""&&(B[0]+=de.cte*(de.oper==="+"?1:-1))}else throw new Error("Type "+fe+" is not allowed")}}});var mU="zpk2tf",eie=["typed","add","multiply","Complex","number"],WE=M(mU,eie,t=>{var{typed:e,add:r,multiply:n,Complex:i,number:a}=t;return e(mU,{"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(T=>T.type==="BigNumber")&&(l=l.map(T=>a(T))),u.some(T=>T.type==="BigNumber")&&(u=u.map(T=>a(T)));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 x=u[h];typeof x=="number"&&(x=i(x,0)),m=s(m,[i(1,0),i(-x.re,-x.im)])}for(var b=0;b<f.length;b++)f[b]=n(f[b],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 dU="freqz",tie=["typed","add","multiply","Complex","divide","matrix"],YE=M(dU,tie,t=>{var{typed:e,add:r,multiply:n,Complex:i,divide:a,matrix:o}=t;return e(dU,{"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),x=i(0,0),b=0;b<u.length;b++)h=r(h,n(u[b],i(Math.cos(-b*f[d]),Math.sin(-b*f[d]))));for(var T=0;T<c.length;T++)x=r(x,n(c[T],i(Math.cos(-T*f[d]),Math.sin(-T*f[d]))));m.push(h),p.push(x)}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 rie="reviver",nie=["classes"],jE=M(rie,nie,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 iie="replacer",aie=[],ZE=M(iie,aie,()=>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 hU="14.0.1";var JE=M("true",[],()=>!0),XE=M("false",[],()=>!1),QE=M("null",[],()=>null),KE=Ya("Infinity",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1/0):1/0}),eT=Ya("NaN",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(NaN):NaN}),tT=Ya("pi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?Sm(r):ZP}),rT=Ya("tau",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?v$(r):JP}),nT=Ya("e",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?h$(r):XP}),iT=Ya("phi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?g$(r):QP}),aT=Ya("LN2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).ln():Math.LN2}),oT=Ya("LN10",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(10).ln():Math.LN10}),sT=Ya("LOG2E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),uT=Ya("LOG10E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),lT=Ya("SQRT1_2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),cT=Ya("SQRT2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),fT=Ya("i",["Complex"],t=>{var{Complex:e}=t;return e.I});var pT=M("version",[],()=>hU);function Ya(t,e,r){return M(t,e,r,{recreateOnConfigChange:!0})}var mT=ar("speedOfLight","299792458","m s^-1"),dT=ar("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),hT=ar("planckConstant","6.62607015e-34","J s"),gT=ar("reducedPlanckConstant","1.0545718176461565e-34","J s"),vT=ar("magneticConstant","1.25663706212e-6","N A^-2"),yT=ar("electricConstant","8.8541878128e-12","F m^-1"),xT=ar("vacuumImpedance","376.730313667","ohm"),bT=ar("coulomb","8.987551792261171e9","N m^2 C^-2"),wT=ar("elementaryCharge","1.602176634e-19","C"),_T=ar("bohrMagneton","9.2740100783e-24","J T^-1"),AT=ar("conductanceQuantum","7.748091729863649e-5","S"),ST=ar("inverseConductanceQuantum","12906.403729652257","ohm"),ET=ar("magneticFluxQuantum","2.0678338484619295e-15","Wb"),TT=ar("nuclearMagneton","5.0507837461e-27","J T^-1"),DT=ar("klitzing","25812.807459304513","ohm");var MT=ar("bohrRadius","5.29177210903e-11","m"),CT=ar("classicalElectronRadius","2.8179403262e-15","m"),NT=ar("electronMass","9.1093837015e-31","kg"),FT=ar("fermiCoupling","1.1663787e-5","GeV^-2"),IT=Vv("fineStructure",.0072973525693),PT=ar("hartreeEnergy","4.3597447222071e-18","J"),BT=ar("protonMass","1.67262192369e-27","kg"),kT=ar("deuteronMass","3.3435830926e-27","kg"),$T=ar("neutronMass","1.6749271613e-27","kg"),OT=ar("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),RT=ar("rydberg","10973731.568160","m^-1"),LT=ar("thomsonCrossSection","6.6524587321e-29","m^2"),VT=Vv("weakMixingAngle",.2229),UT=Vv("efimovFactor",22.7),qT=ar("atomicMass","1.66053906660e-27","kg"),zT=ar("avogadro","6.02214076e23","mol^-1"),HT=ar("boltzmann","1.380649e-23","J K^-1"),GT=ar("faraday","96485.33212331001","C mol^-1"),WT=ar("firstRadiation","3.7417718521927573e-16","W m^2"),YT=ar("loschmidt","2.686780111798444e25","m^-3"),jT=ar("gasConstant","8.31446261815324","J K^-1 mol^-1"),ZT=ar("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),JT=ar("molarVolume","0.022413969545014137","m^3 mol^-1"),XT=Vv("sackurTetrode",-1.16487052358),QT=ar("secondRadiation","0.014387768775039337","m K"),KT=ar("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),eD=ar("wienDisplacement","2.897771955e-3","m K"),tD=ar("molarMass","0.99999999965e-3","kg mol^-1"),rD=ar("molarMassC12","11.9999999958e-3","kg mol^-1"),nD=ar("gravity","9.80665","m s^-2"),iD=ar("planckLength","1.616255e-35","m"),aD=ar("planckMass","2.176435e-8","kg"),oD=ar("planckTime","5.391245e-44","s"),sD=ar("planckCharge","1.87554603778e-18","C"),uD=ar("planckTemperature","1.416785e+32","K");function ar(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 Vv(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})}var oie="apply",sie=["typed","isInteger"],lD=M(oie,sie,t=>{var{typed:e,isInteger:r}=t,n=Jl({typed:e,isInteger:r});return e("apply",{"...any":function(a){var o=a[1];At(o)?a[1]=o-1:ct(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw Jr(s)}}})},{isTransformFunction:!0});var uie="column",lie=["typed","Index","matrix","range"],cD=M(uie,lie,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=pm({typed:e,Index:r,matrix:n,range:i});return e("column",{"...any":function(s){var l=s.length-1,u=s[l];At(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Jr(c)}}})},{isTransformFunction:!0});function kf(t,e,r){var n=t.filter(function(l){return Yr(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 pf(r,a,new Set([i])),s=t.compile();return function(u){return a.set(i,u),s.evaluate(o)}}var cie="transformCallback",fie=["typed"],$f=M(cie,fie,t=>{var{typed:e}=t;return function(n,i){return e.isTypedFunction(n)?r(n,i):gU(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,gU(l,u,i)]}));return typeof n.name=="string"?e(n.name,a):e(a)}});function gU(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=vU(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=vU(i[r]),l=i.slice(r+1);return t(...o,s,...l)}:t}function vU(t){return t.map(e=>e+1)}var pie="filter",mie=["typed"],fD=M(pie,mie,t=>{var{typed:e}=t;function r(i,a,o){var s=mm({typed:e}),l=$f({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&&(Yr(f)||ms(f)?f=n(f,o):f=kf(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 die="forEach",hie=["typed"],pD=M(die,hie,t=>{var{typed:e}=t,r=dm({typed:e}),n=$f({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&&(Yr(f)||ms(f)?f=a(f,l):f=kf(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 gie="index",vie=["Index","getMatrixDataType"],mD=M(gie,vie,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(mf(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(gr(s)||rt(s))r(s)!=="boolean"&&(s=s.map(function(u){return u-1}));else if(At(s))s--;else if(ct(s))s=s.toNumber()-1;else if(typeof s!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=s}var l=new e;return e.apply(l,i),l}},{isTransformFunction:!0});var yie="map",xie=["typed"],dD=M(yie,xie,t=>{var{typed:e}=t,r=hm({typed:e}),n=$f({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&&(Yr(c)||ms(c)?c=f(c,s):c=kf(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 yU(t){return At(t)?t-1:ct(t)?t.minus(1):t}function xU(t){return At(t)||ct(t)}function Li(t){if(t.length===2&&Tn(t[0])){t=t.slice();var e=t[1];xU(e)&&(t[1]=yU(e))}return t}var bie="max",wie=["typed","config","numeric","larger"],hD=M(bie,wie,t=>{var{typed:e,config:r,numeric:n,larger:i}=t,a=_m({typed:e,config:r,numeric:n,larger:i});return e("max",{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Jr(l)}}})},{isTransformFunction:!0});var _ie="mean",Aie=["typed","add","divide"],gD=M(_ie,Aie,t=>{var{typed:e,add:r,divide:n}=t,i=Mm({typed:e,add:r,divide:n});return e("mean",{"...any":function(o){o=Li(o);try{return i.apply(null,o)}catch(s){throw Jr(s)}}})},{isTransformFunction:!0});var Sie="min",Eie=["typed","config","numeric","smaller"],vD=M(Sie,Eie,t=>{var{typed:e,config:r,numeric:n,smaller:i}=t,a=Am({typed:e,config:r,numeric:n,smaller:i});return e("min",{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Jr(l)}}})},{isTransformFunction:!0});var Tie="range",Die=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],yD=M(Tie,Die,t=>{var{typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=t,f=vm({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 Mie="row",Cie=["typed","Index","matrix","range"],xD=M(Mie,Cie,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=ym({typed:e,Index:r,matrix:n,range:i});return e("row",{"...any":function(s){var l=s.length-1,u=s[l];At(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Jr(c)}}})},{isTransformFunction:!0});var Nie="subset",Fie=["typed","matrix","zeros","add"],bD=M(Nie,Fie,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t,a=xm({typed:e,matrix:r,zeros:n,add:i});return e("subset",{"...any":function(s){try{return a.apply(null,s)}catch(l){throw Jr(l)}}})},{isTransformFunction:!0});var Iie="concat",Pie=["typed","matrix","isInteger"],wD=M(Iie,Pie,t=>{var{typed:e,matrix:r,isInteger:n}=t,i=fm({typed:e,matrix:r,isInteger:n});return e("concat",{"...any":function(o){var s=o.length-1,l=o[s];At(l)?o[s]=l-1:ct(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw Jr(u)}}})},{isTransformFunction:!0});var bU="diff",Bie=["typed","matrix","subtract","number","bignumber"],_D=M(bU,Bie,t=>{var{typed:e,matrix:r,subtract:n,number:i,bignumber:a}=t,o=gm({typed:e,matrix:r,subtract:n,number:i,bignumber:a});return e(bU,{"...any":function(l){l=Li(l);try{return o.apply(null,l)}catch(u){throw Jr(u)}}})},{isTransformFunction:!0});var kie="std",$ie=["typed","map","sqrt","variance"],AD=M(kie,$ie,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t,a=Fm({typed:e,map:r,sqrt:n,variance:i});return e("std",{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Jr(l)}}})},{isTransformFunction:!0});var wU="sum",Oie=["typed","config","add","numeric"],SD=M(wU,Oie,t=>{var{typed:e,config:r,add:n,numeric:i}=t,a=Tm({typed:e,config:r,add:n,numeric:i});return e(wU,{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Jr(l)}}})},{isTransformFunction:!0});var Rie="quantileSeq",Lie=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],ED=M(Rie,Lie,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}=t,p=Nm({typed:e,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:m});return e("quantileSeq",{"Array | Matrix, number | BigNumber":p,"Array | Matrix, number | BigNumber, number":(h,x,b)=>p(h,x,d(b)),"Array | Matrix, number | BigNumber, boolean":p,"Array | Matrix, number | BigNumber, boolean, number":(h,x,b,T)=>p(h,x,b,d(T)),"Array | Matrix, Array | Matrix":p,"Array | Matrix, Array | Matrix, number":(h,x,b)=>p(h,x,d(b)),"Array | Matrix, Array | Matrix, boolean":p,"Array | Matrix, Array | Matrix, boolean, number":(h,x,b,T)=>p(h,x,b,d(T))});function d(h){return Li([[],h])[1]}},{isTransformFunction:!0});var _U="cumsum",Vie=["typed","add","unaryPlus"],TD=M(_U,Vie,t=>{var{typed:e,add:r,unaryPlus:n}=t,i=Dm({typed:e,add:r,unaryPlus:n});return e(_U,{"...any":function(o){if(o.length===2&&Tn(o[0])){var s=o[1];At(s)?o[1]=s-1:ct(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw Jr(l)}}})},{isTransformFunction:!0});var AU="variance",Uie=["typed","add","subtract","multiply","divide","apply","isNaN"],DD=M(AU,Uie,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=t,l=Cm({typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return e(AU,{"...any":function(c){c=Li(c);try{return l.apply(null,c)}catch(f){throw Jr(f)}}})},{isTransformFunction:!0});var SU="print",qie=["typed","matrix","zeros","add"],MD=M(SU,qie,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t,a=bm({typed:e,matrix:r,zeros:n,add:i});return e(SU,{"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(sv,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 zie="and",Hie=["typed","matrix","zeros","add","equalScalar","not","concat"],CD=M(zie,Hie,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=wm({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(!Tn(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 Gie="or",Wie=["typed","matrix","equalScalar","DenseMatrix","concat"],ND=M(Gie,Wie,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=cm({typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Tn(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 Yie="bitAnd",jie=["typed","matrix","zeros","add","equalScalar","not","concat"],FD=M(Yie,jie,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=um({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(!Tn(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 Zie="bitOr",Jie=["typed","matrix","equalScalar","DenseMatrix","concat"],ID=M(Zie,Jie,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=lm({typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Tn(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 We=j0({config:Ie}),Xr=X0({}),PD=nT({BigNumber:We,config:Ie}),EU=XE({}),TU=IT({BigNumber:We,config:Ie}),Yu=ew({}),BD=fT({Complex:Xr}),DU=KE({BigNumber:We,config:Ie}),MU=oT({BigNumber:We,config:Ie}),CU=uT({BigNumber:We,config:Ie}),Bm=rw({}),NU=eT({BigNumber:We,config:Ie}),FU=QE({}),IU=iT({BigNumber:We,config:Ie}),PU=tw({}),kD=U0({}),BU=lT({BigNumber:We,config:Ie}),kU=XT({BigNumber:We,config:Ie}),$D=rT({BigNumber:We,config:Ie}),$U=JE({}),OU=pT({}),sr=cw({Matrix:Bm}),RU=UT({BigNumber:We,config:Ie}),LU=aT({BigNumber:We,config:Ie}),Uv=tT({BigNumber:We,config:Ie}),OD=ZE({}),VU=cT({BigNumber:We,config:Ie}),te=V0({BigNumber:We,Complex:Xr,DenseMatrix:sr,Fraction:Yu}),UU=VT({BigNumber:We,config:Ie}),Vi=N_({typed:te}),qU=MA({Complex:Xr,config:Ie,typed:te}),zU=NA({BigNumber:We,typed:te}),HU=IA({BigNumber:We,Complex:Xr,config:Ie,typed:te}),Wn=F_({typed:te}),GU=o1({typed:te}),WU=kA({BigNumber:We,Complex:Xr,config:Ie,typed:te}),YU=OA({typed:te}),RD=RA({typed:te}),jU=VA({Complex:Xr,config:Ie,typed:te}),ZU=v_({typed:te}),JU=i1({typed:te}),XU=x_({typed:te}),QU=fw({typed:te}),km=dE({typed:te}),$m=w_({Complex:Xr,typed:te}),ju=s1({typed:te}),qv=UA({typed:te}),KU=zA({BigNumber:We,typed:te}),e5=GA({BigNumber:We,typed:te}),t5=$_({typed:te}),fr=d_({config:Ie,typed:te}),r5=B1({typed:te}),LD=O_({typed:te}),n5=R_({Complex:Xr,typed:te}),i5=mm({typed:te}),Of=h1({typed:te}),a5=dm({typed:te}),Rf=R1({typed:te}),zv=v1({typed:te}),o5=U1({format:Rf,typed:te}),Hv=u1({typed:te}),ia=mw({typed:te}),au=s_({config:Ie,typed:te}),Zu=c_({config:Ie,typed:te}),Zo=f_({equalScalar:fr,typed:te}),s5=sT({BigNumber:We,config:Ie}),u5=vE({Complex:Xr,typed:te}),l5=G_({Complex:Xr,config:Ie,typed:te}),VD=W_({Complex:Xr,config:Ie,typed:te}),Ju=hm({typed:te}),Dn=Y_({typed:te}),Om=c1({typed:te}),vs=g_({typed:te}),c5=V1({format:Rf,typed:te}),f5=CE({config:Ie,typed:te}),p5=bm({typed:te}),m5=NE({config:Ie,typed:te}),Gv=l1({typed:te}),d5=YA({BigNumber:We,typed:te}),UD=J_({BigNumber:We,Fraction:Yu,complex:$m,typed:te}),Rm=ZA({typed:te}),Yn=h_({Matrix:Bm,equalScalar:fr,typed:te}),h5=D_({typed:te}),g5=Q_({typed:te}),v5=y_({typed:te}),ja=I_({typed:te}),y5=XA({typed:te}),Wv=m_({typed:te}),x5=CA({Complex:Xr,config:Ie,typed:te}),b5=PA({BigNumber:We,typed:te}),Yv=Jl({isInteger:ia,typed:te}),w5=BA({BigNumber:We,Complex:Xr,config:Ie,typed:te}),Za=b_({BigNumber:We,typed:te}),_5=hE({typed:te}),A5=qA({typed:te}),S5=WA({BigNumber:We,typed:te}),Lf=p_({typed:te}),E5=z1({typed:te}),T5=FE({config:Ie,typed:te}),D5=jA({BigNumber:We,typed:te}),M5=JA({typed:te}),C5=TA({SparseMatrix:Yn,typed:te}),To=X_({Complex:Xr,config:Ie,typed:te}),N5=D1({typed:te}),F5=QA({typed:te}),Jo=M_({typed:te}),I5=FA({BigNumber:We,Complex:Xr,config:Ie,typed:te}),P5=L1({format:Rf,typed:te}),B5=HA({BigNumber:We,typed:te}),Vf=__({Fraction:Yu,typed:te}),Xu=u_({typed:te}),He=A_({DenseMatrix:sr,Matrix:Bm,SparseMatrix:Yn,typed:te}),k5=S_({isZero:Zo,matrix:He,typed:te}),$5=$1({isNaN:Lf,isNumeric:Xu,typed:te}),Ja=H1({bignumber:Za,fraction:Vf,number:vs}),qD=O1({config:Ie,multiplyScalar:Dn,numeric:Ja,typed:te}),zD=_1({isInteger:ia,matrix:He,typed:te}),pi=T1({matrix:He,config:Ie,typed:te}),Uf=M1({matrix:He,typed:te}),HD=e1({BigNumber:We,config:Ie,matrix:He,typed:te}),mi=N1({BigNumber:We,config:Ie,matrix:He,typed:te}),O5=$A({Complex:Xr,config:Ie,typed:te}),GD=P_({BigNumber:We,Complex:Xr,Fraction:Yu,config:Ie,isNegative:au,matrix:He,typed:te,unaryMinus:Jo}),Sr=fm({isInteger:ia,matrix:He,typed:te}),R5=p1({prod:qD,size:pi,typed:te}),jv=C1({conj:ju,transpose:Uf,typed:te}),WD=d1({DenseMatrix:sr,SparseMatrix:Yn,matrix:He,typed:te}),dn=G1({numeric:Ja,typed:te}),qf=Q1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,divideScalar:dn,equalScalar:fr,matrix:He,typed:te}),Xa=lA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,equalScalar:fr,matrix:He,typed:te}),L5=l_({isNumeric:Xu,typed:te}),ou=y1({BigNumber:We,DenseMatrix:sr,SparseMatrix:Yn,config:Ie,matrix:He,typed:te}),V5=x1({matrix:He,multiplyScalar:Dn,typed:te}),Lm=dA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:He,typed:te}),U5=nA({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te,zeros:mi}),YD=K1({DenseMatrix:sr,divideScalar:dn,equalScalar:fr,matrix:He,multiplyScalar:Dn,subtractScalar:ja,typed:te}),Zv=T_({flatten:Of,matrix:He,size:pi,typed:te}),q5=Z_({BigNumber:We,concat:Sr,equalScalar:fr,matrix:He,typed:te}),z5=w1({BigNumber:We,config:Ie,matrix:He,typed:te}),Jv=VS({addScalar:Wn,complex:$m,conj:ju,divideScalar:dn,equal:Xa,identity:ou,isZero:Zo,matrix:He,multiplyScalar:Dn,sign:UD,sqrt:To,subtractScalar:ja,typed:te,unaryMinus:Jo,zeros:mi}),H5=A1({config:Ie,matrix:He}),G5=iA({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te,zeros:mi}),rc=Y1({BigNumber:We,DenseMatrix:sr,config:Ie,equalScalar:fr,matrix:He,typed:te,zeros:mi}),Ui=fA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:He,typed:te}),Pn=K_({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,subtractScalar:ja,typed:te,unaryMinus:Jo}),W5=q1({concat:Sr,matrix:He,typed:te}),Xv=C_({config:Ie,numeric:Ja,typed:te}),Qv=eA({DenseMatrix:sr,divideScalar:dn,equalScalar:fr,matrix:He,multiplyScalar:Dn,subtractScalar:ja,typed:te}),Y5=f1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,matrix:He,typed:te}),br=lS({DenseMatrix:sr,SparseMatrix:Yn,addScalar:Wn,concat:Sr,equalScalar:fr,matrix:He,typed:te}),j5=LA({BigNumber:We,DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te}),Z5=um({concat:Sr,equalScalar:fr,matrix:He,typed:te}),J5=lm({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te}),X5=a1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,matrix:He,typed:te}),Q5=BE({addScalar:Wn,combinations:km,divideScalar:dn,isInteger:ia,isNegative:au,multiplyScalar:Dn,typed:te}),Qu=oA({BigNumber:We,DenseMatrix:sr,Fraction:Yu,concat:Sr,config:Ie,equalScalar:fr,matrix:He,typed:te}),jD=uA({concat:Sr,matrix:He,typed:te}),K5=Dm({add:br,typed:te,unaryPlus:Xv}),Kv=hA({equal:Xa,typed:te}),e8=gm({matrix:He,number:vs,subtract:Pn,typed:te}),t8=uE({abs:Vi,addScalar:Wn,deepEqual:Kv,divideScalar:dn,multiplyScalar:Dn,sqrt:To,subtractScalar:ja,typed:te}),Vm=pS({addScalar:Wn,conj:ju,multiplyScalar:Dn,size:pi,typed:te}),r8=cA({compareText:jD,isZero:Zo,typed:te}),ZD=om({DenseMatrix:sr,config:Ie,equalScalar:fr,matrix:He,round:rc,typed:te,zeros:mi}),n8=z_({BigNumber:We,DenseMatrix:sr,concat:Sr,config:Ie,equalScalar:fr,matrix:He,round:rc,typed:te,zeros:mi}),i8=cS({abs:Vi,addScalar:Wn,divideScalar:dn,isPositive:Zu,multiplyScalar:Dn,smaller:Ui,sqrt:To,typed:te}),JD=xA({DenseMatrix:sr,smaller:Ui}),Ei=bA({ImmutableDenseMatrix:JD,getMatrixDataType:zv}),qi=mA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:He,typed:te}),ey=j1({Complex:Xr,config:Ie,divideScalar:dn,typeOf:Wv,typed:te}),a8=tA({DenseMatrix:sr,divideScalar:dn,equalScalar:fr,matrix:He,multiplyScalar:Dn,subtractScalar:ja,typed:te}),o8=E_({flatten:Of,matrix:He,size:pi,typed:te}),s8=Am({config:Ie,numeric:Ja,smaller:Ui,typed:te}),XD=sm({DenseMatrix:sr,concat:Sr,config:Ie,equalScalar:fr,matrix:He,round:rc,typed:te,zeros:mi}),qr=j_({addScalar:Wn,dot:Vm,equalScalar:fr,matrix:He,multiplyScalar:Dn,typed:te}),u8=J1({Complex:Xr,config:Ie,divideScalar:dn,typed:te}),l8=cm({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te}),Um=vA({compare:Qu,isNaN:Lf,isNumeric:Xu,typed:te}),c8=aA({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te,zeros:mi}),QD=qS({SparseMatrix:Yn,abs:Vi,add:br,divideScalar:dn,larger:qi,largerEq:Lm,multiply:qr,subtract:Pn,transpose:Uf,typed:te}),Ea=xm({add:br,matrix:He,typed:te,zeros:mi}),ty=Tm({add:br,config:Ie,numeric:Ja,typed:te}),f8=mS({add:br,matrix:He,typed:te}),KD=rA({DenseMatrix:sr,divideScalar:dn,equalScalar:fr,matrix:He,multiplyScalar:Dn,subtractScalar:ja,typed:te}),p8=WE({Complex:Xr,add:br,multiply:qr,number:vs,typed:te}),ry=k_({DenseMatrix:sr,config:Ie,equalScalar:fr,matrix:He,round:rc,typed:te,zeros:mi}),Xo=sA({compare:Qu,typed:te}),m8=kE({addScalar:Wn,combinations:km,isInteger:ia,isNegative:au,isPositive:Zu,larger:qi,typed:te}),d8=m1({matrix:He,multiply:qr,subtract:Pn,typed:te}),eM=QS({divideScalar:dn,isZero:Zo,matrix:He,multiply:qr,subtractScalar:ja,typed:te,unaryMinus:Jo}),h8=r1({concat:Sr,equalScalar:fr,matrix:He,multiplyScalar:Dn,typed:te}),tM=wA({larger:qi,smaller:Ui}),rM=V_({Complex:Xr,DenseMatrix:sr,ceil:ry,equalScalar:fr,floor:ZD,matrix:He,typed:te,zeros:mi}),nM=dS({Index:Ei,typed:te}),g8=lE({abs:Vi,add:br,addScalar:Wn,config:Ie,divideScalar:dn,equalScalar:fr,flatten:Of,isNumeric:Xu,isZero:Zo,matrix:He,multiply:qr,multiplyScalar:Dn,smaller:Ui,subtract:Pn,typed:te}),v8=t1({BigNumber:We,add:br,config:Ie,equal:Xa,isInteger:ia,mod:XD,smaller:Ui,typed:te,xgcd:HD}),y8=H_({concat:Sr,equalScalar:fr,matrix:He,typed:te}),x8=Z1({Complex:Xr,config:Ie,divideScalar:dn,log:ey,typed:te}),ny=_m({config:Ie,larger:qi,numeric:Ja,typed:te}),b8=KA({DenseMatrix:sr,Index:Ei,compareNatural:Xo,size:pi,subset:Ea,typed:te}),w8=tS({DenseMatrix:sr,Index:Ei,compareNatural:Xo,size:pi,subset:Ea,typed:te}),_8=nS({Index:Ei,compareNatural:Xo,size:pi,subset:Ea,typed:te}),A8=aS({Index:Ei,compareNatural:Xo,size:pi,subset:Ea,typed:te}),nc=pA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:He,typed:te}),S8=yA({compare:Qu,compareNatural:Xo,matrix:He,typed:te}),E8=gA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,equalScalar:fr,matrix:He,typed:te}),T8=wm({concat:Sr,equalScalar:fr,matrix:He,not:Om,typed:te,zeros:mi}),ic=vm({bignumber:Za,matrix:He,add:br,config:Ie,isPositive:Zu,larger:qi,largerEq:Lm,smaller:Ui,smallerEq:nc,typed:te}),D8=ym({Index:Ei,matrix:He,range:ic,typed:te}),iM=eS({DenseMatrix:sr,Index:Ei,compareNatural:Xo,size:pi,subset:Ea,typed:te}),M8=iS({Index:Ei,compareNatural:Xo,size:pi,subset:Ea,typed:te}),aM=sS({Index:Ei,concat:Sr,setDifference:iM,size:pi,subset:Ea,typed:te}),oM=_A({FibonacciHeap:tM,addScalar:Wn,equalScalar:fr}),sM=pm({Index:Ei,matrix:He,range:ic,typed:te}),Ku=KS({abs:Vi,addScalar:Wn,det:eM,divideScalar:dn,identity:ou,matrix:He,multiply:qr,typed:te,unaryMinus:Jo}),uM=LS({DenseMatrix:sr,Spa:oM,SparseMatrix:Yn,abs:Vi,addScalar:Wn,divideScalar:dn,equalScalar:fr,larger:qi,matrix:He,multiplyScalar:Dn,subtractScalar:ja,typed:te,unaryMinus:Jo}),C8=eE({Complex:Xr,add:br,ctranspose:jv,deepEqual:Kv,divideScalar:dn,dot:Vm,dotDivide:qf,equal:Xa,inv:Ku,matrix:He,multiply:qr,typed:te}),Do=W1({Complex:Xr,config:Ie,fraction:Vf,identity:ou,inv:Ku,matrix:He,multiply:qr,number:vs,typed:te}),lM=rS({DenseMatrix:sr,Index:Ei,compareNatural:Xo,size:pi,subset:Ea,typed:te}),N8=uS({Index:Ei,concat:Sr,setIntersect:lM,setSymDifference:aM,size:pi,subset:Ea,typed:te}),F8=nE({abs:Vi,add:br,identity:ou,inv:Ku,map:Ju,max:ny,multiply:qr,size:pi,sqrt:To,subtract:Pn,typed:te}),Ut=SA({BigNumber:We,Complex:Xr,Fraction:Yu,abs:Vi,addScalar:Wn,config:Ie,divideScalar:dn,equal:Xa,fix:rM,format:Rf,isNumeric:Xu,multiplyScalar:Dn,number:vs,pow:Do,round:rc,subtractScalar:ja}),I8=xT({BigNumber:We,Unit:Ut,config:Ie}),P8=eD({BigNumber:We,Unit:Ut,config:Ie}),B8=qT({BigNumber:We,Unit:Ut,config:Ie}),k8=_T({BigNumber:We,Unit:Ut,config:Ie}),$8=HT({BigNumber:We,Unit:Ut,config:Ie}),O8=AT({BigNumber:We,Unit:Ut,config:Ie}),R8=bT({BigNumber:We,Unit:Ut,config:Ie}),L8=kT({BigNumber:We,Unit:Ut,config:Ie}),V8=X1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,equalScalar:fr,matrix:He,pow:Do,typed:te}),U8=yT({BigNumber:We,Unit:Ut,config:Ie}),q8=wT({BigNumber:We,Unit:Ut,config:Ie}),z8=rE({abs:Vi,add:br,identity:ou,inv:Ku,multiply:qr,typed:te}),H8=GT({BigNumber:We,Unit:Ut,config:Ie}),cM=F1({addScalar:Wn,ceil:ry,conj:ju,divideScalar:dn,dotDivide:qf,exp:LD,i:BD,log2:VD,matrix:He,multiplyScalar:Dn,pow:Do,tau:$D,typed:te}),iy=gE({BigNumber:We,Complex:Xr,config:Ie,multiplyScalar:Dn,pow:Do,typed:te}),G8=dT({BigNumber:We,Unit:Ut,config:Ie}),W8=PT({BigNumber:We,Unit:Ut,config:Ie}),Y8=I1({conj:ju,dotDivide:qf,fft:cM,typed:te}),j8=DT({BigNumber:We,Unit:Ut,config:Ie}),Z8=YT({BigNumber:We,Unit:Ut,config:Ie}),J8=vT({BigNumber:We,Unit:Ut,config:Ie}),X8=tD({BigNumber:We,Unit:Ut,config:Ie}),Q8=ZT({BigNumber:We,Unit:Ut,config:Ie}),K8=$T({BigNumber:We,Unit:Ut,config:Ie}),e6=TT({BigNumber:We,Unit:Ut,config:Ie}),t6=sD({BigNumber:We,Unit:Ut,config:Ie}),r6=iD({BigNumber:We,Unit:Ut,config:Ie}),n6=uD({BigNumber:We,Unit:Ut,config:Ie}),i6=BT({BigNumber:We,Unit:Ut,config:Ie}),a6=OT({BigNumber:We,Unit:Ut,config:Ie}),o6=gT({BigNumber:We,Unit:Ut,config:Ie}),s6=RT({BigNumber:We,Unit:Ut,config:Ie}),u6=QT({BigNumber:We,Unit:Ut,config:Ie}),l6=mT({BigNumber:We,Unit:Ut,config:Ie}),c6=KT({BigNumber:We,Unit:Ut,config:Ie}),f6=LT({BigNumber:We,Unit:Ut,config:Ie}),p6=zT({BigNumber:We,Unit:Ut,config:Ie}),m6=MT({BigNumber:We,Unit:Ut,config:Ie}),d6=DA({Unit:Ut,typed:te}),di=sE({divideScalar:dn,equalScalar:fr,inv:Ku,matrix:He,multiply:qr,typed:te}),h6=NT({BigNumber:We,Unit:Ut,config:Ie}),zf=yE({gamma:iy,typed:te}),g6=WT({BigNumber:We,Unit:Ut,config:Ie}),v6=nD({BigNumber:We,Unit:Ut,config:Ie}),y6=ST({BigNumber:We,Unit:Ut,config:Ie}),fM=HS({DenseMatrix:sr,lsolve:YD,lup:uM,matrix:He,slu:QD,typed:te,usolve:Qv}),x6=ET({BigNumber:We,Unit:Ut,config:Ie}),b6=rD({BigNumber:We,Unit:Ut,config:Ie}),w6=bE({add:br,divide:di,factorial:zf,isInteger:ia,isPositive:Zu,multiply:qr,typed:te}),_6=wE({factorial:zf,typed:te}),A6=aD({BigNumber:We,Unit:Ut,config:Ie}),S6=GS({add:br,cbrt:GD,divide:di,equalScalar:fr,im:Hv,isZero:Zo,multiply:qr,re:Gv,sqrt:To,subtract:Pn,typeOf:Wv,typed:te,unaryMinus:Jo}),E6=oS({compareNatural:Xo,typed:te}),T6=P1({abs:Vi,add:br,bignumber:Za,divide:di,isNegative:au,isPositive:Zu,larger:qi,map:Ju,matrix:He,max:ny,multiply:qr,smaller:Ui,subtract:Pn,typed:te,unaryMinus:Jo}),pM=IE({bignumber:Za,addScalar:Wn,combinations:km,divideScalar:dn,factorial:zf,isInteger:ia,isNegative:au,larger:qi,multiplyScalar:Dn,number:vs,pow:Do,subtractScalar:ja,typed:te}),D6=EA({Unit:Ut,typed:te}),M6=PE({addScalar:Wn,isInteger:ia,isNegative:au,stirlingS2:pM,typed:te}),mM=tE({abs:Vi,add:br,addScalar:Wn,atan:RD,bignumber:Za,column:sM,complex:$m,config:Ie,cos:qv,diag:WD,divideScalar:dn,dot:Vm,equal:Xa,flatten:Of,im:Hv,inv:Ku,larger:qi,matrix:He,matrixFromColumns:Zv,multiply:qr,multiplyScalar:Dn,number:vs,qr:Jv,re:Gv,reshape:zD,sin:Rm,size:pi,smaller:Ui,sqrt:To,subtract:Pn,typed:te,usolve:Qv,usolveAll:KD}),C6=FT({BigNumber:We,Unit:Ut,config:Ie}),N6=jT({BigNumber:We,Unit:Ut,config:Ie}),F6=xE({divide:di,dotDivide:qf,isNumeric:Xu,log:ey,map:Ju,matrix:He,multiply:qr,sum:ty,typed:te}),dM=Mm({add:br,divide:di,typed:te}),I6=JT({BigNumber:We,Unit:Ut,config:Ie}),P6=hT({BigNumber:We,Unit:Ut,config:Ie}),B6=Nm({bignumber:Za,add:br,compare:Qu,divide:di,isInteger:ia,larger:qi,multiply:qr,partitionSelect:Um,smaller:Ui,smallerEq:nc,subtract:Pn,typed:te}),ay=Cm({add:br,apply:Yv,divide:di,isNaN:Lf,multiply:qr,subtract:Pn,typed:te}),k6=CT({BigNumber:We,Unit:Ut,config:Ie}),hM=cE({add:br,compare:Qu,divide:di,partitionSelect:Um,typed:te}),$6=mE({add:br,divide:di,matrix:He,mean:dM,multiply:qr,pow:Do,sqrt:To,subtract:Pn,sum:ty,typed:te}),O6=YE({Complex:Xr,add:br,divide:di,matrix:He,multiply:qr,typed:te}),R6=fE({abs:Vi,map:Ju,median:hM,subtract:Pn,typed:te}),L6=Fm({map:Ju,sqrt:To,typed:te,variance:ay}),V6=k1({BigNumber:We,Complex:Xr,add:br,config:Ie,divide:di,equal:Xa,factorial:zf,gamma:iy,isNegative:au,multiply:qr,pi:Uv,pow:Do,sin:Rm,smallerEq:nc,subtract:Pn,typed:te}),oy=fS({abs:Vi,add:br,conj:ju,ctranspose:jv,eigs:mM,equalScalar:fr,larger:qi,matrix:He,multiply:qr,pow:Do,smaller:Ui,sqrt:To,typed:te}),gM=E1({BigNumber:We,DenseMatrix:sr,SparseMatrix:Yn,addScalar:Wn,config:Ie,cos:qv,matrix:He,multiplyScalar:Dn,norm:oy,sin:Rm,typed:te,unaryMinus:Jo}),U6=oD({BigNumber:We,Unit:Ut,config:Ie}),vM=aE({identity:ou,matrix:He,multiply:qr,norm:oy,qr:Jv,subtract:Pn,typed:te}),q6=S1({multiply:qr,rotationMatrix:gM,typed:te}),yM=iE({abs:Vi,add:br,concat:Sr,identity:ou,index:nM,lusolve:fM,matrix:He,matrixFromColumns:Zv,multiply:qr,range:ic,schur:vM,subset:Ea,subtract:Pn,transpose:Uf,typed:te}),z6=oE({matrix:He,multiply:qr,sylvester:yM,transpose:Uf,typed:te});var Hf={},qm={},H6={},zi=hS({mathWithTransform:qm}),Gf=DS({Node:zi}),su=MS({Node:zi}),ac=CS({Node:zi}),G6=FS({Node:zi}),Wf=vS({Node:zi}),W6=xS({Node:zi,ResultSet:kD}),Y6=bS({Node:zi}),el=SS({Node:zi}),j6=NS({Node:zi}),Xie=jE({classes:H6}),xM=YS({math:Hf,typed:te}),Z6=ES({Node:zi,typed:te}),Qie=XS({Chain:xM,typed:te}),Yf=TS({Node:zi,size:pi}),jf=gS({Node:zi,subset:Ea}),J6=yS({matrix:He,Node:zi,subset:Ea}),tl=IS({Unit:Ut,Node:zi,math:Hf}),rl=PS({Node:zi,SymbolNode:tl,math:Hf}),Qo=BS({AccessorNode:jf,ArrayNode:Wf,AssignmentNode:J6,BlockNode:W6,ConditionalNode:Y6,ConstantNode:el,FunctionAssignmentNode:Z6,FunctionNode:rl,IndexNode:Yf,ObjectNode:Gf,OperatorNode:su,ParenthesisNode:ac,RangeNode:j6,RelationalNode:G6,SymbolNode:tl,config:Ie,numeric:Ja,typed:te}),X6=qE({ConstantNode:el,FunctionNode:rl,OperatorNode:su,ParenthesisNode:ac,parse:Qo,typed:te}),bM=VE({bignumber:Za,fraction:Vf,AccessorNode:jf,ArrayNode:Wf,ConstantNode:el,FunctionNode:rl,IndexNode:Yf,ObjectNode:Gf,OperatorNode:su,SymbolNode:tl,config:Ie,mathWithTransform:qm,matrix:He,typed:te}),wM=kS({parse:Qo,typed:te}),_M=UE({AccessorNode:jf,ArrayNode:Wf,ConstantNode:el,FunctionNode:rl,IndexNode:Yf,ObjectNode:Gf,OperatorNode:su,ParenthesisNode:ac,SymbolNode:tl,add:br,divide:di,equal:Xa,isZero:Zo,multiply:qr,parse:Qo,pow:Do,subtract:Pn,typed:te}),AM=$S({parse:Qo,typed:te}),Q6=WS({evaluate:AM}),K6=OS({evaluate:AM,parse:Qo}),sy=LE({AccessorNode:jf,ArrayNode:Wf,ConstantNode:el,FunctionNode:rl,IndexNode:Yf,ObjectNode:Gf,OperatorNode:su,ParenthesisNode:ac,SymbolNode:tl,equal:Xa,parse:Qo,replacer:OD,resolve:X6,simplifyConstant:bM,simplifyCore:_M,typed:te}),Kie=zE({OperatorNode:su,parse:Qo,simplify:sy,typed:te}),eae=$E({parse:Qo,typed:te}),tae=RS({Parser:K6,typed:te}),rae=GE({bignumber:Za,fraction:Vf,AccessorNode:jf,ArrayNode:Wf,ConstantNode:el,FunctionNode:rl,IndexNode:Yf,ObjectNode:Gf,OperatorNode:su,ParenthesisNode:ac,SymbolNode:tl,add:br,config:Ie,divide:di,equal:Xa,isZero:Zo,mathWithTransform:qm,matrix:He,multiply:qr,parse:Qo,pow:Do,simplify:sy,simplifyConstant:bM,simplifyCore:_M,subtract:Pn,typed:te}),nae=HE({ConstantNode:el,FunctionNode:rl,OperatorNode:su,ParenthesisNode:ac,SymbolNode:tl,config:Ie,equal:Xa,isZero:Zo,numeric:Ja,parse:Qo,simplify:sy,typed:te}),iae=JS({Help:Q6,mathWithTransform:qm,typed:te});sn(Hf,{e:PD,false:EU,fineStructure:TU,i:BD,Infinity:DU,LN10:MU,LOG10E:CU,NaN:NU,null:FU,phi:IU,SQRT1_2:BU,sackurTetrode:kU,tau:$D,true:$U,E:PD,version:OU,efimovFactor:RU,LN2:LU,pi:Uv,replacer:OD,reviver:Xie,SQRT2:VU,typed:te,PI:Uv,weakMixingAngle:UU,abs:Vi,acos:qU,acot:zU,acsc:HU,addScalar:Wn,arg:GU,asech:WU,asinh:YU,atan:RD,atanh:jU,bigint:ZU,bitNot:JU,boolean:XU,clone:QU,combinations:km,complex:$m,conj:ju,cos:qv,cot:KU,csc:e5,cube:t5,equalScalar:fr,erf:r5,exp:LD,expm1:n5,filter:i5,flatten:Of,forEach:a5,format:Rf,getMatrixDataType:zv,hex:o5,im:Hv,isInteger:ia,isNegative:au,isPositive:Zu,isZero:Zo,LOG2E:s5,lgamma:u5,log10:l5,log2:VD,map:Ju,multiplyScalar:Dn,not:Om,number:vs,oct:c5,pickRandom:f5,print:p5,random:m5,re:Gv,sec:d5,sign:UD,sin:Rm,splitUnit:h5,square:g5,string:v5,subtractScalar:ja,tan:y5,typeOf:Wv,acosh:x5,acsch:b5,apply:Yv,asec:w5,bignumber:Za,chain:Qie,combinationsWithRep:_5,cosh:A5,csch:S5,isNaN:Lf,isPrime:E5,randomInt:T5,sech:D5,sinh:M5,sparse:C5,sqrt:To,squeeze:N5,tanh:F5,unaryMinus:Jo,acoth:I5,bin:P5,coth:B5,fraction:Vf,isNumeric:Xu,matrix:He,matrixFromFunction:k5,mode:$5,numeric:Ja,prod:qD,reshape:zD,size:pi,transpose:Uf,xgcd:HD,zeros:mi,asin:O5,cbrt:GD,concat:Sr,count:R5,ctranspose:jv,diag:WD,divideScalar:dn,dotDivide:qf,equal:Xa,hasNumericValue:L5,identity:ou,kron:V5,largerEq:Lm,leftShift:U5,lsolve:YD,matrixFromColumns:Zv,nthRoot:q5,ones:z5,qr:Jv,resize:H5,rightArithShift:G5,round:rc,smaller:Ui,subtract:Pn,to:W5,unaryPlus:Xv,usolve:Qv,xor:Y5,add:br,atan2:j5,bitAnd:Z5,bitOr:J5,bitXor:X5,catalan:Q5,compare:Qu,compareText:jD,cumsum:K5,deepEqual:Kv,diff:e8,distance:t8,dot:Vm,equalText:r8,floor:ZD,gcd:n8,hypot:i8,larger:qi,log:ey,lsolveAll:a8,matrixFromRows:o8,min:s8,mod:XD,multiply:qr,nthRoots:u8,or:l8,partitionSelect:Um,rightLogShift:c8,slu:QD,subset:Ea,sum:ty,trace:f8,usolveAll:KD,zpk2tf:p8,ceil:ry,compareNatural:Xo,composition:m8,cross:d8,det:eM,dotMultiply:h8,fix:rM,index:nM,intersect:g8,invmod:v8,lcm:y8,log1p:x8,max:ny,setCartesian:b8,setDistinct:w8,setIsSubset:_8,setPowerset:A8,smallerEq:nc,sort:S8,unequal:E8,and:T8,range:ic,row:D8,setDifference:iM,setMultiplicity:M8,setSymDifference:aM,column:sM,inv:Ku,lup:uM,pinv:C8,pow:Do,setIntersect:lM,setUnion:N8,sqrtm:F8,vacuumImpedance:I8,wienDisplacement:P8,atomicMass:B8,bohrMagneton:k8,boltzmann:$8,conductanceQuantum:O8,coulomb:R8,deuteronMass:L8,dotPow:V8,electricConstant:U8,elementaryCharge:q8,expm:z8,faraday:H8,fft:cM,gamma:iy,gravitationConstant:G8,hartreeEnergy:W8,ifft:Y8,klitzing:j8,loschmidt:Z8,magneticConstant:J8,molarMass:X8,molarPlanckConstant:Q8,neutronMass:K8,nuclearMagneton:e6,planckCharge:t6,planckLength:r6,planckTemperature:n6,protonMass:i6,quantumOfCirculation:a6,reducedPlanckConstant:o6,rydberg:s6,secondRadiation:u6,speedOfLight:l6,stefanBoltzmann:c6,thomsonCrossSection:f6,avogadro:p6,bohrRadius:m6,createUnit:d6,divide:di,electronMass:h6,factorial:zf,firstRadiation:g6,gravity:v6,inverseConductanceQuantum:y6,lusolve:fM,magneticFluxQuantum:x6,molarMassC12:b6,multinomial:w6,parse:Qo,permutations:_6,planckMass:A6,polynomialRoot:S6,resolve:X6,setSize:E6,simplifyConstant:bM,solveODE:T6,stirlingS2:pM,unit:D6,bellNumbers:M6,compile:wM,eigs:mM,fermiCoupling:C6,gasConstant:N6,kldivergence:F6,mean:dM,molarVolume:I6,planckConstant:P6,quantileSeq:B6,simplifyCore:_M,variance:ay,classicalElectronRadius:k6,evaluate:AM,median:hM,simplify:sy,symbolicEqual:Kie,corr:$6,freqz:O6,leafCount:eae,mad:R6,parser:tae,rationalize:rae,std:L6,zeta:V6,derivative:nae,norm:oy,rotationMatrix:gM,help:iae,planckTime:U6,schur:vM,rotate:q6,sylvester:yM,lyap:z6,config:Ie});sn(qm,Hf,{filter:fD({typed:te}),forEach:pD({typed:te}),map:dD({typed:te}),apply:lD({isInteger:ia,typed:te}),or:ND({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te}),and:CD({add:br,concat:Sr,equalScalar:fr,matrix:He,not:Om,typed:te,zeros:mi}),concat:wD({isInteger:ia,matrix:He,typed:te}),max:hD({config:Ie,larger:qi,numeric:Ja,typed:te}),print:MD({add:br,matrix:He,typed:te,zeros:mi}),bitAnd:FD({add:br,concat:Sr,equalScalar:fr,matrix:He,not:Om,typed:te,zeros:mi}),diff:_D({bignumber:Za,matrix:He,number:vs,subtract:Pn,typed:te}),min:vD({config:Ie,numeric:Ja,smaller:Ui,typed:te}),subset:bD({add:br,matrix:He,typed:te,zeros:mi}),bitOr:ID({DenseMatrix:sr,concat:Sr,equalScalar:fr,matrix:He,typed:te}),cumsum:TD({add:br,typed:te,unaryPlus:Xv}),index:mD({Index:Ei,getMatrixDataType:zv}),sum:SD({add:br,config:Ie,numeric:Ja,typed:te}),range:yD({bignumber:Za,matrix:He,add:br,config:Ie,isPositive:Zu,larger:qi,largerEq:Lm,smaller:Ui,smallerEq:nc,typed:te}),row:xD({Index:Ei,matrix:He,range:ic,typed:te}),column:cD({Index:Ei,matrix:He,range:ic,typed:te}),mean:gD({add:br,divide:di,typed:te}),quantileSeq:ED({add:br,bignumber:Za,compare:Qu,divide:di,isInteger:ia,larger:qi,multiply:qr,partitionSelect:Um,smaller:Ui,smallerEq:nc,subtract:Pn,typed:te}),variance:DD({add:br,apply:Yv,divide:di,isNaN:Lf,multiply:qr,subtract:Pn,typed:te}),std:AD({map:Ju,sqrt:To,typed:te,variance:ay})});sn(H6,{BigNumber:We,Complex:Xr,Fraction:Yu,Matrix:Bm,Node:zi,ObjectNode:Gf,OperatorNode:su,ParenthesisNode:ac,Range:PU,RelationalNode:G6,ResultSet:kD,ArrayNode:Wf,BlockNode:W6,ConditionalNode:Y6,ConstantNode:el,DenseMatrix:sr,RangeNode:j6,Chain:xM,FunctionAssignmentNode:Z6,SparseMatrix:Yn,IndexNode:Yf,ImmutableDenseMatrix:JD,Index:Ei,AccessorNode:jf,AssignmentNode:J6,FibonacciHeap:tM,Spa:oM,Unit:Ut,SymbolNode:tl,FunctionNode:rl,Help:Q6,Parser:K6});xM.createProxy(Hf);var uy=class extends fs{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 yn(void 0),uuid:Fr(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.expressionStr+=n.contextName,e+=1}else this.expressionStr+=r;this.expression=wM(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 ll({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{let r=`${this.expression.evaluate(e)}`;return{value:Oa(r),error:!1}}catch(r){return r instanceof Error?this.handleComputeError(new ll({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=Pl(r?.value,this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)??"";r?.error?pt.addClass(e,"mb-error"):pt.removeClass(e,"mb-error"),e.innerText=n}handleComputeError(e){return console.warn(e),{error:!0,value:e.message}}};var ly=class extends fs{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 yn(void 0),uuid:Fr(),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 ll({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="string"?e:Pl(e.metadataSignal.get(),this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)).join("")}mapValue(e){return e}onInitialRender(e){this.renderMarkdown=this.mountable.getArgument("renderMarkdown")?.value??!1,this.renderMarkdown&&pt.addClass(e,"mb-view-markdown")}async onRerender(e,r){let n=Pl(r,this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)??"";this.renderMarkdown?(this.markdownUnloadCallback?.(),this.markdownUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(n,e,this.mountable.getFilePath())):e.innerText=n}onUnmount(){super.onUnmount(),this.markdownUnloadCallback?.()}};var cy=class{constructor(e){this.plugin=e}createViewField(e){let r=e.declaration.viewFieldType;if(r==="math")return new uy(e);if(r==="text")return new ly(e);if(r==="link")return new Tg(e);if(r==="image")return new Eg(e);}};var fy=class extends qn{constructor(e,r,n,i,a){super(e,r,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Qt(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 Ht({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.plugin.api.viewFieldFactory.createViewField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.viewField&&this.errorCollection.add(new Ht({errorLevel:"CRITICAL",effect:"can't render view field",cause:"view field is undefined"}))}createErrorIndicator(e){this.plugin.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),pt.empty(e),pt.addClass(e,"mb-view"),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let r=document.createElement("div");pt.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)pt.addClasses(r,i.value);pt.addClass(r,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType==="block"?pt.addClass(e,"mb-view-block"):pt.addClass(e,"mb-view-inline")}onUnmount(e){super.onUnmount(e),this.viewField?.unmount(),Di(e,"view field")}};var py=class{constructor(e){this.plugin=e}fromString(e){return Xn(rs,e)}fromStringAndValidate(e,r,n){return this.validate(e,this.fromString(e),r,n)}fromExistingDeclaration(e){if(e!==void 0)return{storageType:Ia(e.storageType),storagePath:Ia(e.storagePath),storageProp:e.storageProp.path.map(r=>({type:r.type,prop:Ia(r.prop)})),listenToChildren:e.listenToChildren}}validate(e,r,n,i){let a={};a.listenToChildren=r.listenToChildren,a.storageProp=new bu(r.storageProp.map(u=>new dl(u.type,u.prop.value))),r.storageType===void 0?a.storageType=this.plugin.metadataManager.defaultSource:a.storageType=this.validateStorageType(r.storageType,e);let o=r.storagePath!==void 0,s=r.storagePath??{value:n},l=this.plugin.metadataManager.getSource(a.storageType);if(l===void 0)throw new Ht({errorLevel:"CRITICAL",effect:"can not validate bind target",cause:`Source '${a.storageType}' not found. But validation was successful. This should not happen.`,context:{fullDeclaration:e,sources:[...this.plugin.metadataManager.sources.keys()]}});return a.storagePath=l.validateStoragePath(s,o,e,this),l.id==="scope"?this.resolveScope(a,i):a}resolveScope(e,r){if(r===void 0)throw new Vn("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.plugin.metadataManager.iterateSources())if(n===e.value)return n;throw new Vn("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 Vn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",r,e?.position);let i=this.plugin.internal.file.getPathByName(n);if(i===void 0)throw new Vn("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${n}' not found.`,r,e?.position);return i}};var n9=zr(Ma()),zm=zr(ca());function EM(t){return t instanceof Error&&t.name==="ZodError"&&"issues"in t&&Array.isArray(t.issues)}var SM=class extends Error{name;details;constructor(t,e){super(t,e),this.name="ZodValidationError",this.details=oae(e)}toString(){return this.message}};function oae(t){if(t){let e=t.cause;if(EM(e))return e.issues}return[]}function e9(t){return t.length!==0}var sae=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function uae(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+'["'+lae(r)+'"]';if(!sae.test(r))return e+'["'+r+'"]';let n=e.length===0?"":".";return e+n+r},"")}function lae(t){return t.replace(/"/g,'\\"')}var cae="; ",fae=99,t9="Validation error",pae=": ",mae=", or ";function dae(t={}){let{issueSeparator:e=cae,unionSeparator:r=mae,prefixSeparator:n=pae,prefix:i=t9,includePath:a=!0,maxIssuesInMessage:o=fae}=t;return s=>{let l=s.slice(0,o).map(u=>my({issue:u,issueSeparator:e,unionSeparator:r,includePath:a})).join(e);return hae(l,i,n)}}function my(t){let{issue:e,issueSeparator:r,unionSeparator:n,includePath:i}=t;if(e.code===qe.invalid_union)return e.unionErrors.reduce((a,o)=>{let s=o.issues.map(l=>my({issue:l,issueSeparator:r,unionSeparator:n,includePath:i})).join(r);return a.includes(s)||a.push(s),a},[]).join(n);if(e.code===qe.invalid_arguments)return[e.message,...e.argumentsError.issues.map(a=>my({issue:a,issueSeparator:r,unionSeparator:n,includePath:i}))].join(r);if(e.code===qe.invalid_return_type)return[e.message,...e.returnTypeError.issues.map(a=>my({issue:a,issueSeparator:r,unionSeparator:n,includePath:i}))].join(r);if(i&&e9(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 "${uae(e.path)}"`}return e.message}function hae(t,e,r){return e!==null?t.length>0?[e,t].join(r):e:t.length>0?t:t9}function dy(t,e={}){if(!EM(t))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${yae.name}" method instead?`);return r9(t,e)}function r9(t,e={}){let r=t.errors,n;return e9(r)?n=gae(e)(r):n=t.message,new SM(n,{cause:t})}function gae(t){return"messageBuilder"in t?t.messageBuilder:dae(t)}var vae=(t={})=>e=>EM(e)?r9(e,t):e instanceof Error?new SM(e.message,{cause:e}):new SM("Unknown error");function yae(t,e={}){return vae(e)(t)}var xae=zm.P.sequenceMap((t,e)=>e,zm.P.string("BUTTON"),zm.P.manyNotOf("[],^").separateBy(zm.P.string(",").trim(n9.P_UTILS.optionalWhitespace())).wrapString("[","]")),hy=class{constructor(e){this.plugin=e}fromGroupString(e){let r=new Qt("ButtonGroup"),n=[];try{n=Xn(xae,e)}catch(i){r.add(i)}return{declarationString:e,referencedButtonIds:n,errorCollection:r}}validateGroup(e){return{declarationString:void 0,referencedButtonIds:e.referencedButtonIds,errorCollection:new Qt("ButtonGroup")}}fromString(e){let r=new Qt("Button"),n;try{let i=this.plugin.internal.parseYaml(e);n=this.validateConfig(i)}catch(i){r.add(i)}return{declarationString:e,config:n,errorCollection:r}}validateConfig(e){let r=WF(Vc,e);if(!r.success){let n=dy(r.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null,includePath:!1});throw new Ns({errorLevel:"ERROR",effect:"The validation for the button config failed.",cause:"Your button syntax seems to be invalid. Check that your button config follows what is described in the docs.",positionContext:n.message,docs:[jt.linkToButtonConfig()]})}return r.data}validate(e){let r=new Qt("Button"),n;try{n=this.validateConfig(e)}catch(i){r.add(i)}return{declarationString:void 0,config:n,errorCollection:r}}};var Zf=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let r of Object.values(fn))e[r]=0;for(let r of this.arguments){let n=r.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new Hr({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${n.type}' does not allow duplicates`,docs:[jt.linkToSearch(n.type)]})}}mergeByOverride(e){for(let r of e.arguments){let n=r.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(r)}return this.validate(),this}mergeByThrow(e){for(let r of e.arguments){let n=r.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new Hr({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(r)}return this.validate(),this}getAll(e){return this.arguments.filter(r=>r.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var gy=class extends Zf{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Jf=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,r){if(r.find(n=>n.length===e.length)===void 0)throw new Hr({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${r.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[jt.linkToSearch(this.getConfig().type)]})}isAllowed(e){return this.getConfig().allowedFieldTypes.length===0?!0:this.getConfig().allowedFieldTypes.includes(e)}getAllowedFieldsAsString(){return this.getConfig().allowedFieldTypes.length===0?"all":this.getConfig().allowedFieldTypes.join(", ")}};var Tr=class extends Jf{};var vy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.addLabels}};var yy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.allowOther}};var xy=class extends Tr{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return Nr.class}};var by=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=Oa(r[0].value)}getConfig(){return Nr.defaultValue}};var wy=class extends Tr{constructor(){super(...arguments);this.value=void 0}_parseValue(r){if(this.value=Number.parseInt(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.limit}};var _y=class extends Tr{constructor(){super(...arguments);this.value=100}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.maxValue}};var Ay=class extends Tr{constructor(){super(...arguments);this.value=0}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.minValue}};var Sy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.multiLine}};var Ey=class extends Tr{constructor(){super(...arguments);this.value=!1}_parseValue(r){this.value=Oa(r[0].value)}getConfig(){return Nr.offValue}};var Ty=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=Oa(r[0].value)}getConfig(){return Nr.onValue}};var Dy=class extends Tr{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(r){r.length===1?(this.value=Oa(r[0].value),this.name=r[0].value):r.length===2&&(this.value=Oa(r[0].value),this.name=r[1].value)}getConfig(){return Nr.option}};var My=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Nr.optionQuery}};var Cy=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Nr.placeholder}};var Ny=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.showcase}};var Fy=class extends Tr{constructor(){super(...arguments);this.value=0}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.stepSize}};var Iy=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Nr.title}};function i9(t,e,r){return r==="true"?`[[${t}|${e}]]`:r==="partial"?`[[${e}]]`:`${e}`}var Py=class extends Tr{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 Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${XN(["true","partial","false"],i=>`'${i}'`,", ","or")}`,docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.useLinks}};var a9={class:xy,addLabels:vy,minValue:Ay,maxValue:_y,stepSize:Fy,option:Dy,title:Iy,optionQuery:My,showcase:Ny,offValue:Ey,onValue:Ty,defaultValue:by,placeholder:Cy,useLinks:Py,limit:wy,allowOther:yy,multiLine:Sy},By=class{static createInputFieldArgument(e){if(e in a9){let r=a9[e];if(r)return new r}throw new No({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var ky=class{constructor(e,r,n){this.plugin=e,this.unvalidatedDeclaration=r,this.filePath=n,this.errorCollection=new Qt("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(hu))if(r[1]===e?.value)return r[1];return this.errorCollection.add(new Vn("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.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.bindTarget,this.filePath,e)}catch(r){this.errorCollection.add(r)}}validateArguments(e){let r=new gy;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=By.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Vn("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(fn))if(r[1]===e.value)return r[1];return this.errorCollection.add(new Vn("WARNING","Declaration Validator",`Encountered invalid identifier. Expected an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}};var Hi=zr(Ma()),on=zr(ca());var wae=on.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{inputFieldType:t,arguments:e,bindTarget:n}},Mi.node(ji).trim(Hi.P_UTILS.optionalWhitespace()).describe("input field type"),bp.trim(Hi.P_UTILS.optionalWhitespace()).wrap(on.P.string("(").describe('arguments paren "("'),on.P.string(")").describe('arguments paren ")"')).trim(Hi.P_UTILS.optionalWhitespace()).optional([]),on.P.sequence(on.P.string(":").trim(Hi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),rs).trim(Hi.P_UTILS.optionalWhitespace()).optional()),o9=on.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{inputFieldType:t,arguments:e,bindTarget:n}},Mi.node(ji).trim(Hi.P_UTILS.optionalWhitespace()).optional().describe("input field type"),bp.trim(Hi.P_UTILS.optionalWhitespace()).wrap(on.P.string("(").describe('arguments paren "("'),on.P.string(")").describe('arguments paren ")"')).trim(Hi.P_UTILS.optionalWhitespace()).optional([]),on.P.sequence(on.P.string(":").trim(Hi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),rs).trim(Hi.P_UTILS.optionalWhitespace()).optional()),s9=on.P.or(on.P.sequenceMap((t,e,r)=>(r.templateName=e,r),on.P.string("INPUT"),on.P.sequenceMap((t,e,r)=>e,on.P.string("["),yF.node(ji).trim(Hi.P_UTILS.optionalWhitespace()).describe("template name"),on.P.string("]").skip(Hi.P_UTILS.optionalWhitespace())),o9.wrap(on.P.string("["),on.P.string("]")),Hi.P_UTILS.eof()),on.P.sequenceMap((t,e)=>e,on.P.string("INPUT"),wae.wrap(on.P.string("["),on.P.string("]")),Hi.P_UTILS.eof())),u9=on.P.sequenceMap((t,e)=>e,on.P.string("INPUT"),o9.wrap(on.P.string("["),on.P.string("]")),Hi.P_UTILS.eof());var $y=class{constructor(e){this.plugin=e,this.templates=[]}fromString(e){let r=new Qt("InputField");try{let n=Xn(s9,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){let r=new Qt("InputField");return{declarationString:void 0,inputFieldType:Ia(e.inputFieldType),bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.bindTarget),arguments:(e.arguments??[]).map(n=>({name:Ia(n.name),value:n.value.map(i=>Ia(i))})),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 ky(this.plugin,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 Qt("input field declaration").merge(e.errorCollection).merge(r.errorCollection)}}parseTemplateString(e){let r=new Qt("InputFieldParser");try{let n=Xn(u9,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 Qt("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(Gx(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 Vn("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 Oy=class{constructor(e){this.plugin=e}fromString(e){let r=new Qt("JsViewFieldDeclaration");try{let n=Xn(EF,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 Qt("JsViewFieldDeclaration");return{declarationString:void 0,code:e.code,bindTargetMappings:e.bindTargetMappings.map(n=>({bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(n.bindTarget),name:n.name})),writeToBindTarget:this.plugin.api.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.plugin.api.bindTargetParser.validate(e.declarationString,i.bindTarget,r),name:i.name})),e.writeToBindTarget!==void 0&&(n.writeToBindTarget=this.plugin.api.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 Ry=class extends Zf{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var nl=class extends Jf{};var Ly=class extends nl{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return xc.class}};var Vy=class extends nl{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return xc.hidden}};var Uy=class extends nl{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return xc.renderMarkdown}};var l9={renderMarkdown:Uy,hidden:Vy,class:Ly},qy=class{static createViewFieldArgument(e){if(e in l9){let r=l9[e];if(r)return new r}throw new No({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var zy=class{constructor(e,r,n){this.unvalidatedDeclaration=e,this.plugin=n,this.filePath=r,this.errorCollection=new Qt("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(sp))if(r[1]===e?.value)return r[1];return this.errorCollection.add(new Vn("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.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.writeToBindTarget,this.filePath,e)}validateArguments(e){let r=new Ry;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=qy.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Vn("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(ul))if(r[1]===e.value)return r[1];return this.errorCollection.add(new Vn("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.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,r,this.filePath,e))??[]}catch(r){return this.errorCollection.add(r),[]}}};var Hy=class{constructor(e){this.plugin=e}fromString(e){let r=new Qt("ViewFieldDeclaration");try{let n=Xn(SF,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 Qt("ViewFieldDeclaration");return{declarationString:void 0,templateDeclaration:(e.templateDeclaration??[]).map(n=>typeof n=="string"?n:this.plugin.api.bindTargetParser.fromExistingDeclaration(n)),viewFieldType:Ia(e.viewFieldType),arguments:(e.arguments??[]).map(n=>({name:Ia(n.name),value:n.value.map(i=>Ia(i))})),writeToBindTarget:this.plugin.api.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 zy(e,r,this.plugin).validate(n)}};var Gy=class{constructor(e,r){this.plugin=e,this.inputFieldParser=r?.inputFieldParser??new $y(e),this.viewFieldParser=r?.viewFieldParser??new Hy(e),this.jsViewFieldParser=r?.jsViewFieldParser??new Oy(e),this.buttonParser=r?.buttonParser??new hy(e),this.bindTargetParser=r?.bindTargetParser??new py(e),this.inputFieldFactory=r?.inputFieldFactory??new wg(e),this.viewFieldFactory=r?.viewFieldFactory??new cy(e),this.buttonActionRunner=r?.buttonActionRunner??new wh(e),this.buttonManager=r?.buttonManager??new Zh(e),this.syntaxHighlighting=r?.syntaxHighlighting??new Zd(e)}createField(e,r,n,i=!0){if(pn(ve.object({type:Tp,filePath:$a,options:ve.any(),honorExcludedSetting:ve.boolean()}),{type:e,filePath:r,options:n,honorExcludedSetting:i}),this.plugin.internal.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){pn(ve.object({fieldString:ve.string(),filePath:$a,scope:zc.optional(),renderChildType:qc,honorExcludedSetting:ve.boolean()}),{fieldString:e,filePath:r,scope:n,renderChildType:i,honorExcludedSetting:o});let s=this.isInlineFieldDeclarationAndGetType(e);if(s===void 0)throw new Ht({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(pn(ve.object({type:Tp,declaration:ve.string(),filePath:$a,scope:zc.optional(),renderChildType:qc,honorExcludedSetting:ve.boolean()}),{type:e,declaration:r,filePath:n,scope:i,renderChildType:a,honorExcludedSetting:s}),this.plugin.internal.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 Ht({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${e}"`})}createInputFieldMountable(e,r){pn(ve.object({filePath:$a,options:nI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.inputFieldParser.fromStringAndValidate(r.declaration,e,r.scope):i=this.inputFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e,r.scope),new ff(this.plugin,n,e,r.renderChildType,i)}createViewFieldMountable(e,r){pn(ve.object({filePath:$a,options:iI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.viewFieldParser.fromStringAndValidate(r.declaration,e,r.scope):i=this.viewFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e,r.scope),new fy(this.plugin,n,e,r.renderChildType,i)}createJsViewFieldMountable(e,r){pn(ve.object({filePath:$a,options:aI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.jsViewFieldParser.fromStringAndValidate(r.declaration,e):i=this.jsViewFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e),new Sg(this.plugin,n,e,i)}createTableMountable(e,r){pn(ve.object({filePath:$a,options:oI}),{filePath:e,options:r});let n=Fr();return new Ag(this.plugin,n,e,r.bindTarget,r.tableHead,r.columns)}createButtonGroupMountable(e,r){pn(ve.object({filePath:$a,options:sI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.buttonParser.fromGroupString(r.declaration):i=this.buttonParser.validateGroup(r.declaration),new Yh(this.plugin,n,e,i,r.renderChildType,r.position)}createButtonMountable(e,r){pn(ve.object({filePath:$a,options:uI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.buttonParser.fromString(r.declaration):i=this.buttonParser.validate(r.declaration),new Jh(this.plugin,n,e,i,r.position,r.isPreview)}createEmbedMountable(e,r){pn(ve.object({filePath:$a,options:lI}),{filePath:e,options:r});let n=Fr();return new Xh(this.plugin,n,e,r.depth,r.content)}createExcludedMountable(e){pn(ve.object({filePath:$a}),{filePath:e});let r=Fr();return new Qh(this.plugin,r,e)}getInlineFieldDeclarationPrefix(e){if(pn(ve.object({fieldType:Tp}),{fieldType:e}),e==="INPUT")return"INPUT";if(e==="VIEW")return"VIEW";if(e==="BUTTON_GROUP")return"BUTTON";throw new Ht({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}isInlineFieldDeclaration(e,r){pn(ve.object({fieldType:Tp,str:ve.string()}),{fieldType:e,str:r});let n=this.getInlineFieldDeclarationPrefix(e)+"[";return r.startsWith(n)&&r.endsWith("]")}isInlineFieldDeclarationAndGetType(e){if(pn(ve.object({str:ve.string()}),{str:e}),!!e.endsWith("]"))for(let r of Object.values(yc)){if(!ud(r))continue;let n=this.getInlineFieldDeclarationPrefix(r)+"[";if(e.startsWith(n))return r}}createSignal(e){return new yn(e)}createBindTarget(e,r,n,i=!1){return pn(ve.object({storageType:ve.string(),storagePath:ve.string(),property:ve.string().array(),listenToChildren:ve.boolean()}),{storageType:e,storagePath:r,property:n,listenToChildren:i}),{storageType:e,storagePath:r,storageProp:_g(n),listenToChildren:i}}parseBindTarget(e,r,n){return pn(ve.object({declarationString:ve.string(),filePath:$a,scope:zc.optional()}),{declarationString:e,filePath:r,scope:n}),this.bindTargetParser.fromStringAndValidate(e,r,n)}setMetadata(e,r){pn(ve.object({bindTarget:ka}),{bindTarget:e}),this.plugin.metadataManager.write(r,e)}getMetadata(e){return pn(ve.object({bindTarget:ka}),{bindTarget:e}),this.plugin.metadataManager.read(e)}updateMetadata(e,r){pn(ve.object({bindTarget:ka,updateFn:ve.function().args(ve.any()).returns(ve.any())}),{bindTarget:e,updateFn:r});let n=this.plugin.metadataManager.read(e),i=r(n);this.plugin.metadataManager.write(i,e)}subscribeToMetadata(e,r,n){pn(ve.object({bindTarget:ka,lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:ve.function().args(ve.any()).returns(ve.void())}),{bindTarget:e,lifecycleHook:r,callback:n});let i=Fr(),a=new yn(void 0);a.registerListener({callback:n});let o=this.plugin.metadataManager.subscribe(i,a,e,()=>{a.unregisterAllListeners()});r.register(()=>{o.unsubscribe()})}createNotePosition(e,r){return pn(ve.object({lineStart:ve.number(),lineEnd:ve.number()}),{lineStart:e,lineEnd:r}),new du({lineStart:e,lineEnd:r})}};var c9=require("@codemirror/view"),Wy=class extends c9.WidgetType{constructor(e,r,n,i,a){super(),this.type=e,this.content=r,this.filePath=n,this.parentComponent=i,this.plugin=a}eq(e){return e.content===this.content}toDOM(e){let r=document.createElement("span");r.addClass("cm-inline-code");let n=this.plugin.api.createInlineFieldOfTypeFromString(this.type,this.content,this.filePath,void 0);return this.renderChild=this.plugin.api.wrapInMDRC(n,r,this.parentComponent),r}destroy(e){this.renderChild?.unload(),super.destroy(e)}};var f9=require("obsidian"),Yy=class extends f9.MarkdownRenderChild{constructor(e,r,n){super(n),this.plugin=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 p9(t){return t.dependencyManager.checkDependency("dataview").api}function il(t){return t.dependencyManager.checkDependency("js-engine").api}function TM(t){return t.dependencyManager.checkDependency("templater-obsidian").templater}var _ae=ve.object({addChild:ve.function().args(ve.instanceof(m9.Component)).returns(ve.void())}),jy=class extends Gy{constructor(e){super(e)}wrapInMDRC(e,r,n){pn(ve.object({field:XF,containerEl:JF,component:_ae}),{field:e,containerEl:r,component:n});let i=new Yy(this.plugin,e,r);return n.addChild(i),i}constructMDRCWidget(e,r,n,i){if(ud(e))return new Wy(e,r,n,i,this.plugin);throw new Ht({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline field type "${e}"`})}reactiveMetadata(e,r,n){pn(ve.object({bindTargets:ka.array(),lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:ve.function()}),{bindTargets:e,lifecycleHook:r,callback:n});let i=il(this.plugin),a=Fr(),o=e.map(()=>new yn(void 0)),s=()=>Promise.resolve(),l=this.plugin.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 Mn=require("obsidian");var Zy=zr(dp());var d9=zr(dp());var Aae=ue('<div class="mb-calendar-cell mb-calendar-header-cell"><span class="mb-calendar-cell-text"> </span></div>'),Sae=(t,e,r)=>e(z(r)),Eae=(t,e,r)=>e(t,z(r)),Tae=ue('<div class="mb-calendar-cell" role="button" tabindex="0"><span class="mb-calendar-cell-text"> </span></div>'),Dae=ue('<div class="mb-calendar"><div class="mb-calendar-header"></div> <div class="mb-calendar-content"></div></div>');function DM(t,e){Te(e,!0);let r=Lt(()=>nF(e.month,e.year));function n(l){l&&e.dateChange((0,d9.default)(new Date(e.year,e.month,l)))}function i(l,u){l.key===" "&&n(u)}var a=Dae(),o=ye(a);Yt(o,21,iF,er,(l,u)=>{var c=Aae(),f=ye(c),m=ye(f,!0);ce(f),ce(c),Le(()=>xt(m,z(u))),K(l,c)}),ce(o);var s=le(o,2);Yt(s,21,()=>z(r),l=>aF(),(l,u)=>{var c=Tae();c.__click=[Sae,n,u],c.__keydown=[Eae,i,u];let f=Lt(()=>e.selectedDate?.year()===e.year&&e.selectedDate?.month()===e.month&&e.selectedDate?.date()===z(u));Le(()=>tn(c,"mb-calendar-selected",z(f)));var m=ye(c),p=ye(m,!0);ce(m),ce(c),Le(()=>{tn(c,"mb-calendar-highlight",z(u)),tn(c,"mb-calendar-content-cell",z(u)),xt(p,z(u)||"")}),K(l,c)}),ce(s),ce(a),K(t,a),De()}Nt(["click","keydown"]);function Mae(t,e,r){if(z(e)===11){$e(e,0),$e(r,z(r)+1);return}$e(e,z(e)+1)}function Cae(t,e,r){if(z(e)===0){$e(e,11),$e(r,z(r)-1);return}$e(e,z(e)-1)}function Nae(t,e){let r=t.target.value,n=Number.parseInt(r);Number.isNaN(n)||$e(e,Ve(n))}function Fae(t,e,r){e(null),r.dateChangeCallback(null)}function Iae(t,e,r){e((0,Zy.default)()),r.dateChangeCallback(e())}var Pae=ue('<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 MM(t,e){Te(e,!0);let r=ut(e,"selectedDate",23,Zy.default),n=yt(0),i=yt(0);ga(()=>{if(r())$e(n,Ve(r().month())),$e(i,Ve(r().year()));else{let T=(0,Zy.default)();$e(n,Ve(T.month())),$e(i,Ve(T.year()))}});function a(T){r(T),e.dateChangeCallback(T)}var o=Pae(),s=ye(o),l=ye(s);l.__click=[Cae,n,i];var u=le(l,2),c=ye(u),f=ye(c,!0);Le(()=>xt(f,rF(z(n)))),ce(c);var m=le(c,2);Tt(m),Le(()=>Qb(m,z(i).toString())),m.__input=[Nae,i],ce(u);var p=le(u,2);p.__click=[Mae,n,i],ce(s);var d=le(s,2);DM(d,{dateChange:a,get month(){return z(n)},get year(){return z(i)},get selectedDate(){return r()}});var h=le(d,2),x=ye(h);x.__click=[Fae,r,e];var b=le(x,2);b.__click=[Iae,r,e],ce(h),ce(o),K(t,o),De()}Nt(["click","input"]);var Xf=class extends Ni{setModal(e){this.modal=e}closeModal(){if(this.modal!==void 0)this.modal.close();else throw new Ht({errorLevel:"CRITICAL",effect:"Failed to close modal",cause:"Modal reference in ModalContent is undefined"})}};var Bae=ue('<div class="setting-item"><div class="setting-item-info"><div class="setting-item-name"> </div> <div class="setting-item-description"> </div></div> <div class="setting-item-control"><!></div></div>');function kt(t,e){Te(e,!0);let r=ut(e,"name",3,""),n=ut(e,"description",3,""),i=ut(e,"heading",3,!1),a=ut(e,"vertical",3,!1);var o=Bae(),s=ye(o),l=ye(s),u=ye(l,!0);ce(l);var c=le(l,2),f=ye(c,!0);ce(c),ce(s);var m=le(s,2),p=ye(m);{var d=h=>{var x=Gr(),b=je(x);go(b,()=>e.children),K(h,x)};at(p,h=>{e.children&&h(d)})}ce(m),ce(o),Le(()=>{tn(o,"setting-item-heading",i()),tn(o,"mb-vertical",a()),xt(u,r()),xt(f,n()),tn(m,"mb-vertical-control",a())}),K(t,o),De()}function CM(t,e){Te(e,!0);let r=ut(e,"action",15);function n(){e.plugin.internal.openCommandSelectModal(a=>{r(r().command=a.id,!0)})}var i=Lt(()=>`Command: ${(r().command||"none")??""}`);kt(t,{get name(){return z(i)},description:"The command to execute when this action runs.",children:(a,o)=>{bt(a,{get variant(){return"primary"},onclick:()=>n(),children:(s,l)=>{Et();var u=Wt("Change");K(s,u)},$$slots:{default:!0}})},$$slots:{default:!0}}),De()}var kae=(t,e,r)=>e(!z(r)),$ae=(t,e,r)=>{t.key===" "&&e(!z(r))},Oae=ue('<div class="checkbox-container" role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function Qa(t,e){let r=ut(e,"checked",15),n=Lt(()=>r()??!1);var i=Oae();i.__click=[kae,r,n],i.__keydown=[$ae,r,n];var a=ye(i);Tt(a),ce(i),Le(()=>{wt(i,"aria-checked",z(n)),tn(i,"is-enabled",z(n)),js(a,z(n))}),K(t,i)}Nt(["click","keydown"]);var Rae=ue('<input type="text" placeholder="some name">'),Lae=ue("<!> <!> <!> <!>",1);function NM(t,e){Te(e,!0);let r=ut(e,"action",15);function n(){e.plugin.internal.openFolderSelectModal(f=>{r(r().folderPath=f,!0)})}var i=Lae(),a=je(i),o=Lt(()=>`Folder: ${(r().folderPath||"none")??""}`);kt(a,{get name(){return z(o)},description:"The folder to create a new note in.",children:(f,m)=>{bt(f,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(p,d)=>{Et();var h=Wt("Change");K(p,h)},$$slots:{default:!0}})},$$slots:{default:!0}});var s=le(a,2),l=Lt(()=>`File name: ${(r().fileName||"default")??""}`);kt(s,{get name(){return z(l)},description:"The file name of the new note.",children:(f,m)=>{var p=Rae();Tt(p),_t(p,()=>r().fileName,d=>r(r().fileName=d,!0)),K(f,p)},$$slots:{default:!0}});var u=le(s,2);kt(u,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(f,m)=>{Qa(f,{get checked(){return r().openNote},set checked(p){r(r().openNote=p,!0)}})},$$slots:{default:!0}});var c=le(u,2);kt(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)=>{Qa(f,{get checked(){return r().openIfAlreadyExists},set checked(p){r(r().openIfAlreadyExists=p,!0)}})},$$slots:{default:!0}}),K(t,i),De()}function FM(t,e){Te(e,!0);let r=ut(e,"action",15);function n(){e.plugin.internal.openMarkdownFileSelectModal(a=>{r(r().templateFile=a,!0)})}var i=Lt(()=>`File path: ${(r().templateFile||"default")??""}`);kt(t,{get name(){return z(i)},description:"The path to the templater file, relative to the vault root.",children:(a,o)=>{bt(a,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(s,l)=>{Et();var u=Wt("Change");K(s,u)},$$slots:{default:!0}})},$$slots:{default:!0}}),De()}var Vae=ue('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function IM(t,e){Te(e,!0);let r=ut(e,"action",15);var n=Vae(),i=je(n);kt(i,{name:"JS code",description:"The JavaScript code to run."});var a=le(i,2),o=ye(a);On(o),ce(a),_t(o,()=>r().code,s=>r(r().code=s,!0)),K(t,n),De()}var Uae=ue('<input type="text" placeholder="some text">');function PM(t,e){Te(e,!0);let r=ut(e,"action",15);kt(t,{name:"Text",description:"The text to input at the cursor.",children:(n,i)=>{var a=Uae();Tt(a),_t(a,()=>r().str,o=>r(r().str=o,!0)),K(n,a)},$$slots:{default:!0}}),De()}var qae=ue('<input type="number" placeholder="0">'),zae=ue('<!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function BM(t,e){Te(e,!0);let r=ut(e,"action",15);var n=zae(),i=je(n);kt(i,{name:"Line",description:"The line number to insert at.",children:(l,u)=>{var c=qae();Tt(c),_t(c,()=>r().line,f=>r(r().line=f,!0)),K(l,c)},$$slots:{default:!0}});var a=le(i,2);kt(a,{name:"Text to insert",description:"The text to insert into the note."});var o=le(a,2),s=ye(o);On(s),ce(o),_t(s,()=>r().value,l=>r(r().value=l,!0)),K(t,n),De()}function kM(t,e){Te(e,!0);let r=ut(e,"action",15);function n(){e.plugin.internal.openFilteredFileSelectModal(i=>{r(r().file=i,!0)},i=>i.endsWith(".js"))}kt(t,{name:"JS file",description:"The JavaScript file to run.",children:(i,a)=>{bt(i,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(o,s)=>{Et();var l=Wt("Change");K(o,l)},$$slots:{default:!0}})},$$slots:{default:!0}}),De()}var Hae=ue('<input type="text" placeholder="[[Some Note]] or https://www.example.com"> <!>',1),Gae=ue("<!> <!>",1);function $M(t,e){Te(e,!0);let r=ut(e,"action",15);function n(){e.plugin.internal.openMarkdownFileSelectModal(s=>{r(r().link=s,!0)})}var i=Gae(),a=je(i);kt(a,{name:"Link",description:"The link to open.",children:(s,l)=>{var u=Hae(),c=je(u);Tt(c);var f=le(c,2);bt(f,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(m,p)=>{Wr(m,{iconName:"list",get plugin(){return e.plugin}})},$$slots:{default:!0}}),_t(c,()=>r().link,m=>r(r().link=m,!0)),K(s,u)},$$slots:{default:!0}});var o=le(a,2);kt(o,{name:"New tab",description:"Whether to open the link in a new tab.",children:(s,l)=>{Qa(s,{get checked(){return r().newTab},set checked(u){r(r().newTab=u,!0)}})},$$slots:{default:!0}}),K(t,i),De()}var Wae=ue('<input type="text">'),Yae=ue('<input type="text" placeholder="g">'),jae=ue('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function OM(t,e){Te(e,!0);let r=ut(e,"action",15);var n=jae(),i=je(n);kt(i,{name:"Regexp",description:"The regexp to find replacements.",children:(u,c)=>{var f=Wae();Tt(f),_t(f,()=>r().regexp,m=>r(r().regexp=m,!0)),K(u,f)},$$slots:{default:!0}});var a=le(i,2);kt(a,{name:"Regexp flags",description:"The regexp flags for this regexp.",children:(u,c)=>{var f=Yae();Tt(f),_t(f,()=>r().regexpFlags,m=>r(r().regexpFlags=m,!0)),K(u,f)},$$slots:{default:!0}});var o=le(a,2);kt(o,{name:"Replacement text",description:"The text to replace the button with."});var s=le(o,2),l=ye(s);On(l),ce(s),_t(l,()=>r().replacement,u=>r(r().replacement=u,!0)),K(t,n),De()}var Zae=ue('<input type="number" placeholder="0">'),Jae=ue('<input type="number" placeholder="0">'),Xae=ue('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function RM(t,e){Te(e,!0);let r=ut(e,"action",15);var n=Xae(),i=je(n);kt(i,{name:"Line from",description:"The line that marks the start of the area to replace.",children:(u,c)=>{var f=Zae();Tt(f),_t(f,()=>r().fromLine,m=>r(r().fromLine=m,!0)),K(u,f)},$$slots:{default:!0}});var a=le(i,2);kt(a,{name:"Line to",description:"The line that marks the end of the area to replace.",children:(u,c)=>{var f=Jae();Tt(f),_t(f,()=>r().toLine,m=>r(r().toLine=m,!0)),K(u,f)},$$slots:{default:!0}});var o=le(a,2);kt(o,{name:"Replacement text",description:"The text to replace the note section."});var s=le(o,2),l=ye(s);On(l),ce(s),_t(l,()=>r().replacement,u=>r(r().replacement=u,!0)),K(t,n),De()}var Qae=ue('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function LM(t,e){Te(e,!0);let r=ut(e,"action",15);var n=Qae(),i=je(n);kt(i,{name:"Replacement text",description:"The text to replace the match with."});var a=le(i,2),o=ye(a);On(o),ce(a),_t(o,()=>r().replacement,s=>r(r().replacement=s,!0)),K(t,n),De()}var Kae=ue('<input type="number" placeholder="100 ms">');function VM(t,e){Te(e,!0);let r=ut(e,"action",15);kt(t,{name:"Sleep time",description:"The time to sleep in milliseconds.",children:(n,i)=>{var a=Kae();Tt(a),_t(a,()=>r().ms,o=>r(r().ms=o,!0)),K(n,a)},$$slots:{default:!0}}),De()}var eoe=ue('<input type="text" placeholder="some name">'),toe=ue("<!> <!> <!> <!> <!>",1);function UM(t,e){Te(e,!0);let r=ut(e,"action",15);function n(d){e.plugin.internal.openFileSelectModal(h=>{d.templateFile=h})}function i(d){e.plugin.internal.openFolderSelectModal(h=>{d.folderPath=h})}var a=toe(),o=je(a),s=Lt(()=>`Template file: ${(r().templateFile||"none")??""}`);kt(o,{get name(){return z(s)},description:"The template file to create a new note of.",children:(d,h)=>{bt(d,{get variant(){return"primary"},onclick:()=>n(r()),tooltip:"Select from vault",children:(x,b)=>{Et();var T=Wt("Change");K(x,T)},$$slots:{default:!0}})},$$slots:{default:!0}});var l=le(o,2),u=Lt(()=>`Folder: ${(r().folderPath||"none")??""}`);kt(l,{get name(){return z(u)},description:"The folder to create a new note in.",children:(d,h)=>{bt(d,{get variant(){return"primary"},onclick:()=>i(r()),tooltip:"Select from vault",children:(x,b)=>{Et();var T=Wt("Change");K(x,T)},$$slots:{default:!0}})},$$slots:{default:!0}});var c=le(l,2),f=Lt(()=>`File name: ${(r().fileName||"default")??""}`);kt(c,{get name(){return z(f)},description:"The file name of the new note.",children:(d,h)=>{var x=eoe();Tt(x),_t(x,()=>r().fileName,b=>r(r().fileName=b,!0)),K(d,x)},$$slots:{default:!0}});var m=le(c,2);kt(m,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(d,h)=>{Qa(d,{get checked(){return r().openNote},set checked(x){r(r().openNote=x,!0)}})},$$slots:{default:!0}});var p=le(m,2);kt(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)=>{Qa(d,{get checked(){return r().openIfAlreadyExists},set checked(x){r(r().openIfAlreadyExists=x,!0)}})},$$slots:{default:!0}}),K(t,a),De()}var roe=ue('<input type="text" placeholder="some value">'),noe=ue('<input type="text" placeholder="some value">'),ioe=ue("<!> <!> <!>",1);function qM(t,e){Te(e,!0);let r=ut(e,"action",15);var n=ioe(),i=je(n);kt(i,{name:"Metadata property",description:"The metadata property in form of a bind target.",children:(s,l)=>{var u=roe();Tt(u),_t(u,()=>r().bindTarget,c=>r(r().bindTarget=c,!0)),K(s,u)},$$slots:{default:!0}});var a=le(i,2);kt(a,{name:"Value",description:"The new value.",children:(s,l)=>{var u=noe();Tt(u),_t(u,()=>r().value,c=>r(r().value=c,!0)),K(s,u)},$$slots:{default:!0}});var o=le(a,2);kt(o,{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",children:(s,l)=>{Qa(s,{get checked(){return r().evaluate},set checked(u){r(r().evaluate=u,!0)}})},$$slots:{default:!0}}),K(t,n),De()}var aoe=ue("<div><!></div>");function uu(t,e){Te(e,!0);let r=ut(e,"reverse",3,!1),n=ut(e,"stretchChildren",3,!1),i=Lt(()=>[r()?"mb-flex-row-reverse":"mb-flex-row",n()?"mb-flex-row-stretch":""].join(" "));var a=aoe(),o=ye(a);go(o,()=>e.children),ce(a),Le(()=>xa(a,Ys(z(i)))),K(t,a),De()}var ooe=ue('<div class="modal-button-container"><!></div>');function Ka(t,e){Te(e,!0);var r=ooe(),n=ye(r);go(n,()=>e.children),ce(r),K(t,r),De()}var soe=ue('<input type="text">'),uoe=ue('<input type="text">'),loe=ue("<option> </option>"),coe=ue('<select class="dropdown"></select>'),foe=ue('<input type="text">'),poe=ue('<input type="text">'),moe=ue('<span style="word-break: break-word"> </span> <!> <!>',1),doe=ue('<input type="text">'),hoe=ue('<input type="text">'),goe=ue("<option> </option>"),voe=ue("<h5> </h5> <!>",1),yoe=ue("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1),xoe=ue("<!> <!>",1),boe=ue('<!> <!> <!> <!> <!> <!> <!> <!> <!> <h4>Actions</h4> Add action of type <select class="dropdown"></select> <!> <!> <h4>Preview</h4> <div></div> <!>',1);function zM(t,e){Te(e,!0);let r=Ve(e.buttonConfig),n,i,a=yt(Ve("command"));cf(()=>{i?.unmount()}),ga(()=>{i?.unmount(),n&&(pt.empty(n),i=new Iu(e.plugin,li(r),"","block",void 0,!1,!0),i.mount(n))});function o(){r.actions?.push(e.plugin.api.buttonActionRunner.createDefaultAction(z(a)))}function s(P){r.actions?.splice(P,1)}function l(P){return e.plugin.api.buttonActionRunner.getActionLabel(P)}function u(P,R){if(r.actions===void 0)return;let L=[];P>0&&L.push({name:"Move up",icon:"arrow-up",onclick:()=>{if(r.actions===void 0)return;let V=r.actions[P-1];r.actions[P-1]=r.actions[P],r.actions[P]=V}}),P<r.actions.length-1&&L.push({name:"Move down",icon:"arrow-down",onclick:()=>{if(r.actions===void 0)return;let V=r.actions[P+1];r.actions[P+1]=r.actions[P],r.actions[P]=V}}),L.push({name:"Remove",icon:"x",warning:!0,onclick:()=>s(P)}),e.plugin.internal.createContextMenu(L).showWithEvent(R)}function c(){e.plugin.internal.openImageFileSelectModal(P=>{r.backgroundImage=P})}function f(){r.backgroundImage=void 0}var m=boe(),p=je(m);kt(p,{name:"Label",description:"The label shown on the button.",children:(P,R)=>{var L=soe();Tt(L),_t(L,()=>r.label,V=>r.label=V),K(P,L)},$$slots:{default:!0}});var d=le(p,2);kt(d,{name:"Icon",description:"The icon shown on the button. If left empty, no icon will show",children:(P,R)=>{var L=uoe();Tt(L),_t(L,()=>r.icon,V=>r.icon=V),K(P,L)},$$slots:{default:!0}});var h=le(d,2);kt(h,{name:"Style",description:"The style variant of the button",children:(P,R)=>{var L=coe();Yt(L,21,()=>Object.values(rn),er,(V,k)=>{var B=loe(),W={},O=ye(B,!0);ce(B),Le(()=>{W!==(W=z(k))&&(B.value=(B.__value=z(k))==null?"":z(k)),xt(O,z(k))}),K(V,B)}),ce(L),lf(L,()=>r.style,V=>r.style=V),K(P,L)},$$slots:{default:!0}});var x=le(h,2);kt(x,{name:"CSS classes",description:"A list of CSS classes to add to the button. Multiple classes should be separated by a space.",children:(P,R)=>{var L=foe();Tt(L),_t(L,()=>r.class,V=>r.class=V),K(P,L)},$$slots:{default:!0}});var b=le(x,2);kt(b,{name:"CSS styles",description:"CSS styles to directly apply to the button.",children:(P,R)=>{var L=poe();Tt(L),_t(L,()=>r.cssStyle,V=>r.cssStyle=V),K(P,L)},$$slots:{default:!0}});var T=le(b,2);kt(T,{name:"Background image",description:"A background image to use in the button.",children:(P,R)=>{var L=moe(),V=je(L),k=ye(V,!0);ce(V);var B=le(V,2);bt(B,{get variant(){return"primary"},onclick:()=>c(),tooltip:"Select from vault",children:(O,Q)=>{Et();var ie=Wt("Change");K(O,ie)},$$slots:{default:!0}});var W=le(B,2);bt(W,{get variant(){return"default"},onclick:()=>f(),tooltip:"Reset to none",children:(O,Q)=>{Wr(O,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),Le(()=>xt(k,r.backgroundImage||"none")),K(P,L)},$$slots:{default:!0}});var v=le(T,2);kt(v,{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",children:(P,R)=>{var L=doe();Tt(L),_t(L,()=>r.tooltip,V=>r.tooltip=V),K(P,L)},$$slots:{default:!0}});var A=le(v,2);kt(A,{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",children:(P,R)=>{var L=hoe();Tt(L),_t(L,()=>r.id,V=>r.id=V),K(P,L)},$$slots:{default:!0}});var w=le(A,2);kt(w,{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",children:(P,R)=>{Qa(P,{get checked(){return r.hidden},set checked(L){r.hidden=L}})},$$slots:{default:!0}});var y=le(w,4);Yt(y,21,()=>Object.values(Kn),er,(P,R)=>{var L=goe(),V={},k=ye(L,!0);ce(L),Le(()=>{V!==(V=z(R))&&(L.value=(L.__value=z(R))==null?"":z(R)),xt(k,z(R))}),K(P,L)}),ce(y);var E=le(y,2);bt(E,{get variant(){return"primary"},onclick:()=>o(),children:(P,R)=>{Et();var L=Wt("Add Action");K(P,L)},$$slots:{default:!0}});var D=le(E,2);{var _=P=>{var R=Gr(),L=je(R);Yt(L,17,()=>r.actions??[],er,(V,k,B)=>{var W=yoe(),O=je(W);uu(O,{children:(Oe,j)=>{var he=voe(),me=je(he),Fe=ye(me,!0);Le(()=>xt(Fe,l(z(k).type))),ce(me);var ke=le(me,2);bt(ke,{get variant(){return"plain"},onclick:Ae=>u(B,Ae),children:(Ae,Xe)=>{Wr(Ae,{iconName:"more-vertical",get plugin(){return e.plugin}})},$$slots:{default:!0}}),K(Oe,he)},$$slots:{default:!0}});var Q=le(O,2);{var ie=Oe=>{CM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(Q,Oe=>{z(k).type==="command"&&Oe(ie)})}var X=le(Q,2);{var U=Oe=>{$M(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(X,Oe=>{z(k).type==="open"&&Oe(U)})}var pe=le(X,2);{var we=Oe=>{kM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(pe,Oe=>{z(k).type==="js"&&Oe(we)})}var se=le(pe,2);{var be=Oe=>{PM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(se,Oe=>{z(k).type==="input"&&Oe(be)})}var ee=le(se,2);{var Z=Oe=>{VM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(ee,Oe=>{z(k).type==="sleep"&&Oe(Z)})}var ne=le(ee,2);{var de=Oe=>{UM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(ne,Oe=>{z(k).type==="templaterCreateNote"&&Oe(de)})}var fe=le(ne,2);{var Se=Oe=>{qM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(fe,Oe=>{z(k).type==="updateMetadata"&&Oe(Se)})}var _e=le(fe,2);{var G=Oe=>{NM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(_e,Oe=>{z(k).type==="createNote"&&Oe(G)})}var J=le(_e,2);{var ge=Oe=>{FM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(J,Oe=>{z(k).type==="runTemplaterFile"&&Oe(ge)})}var xe=le(J,2);{var Ee=Oe=>{RM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(xe,Oe=>{z(k).type==="replaceInNote"&&Oe(Ee)})}var Be=le(xe,2);{var Ue=Oe=>{OM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(Be,Oe=>{z(k).type==="regexpReplaceInNote"&&Oe(Ue)})}var et=le(Be,2);{var St=Oe=>{LM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(et,Oe=>{z(k).type==="replaceSelf"&&Oe(St)})}var Ye=le(et,2);{var ur=Oe=>{BM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(Ye,Oe=>{z(k).type==="insertIntoNote"&&Oe(ur)})}var Jt=le(Ye,2);{var yr=Oe=>{IM(Oe,{get plugin(){return e.plugin},get action(){return r.actions[B]},set action(j){r.actions[B]=j}})};at(Jt,Oe=>{z(k).type==="inlineJS"&&Oe(yr)})}K(V,W)}),K(P,R)};at(D,P=>{r.actions&&P(_)})}var C=le(D,4);Uo(C,P=>n=P,()=>n);var N=le(C,2);Ka(N,{children:(P,R)=>{var L=xoe(),V=je(L);bt(V,{get variant(){return"primary"},onclick:()=>e.modal.okay(li(r)),children:(B,W)=>{Et();var O=Wt();Le(()=>xt(O,e.modal.options.submitText)),K(B,O)},$$slots:{default:!0}});var k=le(V,2);bt(k,{get variant(){return"default"},onclick:()=>e.modal.cancel(),children:(B,W)=>{Et();var O=Wt("Cancel");K(B,O)},$$slots:{default:!0}}),K(P,L)},$$slots:{default:!0}}),lf(y,()=>z(a),P=>$e(a,P)),K(t,m),De()}var Jy=class extends Xf{constructor(e,r){super(),this.plugin=e,this.options=r}onMount(e){pt.empty(e),this.component&&Pr(this.component),this.component=Ur(zM,{target:e,props:{plugin:this.plugin,modal:this,buttonConfig:this.options.config??this.plugin.api.buttonActionRunner.createDefaultButtonConfig()}})}onUnmount(e){pt.empty(e),this.component&&Pr(this.component)}okay(e){this.closeModal(),this.options.onOkay(e)}cancel(){this.closeModal()}};var woe=(t,e,r)=>r.onSelect(r.image),_oe=(t,e,r,n)=>e(t,n.image),Aoe=ue('<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 HM(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]);function n(u,c){u.key===" "&&e.onSelect(c)}var i=Aoe();i.__click=[woe,r,e],i.__keydown=[_oe,n,r,e];var a=ye(i);Le(()=>wt(a,"src",e.plugin.internal.imagePathToUri(e.image)));var o=le(a,2),s=ye(o),l=ye(s,!0);ce(s),ce(o),ce(i),Le(()=>{wt(a,"alt",e.image),xt(l,e.image)}),K(t,i),De()}Nt(["click","keydown"]);var Soe=ue("<!> <!>",1),Eoe=ue('<div class="mb-image-modal-header"><input type="text" placeholder="Search images..."></div> <div class="mb-image-card-grid"></div> <!>',1);function GM(t,e){Te(e,!0);let r=yt(""),n=e.plugin.internal.createFuzzySearch(),i=Lt(()=>z(r)?(n.setSearch(z(r)),n.filterItems(e.options,c=>c.value)):e.options);var a=Eoe(),o=je(a),s=ye(o);Tt(s),ce(o);var l=le(o,2);Yt(l,21,()=>z(i),er,(c,f)=>{HM(c,{get plugin(){return e.plugin},get image(){return z(f).value},get onSelect(){return e.onSelect}})}),ce(l);var u=le(l,2);Ka(u,{children:(c,f)=>{var m=Soe(),p=je(m);{var d=x=>{bt(x,{get variant(){return"primary"},onclick:()=>e.onSelect(void 0),children:(b,T)=>{Et();var v=Wt("Select none");K(b,v)},$$slots:{default:!0}})};at(p,x=>{e.canSelectNone&&x(d)})}var h=le(p,2);bt(h,{onclick:()=>e.onCancel(),children:(x,b)=>{Et();var T=Wt("Cancel");K(x,T)},$$slots:{default:!0}}),K(c,m)},$$slots:{default:!0}}),_t(s,()=>z(r),c=>$e(r,c)),K(t,a),De()}var oc=class extends Xf{constructor(e){super(),this.createComponent=e}onMount(e){pt.empty(e),this.component=this.createComponent(this,e)}onUnmount(e){this.component&&Pr(this.component),pt.empty(e)}};var Toe=ue("<textarea></textarea>"),Doe=ue('<input type="text">'),Moe=ue("<!> <!>",1),Coe=ue('<p> </p> <div class="mb-full-width-text-input"><!></div> <!>',1);function WM(t,e){Te(e,!0);let r=yt(Ve(e.options.value));var n=Coe(),i=je(n),a=ye(i,!0);ce(i);var o=le(i,2),s=ye(o);{var l=f=>{var m=Toe();On(m),_t(m,()=>z(r),p=>$e(r,p)),K(f,m)},u=f=>{var m=Doe();Tt(m),_t(m,()=>z(r),p=>$e(r,p)),K(f,m)};at(s,f=>{e.options.multiline?f(l):f(u,!1)})}ce(o);var c=le(o,2);Ka(c,{children:(f,m)=>{var p=Moe(),d=je(p);bt(d,{get variant(){return"primary"},onclick:()=>e.options.onSubmit(li(z(r))),children:(x,b)=>{Et();var T=Wt("OK");K(x,T)},$$slots:{default:!0}});var h=le(d,2);bt(h,{onclick:()=>e.options.onCancel(),children:(x,b)=>{Et();var T=Wt("Cancel");K(x,T)},$$slots:{default:!0}}),K(f,p)},$$slots:{default:!0}}),Le(()=>xt(a,e.options.subTitle)),K(t,n),De()}var ys=class{constructor(e,r){this.plugin=e,this.selectCallback=r}onSelected(e){this.selectCallback(e)}};var Xy=class extends ys{getItemText(e){return e.name}getItemDescription(e){}getItems(){return this.plugin.internal.getAllCommands()}};var Hm=class extends ys{constructor(e,r,n){super(e,r),this.filterFunction=n}getItemText(e){return e}getItemDescription(e){}getItems(){return this.filterFunction!==void 0?this.plugin.internal.file.getAllFiles().filter(e=>this.filterFunction(e)):this.plugin.internal.file.getAllFiles()}};var Qy=class extends ys{getItemText(e){return e}getItemDescription(e){}getItems(){return this.plugin.internal.file.getAllFolders()}};var Ky=class extends ys{constructor(e,r,n){super(e,r),this.ipf=n}getItemText(e){return e.displayValue}getItemDescription(e){return e.displayDescription}getItems(){return this.plugin.internal.getSuggesterOptions(this.ipf)}};var Noe=ue('<pre class="mb-pre"><code class="language-none mb-none"> </code></pre>'),Foe=ue("<tr><td>Tip</td><td> </td></tr>"),Ioe=ue("<a> </a><br>",1),Poe=ue("<tr><td>Docs</td><td></td></tr>"),Boe=ue('<tr><td>Context</td><td><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></td></tr>'),koe=ue('<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>'),$oe=ue('<div class="mb-card"><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></div>');function ex(t,e){Te(e,!0);var r=Gr(),n=je(r);{var i=o=>{var s=koe(),l=ye(s),u=ye(l),c=ye(u);Le(()=>xt(c,`${e.error.errorLevel??""}
[${e.error.getErrorType()??""}]`)),ce(u);var f=le(u);ce(l);var m=le(l,2);{var p=P=>{var R=Noe(),L=ye(R),V=ye(L,!0);ce(L),ce(R),Le(()=>xt(V,e.error.positionContext)),K(P,R)};at(m,P=>{e.error.positionContext&&P(p)})}var d=le(m,2),h=ye(d),x=ye(h),b=le(ye(x)),T=ye(b,!0);ce(b),ce(x);var v=le(x),A=le(ye(v)),w=ye(A,!0);ce(A),ce(v);var y=le(v);{var E=P=>{var R=Foe(),L=le(ye(R)),V=ye(L,!0);ce(L),ce(R),Le(()=>xt(V,e.error.tip)),K(P,R)};at(y,P=>{e.error.tip&&P(E)})}var D=le(y);{var _=P=>{var R=Poe(),L=le(ye(R));Yt(L,21,()=>e.error.docs,er,(V,k)=>{var B=Ioe(),W=je(B),O=ye(W,!0);ce(W),Et(),Le(()=>{wt(W,"href",z(k)),xt(O,z(k))}),K(V,B)}),ce(L),ce(R),K(P,R)};at(D,P=>{e.error.docs&&P(_)})}var C=le(D);{var N=P=>{var R=Boe(),L=le(ye(R)),V=ye(L),k=ye(V),B=ye(k,!0);Le(()=>xt(B,JSON.stringify(e.error.context,null,4))),ce(k),ce(V),ce(L),ce(R),K(P,R)};at(C,P=>{e.error.context&&P(N)})}ce(h),ce(d),ce(s),Le(()=>{xa(u,Ys(e.error.errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")),xt(f,` - ${e.error.effect??""}`),xt(T,e.error.cause),xt(w,e.error.effect)}),K(o,s)},a=o=>{var s=$oe(),l=ye(s),u=ye(l),c=ye(u,!0);ce(u),ce(l),ce(s),Le(()=>xt(c,e.error.stack)),K(o,s)};at(n,o=>{e.error instanceof Jn?o(i):o(a,!1)})}K(t,r),De()}var Ooe=ue("<p> </p>"),Roe=ue('<pre class="mb-pre"><code class="language-none meta-bind-none"> </code></pre>'),Loe=ue("<p> </p>"),Voe=ue("<h6>Errors</h6> <!> <!>",1),Uoe=ue("<p> </p>"),qoe=ue("<h6>Warnings</h6> <!> <!>",1),zoe=ue("<!> <!> <!> <!>",1);function lu(t,e){Te(e,!0);var r=zoe(),n=je(r);{var i=f=>{var m=Ooe(),p=ye(m,!0);ce(m),Le(()=>xt(p,e.settings.text)),K(f,m)};at(n,f=>{e.settings.text&&f(i)})}var a=le(n,2);{var o=f=>{var m=Roe(),p=ye(m),d=ye(p,!0);ce(p),ce(m),Le(()=>xt(d,e.settings.code)),K(f,m)};at(a,f=>{e.settings.code&&f(o)})}var s=le(a,2);{var l=f=>{var m=Voe(),p=le(je(m),2);{var d=x=>{var b=Loe(),T=ye(b,!0);ce(b),Le(()=>xt(T,e.settings.errorText)),K(x,b)};at(p,x=>{e.settings.errorText&&x(d)})}var h=le(p,2);Yt(h,17,()=>e.settings.errorCollection.getErrors(),er,(x,b)=>{ex(x,{get error(){return z(b)}})}),K(f,m)};at(s,f=>{e.settings.errorCollection.hasErrors()&&f(l)})}var u=le(s,2);{var c=f=>{var m=qoe(),p=le(je(m),2);{var d=x=>{var b=Uoe(),T=ye(b,!0);ce(b),Le(()=>xt(T,e.settings.warningText)),K(x,b)};at(p,x=>{e.settings.warningText&&x(d)})}var h=le(p,2);Yt(h,17,()=>e.settings.errorCollection.getWarnings(),er,(x,b)=>{ex(x,{get error(){return z(b)}})}),K(f,m)};at(u,f=>{e.settings.errorCollection.hasWarnings()&&f(c)})}K(t,r),De()}var Hoe=(t,e)=>e(),Goe=(t,e)=>{t.key===" "&&e()},Woe=ue('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" x2="12" y1="8" y2="12"></line><line x1="12" x2="12.01" y1="16" y2="16"></line></svg> <span class="mb-error">[META_BIND_ERROR]</span>',1),Yoe=qh('<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>'),joe=qh('<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>'),Zoe=ue('<div class="mb-error-collection" role="button" tabindex="0" aria-label="Click to view errors and warnings"><!></div>');function Qf(t,e){Te(e,!0);function r(){e.plugin.internal.openErrorCollectionViewModal(e.settings)}var n=Gr(),i=je(n);{var a=o=>{var s=Zoe();s.__click=[Hoe,r],s.__keydown=[Goe,r];var l=ye(s);{var u=f=>{var m=Woe();Et(2),K(f,m)},c=f=>{var m=Gr(),p=je(m);{var d=x=>{var b=Yoe();K(x,b)},h=x=>{var b=joe();K(x,b)};at(p,x=>{e.settings.errorCollection.hasWarnings()?x(d):x(h,!1)},!0)}K(f,m)};at(l,f=>{e.settings.errorCollection.hasErrors()?f(u):f(c,!1)})}ce(s),K(o,s)};at(i,o=>{e.settings.errorCollection.isEmpty()||o(a)})}K(t,n),De()}Nt(["click","keydown"]);var YM=["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"],Joe=YM.map(t=>`.${t}`),tx=class{constructor(e,r){this.plugin=e,this.file=r}openCommandSelectModal(e){this.createSearchModal(new Xy(this.plugin,e)).open()}openFileSelectModal(e){this.createSearchModal(new Hm(this.plugin,e)).open()}openFilteredFileSelectModal(e,r){this.createSearchModal(new Hm(this.plugin,e,r)).open()}openMarkdownFileSelectModal(e){this.openFilteredFileSelectModal(e,r=>r.endsWith(".md"))}openImageFileSelectModal(e){this.openFilteredFileSelectModal(e,r=>Joe.some(n=>r.endsWith(n)))}openFolderSelectModal(e){this.createSearchModal(new Qy(this.plugin,e)).open()}openButtonBuilderModal(e){this.createModal(new Jy(this.plugin,e),{title:"Meta Bind Button Builder"}).open()}openSuggesterModal(e,r){this.createSearchModal(new Ky(this.plugin,r,e)).open()}openImageSuggesterModal(e,r,n){this.createModal(new oc((i,a)=>Ur(GM,{target:a,props:{plugin:this.plugin,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){this.createModal(new oc((r,n)=>Ur(MM,{target:n,props:{selectedDate:e.getInternalValue(),dateChangeCallback:i=>{e.setInternalValue(i),r.closeModal()}}})),{title:"Meta Bind date picker"}).open()}openTextPromptModal(e){this.createModal(new oc((r,n)=>Ur(WM,{target:n,props:{options:{...e,onSubmit:i=>{e.onSubmit(i),r.closeModal()},onCancel:()=>{e.onCancel(),r.closeModal()}}}})),e).open()}openErrorCollectionViewModal(e){this.createModal(new oc((r,n)=>Ur(lu,{target:n,props:{settings:e}})),{title:"Meta Bind error overview",classes:["mb-error-collection-modal","markdown-rendered"]}).open()}createErrorIndicator(e,r){let n=Ur(Qf,{target:e,props:{plugin:this.plugin,settings:r}});return()=>{Pr(n)}}};var h9=require("obsidian"),rx=class{constructor(){}setSearch(e){this.preparedSearch=(0,h9.prepareFuzzySearch)(e)}filterItems(e,r){return this.preparedSearch?e.filter(n=>this.preparedSearch?.(r(n))?.score!=null):e}};var Ta=require("obsidian");var al=class{constructor(e,r,n){this.value=e,this.displayValue=r,this.displayDescription=n}valueAsString(){return this.value?.toString()??"null"}};function g9(t){let e=[];for(let r of t.children)r instanceof Ta.TFile&&v9(r.extension)&&e.push(new al(r.path,r.name)),r instanceof Ta.TFolder&&e.push(...g9(r));return e}function Xoe(t,e,r){let n=[];for(let i of e){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let s=new Hr({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 Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}let o;if(a===""||a==="."?o=r.app.vault.getRoot():o=r.app.vault.getAbstractFileByPath(a),o==null){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!(o instanceof Ta.TFolder)){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}n.push(...g9(o))}for(let i of t){let a=$o(i.value);if(!a){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}let o=r.app.vault.getAbstractFileByPath(a);if(!o){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!(o instanceof Ta.TFile)){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!v9(o.extension)){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}n.push(new al(o.path,o.name))}return n}function v9(t){return YM.contains(t)}function y9(t,e){let r=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery");return Xoe(r,n,t)}var x9=require("obsidian");var nx=class extends x9.Modal{constructor(e,r,n){super(e.app),this.content=r,r.setModal(this),this.options=n}onOpen(){this.options?.title&&this.titleEl.setText(this.options.title),this.options?.classes&&pt.addClasses(this.modalEl,this.options.classes),this.content.mount(this.contentEl)}onClose(){this.content.unmount()}};var Gm=require("obsidian"),ix=class extends Gm.FuzzySuggestModal{constructor(e,r){super(e.app),this.content=r}renderSuggestion(e,r){(0,Gm.renderResults)(r.createDiv(),this.content.getItemText(e.item),e.match);let n=this.content.getItemDescription(e.item);n&&(0,Gm.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 b9=require("obsidian");function Qoe(t,e,r,n,i){let a=[];for(let o of r)a.push(new al(o.value,o.name,"option"));if(n.length>0){let o;try{o=p9(t)}catch(l){return new b9.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=ve.object({name:ve.string().min(1),path:ve.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=i9(f.path,f.name,i);a.push(new al(m,f.name,`file: ${f.path}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function w9(t,e){let r=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery"),i=e.mountable.getArgument("useLinks");return Qoe(t,e.mountable.getFilePath(),r,n,i===void 0?"true":i.value)}var _9=require("obsidian"),ax=class{constructor(){this.menu=new _9.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)}};var sc=require("obsidian");var ox=class{constructor(e){this.plugin=e}isExcludedFromRendering(e){for(let r of this.plugin.settings.excludedFolders)if(e.startsWith(r))return!0;return!1}};var sx=class extends ox{constructor(e){super(e),this.app=e.app}async read(e){let r=this.app.vault.getAbstractFileByPath(e);if(!r||!(r instanceof sc.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){let a=this.app.vault.getAvailablePath((0,sc.normalizePath)(e+"/"+r),n),o=await this.app.vault.create(a,"");if(i){let s=this.app.workspace.getLeaf(!1);s&&await s.openFile(o,{state:{mode:"source"}})}return o.path}getAllFiles(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof sc.TFile).map(e=>e.path)}getAllFolders(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof sc.TFolder).map(e=>e.path)}open(e,r,n){this.app.workspace.openLinkText(e,r,n)}getPathByName(e,r=""){return this.app.metadataCache.getFirstLinkpathDest(e,r)?.path}};var Wm=require("obsidian");var ux=class{constructor(e,r,n,i,a){this.plugin=e,this.containerEl=r,this.code=i,this.hidden=a;let o=e.app.vault.getAbstractFileByPath(n);if(!(o instanceof Wm.TFile))throw new Error(`File not found: ${n}`);this.file=o,this.jsEngine=il(this.plugin),this.renderComponent=new Wm.Component}async evaluateCode(e){return this.jsEngine.internal.execute({code:this.code,context:{file:this.file,line:0,metadata:this.plugin.app.metadataCache.getFileCache(this.file)},container:this.containerEl,component:this.renderComponent,contextOverrides:e})}async evaluate(e){try{pt.empty(this.containerEl),pt.removeClass(this.containerEl,"mb-error"),this.renderComponent.unload(),this.renderComponent=new Wm.Component,this.renderComponent.load();let r=await this.evaluateCode(e),n=this.jsEngine.internal.createRenderer(this.containerEl,this.file.path,this.renderComponent);return this.hidden||await n.render(r.result),n.convertToSimpleObject(r.result)}catch(r){r instanceof Error&&(this.containerEl.innerText=r.message,pt.addClass(this.containerEl,"mb-error"));return}}unload(){this.renderComponent.unload()}};var lx=class extends tx{constructor(e){super(e,new sx(e)),this.app=e.app}getLifecycleHookValidator(){return ve.instanceof(Mn.Component)}getImageSuggesterOptions(e){return y9(this.plugin,e)}getSuggesterOptions(e){return w9(this.plugin,e)}async renderMarkdown(e,r,n){let i=new Mn.Component;return i.load(),await Mn.MarkdownRenderer.render(this.app,e,r,n,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return il(this.plugin),!0}catch{return!1}}async jsEngineRunFile(e,r,n,i){let a=il(this.plugin),o=this.app.vault.getAbstractFileByPath(r);if(!o||!(o instanceof Mn.TFile))throw new Error(`calling file not found: ${r}`);let s=this.app.metadataCache.getFileCache(o),l=new Mn.Component;return await a.internal.executeFile(e,{component:l,container:i,context:{metadata:s,file:o,line:0},contextOverrides:n}),()=>l.unload()}async jsEngineRunCode(e,r,n,i){let a=il(this.plugin),o=this.app.vault.getAbstractFileByPath(r);if(!o||!(o instanceof Mn.TFile))throw new Error(`calling file not found: ${r}`);let s=this.app.metadataCache.getFileCache(o),l=new Mn.Component;return await a.internal.execute({code:e,component:l,container:i,context:{metadata:s,file:o,line:0},contextOverrides:n}),()=>l.unload()}createJsRenderer(e,r,n,i){return new ux(this.plugin,e,r,n,i)}showNotice(e){new Mn.Notice(e)}parseYaml(e){return(0,Mn.parseYaml)(e)}stringifyYaml(e){return(0,Mn.stringifyYaml)(e)}setIcon(e,r){(0,Mn.setIcon)(e,r)}imagePathToUri(e){return this.app.vault.adapter.getResourcePath(e)}createModal(e,r){return new nx(this.plugin,e,r)}createSearchModal(e){return new ix(this.plugin,e)}getAllCommands(){return this.app.commands.listCommands().map(e=>({id:e.id,name:e.name}))}createFuzzySearch(){return new rx}createContextMenu(e){let r=new ax;return r.setItems(e),r}async evaluateTemplaterTemplate(e,r){let n=TM(this.plugin),i=this.app.vault.getAbstractFileByPath(e);if(!i||!(i instanceof Mn.TFile))throw new Error(`Template file not found: ${e}`);let a=this.app.vault.getAbstractFileByPath(r);if(!a||!(a instanceof Mn.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){let a=TM(this.plugin),o=this.app.vault.getAbstractFileByPath(e);if(!o||!(o instanceof Mn.TFile))throw new Error(`Template file not found: ${e}`);let s;if(r!==void 0){let u=this.app.vault.getAbstractFileByPath(r);if(!u||!(u instanceof Mn.TFolder))throw new Error(`Folder not found: ${r}`);s=u}return(await a.create_new_note_from_template(o,s,n,i??!0))?.path}};var jM=require("obsidian");var cx=class extends bc{constructor(e,r,n){super(r,n),this.plugin=e,this.plugin.registerEvent(this.plugin.app.metadataCache.on("changed",(i,a,o)=>{this.manager.onExternalUpdate(this,i.path,structuredClone(o.frontmatter)??{})}))}readExternal(e){let r=this.plugin.app.vault.getAbstractFileByPath(e);if(r==null||!(r instanceof jM.TFile))throw new Ht({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.plugin.app.metadataCache.getFileCache(r)?.frontmatter;return structuredClone(n)??{}}getDefaultCacheItem(e){let r=this.plugin.app.vault.getAbstractFileByPath(e);if(r==null||!(r instanceof jM.TFile))throw new Ht({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.plugin.app.metadataCache.getFileCache(r)?.frontmatter;return{data:structuredClone(n)??{},storagePath:e,file:r,...this.manager.getDefaultCacheItem()}}syncExternal(e){this.plugin.app.fileManager.processFrontMatter(e.file,r=>{Object.assign(r,e.data)})}};var Ym=class extends du{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 A9=require("obsidian");function ZM(t,e){Te(e,!0);let r=new ff(e.plugin,Fr(),"","block",e.declaration);Pu(t,{mountable:r}),De()}var Koe=ue('<div class="mb-card"><h3> </h3> <!> <!> <code> </code></div>');function JM(t,e){Te(e,!0);let r=e.plugin.api.createInlineFieldFromString(e.declaration.inputField,"",void 0,"block"),n=e.plugin.api.createInlineFieldFromString(e.declaration.declaration,"",void 0,"block");var i=Koe(),a=ye(i),o=ye(a,!0);ce(a);var s=le(a,2);Pu(s,{mountable:r});var l=le(s,2);Pu(l,{mountable:n});var u=le(l,2),c=ye(u,!0);ce(u),ce(i),Le(()=>{xt(o,e.declaration.title),xt(c,e.declaration.display)}),K(t,i),De()}var ese=ue("<h1>Meta Bind Playground</h1> <span><!> <!> <!></span>",1),tse=ue(`<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 XM(t,e){Te(e,!0);let r="INPUT[someInputFieldDeclaration]",n=Ve(new Qt("exampleWarningErrorCollection")),i="INPUT[someInputFieldDeclaration]",a=Ve(new Qt("exampleErrorErrorCollection"));r0(()=>{n.add(new up({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),a.add(new up({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"}))});var o=tse(),s=ye(o);uu(s,{children:(D,_)=>{var C=ese(),N=le(je(C),2),P=ye(N);bt(P,{get variant(){return"primary"},onclick:()=>{jt.open(jt.linkToHome())},children:(V,k)=>{Et();var B=Wt("Docs");K(V,B)},$$slots:{default:!0}});var R=le(P,2);bt(R,{onclick:()=>{jt.open(jt.linkToGithub())},children:(V,k)=>{Et();var B=Wt("GitHub");K(V,B)},$$slots:{default:!0}});var L=le(R,2);bt(L,{onclick:()=>{jt.open(jt.linkToIssues())},children:(V,k)=>{Et();var B=Wt("Report Issue");K(V,B)},$$slots:{default:!0}}),ce(N),K(D,C)},$$slots:{default:!0}});var l=le(s,6),u=le(ye(l));Le(()=>wt(u,"href",jt.linkToInputFields()));var c=le(u,2);Le(()=>wt(c,"href",jt.linkToViewFields()));var f=le(c,4),m=Lt(()=>({errorCollection:n,code:r}));Qf(f,{get plugin(){return e.plugin},get settings(){return z(m)}});var p=le(f,4),d=Lt(()=>({errorCollection:a,code:i}));Qf(p,{get plugin(){return e.plugin},get settings(){return z(d)}}),Et(3),ce(l);var h=le(l,10),x=le(ye(h),2);Le(()=>wt(x,"href",jt.linkToInputFields()));var b=le(x,2);Le(()=>wt(b,"href",jt.linkToViewFields())),Et(),ce(h);var T=le(h,6),v=ye(T);Le(()=>wt(v,"href",jt.linkToInputFields())),Et(),ce(T);var A=le(T,2);Yt(A,17,()=>mF(e.plugin),er,(D,_)=>{ZM(D,{get declaration(){return z(_)[1]},get plugin(){return e.plugin}})});var w=le(A,4),y=ye(w);Le(()=>wt(y,"href",jt.linkToViewFields())),Et(),ce(w);var E=le(w,2);Yt(E,17,()=>Object.values(ob),er,(D,_)=>{var C=Gr(),N=je(C);Yt(N,17,()=>z(_),er,(P,R)=>{JM(P,{get declaration(){return z(R)},get plugin(){return e.plugin}})}),K(D,C)}),ce(o),K(t,o),De()}var uc="mb-playground-view-type",fx=class extends A9.ItemView{constructor(e,r){super(e),this.plugin=r}getViewType(){return uc}getDisplayText(){return"Meta Bind playground"}async onOpen(){this.contentEl.empty(),this.component=Ur(XM,{target:this.contentEl,props:{plugin:this.plugin}})}async onClose(){this.component&&Pr(this.component)}};var hi=require("obsidian");var S9=require("obsidian");var Zm=require("obsidian");var jm=require("obsidian");var rse=ue("<span> </span> <!> <!> <!>",1),nse=ue('<div class="mb-card markdown-rendered"><!> <pre class="mb-pre"><code class="mb-none"> </code></pre></div>');function QM(t,e){Te(e,!0);let r=ut(e,"template",15);function n(){e.plugin.internal.openButtonBuilderModal({submitText:"Submit",config:li(r()),onOkay:c=>{r(c)}})}function i(){let c=(0,jm.stringifyYaml)(li(r()));navigator.clipboard.writeText(c),new jm.Notice("meta-bind | Copied to clipboard")}var a=nse(),o=ye(a);uu(o,{stretchChildren:!0,children:(c,f)=>{var m=rse(),p=je(m),d=ye(p,!0);ce(p);var h=le(p,2);bt(h,{onclick:()=>n(),get variant(){return"primary"},tooltip:"Edit",children:(T,v)=>{Wr(T,{get plugin(){return e.plugin},iconName:"pen-line"})},$$slots:{default:!0}});var x=le(h,2);bt(x,{onclick:()=>i(),get variant(){return"default"},tooltip:"Copy",children:(T,v)=>{Wr(T,{get plugin(){return e.plugin},iconName:"copy"})},$$slots:{default:!0}});var b=le(x,2);bt(b,{onclick:()=>e.onDelete(r()),get variant(){return"destructive"},tooltip:"Delete",children:(T,v)=>{Wr(T,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),Le(()=>xt(d,r().id)),K(c,m)},$$slots:{default:!0}});var s=le(o,2),l=ye(s),u=ye(l,!0);Le(()=>xt(u,(0,jm.stringifyYaml)(r()))),ce(l),ce(s),ce(a),K(t,a),De()}var ise=ue('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),ase=ue("<!> <!>",1),ose=ue("<div><h2>Meta Bind Button Templates</h2> <!> <!> <!> <!> <!></div>");function KM(t,e){Te(e,!0);let r=yt(void 0),n=yt(Ve(e.buttonConfigs));function i(x){$e(n,Ve(z(n).filter(b=>b!==x)))}function a(){z(n).push(e.modal.plugin.api.buttonActionRunner.createDefaultButtonConfig())}async function o(){let x;try{x=(0,Zm.parseYaml)(await navigator.clipboard.readText())}catch(T){console.warn(T),new Zm.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}let b=Vc.safeParse(x);if(!b.success){let T=dy(b.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});console.warn(new Ns({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:T.message,docs:[jt.linkToButtonConfig()]})),console.warn(T),new Zm.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}z(n).push(x)}function s(){$e(r,Ve(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function l(){e.modal.close()}var u=ose(),c=le(ye(u),2);Yt(c,17,()=>z(n),er,(x,b,T)=>{QM(x,{get plugin(){return e.modal.plugin},onDelete:i,get template(){return z(n)[T]},set template(v){z(n)[T]=v}})});var f=le(c,2);bt(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create new template",children:(x,b)=>{Et();var T=Wt("Add Template");K(x,T)},$$slots:{default:!0}});var m=le(f,2);bt(m,{onclick:()=>o(),get variant(){return"default"},tooltip:"Create new template from YAML in clipboard",children:(x,b)=>{Et();var T=Wt("Add Template from Clipboard");K(x,T)},$$slots:{default:!0}});var p=le(m,2);{var d=x=>{var b=ise(),T=le(ye(b),2),v=Lt(()=>({errorCollection:z(r)}));lu(T,{get settings(){return z(v)}}),ce(b),K(x,b)};at(p,x=>{z(r)&&x(d)})}var h=le(p,2);Ka(h,{children:(x,b)=>{var T=ase(),v=je(T);bt(v,{onclick:()=>s(),get variant(){return"primary"},tooltip:"Save changes",children:(w,y)=>{Et();var E=Wt("Save");K(w,E)},$$slots:{default:!0}});var A=le(v,2);bt(A,{onclick:()=>l(),tooltip:"Revert changes",children:(w,y)=>{Et();var E=Wt("Cancel");K(w,E)},$$slots:{default:!0}}),K(x,T)},$$slots:{default:!0}}),ce(u),K(t,u),De()}var px=class extends S9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Pr(this.component),this.component=Ur(KM,{target:this.contentEl,props:{buttonConfigs:JN(this.plugin.settings.buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Pr(this.component)}save(e){let r=this.plugin.api.buttonManager.setButtonTemplates(e);if(r.hasErrors())return r;this.plugin.settings.buttonTemplates=e,this.plugin.saveSettings()}};var E9=require("obsidian");var sse=ue('<tr><td class="mb-excluded-folders-table-input-cell"><input type="text" placeholder="path/to/folder"></td><td><!></td></tr>'),use=ue('<div><h3 class="mod-error">Some folder paths are invalid</h3> <!></div>'),lse=ue("<!> <!>",1),cse=ue('<div><table class="mb-excluded-folders-table"><thead><tr><th>Folder Path</th><th></th></tr></thead><tbody></tbody></table> <!> <!> <!></div>');function eC(t,e){Te(e,!0);let r=yt(void 0),n=yt(Ve(e.excludedFolders));function i(h){$e(n,Ve(z(n).filter(x=>x!==h)))}function a(){z(n).push("")}function o(){$e(r,Ve(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=cse(),u=ye(l),c=le(ye(u));Yt(c,21,()=>z(n),er,(h,x,b)=>{var T=sse(),v=ye(T),A=ye(v);Tt(A),ce(v);var w=le(v),y=ye(w);bt(y,{onclick:()=>i(z(x)),tooltip:"Delete",children:(E,D)=>{Wr(E,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),ce(w),ce(T),_t(A,()=>z(n)[b],E=>z(n)[b]=E),K(h,T)}),ce(c),ce(u);var f=le(u,2);bt(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Add new excluded folder",children:(h,x)=>{Et();var b=Wt("Add folder");K(h,b)},$$slots:{default:!0}});var m=le(f,2);{var p=h=>{var x=use(),b=le(ye(x),2),T=Lt(()=>({errorCollection:z(r)}));lu(b,{get settings(){return z(T)}}),ce(x),K(h,x)};at(m,h=>{z(r)&&h(p)})}var d=le(m,2);Ka(d,{children:(h,x)=>{var b=lse(),T=je(b);bt(T,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save changes",children:(A,w)=>{Et();var y=Wt("Save");K(A,y)},$$slots:{default:!0}});var v=le(T,2);bt(v,{onclick:()=>s(),tooltip:"Revert changes",children:(A,w)=>{Et();var y=Wt("Cancel");K(A,y)},$$slots:{default:!0}}),K(h,b)},$$slots:{default:!0}}),ce(l),K(t,l),De()}var mx=class extends E9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Pr(this.component),this.component=Ur(eC,{target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this,plugin:this.plugin}})}onClose(){this.contentEl.empty(),this.component&&Pr(this.component)}save(e){for(let r of e)if(r===""){let n=new Qt("Excluded folders");return n.add(new Error(`Invalid Folder Path '${r}'. Folder path may not be empty.`)),n}this.plugin.settings.excludedFolders=e,this.plugin.saveSettings()}};var T9=require("obsidian");var fse=ue('<input type="text" placeholder="template-name"> <!>',1),pse=ue('<div class="mb-card"><!> <textarea placeholder="INPUT[slider(addLabels)]" class="mb-textarea"></textarea></div>');function tC(t,e){Te(e,!0);let r=ut(e,"template",15);var n=pse(),i=ye(n);uu(i,{children:(o,s)=>{var l=fse(),u=je(l);Tt(u);var c=le(u,2);bt(c,{onclick:()=>e.onDelete(r()),get variant(){return"destructive"},tooltip:"Delete Template",children:(f,m)=>{Wr(f,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),_t(u,()=>r().name,f=>r(r().name=f,!0)),K(o,l)},$$slots:{default:!0}});var a=le(i,2);On(a),ce(n),_t(a,()=>r().declaration,o=>r(r().declaration=o,!0)),K(t,n),De()}var mse=ue('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),dse=ue("<!> <!>",1),hse=ue("<div><h2>Meta Bind Input Field Templates</h2> <!> <!> <!> <!></div>");function rC(t,e){Te(e,!0);let r=yt(void 0),n=yt(Ve(e.inputFieldTemplates));function i(d){$e(n,Ve(z(n).filter(h=>h!==d)))}function a(){z(n).push({name:"",declaration:""})}function o(){$e(r,Ve(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=hse(),u=le(ye(l),2);Yt(u,17,()=>z(n),er,(d,h)=>{tC(d,{get plugin(){return e.modal.plugin},get template(){return z(h)},onDelete:i})});var c=le(u,2);bt(c,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create New Template",children:(d,h)=>{Et();var x=Wt("Add Template");K(d,x)},$$slots:{default:!0}});var f=le(c,2);{var m=d=>{var h=mse(),x=le(ye(h),2),b=Lt(()=>({errorCollection:z(r)}));lu(x,{get settings(){return z(b)}}),ce(h),K(d,h)};at(f,d=>{z(r)&&d(m)})}var p=le(f,2);Ka(p,{children:(d,h)=>{var x=dse(),b=je(x);bt(b,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save Changes",children:(v,A)=>{Et();var w=Wt("Save");K(v,w)},$$slots:{default:!0}});var T=le(b,2);bt(T,{onclick:()=>s(),tooltip:"Revert Changes",children:(v,A)=>{Et();var w=Wt("Cancel");K(v,w)},$$slots:{default:!0}}),K(d,x)},$$slots:{default:!0}}),ce(l),K(t,l),De()}var dx=class extends T9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Pr(this.component),this.component=Ur(rC,{target:this.contentEl,props:{inputFieldTemplates:JSON.parse(JSON.stringify(this.plugin.settings.inputFieldTemplates)),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Pr(this.component)}save(e){let r=this.plugin.api.inputFieldParser.parseTemplates(e);if(r.hasErrors())return r;this.plugin.settings.inputFieldTemplates=e,this.plugin.saveSettings()}};var hx=class extends hi.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}display(){let{containerEl:e}=this;if(e.empty(),this.plugin.build==="dev"||this.plugin.build==="canary"){e.createEl("p",{text:`You are using a ${this.plugin.build} build (${this.plugin.manifest.version}). This build is not intended for production use. Use at your own risk.`,cls:"mb-error"});let r=new hi.ButtonComponent(e);r.setButtonText("Learn About Canary Builds"),r.setCta(),r.onClick(()=>{jt.open(jt.linkToCanaryBuilds())})}new hi.Setting(e).setName("Quick access").addButton(r=>{r.setCta(),r.setButtonText("Docs"),r.onClick(()=>{jt.open(jt.linkToHome())})}).addButton(r=>{r.setButtonText("Open FAQ"),r.onClick(()=>{this.plugin.activateView(uc)})}).addButton(r=>{r.setButtonText("GitHub"),r.onClick(()=>{jt.open(jt.linkToGithub())})}).addButton(r=>{r.setButtonText("Report issue"),r.onClick(()=>{jt.open(jt.linkToIssues())})}),new hi.Setting(e).setName("Enable syntax highlighting").setDesc("Enable syntax highlighting for meta bind syntax. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.plugin.settings.enableSyntaxHighlighting),r.onChange(n=>{this.plugin.settings.enableSyntaxHighlighting=n,this.plugin.saveSettings()})}),new hi.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.plugin.settings.enableEditorRightClickMenu),r.onChange(n=>{this.plugin.settings.enableEditorRightClickMenu=n,this.plugin.saveSettings()})}),new hi.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 dx(this.app,this.plugin).open()})}),new hi.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 px(this.app,this.plugin).open()})}),new hi.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 mx(this.app,this.plugin).open()})}),new hi.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.plugin.settings.viewFieldDisplayNullAsEmpty),r.onChange(n=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=n,this.plugin.saveSettings()})}),new hi.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.plugin.settings.enableJs),r.onChange(n=>{this.plugin.settings.enableJs=n,this.plugin.saveSettings()})}),e.createEl("h2",{text:"Date and time settings"}),new hi.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.plugin.settings.preferredDateFormat),r.onChange(n=>{this.plugin.settings.preferredDateFormat=n,this.plugin.saveSettings()})}),new hi.Setting(e).setName("First weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(r=>{for(let n of pl)r.addOption(n.name,n.name);r.setValue(this.plugin.settings.firstWeekday.name),r.onChange(n=>{this.plugin.settings.firstWeekday=pl.find(i=>i.name===n),this.plugin.saveSettings()})}),e.createEl("h2",{text:"Advanced settings"}),new hi.Setting(e).setName("Dev mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(r=>{r.setValue(this.plugin.settings.devMode),r.onChange(n=>{this.plugin.settings.devMode=n,this.plugin.saveSettings()})}),new hi.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.plugin.settings.ignoreCodeBlockRestrictions),r.onChange(n=>{this.plugin.settings.ignoreCodeBlockRestrictions=n,this.plugin.saveSettings()})}),new hi.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: ${Bo.syncInterval}; Minimum: ${Bo.minSyncInterval}; Maximum: ${Bo.maxSyncInterval}`).addText(r=>{r.setValue(this.plugin.settings.syncInterval.toString()),r.onChange(n=>{this.plugin.settings.syncInterval=Number.parseInt(n),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=Bo.syncInterval),this.plugin.settings.syncInterval<Bo.minSyncInterval&&(this.plugin.settings.syncInterval=Bo.minSyncInterval),this.plugin.settings.syncInterval>Bo.maxSyncInterval&&(this.plugin.settings.syncInterval=Bo.maxSyncInterval),this.plugin.saveSettings()})})}};var nC=(n=>(n.DEV="dev",n.CANARY="canary",n.RELEASE="release",n))(nC||{}),gx=class extends xs.Plugin{async onload(){console.log("meta-bind | Main >> loading"),console.time("meta-bind | Main >> load-time"),this.build=this.determineBuild(),await this.loadSettings(),this.addSettingTab(new hx(this.app,this)),this.dependencyManager=new Vd(this,[{name:"Dataview",pluginId:"dataview",minVersion:new Na(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new Na(0,1,0)},{name:"Templater",pluginId:"templater-obsidian",minVersion:new Na(2,2,3)}]),!this.dependencyManager.checkDependenciesOnStartup()&&(this.api=new jy(this),this.internal=new lx(this),this.mountableManager=new Md,this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(fF(this)),this.addCommands(),lF(this),this.registerView(uc,e=>new fx(e,this)),this.addStatusBarBuildIndicator(),this.settings.enableEditorRightClickMenu&&this.registerEvent(this.app.workspace.on("editor-menu",(e,r)=>{vF(e,r,this)})),console.timeEnd("meta-bind | Main >> load-time"))}onunload(){console.log("meta-bind | Main >> unload"),this.mountableManager.unload()}determineBuild(){return this.manifest.version.includes("canary")?"canary":"release"}setUpMetadataManager(){this.metadataManager=new Dd,this.metadataManager.registerSource(new cx(this,"frontmatter",this.metadataManager)),this.metadataManager.registerSource(new pd("memory",this.metadataManager)),this.metadataManager.registerSource(new md("globalMemory",this.metadataManager)),this.metadataManager.registerSource(new dd("scope",this.metadataManager)),this.metadataManager.setDefaultSource("frontmatter"),this.registerEvent(this.app.vault.on("rename",(e,r)=>{this.mountableManager.unloadFile(r),this.metadataManager.onStoragePathRenamed(r,e.path)})),this.registerEvent(this.app.vault.on("delete",e=>{this.mountableManager.unloadFile(e.path),this.metadataManager.onStoragePathDeleted(e.path)})),this.registerInterval(window.setInterval(()=>this.metadataManager.cycle(),this.settings.syncInterval))}addPostProcessors(){this.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.registerMarkdownCodeBlockProcessor("meta-bind",async(e,r,n)=>{await(0,xs.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 Ym(n,r));this.api.wrapInMDRC(l,i,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",async(e,r,n)=>{await(0,xs.loadPrism)();let i=this.api.createJsViewFieldMountable(n.sourcePath,{declaration:e});this.api.wrapInMDRC(i,r,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",async(e,r,n)=>{await(0,xs.loadPrism)();let i=this.api.createEmbedMountable(n.sourcePath,{content:e,depth:0});this.api.wrapInMDRC(i,r,n)});for(let e=1;e<=cd;e++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,async(r,n,i)=>{await(0,xs.loadPrism)();let a=this.api.createEmbedMountable(i.sourcePath,{content:r,depth:e});this.api.wrapInMDRC(a,n,i)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",async(e,r,n)=>{await(0,xs.loadPrism)();let i=this.api.createButtonMountable(n.sourcePath,{declaration:e,isPreview:!1,position:new Ym(n,r)});this.api.wrapInMDRC(i,r,n)})}addCommands(){this.addCommand({id:"open-docs",name:"Open docs",callback:()=>{window.open("https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/","_blank")}}),this.addCommand({id:"open-playground",name:"Open playground",callback:()=>{this.activateView(uc)}}),this.addCommand({id:"open-help",name:"Open Help",callback:()=>{this.activateView(uc)}}),this.addCommand({id:"open-button-builder",name:"Open button builder",callback:()=>{this.internal.openButtonBuilderModal({onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,xs.stringifyYaml)(e)}
\`\`\``)},submitText:"Copy to Clipboard"})}}),this.addCommand({id:"copy-command-id",name:"Select and copy command id",callback:()=>{this.internal.openCommandSelectModal(e=>{window.navigator.clipboard.writeText(e.id)})}})}addStatusBarBuildIndicator(){if(this.build==="dev"){let e=this.addStatusBarItem();e.setText("Meta Bind Dev Build"),e.addClass("mb-error"),this.register(()=>e.remove())}if(this.build==="canary"){let e=this.addStatusBarItem();e.setText(`Meta Bind Canary Build (${this.manifest.version})`),e.addClass("mb-error"),this.register(()=>e.remove())}}loadTemplates(){if(!this.api)return;let e=this.api.inputFieldParser.parseTemplates(this.settings.inputFieldTemplates);e.hasErrors()&&console.warn("meta-bind | failed to parse input field templates",e);let r=this.api.buttonManager.setButtonTemplates(this.settings.buttonTemplates);r.hasErrors()&&console.warn("meta-bind | failed to parse button templates",r)}async loadSettings(){console.log("meta-bind | Main >> loading settings");let e=await this.loadData()??{};typeof e=="object"&&e!=null&&(delete e.inputTemplates,delete e.useUsDateInputOrder),this.settings=Object.assign({},Bo,e),this.updateInternalSettings(),yd(e,this.settings)||await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),this.updateInternalSettings(),await this.saveData(this.settings)}updateInternalSettings(){oi.dateFormat=this.settings.preferredDateFormat,tF(this.settings.firstWeekday),this.loadTemplates()}async onExternalSettingsChange(){await this.loadSettings()}async activateView(e){let{workspace:r}=this.app,n,i=r.getLeavesOfType(e);i.length>0?n=i[0]:(n=r.getLeaf("tab"),await n.setViewState({type:e,active:!0})),r.revealLeaf(n)}};
/*! Bundled license information:
moment/moment.js:
(*! moment.js *)
(*! version : 2.30.1 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
decimal.js/decimal.mjs:
(*!
* decimal.js v10.4.3
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
* MIT Licence
*)
*/
/* nosourcemap */