/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Time: Tue, 29 Oct 2024 17:53:39 GMT
Version: 1.2.5
-------------------------------------------
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) 2024 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 G7=Object.create;var km=Object.defineProperty;var W7=Object.getOwnPropertyDescriptor;var Y7=Object.getOwnPropertyNames;var j7=Object.getPrototypeOf,Z7=Object.prototype.hasOwnProperty;var zn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),J7=(r,e)=>{for(var t in e)km(r,t,{get:e[t],enumerable:!0})},zD=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Y7(e))!Z7.call(r,i)&&i!==t&&km(r,i,{get:()=>e[i],enumerable:!(n=W7(e,i))||n.enumerable});return r};var Or=(r,e,t)=>(t=r!=null?G7(j7(r)):{},zD(e||!r||!r.__esModule?km(t,"default",{value:r,enumerable:!0}):t,r)),X7=r=>zD(km({},"__esModule",{value:!0}),r);var zf=zn((Zy,ac)=>{(function(r,e){typeof Zy=="object"&&typeof ac<"u"?ac.exports=e():typeof define=="function"&&define.amd?define(e):r.moment=e()})(Zy,function(){"use strict";var r;function e(){return r.apply(null,arguments)}function t(g){r=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,E){return Object.prototype.hasOwnProperty.call(g,E)}function o(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var E;for(E in g)if(a(g,E))return!1;return!0}function u(g){return g===void 0}function c(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function s(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function l(g,E){var I=[],$,H=g.length;for($=0;$<H;++$)I.push(E(g[$],$));return I}function f(g,E){for(var I in E)a(E,I)&&(g[I]=E[I]);return a(E,"toString")&&(g.toString=E.toString),a(E,"valueOf")&&(g.valueOf=E.valueOf),g}function p(g,E,I,$){return bD(g,E,I,$,!0).utc()}function m(){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=m()),g._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(g){var E=Object(this),I=E.length>>>0,$;for($=0;$<I;$++)if($ in E&&g.call(this,E[$],$,E))return!0;return!1};function x(g){var E=null,I=!1,$=g._d&&!isNaN(g._d.getTime());if($&&(E=d(g),I=h.call(E.parsedDateParts,function(H){return H!=null}),$=E.overflow<0&&!E.empty&&!E.invalidEra&&!E.invalidMonth&&!E.invalidWeekday&&!E.weekdayMismatch&&!E.nullInput&&!E.invalidFormat&&!E.userInvalidated&&(!E.meridiem||E.meridiem&&I),g._strict&&($=$&&E.charsLeftOver===0&&E.unusedTokens.length===0&&E.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(g))g._isValid=$;else return $;return g._isValid}function b(g){var E=p(NaN);return g!=null?f(d(E),g):d(E).userInvalidated=!0,E}var T=e.momentProperties=[],v=!1;function S(g,E){var I,$,H,ie=T.length;if(u(E._isAMomentObject)||(g._isAMomentObject=E._isAMomentObject),u(E._i)||(g._i=E._i),u(E._f)||(g._f=E._f),u(E._l)||(g._l=E._l),u(E._strict)||(g._strict=E._strict),u(E._tzm)||(g._tzm=E._tzm),u(E._isUTC)||(g._isUTC=E._isUTC),u(E._offset)||(g._offset=E._offset),u(E._pf)||(g._pf=d(E)),u(E._locale)||(g._locale=E._locale),ie>0)for(I=0;I<ie;I++)$=T[I],H=E[$],u(H)||(g[$]=H);return g}function _(g){S(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 _||g!=null&&g._isAMomentObject!=null}function A(g){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+g)}function M(g,E){var I=!0;return f(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,g),I){var $=[],H,ie,Me,mt=arguments.length;for(ie=0;ie<mt;ie++){if(H="",typeof arguments[ie]=="object"){H+=`
[`+ie+"] ";for(Me in arguments[0])a(arguments[0],Me)&&(H+=Me+": "+arguments[0][Me]+", ");H=H.slice(0,-2)}else H=arguments[ie];$.push(H)}A(g+`
Arguments: `+Array.prototype.slice.call($).join("")+`
`+new Error().stack),I=!1}return E.apply(this,arguments)},E)}var w={};function D(g,E){e.deprecationHandler!=null&&e.deprecationHandler(g,E),w[g]||(A(E),w[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 B(g){var E,I;for(I in g)a(g,I)&&(E=g[I],N(E)?this[I]=E:this["_"+I]=E);this._config=g,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function R(g,E){var I=f({},g),$;for($ in E)a(E,$)&&(i(g[$])&&i(E[$])?(I[$]={},f(I[$],g[$]),f(I[$],E[$])):E[$]!=null?I[$]=E[$]:delete I[$]);for($ in g)a(g,$)&&!a(E,$)&&i(g[$])&&(I[$]=f({},I[$]));return I}function z(g){g!=null&&this.set(g)}var V;Object.keys?V=Object.keys:V=function(g){var E,I=[];for(E in g)a(g,E)&&I.push(E);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 P(g,E,I){var $=this._calendar[g]||this._calendar.sameElse;return N($)?$.call(E,I):$}function W(g,E,I){var $=""+Math.abs(g),H=E-$.length,ie=g>=0;return(ie?I?"+":"":"-")+Math.pow(10,Math.max(0,H)).toString().substr(1)+$}var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,X=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ne={},Z={};function L(g,E,I,$){var H=$;typeof $=="string"&&(H=function(){return this[$]()}),g&&(Z[g]=H),E&&(Z[E[0]]=function(){return W(H.apply(this,arguments),E[1],E[2])}),I&&(Z[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 me(g){var E=g.match(O),I,$;for(I=0,$=E.length;I<$;I++)Z[E[I]]?E[I]=Z[E[I]]:E[I]=pe(E[I]);return function(H){var ie="",Me;for(Me=0;Me<$;Me++)ie+=N(E[Me])?E[Me].call(H,g):E[Me];return ie}}function oe(g,E){return g.isValid()?(E=ve(E,g.localeData()),ne[E]=ne[E]||me(E),ne[E](g)):g.localeData().invalidDate()}function ve(g,E){var I=5;function $(H){return E.longDateFormat(H)||H}for(X.lastIndex=0;I>=0&&X.test(g);)g=g.replace(X,$),X.lastIndex=0,I-=1;return g}var _e={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 ye(g){var E=this._longDateFormat[g],I=this._longDateFormat[g.toUpperCase()];return E||!I?E:(this._longDateFormat[g]=I.match(O).map(function($){return $==="MMMM"||$==="MM"||$==="DD"||$==="dddd"?$.slice(1):$}).join(""),this._longDateFormat[g])}var be="Invalid date";function we(){return this._invalidDate}var Ee="%d",ze=/\d{1,2}/;function Qe(g){return this._ordinal.replace("%d",g)}var Y={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 Q(g,E,I,$){var H=this._relativeTime[I];return N(H)?H(g,E,I,$):H.replace(/%d/i,g)}function xe(g,E){var I=this._relativeTime[g>0?"future":"past"];return N(I)?I(E):I.replace(/%s/i,E)}var J={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 re(g){return typeof g=="string"?J[g]||J[g.toLowerCase()]:void 0}function se(g){var E={},I,$;for($ in g)a(g,$)&&(I=re($),I&&(E[I]=g[$]));return E}var Ae={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 Te(g){var E=[],I;for(I in g)a(g,I)&&E.push({unit:I,priority:Ae[I]});return E.sort(function($,H){return $.priority-H.priority}),E}var qe=/\d/,Se=/\d\d/,wt=/\d{3}/,Dt=/\d{4}/,jt=/[+-]?\d{6}/,Tt=/\d\d?/,j=/\d\d\d\d?/,le=/\d\d\d\d\d\d?/,fe=/\d{1,3}/,Pe=/\d{1,4}/,ke=/[+-]?\d{1,6}/,Fe=/\d+/,$e=/[+-]?\d+/,He=/Z|[+-]\d\d:?\d\d/gi,F=/Z|[+-]\d\d(?::?\d\d)?/gi,G=/[+-]?\d+(\.\d{1,3})?/,ge=/[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,Ne=/^[1-9]\d?/,ot=/^([1-9]\d|\d)/,yt;yt={};function Re(g,E,I){yt[g]=N(E)?E:function($,H){return $&&I?I:E}}function Xn(g,E){return a(yt,g)?yt[g](E._strict,E._locale):new RegExp(Bi(g))}function Bi(g){return nn(g.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(E,I,$,H,ie){return I||$||H||ie}))}function nn(g){return g.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Un(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function mr(g){var E=+g,I=0;return E!==0&&isFinite(E)&&(I=Un(E)),I}var Js={};function Br(g,E){var I,$=E,H;for(typeof g=="string"&&(g=[g]),c(E)&&($=function(ie,Me){Me[E]=mr(ie)}),H=g.length,I=0;I<H;I++)Js[g[I]]=$}function Yi(g,E){Br(g,function(I,$,H,ie){H._w=H._w||{},E(I,H._w,H,ie)})}function Ra(g,E,I){E!=null&&a(Js,g)&&Js[g](E,I._a,I,g)}function ga(g){return g%4===0&&g%100!==0||g%400===0}var Dn=0,qn=1,ji=2,fn=3,Qn=4,Cn=5,Zi=6,Ff=7,Wl=8;L("Y",0,0,function(){var g=this.year();return g<=9999?W(g,4):"+"+g}),L(0,["YY",2],0,function(){return this.year()%100}),L(0,["YYYY",4],0,"year"),L(0,["YYYYY",5],0,"year"),L(0,["YYYYYY",6,!0],0,"year"),Re("Y",$e),Re("YY",Tt,Se),Re("YYYY",Pe,Dt),Re("YYYYY",ke,jt),Re("YYYYYY",ke,jt),Br(["YYYYY","YYYYYY"],Dn),Br("YYYY",function(g,E){E[Dn]=g.length===2?e.parseTwoDigitYear(g):mr(g)}),Br("YY",function(g,E){E[Dn]=e.parseTwoDigitYear(g)}),Br("Y",function(g,E){E[Dn]=parseInt(g,10)});function ss(g){return ga(g)?366:365}e.parseTwoDigitYear=function(g){return mr(g)+(mr(g)>68?1900:2e3)};var us=Lo("FullYear",!0);function Yl(){return ga(this.year())}function Lo(g,E){return function(I){return I!=null?(jl(this,g,I),e.updateOffset(this,E),this):vo(this,g)}}function vo(g,E){if(!g.isValid())return NaN;var I=g._d,$=g._isUTC;switch(E){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 jl(g,E,I){var $,H,ie,Me,mt;if(!(!g.isValid()||isNaN(I))){switch($=g._d,H=g._isUTC,E){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}ie=I,Me=g.month(),mt=g.date(),mt=mt===29&&Me===1&&!ga(ie)?28:mt,H?$.setUTCFullYear(ie,Me,mt):$.setFullYear(ie,Me,mt)}}function Zl(g){return g=re(g),N(this[g])?this[g]():this}function If(g,E){if(typeof g=="object"){g=se(g);var I=Te(g),$,H=I.length;for($=0;$<H;$++)this[I[$].unit](g[I[$].unit])}else if(g=re(g),N(this[g]))return this[g](E);return this}function Pf(g,E){return(g%E+E)%E}var an;Array.prototype.indexOf?an=Array.prototype.indexOf:an=function(g){var E;for(E=0;E<this.length;++E)if(this[E]===g)return E;return-1};function q(g,E){if(isNaN(g)||isNaN(E))return NaN;var I=Pf(E,12);return g+=(E-I)/12,I===1?ga(g)?29:28:31-I%7%2}L("M",["MM",2],"Mo",function(){return this.month()+1}),L("MMM",0,0,function(g){return this.localeData().monthsShort(this,g)}),L("MMMM",0,0,function(g){return this.localeData().months(this,g)}),Re("M",Tt,Ne),Re("MM",Tt,Se),Re("MMM",function(g,E){return E.monthsShortRegex(g)}),Re("MMMM",function(g,E){return E.monthsRegex(g)}),Br(["M","MM"],function(g,E){E[qn]=mr(g)-1}),Br(["MMM","MMMM"],function(g,E,I,$){var H=I._locale.monthsParse(g,$,I._strict);H!=null?E[qn]=H:d(I).invalidMonth=g});var ee="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ie="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Xe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ye=ge,Vt=ge;function kr(g,E){return g?n(this._months)?this._months[g.month()]:this._months[(this._months.isFormat||Xe).test(E)?"format":"standalone"][g.month()]:n(this._months)?this._months:this._months.standalone}function In(g,E){return g?n(this._monthsShort)?this._monthsShort[g.month()]:this._monthsShort[Xe.test(E)?"format":"standalone"][g.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Pn(g,E,I){var $,H,ie,Me=g.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],$=0;$<12;++$)ie=p([2e3,$]),this._shortMonthsParse[$]=this.monthsShort(ie,"").toLocaleLowerCase(),this._longMonthsParse[$]=this.months(ie,"").toLocaleLowerCase();return I?E==="MMM"?(H=an.call(this._shortMonthsParse,Me),H!==-1?H:null):(H=an.call(this._longMonthsParse,Me),H!==-1?H:null):E==="MMM"?(H=an.call(this._shortMonthsParse,Me),H!==-1?H:(H=an.call(this._longMonthsParse,Me),H!==-1?H:null)):(H=an.call(this._longMonthsParse,Me),H!==-1?H:(H=an.call(this._shortMonthsParse,Me),H!==-1?H:null))}function ls(g,E,I){var $,H,ie;if(this._monthsParseExact)return Pn.call(this,g,E,I);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),$=0;$<12;$++){if(H=p([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[$]&&(ie="^"+this.months(H,"")+"|^"+this.monthsShort(H,""),this._monthsParse[$]=new RegExp(ie.replace(".",""),"i")),I&&E==="MMMM"&&this._longMonthsParse[$].test(g))return $;if(I&&E==="MMM"&&this._shortMonthsParse[$].test(g))return $;if(!I&&this._monthsParse[$].test(g))return $}}function uD(g,E){if(!g.isValid())return g;if(typeof E=="string"){if(/^\d+$/.test(E))E=mr(E);else if(E=g.localeData().monthsParse(E),!c(E))return g}var I=E,$=g.date();return $=$<29?$:Math.min($,q(g.year(),I)),g._isUTC?g._d.setUTCMonth(I,$):g._d.setMonth(I,$),g}function lD(g){return g!=null?(uD(this,g),e.updateOffset(this,!0),this):vo(this,"Month")}function D6(){return q(this.year(),this.month())}function C6(g){return this._monthsParseExact?(a(this,"_monthsRegex")||cD.call(this),g?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=Ye),this._monthsShortStrictRegex&&g?this._monthsShortStrictRegex:this._monthsShortRegex)}function N6(g){return this._monthsParseExact?(a(this,"_monthsRegex")||cD.call(this),g?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=Vt),this._monthsStrictRegex&&g?this._monthsStrictRegex:this._monthsRegex)}function cD(){function g(er,Sr){return Sr.length-er.length}var E=[],I=[],$=[],H,ie,Me,mt;for(H=0;H<12;H++)ie=p([2e3,H]),Me=nn(this.monthsShort(ie,"")),mt=nn(this.months(ie,"")),E.push(Me),I.push(mt),$.push(mt),$.push(Me);E.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("^("+E.join("|")+")","i")}function F6(g,E,I,$,H,ie,Me){var mt;return g<100&&g>=0?(mt=new Date(g+400,E,I,$,H,ie,Me),isFinite(mt.getFullYear())&&mt.setFullYear(g)):mt=new Date(g,E,I,$,H,ie,Me),mt}function Bf(g){var E,I;return g<100&&g>=0?(I=Array.prototype.slice.call(arguments),I[0]=g+400,E=new Date(Date.UTC.apply(null,I)),isFinite(E.getUTCFullYear())&&E.setUTCFullYear(g)):E=new Date(Date.UTC.apply(null,arguments)),E}function Am(g,E,I){var $=7+E-I,H=(7+Bf(g,0,$).getUTCDay()-E)%7;return-H+$-1}function fD(g,E,I,$,H){var ie=(7+I-$)%7,Me=Am(g,$,H),mt=1+7*(E-1)+ie+Me,er,Sr;return mt<=0?(er=g-1,Sr=ss(er)+mt):mt>ss(g)?(er=g+1,Sr=mt-ss(g)):(er=g,Sr=mt),{year:er,dayOfYear:Sr}}function kf(g,E,I){var $=Am(g.year(),E,I),H=Math.floor((g.dayOfYear()-$-1)/7)+1,ie,Me;return H<1?(Me=g.year()-1,ie=H+cs(Me,E,I)):H>cs(g.year(),E,I)?(ie=H-cs(g.year(),E,I),Me=g.year()+1):(Me=g.year(),ie=H),{week:ie,year:Me}}function cs(g,E,I){var $=Am(g,E,I),H=Am(g+1,E,I);return(ss(g)-$+H)/7}L("w",["ww",2],"wo","week"),L("W",["WW",2],"Wo","isoWeek"),Re("w",Tt,Ne),Re("ww",Tt,Se),Re("W",Tt,Ne),Re("WW",Tt,Se),Yi(["w","ww","W","WW"],function(g,E,I,$){E[$.substr(0,1)]=mr(g)});function I6(g){return kf(g,this._week.dow,this._week.doy).week}var P6={dow:0,doy:6};function B6(){return this._week.dow}function k6(){return this._week.doy}function $6(g){var E=this.localeData().week(this);return g==null?E:this.add((g-E)*7,"d")}function O6(g){var E=kf(this,1,4).week;return g==null?E:this.add((g-E)*7,"d")}L("d",0,"do","day"),L("dd",0,0,function(g){return this.localeData().weekdaysMin(this,g)}),L("ddd",0,0,function(g){return this.localeData().weekdaysShort(this,g)}),L("dddd",0,0,function(g){return this.localeData().weekdays(this,g)}),L("e",0,0,"weekday"),L("E",0,0,"isoWeekday"),Re("d",Tt),Re("e",Tt),Re("E",Tt),Re("dd",function(g,E){return E.weekdaysMinRegex(g)}),Re("ddd",function(g,E){return E.weekdaysShortRegex(g)}),Re("dddd",function(g,E){return E.weekdaysRegex(g)}),Yi(["dd","ddd","dddd"],function(g,E,I,$){var H=I._locale.weekdaysParse(g,$,I._strict);H!=null?E.d=H:d(I).invalidWeekday=g}),Yi(["d","e","E"],function(g,E,I,$){E[$]=mr(g)});function R6(g,E){return typeof g!="string"?g:isNaN(g)?(g=E.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function L6(g,E){return typeof g=="string"?E.weekdaysParse(g)%7||7:isNaN(g)?null:g}function Ty(g,E){return g.slice(E,7).concat(g.slice(0,E))}var V6="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),pD="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),U6="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),q6=ge,z6=ge,H6=ge;function G6(g,E){var I=n(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(E)?"format":"standalone"];return g===!0?Ty(I,this._week.dow):g?I[g.day()]:I}function W6(g){return g===!0?Ty(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function Y6(g){return g===!0?Ty(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function j6(g,E,I){var $,H,ie,Me=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],$=0;$<7;++$)ie=p([2e3,1]).day($),this._minWeekdaysParse[$]=this.weekdaysMin(ie,"").toLocaleLowerCase(),this._shortWeekdaysParse[$]=this.weekdaysShort(ie,"").toLocaleLowerCase(),this._weekdaysParse[$]=this.weekdays(ie,"").toLocaleLowerCase();return I?E==="dddd"?(H=an.call(this._weekdaysParse,Me),H!==-1?H:null):E==="ddd"?(H=an.call(this._shortWeekdaysParse,Me),H!==-1?H:null):(H=an.call(this._minWeekdaysParse,Me),H!==-1?H:null):E==="dddd"?(H=an.call(this._weekdaysParse,Me),H!==-1||(H=an.call(this._shortWeekdaysParse,Me),H!==-1)?H:(H=an.call(this._minWeekdaysParse,Me),H!==-1?H:null)):E==="ddd"?(H=an.call(this._shortWeekdaysParse,Me),H!==-1||(H=an.call(this._weekdaysParse,Me),H!==-1)?H:(H=an.call(this._minWeekdaysParse,Me),H!==-1?H:null)):(H=an.call(this._minWeekdaysParse,Me),H!==-1||(H=an.call(this._weekdaysParse,Me),H!==-1)?H:(H=an.call(this._shortWeekdaysParse,Me),H!==-1?H:null))}function Z6(g,E,I){var $,H,ie;if(this._weekdaysParseExact)return j6.call(this,g,E,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),$=0;$<7;$++){if(H=p([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[$]||(ie="^"+this.weekdays(H,"")+"|^"+this.weekdaysShort(H,"")+"|^"+this.weekdaysMin(H,""),this._weekdaysParse[$]=new RegExp(ie.replace(".",""),"i")),I&&E==="dddd"&&this._fullWeekdaysParse[$].test(g))return $;if(I&&E==="ddd"&&this._shortWeekdaysParse[$].test(g))return $;if(I&&E==="dd"&&this._minWeekdaysParse[$].test(g))return $;if(!I&&this._weekdaysParse[$].test(g))return $}}function J6(g){if(!this.isValid())return g!=null?this:NaN;var E=vo(this,"Day");return g!=null?(g=R6(g,this.localeData()),this.add(g-E,"d")):E}function X6(g){if(!this.isValid())return g!=null?this:NaN;var E=(this.day()+7-this.localeData()._week.dow)%7;return g==null?E:this.add(g-E,"d")}function Q6(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var E=L6(g,this.localeData());return this.day(this.day()%7?E:E-7)}else return this.day()||7}function K6(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||My.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=q6),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function eq(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||My.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=z6),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function tq(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||My.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=H6),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function My(){function g(ki,hs){return hs.length-ki.length}var E=[],I=[],$=[],H=[],ie,Me,mt,er,Sr;for(ie=0;ie<7;ie++)Me=p([2e3,1]).day(ie),mt=nn(this.weekdaysMin(Me,"")),er=nn(this.weekdaysShort(Me,"")),Sr=nn(this.weekdays(Me,"")),E.push(mt),I.push(er),$.push(Sr),H.push(mt),H.push(er),H.push(Sr);E.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("^("+E.join("|")+")","i")}function Dy(){return this.hours()%12||12}function rq(){return this.hours()||24}L("H",["HH",2],0,"hour"),L("h",["hh",2],0,Dy),L("k",["kk",2],0,rq),L("hmm",0,0,function(){return""+Dy.apply(this)+W(this.minutes(),2)}),L("hmmss",0,0,function(){return""+Dy.apply(this)+W(this.minutes(),2)+W(this.seconds(),2)}),L("Hmm",0,0,function(){return""+this.hours()+W(this.minutes(),2)}),L("Hmmss",0,0,function(){return""+this.hours()+W(this.minutes(),2)+W(this.seconds(),2)});function mD(g,E){L(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),E)})}mD("a",!0),mD("A",!1);function dD(g,E){return E._meridiemParse}Re("a",dD),Re("A",dD),Re("H",Tt,ot),Re("h",Tt,Ne),Re("k",Tt,Ne),Re("HH",Tt,Se),Re("hh",Tt,Se),Re("kk",Tt,Se),Re("hmm",j),Re("hmmss",le),Re("Hmm",j),Re("Hmmss",le),Br(["H","HH"],fn),Br(["k","kk"],function(g,E,I){var $=mr(g);E[fn]=$===24?0:$}),Br(["a","A"],function(g,E,I){I._isPm=I._locale.isPM(g),I._meridiem=g}),Br(["h","hh"],function(g,E,I){E[fn]=mr(g),d(I).bigHour=!0}),Br("hmm",function(g,E,I){var $=g.length-2;E[fn]=mr(g.substr(0,$)),E[Qn]=mr(g.substr($)),d(I).bigHour=!0}),Br("hmmss",function(g,E,I){var $=g.length-4,H=g.length-2;E[fn]=mr(g.substr(0,$)),E[Qn]=mr(g.substr($,2)),E[Cn]=mr(g.substr(H)),d(I).bigHour=!0}),Br("Hmm",function(g,E,I){var $=g.length-2;E[fn]=mr(g.substr(0,$)),E[Qn]=mr(g.substr($))}),Br("Hmmss",function(g,E,I){var $=g.length-4,H=g.length-2;E[fn]=mr(g.substr(0,$)),E[Qn]=mr(g.substr($,2)),E[Cn]=mr(g.substr(H))});function nq(g){return(g+"").toLowerCase().charAt(0)==="p"}var iq=/[ap]\.?m?\.?/i,aq=Lo("Hours",!0);function oq(g,E,I){return g>11?I?"pm":"PM":I?"am":"AM"}var hD={calendar:k,longDateFormat:_e,invalidDate:be,ordinal:Ee,dayOfMonthOrdinalParse:ze,relativeTime:Y,months:ee,monthsShort:Ie,week:P6,weekdays:V6,weekdaysMin:U6,weekdaysShort:pD,meridiemParse:iq},pn={},$f={},Of;function sq(g,E){var I,$=Math.min(g.length,E.length);for(I=0;I<$;I+=1)if(g[I]!==E[I])return I;return $}function gD(g){return g&&g.toLowerCase().replace("_","-")}function uq(g){for(var E=0,I,$,H,ie;E<g.length;){for(ie=gD(g[E]).split("-"),I=ie.length,$=gD(g[E+1]),$=$?$.split("-"):null;I>0;){if(H=Em(ie.slice(0,I).join("-")),H)return H;if($&&$.length>=I&&sq(ie,$)>=I-1)break;I--}E++}return Of}function lq(g){return!!(g&&g.match("^[^/\\\\]*$"))}function Em(g){var E=null,I;if(pn[g]===void 0&&typeof ac<"u"&&ac&&ac.exports&&lq(g))try{E=Of._abbr,I=require,I("./locale/"+g),Xs(E)}catch{pn[g]=null}return pn[g]}function Xs(g,E){var I;return g&&(u(E)?I=fs(g):I=Cy(g,E),I?Of=I:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),Of._abbr}function Cy(g,E){if(E!==null){var I,$=hD;if(E.abbr=g,pn[g]!=null)D("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."),$=pn[g]._config;else if(E.parentLocale!=null)if(pn[E.parentLocale]!=null)$=pn[E.parentLocale]._config;else if(I=Em(E.parentLocale),I!=null)$=I._config;else return $f[E.parentLocale]||($f[E.parentLocale]=[]),$f[E.parentLocale].push({name:g,config:E}),null;return pn[g]=new z(R($,E)),$f[g]&&$f[g].forEach(function(H){Cy(H.name,H.config)}),Xs(g),pn[g]}else return delete pn[g],null}function cq(g,E){if(E!=null){var I,$,H=hD;pn[g]!=null&&pn[g].parentLocale!=null?pn[g].set(R(pn[g]._config,E)):($=Em(g),$!=null&&(H=$._config),E=R(H,E),$==null&&(E.abbr=g),I=new z(E),I.parentLocale=pn[g],pn[g]=I),Xs(g)}else pn[g]!=null&&(pn[g].parentLocale!=null?(pn[g]=pn[g].parentLocale,g===Xs()&&Xs(g)):pn[g]!=null&&delete pn[g]);return pn[g]}function fs(g){var E;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return Of;if(!n(g)){if(E=Em(g),E)return E;g=[g]}return uq(g)}function fq(){return V(pn)}function Ny(g){var E,I=g._a;return I&&d(g).overflow===-2&&(E=I[qn]<0||I[qn]>11?qn:I[ji]<1||I[ji]>q(I[Dn],I[qn])?ji:I[fn]<0||I[fn]>24||I[fn]===24&&(I[Qn]!==0||I[Cn]!==0||I[Zi]!==0)?fn:I[Qn]<0||I[Qn]>59?Qn:I[Cn]<0||I[Cn]>59?Cn:I[Zi]<0||I[Zi]>999?Zi:-1,d(g)._overflowDayOfYear&&(E<Dn||E>ji)&&(E=ji),d(g)._overflowWeeks&&E===-1&&(E=Ff),d(g)._overflowWeekday&&E===-1&&(E=Wl),d(g).overflow=E),g}var 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=/^\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)?)?$/,dq=/Z|[+-]\d\d(?::?\d\d)?/,Tm=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Fy=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],hq=/^\/?Date\((-?\d+)/i,gq=/^(?:(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}))$/,vq={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 vD(g){var E,I,$=g._i,H=pq.exec($)||mq.exec($),ie,Me,mt,er,Sr=Tm.length,ki=Fy.length;if(H){for(d(g).iso=!0,E=0,I=Sr;E<I;E++)if(Tm[E][1].exec(H[1])){Me=Tm[E][0],ie=Tm[E][2]!==!1;break}if(Me==null){g._isValid=!1;return}if(H[3]){for(E=0,I=ki;E<I;E++)if(Fy[E][1].exec(H[3])){mt=(H[2]||" ")+Fy[E][0];break}if(mt==null){g._isValid=!1;return}}if(!ie&&mt!=null){g._isValid=!1;return}if(H[4])if(dq.exec(H[4]))er="Z";else{g._isValid=!1;return}g._f=Me+(mt||"")+(er||""),Py(g)}else g._isValid=!1}function yq(g,E,I,$,H,ie){var Me=[xq(g),Ie.indexOf(E),parseInt(I,10),parseInt($,10),parseInt(H,10)];return ie&&Me.push(parseInt(ie,10)),Me}function xq(g){var E=parseInt(g,10);return E<=49?2e3+E:E<=999?1900+E:E}function bq(g){return g.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function wq(g,E,I){if(g){var $=pD.indexOf(g),H=new Date(E[0],E[1],E[2]).getDay();if($!==H)return d(I).weekdayMismatch=!0,I._isValid=!1,!1}return!0}function _q(g,E,I){if(g)return vq[g];if(E)return 0;var $=parseInt(I,10),H=$%100,ie=($-H)/100;return ie*60+H}function yD(g){var E=gq.exec(bq(g._i)),I;if(E){if(I=yq(E[4],E[3],E[2],E[5],E[6],E[7]),!wq(E[1],I,g))return;g._a=I,g._tzm=_q(E[8],E[9],E[10]),g._d=Bf.apply(null,g._a),g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),d(g).rfc2822=!0}else g._isValid=!1}function Sq(g){var E=hq.exec(g._i);if(E!==null){g._d=new Date(+E[1]);return}if(vD(g),g._isValid===!1)delete g._isValid;else return;if(yD(g),g._isValid===!1)delete g._isValid;else return;g._strict?g._isValid=!1:e.createFromInputFallback(g)}e.createFromInputFallback=M("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 Jl(g,E,I){return g??E??I}function Aq(g){var E=new Date(e.now());return g._useUTC?[E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()]:[E.getFullYear(),E.getMonth(),E.getDate()]}function Iy(g){var E,I,$=[],H,ie,Me;if(!g._d){for(H=Aq(g),g._w&&g._a[ji]==null&&g._a[qn]==null&&Eq(g),g._dayOfYear!=null&&(Me=Jl(g._a[Dn],H[Dn]),(g._dayOfYear>ss(Me)||g._dayOfYear===0)&&(d(g)._overflowDayOfYear=!0),I=Bf(Me,0,g._dayOfYear),g._a[qn]=I.getUTCMonth(),g._a[ji]=I.getUTCDate()),E=0;E<3&&g._a[E]==null;++E)g._a[E]=$[E]=H[E];for(;E<7;E++)g._a[E]=$[E]=g._a[E]==null?E===2?1:0:g._a[E];g._a[fn]===24&&g._a[Qn]===0&&g._a[Cn]===0&&g._a[Zi]===0&&(g._nextDay=!0,g._a[fn]=0),g._d=(g._useUTC?Bf:F6).apply(null,$),ie=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[fn]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==ie&&(d(g).weekdayMismatch=!0)}}function Eq(g){var E,I,$,H,ie,Me,mt,er,Sr;E=g._w,E.GG!=null||E.W!=null||E.E!=null?(ie=1,Me=4,I=Jl(E.GG,g._a[Dn],kf(on(),1,4).year),$=Jl(E.W,1),H=Jl(E.E,1),(H<1||H>7)&&(er=!0)):(ie=g._locale._week.dow,Me=g._locale._week.doy,Sr=kf(on(),ie,Me),I=Jl(E.gg,g._a[Dn],Sr.year),$=Jl(E.w,Sr.week),E.d!=null?(H=E.d,(H<0||H>6)&&(er=!0)):E.e!=null?(H=E.e+ie,(E.e<0||E.e>6)&&(er=!0)):H=ie),$<1||$>cs(I,ie,Me)?d(g)._overflowWeeks=!0:er!=null?d(g)._overflowWeekday=!0:(mt=fD(I,$,H,ie,Me),g._a[Dn]=mt.year,g._dayOfYear=mt.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Py(g){if(g._f===e.ISO_8601){vD(g);return}if(g._f===e.RFC_2822){yD(g);return}g._a=[],d(g).empty=!0;var E=""+g._i,I,$,H,ie,Me,mt=E.length,er=0,Sr,ki;for(H=ve(g._f,g._locale).match(O)||[],ki=H.length,I=0;I<ki;I++)ie=H[I],$=(E.match(Xn(ie,g))||[])[0],$&&(Me=E.substr(0,E.indexOf($)),Me.length>0&&d(g).unusedInput.push(Me),E=E.slice(E.indexOf($)+$.length),er+=$.length),Z[ie]?($?d(g).empty=!1:d(g).unusedTokens.push(ie),Ra(ie,$,g)):g._strict&&!$&&d(g).unusedTokens.push(ie);d(g).charsLeftOver=mt-er,E.length>0&&d(g).unusedInput.push(E),g._a[fn]<=12&&d(g).bigHour===!0&&g._a[fn]>0&&(d(g).bigHour=void 0),d(g).parsedDateParts=g._a.slice(0),d(g).meridiem=g._meridiem,g._a[fn]=Tq(g._locale,g._a[fn],g._meridiem),Sr=d(g).era,Sr!==null&&(g._a[Dn]=g._locale.erasConvertYear(Sr,g._a[Dn])),Iy(g),Ny(g)}function Tq(g,E,I){var $;return I==null?E:g.meridiemHour!=null?g.meridiemHour(E,I):(g.isPM!=null&&($=g.isPM(I),$&&E<12&&(E+=12),!$&&E===12&&(E=0)),E)}function Mq(g){var E,I,$,H,ie,Me,mt=!1,er=g._f.length;if(er===0){d(g).invalidFormat=!0,g._d=new Date(NaN);return}for(H=0;H<er;H++)ie=0,Me=!1,E=S({},g),g._useUTC!=null&&(E._useUTC=g._useUTC),E._f=g._f[H],Py(E),x(E)&&(Me=!0),ie+=d(E).charsLeftOver,ie+=d(E).unusedTokens.length*10,d(E).score=ie,mt?ie<$&&($=ie,I=E):($==null||ie<$||Me)&&($=ie,I=E,Me&&(mt=!0));f(g,I||E)}function Dq(g){if(!g._d){var E=se(g._i),I=E.day===void 0?E.date:E.day;g._a=l([E.year,E.month,I,E.hour,E.minute,E.second,E.millisecond],function($){return $&&parseInt($,10)}),Iy(g)}}function Cq(g){var E=new _(Ny(xD(g)));return E._nextDay&&(E.add(1,"d"),E._nextDay=void 0),E}function xD(g){var E=g._i,I=g._f;return g._locale=g._locale||fs(g._l),E===null||I===void 0&&E===""?b({nullInput:!0}):(typeof E=="string"&&(g._i=E=g._locale.preparse(E)),y(E)?new _(Ny(E)):(s(E)?g._d=E:n(I)?Mq(g):I?Py(g):Nq(g),x(g)||(g._d=null),g))}function Nq(g){var E=g._i;u(E)?g._d=new Date(e.now()):s(E)?g._d=new Date(E.valueOf()):typeof E=="string"?Sq(g):n(E)?(g._a=l(E.slice(0),function(I){return parseInt(I,10)}),Iy(g)):i(E)?Dq(g):c(E)?g._d=new Date(E):e.createFromInputFallback(g)}function bD(g,E,I,$,H){var ie={};return(E===!0||E===!1)&&($=E,E=void 0),(I===!0||I===!1)&&($=I,I=void 0),(i(g)&&o(g)||n(g)&&g.length===0)&&(g=void 0),ie._isAMomentObject=!0,ie._useUTC=ie._isUTC=H,ie._l=I,ie._i=g,ie._f=E,ie._strict=$,Cq(ie)}function on(g,E,I,$){return bD(g,E,I,$,!1)}var Fq=M("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=on.apply(null,arguments);return this.isValid()&&g.isValid()?g<this?this:g:b()}),Iq=M("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=on.apply(null,arguments);return this.isValid()&&g.isValid()?g>this?this:g:b()});function wD(g,E){var I,$;if(E.length===1&&n(E[0])&&(E=E[0]),!E.length)return on();for(I=E[0],$=1;$<E.length;++$)(!E[$].isValid()||E[$][g](I))&&(I=E[$]);return I}function Pq(){var g=[].slice.call(arguments,0);return wD("isBefore",g)}function Bq(){var g=[].slice.call(arguments,0);return wD("isAfter",g)}var kq=function(){return Date.now?Date.now():+new Date},Rf=["year","quarter","month","week","day","hour","minute","second","millisecond"];function $q(g){var E,I=!1,$,H=Rf.length;for(E in g)if(a(g,E)&&!(an.call(Rf,E)!==-1&&(g[E]==null||!isNaN(g[E]))))return!1;for($=0;$<H;++$)if(g[Rf[$]]){if(I)return!1;parseFloat(g[Rf[$]])!==mr(g[Rf[$]])&&(I=!0)}return!0}function Oq(){return this._isValid}function Rq(){return yo(NaN)}function Mm(g){var E=se(g),I=E.year||0,$=E.quarter||0,H=E.month||0,ie=E.week||E.isoWeek||0,Me=E.day||0,mt=E.hour||0,er=E.minute||0,Sr=E.second||0,ki=E.millisecond||0;this._isValid=$q(E),this._milliseconds=+ki+Sr*1e3+er*6e4+mt*1e3*60*60,this._days=+Me+ie*7,this._months=+H+$*3+I*12,this._data={},this._locale=fs(),this._bubble()}function Dm(g){return g instanceof Mm}function By(g){return g<0?Math.round(-1*g)*-1:Math.round(g)}function Lq(g,E,I){var $=Math.min(g.length,E.length),H=Math.abs(g.length-E.length),ie=0,Me;for(Me=0;Me<$;Me++)(I&&g[Me]!==E[Me]||!I&&mr(g[Me])!==mr(E[Me]))&&ie++;return ie+H}function _D(g,E){L(g,0,0,function(){var I=this.utcOffset(),$="+";return I<0&&(I=-I,$="-"),$+W(~~(I/60),2)+E+W(~~I%60,2)})}_D("Z",":"),_D("ZZ",""),Re("Z",F),Re("ZZ",F),Br(["Z","ZZ"],function(g,E,I){I._useUTC=!0,I._tzm=ky(F,g)});var Vq=/([\+\-]|\d\d)/gi;function ky(g,E){var I=(E||"").match(g),$,H,ie;return I===null?null:($=I[I.length-1]||[],H=($+"").match(Vq)||["-",0,0],ie=+(H[1]*60)+mr(H[2]),ie===0?0:H[0]==="+"?ie:-ie)}function $y(g,E){var I,$;return E._isUTC?(I=E.clone(),$=(y(g)||s(g)?g.valueOf():on(g).valueOf())-I.valueOf(),I._d.setTime(I._d.valueOf()+$),e.updateOffset(I,!1),I):on(g).local()}function Oy(g){return-Math.round(g._d.getTimezoneOffset())}e.updateOffset=function(){};function Uq(g,E,I){var $=this._offset||0,H;if(!this.isValid())return g!=null?this:NaN;if(g!=null){if(typeof g=="string"){if(g=ky(F,g),g===null)return this}else Math.abs(g)<16&&!I&&(g=g*60);return!this._isUTC&&E&&(H=Oy(this)),this._offset=g,this._isUTC=!0,H!=null&&this.add(H,"m"),$!==g&&(!E||this._changeInProgress?TD(this,yo(g-$,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?$:Oy(this)}function qq(g,E){return g!=null?(typeof g!="string"&&(g=-g),this.utcOffset(g,E),this):-this.utcOffset()}function zq(g){return this.utcOffset(0,g)}function Hq(g){return this._isUTC&&(this.utcOffset(0,g),this._isUTC=!1,g&&this.subtract(Oy(this),"m")),this}function Gq(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var g=ky(He,this._i);g!=null?this.utcOffset(g):this.utcOffset(0,!0)}return this}function Wq(g){return this.isValid()?(g=g?on(g).utcOffset():0,(this.utcOffset()-g)%60===0):!1}function Yq(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function jq(){if(!u(this._isDSTShifted))return this._isDSTShifted;var g={},E;return S(g,this),g=xD(g),g._a?(E=g._isUTC?p(g._a):on(g._a),this._isDSTShifted=this.isValid()&&Lq(g._a,E.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Zq(){return this.isValid()?!this._isUTC:!1}function Jq(){return this.isValid()?this._isUTC:!1}function SD(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Xq=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Qq=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function yo(g,E){var I=g,$=null,H,ie,Me;return Dm(g)?I={ms:g._milliseconds,d:g._days,M:g._months}:c(g)||!isNaN(+g)?(I={},E?I[E]=+g:I.milliseconds=+g):($=Xq.exec(g))?(H=$[1]==="-"?-1:1,I={y:0,d:mr($[ji])*H,h:mr($[fn])*H,m:mr($[Qn])*H,s:mr($[Cn])*H,ms:mr(By($[Zi]*1e3))*H}):($=Qq.exec(g))?(H=$[1]==="-"?-1:1,I={y:Yu($[2],H),M:Yu($[3],H),w:Yu($[4],H),d:Yu($[5],H),h:Yu($[6],H),m:Yu($[7],H),s:Yu($[8],H)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(Me=Kq(on(I.from),on(I.to)),I={},I.ms=Me.milliseconds,I.M=Me.months),ie=new Mm(I),Dm(g)&&a(g,"_locale")&&(ie._locale=g._locale),Dm(g)&&a(g,"_isValid")&&(ie._isValid=g._isValid),ie}yo.fn=Mm.prototype,yo.invalid=Rq;function Yu(g,E){var I=g&&parseFloat(g.replace(",","."));return(isNaN(I)?0:I)*E}function AD(g,E){var I={};return I.months=E.month()-g.month()+(E.year()-g.year())*12,g.clone().add(I.months,"M").isAfter(E)&&--I.months,I.milliseconds=+E-+g.clone().add(I.months,"M"),I}function Kq(g,E){var I;return g.isValid()&&E.isValid()?(E=$y(E,g),g.isBefore(E)?I=AD(g,E):(I=AD(E,g),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function ED(g,E){return function(I,$){var H,ie;return $!==null&&!isNaN(+$)&&(D(E,"moment()."+E+"(period, number) is deprecated. Please use moment()."+E+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),ie=I,I=$,$=ie),H=yo(I,$),TD(this,H,g),this}}function TD(g,E,I,$){var H=E._milliseconds,ie=By(E._days),Me=By(E._months);g.isValid()&&($=$??!0,Me&&uD(g,vo(g,"Month")+Me*I),ie&&jl(g,"Date",vo(g,"Date")+ie*I),H&&g._d.setTime(g._d.valueOf()+H*I),$&&e.updateOffset(g,ie||Me))}var e9=ED(1,"add"),t9=ED(-1,"subtract");function MD(g){return typeof g=="string"||g instanceof String}function r9(g){return y(g)||s(g)||MD(g)||c(g)||i9(g)||n9(g)||g===null||g===void 0}function n9(g){var E=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,ie,Me=$.length;for(H=0;H<Me;H+=1)ie=$[H],I=I||a(g,ie);return E&&I}function i9(g){var E=n(g),I=!1;return E&&(I=g.filter(function($){return!c($)&&MD(g)}).length===0),E&&I}function a9(g){var E=i(g)&&!o(g),I=!1,$=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],H,ie;for(H=0;H<$.length;H+=1)ie=$[H],I=I||a(g,ie);return E&&I}function o9(g,E){var I=g.diff(E,"days",!0);return I<-6?"sameElse":I<-1?"lastWeek":I<0?"lastDay":I<1?"sameDay":I<2?"nextDay":I<7?"nextWeek":"sameElse"}function s9(g,E){arguments.length===1&&(arguments[0]?r9(arguments[0])?(g=arguments[0],E=void 0):a9(arguments[0])&&(E=arguments[0],g=void 0):(g=void 0,E=void 0));var I=g||on(),$=$y(I,this).startOf("day"),H=e.calendarFormat(this,$)||"sameElse",ie=E&&(N(E[H])?E[H].call(this,I):E[H]);return this.format(ie||this.localeData().calendar(H,this,on(I)))}function u9(){return new _(this)}function l9(g,E){var I=y(g)?g:on(g);return this.isValid()&&I.isValid()?(E=re(E)||"millisecond",E==="millisecond"?this.valueOf()>I.valueOf():I.valueOf()<this.clone().startOf(E).valueOf()):!1}function c9(g,E){var I=y(g)?g:on(g);return this.isValid()&&I.isValid()?(E=re(E)||"millisecond",E==="millisecond"?this.valueOf()<I.valueOf():this.clone().endOf(E).valueOf()<I.valueOf()):!1}function f9(g,E,I,$){var H=y(g)?g:on(g),ie=y(E)?E:on(E);return this.isValid()&&H.isValid()&&ie.isValid()?($=$||"()",($[0]==="("?this.isAfter(H,I):!this.isBefore(H,I))&&($[1]===")"?this.isBefore(ie,I):!this.isAfter(ie,I))):!1}function p9(g,E){var I=y(g)?g:on(g),$;return this.isValid()&&I.isValid()?(E=re(E)||"millisecond",E==="millisecond"?this.valueOf()===I.valueOf():($=I.valueOf(),this.clone().startOf(E).valueOf()<=$&&$<=this.clone().endOf(E).valueOf())):!1}function m9(g,E){return this.isSame(g,E)||this.isAfter(g,E)}function d9(g,E){return this.isSame(g,E)||this.isBefore(g,E)}function h9(g,E,I){var $,H,ie;if(!this.isValid())return NaN;if($=$y(g,this),!$.isValid())return NaN;switch(H=($.utcOffset()-this.utcOffset())*6e4,E=re(E),E){case"year":ie=Cm(this,$)/12;break;case"month":ie=Cm(this,$);break;case"quarter":ie=Cm(this,$)/3;break;case"second":ie=(this-$)/1e3;break;case"minute":ie=(this-$)/6e4;break;case"hour":ie=(this-$)/36e5;break;case"day":ie=(this-$-H)/864e5;break;case"week":ie=(this-$-H)/6048e5;break;default:ie=this-$}return I?ie:Un(ie)}function Cm(g,E){if(g.date()<E.date())return-Cm(E,g);var I=(E.year()-g.year())*12+(E.month()-g.month()),$=g.clone().add(I,"months"),H,ie;return E-$<0?(H=g.clone().add(I-1,"months"),ie=(E-$)/($-H)):(H=g.clone().add(I+1,"months"),ie=(E-$)/(H-$)),-(I+ie)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function g9(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function v9(g){if(!this.isValid())return null;var E=g!==!0,I=E?this.clone().utc():this;return I.year()<0||I.year()>9999?oe(I,E?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?E?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",oe(I,"Z")):oe(I,E?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function y9(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",E="",I,$,H,ie;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",E="Z"),I="["+g+'("]',$=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",H="-MM-DD[T]HH:mm:ss.SSS",ie=E+'[")]',this.format(I+$+H+ie)}function x9(g){g||(g=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var E=oe(this,g);return this.localeData().postformat(E)}function b9(g,E){return this.isValid()&&(y(g)&&g.isValid()||on(g).isValid())?yo({to:this,from:g}).locale(this.locale()).humanize(!E):this.localeData().invalidDate()}function w9(g){return this.from(on(),g)}function _9(g,E){return this.isValid()&&(y(g)&&g.isValid()||on(g).isValid())?yo({from:this,to:g}).locale(this.locale()).humanize(!E):this.localeData().invalidDate()}function S9(g){return this.to(on(),g)}function DD(g){var E;return g===void 0?this._locale._abbr:(E=fs(g),E!=null&&(this._locale=E),this)}var CD=M("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 ND(){return this._locale}var Nm=1e3,Xl=60*Nm,Fm=60*Xl,FD=(365*400+97)*24*Fm;function Ql(g,E){return(g%E+E)%E}function ID(g,E,I){return g<100&&g>=0?new Date(g+400,E,I)-FD:new Date(g,E,I).valueOf()}function PD(g,E,I){return g<100&&g>=0?Date.UTC(g+400,E,I)-FD:Date.UTC(g,E,I)}function A9(g){var E,I;if(g=re(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?PD:ID,g){case"year":E=I(this.year(),0,1);break;case"quarter":E=I(this.year(),this.month()-this.month()%3,1);break;case"month":E=I(this.year(),this.month(),1);break;case"week":E=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":E=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":E=I(this.year(),this.month(),this.date());break;case"hour":E=this._d.valueOf(),E-=Ql(E+(this._isUTC?0:this.utcOffset()*Xl),Fm);break;case"minute":E=this._d.valueOf(),E-=Ql(E,Xl);break;case"second":E=this._d.valueOf(),E-=Ql(E,Nm);break}return this._d.setTime(E),e.updateOffset(this,!0),this}function E9(g){var E,I;if(g=re(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?PD:ID,g){case"year":E=I(this.year()+1,0,1)-1;break;case"quarter":E=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":E=I(this.year(),this.month()+1,1)-1;break;case"week":E=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":E=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":E=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":E=this._d.valueOf(),E+=Fm-Ql(E+(this._isUTC?0:this.utcOffset()*Xl),Fm)-1;break;case"minute":E=this._d.valueOf(),E+=Xl-Ql(E,Xl)-1;break;case"second":E=this._d.valueOf(),E+=Nm-Ql(E,Nm)-1;break}return this._d.setTime(E),e.updateOffset(this,!0),this}function T9(){return this._d.valueOf()-(this._offset||0)*6e4}function M9(){return Math.floor(this.valueOf()/1e3)}function D9(){return new Date(this.valueOf())}function C9(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function N9(){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 F9(){return this.isValid()?this.toISOString():null}function I9(){return x(this)}function P9(){return f({},d(this))}function B9(){return d(this).overflow}function k9(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}L("N",0,0,"eraAbbr"),L("NN",0,0,"eraAbbr"),L("NNN",0,0,"eraAbbr"),L("NNNN",0,0,"eraName"),L("NNNNN",0,0,"eraNarrow"),L("y",["y",1],"yo","eraYear"),L("y",["yy",2],0,"eraYear"),L("y",["yyy",3],0,"eraYear"),L("y",["yyyy",4],0,"eraYear"),Re("N",Ry),Re("NN",Ry),Re("NNN",Ry),Re("NNNN",W9),Re("NNNNN",Y9),Br(["N","NN","NNN","NNNN","NNNNN"],function(g,E,I,$){var H=I._locale.erasParse(g,$,I._strict);H?d(I).era=H:d(I).invalidEra=g}),Re("y",Fe),Re("yy",Fe),Re("yyy",Fe),Re("yyyy",Fe),Re("yo",j9),Br(["y","yy","yyy","yyyy"],Dn),Br(["yo"],function(g,E,I,$){var H;I._locale._eraYearOrdinalRegex&&(H=g.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?E[Dn]=I._locale.eraYearOrdinalParse(g,H):E[Dn]=parseInt(g,10)});function $9(g,E){var I,$,H,ie=this._eras||fs("en")._eras;for(I=0,$=ie.length;I<$;++I){switch(typeof ie[I].since){case"string":H=e(ie[I].since).startOf("day"),ie[I].since=H.valueOf();break}switch(typeof ie[I].until){case"undefined":ie[I].until=1/0;break;case"string":H=e(ie[I].until).startOf("day").valueOf(),ie[I].until=H.valueOf();break}}return ie}function O9(g,E,I){var $,H,ie=this.eras(),Me,mt,er;for(g=g.toUpperCase(),$=0,H=ie.length;$<H;++$)if(Me=ie[$].name.toUpperCase(),mt=ie[$].abbr.toUpperCase(),er=ie[$].narrow.toUpperCase(),I)switch(E){case"N":case"NN":case"NNN":if(mt===g)return ie[$];break;case"NNNN":if(Me===g)return ie[$];break;case"NNNNN":if(er===g)return ie[$];break}else if([Me,mt,er].indexOf(g)>=0)return ie[$]}function R9(g,E){var I=g.since<=g.until?1:-1;return E===void 0?e(g.since).year():e(g.since).year()+(E-g.offset)*I}function L9(){var g,E,I,$=this.localeData().eras();for(g=0,E=$.length;g<E;++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 V9(){var g,E,I,$=this.localeData().eras();for(g=0,E=$.length;g<E;++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 U9(){var g,E,I,$=this.localeData().eras();for(g=0,E=$.length;g<E;++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 q9(){var g,E,I,$,H=this.localeData().eras();for(g=0,E=H.length;g<E;++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 z9(g){return a(this,"_erasNameRegex")||Ly.call(this),g?this._erasNameRegex:this._erasRegex}function H9(g){return a(this,"_erasAbbrRegex")||Ly.call(this),g?this._erasAbbrRegex:this._erasRegex}function G9(g){return a(this,"_erasNarrowRegex")||Ly.call(this),g?this._erasNarrowRegex:this._erasRegex}function Ry(g,E){return E.erasAbbrRegex(g)}function W9(g,E){return E.erasNameRegex(g)}function Y9(g,E){return E.erasNarrowRegex(g)}function j9(g,E){return E._eraYearOrdinalRegex||Fe}function Ly(){var g=[],E=[],I=[],$=[],H,ie,Me,mt,er,Sr=this.eras();for(H=0,ie=Sr.length;H<ie;++H)Me=nn(Sr[H].name),mt=nn(Sr[H].abbr),er=nn(Sr[H].narrow),E.push(Me),g.push(mt),I.push(er),$.push(Me),$.push(mt),$.push(er);this._erasRegex=new RegExp("^("+$.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+E.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+g.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+I.join("|")+")","i")}L(0,["gg",2],0,function(){return this.weekYear()%100}),L(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Im(g,E){L(0,[g,g.length],0,E)}Im("gggg","weekYear"),Im("ggggg","weekYear"),Im("GGGG","isoWeekYear"),Im("GGGGG","isoWeekYear"),Re("G",$e),Re("g",$e),Re("GG",Tt,Se),Re("gg",Tt,Se),Re("GGGG",Pe,Dt),Re("gggg",Pe,Dt),Re("GGGGG",ke,jt),Re("ggggg",ke,jt),Yi(["gggg","ggggg","GGGG","GGGGG"],function(g,E,I,$){E[$.substr(0,2)]=mr(g)}),Yi(["gg","GG"],function(g,E,I,$){E[$]=e.parseTwoDigitYear(g)});function Z9(g){return BD.call(this,g,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function J9(g){return BD.call(this,g,this.isoWeek(),this.isoWeekday(),1,4)}function X9(){return cs(this.year(),1,4)}function Q9(){return cs(this.isoWeekYear(),1,4)}function K9(){var g=this.localeData()._week;return cs(this.year(),g.dow,g.doy)}function e7(){var g=this.localeData()._week;return cs(this.weekYear(),g.dow,g.doy)}function BD(g,E,I,$,H){var ie;return g==null?kf(this,$,H).year:(ie=cs(g,$,H),E>ie&&(E=ie),t7.call(this,g,E,I,$,H))}function t7(g,E,I,$,H){var ie=fD(g,E,I,$,H),Me=Bf(ie.year,0,ie.dayOfYear);return this.year(Me.getUTCFullYear()),this.month(Me.getUTCMonth()),this.date(Me.getUTCDate()),this}L("Q",0,"Qo","quarter"),Re("Q",qe),Br("Q",function(g,E){E[qn]=(mr(g)-1)*3});function r7(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}L("D",["DD",2],"Do","date"),Re("D",Tt,Ne),Re("DD",Tt,Se),Re("Do",function(g,E){return g?E._dayOfMonthOrdinalParse||E._ordinalParse:E._dayOfMonthOrdinalParseLenient}),Br(["D","DD"],ji),Br("Do",function(g,E){E[ji]=mr(g.match(Tt)[0])});var kD=Lo("Date",!0);L("DDD",["DDDD",3],"DDDo","dayOfYear"),Re("DDD",fe),Re("DDDD",wt),Br(["DDD","DDDD"],function(g,E,I){I._dayOfYear=mr(g)});function n7(g){var E=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return g==null?E:this.add(g-E,"d")}L("m",["mm",2],0,"minute"),Re("m",Tt,ot),Re("mm",Tt,Se),Br(["m","mm"],Qn);var i7=Lo("Minutes",!1);L("s",["ss",2],0,"second"),Re("s",Tt,ot),Re("ss",Tt,Se),Br(["s","ss"],Cn);var a7=Lo("Seconds",!1);L("S",0,0,function(){return~~(this.millisecond()/100)}),L(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),L(0,["SSS",3],0,"millisecond"),L(0,["SSSS",4],0,function(){return this.millisecond()*10}),L(0,["SSSSS",5],0,function(){return this.millisecond()*100}),L(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),L(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),L(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),L(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Re("S",fe,qe),Re("SS",fe,Se),Re("SSS",fe,wt);var Qs,$D;for(Qs="SSSS";Qs.length<=9;Qs+="S")Re(Qs,Fe);function o7(g,E){E[Zi]=mr(("0."+g)*1e3)}for(Qs="S";Qs.length<=9;Qs+="S")Br(Qs,o7);$D=Lo("Milliseconds",!1),L("z",0,0,"zoneAbbr"),L("zz",0,0,"zoneName");function s7(){return this._isUTC?"UTC":""}function u7(){return this._isUTC?"Coordinated Universal Time":""}var Ze=_.prototype;Ze.add=e9,Ze.calendar=s9,Ze.clone=u9,Ze.diff=h9,Ze.endOf=E9,Ze.format=x9,Ze.from=b9,Ze.fromNow=w9,Ze.to=_9,Ze.toNow=S9,Ze.get=Zl,Ze.invalidAt=B9,Ze.isAfter=l9,Ze.isBefore=c9,Ze.isBetween=f9,Ze.isSame=p9,Ze.isSameOrAfter=m9,Ze.isSameOrBefore=d9,Ze.isValid=I9,Ze.lang=CD,Ze.locale=DD,Ze.localeData=ND,Ze.max=Iq,Ze.min=Fq,Ze.parsingFlags=P9,Ze.set=If,Ze.startOf=A9,Ze.subtract=t9,Ze.toArray=C9,Ze.toObject=N9,Ze.toDate=D9,Ze.toISOString=v9,Ze.inspect=y9,typeof Symbol<"u"&&Symbol.for!=null&&(Ze[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ze.toJSON=F9,Ze.toString=g9,Ze.unix=M9,Ze.valueOf=T9,Ze.creationData=k9,Ze.eraName=L9,Ze.eraNarrow=V9,Ze.eraAbbr=U9,Ze.eraYear=q9,Ze.year=us,Ze.isLeapYear=Yl,Ze.weekYear=Z9,Ze.isoWeekYear=J9,Ze.quarter=Ze.quarters=r7,Ze.month=lD,Ze.daysInMonth=D6,Ze.week=Ze.weeks=$6,Ze.isoWeek=Ze.isoWeeks=O6,Ze.weeksInYear=K9,Ze.weeksInWeekYear=e7,Ze.isoWeeksInYear=X9,Ze.isoWeeksInISOWeekYear=Q9,Ze.date=kD,Ze.day=Ze.days=J6,Ze.weekday=X6,Ze.isoWeekday=Q6,Ze.dayOfYear=n7,Ze.hour=Ze.hours=aq,Ze.minute=Ze.minutes=i7,Ze.second=Ze.seconds=a7,Ze.millisecond=Ze.milliseconds=$D,Ze.utcOffset=Uq,Ze.utc=zq,Ze.local=Hq,Ze.parseZone=Gq,Ze.hasAlignedHourOffset=Wq,Ze.isDST=Yq,Ze.isLocal=Zq,Ze.isUtcOffset=Jq,Ze.isUtc=SD,Ze.isUTC=SD,Ze.zoneAbbr=s7,Ze.zoneName=u7,Ze.dates=M("dates accessor is deprecated. Use date instead.",kD),Ze.months=M("months accessor is deprecated. Use month instead",lD),Ze.years=M("years accessor is deprecated. Use year instead",us),Ze.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",qq),Ze.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",jq);function l7(g){return on(g*1e3)}function c7(){return on.apply(null,arguments).parseZone()}function OD(g){return g}var $r=z.prototype;$r.calendar=P,$r.longDateFormat=ye,$r.invalidDate=we,$r.ordinal=Qe,$r.preparse=OD,$r.postformat=OD,$r.relativeTime=Q,$r.pastFuture=xe,$r.set=B,$r.eras=$9,$r.erasParse=O9,$r.erasConvertYear=R9,$r.erasAbbrRegex=H9,$r.erasNameRegex=z9,$r.erasNarrowRegex=G9,$r.months=kr,$r.monthsShort=In,$r.monthsParse=ls,$r.monthsRegex=N6,$r.monthsShortRegex=C6,$r.week=I6,$r.firstDayOfYear=k6,$r.firstDayOfWeek=B6,$r.weekdays=G6,$r.weekdaysMin=Y6,$r.weekdaysShort=W6,$r.weekdaysParse=Z6,$r.weekdaysRegex=K6,$r.weekdaysShortRegex=eq,$r.weekdaysMinRegex=tq,$r.isPM=nq,$r.meridiem=oq;function Pm(g,E,I,$){var H=fs(),ie=p().set($,E);return H[I](ie,g)}function RD(g,E,I){if(c(g)&&(E=g,g=void 0),g=g||"",E!=null)return Pm(g,E,I,"month");var $,H=[];for($=0;$<12;$++)H[$]=Pm(g,$,I,"month");return H}function Vy(g,E,I,$){typeof g=="boolean"?(c(E)&&(I=E,E=void 0),E=E||""):(E=g,I=E,g=!1,c(E)&&(I=E,E=void 0),E=E||"");var H=fs(),ie=g?H._week.dow:0,Me,mt=[];if(I!=null)return Pm(E,(I+ie)%7,$,"day");for(Me=0;Me<7;Me++)mt[Me]=Pm(E,(Me+ie)%7,$,"day");return mt}function f7(g,E){return RD(g,E,"months")}function p7(g,E){return RD(g,E,"monthsShort")}function m7(g,E,I){return Vy(g,E,I,"weekdays")}function d7(g,E,I){return Vy(g,E,I,"weekdaysShort")}function h7(g,E,I){return Vy(g,E,I,"weekdaysMin")}Xs("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 E=g%10,I=mr(g%100/10)===1?"th":E===1?"st":E===2?"nd":E===3?"rd":"th";return g+I}}),e.lang=M("moment.lang is deprecated. Use moment.locale instead.",Xs),e.langData=M("moment.langData is deprecated. Use moment.localeData instead.",fs);var ps=Math.abs;function g7(){var g=this._data;return this._milliseconds=ps(this._milliseconds),this._days=ps(this._days),this._months=ps(this._months),g.milliseconds=ps(g.milliseconds),g.seconds=ps(g.seconds),g.minutes=ps(g.minutes),g.hours=ps(g.hours),g.months=ps(g.months),g.years=ps(g.years),this}function LD(g,E,I,$){var H=yo(E,I);return g._milliseconds+=$*H._milliseconds,g._days+=$*H._days,g._months+=$*H._months,g._bubble()}function v7(g,E){return LD(this,g,E,1)}function y7(g,E){return LD(this,g,E,-1)}function VD(g){return g<0?Math.floor(g):Math.ceil(g)}function x7(){var g=this._milliseconds,E=this._days,I=this._months,$=this._data,H,ie,Me,mt,er;return g>=0&&E>=0&&I>=0||g<=0&&E<=0&&I<=0||(g+=VD(Uy(I)+E)*864e5,E=0,I=0),$.milliseconds=g%1e3,H=Un(g/1e3),$.seconds=H%60,ie=Un(H/60),$.minutes=ie%60,Me=Un(ie/60),$.hours=Me%24,E+=Un(Me/24),er=Un(UD(E)),I+=er,E-=VD(Uy(er)),mt=Un(I/12),I%=12,$.days=E,$.months=I,$.years=mt,this}function UD(g){return g*4800/146097}function Uy(g){return g*146097/4800}function b7(g){if(!this.isValid())return NaN;var E,I,$=this._milliseconds;if(g=re(g),g==="month"||g==="quarter"||g==="year")switch(E=this._days+$/864e5,I=this._months+UD(E),g){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(E=this._days+Math.round(Uy(this._months)),g){case"week":return E/7+$/6048e5;case"day":return E+$/864e5;case"hour":return E*24+$/36e5;case"minute":return E*1440+$/6e4;case"second":return E*86400+$/1e3;case"millisecond":return Math.floor(E*864e5)+$;default:throw new Error("Unknown unit "+g)}}function ms(g){return function(){return this.as(g)}}var qD=ms("ms"),w7=ms("s"),_7=ms("m"),S7=ms("h"),A7=ms("d"),E7=ms("w"),T7=ms("M"),M7=ms("Q"),D7=ms("y"),C7=qD;function N7(){return yo(this)}function F7(g){return g=re(g),this.isValid()?this[g+"s"]():NaN}function ju(g){return function(){return this.isValid()?this._data[g]:NaN}}var I7=ju("milliseconds"),P7=ju("seconds"),B7=ju("minutes"),k7=ju("hours"),$7=ju("days"),O7=ju("months"),R7=ju("years");function L7(){return Un(this.days()/7)}var ds=Math.round,Kl={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function V7(g,E,I,$,H){return H.relativeTime(E||1,!!I,g,$)}function U7(g,E,I,$){var H=yo(g).abs(),ie=ds(H.as("s")),Me=ds(H.as("m")),mt=ds(H.as("h")),er=ds(H.as("d")),Sr=ds(H.as("M")),ki=ds(H.as("w")),hs=ds(H.as("y")),Ks=ie<=I.ss&&["s",ie]||ie<I.s&&["ss",ie]||Me<=1&&["m"]||Me<I.m&&["mm",Me]||mt<=1&&["h"]||mt<I.h&&["hh",mt]||er<=1&&["d"]||er<I.d&&["dd",er];return I.w!=null&&(Ks=Ks||ki<=1&&["w"]||ki<I.w&&["ww",ki]),Ks=Ks||Sr<=1&&["M"]||Sr<I.M&&["MM",Sr]||hs<=1&&["y"]||["yy",hs],Ks[2]=E,Ks[3]=+g>0,Ks[4]=$,V7.apply(null,Ks)}function q7(g){return g===void 0?ds:typeof g=="function"?(ds=g,!0):!1}function z7(g,E){return Kl[g]===void 0?!1:E===void 0?Kl[g]:(Kl[g]=E,g==="s"&&(Kl.ss=E-1),!0)}function H7(g,E){if(!this.isValid())return this.localeData().invalidDate();var I=!1,$=Kl,H,ie;return typeof g=="object"&&(E=g,g=!1),typeof g=="boolean"&&(I=g),typeof E=="object"&&($=Object.assign({},Kl,E),E.s!=null&&E.ss==null&&($.ss=E.s-1)),H=this.localeData(),ie=U7(this,!I,$,H),I&&(ie=H.pastFuture(+this,ie)),H.postformat(ie)}var qy=Math.abs;function ec(g){return(g>0)-(g<0)||+g}function Bm(){if(!this.isValid())return this.localeData().invalidDate();var g=qy(this._milliseconds)/1e3,E=qy(this._days),I=qy(this._months),$,H,ie,Me,mt=this.asSeconds(),er,Sr,ki,hs;return mt?($=Un(g/60),H=Un($/60),g%=60,$%=60,ie=Un(I/12),I%=12,Me=g?g.toFixed(3).replace(/\.?0+$/,""):"",er=mt<0?"-":"",Sr=ec(this._months)!==ec(mt)?"-":"",ki=ec(this._days)!==ec(mt)?"-":"",hs=ec(this._milliseconds)!==ec(mt)?"-":"",er+"P"+(ie?Sr+ie+"Y":"")+(I?Sr+I+"M":"")+(E?ki+E+"D":"")+(H||$||g?"T":"")+(H?hs+H+"H":"")+($?hs+$+"M":"")+(g?hs+Me+"S":"")):"P0D"}var Er=Mm.prototype;Er.isValid=Oq,Er.abs=g7,Er.add=v7,Er.subtract=y7,Er.as=b7,Er.asMilliseconds=qD,Er.asSeconds=w7,Er.asMinutes=_7,Er.asHours=S7,Er.asDays=A7,Er.asWeeks=E7,Er.asMonths=T7,Er.asQuarters=M7,Er.asYears=D7,Er.valueOf=C7,Er._bubble=x7,Er.clone=N7,Er.get=F7,Er.milliseconds=I7,Er.seconds=P7,Er.minutes=B7,Er.hours=k7,Er.days=$7,Er.weeks=L7,Er.months=O7,Er.years=R7,Er.humanize=H7,Er.toISOString=Bm,Er.toString=Bm,Er.toJSON=Bm,Er.locale=DD,Er.localeData=ND,Er.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Bm),Er.lang=CD,L("X",0,0,"unix"),L("x",0,0,"valueOf"),Re("x",$e),Re("X",G),Br("X",function(g,E,I){I._d=new Date(parseFloat(g)*1e3)}),Br("x",function(g,E,I){I._d=new Date(mr(g))});return e.version="2.30.1",t(on),e.fn=Ze,e.min=Pq,e.max=Bq,e.now=kq,e.utc=p,e.unix=l7,e.months=f7,e.isDate=s,e.locale=Xs,e.invalid=b,e.duration=yo,e.isMoment=y,e.weekdays=m7,e.parseZone=c7,e.localeData=fs,e.isDuration=Dm,e.monthsShort=p7,e.weekdaysMin=h7,e.defineLocale=Cy,e.updateLocale=cq,e.locales=fq,e.weekdaysShort=d7,e.normalizeUnits=re,e.relativeTimeRounding=q7,e.relativeTimeThreshold=z7,e.calendarFormat=o9,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 Qm=zn(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.P_HELPERS=Ji.ParserHelpers=Ji.validateRegexFlags=Ji.validateRange=Ji.getIndex=Ji.arrayUnion=void 0;var Qy=Km();function nz(r,e){if(r===void 0&&e===void 0)return;if(r===void 0)return e;if(e===void 0)return r;let t=[...r];for(let n of e)t.includes(n)||t.push(n);return t}Ji.arrayUnion=nz;function iz(r){return r===void 0?-1:r.index}Ji.getIndex=iz;function az(r,e){if(e<r)throw new Error(`Invalid Range: max might not be smaller than min. Received [${r}, ${e}].`);if(r<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${r}, ${e}].`);if(r===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${r}, ${e}].`);if(!Number.isInteger(r)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${r}, ${e}].`)}Ji.validateRange=az;function oz(r){for(let e of r)if(e!=="i"&&e!=="m"&&e!=="s"&&e!=="u")throw new Error(`RegExp flag '${e}' is not allowed. The only allowed flags are 'i', 'm', 's' and 'u'.`)}Ji.validateRegexFlags=oz;var Xm=class{followedBy(e){return new Qy.Parser(function(n){return e.p(n.copy())})}notFollowedBy(e){return new Qy.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 Qy.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}`)})}};Ji.ParserHelpers=Xm;Ji.P_HELPERS=new Xm});var rC=zn(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.ParserContext=void 0;var Ky=Qm(),ex=class r{constructor(e,t){this.input=e,this.position=t}moveToPosition(e){return this.position=e,this}copy(){return new r(this.input,{index:this.position.index,column:this.position.column,line:this.position.line})}getPosition(){return{index:this.position.index,column:this.position.column,line:this.position.line}}atEOF(){return this.position.index>=this.input.length}advanceTo(e){if(e<this.position.index)throw new Error(`Can not advance backwards. Current pos ${this.position.index}. Advance target index ${e}.`);if(e!==this.position.index){for(let t=this.position.index;t<e;t++)this.input[t]===`
`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,t){return this.succeedAt(this.position.index+e,t)}failOffset(e,t){return this.failAt(this.position.index+e,t)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,t){return this.advanceTo(e),{success:!0,value:t,furthest:void 0,expected:void 0}}failAt(e,t){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(t)?t:[t]}}merge(e,t){if(e===void 0)return t;let n=(0,Ky.getIndex)(e.furthest),i=(0,Ky.getIndex)(t.furthest);if(i>n)return t;let a=i===n?(0,Ky.arrayUnion)(e.expected,t.expected):e.expected;return t.furthest=e.furthest,t.expected=a,t}};ed.ParserContext=ex});var va=zn(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.P_UTILS=void 0;var td=Km(),jr=Xi(),tx=class r{static position(){return new td.Parser(e=>e.succeed(e.getPosition()))}static any(){return new td.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new td.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new td.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return jr.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return jr.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return jr.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return jr.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return jr.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return jr.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return jr.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return jr.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return jr.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return jr.P.regexp(/^\s+/).describe("whitespace")}static cr(){return jr.P.string("\r")}static lf(){return jr.P.string(`
`)}static crlf(){return jr.P.string(`\r
`)}static newline(){return jr.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,t,n){return jr.P.sequenceMap((i,a)=>i.reduce((o,u)=>n(u,o),a),e.many(),t)}static postfix(e,t,n){return jr.P.sequenceMap((i,a)=>a.reduce((o,u)=>n(u,o),i),t,e.many())}static binaryRight(e,t,n){return jr.P.sequenceMap((i,a)=>i.reverse().reduce((o,u)=>{let[c,s]=u;return n(c,s,o)},a),jr.P.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,n){return jr.P.sequenceMap((i,a)=>a.reduce((o,u)=>{let[c,s]=u;return n(o,c,s)},i),t,jr.P.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(e,t,n){return jr.P.sequenceMap((i,a,o)=>i.reverse().reduce((u,c)=>{let[s,l,f]=c;return n({from:s,to:o},l,f,u)},a),jr.P.sequence(r.position(),t,e.trim(this.optionalWhitespace())).many(),t,r.position())}static binaryLeftRange(e,t,n){return jr.P.sequenceMap((i,a,o)=>o.reduce((u,c)=>{let[s,l,f]=c;return n({from:i,to:f},u,s,l)},a),r.position(),t,jr.P.sequence(e.trim(this.optionalWhitespace()),t,r.position()).many())}static func(e,t,n){let i=typeof e=="string"?jr.P.string(e):e;return jr.P.sequenceMap((a,o,u,c,s,l)=>n(a,c),i,jr.P.string("("),this.optionalWhitespace(),t,this.optionalWhitespace(),jr.P.string(")"))}};rd.P_UTILS=tx});var iC=zn(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.ParsingError=sc.createParsingErrorMessage=void 0;function nC(r,e,t){let n=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${n} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(t){let o=r.split(`
`)[e.furthest.line-1],u=`${e.furthest.line} |   `;i+=`

${u}${o}`,i+=`
${" ".repeat(e.furthest.column-1+u.length)}^ (${n})`}return i}sc.createParsingErrorMessage=nC;var rx=class extends Error{constructor(e,t){super(nC(e,t,!0))}};sc.ParsingError=rx});var Km=zn(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.Parser=void 0;var sz=rC(),Va=Xi(),nx=Qm(),uc=va(),uz=iC(),ix=class r{constructor(e){this.p=e}tryParse(e){return this.p(new sz.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let t=this.tryParse(e);if(t.success)return t.value;throw new uz.ParsingError(e,t)}or(e){return Va.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(Va.P.string(e))}wrap(e,t){let n=this;return new r(function(a){let o=e.p(a);if(!o.success)return o;let u=a.merge(o,n.p(a));if(!u.success)return u;let c=a.merge(u,t.p(a));return c.success?a.merge(c,a.succeed(u.value)):c})}wrapString(e,t){return this.wrap(Va.P.string(e),Va.P.string(t))}then(e){let t=this;return new r(function(i){let a=t.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success,o})}skip(e){let t=this;return new r(function(i){let a=t.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success?i.merge(o,i.succeed(a.value)):o})}and(e){return Va.P.sequence(this,e)}many(){let e=this;return new r(function(n){let i,a=n.position.index,o=[];for(;;){let u=n.copy(),c=e.p(u);if(i=n.merge(i,c),i.success){if(u.position.index===a)throw new Error("infinite loop in many() parser detected");n.moveToPosition(u.position),o.push(i.value)}else return n.merge(i,n.succeed(o))}})}repeat(e,t){(0,nx.validateRange)(e,t);let n=this;return new r(function(a){let o,u,c=[],s=0;for(;s<e;s++)if(o=n.p(a),u=a.merge(u,o),o.success)c.push(o.value);else return u;for(;s<t;s++){let l=a.copy();if(o=n.p(l),u=a.merge(u,o),o.success)a.moveToPosition(l.position),c.push(o.value);else break}return a.merge(u,a.succeed(c))})}atMost(e){return this.repeat(0,e)}atLeast(e){return Va.P.sequenceMap((t,n)=>t.concat(n),this.repeat(e,e),this.many())}separateBy(e){return Va.P.separateBy(this,e)}separateByNotEmpty(e){return Va.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let t=this;return new r(function(i){let a=t.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return Va.P.sequenceMap(function(t,n,i){return{value:n,range:{from:t,to:i}}},uc.P_UTILS.position(),this,uc.P_UTILS.position())}namedMarker(e){return Va.P.sequenceMap(function(n,i,a){return{value:i,name:e,range:{from:n,to:a}}},uc.P_UTILS.position(),this,uc.P_UTILS.position())}node(e){return Va.P.sequenceMap(function(n,i,a){return e(i,{from:n,to:a})},uc.P_UTILS.position(),this,uc.P_UTILS.position())}followedBy(e){return this.skip(nx.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(nx.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let t=this;return new r(function(i){let a=t.p(i);return a.expected!==void 0&&a.expected.length!==0&&(a.expected=e),a})}box(e){let t=this;return new r(function(i){var a;let o=t.p(i);return o.expected!==void 0&&o.expected.length!==0&&(o.expected=[`(${(a=o.expected)===null||a===void 0?void 0:a.join(" or ")} as part of ${e})`]),o})}optional(e){return this.or(Va.P.succeed(e))}chain(e){let t=this;return new r(function(i){let a=t.p(i);if(!a.success)return a;let u=e(a.value).p(i);return i.merge(a,u)})}thenEof(){let e=this;return new r(function(n){let i=e.p(n);return i.success?n.atEOF()?i:n.merge(i,n.fail("eof")):i})}memorize(){let e=this,t="",n=new Map,i=new Map;return new r(function(o){let u=o.position.index;if(o.input!==t)t=o.input,n.clear(),i.clear();else{let s=n.get(u),l=i.get(u);if(s!==void 0&&l!==void 0)return o.moveToPosition(Object.assign({},l)),Object.assign({},s)}let c=e.p(o);return n.set(u,Object.assign({},c)),i.set(u,o.getPosition()),c})}};nd.Parser=ix});var Xi=zn(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.P=void 0;var ya=Km(),id=Qm(),ax=class r{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new ya.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let c=e[o].p(n);if(i=n.merge(i,c),!i.success)return i;a[o]=i.value}return i.value=a,i})}static sequenceMap(e,...t){if(t.length===0)throw new Error("sequenceMap must have at least one parser argument");return new ya.Parser(function(i){let a,o=new Array(t.length);for(let u=0;u<t.length;u++){let s=t[u].p(i);if(a=i.merge(a,s),!a.success)return a;o[u]=a.value}return a.value=e(...o),a})}static createLanguage(e){let t={},n={},i={};for(let a in e)i[a]=r.reference(()=>e[a](t,i)),Object.defineProperty(n,a,{get:()=>{if(t[a]!==void 0)return t[a];throw new Error(`Can not access rule '${a}' in language. Rule is not yet defined. Try to access it via 'ref'.`)}});for(let a in e)t[a]=e[a](n,i);return t}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new ya.Parser(function(n){let i;for(let a of e){let o=a,u=n.copy(),c=o.p(u);if(i=n.merge(i,c),i.success)return n.moveToPosition(u.position),i}return i})}static separateBy(e,t){return this.separateByNotEmpty(e,t).or(r.succeed([]))}static separateByNotEmpty(e,t){return this.sequenceMap(function(i,a){return a.unshift(i),a},e,t.then(e).many())}static string(e){let t="'"+e+"'";return new ya.Parser(function(i){for(let a=0;a<e.length;a++)if(i.input[i.position.index+a]!==e[a])return i.fail(t);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,t){(0,id.validateRegexFlags)(e.flags);let n=e.source;return t!==void 0?new ya.Parser(function(a){let o=a.input.slice(a.position.index),u=e.exec(o);if(u!==null){let c=t??0;if(c>=0&&c<=u.length){let l=u[0],f=u[c];return a.succeedOffset(l.length,f)}let s="expected valid match group (0 to "+u.length+") in "+n;return a.fail(s)}else return a.fail(n)}):new ya.Parser(function(a){let o=a.input.slice(a.position.index),u=e.exec(o);if(u!==null){let c=u[0];return a.succeedOffset(c.length,c)}else return a.fail(n)})}static succeed(e){return new ya.Parser(function(n){return n.succeed(e)})}static fail(e){return new ya.Parser(function(n){return n.fail(e)})}static oneOf(e){return id.P_HELPERS.test(function(n){return e.includes(n)}).describe(`one character of '${e}'`)}static noneOf(e){return id.P_HELPERS.test(function(n){return!e.includes(n)}).describe(`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(t=>this.string(t))).describe(e.map(t=>`'${t}'`).join(" or "))}static manyOf(e){return new ya.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 ya.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 ya.Parser(e)}static range(e,t){let n=e.charCodeAt(0),i=t.charCodeAt(0);return id.P_HELPERS.test(function(o){let u=o.charCodeAt(0);return n<=u&&u<=i}).describe(`${e}-${t}`)}static takeWhile(e){return new ya.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 ya.Parser(function(n){return e().p(n)})}};ad.P=ax});var zb=zn((Ub,qb)=>{(function(r,e){typeof Ub=="object"&&typeof qb<"u"?qb.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(Ub,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function o(j){return typeof j=="object"&&j!==null&&j.constructor===Object}let u=[{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}}],c={name:"any",test:r,isAny:!0},s,l,f=0,p={createCount:0};function m(j){let le=s.get(j);if(le)return le;let fe='Unknown type "'+j+'"',Pe=j.toLowerCase(),ke;for(ke of l)if(ke.toLowerCase()===Pe){fe+='. Did you mean "'+ke+'" ?';break}throw new TypeError(fe)}function d(j){let le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",fe=le?m(le).index:l.length,Pe=[];for(let Fe=0;Fe<j.length;++Fe){if(!j[Fe]||typeof j[Fe].name!="string"||typeof j[Fe].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let $e=j[Fe].name;if(s.has($e))throw new TypeError('Duplicate type name "'+$e+'"');Pe.push($e),s.set($e,{name:$e,test:j[Fe].test,isAny:j[Fe].isAny,index:fe+Fe,conversionsTo:[]})}let ke=l.slice(fe);l=l.slice(0,fe).concat(Pe).concat(ke);for(let Fe=fe+Pe.length;Fe<l.length;++Fe)s.get(l[Fe]).index=Fe}function h(){s=new Map,l=[],f=0,d([c],!1)}h(),d(u);function x(){let j;for(j of l)s.get(j).conversionsTo=[];f=0}function b(j){let le=l.filter(fe=>{let Pe=s.get(fe);return!Pe.isAny&&Pe.test(j)});return le.length?le:["any"]}function T(j){return j&&typeof j=="function"&&"_typedFunctionData"in j}function v(j,le,fe){if(!T(j))throw new TypeError(n);let Pe=fe&&fe.exact,ke=Array.isArray(le)?le.join(","):le,Fe=D(ke),$e=y(Fe);if(!Pe||$e in j.signatures){let ge=j._typedFunctionData.signatureMap.get($e);if(ge)return ge}let He=Fe.length,F;if(Pe){F=[];let ge;for(ge in j.signatures)F.push(j._typedFunctionData.signatureMap.get(ge))}else F=j._typedFunctionData.signatures;for(let ge=0;ge<He;++ge){let Ne=Fe[ge],ot=[],yt;for(yt of F){let Re=z(yt.params,ge);if(!(!Re||Ne.restParam&&!Re.restParam)){if(!Re.hasAny){let Xn=w(Re);if(Ne.types.some(Bi=>!Xn.has(Bi.name)))continue}ot.push(yt)}}if(F=ot,F.length===0)break}let G;for(G of F)if(G.params.length<=He)return G;throw new TypeError("Signature not found (signature: "+(j.name||"unnamed")+"("+y(Fe,", ")+"))")}function S(j,le,fe){return v(j,le,fe).implementation}function _(j,le){let fe=m(le);if(fe.test(j))return j;let Pe=fe.conversionsTo;if(Pe.length===0)throw new Error("There are no conversions to "+le+" defined.");for(let ke=0;ke<Pe.length;ke++)if(m(Pe[ke].from).test(j))return Pe[ke].convert(j);throw new Error("Cannot convert "+j+" to "+le)}function y(j){let le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return j.map(fe=>fe.name).join(le)}function A(j){let le=j.indexOf("...")===0,Pe=(le?j.length>3?j.slice(3):"any":j).split("|").map(He=>m(He.trim())),ke=!1,Fe=le?"...":"";return{types:Pe.map(function(He){return ke=He.isAny||ke,Fe+=He.name+"|",{name:He.name,typeIndex:He.index,test:He.test,isAny:He.isAny,conversion:null,conversionIndex:-1}}),name:Fe.slice(0,-1),hasAny:ke,hasConversion:!1,restParam:le}}function M(j){let le=j.types.map($e=>$e.name),fe=L(le),Pe=j.hasAny,ke=j.name,Fe=fe.map(function($e){let He=m($e.from);return Pe=He.isAny||Pe,ke+="|"+$e.from,{name:$e.from,typeIndex:He.index,test:He.test,isAny:He.isAny,conversion:$e,conversionIndex:$e.index}});return{types:j.types.concat(Fe),name:ke,hasAny:Pe,hasConversion:Fe.length>0,restParam:j.restParam}}function w(j){return j.typeSet||(j.typeSet=new Set,j.types.forEach(le=>j.typeSet.add(le.name))),j.typeSet}function D(j){let le=[];if(typeof j!="string")throw new TypeError("Signatures must be strings");let fe=j.trim();if(fe==="")return le;let Pe=fe.split(",");for(let ke=0;ke<Pe.length;++ke){let Fe=A(Pe[ke].trim());if(Fe.restParam&&ke!==Pe.length-1)throw new SyntaxError('Unexpected rest parameter "'+Pe[ke]+'": only allowed for the last parameter');if(Fe.types.length===0)return null;le.push(Fe)}return le}function N(j){let le=Y(j);return le?le.restParam:!1}function B(j){if(!j||j.types.length===0)return r;if(j.types.length===1)return m(j.types[0].name).test;if(j.types.length===2){let le=m(j.types[0].name).test,fe=m(j.types[1].name).test;return function(ke){return le(ke)||fe(ke)}}else{let le=j.types.map(function(fe){return m(fe.name).test});return function(Pe){for(let ke=0;ke<le.length;ke++)if(le[ke](Pe))return!0;return!1}}}function R(j){let le,fe,Pe;if(N(j)){le=Qe(j).map(B);let ke=le.length,Fe=B(Y(j)),$e=function(He){for(let F=ke;F<He.length;F++)if(!Fe(He[F]))return!1;return!0};return function(F){for(let G=0;G<le.length;G++)if(!le[G](F[G]))return!1;return $e(F)&&F.length>=ke+1}}else return j.length===0?function(Fe){return Fe.length===0}:j.length===1?(fe=B(j[0]),function(Fe){return fe(Fe[0])&&Fe.length===1}):j.length===2?(fe=B(j[0]),Pe=B(j[1]),function(Fe){return fe(Fe[0])&&Pe(Fe[1])&&Fe.length===2}):(le=j.map(B),function(Fe){for(let $e=0;$e<le.length;$e++)if(!le[$e](Fe[$e]))return!1;return Fe.length===le.length})}function z(j,le){return le<j.length?j[le]:N(j)?Y(j):null}function V(j,le){let fe=z(j,le);return fe?w(fe):new Set}function k(j){return j.conversion===null||j.conversion===void 0}function P(j,le){let fe=new Set;return j.forEach(Pe=>{let ke=V(Pe.params,le),Fe;for(Fe of ke)fe.add(Fe)}),fe.has("any")?["any"]:Array.from(fe)}function W(j,le,fe){let Pe,ke,Fe=j||"unnamed",$e=fe,He;for(He=0;He<le.length;He++){let Ne=[];if($e.forEach(ot=>{let yt=z(ot.params,He),Re=B(yt);(He<ot.params.length||N(ot.params))&&Re(le[He])&&Ne.push(ot)}),Ne.length===0){if(ke=P($e,He),ke.length>0){let ot=b(le[He]);return Pe=new TypeError("Unexpected type of argument in function "+Fe+" (expected: "+ke.join(" or ")+", actual: "+ot.join(" | ")+", index: "+He+")"),Pe.data={category:"wrongType",fn:Fe,index:He,actual:ot,expected:ke},Pe}}else $e=Ne}let F=$e.map(function(Ne){return N(Ne.params)?1/0:Ne.params.length});if(le.length<Math.min.apply(null,F))return ke=P($e,He),Pe=new TypeError("Too few arguments in function "+Fe+" (expected: "+ke.join(" or ")+", index: "+le.length+")"),Pe.data={category:"tooFewArgs",fn:Fe,index:le.length,expected:ke},Pe;let G=Math.max.apply(null,F);if(le.length>G)return Pe=new TypeError("Too many arguments in function "+Fe+" (expected: "+G+", actual: "+le.length+")"),Pe.data={category:"tooManyArgs",fn:Fe,index:le.length,expectedLength:G},Pe;let ge=[];for(let Ne=0;Ne<le.length;++Ne)ge.push(b(le[Ne]).join("|"));return Pe=new TypeError('Arguments of type "'+ge.join(", ")+'" do not match any of the defined signatures of function '+Fe+"."),Pe.data={category:"mismatch",actual:ge},Pe}function O(j){let le=l.length+1;for(let fe=0;fe<j.types.length;fe++)k(j.types[fe])&&(le=Math.min(le,j.types[fe].typeIndex));return le}function X(j){let le=f+1;for(let fe=0;fe<j.types.length;fe++)k(j.types[fe])||(le=Math.min(le,j.types[fe].conversionIndex));return le}function ne(j,le){if(j.hasAny){if(!le.hasAny)return 1}else if(le.hasAny)return-1;if(j.restParam){if(!le.restParam)return 1}else if(le.restParam)return-1;if(j.hasConversion){if(!le.hasConversion)return 1}else if(le.hasConversion)return-1;let fe=O(j)-O(le);if(fe<0)return-1;if(fe>0)return 1;let Pe=X(j)-X(le);return Pe<0?-1:Pe>0?1:0}function Z(j,le){let fe=j.params,Pe=le.params,ke=Y(fe),Fe=Y(Pe),$e=N(fe),He=N(Pe);if($e&&ke.hasAny){if(!He||!Fe.hasAny)return 1}else if(He&&Fe.hasAny)return-1;let F=0,G=0,ge;for(ge of fe)ge.hasAny&&++F,ge.hasConversion&&++G;let Ne=0,ot=0;for(ge of Pe)ge.hasAny&&++Ne,ge.hasConversion&&++ot;if(F!==Ne)return F-Ne;if($e&&ke.hasConversion){if(!He||!Fe.hasConversion)return 1}else if(He&&Fe.hasConversion)return-1;if(G!==ot)return G-ot;if($e){if(!He)return 1}else if(He)return-1;let yt=(fe.length-Pe.length)*($e?-1:1);if(yt!==0)return yt;let Re=[],Xn=0;for(let nn=0;nn<fe.length;++nn){let Un=ne(fe[nn],Pe[nn]);Re.push(Un),Xn+=Un}if(Xn!==0)return Xn;let Bi;for(Bi of Re)if(Bi!==0)return Bi;return 0}function L(j){if(j.length===0)return[];let le=j.map(m);j.length>1&&le.sort((ke,Fe)=>ke.index-Fe.index);let fe=le[0].conversionsTo;if(j.length===1)return fe;fe=fe.concat([]);let Pe=new Set(j);for(let ke=1;ke<le.length;++ke){let Fe;for(Fe of le[ke].conversionsTo)Pe.has(Fe.from)||(fe.push(Fe),Pe.add(Fe.from))}return fe}function pe(j,le){let fe=le;if(j.some(ke=>ke.hasConversion)){let ke=N(j),Fe=j.map(me);fe=function(){let He=[],F=ke?arguments.length-1:arguments.length;for(let G=0;G<F;G++)He[G]=Fe[G](arguments[G]);return ke&&(He[F]=arguments[F].map(Fe[F])),le.apply(this,He)}}let Pe=fe;if(N(j)){let ke=j.length-1;Pe=function(){return fe.apply(this,Q(arguments,0,ke).concat([Q(arguments,ke)]))}}return Pe}function me(j){let le,fe,Pe,ke,Fe=[],$e=[];switch(j.types.forEach(function(He){He.conversion&&(Fe.push(m(He.conversion.from).test),$e.push(He.conversion.convert))}),$e.length){case 0:return function(F){return F};case 1:return le=Fe[0],Pe=$e[0],function(F){return le(F)?Pe(F):F};case 2:return le=Fe[0],fe=Fe[1],Pe=$e[0],ke=$e[1],function(F){return le(F)?Pe(F):fe(F)?ke(F):F};default:return function(F){for(let G=0;G<$e.length;G++)if(Fe[G](F))return $e[G](F);return F}}}function oe(j){function le(fe,Pe,ke){if(Pe<fe.length){let Fe=fe[Pe],$e=[];if(Fe.restParam){let He=Fe.types.filter(k);He.length<Fe.types.length&&$e.push({types:He,name:"..."+He.map(F=>F.name).join("|"),hasAny:He.some(F=>F.isAny),hasConversion:!1,restParam:!0}),$e.push(Fe)}else $e=Fe.types.map(function(He){return{types:[He],name:He.name,hasAny:He.isAny,hasConversion:He.conversion,restParam:!1}});return J($e,function(He){return le(fe,Pe+1,ke.concat([He]))})}else return[ke]}return le(j,0,[])}function ve(j,le){let fe=Math.max(j.length,le.length);for(let He=0;He<fe;He++){let F=V(j,He),G=V(le,He),ge=!1,Ne;for(Ne of G)if(F.has(Ne)){ge=!0;break}if(!ge)return!1}let Pe=j.length,ke=le.length,Fe=N(j),$e=N(le);return Fe?$e?Pe===ke:ke>=Pe:$e?Pe>=ke:Pe===ke}function _e(j){return j.map(le=>qe(le)?Ae(le.referToSelf.callback):Te(le)?se(le.referTo.references,le.referTo.callback):le)}function ye(j,le,fe){let Pe=[],ke;for(ke of j){let Fe=fe[ke];if(typeof Fe!="number")throw new TypeError('No definition for referenced signature "'+ke+'"');if(Fe=le[Fe],typeof Fe!="function")return!1;Pe.push(Fe)}return Pe}function be(j,le,fe){let Pe=_e(j),ke=new Array(Pe.length).fill(!1),Fe=!0;for(;Fe;){Fe=!1;let $e=!0;for(let He=0;He<Pe.length;++He){if(ke[He])continue;let F=Pe[He];if(qe(F))Pe[He]=F.referToSelf.callback(fe),Pe[He].referToSelf=F.referToSelf,ke[He]=!0,$e=!1;else if(Te(F)){let G=ye(F.referTo.references,Pe,le);G?(Pe[He]=F.referTo.callback.apply(this,G),Pe[He].referTo=F.referTo,ke[He]=!0,$e=!1):Fe=!0}}if($e&&Fe)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return Pe}function we(j){let le=/\bthis(\(|\.signatures\b)/;Object.keys(j).forEach(fe=>{let Pe=j[fe];if(le.test(Pe.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 Ee(j,le){if(p.createCount++,Object.keys(le).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&we(le);let fe=[],Pe=[],ke={},Fe=[],$e;for($e in le){if(!Object.prototype.hasOwnProperty.call(le,$e))continue;let Ye=D($e);if(!Ye)continue;fe.forEach(function(Pn){if(ve(Pn,Ye))throw new TypeError('Conflicting signatures "'+y(Pn)+'" and "'+y(Ye)+'".')}),fe.push(Ye);let Vt=Pe.length;Pe.push(le[$e]);let kr=Ye.map(M),In;for(In of oe(kr)){let Pn=y(In);Fe.push({params:In,name:Pn,fn:Vt}),In.every(ls=>!ls.hasConversion)&&(ke[Pn]=Vt)}}Fe.sort(Z);let He=be(Pe,ke,Xe),F;for(F in ke)Object.prototype.hasOwnProperty.call(ke,F)&&(ke[F]=He[ke[F]]);let G=[],ge=new Map;for(F of Fe)ge.has(F.name)||(F.fn=He[F.fn],G.push(F),ge.set(F.name,F));let Ne=G[0]&&G[0].params.length<=2&&!N(G[0].params),ot=G[1]&&G[1].params.length<=2&&!N(G[1].params),yt=G[2]&&G[2].params.length<=2&&!N(G[2].params),Re=G[3]&&G[3].params.length<=2&&!N(G[3].params),Xn=G[4]&&G[4].params.length<=2&&!N(G[4].params),Bi=G[5]&&G[5].params.length<=2&&!N(G[5].params),nn=Ne&&ot&&yt&&Re&&Xn&&Bi;for(let Ye=0;Ye<G.length;++Ye)G[Ye].test=R(G[Ye].params);let Un=Ne?B(G[0].params[0]):e,mr=ot?B(G[1].params[0]):e,Js=yt?B(G[2].params[0]):e,Br=Re?B(G[3].params[0]):e,Yi=Xn?B(G[4].params[0]):e,Ra=Bi?B(G[5].params[0]):e,ga=Ne?B(G[0].params[1]):e,Dn=ot?B(G[1].params[1]):e,qn=yt?B(G[2].params[1]):e,ji=Re?B(G[3].params[1]):e,fn=Xn?B(G[4].params[1]):e,Qn=Bi?B(G[5].params[1]):e;for(let Ye=0;Ye<G.length;++Ye)G[Ye].implementation=pe(G[Ye].params,G[Ye].fn);let Cn=Ne?G[0].implementation:t,Zi=ot?G[1].implementation:t,Ff=yt?G[2].implementation:t,Wl=Re?G[3].implementation:t,ss=Xn?G[4].implementation:t,us=Bi?G[5].implementation:t,Yl=Ne?G[0].params.length:-1,Lo=ot?G[1].params.length:-1,vo=yt?G[2].params.length:-1,jl=Re?G[3].params.length:-1,Zl=Xn?G[4].params.length:-1,If=Bi?G[5].params.length:-1,Pf=nn?6:0,an=G.length,q=G.map(Ye=>Ye.test),ee=G.map(Ye=>Ye.implementation),Ie=function(){for(let Vt=Pf;Vt<an;Vt++)if(q[Vt](arguments))return ee[Vt].apply(this,arguments);return p.onMismatch(j,arguments,G)};function Xe(Ye,Vt){return arguments.length===Yl&&Un(Ye)&&ga(Vt)?Cn.apply(this,arguments):arguments.length===Lo&&mr(Ye)&&Dn(Vt)?Zi.apply(this,arguments):arguments.length===vo&&Js(Ye)&&qn(Vt)?Ff.apply(this,arguments):arguments.length===jl&&Br(Ye)&&ji(Vt)?Wl.apply(this,arguments):arguments.length===Zl&&Yi(Ye)&&fn(Vt)?ss.apply(this,arguments):arguments.length===If&&Ra(Ye)&&Qn(Vt)?us.apply(this,arguments):Ie.apply(this,arguments)}try{Object.defineProperty(Xe,"name",{value:j})}catch{}return Xe.signatures=ke,Xe._typedFunctionData={signatures:G,signatureMap:ge},Xe}function ze(j,le,fe){throw W(j,le,fe)}function Qe(j){return Q(j,0,j.length-1)}function Y(j){return j[j.length-1]}function Q(j,le,fe){return Array.prototype.slice.call(j,le,fe)}function xe(j,le){for(let fe=0;fe<j.length;fe++)if(le(j[fe]))return j[fe]}function J(j,le){return Array.prototype.concat.apply([],j.map(le))}function re(){let j=Qe(arguments).map(fe=>y(D(fe))),le=Y(arguments);if(typeof le!="function")throw new TypeError("Callback function expected as last argument");return se(j,le)}function se(j,le){return{referTo:{references:j,callback:le}}}function Ae(j){if(typeof j!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:j}}}function Te(j){return j&&typeof j.referTo=="object"&&Array.isArray(j.referTo.references)&&typeof j.referTo.callback=="function"}function qe(j){return j&&typeof j.referToSelf=="object"&&typeof j.referToSelf.callback=="function"}function Se(j,le){if(!j)return le;if(le&&le!==j){let fe=new Error("Function names do not match (expected: "+j+", actual: "+le+")");throw fe.data={actual:le,expected:j},fe}return j}function wt(j){let le;for(let fe in j)Object.prototype.hasOwnProperty.call(j,fe)&&(T(j[fe])||typeof j[fe].signature=="string")&&(le=Se(le,j[fe].name));return le}function Dt(j,le){let fe;for(fe in le)if(Object.prototype.hasOwnProperty.call(le,fe)){if(fe in j&&le[fe]!==j[fe]){let Pe=new Error('Signature "'+fe+'" is defined twice');throw Pe.data={signature:fe,sourceFunction:le[fe],destFunction:j[fe]},Pe}j[fe]=le[fe]}}let jt=p;p=function(j){let le=typeof j=="string",fe=le?1:0,Pe=le?j:"",ke={};for(let Fe=fe;Fe<arguments.length;++Fe){let $e=arguments[Fe],He={},F;if(typeof $e=="function"?(F=$e.name,typeof $e.signature=="string"?He[$e.signature]=$e:T($e)&&(He=$e.signatures)):o($e)&&(He=$e,le||(F=wt($e))),Object.keys(He).length===0){let G=new TypeError("Argument to 'typed' at index "+Fe+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw G.data={index:Fe,argument:$e},G}le||(Pe=Se(Pe,F)),Dt(ke,He)}return Ee(Pe||"",ke)},p.create=i,p.createCount=jt.createCount,p.onMismatch=ze,p.throwMismatchError=ze,p.createError=W,p.clear=h,p.clearConversions=x,p.addTypes=d,p._findType=m,p.referTo=re,p.referToSelf=Ae,p.convert=_,p.findSignature=v,p.find=S,p.isTypedFunction=T,p.warnAgainstDeprecatedThis=!0,p.addType=function(j,le){let fe="any";le!==!1&&s.has("Object")&&(fe="Object"),p.addTypes([j],fe)};function Tt(j){if(!j||typeof j.from!="string"||typeof j.to!="string"||typeof j.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(j.to===j.from)throw new SyntaxError('Illegal to define conversion from "'+j.from+'" to itself.')}return p.addConversion=function(j){let le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};Tt(j);let fe=m(j.to),Pe=fe.conversionsTo.find(ke=>ke.from===j.from);if(Pe)if(le&&le.override)p.removeConversion({from:Pe.from,to:j.to,convert:Pe.convert});else throw new Error('There is already a conversion from "'+j.from+'" to "'+fe.name+'"');fe.conversionsTo.push({from:j.from,convert:j.convert,index:f++})},p.addConversions=function(j,le){j.forEach(fe=>p.addConversion(fe,le))},p.removeConversion=function(j){Tt(j);let le=m(j.to),fe=xe(le.conversionsTo,ke=>ke.from===j.from);if(!fe)throw new Error("Attempt to remove nonexistent conversion from "+j.from+" to "+j.to);if(fe.convert!==j.convert)throw new Error("Conversion to remove does not match existing conversion");let Pe=le.conversionsTo.indexOf(fe);le.conversionsTo.splice(Pe,1)},p.resolve=function(j,le){if(!T(j))throw new TypeError(n);let fe=j._typedFunctionData.signatures;for(let Pe=0;Pe<fe.length;++Pe)if(fe[Pe].test(le))return fe[Pe];return null},p}var a=i();return a})});var C2=zn((n0,D2)=>{(function(r){"use strict";var e=Math.cosh||function(s){return Math.abs(s)<1e-9?1-s:(Math.exp(s)+Math.exp(-s))*.5},t=Math.sinh||function(s){return Math.abs(s)<1e-9?s:(Math.exp(s)-Math.exp(-s))*.5},n=function(s){var l=Math.PI/4;if(-l>s||s>l)return Math.cos(s)-1;var f=s*s;return f*(f*(f*(f*(f*(f*(f*(f/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(s,l){var f=Math.abs(s),p=Math.abs(l);return f<3e3&&p<3e3?Math.sqrt(f*f+p*p):(f<p?(f=p,p=s/l):p=l/s,f*Math.sqrt(1+p*p))},a=function(){throw SyntaxError("Invalid Param")};function o(s,l){var f=Math.abs(s),p=Math.abs(l);return s===0?Math.log(p):l===0?Math.log(f):f<3e3&&p<3e3?Math.log(s*s+l*l)*.5:(s=s/2,l=l/2,.5*Math.log(s*s+l*l)+Math.LN2)}var u=function(s,l){var f={re:0,im:0};if(s==null)f.re=f.im=0;else if(l!==void 0)f.re=s,f.im=l;else switch(typeof s){case"object":if("im"in s&&"re"in s)f.re=s.re,f.im=s.im;else if("abs"in s&&"arg"in s){if(!Number.isFinite(s.abs)&&Number.isFinite(s.arg))return c.INFINITY;f.re=s.abs*Math.cos(s.arg),f.im=s.abs*Math.sin(s.arg)}else if("r"in s&&"phi"in s){if(!Number.isFinite(s.r)&&Number.isFinite(s.phi))return c.INFINITY;f.re=s.r*Math.cos(s.phi),f.im=s.r*Math.sin(s.phi)}else s.length===2?(f.re=s[0],f.im=s[1]):a();break;case"string":f.im=f.re=0;var p=s.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),m=1,d=0;p===null&&a();for(var h=0;h<p.length;h++){var x=p[h];x===" "||x==="	"||x===`
`||(x==="+"?m++:x==="-"?d++:x==="i"||x==="I"?(m+d===0&&a(),p[h+1]!==" "&&!isNaN(p[h+1])?(f.im+=parseFloat((d%2?"-":"")+p[h+1]),h++):f.im+=parseFloat((d%2?"-":"")+"1"),m=d=0):((m+d===0||isNaN(x))&&a(),p[h+1]==="i"||p[h+1]==="I"?(f.im+=parseFloat((d%2?"-":"")+x),h++):f.re+=parseFloat((d%2?"-":"")+x),m=d=0))}m+d>0&&a();break;case"number":f.im=0,f.re=s;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function c(s,l){if(!(this instanceof c))return new c(s,l);var f=u(s,l);this.re=f.re,this.im=f.im}c.prototype={re:0,im:0,sign:function(){var s=this.abs();return new c(this.re/s,this.im/s)},add:function(s,l){var f=new c(s,l);return this.isInfinite()&&f.isInfinite()?c.NAN:this.isInfinite()||f.isInfinite()?c.INFINITY:new c(this.re+f.re,this.im+f.im)},sub:function(s,l){var f=new c(s,l);return this.isInfinite()&&f.isInfinite()?c.NAN:this.isInfinite()||f.isInfinite()?c.INFINITY:new c(this.re-f.re,this.im-f.im)},mul:function(s,l){var f=new c(s,l);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?c.NAN:this.isInfinite()||f.isInfinite()?c.INFINITY:f.im===0&&this.im===0?new c(this.re*f.re,0):new c(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(s,l){var f=new c(s,l);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return c.NAN;if(this.isInfinite()||f.isZero())return c.INFINITY;if(this.isZero()||f.isInfinite())return c.ZERO;s=this.re,l=this.im;var p=f.re,m=f.im,d,h;return m===0?new c(s/p,l/p):Math.abs(p)<Math.abs(m)?(h=p/m,d=p*h+m,new c((s*h+l)/d,(l*h-s)/d)):(h=m/p,d=m*h+p,new c((s+l*h)/d,(l-s*h)/d))},pow:function(s,l){var f=new c(s,l);if(s=this.re,l=this.im,f.isZero())return c.ONE;if(f.im===0){if(l===0&&s>0)return new c(Math.pow(s,f.re),0);if(s===0)switch((f.re%4+4)%4){case 0:return new c(Math.pow(l,f.re),0);case 1:return new c(0,Math.pow(l,f.re));case 2:return new c(-Math.pow(l,f.re),0);case 3:return new c(0,-Math.pow(l,f.re))}}if(s===0&&l===0&&f.re>0&&f.im>=0)return c.ZERO;var p=Math.atan2(l,s),m=o(s,l);return s=Math.exp(f.re*m-f.im*p),l=f.im*m+f.re*p,new c(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){var s=this.re,l=this.im,f=this.abs(),p,m;if(s>=0){if(l===0)return new c(Math.sqrt(s),0);p=.5*Math.sqrt(2*(f+s))}else p=Math.abs(l)/Math.sqrt(2*(f-s));return s<=0?m=.5*Math.sqrt(2*(f-s)):m=Math.abs(l)/Math.sqrt(2*(f+s)),new c(p,l<0?-m:m)},exp:function(){var s=Math.exp(this.re);return this.im,new c(s*Math.cos(this.im),s*Math.sin(this.im))},expm1:function(){var s=this.re,l=this.im;return new c(Math.expm1(s)*Math.cos(l)+n(l),Math.exp(s)*Math.sin(l))},log:function(){var s=this.re,l=this.im;return l===0&&s>0,new c(o(s,l),Math.atan2(l,s))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var s=this.re,l=this.im;return new c(Math.sin(s)*e(l),Math.cos(s)*t(l))},cos:function(){var s=this.re,l=this.im;return new c(Math.cos(s)*e(l),-Math.sin(s)*t(l))},tan:function(){var s=2*this.re,l=2*this.im,f=Math.cos(s)+e(l);return new c(Math.sin(s)/f,t(l)/f)},cot:function(){var s=2*this.re,l=2*this.im,f=Math.cos(s)-e(l);return new c(-Math.sin(s)/f,t(l)/f)},sec:function(){var s=this.re,l=this.im,f=.5*e(2*l)+.5*Math.cos(2*s);return new c(Math.cos(s)*e(l)/f,Math.sin(s)*t(l)/f)},csc:function(){var s=this.re,l=this.im,f=.5*e(2*l)-.5*Math.cos(2*s);return new c(Math.sin(s)*e(l)/f,-Math.cos(s)*t(l)/f)},asin:function(){var s=this.re,l=this.im,f=new c(l*l-s*s+1,-2*s*l).sqrt(),p=new c(f.re-l,f.im+s).log();return new c(p.im,-p.re)},acos:function(){var s=this.re,l=this.im,f=new c(l*l-s*s+1,-2*s*l).sqrt(),p=new c(f.re-l,f.im+s).log();return new c(Math.PI/2-p.im,p.re)},atan:function(){var s=this.re,l=this.im;if(s===0){if(l===1)return new c(0,1/0);if(l===-1)return new c(0,-1/0)}var f=s*s+(1-l)*(1-l),p=new c((1-l*l-s*s)/f,-2*s/f).log();return new c(-.5*p.im,.5*p.re)},acot:function(){var s=this.re,l=this.im;if(l===0)return new c(Math.atan2(1,s),0);var f=s*s+l*l;return f!==0?new c(s/f,-l/f).atan():new c(s!==0?s/0:0,l!==0?-l/0:0).atan()},asec:function(){var s=this.re,l=this.im;if(s===0&&l===0)return new c(0,1/0);var f=s*s+l*l;return f!==0?new c(s/f,-l/f).acos():new c(s!==0?s/0:0,l!==0?-l/0:0).acos()},acsc:function(){var s=this.re,l=this.im;if(s===0&&l===0)return new c(Math.PI/2,1/0);var f=s*s+l*l;return f!==0?new c(s/f,-l/f).asin():new c(s!==0?s/0:0,l!==0?-l/0:0).asin()},sinh:function(){var s=this.re,l=this.im;return new c(t(s)*Math.cos(l),e(s)*Math.sin(l))},cosh:function(){var s=this.re,l=this.im;return new c(e(s)*Math.cos(l),t(s)*Math.sin(l))},tanh:function(){var s=2*this.re,l=2*this.im,f=e(s)+Math.cos(l);return new c(t(s)/f,Math.sin(l)/f)},coth:function(){var s=2*this.re,l=2*this.im,f=e(s)-Math.cos(l);return new c(t(s)/f,-Math.sin(l)/f)},csch:function(){var s=this.re,l=this.im,f=Math.cos(2*l)-e(2*s);return new c(-2*t(s)*Math.cos(l)/f,2*e(s)*Math.sin(l)/f)},sech:function(){var s=this.re,l=this.im,f=Math.cos(2*l)+e(2*s);return new c(2*e(s)*Math.cos(l)/f,-2*t(s)*Math.sin(l)/f)},asinh:function(){var s=this.im;this.im=-this.re,this.re=s;var l=this.asin();return this.re=-this.im,this.im=s,s=l.re,l.re=-l.im,l.im=s,l},acosh:function(){var s=this.acos();if(s.im<=0){var l=s.re;s.re=-s.im,s.im=l}else{var l=s.im;s.im=-s.re,s.re=l}return s},atanh:function(){var s=this.re,l=this.im,f=s>1&&l===0,p=1-s,m=1+s,d=p*p+l*l,h=d!==0?new c((m*p-l*l)/d,(l*p+m*l)/d):new c(s!==-1?s/0:0,l!==0?l/0:0),x=h.re;return h.re=o(h.re,h.im)/2,h.im=Math.atan2(h.im,x)/2,f&&(h.im=-h.im),h},acoth:function(){var s=this.re,l=this.im;if(s===0&&l===0)return new c(0,Math.PI/2);var f=s*s+l*l;return f!==0?new c(s/f,-l/f).atanh():new c(s!==0?s/0:0,l!==0?-l/0:0).atanh()},acsch:function(){var s=this.re,l=this.im;if(l===0)return new c(s!==0?Math.log(s+Math.sqrt(s*s+1)):1/0,0);var f=s*s+l*l;return f!==0?new c(s/f,-l/f).asinh():new c(s!==0?s/0:0,l!==0?-l/0:0).asinh()},asech:function(){var s=this.re,l=this.im;if(this.isZero())return c.INFINITY;var f=s*s+l*l;return f!==0?new c(s/f,-l/f).acosh():new c(s!==0?s/0:0,l!==0?-l/0:0).acosh()},inverse:function(){if(this.isZero())return c.INFINITY;if(this.isInfinite())return c.ZERO;var s=this.re,l=this.im,f=s*s+l*l;return new c(s/f,-l/f)},conjugate:function(){return new c(this.re,-this.im)},neg:function(){return new c(-this.re,-this.im)},ceil:function(s){return s=Math.pow(10,s||0),new c(Math.ceil(this.re*s)/s,Math.ceil(this.im*s)/s)},floor:function(s){return s=Math.pow(10,s||0),new c(Math.floor(this.re*s)/s,Math.floor(this.im*s)/s)},round:function(s){return s=Math.pow(10,s||0),new c(Math.round(this.re*s)/s,Math.round(this.im*s)/s)},equals:function(s,l){var f=new c(s,l);return Math.abs(f.re-this.re)<=c.EPSILON&&Math.abs(f.im-this.im)<=c.EPSILON},clone:function(){return new c(this.re,this.im)},toString:function(){var s=this.re,l=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(s)<c.EPSILON&&(s=0),Math.abs(l)<c.EPSILON&&(l=0),l===0?f+s:(s!==0?(f+=s,f+=" ",l<0?(l=-l,f+="-"):f+="+",f+=" "):l<0&&(l=-l,f+="-"),l!==1&&(f+=l),f+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},c.ZERO=new c(0,0),c.ONE=new c(1,0),c.I=new c(0,1),c.PI=new c(Math.PI,0),c.E=new c(Math.E,0),c.INFINITY=new c(1/0,1/0),c.NAN=new c(NaN,NaN),c.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return c}):typeof n0=="object"?(Object.defineProperty(c,"__esModule",{value:!0}),c.default=c,c.Complex=c,D2.exports=c):r.Complex=c})(n0)});var nk=zn((Gke,rk)=>{rk.exports=function r(e,t){"use strict";var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,u=/^0/,c=function(v){return r.insensitive&&(""+v).toLowerCase()||""+v},s=c(e).replace(i,"")||"",l=c(t).replace(i,"")||"",f=s.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=l.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(s.match(o),16)||f.length!==1&&s.match(a)&&Date.parse(s),d=parseInt(l.match(o),16)||m&&l.match(a)&&Date.parse(l)||null,h,x;if(d){if(m<d)return-1;if(m>d)return 1}for(var b=0,T=Math.max(f.length,p.length);b<T;b++){if(h=!(f[b]||"").match(u)&&parseFloat(f[b])||f[b]||0,x=!(p[b]||"").match(u)&&parseFloat(p[b])||p[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 s$=zn((m4e,o$)=>{"use strict";var MS=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Jee={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},Xee={"\u2013":"\\--","\u2014":"\\---"," ":"~","	":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},Qee=function(e,t){return MS({},e,t)};o$.exports=function(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.preserveFormatting,n=t===void 0?!1:t,i=e.escapeMapFn,a=i===void 0?Qee:i,o=String(r),u="",c=a(MS({},Jee),n?MS({},Xee):{}),s=Object.keys(c),l=function(){var p=!1;s.forEach(function(m,d){p||o.length>=m.length&&o.slice(0,m.length)===m&&(u+=c[s[d]],o=o.slice(m.length,o.length),p=!0)}),p||(u+=o.slice(0,1),o=o.slice(1,o.length))};o;)l();return u}});var R4=zn((O4,DA)=>{(function(r,e,t){function n(u){var c=this,s=o();c.next=function(){var l=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=l-(c.c=l|0)},c.c=1,c.s0=s(" "),c.s1=s(" "),c.s2=s(" "),c.s0-=s(u),c.s0<0&&(c.s0+=1),c.s1-=s(u),c.s1<0&&(c.s1+=1),c.s2-=s(u),c.s2<0&&(c.s2+=1),s=null}function i(u,c){return c.c=u.c,c.s0=u.s0,c.s1=u.s1,c.s2=u.s2,c}function a(u,c){var s=new n(u),l=c&&c.state,f=s.next;return f.int32=function(){return s.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,l&&(typeof l=="object"&&i(l,s),f.state=function(){return i(s,{})}),f}function o(){var u=4022871197,c=function(s){s=String(s);for(var l=0;l<s.length;l++){u+=s.charCodeAt(l);var f=.02519603282416938*u;u=f>>>0,f-=u,f*=u,u=f>>>0,f-=u,u+=f*4294967296}return(u>>>0)*23283064365386963e-26};return c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.alea=a})(O4,typeof DA=="object"&&DA,typeof define=="function"&&define)});var V4=zn((L4,CA)=>{(function(r,e,t){function n(o){var u=this,c="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var l=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^l^l>>>8},o===(o|0)?u.x=o:c+=o;for(var s=0;s<c.length+64;s++)u.x^=c.charCodeAt(s)|0,u.next()}function i(o,u){return u.x=o.x,u.y=o.y,u.z=o.z,u.w=o.w,u}function a(o,u){var c=new n(o),s=u&&u.state,l=function(){return(c.next()>>>0)/4294967296};return l.double=function(){do var f=c.next()>>>11,p=(c.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},l.int32=c.next,l.quick=l,s&&(typeof s=="object"&&i(s,c),l.state=function(){return i(c,{})}),l}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor128=a})(L4,typeof CA=="object"&&CA,typeof define=="function"&&define)});var q4=zn((U4,NA)=>{(function(r,e,t){function n(o){var u=this,c="";u.next=function(){var l=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(l^l<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,o===(o|0)?u.x=o:c+=o;for(var s=0;s<c.length+64;s++)u.x^=c.charCodeAt(s)|0,s==c.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function i(o,u){return u.x=o.x,u.y=o.y,u.z=o.z,u.w=o.w,u.v=o.v,u.d=o.d,u}function a(o,u){var c=new n(o),s=u&&u.state,l=function(){return(c.next()>>>0)/4294967296};return l.double=function(){do var f=c.next()>>>11,p=(c.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},l.int32=c.next,l.quick=l,s&&(typeof s=="object"&&i(s,c),l.state=function(){return i(c,{})}),l}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorwow=a})(U4,typeof NA=="object"&&NA,typeof define=="function"&&define)});var H4=zn((z4,FA)=>{(function(r,e,t){function n(o){var u=this;u.next=function(){var s=u.x,l=u.i,f,p,m;return f=s[l],f^=f>>>7,p=f^f<<24,f=s[l+1&7],p^=f^f>>>10,f=s[l+3&7],p^=f^f>>>3,f=s[l+4&7],p^=f^f<<7,f=s[l+7&7],f=f^f<<13,p^=f^f<<9,s[l]=p,u.i=l+1&7,p};function c(s,l){var f,p,m=[];if(l===(l|0))p=m[0]=l;else for(l=""+l,f=0;f<l.length;++f)m[f&7]=m[f&7]<<15^l.charCodeAt(f)+m[f+1&7]<<13;for(;m.length<8;)m.push(0);for(f=0;f<8&&m[f]===0;++f);for(f==8?p=m[7]=-1:p=m[f],s.x=m,s.i=0,f=256;f>0;--f)s.next()}c(u,o)}function i(o,u){return u.x=o.x.slice(),u.i=o.i,u}function a(o,u){o==null&&(o=+new Date);var c=new n(o),s=u&&u.state,l=function(){return(c.next()>>>0)/4294967296};return l.double=function(){do var f=c.next()>>>11,p=(c.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},l.int32=c.next,l.quick=l,s&&(s.x&&i(s,c),l.state=function(){return i(c,{})}),l}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorshift7=a})(z4,typeof FA=="object"&&FA,typeof define=="function"&&define)});var W4=zn((G4,IA)=>{(function(r,e,t){function n(o){var u=this;u.next=function(){var s=u.w,l=u.X,f=u.i,p,m;return u.w=s=s+1640531527|0,m=l[f+34&127],p=l[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,m=l[f]=m^p,u.i=f,m+(s^s>>>16)|0};function c(s,l){var f,p,m,d,h,x=[],b=128;for(l===(l|0)?(p=l,l=null):(l=l+"\0",p=0,b=Math.max(b,l.length)),m=0,d=-32;d<b;++d)l&&(p^=l.charCodeAt((d+32)%l.length)),d===0&&(h=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,d>=0&&(h=h+1640531527|0,f=x[d&127]^=p+h,m=f==0?m+1:0);for(m>=128&&(x[(l&&l.length||0)&127]=-1),m=127,d=4*128;d>0;--d)p=x[m+34&127],f=x[m=m+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,x[m]=p^f;s.w=h,s.X=x,s.i=m}c(u,o)}function i(o,u){return u.i=o.i,u.w=o.w,u.X=o.X.slice(),u}function a(o,u){o==null&&(o=+new Date);var c=new n(o),s=u&&u.state,l=function(){return(c.next()>>>0)/4294967296};return l.double=function(){do var f=c.next()>>>11,p=(c.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},l.int32=c.next,l.quick=l,s&&(s.X&&i(s,c),l.state=function(){return i(c,{})}),l}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor4096=a})(G4,typeof IA=="object"&&IA,typeof define=="function"&&define)});var j4=zn((Y4,PA)=>{(function(r,e,t){function n(o){var u=this,c="";u.next=function(){var l=u.b,f=u.c,p=u.d,m=u.a;return l=l<<25^l>>>7^f,f=f-p|0,p=p<<24^p>>>8^m,m=m-l|0,u.b=l=l<<20^l>>>12^f,u.c=f=f-p|0,u.d=p<<16^f>>>16^m,u.a=m-l|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,o===Math.floor(o)?(u.a=o/4294967296|0,u.b=o|0):c+=o;for(var s=0;s<c.length+20;s++)u.b^=c.charCodeAt(s)|0,u.next()}function i(o,u){return u.a=o.a,u.b=o.b,u.c=o.c,u.d=o.d,u}function a(o,u){var c=new n(o),s=u&&u.state,l=function(){return(c.next()>>>0)/4294967296};return l.double=function(){do var f=c.next()>>>11,p=(c.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},l.int32=c.next,l.quick=l,s&&(typeof s=="object"&&i(s,c),l.state=function(){return i(c,{})}),l}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.tychei=a})(Y4,typeof PA=="object"&&PA,typeof define=="function"&&define)});var J4=zn((Z4,Yg)=>{(function(r,e,t){var n=256,i=6,a=52,o="random",u=t.pow(n,i),c=t.pow(2,a),s=c*2,l=n-1,f;function p(v,S,_){var y=[];S=S==!0?{entropy:!0}:S||{};var A=x(h(S.entropy?[v,T(e)]:v??b(),3),y),M=new m(y),w=function(){for(var D=M.g(i),N=u,B=0;D<c;)D=(D+B)*n,N*=n,B=M.g(1);for(;D>=s;)D/=2,N/=2,B>>>=1;return(D+B)/N};return w.int32=function(){return M.g(4)|0},w.quick=function(){return M.g(4)/4294967296},w.double=w,x(T(M.S),e),(S.pass||_||function(D,N,B,R){return R&&(R.S&&d(R,M),D.state=function(){return d(M,{})}),B?(t[o]=D,N):D})(w,A,"global"in S?S.global:this==t,S.state)}function m(v){var S,_=v.length,y=this,A=0,M=y.i=y.j=0,w=y.S=[];for(_||(v=[_++]);A<n;)w[A]=A++;for(A=0;A<n;A++)w[A]=w[M=l&M+v[A%_]+(S=w[A])],w[M]=S;(y.g=function(D){for(var N,B=0,R=y.i,z=y.j,V=y.S;D--;)N=V[R=l&R+1],B=B*n+V[l&(V[R]=V[z=l&z+N])+(V[z]=N)];return y.i=R,y.j=z,B})(n)}function d(v,S){return S.i=v.i,S.j=v.j,S.S=v.S.slice(),S}function h(v,S){var _=[],y=typeof v,A;if(S&&y=="object")for(A in v)try{_.push(h(v[A],S-1))}catch{}return _.length?_:y=="string"?v:v+"\0"}function x(v,S){for(var _=v+"",y,A=0;A<_.length;)S[l&A]=l&(y^=S[l&A]*19)+_.charCodeAt(A++);return T(S)}function b(){try{var v;return f&&(v=f.randomBytes)?v=v(n):(v=new Uint8Array(n),(r.crypto||r.msCrypto).getRandomValues(v)),T(v)}catch{var S=r.navigator,_=S&&S.plugins;return[+new Date,r,_,r.screen,T(e)]}}function T(v){return String.fromCharCode.apply(0,v)}if(x(t.random(),e),typeof Yg=="object"&&Yg.exports){Yg.exports=p;try{f=require("crypto")}catch{}}else typeof define=="function"&&define.amd?define(function(){return p}):t["seed"+o]=p})(typeof self<"u"?self:Z4,[],Math)});var Q4=zn(($je,X4)=>{var hre=R4(),gre=V4(),vre=q4(),yre=H4(),xre=W4(),bre=j4(),Ol=J4();Ol.alea=hre;Ol.xor128=gre;Ol.xorwow=vre;Ol.xorshift7=yre;Ol.xor4096=xre;Ol.tychei=bre;X4.exports=Ol});var eoe={};J7(eoe,{MetaBindBuild:()=>sD,default:()=>Ay});module.exports=X7(eoe);var Ey=require("obsidian");var $i=(t=>(t.INLINE="inline",t.BLOCK="block",t))($i||{}),tc=(c=>(c.INPUT="INPUT",c.VIEW="VIEW",c.JS_VIEW="JS_VIEW",c.TABLE="TABLE",c.BUTTON_GROUP="BUTTON_GROUP",c.BUTTON="BUTTON",c.EMBED="EMBED",c.EXCLUDED="EXCLUDED",c))(tc||{}),eu=class{constructor(e){this.linePosition=e}getPosition(){return this.linePosition}};function $m(r){return r==="INPUT"||r==="VIEW"||r==="BUTTON_GROUP"}var tu=(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))(tu||{}),sn=(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))(sn||{}),Om={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:!1},progressBar:{type:"progressBar",allowInBlock:!0,allowInline:!1},inlineSelect:{type:"inlineSelect",allowInBlock:!0,allowInline:!0},list:{type:"list",allowInBlock:!0,allowInline:!1},listSuggester:{type:"listSuggester",allowInBlock:!0,allowInline:!1},inlineListSuggester:{type:"inlineListSuggester",allowInBlock:!0,allowInline:!0},inlineList:{type:"inlineList",allowInBlock:!0,allowInline:!0},imageListSuggester:{type:"imageListSuggester",allowInBlock:!0,allowInline:!1},dateTime:{type:"dateTime",allowInBlock:!0,allowInline:!0},invalid:{type:"invalid",allowInBlock:!1,allowInline:!1}};var Tr={addLabels:{type:"addLabels",allowedFieldTypes:["slider","progressBar"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},class:{type:"class",allowedFieldTypes:[],values:[[{name:"className",allowed:[],description:"the name of the css class to add"}]],allowMultiple:!0},defaultValue:{type:"defaultValue",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},maxValue:{type:"maxValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the maximally allowed value"}]],allowMultiple:!1},minValue:{type:"minValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the minimally allowed value"}]],allowMultiple:!1},stepSize:{type:"stepSize",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the step size for sliders"}]],allowMultiple:!1},offValue:{type:"offValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},onValue:{type:"onValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},option:{type:"option",allowedFieldTypes:["select","multiSelect","suggester","imageSuggester","inlineSelect","listSuggester","inlineListSuggester","imageListSuggester"],values:[[{name:"value",allowed:[],description:"the value and display name of the option"}],[{name:"value",allowed:[],description:"the value of the option"},{name:"name",allowed:[],description:"the display name of the option"}]],allowMultiple:!0},optionQuery:{type:"optionQuery",allowedFieldTypes:["suggester","imageSuggester","listSuggester","inlineListSuggester","imageListSuggester"],values:[[{name:"value",allowed:[],description:"the query for options"}]],allowMultiple:!0},placeholder:{type:"placeholder",allowedFieldTypes:["text","textArea","number","list","inlineList"],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},showcase:{type:"showcase",allowedFieldTypes:[],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},title:{type:"title",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},useLinks:{type:"useLinks",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","partial","false"],description:""}]],allowMultiple:!1},limit:{type:"limit",allowedFieldTypes:["text","textArea","list","inlineList"],values:[[{name:"value",allowed:["number"],description:"a character limit for text fields"}]],allowMultiple:!1},multiLine:{type:"multiLine",allowedFieldTypes:["list"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},allowOther:{type:"allowOther",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},Lf=(a=>(a.MATH="math",a.TEXT="text",a.LINK="link",a.IMAGE="image",a.INVALID="invalid",a))(Lf||{}),Zu=(i=>(i.RENDER_MARKDOWN="renderMarkdown",i.HIDDEN="hidden",i.CLASS="class",i.INVALID="invalid",i))(Zu||{}),rc={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}},Rm=8;var Hn=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 Hn{getErrorType(){return"MB_INTERNAL"}},xo=class extends Hn{getErrorType(){return"MB_PARSING"}},ru=class extends Hn{getErrorType(){return"MB_VALIDATION"}},Lm=class extends Hn{getErrorType(){return"MB_BIND_TARGET"}};var Vr=class extends Hn{getErrorType(){return"MB_ARGUMENT"}},gs=class extends Hn{getErrorType(){return"MB_JS"}},bo=class extends Hn{getErrorType(){return"MB_EXPRESSION"}};var Vf=class extends Hn{getErrorType(){return"MB_EXAMPLE"}};var vs=class extends Hn{getErrorType(){return"MB_BUTTON"}},Ju=class extends Hn{getErrorType(){return"MB_DEPENDENCY"}};var La=class{static get(e,t){return t.get(e).child}static tryGet(e,t){return t.tryGet(e)?.child}static fullGet(e,t){return t.get(e)}static set(e,t,n){t.set(e,n)}static setAndCreate(e,t,n){t.setAndCreate(e,n)}};var nc=class{constructor(e,t){this.id=e,this.manager=t,this.cache=new Map}validateStoragePath(e,t,n,i){return i.validateStoragePathAsFilePath(e,n)}resolveBindTargetScope(e,t,n){return e}createCacheItem(e){let t=this.cache.get(e);if(t!==void 0)throw new Ht({errorLevel:"CRITICAL",effect:"can not create cache item",cause:"cache item already exists"});return t=this.getDefaultCacheItem(e),this.cache.set(e,t),t}getOrCreateCacheItem(e){let t=this.getCacheItemForStoragePath(e);return t===void 0&&(t=this.getDefaultCacheItem(e),this.cache.set(e,t)),t}subscribe(e){if(e.bindTarget===void 0)throw new Ht({errorLevel:"CRITICAL",effect:"can not subscribe",cause:"subscription bind target undefined"});let t=this.getOrCreateCacheItem(e.bindTarget.storagePath);return t.subscriptions.push(e),t}unsubscribe(e){if(e.bindTarget===void 0)throw new Ht({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"subscription bind target undefined"});let t=this.cache.get(e.bindTarget.storagePath);if(t===void 0)throw new Ht({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"cache item does not exist"});return t.subscriptions=t.subscriptions.filter(n=>n.uuid!==e.uuid),t}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,t){let n=this.getOrCreateCacheItem(t.storagePath);return La.setAndCreate(n.data,t.storageProp,e),n}writeEntireCache(e,t){t.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 t=this.getCacheItemForStoragePath(e.storagePath);return t===void 0?La.tryGet(this.readExternal(e.storagePath),e.storageProp):this.readCacheItem(t,e.storageProp)}readCacheItem(e,t){return La.tryGet(e.data,t)}readEntireCacheItem(e){return e.data}};function Gn(r,e){let t=r.tryParse(e);if(t.success)return t.value;throw new Uf("ERROR","parsiNOM parser",e,t)}var Uf=class extends Hn{constructor(e,t,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=t,this.updateMessage2()}getErrorType(){return"MB_PARSINOM"}updateMessage2(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`;let t=this.str.split(`
`)[this.parseFailure.furthest.line-1],n=`${this.parseFailure.furthest.line} |   `;this.positionContext=`${n}${t}`,this.positionContext+=`
${this.getUnderline(n.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let t=" ".repeat(this.parseFailure.furthest.column+e-1),n=`^ (${this.cause})`;return t+n}},Bn=class extends Hn{constructor(e,t,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=t,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`,this.str&&this.position){let t=this.str.split(`
`)[this.position.from.line-1],n=`${this.position.from.line} |   `;this.positionContext=`${n}${t}`,this.positionContext+=`
${this.getUnderline(n.length,t.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,t){if(this.position===void 0)return"";let n=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:t,a="^".repeat(i-this.position.from.column);return n+a}};var Vm=class extends nc{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}async syncExternal(e){}},Um=class{constructor(e,t){this.id=e,this.manager=t,this.cache={data:{},...this.manager.getDefaultCacheItem()}}createCacheItem(e){return this.cache}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,t,n,i){if(t)throw new Bn("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""}resolveBindTargetScope(e,t,n){return e}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,t){return La.tryGet(e.data,t)}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(t=>t.uuid!==e.uuid),this.cache}writeCache(e,t){return La.setAndCreate(this.cache.data,t.storageProp,e),this.cache}writeEntireCache(e,t){t.data=e}readEntireCacheItem(e){return e.data}},qm=class{constructor(e,t){this.id=e,this.manager=t}createCacheItem(e){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}getOrCreateCacheItem(e){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}validateStoragePath(e,t,n,i){if(t)throw new Bn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",n,e.position);return""}resolveBindTargetScope(e,t,n){return n.resolveScope(e,t)}deleteCache(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,t){}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,t){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeEntireCache(e,t){}readEntireCacheItem(e){throw new Ht({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};function qf(r,e,t){return Math.min(Math.max(r,e),t)}function Hm(r,e,t){return r!==void 0?Math.min(Math.max(r,e),t):void 0}function zy(r,e,t,n,i){return(r-e)/(t-e)*(i-n)+n}function Hy(r,e){return(r%e+e)%e}function zm(r,e){if(r==null&&e==null)return!0;if(r==null||e==null||typeof r!=typeof e)return!1;if(typeof r=="object"&&typeof e=="object"){if(Array.isArray(r)&&Array.isArray(e)){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!zm(r[i],e[i]))return!1;return!0}let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;for(let i of t)if(!zm(r[i],e[i]))return!1;return!0}return r===e}function HD(r){return!!r}function Gy(r){if(r===void 0)return r;let e=Reflect.ownKeys(r);for(let t of e){let n=r[t];(n&&typeof n=="object"||typeof n=="function")&&Gy(n)}return Object.freeze(r)}function GD(r){return structuredClone(r)}function qr(){return window.crypto.randomUUID()}function ic(r){try{return new URL(r),!0}catch{return!1}}function Gm(r){window.open(r,"_blank")}function WD(r,e,t=", ",n="and"){return r.length===0?"":(r=r.map(e),r.length===1?r[0]:r.length===2?`${r[0]} ${n} ${r[1]}`:`${r.slice(0,-1).join(t)} ${n} ${r.slice(-1)}`)}function gi(r,e){r.innerHTML="",r.className="";let t=document.createElement("span");t.className="mb-warning mb-unloaded",t.innerText=`[MB_UNLOADED] ${e}`,r.appendChild(t)}var ct=class{static createElement(e,t,n){let i=document.createElement(t);return n?.text&&(i.innerText=n.text),n?.class&&(i.className=n.class),e.appendChild(i),i}static addClass(e,t){e.classList.add(...t.split(" "))}static addClasses(e,t){e.classList.add(...t)}static removeClass(e,t){e.classList.remove(...t.split(" "))}static hasClass(e,t){return e.classList.contains(t)}static removeAllClasses(e){e.className=""}static empty(e){for(;e.lastChild;)e.removeChild(e.lastChild)}};function Wy(...r){let e=r[0];for(let t=1;t<r.length;t++){let n=e.endsWith("/"),i=r[t].startsWith("/");n&&i?e=e.substring(0,e.length-1):!n&&!i&&(e+="/"),e+=r[t]}return e}function Yy(r,e){return e=e.startsWith(".")?e:"."+e,r.endsWith(e)?r:r+e}var Wm=class{constructor(e,t,n,i,a,o,u){this.uuid=e,this.callbackSignal=t,this.metadataManager=n,this.bindTarget=i,this.dependencies=a,this.dependencySubscriptions=[],this.computeFunction=o,this.onDelete=u,this.deleted=!1}init(){for(let e of this.dependencies){let t=this.uuid+"/"+qr();this.dependencySubscriptions.push(this.metadataManager.subscribe(t,e.callbackSignal,e.bindTarget,()=>this.delete())),e.callbackSignal.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){try{let e=this.dependencySubscriptions.map(n=>n.callbackSignal.get()),t=await this.computeFunction(e);this.callbackSignal.set(t),this.bindTarget!==void 0&&this.metadataManager.write(t,this.bindTarget,this.uuid)}catch(e){let t=e instanceof Error?e:String(e);console.warn(new Ht({errorLevel:"ERROR",effect:"Failed to compute value of computed subscription",cause:t}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}notify(e){}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var Ym=class{constructor(e,t,n,i,a){this.uuid=e,this.callbackSignal=t,this.metadataManager=n,this.bindTarget=i,this.onDelete=a,this.deleted=!1}unsubscribe(){this.metadataManager.unsubscribe(this)}update(e){this.metadataManager.write(e,this.bindTarget,this.uuid)}notify(e){try{this.callbackSignal.set(e)}catch(t){let n=t instanceof Error?t:String(t);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 YD=5,Q7=5*60;function jy(r,e){return r===void 0||e===void 0||r.storageType!==e.storageType||r.storagePath!==e.storagePath?!1:jD(r.storageProp,e.storageProp,e.listenToChildren)}function jD(r,e,t){let n=r.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?t:!0}function K7(r){return r===void 0?"undefined":`${r.storagePath}#${r.storageProp.toString()}`}var jm=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,t,n,i){let a=new Ym(e,t,this,n,i);return this.subscribeSubscription(a),a}subscribeComputed(e,t,n,i,a,o){let u=new Wm(e,t,this,n,i,a,o);return this.checkForLoops(u),u.init(),this.subscribeSubscription(u),u}unsubscribe(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new Ht({errorLevel:"ERROR",effect:"can not unsubscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=t.unsubscribe(e);n.subscriptions.length===0&&(n.inactive=!0)}subscribeSubscription(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new Ht({errorLevel:"ERROR",effect:"can not subscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=t.subscribe(e);n.inactive=!1,n.cyclesSinceInactive=0,e.notify(t.readCacheItem(n,e.bindTarget.storageProp))}checkForLoops(e){for(let t of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,t])}recCheckForLoops(e){let t=e.at(0),n=e.at(-1);if(!(n===void 0||t===void 0)){if(jy(t.bindTarget,n.bindTarget))throw new Lm({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${K7(i.bindTarget)}"`).join(" -> ")}`,docs:["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies"]});for(let i of this.getAllSubscriptionsToDependencies(n))this.recCheckForLoops([...e,i])}}getAllSubscriptionsToDependencies(e){return e.getDependencies().map(t=>this.getAllSubscriptionsToBindTarget(t.bindTarget)).flat()}getAllSubscriptionsToBindTarget(e){if(e===void 0)return[];let t=this.getCacheItemForBindTarget(e);if(!t)return[];let n=[];for(let i of t.subscriptions)jy(i.bindTarget,e)&&n.push(i);return t.subscriptions.filter(i=>jy(i.bindTarget,e))}getCacheItemForBindTarget(e){return this.getSource(e.storageType)?.getCacheItemForStoragePath(e.storagePath)}cycle(){for(let e of this.sources.values()){let t=[];for(let n of e.iterateCacheItems()){if(e.onCycle(n),n.pendingInternalChange){try{e.syncExternal(n)}catch(i){console.warn("failed to update frontmatter",i)}n.pendingInternalChange=!1}n.cyclesSinceInternalChange+=1,n.inactive&&(n.cyclesSinceInactive+=1),n.cyclesSinceInactive>Q7&&e.shouldDelete(n)&&t.push(n)}for(let n of t)e.deleteCache(n)}}write(e,t,n){let i=this.getSource(t.storageType);if(i===void 0)throw new Ht({errorLevel:"ERROR",effect:"can not write to cache",cause:`Source "${t.storageType}" does not exist`});let a=i.writeCache(e,t);a.pendingInternalChange=!0,a.cyclesSinceInternalChange=0,this.notifyListeners(t,n)}read(e){let t=this.getSource(e.storageType);if(t===void 0)throw new Ht({errorLevel:"ERROR",effect:"can not read metadata",cause:`Source "${e.storageType}" does not exist`});return t.readCache(e)}isCacheExternalWriteLocked(e){return e.cyclesSinceInternalChange<YD}notifyListeners(e,t){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(!(t!==void 0&&t===a.uuid||a.bindTarget===void 0)&&jD(e.storageProp,a.bindTarget.storageProp,a.bindTarget.listenToChildren)){let o=n.readCache(a.bindTarget);a.notify(o)}}}notifyAllListeners(e,t){for(let n of t.subscriptions){if(n.bindTarget===void 0)continue;let i=e.readCache(n.bindTarget);n.notify(i)}}deleteCachesForStoragePath(e){for(let t of this.sources.values()){let n=t.getCacheItemForStoragePath(e);n!==void 0&&(n.subscriptions.forEach(i=>i.delete()),t.deleteCache(n))}}getDefaultCacheItem(){return{subscriptions:[],cyclesSinceInternalChange:YD+1,pendingInternalChange:!1,cyclesSinceInactive:0,inactive:!0}}onExternalUpdate(e,t,n){let i=e.getCacheItemForStoragePath(t);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 u=o.bindTarget.storageProp,c=La.tryGet(n,u),s=La.tryGet(a,u);c!==s&&o.notify(c)}}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,t){this.deleteCachesForStoragePath(e)}};var Zm=class{constructor(){this.activeMountables=new Map}unloadFile(e){for(let t of this.activeMountables.values())t.getFilePath()===e&&t.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 Jy=Or(zf()),Kn=class r{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,Jy.default)(e,r.dateFormat)}static getDefaultDate(){return(0,Jy.default)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var ZD=["January","February","March","April","May","June","July","August","September","October","November","December"],Xu=[{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"}],wo={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",firstWeekday:Xu[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:["templates"]};var JD=Or(zf());var Xy=Xu[1];function XD(r){Xy=r}function QD(r){return ZD[r]}function KD(r,e){let t=(0,JD.default)(new Date(e,r)).daysInMonth(),n=new Array(42).fill(0),i=ez(new Date(e,r,1));for(let a=0;a<t;a++)n[a+i]=a+1;return n=n[n.length-7]?n:n.slice(0,-7),n=n[n.length-7]?n:n.slice(0,-7),n}function ez(r){return Hy(r.getDay()-Xy.index,7)}function eC(){return Xu.map(e=>({index:Hy(e.index-Xy.index,7),name:e.name,shortName:e.shortName})).sort((e,t)=>e.index-t.index).map(e=>e.shortName)}function tC(){let r=0;return()=>++r}function Jm(r){var e=r.statementIndent,t=r.jsonld,n=r.json||t,i=r.typescript,a=r.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function q(In){return{type:In,style:"keyword"}}var ee=q("keyword a"),Ie=q("keyword b"),Xe=q("keyword c"),Ye=q("keyword d"),Vt=q("operator"),kr={type:"atom",style:"atom"};return{if:q("if"),while:ee,with:ee,else:Ie,do:Ie,try:Ie,finally:Ie,return:Ye,break:Ye,continue:Ye,new:q("new"),delete:Xe,void:Xe,throw:Xe,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:Vt,typeof:Vt,instanceof:Vt,true:kr,false:kr,null:kr,undefined:kr,NaN:kr,Infinity:kr,this:q("this"),class:q("class"),super:q("atom"),yield:Xe,export:q("export"),import:q("import"),extends:Xe,await:Xe}}(),u=/[+\-*&%=<>!?|~^@]/,c=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function s(q){for(var ee=!1,Ie,Xe=!1;(Ie=q.next())!=null;){if(!ee){if(Ie=="/"&&!Xe)return;Ie=="["?Xe=!0:Xe&&Ie=="]"&&(Xe=!1)}ee=!ee&&Ie=="\\"}}var l,f;function p(q,ee,Ie){return l=q,f=Ie,ee}function m(q,ee){var Ie=q.next();if(Ie=='"'||Ie=="'")return ee.tokenize=d(Ie),ee.tokenize(q,ee);if(Ie=="."&&q.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if(Ie=="."&&q.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(Ie))return p(Ie);if(Ie=="="&&q.eat(">"))return p("=>","operator");if(Ie=="0"&&q.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(Ie))return q.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if(Ie=="/")return q.eat("*")?(ee.tokenize=h,h(q,ee)):q.eat("/")?(q.skipToEnd(),p("comment","comment")):an(q,ee,1)?(s(q),q.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string.special")):(q.eat("="),p("operator","operator",q.current()));if(Ie=="`")return ee.tokenize=x,x(q,ee);if(Ie=="#"&&q.peek()=="!")return q.skipToEnd(),p("meta","meta");if(Ie=="#"&&q.eatWhile(a))return p("variable","property");if(Ie=="<"&&q.match("!--")||Ie=="-"&&q.match("->")&&!/\S/.test(q.string.slice(0,q.start)))return q.skipToEnd(),p("comment","comment");if(u.test(Ie))return(Ie!=">"||!ee.lexical||ee.lexical.type!=">")&&(q.eat("=")?(Ie=="!"||Ie=="=")&&q.eat("="):/[<>*+\-|&?]/.test(Ie)&&(q.eat(Ie),Ie==">"&&q.eat(Ie))),Ie=="?"&&q.eat(".")?p("."):p("operator","operator",q.current());if(a.test(Ie)){q.eatWhile(a);var Xe=q.current();if(ee.lastType!="."){if(o.propertyIsEnumerable(Xe)){var Ye=o[Xe];return p(Ye.type,Ye.style,Xe)}if(Xe=="async"&&q.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",Xe)}return p("variable","variable",Xe)}}function d(q){return function(ee,Ie){var Xe=!1,Ye;if(t&&ee.peek()=="@"&&ee.match(c))return Ie.tokenize=m,p("jsonld-keyword","meta");for(;(Ye=ee.next())!=null&&!(Ye==q&&!Xe);)Xe=!Xe&&Ye=="\\";return Xe||(Ie.tokenize=m),p("string","string")}}function h(q,ee){for(var Ie=!1,Xe;Xe=q.next();){if(Xe=="/"&&Ie){ee.tokenize=m;break}Ie=Xe=="*"}return p("comment","comment")}function x(q,ee){for(var Ie=!1,Xe;(Xe=q.next())!=null;){if(!Ie&&(Xe=="`"||Xe=="$"&&q.eat("{"))){ee.tokenize=m;break}Ie=!Ie&&Xe=="\\"}return p("quasi","string.special",q.current())}var b="([{}])";function T(q,ee){ee.fatArrowAt&&(ee.fatArrowAt=null);var Ie=q.string.indexOf("=>",q.start);if(!(Ie<0)){if(i){var Xe=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(q.string.slice(q.start,Ie));Xe&&(Ie=Xe.index)}for(var Ye=0,Vt=!1,kr=Ie-1;kr>=0;--kr){var In=q.string.charAt(kr),Pn=b.indexOf(In);if(Pn>=0&&Pn<3){if(!Ye){++kr;break}if(--Ye==0){In=="("&&(Vt=!0);break}}else if(Pn>=3&&Pn<6)++Ye;else if(a.test(In))Vt=!0;else if(/["'\/`]/.test(In))for(;;--kr){if(kr==0)return;var ls=q.string.charAt(kr-1);if(ls==In&&q.string.charAt(kr-2)!="\\"){kr--;break}}else if(Vt&&!Ye){++kr;break}}Vt&&!Ye&&(ee.fatArrowAt=kr)}}var v={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function S(q,ee,Ie,Xe,Ye,Vt){this.indented=q,this.column=ee,this.type=Ie,this.prev=Ye,this.info=Vt,Xe!=null&&(this.align=Xe)}function _(q,ee){for(var Ie=q.localVars;Ie;Ie=Ie.next)if(Ie.name==ee)return!0;for(var Xe=q.context;Xe;Xe=Xe.prev)for(var Ie=Xe.vars;Ie;Ie=Ie.next)if(Ie.name==ee)return!0}function y(q,ee,Ie,Xe,Ye){var Vt=q.cc;for(A.state=q,A.stream=Ye,A.marked=null,A.cc=Vt,A.style=ee,q.lexical.hasOwnProperty("align")||(q.lexical.align=!0);;){var kr=Vt.length?Vt.pop():n?me:L;if(kr(Ie,Xe)){for(;Vt.length&&Vt[Vt.length-1].lex;)Vt.pop()();return A.marked?A.marked:Ie=="variable"&&_(q,Xe)?"variableName.local":ee}}}var A={state:null,column:null,marked:null,cc:null};function M(){for(var q=arguments.length-1;q>=0;q--)A.cc.push(arguments[q])}function w(){return M.apply(null,arguments),!0}function D(q,ee){for(var Ie=ee;Ie;Ie=Ie.next)if(Ie.name==q)return!0;return!1}function N(q){var ee=A.state;if(A.marked="def",ee.context){if(ee.lexical.info=="var"&&ee.context&&ee.context.block){var Ie=B(q,ee.context);if(Ie!=null){ee.context=Ie;return}}else if(!D(q,ee.localVars)){ee.localVars=new V(q,ee.localVars);return}}r.globalVars&&!D(q,ee.globalVars)&&(ee.globalVars=new V(q,ee.globalVars))}function B(q,ee){if(ee)if(ee.block){var Ie=B(q,ee.prev);return Ie?Ie==ee.prev?ee:new z(Ie,ee.vars,!0):null}else return D(q,ee.vars)?ee:new z(ee.prev,new V(q,ee.vars),!1);else return null}function R(q){return q=="public"||q=="private"||q=="protected"||q=="abstract"||q=="readonly"}function z(q,ee,Ie){this.prev=q,this.vars=ee,this.block=Ie}function V(q,ee){this.name=q,this.next=ee}var k=new V("this",new V("arguments",null));function P(){A.state.context=new z(A.state.context,A.state.localVars,!1),A.state.localVars=k}function W(){A.state.context=new z(A.state.context,A.state.localVars,!0),A.state.localVars=null}P.lex=W.lex=!0;function O(){A.state.localVars=A.state.context.vars,A.state.context=A.state.context.prev}O.lex=!0;function X(q,ee){var Ie=function(){var Xe=A.state,Ye=Xe.indented;if(Xe.lexical.type=="stat")Ye=Xe.lexical.indented;else for(var Vt=Xe.lexical;Vt&&Vt.type==")"&&Vt.align;Vt=Vt.prev)Ye=Vt.indented;Xe.lexical=new S(Ye,A.stream.column(),q,null,Xe.lexical,ee)};return Ie.lex=!0,Ie}function ne(){var q=A.state;q.lexical.prev&&(q.lexical.type==")"&&(q.indented=q.lexical.indented),q.lexical=q.lexical.prev)}ne.lex=!0;function Z(q){function ee(Ie){return Ie==q?w():q==";"||Ie=="}"||Ie==")"||Ie=="]"?M():w(ee)}return ee}function L(q,ee){return q=="var"?w(X("vardef",ee),yt,Z(";"),ne):q=="keyword a"?w(X("form"),ve,L,ne):q=="keyword b"?w(X("form"),L,ne):q=="keyword d"?A.stream.match(/^\s*$/,!1)?w():w(X("stat"),ye,Z(";"),ne):q=="debugger"?w(Z(";")):q=="{"?w(X("}"),W,Dt,ne,O):q==";"?w():q=="if"?(A.state.lexical.info=="else"&&A.state.cc[A.state.cc.length-1]==ne&&A.state.cc.pop()(),w(X("form"),ve,L,ne,mr)):q=="function"?w(Ra):q=="for"?w(X("form"),W,Js,L,O,ne):q=="class"||i&&ee=="interface"?(A.marked="keyword",w(X("form",q=="class"?q:ee),fn,ne)):q=="variable"?i&&ee=="declare"?(A.marked="keyword",w(L)):i&&(ee=="module"||ee=="enum"||ee=="type")&&A.stream.match(/^\s*\w/,!1)?(A.marked="keyword",ee=="enum"?w(Zl):ee=="type"?w(Dn,Z("operator"),fe,Z(";")):w(X("form"),Re,Z("{"),X("}"),Dt,ne,ne)):i&&ee=="namespace"?(A.marked="keyword",w(X("form"),me,L,ne)):i&&ee=="abstract"?(A.marked="keyword",w(L)):w(X("stat"),re):q=="switch"?w(X("form"),ve,Z("{"),X("}","switch"),W,Dt,ne,ne,O):q=="case"?w(me,Z(":")):q=="default"?w(Z(":")):q=="catch"?w(X("form"),P,pe,L,ne,O):q=="export"?w(X("stat"),Ff,ne):q=="import"?w(X("stat"),ss,ne):q=="async"?w(L):ee=="@"?w(me,L):M(X("stat"),me,Z(";"),ne)}function pe(q){if(q=="(")return w(qn,Z(")"))}function me(q,ee){return _e(q,ee,!1)}function oe(q,ee){return _e(q,ee,!0)}function ve(q){return q!="("?M():w(X(")"),ye,Z(")"),ne)}function _e(q,ee,Ie){if(A.state.fatArrowAt==A.stream.start){var Xe=Ie?Y:Qe;if(q=="(")return w(P,X(")"),Se(qn,")"),ne,Z("=>"),Xe,O);if(q=="variable")return M(P,Re,Z("=>"),Xe,O)}var Ye=Ie?we:be;return v.hasOwnProperty(q)?w(Ye):q=="function"?w(Ra,Ye):q=="class"||i&&ee=="interface"?(A.marked="keyword",w(X("form"),ji,ne)):q=="keyword c"||q=="async"?w(Ie?oe:me):q=="("?w(X(")"),ye,Z(")"),ne,Ye):q=="operator"||q=="spread"?w(Ie?oe:me):q=="["?w(X("]"),jl,ne,Ye):q=="{"?wt(Ae,"}",null,Ye):q=="quasi"?M(Ee,Ye):q=="new"?w(Q(Ie)):w()}function ye(q){return q.match(/[;\}\)\],]/)?M():M(me)}function be(q,ee){return q==","?w(ye):we(q,ee,!1)}function we(q,ee,Ie){var Xe=Ie==!1?be:we,Ye=Ie==!1?me:oe;if(q=="=>")return w(P,Ie?Y:Qe,O);if(q=="operator")return/\+\+|--/.test(ee)||i&&ee=="!"?w(Xe):i&&ee=="<"&&A.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?w(X(">"),Se(fe,">"),ne,Xe):ee=="?"?w(me,Z(":"),Ye):w(Ye);if(q=="quasi")return M(Ee,Xe);if(q!=";"){if(q=="(")return wt(oe,")","call",Xe);if(q==".")return w(se,Xe);if(q=="[")return w(X("]"),ye,Z("]"),ne,Xe);if(i&&ee=="as")return A.marked="keyword",w(fe,Xe);if(q=="regexp")return A.state.lastType=A.marked="operator",A.stream.backUp(A.stream.pos-A.stream.start-1),w(Ye)}}function Ee(q,ee){return q!="quasi"?M():ee.slice(ee.length-2)!="${"?w(Ee):w(ye,ze)}function ze(q){if(q=="}")return A.marked="string.special",A.state.tokenize=x,w(Ee)}function Qe(q){return T(A.stream,A.state),M(q=="{"?L:me)}function Y(q){return T(A.stream,A.state),M(q=="{"?L:oe)}function Q(q){return function(ee){return ee=="."?w(q?J:xe):ee=="variable"&&i?w(ge,q?we:be):M(q?oe:me)}}function xe(q,ee){if(ee=="target")return A.marked="keyword",w(be)}function J(q,ee){if(ee=="target")return A.marked="keyword",w(we)}function re(q){return q==":"?w(ne,L):M(be,Z(";"),ne)}function se(q){if(q=="variable")return A.marked="property",w()}function Ae(q,ee){if(q=="async")return A.marked="property",w(Ae);if(q=="variable"||A.style=="keyword"){if(A.marked="property",ee=="get"||ee=="set")return w(Te);var Ie;return i&&A.state.fatArrowAt==A.stream.start&&(Ie=A.stream.match(/^\s*:\s*/,!1))&&(A.state.fatArrowAt=A.stream.pos+Ie[0].length),w(qe)}else{if(q=="number"||q=="string")return A.marked=t?"property":A.style+" property",w(qe);if(q=="jsonld-keyword")return w(qe);if(i&&R(ee))return A.marked="keyword",w(Ae);if(q=="[")return w(me,jt,Z("]"),qe);if(q=="spread")return w(oe,qe);if(ee=="*")return A.marked="keyword",w(Ae);if(q==":")return M(qe)}}function Te(q){return q!="variable"?M(qe):(A.marked="property",w(Ra))}function qe(q){if(q==":")return w(oe);if(q=="(")return M(Ra)}function Se(q,ee,Ie){function Xe(Ye,Vt){if(Ie?Ie.indexOf(Ye)>-1:Ye==","){var kr=A.state.lexical;return kr.info=="call"&&(kr.pos=(kr.pos||0)+1),w(function(In,Pn){return In==ee||Pn==ee?M():M(q)},Xe)}return Ye==ee||Vt==ee?w():Ie&&Ie.indexOf(";")>-1?M(q):w(Z(ee))}return function(Ye,Vt){return Ye==ee||Vt==ee?w():M(q,Xe)}}function wt(q,ee,Ie){for(var Xe=3;Xe<arguments.length;Xe++)A.cc.push(arguments[Xe]);return w(X(ee,Ie),Se(q,ee),ne)}function Dt(q){return q=="}"?w():M(L,Dt)}function jt(q,ee){if(i){if(q==":")return w(fe);if(ee=="?")return w(jt)}}function Tt(q,ee){if(i&&(q==":"||ee=="in"))return w(fe)}function j(q){if(i&&q==":")return A.stream.match(/^\s*\w+\s+is\b/,!1)?w(me,le,fe):w(fe)}function le(q,ee){if(ee=="is")return A.marked="keyword",w()}function fe(q,ee){if(ee=="keyof"||ee=="typeof"||ee=="infer"||ee=="readonly")return A.marked="keyword",w(ee=="typeof"?oe:fe);if(q=="variable"||ee=="void")return A.marked="type",w(G);if(ee=="|"||ee=="&")return w(fe);if(q=="string"||q=="number"||q=="atom")return w(G);if(q=="[")return w(X("]"),Se(fe,"]",","),ne,G);if(q=="{")return w(X("}"),ke,ne,G);if(q=="(")return w(Se(F,")"),Pe,G);if(q=="<")return w(Se(fe,">"),fe);if(q=="quasi")return M($e,G)}function Pe(q){if(q=="=>")return w(fe)}function ke(q){return q.match(/[\}\)\]]/)?w():q==","||q==";"?w(ke):M(Fe,ke)}function Fe(q,ee){if(q=="variable"||A.style=="keyword")return A.marked="property",w(Fe);if(ee=="?"||q=="number"||q=="string")return w(Fe);if(q==":")return w(fe);if(q=="[")return w(Z("variable"),Tt,Z("]"),Fe);if(q=="(")return M(ga,Fe);if(!q.match(/[;\}\)\],]/))return w()}function $e(q,ee){return q!="quasi"?M():ee.slice(ee.length-2)!="${"?w($e):w(fe,He)}function He(q){if(q=="}")return A.marked="string.special",A.state.tokenize=x,w($e)}function F(q,ee){return q=="variable"&&A.stream.match(/^\s*[?:]/,!1)||ee=="?"?w(F):q==":"?w(fe):q=="spread"?w(F):M(fe)}function G(q,ee){if(ee=="<")return w(X(">"),Se(fe,">"),ne,G);if(ee=="|"||q=="."||ee=="&")return w(fe);if(q=="[")return w(fe,Z("]"),G);if(ee=="extends"||ee=="implements")return A.marked="keyword",w(fe);if(ee=="?")return w(fe,Z(":"),fe)}function ge(q,ee){if(ee=="<")return w(X(">"),Se(fe,">"),ne,G)}function Ne(){return M(fe,ot)}function ot(q,ee){if(ee=="=")return w(fe)}function yt(q,ee){return ee=="enum"?(A.marked="keyword",w(Zl)):M(Re,jt,nn,Un)}function Re(q,ee){if(i&&R(ee))return A.marked="keyword",w(Re);if(q=="variable")return N(ee),w();if(q=="spread")return w(Re);if(q=="[")return wt(Bi,"]");if(q=="{")return wt(Xn,"}")}function Xn(q,ee){return q=="variable"&&!A.stream.match(/^\s*:/,!1)?(N(ee),w(nn)):(q=="variable"&&(A.marked="property"),q=="spread"?w(Re):q=="}"?M():q=="["?w(me,Z("]"),Z(":"),Xn):w(Z(":"),Re,nn))}function Bi(){return M(Re,nn)}function nn(q,ee){if(ee=="=")return w(oe)}function Un(q){if(q==",")return w(yt)}function mr(q,ee){if(q=="keyword b"&&ee=="else")return w(X("form","else"),L,ne)}function Js(q,ee){if(ee=="await")return w(Js);if(q=="(")return w(X(")"),Br,ne)}function Br(q){return q=="var"?w(yt,Yi):q=="variable"?w(Yi):M(Yi)}function Yi(q,ee){return q==")"?w():q==";"?w(Yi):ee=="in"||ee=="of"?(A.marked="keyword",w(me,Yi)):M(me,Yi)}function Ra(q,ee){if(ee=="*")return A.marked="keyword",w(Ra);if(q=="variable")return N(ee),w(Ra);if(q=="(")return w(P,X(")"),Se(qn,")"),ne,j,L,O);if(i&&ee=="<")return w(X(">"),Se(Ne,">"),ne,Ra)}function ga(q,ee){if(ee=="*")return A.marked="keyword",w(ga);if(q=="variable")return N(ee),w(ga);if(q=="(")return w(P,X(")"),Se(qn,")"),ne,j,O);if(i&&ee=="<")return w(X(">"),Se(Ne,">"),ne,ga)}function Dn(q,ee){if(q=="keyword"||q=="variable")return A.marked="type",w(Dn);if(ee=="<")return w(X(">"),Se(Ne,">"),ne)}function qn(q,ee){return ee=="@"&&w(me,qn),q=="spread"?w(qn):i&&R(ee)?(A.marked="keyword",w(qn)):i&&q=="this"?w(jt,nn):M(Re,jt,nn)}function ji(q,ee){return q=="variable"?fn(q,ee):Qn(q,ee)}function fn(q,ee){if(q=="variable")return N(ee),w(Qn)}function Qn(q,ee){if(ee=="<")return w(X(">"),Se(Ne,">"),ne,Qn);if(ee=="extends"||ee=="implements"||i&&q==",")return ee=="implements"&&(A.marked="keyword"),w(i?fe:me,Qn);if(q=="{")return w(X("}"),Cn,ne)}function Cn(q,ee){if(q=="async"||q=="variable"&&(ee=="static"||ee=="get"||ee=="set"||i&&R(ee))&&A.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return A.marked="keyword",w(Cn);if(q=="variable"||A.style=="keyword")return A.marked="property",w(Zi,Cn);if(q=="number"||q=="string")return w(Zi,Cn);if(q=="[")return w(me,jt,Z("]"),Zi,Cn);if(ee=="*")return A.marked="keyword",w(Cn);if(i&&q=="(")return M(ga,Cn);if(q==";"||q==",")return w(Cn);if(q=="}")return w();if(ee=="@")return w(me,Cn)}function Zi(q,ee){if(ee=="!"||ee=="?")return w(Zi);if(q==":")return w(fe,nn);if(ee=="=")return w(oe);var Ie=A.state.lexical.prev,Xe=Ie&&Ie.info=="interface";return M(Xe?ga:Ra)}function Ff(q,ee){return ee=="*"?(A.marked="keyword",w(vo,Z(";"))):ee=="default"?(A.marked="keyword",w(me,Z(";"))):q=="{"?w(Se(Wl,"}"),vo,Z(";")):M(L)}function Wl(q,ee){if(ee=="as")return A.marked="keyword",w(Z("variable"));if(q=="variable")return M(oe,Wl)}function ss(q){return q=="string"?w():q=="("?M(me):q=="."?M(be):M(us,Yl,vo)}function us(q,ee){return q=="{"?wt(us,"}"):(q=="variable"&&N(ee),ee=="*"&&(A.marked="keyword"),w(Lo))}function Yl(q){if(q==",")return w(us,Yl)}function Lo(q,ee){if(ee=="as")return A.marked="keyword",w(us)}function vo(q,ee){if(ee=="from")return A.marked="keyword",w(me)}function jl(q){return q=="]"?w():M(Se(oe,"]"))}function Zl(){return M(X("form"),Re,Z("{"),X("}"),Se(If,"}"),ne,ne)}function If(){return M(Re,nn)}function Pf(q,ee){return q.lastType=="operator"||q.lastType==","||u.test(ee.charAt(0))||/[,.]/.test(ee.charAt(0))}function an(q,ee,Ie){return ee.tokenize==m&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(ee.lastType)||ee.lastType=="quasi"&&/\{\s*$/.test(q.string.slice(0,q.pos-(Ie||0)))}return{name:r.name,startState:function(q){var ee={tokenize:m,lastType:"sof",cc:[],lexical:new S(-q,0,"block",!1),localVars:r.localVars,context:r.localVars&&new z(null,null,!1),indented:0};return r.globalVars&&typeof r.globalVars=="object"&&(ee.globalVars=r.globalVars),ee},token:function(q,ee){if(q.sol()&&(ee.lexical.hasOwnProperty("align")||(ee.lexical.align=!1),ee.indented=q.indentation(),T(q,ee)),ee.tokenize!=h&&q.eatSpace())return null;var Ie=ee.tokenize(q,ee);return l=="comment"?Ie:(ee.lastType=l=="operator"&&(f=="++"||f=="--")?"incdec":l,y(ee,Ie,l,f,q))},indent:function(q,ee,Ie){if(q.tokenize==h||q.tokenize==x)return null;if(q.tokenize!=m)return 0;var Xe=ee&&ee.charAt(0),Ye=q.lexical,Vt;if(!/^\s*else\b/.test(ee))for(var kr=q.cc.length-1;kr>=0;--kr){var In=q.cc[kr];if(In==ne)Ye=Ye.prev;else if(In!=mr&&In!=O)break}for(;(Ye.type=="stat"||Ye.type=="form")&&(Xe=="}"||(Vt=q.cc[q.cc.length-1])&&(Vt==be||Vt==we)&&!/^[,\.=+\-*:?[\(]/.test(ee));)Ye=Ye.prev;e&&Ye.type==")"&&Ye.prev.type=="stat"&&(Ye=Ye.prev);var Pn=Ye.type,ls=Xe==Pn;return Pn=="vardef"?Ye.indented+(q.lastType=="operator"||q.lastType==","?Ye.info.length+1:0):Pn=="form"&&Xe=="{"?Ye.indented:Pn=="form"?Ye.indented+Ie.unit:Pn=="stat"?Ye.indented+(Pf(q,ee)?e||Ie.unit:0):Ye.info=="switch"&&!ls&&r.doubleIndentSwitch!=!1?Ye.indented+(/^(?:case|default)\b/.test(ee)?Ie.unit:2*Ie.unit):Ye.align?Ye.column+(ls?0:1):Ye.indented+(ls?0:Ie.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:n?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var Hf=Jm({name:"javascript"}),koe=Jm({name:"json",json:!0}),$oe=Jm({name:"json",jsonld:!0}),Ooe=Jm({name:"typescript",typescript:!0});var tz=["true","false","on","off","yes","no"],rz=new RegExp("\\b(("+tz.join(")|(")+"))$","i"),Gf={name:"yaml",token:function(r,e){var t=r.peek(),n=e.escaped;if(e.escaped=!1,t=="#"&&(r.pos==0||/\s/.test(r.string.charAt(r.pos-1))))return r.skipToEnd(),"comment";if(r.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&r.indentation()>e.keyCol)return r.skipToEnd(),"string";if(e.literal&&(e.literal=!1),r.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,r.match("---")||r.match("..."))return"def";if(r.match(/^\s*-\s+/))return"meta"}if(r.match(/^(\{|\}|\[|\])/))return t=="{"?e.inlinePairs++:t=="}"?e.inlinePairs--:t=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!n&&t==",")return r.next(),"meta";if(e.inlinePairs>0&&!n&&t==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,r.next(),"meta";if(e.pairStart){if(r.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(r.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&r.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&r.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(r.match(rz))return"keyword"}return!e.pair&&r.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=r.indentation(),"atom"):e.pair&&r.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=t=="\\",r.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};var oc=class{constructor(e,t){this.range=e,this.tokenClass=t}};var ox=Or(Xi());var $t=class r{static sequence(...e){return ox.P.sequenceMap((...t)=>t.flat(2).filter(n=>n!==void 0),...e)}static separateBy(e,t){return r.sequence(e,r.sequence(t,e).many()).optional([])}static highlight(e,t){return e.node((n,i)=>[new oc(i,t)])}static highlightStr(e,t){return r.highlight(ox.P.string(e),t)}};var ys=class{constructor(e,t,n){this.str=e,this.highlights=t.filter(i=>i.range.from.index!==i.range.to.index),this.parsingError=n}getHighlights(){if(this.parsingError===void 0)return this.highlights;let e;return this.str[this.parsingError.parseFailure.furthest.index]===`
`?e={index:this.parsingError.parseFailure.furthest.index+1,column:1,line:this.parsingError.parseFailure.furthest.line+1}:e={index:this.parsingError.parseFailure.furthest.index+1,column:this.parsingError.parseFailure.furthest.column+1,line:this.parsingError.parseFailure.furthest.line},[new oc({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};function aC(r){if(!r.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",t=>({startState:()=>Gf.startState?.(4),blankLine:i=>Gf.blankLine?.(i,4),copyState:i=>Gf.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${Gf.token?.(i,a)}`})),window.CodeMirror.defineMode("meta-bind-js-view",t=>({startState:()=>Hf.startState?.(4),blankLine:i=>Hf.blankLine?.(i,4),copyState:i=>Hf.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${Hf.token?.(i,a)}`}));let e=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode("meta-bind",t=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(i,a)=>{if(a.str===void 0){let c=[i.string],s=1,l=i.lookAhead(s);for(;l!==void 0&&!e.test(l)&&(c.push(l),s+=1,l=i.lookAhead(s),!(s>100)););a.str=c.filter(p=>p.trim()!=="").join(`
`);let f=r.api.isInlineFieldDeclarationAndGetType(a.str.trim());f===void 0?a.highlights=new ys(a.str,[]):(a.fieldType=f,a.highlights=r.api.syntaxHighlighting.highlight(a.str,a.fieldType,!0))}let u=a.highlights.getHighlights().filter(c=>c.range.from.line===a.line).find(c=>c.range.from.column===i.pos+1);return u===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<u.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${u.tokenClass}`)}}))}var hx=require("@codemirror/language"),Ku=require("@codemirror/view");var mn=class extends Error{},Wf=class extends Error{};var lc=function(r){return this instanceof lc?(this.v=r,this):new lc(r)},cz=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(d,h){a.push([p,m,d,h])>1||u(p,m)})})}function u(p,m){try{c(n[p](m))}catch(d){f(a[0][3],d)}}function c(p){p.value instanceof lc?Promise.resolve(p.value.v).then(s,l):f(a[0][2],p)}function s(p){u("next",p)}function l(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}},_o;(function(r){r[r.SHORTEST=0]="SHORTEST",r[r.LONGEST=1]="LONGEST",r[r.STRICT_EQUAL=2]="STRICT_EQUAL"})(_o||(_o={}));function*sx(r,e,...t){if(t.length===0)return;let n=[];for(let i of t)n.push(oC(i));e:for(;;){let i=uC.map(n,c=>c.next()),a=[],o=!0,u=!1;for(let c of i){let s;c.done?(o=!1,s=e):(u=!0,s=c.value),a.push(s)}if(!o&&u)switch(r){case _o.SHORTEST:break e;case _o.STRICT_EQUAL:throw new Wf("Iterators must have equal lengths")}if(!u)break;yield a}}function ux(r,e,...t){return cz(this,arguments,function*(){if(t.length===0)return yield lc(void 0);let i=[];for(let a of t)i.push(sC(a));e:for(;;){let a=[];for(let s of i){let l=yield lc(s.next());a.push(l)}let o=[],u=!0,c=!1;for(let s of a){let l;s.done?(u=!1,l=e):(c=!0,l=s.value),o.push(l)}if(!u&&c)switch(r){case _o.SHORTEST:break e;case _o.STRICT_EQUAL:throw new Wf("Iterators must have equal lengths")}if(!c)break;yield yield lc(o)}})}var lC=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(u,c){o=r[a](o),i(u,c,o.done,o.value)})}}function i(a,o,u,c){Promise.resolve(c).then(function(s){a({value:s,done:u})},o)}},xs=function(r){return this instanceof xs?(this.v=r,this):new xs(r)},cC=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(d,h){a.push([p,m,d,h])>1||u(p,m)})})}function u(p,m){try{c(n[p](m))}catch(d){f(a[0][3],d)}}function c(p){p.value instanceof xs?Promise.resolve(p.value.v).then(s,l):f(a[0][2],p)}function s(p){u("next",p)}function l(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*fC(...r){for(let e of sx(_o.SHORTEST,void 0,...r))yield e}function pC(...r){return cC(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,u=lC(ux(_o.SHORTEST,void 0,...r)),c;c=yield xs(u.next()),t=c.done,!t;){a=c.value,o=!1;try{yield yield xs(a)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=u.return)&&(yield xs(i.call(u)))}finally{if(n)throw n.error}}})}function*mC(...r){for(let e of sx(_o.STRICT_EQUAL,void 0,...r))yield e}function dC(...r){return cC(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,u=lC(ux(_o.STRICT_EQUAL,void 0,...r)),c;c=yield xs(u.next()),t=c.done,!t;){a=c.value,o=!1;try{yield yield xs(a)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=u.return)&&(yield xs(i.call(u)))}finally{if(n)throw n.error}}})}var hC=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(l){try{s(n.next(l))}catch(f){o(f)}}function c(l){try{s(n.throw(l))}catch(f){o(f)}}function s(l){l.done?a(l.value):i(l.value).then(u,c)}s((n=n.apply(r,e||[])).next())})},fz=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(u,c){o=r[a](o),i(u,c,o.done,o.value)})}}function i(a,o,u,c){Promise.resolve(c).then(function(s){a({value:s,done:u})},o)}};function pz(r,e,t){let n=t;for(let i of Rr(r))n=e(n,i);return n}function mz(r,e,t){var n,i,a,o;return hC(this,void 0,void 0,function*(){let u=t;try{for(var c=!0,s=fz(Lr(r)),l;l=yield s.next(),n=l.done,!n;){o=l.value,c=!1;try{u=yield e(u,o)}finally{c=!0}}}catch(f){i={error:f}}finally{try{!c&&!n&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return u})}function lx(r){switch(!0){case r instanceof Array:return r.length;case Vo(r):return r.length;case r instanceof Set:return r.size;case r instanceof Map:return r.size}return pz(r,e=>e+1,0)}function gC(r){return hC(this,void 0,void 0,function*(){switch(!0){case r instanceof Array:case Vo(r):case r instanceof Set:case r instanceof Map:return lx(r)}return yield mz(r,e=>e+1,0)})}var So=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(l){try{s(n.next(l))}catch(f){o(f)}}function c(l){try{s(n.throw(l))}catch(f){o(f)}}function s(l){l.done?a(l.value):i(l.value).then(u,c)}s((n=n.apply(r,e||[])).next())})},bs=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(u,c){o=r[a](o),i(u,c,o.done,o.value)})}}function i(a,o,u,c){Promise.resolve(c).then(function(s){a({value:s,done:u})},o)}};function vC(r,e){for(let t of Rr(r))if(!e(t))return!1;return!0}function yC(r,e){var t,n,i,a;return So(this,void 0,void 0,function*(){try{for(var o=!0,u=bs(Lr(r)),c;c=yield u.next(),t=c.done,!t;){a=c.value,o=!1;try{if(!(yield e(a)))return!1}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return!0})}function xC(r){let e=new Set;for(let t of Rr(r)){if(e.has(t))return!1;e.add(t)}return!0}function bC(r){var e,t,n,i;return So(this,void 0,void 0,function*(){let a=new Set;try{for(var o=!0,u=bs(Lr(r)),c;c=yield u.next(),e=c.done,!e;){i=c.value,o=!1;try{let s=i;if(a.has(s))return!1;a.add(s)}finally{o=!0}}}catch(s){t={error:s}}finally{try{!o&&!e&&(n=u.return)&&(yield n.call(u))}finally{if(t)throw t.error}}return!0})}function wC(r,e){for(let t of Rr(r))if(e(t))return!0;return!1}function _C(r,e){var t,n,i,a;return So(this,void 0,void 0,function*(){try{for(var o=!0,u=bs(Lr(r)),c;c=yield u.next(),t=c.done,!t;){a=c.value,o=!1;try{if(yield e(a))return!0}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return!1})}function SC(r,e,t){if(e<0)return!1;t===void 0&&(t=i=>!!i);let n=0;for(let i of Rr(r))if(t(i)&&(n++,n>e))return!1;return n===e}function AC(r,e,t){var n,i,a,o;return So(this,void 0,void 0,function*(){if(e<0)return!1;t===void 0&&(t=f=>!!f);let u=0;try{for(var c=!0,s=bs(Lr(r)),l;l=yield s.next(),n=l.done,!n;){o=l.value,c=!1;try{if((yield t(o))&&(u++,u>e))return!1}finally{c=!0}}}catch(f){i={error:f}}finally{try{!c&&!n&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return u===e})}function EC(r){for(let e of Rr(r))return!1;return!0}function TC(r){var e,t,n,i;return So(this,void 0,void 0,function*(){try{for(var a=!0,o=bs(Lr(r)),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let c=i;return!1}finally{a=!0}}}catch(c){t={error:c}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function Qi(r){return r==null?!1:typeof r[Symbol.iterator]=="function"}function ws(r){return r==null?!1:typeof r[Symbol.asyncIterator]=="function"}function Ua(r){return r==null?!1:r.next!==void 0&&typeof r.next=="function"}function MC(r){for(let[e,t]of Qu(Rr(r)))if(e<t)return!1;return!0}function DC(r){var e,t,n,i;return So(this,void 0,void 0,function*(){try{for(var a=!0,o=bs(jf(Lr(r))),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let[c,s]=i;if(c<s)return!1}finally{a=!0}}}catch(c){t={error:c}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function CC(r){for(let[e,t]of Qu(Rr(r)))if(e>t)return!1;return!0}function NC(r){var e,t,n,i;return So(this,void 0,void 0,function*(){try{for(var a=!0,o=bs(jf(Lr(r))),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let[c,s]=i;if(c>s)return!1}finally{a=!0}}}catch(c){t={error:c}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function Vo(r){return typeof r=="string"||r instanceof String}function FC(r,e){for(let t of Rr(r))if(e(t))return!1;return!0}function IC(r,e){var t,n,i,a;return So(this,void 0,void 0,function*(){try{for(var o=!0,u=bs(Lr(r)),c;c=yield u.next(),t=c.done,!t;){a=c.value,o=!1;try{if(yield e(a))return!1}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return!0})}function PC(...r){try{for(let e of mC(...r))for(let[t,n]of Qu(e))if(t!==n)return!1}catch{return!1}return!0}function BC(...r){var e,t,n,i;return So(this,void 0,void 0,function*(){try{try{for(var a=!0,o=bs(dC(...r)),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let c=i;for(let[s,l]of Qu(c))if(s!==l)return!1}finally{a=!0}}}catch(c){t={error:c}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}}catch{return!1}return!0})}function kC(...r){if(r.length<=1)return!0;let e=r.map(t=>lx(t));return new Set(e).size===1}function $C(...r){return So(this,void 0,void 0,function*(){if(r.length<=1)return!0;let e=yield od(r,t=>So(this,void 0,void 0,function*(){return yield gC(t)}));return new Set(yield Yf(e)).size===1})}var dz=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(l){try{s(n.next(l))}catch(f){o(f)}}function c(l){try{s(n.throw(l))}catch(f){o(f)}}function s(l){l.done?a(l.value):i(l.value).then(u,c)}s((n=n.apply(r,e||[])).next())})},Uo=function(r){return this instanceof Uo?(this.v=r,this):new Uo(r)},cx=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(d,h){a.push([p,m,d,h])>1||u(p,m)})})}function u(p,m){try{c(n[p](m))}catch(d){f(a[0][3],d)}}function c(p){p.value instanceof Uo?Promise.resolve(p.value.v).then(s,l):f(a[0][2],p)}function s(p){u("next",p)}function l(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}},OC=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(u,c){o=r[a](o),i(u,c,o.done,o.value)})}}function i(a,o,u,c){Promise.resolve(c).then(function(s){a({value:s,done:u})},o)}};function Rr(r){if(Qi(r))return r;if(Ua(r))return{[Symbol.iterator](){return r}};if(typeof r=="object"&&r!==null)return function*(){for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(yield[e,r[e]])}();throw new mn("Given collection is not iterable or iterator.")}function Lr(r){if(ws(r))return r;if(Ua(r))return{[Symbol.asyncIterator](){return cx(this,arguments,function*(){for(;;){let t=yield Uo(r.next());if(t.done)return yield Uo(void 0);yield yield Uo(t.value)}})}};if(typeof r=="object"&&r!==null&&(r=Rr(r)),Qi(r))return{[Symbol.asyncIterator](){return cx(this,arguments,function*(){for(let t of r)yield yield Uo(t)})}};throw new mn("Given collection is not async iterable or iterator.")}function oC(r){if(Ua(r))return r;if(Qi(r))return function*(){for(let e of r)yield e}();throw new mn("Given collection is not iterable or iterator.")}function sC(r){if((Ua(r)||Qi(r))&&(r=Lr(r)),ws(r))return function(){return cx(this,arguments,function*(){var e,t,n,i;try{for(var a=!0,o=OC(r),u;u=yield Uo(o.next()),e=u.done,!e;){i=u.value,a=!1;try{yield yield Uo(i)}finally{a=!0}}}catch(c){t={error:c}}finally{try{!a&&!e&&(n=o.return)&&(yield Uo(n.call(o)))}finally{if(t)throw t.error}}})}();throw new mn("Given collection is not iterable or iterator.")}function fx(r){let e=[];for(let t of Rr(r))e.push(t);return e}function Yf(r){var e,t,n,i;return dz(this,void 0,void 0,function*(){let a=[];try{for(var o=!0,u=OC(Lr(r)),c;c=yield u.next(),e=c.done,!e;){i=c.value,o=!1;try{let s=i;a.push(s)}finally{o=!0}}}catch(s){t={error:s}}finally{try{!o&&!e&&(n=u.return)&&(yield n.call(u))}finally{if(t)throw t.error}}return a})}var nu=function(r){return this instanceof nu?(this.v=r,this):new nu(r)},hz=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(u,c){o=r[a](o),i(u,c,o.done,o.value)})}}function i(a,o,u,c){Promise.resolve(c).then(function(s){a({value:s,done:u})},o)}},gz=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(d,h){a.push([p,m,d,h])>1||u(p,m)})})}function u(p,m){try{c(n[p](m))}catch(d){f(a[0][3],d)}}function c(p){p.value instanceof nu?Promise.resolve(p.value.v).then(s,l):f(a[0][2],p)}function s(p){u("next",p)}function l(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*px(r,e){let t=new Set;if(r instanceof Map){e===void 0&&(e=n=>n[1]);for(let n of r){let i=e(n);t.has(i)||(yield n,t.add(i))}}else{e===void 0&&(e=n=>n);for(let n of Rr(r)){let i=e(n);t.has(i)||(yield n,t.add(i))}}}function RC(r,e){return gz(this,arguments,function*(){var n,i,a,o;let u=new Set;if(r instanceof Map)for(let f of px(r,e))yield yield nu(yield nu(f));else{e===void 0&&(e=f=>f);try{for(var c=!0,s=hz(Lr(r)),l;l=yield nu(s.next()),n=l.done,!n;){o=l.value,c=!1;try{let f=o,p=e(f);u.has(p)||(yield yield nu(f),u.add(p))}finally{c=!0}}}catch(f){i={error:f}}finally{try{!c&&!n&&(a=s.return)&&(yield nu(a.call(s)))}finally{if(i)throw i.error}}}})}var Nn=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(u,c){o=r[a](o),i(u,c,o.done,o.value)})}}function i(a,o,u,c){Promise.resolve(c).then(function(s){a({value:s,done:u})},o)}},tt=function(r){return this instanceof tt?(this.v=r,this):new tt(r)},Wn=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(d,h){a.push([p,m,d,h])>1||u(p,m)})})}function u(p,m){try{c(n[p](m))}catch(d){f(a[0][3],d)}}function c(p){p.value instanceof tt?Promise.resolve(p.value.v).then(s,l):f(a[0][2],p)}function s(p){u("next",p)}function l(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*LC(r,e){for(let t of Rr(r))yield e(t)}function od(r,e){return Wn(this,arguments,function*(){var n,i,a,o;try{for(var u=!0,c=Nn(Lr(r)),s;s=yield tt(c.next()),n=s.done,!n;){o=s.value,u=!1;try{yield yield tt(yield tt(e(o)))}finally{u=!0}}}catch(l){i={error:l}}finally{try{!u&&!n&&(a=c.return)&&(yield tt(a.call(c)))}finally{if(i)throw i.error}}})}function*VC(r,e){for(let[t,n]of fC(r,e))n&&(yield t)}function UC(r,e){return Wn(this,arguments,function*(){var n,i,a,o;try{for(var u=!0,c=Nn(pC(r,e)),s;s=yield tt(c.next()),n=s.done,!n;){o=s.value,u=!1;try{let[l,f]=o;f&&(yield yield tt(l))}finally{u=!0}}}catch(l){i={error:l}}finally{try{!u&&!n&&(a=c.return)&&(yield tt(a.call(c)))}finally{if(i)throw i.error}}})}function*qC(r,e){let t=!0;for(let n of Rr(r)){if(t){if(!e(n)){t=!1,yield n;continue}continue}yield n}}function zC(r,e){return Wn(this,arguments,function*(){var n,i,a,o;let u=!0;try{for(var c=!0,s=Nn(Lr(r)),l;l=yield tt(s.next()),n=l.done,!n;){o=l.value,c=!1;try{let f=o;if(u){if(!(yield tt(e(f)))){u=!1,yield yield tt(f);continue}continue}yield yield tt(f)}finally{c=!0}}}catch(f){i={error:f}}finally{try{!c&&!n&&(a=s.return)&&(yield tt(a.call(s)))}finally{if(i)throw i.error}}})}function*HC(r,e){for(let t of Rr(r))if(e(t))yield t;else break}function GC(r,e){return Wn(this,arguments,function*(){var n,i,a,o;try{for(var u=!0,c=Nn(Lr(r)),s;s=yield tt(c.next()),n=s.done,!n;){o=s.value,u=!1;try{let l=o;if(yield tt(e(l)))yield yield tt(l);else break}finally{u=!0}}}catch(l){i={error:l}}finally{try{!u&&!n&&(a=c.return)&&(yield tt(a.call(c)))}finally{if(i)throw i.error}}})}function*WC(r,e){if(e<0)throw new mn(`Number of repetitions cannot be negative: ${e}`);for(let t=e;t>0;--t)yield r}function YC(r,e){return Wn(this,arguments,function*(){if(e<0)throw new mn(`Number of repetitions cannot be negative: ${e}`);let n=yield tt(r);for(let i=e;i>0;--i)yield yield tt(n)})}function*jC(r,e){for(let t of Rr(r)){let n=e(t,e);if(Qi(n))for(let i of Rr(n))yield i;else yield n}}function ZC(r,e){return Wn(this,arguments,function*(){var n,i,a,o,u,c,s,l;try{for(var f=!0,p=Nn(Lr(r)),m;m=yield tt(p.next()),n=m.done,!n;){o=m.value,f=!1;try{let T=yield tt(e(o,e));if(Qi(T)||ws(T))try{for(var d=!0,h=(c=void 0,Nn(Lr(T))),x;x=yield tt(h.next()),u=x.done,!u;){l=x.value,d=!1;try{yield yield tt(l)}finally{d=!0}}}catch(v){c={error:v}}finally{try{!d&&!u&&(s=h.return)&&(yield tt(s.call(h)))}finally{if(c)throw c.error}}else yield yield tt(T)}finally{f=!0}}}catch(b){i={error:b}}finally{try{!f&&!n&&(a=p.return)&&(yield tt(a.call(p)))}finally{if(i)throw i.error}}})}function*mx(r,e=1/0){if(e<1){for(let t of Rr(r))r instanceof Map&&(t=t[1]),yield t;return}for(let t of Rr(r))if(r instanceof Map&&(t=t[1]),(Qi(t)||Ua(t))&&!Vo(t))for(let n of mx(t,e-1))yield n;else yield t}function dx(r,e=1/0){return Wn(this,arguments,function*(){var n,i,a,o,u,c,s,l,f,p,m,d;if(e<1){try{for(var h=!0,x=Nn(Lr(r)),b;b=yield tt(x.next()),n=b.done,!n;){o=b.value,h=!1;try{let M=o;r instanceof Map&&(M=M[1]),yield yield tt(M)}finally{h=!0}}}catch(M){i={error:M}}finally{try{!h&&!n&&(a=x.return)&&(yield tt(a.call(x)))}finally{if(i)throw i.error}}return yield tt(void 0)}try{for(var T=!0,v=Nn(Lr(r)),S;S=yield tt(v.next()),u=S.done,!u;){l=S.value,T=!1;try{let M=l;if(r instanceof Map&&(M=M[1]),(ws(M)||Qi(M)||Ua(M))&&!Vo(M))try{for(var _=!0,y=(p=void 0,Nn(dx(M,e-1))),A;A=yield tt(y.next()),f=A.done,!f;){d=A.value,_=!1;try{yield yield tt(d)}finally{_=!0}}}catch(w){p={error:w}}finally{try{!_&&!f&&(m=y.return)&&(yield tt(m.call(y)))}finally{if(p)throw p.error}}else yield yield tt(M)}finally{T=!0}}}catch(M){c={error:M}}finally{try{!T&&!u&&(s=v.return)&&(yield tt(s.call(v)))}finally{if(c)throw c.error}}})}function*JC(r,e){for(let t of Rr(r))e(t)&&(yield t)}function XC(r,e){return Wn(this,arguments,function*(){var n,i,a,o;try{for(var u=!0,c=Nn(Lr(r)),s;s=yield tt(c.next()),n=s.done,!n;){o=s.value,u=!1;try{let l=o;(yield tt(e(l)))&&(yield yield tt(l))}finally{u=!0}}}catch(l){i={error:l}}finally{try{!u&&!n&&(a=c.return)&&(yield tt(a.call(c)))}finally{if(i)throw i.error}}})}function*sd(r,e,t,n=!0){if(e<1)throw new mn(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new mn("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of Rr(r))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-t),a=!0);!a&&i.length>0&&n&&(yield i)}function ud(r,e,t,n=!0){return Wn(this,arguments,function*(){var a,o,u,c;if(e<1)throw new mn(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new mn("Overlap size must be less than chunk size");let s=[],l=!1;try{for(var f=!0,p=Nn(Lr(r)),m;m=yield tt(p.next()),a=m.done,!a;){c=m.value,f=!1;try{let d=c;l=!1,s.push(d),s.length===e&&(yield yield tt(s),s=s.slice(e-t),l=!0)}finally{f=!0}}}catch(d){o={error:d}}finally{try{!f&&!a&&(u=p.return)&&(yield tt(u.call(p)))}finally{if(o)throw o.error}}!l&&s.length>0&&n&&(yield yield tt(s))})}function*QC(r,e){for(let t of sd(r,e,0))yield t}function KC(r,e){return Wn(this,arguments,function*(){var n,i,a,o;try{for(var u=!0,c=Nn(ud(r,e,0)),s;s=yield tt(c.next()),n=s.done,!n;){o=s.value,u=!1;try{yield yield tt(o)}finally{u=!0}}}catch(l){i={error:l}}finally{try{!u&&!n&&(a=c.return)&&(yield tt(a.call(c)))}finally{if(i)throw i.error}}})}function*Qu(r){let e=sd(r,2,1,!1);for(let t of e)yield t}function jf(r){return Wn(this,arguments,function*(){var t,n,i,a;let o=ud(r,2,1,!1);try{for(var u=!0,c=Nn(o),s;s=yield tt(c.next()),t=s.done,!t;){a=s.value,u=!1;try{yield yield tt(a)}finally{u=!0}}}catch(l){n={error:l}}finally{try{!u&&!t&&(i=c.return)&&(yield tt(i.call(c)))}finally{if(n)throw n.error}}})}function*eN(r,e){if(e<0)throw new mn(`Limit must be \u2265 0. Got ${e}`);let t=0;for(let n of Rr(r)){if(t>=e)return;yield n,++t}}function tN(r,e){return Wn(this,arguments,function*(){var n,i,a,o;if(e<0)throw new mn(`Limit must be \u2265 0. Got ${e}`);let u=0;try{for(var c=!0,s=Nn(Lr(r)),l;l=yield tt(s.next()),n=l.done,!n;){o=l.value,c=!1;try{let f=o;if(u>=e)return yield tt(void 0);yield yield tt(f),++u}finally{c=!0}}}catch(f){i={error:f}}finally{try{!c&&!n&&(a=s.return)&&(yield tt(a.call(s)))}finally{if(i)throw i.error}}})}function*rN(r){let e=0;for(let t of Rr(r))yield[e++,t]}function nN(r){return Wn(this,arguments,function*(){var t,n,i,a;let o=0;try{for(var u=!0,c=Nn(Lr(r)),s;s=yield tt(c.next()),t=s.done,!t;){a=s.value,u=!1;try{let l=a;yield yield tt([o++,l])}finally{u=!0}}}catch(l){n={error:l}}finally{try{!u&&!t&&(i=c.return)&&(yield tt(i.call(c)))}finally{if(n)throw n.error}}})}function*iN(r,e=0,t,n=1){if(e<0)throw new mn("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new mn("Parameter 'count' cannot be negative");if(n<=0)throw new mn("Parameter 'step' must be positive");let i=0,a=0;for(let o of Rr(r))if(!(i++<e||(i-e-1)%n!==0)){if(a++===t&&t!==void 0)break;yield o}}function aN(r,e=0,t,n=1){return Wn(this,arguments,function*(){var a,o,u,c;if(e<0)throw new mn("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new mn("Parameter 'count' cannot be negative");if(n<=0)throw new mn("Parameter 'step' must be positive");let s=0,l=0;try{for(var f=!0,p=Nn(Lr(r)),m;m=yield tt(p.next()),a=m.done,!a;){c=m.value,f=!1;try{let d=c;if(s++<e||(s-e-1)%n!==0)continue;if(l++===t&&t!==void 0)break;yield yield tt(d)}finally{f=!0}}}catch(d){o={error:d}}finally{try{!f&&!a&&(u=p.return)&&(yield tt(u.call(p)))}finally{if(o)throw o.error}}})}function*oN(r){for(let[e]of Rr(r))yield e}function sN(r){return Wn(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,u=Nn(Lr(r)),c;c=yield tt(u.next()),t=c.done,!t;){a=c.value,o=!1;try{let[s]=a;yield yield tt(s)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=u.return)&&(yield tt(i.call(u)))}finally{if(n)throw n.error}}})}function*uN(r,e,t=0){if(e<0||t<0)throw new mn;let n=-t;for(let i of Rr(r))(n<0||n>=e)&&(yield i),++n}function lN(r,e,t=0){return Wn(this,arguments,function*(){var i,a,o,u;if(e<0||t<0)throw new mn;let c=-t;try{for(var s=!0,l=Nn(Lr(r)),f;f=yield tt(l.next()),i=f.done,!i;){u=f.value,s=!1;try{let p=u;(c<0||c>=e)&&(yield yield tt(p)),++c}finally{s=!0}}}catch(p){a={error:p}}finally{try{!s&&!i&&(o=l.return)&&(yield tt(o.call(l)))}finally{if(a)throw a.error}}})}function*cN(r){for(let[,e]of Rr(r))yield e}function fN(r){return Wn(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,u=Nn(Lr(r)),c;c=yield tt(u.next()),t=c.done,!t;){a=c.value,o=!1;try{let[,s]=a;yield yield tt(s)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=u.return)&&(yield tt(i.call(u)))}finally{if(n)throw n.error}}})}function*pN(r,e,t){let n=new Map,i=a=>{n.has(a)||(t!==void 0?n.set(a,{}):n.set(a,[]))};for(let a of Rr(r)){let o=e(a),u=t!==void 0?t(a):void 0,c=(Qi(o)||Ua(o))&&!Vo(o)?o:[o];for(let s of px(c))i(s),u===void 0?n.get(s).push(a):n.get(s)[u]=a}for(let a of n)yield a}function mN(r,e,t){return Wn(this,arguments,function*(){var i,a,o,u,c,s,l,f;let p=new Map,m=S=>{p.has(S)||(t!==void 0?p.set(S,{}):p.set(S,[]))};try{for(var d=!0,h=Nn(Lr(r)),x;x=yield tt(h.next()),i=x.done,!i;){u=x.value,d=!1;try{let S=u,_=yield tt(e(S)),y=t!==void 0?yield tt(t(S)):void 0,A=(ws(_)||Qi(_)||Ua(_))&&!Vo(_)?_:[_];try{for(var b=!0,T=(s=void 0,Nn(RC(A))),v;v=yield tt(T.next()),c=v.done,!c;){f=v.value,b=!1;try{let M=f;m(M),y===void 0?p.get(M).push(S):p.get(M)[y]=S}finally{b=!0}}}catch(M){s={error:M}}finally{try{!b&&!c&&(l=T.return)&&(yield tt(l.call(T)))}finally{if(s)throw s.error}}}finally{d=!0}}}catch(S){a={error:S}}finally{try{!d&&!i&&(o=h.return)&&(yield tt(o.call(h)))}finally{if(a)throw a.error}}for(let S of p)yield yield tt(S)})}function*dN(r,e){let t=fx(r);e!==void 0?t.sort(e):t.sort();for(let n of t)yield n}function hN(r,e){return Wn(this,arguments,function*(){let n=yield tt(Yf(r));e!==void 0?n.sort(e):n.sort();for(let i of n)yield yield tt(i)})}var uC={chunkwise:QC,chunkwiseOverlap:sd,compress:VC,dropWhile:qC,enumerate:rN,filter:JC,flatMap:jC,flatten:mx,groupBy:pN,keys:oN,limit:eN,map:LC,pairwise:Qu,repeat:WC,skip:uN,slice:iN,sort:dN,takeWhile:HC,values:cN,chunkwiseAsync:KC,chunkwiseOverlapAsync:ud,compressAsync:UC,dropWhileAsync:zC,enumerateAsync:nN,filterAsync:XC,flatMapAsync:ZC,flattenAsync:dx,groupByAsync:mN,keysAsync:sN,limitAsync:tN,mapAsync:od,pairwiseAsync:jf,repeatAsync:YC,skipAsync:lN,sliceAsync:aN,sortAsync:hN,takeWhileAsync:GC,valuesAsync:fN};var gN={allMatch:vC,allUnique:xC,anyMatch:wC,exactlyN:SC,isEmpty:EC,isAsyncIterable:ws,isIterable:Qi,isIterator:Ua,isReversed:MC,isSorted:CC,isString:Vo,noneMatch:FC,same:PC,sameCount:kC,allMatchAsync:yC,allUniqueAsync:bC,anyMatchAsync:_C,exactlyNAsync:AC,isEmptyAsync:TC,isReversedAsync:DC,isSortedAsync:NC,noneMatchAsync:IC,sameAsync:BC,sameCountAsync:$C};var ld=require("obsidian");var vN=require("obsidian");var _s=class{static checkSelectionOverlap(e,t,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=t&&i.from<=n)return!0;return!1}static checkRangeOverlap(e,t,n,i){return e<=i&&n<=t}static getContent(e,t,n){return e.sliceDoc(t,n)}static getCurrentFile(e){return e.state.field(vN.editorInfoField).file}static existsDecorationBetween(e,t,n){let i=!1;return e.between(t,n,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,t,n,i){let a=!1;return e.between(n,i,(o,u,c)=>{c.spec.mb_widgetType===t&&(a=!0)}),a}};function yN(r){return Ku.ViewPlugin.fromClass(class{constructor(e){this.component=new ld.Component,this.component.load(),this.decorations=this.renderWidgets(e)??Ku.Decoration.none,e.dom.addEventListener("click",t=>this.handleClick(t))}handleClick(e){if(e.target instanceof HTMLElement){let t=e.target;for(;t!==null;){if(t.classList.contains("mb-input")){e.stopPropagation();break}t=t.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:(t,n,i)=>gN.anyMatch(e.visibleRanges,o=>_s.checkRangeOverlap(t,n,o.from,o.to))?!0:(i.spec.mb_unload?.(),!1)});for(let{from:t,to:n}of e.visibleRanges)(0,hx.syntaxTree)(e.state).iterate({from:t,to:n,enter:i=>{let a=i.node,o=this.getRenderInfo(e,a);o.widgetType===void 0||o.content===void 0||(o.shouldRender?(this.removeDecoration(a,"field"),this.addDecoration(a,e,"field",o.content,o.widgetType)):o.shouldHighlight?(this.removeDecoration(a,"highlight"),this.addDecoration(a,e,"highlight",o.content,o.widgetType)):this.removeDecoration(a))}})}removeDecoration(e,t){this.decorations.between(e.from-1,e.to+1,(n,i,a)=>{this.decorations=this.decorations.update({filterFrom:n,filterTo:i,filter:(o,u,c)=>{let s=c.spec;return t&&s.mb_widgetType===t?!0:(s.mb_unload?.(),!1)}})})}addDecoration(e,t,n,i,a){let o=e.from-1,u=e.to+1;if(_s.existsDecorationOfTypeBetween(this.decorations,n,o,u))return;let c=_s.getCurrentFile(t);if(!c)return;let s=this.renderWidget(e,a,n,i,c),l=Array.isArray(s)?s:[s];l.length!==0&&(this.decorations=this.decorations.update({add:l}))}getRenderInfo(e,t){let n=new Set(t.type.name?.split("_"));if(n.has("inline-code")&&!n.has("formatting")){let i=_s.checkSelectionOverlap(e.state.selection,t.from-1,t.to+1),a=this.readNode(e,t.from,t.to),o=this.isLivePreview(e.state),u=!i&&o;return{shouldRender:u,shouldHighlight:!u&&r.settings.enableSyntaxHighlighting,content:a.content,widgetType:a.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,t,n){let i=_s.getContent(e.state,t,n);return{content:i,widgetType:r.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let t=_s.getCurrentFile(e);if(!t)return;let n=[];for(let i of e.visibleRanges)(0,hx.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,u=this.getRenderInfo(e,o);if(!u.widgetType||!u.content)return;let c;u.shouldRender&&(c=this.renderWidget(o,u.widgetType,"field",u.content,t)),u.shouldHighlight&&(c=this.renderWidget(o,u.widgetType,"highlight",u.content,t)),c&&(Array.isArray(c)?n.push(...c):n.push(c))}});return Ku.Decoration.set(n,!0)}renderWidget(e,t,n,i,a){if(n==="field"){let o=r.api.constructMDRCWidget(t,i,a.path,this.component);return Ku.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{o.renderChild?.unload()}}).range(e.from-1,e.to+1)}else return r.api.syntaxHighlighting.highlight(i,t,!1).getHighlights().map(u=>Ku.Decoration.mark({class:`mb-highlight-${u.tokenClass}`}).range(e.from+u.range.from.index,e.from+u.range.to.index))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var Xt=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof Hn?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(t=>t.errorLevel==="ERROR"||t.errorLevel==="CRITICAL");return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel==="WARNING")}};var Zf=Or(va()),Jf=Or(Xi());var vz=Jf.P.sequenceMap((r,e,t,n)=>{let i=parseInt(r),a=parseInt(e),o=parseInt(t);return new xa(i,a,o,n)},Zf.P_UTILS.digits().skip(Jf.P.string(".")),Zf.P_UTILS.digits().skip(Jf.P.string(".")),Zf.P_UTILS.digits(),Jf.P.string("-").then(Zf.P_UTILS.remaining()).optional()),xa=class r{constructor(e,t,n,i){this.major=e,this.minor=t,this.patch=n,this.prerelease=i}static fromString(e){return Gn(vz,e)}static lessThan(e,t){return e.major<t.major?!0:e.major>t.major?!1:e.minor<t.minor?!0:e.minor>t.minor?!1:e.patch<t.patch?!0:e.patch>t.patch||e.prerelease===void 0?!1:t.prerelease===void 0?!0:e.prerelease<t.prerelease}static greaterThan(e,t){return r.lessThan(t,e)}static equals(e,t){return e.major===t.major&&e.minor===t.minor&&e.patch===t.patch&&e.prerelease===t.prerelease}toString(){return`${this.major}.${this.minor}.${this.patch}${this.prerelease===void 0?"":`-${this.prerelease}`}`}};var cd=class{constructor(e,t){this.plugin=e,this.dependencies=t}getDependency(e){let t=this.dependencies.find(n=>n.pluginId===e);if(t===void 0)throw new Ju({errorLevel:"CRITICAL",effect:"Dependency violation detected",cause:`Attempted to access dependency ${e} which is not a listed dependency. Please report this error.`});return t}getPlugin(e){return this.plugin.app.plugins.getPlugin(e)}throwPluginNotFound(e){throw new Ju({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e} is required, but not installed. Please install the plugin.`})}checkDependencyVersion(e,t){if(xa.lessThan(t,e.minVersion))throw new Ju({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${t}. Please update the plugin.`});if(e.maxVersion!==void 0&&(xa.greaterThan(t,e.maxVersion)||xa.equals(t,e.maxVersion)))throw new Ju({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e.pluginId} is too new. Required version is lower than ${e.maxVersion}, installed version is ${t}. Please downgrade the plugin.`})}checkDependency(e){let t=this.getDependency(e),n=this.getPlugin(e);if(n==null)throw this.throwPluginNotFound(e),Error("unreachable");let i=xa.fromString(n.manifest.version);return this.checkDependencyVersion(t,i),n}checkDependencyOnStartup(e){let t=this.getDependency(e);if(!this.plugin.app.plugins.enabledPlugins.has(e))throw this.throwPluginNotFound(e),Error("unreachable");let n=xa.fromString(this.plugin.app.plugins.manifests[e].version);this.checkDependencyVersion(t,n)}checkDependenciesOnStartup(){let e=new Xt("Dependency Validation");for(let t of this.dependencies)if(t.checkOnStartup)try{this.checkDependencyOnStartup(t.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 SN=require("obsidian");var xN={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:""},gx={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 bN(r){let e=[];for(let[t,n]of Object.entries(xN)){if(n==="")continue;let i=r.api.inputFieldParser.fromString(`INPUT[${n}]`),a=r.api.inputFieldParser.fromSimpleDeclaration({inputFieldType:void 0,templateName:void 0,bindTarget:void 0,arguments:[{name:"showcase",value:["true"]},{name:"title",value:[t]}]});i=r.api.inputFieldParser.merge(i,a),i.declarationString=`INPUT[${n}]`;let o=r.api.inputFieldParser.validate(i,"",void 0);e.push([t,o])}return e}function wN(r){let e=[];for(let[t,n]of Object.entries(xN)){if(n==="")continue;let i=t,a="";Om[i].allowInline?a=`\`INPUT[${n}:exampleProperty]\``:a=`
\`\`\`meta-bind
INPUT[${n}:exampleProperty]
\`\`\`
`,e.push([i,a])}return e.sort((t,n)=>t[0].localeCompare(n[0])),e}function _N(r){let e=[];for(let t of Object.values(gx))for(let n of t)e.push([n.title,`\`${n.display}\``]);return e.sort((t,n)=>t[0].localeCompare(n[0])),e}function AN(r,e,t){let n=wN(t),i=_N(t);r.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(u=>{u.setTitle("Input Field");let c=u.setSubmenu();for(let[s,l]of n)c.addItem(f=>{f.setTitle(s),f.onClick(()=>fd(e,l))})}),o.addItem(u=>{u.setTitle("View Field");let c=u.setSubmenu();for(let[s,l]of i)c.addItem(f=>{f.setTitle(s),f.onClick(()=>fd(e,l))})}),o.addItem(u=>{u.setTitle("Inline Button"),u.onClick(()=>{fd(e,"`BUTTON[example-id]`")})}),o.addItem(u=>{u.setTitle("Button"),u.onClick(()=>{t.internal.openButtonBuilderModal({onOkay:c=>{fd(e,`\`\`\`meta-bind-button
${(0,SN.stringifyYaml)(c)}
\`\`\``)},submitText:"Insert"})})})})}function fd(r,e){r.replaceSelection(e)}var m6=require("obsidian");var ON=Or(va());var vn=Or(va()),bx=Or(Xi());var CN=Or(va()),Ri=Or(Xi());var Xf=Or(va()),ba=Or(Xi()),vi=ba.P.sequence(ba.P.or(Xf.P_UTILS.unicodeLetter(),ba.P.oneOf("_$")),ba.P.or(Xf.P_UTILS.unicodeAlphanumeric(),ba.P.oneOf("-_$")).many()).map(r=>r[0]+r[1].join("")).describe("identifier"),EN=ba.P.sequenceMap((r,e)=>r+e.map(t=>t[0]+t[1]).join(""),vi,ba.P.sequence(Xf.P_UTILS.optionalWhitespace(),vi).many()).describe("identifier with spaces"),yz=ba.P.string("\\").then(Xf.P_UTILS.any()).map(r=>r==="'"?"'":r==="\\"?"\\":"\\"+r);function TN(r){return ba.P.or(yz,ba.P.noneOf(r+"\\")).many().map(e=>e.join("")).trim(ba.P.string(r))}var pd=TN("'"),MN=TN('"'),cc=ba.P.manyNotOf("{}[]#^|:?").box("file path");function Oi(r,e){return{value:r,position:e}}function wa(r){if(r!==void 0)return typeof r=="string"?{value:r}:r}var tl=(t=>(t.OBJECT="object",t.ARRAY="array",t))(tl||{}),md=class{constructor(e,t,n){this.parent=e,this.access=t,this.child=n}};function xz(r,e){return r[e]}function DN(r,e,t){r[e]=t}var el=class{constructor(e,t){if(this.type=e,this.prop=e==="object"?t:"",this.index=e==="array"?Number(t):0,Number.isNaN(this.index))throw new Error("can not access array with non number index")}get(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");return new md(e,this,xz(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 md(e,this,e[this.index])}}set(e,t){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");DN(e,this.prop,t)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=t}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");DN(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 NN=vi.node((r,e)=>({type:"object",prop:Oi(r,e)})),vx=Ri.P.or(CN.P_UTILS.digits().wrap(Ri.P.string("["),Ri.P.string("]")).node((r,e)=>({type:"array",prop:Oi(r,e)})),MN.wrap(Ri.P.string("["),Ri.P.string("]")).node((r,e)=>({type:"object",prop:Oi(r,e)}))),bz=Ri.P.or(Ri.P.sequenceMap(r=>({storagePath:void 0,listenToChildren:!1,storageProp:r}),vx.atLeast(1)),Ri.P.sequenceMap((r,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[r,...e]}),NN,vx.many())),wz=Ri.P.sequenceMap((r,e)=>[r,...e],NN,vx.many()),yx=Ri.P.sequenceMap((r,e)=>(r.storageProp=r.storageProp.concat(e.flat()),r),bz,Ri.P.string(".").then(wz).many()),qo=Ri.P.sequenceMap((r,e,t)=>(t.storageType=r,t.storagePath=e,t),vi.describe("storage type").node(Oi).skip(Ri.P.string("^").describe('storage type separator "^"')).optional(),cc.describe("storage path").node(Oi).skip(Ri.P.string("#").describe('storage/file path separator "#"')).optional(),yx.describe("property path")).box("bind target");var dd=Or(va()),zo=Or(Xi());var xx=zo.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),_z=zo.P.or(pd,xx).node(Oi),Sz=zo.P.separateBy(_z,zo.P.string(",").describe('argument value separator ","').trim(dd.P_UTILS.optionalWhitespace())),Az=zo.P.sequenceMap((r,e)=>({name:r,value:e}),vi.node(Oi),Sz.trim(dd.P_UTILS.optionalWhitespace()).wrap(zo.P.string("(").describe('argument value paren "("'),zo.P.string(")").describe('argument value paren ")"')).optional([])),Qf=zo.P.separateBy(Az,zo.P.string(",").describe('argument separator ","').trim(dd.P_UTILS.optionalWhitespace()));var Ki=Or(va()),kn=Or(Xi());var Ez=kn.P.string("\\").then(Ki.P_UTILS.any()).map(r=>r==="["?"[":r==="]"?"]":r==="{"?"{":r==="}"?"}":r==="\\"?"\\":"\\"+r),hd=kn.P.sequenceMap((r,e)=>r+e.flat().join(""),kn.P.manyNotOf("{}[]\\"),kn.P.sequence(Ez,kn.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),Tz=kn.P.sequenceMap((r,e)=>[r,...e.flat()],hd,kn.P.sequence(qo.wrapString("{","}"),hd).many()),Mz=kn.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{viewFieldType:r,writeToBindTarget:n,arguments:e,templateDeclaration:void 0}},vi.node(Oi).trim(Ki.P_UTILS.optionalWhitespace()).optional().describe("input field type"),Qf.trim(Ki.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(Ki.P_UTILS.optionalWhitespace()).optional([]),kn.P.sequence(kn.P.string(":").trim(Ki.P_UTILS.optionalWhitespace()),qo).trim(Ki.P_UTILS.optionalWhitespace()).optional()),FN=kn.P.sequenceMap((r,e,t,n)=>n===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(n.templateDeclaration=e,n),kn.P.string("VIEW"),Tz.wrapString("[","]"),Ki.P_UTILS.optionalWhitespace(),Mz.wrapString("[","]").optional(),Ki.P_UTILS.eof()),Dz=kn.P.sequenceMap((r,e,t,n)=>(e!==void 0&&(r.listenToChildren=!0),{bindTarget:r,name:n}),qo.wrapString("{","}"),kn.P.string(" and children").optional(),kn.P.string(" as "),vi),IN=kn.P.sequenceMap((r,e,t,n)=>({bindTargetMappings:r,writeToBindTarget:e,hidden:t!==void 0,code:n}),Dz.separateBy(Ki.P_UTILS.whitespace()).skip(Ki.P_UTILS.whitespace()),kn.P.string("save to ").then(qo.wrapString("{","}")).skip(Ki.P_UTILS.whitespace()).optional(),kn.P.string("hidden").skip(Ki.P_UTILS.whitespace()).optional(),kn.P.string("---").then(Ki.P_UTILS.remaining()));var wx=$t.highlight(vi,"ident"),gd=$t.highlight(vi,"keyword"),_x=$t.highlightStr(",","control"),vd=$t.highlightStr("(","control"),yd=$t.highlightStr(")","control"),fc=$t.highlightStr("[","control"),pc=$t.highlightStr("]","control"),Cz=$t.highlight(pd,"string"),Nz=$t.highlight(xx,"ident"),Fz=bx.P.or(Nz,Cz),Iz=$t.separateBy(Fz,_x.trim(vn.P_UTILS.optionalWhitespace())),Pz=$t.sequence(gd,$t.sequence(vd,Iz.trim(vn.P_UTILS.optionalWhitespace()),yd).optional()),Sx=$t.separateBy(Pz,_x.trim(vn.P_UTILS.optionalWhitespace())),mc=$t.sequence($t.sequence(wx,$t.highlightStr("^","control")).optional(),$t.sequence($t.highlight(cc,"ident"),$t.highlightStr("#","control")).optional(),$t.highlight(yx,"ident")),Bz=$t.sequence(gd.trim(vn.P_UTILS.optionalWhitespace()),$t.sequence(vd,Sx.trim(vn.P_UTILS.optionalWhitespace()),yd).trim(vn.P_UTILS.optionalWhitespace()).optional(),$t.sequence($t.highlightStr(":","control").trim(vn.P_UTILS.optionalWhitespace()),mc).trim(vn.P_UTILS.optionalWhitespace()).optional()),kz=$t.sequence(gd.trim(vn.P_UTILS.optionalWhitespace()).optional(),$t.sequence(vd,Sx.trim(vn.P_UTILS.optionalWhitespace()),yd).trim(vn.P_UTILS.optionalWhitespace()).optional(),$t.sequence($t.highlightStr(":","control").trim(vn.P_UTILS.optionalWhitespace()),mc).trim(vn.P_UTILS.optionalWhitespace()).optional()),BN=bx.P.or($t.sequence($t.highlightStr("INPUT","control"),fc,wx.trim(vn.P_UTILS.optionalWhitespace()),pc.skip(vn.P_UTILS.optionalWhitespace()),fc,kz,pc),$t.sequence($t.highlightStr("INPUT","control"),fc,Bz,pc)),PN=$t.highlight(hd,"ident"),$z=$t.sequence($t.highlightStr("{","string"),mc,$t.highlightStr("}","string")),Oz=$t.sequence(PN,$t.sequence($z,PN).many()),Rz=$t.sequence(gd.trim(vn.P_UTILS.optionalWhitespace()).optional(),$t.sequence(vd,Sx.trim(vn.P_UTILS.optionalWhitespace()).optional(),yd).trim(vn.P_UTILS.optionalWhitespace()).optional(),$t.sequence($t.highlightStr(":","control").trim(vn.P_UTILS.optionalWhitespace()),mc).trim(vn.P_UTILS.optionalWhitespace()).optional()),kN=$t.sequence($t.highlightStr("VIEW","control"),fc,Oz,pc,$t.sequence(fc.skip(vn.P_UTILS.optionalWhitespace()),Rz,pc).optional()),$N=$t.sequence($t.highlightStr("BUTTON","control"),fc,$t.separateBy(wx,_x.trim(vn.P_UTILS.optionalWhitespace())),pc);var xd=class{constructor(e){this.plugin=e}highlightInputFieldDeclaration(e,t){return this.highlightWithParser(e,t,BN)}highlightViewFieldDeclaration(e,t){return this.highlightWithParser(e,t,kN)}highlightInlineButtonDeclaration(e,t){return this.highlightWithParser(e,t,$N)}highlight(e,t,n){if(t==="INPUT")return this.highlightInputFieldDeclaration(e,n);if(t==="VIEW")return this.highlightViewFieldDeclaration(e,n);if(t==="BUTTON_GROUP")return this.highlightInlineButtonDeclaration(e,n);throw new Error(`Unknown MDRCType ${t}`)}highlightBindTarget(e,t){return this.highlightWithParser(e,t,mc)}highlightWithParser(e,t,n){try{return t?new ys(e,Gn(n.trim(ON.P_UTILS.optionalWhitespace()).thenEof(),e)):new ys(e,Gn(n.thenEof(),e))}catch(i){return i instanceof Uf?new ys(e,[],i):(console.error(i),new ys(e,[]))}}};var yn=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(yn||{}),iu=(m=>(m.COMMAND="command",m.JS="js",m.OPEN="open",m.INPUT="input",m.SLEEP="sleep",m.TEMPLATER_CREATE_NOTE="templaterCreateNote",m.UPDATE_METADATA="updateMetadata",m.CREATE_NOTE="createNote",m.REPLACE_IN_NOTE="replaceInNote",m.REGEXP_REPLACE_IN_NOTE="regexpReplaceInNote",m.REPLACE_SELF="replaceSelf",m.INSERT_INTO_NOTE="insertIntoNote",m.INLINE_JS="inlineJS",m))(iu||{});var Mr;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},r.getValidEnumValues=i=>{let a=r.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),o={};for(let u of a)o[u]=i[u];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(a){return i[a]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},r.find=(i,a)=>{for(let o of i)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Mr||(Mr={}));var Ex;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ex||(Ex={}));var pt=Mr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),au=r=>{switch(typeof r){case"undefined":return pt.undefined;case"string":return pt.string;case"number":return isNaN(r)?pt.nan:pt.number;case"boolean":return pt.boolean;case"function":return pt.function;case"bigint":return pt.bigint;case"symbol":return pt.symbol;case"object":return Array.isArray(r)?pt.array:r===null?pt.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?pt.promise:typeof Map<"u"&&r instanceof Map?pt.map:typeof Set<"u"&&r instanceof Set?pt.set:typeof Date<"u"&&r instanceof Date?pt.date:pt.object;default:return pt.unknown}},We=Mr.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"]),Lz=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),_a=class r extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let u=n,c=0;for(;c<o.path.length;){let s=o.path[c];c===o.path.length-1?(u[s]=u[s]||{_errors:[]},u[s]._errors.push(t(o))):u[s]=u[s]||{_errors:[]},u=u[s],c++}}};return i(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Mr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};_a.create=r=>new _a(r);var gc=(r,e)=>{let t;switch(r.code){case We.invalid_type:r.received===pt.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case We.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Mr.jsonStringifyReplacer)}`;break;case We.unrecognized_keys:t=`Unrecognized key(s) in object: ${Mr.joinValues(r.keys,", ")}`;break;case We.invalid_union:t="Invalid input";break;case We.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Mr.joinValues(r.options)}`;break;case We.invalid_enum_value:t=`Invalid enum value. Expected ${Mr.joinValues(r.options)}, received '${r.received}'`;break;case We.invalid_arguments:t="Invalid function arguments";break;case We.invalid_return_type:t="Invalid function return type";break;case We.invalid_date:t="Invalid date";break;case We.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:Mr.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case We.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case We.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case We.custom:t="Invalid input";break;case We.invalid_intersection_types:t="Intersection results could not be merged";break;case We.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case We.not_finite:t="Number must be finite";break;default:t=e.defaultError,Mr.assertNever(r)}return{message:t}},VN=gc;function Vz(r){VN=r}function bd(){return VN}var wd=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,a=[...t,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let u="",c=n.filter(s=>!!s).slice().reverse();for(let s of c)u=s(o,{data:e,defaultError:u}).message;return{...i,path:a,message:u}},Uz=[];function st(r,e){let t=bd(),n=wd({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===gc?void 0:gc].filter(i=>!!i)});r.common.issues.push(n)}var yi=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return Zt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return 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"}),hc=r=>({status:"dirty",value:r}),Li=r=>({status:"valid",value:r}),Tx=r=>r.status==="aborted",Mx=r=>r.status==="dirty",tp=r=>r.status==="valid",rp=r=>typeof Promise<"u"&&r instanceof Promise;function _d(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function UN(r,e,t,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"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t}var Ct;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Ct||(Ct={}));var Kf,ep,za=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},RN=(r,e)=>{if(tp(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new _a(r.common.issues);return this._error=t,this._error}}};function fr(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,u)=>{var c,s;let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??u.defaultError}:typeof u.data>"u"?{message:(c=l??n)!==null&&c!==void 0?c:u.defaultError}:o.code!=="invalid_type"?{message:u.defaultError}:{message:(s=l??t)!==null&&s!==void 0?s:u.defaultError}},description:i}}var pr=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return au(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:au(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new yi,ctx:{common:e.parent.common,data:e.data,parsedType:au(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(rp(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:au(e)},a=this._parseSync({data:e,path:i.path,parent:i});return RN(i,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:au(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(rp(i)?i:Promise.resolve(i));return RN(n,a)}refine(e,t){let n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{let o=e(i),u=()=>a.addIssue({code:We.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(u(),!1)):o?!0:(u(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Sa({schema:this,typeName:Gt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return qa.create(this,this._def)}nullable(){return Go.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Es.create(this,this._def)}promise(){return uu.create(this,this._def)}or(e){return ul.create([this,e],this._def)}and(e){return ll.create(this,e,this._def)}transform(e){return new Sa({...fr(this._def),schema:this,typeName:Gt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new dl({...fr(this._def),innerType:this,defaultValue:t,typeName:Gt.ZodDefault})}brand(){return new np({typeName:Gt.ZodBranded,type:this,...fr(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new hl({...fr(this._def),innerType:this,catchValue:t,typeName:Gt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ip.create(this,e)}readonly(){return gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qz=/^c[^\s-]{8,}$/i,zz=/^[0-9a-z]+$/,Hz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Gz=/^[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,Wz=/^[a-z0-9_-]{21}$/i,Yz=/^[-+]?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)?)??$/,jz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ax,Jz=/^(?:(?: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])$/,Xz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Qz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qN="((\\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])))",Kz=new RegExp(`^${qN}$`);function zN(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function eH(r){return new RegExp(`^${zN(r)}$`)}function HN(r){let e=`${qN}T${zN(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function tH(r,e){return!!((e==="v4"||!e)&&Jz.test(r)||(e==="v6"||!e)&&Xz.test(r))}var ou=class r extends pr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pt.string){let a=this._getOrReturnCtx(e);return st(a,{code:We.invalid_type,expected:pt.string,received:a.parsedType}),Zt}let n=new yi,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),st(i,{code:We.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),st(i,{code:We.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,u=e.data.length<a.value;(o||u)&&(i=this._getOrReturnCtx(e,i),o?st(i,{code:We.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):u&&st(i,{code:We.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")jz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"email",code:We.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ax||(Ax=new RegExp(Zz,"u")),Ax.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"emoji",code:We.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Gz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"uuid",code:We.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Wz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"nanoid",code:We.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")qz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"cuid",code:We.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")zz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"cuid2",code:We.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Hz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"ulid",code:We.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),st(i,{validation:"url",code:We.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"regex",code:We.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),st(i,{code:We.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),st(i,{code:We.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),st(i,{code:We.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?HN(a).test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{code:We.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Kz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{code:We.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?eH(a).test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{code:We.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Yz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"duration",code:We.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?tH(e.data,a.version)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"ip",code:We.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Qz.test(e.data)||(i=this._getOrReturnCtx(e,i),st(i,{validation:"base64",code:We.invalid_string,message:a.message}),n.dirty()):Mr.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:We.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,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:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...Ct.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,...Ct.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Ct.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get 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 isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ou.create=r=>{var e;return new ou({checks:[],typeName:Gt.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...fr(r)})};function rH(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,a=parseInt(r.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var rl=class r extends pr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==pt.number){let a=this._getOrReturnCtx(e);return st(a,{code:We.invalid_type,expected:pt.number,received:a.parsedType}),Zt}let n,i=new yi;for(let a of this._def.checks)a.kind==="int"?Mr.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:We.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),st(n,{code:We.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),st(n,{code:We.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?rH(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),st(n,{code:We.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:We.not_finite,message:a.message}),i.dirty()):Mr.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Mr.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};rl.create=r=>new rl({checks:[],typeName:Gt.ZodNumber,coerce:r?.coerce||!1,...fr(r)});var nl=class r extends pr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==pt.bigint){let a=this._getOrReturnCtx(e);return st(a,{code:We.invalid_type,expected:pt.bigint,received:a.parsedType}),Zt}let n,i=new yi;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),st(n,{code:We.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),st(n,{code:We.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),st(n,{code:We.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Mr.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};nl.create=r=>{var e;return new nl({checks:[],typeName:Gt.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...fr(r)})};var il=class extends pr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pt.boolean){let n=this._getOrReturnCtx(e);return st(n,{code:We.invalid_type,expected:pt.boolean,received:n.parsedType}),Zt}return Li(e.data)}};il.create=r=>new il({typeName:Gt.ZodBoolean,coerce:r?.coerce||!1,...fr(r)});var al=class r extends pr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pt.date){let a=this._getOrReturnCtx(e);return st(a,{code:We.invalid_type,expected:pt.date,received:a.parsedType}),Zt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return st(a,{code:We.invalid_date}),Zt}let n=new yi,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),st(i,{code:We.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),st(i,{code:We.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Mr.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};al.create=r=>new al({checks:[],coerce:r?.coerce||!1,typeName:Gt.ZodDate,...fr(r)});var vc=class extends pr{_parse(e){if(this._getType(e)!==pt.symbol){let n=this._getOrReturnCtx(e);return st(n,{code:We.invalid_type,expected:pt.symbol,received:n.parsedType}),Zt}return Li(e.data)}};vc.create=r=>new vc({typeName:Gt.ZodSymbol,...fr(r)});var ol=class extends pr{_parse(e){if(this._getType(e)!==pt.undefined){let n=this._getOrReturnCtx(e);return st(n,{code:We.invalid_type,expected:pt.undefined,received:n.parsedType}),Zt}return Li(e.data)}};ol.create=r=>new ol({typeName:Gt.ZodUndefined,...fr(r)});var sl=class extends pr{_parse(e){if(this._getType(e)!==pt.null){let n=this._getOrReturnCtx(e);return st(n,{code:We.invalid_type,expected:pt.null,received:n.parsedType}),Zt}return Li(e.data)}};sl.create=r=>new sl({typeName:Gt.ZodNull,...fr(r)});var su=class extends pr{constructor(){super(...arguments),this._any=!0}_parse(e){return Li(e.data)}};su.create=r=>new su({typeName:Gt.ZodAny,...fr(r)});var As=class extends pr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Li(e.data)}};As.create=r=>new As({typeName:Gt.ZodUnknown,...fr(r)});var Ao=class extends pr{_parse(e){let t=this._getOrReturnCtx(e);return st(t,{code:We.invalid_type,expected:pt.never,received:t.parsedType}),Zt}};Ao.create=r=>new Ao({typeName:Gt.ZodNever,...fr(r)});var yc=class extends pr{_parse(e){if(this._getType(e)!==pt.undefined){let n=this._getOrReturnCtx(e);return st(n,{code:We.invalid_type,expected:pt.void,received:n.parsedType}),Zt}return Li(e.data)}};yc.create=r=>new yc({typeName:Gt.ZodVoid,...fr(r)});var Es=class r extends pr{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==pt.array)return st(t,{code:We.invalid_type,expected:pt.array,received:t.parsedType}),Zt;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,u=t.data.length<i.exactLength.value;(o||u)&&(st(t,{code:o?We.too_big:We.too_small,minimum:u?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(st(t,{code:We.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(st(t,{code:We.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,u)=>i.type._parseAsync(new za(t,o,t.path,u)))).then(o=>yi.mergeArray(n,o));let a=[...t.data].map((o,u)=>i.type._parseSync(new za(t,o,t.path,u)));return yi.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}};Es.create=(r,e)=>new Es({type:r,minLength:null,maxLength:null,exactLength:null,typeName:Gt.ZodArray,...fr(e)});function dc(r){if(r instanceof ea){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=qa.create(dc(n))}return new ea({...r._def,shape:()=>e})}else return r instanceof Es?new Es({...r._def,type:dc(r.element)}):r instanceof qa?qa.create(dc(r.unwrap())):r instanceof Go?Go.create(dc(r.unwrap())):r instanceof Ho?Ho.create(r.items.map(e=>dc(e))):r}var ea=class r extends pr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Mr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==pt.object){let s=this._getOrReturnCtx(e);return st(s,{code:We.invalid_type,expected:pt.object,received:s.parsedType}),Zt}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),u=[];if(!(this._def.catchall instanceof Ao&&this._def.unknownKeys==="strip"))for(let s in i.data)o.includes(s)||u.push(s);let c=[];for(let s of o){let l=a[s],f=i.data[s];c.push({key:{status:"valid",value:s},value:l._parse(new za(i,f,i.path,s)),alwaysSet:s in i.data})}if(this._def.catchall instanceof Ao){let s=this._def.unknownKeys;if(s==="passthrough")for(let l of u)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(s==="strict")u.length>0&&(st(i,{code:We.unrecognized_keys,keys:u}),n.dirty());else if(s!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let s=this._def.catchall;for(let l of u){let f=i.data[l];c.push({key:{status:"valid",value:l},value:s._parse(new za(i,f,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let s=[];for(let l of c){let f=await l.key,p=await l.value;s.push({key:f,value:p,alwaysSet:l.alwaysSet})}return s}).then(s=>yi.mergeObjectSync(n,s)):yi.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,a,o,u;let c=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(u=Ct.errToObj(e).message)!==null&&u!==void 0?u:c}:{message:c}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Gt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return Mr.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return Mr.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return dc(this)}partial(e){let t={};return Mr.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return Mr.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof qa;)a=a._def.innerType;t[n]=a}}),new r({...this._def,shape:()=>t})}keyof(){return GN(Mr.objectKeys(this.shape))}};ea.create=(r,e)=>new ea({shape:()=>r,unknownKeys:"strip",catchall:Ao.create(),typeName:Gt.ZodObject,...fr(e)});ea.strictCreate=(r,e)=>new ea({shape:()=>r,unknownKeys:"strict",catchall:Ao.create(),typeName:Gt.ZodObject,...fr(e)});ea.lazycreate=(r,e)=>new ea({shape:r,unknownKeys:"strip",catchall:Ao.create(),typeName:Gt.ZodObject,...fr(e)});var ul=class extends pr{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(a){for(let u of a)if(u.result.status==="valid")return u.result;for(let u of a)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let o=a.map(u=>new _a(u.ctx.common.issues));return st(t,{code:We.invalid_union,unionErrors:o}),Zt}if(t.common.async)return Promise.all(n.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of n){let s={...t,common:{...t.common,issues:[]},parent:null},l=c._parseSync({data:t.data,path:t.path,parent:s});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,ctx:s}),s.common.issues.length&&o.push(s.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let u=o.map(c=>new _a(c));return st(t,{code:We.invalid_union,unionErrors:u}),Zt}}get options(){return this._def.options}};ul.create=(r,e)=>new ul({options:r,typeName:Gt.ZodUnion,...fr(e)});var Ss=r=>r instanceof cl?Ss(r.schema):r instanceof Sa?Ss(r.innerType()):r instanceof fl?[r.value]:r instanceof pl?r.options:r instanceof ml?Mr.objectValues(r.enum):r instanceof dl?Ss(r._def.innerType):r instanceof ol?[void 0]:r instanceof sl?[null]:r instanceof qa?[void 0,...Ss(r.unwrap())]:r instanceof Go?[null,...Ss(r.unwrap())]:r instanceof np||r instanceof gl?Ss(r.unwrap()):r instanceof hl?Ss(r._def.innerType):[],Sd=class r extends pr{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==pt.object)return st(t,{code:We.invalid_type,expected:pt.object,received:t.parsedType}),Zt;let n=this.discriminator,i=t.data[n],a=this.optionsMap.get(i);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(st(t,{code:We.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,t,n){let i=new Map;for(let a of t){let o=Ss(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 u of o){if(i.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);i.set(u,a)}}return new r({typeName:Gt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...fr(n)})}};function Dx(r,e){let t=au(r),n=au(e);if(r===e)return{valid:!0,data:r};if(t===pt.object&&n===pt.object){let i=Mr.objectKeys(e),a=Mr.objectKeys(r).filter(u=>i.indexOf(u)!==-1),o={...r,...e};for(let u of a){let c=Dx(r[u],e[u]);if(!c.valid)return{valid:!1};o[u]=c.data}return{valid:!0,data:o}}else if(t===pt.array&&n===pt.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<r.length;a++){let o=r[a],u=e[a],c=Dx(o,u);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return t===pt.date&&n===pt.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ll=class extends pr{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Tx(a)||Tx(o))return Zt;let u=Dx(a.value,o.value);return u.valid?((Mx(a)||Mx(o))&&t.dirty(),{status:t.value,value:u.data}):(st(n,{code:We.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}))}};ll.create=(r,e,t)=>new ll({left:r,right:e,typeName:Gt.ZodIntersection,...fr(t)});var Ho=class r extends pr{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.array)return st(n,{code:We.invalid_type,expected:pt.array,received:n.parsedType}),Zt;if(n.data.length<this._def.items.length)return st(n,{code:We.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Zt;!this._def.rest&&n.data.length>this._def.items.length&&(st(n,{code:We.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((o,u)=>{let c=this._def.items[u]||this._def.rest;return c?c._parse(new za(n,o,n.path,u)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>yi.mergeArray(t,o)):yi.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Ho.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ho({items:r,typeName:Gt.ZodTuple,rest:null,...fr(e)})};var Ad=class r extends pr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.object)return st(n,{code:We.invalid_type,expected:pt.object,received:n.parsedType}),Zt;let i=[],a=this._def.keyType,o=this._def.valueType;for(let u in n.data)i.push({key:a._parse(new za(n,u,n.path,u)),value:o._parse(new za(n,n.data[u],n.path,u)),alwaysSet:u in n.data});return n.common.async?yi.mergeObjectAsync(t,i):yi.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof pr?new r({keyType:e,valueType:t,typeName:Gt.ZodRecord,...fr(n)}):new r({keyType:ou.create(),valueType:e,typeName:Gt.ZodRecord,...fr(t)})}},xc=class extends pr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.map)return st(n,{code:We.invalid_type,expected:pt.map,received:n.parsedType}),Zt;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([u,c],s)=>({key:i._parse(new za(n,u,n.path,[s,"key"])),value:a._parse(new za(n,c,n.path,[s,"value"]))}));if(n.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let c of o){let s=await c.key,l=await c.value;if(s.status==="aborted"||l.status==="aborted")return Zt;(s.status==="dirty"||l.status==="dirty")&&t.dirty(),u.set(s.value,l.value)}return{status:t.value,value:u}})}else{let u=new Map;for(let c of o){let s=c.key,l=c.value;if(s.status==="aborted"||l.status==="aborted")return Zt;(s.status==="dirty"||l.status==="dirty")&&t.dirty(),u.set(s.value,l.value)}return{status:t.value,value:u}}}};xc.create=(r,e,t)=>new xc({valueType:e,keyType:r,typeName:Gt.ZodMap,...fr(t)});var bc=class r extends pr{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pt.set)return st(n,{code:We.invalid_type,expected:pt.set,received:n.parsedType}),Zt;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(st(n,{code:We.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(st(n,{code:We.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let a=this._def.valueType;function o(c){let s=new Set;for(let l of c){if(l.status==="aborted")return Zt;l.status==="dirty"&&t.dirty(),s.add(l.value)}return{status:t.value,value:s}}let u=[...n.data.values()].map((c,s)=>a._parse(new za(n,c,n.path,s)));return n.common.async?Promise.all(u).then(c=>o(c)):o(u)}min(e,t){return new r({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};bc.create=(r,e)=>new bc({valueType:r,minSize:null,maxSize:null,typeName:Gt.ZodSet,...fr(e)});var Ed=class r extends pr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==pt.function)return st(t,{code:We.invalid_type,expected:pt.function,received:t.parsedType}),Zt;function n(u,c){return wd({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bd(),gc].filter(s=>!!s),issueData:{code:We.invalid_arguments,argumentsError:c}})}function i(u,c){return wd({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bd(),gc].filter(s=>!!s),issueData:{code:We.invalid_return_type,returnTypeError:c}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof uu){let u=this;return Li(async function(...c){let s=new _a([]),l=await u._def.args.parseAsync(c,a).catch(m=>{throw s.addIssue(n(c,m)),s}),f=await Reflect.apply(o,this,l);return await u._def.returns._def.type.parseAsync(f,a).catch(m=>{throw s.addIssue(i(f,m)),s})})}else{let u=this;return Li(function(...c){let s=u._def.args.safeParse(c,a);if(!s.success)throw new _a([n(c,s.error)]);let l=Reflect.apply(o,this,s.data),f=u._def.returns.safeParse(l,a);if(!f.success)throw new _a([i(l,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Ho.create(e).rest(As.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Ho.create([]).rest(As.create()),returns:t||As.create(),typeName:Gt.ZodFunction,...fr(n)})}},cl=class extends pr{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};cl.create=(r,e)=>new cl({getter:r,typeName:Gt.ZodLazy,...fr(e)});var fl=class extends pr{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return st(t,{received:t.data,code:We.invalid_literal,expected:this._def.value}),Zt}return{status:"valid",value:e.data}}get value(){return this._def.value}};fl.create=(r,e)=>new fl({value:r,typeName:Gt.ZodLiteral,...fr(e)});function GN(r,e){return new pl({values:r,typeName:Gt.ZodEnum,...fr(e)})}var pl=class r extends pr{constructor(){super(...arguments),Kf.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return st(t,{expected:Mr.joinValues(n),received:t.parsedType,code:We.invalid_type}),Zt}if(_d(this,Kf,"f")||UN(this,Kf,new Set(this._def.values),"f"),!_d(this,Kf,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return st(t,{received:t.data,code:We.invalid_enum_value,options:n}),Zt}return Li(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Kf=new WeakMap;pl.create=GN;var ml=class extends pr{constructor(){super(...arguments),ep.set(this,void 0)}_parse(e){let t=Mr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==pt.string&&n.parsedType!==pt.number){let i=Mr.objectValues(t);return st(n,{expected:Mr.joinValues(i),received:n.parsedType,code:We.invalid_type}),Zt}if(_d(this,ep,"f")||UN(this,ep,new Set(Mr.getValidEnumValues(this._def.values)),"f"),!_d(this,ep,"f").has(e.data)){let i=Mr.objectValues(t);return st(n,{received:n.data,code:We.invalid_enum_value,options:i}),Zt}return Li(e.data)}get enum(){return this._def.values}};ep=new WeakMap;ml.create=(r,e)=>new ml({values:r,typeName:Gt.ZodNativeEnum,...fr(e)});var uu=class extends pr{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==pt.promise&&t.common.async===!1)return st(t,{code:We.invalid_type,expected:pt.promise,received:t.parsedType}),Zt;let n=t.parsedType===pt.promise?t.data:Promise.resolve(t.data);return Li(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};uu.create=(r,e)=>new uu({type:r,typeName:Gt.ZodPromise,...fr(e)});var Sa=class extends pr{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:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{st(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async u=>{if(t.value==="aborted")return Zt;let c=await this._def.schema._parseAsync({data:u,path:n.path,parent:n});return c.status==="aborted"?Zt:c.status==="dirty"||t.value==="dirty"?hc(c.value):c});{if(t.value==="aborted")return Zt;let u=this._def.schema._parseSync({data:o,path:n.path,parent:n});return u.status==="aborted"?Zt:u.status==="dirty"||t.value==="dirty"?hc(u.value):u}}if(i.type==="refinement"){let o=u=>{let c=i.refinement(u,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(n.common.async===!1){let u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return u.status==="aborted"?Zt:(u.status==="dirty"&&t.dirty(),o(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>u.status==="aborted"?Zt:(u.status==="dirty"&&t.dirty(),o(u.value).then(()=>({status:t.value,value:u.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(!tp(o))return o;let u=i.transform(o.value,a);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>tp(o)?Promise.resolve(i.transform(o.value,a)).then(u=>({status:t.value,value:u})):o);Mr.assertNever(i)}};Sa.create=(r,e,t)=>new Sa({schema:r,typeName:Gt.ZodEffects,effect:e,...fr(t)});Sa.createWithPreprocess=(r,e,t)=>new Sa({schema:e,effect:{type:"preprocess",transform:r},typeName:Gt.ZodEffects,...fr(t)});var qa=class extends pr{_parse(e){return this._getType(e)===pt.undefined?Li(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qa.create=(r,e)=>new qa({innerType:r,typeName:Gt.ZodOptional,...fr(e)});var Go=class extends pr{_parse(e){return this._getType(e)===pt.null?Li(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Go.create=(r,e)=>new Go({innerType:r,typeName:Gt.ZodNullable,...fr(e)});var dl=class extends pr{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===pt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};dl.create=(r,e)=>new dl({innerType:r,typeName:Gt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...fr(e)});var hl=class extends pr{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rp(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new _a(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new _a(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};hl.create=(r,e)=>new hl({innerType:r,typeName:Gt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...fr(e)});var wc=class extends pr{_parse(e){if(this._getType(e)!==pt.nan){let n=this._getOrReturnCtx(e);return st(n,{code:We.invalid_type,expected:pt.nan,received:n.parsedType}),Zt}return{status:"valid",value:e.data}}};wc.create=r=>new wc({typeName:Gt.ZodNaN,...fr(r)});var nH=Symbol("zod_brand"),np=class extends pr{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ip=class r extends pr{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Zt:a.status==="dirty"?(t.dirty(),hc(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"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:Gt.ZodPipeline})}},gl=class extends pr{_parse(e){let t=this._def.innerType._parse(e),n=i=>(tp(i)&&(i.value=Object.freeze(i.value)),i);return rp(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};gl.create=(r,e)=>new gl({innerType:r,typeName:Gt.ZodReadonly,...fr(e)});function WN(r,e={},t){return r?su.create().superRefine((n,i)=>{var a,o;if(!r(n)){let u=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(o=(a=u.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0,s=typeof u=="string"?{message:u}:u;i.addIssue({code:"custom",...s,fatal:c})}}):su.create()}var iH={object:ea.lazycreate},Gt;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(Gt||(Gt={}));var aH=(r,e={message:`Input not instance of ${r.name}`})=>WN(t=>t instanceof r,e),YN=ou.create,jN=rl.create,oH=wc.create,sH=nl.create,ZN=il.create,uH=al.create,lH=vc.create,cH=ol.create,fH=sl.create,pH=su.create,mH=As.create,dH=Ao.create,hH=yc.create,gH=Es.create,vH=ea.create,yH=ea.strictCreate,xH=ul.create,bH=Sd.create,wH=ll.create,_H=Ho.create,SH=Ad.create,AH=xc.create,EH=bc.create,TH=Ed.create,MH=cl.create,DH=fl.create,CH=pl.create,NH=ml.create,FH=uu.create,LN=Sa.create,IH=qa.create,PH=Go.create,BH=Sa.createWithPreprocess,kH=ip.create,$H=()=>YN().optional(),OH=()=>jN().optional(),RH=()=>ZN().optional(),LH={string:r=>ou.create({...r,coerce:!0}),number:r=>rl.create({...r,coerce:!0}),boolean:r=>il.create({...r,coerce:!0}),bigint:r=>nl.create({...r,coerce:!0}),date:r=>al.create({...r,coerce:!0})},VH=Zt,he=Object.freeze({__proto__:null,defaultErrorMap:gc,setErrorMap:Vz,getErrorMap:bd,makeIssue:wd,EMPTY_PATH:Uz,addIssueToContext:st,ParseStatus:yi,INVALID:Zt,DIRTY:hc,OK:Li,isAborted:Tx,isDirty:Mx,isValid:tp,isAsync:rp,get util(){return Mr},get objectUtil(){return Ex},ZodParsedType:pt,getParsedType:au,ZodType:pr,datetimeRegex:HN,ZodString:ou,ZodNumber:rl,ZodBigInt:nl,ZodBoolean:il,ZodDate:al,ZodSymbol:vc,ZodUndefined:ol,ZodNull:sl,ZodAny:su,ZodUnknown:As,ZodNever:Ao,ZodVoid:yc,ZodArray:Es,ZodObject:ea,ZodUnion:ul,ZodDiscriminatedUnion:Sd,ZodIntersection:ll,ZodTuple:Ho,ZodRecord:Ad,ZodMap:xc,ZodSet:bc,ZodFunction:Ed,ZodLazy:cl,ZodLiteral:fl,ZodEnum:pl,ZodNativeEnum:ml,ZodPromise:uu,ZodEffects:Sa,ZodTransformer:Sa,ZodOptional:qa,ZodNullable:Go,ZodDefault:dl,ZodCatch:hl,ZodNaN:wc,BRAND:nH,ZodBranded:np,ZodPipeline:ip,ZodReadonly:gl,custom:WN,Schema:pr,ZodSchema:pr,late:iH,get ZodFirstPartyTypeKind(){return Gt},coerce:LH,any:pH,array:gH,bigint:sH,boolean:ZN,date:uH,discriminatedUnion:bH,effect:LN,enum:CH,function:TH,instanceof:aH,intersection:wH,lazy:MH,literal:DH,map:AH,nan:oH,nativeEnum:NH,never:dH,null:fH,nullable:PH,number:jN,object:vH,oboolean:RH,onumber:OH,optional:IH,ostring:$H,pipeline:kH,preprocess:BH,promise:FH,record:SH,set:EH,strictObject:yH,string:YN,symbol:lH,transformer:LN,tuple:_H,undefined:cH,union:xH,unknown:mH,void:hH,NEVER:VH,ZodIssueCode:We,quotelessJson:Lz,ZodError:_a});function QN(r,e){return(t,n)=>t[r]===void 0==(t[e]===void 0)?(n.addIssue({code:he.ZodIssueCode.custom,message:`Either ${r} or ${e} must be used, but not both.`}),!1):!0}function Ot(){return function(r){return r}}function un(r,e){let t=r.safeParse(e);if(!t.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:t.error})}function KN(r,e){return r.safeParse(e,{errorMap:zH})}var JN=["zeroth","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],XN=["twent","thirt","fort","fift","sixt","sevent","eight","ninet"];function qH(r){return r<20?JN[r]:r%10===0?XN[Math.floor(r/10)-2]+"ieth":XN[Math.floor(r/10)-2]+"y-"+JN[r%10]}var zH=(r,e)=>({message:`At '${r.path.map(n=>typeof n=="string"?n:qH(n+1)+" element").join(" > ")}'. ${e.defaultError}`});function Td(r,e,t){return he.number({required_error:`The ${r} action requires a specified ${t} with the '${e}' field.`,invalid_type_error:`The ${r} action requires the value of the '${e}' fields to be a number.`})}function oi(r,e,t){return he.string({required_error:`The ${r} action requires a specified ${t} with the '${e}' field.`,invalid_type_error:`The ${r} action requires the value of the '${e}' fields to be a string.`})}function Ts(r,e,t){return he.boolean({required_error:`The ${r} action requires a specified ${t} with the '${e}' field.`,invalid_type_error:`The ${r} action requires the value of the '${e}' fields to be a boolean.`})}var HH=Ot()(he.object({type:he.literal("command"),command:oi("command","command","command to run")})),GH=Ot()(he.object({type:he.literal("js"),file:oi("js","file","file path to the file to run"),args:he.record(he.unknown()).optional()})),WH=Ot()(he.object({type:he.literal("open"),link:oi("open","link","link to open"),newTab:Ts("open","newTab","").optional()})),YH=Ot()(he.object({type:he.literal("input"),str:oi("input","str","value to input")})),jH=Ot()(he.object({type:he.literal("sleep"),ms:Td("sleep","ms","duration")})),ZH=Ot()(he.object({type:he.literal("templaterCreateNote"),templateFile:oi("templaterCreateNote","templateFile","template file path"),folderPath:oi("templaterCreateNote","folderPath","folder path").optional(),fileName:oi("templaterCreateNote","fileName","file name").optional(),openNote:Ts("templaterCreateNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:Ts("templaterCreateNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),JH=Ot()(he.object({type:he.literal("updateMetadata"),bindTarget:oi("updateMetadata","bindTarget","bind target to the metadata to update"),evaluate:Ts("updateMetadata","evaluate","value for whether to evaluate the value as a JavaScript expression"),value:he.coerce.string({required_error:"The updateMetadata action requires a specified value for the update with the 'value' field.",invalid_type_error:"The updateMetadata action requires the value of the 'value' fields to be a string."})})),XH=Ot()(he.object({type:he.literal("createNote"),folderPath:oi("createNote","folderPath","folder path").optional(),fileName:oi("createNote","fileName","file name"),openNote:Ts("createNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:Ts("createNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),QH=Ot()(he.object({type:he.literal("replaceInNote"),fromLine:Td("replaceInNote","fromLine","line to replace from"),toLine:Td("replaceInNote","toLine","line to replace to"),replacement:oi("replaceInNote","replacement","replacement string"),templater:Ts("replaceInNote","templater","value for whether to use Templater").optional()})),KH=Ot()(he.object({type:he.literal("replaceSelf"),replacement:oi("replaceSelf","replacement","replacement string"),templater:Ts("replaceSelf","templater","value for whether to use Templater").optional()})),eG=Ot()(he.object({type:he.literal("regexpReplaceInNote"),regexp:oi("regexpReplaceInNote","regexp","search regular expression"),regexpFlags:oi("regexpReplaceInNote","regexpFlags","regular expression flags string").optional(),replacement:oi("regexpReplaceInNote","replacement","replacement string")})),tG=Ot()(he.object({type:he.literal("insertIntoNote"),line:Td("insertIntoNote","line","line to insert at"),value:oi("insertIntoNote","value","string to insert"),templater:Ts("insertIntoNote","templater","value for whether to use Templater").optional()})),rG=Ot()(he.object({type:he.literal("inlineJS"),code:oi("inlineJS","code","code string to run")})),eF=Ot()(he.discriminatedUnion("type",[HH,GH,WH,YH,jH,ZH,JH,XH,QH,KH,eG,tG,rG])),nG=he.nativeEnum(yn),_c=Ot()(he.object({label:he.string(),icon:he.string().optional(),style:nG,class:he.string().optional(),tooltip:he.string().optional(),id:he.string().optional(),hidden:he.boolean().optional(),action:eF.optional(),actions:eF.array().optional()}).superRefine(QN("action","actions")));var xi=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)throw new Error("Mountable is already mounted");this.mounted=!0,this.targetEl=e,this.onMount(e)}unmount(){if(!this.mounted||!this.targetEl)throw new Error("Mountable is not mounted");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 $n=class extends xi{constructor(e,t,n){super(),this.plugin=e,this.filePath=n,this.uuid=t}getUuid(){return this.uuid}getFilePath(){return this.filePath}onMount(e){this.plugin.mountableManager.registerMountable(this)}onUnmount(e){this.plugin.mountableManager.unregisterMountable(this)}};var Sc=class{constructor(e){this.scope=e}};var lu=class r{constructor(e){this.path=e}get(e){if(this.path.length===0)throw new Error("can not use empty path to access object");let t=this.path[0].get(e);for(let n of this.path.slice(1))t=n.get(t.child);return t}tryGet(e){try{return this.get(e)}catch{return}}set(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let n=this.path[0].get(e);for(let i of this.path.slice(1))n=i.get(n.child);n.access.set(n.parent,t)}setAndCreate(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let n=this.path[0].get(e);n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(0,t)),n=n.access.get(n.parent));for(let i=1;i<this.path.length;i++)n=this.path[i].get(n.child),n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(i,t)),n=n.access.get(n.parent));n.access.set(n.parent,t)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,t){let n=this.getNextPathElement(e);return n===void 0?t:n.type==="object"?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new r(this.path.concat(e.path))}compareDiffArray(e){let t=Math.min(this.path.length,e.length);for(let n=0;n<t;n++){let i=this.path[n],a=e[n];if(i.prop!==a.toString())return!1}return!0}};var Ac=class{constructor(){this.listeners=[]}registerListener(e){let t=e;return t.uuid=qr(),this.listeners.push(t),t}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(t=>t.uuid!==e)}unregisterAllListeners(){this.listeners=[]}notifyListeners(e){for(let t of this.listeners)try{t.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}))}}},Zr=class extends Ac{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},Md=class extends Ac{constructor(e,t){super(),this.dependency=e,this.value=t(e.get()),this.dependencyListener=e.registerListener({callback:n=>this.set(t(n))})}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}destroy(){this.dependency.unregisterListener(this.dependencyListener)}};var Ea=Ot()(he.string()),Ec=Ot()(he.nativeEnum($i)),ap=Ot()(he.nativeEnum(tc)),rF=Ot()(he.nativeEnum(tu)),nF=Ot()(he.instanceof(HTMLElement)),Tc=Ot()(he.instanceof(Sc)),jue=Ot()(he.instanceof(Zr)),Zue=Ot()(he.function().args().returns(he.void())),Jue=Ot()(he.instanceof($n)),iF=Ot()(he.instanceof(xi)),aF=Ot()(he.instanceof(eu)),tF=Ot()(he.object({index:he.number(),line:he.number(),column:he.number()})),iG=Ot()(he.object({from:tF,to:tF})),cu=Ot()(he.object({value:he.string(),position:iG.optional()})),oF=Ot()(he.object({name:cu,value:cu.array()})),aG=Ot()(he.object({type:he.nativeEnum(tl),prop:cu})),Cx=Ot()(he.object({storageType:cu.optional(),storagePath:cu.optional(),storageProp:aG.array(),listenToChildren:he.boolean()})),Xue=Ot()(he.object({declarationString:he.string().optional(),inputFieldType:cu.optional(),templateName:cu.optional(),bindTarget:Cx.optional(),arguments:oF.array(),errorCollection:he.instanceof(Xt)})),Que=Ot()(he.object({declarationString:he.string().optional(),templateDeclaration:he.array(he.union([he.string(),Cx])).optional(),viewFieldType:cu.optional(),arguments:oF.array(),writeToBindTarget:Cx.optional(),errorCollection:he.instanceof(Xt)})),Aa=Ot()(he.object({storageType:he.string(),storagePath:he.string(),storageProp:he.instanceof(lu),listenToChildren:he.boolean()})),sF=Ot()(he.object({name:he.string(),value:he.string().array()})),Kue=Ot()(he.object({type:he.nativeEnum(tl),prop:he.string()})),uF=Ot()(he.object({inputFieldType:rF.optional(),templateName:he.string().optional(),bindTarget:Aa.optional(),arguments:sF.array().optional()})),lF=Ot()(he.object({viewFieldType:rF.optional(),templateDeclaration:he.union([he.string(),Aa]).array().optional(),arguments:sF.array().optional(),writeToBindTarget:Aa.optional()})),oG=Ot()(he.object({bindTarget:Aa,name:he.string()})),sG=Ot()(he.object({bindTargetMappings:oG.array(),writeToBindTarget:Aa.optional(),code:he.string()})),uG=Ot()(he.object({referencedButtonIds:he.string().array()})),cF=Ot()(he.object({renderChildType:Ec,declaration:he.union([he.string(),uF]),scope:Tc.optional()})),fF=Ot()(he.object({renderChildType:Ec,declaration:he.union([he.string(),lF]),scope:Tc.optional()})),pF=Ot()(he.object({declaration:he.union([he.string(),sG])})),mF=Ot()(he.object({bindTarget:Aa,tableHead:he.string().array(),columns:he.array(he.union([uF,lF,he.string()]))})),dF=Ot()(he.object({renderChildType:Ec,declaration:he.union([he.string(),uG]),position:aF.optional()})),hF=Ot()(he.object({declaration:he.union([he.string(),_c]),position:aF.optional(),isPreview:he.boolean()})),gF=Ot()(he.object({depth:he.number(),content:he.string()}));var vF=Or(va()),Vi=Or(Xi());var lG=Vi.P.sequence(cc,Vi.P.string("#").then(Vi.P.manyNotOf("[]#|^:")).optional(),Vi.P.string("|").then(Vi.P.manyNotOf("[]")).optional()),Nx=Vi.P.or(Vi.P.sequenceMap((r,e)=>new op(r!==void 0,e[0],e[1],e[2],!0),Vi.P.string("!").optional(),lG.wrapString("[[","]]")),Vi.P.sequenceMap((r,e,t)=>{let n=!ic(t);return new op(r!==void 0,t,void 0,e,n)},Vi.P.string("!").optional(),Vi.P.manyNotOf("[]").wrapString("[","]"),Vi.P.manyNotOf("()").wrapString("(",")"))),cG=Vi.P.separateBy(Nx,Vi.P.string(",").trim(vF.P_UTILS.optionalWhitespace())),op=class r{constructor(e,t,n,i,a){this.isEmbed=e,this.target=t,this.block=n,this.alias=i,this.internal=a??!0}static fromUrl(e){return new r(!1,e.href,void 0,e.hostname,!1)}fullTarget(){return this.block?`${this.target}#${this.block}`:this.target}open(e,t,n){this.internal?e.internal.file.open(this.fullTarget(),t,n):Gm(this.target)}},xn=class r{static parseLink(e){return Gn(Nx.thenEof(),e)}static parseLinkList(e){return Gn(cG.thenEof(),e)}static isLink(e){return Nx.thenEof().tryParse(e).success}static urlToLink(e){return op.fromUrl(e)}static parseLinkOrUrl(e){return ic(e)?r.urlToLink(new URL(e)):r.parseLink(e)}static toLinkString(e){return r.isLink(e)?e:ic(e)?`[${new URL(e).hostname}](${e})`:r.isLink(`[[${e}]]`)?`[[${e}]]`:""}};var sp=Or(va()),fu=Or(Xi());var xF=fu.P.sequenceMap((r,e)=>r===void 0?e:-e,fu.P.string("-").optional(),fu.P.or(fu.P.sequenceMap((r,e,t)=>Number(r+e+t),sp.P_UTILS.digits(),fu.P.string("."),sp.P_UTILS.digits()),sp.P_UTILS.digits().map(r=>Number(r)))).thenEof(),bF=fu.P.sequenceMap((r,e)=>r===void 0?e:-e,fu.P.string("-").optional(),sp.P_UTILS.digits().map(r=>Number(r))).thenEof();function Ta(r){if(r.toLowerCase()==="null")return null;if(r==="true")return!0;if(r==="false")return!1;{let e=xF.tryParse(r);return e.success?e.value:r}}function Eo(r){return r===void 0||r===null?"":typeof r=="string"?r:typeof r=="boolean"?r?"true":"false":r.toString()}function pu(r){return r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"}function Ha(r){if(r!=null){if(pu(r))return[r];if(typeof r=="object"&&Array.isArray(r))return r.filter(e=>pu(e))}}function Mc(r){if(typeof r=="number")return r;if(typeof r=="string"){let e=xF.tryParse(r);if(e.success)return e.value}}function Wo(r){return pu(r)?Eo(r):void 0}function mu(r){return pu(r)?r:void 0}function Dd(r,e){return Array.isArray(r)?r.map(t=>Fx(t,e)).filter(t=>t!=="").join(", "):Fx(r,e)}function Fx(r,e){return r==null?e?"":"null":typeof r=="function"?"<function>":typeof r=="object"||Array.isArray(r)?JSON.stringify(r):r.toString()}function wF(r,e){return Array.isArray(r)?r.map(t=>yF(t,e)).filter(t=>t!==""):yF(r,e)}function yF(r,e){return typeof r=="string"?xn.isLink(r)?xn.parseLink(r):ic(r)?xn.urlToLink(new URL(r)):r:Fx(r,e)}var Cd=class{constructor(e){this.plugin=e}resolveFilePath(e,t){let n=xn.isLink(e)?xn.parseLink(e).target:e,i=this.plugin.internal.file.getPathByName(n,t);if(i===void 0)throw new xo({errorLevel:"ERROR",cause:'Could not find a file that matches "${filePath}".',effect:`Could not resolve path or link "${e}" relative to "${t}".`});return i}createDefaultButtonConfig(){return{label:"This is a button",icon:"",hidden:!1,class:"",tooltip:"",id:"",style:"default",actions:[]}}async runButtonActions(e,t,n){try{if(e.action)await this.plugin.api.buttonActionRunner.runAction(e,e.action,t,n);else if(e.actions)for(let i of e.actions)await this.plugin.api.buttonActionRunner.runAction(e,i,t,n);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(i){console.warn("meta-bind | ButtonMDRC >> error while running action",i),this.plugin.internal.showNotice("meta-bind | Error while running button action. Check the console for details.")}}createDefaultAction(e){if(e==="command")return{type:"command",command:""};if(e==="open")return{type:"open",link:"",newTab:!0};if(e==="js")return{type:"js",file:"",args:{}};if(e==="input")return{type:"input",str:""};if(e==="sleep")return{type:"sleep",ms:0};if(e==="templaterCreateNote")return{type:"templaterCreateNote",templateFile:"",folderPath:"/",fileName:"",openNote:!0,openIfAlreadyExists:!1};if(e==="updateMetadata")return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""};if(e==="createNote")return{type:"createNote",folderPath:"/",fileName:"Untitled",openNote:!0,openIfAlreadyExists:!1};if(e==="replaceInNote")return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text",templater:!1};if(e==="replaceSelf")return{type:"replaceSelf",replacement:"Replacement text",templater:!1};if(e==="regexpReplaceInNote")return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text",regexpFlags:"g"};if(e==="insertIntoNote")return{type:"insertIntoNote",line:0,value:"Some text",templater:!1};if(e==="inlineJS")return{type:"inlineJS",code:'console.log("Hello world")'};throw new Error(`Unknown button action type: ${e}`)}async runAction(e,t,n,i){if(t.type==="command"){await this.runCommandAction(t);return}else if(t.type==="js"){await this.runJSAction(e,t,n,i);return}else if(t.type==="open"){await this.runOpenAction(t,n);return}else if(t.type==="input"){await this.runInputAction(t);return}else if(t.type==="sleep"){await this.runSleepAction(t);return}else if(t.type==="templaterCreateNote"){await this.runTemplaterCreateNoteAction(t);return}else if(t.type==="updateMetadata"){await this.runUpdateMetadataAction(t,n);return}else if(t.type==="createNote"){await this.runCreateNoteAction(t);return}else if(t.type==="replaceInNote"){await this.runReplaceInNoteAction(t,n);return}else if(t.type==="replaceSelf"){await this.runReplaceSelfAction(t,n,i);return}else if(t.type==="regexpReplaceInNote"){await this.runRegexpReplaceInNoteAction(t,n);return}else if(t.type==="insertIntoNote"){await this.runInsertIntoNoteAction(t,n);return}else if(t.type==="inlineJS"){await this.runInlineJsAction(e,t,n,i);return}throw new Error("Unknown button action type")}async runCommandAction(e){this.plugin.internal.executeCommandById(e.command)}async runJSAction(e,t,n,i){if(!this.plugin.settings.enableJs)throw new gs({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let a={buttonConfig:structuredClone(e),args:structuredClone(t.args),buttonContext:structuredClone(i)};(await this.plugin.internal.jsEngineRunFile(t.file,n,a))()}async runOpenAction(e,t){xn.parseLinkOrUrl(e.link).open(this.plugin,t,e.newTab??!1)}async runInputAction(e){let t=document.activeElement;t&&t instanceof HTMLInputElement&&(t.setRangeText(e.str,t.selectionStart,t.selectionEnd,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})))}async runSleepAction(e){await new Promise(t=>setTimeout(t,e.ms))}async runTemplaterCreateNoteAction(e){if(e.openIfAlreadyExists&&e.fileName){let t=Yy(Wy(e.folderPath??"",e.fileName),"md");if(await this.plugin.internal.file.exists(t)){this.plugin.internal.file.open(t,"",!1);return}}await this.plugin.internal.createNoteWithTemplater(e.templateFile,e.folderPath,e.fileName,e.openNote)}async runUpdateMetadataAction(e,t){let n=this.plugin.api.bindTargetParser.fromStringAndValidate(e.bindTarget,t);if(e.evaluate){if(!this.plugin.settings.enableJs)throw new gs({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let i=new Function("x","getMetadata",`return ${e.value};`);this.plugin.api.updateMetadata(n,a=>i(a,o=>this.plugin.api.getMetadata(this.plugin.api.parseBindTarget(o,t))))}else this.plugin.api.setMetadata(n,Ta(e.value))}async runCreateNoteAction(e){if(e.openIfAlreadyExists){let t=Yy(Wy(e.folderPath??"",e.fileName),"md");if(await this.plugin.internal.file.exists(t)){this.plugin.internal.file.open(t,"",!1);return}}await this.plugin.internal.file.create(e.folderPath??"",e.fileName,"md",e.openNote??!1)}async runReplaceInNoteAction(e,t){if(e.fromLine>e.toLine)throw new Error("From line cannot be greater than to line");let n=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.replacement),t):e.replacement;await this.plugin.internal.file.atomicModify(t,i=>{let a=i.split(`
`);if(e.fromLine<0||e.toLine>a.length+1)throw new Error("Line numbers out of bounds");return a=[...a.slice(0,e.fromLine-1),n,...a.slice(e.toLine)],a.join(`
`)})}async runReplaceSelfAction(e,t,n){if(n.isInline)throw new Error("Replace self action not supported for inline buttons");if(n.position===void 0)throw new Error("Position of the button in the note is unknown");if(n.position.lineStart>n.position.lineEnd)throw new Error("Position of the button in the note is invalid");let i=n.position,a=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.replacement),t):e.replacement;await this.plugin.internal.file.atomicModify(t,o=>{let u=o.split(`
`);if(i.lineStart<0||i.lineEnd>u.length+1)throw new Error("Position of the button in the note is out of bounds");return u=[...u.slice(0,i.lineStart),a,...u.slice(i.lineEnd+1)],u.join(`
`)})}async runRegexpReplaceInNoteAction(e,t){if(e.regexp==="")throw new Error("Regexp cannot be empty");await this.plugin.internal.file.atomicModify(t,n=>n.replace(new RegExp(e.regexp,e.regexpFlags??"g"),e.replacement))}async runInsertIntoNoteAction(e,t){let n=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.value),t):e.value;await this.plugin.internal.file.atomicModify(t,i=>{let a=i.split(`
`);if(e.line<1||e.line>a.length+1)throw new Error("Line number out of bounds");return a=[...a.slice(0,e.line-1),n,...a.slice(e.line-1)],a.join(`
`)})}async runInlineJsAction(e,t,n,i){if(!this.plugin.settings.enableJs)throw new gs({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let a={buttonConfig:structuredClone(e),buttonContext:structuredClone(i)};(await this.plugin.internal.jsEngineRunCode(t.code,n,a))()}};var _F="5";typeof window<"u"&&(window.__svelte||={v:new Set}).v.add(_F);var Dc="[",vl="[!",yl="]",du={};var bi=Symbol(),Ui=Symbol("filename"),SF=Symbol("hmr");var lp="font-weight: bold",cp="font-weight: normal";function AF(r,e,t){console.warn("hydration_attribute_changed")}function Cc(r){console.warn("hydration_mismatch")}function EF(){console.warn("lifecycle_double_unmount")}function Ix(r,e){console.warn("ownership_invalid_mutation")}function Nd(r){console.warn("state_proxy_equality_mismatch")}var Ga=Array.isArray,fp=Array.from,Px=Object.keys,Wa=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,Bx=Object.getOwnPropertyDescriptors,Fd=Object.prototype,TF=Array.prototype,Ms=Object.getPrototypeOf;var ja=()=>{};function Id(r){for(var e=0;e<r.length;e++)r[e]()}var Yo=Symbol("$state"),xl=Symbol("$state metadata"),MF=Symbol("");function Pd(r){return r===this.v}function kx(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function Nc(r){return!kx(r,this.v)}function $x(){if(!1){let r=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead");throw r.name="Svelte error",r}else throw new Error("bind_invalid_checkbox_value")}function DF(){if(!1){let r=new Error(`derived_references_self
A derived value cannot reference itself recursively`);throw r.name="Svelte error",r}else throw new Error("derived_references_self")}function CF(r){if(!1){let e=new Error(`effect_in_teardown
\`${r}\` cannot be used inside an effect cleanup function`);throw e.name="Svelte error",e}else throw new Error("effect_in_teardown")}function NF(){if(!1){let r=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect");throw r.name="Svelte error",r}else throw new Error("effect_in_unowned_derived")}function FF(r){if(!1){let e=new Error(`effect_orphan
\`${r}\` can only be used inside an effect (e.g. during component initialisation)`);throw e.name="Svelte error",e}else throw new Error("effect_orphan")}function Ox(){if(!1){let r=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`);throw r.name="Svelte error",r}else throw new Error("effect_update_depth_exceeded")}function IF(){if(!1){let r=new Error(`hydration_failed
Failed to hydrate the application`);throw r.name="Svelte error",r}else throw new Error("hydration_failed")}function PF(){if(!1){let r=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`");throw r.name="Svelte error",r}else throw new Error("invalid_snippet")}function BF(r){if(!1){let e=new Error(`props_invalid_value
Cannot do \`bind:${r}={undefined}\` when \`${r}\` has a fallback value`);throw e.name="Svelte error",e}else throw new Error("props_invalid_value")}function kF(r){if(!1){let e=new Error(`props_rest_readonly
Rest element properties of \`$props()\` such as \`${r}\` are readonly`);throw e.name="Svelte error",e}else throw new Error("props_rest_readonly")}function $F(r){if(!1){let e=new Error(`rune_outside_svelte
The \`${r}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files`);throw e.name="Svelte error",e}else throw new Error("rune_outside_svelte")}function OF(){if(!1){let r=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.");throw r.name="Svelte error",r}else throw new Error("state_descriptors_fixed")}function RF(){if(!1){let r=new Error("state_prototype_fixed\nCannot set prototype of `$state` object");throw r.name="Svelte error",r}else throw new Error("state_prototype_fixed")}function LF(){if(!1){let r=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");throw r.name="Svelte error",r}else throw new Error("state_unsafe_local_read")}function VF(){if(!1){let r=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`");throw r.name="Svelte error",r}else throw new Error("state_unsafe_mutation")}var bl=new Set;function Lx(r){bl=r}function On(r){return{f:0,v:r,reactions:null,equals:Pd,version:0}}function ht(r){return fG(On(r))}function hu(r,e=!1){let t=On(r);return e||(t.equals=Nc),vr!==null&&vr.l!==null&&(vr.l.s??=[]).push(t),t}function fG(r){return Dr!==null&&Dr.f&2&&(Mo===null?qF([r]):Mo.push(r)),r}function Oe(r,e){return Dr!==null&&wl()&&Dr.f&18&&(Mo===null||!Mo.includes(r))&&VF(),pp(r,e)}function pp(r,e){if(!r.equals(e)&&(r.v=e,r.version=Bd(),UF(r,1024),wl()&&Jt!==null&&Jt.f&512&&!(Jt.f&32)&&(si!==null&&si.includes(r)?(qi(Jt,1024),Pc(Jt)):Ds===null?zF([r]):Ds.push(r)),!1)){let n=Array.from(bl);var t=Cs;Fc(!0);try{for(let i of n)i.f&512&&qi(i,2048),gu(i)&&_l(i)}finally{Fc(t)}bl.clear()}return e}function UF(r,e){var t=r.reactions;if(t!==null)for(var n=wl(),i=t.length,a=0;a<i;a++){var o=t[a],u=o.f;if(!(u&1024)&&!(!n&&o===Jt)){if(!1){bl.add(o);continue}qi(o,e),u&640&&(u&2?UF(o,2048):Pc(o))}}}function Qt(r){var e=1026;Jt===null?e|=128:Jt.f|=524288;let t={children:null,ctx:vr,deps:null,equals:Pd,f:e,fn:r,reactions:null,v:null,version:0,parent:Jt};if(Dr!==null&&Dr.f&2){var n=Dr;(n.children??=[]).push(t)}return t}function zx(r){let e=Qt(r);return e.equals=Nc,e}function Ux(r){var e=r.children;if(e!==null){r.children=null;for(var t=0;t<e.length;t+=1){var n=e[t];n.f&2?mp(n):ra(n)}}}var Vx=[];function Hx(r){var e,t=Jt;if(wi(r.parent),!1){let n=bl;Lx(new Set);try{Vx.includes(r)&&DF(),Vx.push(r),Ux(r),e=kd(r)}finally{wi(t),Lx(n),Vx.pop()}}else try{Ux(r),e=kd(r)}finally{wi(t)}return e}function Gx(r){var e=Hx(r),t=(vu||r.f&128)&&r.deps!==null?2048:512;qi(r,t),r.equals(e)||(r.v=e,r.version=Bd())}function mp(r){Ux(r),Sl(r,0),qi(r,8192),r.v=r.children=r.deps=r.ctx=r.reactions=null}function WF(r){Jt===null&&Dr===null&&FF(r),Dr!==null&&Dr.f&128&&NF(),Od&&CF(r)}function pG(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function kc(r,e,t,n=!0){var i=(r&64)!==0,a=Jt;if(!1)for(;a!==null&&a.f&131072;)a=a.parent;var o={ctx:vr,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:r|1024,first:null,fn:e,last:null,next:null,parent:i?null:a,prev:null,teardown:null,transitions:null,version:0};if(!1,t){var u=Cs;try{Fc(!0),_l(o),o.f|=16384}catch(l){throw ra(o),l}finally{Fc(u)}}else e!==null&&Pc(o);var c=t&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&524288)===0;if(!c&&!i&&n&&(a!==null&&pG(o,a),Dr!==null&&Dr.f&2)){var s=Dr;(s.children??=[]).push(o)}return o}function Ka(r){let e=kc(8,null,!1);return qi(e,512),e.teardown=r,e}function eo(r){WF("$effect");var e=Jt!==null&&(Jt.f&32)!==0&&vr!==null&&!vr.m;if(!1,e){var t=vr;(t.e??=[]).push({fn:r,effect:Jt,reaction:Dr})}else{var n=na(r);return n}}function dp(r){let e=kc(64,r,!0);return()=>{ra(e)}}function na(r){return kc(4,r,!1)}function ia(r){return kc(8,r,!0)}function Ve(r){return!1,aa(r)}function aa(r,e=0){return kc(24|e,r,!0)}function _i(r,e=!0){return kc(40,r,!0,e)}function jx(r){var e=r.teardown;if(e!==null){let t=Od,n=Dr;Wx(!0),Qa(null);try{e.call(null)}finally{Wx(t),Qa(n)}}}function Zx(r){var e=r.deriveds;if(e!==null){r.deriveds=null;for(var t=0;t<e.length;t+=1)mp(e[t])}}function Jx(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){var n=t.next;ra(t,e),t=n}}function YF(r){for(var e=r.first;e!==null;){var t=e.next;e.f&32||ra(e),e=t}}function ra(r,e=!0){var t=!1;if((e||r.f&262144)&&r.nodes_start!==null){for(var n=r.nodes_start,i=r.nodes_end;n!==null;){var a=n===i?null:Si(n);n.remove(),n=a}t=!0}Zx(r),Jx(r,e&&!t),Sl(r,0),qi(r,8192);var o=r.transitions;if(o!==null)for(let c of o)c.stop();jx(r);var u=r.parent;u!==null&&u.first!==null&&Xx(r),!1,r.next=r.prev=r.teardown=r.ctx=r.deps=r.parent=r.fn=r.nodes_start=r.nodes_end=null}function Xx(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function Fs(r,e){var t=[];$d(r,t,!0),Qx(t,()=>{ra(r),e&&e()})}function Qx(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var i of r)i.out(n)}else e()}function $d(r,e,t){if(!(r.f&4096)){if(r.f^=4096,r.transitions!==null)for(let o of r.transitions)(o.is_global||t)&&e.push(o);for(var n=r.first;n!==null;){var i=n.next,a=(n.f&32768)!==0||(n.f&32)!==0;$d(n,e,a?t:!1),n=i}}}function yu(r){jF(r,!0)}function jF(r,e){if(r.f&4096){r.f^=4096,gu(r)&&_l(r);for(var t=r.first;t!==null;){var n=t.next,i=(t.f&32768)!==0||(t.f&32)!==0;jF(t,i?e:!1),t=n}if(r.transitions!==null)for(let a of r.transitions)(a.is_global||e)&&a.in()}}var mG=typeof requestIdleCallback>"u"?r=>setTimeout(r,1):requestIdleCallback,Rd=!1,Ld=!1,Kx=[],eb=[];function ZF(){Rd=!1;let r=Kx.slice();Kx=[],Id(r)}function JF(){Ld=!1;let r=eb.slice();eb=[],Id(r)}function ro(r){Rd||(Rd=!0,queueMicrotask(ZF)),Kx.push(r)}function XF(r){Ld||(Ld=!0,mG(JF)),eb.push(r)}function QF(){Rd&&ZF(),Ld&&JF()}var dG={},hG=/at (?:.+ \()?(.+):(\d+):(\d+)\)?$/,gG=/@(.+):(\d+):(\d+)$/;function vG(){let r=new Error().stack;if(!r)return null;let e=[];for(let t of r.split(`
`)){let n=hG.exec(t)??gG.exec(t);n&&e.push({file:n[1],line:+n[2],column:+n[3]})}return e}function KF(){let r=vG()?.slice(4);if(!r)return null;for(let e=0;e<r.length;e++){let t=r[e],n=dG[t.file];if(!n){if(e===0)return null;continue}for(let i of n)if(i.start.line<t.line&&i.end.line>t.line)return i.component}return null}var yG=Symbol("ADD_OWNER");function tb(r,e){if(e.owners!==null)for(;r;){if(r.owners===null){e.owners=null;break}for(let t of r.owners)e.owners.add(t);r=r.parent}}function eI(r,e){return r.owners===null?!0:r.owners.has(e)||r.parent!==null&&eI(r.parent,e)}function tI(r){return r?.owners?.values().next().value??tI(r.parent)}var xG=!1;function rI(r){if(xG)return;let e=KF();if(e&&!eI(r,e)){let t=tI(r);t[Ui]!==e[Ui]?Ix(e[Ui],t[Ui]):Ix()}}function hp(r){if(!1){let e=new Error(`lifecycle_outside_component
\`${r}(...)\` can only be used during component initialisation`);throw e.name="Svelte error",e}else throw new Error("lifecycle_outside_component")}var aI=0,SG=1,nI=new WeakSet,Ud=aI,gp=!1,Cs=!1,Od=!1;function Fc(r){Cs=r}function Wx(r){Od=r}var El=[],$c=0,vp=[],Dr=null;function Qa(r){Dr=r}var Jt=null;function wi(r){Jt=r}var Mo=null;function qF(r){Mo=r}var si=null,Ma=0,Ds=null;function zF(r){Ds=r}var oI=0,vu=!1,rb=!1,AG=new Set,vr=null;var to=null;function Bd(){return++oI}function wl(){return vr!==null&&vr.l===null}function gu(r){var e=r.f;if(e&1024)return!0;if(e&2048){var t=r.deps,n=(e&128)!==0;if(t!==null){var i;if(e&256){for(i=0;i<t.length;i++)(t[i].reactions??=[]).push(r);r.f^=256}for(i=0;i<t.length;i++){var a=t[i];if(gu(a)&&Gx(a),n&&Jt!==null&&!vu&&!a?.reactions?.includes(r)&&(a.reactions??=[]).push(r),a.version>r.version)return!0}}n||qi(r,512)}return!1}function EG(r,e,t){if(!!1||nI.has(r)||t===null)throw r;let n=[],i=e.fn?.name;i&&n.push(i);let a=t;for(;a!==null;){if(!1){var o=a.function?.[Ui];if(o){let s=o.split("/").pop();n.push(s)}}a=a.p}let u=/Firefox/.test(navigator.userAgent)?"  ":"	";Wa(r,"message",{value:r.message+`
${n.map(s=>`
${u}in ${s}`).join("")}
`});let c=r.stack;if(c){let s=c.split(`
`),l=[];for(let f=0;f<s.length;f++){let p=s[f];p.includes("svelte/src/internal")||l.push(p)}Wa(r,"stack",{value:r.stack+l.join(`
`)})}throw nI.add(r),r}function kd(r){var e=si,t=Ma,n=Ds,i=Dr,a=vu,o=Mo,u=vr,c=r.f;si=null,Ma=0,Ds=null,Dr=c&96?null:r,vu=!Cs&&(c&128)!==0,Mo=null,vr=r.ctx;try{var s=(0,r.fn)(),l=r.deps;if(si!==null){var f;if(Sl(r,Ma),l!==null&&Ma>0)for(l.length=Ma+si.length,f=0;f<si.length;f++)l[Ma+f]=si[f];else r.deps=l=si;if(!vu)for(f=Ma;f<l.length;f++)(l[f].reactions??=[]).push(r)}else l!==null&&Ma<l.length&&(Sl(r,Ma),l.length=Ma);return s}finally{si=e,Ma=t,Ds=n,Dr=i,vu=a,Mo=o,vr=u}}function TG(r,e){let t=e.reactions;if(t!==null){var n=t.indexOf(r);if(n!==-1){var i=t.length-1;i===0?t=e.reactions=null:(t[n]=t[i],t.pop())}}t===null&&e.f&2&&(si===null||!si.includes(e))&&(qi(e,2048),e.f&384||(e.f^=256),Sl(e,0))}function Sl(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)TG(r,t[n])}function _l(r){var e=r.f;if(!(e&8192)){qi(r,512);var t=Jt,n=vr;if(Jt=r,!1){var i=to;to=r.component_function}try{Zx(r),e&16?YF(r):Jx(r),jx(r);var a=kd(r);r.teardown=typeof a=="function"?a:null,r.version=oI,!1}catch(o){EG(o,r,n)}finally{Jt=t,!1}}}function sI(){if($c>1e3)if($c=0,!1)try{Ox()}catch(r){throw Wa(r,"stack",{value:""}),console.error("Last ten effects were: ",vp.slice(-10).map(e=>e.fn)),vp=[],r}else Ox();$c++}function uI(r){var e=r.length;if(e!==0){sI();var t=Cs;Cs=!0;try{for(var n=0;n<e;n++){var i=r[n];i.f&512||(i.f^=512);var a=[];lI(i,a),MG(a)}}finally{Cs=t}}}function MG(r){var e=r.length;if(e!==0)for(var t=0;t<e;t++){var n=r[t];!(n.f&12288)&&gu(n)&&(_l(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Xx(n):n.fn=null))}}function DG(){if(gp=!1,$c>1001)return;let r=El;El=[],uI(r),gp||($c=0,!1)}function Pc(r){Ud===aI&&(gp||(gp=!0,queueMicrotask(DG)));for(var e=r;e.parent!==null;){e=e.parent;var t=e.f;if(t&96){if(!(t&512))return;e.f^=512}}El.push(e)}function lI(r,e){var t=r.first,n=[];e:for(;t!==null;){var i=t.f,a=(i&32)!==0,o=a&&(i&512)!==0;if(!o&&!(i&4096))if(i&8){a?t.f^=512:gu(t)&&_l(t);var u=t.first;if(u!==null){t=u;continue}}else i&4&&n.push(t);var c=t.next;if(c===null){let f=t.parent;for(;f!==null;){if(r===f)break e;var s=f.next;if(s!==null){t=s;continue e}f=f.parent}}t=c}for(var l=0;l<n.length;l++)u=n[l],e.push(u),lI(u,e)}function Oc(r){var e=Ud,t=El;try{sI();let i=[];Ud=SG,El=i,gp=!1,uI(t);var n=r?.();return QF(),(El.length>0||i.length>0)&&Oc(),$c=0,!1,n}finally{Ud=e,El=t}}function U(r){var e=r.f,t=(e&2)!==0;if(t&&e&8192){var n=Hx(r);return mp(r),n}if(rb&&AG.add(r),Dr!==null){Mo!==null&&Mo.includes(r)&&LF();var i=Dr.deps;si===null&&i!==null&&i[Ma]===r?Ma++:si===null?si=[r]:si.push(r),Ds!==null&&Jt!==null&&Jt.f&512&&!(Jt.f&32)&&Ds.includes(r)&&(qi(Jt,1024),Pc(Jt))}else if(t&&r.deps===null){var a=r,o=a.parent;o!==null&&!o.deriveds?.includes(a)&&(o.deriveds??=[]).push(a)}return t&&(a=r,gu(a)&&Gx(a)),r.v}function Rn(r){let e=Dr;try{return Dr=null,r()}finally{Dr=e}}var CG=-3585;function qi(r,e){r.f=r.f&CG|e}function De(r,e=!1,t){vr={p:vr,c:null,e:null,m:!1,s:r,x:null,l:null},e||(vr.l={s:null,u:null,r1:[],r2:On(!1)}),!1}function Ce(r){let e=vr;if(e!==null){r!==void 0&&(e.x=r);let o=e.e;if(o!==null){var t=Jt,n=Dr;e.e=null;try{for(var i=0;i<o.length;i++){var a=o[i];wi(a.effect),Qa(a.reaction),na(a.fn)}}finally{wi(t),Qa(n)}}vr=e.p,!1,e.m=!0}return r||{}}if(!1){let r=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void 0)return t;$F(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}function Ue(r,e=null,t){if(typeof r!="object"||r===null||Yo in r)return r;let n=Ms(r);if(n!==Fd&&n!==TF)return r;var i=new Map,a=Ga(r),o=On(0);a&&i.set("length",On(r.length));var u;if(!1)if(u={parent:e,owners:null},t){let c=t.v?.[xl]?.owners;u.owners=c?new Set(c):null}else u.owners=e===null?vr!==null?new Set([vr.function]):null:new Set;return new Proxy(r,{defineProperty(c,s,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&OF();var f=i.get(s);return f===void 0?(f=On(l.value),i.set(s,f)):Oe(f,Ue(l.value,u)),!0},deleteProperty(c,s){var l=i.get(s);if(l===void 0)s in c&&i.set(s,On(bi));else{if(a&&typeof s=="string"){var f=i.get("length"),p=Number(s);Number.isInteger(p)&&p<f.v&&Oe(f,p)}Oe(l,bi),cI(o)}return!0},get(c,s,l){if(!1)return u;if(s===Yo)return r;var f=i.get(s),p=s in c;if(f===void 0&&(!p||Ya(c,s)?.writable)&&(f=On(Ue(p?c[s]:bi,u)),i.set(s,f)),f!==void 0){var m=U(f);if(!1){var d=m?.[xl];d&&d?.parent!==u&&tb(u,d)}return m===bi?void 0:m}return Reflect.get(c,s,l)},getOwnPropertyDescriptor(c,s){var l=Reflect.getOwnPropertyDescriptor(c,s);if(l&&"value"in l){var f=i.get(s);f&&(l.value=U(f))}else if(l===void 0){var p=i.get(s),m=p?.v;if(p!==void 0&&m!==bi)return{enumerable:!0,configurable:!0,value:m,writable:!0}}return l},has(c,s){if(s===Yo)return!0;var l=i.get(s),f=l!==void 0&&l.v!==bi||Reflect.has(c,s);if(l!==void 0||Jt!==null&&(!f||Ya(c,s)?.writable)){l===void 0&&(l=On(f?Ue(c[s],u):bi),i.set(s,l));var p=U(l);if(p===bi)return!1}return f},set(c,s,l,f){var p=i.get(s),m=s in c;if(a&&s==="length")for(var d=l;d<p.v;d+=1){var h=i.get(d+"");h!==void 0?Oe(h,bi):d in c&&(h=On(bi),i.set(d+"",h))}if(p===void 0?(!m||Ya(c,s)?.writable)&&(p=On(void 0),Oe(p,Ue(l,u)),i.set(s,p)):(m=p.v!==bi,Oe(p,Ue(l,u))),!1){var x=l?.[xl];x&&x?.parent!==u&&tb(u,x),rI(u)}var b=Reflect.getOwnPropertyDescriptor(c,s);if(b?.set&&b.set.call(f,l),!m){if(a&&typeof s=="string"){var T=i.get("length"),v=Number(s);Number.isInteger(v)&&v>=T.v&&Oe(T,v+1)}cI(o)}return!0},ownKeys(c){U(o);var s=Reflect.ownKeys(c).filter(p=>{var m=i.get(p);return m===void 0||m.v!==bi});for(var[l,f]of i)f.v!==bi&&!(l in c)&&s.push(l);return s},setPrototypeOf(){RF()}})}function cI(r,e=1){Oe(r,r.v+e)}function Is(r){return r!==null&&typeof r=="object"&&Yo in r?r[Yo]:r}function nb(r,e){return Object.is(Is(r),Is(e))}function fI(){let r=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:t,lastIndexOf:n,includes:i}=r;r.indexOf=function(a,o){let u=t.call(this,a,o);return u===-1&&t.call(Is(this),Is(a),o)!==-1&&Nd("array.indexOf(...)"),u},r.lastIndexOf=function(a,o){let u=n.call(this,a,o??this.length-1);return u===-1&&n.call(Is(this),Is(a),o??this.length-1)!==-1&&Nd("array.lastIndexOf(...)"),u},r.includes=function(a,o){let u=i.call(this,a,o);return u||i.call(Is(this),Is(a),o)&&Nd("array.includes(...)"),u},Array.__svelte_cleanup=()=>{r.indexOf=t,r.lastIndexOf=n,r.includes=i}}var Ps,pI,mI,dI;function zd(){if(Ps===void 0){Ps=window,pI=document;var r=Element.prototype,e=Node.prototype;mI=Ya(e,"firstChild").get,dI=Ya(e,"nextSibling").get,r.__click=void 0,r.__className="",r.__attributes=null,r.__styles=null,r.__e=void 0,Text.prototype.__t=void 0,!1}}function oa(r=""){return document.createTextNode(r)}function ui(r){return mI.call(r)}function Si(r){return dI.call(r)}function de(r,e){if(!Bt)return ui(r);var t=ui(or);if(t===null)t=or.appendChild(oa());else if(e&&t.nodeType!==3){var n=oa();return t?.before(n),En(n),n}return En(t),t}function Ke(r,e){if(!Bt){var t=ui(r);return t instanceof Comment&&t.data===""?Si(t):t}if(e&&or?.nodeType!==3){var n=oa();return or?.before(n),En(n),n}return or}function ce(r,e=1,t=!1){let n=Bt?or:r;for(;e--;)n=Si(n);if(!Bt)return n;var i=n.nodeType;if(t&&i!==3){var a=oa();return n?.before(a),En(a),a}return En(n),n}function Rc(r){r.textContent=""}var Bt=!1;function sa(r){Bt=r}var or;function En(r){if(r===null)throw Cc(),du;return or=r}function zi(){return En(Si(or))}function ue(r){if(Bt){if(Si(or)!==null)throw Cc(),du;or=r}}function Ut(r=1){if(Bt){for(var e=r,t=or;e--;)t=Si(t);or=t}}function yp(){for(var r=0,e=or;;){if(e.nodeType===8){var t=e.data;if(t===yl){if(r===0)return e;r-=1}else(t===Dc||t===vl)&&(r+=1)}var n=Si(e);e.remove(),e=n}}var ib=new Set,Hd=new Set;function hI(r,e,t,n){function i(a){if(n.capture||Lc.call(e,a),!a.cancelBubble){var o=Dr,u=Jt;Qa(null),wi(null);try{return t.call(this,a)}finally{Qa(o),wi(u)}}}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?ro(()=>{e.addEventListener(r,i,n)}):e.addEventListener(r,i,n),i}function ua(r,e,t,n,i){var a={capture:n,passive:i},o=hI(r,e,t,a);(e===document.body||e===window||e===document)&&Ka(()=>{e.removeEventListener(r,o,a)})}function Pt(r){for(var e=0;e<r.length;e++)ib.add(r[e]);for(var t of Hd)t(r)}function Lc(r){var e=this,t=e.ownerDocument,n=r.type,i=r.composedPath?.()||[],a=i[0]||r.target,o=0,u=r.__root;if(u){var c=i.indexOf(u);if(c!==-1&&(e===document||e===window)){r.__root=e;return}var s=i.indexOf(e);if(s===-1)return;c<=s&&(o=c)}if(a=i[o]||r.target,a!==e){Wa(r,"currentTarget",{configurable:!0,get(){return a||t}});var l=Dr,f=Jt;Qa(null),wi(null);try{for(var p,m=[];a!==null;){var d=a.assignedSlot||a.parentNode||a.host||null;try{var h=a["__"+n];if(h!==void 0&&!a.disabled)if(Ga(h)){var[x,...b]=h;x.apply(a,[r,...b])}else h.call(a,r)}catch(T){p?m.push(T):p=T}if(r.cancelBubble||d===e||d===null)break;a=d}if(p){for(let T of m)queueMicrotask(()=>{throw T});throw p}}finally{r.__root=e,delete r.currentTarget,Qa(l),wi(f)}}}var NG;function gI(){NG=void 0}function Gd(r){var e=document.createElement("template");return e.innerHTML=r,e.content}function no(r,e){var t=Jt;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function ae(r,e){var t=(e&1)!==0,n=(e&2)!==0,i,a=!r.startsWith("<!>");return()=>{if(Bt)return no(or,null),or;i===void 0&&(i=Gd(a?r:"<!>"+r),t||(i=ui(i)));var o=n?document.importNode(i,!0):i.cloneNode(!0);if(t){var u=ui(o),c=o.lastChild;no(u,c)}else no(o,o);return o}}function gr(r=""){if(!Bt){var e=oa(r+"");return no(e,e),e}var t=or;return t.nodeType!==3&&(t.before(t=oa()),En(t)),no(t,t),t}function Qr(){if(Bt)return no(or,null),or;var r=document.createDocumentFragment(),e=document.createComment(""),t=oa();return r.append(e,t),no(e,t),r}function te(r,e){if(Bt){Jt.nodes_end=or,zi();return}r!==null&&r.before(e)}var PG=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory"];var tfe=[...PG,"formNoValidate","isMap","noModule","playsInline","readOnly","value","inert","volume"];var BG=["touchstart","touchmove"];function vI(r){return BG.includes(r)}var ab=!0;function ft(r,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(r.__t??=r.nodeValue)&&(r.__t=t,r.nodeValue=t==null?"":t+"")}function Cr(r,e){return yI(r,e)}function sb(r,e){zd(),e.intro=e.intro??!1;let t=e.target,n=Bt,i=or;try{for(var a=ui(t);a&&(a.nodeType!==8||a.data!==Dc);)a=Si(a);if(!a)throw du;sa(!0),En(a),zi();let o=yI(r,{...e,anchor:a});if(or===null||or.nodeType!==8||or.data!==yl)throw Cc(),du;return sa(!1),o}catch(o){if(o===du)return e.recover===!1&&IF(),zd(),Rc(t),sa(!1),Cr(r,e);throw o}finally{sa(n),En(i),gI()}}var Vc=new Map;function yI(r,{target:e,anchor:t,props:n={},events:i,context:a,intro:o=!0}){zd();var u=new Set,c=f=>{for(var p=0;p<f.length;p++){var m=f[p];if(!u.has(m)){u.add(m);var d=vI(m);e.addEventListener(m,Lc,{passive:d});var h=Vc.get(m);h===void 0?(document.addEventListener(m,Lc,{passive:d}),Vc.set(m,1)):Vc.set(m,h+1)}}};c(fp(ib)),Hd.add(c);var s=void 0,l=dp(()=>{var f=t??e.appendChild(oa());return _i(()=>{if(a){De({});var p=vr;p.c=a}i&&(n.$$events=i),Bt&&no(f,null),ab=o,s=r(f,n)||{},ab=!0,Bt&&(Jt.nodes_end=or),a&&Ce()}),()=>{for(var p of u){e.removeEventListener(p,Lc);var m=Vc.get(p);--m===0?(document.removeEventListener(p,Lc),Vc.delete(p)):Vc.set(p,m)}Hd.delete(c),ob.delete(s),f!==t&&f.parentNode?.removeChild(f)}});return ob.set(s,l),s}var ob=new WeakMap;function Fr(r){let e=ob.get(r);e?e():!1}var $G="font-weight: bold",OG="font-weight: normal";function ub(r){console.warn("state_snapshot_uncloneable")}var RG=[];function li(r,e=!1){if(!1){let t=[],n=xp(r,new Map,"",t);if(t.length===1&&t[0]==="")ub();else if(t.length>0){let i=t.length>10?t.slice(0,7):t.slice(0,10),a=t.length-i.length,o=i.map(u=>`- <value>${u}`).join(`
`);a>0&&(o+=`
- ...and ${a} more`),ub(o)}return n}return xp(r,new Map,"",RG)}function xp(r,e,t,n){if(typeof r=="object"&&r!==null){let a=e.get(r);if(a!==void 0)return a;if(r instanceof Map)return new Map(r);if(r instanceof Set)return new Set(r);if(Ga(r)){let o=[];e.set(r,o);for(let u=0;u<r.length;u+=1)o.push(xp(r[u],e,t,n));return o}if(Ms(r)===Fd){let o={};e.set(r,o);for(var i in r)o[i]=xp(r[i],e,t,n);return o}if(r instanceof Date)return structuredClone(r);if(typeof r.toJSON=="function")return xp(r.toJSON(),e,t,n)}if(r instanceof EventTarget)return r;try{return structuredClone(r)}catch{return!1,r}}function at(r,e,t,n=null,i=!1){Bt&&zi();var a=r,o=null,u=null,c=null,s=i?32768:0;aa(()=>{if(c===(c=!!e()))return;let l=!1;if(Bt){let f=a.data===vl;c===f&&(a=yp(),En(a),sa(!1),l=!0)}c?(o?yu(o):o=_i(()=>t(a)),u&&Fs(u,()=>{u=null})):(u?yu(u):n&&(u=_i(()=>n(a))),o&&Fs(o,()=>{o=null})),l&&sa(!0)},s),Bt&&(a=or)}var bp=null;function Kt(r,e){return e}function qG(r,e,t,n){for(var i=[],a=e.length,o=0;o<a;o++)$d(e[o].e,i,!0);var u=a>0&&i.length===0&&t!==null;if(u){var c=t.parentNode;Rc(c),c.append(t),n.clear(),xu(r,e[0].prev,e[a-1].next)}Qx(i,()=>{for(var s=0;s<a;s++){var l=e[s];u||(n.delete(l.k),xu(r,l.prev,l.next)),ra(l.e,!u)}})}function Wt(r,e,t,n,i,a=null){var o=r,u={flags:e,items:new Map,first:null},c=(e&4)!==0;if(c){var s=r;o=Bt?En(ui(s)):s.appendChild(oa())}Bt&&zi();var l=null,f=!1;aa(()=>{var p=t(),m=Ga(p)?p:p==null?[]:fp(p),d=m.length;if(f&&d===0)return;f=d===0;let h=!1;if(Bt){var x=o.data===vl;x!==(d===0)&&(o=yp(),En(o),sa(!1),h=!0)}if(Bt){for(var b=null,T,v=0;v<d;v++){if(or.nodeType===8&&or.data===yl){o=or,h=!0,sa(!1);break}var S=m[v],_=n(S,v);T=_I(or,u,b,null,S,_,v,i,e),u.items.set(_,T),b=T}d>0&&En(yp())}Bt||zG(m,u,o,i,e,n),a!==null&&(d===0?l?yu(l):l=_i(()=>a(o)):l!==null&&Fs(l,()=>{l=null})),h&&sa(!0),t()}),Bt&&(o=or)}function zG(r,e,t,n,i,a){var o=(i&8)!==0,u=(i&3)!==0,c=r.length,s=e.items,l=e.first,f=l,p,m=null,d,h=[],x=[],b,T,v,S;if(o)for(S=0;S<c;S+=1)b=r[S],T=a(b,S),v=s.get(T),v!==void 0&&(v.a?.measure(),(d??=new Set).add(v));for(S=0;S<c;S+=1){if(b=r[S],T=a(b,S),v=s.get(T),v===void 0){var _=f?f.e.nodes_start:t;m=_I(_,e,m,m===null?e.first:m.next,b,T,S,n,i),s.set(T,m),h=[],x=[],f=m.next;continue}if(u&&HG(v,b,S,i),v.e.f&4096&&(yu(v.e),o&&(v.a?.unfix(),(d??=new Set).delete(v))),v!==f){if(p!==void 0&&p.has(v)){if(h.length<x.length){var y=x[0],A;m=y.prev;var M=h[0],w=h[h.length-1];for(A=0;A<h.length;A+=1)bI(h[A],y,t);for(A=0;A<x.length;A+=1)p.delete(x[A]);xu(e,M.prev,w.next),xu(e,m,M),xu(e,w,y),f=y,m=w,S-=1,h=[],x=[]}else p.delete(v),bI(v,f,t),xu(e,v.prev,v.next),xu(e,v,m===null?e.first:m.next),xu(e,m,v),m=v;continue}for(h=[],x=[];f!==null&&f.k!==T;)f.e.f&4096||(p??=new Set).add(f),x.push(f),f=f.next;if(f===null)continue;v=f}h.push(v),m=v,f=v.next}if(f!==null||p!==void 0){for(var D=p===void 0?[]:fp(p);f!==null;)f.e.f&4096||D.push(f),f=f.next;var N=D.length;if(N>0){var B=i&4&&c===0?t:null;if(o){for(S=0;S<N;S+=1)D[S].a?.measure();for(S=0;S<N;S+=1)D[S].a?.fix()}qG(e,D,B,s)}}o&&ro(()=>{if(d!==void 0)for(v of d)v.a?.apply()}),Jt.first=e.first&&e.first.e,Jt.last=m&&m.e}function HG(r,e,t,n){n&1&&pp(r.v,e),n&2?pp(r.i,t):r.i=t}function _I(r,e,t,n,i,a,o,u,c){var s=bp;try{var l=(c&1)!==0,f=(c&16)===0,p=l?f?hu(i):On(i):i,m=c&2?On(o):o,d={i:m,v:p,k:a,a:null,e:null,prev:t,next:n};return bp=d,d.e=_i(()=>u(r,p,m),Bt),d.e.prev=t&&t.e,d.e.next=n&&n.e,t===null?e.first=d:(t.next=d,t.e.next=d.e),n!==null&&(n.prev=d,n.e.prev=d.e),d}finally{bp=s}}function bI(r,e,t){for(var n=r.next?r.next.e.nodes_start:t,i=e?e.e.nodes_start:t,a=r.e.nodes_start;a!==n;){var o=Si(a);i.before(a),a=o}}function xu(r,e,t){e===null?r.first=t:(e.next=t,e.e.next=t&&t.e),t!==null&&(t.prev=e,t.e.prev=e&&e.e)}function io(r,e,...t){var n=r,i=ja,a;aa(()=>{i!==(i=e())&&(a&&(ra(a),a=null),!1,a=_i(()=>i(n,...t)))},32768),Bt&&(n=or)}function Fn(r){Bt&&ui(r)!==null&&Rc(r)}var AI=!1;function Wd(){AI||(AI=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{if(!r.defaultPrevented)for(let e of r.target.elements)e.__on_r?.()})},{capture:!0}))}function St(r){if(Bt){var e=!1,t=()=>{if(!e){if(e=!0,r.hasAttribute("value")){var n=r.value;_t(r,"value",null),r.value=n}if(r.hasAttribute("checked")){var i=r.checked;_t(r,"checked",null),r.checked=i}}};r.__on_r=t,XF(t),Wd()}}function pb(r,e){var t=r.__attributes??={};t.value===(t.value=e)||r.value===e&&(e!==0||r.nodeName!=="PROGRESS")||(r.value=e)}function Bs(r,e){var t=r.__attributes??={};t.checked!==(t.checked=e)&&(r.checked=e)}function _t(r,e,t,n){var i=r.__attributes??={};if(Bt&&(i[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName==="LINK")){n||jG(r,e,t??"");return}i[e]!==(i[e]=t)&&(e==="style"&&"__styles"in r&&(r.__styles={}),e==="loading"&&(r[MF]=t),t==null?r.removeAttribute(e):typeof t!="string"&&YG(r).includes(e)?r[e]=t:r.setAttribute(e,t))}var EI=new Map;function YG(r){var e=EI.get(r.nodeName);if(e)return e;EI.set(r.nodeName,e=[]);for(var t,n=Ms(r),i=Element.prototype;i!==n;){t=Bx(n);for(var a in t)t[a].set&&e.push(a);n=Ms(n)}return e}function jG(r,e,t){!1}function fb(r,e){return r===e?!0:new URL(r,document.baseURI).href===new URL(e,document.baseURI).href}function TI(r){return r.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function ZG(r,e){var t=TI(r.srcset),n=TI(e);return n.length===t.length&&n.every(([i,a],o)=>a===t[o][1]&&(fb(t[o][0],i)||fb(i,t[o][0])))}function ao(r,e){var t=r.__className,n=JG(e);Bt&&r.className===n?r.__className=n:(t!==n||Bt&&r.className!==n)&&(e==null?r.removeAttribute("class"):r.className=n,r.__className=n)}function JG(r){return r??""}function Jr(r,e,t){if(t){if(r.classList.contains(e))return;r.classList.add(e)}else{if(!r.classList.contains(e))return;r.classList.remove(e)}}function Yd(r,e,t,n=t){r.addEventListener(e,t);let i=r.__on_r;i?r.__on_r=()=>{i(),n()}:r.__on_r=n,Wd()}function vt(r,e,t=e){var n=wl();Yd(r,"input",()=>{!1;var i=MI(r)?DI(r.value):r.value;t(i),n&&i!==(i=e())&&(r.value=i??"")}),ia(()=>{!1;var i=e();if(Bt&&r.defaultValue!==r.value){t(r.value);return}MI(r)&&i===DI(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i??"")})}function MI(r){var e=r.type;return e==="number"||e==="range"}function DI(r){return r===""?null:+r}function Zd(r,e,t){if(r.multiple)return KG(r,e);for(var n of r.options){var i=wp(n);if(nb(i,e)){n.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function CI(r,e){let t=!0;na(()=>{e&&Zd(r,Rn(e),t),t=!1;var n=new MutationObserver(()=>{var i=r.__value;Zd(r,i)});return n.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{n.disconnect()}})}function Uc(r,e,t=e){var n=!0;Yd(r,"change",()=>{var i;if(r.multiple)i=[].map.call(r.querySelectorAll(":checked"),wp);else{var a=r.querySelector(":checked");i=a&&wp(a)}t(i)}),na(()=>{var i=e();if(Zd(r,i,n),n&&i===void 0){var a=r.querySelector(":checked");a!==null&&(i=wp(a),t(i))}r.__value=i,n=!1}),CI(r)}function KG(r,e){for(var t of r.options)t.selected=~e.indexOf(wp(t))}function wp(r){return"__value"in r?r.__value:r.value}function NI(r,e){return r===e||r?.[Yo]===e}function Co(r={},e,t,n){return na(()=>{var i,a;return ia(()=>{i=a,a=n?.()||[],Rn(()=>{r!==t(...a)&&(e(r,...a),i&&NI(t(...i),r)&&e(null,...i))})}),()=>{ro(()=>{a&&NI(t(...a),r)&&e(null,...a)})}}),r}function _p(r){vr===null&&hp("onMount"),vr.l!==null?aW(vr).m.push(r):eo(()=>{let e=Rn(r);if(typeof e=="function")return e})}function qc(r){vr===null&&hp("onDestroy"),_p(()=>()=>Rn(r))}function aW(r){var e=r.l;return e.u??={a:[],b:[],m:[]}}var Jd=!1;function mb(r){var e=Jd;try{return Jd=!1,[r(),Jd]}finally{Jd=e}}var pW={get(r,e){if(!r.exclude.includes(e))return r.props[e]},set(r,e){return!1,!1},getOwnPropertyDescriptor(r,e){if(!r.exclude.includes(e)&&e in r.props)return{enumerable:!0,configurable:!0,value:r.props[e]}},has(r,e){return r.exclude.includes(e)?!1:e in r.props},ownKeys(r){return Reflect.ownKeys(r.props).filter(e=>!r.exclude.includes(e))}};function ir(r,e,t){return new Proxy({props:r,exclude:e},pW)}function FI(r){for(var e=Jt,t=Jt;e!==null&&!(e.f&96);)e=e.parent;try{return wi(e),r()}finally{wi(t)}}function bt(r,e,t,n){var i=(t&1)!==0,a=(t&2)!==0,o=(t&8)!==0,u=(t&16)!==0,c=!1,s;o?[s,c]=mb(()=>r[e]):s=r[e];var l=Ya(r,e)?.set,f=n,p=!0,m=!1,d=()=>(m=!0,p&&(p=!1,u?f=Rn(n):f=n),f);s===void 0&&n!==void 0&&(l&&a&&BF(e),s=d(),l&&l(s));var h;if(a)h=()=>{var y=r[e];return y===void 0?d():(p=!0,m=!1,y)};else{var x=FI(()=>(i?Qt:zx)(()=>r[e]));x.f|=65536,h=()=>{var y=U(x);return y!==void 0&&(f=void 0),y===void 0?f:y}}if(!(t&4))return h;if(l){var b=r.$$legacy;return function(y,A){return arguments.length>0?((!a||!A||b||c)&&l(A?h():y),y):h()}}var T=!1,v=!1,S=hu(s),_=FI(()=>Qt(()=>{var y=h(),A=U(S),M=Dr;return T||y===void 0&&M.f&8192?(T=!1,v=!0,A):(v=!1,S.v=y)}));return i||(_.equals=Nc),function(y,A){if(rb&&(T=v,h(),U(S)),arguments.length>0){let M=A?U(_):a&&o?Ue(y):y;return _.equals(M)||(T=!0,Oe(S,M),m&&f!==void 0&&(f=M),Rn(()=>U(_))),y}return U(_)}}function II(r){return new db(r)}var db=class{#t;#e;constructor(e){var t=new Map,n=(a,o)=>{var u=hu(o);return t.set(a,u),u};let i=new Proxy({...e.props||{},$$events:{}},{get(a,o){return U(t.get(o)??n(o,Reflect.get(a,o)))},has(a,o){return U(t.get(o)??n(o,Reflect.get(a,o))),Reflect.has(a,o)},set(a,o,u){return Oe(t.get(o)??n(o,u),u),Reflect.set(a,o,u)}});this.#e=(e.hydrate?sb:Cr)(e.component,{target:e.target,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&Oc(),this.#t=i.$$events;for(let a of Object.keys(this.#e))a==="$set"||a==="$destroy"||a==="$on"||Wa(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=()=>{Fr(this.#e)}}$set(e){this.#e.$set(e)}$on(e,t){this.#t[e]=this.#t[e]||[];let n=(...i)=>t.call(this,...i);return this.#t[e].push(n),()=>{this.#t[e]=this.#t[e].filter(i=>i!==n)}}$destroy(){this.#e.$destroy()}};var xW;typeof HTMLElement=="function"&&(xW=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(r,e,t){super(),this.$$ctor=r,this.$$s=e,t&&this.attachShadow({mode:"open"})}addEventListener(r,e,t){if(this.$$l[r]=this.$$l[r]||[],this.$$l[r].push(e),this.$$c){let n=this.$$c.$on(r,e);this.$$l_u.set(e,n)}super.addEventListener(r,e,t)}removeEventListener(r,e,t){if(super.removeEventListener(r,e,t),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 r=function(n){return i=>{let a=document.createElement("slot");n!=="default"&&(a.name=n),te(i,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},t=bW(this);for(let n of this.$$s)n in t&&(n==="default"&&!this.$$d.children?(this.$$d.children=r(n),e.default=!0):e[n]=r(n));for(let n of this.attributes){let i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=hb(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=II({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=dp(()=>{ia(()=>{this.$$r=!0;for(let n of Px(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=hb(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(r,e,t){this.$$r||(r=this.$$g_p(r),this.$$d[r]=hb(r,t,this.$$p_d,"toProp"),this.$$c?.$set({[r]:this.$$d[r]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(r){return Px(this.$$p_d).find(e=>this.$$p_d[e].attribute===r||!this.$$p_d[e].attribute&&e.toLowerCase()===r)||r}});function hb(r,e,t,n){let i=t[r]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[r])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;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 bW(r){let e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var _W=ae('<div class="mb-icon-wrapper"></div>');function Xr(r,e){De(e,!0);let t=bt(e,"iconName",3,""),n=ht(void 0);eo(()=>U(n)?e.plugin.internal.setIcon(U(n),t()):void 0);var i=Qr(),a=Ke(i);at(a,()=>t().length>0,o=>{var u=_W();Co(u,c=>Oe(n,c),()=>U(n)),te(o,u)}),te(r,i),Ce()}async function SW(r,e,t){if(!e()){e(!0);try{await t()()}catch(n){console.warn("failed to run button component on click",n)}finally{e(!1)}}}var AW=ae('<button class="mb-button-inner"><!> </button>');function Sp(r,e){De(e,!0);let t=bt(e,"variant",19,()=>"default"),n=bt(e,"disabled",7,!1),i=bt(e,"tooltip",3,""),a=bt(e,"label",3,""),o=bt(e,"icon",3,""),u=bt(e,"error",3,!1),c=bt(e,"onclick",3,()=>{});var s=AW();s.__click=[SW,n,c];var l=de(s);at(l,o,p=>{Xr(p,{get plugin(){return e.plugin},get iconName(){return o()}})});var f=ce(l);ue(s),Ve(()=>{_t(s,"aria-label",i()),s.disabled=n(),Jr(s,"mod-cta",t()==="primary"),Jr(s,"mod-warning",t()==="destructive"),Jr(s,"mod-plain",t()==="plain"),Jr(s,"disabled",n()),Jr(s,"mb-error",u()),ft(f,` ${a()??""}`)}),te(r,s),Ce()}Pt(["click"]);var bu=class extends xi{constructor(e,t,n,i,a,o,u){super(),this.plugin=e,this.config=t,this.filePath=n,this.isInline=i==="inline",this.position=a,this.isInGroup=o,this.isPreview=u}onMount(e){ct.empty(e),ct.removeAllClasses(e),ct.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&&ct.addClasses(e,this.config.class.split(" ").filter(t=>t!=="")),this.buttonComponent=Cr(Sp,{target:e,props:{plugin:this.plugin,icon:this.config.icon,variant:this.config.style,label:this.config.label,tooltip:HD(this.config.tooltip)?this.config.tooltip:this.config.label,onclick:async()=>{await this.plugin.api.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext())}}}))}getContext(){return{position:this.position?.getPosition(),isInGroup:this.isInGroup,isInline:this.isInline}}onUnmount(){this.buttonComponent&&Fr(this.buttonComponent),!this.isInline&&!this.isPreview&&this.config?.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.config.id)}};var Xd=class extends xi{constructor(e,t,n,i,a){super(),this.plugin=e,this.referencedIds=t,this.filePath=n,this.renderChildType=i,this.notePosition=a}renderInitialButton(e,t){return ct.removeAllClasses(e),ct.addClasses(e,["mb-button",this.renderChildType==="inline"?"mb-button-inline":"mb-button-block"]),Cr(Sp,{target:e,props:{plugin:this.plugin,variant:"default",label:"Button ID not Found",tooltip:`No button with id '${t}' found`,error:!0,onclick:async()=>{}}})}onMount(e){ct.empty(e),ct.addClasses(e,["mb-button-group",this.renderChildType==="inline"?"mb-button-group-inline":"mb-button-group-block"]);for(let t of this.referencedIds){let n=ct.createElement(e,"span"),i=this.renderInitialButton(n,t),a,o=this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,t,u=>{i&&Fr(i),i=void 0,a=new bu(this.plugin,u,this.filePath,this.renderChildType,this.notePosition,!0,!1),a.mount(n)});this.registerUnmountCb(()=>{i&&Fr(i),i=void 0,a?.unmount(),o()})}}onUnmount(e){ct.empty(e)}};var Qd=class extends $n{constructor(e,t,n,i,a,o){super(e,t,n),this.declaration=i,this.errorCollection=new Xt(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.renderChildType=a,this.position=o}onMount(e){if(super.onMount(e),ct.removeAllClasses(e),this.declaration.errorCollection.isEmpty())try{this.buttonField=new Xd(this.plugin,this.declaration.referencedButtonIds,this.getFilePath(),this.renderChildType,this.position),this.buttonField.mount(e)}catch(t){this.errorCollection.add(t),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(),gi(e,"inline button")}};var Kd=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 eh=class{constructor(e){this.plugin=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let t=new Set,n=new Xt("ButtonManager");this.buttonTemplates.clear();for(let i of e)i.id===void 0||i.id===""?n.add(new vs({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."})):t.has(i.id)?n.add(new vs({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."})):(t.add(i.id),this.buttonTemplates.set(i.id,i));return n.hasErrors()&&this.buttonTemplates.clear(),n}registerButtonLoadListener(e,t,n){let i=this.getButton(e,t);i&&n(i),this.buttonLoadListeners.has(e)||this.buttonLoadListeners.set(e,new Map);let a=this.buttonLoadListeners.get(e);a.has(t)||a.set(t,new Map);let o=a.get(t),u=qr();return o.set(u,n),()=>this.removeButtonLoadListener(e,t,u)}notifyButtonLoadListeners(e,t){let n=this.getButton(e,t);if(!n)throw new Error(`ButtonManager | button with id ${t} does not exist`);let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);if(a)for(let[o,u]of a)u(n)}removeButtonLoadListener(e,t,n){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);a&&(a.delete(n),a.size===0&&i.delete(t),i.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,t){if(t.id===void 0||t.id==="")throw new Error("ButtonManager | button id is undefined");if(this.buttonTemplates.has(t.id))throw new Error(`ButtonManager | button with id "${t.id}" already exists in the button templates`);this.buttons.has(e)||this.buttons.set(e,new Map),this.buttons.get(e).set(t.id,new Kd(t)),this.notifyButtonLoadListeners(e,t.id)}getButton(e,t){if(this.buttonTemplates.has(t))return this.buttonTemplates.get(t);let n=this.buttons.get(e);if(n)return n.get(t)?.getValue()}removeButton(e,t){let n=this.buttons.get(e);n&&(n.get(t)?.decrement(),n.get(t)?.isEmpty()&&n.delete(t),n.size===0&&this.buttons.delete(e))}};var th=class extends $n{constructor(e,t,n,i,a,o){super(e,t,n),this.declaration=i,this.position=a,this.isPreview=o,this.errorCollection=new Xt(this.getUuid()),this.errorCollection.merge(i.errorCollection)}onMount(e){if(super.onMount(e),ct.removeAllClasses(e),this.declaration.config&&this.declaration.errorCollection.isEmpty())try{this.buttonField=new bu(this.plugin,this.declaration.config,this.getFilePath(),"block",this.position,!1,this.isPreview),this.buttonField.mount(e)}catch(t){this.errorCollection.add(t),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(),gi(e,"button")}};var rh=class extends $n{constructor(e,t,n,i,a){super(e,t,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 t=e[0],n=xn.parseLink(t);if(!n.internal)return{error:`${t} 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>Rm}createEmbedMessage(e,t){e.createSpan({text:t,cls:"mb-embed-message"})}async renderContent(e){try{if(this.exceedsMaxDepth()){this.createEmbedMessage(e,"Max embed depth exceeded");return}let t=await this.parseContent();if(t.error){this.createEmbedMessage(e,t.error);return}if(t.content===void 0){this.createEmbedMessage(e,"Embed content not found");return}let n=t.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(t){let n=new Xt("Embed");n.add(t),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?.(),gi(e,"Embed")}};var nh=class extends $n{constructor(e,t,n){super(e,t,n)}onMount(e){super.onMount(e),ct.empty(e),ct.createElement(e,"span",{text:"[META_BIND] This folder has been excluded in the settings",class:"mb-error"})}onUnmount(e){super.onUnmount(e),ct.empty(e),gi(e,"Excluded")}};var ih=class extends Ac{constructor(e,t){super(),this.plugin=e,this.mounted=!1,this.svelteComponent=t}setValue(e){this.svelteComponentInstance?.setValue(e)}getInstance(){return this.svelteComponentInstance}mount(e,t,n={}){let i=Object.assign({plugin:this.plugin,value:t,onValueChange:a=>{this.notifyListeners(a)}},n);this.svelteComponentInstance=Cr(this.svelteComponent,{target:e,props:i}),this.mounted=!0}unmount(){this.unregisterAllListeners(),this.svelteComponentInstance&&Fr(this.svelteComponentInstance),this.mounted=!1}isMounted(){return this.mounted}};var sr=class extends xi{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.inputSignal=new Zr(void 0),this.svelteWrapper=new ih(this.plugin,this.getSvelteComponent()),this.computedSignal=new Md(this.inputSignal,t=>{let n=this.filterValue(t);return n!==void 0?n:this.getDefaultValue()})}destroy(){this.svelteWrapper.isMounted()&&this.unmount()}reverseMapValue(e){let t=this.rawReverseMapValue(e);if(t!==void 0)return t;let n=this.rawReverseMapValue(this.getDefaultValue());return n!==void 0?n:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.computedSignal.get()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.computedSignal.set(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){this.metadataSubscription?.update(e)}getDefaultValue(){let e=this.mountable.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let t=this.filterValue(e.value);return t!==void 0?t:this.mapValue(this.getFallbackDefaultValue())}getMountArgs(){return{}}onMount(e){this.inputSignal.set(this.inputSignal.get()),this.computedSignal.registerListener({callback:n=>this.svelteWrapper.setValue(this.reverseMapValue(n))});let t=this.mountable.getBindTarget();t&&(this.svelteWrapper.registerListener({callback:n=>{this.notifySubscription(this.mapValue(n))}}),this.metadataSubscription=this.mountable.plugin.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,t,()=>this.mountable.unmount())),this.svelteWrapper.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.computedSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.svelteWrapper.unmount()}};var EW=(r,e,t,n)=>t.onValueChange(U(n)),TW=ae('<input type="date">');function gb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(o){Oe(n,Ue(o))}var a=TW();return St(a),a.__input=[EW,t,e,n],vt(a,()=>U(n),o=>Oe(n,o)),te(r,a),Ce({setValue:i})}Pt(["input"]);var ah=class extends sr{filterValue(e){return Wo(e)}getFallbackDefaultValue(){return Kn.stringify(Kn.getDefaultDate())}getSvelteComponent(){return gb}rawMapValue(e){return e}rawReverseMapValue(e){return e}};function MW(r,e,t){t.showDatePicker()}function DW(r,e,t){r.key===" "&&t.showDatePicker()}var CW=ae('<div class="mb-date-picker-input" role="button" tabindex="0"><span class="mb-date-picker-text"> </span> <!></div>');function vb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(s){Oe(n,Ue(s))}var a=CW();a.__click=[MW,t,e],a.__keydown=[DW,t,e];var o=de(a),u=de(o,!0);Ve(()=>ft(u,U(n)?U(n).format(e.dateFormat):"none")),ue(o);var c=ce(o,2);return Xr(c,{get plugin(){return e.plugin},iconName:"calendar"}),ue(a),te(r,a),Ce({setValue:i})}Pt(["click","keydown"]);var oh=class extends sr{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 t=Kn.parse(e);if(t.isValid())return Kn.stringify(t)}getFallbackDefaultValue(){return Kn.getDefaultDate()}getSvelteComponent(){return vb}rawMapValue(e){return e===null?null:(console.log("value",e,Kn.stringify(e),Kn.dateFormat),Kn.stringify(e))}rawReverseMapValue(e){if(e===null)return null;let t=Kn.parse(e);if(t.isValid())return t}getMountArgs(){return{dateFormat:this.mountable.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.mountable.plugin.internal.openDatePickerModal(this)}}}};var NW=(r,e,t,n)=>t.onValueChange(U(n)),FW=ae('<input type="datetime-local">');function yb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(o){Oe(n,Ue(o))}var a=FW();return St(a),a.__input=[NW,t,e,n],vt(a,()=>U(n),o=>Oe(n,o)),te(r,a),Ce({setValue:i})}Pt(["input"]);var sh=class extends sr{filterValue(e){return Wo(e)}getFallbackDefaultValue(){return Kn.stringify(Kn.getDefaultDate())}getSvelteComponent(){return yb}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var IW=ae("<div></div>");function xb(r,e){De(e,!0);let t,n;qc(()=>{n?.()});async function i(o){n?.(),n=await e.plugin.internal.renderMarkdown(o,t,e.filePath)}eo(()=>void i(e.value));var a=IW();Co(a,o=>t=o,()=>t),te(r,a),Ce()}var PW=(r,e)=>e(),BW=(r,e)=>e(),kW=(r,e,t,n)=>t.onValueChange(U(n)),$W=ae("<textarea></textarea>"),OW=ae('<div class="mb-editor-input card" role="button" tabindex="0"><!></div>');function bb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value)),i=ht(!1);function a(f){Oe(n,Ue(f))}function o(){Oe(i,!1)}function u(){Oe(i,!0)}function c(f){f.key===" "&&u()}var s=OW();s.__click=[PW,u];var l=de(s);return at(l,()=>U(i),f=>{var p=$W();Fn(p),p.__focusout=[BW,o],p.__input=[kW,t,e,n],vt(p,()=>U(n),m=>Oe(n,m)),te(f,p)},f=>{xb(f,{get value(){return U(n)},get plugin(){return e.plugin},get filePath(){return e.filePath}})}),ue(s),ua("keypress",s,f=>c(f)),te(r,s),Ce({setValue:a})}Pt(["click","focusout","input"]);var uh=class extends sr{filterValue(e){return pu(e)?e?.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return bb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,t)=>void this.renderInElement(e,t),filePath:this.mountable.getFilePath()}}async renderInElement(e,t){this.mdUnloadCallback?.(),e.innerHTML="",this.mdUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(t,e,this.mountable.getFilePath())}onUnmount(){super.onUnmount(),this.mdUnloadCallback?.()}};var RW=ae('<button class="mb-button-inner"><!></button>');function It(r,e){De(e,!0);let t=bt(e,"variant",19,()=>"default"),n=bt(e,"disabled",3,!1),i=bt(e,"tooltip",3,""),a=bt(e,"onclick",3,()=>{});var o=RW();o.__click=function(...c){a()?.apply(this,c)};var u=de(o);io(u,()=>e.children),ue(o),Ve(()=>{_t(o,"aria-label",i()),o.disabled=n(),Jr(o,"mod-cta",t()==="primary"),Jr(o,"mod-warning",t()==="destructive"),Jr(o,"mod-plain",t()==="plain"),Jr(o,"disabled",n())}),te(r,o),Ce()}Pt(["click"]);var LW=ae('<div class="mb-image-card" role="listitem"><img class="mb-image-card-image"> <div class="mb-image-card-footer"><span> </span></div></div>'),VW=ae('<div class="mb-image-card-grid"></div> <div class="mb-list-input"><!></div>',1);function wb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(p){Oe(n,Ue(p))}function a(p){U(n).push(p),e.onValueChange(U(n))}function o(p){U(n).splice(p,1),e.onValueChange(U(n))}function u(p,m){let d=[];m>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=U(n)[m-1];U(n)[m-1]=U(n)[m],U(n)[m]=h,e.onValueChange(U(n))}}),m<U(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=U(n)[m+1];U(n)[m+1]=U(n)[m],U(n)[m]=h,e.onValueChange(U(n))}}),d.push({name:"Copy image path",icon:"copy",onclick:()=>{let h=U(n)[m];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(m)}),e.plugin.internal.createContextMenu(d).showWithEvent(p)}var c=VW(),s=Ke(c);Wt(s,21,()=>U(n),Kt,(p,m,d)=>{var h=LW();h.__contextmenu=S=>u(S,d);var x=de(h);Ve(()=>_t(x,"src",e.plugin.internal.imagePathToUri(U(m))));var b=ce(x,2),T=de(b),v=de(T,!0);ue(T),ue(b),ue(h),Ve(()=>{_t(x,"alt",U(m)),ft(v,U(m))}),te(p,h)}),ue(s);var l=ce(s,2),f=de(l);return It(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(p,m)=>{Ut();var d=gr("Add new image");te(p,d)},$$slots:{default:!0}}),ue(l),te(r,c),Ce({setValue:i,pushValue:a})}Pt(["contextmenu"]);var lh=class extends sr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return wb}rawMapValue(e){return e}rawReverseMapValue(e){return e.map(t=>Eo(t)).filter(t=>t!==void 0)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>{this.svelteWrapper.getInstance()?.pushValue(e)})}};var UW=ae('<img class="mb-image-card-image">'),qW=ae('<div class="mb-image-card"><!> <div class="mb-image-card-footer"><span> </span> <!></div></div>');function _b(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(p){Oe(n,Ue(p))}function a(){e.showSuggester()}var o=qW(),u=de(o);at(u,()=>U(n),p=>{var m=UW();Ve(()=>_t(m,"src",e.plugin.internal.imagePathToUri(U(n)))),Ve(()=>_t(m,"alt",U(n))),te(p,m)});var c=ce(u,2),s=de(c),l=de(s,!0);ue(s);var f=ce(s,2);return It(f,{get variant(){return"plain"},onclick:a,children:(p,m)=>{Xr(p,{iconName:"pencil",get plugin(){return e.plugin}})},$$slots:{default:!0}}),ue(c),ue(o),Ve(()=>ft(l,U(n)||"no image selected")),te(r,o),Ce({setValue:i})}var ch=class extends sr{filterValue(e){return pu(e)?e:void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return _b}rawMapValue(e){return e}rawReverseMapValue(e){return Eo(e)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>this.setInternalValue(e))}};var zW=ae('<a target="_blank" rel="noopener"> </a>'),HW=ae('<a target="_blank" rel="noopener"> </a>');function ks(r,e){De(e,!0);let t=Qt(()=>e.mdLink.block?`${e.mdLink.target}#${e.mdLink.block}`:e.mdLink.target),n=Qt(()=>e.mdLink.internal?"internal-link":"external-link");var i=Qr(),a=Ke(i);at(a,()=>e.mdLink.alias,o=>{var u=zW(),c=de(u,!0);ue(u),Ve(()=>{_t(u,"data-href",U(t)),_t(u,"href",U(t)),ao(u,U(n)),_t(u,"aria-label",U(t)),ft(c,e.mdLink.alias)}),te(o,u)},o=>{var u=HW(),c=de(u,!0);ue(u),Ve(()=>{_t(u,"data-href",U(t)),_t(u,"href",U(t)),ao(u,U(n)),ft(c,U(t))}),te(o,u)}),te(r,i),Ce()}var GW=ae("<!><span>,</span> <span></span>",1),WW=ae("<!> <!>",1);function Ap(r,e){De(e,!0);let t=bt(e,"elements",19,()=>[]);var n=WW(),i=Ke(n);Wt(i,17,()=>t().slice(0,t().length-1),Kt,(o,u)=>{var c=GW(),s=Ke(c);io(s,()=>e.children,()=>U(u)),Ut(3),te(o,c)});var a=ce(i,2);io(a,()=>e.children,()=>t()[t().length-1]),te(r,n),Ce()}var YW=ae('<span class="mb-whitespace-pre"> </span>'),jW=ae("<span> </span>"),ZW=ae("<span><!></span>"),JW=ae("<span><!></span>");function Da(r,e){De(e,!0);let t=bt(e,"value",3,void 0),n=Qt(()=>wF(t(),!1));var i=Qr(),a=Ke(i);at(a,()=>typeof U(n)=="string",o=>{var u=YW(),c=de(u,!0);ue(u),Ve(()=>ft(c,U(n))),te(o,u)},o=>{var u=Qr(),c=Ke(u);at(c,()=>Array.isArray(U(n)),s=>{var l=ZW(),f=de(l);Ap(f,{get elements(){return U(n)},children:(m,d=ja)=>{var h=Qr(),x=Ke(h);at(x,()=>typeof d()=="string",b=>{var T=jW(),v=de(T,!0);ue(T),Ve(()=>ft(v,d())),te(b,T)},b=>{ks(b,{get mdLink(){return d()}})}),te(m,h)},$$slots:{default:!0}}),ue(l),te(s,l)},s=>{var l=JW(),f=de(l);ks(f,{get mdLink(){return U(n)}}),ue(l),te(s,l)},!0),te(o,u)}),te(r,i),Ce()}function XW(r,e,t){r.key===" "&&t.showInput()}var QW=ae('<div class="mb-inline-list-item" role="listitem"><!></div>'),KW=(r,e,t)=>t.showInput(),eY=ae('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function Sb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(p){Oe(n,Ue(p))}function a(p){U(n).push(p),e.onValueChange(U(n))}function o(p){U(n).splice(p,1),e.onValueChange(U(n))}function u(p,m){let d=[];m>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=U(n)[m-1];U(n)[m-1]=U(n)[m],U(n)[m]=h,e.onValueChange(U(n))}}),m<U(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=U(n)[m+1];U(n)[m+1]=U(n)[m],U(n)[m]=h,e.onValueChange(U(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:Eo(U(n)[m]),multiline:!1,onSubmit:h=>{U(n)[m]=h,e.onValueChange(U(n))},onCancel:()=>{}})}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(m)}),e.plugin.internal.createContextMenu(d).showWithEvent(p)}var c=eY(),s=de(c);Wt(s,17,()=>U(n),Kt,(p,m,d)=>{var h=QW();h.__contextmenu=b=>u(b,d);var x=de(h);Da(x,{get value(){return U(m)}}),ue(h),te(p,h)});var l=ce(s,2);l.__click=[KW,t,e],l.__keydown=[XW,t,e];var f=ce(de(l),2);return Xr(f,{get plugin(){return e.plugin},iconName:"plus"}),ue(l),ue(c),te(r,c),Ce({setValue:i,pushValue:a})}Pt(["contextmenu","click","keydown"]);var fh=class extends sr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Sb}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 tY(r,e,t){if(!t.allowOther){t.showSuggester();return}t.plugin.internal.createContextMenu([{name:"From Options",onclick:()=>t.showSuggester()},{name:"From Text",onclick:()=>t.showTextPrompt()}]).showWithEvent(r)}function rY(r,e,t){r.key===" "&&t.showSuggester()}var nY=ae('<div class="mb-inline-list-item" role="listitem"><!></div>'),iY=ae('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function Ab(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(p){Oe(n,Ue(p))}function a(p){U(n).push(p),e.onValueChange(U(n))}function o(p){U(n).splice(p,1),e.onValueChange(U(n))}function u(p,m){let d=[];m>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=U(n)[m-1];U(n)[m-1]=U(n)[m],U(n)[m]=h,e.onValueChange(U(n))}}),m<U(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=U(n)[m+1];U(n)[m+1]=U(n)[m],U(n)[m]=h,e.onValueChange(U(n))}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(m)}),e.plugin.internal.createContextMenu(d).showWithEvent(p)}var c=iY(),s=de(c);Wt(s,17,()=>U(n),Kt,(p,m,d)=>{var h=nY();h.__contextmenu=b=>u(b,d);var x=de(h);Da(x,{get value(){return U(m)}}),ue(h),te(p,h)});var l=ce(s,2);l.__click=[tY,t,e],l.__keydown=[rY,t,e];var f=ce(de(l),2);return Xr(f,{get plugin(){return e.plugin},iconName:"plus"}),ue(l),ue(c),te(r,c),Ce({setValue:i,pushValue:a})}Pt(["contextmenu","click","keydown"]);var ph=class extends sr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Ab}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 aY=(r,e)=>e(),oY=ae("<option> </option>"),sY=ae('<select class="dropdown"></select>');function Eb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(u){Oe(n,Ue(u))}function a(){e.onValueChange(U(n))}var o=sY();return o.__change=[aY,a],Wt(o,21,()=>e.options,Kt,(u,c)=>{var s=oY(),l={},f=de(s,!0);ue(s),Ve(()=>{l!==(l=U(c).value)&&(s.value=(s.__value=U(c).value)==null?"":U(c).value),ft(f,U(c).name)}),te(u,s)}),ue(o),Uc(o,()=>U(n),u=>Oe(n,u)),te(r,o),Ce({setValue:i})}Pt(["change"]);var mh=class extends sr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return mu(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return Eb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var uY=ae('<div class="mb-list-item" role="listitem"><!></div>'),lY=ae('<span class="mb-list-empty">Empty</span>'),cY=ae('<textarea tabindex="0"></textarea>'),fY=(r,e,t)=>{r.key==="Enter"&&U(e).length>0&&t()},pY=ae('<input type="text" tabindex="0">'),mY=ae("<span> </span>"),dY=ae('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!> <!></div>',1);function Tb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value)),i=ht("");function a(b){Oe(n,Ue(b))}function o(){U(n).push(U(i)),e.onValueChange(U(n)),Oe(i,"")}function u(b){U(n).splice(b,1),e.onValueChange(U(n))}function c(b,T){let v=T.toString();return`${b.toString().padStart(v.length,"0")}/${v}`}function s(b,T){let v=[];T>0&&v.push({name:"Move up",icon:"arrow-up",onclick:()=>{let S=U(n)[T-1];U(n)[T-1]=U(n)[T],U(n)[T]=S,e.onValueChange(U(n))}}),T<U(n).length-1&&v.push({name:"Move down",icon:"arrow-down",onclick:()=>{let S=U(n)[T+1];U(n)[T+1]=U(n)[T],U(n)[T]=S,e.onValueChange(U(n))}}),v.push({name:"Edit",icon:"pencil",onclick:()=>{e.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:Eo(U(n)[T]),multiline:e.multiLine,onSubmit:S=>{U(n)[T]=S,e.onValueChange(U(n))},onCancel:()=>{}})}}),v.push({name:"Remove",icon:"x",warning:!0,onclick:()=>u(T)}),e.plugin.internal.createContextMenu(v).showWithEvent(b)}var l=dY(),f=Ke(l);Wt(f,21,()=>U(n),Kt,(b,T,v)=>{var S=uY();S.__contextmenu=y=>s(y,v);var _=de(S);Da(_,{get value(){return U(T)}}),ue(S),te(b,S)},b=>{var T=lY();te(b,T)}),ue(f);var p=ce(f,2),m=de(p);at(m,()=>e.multiLine,b=>{var T=cY();Fn(T),Ve(()=>{_t(T,"placeholder",e.placeholder),_t(T,"maxlength",e.limit)}),vt(T,()=>U(i),v=>Oe(i,v)),te(b,T)},b=>{var T=pY();St(T),T.__keyup=[fY,i,o],Ve(()=>{_t(T,"placeholder",e.placeholder),_t(T,"maxlength",e.limit)}),vt(T,()=>U(i),v=>Oe(i,v)),te(b,T)});var d=ce(m,2);at(d,()=>e.limit!==void 0,b=>{var T=mY(),v=de(T,!0);Ve(()=>ft(v,c(U(n).length,e.limit))),ue(T),Ve(()=>ao(T,`mb-content-limit-indicator ${U(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`)),te(b,T)});var h=ce(d,2),x=Qt(()=>!U(i));return It(h,{onclick:()=>o(),get disabled(){return U(x)},children:(b,T)=>{Xr(b,{get plugin(){return e.plugin},iconName:"plus"})},$$slots:{default:!0}}),ue(p),te(r,l),Ce({setValue:a})}Pt(["contextmenu","keyup"]);var dh=class extends sr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Tb}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 hY=ae('<div class="mb-list-item" role="listitem"><!></div>'),gY=ae('<span class="mb-list-empty">Empty</span>'),vY=ae('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!></div>',1);function Mb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(m){Oe(n,Ue(m))}function a(m){U(n).push(m),e.onValueChange(U(n))}function o(m){U(n).splice(m,1),e.onValueChange(U(n))}function u(m,d){let h=[];d>0&&h.push({name:"Move up",icon:"arrow-up",onclick:()=>{let x=U(n)[d-1];U(n)[d-1]=U(n)[d],U(n)[d]=x,e.onValueChange(U(n))}}),d<U(n).length-1&&h.push({name:"Move down",icon:"arrow-down",onclick:()=>{let x=U(n)[d+1];U(n)[d+1]=U(n)[d],U(n)[d]=x,e.onValueChange(U(n))}}),h.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(d)}),e.plugin.internal.createContextMenu(h).showWithEvent(m)}var c=vY(),s=Ke(c);Wt(s,21,()=>U(n),Kt,(m,d,h)=>{var x=hY();x.__contextmenu=T=>u(T,h);var b=de(x);Da(b,{get value(){return U(d)}}),ue(x),te(m,x)},m=>{var d=gY();te(m,d)}),ue(s);var l=ce(s,2),f=de(l);It(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(m,d)=>{Ut();var h=gr("Add new item");te(m,h)},$$slots:{default:!0}});var p=ce(f,2);return at(p,()=>e.allowOther,m=>{It(m,{get variant(){return"default"},onclick:()=>e.showTextPrompt(),children:(d,h)=>{Ut();var x=gr("Add other item");te(d,x)},$$slots:{default:!0}})}),ue(l),te(r,c),Ce({setValue:i,pushValue:a})}Pt(["contextmenu"]);var hh=class extends sr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Mb}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 yY=(r,e,t)=>{r.target instanceof HTMLInputElement||e(U(t).value)},xY=(r,e,t)=>e(U(t).value),bY=ae('<div class="mb-select-input-element mb-mod-multi" role="button" tabindex="0"><input type="checkbox"> <!></div>');function Db(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(s){Oe(n,Ue(s))}function a(s){U(n).includes(s)?Oe(n,Ue(U(n).filter(l=>l!==s))):U(n).push(s),e.onValueChange(U(n))}function o(s,l){s.key===" "&&a(l)}var u=Qr(),c=Ke(u);return Wt(c,17,()=>e.options,Kt,(s,l)=>{var f=bY();f.__click=[yY,a,l];let p=Qt(()=>U(n).includes(U(l).value));Ve(()=>Jr(f,"is-selected",U(p)));var m=de(f);St(m),Ve(()=>Bs(m,U(n).includes(U(l).value))),m.__input=[xY,a,l];var d=ce(m,2);Da(d,{get value(){return U(l).name}}),ue(f),ua("keypress",f,h=>o(h,U(l).value)),te(s,f)}),te(r,u),Ce({setValue:i})}Pt(["click","input"]);var gh=class extends sr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Ha(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Db}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var wY=(r,e,t,n)=>t.onValueChange(U(n)),_Y=ae('<input type="number" tabindex="0">');function Cb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(o){Oe(n,Ue(o))}var a=_Y();return St(a),a.__input=[wY,t,e,n],Ve(()=>_t(a,"placeholder",e.placeholder)),vt(a,()=>U(n),o=>Oe(n,o)),te(r,a),Ce({setValue:i})}Pt(["input"]);var vh=class extends sr{filterValue(e){return Mc(e)}getFallbackDefaultValue(){return 0}getSvelteComponent(){return Cb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Number"}}};function PI(r,e,t){e(),t(r)}var SY=ae('<div class="mb-progress-bar-input" tabindex="0" role="button"><div class="mb-progress-bar-progress" role="slider" tabindex="0"></div> <span class="mb-progress-bar-value"> </span> <span class="mb-progress-bar-label-left"> </span> <span class="mb-progress-bar-label-right"> </span></div>');function Nb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value)),i=!1,a,o=0,u;function c(D){Oe(n,Ue(D))}function s(D){Oe(n,Ue(D)),e.onValueChange(D)}function l(D){return D=qf(D,e.minValue,e.maxValue),zy(D,e.minValue,e.maxValue,0,100)}function f(){i=!0}function p(){i=!1}function m(D){if(!i)return;D.stopPropagation&&D.stopPropagation(),D.preventDefault&&D.preventDefault();let N=D instanceof TouchEvent?D.touches[0].clientX:D.clientX;d(N)}function d(D){let N=a.getBoundingClientRect();D=qf(D,N.left,N.right);let B=zy(D,N.left,N.right,e.minValue,e.maxValue);B=h(B,e.stepSize),s(B)}function h(D,N){return Number.parseFloat((Math.round(D/N)*N).toFixed(10))}function x(D){o<50&&(o+=1);let N=Math.ceil(o/5);if(D.key==="ArrowUp"||D.key==="ArrowRight"){let B=qf(U(n)+N,e.minValue,e.maxValue);s(B)}if(D.key==="ArrowDown"||D.key==="ArrowLeft"){let B=qf(U(n)-N,e.minValue,e.maxValue);s(B)}window.clearTimeout(u),u=window.setTimeout(()=>o=1,100)}var b=SY();ua("touchmove",Ps,m,void 0,!1),ua("touchcancel",Ps,p),ua("touchend",Ps,p),ua("mousemove",Ps,m),ua("mouseup",Ps,p),Co(b,D=>a=D,()=>a),b.__keydown=x,b.__mousedown=[PI,f,m],b.__touchstart=[PI,f,m];var T=de(b);let v=Qt(()=>`width: ${l(U(n))}%`);var S=ce(T,2),_=de(S,!0);ue(S);var y=ce(S,2),A=de(y,!0);ue(y);var M=ce(y,2),w=de(M,!0);return ue(M),ue(b),Ve(()=>{_t(T,"style",U(v)),_t(T,"aria-valuemin",e.minValue),_t(T,"aria-valuemax",e.maxValue),_t(T,"aria-valuenow",U(n)),ft(_,U(n)),ft(A,e.minValue),ft(w,e.maxValue)}),ua("dragstart",T,()=>i=!0),te(r,b),Ce({setValue:c})}Pt(["keydown","mousedown","touchstart"]);var yh=class extends sr{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 Vr({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Hm(Mc(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return Nb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize}}};var AY=(r,e,t)=>{r.target instanceof HTMLInputElement||e(U(t).value)},EY=(r,e,t)=>e(U(t).value),TY=ae('<div class="mb-select-input-element" role="button" tabindex="0"><input type="checkbox"> <!></div>');function Fb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(s){Oe(n,Ue(s))}function a(s){U(n)===s?Oe(n,null):Oe(n,Ue(s)),e.onValueChange(U(n))}function o(s,l){s.key===" "&&a(l)}var u=Qr(),c=Ke(u);return Wt(c,17,()=>e.options,Kt,(s,l)=>{var f=TY();f.__click=[AY,a,l];var p=de(f);St(p),p.__input=[EY,a,l];var m=ce(p,2);Da(m,{get value(){return U(l).name}}),ue(f),Ve(()=>{Jr(f,"is-selected",U(l).value===U(n)),Bs(p,U(l).value===U(n))}),ua("keypress",f,d=>o(d,U(l).value)),te(s,f)}),te(r,u),Ce({setValue:i})}Pt(["click","input"]);var xh=class extends sr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return mu(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return Fb}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var MY=ae('<span class="mb-slider-input-label"> </span>'),DY=(r,e,t,n)=>t.onValueChange(U(n)),CY=ae('<span class="mb-slider-input-label"> </span>'),NY=ae('<!> <input class="mb-slider-input slider" type="range" tabindex="0"> <!>',1);function Ib(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(s){Oe(n,Ue(s))}var a=NY(),o=Ke(a);at(o,()=>e.addLabels,s=>{var l=MY(),f=de(l,!0);ue(l),Ve(()=>ft(f,e.minValue)),te(s,l)});var u=ce(o,2);St(u),u.__input=[DY,t,e,n];var c=ce(u,2);return at(c,()=>e.addLabels,s=>{var l=CY(),f=de(l,!0);ue(l),Ve(()=>ft(f,e.maxValue)),te(s,l)}),Ve(()=>{_t(u,"min",e.minValue),_t(u,"max",e.maxValue),_t(u,"step",e.stepSize)}),vt(u,()=>U(n),s=>Oe(n,s)),te(r,a),Ce({setValue:i})}Pt(["input"]);var bh=class extends sr{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 Vr({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Hm(Mc(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return Ib}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 FY=ae("<span> </span>"),IY=ae('<div class="mb-suggest-input"><div class="mb-suggest-text"><!></div> <!> <!></div>');function Pb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(p){Oe(n,Ue(p))}let a=Qt(()=>U(n)?.toString()??"null"),o=Qt(()=>{if(xn.isLink(U(a)))try{return xn.parseLink(U(a))}catch(p){console.warn(p)}});var u=IY(),c=de(u),s=de(c);at(s,()=>U(o)!==void 0,p=>{ks(p,{get mdLink(){return U(o)}})},p=>{var m=FY(),d=de(m,!0);ue(m),Ve(()=>ft(d,U(a))),te(p,m)}),ue(c);var l=ce(c,2);It(l,{get variant(){return"plain"},get onclick(){return e.showSuggester},children:(p,m)=>{Xr(p,{get plugin(){return e.plugin},iconName:"list"})},$$slots:{default:!0}});var f=ce(l,2);return at(f,()=>e.allowOther,p=>{It(p,{get variant(){return"plain"},get onclick(){return e.showTextPrompt},children:(m,d)=>{Xr(m,{get plugin(){return e.plugin},iconName:"pencil"})},$$slots:{default:!0}})}),ue(u),te(r,u),Ce({setValue:i})}var wh=class extends sr{filterValue(e){return mu(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return Pb}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 PY=(r,e,t,n)=>t.onValueChange(U(n)),BY=ae("<span> </span>"),kY=ae('<input type="text" tabindex="0"> <!>',1);function Bb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(s){Oe(n,Ue(s))}function a(s,l){let f=l.toString();return`${s.toString().padStart(f.length,"0")}/${f}`}var o=kY(),u=Ke(o);St(u),u.__input=[PY,t,e,n];var c=ce(u,2);return at(c,()=>e.limit!==void 0,s=>{var l=BY(),f=de(l,!0);Ve(()=>ft(f,a(U(n).length,e.limit))),ue(l),Ve(()=>ao(l,`mb-content-limit-indicator ${U(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`)),te(s,l)}),Ve(()=>{_t(u,"placeholder",e.placeholder),_t(u,"maxlength",e.limit)}),vt(u,()=>U(n),s=>Oe(n,s)),te(r,o),Ce({setValue:i})}Pt(["input"]);var _h=class extends sr{filterValue(e){return Wo(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return Bb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var $Y=(r,e,t,n)=>t.onValueChange(U(n)),OY=ae('<textarea class="mb-input-textarea" tabindex="0"></textarea>');function kb(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(o){Oe(n,Ue(o))}var a=OY();return Fn(a),a.__input=[$Y,t,e,n],Ve(()=>{_t(a,"placeholder",e.placeholder),_t(a,"maxlength",e.limit)}),vt(a,()=>U(n),o=>Oe(n,o)),te(r,a),Ce({setValue:i})}Pt(["input"]);var Sh=class extends sr{filterValue(e){return Wo(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return kb}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var RY=(r,e,t,n)=>t.onValueChange(U(n)),LY=ae('<input type="time">');function $b(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(o){Oe(n,Ue(o))}var a=LY();return St(a),a.__input=[RY,t,e,n],vt(a,()=>U(n),o=>Oe(n,o)),te(r,a),Ce({setValue:i})}Pt(["input"]);var Ah=class extends sr{filterValue(e){return Wo(e)}getFallbackDefaultValue(){return"00:00"}getSvelteComponent(){return $b}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var VY=(r,e)=>e(),UY=(r,e)=>e(r),qY=ae('<div class="checkbox-container" role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function Ob(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]),n=ht(Ue(e.value));function i(s){Oe(n,Ue(s))}function a(){Oe(n,!U(n)),e.onValueChange(U(n))}function o(s){s.key===" "&&a()}var u=qY();u.__click=[VY,a],u.__keydown=[UY,o];var c=de(u);return St(c),ue(u),Ve(()=>{_t(u,"aria-checked",U(n)),Jr(u,"is-enabled",U(n)),Bs(c,U(n))}),te(r,u),Ce({setValue:i})}Pt(["click","keydown"]);var Eh=class extends sr{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?mu(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return Ob}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};var Yt=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){Gm(e)}};var Th=class{constructor(e){this.plugin=e}createInputField(e){let t=e.declaration.inputFieldType,n=e.renderChildType;if(t!=="invalid"&&this.checkRenderChildTypeAllowed(t,n),t==="toggle")return new Eh(e);if(t==="slider")return new bh(e);if(t==="text")return new _h(e);if(t==="textArea")return new Sh(e);if(t==="select")return new xh(e);if(t==="multiSelect")return new gh(e);if(t==="datePicker")return new oh(e);if(t==="number")return new vh(e);if(t==="suggester")return new wh(e);if(t==="editor")return new uh(e);if(t==="progressBar")return new yh(e);if(t==="inlineSelect")return new mh(e);if(t==="imageSuggester")return new ch(e);if(t==="list")return new dh(e);if(t==="listSuggester")return new hh(e);if(t==="date")return new ah(e);if(t==="time")return new Ah(e);if(t==="inlineListSuggester")return new ph(e);if(t==="inlineList")return new fh(e);if(t==="imageListSuggester")return new lh(e);if(t==="dateTime")return new sh(e);}checkRenderChildTypeAllowed(e,t){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let n=Om[e];if(t==="block"&&!n.allowInBlock)throw new xo({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[Yt.linkToInputField(e)]});if(t==="inline"&&!n.allowInline)throw new xo({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[Yt.linkToInputField(e)]})}};var zc=class extends $n{constructor(e,t,n,i,a){super(e,t,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Xt(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",t=this.hasArgument("showcase")||this.hasArgument("title");return this.renderChildType==="block"&&(e||t)}createContainer(e){if(this.shouldAddCardContainer()){let t=ct.createElement(e,"div");ct.addClass(t,"mb-card");let n=this.getArgument("title");return n&&ct.createElement(t,"h3",{text:n.value}),t}return e}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){let n=ct.createElement(e,"code",{class:"mb-none"}),i=ct.createElement(n,"a",{text:this.declarationString,class:"mb-no-link"});i.href=Yt.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),ct.empty(e),ct.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=this.createContainer(e);this.createErrorIndicator(t);let n=ct.createElement(t,"div",{class:"mb-input-wrapper"});this.inputField?.mount(n);let i=this.getArguments("class");for(let a of i)ct.addClasses(n,a.value);ct.addClass(n,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType==="block"?ct.addClass(e,"mb-input-block"):ct.addClass(e,"mb-input-inline"),this.addShowcase(t)}onUnmount(e){super.onUnmount(e),this.inputField?.destroy(),gi(e,"input field")}};var zY=ae("<div></div>");function wu(r,e){De(e,!0);let t;_p(()=>{e.mountable.mount(t)}),qc(()=>{e.mountable.unmount()});var n=zY();Co(n,i=>t=i,()=>t),te(r,n),Ce()}var HY=ae("<th> </th>"),GY=ae("<td><!></td>"),WY=ae('<td class="meta-bind-error">invalid data</td>'),YY=ae('<tr><!><td class="mb-html-table-button-cell"><!></td></tr>'),jY=ae('<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 Rb(r,e){De(e,!0);let t=bt(e,"tableHead",19,()=>[]),n=ht(Ue([]));function i(m){Oe(n,Ue(m))}var a=jY(),o=Ke(a),u=de(o),c=de(u),s=de(c),l=de(s);Wt(l,17,t,Kt,(m,d)=>{var h=HY(),x=de(h,!0);ue(h),Ve(()=>ft(x,U(d))),te(m,h)}),Ut(),ue(s),ue(c);var f=ce(c);Wt(f,21,()=>U(n),m=>m.index,(m,d)=>{var h=YY(),x=de(h);at(x,()=>U(d).isValid,v=>{var S=Qr(),_=Ke(S);Wt(_,17,()=>U(d).cells,Kt,(y,A)=>{var M=GY(),w=de(M);wu(w,{get mountable(){return U(A)}}),ue(M),te(y,M)}),te(v,S)},v=>{var S=WY();Ve(()=>_t(S,"colspan",t().length)),te(v,S)});var b=ce(x),T=de(b);It(T,{onclick:()=>e.table.removeColumn(U(d).index),children:(v,S)=>{Xr(v,{get plugin(){return e.table.plugin},iconName:"x"})},$$slots:{default:!0}}),ue(b),ue(h),te(m,h)}),ue(f),ue(u),ue(o);var p=ce(o,2);return It(p,{onclick:()=>e.table.addColumn(),children:(m,d)=>{Ut();var h=gr("Add Row");te(m,h)},$$slots:{default:!0}}),te(r,a),Ce({updateTable:i})}function Mh(r){return new lu(r.map(e=>bF.tryParse(e).success?new el("array",e):new el("object",e)))}var Dh=class extends $n{constructor(e,t,n,i,a,o){super(e,t,n),this.bindTarget=i,this.tableHead=a,this.columns=o,this.inputSignal=new Zr(void 0),this.outputSignal=new Zr(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?.update(e)}updateDisplayValue(e){e=e??[];let t=[];for(let n=0;n<e.length;n++)if(typeof e[n]=="object"){let i=new Sc({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(Mh([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"}));t.push({cells:a,index:n,value:e[n],isValid:!0})}else t.push({cells:[],index:n,value:e[n],isValid:!1});this.tableComponent?.updateTable(t)}createCell(e,t){return e.mount(t),()=>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=Cr(Rb,{target:e,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:t=>{this.value=t,this.updateDisplayValue(t)}}),this.registerSelfToMetadataManager()}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),this.tableComponent&&Fr(this.tableComponent),gi(e,"table")}};var Ch=class extends $n{constructor(e,t,n,i){super(e,t,n),this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new Xt(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,inputSignal:new Zr(void 0),uuid:qr(),contextName:e.name})}catch(e){this.errorCollection.add(e)}}buildContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.inputSignal||(e[t.contextName]=t.inputSignal.get()??"");return e}async evaluate(){return this.jsRenderer?.evaluate({bound:this.buildContext()})}registerSelfToMetadataManager(){let e=new Zr(void 0);this.metadataSubscription=this.plugin.metadataManager.subscribeComputed(this.getUuid(),e,this.declaration.writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),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),ct.addClass(e,"mb-view"),ct.empty(e),this.plugin.internal.isJsEngineAvailable()||this.errorCollection.add(new gs({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 gs({errorLevel:"CRITICAL",effect:"Can't evaluate expression.",cause:"JS evaluation is disabled in the plugin settings."})),this.createErrorIndicator(e),this.errorCollection.hasErrors())return;let t=document.createElement("div");ct.addClass(t,"mb-view-wrapper"),this.jsRenderer=this.plugin.internal.createJsRenderer(t,this.getFilePath(),this.declaration.code,this.declaration.hidden),this.registerSelfToMetadataManager(),e.appendChild(t)}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),gi(e,"js view field")}};var Xo=class extends xi{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.inputSignal=new Zr(void 0),this.variables=[],this.hidden=!1}async initialRender(e){ct.addClass(e,"mb-view-text"),this.hidden=this.mountable.getArgument("hidden")?.value??!1,this.hidden&&ct.addClass(e,"mb-view-hidden"),await this.onInitialRender(e),await this.rerender(e,"")}async rerender(e,t){if(!this.hidden){let n=Dd(t,this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)??"";ct.empty(e),await this.onRerender(e,n)}}onMount(e){this.buildVariables(),this.inputSignal.registerListener({callback:t=>void this.rerender(e,t)}),this.metadataSubscription=this.mountable.plugin.metadataManager.subscribeComputed(this.mountable.getUuid(),this.inputSignal,this.mountable.getDeclaration().writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.computeValue(),()=>this.mountable.unmount()),this.initialRender(e)}onUnmount(){this.inputSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe()}};var ZY=ae('<div class="mb-image-card"><img class="mb-image-card-image"></div>');function Lb(r,e){De(e,!0);var t=ZY(),n=de(t);Ve(()=>_t(n,"src",e.plugin.internal.imagePathToUri(e.image))),ue(t),Ve(()=>_t(n,"alt",e.image)),te(r,t),Ce()}var JY=ae('<div class="mb-image-card-grid"></div>');function Nh(r,e){let t=bt(e,"images",19,()=>[]);var n=JY();Wt(n,21,t,Kt,(i,a)=>{Lb(i,{get plugin(){return e.plugin},get image(){return U(a)}})}),ue(n),te(r,n)}var Fh=class extends Xo{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(n=>typeof n=="string"?n:!0);if(e.length!==1)throw new ru({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});let t=e[0];if(typeof t=="string")throw new ru({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});t.listenToChildren=!0,this.variables=[{bindTargetDeclaration:t,inputSignal:new Zr(void 0),uuid:qr(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new bo({errorLevel:"CRITICAL",effect:"failed to evaluate image view field",cause:"there should be exactly one variable"});let t=this.variables[0].inputSignal.get();return typeof t=="string"?xn.toLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>xn.toLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=Cr(Nh,{target:e,props:{images:[],plugin:this.mountable.plugin}})}async onRerender(e,t){let n=xn.parseLinkList(t);this.component&&Fr(this.component),this.component=Cr(Nh,{target:e,props:{images:n.map(i=>i.target),plugin:this.mountable.plugin}})}onUnmount(){super.onUnmount(),this.component&&Fr(this.component)}};var XY=ae("<span></span>");function Ih(r,e){De(e,!0);var t=Qr(),n=Ke(t);at(n,()=>e.mdLinkList.length===0,i=>{var a=XY();te(i,a)},i=>{var a=Qr(),o=Ke(a);at(o,()=>e.mdLinkList.length===1,u=>{ks(u,{get mdLink(){return e.mdLinkList[0]}})},u=>{Ap(u,{get elements(){return e.mdLinkList},children:(s,l=ja)=>{ks(s,{get mdLink(){return l()}})},$$slots:{default:!0}})},!0),te(i,a)}),te(r,t),Ce()}var Ph=class extends Xo{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(n=>typeof n=="string"?n:!0);if(e.length!==1)throw new ru({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});let t=e[0];if(typeof t=="string")throw new ru({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});t.listenToChildren=!0,this.variables=[{bindTargetDeclaration:t,inputSignal:new Zr(void 0),uuid:qr(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new bo({errorLevel:"CRITICAL",effect:"failed to evaluate link view field",cause:"there should be exactly one variable"});let t=this.variables[0].inputSignal.get();return typeof t=="string"?xn.toLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>xn.toLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=Cr(Ih,{target:e,props:{mdLinkList:[]}})}async onRerender(e,t){let n=xn.parseLinkList(t);this.component=Cr(Ih,{target:e,props:{mdLinkList:n}})}onUnmount(){super.onUnmount(),this.component&&Fr(this.component)}};function rn(){return rn=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},rn.apply(null,arguments)}var Vb={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function Kr(r,e){if(Ep(r,e))return r[e];throw typeof r[e]=="function"&&Bh(r,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function Qo(r,e,t){if(Ep(r,e))return r[e]=t,t;throw new Error('No access to property "'+e+'"')}function Ep(r,e){return!QY(r)&&!Array.isArray(r)?!1:it(KY,e)?!0:!(e in Object.prototype||e in Function.prototype)}function BI(r,e){if(!Bh(r,e))throw new Error('No access to method "'+e+'"');return r[e]}function Bh(r,e){return r==null||typeof r[e]!="function"||it(r,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(r)?!1:it(ej,e)?!0:!(e in Object.prototype||e in Function.prototype)}function QY(r){return typeof r=="object"&&r&&r.constructor===Object}var KY={length:!0,name:!0},ej={toString:!0,valueOf:!0,toLocaleString:!0};var _u=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 Kr(this.wrappedObject,e)}set(e,t){return Qo(this.wrappedObject,e,t),this}has(e){return Ep(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return kI(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){Ep(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}},Hc=class{constructor(e,t,n){this.a=e,this.b=t,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,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),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 kI(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,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 kI(r,e){return{next:()=>{var t=r.next();return t.done?t:{value:e(t.value),done:!1}}}}function Su(){return new Map}function $s(r){if(!r)return Su();if(kh(r))return r;if(Au(r))return new _u(r);throw new Error("createMap can create maps from objects or Maps")}function $I(r){if(r instanceof _u)return r.wrappedObject;var e={};for(var t of r.keys()){var n=r.get(t);Qo(e,t,n)}return e}function xt(r){return typeof r=="number"}function ut(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function OI(r){return typeof r=="bigint"}function Hi(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function Os(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function ci(r){return r&&r.constructor.prototype.isUnit===!0||!1}function dn(r){return typeof r=="string"}var dr=Array.isArray;function et(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function bn(r){return Array.isArray(r)||et(r)}function Tl(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function No(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Gc(r){return r&&r.constructor.prototype.isRange===!0||!1}function Eu(r){return r&&r.constructor.prototype.isIndex===!0||!1}function RI(r){return typeof r=="boolean"}function LI(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function $h(r){return r&&r.constructor.prototype.isHelp===!0||!1}function VI(r){return typeof r=="function"}function UI(r){return r instanceof Date}function qI(r){return r instanceof RegExp}function Au(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!Hi(r)&&!Os(r))}function kh(r){return r?r instanceof Map||r instanceof _u||typeof r.set=="function"&&typeof r.get=="function"&&typeof r.keys=="function"&&typeof r.has=="function":!1}function zI(r){return r===null}function HI(r){return r===void 0}function Ca(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function fi(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function GI(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function WI(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function YI(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function qt(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function Tp(r){return qt(r)||Wr(r)&&r.args.length===1&&qt(r.args[0])&&"-+~".includes(r.op)}function Ko(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function Gi(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function oo(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function tr(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function Tu(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function Wr(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function pi(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function jI(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function ZI(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function Ur(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function Oh(r){return r&&r.constructor.prototype.isChain===!0||!1}function ur(r){var e=typeof r;return e==="object"?r===null?"null":ut(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":e}function dt(r){var e=typeof r;if(e==="number"||e==="bigint"||e==="string"||e==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(t){return dt(t)});if(r instanceof Date)return new Date(r.valueOf());if(ut(r))return r;if(Au(r))return tj(r,dt);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function tj(r,e){var t={};for(var n in r)it(r,n)&&(t[n]=e(r[n]));return t}function Rh(r,e){for(var t in e)it(e,t)&&(r[t]=e[t]);return r}function la(r,e){var t,n,i;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(n=0,i=r.length;n<i;n++)if(!la(r[n],e[n]))return!1;return!0}else{if(typeof r=="function")return r===e;if(r instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in r)if(!(t in e)||!la(r[t],e[t]))return!1;for(t in e)if(!(t in r))return!1;return!0}else return r===e}}function JI(r,e,t){var n=!0,i;Object.defineProperty(r,e,{get:function(){return n&&(i=t(),n=!1),i},set:function(o){i=o,n=!1},configurable:!0,enumerable:!0})}function it(r,e){return r&&Object.hasOwnProperty.call(r,e)}function XI(r,e){for(var t={},n=0;n<e.length;n++){var i=e[n],a=r[i];a!==void 0&&(t[i]=a)}return t}var QI=["Matrix","Array"],KI=["number","BigNumber","Fraction"];var Be=function(e){if(e)throw new Error(`The global config is readonly. 
Please create a mathjs instance if you want to change the default configuration. 
Example:

  import { create, all } from 'mathjs';
  const mathjs = create(all);
  mathjs.config({ number: 'BigNumber' });
`);return Object.freeze(Vb)};rn(Be,Vb,{MATRIX_OPTIONS:QI,NUMBER_OPTIONS:KI});var Yb=Or(zb(),1);function C(r,e,t,n){function i(a){var o=XI(a,e.map(ij));return rj(r,e,a),t(o)}return i.isFactory=!0,i.fn=r,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function rj(r,e,t){var n=e.filter(a=>!nj(a)).every(a=>t[a]!==void 0);if(!n){var i=e.filter(a=>t[a]===void 0);throw new Error('Cannot create function "'.concat(r,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function nj(r){return r&&r[0]==="?"}function ij(r){return r&&r[0]==="?"?r.slice(1):r}function Je(r){return typeof r=="boolean"?!0:isFinite(r)?r===Math.round(r):!1}function aj(r){return/^-?\d+$/.test(r)}function Ai(r,e){return e.number==="bigint"&&!aj(r)?e.numberFallback:e.number}var so=Math.sign||function(r){return r>0?1:r<0?-1:0},r2=Math.log2||function(e){return Math.log(e)/Math.LN2},n2=Math.log10||function(e){return Math.log(e)/Math.LN10},Lh=Math.log1p||function(r){return Math.log(r+1)},i2=Math.cbrt||function(e){if(e===0)return e;var t=e<0,n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},a2=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Hb(r,e,t){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Je(t))throw new Error("size must be an integer");if(r>2**(t-1)-1||r<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!Je(r))throw new Error("Value must be an integer");r<0&&(r=r+2**t),a="i".concat(t)}var o="";return r<0&&(r=-r,o="-"),"".concat(o).concat(i).concat(r.toString(e)).concat(a)}function Fo(r,e){if(typeof e=="function")return e(r);if(r===1/0)return"Infinity";if(r===-1/0)return"-Infinity";if(isNaN(r))return"NaN";var{notation:t,precision:n,wordSize:i}=Gb(e);switch(t){case"fixed":return Wb(r,n);case"exponential":return o2(r,n);case"engineering":return oj(r,n);case"bin":return Hb(r,2,i);case"oct":return Hb(r,8,i);case"hex":return Hb(r,16,i);case"auto":return sj(r,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 "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Gb(r){var e="auto",t,n;if(r!==void 0)if(xt(r))t=r;else if(ut(r))t=r.toNumber();else if(Au(r))r.precision!==void 0&&(t=e2(r.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),r.wordSize!==void 0&&(n=e2(r.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),r.notation&&(e=r.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:n}}function Yc(r){var e=String(r).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+r);var t=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(u){return i-=u.length,""}).replace(/0*$/,"").split("").map(function(u){return parseInt(u)});return o.length===0&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function oj(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Yc(r),n=Vh(t,e),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(xt(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var u=Math.abs(i-o)-(a.length-1),c=0;c<u;c++)a.push(0);for(var s=Math.abs(i-o),l=1;s>0;)l++,s--;var f=a.slice(l).join(""),p=xt(e)&&f.length||f.match(/[1-9]/)?"."+f:"",m=a.slice(0,l).join("")+p+"e"+(i>=0?"+":"")+o.toString();return n.sign+m}function Wb(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Yc(r),n=typeof e=="number"?Vh(t,t.exponent+1+e):t,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(Wc(o-i.length))),a<0&&(i=Wc(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function o2(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=Yc(r),n=e?Vh(t,e):t,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(Wc(e-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function sj(r,e,t){if(isNaN(r)||!isFinite(r))return String(r);var n=t2(t?.lowerExp,-3),i=t2(t?.upperExp,5),a=Yc(r),o=e?Vh(a,e):a;if(o.exponent<n||o.exponent>=i)return o2(r,e);var u=o.coefficients,c=o.exponent;u.length<e&&(u=u.concat(Wc(e-u.length))),u=u.concat(Wc(c-u.length+1+(u.length<e?e-u.length:0))),u=Wc(-c).concat(u);var s=c>0?c:0;return s<u.length-1&&u.splice(s+1,0,"."),o.sign+u.join("")}function Vh(r,e){for(var t={sign:r.sign,coefficients:r.coefficients,exponent:r.exponent},n=t.coefficients;e<=0;)n.unshift(0),t.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var a=e-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),t.exponent++,a++),a--,n[a]++}}return t}function Wc(r){for(var e=[],t=0;t<r;t++)e.push(0);return e}function s2(r){return r.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var KSe=Number.EPSILON||2220446049250313e-31;function Yr(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(t<=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(r)||isNaN(e)?!1:!isFinite(r)||!isFinite(e)?r===e:r===e?!0:Math.abs(r-e)<=Math.max(t*Math.max(Math.abs(r),Math.abs(e)),n)}var u2=Math.acosh||function(r){return Math.log(Math.sqrt(r*r-1)+r)},l2=Math.asinh||function(r){return Math.log(Math.sqrt(r*r+1)+r)},c2=Math.atanh||function(r){return Math.log((1+r)/(1-r))/2},Uh=Math.cosh||function(r){return(Math.exp(r)+Math.exp(-r))/2},f2=Math.sinh||function(r){return(Math.exp(r)-Math.exp(-r))/2},qh=Math.tanh||function(r){var e=Math.exp(2*r);return(e-1)/(e+1)};function p2(r,e){var t=r>0?!0:r<0?!1:1/r===1/0,n=e>0?!0:e<0?!1:1/e===1/0;return t^n?-r:r}function e2(r,e){if(xt(r))return r;if(ut(r))return r.toNumber();e()}function t2(r,e){return xt(r)?r:ut(r)?r.toNumber():e}var m2=function(){return m2=Yb.default.create,Yb.default},uj=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],jb=C("typed",uj,function(e){var{BigNumber:t,Complex:n,DenseMatrix:i,Fraction:a}=e,o=m2();return o.clear(),o.addTypes([{name:"number",test:xt},{name:"Complex",test:Hi},{name:"BigNumber",test:ut},{name:"bigint",test:OI},{name:"Fraction",test:Os},{name:"Unit",test:ci},{name:"identifier",test:u=>dn&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\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-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(u)},{name:"string",test:dn},{name:"Chain",test:Oh},{name:"Array",test:dr},{name:"Matrix",test:et},{name:"DenseMatrix",test:Tl},{name:"SparseMatrix",test:No},{name:"Range",test:Gc},{name:"Index",test:Eu},{name:"boolean",test:RI},{name:"ResultSet",test:LI},{name:"Help",test:$h},{name:"function",test:VI},{name:"Date",test:UI},{name:"RegExp",test:qI},{name:"null",test:zI},{name:"undefined",test:HI},{name:"AccessorNode",test:Ca},{name:"ArrayNode",test:fi},{name:"AssignmentNode",test:GI},{name:"BlockNode",test:WI},{name:"ConditionalNode",test:YI},{name:"ConstantNode",test:qt},{name:"FunctionNode",test:Gi},{name:"FunctionAssignmentNode",test:Ko},{name:"IndexNode",test:oo},{name:"Node",test:tr},{name:"ObjectNode",test:Tu},{name:"OperatorNode",test:Wr},{name:"ParenthesisNode",test:pi},{name:"RangeNode",test:jI},{name:"RelationalNode",test:ZI},{name:"SymbolNode",test:Ur},{name:"Map",test:kh},{name:"Object",test:Au}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(c){if(t||zh(c),s2(c)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+c+"). Use function bignumber(x) to convert to BigNumber.");return new t(c)}},{from:"number",to:"Complex",convert:function(c){return n||Hh(c),new n(c,0)}},{from:"BigNumber",to:"Complex",convert:function(c){return n||Hh(c),new n(c.toNumber(),0)}},{from:"bigint",to:"number",convert:function(c){if(c>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+c+")");return Number(c)}},{from:"bigint",to:"BigNumber",convert:function(c){return t||zh(c),new t(c.toString())}},{from:"bigint",to:"Fraction",convert:function(c){return a||Gh(c),new a(c.toString())}},{from:"Fraction",to:"BigNumber",convert:function(c){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(c){return n||Hh(c),new n(c.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(c){a||Gh(c);var s=new a(c);if(s.valueOf()!==c)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+c+"). Use function fraction(x) to convert to Fraction.");return s}},{from:"string",to:"number",convert:function(c){var s=Number(c);if(isNaN(s))throw new Error('Cannot convert "'+c+'" to a number');return s}},{from:"string",to:"BigNumber",convert:function(c){t||zh(c);try{return new t(c)}catch{throw new Error('Cannot convert "'+c+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(c){try{return BigInt(c)}catch{throw new Error('Cannot convert "'+c+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(c){a||Gh(c);try{return new a(c)}catch{throw new Error('Cannot convert "'+c+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(c){n||Hh(c);try{return new n(c)}catch{throw new Error('Cannot convert "'+c+'" to Complex')}}},{from:"boolean",to:"number",convert:function(c){return+c}},{from:"boolean",to:"BigNumber",convert:function(c){return t||zh(c),new t(+c)}},{from:"boolean",to:"bigint",convert:function(c){return BigInt(+c)}},{from:"boolean",to:"Fraction",convert:function(c){return a||Gh(c),new a(+c)}},{from:"boolean",to:"string",convert:function(c){return String(c)}},{from:"Array",to:"Matrix",convert:function(c){return i||lj(),new i(c)}},{from:"Matrix",to:"Array",convert:function(c){return c.valueOf()}}]),o.onMismatch=(u,c,s)=>{var l=o.createError(u,c,s);if(["wrongType","mismatch"].includes(l.data.category)&&c.length===1&&bn(c[0])&&s.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw f.data=l.data,f}throw l},o.onMismatch=(u,c,s)=>{var l=o.createError(u,c,s);if(["wrongType","mismatch"].includes(l.data.category)&&c.length===1&&bn(c[0])&&s.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw f.data=l.data,f}throw l},o});function zh(r){throw new Error("Cannot convert value ".concat(r," into a BigNumber: no class 'BigNumber' provided"))}function Hh(r){throw new Error("Cannot convert value ".concat(r," into a Complex number: no class 'Complex' provided"))}function lj(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Gh(r){throw new Error("Cannot convert value ".concat(r," into a Fraction, no class 'Fraction' provided."))}var cj="ResultSet",fj=[],Zb=C(cj,fj,()=>{function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return r.prototype.type="ResultSet",r.prototype.isResultSet=!0,r.prototype.valueOf=function(){return this.entries},r.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},r.fromJSON=function(e){return new r(e.entries)},r},{isClass:!0});var jc=9e15,Nu=1e9,Jb="0123456789abcdef",Yh="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",jh="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Xb={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-jc,maxE:jc,crypto:!1},v2,Rs,rr=!0,Jh="[DecimalError] ",Cu=Jh+"Invalid argument: ",y2=Jh+"Precision limit exceeded",x2=Jh+"crypto unavailable",b2="[object Decimal]",Ei=Math.floor,Yn=Math.pow,pj=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,mj=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,dj=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,w2=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Po=1e7,Rt=7,hj=9007199254740991,gj=Yh.length-1,Qb=jh.length-1,Le={toStringTag:b2};Le.absoluteValue=Le.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),Nt(r)};Le.ceil=function(){return Nt(new this.constructor(this),this.e+1,2)};Le.clampedTo=Le.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Cu+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};Le.comparedTo=Le.cmp=function(r){var e,t,n,i,a=this,o=a.d,u=(r=new a.constructor(r)).d,c=a.s,s=r.s;if(!o||!u)return!c||!s?NaN:c!==s?c:o===u?0:!o^c<0?1:-1;if(!o[0]||!u[0])return o[0]?c:u[0]?-s:0;if(c!==s)return c;if(a.e!==r.e)return a.e>r.e^c<0?1:-1;for(n=o.length,i=u.length,e=0,t=n<i?n:i;e<t;++e)if(o[e]!==u[e])return o[e]>u[e]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1};Le.cosine=Le.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Rt,n.rounding=1,t=vj(n,T2(n,t)),n.precision=r,n.rounding=e,Nt(Rs==2||Rs==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Le.cubeRoot=Le.cbrt=function(){var r,e,t,n,i,a,o,u,c,s,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(rr=!1,a=l.s*Yn(l.s*l,1/3),!a||Math.abs(a)==1/0?(t=mi(l.d),r=l.e,(a=(r-t.length+1)%3)&&(t+=a==1||a==-2?"0":"00"),a=Yn(t,1/3),r=Ei((r+1)/3)-(r%3==(r<0?-1:2)),a==1/0?t="5e"+r:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new f(t),n.s=l.s):n=new f(a.toString()),o=(r=f.precision)+3;;)if(u=n,c=u.times(u).times(u),s=c.plus(l),n=en(s.plus(l).times(u),s.plus(c),o+2,1),mi(u.d).slice(0,o)===(t=mi(n.d)).slice(0,o))if(t=t.slice(o-3,o+1),t=="9999"||!i&&t=="4999"){if(!i&&(Nt(u,r+1,0),u.times(u).times(u).eq(l))){n=u;break}o+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Nt(n,r+1,1),e=!n.times(n).times(n).eq(l));break}return rr=!0,Nt(n,r,f.rounding,e)};Le.decimalPlaces=Le.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-Ei(this.e/Rt))*Rt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Le.dividedBy=Le.div=function(r){return en(this,new this.constructor(r))};Le.dividedToIntegerBy=Le.divToInt=function(r){var e=this,t=e.constructor;return Nt(en(e,new t(r),0,1,1),t.precision,t.rounding)};Le.equals=Le.eq=function(r){return this.cmp(r)===0};Le.floor=function(){return Nt(new this.constructor(this),this.e+1,3)};Le.greaterThan=Le.gt=function(r){return this.cmp(r)>0};Le.greaterThanOrEqualTo=Le.gte=function(r){var e=this.cmp(r);return e==1||e===0};Le.hyperbolicCosine=Le.cosh=function(){var r,e,t,n,i,a=this,o=a.constructor,u=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return u;t=o.precision,n=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(r=Math.ceil(i/3),e=(1/Qh(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),a=Zc(o,1,a.times(e),new o(1),!0);for(var c,s=r,l=new o(8);s--;)c=a.times(a),a=u.minus(c.times(l.minus(c.times(l))));return Nt(a,o.precision=t,o.rounding=n,!0)};Le.hyperbolicSine=Le.sinh=function(){var r,e,t,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,t=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=Zc(a,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/Qh(5,r)),i=Zc(a,2,i,i,!0);for(var o,u=new a(5),c=new a(16),s=new a(20);r--;)o=i.times(i),i=i.times(u.plus(o.times(c.times(o).plus(s))))}return a.precision=e,a.rounding=t,Nt(i,e,t,!0)};Le.hyperbolicTangent=Le.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,en(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Le.inverseCosine=Le.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,a=t.rounding;return n!==-1?n===0?e.isNeg()?Io(t,i,a):new t(0):new t(NaN):e.isZero()?Io(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=Io(t,i+4,a).times(.5),t.precision=i,t.rounding=a,r.minus(e))};Le.inverseHyperbolicCosine=Le.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,rr=!1,t=t.times(t).minus(1).sqrt().plus(t),rr=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Le.inverseHyperbolicSine=Le.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,rr=!1,t=t.times(t).plus(1).sqrt().plus(t),rr=!0,n.precision=r,n.rounding=e,t.ln())};Le.inverseHyperbolicTangent=Le.atanh=function(){var r,e,t,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=a.precision,e=a.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?Nt(new a(i),r,e,!0):(a.precision=t=n-i.e,i=en(i.plus(1),new a(1).minus(i),t+r,1),a.precision=r+4,a.rounding=1,i=i.ln(),a.precision=r,a.rounding=e,i.times(.5))):new a(NaN)};Le.inverseSine=Le.asin=function(){var r,e,t,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),t=a.precision,n=a.rounding,e!==-1?e===0?(r=Io(a,t+4,n).times(.5),r.s=i.s,r):new a(NaN):(a.precision=t+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=t,a.rounding=n,i.times(2)))};Le.inverseTangent=Le.atan=function(){var r,e,t,n,i,a,o,u,c,s=this,l=s.constructor,f=l.precision,p=l.rounding;if(s.isFinite()){if(s.isZero())return new l(s);if(s.abs().eq(1)&&f+4<=Qb)return o=Io(l,f+4,p).times(.25),o.s=s.s,o}else{if(!s.s)return new l(NaN);if(f+4<=Qb)return o=Io(l,f+4,p).times(.5),o.s=s.s,o}for(l.precision=u=f+10,l.rounding=1,t=Math.min(28,u/Rt+2|0),r=t;r;--r)s=s.div(s.times(s).plus(1).sqrt().plus(1));for(rr=!1,e=Math.ceil(u/Rt),n=1,c=s.times(s),o=new l(s),i=s;r!==-1;)if(i=i.times(c),a=o.minus(i.div(n+=2)),i=i.times(c),o=a.plus(i.div(n+=2)),o.d[e]!==void 0)for(r=e;o.d[r]===a.d[r]&&r--;);return t&&(o=o.times(2<<t-1)),rr=!0,Nt(o,l.precision=f,l.rounding=p,!0)};Le.isFinite=function(){return!!this.d};Le.isInteger=Le.isInt=function(){return!!this.d&&Ei(this.e/Rt)>this.d.length-2};Le.isNaN=function(){return!this.s};Le.isNegative=Le.isNeg=function(){return this.s<0};Le.isPositive=Le.isPos=function(){return this.s>0};Le.isZero=function(){return!!this.d&&this.d[0]===0};Le.lessThan=Le.lt=function(r){return this.cmp(r)<0};Le.lessThanOrEqualTo=Le.lte=function(r){return this.cmp(r)<1};Le.logarithm=Le.log=function(r){var e,t,n,i,a,o,u,c,s=this,l=s.constructor,f=l.precision,p=l.rounding,m=5;if(r==null)r=new l(10),e=!0;else{if(r=new l(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new l(NaN);e=r.eq(10)}if(t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new l(t&&!t[0]?-1/0:s.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)a=!0;else{for(i=t[0];i%10===0;)i/=10;a=i!==1}if(rr=!1,u=f+m,o=Du(s,u),n=e?Zh(l,u+10):Du(r,u),c=en(o,n,u,1),Mp(c.d,i=f,p))do if(u+=10,o=Du(s,u),n=e?Zh(l,u+10):Du(r,u),c=en(o,n,u,1),!a){+mi(c.d).slice(i+1,i+15)+1==1e14&&(c=Nt(c,f+1,0));break}while(Mp(c.d,i+=10,p));return rr=!0,Nt(c,f,p)};Le.minus=Le.sub=function(r){var e,t,n,i,a,o,u,c,s,l,f,p,m=this,d=m.constructor;if(r=new d(r),!m.d||!r.d)return!m.s||!r.s?r=new d(NaN):m.d?r.s=-r.s:r=new d(r.d||m.s!==r.s?m:NaN),r;if(m.s!=r.s)return r.s=-r.s,m.plus(r);if(s=m.d,p=r.d,u=d.precision,c=d.rounding,!s[0]||!p[0]){if(p[0])r.s=-r.s;else if(s[0])r=new d(m);else return new d(c===3?-0:0);return rr?Nt(r,u,c):r}if(t=Ei(r.e/Rt),l=Ei(m.e/Rt),s=s.slice(),a=l-t,a){for(f=a<0,f?(e=s,a=-a,o=p.length):(e=p,t=l,o=s.length),n=Math.max(Math.ceil(u/Rt),o)+2,a>n&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for(n=s.length,o=p.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(s[n]!=p[n]){f=s[n]<p[n];break}a=0}for(f&&(e=s,s=p,p=e,r.s=-r.s),o=s.length,n=p.length-o;n>0;--n)s[o++]=0;for(n=p.length;n>a;){if(s[--n]<p[n]){for(i=n;i&&s[--i]===0;)s[i]=Po-1;--s[i],s[n]+=Po}s[n]-=p[n]}for(;s[--o]===0;)s.pop();for(;s[0]===0;s.shift())--t;return s[0]?(r.d=s,r.e=Xh(s,t),rr?Nt(r,u,c):r):new d(c===3?-0:0)};Le.modulo=Le.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?Nt(new n(t),n.precision,n.rounding):(rr=!1,n.modulo==9?(e=en(t,r.abs(),0,3,1),e.s*=r.s):e=en(t,r,0,n.modulo,1),e=e.times(r),rr=!0,t.minus(e))};Le.naturalExponential=Le.exp=function(){return Kb(this)};Le.naturalLogarithm=Le.ln=function(){return Du(this)};Le.negated=Le.neg=function(){var r=new this.constructor(this);return r.s=-r.s,Nt(r)};Le.plus=Le.add=function(r){var e,t,n,i,a,o,u,c,s,l,f=this,p=f.constructor;if(r=new p(r),!f.d||!r.d)return!f.s||!r.s?r=new p(NaN):f.d||(r=new p(r.d||f.s===r.s?f:NaN)),r;if(f.s!=r.s)return r.s=-r.s,f.minus(r);if(s=f.d,l=r.d,u=p.precision,c=p.rounding,!s[0]||!l[0])return l[0]||(r=new p(f)),rr?Nt(r,u,c):r;if(a=Ei(f.e/Rt),n=Ei(r.e/Rt),s=s.slice(),i=a-n,i){for(i<0?(t=s,i=-i,o=l.length):(t=l,n=a,o=s.length),a=Math.ceil(u/Rt),o=a>o?a+1:o+1,i>o&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(o=s.length,i=l.length,o-i<0&&(i=o,t=l,l=s,s=t),e=0;i;)e=(s[--i]=s[i]+l[i]+e)/Po|0,s[i]%=Po;for(e&&(s.unshift(e),++n),o=s.length;s[--o]==0;)s.pop();return r.d=s,r.e=Xh(s,n),rr?Nt(r,u,c):r};Le.precision=Le.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Cu+r);return t.d?(e=_2(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Le.round=function(){var r=this,e=r.constructor;return Nt(new e(r),r.e+1,e.rounding)};Le.sine=Le.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+Rt,n.rounding=1,t=xj(n,T2(n,t)),n.precision=r,n.rounding=e,Nt(Rs>2?t.neg():t,r,e,!0)):new n(NaN)};Le.squareRoot=Le.sqrt=function(){var r,e,t,n,i,a,o=this,u=o.d,c=o.e,s=o.s,l=o.constructor;if(s!==1||!u||!u[0])return new l(!s||s<0&&(!u||u[0])?NaN:u?o:1/0);for(rr=!1,s=Math.sqrt(+o),s==0||s==1/0?(e=mi(u),(e.length+c)%2==0&&(e+="0"),s=Math.sqrt(e),c=Ei((c+1)/2)-(c<0||c%2),s==1/0?e="5e"+c:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new l(e)):n=new l(s.toString()),t=(c=l.precision)+3;;)if(a=n,n=a.plus(en(o,a,t+2,1)).times(.5),mi(a.d).slice(0,t)===(e=mi(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(Nt(a,c+1,0),a.times(a).eq(o))){n=a;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Nt(n,c+1,1),r=!n.times(n).eq(o));break}return rr=!0,Nt(n,c,l.rounding,r)};Le.tangent=Le.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=en(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,Nt(Rs==2||Rs==4?t.neg():t,r,e,!0)):new n(NaN)};Le.times=Le.mul=function(r){var e,t,n,i,a,o,u,c,s,l=this,f=l.constructor,p=l.d,m=(r=new f(r)).d;if(r.s*=l.s,!p||!p[0]||!m||!m[0])return new f(!r.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?r.s/0:r.s*0);for(t=Ei(l.e/Rt)+Ei(r.e/Rt),c=p.length,s=m.length,c<s&&(a=p,p=m,m=a,o=c,c=s,s=o),a=[],o=c+s,n=o;n--;)a.push(0);for(n=s;--n>=0;){for(e=0,i=c+n;i>n;)u=a[i]+m[n]*p[i-n-1]+e,a[i--]=u%Po|0,e=u/Po|0;a[i]=(a[i]+e)%Po|0}for(;!a[--o];)a.pop();return e?++t:a.shift(),r.d=a,r.e=Xh(a,t),rr?Nt(r,f.precision,f.rounding):r};Le.toBinary=function(r,e){return t0(this,2,r,e)};Le.toDecimalPlaces=Le.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(ca(r,0,Nu),e===void 0?e=n.rounding:ca(e,0,8),Nt(t,r+t.e+1,e))};Le.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=es(n,!0):(ca(r,0,Nu),e===void 0?e=i.rounding:ca(e,0,8),n=Nt(new i(n),r+1,e),t=es(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Le.toFixed=function(r,e){var t,n,i=this,a=i.constructor;return r===void 0?t=es(i):(ca(r,0,Nu),e===void 0?e=a.rounding:ca(e,0,8),n=Nt(new a(i),r+i.e+1,e),t=es(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};Le.toFraction=function(r){var e,t,n,i,a,o,u,c,s,l,f,p,m=this,d=m.d,h=m.constructor;if(!d)return new h(m);if(s=t=new h(1),n=c=new h(0),e=new h(n),a=e.e=_2(d)-m.e-1,o=a%Rt,e.d[0]=Yn(10,o<0?Rt+o:o),r==null)r=a>0?e:s;else{if(u=new h(r),!u.isInt()||u.lt(s))throw Error(Cu+u);r=u.gt(e)?a>0?e:s:u}for(rr=!1,u=new h(mi(d)),l=h.precision,h.precision=a=d.length*Rt*2;f=en(u,e,0,1,1),i=t.plus(f.times(n)),i.cmp(r)!=1;)t=n,n=i,i=s,s=c.plus(f.times(i)),c=i,i=e,e=u.minus(f.times(i)),u=i;return i=en(r.minus(t),n,0,1,1),c=c.plus(i.times(s)),t=t.plus(i.times(n)),c.s=s.s=m.s,p=en(s,n,a,1).minus(m).abs().cmp(en(c,t,a,1).minus(m).abs())<1?[s,n]:[c,t],h.precision=l,rr=!0,p};Le.toHexadecimal=Le.toHex=function(r,e){return t0(this,16,r,e)};Le.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:ca(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(rr=!1,t=en(t,r,0,e,1).times(r),rr=!0,Nt(t)):(r.s=t.s,t=r),t};Le.toNumber=function(){return+this};Le.toOctal=function(r,e){return t0(this,8,r,e)};Le.toPower=Le.pow=function(r){var e,t,n,i,a,o,u=this,c=u.constructor,s=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(Yn(+u,s));if(u=new c(u),u.eq(1))return u;if(n=c.precision,a=c.rounding,r.eq(1))return Nt(u,n,a);if(e=Ei(r.e/Rt),e>=r.d.length-1&&(t=s<0?-s:s)<=hj)return i=S2(c,u,t,n),r.s<0?new c(1).div(i):Nt(i,n,a);if(o=u.s,o<0){if(e<r.d.length-1)return new c(NaN);if(r.d[e]&1||(o=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=o,u}return t=Yn(+u,s),e=t==0||!isFinite(t)?Ei(s*(Math.log("0."+mi(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?o/0:0):(rr=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),i=Kb(r.times(Du(u,n+t)),n),i.d&&(i=Nt(i,n+5,1),Mp(i.d,n,a)&&(e=n+10,i=Nt(Kb(r.times(Du(u,e+t)),e),e+5,1),+mi(i.d).slice(n+1,n+15)+1==1e14&&(i=Nt(i,n+1,0)))),i.s=o,rr=!0,c.rounding=a,Nt(i,n,a))};Le.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=es(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(ca(r,1,Nu),e===void 0?e=i.rounding:ca(e,0,8),n=Nt(new i(n),r,e),t=es(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Le.toSignificantDigits=Le.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(ca(r,1,Nu),e===void 0?e=n.rounding:ca(e,0,8)),Nt(new n(t),r,e)};Le.toString=function(){var r=this,e=r.constructor,t=es(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Le.truncated=Le.trunc=function(){return Nt(new this.constructor(this),this.e+1,1)};Le.valueOf=Le.toJSON=function(){var r=this,e=r.constructor,t=es(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function mi(r){var e,t,n,i=r.length-1,a="",o=r[0];if(i>0){for(a+=o,e=1;e<i;e++)n=r[e]+"",t=Rt-n.length,t&&(a+=Mu(t)),a+=n;o=r[e],n=o+"",t=Rt-n.length,t&&(a+=Mu(t))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function ca(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Cu+r)}function Mp(r,e,t,n){var i,a,o,u;for(a=r[0];a>=10;a/=10)--e;return--e<0?(e+=Rt,i=0):(i=Math.ceil((e+1)/Rt),e%=Rt),a=Yn(10,Rt-e),u=r[i]%a|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),o=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):o=(t<4&&u+1==a||t>3&&u+1==a/2)&&(r[i+1]/a/100|0)==Yn(10,e-2)-1||(u==a/2||u==0)&&(r[i+1]/a/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),o=(n||t<4)&&u==9999||!n&&t>3&&u==4999):o=((n||t<4)&&u+1==a||!n&&t>3&&u+1==a/2)&&(r[i+1]/a/1e3|0)==Yn(10,e-3)-1,o}function Wh(r,e,t){for(var n,i=[0],a,o=0,u=r.length;o<u;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=Jb.indexOf(r.charAt(o++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function vj(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/Qh(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=Zc(r,1,e.times(i),new r(1));for(var a=t;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return r.precision-=t,e}var en=function(){function r(n,i,a){var o,u=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+u,n[c]=o%a|0,u=o/a|0;return u&&n.unshift(u),n}function e(n,i,a,o){var u,c;if(a!=o)c=a>o?1:-1;else for(u=c=0;u<a;u++)if(n[u]!=i[u]){c=n[u]>i[u]?1:-1;break}return c}function t(n,i,a,o){for(var u=0;a--;)n[a]-=u,u=n[a]<i[a]?1:0,n[a]=u*o+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o,u,c){var s,l,f,p,m,d,h,x,b,T,v,S,_,y,A,M,w,D,N,B,R=n.constructor,z=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?z*0:z/0);for(c?(m=1,l=n.e-i.e):(c=Po,m=Rt,l=Ei(n.e/m)-Ei(i.e/m)),N=k.length,w=V.length,b=new R(z),T=b.d=[],f=0;k[f]==(V[f]||0);f++);if(k[f]>(V[f]||0)&&l--,a==null?(y=a=R.precision,o=R.rounding):u?y=a+(n.e-i.e)+1:y=a,y<0)T.push(1),d=!0;else{if(y=y/m+2|0,f=0,N==1){for(p=0,k=k[0],y++;(f<w||p)&&y--;f++)A=p*c+(V[f]||0),T[f]=A/k|0,p=A%k|0;d=p||f<w}else{for(p=c/(k[0]+1)|0,p>1&&(k=r(k,p,c),V=r(V,p,c),N=k.length,w=V.length),M=N,v=V.slice(0,N),S=v.length;S<N;)v[S++]=0;B=k.slice(),B.unshift(0),D=k[0],k[1]>=c/2&&++D;do p=0,s=e(k,v,N,S),s<0?(_=v[0],N!=S&&(_=_*c+(v[1]||0)),p=_/D|0,p>1?(p>=c&&(p=c-1),h=r(k,p,c),x=h.length,S=v.length,s=e(h,v,x,S),s==1&&(p--,t(h,N<x?B:k,x,c))):(p==0&&(s=p=1),h=k.slice()),x=h.length,x<S&&h.unshift(0),t(v,h,S,c),s==-1&&(S=v.length,s=e(k,v,N,S),s<1&&(p++,t(v,N<S?B:k,S,c))),S=v.length):s===0&&(p++,v=[0]),T[f++]=p,s&&v[0]?v[S++]=V[M]||0:(v=[V[M]],S=1);while((M++<w||v[0]!==void 0)&&y--);d=v[0]!==void 0}T[0]||T.shift()}if(m==1)b.e=l,v2=d;else{for(f=1,p=T[0];p>=10;p/=10)f++;b.e=f+l*m-1,Nt(b,u?a+b.e+1:a,o,d)}return b}}();function Nt(r,e,t,n){var i,a,o,u,c,s,l,f,p,m=r.constructor;e:if(e!=null){if(f=r.d,!f)return r;for(i=1,u=f[0];u>=10;u/=10)i++;if(a=e-i,a<0)a+=Rt,o=e,l=f[p=0],c=l/Yn(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/Rt),u=f.length,p>=u)if(n){for(;u++<=p;)f.push(0);l=c=0,i=1,a%=Rt,o=a-Rt+1}else break e;else{for(l=u=f[p],i=1;u>=10;u/=10)i++;a%=Rt,o=a-Rt+i,c=o<0?0:l/Yn(10,i-o-1)%10|0}if(n=n||e<0||f[p+1]!==void 0||(o<0?l:l%Yn(10,i-o-1)),s=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(a>0?o>0?l/Yn(10,i-o):0:f[p-1])%10&1||t==(r.s<0?8:7)),e<1||!f[0])return f.length=0,s?(e-=r.e+1,f[0]=Yn(10,(Rt-e%Rt)%Rt),r.e=-e||0):f[0]=r.e=0,r;if(a==0?(f.length=p,u=1,p--):(f.length=p+1,u=Yn(10,Rt-a),f[p]=o>0?(l/Yn(10,i-o)%Yn(10,o)|0)*u:0),s)for(;;)if(p==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=u,u=1;o>=10;o/=10)u++;a!=u&&(r.e++,f[0]==Po&&(f[0]=1));break}else{if(f[p]+=u,f[p]!=Po)break;f[p--]=0,u=1}for(a=f.length;f[--a]===0;)f.pop()}return rr&&(r.e>m.maxE?(r.d=null,r.e=NaN):r.e<m.minE&&(r.e=0,r.d=[0])),r}function es(r,e,t){if(!r.isFinite())return E2(r);var n,i=r.e,a=mi(r.d),o=a.length;return e?(t&&(n=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+Mu(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(r.e<0?"e":"e+")+r.e):i<0?(a="0."+Mu(-i-1)+a,t&&(n=t-o)>0&&(a+=Mu(n))):i>=o?(a+=Mu(i+1-o),t&&(n=t-i-1)>0&&(a=a+"."+Mu(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),t&&(n=t-o)>0&&(i+1===o&&(a+="."),a+=Mu(n))),a}function Xh(r,e){var t=r[0];for(e*=Rt;t>=10;t/=10)e++;return e}function Zh(r,e,t){if(e>gj)throw rr=!0,t&&(r.precision=t),Error(y2);return Nt(new r(Yh),e,1,!0)}function Io(r,e,t){if(e>Qb)throw Error(y2);return Nt(new r(jh),e,t,!0)}function _2(r){var e=r.length-1,t=e*Rt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function Mu(r){for(var e="";r--;)e+="0";return e}function S2(r,e,t,n){var i,a=new r(1),o=Math.ceil(n/Rt+4);for(rr=!1;;){if(t%2&&(a=a.times(e),h2(a.d,o)&&(i=!0)),t=Ei(t/2),t===0){t=a.d.length-1,i&&a.d[t]===0&&++a.d[t];break}e=e.times(e),h2(e.d,o)}return rr=!0,a}function d2(r){return r.d[r.d.length-1]&1}function A2(r,e,t){for(var n,i=new r(e[0]),a=0;++a<e.length;)if(n=new r(e[a]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function Kb(r,e){var t,n,i,a,o,u,c,s=0,l=0,f=0,p=r.constructor,m=p.rounding,d=p.precision;if(!r.d||!r.d[0]||r.e>17)return new p(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(rr=!1,c=d):c=e,u=new p(.03125);r.e>-2;)r=r.times(u),f+=5;for(n=Math.log(Yn(2,f))/Math.LN10*2+5|0,c+=n,t=a=o=new p(1),p.precision=c;;){if(a=Nt(a.times(r),c,1),t=t.times(++l),u=o.plus(en(a,t,c,1)),mi(u.d).slice(0,c)===mi(o.d).slice(0,c)){for(i=f;i--;)o=Nt(o.times(o),c,1);if(e==null)if(s<3&&Mp(o.d,c-n,m,s))p.precision=c+=10,t=a=u=new p(1),l=0,s++;else return Nt(o,p.precision=d,m,rr=!0);else return p.precision=d,o}o=u}}function Du(r,e){var t,n,i,a,o,u,c,s,l,f,p,m=1,d=10,h=r,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?(rr=!1,l=v):l=e,b.precision=l+=d,t=mi(x),n=t.charAt(0),Math.abs(a=h.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)h=h.times(r),t=mi(h.d),n=t.charAt(0),m++;a=h.e,n>1?(h=new b("0."+t),a++):h=new b(n+"."+t.slice(1))}else return s=Zh(b,l+2,v).times(a+""),h=Du(new b(n+"."+t.slice(1)),l-d).plus(s),b.precision=v,e==null?Nt(h,v,T,rr=!0):h;for(f=h,c=o=h=en(h.minus(1),h.plus(1),l,1),p=Nt(h.times(h),l,1),i=3;;){if(o=Nt(o.times(p),l,1),s=c.plus(en(o,new b(i),l,1)),mi(s.d).slice(0,l)===mi(c.d).slice(0,l))if(c=c.times(2),a!==0&&(c=c.plus(Zh(b,l+2,v).times(a+""))),c=en(c,new b(m),l,1),e==null)if(Mp(c.d,l-d,T,u))b.precision=l+=d,s=o=h=en(f.minus(1),f.plus(1),l,1),p=Nt(h.times(h),l,1),i=u=1;else return Nt(c,b.precision=v,T,rr=!0);else return b.precision=v,c;c=s,i+=2}}function E2(r){return String(r.s*r.s/0)}function e0(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%Rt,t<0&&(n+=Rt),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=Rt;n<i;)r.d.push(+e.slice(n,n+=Rt));e=e.slice(n),n=Rt-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),rr&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function yj(r,e){var t,n,i,a,o,u,c,s,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),w2.test(e))return e0(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(mj.test(e))t=16,e=e.toLowerCase();else if(pj.test(e))t=2;else if(dj.test(e))t=8;else throw Error(Cu+e);for(a=e.search(/p/i),a>0?(c=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,n=r.constructor,o&&(e=e.replace(".",""),u=e.length,a=u-a,i=S2(n,new n(t),a,a*2)),s=Wh(e,t,Po),l=s.length-1,a=l;s[a]===0;--a)s.pop();return a<0?new n(r.s*0):(r.e=Xh(s,l),r.d=s,rr=!1,o&&(r=en(r,i,u*4)),c&&(r=r.times(Math.abs(c)<54?Yn(2,c):Dp.pow(2,c))),rr=!0,r)}function xj(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Zc(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Qh(5,t)),e=Zc(r,2,e,e);for(var i,a=new r(5),o=new r(16),u=new r(20);t--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(u))));return e}function Zc(r,e,t,n,i){var a,o,u,c,s=1,l=r.precision,f=Math.ceil(l/Rt);for(rr=!1,c=t.times(t),u=new r(n);;){if(o=en(u.times(c),new r(e++*e++),l,1),u=i?n.plus(o):n.minus(o),n=en(o.times(c),new r(e++*e++),l,1),o=u.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===u.d[a]&&a--;);if(a==-1)break}a=u,u=n,n=o,o=a,s++}return rr=!0,o.d.length=f+1,o}function Qh(r,e){for(var t=r;--e;)t*=r;return t}function T2(r,e){var t,n=e.s<0,i=Io(r,r.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return Rs=n?4:1,e;if(t=e.divToInt(i),t.isZero())Rs=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(a))return Rs=d2(t)?n?2:3:n?4:1,e;Rs=d2(t)?n?1:4:n?3:2}return e.minus(i).abs()}function t0(r,e,t,n){var i,a,o,u,c,s,l,f,p,m=r.constructor,d=t!==void 0;if(d?(ca(t,1,Nu),n===void 0?n=m.rounding:ca(n,0,8)):(t=m.precision,n=m.rounding),!r.isFinite())l=E2(r);else{for(l=es(r),o=l.indexOf("."),d?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,o>=0&&(l=l.replace(".",""),p=new m(1),p.e=l.length-o,p.d=Wh(es(p),10,i),p.e=p.d.length),f=Wh(l,10,i),a=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=d?"0p+0":"0";else{if(o<0?a--:(r=new m(r),r.d=f,r.e=a,r=en(r,p,t,n,0,i),f=r.d,a=r.e,s=v2),o=f[t],u=i/2,s=s||f[t+1]!==void 0,s=n<4?(o!==void 0||s)&&(n===0||n===(r.s<0?3:2)):o>u||o===u&&(n===4||s||n===6&&f[t-1]&1||n===(r.s<0?8:7)),f.length=t,s)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=Jb.charAt(f[o]);if(d){if(c>1)if(e==16||e==8){for(o=e==16?4:3,--c;c%o;c++)l+="0";for(f=Wh(l,i,e),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Jb.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)l="0"+l;l="0."+l}else if(++a>c)for(a-=c;a--;)l+="0";else a<c&&(l=l.slice(0,a)+"."+l.slice(a))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return r.s<0?"-"+l:l}function h2(r,e){if(r.length>e)return r.length=e,!0}function bj(r){return new this(r).abs()}function wj(r){return new this(r).acos()}function _j(r){return new this(r).acosh()}function Sj(r,e){return new this(r).plus(e)}function Aj(r){return new this(r).asin()}function Ej(r){return new this(r).asinh()}function Tj(r){return new this(r).atan()}function Mj(r){return new this(r).atanh()}function Dj(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,a=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Io(this,a,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Io(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Io(this,a,1).times(.5),t.s=r.s):e.s<0?(this.precision=a,this.rounding=1,t=this.atan(en(r,e,a,1)),e=Io(this,a,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(en(r,e,a,1)),t}function Cj(r){return new this(r).cbrt()}function Nj(r){return Nt(r=new this(r),r.e+1,2)}function Fj(r,e,t){return new this(r).clamp(e,t)}function Ij(r){if(!r||typeof r!="object")throw Error(Jh+"Object expected");var e,t,n,i=r.defaults===!0,a=["precision",1,Nu,"rounding",0,8,"toExpNeg",-jc,0,"toExpPos",0,jc,"maxE",0,jc,"minE",-jc,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(t=a[e],i&&(this[t]=Xb[t]),(n=r[t])!==void 0)if(Ei(n)===n&&n>=a[e+1]&&n<=a[e+2])this[t]=n;else throw Error(Cu+t+": "+n);if(t="crypto",i&&(this[t]=Xb[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(x2);else this[t]=!1;else throw Error(Cu+t+": "+n);return this}function Pj(r){return new this(r).cos()}function Bj(r){return new this(r).cosh()}function M2(r){var e,t,n;function i(a){var o,u,c,s=this;if(!(s instanceof i))return new i(a);if(s.constructor=i,g2(a)){s.s=a.s,rr?!a.d||a.e>i.maxE?(s.e=NaN,s.d=null):a.e<i.minE?(s.e=0,s.d=[0]):(s.e=a.e,s.d=a.d.slice()):(s.e=a.e,s.d=a.d?a.d.slice():a.d);return}if(c=typeof a,c==="number"){if(a===0){s.s=1/a<0?-1:1,s.e=0,s.d=[0];return}if(a<0?(a=-a,s.s=-1):s.s=1,a===~~a&&a<1e7){for(o=0,u=a;u>=10;u/=10)o++;rr?o>i.maxE?(s.e=NaN,s.d=null):o<i.minE?(s.e=0,s.d=[0]):(s.e=o,s.d=[a]):(s.e=o,s.d=[a]);return}else if(a*0!==0){a||(s.s=NaN),s.e=NaN,s.d=null;return}return e0(s,a.toString())}else if(c!=="string")throw Error(Cu+a);return(u=a.charCodeAt(0))===45?(a=a.slice(1),s.s=-1):(u===43&&(a=a.slice(1)),s.s=1),w2.test(a)?e0(s,a):yj(s,a)}if(i.prototype=Le,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=Ij,i.clone=M2,i.isDecimal=g2,i.abs=bj,i.acos=wj,i.acosh=_j,i.add=Sj,i.asin=Aj,i.asinh=Ej,i.atan=Tj,i.atanh=Mj,i.atan2=Dj,i.cbrt=Cj,i.ceil=Nj,i.clamp=Fj,i.cos=Pj,i.cosh=Bj,i.div=kj,i.exp=$j,i.floor=Oj,i.hypot=Rj,i.ln=Lj,i.log=Vj,i.log10=qj,i.log2=Uj,i.max=zj,i.min=Hj,i.mod=Gj,i.mul=Wj,i.pow=Yj,i.random=jj,i.round=Zj,i.sign=Jj,i.sin=Xj,i.sinh=Qj,i.sqrt=Kj,i.sub=eZ,i.sum=tZ,i.tan=rZ,i.tanh=nZ,i.trunc=iZ,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function kj(r,e){return new this(r).div(e)}function $j(r){return new this(r).exp()}function Oj(r){return Nt(r=new this(r),r.e+1,3)}function Rj(){var r,e,t=new this(0);for(rr=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return rr=!0,new this(1/0);t=e}return rr=!0,t.sqrt()}function g2(r){return r instanceof Dp||r&&r.toStringTag===b2||!1}function Lj(r){return new this(r).ln()}function Vj(r,e){return new this(r).log(e)}function Uj(r){return new this(r).log(2)}function qj(r){return new this(r).log(10)}function zj(){return A2(this,arguments,"lt")}function Hj(){return A2(this,arguments,"gt")}function Gj(r,e){return new this(r).mod(e)}function Wj(r,e){return new this(r).mul(e)}function Yj(r,e){return new this(r).pow(e)}function jj(r){var e,t,n,i,a=0,o=new this(1),u=[];if(r===void 0?r=this.precision:ca(r,1,Nu),n=Math.ceil(r/Rt),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]:u[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):(u.push(i%1e7),a+=4);a=n/4}else throw Error(x2);else for(;a<n;)u[a++]=Math.random()*1e7|0;for(n=u[--a],r%=Rt,n&&r&&(i=Yn(10,Rt-r),u[a]=(n/i|0)*i);u[a]===0;a--)u.pop();if(a<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Rt)u.shift();for(n=1,i=u[0];i>=10;i/=10)n++;n<Rt&&(t-=Rt-n)}return o.e=t,o.d=u,o}function Zj(r){return Nt(r=new this(r),r.e+1,this.rounding)}function Jj(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function Xj(r){return new this(r).sin()}function Qj(r){return new this(r).sinh()}function Kj(r){return new this(r).sqrt()}function eZ(r,e){return new this(r).sub(e)}function tZ(){var r=0,e=arguments,t=new this(e[r]);for(rr=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return rr=!0,Nt(t,this.precision,this.rounding)}function rZ(r){return new this(r).tan()}function nZ(r){return new this(r).tanh()}function iZ(r){return Nt(r=new this(r),r.e+1,1)}Le[Symbol.for("nodejs.util.inspect.custom")]=Le.toString;Le[Symbol.toStringTag]="Decimal";var Dp=Le.constructor=M2(Xb);Yh=new Dp(Yh);jh=new Dp(jh);var Ml=Dp;var aZ="BigNumber",oZ=["?on","config"],r0=C(aZ,oZ,r=>{var{on:e,config:t}=r,n=Ml.clone({precision:t.precision,modulo:Ml.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 ti=Or(C2(),1);var sZ="Complex",uZ=[],i0=C(sZ,uZ,()=>(Object.defineProperty(ti.default,"name",{value:"Complex"}),ti.default.prototype.constructor=ti.default,ti.default.prototype.type="Complex",ti.default.prototype.isComplex=!0,ti.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},ti.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},ti.default.prototype.format=function(r){var e="",t=this.im,n=this.re,i=Fo(this.re,r),a=Fo(this.im,r),o=xt(r)?r:r?r.precision:null;if(o!==null){var u=Math.pow(10,-o);Math.abs(n/t)<u&&(n=0),Math.abs(t/n)<u&&(t=0)}return t===0?e=i:n===0?t===1?e="i":t===-1?e="-i":e=a+"i":t<0?t===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":t===1?e=i+" + i":e=i+" + "+a+"i",e},ti.default.fromPolar=function(r){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,ti.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],n=arguments[1];if(xt(t)){if(ci(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),xt(n))return new ti.default({r:t,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},ti.default.prototype.valueOf=ti.default.prototype.toString,ti.default.fromJSON=function(r){return new ti.default(r)},ti.default.compare=function(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0},ti.default),{isClass:!0});var lZ=2e3,At={s:1,n:0,d:1};function Ls(r,e){if(isNaN(r=parseInt(r,10)))throw Kh();return r*e}function wn(r,e){if(e===0)throw a0();var t=Object.create(ri.prototype);t.s=r<0?-1:1,r=r<0?-r:r;var n=Jc(r,e);return t.n=r/n,t.d=e/n,t}function N2(r){for(var e={},t=r,n=2,i=4;i<=t;){for(;t%n===0;)t/=n,e[n]=(e[n]||0)+1;i+=1+2*n++}return t!==r?t>1&&(e[t]=(e[t]||0)+1):e[r]=(e[r]||0)+1,e}var Na=function(r,e){var t=0,n=1,i=1,a=0,o=0,u=0,c=1,s=1,l=0,f=1,p=1,m=1,d=1e7,h;if(r!=null)if(e!==void 0){if(t=r,n=e,i=t*n,t%1!==0||n%1!==0)throw mZ()}else switch(typeof r){case"object":{if("d"in r&&"n"in r)t=r.n,n=r.d,"s"in r&&(t*=r.s);else if(0 in r)t=r[0],1 in r&&(n=r[1]);else throw Kh();i=t*n;break}case"number":{if(r<0&&(i=r,r=-r),r%1===0)t=r;else if(r>0){for(r>=1&&(s=Math.pow(10,Math.floor(1+Math.log(r)/Math.LN10)),r/=s);f<=d&&m<=d;)if(h=(l+p)/(f+m),r===h){f+m<=d?(t=l+p,n=f+m):m>f?(t=p,n=m):(t=l,n=f);break}else r>h?(l+=p,f+=m):(p+=l,m+=f),f>d?(t=p,n=m):(t=l,n=f);t*=s}else(isNaN(r)||isNaN(e))&&(n=t=NaN);break}case"string":{if(f=r.match(/\d+|./g),f===null)throw Kh();if(f[l]==="-"?(i=-1,l++):f[l]==="+"&&l++,f.length===l+1?o=Ls(f[l++],i):f[l+1]==="."||f[l]==="."?(f[l]!=="."&&(a=Ls(f[l++],i)),l++,(l+1===f.length||f[l+1]==="("&&f[l+3]===")"||f[l+1]==="'"&&f[l+3]==="'")&&(o=Ls(f[l],i),c=Math.pow(10,f[l].length),l++),(f[l]==="("&&f[l+2]===")"||f[l]==="'"&&f[l+2]==="'")&&(u=Ls(f[l+1],i),s=Math.pow(10,f[l+1].length)-1,l+=3)):f[l+1]==="/"||f[l+1]===":"?(o=Ls(f[l],i),c=Ls(f[l+2],1),l+=3):f[l+3]==="/"&&f[l+1]===" "&&(a=Ls(f[l],i),o=Ls(f[l+2],i),c=Ls(f[l+4],1),l+=5),f.length<=l){n=c*s,i=t=u+n*a+s*o;break}}default:throw Kh()}if(n===0)throw a0();At.s=i<0?-1:1,At.n=Math.abs(t),At.d=Math.abs(n)};function cZ(r,e,t){for(var n=1;e>0;r=r*r%t,e>>=1)e&1&&(n=n*r%t);return n}function fZ(r,e){for(;e%2===0;e/=2);for(;e%5===0;e/=5);if(e===1)return 0;for(var t=10%e,n=1;t!==1;n++)if(t=t*10%e,n>lZ)return 0;return n}function pZ(r,e,t){for(var n=1,i=cZ(10,t,e),a=0;a<300;a++){if(n===i)return a;n=n*10%e,i=i*10%e}return 0}function Jc(r,e){if(!r)return e;if(!e)return r;for(;;){if(r%=e,!r)return e;if(e%=r,!e)return r}}function ri(r,e){if(Na(r,e),this instanceof ri)r=Jc(At.d,At.n),this.s=At.s,this.n=At.n/r,this.d=At.d/r;else return wn(At.s*At.n,At.d)}var a0=function(){return new Error("Division by Zero")},Kh=function(){return new Error("Invalid argument")},mZ=function(){return new Error("Parameters must be integer")};ri.prototype={s:1,n:0,d:1,abs:function(){return wn(this.n,this.d)},neg:function(){return wn(-this.s*this.n,this.d)},add:function(r,e){return Na(r,e),wn(this.s*this.n*At.d+At.s*this.d*At.n,this.d*At.d)},sub:function(r,e){return Na(r,e),wn(this.s*this.n*At.d-At.s*this.d*At.n,this.d*At.d)},mul:function(r,e){return Na(r,e),wn(this.s*At.s*this.n*At.n,this.d*At.d)},div:function(r,e){return Na(r,e),wn(this.s*At.s*this.n*At.d,this.d*At.n)},clone:function(){return wn(this.s*this.n,this.d)},mod:function(r,e){if(isNaN(this.n)||isNaN(this.d))return new ri(NaN);if(r===void 0)return wn(this.s*this.n%this.d,1);if(Na(r,e),At.n===0&&this.d===0)throw a0();return wn(this.s*(At.d*this.n)%(At.n*this.d),At.d*this.d)},gcd:function(r,e){return Na(r,e),wn(Jc(At.n,this.n)*Jc(At.d,this.d),At.d*this.d)},lcm:function(r,e){return Na(r,e),At.n===0&&this.n===0?wn(0,1):wn(At.n*this.n,Jc(At.n,this.n)*Jc(At.d,this.d))},ceil:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new ri(NaN):wn(Math.ceil(r*this.s*this.n/this.d),r)},floor:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new ri(NaN):wn(Math.floor(r*this.s*this.n/this.d),r)},round:function(r){return r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d)?new ri(NaN):wn(Math.round(r*this.s*this.n/this.d),r)},roundTo:function(r,e){return Na(r,e),wn(this.s*Math.round(this.n*At.d/(this.d*At.n))*At.n,At.d)},inverse:function(){return wn(this.s*this.d,this.n)},pow:function(r,e){if(Na(r,e),At.d===1)return At.s<0?wn(Math.pow(this.s*this.d,At.n),Math.pow(this.n,At.n)):wn(Math.pow(this.s*this.n,At.n),Math.pow(this.d,At.n));if(this.s<0)return null;var t=N2(this.n),n=N2(this.d),i=1,a=1;for(var o in t)if(o!=="1"){if(o==="0"){i=0;break}if(t[o]*=At.n,t[o]%At.d===0)t[o]/=At.d;else return null;i*=Math.pow(o,t[o])}for(var o in n)if(o!=="1"){if(n[o]*=At.n,n[o]%At.d===0)n[o]/=At.d;else return null;a*=Math.pow(o,n[o])}return At.s<0?wn(a,i):wn(i,a)},equals:function(r,e){return Na(r,e),this.s*this.n*At.d===At.s*At.n*this.d},compare:function(r,e){Na(r,e);var t=this.s*this.n*At.d-At.s*At.n*this.d;return(0<t)-(t<0)},simplify:function(r){if(isNaN(this.n)||isNaN(this.d))return this;r=r||.001;for(var e=this.abs(),t=e.toContinued(),n=1;n<t.length;n++){for(var i=wn(t[n-1],1),a=n-2;a>=0;a--)i=i.inverse().add(t[a]);if(Math.abs(i.sub(e).valueOf())<r)return i.mul(this.s)}return this},divisible:function(r,e){return Na(r,e),!(!(At.n*this.d)||this.n*At.d%(At.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),i===1?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,t+=" ",n%=i),t+=n,t+="/",t+=i),t},toLatex:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),i===1?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,n%=i),t+="\\frac{",t+=n,t+="}{",t+=i,t+="}"),t},toContinued:function(){var r,e=this.n,t=this.d,n=[];if(isNaN(e)||isNaN(t))return n;do n.push(Math.floor(e/t)),r=e%t,e=t,t=r;while(e!==1);return n},toString:function(r){var e=this.n,t=this.d;if(isNaN(e)||isNaN(t))return"NaN";r=r||15;var n=fZ(e,t),i=pZ(e,t,n),a=this.s<0?"-":"";if(a+=e/t|0,e%=t,e*=10,e&&(a+="."),n){for(var o=i;o--;)a+=e/t|0,e%=t,e*=10;a+="(";for(var o=n;o--;)a+=e/t|0,e%=t,e*=10;a+=")"}else for(var o=r;e&&o--;)a+=e/t|0,e%=t,e*=10;return a}};var dZ="Fraction",hZ=[],o0=C(dZ,hZ,()=>(Object.defineProperty(ri,"name",{value:"Fraction"}),ri.prototype.constructor=ri,ri.prototype.type="Fraction",ri.prototype.isFraction=!0,ri.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},ri.fromJSON=function(r){return new ri(r)},ri),{isClass:!0});var gZ="Range",vZ=[],s0=C(gZ,vZ,()=>{function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=t!=null,o=n!=null;if(i){if(ut(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(ut(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(o){if(ut(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(t):0,this.step=o?parseFloat(n):1}return r.prototype.type="Range",r.prototype.isRange=!0,r.parse=function(e){if(typeof e!="string")return null;var t=e.split(":"),n=t.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new r(n[0],n[1]);case 3:return new r(n[0],n[2],n[1]);default:return null}},r.prototype.clone=function(){return new r(this.start,this.end,this.step)},r.prototype.size=function(){var e=0,t=this.start,n=this.step,i=this.end,a=i-t;return so(n)===so(a)?e=Math.ceil(a/n):a===0&&(e=0),isNaN(e)&&(e=0),[e]},r.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},r.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},r.prototype.forEach=function(e){var t=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;t<i;)e(t,[a],this),t+=n,a++;else if(n<0)for(;t>i;)e(t,[a],this),t+=n,a++},r.prototype.map=function(e){var t=[];return this.forEach(function(n,i,a){t[i[0]]=e(n,i,a)}),t},r.prototype.toArray=function(){var e=[];return this.forEach(function(t,n){e[n[0]]=t}),e},r.prototype.valueOf=function(){return this.toArray()},r.prototype.format=function(e){var t=Fo(this.start,e);return this.step!==1&&(t+=":"+Fo(this.step,e)),t+=":"+Fo(this.end,e),t},r.prototype.toString=function(){return this.format()},r.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},r.fromJSON=function(e){return new r(e.start,e.end,e.step)},r},{isClass:!0});var yZ="Matrix",xZ=[],u0=C(yZ,xZ,()=>{function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator")}return r.prototype.type="Matrix",r.prototype.isMatrix=!0,r.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},r.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},r.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},r.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},r.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},r.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},r.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},r.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},r.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},r.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},r.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},r.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},r.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},r.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},r.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},r.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},r.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},r},{isClass:!0});function l0(r,e,t){var n=r.constructor,i=new n(2),a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Je(t))throw new Error("size must be an integer");if(r.greaterThan(i.pow(t-1).sub(1))||r.lessThan(i.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!r.isInteger())throw new Error("Value must be an integer");r.lessThan(0)&&(r=r.add(i.pow(t))),a="i".concat(t)}switch(e){case 2:return"".concat(r.toBinary()).concat(a);case 8:return"".concat(r.toOctal()).concat(a);case 16:return"".concat(r.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function P2(r,e){if(typeof e=="function")return e(r);if(!r.isFinite())return r.isNaN()?"NaN":r.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:i}=Gb(e);switch(t){case"fixed":return wZ(r,n);case"exponential":return F2(r,n);case"engineering":return bZ(r,n);case"bin":return l0(r,2,i);case"oct":return l0(r,8,i);case"hex":return l0(r,16,i);case"auto":{var a=I2(e?.lowerExp,-3),o=I2(e?.upperExp,5);if(r.isZero())return"0";var u,c=r.toSignificantDigits(n),s=c.e;return s>=a&&s<o?u=c.toFixed():u=F2(r,n),u.replace(/((\.\d*?)(0+))($|e)/,function(){var l=arguments[2],f=arguments[4];return l!=="."?l+f:f})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function bZ(r,e){var t=r.e,n=t%3===0?t:t<0?t-3-t%3:t-t%3,i=r.mul(Math.pow(10,-n)),a=i.toPrecision(e);if(a.includes("e")){var o=r.constructor;a=new o(a).toFixed()}return a+"e"+(t>=0?"+":"")+n.toString()}function F2(r,e){return e!==void 0?r.toExponential(e-1):r.toExponential()}function wZ(r,e){return r.toFixed(e)}function I2(r,e){return xt(r)?r:ut(r)?r.toNumber():e}function k2(r,e){var t=r.length-e.length,n=r.length;return r.substring(t,n)===e}function Et(r,e){var t=_Z(r,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function _Z(r,e){if(typeof r=="number")return Fo(r,e);if(ut(r))return P2(r,e);if(SZ(r))return!e||e.fraction!=="decimal"?r.s*r.n+"/"+r.d:r.toString();if(Array.isArray(r))return $2(r,e);if(dn(r))return Dl(r);if(typeof r=="function")return r.syntax?String(r.syntax):"function";if(r&&typeof r=="object"){if(typeof r.format=="function")return r.format(e);if(r&&r.toString(e)!=={}.toString())return r.toString(e);var t=Object.keys(r).map(n=>Dl(n)+": "+Et(r[n],e));return"{"+t.join(", ")+"}"}return String(r)}function Dl(r){for(var e=String(r),t="",n=0;n<e.length;){var i=e.charAt(n);t+=i in B2?B2[i]:i,n++}return'"'+t+'"'}var B2={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t"};function jn(r){var e=String(r);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function $2(r,e){if(Array.isArray(r)){for(var t="[",n=r.length,i=0;i<n;i++)i!==0&&(t+=", "),t+=$2(r[i],e);return t+="]",t}else return Et(r,e)}function SZ(r){return r&&typeof r=="object"&&typeof r.s=="number"&&typeof r.n=="number"&&typeof r.d=="number"||!1}function eg(r,e){if(!dn(r))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+ur(r)+", index: 0)");if(!dn(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+ur(e)+", index: 1)");return r===e?0:r>e?1:-1}function Mt(r,e,t){if(!(this instanceof Mt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=r,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(r)?"["+r.join(", ")+"]":r)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Mt.prototype=new RangeError;Mt.prototype.constructor=RangeError;Mt.prototype.name="DimensionError";Mt.prototype.isDimensionError=!0;function di(r,e,t){if(!(this instanceof di))throw new SyntaxError("Constructor must be called with the new operator");this.index=r,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}di.prototype=new RangeError;di.prototype.constructor=RangeError;di.prototype.name="IndexError";di.prototype.isIndexError=!0;function lt(r){for(var e=[];Array.isArray(r);)e.push(r.length),r=r[0];return e}function O2(r,e,t){var n,i=r.length;if(i!==e[t])throw new Mt(i,e[t]);if(t<e.length-1){var a=t+1;for(n=0;n<i;n++){var o=r[n];if(!Array.isArray(o))throw new Mt(e.length-1,e.length,"<");O2(r[n],e,a)}}else for(n=0;n<i;n++)if(Array.isArray(r[n]))throw new Mt(e.length+1,e.length,">")}function f0(r,e){var t=e.length===0;if(t){if(Array.isArray(r))throw new Mt(r.length,0)}else O2(r,e,0)}function Cp(r,e){var t=r.isMatrix?r._size:lt(r),n=e._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==t[a])throw new Mt(i,t[a])})}function Ir(r,e){if(r!==void 0){if(!xt(r)||!Je(r))throw new TypeError("Index must be an integer (value: "+r+")");if(r<0||typeof e=="number"&&r>=e)throw new di(r,e)}}function Cl(r){for(var e=0;e<r._dimensions.length;++e){var t=r._dimensions[e];if(t._data&&dr(t._data)){if(t._size[0]===0)return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(dn(t)&&t.length===0)return!0}return!1}function Bo(r,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(i){if(!xt(i)||!Je(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Et(e)+")")}),(xt(r)||ut(r))&&(r=[r]);var n=t!==void 0?t:0;return c0(r,e,0,n),r}function c0(r,e,t,n){var i,a,o=r.length,u=e[t],c=Math.min(o,u);if(r.length=u,t<e.length-1){var s=t+1;for(i=0;i<c;i++)a=r[i],Array.isArray(a)||(a=[a],r[i]=a),c0(a,e,s,n);for(i=c;i<u;i++)a=[],r[i]=a,c0(a,e,s,n)}else{for(i=0;i<c;i++)for(;Array.isArray(r[i]);)r[i]=r[i][0];for(i=c;i<u;i++)r[i]=n}}function Np(r,e){var t=kt(r),n=t.length;if(!Array.isArray(r)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Mt(0,n,"!=");e=Fp(e,n);var i=R2(e);if(n!==i)throw new Mt(i,n,"!=");try{return AZ(t,e)}catch(a){throw a instanceof Mt?new Mt(i,n,"!="):a}}function Fp(r,e){var t=R2(r),n=r.slice(),i=-1,a=r.indexOf(i),o=r.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var u=a>=0,c=e%t===0;if(u)if(c)n[a]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return n}function R2(r){return r.reduce((e,t)=>e*t,1)}function AZ(r,e){for(var t=r,n,i=e.length-1;i>0;i--){var a=e[i];n=[];for(var o=t.length/a,u=0;u<o;u++)n.push(t.slice(u*a,(u+1)*a));t=n}return t}function Xc(r,e){for(var t=e||lt(r);Array.isArray(r)&&r.length===1;)r=r[0],t.shift();for(var n=t.length;t[n-1]===1;)n--;return n<t.length&&(r=L2(r,n,0),t.length=n),r}function L2(r,e,t){var n,i;if(t<e){var a=t+1;for(n=0,i=r.length;n<i;n++)r[n]=L2(r[n],e,a)}else for(;Array.isArray(r);)r=r[0];return r}function tg(r,e,t,n){var i=n||lt(r);if(t)for(var a=0;a<t;a++)r=[r],i.unshift(1);for(r=V2(r,e,0);i.length<e;)i.push(1);return r}function V2(r,e,t){var n,i;if(Array.isArray(r)){var a=t+1;for(n=0,i=r.length;n<i;n++)r[n]=V2(r[n],e,a)}else for(var o=t;o<e;o++)r=[r];return r}function kt(r){if(!Array.isArray(r))return r;var e=[];return r.forEach(function t(n){Array.isArray(n)?n.forEach(t):e.push(n)}),e}function uo(r,e){return Array.prototype.map.call(r,e)}function rg(r,e){Array.prototype.forEach.call(r,e)}function U2(r,e){if(lt(r).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,e)}function p0(r,e){if(lt(r).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,t=>e.test(t))}function m0(r,e){return Array.prototype.join.call(r,e)}function Vs(r){if(!Array.isArray(r))throw new TypeError("Array input expected");if(r.length===0)return r;var e=[],t=0;e[0]={value:r[0],identifier:0};for(var n=1;n<r.length;n++)r[n]===r[n-1]?t++:t=0,e.push({value:r[n],identifier:t});return e}function Qc(r){if(!Array.isArray(r))throw new TypeError("Array input expected");if(r.length===0)return r;for(var e=[],t=0;t<r.length;t++)e.push(r[t].value);return e}function Nl(r,e){for(var t,n=0,i=0;i<r.length;i++){var a=r[i],o=Array.isArray(a);if(i===0&&o&&(n=a.length),o&&a.length!==n)return;var u=o?Nl(a,e):e(a);if(t===void 0)t=u;else if(t!==u)return"mixed"}return t}function q2(r,e,t,n){if(n<t){if(r.length!==e.length)throw new Mt(r.length,e.length);for(var i=[],a=0;a<r.length;a++)i[a]=q2(r[a],e[a],t,n+1);return i}else return r.concat(e)}function d0(){var r=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(r.length===1)return r[0];if(r.length>1)return r.slice(1).reduce(function(t,n){return q2(t,n,e,0)},r[0]);throw new Error("Wrong number of arguments in function concat")}function Ip(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var n=e.map(p=>p.length),i=Math.max(...n),a=new Array(i).fill(null),o=0;o<e.length;o++)for(var u=e[o],c=n[o],s=0;s<c;s++){var l=i-c+s;u[s]>a[l]&&(a[l]=u[s])}for(var f=0;f<e.length;f++)z2(e[f],a);return a}function z2(r,e){for(var t=e.length,n=r.length,i=0;i<n;i++){var a=t-n+i;if(r[i]<e[a]&&r[i]>1||r[i]>e[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(r,") not possible to broadcast dimension ").concat(n," with size ").concat(r[i]," to size ").concat(e[a]))}}function ts(r,e){var t=lt(r);if(la(t,e))return r;z2(t,e);var n=Ip(t,e),i=n.length,a=[...Array(i-t.length).fill(1),...t],o=TZ(r);t.length<i&&(o=Np(o,a),t=lt(o));for(var u=0;u<i;u++)t[u]<n[u]&&(o=EZ(o,n[u],u),t=lt(o));return o}function EZ(r,e,t){return d0(...Array(e).fill(r),t)}function Kc(r,e){if(!Array.isArray(r))throw new Error("Array expected");var t=lt(r);if(e.length!==t.length)throw new Mt(e.length,t.length);for(var n=0;n<e.length;n++)Ir(e[n],t[n]);return e.reduce((i,a)=>i[a],r)}function Pp(r,e,t,n){return Array.isArray(r)?r.map(function(i,a){return Pp(i,e.concat(a),t,n)}):n(r,e,t)}function TZ(r){return rn([],r)}var h0=Or(zb(),1);function lo(r,e,t){if(h0.default.isTypedFunction(r)){var n=(e.isMatrix?e.size():lt(e)).map(()=>0),i=e.isMatrix?e.get(n):Kc(e,n),a=Object.keys(r.signatures).length===1,o=MZ(r,i,n,e),u=a?Object.values(r.signatures)[0]:r;return o>=1&&o<=3?function(){for(var c=arguments.length,s=new Array(c),l=0;l<c;l++)s[l]=arguments[l];return H2(u,s.slice(0,o),t,r.name)}:function(){for(var c=arguments.length,s=new Array(c),l=0;l<c;l++)s[l]=arguments[l];return H2(u,s,t,r.name)}}return r}function MZ(r,e,t,n){for(var i=[e,t,n],a=3;a>0;a--){var o=i.slice(0,a);if(h0.default.resolve(r,o)!==null)return a}}function H2(r,e,t,n){try{return r(...e)}catch(i){DZ(i,e,t,n)}}function DZ(r,e,t,n){var i;if(r instanceof TypeError&&((i=r.data)===null||i===void 0?void 0:i.category)==="wrongType"){var a=[];throw a.push("value: ".concat(ur(e[0]))),e.length>=2&&a.push("index: ".concat(ur(e[1]))),e.length>=3&&a.push("array: ".concat(ur(e[2]))),new TypeError("Function ".concat(t," cannot apply callback arguments ")+"".concat(n,"(").concat(a.join(", "),") at index ").concat(JSON.stringify(e[1])))}else throw new TypeError("Function ".concat(t," cannot apply callback arguments ")+"to function ".concat(n,": ").concat(r.message))}var CZ="DenseMatrix",NZ=["Matrix"],g0=C(CZ,NZ,r=>{var{Matrix:e}=r;function t(l,f){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!dn(f))throw new Error("Invalid datatype: "+f);if(et(l))l.type==="DenseMatrix"?(this._data=dt(l._data),this._size=dt(l._size),this._datatype=f||l._datatype):(this._data=l.toArray(),this._size=l.size(),this._datatype=f||l._datatype);else if(l&&dr(l.data)&&dr(l.size))this._data=l.data,this._size=l.size,f0(this._data,this._size),this._datatype=f||l.datatype;else if(dr(l))this._data=s(l),this._size=lt(this._data),f0(this._data,this._size),this._datatype=f;else{if(l)throw new TypeError("Unsupported type of data ("+ur(l)+")");this._data=[],this._size=[0],this._datatype=f}}t.prototype=new e,t.prototype.createDenseMatrix=function(l,f){return new t(l,f)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return Nl(this._data,ur)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(l,f){return new t(l,f)},t.prototype.subset=function(l,f,p){switch(arguments.length){case 1:return n(this,l);case 2:case 3:return a(this,l,f,p);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(l){return Kc(this._data,l)},t.prototype.set=function(l,f,p){if(!dr(l))throw new TypeError("Array expected");if(l.length<this._size.length)throw new Mt(l.length,this._size.length,"<");var m,d,h,x=l.map(function(T){return T+1});c(this,x,p);var b=this._data;for(m=0,d=l.length-1;m<d;m++)h=l[m],Ir(h,b.length),b=b[h];return h=l[l.length-1],Ir(h,b.length),b[h]=f,this};function n(l,f){if(!Eu(f))throw new TypeError("Invalid index");var p=f.isScalar();if(p)return l.get(f.min());var m=f.size();if(m.length!==l._size.length)throw new Mt(m.length,l._size.length);for(var d=f.min(),h=f.max(),x=0,b=l._size.length;x<b;x++)Ir(d[x],l._size[x]),Ir(h[x],l._size[x]);return new t(i(l._data,f,m.length,0),l._datatype)}function i(l,f,p,m){var d=m===p-1,h=f.dimension(m);return d?h.map(function(x){return Ir(x,l.length),l[x]}).valueOf():h.map(function(x){Ir(x,l.length);var b=l[x];return i(b,f,p,m+1)}).valueOf()}function a(l,f,p,m){if(!f||f.isIndex!==!0)throw new TypeError("Invalid index");var d=f.size(),h=f.isScalar(),x;if(et(p)?(x=p.size(),p=p.valueOf()):x=lt(p),h){if(x.length!==0)throw new TypeError("Scalar expected");l.set(f.min(),p,m)}else{if(!la(x,d))try{x.length===0?p=ts([p],d):p=ts(p,d),x=lt(p)}catch{}if(d.length<l._size.length)throw new Mt(d.length,l._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++;p=tg(p,d.length,T,x)}if(!la(d,x))throw new Mt(d,x,">");var v=f.max().map(function(y){return y+1});c(l,v,m);var S=d.length,_=0;o(l._data,f,p,S,_)}return l}function o(l,f,p,m,d){var h=d===m-1,x=f.dimension(d);h?x.forEach(function(b,T){Ir(b),l[b]=p[T[0]]}):x.forEach(function(b,T){Ir(b),o(l[b],f,p[T[0]],m,d+1)})}t.prototype.resize=function(l,f,p){if(!bn(l))throw new TypeError("Array or Matrix expected");var m=l.valueOf().map(h=>Array.isArray(h)&&h.length===1?h[0]:h),d=p?this.clone():this;return u(d,m,f)};function u(l,f,p){if(f.length===0){for(var m=l._data;dr(m);)m=m[0];return m}return l._size=f.slice(0),l._data=Bo(l._data,l._size,p),l}t.prototype.reshape=function(l,f){var p=f?this.clone():this;p._data=Np(p._data,l);var m=p._size.reduce((d,h)=>d*h);return p._size=Fp(l,m),p};function c(l,f,p){for(var m=l._size.slice(0),d=!1;m.length<f.length;)m.push(0),d=!0;for(var h=0,x=f.length;h<x;h++)f[h]>m[h]&&(m[h]=f[h],d=!0);d&&u(l,m,p)}t.prototype.clone=function(){var l=new t({data:dt(this._data),size:dt(this._size),datatype:this._datatype});return l},t.prototype.size=function(){return this._size.slice(0)},t.prototype._forEach=function(l){var f=this,p=f.size();if(p.length===1){for(var m=0;m<p[0];m++)l(f._data,m,[m]);return}var d=Array(p.length).fill(0),h=Array(p.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]===p[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 S=0;S<p[h.length];S++)d[h.length]=S,l(h[x],S,d.slice(0));break}if(T===-1)break}},t.prototype.map=function(l){var f=this,p=new t(f),m=lo(l,f._data,"map");return p._forEach(function(d,h,x){d[h]=m(d[h],x,f)}),p},t.prototype.forEach=function(l){var f=this,p=lo(l,f._data,"map");f._forEach(function(m,d,h){p(m[d],h,f)})},t.prototype[Symbol.iterator]=function*(){var l=function*(p,m){if(dr(p))for(var d=0;d<p.length;d++)yield*l(p[d],m.concat(d));else yield{value:p,index:m}};yield*l(this._data,[])},t.prototype.rows=function(){var l=[],f=this.size();if(f.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var m of p)l.push(new t([m],this._datatype));return l},t.prototype.columns=function(){var l=this,f=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var m=this._data,d=function(b){var T=m.map(v=>[v[b]]);f.push(new t(T,l._datatype))},h=0;h<p[1];h++)d(h);return f},t.prototype.toArray=function(){return dt(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(l){return Et(this._data,l)},t.prototype.toString=function(){return Et(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(l){if(l){if(ut(l)&&(l=l.toNumber()),!xt(l)||!Je(l))throw new TypeError("The parameter k must be an integer number")}else l=0;for(var f=l>0?l:0,p=l<0?-l:0,m=this._size[0],d=this._size[1],h=Math.min(m-p,d-f),x=[],b=0;b<h;b++)x[b]=this._data[b+p][b+f];return new t({data:x,size:[h],datatype:this._datatype})},t.diagonal=function(l,f,p,m){if(!dr(l))throw new TypeError("Array expected, size parameter");if(l.length!==2)throw new Error("Only two dimensions matrix are supported");if(l=l.map(function(A){if(ut(A)&&(A=A.toNumber()),!xt(A)||!Je(A)||A<1)throw new Error("Size values must be positive integers");return A}),p){if(ut(p)&&(p=p.toNumber()),!xt(p)||!Je(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var d=p>0?p:0,h=p<0?-p:0,x=l[0],b=l[1],T=Math.min(x-h,b-d),v;if(dr(f)){if(f.length!==T)throw new Error("Invalid value array length");v=function(M){return f[M]}}else if(et(f)){var S=f.size();if(S.length!==1||S[0]!==T)throw new Error("Invalid matrix length");v=function(M){return f.get([M])}}else v=function(){return f};m||(m=ut(v(0))?v(0).mul(0):0);var _=[];if(l.length>0){_=Bo(_,l,m);for(var y=0;y<T;y++)_[y+h][y+d]=v(y)}return new t({data:_,size:[x,b]})},t.fromJSON=function(l){return new t(l)},t.prototype.swapRows=function(l,f){if(!xt(l)||!Je(l)||!xt(f)||!Je(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 Ir(l,this._size[0]),Ir(f,this._size[0]),t._swapRows(l,f,this._data),this},t._swapRows=function(l,f,p){var m=p[l];p[l]=p[f],p[f]=m};function s(l){return et(l)?s(l.valueOf()):dr(l)?l.map(s):l}return t},{isClass:!0});var G2="clone",FZ=["typed"],v0=C(G2,FZ,r=>{var{typed:e}=r;return e(G2,{any:dt})});function ng(r){var e=r.length,t=r[0].length,n,i,a=[];for(i=0;i<t;i++){var o=[];for(n=0;n<e;n++)o.push(r[n][i]);a.push(o)}return a}function co(r){for(var e=0;e<r.length;e++)if(bn(r[e]))return!0;return!1}function Ti(r,e){et(r)&&(r=r.valueOf());for(var t=0,n=r.length;t<n;t++){var i=r[t];Array.isArray(i)?Ti(i,e):e(i)}}function rt(r,e,t){return r&&typeof r.map=="function"?r.map(function(n){return rt(n,e,t)}):e(r)}function Fu(r,e,t){var n=Array.isArray(r)?lt(r):r.size();if(e<0||e>=n.length)throw new di(e,n.length);return et(r)?r.create(ig(r.valueOf(),e,t),r.datatype()):ig(r,e,t)}function ig(r,e,t){var n,i,a,o;if(e<=0)if(Array.isArray(r[0])){for(o=ng(r),i=[],n=0;n<o.length;n++)i[n]=ig(o[n],e-1,t);return i}else{for(a=r[0],n=1;n<r.length;n++)a=t(a,r[n]);return a}else{for(i=[],n=0;n<r.length;n++)i[n]=ig(r[n],e-1,t);return i}}function y0(r,e,t,n,i,a,o,u,c,s,l){var f=r._values,p=r._index,m=r._ptr,d,h,x,b;if(n)for(h=m[e],x=m[e+1],d=h;d<x;d++)b=p[d],t[b]!==a?(t[b]=a,o.push(b),s?(n[b]=c?u(f[d],l):u(l,f[d]),i[b]=a):n[b]=f[d]):(n[b]=c?u(f[d],n[b]):u(n[b],f[d]),i[b]=a);else for(h=m[e],x=m[e+1],d=h;d<x;d++)b=p[d],t[b]!==a?(t[b]=a,o.push(b)):i[b]=a}var W2="isInteger",IZ=["typed"],x0=C(W2,IZ,r=>{var{typed:e}=r;return e(W2,{number:Je,BigNumber:function(n){return n.isInt()},bigint:function(n){return!0},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var fa="number",Us="number, number";function b0(r){return Math.abs(r)}b0.signature=fa;function w0(r,e){return r+e}w0.signature=Us;function _0(r,e){return r-e}_0.signature=Us;function S0(r,e){return r*e}S0.signature=Us;function PZ(r,e){return r/e}PZ.signature=Us;function A0(r){return-r}A0.signature=fa;function E0(r){return r}E0.signature=fa;function ef(r){return i2(r)}ef.signature=fa;function T0(r){return r*r*r}T0.signature=fa;function M0(r){return Math.exp(r)}M0.signature=fa;function D0(r){return a2(r)}D0.signature=fa;function BZ(r,e){if(!Je(r)||!Je(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=r%e,r=e,e=t;return r<0?-r:r}BZ.signature=Us;function C0(r,e){if(!Je(r)||!Je(e))throw new Error("Parameters in function lcm must be integer numbers");if(r===0||e===0)return 0;for(var t,n=r*e;e!==0;)t=e,e=r%t,r=t;return Math.abs(n/r)}C0.signature=Us;function Y2(r,e){return e?Math.log(r)/Math.log(e):Math.log(r)}function N0(r){return n2(r)}N0.signature=fa;function F0(r){return r2(r)}F0.signature=fa;function kZ(r){return Lh(r)}kZ.signature=fa;function $Z(r,e){return e===0?r:r-e*Math.floor(r/e)}$Z.signature=Us;function I0(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,t=e<0;if(t&&(e=-e),e===0)throw new Error("Root must be non-zero");if(r<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(r===0)return t?1/0:0;if(!isFinite(r))return t?0:r;var n=Math.pow(Math.abs(r),1/e);return n=r<0?-n:n,t?1/n:n}function ag(r){return so(r)}ag.signature=fa;function OZ(r){return Math.sqrt(r)}OZ.signature=fa;function P0(r){return r*r}P0.signature=fa;function B0(r,e){var t,n,i,a=0,o=1,u=1,c=0;if(!Je(r)||!Je(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(r/e),i=r-n*e,t=a,a=o-n*a,o=t,t=u,u=c-n*u,c=t,r=e,e=i;var s;return r<0?s=[-r,-o,-c]:s=[r,r?o:0,c],s}B0.signature=Us;function k0(r,e){return r*r<1&&e===1/0||r*r>1&&e===-1/0?0:Math.pow(r,e)}k0.signature=Us;function tf(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Je(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(Wb(r,e))}function RZ(r){return Math.abs(r)}RZ.signature=fa;var LZ="number",rf="number, number";function $0(r,e){if(!Je(r)||!Je(e))throw new Error("Integers expected in function bitAnd");return r&e}$0.signature=rf;function O0(r){if(!Je(r))throw new Error("Integer expected in function bitNot");return~r}O0.signature=LZ;function R0(r,e){if(!Je(r)||!Je(e))throw new Error("Integers expected in function bitOr");return r|e}R0.signature=rf;function L0(r,e){if(!Je(r)||!Je(e))throw new Error("Integers expected in function bitXor");return r^e}L0.signature=rf;function V0(r,e){if(!Je(r)||!Je(e))throw new Error("Integers expected in function leftShift");return r<<e}V0.signature=rf;function U0(r,e){if(!Je(r)||!Je(e))throw new Error("Integers expected in function rightArithShift");return r>>e}U0.signature=rf;function q0(r,e){if(!Je(r)||!Je(e))throw new Error("Integers expected in function rightLogShift");return r>>>e}q0.signature=rf;function Fa(r,e){if(e<r)return 1;if(e===r)return e;var t=e+r>>1;return Fa(r,t)*Fa(t+1,e)}function z0(r,e){if(!Je(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(!Je(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>r)throw new TypeError("k must be less than or equal to n");for(var t=r-e,n=1,i=e<t?t+1:e+1,a=2,o=e<t?e:t,u=i;u<=r;++u)for(n*=u;a<=o&&n%a===0;)n/=a,++a;return a<=o&&(n/=Fa(a,o)),n}z0.signature="number, number";var j2=Math.PI,Z2=2*Math.PI,J2=Math.E,X2=1.618033988749895;var VZ="number",H0="number, number";function G0(r){return!r}G0.signature=VZ;function og(r,e){return!!(r||e)}og.signature=H0;function sg(r,e){return!!r!=!!e}sg.signature=H0;function ug(r,e){return!!(r&&e)}ug.signature=H0;function Bp(r){var e;if(Je(r))return r<=0?isFinite(r)?1/0:NaN:r>171?1/0:Fa(1,r-1);if(r<.5)return Math.PI/(Math.sin(Math.PI*r)*Bp(1-r));if(r>=171.35)return 1/0;if(r>85){var t=r*r,n=t*r,i=n*r,a=i*r;return Math.sqrt(2*Math.PI/r)*Math.pow(r/Math.E,r)*(1+1/(12*r)+1/(288*t)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*r))}--r,e=Fl[0];for(var o=1;o<Fl.length;++o)e+=Fl[o]/(r+o);var u=r+W0+.5;return Math.sqrt(2*Math.PI)*Math.pow(u,r+.5)*Math.exp(-u)*e}Bp.signature="number";var W0=4.7421875,Fl=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Y0=.9189385332046728,UZ=5,qZ=7,Q2=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function kp(r){if(r<0)return NaN;if(r===0)return 1/0;if(!isFinite(r))return r;if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-kp(1-r);r=r-1;for(var e=r+UZ+.5,t=Q2[0],n=qZ-1;n>=1;n--)t+=Q2[n]/(r+n);return Y0+(r+.5)*Math.log(e)-e+Math.log(t)}kp.signature="number";var hn="number",zZ="number, number";function HZ(r){return Math.acos(r)}HZ.signature=hn;function j0(r){return u2(r)}j0.signature=hn;function Z0(r){return Math.atan(1/r)}Z0.signature=hn;function J0(r){return isFinite(r)?(Math.log((r+1)/r)+Math.log(r/(r-1)))/2:0}J0.signature=hn;function X0(r){return Math.asin(1/r)}X0.signature=hn;function Q0(r){var e=1/r;return Math.log(e+Math.sqrt(e*e+1))}Q0.signature=hn;function K0(r){return Math.acos(1/r)}K0.signature=hn;function ew(r){var e=1/r,t=Math.sqrt(e*e-1);return Math.log(t+e)}ew.signature=hn;function GZ(r){return Math.asin(r)}GZ.signature=hn;function tw(r){return l2(r)}tw.signature=hn;function WZ(r){return Math.atan(r)}WZ.signature=hn;function YZ(r,e){return Math.atan2(r,e)}YZ.signature=zZ;function rw(r){return c2(r)}rw.signature=hn;function jZ(r){return Math.cos(r)}jZ.signature=hn;function ZZ(r){return Uh(r)}ZZ.signature=hn;function nw(r){return 1/Math.tan(r)}nw.signature=hn;function iw(r){var e=Math.exp(2*r);return(e+1)/(e-1)}iw.signature=hn;function aw(r){return 1/Math.sin(r)}aw.signature=hn;function ow(r){return r===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(r)-Math.exp(-r)))*so(r)}ow.signature=hn;function sw(r){return 1/Math.cos(r)}sw.signature=hn;function uw(r){return 2/(Math.exp(r)+Math.exp(-r))}uw.signature=hn;function JZ(r){return Math.sin(r)}JZ.signature=hn;function lw(r){return f2(r)}lw.signature=hn;function XZ(r){return Math.tan(r)}XZ.signature=hn;function QZ(r){return qh(r)}QZ.signature=hn;var $p="number";function KZ(r){return Je(r)}KZ.signature=$p;function cw(r){return r<0}cw.signature=$p;function fw(r){return r>0}fw.signature=$p;function eJ(r){return r===0}eJ.signature=$p;function pw(r){return Number.isNaN(r)}pw.signature=$p;function ln(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(t<=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 r.isNaN()||e.isNaN()?!1:!r.isFinite()||!e.isFinite()?r.eq(e):r.eq(e)?!0:r.minus(e).abs().lte(r.constructor.max(r.constructor.max(r.abs(),e.abs()).mul(t),n))}var K2="isNegative",tJ=["typed","config"],mw=C(K2,tJ,r=>{var{typed:e,config:t}=r;return e(K2,{number:n=>Yr(n,0,t.relTol,t.absTol)?!1:cw(n),BigNumber:n=>ln(n,new n.constructor(0),t.relTol,t.absTol)?!1:n.isNeg()&&!n.isZero()&&!n.isNaN(),bigint:n=>n<0n,Fraction:n=>n.s<0,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var eP="isNumeric",rJ=["typed"],dw=C(eP,rJ,r=>{var{typed:e}=r;return e(eP,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var tP="hasNumericValue",nJ=["typed","isNumeric"],hw=C(tP,nJ,r=>{var{typed:e,isNumeric:t}=r;return e(tP,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return t(i)}})});var rP="isPositive",iJ=["typed","config"],gw=C(rP,iJ,r=>{var{typed:e,config:t}=r;return e(rP,{number:n=>Yr(n,0,t.relTol,t.absTol)?!1:fw(n),BigNumber:n=>ln(n,new n.constructor(0),t.relTol,t.absTol)?!1:!n.isNeg()&&!n.isZero()&&!n.isNaN(),bigint:n=>n>0n,Fraction:n=>n.s>0&&n.n>0,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var nP="isZero",aJ=["typed","equalScalar"],vw=C(nP,aJ,r=>{var{typed:e,equalScalar:t}=r;return e(nP,{"number | BigNumber | Complex | Fraction":n=>t(n,0),bigint:n=>n===0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var iP="isNaN",oJ=["typed"],yw=C(iP,oJ,r=>{var{typed:e}=r;return e(iP,{number:pw,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(t=>n=>rt(n,t))})});var aP="typeOf",sJ=["typed"],xw=C(aP,sJ,r=>{var{typed:e}=r;return e(aP,{any:ur})});function oP(r,e,t,n){return Yr(r.re,e.re,t,n)&&Yr(r.im,e.im,t,n)}var fo=C("compareUnits",["typed"],r=>{var{typed:e}=r;return{"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[n.valueType(),i.valueType()])(n.value,i.value)})}});var lg="equalScalar",uJ=["typed","config"],bw=C(lg,uJ,r=>{var{typed:e,config:t}=r,n=fo({typed:e});return e(lg,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Yr(a,o,t.relTol,t.absTol)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||ln(a,o,t.relTol,t.absTol)},"bigint, bigint":function(a,o){return a===o},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return oP(a,o,t.relTol,t.absTol)}},n)}),mTe=C(lg,["typed","config"],r=>{var{typed:e,config:t}=r;return e(lg,{"number, number":function(i,a){return Yr(i,a,t.relTol,t.absTol)}})});var lJ="SparseMatrix",cJ=["typed","equalScalar","Matrix"],ww=C(lJ,cJ,r=>{var{typed:e,equalScalar:t,Matrix:n}=r;function i(h,x){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(x&&!dn(x))throw new Error("Invalid datatype: "+x);if(et(h))a(this,h,x);else if(h&&dr(h.index)&&dr(h.ptr)&&dr(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(dr(h))o(this,h,x);else{if(h)throw new TypeError("Unsupported type of data ("+ur(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?dt(x._values):void 0,h._index=dt(x._index),h._ptr=dt(x._ptr),h._size=dt(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,S=t,_=0;if(dn(b)&&(S=e.find(t,[b,b])||t,_=e.convert(0,b)),T>0){var y=0;do{h._ptr.push(h._index.length);for(var A=0;A<T;A++){var M=x[A];if(dr(M)){if(y===0&&v<M.length&&(v=M.length),y<M.length){var w=M[y];S(w,_)||(h._values.push(w),h._index.push(A))}}else y===0&&v<1&&(v=1),S(M,_)||(h._values.push(M),h._index.push(A))}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 Nl(this._values,ur)},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 u(this,h);case 2:case 3:return c(this,h,x,b);default:throw new SyntaxError("Wrong number of arguments")}};function u(h,x){if(!Eu(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 Mt(T.length,h._size.length);var v,S,_,y,A=x.min(),M=x.max();for(v=0,S=h._size.length;v<S;v++)Ir(A[v],h._size[v]),Ir(M[v],h._size[v]);var w=h._values,D=h._index,N=h._ptr,B=x.dimension(0),R=x.dimension(1),z=[],V=[];B.forEach(function(O,X){V[O]=X[0],z[O]=!0});var k=w?[]:void 0,P=[],W=[];return R.forEach(function(O){for(W.push(P.length),_=N[O],y=N[O+1];_<y;_++)v=D[_],z[v]===!0&&(P.push(V[v]),k&&k.push(w[_]))}),W.push(P.length),new i({values:k,index:P,ptr:W,size:T,datatype:h._datatype})}function c(h,x,b,T){if(!x||x.isIndex!==!0)throw new TypeError("Invalid index");var v=x.size(),S=x.isScalar(),_;if(et(b)?(_=b.size(),b=b.toArray()):_=lt(b),S){if(_.length!==0)throw new TypeError("Scalar expected");h.set(x.min(),b,T)}else{if(v.length!==1&&v.length!==2)throw new Mt(v.length,h._size.length,"<");if(_.length<v.length){for(var y=0,A=0;v[y]===1&&_[y]===1;)y++;for(;v[y]===1;)A++,y++;b=tg(b,v.length,A,_)}if(!la(v,_))throw new Mt(v,_,">");if(v.length===1){var M=x.dimension(0);M.forEach(function(N,B){Ir(N),h.set([N,0],b[B[0]],T)})}else{var w=x.dimension(0),D=x.dimension(1);w.forEach(function(N,B){Ir(N),D.forEach(function(R,z){Ir(R),h.set([N,R],b[B[0]][z[0]],T)})})}}return h}i.prototype.get=function(h){if(!dr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Mt(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];Ir(x,this._size[0]),Ir(b,this._size[1]);var T=s(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(!dr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Mt(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],S=this._size[0],_=this._size[1],y=t,A=0;dn(this._datatype)&&(y=e.find(t,[this._datatype,this._datatype])||t,A=e.convert(0,this._datatype)),(T>S-1||v>_-1)&&(p(this,Math.max(T+1,S),Math.max(v+1,_),b),S=this._size[0],_=this._size[1]),Ir(T,S),Ir(v,_);var M=s(T,this._ptr[v],this._ptr[v+1],this._index);return M<this._ptr[v+1]&&this._index[M]===T?y(x,A)?l(M,v,this._values,this._index,this._ptr):this._values[M]=x:y(x,A)||f(M,T,v,x,this._values,this._index,this._ptr),this};function s(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 l(h,x,b,T,v){b.splice(h,1),T.splice(h,1);for(var S=x+1;S<v.length;S++)v[S]--}function f(h,x,b,T,v,S,_){v.splice(h,0,T),S.splice(h,0,x);for(var y=b+1;y<_.length;y++)_[y]++}i.prototype.resize=function(h,x,b){if(!bn(h))throw new TypeError("Array or Matrix expected");var T=h.valueOf().map(S=>Array.isArray(S)&&S.length===1?S[0]:S);if(T.length!==2)throw new Error("Only two dimensions matrix are supported");T.forEach(function(S){if(!xt(S)||!Je(S)||S<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Et(T)+")")});var v=b?this.clone():this;return p(v,T[0],T[1],x)};function p(h,x,b,T){var v=T||0,S=t,_=0;dn(h._datatype)&&(S=e.find(t,[h._datatype,h._datatype])||t,_=e.convert(0,h._datatype),v=e.convert(v,h._datatype));var y=!S(v,_),A=h._size[0],M=h._size[1],w,D,N;if(b>M){for(D=M;D<b;D++)if(h._ptr[D]=h._values.length,y)for(w=0;w<A;w++)h._values.push(v),h._index.push(w);h._ptr[b]=h._values.length}else b<M&&(h._ptr.splice(b+1,M-b),h._values.splice(h._ptr[b],h._values.length),h._index.splice(h._ptr[b],h._index.length));if(M=b,x>A){if(y){var B=0;for(D=0;D<M;D++){h._ptr[D]=h._ptr[D]+B,N=h._ptr[D+1]+B;var R=0;for(w=A;w<x;w++,R++)h._values.splice(N+R,0,v),h._index.splice(N+R,0,w),B++}h._ptr[M]=h._values.length}}else if(x<A){var z=0;for(D=0;D<M;D++){h._ptr[D]=h._ptr[D]-z;var V=h._ptr[D],k=h._ptr[D+1]-z;for(N=V;N<k;N++)w=h._index[N],w>x-1&&(h._values.splice(N,1),h._index.splice(N,1),z++)}h._ptr[D]=h._values.length}return h._size[0]=x,h._size[1]=b,h}i.prototype.reshape=function(h,x){if(!dr(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(!xt(O)||!Je(O)||O<=-2||O===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Et(h)+")")});var b=this._size[0]*this._size[1];h=Fp(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 S=[],_=0;_<v._ptr.length;_++)for(var y=0;y<v._ptr[_+1]-v._ptr[_];y++)S.push(_);for(var A=v._values.slice(),M=v._index.slice(),w=0;w<v._index.length;w++){var D=M[w],N=S[w],B=D*v._size[1]+N;S[w]=B%h[1],M[w]=Math.floor(B/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 z=0;z<A.length;z++){var V=M[z],k=S[z],P=A[z],W=s(V,v._ptr[k],v._ptr[k+1],v._index);f(W,V,k,P,v._values,v._index,v._ptr)}return v},i.prototype.clone=function(){var h=new i({values:this._values?dt(this._values):void 0,index:dt(this._index),ptr:dt(this._ptr),size:dt(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],S=lo(h,b,"map"),_=function(A,M,w){return S(A,[M,w],b)};return m(this,0,T-1,0,v-1,_,x)};function m(h,x,b,T,v,S,_){var y=[],A=[],M=[],w=t,D=0;dn(h._datatype)&&(w=e.find(t,[h._datatype,h._datatype])||t,D=e.convert(0,h._datatype));for(var N=function(L,pe,me){var oe=S(L,pe,me);w(oe,D)||(y.push(oe),A.push(pe))},B=T;B<=v;B++){M.push(y.length);var R=h._ptr[B],z=h._ptr[B+1];if(_)for(var V=R;V<z;V++){var k=h._index[V];k>=x&&k<=b&&N(h._values[V],k-x,B-T)}else{for(var P={},W=R;W<z;W++){var O=h._index[W];P[O]=h._values[W]}for(var X=x;X<=b;X++){var ne=X in P?P[X]:0;N(ne,X-x,B-T)}}}return M.push(y.length),new i({values:y,index:A,ptr:M,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],S=lo(h,b,"forEach"),_=0;_<v;_++){var y=this._ptr[_],A=this._ptr[_+1];if(x)for(var M=y;M<A;M++){var w=this._index[M];S(this._values[M],[w,_],b)}else{for(var D={},N=y;N<A;N++){var B=this._index[N];D[B]=this._values[N]}for(var R=0;R<T;R++){var z=R in D?D[R]:0;S(z,[R,_],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 S=this._index[v];yield{value:this._values[v],index:[S,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 S=T[0],_=T[1],y=[],A,M;for(A=0;A<S;A++)for(y[A]=[],M=0;M<_;M++)y[A][M]=0;for(M=0;M<_;M++)for(var w=b[M],D=b[M+1],N=w;N<D;N++)A=x[N],y[A][M]=h?v?dt(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 ["+Et(x,h)+" x "+Et(b,h)+"] density: "+Et(T,h)+`
`,S=0;S<b;S++)for(var _=this._ptr[S],y=this._ptr[S+1],A=_;A<y;A++){var M=this._index[A];v+=`
    (`+Et(M,h)+", "+Et(S,h)+") ==> "+(this._values?Et(this._values[A],h):"X")}return v},i.prototype.toString=function(){return Et(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(ut(h)&&(h=h.toNumber()),!xt(h)||!Je(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],S=Math.min(T-b,v-x),_=[],y=[],A=[];A[0]=0;for(var M=x;M<v&&_.length<S;M++)for(var w=this._ptr[M],D=this._ptr[M+1],N=w;N<D;N++){var B=this._index[N];if(B===M-x+b){_.push(this._values[N]),y[_.length-1]=B-b;break}}return A.push(_.length),new i({values:_,index:y,ptr:A,size:[S,1]})},i.fromJSON=function(h){return new i(h)},i.diagonal=function(h,x,b,T,v){if(!dr(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(ut(O)&&(O=O.toNumber()),!xt(O)||!Je(O)||O<1)throw new Error("Size values must be positive integers");return O}),b){if(ut(b)&&(b=b.toNumber()),!xt(b)||!Je(b))throw new TypeError("The parameter k must be an integer number")}else b=0;var S=t,_=0;dn(v)&&(S=e.find(t,[v,v])||t,_=e.convert(0,v));var y=b>0?b:0,A=b<0?-b:0,M=h[0],w=h[1],D=Math.min(M-A,w-y),N;if(dr(x)){if(x.length!==D)throw new Error("Invalid value array length");N=function(X){return x[X]}}else if(et(x)){var B=x.size();if(B.length!==1||B[0]!==D)throw new Error("Invalid matrix length");N=function(X){return x.get([X])}}else N=function(){return x};for(var R=[],z=[],V=[],k=0;k<w;k++){V.push(R.length);var P=k-y;if(P>=0&&P<D){var W=N(P);S(W,_)||(z.push(P+A),R.push(W))}}return V.push(R.length),new i({values:R,index:z,ptr:V,size:[M,w]})},i.prototype.swapRows=function(h,x){if(!xt(h)||!Je(h)||!xt(x)||!Je(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 Ir(h,this._size[0]),Ir(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 S=T[h],_=T[h+1],y=S;y<_;y++)v(b[y],x[y])},i._swapRows=function(h,x,b,T,v,S){for(var _=0;_<b;_++){var y=S[_],A=S[_+1],M=s(h,y,A,v),w=s(x,y,A,v);if(M<A&&w<A&&v[M]===h&&v[w]===x){if(T){var D=T[M];T[M]=T[w],T[w]=D}continue}if(M<A&&v[M]===h&&(w>=A||v[w]!==x)){var N=T?T[M]:void 0;v.splice(w,0,x),T&&T.splice(w,0,N),v.splice(w<=M?M+1:M,1),T&&T.splice(w<=M?M+1:M,1);continue}if(w<A&&v[w]===x&&(M>=A||v[M]!==h)){var B=T?T[w]:void 0;v.splice(M,0,h),T&&T.splice(M,0,B),v.splice(M<=w?w+1:w,1),T&&T.splice(M<=w?w+1:w,1)}}},i},{isClass:!0});var fJ="number",pJ=["typed"];function mJ(r){var e=r.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:r,radix:t,integerPart:n,fractionalPart:i}}else return null}function dJ(r){for(var e=parseInt(r.integerPart,r.radix),t=0,n=0;n<r.fractionalPart.length;n++){var i=parseInt(r.fractionalPart[n],r.radix);t+=i/Math.pow(r.radix,n+1)}var a=e+t;if(isNaN(a))throw new SyntaxError('String "'+r.input+'" is not a valid number');return a}var _w=C(fJ,pJ,r=>{var{typed:e}=r,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=mJ(i);if(a)return dJ(a);var o=0,u=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);u&&(o=Number(u[2]),i=u[1]);var c=Number(i);if(isNaN(c))throw new SyntaxError('String "'+i+'" is not a valid number');if(u){if(c>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));c>=2**(o-1)&&(c=c-2**o)}return c},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=>rt(i,n))});return t.fromJSON=function(n){return parseFloat(n.value)},t});var hJ="bigint",gJ=["typed"],Sw=C(hJ,gJ,r=>{var{typed:e}=r,t=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=>rt(i,n))});return t.fromJSON=function(n){return BigInt(n.value)},t});var sP="string",vJ=["typed"],Aw=C(sP,vJ,r=>{var{typed:e}=r;return e(sP,{"":function(){return""},number:Fo,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":e.referToSelf(t=>n=>rt(n,t)),any:function(n){return String(n)}})});var uP="boolean",yJ=["typed"],Ew=C(uP,yJ,r=>{var{typed:e}=r;return e(uP,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var xJ="bignumber",bJ=["typed","BigNumber"],Tw=C(xJ,bJ,r=>{var{typed:e,BigNumber:t}=r;return e("bignumber",{"":function(){return new t(0)},number:function(i){return new t(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],u=t(a[1]),c=new t(2).pow(Number(o));if(u.gt(c.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var s=new t(2).pow(Number(o)-1);return u.gte(s)?u.sub(c):u}return new t(i)},BigNumber:function(i){return i},bigint:function(i){return new t(i.toString())},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Fraction:function(i){return new t(i.n).div(i.d).times(i.s)},null:function(i){return new t(0)},"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var wJ="complex",_J=["typed","Complex"],Mw=C(wJ,_J,r=>{var{typed:e,Complex:t}=r;return e("complex",{"":function(){return t.ZERO},number:function(i){return new t(i,0)},"number, number":function(i,a){return new t(i,a)},"BigNumber, BigNumber":function(i,a){return new t(i.toNumber(),a.toNumber())},Fraction:function(i){return new t(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return t(i)},null:function(i){return t(0)},Object:function(i){if("re"in i&&"im"in i)return new t(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new t(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var SJ="fraction",AJ=["typed","Fraction"],Dw=C(SJ,AJ,r=>{var{typed:e,Fraction:t}=r;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new t(i)},string:function(i){return new t(i)},"number, number":function(i,a){return new t(i,a)},null:function(i){return new t(0)},BigNumber:function(i){return new t(i.toString())},bigint:function(i){return new t(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var lP="matrix",EJ=["typed","Matrix","DenseMatrix","SparseMatrix"],Cw=C(lP,EJ,r=>{var{typed:e,Matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(lP,{"":function(){return a([])},string:function(u){return a([],u)},"string, string":function(u,c){return a([],u,c)},Array:function(u){return a(u)},Matrix:function(u){return a(u,u.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,u,c){if(u==="dense"||u==="default"||u===void 0)return new n(o,c);if(u==="sparse")return new i(o,c);throw new TypeError("Unknown matrix type "+JSON.stringify(u)+".")}});var cP="matrixFromFunction",TJ=["typed","matrix","isZero"],Nw=C(cP,TJ,r=>{var{typed:e,matrix:t,isZero:n}=r;return e(cP,{"Array | Matrix, function, string, string":function(o,u,c,s){return i(o,u,c,s)},"Array | Matrix, function, string":function(o,u,c){return i(o,u,c)},"Matrix, function":function(o,u){return i(o,u,"dense")},"Array, function":function(o,u){return i(o,u,"dense").toArray()},"Array | Matrix, string, function":function(o,u,c){return i(o,c,u)},"Array | Matrix, string, string, function":function(o,u,c,s){return i(o,s,u,c)}});function i(a,o,u,c){var s;return c!==void 0?s=t(u,c):s=t(u),s.resize(a),s.forEach(function(l,f){var p=o(f);n(p)||s.set(f,p)}),s}});var fP="matrixFromRows",MJ=["typed","matrix","flatten","size"],Fw=C(fP,MJ,r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(fP,{"...Array":function(c){return a(c)},"...Matrix":function(c){return t(a(c.map(s=>s.toArray())))}});function a(u){if(u.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var c=o(u[0]),s=[];for(var l of u){var f=o(l);if(f!==c)throw new TypeError("The vectors had different length: "+(c|0)+" \u2260 "+(f|0));s.push(n(l))}return s}function o(u){var c=i(u);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[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 pP="matrixFromColumns",DJ=["typed","matrix","flatten","size"],Iw=C(pP,DJ,r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(pP,{"...Array":function(c){return a(c)},"...Matrix":function(c){return t(a(c.map(s=>s.toArray())))}});function a(u){if(u.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var c=o(u[0]),s=[],l=0;l<c;l++)s[l]=[];for(var f of u){var p=o(f);if(p!==c)throw new TypeError("The vectors had different length: "+(c|0)+" \u2260 "+(p|0));for(var m=n(f),d=0;d<c;d++)s[d].push(m[d])}return s}function o(u){var c=i(u);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[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 mP="splitUnit",CJ=["typed"],Pw=C(mP,CJ,r=>{var{typed:e}=r;return e(mP,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var dP="unaryMinus",NJ=["typed"],Bw=C(dP,NJ,r=>{var{typed:e}=r;return e(dP,{number:A0,"Complex | BigNumber | Fraction":t=>t.neg(),bigint:t=>-t,Unit:e.referToSelf(t=>n=>{var i=n.clone();return i.value=e.find(t,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(t=>n=>rt(n,t,!0))})});var hP="unaryPlus",FJ=["typed","config","numeric"],kw=C(hP,FJ,r=>{var{typed:e,config:t,numeric:n}=r;return e(hP,{number:E0,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=>rt(a,i,!0)),boolean:function(a){return n(a?1:0,t.number)},string:function(a){return n(a,Ai(a,t))}})});var gP="abs",IJ=["typed"],$w=C(gP,IJ,r=>{var{typed:e}=r;return e(gP,{number:b0,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),bigint:t=>t<0n?-t:t,"Array | Matrix":e.referToSelf(t=>n=>rt(n,t,!0))})});var vP="apply",PJ=["typed","isInteger"],Il=C(vP,PJ,r=>{var{typed:e,isInteger:t}=r;return e(vP,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!t(a))throw new TypeError("Integer number expected for dimension");var u=Array.isArray(i)?lt(i):i.size();if(a<0||a>=u.length)throw new di(a,u.length);return et(i)?i.create(cg(i.valueOf(),a,o),i.datatype()):cg(i,a,o)}})});function cg(r,e,t){var n,i,a;if(e<=0)if(Array.isArray(r[0])){for(a=BJ(r),i=[],n=0;n<a.length;n++)i[n]=cg(a[n],e-1,t);return i}else return t(r);else{for(i=[],n=0;n<r.length;n++)i[n]=cg(r[n],e-1,t);return i}}function BJ(r){var e=r.length,t=r[0].length,n,i,a=[];for(i=0;i<t;i++){var o=[];for(n=0;n<e;n++)o.push(r[n][i]);a.push(o)}return a}var yP="addScalar",kJ=["typed"],Ow=C(yP,kJ,r=>{var{typed:e}=r;return e(yP,{"number, number":w0,"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(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var xP="subtractScalar",$J=["typed"],Rw=C(xP,$J,r=>{var{typed:e}=r;return e(xP,{"number, number":_0,"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(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var bP="cbrt",OJ=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],Lw=C(bP,OJ,r=>{var{config:e,typed:t,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:u,Fraction:c}=r;return t(bP,{number:ef,Complex:s,"Complex, boolean":s,BigNumber:function(p){return p.cbrt()},Unit:l});function s(f,p){var m=f.arg()/3,d=f.abs(),h=new o(ef(d),0).mul(new o(0,m).exp());if(p){var x=[h,new o(ef(d),0).mul(new o(0,m+Math.PI*2/3).exp()),new o(ef(d),0).mul(new o(0,m-Math.PI*2/3).exp())];return e.matrix==="Array"?x:a(x)}else return h}function l(f){if(f.value&&Hi(f.value)){var p=f.clone();return p.value=1,p=p.pow(1/3),p.value=s(f.value),p}else{var m=n(f.value);m&&(f.value=i(f.value));var d;ut(f.value)?d=new u(1).div(3):Os(f.value)?d=new c(1,3):d=1/3;var h=f.pow(d);return m&&(h.value=i(h.value)),h}}});var RJ="matAlgo11xS0s",LJ=["typed","equalScalar"],Nr=C(RJ,LJ,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o,u){var c=i._values,s=i._index,l=i._ptr,f=i._size,p=i._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],d=f[1],h,x=t,b=0,T=o;typeof p=="string"&&(h=p,x=e.find(t,[h,h]),b=e.convert(0,h),a=e.convert(a,h),T=e.find(o,[h,h]));for(var v=[],S=[],_=[],y=0;y<d;y++){_[y]=S.length;for(var A=l[y],M=l[y+1],w=A;w<M;w++){var D=s[w],N=u?T(a,c[w]):T(c[w],a);x(N,b)||(S.push(D),v.push(N))}}return _[d]=S.length,i.createSparseMatrix({values:v,index:S,ptr:_,size:[m,d],datatype:h})}});var VJ="matAlgo12xSfs",UJ=["typed","DenseMatrix"],yr=C(VJ,UJ,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,a,o,u){var c=i._values,s=i._index,l=i._ptr,f=i._size,p=i._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],d=f[1],h,x=o;typeof p=="string"&&(h=p,a=e.convert(a,h),x=e.find(o,[h,h]));for(var b=[],T=[],v=[],S=0;S<d;S++){for(var _=S+1,y=l[S],A=l[S+1],M=y;M<A;M++){var w=s[M];T[w]=c[M],v[w]=_}for(var D=0;D<m;D++)S===0&&(b[D]=[]),v[D]===_?b[D][S]=u?x(a,T[D]):x(T[D],a):b[D][S]=u?x(a,0):x(0,a)}return new t({data:b,size:[m,d],datatype:h})}});var qJ="matAlgo14xDs",zJ=["typed"],Tn=C(qJ,zJ,r=>{var{typed:e}=r;return function(i,a,o,u){var c=i._data,s=i._size,l=i._datatype,f,p=o;typeof l=="string"&&(f=l,a=e.convert(a,f),p=e.find(o,[f,f]));var m=s.length>0?t(p,0,s,s[0],c,a,u):[];return i.createDenseMatrix({data:m,size:dt(s),datatype:f})};function t(n,i,a,o,u,c,s){var l=[];if(i===a.length-1)for(var f=0;f<o;f++)l[f]=s?n(c,u[f]):n(u[f],c);else for(var p=0;p<o;p++)l[p]=t(n,i+1,a,a[i+1],u[p],c,s);return l}});var Vw="ceil",HJ=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],GJ=C(Vw,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(Vw,{number:function(a){return Yr(a,n(a),t.relTol,t.absTol)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Yr(a,n(a,o),t.relTol,t.absTol))return n(a,o);var[u,c]="".concat(a,"e").split("e"),s=Math.ceil(Number("".concat(u,"e").concat(Number(c)+o)));return[u,c]="".concat(s,"e").split("e"),Number("".concat(u,"e").concat(Number(c)-o))}})}),Uw=C(Vw,HJ,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}=r,c=Nr({typed:e,equalScalar:a}),s=yr({typed:e,DenseMatrix:u}),l=Tn({typed:e}),f=GJ({typed:e,config:t,round:n});return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.ceil()},"Complex, number":function(m,d){return m.ceil(d)},"Complex, BigNumber":function(m,d){return m.ceil(d.toNumber())},BigNumber:function(m){return ln(m,n(m),t.relTol,t.absTol)?n(m):m.ceil()},"BigNumber, BigNumber":function(m,d){return ln(m,n(m,d),t.relTol,t.absTol)?n(m,d):m.toDecimalPlaces(d.toNumber(),Ml.ROUND_CEIL)},Fraction:function(m){return m.ceil()},"Fraction, number":function(m,d){return m.ceil(d)},"Fraction, BigNumber":function(m,d){return m.ceil(d.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>rt(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,d)=>rt(m,h=>p(h,d),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,d)=>c(m,d,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,d)=>l(m,d,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,d)=>l(i(d),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,d)=>a(m,0)?o(d.size(),d.storage()):d.storage()==="dense"?l(d,m,p,!0):s(d,m,p,!0))})});var wP="cube",WJ=["typed"],qw=C(wP,WJ,r=>{var{typed:e}=r;return e(wP,{number:T0,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 _P="exp",YJ=["typed"],zw=C(_P,YJ,r=>{var{typed:e}=r;return e(_P,{number:M0,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var SP="expm1",jJ=["typed","Complex"],Hw=C(SP,jJ,r=>{var{typed:e,Complex:t}=r;return e(SP,{number:D0,Complex:function(i){var a=Math.exp(i.re);return new t(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var Gw="fix",ZJ=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],JJ=C(Gw,["typed","ceil","floor"],r=>{var{typed:e,ceil:t,floor:n}=r;return e(Gw,{number:function(a){return a>0?n(a):t(a)},"number, number":function(a,o){return a>0?n(a,o):t(a,o)}})}),Ww=C(Gw,ZJ,r=>{var{typed:e,Complex:t,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:u,DenseMatrix:c}=r,s=yr({typed:e,DenseMatrix:c}),l=Tn({typed:e}),f=JJ({typed:e,ceil:i,floor:a});return e("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(m){return new t(m.re>0?Math.floor(m.re):Math.ceil(m.re),m.im>0?Math.floor(m.im):Math.ceil(m.im))},"Complex, number":function(m,d){return new t(m.re>0?a(m.re,d):i(m.re,d),m.im>0?a(m.im,d):i(m.im,d))},"Complex, BigNumber":function(m,d){var h=d.toNumber();return new t(m.re>0?a(m.re,h):i(m.re,h),m.im>0?a(m.im,h):i(m.im,h))},BigNumber:function(m){return m.isNegative()?i(m):a(m)},"BigNumber, number | BigNumber":function(m,d){return m.isNegative()?i(m,d):a(m,d)},Fraction:function(m){return m.s<0?m.ceil():m.floor()},"Fraction, number | BigNumber":function(m,d){return m.s<0?i(m,d):a(m,d)},"Array | Matrix":e.referToSelf(p=>m=>rt(m,p,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(p=>(m,d)=>rt(m,h=>p(h,d),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,d)=>l(n(d),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,d)=>o(m,0)?u(d.size(),d.storage()):d.storage()==="dense"?l(d,m,p,!0):s(d,m,p,!0))})});var Yw="floor",XJ=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],QJ=C(Yw,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(Yw,{number:function(a){return Yr(a,n(a),t.relTol,t.absTol)?n(a):Math.floor(a)},"number, number":function(a,o){if(Yr(a,n(a,o),t.relTol,t.absTol))return n(a,o);var[u,c]="".concat(a,"e").split("e"),s=Math.floor(Number("".concat(u,"e").concat(Number(c)+o)));return[u,c]="".concat(s,"e").split("e"),Number("".concat(u,"e").concat(Number(c)-o))}})}),Op=C(Yw,XJ,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}=r,c=Nr({typed:e,equalScalar:a}),s=yr({typed:e,DenseMatrix:u}),l=Tn({typed:e}),f=QJ({typed:e,config:t,round:n});return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.floor()},"Complex, number":function(m,d){return m.floor(d)},"Complex, BigNumber":function(m,d){return m.floor(d.toNumber())},BigNumber:function(m){return ln(m,n(m),t.relTol,t.absTol)?n(m):m.floor()},"BigNumber, BigNumber":function(m,d){return ln(m,n(m,d),t.relTol,t.absTol)?n(m,d):m.toDecimalPlaces(d.toNumber(),Ml.ROUND_FLOOR)},Fraction:function(m){return m.floor()},"Fraction, number":function(m,d){return m.floor(d)},"Fraction, BigNumber":function(m,d){return m.floor(d.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>rt(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,d)=>rt(m,h=>p(h,d),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,d)=>c(m,d,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,d)=>l(m,d,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,d)=>l(i(d),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,d)=>a(m,0)?o(d.size(),d.storage()):d.storage()==="dense"?l(d,m,p,!0):s(d,m,p,!0))})});var KJ="matAlgo02xDS0",eX=["typed","equalScalar"],Mn=C(KJ,eX,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o,u){var c=i._data,s=i._size,l=i._datatype||i.getDataType(),f=a._values,p=a._index,m=a._ptr,d=a._size,h=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(s.length!==d.length)throw new Mt(s.length,d.length);if(s[0]!==d[0]||s[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+d+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var x=s[0],b=s[1],T,v=t,S=0,_=o;typeof l=="string"&&l===h&&l!=="mixed"&&(T=l,v=e.find(t,[T,T]),S=e.convert(0,T),_=e.find(o,[T,T]));for(var y=[],A=[],M=[],w=0;w<b;w++){M[w]=A.length;for(var D=m[w],N=m[w+1],B=D;B<N;B++){var R=p[B],z=u?_(f[B],c[R][w]):_(c[R][w],f[B]);v(z,S)||(A.push(R),y.push(z))}}return M[b]=A.length,a.createSparseMatrix({values:y,index:A,ptr:M,size:[x,b],datatype:l===i._datatype&&h===a._datatype?T:void 0})}});var tX="matAlgo03xDSf",rX=["typed"],zr=C(tX,rX,r=>{var{typed:e}=r;return function(n,i,a,o){var u=n._data,c=n._size,s=n._datatype||n.getDataType(),l=i._values,f=i._index,p=i._ptr,m=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(c.length!==m.length)throw new Mt(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");if(!l)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=c[0],x=c[1],b,T=0,v=a;typeof s=="string"&&s===d&&s!=="mixed"&&(b=s,T=e.convert(0,b),v=e.find(a,[b,b]));for(var S=[],_=0;_<h;_++)S[_]=[];for(var y=[],A=[],M=0;M<x;M++){for(var w=M+1,D=p[M],N=p[M+1],B=D;B<N;B++){var R=f[B];y[R]=o?v(l[B],u[R][M]):v(u[R][M],l[B]),A[R]=w}for(var z=0;z<h;z++)A[z]===w?S[z][M]=y[z]:S[z][M]=o?v(T,u[z][M]):v(u[z][M],T)}return n.createDenseMatrix({data:S,size:[h,x],datatype:s===n._datatype&&d===i._datatype?b:void 0})}});var nX="matAlgo05xSfSf",iX=["typed","equalScalar"],Iu=C(nX,iX,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var u=i._values,c=i._index,s=i._ptr,l=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==h.length)throw new Mt(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");var b=l[0],T=l[1],v,S=t,_=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,S=e.find(t,[v,v]),_=e.convert(0,v),y=e.find(o,[v,v]));var A=u&&p?[]:void 0,M=[],w=[],D=A?[]:void 0,N=A?[]:void 0,B=[],R=[],z,V,k,P;for(V=0;V<T;V++){w[V]=M.length;var W=V+1;for(k=s[V],P=s[V+1];k<P;k++)z=c[k],M.push(z),B[z]=W,D&&(D[z]=u[k]);for(k=d[V],P=d[V+1];k<P;k++)z=m[k],B[z]!==W&&M.push(z),R[z]=W,N&&(N[z]=p[k]);if(A)for(k=w[V];k<M.length;){z=M[k];var O=B[z],X=R[z];if(O===W||X===W){var ne=O===W?D[z]:_,Z=X===W?N[z]:_,L=y(ne,Z);S(L,_)?M.splice(k,1):(A.push(L),k++)}}}return w[T]=M.length,i.createSparseMatrix({values:A,index:M,ptr:w,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var aX="matAlgo13xDD",oX=["typed"],AP=C(aX,oX,r=>{var{typed:e}=r;return function(i,a,o){var u=i._data,c=i._size,s=i._datatype,l=a._data,f=a._size,p=a._datatype,m=[];if(c.length!==f.length)throw new Mt(c.length,f.length);for(var d=0;d<c.length;d++){if(c[d]!==f[d])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+f+")");m[d]=c[d]}var h,x=o;typeof s=="string"&&s===p&&(h=s,x=e.find(o,[h,h]));var b=m.length>0?t(x,0,m,m[0],u,l):[];return i.createDenseMatrix({data:b,size:m,datatype:h})};function t(n,i,a,o,u,c){var s=[];if(i===a.length-1)for(var l=0;l<o;l++)s[l]=n(u[l],c[l]);else for(var f=0;f<o;f++)s[f]=t(n,i+1,a,a[i+1],u[f],c[f]);return s}});function Zn(r,e){if(la(r.size(),e.size()))return[r,e];var t=Ip(r.size(),e.size());return[r,e].map(n=>sX(n,t))}function sX(r,e){return la(r.size(),e)?r:r.create(ts(r.valueOf(),e),r.datatype())}var uX="matrixAlgorithmSuite",lX=["typed","matrix"],Ft=C(uX,lX,r=>{var{typed:e,matrix:t}=r,n=AP({typed:e}),i=Tn({typed:e});return function(o){var u=o.elop,c=o.SD||o.DS,s;u?(s={"DenseMatrix, DenseMatrix":(m,d)=>n(...Zn(m,d),u),"Array, Array":(m,d)=>n(...Zn(t(m),t(d)),u).valueOf(),"Array, DenseMatrix":(m,d)=>n(...Zn(t(m),d),u),"DenseMatrix, Array":(m,d)=>n(...Zn(m,t(d)),u)},o.SS&&(s["SparseMatrix, SparseMatrix"]=(m,d)=>o.SS(...Zn(m,d),u,!1)),o.DS&&(s["DenseMatrix, SparseMatrix"]=(m,d)=>o.DS(...Zn(m,d),u,!1),s["Array, SparseMatrix"]=(m,d)=>o.DS(...Zn(t(m),d),u,!1)),c&&(s["SparseMatrix, DenseMatrix"]=(m,d)=>c(...Zn(d,m),u,!0),s["SparseMatrix, Array"]=(m,d)=>c(...Zn(t(d),m),u,!0))):(s={"DenseMatrix, DenseMatrix":e.referToSelf(m=>(d,h)=>n(...Zn(d,h),m)),"Array, Array":e.referToSelf(m=>(d,h)=>n(...Zn(t(d),t(h)),m).valueOf()),"Array, DenseMatrix":e.referToSelf(m=>(d,h)=>n(...Zn(t(d),h),m)),"DenseMatrix, Array":e.referToSelf(m=>(d,h)=>n(...Zn(d,t(h)),m))},o.SS&&(s["SparseMatrix, SparseMatrix"]=e.referToSelf(m=>(d,h)=>o.SS(...Zn(d,h),m,!1))),o.DS&&(s["DenseMatrix, SparseMatrix"]=e.referToSelf(m=>(d,h)=>o.DS(...Zn(d,h),m,!1)),s["Array, SparseMatrix"]=e.referToSelf(m=>(d,h)=>o.DS(...Zn(t(d),h),m,!1))),c&&(s["SparseMatrix, DenseMatrix"]=e.referToSelf(m=>(d,h)=>c(...Zn(h,d),m,!0)),s["SparseMatrix, Array"]=e.referToSelf(m=>(d,h)=>c(...Zn(t(h),d),m,!0))));var l=o.scalar||"any",f=o.Ds||o.Ss;f&&(u?(s["DenseMatrix,"+l]=(m,d)=>i(m,d,u,!1),s[l+", DenseMatrix"]=(m,d)=>i(d,m,u,!0),s["Array,"+l]=(m,d)=>i(t(m),d,u,!1).valueOf(),s[l+", Array"]=(m,d)=>i(t(d),m,u,!0).valueOf()):(s["DenseMatrix,"+l]=e.referToSelf(m=>(d,h)=>i(d,h,m,!1)),s[l+", DenseMatrix"]=e.referToSelf(m=>(d,h)=>i(h,d,m,!0)),s["Array,"+l]=e.referToSelf(m=>(d,h)=>i(t(d),h,m,!1).valueOf()),s[l+", Array"]=e.referToSelf(m=>(d,h)=>i(t(h),d,m,!0).valueOf())));var p=o.sS!==void 0?o.sS:o.Ss;return u?(o.Ss&&(s["SparseMatrix,"+l]=(m,d)=>o.Ss(m,d,u,!1)),p&&(s[l+", SparseMatrix"]=(m,d)=>p(d,m,u,!0))):(o.Ss&&(s["SparseMatrix,"+l]=e.referToSelf(m=>(d,h)=>o.Ss(d,h,m,!1))),p&&(s[l+", SparseMatrix"]=e.referToSelf(m=>(d,h)=>p(h,d,m,!0)))),u&&u.signatures&&Rh(s,u.signatures),s}});var EP="mod",cX=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],Rp=C(EP,cX,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u,concat:c}=r,s=Op({typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}),l=Mn({typed:e,equalScalar:a}),f=zr({typed:e}),p=Iu({typed:e,equalScalar:a}),m=Nr({typed:e,equalScalar:a}),d=yr({typed:e,DenseMatrix:u}),h=Ft({typed:e,matrix:i,concat:c});return e(EP,{"number, number":x,"BigNumber, BigNumber":function(T,v){return v.isZero()?T:T.sub(v.mul(s(T.div(v))))},"bigint, bigint":function(T,v){if(v===0n)return T;if(T<0){var S=T%v;return S===0n?S:S+v}return T%v},"Fraction, Fraction":function(T,v){return v.equals(0)?T:T.sub(v.mul(s(T.div(v))))}},h({SS:p,DS:f,SD:l,Ss:m,sS:d}));function x(b,T){return T===0?b:b-T*s(b/T)}});var fX="matAlgo01xDSid",pX=["typed"],Mi=C(fX,pX,r=>{var{typed:e}=r;return function(n,i,a,o){var u=n._data,c=n._size,s=n._datatype||n.getDataType(),l=i._values,f=i._index,p=i._ptr,m=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(c.length!==m.length)throw new Mt(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");if(!l)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=c[0],x=c[1],b=typeof s=="string"&&s!=="mixed"&&s===d?s:void 0,T=b?e.find(a,[b,b]):a,v,S,_=[];for(v=0;v<h;v++)_[v]=[];var y=[],A=[];for(S=0;S<x;S++){for(var M=S+1,w=p[S],D=p[S+1],N=w;N<D;N++)v=f[N],y[v]=o?T(l[N],u[v][S]):T(u[v][S],l[N]),A[v]=M;for(v=0;v<h;v++)A[v]===M?_[v][S]=y[v]:_[v][S]=u[v][S]}return n.createDenseMatrix({data:_,size:[h,x],datatype:s===n._datatype&&d===i._datatype?b:void 0})}});var mX="matAlgo04xSidSid",dX=["typed","equalScalar"],nf=C(mX,dX,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var u=i._values,c=i._index,s=i._ptr,l=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==h.length)throw new Mt(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");var b=l[0],T=l[1],v,S=t,_=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,S=e.find(t,[v,v]),_=e.convert(0,v),y=e.find(o,[v,v]));var A=u&&p?[]:void 0,M=[],w=[],D=u&&p?[]:void 0,N=u&&p?[]:void 0,B=[],R=[],z,V,k,P,W;for(V=0;V<T;V++){w[V]=M.length;var O=V+1;for(P=s[V],W=s[V+1],k=P;k<W;k++)z=c[k],M.push(z),B[z]=O,D&&(D[z]=u[k]);for(P=d[V],W=d[V+1],k=P;k<W;k++)if(z=m[k],B[z]===O){if(D){var X=y(D[z],p[k]);S(X,_)?B[z]=null:D[z]=X}}else M.push(z),R[z]=O,N&&(N[z]=p[k]);if(D&&N)for(k=w[V];k<M.length;)z=M[k],B[z]===O?(A[k]=D[z],k++):R[z]===O?(A[k]=N[z],k++):M.splice(k,1)}return w[T]=M.length,i.createSparseMatrix({values:A,index:M,ptr:w,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var hX="matAlgo10xSids",gX=["typed","DenseMatrix"],pa=C(hX,gX,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,a,o,u){var c=i._values,s=i._index,l=i._ptr,f=i._size,p=i._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],d=f[1],h,x=o;typeof p=="string"&&(h=p,a=e.convert(a,h),x=e.find(o,[h,h]));for(var b=[],T=[],v=[],S=0;S<d;S++){for(var _=S+1,y=l[S],A=l[S+1],M=y;M<A;M++){var w=s[M];T[w]=c[M],v[w]=_}for(var D=0;D<m;D++)S===0&&(b[D]=[]),v[D]===_?b[D][S]=u?x(a,T[D]):x(T[D],a):b[D][S]=a}return new t({data:b,size:[m,d],datatype:h})}});function qs(r,e,t,n){if(!(this instanceof qs))throw new SyntaxError("Constructor must be called with the new operator");this.fn=r,this.count=e,this.min=t,this.max=n,this.message="Wrong number of arguments in function "+r+" ("+e+" provided, "+t+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}qs.prototype=new Error;qs.prototype.constructor=Error;qs.prototype.name="ArgumentsError";qs.prototype.isArgumentsError=!0;var TP="gcd",vX=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],jw="number | BigNumber | Fraction | Matrix | Array",yX="".concat(jw,", ").concat(jw,", ...").concat(jw);function MP(r){return!r.some(e=>Array.isArray(e))}var Zw=C(TP,vX,r=>{var{typed:e,matrix:t,config:n,round:i,equalScalar:a,zeros:o,BigNumber:u,DenseMatrix:c,concat:s}=r,l=Rp({typed:e,config:n,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:c,concat:s}),f=Mi({typed:e}),p=nf({typed:e,equalScalar:a}),m=pa({typed:e,DenseMatrix:c}),d=Ft({typed:e,matrix:t,concat:s});return e(TP,{"number, number":h,"BigNumber, BigNumber":x,"Fraction, Fraction":(b,T)=>b.gcd(T)},d({SS:p,DS:f,Ss:m}),{[yX]:e.referToSelf(b=>(T,v,S)=>{for(var _=b(T,v),y=0;y<S.length;y++)_=b(_,S[y]);return _}),Array:e.referToSelf(b=>T=>{if(T.length===1&&Array.isArray(T[0])&&MP(T[0]))return b(...T[0]);if(MP(T))return b(...T);throw new qs("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(b=>T=>b(T.toArray()))});function h(b,T){if(!Je(b)||!Je(T))throw new Error("Parameters in function gcd must be integer numbers");for(var v;T!==0;)v=l(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 u(0);!T.isZero();){var S=l(b,T);b=T,T=S}return b.lt(v)?b.neg():b}});var xX="matAlgo06xS0S0",bX=["typed","equalScalar"],Pu=C(xX,bX,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var u=i._values,c=i._size,s=i._datatype||i._data===void 0?i._datatype:i.getDataType(),l=a._values,f=a._size,p=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==f.length)throw new Mt(c.length,f.length);if(c[0]!==f[0]||c[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+f+")");var m=c[0],d=c[1],h,x=t,b=0,T=o;typeof s=="string"&&s===p&&s!=="mixed"&&(h=s,x=e.find(t,[h,h]),b=e.convert(0,h),T=e.find(o,[h,h]));for(var v=u&&l?[]:void 0,S=[],_=[],y=v?[]:void 0,A=[],M=[],w=0;w<d;w++){_[w]=S.length;var D=w+1;if(y0(i,w,A,y,M,D,S,T),y0(a,w,A,y,M,D,S,T),y)for(var N=_[w];N<S.length;){var B=S[N];if(M[B]===D){var R=y[B];x(R,b)?S.splice(N,1):(v.push(R),N++)}else S.splice(N,1)}else for(var z=_[w];z<S.length;){var V=S[z];M[V]!==D?S.splice(z,1):z++}}return _[d]=S.length,i.createSparseMatrix({values:v,index:S,ptr:_,size:[m,d],datatype:s===i._datatype&&p===a._datatype?h:void 0})}});var DP="lcm",wX=["typed","matrix","equalScalar","concat"],Jw=C(DP,wX,r=>{var{typed:e,matrix:t,equalScalar:n,concat:i}=r,a=Mn({typed:e,equalScalar:n}),o=Pu({typed:e,equalScalar:n}),u=Nr({typed:e,equalScalar:n}),c=Ft({typed:e,matrix:t,concat:i}),s="number | BigNumber | Fraction | Matrix | Array",l={};return l["".concat(s,", ").concat(s,", ...").concat(s)]=e.referToSelf(p=>(m,d,h)=>{for(var x=p(m,d),b=0;b<h.length;b++)x=p(x,h[b]);return x}),e(DP,{"number, number":C0,"BigNumber, BigNumber":f,"Fraction, Fraction":(p,m)=>p.lcm(m)},c({SS:o,DS:a,Ss:u}),l);function f(p,m){if(!p.isInt()||!m.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(p.isZero())return p;if(m.isZero())return m;for(var d=p.times(m);!m.isZero();){var h=m;m=p.mod(h),p=h}return d.div(p).abs()}});var CP="log10",_X=["typed","config","Complex"],Xw=C(CP,_X,r=>{var{typed:e,config:t,Complex:n}=r;return e(CP,{number:function(a){return a>=0||t.predictable?N0(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||t.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>rt(a,i))})});var NP="log2",SX=["typed","config","Complex"],Qw=C(NP,SX,r=>{var{typed:e,config:t,Complex:n}=r;return e(NP,{number:function(o){return o>=0||t.predictable?F0(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||t.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>rt(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 AX="multiplyScalar",EX=["typed"],Kw=C(AX,EX,r=>{var{typed:e}=r;return e("multiplyScalar",{"number, number":S0,"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":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});var FP="multiply",TX=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],e_=C(FP,TX,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=r,u=Nr({typed:e,equalScalar:a}),c=Tn({typed:e});function s(_,y){switch(_.length){case 1:switch(y.length){case 1:if(_[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(_[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+_[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(_[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+_[1]+") must match Vector length ("+y[0]+")");break;case 2:if(_[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+_[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 "+_.length+" dimensions)")}}function l(_,y,A){if(A===0)throw new Error("Cannot multiply two empty vectors");return o(_,y)}function f(_,y){if(y.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(_,y)}function p(_,y){var A=_._data,M=_._size,w=_._datatype||_.getDataType(),D=y._data,N=y._size,B=y._datatype||y.getDataType(),R=M[0],z=N[1],V,k=n,P=i;w&&B&&w===B&&typeof w=="string"&&w!=="mixed"&&(V=w,k=e.find(n,[V,V]),P=e.find(i,[V,V]));for(var W=[],O=0;O<z;O++){for(var X=P(A[0],D[0][O]),ne=1;ne<R;ne++)X=k(X,P(A[ne],D[ne][O]));W[O]=X}return _.createDenseMatrix({data:W,size:[z],datatype:w===_._datatype&&B===y._datatype?V:void 0})}var m=e("_multiplyMatrixVector",{"DenseMatrix, any":h,"SparseMatrix, any":T}),d=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":x,"DenseMatrix, SparseMatrix":b,"SparseMatrix, DenseMatrix":v,"SparseMatrix, SparseMatrix":S});function h(_,y){var A=_._data,M=_._size,w=_._datatype||_.getDataType(),D=y._data,N=y._datatype||y.getDataType(),B=M[0],R=M[1],z,V=n,k=i;w&&N&&w===N&&typeof w=="string"&&w!=="mixed"&&(z=w,V=e.find(n,[z,z]),k=e.find(i,[z,z]));for(var P=[],W=0;W<B;W++){for(var O=A[W],X=k(O[0],D[0]),ne=1;ne<R;ne++)X=V(X,k(O[ne],D[ne]));P[W]=X}return _.createDenseMatrix({data:P,size:[B],datatype:w===_._datatype&&N===y._datatype?z:void 0})}function x(_,y){var A=_._data,M=_._size,w=_._datatype||_.getDataType(),D=y._data,N=y._size,B=y._datatype||y.getDataType(),R=M[0],z=M[1],V=N[1],k,P=n,W=i;w&&B&&w===B&&typeof w=="string"&&w!=="mixed"&&w!=="mixed"&&(k=w,P=e.find(n,[k,k]),W=e.find(i,[k,k]));for(var O=[],X=0;X<R;X++){var ne=A[X];O[X]=[];for(var Z=0;Z<V;Z++){for(var L=W(ne[0],D[0][Z]),pe=1;pe<z;pe++)L=P(L,W(ne[pe],D[pe][Z]));O[X][Z]=L}}return _.createDenseMatrix({data:O,size:[R,V],datatype:w===_._datatype&&B===y._datatype?k:void 0})}function b(_,y){var A=_._data,M=_._size,w=_._datatype||_.getDataType(),D=y._values,N=y._index,B=y._ptr,R=y._size,z=y._datatype||y._data===void 0?y._datatype:y.getDataType();if(!D)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var V=M[0],k=R[1],P,W=n,O=i,X=a,ne=0;w&&z&&w===z&&typeof w=="string"&&w!=="mixed"&&(P=w,W=e.find(n,[P,P]),O=e.find(i,[P,P]),X=e.find(a,[P,P]),ne=e.convert(0,P));for(var Z=[],L=[],pe=[],me=y.createSparseMatrix({values:Z,index:L,ptr:pe,size:[V,k],datatype:w===_._datatype&&z===y._datatype?P:void 0}),oe=0;oe<k;oe++){pe[oe]=L.length;var ve=B[oe],_e=B[oe+1];if(_e>ve)for(var ye=0,be=0;be<V;be++){for(var we=be+1,Ee=void 0,ze=ve;ze<_e;ze++){var Qe=N[ze];ye!==we?(Ee=O(A[be][Qe],D[ze]),ye=we):Ee=W(Ee,O(A[be][Qe],D[ze]))}ye===we&&!X(Ee,ne)&&(L.push(be),Z.push(Ee))}}return pe[k]=L.length,me}function T(_,y){var A=_._values,M=_._index,w=_._ptr,D=_._datatype||_._data===void 0?_._datatype:_.getDataType();if(!A)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=y._data,B=y._datatype||y.getDataType(),R=_._size[0],z=y._size[0],V=[],k=[],P=[],W,O=n,X=i,ne=a,Z=0;D&&B&&D===B&&typeof D=="string"&&D!=="mixed"&&(W=D,O=e.find(n,[W,W]),X=e.find(i,[W,W]),ne=e.find(a,[W,W]),Z=e.convert(0,W));var L=[],pe=[];P[0]=0;for(var me=0;me<z;me++){var oe=N[me];if(!ne(oe,Z))for(var ve=w[me],_e=w[me+1],ye=ve;ye<_e;ye++){var be=M[ye];pe[be]?L[be]=O(L[be],X(oe,A[ye])):(pe[be]=!0,k.push(be),L[be]=X(oe,A[ye]))}}for(var we=k.length,Ee=0;Ee<we;Ee++){var ze=k[Ee];V[Ee]=L[ze]}return P[1]=k.length,_.createSparseMatrix({values:V,index:k,ptr:P,size:[R,1],datatype:D===_._datatype&&B===y._datatype?W:void 0})}function v(_,y){var A=_._values,M=_._index,w=_._ptr,D=_._datatype||_._data===void 0?_._datatype:_.getDataType();if(!A)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var N=y._data,B=y._datatype||y.getDataType(),R=_._size[0],z=y._size[0],V=y._size[1],k,P=n,W=i,O=a,X=0;D&&B&&D===B&&typeof D=="string"&&D!=="mixed"&&(k=D,P=e.find(n,[k,k]),W=e.find(i,[k,k]),O=e.find(a,[k,k]),X=e.convert(0,k));for(var ne=[],Z=[],L=[],pe=_.createSparseMatrix({values:ne,index:Z,ptr:L,size:[R,V],datatype:D===_._datatype&&B===y._datatype?k:void 0}),me=[],oe=[],ve=0;ve<V;ve++){L[ve]=Z.length;for(var _e=ve+1,ye=0;ye<z;ye++){var be=N[ye][ve];if(!O(be,X))for(var we=w[ye],Ee=w[ye+1],ze=we;ze<Ee;ze++){var Qe=M[ze];oe[Qe]!==_e?(oe[Qe]=_e,Z.push(Qe),me[Qe]=W(be,A[ze])):me[Qe]=P(me[Qe],W(be,A[ze]))}}for(var Y=L[ve],Q=Z.length,xe=Y;xe<Q;xe++){var J=Z[xe];ne[xe]=me[J]}}return L[V]=Z.length,pe}function S(_,y){var A=_._values,M=_._index,w=_._ptr,D=_._datatype||_._data===void 0?_._datatype:_.getDataType(),N=y._values,B=y._index,R=y._ptr,z=y._datatype||y._data===void 0?y._datatype:y.getDataType(),V=_._size[0],k=y._size[1],P=A&&N,W,O=n,X=i;D&&z&&D===z&&typeof D=="string"&&D!=="mixed"&&(W=D,O=e.find(n,[W,W]),X=e.find(i,[W,W]));for(var ne=P?[]:void 0,Z=[],L=[],pe=_.createSparseMatrix({values:ne,index:Z,ptr:L,size:[V,k],datatype:D===_._datatype&&z===y._datatype?W:void 0}),me=P?[]:void 0,oe=[],ve,_e,ye,be,we,Ee,ze,Qe,Y=0;Y<k;Y++){L[Y]=Z.length;var Q=Y+1;for(we=R[Y],Ee=R[Y+1],be=we;be<Ee;be++)if(Qe=B[be],P)for(_e=w[Qe],ye=w[Qe+1],ve=_e;ve<ye;ve++)ze=M[ve],oe[ze]!==Q?(oe[ze]=Q,Z.push(ze),me[ze]=X(N[be],A[ve])):me[ze]=O(me[ze],X(N[be],A[ve]));else for(_e=w[Qe],ye=w[Qe+1],ve=_e;ve<ye;ve++)ze=M[ve],oe[ze]!==Q&&(oe[ze]=Q,Z.push(ze));if(P)for(var xe=L[Y],J=Z.length,re=xe;re<J;re++){var se=Z[re];ne[re]=me[se]}}return L[k]=Z.length,pe}return e(FP,i,{"Array, Array":e.referTo("Matrix, Matrix",_=>(y,A)=>{s(lt(y),lt(A));var M=_(t(y),t(A));return et(M)?M.valueOf():M}),"Matrix, Matrix":function(y,A){var M=y.size(),w=A.size();return s(M,w),M.length===1?w.length===1?l(y,A,M[0]):f(y,A):w.length===1?m(y,A):d(y,A)},"Matrix, Array":e.referTo("Matrix,Matrix",_=>(y,A)=>_(y,t(A))),"Array, Matrix":e.referToSelf(_=>(y,A)=>_(t(y,A.storage()),A)),"SparseMatrix, any":function(y,A){return u(y,A,i,!1)},"DenseMatrix, any":function(y,A){return c(y,A,i,!1)},"any, SparseMatrix":function(y,A){return u(A,y,i,!0)},"any, DenseMatrix":function(y,A){return c(A,y,i,!0)},"Array, any":function(y,A){return c(t(y),A,i,!1).valueOf()},"any, Array":function(y,A){return c(t(A),y,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(_=>(y,A,M)=>{for(var w=_(y,A),D=0;D<M.length;D++)w=_(w,M[D]);return w})})});var IP="nthRoot",MX=["typed","matrix","equalScalar","BigNumber","concat"],t_=C(IP,MX,r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,concat:a}=r,o=Mi({typed:e}),u=Mn({typed:e,equalScalar:n}),c=Pu({typed:e,equalScalar:n}),s=Nr({typed:e,equalScalar:n}),l=Ft({typed:e,matrix:t,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(IP,{number:I0,"number, number":I0,BigNumber:m=>p(m,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:e.referTo("DenseMatrix,number",m=>d=>m(t(d),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",m=>d=>m(d,2)),SparseMatrix:e.referTo("SparseMatrix,number",m=>d=>m(d,2)),"SparseMatrix, SparseMatrix":e.referToSelf(m=>(d,h)=>{if(h.density()===1)return c(d,h,m);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(m=>(d,h)=>{if(h.density()===1)return o(d,h,m,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",m=>(d,h)=>m(t(d),h)),"number | BigNumber, SparseMatrix":e.referToSelf(m=>(d,h)=>{if(h.density()===1)return s(h,d,m,!0);throw new Error("Root must be non-zero")})},l({scalar:"number | BigNumber",SD:u,Ss:s,sS:!1}));function p(m,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(m.isNegative()&&!d.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(m.isZero())return v?new x(1/0):0;if(!m.isFinite())return v?b:m;var S=m.abs().pow(T.div(d));return S=m.isNeg()?S.neg():S,new i((v?T.div(S):S).toPrecision(h))}});var PP="sign",DX=["typed","BigNumber","Fraction","complex"],r_=C(PP,DX,r=>{var{typed:e,BigNumber:t,complex:n,Fraction:i}=r;return e(PP,{number:ag,Complex:function(o){return o.im===0?n(ag(o.re)):o.sign()},BigNumber:function(o){return new t(o.cmp(0))},bigint:function(o){return o>0n?1n:o<0n?-1n:0n},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":e.referToSelf(a=>o=>rt(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 CX="sqrt",NX=["config","typed","Complex"],n_=C(CX,NX,r=>{var{config:e,typed:t,Complex:n}=r;return t("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||e.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||e.predictable?Math.sqrt(a):new n(a,0).sqrt()}});var BP="square",FX=["typed"],i_=C(BP,FX,r=>{var{typed:e}=r;return e(BP,{number:P0,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 kP="subtract",IX=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],a_=C(kP,IX,r=>{var{typed:e,matrix:t,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:u}=r,c=Mi({typed:e}),s=zr({typed:e}),l=Iu({typed:e,equalScalar:n}),f=pa({typed:e,DenseMatrix:o}),p=yr({typed:e,DenseMatrix:o}),m=Ft({typed:e,matrix:t,concat:u});return e(kP,{"any, any":i},m({elop:i,SS:l,DS:c,SD:s,Ss:p,sS:f}))});var $P="xgcd",PX=["typed","config","matrix","BigNumber"],o_=C($P,PX,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e($P,{"number, number":function(u,c){var s=B0(u,c);return t.matrix==="Array"?s:n(s)},"BigNumber, BigNumber":a});function a(o,u){var c,s,l,f=new i(0),p=new i(1),m=f,d=p,h=p,x=f;if(!o.isInt()||!u.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!u.isZero();)s=o.div(u).floor(),l=o.mod(u),c=m,m=d.minus(s.times(m)),d=c,c=h,h=x.minus(s.times(h)),x=c,o=u,u=l;var b;return o.lt(f)?b=[o.neg(),d.neg(),x.neg()]:b=[o,o.isZero()?0:d,x],t.matrix==="Array"?b:n(b)}});var OP="invmod",BX=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],s_=C(OP,BX,r=>{var{typed:e,config:t,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:u,add:c,isInteger:s}=r;return e(OP,{"number, number":l,"BigNumber, BigNumber":l});function l(f,p){if(!s(f)||!s(p))throw new Error("Parameters in function invmod must be integer numbers");if(f=u(f,p),a(p,0))throw new Error("Divisor must be non zero");var m=i(f,p);m=m.valueOf();var[d,h]=m;return a(d,n(1))?(h=u(h,p),o(h,n(0))&&(h=c(h,p)),h):NaN}});var kX="matAlgo09xS0Sf",$X=["typed","equalScalar"],fg=C(kX,$X,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var u=i._values,c=i._index,s=i._ptr,l=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==h.length)throw new Mt(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");var b=l[0],T=l[1],v,S=t,_=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,S=e.find(t,[v,v]),_=e.convert(0,v),y=e.find(o,[v,v]));var A=u&&p?[]:void 0,M=[],w=[],D=A?[]:void 0,N=[],B,R,z,V,k;for(R=0;R<T;R++){w[R]=M.length;var P=R+1;if(D)for(V=d[R],k=d[R+1],z=V;z<k;z++)B=m[z],N[B]=P,D[B]=p[z];for(V=s[R],k=s[R+1],z=V;z<k;z++)if(B=c[z],D){var W=N[B]===P?D[B]:_,O=y(u[z],W);S(O,_)||(M.push(B),A.push(O))}else M.push(B)}return w[T]=M.length,i.createSparseMatrix({values:A,index:M,ptr:w,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var RP="dotMultiply",OX=["typed","matrix","equalScalar","multiplyScalar","concat"],u_=C(RP,OX,r=>{var{typed:e,matrix:t,equalScalar:n,multiplyScalar:i,concat:a}=r,o=Mn({typed:e,equalScalar:n}),u=fg({typed:e,equalScalar:n}),c=Nr({typed:e,equalScalar:n}),s=Ft({typed:e,matrix:t,concat:a});return e(RP,s({elop:i,SS:u,DS:o,Ss:c}))});function LP(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero()||e.eq(-1)||r.eq(e))return r;if(e.isZero()||r.eq(-1))return e;if(!r.isFinite()||!e.isFinite()){if(!r.isFinite()&&!e.isFinite())return r.isNegative()===e.isNegative()?r:new t(0);if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e;if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r}return l_(r,e,function(n,i){return n&i})}function af(r){if(r.isFinite()&&!r.isInteger())throw new Error("Integer expected in function bitNot");var e=r.constructor,t=e.precision;e.config({precision:1e9});var n=r.plus(new e(1));return n.s=-n.s||null,e.config({precision:t}),n}function VP(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);var n=new t(-1);return r.isZero()||e.eq(n)||r.eq(e)?e:e.isZero()||r.eq(n)?r:!r.isFinite()||!e.isFinite()?!r.isFinite()&&!r.isNegative()&&e.isNegative()||r.isNegative()&&!e.isNegative()&&!e.isFinite()?n:r.isNegative()&&e.isNegative()?r.isFinite()?r:e:r.isFinite()?e:r:l_(r,e,function(i,a){return i|a})}function l_(r,e,t){var n=r.constructor,i,a,o=+(r.s<0),u=+(e.s<0);if(o){i=pg(af(r));for(var c=0;c<i.length;++c)i[c]^=1}else i=pg(r);if(u){a=pg(af(e));for(var s=0;s<a.length;++s)a[s]^=1}else a=pg(e);var l,f,p;i.length<=a.length?(l=i,f=a,p=o):(l=a,f=i,p=u);var m=l.length,d=f.length,h=t(o,u)^1,x=new n(h^1),b=new n(1),T=new n(2),v=n.precision;for(n.config({precision:1e9});m>0;)t(l[--m],f[--d])===h&&(x=x.plus(b)),b=b.times(T);for(;d>0;)t(p,f[--d])===h&&(x=x.plus(b)),b=b.times(T);return n.config({precision:v}),h===0&&(x.s=-x.s),x}function pg(r){for(var e=r.d,t=e[0]+"",n=1;n<e.length;++n){for(var i=e[n]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;t.charAt(o)==="0";)o--;var u=r.e,c=t.slice(0,o+1||1),s=c.length;if(u>0)if(++u>s)for(u-=s;u--;)c+="0";else u<s&&(c=c.slice(0,u)+"."+c.slice(u));for(var l=[0],f=0;f<c.length;){for(var p=l.length;p--;)l[p]*=10;l[0]+=parseInt(c.charAt(f++));for(var m=0;m<l.length;++m)l[m]>1&&((l[m+1]===null||l[m+1]===void 0)&&(l[m+1]=0),l[m+1]+=l[m]>>1,l[m]&=1)}return l.reverse()}function UP(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero())return e;if(e.isZero())return r;if(r.eq(e))return new t(0);var n=new t(-1);return r.eq(n)?af(e):e.eq(n)?af(r):!r.isFinite()||!e.isFinite()?!r.isFinite()&&!e.isFinite()?n:new t(r.isNegative()===e.isNegative()?1/0:-1/0):l_(r,e,function(i,a){return i^a})}function qP(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:!r.isFinite()&&!e.isFinite()?new t(NaN):e.lt(55)?r.times(Math.pow(2,e.toNumber())+""):r.times(new t(2).pow(e))}function zP(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:e.isFinite()?e.lt(55)?r.div(Math.pow(2,e.toNumber())+"").floor():r.div(new t(2).pow(e)).floor():r.isNegative()?new t(-1):r.isFinite()?new t(0):new t(NaN)}var HP="bitAnd",RX=["typed","matrix","equalScalar","concat"],Lp=C(HP,RX,r=>{var{typed:e,matrix:t,equalScalar:n,concat:i}=r,a=Mn({typed:e,equalScalar:n}),o=Pu({typed:e,equalScalar:n}),u=Nr({typed:e,equalScalar:n}),c=Ft({typed:e,matrix:t,concat:i});return e(HP,{"number, number":$0,"BigNumber, BigNumber":LP,"bigint, bigint":(s,l)=>s&l},c({SS:o,DS:a,Ss:u}))});var GP="bitNot",LX=["typed"],c_=C(GP,LX,r=>{var{typed:e}=r;return e(GP,{number:O0,BigNumber:af,bigint:t=>~t,"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var WP="bitOr",VX=["typed","matrix","equalScalar","DenseMatrix","concat"],Vp=C(WP,VX,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=Mi({typed:e}),u=nf({typed:e,equalScalar:n}),c=pa({typed:e,DenseMatrix:i}),s=Ft({typed:e,matrix:t,concat:a});return e(WP,{"number, number":R0,"BigNumber, BigNumber":VP,"bigint, bigint":(l,f)=>l|f},s({SS:u,DS:o,Ss:c}))});var UX="matAlgo07xSSf",qX=["typed","DenseMatrix"],Ln=C(UX,qX,r=>{var{typed:e,DenseMatrix:t}=r;return function(a,o,u){var c=a._size,s=a._datatype||a._data===void 0?a._datatype:a.getDataType(),l=o._size,f=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(c.length!==l.length)throw new Mt(c.length,l.length);if(c[0]!==l[0]||c[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+l+")");var p=c[0],m=c[1],d,h=0,x=u;typeof s=="string"&&s===f&&s!=="mixed"&&(d=s,h=e.convert(0,d),x=e.find(u,[d,d]));var b,T,v=[];for(b=0;b<p;b++)v[b]=[];var S=[],_=[],y=[],A=[];for(T=0;T<m;T++){var M=T+1;for(n(a,T,y,S,M),n(o,T,A,_,M),b=0;b<p;b++){var w=y[b]===M?S[b]:h,D=A[b]===M?_[b]:h;v[b][T]=x(w,D)}}return new t({data:v,size:[p,m],datatype:s===a._datatype&&f===o._datatype?d:void 0})};function n(i,a,o,u,c){for(var s=i._values,l=i._index,f=i._ptr,p=f[a],m=f[a+1];p<m;p++){var d=l[p];o[d]=c,u[d]=s[p]}}});var YP="bitXor",zX=["typed","matrix","DenseMatrix","concat"],f_=C(YP,zX,r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,a=zr({typed:e}),o=Ln({typed:e,DenseMatrix:n}),u=yr({typed:e,DenseMatrix:n}),c=Ft({typed:e,matrix:t,concat:i});return e(YP,{"number, number":L0,"BigNumber, BigNumber":UP,"bigint, bigint":(s,l)=>s^l},c({SS:o,DS:a,Ss:u}))});var jP="arg",HX=["typed"],p_=C(jP,HX,r=>{var{typed:e}=r;return e(jP,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var ZP="conj",GX=["typed"],m_=C(ZP,GX,r=>{var{typed:e}=r;return e(ZP,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var JP="im",WX=["typed"],d_=C(JP,WX,r=>{var{typed:e}=r;return e(JP,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var XP="re",YX=["typed"],h_=C(XP,YX,r=>{var{typed:e}=r;return e(XP,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var QP="not",jX=["typed"],g_=C(QP,jX,r=>{var{typed:e}=r;return e(QP,{"null | undefined":()=>!0,number:G0,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},bigint:t=>!t,Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var KP="or",ZX=["typed","matrix","equalScalar","DenseMatrix","concat"],Up=C(KP,ZX,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=zr({typed:e}),u=Iu({typed:e,equalScalar:n}),c=yr({typed:e,DenseMatrix:i}),s=Ft({typed:e,matrix:t,concat:a});return e(KP,{"number, number":og,"Complex, Complex":function(f,p){return f.re!==0||f.im!==0||p.re!==0||p.im!==0},"BigNumber, BigNumber":function(f,p){return!f.isZero()&&!f.isNaN()||!p.isZero()&&!p.isNaN()},"bigint, bigint":og,"Unit, Unit":e.referToSelf(l=>(f,p)=>l(f.value||0,p.value||0))},s({SS:u,DS:o,Ss:c}))});var eB="xor",JX=["typed","matrix","DenseMatrix","concat"],v_=C(eB,JX,r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,a=zr({typed:e}),o=Ln({typed:e,DenseMatrix:n}),u=yr({typed:e,DenseMatrix:n}),c=Ft({typed:e,matrix:t,concat:i});return e(eB,{"number, number":sg,"Complex, Complex":function(l,f){return(l.re!==0||l.im!==0)!=(f.re!==0||f.im!==0)},"bigint, bigint":sg,"BigNumber, BigNumber":function(l,f){return(!l.isZero()&&!l.isNaN())!=(!f.isZero()&&!f.isNaN())},"Unit, Unit":e.referToSelf(s=>(l,f)=>s(l.value||0,f.value||0))},c({SS:o,DS:a,Ss:u}))});var tB="concat",XX=["typed","matrix","isInteger"],qp=C(tB,XX,r=>{var{typed:e,matrix:t,isInteger:n}=r;return e(tB,{"...Array | Matrix | number | BigNumber":function(a){var o,u=a.length,c=-1,s,l=!1,f=[];for(o=0;o<u;o++){var p=a[o];if(et(p)&&(l=!0),xt(p)||ut(p)){if(o!==u-1)throw new Error("Dimension must be specified as last argument");if(s=c,c=p.valueOf(),!n(c))throw new TypeError("Integer number expected for dimension");if(c<0||o>0&&c>s)throw new di(c,s+1)}else{var m=dt(p).valueOf(),d=lt(m);if(f[o]=m,s=c,c=d.length-1,o>0&&c!==s)throw new Mt(s+1,c+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var h=f.shift();f.length;)h=d0(h,f.shift(),c);return l?t(h):h},"...string":function(a){return a.join("")}})});var rB="column",QX=["typed","Index","matrix","range"],zp=C(rB,QX,r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e(rB,{"Matrix, number":a,"Array, number":function(u,c){return a(n(dt(u)),c).valueOf()}});function a(o,u){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Ir(u,o.size()[1]);var c=i(0,o.size()[0]),s=new t(c,u),l=o.subset(s);return et(l)?l:n([[l]])}});var nB="count",KX=["typed","size","prod"],y_=C(nB,KX,r=>{var{typed:e,size:t,prod:n}=r;return e(nB,{string:function(a){return a.length},"Matrix | Array":function(a){return n(t(a))}})});var iB="cross",eQ=["typed","matrix","subtract","multiply"],x_=C(iB,eQ,r=>{var{typed:e,matrix:t,subtract:n,multiply:i}=r;return e(iB,{"Matrix, Matrix":function(u,c){return t(a(u.toArray(),c.toArray()))},"Matrix, Array":function(u,c){return t(a(u.toArray(),c))},"Array, Matrix":function(u,c){return t(a(u,c.toArray()))},"Array, Array":a});function a(o,u){var c=Math.max(lt(o).length,lt(u).length);o=Xc(o),u=Xc(u);var s=lt(o),l=lt(u);if(s.length!==1||l.length!==1||s[0]!==3||l[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+s.join(", ")+"], B = ["+l.join(", ")+"])");var f=[n(i(o[1],u[2]),i(o[2],u[1])),n(i(o[2],u[0]),i(o[0],u[2])),n(i(o[0],u[1]),i(o[1],u[0]))];return c>1?[f]:f}});var aB="diag",tQ=["typed","matrix","DenseMatrix","SparseMatrix"],b_=C(aB,tQ,r=>{var{typed:e,matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(aB,{Array:function(s){return a(s,0,lt(s),null)},"Array, number":function(s,l){return a(s,l,lt(s),null)},"Array, BigNumber":function(s,l){return a(s,l.toNumber(),lt(s),null)},"Array, string":function(s,l){return a(s,0,lt(s),l)},"Array, number, string":function(s,l,f){return a(s,l,lt(s),f)},"Array, BigNumber, string":function(s,l,f){return a(s,l.toNumber(),lt(s),f)},Matrix:function(s){return a(s,0,s.size(),s.storage())},"Matrix, number":function(s,l){return a(s,l,s.size(),s.storage())},"Matrix, BigNumber":function(s,l){return a(s,l.toNumber(),s.size(),s.storage())},"Matrix, string":function(s,l){return a(s,0,s.size(),l)},"Matrix, number, string":function(s,l,f){return a(s,l,s.size(),f)},"Matrix, BigNumber, string":function(s,l,f){return a(s,l.toNumber(),s.size(),f)}});function a(c,s,l,f){if(!Je(s))throw new TypeError("Second parameter in function diag must be an integer");var p=s>0?s:0,m=s<0?-s:0;switch(l.length){case 1:return o(c,s,f,l[0],m,p);case 2:return u(c,s,f,l,m,p)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(c,s,l,f,p,m){var d=[f+p,f+m];if(l&&l!=="sparse"&&l!=="dense")throw new TypeError("Unknown matrix type ".concat(l,'"'));var h=l==="sparse"?i.diagonal(d,c,s):n.diagonal(d,c,s);return l!==null?h:h.valueOf()}function u(c,s,l,f,p,m){if(et(c)){var d=c.diagonal(s);return l!==null?l!==d.storage()?t(d,l):d:d.valueOf()}for(var h=Math.min(f[0]-p,f[1]-m),x=[],b=0;b<h;b++)x[b]=c[b+p][b+m];return l!==null?t(x):x}});var rQ="filter",nQ=["typed"],Hp=C(rQ,nQ,r=>{var{typed:e}=r;return e("filter",{"Array, function":oB,"Matrix, function":function(n,i){return n.create(oB(n.valueOf(),i),n.datatype())},"Array, RegExp":p0,"Matrix, RegExp":function(n,i){return n.create(p0(n.valueOf(),i),n.datatype())}})});function oB(r,e){var t=lo(e,r,"filter");return U2(r,function(n,i,a){return t(n,[i],a)})}var sB="flatten",iQ=["typed"],w_=C(sB,iQ,r=>{var{typed:e}=r;return e(sB,{Array:function(n){return kt(n)},Matrix:function(n){return n.create(kt(n.toArray()),n.datatype())}})});var __="forEach",aQ=["typed"],Gp=C(__,aQ,r=>{var{typed:e}=r;return e(__,{"Array, function":oQ,"Matrix, function":function(n,i){n.forEach(i)}})});function oQ(r,e){Pp(r,[],r,lo(e,r,__))}var uB="getMatrixDataType",sQ=["typed"],S_=C(uB,sQ,r=>{var{typed:e}=r;return e(uB,{Array:function(n){return Nl(n,ur)},Matrix:function(n){return n.getDataType()}})});var lB="identity",uQ=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],A_=C(lB,uQ,r=>{var{typed:e,config:t,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=r;return e(lB,{"":function(){return t.matrix==="Matrix"?n([]):[]},string:function(l){return n(l)},"number | BigNumber":function(l){return c(l,l,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(l,f){return c(l,l,f)},"number | BigNumber, number | BigNumber":function(l,f){return c(l,f,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(l,f,p){return c(l,f,p)},Array:function(l){return u(l)},"Array, string":function(l,f){return u(l,f)},Matrix:function(l){return u(l.valueOf(),l.storage())},"Matrix, string":function(l,f){return u(l.valueOf(),f)}});function u(s,l){switch(s.length){case 0:return l?n(l):[];case 1:return c(s[0],s[0],l);case 2:return c(s[0],s[1],l);default:throw new Error("Vector containing two values expected")}}function c(s,l,f){var p=ut(s)||ut(l)?i:null;if(ut(s)&&(s=s.toNumber()),ut(l)&&(l=l.toNumber()),!Je(s)||s<1)throw new Error("Parameters in function identity must be positive integers");if(!Je(l)||l<1)throw new Error("Parameters in function identity must be positive integers");var m=p?new i(1):1,d=p?new p(0):0,h=[s,l];if(f){if(f==="sparse")return o.diagonal(h,m,0,d);if(f==="dense")return a.diagonal(h,m,0,d);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var x=Bo([],h,d),b=s<l?s:l,T=0;T<b;T++)x[T][T]=m;return x}});var cB="kron",lQ=["typed","matrix","multiplyScalar"],E_=C(cB,lQ,r=>{var{typed:e,matrix:t,multiplyScalar:n}=r;return e(cB,{"Matrix, Matrix":function(o,u){return t(i(o.toArray(),u.toArray()))},"Matrix, Array":function(o,u){return t(i(o.toArray(),u))},"Array, Matrix":function(o,u){return t(i(o,u.toArray()))},"Array, Array":i});function i(a,o){if(lt(a).length===1&&(a=[a]),lt(o).length===1&&(o=[o]),lt(a).length>2||lt(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 u=[],c=[];return a.map(function(s){return o.map(function(l){return c=[],u.push(c),s.map(function(f){return l.map(function(p){return c.push(n(f,p))})})})})&&u}});var T_="map",cQ=["typed"],Wp=C(T_,cQ,r=>{var{typed:e}=r;return e(T_,{"Array, function":n,"Matrix, function":function(a,o){return a.map(o)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(i,a,o)=>t([i,a,...o.slice(0,o.length-1)],o[o.length-1])});function t(i,a){if(typeof a!="function")throw new Error("Last argument must be a callback function");var o=i[0].isMatrix,u=Ip(...i.map(S=>S.isMatrix?S.size():lt(S))),c=o?(S,_)=>S.get(_):Kc,s=o?i.map(S=>S.isMatrix?S.create(ts(S.toArray(),u),S.datatype()):i[0].create(ts(S.valueOf(),u))):i.map(S=>S.isMatrix?ts(S.toArray(),u):ts(S,u)),l;if(e.isTypedFunction(a)){var f=u.map(()=>0),p=s.map(S=>c(S,f)),m=v(a,p,f,s);l=b(m)}else{var d=i.length,h=T(a,d);l=b(h)}var x=(S,_)=>l([S,...s.slice(1).map(y=>c(y,_))],_);if(o)return s[0].map(x);return n(s[0],x);function b(S){switch(S){case 0:return _=>a(..._);case 1:return(_,y)=>a(..._,y);case 2:return(_,y)=>a(..._,y,...s)}}function T(S,_){return S.length>_+1?2:S.length===_+1?1:0}function v(S,_,y,A){return e.resolve(S,[..._,y,...A])!==null?2:e.resolve(S,[..._,y])!==null?1:(e.resolve(S,_)!==null,0)}}function n(i,a){return Pp(i,[],i,lo(a,i,T_))}});var fB="diff",fQ=["typed","matrix","subtract","number"],Yp=C(fB,fQ,r=>{var{typed:e,matrix:t,subtract:n,number:i}=r;return e(fB,{"Array | Matrix":function(l){return et(l)?t(o(l.toArray())):o(l)},"Array | Matrix, number":function(l,f){if(!Je(f))throw new RangeError("Dimension must be a whole number");return et(l)?t(a(l.toArray(),f)):a(l,f)},"Array, BigNumber":e.referTo("Array,number",s=>(l,f)=>s(l,i(f))),"Matrix, BigNumber":e.referTo("Matrix,number",s=>(l,f)=>s(l,i(f)))});function a(s,l){if(et(s)&&(s=s.toArray()),!Array.isArray(s))throw RangeError("Array/Matrix does not have that many dimensions");if(l>0){var f=[];return s.forEach(p=>{f.push(a(p,l-1))}),f}else{if(l===0)return o(s);throw RangeError("Cannot have negative dimension")}}function o(s){for(var l=[],f=s.length,p=1;p<f;p++)l.push(u(s[p-1],s[p]));return l}function u(s,l){et(s)&&(s=s.toArray()),et(l)&&(l=l.toArray());var f=Array.isArray(s),p=Array.isArray(l);if(f&&p)return c(s,l);if(!f&&!p)return n(l,s);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function c(s,l){if(s.length!==l.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],p=s.length,m=0;m<p;m++)f.push(u(s[m],l[m]));return f}});var pQ="ones",mQ=["typed","config","matrix","BigNumber"],M_=C(pQ,mQ,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e("ones",{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(s){var l=s[s.length-1];if(typeof l=="string"){var f=s.pop();return a(s,f)}else return t.matrix==="Array"?a(s):a(s,"default")},Array:a,Matrix:function(s){var l=s.storage();return a(s.valueOf(),l)},"Array | Matrix, string":function(s,l){return a(s.valueOf(),l)}});function a(c,s){var l=o(c),f=l?new i(1):1;if(u(c),s){var p=n(s);return c.length>0?p.resize(c,f):p}else{var m=[];return c.length>0?Bo(m,c,f):m}}function o(c){var s=!1;return c.forEach(function(l,f,p){ut(l)&&(s=!0,p[f]=l.toNumber())}),s}function u(c){c.forEach(function(s){if(typeof s!="number"||!Je(s)||s<0)throw new Error("Parameters in function ones must be positive integers")})}});function of(){throw new Error('No "bignumber" implementation available')}function mg(){throw new Error('No "fraction" implementation available')}function dg(){throw new Error('No "matrix" implementation available')}var pB="range",dQ=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],jp=C(pB,dQ,r=>{var{typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:c,add:s,isPositive:l}=r;return e(pB,{string:p,"string, boolean":p,"number, number":function(x,b){return f(m(x,b,1,!1))},"number, number, number":function(x,b,T){return f(m(x,b,T,!1))},"number, number, boolean":function(x,b,T){return f(m(x,b,1,T))},"number, number, number, boolean":function(x,b,T,v){return f(m(x,b,T,v))},"BigNumber, BigNumber":function(x,b){var T=x.constructor;return f(m(x,b,new T(1),!1))},"BigNumber, BigNumber, BigNumber":function(x,b,T){return f(m(x,b,T,!1))},"BigNumber, BigNumber, boolean":function(x,b,T){var v=x.constructor;return f(m(x,b,new v(1),T))},"BigNumber, BigNumber, BigNumber, boolean":function(x,b,T,v){return f(m(x,b,T,v))},"Unit, Unit, Unit":function(x,b,T){return f(m(x,b,T,!1))},"Unit, Unit, Unit, boolean":function(x,b,T,v){return f(m(x,b,T,v))}});function f(h){return t.matrix==="Matrix"?n?n(h):dg():h}function p(h,x){var b=d(h);if(!b)throw new SyntaxError('String "'+h+'" is no valid range');return t.number==="BigNumber"?(i===void 0&&of(),f(m(i(b.start),i(b.end),i(b.step)),x)):f(m(b.start,b.end,b.step,x))}function m(h,x,b,T){for(var v=[],S=l(b)?T?o:a:T?c:u,_=h;S(_,x);)v.push(_),_=s(_,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 mB="reshape",hQ=["typed","isInteger","matrix"],D_=C(mB,hQ,r=>{var{typed:e,isInteger:t}=r;return e(mB,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!t(o))throw new TypeError("Invalid size for dimension: "+o)}),Np(i,a)}})});var gQ="resize",vQ=["config","matrix"],C_=C(gQ,vQ,r=>{var{config:e,matrix:t}=r;return function(a,o,u){if(arguments.length!==2&&arguments.length!==3)throw new qs("resize",arguments.length,2,3);if(et(o)&&(o=o.valueOf()),ut(o[0])&&(o=o.map(function(l){return ut(l)?l.toNumber():l})),et(a))return a.resize(o,u,!0);if(typeof a=="string")return n(a,o,u);var c=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return dt(a)}else{Array.isArray(a)||(a=[a]),a=dt(a);var s=Bo(a,o,u);return c?t(s):s}};function n(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new Mt(a.length,1);var u=a[0];if(typeof u!="number"||!Je(u))throw new TypeError("Invalid size, must contain positive integers (size: "+Et(a)+")");if(i.length>u)return i.substring(0,u);if(i.length<u){for(var c=i,s=0,l=u-i.length;s<l;s++)c+=o;return c}else return i}});var dB="rotate",yQ=["typed","multiply","rotationMatrix"],N_=C(dB,yQ,r=>{var{typed:e,multiply:t,rotationMatrix:n}=r;return e(dB,{"Array , number | BigNumber | Complex | Unit":function(o,u){i(o,2);var c=t(n(u),o);return c.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,u){return i(o,2),t(n(u),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,u,c){i(o,3);var s=t(n(u,c),o);return s},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,u,c){return i(o,3),t(n(u,c),o)}});function i(a,o){var u=Array.isArray(a)?lt(a):a.size();if(u.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(u.length===2&&u[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(u[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var hB="rotationMatrix",xQ=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],F_=C(hB,xQ,r=>{var{typed:e,config:t,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:u,matrix:c,DenseMatrix:s,SparseMatrix:l,cos:f,sin:p}=r;return e(hB,{"":function(){return t.matrix==="Matrix"?c([]):[]},string:function(v){return c(v)},"number | BigNumber | Complex | Unit":function(v){return m(v,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(v,S){return m(v,S)},"number | BigNumber | Complex | Unit, Array":function(v,S){var _=c(S);return d(_),b(v,_,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(v,S){d(S);var _=S.storage()||(t.matrix==="Matrix"?"dense":void 0);return b(v,S,_)},"number | BigNumber | Complex | Unit, Array, string":function(v,S,_){var y=c(S);return d(y),b(v,y,_)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,S,_){return d(S),b(v,S,_)}});function m(T,v){var S=ut(T),_=S?new u(-1):-1,y=f(T),A=p(T),M=[[y,n(_,A)],[A,y]];return x(M,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,S)=>n(v,S))}function x(T,v){if(v){if(v==="sparse")return new l(T);if(v==="dense")return new s(T);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return T}function b(T,v,S){var _=o(v);if(_===0)throw new RangeError("Rotation around zero vector");var y=ut(T)?u:null,A=y?new y(1):1,M=y?new y(-1):-1,w=y?new y(v.get([0])/_):v.get([0])/_,D=y?new y(v.get([1])/_):v.get([1])/_,N=y?new y(v.get([2])/_):v.get([2])/_,B=f(T),R=i(A,a(B)),z=p(T),V=i(B,h([w,w,R])),k=i(h([w,D,R]),h([M,N,z])),P=i(h([w,N,R]),h([D,z])),W=i(h([w,D,R]),h([N,z])),O=i(B,h([D,D,R])),X=i(h([D,N,R]),h([M,w,z])),ne=i(h([w,N,R]),h([M,D,z])),Z=i(h([D,N,R]),h([w,z])),L=i(B,h([N,N,R])),pe=[[V,k,P],[W,O,X],[ne,Z,L]];return x(pe,S)}});var gB="row",bQ=["typed","Index","matrix","range"],Zp=C(gB,bQ,r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e(gB,{"Matrix, number":a,"Array, number":function(u,c){return a(n(dt(u)),c).valueOf()}});function a(o,u){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Ir(u,o.size()[0]);var c=i(0,o.size()[1]),s=new t(u,c),l=o.subset(s);return et(l)?l:n([[l]])}});var vB="size",wQ=["typed","config","?matrix"],I_=C(vB,wQ,r=>{var{typed:e,config:t,matrix:n}=r;return e(vB,{Matrix:function(a){return a.create(a.size(),"number")},Array:lt,string:function(a){return t.matrix==="Array"?[a.length]:n([a.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(a){return t.matrix==="Array"?[]:n?n([],"dense","number"):dg()}})});var yB="squeeze",_Q=["typed"],P_=C(yB,_Q,r=>{var{typed:e}=r;return e(yB,{Array:function(n){return Xc(dt(n))},Matrix:function(n){var i=Xc(n.toArray());return Array.isArray(i)?n.create(i,n.datatype()):i},any:function(n){return dt(n)}})});var xB="subset",SQ=["typed","matrix","zeros","add"],Jp=C(xB,SQ,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r;return e(xB,{"Matrix, Index":function(u,c){return Cl(c)?t():(Cp(u,c),u.subset(c))},"Array, Index":e.referTo("Matrix, Index",function(o){return function(u,c){var s=o(t(u),c);return c.isScalar()?s:s.valueOf()}}),"Object, Index":EQ,"string, Index":AQ,"Matrix, Index, any, any":function(u,c,s,l){return Cl(c)?u:(Cp(u,c),u.clone().subset(c,a(s,c),l))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,c,s,l){var f=o(t(u),c,s,l);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,c,s){return o(t(u),c,s,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,c,s){return o(u,c,s,void 0)}}),"string, Index, string":bB,"string, Index, string, string":bB,"Object, Index, any":TQ});function a(o,u){if(typeof o=="string")throw new Error("can't boradcast a string");if(u._isScalar)return o;var c=u.size();if(c.every(s=>s>0))try{return i(o,n(c))}catch{return o}else return o}});function AQ(r,e){if(!Eu(e))throw new TypeError("Index expected");if(Cl(e))return"";if(Cp(Array.from(r),e),e.size().length!==1)throw new Mt(e.size().length,1);var t=r.length;Ir(e.min()[0],t),Ir(e.max()[0],t);var n=e.dimension(0),i="";return n.forEach(function(a){i+=r.charAt(a)}),i}function bB(r,e,t,n){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Cl(e))return r;if(Cp(Array.from(r),e),e.size().length!==1)throw new Mt(e.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=e.dimension(0),a=i.size()[0];if(a!==t.length)throw new Mt(i.size()[0],t.length);var o=r.length;Ir(e.min()[0]),Ir(e.max()[0]);for(var u=[],c=0;c<o;c++)u[c]=r.charAt(c);if(i.forEach(function(f,p){u[f]=t.charAt(p[0])}),u.length>o)for(var s=o-1,l=u.length;s<l;s++)u[s]||(u[s]=n);return u.join("")}function EQ(r,e){if(!Cl(e)){if(e.size().length!==1)throw new Mt(e.size(),1);var t=e.dimension(0);if(typeof t!="string")throw new TypeError("String expected as index to retrieve an object property");return Kr(r,t)}}function TQ(r,e,t){if(Cl(e))return r;if(e.size().length!==1)throw new Mt(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=dt(r);return Qo(i,n,t),i}var wB="transpose",MQ=["typed","matrix"],B_=C(wB,MQ,r=>{var{typed:e,matrix:t}=r;return e(wB,{Array:o=>n(t(o)).valueOf(),Matrix:n,any:dt});function n(o){var u=o.size(),c;switch(u.length){case 1:c=o.clone();break;case 2:{var s=u[0],l=u[1];if(l===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Et(u)+")");switch(o.storage()){case"dense":c=i(o,s,l);break;case"sparse":c=a(o,s,l);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Et(u)+")")}return c}function i(o,u,c){for(var s=o._data,l=[],f,p=0;p<c;p++){f=l[p]=[];for(var m=0;m<u;m++)f[m]=dt(s[m][p])}return o.createDenseMatrix({data:l,size:[c,u],datatype:o._datatype})}function a(o,u,c){for(var s=o._values,l=o._index,f=o._ptr,p=s?[]:void 0,m=[],d=[],h=[],x=0;x<u;x++)h[x]=0;var b,T,v;for(b=0,T=l.length;b<T;b++)h[l[b]]++;for(var S=0,_=0;_<u;_++)d.push(S),S+=h[_],h[_]=d[_];for(d.push(S),v=0;v<c;v++)for(var y=f[v],A=f[v+1],M=y;M<A;M++){var w=h[l[M]]++;m[w]=v,s&&(p[w]=dt(s[M]))}return o.createSparseMatrix({values:p,index:m,ptr:d,size:[c,u],datatype:o._datatype})}});var _B="ctranspose",DQ=["typed","transpose","conj"],k_=C(_B,DQ,r=>{var{typed:e,transpose:t,conj:n}=r;return e(_B,{any:function(a){return n(t(a))}})});var SB="zeros",CQ=["typed","config","matrix","BigNumber"],$_=C(SB,CQ,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(SB,{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(s){var l=s[s.length-1];if(typeof l=="string"){var f=s.pop();return a(s,f)}else return t.matrix==="Array"?a(s):a(s,"default")},Array:a,Matrix:function(s){var l=s.storage();return a(s.valueOf(),l)},"Array | Matrix, string":function(s,l){return a(s.valueOf(),l)}});function a(c,s){var l=o(c),f=l?new i(0):0;if(u(c),s){var p=n(s);return c.length>0?p.resize(c,f):p}else{var m=[];return c.length>0?Bo(m,c,f):m}}function o(c){var s=!1;return c.forEach(function(l,f,p){ut(l)&&(s=!0,p[f]=l.toNumber())}),s}function u(c){c.forEach(function(s){if(typeof s!="number"||!Je(s)||s<0)throw new Error("Parameters in function zeros must be positive integers")})}});var AB="fft",NQ=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],O_=C(AB,NQ,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:u,i:c,dotDivide:s,conj:l,pow:f,ceil:p,log2:m}=r;return e(AB,{Array:d,Matrix:function(v){return v.create(d(v.valueOf()),v.datatype())}});function d(T){var v=lt(T);return v.length===1?b(T,v[0]):h(T.map(S=>d(S,v.slice(1))),0)}function h(T,v){var S=lt(T);if(v!==0)return new Array(S[0]).fill(0).map((y,A)=>h(T[A],v-1));if(S.length===1)return b(T);function _(y){var A=lt(y);return new Array(A[1]).fill(0).map((M,w)=>new Array(A[0]).fill(0).map((D,N)=>y[N][w]))}return _(h(_(T),1))}function x(T){for(var v=T.length,S=o(a(i(-1,i(c,u)),v)),_=[],y=1-v;y<v;y++)_.push(f(S,a(f(y,2),2)));for(var A=f(2,p(m(v+v-1))),M=[...new Array(v).fill(0).map((k,P)=>i(T[P],_[v-1+P])),...new Array(A-v).fill(0)],w=[...new Array(v+v-1).fill(0).map((k,P)=>a(1,_[P])),...new Array(A-(v+v-1)).fill(0)],D=b(M),N=b(w),B=new Array(A).fill(0).map((k,P)=>i(D[P],N[P])),R=s(l(d(l(B))),A),z=[],V=v-1;V<v+v-1;V++)z.push(i(R[V],_[V]));return z}function b(T){var v=T.length;if(v===1)return[T[0]];if(v%2===0){for(var S=[...b(T.filter((M,w)=>w%2===0),v/2),...b(T.filter((M,w)=>w%2===1),v/2)],_=0;_<v/2;_++){var y=S[_],A=i(S[_+v/2],o(i(i(u,c),a(-_,v))));S[_]=n(y,A),S[_+v/2]=n(y,i(-1,A))}return S}else return x(T)}});var EB="ifft",FQ=["typed","fft","dotDivide","conj"],R_=C(EB,FQ,r=>{var{typed:e,fft:t,dotDivide:n,conj:i}=r;return e(EB,{"Array | Matrix":function(o){var u=et(o)?o.size():lt(o);return n(i(t(i(o))),u.reduce((c,s)=>c*s,1))}})});function Pl(r){"@babel/helpers - typeof";return Pl=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},Pl(r)}function TB(r,e){if(Pl(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Pl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function MB(r){var e=TB(r,"string");return Pl(e)=="symbol"?e:e+""}function wr(r,e,t){return(e=MB(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function DB(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function IQ(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?DB(Object(t),!0).forEach(function(n){wr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):DB(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var PQ="solveODE",BQ=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],L_=C(PQ,BQ,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,max:o,map:u,abs:c,isPositive:s,isNegative:l,larger:f,smaller:p,matrix:m,bignumber:d,unaryMinus:h}=r;function x(M){return function(w,D,N,B){var R=!(D.length===2&&(D.every(y)||D.every(ci)));if(R)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var z=D[0],V=D[1],k=f(V,z),P=B.firstStep;if(P!==void 0&&!s(P))throw new Error('"firstStep" must be positive');var W=B.maxStep;if(W!==void 0&&!s(W))throw new Error('"maxStep" must be positive');var O=B.minStep;if(O&&l(O))throw new Error('"minStep" must be positive or zero');var X=[z,V,P,O,W].filter(qe=>qe!==void 0);if(!(X.every(y)||X.every(ci)))throw new Error('Inconsistent type of "t" dependant variables');for(var ne=1,Z=B.tol?B.tol:1e-4,L=B.minDelta?B.minDelta:.2,pe=B.maxDelta?B.maxDelta:5,me=B.maxIter?B.maxIter:1e4,oe=[z,V,...N,W,O].some(ut),[ve,_e,ye,be]=oe?[d(M.a),d(M.c),d(M.b),d(M.bp)]:[M.a,M.c,M.b,M.bp],we=P?k?P:h(P):a(n(V,z),ne),Ee=[z],ze=[N],Qe=n(ye,be),Y=0,Q=0,xe=S(k),J=_(k);xe(Ee[Y],V);){var re=[];we=J(Ee[Y],V,we),re.push(w(Ee[Y],ze[Y]));for(var se=1;se<_e.length;++se)re.push(w(t(Ee[Y],i(_e[se],we)),t(ze[Y],i(we,ve[se],re))));var Ae=o(c(u(i(Qe,re),qe=>ci(qe)?qe.value:qe)));Ae<Z&&Z/Ae>1/4&&(Ee.push(t(Ee[Y],we)),ze.push(t(ze[Y],i(we,ye,re))),Y++);var Te=.84*(Z/Ae)**(1/5);if(p(Te,L)?Te=L:f(Te,pe)&&(Te=pe),Te=oe?d(Te):Te,we=i(we,Te),W&&f(c(we),W)?we=k?W:h(W):O&&p(c(we),O)&&(we=k?O:h(O)),Q++,Q>me)throw new Error("Maximum number of iterations reached, try changing options")}return{t:Ee,y:ze}}}function b(M,w,D,N){var B=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],R=[null,1/2,3/4,1],z=[2/9,1/3,4/9,0],V=[7/24,1/4,1/3,1/8],k={a:B,c:R,b:z,bp:V};return x(k)(M,w,D,N)}function T(M,w,D,N){var B=[[],[.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],z=[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:B,c:R,b:z,bp:V};return x(k)(M,w,D,N)}function v(M,w,D,N){var B=N.method?N.method:"RK45",R={RK23:b,RK45:T};if(B.toUpperCase()in R){var z=IQ({},N);return delete z.method,R[B.toUpperCase()](M,w,D,z)}else{var V=Object.keys(R).map(P=>'"'.concat(P,'"')),k="".concat(V.slice(0,-1).join(", ")," and ").concat(V.slice(-1));throw new Error('Unavailable method "'.concat(B,'". Available methods are ').concat(k))}}function S(M){return M?p:f}function _(M){var w=M?f:p;return function(D,N,B){var R=t(D,B);return w(R,N)?n(N,D):B}}function y(M){return ut(M)||xt(M)}function A(M,w,D,N){var B=v(M,w.toArray(),D.toArray(),N);return{t:m(B.t),y:m(B.y)}}return e("solveODE",{"function, Array, Array, Object":v,"function, Matrix, Matrix, Object":A,"function, Array, Array":(M,w,D)=>v(M,w,D,{}),"function, Matrix, Matrix":(M,w,D)=>A(M,w,D,{}),"function, Array, number | BigNumber | Unit":(M,w,D)=>{var N=v(M,w,[D],{});return{t:N.t,y:N.y.map(B=>B[0])}},"function, Matrix, number | BigNumber | Unit":(M,w,D)=>{var N=v(M,w.toArray(),[D],{});return{t:m(N.t),y:m(N.y.map(B=>B[0]))}},"function, Array, number | BigNumber | Unit, Object":(M,w,D,N)=>{var B=v(M,w,[D],N);return{t:B.t,y:B.y.map(R=>R[0])}},"function, Matrix, number | BigNumber | Unit, Object":(M,w,D,N)=>{var B=v(M,w.toArray(),[D],N);return{t:m(B.t),y:m(B.y.map(R=>R[0]))}}})});var kQ="erf",$Q=["typed"],V_=C(kQ,$Q,r=>{var{typed:e}=r;return e("name",{number:function(o){var u=Math.abs(o);return u>=LQ?so(o):u<=OQ?so(o)*t(u):u<=4?so(o)*(1-n(u)):so(o)*(1-i(u))},"Array | Matrix":e.referToSelf(a=>o=>rt(o,a))});function t(a){var o=a*a,u=zs[0][4]*o,c=o,s;for(s=0;s<3;s+=1)u=(u+zs[0][s])*o,c=(c+sf[0][s])*o;return a*(u+zs[0][3])/(c+sf[0][3])}function n(a){var o=zs[1][8]*a,u=a,c;for(c=0;c<7;c+=1)o=(o+zs[1][c])*a,u=(u+sf[1][c])*a;var s=(o+zs[1][7])/(u+sf[1][7]),l=parseInt(a*16)/16,f=(a-l)*(a+l);return Math.exp(-l*l)*Math.exp(-f)*s}function i(a){var o=1/(a*a),u=zs[2][5]*o,c=o,s;for(s=0;s<4;s+=1)u=(u+zs[2][s])*o,c=(c+sf[2][s])*o;var l=o*(u+zs[2][4])/(c+sf[2][4]);l=(RQ-l)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*l}}),OQ=.46875,RQ=.5641895835477563,zs=[[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]],sf=[[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]],LQ=Math.pow(2,53);var CB="zeta",VQ=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],U_=C(CB,VQ,r=>{var{typed:e,config:t,multiply:n,pow:i,divide:a,factorial:o,equal:u,smallerEq:c,isNegative:s,gamma:l,sin:f,subtract:p,add:m,Complex:d,BigNumber:h,pi:x}=r;return e(CB,{number:y=>b(y,A=>A,()=>20),BigNumber:y=>b(y,A=>new h(A),()=>Math.abs(Math.log10(t.relTol))),Complex:T});function b(y,A,M){return u(y,0)?A(-.5):u(y,1)?A(NaN):isFinite(y)?v(y,A,M,w=>w):s(y)?A(NaN):A(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,A=>A,A=>Math.round(1.3*15+.9*Math.abs(A.im)),A=>A.re)}function v(y,A,M,w){var D=M(y);if(w(y)>-(D-1)/2)return _(y,A(D),A);var N=n(i(2,y),i(A(x),p(y,1)));return N=n(N,f(n(a(A(x),2),y))),N=n(N,l(p(1,y))),n(N,v(p(1,y),A,M,w))}function S(y,A){for(var M=y,w=y;c(w,A);w=m(w,1)){var D=a(n(o(m(A,p(w,1))),i(4,w)),n(o(p(A,w)),o(n(2,w))));M=m(M,D)}return n(A,M)}function _(y,A,M){for(var w=a(1,n(S(M(0),A),p(1,i(2,p(1,y))))),D=M(0),N=M(1);c(N,A);N=m(N,1))D=m(D,a(n((-1)**(N-1),S(N,A)),i(N,y)));return n(w,D)}});var NB="mode",UQ=["typed","isNaN","isNumeric"],q_=C(NB,UQ,r=>{var{typed:e,isNaN:t,isNumeric:n}=r;return e(NB,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=kt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var u={},c=[],s=0,l=0;l<a.length;l++){var f=a[l];if(n(f)&&t(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in u||(u[f]=0),u[f]++,u[f]===s?c.push(f):u[f]>s&&(s=u[f],c=[f])}return c}});function gn(r,e,t){var n;return String(r).includes("Unexpected type")?(n=arguments.length>2?" (type: "+ur(t)+", value: "+JSON.stringify(t)+")":" (type: "+r.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(r).includes("complex numbers")?(n=arguments.length>2?" (type: "+ur(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):r}var FB="prod",qQ=["typed","config","multiplyScalar","numeric"],z_=C(FB,qQ,r=>{var{typed:e,config:t,multiplyScalar:n,numeric:i}=r;return e(FB,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(u,c){throw new Error("prod(A, dim) is not yet supported")},"...":function(u){return a(u)}});function a(o){var u;if(Ti(o,function(c){try{u=u===void 0?c:n(u,c)}catch(s){throw gn(s,"prod",c)}}),typeof u=="string"&&(u=i(u,Ai(u,t))),u===void 0)throw new Error("Cannot calculate prod of an empty array");return u}});var IB="format",zQ=["typed"],H_=C(IB,zQ,r=>{var{typed:e}=r;return e(IB,{any:Et,"any, Object | function | number | BigNumber":Et})});var PB="bin",HQ=["typed","format"],G_=C(PB,HQ,r=>{var{typed:e,format:t}=r;return e(PB,{"number | BigNumber":function(i){return t(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"bin",wordSize:a})}})});var BB="oct",GQ=["typed","format"],W_=C(BB,GQ,r=>{var{typed:e,format:t}=r;return e(BB,{"number | BigNumber":function(i){return t(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"oct",wordSize:a})}})});var kB="hex",WQ=["typed","format"],Y_=C(kB,WQ,r=>{var{typed:e,format:t}=r;return e(kB,{"number | BigNumber":function(i){return t(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"hex",wordSize:a})}})});var hg=/\$([\w.]+)/g;var $B="print",YQ=["typed"],Xp=C($B,YQ,r=>{var{typed:e}=r;return e($B,{"string, Object | Array":OB,"string, Object | Array, number | Object":OB})});function OB(r,e,t){return r.replace(hg,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 u=a.shift();o=u?o[u]:o+"."}return o!==void 0?dn(o)?o:Et(o,t):n})}var RB="to",jQ=["typed","matrix","concat"],j_=C(RB,jQ,r=>{var{typed:e,matrix:t,concat:n}=r,i=Ft({typed:e,matrix:t,concat:n});return e(RB,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var LB="isPrime",ZQ=["typed"],Z_=C(LB,ZQ,r=>{var{typed:e}=r;return e(LB,{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,S){for(var _=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),T=T.mul(T).mod(S)):(v=v.sub(1),_=T.mul(_).mod(S));return _}var u=n.constructor.clone({precision:n.toFixed(0).length*2});n=new u(n);for(var c=0,s=n.sub(1);s.mod(2).eq(0);)s=s.div(2),c+=1;var l=null;if(n.lt("3317044064679887385961981"))l=[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)));l=[];for(var p=2;p<=f;p+=1)l.push(f)}for(var m=0;m<l.length;m+=1){var d=l[m],h=o(n.sub(n).add(d),s,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===c-1)return!1}}return!0},"Array | Matrix":e.referToSelf(t=>n=>rt(n,t))})});var JQ="numeric",XQ=["number","?bignumber","?fraction"],J_=C(JQ,XQ,r=>{var{number:e,bignumber:t,fraction:n}=r,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:t?o=>t(o):of,bigint:o=>BigInt(o),Fraction:n?o=>n(o):mg};return function(u){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",s=arguments.length>2?arguments[2]:void 0;if(s!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var l=ur(u);if(!(l in i))throw new TypeError("Cannot convert "+u+' of type "'+l+'"; valid input types are '+Object.keys(i).join(", "));if(!(c in a))throw new TypeError("Cannot convert "+u+' to type "'+c+'"; valid output types are '+Object.keys(a).join(", "));return c===l?u:a[c](u)}});var VB="divideScalar",QQ=["typed","numeric"],X_=C(VB,QQ,r=>{var{typed:e,numeric:t}=r;return e(VB,{"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 UB="pow",KQ=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Q_=C(UB,KQ,r=>{var{typed:e,config:t,identity:n,multiply:i,matrix:a,inv:o,number:u,fraction:c,Complex:s}=r;return e(UB,{"number, number":l,"Complex, Complex":function(d,h){return d.pow(h)},"BigNumber, BigNumber":function(d,h){return h.isInteger()||d>=0||t.predictable?d.pow(h):new s(d.toNumber(),0).pow(h.toNumber(),0)},"bigint, bigint":(m,d)=>m**d,"Fraction, Fraction":function(d,h){var x=d.pow(h);if(x!=null)return x;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(d.valueOf(),h.valueOf())},"Array, number":f,"Array, BigNumber":function(d,h){return f(d,h.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(d,h){return p(d,h.toNumber())},"Unit, number | BigNumber":function(d,h){return d.pow(h)}});function l(m,d){if(t.predictable&&!Je(d)&&m<0)try{var h=c(d),x=u(h);if((d===x||Math.abs((d-x)/d)<1e-14)&&h.d%2===1)return(h.n%2===0?1:-1)*Math.pow(-m,d)}catch{}return t.predictable&&(m<-1&&d===1/0||m>-1&&m<0&&d===-1/0)?NaN:Je(d)||m>=0||t.predictable?k0(m,d):m*m<1&&d===1/0||m*m>1&&d===-1/0?0:new s(m,0).pow(d,0)}function f(m,d){if(!Je(d))throw new TypeError("For A^b, b must be an integer (value is "+d+")");var h=lt(m);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(m),-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=m;d>=1;)(d&1)===1&&(x=i(b,x)),d>>=1,b=i(b,b);return x}function p(m,d){return a(f(m.valueOf(),d))}});var uf="Number of decimals in function round must be an integer",qB="round",eK=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],K_=C(qB,eK,r=>{var{typed:e,config:t,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:u}=r,c=Nr({typed:e,equalScalar:i}),s=yr({typed:e,DenseMatrix:u}),l=Tn({typed:e});function f(p){return Math.abs(Yc(p).exponent)}return e(qB,{number:function(m){var d=tf(m,f(t.relTol)),h=Yr(m,d,t.relTol,t.absTol)?d:m;return tf(h)},"number, number":function(m,d){var h=f(t.relTol);if(d>=h)return tf(m,d);var x=tf(m,h),b=Yr(m,x,t.relTol,t.absTol)?x:m;return tf(b,d)},"number, BigNumber":function(m,d){if(!d.isInteger())throw new TypeError(uf);return new o(m).toDecimalPlaces(d.toNumber())},Complex:function(m){return m.round()},"Complex, number":function(m,d){if(d%1)throw new TypeError(uf);return m.round(d)},"Complex, BigNumber":function(m,d){if(!d.isInteger())throw new TypeError(uf);var h=d.toNumber();return m.round(h)},BigNumber:function(m){var d=new o(m).toDecimalPlaces(f(t.relTol)),h=ln(m,d,t.relTol,t.absTol)?d:m;return h.toDecimalPlaces(0)},"BigNumber, BigNumber":function(m,d){if(!d.isInteger())throw new TypeError(uf);var h=f(t.relTol);if(d>=h)return m.toDecimalPlaces(d.toNumber());var x=m.toDecimalPlaces(h),b=ln(m,x,t.relTol,t.absTol)?x:m;return b.toDecimalPlaces(d.toNumber())},Fraction:function(m){return m.round()},"Fraction, number":function(m,d){if(d%1)throw new TypeError(uf);return m.round(d)},"Fraction, BigNumber":function(m,d){if(!d.isInteger())throw new TypeError(uf);return m.round(d.toNumber())},"Unit, number, Unit":e.referToSelf(p=>function(m,d,h){var x=m.toNumeric(h);return h.multiply(p(x,d))}),"Unit, BigNumber, Unit":e.referToSelf(p=>(m,d,h)=>p(m,d.toNumber(),h)),"Unit, Unit":e.referToSelf(p=>(m,d)=>p(m,0,d)),"Array | Matrix, number, Unit":e.referToSelf(p=>(m,d,h)=>rt(m,x=>p(x,d,h),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(p=>(m,d,h)=>p(m,d.toNumber(),h)),"Array | Matrix, Unit":e.referToSelf(p=>(m,d)=>p(m,0,d)),"Array | Matrix":e.referToSelf(p=>m=>rt(m,p,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,d)=>c(m,d,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,d)=>l(m,d,p,!1)),"Array, number | BigNumber":e.referToSelf(p=>(m,d)=>l(n(m),d,p,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(p=>(m,d)=>i(m,0)?a(d.size(),d.storage()):s(d,m,p,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(p=>(m,d)=>i(m,0)?a(d.size(),d.storage()):l(d,m,p,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(p=>(m,d)=>l(n(d),m,p,!0).valueOf())})});var zB="log",tK=["config","typed","divideScalar","Complex"],e1=C(zB,tK,r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r;return e(zB,{number:function(o){return o>=0||t.predictable?Y2(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":e.referToSelf(a=>(o,u)=>n(a(o),a(u)))})});var HB="log1p",rK=["typed","config","divideScalar","log","Complex"],t1=C(HB,rK,r=>{var{typed:e,config:t,divideScalar:n,log:i,Complex:a}=r;return e(HB,{number:function(c){return c>=-1||t.predictable?Lh(c):o(new a(c,0))},Complex:o,BigNumber:function(c){var s=c.plus(1);return!s.isNegative()||t.predictable?s.ln():o(new a(c.toNumber(),0))},"Array | Matrix":e.referToSelf(u=>c=>rt(c,u)),"any, any":e.referToSelf(u=>(c,s)=>n(u(c),i(s)))});function o(u){var c=u.re+1;return new a(Math.log(Math.sqrt(c*c+u.im*u.im)),Math.atan2(u.im,c))}});var GB="nthRoots",nK=["config","typed","divideScalar","Complex"],r1=C(GB,nK,r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r,a=[function(c){return new i(c,0)},function(c){return new i(0,c)},function(c){return new i(-c,0)},function(c){return new i(0,-c)}];function o(u,c){if(c<0)throw new Error("Root must be greater than zero");if(c===0)throw new Error("Root must be non-zero");if(c%1!==0)throw new Error("Root must be an integer");if(u===0||u.abs()===0)return[new i(0,0)];var s=typeof u=="number",l;(s||u.re===0||u.im===0)&&(s?l=2*+(u<0):u.im===0?l=2*+(u.re<0):l=2*+(u.im<0)+1);for(var f=u.arg(),p=u.abs(),m=[],d=Math.pow(p,1/c),h=0;h<c;h++){var x=(l+4*h)/c;if(x===Math.round(x)){m.push(a[x%4](d));continue}m.push(new i({r:d,phi:(f+2*Math.PI*h)/c}))}return m}return e(GB,{Complex:function(c){return o(c,2)},"Complex, number":o})});var WB="dotPow",iK=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],n1=C(WB,iK,r=>{var{typed:e,equalScalar:t,matrix:n,pow:i,DenseMatrix:a,concat:o}=r,u=zr({typed:e}),c=Ln({typed:e,DenseMatrix:a}),s=Nr({typed:e,equalScalar:t}),l=yr({typed:e,DenseMatrix:a}),f=Ft({typed:e,matrix:n,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&!m.includes("Matrix")&&!m.includes("Array")&&(p[m]=i.signatures[m]);var d=e(p);return e(WB,f({elop:d,SS:c,DS:u,Ss:s,sS:l}))});var YB="dotDivide",aK=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],i1=C(YB,aK,r=>{var{typed:e,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=r,u=Mn({typed:e,equalScalar:n}),c=zr({typed:e}),s=Ln({typed:e,DenseMatrix:a}),l=Nr({typed:e,equalScalar:n}),f=yr({typed:e,DenseMatrix:a}),p=Ft({typed:e,matrix:t,concat:o});return e(YB,p({elop:i,SS:s,DS:c,SD:u,Ss:l,sS:f}))});function rs(r){var{DenseMatrix:e}=r;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Et(o)+")");var u=o[0],c=o[1];if(u!==c)throw new RangeError("Matrix must be square (size: "+Et(o)+")");var s=[];if(et(i)){var l=i.size(),f=i._data;if(l.length===1){if(l[0]!==u)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var p=0;p<u;p++)s[p]=[f[p]];return new e({data:s,size:[u,1],datatype:i._datatype})}if(l.length===2){if(l[0]!==u||l[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Tl(i)){if(a){s=[];for(var m=0;m<u;m++)s[m]=[f[m][0]];return new e({data:s,size:[u,1],datatype:i._datatype})}return i}if(No(i)){for(var d=0;d<u;d++)s[d]=[0];for(var h=i._values,x=i._index,b=i._ptr,T=b[1],v=b[0];v<T;v++){var S=x[v];s[S][0]=h[v]}return new e({data:s,size:[u,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(dr(i)){var _=lt(i);if(_.length===1){if(_[0]!==u)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var y=0;y<u;y++)s[y]=[i[y]];return new e({data:s,size:[u,1]})}if(_.length===2){if(_[0]!==u||_[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var A=0;A<u;A++)s[A]=[i[A][0]];return new e({data:s,size:[u,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var jB="lsolve",oK=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],a1=C(jB,oK,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=r,c=rs({DenseMatrix:u});return e(jB,{"SparseMatrix, Array | Matrix":function(p,m){return l(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var d=t(p),h=s(d,m);return h.valueOf()}});function s(f,p){p=c(f,p,!0);for(var m=p._data,d=f._size[0],h=f._size[1],x=[],b=f._data,T=0;T<h;T++){var v=m[T][0]||0,S=void 0;if(o(v,0))S=0;else{var _=b[T][T];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");S=n(v,_);for(var y=T+1;y<d;y++)m[y]=[a(m[y][0]||0,i(S,b[y][T]))]}x[T]=[S]}return new u({data:x,size:[d,1]})}function l(f,p){p=c(f,p,!0);for(var m=p._data,d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=[],S=0;S<h;S++){var _=m[S][0]||0;if(o(_,0))v[S]=[0];else{for(var y=0,A=[],M=[],w=T[S],D=T[S+1],N=w;N<D;N++){var B=b[N];B===S?y=x[N]:B>S&&(A.push(x[N]),M.push(B))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(_,y),z=0,V=M.length;z<V;z++){var k=M[z];m[k]=[a(m[k][0]||0,i(R,A[z]))]}v[S]=[R]}}return new u({data:v,size:[d,1]})}});var ZB="usolve",sK=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],o1=C(ZB,sK,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=r,c=rs({DenseMatrix:u});return e(ZB,{"SparseMatrix, Array | Matrix":function(p,m){return l(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var d=t(p),h=s(d,m);return h.valueOf()}});function s(f,p){p=c(f,p,!0);for(var m=p._data,d=f._size[0],h=f._size[1],x=[],b=f._data,T=h-1;T>=0;T--){var v=m[T][0]||0,S=void 0;if(o(v,0))S=0;else{var _=b[T][T];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");S=n(v,_);for(var y=T-1;y>=0;y--)m[y]=[a(m[y][0]||0,i(S,b[y][T]))]}x[T]=[S]}return new u({data:x,size:[d,1]})}function l(f,p){p=c(f,p,!0);for(var m=p._data,d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=[],S=h-1;S>=0;S--){var _=m[S][0]||0;if(o(_,0))v[S]=[0];else{for(var y=0,A=[],M=[],w=T[S],D=T[S+1],N=D-1;N>=w;N--){var B=b[N];B===S?y=x[N]:B<S&&(A.push(x[N]),M.push(B))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(_,y),z=0,V=M.length;z<V;z++){var k=M[z];m[k]=[a(m[k][0],i(R,A[z]))]}v[S]=[R]}}return new u({data:v,size:[d,1]})}});var JB="lsolveAll",uK=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],s1=C(JB,uK,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=r,c=rs({DenseMatrix:u});return e(JB,{"SparseMatrix, Array | Matrix":function(p,m){return l(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var d=t(p),h=s(d,m);return h.map(x=>x.valueOf())}});function s(f,p){for(var m=[c(f,p,!0)._data.map(M=>M[0])],d=f._data,h=f._size[0],x=f._size[1],b=0;b<x;b++)for(var T=m.length,v=0;v<T;v++){var S=m[v];if(o(d[b][b],0))if(o(S[b],0)){if(v===0){var y=[...S];y[b]=1;for(var A=b+1;A<x;A++)y[A]=a(y[A],d[A][b]);m.push(y)}}else{if(v===0)return[];m.splice(v,1),v-=1,T-=1}else{S[b]=n(S[b],d[b][b]);for(var _=b+1;_<x;_++)S[_]=a(S[_],i(S[b],d[_][b]))}}return m.map(M=>new u({data:M.map(w=>[w]),size:[h,1]}))}function l(f,p){for(var m=[c(f,p,!0)._data.map(ne=>ne[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 S=m.length,_=0;_<S;_++){for(var y=m[_],A=[],M=[],w=T[v],D=T[v+1],N=0,B=w;B<D;B++){var R=b[B];R===v?N=x[B]:R>v&&(A.push(x[B]),M.push(R))}if(o(N,0))if(o(y[v],0)){if(_===0){var P=[...y];P[v]=1;for(var W=0,O=M.length;W<O;W++){var X=M[W];P[X]=a(P[X],A[W])}m.push(P)}}else{if(_===0)return[];m.splice(_,1),_-=1,S-=1}else{y[v]=n(y[v],N);for(var z=0,V=M.length;z<V;z++){var k=M[z];y[k]=a(y[k],i(y[v],A[z]))}}}return m.map(ne=>new u({data:ne.map(Z=>[Z]),size:[d,1]}))}});var XB="usolveAll",lK=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],u1=C(XB,lK,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=r,c=rs({DenseMatrix:u});return e(XB,{"SparseMatrix, Array | Matrix":function(p,m){return l(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var d=t(p),h=s(d,m);return h.map(x=>x.valueOf())}});function s(f,p){for(var m=[c(f,p,!0)._data.map(M=>M[0])],d=f._data,h=f._size[0],x=f._size[1],b=x-1;b>=0;b--)for(var T=m.length,v=0;v<T;v++){var S=m[v];if(o(d[b][b],0))if(o(S[b],0)){if(v===0){var y=[...S];y[b]=1;for(var A=b-1;A>=0;A--)y[A]=a(y[A],d[A][b]);m.push(y)}}else{if(v===0)return[];m.splice(v,1),v-=1,T-=1}else{S[b]=n(S[b],d[b][b]);for(var _=b-1;_>=0;_--)S[_]=a(S[_],i(S[b],d[_][b]))}}return m.map(M=>new u({data:M.map(w=>[w]),size:[h,1]}))}function l(f,p){for(var m=[c(f,p,!0)._data.map(ne=>ne[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 S=m.length,_=0;_<S;_++){for(var y=m[_],A=[],M=[],w=T[v],D=T[v+1],N=0,B=D-1;B>=w;B--){var R=b[B];R===v?N=x[B]:R<v&&(A.push(x[B]),M.push(R))}if(o(N,0))if(o(y[v],0)){if(_===0){var P=[...y];P[v]=1;for(var W=0,O=M.length;W<O;W++){var X=M[W];P[X]=a(P[X],A[W])}m.push(P)}}else{if(_===0)return[];m.splice(_,1),_-=1,S-=1}else{y[v]=n(y[v],N);for(var z=0,V=M.length;z<V;z++){var k=M[z];y[k]=a(y[k],i(y[v],A[z]))}}}return m.map(ne=>new u({data:ne.map(Z=>[Z]),size:[d,1]}))}});var cK="matAlgo08xS0Sid",fK=["typed","equalScalar"],lf=C(cK,fK,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var u=i._values,c=i._index,s=i._ptr,l=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==h.length)throw new Mt(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");if(!u||!p)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var b=l[0],T=l[1],v,S=t,_=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,S=e.find(t,[v,v]),_=e.convert(0,v),y=e.find(o,[v,v]));for(var A=[],M=[],w=[],D=[],N=[],B,R,z,V,k=0;k<T;k++){w[k]=M.length;var P=k+1;for(R=s[k],z=s[k+1],B=R;B<z;B++)V=c[B],N[V]=P,D[V]=u[B],M.push(V);for(R=d[k],z=d[k+1],B=R;B<z;B++)V=m[B],N[V]===P&&(D[V]=y(D[V],p[B]));for(B=w[k];B<M.length;){V=M[B];var W=D[V];S(W,_)?M.splice(B,1):(A.push(W),B++)}}return w[T]=M.length,i.createSparseMatrix({values:A,index:M,ptr:w,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var cf=C("useMatrixForArrayScalar",["typed","matrix"],r=>{var{typed:e,matrix:t}=r;return{"Array, number":e.referTo("DenseMatrix, number",n=>(i,a)=>n(t(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(t(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",n=>(i,a)=>n(i,t(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,t(a)).valueOf())}});var QB="leftShift",pK=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],l1=C(QB,pK,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,u=Mi({typed:e}),c=Mn({typed:e,equalScalar:n}),s=lf({typed:e,equalScalar:n}),l=pa({typed:e,DenseMatrix:a}),f=Nr({typed:e,equalScalar:n}),p=Tn({typed:e}),m=Ft({typed:e,matrix:t,concat:o}),d=cf({typed:e,matrix:t});return e(QB,{"number, number":V0,"BigNumber, BigNumber":qP,"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():p(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):l(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):p(b,x,h,!0))},d,m({SS:s,DS:u,SD:c}))});var KB="rightArithShift",mK=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],c1=C(KB,mK,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,u=Mi({typed:e}),c=Mn({typed:e,equalScalar:n}),s=lf({typed:e,equalScalar:n}),l=pa({typed:e,DenseMatrix:a}),f=Nr({typed:e,equalScalar:n}),p=Tn({typed:e}),m=Ft({typed:e,matrix:t,concat:o}),d=cf({typed:e,matrix:t});return e(KB,{"number, number":U0,"BigNumber, BigNumber":zP,"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():p(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):l(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):p(b,x,h,!0))},d,m({SS:s,DS:u,SD:c}))});var ek="rightLogShift",dK=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],f1=C(ek,dK,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,u=Mi({typed:e}),c=Mn({typed:e,equalScalar:n}),s=lf({typed:e,equalScalar:n}),l=pa({typed:e,DenseMatrix:a}),f=Nr({typed:e,equalScalar:n}),p=Tn({typed:e}),m=Ft({typed:e,matrix:t,concat:o}),d=cf({typed:e,matrix:t});return e(ek,{"number, number":q0,"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():p(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):l(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):p(b,x,h,!0))},d,m({SS:s,DS:u,SD:c}))});var tk="and",hK=["typed","matrix","equalScalar","zeros","not","concat"],Qp=C(tk,hK,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,u=Mn({typed:e,equalScalar:n}),c=Pu({typed:e,equalScalar:n}),s=Nr({typed:e,equalScalar:n}),l=Tn({typed:e}),f=Ft({typed:e,matrix:t,concat:o});return e(tk,{"number, number":ug,"Complex, Complex":function(m,d){return(m.re!==0||m.im!==0)&&(d.re!==0||d.im!==0)},"BigNumber, BigNumber":function(m,d){return!m.isZero()&&!d.isZero()&&!m.isNaN()&&!d.isNaN()},"bigint, bigint":ug,"Unit, Unit":e.referToSelf(p=>(m,d)=>p(m.value||0,d.value||0)),"SparseMatrix, any":e.referToSelf(p=>(m,d)=>a(d)?i(m.size(),m.storage()):s(m,d,p,!1)),"DenseMatrix, any":e.referToSelf(p=>(m,d)=>a(d)?i(m.size(),m.storage()):l(m,d,p,!1)),"any, SparseMatrix":e.referToSelf(p=>(m,d)=>a(m)?i(m.size(),m.storage()):s(d,m,p,!0)),"any, DenseMatrix":e.referToSelf(p=>(m,d)=>a(m)?i(m.size(),m.storage()):l(d,m,p,!0)),"Array, any":e.referToSelf(p=>(m,d)=>p(t(m),d).valueOf()),"any, Array":e.referToSelf(p=>(m,d)=>p(m,t(d)).valueOf())},f({SS:c,DS:u}))});var gg="compare",gK=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],p1=C(gg,gK,r=>{var{typed:e,config:t,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:u,concat:c}=r,s=zr({typed:e}),l=Iu({typed:e,equalScalar:n}),f=yr({typed:e,DenseMatrix:u}),p=Ft({typed:e,matrix:i,concat:c}),m=fo({typed:e});return e(gg,vK({typed:e,config:t}),{"boolean, boolean":function(h,x){return h===x?0:h>x?1:-1},"BigNumber, BigNumber":function(h,x){return ln(h,x,t.relTol,t.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")}},m,p({SS:l,DS:s,Ss:f}))}),vK=C(gg,["typed","config"],r=>{var{typed:e,config:t}=r;return e(gg,{"number, number":function(i,a){return Yr(i,a,t.relTol,t.absTol)?0:i>a?1:-1}})});var Bl=Or(nk(),1);var ik="compareNatural",yK=["typed","compare"],m1=C(ik,yK,r=>{var{typed:e,compare:t}=r,n=t.signatures["boolean,boolean"];return e(ik,{"any, any":i});function i(c,s){var l=ur(c),f=ur(s),p;if((l==="number"||l==="BigNumber"||l==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return p=t(c,s),p.toString()!=="0"?p>0?1:-1:(0,Bl.default)(l,f);var m=["Array","DenseMatrix","SparseMatrix"];if(m.includes(l)||m.includes(f))return p=a(i,c,s),p!==0?p:(0,Bl.default)(l,f);if(l!==f)return(0,Bl.default)(l,f);if(l==="Complex")return xK(c,s);if(l==="Unit")return c.equalBase(s)?i(c.value,s.value):o(i,c.formatUnits(),s.formatUnits());if(l==="boolean")return n(c,s);if(l==="string")return(0,Bl.default)(c,s);if(l==="Object")return u(i,c,s);if(l==="null"||l==="undefined")return 0;throw new TypeError('Unsupported type of value "'+l+'"')}function a(c,s,l){return No(s)&&No(l)?o(c,s.toJSON().values,l.toJSON().values):No(s)?a(c,s.toArray(),l):No(l)?a(c,s,l.toArray()):Tl(s)?a(c,s.toJSON().data,l):Tl(l)?a(c,s,l.toJSON().data):Array.isArray(s)?Array.isArray(l)?o(c,s,l):a(c,s,[l]):a(c,[s],l)}function o(c,s,l){for(var f=0,p=Math.min(s.length,l.length);f<p;f++){var m=c(s[f],l[f]);if(m!==0)return m}return s.length>l.length?1:s.length<l.length?-1:0}function u(c,s,l){var f=Object.keys(s),p=Object.keys(l);f.sort(Bl.default),p.sort(Bl.default);var m=o(c,f,p);if(m!==0)return m;for(var d=0;d<f.length;d++){var h=c(s[f[d]],l[p[d]]);if(h!==0)return h}return 0}});function xK(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0}var ak="compareText",bK=["typed","matrix","concat"];eg.signature="any, any";var d1=C(ak,bK,r=>{var{typed:e,matrix:t,concat:n}=r,i=Ft({typed:e,matrix:t,concat:n});return e(ak,eg,i({elop:eg,Ds:!0}))});var vg="equal",wK=["typed","matrix","equalScalar","DenseMatrix","concat"],h1=C(vg,wK,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=zr({typed:e}),u=Ln({typed:e,DenseMatrix:i}),c=yr({typed:e,DenseMatrix:i}),s=Ft({typed:e,matrix:t,concat:a});return e(vg,_K({typed:e,equalScalar:n}),s({elop:n,SS:u,DS:o,Ss:c}))}),_K=C(vg,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(vg,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:t(i,a)}})});var ok="equalText",SK=["typed","compareText","isZero"],g1=C(ok,SK,r=>{var{typed:e,compareText:t,isZero:n}=r;return e(ok,{"any, any":function(a,o){return n(t(a,o))}})});var yg="smaller",AK=["typed","config","matrix","DenseMatrix","concat"],v1=C(yg,AK,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=zr({typed:e}),u=Ln({typed:e,DenseMatrix:i}),c=yr({typed:e,DenseMatrix:i}),s=Ft({typed:e,matrix:n,concat:a}),l=fo({typed:e});return e(yg,EK({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<p,"BigNumber, BigNumber":function(p,m){return p.lt(m)&&!ln(p,m,t.relTol,t.absTol)},"bigint, bigint":(f,p)=>f<p,"Fraction, Fraction":(f,p)=>f.compare(p)===-1,"Complex, Complex":function(p,m){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:u,DS:o,Ss:c}))}),EK=C(yg,["typed","config"],r=>{var{typed:e,config:t}=r;return e(yg,{"number, number":function(i,a){return i<a&&!Yr(i,a,t.relTol,t.absTol)}})});var xg="smallerEq",TK=["typed","config","matrix","DenseMatrix","concat"],y1=C(xg,TK,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=zr({typed:e}),u=Ln({typed:e,DenseMatrix:i}),c=yr({typed:e,DenseMatrix:i}),s=Ft({typed:e,matrix:n,concat:a}),l=fo({typed:e});return e(xg,MK({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<=p,"BigNumber, BigNumber":function(p,m){return p.lte(m)||ln(p,m,t.relTol,t.absTol)},"bigint, bigint":(f,p)=>f<=p,"Fraction, Fraction":(f,p)=>f.compare(p)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:u,DS:o,Ss:c}))}),MK=C(xg,["typed","config"],r=>{var{typed:e,config:t}=r;return e(xg,{"number, number":function(i,a){return i<=a||Yr(i,a,t.relTol,t.absTol)}})});var bg="larger",DK=["typed","config","matrix","DenseMatrix","concat"],x1=C(bg,DK,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=zr({typed:e}),u=Ln({typed:e,DenseMatrix:i}),c=yr({typed:e,DenseMatrix:i}),s=Ft({typed:e,matrix:n,concat:a}),l=fo({typed:e});return e(bg,CK({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>p,"BigNumber, BigNumber":function(p,m){return p.gt(m)&&!ln(p,m,t.relTol,t.absTol)},"bigint, bigint":(f,p)=>f>p,"Fraction, Fraction":(f,p)=>f.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:u,DS:o,Ss:c}))}),CK=C(bg,["typed","config"],r=>{var{typed:e,config:t}=r;return e(bg,{"number, number":function(i,a){return i>a&&!Yr(i,a,t.relTol,t.absTol)}})});var wg="largerEq",NK=["typed","config","matrix","DenseMatrix","concat"],b1=C(wg,NK,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=zr({typed:e}),u=Ln({typed:e,DenseMatrix:i}),c=yr({typed:e,DenseMatrix:i}),s=Ft({typed:e,matrix:n,concat:a}),l=fo({typed:e});return e(wg,FK({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>=p,"BigNumber, BigNumber":function(p,m){return p.gte(m)||ln(p,m,t.relTol,t.absTol)},"bigint, bigint":function(p,m){return p>=m},"Fraction, Fraction":(f,p)=>f.compare(p)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:u,DS:o,Ss:c}))}),FK=C(wg,["typed","config"],r=>{var{typed:e,config:t}=r;return e(wg,{"number, number":function(i,a){return i>=a||Yr(i,a,t.relTol,t.absTol)}})});var sk="deepEqual",IK=["typed","equal"],w1=C(sk,IK,r=>{var{typed:e,equal:t}=r;return e(sk,{"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 u=0;u<o;u++)if(!n(i[u],a[u]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:t(i,a)}});var _g="unequal",PK=["typed","config","equalScalar","matrix","DenseMatrix","concat"],_1=C(_g,PK,r=>{var{typed:e,config:t,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=r,u=zr({typed:e}),c=Ln({typed:e,DenseMatrix:a}),s=yr({typed:e,DenseMatrix:a}),l=Ft({typed:e,matrix:i,concat:o});return e(_g,BK({typed:e,equalScalar:n}),l({elop:f,SS:c,DS:u,Ss:s}));function f(p,m){return!n(p,m)}}),BK=C(_g,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(_g,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!t(i,a)}})});var uk="partitionSelect",kK=["typed","isNumeric","isNaN","compare"],S1=C(uk,kK,r=>{var{typed:e,isNumeric:t,isNaN:n,compare:i}=r,a=i,o=(s,l)=>-i(s,l);return e(uk,{"Array | Matrix, number":function(l,f){return u(l,f,a)},"Array | Matrix, number, string":function(l,f,p){if(p==="asc")return u(l,f,a);if(p==="desc")return u(l,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":u});function u(s,l,f){if(!Je(l)||l<0)throw new Error("k must be a non-negative integer");if(et(s)){var p=s.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return c(s.valueOf(),l,f)}if(Array.isArray(s))return c(s,l,f)}function c(s,l,f){if(l>=s.length)throw new Error("k out of bounds");for(var p=0;p<s.length;p++)if(t(s[p])&&n(s[p]))return s[p];for(var m=0,d=s.length-1;m<d;){for(var h=m,x=d,b=s[Math.floor(Math.random()*(d-m+1))+m];h<x;)if(f(s[h],b)>=0){var T=s[x];s[x]=s[h],s[h]=T,--x}else++h;f(s[h],b)>0&&--h,l<=h?d=h:m=h+1}return s[l]}});var lk="sort",$K=["typed","matrix","compare","compareNatural"],A1=C(lk,$K,r=>{var{typed:e,matrix:t,compare:n,compareNatural:i}=r,a=n,o=(l,f)=>-n(l,f);return e(lk,{Array:function(f){return c(f),f.sort(a)},Matrix:function(f){return s(f),t(f.toArray().sort(a),f.storage())},"Array, function":function(f,p){return c(f),f.sort(p)},"Matrix, function":function(f,p){return s(f),t(f.toArray().sort(p),f.storage())},"Array, string":function(f,p){return c(f),f.sort(u(p))},"Matrix, string":function(f,p){return s(f),t(f.toArray().sort(u(p)),f.storage())}});function u(l){if(l==="asc")return a;if(l==="desc")return o;if(l==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function c(l){if(lt(l).length!==1)throw new Error("One dimensional array expected")}function s(l){if(l.size().length!==1)throw new Error("One dimensional matrix expected")}});var ck="max",OK=["typed","config","numeric","larger"],Kp=C(ck,OK,r=>{var{typed:e,config:t,numeric:n,larger:i}=r;return e(ck,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,s){return Fu(c,s.valueOf(),a)},"...":function(c){if(co(c))throw new TypeError("Scalar values expected in function max");return o(c)}});function a(u,c){try{return i(u,c)?u:c}catch(s){throw gn(s,"max",c)}}function o(u){var c;if(Ti(u,function(s){try{isNaN(s)&&typeof s=="number"?c=NaN:(c===void 0||i(s,c))&&(c=s)}catch(l){throw gn(l,"max",s)}}),c===void 0)throw new Error("Cannot calculate max of an empty array");return typeof c=="string"&&(c=n(c,Ai(c,t))),c}});var fk="min",RK=["typed","config","numeric","smaller"],em=C(fk,RK,r=>{var{typed:e,config:t,numeric:n,smaller:i}=r;return e(fk,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,s){return Fu(c,s.valueOf(),a)},"...":function(c){if(co(c))throw new TypeError("Scalar values expected in function min");return o(c)}});function a(u,c){try{return i(u,c)?u:c}catch(s){throw gn(s,"min",c)}}function o(u){var c;if(Ti(u,function(s){try{isNaN(s)&&typeof s=="number"?c=NaN:(c===void 0||i(s,c))&&(c=s)}catch(l){throw gn(l,"min",s)}}),c===void 0)throw new Error("Cannot calculate min of an empty array");return typeof c=="string"&&(c=n(c,Ai(c,t))),c}});var LK="ImmutableDenseMatrix",VK=["smaller","DenseMatrix"],E1=C(LK,VK,r=>{var{smaller:e,DenseMatrix:t}=r;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!dn(a))throw new Error("Invalid datatype: "+a);if(et(i)||dr(i)){var o=new t(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&dr(i.data)&&dr(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 ("+ur(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=t.prototype.subset.call(this,i);return et(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:dt(this._data),size:dt(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 UK="Index",qK=["ImmutableDenseMatrix","getMatrixDataType"],T1=C(UK,qK,r=>{var{ImmutableDenseMatrix:e,getMatrixDataType:t}=r;function n(a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,u=arguments.length;o<u;o++){var c=arguments[o],s=dr(c),l=et(c),f=null;if(Gc(c))this._dimensions.push(c),this._isScalar=!1;else if(s||l){var p=void 0;t(c)==="boolean"?(s&&(p=i(pk(c).valueOf())),l&&(p=i(pk(c._data).valueOf())),f=c.valueOf().length):p=i(c.valueOf()),this._dimensions.push(p);var m=p.size();(m.length!==1||m[0]!==1||f!==null)&&(this._isScalar=!1)}else if(typeof c=="number")this._dimensions.push(i([c]));else if(typeof c=="string")this._dimensions.push(c);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,u=a.length;o<u;o++)if(typeof a[o]!="number"||!Je(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=dt(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,u=this._dimensions.length;o<u;o++){var c=this._dimensions[o];a[o]=typeof c=="string"?1:c.size()[0]}return a},n.prototype.max=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var c=this._dimensions[o];a[o]=typeof c=="string"?c:c.max()}return a},n.prototype.min=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var c=this._dimensions[o];a[o]=typeof c=="string"?c:c.min()}return a},n.prototype.forEach=function(a){for(var o=0,u=this._dimensions.length;o<u;o++)a(this._dimensions[o],o,this)},n.prototype.dimension=function(a){return this._dimensions[a]||null},n.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var c=this._dimensions[o];a.push(typeof c=="string"?c:c.toArray())}return a},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var c=this._dimensions[o];typeof c=="string"?a.push(JSON.stringify(c)):a.push(c.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 pk(r){var e=[];return r.forEach((t,n)=>{t&&e.push(n)}),e}var zK="FibonacciHeap",HK=["smaller","larger"],M1=C(zK,HK,r=>{var{smaller:e,larger:t}=r,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(l,f){var p={key:l,value:f,degree:0};if(this._minimum){var m=this._minimum;p.left=m,p.right=m.right,m.right=p,p.right.left=p,e(l,m.key)&&(this._minimum=p)}else p.left=p,p.right=p,this._minimum=p;return this._size++,p},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var l=this._minimum;if(l===null)return l;for(var f=this._minimum,p=l.degree,m=l.child;p>0;){var d=m.right;m.left.right=m.right,m.right.left=m.left,m.left=f,m.right=f.right,f.right=m,m.right.left=m,m.parent=null,m=d,p--}return l.left.right=l.right,l.right.left=l.left,l===l.right?f=null:(f=l.right,f=s(f,this._size)),this._size--,this._minimum=f,l},i.prototype.remove=function(l){this._minimum=a(this._minimum,l,-1),this.extractMinimum()};function a(l,f,p){f.key=p;var m=f.parent;return m&&e(f.key,m.key)&&(o(l,f,m),u(l,m)),e(f.key,l.key)&&(l=f),l}function o(l,f,p){f.left.right=f.right,f.right.left=f.left,p.degree--,p.child===f&&(p.child=f.right),p.degree===0&&(p.child=null),f.left=l,f.right=l.right,l.right=f,f.right.left=f,f.parent=null,f.mark=!1}function u(l,f){var p=f.parent;p&&(f.mark?(o(l,f,p),u(p)):f.mark=!0)}var c=function(f,p){f.left.right=f.right,f.right.left=f.left,f.parent=p,p.child?(f.left=p.child,f.right=p.child.right,p.child.right=f,f.right.left=f):(p.child=f,f.right=f,f.left=f),p.degree++,f.mark=!1};function s(l,f){var p=Math.floor(Math.log(f)*n)+1,m=new Array(p),d=0,h=l;if(h)for(d++,h=h.right;h!==l;)d++,h=h.right;for(var x;d>0;){for(var b=h.degree,T=h.right;x=m[b],!!x;){if(t(h.key,x.key)){var v=x;x=h,h=v}c(x,h),m[b]=null,b++}m[b]=h,h=T,d--}l=null;for(var S=0;S<p;S++)x=m[S],x&&(l?(x.left.right=x.right,x.right.left=x.left,x.left=l,x.right=l.right,l.right=x,x.right.left=x,e(x.key,l.key)&&(l=x)):l=x);return l}return i},{isClass:!0});var GK="Spa",WK=["addScalar","equalScalar","FibonacciHeap"],D1=C(GK,WK,r=>{var{addScalar:e,equalScalar:t,FibonacciHeap:n}=r;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var u=this._heap.insert(a,o);this._values[a]=u}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var u=this._values[a];u?u.value=e(u.value,o):(u=this._heap.insert(a,o),this._values[a]=u)},i.prototype.forEach=function(a,o,u){var c=this._heap,s=this._values,l=[],f=c.extractMinimum();for(f&&l.push(f);f&&f.key<=o;)f.key>=a&&(t(f.value,0)||u(f.key,f.value,this)),f=c.extractMinimum(),f&&l.push(f);for(var p=0;p<l.length;p++){var m=l[p];f=c.insert(m.key,m.value),s[f.key]=f}},i.prototype.swap=function(a,o){var u=this._values[a],c=this._values[o];if(!u&&c)u=this._heap.insert(a,c.value),this._heap.remove(c),this._values[a]=u,this._values[o]=void 0;else if(u&&!c)c=this._heap.insert(o,u.value),this._heap.remove(u),this._values[o]=c,this._values[a]=void 0;else if(u&&c){var s=u.value;u.value=c.value,c.value=s}},i},{isClass:!0});function mk(r){var e=0,t=1,n=Object.create(null),i=Object.create(null),a=0,o=function(c){var s=i[c];if(s&&(delete n[s],delete i[c],--e,t===s)){if(!e){a=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return r=Math.abs(r),{hit:function(c){var s=i[c],l=++a;if(n[l]=c,i[c]=l,!s)return++e,e<=r?void 0:(c=n[t],o(c),c);if(delete n[s],t===s)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:o,clear:function(){e=a=0,t=1,n=Object.create(null),i=Object.create(null)}}}function kl(r){var{hasher:e,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t??Number.POSITIVE_INFINITY,e=e??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:mk(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var u=r.apply(r,i);return n.cache.values.set(o,u),n.cache.values.delete(n.cache.lru.hit(o)),u}}var dk=kl(function(r){return new r(1).exp()},{hasher:Sg}),hk=kl(function(r){return new r(1).plus(new r(5).sqrt()).div(2)},{hasher:Sg}),tm=kl(function(r){return r.acos(-1)},{hasher:Sg}),gk=kl(function(r){return tm(r).times(2)},{hasher:Sg});function Sg(r){return r[0].precision}function vk(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function C1(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vk(Object(t),!0).forEach(function(n){wr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vk(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var YK="Unit",jK=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],N1=C(YK,jK,r=>{var{on:e,config:t,addScalar:n,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:u,abs:c,fix:s,round:l,equal:f,isNumeric:p,format:m,number:d,Complex:h,BigNumber:x,Fraction:b}=r,T=d;function v(Y,Q){if(!(this instanceof v))throw new Error("Constructor must be called with the new operator");if(!(Y==null||p(Y)||Hi(Y)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,Q===void 0)this.units=[],this.dimensions=W.map(J=>0);else if(typeof Q=="string"){var xe=v.parse(Q);this.units=xe.units,this.dimensions=xe.dimensions}else if(ci(Q)&&Q.value===null)this.fixPrefix=Q.fixPrefix,this.skipAutomaticSimplification=Q.skipAutomaticSimplification,this.dimensions=Q.dimensions.slice(0),this.units=Q.units.map(J=>rn({},J));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(Y)}Object.defineProperty(v,"name",{value:"Unit"}),v.prototype.constructor=v,v.prototype.type="Unit",v.prototype.isUnit=!0;var S,_,y;function A(){for(;y===" "||y==="	";)D()}function M(Y){return Y>="0"&&Y<="9"||Y==="."}function w(Y){return Y>="0"&&Y<="9"}function D(){_++,y=S.charAt(_)}function N(Y){_=Y,y=S.charAt(_)}function B(){var Y="",Q=_;if(y==="+"?D():y==="-"&&(Y+=y,D()),!M(y))return N(Q),null;if(y==="."){if(Y+=y,D(),!w(y))return N(Q),null}else{for(;w(y);)Y+=y,D();y==="."&&(Y+=y,D())}for(;w(y);)Y+=y,D();if(y==="E"||y==="e"){var xe="",J=_;if(xe+=y,D(),(y==="+"||y==="-")&&(xe+=y,D()),!w(y))return N(J),Y;for(Y=Y+xe;w(y);)Y+=y,D()}return Y}function R(){for(var Y="";w(y)||v.isValidAlpha(y);)Y+=y,D();var Q=Y.charAt(0);return v.isValidAlpha(Q)?Y:null}function z(Y){return y===Y?(D(),Y):null}v.parse=function(Y,Q){if(Q=Q||{},S=Y,_=-1,y="",typeof S!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var xe=new v;xe.units=[];var J=1,re=!1;D(),A();var se=B(),Ae=null;if(se){if(t.number==="BigNumber")Ae=new x(se);else if(t.number==="Fraction")try{Ae=new b(se)}catch{Ae=parseFloat(se)}else Ae=parseFloat(se);A(),z("*")?(J=1,re=!0):z("/")&&(J=-1,re=!0)}for(var Te=[],qe=1;;){for(A();y==="(";)Te.push(J),qe*=J,J=1,D(),A();var Se=void 0;if(y){var wt=y;if(Se=R(),Se===null)throw new SyntaxError('Unexpected "'+wt+'" in "'+S+'" at index '+_.toString())}else break;var Dt=V(Se);if(Dt===null)throw new SyntaxError('Unit "'+Se+'" not found.');var jt=J*qe;if(A(),z("^")){A();var Tt=B();if(Tt===null)throw new SyntaxError('In "'+Y+'", "^" must be followed by a floating-point number');jt*=Tt}xe.units.push({unit:Dt.unit,prefix:Dt.prefix,power:jt});for(var j=0;j<W.length;j++)xe.dimensions[j]+=(Dt.unit.dimensions[j]||0)*jt;for(A();y===")";){if(Te.length===0)throw new SyntaxError('Unmatched ")" in "'+S+'" at index '+_.toString());qe/=Te.pop(),D(),A()}if(re=!1,z("*")?(J=1,re=!0):z("/")?(J=-1,re=!0):J=1,Dt.unit.base){var le=Dt.unit.base.key;oe.auto[le]={unit:Dt.unit,prefix:Dt.prefix}}}if(A(),y)throw new SyntaxError('Could not parse: "'+Y+'"');if(re)throw new SyntaxError('Trailing characters: "'+Y+'"');if(Te.length!==0)throw new SyntaxError('Unmatched "(" in "'+S+'"');if(xe.units.length===0&&!Q.allowNoUnits)throw new SyntaxError('"'+Y+'" contains no units');return xe.value=Ae!==void 0?xe._normalize(Ae):null,xe},v.prototype.clone=function(){var Y=new v;Y.fixPrefix=this.fixPrefix,Y.skipAutomaticSimplification=this.skipAutomaticSimplification,Y.value=dt(this.value),Y.dimensions=this.dimensions.slice(0),Y.units=[];for(var Q=0;Q<this.units.length;Q++){Y.units[Q]={};for(var xe in this.units[Q])it(this.units[Q],xe)&&(Y.units[Q][xe]=this.units[Q][xe])}return Y},v.prototype.valueType=function(){return ur(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(Y){if(Y==null||this.units.length===0)return Y;for(var Q=Y,xe=v._getNumberConverter(ur(Y)),J=0;J<this.units.length;J++){var re=xe(this.units[J].unit.value),se=xe(this.units[J].prefix.value),Ae=xe(this.units[J].power);Q=a(Q,u(a(re,se),Ae))}return Q},v.prototype._denormalize=function(Y,Q){if(Y==null||this.units.length===0)return Y;for(var xe=Y,J=v._getNumberConverter(ur(Y)),re=0;re<this.units.length;re++){var se=J(this.units[re].unit.value),Ae=J(this.units[re].prefix.value),Te=J(this.units[re].power);xe=o(xe,u(a(se,Ae),Te))}return xe};var V=kl(Y=>{if(it(L,Y)){var Q=L[Y],xe=Q.prefixes[""];return{unit:Q,prefix:xe}}for(var J in L)if(it(L,J)&&k2(Y,J)){var re=L[J],se=Y.length-J.length,Ae=Y.substring(0,se),Te=it(re.prefixes,Ae)?re.prefixes[Ae]:void 0;if(Te!==void 0)return{unit:re,prefix:Te}}return null},{hasher:Y=>Y[0],limit:100});v.isValuelessUnit=function(Y){return V(Y)!==null},v.prototype.hasBase=function(Y){if(typeof Y=="string"&&(Y=O[Y]),!Y)return!1;for(var Q=0;Q<W.length;Q++)if(Math.abs((this.dimensions[Q]||0)-(Y.dimensions[Q]||0))>1e-12)return!1;return!0},v.prototype.equalBase=function(Y){for(var Q=0;Q<W.length;Q++)if(Math.abs((this.dimensions[Q]||0)-(Y.dimensions[Q]||0))>1e-12)return!1;return!0},v.prototype.equals=function(Y){return this.equalBase(Y)&&f(this.value,Y.value)},v.prototype.multiply=function(Y){for(var Q=this.clone(),xe=ci(Y)?Y:new v(Y),J=0;J<W.length;J++)Q.dimensions[J]=(this.dimensions[J]||0)+(xe.dimensions[J]||0);for(var re=0;re<xe.units.length;re++){var se=C1({},xe.units[re]);Q.units.push(se)}if(this.value!==null||xe.value!==null){var Ae=this.value===null?this._normalize(1):this.value,Te=xe.value===null?xe._normalize(1):xe.value;Q.value=a(Ae,Te)}else Q.value=null;return ci(Y)&&(Q.skipAutomaticSimplification=!1),k(Q)},v.prototype.divideInto=function(Y){return new v(Y).divide(this)},v.prototype.divide=function(Y){for(var Q=this.clone(),xe=ci(Y)?Y:new v(Y),J=0;J<W.length;J++)Q.dimensions[J]=(this.dimensions[J]||0)-(xe.dimensions[J]||0);for(var re=0;re<xe.units.length;re++){var se=C1(C1({},xe.units[re]),{},{power:-xe.units[re].power});Q.units.push(se)}if(this.value!==null||xe.value!==null){var Ae=this.value===null?this._normalize(1):this.value,Te=xe.value===null?xe._normalize(1):xe.value;Q.value=o(Ae,Te)}else Q.value=null;return ci(Y)&&(Q.skipAutomaticSimplification=!1),k(Q)},v.prototype.pow=function(Y){for(var Q=this.clone(),xe=0;xe<W.length;xe++)Q.dimensions[xe]=(this.dimensions[xe]||0)*Y;for(var J=0;J<Q.units.length;J++)Q.units[J].power*=Y;return Q.value!==null?Q.value=u(Q.value,Y):Q.value=null,Q.skipAutomaticSimplification=!1,k(Q)};function k(Y){return Y.equalBase(O.NONE)&&Y.value!==null&&!t.predictable?Y.value:Y}v.prototype.abs=function(){var Y=this.clone();if(Y.value!==null)if(Y._isDerived()||Y.units.length===0||Y.units[0].unit.offset===0)Y.value=c(Y.value);else{var Q=Y._numberConverter(),xe=Q(Y.units[0].unit.value),J=Q(Y.units[0].unit.offset),re=a(xe,J);Y.value=i(c(n(Y.value,re)),re)}for(var se in Y.units)(Y.units[se].unit.name==="VA"||Y.units[se].unit.name==="VAR")&&(Y.units[se].unit=L.W);return Y},v.prototype.to=function(Y){var Q=this.value===null?this._normalize(1):this.value,xe;if(typeof Y=="string")xe=v.parse(Y);else if(ci(Y))xe=Y.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(xe))throw new Error("Units do not match ('".concat(xe.toString(),"' != '").concat(this.toString(),"')"));if(xe.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units.length===0||xe.units.length===0||this.units[0].unit.offset===xe.units[0].unit.offset)xe.value=dt(Q);else{var J=v._getNumberConverter(ur(Q)),re=this.units[0].unit.value,se=this.units[0].unit.offset,Ae=a(re,se),Te=xe.units[0].unit.value,qe=xe.units[0].unit.offset,Se=a(Te,qe);xe.value=n(Q,J(i(Ae,Se)))}return xe.fixPrefix=!0,xe.skipAutomaticSimplification=!0,xe},v.prototype.toNumber=function(Y){return T(this.toNumeric(Y))},v.prototype.toNumeric=function(Y){var Q;return Y?Q=this.to(Y):Q=this.clone(),Q._isDerived()||Q.units.length===0?Q._denormalize(Q.value):Q._denormalize(Q.value,Q.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(Y){var Q,xe=new v(Y.value,(Q=Y.unit)!==null&&Q!==void 0?Q:void 0);return xe.fixPrefix=Y.fixPrefix||!1,xe},v.prototype.valueOf=v.prototype.toString,v.prototype.simplify=function(){var Y=this.clone(),Q=[],xe;for(var J in ve)if(it(ve,J)&&Y.hasBase(O[J])){xe=J;break}if(xe==="NONE")Y.units=[];else{var re;if(xe&&it(ve,xe)&&(re=ve[xe]),re)Y.units=[{unit:re.unit,prefix:re.prefix,power:1}];else{for(var se=!1,Ae=0;Ae<W.length;Ae++){var Te=W[Ae];Math.abs(Y.dimensions[Ae]||0)>1e-12&&(it(ve,Te)?Q.push({unit:ve[Te].unit,prefix:ve[Te].prefix,power:Y.dimensions[Ae]||0}):se=!0)}Q.length<Y.units.length&&!se&&(Y.units=Q)}}return Y},v.prototype.toSI=function(){for(var Y=this.clone(),Q=[],xe=0;xe<W.length;xe++){var J=W[xe];if(Math.abs(Y.dimensions[xe]||0)>1e-12)if(it(oe.si,J))Q.push({unit:oe.si[J].unit,prefix:oe.si[J].prefix,power:Y.dimensions[xe]||0});else throw new Error("Cannot express custom unit "+J+" in SI units")}return Y.units=Q,Y.fixPrefix=!0,Y.skipAutomaticSimplification=!0,this.value!==null?(Y.value=null,this.to(Y)):Y},v.prototype.formatUnits=function(){for(var Y="",Q="",xe=0,J=0,re=0;re<this.units.length;re++)this.units[re].power>0?(xe++,Y+=" "+this.units[re].prefix.name+this.units[re].unit.name,Math.abs(this.units[re].power-1)>1e-15&&(Y+="^"+this.units[re].power)):this.units[re].power<0&&J++;if(J>0)for(var se=0;se<this.units.length;se++)this.units[se].power<0&&(xe>0?(Q+=" "+this.units[se].prefix.name+this.units[se].unit.name,Math.abs(this.units[se].power+1)>1e-15&&(Q+="^"+-this.units[se].power)):(Q+=" "+this.units[se].prefix.name+this.units[se].unit.name,Q+="^"+this.units[se].power));Y=Y.substr(1),Q=Q.substr(1),xe>1&&J>0&&(Y="("+Y+")"),J>1&&xe>0&&(Q="("+Q+")");var Ae=Y;return xe>0&&J>0&&(Ae+=" / "),Ae+=Q,Ae},v.prototype.format=function(Y){var Q=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),xe=!1;typeof Q.value<"u"&&Q.value!==null&&Hi(Q.value)&&(xe=Math.abs(Q.value.re)<1e-14);for(var J in Q.units)it(Q.units,J)&&Q.units[J].unit&&(Q.units[J].unit.name==="VA"&&xe?Q.units[J].unit=L.VAR:Q.units[J].unit.name==="VAR"&&!xe&&(Q.units[J].unit=L.VA));Q.units.length===1&&!Q.fixPrefix&&Math.abs(Q.units[0].power-Math.round(Q.units[0].power))<1e-14&&(Q.units[0].prefix=Q._bestPrefix());var re=Q._denormalize(Q.value),se=Q.value!==null?m(re,Y||{}):"",Ae=Q.formatUnits();return Q.value&&Hi(Q.value)&&(se="("+se+")"),Ae.length>0&&se.length>0&&(se+=" "),se+=Ae,se},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 Y=this.value!==null?c(this.value):0,Q=c(this.units[0].unit.value),xe=this.units[0].prefix;if(Y===0)return xe;var J=this.units[0].power,re=Math.log(Y/Math.pow(xe.value*Q,J))/Math.LN10-1.2;if(re>-2.200001&&re<1.800001)return xe;re=Math.abs(re);var se=this.units[0].unit.prefixes;for(var Ae in se)if(it(se,Ae)){var Te=se[Ae];if(Te.scientific){var qe=Math.abs(Math.log(Y/Math.pow(Te.value*Q,J))/Math.LN10-1.2);(qe<re||qe===re&&Te.name.length<xe.name.length)&&(xe=Te,re=qe)}}return xe},v.prototype.splitUnit=function(Y){for(var Q=this.clone(),xe=[],J=0;J<Y.length&&(Q=Q.to(Y[J]),J!==Y.length-1);J++){var re=Q.toNumeric(),se=l(re),Ae=void 0,Te=f(se,re);Te?Ae=se:Ae=s(Q.toNumeric());var qe=new v(Ae,Y[J].toString());xe.push(qe),Q=i(Q,qe)}for(var Se=0,wt=0;wt<xe.length;wt++)Se=n(Se,xe[wt].value);return f(Se,this.value)&&(Q.value=0),xe.push(Q),xe};var P={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}}};P.SHORTLONG=rn({},P.SHORT,P.LONG),P.BINARY_SHORT=rn({},P.BINARY_SHORT_SI,P.BINARY_SHORT_IEC),P.BINARY_LONG=rn({},P.BINARY_LONG_SI,P.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 X in O)it(O,X)&&(O[X].key=X);var ne={},Z={name:"",base:ne,value:1,offset:0,dimensions:W.map(Y=>0)},L={meter:{name:"meter",base:O.LENGTH,prefixes:P.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:P.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:P.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:P.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:P.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:P.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:P.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:P.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:P.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:P.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:P.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:P.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:P.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:P.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:P.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:P.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:P.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:P.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:P.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:P.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:P.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:P.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:P.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:P.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:P.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:P.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:P.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:P.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:P.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:P.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:P.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:P.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:P.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:P.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:P.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:P.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:P.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:P.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:P.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:P.NONE,value:61611519921875e-21,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:P.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:P.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:P.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:P.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:P.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:P.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:P.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:P.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:P.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:P.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:P.NONE,value:.238480942392,offset:0},g:{name:"g",base:O.MASS,prefixes:P.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:P.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:P.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:P.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:P.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:P.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:P.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:P.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:P.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:P.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:P.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:P.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:P.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:P.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:P.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:P.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:P.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:P.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:P.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:P.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:P.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:P.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:P.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:P.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:P.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:P.NONE,value:7*86400,offset:0},month:{name:"month",base:O.TIME,prefixes:P.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:P.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:P.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:P.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:P.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:P.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:P.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:P.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:P.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:P.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:P.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:P.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:P.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:P.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:P.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:P.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:P.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:P.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:P.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:P.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:P.SHORT,value:new b(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:P.SHORT,value:new b(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:P.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:P.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:P.LONG,value:new b(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:P.LONG,value:new b(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:P.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:P.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:P.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:P.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:P.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:P.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:P.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:P.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:P.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:P.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:P.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:P.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:P.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:P.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:P.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:P.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:P.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:P.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:P.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:P.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:P.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:P.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:P.SHORT,value:h.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:P.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:P.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:P.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:P.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:P.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:P.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:P.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:P.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:P.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:P.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:P.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:P.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:P.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:P.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:P.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:P.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:P.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:P.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:P.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:P.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:P.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:P.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:P.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:P.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:P.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:P.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:P.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:P.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 me(Y){if(Y.number==="BigNumber"){var Q=tm(x);L.rad.value=new x(1),L.deg.value=Q.div(180),L.grad.value=Q.div(200),L.cycle.value=Q.times(2),L.arcsec.value=Q.div(648e3),L.arcmin.value=Q.div(10800)}else L.rad.value=1,L.deg.value=Math.PI/180,L.grad.value=Math.PI/200,L.cycle.value=Math.PI*2,L.arcsec.value=Math.PI/648e3,L.arcmin.value=Math.PI/10800;L.radian.value=L.rad.value,L.degree.value=L.deg.value,L.gradian.value=L.grad.value}me(t),e&&e("config",function(Y,Q){Y.number!==Q.number&&me(Y)});var oe={si:{NONE:{unit:Z,prefix:P.NONE[""]},LENGTH:{unit:L.m,prefix:P.SHORT[""]},MASS:{unit:L.g,prefix:P.SHORT.k},TIME:{unit:L.s,prefix:P.SHORT[""]},CURRENT:{unit:L.A,prefix:P.SHORT[""]},TEMPERATURE:{unit:L.K,prefix:P.SHORT[""]},LUMINOUS_INTENSITY:{unit:L.cd,prefix:P.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:L.mol,prefix:P.SHORT[""]},ANGLE:{unit:L.rad,prefix:P.SHORT[""]},BIT:{unit:L.bits,prefix:P.SHORT[""]},FORCE:{unit:L.N,prefix:P.SHORT[""]},ENERGY:{unit:L.J,prefix:P.SHORT[""]},POWER:{unit:L.W,prefix:P.SHORT[""]},PRESSURE:{unit:L.Pa,prefix:P.SHORT[""]},ELECTRIC_CHARGE:{unit:L.C,prefix:P.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:L.F,prefix:P.SHORT[""]},ELECTRIC_POTENTIAL:{unit:L.V,prefix:P.SHORT[""]},ELECTRIC_RESISTANCE:{unit:L.ohm,prefix:P.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:L.H,prefix:P.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:L.S,prefix:P.SHORT[""]},MAGNETIC_FLUX:{unit:L.Wb,prefix:P.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:L.T,prefix:P.SHORT[""]},FREQUENCY:{unit:L.Hz,prefix:P.SHORT[""]}}};oe.cgs=JSON.parse(JSON.stringify(oe.si)),oe.cgs.LENGTH={unit:L.m,prefix:P.SHORT.c},oe.cgs.MASS={unit:L.g,prefix:P.SHORT[""]},oe.cgs.FORCE={unit:L.dyn,prefix:P.SHORT[""]},oe.cgs.ENERGY={unit:L.erg,prefix:P.NONE[""]},oe.us=JSON.parse(JSON.stringify(oe.si)),oe.us.LENGTH={unit:L.ft,prefix:P.NONE[""]},oe.us.MASS={unit:L.lbm,prefix:P.NONE[""]},oe.us.TEMPERATURE={unit:L.degF,prefix:P.NONE[""]},oe.us.FORCE={unit:L.lbf,prefix:P.NONE[""]},oe.us.ENERGY={unit:L.BTU,prefix:P.BTU[""]},oe.us.POWER={unit:L.hp,prefix:P.NONE[""]},oe.us.PRESSURE={unit:L.psi,prefix:P.NONE[""]},oe.auto=JSON.parse(JSON.stringify(oe.si));var ve=oe.auto;v.setUnitSystem=function(Y){if(it(oe,Y))ve=oe[Y];else throw new Error("Unit system "+Y+" does not exist. Choices are: "+Object.keys(oe).join(", "))},v.getUnitSystem=function(){for(var Y in oe)if(it(oe,Y)&&oe[Y]===ve)return Y},v.typeConverters={BigNumber:function(Q){return Q!=null&&Q.isFraction?new x(Q.n).div(Q.d).times(Q.s):new x(Q+"")},Fraction:function(Q){return new b(Q)},Complex:function(Q){return Q},number:function(Q){return Q!=null&&Q.isFraction?d(Q):Q}},v.prototype._numberConverter=function(){var Y=v.typeConverters[this.valueType()];if(Y)return Y;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},v._getNumberConverter=function(Y){if(!v.typeConverters[Y])throw new TypeError('Unsupported type "'+Y+'"');return v.typeConverters[Y]};for(var _e in L)if(it(L,_e)){var ye=L[_e];ye.dimensions=ye.base.dimensions}for(var be in pe)if(it(pe,be)){var we=L[pe[be]],Ee={};for(var ze in we)it(we,ze)&&(Ee[ze]=we[ze]);Ee.name=be,L[be]=Ee}v.isValidAlpha=function(Q){return/^[a-zA-Z]$/.test(Q)};function Qe(Y){for(var Q=0;Q<Y.length;Q++){if(y=Y.charAt(Q),Q===0&&!v.isValidAlpha(y))throw new Error('Invalid unit name (must begin with alpha character): "'+Y+'"');if(Q>0&&!(v.isValidAlpha(y)||w(y)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+Y+'"')}}return v.createUnit=function(Y,Q){if(typeof Y!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(Q&&Q.override){for(var xe in Y)if(it(Y,xe)&&v.deleteUnit(xe),Y[xe].aliases)for(var J=0;J<Y[xe].aliases.length;J++)v.deleteUnit(Y[xe].aliases[J])}var re;for(var se in Y)it(Y,se)&&(re=v.createUnitSingle(se,Y[se]));return re},v.createUnitSingle=function(Y,Q){if((typeof Q>"u"||Q===null)&&(Q={}),typeof Y!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(it(L,Y))throw new Error('Cannot create unit "'+Y+'": a unit with that name already exists');Qe(Y);var xe=null,J=[],re=0,se,Ae,Te;if(Q&&Q.type==="Unit")xe=Q.clone();else if(typeof Q=="string")Q!==""&&(se=Q);else if(typeof Q=="object")se=Q.definition,Ae=Q.prefixes,re=Q.offset,Te=Q.baseName,Q.aliases&&(J=Q.aliases.valueOf());else throw new TypeError('Cannot create unit "'+Y+'" from "'+Q.toString()+'": expecting "string" or "Unit" or "Object"');if(J){for(var qe=0;qe<J.length;qe++)if(it(L,J[qe]))throw new Error('Cannot create alias "'+J[qe]+'": a unit with that name already exists')}if(se&&typeof se=="string"&&!xe)try{xe=v.parse(se,{allowNoUnits:!0})}catch(F){throw F.message='Could not create unit "'+Y+'" from "'+se+'": '+F.message,F}else se&&se.type==="Unit"&&(xe=se.clone());J=J||[],re=re||0,Ae&&Ae.toUpperCase?Ae=P[Ae.toUpperCase()]||P.NONE:Ae=P.NONE;var Se={};if(xe){Se={name:Y,value:xe.value,dimensions:xe.dimensions.slice(0),prefixes:Ae,offset:re};var Tt=!1;for(var j in O)if(it(O,j)){for(var le=!0,fe=0;fe<W.length;fe++)if(Math.abs((Se.dimensions[fe]||0)-(O[j].dimensions[fe]||0))>1e-12){le=!1;break}if(le){Tt=!0,Se.base=O[j];break}}if(!Tt){Te=Te||Y+"_STUFF";var Pe={dimensions:xe.dimensions.slice(0)};Pe.key=Te,O[Te]=Pe,ve[Te]={unit:Se,prefix:P.NONE[""]},Se.base=O[Te]}}else{if(Te=Te||Y+"_STUFF",W.indexOf(Te)>=0)throw new Error('Cannot create new base unit "'+Y+'": a base unit with that name already exists (and cannot be overridden)');W.push(Te);for(var wt in O)it(O,wt)&&(O[wt].dimensions[W.length-1]=0);for(var Dt={dimensions:[]},jt=0;jt<W.length;jt++)Dt.dimensions[jt]=0;Dt.dimensions[W.length-1]=1,Dt.key=Te,O[Te]=Dt,Se={name:Y,value:1,dimensions:O[Te].dimensions.slice(0),prefixes:Ae,offset:re,base:O[Te]},ve[Te]={unit:Se,prefix:P.NONE[""]}}v.UNITS[Y]=Se;for(var ke=0;ke<J.length;ke++){var Fe=J[ke],$e={};for(var He in Se)it(Se,He)&&($e[He]=Se[He]);$e.name=Fe,v.UNITS[Fe]=$e}return delete V.cache,new v(null,Y)},v.deleteUnit=function(Y){delete v.UNITS[Y],delete V.cache},v.PREFIXES=P,v.BASE_DIMENSIONS=W,v.BASE_UNITS=O,v.UNIT_SYSTEMS=oe,v.UNITS=L,v},{isClass:!0});var yk="unit",ZK=["typed","Unit"],F1=C(yk,ZK,r=>{var{typed:e,Unit:t}=r;return e(yk,{Unit:function(i){return i.clone()},string:function(i){return t.isValuelessUnit(i)?new t(null,i):t.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new t(i,a)},"number | BigNumber | Fraction":function(i){return new t(i)},"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var xk="sparse",JK=["typed","SparseMatrix"],I1=C(xk,JK,r=>{var{typed:e,SparseMatrix:t}=r;return e(xk,{"":function(){return new t([])},string:function(i){return new t([],i)},"Array | Matrix":function(i){return new t(i)},"Array | Matrix, string":function(i,a){return new t(i,a)}})});var bk="createUnit",XK=["typed","Unit"],P1=C(bk,XK,r=>{var{typed:e,Unit:t}=r;return e(bk,{"Object, Object":function(i,a){return t.createUnit(i,a)},Object:function(i){return t.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var u={};return u[i]=a,t.createUnit(u,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,t.createUnit(o,{})},string:function(i){var a={};return a[i]={},t.createUnit(a,{})}})});var wk="acos",QK=["typed","config","Complex"],B1=C(wk,QK,r=>{var{typed:e,config:t,Complex:n}=r;return e(wk,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var _k="acosh",KK=["typed","config","Complex"],k1=C(_k,KK,r=>{var{typed:e,config:t,Complex:n}=r;return e(_k,{number:function(a){return a>=1||t.predictable?j0(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 Sk="acot",eee=["typed","BigNumber"],$1=C(Sk,eee,r=>{var{typed:e,BigNumber:t}=r;return e(Sk,{number:Z0,Complex:function(i){return i.acot()},BigNumber:function(i){return new t(1).div(i).atan()}})});var Ak="acoth",tee=["typed","config","Complex","BigNumber"],O1=C(Ak,tee,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(Ak,{number:function(o){return o>=1||o<=-1||t.predictable?J0(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var Ek="acsc",ree=["typed","config","Complex","BigNumber"],R1=C(Ek,ree,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(Ek,{number:function(o){return o<=-1||o>=1||t.predictable?X0(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var Tk="acsch",nee=["typed","BigNumber"],L1=C(Tk,nee,r=>{var{typed:e,BigNumber:t}=r;return e(Tk,{number:Q0,Complex:function(i){return i.acsch()},BigNumber:function(i){return new t(1).div(i).asinh()}})});var Mk="asec",iee=["typed","config","Complex","BigNumber"],V1=C(Mk,iee,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(Mk,{number:function(o){return o<=-1||o>=1||t.predictable?K0(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var Dk="asech",aee=["typed","config","Complex","BigNumber"],U1=C(Dk,aee,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(Dk,{number:function(o){if(o<=1&&o>=-1||t.predictable){var u=1/o;if(u>0||t.predictable)return ew(o);var c=Math.sqrt(u*u-1);return new n(Math.log(c-u),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 Ck="asin",oee=["typed","config","Complex"],q1=C(Ck,oee,r=>{var{typed:e,config:t,Complex:n}=r;return e(Ck,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var see="asinh",uee=["typed"],z1=C(see,uee,r=>{var{typed:e}=r;return e("asinh",{number:tw,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var lee="atan",cee=["typed"],H1=C(lee,cee,r=>{var{typed:e}=r;return e("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var Nk="atan2",fee=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],G1=C(Nk,fee,r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=r,u=Mn({typed:e,equalScalar:n}),c=zr({typed:e}),s=fg({typed:e,equalScalar:n}),l=Nr({typed:e,equalScalar:n}),f=yr({typed:e,DenseMatrix:a}),p=Ft({typed:e,matrix:t,concat:o});return e(Nk,{"number, number":Math.atan2,"BigNumber, BigNumber":(m,d)=>i.atan2(m,d)},p({scalar:"number | BigNumber",SS:s,DS:c,SD:u,Ss:l,sS:f}))});var Fk="atanh",pee=["typed","config","Complex"],W1=C(Fk,pee,r=>{var{typed:e,config:t,Complex:n}=r;return e(Fk,{number:function(a){return a<=1&&a>=-1||t.predictable?rw(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var po=C("trigUnit",["typed"],r=>{var{typed:e}=r;return{Unit:e.referToSelf(t=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(t,n.valueType())(n.value)})}});var Ik="cos",mee=["typed"],Y1=C(Ik,mee,r=>{var{typed:e}=r,t=po({typed:e});return e(Ik,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},t)});var Pk="cosh",dee=["typed"],j1=C(Pk,dee,r=>{var{typed:e}=r;return e(Pk,{number:Uh,"Complex | BigNumber":t=>t.cosh()})});var Bk="cot",hee=["typed","BigNumber"],Z1=C(Bk,hee,r=>{var{typed:e,BigNumber:t}=r,n=po({typed:e});return e(Bk,{number:nw,Complex:i=>i.cot(),BigNumber:i=>new t(1).div(i.tan())},n)});var kk="coth",gee=["typed","BigNumber"],J1=C(kk,gee,r=>{var{typed:e,BigNumber:t}=r;return e(kk,{number:iw,Complex:n=>n.coth(),BigNumber:n=>new t(1).div(n.tanh())})});var $k="csc",vee=["typed","BigNumber"],X1=C($k,vee,r=>{var{typed:e,BigNumber:t}=r,n=po({typed:e});return e($k,{number:aw,Complex:i=>i.csc(),BigNumber:i=>new t(1).div(i.sin())},n)});var Ok="csch",yee=["typed","BigNumber"],Q1=C(Ok,yee,r=>{var{typed:e,BigNumber:t}=r;return e(Ok,{number:ow,Complex:n=>n.csch(),BigNumber:n=>new t(1).div(n.sinh())})});var Rk="sec",xee=["typed","BigNumber"],K1=C(Rk,xee,r=>{var{typed:e,BigNumber:t}=r,n=po({typed:e});return e(Rk,{number:sw,Complex:i=>i.sec(),BigNumber:i=>new t(1).div(i.cos())},n)});var Lk="sech",bee=["typed","BigNumber"],eS=C(Lk,bee,r=>{var{typed:e,BigNumber:t}=r;return e(Lk,{number:uw,Complex:n=>n.sech(),BigNumber:n=>new t(1).div(n.cosh())})});var Vk="sin",wee=["typed"],tS=C(Vk,wee,r=>{var{typed:e}=r,t=po({typed:e});return e(Vk,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},t)});var Uk="sinh",_ee=["typed"],rS=C(Uk,_ee,r=>{var{typed:e}=r;return e(Uk,{number:lw,"Complex | BigNumber":t=>t.sinh()})});var qk="tan",See=["typed"],nS=C(qk,See,r=>{var{typed:e}=r,t=po({typed:e});return e(qk,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},t)});var Aee="tanh",Eee=["typed"],iS=C(Aee,Eee,r=>{var{typed:e}=r;return e("tanh",{number:qh,"Complex | BigNumber":t=>t.tanh()})});var zk="setCartesian",Tee=["typed","size","subset","compareNatural","Index","DenseMatrix"],aS=C(zk,Tee,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(zk,{"Array | Matrix, Array | Matrix":function(c,s){var l=[];if(n(t(c),new a(0))!==0&&n(t(s),new a(0))!==0){var f=kt(Array.isArray(c)?c:c.toArray()).sort(i),p=kt(Array.isArray(s)?s:s.toArray()).sort(i);l=[];for(var m=0;m<f.length;m++)for(var d=0;d<p.length;d++)l.push([f[m],p[d]])}return Array.isArray(c)&&Array.isArray(s)?l:new o(l)}})});var Hk="setDifference",Mee=["typed","size","subset","compareNatural","Index","DenseMatrix"],oS=C(Hk,Mee,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(Hk,{"Array | Matrix, Array | Matrix":function(c,s){var l;if(n(t(c),new a(0))===0)l=[];else{if(n(t(s),new a(0))===0)return kt(c.toArray());var f=Vs(kt(Array.isArray(c)?c:c.toArray()).sort(i)),p=Vs(kt(Array.isArray(s)?s:s.toArray()).sort(i));l=[];for(var m,d=0;d<f.length;d++){m=!1;for(var h=0;h<p.length;h++)if(i(f[d].value,p[h].value)===0&&f[d].identifier===p[h].identifier){m=!0;break}m||l.push(f[d])}}return Array.isArray(c)&&Array.isArray(s)?Qc(l):new o(Qc(l))}})});var Gk="setDistinct",Dee=["typed","size","subset","compareNatural","Index","DenseMatrix"],sS=C(Gk,Dee,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(Gk,{"Array | Matrix":function(c){var s;if(n(t(c),new a(0))===0)s=[];else{var l=kt(Array.isArray(c)?c:c.toArray()).sort(i);s=[],s.push(l[0]);for(var f=1;f<l.length;f++)i(l[f],l[f-1])!==0&&s.push(l[f])}return Array.isArray(c)?s:new o(s)}})});var Wk="setIntersect",Cee=["typed","size","subset","compareNatural","Index","DenseMatrix"],uS=C(Wk,Cee,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(Wk,{"Array | Matrix, Array | Matrix":function(c,s){var l;if(n(t(c),new a(0))===0||n(t(s),new a(0))===0)l=[];else{var f=Vs(kt(Array.isArray(c)?c:c.toArray()).sort(i)),p=Vs(kt(Array.isArray(s)?s:s.toArray()).sort(i));l=[];for(var m=0;m<f.length;m++)for(var d=0;d<p.length;d++)if(i(f[m].value,p[d].value)===0&&f[m].identifier===p[d].identifier){l.push(f[m]);break}}return Array.isArray(c)&&Array.isArray(s)?Qc(l):new o(Qc(l))}})});var Yk="setIsSubset",Nee=["typed","size","subset","compareNatural","Index"],lS=C(Yk,Nee,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(Yk,{"Array | Matrix, Array | Matrix":function(u,c){if(n(t(u),new a(0))===0)return!0;if(n(t(c),new a(0))===0)return!1;for(var s=Vs(kt(Array.isArray(u)?u:u.toArray()).sort(i)),l=Vs(kt(Array.isArray(c)?c:c.toArray()).sort(i)),f,p=0;p<s.length;p++){f=!1;for(var m=0;m<l.length;m++)if(i(s[p].value,l[m].value)===0&&s[p].identifier===l[m].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var jk="setMultiplicity",Fee=["typed","size","subset","compareNatural","Index"],cS=C(jk,Fee,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(jk,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(u,c){if(n(t(c),new a(0))===0)return 0;for(var s=kt(Array.isArray(c)?c:c.toArray()),l=0,f=0;f<s.length;f++)i(s[f],u)===0&&l++;return l}})});var Zk="setPowerset",Iee=["typed","size","subset","compareNatural","Index"],fS=C(Zk,Iee,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(Zk,{"Array | Matrix":function(s){if(n(t(s),new a(0))===0)return[];for(var l=kt(Array.isArray(s)?s:s.toArray()).sort(i),f=[],p=0;p.toString(2).length<=l.length;)f.push(o(l,p.toString(2).split("").reverse())),p++;return u(f)}});function o(c,s){for(var l=[],f=0;f<s.length;f++)s[f]==="1"&&l.push(c[f]);return l}function u(c){for(var s=[],l=c.length-1;l>0;l--)for(var f=0;f<l;f++)c[f].length>c[f+1].length&&(s=c[f],c[f]=c[f+1],c[f+1]=s);return c}});var Jk="setSize",Pee=["typed","compareNatural"],pS=C(Jk,Pee,r=>{var{typed:e,compareNatural:t}=r;return e(Jk,{"Array | Matrix":function(i){return Array.isArray(i)?kt(i).length:kt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?kt(i).length:kt(i.toArray()).length;for(var o=kt(Array.isArray(i)?i:i.toArray()).sort(t),u=1,c=1;c<o.length;c++)t(o[c],o[c-1])!==0&&u++;return u}})});var Xk="setSymDifference",Bee=["typed","size","concat","subset","setDifference","Index"],mS=C(Xk,Bee,r=>{var{typed:e,size:t,concat:n,subset:i,setDifference:a,Index:o}=r;return e(Xk,{"Array | Matrix, Array | Matrix":function(c,s){if(i(t(c),new o(0))===0)return kt(s);if(i(t(s),new o(0))===0)return kt(c);var l=kt(c),f=kt(s);return n(a(l,f),a(f,l))}})});var Qk="setUnion",kee=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],dS=C(Qk,kee,r=>{var{typed:e,size:t,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:u}=r;return e(Qk,{"Array | Matrix, Array | Matrix":function(s,l){if(i(t(s),new u(0))===0)return kt(l);if(i(t(l),new u(0))===0)return kt(s);var f=kt(s),p=kt(l);return n(o(f,p),a(f,p))}})});var Kk="add",$ee=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],hS=C(Kk,$ee,r=>{var{typed:e,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:u}=r,c=Mi({typed:e}),s=nf({typed:e,equalScalar:i}),l=pa({typed:e,DenseMatrix:a}),f=Ft({typed:e,matrix:t,concat:u});return e(Kk,{"any, any":n,"any, any, ...any":e.referToSelf(p=>(m,d,h)=>{for(var x=p(m,d),b=0;b<h.length;b++)x=p(x,h[b]);return x})},f({elop:n,DS:c,SS:s,Ss:l}))});var e$="hypot",Oee=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],gS=C(e$,Oee,r=>{var{typed:e,abs:t,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:u,isPositive:c}=r;return e(e$,{"... number | BigNumber":s,Array:s,Matrix:l=>s(kt(l.toArray()))});function s(l){for(var f=0,p=0,m=0;m<l.length;m++){if(Hi(l[m]))throw new TypeError("Unexpected type of argument to hypot");var d=t(l[m]);u(p,d)?(f=a(f,a(i(p,d),i(p,d))),f=n(f,1),p=d):f=n(f,c(d)?a(i(d,p),i(d,p)):d)}return a(p,o(f))}});var t$="norm",Ree=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],vS=C(t$,Ree,r=>{var{typed:e,abs:t,add:n,pow:i,conj:a,sqrt:o,multiply:u,equalScalar:c,larger:s,smaller:l,matrix:f,ctranspose:p,eigs:m}=r;return e(t$,{number:Math.abs,Complex:function(M){return M.abs()},BigNumber:function(M){return M.abs()},boolean:function(M){return Math.abs(M)},Array:function(M){return y(f(M),2)},Matrix:function(M){return y(M,2)},"Array, number | BigNumber | string":function(M,w){return y(f(M),w)},"Matrix, number | BigNumber | string":function(M,w){return y(M,w)}});function d(A){var M=0;return A.forEach(function(w){var D=t(w);s(D,M)&&(M=D)},!0),M}function h(A){var M;return A.forEach(function(w){var D=t(w);(!M||l(D,M))&&(M=D)},!0),M||0}function x(A,M){if(M===Number.POSITIVE_INFINITY||M==="inf")return d(A);if(M===Number.NEGATIVE_INFINITY||M==="-inf")return h(A);if(M==="fro")return y(A,2);if(typeof M=="number"&&!isNaN(M)){if(!c(M,0)){var w=0;return A.forEach(function(D){w=n(i(t(D),M),w)},!0),i(w,1/M)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function b(A){var M=0;return A.forEach(function(w,D){M=n(M,u(w,a(w)))}),t(o(M))}function T(A){var M=[],w=0;return A.forEach(function(D,N){var B=N[1],R=n(M[B]||0,t(D));s(R,w)&&(w=R),M[B]=R},!0),w}function v(A){var M=A.size();if(M[0]!==M[1])throw new RangeError("Invalid matrix dimensions");var w=p(A),D=u(w,A),N=m(D).values.toArray(),B=N[N.length-1];return t(o(B))}function S(A){var M=[],w=0;return A.forEach(function(D,N){var B=N[0],R=n(M[B]||0,t(D));s(R,w)&&(w=R),M[B]=R},!0),w}function _(A,M){if(M===1)return T(A);if(M===Number.POSITIVE_INFINITY||M==="inf")return S(A);if(M==="fro")return b(A);if(M===2)return v(A);throw new Error("Unsupported parameter value "+M)}function y(A,M){var w=A.size();if(w.length===1)return x(A,M);if(w.length===2){if(w[0]&&w[1])return _(A,M);throw new RangeError("Invalid matrix dimensions")}}});var r$="dot",Lee=["typed","addScalar","multiplyScalar","conj","size"],yS=C(r$,Lee,r=>{var{typed:e,addScalar:t,multiplyScalar:n,conj:i,size:a}=r;return e(r$,{"Array | DenseMatrix, Array | DenseMatrix":u,"SparseMatrix, SparseMatrix":c});function o(l,f){var p=s(l),m=s(f),d,h;if(p.length===1)d=p[0];else if(p.length===2&&p[1]===1)d=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(m.length===1)h=m[0];else if(m.length===2&&m[1]===1)h=m[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+m.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 u(l,f){var p=o(l,f),m=et(l)?l._data:l,d=et(l)?l._datatype||l.getDataType():void 0,h=et(f)?f._data:f,x=et(f)?f._datatype||f.getDataType():void 0,b=s(l).length===2,T=s(f).length===2,v=t,S=n;if(d&&x&&d===x&&typeof d=="string"&&d!=="mixed"){var _=d;v=e.find(t,[_,_]),S=e.find(n,[_,_])}if(!b&&!T){for(var y=S(i(m[0]),h[0]),A=1;A<p;A++)y=v(y,S(i(m[A]),h[A]));return y}if(!b&&T){for(var M=S(i(m[0]),h[0][0]),w=1;w<p;w++)M=v(M,S(i(m[w]),h[w][0]));return M}if(b&&!T){for(var D=S(i(m[0][0]),h[0]),N=1;N<p;N++)D=v(D,S(i(m[N][0]),h[N]));return D}if(b&&T){for(var B=S(i(m[0][0]),h[0][0]),R=1;R<p;R++)B=v(B,S(i(m[R][0]),h[R][0]));return B}}function c(l,f){o(l,f);for(var p=l._index,m=l._values,d=f._index,h=f._values,x=0,b=t,T=n,v=0,S=0;v<p.length&&S<d.length;){var _=p[v],y=d[S];if(_<y){v++;continue}if(_>y){S++;continue}_===y&&(x=b(x,T(m[v],h[S])),v++,S++)}return x}function s(l){return et(l)?l.size():a(l)}});var Vee="trace",Uee=["typed","matrix","add"],xS=C(Vee,Uee,r=>{var{typed:e,matrix:t,add:n}=r;return e("trace",{Array:function(u){return i(t(u))},SparseMatrix:a,DenseMatrix:i,any:dt});function i(o){var u=o._size,c=o._data;switch(u.length){case 1:if(u[0]===1)return dt(c[0]);throw new RangeError("Matrix must be square (size: "+Et(u)+")");case 2:{var s=u[0],l=u[1];if(s===l){for(var f=0,p=0;p<s;p++)f=n(f,c[p][p]);return f}else throw new RangeError("Matrix must be square (size: "+Et(u)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Et(u)+")")}}function a(o){var u=o._values,c=o._index,s=o._ptr,l=o._size,f=l[0],p=l[1];if(f===p){var m=0;if(u.length>0)for(var d=0;d<p;d++)for(var h=s[d],x=s[d+1],b=h;b<x;b++){var T=c[b];if(T===d){m=n(m,u[b]);break}if(T>d)break}return m}throw new RangeError("Matrix must be square (size: "+Et(l)+")")}});var n$="index",qee=["typed","Index"],bS=C(n$,qee,r=>{var{typed:e,Index:t}=r;return e(n$,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(u){return ut(u)?u.toNumber():dr(u)||et(u)?u.map(function(c){return ut(c)?c.toNumber():c}):u}),o=new t;return t.apply(o,a),o}})});var Ag=new Set(["end"]);var zee="Node",Hee=["mathWithTransform"],wS=C(zee,Hee,r=>{var{mathWithTransform:e}=r;function t(i){for(var a of[...Ag])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={},u=null;function c(s){var l=$s(s);return t(l),a(l,o,u)}return{evaluate:c}}_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(!tr(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(u,c){u.forEach(function(s,l,f){c(s,l,f),o(s,c)})}o(this,a)}transform(a){function o(u,c,s){var l=a(u,c,s);return l!==u?l:u.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(u,c,s){a(u,c,s)&&o.push(u)}),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&&la(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 Hr(r){return r&&r.isIndexError?new di(r.index+1,r.min+1,r.max!==void 0?r.max+1:void 0):r}function Eg(r){var{subset:e}=r;return function(n,i){try{if(Array.isArray(n))return e(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return e(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Kr(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Hr(a)}}}var Tg="AccessorNode",Gee=["subset","Node"],_S=C(Tg,Gee,r=>{var{subset:e,Node:t}=r,n=Eg({subset:e});function i(o){return!(Ca(o)||fi(o)||qt(o)||Gi(o)||Tu(o)||pi(o)||Ur(o))}class a extends t{constructor(u,c){if(super(),!tr(u))throw new TypeError('Node expected for parameter "object"');if(!oo(c))throw new TypeError('IndexNode expected for parameter "index"');this.object=u,this.index=c}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Tg}get isAccessorNode(){return!0}_compile(u,c){var s=this.object._compile(u,c),l=this.index._compile(u,c);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(m,d,h){return Kr(s(m,d,h),f)}}else return function(m,d,h){var x=s(m,d,h),b=l(m,d,x);return n(x,b)}}forEach(u){u(this.object,"object",this),u(this.index,"index",this)}map(u){return new a(this._ifNode(u(this.object,"object",this)),this._ifNode(u(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(u){var c=this.object.toString(u);return i(this.object)&&(c="("+c+")"),c+this.index.toString(u)}_toHTML(u){var c=this.object.toHTML(u);return i(this.object)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+this.index.toHTML(u)}_toTex(u){var c=this.object.toTex(u);return i(this.object)&&(c="\\left(' + object + '\\right)"),c+this.index.toTex(u)}toJSON(){return{mathjs:Tg,object:this.object,index:this.index}}static fromJSON(u){return new a(u.object,u.index)}}return wr(a,"name",Tg),a},{isClass:!0,isNode:!0});var Mg="ArrayNode",Wee=["Node"],SS=C(Mg,Wee,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(tr))throw new TypeError("Array containing Nodes expected")}get type(){return Mg}get isArrayNode(){return!0}_compile(i,a){var o=uo(this.items,function(s){return s._compile(i,a)}),u=i.config.matrix!=="Array";if(u){var c=i.matrix;return function(l,f,p){return c(uo(o,function(m){return m(l,f,p)}))}}else return function(l,f,p){return uo(o,function(m){return m(l,f,p)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new t(a)}clone(){return new t(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:Mg,items:this.items}}static fromJSON(i){return new t(i.items)}_toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,u){var c=o.some(fi)&&!o.every(fi),s=u||c,l=s?"&":"\\\\",f=o.map(function(p){return p.items?a(p.items,!u):p.toTex(i)}).join(l);return c||!s||s&&!u?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return wr(t,"name",Mg),t},{isClass:!0,isNode:!0});function i$(r){var{subset:e,matrix:t}=r;return function(i,a,o){try{if(Array.isArray(i)){var u=t(i).subset(a,o).valueOf();return u.forEach((c,s)=>{i[s]=c}),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 Qo(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(c){throw Hr(c)}}}var mo=[{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 Dg(r,e){if(!e||e!=="auto")return r;for(var t=r;pi(t);)t=t.content;return t}function Ar(r,e,t,n){var i=r;e!=="keep"&&(i=r.getContent());for(var a=i.getIdentifier(),o=null,u=0;u<mo.length;u++)if(a in mo[u]){o=u;break}if(a==="OperatorNode:multiply"&&i.implicit&&t!=="show"){var c=Dg(i.args[0],e);!(qt(c)&&n&&n.getIdentifier()==="OperatorNode:divide"&&Tp(Dg(n.args[0],e)))&&!(c.getIdentifier()==="OperatorNode:divide"&&Tp(Dg(c.args[0],e))&&qt(Dg(c.args[1])))&&(o+=1)}return o}function ff(r,e){var t=r;e!=="keep"&&(t=r.getContent());var n=t.getIdentifier(),i=Ar(t,e);if(i===null)return null;var a=mo[i][n];if(it(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 Cg(r,e,t){var n=t!=="keep"?r.getContent():r,i=t!=="keep"?r.getContent():e,a=n.getIdentifier(),o=i.getIdentifier(),u=Ar(n,t);if(u===null)return null;var c=mo[u][a];if(it(c,"associativeWith")&&c.associativeWith instanceof Array){for(var s=0;s<c.associativeWith.length;s++)if(c.associativeWith[s]===o)return!0;return!1}return null}function a$(r){var e="OperatorNode:"+r;for(var t of mo)if(e in t)return t[e].op;return null}var Ng="AssignmentNode",Yee=["subset","?matrix","Node"],AS=C(Ng,Yee,r=>{var{subset:e,matrix:t,Node:n}=r,i=Eg({subset:e}),a=i$({subset:e,matrix:t});function o(c,s,l){s||(s="keep");var f=Ar(c,s,l),p=Ar(c.value,s,l);return s==="all"||p!==null&&p<=f}class u extends n{constructor(s,l,f){if(super(),this.object=s,this.index=f?l:null,this.value=f||l,!Ur(s)&&!Ca(s))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Ur(s)&&s.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!oo(this.index))throw new TypeError('IndexNode expected as "index"');if(!tr(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 Ng}get isAssignmentNode(){return!0}_compile(s,l){var f=this.object._compile(s,l),p=this.index?this.index._compile(s,l):null,m=this.value._compile(s,l),d=this.object.name;if(this.index)if(this.index.isObjectProperty()){var h=this.index.getObjectProperty();return function(S,_,y){var A=f(S,_,y),M=m(S,_,y);return Qo(A,h,M),M}}else{if(Ur(this.object))return function(S,_,y){var A=f(S,_,y),M=m(S,_,y),w=p(S,_,A);return S.set(d,a(A,w,M)),M};var x=this.object.object._compile(s,l);if(this.object.index.isObjectProperty()){var b=this.object.index.getObjectProperty();return function(S,_,y){var A=x(S,_,y),M=Kr(A,b),w=p(S,_,M),D=m(S,_,y);return Qo(A,b,a(M,w,D)),D}}else{var T=this.object.index._compile(s,l);return function(S,_,y){var A=x(S,_,y),M=T(S,_,A),w=i(A,M),D=p(S,_,w),N=m(S,_,y);return a(A,M,a(w,D,N)),N}}}else{if(!Ur(this.object))throw new TypeError("SymbolNode expected as object");return function(S,_,y){var A=m(S,_,y);return S.set(d,A),A}}}forEach(s){s(this.object,"object",this),this.index&&s(this.index,"index",this),s(this.value,"value",this)}map(s){var l=this._ifNode(s(this.object,"object",this)),f=this.index?this._ifNode(s(this.index,"index",this)):null,p=this._ifNode(s(this.value,"value",this));return new u(l,f,p)}clone(){return new u(this.object,this.index,this.value)}_toString(s){var l=this.object.toString(s),f=this.index?this.index.toString(s):"",p=this.value.toString(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p="("+p+")"),l+f+" = "+p}toJSON(){return{mathjs:Ng,object:this.object,index:this.index,value:this.value}}static fromJSON(s){return new u(s.object,s.index,s.value)}_toHTML(s){var l=this.object.toHTML(s),f=this.index?this.index.toHTML(s):"",p=this.value.toHTML(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p='<span class="math-paranthesis math-round-parenthesis">(</span>'+p+'<span class="math-paranthesis math-round-parenthesis">)</span>'),l+f+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+p}_toTex(s){var l=this.object.toTex(s),f=this.index?this.index.toTex(s):"",p=this.value.toTex(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p="\\left(".concat(p,"\\right)")),l+f+"="+p}}return wr(u,"name",Ng),u},{isClass:!0,isNode:!0});var Fg="BlockNode",jee=["ResultSet","Node"],ES=C(Fg,jee,r=>{var{ResultSet:e,Node:t}=r;class n extends t{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var u=o&&o.node,c=o&&o.visible!==void 0?o.visible:!0;if(!tr(u))throw new TypeError('Property "node" must be a Node');if(typeof c!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:u,visible:c}})}get type(){return Fg}get isBlockNode(){return!0}_compile(a,o){var u=uo(this.blocks,function(c){return{evaluate:c.node._compile(a,o),visible:c.visible}});return function(s,l,f){var p=[];return rg(u,function(d){var h=d.evaluate(s,l,f);d.visible&&p.push(h)}),new e(p)}}forEach(a){for(var o=0;o<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],u=0;u<this.blocks.length;u++){var c=this.blocks[u],s=this._ifNode(a(c.node,"blocks["+u+"].node",this));o[u]={node:s,visible:c.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:Fg,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 wr(n,"name",Fg),n},{isClass:!0,isNode:!0});var Ig="ConditionalNode",Zee=["Node"],TS=C(Ig,Zee,r=>{var{Node:e}=r;function t(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(ut(i))return!i.isZero();if(Hi(i))return!!(i.re||i.im);if(ci(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+ur(i)+'"')}class n extends e{constructor(a,o,u){if(super(),!tr(a))throw new TypeError("Parameter condition must be a Node");if(!tr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!tr(u))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=u}get type(){return Ig}get isConditionalNode(){return!0}_compile(a,o){var u=this.condition._compile(a,o),c=this.trueExpr._compile(a,o),s=this.falseExpr._compile(a,o);return function(f,p,m){return t(u(f,p,m))?c(f,p,m):s(f,p,m)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=Ar(this,o,a&&a.implicit),c=this.condition.toString(a),s=Ar(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=u)&&(c="("+c+")");var l=this.trueExpr.toString(a),f=Ar(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=u)&&(l="("+l+")");var p=this.falseExpr.toString(a),m=Ar(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=u)&&(p="("+p+")"),c+" ? "+l+" : "+p}toJSON(){return{mathjs:Ig,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",u=Ar(this,o,a&&a.implicit),c=this.condition.toHTML(a),s=Ar(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=u)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var l=this.trueExpr.toHTML(a),f=Ar(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=u)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var p=this.falseExpr.toHTML(a),m=Ar(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=u)&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+'<span class="math-operator math-conditional-operator">?</span>'+l+'<span class="math-operator math-conditional-operator">:</span>'+p}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return wr(n,"name",Ig),n},{isClass:!0,isNode:!0});var l$=Or(s$(),1);var DS={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{?}"},xr={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"},CS={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(xr.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(xr.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(xr.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(xr.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(xr.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(xr.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(xr.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(xr.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(xr.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(xr.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(xr.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(xr.bitAnd,"${args[1]}\\right)")},bitNot:{1:xr.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(xr.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(xr.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(xr.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(xr.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(xr.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(xr.and,"${args[1]}\\right)")},not:{1:xr.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(xr.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(xr.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(xr.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(xr.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(xr.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(xr.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(xr.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(xr.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(xr.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(xr.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(xr.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(xr.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(xr.to,"${args[1]}\\right)")},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(DS.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)"}},c$="\\mathrm{${name}}\\left(${args}\\right)",u$={deg:"^\\circ"};function Pg(r){return(0,l$.default)(r,{preserveFormatting:!0})}function Bg(r,e){return e=typeof e>"u"?!1:e,e?it(u$,r)?u$[r]:"\\mathrm{"+Pg(r)+"}":it(DS,r)?DS[r]:Pg(r)}var kg="ConstantNode",Kee=["Node"],NS=C(kg,Kee,r=>{var{Node:e}=r;class t extends e{constructor(i){super(),this.value=i}get type(){return kg}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new t(this.value)}_toString(i){return Et(this.value,i)}_toHTML(i){var a=this._toString(i);switch(ur(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:kg,value:this.value}}static fromJSON(i){return new t(i.value)}_toTex(i){var a=this._toString(i),o=ur(this.value);switch(o){case"string":return"\\mathtt{"+Pg(a)+"}";case"number":case"BigNumber":{var u=o==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!u)return this.value.valueOf()<0?"-\\infty":"\\infty";var c=a.toLowerCase().indexOf("e");return c!==-1?a.substring(0,c)+"\\cdot10^{"+a.substring(c+1)+"}":a}case"bigint":return a.toString();case"Fraction":return this.value.toLatex();default:return a}}}return wr(t,"name",kg),t},{isClass:!0,isNode:!0});var $g="FunctionAssignmentNode",ete=["typed","Node"],FS=C($g,ete,r=>{var{typed:e,Node:t}=r;function n(a,o,u){var c=Ar(a,o,u),s=Ar(a.expr,o,u);return o==="all"||s!==null&&s<=c}class i extends t{constructor(o,u,c){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(u))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!tr(c))throw new TypeError('Node expected for parameter "expr"');if(Ag.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var s=new Set;for(var l of u){var f=typeof l=="string"?l:l.name;if(s.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));s.add(f)}this.name=o,this.params=u.map(function(p){return p&&p.name||p}),this.types=u.map(function(p){return p&&p.type||"any"}),this.expr=c}get type(){return $g}get isFunctionAssignmentNode(){return!0}_compile(o,u){var c=Object.create(u);rg(this.params,function(d){c[d]=!0});var s=this.expr._compile(o,c),l=this.name,f=this.params,p=m0(this.types,","),m=l+"("+m0(this.params,", ")+")";return function(h,x,b){var T={};T[p]=function(){for(var S=Object.create(x),_=0;_<f.length;_++)S[f[_]]=arguments[_];return s(h,S,b)};var v=e(l,T);return v.syntax=m,h.set(l,v),v}}forEach(o){o(this.expr,"expr",this)}map(o){var u=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),u)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var u=o&&o.parenthesis?o.parenthesis:"keep",c=this.expr.toString(o);return n(this,u,o&&o.implicit)&&(c="("+c+")"),this.name+"("+this.params.join(", ")+") = "+c}toJSON(){var o=this.types;return{mathjs:$g,name:this.name,params:this.params.map(function(u,c){return{name:u,type:o[c]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var u=o&&o.parenthesis?o.parenthesis:"keep",c=[],s=0;s<this.params.length;s++)c.push('<span class="math-symbol math-parameter">'+jn(this.params[s])+"</span>");var l=this.expr.toHTML(o);return n(this,u,o&&o.implicit)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+jn(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+c.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>'+l}_toTex(o){var u=o&&o.parenthesis?o.parenthesis:"keep",c=this.expr.toTex(o);return n(this,u,o&&o.implicit)&&(c="\\left(".concat(c,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Bg).join(",")+"\\right)="+c}}return wr(i,"name",$g),i},{isClass:!0,isNode:!0});var Og="IndexNode",tte=["Node","size"],IS=C(Og,tte,r=>{var{Node:e,size:t}=r;class n extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(tr))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 Og}get isIndexNode(){return!0}_compile(a,o){var u=uo(this.dimensions,function(s,l){var f=s.filter(d=>d.isSymbolNode&&d.name==="end").length>0;if(f){var p=Object.create(o);p.end=!0;var m=s._compile(a,p);return function(h,x,b){if(!et(b)&&!dr(b)&&!dn(b))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+ur(b));var T=t(b).valueOf(),v=Object.create(x);return v.end=T[l],m(h,v,b)}}else return s._compile(a,o)}),c=Kr(a,"index");return function(l,f,p){var m=uo(u,function(d){return d(l,f,p)});return c(...m)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],u=0;u<this.dimensions.length;u++)o[u]=this._ifNode(a(this.dimensions[u],"dimensions["+u+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&qt(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:Og,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],u=0;u<this.dimensions.length;u++)o[u]=this.dimensions[u].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+jn(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(u){return u.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return wr(n,"name",Og),n},{isClass:!0,isNode:!0});var Rg="ObjectNode",rte=["Node"],PS=C(Rg,rte,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return tr(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Rg}get isObjectNode(){return!0}_compile(i,a){var o={};for(var u in this.properties)if(it(this.properties,u)){var c=Dl(u),s=JSON.parse(c),l=Kr(this.properties,u);o[s]=l._compile(i,a)}return function(p,m,d){var h={};for(var x in o)it(o,x)&&(h[x]=o[x](p,m,d));return h}}forEach(i){for(var a in this.properties)it(this.properties,a)&&i(this.properties[a],"properties["+Dl(a)+"]",this)}map(i){var a={};for(var o in this.properties)it(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Dl(o)+"]",this)));return new t(a)}clone(){var i={};for(var a in this.properties)it(this.properties,a)&&(i[a]=this.properties[a]);return new t(i)}_toString(i){var a=[];for(var o in this.properties)it(this.properties,o)&&a.push(Dl(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Rg,properties:this.properties}}static fromJSON(i){return new t(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)it(this.properties,o)&&a.push('<span class="math-symbol math-property">'+jn(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)it(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var u="\\left\\{\\begin{array}{ll}"+a.join(`
`)+"\\end{array}\\right\\}";return u}}return wr(t,"name",Rg),t},{isClass:!0,isNode:!0});function $l(r,e){return new Hc(r,new _u(e),new Set(Object.keys(e)))}var Lg="OperatorNode",nte=["Node"],BS=C(Lg,nte,r=>{var{Node:e}=r;function t(a,o){var u=a;if(o==="auto")for(;pi(u);)u=u.content;return qt(u)?!0:Wr(u)?t(u.args[0],o):!1}function n(a,o,u,c,s){var l=Ar(a,o,u),f=ff(a,o);if(o==="all"||c.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return c.map(function(D){switch(D.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var p;switch(c.length){case 0:p=[];break;case 1:{var m=Ar(c[0],o,u,a);if(s&&m!==null){var d,h;if(o==="keep"?(d=c[0].getIdentifier(),h=a.getIdentifier()):(d=c[0].getContent().getIdentifier(),h=a.getContent().getIdentifier()),mo[l][h].latexLeftParens===!1){p=[!1];break}if(mo[m][d].latexParens===!1){p=[!1];break}}if(m===null){p=[!1];break}if(m<=l){p=[!0];break}p=[!1]}break;case 2:{var x,b=Ar(c[0],o,u,a),T=Cg(a,c[0],o);b===null?x=!1:b===l&&f==="right"&&!T||b<l?x=!0:x=!1;var v,S=Ar(c[1],o,u,a),_=Cg(a,c[1],o);if(S===null?v=!1:S===l&&f==="left"&&!_||S<l?v=!0:v=!1,s){var y,A,M;o==="keep"?(y=a.getIdentifier(),A=a.args[0].getIdentifier(),M=a.args[1].getIdentifier()):(y=a.getContent().getIdentifier(),A=a.args[0].getContent().getIdentifier(),M=a.args[1].getContent().getIdentifier()),b!==null&&(mo[l][y].latexLeftParens===!1&&(x=!1),mo[b][A].latexParens===!1&&(x=!1)),S!==null&&(mo[l][y].latexRightParens===!1&&(v=!1),mo[S][M].latexParens===!1&&(v=!1))}p=[x,v]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(p=c.map(function(D){var N=Ar(D,o,u,a),B=Cg(a,D,o),R=ff(D,o);return N===null?!1:l===N&&f===R&&!B?!0:N<l}));break}if(c.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&u==="hide")for(var w=1;w<p.length;++w)t(c[w],o)&&!p[w-1]&&(o!=="keep"||!pi(c[w-1]))&&(p[w]=!0);return p}class i extends e{constructor(o,u,c,s,l){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof u!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(c)||!c.every(tr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=s===!0,this.isPercentage=l===!0,this.op=o,this.fn=u,this.args=c||[]}get type(){return Lg}get isOperatorNode(){return!0}_compile(o,u){if(typeof this.fn!="string"||!Bh(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 c=Kr(o,this.fn),s=uo(this.args,function(d){return d._compile(o,u)});if(typeof c=="function"&&c.rawArgs===!0){var l=this.args;return function(h,x,b){return c(l,o,$l(h,x))}}else if(s.length===1){var f=s[0];return function(h,x,b){return c(f(h,x,b))}}else if(s.length===2){var p=s[0],m=s[1];return function(h,x,b){return c(p(h,x,b),m(h,x,b))}}else return function(h,x,b){return c.apply(null,uo(s,function(T){return T(h,x,b)}))}}forEach(o){for(var u=0;u<this.args.length;u++)o(this.args[u],"args["+u+"]",this)}map(o){for(var u=[],c=0;c<this.args.length;c++)u[c]=this._ifNode(o(this.args[c],"args["+c+"]",this));return new i(this.op,this.fn,u,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 u=o&&o.parenthesis?o.parenthesis:"keep",c=o&&o.implicit?o.implicit:"hide",s=this.args,l=n(this,u,c,s,!1);if(s.length===1){var f=ff(this,u),p=s[0].toString(o);l[0]&&(p="("+p+")");var m=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(m?" ":"")+p:f==="left"?p+(m?" ":"")+this.op:p+this.op}else if(s.length===2){var d=s[0].toString(o),h=s[1].toString(o);return l[0]&&(d="("+d+")"),l[1]&&(h="("+h+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?d+" "+h:d+" "+this.op+" "+h}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var x=s.map(function(b,T){return b=b.toString(o),l[T]&&(b="("+b+")"),b});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?x.join(" "):x.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Lg,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 u=o&&o.parenthesis?o.parenthesis:"keep",c=o&&o.implicit?o.implicit:"hide",s=this.args,l=n(this,u,c,s,!1);if(s.length===1){var f=ff(this,u),p=s[0].toHTML(o);return l[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+jn(this.op)+"</span>"+p:p+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+jn(this.op)+"</span>"}else if(s.length===2){var m=s[0].toHTML(o),d=s[1].toHTML(o);return l[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l[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"&&c==="hide"?m+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+d:m+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+jn(this.op)+"</span>"+d}else{var h=s.map(function(x,b){return x=x.toHTML(o),l[b]&&(x='<span class="math-parenthesis math-round-parenthesis">(</span>'+x+'<span class="math-parenthesis math-round-parenthesis">)</span>'),x});return s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?h.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):h.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+jn(this.op)+"</span>"):'<span class="math-function">'+jn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+h.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var u=o&&o.parenthesis?o.parenthesis:"keep",c=o&&o.implicit?o.implicit:"hide",s=this.args,l=n(this,u,c,s,!0),f=xr[this.fn];if(f=typeof f>"u"?this.op:f,s.length===1){var p=ff(this,u),m=s[0].toTex(o);return l[0]&&(m="\\left(".concat(m,"\\right)")),p==="right"?f+m:m+f}else if(s.length===2){var d=s[0],h=d.toTex(o);l[0]&&(h="\\left(".concat(h,"\\right)"));var x=s[1],b=x.toTex(o);l[1]&&(b="\\left(".concat(b,"\\right)"));var T;switch(u==="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&&c==="hide")return h+"~"+b}return h+f+b}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=s.map(function(S,_){return S=S.toTex(o),l[_]&&(S="\\left(".concat(S,"\\right)")),S});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&c==="hide"?v.join("~"):v.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+s.map(function(S){return S.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return wr(i,"name",Lg),i},{isClass:!0,isNode:!0});var Vg="ParenthesisNode",ite=["Node"],kS=C(Vg,ite,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),!tr(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return Vg}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new t(a)}clone(){return new t(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:Vg,content:this.content}}static fromJSON(i){return new t(i.content)}_toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return wr(t,"name",Vg),t},{isClass:!0,isNode:!0});var Ug="RangeNode",ate=["Node"],$S=C(Ug,ate,r=>{var{Node:e}=r;function t(i,a,o){var u=Ar(i,a,o),c={},s=Ar(i.start,a,o);if(c.start=s!==null&&s<=u||a==="all",i.step){var l=Ar(i.step,a,o);c.step=l!==null&&l<=u||a==="all"}var f=Ar(i.end,a,o);return c.end=f!==null&&f<=u||a==="all",c}class n extends e{constructor(a,o,u){if(super(),!tr(a))throw new TypeError("Node expected");if(!tr(o))throw new TypeError("Node expected");if(u&&!tr(u))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=u||null}get type(){return Ug}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Ur(o)&&o.name==="end"});return a.length>0}_compile(a,o){var u=a.range,c=this.start._compile(a,o),s=this.end._compile(a,o);if(this.step){var l=this.step._compile(a,o);return function(p,m,d){return u(c(p,m,d),s(p,m,d),l(p,m,d))}}else return function(p,m,d){return u(c(p,m,d),s(p,m,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",u=t(this,o,a&&a.implicit),c,s=this.start.toString(a);if(u.start&&(s="("+s+")"),c=s,this.step){var l=this.step.toString(a);u.step&&(l="("+l+")"),c+=":"+l}var f=this.end.toString(a);return u.end&&(f="("+f+")"),c+=":"+f,c}toJSON(){return{mathjs:Ug,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",u=t(this,o,a&&a.implicit),c,s=this.start.toHTML(a);if(u.start&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c=s,this.step){var l=this.step.toHTML(a);u.step&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+='<span class="math-operator math-range-operator">:</span>'+l}var f=this.end.toHTML(a);return u.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+='<span class="math-operator math-range-operator">:</span>'+f,c}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=t(this,o,a&&a.implicit),c=this.start.toTex(a);if(u.start&&(c="\\left(".concat(c,"\\right)")),this.step){var s=this.step.toTex(a);u.step&&(s="\\left(".concat(s,"\\right)")),c+=":"+s}var l=this.end.toTex(a);return u.end&&(l="\\left(".concat(l,"\\right)")),c+=":"+l,c}}return wr(n,"name",Ug),n},{isClass:!0,isNode:!0});var qg="RelationalNode",ote=["Node"],OS=C(qg,ote,r=>{var{Node:e}=r,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends e{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return qg}get isRelationalNode(){return!0}_compile(a,o){var u=this,c=this.params.map(s=>s._compile(a,o));return function(l,f,p){for(var m,d=c[0](l,f,p),h=0;h<u.conditionals.length;h++){m=d,d=c[h+1](l,f,p);var x=Kr(a,u.conditionals[h]);if(!x(m,d))return!1}return!0}}forEach(a){this.params.forEach((o,u)=>a(o,"params["+u+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,u)=>this._ifNode(a(o,"params["+u+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=Ar(this,o,a&&a.implicit),c=this.params.map(function(f,p){var m=Ar(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?"("+f.toString(a)+")":f.toString(a)}),s=c[0],l=0;l<this.conditionals.length;l++)s+=" "+t[this.conditionals[l]],s+=" "+c[l+1];return s}toJSON(){return{mathjs:qg,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",u=Ar(this,o,a&&a.implicit),c=this.params.map(function(f,p){var m=Ar(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),s=c[0],l=0;l<this.conditionals.length;l++)s+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+jn(t[this.conditionals[l]])+"</span>"+c[l+1];return s}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=Ar(this,o,a&&a.implicit),c=this.params.map(function(f,p){var m=Ar(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),s=c[0],l=0;l<this.conditionals.length;l++)s+=xr[this.conditionals[l]]+c[l+1];return s}}return wr(n,"name",qg),n},{isClass:!0,isNode:!0});var ste="SymbolNode",ute=["math","?Unit","Node"],RS=C(ste,ute,r=>{var{math:e,Unit:t,Node:n}=r;function i(o){return t?t.isValuelessUnit(o):!1}class a extends n{constructor(u){if(super(),typeof u!="string")throw new TypeError('String expected for parameter "name"');this.name=u}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(u,c){var s=this.name;if(c[s]===!0)return function(f,p,m){return Kr(p,s)};if(s in u)return function(f,p,m){return f.has(s)?f.get(s):Kr(u,s)};var l=i(s);return function(f,p,m){return f.has(s)?f.get(s):l?new t(null,s):a.onUndefinedSymbol(s)}}forEach(u){}map(u){return this.clone()}static onUndefinedSymbol(u){throw new Error("Undefined symbol "+u)}clone(){return new a(this.name)}_toString(u){return this.name}_toHTML(u){var c=jn(this.name);return c==="true"||c==="false"?'<span class="math-symbol math-boolean">'+c+"</span>":c==="i"?'<span class="math-symbol math-imaginary-symbol">'+c+"</span>":c==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+c+"</span>":c==="NaN"?'<span class="math-symbol math-nan-symbol">'+c+"</span>":c==="null"?'<span class="math-symbol math-null-symbol">'+c+"</span>":c==="undefined"?'<span class="math-symbol math-undefined-symbol">'+c+"</span>":'<span class="math-symbol">'+c+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(u){return new a(u.name)}_toTex(u){var c=!1;typeof e[this.name]>"u"&&i(this.name)&&(c=!0);var s=Bg(this.name,c);return s[0]==="\\"?s:" "+s}}return a},{isClass:!0,isNode:!0});var zg="FunctionNode",lte=["math","Node","SymbolNode"],LS=C(zg,lte,r=>{var e,{math:t,Node:n,SymbolNode:i}=r,a=c=>Et(c,{truncate:78});function o(c,s,l){for(var f="",p=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,d;(d=p.exec(c))!==null;)if(f+=c.substring(m,d.index),m=d.index,d[0]==="$$")f+="$",m++;else{m+=d[0].length;var h=s[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(tr(h))f+=h.toTex(l);else if(Array.isArray(h))f+=h.map(function(x,b){if(tr(x))return x.toTex(l);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(tr(h[d[2]]&&h[d[2]]))f+=h[d[2]].toTex(l);else throw new TypeError("Template: "+d[1]+"["+d[2]+"] is not a Node.")}return f+=c.slice(m),f}class u extends n{constructor(s,l){if(super(),typeof s=="string"&&(s=new i(s)),!tr(s))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(l)||!l.every(tr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=s,this.args=l||[]}get name(){return this.fn.name||""}get type(){return zg}get isFunctionNode(){return!0}_compile(s,l){var f=this.args.map(M=>M._compile(s,l));if(Ur(this.fn)){var p=this.fn.name;if(l[p]){var b=this.args;return function(w,D,N){var B=Kr(D,p);if(typeof B!="function")throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(B)));if(B.rawArgs)return B(b,s,$l(w,D));var R=f.map(z=>z(w,D,N));return B.apply(B,R)}}else{var m=p in s?Kr(s,p):void 0,d=typeof m=="function"&&m.rawArgs===!0,h=M=>{var w;if(M.has(p))w=M.get(p);else if(p in s)w=Kr(s,p);else return u.onUndefinedFunction(p);if(typeof w=="function")return w;throw new TypeError("'".concat(p,`' is not a function; its value is:
  `).concat(a(w)))};if(d){var x=this.args;return function(w,D,N){var B=h(w);if(B.rawArgs===!0)return B(x,s,$l(w,D));var R=f.map(z=>z(w,D,N));return B(...R)}}else switch(f.length){case 0:return function(w,D,N){var B=h(w);return B()};case 1:return function(w,D,N){var B=h(w),R=f[0];return B(R(w,D,N))};case 2:return function(w,D,N){var B=h(w),R=f[0],z=f[1];return B(R(w,D,N),z(w,D,N))};default:return function(w,D,N){var B=h(w),R=f.map(z=>z(w,D,N));return B(...R)}}}}else if(Ca(this.fn)&&oo(this.fn.index)&&this.fn.index.isObjectProperty()){var T=this.fn.object._compile(s,l),v=this.fn.index.getObjectProperty(),S=this.args;return function(w,D,N){var B=T(w,D,N),R=BI(B,v);if(R!=null&&R.rawArgs)return R(S,s,$l(w,D));var z=f.map(V=>V(w,D,N));return R.apply(B,z)}}else{var _=this.fn.toString(),y=this.fn._compile(s,l),A=this.args;return function(w,D,N){var B=y(w,D,N);if(typeof B!="function")throw new TypeError("Expression '".concat(_,"' did not evaluate to a function; value is:")+`
  `.concat(a(B)));if(B.rawArgs)return B(A,s,$l(w,D));var R=f.map(z=>z(w,D,N));return B.apply(B,R)}}}forEach(s){s(this.fn,"fn",this);for(var l=0;l<this.args.length;l++)s(this.args[l],"args["+l+"]",this)}map(s){for(var l=this._ifNode(s(this.fn,"fn",this)),f=[],p=0;p<this.args.length;p++)f[p]=this._ifNode(s(this.args[p],"args["+p+"]",this));return new u(l,f)}clone(){return new u(this.fn,this.args.slice(0))}toString(s){var l,f=this.fn.toString(s);return s&&typeof s.handler=="object"&&it(s.handler,f)&&(l=s.handler[f](this,s)),typeof l<"u"?l:super.toString(s)}_toString(s){var l=this.args.map(function(p){return p.toString(s)}),f=Ko(this.fn)?"("+this.fn.toString(s)+")":this.fn.toString(s);return f+"("+l.join(", ")+")"}toJSON(){return{mathjs:zg,fn:this.fn,args:this.args}}_toHTML(s){var l=this.args.map(function(f){return f.toHTML(s)});return'<span class="math-function">'+jn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+l.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(s){var l;return s&&typeof s.handler=="object"&&it(s.handler,this.name)&&(l=s.handler[this.name](this,s)),typeof l<"u"?l:super.toTex(s)}_toTex(s){var l=this.args.map(function(m){return m.toTex(s)}),f;CS[this.name]&&(f=CS[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(f=t[this.name].toTex);var p;switch(typeof f){case"function":p=f(this,s);break;case"string":p=o(f,this,s);break;case"object":switch(typeof f[l.length]){case"function":p=f[l.length](this,s);break;case"string":p=o(f[l.length],this,s);break}}return typeof p<"u"?p:o(c$,this,s)}getIdentifier(){return this.type+":"+this.name}}return e=u,wr(u,"name",zg),wr(u,"onUndefinedFunction",function(c){throw new Error("Undefined function "+c)}),wr(u,"fromJSON",function(c){return new e(c.fn,c.args)}),u},{isClass:!0,isNode:!0});var f$="parse",cte=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],VS=C(f$,cte,r=>{var{typed:e,numeric:t,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:u,ConditionalNode:c,ConstantNode:s,FunctionAssignmentNode:l,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:d,ParenthesisNode:h,RangeNode:x,RelationalNode:b,SymbolNode:T}=r,v=e(f$,{string:function(G){return ne(G,{})},"Array | Matrix":function(G){return S(G,{})},"string, Object":function(G,ge){var Ne=ge.nodes!==void 0?ge.nodes:{};return ne(G,Ne)},"Array | Matrix, Object":S});function S(F){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ge=G.nodes!==void 0?G.nodes:{};return rt(F,function(Ne){if(typeof Ne!="string")throw new TypeError("String expected");return ne(Ne,ge)})}var _={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},A={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},M={true:!0,false:!1,null:null,undefined:void 0},w=["NaN","Infinity"],D={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:"	"};function N(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:_.NULL,nestingLevel:0,conditionalLevel:null}}function B(F,G){return F.expression.substr(F.index,G)}function R(F){return B(F,1)}function z(F){F.index++}function V(F){return F.expression.charAt(F.index-1)}function k(F){return F.expression.charAt(F.index+1)}function P(F){for(F.tokenType=_.NULL,F.token="",F.comment="";;){if(R(F)==="#")for(;R(F)!==`
`&&R(F)!=="";)F.comment+=R(F),z(F);if(v.isWhitespace(R(F),F.nestingLevel))z(F);else break}if(R(F)===""){F.tokenType=_.DELIMITER;return}if(R(F)===`
`&&!F.nestingLevel){F.tokenType=_.DELIMITER,F.token=R(F),z(F);return}var G=R(F),ge=B(F,2),Ne=B(F,3);if(Ne.length===3&&y[Ne]){F.tokenType=_.DELIMITER,F.token=Ne,z(F),z(F),z(F);return}if(ge.length===2&&y[ge]){F.tokenType=_.DELIMITER,F.token=ge,z(F),z(F);return}if(y[G]){F.tokenType=_.DELIMITER,F.token=G,z(F);return}if(v.isDigitDot(G)){F.tokenType=_.NUMBER;var ot=B(F,2);if(ot==="0b"||ot==="0o"||ot==="0x"){for(F.token+=R(F),z(F),F.token+=R(F),z(F);v.isHexDigit(R(F));)F.token+=R(F),z(F);if(R(F)===".")for(F.token+=".",z(F);v.isHexDigit(R(F));)F.token+=R(F),z(F);else if(R(F)==="i")for(F.token+="i",z(F);v.isDigit(R(F));)F.token+=R(F),z(F);return}if(R(F)==="."){if(F.token+=R(F),z(F),!v.isDigit(R(F))){F.tokenType=_.DELIMITER;return}}else{for(;v.isDigit(R(F));)F.token+=R(F),z(F);v.isDecimalMark(R(F),k(F))&&(F.token+=R(F),z(F))}for(;v.isDigit(R(F));)F.token+=R(F),z(F);if(R(F)==="E"||R(F)==="e"){if(v.isDigit(k(F))||k(F)==="-"||k(F)==="+"){if(F.token+=R(F),z(F),(R(F)==="+"||R(F)==="-")&&(F.token+=R(F),z(F)),!v.isDigit(R(F)))throw $e(F,'Digit expected, got "'+R(F)+'"');for(;v.isDigit(R(F));)F.token+=R(F),z(F);if(v.isDecimalMark(R(F),k(F)))throw $e(F,'Digit expected, got "'+R(F)+'"')}else if(k(F)===".")throw z(F),$e(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),z(F);it(A,F.token)?F.tokenType=_.DELIMITER:F.tokenType=_.SYMBOL;return}for(F.tokenType=_.UNKNOWN;R(F)!=="";)F.token+=R(F),z(F);throw $e(F,'Syntax error in part "'+F.token+'"')}function W(F){do P(F);while(F.token===`
`)}function O(F){F.nestingLevel++}function X(F){F.nestingLevel--}v.isAlpha=function(G,ge,Ne){return v.isValidLatinOrGreek(G)||v.isValidMathSymbol(G,Ne)||v.isValidMathSymbol(ge,G)},v.isValidLatinOrGreek=function(G){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(G)},v.isValidMathSymbol=function(G,ge){return/^[\uD835]$/.test(G)&&/^[\uDC00-\uDFFF]$/.test(ge)&&/^[^\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(ge)},v.isWhitespace=function(G,ge){return G===" "||G==="	"||G===`
`&&ge>0},v.isDecimalMark=function(G,ge){return G==="."&&ge!=="/"&&ge!=="*"&&ge!=="^"},v.isDigitDot=function(G){return G>="0"&&G<="9"||G==="."},v.isDigit=function(G){return G>="0"&&G<="9"},v.isHexDigit=function(G){return G>="0"&&G<="9"||G>="a"&&G<="f"||G>="A"&&G<="F"};function ne(F,G){var ge=N();rn(ge,{expression:F,extraNodes:G}),P(ge);var Ne=Z(ge);if(ge.token!=="")throw ge.tokenType===_.DELIMITER?He(ge,"Unexpected operator "+ge.token):$e(ge,'Unexpected part "'+ge.token+'"');return Ne}function Z(F){var G,ge=[],Ne;for(F.token!==""&&F.token!==`
`&&F.token!==";"&&(G=L(F),F.comment&&(G.comment=F.comment));F.token===`
`||F.token===";";)ge.length===0&&G&&(Ne=F.token!==";",ge.push({node:G,visible:Ne})),P(F),F.token!==`
`&&F.token!==";"&&F.token!==""&&(G=L(F),F.comment&&(G.comment=F.comment),Ne=F.token!==";",ge.push({node:G,visible:Ne}));return ge.length>0?new u(ge):(G||(G=new s(void 0),F.comment&&(G.comment=F.comment)),G)}function L(F){var G,ge,Ne,ot,yt=pe(F);if(F.token==="="){if(Ur(yt))return G=yt.name,W(F),Ne=L(F),new o(new T(G),Ne);if(Ca(yt))return W(F),Ne=L(F),new o(yt.object,yt.index,Ne);if(Gi(yt)&&Ur(yt.fn)&&(ot=!0,ge=[],G=yt.name,yt.args.forEach(function(Re,Xn){Ur(Re)?ge[Xn]=Re.name:ot=!1}),ot))return W(F),Ne=L(F),new l(G,ge,Ne);throw $e(F,"Invalid left hand side of assignment operator =")}return yt}function pe(F){for(var G=me(F);F.token==="?";){var ge=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,W(F);var Ne=G,ot=L(F);if(F.token!==":")throw $e(F,"False part of conditional expression expected");F.conditionalLevel=null,W(F);var yt=L(F);G=new c(Ne,ot,yt),F.conditionalLevel=ge}return G}function me(F){for(var G=oe(F);F.token==="or";)W(F),G=new d("or","or",[G,oe(F)]);return G}function oe(F){for(var G=ve(F);F.token==="xor";)W(F),G=new d("xor","xor",[G,ve(F)]);return G}function ve(F){for(var G=_e(F);F.token==="and";)W(F),G=new d("and","and",[G,_e(F)]);return G}function _e(F){for(var G=ye(F);F.token==="|";)W(F),G=new d("|","bitOr",[G,ye(F)]);return G}function ye(F){for(var G=be(F);F.token==="^|";)W(F),G=new d("^|","bitXor",[G,be(F)]);return G}function be(F){for(var G=we(F);F.token==="&";)W(F),G=new d("&","bitAnd",[G,we(F)]);return G}function we(F){for(var G=[Ee(F)],ge=[],Ne={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};it(Ne,F.token);){var ot={name:F.token,fn:Ne[F.token]};ge.push(ot),W(F),G.push(Ee(F))}return G.length===1?G[0]:G.length===2?new d(ge[0].name,ge[0].fn,G):new b(ge.map(yt=>yt.fn),G)}function Ee(F){var G,ge,Ne,ot;G=ze(F);for(var yt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};it(yt,F.token);)ge=F.token,Ne=yt[ge],W(F),ot=[G,ze(F)],G=new d(ge,Ne,ot);return G}function ze(F){var G,ge,Ne,ot;G=Qe(F);for(var yt={to:"to",in:"to"};it(yt,F.token);)ge=F.token,Ne=yt[ge],W(F),ge==="in"&&F.token===""?G=new d("*","multiply",[G,new T("in")],!0):(ot=[G,Qe(F)],G=new d(ge,Ne,ot));return G}function Qe(F){var G,ge=[];if(F.token===":"?G=new s(1):G=Y(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(ge.push(G);F.token===":"&&ge.length<3;)W(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?ge.push(new T("end")):ge.push(Y(F));ge.length===3?G=new x(ge[0],ge[2],ge[1]):G=new x(ge[0],ge[1])}return G}function Y(F){var G,ge,Ne,ot;G=Q(F);for(var yt={"+":"add","-":"subtract"};it(yt,F.token);){ge=F.token,Ne=yt[ge],W(F);var Re=Q(F);Re.isPercentage?ot=[G,new d("*","multiply",[G,Re])]:ot=[G,Re],G=new d(ge,Ne,ot)}return G}function Q(F){var G,ge,Ne,ot;G=xe(F),ge=G;for(var yt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};it(yt,F.token);)Ne=F.token,ot=yt[Ne],W(F),ge=xe(F),G=new d(Ne,ot,[G,ge]);return G}function xe(F){var G,ge;for(G=J(F),ge=G;F.tokenType===_.SYMBOL||F.token==="in"&&qt(G)||F.token==="in"&&Wr(G)&&G.fn==="unaryMinus"&&qt(G.args[0])||F.tokenType===_.NUMBER&&!qt(ge)&&(!Wr(ge)||ge.op==="!")||F.token==="(";)ge=J(F),G=new d("*","multiply",[G,ge],!0);return G}function J(F){for(var G=re(F),ge=G,Ne=[];F.token==="/"&&Tp(ge);)if(Ne.push(rn({},F)),W(F),F.tokenType===_.NUMBER)if(Ne.push(rn({},F)),W(F),F.tokenType===_.SYMBOL||F.token==="(")rn(F,Ne.pop()),Ne.pop(),ge=re(F),G=new d("/","divide",[G,ge]);else{Ne.pop(),rn(F,Ne.pop());break}else{rn(F,Ne.pop());break}return G}function re(F){var G,ge,Ne,ot;G=se(F);for(var yt={"%":"mod",mod:"mod"};it(yt,F.token);)ge=F.token,Ne=yt[ge],W(F),ge==="%"&&F.tokenType===_.DELIMITER&&F.token!=="("?G=new d("/","divide",[G,new s(100)],!1,!0):(ot=[G,se(F)],G=new d(ge,Ne,ot));return G}function se(F){var G,ge,Ne,ot={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return it(ot,F.token)?(Ne=ot[F.token],G=F.token,W(F),ge=[se(F)],new d(G,Ne,ge)):Ae(F)}function Ae(F){var G,ge,Ne,ot;return G=Te(F),(F.token==="^"||F.token===".^")&&(ge=F.token,Ne=ge==="^"?"pow":"dotPow",W(F),ot=[G,se(F)],G=new d(ge,Ne,ot)),G}function Te(F){var G,ge,Ne,ot;G=qe(F);for(var yt={"!":"factorial","'":"ctranspose"};it(yt,F.token);)ge=F.token,Ne=yt[ge],P(F),ot=[G],G=new d(ge,Ne,ot),G=wt(F,G);return G}function qe(F){var G=[];if(F.tokenType===_.SYMBOL&&it(F.extraNodes,F.token)){var ge=F.extraNodes[F.token];if(P(F),F.token==="("){if(G=[],O(F),P(F),F.token!==")")for(G.push(L(F));F.token===",";)P(F),G.push(L(F));if(F.token!==")")throw $e(F,"Parenthesis ) expected");X(F),P(F)}return new ge(G)}return Se(F)}function Se(F){var G,ge;return F.tokenType===_.SYMBOL||F.tokenType===_.DELIMITER&&F.token in A?(ge=F.token,P(F),it(M,ge)?G=new s(M[ge]):w.includes(ge)?G=new s(t(ge,"number")):G=new T(ge),G=wt(F,G),G):Dt(F)}function wt(F,G,ge){for(var Ne;(F.token==="("||F.token==="["||F.token===".")&&(!ge||ge.includes(F.token));)if(Ne=[],F.token==="(")if(Ur(G)||Ca(G)){if(O(F),P(F),F.token!==")")for(Ne.push(L(F));F.token===",";)P(F),Ne.push(L(F));if(F.token!==")")throw $e(F,"Parenthesis ) expected");X(F),P(F),G=new f(G,Ne)}else return G;else if(F.token==="["){if(O(F),P(F),F.token!=="]")for(Ne.push(L(F));F.token===",";)P(F),Ne.push(L(F));if(F.token!=="]")throw $e(F,"Parenthesis ] expected");X(F),P(F),G=new i(G,new p(Ne))}else{P(F);var ot=F.tokenType===_.SYMBOL||F.tokenType===_.DELIMITER&&F.token in A;if(!ot)throw $e(F,"Property name expected after dot");Ne.push(new s(F.token)),P(F);var yt=!0;G=new i(G,new p(Ne,yt))}return G}function Dt(F){var G,ge;return F.token==='"'||F.token==="'"?(ge=jt(F,F.token),G=new s(ge),G=wt(F,G),G):Tt(F)}function jt(F,G){for(var ge="";R(F)!==""&&R(F)!==G;)if(R(F)==="\\"){z(F);var Ne=R(F),ot=D[Ne];if(ot!==void 0)ge+=ot,F.index+=1;else if(Ne==="u"){var yt=F.expression.slice(F.index+1,F.index+5);if(/^[0-9A-Fa-f]{4}$/.test(yt))ge+=String.fromCharCode(parseInt(yt,16)),F.index+=5;else throw $e(F,"Invalid unicode character \\u".concat(yt))}else throw $e(F,"Bad escape character \\".concat(Ne))}else ge+=R(F),z(F);if(P(F),F.token!==G)throw $e(F,"End of string ".concat(G," expected"));return P(F),ge}function Tt(F){var G,ge,Ne,ot;if(F.token==="["){if(O(F),P(F),F.token!=="]"){var yt=j(F);if(F.token===";"){for(Ne=1,ge=[yt];F.token===";";)P(F),F.token!=="]"&&(ge[Ne]=j(F),Ne++);if(F.token!=="]")throw $e(F,"End of matrix ] expected");X(F),P(F),ot=ge[0].items.length;for(var Re=1;Re<Ne;Re++)if(ge[Re].items.length!==ot)throw He(F,"Column dimensions mismatch ("+ge[Re].items.length+" !== "+ot+")");G=new a(ge)}else{if(F.token!=="]")throw $e(F,"End of matrix ] expected");X(F),P(F),G=yt}}else X(F),P(F),G=new a([]);return wt(F,G)}return le(F)}function j(F){for(var G=[L(F)],ge=1;F.token===",";)P(F),F.token!=="]"&&F.token!==";"&&(G[ge]=L(F),ge++);return new a(G)}function le(F){if(F.token==="{"){O(F);var G,ge={};do if(P(F),F.token!=="}"){if(F.token==='"'||F.token==="'")G=jt(F,F.token);else if(F.tokenType===_.SYMBOL||F.tokenType===_.DELIMITER&&F.token in A)G=F.token,P(F);else throw $e(F,"Symbol or string expected as object key");if(F.token!==":")throw $e(F,"Colon : expected after object key");P(F),ge[G]=L(F)}while(F.token===",");if(F.token!=="}")throw $e(F,"Comma , or bracket } expected after object value");X(F),P(F);var Ne=new m(ge);return Ne=wt(F,Ne),Ne}return fe(F)}function fe(F){var G;if(F.tokenType===_.NUMBER){G=F.token,P(F);var ge=Ai(G,n),Ne=t(G,ge);return new s(Ne)}return Pe(F)}function Pe(F){var G;if(F.token==="("){if(O(F),P(F),G=L(F),F.token!==")")throw $e(F,"Parenthesis ) expected");return X(F),P(F),G=new h(G),G=wt(F,G),G}return ke(F)}function ke(F){throw F.token===""?$e(F,"Unexpected end of expression"):$e(F,"Value expected")}function Fe(F){return F.index-F.token.length+1}function $e(F,G){var ge=Fe(F),Ne=new SyntaxError(G+" (char "+ge+")");return Ne.char=ge,Ne}function He(F,G){var ge=Fe(F),Ne=new SyntaxError(G+" (char "+ge+")");return Ne.char=ge,Ne}return e.addConversion({from:"string",to:"Node",convert:v}),v});var p$="compile",fte=["typed","parse"],US=C(p$,fte,r=>{var{typed:e,parse:t}=r;return e(p$,{string:function(i){return t(i).compile()},"Array | Matrix":function(i){return rt(i,function(a){return t(a).compile()})}})});var m$="evaluate",pte=["typed","parse"],qS=C(m$,pte,r=>{var{typed:e,parse:t}=r;return e(m$,{string:function(i){var a=Su();return t(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return t(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=Su();return rt(i,function(o){return t(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return rt(i,function(o){return t(o).compile().evaluate(a)})}})});var mte="Parser",dte=["evaluate"],zS=C(mte,dte,r=>{var{evaluate:e}=r;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Su(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(n){return e(n,this.scope)},t.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},t.prototype.getAll=function(){return $I(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(n,i){return this.scope.set(n,i),i},t.prototype.remove=function(n){this.scope.delete(n)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var d$="parser",hte=["typed","Parser"],HS=C(d$,hte,r=>{var{typed:e,Parser:t}=r;return e(d$,{"":function(){return new t}})});var h$="lup",gte=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],GS=C(h$,gte,r=>{var{typed:e,matrix:t,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:u,larger:c,equalScalar:s,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=r;return e(h$,{DenseMatrix:function(b){return d(b)},SparseMatrix:function(b){return h(b)},Array:function(b){var T=t(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),S=dt(x._data),_=[],y=[b,v],A=[],M=[v,T],w,D,N,B=[];for(w=0;w<b;w++)B[w]=w;for(D=0;D<T;D++){if(D>0)for(w=0;w<b;w++){var R=Math.min(w,D),z=0;for(N=0;N<R;N++)z=i(z,o(S[w][N],S[N][D]));S[w][D]=u(S[w][D],z)}var V=D,k=0,P=0;for(w=D;w<b;w++){var W=S[w][D],O=n(W);c(O,k)&&(V=w,k=O,P=W)}if(D!==V&&(B[D]=[B[V],B[V]=B[D]][0],f._swapRows(D,V,S)),D<b)for(w=D+1;w<b;w++){var X=S[w][D];s(X,0)||(S[w][D]=a(S[w][D],P))}}for(D=0;D<T;D++)for(w=0;w<b;w++){if(D===0&&(w<T&&(A[w]=[]),_[w]=[]),w<D){w<T&&(A[w][D]=S[w][D]),D<b&&(_[w][D]=0);continue}if(w===D){w<T&&(A[w][D]=S[w][D]),D<b&&(_[w][D]=1);continue}w<T&&(A[w][D]=0),D<b&&(_[w][D]=S[w][D])}var ne=new f({data:_,size:y}),Z=new f({data:A,size:M}),L=[];for(w=0,v=B.length;w<v;w++)L[B[w]]=w;return{L:ne,U:Z,p:L,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),S=x._values,_=x._index,y=x._ptr,A=[],M=[],w=[],D=[b,v],N=[],B=[],R=[],z=[v,T],V,k,P,W=[],O=[];for(V=0;V<b;V++)W[V]=V,O[V]=V;var X=function(L,pe){var me=O[L],oe=O[pe];W[me]=pe,W[oe]=L,O[L]=oe,O[pe]=me},ne=function(){var L=new m;k<b&&(w.push(A.length),A.push(1),M.push(k)),R.push(N.length);var pe=y[k],me=y[k+1];for(P=pe;P<me;P++)V=_[P],L.set(W[V],S[P]);k>0&&L.forEach(0,k-1,function(ye,be){p._forEachRow(ye,A,M,w,function(we,Ee){we>ye&&L.accumulate(we,l(o(Ee,be)))})});var oe=k,ve=L.get(k),_e=n(ve);L.forEach(k+1,b-1,function(ye,be){var we=n(be);c(we,_e)&&(oe=ye,_e=we,ve=be)}),k!==oe&&(p._swapRows(k,oe,D[1],A,M,w),p._swapRows(k,oe,z[1],N,B,R),L.swap(k,oe),X(k,oe)),L.forEach(0,b-1,function(ye,be){ye<=k?(N.push(be),B.push(ye)):(be=a(be,ve),s(be,0)||(A.push(be),M.push(ye)))})};for(k=0;k<T;k++)ne();return R.push(N.length),w.push(A.length),{L:new p({values:A,index:M,ptr:w,size:D}),U:new p({values:N,index:B,ptr:R,size:z}),p:W,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var g$="qr",vte=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],WS=C(g$,vte,r=>{var{typed:e,matrix:t,zeros:n,identity:i,isZero:a,equal:o,sign:u,sqrt:c,conj:s,unaryMinus:l,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:d,complex:h}=r;return rn(e(g$,{DenseMatrix:function(S){return b(S)},SparseMatrix:function(S){return T(S)},Array:function(S){var _=t(S),y=b(_);return{Q:y.Q.valueOf(),R:y.R.valueOf()}}}),{_denseQRimpl:x});function x(v){var S=v._size[0],_=v._size[1],y=i([S],"dense"),A=y._data,M=v.clone(),w=M._data,D,N,B,R=n([S],"");for(B=0;B<Math.min(_,S);++B){var z=w[B][B],V=l(o(z,0)?1:u(z)),k=s(V),P=0;for(D=B;D<S;D++)P=f(P,m(w[D][B],s(w[D][B])));var W=m(V,c(P));if(!a(W)){var O=d(z,W);for(R[B]=1,D=B+1;D<S;D++)R[D]=p(w[D][B],O);var X=l(s(p(O,W))),ne=void 0;for(N=B;N<_;N++){for(ne=0,D=B;D<S;D++)ne=f(ne,m(s(R[D]),w[D][N]));for(ne=m(ne,X),D=B;D<S;D++)w[D][N]=m(d(w[D][N],m(R[D],ne)),k)}for(D=0;D<S;D++){for(ne=0,N=B;N<S;N++)ne=f(ne,m(A[D][N],R[N]));for(ne=m(ne,X),N=B;N<S;++N)A[D][N]=p(d(A[D][N],m(ne,s(R[N]))),k)}}}return{Q:y,R:M,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function b(v){var S=x(v),_=S.R._data;if(v._data.length>0)for(var y=_[0][0].type==="Complex"?h(0):0,A=0;A<_.length;++A)for(var M=0;M<A&&M<(_[0]||[]).length;++M)_[A][M]=y;return S}function T(v){throw new Error("qr not implemented for sparse matrices yet")}});function v$(r,e,t,n){for(var i=r._values,a=r._index,o=r._ptr,u=r._size,c=r._datatype,s=u[0],l=u[1],f=n&&r._values?[]:null,p=[],m=[],d=0,h=0;h<l;h++){m[h]=d;for(var x=t?t[h]:h,b=o[x],T=o[x+1],v=b;v<T;v++){var S=e?e[a[v]]:a[v];p[d]=S,f&&(f[d]=i[v]),d++}}return m[l]=d,r.createSparseMatrix({values:f,index:p,ptr:m,size:[s,l],datatype:c})}function Hg(r,e,t,n,i,a,o){var u=0;for(t[o]=r;u>=0;){var c=t[o+u],s=t[n+c];s===-1?(u--,a[e++]=c):(t[n+c]=t[i+s],++u,t[o+u]=s)}return e}function y$(r,e){if(!r)return null;var t=0,n,i=[],a=[],o=0,u=e,c=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)r[n]!==-1&&(a[u+n]=a[o+r[n]],a[o+r[n]]=n);for(n=0;n<e;n++)r[n]===-1&&(t=Hg(n,t,a,o,u,i,c));return i}function x$(r,e){if(!r)return null;var t=r._index,n=r._ptr,i=r._size,a=i[0],o=i[1],u=[],c=[],s=0,l=o,f,p;if(e)for(f=0;f<a;f++)c[l+f]=-1;for(var m=0;m<o;m++){u[m]=-1,c[s+m]=-1;for(var d=n[m],h=n[m+1],x=d;x<h;x++){var b=t[x];for(f=e?c[l+b]:b;f!==-1&&f<m;f=p)p=c[s+f],c[s+f]=m,p===-1&&(u[f]=m);e&&(c[l+b]=m)}}return u}function b$(r,e,t){for(var n=r._values,i=r._index,a=r._ptr,o=r._size,u=o[1],c=0,s=0;s<u;s++){var l=a[s];for(a[s]=c;l<a[s+1];l++)e(i[l],s,n?n[l]:1,t)&&(i[c]=i[l],n&&(n[c]=n[l]),c++)}return a[u]=c,i.splice(c,i.length-c),n&&n.splice(c,n.length-c),c}function ko(r){return-r-2}var yte="csAmd",xte=["add","multiply","transpose"],w$=C(yte,xte,r=>{var{add:e,multiply:t,transpose:n}=r;return function(l,f){if(!f||l<=0||l>3)return null;var p=f._size,m=p[0],d=p[1],h=0,x=Math.max(16,10*Math.sqrt(d));x=Math.min(d-2,x);var b=i(l,f,m,d,x);b$(b,c,null);for(var T=b._index,v=b._ptr,S=v[d],_=[],y=[],A=0,M=d+1,w=2*(d+1),D=3*(d+1),N=4*(d+1),B=5*(d+1),R=6*(d+1),z=7*(d+1),V=_,k=a(d,v,y,A,D,V,w,z,M,R,N,B),P=o(d,v,y,B,N,R,x,M,D,V,w),W=0,O,X,ne,Z,L,pe,me,oe,ve,_e,ye,be,we,Ee,ze,Qe;P<d;){for(ne=-1;W<d&&(ne=y[D+W])===-1;W++);y[w+ne]!==-1&&(V[y[w+ne]]=-1),y[D+W]=y[w+ne];var Y=y[N+ne],Q=y[M+ne];P+=Q;var xe=0;y[M+ne]=-Q;var J=v[ne],re=Y===0?J:S,se=re;for(Z=1;Z<=Y+1;Z++){for(Z>Y?(pe=ne,me=J,oe=y[A+ne]-Y):(pe=T[J++],me=v[pe],oe=y[A+pe]),L=1;L<=oe;L++)O=T[me++],!((ve=y[M+O])<=0)&&(xe+=ve,y[M+O]=-ve,T[se++]=O,y[w+O]!==-1&&(V[y[w+O]]=V[O]),V[O]!==-1?y[w+V[O]]=y[w+O]:y[D+y[B+O]]=y[w+O]);pe!==ne&&(v[pe]=ko(ne),y[R+pe]=0)}for(Y!==0&&(S=se),y[B+ne]=xe,v[ne]=re,y[A+ne]=se-re,y[N+ne]=-2,k=u(k,h,y,R,d),_e=re;_e<se;_e++)if(O=T[_e],!((ye=y[N+O])<=0)){ve=-y[M+O];var Ae=k-ve;for(J=v[O],be=v[O]+ye-1;J<=be;J++)pe=T[J],y[R+pe]>=k?y[R+pe]-=ve:y[R+pe]!==0&&(y[R+pe]=y[B+pe]+Ae)}for(_e=re;_e<se;_e++){for(O=T[_e],be=v[O],we=be+y[N+O]-1,Ee=be,ze=0,Qe=0,J=be;J<=we;J++)if(pe=T[J],y[R+pe]!==0){var Te=y[R+pe]-k;Te>0?(Qe+=Te,T[Ee++]=pe,ze+=pe):(v[pe]=ko(ne),y[R+pe]=0)}y[N+O]=Ee-be+1;var qe=Ee,Se=be+y[A+O];for(J=we+1;J<Se;J++){X=T[J];var wt=y[M+X];wt<=0||(Qe+=wt,T[Ee++]=X,ze+=X)}Qe===0?(v[O]=ko(ne),ve=-y[M+O],xe-=ve,Q+=ve,P+=ve,y[M+O]=0,y[N+O]=-1):(y[B+O]=Math.min(y[B+O],Qe),T[Ee]=T[qe],T[qe]=T[be],T[be]=ne,y[A+O]=Ee-be+1,ze=(ze<0?-ze:ze)%d,y[w+O]=y[z+ze],y[z+ze]=O,V[O]=ze)}for(y[B+ne]=xe,h=Math.max(h,xe),k=u(k+h,h,y,R,d),_e=re;_e<se;_e++)if(O=T[_e],!(y[M+O]>=0))for(ze=V[O],O=y[z+ze],y[z+ze]=-1;O!==-1&&y[w+O]!==-1;O=y[w+O],k++){for(oe=y[A+O],ye=y[N+O],J=v[O]+1;J<=v[O]+oe-1;J++)y[R+T[J]]=k;var Dt=O;for(X=y[w+O];X!==-1;){var jt=y[A+X]===oe&&y[N+X]===ye;for(J=v[X]+1;jt&&J<=v[X]+oe-1;J++)y[R+T[J]]!==k&&(jt=0);jt?(v[X]=ko(O),y[M+O]+=y[M+X],y[M+X]=0,y[N+X]=-1,X=y[w+X],y[w+Dt]=X):(Dt=X,X=y[w+X])}}for(J=re,_e=re;_e<se;_e++)O=T[_e],!((ve=-y[M+O])<=0)&&(y[M+O]=ve,Qe=y[B+O]+xe-ve,Qe=Math.min(Qe,d-P-ve),y[D+Qe]!==-1&&(V[y[D+Qe]]=O),y[w+O]=y[D+Qe],V[O]=-1,y[D+Qe]=O,W=Math.min(W,Qe),y[B+O]=Qe,T[J++]=O);y[M+ne]=Q,(y[A+ne]=J-re)===0&&(v[ne]=-1,y[R+ne]=0),Y!==0&&(S=J)}for(O=0;O<d;O++)v[O]=ko(v[O]);for(X=0;X<=d;X++)y[D+X]=-1;for(X=d;X>=0;X--)y[M+X]>0||(y[w+X]=y[D+v[X]],y[D+v[X]]=X);for(pe=d;pe>=0;pe--)y[M+pe]<=0||v[pe]!==-1&&(y[w+pe]=y[D+v[pe]],y[D+v[pe]]=pe);for(ne=0,O=0;O<=d;O++)v[O]===-1&&(ne=Hg(O,ne,y,D,w,_,R));return _.splice(_.length-1,1),_};function i(s,l,f,p,m){var d=n(l);if(s===1&&p===f)return e(l,d);if(s===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>m))for(var S=x[T+1];v<S;v++)h[b++]=h[v]}return x[f]=b,l=n(d),t(d,l)}return t(d,l)}function a(s,l,f,p,m,d,h,x,b,T,v,S){for(var _=0;_<s;_++)f[p+_]=l[_+1]-l[_];f[p+s]=0;for(var y=0;y<=s;y++)f[m+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[S+y]=f[p+y];var A=u(0,0,f,T,s);return f[v+s]=-2,l[s]=-1,f[T+s]=0,A}function o(s,l,f,p,m,d,h,x,b,T,v){for(var S=0,_=0;_<s;_++){var y=f[p+_];if(y===0)f[m+_]=-2,S++,l[_]=-1,f[d+_]=0;else if(y>h)f[x+_]=0,f[m+_]=-1,S++,l[_]=ko(s),f[x+s]++;else{var A=f[b+y];A!==-1&&(T[A]=_),f[v+_]=f[b+y],f[b+y]=_}}return S}function u(s,l,f,p,m){if(s<2||s+l<0){for(var d=0;d<m;d++)f[p+d]!==0&&(f[p+d]=1);s=2}return s}function c(s,l){return s!==l}});function _$(r,e,t,n,i,a,o){var u,c,s=0,l;if(r<=e||t[n+e]<=t[i+r])return-1;t[i+r]=t[n+e];var f=t[a+r];if(t[a+r]=e,f===-1)s=1,l=r;else{for(s=2,l=f;l!==t[o+l];l=t[o+l]);for(u=f;u!==l;u=c)c=t[o+u],t[o+u]=l}return{jleaf:s,q:l}}var bte="csCounts",wte=["transpose"],S$=C(bte,wte,r=>{var{transpose:e}=r;return function(t,n,i,a){if(!t||!n||!i)return null;var o=t._size,u=o[0],c=o[1],s,l,f,p,m,d,h,x=4*c+(a?c+u+1:0),b=[],T=0,v=c,S=2*c,_=3*c,y=4*c,A=5*c+1;for(f=0;f<x;f++)b[f]=-1;var M=[],w=e(t),D=w._index,N=w._ptr;for(f=0;f<c;f++)for(l=i[f],M[l]=b[_+l]===-1?1:0;l!==-1&&b[_+l]===-1;l=n[l])b[_+l]=f;if(a){for(f=0;f<c;f++)b[i[f]]=f;for(s=0;s<u;s++){for(f=c,d=N[s],h=N[s+1],m=d;m<h;m++)f=Math.min(f,b[D[m]]);b[A+s]=b[y+f],b[y+f]=s}}for(s=0;s<c;s++)b[T+s]=s;for(f=0;f<c;f++){for(l=i[f],n[l]!==-1&&M[n[l]]--,p=a?b[y+f]:l;p!==-1;p=a?b[A+p]:-1)for(m=N[p];m<N[p+1];m++){s=D[m];var B=_$(s,l,b,_,v,S,T);B.jleaf>=1&&M[l]++,B.jleaf===2&&M[B.q]--}n[l]!==-1&&(b[T+l]=n[l])}for(l=0;l<c;l++)n[l]!==-1&&(M[n[l]]+=M[l]);return M}});var _te="csSqr",Ste=["add","multiply","transpose"],A$=C(_te,Ste,r=>{var{add:e,multiply:t,transpose:n}=r,i=w$({add:e,multiply:t,transpose:n}),a=S$({transpose:n});return function(c,s,l){var f=s._ptr,p=s._size,m=p[1],d,h={};if(h.q=i(c,s),c&&!h.q)return null;if(l){var x=c?v$(s,null,h.q,0):s;h.parent=x$(x,1);var b=y$(h.parent,m);if(h.cp=a(x,h.parent,b,1),x&&h.parent&&h.cp&&o(x,h))for(h.unz=0,d=0;d<m;d++)h.unz+=h.cp[d]}else h.unz=4*f[m]+m,h.lnz=h.unz;return h};function o(u,c){var s=u._ptr,l=u._index,f=u._size,p=f[0],m=f[1];c.pinv=[],c.leftmost=[];var d=c.parent,h=c.pinv,x=c.leftmost,b=[],T=0,v=p,S=p+m,_=p+2*m,y,A,M,w,D;for(A=0;A<m;A++)b[v+A]=-1,b[S+A]=-1,b[_+A]=0;for(y=0;y<p;y++)x[y]=-1;for(A=m-1;A>=0;A--)for(w=s[A],D=s[A+1],M=w;M<D;M++)x[l[M]]=A;for(y=p-1;y>=0;y--)h[y]=-1,A=x[y],A!==-1&&(b[_+A]++===0&&(b[S+A]=y),b[T+y]=b[v+A],b[v+A]=y);for(c.lnz=0,c.m2=p,A=0;A<m;A++)if(y=b[v+A],c.lnz++,y<0&&(y=c.m2++),h[y]=A,!(--_[A]<=0)){c.lnz+=b[_+A];var N=d[A];N!==-1&&(b[_+N]===0&&(b[S+N]=b[S+A]),b[T+b[S+A]]=b[v+N],b[v+N]=b[T+y],b[_+N]+=b[_+A])}for(y=0;y<p;y++)h[y]<0&&(h[y]=A++);return!0}});function rm(r,e){return r[e]<0}function Gg(r,e){r[e]=ko(r[e])}function YS(r){return r<0?ko(r):r}function E$(r,e,t,n,i){var a=e._index,o=e._ptr,u=e._size,c=u[1],s,l,f,p=0;for(n[0]=r;p>=0;){r=n[p];var m=i?i[r]:r;rm(o,r)||(Gg(o,r),n[c+p]=m<0?0:YS(o[m]));var d=1;for(l=n[c+p],f=m<0?0:YS(o[m+1]);l<f;l++)if(s=a[l],!rm(o,s)){n[c+p]=l,n[++p]=s,d=0;break}d&&(p--,n[--t]=r)}return t}function T$(r,e,t,n,i){var a=r._ptr,o=r._size,u=e._index,c=e._ptr,s=o[1],l,f,p,m=s;for(f=c[t],p=c[t+1],l=f;l<p;l++){var d=u[l];rm(a,d)||(m=E$(d,r,m,n,i))}for(l=m;l<s;l++)Gg(a,n[l]);return m}var Ate="csSpsolve",Ete=["divideScalar","multiply","subtract"],M$=C(Ate,Ete,r=>{var{divideScalar:e,multiply:t,subtract:n}=r;return function(a,o,u,c,s,l,f){var p=a._values,m=a._index,d=a._ptr,h=a._size,x=h[1],b=o._values,T=o._index,v=o._ptr,S,_,y,A,M=T$(a,o,u,c,l);for(S=M;S<x;S++)s[c[S]]=0;for(_=v[u],y=v[u+1],S=_;S<y;S++)s[T[S]]=b[S];for(var w=M;w<x;w++){var D=c[w],N=l?l[D]:D;if(!(N<0))for(_=d[N],y=d[N+1],s[D]=e(s[D],p[f?_:y-1]),S=f?_+1:_,A=f?y:y-1;S<A;S++){var B=m[S];s[B]=n(s[B],t(p[S],s[D]))}}return M}});var Tte="csLu",Mte=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],D$=C(Tte,Mte,r=>{var{abs:e,divideScalar:t,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:u}=r,c=M$({divideScalar:t,multiply:n,subtract:i});return function(l,f,p){if(!l)return null;var m=l._size,d=m[1],h,x=100,b=100;f&&(h=f.q,x=f.lnz||x,b=f.unz||b);var T=[],v=[],S=[],_=new u({values:T,index:v,ptr:S,size:[d,d]}),y=[],A=[],M=[],w=new u({values:y,index:A,ptr:M,size:[d,d]}),D=[],N,B,R=[],z=[];for(N=0;N<d;N++)R[N]=0,D[N]=-1,S[N+1]=0;x=0,b=0;for(var V=0;V<d;V++){S[V]=x,M[V]=b;var k=h?h[V]:V,P=c(_,l,k,z,R,D,1),W=-1,O=-1;for(B=P;B<d;B++)if(N=z[B],D[N]<0){var X=e(R[N]);a(X,O)&&(O=X,W=N)}else A[b]=D[N],y[b++]=R[N];if(W===-1||O<=0)return null;D[k]<0&&o(e(R[k]),n(O,p))&&(W=k);var ne=R[W];for(A[b]=V,y[b++]=ne,D[W]=V,v[x]=W,T[x++]=1,B=P;B<d;B++)N=z[B],D[N]<0&&(v[x]=N,T[x++]=t(R[N],ne)),R[N]=0}for(S[d]=x,M[d]=b,B=0;B<x;B++)v[B]=D[v[B]];return T.splice(x,T.length-x),v.splice(x,v.length-x),y.splice(b,y.length-b),A.splice(b,A.length-b),{L:_,U:w,pinv:D}}});var C$="slu",Dte=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],jS=C(C$,Dte,r=>{var{typed:e,abs:t,add:n,multiply:i,transpose:a,divideScalar:o,subtract:u,larger:c,largerEq:s,SparseMatrix:l}=r,f=A$({add:n,multiply:i,transpose:a}),p=D$({abs:t,divideScalar:o,multiply:i,subtract:u,larger:c,largerEq:s,SparseMatrix:l});return e(C$,{"SparseMatrix, number, number":function(d,h,x){if(!Je(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=p(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(r,e){var t,n=e.length,i=[];if(r)for(t=0;t<n;t++)i[r[t]]=e[t];else for(t=0;t<n;t++)i[t]=e[t];return i}var N$="lusolve",Cte=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],JS=C(N$,Cte,r=>{var{typed:e,matrix:t,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:u}=r,c=rs({DenseMatrix:u});return e(N$,{"Array, Array | Matrix":function(p,m){p=t(p);var d=n(p),h=l(d.L,d.U,d.p,null,m);return h.valueOf()},"DenseMatrix, Array | Matrix":function(p,m){var d=n(p);return l(d.L,d.U,d.p,null,m)},"SparseMatrix, Array | Matrix":function(p,m){var d=n(p);return l(d.L,d.U,d.p,null,m)},"SparseMatrix, Array | Matrix, number, number":function(p,m,d,h){var x=i(p,d,h);return l(x.L,x.U,x.p,x.q,m)},"Object, Array | Matrix":function(p,m){return l(p.L,p.U,p.p,p.q,m)}});function s(f){if(et(f))return f;if(dr(f))return t(f);throw new TypeError("Invalid Matrix LU decomposition")}function l(f,p,m,d,h){f=s(f),p=s(p),m&&(h=c(f,h,!0),h._data=ZS(m,h._data));var x=o(f,h),b=a(p,x);return d&&(b._data=ZS(d,b._data)),b}});var F$="polynomialRoot",Nte=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],XS=C(F$,Nte,r=>{var{typed:e,isZero:t,equalScalar:n,add:i,subtract:a,multiply:o,divide:u,sqrt:c,unaryMinus:s,cbrt:l,typeOf:f,im:p,re:m}=r;return e(F$,{"number|Complex, ...number|Complex":(d,h)=>{for(var x=[d,...h];x.length>0&&t(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[s(u(x[0],x[1]))];case 3:{var[b,T,v]=x,S=o(2,v),_=o(T,T),y=o(4,v,b);if(n(_,y))return[u(s(T),S)];var A=c(a(_,y));return[u(a(A,T),S),u(a(s(A),T),S)]}case 4:{var[M,w,D,N]=x,B=s(o(3,N)),R=o(D,D),z=o(3,N,w),V=i(o(2,D,D,D),o(27,N,N,M)),k=o(9,N,D,w);if(n(R,z)&&n(V,k))return[u(D,B)];var P=a(R,z),W=a(V,k),O=i(o(18,N,D,w,M),o(D,D,w,w)),X=i(o(4,D,D,D,M),o(4,N,w,w,w),o(27,N,N,M,M));if(n(O,X))return[u(a(o(4,N,D,w),i(o(9,N,N,M),o(D,D,D))),o(N,P)),u(a(o(9,N,M),o(D,w)),o(2,P))];var ne;n(R,z)?ne=W:ne=u(i(W,c(a(o(W,W),o(4,P,P,P)))),2);var Z=!0,L=l(ne,Z).toArray().map(pe=>u(i(D,pe,u(P,pe)),B));return L.map(pe=>f(pe)==="Complex"&&n(m(pe),m(pe)+p(pe))?m(pe):pe)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(x))}}})});var Fte="Help",Ite=["evaluate"],QS=C(Fte,Ite,r=>{var{evaluate:e}=r;function t(n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var n=this.doc||{},i=`
`;if(n.name&&(i+="Name: "+n.name+`

`),n.category&&(i+="Category: "+n.category+`

`),n.description&&(i+=`Description:
    `+n.description+`

`),n.syntax&&(i+=`Syntax:
    `+n.syntax.join(`
    `)+`

`),n.examples){i+=`Examples:
`;for(var a=!1,o=e("config()"),u={config:f=>(a=!0,e("config(newConfig)",{newConfig:f}))},c=0;c<n.examples.length;c++){var s=n.examples[c];i+="    "+s+`
`;var l=void 0;try{l=e(s,u)}catch(f){l=f}l!==void 0&&!$h(l)&&(i+="        "+Et(l,{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},t.prototype.toJSON=function(){var n=dt(this.doc);return n.mathjs="Help",n},t.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new t(i)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var Pte="Chain",Bte=["?on","math","typed"],KS=C(Pte,Bte,r=>{var{on:e,math:t,typed:n}=r;function i(s){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Oh(s)?this.value=s.value:this.value=s}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Et(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(s){return new i(s.value)};function a(s,l){typeof l=="function"&&(i.prototype[s]=u(l))}function o(s,l){JI(i.prototype,s,function(){var p=l();if(typeof p=="function")return u(p)})}function u(s){return function(){if(arguments.length===0)return new i(s(this.value));for(var l=[this.value],f=0;f<arguments.length;f++)l[f+1]=arguments[f];if(n.isTypedFunction(s)){var p=n.resolve(s,l);if(p.params.length===1)throw new Error("chain function "+s.name+" cannot match rest parameter between chain value and additional arguments.");return new i(p.implementation.apply(s,l))}return new i(s.apply(s,l))}}i.createProxy=function(s,l){if(typeof s=="string")a(s,l);else{var f=function(d){it(s,d)&&c[d]===void 0&&o(d,()=>s[d])};for(var p in s)f(p)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),e&&e("import",function(s,l,f){f||o(s,l)}),i},{isClass:!0});var eA={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 I$={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var P$={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 B$={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 k$={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var $$={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var O$={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 R$={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 L$={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var V$={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var U$={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 tA={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 q$={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 z$={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var H$={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 G$={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var W$={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var Y$={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 j$={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 Z$={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 J$={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 X$={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 Q$={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 K$={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 eO={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 tO={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 rO={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 nO={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 iO={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 aO={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 oO={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 sO={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 uO={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 lO={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 cO={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 fO={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 pO={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 mO={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 dO={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 hO={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 gO={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 vO={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 yO={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 xO={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 bO={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 wO={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 _O={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 SO={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 AO={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 EO={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 TO={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var MO={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 DO={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 CO={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var NO={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 FO={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 IO={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 PO={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 BO={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 kO={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 $O={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 OO={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 RO={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var LO={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var VO={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 UO={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 qO={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 zO={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 HO={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 GO={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 WO={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 YO={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 jO={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 ZO={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 JO={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 XO={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 QO={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 KO={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 eR={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 tR={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 rR={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 nR={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 iR={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 aR={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 oR={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 sR={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 uR={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 lR={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 cR={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var fR={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 pR={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 mR={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 dR={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 hR={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 gR={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 vR={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 yR={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 xR={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 bR={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 wR={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 _R={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 SR={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 AR={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 ER={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 TR={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 MR={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 DR={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 CR={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 NR={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 FR={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 IR={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 PR={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 BR={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 kR={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 $R={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 OR={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 RR={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 LR={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 VR={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 UR={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 qR={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 zR={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 HR={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 GR={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 WR={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 YR={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 jR={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 ZR={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 JR={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 XR={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 QR={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 KR={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 eL={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 tL={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 rL={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 nL={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 iL={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 aL={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 oL={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 sL={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 uL={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 lL={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 cL={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 fL={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 pL={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 mL={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 dL={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 hL={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 gL={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 vL={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 yL={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var xL={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var bL={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 wL={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 _L={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 SL={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 AL={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 EL={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 TL={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 ML={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 DL={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 CL={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 NL={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 FL={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 IL={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 PL={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 BL={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 kL={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 $L={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 OL={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 RL={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 LL={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 VL={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 UL={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 qL={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 zL={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 HL={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 GL={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 WL={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 YL={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 jL={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 ZL={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 JL={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 XL={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 QL={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 KL={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 e3={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 t3={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 r3={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 n3={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 i3={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 a3={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 o3={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 s3={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 u3={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 l3={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 c3={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 f3={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 p3={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 m3={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 d3={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 h3={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 g3={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 v3={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 y3={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 x3={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 b3={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 w3={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 _3={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var S3={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 A3={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 E3={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 T3={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 M3={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 D3={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 C3={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 N3={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 F3={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 I3={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 P3={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 B3={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 k3={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 $3={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 O3={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var R3={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 L3={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 V3={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 U3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var q3={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 z3={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 H3={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 G3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var W3={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 Y3={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 j3={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 Z3={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 J3={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 X3={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 Q3={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 K3={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 e4={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var t4={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 r4={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 n4={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 i4={bignumber:Y$,bigint:j$,boolean:Z$,complex:J$,createUnit:X$,fraction:Q$,index:K$,matrix:eO,number:tO,sparse:rO,splitUnit:nO,string:iO,unit:aO,e:eA,E:eA,false:I$,i:P$,Infinity:B$,LN2:$$,LN10:k$,LOG2E:R$,LOG10E:O$,NaN:L$,null:V$,pi:tA,PI:tA,phi:U$,SQRT1_2:q$,SQRT2:z$,tau:H$,true:G$,version:W$,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:lO,lsolve:fO,lsolveAll:pO,lup:mO,lusolve:dO,leafCount:cO,polynomialRoot:hO,resolve:yO,simplify:xO,simplifyConstant:bO,simplifyCore:wO,symbolicEqual:SO,rationalize:vO,slu:_O,usolve:AO,usolveAll:EO,qr:gO,abs:TO,add:MO,cbrt:DO,ceil:CO,cube:NO,divide:FO,dotDivide:IO,dotMultiply:PO,dotPow:BO,exp:kO,expm:$O,expm1:OO,fix:RO,floor:LO,gcd:VO,hypot:UO,lcm:zO,log:HO,log2:YO,log1p:WO,log10:GO,mod:jO,multiply:ZO,norm:JO,nthRoot:XO,nthRoots:QO,pow:KO,round:eR,sign:tR,sqrt:rR,sqrtm:nR,square:sR,subtract:uR,unaryMinus:lR,unaryPlus:cR,xgcd:fR,invmod:qO,bitAnd:pR,bitNot:mR,bitOr:dR,bitXor:hR,leftShift:gR,rightArithShift:vR,rightLogShift:yR,bellNumbers:xR,catalan:bR,composition:wR,stirlingS2:_R,config:oO,import:sO,typed:uO,arg:SR,conj:AR,re:TR,im:ER,evaluate:MR,help:DR,distance:CR,intersect:NR,and:FR,not:IR,or:PR,xor:BR,concat:$R,count:OR,cross:RR,column:kR,ctranspose:LR,det:VR,diag:UR,diff:qR,dot:zR,getMatrixDataType:jR,identity:ZR,filter:GR,flatten:WR,forEach:YR,inv:JR,pinv:XR,eigs:HR,kron:QR,matrixFromFunction:tL,matrixFromRows:rL,matrixFromColumns:eL,map:KR,ones:nL,partitionSelect:iL,range:aL,resize:sL,reshape:oL,rotate:uL,rotationMatrix:lL,row:cL,size:fL,sort:pL,squeeze:mL,subset:dL,trace:hL,transpose:gL,zeros:vL,fft:yL,ifft:xL,sylvester:iR,schur:aR,lyap:oR,solveODE:n4,combinations:bL,combinationsWithRep:wL,factorial:_L,gamma:SL,kldivergence:EL,lgamma:AL,multinomial:TL,permutations:ML,pickRandom:DL,random:CL,randomInt:NL,compare:FL,compareNatural:IL,compareText:PL,deepEqual:BL,equal:kL,equalText:$L,larger:OL,largerEq:RL,smaller:LL,smallerEq:VL,unequal:UL,setCartesian:qL,setDifference:zL,setDistinct:HL,setIntersect:GL,setIsSubset:WL,setMultiplicity:YL,setPowerset:jL,setSize:ZL,setSymDifference:JL,setUnion:XL,zpk2tf:QL,freqz:KL,erf:e3,zeta:t3,cumsum:f3,mad:r3,max:n3,mean:i3,median:a3,min:o3,mode:s3,prod:u3,quantileSeq:l3,std:c3,sum:p3,variance:m3,corr:d3,acos:h3,acosh:g3,acot:v3,acoth:y3,acsc:x3,acsch:b3,asec:w3,asech:_3,asin:S3,asinh:A3,atan:E3,atanh:M3,atan2:T3,cos:D3,cosh:C3,cot:N3,coth:F3,csc:I3,csch:P3,sec:B3,sech:k3,sin:$3,sinh:O3,tan:R3,tanh:L3,to:V3,clone:q3,format:z3,bin:U3,oct:e4,hex:G3,isNaN:Y3,isInteger:W3,isNegative:j3,isNumeric:Z3,hasNumericValue:H3,isPositive:J3,isPrime:X3,isZero:Q3,print:t4,typeOf:r4,numeric:K3};var a4="help",kte=["typed","mathWithTransform","Help"],rA=C(a4,kte,r=>{var{typed:e,mathWithTransform:t,Help:n}=r;return e(a4,{any:function(a){var o,u=a;if(typeof a!="string"){for(o in t)if(it(t,o)&&a===t[o]){u=o;break}}var c=Kr(i4,u);if(!c){var s=typeof u=="function"?u.name:u;throw new Error('No documentation found on "'+s+'"')}return new n(c)}})});var o4="chain",$te=["typed","Chain"],nA=C(o4,$te,r=>{var{typed:e,Chain:t}=r;return e(o4,{"":function(){return new t},any:function(i){return new t(i)}})});var s4="det",Ote=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],iA=C(s4,Ote,r=>{var{typed:e,matrix:t,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:u}=r;return e(s4,{any:function(l){return dt(l)},"Array | Matrix":function(l){var f;switch(et(l)?f=l.size():Array.isArray(l)?(l=t(l),f=l.size()):f=[],f.length){case 0:return dt(l);case 1:if(f[0]===1)return dt(l.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Et(f)+")");case 2:{var p=f[0],m=f[1];if(p===m)return c(l.clone().valueOf(),p,m);if(m===0)return 1;throw new RangeError("Matrix must be square (size: "+Et(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Et(f)+")")}}});function c(s,l,f){if(l===1)return dt(s[0][0]);if(l===2)return n(i(s[0][0],s[1][1]),i(s[1][0],s[0][1]));for(var p=!1,m=new Array(l).fill(0).map((A,M)=>M),d=0;d<l;d++){var h=m[d];if(o(s[h][d])){var x=void 0;for(x=d+1;x<l;x++)if(!o(s[m[x]][d])){h=m[x],m[x]=m[d],m[d]=h,p=!p;break}if(x===l)return s[h][d]}for(var b=s[h][d],T=d===0?1:s[m[d-1]][d-1],v=d+1;v<l;v++)for(var S=m[v],_=d+1;_<l;_++)s[S][_]=a(n(i(s[S][_],b),i(s[S][d],s[h][_])),T)}var y=s[m[l-1]][l-1];return p?u(y):y}});var u4="inv",Rte=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],aA=C(u4,Rte,r=>{var{typed:e,matrix:t,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:u,identity:c,abs:s}=r;return e(u4,{"Array | Matrix":function(p){var m=et(p)?p.size():lt(p);switch(m.length){case 1:if(m[0]===1)return et(p)?t([n(1,p.valueOf()[0])]):[n(1,p[0])];throw new RangeError("Matrix must be square (size: "+Et(m)+")");case 2:{var d=m[0],h=m[1];if(d===h)return et(p)?t(l(p.valueOf(),d,h),p.storage()):l(p,d,h);throw new RangeError("Matrix must be square (size: "+Et(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Et(m)+")")}},any:function(p){return n(1,p)}});function l(f,p,m){var d,h,x,b,T;if(p===1){if(b=f[0][0],b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,b)]]}else if(p===2){var v=u(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 S=f.concat();for(d=0;d<p;d++)S[d]=S[d].concat();for(var _=c(p).valueOf(),y=0;y<m;y++){var A=s(S[y][y]),M=y;for(d=y+1;d<p;)s(S[d][y])>A&&(A=s(S[d][y]),M=d),d++;if(A===0)throw Error("Cannot calculate inverse, determinant is zero");d=M,d!==y&&(T=S[y],S[y]=S[d],S[d]=T,T=_[y],_[y]=_[d],_[d]=T);var w=S[y],D=_[y];for(d=0;d<p;d++){var N=S[d],B=_[d];if(d!==y){if(N[y]!==0){for(x=n(o(N[y]),w[y]),h=y;h<m;h++)N[h]=i(N[h],a(x,w[h]));for(h=0;h<m;h++)B[h]=i(B[h],a(x,D[h]))}}else{for(x=w[y],h=y;h<m;h++)N[h]=n(N[h],x);for(h=0;h<m;h++)B[h]=n(B[h],x)}}}return _}}});var l4="pinv",Lte=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],oA=C(l4,Lte,r=>{var{typed:e,matrix:t,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:u,ctranspose:c,divideScalar:s,multiply:l,add:f,Complex:p}=r;return e(l4,{"Array | Matrix":function(v){var S=et(v)?v.size():lt(v);switch(S.length){case 1:return b(v)?c(v):S[0]===1?n(v):o(c(v),u(v,v));case 2:{if(b(v))return c(v);var _=S[0],y=S[1];if(_===y)try{return n(v)}catch(A){if(!(A instanceof Error&&A.message.match(/Cannot calculate inverse, determinant is zero/)))throw A}return et(v)?t(m(v.valueOf(),_,y),v.storage()):m(v,_,y)}default:throw new RangeError("Matrix must be two dimensional (size: "+Et(S)+")")}},any:function(v){return a(v,0)?dt(v):s(1,v)}});function m(T,v,S){var{C:_,F:y}=h(T,v,S),A=l(n(l(c(_),_)),c(_)),M=l(c(y),n(l(y,c(y))));return l(M,A)}function d(T,v,S){for(var _=dt(T),y=0,A=0;A<v;A++){if(S<=y)return _;for(var M=A;x(_[M][y]);)if(M++,v===M&&(M=A,y++,S===y))return _;[_[M],_[A]]=[_[A],_[M]];for(var w=_[A][y],D=0;D<S;D++)_[A][D]=o(_[A][D],w);for(var N=0;N<v;N++)if(N!==A){w=_[N][y];for(var B=0;B<S;B++)_[N][B]=f(_[N][B],l(-1,l(w,_[A][B])))}y++}return _}function h(T,v,S){var _=d(T,v,S),y=T.map((M,w)=>M.filter((D,N)=>N<v&&!x(u(_[N],_[N])))),A=_.filter((M,w)=>!x(u(_[w],_[w])));return{C:y,F:A}}function x(T){return a(f(T,p(1,1)),f(0,p(1,1)))}function b(T){return i(f(T,p(1,1)),f(l(T,0),p(1,1)))}});function c4(r){var{addScalar:e,subtract:t,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:u,abs:c,bignumber:s,diag:l,size:f,reshape:p,inv:m,qr:d,usolve:h,usolveAll:x,equal:b,complex:T,larger:v,smaller:S,matrixFromColumns:_,dot:y}=r;function A(Z,L,pe,me){var oe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ve=M(Z,L,pe,me,oe);w(Z,L,pe,me,oe,ve);var{values:_e,C:ye}=D(Z,L,pe,me,oe);if(oe){var be=N(Z,L,ye,ve,_e,pe,me);return{values:_e,eigenvectors:be}}return{values:_e}}function M(Z,L,pe,me,oe){var ve=me==="BigNumber",_e=me==="Complex",ye=ve?s(0):0,be=ve?s(1):_e?T(1):1,we=ve?s(1):1,Ee=ve?s(10):2,ze=a(Ee,Ee),Qe;oe&&(Qe=Array(L).fill(be));for(var Y=!1;!Y;){Y=!0;for(var Q=0;Q<L;Q++){for(var xe=ye,J=ye,re=0;re<L;re++)Q!==re&&(xe=e(xe,c(Z[re][Q])),J=e(J,c(Z[Q][re])));if(!b(xe,0)&&!b(J,0)){for(var se=we,Ae=xe,Te=o(J,Ee),qe=a(J,Ee);S(Ae,Te);)Ae=a(Ae,ze),se=a(se,Ee);for(;v(Ae,qe);)Ae=o(Ae,ze),se=o(se,Ee);var Se=S(o(e(Ae,J),se),a(e(xe,J),.95));if(Se){Y=!1;for(var wt=o(1,se),Dt=0;Dt<L;Dt++)Q!==Dt&&(Z[Q][Dt]=a(Z[Q][Dt],wt),Z[Dt][Q]=a(Z[Dt][Q],se));oe&&(Qe[Q]=a(Qe[Q],wt))}}}}return oe?l(Qe):null}function w(Z,L,pe,me,oe,ve){var _e=me==="BigNumber",ye=me==="Complex",be=_e?s(0):ye?T(0):0;_e&&(pe=s(pe));for(var we=0;we<L-2;we++){for(var Ee=0,ze=be,Qe=we+1;Qe<L;Qe++){var Y=Z[Qe][we];S(c(ze),c(Y))&&(ze=Y,Ee=Qe)}if(!S(c(ze),pe)){if(Ee!==we+1){var Q=Z[Ee];Z[Ee]=Z[we+1],Z[we+1]=Q;for(var xe=0;xe<L;xe++){var J=Z[xe][Ee];Z[xe][Ee]=Z[xe][we+1],Z[xe][we+1]=J}if(oe){var re=ve[Ee];ve[Ee]=ve[we+1],ve[we+1]=re}}for(var se=we+2;se<L;se++){var Ae=o(Z[se][we],ze);if(Ae!==0){for(var Te=0;Te<L;Te++)Z[se][Te]=t(Z[se][Te],a(Ae,Z[we+1][Te]));for(var qe=0;qe<L;qe++)Z[qe][we+1]=e(Z[qe][we+1],a(Ae,Z[qe][se]));if(oe)for(var Se=0;Se<L;Se++)ve[se][Se]=t(ve[se][Se],a(Ae,ve[we+1][Se]))}}}}return ve}function D(Z,L,pe,me,oe){var ve=me==="BigNumber",_e=me==="Complex",ye=ve?s(1):_e?T(1):1;ve&&(pe=s(pe));for(var be=dt(Z),we=[],Ee=L,ze=[],Qe=oe?l(Array(L).fill(ye)):void 0,Y=oe?l(Array(Ee).fill(ye)):void 0,Q=0;Q<=100;){Q+=1;for(var xe=be[Ee-1][Ee-1],J=0;J<Ee;J++)be[J][J]=t(be[J][J],xe);var{Q:re,R:se}=d(be);be=i(se,re);for(var Ae=0;Ae<Ee;Ae++)be[Ae][Ae]=e(be[Ae][Ae],xe);if(oe&&(Y=i(Y,re)),Ee===1||S(c(be[Ee-1][Ee-2]),pe)){Q=0,we.push(be[Ee-1][Ee-1]),oe&&(ze.unshift([[1]]),z(Y,L),Qe=i(Qe,Y),Ee>1&&(Y=l(Array(Ee-1).fill(ye)))),Ee-=1,be.pop();for(var Te=0;Te<Ee;Te++)be[Te].pop()}else if(Ee===2||S(c(be[Ee-2][Ee-3]),pe)){Q=0;var qe=B(be[Ee-2][Ee-2],be[Ee-2][Ee-1],be[Ee-1][Ee-2],be[Ee-1][Ee-1]);we.push(...qe),oe&&(ze.unshift(R(be[Ee-2][Ee-2],be[Ee-2][Ee-1],be[Ee-1][Ee-2],be[Ee-1][Ee-1],qe[0],qe[1],pe,me)),z(Y,L),Qe=i(Qe,Y),Ee>2&&(Y=l(Array(Ee-2).fill(ye)))),Ee-=2,be.pop(),be.pop();for(var Se=0;Se<Ee;Se++)be[Se].pop(),be[Se].pop()}if(Ee===0)break}if(we.sort((jt,Tt)=>+t(c(jt),c(Tt))),Q>100){var wt=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+we.join(", "));throw wt.values=we,wt.vectors=[],wt}var Dt=oe?i(Qe,V(ze,L)):void 0;return{values:we,C:Dt}}function N(Z,L,pe,me,oe,ve,_e){var ye=m(pe),be=i(ye,Z,pe),we=_e==="BigNumber",Ee=_e==="Complex",ze=we?s(0):Ee?T(0):0,Qe=we?s(1):Ee?T(1):1,Y=[],Q=[];for(var xe of oe){var J=k(Y,xe,b);J===-1?(Y.push(xe),Q.push(1)):Q[J]+=1}for(var re=[],se=Y.length,Ae=Array(L).fill(ze),Te=l(Array(L).fill(Qe)),qe=function(){var Dt=Y[Se],jt=t(be,i(Dt,Te)),Tt=x(jt,Ae);for(Tt.shift();Tt.length<Q[Se];){var j=P(jt,L,Tt,ve,_e);if(j===null)break;Tt.push(j)}var le=i(m(me),pe);Tt=Tt.map(fe=>i(le,fe)),re.push(...Tt.map(fe=>({value:Dt,vector:n(fe)})))},Se=0;Se<se;Se++)qe();return re}function B(Z,L,pe,me){var oe=e(Z,me),ve=t(a(Z,me),a(L,pe)),_e=a(oe,.5),ye=a(u(t(a(oe,oe),a(4,ve))),.5);return[e(_e,ye),t(_e,ye)]}function R(Z,L,pe,me,oe,ve,_e,ye){var be=ye==="BigNumber",we=ye==="Complex",Ee=be?s(0):we?T(0):0,ze=be?s(1):we?T(1):1;if(S(c(pe),_e))return[[ze,Ee],[Ee,ze]];if(v(c(t(oe,ve)),_e))return[[t(oe,me),t(ve,me)],[pe,pe]];var Qe=t(Z,oe),Y=t(me,oe);return S(c(L),_e)&&S(c(Y),_e)?[[Qe,ze],[pe,Ee]]:[[L,Ee],[Y,ze]]}function z(Z,L){for(var pe=0;pe<Z.length;pe++)Z[pe].push(...Array(L-Z[pe].length).fill(0));for(var me=Z.length;me<L;me++)Z.push(Array(L).fill(0)),Z[me][me]=1;return Z}function V(Z,L){for(var pe=[],me=0;me<L;me++)pe[me]=Array(L).fill(0);var oe=0;for(var ve of Z){for(var _e=ve.length,ye=0;ye<_e;ye++)for(var be=0;be<_e;be++)pe[oe+ye][oe+be]=ve[ye][be];oe+=_e}return pe}function k(Z,L,pe){for(var me=0;me<Z.length;me++)if(pe(Z[me],L))return me;return-1}function P(Z,L,pe,me,oe){for(var ve=oe==="BigNumber"?s(1e3):1e3,_e,ye=0;ye<5;++ye){_e=W(L,pe,oe);try{_e=h(Z,_e)}catch{continue}if(v(X(_e),ve))break}if(ye>=5)return null;for(ye=0;;){var be=h(Z,_e);if(S(X(O(_e,[be])),me))break;if(++ye>=10)return null;_e=ne(be)}return _e}function W(Z,L,pe){var me=pe==="BigNumber",oe=pe==="Complex",ve=Array(Z).fill(0).map(_e=>2*Math.random()-1);return me&&(ve=ve.map(_e=>s(_e))),oe&&(ve=ve.map(_e=>T(_e))),ve=O(ve,L),ne(ve,pe)}function O(Z,L){var pe=f(Z);for(var me of L)me=p(me,pe),Z=t(Z,i(o(y(me,Z),y(me,me)),me));return Z}function X(Z){return c(u(y(Z,Z)))}function ne(Z,L){var pe=L==="BigNumber",me=L==="Complex",oe=pe?s(1):me?T(1):1;return i(o(oe,X(Z)),Z)}return A}function f4(r){var{config:e,addScalar:t,subtract:n,abs:i,atan:a,cos:o,sin:u,multiplyScalar:c,inv:s,bignumber:l,multiply:f,add:p}=r;function m(w,D){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.relTol,B=arguments.length>3?arguments[3]:void 0,R=arguments.length>4?arguments[4]:void 0;if(B==="number")return d(w,N,R);if(B==="BigNumber")return h(w,N,R);throw TypeError("Unsupported data type: "+B)}function d(w,D,N){var B=w.length,R=Math.abs(D/B),z,V;if(N){V=new Array(B);for(var k=0;k<B;k++)V[k]=Array(B).fill(0),V[k][k]=1}for(var P=y(w);Math.abs(P[1])>=Math.abs(R);){var W=P[0][0],O=P[0][1];z=x(w[W][W],w[O][O],w[W][O]),w=_(w,z,W,O),N&&(V=T(V,z,W,O)),P=y(w)}for(var X=Array(B).fill(0),ne=0;ne<B;ne++)X[ne]=w[ne][ne];return M(dt(X),V,N)}function h(w,D,N){var B=w.length,R=i(D/B),z,V;if(N){V=new Array(B);for(var k=0;k<B;k++)V[k]=Array(B).fill(0),V[k][k]=1}for(var P=A(w);i(P[1])>=i(R);){var W=P[0][0],O=P[0][1];z=b(w[W][W],w[O][O],w[W][O]),w=S(w,z,W,O),N&&(V=v(V,z,W,O)),P=A(w)}for(var X=Array(B).fill(0),ne=0;ne<B;ne++)X[ne]=w[ne][ne];return M(dt(X),V,N)}function x(w,D,N){var B=D-w;return Math.abs(B)<=e.relTol?Math.PI/4:.5*Math.atan(2*N/(D-w))}function b(w,D,N){var B=n(D,w);return i(B)<=e.relTol?l(-1).acos().div(4):c(.5,a(f(2,N,s(B))))}function T(w,D,N,B){for(var R=w.length,z=Math.cos(D),V=Math.sin(D),k=Array(R).fill(0),P=Array(R).fill(0),W=0;W<R;W++)k[W]=z*w[W][N]-V*w[W][B],P[W]=V*w[W][N]+z*w[W][B];for(var O=0;O<R;O++)w[O][N]=k[O],w[O][B]=P[O];return w}function v(w,D,N,B){for(var R=w.length,z=o(D),V=u(D),k=Array(R).fill(l(0)),P=Array(R).fill(l(0)),W=0;W<R;W++)k[W]=n(c(z,w[W][N]),c(V,w[W][B])),P[W]=t(c(V,w[W][N]),c(z,w[W][B]));for(var O=0;O<R;O++)w[O][N]=k[O],w[O][B]=P[O];return w}function S(w,D,N,B){for(var R=w.length,z=l(o(D)),V=l(u(D)),k=c(z,z),P=c(V,V),W=Array(R).fill(l(0)),O=Array(R).fill(l(0)),X=f(l(2),z,V,w[N][B]),ne=t(n(c(k,w[N][N]),X),c(P,w[B][B])),Z=p(c(P,w[N][N]),X,c(k,w[B][B])),L=0;L<R;L++)W[L]=n(c(z,w[N][L]),c(V,w[B][L])),O[L]=t(c(V,w[N][L]),c(z,w[B][L]));w[N][N]=ne,w[B][B]=Z,w[N][B]=l(0),w[B][N]=l(0);for(var pe=0;pe<R;pe++)pe!==N&&pe!==B&&(w[N][pe]=W[pe],w[pe][N]=W[pe],w[B][pe]=O[pe],w[pe][B]=O[pe]);return w}function _(w,D,N,B){for(var R=w.length,z=Math.cos(D),V=Math.sin(D),k=z*z,P=V*V,W=Array(R).fill(0),O=Array(R).fill(0),X=k*w[N][N]-2*z*V*w[N][B]+P*w[B][B],ne=P*w[N][N]+2*z*V*w[N][B]+k*w[B][B],Z=0;Z<R;Z++)W[Z]=z*w[N][Z]-V*w[B][Z],O[Z]=V*w[N][Z]+z*w[B][Z];w[N][N]=X,w[B][B]=ne,w[N][B]=0,w[B][N]=0;for(var L=0;L<R;L++)L!==N&&L!==B&&(w[N][L]=W[L],w[L][N]=W[L],w[B][L]=O[L],w[L][B]=O[L]);return w}function y(w){for(var D=w.length,N=0,B=[0,1],R=0;R<D;R++)for(var z=R+1;z<D;z++)Math.abs(N)<Math.abs(w[R][z])&&(N=Math.abs(w[R][z]),B=[R,z]);return[B,N]}function A(w){for(var D=w.length,N=0,B=[0,1],R=0;R<D;R++)for(var z=R+1;z<D;z++)i(N)<i(w[R][z])&&(N=i(w[R][z]),B=[R,z]);return[B,N]}function M(w,D,N){var B=w.length,R=Array(B),z;if(N){z=Array(B);for(var V=0;V<B;V++)z[V]=Array(B)}for(var k=0;k<B;k++){for(var P=0,W=w[0],O=0;O<w.length;O++)i(w[O])<i(W)&&(P=O,W=w[P]);if(R[k]=w.splice(P,1)[0],N)for(var X=0;X<B;X++)z[k][X]=D[X][P],D[X].splice(P,1)}if(!N)return{values:R};var ne=z.map((Z,L)=>({value:R[L],vector:Z}));return{values:R,eigenvectors:ne}}return m}var Vte="eigs",Ute=["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"],sA=C(Vte,Ute,r=>{var{config:e,typed:t,matrix:n,addScalar:i,subtract:a,equal:o,abs:u,atan:c,cos:s,sin:l,multiplyScalar:f,divideScalar:p,inv:m,bignumber:d,multiply:h,add:x,larger:b,column:T,flatten:v,number:S,complex:_,sqrt:y,diag:A,size:M,reshape:w,qr:D,usolve:N,usolveAll:B,im:R,re:z,smaller:V,matrixFromColumns:k,dot:P}=r,W=f4({config:e,addScalar:i,subtract:a,column:T,flatten:v,equal:o,abs:u,atan:c,cos:s,sin:l,multiplyScalar:f,inv:m,bignumber:d,complex:_,multiply:h,add:x}),O=c4({config:e,addScalar:i,subtract:a,multiply:h,multiplyScalar:f,flatten:v,divideScalar:p,sqrt:y,abs:u,bignumber:d,diag:A,size:M,reshape:w,qr:D,inv:m,usolve:N,usolveAll:B,equal:o,complex:_,larger:b,smaller:V,matrixFromColumns:k,dot:P});return t("eigs",{Array:function(ve){return X(n(ve))},"Array, number|BigNumber":function(ve,_e){return X(n(ve),{precision:_e})},"Array, Object"(oe,ve){return X(n(oe),ve)},Matrix:function(ve){return X(ve,{matricize:!0})},"Matrix, number|BigNumber":function(ve,_e){return X(ve,{precision:_e,matricize:!0})},"Matrix, Object":function(ve,_e){var ye={matricize:!0};return rn(ye,_e),X(ve,ye)}});function X(oe){var ve,_e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye="eigenvectors"in _e?_e.eigenvectors:!0,be=(ve=_e.precision)!==null&&ve!==void 0?ve:e.relTol,we=ne(oe,be,ye);return _e.matricize&&(we.values=n(we.values),ye&&(we.eigenvectors=we.eigenvectors.map(Ee=>{var{value:ze,vector:Qe}=Ee;return{value:ze,vector:n(Qe)}}))),ye&&Object.defineProperty(we,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),we}function ne(oe,ve,_e){var ye=oe.toArray(),be=oe.size();if(be.length!==2||be[0]!==be[1])throw new RangeError("Matrix must be square (size: ".concat(Et(be),")"));var we=be[0];if(L(ye,we,ve)&&(pe(ye,we),Z(ye,we,ve))){var Ee=me(oe,ye,we);return W(ye,we,ve,Ee,_e)}var ze=me(oe,ye,we);return O(ye,we,ve,ze,_e)}function Z(oe,ve,_e){for(var ye=0;ye<ve;ye++)for(var be=ye;be<ve;be++)if(b(d(u(a(oe[ye][be],oe[be][ye]))),_e))return!1;return!0}function L(oe,ve,_e){for(var ye=0;ye<ve;ye++)for(var be=0;be<ve;be++)if(b(d(u(R(oe[ye][be]))),_e))return!1;return!0}function pe(oe,ve){for(var _e=0;_e<ve;_e++)for(var ye=0;ye<ve;ye++)oe[_e][ye]=z(oe[_e][ye])}function me(oe,ve,_e){var ye=oe.datatype();if(ye==="number"||ye==="BigNumber"||ye==="Complex")return ye;for(var be=!1,we=!1,Ee=!1,ze=0;ze<_e;ze++)for(var Qe=0;Qe<_e;Qe++){var Y=ve[ze][Qe];if(xt(Y)||Os(Y))be=!0;else if(ut(Y))we=!0;else if(Hi(Y))Ee=!0;else throw TypeError("Unsupported type in Matrix: "+ur(Y))}if(we&&Ee&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),Ee){for(var Q=0;Q<_e;Q++)for(var xe=0;xe<_e;xe++)ve[Q][xe]=_(ve[Q][xe]);return"Complex"}if(we){for(var J=0;J<_e;J++)for(var re=0;re<_e;re++)ve[J][re]=d(ve[J][re]);return"BigNumber"}if(be){for(var se=0;se<_e;se++)for(var Ae=0;Ae<_e;Ae++)ve[se][Ae]=S(ve[se][Ae]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var p4="expm",qte=["typed","abs","add","identity","inv","multiply"],uA=C(p4,qte,r=>{var{typed:e,abs:t,add:n,identity:i,inv:a,multiply:o}=r;return e(p4,{Matrix:function(f){var p=f.size();if(p.length!==2||p[0]!==p[1])throw new RangeError("Matrix must be square (size: "+Et(p)+")");for(var m=p[0],d=1e-15,h=u(f),x=c(h,d),b=x.q,T=x.j,v=o(f,Math.pow(2,-T)),S=i(m),_=i(m),y=1,A=v,M=-1,w=1;w<=b;w++)w>1&&(A=o(A,v),M=-M),y=y*(b-w+1)/((2*b-w+1)*w),S=n(S,o(y,A)),_=n(_,o(y*M,A));for(var D=o(a(_),S),N=0;N<T;N++)D=o(D,D);return No(f)?f.createSparseMatrix(D):D}});function u(l){for(var f=l.size()[0],p=0,m=0;m<f;m++){for(var d=0,h=0;h<f;h++)d+=t(l.get([m,h]));p=Math.max(d,p)}return p}function c(l,f){for(var p=30,m=0;m<p;m++)for(var d=0;d<=m;d++){var h=m-d;if(s(l,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 s(l,f,p){for(var m=1,d=2;d<=f;d++)m*=d;for(var h=m,x=f+1;x<=2*f;x++)h*=x;var b=h*(2*f+1);return 8*Math.pow(l/Math.pow(2,p),2*f)*m*m/(h*b)}});var m4="sqrtm",zte=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],lA=C(m4,zte,r=>{var{typed:e,abs:t,add:n,multiply:i,map:a,sqrt:o,subtract:u,inv:c,size:s,max:l,identity:f}=r,p=1e3,m=1e-6;function d(h){var x,b=0,T=h,v=f(s(h));do{var S=T;if(T=i(.5,n(S,c(v))),v=i(.5,n(v,c(S))),x=l(t(u(T,S))),x>m&&++b>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(x>m);return T}return e(m4,{"Array | Matrix":function(x){var b=et(x)?x.size():lt(x);switch(b.length){case 1:if(b[0]===1)return a(x,o);throw new RangeError("Matrix must be square (size: "+Et(b)+")");case 2:{var T=b[0],v=b[1];if(T===v)return d(x);throw new RangeError("Matrix must be square (size: "+Et(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Et(b)+")")}}})});var d4="sylvester",Hte=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],cA=C(d4,Hte,r=>{var{typed:e,schur:t,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:u,transpose:c,index:s,subset:l,add:f,subtract:p,identity:m,lusolve:d,abs:h}=r;return e(d4,{"Matrix, Matrix, Matrix":x,"Array, Matrix, Matrix":function(T,v,S){return x(i(T),v,S)},"Array, Array, Matrix":function(T,v,S){return x(i(T),i(v),S)},"Array, Matrix, Array":function(T,v,S){return x(i(T),v,i(S))},"Matrix, Array, Matrix":function(T,v,S){return x(T,i(v),S)},"Matrix, Array, Array":function(T,v,S){return x(T,i(v),i(S))},"Matrix, Matrix, Array":function(T,v,S){return x(T,v,i(S))},"Array, Array, Array":function(T,v,S){return x(i(T),i(v),i(S)).toArray()}});function x(b,T,v){for(var S=T.size()[0],_=b.size()[0],y=t(b),A=y.T,M=y.U,w=t(a(-1,T)),D=w.T,N=w.U,B=a(a(c(M),v),N),R=o(0,_),z=[],V=(Ee,ze)=>u(Ee,ze,1),k=(Ee,ze)=>u(Ee,ze,0),P=0;P<S;P++)if(P<S-1&&h(l(D,s(P+1,P)))>1e-5){for(var W=k(l(B,s(R,P)),l(B,s(R,P+1))),O=0;O<P;O++)W=f(W,k(a(z[O],l(D,s(O,P))),a(z[O],l(D,s(O,P+1)))));var X=a(m(_),a(-1,l(D,s(P,P)))),ne=a(m(_),a(-1,l(D,s(P+1,P)))),Z=a(m(_),a(-1,l(D,s(P,P+1)))),L=a(m(_),a(-1,l(D,s(P+1,P+1)))),pe=k(V(f(A,X),ne),V(Z,f(A,L))),me=d(pe,W);z[P]=me.subset(s(o(0,_),0)),z[P+1]=me.subset(s(o(_,2*_),0)),P++}else{for(var oe=l(B,s(R,P)),ve=0;ve<P;ve++)oe=f(oe,a(z[ve],l(D,s(ve,P))));var _e=l(D,s(P,P)),ye=p(A,a(_e,m(_)));z[P]=d(ye,oe)}var be=i(n(...z)),we=a(M,a(be,c(N)));return we}});var h4="schur",Gte=["typed","matrix","identity","multiply","qr","norm","subtract"],fA=C(h4,Gte,r=>{var{typed:e,matrix:t,identity:n,multiply:i,qr:a,norm:o,subtract:u}=r;return e(h4,{Array:function(l){var f=c(t(l));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(l){return c(l)}});function c(s){var l=s.size()[0],f=s,p=n(l),m=0,d;do{d=f;var h=a(f),x=h.Q,b=h.R;if(f=i(b,x),p=i(p,x),m++>100)break}while(o(u(f,d))>1e-4);return{U:p,T:f}}});var g4="lyap",Wte=["typed","matrix","sylvester","multiply","transpose"],pA=C(g4,Wte,r=>{var{typed:e,matrix:t,sylvester:n,multiply:i,transpose:a}=r;return e(g4,{"Matrix, Matrix":function(u,c){return n(u,a(u),i(-1,c))},"Array, Matrix":function(u,c){return n(t(u),a(t(u)),i(-1,c))},"Matrix, Array":function(u,c){return n(u,a(t(u)),t(i(-1,c)))},"Array, Array":function(u,c){return n(t(u),a(t(u)),t(i(-1,c))).toArray()}})});var Yte="divide",jte=["typed","matrix","multiply","equalScalar","divideScalar","inv"],mA=C(Yte,jte,r=>{var{typed:e,matrix:t,multiply:n,equalScalar:i,divideScalar:a,inv:o}=r,u=Nr({typed:e,equalScalar:i}),c=Tn({typed:e});return e("divide",Rh({"Array | Matrix, Array | Matrix":function(l,f){return n(l,o(f))},"DenseMatrix, any":function(l,f){return c(l,f,a,!1)},"SparseMatrix, any":function(l,f){return u(l,f,a,!1)},"Array, any":function(l,f){return c(t(l),f,a,!1).valueOf()},"any, Array | Matrix":function(l,f){return n(l,o(f))}},a.signatures))});var v4="distance",Zte=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],dA=C(v4,Zte,r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:u,abs:c}=r;return e(v4,{"Array, Array, Array":function(_,y,A){if(_.length===2&&y.length===2&&A.length===2){if(!l(_))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(y))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!l(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(y,A))throw new TypeError("LinePoint1 should not be same with LinePoint2");var M=n(A[1],y[1]),w=n(y[0],A[0]),D=n(i(A[0],y[1]),i(y[0],A[1]));return x(_[0],_[1],M,w,D)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(_,y,A){if(Object.keys(_).length===2&&Object.keys(y).length===2&&Object.keys(A).length===2){if(!l(_))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(y))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!l(A))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(d(y),d(A)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in _&&"pointY"in _&&"lineOnePtX"in y&&"lineOnePtY"in y&&"lineTwoPtX"in A&&"lineTwoPtY"in A){var M=n(A.lineTwoPtY,y.lineOnePtY),w=n(y.lineOnePtX,A.lineTwoPtX),D=n(i(A.lineTwoPtX,y.lineOnePtY),i(y.lineOnePtX,A.lineTwoPtY));return x(_.pointX,_.pointY,M,w,D)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(_,y){if(_.length===2&&y.length===3){if(!l(_))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(_[0],_[1],y[0],y[1],y[2])}else if(_.length===3&&y.length===6){if(!f(_))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(y))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return b(_[0],_[1],_[2],y[0],y[1],y[2],y[3],y[4],y[5])}else if(_.length===y.length&&_.length>0){if(!p(_))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(y))throw new TypeError("All values of an array should be numbers or BigNumbers");return T(_,y)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(_,y){if(Object.keys(_).length===2&&Object.keys(y).length===3){if(!l(_))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 _&&"pointY"in _&&"xCoeffLine"in y&&"yCoeffLine"in y&&"constant"in y)return x(_.pointX,_.pointY,y.xCoeffLine,y.yCoeffLine,y.constant);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===3&&Object.keys(y).length===6){if(!f(_))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(y))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in _&&"pointY"in _&&"x0"in y&&"y0"in y&&"z0"in y&&"a"in y&&"b"in y&&"c"in y)return b(_.pointX,_.pointY,_.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(_).length===2&&Object.keys(y).length===2){if(!l(_))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!l(y))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in _&&"pointOneY"in _&&"pointTwoX"in y&&"pointTwoY"in y)return T([_.pointOneX,_.pointOneY],[y.pointTwoX,y.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===3&&Object.keys(y).length===3){if(!f(_))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 _&&"pointOneY"in _&&"pointOneZ"in _&&"pointTwoX"in y&&"pointTwoY"in y&&"pointTwoZ"in y)return T([_.pointOneX,_.pointOneY,_.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(_){if(!h(_))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return v(_)}});function s(S){return typeof S=="number"||ut(S)}function l(S){return S.constructor!==Array&&(S=d(S)),s(S[0])&&s(S[1])}function f(S){return S.constructor!==Array&&(S=d(S)),s(S[0])&&s(S[1])&&s(S[2])}function p(S){return Array.isArray(S)||(S=d(S)),S.every(s)}function m(S){return S.constructor!==Array&&(S=d(S)),s(S[0])&&s(S[1])&&s(S[2])&&s(S[3])&&s(S[4])&&s(S[5])}function d(S){for(var _=Object.keys(S),y=[],A=0;A<_.length;A++)y.push(S[_[A]]);return y}function h(S){if(S[0].length===2&&s(S[0][0])&&s(S[0][1])){if(S.some(_=>_.length!==2||!s(_[0])||!s(_[1])))return!1}else if(S[0].length===3&&s(S[0][0])&&s(S[0][1])&&s(S[0][2])){if(S.some(_=>_.length!==3||!s(_[0])||!s(_[1])||!s(_[2])))return!1}else return!1;return!0}function x(S,_,y,A,M){var w=c(t(t(i(y,S),i(A,_)),M)),D=u(t(i(y,y),i(A,A)));return a(w,D)}function b(S,_,y,A,M,w,D,N,B){var R=[n(i(n(M,_),B),i(n(w,y),N)),n(i(n(w,y),D),i(n(A,S),B)),n(i(n(A,S),N),i(n(M,_),D))];R=u(t(t(i(R[0],R[0]),i(R[1],R[1])),i(R[2],R[2])));var z=u(t(t(i(D,D),i(N,N)),i(B,B)));return a(R,z)}function T(S,_){for(var y=S.length,A=0,M=0,w=0;w<y;w++)M=n(S[w],_[w]),A=t(i(M,M),A);return u(A)}function v(S){for(var _=[],y=[],A=[],M=0;M<S.length-1;M++)for(var w=M+1;w<S.length;w++)S[0].length===2?(y=[S[M][0],S[M][1]],A=[S[w][0],S[w][1]]):S[0].length===3&&(y=[S[M][0],S[M][1],S[M][2]],A=[S[w][0],S[w][1],S[w][2]]),_.push(T(y,A));return _}});var Jte="intersect",Xte=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],hA=C(Jte,Xte,r=>{var{typed:e,config:t,abs:n,add:i,addScalar:a,matrix:o,multiply:u,multiplyScalar:c,divideScalar:s,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:d,isNumeric:h}=r;return e("intersect",{"Array, Array, Array":x,"Array, Array, Array, Array":b,"Matrix, Matrix, Matrix":function(N,B,R){var z=x(N.valueOf(),B.valueOf(),R.valueOf());return z===null?null:o(z)},"Matrix, Matrix, Matrix, Matrix":function(N,B,R,z){var V=b(N.valueOf(),B.valueOf(),R.valueOf(),z.valueOf());return V===null?null:o(V)}});function x(D,N,B){if(D=T(D),N=T(N),B=T(B),!S(D))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!_(B))throw new TypeError("Array with 4 numbers expected as third argument");return w(D[0],D[1],D[2],N[0],N[1],N[2],B[0],B[1],B[2],B[3])}function b(D,N,B,R){if(D=T(D),N=T(N),B=T(B),R=T(R),D.length===2){if(!v(D))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(B))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(D,N,B,R)}else if(D.length===3){if(!S(D))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!S(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!S(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return M(D[0],D[1],D[2],N[0],N[1],N[2],B[0],B[1],B[2],R[0],R[1],R[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function T(D){return D.length===1?D[0]:D.length>1&&Array.isArray(D[0])&&D.every(N=>Array.isArray(N)&&N.length===1)?m(D):D}function v(D){return D.length===2&&h(D[0])&&h(D[1])}function S(D){return D.length===3&&h(D[0])&&h(D[1])&&h(D[2])}function _(D){return D.length===4&&h(D[0])&&h(D[1])&&h(D[2])&&h(D[3])}function y(D,N,B,R){var z=D,V=B,k=l(z,N),P=l(V,R),W=l(c(k[0],P[1]),c(P[0],k[1]));if(d(W)||f(n(W),t.relTol))return null;var O=c(P[0],z[1]),X=c(P[1],z[0]),ne=c(P[0],V[1]),Z=c(P[1],V[0]),L=s(a(l(l(O,X),ne),Z),W);return i(u(k,L),z)}function A(D,N,B,R,z,V,k,P,W,O,X,ne){var Z=c(l(D,N),l(B,R)),L=c(l(z,V),l(k,P)),pe=c(l(W,O),l(X,ne));return a(a(Z,L),pe)}function M(D,N,B,R,z,V,k,P,W,O,X,ne){var Z=A(D,k,O,k,N,P,X,P,B,W,ne,W),L=A(O,k,R,D,X,P,z,N,ne,W,V,B),pe=A(D,k,R,D,N,P,z,N,B,W,V,B),me=A(O,k,O,k,X,P,X,P,ne,W,ne,W),oe=A(R,D,R,D,z,N,z,N,V,B,V,B),ve=l(c(Z,L),c(pe,me)),_e=l(c(oe,me),c(L,L));if(d(_e))return null;var ye=s(ve,_e),be=s(a(Z,c(ye,L)),me),we=a(D,c(ye,l(R,D))),Ee=a(N,c(ye,l(z,N))),ze=a(B,c(ye,l(V,B))),Qe=a(k,c(be,l(O,k))),Y=a(P,c(be,l(X,P))),Q=a(W,c(be,l(ne,W)));return p(we,Qe)&&p(Ee,Y)&&p(ze,Q)?[we,Ee,ze]:null}function w(D,N,B,R,z,V,k,P,W,O){var X=c(D,k),ne=c(R,k),Z=c(N,P),L=c(z,P),pe=c(B,W),me=c(V,W),oe=l(l(l(O,X),Z),pe),ve=l(l(l(a(a(ne,L),me),X),Z),pe),_e=s(oe,ve),ye=a(D,c(_e,l(R,D))),be=a(N,c(_e,l(z,N))),we=a(B,c(_e,l(V,B)));return[ye,be,we]}});var y4="sum",Qte=["typed","config","add","numeric"],nm=C(y4,Qte,r=>{var{typed:e,config:t,add:n,numeric:i}=r;return e(y4,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(c){if(co(c))throw new TypeError("Scalar values expected in function sum");return a(c)}});function a(u){var c;return Ti(u,function(s){try{c=c===void 0?s:n(c,s)}catch(l){throw gn(l,"sum",s)}}),c===void 0&&(c=i(0,t.number)),typeof c=="string"&&(c=i(c,Ai(c,t))),c}function o(u,c){try{var s=Fu(u,c,n);return s}catch(l){throw gn(l,"sum")}}});var Wg="cumsum",Kte=["typed","add","unaryPlus"],im=C(Wg,Kte,r=>{var{typed:e,add:t,unaryPlus:n}=r;return e(Wg,{Array:i,Matrix:function(s){return s.create(i(s.valueOf(),s.datatype()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(s,l){return s.create(o(s.valueOf(),l),s.datatype())},"...":function(s){if(co(s))throw new TypeError("All values expected to be scalar in function cumsum");return i(s)}});function i(c){try{return a(c)}catch(s){throw gn(s,Wg)}}function a(c){if(c.length===0)return[];for(var s=[n(c[0])],l=1;l<c.length;++l)s.push(t(s[l-1],c[l]));return s}function o(c,s){var l=lt(c);if(s<0||s>=l.length)throw new di(s,l.length);try{return u(c,s)}catch(f){throw gn(f,Wg)}}function u(c,s){var l,f,p;if(s<=0){var m=c[0][0];if(Array.isArray(m)){for(p=ng(c),f=[],l=0;l<p.length;l++)f[l]=u(p[l],s-1);return f}else return a(c)}else{for(f=[],l=0;l<c.length;l++)f[l]=u(c[l],s-1);return f}}});var x4="mean",ere=["typed","add","divide"],am=C(x4,ere,r=>{var{typed:e,add:t,divide:n}=r;return e(x4,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(u){if(co(u))throw new TypeError("Scalar values expected in function mean");return a(u)}});function i(o,u){try{var c=Fu(o,u,t),s=Array.isArray(o)?lt(o):o.size();return n(c,s[u])}catch(l){throw gn(l,"mean")}}function a(o){var u,c=0;if(Ti(o,function(s){try{u=u===void 0?s:t(u,s),c++}catch(l){throw gn(l,"mean",s)}}),c===0)throw new Error("Cannot calculate the mean of an empty array");return n(u,c)}});var b4="median",tre=["typed","add","divide","compare","partitionSelect"],gA=C(b4,tre,r=>{var{typed:e,add:t,divide:n,compare:i,partitionSelect:a}=r;function o(s){try{s=kt(s.valueOf());var l=s.length;if(l===0)throw new Error("Cannot calculate median of an empty array");if(l%2===0){for(var f=l/2-1,p=a(s,f+1),m=s[f],d=0;d<f;++d)i(s[d],m)>0&&(m=s[d]);return c(m,p)}else{var h=a(s,(l-1)/2);return u(h)}}catch(x){throw gn(x,"median")}}var u=e({"number | BigNumber | Complex | Unit":function(l){return l}}),c=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(l,f){return n(t(l,f),2)}});return e(b4,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,f){throw new Error("median(A, dim) is not yet supported")},"...":function(l){if(co(l))throw new TypeError("Scalar values expected in function median");return o(l)}})});var w4="mad",rre=["typed","abs","map","median","subtract"],vA=C(w4,rre,r=>{var{typed:e,abs:t,map:n,median:i,subtract:a}=r;return e(w4,{"Array | Matrix":o,"...":function(c){return o(c)}});function o(u){if(u=kt(u.valueOf()),u.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var c=i(u);return i(n(u,function(s){return t(a(s,c))}))}catch(s){throw s instanceof TypeError&&s.message.includes("median")?new TypeError(s.message.replace("median","mad")):gn(s,"mad")}}});var yA="unbiased",_4="variance",nre=["typed","add","subtract","multiply","divide","apply","isNaN"],om=C(_4,nre,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:u}=r;return e(_4,{"Array | Matrix":function(f){return c(f,yA)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(f,p){return s(f,p,yA)},"Array | Matrix, number | BigNumber, string":s,"...":function(f){return c(f,yA)}});function c(l,f){var p,m=0;if(l.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Ti(l,function(x){try{p=p===void 0?x:t(p,x),m++}catch(b){throw gn(b,"variance",x)}}),m===0)throw new Error("Cannot calculate variance of an empty array");var d=a(p,m);if(p=void 0,Ti(l,function(x){var b=n(x,d);p=p===void 0?i(b,b):t(p,i(b,b))}),u(p))return p;switch(f){case"uncorrected":return a(p,m);case"biased":return a(p,m+1);case"unbiased":{var h=ut(p)?p.mul(0):0;return m===1?h:a(p,m-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function s(l,f,p){try{if(l.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(l,f,m=>c(m,p))}catch(m){throw gn(m,"variance")}}});var S4="quantileSeq",ire=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],sm=C(S4,ire,r=>{var{typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:c,isInteger:s,smaller:l,smallerEq:f,larger:p}=r,m=Il({typed:e,isInteger:s});return e(S4,{"Array | Matrix, number | BigNumber":(T,v)=>h(T,v,!1),"Array | Matrix, number | BigNumber, number":(T,v,S)=>d(T,v,!1,S,h),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(T,v,S,_)=>d(T,v,S,_,h),"Array | Matrix, Array | Matrix":(T,v)=>x(T,v,!1),"Array | Matrix, Array | Matrix, number":(T,v,S)=>d(T,v,!1,S,x),"Array | Matrix, Array | Matrix, boolean":x,"Array | Matrix, Array | Matrix, boolean, number":(T,v,S,_)=>d(T,v,S,_,x)});function d(T,v,S,_,y){return m(T,_,A=>y(A,v,S))}function h(T,v,S){var _,y=T.valueOf();if(l(v,0))throw new Error("N/prob must be non-negative");if(f(v,1))return xt(v)?b(y,v,S):t(b(y,v,S));if(p(v,1)){if(!s(v))throw new Error("N must be a positive integer");if(p(v,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var A=n(v,1);_=[];for(var M=0;l(M,v);M++){var w=a(M+1,A);_.push(b(y,w,S))}return xt(v)?_:t(_)}}function x(T,v,S){for(var _=T.valueOf(),y=v.valueOf(),A=[],M=0;M<y.length;++M)A.push(b(_,y[M],S));return A}function b(T,v,S){var _=kt(T),y=_.length;if(y===0)throw new Error("Cannot calculate quantile of an empty sequence");var A=xt(v)?v*(y-1):v.times(y-1),M=xt(v)?Math.floor(A):A.floor().toNumber(),w=xt(v)?A%1:A.minus(M);if(s(A))return S?_[A]:u(_,xt(v)?A:A.valueOf());var D,N;if(S)D=_[M],N=_[M+1];else{N=u(_,M+1),D=_[M];for(var B=0;B<M;++B)c(_[B],D)>0&&(D=_[B])}return n(o(D,i(1,w)),o(N,w))}});var A4="std",are=["typed","map","sqrt","variance"],um=C(A4,are,r=>{var{typed:e,map:t,sqrt:n,variance:i}=r;return e(A4,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(u){return a(u)}});function a(o,u){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var c=i.apply(null,arguments);return bn(c)?t(c,n):n(c)}catch(s){throw s instanceof TypeError&&s.message.includes(" variance")?new TypeError(s.message.replace(" variance"," std")):s}}});var E4="corr",ore=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],xA=C(E4,ore,r=>{var{typed:e,matrix:t,sqrt:n,sum:i,add:a,subtract:o,multiply:u,pow:c,divide:s}=r;return e(E4,{"Array, Array":function(m,d){return l(m,d)},"Matrix, Matrix":function(m,d){var h=l(m.toArray(),d.toArray());return Array.isArray(h)?t(h):h}});function l(p,m){var d=[];if(Array.isArray(p[0])&&Array.isArray(m[0])){if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var h=0;h<p.length;h++){if(p[h].length!==m[h].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");d.push(f(p[h],m[h]))}return d}else{if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(p,m)}}function f(p,m){var d=p.length,h=i(p),x=i(m),b=p.reduce((y,A,M)=>a(y,u(A,m[M])),0),T=i(p.map(y=>c(y,2))),v=i(m.map(y=>c(y,2))),S=o(u(d,b),u(h,x)),_=n(u(o(u(d,T),c(h,2)),o(u(d,v),c(x,2))));return s(S,_)}});var T4="combinations",sre=["typed"],bA=C(T4,sre,r=>{var{typed:e}=r;return e(T4,{"number, number":z0,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,u,c=n.minus(i),s=new a(1);if(!M4(n)||!M4(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=s,i.lt(c))for(u=s;u.lte(c);u=u.plus(s))o=o.times(i.plus(u)).dividedBy(u);else for(u=s;u.lte(i);u=u.plus(s))o=o.times(c.plus(u)).dividedBy(u);return o}})});function M4(r){return r.isInteger()&&r.gte(0)}var D4="combinationsWithRep",ure=["typed"],wA=C(D4,ure,r=>{var{typed:e}=r;return e(D4,{"number, number":function(n,i){if(!Je(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Je(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=Fa(n,n+i-1);return a/Fa(1,i)}var o=Fa(i+1,n+i-1);return o/Fa(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,u,c=new a(1),s=n.minus(c);if(!C4(n)||!C4(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(c))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=c,i.lt(s))for(u=c;u.lte(s);u=u.plus(c))o=o.times(i.plus(u)).dividedBy(u);else for(u=c;u.lte(i);u=u.plus(c))o=o.times(s.plus(u)).dividedBy(u);return o}})});function C4(r){return r.isInteger()&&r.gte(0)}var N4="gamma",lre=["typed","config","multiplyScalar","pow","BigNumber","Complex"],_A=C(N4,lre,r=>{var{typed:e,config:t,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=r;function u(s){if(s.im===0)return Bp(s.re);if(s.re<.5){var l=new o(1-s.re,-s.im),f=new o(Math.PI*s.re,Math.PI*s.im);return new o(Math.PI).div(f.sin()).div(u(l))}s=new o(s.re-1,s.im);for(var p=new o(Fl[0],0),m=1;m<Fl.length;++m){var d=new o(Fl[m],0);p=p.add(d.div(s.add(m)))}var h=new o(s.re+W0+.5,s.im),x=Math.sqrt(2*Math.PI),b=h.pow(s.add(.5)),T=h.neg().exp();return p.mul(x).mul(b).mul(T)}return e(N4,{number:Bp,Complex:u,BigNumber:function(l){if(l.isInteger())return l.isNegative()||l.isZero()?new a(1/0):c(l.minus(1));if(!l.isFinite())return new a(l.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function c(s){if(s<8)return new a([1,1,2,6,24,120,720,5040][s]);var l=t.precision+(Math.log(s.toNumber())|0),f=a.clone({precision:l});if(s%2===1)return s.times(c(new a(s-1)));for(var p=s,m=new f(s),d=s.toNumber();p>2;)p-=2,d+=p,m=m.times(d);return new a(m.toPrecision(a.precision))}});var F4="lgamma",cre=["Complex","typed"],SA=C(F4,cre,r=>{var{Complex:e,typed:t}=r,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(F4,{number:kp,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(s){var l=6.283185307179586,f=1.1447298858494002,p=.1;if(s.isNaN())return new e(NaN,NaN);if(s.im===0)return new e(kp(s.re),0);if(s.re>=n||Math.abs(s.im)>=i)return u(s);if(s.re<=p){var m=p2(l,s.im)*Math.floor(.5*s.re+.25),d=s.mul(Math.PI).sin().log(),h=o(new e(1-s.re,-s.im));return new e(f,m).sub(d).sub(h)}else return s.im>=0?c(s):c(s.conjugate()).conjugate()}function u(s){for(var l=s.sub(.5).mul(s.log()).sub(s).add(Y0),f=new e(1,0).div(s),p=f.div(s),m=a[0],d=a[1],h=2*p.re,x=p.re*p.re+p.im*p.im,b=2;b<8;b++){var T=d;d=-x*m+a[b],m=h*m+T}var v=f.mul(p.mul(m).add(d));return l.add(v)}function c(s){var l=0,f=0,p=s;for(s=s.add(1);s.re<=n;){p=p.mul(s);var m=p.im<0?1:0;m!==0&&f===0&&l++,f=m,s=s.add(1)}return u(s).sub(p.log()).sub(new e(0,l*2*Math.PI*1))}});var I4="factorial",fre=["typed","gamma"],AA=C(I4,fre,r=>{var{typed:e,gamma:t}=r;return e(I4,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return t(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return t(i.plus(1))},"Array | Matrix":e.referToSelf(n=>i=>rt(i,n))})});var P4="kldivergence",pre=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],EA=C(P4,pre,r=>{var{typed:e,matrix:t,divide:n,sum:i,multiply:a,map:o,dotDivide:u,log:c,isNumeric:s}=r;return e(P4,{"Array, Array":function(p,m){return l(t(p),t(m))},"Matrix, Array":function(p,m){return l(p,t(m))},"Array, Matrix":function(p,m){return l(t(p),m)},"Matrix, Matrix":function(p,m){return l(p,m)}});function l(f,p){var m=p.size().length,d=f.size().length;if(m>1)throw new Error("first object must be one dimensional");if(d>1)throw new Error("second object must be one dimensional");if(m!==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(p);if(x===0)throw new Error("Sum of elements in second object must be non zero");var b=n(f,i(f)),T=n(p,i(p)),v=i(a(b,o(u(b,T),S=>c(S))));return s(v)?v:Number.NaN}});var B4="multinomial",mre=["typed","add","divide","multiply","factorial","isInteger","isPositive"],TA=C(B4,mre,r=>{var{typed:e,add:t,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:u}=r;return e(B4,{"Array | Matrix":function(s){var l=0,f=1;return Ti(s,function(p){if(!o(p)||!u(p))throw new TypeError("Positive integer value expected in function multinomial");l=t(l,p),f=i(f,a(p))}),n(a(l),f)}})});var k4="permutations",dre=["typed","factorial"],MA=C(k4,dre,r=>{var{typed:e,factorial:t}=r;return e(k4,{"number | BigNumber":t,"number, number":function(i,a){if(!Je(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!Je(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 Fa(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,u;if(!$4(i)||!$4(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 c=i.mul(0).add(1);for(o=c,u=i.minus(a).plus(1);u.lte(i);u=u.plus(1))o=o.times(u);return o}})});function $4(r){return r.isInteger()&&r.gte(0)}var BA=Or(Q4(),1),wre=(0,BA.default)(Date.now());function Hs(r){var e;function t(i){e=i===null?wre:(0,BA.default)(String(i))}t(r);function n(){return e()}return n}var K4="pickRandom",_re=["typed","config","?on"],kA=C(K4,_re,r=>{var{typed:e,config:t,on:n}=r,i=Hs(t.randomSeed);return n&&n("config",function(o,u){o.randomSeed!==u.randomSeed&&(i=Hs(o.randomSeed))}),e(K4,{"Array | Matrix":function(u){return a(u,{})},"Array | Matrix, Object":function(u,c){return a(u,c)},"Array | Matrix, number":function(u,c){return a(u,{number:c})},"Array | Matrix, Array | Matrix":function(u,c){return a(u,{weights:c})},"Array | Matrix, Array | Matrix, number":function(u,c,s){return a(u,{number:s,weights:c})},"Array | Matrix, number, Array | Matrix":function(u,c,s){return a(u,{number:c,weights:s})}});function a(o,u){var{number:c,weights:s,elementWise:l=!0}=u,f=typeof c>"u";f&&(c=1);var p=et(o)?o.create:et(s)?s.create:null;o=o.valueOf(),s&&(s=s.valueOf()),l===!0&&(o=kt(o),s=kt(s));var m=0;if(typeof s<"u"){if(s.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var d=0,h=s.length;d<h;d++){if(!xt(s[d])||s[d]<0)throw new Error("Weights must be an array of positive numbers");m+=s[d]}}for(var x=o.length,b=[],T;b.length<c;){if(typeof s>"u")T=o[Math.floor(i()*x)];else for(var v=i()*m,S=0,_=o.length;S<_;S++)if(v-=s[S],v<0){T=o[S];break}b.push(T)}return f?b[0]:p?p(b):b}});function lm(r,e){var t=[];if(r=r.slice(0),r.length>1)for(var n=0,i=r.shift();n<i;n++)t.push(lm(r,e));else for(var a=0,o=r.shift();a<o;a++)t.push(e());return t}var eV="random",Sre=["typed","config","?on"],$A=C(eV,Sre,r=>{var{typed:e,config:t,on:n}=r,i=Hs(t.randomSeed);return n&&n("config",function(u,c){u.randomSeed!==c.randomSeed&&(i=Hs(u.randomSeed))}),e(eV,{"":()=>o(0,1),number:u=>o(0,u),"number, number":(u,c)=>o(u,c),"Array | Matrix":u=>a(u,0,1),"Array | Matrix, number":(u,c)=>a(u,0,c),"Array | Matrix, number, number":(u,c,s)=>a(u,c,s)});function a(u,c,s){var l=lm(u.valueOf(),()=>o(c,s));return et(u)?u.create(l,"number"):l}function o(u,c){return u+i()*(c-u)}});var tV="randomInt",Are=["typed","config","?on"],OA=C(tV,Are,r=>{var{typed:e,config:t,on:n}=r,i=Hs(t.randomSeed);return n&&n("config",function(u,c){u.randomSeed!==c.randomSeed&&(i=Hs(u.randomSeed))}),e(tV,{"":()=>o(0,1),number:u=>o(0,u),"number, number":(u,c)=>o(u,c),"Array | Matrix":u=>a(u,0,1),"Array | Matrix, number":(u,c)=>a(u,0,c),"Array | Matrix, number, number":(u,c,s)=>a(u,c,s)});function a(u,c,s){var l=lm(u.valueOf(),()=>o(c,s));return et(u)?u.create(l,"number"):l}function o(u,c){return Math.floor(u+i()*(c-u))}});var rV="stirlingS2",Ere=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],RA=C(rV,Ere,r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:u,combinations:c,isNegative:s,isInteger:l,number:f,bignumber:p,larger:m}=r,d=[],h=[];return e(rV,{"number | BigNumber, number | BigNumber":function(b,T){if(!l(b)||s(b)||!l(T)||s(T))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(T,b))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(xt(b)&&xt(T)),S=v?h:d,_=v?p:f,y=f(b),A=f(T);if(S[y]&&S[y].length>A)return S[y][A];for(var M=0;M<=y;++M)if(S[M]||(S[M]=[_(M===0?1:0)]),M!==0)for(var w=S[M],D=S[M-1],N=w.length;N<=M&&N<=A;++N)N===M?w[N]=1:w[N]=t(i(_(N),D[N]),D[N-1]);return S[y][A]}})});var nV="bellNumbers",Tre=["typed","addScalar","isNegative","isInteger","stirlingS2"],LA=C(nV,Tre,r=>{var{typed:e,addScalar:t,isNegative:n,isInteger:i,stirlingS2:a}=r;return e(nV,{"number | BigNumber":function(u){if(!i(u)||n(u))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var c=0,s=0;s<=u;s++)c=t(c,a(u,s));return c}})});var iV="catalan",Mre=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],VA=C(iV,Mre,r=>{var{typed:e,addScalar:t,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:u}=r;return e(iV,{"number | BigNumber":function(s){if(!u(s)||o(s))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(s,2),s),t(s,1))}})});var aV="composition",Dre=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],UA=C(aV,Dre,r=>{var{typed:e,addScalar:t,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:u}=r;return e(aV,{"number | BigNumber, number | BigNumber":function(s,l){if(!o(s)||!i(s)||!o(l)||!i(l))throw new TypeError("Positive integer value expected in function composition");if(u(l,s))throw new TypeError("k must be less than or equal to n in function composition");return n(t(s,-1),t(l,-1))}})});var oV="leafCount",Cre=["parse","typed"],qA=C(oV,Cre,r=>{var{parse:e,typed:t}=r;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return t(oV,{Node:function(a){return n(a)}})});function zA(r){return qt(r)||Wr(r)&&r.isUnary()&&qt(r.args[0])}function cm(r){return!!(qt(r)||(Gi(r)||Wr(r))&&r.args.every(cm)||pi(r)&&cm(r.content))}function sV(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function HA(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sV(Object(t),!0).forEach(function(n){wr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sV(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Nre="simplifyUtil",Fre=["FunctionNode","OperatorNode","SymbolNode"],pf=C(Nre,Fre,r=>{var{FunctionNode:e,OperatorNode:t,SymbolNode:n}=r,i=!0,a=!1,o="defaultF",u={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}},c={divide:{total:a},log:{total:a}},s={subtract:{total:a},abs:{trivial:i},log:{total:i}};function l(v,S){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u,y=o;if(typeof v=="string"?y=v:Wr(v)?y=v.fn.toString():Gi(v)?y=v.name:pi(v)&&(y="paren"),it(_,y)){var A=_[y];if(it(A,S))return A[S];if(it(u,y))return u[y][S]}if(it(_,o)){var M=_[o];return it(M,S)?M[S]:u[o][S]}if(it(u,y)){var w=u[y];if(it(w,S))return w[S]}return u[o][S]}function f(v){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l(v,"commutative",S)}function p(v){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return l(v,"associative",S)}function m(v,S){var _=HA({},v);for(var y in S)it(v,y)?_[y]=HA(HA({},S[y]),v[y]):_[y]=S[y];return _}function d(v,S){if(!v.args||v.args.length===0)return v;v.args=h(v,S);for(var _=0;_<v.args.length;_++)d(v.args[_],S)}function h(v,S){var _,y=[],A=function(w){for(var D=0;D<w.args.length;D++){var N=w.args[D];Wr(N)&&_===N.op?A(N):y.push(N)}};return p(v,S)?(_=v.op,A(v),y):v.args}function x(v,S){if(!(!v.args||v.args.length===0)){for(var _=T(v),y=v.args.length,A=0;A<y;A++)x(v.args[A],S);if(y>2&&p(v,S)){for(var M=v.args.pop();v.args.length>0;)M=_([v.args.pop(),M]);v.args=M.args}}}function b(v,S){if(!(!v.args||v.args.length===0)){for(var _=T(v),y=v.args.length,A=0;A<y;A++)b(v.args[A],S);if(y>2&&p(v,S)){for(var M=v.args.shift();v.args.length>0;)M=_([M,v.args.shift()]);v.args=M.args}}}function T(v){return Wr(v)?function(S){try{return new t(v.op,v.fn,S,v.implicit)}catch(_){return console.error(_),[]}}:function(S){return new e(new n(v.name),S)}}return{createMakeNodeFunction:T,hasProperty:l,isCommutative:f,isAssociative:p,mergeContext:m,flatten:d,allChildren:h,unflattenr:x,unflattenl:b,defaultContext:u,realContext:c,positiveContext:s}});var Ire="simplify",Pre=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],GA=C(Ire,Pre,r=>{var{config:e,typed:t,parse:n,add:i,subtract:a,multiply:o,divide:u,pow:c,isZero:s,equal:l,resolve:f,simplifyConstant:p,simplifyCore:m,fraction:d,bignumber:h,mathWithTransform:x,matrix:b,AccessorNode:T,ArrayNode:v,ConstantNode:S,FunctionNode:_,IndexNode:y,ObjectNode:A,OperatorNode:M,ParenthesisNode:w,SymbolNode:D}=r,{hasProperty:N,isCommutative:B,isAssociative:R,mergeContext:z,flatten:V,unflattenr:k,unflattenl:P,createMakeNodeFunction:W,defaultContext:O,realContext:X,positiveContext:ne}=pf({FunctionNode:_,OperatorNode:M,SymbolNode:D});t.addConversion({from:"Object",to:"Map",convert:$s});var Z=t("simplify",{Node:ye,"Node, Map":(J,re)=>ye(J,!1,re),"Node, Map, Object":(J,re,se)=>ye(J,!1,re,se),"Node, Array":ye,"Node, Array, Map":ye,"Node, Array, Map, Object":ye});t.removeConversion({from:"Object",to:"Map",convert:$s}),Z.defaultContext=O,Z.realContext=X,Z.positiveContext=ne;function L(J){return J.transform(function(re,se,Ae){return pi(re)?L(re.content):re})}var pe={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};Z.rules=[m,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd   * ( vd   * n1 + n2)",r:"vd^2       * n1 +  vd   * n2"},{s:" vd   * (vd^n4 * n1 + n2)   ->  vd^(1+n4)  * n1 +  vd   * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd   * n1 + n2)   ->  vd^(n3+1)  * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2)   ->  vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 +   n3  * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3    -> (n1 + n2*n3^(n4 +  1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},p,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function me(J,re){var se={};if(J.s){var Ae=J.s.split("->");if(Ae.length===2)se.l=Ae[0],se.r=Ae[1];else throw SyntaxError("Could not parse rule: "+J.s)}else se.l=J.l,se.r=J.r;se.l=L(n(se.l)),se.r=L(n(se.r));for(var Te of["imposeContext","repeat","assuming"])Te in J&&(se[Te]=J[Te]);if(J.evaluate&&(se.evaluate=n(J.evaluate)),R(se.l,re)){var qe=!B(se.l,re),Se;qe&&(Se=_e());var wt=W(se.l),Dt=_e();se.expanded={},se.expanded.l=wt([se.l,Dt]),V(se.expanded.l,re),k(se.expanded.l,re),se.expanded.r=wt([se.r,Dt]),qe&&(se.expandedNC1={},se.expandedNC1.l=wt([Se,se.l]),se.expandedNC1.r=wt([Se,se.r]),se.expandedNC2={},se.expandedNC2.l=wt([Se,se.expanded.l]),se.expandedNC2.r=wt([Se,se.expanded.r]))}return se}function oe(J,re){for(var se=[],Ae=0;Ae<J.length;Ae++){var Te=J[Ae],qe=void 0,Se=typeof Te;switch(Se){case"string":Te={s:Te};case"object":qe=me(Te,re);break;case"function":qe=Te;break;default:throw TypeError("Unsupported type of rule: "+Se)}se.push(qe)}return se}var ve=0;function _e(){return new D("_p"+ve++)}function ye(J,re){var se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Su(),Ae=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Te=Ae.consoleDebug;re=oe(re||Z.rules,Ae.context);var qe=f(J,se);qe=L(qe);for(var Se={},wt=qe.toString({parenthesis:"all"});!Se[wt];){Se[wt]=!0,ve=0;var Dt=wt;Te&&console.log("Working on: ",wt);for(var jt=0;jt<re.length;jt++){var Tt="";if(typeof re[jt]=="function"?(qe=re[jt](qe,Ae),Te&&(Tt=re[jt].name)):(V(qe,Ae.context),qe=we(qe,re[jt],Ae.context),Te&&(Tt="".concat(re[jt].l.toString()," -> ").concat(re[jt].r.toString()))),Te){var j=qe.toString({parenthesis:"all"});j!==Dt&&(console.log("Applying",Tt,"produced",j),Dt=j)}P(qe,Ae.context)}wt=qe.toString({parenthesis:"all"})}return qe}function be(J,re,se){var Ae=J;if(J)for(var Te=0;Te<J.length;++Te){var qe=we(J[Te],re,se);qe!==J[Te]&&(Ae===J&&(Ae=J.slice()),Ae[Te]=qe)}return Ae}function we(J,re,se){if(re.assuming){for(var Ae in re.assuming)for(var Te in re.assuming[Ae])if(N(Ae,Te,se)!==re.assuming[Ae][Te])return J}var qe=z(re.imposeContext,se),Se=J;if(Se instanceof M||Se instanceof _){var wt=be(Se.args,re,se);wt!==Se.args&&(Se=Se.clone(),Se.args=wt)}else if(Se instanceof w){if(Se.content){var Dt=we(Se.content,re,se);Dt!==Se.content&&(Se=new w(Dt))}}else if(Se instanceof v){var jt=be(Se.items,re,se);jt!==Se.items&&(Se=new v(jt))}else if(Se instanceof T){var Tt=Se.object;Se.object&&(Tt=we(Se.object,re,se));var j=Se.index;Se.index&&(j=we(Se.index,re,se)),(Tt!==Se.object||j!==Se.index)&&(Se=new T(Tt,j))}else if(Se instanceof y){var le=be(Se.dimensions,re,se);le!==Se.dimensions&&(Se=new y(le))}else if(Se instanceof A){var fe=!1,Pe={};for(var ke in Se.properties)Pe[ke]=we(Se.properties[ke],re,se),Pe[ke]!==Se.properties[ke]&&(fe=!0);fe&&(Se=new A(Pe))}var Fe=re.r,$e=Q(re.l,Se,qe)[0];if(!$e&&re.expanded&&(Fe=re.expanded.r,$e=Q(re.expanded.l,Se,qe)[0]),!$e&&re.expandedNC1&&(Fe=re.expandedNC1.r,$e=Q(re.expandedNC1.l,Se,qe)[0],$e||(Fe=re.expandedNC2.r,$e=Q(re.expandedNC2.l,Se,qe)[0])),$e){var He=Se.implicit;Se=Fe.clone(),He&&"implicit"in Fe&&(Se.implicit=!0),Se=Se.transform(function(F){return F.isSymbolNode&&it($e.placeholders,F.name)?$e.placeholders[F.name].clone():F})}return re.repeat&&Se!==J&&(Se=we(Se,re,se)),Se}function Ee(J,re){var se=[],Ae,Te,qe=W(J);if(B(J,re))for(var Se=0;Se<J.args.length;Se++)Te=J.args.slice(0),Te.splice(Se,1),Ae=Te.length===1?Te[0]:qe(Te),se.push(qe([J.args[Se],Ae]));else for(var wt=1;wt<J.args.length;wt++){var Dt=J.args[0];wt>1&&(Dt=qe(J.args.slice(0,wt))),Te=J.args.slice(wt),Ae=Te.length===1?Te[0]:qe(Te),se.push(qe([Dt,Ae]))}return se}function ze(J,re){var se={placeholders:{}};if(!J.placeholders&&!re.placeholders)return se;if(J.placeholders){if(!re.placeholders)return J}else return re;for(var Ae in J.placeholders)if(it(J.placeholders,Ae)&&(se.placeholders[Ae]=J.placeholders[Ae],it(re.placeholders,Ae)&&!xe(J.placeholders[Ae],re.placeholders[Ae])))return null;for(var Te in re.placeholders)it(re.placeholders,Te)&&(se.placeholders[Te]=re.placeholders[Te]);return se}function Qe(J,re){var se=[];if(J.length===0||re.length===0)return se;for(var Ae,Te=0;Te<J.length;Te++)for(var qe=0;qe<re.length;qe++)Ae=ze(J[Te],re[qe]),Ae&&se.push(Ae);return se}function Y(J){if(J.length===0)return J;for(var re=J.reduce(Qe),se=[],Ae={},Te=0;Te<re.length;Te++){var qe=JSON.stringify(re[Te]);Ae[qe]||(Ae[qe]=!0,se.push(re[Te]))}return se}function Q(J,re,se,Ae){var Te=[{placeholders:{}}];if(J instanceof M&&re instanceof M||J instanceof _&&re instanceof _){if(J instanceof M){if(J.op!==re.op||J.fn!==re.fn)return[]}else if(J instanceof _&&J.name!==re.name)return[];if(re.args.length===1&&J.args.length===1||!R(re,se)&&re.args.length===J.args.length||Ae){for(var qe=[],Se=0;Se<J.args.length;Se++){var wt=Q(J.args[Se],re.args[Se],se);if(wt.length===0)break;qe.push(wt)}if(qe.length!==J.args.length){if(!B(re,se)||J.args.length===1)return[];if(J.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Dt=Q(J.args[0],re.args[1],se);if(Dt.length===0)return[];var jt=Q(J.args[1],re.args[0],se);if(jt.length===0)return[];qe=[Dt,jt]}Te=Y(qe)}else if(re.args.length>=2&&J.args.length===2){for(var Tt=Ee(re,se),j=[],le=0;le<Tt.length;le++){var fe=Q(J,Tt[le],se,!0);j=j.concat(fe)}return j}else{if(J.args.length>2)throw Error("Unexpected non-binary associative function: "+J.toString());return[]}}else if(J instanceof D){if(J.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(pe[J.name]){if(J.name!==re.name)return[]}else switch(J.name[1]>="a"&&J.name[1]<="z"?J.name.substring(0,2):J.name[0]){case"n":case"_p":Te[0].placeholders[J.name]=re;break;case"c":case"cl":if(qt(re))Te[0].placeholders[J.name]=re;else return[];break;case"v":if(!qt(re))Te[0].placeholders[J.name]=re;else return[];break;case"vl":if(Ur(re))Te[0].placeholders[J.name]=re;else return[];break;case"cd":if(zA(re))Te[0].placeholders[J.name]=re;else return[];break;case"vd":if(!zA(re))Te[0].placeholders[J.name]=re;else return[];break;case"ce":if(cm(re))Te[0].placeholders[J.name]=re;else return[];break;case"ve":if(!cm(re))Te[0].placeholders[J.name]=re;else return[];break;default:throw new Error("Invalid symbol in rule: "+J.name)}}else if(J instanceof S){if(!l(J.value,re.value))return[]}else return[];return Te}function xe(J,re){if(J instanceof S&&re instanceof S){if(!l(J.value,re.value))return!1}else if(J instanceof D&&re instanceof D){if(J.name!==re.name)return!1}else if(J instanceof M&&re instanceof M||J instanceof _&&re instanceof _){if(J instanceof M){if(J.op!==re.op||J.fn!==re.fn)return!1}else if(J instanceof _&&J.name!==re.name)return!1;if(J.args.length!==re.args.length)return!1;for(var se=0;se<J.args.length;se++)if(!xe(J.args[se],re.args[se]))return!1}else return!1;return!0}return Z});var Bre="simplifyConstant",kre=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],WA=C(Bre,kre,r=>{var{typed:e,config:t,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:u,ArrayNode:c,ConstantNode:s,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:d}=r,{isCommutative:h,isAssociative:x,allChildren:b,createMakeNodeFunction:T}=pf({FunctionNode:l,OperatorNode:m,SymbolNode:d}),v=e("simplifyConstant",{Node:V=>A(z(V,{})),"Node, Object":function(k,P){return A(z(k,P))}});function S(V){return Os(V)?V.valueOf():V instanceof Array?V.map(S):et(V)?i(S(V.valueOf())):V}function _(V,k,P){try{return n[V].apply(null,k)}catch{return k=k.map(S),w(n[V].apply(null,k),P)}}var y=e({Fraction:N,number:function(k){return k<0?D(new s(-k)):new s(k)},BigNumber:function(k){return k<0?D(new s(-k)):new s(k)},bigint:function(k){return k<0n?D(new s(-k)):new s(k)},Complex:function(k){throw new Error("Cannot convert Complex number to Node")},string:function(k){return new s(k)},Matrix:function(k){return new c(k.valueOf().map(P=>y(P)))}});function A(V){return tr(V)?V:y(V)}function M(V,k){var P=k&&k.exactFractions!==!1;if(P&&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 w=e({"string, Object":function(k,P){var W=Ai(k,t);if(W==="BigNumber")return o===void 0&&of(),o(k);if(W==="bigint")return BigInt(k);if(W==="Fraction")return a===void 0&&mg(),a(k);var O=parseFloat(k);return M(O,P)},"Fraction, Object":function(k,P){return k},"BigNumber, Object":function(k,P){return k},"number, Object":function(k,P){return M(k,P)},"bigint, Object":function(k,P){return k},"Complex, Object":function(k,P){return k.im!==0?k:M(k.re,P)},"Matrix, Object":function(k,P){return i(M(k.valueOf()))},"Array, Object":function(k,P){return k.map(M)}});function D(V){return new m("-","unaryMinus",[V])}function N(V){var k,P=V.s*V.n;return P<0?k=new m("-","unaryMinus",[new s(-P)]):k=new s(P),V.d===1?k:new m("/","divide",[k,new s(V.d)])}function B(V,k,P){if(!oo(k))return new u(A(V),A(k));if(fi(V)||et(V)){for(var W=Array.from(k.dimensions);W.length>0;)if(qt(W[0])&&typeof W[0].value!="string"){var O=w(W.shift().value,P);fi(V)?V=V.items[O-1]:(V=V.valueOf()[O-1],V instanceof Array&&(V=i(V)))}else if(W.length>1&&qt(W[1])&&typeof W[1].value!="string"){var X=w(W[1].value,P),ne=[],Z=fi(V)?V.items:V.valueOf();for(var L of Z)if(fi(L))ne.push(L.items[X-1]);else if(et(V))ne.push(L[X-1]);else break;if(ne.length===Z.length)fi(V)?V=new c(ne):V=i(ne),W.splice(1,1);else break}else break;return W.length===k.dimensions.length?new u(A(V),k):W.length>0?(k=new f(W),new u(A(V),k)):V}if(Tu(V)&&k.dimensions.length===1&&qt(k.dimensions[0])){var pe=k.dimensions[0].value;return pe in V.properties?V.properties[pe]:new s}return new u(A(V),k)}function R(V,k,P,W){var O=k.shift(),X=k.reduce((ne,Z)=>{if(!tr(Z)){var L=ne.pop();if(tr(L))return[L,Z];try{return ne.push(_(V,[L,Z],W)),ne}catch{ne.push(L)}}ne.push(A(ne.pop()));var pe=ne.length===1?ne[0]:P(ne);return[P([pe,A(Z)])]},[O]);return X.length===1?X[0]:P([X[0],y(X[1])])}function z(V,k){switch(V.type){case"SymbolNode":return V;case"ConstantNode":switch(typeof V.value){case"number":return w(V.value,k);case"bigint":return w(V.value,k);case"string":return V.value;default:if(!isNaN(V.value))return w(V.value,k)}return V;case"FunctionNode":if(n[V.name]&&n[V.name].rawArgs)return V;{var P=["add","multiply"];if(!P.includes(V.name)){var W=V.args.map(we=>z(we,k));if(!W.some(tr))try{return _(V.name,W,k)}catch{}if(V.name==="size"&&W.length===1&&fi(W[0])){for(var O=[],X=W[0];fi(X);)O.push(X.items.length),X=X.items[0];return i(O)}return new l(V.name,W.map(A))}}case"OperatorNode":{var ne=V.fn.toString(),Z,L,pe=T(V);if(Wr(V)&&V.isUnary())Z=[z(V.args[0],k)],tr(Z[0])?L=pe(Z):L=_(ne,Z,k);else if(x(V,k.context))if(Z=b(V,k.context),Z=Z.map(we=>z(we,k)),h(ne,k.context)){for(var me=[],oe=[],ve=0;ve<Z.length;ve++)tr(Z[ve])?oe.push(Z[ve]):me.push(Z[ve]);me.length>1?(L=R(ne,me,pe,k),oe.unshift(L),L=R(ne,oe,pe,k)):L=R(ne,Z,pe,k)}else L=R(ne,Z,pe,k);else Z=V.args.map(we=>z(we,k)),L=R(ne,Z,pe,k);return L}case"ParenthesisNode":return z(V.content,k);case"AccessorNode":return B(z(V.object,k),z(V.index,k),k);case"ArrayNode":{var _e=V.items.map(we=>z(we,k));return _e.some(tr)?new c(_e.map(A)):i(_e)}case"IndexNode":return new f(V.dimensions.map(we=>v(we,k)));case"ObjectNode":{var ye={};for(var be in V.properties)ye[be]=v(V.properties[be],k);return new p(ye)}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 uV="simplifyCore",$re=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],YA=C(uV,$re,r=>{var{typed:e,parse:t,equal:n,isZero:i,add:a,subtract:o,multiply:u,divide:c,pow:s,AccessorNode:l,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:d,ObjectNode:h,OperatorNode:x,ParenthesisNode:b,SymbolNode:T}=r,v=new p(0),S=new p(1),_=new p(!0),y=new p(!1);function A(N){return Wr(N)&&["and","not","or"].includes(N.op)}var{hasProperty:M,isCommutative:w}=pf({FunctionNode:m,OperatorNode:x,SymbolNode:T});function D(N){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=B?B.context:void 0;if(M(N,"trivial",R)){if(Gi(N)&&N.args.length===1)return D(N.args[0],B);var z=!1,V=0;if(N.forEach(oe=>{++V,V===1&&(z=D(oe,B))}),V===1)return z}var k=N;if(Gi(k)){var P=a$(k.name);if(P){if(k.args.length>2&&M(k,"associative",R))for(;k.args.length>2;){var W=k.args.pop(),O=k.args.pop();k.args.push(new x(P,k.name,[W,O]))}k=new x(P,k.name,k.args)}else return new m(D(k.fn),k.args.map(oe=>D(oe,B)))}if(Wr(k)&&k.isUnary()){var X=D(k.args[0],B);if(k.op==="~"&&Wr(X)&&X.isUnary()&&X.op==="~"||k.op==="not"&&Wr(X)&&X.isUnary()&&X.op==="not"&&A(X.args[0]))return X.args[0];var ne=!0;if(k.op==="-"&&Wr(X)&&(X.isBinary()&&X.fn==="subtract"&&(k=new x("-","subtract",[X.args[1],X.args[0]]),ne=!1),X.isUnary()&&X.op==="-"))return X.args[0];if(ne)return new x(k.op,k.fn,[X])}if(Wr(k)&&k.isBinary()){var Z=D(k.args[0],B),L=D(k.args[1],B);if(k.op==="+"){if(qt(Z)&&i(Z.value))return L;if(qt(L)&&i(L.value))return Z;Wr(L)&&L.isUnary()&&L.op==="-"&&(L=L.args[0],k=new x("-","subtract",[Z,L]))}if(k.op==="-")return Wr(L)&&L.isUnary()&&L.op==="-"?D(new x("+","add",[Z,L.args[0]]),B):qt(Z)&&i(Z.value)?D(new x("-","unaryMinus",[L])):qt(L)&&i(L.value)?Z:new x(k.op,k.fn,[Z,L]);if(k.op==="*"){if(qt(Z)){if(i(Z.value))return v;if(n(Z.value,1))return L}if(qt(L)){if(i(L.value))return v;if(n(L.value,1))return Z;if(w(k,R))return new x(k.op,k.fn,[L,Z],k.implicit)}return new x(k.op,k.fn,[Z,L],k.implicit)}if(k.op==="/")return qt(Z)&&i(Z.value)?v:qt(L)&&n(L.value,1)?Z:new x(k.op,k.fn,[Z,L]);if(k.op==="^"&&qt(L)){if(i(L.value))return S;if(n(L.value,1))return Z}if(k.op==="and"){if(qt(Z))if(Z.value){if(A(L))return L;if(qt(L))return L.value?_:y}else return y;if(qt(L))if(L.value){if(A(Z))return Z}else return y}if(k.op==="or"){if(qt(Z)){if(Z.value)return _;if(A(L))return L}if(qt(L)){if(L.value)return _;if(A(Z))return Z}}return new x(k.op,k.fn,[Z,L])}if(Wr(k))return new x(k.op,k.fn,k.args.map(oe=>D(oe,B)));if(fi(k))return new f(k.items.map(oe=>D(oe,B)));if(Ca(k))return new l(D(k.object,B),D(k.index,B));if(oo(k))return new d(k.dimensions.map(oe=>D(oe,B)));if(Tu(k)){var pe={};for(var me in k.properties)pe[me]=D(k.properties[me],B);return new h(pe)}return k}return e(uV,{Node:D,"Node,Object":D})});var Ore="resolve",Rre=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],jA=C(Ore,Rre,r=>{var{typed:e,parse:t,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=r;function u(c,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!s)return c;if(Ur(c)){if(l.has(c.name)){var f=Array.from(l).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var p=s.get(c.name);if(tr(p)){var m=new Set(l);return m.add(c.name),u(p,s,m)}else return typeof p=="number"?t(String(p)):p!==void 0?new n(p):c}else if(Wr(c)){var d=c.args.map(function(x){return u(x,s,l)});return new a(c.op,c.fn,d,c.implicit)}else{if(pi(c))return new o(u(c.content,s,l));if(Gi(c)){var h=c.args.map(function(x){return u(x,s,l)});return new i(c.name,h)}}return c.map(x=>u(x,s,l))}return e("resolve",{Node:u,"Node, Map | null | undefined":u,"Node, Object":(c,s)=>u(c,$s(s)),"Array | Matrix":e.referToSelf(c=>s=>s.map(l=>c(l))),"Array | Matrix, null | undefined":e.referToSelf(c=>s=>s.map(l=>c(l))),"Array, Object":e.referTo("Array,Map",c=>(s,l)=>c(s,$s(l))),"Matrix, Object":e.referTo("Matrix,Map",c=>(s,l)=>c(s,$s(l))),"Array | Matrix, Map":e.referToSelf(c=>(s,l)=>s.map(f=>c(f,l)))})});var lV="symbolicEqual",Lre=["parse","simplify","typed","OperatorNode"],ZA=C(lV,Lre,r=>{var{parse:e,simplify:t,typed:n,OperatorNode:i}=r;function a(o,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=new i("-","subtract",[o,u]),l=t(s,{},c);return qt(l)&&!l.value}return n(lV,{"Node, Node":a,"Node, Node, Object":a})});var cV="derivative",Vre=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],JA=C(cV,Vre,r=>{var{typed:e,config:t,parse:n,simplify:i,equal:a,isZero:o,numeric:u,ConstantNode:c,FunctionNode:s,OperatorNode:l,ParenthesisNode:f,SymbolNode:p}=r;function m(S,_){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},A={};b(A,S,_.name);var M=T(S,A);return y.simplify?i(M):M}function d(S){var _=n(S);if(!_.isSymbolNode)throw new TypeError("Invalid variable. "+"Cannot parse ".concat(JSON.stringify(S)," into a variable in function derivative"));return _}var h=e(cV,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m,"Node, string":(S,_)=>m(S,d(_)),"Node, string, Object":(S,_,y)=>m(S,d(_),y)});h._simplify=!0,h.toTex=function(S){return x.apply(null,S.args)};var x=e("_derivTex",{"Node, SymbolNode":function(_,y){return qt(_)&&ur(_.value)==="string"?x(n(_.value).toString(),y.toString(),1):x(_.toTex(),y.toString(),1)},"Node, ConstantNode":function(_,y){if(ur(y.value)==="string")return x(_,n(y.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(_,y,A){return x(_.toString(),y.name,A.value)},"string, string, number":function(_,y,A){var M;return A===1?M="{d\\over d"+y+"}":M="{d^{"+A+"}\\over d"+y+"^{"+A+"}}",M+"\\left[".concat(_,"\\right]")}}),b=e("constTag",{"Object, ConstantNode, string":function(_,y){return _[y]=!0,!0},"Object, SymbolNode, string":function(_,y,A){return y.name!==A?(_[y]=!0,!0):!1},"Object, ParenthesisNode, string":function(_,y,A){return b(_,y.content,A)},"Object, FunctionAssignmentNode, string":function(_,y,A){return y.params.includes(A)?b(_,y.expr,A):(_[y]=!0,!0)},"Object, FunctionNode | OperatorNode, string":function(_,y,A){if(y.args.length>0){for(var M=b(_,y.args[0],A),w=1;w<y.args.length;++w)M=b(_,y.args[w],A)&&M;if(M)return _[y]=!0,!0}return!1}}),T=e("_derivative",{"ConstantNode, Object":function(_){return v(0)},"SymbolNode, Object":function(_,y){return y[_]!==void 0?v(0):v(1)},"ParenthesisNode, Object":function(_,y){return new f(T(_.content,y))},"FunctionAssignmentNode, Object":function(_,y){return y[_]!==void 0?v(0):T(_.expr,y)},"FunctionNode, Object":function(_,y){if(y[_]!==void 0)return v(0);var A=_.args[0],M,w=!1,D=!1,N;switch(_.name){case"cbrt":w=!0,N=new l("*","multiply",[v(3),new l("^","pow",[A,new l("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(_.args.length===1)w=!0,N=new l("*","multiply",[v(2),new s("sqrt",[A])]);else if(_.args.length===2)return M=new l("/","divide",[v(1),_.args[1]]),y[M]=y[_.args[1]],T(new l("^","pow",[A,M]),y);break;case"log10":M=v(10);case"log":if(!M&&_.args.length===1)N=A.clone(),w=!0;else if(_.args.length===1&&M||_.args.length===2&&y[_.args[1]]!==void 0)N=new l("*","multiply",[A.clone(),new s("log",[M||_.args[1]])]),w=!0;else if(_.args.length===2)return T(new l("/","divide",[new s("log",[A]),new s("log",[_.args[1]])]),y);break;case"pow":if(_.args.length===2)return y[M]=y[_.args[1]],T(new l("^","pow",[A,_.args[1]]),y);break;case"exp":N=new s("exp",[A.clone()]);break;case"sin":N=new s("cos",[A.clone()]);break;case"cos":N=new l("-","unaryMinus",[new s("sin",[A.clone()])]);break;case"tan":N=new l("^","pow",[new s("sec",[A.clone()]),v(2)]);break;case"sec":N=new l("*","multiply",[_,new s("tan",[A.clone()])]);break;case"csc":D=!0,N=new l("*","multiply",[_,new s("cot",[A.clone()])]);break;case"cot":D=!0,N=new l("^","pow",[new s("csc",[A.clone()]),v(2)]);break;case"asin":w=!0,N=new s("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[A.clone(),v(2)])])]);break;case"acos":w=!0,D=!0,N=new s("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[A.clone(),v(2)])])]);break;case"atan":w=!0,N=new l("+","add",[new l("^","pow",[A.clone(),v(2)]),v(1)]);break;case"asec":w=!0,N=new l("*","multiply",[new s("abs",[A.clone()]),new s("sqrt",[new l("-","subtract",[new l("^","pow",[A.clone(),v(2)]),v(1)])])]);break;case"acsc":w=!0,D=!0,N=new l("*","multiply",[new s("abs",[A.clone()]),new s("sqrt",[new l("-","subtract",[new l("^","pow",[A.clone(),v(2)]),v(1)])])]);break;case"acot":w=!0,D=!0,N=new l("+","add",[new l("^","pow",[A.clone(),v(2)]),v(1)]);break;case"sinh":N=new s("cosh",[A.clone()]);break;case"cosh":N=new s("sinh",[A.clone()]);break;case"tanh":N=new l("^","pow",[new s("sech",[A.clone()]),v(2)]);break;case"sech":D=!0,N=new l("*","multiply",[_,new s("tanh",[A.clone()])]);break;case"csch":D=!0,N=new l("*","multiply",[_,new s("coth",[A.clone()])]);break;case"coth":D=!0,N=new l("^","pow",[new s("csch",[A.clone()]),v(2)]);break;case"asinh":w=!0,N=new s("sqrt",[new l("+","add",[new l("^","pow",[A.clone(),v(2)]),v(1)])]);break;case"acosh":w=!0,N=new s("sqrt",[new l("-","subtract",[new l("^","pow",[A.clone(),v(2)]),v(1)])]);break;case"atanh":w=!0,N=new l("-","subtract",[v(1),new l("^","pow",[A.clone(),v(2)])]);break;case"asech":w=!0,D=!0,N=new l("*","multiply",[A.clone(),new s("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[A.clone(),v(2)])])])]);break;case"acsch":w=!0,D=!0,N=new l("*","multiply",[new s("abs",[A.clone()]),new s("sqrt",[new l("+","add",[new l("^","pow",[A.clone(),v(2)]),v(1)])])]);break;case"acoth":w=!0,D=!0,N=new l("-","subtract",[v(1),new l("^","pow",[A.clone(),v(2)])]);break;case"abs":N=new l("/","divide",[new s(new p("abs"),[A.clone()]),A.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+_.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var B,R;w?(B="/",R="divide"):(B="*",R="multiply");var z=T(A,y);return D&&(z=new l("-","unaryMinus",[z])),new l(B,R,[z,N])},"OperatorNode, Object":function(_,y){if(y[_]!==void 0)return v(0);if(_.op==="+")return new l(_.op,_.fn,_.args.map(function(k){return T(k,y)}));if(_.op==="-"){if(_.isUnary())return new l(_.op,_.fn,[T(_.args[0],y)]);if(_.isBinary())return new l(_.op,_.fn,[T(_.args[0],y),T(_.args[1],y)])}if(_.op==="*"){var A=_.args.filter(function(k){return y[k]!==void 0});if(A.length>0){var M=_.args.filter(function(k){return y[k]===void 0}),w=M.length===1?M[0]:new l("*","multiply",M),D=A.concat(T(w,y));return new l("*","multiply",D)}return new l("+","add",_.args.map(function(k){return new l("*","multiply",_.args.map(function(P){return P===k?T(P,y):P.clone()}))}))}if(_.op==="/"&&_.isBinary()){var N=_.args[0],B=_.args[1];return y[B]!==void 0?new l("/","divide",[T(N,y),B]):y[N]!==void 0?new l("*","multiply",[new l("-","unaryMinus",[N]),new l("/","divide",[T(B,y),new l("^","pow",[B.clone(),v(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[T(N,y),B.clone()]),new l("*","multiply",[N.clone(),T(B,y)])]),new l("^","pow",[B.clone(),v(2)])])}if(_.op==="^"&&_.isBinary()){var R=_.args[0],z=_.args[1];if(y[R]!==void 0)return qt(R)&&(o(R.value)||a(R.value,1))?v(0):new l("*","multiply",[_,new l("*","multiply",[new s("log",[R.clone()]),T(z.clone(),y)])]);if(y[z]!==void 0){if(qt(z)){if(o(z.value))return v(0);if(a(z.value,1))return T(R,y)}var V=new l("^","pow",[R.clone(),new l("-","subtract",[z,v(1)])]);return new l("*","multiply",[z.clone(),new l("*","multiply",[T(R,y),V])])}return new l("*","multiply",[new l("^","pow",[R.clone(),z.clone()]),new l("+","add",[new l("*","multiply",[T(R,y),new l("/","divide",[z.clone(),R.clone()])]),new l("*","multiply",[T(z,y),new s("log",[R.clone()])])])])}throw new Error('Cannot process operator "'+_.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function v(S,_){return new c(u(S,_||Ai(String(S),t)))}return h});var fV="rationalize",Ure=["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"],XA=C(fV,Ure,r=>{var{config:e,typed:t,equal:n,isZero:i,add:a,subtract:o,multiply:u,divide:c,pow:s,parse:l,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:d,bignumber:h,mathWithTransform:x,matrix:b,AccessorNode:T,ArrayNode:v,ConstantNode:S,FunctionNode:_,IndexNode:y,ObjectNode:A,OperatorNode:M,SymbolNode:w,ParenthesisNode:D}=r;function N(k){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=R(),X=B(k,P,!0,O.firstRules),ne=X.variables.length,Z={exactFractions:!1},L={exactFractions:!0};if(k=X.expression,ne>=1){k=z(k);var pe,me,oe=!0,ve=!1;k=m(k,O.firstRules,{},Z);for(var _e;me=oe?O.distrDivRules:O.sucDivRules,k=m(k,me,{},L),oe=!oe,_e=k.toString(),_e!==pe;)ve=!0,pe=_e;ve&&(k=m(k,O.firstRulesAgain,{},Z)),k=m(k,O.finalRules,{},Z)}var ye=[],be={};return k.type==="OperatorNode"&&k.isBinary()&&k.op==="/"?(ne===1&&(k.args[0]=V(k.args[0],ye),k.args[1]=V(k.args[1])),W&&(be.numerator=k.args[0],be.denominator=k.args[1])):(ne===1&&(k=V(k,ye)),W&&(be.numerator=k,be.denominator=null)),W?(be.coefficients=ye,be.variables=X.variables,be.expression=k,be):k}return t(fV,{Node:N,"Node, boolean":(k,P)=>N(k,{},P),"Node, Object":N,"Node, Object, boolean":N});function B(k,P,W,O){var X=[],ne=m(k,O,P,{exactFractions:!1});W=!!W;var Z="+-*"+(W?"/":"");pe(ne);var L={};return L.expression=ne,L.variables=X,L;function pe(me){var oe=me.type;if(oe==="FunctionNode")throw new Error("There is an unsolved function call");if(oe==="OperatorNode")if(me.op==="^"){if(me.args[1].type!=="ConstantNode"||!Je(parseFloat(me.args[1].value)))throw new Error("There is a non-integer exponent");pe(me.args[0])}else{if(!Z.includes(me.op))throw new Error("Operator "+me.op+" invalid in polynomial expression");for(var ve=0;ve<me.args.length;ve++)pe(me.args[ve])}else if(oe==="SymbolNode"){var _e=me.name,ye=X.indexOf(_e);ye===-1&&X.push(_e)}else if(oe==="ParenthesisNode")pe(me.content);else if(oe!=="ConstantNode")throw new Error("type "+oe+" is not allowed in polynomial expression")}}function R(){var k=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],P=[{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))"}],X={};return X.firstRules=k.concat(P,O),X.distrDivRules=W,X.sucDivRules=O,X.firstRulesAgain=k.concat(P),X.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],X}function z(k,P,W){var O=k.type,X=arguments.length>1;if(O==="OperatorNode"&&k.isBinary()){var ne=!1,Z;if(k.op==="^"&&(k.args[0].type==="ParenthesisNode"||k.args[0].type==="OperatorNode")&&k.args[1].type==="ConstantNode"&&(Z=parseFloat(k.args[1].value),ne=Z>=2&&Je(Z)),ne){if(Z>2){var L=k.args[0],pe=new M("^","pow",[k.args[0].cloneDeep(),new S(Z-1)]);k=new M("*","multiply",[L,pe])}else k=new M("*","multiply",[k.args[0],k.args[0].cloneDeep()]);X&&(W==="content"?P.content=k:P.args[W]=k)}}if(O==="ParenthesisNode")z(k.content,k,"content");else if(O!=="ConstantNode"&&O!=="SymbolNode")for(var me=0;me<k.args.length;me++)z(k.args[me],k,me);if(!X)return k}function V(k,P){P===void 0&&(P=[]),P[0]=0;var W={};W.cte=1,W.oper="+",W.fire="";var O=0,X="";_e(k,null,W),O=P.length-1;for(var ne=!0,Z,L=O;L>=0;L--)if(P[L]!==0){var pe=new S(ne?P[L]:Math.abs(P[L])),me=P[L]<0?"-":"+";if(L>0){var oe=new w(X);if(L>1){var ve=new S(L);oe=new M("^","pow",[oe,ve])}P[L]===-1&&ne?pe=new M("-","unaryMinus",[oe]):Math.abs(P[L])===1?pe=oe:pe=new M("*","multiply",[pe,oe])}ne?Z=pe:me==="+"?Z=new M("+","add",[Z,pe]):Z=new M("-","subtract",[Z,pe]),ne=!1}if(ne)return new S(0);return Z;function _e(ye,be,we){var Ee=ye.type;if(Ee==="FunctionNode")throw new Error("There is an unsolved function call");if(Ee==="OperatorNode"){if(!"+-*^".includes(ye.op))throw new Error("Operator "+ye.op+" invalid");if(be!==null){if((ye.fn==="unaryMinus"||ye.fn==="pow")&&be.fn!=="add"&&be.fn!=="subtract"&&be.fn!=="multiply")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="multiply")&&be.fn!=="add"&&be.fn!=="subtract")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="unaryMinus")&&we.noFil!==0)throw new Error("Invalid "+ye.op+" placing")}(ye.op==="^"||ye.op==="*")&&(we.fire=ye.op);for(var ze=0;ze<ye.args.length;ze++)ye.fn==="unaryMinus"&&(we.oper="-"),(ye.op==="+"||ye.fn==="subtract")&&(we.fire="",we.cte=1,we.oper=ze===0?"+":ye.op),we.noFil=ze,_e(ye.args[ze],ye,we)}else if(Ee==="SymbolNode"){if(ye.name!==X&&X!=="")throw new Error("There is more than one variable");if(X=ye.name,be===null){P[1]=1;return}if(be.op==="^"&&we.noFil!==0)throw new Error("In power the variable should be the first parameter");if(be.op==="*"&&we.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(we.fire===""||we.fire==="*")&&(O<1&&(P[1]=0),P[1]+=we.cte*(we.oper==="+"?1:-1),O=Math.max(1,O))}else if(Ee==="ConstantNode"){var Qe=parseFloat(ye.value);if(be===null){P[0]=Qe;return}if(be.op==="^"){if(we.noFil!==1)throw new Error("Constant cannot be powered");if(!Je(Qe)||Qe<=0)throw new Error("Non-integer exponent is not allowed");for(var Y=O+1;Y<Qe;Y++)P[Y]=0;Qe>O&&(P[Qe]=0),P[Qe]+=we.cte*(we.oper==="+"?1:-1),O=Math.max(Qe,O);return}we.cte=Qe,we.fire===""&&(P[0]+=we.cte*(we.oper==="+"?1:-1))}else throw new Error("Type "+Ee+" is not allowed")}}});var pV="zpk2tf",qre=["typed","add","multiply","Complex","number"],QA=C(pV,qre,r=>{var{typed:e,add:t,multiply:n,Complex:i,number:a}=r;return e(pV,{"Array,Array,number":function(s,l,f){return o(s,l,f)},"Array,Array":function(s,l){return o(s,l,1)},"Matrix,Matrix,number":function(s,l,f){return o(s.valueOf(),l.valueOf(),f)},"Matrix,Matrix":function(s,l){return o(s.valueOf(),l.valueOf(),1)}});function o(c,s,l){c.some(T=>T.type==="BigNumber")&&(c=c.map(T=>a(T))),s.some(T=>T.type==="BigNumber")&&(s=s.map(T=>a(T)));for(var f=[i(1,0)],p=[i(1,0)],m=0;m<c.length;m++){var d=c[m];typeof d=="number"&&(d=i(d,0)),f=u(f,[i(1,0),i(-d.re,-d.im)])}for(var h=0;h<s.length;h++){var x=s[h];typeof x=="number"&&(x=i(x,0)),p=u(p,[i(1,0),i(-x.re,-x.im)])}for(var b=0;b<f.length;b++)f[b]=n(f[b],l);return[f,p]}function u(c,s){for(var l=[],f=0;f<c.length+s.length-1;f++){l[f]=i(0,0);for(var p=0;p<c.length;p++)f-p>=0&&f-p<s.length&&(l[f]=t(l[f],n(c[p],s[f-p])))}return l}});var mV="freqz",zre=["typed","add","multiply","Complex","divide","matrix"],KA=C(mV,zre,r=>{var{typed:e,add:t,multiply:n,Complex:i,divide:a,matrix:o}=r;return e(mV,{"Array, Array":function(l,f){var p=c(512);return u(l,f,p)},"Array, Array, Array":function(l,f,p){return u(l,f,p)},"Array, Array, number":function(l,f,p){if(p<0)throw new Error("w must be a positive number");var m=c(p);return u(l,f,m)},"Matrix, Matrix":function(l,f){var p=c(512),{w:m,h:d}=u(l.valueOf(),f.valueOf(),p);return{w:o(m),h:o(d)}},"Matrix, Matrix, Matrix":function(l,f,p){var{h:m}=u(l.valueOf(),f.valueOf(),p.valueOf());return{h:o(m),w:o(p)}},"Matrix, Matrix, number":function(l,f,p){if(p<0)throw new Error("w must be a positive number");var m=c(p),{h:d}=u(l.valueOf(),f.valueOf(),m);return{h:o(d),w:o(m)}}});function u(s,l,f){for(var p=[],m=[],d=0;d<f.length;d++){for(var h=i(0,0),x=i(0,0),b=0;b<s.length;b++)h=t(h,n(s[b],i(Math.cos(-b*f[d]),Math.sin(-b*f[d]))));for(var T=0;T<l.length;T++)x=t(x,n(l[T],i(Math.cos(-T*f[d]),Math.sin(-T*f[d]))));p.push(h),m.push(x)}for(var v=[],S=0;S<p.length;S++)v.push(a(p[S],m[S]));return{h:v,w:f}}function c(s){for(var l=[],f=0;f<s;f++)l.push(f/s*Math.PI);return l}});var Hre="reviver",Gre=["classes"],eE=C(Hre,Gre,r=>{var{classes:e}=r;return function(n,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var Wre="replacer",Yre=[],tE=C(Wre,Yre,()=>function(e,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:typeof t=="bigint"?{mathjs:"bigint",value:String(t)}:t});var dV="13.2.0";var rE=C("true",[],()=>!0),nE=C("false",[],()=>!1),iE=C("null",[],()=>null),aE=Ia("Infinity",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1/0):1/0}),oE=Ia("NaN",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(NaN):NaN}),sE=Ia("pi",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?tm(t):j2}),uE=Ia("tau",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?gk(t):Z2}),lE=Ia("e",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?dk(t):J2}),cE=Ia("phi",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?hk(t):X2}),fE=Ia("LN2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(2).ln():Math.LN2}),pE=Ia("LN10",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(10).ln():Math.LN10}),mE=Ia("LOG2E",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),dE=Ia("LOG10E",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),hE=Ia("SQRT1_2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),gE=Ia("SQRT2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),vE=Ia("i",["Complex"],r=>{var{Complex:e}=r;return e.I});var yE=C("version",[],()=>dV);function Ia(r,e,t){return C(r,e,t,{recreateOnConfigChange:!0})}var xE=nr("speedOfLight","299792458","m s^-1"),bE=nr("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),wE=nr("planckConstant","6.62607015e-34","J s"),_E=nr("reducedPlanckConstant","1.0545718176461565e-34","J s"),SE=nr("magneticConstant","1.25663706212e-6","N A^-2"),AE=nr("electricConstant","8.8541878128e-12","F m^-1"),EE=nr("vacuumImpedance","376.730313667","ohm"),TE=nr("coulomb","8.987551792261171e9","N m^2 C^-2"),ME=nr("elementaryCharge","1.602176634e-19","C"),DE=nr("bohrMagneton","9.2740100783e-24","J T^-1"),CE=nr("conductanceQuantum","7.748091729863649e-5","S"),NE=nr("inverseConductanceQuantum","12906.403729652257","ohm"),FE=nr("magneticFluxQuantum","2.0678338484619295e-15","Wb"),IE=nr("nuclearMagneton","5.0507837461e-27","J T^-1"),PE=nr("klitzing","25812.807459304513","ohm");var BE=nr("bohrRadius","5.29177210903e-11","m"),kE=nr("classicalElectronRadius","2.8179403262e-15","m"),$E=nr("electronMass","9.1093837015e-31","kg"),OE=nr("fermiCoupling","1.1663787e-5","GeV^-2"),RE=jg("fineStructure",.0072973525693),LE=nr("hartreeEnergy","4.3597447222071e-18","J"),VE=nr("protonMass","1.67262192369e-27","kg"),UE=nr("deuteronMass","3.3435830926e-27","kg"),qE=nr("neutronMass","1.6749271613e-27","kg"),zE=nr("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),HE=nr("rydberg","10973731.568160","m^-1"),GE=nr("thomsonCrossSection","6.6524587321e-29","m^2"),WE=jg("weakMixingAngle",.2229),YE=jg("efimovFactor",22.7),jE=nr("atomicMass","1.66053906660e-27","kg"),ZE=nr("avogadro","6.02214076e23","mol^-1"),JE=nr("boltzmann","1.380649e-23","J K^-1"),XE=nr("faraday","96485.33212331001","C mol^-1"),QE=nr("firstRadiation","3.7417718521927573e-16","W m^2"),KE=nr("loschmidt","2.686780111798444e25","m^-3"),eT=nr("gasConstant","8.31446261815324","J K^-1 mol^-1"),tT=nr("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),rT=nr("molarVolume","0.022413969545014137","m^3 mol^-1"),nT=jg("sackurTetrode",-1.16487052358),iT=nr("secondRadiation","0.014387768775039337","m K"),aT=nr("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),oT=nr("wienDisplacement","2.897771955e-3","m K"),sT=nr("molarMass","0.99999999965e-3","kg mol^-1"),uT=nr("molarMassC12","11.9999999958e-3","kg mol^-1"),lT=nr("gravity","9.80665","m s^-2"),cT=nr("planckLength","1.616255e-35","m"),fT=nr("planckMass","2.176435e-8","kg"),pT=nr("planckTime","5.391245e-44","s"),mT=nr("planckCharge","1.87554603778e-18","C"),dT=nr("planckTemperature","1.416785e+32","K");function nr(r,e,t){var n=["config","Unit","BigNumber"];return C(r,n,i=>{var{config:a,Unit:o,BigNumber:u}=i,c=a.number==="BigNumber"?new u(e):parseFloat(e),s=new o(c,t);return s.fixPrefix=!0,s})}function jg(r,e){var t=["config","BigNumber"];return C(r,t,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(e):e})}var jre="apply",Zre=["typed","isInteger"],hT=C(jre,Zre,r=>{var{typed:e,isInteger:t}=r,n=Il({typed:e,isInteger:t});return e("apply",{"...any":function(a){var o=a[1];xt(o)?a[1]=o-1:ut(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(u){throw Hr(u)}}})},{isTransformFunction:!0});var Jre="column",Xre=["typed","Index","matrix","range"],gT=C(Jre,Xre,r=>{var{typed:e,Index:t,matrix:n,range:i}=r,a=zp({typed:e,Index:t,matrix:n,range:i});return e("column",{"...any":function(u){var c=u.length-1,s=u[c];xt(s)&&(u[c]=s-1);try{return a.apply(null,u)}catch(l){throw Hr(l)}}})},{isTransformFunction:!0});function mf(r,e,t){var n=r.filter(function(c){return Ur(c)&&!(c.name in e)&&!t.has(c.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+r+'"');var i=n.name,a=new Map,o=new Hc(t,a,new Set([i])),u=r.compile();return function(s){return a.set(i,s),u.evaluate(o)}}var Qre="transformCallback",Kre=["typed"],df=C(Qre,Kre,r=>{var{typed:e}=r;return function(n,i){return e.isTypedFunction(n)?t(n,i):hV(n,n.length,i)};function t(n,i){var a=Object.fromEntries(Object.entries(n.signatures).map(o=>{var[u,c]=o,s=u.split(",").length;return e.isTypedFunction(c)?[u,t(c,i)]:[u,hV(c,s,i)]}));return typeof n.name=="string"?e(n.name,a):e(a)}});function hV(r,e,t){return e===t?r:e===t+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,t),u=gV(i[t]);return r(...o,u)}:e>t+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,t),u=gV(i[t]),c=i.slice(t+1);return r(...o,u,...c)}:r}function gV(r){return r.map(e=>e+1)}var ene="filter",tne=["typed"],vT=C(ene,tne,r=>{var{typed:e}=r;function t(i,a,o){var u=Hp({typed:e}),c=df({typed:e});if(i.length===0)return u();var s=i[0];if(i.length===1)return u(s);var l=i.length-1,f=i[l];return s&&(s=n(s,o)),f&&(Ur(f)||Ko(f)?f=n(f,o):f=mf(f,a,o)),u(s,c(f,l))}t.rawArgs=!0;function n(i,a){return i.compile().evaluate(a)}return t},{isTransformFunction:!0});var rne="forEach",nne=["typed"],yT=C(rne,nne,r=>{var{typed:e}=r,t=Gp({typed:e}),n=df({typed:e});function i(o,u,c){if(o.length===0)return t();var s=o[0];if(o.length===1)return t(s);var l=o.length-1,f=o[l];return s&&(s=a(s,c)),f&&(Ur(f)||Ko(f)?f=a(f,c):f=mf(f,u,c)),t(s,n(f,l))}i.rawArgs=!0;function a(o,u){return o.compile().evaluate(u)}return i},{isTransformFunction:!0});var ine="index",ane=["Index","getMatrixDataType"],xT=C(ine,ane,r=>{var{Index:e,getMatrixDataType:t}=r;return function(){for(var i=[],a=0,o=arguments.length;a<o;a++){var u=arguments[a];if(Gc(u))u.start--,u.end-=u.step>0?0:2;else if(u&&u.isSet===!0)u=u.map(function(s){return s-1});else if(dr(u)||et(u))t(u)!=="boolean"&&(u=u.map(function(s){return s-1}));else if(xt(u))u--;else if(ut(u))u=u.toNumber()-1;else if(typeof u!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=u}var c=new e;return e.apply(c,i),c}},{isTransformFunction:!0});var one="map",sne=["typed"],bT=C(one,sne,r=>{var{typed:e}=r,t=Wp({typed:e}),n=df({typed:e});function i(a,o,u){if(a.length===0)return t();if(a.length===1)return t(a[0]);var c=a.length-1,s=a.slice(0,c),l=a[c];return s=s.map(p=>f(p,u)),l&&(Ur(l)||Ko(l)?l=f(l,u):l=mf(l,o,u)),t(...s,n(l,c));function f(p,m){return p.compile().evaluate(m)}}return i.rawArgs=!0,i},{isTransformFunction:!0});function vV(r){return xt(r)?r-1:ut(r)?r.minus(1):r}function yV(r){return xt(r)||ut(r)}function Di(r){if(r.length===2&&bn(r[0])){r=r.slice();var e=r[1];yV(e)&&(r[1]=vV(e))}return r}var une="max",lne=["typed","config","numeric","larger"],wT=C(une,lne,r=>{var{typed:e,config:t,numeric:n,larger:i}=r,a=Kp({typed:e,config:t,numeric:n,larger:i});return e("max",{"...any":function(u){u=Di(u);try{return a.apply(null,u)}catch(c){throw Hr(c)}}})},{isTransformFunction:!0});var cne="mean",fne=["typed","add","divide"],_T=C(cne,fne,r=>{var{typed:e,add:t,divide:n}=r,i=am({typed:e,add:t,divide:n});return e("mean",{"...any":function(o){o=Di(o);try{return i.apply(null,o)}catch(u){throw Hr(u)}}})},{isTransformFunction:!0});var pne="min",mne=["typed","config","numeric","smaller"],ST=C(pne,mne,r=>{var{typed:e,config:t,numeric:n,smaller:i}=r,a=em({typed:e,config:t,numeric:n,smaller:i});return e("min",{"...any":function(u){u=Di(u);try{return a.apply(null,u)}catch(c){throw Hr(c)}}})},{isTransformFunction:!0});var dne="range",hne=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],AT=C(dne,hne,r=>{var{typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:c,add:s,isPositive:l}=r,f=jp({typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:c,add:s,isPositive:l});return e("range",{"...any":function(m){var d=m.length-1,h=m[d];return typeof h!="boolean"&&m.push(!0),f.apply(null,m)}})},{isTransformFunction:!0});var gne="row",vne=["typed","Index","matrix","range"],ET=C(gne,vne,r=>{var{typed:e,Index:t,matrix:n,range:i}=r,a=Zp({typed:e,Index:t,matrix:n,range:i});return e("row",{"...any":function(u){var c=u.length-1,s=u[c];xt(s)&&(u[c]=s-1);try{return a.apply(null,u)}catch(l){throw Hr(l)}}})},{isTransformFunction:!0});var yne="subset",xne=["typed","matrix","zeros","add"],TT=C(yne,xne,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r,a=Jp({typed:e,matrix:t,zeros:n,add:i});return e("subset",{"...any":function(u){try{return a.apply(null,u)}catch(c){throw Hr(c)}}})},{isTransformFunction:!0});var bne="concat",wne=["typed","matrix","isInteger"],MT=C(bne,wne,r=>{var{typed:e,matrix:t,isInteger:n}=r,i=qp({typed:e,matrix:t,isInteger:n});return e("concat",{"...any":function(o){var u=o.length-1,c=o[u];xt(c)?o[u]=c-1:ut(c)&&(o[u]=c.minus(1));try{return i.apply(null,o)}catch(s){throw Hr(s)}}})},{isTransformFunction:!0});var xV="diff",_ne=["typed","matrix","subtract","number","bignumber"],DT=C(xV,_ne,r=>{var{typed:e,matrix:t,subtract:n,number:i,bignumber:a}=r,o=Yp({typed:e,matrix:t,subtract:n,number:i,bignumber:a});return e(xV,{"...any":function(c){c=Di(c);try{return o.apply(null,c)}catch(s){throw Hr(s)}}})},{isTransformFunction:!0});var Sne="std",Ane=["typed","map","sqrt","variance"],CT=C(Sne,Ane,r=>{var{typed:e,map:t,sqrt:n,variance:i}=r,a=um({typed:e,map:t,sqrt:n,variance:i});return e("std",{"...any":function(u){u=Di(u);try{return a.apply(null,u)}catch(c){throw Hr(c)}}})},{isTransformFunction:!0});var bV="sum",Ene=["typed","config","add","numeric"],NT=C(bV,Ene,r=>{var{typed:e,config:t,add:n,numeric:i}=r,a=nm({typed:e,config:t,add:n,numeric:i});return e(bV,{"...any":function(u){u=Di(u);try{return a.apply(null,u)}catch(c){throw Hr(c)}}})},{isTransformFunction:!0});var Tne="quantileSeq",Mne=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],FT=C(Tne,Mne,r=>{var{typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:c,isInteger:s,smaller:l,smallerEq:f,larger:p}=r,m=sm({typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:c,isInteger:s,smaller:l,smallerEq:f,larger:p});return e("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(h,x,b)=>m(h,x,d(b)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(h,x,b,T)=>m(h,x,b,d(T)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(h,x,b)=>m(h,x,d(b)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(h,x,b,T)=>m(h,x,b,d(T))});function d(h){return Di([[],h])[1]}},{isTransformFunction:!0});var wV="cumsum",Dne=["typed","add","unaryPlus"],IT=C(wV,Dne,r=>{var{typed:e,add:t,unaryPlus:n}=r,i=im({typed:e,add:t,unaryPlus:n});return e(wV,{"...any":function(o){if(o.length===2&&bn(o[0])){var u=o[1];xt(u)?o[1]=u-1:ut(u)&&(o[1]=u.minus(1))}try{return i.apply(null,o)}catch(c){throw Hr(c)}}})},{isTransformFunction:!0});var _V="variance",Cne=["typed","add","subtract","multiply","divide","apply","isNaN"],PT=C(_V,Cne,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:u}=r,c=om({typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:u});return e(_V,{"...any":function(l){l=Di(l);try{return c.apply(null,l)}catch(f){throw Hr(f)}}})},{isTransformFunction:!0});var SV="print",Nne=["typed","matrix","zeros","add"],BT=C(SV,Nne,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r,a=Xp({typed:e,matrix:t,zeros:n,add:i});return e(SV,{"string, Object | Array":function(c,s){return a(o(c),s)},"string, Object | Array, number | Object":function(c,s,l){return a(o(c),s,l)}});function o(u){return u.replace(hg,c=>{var s=c.slice(1).split("."),l=s.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+l.join(".")})}},{isTransformFunction:!0});var Fne="and",Ine=["typed","matrix","zeros","add","equalScalar","not","concat"],kT=C(Fne,Ine,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,u=Qp({typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function c(s,l,f){var p=s[0].compile().evaluate(f);if(!bn(p)&&!u(p,!0))return!1;var m=s[1].compile().evaluate(f);return u(p,m)}return c.rawArgs=!0,c},{isTransformFunction:!0});var Pne="or",Bne=["typed","matrix","equalScalar","DenseMatrix","concat"],$T=C(Pne,Bne,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=Up({typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function u(c,s,l){var f=c[0].compile().evaluate(l);if(!bn(f)&&o(f,!1))return!0;var p=c[1].compile().evaluate(l);return o(f,p)}return u.rawArgs=!0,u},{isTransformFunction:!0});var kne="bitAnd",$ne=["typed","matrix","zeros","add","equalScalar","not","concat"],OT=C(kne,$ne,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,u=Lp({typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function c(s,l,f){var p=s[0].compile().evaluate(f);if(!bn(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var m=s[1].compile().evaluate(f);return u(p,m)}return c.rawArgs=!0,c},{isTransformFunction:!0});var One="bitOr",Rne=["typed","matrix","equalScalar","DenseMatrix","concat"],RT=C(One,Rne,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=Vp({typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function u(c,s,l){var f=c[0].compile().evaluate(l);if(!bn(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var p=c[1].compile().evaluate(l);return o(f,p)}return u.rawArgs=!0,u},{isTransformFunction:!0});var je=r0({config:Be}),Gr=i0({}),LT=lE({BigNumber:je,config:Be}),AV=nE({}),EV=RE({BigNumber:je,config:Be}),Bu=o0({}),VT=vE({Complex:Gr}),TV=aE({BigNumber:je,config:Be}),MV=pE({BigNumber:je,config:Be}),DV=dE({BigNumber:je,config:Be}),fm=u0({}),CV=oE({BigNumber:je,config:Be}),NV=iE({}),FV=cE({BigNumber:je,config:Be}),IV=s0({}),UT=Zb({}),PV=hE({BigNumber:je,config:Be}),BV=nT({BigNumber:je,config:Be}),qT=uE({BigNumber:je,config:Be}),kV=rE({}),$V=yE({}),ar=g0({Matrix:fm}),OV=YE({BigNumber:je,config:Be}),RV=fE({BigNumber:je,config:Be}),Zg=sE({BigNumber:je,config:Be}),LV=tE({}),VV=gE({BigNumber:je,config:Be}),K=jb({BigNumber:je,Complex:Gr,DenseMatrix:ar,Fraction:Bu}),UV=WE({BigNumber:je,config:Be}),Ci=$w({typed:K}),qV=B1({Complex:Gr,config:Be,typed:K}),zV=$1({BigNumber:je,typed:K}),HV=R1({BigNumber:je,Complex:Gr,config:Be,typed:K}),Vn=Ow({typed:K}),GV=p_({typed:K}),WV=U1({BigNumber:je,Complex:Gr,config:Be,typed:K}),YV=z1({typed:K}),zT=H1({typed:K}),jV=W1({Complex:Gr,config:Be,typed:K}),ZV=Sw({typed:K}),JV=c_({typed:K}),XV=Ew({typed:K}),QV=v0({typed:K}),pm=bA({typed:K}),mm=Mw({Complex:Gr,typed:K}),ku=m_({typed:K}),Jg=Y1({typed:K}),KV=Z1({BigNumber:je,typed:K}),eU=X1({BigNumber:je,typed:K}),tU=qw({typed:K}),cr=bw({config:Be,typed:K}),rU=V_({typed:K}),HT=zw({typed:K}),nU=Hw({Complex:Gr,typed:K}),iU=Hp({typed:K}),hf=w_({typed:K}),aU=Gp({typed:K}),gf=H_({typed:K}),Xg=S_({typed:K}),oU=Y_({format:gf,typed:K}),Qg=d_({typed:K}),Wi=x0({typed:K}),Gs=mw({config:Be,typed:K}),$u=gw({config:Be,typed:K}),ho=vw({equalScalar:cr,typed:K}),sU=mE({BigNumber:je,config:Be}),uU=SA({Complex:Gr,typed:K}),lU=Xw({Complex:Gr,config:Be,typed:K}),GT=Qw({Complex:Gr,config:Be,typed:K}),Ou=Wp({typed:K}),_n=Kw({typed:K}),dm=g_({typed:K}),ns=_w({typed:K}),cU=W_({format:gf,typed:K}),fU=kA({config:Be,typed:K}),pU=Xp({typed:K}),mU=$A({config:Be,typed:K}),Kg=h_({typed:K}),dU=K1({BigNumber:je,typed:K}),WT=r_({BigNumber:je,Fraction:Bu,complex:mm,typed:K}),hm=tS({typed:K}),is=ww({Matrix:fm,equalScalar:cr,typed:K}),hU=Pw({typed:K}),gU=i_({typed:K}),vU=Aw({typed:K}),Pa=Rw({typed:K}),yU=nS({typed:K}),YT=xw({typed:K}),xU=k1({Complex:Gr,config:Be,typed:K}),bU=L1({BigNumber:je,typed:K}),ev=Il({isInteger:Wi,typed:K}),wU=V1({BigNumber:je,Complex:Gr,config:Be,typed:K}),ma=Tw({BigNumber:je,typed:K}),_U=wA({typed:K}),SU=j1({typed:K}),AU=Q1({BigNumber:je,typed:K}),vf=yw({typed:K}),EU=Z_({typed:K}),TU=OA({config:Be,typed:K}),MU=eS({BigNumber:je,typed:K}),DU=rS({typed:K}),CU=I1({SparseMatrix:is,typed:K}),go=n_({Complex:Gr,config:Be,typed:K}),NU=P_({typed:K}),FU=iS({typed:K}),$o=Bw({typed:K}),IU=O1({BigNumber:je,Complex:Gr,config:Be,typed:K}),PU=G_({format:gf,typed:K}),BU=J1({BigNumber:je,typed:K}),Rl=Dw({Fraction:Bu,typed:K}),Ru=dw({typed:K}),Ge=Cw({DenseMatrix:ar,Matrix:fm,SparseMatrix:is,typed:K}),kU=Nw({isZero:ho,matrix:Ge,typed:K}),$U=q_({isNaN:vf,isNumeric:Ru,typed:K}),Ba=J_({bignumber:ma,fraction:Rl,number:ns}),jT=z_({config:Be,multiplyScalar:_n,numeric:Ba,typed:K}),ZT=D_({isInteger:Wi,matrix:Ge,typed:K}),ni=I_({matrix:Ge,config:Be,typed:K}),yf=B_({matrix:Ge,typed:K}),JT=o_({BigNumber:je,config:Be,matrix:Ge,typed:K}),ii=$_({BigNumber:je,config:Be,matrix:Ge,typed:K}),OU=q1({Complex:Gr,config:Be,typed:K}),XT=Lw({BigNumber:je,Complex:Gr,Fraction:Bu,config:Be,isNegative:Gs,matrix:Ge,typed:K,unaryMinus:$o}),br=qp({isInteger:Wi,matrix:Ge,typed:K}),RU=y_({prod:jT,size:ni,typed:K}),tv=k_({conj:ku,transpose:yf,typed:K}),QT=b_({DenseMatrix:ar,SparseMatrix:is,matrix:Ge,typed:K}),cn=X_({numeric:Ba,typed:K}),xf=i1({DenseMatrix:ar,concat:br,divideScalar:cn,equalScalar:cr,matrix:Ge,typed:K}),ka=h1({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K}),LU=hw({isNumeric:Ru,typed:K}),Ws=A_({BigNumber:je,DenseMatrix:ar,SparseMatrix:is,config:Be,matrix:Ge,typed:K}),VU=E_({matrix:Ge,multiplyScalar:_n,typed:K}),gm=b1({DenseMatrix:ar,concat:br,config:Be,matrix:Ge,typed:K}),UU=l1({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K,zeros:ii}),KT=a1({DenseMatrix:ar,divideScalar:cn,equalScalar:cr,matrix:Ge,multiplyScalar:_n,subtractScalar:Pa,typed:K}),rv=Iw({flatten:hf,matrix:Ge,size:ni,typed:K}),qU=t_({BigNumber:je,concat:br,equalScalar:cr,matrix:Ge,typed:K}),zU=M_({BigNumber:je,config:Be,matrix:Ge,typed:K}),nv=WS({addScalar:Vn,complex:mm,conj:ku,divideScalar:cn,equal:ka,identity:Ws,isZero:ho,matrix:Ge,multiplyScalar:_n,sign:WT,sqrt:go,subtractScalar:Pa,typed:K,unaryMinus:$o,zeros:ii}),HU=C_({config:Be,matrix:Ge}),GU=c1({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K,zeros:ii}),Ll=K_({BigNumber:je,DenseMatrix:ar,config:Be,equalScalar:cr,matrix:Ge,typed:K,zeros:ii}),Ni=v1({DenseMatrix:ar,concat:br,config:Be,matrix:Ge,typed:K}),Sn=a_({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,subtractScalar:Pa,typed:K,unaryMinus:$o}),WU=j_({concat:br,matrix:Ge,typed:K}),iv=kw({config:Be,numeric:Ba,typed:K}),av=o1({DenseMatrix:ar,divideScalar:cn,equalScalar:cr,matrix:Ge,multiplyScalar:_n,subtractScalar:Pa,typed:K}),YU=v_({DenseMatrix:ar,concat:br,matrix:Ge,typed:K}),hr=hS({DenseMatrix:ar,SparseMatrix:is,addScalar:Vn,concat:br,equalScalar:cr,matrix:Ge,typed:K}),jU=G1({BigNumber:je,DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K}),ZU=Lp({concat:br,equalScalar:cr,matrix:Ge,typed:K}),JU=Vp({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K}),XU=f_({DenseMatrix:ar,concat:br,matrix:Ge,typed:K}),QU=VA({addScalar:Vn,combinations:pm,divideScalar:cn,isInteger:Wi,isNegative:Gs,multiplyScalar:_n,typed:K}),Lu=p1({BigNumber:je,DenseMatrix:ar,Fraction:Bu,concat:br,config:Be,equalScalar:cr,matrix:Ge,typed:K}),eM=d1({concat:br,matrix:Ge,typed:K}),KU=im({add:hr,typed:K,unaryPlus:iv}),ov=w1({equal:ka,typed:K}),e5=Yp({matrix:Ge,number:ns,subtract:Sn,typed:K}),t5=dA({abs:Ci,addScalar:Vn,deepEqual:ov,divideScalar:cn,multiplyScalar:_n,sqrt:go,subtractScalar:Pa,typed:K}),vm=yS({addScalar:Vn,conj:ku,multiplyScalar:_n,size:ni,typed:K}),r5=g1({compareText:eM,isZero:ho,typed:K}),tM=Op({DenseMatrix:ar,config:Be,equalScalar:cr,matrix:Ge,round:Ll,typed:K,zeros:ii}),n5=Zw({BigNumber:je,DenseMatrix:ar,concat:br,config:Be,equalScalar:cr,matrix:Ge,round:Ll,typed:K,zeros:ii}),i5=gS({abs:Ci,addScalar:Vn,divideScalar:cn,isPositive:$u,multiplyScalar:_n,smaller:Ni,sqrt:go,typed:K}),rM=E1({DenseMatrix:ar,smaller:Ni}),hi=T1({ImmutableDenseMatrix:rM,getMatrixDataType:Xg}),Fi=x1({DenseMatrix:ar,concat:br,config:Be,matrix:Ge,typed:K}),sv=e1({Complex:Gr,config:Be,divideScalar:cn,typed:K}),a5=s1({DenseMatrix:ar,divideScalar:cn,equalScalar:cr,matrix:Ge,multiplyScalar:_n,subtractScalar:Pa,typed:K}),o5=Fw({flatten:hf,matrix:Ge,size:ni,typed:K}),s5=em({config:Be,numeric:Ba,smaller:Ni,typed:K}),nM=Rp({DenseMatrix:ar,concat:br,config:Be,equalScalar:cr,matrix:Ge,round:Ll,typed:K,zeros:ii}),Pr=e_({addScalar:Vn,dot:vm,equalScalar:cr,matrix:Ge,multiplyScalar:_n,typed:K}),u5=r1({Complex:Gr,config:Be,divideScalar:cn,typed:K}),l5=Up({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K}),ym=S1({compare:Lu,isNaN:vf,isNumeric:Ru,typed:K}),c5=f1({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K,zeros:ii}),iM=jS({SparseMatrix:is,abs:Ci,add:hr,divideScalar:cn,larger:Fi,largerEq:gm,multiply:Pr,subtract:Sn,transpose:yf,typed:K}),da=Jp({add:hr,matrix:Ge,typed:K,zeros:ii}),uv=nm({add:hr,config:Be,numeric:Ba,typed:K}),f5=xS({add:hr,matrix:Ge,typed:K}),aM=u1({DenseMatrix:ar,divideScalar:cn,equalScalar:cr,matrix:Ge,multiplyScalar:_n,subtractScalar:Pa,typed:K}),p5=QA({Complex:Gr,add:hr,multiply:Pr,number:ns,typed:K}),lv=Uw({DenseMatrix:ar,config:Be,equalScalar:cr,matrix:Ge,round:Ll,typed:K,zeros:ii}),Oo=m1({compare:Lu,typed:K}),m5=UA({addScalar:Vn,combinations:pm,isInteger:Wi,isNegative:Gs,isPositive:$u,larger:Fi,typed:K}),d5=x_({matrix:Ge,multiply:Pr,subtract:Sn,typed:K}),oM=iA({divideScalar:cn,isZero:ho,matrix:Ge,multiply:Pr,subtractScalar:Pa,typed:K,unaryMinus:$o}),h5=u_({concat:br,equalScalar:cr,matrix:Ge,multiplyScalar:_n,typed:K}),sM=M1({larger:Fi,smaller:Ni}),uM=Ww({Complex:Gr,DenseMatrix:ar,ceil:lv,equalScalar:cr,floor:tM,matrix:Ge,typed:K,zeros:ii}),lM=bS({Index:hi,typed:K}),g5=hA({abs:Ci,add:hr,addScalar:Vn,config:Be,divideScalar:cn,equalScalar:cr,flatten:hf,isNumeric:Ru,isZero:ho,matrix:Ge,multiply:Pr,multiplyScalar:_n,smaller:Ni,subtract:Sn,typed:K}),v5=s_({BigNumber:je,add:hr,config:Be,equal:ka,isInteger:Wi,mod:nM,smaller:Ni,typed:K,xgcd:JT}),y5=Jw({concat:br,equalScalar:cr,matrix:Ge,typed:K}),x5=t1({Complex:Gr,config:Be,divideScalar:cn,log:sv,typed:K}),cv=Kp({config:Be,larger:Fi,numeric:Ba,typed:K}),b5=aS({DenseMatrix:ar,Index:hi,compareNatural:Oo,size:ni,subset:da,typed:K}),w5=sS({DenseMatrix:ar,Index:hi,compareNatural:Oo,size:ni,subset:da,typed:K}),_5=lS({Index:hi,compareNatural:Oo,size:ni,subset:da,typed:K}),S5=fS({Index:hi,compareNatural:Oo,size:ni,subset:da,typed:K}),Vl=y1({DenseMatrix:ar,concat:br,config:Be,matrix:Ge,typed:K}),A5=A1({compare:Lu,compareNatural:Oo,matrix:Ge,typed:K}),E5=_1({DenseMatrix:ar,concat:br,config:Be,equalScalar:cr,matrix:Ge,typed:K}),T5=Qp({concat:br,equalScalar:cr,matrix:Ge,not:dm,typed:K,zeros:ii}),Ul=jp({bignumber:ma,matrix:Ge,add:hr,config:Be,isPositive:$u,larger:Fi,largerEq:gm,smaller:Ni,smallerEq:Vl,typed:K}),M5=Zp({Index:hi,matrix:Ge,range:Ul,typed:K}),cM=oS({DenseMatrix:ar,Index:hi,compareNatural:Oo,size:ni,subset:da,typed:K}),D5=cS({Index:hi,compareNatural:Oo,size:ni,subset:da,typed:K}),fM=mS({Index:hi,concat:br,setDifference:cM,size:ni,subset:da,typed:K}),pM=D1({FibonacciHeap:sM,addScalar:Vn,equalScalar:cr}),mM=zp({Index:hi,matrix:Ge,range:Ul,typed:K}),Vu=aA({abs:Ci,addScalar:Vn,det:oM,divideScalar:cn,identity:Ws,matrix:Ge,multiply:Pr,typed:K,unaryMinus:$o}),dM=GS({DenseMatrix:ar,Spa:pM,SparseMatrix:is,abs:Ci,addScalar:Vn,divideScalar:cn,equalScalar:cr,larger:Fi,matrix:Ge,multiplyScalar:_n,subtractScalar:Pa,typed:K,unaryMinus:$o}),C5=oA({Complex:Gr,add:hr,ctranspose:tv,deepEqual:ov,divideScalar:cn,dot:vm,dotDivide:xf,equal:ka,inv:Vu,matrix:Ge,multiply:Pr,typed:K}),$a=Q_({Complex:Gr,config:Be,fraction:Rl,identity:Ws,inv:Vu,matrix:Ge,multiply:Pr,number:ns,typed:K}),hM=uS({DenseMatrix:ar,Index:hi,compareNatural:Oo,size:ni,subset:da,typed:K}),N5=dS({Index:hi,concat:br,setIntersect:hM,setSymDifference:fM,size:ni,subset:da,typed:K}),F5=lA({abs:Ci,add:hr,identity:Ws,inv:Vu,map:Ou,max:cv,multiply:Pr,size:ni,sqrt:go,subtract:Sn,typed:K}),Lt=N1({BigNumber:je,Complex:Gr,Fraction:Bu,abs:Ci,addScalar:Vn,config:Be,divideScalar:cn,equal:ka,fix:uM,format:gf,isNumeric:Ru,multiplyScalar:_n,number:ns,pow:$a,round:Ll,subtractScalar:Pa}),I5=EE({BigNumber:je,Unit:Lt,config:Be}),P5=oT({BigNumber:je,Unit:Lt,config:Be}),B5=jE({BigNumber:je,Unit:Lt,config:Be}),k5=DE({BigNumber:je,Unit:Lt,config:Be}),$5=JE({BigNumber:je,Unit:Lt,config:Be}),O5=CE({BigNumber:je,Unit:Lt,config:Be}),R5=TE({BigNumber:je,Unit:Lt,config:Be}),L5=UE({BigNumber:je,Unit:Lt,config:Be}),V5=n1({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,pow:$a,typed:K}),U5=AE({BigNumber:je,Unit:Lt,config:Be}),q5=ME({BigNumber:je,Unit:Lt,config:Be}),z5=uA({abs:Ci,add:hr,identity:Ws,inv:Vu,multiply:Pr,typed:K}),H5=XE({BigNumber:je,Unit:Lt,config:Be}),gM=O_({addScalar:Vn,ceil:lv,conj:ku,divideScalar:cn,dotDivide:xf,exp:HT,i:VT,log2:GT,matrix:Ge,multiplyScalar:_n,pow:$a,tau:qT,typed:K}),fv=_A({BigNumber:je,Complex:Gr,config:Be,multiplyScalar:_n,pow:$a,typed:K}),G5=bE({BigNumber:je,Unit:Lt,config:Be}),W5=LE({BigNumber:je,Unit:Lt,config:Be}),Y5=R_({conj:ku,dotDivide:xf,fft:gM,typed:K}),j5=PE({BigNumber:je,Unit:Lt,config:Be}),Z5=KE({BigNumber:je,Unit:Lt,config:Be}),J5=SE({BigNumber:je,Unit:Lt,config:Be}),X5=sT({BigNumber:je,Unit:Lt,config:Be}),Q5=tT({BigNumber:je,Unit:Lt,config:Be}),K5=qE({BigNumber:je,Unit:Lt,config:Be}),e8=IE({BigNumber:je,Unit:Lt,config:Be}),t8=mT({BigNumber:je,Unit:Lt,config:Be}),r8=cT({BigNumber:je,Unit:Lt,config:Be}),n8=dT({BigNumber:je,Unit:Lt,config:Be}),i8=VE({BigNumber:je,Unit:Lt,config:Be}),a8=zE({BigNumber:je,Unit:Lt,config:Be}),o8=_E({BigNumber:je,Unit:Lt,config:Be}),s8=HE({BigNumber:je,Unit:Lt,config:Be}),u8=iT({BigNumber:je,Unit:Lt,config:Be}),l8=xE({BigNumber:je,Unit:Lt,config:Be}),c8=aT({BigNumber:je,Unit:Lt,config:Be}),f8=GE({BigNumber:je,Unit:Lt,config:Be}),p8=ZE({BigNumber:je,Unit:Lt,config:Be}),m8=BE({BigNumber:je,Unit:Lt,config:Be}),d8=P1({Unit:Lt,typed:K}),Jn=mA({divideScalar:cn,equalScalar:cr,inv:Vu,matrix:Ge,multiply:Pr,typed:K}),h8=$E({BigNumber:je,Unit:Lt,config:Be}),bf=AA({gamma:fv,typed:K}),g8=QE({BigNumber:je,Unit:Lt,config:Be}),v8=lT({BigNumber:je,Unit:Lt,config:Be}),y8=NE({BigNumber:je,Unit:Lt,config:Be}),vM=JS({DenseMatrix:ar,lsolve:KT,lup:dM,matrix:Ge,slu:iM,typed:K,usolve:av}),x8=FE({BigNumber:je,Unit:Lt,config:Be}),b8=uT({BigNumber:je,Unit:Lt,config:Be}),w8=TA({add:hr,divide:Jn,factorial:bf,isInteger:Wi,isPositive:$u,multiply:Pr,typed:K}),_8=MA({factorial:bf,typed:K}),S8=fT({BigNumber:je,Unit:Lt,config:Be}),A8=XS({add:hr,cbrt:XT,divide:Jn,equalScalar:cr,im:Qg,isZero:ho,multiply:Pr,re:Kg,sqrt:go,subtract:Sn,typeOf:YT,typed:K,unaryMinus:$o}),E8=pS({compareNatural:Oo,typed:K}),T8=L_({abs:Ci,add:hr,bignumber:ma,divide:Jn,isNegative:Gs,isPositive:$u,larger:Fi,map:Ou,matrix:Ge,max:cv,multiply:Pr,smaller:Ni,subtract:Sn,typed:K,unaryMinus:$o}),yM=RA({bignumber:ma,addScalar:Vn,combinations:pm,divideScalar:cn,factorial:bf,isInteger:Wi,isNegative:Gs,larger:Fi,multiplyScalar:_n,number:ns,pow:$a,subtractScalar:Pa,typed:K}),M8=F1({Unit:Lt,typed:K}),D8=LA({addScalar:Vn,isInteger:Wi,isNegative:Gs,stirlingS2:yM,typed:K}),xM=sA({abs:Ci,add:hr,addScalar:Vn,atan:zT,bignumber:ma,column:mM,complex:mm,config:Be,cos:Jg,diag:QT,divideScalar:cn,dot:vm,equal:ka,flatten:hf,im:Qg,inv:Vu,larger:Fi,matrix:Ge,matrixFromColumns:rv,multiply:Pr,multiplyScalar:_n,number:ns,qr:nv,re:Kg,reshape:ZT,sin:hm,size:ni,smaller:Ni,sqrt:go,subtract:Sn,typed:K,usolve:av,usolveAll:aM}),C8=OE({BigNumber:je,Unit:Lt,config:Be}),N8=eT({BigNumber:je,Unit:Lt,config:Be}),F8=EA({divide:Jn,dotDivide:xf,isNumeric:Ru,log:sv,map:Ou,matrix:Ge,multiply:Pr,sum:uv,typed:K}),bM=am({add:hr,divide:Jn,typed:K}),I8=rT({BigNumber:je,Unit:Lt,config:Be}),P8=wE({BigNumber:je,Unit:Lt,config:Be}),B8=sm({bignumber:ma,add:hr,compare:Lu,divide:Jn,isInteger:Wi,larger:Fi,multiply:Pr,partitionSelect:ym,smaller:Ni,smallerEq:Vl,subtract:Sn,typed:K}),pv=om({add:hr,apply:ev,divide:Jn,isNaN:vf,multiply:Pr,subtract:Sn,typed:K}),k8=kE({BigNumber:je,Unit:Lt,config:Be}),wM=gA({add:hr,compare:Lu,divide:Jn,partitionSelect:ym,typed:K}),$8=xA({add:hr,divide:Jn,matrix:Ge,mean:bM,multiply:Pr,pow:$a,sqrt:go,subtract:Sn,sum:uv,typed:K}),O8=KA({Complex:Gr,add:hr,divide:Jn,matrix:Ge,multiply:Pr,typed:K}),R8=vA({abs:Ci,map:Ou,median:wM,subtract:Sn,typed:K}),L8=um({map:Ou,sqrt:go,typed:K,variance:pv}),V8=U_({BigNumber:je,Complex:Gr,add:hr,config:Be,divide:Jn,equal:ka,factorial:bf,gamma:fv,isNegative:Gs,multiply:Pr,pi:Zg,pow:$a,sin:hm,smallerEq:Vl,subtract:Sn,typed:K}),mv=vS({abs:Ci,add:hr,conj:ku,ctranspose:tv,eigs:xM,equalScalar:cr,larger:Fi,matrix:Ge,multiply:Pr,pow:$a,smaller:Ni,sqrt:go,typed:K}),_M=F_({BigNumber:je,DenseMatrix:ar,SparseMatrix:is,addScalar:Vn,config:Be,cos:Jg,matrix:Ge,multiplyScalar:_n,norm:mv,sin:hm,typed:K,unaryMinus:$o}),U8=pT({BigNumber:je,Unit:Lt,config:Be}),SM=fA({identity:Ws,matrix:Ge,multiply:Pr,norm:mv,qr:nv,subtract:Sn,typed:K}),q8=N_({multiply:Pr,rotationMatrix:_M,typed:K}),AM=cA({abs:Ci,add:hr,concat:br,identity:Ws,index:lM,lusolve:vM,matrix:Ge,matrixFromColumns:rv,multiply:Pr,range:Ul,schur:SM,subset:da,subtract:Sn,transpose:yf,typed:K}),z8=pA({matrix:Ge,multiply:Pr,sylvester:AM,transpose:yf,typed:K});var wf={},_f={},H8={},Ii=wS({mathWithTransform:_f}),Sf=PS({Node:Ii}),Ys=BS({Node:Ii}),ql=kS({Node:Ii}),G8=OS({Node:Ii}),Af=SS({Node:Ii}),W8=ES({Node:Ii,ResultSet:UT}),Y8=TS({Node:Ii}),Uu=NS({Node:Ii}),j8=$S({Node:Ii}),Lne=eE({classes:H8}),EM=KS({math:wf,typed:K}),Z8=FS({Node:Ii,typed:K}),Vne=nA({Chain:EM,typed:K}),Ef=IS({Node:Ii,size:ni}),Tf=_S({Node:Ii,subset:da}),J8=AS({matrix:Ge,Node:Ii,subset:da}),qu=RS({Unit:Lt,Node:Ii,math:wf}),zu=LS({Node:Ii,SymbolNode:qu,math:wf}),as=VS({AccessorNode:Tf,ArrayNode:Af,AssignmentNode:J8,BlockNode:W8,ConditionalNode:Y8,ConstantNode:Uu,FunctionAssignmentNode:Z8,FunctionNode:zu,IndexNode:Ef,ObjectNode:Sf,OperatorNode:Ys,ParenthesisNode:ql,RangeNode:j8,RelationalNode:G8,SymbolNode:qu,config:Be,numeric:Ba,typed:K}),X8=jA({ConstantNode:Uu,FunctionNode:zu,OperatorNode:Ys,ParenthesisNode:ql,parse:as,typed:K}),TM=WA({bignumber:ma,fraction:Rl,AccessorNode:Tf,ArrayNode:Af,ConstantNode:Uu,FunctionNode:zu,IndexNode:Ef,ObjectNode:Sf,OperatorNode:Ys,SymbolNode:qu,config:Be,mathWithTransform:_f,matrix:Ge,typed:K}),MM=US({parse:as,typed:K}),DM=YA({AccessorNode:Tf,ArrayNode:Af,ConstantNode:Uu,FunctionNode:zu,IndexNode:Ef,ObjectNode:Sf,OperatorNode:Ys,ParenthesisNode:ql,SymbolNode:qu,add:hr,divide:Jn,equal:ka,isZero:ho,multiply:Pr,parse:as,pow:$a,subtract:Sn,typed:K}),CM=qS({parse:as,typed:K}),Q8=QS({evaluate:CM}),K8=zS({evaluate:CM}),dv=GA({bignumber:ma,fraction:Rl,AccessorNode:Tf,ArrayNode:Af,ConstantNode:Uu,FunctionNode:zu,IndexNode:Ef,ObjectNode:Sf,OperatorNode:Ys,ParenthesisNode:ql,SymbolNode:qu,add:hr,config:Be,divide:Jn,equal:ka,isZero:ho,mathWithTransform:_f,matrix:Ge,multiply:Pr,parse:as,pow:$a,resolve:X8,simplifyConstant:TM,simplifyCore:DM,subtract:Sn,typed:K}),Une=ZA({OperatorNode:Ys,parse:as,simplify:dv,typed:K}),qne=qA({parse:as,typed:K}),zne=HS({Parser:K8,typed:K}),Hne=XA({bignumber:ma,fraction:Rl,AccessorNode:Tf,ArrayNode:Af,ConstantNode:Uu,FunctionNode:zu,IndexNode:Ef,ObjectNode:Sf,OperatorNode:Ys,ParenthesisNode:ql,SymbolNode:qu,add:hr,config:Be,divide:Jn,equal:ka,isZero:ho,mathWithTransform:_f,matrix:Ge,multiply:Pr,parse:as,pow:$a,simplify:dv,simplifyConstant:TM,simplifyCore:DM,subtract:Sn,typed:K}),Gne=JA({ConstantNode:Uu,FunctionNode:zu,OperatorNode:Ys,ParenthesisNode:ql,SymbolNode:qu,config:Be,equal:ka,isZero:ho,numeric:Ba,parse:as,simplify:dv,typed:K}),Wne=rA({Help:Q8,mathWithTransform:_f,typed:K});rn(wf,{e:LT,false:AV,fineStructure:EV,i:VT,Infinity:TV,LN10:MV,LOG10E:DV,NaN:CV,null:NV,phi:FV,SQRT1_2:PV,sackurTetrode:BV,tau:qT,true:kV,E:LT,version:$V,efimovFactor:OV,LN2:RV,pi:Zg,replacer:LV,reviver:Lne,SQRT2:VV,typed:K,PI:Zg,weakMixingAngle:UV,abs:Ci,acos:qV,acot:zV,acsc:HV,addScalar:Vn,arg:GV,asech:WV,asinh:YV,atan:zT,atanh:jV,bigint:ZV,bitNot:JV,boolean:XV,clone:QV,combinations:pm,complex:mm,conj:ku,cos:Jg,cot:KV,csc:eU,cube:tU,equalScalar:cr,erf:rU,exp:HT,expm1:nU,filter:iU,flatten:hf,forEach:aU,format:gf,getMatrixDataType:Xg,hex:oU,im:Qg,isInteger:Wi,isNegative:Gs,isPositive:$u,isZero:ho,LOG2E:sU,lgamma:uU,log10:lU,log2:GT,map:Ou,multiplyScalar:_n,not:dm,number:ns,oct:cU,pickRandom:fU,print:pU,random:mU,re:Kg,sec:dU,sign:WT,sin:hm,splitUnit:hU,square:gU,string:vU,subtractScalar:Pa,tan:yU,typeOf:YT,acosh:xU,acsch:bU,apply:ev,asec:wU,bignumber:ma,chain:Vne,combinationsWithRep:_U,cosh:SU,csch:AU,isNaN:vf,isPrime:EU,randomInt:TU,sech:MU,sinh:DU,sparse:CU,sqrt:go,squeeze:NU,tanh:FU,unaryMinus:$o,acoth:IU,bin:PU,coth:BU,fraction:Rl,isNumeric:Ru,matrix:Ge,matrixFromFunction:kU,mode:$U,numeric:Ba,prod:jT,reshape:ZT,size:ni,transpose:yf,xgcd:JT,zeros:ii,asin:OU,cbrt:XT,concat:br,count:RU,ctranspose:tv,diag:QT,divideScalar:cn,dotDivide:xf,equal:ka,hasNumericValue:LU,identity:Ws,kron:VU,largerEq:gm,leftShift:UU,lsolve:KT,matrixFromColumns:rv,nthRoot:qU,ones:zU,qr:nv,resize:HU,rightArithShift:GU,round:Ll,smaller:Ni,subtract:Sn,to:WU,unaryPlus:iv,usolve:av,xor:YU,add:hr,atan2:jU,bitAnd:ZU,bitOr:JU,bitXor:XU,catalan:QU,compare:Lu,compareText:eM,cumsum:KU,deepEqual:ov,diff:e5,distance:t5,dot:vm,equalText:r5,floor:tM,gcd:n5,hypot:i5,larger:Fi,log:sv,lsolveAll:a5,matrixFromRows:o5,min:s5,mod:nM,multiply:Pr,nthRoots:u5,or:l5,partitionSelect:ym,rightLogShift:c5,slu:iM,subset:da,sum:uv,trace:f5,usolveAll:aM,zpk2tf:p5,ceil:lv,compareNatural:Oo,composition:m5,cross:d5,det:oM,dotMultiply:h5,fix:uM,index:lM,intersect:g5,invmod:v5,lcm:y5,log1p:x5,max:cv,setCartesian:b5,setDistinct:w5,setIsSubset:_5,setPowerset:S5,smallerEq:Vl,sort:A5,unequal:E5,and:T5,range:Ul,row:M5,setDifference:cM,setMultiplicity:D5,setSymDifference:fM,column:mM,inv:Vu,lup:dM,pinv:C5,pow:$a,setIntersect:hM,setUnion:N5,sqrtm:F5,vacuumImpedance:I5,wienDisplacement:P5,atomicMass:B5,bohrMagneton:k5,boltzmann:$5,conductanceQuantum:O5,coulomb:R5,deuteronMass:L5,dotPow:V5,electricConstant:U5,elementaryCharge:q5,expm:z5,faraday:H5,fft:gM,gamma:fv,gravitationConstant:G5,hartreeEnergy:W5,ifft:Y5,klitzing:j5,loschmidt:Z5,magneticConstant:J5,molarMass:X5,molarPlanckConstant:Q5,neutronMass:K5,nuclearMagneton:e8,planckCharge:t8,planckLength:r8,planckTemperature:n8,protonMass:i8,quantumOfCirculation:a8,reducedPlanckConstant:o8,rydberg:s8,secondRadiation:u8,speedOfLight:l8,stefanBoltzmann:c8,thomsonCrossSection:f8,avogadro:p8,bohrRadius:m8,createUnit:d8,divide:Jn,electronMass:h8,factorial:bf,firstRadiation:g8,gravity:v8,inverseConductanceQuantum:y8,lusolve:vM,magneticFluxQuantum:x8,molarMassC12:b8,multinomial:w8,parse:as,permutations:_8,planckMass:S8,polynomialRoot:A8,resolve:X8,setSize:E8,simplifyConstant:TM,solveODE:T8,stirlingS2:yM,unit:M8,bellNumbers:D8,compile:MM,eigs:xM,fermiCoupling:C8,gasConstant:N8,kldivergence:F8,mean:bM,molarVolume:I8,planckConstant:P8,quantileSeq:B8,simplifyCore:DM,variance:pv,classicalElectronRadius:k8,evaluate:CM,median:wM,simplify:dv,symbolicEqual:Une,corr:$8,freqz:O8,leafCount:qne,mad:R8,parser:zne,rationalize:Hne,std:L8,zeta:V8,derivative:Gne,norm:mv,rotationMatrix:_M,help:Wne,planckTime:U8,schur:SM,rotate:q8,sylvester:AM,lyap:z8,config:Be});rn(_f,wf,{filter:vT({typed:K}),forEach:yT({typed:K}),map:bT({typed:K}),apply:hT({isInteger:Wi,typed:K}),or:$T({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K}),and:kT({add:hr,concat:br,equalScalar:cr,matrix:Ge,not:dm,typed:K,zeros:ii}),concat:MT({isInteger:Wi,matrix:Ge,typed:K}),max:wT({config:Be,larger:Fi,numeric:Ba,typed:K}),print:BT({add:hr,matrix:Ge,typed:K,zeros:ii}),bitAnd:OT({add:hr,concat:br,equalScalar:cr,matrix:Ge,not:dm,typed:K,zeros:ii}),diff:DT({bignumber:ma,matrix:Ge,number:ns,subtract:Sn,typed:K}),min:ST({config:Be,numeric:Ba,smaller:Ni,typed:K}),subset:TT({add:hr,matrix:Ge,typed:K,zeros:ii}),bitOr:RT({DenseMatrix:ar,concat:br,equalScalar:cr,matrix:Ge,typed:K}),cumsum:IT({add:hr,typed:K,unaryPlus:iv}),index:xT({Index:hi,getMatrixDataType:Xg}),sum:NT({add:hr,config:Be,numeric:Ba,typed:K}),range:AT({bignumber:ma,matrix:Ge,add:hr,config:Be,isPositive:$u,larger:Fi,largerEq:gm,smaller:Ni,smallerEq:Vl,typed:K}),row:ET({Index:hi,matrix:Ge,range:Ul,typed:K}),column:gT({Index:hi,matrix:Ge,range:Ul,typed:K}),mean:_T({add:hr,divide:Jn,typed:K}),quantileSeq:FT({add:hr,bignumber:ma,compare:Lu,divide:Jn,isInteger:Wi,larger:Fi,multiply:Pr,partitionSelect:ym,smaller:Ni,smallerEq:Vl,subtract:Sn,typed:K}),variance:PT({add:hr,apply:ev,divide:Jn,isNaN:vf,multiply:Pr,subtract:Sn,typed:K}),std:CT({map:Ou,sqrt:go,typed:K,variance:pv})});rn(H8,{BigNumber:je,Complex:Gr,Fraction:Bu,Matrix:fm,Node:Ii,ObjectNode:Sf,OperatorNode:Ys,ParenthesisNode:ql,Range:IV,RelationalNode:G8,ResultSet:UT,ArrayNode:Af,BlockNode:W8,ConditionalNode:Y8,ConstantNode:Uu,DenseMatrix:ar,RangeNode:j8,Chain:EM,FunctionAssignmentNode:Z8,SparseMatrix:is,IndexNode:Ef,ImmutableDenseMatrix:rM,Index:hi,AccessorNode:Tf,AssignmentNode:J8,FibonacciHeap:sM,Spa:pM,Unit:Lt,SymbolNode:qu,FunctionNode:zu,Help:Q8,Parser:K8});EM.createProxy(wf);var hv=class extends Xo{constructor(e){super(e),this.hidden=!1,this.hasError=!1}buildVariables(){let e=0;this.expressionStr="",this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!="string"){let n={bindTargetDeclaration:t,inputSignal:new Zr(void 0),uuid:qr(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.expressionStr+=n.contextName,e+=1}else this.expressionStr+=t;this.expression=MM(this.expressionStr)}buildMathJSContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.inputSignal||(e[t.contextName]=t.inputSignal.get()??"");return e}computeValue(){if(this.hasError=!1,!this.expression)return this.handleComputeError(new bo({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{let t=this.expression.evaluate(e);return typeof t=="string"?Ta(t):t}catch(t){return t instanceof Error?this.handleComputeError(new bo({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:t,context:{expression:this.expressionStr,context:e}})):this.handleComputeError(new Error("failed to evaluate js expression because of: unexpected thrown value"))}}onInitialRender(e){}onRerender(e,t){this.hasError?ct.addClass(e,"mb-error"):ct.removeClass(e,"mb-error"),e.innerText=t}handleComputeError(e){return this.hasError=!0,console.warn(e),e.message}};var gv=class extends Xo{constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){this.textParts=[];let e=0;this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!="string"){let n={bindTargetDeclaration:t,inputSignal:new Zr(void 0),uuid:qr(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.textParts.push(e),e+=1}else this.textParts.push(t)}computeValue(){if(!this.textParts)throw new bo({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="number"?Dd(this.variables[e].inputSignal.get(),this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty):e).join("")}onInitialRender(e){this.renderMarkdown=this.mountable.getArgument("renderMarkdown")?.value??!1,this.renderMarkdown&&ct.addClass(e,"mb-view-markdown")}async onRerender(e,t){this.renderMarkdown?(this.markdownUnloadCallback?.(),this.markdownUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(t,e,this.mountable.getFilePath())):e.innerText=t}onUnmount(){super.onUnmount(),this.markdownUnloadCallback?.()}};var vv=class{constructor(e){this.plugin=e}createViewField(e){let t=e.declaration.viewFieldType;if(t==="math")return new hv(e);if(t==="text")return new gv(e);if(t==="link")return new Ph(e);if(t==="image")return new Fh(e);}};var yv=class extends $n{constructor(e,t,n,i,a){super(e,t,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Xt(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),ct.empty(e),ct.addClass(e,"mb-view"),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=document.createElement("div");ct.addClass(t,"mb-view-wrapper");try{this.viewField?.mount(t)}catch(i){this.errorCollection.add(i)}this.createErrorIndicator(e),e.append(t);let n=this.getArguments("class");for(let i of n)ct.addClasses(t,i.value);ct.addClass(t,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType==="block"?ct.addClass(e,"mb-view-block"):ct.addClass(e,"mb-view-inline")}onUnmount(e){super.onUnmount(e),this.viewField?.unmount(),gi(e,"view field")}};var xv=class{constructor(e){this.plugin=e}fromString(e){return Gn(qo,e)}fromStringAndValidate(e,t,n){return this.validate(e,this.fromString(e),t,n)}fromExistingDeclaration(e){if(e!==void 0)return{storageType:wa(e.storageType),storagePath:wa(e.storagePath),storageProp:e.storageProp.path.map(t=>({type:t.type,prop:wa(t.prop)})),listenToChildren:e.listenToChildren}}validate(e,t,n,i){let a={};a.listenToChildren=t.listenToChildren,a.storageProp=new lu(t.storageProp.map(s=>new el(s.type,s.prop.value))),t.storageType===void 0?a.storageType=this.plugin.metadataManager.defaultSource:a.storageType=this.validateStorageType(t.storageType,e);let o=t.storagePath!==void 0,u=t.storagePath??{value:n},c=this.plugin.metadataManager.getSource(a.storageType);if(c===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=c.validateStoragePath(u,o,e,this),c.resolveBindTargetScope(a,i,this)}resolveScope(e,t){if(t===void 0)throw new Bn("ERROR","Bind Target Scope Validator","Failed to resolve bind target scope, no scope provided");return e.storageType=t.scope.storageType,e.storagePath=t.scope.storagePath,e.storageProp=t.scope.storageProp.concat(e.storageProp),e}validateStorageType(e,t){for(let n of this.plugin.metadataManager.iterateSources())if(n===e.value)return n;throw new Bn("ERROR","Bind Target Validator",`Encountered invalid identifier. Expected token to be a storage type but received '${e?.value}'.`,t,e?.position)}validateStoragePathAsFilePath(e,t){let n=e?.value;if(n===void 0)throw new Bn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",t,e?.position);let i=this.plugin.internal.file.getPathByName(n);if(i===void 0)throw new Bn("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${n}' not found.`,t,e?.position);return i}};var n6=Or(va()),xm=Or(Xi());function FM(r){return r instanceof Error&&r.name==="ZodError"&&"issues"in r&&Array.isArray(r.issues)}var NM=class extends Error{name;details;constructor(r,e){super(r,e),this.name="ZodValidationError",this.details=Yne(e)}toString(){return this.message}};function Yne(r){if(r){let e=r.cause;if(FM(e))return e.issues}return[]}function e6(r){return r.length!==0}var jne=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function Zne(r){return r.length===1?r[0].toString():r.reduce((e,t)=>{if(typeof t=="number")return e+"["+t.toString()+"]";if(t.includes('"'))return e+'["'+Jne(t)+'"]';if(!jne.test(t))return e+'["'+t+'"]';let n=e.length===0?"":".";return e+n+t},"")}function Jne(r){return r.replace(/"/g,'\\"')}var Xne="; ",Qne=99,t6="Validation error",Kne=": ",eie=", or ";function tie(r={}){let{issueSeparator:e=Xne,unionSeparator:t=eie,prefixSeparator:n=Kne,prefix:i=t6,includePath:a=!0,maxIssuesInMessage:o=Qne}=r;return u=>{let c=u.slice(0,o).map(s=>bv({issue:s,issueSeparator:e,unionSeparator:t,includePath:a})).join(e);return rie(c,i,n)}}function bv(r){let{issue:e,issueSeparator:t,unionSeparator:n,includePath:i}=r;if(e.code===We.invalid_union)return e.unionErrors.reduce((a,o)=>{let u=o.issues.map(c=>bv({issue:c,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return a.includes(u)||a.push(u),a},[]).join(n);if(e.code===We.invalid_arguments)return[e.message,...e.argumentsError.issues.map(a=>bv({issue:a,issueSeparator:t,unionSeparator:n,includePath:i}))].join(t);if(e.code===We.invalid_return_type)return[e.message,...e.returnTypeError.issues.map(a=>bv({issue:a,issueSeparator:t,unionSeparator:n,includePath:i}))].join(t);if(i&&e6(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 "${Zne(e.path)}"`}return e.message}function rie(r,e,t){return e!==null?r.length>0?[e,r].join(t):e:r.length>0?r:t6}function wv(r,e={}){if(!FM(r))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${aie.name}" method instead?`);return r6(r,e)}function r6(r,e={}){let t=r.errors,n;return e6(t)?n=nie(e)(t):n=r.message,new NM(n,{cause:r})}function nie(r){return"messageBuilder"in r?r.messageBuilder:tie(r)}var iie=(r={})=>e=>FM(e)?r6(e,r):e instanceof Error?new NM(e.message,{cause:e}):new NM("Unknown error");function aie(r,e={}){return iie(e)(r)}var oie=xm.P.sequenceMap((r,e)=>e,xm.P.string("BUTTON"),xm.P.manyNotOf("[],^").separateBy(xm.P.string(",").trim(n6.P_UTILS.optionalWhitespace())).wrapString("[","]")),_v=class{constructor(e){this.plugin=e}fromGroupString(e){let t=new Xt("ButtonGroup"),n=[];try{n=Gn(oie,e)}catch(i){t.add(i)}return{declarationString:e,referencedButtonIds:n,errorCollection:t}}validateGroup(e){return{declarationString:void 0,referencedButtonIds:e.referencedButtonIds,errorCollection:new Xt("ButtonGroup")}}fromString(e){let t=new Xt("Button"),n;try{let i=this.plugin.internal.parseYaml(e);n=this.validateConfig(i)}catch(i){t.add(i)}return{declarationString:e,config:n,errorCollection:t}}validateConfig(e){let t=KN(_c,e);if(!t.success){let n=wv(t.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null,includePath:!1});throw new vs({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:[Yt.linkToButtonConfig()]})}return t.data}validate(e){let t=new Xt("Button"),n;try{n=this.validateConfig(e)}catch(i){t.add(i)}return{declarationString:void 0,config:n,errorCollection:t}}};var Mf=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let t of Object.values(sn))e[t]=0;for(let t of this.arguments){let n=t.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new Vr({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${n.type}' does not allow duplicates`,docs:[Yt.linkToSearch(n.type)]})}}mergeByOverride(e){for(let t of e.arguments){let n=t.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(t)}return this.validate(),this}mergeByThrow(e){for(let t of e.arguments){let n=t.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new Vr({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(t)}return this.validate(),this}getAll(e){return this.arguments.filter(t=>t.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var Sv=class extends Mf{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Df=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,t){if(t.find(n=>n.length===e.length)===void 0)throw new Vr({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${t.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[Yt.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 _r=class extends Df{};var Av=class extends _r{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Tr.addLabels}};var Ev=class extends _r{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Tr.allowOther}};var Tv=class extends _r{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return Tr.class}};var Mv=class extends _r{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=Ta(t[0].value)}getConfig(){return Tr.defaultValue}};var Dv=class extends _r{constructor(){super(...arguments);this.value=void 0}_parseValue(t){if(this.value=Number.parseInt(t[0].value),Number.isNaN(this.value))throw new Vr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[Yt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Vr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[Yt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Tr.limit}};var Cv=class extends _r{constructor(){super(...arguments);this.value=100}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Vr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[Yt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Tr.maxValue}};var Nv=class extends _r{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Vr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[Yt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Tr.minValue}};var Fv=class extends _r{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Tr.multiLine}};var Iv=class extends _r{constructor(){super(...arguments);this.value=!1}_parseValue(t){this.value=Ta(t[0].value)}getConfig(){return Tr.offValue}};var Pv=class extends _r{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=Ta(t[0].value)}getConfig(){return Tr.onValue}};var Bv=class extends _r{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(t){t.length===1?(this.value=Ta(t[0].value),this.name=t[0].value):t.length===2&&(this.value=Ta(t[0].value),this.name=t[1].value)}getConfig(){return Tr.option}};var kv=class extends _r{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return Tr.optionQuery}};var $v=class extends _r{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return Tr.placeholder}};var Ov=class extends _r{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Tr.showcase}};var Rv=class extends _r{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Vr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[Yt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Vr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[Yt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Tr.stepSize}};var Lv=class extends _r{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return Tr.title}};function i6(r,e,t){return t==="true"?`[[${r}|${e}]]`:t==="partial"?`[[${e}]]`:`${e}`}var Vv=class extends _r{constructor(){super(...arguments);this.value="true"}_parseValue(t){let n=t[0]?.value.toLowerCase();if(n===void 0){this.value="true";return}if(n==="true"||n==="partial"||n==="false"){this.value=n;return}throw new Vr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${WD(["true","partial","false"],i=>`'${i}'`,", ","or")}`,docs:[Yt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Tr.useLinks}};var a6={class:Tv,addLabels:Av,minValue:Nv,maxValue:Cv,stepSize:Rv,option:Bv,title:Lv,optionQuery:kv,showcase:Ov,offValue:Iv,onValue:Pv,defaultValue:Mv,placeholder:$v,useLinks:Vv,limit:Dv,allowOther:Ev,multiLine:Fv},Uv=class{static createInputFieldArgument(e){if(e in a6){let t=a6[e];if(t)return new t}throw new xo({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var qv=class{constructor(e,t,n){this.plugin=e,this.unvalidatedDeclaration=t,this.filePath=n,this.errorCollection=new Xt("input field declaration")}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(t),a={declarationString:this.unvalidatedDeclaration.declarationString,inputFieldType:t,bindTarget:n,argumentContainer:i,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(a),a}validateInputFieldType(){let e=this.unvalidatedDeclaration.inputFieldType;for(let t of Object.entries(tu))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new Bn("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(t){this.errorCollection.add(t)}}validateArguments(e){let t=new Sv;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=Uv.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Bn("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}t.add(a)}try{t.validate()}catch(n){this.errorCollection.add(n)}return t}validateArgumentType(e){for(let t of Object.entries(sn))if(t[1]===e.value)return t[1];return this.errorCollection.add(new Bn("WARNING","Declaration Validator",`Encountered invalid identifier. Expected an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}};var Pi=Or(va()),tn=Or(Xi());var uie=tn.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{inputFieldType:r,arguments:e,bindTarget:n}},vi.node(Oi).trim(Pi.P_UTILS.optionalWhitespace()).describe("input field type"),Qf.trim(Pi.P_UTILS.optionalWhitespace()).wrap(tn.P.string("(").describe('arguments paren "("'),tn.P.string(")").describe('arguments paren ")"')).trim(Pi.P_UTILS.optionalWhitespace()).optional([]),tn.P.sequence(tn.P.string(":").trim(Pi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),qo).trim(Pi.P_UTILS.optionalWhitespace()).optional()),o6=tn.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{inputFieldType:r,arguments:e,bindTarget:n}},vi.node(Oi).trim(Pi.P_UTILS.optionalWhitespace()).optional().describe("input field type"),Qf.trim(Pi.P_UTILS.optionalWhitespace()).wrap(tn.P.string("(").describe('arguments paren "("'),tn.P.string(")").describe('arguments paren ")"')).trim(Pi.P_UTILS.optionalWhitespace()).optional([]),tn.P.sequence(tn.P.string(":").trim(Pi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),qo).trim(Pi.P_UTILS.optionalWhitespace()).optional()),s6=tn.P.or(tn.P.sequenceMap((r,e,t)=>(t.templateName=e,t),tn.P.string("INPUT"),tn.P.sequenceMap((r,e,t)=>e,tn.P.string("["),EN.node(Oi).trim(Pi.P_UTILS.optionalWhitespace()).describe("template name"),tn.P.string("]").skip(Pi.P_UTILS.optionalWhitespace())),o6.wrap(tn.P.string("["),tn.P.string("]")),Pi.P_UTILS.eof()),tn.P.sequenceMap((r,e)=>e,tn.P.string("INPUT"),uie.wrap(tn.P.string("["),tn.P.string("]")),Pi.P_UTILS.eof())),u6=tn.P.sequenceMap((r,e)=>e,tn.P.string("INPUT"),o6.wrap(tn.P.string("["),tn.P.string("]")),Pi.P_UTILS.eof());var zv=class{constructor(e){this.plugin=e,this.templates=[]}fromString(e){let t=new Xt("InputField");try{let n=Gn(s6,e),i=this.partialToFullDeclaration(n,e,t);return i=this.applyTemplate(i),i}catch(n){t.add(n)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}fromStringAndValidate(e,t,n){return this.validate(this.fromString(e),t,n)}fromSimpleDeclaration(e){let t=new Xt("InputField");return{declarationString:void 0,inputFieldType:wa(e.inputFieldType),bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.bindTarget),arguments:(e.arguments??[]).map(n=>({name:wa(n.name),value:n.value.map(i=>wa(i))})),errorCollection:t}}fromSimpleDeclarationAndValidate(e,t,n){return this.validate(this.fromSimpleDeclaration(e),t,n)}partialToFullDeclaration(e,t,n){return{...structuredClone(e),declarationString:t,errorCollection:n}}validate(e,t,n){return new qv(this.plugin,e,t).validate(n)}merge(e,t){let n;return e.bindTarget===void 0?n=t.bindTarget:(n=e.bindTarget,t.bindTarget?.storagePath!==void 0&&(n.storagePath=t.bindTarget.storagePath),t.bindTarget?.storageProp!==void 0&&(n.storageProp=t.bindTarget.storageProp)),{declarationString:t.declarationString,inputFieldType:t.inputFieldType??e.inputFieldType,bindTarget:n,arguments:t.arguments.concat(e.arguments).reduce((i,a)=>(i.find(o=>o.name===a.name)===void 0&&i.push(a),i),[]),errorCollection:new Xt("input field declaration").merge(e.errorCollection).merge(t.errorCollection)}}parseTemplateString(e){let t=new Xt("InputFieldParser");try{let n=Gn(u6,e);return this.partialToFullDeclaration(n,e,t)}catch(n){t.add(n)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}parseTemplates(e){this.templates=[];let t=new Xt("input field template parser");for(let n of e){let i=this.parseTemplateString(n.declaration);t.merge(i.errorCollection);let a={name:n.name,template:i};this.templates.push(Gy(a))}return t}getTemplate(e){return this.templates.find(t=>t.name===e)?.template}applyTemplate(e){if(e.templateName===void 0)return e;let t=this.getTemplate(e.templateName.value);return t===void 0?(e.errorCollection.add(new Bn("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(t,e)}};var Hv=class{constructor(e){this.plugin=e}fromString(e){let t=new Xt("JsViewFieldDeclaration");try{let n=Gn(IN,e);return this.partialToFullDeclaration(n,e,t)}catch(n){t.add(n)}return{declarationString:e,errorCollection:t,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}fromStringAndValidate(e,t){return this.validate(this.fromString(e),t)}fromSimpleDeclaration(e){let t=new Xt("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:t}}fromSimpleDeclarationAndValidate(e,t){return this.validate(this.fromSimpleDeclaration(e),t)}partialToFullDeclaration(e,t,n){let i=e;return i.declarationString=t,i.errorCollection=n,i.bindTargetMappings=[...i.bindTargetMappings],i}validate(e,t){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,t),name:i.name})),e.writeToBindTarget!==void 0&&(n.writeToBindTarget=this.plugin.api.bindTargetParser.validate(e.declarationString,e.writeToBindTarget,t)),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 Gv=class extends Mf{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Hu=class extends Df{};var Wv=class extends Hu{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return rc.class}};var Yv=class extends Hu{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return rc.hidden}};var jv=class extends Hu{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return rc.renderMarkdown}};var l6={renderMarkdown:jv,hidden:Yv,class:Wv},Zv=class{static createViewFieldArgument(e){if(e in l6){let t=l6[e];if(t)return new t}throw new xo({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var Jv=class{constructor(e,t,n){this.unvalidatedDeclaration=e,this.plugin=n,this.filePath=t,this.errorCollection=new Xt("view field declaration")}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(t),a=this.validateTemplateDeclaration(e),o={declarationString:this.unvalidatedDeclaration.declarationString,viewFieldType:t,writeToBindTarget:n,argumentContainer:i,templateDeclaration:a,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(o),o}validateInputFieldType(){let e=this.unvalidatedDeclaration.viewFieldType;if(e===void 0)return"math";for(let t of Object.entries(Lf))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new Bn("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 t=new Gv;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=Zv.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Bn("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}t.add(a)}try{t.validate()}catch(n){this.errorCollection.add(n)}return t}validateArgumentType(e){for(let t of Object.entries(Zu))if(t[1]===e.value)return t[1];return this.errorCollection.add(new Bn("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(t=>typeof t=="string"?t:this.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,t,this.filePath,e))??[]}catch(t){return this.errorCollection.add(t),[]}}};var Xv=class{constructor(e){this.plugin=e}fromString(e){let t=new Xt("ViewFieldDeclaration");try{let n=Gn(FN,e);return this.partialToFullDeclaration(n,e,t)}catch(n){t.add(n)}return{declarationString:e,errorCollection:t,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}fromStringAndValidate(e,t,n){return this.validate(this.fromString(e),t,n)}fromSimpleDeclaration(e){let t=new Xt("ViewFieldDeclaration");return{declarationString:void 0,templateDeclaration:(e.templateDeclaration??[]).map(n=>typeof n=="string"?n:this.plugin.api.bindTargetParser.fromExistingDeclaration(n)),viewFieldType:wa(e.viewFieldType),arguments:(e.arguments??[]).map(n=>({name:wa(n.name),value:n.value.map(i=>wa(i))})),writeToBindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),errorCollection:t}}fromSimpleDeclarationAndValidate(e,t,n){return this.validate(this.fromSimpleDeclaration(e),t,n)}partialToFullDeclaration(e,t,n){return{...structuredClone(e),declarationString:t,errorCollection:n}}validate(e,t,n){return new Jv(e,t,this.plugin).validate(n)}};var Qv=class{constructor(e,t){this.plugin=e,this.inputFieldParser=t?.inputFieldParser??new zv(e),this.viewFieldParser=t?.viewFieldParser??new Xv(e),this.jsViewFieldParser=t?.jsViewFieldParser??new Hv(e),this.buttonParser=t?.buttonParser??new _v(e),this.bindTargetParser=t?.bindTargetParser??new xv(e),this.inputFieldFactory=t?.inputFieldFactory??new Th(e),this.viewFieldFactory=t?.viewFieldFactory??new vv(e),this.buttonActionRunner=t?.buttonActionRunner??new Cd(e),this.buttonManager=t?.buttonManager??new eh(e),this.syntaxHighlighting=t?.syntaxHighlighting??new xd(e)}createField(e,t,n,i=!0){if(un(he.object({type:ap,filePath:Ea,options:he.any(),honorExcludedSetting:he.boolean()}),{type:e,filePath:t,options:n,honorExcludedSetting:i}),this.plugin.internal.file.isExcludedFromRendering(t)&&i)return this.createExcludedMountable(t);if(e==="INPUT")return this.createInputFieldMountable(t,n);if(e==="VIEW")return this.createViewFieldMountable(t,n);if(e==="JS_VIEW")return this.createJsViewFieldMountable(t,n);if(e==="TABLE")return this.createTableMountable(t,n);if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(t,n);if(e==="BUTTON")return this.createButtonMountable(t,n);if(e==="EMBED")return this.createEmbedMountable(t,n);if(e==="EXCLUDED")return this.createExcludedMountable(t);throw new Error(`Unknown field type: ${e}`)}createInlineFieldFromString(e,t,n,i="inline",a,o=!0){un(he.object({fieldString:he.string(),filePath:Ea,scope:Tc.optional(),renderChildType:Ec,honorExcludedSetting:he.boolean()}),{fieldString:e,filePath:t,scope:n,renderChildType:i,honorExcludedSetting:o});let u=this.isInlineFieldDeclarationAndGetType(e);if(u===void 0)throw new Ht({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${u}"`});return this.createInlineFieldOfTypeFromString(u,e,t,n,i,a,o)}createInlineFieldOfTypeFromString(e,t,n,i,a="inline",o,u=!0){if(un(he.object({type:ap,declaration:he.string(),filePath:Ea,scope:Tc.optional(),renderChildType:Ec,honorExcludedSetting:he.boolean()}),{type:e,declaration:t,filePath:n,scope:i,renderChildType:a,honorExcludedSetting:u}),this.plugin.internal.file.isExcludedFromRendering(n)&&u)return this.createExcludedMountable(n);if(e==="INPUT")return this.createInputFieldMountable(n,{renderChildType:a,declaration:t,scope:i});if(e==="VIEW")return this.createViewFieldMountable(n,{renderChildType:a,declaration:t,scope:i});if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(n,{renderChildType:a,declaration:t,position:o});throw new Ht({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${e}"`})}createInputFieldMountable(e,t){un(he.object({filePath:Ea,options:cF}),{filePath:e,options:t});let n=qr(),i;return typeof t.declaration=="string"?i=this.inputFieldParser.fromStringAndValidate(t.declaration,e,t.scope):i=this.inputFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new zc(this.plugin,n,e,t.renderChildType,i)}createViewFieldMountable(e,t){un(he.object({filePath:Ea,options:fF}),{filePath:e,options:t});let n=qr(),i;return typeof t.declaration=="string"?i=this.viewFieldParser.fromStringAndValidate(t.declaration,e,t.scope):i=this.viewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new yv(this.plugin,n,e,t.renderChildType,i)}createJsViewFieldMountable(e,t){un(he.object({filePath:Ea,options:pF}),{filePath:e,options:t});let n=qr(),i;return typeof t.declaration=="string"?i=this.jsViewFieldParser.fromStringAndValidate(t.declaration,e):i=this.jsViewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e),new Ch(this.plugin,n,e,i)}createTableMountable(e,t){un(he.object({filePath:Ea,options:mF}),{filePath:e,options:t});let n=qr();return new Dh(this.plugin,n,e,t.bindTarget,t.tableHead,t.columns)}createButtonGroupMountable(e,t){un(he.object({filePath:Ea,options:dF}),{filePath:e,options:t});let n=qr(),i;return typeof t.declaration=="string"?i=this.buttonParser.fromGroupString(t.declaration):i=this.buttonParser.validateGroup(t.declaration),new Qd(this.plugin,n,e,i,t.renderChildType,t.position)}createButtonMountable(e,t){un(he.object({filePath:Ea,options:hF}),{filePath:e,options:t});let n=qr(),i;return typeof t.declaration=="string"?i=this.buttonParser.fromString(t.declaration):i=this.buttonParser.validate(t.declaration),new th(this.plugin,n,e,i,t.position,t.isPreview)}createEmbedMountable(e,t){un(he.object({filePath:Ea,options:gF}),{filePath:e,options:t});let n=qr();return new rh(this.plugin,n,e,t.depth,t.content)}createExcludedMountable(e){un(he.object({filePath:Ea}),{filePath:e});let t=qr();return new nh(this.plugin,t,e)}getInlineFieldDeclarationPrefix(e){if(un(he.object({fieldType:ap}),{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,t){un(he.object({fieldType:ap,str:he.string()}),{fieldType:e,str:t});let n=this.getInlineFieldDeclarationPrefix(e)+"[";return t.startsWith(n)&&t.endsWith("]")}isInlineFieldDeclarationAndGetType(e){if(un(he.object({str:he.string()}),{str:e}),!!e.endsWith("]"))for(let t of Object.values(tc)){if(!$m(t))continue;let n=this.getInlineFieldDeclarationPrefix(t)+"[";if(e.startsWith(n))return t}}createSignal(e){return new Zr(e)}createBindTarget(e,t,n,i=!1){return un(he.object({storageType:he.string(),storagePath:he.string(),property:he.string().array(),listenToChildren:he.boolean()}),{storageType:e,storagePath:t,property:n,listenToChildren:i}),{storageType:e,storagePath:t,storageProp:Mh(n),listenToChildren:i}}parseBindTarget(e,t,n){return un(he.object({declarationString:he.string(),filePath:Ea,scope:Tc.optional()}),{declarationString:e,filePath:t,scope:n}),this.bindTargetParser.fromStringAndValidate(e,t,n)}setMetadata(e,t){un(he.object({bindTarget:Aa}),{bindTarget:e}),this.plugin.metadataManager.write(t,e)}getMetadata(e){return un(he.object({bindTarget:Aa}),{bindTarget:e}),this.plugin.metadataManager.read(e)}updateMetadata(e,t){un(he.object({bindTarget:Aa,updateFn:he.function().args(he.any()).returns(he.any())}),{bindTarget:e,updateFn:t});let n=this.plugin.metadataManager.read(e),i=t(n);this.plugin.metadataManager.write(i,e)}subscribeToMetadata(e,t,n){un(he.object({bindTarget:Aa,lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:he.function().args(he.any()).returns(he.void())}),{bindTarget:e,lifecycleHook:t,callback:n});let i=qr(),a=new Zr(void 0);a.registerListener({callback:n});let o=this.plugin.metadataManager.subscribe(i,a,e,()=>{a.unregisterAllListeners()});t.register(()=>{o.unsubscribe()})}createNotePosition(e,t){return un(he.object({lineStart:he.number(),lineEnd:he.number()}),{lineStart:e,lineEnd:t}),new eu({lineStart:e,lineEnd:t})}};var c6=require("@codemirror/view"),Kv=class extends c6.WidgetType{constructor(e,t,n,i,a){super(),this.type=e,this.content=t,this.filePath=n,this.parentComponent=i,this.plugin=a}eq(e){return e.content===this.content}toDOM(e){let t=document.createElement("span");t.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,t,this.parentComponent),t}destroy(e){this.renderChild?.unload(),super.destroy(e)}};var f6=require("obsidian"),ey=class extends f6.MarkdownRenderChild{constructor(e,t,n){super(n),this.plugin=e,this.mountable=t,this.mountable.registerUnmountCb(()=>{this.unload()})}onload(){this.mountable.mount(this.containerEl),super.onload()}onunload(){this.mountable.isMounted()&&this.mountable.unmount(),super.onunload()}};function p6(r){return r.dependencyManager.checkDependency("dataview").api}function Gu(r){return r.dependencyManager.checkDependency("js-engine").api}function IM(r){return r.dependencyManager.checkDependency("templater-obsidian").templater}var lie=he.object({addChild:he.function().args(he.instanceof(m6.Component)).returns(he.void())}),ty=class extends Qv{constructor(e){super(e)}wrapInMDRC(e,t,n){un(he.object({field:iF,containerEl:nF,component:lie}),{field:e,containerEl:t,component:n});let i=new ey(this.plugin,e,t);return n.addChild(i),i}constructMDRCWidget(e,t,n,i){if($m(e))return new Kv(e,t,n,i,this.plugin);throw new Ht({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline field type "${e}"`})}reactiveMetadata(e,t,n){un(he.object({bindTargets:Aa.array(),lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:he.function()}),{bindTargets:e,lifecycleHook:t,callback:n});let i=Gu(this.plugin),a=qr(),o=new Zr(void 0),u=e.map(l=>({bindTarget:l,callbackSignal:new Zr(void 0)})),c,s=this.plugin.metadataManager.subscribeComputed(a,o,void 0,u,l=>c?.refresh(...l),()=>{});return t.register(()=>s.unsubscribe()),c=i.reactive(n,...u.map(l=>l.callbackSignal.get())),c}};var An=require("obsidian");var ry=Or(zf());var d6=Or(zf());var cie=ae('<div class="mb-calendar-cell mb-calendar-header-cell"><span class="mb-calendar-cell-text"> </span></div>'),fie=(r,e,t)=>e(U(t)),pie=(r,e,t)=>e(r,U(t)),mie=ae('<div class="mb-calendar-cell" role="button" tabindex="0"><span class="mb-calendar-cell-text"> </span></div>'),die=ae('<div class="mb-calendar"><div class="mb-calendar-header"></div> <div class="mb-calendar-content"></div></div>');function PM(r,e){De(e,!0);let t=Qt(()=>KD(e.month,e.year));function n(c){c&&e.dateChange((0,d6.default)(new Date(e.year,e.month,c)))}function i(c,s){c.key===" "&&n(s)}var a=die(),o=de(a);Wt(o,21,eC,Kt,(c,s)=>{var l=cie(),f=de(l),p=de(f,!0);ue(f),ue(l),Ve(()=>ft(p,U(s))),te(c,l)}),ue(o);var u=ce(o,2);Wt(u,21,()=>U(t),c=>tC(),(c,s)=>{var l=mie();l.__click=[fie,n,s],l.__keydown=[pie,i,s];let f=Qt(()=>e.selectedDate?.year()===e.year&&e.selectedDate?.month()===e.month&&e.selectedDate?.date()===U(s));Ve(()=>Jr(l,"mb-calendar-selected",U(f)));var p=de(l),m=de(p,!0);ue(p),ue(l),Ve(()=>{Jr(l,"mb-calendar-highlight",U(s)),Jr(l,"mb-calendar-content-cell",U(s)),ft(m,U(s)||"")}),te(c,l)}),ue(u),ue(a),te(r,a),Ce()}Pt(["click","keydown"]);function hie(r,e,t){if(U(e)===11){Oe(e,0),Oe(t,U(t)+1);return}Oe(e,U(e)+1)}function gie(r,e,t){if(U(e)===0){Oe(e,11),Oe(t,U(t)-1);return}Oe(e,U(e)-1)}function vie(r,e){let t=r.target.value,n=Number.parseInt(t);Number.isNaN(n)||Oe(e,Ue(n))}function yie(r,e,t){e(null),t.dateChangeCallback(null)}function xie(r,e,t){e((0,ry.default)()),t.dateChangeCallback(e())}var bie=ae('<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 BM(r,e){De(e,!0);let t=bt(e,"selectedDate",23,ry.default),n=ht(0),i=ht(0);eo(()=>{if(t())Oe(n,Ue(t().month())),Oe(i,Ue(t().year()));else{let T=(0,ry.default)();Oe(n,Ue(T.month())),Oe(i,Ue(T.year()))}});function a(T){t(T),e.dateChangeCallback(T)}var o=bie(),u=de(o),c=de(u);c.__click=[gie,n,i];var s=ce(c,2),l=de(s),f=de(l,!0);Ve(()=>ft(f,QD(U(n)))),ue(l);var p=ce(l,2);St(p),Ve(()=>pb(p,U(i).toString())),p.__input=[vie,i],ue(s);var m=ce(s,2);m.__click=[hie,n,i],ue(u);var d=ce(u,2);PM(d,{dateChange:a,get month(){return U(n)},get year(){return U(i)},get selectedDate(){return t()}});var h=ce(d,2),x=de(h);x.__click=[yie,t,e];var b=ce(x,2);b.__click=[xie,t,e],ue(h),ue(o),te(r,o),Ce()}Pt(["click","input"]);var Cf=class extends xi{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 wie=ae('<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 zt(r,e){De(e,!0);let t=bt(e,"name",3,""),n=bt(e,"description",3,""),i=bt(e,"heading",3,!1),a=bt(e,"vertical",3,!1);var o=wie(),u=de(o),c=de(u),s=de(c,!0);ue(c);var l=ce(c,2),f=de(l,!0);ue(l),ue(u);var p=ce(u,2),m=de(p);at(m,()=>e.children,d=>{var h=Qr(),x=Ke(h);io(x,()=>e.children),te(d,h)}),ue(p),ue(o),Ve(()=>{Jr(o,"setting-item-heading",i()),Jr(o,"mb-vertical",a()),ft(s,t()),ft(f,n()),Jr(p,"mb-vertical-control",a())}),te(r,o),Ce()}function kM(r,e){De(e,!0);function t(i){i.type==="command"&&e.plugin.internal.openCommandSelectModal(a=>{i.command=a.id})}var n=Qt(()=>`Command: ${(e.action.command||"none")??""}`);zt(r,{get name(){return U(n)},description:"The command to execute when this action runs.",children:(i,a)=>{It(i,{get variant(){return"primary"},onclick:()=>t(e.action),children:(o,u)=>{Ut();var c=gr("Change");te(o,c)},$$slots:{default:!0}})},$$slots:{default:!0}}),Ce()}var _ie=(r,e,t)=>e(!U(t)),Sie=(r,e,t)=>{r.key===" "&&e(!U(t))},Aie=ae('<div class="checkbox-container" role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function Oa(r,e){let t=bt(e,"checked",15),n=Qt(()=>t()??!1);var i=Aie();i.__click=[_ie,t,n],i.__keydown=[Sie,t,n];var a=de(i);St(a),ue(i),Ve(()=>{_t(i,"aria-checked",U(n)),Jr(i,"is-enabled",U(n)),Bs(a,U(n))}),te(r,i)}Pt(["click","keydown"]);var Eie=ae('<input type="text" placeholder="some name">'),Tie=ae("<!> <!> <!> <!>",1);function $M(r,e){De(e,!0);let t=bt(e,"action",7);function n(f){f.type==="createNote"&&e.plugin.internal.openFolderSelectModal(p=>{f.folderPath=p})}var i=Tie(),a=Ke(i),o=Qt(()=>`Folder: ${(t().folderPath||"none")??""}`);zt(a,{get name(){return U(o)},description:"The folder to create a new note in.",children:(f,p)=>{It(f,{get variant(){return"primary"},onclick:()=>n(t()),children:(m,d)=>{Ut();var h=gr("Change");te(m,h)},$$slots:{default:!0}})},$$slots:{default:!0}});var u=ce(a,2),c=Qt(()=>`File name: ${(t().fileName||"default")??""}`);zt(u,{get name(){return U(c)},description:"The file name of the new note.",children:(f,p)=>{var m=Eie();St(m),vt(m,()=>t().fileName,d=>t().fileName=d),te(f,m)},$$slots:{default:!0}});var s=ce(u,2);zt(s,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(f,p)=>{Oa(f,{get checked(){return t().openNote},set checked(m){t().openNote=m}})},$$slots:{default:!0}});var l=ce(s,2);zt(l,{name:"Open if note already xxists",description:"Whether to open the note instead of creating a new one if the note already exists.",children:(f,p)=>{Oa(f,{get checked(){return t().openIfAlreadyExists},set checked(m){t().openIfAlreadyExists=m}})},$$slots:{default:!0}}),te(r,i),Ce()}var Mie=ae('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function OM(r,e){De(e,!0);let t=bt(e,"action",7);var n=Mie(),i=Ke(n);zt(i,{name:"JS code",description:"The JavaScript code to run."});var a=ce(i,2),o=de(a);Fn(o),ue(a),vt(o,()=>t().code,u=>t().code=u),te(r,n),Ce()}var Die=ae('<input type="text" placeholder="some text">');function RM(r,e){De(e,!0);let t=bt(e,"action",7);zt(r,{name:"Text",description:"The text to input at the cursor.",children:(n,i)=>{var a=Die();St(a),vt(a,()=>t().str,o=>t().str=o),te(n,a)},$$slots:{default:!0}}),Ce()}var Cie=ae('<input type="number" placeholder="0">'),Nie=ae('<!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function LM(r,e){De(e,!0);let t=bt(e,"action",7);var n=Nie(),i=Ke(n);zt(i,{name:"Line",description:"The line number to insert at.",children:(c,s)=>{var l=Cie();St(l),vt(l,()=>t().line,f=>t().line=f),te(c,l)},$$slots:{default:!0}});var a=ce(i,2);zt(a,{name:"Text to insert",description:"The text to insert into the note."});var o=ce(a,2),u=de(o);Fn(u),ue(o),vt(u,()=>t().value,c=>t().value=c),te(r,n),Ce()}var Fie=ae('<input type="text" placeholder="someJsFile.js">');function VM(r,e){De(e,!0);let t=bt(e,"action",7);zt(r,{name:"JS file",description:"The JavaScript file to run.",children:(n,i)=>{var a=Fie();St(a),vt(a,()=>t().file,o=>t().file=o),te(n,a)},$$slots:{default:!0}}),Ce()}var Iie=ae('<input type="text" placeholder="[[Some Note]] or https://www.example.com">'),Pie=ae("<!> <!>",1);function UM(r,e){De(e,!0);let t=bt(e,"action",7);var n=Pie(),i=Ke(n);zt(i,{name:"Link",description:"The link to open.",children:(o,u)=>{var c=Iie();St(c),vt(c,()=>t().link,s=>t().link=s),te(o,c)},$$slots:{default:!0}});var a=ce(i,2);zt(a,{name:"New tab",description:"Whether to open the link in a new tab.",children:(o,u)=>{Oa(o,{get checked(){return t().newTab},set checked(c){t().newTab=c}})},$$slots:{default:!0}}),te(r,n),Ce()}var Bie=ae('<input type="text">'),kie=ae('<input type="text" placeholder="g">'),$ie=ae('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function qM(r,e){De(e,!0);let t=bt(e,"action",7);var n=$ie(),i=Ke(n);zt(i,{name:"Regexp",description:"The regexp to find replacements.",children:(s,l)=>{var f=Bie();St(f),vt(f,()=>t().regexp,p=>t().regexp=p),te(s,f)},$$slots:{default:!0}});var a=ce(i,2);zt(a,{name:"Regexp flags",description:"The regexp flags for this regexp.",children:(s,l)=>{var f=kie();St(f),vt(f,()=>t().regexpFlags,p=>t().regexpFlags=p),te(s,f)},$$slots:{default:!0}});var o=ce(a,2);zt(o,{name:"Replacement text",description:"The text to replace the button with."});var u=ce(o,2),c=de(u);Fn(c),ue(u),vt(c,()=>t().replacement,s=>t().replacement=s),te(r,n),Ce()}var Oie=ae('<input type="number" placeholder="0">'),Rie=ae('<input type="number" placeholder="0">'),Lie=ae('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function zM(r,e){De(e,!0);let t=bt(e,"action",7);var n=Lie(),i=Ke(n);zt(i,{name:"Line from",description:"The line that marks the start of the area to replace.",children:(s,l)=>{var f=Oie();St(f),vt(f,()=>t().fromLine,p=>t().fromLine=p),te(s,f)},$$slots:{default:!0}});var a=ce(i,2);zt(a,{name:"Line to",description:"The line that marks the end of the area to replace.",children:(s,l)=>{var f=Rie();St(f),vt(f,()=>t().toLine,p=>t().toLine=p),te(s,f)},$$slots:{default:!0}});var o=ce(a,2);zt(o,{name:"Replacement text",description:"The text to replace the note section."});var u=ce(o,2),c=de(u);Fn(c),ue(u),vt(c,()=>t().replacement,s=>t().replacement=s),te(r,n),Ce()}var Vie=ae('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function HM(r,e){De(e,!0);let t=bt(e,"action",7);var n=Vie(),i=Ke(n);zt(i,{name:"Replacement text",description:"The text to replace the match with."});var a=ce(i,2),o=de(a);Fn(o),ue(a),vt(o,()=>t().replacement,u=>t().replacement=u),te(r,n),Ce()}var Uie=ae('<input type="number" placeholder="100 ms">');function GM(r,e){De(e,!0);let t=bt(e,"action",7);zt(r,{name:"Sleep time",description:"The time to sleep in milliseconds.",children:(n,i)=>{var a=Uie();St(a),vt(a,()=>t().ms,o=>t().ms=o),te(n,a)},$$slots:{default:!0}}),Ce()}var qie=ae('<input type="text" placeholder="some name">'),zie=ae("<!> <!> <!> <!> <!>",1);function WM(r,e){De(e,!0);let t=bt(e,"action",7);function n(d){d.type==="templaterCreateNote"&&e.plugin.internal.openFileSelectModal(h=>{d.templateFile=h})}function i(d){d.type==="templaterCreateNote"&&e.plugin.internal.openFolderSelectModal(h=>{d.folderPath=h})}var a=zie(),o=Ke(a),u=Qt(()=>`Template file: ${(t().templateFile||"none")??""}`);zt(o,{get name(){return U(u)},description:"The template file to create a new note of.",children:(d,h)=>{It(d,{get variant(){return"primary"},onclick:()=>n(t()),children:(x,b)=>{Ut();var T=gr("Change");te(x,T)},$$slots:{default:!0}})},$$slots:{default:!0}});var c=ce(o,2),s=Qt(()=>`Folder: ${(t().folderPath||"none")??""}`);zt(c,{get name(){return U(s)},description:"The folder to create a new note in.",children:(d,h)=>{It(d,{get variant(){return"primary"},onclick:()=>i(t()),children:(x,b)=>{Ut();var T=gr("Change");te(x,T)},$$slots:{default:!0}})},$$slots:{default:!0}});var l=ce(c,2),f=Qt(()=>`File name: ${(t().fileName||"default")??""}`);zt(l,{get name(){return U(f)},description:"The file name of the new note.",children:(d,h)=>{var x=qie();St(x),vt(x,()=>t().fileName,b=>t().fileName=b),te(d,x)},$$slots:{default:!0}});var p=ce(l,2);zt(p,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(d,h)=>{Oa(d,{get checked(){return t().openNote},set checked(x){t().openNote=x}})},$$slots:{default:!0}});var m=ce(p,2);zt(m,{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)=>{Oa(d,{get checked(){return t().openIfAlreadyExists},set checked(x){t().openIfAlreadyExists=x}})},$$slots:{default:!0}}),te(r,a),Ce()}var Hie=ae('<input type="text" placeholder="some value">'),Gie=ae('<input type="text" placeholder="some value">'),Wie=ae("<!> <!> <!>",1);function YM(r,e){De(e,!0);let t=bt(e,"action",7);var n=Wie(),i=Ke(n);zt(i,{name:"Metadata property",description:"The metadata property in form of a bind target.",children:(u,c)=>{var s=Hie();St(s),vt(s,()=>t().bindTarget,l=>t().bindTarget=l),te(u,s)},$$slots:{default:!0}});var a=ce(i,2);zt(a,{name:"Value",description:"The new value.",children:(u,c)=>{var s=Gie();St(s),vt(s,()=>t().value,l=>t().value=l),te(u,s)},$$slots:{default:!0}});var o=ce(a,2);zt(o,{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",children:(u,c)=>{Oa(u,{get checked(){return t().evaluate},set checked(s){t().evaluate=s}})},$$slots:{default:!0}}),te(r,n),Ce()}var Yie=ae("<div><!></div>");function js(r,e){De(e,!0);let t=bt(e,"reverse",3,!1),n=bt(e,"stretchChildren",3,!1),i=Qt(()=>[t()?"mb-flex-row-reverse":"mb-flex-row",n()?"mb-flex-row-stretch":""].join(" "));var a=Yie(),o=de(a);io(o,()=>e.children),ue(a),Ve(()=>ao(a,U(i))),te(r,a),Ce()}var jie=ae('<div class="modal-button-container"><!></div>');function Ro(r,e){De(e,!0);var t=jie(),n=de(t);io(n,()=>e.children),ue(t),te(r,t),Ce()}var Zie=ae('<input type="text">'),Jie=ae('<input type="text">'),Xie=ae("<option> </option>"),Qie=ae('<select class="dropdown"></select>'),Kie=ae('<input type="text">'),eae=ae('<input type="text">'),tae=ae('<input type="text">'),rae=ae("<option> </option>"),nae=ae("<h5> </h5> <!>",1),iae=ae("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1),aae=ae("<!> <!>",1),oae=ae('<!> <!> <!> <!> <!> <!> <!> <h4>Actions</h4> Add action of type <select class="dropdown"></select> <!> <!> <h4>Preview</h4> <div></div> <!>',1);function jM(r,e){De(e,!0);let t=Ue(e.buttonConfig),n,i,a=ht(Ue("command"));qc(()=>{i?.unmount()}),eo(()=>{i?.unmount(),n&&(ct.empty(n),i=new bu(e.plugin,li(t),"","block",void 0,!1,!0),i.mount(n))});function o(){t.actions?.push(e.plugin.api.buttonActionRunner.createDefaultAction(U(a)))}function u(A){t.actions?.splice(A,1)}function c(A){return A==="command"?"Run a command":A==="open"?"Open a link":A==="js"?"Run a JavaScript file":A==="input"?"Insert text at cursor":A==="sleep"?"Sleep for some time":A==="templaterCreateNote"?"Create a new note using Templater":A==="updateMetadata"?"Update metadata":A==="createNote"?"Create a new note":A==="replaceInNote"?"Replace text in note":A==="regexpReplaceInNote"?"Replace text in note using regexp":A==="replaceSelf"?"Replace button with text":A==="insertIntoNote"?"Insert text into the note":A==="inlineJS"?"Run JavaScript code":"CHANGE ME"}function s(A,M){if(t.actions===void 0)return;let w=[];A>0&&w.push({name:"Move up",icon:"arrow-up",onclick:()=>{if(t.actions===void 0)return;let D=t.actions[A-1];t.actions[A-1]=t.actions[A],t.actions[A]=D}}),A<t.actions.length-1&&w.push({name:"Move down",icon:"arrow-down",onclick:()=>{if(t.actions===void 0)return;let D=t.actions[A+1];t.actions[A+1]=t.actions[A],t.actions[A]=D}}),w.push({name:"Remove",icon:"x",warning:!0,onclick:()=>u(A)}),e.plugin.internal.createContextMenu(w).showWithEvent(M)}var l=oae(),f=Ke(l);zt(f,{name:"Label",description:"The label shown on the button.",children:(A,M)=>{var w=Zie();St(w),vt(w,()=>t.label,D=>t.label=D),te(A,w)},$$slots:{default:!0}});var p=ce(f,2);zt(p,{name:"Icon",description:"The icon shown on the button. If left empty, no icon will show",children:(A,M)=>{var w=Jie();St(w),vt(w,()=>t.icon,D=>t.icon=D),te(A,w)},$$slots:{default:!0}});var m=ce(p,2);zt(m,{name:"Style",description:"The style variant of the button",children:(A,M)=>{var w=Qie();Wt(w,21,()=>Object.values(yn),Kt,(D,N)=>{var B=Xie(),R={},z=de(B,!0);ue(B),Ve(()=>{R!==(R=U(N))&&(B.value=(B.__value=U(N))==null?"":U(N)),ft(z,U(N))}),te(D,B)}),ue(w),Uc(w,()=>t.style,D=>t.style=D),te(A,w)},$$slots:{default:!0}});var d=ce(m,2);zt(d,{name:"CSS classes",description:"A list of CSS classes to add to the button. Multiple classes should be separated by a space.",children:(A,M)=>{var w=Kie();St(w),vt(w,()=>t.class,D=>t.class=D),te(A,w)},$$slots:{default:!0}});var h=ce(d,2);zt(h,{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",children:(A,M)=>{var w=eae();St(w),vt(w,()=>t.tooltip,D=>t.tooltip=D),te(A,w)},$$slots:{default:!0}});var x=ce(h,2);zt(x,{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",children:(A,M)=>{var w=tae();St(w),vt(w,()=>t.id,D=>t.id=D),te(A,w)},$$slots:{default:!0}});var b=ce(x,2);zt(b,{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",children:(A,M)=>{Oa(A,{get checked(){return t.hidden},set checked(w){t.hidden=w}})},$$slots:{default:!0}});var T=ce(b,4);Wt(T,21,()=>Object.values(iu),Kt,(A,M)=>{var w=rae(),D={},N=de(w,!0);ue(w),Ve(()=>{D!==(D=U(M))&&(w.value=(w.__value=U(M))==null?"":U(M)),ft(N,U(M))}),te(A,w)}),ue(T);var v=ce(T,2);It(v,{get variant(){return"primary"},onclick:()=>o(),children:(A,M)=>{Ut();var w=gr("Add Action");te(A,w)},$$slots:{default:!0}});var S=ce(v,2);Wt(S,17,()=>t.actions??[],Kt,(A,M,w)=>{var D=iae(),N=Ke(D);js(N,{children:(me,oe)=>{var ve=nae(),_e=Ke(ve),ye=de(_e,!0);Ve(()=>ft(ye,c(U(M).type))),ue(_e);var be=ce(_e,2);It(be,{get variant(){return"plain"},onclick:we=>s(w,we),children:(we,Ee)=>{Xr(we,{iconName:"more-vertical",get plugin(){return e.plugin}})},$$slots:{default:!0}}),te(me,ve)},$$slots:{default:!0}});var B=ce(N,2);at(B,()=>U(M).type==="command",me=>{kM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var R=ce(B,2);at(R,()=>U(M).type==="open",me=>{UM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var z=ce(R,2);at(z,()=>U(M).type==="js",me=>{VM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var V=ce(z,2);at(V,()=>U(M).type==="input",me=>{RM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var k=ce(V,2);at(k,()=>U(M).type==="sleep",me=>{GM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var P=ce(k,2);at(P,()=>U(M).type==="templaterCreateNote",me=>{WM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var W=ce(P,2);at(W,()=>U(M).type==="updateMetadata",me=>{YM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var O=ce(W,2);at(O,()=>U(M).type==="createNote",me=>{$M(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var X=ce(O,2);at(X,()=>U(M).type==="replaceInNote",me=>{zM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var ne=ce(X,2);at(ne,()=>U(M).type==="regexpReplaceInNote",me=>{qM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var Z=ce(ne,2);at(Z,()=>U(M).type==="replaceSelf",me=>{HM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var L=ce(Z,2);at(L,()=>U(M).type==="insertIntoNote",me=>{LM(me,{get action(){return U(M)},get plugin(){return e.plugin}})});var pe=ce(L,2);at(pe,()=>U(M).type==="inlineJS",me=>{OM(me,{get action(){return U(M)},get plugin(){return e.plugin}})}),te(A,D)});var _=ce(S,4);Co(_,A=>n=A,()=>n);var y=ce(_,2);Ro(y,{children:(A,M)=>{var w=aae(),D=Ke(w);It(D,{get variant(){return"primary"},onclick:()=>e.modal.okay(li(t)),children:(B,R)=>{Ut();var z=gr();Ve(()=>ft(z,e.modal.options.submitText)),te(B,z)},$$slots:{default:!0}});var N=ce(D,2);It(N,{get variant(){return"default"},onclick:()=>e.modal.cancel(),children:(B,R)=>{Ut();var z=gr("Cancel");te(B,z)},$$slots:{default:!0}}),te(A,w)},$$slots:{default:!0}}),Uc(T,()=>U(a),A=>Oe(a,A)),te(r,l),Ce()}var ny=class extends Cf{constructor(e,t){super(),this.plugin=e,this.options=t}onMount(e){ct.empty(e),this.component&&Fr(this.component),this.component=Cr(jM,{target:e,props:{plugin:this.plugin,modal:this,buttonConfig:this.options.config??this.plugin.api.buttonActionRunner.createDefaultButtonConfig()}})}onUnmount(e){ct.empty(e),this.component&&Fr(this.component)}okay(e){this.closeModal(),this.options.onOkay(e)}cancel(){this.closeModal()}};var sae=(r,e,t)=>t.onSelect(t.image),uae=(r,e,t,n)=>e(r,n.image),lae=ae('<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 ZM(r,e){De(e,!0);let t=ir(e,["$$slots","$$events","$$legacy"]);function n(s,l){s.key===" "&&e.onSelect(l)}var i=lae();i.__click=[sae,t,e],i.__keydown=[uae,n,t,e];var a=de(i);Ve(()=>_t(a,"src",e.plugin.internal.imagePathToUri(e.image)));var o=ce(a,2),u=de(o),c=de(u,!0);ue(u),ue(o),ue(i),Ve(()=>{_t(a,"alt",e.image),ft(c,e.image)}),te(r,i),Ce()}Pt(["click","keydown"]);var cae=ae('<div class="mb-image-search-container"><input type="text" placeholder="Search images..."></div> <div class="mb-image-card-grid"></div>',1);function JM(r,e){De(e,!0);let t=ht(""),n=e.plugin.internal.createFuzzySearch(),i=Qt(()=>U(t)?(n.setSearch(U(t)),n.filterItems(e.options,s=>s.value)):e.options);var a=cae(),o=Ke(a),u=de(o);St(u),ue(o);var c=ce(o,2);Wt(c,21,()=>U(i),Kt,(s,l)=>{ZM(s,{get plugin(){return e.plugin},get image(){return U(l).value},get onSelect(){return e.onSelect}})}),ue(c),vt(u,()=>U(t),s=>Oe(t,s)),te(r,a),Ce()}var zl=class extends Cf{constructor(e){super(),this.createComponent=e}onMount(e){ct.empty(e),this.component=this.createComponent(this,e)}onUnmount(e){this.component&&Fr(this.component),ct.empty(e)}};var fae=ae("<textarea></textarea>"),pae=ae('<input type="text">'),mae=ae("<!> <!>",1),dae=ae('<p> </p> <div class="mb-full-width-text-input"><!></div> <!>',1);function XM(r,e){De(e,!0);let t=ht(Ue(e.options.value));var n=dae(),i=Ke(n),a=de(i,!0);ue(i);var o=ce(i,2),u=de(o);at(u,()=>e.options.multiline,s=>{var l=fae();Fn(l),vt(l,()=>U(t),f=>Oe(t,f)),te(s,l)},s=>{var l=pae();St(l),vt(l,()=>U(t),f=>Oe(t,f)),te(s,l)}),ue(o);var c=ce(o,2);Ro(c,{children:(s,l)=>{var f=mae(),p=Ke(f);It(p,{get variant(){return"primary"},onclick:()=>e.options.onSubmit(li(U(t))),children:(d,h)=>{Ut();var x=gr("OK");te(d,x)},$$slots:{default:!0}});var m=ce(p,2);It(m,{onclick:()=>e.options.onCancel(),children:(d,h)=>{Ut();var x=gr("Cancel");te(d,x)},$$slots:{default:!0}}),te(s,f)},$$slots:{default:!0}}),Ve(()=>ft(a,e.options.subTitle)),te(r,n),Ce()}var os=class{constructor(e,t){this.plugin=e,this.selectCallback=t}onSelected(e){this.selectCallback(e)}};var iy=class extends os{getItemText(e){return e.name}getItems(){return this.plugin.internal.getAllCommands()}};var ay=class extends os{getItemText(e){return e}getItems(){return this.plugin.internal.file.getAllFiles()}};var oy=class extends os{getItemText(e){return e}getItems(){return this.plugin.internal.file.getAllFolders()}};var sy=class extends os{constructor(e,t,n){super(e,t),this.ipf=n}getItemText(e){return e.displayValue}getItems(){return this.plugin.internal.getSuggesterOptions(this.ipf)}};var hae=ae('<pre class="mb-pre"><code class="language-none mb-none"> </code></pre>'),gae=ae("<tr><td>Tip</td><td> </td></tr>"),vae=ae("<a> </a><br>",1),yae=ae("<tr><td>Docs</td><td></td></tr>"),xae=ae('<tr><td>Context</td><td><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></td></tr>'),bae=ae('<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>'),wae=ae('<div class="mb-card"><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></div>');function uy(r,e){De(e,!0);var t=Qr(),n=Ke(t);at(n,()=>e.error instanceof Hn,i=>{var a=bae(),o=de(a),u=de(o),c=de(u);Ve(()=>ft(c,`${e.error.errorLevel??""}
				[${e.error.getErrorType()??""}]`)),ue(u);var s=ce(u);ue(o);var l=ce(o,2);at(l,()=>e.error.positionContext,y=>{var A=hae(),M=de(A),w=de(M,!0);ue(M),ue(A),Ve(()=>ft(w,e.error.positionContext)),te(y,A)});var f=ce(l,2),p=de(f),m=de(p),d=ce(de(m)),h=de(d,!0);ue(d),ue(m);var x=ce(m),b=ce(de(x)),T=de(b,!0);ue(b),ue(x);var v=ce(x);at(v,()=>e.error.tip,y=>{var A=gae(),M=ce(de(A)),w=de(M,!0);ue(M),ue(A),Ve(()=>ft(w,e.error.tip)),te(y,A)});var S=ce(v);at(S,()=>e.error.docs,y=>{var A=yae(),M=ce(de(A));Wt(M,21,()=>e.error.docs,Kt,(w,D)=>{var N=vae(),B=Ke(N),R=de(B,!0);ue(B),Ut(),Ve(()=>{_t(B,"href",U(D)),ft(R,U(D))}),te(w,N)}),ue(M),ue(A),te(y,A)});var _=ce(S);at(_,()=>e.error.context,y=>{var A=xae(),M=ce(de(A)),w=de(M),D=de(w),N=de(D,!0);Ve(()=>ft(N,JSON.stringify(e.error.context,null,4))),ue(D),ue(w),ue(M),ue(A),te(y,A)}),ue(p),ue(f),ue(a),Ve(()=>{ao(u,e.error.errorLevel==="WARNING"?"mb-warning-text":"mb-error-text"),ft(s,` - ${e.error.effect??""}`),ft(h,e.error.cause),ft(T,e.error.effect)}),te(i,a)},i=>{var a=wae(),o=de(a),u=de(o),c=de(u,!0);ue(u),ue(o),ue(a),Ve(()=>ft(c,e.error.stack)),te(i,a)}),te(r,t),Ce()}var _ae=ae("<p> </p>"),Sae=ae('<pre class="mb-pre"><code class="language-none meta-bind-none"> </code></pre>'),Aae=ae("<p> </p>"),Eae=ae("<h6>Errors</h6> <!> <!>",1),Tae=ae("<p> </p>"),Mae=ae("<h6>Warnings</h6> <!> <!>",1),Dae=ae("<!> <!> <!> <!>",1);function Zs(r,e){De(e,!0);var t=Dae(),n=Ke(t);at(n,()=>e.settings.text,u=>{var c=_ae(),s=de(c,!0);ue(c),Ve(()=>ft(s,e.settings.text)),te(u,c)});var i=ce(n,2);at(i,()=>e.settings.code,u=>{var c=Sae(),s=de(c),l=de(s,!0);ue(s),ue(c),Ve(()=>ft(l,e.settings.code)),te(u,c)});var a=ce(i,2);at(a,()=>e.settings.errorCollection.hasErrors(),u=>{var c=Eae(),s=ce(Ke(c),2);at(s,()=>e.settings.errorText,f=>{var p=Aae(),m=de(p,!0);ue(p),Ve(()=>ft(m,e.settings.errorText)),te(f,p)});var l=ce(s,2);Wt(l,17,()=>e.settings.errorCollection.getErrors(),Kt,(f,p)=>{uy(f,{get error(){return U(p)}})}),te(u,c)});var o=ce(a,2);at(o,()=>e.settings.errorCollection.hasWarnings(),u=>{var c=Mae(),s=ce(Ke(c),2);at(s,()=>e.settings.warningText,f=>{var p=Tae(),m=de(p,!0);ue(p),Ve(()=>ft(m,e.settings.warningText)),te(f,p)});var l=ce(s,2);Wt(l,17,()=>e.settings.errorCollection.getWarnings(),Kt,(f,p)=>{uy(f,{get error(){return U(p)}})}),te(u,c)}),te(r,t),Ce()}var Cae=(r,e)=>e(),Nae=(r,e)=>{r.key===" "&&e()},Fae=ae('<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),Iae=ae('<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>'),Pae=ae('<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>'),Bae=ae('<div class="mb-error-collection" role="button" tabindex="0"><!></div>');function Nf(r,e){De(e,!0);function t(){e.plugin.internal.openErrorCollectionViewModal(e.settings)}var n=Qr(),i=Ke(n);at(i,()=>!e.settings.errorCollection.isEmpty(),a=>{var o=Bae();o.__click=[Cae,t],o.__keydown=[Nae,t];var u=de(o);at(u,()=>e.settings.errorCollection.hasErrors(),c=>{var s=Fae();Ut(2),te(c,s)},c=>{var s=Qr(),l=Ke(s);at(l,()=>e.settings.errorCollection.hasWarnings(),f=>{var p=Iae();te(f,p)},f=>{var p=Pae();te(f,p)},!0),te(c,s)}),ue(o),te(a,o)}),te(r,n),Ce()}Pt(["click","keydown"]);var ly=class{constructor(e,t){this.plugin=e,this.file=t}openCommandSelectModal(e){this.createSearchModal(new iy(this.plugin,e)).open()}openFileSelectModal(e){this.createSearchModal(new ay(this.plugin,e)).open()}openFolderSelectModal(e){this.createSearchModal(new oy(this.plugin,e)).open()}openButtonBuilderModal(e){this.createModal(new ny(this.plugin,e),{title:"Meta Bind Button Builder"}).open()}openSuggesterModal(e,t){this.createSearchModal(new sy(this.plugin,t,e)).open()}openImageSuggesterModal(e,t){this.createModal(new zl((n,i)=>Cr(JM,{target:i,props:{plugin:this.plugin,options:this.getImageSuggesterOptions(e),onSelect:a=>{t(a),n.closeModal()}}})),{title:"Meta Bind image suggester",classes:["mb-image-suggester-modal"]}).open()}openDatePickerModal(e){this.createModal(new zl((t,n)=>Cr(BM,{target:n,props:{selectedDate:e.getInternalValue(),dateChangeCallback:i=>{e.setInternalValue(i),t.closeModal()}}})),{title:"Meta Bind date picker"}).open()}openTextPromptModal(e){this.createModal(new zl((t,n)=>Cr(XM,{target:n,props:{options:{...e,onSubmit:i=>{e.onSubmit(i),t.closeModal()},onCancel:()=>{e.onCancel(),t.closeModal()}}}})),e).open()}openErrorCollectionViewModal(e){this.createModal(new zl((t,n)=>Cr(Zs,{target:n,props:{settings:e}})),{title:"Meta Bind error overview",classes:["mb-error-collection-modal","markdown-rendered"]}).open()}createErrorIndicator(e,t){Cr(Nf,{target:e,props:{plugin:this.plugin,settings:t}})}};var h6=require("obsidian"),cy=class{constructor(){}setSearch(e){this.preparedSearch=(0,h6.prepareFuzzySearch)(e)}filterItems(e,t){return this.preparedSearch?e.filter(n=>this.preparedSearch?.(t(n))?.score!=null):e}};var ha=require("obsidian");var Wu=class{constructor(e,t){this.value=e,this.displayValue=t}valueAsString(){return this.value?.toString()??"null"}};function g6(r){let e=[];for(let t of r.children)t instanceof ha.TFile&&v6(t.extension)&&e.push(new Wu(t.path,t.name)),t instanceof ha.TFolder&&e.push(...g6(t));return e}function kae(r,e,t){let n=[];for(let i of e){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let u=new Vr({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 ha.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}let o;if(a===""||a==="."?o=t.app.vault.getRoot():o=t.app.vault.getAbstractFileByPath(a),o==null){let u=new Vr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new ha.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!(o instanceof ha.TFolder)){let u=new Vr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new ha.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}n.push(...g6(o))}for(let i of r){let a=Eo(i.value);if(!a){let u=new Vr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new ha.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}let o=t.app.vault.getAbstractFileByPath(a);if(!o){let u=new Vr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new ha.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!(o instanceof ha.TFile)){let u=new Vr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new ha.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!v6(o.extension)){let u=new Vr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new ha.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}n.push(new Wu(o.path,o.name))}return n}function v6(r){return["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"].contains(r)}function y6(r,e){let t=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery");return kae(t,n,r)}var x6=require("obsidian");var fy=class extends x6.Modal{constructor(e,t,n){super(e.app),this.content=t,t.setModal(this),this.options=n}onOpen(){this.options?.title&&this.titleEl.setText(this.options.title),this.options?.classes&&ct.addClasses(this.modalEl,this.options.classes),this.content.mount(this.contentEl)}onClose(){this.content.unmount()}};var b6=require("obsidian"),py=class extends b6.FuzzySuggestModal{constructor(e,t){super(e.app),this.content=t}getItems(){return this.content.getItems()}getItemText(e){return this.content.getItemText(e)}onChooseItem(e,t){this.content.onSelected(e)}};var w6=require("obsidian");function $ae(r,e,t,n,i){let a=[];for(let o of t)a.push(new Wu(o.value,o.name));if(n.length>0){let o;try{o=p6(r)}catch(c){return new w6.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",c),a}let u=he.object({name:he.string().min(1),path:he.string().min(1)});for(let c of n)o.pages(c.value,e).forEach(l=>{try{let f=l.file;if(!u.safeParse(f).success)return;let p=i6(f.path,f.name,i);a.push(new Wu(p,`file: ${f.name}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function _6(r,e){let t=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery"),i=e.mountable.getArgument("useLinks");return $ae(r,e.mountable.getFilePath(),t,n,i===void 0?"true":i.value)}var S6=require("obsidian"),my=class{constructor(){this.menu=new S6.Menu}setItems(e){for(let t of e)this.menu.addItem(n=>{n.setTitle(t.name),t.icon&&n.setIcon(t.icon),t.warning&&n.setWarning(t.warning),n.onClick(t.onclick)})}show(e,t){this.menu.showAtPosition({x:e,y:t},document)}showWithEvent(e){this.menu.showAtMouseEvent(e)}};var Hl=require("obsidian");var dy=class{constructor(e){this.plugin=e}isExcludedFromRendering(e){for(let t of this.plugin.settings.excludedFolders)if(e.startsWith(t))return!0;return!1}};var hy=class extends dy{constructor(e){super(e),this.app=e.app}async read(e){let t=this.app.vault.getAbstractFileByPath(e);if(!t||!(t instanceof Hl.TFile))throw new Error(`file not found: ${e}`);return this.app.vault.cachedRead(t)}async write(e,t){let n=this.app.vault.getFileByPath(e);if(!n)throw new Error(`file not found: ${e}`);await this.app.vault.modify(n,t)}async exists(e){return this.app.vault.getFileByPath(e)!==null}async atomicModify(e,t){let n=this.app.vault.getFileByPath(e);if(!n)throw new Error(`file not found: ${e}`);await this.app.vault.process(n,i=>t(i))}async create(e,t,n,i){let a=this.app.vault.getAvailablePath((0,Hl.normalizePath)(e+"/"+t),n),o=await this.app.vault.create(a,"");if(i){let u=this.app.workspace.getLeaf(!1);u&&await u.openFile(o,{state:{mode:"source"}})}return o.path}getAllFiles(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Hl.TFile).map(e=>e.path)}getAllFolders(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Hl.TFolder).map(e=>e.path)}open(e,t,n){this.app.workspace.openLinkText(e,t,n)}getPathByName(e,t=""){return this.app.metadataCache.getFirstLinkpathDest(e,t)?.path}};var bm=require("obsidian");var gy=class{constructor(e,t,n,i,a){this.plugin=e,this.containerEl=t,this.code=i,this.hidden=a;let o=e.app.vault.getAbstractFileByPath(n);if(!(o instanceof bm.TFile))throw new Error(`File not found: ${n}`);this.file=o,this.jsEngine=Gu(this.plugin),this.renderComponent=new bm.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{ct.empty(this.containerEl),ct.removeClass(this.containerEl,"mb-error"),this.renderComponent.unload(),this.renderComponent=new bm.Component,this.renderComponent.load();let t=await this.evaluateCode(e),n=this.jsEngine.internal.createRenderer(this.containerEl,this.file.path,this.renderComponent);return this.hidden||await n.render(t.result),n.convertToSimpleObject(t.result)}catch(t){t instanceof Error&&(this.containerEl.innerText=t.message,ct.addClass(this.containerEl,"mb-error"));return}}unload(){this.renderComponent.unload()}};var vy=class extends ly{constructor(e){super(e,new hy(e)),this.app=e.app}getLifecycleHookValidator(){return he.instanceof(An.Component)}getImageSuggesterOptions(e){return y6(this.plugin,e)}getSuggesterOptions(e){return _6(this.plugin,e)}async renderMarkdown(e,t,n){let i=new An.Component;return i.load(),await An.MarkdownRenderer.render(this.app,e,t,n,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return Gu(this.plugin),!0}catch{return!1}}async jsEngineRunFile(e,t,n,i){let a=Gu(this.plugin),o=this.app.vault.getAbstractFileByPath(t);if(!o||!(o instanceof An.TFile))throw new Error(`calling file not found: ${t}`);let u=this.app.metadataCache.getFileCache(o),c=new An.Component;return await a.internal.executeFile(e,{component:c,container:i,context:{metadata:u,file:o,line:0},contextOverrides:n}),()=>c.unload()}async jsEngineRunCode(e,t,n,i){let a=Gu(this.plugin),o=this.app.vault.getAbstractFileByPath(t);if(!o||!(o instanceof An.TFile))throw new Error(`calling file not found: ${t}`);let u=this.app.metadataCache.getFileCache(o),c=new An.Component;return await a.internal.execute({code:e,component:c,container:i,context:{metadata:u,file:o,line:0},contextOverrides:n}),()=>c.unload()}createJsRenderer(e,t,n,i){return new gy(this.plugin,e,t,n,i)}showNotice(e){new An.Notice(e)}parseYaml(e){return(0,An.parseYaml)(e)}stringifyYaml(e){return(0,An.stringifyYaml)(e)}setIcon(e,t){(0,An.setIcon)(e,t)}imagePathToUri(e){return this.app.vault.adapter.getResourcePath(e)}createModal(e,t){return new fy(this.plugin,e,t)}createSearchModal(e){return new py(this.plugin,e)}getAllCommands(){return this.app.commands.listCommands().map(e=>({id:e.id,name:e.name}))}createFuzzySearch(){return new cy}createContextMenu(e){let t=new my;return t.setItems(e),t}async evaluateTemplaterTemplate(e,t){let n=IM(this.plugin),i=this.app.vault.getAbstractFileByPath(e);if(!i||!(i instanceof An.TFile))throw new Error(`Template file not found: ${e}`);let a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof An.TFile))throw new Error(`Target file not found: ${t}`);let o=n.create_running_config(i,a,4);return await n.read_and_parse_template(o)}async createNoteWithTemplater(e,t,n,i){let a=IM(this.plugin),o=this.app.vault.getAbstractFileByPath(e);if(!o||!(o instanceof An.TFile))throw new Error(`Template file not found: ${e}`);let u;if(t!==void 0){let s=this.app.vault.getAbstractFileByPath(t);if(!s||!(s instanceof An.TFolder))throw new Error(`Folder not found: ${t}`);u=s}return(await a.create_new_note_from_template(o,u,n,i??!0))?.path}};var QM=require("obsidian");var yy=class extends nc{constructor(e,t,n){super(t,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 t=this.plugin.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof QM.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(t)?.frontmatter;return structuredClone(n)??{}}getDefaultCacheItem(e){let t=this.plugin.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof QM.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(t)?.frontmatter;return{data:structuredClone(n)??{},storagePath:e,file:t,...this.manager.getDefaultCacheItem()}}getTags(e){let t=this.plugin.app.metadataCache.getFileCache(e);if(!t)return[];let n=t.tags?.map(a=>a.tag.substring(1))??[],i=t.frontmatter?.tags;return i&&(Array.isArray(i)?n.push(...i):n.push(i)),Array.from(new Set(n))}async syncExternal(e){await this.plugin.app.fileManager.processFrontMatter(e.file,t=>{Object.assign(t,e.data)})}};var wm=class extends eu{constructor(e,t){super(void 0),this.ctx=e,this.element=t}getPosition(){let e=this.ctx.getSectionInfo(this.element);if(e)return{lineStart:e.lineStart,lineEnd:e.lineEnd}}};var A6=require("obsidian");function KM(r,e){De(e,!0);let t=new zc(e.plugin,qr(),"","block",e.declaration);wu(r,{mountable:t}),Ce()}var Oae=ae('<div class="mb-card"><h3> </h3> <!> <!> <code> </code></div>');function eD(r,e){De(e,!0);let t=e.plugin.api.createInlineFieldFromString(e.declaration.inputField,"",void 0,"block"),n=e.plugin.api.createInlineFieldFromString(e.declaration.declaration,"",void 0,"block");var i=Oae(),a=de(i),o=de(a,!0);ue(a);var u=ce(a,2);wu(u,{mountable:t});var c=ce(u,2);wu(c,{mountable:n});var s=ce(c,2),l=de(s,!0);ue(s),ue(i),Ve(()=>{ft(o,e.declaration.title),ft(l,e.declaration.display)}),te(r,i),Ce()}var Rae=ae("<h1>Meta Bind Playground</h1> <span><!> <!> <!></span>",1),Lae=ae(`<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 tD(r,e){De(e,!0);let t="INPUT[someInputFieldDeclaration]",n=Ue(new Xt("exampleWarningErrorCollection")),i="INPUT[someInputFieldDeclaration]",a=Ue(new Xt("exampleErrorErrorCollection"));_p(()=>{n.add(new Vf({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),a.add(new Vf({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"}))});var o=Lae(),u=de(o);js(u,{children:(M,w)=>{var D=Rae(),N=ce(Ke(D),2),B=de(N);It(B,{get variant(){return"primary"},onclick:()=>{Yt.open(Yt.linkToHome())},children:(V,k)=>{Ut();var P=gr("Docs");te(V,P)},$$slots:{default:!0}});var R=ce(B,2);It(R,{onclick:()=>{Yt.open(Yt.linkToGithub())},children:(V,k)=>{Ut();var P=gr("GitHub");te(V,P)},$$slots:{default:!0}});var z=ce(R,2);It(z,{onclick:()=>{Yt.open(Yt.linkToIssues())},children:(V,k)=>{Ut();var P=gr("Report Issue");te(V,P)},$$slots:{default:!0}}),ue(N),te(M,D)},$$slots:{default:!0}});var c=ce(u,6),s=ce(de(c));Ve(()=>_t(s,"href",Yt.linkToInputFields()));var l=ce(s,2);Ve(()=>_t(l,"href",Yt.linkToViewFields()));var f=ce(l,4),p=Qt(()=>({errorCollection:n,code:t}));Nf(f,{get plugin(){return e.plugin},get settings(){return U(p)}});var m=ce(f,4),d=Qt(()=>({errorCollection:a,code:i}));Nf(m,{get plugin(){return e.plugin},get settings(){return U(d)}}),Ut(3),ue(c);var h=ce(c,10),x=ce(de(h),2);Ve(()=>_t(x,"href",Yt.linkToInputFields()));var b=ce(x,2);Ve(()=>_t(b,"href",Yt.linkToViewFields())),Ut(),ue(h);var T=ce(h,6),v=de(T);Ve(()=>_t(v,"href",Yt.linkToInputFields())),Ut(),ue(T);var S=ce(T,2);Wt(S,17,()=>bN(e.plugin),Kt,(M,w)=>{KM(M,{get declaration(){return U(w)[1]},get plugin(){return e.plugin}})});var _=ce(S,4),y=de(_);Ve(()=>_t(y,"href",Yt.linkToViewFields())),Ut(),ue(_);var A=ce(_,2);Wt(A,17,()=>Object.values(gx),Kt,(M,w)=>{var D=Qr(),N=Ke(D);Wt(N,17,()=>U(w),Kt,(B,R)=>{eD(B,{get declaration(){return U(R)},get plugin(){return e.plugin}})}),te(M,D)}),ue(o),te(r,o),Ce()}var Gl="mb-playground-view-type",xy=class extends A6.ItemView{constructor(e,t){super(e),this.plugin=t}getViewType(){return Gl}getDisplayText(){return"Meta Bind playground"}async onOpen(){this.contentEl.empty(),this.component=Cr(tD,{target:this.contentEl,props:{plugin:this.plugin}})}async onClose(){this.component&&Fr(this.component)}};var ai=require("obsidian");var E6=require("obsidian");var Sm=require("obsidian");var _m=require("obsidian");var Vae=ae("<span> </span> <!> <!> <!>",1),Uae=ae('<div class="mb-card markdown-rendered"><!> <pre class="mb-pre"><code class="mb-none"> </code></pre></div>');function rD(r,e){De(e,!0);let t=bt(e,"template",15);function n(){e.plugin.internal.openButtonBuilderModal({submitText:"Submit",config:li(t()),onOkay:l=>{t(l)}})}function i(){let l=(0,_m.stringifyYaml)(li(t()));navigator.clipboard.writeText(l),new _m.Notice("meta-bind | Copied to clipboard")}var a=Uae(),o=de(a);js(o,{stretchChildren:!0,children:(l,f)=>{var p=Vae(),m=Ke(p),d=de(m,!0);ue(m);var h=ce(m,2);It(h,{onclick:()=>n(),get variant(){return"primary"},tooltip:"Edit",children:(T,v)=>{Xr(T,{get plugin(){return e.plugin},iconName:"pen-line"})},$$slots:{default:!0}});var x=ce(h,2);It(x,{onclick:()=>i(),get variant(){return"default"},tooltip:"Copy",children:(T,v)=>{Xr(T,{get plugin(){return e.plugin},iconName:"copy"})},$$slots:{default:!0}});var b=ce(x,2);It(b,{onclick:()=>e.onDelete(t()),get variant(){return"destructive"},tooltip:"Delete",children:(T,v)=>{Xr(T,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),Ve(()=>ft(d,t().id)),te(l,p)},$$slots:{default:!0}});var u=ce(o,2),c=de(u),s=de(c,!0);Ve(()=>ft(s,(0,_m.stringifyYaml)(t()))),ue(c),ue(u),ue(a),te(r,a),Ce()}var qae=ae('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),zae=ae("<!> <!>",1),Hae=ae("<div><h2>Meta Bind Button Templates</h2> <!> <!> <!> <!> <!></div>");function nD(r,e){De(e,!0);let t=ht(void 0),n=ht(Ue(e.buttonConfigs));function i(h){Oe(n,Ue(U(n).filter(x=>x!==h)))}function a(){U(n).push(e.modal.plugin.api.buttonActionRunner.createDefaultButtonConfig())}async function o(){let h;try{h=(0,Sm.parseYaml)(await navigator.clipboard.readText())}catch(b){console.warn(b),new Sm.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}let x=_c.safeParse(h);if(!x.success){let b=wv(x.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});console.warn(new vs({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:b.message,docs:[Yt.linkToButtonConfig()]})),console.warn(b),new Sm.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}U(n).push(h)}function u(){Oe(t,Ue(e.modal.save(li(U(n))))),U(t)===void 0&&e.modal.close()}function c(){e.modal.close()}var s=Hae(),l=ce(de(s),2);Wt(l,17,()=>U(n),Kt,(h,x,b)=>{rD(h,{get plugin(){return e.modal.plugin},get template(){return U(n)[b]},set template(T){U(n)[b]=T},onDelete:i})});var f=ce(l,2);It(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create new template",children:(h,x)=>{Ut();var b=gr("Add Template");te(h,b)},$$slots:{default:!0}});var p=ce(f,2);It(p,{onclick:()=>o(),get variant(){return"default"},tooltip:"Create new template from YAML in clipboard",children:(h,x)=>{Ut();var b=gr("Add Template from Clipboard");te(h,b)},$$slots:{default:!0}});var m=ce(p,2);at(m,()=>U(t),h=>{var x=qae(),b=ce(de(x),2),T=Qt(()=>({errorCollection:U(t)}));Zs(b,{get settings(){return U(T)}}),ue(x),te(h,x)});var d=ce(m,2);Ro(d,{children:(h,x)=>{var b=zae(),T=Ke(b);It(T,{onclick:()=>u(),get variant(){return"primary"},tooltip:"Save changes",children:(S,_)=>{Ut();var y=gr("Save");te(S,y)},$$slots:{default:!0}});var v=ce(T,2);It(v,{onclick:()=>c(),tooltip:"Revert changes",children:(S,_)=>{Ut();var y=gr("Cancel");te(S,y)},$$slots:{default:!0}}),te(h,b)},$$slots:{default:!0}}),ue(s),te(r,s),Ce()}var by=class extends E6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&Fr(this.component),this.component=Cr(nD,{target:this.contentEl,props:{buttonConfigs:GD(this.plugin.settings.buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Fr(this.component)}save(e){let t=this.plugin.api.buttonManager.setButtonTemplates(e);if(t.hasErrors())return t;this.plugin.settings.buttonTemplates=e,this.plugin.saveSettings()}};var T6=require("obsidian");var Gae=ae('<tr><td class="mb-excluded-folders-table-input-cell"><input type="text" placeholder="path/to/folder"></td><td><!></td></tr>'),Wae=ae('<div><h3 class="mod-error">Some folder paths are invalid</h3> <!></div>'),Yae=ae("<!> <!>",1),jae=ae('<div><table class="mb-excluded-folders-table"><thead><tr><th>Folder Path</th><th></th></tr></thead><tbody></tbody></table> <!> <!> <!></div>');function iD(r,e){De(e,!0);let t=ht(void 0),n=ht(Ue(e.excludedFolders));function i(d){Oe(n,Ue(U(n).filter(h=>h!==d)))}function a(){U(n).push("")}function o(){Oe(t,Ue(e.modal.save(li(U(n))))),U(t)===void 0&&e.modal.close()}function u(){e.modal.close()}var c=jae(),s=de(c),l=ce(de(s));Wt(l,21,()=>U(n),Kt,(d,h,x)=>{var b=Gae(),T=de(b),v=de(T);St(v),ue(T);var S=ce(T),_=de(S);It(_,{onclick:()=>i(U(h)),tooltip:"Delete",children:(y,A)=>{Xr(y,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),ue(S),ue(b),vt(v,()=>U(n)[x],y=>U(n)[x]=y),te(d,b)}),ue(l),ue(s);var f=ce(s,2);It(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Add new excluded folder",children:(d,h)=>{Ut();var x=gr("Add folder");te(d,x)},$$slots:{default:!0}});var p=ce(f,2);at(p,()=>U(t),d=>{var h=Wae(),x=ce(de(h),2),b=Qt(()=>({errorCollection:U(t)}));Zs(x,{get settings(){return U(b)}}),ue(h),te(d,h)});var m=ce(p,2);Ro(m,{children:(d,h)=>{var x=Yae(),b=Ke(x);It(b,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save changes",children:(v,S)=>{Ut();var _=gr("Save");te(v,_)},$$slots:{default:!0}});var T=ce(b,2);It(T,{onclick:()=>u(),tooltip:"Revert changes",children:(v,S)=>{Ut();var _=gr("Cancel");te(v,_)},$$slots:{default:!0}}),te(d,x)},$$slots:{default:!0}}),ue(c),te(r,c),Ce()}var wy=class extends T6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&Fr(this.component),this.component=Cr(iD,{target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this,plugin:this.plugin}})}onClose(){this.contentEl.empty(),this.component&&Fr(this.component)}save(e){for(let t of e)if(t===""){let n=new Xt("Excluded folders");return n.add(new Error(`Invalid Folder Path '${t}'. Folder path may not be empty.`)),n}this.plugin.settings.excludedFolders=e,this.plugin.saveSettings()}};var M6=require("obsidian");var Zae=ae('<input type="text" placeholder="template-name"> <!>',1),Jae=ae('<div class="mb-card"><!> <textarea placeholder="INPUT[slider(addLabels)]" class="mb-textarea"></textarea></div>');function aD(r,e){De(e,!0);let t=bt(e,"template",15);var n=Jae(),i=de(n);js(i,{children:(o,u)=>{var c=Zae(),s=Ke(c);St(s);var l=ce(s,2);It(l,{onclick:()=>e.onDelete(t()),get variant(){return"destructive"},tooltip:"Delete Template",children:(f,p)=>{Xr(f,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),vt(s,()=>t().name,f=>t(t().name=f,!0)),te(o,c)},$$slots:{default:!0}});var a=ce(i,2);Fn(a),ue(n),vt(a,()=>t().declaration,o=>t(t().declaration=o,!0)),te(r,n),Ce()}var Xae=ae('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),Qae=ae("<!> <!>",1),Kae=ae("<div><h2>Meta Bind Input Field Templates</h2> <!> <!> <!> <!></div>");function oD(r,e){De(e,!0);let t=ht(void 0),n=ht(Ue(e.inputFieldTemplates));function i(m){Oe(n,Ue(U(n).filter(d=>d!==m)))}function a(){U(n).push({name:"",declaration:""})}function o(){Oe(t,Ue(e.modal.save(li(U(n))))),U(t)===void 0&&e.modal.close()}function u(){e.modal.close()}var c=Kae(),s=ce(de(c),2);Wt(s,17,()=>U(n),Kt,(m,d)=>{aD(m,{get plugin(){return e.modal.plugin},get template(){return U(d)},onDelete:i})});var l=ce(s,2);It(l,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create New Template",children:(m,d)=>{Ut();var h=gr("Add Template");te(m,h)},$$slots:{default:!0}});var f=ce(l,2);at(f,()=>U(t),m=>{var d=Xae(),h=ce(de(d),2),x=Qt(()=>({errorCollection:U(t)}));Zs(h,{get settings(){return U(x)}}),ue(d),te(m,d)});var p=ce(f,2);Ro(p,{children:(m,d)=>{var h=Qae(),x=Ke(h);It(x,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save Changes",children:(T,v)=>{Ut();var S=gr("Save");te(T,S)},$$slots:{default:!0}});var b=ce(x,2);It(b,{onclick:()=>u(),tooltip:"Revert Changes",children:(T,v)=>{Ut();var S=gr("Cancel");te(T,S)},$$slots:{default:!0}}),te(m,h)},$$slots:{default:!0}}),ue(c),te(r,c),Ce()}var _y=class extends M6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&Fr(this.component),this.component=Cr(oD,{target:this.contentEl,props:{inputFieldTemplates:JSON.parse(JSON.stringify(this.plugin.settings.inputFieldTemplates)),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Fr(this.component)}save(e){let t=this.plugin.api.inputFieldParser.parseTemplates(e);if(t.hasErrors())return t;this.plugin.settings.inputFieldTemplates=e,this.plugin.saveSettings()}};var Sy=class extends ai.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t}display(){let{containerEl:e}=this;if(e.empty(),this.plugin.build==="dev"||this.plugin.build==="canary"){e.createEl("p",{text:`You are using a ${this.plugin.build} build (${this.plugin.manifest.version}). This build is not intended for production use. Use at your own risk.`,cls:"mb-error"});let t=new ai.ButtonComponent(e);t.setButtonText("Learn About Canary Builds"),t.setCta(),t.onClick(()=>{Yt.open(Yt.linkToCanaryBuilds())})}new ai.Setting(e).setName("Quick access").addButton(t=>{t.setCta(),t.setButtonText("Docs"),t.onClick(()=>{Yt.open(Yt.linkToHome())})}).addButton(t=>{t.setButtonText("Open FAQ"),t.onClick(()=>{this.plugin.activateView(Gl)})}).addButton(t=>{t.setButtonText("GitHub"),t.onClick(()=>{Yt.open(Yt.linkToGithub())})}).addButton(t=>{t.setButtonText("Report issue"),t.onClick(()=>{Yt.open(Yt.linkToIssues())})}),new ai.Setting(e).setName("Enable syntax highlighting").setDesc("Enable syntax highlighting for meta bind syntax. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableSyntaxHighlighting),t.onChange(n=>{this.plugin.settings.enableSyntaxHighlighting=n,this.plugin.saveSettings()})}),new ai.Setting(e).setName("Enable editor right-click menu").setDesc("Enable a meta bind menu section in the editor right-click menu. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableEditorRightClickMenu),t.onChange(n=>{this.plugin.settings.enableEditorRightClickMenu=n,this.plugin.saveSettings()})}),new ai.Setting(e).setName("Input field templates").setDesc("You can specify input field templates here, and access them using `INPUT[template_name][overrides (optional)]` in your notes.").addButton(t=>{t.setButtonText("Edit templates"),t.onClick(()=>{new _y(this.app,this.plugin).open()})}),new ai.Setting(e).setName("Button templates").setDesc("You can specify button field templates here, and access them in inline buttons.").addButton(t=>{t.setButtonText("Edit templates"),t.onClick(()=>{new by(this.app,this.plugin).open()})}),new ai.Setting(e).setName("Excluded folders").setDesc("You can specify excluded folders here. The plugin will not work within excluded folders.").addButton(t=>{t.setButtonText("Edit excluded folders"),t.onClick(()=>{new wy(this.app,this.plugin).open()})}),new ai.Setting(e).setName("View fields display null as empty").setDesc("Display nothing instead of null, if the frontmatter value is empty, in text view fields.").addToggle(t=>{t.setValue(this.plugin.settings.viewFieldDisplayNullAsEmpty),t.onChange(n=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=n,this.plugin.saveSettings()})}),new ai.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(t=>{t.setValue(this.plugin.settings.enableJs),t.onChange(n=>{this.plugin.settings.enableJs=n,this.plugin.saveSettings()})}),e.createEl("h2",{text:"Date and time settings"}),new ai.Setting(e).setName("Date format").setDesc("The date format to be used by this plugin. Changing this setting will break the parsing of existing date inputs. Here is a list of all available date tokes https://momentjs.com/docs/#/displaying/.").addText(t=>{t.setValue(this.plugin.settings.preferredDateFormat),t.onChange(n=>{this.plugin.settings.preferredDateFormat=n,this.plugin.saveSettings()})}),new ai.Setting(e).setName("First weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(t=>{for(let n of Xu)t.addOption(n.name,n.name);t.setValue(this.plugin.settings.firstWeekday.name),t.onChange(n=>{this.plugin.settings.firstWeekday=Xu.find(i=>i.name===n),this.plugin.saveSettings()})}),e.createEl("h2",{text:"Advanced settings"}),new ai.Setting(e).setName("Dev mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(t=>{t.setValue(this.plugin.settings.devMode),t.onChange(n=>{this.plugin.settings.devMode=n,this.plugin.saveSettings()})}),new ai.Setting(e).setName("Disable code block restrictions").setDesc("Disable restrictions on which input fields can be created in which code blocks. Not recommended unless you know what you are doing.").addToggle(t=>{t.setValue(this.plugin.settings.ignoreCodeBlockRestrictions),t.onChange(n=>{this.plugin.settings.ignoreCodeBlockRestrictions=n,this.plugin.saveSettings()})}),new ai.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: ${wo.syncInterval}; Minimum: ${wo.minSyncInterval}; Maximum: ${wo.maxSyncInterval}`).addText(t=>{t.setValue(this.plugin.settings.syncInterval.toString()),t.onChange(n=>{this.plugin.settings.syncInterval=Number.parseInt(n),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=wo.syncInterval),this.plugin.settings.syncInterval<wo.minSyncInterval&&(this.plugin.settings.syncInterval=wo.minSyncInterval),this.plugin.settings.syncInterval>wo.maxSyncInterval&&(this.plugin.settings.syncInterval=wo.maxSyncInterval),this.plugin.saveSettings()})})}};var sD=(n=>(n.DEV="dev",n.CANARY="canary",n.RELEASE="release",n))(sD||{}),Ay=class extends Ey.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 Sy(this.app,this)),this.dependencyManager=new cd(this,[{name:"Dataview",pluginId:"dataview",minVersion:new xa(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new xa(0,1,0)},{name:"Templater",pluginId:"templater-obsidian",minVersion:new xa(2,2,3)}]),!this.dependencyManager.checkDependenciesOnStartup()&&(this.api=new ty(this),this.internal=new vy(this),this.mountableManager=new Zm,this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(yN(this)),this.addCommands(),aC(this),this.registerView(Gl,e=>new xy(e,this)),this.addStatusBarBuildIndicator(),this.settings.enableEditorRightClickMenu&&this.registerEvent(this.app.workspace.on("editor-menu",(e,t)=>{AN(e,t,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 jm,this.metadataManager.registerSource(new yy(this,"frontmatter",this.metadataManager)),this.metadataManager.registerSource(new Vm("memory",this.metadataManager)),this.metadataManager.registerSource(new Um("globalMemory",this.metadataManager)),this.metadataManager.registerSource(new qm("scope",this.metadataManager)),this.metadataManager.setDefaultSource("frontmatter"),this.registerEvent(this.app.vault.on("rename",(e,t)=>{this.mountableManager.unloadFile(t),this.metadataManager.onStoragePathRenamed(t,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,t)=>{let n=e.querySelectorAll("code"),i=t.sourcePath;for(let a=0;a<n.length;a++){let o=n.item(a);if(o.hasClass("mb-none"))continue;let u=o.innerText,c=this.api.isInlineFieldDeclarationAndGetType(u);if(c===void 0)continue;let s=this.api.createInlineFieldOfTypeFromString(c,u,i,void 0);this.api.wrapInMDRC(s,o,t)}},1),this.registerMarkdownCodeBlockProcessor("meta-bind",(e,t,n)=>{let i=t,a=e.trim(),o=n.sourcePath,u=this.api.isInlineFieldDeclarationAndGetType(a);if(u===void 0)return;let c=this.api.createInlineFieldOfTypeFromString(u,a,o,void 0,"block",new wm(n,t));this.api.wrapInMDRC(c,i,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(e,t,n)=>{let i=this.api.createJsViewFieldMountable(n.sourcePath,{declaration:e});this.api.wrapInMDRC(i,t,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",(e,t,n)=>{let i=this.api.createEmbedMountable(n.sourcePath,{content:e,depth:0});this.api.wrapInMDRC(i,t,n)});for(let e=1;e<=Rm;e++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,(t,n,i)=>{let a=this.api.createEmbedMountable(i.sourcePath,{content:t,depth:e});this.api.wrapInMDRC(a,n,i)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",(e,t,n)=>{let i=this.api.createButtonMountable(n.sourcePath,{declaration:e,isPreview:!1,position:new wm(n,t)});this.api.wrapInMDRC(i,t,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(Gl)}}),this.addCommand({id:"open-help",name:"Open Help",callback:()=>{this.activateView(Gl)}}),this.addCommand({id:"open-button-builder",name:"Open Button Builder",callback:()=>{this.internal.openButtonBuilderModal({onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,Ey.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 t=this.api.buttonManager.setButtonTemplates(this.settings.buttonTemplates);t.hasErrors()&&console.warn("meta-bind | failed to parse button templates",t)}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({},wo,e),this.updateInternalSettings(),zm(e,this.settings)||await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),this.updateInternalSettings(),await this.saveData(this.settings)}updateInternalSettings(){Kn.dateFormat=this.settings.preferredDateFormat,XD(this.settings.firstWeekday),this.loadTemplates()}async onExternalSettingsChange(){await this.loadSettings()}async activateView(e){let{workspace:t}=this.app,n,i=t.getLeavesOfType(e);i.length>0?n=i[0]:(n=t.getLeaf("tab"),await n.setViewState({type:e,active:!0})),t.revealLeaf(n)}};
/*! Bundled license information:

moment/moment.js:
  (*! moment.js *)
  (*! version : 2.30.1 *)
  (*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
  (*! license : MIT *)
  (*! momentjs.com *)

complex.js/complex.js:
  (**
   * @license Complex.js v2.1.1 12/05/2020
   *
   * Copyright (c) 2020, Robert Eisele (robert@xarg.org)
   * Dual licensed under the MIT or GPL Version 2 licenses.
   **)

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
   *)

fraction.js/fraction.js:
  (**
   * @license Fraction.js v4.3.7 31/08/2023
   * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
   *
   * Copyright (c) 2023, Robert Eisele (robert@raw.org)
   * Dual licensed under the MIT or GPL Version 2 licenses.
   **)
*/

/* nosourcemap */