oscar.plaisant@icloud.com 717479f658 update
2023-10-23 23:30:51 +02:00

109 lines
842 KiB
JavaScript

"use strict";/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var k_=Object.create;var gu=Object.defineProperty;var q_=Object.getOwnPropertyDescriptor;var z_=Object.getOwnPropertyNames;var U_=Object.getPrototypeOf,V_=Object.prototype.hasOwnProperty;var dt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$_=(t,e)=>{for(var r in e)gu(t,r,{get:e[r],enumerable:!0})},y1=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of z_(e))!V_.call(t,i)&&i!==r&&gu(t,i,{get:()=>e[i],enumerable:!(n=q_(e,i))||n.enumerable});return t};var Yt=(t,e,r)=>(r=t!=null?k_(U_(t)):{},y1(e||!t||!t.__esModule?gu(r,"default",{value:t,enumerable:!0}):r,t)),H_=t=>y1(gu({},"__esModule",{value:!0}),t);var xu=dt(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.OPDUtilsObjectTraversalError=Ha.OPDUtilsParsingError=void 0;var Qc=class extends Error{constructor(e){super(e)}};Ha.OPDUtilsParsingError=Qc;var Kc=class extends Error{constructor(e){super(e)}};Ha.OPDUtilsObjectTraversalError=Kc});var Wa=dt(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.validatePath=En.parsePath=En.traverseObjectByPath=En.traverseObjectToParent=En.traverseObject=void 0;var Ci=xu();function W_(t,e){let r=rf(t);return ef(r,e)}En.traverseObject=W_;function G_(t,e){var r;let n=rf(t);if(n[0]==="")throw new Ci.OPDUtilsObjectTraversalError("can not traverse to parent on self reference");let i=n.slice(0,-1),a=(r=n.at(-1))!==null&&r!==void 0?r:"",o=ef(i,e);return{parent:{key:i,value:o},child:{key:a,value:o[a]}}}En.traverseObjectToParent=G_;function ef(t,e){for(let r of t){if(r==="")return e;if(e===void 0)return;e=e[r]}return e}En.traverseObjectByPath=ef;function rf(t){return t=t.replace(/'/g,'"'),D1(t),t.split(".").map(e=>e.split("[").map(r=>(r.endsWith("]")&&(r=r.slice(0,-1)),r.startsWith('"')&&r.endsWith('"')&&(r=r.slice(1,-1)),r))).flat()}En.parsePath=rf;function D1(t){let e="0123456789",r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=!1,i=!1;for(let a=0;a<t.length;a++){let o=t[a],c=t[a+1];if(o==="."){if(a===0)throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${o}' at position ${a} in "${t}", path may not start with '.'`);if(!(r.includes(c)||c==="_"||c==="$"))throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${c}' at position ${a+1} in "${t}", expected a letter, '_' or '$' to follow '.'`)}if(o==="[")if(e.includes(c)){i=!0;continue}else if(c==='"'){if(t[a+2]==='"')throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${t[a+2]}' at position ${a+2} in "${t}", the string between the quotation-marks may not be empty`);n=!0,a+=1;continue}else throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${c}' at position ${a+1} in "${t}", expected number or '"' to follow a '['`);if(n&&o==='"')if(c==="]"){n=!1,a+=1;continue}else throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${c}' at position ${a+1} in "${t}", expected ']' to follow a '"'`);if(i&&o==="]"){i=!1;continue}if(n&&(o==="."||o==="]"||o==="["))throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${o}' at position ${a} in "${t}"`);if(i&&!e.includes(o))throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${o}' at position ${a} in "${t}", number expected inside of brackets`);if(!i&&!n&&o==="]")throw new Ci.OPDUtilsObjectTraversalError(`Invalid character '${o}' at position ${a} in "${t}", expected '[' to proceed`)}}En.validatePath=D1});var om=dt(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});require("obsidian");var Si=class extends Error{},If=class extends Si{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},_f=class extends Si{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Rf=class extends Si{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Da=class extends Si{},ju=class extends Si{constructor(e){super(`Invalid unit ${e}`)}},Jt=class extends Si{},mi=class extends Si{constructor(){super("Zone is an abstract class")}},Be="numeric",Zn="short",fn="long",Yu={year:Be,month:Be,day:Be},PD={year:Be,month:Zn,day:Be},S8={year:Be,month:Zn,day:Be,weekday:Zn},LD={year:Be,month:fn,day:Be},kD={year:Be,month:fn,day:Be,weekday:fn},qD={hour:Be,minute:Be},zD={hour:Be,minute:Be,second:Be},UD={hour:Be,minute:Be,second:Be,timeZoneName:Zn},VD={hour:Be,minute:Be,second:Be,timeZoneName:fn},$D={hour:Be,minute:Be,hourCycle:"h23"},HD={hour:Be,minute:Be,second:Be,hourCycle:"h23"},WD={hour:Be,minute:Be,second:Be,hourCycle:"h23",timeZoneName:Zn},GD={hour:Be,minute:Be,second:Be,hourCycle:"h23",timeZoneName:fn},ZD={year:Be,month:Be,day:Be,hour:Be,minute:Be},jD={year:Be,month:Be,day:Be,hour:Be,minute:Be,second:Be},YD={year:Be,month:Zn,day:Be,hour:Be,minute:Be},JD={year:Be,month:Zn,day:Be,hour:Be,minute:Be,second:Be},M8={year:Be,month:Zn,day:Be,weekday:Zn,hour:Be,minute:Be},XD={year:Be,month:fn,day:Be,hour:Be,minute:Be,timeZoneName:Zn},QD={year:Be,month:fn,day:Be,hour:Be,minute:Be,second:Be,timeZoneName:Zn},KD={year:Be,month:fn,day:Be,weekday:fn,hour:Be,minute:Be,timeZoneName:fn},eb={year:Be,month:fn,day:Be,weekday:fn,hour:Be,minute:Be,second:Be,timeZoneName:fn},wa=class{get type(){throw new mi}get name(){throw new mi}get ianaName(){return this.name}get isUniversal(){throw new mi}offsetName(e,r){throw new mi}formatOffset(e,r){throw new mi}offset(e){throw new mi}equals(e){throw new mi}get isValid(){throw new mi}},Nf=null,mo=class extends wa{static get instance(){return Nf===null&&(Nf=new mo),Nf}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return tb(e,r,n)}formatOffset(e,r){return xs(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},Gu={};function T8(t){return Gu[t]||(Gu[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Gu[t]}var O8={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function B8(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,a,o,c,u,s,l]=n;return[o,i,a,c,u,s,l]}function I8(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:a,value:o}=r[i],c=O8[a];a==="era"?n[c]=o:yr(c)||(n[c]=parseInt(o,10))}return n}var Vu={},jn=class extends wa{static create(e){return Vu[e]||(Vu[e]=new jn(e)),Vu[e]}static resetCache(){Vu={},Gu={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(r){return!1}}constructor(e){super(),this.zoneName=e,this.valid=jn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return tb(e,r,n,this.name)}formatOffset(e,r){return xs(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=T8(this.name),[i,a,o,c,u,s,l]=n.formatToParts?I8(n,r):B8(n,r);c==="BC"&&(i=-Math.abs(i)+1);let m=Kf({year:i,month:a,day:o,hour:u===24?0:u,minute:s,second:l,millisecond:0}),p=+r,h=p%1e3;return p-=h>=0?h:1e3+h,(m-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},sD={};function _8(t,e={}){let r=JSON.stringify([t,e]),n=sD[r];return n||(n=new Intl.ListFormat(t,e),sD[r]=n),n}var Pf={};function Lf(t,e={}){let r=JSON.stringify([t,e]),n=Pf[r];return n||(n=new Intl.DateTimeFormat(t,e),Pf[r]=n),n}var kf={};function R8(t,e={}){let r=JSON.stringify([t,e]),n=kf[r];return n||(n=new Intl.NumberFormat(t,e),kf[r]=n),n}var qf={};function P8(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),a=qf[i];return a||(a=new Intl.RelativeTimeFormat(t,e),qf[i]=a),a}var gs=null;function L8(){return gs||(gs=new Intl.DateTimeFormat().resolvedOptions().locale,gs)}function k8(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,i;try{n=Lf(t).resolvedOptions(),i=t}catch(c){let u=t.substring(0,r);n=Lf(u).resolvedOptions(),i=u}let{numberingSystem:a,calendar:o}=n;return[i,a,o]}}function q8(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function z8(t){let e=[];for(let r=1;r<=12;r++){let n=ke.utc(2016,r,1);e.push(t(n))}return e}function U8(t){let e=[];for(let r=1;r<=7;r++){let n=ke.utc(2016,11,13+r);e.push(t(n))}return e}function $u(t,e,r,n,i){let a=t.listingMode(r);return a==="error"?null:a==="en"?n(e):i(e)}function V8(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var zf=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:a,...o}=n;if(!r||Object.keys(o).length>0){let c={useGrouping:!1,...n};n.padTo>0&&(c.minimumIntegerDigits=n.padTo),this.inf=R8(e,c)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):Qf(e,3);return bt(r,this.padTo)}}},Uf=class{constructor(e,r,n){this.opts=n;let i;if(e.zone.isUniversal){let o=-1*(e.offset/60),c=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&jn.create(c).valid?(i=c,this.dt=e):(i="UTC",n.timeZoneName?this.dt=e:this.dt=e.offset===0?e:ke.fromMillis(e.ts+e.offset*60*1e3))}else e.zone.type==="system"?this.dt=e:(this.dt=e,i=e.zone.name);let a={...this.opts};a.timeZone=a.timeZone||i,this.dtf=Lf(r,a)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}},Vf=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&rb()&&(this.rtf=P8(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):i4(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},kr=class{static fromOpts(e){return kr.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,r,n,i=!1){let a=e||st.defaultLocale,o=a||(i?"en-US":L8()),c=r||st.defaultNumberingSystem,u=n||st.defaultOutputCalendar;return new kr(o,c,u,a)}static resetCache(){gs=null,Pf={},kf={},qf={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n}={}){return kr.create(e,r,n)}constructor(e,r,n,i){let[a,o,c]=k8(e);this.locale=a,this.numberingSystem=r||o||null,this.outputCalendar=n||c||null,this.intl=q8(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=V8(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:kr.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1,n=!0){return $u(this,e,n,ab,()=>{let i=r?{month:e,day:"numeric"}:{month:e},a=r?"format":"standalone";return this.monthsCache[a][e]||(this.monthsCache[a][e]=z8(o=>this.extract(o,i,"month"))),this.monthsCache[a][e]})}weekdays(e,r=!1,n=!0){return $u(this,e,n,ub,()=>{let i=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},a=r?"format":"standalone";return this.weekdaysCache[a][e]||(this.weekdaysCache[a][e]=U8(o=>this.extract(o,i,"weekday"))),this.weekdaysCache[a][e]})}meridiems(e=!0){return $u(this,void 0,e,()=>lb,()=>{if(!this.meridiemCache){let r={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ke.utc(2016,11,13,9),ke.utc(2016,11,13,19)].map(n=>this.extract(n,r,"dayperiod"))}return this.meridiemCache})}eras(e,r=!0){return $u(this,e,r,cb,()=>{let n={era:e};return this.eraCache[e]||(this.eraCache[e]=[ke.utc(-40,1,1),ke.utc(2017,1,1)].map(i=>this.extract(i,n,"era"))),this.eraCache[e]})}extract(e,r,n){let i=this.dtFormatter(e,r),a=i.formatToParts(),o=a.find(c=>c.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new zf(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new Uf(e,this.intl,r)}relFormatter(e={}){return new Vf(this.intl,this.isEnglish(),e)}listFormatter(e={}){return _8(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}},Af=null,It=class extends wa{static get utcInstance(){return Af===null&&(Af=new It(0)),Af}static instance(e){return e===0?It.utcInstance:new It(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new It(tl(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${xs(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${xs(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return xs(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},$f=class extends wa{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Hi(t,e){if(yr(t)||t===null)return e;if(t instanceof wa)return t;if($8(t)){let r=t.toLowerCase();return r==="default"?e:r==="local"||r==="system"?mo.instance:r==="utc"||r==="gmt"?It.utcInstance:It.parseSpecifier(r)||jn.create(t)}else return ba(t)?It.instance(t):typeof t=="object"&&t.offset&&typeof t.offset=="number"?t:new $f(t)}var uD=()=>Date.now(),lD="system",cD=null,fD=null,mD=null,pD=60,dD,st=class{static get now(){return uD}static set now(e){uD=e}static set defaultZone(e){lD=e}static get defaultZone(){return Hi(lD,mo.instance)}static get defaultLocale(){return cD}static set defaultLocale(e){cD=e}static get defaultNumberingSystem(){return fD}static set defaultNumberingSystem(e){fD=e}static get defaultOutputCalendar(){return mD}static set defaultOutputCalendar(e){mD=e}static get twoDigitCutoffYear(){return pD}static set twoDigitCutoffYear(e){pD=e%100}static get throwOnInvalid(){return dD}static set throwOnInvalid(e){dD=e}static resetCaches(){kr.resetCache(),jn.resetCache()}};function yr(t){return typeof t=="undefined"}function ba(t){return typeof t=="number"}function rl(t){return typeof t=="number"&&t%1===0}function $8(t){return typeof t=="string"}function H8(t){return Object.prototype.toString.call(t)==="[object Date]"}function rb(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function W8(t){return Array.isArray(t)?t:[t]}function hD(t,e,r){if(t.length!==0)return t.reduce((n,i)=>{let a=[e(i),i];return n&&r(n[0],a[0])===n[0]?n:a},null)[1]}function G8(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function po(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Fi(t,e,r){return rl(t)&&t>=e&&t<=r}function Z8(t,e){return t-e*Math.floor(t/e)}function bt(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function $i(t){if(!(yr(t)||t===null||t===""))return parseInt(t,10)}function ya(t){if(!(yr(t)||t===null||t===""))return parseFloat(t)}function Xf(t){if(!(yr(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Qf(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function Cs(t){return t%4===0&&(t%100!==0||t%400===0)}function ys(t){return Cs(t)?366:365}function Ju(t,e){let r=Z8(e-1,12)+1,n=t+(e-r)/12;return r===2?Cs(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Kf(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function Xu(t){let e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,r=t-1,n=(r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400))%7;return e===4||n===3?53:52}function Hf(t){return t>99?t:t>st.twoDigitCutoffYear?1900+t:2e3+t}function tb(t,e,r,n=null){let i=new Date(t),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);let o={timeZoneName:e,...a},c=new Intl.DateTimeFormat(r,o).formatToParts(i).find(u=>u.type.toLowerCase()==="timezonename");return c?c.value:null}function tl(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function nb(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Jt(`Invalid unit value ${t}`);return e}function Qu(t,e){let r={};for(let n in t)if(po(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=nb(i)}return r}function xs(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${bt(r,2)}:${bt(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${bt(r,2)}${bt(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function nl(t){return G8(t,["hour","minute","second","millisecond"])}var j8=["January","February","March","April","May","June","July","August","September","October","November","December"],ib=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Y8=["J","F","M","A","M","J","J","A","S","O","N","D"];function ab(t){switch(t){case"narrow":return[...Y8];case"short":return[...ib];case"long":return[...j8];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var ob=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],sb=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],J8=["M","T","W","T","F","S","S"];function ub(t){switch(t){case"narrow":return[...J8];case"short":return[...sb];case"long":return[...ob];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var lb=["AM","PM"],X8=["Before Christ","Anno Domini"],Q8=["BC","AD"],K8=["B","A"];function cb(t){switch(t){case"narrow":return[...K8];case"short":return[...Q8];case"long":return[...X8];default:return null}}function e4(t){return lb[t.hour<12?0:1]}function r4(t,e){return ub(e)[t.weekday-1]}function t4(t,e){return ab(e)[t.month-1]}function n4(t,e){return cb(e)[t.year<0?0:1]}function i4(t,e,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&a){let f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`}}let o=Object.is(e,-0)||e<0,c=Math.abs(e),u=c===1,s=i[t],l=n?u?s[1]:s[2]||s[1]:u?i[t][0]:t;return o?`${c} ${l} ago`:`in ${c} ${l}`}function vD(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var a4={D:Yu,DD:PD,DDD:LD,DDDD:kD,t:qD,tt:zD,ttt:UD,tttt:VD,T:$D,TT:HD,TTT:WD,TTTT:GD,f:ZD,ff:YD,fff:XD,ffff:KD,F:jD,FF:JD,FFF:QD,FFFF:eb},Ft=class{static create(e,r={}){return new Ft(e,r)}static parseFormat(e){let r=null,n="",i=!1,a=[];for(let o=0;o<e.length;o++){let c=e.charAt(o);c==="'"?(n.length>0&&a.push({literal:i,val:n}),r=null,n="",i=!i):i||c===r?n+=c:(n.length>0&&a.push({literal:!1,val:n}),n=c,r=c)}return n.length>0&&a.push({literal:i,val:n}),a}static macroTokenToFormatOpts(e){return a4[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}formatDateTime(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r}).format()}formatDateTimeParts(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r}).formatToParts()}formatInterval(e,r={}){return this.loc.dtFormatter(e.start,{...this.opts,...r}).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r}).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return bt(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(p,h)=>this.loc.extract(e,p,h),o=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",c=()=>n?e4(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,h)=>n?t4(e,p):a(h?{month:p}:{month:p,day:"numeric"},"month"),s=(p,h)=>n?r4(e,p):a(h?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),l=p=>{let h=Ft.macroTokenToFormatOpts(p);return h?this.formatWithSystemDefault(e,h):p},f=p=>n?n4(e,p):a({era:p},"era"),m=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return c();case"d":return i?a({day:"numeric"},"day"):this.num(e.day);case"dd":return i?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return s("short",!0);case"cccc":return s("long",!0);case"ccccc":return s("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return s("short",!1);case"EEEE":return s("long",!1);case"EEEEE":return s("narrow",!1);case"L":return i?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return i?a({month:"numeric"},"month"):this.num(e.month);case"MM":return i?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return i?a({year:"numeric"},"year"):this.num(e.year);case"yy":return i?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(p)}};return vD(Ft.parseFormat(r),m)}formatDurationFromString(e,r){let n=u=>{switch(u[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=u=>s=>{let l=n(s);return l?this.num(u.get(l),s.length):s},a=Ft.parseFormat(r),o=a.reduce((u,{literal:s,val:l})=>s?u:u.concat(l),[]),c=e.shiftTo(...o.map(n).filter(u=>u));return vD(a,i(c))}},cn=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},fb=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ho(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function vo(...t){return e=>t.reduce(([r,n,i],a)=>{let[o,c,u]=a(e,i);return[{...r,...o},c||n,u]},[{},null,1]).slice(0,2)}function go(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let i=r.exec(t);if(i)return n(i)}return[null,null]}function mb(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=$i(e[r+i]);return[n,null,r+i]}}var pb=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,o4=`(?:${pb.source}?(?:\\[(${fb.source})\\])?)?`,em=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,db=RegExp(`${em.source}${o4}`),rm=RegExp(`(?:T${db.source})?`),s4=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,u4=/(\d{4})-?W(\d\d)(?:-?(\d))?/,l4=/(\d{4})-?(\d{3})/,c4=mb("weekYear","weekNumber","weekDay"),f4=mb("year","ordinal"),m4=/(\d{4})-(\d\d)-(\d\d)/,hb=RegExp(`${em.source} ?(?:${pb.source}|(${fb.source}))?`),p4=RegExp(`(?: ${hb.source})?`);function fo(t,e,r){let n=t[e];return yr(n)?r:$i(n)}function d4(t,e){return[{year:fo(t,e),month:fo(t,e+1,1),day:fo(t,e+2,1)},null,e+3]}function yo(t,e){return[{hours:fo(t,e,0),minutes:fo(t,e+1,0),seconds:fo(t,e+2,0),milliseconds:Xf(t[e+3])},null,e+4]}function Ns(t,e){let r=!t[e]&&!t[e+1],n=tl(t[e+1],t[e+2]),i=r?null:It.instance(n);return[{},i,e+3]}function As(t,e){let r=t[e]?jn.create(t[e]):null;return[{},r,e+1]}var h4=RegExp(`^T?${em.source}$`),v4=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function g4(t){let[e,r,n,i,a,o,c,u,s]=t,l=e[0]==="-",f=u&&u[0]==="-",m=(p,h=!1)=>p!==void 0&&(h||p&&l)?-p:p;return[{years:m(ya(r)),months:m(ya(n)),weeks:m(ya(i)),days:m(ya(a)),hours:m(ya(o)),minutes:m(ya(c)),seconds:m(ya(u),u==="-0"),milliseconds:m(Xf(s),f)}]}var y4={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 tm(t,e,r,n,i,a,o){let c={year:e.length===2?Hf($i(e)):$i(e),month:ib.indexOf(r)+1,day:$i(n),hour:$i(i),minute:$i(a)};return o&&(c.second=$i(o)),t&&(c.weekday=t.length>3?ob.indexOf(t)+1:sb.indexOf(t)+1),c}var x4=/^(?:(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\d)(\d\d)))$/;function D4(t){let[,e,r,n,i,a,o,c,u,s,l,f]=t,m=tm(e,i,n,r,a,o,c),p;return u?p=y4[u]:s?p=0:p=tl(l,f),[m,new It(p)]}function b4(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var w4=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,E4=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,C4=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function gD(t){let[,e,r,n,i,a,o,c]=t;return[tm(e,i,n,r,a,o,c),It.utcInstance]}function N4(t){let[,e,r,n,i,a,o,c]=t;return[tm(e,c,r,n,i,a,o),It.utcInstance]}var A4=ho(s4,rm),F4=ho(u4,rm),S4=ho(l4,rm),M4=ho(db),vb=vo(d4,yo,Ns,As),T4=vo(c4,yo,Ns,As),O4=vo(f4,yo,Ns,As),B4=vo(yo,Ns,As);function I4(t){return go(t,[A4,vb],[F4,T4],[S4,O4],[M4,B4])}function _4(t){return go(b4(t),[x4,D4])}function R4(t){return go(t,[w4,gD],[E4,gD],[C4,N4])}function P4(t){return go(t,[v4,g4])}var L4=vo(yo);function k4(t){return go(t,[h4,L4])}var q4=ho(m4,p4),z4=ho(hb),U4=vo(yo,Ns,As);function V4(t){return go(t,[q4,vb],[z4,U4])}var $4="Invalid Duration",gb={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},H4={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...gb},An=146097/400,uo=146097/4800,W4={years:{quarters:4,months:12,weeks:An/7,days:An,hours:An*24,minutes:An*24*60,seconds:An*24*60*60,milliseconds:An*24*60*60*1e3},quarters:{months:3,weeks:An/28,days:An/4,hours:An*24/4,minutes:An*24*60/4,seconds:An*24*60*60/4,milliseconds:An*24*60*60*1e3/4},months:{weeks:uo/7,days:uo,hours:uo*24,minutes:uo*24*60,seconds:uo*24*60*60,milliseconds:uo*24*60*60*1e3},...gb},xa=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],G4=xa.slice(0).reverse();function Vi(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new _e(n)}function Z4(t){return t<0?Math.floor(t):Math.ceil(t)}function yb(t,e,r,n,i){let a=t[i][r],o=e[r]/a,c=Math.sign(o)===Math.sign(n[i]),u=!c&&n[i]!==0&&Math.abs(o)<=1?Z4(o):Math.trunc(o);n[i]+=u,e[r]-=u*a}function j4(t,e){G4.reduce((r,n)=>yr(e[n])?r:(r&&yb(t,e,r,e,n),n),null)}function Y4(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var _e=class{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?W4:H4;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||kr.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return _e.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Jt(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new _e({values:Qu(e,_e.normalizeUnit),loc:kr.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(ba(e))return _e.fromMillis(e);if(_e.isDuration(e))return e;if(typeof e=="object")return _e.fromObject(e);throw new Jt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=P4(e);return n?_e.fromObject(n,r):_e.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=k4(e);return n?_e.fromObject(n,r):_e.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Jt("need to specify a reason the Duration is invalid");let n=e instanceof cn?e:new cn(e,r);if(st.throwOnInvalid)throw new Rf(n);return new _e({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new ju(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Ft.create(this.loc,n).formatDurationFromString(this,e):$4}toHuman(e={}){let r=xa.map(n=>{let i=this.values[n];return yr(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Qf(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();if(r<0||r>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e};let n=this.shiftTo("hours","minutes","seconds","milliseconds"),i=e.format==="basic"?"hhmm":"hh:mm";(!e.suppressSeconds||n.seconds!==0||n.milliseconds!==0)&&(i+=e.format==="basic"?"ss":":ss",(!e.suppressMilliseconds||n.milliseconds!==0)&&(i+=".SSS"));let a=n.toFormat(i);return e.includePrefix&&(a="T"+a),a}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.as("milliseconds")}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=_e.fromDurationLike(e),n={};for(let i of xa)(po(r.values,i)||po(this.values,i))&&(n[i]=r.get(i)+this.get(i));return Vi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=_e.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=nb(e(this.values[n],n));return Vi(this,{values:r},!0)}get(e){return this[_e.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Qu(e,_e.normalizeUnit)};return Vi(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let o={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:i,conversionAccuracy:n};return Vi(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return j4(this.matrix,e),Vi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Y4(this.normalize().shiftToAll().toObject());return Vi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>_e.normalizeUnit(o));let r={},n={},i=this.toObject(),a;for(let o of xa)if(e.indexOf(o)>=0){a=o;let c=0;for(let s in n)c+=this.matrix[s][o]*n[s],n[s]=0;ba(i[o])&&(c+=i[o]);let u=Math.trunc(c);r[o]=u,n[o]=(c*1e3-u*1e3)/1e3;for(let s in i)xa.indexOf(s)>xa.indexOf(o)&&yb(this.matrix,i,s,r,o)}else ba(i[o])&&(n[o]=i[o]);for(let o in n)n[o]!==0&&(r[a]+=o===a?n[o]:n[o]/this.matrix[a][o]);return Vi(this,{values:r},!0).normalize()}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return Vi(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of xa)if(!r(this.values[n],e.values[n]))return!1;return!0}},lo="Invalid Interval";function J4(t,e){return!t||!t.isValid?Jr.invalid("missing or invalid start"):!e||!e.isValid?Jr.invalid("missing or invalid end"):e<t?Jr.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var Jr=class{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Jt("need to specify a reason the Interval is invalid");let n=e instanceof cn?e:new cn(e,r);if(st.throwOnInvalid)throw new _f(n);return new Jr({invalid:n})}static fromDateTimes(e,r){let n=hs(e),i=hs(r),a=J4(n,i);return a==null?new Jr({start:n,end:i}):a}static after(e,r){let n=_e.fromDurationLike(r),i=hs(e);return Jr.fromDateTimes(i,i.plus(n))}static before(e,r){let n=_e.fromDurationLike(r),i=hs(e);return Jr.fromDateTimes(i.minus(n),i)}static fromISO(e,r){let[n,i]=(e||"").split("/",2);if(n&&i){let a,o;try{a=ke.fromISO(n,r),o=a.isValid}catch(s){o=!1}let c,u;try{c=ke.fromISO(i,r),u=c.isValid}catch(s){u=!1}if(o&&u)return Jr.fromDateTimes(a,c);if(o){let s=_e.fromISO(i,r);if(s.isValid)return Jr.after(a,s)}else if(u){let s=_e.fromISO(n,r);if(s.isValid)return Jr.before(c,s)}}return Jr.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds"){if(!this.isValid)return NaN;let r=this.start.startOf(e),n=this.end.startOf(e);return Math.floor(n.diff(r,e).get(e))+1}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?Jr.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(hs).filter(o=>this.contains(o)).sort(),n=[],{s:i}=this,a=0;for(;i<this.e;){let o=r[a]||this.e,c=+o>+this.e?this.e:o;n.push(Jr.fromDateTimes(i,c)),i=c,a+=1}return n}splitBy(e){let r=_e.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,a,o=[];for(;n<this.e;){let c=this.start.plus(r.mapUnits(u=>u*i));a=+c>+this.e?this.e:c,o.push(Jr.fromDateTimes(n,a)),n=a,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:Jr.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return Jr.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((i,a)=>i.s-a.s).reduce(([i,a],o)=>a?a.overlaps(o)||a.abutsStart(o)?[i,a.union(o)]:[i.concat([a]),o]:[i,o],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,i=[],a=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),o=Array.prototype.concat(...a),c=o.sort((u,s)=>u.time-s.time);for(let u of c)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&i.push(Jr.fromDateTimes(r,u.time)),r=null);return Jr.merge(i)}difference(...e){return Jr.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:lo}toLocaleString(e=Yu,r={}){return this.isValid?Ft.create(this.s.loc.clone(r),e).formatInterval(this):lo}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:lo}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:lo}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:lo}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:lo}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):_e.invalid(this.invalidReason)}mapEndpoints(e){return Jr.fromDateTimes(e(this.s),e(this.e))}},co=class{static hasDST(e=st.defaultZone){let r=ke.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return jn.isValidZone(e)}static normalizeZone(e){return Hi(e,st.defaultZone)}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||kr.create(r,n,a)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:a="gregory"}={}){return(i||kr.create(r,n,a)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||kr.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||kr.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return kr.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return kr.create(r,null,"gregory").eras(e)}static features(){return{relative:rb()}}};function yD(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(_e.fromMillis(n).as("days"))}function X4(t,e,r){let n=[["years",(u,s)=>s.year-u.year],["quarters",(u,s)=>s.quarter-u.quarter+(s.year-u.year)*4],["months",(u,s)=>s.month-u.month+(s.year-u.year)*12],["weeks",(u,s)=>{let l=yD(u,s);return(l-l%7)/7}],["days",yD]],i={},a=t,o,c;for(let[u,s]of n)r.indexOf(u)>=0&&(o=u,i[u]=s(t,e),c=a.plus(i),c>e?(i[u]--,t=a.plus(i)):t=c);return[t,i,c,o]}function Q4(t,e,r,n){let[i,a,o,c]=X4(t,e,r),u=e-i,s=r.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);s.length===0&&(o<e&&(o=i.plus({[c]:1})),o!==i&&(a[c]=(a[c]||0)+u/(o-i)));let l=_e.fromObject(a,n);return s.length>0?_e.fromMillis(u,n).shiftTo(...s).plus(l):l}var nm={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},xD={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},K4=nm.hanidec.replace(/[\[|\]]/g,"").split("");function e6(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(nm.hanidec)!==-1)e+=K4.indexOf(t[r]);else for(let i in xD){let[a,o]=xD[i];n>=a&&n<=o&&(e+=n-a)}}return parseInt(e,10)}else return e}function Hn({numberingSystem:t},e=""){return new RegExp(`${nm[t||"latn"]}${e}`)}var r6="missing Intl.DateTimeFormat.formatToParts support";function Sr(t,e=r=>r){return{regex:t,deser:([r])=>e(e6(r))}}var t6=String.fromCharCode(160),xb=`[ ${t6}]`,Db=new RegExp(xb,"g");function n6(t){return t.replace(/\./g,"\\.?").replace(Db,xb)}function DD(t){return t.replace(/\./g,"").replace(Db," ").toLowerCase()}function Wn(t,e){return t===null?null:{regex:RegExp(t.map(n6).join("|")),deser:([r])=>t.findIndex(n=>DD(r)===DD(n))+e}}function bD(t,e){return{regex:t,deser:([,r,n])=>tl(r,n),groups:e}}function Ff(t){return{regex:t,deser:([e])=>e}}function i6(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function a6(t,e){let r=Hn(e),n=Hn(e,"{2}"),i=Hn(e,"{3}"),a=Hn(e,"{4}"),o=Hn(e,"{6}"),c=Hn(e,"{1,2}"),u=Hn(e,"{1,3}"),s=Hn(e,"{1,6}"),l=Hn(e,"{1,9}"),f=Hn(e,"{2,4}"),m=Hn(e,"{4,6}"),p=g=>({regex:RegExp(i6(g.val)),deser:([D])=>D,literal:!0}),d=(g=>{if(t.literal)return p(g);switch(g.val){case"G":return Wn(e.eras("short",!1),0);case"GG":return Wn(e.eras("long",!1),0);case"y":return Sr(s);case"yy":return Sr(f,Hf);case"yyyy":return Sr(a);case"yyyyy":return Sr(m);case"yyyyyy":return Sr(o);case"M":return Sr(c);case"MM":return Sr(n);case"MMM":return Wn(e.months("short",!0,!1),1);case"MMMM":return Wn(e.months("long",!0,!1),1);case"L":return Sr(c);case"LL":return Sr(n);case"LLL":return Wn(e.months("short",!1,!1),1);case"LLLL":return Wn(e.months("long",!1,!1),1);case"d":return Sr(c);case"dd":return Sr(n);case"o":return Sr(u);case"ooo":return Sr(i);case"HH":return Sr(n);case"H":return Sr(c);case"hh":return Sr(n);case"h":return Sr(c);case"mm":return Sr(n);case"m":return Sr(c);case"q":return Sr(c);case"qq":return Sr(n);case"s":return Sr(c);case"ss":return Sr(n);case"S":return Sr(u);case"SSS":return Sr(i);case"u":return Ff(l);case"uu":return Ff(c);case"uuu":return Sr(r);case"a":return Wn(e.meridiems(),0);case"kkkk":return Sr(a);case"kk":return Sr(f,Hf);case"W":return Sr(c);case"WW":return Sr(n);case"E":case"c":return Sr(r);case"EEE":return Wn(e.weekdays("short",!1,!1),1);case"EEEE":return Wn(e.weekdays("long",!1,!1),1);case"ccc":return Wn(e.weekdays("short",!0,!1),1);case"cccc":return Wn(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return bD(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return bD(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return Ff(/[a-z_+-/]{1,256}?/i);default:return p(g)}})(t)||{invalidReason:r6};return d.token=t,d}var o6={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function s6(t,e){let{type:r,value:n}=t;if(r==="literal")return{literal:!0,val:n};let i=e[r],a=o6[r];if(typeof a=="object"&&(a=a[i]),a)return{literal:!1,val:a}}function u6(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function l6(t,e,r){let n=t.match(e);if(n){let i={},a=1;for(let o in r)if(po(r,o)){let c=r[o],u=c.groups?c.groups+1:1;!c.literal&&c.token&&(i[c.token.val[0]]=c.deser(n.slice(a,a+u))),a+=u}return[n,i]}else return[n,{}]}function c6(t){let e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return yr(t.z)||(r=jn.create(t.z)),yr(t.Z)||(r||(r=new It(t.Z)),n=t.Z),yr(t.q)||(t.M=(t.q-1)*3+1),yr(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),yr(t.u)||(t.S=Xf(t.u)),[Object.keys(t).reduce((a,o)=>{let c=e(o);return c&&(a[c]=t[o]),a},{}),r,n]}var Sf=null;function f6(){return Sf||(Sf=ke.fromMillis(1555555555555)),Sf}function m6(t,e){if(t.literal)return t;let r=Ft.macroTokenToFormatOpts(t.val),n=Eb(r,e);return n==null||n.includes(void 0)?t:n}function bb(t,e){return Array.prototype.concat(...t.map(r=>m6(r,e)))}function wb(t,e,r){let n=bb(Ft.parseFormat(r),t),i=n.map(o=>a6(o,t)),a=i.find(o=>o.invalidReason);if(a)return{input:e,tokens:n,invalidReason:a.invalidReason};{let[o,c]=u6(i),u=RegExp(o,"i"),[s,l]=l6(e,u,c),[f,m,p]=l?c6(l):[null,null,void 0];if(po(l,"a")&&po(l,"H"))throw new Da("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:u,rawMatches:s,matches:l,result:f,zone:m,specificOffset:p}}}function p6(t,e,r){let{result:n,zone:i,specificOffset:a,invalidReason:o}=wb(t,e,r);return[n,i,a,o]}function Eb(t,e){return t?Ft.create(e,t).formatDateTimeParts(f6()).map(i=>s6(i,t)):null}var Cb=[0,31,59,90,120,151,181,212,243,273,304,334],Nb=[0,31,60,91,121,152,182,213,244,274,305,335];function Fn(t,e){return new cn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Ab(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function Fb(t,e,r){return r+(Cs(t)?Nb:Cb)[e-1]}function Sb(t,e){let r=Cs(t)?Nb:Cb,n=r.findIndex(a=>a<e),i=e-r[n];return{month:n+1,day:i}}function Wf(t){let{year:e,month:r,day:n}=t,i=Fb(e,r,n),a=Ab(e,r,n),o=Math.floor((i-a+10)/7),c;return o<1?(c=e-1,o=Xu(c)):o>Xu(e)?(c=e+1,o=1):c=e,{weekYear:c,weekNumber:o,weekday:a,...nl(t)}}function wD(t){let{weekYear:e,weekNumber:r,weekday:n}=t,i=Ab(e,1,4),a=ys(e),o=r*7+n-i-3,c;o<1?(c=e-1,o+=ys(c)):o>a?(c=e+1,o-=ys(e)):c=e;let{month:u,day:s}=Sb(c,o);return{year:c,month:u,day:s,...nl(t)}}function Mf(t){let{year:e,month:r,day:n}=t,i=Fb(e,r,n);return{year:e,ordinal:i,...nl(t)}}function ED(t){let{year:e,ordinal:r}=t,{month:n,day:i}=Sb(e,r);return{year:e,month:n,day:i,...nl(t)}}function d6(t){let e=rl(t.weekYear),r=Fi(t.weekNumber,1,Xu(t.weekYear)),n=Fi(t.weekday,1,7);return e?r?n?!1:Fn("weekday",t.weekday):Fn("week",t.week):Fn("weekYear",t.weekYear)}function h6(t){let e=rl(t.year),r=Fi(t.ordinal,1,ys(t.year));return e?r?!1:Fn("ordinal",t.ordinal):Fn("year",t.year)}function Mb(t){let e=rl(t.year),r=Fi(t.month,1,12),n=Fi(t.day,1,Ju(t.year,t.month));return e?r?n?!1:Fn("day",t.day):Fn("month",t.month):Fn("year",t.year)}function Tb(t){let{hour:e,minute:r,second:n,millisecond:i}=t,a=Fi(e,0,23)||e===24&&r===0&&n===0&&i===0,o=Fi(r,0,59),c=Fi(n,0,59),u=Fi(i,0,999);return a?o?c?u?!1:Fn("millisecond",i):Fn("second",n):Fn("minute",r):Fn("hour",e)}var Tf="Invalid DateTime",CD=864e13;function Hu(t){return new cn("unsupported zone",`the zone "${t.name}" is not supported`)}function Of(t){return t.weekData===null&&(t.weekData=Wf(t.c)),t.weekData}function ps(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new ke({...r,...e,old:r})}function Ob(t,e,r){let n=t-e*60*1e3,i=r.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let a=r.offset(n);return i===a?[n,i]:[t-Math.min(i,a)*60*1e3,Math.max(i,a)]}function ND(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function Zu(t,e,r){return Ob(Kf(t),e,r)}function AD(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...t.c,year:n,month:i,day:Math.min(t.c.day,Ju(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=_e.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),c=Kf(a),[u,s]=Ob(c,r,t.zone);return o!==0&&(u+=o,s=t.zone.offset(u)),{ts:u,o:s}}function ds(t,e,r,n,i,a){let{setZone:o,zone:c}=r;if(t&&Object.keys(t).length!==0){let u=e||c,s=ke.fromObject(t,{...r,zone:u,specificOffset:a});return o?s:s.setZone(c)}else return ke.invalid(new cn("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Wu(t,e,r=!0){return t.isValid?Ft.create(kr.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Bf(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=bt(t.c.year,r?6:4),e?(n+="-",n+=bt(t.c.month),n+="-",n+=bt(t.c.day)):(n+=bt(t.c.month),n+=bt(t.c.day)),n}function FD(t,e,r,n,i,a){let o=bt(t.c.hour);return e?(o+=":",o+=bt(t.c.minute),(t.c.second!==0||!r)&&(o+=":")):o+=bt(t.c.minute),(t.c.second!==0||!r)&&(o+=bt(t.c.second),(t.c.millisecond!==0||!n)&&(o+=".",o+=bt(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!a?o+="Z":t.o<0?(o+="-",o+=bt(Math.trunc(-t.o/60)),o+=":",o+=bt(Math.trunc(-t.o%60))):(o+="+",o+=bt(Math.trunc(t.o/60)),o+=":",o+=bt(Math.trunc(t.o%60)))),a&&(o+="["+t.zone.ianaName+"]"),o}var Bb={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},v6={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},g6={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ib=["year","month","day","hour","minute","second","millisecond"],y6=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],x6=["year","ordinal","hour","minute","second","millisecond"];function SD(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new ju(t);return e}function MD(t,e){let r=Hi(e.zone,st.defaultZone),n=kr.fromObject(e),i=st.now(),a,o;if(yr(t.year))a=i;else{for(let s of Ib)yr(t[s])&&(t[s]=Bb[s]);let c=Mb(t)||Tb(t);if(c)return ke.invalid(c);let u=r.offset(i);[a,o]=Zu(t,u,r)}return new ke({ts:a,zone:r,loc:n,o})}function TD(t,e,r){let n=yr(r.round)?!0:r.round,i=(o,c)=>(o=Qf(o,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(o,c)),a=o=>r.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(r.unit)return i(a(r.unit),r.unit);for(let o of r.units){let c=a(o);if(Math.abs(c)>=1)return i(c,o)}return i(t>e?-0:0,r.units[r.units.length-1])}function OD(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var ke=class{constructor(e){let r=e.zone||st.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new cn("invalid input"):null)||(r.isValid?null:Hu(r));this.ts=yr(e.ts)?st.now():e.ts;let i=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[i,a]=[e.old.c,e.old.o];else{let c=r.offset(this.ts);i=ND(this.ts,c),n=Number.isNaN(i.year)?new cn("invalid input"):null,i=n?null:i,a=n?null:c}this._zone=r,this.loc=e.loc||kr.create(),this.invalid=n,this.weekData=null,this.c=i,this.o=a,this.isLuxonDateTime=!0}static now(){return new ke({})}static local(){let[e,r]=OD(arguments),[n,i,a,o,c,u,s]=r;return MD({year:n,month:i,day:a,hour:o,minute:c,second:u,millisecond:s},e)}static utc(){let[e,r]=OD(arguments),[n,i,a,o,c,u,s]=r;return e.zone=It.utcInstance,MD({year:n,month:i,day:a,hour:o,minute:c,second:u,millisecond:s},e)}static fromJSDate(e,r={}){let n=H8(e)?e.valueOf():NaN;if(Number.isNaN(n))return ke.invalid("invalid input");let i=Hi(r.zone,st.defaultZone);return i.isValid?new ke({ts:n,zone:i,loc:kr.fromObject(r)}):ke.invalid(Hu(i))}static fromMillis(e,r={}){if(ba(e))return e<-CD||e>CD?ke.invalid("Timestamp out of range"):new ke({ts:e,zone:Hi(r.zone,st.defaultZone),loc:kr.fromObject(r)});throw new Jt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(ba(e))return new ke({ts:e*1e3,zone:Hi(r.zone,st.defaultZone),loc:kr.fromObject(r)});throw new Jt("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=Hi(r.zone,st.defaultZone);if(!n.isValid)return ke.invalid(Hu(n));let i=st.now(),a=yr(r.specificOffset)?n.offset(i):r.specificOffset,o=Qu(e,SD),c=!yr(o.ordinal),u=!yr(o.year),s=!yr(o.month)||!yr(o.day),l=u||s,f=o.weekYear||o.weekNumber,m=kr.fromObject(r);if((l||c)&&f)throw new Da("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(s&&c)throw new Da("Can't mix ordinal dates with month/day");let p=f||o.weekday&&!l,h,d,g=ND(i,a);p?(h=y6,d=v6,g=Wf(g)):c?(h=x6,d=g6,g=Mf(g)):(h=Ib,d=Bb);let D=!1;for(let F of h){let S=o[F];yr(S)?D?o[F]=d[F]:o[F]=g[F]:D=!0}let N=p?d6(o):c?h6(o):Mb(o),v=N||Tb(o);if(v)return ke.invalid(v);let w=p?wD(o):c?ED(o):o,[b,y]=Zu(w,a,n),E=new ke({ts:b,zone:n,o:y,loc:m});return o.weekday&&l&&e.weekday!==E.weekday?ke.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${E.toISO()}`):E}static fromISO(e,r={}){let[n,i]=I4(e);return ds(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=_4(e);return ds(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=R4(e);return ds(n,i,r,"HTTP",r)}static fromFormat(e,r,n={}){if(yr(e)||yr(r))throw new Jt("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:a=null}=n,o=kr.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),[c,u,s,l]=p6(o,e,r);return l?ke.invalid(l):ds(c,u,n,`format ${r}`,e,s)}static fromString(e,r,n={}){return ke.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,i]=V4(e);return ds(n,i,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Jt("need to specify a reason the DateTime is invalid");let n=e instanceof cn?e:new cn(e,r);if(st.throwOnInvalid)throw new If(n);return new ke({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Eb(e,kr.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return bb(Ft.parseFormat(e),kr.fromObject(r)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Of(this).weekYear:NaN}get weekNumber(){return this.isValid?Of(this).weekNumber:NaN}get weekday(){return this.isValid?Of(this).weekday:NaN}get ordinal(){return this.isValid?Mf(this.c).ordinal:NaN}get monthShort(){return this.isValid?co.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?co.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?co.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?co.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}get isInLeapYear(){return Cs(this.year)}get daysInMonth(){return Ju(this.year,this.month)}get daysInYear(){return this.isValid?ys(this.year):NaN}get weeksInWeekYear(){return this.isValid?Xu(this.weekYear):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:i}=Ft.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(e=0,r={}){return this.setZone(It.instance(e),r)}toLocal(){return this.setZone(st.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=Hi(e,st.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(r||n){let a=e.offset(this.ts),o=this.toObject();[i]=Zu(o,a,e)}return ps(this,{ts:i,zone:e})}else return ke.invalid(Hu(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return ps(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Qu(e,SD),n=!yr(r.weekYear)||!yr(r.weekNumber)||!yr(r.weekday),i=!yr(r.ordinal),a=!yr(r.year),o=!yr(r.month)||!yr(r.day),c=a||o,u=r.weekYear||r.weekNumber;if((c||i)&&u)throw new Da("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(o&&i)throw new Da("Can't mix ordinal dates with month/day");let s;n?s=wD({...Wf(this.c),...r}):yr(r.ordinal)?(s={...this.toObject(),...r},yr(r.day)&&(s.day=Math.min(Ju(s.year,s.month),s.day))):s=ED({...Mf(this.c),...r});let[l,f]=Zu(s,this.o,this.zone);return ps(this,{ts:l,o:f})}plus(e){if(!this.isValid)return this;let r=_e.fromDurationLike(e);return ps(this,AD(this,r))}minus(e){if(!this.isValid)return this;let r=_e.fromDurationLike(e).negate();return ps(this,AD(this,r))}startOf(e){if(!this.isValid)return this;let r={},n=_e.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(n==="weeks"&&(r.weekday=1),n==="quarters"){let i=Math.ceil(this.month/3);r.month=(i-1)*3+1}return this.set(r)}endOf(e){return this.isValid?this.plus({[e]:1}).startOf(e).minus(1):this}toFormat(e,r={}){return this.isValid?Ft.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):Tf}toLocaleString(e=Yu,r={}){return this.isValid?Ft.create(this.loc.clone(r),e).formatDateTime(this):Tf}toLocaleParts(e={}){return this.isValid?Ft.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:a=!1}={}){if(!this.isValid)return null;let o=e==="extended",c=Bf(this,o);return c+="T",c+=FD(this,o,r,n,i,a),c}toISODate({format:e="extended"}={}){return this.isValid?Bf(this,e==="extended"):null}toISOWeekDate(){return Wu(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:a=!1,format:o="extended"}={}){return this.isValid?(i?"T":"")+FD(this,o==="extended",r,e,n,a):null}toRFC2822(){return Wu(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Wu(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Bf(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||e)&&(n&&(i+=" "),r?i+="z":e&&(i+="ZZ")),Wu(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Tf}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return _e.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=W8(r).map(_e.normalizeUnit),o=e.valueOf()>this.valueOf(),c=o?this:e,u=o?e:this,s=Q4(c,u,a,i);return o?s.negate():s}diffNow(e="milliseconds",r={}){return this.diff(ke.now(),e,r)}until(e){return this.isValid?Jr.fromDateTimes(this,e):this}hasSame(e,r){if(!this.isValid)return!1;let n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(r)<=n&&n<=i.endOf(r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||ke.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(i=e.unit,a=void 0),TD(r,this.plus(n),{...e,numeric:"always",units:i,unit:a})}toRelativeCalendar(e={}){return this.isValid?TD(e.base||ke.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(ke.isDateTime))throw new Jt("min requires all arguments be DateTimes");return hD(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(ke.isDateTime))throw new Jt("max requires all arguments be DateTimes");return hD(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:i=null,numberingSystem:a=null}=n,o=kr.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});return wb(o,e,r)}static fromStringExplain(e,r,n={}){return ke.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return Yu}static get DATE_MED(){return PD}static get DATE_MED_WITH_WEEKDAY(){return S8}static get DATE_FULL(){return LD}static get DATE_HUGE(){return kD}static get TIME_SIMPLE(){return qD}static get TIME_WITH_SECONDS(){return zD}static get TIME_WITH_SHORT_OFFSET(){return UD}static get TIME_WITH_LONG_OFFSET(){return VD}static get TIME_24_SIMPLE(){return $D}static get TIME_24_WITH_SECONDS(){return HD}static get TIME_24_WITH_SHORT_OFFSET(){return WD}static get TIME_24_WITH_LONG_OFFSET(){return GD}static get DATETIME_SHORT(){return ZD}static get DATETIME_SHORT_WITH_SECONDS(){return jD}static get DATETIME_MED(){return YD}static get DATETIME_MED_WITH_SECONDS(){return JD}static get DATETIME_MED_WITH_WEEKDAY(){return M8}static get DATETIME_FULL(){return XD}static get DATETIME_FULL_WITH_SECONDS(){return QD}static get DATETIME_HUGE(){return KD}static get DATETIME_HUGE_WITH_SECONDS(){return eb}};function hs(t){if(ke.isDateTime(t))return t;if(t&&t.valueOf&&ba(t.valueOf()))return ke.fromJSDate(t);if(t&&typeof t=="object")return ke.fromObject(t);throw new Jt(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var im={renderNullAs:"\\-",taskCompletionTracking:!1,taskCompletionUseEmojiShorthand:!1,taskCompletionText:"completion",taskCompletionDateFormat:"yyyy-MM-dd",recursiveSubTaskCompletion:!1,warnOnEmptyResult:!0,refreshEnabled:!0,refreshInterval:2500,defaultDateFormat:"MMMM dd, yyyy",defaultDateTimeFormat:"h:mm a - MMMM dd, yyyy",maxRecursiveRenderDepth:4,tableIdColumnName:"File",tableGroupColumnName:"Group",showResultCount:!0},D6={allowHtml:!0};({...im,...D6});var Ds=class{constructor(e){this.value=e,this.successful=!0}map(e){return new Ds(e(this.value))}flatMap(e){return e(this.value)}mapErr(e){return this}bimap(e,r){return this.map(e)}orElse(e){return this.value}cast(){return this}orElseThrow(e){return this.value}},bs=class{constructor(e){this.error=e,this.successful=!1}map(e){return this}flatMap(e){return this}mapErr(e){return new bs(e(this.error))}bimap(e,r){return this.mapErr(r)}orElse(e){return e}cast(){return this}orElseThrow(e){throw e?new Error(e(this.error)):new Error(""+this.error)}},Ku;(function(t){function e(a){return new Ds(a)}t.success=e;function r(a){return new bs(a)}t.failure=r;function n(a,o,c){return a.successful?o.successful?c(a.value,o.value):r(o.error):r(a.error)}t.flatMap2=n;function i(a,o,c){return n(a,o,(u,s)=>e(c(u,s)))}t.map2=i})(Ku||(Ku={}));var b6=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Q={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(typeof self!="undefined"?self:b6,function(){return function(r){var n={};function i(a){if(n[a])return n[a].exports;var o=n[a]={i:a,l:!1,exports:{}};return r[a].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=r,i.c=n,i.d=function(a,o,c){i.o(a,o)||Object.defineProperty(a,o,{configurable:!1,enumerable:!0,get:c})},i.r=function(a){Object.defineProperty(a,"__esModule",{value:!0})},i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,"a",o),o},i.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)},i.p="",i(i.s=0)}([function(r,n,i){function a(x){if(!(this instanceof a))return new a(x);this._=x}var o=a.prototype;function c(x,O){for(var R=0;R<x;R++)O(R)}function u(x,O,R){return function(V,ee){c(ee.length,function(ue){V(ee[ue],ue,ee)})}(function(V,ee,ue){O=x(O,V,ee,ue)},R),O}function s(x,O){return u(function(R,V,ee,ue){return R.concat([x(V,ee,ue)])},[],O)}function l(x,O){var R={v:0,buf:O};return c(x,function(){var V;R={v:R.v<<1|(V=R.buf,V[0]>>7),buf:function(ee){var ue=u(function(ne,Pe,ir,Er){return ne.concat(ir===Er.length-1?Buffer.from([Pe,0]).readUInt16BE(0):Er.readUInt16BE(ir))},[],ee);return Buffer.from(s(function(ne){return(ne<<1&65535)>>8},ue))}(R.buf)}}),R}function f(){return typeof Buffer!="undefined"}function m(){if(!f())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function p(x){m();var O=u(function(ue,ne){return ue+ne},0,x);if(O%8!=0)throw new Error("The bits ["+x.join(", ")+"] add up to "+O+" which is not an even number of bytes; the total should be divisible by 8");var R,V=O/8,ee=(R=function(ue){return ue>48},u(function(ue,ne){return ue||(R(ne)?ne:ue)},null,x));if(ee)throw new Error(ee+" bit range requested exceeds 48 bit (6 byte) Number max.");return new a(function(ue,ne){var Pe=V+ne;return Pe>ue.length?F(ne,V.toString()+" bytes"):E(Pe,u(function(ir,Er){var mr=l(Er,ir.buf);return{coll:ir.coll.concat(mr.v),buf:mr.buf}},{coll:[],buf:ue.slice(ne,Pe)},x).coll)})}function h(x,O){return new a(function(R,V){return m(),V+O>R.length?F(V,O+" bytes for "+x):E(V+O,R.slice(V,V+O))})}function d(x,O){if(typeof(R=O)!="number"||Math.floor(R)!==R||O<0||O>6)throw new Error(x+" requires integer length in range [0, 6].");var R}function g(x){return d("uintBE",x),h("uintBE("+x+")",x).map(function(O){return O.readUIntBE(0,x)})}function D(x){return d("uintLE",x),h("uintLE("+x+")",x).map(function(O){return O.readUIntLE(0,x)})}function N(x){return d("intBE",x),h("intBE("+x+")",x).map(function(O){return O.readIntBE(0,x)})}function v(x){return d("intLE",x),h("intLE("+x+")",x).map(function(O){return O.readIntLE(0,x)})}function w(x){return x instanceof a}function b(x){return{}.toString.call(x)==="[object Array]"}function y(x){return f()&&Buffer.isBuffer(x)}function E(x,O){return{status:!0,index:x,value:O,furthest:-1,expected:[]}}function F(x,O){return b(O)||(O=[O]),{status:!1,index:-1,value:null,furthest:x,expected:O}}function S(x,O){if(!O||x.furthest>O.furthest)return x;var R=x.furthest===O.furthest?function(V,ee){if(function(){if(a._supportsSet!==void 0)return a._supportsSet;var nt=typeof Set!="undefined";return a._supportsSet=nt,nt}()&&Array.from){for(var ue=new Set(V),ne=0;ne<ee.length;ne++)ue.add(ee[ne]);var Pe=Array.from(ue);return Pe.sort(),Pe}for(var ir={},Er=0;Er<V.length;Er++)ir[V[Er]]=!0;for(var mr=0;mr<ee.length;mr++)ir[ee[mr]]=!0;var jr=[];for(var Cr in ir)({}).hasOwnProperty.call(ir,Cr)&&jr.push(Cr);return jr.sort(),jr}(x.expected,O.expected):O.expected;return{status:x.status,index:x.index,value:x.value,furthest:O.furthest,expected:R}}var C={};function B(x,O){if(y(x))return{offset:O,line:-1,column:-1};x in C||(C[x]={});for(var R=C[x],V=0,ee=0,ue=0,ne=O;ne>=0;){if(ne in R){V=R[ne].line,ue===0&&(ue=R[ne].lineStart);break}(x.charAt(ne)===`
`||x.charAt(ne)==="\r"&&x.charAt(ne+1)!==`
`)&&(ee++,ue===0&&(ue=ne+1)),ne--}var Pe=V+ee,ir=O-ue;return R[O]={line:Pe,lineStart:ue},{offset:O,line:Pe+1,column:ir+1}}function I(x){if(!w(x))throw new Error("not a parser: "+x)}function L(x,O){return typeof x=="string"?x.charAt(O):x[O]}function k(x){if(typeof x!="number")throw new Error("not a number: "+x)}function P(x){if(typeof x!="function")throw new Error("not a function: "+x)}function M(x){if(typeof x!="string")throw new Error("not a string: "+x)}var T=2,H=3,_=8,z=5*_,Y=4*_,X=" ";function q(x,O){return new Array(O+1).join(x)}function J(x,O,R){var V=O-x.length;return V<=0?x:q(R,V)+x}function ae(x,O,R,V){return{from:x-O>0?x-O:0,to:x+R>V?V:x+R}}function re(x,O){var R,V,ee,ue,ne,Pe=O.index,ir=Pe.offset,Er=1;if(ir===x.length)return"Got the end of the input";if(y(x)){var mr=ir-ir%_,jr=ir-mr,Cr=ae(mr,z,Y+_,x.length),nt=s(function(Lr){return s(function(pt){return J(pt.toString(16),2,"0")},Lr)},function(Lr,pt){var jt=Lr.length,bn=[],wn=0;if(jt<=pt)return[Lr.slice()];for(var Ui=0;Ui<jt;Ui++)bn[wn]||bn.push([]),bn[wn].push(Lr[Ui]),(Ui+1)%pt==0&&wn++;return bn}(x.slice(Cr.from,Cr.to).toJSON().data,_));ue=function(Lr){return Lr.from===0&&Lr.to===1?{from:Lr.from,to:Lr.to}:{from:Lr.from/_,to:Math.floor(Lr.to/_)}}(Cr),V=mr/_,R=3*jr,jr>=4&&(R+=1),Er=2,ee=s(function(Lr){return Lr.length<=4?Lr.join(" "):Lr.slice(0,4).join(" ")+" "+Lr.slice(4).join(" ")},nt),(ne=(8*(ue.to>0?ue.to-1:ue.to)).toString(16).length)<2&&(ne=2)}else{var it=x.split(/\r\n|[\n\r\u2028\u2029]/);R=Pe.column-1,V=Pe.line-1,ue=ae(V,T,H,it.length),ee=it.slice(ue.from,ue.to),ne=ue.to.toString().length}var Ot=V-ue.from;return y(x)&&(ne=(8*(ue.to>0?ue.to-1:ue.to)).toString(16).length)<2&&(ne=2),u(function(Lr,pt,jt){var bn,wn=jt===Ot,Ui=wn?"> ":X;return bn=y(x)?J((8*(ue.from+jt)).toString(16),ne,"0"):J((ue.from+jt+1).toString(),ne," "),[].concat(Lr,[Ui+bn+" | "+pt],wn?[X+q(" ",ne)+" | "+J("",R," ")+q("^",Er)]:[])},[],ee).join(`
`)}function fe(x,O){return[`
`,"-- PARSING FAILED "+q("-",50),`
`,re(x,O),`
`,(R=O.expected,R.length===1?`Expected:
`+R[0]:`Expected one of the following:
`+R.join(", ")),`
`].join("");var R}function he(x){return x.flags!==void 0?x.flags:[x.global?"g":"",x.ignoreCase?"i":"",x.multiline?"m":"",x.unicode?"u":"",x.sticky?"y":""].join("")}function me(){for(var x=[].slice.call(arguments),O=x.length,R=0;R<O;R+=1)I(x[R]);return a(function(V,ee){for(var ue,ne=new Array(O),Pe=0;Pe<O;Pe+=1){if(!(ue=S(x[Pe]._(V,ee),ue)).status)return ue;ne[Pe]=ue.value,ee=ue.index}return S(E(ee,ne),ue)})}function ie(){var x=[].slice.call(arguments);if(x.length===0)throw new Error("seqMap needs at least one argument");var O=x.pop();return P(O),me.apply(null,x).map(function(R){return O.apply(null,R)})}function xe(){var x=[].slice.call(arguments),O=x.length;if(O===0)return oe("zero alternates");for(var R=0;R<O;R+=1)I(x[R]);return a(function(V,ee){for(var ue,ne=0;ne<x.length;ne+=1)if((ue=S(x[ne]._(V,ee),ue)).status)return ue;return ue})}function Me(x,O){return be(x,O).or(G([]))}function be(x,O){return I(x),I(O),ie(x,O.then(x).many(),function(R,V){return[R].concat(V)})}function Ce(x){M(x);var O="'"+x+"'";return a(function(R,V){var ee=V+x.length,ue=R.slice(V,ee);return ue===x?E(ee,ue):F(V,O)})}function U(x,O){(function(ee){if(!(ee instanceof RegExp))throw new Error("not a regexp: "+ee);for(var ue=he(ee),ne=0;ne<ue.length;ne++){var Pe=ue.charAt(ne);if(Pe!=="i"&&Pe!=="m"&&Pe!=="u"&&Pe!=="s")throw new Error('unsupported regexp flag "'+Pe+'": '+ee)}})(x),arguments.length>=2?k(O):O=0;var R=function(ee){return RegExp("^(?:"+ee.source+")",he(ee))}(x),V=""+x;return a(function(ee,ue){var ne=R.exec(ee.slice(ue));if(ne){if(0<=O&&O<=ne.length){var Pe=ne[0],ir=ne[O];return E(ue+Pe.length,ir)}return F(ue,"valid match group (0 to "+ne.length+") in "+V)}return F(ue,V)})}function G(x){return a(function(O,R){return E(R,x)})}function oe(x){return a(function(O,R){return F(R,x)})}function $(x){if(w(x))return a(function(O,R){var V=x._(O,R);return V.index=R,V.value="",V});if(typeof x=="string")return $(Ce(x));if(x instanceof RegExp)return $(U(x));throw new Error("not a string, regexp, or parser: "+x)}function j(x){return I(x),a(function(O,R){var V=x._(O,R),ee=O.slice(R,V.index);return V.status?F(R,'not "'+ee+'"'):E(R,null)})}function te(x){return P(x),a(function(O,R){var V=L(O,R);return R<O.length&&x(V)?E(R+1,V):F(R,"a character/byte matching "+x)})}function ve(x,O){arguments.length<2&&(O=x,x=void 0);var R=a(function(V,ee){return R._=O()._,R._(V,ee)});return x?R.desc(x):R}function pe(){return oe("fantasy-land/empty")}o.parse=function(x){if(typeof x!="string"&&!y(x))throw new Error(".parse must be called with a string or Buffer as its argument");var O,R=this.skip(Ke)._(x,0);return O=R.status?{status:!0,value:R.value}:{status:!1,index:B(x,R.furthest),expected:R.expected},delete C[x],O},o.tryParse=function(x){var O=this.parse(x);if(O.status)return O.value;var R=fe(x,O),V=new Error(R);throw V.type="ParsimmonError",V.result=O,V},o.assert=function(x,O){return this.chain(function(R){return x(R)?G(R):oe(O)})},o.or=function(x){return xe(this,x)},o.trim=function(x){return this.wrap(x,x)},o.wrap=function(x,O){return ie(x,this,O,function(R,V){return V})},o.thru=function(x){return x(this)},o.then=function(x){return I(x),me(this,x).map(function(O){return O[1]})},o.many=function(){var x=this;return a(function(O,R){for(var V=[],ee=void 0;;){if(!(ee=S(x._(O,R),ee)).status)return S(E(R,V),ee);if(R===ee.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");R=ee.index,V.push(ee.value)}})},o.tieWith=function(x){return M(x),this.map(function(O){if(function(ee){if(!b(ee))throw new Error("not an array: "+ee)}(O),O.length){M(O[0]);for(var R=O[0],V=1;V<O.length;V++)M(O[V]),R+=x+O[V];return R}return""})},o.tie=function(){return this.tieWith("")},o.times=function(x,O){var R=this;return arguments.length<2&&(O=x),k(x),k(O),a(function(V,ee){for(var ue=[],ne=void 0,Pe=void 0,ir=0;ir<x;ir+=1){if(Pe=S(ne=R._(V,ee),Pe),!ne.status)return Pe;ee=ne.index,ue.push(ne.value)}for(;ir<O&&(Pe=S(ne=R._(V,ee),Pe),ne.status);ir+=1)ee=ne.index,ue.push(ne.value);return S(E(ee,ue),Pe)})},o.result=function(x){return this.map(function(){return x})},o.atMost=function(x){return this.times(0,x)},o.atLeast=function(x){return ie(this.times(x),this.many(),function(O,R){return O.concat(R)})},o.map=function(x){P(x);var O=this;return a(function(R,V){var ee=O._(R,V);return ee.status?S(E(ee.index,x(ee.value)),ee):ee})},o.contramap=function(x){P(x);var O=this;return a(function(R,V){var ee=O.parse(x(R.slice(V)));return ee.status?E(V+R.length,ee.value):ee})},o.promap=function(x,O){return P(x),P(O),this.contramap(x).map(O)},o.skip=function(x){return me(this,x).map(function(O){return O[0]})},o.mark=function(){return ie(Ne,this,Ne,function(x,O,R){return{start:x,value:O,end:R}})},o.node=function(x){return ie(Ne,this,Ne,function(O,R,V){return{name:x,value:R,start:O,end:V}})},o.sepBy=function(x){return Me(this,x)},o.sepBy1=function(x){return be(this,x)},o.lookahead=function(x){return this.skip($(x))},o.notFollowedBy=function(x){return this.skip(j(x))},o.desc=function(x){b(x)||(x=[x]);var O=this;return a(function(R,V){var ee=O._(R,V);return ee.status||(ee.expected=x),ee})},o.fallback=function(x){return this.or(G(x))},o.ap=function(x){return ie(x,this,function(O,R){return O(R)})},o.chain=function(x){var O=this;return a(function(R,V){var ee=O._(R,V);return ee.status?S(x(ee.value)._(R,ee.index),ee):ee})},o.concat=o.or,o.empty=pe,o.of=G,o["fantasy-land/ap"]=o.ap,o["fantasy-land/chain"]=o.chain,o["fantasy-land/concat"]=o.concat,o["fantasy-land/empty"]=o.empty,o["fantasy-land/of"]=o.of,o["fantasy-land/map"]=o.map;var Ne=a(function(x,O){return E(O,B(x,O))}),ge=a(function(x,O){return O>=x.length?F(O,"any character/byte"):E(O+1,L(x,O))}),We=a(function(x,O){return E(x.length,x.slice(O))}),Ke=a(function(x,O){return O<x.length?F(O,"EOF"):E(O,null)}),dr=U(/[0-9]/).desc("a digit"),wr=U(/[0-9]*/).desc("optional digits"),Br=U(/[a-z]/i).desc("a letter"),gt=U(/[a-z]*/i).desc("optional letters"),yt=U(/\s*/).desc("optional whitespace"),nn=U(/\s+/).desc("whitespace"),W=Ce("\r"),K=Ce(`
`),se=Ce(`\r
`),le=xe(se,K,W).desc("newline"),De=xe(le,Ke);a.all=We,a.alt=xe,a.any=ge,a.cr=W,a.createLanguage=function(x){var O={};for(var R in x)({}).hasOwnProperty.call(x,R)&&function(V){O[V]=ve(function(){return x[V](O)})}(R);return O},a.crlf=se,a.custom=function(x){return a(x(E,F))},a.digit=dr,a.digits=wr,a.empty=pe,a.end=De,a.eof=Ke,a.fail=oe,a.formatError=fe,a.index=Ne,a.isParser=w,a.lazy=ve,a.letter=Br,a.letters=gt,a.lf=K,a.lookahead=$,a.makeFailure=F,a.makeSuccess=E,a.newline=le,a.noneOf=function(x){return te(function(O){return x.indexOf(O)<0}).desc("none of '"+x+"'")},a.notFollowedBy=j,a.of=G,a.oneOf=function(x){for(var O=x.split(""),R=0;R<O.length;R++)O[R]="'"+O[R]+"'";return te(function(V){return x.indexOf(V)>=0}).desc(O)},a.optWhitespace=yt,a.Parser=a,a.range=function(x,O){return te(function(R){return x<=R&&R<=O}).desc(x+"-"+O)},a.regex=U,a.regexp=U,a.sepBy=Me,a.sepBy1=be,a.seq=me,a.seqMap=ie,a.seqObj=function(){for(var x,O={},R=0,V=(x=arguments,Array.prototype.slice.call(x)),ee=V.length,ue=0;ue<ee;ue+=1){var ne=V[ue];if(!w(ne)){if(b(ne)&&ne.length===2&&typeof ne[0]=="string"&&w(ne[1])){var Pe=ne[0];if(Object.prototype.hasOwnProperty.call(O,Pe))throw new Error("seqObj: duplicate key "+Pe);O[Pe]=!0,R++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(R===0)throw new Error("seqObj expects at least one named parser, found zero");return a(function(ir,Er){for(var mr,jr={},Cr=0;Cr<ee;Cr+=1){var nt,it;if(b(V[Cr])?(nt=V[Cr][0],it=V[Cr][1]):(nt=null,it=V[Cr]),!(mr=S(it._(ir,Er),mr)).status)return mr;nt&&(jr[nt]=mr.value),Er=mr.index}return S(E(Er,jr),mr)})},a.string=Ce,a.succeed=G,a.takeWhile=function(x){return P(x),a(function(O,R){for(var V=R;V<O.length&&x(L(O,V));)V++;return E(V,O.slice(R,V))})},a.test=te,a.whitespace=nn,a["fantasy-land/empty"]=pe,a["fantasy-land/of"]=G,a.Binary={bitSeq:p,bitSeqObj:function(x){m();var O={},R=0,V=s(function(ue){if(b(ue)){var ne=ue;if(ne.length!==2)throw new Error("["+ne.join(", ")+"] should be length 2, got length "+ne.length);if(M(ne[0]),k(ne[1]),Object.prototype.hasOwnProperty.call(O,ne[0]))throw new Error("duplicate key in bitSeqObj: "+ne[0]);return O[ne[0]]=!0,R++,ne}return k(ue),[null,ue]},x);if(R<1)throw new Error("bitSeqObj expects at least one named pair, got ["+x.join(", ")+"]");var ee=s(function(ue){return ue[0]},V);return p(s(function(ue){return ue[1]},V)).map(function(ue){return u(function(ne,Pe){return Pe[0]!==null&&(ne[Pe[0]]=Pe[1]),ne},{},s(function(ne,Pe){return[ne,ue[Pe]]},ee))})},byte:function(x){if(m(),k(x),x>255)throw new Error("Value specified to byte constructor ("+x+"=0x"+x.toString(16)+") is larger in value than a single byte.");var O=(x>15?"0x":"0x0")+x.toString(16);return a(function(R,V){var ee=L(R,V);return ee===x?E(V+1,ee):F(V,O)})},buffer:function(x){return h("buffer",x).map(function(O){return Buffer.from(O)})},encodedString:function(x,O){return h("string",O).map(function(R){return R.toString(x)})},uintBE:g,uint8BE:g(1),uint16BE:g(2),uint32BE:g(4),uintLE:D,uint8LE:D(1),uint16LE:D(2),uint32LE:D(4),intBE:N,int8BE:N(1),int16BE:N(2),int32BE:N(4),intLE:v,int8LE:v(1),int16LE:v(2),int32LE:v(4),floatBE:h("floatBE",4).map(function(x){return x.readFloatBE(0)}),floatLE:h("floatLE",4).map(function(x){return x.readFloatLE(0)}),doubleBE:h("doubleBE",8).map(function(x){return x.readDoubleBE(0)}),doubleLE:h("doubleLE",8).map(function(x){return x.readDoubleLE(0)})},r.exports=a}])})})(Q);var am=()=>/(?:[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDD-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF6](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC2\uDED0-\uDED9\uDEE0-\uDEE7]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?))/g;function _b(t){return t==null?t:t.shiftToAll().normalize()}function BD(t){return t.includes("/")&&(t=t.substring(t.lastIndexOf("/")+1)),t.endsWith(".md")&&(t=t.substring(0,t.length-3)),t}Q.exports.alt(Q.exports.regex(new RegExp(am(),"")),Q.exports.regex(/[0-9\p{Letter}_-]+/u).map(t=>t.toLocaleLowerCase()),Q.exports.whitespace.map(t=>"-"),Q.exports.any.map(t=>"")).many().map(t=>t.join(""));var w6=Q.exports.alt(Q.exports.regex(new RegExp(am(),"")),Q.exports.regex(/[0-9\p{Letter}_-]+/u),Q.exports.whitespace.map(t=>" "),Q.exports.any.map(t=>" ")).many().map(t=>t.join("").split(/\s+/).join(" ").trim());function E6(t){return w6.tryParse(t)}function C6(t){return t=_b(t),t=_e.fromObject(Object.fromEntries(Object.entries(t.toObject()).filter(([,e])=>e>0))),t.toHuman()}var ws;(function(t){function e(w,b=im,y=!1){let E=r(w);if(!E)return b.renderNullAs;switch(E.type){case"null":return b.renderNullAs;case"string":return E.value;case"number":case"boolean":return""+E.value;case"html":return E.value.outerHTML;case"widget":return E.value.markdown();case"link":return E.value.markdown();case"function":return"<function>";case"array":let F="";return y&&(F+="["),F+=E.value.map(S=>e(S,b,!0)).join(", "),y&&(F+="]"),F;case"object":return"{ "+Object.entries(E.value).map(S=>S[0]+": "+e(S[1],b,!0)).join(", ")+" }";case"date":return E.value.second==0&&E.value.hour==0&&E.value.minute==0?E.value.toFormat(b.defaultDateFormat):E.value.toFormat(b.defaultDateTimeFormat);case"duration":return C6(E.value)}}t.toString=e;function r(w){return m(w)?{type:"null",value:w}:s(w)?{type:"number",value:w}:u(w)?{type:"string",value:w}:h(w)?{type:"boolean",value:w}:f(w)?{type:"duration",value:w}:l(w)?{type:"date",value:w}:g(w)?{type:"widget",value:w}:p(w)?{type:"array",value:w}:d(w)?{type:"link",value:w}:v(w)?{type:"function",value:w}:D(w)?{type:"html",value:w}:N(w)?{type:"object",value:w}:void 0}t.wrapValue=r;function n(w,b){if(N(w)){let y={};for(let[E,F]of Object.entries(w))y[E]=n(F,b);return y}else if(p(w)){let y=[];for(let E of w)y.push(n(E,b));return y}else return b(w)}t.mapLeaves=n;function i(w,b,y){var E,F;if(w===void 0&&(w=null),b===void 0&&(b=null),w===null&&b===null)return 0;if(w===null)return-1;if(b===null)return 1;let S=r(w),C=r(b);if(S===void 0&&C===void 0)return 0;if(S===void 0)return-1;if(C===void 0)return 1;if(S.type!=C.type)return S.type.localeCompare(C.type);if(S.value===C.value)return 0;switch(S.type){case"string":return S.value.localeCompare(C.value);case"number":return S.value<C.value?-1:S.value==C.value?0:1;case"null":return 0;case"boolean":return S.value==C.value?0:S.value?1:-1;case"link":let B=S.value,I=C.value,L=y!=null?y:q=>q,k=L(B.path).localeCompare(L(I.path));if(k!=0)return k;let P=B.type.localeCompare(I.type);return P!=0?P:B.subpath&&!I.subpath?1:!B.subpath&&I.subpath?-1:!B.subpath&&!I.subpath?0:((E=B.subpath)!==null&&E!==void 0?E:"").localeCompare((F=I.subpath)!==null&&F!==void 0?F:"");case"date":return S.value<C.value?-1:S.value.equals(C.value)?0:1;case"duration":return S.value<C.value?-1:S.value.equals(C.value)?0:1;case"array":let M=S.value,T=C.value;for(let q=0;q<Math.min(M.length,T.length);q++){let J=i(M[q],T[q]);if(J!=0)return J}return M.length-T.length;case"object":let H=S.value,_=C.value,z=Array.from(Object.keys(H)),Y=Array.from(Object.keys(_));z.sort(),Y.sort();let X=i(z,Y);if(X!=0)return X;for(let q of z){let J=i(H[q],_[q]);if(J!=0)return J}return 0;case"widget":case"html":case"function":return 0}}t.compareValue=i;function a(w){var b;return(b=r(w))===null||b===void 0?void 0:b.type}t.typeOf=a;function o(w){let b=r(w);if(!b)return!1;switch(b.type){case"number":return b.value!=0;case"string":return b.value.length>0;case"boolean":return b.value;case"link":return!!b.value.path;case"date":return b.value.toMillis()!=0;case"duration":return b.value.as("seconds")!=0;case"object":return Object.keys(b.value).length>0;case"array":return b.value.length>0;case"null":return!1;case"html":case"widget":case"function":return!0}}t.isTruthy=o;function c(w){if(w==null)return w;if(t.isArray(w))return[].concat(w.map(b=>c(b)));if(t.isObject(w)){let b={};for(let[y,E]of Object.entries(w))b[y]=c(E);return b}else return w}t.deepCopy=c;function u(w){return typeof w=="string"}t.isString=u;function s(w){return typeof w=="number"}t.isNumber=s;function l(w){return w instanceof ke}t.isDate=l;function f(w){return w instanceof _e}t.isDuration=f;function m(w){return w==null}t.isNull=m;function p(w){return Array.isArray(w)}t.isArray=p;function h(w){return typeof w=="boolean"}t.isBoolean=h;function d(w){return w instanceof At}t.isLink=d;function g(w){return w instanceof Es}t.isWidget=g;function D(w){return typeof HTMLElement!="undefined"?w instanceof HTMLElement:!1}t.isHtml=D;function N(w){return typeof w=="object"&&!D(w)&&!g(w)&&!p(w)&&!f(w)&&!l(w)&&!d(w)&&w!==void 0&&!m(w)}t.isObject=N;function v(w){return typeof w=="function"}t.isFunction=v})(ws||(ws={}));var ID;(function(t){function e(i){return ws.isObject(i)&&Object.keys(i).length==2&&"key"in i&&"rows"in i}t.isElementGroup=e;function r(i){for(let a of i)if(!e(a))return!1;return!0}t.isGrouping=r;function n(i){if(r(i)){let a=0;for(let o of i)a+=n(o.rows);return a}else return i.length}t.count=n})(ID||(ID={}));var At=class{constructor(e){Object.assign(this,e)}static file(e,r=!1,n){return new At({path:e,embed:r,display:n,subpath:void 0,type:"file"})}static infer(e,r=!1,n){if(e.includes("#^")){let i=e.split("#^");return At.block(i[0],i[1],r,n)}else if(e.includes("#")){let i=e.split("#");return At.header(i[0],i[1],r,n)}else return At.file(e,r,n)}static header(e,r,n,i){return new At({path:e,embed:n,display:i,subpath:E6(r),type:"header"})}static block(e,r,n,i){return new At({path:e,embed:n,display:i,subpath:r,type:"block"})}static fromObject(e){return new At(e)}equals(e){return e==null||e==null?!1:this.path==e.path&&this.type==e.type&&this.subpath==e.subpath}toString(){return this.markdown()}toObject(){return{path:this.path,type:this.type,subpath:this.subpath,display:this.display,embed:this.embed}}withPath(e){return new At(Object.assign({},this,{path:e}))}withDisplay(e){return new At(Object.assign({},this,{display:e}))}withHeader(e){return At.header(this.path,e,this.embed,this.display)}toFile(){return At.file(this.path,this.embed,this.display)}toEmbed(){if(this.embed)return this;{let e=new At(this);return e.embed=!0,e}}fromEmbed(){if(this.embed){let e=new At(this);return e.embed=!1,e}else return this}markdown(){let e=(this.embed?"!":"")+"[["+this.obsidianLink();return this.display?e+="|"+this.display:(e+="|"+BD(this.path),(this.type=="header"||this.type=="block")&&(e+=" > "+this.subpath)),e+="]]",e}obsidianLink(){var e,r;let n=this.path.replace("|","\\|");return this.type=="header"?n+"#"+((e=this.subpath)===null||e===void 0?void 0:e.replace("|","\\|")):this.type=="block"?n+"#^"+((r=this.subpath)===null||r===void 0?void 0:r.replace("|","\\|")):n}fileName(){return BD(this.path).replace(".md","")}},Es=class{constructor(e){this.$widget=e}},Gf=class extends Es{constructor(e,r){super("dataview:list-pair"),this.key=e,this.value=r}markdown(){return`${ws.toString(this.key)}: ${ws.toString(this.value)}`}},Zf=class extends Es{constructor(e,r){super("dataview:external-link"),this.url=e,this.display=r}markdown(){var e;return`[${(e=this.display)!==null&&e!==void 0?e:this.url}](${this.url})`}},_D;(function(t){function e(o,c){return new Gf(o,c)}t.listPair=e;function r(o,c){return new Zf(o,c)}t.externalLink=r;function n(o){return o.$widget==="dataview:list-pair"}t.isListPair=n;function i(o){return o.$widget==="dataview:external-link"}t.isExternalLink=i;function a(o){return n(o)||i(o)}t.isBuiltin=a})(_D||(_D={}));var ot;(function(t){function e(m){return{type:"variable",name:m}}t.variable=e;function r(m){return{type:"literal",value:m}}t.literal=r;function n(m,p,h){return{type:"binaryop",left:m,op:p,right:h}}t.binaryOp=n;function i(m,p){return{type:"index",object:m,index:p}}t.index=i;function a(m){let p=m.split("."),h=t.variable(p[0]);for(let d=1;d<p.length;d++)h=t.index(h,t.literal(p[d]));return h}t.indexVariable=a;function o(m,p){return{type:"lambda",arguments:m,value:p}}t.lambda=o;function c(m,p){return{type:"function",func:m,arguments:p}}t.func=c;function u(m){return{type:"list",values:m}}t.list=u;function s(m){return{type:"object",values:m}}t.object=s;function l(m){return{type:"negated",child:m}}t.negate=l;function f(m){return m=="<="||m=="<"||m==">"||m==">="||m=="!="||m=="="}t.isCompareOp=f,t.NULL=t.literal(null)})(ot||(ot={}));var pi;(function(t){function e(l){return{type:"tag",tag:l}}t.tag=e;function r(l){return{type:"csv",path:l}}t.csv=r;function n(l){return{type:"folder",folder:l}}t.folder=n;function i(l,f){return{type:"link",file:l,direction:f?"incoming":"outgoing"}}t.link=i;function a(l,f,m){return{type:"binaryop",left:l,op:f,right:m}}t.binaryOp=a;function o(l,f){return{type:"binaryop",left:l,op:"&",right:f}}t.and=o;function c(l,f){return{type:"binaryop",left:l,op:"|",right:f}}t.or=c;function u(l){return{type:"negate",child:l}}t.negate=u;function s(){return{type:"empty"}}t.empty=s})(pi||(pi={}));var RD=new RegExp(am(),""),jf={year:_e.fromObject({years:1}),years:_e.fromObject({years:1}),yr:_e.fromObject({years:1}),yrs:_e.fromObject({years:1}),month:_e.fromObject({months:1}),months:_e.fromObject({months:1}),mo:_e.fromObject({months:1}),mos:_e.fromObject({months:1}),week:_e.fromObject({weeks:1}),weeks:_e.fromObject({weeks:1}),wk:_e.fromObject({weeks:1}),wks:_e.fromObject({weeks:1}),w:_e.fromObject({weeks:1}),day:_e.fromObject({days:1}),days:_e.fromObject({days:1}),d:_e.fromObject({days:1}),hour:_e.fromObject({hours:1}),hours:_e.fromObject({hours:1}),hr:_e.fromObject({hours:1}),hrs:_e.fromObject({hours:1}),h:_e.fromObject({hours:1}),minute:_e.fromObject({minutes:1}),minutes:_e.fromObject({minutes:1}),min:_e.fromObject({minutes:1}),mins:_e.fromObject({minutes:1}),m:_e.fromObject({minutes:1}),second:_e.fromObject({seconds:1}),seconds:_e.fromObject({seconds:1}),sec:_e.fromObject({seconds:1}),secs:_e.fromObject({seconds:1}),s:_e.fromObject({seconds:1})},Yf={now:()=>ke.local(),today:()=>ke.local().startOf("day"),yesterday:()=>ke.local().startOf("day").minus(_e.fromObject({days:1})),tomorrow:()=>ke.local().startOf("day").plus(_e.fromObject({days:1})),sow:()=>ke.local().startOf("week"),"start-of-week":()=>ke.local().startOf("week"),eow:()=>ke.local().endOf("week"),"end-of-week":()=>ke.local().endOf("week"),soy:()=>ke.local().startOf("year"),"start-of-year":()=>ke.local().startOf("year"),eoy:()=>ke.local().endOf("year"),"end-of-year":()=>ke.local().endOf("year"),som:()=>ke.local().startOf("month"),"start-of-month":()=>ke.local().startOf("month"),eom:()=>ke.local().endOf("month"),"end-of-month":()=>ke.local().endOf("month")},Jf=["FROM","WHERE","LIMIT","GROUP","FLATTEN"];function N6(t){let e=-1;for(;(e=t.indexOf("|",e+1))>=0;)if(!(e>0&&t[e-1]=="\\"))return[t.substring(0,e).replace(/\\\|/g,"|"),t.substring(e+1)];return[t.replace(/\\\|/g,"|"),void 0]}function A6(t){let[e,r]=N6(t);return At.infer(e,!1,r)}function vs(t,e,r){return Q.exports.seqMap(t,Q.exports.seq(Q.exports.optWhitespace,e,Q.exports.optWhitespace,t).many(),(n,i)=>{if(i.length==0)return n;let a=r(n,i[0][1],i[0][3]);for(let o=1;o<i.length;o++)a=r(a,i[o][1],i[o][3]);return a})}function F6(t,...e){return Q.exports.custom((r,n)=>(i,a)=>{let o=t._(i,a);if(!o.status)return o;for(let c of e){let u=c(o.value)._(i,o.index);if(!u.status)return o;o=u}return o})}var Gn=Q.exports.createLanguage({number:t=>Q.exports.regexp(/-?[0-9]+(\.[0-9]+)?/).map(e=>Number.parseFloat(e)).desc("number"),string:t=>Q.exports.string('"').then(Q.exports.alt(t.escapeCharacter,Q.exports.noneOf('"\\')).atLeast(0).map(e=>e.join(""))).skip(Q.exports.string('"')).desc("string"),escapeCharacter:t=>Q.exports.string("\\").then(Q.exports.any).map(e=>e==='"'?'"':e==="\\"?"\\":"\\"+e),bool:t=>Q.exports.regexp(/true|false|True|False/).map(e=>e.toLowerCase()=="true").desc("boolean ('true' or 'false')"),tag:t=>Q.exports.seqMap(Q.exports.string("#"),Q.exports.alt(Q.exports.regexp(/[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]/).desc("text")).many(),(e,r)=>e+r.join("")).desc("tag ('#hello/stuff')"),identifier:t=>Q.exports.seqMap(Q.exports.alt(Q.exports.regexp(/\p{Letter}/u),Q.exports.regexp(RD).desc("text")),Q.exports.alt(Q.exports.regexp(/[0-9\p{Letter}_-]/u),Q.exports.regexp(RD).desc("text")).many(),(e,r)=>e+r.join("")).desc("variable identifier"),link:t=>Q.exports.regexp(/\[\[([^\[\]]*?)\]\]/u,1).map(e=>A6(e)).desc("file link"),embedLink:t=>Q.exports.seqMap(Q.exports.string("!").atMost(1),t.link,(e,r)=>(e.length>0&&(r.embed=!0),r)).desc("file link"),binaryPlusMinus:t=>Q.exports.regexp(/\+|-/).map(e=>e).desc("'+' or '-'"),binaryMulDiv:t=>Q.exports.regexp(/\*|\/|%/).map(e=>e).desc("'*' or '/' or '%'"),binaryCompareOp:t=>Q.exports.regexp(/>=|<=|!=|>|<|=/).map(e=>e).desc("'>=' or '<=' or '!=' or '=' or '>' or '<'"),binaryBooleanOp:t=>Q.exports.regexp(/and|or|&|\|/i).map(e=>e.toLowerCase()=="and"?"&":e.toLowerCase()=="or"?"|":e).desc("'and' or 'or'"),rootDate:t=>Q.exports.seqMap(Q.exports.regexp(/\d{4}/),Q.exports.string("-"),Q.exports.regexp(/\d{2}/),(e,r,n)=>ke.fromObject({year:Number.parseInt(e),month:Number.parseInt(n)})).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),dateShorthand:t=>Q.exports.alt(...Object.keys(Yf).sort((e,r)=>r.length-e.length).map(Q.exports.string)),date:t=>F6(t.rootDate,e=>Q.exports.seqMap(Q.exports.string("-"),Q.exports.regexp(/\d{2}/),(r,n)=>e.set({day:Number.parseInt(n)})),e=>Q.exports.seqMap(Q.exports.string("T"),Q.exports.regexp(/\d{2}/),(r,n)=>e.set({hour:Number.parseInt(n)})),e=>Q.exports.seqMap(Q.exports.string(":"),Q.exports.regexp(/\d{2}/),(r,n)=>e.set({minute:Number.parseInt(n)})),e=>Q.exports.seqMap(Q.exports.string(":"),Q.exports.regexp(/\d{2}/),(r,n)=>e.set({second:Number.parseInt(n)})),e=>Q.exports.alt(Q.exports.seqMap(Q.exports.string("."),Q.exports.regexp(/\d{3}/),(r,n)=>e.set({millisecond:Number.parseInt(n)})),Q.exports.succeed(e)),e=>Q.exports.alt(Q.exports.seqMap(Q.exports.string("+").or(Q.exports.string("-")),Q.exports.regexp(/\d{1,2}(:\d{2})?/),(r,n)=>e.setZone("UTC"+r+n,{keepLocalTime:!0})),Q.exports.seqMap(Q.exports.string("Z"),()=>e.setZone("utc",{keepLocalTime:!0})),Q.exports.seqMap(Q.exports.string("["),Q.exports.regexp(/[0-9A-Za-z+-\/]+/u),Q.exports.string("]"),(r,n,i)=>e.setZone(n,{keepLocalTime:!0})))).assert(e=>e.isValid,"valid date").desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),datePlus:t=>Q.exports.alt(t.dateShorthand.map(e=>Yf[e]()),t.date).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS] or in shorthand"),durationType:t=>Q.exports.alt(...Object.keys(jf).sort((e,r)=>r.length-e.length).map(Q.exports.string)),duration:t=>Q.exports.seqMap(t.number,Q.exports.optWhitespace,t.durationType,(e,r,n)=>jf[n].mapUnits(i=>i*e)).sepBy1(Q.exports.string(",").trim(Q.exports.optWhitespace).or(Q.exports.optWhitespace)).map(e=>e.reduce((r,n)=>r.plus(n))).desc("duration like 4hr2min"),rawNull:t=>Q.exports.string("null"),tagSource:t=>t.tag.map(e=>pi.tag(e)),csvSource:t=>Q.exports.seqMap(Q.exports.string("csv(").skip(Q.exports.optWhitespace),t.string,Q.exports.string(")"),(e,r,n)=>pi.csv(r)),linkIncomingSource:t=>t.link.map(e=>pi.link(e.path,!0)),linkOutgoingSource:t=>Q.exports.seqMap(Q.exports.string("outgoing(").skip(Q.exports.optWhitespace),t.link,Q.exports.string(")"),(e,r,n)=>pi.link(r.path,!1)),folderSource:t=>t.string.map(e=>pi.folder(e)),parensSource:t=>Q.exports.seqMap(Q.exports.string("("),Q.exports.optWhitespace,t.source,Q.exports.optWhitespace,Q.exports.string(")"),(e,r,n,i,a)=>n),negateSource:t=>Q.exports.seqMap(Q.exports.alt(Q.exports.string("-"),Q.exports.string("!")),t.atomSource,(e,r)=>pi.negate(r)),atomSource:t=>Q.exports.alt(t.parensSource,t.negateSource,t.linkOutgoingSource,t.linkIncomingSource,t.folderSource,t.tagSource,t.csvSource),binaryOpSource:t=>vs(t.atomSource,t.binaryBooleanOp.map(e=>e),pi.binaryOp),source:t=>t.binaryOpSource,variableField:t=>t.identifier.chain(e=>Jf.includes(e.toUpperCase())?Q.exports.fail("Variable fields cannot be a keyword ("+Jf.join(" or ")+")"):Q.exports.succeed(ot.variable(e))).desc("variable"),numberField:t=>t.number.map(e=>ot.literal(e)).desc("number"),stringField:t=>t.string.map(e=>ot.literal(e)).desc("string"),boolField:t=>t.bool.map(e=>ot.literal(e)).desc("boolean"),dateField:t=>Q.exports.seqMap(Q.exports.string("date("),Q.exports.optWhitespace,t.datePlus,Q.exports.optWhitespace,Q.exports.string(")"),(e,r,n,i,a)=>ot.literal(n)).desc("date"),durationField:t=>Q.exports.seqMap(Q.exports.string("dur("),Q.exports.optWhitespace,t.duration,Q.exports.optWhitespace,Q.exports.string(")"),(e,r,n,i,a)=>ot.literal(n)).desc("duration"),nullField:t=>t.rawNull.map(e=>ot.NULL),linkField:t=>t.link.map(e=>ot.literal(e)),listField:t=>t.field.sepBy(Q.exports.string(",").trim(Q.exports.optWhitespace)).wrap(Q.exports.string("[").skip(Q.exports.optWhitespace),Q.exports.optWhitespace.then(Q.exports.string("]"))).map(e=>ot.list(e)).desc("list ('[1, 2, 3]')"),objectField:t=>Q.exports.seqMap(t.identifier.or(t.string),Q.exports.string(":").trim(Q.exports.optWhitespace),t.field,(e,r,n)=>({name:e,value:n})).sepBy(Q.exports.string(",").trim(Q.exports.optWhitespace)).wrap(Q.exports.string("{").skip(Q.exports.optWhitespace),Q.exports.optWhitespace.then(Q.exports.string("}"))).map(e=>{let r={};for(let n of e)r[n.name]=n.value;return ot.object(r)}).desc("object ('{ a: 1, b: 2 }')"),atomInlineField:t=>Q.exports.alt(t.date,t.duration.map(e=>_b(e)),t.string,t.tag,t.embedLink,t.bool,t.number,t.rawNull),inlineFieldList:t=>t.atomInlineField.sepBy(Q.exports.string(",").trim(Q.exports.optWhitespace).lookahead(t.atomInlineField)),inlineField:t=>Q.exports.alt(Q.exports.seqMap(t.atomInlineField,Q.exports.string(",").trim(Q.exports.optWhitespace),t.inlineFieldList,(e,r,n)=>[e].concat(n)),t.atomInlineField),atomField:t=>Q.exports.alt(t.embedLink.map(e=>ot.literal(e)),t.negatedField,t.linkField,t.listField,t.objectField,t.lambdaField,t.parensField,t.boolField,t.numberField,t.stringField,t.dateField,t.durationField,t.nullField,t.variableField),indexField:t=>Q.exports.seqMap(t.atomField,Q.exports.alt(t.dotPostfix,t.indexPostfix,t.functionPostfix).many(),(e,r)=>{let n=e;for(let i of r)switch(i.type){case"dot":n=ot.index(n,ot.literal(i.field));break;case"index":n=ot.index(n,i.field);break;case"function":n=ot.func(n,i.fields);break}return n}),negatedField:t=>Q.exports.seqMap(Q.exports.string("!"),t.indexField,(e,r)=>ot.negate(r)).desc("negated field"),parensField:t=>Q.exports.seqMap(Q.exports.string("("),Q.exports.optWhitespace,t.field,Q.exports.optWhitespace,Q.exports.string(")"),(e,r,n,i,a)=>n),lambdaField:t=>Q.exports.seqMap(t.identifier.sepBy(Q.exports.string(",").trim(Q.exports.optWhitespace)).wrap(Q.exports.string("(").trim(Q.exports.optWhitespace),Q.exports.string(")").trim(Q.exports.optWhitespace)),Q.exports.string("=>").trim(Q.exports.optWhitespace),t.field,(e,r,n)=>({type:"lambda",arguments:e,value:n})),dotPostfix:t=>Q.exports.seqMap(Q.exports.string("."),t.identifier,(e,r)=>({type:"dot",field:r})),indexPostfix:t=>Q.exports.seqMap(Q.exports.string("["),Q.exports.optWhitespace,t.field,Q.exports.optWhitespace,Q.exports.string("]"),(e,r,n,i,a)=>({type:"index",field:n})),functionPostfix:t=>Q.exports.seqMap(Q.exports.string("("),Q.exports.optWhitespace,t.field.sepBy(Q.exports.string(",").trim(Q.exports.optWhitespace)),Q.exports.optWhitespace,Q.exports.string(")"),(e,r,n,i,a)=>({type:"function",fields:n})),binaryMulDivField:t=>vs(t.indexField,t.binaryMulDiv,ot.binaryOp),binaryPlusMinusField:t=>vs(t.binaryMulDivField,t.binaryPlusMinus,ot.binaryOp),binaryCompareField:t=>vs(t.binaryPlusMinusField,t.binaryCompareOp,ot.binaryOp),binaryBooleanField:t=>vs(t.binaryCompareField,t.binaryBooleanOp,ot.binaryOp),binaryOpField:t=>t.binaryBooleanField,field:t=>t.binaryOpField});function S6(t){try{return Ku.success(Gn.field.tryParse(t))}catch(e){return Ku.failure(""+e)}}var el;(function(t){function e(n,i){return{name:n,field:i}}t.named=e;function r(n,i){return{field:n,direction:i}}t.sortBy=r})(el||(el={}));function M6(t){return Q.exports.custom((e,r)=>(n,i)=>{let a=t._(n,i);return a.status?Object.assign({},a,{value:[a.value,n.substring(i,a.index)]}):a})}function T6(t){return t.split(/[\r\n]+/).map(e=>e.trim()).join("")}var O6=Q.exports.createLanguage({queryType:t=>Q.exports.alt(Q.exports.regexp(/TABLE|LIST|TASK|CALENDAR/i)).map(e=>e.toLowerCase()).desc("query type ('TABLE', 'LIST', 'TASK', or 'CALENDAR')"),explicitNamedField:t=>Q.exports.seqMap(Gn.field.skip(Q.exports.whitespace),Q.exports.regexp(/AS/i).skip(Q.exports.whitespace),Gn.identifier.or(Gn.string),(e,r,n)=>el.named(n,e)),namedField:t=>Q.exports.alt(t.explicitNamedField,M6(Gn.field).map(([e,r])=>el.named(T6(r),e))),sortField:t=>Q.exports.seqMap(Gn.field.skip(Q.exports.optWhitespace),Q.exports.regexp(/ASCENDING|DESCENDING|ASC|DESC/i).atMost(1),(e,r)=>{let n=r.length==0?"ascending":r[0].toLowerCase();return n=="desc"&&(n="descending"),n=="asc"&&(n="ascending"),{field:e,direction:n}}),headerClause:t=>t.queryType.skip(Q.exports.whitespace).chain(e=>{switch(e){case"table":return Q.exports.seqMap(Q.exports.regexp(/WITHOUT\s+ID/i).skip(Q.exports.optWhitespace).atMost(1),Q.exports.sepBy(t.namedField,Q.exports.string(",").trim(Q.exports.optWhitespace)),(r,n)=>({type:"table",fields:n,showId:r.length==0}));case"list":return Q.exports.seqMap(Q.exports.regexp(/WITHOUT\s+ID/i).skip(Q.exports.optWhitespace).atMost(1),Gn.field.atMost(1),(r,n)=>({type:"list",format:n.length==1?n[0]:void 0,showId:r.length==0}));case"task":return Q.exports.succeed({type:"task"});case"calendar":return Q.exports.seqMap(t.namedField,r=>({type:"calendar",showId:!0,field:r}));default:return Q.exports.fail(`Unrecognized query type '${e}'`)}}).desc("TABLE or LIST or TASK or CALENDAR"),fromClause:t=>Q.exports.seqMap(Q.exports.regexp(/FROM/i),Q.exports.whitespace,Gn.source,(e,r,n)=>n),whereClause:t=>Q.exports.seqMap(Q.exports.regexp(/WHERE/i),Q.exports.whitespace,Gn.field,(e,r,n)=>({type:"where",clause:n})).desc("WHERE <expression>"),sortByClause:t=>Q.exports.seqMap(Q.exports.regexp(/SORT/i),Q.exports.whitespace,t.sortField.sepBy1(Q.exports.string(",").trim(Q.exports.optWhitespace)),(e,r,n)=>({type:"sort",fields:n})).desc("SORT field [ASC/DESC]"),limitClause:t=>Q.exports.seqMap(Q.exports.regexp(/LIMIT/i),Q.exports.whitespace,Gn.field,(e,r,n)=>({type:"limit",amount:n})).desc("LIMIT <value>"),flattenClause:t=>Q.exports.seqMap(Q.exports.regexp(/FLATTEN/i).skip(Q.exports.whitespace),t.namedField,(e,r)=>({type:"flatten",field:r})).desc("FLATTEN <value> [AS <name>]"),groupByClause:t=>Q.exports.seqMap(Q.exports.regexp(/GROUP BY/i).skip(Q.exports.whitespace),t.namedField,(e,r)=>({type:"group",field:r})).desc("GROUP BY <value> [AS <name>]"),clause:t=>Q.exports.alt(t.fromClause,t.whereClause,t.sortByClause,t.limitClause,t.groupByClause,t.flattenClause),query:t=>Q.exports.seqMap(t.headerClause.trim(Q.exports.optWhitespace),t.fromClause.trim(Q.exports.optWhitespace).atMost(1),t.clause.trim(Q.exports.optWhitespace).many(),(e,r,n)=>({header:e,source:r.length==0?pi.folder(""):r[0],operations:n,settings:im}))}),B6=t=>{var e;return t?(e=t.plugins.plugins.dataview)===null||e===void 0?void 0:e.api:window.DataviewAPI},I6=t=>t.plugins.enabledPlugins.has("dataview");di.DATE_SHORTHANDS=Yf;di.DURATION_TYPES=jf;di.EXPRESSION=Gn;di.KEYWORDS=Jf;di.QUERY_LANGUAGE=O6;di.getAPI=B6;di.isPluginEnabled=I6;di.parseField=S6});var aw=dt(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.stringifyFrontmatter=void 0;var tR=require("obsidian");function nR(t){return`---
${(0,tR.stringifyYaml)(t)}---`}ul.stringifyFrontmatter=nR});var vm=dt(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.numberToString=ut.equalOrIncludes=ut.isFalsy=ut.isTruthy=ut.arrayEquals=ut.mod=ut.clamp=ut.removeFileExtension=ut.isPath=ut.getFileName=void 0;function iR(t){var e;return(e=t.split("/").at(-1))!==null&&e!==void 0?e:t}ut.getFileName=iR;function aR(t){return t.split("/").length>1}ut.isPath=aR;function oR(t){let e=t.split(".");if(e.length===1)return t;{let r=e[0];for(let n=1;n<e.length-1;n++)r+="."+e[n];return r}}ut.removeFileExtension=oR;function sR(t,e,r){return Math.min(Math.max(t,e),r)}ut.clamp=sR;function uR(t,e){return(t%e+e)%e}ut.mod=uR;function lR(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}ut.arrayEquals=lR;function cR(t){return!!t}ut.isTruthy=cR;function fR(t){return!t}ut.isFalsy=fR;function mR(t,e){return t===e||t.includes(e)||e.includes(t)}ut.equalOrIncludes=mR;function pR(t){return t+""}ut.numberToString=pR});var ow=dt(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.ParserUtils=Eo.EnclosingPair=void 0;var Sa=vm(),Yn=xu(),gm=class{constructor(e,r){if((0,Sa.isFalsy)(e))throw new Yn.OPDUtilsParsingError("opening string must not be empty");this.openingEqualsClosing=(0,Sa.isFalsy)(r)||e===r,this.openingEqualsClosing?(this._openingString=e,this._closingString=e):(this._openingString=e,this._closingString=r)}get openingString(){return this._openingString}get closingString(){return this.openingEqualsClosing?this._openingString:this._closingString}overlaps(e){return(0,Sa.equalOrIncludes)(this.openingString,e.openingString)||(0,Sa.equalOrIncludes)(this.openingString,e.closingString)||(0,Sa.equalOrIncludes)(this.closingString,e.openingString)||(0,Sa.equalOrIncludes)(this.closingString,e.closingString)}equals(e){return(0,Sa.isFalsy)(e)?!1:this.openingString===e.openingString&&this.closingString===e.closingString}toString(){return JSON.stringify(this)}};Eo.EnclosingPair=gm;var Kr=class{static split(e,r,n){if(!e)throw new Yn.OPDUtilsParsingError("string must not be empty");if(!r)throw new Yn.OPDUtilsParsingError("separator must not be empty");let i="",a=[];if(n){let o=Kr.numberOfOccurrences(e,n.openingString),c=Kr.numberOfOccurrences(e,n.closingString),u=0;e:for(let s=0;s<e.length;s++)if(u===0&&Kr.isStringAt(e,r,s)?(a.push(i),i="",s+=r.length-1):i+=e[s],n.openingEqualsClosing){if(Kr.isStringAt(e,n.openingString,s)){if(!(u%2===0&&o===1))if(u%2===0){u+=1;for(let l=1;l<n.openingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}else{u-=1;for(let l=1;l<n.closingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}o-=1}}else if(Kr.isStringAt(e,n.openingString,s)){if(o<=c){u+=1;for(let l=1;l<n.openingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}o-=1}else if(Kr.isStringAt(e,n.closingString,s)){if(u>0){u-=1;for(let l=1;l<n.closingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}c-=1}}else for(let o=0;o<e.length;o++)Kr.isStringAt(e,r,o)?(a.push(i),i="",o+=r.length-1):i+=e[o];return a.push(i),a}static removeInBetween(e,r){if(!e)throw new Yn.OPDUtilsParsingError("string must not be empty");let n=Kr.numberOfOccurrences(e,r.openingString),i=Kr.numberOfOccurrences(e,r.closingString),a=0,o="";for(let c=0;c<e.length;c++){if(r.openingEqualsClosing){if(Kr.isStringAt(e,r.openingString,c)){if(!(a%2===0&&n===1)){if(a%2===0){if(a+=1,c+=r.openingString.length,c>=e.length)break}else if(a-=1,c+=r.closingString.length,c>=e.length)break}n-=1}}else if(Kr.isStringAt(e,r.openingString,c)){if(n<=i&&(a+=1,c+=r.openingString.length,c>=e.length))break;n-=1}else if(Kr.isStringAt(e,r.closingString,c)){if(a>0&&(a-=1,c+=r.closingString.length,c>=e.length))break;i-=1}a===0&&(o+=e[c])}return o}static getInBetween(e,r){if(!e)throw new Yn.OPDUtilsParsingError("string must not be empty");let n=Kr.numberOfOccurrences(e,r.openingString),i=Kr.numberOfOccurrences(e,r.closingString),a=0,o="",c=[];e:for(let u=0;u<e.length;u++)if(r.openingEqualsClosing)if(Kr.isStringAt(e,r.openingString,u)){if(!(a%2===0&&n===1))if(a%2===0){a+=1,o+=e[u];for(let s=1;s<r.openingString.length;s++)if(u+=1,o+=e[u],u>=e.length)break e}else{a-=1,o+=e[u];for(let s=1;s<r.closingString.length;s++)if(u+=1,o+=e[u],u>e.length)break e;c.push(o),o=""}n-=1}else a>=1&&(o+=e[u]);else if(Kr.isStringAt(e,r.openingString,u)){if(n<=i){a+=1,o+=e[u];for(let s=1;s<r.openingString.length;s++)if(u+=1,o+=e[u],u>=e.length)break e}n-=1}else if(Kr.isStringAt(e,r.closingString,u)){if(a>0){a-=1,o+=e[u];for(let s=1;s<r.closingString.length;s++)if(u+=1,o+=e[u],u>e.length)break e;a===0&&(c.push(o),o="")}i-=1}else a>=1&&(o+=e[u]);return c.length===0?"":c.length===1?c[0].substring(r.openingString.length,c[0].length-r.closingString.length):c.map(u=>u.substring(r.openingString.length,u.length-r.closingString.length))}static isStringAt(e,r,n){if(n<0)throw new Yn.OPDUtilsParsingError("index must be greater than 0");if(n>=e.length)throw new Yn.OPDUtilsParsingError("index out of bounds of string");if(!e)throw new Yn.OPDUtilsParsingError("string must not be empty");if(!r)throw new Yn.OPDUtilsParsingError("sub string must not be empty");for(let i=0;i<r.length;i++)if(e[i+n]!==r[i])return!1;return!0}static contains(e,r){return Kr.numberOfOccurrences(e,r)>0}static numberOfOccurrences(e,r){if(!e)throw new Yn.OPDUtilsParsingError("string must not be empty");if(!r)throw new Yn.OPDUtilsParsingError("sub string must not be empty");let n=0;for(let i=0;i<e.length;i++)Kr.isStringAt(e,r,i)&&(n+=1);return n}};Eo.ParserUtils=Kr});var sw=dt(hi=>{"use strict";var dR=hi&&hi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ll=hi&&hi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dR(e,t,r)};Object.defineProperty(hi,"__esModule",{value:!0});ll(ow(),hi);ll(Wa(),hi);ll(xu(),hi);ll(vm(),hi)});var uw=dt(Ma=>{"use strict";var hR=Ma&&Ma.__awaiter||function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(l){try{s(n.next(l))}catch(f){o(f)}}function u(l){try{s(n.throw(l))}catch(f){o(f)}}function s(l){l.done?a(l.value):i(l.value).then(c,u)}s((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.Internal=void 0;var vR=require("obsidian"),ym=aw(),Ms=sw(),gR;(function(t){t.frontMatterRexExpPattern="^(---)\\n[\\s\\S]*?\\n---";function e(m){let h=new RegExp(t.frontMatterRexExpPattern).exec(m);if(!h)return{};let d=h[0];return d?(d=d.substring(4),d=d.substring(0,d.length-3),r(d)):{}}t.getMetaDataFromFileContent=e;function r(m){if(!m)return{};let p=(0,vR.parseYaml)(m);return p||{}}t.getMetaDataFromYAML=r;function n(m,p){var h;let d=(h=p.app.metadataCache.getFileCache(m))===null||h===void 0?void 0:h.frontmatter;if(d)d=Object.assign({},d),delete d.position;else return{};return d}t.getMetadataFromFileCache=n;function i(m){return m.replace(new RegExp(t.frontMatterRexExpPattern),"")}t.removeFrontmatter=i;function a(m,p,h){return hR(this,void 0,void 0,function*(){let d=yield h.app.vault.cachedRead(p);d=i(d),d.startsWith(`
`)?d=`${(0,ym.stringifyFrontmatter)(m)}${d}`:d.startsWith(`
`)?d=`${(0,ym.stringifyFrontmatter)(m)}
${d}`:d=`${(0,ym.stringifyFrontmatter)(m)}
${d}`,yield h.app.vault.modify(p,d)})}t.updateFrontmatter=a;function o(m,p){return c(m,p)!==void 0}t.hasField=o;function c(m,p){return(0,Ms.traverseObject)(m,p)}t.getField=c;function u(m,p){let{parent:h,child:d}=(0,Ms.traverseObjectToParent)(m,p);if(h.value===void 0)throw Error(`The parent of "${m}" does not exist in Object, can not delete child from non existing parent`);if(Array.isArray(h.value)){let g=Number.parseInt(d.key);if(Number.isNaN(g))return p;h.value.splice(g,1)}else delete h.value[d.key];return p}t.deleteField=u;function s(m,p,h){let{parent:d,child:g}=(0,Ms.traverseObjectToParent)(m,h);if(d.value===void 0)throw Error(`The parent of "${m}" does not exist in Object, please create the parent first`);if(g.value===void 0)throw Error(`Field with key "${m}" does not exist in Object`);return d.value[g.key]=p,h}t.updateField=s;function l(m,p,h){let{parent:d,child:g}=(0,Ms.traverseObjectToParent)(m,h);if(d.value===void 0)throw Error(`The parent of "${m}" does not exist in Object, please create the parent first`);if(g.value!==void 0)throw Error(`Field with key "${m}" does already exist in Object`);return d.value[g.key]=p,h}t.insertField=l;function f(m,p,h){let{parent:d,child:g}=(0,Ms.traverseObjectToParent)(m,h);if(d.value===void 0)throw Error(`The parent of "${m}" does not exist in Object, please create the parent first`);return d.value[g.key]=p,h}t.updateOrInsertField=f})(gR=Ma.Internal||(Ma.Internal={}))});var wm=dt((Dm,bm)=>{(function(t,e){typeof Dm=="object"&&typeof bm!="undefined"?bm.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis!="undefined"?globalThis:t||self,t.typed=e())})(Dm,function(){"use strict";function t(l,f){var m=typeof Symbol!="undefined"&&l[Symbol.iterator]||l["@@iterator"];if(!m){if(Array.isArray(l)||(m=e(l))||f&&l&&typeof l.length=="number"){m&&(l=m);var p=0,h=function(){};return{s:h,n:function(){return p>=l.length?{done:!0}:{done:!1,value:l[p++]}},e:function(v){throw v},f:h}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var d=!0,g=!1,D;return{s:function(){m=m.call(l)},n:function(){var v=m.next();return d=v.done,v},e:function(v){g=!0,D=v},f:function(){try{!d&&m.return!=null&&m.return()}finally{if(g)throw D}}}}function e(l,f){if(!!l){if(typeof l=="string")return r(l,f);var m=Object.prototype.toString.call(l).slice(8,-1);if(m==="Object"&&l.constructor&&(m=l.constructor.name),m==="Map"||m==="Set")return Array.from(l);if(m==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return r(l,f)}}function r(l,f){(f==null||f>l.length)&&(f=l.length);for(var m=0,p=new Array(f);m<f;m++)p[m]=l[m];return p}function n(l){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},n(l)}function i(){return!0}function a(){return!1}function o(){}var c="Argument is not a typed-function.";function u(){function l(W){return n(W)==="object"&&W!==null&&W.constructor===Object}var f=[{name:"number",test:function(K){return typeof K=="number"}},{name:"string",test:function(K){return typeof K=="string"}},{name:"boolean",test:function(K){return typeof K=="boolean"}},{name:"Function",test:function(K){return typeof K=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(K){return K instanceof Date}},{name:"RegExp",test:function(K){return K instanceof RegExp}},{name:"Object",test:l},{name:"null",test:function(K){return K===null}},{name:"undefined",test:function(K){return K===void 0}}],m={name:"any",test:i,isAny:!0},p,h,d=0,g={createCount:0};function D(W){var K=p.get(W);if(K)return K;var se='Unknown type "'+W+'"',le=W.toLowerCase(),De,x=t(h),O;try{for(x.s();!(O=x.n()).done;)if(De=O.value,De.toLowerCase()===le){se+='. Did you mean "'+De+'" ?';break}}catch(R){x.e(R)}finally{x.f()}throw new TypeError(se)}function N(W){for(var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",se=K?D(K).index:h.length,le=[],De=0;De<W.length;++De){if(!W[De]||typeof W[De].name!="string"||typeof W[De].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");var x=W[De].name;if(p.has(x))throw new TypeError('Duplicate type name "'+x+'"');le.push(x),p.set(x,{name:x,test:W[De].test,isAny:W[De].isAny,index:se+De,conversionsTo:[]})}var O=h.slice(se);h=h.slice(0,se).concat(le).concat(O);for(var R=se+le.length;R<h.length;++R)p.get(h[R]).index=R}function v(){p=new Map,h=[],d=0,N([m],!1)}v(),N(f);function w(){var W,K=t(h),se;try{for(K.s();!(se=K.n()).done;)W=se.value,p.get(W).conversionsTo=[]}catch(le){K.e(le)}finally{K.f()}d=0}function b(W){var K=h.filter(function(se){var le=p.get(se);return!le.isAny&&le.test(W)});return K.length?K:["any"]}function y(W){return W&&typeof W=="function"&&"_typedFunctionData"in W}function E(W,K,se){if(!y(W))throw new TypeError(c);var le=se&&se.exact,De=Array.isArray(K)?K.join(","):K,x=k(De),O=C(x);if(!le||O in W.signatures){var R=W._typedFunctionData.signatureMap.get(O);if(R)return R}var V=x.length,ee;if(le){ee=[];var ue;for(ue in W.signatures)ee.push(W._typedFunctionData.signatureMap.get(ue))}else ee=W._typedFunctionData.signatures;for(var ne=0;ne<V;++ne){var Pe=x[ne],ir=[],Er=void 0,mr=t(ee),jr;try{for(mr.s();!(jr=mr.n()).done;){Er=jr.value;var Cr=H(Er.params,ne);if(!(!Cr||Pe.restParam&&!Cr.restParam)){if(!Cr.hasAny){var nt=function(){var pt=L(Cr);if(Pe.types.some(function(jt){return!pt.has(jt.name)}))return"continue"}();if(nt==="continue")continue}ir.push(Er)}}}catch(pt){mr.e(pt)}finally{mr.f()}if(ee=ir,ee.length===0)break}var it,Ot=t(ee),Lr;try{for(Ot.s();!(Lr=Ot.n()).done;)if(it=Lr.value,it.params.length<=V)return it}catch(pt){Ot.e(pt)}finally{Ot.f()}throw new TypeError("Signature not found (signature: "+(W.name||"unnamed")+"("+C(x,", ")+"))")}function F(W,K,se){return E(W,K,se).implementation}function S(W,K){var se=D(K);if(se.test(W))return W;var le=se.conversionsTo;if(le.length===0)throw new Error("There are no conversions to "+K+" defined.");for(var De=0;De<le.length;De++){var x=D(le[De].from);if(x.test(W))return le[De].convert(W)}throw new Error("Cannot convert "+W+" to "+K)}function C(W){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return W.map(function(se){return se.name}).join(K)}function B(W){var K=W.indexOf("...")===0,se=K?W.length>3?W.slice(3):"any":W,le=se.split("|").map(function(R){return D(R.trim())}),De=!1,x=K?"...":"",O=le.map(function(R){return De=R.isAny||De,x+=R.name+"|",{name:R.name,typeIndex:R.index,test:R.test,isAny:R.isAny,conversion:null,conversionIndex:-1}});return{types:O,name:x.slice(0,-1),hasAny:De,hasConversion:!1,restParam:K}}function I(W){var K=W.types.map(function(O){return O.name}),se=fe(K),le=W.hasAny,De=W.name,x=se.map(function(O){var R=D(O.from);return le=R.isAny||le,De+="|"+O.from,{name:O.from,typeIndex:R.index,test:R.test,isAny:R.isAny,conversion:O,conversionIndex:O.index}});return{types:W.types.concat(x),name:De,hasAny:le,hasConversion:x.length>0,restParam:W.restParam}}function L(W){return W.typeSet||(W.typeSet=new Set,W.types.forEach(function(K){return W.typeSet.add(K.name)})),W.typeSet}function k(W){var K=[];if(typeof W!="string")throw new TypeError("Signatures must be strings");var se=W.trim();if(se==="")return K;for(var le=se.split(","),De=0;De<le.length;++De){var x=B(le[De].trim());if(x.restParam&&De!==le.length-1)throw new SyntaxError('Unexpected rest parameter "'+le[De]+'": only allowed for the last parameter');if(x.types.length===0)return null;K.push(x)}return K}function P(W){var K=j(W);return K?K.restParam:!1}function M(W){if(!W||W.types.length===0)return i;if(W.types.length===1)return D(W.types[0].name).test;if(W.types.length===2){var K=D(W.types[0].name).test,se=D(W.types[1].name).test;return function(x){return K(x)||se(x)}}else{var le=W.types.map(function(De){return D(De.name).test});return function(x){for(var O=0;O<le.length;O++)if(le[O](x))return!0;return!1}}}function T(W){var K,se,le;if(P(W)){K=$(W).map(M);var De=K.length,x=M(j(W)),O=function(V){for(var ee=De;ee<V.length;ee++)if(!x(V[ee]))return!1;return!0};return function(V){for(var ee=0;ee<K.length;ee++)if(!K[ee](V[ee]))return!1;return O(V)&&V.length>=De+1}}else return W.length===0?function(V){return V.length===0}:W.length===1?(se=M(W[0]),function(V){return se(V[0])&&V.length===1}):W.length===2?(se=M(W[0]),le=M(W[1]),function(V){return se(V[0])&&le(V[1])&&V.length===2}):(K=W.map(M),function(V){for(var ee=0;ee<K.length;ee++)if(!K[ee](V[ee]))return!1;return V.length===K.length})}function H(W,K){return K<W.length?W[K]:P(W)?j(W):null}function _(W,K){var se=H(W,K);return se?L(se):new Set}function z(W){return W.conversion===null||W.conversion===void 0}function Y(W,K){var se=new Set;return W.forEach(function(le){var De=_(le.params,K),x,O=t(De),R;try{for(O.s();!(R=O.n()).done;)x=R.value,se.add(x)}catch(V){O.e(V)}finally{O.f()}}),se.has("any")?["any"]:Array.from(se)}function X(W,K,se){var le,De,x=W||"unnamed",O=se,R,V=function(){var mr=[];if(O.forEach(function(Cr){var nt=H(Cr.params,R),it=M(nt);(R<Cr.params.length||P(Cr.params))&&it(K[R])&&mr.push(Cr)}),mr.length===0){if(De=Y(O,R),De.length>0){var jr=b(K[R]);return le=new TypeError("Unexpected type of argument in function "+x+" (expected: "+De.join(" or ")+", actual: "+jr.join(" | ")+", index: "+R+")"),le.data={category:"wrongType",fn:x,index:R,actual:jr,expected:De},{v:le}}}else O=mr};for(R=0;R<K.length;R++){var ee=V();if(n(ee)==="object")return ee.v}var ue=O.map(function(Er){return P(Er.params)?1/0:Er.params.length});if(K.length<Math.min.apply(null,ue))return De=Y(O,R),le=new TypeError("Too few arguments in function "+x+" (expected: "+De.join(" or ")+", index: "+K.length+")"),le.data={category:"tooFewArgs",fn:x,index:K.length,expected:De},le;var ne=Math.max.apply(null,ue);if(K.length>ne)return le=new TypeError("Too many arguments in function "+x+" (expected: "+ne+", actual: "+K.length+")"),le.data={category:"tooManyArgs",fn:x,index:K.length,expectedLength:ne},le;for(var Pe=[],ir=0;ir<K.length;++ir)Pe.push(b(K[ir]).join("|"));return le=new TypeError('Arguments of type "'+Pe.join(", ")+'" do not match any of the defined signatures of function '+x+"."),le.data={category:"mismatch",actual:Pe},le}function q(W){for(var K=h.length+1,se=0;se<W.types.length;se++)z(W.types[se])&&(K=Math.min(K,W.types[se].typeIndex));return K}function J(W){for(var K=d+1,se=0;se<W.types.length;se++)z(W.types[se])||(K=Math.min(K,W.types[se].conversionIndex));return K}function ae(W,K){if(W.hasAny){if(!K.hasAny)return 1}else if(K.hasAny)return-1;if(W.restParam){if(!K.restParam)return 1}else if(K.restParam)return-1;if(W.hasConversion){if(!K.hasConversion)return 1}else if(K.hasConversion)return-1;var se=q(W)-q(K);if(se<0)return-1;if(se>0)return 1;var le=J(W)-J(K);return le<0?-1:le>0?1:0}function re(W,K){var se=W.params,le=K.params,De=j(se),x=j(le),O=P(se),R=P(le);if(O&&De.hasAny){if(!R||!x.hasAny)return 1}else if(R&&x.hasAny)return-1;var V=0,ee=0,ue,ne=t(se),Pe;try{for(ne.s();!(Pe=ne.n()).done;)ue=Pe.value,ue.hasAny&&++V,ue.hasConversion&&++ee}catch(wn){ne.e(wn)}finally{ne.f()}var ir=0,Er=0,mr=t(le),jr;try{for(mr.s();!(jr=mr.n()).done;)ue=jr.value,ue.hasAny&&++ir,ue.hasConversion&&++Er}catch(wn){mr.e(wn)}finally{mr.f()}if(V!==ir)return V-ir;if(O&&De.hasConversion){if(!R||!x.hasConversion)return 1}else if(R&&x.hasConversion)return-1;if(ee!==Er)return ee-Er;if(O){if(!R)return 1}else if(R)return-1;var Cr=(se.length-le.length)*(O?-1:1);if(Cr!==0)return Cr;for(var nt=[],it=0,Ot=0;Ot<se.length;++Ot){var Lr=ae(se[Ot],le[Ot]);nt.push(Lr),it+=Lr}if(it!==0)return it;for(var pt,jt=0,bn=nt;jt<bn.length;jt++)if(pt=bn[jt],pt!==0)return pt;return 0}function fe(W){if(W.length===0)return[];var K=W.map(D);W.length>1&&K.sort(function(V,ee){return V.index-ee.index});var se=K[0].conversionsTo;if(W.length===1)return se;se=se.concat([]);for(var le=new Set(W),De=1;De<K.length;++De){var x=void 0,O=t(K[De].conversionsTo),R;try{for(O.s();!(R=O.n()).done;)x=R.value,le.has(x.from)||(se.push(x),le.add(x.from))}catch(V){O.e(V)}finally{O.f()}}return se}function he(W,K){var se=K;if(W.some(function(R){return R.hasConversion})){var le=P(W),De=W.map(me);se=function(){for(var V=[],ee=le?arguments.length-1:arguments.length,ue=0;ue<ee;ue++)V[ue]=De[ue](arguments[ue]);return le&&(V[ee]=arguments[ee].map(De[ee])),K.apply(this,V)}}var x=se;if(P(W)){var O=W.length-1;x=function(){return se.apply(this,te(arguments,0,O).concat([te(arguments,O)]))}}return x}function me(W){var K,se,le,De,x=[],O=[];switch(W.types.forEach(function(R){R.conversion&&(x.push(D(R.conversion.from).test),O.push(R.conversion.convert))}),O.length){case 0:return function(V){return V};case 1:return K=x[0],le=O[0],function(V){return K(V)?le(V):V};case 2:return K=x[0],se=x[1],le=O[0],De=O[1],function(V){return K(V)?le(V):se(V)?De(V):V};default:return function(V){for(var ee=0;ee<O.length;ee++)if(x[ee](V))return O[ee](V);return V}}}function ie(W){function K(se,le,De){if(le<se.length){var x=se[le],O=[];if(x.restParam){var R=x.types.filter(z);R.length<x.types.length&&O.push({types:R,name:"..."+R.map(function(V){return V.name}).join("|"),hasAny:R.some(function(V){return V.isAny}),hasConversion:!1,restParam:!0}),O.push(x)}else O=x.types.map(function(V){return{types:[V],name:V.name,hasAny:V.isAny,hasConversion:V.conversion,restParam:!1}});return pe(O,function(V){return K(se,le+1,De.concat([V]))})}else return[De]}return K(W,0,[])}function xe(W,K){for(var se=Math.max(W.length,K.length),le=0;le<se;le++){var De=_(W,le),x=_(K,le),O=!1,R=void 0,V=t(x),ee;try{for(V.s();!(ee=V.n()).done;)if(R=ee.value,De.has(R)){O=!0;break}}catch(Er){V.e(Er)}finally{V.f()}if(!O)return!1}var ue=W.length,ne=K.length,Pe=P(W),ir=P(K);return Pe?ir?ue===ne:ne>=ue:ir?ue>=ne:ue===ne}function Me(W){return W.map(function(K){return dr(K)?We(K.referToSelf.callback):Ke(K)?ge(K.referTo.references,K.referTo.callback):K})}function be(W,K,se){var le=[],De,x=t(W),O;try{for(x.s();!(O=x.n()).done;){De=O.value;var R=se[De];if(typeof R!="number")throw new TypeError('No definition for referenced signature "'+De+'"');if(R=K[R],typeof R!="function")return!1;le.push(R)}}catch(V){x.e(V)}finally{x.f()}return le}function Ce(W,K,se){for(var le=Me(W),De=new Array(le.length).fill(!1),x=!0;x;){x=!1;for(var O=!0,R=0;R<le.length;++R)if(!De[R]){var V=le[R];if(dr(V))le[R]=V.referToSelf.callback(se),le[R].referToSelf=V.referToSelf,De[R]=!0,O=!1;else if(Ke(V)){var ee=be(V.referTo.references,le,K);ee?(le[R]=V.referTo.callback.apply(this,ee),le[R].referTo=V.referTo,De[R]=!0,O=!1):x=!0}}if(O&&x)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return le}function U(W){var K=/\bthis(\(|\.signatures\b)/;Object.keys(W).forEach(function(se){var le=W[se];if(K.test(le.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 G(W,K){if(g.createCount++,Object.keys(K).length===0)throw new SyntaxError("No signatures provided");g.warnAgainstDeprecatedThis&&U(K);var se=[],le=[],De={},x=[],O,R=function(){if(!Object.prototype.hasOwnProperty.call(K,O))return"continue";var Bt=k(O);if(!Bt)return"continue";se.forEach(function($a){if(xe($a,Bt))throw new TypeError('Conflicting signatures "'+C($a)+'" and "'+C(Bt)+'".')}),se.push(Bt);var h1=le.length;le.push(K[O]);var L_=Bt.map(I),hu=void 0,vu=t(ie(L_)),v1;try{for(vu.s();!(v1=vu.n()).done;){hu=v1.value;var g1=C(hu);x.push({params:hu,name:g1,fn:h1}),hu.every(function($a){return!$a.hasConversion})&&(De[g1]=h1)}}catch($a){vu.e($a)}finally{vu.f()}};for(O in K)var V=R();x.sort(re);var ee=Ce(le,De,ns),ue;for(ue in De)Object.prototype.hasOwnProperty.call(De,ue)&&(De[ue]=ee[De[ue]]);for(var ne=[],Pe=new Map,ir=0,Er=x;ir<Er.length;ir++)ue=Er[ir],Pe.has(ue.name)||(ue.fn=ee[ue.fn],ne.push(ue),Pe.set(ue.name,ue));for(var mr=ne[0]&&ne[0].params.length<=2&&!P(ne[0].params),jr=ne[1]&&ne[1].params.length<=2&&!P(ne[1].params),Cr=ne[2]&&ne[2].params.length<=2&&!P(ne[2].params),nt=ne[3]&&ne[3].params.length<=2&&!P(ne[3].params),it=ne[4]&&ne[4].params.length<=2&&!P(ne[4].params),Ot=ne[5]&&ne[5].params.length<=2&&!P(ne[5].params),Lr=mr&&jr&&Cr&&nt&&it&&Ot,pt=0;pt<ne.length;++pt)ne[pt].test=T(ne[pt].params);for(var jt=mr?M(ne[0].params[0]):a,bn=jr?M(ne[1].params[0]):a,wn=Cr?M(ne[2].params[0]):a,Ui=nt?M(ne[3].params[0]):a,m_=it?M(ne[4].params[0]):a,p_=Ot?M(ne[5].params[0]):a,d_=mr?M(ne[0].params[1]):a,h_=jr?M(ne[1].params[1]):a,v_=Cr?M(ne[2].params[1]):a,g_=nt?M(ne[3].params[1]):a,y_=it?M(ne[4].params[1]):a,x_=Ot?M(ne[5].params[1]):a,ts=0;ts<ne.length;++ts)ne[ts].implementation=he(ne[ts].params,ne[ts].fn);var D_=mr?ne[0].implementation:o,b_=jr?ne[1].implementation:o,w_=Cr?ne[2].implementation:o,E_=nt?ne[3].implementation:o,C_=it?ne[4].implementation:o,N_=Ot?ne[5].implementation:o,A_=mr?ne[0].params.length:-1,F_=jr?ne[1].params.length:-1,S_=Cr?ne[2].params.length:-1,M_=nt?ne[3].params.length:-1,T_=it?ne[4].params.length:-1,O_=Ot?ne[5].params.length:-1,B_=Lr?6:0,I_=ne.length,__=ne.map(function(an){return an.test}),R_=ne.map(function(an){return an.implementation}),P_=function(){for(var Bt=B_;Bt<I_;Bt++)if(__[Bt](arguments))return R_[Bt].apply(this,arguments);return g.onMismatch(W,arguments,ne)};function ns(an,Bt){return arguments.length===A_&&jt(an)&&d_(Bt)?D_.apply(this,arguments):arguments.length===F_&&bn(an)&&h_(Bt)?b_.apply(this,arguments):arguments.length===S_&&wn(an)&&v_(Bt)?w_.apply(this,arguments):arguments.length===M_&&Ui(an)&&g_(Bt)?E_.apply(this,arguments):arguments.length===T_&&m_(an)&&y_(Bt)?C_.apply(this,arguments):arguments.length===O_&&p_(an)&&x_(Bt)?N_.apply(this,arguments):P_.apply(this,arguments)}try{Object.defineProperty(ns,"name",{value:W})}catch(an){}return ns.signatures=De,ns._typedFunctionData={signatures:ne,signatureMap:Pe},ns}function oe(W,K,se){throw X(W,K,se)}function $(W){return te(W,0,W.length-1)}function j(W){return W[W.length-1]}function te(W,K,se){return Array.prototype.slice.call(W,K,se)}function ve(W,K){for(var se=0;se<W.length;se++)if(K(W[se]))return W[se]}function pe(W,K){return Array.prototype.concat.apply([],W.map(K))}function Ne(){var W=$(arguments).map(function(se){return C(k(se))}),K=j(arguments);if(typeof K!="function")throw new TypeError("Callback function expected as last argument");return ge(W,K)}function ge(W,K){return{referTo:{references:W,callback:K}}}function We(W){if(typeof W!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:W}}}function Ke(W){return W&&n(W.referTo)==="object"&&Array.isArray(W.referTo.references)&&typeof W.referTo.callback=="function"}function dr(W){return W&&n(W.referToSelf)==="object"&&typeof W.referToSelf.callback=="function"}function wr(W,K){if(!W)return K;if(K&&K!==W){var se=new Error("Function names do not match (expected: "+W+", actual: "+K+")");throw se.data={actual:K,expected:W},se}return W}function Br(W){var K;for(var se in W)Object.prototype.hasOwnProperty.call(W,se)&&(y(W[se])||typeof W[se].signature=="string")&&(K=wr(K,W[se].name));return K}function gt(W,K){var se;for(se in K)if(Object.prototype.hasOwnProperty.call(K,se)){if(se in W&&K[se]!==W[se]){var le=new Error('Signature "'+se+'" is defined twice');throw le.data={signature:se,sourceFunction:K[se],destFunction:W[se]},le}W[se]=K[se]}}var yt=g;g=function(K){for(var se=typeof K=="string",le=se?1:0,De=se?K:"",x={},O=le;O<arguments.length;++O){var R=arguments[O],V={},ee=void 0;if(typeof R=="function"?(ee=R.name,typeof R.signature=="string"?V[R.signature]=R:y(R)&&(V=R.signatures)):l(R)&&(V=R,se||(ee=Br(R))),Object.keys(V).length===0){var ue=new TypeError("Argument to 'typed' at index "+O+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw ue.data={index:O,argument:R},ue}se||(De=wr(De,ee)),gt(x,V)}return G(De||"",x)},g.create=u,g.createCount=yt.createCount,g.onMismatch=oe,g.throwMismatchError=oe,g.createError=X,g.clear=v,g.clearConversions=w,g.addTypes=N,g._findType=D,g.referTo=Ne,g.referToSelf=We,g.convert=S,g.findSignature=E,g.find=F,g.isTypedFunction=y,g.warnAgainstDeprecatedThis=!0,g.addType=function(W,K){var se="any";K!==!1&&p.has("Object")&&(se="Object"),g.addTypes([W],se)};function nn(W){if(!W||typeof W.from!="string"||typeof W.to!="string"||typeof W.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(W.to===W.from)throw new SyntaxError('Illegal to define conversion from "'+W.from+'" to itself.')}return g.addConversion=function(W){nn(W);var K=D(W.to);if(K.conversionsTo.every(function(se){return se.from!==W.from}))K.conversionsTo.push({from:W.from,convert:W.convert,index:d++});else throw new Error('There is already a conversion from "'+W.from+'" to "'+K.name+'"')},g.addConversions=function(W){W.forEach(g.addConversion)},g.removeConversion=function(W){nn(W);var K=D(W.to),se=ve(K.conversionsTo,function(De){return De.from===W.from});if(!se)throw new Error("Attempt to remove nonexistent conversion from "+W.from+" to "+W.to);if(se.convert!==W.convert)throw new Error("Conversion to remove does not match existing conversion");var le=K.conversionsTo.indexOf(se);K.conversionsTo.splice(le,1)},g.resolve=function(W,K){if(!y(W))throw new TypeError(c);for(var se=W._typedFunctionData.signatures,le=0;le<se.length;++le)if(se[le].test(K))return se[le];return null},g}var s=u();return s})});var mE=dt((Vm,fE)=>{(function(t){"use strict";var e=Math.cosh||function(s){return Math.abs(s)<1e-9?1-s:(Math.exp(s)+Math.exp(-s))*.5},r=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),m=Math.abs(l);return f<3e3&&m<3e3?Math.sqrt(f*f+m*m):(f<m?(f=m,m=s/l):m=l/s,f*Math.sqrt(1+m*m))},a=function(){throw SyntaxError("Invalid Param")};function o(s,l){var f=Math.abs(s),m=Math.abs(l);return s===0?Math.log(m):l===0?Math.log(f):f<3e3&&m<3e3?Math.log(s*s+l*l)*.5:(s=s/2,l=l/2,.5*Math.log(s*s+l*l)+Math.LN2)}var c=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 u.INFINITY;f.re=s.abs*Math.cos(s.arg),f.im=s.abs*Math.sin(s.arg)}else if("r"in s&&"phi"in s){if(!Number.isFinite(s.r)&&Number.isFinite(s.phi))return u.INFINITY;f.re=s.r*Math.cos(s.phi),f.im=s.r*Math.sin(s.phi)}else s.length===2?(f.re=s[0],f.im=s[1]):a();break;case"string":f.im=f.re=0;var m=s.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),p=1,h=0;m===null&&a();for(var d=0;d<m.length;d++){var g=m[d];g===" "||g===" "||g===`
`||(g==="+"?p++:g==="-"?h++:g==="i"||g==="I"?(p+h===0&&a(),m[d+1]!==" "&&!isNaN(m[d+1])?(f.im+=parseFloat((h%2?"-":"")+m[d+1]),d++):f.im+=parseFloat((h%2?"-":"")+"1"),p=h=0):((p+h===0||isNaN(g))&&a(),m[d+1]==="i"||m[d+1]==="I"?(f.im+=parseFloat((h%2?"-":"")+g),d++):f.re+=parseFloat((h%2?"-":"")+g),p=h=0))}p+h>0&&a();break;case"number":f.im=0,f.re=s;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function u(s,l){if(!(this instanceof u))return new u(s,l);var f=c(s,l);this.re=f.re,this.im=f.im}u.prototype={re:0,im:0,sign:function(){var s=this.abs();return new u(this.re/s,this.im/s)},add:function(s,l){var f=new u(s,l);return this.isInfinite()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:new u(this.re+f.re,this.im+f.im)},sub:function(s,l){var f=new u(s,l);return this.isInfinite()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:new u(this.re-f.re,this.im-f.im)},mul:function(s,l){var f=new u(s,l);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:f.im===0&&this.im===0?new u(this.re*f.re,0):new u(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(s,l){var f=new u(s,l);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return u.NAN;if(this.isInfinite()||f.isZero())return u.INFINITY;if(this.isZero()||f.isInfinite())return u.ZERO;s=this.re,l=this.im;var m=f.re,p=f.im,h,d;return p===0?new u(s/m,l/m):Math.abs(m)<Math.abs(p)?(d=m/p,h=m*d+p,new u((s*d+l)/h,(l*d-s)/h)):(d=p/m,h=p*d+m,new u((s+l*d)/h,(l-s*d)/h))},pow:function(s,l){var f=new u(s,l);if(s=this.re,l=this.im,f.isZero())return u.ONE;if(f.im===0){if(l===0&&s>0)return new u(Math.pow(s,f.re),0);if(s===0)switch((f.re%4+4)%4){case 0:return new u(Math.pow(l,f.re),0);case 1:return new u(0,Math.pow(l,f.re));case 2:return new u(-Math.pow(l,f.re),0);case 3:return new u(0,-Math.pow(l,f.re))}}if(s===0&&l===0&&f.re>0&&f.im>=0)return u.ZERO;var m=Math.atan2(l,s),p=o(s,l);return s=Math.exp(f.re*p-f.im*m),l=f.im*p+f.re*m,new u(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){var s=this.re,l=this.im,f=this.abs(),m,p;if(s>=0){if(l===0)return new u(Math.sqrt(s),0);m=.5*Math.sqrt(2*(f+s))}else m=Math.abs(l)/Math.sqrt(2*(f-s));return s<=0?p=.5*Math.sqrt(2*(f-s)):p=Math.abs(l)/Math.sqrt(2*(f+s)),new u(m,l<0?-p:p)},exp:function(){var s=Math.exp(this.re);return this.im,new u(s*Math.cos(this.im),s*Math.sin(this.im))},expm1:function(){var s=this.re,l=this.im;return new u(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 u(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 u(Math.sin(s)*e(l),Math.cos(s)*r(l))},cos:function(){var s=this.re,l=this.im;return new u(Math.cos(s)*e(l),-Math.sin(s)*r(l))},tan:function(){var s=2*this.re,l=2*this.im,f=Math.cos(s)+e(l);return new u(Math.sin(s)/f,r(l)/f)},cot:function(){var s=2*this.re,l=2*this.im,f=Math.cos(s)-e(l);return new u(-Math.sin(s)/f,r(l)/f)},sec:function(){var s=this.re,l=this.im,f=.5*e(2*l)+.5*Math.cos(2*s);return new u(Math.cos(s)*e(l)/f,Math.sin(s)*r(l)/f)},csc:function(){var s=this.re,l=this.im,f=.5*e(2*l)-.5*Math.cos(2*s);return new u(Math.sin(s)*e(l)/f,-Math.cos(s)*r(l)/f)},asin:function(){var s=this.re,l=this.im,f=new u(l*l-s*s+1,-2*s*l).sqrt(),m=new u(f.re-l,f.im+s).log();return new u(m.im,-m.re)},acos:function(){var s=this.re,l=this.im,f=new u(l*l-s*s+1,-2*s*l).sqrt(),m=new u(f.re-l,f.im+s).log();return new u(Math.PI/2-m.im,m.re)},atan:function(){var s=this.re,l=this.im;if(s===0){if(l===1)return new u(0,1/0);if(l===-1)return new u(0,-1/0)}var f=s*s+(1-l)*(1-l),m=new u((1-l*l-s*s)/f,-2*s/f).log();return new u(-.5*m.im,.5*m.re)},acot:function(){var s=this.re,l=this.im;if(l===0)return new u(Math.atan2(1,s),0);var f=s*s+l*l;return f!==0?new u(s/f,-l/f).atan():new u(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 u(0,1/0);var f=s*s+l*l;return f!==0?new u(s/f,-l/f).acos():new u(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 u(Math.PI/2,1/0);var f=s*s+l*l;return f!==0?new u(s/f,-l/f).asin():new u(s!==0?s/0:0,l!==0?-l/0:0).asin()},sinh:function(){var s=this.re,l=this.im;return new u(r(s)*Math.cos(l),e(s)*Math.sin(l))},cosh:function(){var s=this.re,l=this.im;return new u(e(s)*Math.cos(l),r(s)*Math.sin(l))},tanh:function(){var s=2*this.re,l=2*this.im,f=e(s)+Math.cos(l);return new u(r(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 u(r(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 u(-2*r(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 u(2*e(s)*Math.cos(l)/f,-2*r(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,m=1-s,p=1+s,h=m*m+l*l,d=h!==0?new u((p*m-l*l)/h,(l*m+p*l)/h):new u(s!==-1?s/0:0,l!==0?l/0:0),g=d.re;return d.re=o(d.re,d.im)/2,d.im=Math.atan2(d.im,g)/2,f&&(d.im=-d.im),d},acoth:function(){var s=this.re,l=this.im;if(s===0&&l===0)return new u(0,Math.PI/2);var f=s*s+l*l;return f!==0?new u(s/f,-l/f).atanh():new u(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 u(s!==0?Math.log(s+Math.sqrt(s*s+1)):1/0,0);var f=s*s+l*l;return f!==0?new u(s/f,-l/f).asinh():new u(s!==0?s/0:0,l!==0?-l/0:0).asinh()},asech:function(){var s=this.re,l=this.im;if(this.isZero())return u.INFINITY;var f=s*s+l*l;return f!==0?new u(s/f,-l/f).acosh():new u(s!==0?s/0:0,l!==0?-l/0:0).acosh()},inverse:function(){if(this.isZero())return u.INFINITY;if(this.isInfinite())return u.ZERO;var s=this.re,l=this.im,f=s*s+l*l;return new u(s/f,-l/f)},conjugate:function(){return new u(this.re,-this.im)},neg:function(){return new u(-this.re,-this.im)},ceil:function(s){return s=Math.pow(10,s||0),new u(Math.ceil(this.re*s)/s,Math.ceil(this.im*s)/s)},floor:function(s){return s=Math.pow(10,s||0),new u(Math.floor(this.re*s)/s,Math.floor(this.im*s)/s)},round:function(s){return s=Math.pow(10,s||0),new u(Math.round(this.re*s)/s,Math.round(this.im*s)/s)},equals:function(s,l){var f=new u(s,l);return Math.abs(f.re-this.re)<=u.EPSILON&&Math.abs(f.im-this.im)<=u.EPSILON},clone:function(){return new u(this.re,this.im)},toString:function(){var s=this.re,l=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(s)<u.EPSILON&&(s=0),Math.abs(l)<u.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())}},u.ZERO=new u(0,0),u.ONE=new u(1,0),u.I=new u(0,1),u.PI=new u(Math.PI,0),u.E=new u(Math.E,0),u.INFINITY=new u(1/0,1/0),u.NAN=new u(NaN,NaN),u.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return u}):typeof Vm=="object"?(Object.defineProperty(u,"__esModule",{value:!0}),u.default=u,u.Complex=u,fE.exports=u):t.Complex=u})(Vm)});var dE=dt((Hm,pE)=>{(function(t){"use strict";var e=2e3,r={s:1,n:0,d:1};function n(m,p){if(isNaN(m=parseInt(m,10)))throw f.InvalidParameter;return m*p}function i(m,p){if(p===0)throw f.DivisionByZero;var h=Object.create(f.prototype);h.s=m<0?-1:1,m=m<0?-m:m;var d=l(m,p);return h.n=m/d,h.d=p/d,h}function a(m){for(var p={},h=m,d=2,g=4;g<=h;){for(;h%d===0;)h/=d,p[d]=(p[d]||0)+1;g+=1+2*d++}return h!==m?h>1&&(p[h]=(p[h]||0)+1):p[m]=(p[m]||0)+1,p}var o=function(m,p){var h=0,d=1,g=1,D=0,N=0,v=0,w=1,b=1,y=0,E=1,F=1,S=1,C=1e7,B;if(m!=null)if(p!==void 0){if(h=m,d=p,g=h*d,h%1!==0||d%1!==0)throw f.NonIntegerParameter}else switch(typeof m){case"object":{if("d"in m&&"n"in m)h=m.n,d=m.d,"s"in m&&(h*=m.s);else if(0 in m)h=m[0],1 in m&&(d=m[1]);else throw f.InvalidParameter;g=h*d;break}case"number":{if(m<0&&(g=m,m=-m),m%1===0)h=m;else if(m>0){for(m>=1&&(b=Math.pow(10,Math.floor(1+Math.log(m)/Math.LN10)),m/=b);E<=C&&S<=C;)if(B=(y+F)/(E+S),m===B){E+S<=C?(h=y+F,d=E+S):S>E?(h=F,d=S):(h=y,d=E);break}else m>B?(y+=F,E+=S):(F+=y,S+=E),E>C?(h=F,d=S):(h=y,d=E);h*=b}else(isNaN(m)||isNaN(p))&&(d=h=NaN);break}case"string":{if(E=m.match(/\d+|./g),E===null)throw f.InvalidParameter;if(E[y]==="-"?(g=-1,y++):E[y]==="+"&&y++,E.length===y+1?N=n(E[y++],g):E[y+1]==="."||E[y]==="."?(E[y]!=="."&&(D=n(E[y++],g)),y++,(y+1===E.length||E[y+1]==="("&&E[y+3]===")"||E[y+1]==="'"&&E[y+3]==="'")&&(N=n(E[y],g),w=Math.pow(10,E[y].length),y++),(E[y]==="("&&E[y+2]===")"||E[y]==="'"&&E[y+2]==="'")&&(v=n(E[y+1],g),b=Math.pow(10,E[y+1].length)-1,y+=3)):E[y+1]==="/"||E[y+1]===":"?(N=n(E[y],g),w=n(E[y+2],1),y+=3):E[y+3]==="/"&&E[y+1]===" "&&(D=n(E[y],g),N=n(E[y+2],g),w=n(E[y+4],1),y+=5),E.length<=y){d=w*b,g=h=v+d*D+b*N;break}}default:throw f.InvalidParameter}if(d===0)throw f.DivisionByZero;r.s=g<0?-1:1,r.n=Math.abs(h),r.d=Math.abs(d)};function c(m,p,h){for(var d=1;p>0;m=m*m%h,p>>=1)p&1&&(d=d*m%h);return d}function u(m,p){for(;p%2===0;p/=2);for(;p%5===0;p/=5);if(p===1)return 0;for(var h=10%p,d=1;h!==1;d++)if(h=h*10%p,d>e)return 0;return d}function s(m,p,h){for(var d=1,g=c(10,h,p),D=0;D<300;D++){if(d===g)return D;d=d*10%p,g=g*10%p}return 0}function l(m,p){if(!m)return p;if(!p)return m;for(;;){if(m%=p,!m)return p;if(p%=m,!p)return m}}function f(m,p){if(o(m,p),this instanceof f)m=l(r.d,r.n),this.s=r.s,this.n=r.n/m,this.d=r.d/m;else return i(r.s*r.n,r.d)}f.DivisionByZero=new Error("Division by Zero"),f.InvalidParameter=new Error("Invalid argument"),f.NonIntegerParameter=new Error("Parameters must be integer"),f.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(m,p){return o(m,p),i(this.s*this.n*r.d+r.s*this.d*r.n,this.d*r.d)},sub:function(m,p){return o(m,p),i(this.s*this.n*r.d-r.s*this.d*r.n,this.d*r.d)},mul:function(m,p){return o(m,p),i(this.s*r.s*this.n*r.n,this.d*r.d)},div:function(m,p){return o(m,p),i(this.s*r.s*this.n*r.d,this.d*r.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(m,p){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(m===void 0)return i(this.s*this.n%this.d,1);if(o(m,p),r.n===0&&this.d===0)throw f.DivisionByZero;return i(this.s*(r.d*this.n)%(r.n*this.d),r.d*this.d)},gcd:function(m,p){return o(m,p),i(l(r.n,this.n)*l(r.d,this.d),r.d*this.d)},lcm:function(m,p){return o(m,p),r.n===0&&this.n===0?i(0,1):i(r.n*this.n,l(r.n,this.n)*l(r.d,this.d))},ceil:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.ceil(m*this.s*this.n/this.d),m)},floor:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.floor(m*this.s*this.n/this.d),m)},round:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.round(m*this.s*this.n/this.d),m)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(m,p){if(o(m,p),r.d===1)return r.s<0?i(Math.pow(this.s*this.d,r.n),Math.pow(this.n,r.n)):i(Math.pow(this.s*this.n,r.n),Math.pow(this.d,r.n));if(this.s<0)return null;var h=a(this.n),d=a(this.d),g=1,D=1;for(var N in h)if(N!=="1"){if(N==="0"){g=0;break}if(h[N]*=r.n,h[N]%r.d===0)h[N]/=r.d;else return null;g*=Math.pow(N,h[N])}for(var N in d)if(N!=="1"){if(d[N]*=r.n,d[N]%r.d===0)d[N]/=r.d;else return null;D*=Math.pow(N,d[N])}return r.s<0?i(D,g):i(g,D)},equals:function(m,p){return o(m,p),this.s*this.n*r.d===r.s*r.n*this.d},compare:function(m,p){o(m,p);var h=this.s*this.n*r.d-r.s*r.n*this.d;return(0<h)-(h<0)},simplify:function(m){if(isNaN(this.n)||isNaN(this.d))return this;m=m||.001;for(var p=this.abs(),h=p.toContinued(),d=1;d<h.length;d++){for(var g=i(h[d-1],1),D=d-2;D>=0;D--)g=g.inverse().add(h[D]);if(g.sub(p).abs().valueOf()<m)return g.mul(this.s)}return this},divisible:function(m,p){return o(m,p),!(!(r.n*this.d)||this.n*r.d%(r.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(m){var p,h="",d=this.n,g=this.d;return this.s<0&&(h+="-"),g===1?h+=d:(m&&(p=Math.floor(d/g))>0&&(h+=p,h+=" ",d%=g),h+=d,h+="/",h+=g),h},toLatex:function(m){var p,h="",d=this.n,g=this.d;return this.s<0&&(h+="-"),g===1?h+=d:(m&&(p=Math.floor(d/g))>0&&(h+=p,d%=g),h+="\\frac{",h+=d,h+="}{",h+=g,h+="}"),h},toContinued:function(){var m,p=this.n,h=this.d,d=[];if(isNaN(p)||isNaN(h))return d;do d.push(Math.floor(p/h)),m=p%h,p=h,h=m;while(p!==1);return d},toString:function(m){var p=this.n,h=this.d;if(isNaN(p)||isNaN(h))return"NaN";m=m||15;var d=u(p,h),g=s(p,h,d),D=this.s<0?"-":"";if(D+=p/h|0,p%=h,p*=10,p&&(D+="."),d){for(var N=g;N--;)D+=p/h|0,p%=h,p*=10;D+="(";for(var N=d;N--;)D+=p/h|0,p%=h,p*=10;D+=")"}else for(var N=m;p&&N--;)D+=p/h|0,p%=h,p*=10;return D}},typeof define=="function"&&define.amd?define([],function(){return f}):typeof Hm=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,pE.exports=f):t.Fraction=f})(Hm)});var FN=dt((Iae,AN)=>{AN.exports=function t(e,r){"use strict";var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,c=/^0/,u=function(v){return t.insensitive&&(""+v).toLowerCase()||""+v},s=u(e).replace(i,"")||"",l=u(r).replace(i,"")||"",f=s.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=l.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(s.match(o),16)||f.length!==1&&s.match(a)&&Date.parse(s),h=parseInt(l.match(o),16)||p&&l.match(a)&&Date.parse(l)||null,d,g;if(h){if(p<h)return-1;if(p>h)return 1}for(var D=0,N=Math.max(f.length,m.length);D<N;D++){if(d=!(f[D]||"").match(c)&&parseFloat(f[D])||f[D]||0,g=!(m[D]||"").match(c)&&parseFloat(m[D])||m[D]||0,isNaN(d)!==isNaN(g))return isNaN(d)?1:-1;if(typeof d!=typeof g&&(d+="",g+=""),d<g)return-1;if(d>g)return 1}return 0}});var MA=dt((ife,SA)=>{"use strict";var gg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},tq={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},nq={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},iq=function(e,r){return gg({},e,r)};SA.exports=function(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.preserveFormatting,n=r===void 0?!1:r,i=e.escapeMapFn,a=i===void 0?iq:i,o=String(t),c="",u=a(gg({},tq),n?gg({},nq):{}),s=Object.keys(u),l=function(){var m=!1;s.forEach(function(p,h){m||o.length>=p.length&&o.slice(0,p.length)===p&&(c+=u[s[h]],o=o.slice(p.length,o.length),m=!0)}),m||(c+=o.slice(0,1),o=o.slice(1,o.length))};o;)l();return c}});var QT=dt((XT,y0)=>{(function(t,e,r){function n(c){var u=this,s=o();u.next=function(){var l=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=l-(u.c=l|0)},u.c=1,u.s0=s(" "),u.s1=s(" "),u.s2=s(" "),u.s0-=s(c),u.s0<0&&(u.s0+=1),u.s1-=s(c),u.s1<0&&(u.s1+=1),u.s2-=s(c),u.s2<0&&(u.s2+=1),s=null}function i(c,u){return u.c=c.c,u.s0=c.s0,u.s1=c.s1,u.s2=c.s2,u}function a(c,u){var s=new n(c),l=u&&u.state,f=s.next;return f.int32=function(){return s.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,l&&(typeof l=="object"&&i(l,s),f.state=function(){return i(s,{})}),f}function o(){var c=4022871197,u=function(s){s=String(s);for(var l=0;l<s.length;l++){c+=s.charCodeAt(l);var f=.02519603282416938*c;c=f>>>0,f-=c,f*=c,c=f>>>0,f-=c,c+=f*4294967296}return(c>>>0)*23283064365386963e-26};return u}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.alea=a})(XT,typeof y0=="object"&&y0,typeof define=="function"&&define)});var e3=dt((KT,x0)=>{(function(t,e,r){function n(o){var c=this,u="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var l=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^l^l>>>8},o===(o|0)?c.x=o:u+=o;for(var s=0;s<u.length+64;s++)c.x^=u.charCodeAt(s)|0,c.next()}function i(o,c){return c.x=o.x,c.y=o.y,c.z=o.z,c.w=o.w,c}function a(o,c){var u=new n(o),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var f=u.next()>>>11,m=(u.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},l.int32=u.next,l.quick=l,s&&(typeof s=="object"&&i(s,u),l.state=function(){return i(u,{})}),l}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xor128=a})(KT,typeof x0=="object"&&x0,typeof define=="function"&&define)});var t3=dt((r3,D0)=>{(function(t,e,r){function n(o){var c=this,u="";c.next=function(){var l=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(l^l<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,o===(o|0)?c.x=o:u+=o;for(var s=0;s<u.length+64;s++)c.x^=u.charCodeAt(s)|0,s==u.length&&(c.d=c.x<<10^c.x>>>4),c.next()}function i(o,c){return c.x=o.x,c.y=o.y,c.z=o.z,c.w=o.w,c.v=o.v,c.d=o.d,c}function a(o,c){var u=new n(o),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var f=u.next()>>>11,m=(u.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},l.int32=u.next,l.quick=l,s&&(typeof s=="object"&&i(s,u),l.state=function(){return i(u,{})}),l}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xorwow=a})(r3,typeof D0=="object"&&D0,typeof define=="function"&&define)});var i3=dt((n3,b0)=>{(function(t,e,r){function n(o){var c=this;c.next=function(){var s=c.x,l=c.i,f,m,p;return f=s[l],f^=f>>>7,m=f^f<<24,f=s[l+1&7],m^=f^f>>>10,f=s[l+3&7],m^=f^f>>>3,f=s[l+4&7],m^=f^f<<7,f=s[l+7&7],f=f^f<<13,m^=f^f<<9,s[l]=m,c.i=l+1&7,m};function u(s,l){var f,m,p=[];if(l===(l|0))m=p[0]=l;else for(l=""+l,f=0;f<l.length;++f)p[f&7]=p[f&7]<<15^l.charCodeAt(f)+p[f+1&7]<<13;for(;p.length<8;)p.push(0);for(f=0;f<8&&p[f]===0;++f);for(f==8?m=p[7]=-1:m=p[f],s.x=p,s.i=0,f=256;f>0;--f)s.next()}u(c,o)}function i(o,c){return c.x=o.x.slice(),c.i=o.i,c}function a(o,c){o==null&&(o=+new Date);var u=new n(o),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var f=u.next()>>>11,m=(u.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},l.int32=u.next,l.quick=l,s&&(s.x&&i(s,u),l.state=function(){return i(u,{})}),l}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xorshift7=a})(n3,typeof b0=="object"&&b0,typeof define=="function"&&define)});var o3=dt((a3,w0)=>{(function(t,e,r){function n(o){var c=this;c.next=function(){var s=c.w,l=c.X,f=c.i,m,p;return c.w=s=s+1640531527|0,p=l[f+34&127],m=l[f=f+1&127],p^=p<<13,m^=m<<17,p^=p>>>15,m^=m>>>12,p=l[f]=p^m,c.i=f,p+(s^s>>>16)|0};function u(s,l){var f,m,p,h,d,g=[],D=128;for(l===(l|0)?(m=l,l=null):(l=l+"\0",m=0,D=Math.max(D,l.length)),p=0,h=-32;h<D;++h)l&&(m^=l.charCodeAt((h+32)%l.length)),h===0&&(d=m),m^=m<<10,m^=m>>>15,m^=m<<4,m^=m>>>13,h>=0&&(d=d+1640531527|0,f=g[h&127]^=m+d,p=f==0?p+1:0);for(p>=128&&(g[(l&&l.length||0)&127]=-1),p=127,h=4*128;h>0;--h)m=g[p+34&127],f=g[p=p+1&127],m^=m<<13,f^=f<<17,m^=m>>>15,f^=f>>>12,g[p]=m^f;s.w=d,s.X=g,s.i=p}u(c,o)}function i(o,c){return c.i=o.i,c.w=o.w,c.X=o.X.slice(),c}function a(o,c){o==null&&(o=+new Date);var u=new n(o),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var f=u.next()>>>11,m=(u.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},l.int32=u.next,l.quick=l,s&&(s.X&&i(s,u),l.state=function(){return i(u,{})}),l}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xor4096=a})(a3,typeof w0=="object"&&w0,typeof define=="function"&&define)});var u3=dt((s3,E0)=>{(function(t,e,r){function n(o){var c=this,u="";c.next=function(){var l=c.b,f=c.c,m=c.d,p=c.a;return l=l<<25^l>>>7^f,f=f-m|0,m=m<<24^m>>>8^p,p=p-l|0,c.b=l=l<<20^l>>>12^f,c.c=f=f-m|0,c.d=m<<16^f>>>16^p,c.a=p-l|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,o===Math.floor(o)?(c.a=o/4294967296|0,c.b=o|0):u+=o;for(var s=0;s<u.length+20;s++)c.b^=u.charCodeAt(s)|0,c.next()}function i(o,c){return c.a=o.a,c.b=o.b,c.c=o.c,c.d=o.d,c}function a(o,c){var u=new n(o),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var f=u.next()>>>11,m=(u.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},l.int32=u.next,l.quick=l,s&&(typeof s=="object"&&i(s,u),l.state=function(){return i(u,{})}),l}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.tychei=a})(s3,typeof E0=="object"&&E0,typeof define=="function"&&define)});var c3=dt((l3,Cc)=>{(function(t,e,r){var n=256,i=6,a=52,o="random",c=r.pow(n,i),u=r.pow(2,a),s=u*2,l=n-1,f;function m(v,w,b){var y=[];w=w==!0?{entropy:!0}:w||{};var E=g(d(w.entropy?[v,N(e)]:v==null?D():v,3),y),F=new p(y),S=function(){for(var C=F.g(i),B=c,I=0;C<u;)C=(C+I)*n,B*=n,I=F.g(1);for(;C>=s;)C/=2,B/=2,I>>>=1;return(C+I)/B};return S.int32=function(){return F.g(4)|0},S.quick=function(){return F.g(4)/4294967296},S.double=S,g(N(F.S),e),(w.pass||b||function(C,B,I,L){return L&&(L.S&&h(L,F),C.state=function(){return h(F,{})}),I?(r[o]=C,B):C})(S,E,"global"in w?w.global:this==r,w.state)}function p(v){var w,b=v.length,y=this,E=0,F=y.i=y.j=0,S=y.S=[];for(b||(v=[b++]);E<n;)S[E]=E++;for(E=0;E<n;E++)S[E]=S[F=l&F+v[E%b]+(w=S[E])],S[F]=w;(y.g=function(C){for(var B,I=0,L=y.i,k=y.j,P=y.S;C--;)B=P[L=l&L+1],I=I*n+P[l&(P[L]=P[k=l&k+B])+(P[k]=B)];return y.i=L,y.j=k,I})(n)}function h(v,w){return w.i=v.i,w.j=v.j,w.S=v.S.slice(),w}function d(v,w){var b=[],y=typeof v,E;if(w&&y=="object")for(E in v)try{b.push(d(v[E],w-1))}catch(F){}return b.length?b:y=="string"?v:v+"\0"}function g(v,w){for(var b=v+"",y,E=0;E<b.length;)w[l&E]=l&(y^=w[l&E]*19)+b.charCodeAt(E++);return N(w)}function D(){try{var v;return f&&(v=f.randomBytes)?v=v(n):(v=new Uint8Array(n),(t.crypto||t.msCrypto).getRandomValues(v)),N(v)}catch(y){var w=t.navigator,b=w&&w.plugins;return[+new Date,t,b,t.screen,N(e)]}}function N(v){return String.fromCharCode.apply(0,v)}if(g(r.random(),e),typeof Cc=="object"&&Cc.exports){Cc.exports=m;try{f=require("crypto")}catch(v){}}else typeof define=="function"&&define.amd?define(function(){return m}):r["seed"+o]=m})(typeof self!="undefined"?self:l3,[],Math)});var m3=dt((lEe,f3)=>{var bz=QT(),wz=e3(),Ez=t3(),Cz=i3(),Nz=o3(),Az=u3(),Pa=c3();Pa.alea=bz;Pa.xor128=wz;Pa.xorwow=Ez;Pa.xorshift7=Cz;Pa.xor4096=Nz;Pa.tychei=Az;f3.exports=Pa});var kU={};$_(kU,{default:()=>Do});module.exports=H_(kU);var f_=require("obsidian");var on=require("obsidian");var x1=["January","February","March","April","May","June","July","August","September","October","November","December"],ma=[{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"}],qn={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",useUsDateInputOrder:!1,firstWeekday:ma[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,inputTemplates:""};var yu=class extends on.PluginSettingTab{constructor(r,n){super(r,n);this.plugin=n}display(){let{containerEl:r}=this;r.empty(),r.createEl("h2",{text:"Meta Bind Plugin Settings"}),new on.Setting(r).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: ${qn.syncInterval}; Minimum: ${qn.minSyncInterval}; Maximum: ${qn.maxSyncInterval}`).addText(i=>{i.setValue(this.plugin.settings.syncInterval.toString()),i.onChange(a=>{this.plugin.settings.syncInterval=Number.parseInt(a),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=qn.syncInterval),this.plugin.settings.syncInterval<qn.minSyncInterval&&(this.plugin.settings.syncInterval=qn.minSyncInterval),this.plugin.settings.syncInterval>qn.maxSyncInterval&&(this.plugin.settings.syncInterval=qn.maxSyncInterval),this.plugin.saveSettings()})}),new on.Setting(r).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(i=>{i.setValue(this.plugin.settings.preferredDateFormat),i.onChange(a=>{this.plugin.settings.preferredDateFormat=a,this.plugin.saveSettings()})}),new on.Setting(r).setName("Use US date input field order").setDesc("When enabled the month input is before the day input.").addToggle(i=>{i.setValue(this.plugin.settings.useUsDateInputOrder),i.onChange(a=>{this.plugin.settings.useUsDateInputOrder=a,this.plugin.saveSettings()})}),new on.Setting(r).setName("First Weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(i=>{for(let a of ma)i.addOption(a.name,a.name);i.setValue(this.plugin.settings.firstWeekday.name),i.onChange(a=>{let o=ma.find(c=>c.name===a);this.plugin.settings.firstWeekday=o,this.plugin.saveSettings()})}),new on.Setting(r).setName("Templates").setDesc("You can specify templates here, and access them using `INPUT[template_name][overrides (optional)]` in your notes.");let n=new on.TextAreaComponent(r);n.setValue(this.plugin.settings.inputTemplates),n.setPlaceholder("template_name -> INPUT[input_type(argument(value)):bind_target]"),n.inputEl.style.width="100%",n.inputEl.style.height="200px",n.onChange(i=>{this.plugin.settings.inputTemplates=i,this.plugin.saveSettings()}),new on.Setting(r).setName("Dev Mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(i=>{i.setValue(this.plugin.settings.devMode),i.onChange(a=>{this.plugin.settings.devMode=a,this.plugin.saveSettings()})}),new on.Setting(r).setName("Enable JS Input Fields").setDesc("Enable the processing of JavaScript input fields. This is potentially DANGEROUS, thus it's disabled by default. RESTART REQUIRED.").addToggle(i=>{i.setValue(this.plugin.settings.enableJs),i.onChange(a=>{this.plugin.settings.enableJs=a,this.plugin.saveSettings()})}),new on.Setting(r).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(i=>{i.setValue(this.plugin.settings.ignoreCodeBlockRestrictions),i.onChange(a=>{this.plugin.settings.ignoreCodeBlockRestrictions=a,this.plugin.saveSettings()})})}};var Nr=class{constructor(e){this.renderChild=e,this.onValueChange=r=>{console.debug("meta-bind | input field on value change",r),this.renderChild.readSignal.set(r)},this.renderChild.writeSignal.registerListener({callback:r=>{this.isEqualValue(r)||this.setValue(r)}})}};Nr.allowBlock=!0,Nr.allowInline=!0;var A1=require("obsidian");var zn=class extends Error{constructor(r,n,i,a={}){super("");this.errorLevel=r,this.effect=n,this.cause=i,this.context=a,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)}},Qe=class extends zn{getErrorType(){return"MB_INTERNAL_ERROR"}},or=class extends zn{getErrorType(){return"MB_PARSING_ERROR"}},ui=class extends zn{getErrorType(){return"MB_BIND_TARGET_ERROR"}},xt=class extends zn{getErrorType(){return"MB_VALUE_ERROR"}},Un=class extends zn{getErrorType(){return"MB_ARGUMENT_ERROR"}},is=class extends zn{getErrorType(){return"MB_JS_ERROR"}},pa=class extends zn{getErrorType(){return"MB_EXPRESSION_ERROR"}};var b1=Yt(Wa());function tf(t){var e;return(e=t.split("/").at(-1))!=null?e:t}function w1(t){return t.split("/").length>1}function as(t){let e=t.split(".");if(e.length===1)return t;{let r=e[0];for(let n=1;n<e.length-1;n++)r+="."+e[n];return r}}function os(t,e,r){return Math.min(Math.max(t,e),r)}function nf(t,e,r,n,i){return(t-e)/(r-e)*(i-n)+n}function Ga(t,e){return(t%e+e)%e}function E1(t,e){if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let r of t)if(!e.contains(r))return!1;return!0}function C1(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function li(t){return!!t}function Du(t){return!t}function ss(t,e){return t===e||t.includes(e)||e.includes(t)}function af(t){return t+""}function N1(t,e){var a;if(t[0]==="")throw new Error("can not traverse to parent on self reference");let r=t.slice(0,-1),n=(a=t.at(-1))!=null?a:"",i=(0,b1.traverseObjectByPath)(r,e);return{parent:{key:r,value:i},child:{key:n,value:i[n]}}}function Za(t){return app.vault.adapter.getResourcePath(t)}var Cn=class{constructor(e,r){if(Du(e))throw new Qe("ERROR","failed to create enclosing pair","opening string must not be empty");this.openingEqualsClosing=Du(r)||e===r,this.openingEqualsClosing?(this._openingString=e,this._closingString=e):(this._openingString=e,this._closingString=r)}get openingString(){return this._openingString}get closingString(){return this.openingEqualsClosing?this._openingString:this._closingString}overlaps(e){return ss(this.openingString,e.openingString)||ss(this.openingString,e.closingString)||ss(this.closingString,e.openingString)||ss(this.closingString,e.closingString)}equals(e){return Du(e)?!1:this.openingString===e.openingString&&this.closingString===e.closingString}toString(){return JSON.stringify(this)}},sr=class{static split(e,r,n){if(!e)throw new Qe("ERROR","failed to split string","string must not be empty");if(!r)throw new Qe("ERROR","failed to split string","separator must not be empty");let i="",a=[];if(n){let o=sr.numberOfOccurrences(e,n.openingString),c=sr.numberOfOccurrences(e,n.closingString),u=0;e:for(let s=0;s<e.length;s++)if(u===0&&sr.isStringAt(e,r,s)?(a.push(i),i="",s+=r.length-1):i+=e[s],n.openingEqualsClosing){if(sr.isStringAt(e,n.openingString,s)){if(!(u%2===0&&o===1))if(u%2===0){u+=1;for(let l=1;l<n.openingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}else{u-=1;for(let l=1;l<n.closingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}o-=1}}else if(sr.isStringAt(e,n.openingString,s)){if(o<=c){u+=1;for(let l=1;l<n.openingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}o-=1}else if(sr.isStringAt(e,n.closingString,s)){if(u>0){u-=1;for(let l=1;l<n.closingString.length;l++)if(s+=1,i+=e[s],s>=e.length)break e}c-=1}}else for(let o=0;o<e.length;o++)sr.isStringAt(e,r,o)?(a.push(i),i="",o+=r.length-1):i+=e[o];return a.push(i),a}static removeInBetween(e,r){if(!e)throw new Qe("ERROR","failed remove in between in string","string must not be empty");let n=sr.numberOfOccurrences(e,r.openingString),i=sr.numberOfOccurrences(e,r.closingString),a=0,o="";for(let c=0;c<e.length;c++){if(r.openingEqualsClosing){if(sr.isStringAt(e,r.openingString,c)){if(!(a%2===0&&n===1)){if(a%2===0){if(a+=1,c+=r.openingString.length,c>=e.length)break}else if(a-=1,c+=r.closingString.length,c>=e.length)break}n-=1}}else if(sr.isStringAt(e,r.openingString,c)){if(n<=i&&(a+=1,c+=r.openingString.length,c>=e.length))break;n-=1}else if(sr.isStringAt(e,r.closingString,c)){if(a>0&&(a-=1,c+=r.closingString.length,c>=e.length))break;i-=1}a===0&&(o+=e[c])}return o}static getInBetween(e,r){if(!e)throw new Qe("ERROR","failed to get in between in string","string must not be empty");let n=sr.numberOfOccurrences(e,r.openingString),i=sr.numberOfOccurrences(e,r.closingString),a=0,o="",c=[];e:for(let u=0;u<e.length;u++)if(r.openingEqualsClosing)if(sr.isStringAt(e,r.openingString,u)){if(!(a%2===0&&n===1))if(a%2===0){a+=1,o+=e[u];for(let s=1;s<r.openingString.length;s++)if(u+=1,o+=e[u],u>=e.length)break e}else{a-=1,o+=e[u];for(let s=1;s<r.closingString.length;s++)if(u+=1,o+=e[u],u>e.length)break e;c.push(o),o=""}n-=1}else a>=1&&(o+=e[u]);else if(sr.isStringAt(e,r.openingString,u)){if(n<=i){a+=1,o+=e[u];for(let s=1;s<r.openingString.length;s++)if(u+=1,o+=e[u],u>=e.length)break e}n-=1}else if(sr.isStringAt(e,r.closingString,u)){if(a>0){a-=1,o+=e[u];for(let s=1;s<r.closingString.length;s++)if(u+=1,o+=e[u],u>e.length)break e;a===0&&(c.push(o),o="")}i-=1}else a>=1&&(o+=e[u]);return c.length===0?"":c.length===1?c[0].substring(r.openingString.length,c[0].length-r.closingString.length):c.map(u=>u.substring(r.openingString.length,u.length-r.closingString.length))}static isStringAt(e,r,n){if(n<0)throw new Qe("ERROR","failed to check is string is at index","index must be greater than 0");if(n>=e.length)throw new Qe("ERROR","failed to check is string is at index","index out of bounds of string");if(!e)throw new Qe("ERROR","failed to check is string is at index","string must not be empty");if(!r)throw new Qe("ERROR","failed to check is string is at index","sub string must not be empty");for(let i=0;i<r.length;i++)if(e[i+n]!==r[i])return!1;return!0}static contains(e,r){return sr.numberOfOccurrences(e,r)>0}static numberOfOccurrences(e,r){if(!e)throw new Qe("ERROR","failed count number of occurrences","string must not be empty");if(!r)throw new Qe("ERROR","failed count number of occurrences","sub string must not be empty");let n=0;for(let i=0;i<e.length;i++)sr.isStringAt(e,r,i)&&(n+=1);return n}};var Yr=class{constructor(){this.identifier="invalid";this.allowedInputFields=[];this.requiresValue=!1;this.allowMultiple=!1}isAllowed(e){return this.allowedInputFields.length===0?!0:this.allowedInputFields.contains(e)}getAllowedInputFieldsAsString(){return this.allowedInputFields.length===0?"all":this.allowedInputFields.join(", ")}};var bu=class extends Yr{constructor(){super(...arguments);this.identifier="class";this.allowedInputFields=[];this.value=[];this.requiresValue=!0;this.allowMultiple=!0}parseValue(r){this.value=r.split(" ")}};var wu=class extends Yr{constructor(){super(...arguments);this.identifier="addLabels";this.allowedInputFields=["slider","progressBar"];this.value=!0;this.requiresValue=!1;this.allowMultiple=!1}parseValue(r){typeof r=="boolean"?this.value=r:typeof r=="string"&&(this.value=r.toLowerCase()==="true")}};var Eu=class extends Yr{constructor(){super(...arguments);this.identifier="minValue";this.allowedInputFields=["slider","progressBar"];this.value=0;this.requiresValue=!0;this.allowMultiple=!1}parseValue(r){if(this.value=Number.parseInt(r),Number.isNaN(this.value))throw new or("ERROR","failed to set value for input field argument","value of argument 'minValue' must be of type number")}};var Cu=class extends Yr{constructor(){super(...arguments);this.identifier="maxValue";this.allowedInputFields=["slider","progressBar"];this.value=100;this.requiresValue=!0;this.allowMultiple=!1}parseValue(r){if(this.value=Number.parseInt(r),Number.isNaN(this.value))throw new or("ERROR","failed to set value for input field argument","value of argument 'maxValue' must be of type number")}};var Nu=class extends Yr{constructor(){super(...arguments);this.identifier="option";this.allowedInputFields=["select","multi_select","suggester","imageSuggester","inlineSelect"];this.value="";this.requiresValue=!0;this.allowMultiple=!0}parseValue(r){this.value=r}};var Au=class extends Yr{constructor(){super(...arguments);this.identifier="title";this.allowedInputFields=[];this.value="";this.requiresValue=!0;this.allowMultiple=!1}parseValue(r){this.value=r}};var Fu=class extends Yr{constructor(){super(...arguments);this.identifier="alignRight";this.allowedInputFields=["date_picker"];this.value=!0;this.requiresValue=!1;this.allowMultiple=!1}parseValue(r){this.value=r.toLowerCase()==="true"}};var Su=class extends Yr{constructor(){super(...arguments);this.identifier="optionQuery";this.allowedInputFields=["suggester","imageSuggester"];this.value="";this.requiresValue=!0;this.allowMultiple=!0}parseValue(r){this.value=r}};var Mu=class extends Yr{constructor(){super(...arguments);this.identifier="showcase";this.allowedInputFields=[];this.value=!0;this.requiresValue=!1;this.allowMultiple=!1}parseValue(r){this.value=r.toLowerCase()==="true"}};var Tu=class extends Yr{constructor(){super(...arguments);this.identifier="offValue";this.allowedInputFields=["toggle"];this.value=!1;this.requiresValue=!0;this.allowMultiple=!1}parseValue(r){if(r==="true")this.value=!0;else if(r==="false")this.value=!1;else{let n=Number.parseFloat(r);this.value=Number.isNaN(n)?r:n}}};var Ou=class extends Yr{constructor(){super(...arguments);this.identifier="onValue";this.allowedInputFields=["toggle"];this.value=!0;this.requiresValue=!0;this.allowMultiple=!1}parseValue(r){if(r==="true")this.value=!0;else if(r==="false")this.value=!1;else{let n=Number.parseFloat(r);this.value=Number.isNaN(n)?r:n}}};var Bu=class{static createInputFieldArgument(e){if(e==="class")return new bu;if(e==="addLabels")return new wu;if(e==="minValue")return new Eu;if(e==="maxValue")return new Cu;if(e==="option")return new Nu;if(e==="title")return new Au;if(e==="alignRight")return new Fu;if(e==="optionQuery")return new Su;if(e==="showcase")return new Mu;if(e==="offValue")return new Tu;if(e==="onValue")return new Ou;throw new or("ERROR","can not crate input field argument",`unknown argument '${e}'`)}};var ja=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let r of Object.values(Gr))e[r]=0;for(let r of this.arguments)if(e[r.identifier]+=1,e[r.identifier]>1&&!r.allowMultiple)throw new or("CRITICAL","failed to validate argument container",`argument '${r.identifier}' does not allow duplicates`)}mergeByOverride(e){for(let r of e.arguments)r.allowMultiple||(this.arguments=this.arguments.filter(n=>n.identifier!==r.identifier)),this.arguments.push(r);return this.validate(),this}mergeByThrow(e){for(let r of e.arguments){if(!r.allowMultiple&&this.arguments.filter(n=>n.identifier===r.identifier).length>0)throw new or("ERROR","failed to merge argument container","can not merge InputFieldArgumentContainers, since arguments overlap");this.arguments.push(r)}return this.validate(),this}getAll(e){return this.arguments.filter(r=>r.identifier===e)}get(e){return this.getAll(e).at(0)}};var Nn=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?e instanceof zn?this.errors.push(e):this.otherError=e:console.warn("[MB_ERROR_CONTAINER] received invalid error type",e)}merge(e){this.errors=this.errors.concat(e.errors),e.otherError&&(this.otherError=e.otherError)}hasErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="ERROR"||e.errorLevel==="CRITICAL")return!0;return!1}hasCriticalErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="CRITICAL")return!0;return!1}hasWarnings(){for(let e of this.errors)if(e.errorLevel==="WARNING")return!0;return!1}isEmpty(){return this.errors.length===0&&!this.otherError}getErrors(){let e=this.errors.filter(r=>r.errorLevel==="ERROR"||r.errorLevel==="CRITICAL");return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel==="WARNING")}};var sn=(g=>(g.TOGGLE="toggle",g.SLIDER="slider",g.TEXT="text",g.TEXT_AREA="text_area",g.SELECT="select",g.MULTI_SELECT="multi_select",g.DATE="date",g.TIME="time",g.DATE_PICKER="date_picker",g.NUMBER="number",g.SUGGESTER="suggester",g.EDITOR="editor",g.IMAGE_SUGGESTER="imageSuggester",g.PROGRESS_BAR="progressBar",g.INLINE_SELECT="inlineSelect",g.INVALID="invalid",g))(sn||{}),Gr=(m=>(m.CLASS="class",m.ADD_LABELS="addLabels",m.MIN_VALUE="minValue",m.MAX_VALUE="maxValue",m.OPTION="option",m.TITLE="title",m.ALIGN_RIGHT="alignRight",m.OPTION_QUERY="optionQuery",m.SHOWCASE="showcase",m.ON_VALUE="onValue",m.OFF_VALUE="offValue",m.INVALID="invalid",m))(Gr||{}),Iu=class{constructor(){this.roundBracesPair=new Cn("(",")");this.squareBracesPair=new Cn("[","]");this.curlyBracesPair=new Cn("{","}");this.allBracesPairs=[this.roundBracesPair,this.squareBracesPair,this.curlyBracesPair];this.templates=[]}parseDeclaration(e,r,n){e.inputFieldType=this.getInputFieldType(e.inputFieldType),e.errorCollection||(e.errorCollection=new Nn("InputFieldDeclaration"));try{if(li(n)&&this.applyTemplate(e,n),e.inputFieldType==="invalid")throw new or("CRITICAL","failed to parse input field declaration",`unknown input field type "${e.inputFieldType}"`);let a=this.parseArguments(e.inputFieldType,r,e.errorCollection);e.argumentContainer.mergeByOverride(a)}catch(i){e.errorCollection.add(i)}return e}parseString(e){var n;let r={};r.errorCollection=new Nn("InputFieldDeclaration");try{let i=!1,a="";r.fullDeclaration=e;let o=sr.getInBetween(e,this.squareBracesPair);if(Array.isArray(o))if(o.length===2)i=!0,a=o[0],r.declaration=o[1];else throw new or("CRITICAL","failed to parse input field declaration","expected number of square bracket pairs to be two",{fullDeclaration:e,contentInSquareBraces:o});else r.declaration=o;let c=r.declaration?sr.split(r.declaration,":",this.squareBracesPair):[""];r.bindTarget=(n=c[1])!=null?n:"",r.isBound=li(r.bindTarget);let u=c[0];if(u){let s=sr.removeInBetween(u,this.roundBracesPair);r.inputFieldType=this.getInputFieldType(s);let l=sr.getInBetween(u,this.roundBracesPair);l?r.argumentContainer=this.parseArgumentString(r.inputFieldType,l,r.errorCollection):r.argumentContainer=new ja}else r.inputFieldType="invalid",r.argumentContainer=new ja;if(i&&this.applyTemplate(r,a),r.inputFieldType==="invalid")throw new or("CRITICAL","failed to parse input field declaration",`unknown input field type "${r.inputFieldType}"`)}catch(i){r.errorCollection.add(i)}return r}parseTemplates(e){this.templates=[];let r=e?sr.split(e,`
`,this.squareBracesPair):[];r=r.map(n=>n.trim()).filter(n=>n.length>0);for(let n of r){let i=sr.split(n,"->",this.squareBracesPair);if(i=i.map(a=>a.trim()),i.length===1)throw new or("CRITICAL","failed to parse template declaration",'template must include one "->"');i.length===2&&this.templates.push({identifier:i[0],template:this.parseString(i[1])})}console.log("meta-bind | InputFieldDeclarationParser >> parsed templates",this.templates)}parseArgumentString(e,r,n){let i=sr.split(r,",",this.roundBracesPair);i=i.map(o=>o.trim());let a=[];for(let o of i){let c=this.extractInputFieldArgumentIdentifier(o),u=this.getInputFieldArgumentType(c),s=this.extractInputFieldArgumentValue(o);if(u==="invalid"){n.add(new or("WARNING","failed to parse input field arguments",`unknown input field argument "${c}"`));continue}a.push({type:u,value:s})}return this.parseArguments(e,a,n)}parseArguments(e,r,n){let i=new ja;if(r){for(let a of r){let o=Bu.createInputFieldArgument(a.type);if(!o.isAllowed(e)){n.add(new or("WARNING","failed to parse input field arguments",`argument "${a.type}" is only applicable to "${o.getAllowedInputFieldsAsString()}" input fields`));continue}if(o.requiresValue){if(!a.value){n.add(new or("WARNING","failed to parse input field arguments",`argument "${a.type}" requires a non empty value`));continue}o.parseValue(a.value)}i.add(o)}try{i.validate()}catch(a){n.add(a)}}return i}extractInputFieldArgumentIdentifier(e){return sr.removeInBetween(e,this.roundBracesPair)}extractInputFieldArgumentValue(e){return sr.getInBetween(e,this.roundBracesPair)}getInputFieldArgumentType(e){for(let r of Object.entries(Gr))if(r[1]===e)return r[1];return"invalid"}getInputFieldType(e){for(let r of Object.entries(sn))if(r[1]===e)return r[1];return"invalid"}applyTemplate(e,r){var i;if(!r)return;let n=(i=this.templates.find(a=>a.identifier===r))==null?void 0:i.template;if(!n)throw new or("CRITICAL","failed to apply template",`unknown template name "${r}"`);e.bindTarget=e.bindTarget||n.bindTarget,e.isBound=e.isBound||n.isBound,e.inputFieldType=(e.inputFieldType==="invalid"?n.inputFieldType:e.inputFieldType)||n.inputFieldType,e.argumentContainer=n.argumentContainer.mergeByOverride(e.argumentContainer)}getDefaultValue(e){let r="placeholder";if(e.inputFieldType==="toggle"){let n=e.argumentContainer.get("offValue");return n?n.value:!1}else if(e.inputFieldType==="slider"){let n=e.argumentContainer.get("minValue");return n?n.value:0}else{if(e.inputFieldType==="text")return r;if(e.inputFieldType==="text_area")return r;if(e.inputFieldType==="select"){let n=e.argumentContainer.get("option");return n?n.value:r}else if(e.inputFieldType==="multi_select"){let n=e.argumentContainer.get("option");return n?n.value:r}else{if(e.inputFieldType==="date")return"1970-01-01";if(e.inputFieldType==="time")return"00:00";if(e.inputFieldType==="date_picker")return"1970-01-01";if(e.inputFieldType==="number")return 0;if(e.inputFieldType==="suggester"){let n=e.argumentContainer.get("option");return n?n.value:r}else{if(e.inputFieldType==="editor")return r;if(e.inputFieldType==="imageSuggester")return r;if(e.inputFieldType==="progressBar"){let n=e.argumentContainer.get("minValue");return n?n.value:0}else if(e.inputFieldType==="inlineSelect"){let n=e.argumentContainer.get("option");return n?n.value:r}}}}return r}};var Ya=class extends Nr{constructor(r){var n,i,a,o;super(r);this.onValue=(i=(n=this.renderChild.getArgument("onValue"))==null?void 0:n.value)!=null?i:!0,this.offValue=(o=(a=this.renderChild.getArgument("offValue"))==null?void 0:a.value)!=null?o:!1}getValue(){if(!!this.toggleComponent)return this.mapValue(this.toggleComponent.getValue())}setValue(r){!this.toggleComponent||(r===this.onValue?this.toggleComponent.setValue(!0):r===this.offValue?this.toggleComponent.setValue(!1):(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at toggleInputField ${this.renderChild.uuid}`)),this.toggleComponent.setValue(!1)))}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return!1}getHtmlElement(){if(!this.toggleComponent)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.toggleComponent.toggleEl}render(r){console.debug(`meta-bind | ToggleInputField >> render ${this.renderChild.uuid}`);let n=new A1.ToggleComponent(r);n.setValue(this.renderChild.getInitialValue()),n.onChange(i=>this.onValueChange(this.mapValue(i))),this.toggleComponent=n}mapValue(r){return r?this.onValue:this.offValue}destroy(){}};var F1=require("obsidian");var Ja=class extends Nr{getValue(){if(!!this.textComponent)return this.textComponent.getValue()}setValue(r){!this.textComponent||(r!=null&&typeof r=="string"?this.textComponent.setValue(r):(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at textInputField ${this.renderChild.uuid}`)),this.textComponent.setValue("")))}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return""}getHtmlElement(){if(!this.textComponent)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.textComponent.inputEl}render(r){console.debug(`meta-bind | TextInputField >> render ${this.renderChild.uuid}`);let n=new F1.TextComponent(r);n.setValue(this.renderChild.getInitialValue()),n.onChange(this.onValueChange),this.textComponent=n}destroy(){}};var S1=require("obsidian");var Xa=class extends Nr{constructor(r){var n,i,a,o;super(r);this.minValue=(i=(n=r.getArgument("minValue"))==null?void 0:n.value)!=null?i:0,this.maxValue=(o=(a=r.getArgument("maxValue"))==null?void 0:a.value)!=null?o:100}getValue(){if(!!this.sliderComponent)return this.sliderComponent.getValue()}setValue(r){!this.sliderComponent||(r!=null&&typeof r=="number"?r>=this.minValue&&r<=this.maxValue&&this.sliderComponent.setValue(r):(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at sliderInputField ${this.renderChild.uuid}`)),this.sliderComponent.setValue(this.getDefaultValue())))}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return this.minValue}getHtmlElement(){if(!this.sliderComponent)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.sliderComponent.sliderEl}render(r){console.debug(`meta-bind | SliderInputField >> render ${this.renderChild.uuid}`),r.removeClass("meta-bind-plugin-input-wrapper"),r.addClass("meta-bind-plugin-flex-input-wrapper");let n=this.renderChild.getArgument("addLabels");n&&n.value===!0&&r.createSpan({text:this.minValue.toString(),cls:"meta-bind-plugin-slider-input-label"});let i=new S1.SliderComponent(r);i.setLimits(this.minValue,this.maxValue,1),i.setValue(this.renderChild.getInitialValue()),i.onChange(this.onValueChange),i.setDynamicTooltip(),i.sliderEl.addClass("meta-bind-plugin-slider-input"),n&&n.value===!0&&r.createSpan({text:this.maxValue.toString(),cls:"meta-bind-plugin-slider-input-label"}),this.sliderComponent=i}destroy(){}};var M1=require("obsidian");var Qa=class extends Nr{getValue(){if(!!this.textAreaComponent)return this.textAreaComponent.getValue()}setValue(r){!this.textAreaComponent||(r!=null&&typeof r=="string"?this.textAreaComponent.setValue(r):(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at textAreaInputField ${this.renderChild.uuid}`)),this.textAreaComponent.setValue("")))}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return""}getHtmlElement(){if(!this.textAreaComponent)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.textAreaComponent.inputEl}render(r){console.debug(`meta-bind | TextAreaInputField >> render ${this.renderChild.uuid}`);let n=new M1.TextAreaComponent(r);n.setValue(this.renderChild.getInitialValue()),n.onChange(this.onValueChange),this.textAreaComponent=n}destroy(){}};var _u=class{constructor(e,r,n,i,a=!1){this.value=e,this.id=n,this.active=a,this.highlighted=!1,this.selectInputField=i,this.cssClass="meta-bind-plugin-select-input-element",this.activeClass="meta-bind-plugin-select-input-element-selected",this.hoverClass="meta-bind-plugin-select-input-element-hover",this.element=r.createDiv({cls:this.cssClass}),this.element.id=this.getHTMLId(),this.element.on("click","#"+this.getHTMLId(),()=>{this.selectInputField.allowMultiSelect||this.selectInputField.disableAllOtherElements(this.id),this.setActive(!this.active,!0)}),this.element.on("mouseenter","#"+this.getHTMLId(),()=>{this.setHighlighted(!0)}),this.element.on("mouseleave","#"+this.getHTMLId(),()=>{this.setHighlighted(!1)})}getHTMLId(){return`meta-bind-select-input-element-${this.selectInputField.renderChild.uuid}-${this.id}`}isHighlighted(){return this.highlighted}setHighlighted(e){this.highlighted=e,this.highlighted?(this.addClass(this.hoverClass),this.selectInputField.deHighlightAllOtherElements(this.id)):this.removeClass(this.hoverClass)}isActive(){return this.active}setActive(e,r=!0){this.active=e,this.update(r)}update(e){this.active?this.addClass(this.activeClass):this.removeClass(this.activeClass),e&&this.selectInputField.onChange()}addClass(e){this.element.hasClass(e)||this.element.addClass(e)}removeClass(e){this.element.hasClass(e)&&this.element.removeClass(e)}render(){this.element.createEl("div",{text:this.value})}};var Ni=class extends Nr{constructor(r){super(r);this.elements=[],this.allowMultiSelect=!1}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}getValue(){var r,n;if(!!this.container)return(n=(r=this.elements.filter(i=>i.isActive()).first())==null?void 0:r.value)!=null?n:""}setValue(r){for(let n of this.elements)r===n.value?n.setActive(!0,!1):n.setActive(!1,!1)}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return""}onChange(){this.onValueChange(this.getValue())}render(r){console.debug(`meta-bind | SelectInputField >> render ${this.renderChild.uuid}`),this.container=r;let n=this.renderChild.getArguments("option"),i=0;for(let a of n){let o=new _u(a.value,r,i,this,!1);this.elements.push(o),o.render(),i+=1}this.setValue(this.renderChild.getInitialValue())}destroy(){}disableAllOtherElements(r){for(let n of this.elements)n.id!==r&&n.setActive(!1,!1)}deHighlightAllOtherElements(r){for(let n of this.elements)n.id!==r&&n.setHighlighted(!1)}activateHighlighted(){for(let r of this.elements)r.isHighlighted()&&(r.setActive(!r.isActive()),this.allowMultiSelect||this.disableAllOtherElements(r.id))}highlightUp(){var r,n;for(let i of this.elements)if(i.isHighlighted()){(r=this.getPreviousSelectModalElement(i))==null||r.setHighlighted(!0);return}(n=this.elements.at(-1))==null||n.setHighlighted(!0)}highlightDown(){var r,n;for(let i of this.elements)if(i.isHighlighted()){(r=this.getNextSelectModalElement(i))==null||r.setHighlighted(!0);return}(n=this.elements.at(0))==null||n.setHighlighted(!0)}getNextSelectModalElement(r){let n=r.id+1;return n=Ga(n,this.elements.length),this.elements.filter(i=>i.id===n).at(0)}getPreviousSelectModalElement(r){let n=r.id-1;return n=Ga(n,this.elements.length),this.elements.filter(i=>i.id===n).at(0)}};Ni.allowInline=!1;var Ka=class extends Ni{constructor(e){super(e),this.allowMultiSelect=!0}getValue(){if(!!this.container)return this.elements.filter(e=>e.isActive()).map(e=>e.value)}setValue(e){if(!e||e.length===0){for(let r of this.elements)r.setActive(!1,!1);return}e:for(let r of this.elements){for(let n of e)if(n===r.value){r.setActive(!0,!1);continue e}r.setActive(!1,!1)}}isEqualValue(e){return Array.isArray(e)?E1(this.getValue(),e):!1}getDefaultValue(){return[]}};var da=require("obsidian");var of=require("obsidian"),Ar=class{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,of.moment)(e,Ar.dateFormat)}static getDefaultDate(){return(0,of.moment)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var eo=class extends Nr{constructor(r){super(r);this.months={0:"January",1:"February",2:"March",3:"April",4:"May",5:"June",6:"July",7:"August",8:"September",9:"October",10:"November",11:"December"};this.date=Ar.getDefaultDate(),this.days={};for(let n=1;n<=31;n++)this.days[n.toString()]=n.toString()}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}getValue(){if(!!this.monthComponent&&!!this.dayComponent&&!!this.yearComponent)return Ar.stringify(this.date)}setValue(r){!this.monthComponent||!this.dayComponent||!this.yearComponent||(this.date=Ar.parse(r),this.date||(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at dateInputField ${this.renderChild.uuid}`)),this.date=Ar.getDefaultDate()),this.date.isValid()||(this.date=Ar.getDefaultDate()),this.monthComponent.setValue(this.date.month().toString()),this.dayComponent.setValue(this.date.date().toString()),this.yearComponent.setValue(this.date.year().toString()))}isEqualValue(r){return r==this.getValue()}getDefaultValue(){return Ar.stringify(Ar.getDefaultDate())}render(r){var i;console.debug(`meta-bind | DateInputField >> render ${this.renderChild.uuid}`),this.date=(i=Ar.parse(this.renderChild.getInitialValue()))!=null?i:Ar.getDefaultDate(),this.date.isValid()||(this.date=Ar.getDefaultDate(),this.onValueChange(this.getValue()));let n=this.renderChild.plugin.settings.useUsDateInputOrder;r.removeClass("meta-bind-plugin-input-wrapper"),r.addClass("meta-bind-plugin-flex-input-wrapper","meta-bind-plugin-input-element-group"),n?(this.monthComponent=new da.DropdownComponent(r),this.monthComponent.addOptions(this.months),this.monthComponent.setValue(this.date.month().toString()),this.monthComponent.onChange(this.onMonthChange.bind(this)),this.dayComponent=new da.DropdownComponent(r),this.dayComponent.addOptions(this.days),this.dayComponent.setValue(this.date.date().toString()),this.dayComponent.onChange(this.onDayChange.bind(this)),this.dayComponent.selectEl.addClass("meta-bind-plugin-input-element-group-element"),this.monthComponent.selectEl.addClass("meta-bind-plugin-input-element-group-element")):(this.dayComponent=new da.DropdownComponent(r),this.dayComponent.addOptions(this.days),this.dayComponent.setValue(this.date.date().toString()),this.dayComponent.onChange(this.onDayChange.bind(this)),this.monthComponent=new da.DropdownComponent(r),this.monthComponent.addOptions(this.months),this.monthComponent.setValue(this.date.month().toString()),this.monthComponent.onChange(this.onMonthChange.bind(this)),this.dayComponent.selectEl.addClass("meta-bind-plugin-input-element-group-element"),this.monthComponent.selectEl.addClass("meta-bind-plugin-input-element-group-element")),this.yearComponent=new da.TextComponent(r),this.yearComponent.setValue(this.date.year().toString()),this.yearComponent.onChange(this.onYearChange.bind(this)),this.yearComponent.inputEl.addClass("meta-bind-plugin-date-input-year-input"),this.yearComponent.inputEl.addClass("meta-bind-plugin-input-element-group-element"),this.yearComponent.inputEl.type="number",this.yearComponent.inputEl.max="9999",this.container=r}destroy(){}onMonthChange(r){var i;this.date.month(r);let n=this.clampDay(this.date.date());(i=this.dayComponent)==null||i.setValue(n.toString()),this.date.date(n),this.onValueChange(this.getValue())}onDayChange(r){var a;let n=Number.parseInt(r),i=this.clampDay(n);i!==n&&((a=this.dayComponent)==null||a.setValue(i.toString())),this.date.date(i),this.onValueChange(this.getValue())}onYearChange(r){let n=Number.parseInt(r);this.date.year(Number.isNaN(n)?Ar.getDefaultYear():n),this.onValueChange(this.getValue())}clampDay(r){return Number.isNaN(r)?Ar.getDefaultDay():r<1?1:r>this.date.daysInMonth()?this.date.daysInMonth():r}};var uf=require("obsidian");var sf=class{constructor(){this._hour=Et.getDefaultHour(),this._minute=Et.getDefaultHour()}getHour(){return this._hour}setHour(e){if(e<0||e>24){this._hour=Et.getDefaultHour();return}this._hour=e}getMinute(){return this._minute}setMinute(e){if(e<0||e>59){this._minute=Et.getDefaultMinute();return}this._minute=e}getUniformHour(){return("00"+this.getHour().toString()).slice(-2)}getUniformMinute(){return("00"+this.getMinute().toString()).slice(-2)}setHourFromString(e){let r=Number.parseInt(e);this.setHour(Number.isNaN(r)?Et.getDefaultHour():r)}setMinuteFromString(e){let r=Number.parseInt(e);this.setMinute(Number.isNaN(r)?Et.getDefaultMinute():r)}},Et=class{static parse(e){let r=Et.getDefaultTime(),n=e.split(":");if(n.length===2)return r.setHourFromString(n[0]),r.setMinuteFromString(n[1]),r}static stringify(e){return`${e.getUniformHour()}:${e.getUniformMinute()}`}static getDefaultTime(){return new sf}static getDefaultHour(){return 0}static getDefaultMinute(){return 0}};var ro=class extends Nr{constructor(r){super(r);this.time=Et.getDefaultTime(),this.hours={};for(let n=0;n<=24;n++)this.hours[n.toString()]=n.toString();this.minutes={};for(let n=0;n<=59;n++)this.minutes[n.toString()]=n.toString()}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}getValue(){if(!!this.hourComponent&&!!this.minuteComponent)return Et.stringify(this.time)}setValue(r){!this.hourComponent||!this.minuteComponent||(this.time=Et.parse(r),this.time||(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at timeInputField ${this.renderChild.uuid}`)),this.time=Et.getDefaultTime()),this.hourComponent.setValue(this.time.getHour().toString()),this.minuteComponent.setValue(this.time.getMinute().toString()))}isEqualValue(r){return r==this.getValue()}getDefaultValue(){return Et.stringify(Et.getDefaultTime())}render(r){var n;console.debug(`meta-bind | TimeInputField >> render ${this.renderChild.uuid}`),this.time=(n=Et.parse(this.renderChild.getInitialValue()))!=null?n:Et.getDefaultTime(),r.removeClass("meta-bind-plugin-input-wrapper"),r.addClass("meta-bind-plugin-flex-input-wrapper","meta-bind-plugin-input-element-group"),this.hourComponent=new uf.DropdownComponent(r),this.hourComponent.addOptions(this.hours),this.hourComponent.setValue(this.time.getHour().toString()),this.hourComponent.onChange(this.onHourChange.bind(this)),this.minuteComponent=new uf.DropdownComponent(r),this.minuteComponent.addOptions(this.minutes),this.minuteComponent.setValue(this.time.getMinute().toString()),this.minuteComponent.onChange(this.onMinuteChange.bind(this)),this.hourComponent.selectEl.addClass("meta-bind-plugin-input-element-group-element"),this.minuteComponent.selectEl.addClass("meta-bind-plugin-input-element-group-element"),this.container=r}destroy(){}onHourChange(r){var n;(n=this.time)==null||n.setHourFromString(r),this.onValueChange(this.getValue())}onMinuteChange(r){var n;(n=this.time)==null||n.setMinuteFromString(r),this.onValueChange(this.getValue())}};function ur(){}function pf(t){return t()}function T1(){return Object.create(null)}function ht(t){t.forEach(pf)}function Lu(t){return typeof t=="function"}function $r(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}var Ru;function ao(t,e){return Ru||(Ru=document.createElement("a")),Ru.href=e,t===Ru.href}function O1(t){return Object.keys(t).length===0}var B1=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global,ls=class{constructor(e){this.options=e,this._listeners="WeakMap"in B1?new WeakMap:void 0}observe(e,r){return this._listeners.set(e,r),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!==null&&e!==void 0?e:this._observer=new ResizeObserver(r=>{var n;for(let i of r)ls.entries.set(i.target,i),(n=this._listeners.get(i.target))===null||n===void 0||n(i)})}};ls.entries="WeakMap"in B1?new WeakMap:void 0;var I1=!1;function Z_(){I1=!0}function j_(){I1=!1}function Se(t,e){t.appendChild(e)}function Dt(t,e,r){let n=Y_(t);if(!n.getElementById(e)){let i=Re("style");i.id=e,i.textContent=r,J_(n,i)}}function Y_(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function J_(t,e){return Se(t.head||t,e),e.sheet}function Je(t,e,r){t.insertBefore(e,r||null)}function Ze(t){t.parentNode&&t.parentNode.removeChild(t)}function va(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}function Re(t){return document.createElement(t)}function un(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Hr(t){return document.createTextNode(t)}function Fr(){return Hr(" ")}function ci(){return Hr("")}function gr(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function ce(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function X_(t){return Array.from(t.childNodes)}function at(t,e){e=""+e,t.data!==e&&(t.data=e)}function df(t,e){t.value=e==null?"":e}function ga(t,e,r){t.classList[r?"add":"remove"](e)}function Q_(t,e,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(t,r,n,e),i}var cs;function us(t){cs=t}function _1(){if(!cs)throw new Error("Function called outside component initialization");return cs}function fs(t){_1().$$.on_mount.push(t)}function ms(){let t=_1();return(e,r,{cancelable:n=!1}={})=>{let i=t.$$.callbacks[e];if(i){let a=Q_(e,r,{cancelable:n});return i.slice().forEach(o=>{o.call(t,a)}),!a.defaultPrevented}return!0}}var no=[];var Vn=[],io=[],cf=[],K_=Promise.resolve(),ff=!1;function e8(){ff||(ff=!0,K_.then(P1))}function mf(t){io.push(t)}function R1(t){cf.push(t)}var lf=new Set,to=0;function P1(){if(to!==0)return;let t=cs;do{try{for(;to<no.length;){let e=no[to];to++,us(e),r8(e.$$)}}catch(e){throw no.length=0,to=0,e}for(us(null),no.length=0,to=0;Vn.length;)Vn.pop()();for(let e=0;e<io.length;e+=1){let r=io[e];lf.has(r)||(lf.add(r),r())}io.length=0}while(no.length);for(;cf.length;)cf.pop()();ff=!1,lf.clear(),us(t)}function r8(t){if(t.fragment!==null){t.update(),ht(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(mf)}}function t8(t){let e=[],r=[];io.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),io=e}var Pu=new Set,ha;function ku(){ha={r:0,c:[],p:ha}}function qu(){ha.r||ht(ha.c),ha=ha.p}function zt(t,e){t&&t.i&&(Pu.delete(t),t.i(e))}function ln(t,e,r,n){if(t&&t.o){if(Pu.has(t))return;Pu.add(t),ha.c.push(()=>{Pu.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function L1(t,e){t.d(1),e.delete(t.key)}function k1(t,e,r,n,i,a,o,c,u,s,l,f){let m=t.length,p=a.length,h=m,d={};for(;h--;)d[t[h].key]=h;let g=[],D=new Map,N=new Map,v=[];for(h=p;h--;){let E=f(i,a,h),F=r(E),S=o.get(F);S?n&&v.push(()=>S.p(E,e)):(S=s(F,E),S.c()),D.set(F,g[h]=S),F in d&&N.set(F,Math.abs(h-d[F]))}let w=new Set,b=new Set;function y(E){zt(E,1),E.m(c,l),o.set(E.key,E),l=E.first,p--}for(;m&&p;){let E=g[p-1],F=t[m-1],S=E.key,C=F.key;E===F?(l=E.first,m--,p--):D.has(C)?!o.has(S)||w.has(S)?y(E):b.has(C)?m--:N.get(S)>N.get(C)?(b.add(S),y(E)):(w.add(C),m--):(u(F,o),m--)}for(;m--;){let E=t[m];D.has(E.key)||u(E,o)}for(;p;)y(g[p-1]);return ht(v),g}var n8=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Y$=new Set([...n8]);function q1(t,e,r){let n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function Ai(t){t&&t.c()}function fi(t,e,r,n){let{fragment:i,after_update:a}=t.$$;i&&i.m(e,r),n||mf(()=>{let o=t.$$.on_mount.map(pf).filter(Lu);t.$$.on_destroy?t.$$.on_destroy.push(...o):ht(o),t.$$.on_mount=[]}),a.forEach(mf)}function $n(t,e){let r=t.$$;r.fragment!==null&&(t8(r.after_update),ht(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function i8(t,e){t.$$.dirty[0]===-1&&(no.push(t),e8(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Wr(t,e,r,n,i,a,o,c=[-1]){let u=cs;us(t);let s=t.$$={fragment:null,ctx:[],props:a,update:ur,not_equal:i,bound:T1(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:T1(),dirty:c,skip_bound:!1,root:e.target||u.$$.root};o&&o(s.root);let l=!1;if(s.ctx=r?r(t,e.props||{},(f,m,...p)=>{let h=p.length?p[0]:m;return s.ctx&&i(s.ctx[f],s.ctx[f]=h)&&(!s.skip_bound&&s.bound[f]&&s.bound[f](h),l&&i8(t,f)),m}):[],s.update(),l=!0,ht(s.before_update),s.fragment=n?n(s.ctx):!1,e.target){if(e.hydrate){Z_();let f=X_(e.target);s.fragment&&s.fragment.l(f),f.forEach(Ze)}else s.fragment&&s.fragment.c();e.intro&&zt(t.$$.fragment),fi(t,e.target,e.anchor,e.customElement),j_(),P1()}us(u)}var a8;typeof HTMLElement=="function"&&(a8=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(pf).filter(Lu);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(t,e,r){this[t]=r}disconnectedCallback(){ht(this.$$.on_disconnect)}$destroy(){$n(this,1),this.$destroy=ur}$on(t,e){if(!Lu(e))return ur;let r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(e),()=>{let n=r.indexOf(e);n!==-1&&r.splice(n,1)}}$set(t){this.$$set&&!O1(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var _r=class{$destroy(){$n(this,1),this.$destroy=ur}$on(e,r){if(!Lu(r))return ur;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{let i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!O1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var V1=require("obsidian");var U1=require("obsidian");function o8(t){Dt(t,"svelte-1elx65w",".icon-wrapper.svelte-1elx65w{display:inline-block;position:relative;width:18px;height:18px}")}function z1(t){let e;return{c(){e=Re("div"),ce(e,"class","icon-wrapper svelte-1elx65w")},m(r,n){Je(r,e,n),t[2](e)},p:ur,d(r){r&&Ze(e),t[2](null)}}}function s8(t){let e,r=t[0].length>0&&z1(t);return{c(){r&&r.c(),e=ci()},m(n,i){r&&r.m(n,i),Je(n,e,i)},p(n,[i]){n[0].length>0?r?r.p(n,i):(r=z1(n),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},i:ur,o:ur,d(n){r&&r.d(n),n&&Ze(e)}}}function u8(t,e,r){let{iconName:n=""}=e,i;fs(()=>{(0,U1.setIcon)(i,n)});function a(o){Vn[o?"unshift":"push"](()=>{i=o,r(1,i)})}return t.$$set=o=>{"iconName"in o&&r(0,n=o.iconName)},[n,i,a]}var hf=class extends _r{constructor(e){super(),Wr(this,e,u8,s8,$r,{iconName:0},o8)}},zu=hf;function l8(t){Dt(t,"svelte-1urcwq2",".date-picker-input.svelte-1urcwq2{background:var(--background-secondary);border-radius:var(--meta-bind-plugin-border-radius);border:var(--meta-bind-plugin-border-width) solid var(--background-modifier-border);padding:5px 5px 5px 7px;cursor:pointer;position:relative;color:var(--text-normal);display:inline-flex;align-items:center;gap:5px}.date-picker-text.svelte-1urcwq2{display:inline-block}")}function c8(t){let e,r,n,i=t[0].format(t[1])+"",a,o,c,u,s,l;return c=new zu({props:{iconName:"calendar"}}),{c(){e=Re("div"),r=Re("div"),n=Re("span"),a=Hr(i),o=Fr(),Ai(c.$$.fragment),ce(r,"class","date-picker-text svelte-1urcwq2"),ce(e,"class","date-picker-input svelte-1urcwq2")},m(f,m){Je(f,e,m),Se(e,r),Se(r,n),Se(n,a),Se(e,o),fi(c,e,null),u=!0,s||(l=[gr(e,"click",t[2]),gr(e,"keydown",t[3])],s=!0)},p(f,[m]){(!u||m&3)&&i!==(i=f[0].format(f[1])+"")&&at(a,i)},i(f){u||(zt(c.$$.fragment,f),u=!0)},o(f){ln(c.$$.fragment,f),u=!1},d(f){f&&Ze(e),$n(c),s=!1,ht(l)}}}function f8(t,e,r){let{showDatePicker:n}=e,{selectedDate:i=(0,V1.moment)()}=e,{dateFormat:a="dddd, MMMM Do YYYY"}=e;function o(s){r(0,i=s)}function c(s){n()}function u(s){s.key===" "&&n()}return t.$$set=s=>{"showDatePicker"in s&&r(4,n=s.showDatePicker),"selectedDate"in s&&r(0,i=s.selectedDate),"dateFormat"in s&&r(1,a=s.dateFormat)},[i,a,c,u,n,o]}var vf=class extends _r{constructor(e){super(),Wr(this,e,f8,c8,$r,{showDatePicker:4,selectedDate:0,dateFormat:1,updateValue:5},l8)}get updateValue(){return this.$$.ctx[5]}},$1=vf;var H1=require("obsidian");var gf=ma[1];function yf(t){gf=t}function xf(t){return x1[t]}function W1(t,e){let r=(0,H1.moment)(new Date(e,t)).daysInMonth(),n=new Array(42).fill(void 0),i=m8(new Date(e,t,1));for(let a=0;a<r;a++)n[a+i]=a+1;return n=n[n.length-7]?n:n.slice(0,-7),n=n[n.length-7]?n:n.slice(0,-7),n}function m8(t){return Ga(t.getDay()-gf.index,7)}function Df(){return ma.map(e=>({index:Ga(e.index-gf.index,7),name:e.name,shortName:e.shortName})).sort((e,r)=>e.index-r.index).map(e=>e.shortName)}function G1(){let t=0;return()=>++t}var X1=require("obsidian");function p8(t){Dt(t,"svelte-1ouugmg",".calendar.svelte-1ouugmg{margin-top:10px}.calendar-header.svelte-1ouugmg{display:flex;justify-content:space-around;flex-wrap:wrap;gap:var(--size-4-1);background:var(--background-secondary);border-radius:var(--meta-bind-plugin-border-radius);margin-bottom:var(--size-4-1);;}.calendar-content.svelte-1ouugmg{display:grid;flex-wrap:wrap;grid-template-columns:repeat(7, 1fr);gap:var(--size-4-1)}.cell.svelte-1ouugmg{min-width:40px;padding:var(--size-4-2);display:flex;justify-content:center;align-items:center;border-radius:var(--meta-bind-plugin-border-radius)}.content-cell.svelte-1ouugmg{cursor:pointer}.cell-text.svelte-1ouugmg{margin:auto;text-align:center}.selected.svelte-1ouugmg{background:var(--interactive-accent)}.highlight.svelte-1ouugmg:hover{background:var(--interactive-hover)}.selected.highlight.svelte-1ouugmg:hover{background:var(--interactive-accent-hover)}")}function Z1(t,e,r){let n=t.slice();return n[10]=e[r],n}function j1(t,e,r){let n=t.slice();return n[13]=e[r],n}function Y1(t){let e,r,n=t[13]+"",i,a;return{c(){e=Re("div"),r=Re("span"),i=Hr(n),a=Fr(),ce(r,"class","cell-text svelte-1ouugmg"),ce(e,"class","cell header-cell svelte-1ouugmg")},m(o,c){Je(o,e,c),Se(e,r),Se(r,i),Se(e,a)},p:ur,d(o){o&&Ze(e)}}}function J1(t,e){let r,n,i=(e[10]||"")+"",a,o,c,u;function s(){return e[6](e[10])}function l(...f){return e[7](e[10],...f)}return{key:t,first:null,c(){r=Re("div"),n=Re("span"),a=Hr(i),o=Fr(),ce(n,"class","cell-text svelte-1ouugmg"),ce(r,"class","cell svelte-1ouugmg"),ga(r,"highlight",e[10]),ga(r,"content-cell",e[10]),ga(r,"selected",e[0].year()===e[2]&&e[0].month()===e[1]&&e[0].date()===e[10]),this.first=r},m(f,m){Je(f,r,m),Se(r,n),Se(n,a),Se(r,o),c||(u=[gr(r,"click",s),gr(r,"keydown",l)],c=!0)},p(f,m){e=f,m&8&&i!==(i=(e[10]||"")+"")&&at(a,i),m&8&&ga(r,"highlight",e[10]),m&8&&ga(r,"content-cell",e[10]),m&15&&ga(r,"selected",e[0].year()===e[2]&&e[0].month()===e[1]&&e[0].date()===e[10])},d(f){f&&Ze(r),c=!1,ht(u)}}}function d8(t){let e,r,n,i,a=[],o=new Map,c=Df(),u=[];for(let f=0;f<c.length;f+=1)u[f]=Y1(j1(t,c,f));let s=t[3],l=f=>G1();for(let f=0;f<s.length;f+=1){let m=Z1(t,s,f),p=l(m);o.set(p,a[f]=J1(p,m))}return{c(){e=Re("div"),r=Re("div");for(let f=0;f<u.length;f+=1)u[f].c();n=Fr(),i=Re("div");for(let f=0;f<a.length;f+=1)a[f].c();ce(r,"class","calendar-header svelte-1ouugmg"),ce(i,"class","calendar-content svelte-1ouugmg"),ce(e,"class","calendar svelte-1ouugmg")},m(f,m){Je(f,e,m),Se(e,r);for(let p=0;p<u.length;p+=1)u[p]&&u[p].m(r,null);Se(e,n),Se(e,i);for(let p=0;p<a.length;p+=1)a[p]&&a[p].m(i,null)},p(f,[m]){if(m&0){c=Df();let p;for(p=0;p<c.length;p+=1){let h=j1(f,c,p);u[p]?u[p].p(h,m):(u[p]=Y1(h),u[p].c(),u[p].m(r,null))}for(;p<u.length;p+=1)u[p].d(1);u.length=c.length}m&63&&(s=f[3],a=k1(a,m,l,1,f,s,o,i,L1,J1,null,Z1))},i:ur,o:ur,d(f){f&&Ze(e),va(u,f);for(let m=0;m<a.length;m+=1)a[m].d()}}}function h8(t,e,r){let n=ms(),{selectedDate:i}=e,{month:a}=e,{year:o}=e,c;function u(p){n("dateChange",(0,X1.moment)(new Date(o,a,p)))}function s(p){p&&u(p)}function l(p,h){p.key===" "&&s(h)}let f=p=>s(p),m=(p,h)=>l(h,p);return t.$$set=p=>{"selectedDate"in p&&r(0,i=p.selectedDate),"month"in p&&r(1,a=p.month),"year"in p&&r(2,o=p.year)},t.$$.update=()=>{if(t.$$.dirty&6){e:r(3,c=W1(a,o))}},[i,a,o,c,s,l,f,m]}var bf=class extends _r{constructor(e){super(),Wr(this,e,h8,d8,$r,{selectedDate:0,month:1,year:2},p8)}},Q1=bf;var K1=require("obsidian");function v8(t){Dt(t,"svelte-1nlxj7b",".date-picker.svelte-1nlxj7b{display:block;padding:var(--size-4-4)}.date-picker-header.svelte-1nlxj7b{display:flex;gap:var(--size-4-2);align-items:center;justify-content:space-around}.date-picker-header-text.svelte-1nlxj7b{flex:1;text-align:center;display:flex;gap:var(--size-4-2);align-items:center;justify-content:center;width:min-content}.date-picker-header-text-year.svelte-1nlxj7b{width:60px;padding:var(--size-4-2)}.date-picker-header-text-month.svelte-1nlxj7b{height:min-content}.month-switch-button.svelte-1nlxj7b{margin:0}")}function g8(t){let e,r,n,i,a,o,c=xf(t[1])+"",u,s,l,f,m,p,h,d,g,D,N;return d=new Q1({props:{month:t[1],year:t[2],selectedDate:t[0]}}),d.$on("dateChange",t[6]),{c(){e=Re("div"),r=Re("div"),n=Re("button"),n.textContent="Prev",i=Fr(),a=Re("div"),o=Re("span"),u=Hr(c),s=Fr(),l=Re("input"),m=Fr(),p=Re("button"),p.textContent="Next",h=Fr(),Ai(d.$$.fragment),ce(n,"class","month-switch-button svelte-1nlxj7b"),ce(o,"class","date-picker-header-text-month svelte-1nlxj7b"),ce(l,"class","date-picker-header-text-year svelte-1nlxj7b"),ce(l,"type","number"),l.value=f=t[2].toString(),ce(a,"class","date-picker-header-text svelte-1nlxj7b"),ce(p,"class","month-switch-button svelte-1nlxj7b"),ce(r,"class","date-picker-header svelte-1nlxj7b"),ce(e,"class","date-picker svelte-1nlxj7b")},m(v,w){Je(v,e,w),Se(e,r),Se(r,n),Se(r,i),Se(r,a),Se(a,o),Se(o,u),Se(a,s),Se(a,l),Se(r,m),Se(r,p),Se(e,h),fi(d,e,null),g=!0,D||(N=[gr(n,"click",t[4]),gr(l,"input",t[5]),gr(p,"click",t[3])],D=!0)},p(v,[w]){(!g||w&2)&&c!==(c=xf(v[1])+"")&&at(u,c),(!g||w&4&&f!==(f=v[2].toString())&&l.value!==f)&&(l.value=f);let b={};w&2&&(b.month=v[1]),w&4&&(b.year=v[2]),w&1&&(b.selectedDate=v[0]),d.$set(b)},i(v){g||(zt(d.$$.fragment,v),g=!0)},o(v){ln(d.$$.fragment,v),g=!1},d(v){v&&Ze(e),$n(d),D=!1,ht(N)}}}function y8(t,e,r){let n=ms(),{selectedDate:i=(0,K1.moment)()}=e,{dateChangeCallback:a}=e,o,c,u,s;function l(){if(c===11){r(1,c=0),r(2,u+=1);return}r(1,c=c+1)}function f(){if(c===0){r(1,c=11),r(2,u-=1);return}r(1,c-=1)}function m(h){let d=h.target.value,g=Number.parseInt(d);Number.isNaN(g)||r(2,u=g)}function p(h){s=!1,r(0,i=h.detail),a(h.detail)}return t.$$set=h=>{"selectedDate"in h&&r(0,i=h.selectedDate),"dateChangeCallback"in h&&r(7,a=h.dateChangeCallback)},t.$$.update=()=>{if(t.$$.dirty&1){e:console.log("update date picker",i),o=i.date(),r(1,c=i.month()),r(2,u=i.year())}},[i,c,u,l,f,m,p,a]}var wf=class extends _r{constructor(e){super(),Wr(this,e,y8,g8,$r,{selectedDate:0,dateChangeCallback:7},v8)}},eD=wf;var rD=require("obsidian"),Uu=class extends rD.Modal{constructor(r,n){super(r);this.opener=n}onOpen(){let{contentEl:r}=this;new eD({target:r,props:{selectedDate:this.opener.date,dateChangeCallback:n=>this.opener.datePickerValueChanged(n)}})}};var oo=class extends Nr{constructor(r){super(r);this.date=Ar.getDefaultDate()}getValue(){if(!!this.component)return Ar.stringify(this.date)}setValue(r){var n,i;this.date=(n=Ar.parse(r))!=null?n:Ar.getDefaultDate(),this.date.isValid()||(this.date=Ar.getDefaultDate(),this.onValueChange(this.getValue())),(i=this.component)==null||i.$set({selectedDate:this.date})}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return Ar.stringify(Ar.getDefaultDate())}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}datePickerValueChanged(r){var n,i;this.date=r,(n=this.component)==null||n.updateValue(this.date),(i=this.modal)==null||i.close(),this.date.isValid()&&this.onValueChange(this.getValue())}showDatePicker(){this.modal=new Uu(this.renderChild.plugin.app,this),this.modal.open()}render(r){var n;console.debug(`meta-bind | DatePickerInputField >> render ${this.renderChild.uuid}`),this.container=r,this.date=(n=Ar.parse(this.renderChild.getInitialValue()))!=null?n:Ar.getDefaultDate(),this.date.isValid()||(this.date=Ar.getDefaultDate(),this.onValueChange(this.getValue())),this.component=new $1({target:r,props:{dateFormat:this.renderChild.plugin.settings.preferredDateFormat,showDatePicker:()=>this.showDatePicker(),selectedDate:this.date}})}destroy(){var r;(r=this.component)==null||r.$destroy()}};var tD=require("obsidian");var so=class extends Nr{getValue(){if(!this.numberComponent)return;let r=parseFloat(this.numberComponent.getValue());return isNaN(r)?0:r}setValue(r){!this.numberComponent||(r!=null&&(typeof r=="number"||typeof r=="string")?this.numberComponent.setValue(af(r)):(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at numberInputField ${this.renderChild.uuid}`)),this.numberComponent.setValue(this.getDefaultValue())))}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return 0}getHtmlElement(){if(!this.numberComponent)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.numberComponent.inputEl}render(r){console.debug(`meta-bind | NumberInputField >> render ${this.renderChild.uuid}`);let n=new tD.TextComponent(r);n.inputEl.type="number",n.setValue(af(this.renderChild.getInitialValue())),n.onChange(i=>{let a=parseFloat(i);this.onValueChange(isNaN(a)?0:a)}),this.numberComponent=n}destroy(){}};function nD(t){if(!t)throw new or("ERROR","failed to parse md link","invalid link, link is empty");let e={};e.isEmbed=t.startsWith("!");let r=sr.getInBetween(t,new Cn("[[","]]"));if(!r)throw new or("ERROR","failed to parse md link","invalid link, link is empty");if(typeof r!="string")throw new or("ERROR","failed to parse md link","invalid link, link format is invalid");let n=r.split("|");if(n.length===2)e.alias=n[1];else if(n.length>2)throw new or("ERROR","failed to parse md link","invalid link, link may only contain a maximum of one '|'");let i=n[0].split("#");if(i.length===1)e.target=i[0];else if(i.length===2)e.target=i[0],e.block=i[1];else throw new or("ERROR","failed to parse md link","invalid link, link target may only contain a maximum of one '#'");return e}function iD(t){return(t.startsWith("![[")||t.startsWith("[["))&&t.endsWith("]]")}function x8(t){let e,r=t[1]()+"",n,i,a;return{c(){e=Re("a"),n=Hr(r),ce(e,"data-href",i=t[1]()),ce(e,"href",a=t[1]()),ce(e,"class","internal-link"),ce(e,"target","_blank"),ce(e,"rel","noopener")},m(o,c){Je(o,e,c),Se(e,n)},p:ur,d(o){o&&Ze(e)}}}function D8(t){let e,r=t[0].alias+"",n,i,a,o;return{c(){e=Re("a"),n=Hr(r),ce(e,"data-href",i=t[1]()),ce(e,"href",a=t[1]()),ce(e,"class","internal-link"),ce(e,"target","_blank"),ce(e,"rel","noopener"),ce(e,"aria-label",o=t[1]()),ce(e,"aria-label-position","top")},m(c,u){Je(c,e,u),Se(e,n)},p(c,u){u&1&&r!==(r=c[0].alias+"")&&at(n,r)},d(c){c&&Ze(e)}}}function b8(t){let e;function r(a,o){return a[0].alias?D8:x8}let n=r(t,-1),i=n(t);return{c(){i.c(),e=ci()},m(a,o){i.m(a,o),Je(a,e,o)},p(a,[o]){n===(n=r(a,o))&&i?i.p(a,o):(i.d(1),i=n(a),i&&(i.c(),i.m(e.parentNode,e)))},i:ur,o:ur,d(a){i.d(a),a&&Ze(e)}}}function w8(t,e,r){let{mdLink:n}=e;function i(){return n.block?`${n.target}#${n.block}`:n.target}return t.$$set=a=>{"mdLink"in a&&r(0,n=a.mdLink)},[n,i]}var Ef=class extends _r{constructor(e){super(),Wr(this,e,w8,b8,$r,{mdLink:0})}},aD=Ef;function E8(t){Dt(t,"svelte-1r8vm9q",".suggest-input.svelte-1r8vm9q{background:var(--background-secondary);border-radius:var(--meta-bind-plugin-border-radius);border:var(--meta-bind-plugin-border-width) solid var(--background-modifier-border);padding:5px 5px 5px 7px;cursor:pointer;position:relative;color:var(--text-normal);display:inline-flex;align-items:center;gap:5px}.suggest-text.svelte-1r8vm9q{display:inline-block}")}function C8(t){let e,r;return{c(){e=Re("span"),r=Hr(t[1])},m(n,i){Je(n,e,i),Se(e,r)},p(n,i){i&2&&at(r,n[1])},i:ur,o:ur,d(n){n&&Ze(e)}}}function N8(t){let e,r,n;function i(o){t[7](o)}let a={};return t[0]!==void 0&&(a.mdLink=t[0]),e=new aD({props:a}),Vn.push(()=>q1(e,"mdLink",i)),{c(){Ai(e.$$.fragment)},m(o,c){fi(e,o,c),n=!0},p(o,c){let u={};!r&&c&1&&(r=!0,u.mdLink=o[0],R1(()=>r=!1)),e.$set(u)},i(o){n||(zt(e.$$.fragment,o),n=!0)},o(o){ln(e.$$.fragment,o),n=!1},d(o){$n(e,o)}}}function A8(t){let e,r,n,i,a,o,c,u,s,l=[N8,C8],f=[];function m(p,h){return p[2]?0:1}return n=m(t,-1),i=f[n]=l[n](t),o=new zu({props:{iconName:"list"}}),{c(){e=Re("div"),r=Re("div"),i.c(),a=Fr(),Ai(o.$$.fragment),ce(r,"class","suggest-text svelte-1r8vm9q"),ce(e,"class","suggest-input svelte-1r8vm9q")},m(p,h){Je(p,e,h),Se(e,r),f[n].m(r,null),Se(e,a),fi(o,e,null),c=!0,u||(s=[gr(e,"click",t[3]),gr(e,"keydown",t[4])],u=!0)},p(p,[h]){let d=n;n=m(p,h),n===d?f[n].p(p,h):(ku(),ln(f[d],1,1,()=>{f[d]=null}),qu(),i=f[n],i?i.p(p,h):(i=f[n]=l[n](p),i.c()),zt(i,1),i.m(r,null))},i(p){c||(zt(i),zt(o.$$.fragment,p),c=!0)},o(p){ln(i),ln(o.$$.fragment,p),c=!1},d(p){p&&Ze(e),f[n].d(),$n(o),u=!1,ht(s)}}}function F8(t,e,r){let{showSuggest:n}=e,i,a,o=!1;function c(f){if(r(2,o=iD(f)),o)try{r(0,i=nD(f))}catch(m){console.warn(m)}else r(1,a=f)}function u(f){f.target instanceof HTMLAnchorElement||n()}function s(f){f.key===" "&&n()}function l(f){i=f,r(0,i)}return t.$$set=f=>{"showSuggest"in f&&r(5,n=f.showSuggest)},[i,a,o,u,s,n,c,l]}var Cf=class extends _r{constructor(e){super(),Wr(this,e,F8,A8,$r,{showSuggest:5,updateValue:6},E8)}get updateValue(){return this.$$.ctx[6]}},oD=Cf;var sm=Yt(om());var Rb=require("obsidian"),il=class extends Rb.FuzzySuggestModal{constructor(r,n,i){super(r);this.options=n,this.onSelect=i}getItemText(r){return r.displayValue}getItems(){return this.options}onChooseItem(r,n){this.onSelect(r)}};var Pb=require("obsidian");var xo=class extends Nr{constructor(r){super(r);if(this.value="",this.options=[],this.needsDataview()&&!(0,sm.getAPI)(this.renderChild.plugin.app))throw new Un("ERROR","can not create suggest input field","dataview needs to be installed and enabled to use suggest option queries")}getValue(){if(!!this.component)return this.value}setValue(r){var n;this.value=r,(n=this.component)==null||n.updateValue(r)}isEqualValue(r){return this.value==r}getDefaultValue(){return""}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}needsDataview(){return this.renderChild.getArguments("optionQuery").length>0}async getOptions(){this.options=[];let r=this.renderChild.getArguments("option"),n=this.renderChild.getArguments("optionQuery");for(let i of r)this.options.push({value:i.value,displayValue:i.value});if(n.length>0){let i=(0,sm.getAPI)(this.renderChild.plugin.app);if(!i){new Pb.Notice("meta-bind | dataview needs to be installed and enabled to use suggest option queries");return}for(let a of n)(await i.pages(a.value,this.renderChild.filePath)).forEach(c=>{try{let u=c.file;this.options.push({value:`[[${u.path}|${u.name}]]`,displayValue:`file: ${u.name}`})}catch(u){console.warn("meta-bind | error while computing suggest options",u)}})}}async showSuggest(){await this.getOptions(),new il(this.renderChild.plugin.app,this.options,r=>{this.setValue(r.value),this.onValueChange(r.value)}).open()}render(r){console.debug(`meta-bind | SuggestInputField >> render ${this.renderChild.uuid}`),this.container=r,this.value=this.renderChild.getInitialValue(),this.component=new oD({target:r,props:{showSuggest:()=>this.showSuggest()}}),this.component.updateValue(this.value)}destroy(){var r;(r=this.component)==null||r.$destroy()}};var Lb=require("obsidian");function _6(t){Dt(t,"svelte-1ycn1rm",".editor-input.svelte-1ycn1rm.svelte-1ycn1rm{background:var(--background-secondary);width:100%;height:500px;padding:0;position:relative;margin-left:0}.editor-input.svelte-1ycn1rm>textarea.svelte-1ycn1rm{background:var(--background-secondary);border:none;padding:var(--size-4-4) var(--size-4-8);margin:0;position:absolute;inset:0;resize:none}.editor-input.svelte-1ycn1rm>div.svelte-1ycn1rm{padding:var(--size-4-4) var(--size-4-8);position:absolute;inset:0}")}function R6(t){let e,r,n,i,a,o;return{c(){e=Re("div"),r=Re("textarea"),n=Fr(),i=Re("div"),ce(r,"class","svelte-1ycn1rm"),ce(i,"class","svelte-1ycn1rm"),ce(e,"class","editor-input card svelte-1ycn1rm")},m(c,u){Je(c,e,u),Se(e,r),t[9](r),df(r,t[0]),Se(e,n),Se(e,i),t[12](i),a||(o=[gr(r,"input",t[10]),gr(r,"focusout",t[11]),gr(e,"click",t[13])],a=!0)},p(c,[u]){u&1&&df(r,c[0])},i:ur,o:ur,d(c){c&&Ze(e),t[9](null),t[12](null),a=!1,ht(o)}}}function P6(t,e,r){let{onValueChange:n}=e,{editorInput:i}=e,{value:a}=e,o,c;fs(()=>{o.toggleVisibility(!0),c.toggleVisibility(!1)});function u(D){r(0,a=D),s()}function s(){r(1,o.innerHTML="",o),i.renderChild.plugin instanceof Do?Lb.MarkdownRenderer.renderMarkdown(a,o,i.renderChild.filePath,i.renderChild):r(1,o.innerText=a,o)}function l(D){o.toggleVisibility(!0),c.toggleVisibility(!1),s()}function f(D){console.log("focus in"),o.toggleVisibility(!1),c.toggleVisibility(!0),c.focus()}function m(D){Vn[D?"unshift":"push"](()=>{c=D,r(2,c)})}function p(){a=this.value,r(0,a)}let h=D=>l(D);function d(D){Vn[D?"unshift":"push"](()=>{o=D,r(1,o)})}let g=D=>f(D);return t.$$set=D=>{"onValueChange"in D&&r(5,n=D.onValueChange),"editorInput"in D&&r(6,i=D.editorInput),"value"in D&&r(0,a=D.value)},t.$$.update=()=>{if(t.$$.dirty&33){e:n(a)&&s()}},[a,o,c,l,f,n,i,u,s,m,p,h,d,g]}var um=class extends _r{constructor(e){super(),Wr(this,e,P6,R6,$r,{onValueChange:5,editorInput:6,value:0,updateValue:7,render:8},_6)}get updateValue(){return this.$$.ctx[7]}get render(){return this.$$.ctx[8]}},kb=um;var Ea=class extends Nr{constructor(r){super(r);this.value=""}getValue(){if(!!this.component)return this.value}setValue(r){var n;this.value=r,(n=this.component)==null||n.updateValue(r)}isEqualValue(r){return this.value==r}getDefaultValue(){return""}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}render(r){console.debug(`meta-bind | EditorInputField >> render ${this.renderChild.uuid}`),this.container=r,this.value=this.renderChild.getInitialValue(),this.component=new kb({target:r,props:{onValueChange:this.onValueChange.bind(this),editorInput:this,value:this.value}}),this.component.render()}destroy(){var r;(r=this.component)==null||r.$destroy()}};Ea.allowInline=!1;function L6(t){Dt(t,"svelte-1f4vrw6",".image-suggest-input.svelte-1f4vrw6{background:var(--background-secondary);border-radius:var(--meta-bind-plugin-border-radius);border:var(--meta-bind-plugin-border-width) solid var(--background-modifier-border);padding:var(--size-4-2);width:100%}.image-suggest-image.svelte-1f4vrw6{width:100%}.image-suggest-footer.svelte-1f4vrw6{display:flex;flex-direction:row;color:var(--text-normal);align-items:baseline}.image-suggest-footer-text.svelte-1f4vrw6{flex:1;margin-left:var(--size-4-2)}")}function qb(t){let e,r;return{c(){e=Re("img"),ce(e,"class","image-suggest-image svelte-1f4vrw6"),ao(e.src,r=Za(t[0]))||ce(e,"src",r),ce(e,"alt",t[0])},m(n,i){Je(n,e,i)},p(n,i){i&1&&!ao(e.src,r=Za(n[0]))&&ce(e,"src",r),i&1&&ce(e,"alt",n[0])},d(n){n&&Ze(e)}}}function k6(t){let e,r,n,i,a=(t[0]||"no image selected")+"",o,c,u,s,l,f=t[0]&&qb(t);return{c(){e=Re("div"),f&&f.c(),r=Fr(),n=Re("div"),i=Re("span"),o=Hr(a),c=Fr(),u=Re("button"),u.textContent="change image",ce(i,"class","image-suggest-footer-text svelte-1f4vrw6"),ce(u,"class","btn btn-active"),ce(n,"class","image-suggest-footer svelte-1f4vrw6"),ce(e,"class","image-suggest-input svelte-1f4vrw6")},m(m,p){Je(m,e,p),f&&f.m(e,null),Se(e,r),Se(e,n),Se(n,i),Se(i,o),Se(n,c),Se(n,u),s||(l=[gr(u,"click",t[1]),gr(u,"keydown",t[2])],s=!0)},p(m,[p]){m[0]?f?f.p(m,p):(f=qb(m),f.c(),f.m(e,r)):f&&(f.d(1),f=null),p&1&&a!==(a=(m[0]||"no image selected")+"")&&at(o,a)},i:ur,o:ur,d(m){m&&Ze(e),f&&f.d(),s=!1,ht(l)}}}function q6(t,e,r){let{showSuggest:n}=e,i;function a(u){r(0,i=u)}function o(u){n()}function c(u){u.key===" "&&n()}return t.$$set=u=>{"showSuggest"in u&&r(3,n=u.showSuggest)},[i,o,c,n,a]}var lm=class extends _r{constructor(e){super(),Wr(this,e,q6,k6,$r,{showSuggest:3,updateValue:4},L6)}get updateValue(){return this.$$.ctx[4]}},zb=lm;var Sn=require("obsidian");var Wb=require("obsidian");function z6(t){Dt(t,"svelte-1cuz7a4",".image-card-image.svelte-1cuz7a4{width:100%}.image-card-text.svelte-1cuz7a4{display:block;margin:var(--size-4-2);margin-bottom:var(--size-4-4)}")}function U6(t){let e,r,n,i,a,o,c,u;return{c(){e=Re("div"),r=Re("img"),i=Fr(),a=Re("span"),o=Hr(t[0]),ce(r,"class","image-card-image svelte-1cuz7a4"),ao(r.src,n=Za(t[0]))||ce(r,"src",n),ce(r,"alt",t[0]),ce(a,"class","image-card-text svelte-1cuz7a4"),ce(e,"class","image-card svelte-1cuz7a4")},m(s,l){Je(s,e,l),Se(e,r),Se(e,i),Se(e,a),Se(a,o),c||(u=gr(e,"click",t[2]),c=!0)},p(s,[l]){l&1&&!ao(r.src,n=Za(s[0]))&&ce(r,"src",n),l&1&&ce(r,"alt",s[0]),l&1&&at(o,s[0])},i:ur,o:ur,d(s){s&&Ze(e),c=!1,u()}}}function V6(t,e,r){let{image:n}=e,{onSelect:i}=e,a=()=>i(n);return t.$$set=o=>{"image"in o&&r(0,n=o.image),"onSelect"in o&&r(1,i=o.onSelect)},[n,i,a]}var cm=class extends _r{constructor(e){super(),Wr(this,e,V6,U6,$r,{image:0,onSelect:1},z6)}},Ub=cm;function $6(t){Dt(t,"svelte-1f80gwc",".image-card-grid.svelte-1f80gwc{display:grid;grid-template-columns:repeat(auto-fit, minmax(min(500px, 100%), 1fr));gap:var(--size-4-4)}")}function Vb(t,e,r){let n=t.slice();return n[2]=e[r],n}function $b(t){let e,r;return e=new Ub({props:{image:t[2],onSelect:t[1]}}),{c(){Ai(e.$$.fragment)},m(n,i){fi(e,n,i),r=!0},p(n,i){let a={};i&1&&(a.image=n[2]),i&2&&(a.onSelect=n[1]),e.$set(a)},i(n){r||(zt(e.$$.fragment,n),r=!0)},o(n){ln(e.$$.fragment,n),r=!1},d(n){$n(e,n)}}}function H6(t){let e,r,n=t[0],i=[];for(let o=0;o<n.length;o+=1)i[o]=$b(Vb(t,n,o));let a=o=>ln(i[o],1,1,()=>{i[o]=null});return{c(){e=Re("div");for(let o=0;o<i.length;o+=1)i[o].c();ce(e,"class","image-card-grid svelte-1f80gwc")},m(o,c){Je(o,e,c);for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(e,null);r=!0},p(o,[c]){if(c&3){n=o[0];let u;for(u=0;u<n.length;u+=1){let s=Vb(o,n,u);i[u]?(i[u].p(s,c),zt(i[u],1)):(i[u]=$b(s),i[u].c(),zt(i[u],1),i[u].m(e,null))}for(ku(),u=n.length;u<i.length;u+=1)a(u);qu()}},i(o){if(!r){for(let c=0;c<n.length;c+=1)zt(i[c]);r=!0}},o(o){i=i.filter(Boolean);for(let c=0;c<i.length;c+=1)ln(i[c]);r=!1},d(o){o&&Ze(e),va(i,o)}}}function W6(t,e,r){let{options:n}=e,{onSelect:i}=e;return t.$$set=a=>{"options"in a&&r(0,n=a.options),"onSelect"in a&&r(1,i=a.onSelect)},[n,i]}var fm=class extends _r{constructor(e){super(),Wr(this,e,W6,H6,$r,{options:0,onSelect:1},$6)}},Hb=fm;var al=class extends Wb.Modal{constructor(r,n,i){super(r);this.options=n,this.onSelect=i}onOpen(){this.modalEl.style.width="100%",new Hb({target:this.contentEl,props:{options:this.options,onSelect:r=>{this.onSelect(r),this.close()}}})}};var Ca=class extends Nr{constructor(r){super(r);this.value="",this.options=[]}getValue(){if(!!this.component)return this.value}setValue(r){var n;r=r!=null?r:this.getDefaultValue(),this.value=r,(n=this.component)==null||n.updateValue(r)}isEqualValue(r){return this.value==r}getDefaultValue(){return""}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}isImageExtension(r){return["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"].contains(r)}async getOptions(){let r=this.renderChild.getArguments("optionQuery"),n=[];for(let a of r){let o=a.value;if(o.startsWith('"')&&o.endsWith('"'))o=o.substring(1,o.length-1);else{let u=new Un("ERROR","failed to get suggest options","expected suggest option query for image suggester to start and end with double quotation marks");new Sn.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}let c=this.renderChild.plugin.app.vault.getAbstractFileByPath(o);if(c==null){let u=new Un("ERROR","failed to get suggest options",`expected suggest option query ${o} for image suggester to exist`);new Sn.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!(c instanceof Sn.TFolder)){let u=new Un("ERROR","failed to get suggest options",`expected suggest option query ${a.value} for image suggester to be a folder`);new Sn.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}for(let u of c.children)u instanceof Sn.TFile&&this.isImageExtension(u.extension)&&n.push(u.path)}let i=this.renderChild.getArguments("option");for(let a of i){let o=this.renderChild.plugin.app.vault.getAbstractFileByPath(a.value);if(!o){let c=new Un("ERROR","failed to get suggest options",`expected suggest option ${a.value} for image suggester to exist`);new Sn.Notice(`meta-bind | ${c.message}`),console.warn(c);continue}if(!(o instanceof Sn.TFile)){let c=new Un("ERROR","failed to get suggest options",`expected suggest option ${a.value} for image suggester to be a file`);new Sn.Notice(`meta-bind | ${c.message}`),console.warn(c);continue}if(!this.isImageExtension(o.extension)){let c=new Un("ERROR","failed to get suggest options",`expected suggest option ${a.value} for image suggester to be an image file`);new Sn.Notice(`meta-bind | ${c.message}`),console.warn(c);continue}n.push(a.value)}this.options=n}async showSuggest(){await this.getOptions(),new al(this.renderChild.plugin.app,this.options,r=>{this.setValue(r),this.onValueChange(r)}).open()}render(r){console.debug(`meta-bind | SuggestInputField >> render ${this.renderChild.uuid}`),this.container=r,this.value=this.renderChild.getInitialValue(),this.component=new zb({target:r,props:{showSuggest:()=>this.showSuggest()}}),this.component.updateValue(this.value)}destroy(){var r;(r=this.component)==null||r.$destroy()}};Ca.allowInline=!1;function G6(t){Dt(t,"svelte-xfyrih",".mb-progress-bar-input.svelte-xfyrih{height:32px;width:100%;border-radius:var(--meta-bind-plugin-border-radius);border:var(--meta-bind-plugin-border-width) solid var(--background-modifier-border);position:relative;cursor:col-resize}.mb-progress-bar-input.svelte-xfyrih:focus-visible{box-shadow:0 0 0 3px var(--background-modifier-border-focus)}.mb-progress-bar-progress.svelte-xfyrih{height:32px;background:var(--color-accent);border-radius:var(--meta-bind-plugin-border-radius)}.mb-progress-bar-value.svelte-xfyrih{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mb-progress-bar-label-left.svelte-xfyrih{position:absolute;top:50%;transform:translate(0, -50%);left:var(--size-4-2)}.mb-progress-bar-label-right.svelte-xfyrih{position:absolute;top:50%;transform:translate(0, -50%);right:var(--size-4-2)}")}function Z6(t){let e,r,n,i,a,o,c,u,s=t[1].minValue+"",l,f,m,p=t[1].maxValue+"",h,d,g,D,N;return{c(){e=Re("div"),r=Re("div"),i=Fr(),a=Re("span"),o=Hr(t[0]),c=Fr(),u=Re("span"),l=Hr(s),f=Fr(),m=Re("span"),h=Hr(p),ce(r,"class","mb-progress-bar-progress svelte-xfyrih"),ce(r,"style",n=`width: ${t[4](t[0])}%`),ce(a,"class","mb-progress-bar-value svelte-xfyrih"),ce(u,"class","mb-progress-bar-label-left svelte-xfyrih"),ce(m,"class","mb-progress-bar-label-right svelte-xfyrih"),ce(e,"class","mb-progress-bar-input svelte-xfyrih"),ce(e,"tabindex","0"),ce(e,"role","slider"),ce(e,"aria-valuemin",d=t[1].minValue),ce(e,"aria-valuemax",g=t[1].maxValue),ce(e,"aria-valuenow",t[0])},m(v,w){Je(v,e,w),Se(e,r),Se(e,i),Se(e,a),Se(a,o),Se(e,c),Se(e,u),Se(u,l),Se(e,f),Se(e,m),Se(m,h),t[12](e),D||(N=[gr(window,"touchmove",t[7],{passive:!1}),gr(window,"touchcancel",t[5]),gr(window,"touchend",t[5]),gr(window,"mousemove",t[7]),gr(window,"mouseup",t[5]),gr(r,"dragstart",t[11]),gr(e,"keydown",t[8]),gr(e,"mousedown",t[6]),gr(e,"touchstart",t[6])],D=!0)},p(v,[w]){w&1&&n!==(n=`width: ${v[4](v[0])}%`)&&ce(r,"style",n),w&1&&at(o,v[0]),w&2&&s!==(s=v[1].minValue+"")&&at(l,s),w&2&&p!==(p=v[1].maxValue+"")&&at(h,p),w&2&&d!==(d=v[1].minValue)&&ce(e,"aria-valuemin",d),w&2&&g!==(g=v[1].maxValue)&&ce(e,"aria-valuemax",g),w&1&&ce(e,"aria-valuenow",v[0])},i:ur,o:ur,d(v){v&&Ze(e),t[12](null),D=!1,ht(N)}}}function j6(t,e,r){let{onValueChange:n}=e,{progressBarInput:i}=e,{value:a}=e,o=!1,c,u=0,s=null;function l(b){r(0,a=b)}function f(b){r(0,a=b),n(b)}function m(b){return b=os(b,i.minValue,i.maxValue),nf(b,i.minValue,i.maxValue,0,100)}function p(){r(2,o=!0)}function h(){r(2,o=!1)}function d(b){p(),g(b)}function g(b){if(!o)return;b.stopPropagation&&b.stopPropagation(),b.preventDefault&&b.preventDefault();let y=b instanceof TouchEvent?b.touches[0].clientX:b.clientX;D(y)}function D(b){let y=c.getBoundingClientRect();b=os(b,y.left,y.right);let E=nf(b,y.left,y.right,i.minValue,i.maxValue);E=Math.round(E),f(E)}function N(b){u<50&&u++;let y=Math.ceil(u/5);if(b.key==="ArrowUp"||b.key==="ArrowRight"){let E=os(a+y,i.minValue,i.maxValue);f(E)}if(b.key==="ArrowDown"||b.key==="ArrowLeft"){let E=os(a-y,i.minValue,i.maxValue);f(E)}clearTimeout(s),s=setTimeout(()=>u=1,100)}let v=()=>r(2,o=!0);function w(b){Vn[b?"unshift":"push"](()=>{c=b,r(3,c)})}return t.$$set=b=>{"onValueChange"in b&&r(9,n=b.onValueChange),"progressBarInput"in b&&r(1,i=b.progressBarInput),"value"in b&&r(0,a=b.value)},[a,i,o,c,m,h,d,g,N,n,l,v,w]}var mm=class extends _r{constructor(e){super(),Wr(this,e,j6,Z6,$r,{onValueChange:9,progressBarInput:1,value:0,updateValue:10},G6)}get updateValue(){return this.$$.ctx[10]}},Gb=mm;var Na=class extends Nr{constructor(r){var n,i,a,o,c,u;super(r);this.minValue=(i=(n=r.getArgument("minValue"))==null?void 0:n.value)!=null?i:0,this.maxValue=(o=(a=r.getArgument("maxValue"))==null?void 0:a.value)!=null?o:100,this.addLabels=(u=(c=r.getArgument("addLabels"))==null?void 0:c.value)!=null?u:!1,this.value=this.getDefaultValue()}getValue(){if(!!this.component)return this.value}setValue(r){var n;r!=null&&typeof r=="number"?r>=this.minValue&&r<=this.maxValue&&(this.value=r):(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at progressBarInputField ${this.renderChild.uuid}`)),this.value=this.getDefaultValue()),(n=this.component)==null||n.updateValue(r)}isEqualValue(r){return this.value==r}getDefaultValue(){return this.minValue}getHtmlElement(){if(!this.container)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.container}render(r){console.debug(`meta-bind | ProgressBarInputField >> render ${this.renderChild.uuid}`),this.container=r,this.value=this.renderChild.getInitialValue(),this.component=new Gb({target:r,props:{onValueChange:this.onValueChange.bind(this),progressBarInput:this,value:this.value}})}destroy(){var r;(r=this.component)==null||r.$destroy()}};Na.allowInline=!1;var Zb=require("obsidian");var Aa=class extends Nr{constructor(r){super(r);this.options=r.getArguments("option").map(n=>n.value)}getValue(){if(!!this.selectComponent)return this.selectComponent.getValue()}setValue(r){!this.selectComponent||(r!=null&&typeof r=="string"?this.selectComponent.setValue(r):(console.warn(new xt("WARNING","failed to set value",`invalid value '${r}' at inlineSelectInputField ${this.renderChild.uuid}`)),this.selectComponent.setValue("")))}isEqualValue(r){return this.getValue()==r}getDefaultValue(){return""}getHtmlElement(){if(!this.selectComponent)throw new Qe("WARNING","failed to get html element for input field","container is undefined, field hasn't been rendered yet");return this.selectComponent.selectEl}render(r){console.debug(`meta-bind | InlineSelectInputField >> render ${this.renderChild.uuid}`);let n=new Zb.DropdownComponent(r);for(let i of this.options)n.addOption(i,i);n.setValue(this.renderChild.getInitialValue()),n.onChange(this.onValueChange),this.selectComponent=n}destroy(){}};Aa.allowBlock=!1;var ol=class{static createInputField(e,r){if(e!=="invalid"&&ol.checkRenderChildTypeAllowed(e,r.renderChildType,r.inputFieldMDRC.plugin),e==="toggle")return new Ya(r.inputFieldMDRC);if(e==="slider")return new Xa(r.inputFieldMDRC);if(e==="text")return new Ja(r.inputFieldMDRC);if(e==="text_area")return new Qa(r.inputFieldMDRC);if(e==="select")return new Ni(r.inputFieldMDRC);if(e==="multi_select")return new Ka(r.inputFieldMDRC);if(e==="date")return new eo(r.inputFieldMDRC);if(e==="time")return new ro(r.inputFieldMDRC);if(e==="date_picker")return new oo(r.inputFieldMDRC);if(e==="number")return new so(r.inputFieldMDRC);if(e==="suggester")return new xo(r.inputFieldMDRC);if(e==="editor")return new Ea(r.inputFieldMDRC);if(e==="imageSuggester")return new Ca(r.inputFieldMDRC);if(e==="progressBar")return new Na(r.inputFieldMDRC);if(e==="inlineSelect")return new Aa(r.inputFieldMDRC)}static checkRenderChildTypeAllowed(e,r,n){if(n.settings.ignoreCodeBlockRestrictions)return;let i=ol.allowCodeBlockMap[e];if(r==="block"&&!i.block)throw new or("CRITICAL","can not create input field",`'${e}' is not allowed as code block`);if(r==="inline"&&!i.inline)throw new or("CRITICAL","can not create input field",`'${e}' is not allowed as inline code block`)}},Fs=ol;Fs.allowCodeBlockMap={["toggle"]:{block:Ya.allowBlock,inline:Ya.allowInline},["slider"]:{block:Xa.allowBlock,inline:Xa.allowInline},["text"]:{block:Ja.allowBlock,inline:Ja.allowInline},["text_area"]:{block:Qa.allowBlock,inline:Qa.allowInline},["select"]:{block:Ni.allowBlock,inline:Ni.allowInline},["multi_select"]:{block:Ka.allowBlock,inline:Ka.allowInline},["date"]:{block:eo.allowBlock,inline:eo.allowInline},["time"]:{block:ro.allowBlock,inline:ro.allowInline},["date_picker"]:{block:oo.allowBlock,inline:oo.allowInline},["number"]:{block:so.allowBlock,inline:so.allowInline},["suggester"]:{block:xo.allowBlock,inline:xo.allowInline},["editor"]:{block:Ea.allowBlock,inline:Ea.allowInline},["imageSuggester"]:{block:Ca.allowBlock,inline:Ca.allowInline},["progressBar"]:{block:Na.allowBlock,inline:Na.allowInline},["inlineSelect"]:{block:Aa.allowBlock,inline:Aa.allowInline}};var iw=Yt(Wa());var pm=class{constructor(){this.listeners=[]}registerListener(e){let r=e;return r.uuid=self.crypto.randomUUID(),this.listeners.push(r),r}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(r=>r.uuid!==e)}notifyListeners(e){for(let r of this.listeners)r.callback(e)}},Mi=class extends pm{constructor(r){super();this.value=r}get(){return this.value}set(r){this.value=r,this.notifyListeners(r)}};var jb=require("obsidian");var wo=class extends jb.MarkdownRenderChild{constructor(r,n,i,a,o,c){super(r);this.renderChildType=n,this.plugin=i,this.filePath=a,this.uuid=o,this.frontmatter=c,this.errorCollection=new Nn(this.uuid)}};var tw=require("obsidian");function Yb(t,e,r){let n=t.slice();return n[2]=e[r],n}function Jb(t,e,r){let n=t.slice();return n[5]=e[r],n}function Xb(t){let e,r,n,i=t[0].getWarnings(),a=[];for(let o=0;o<i.length;o+=1)a[o]=Qb(Jb(t,i,o));return{c(){e=Re("h6"),e.textContent="Warnings",r=Fr();for(let o=0;o<a.length;o+=1)a[o].c();n=ci()},m(o,c){Je(o,e,c),Je(o,r,c);for(let u=0;u<a.length;u+=1)a[u]&&a[u].m(o,c);Je(o,n,c)},p(o,c){if(c&1){i=o[0].getWarnings();let u;for(u=0;u<i.length;u+=1){let s=Jb(o,i,u);a[u]?a[u].p(s,c):(a[u]=Qb(s),a[u].c(),a[u].m(n.parentNode,n))}for(;u<a.length;u+=1)a[u].d(1);a.length=i.length}},d(o){o&&Ze(e),o&&Ze(r),va(a,o),o&&Ze(n)}}}function Qb(t){let e,r,n=t[5].message+"",i;return{c(){e=Re("p"),r=Re("code"),i=Hr(n),ce(r,"class","language-none meta-bind-none")},m(a,o){Je(a,e,o),Se(e,r),Se(r,i)},p(a,o){o&1&&n!==(n=a[5].message+"")&&at(i,n)},d(a){a&&Ze(e)}}}function Kb(t){let e,r,n,i=t[0].getErrors(),a=[];for(let o=0;o<i.length;o+=1)a[o]=ew(Yb(t,i,o));return{c(){e=Re("h6"),e.textContent="Errors",r=Fr();for(let o=0;o<a.length;o+=1)a[o].c();n=ci()},m(o,c){Je(o,e,c),Je(o,r,c);for(let u=0;u<a.length;u+=1)a[u]&&a[u].m(o,c);Je(o,n,c)},p(o,c){if(c&1){i=o[0].getErrors();let u;for(u=0;u<i.length;u+=1){let s=Yb(o,i,u);a[u]?a[u].p(s,c):(a[u]=ew(s),a[u].c(),a[u].m(n.parentNode,n))}for(;u<a.length;u+=1)a[u].d(1);a.length=i.length}},d(o){o&&Ze(e),o&&Ze(r),va(a,o),o&&Ze(n)}}}function ew(t){let e,r,n=t[2].message+"",i;return{c(){e=Re("p"),r=Re("code"),i=Hr(n),ce(r,"class","language-none meta-bind-none")},m(a,o){Je(a,e,o),Se(e,r),Se(r,i)},p(a,o){o&1&&n!==(n=a[2].message+"")&&at(i,n)},d(a){a&&Ze(e)}}}function Y6(t){let e,r,n,i,a=t[0].hasWarnings(),o,c=t[0].hasErrors(),u,s=a&&Xb(t),l=c&&Kb(t);return{c(){e=Re("p"),r=Re("code"),n=Hr(t[1]),i=Fr(),s&&s.c(),o=Fr(),l&&l.c(),u=ci(),ce(r,"class","language-none meta-bind-none")},m(f,m){Je(f,e,m),Se(e,r),Se(r,n),Je(f,i,m),s&&s.m(f,m),Je(f,o,m),l&&l.m(f,m),Je(f,u,m)},p(f,[m]){m&2&&at(n,f[1]),m&1&&(a=f[0].hasWarnings()),a?s?s.p(f,m):(s=Xb(f),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null),m&1&&(c=f[0].hasErrors()),c?l?l.p(f,m):(l=Kb(f),l.c(),l.m(u.parentNode,u)):l&&(l.d(1),l=null)},i:ur,o:ur,d(f){f&&Ze(e),f&&Ze(i),s&&s.d(f),f&&Ze(o),l&&l.d(f),f&&Ze(u)}}}function J6(t,e,r){let{errorCollection:n}=e,{declaration:i}=e;return t.$$set=a=>{"errorCollection"in a&&r(0,n=a.errorCollection),"declaration"in a&&r(1,i=a.declaration)},[n,i]}var dm=class extends _r{constructor(e){super(),Wr(this,e,J6,Y6,$r,{errorCollection:0,declaration:1})}},rw=dm;var sl=class extends tw.Modal{constructor(r,n,i){super(r);this.errorCollection=n,this.declaration=i}onOpen(){this.titleEl.innerText="Meta Bind Field",this.component=new rw({target:this.contentEl,props:{errorCollection:this.errorCollection,declaration:this.declaration}})}onClose(){var r;(r=this.component)==null||r.$destroy()}};var OG=require("obsidian");function nw(t){let e,r,n,i,a;function o(s,l){return l&1&&(r=null),l&1&&(n=null),r==null&&(r=!!s[0].hasErrors()),r?K6:(n==null&&(n=!!s[0].hasWarnings()),n?Q6:X6)}let c=o(t,-1),u=c(t);return{c(){e=Re("div"),u.c(),ce(e,"class","meta-bind-error-collection")},m(s,l){Je(s,e,l),u.m(e,null),i||(a=gr(e,"click",t[4]),i=!0)},p(s,l){c!==(c=o(s,l))&&(u.d(1),u=c(s),u&&(u.c(),u.m(e,null)))},d(s){s&&Ze(e),u.d(),i=!1,a()}}}function X6(t){let e,r,n,i;return{c(){e=un("svg"),r=un("circle"),n=un("path"),i=un("path"),ce(r,"cx","12"),ce(r,"cy","12"),ce(r,"r","10"),ce(n,"d","M12 16v-4"),ce(i,"d","M12 8h.01"),ce(e,"xmlns","http://www.w3.org/2000/svg"),ce(e,"width","24"),ce(e,"height","24"),ce(e,"viewBox","0 0 24 24"),ce(e,"fill","none"),ce(e,"stroke","currentColor"),ce(e,"stroke-width","2"),ce(e,"stroke-linecap","round"),ce(e,"stroke-linejoin","round"),ce(e,"class","lucide lucide-info")},m(a,o){Je(a,e,o),Se(e,r),Se(e,n),Se(e,i)},d(a){a&&Ze(e)}}}function Q6(t){let e,r,n,i;return{c(){e=un("svg"),r=un("path"),n=un("line"),i=un("line"),ce(r,"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"),ce(n,"x1","12"),ce(n,"x2","12"),ce(n,"y1","9"),ce(n,"y2","13"),ce(i,"x1","12"),ce(i,"x2","12.01"),ce(i,"y1","17"),ce(i,"y2","17"),ce(e,"xmlns","http://www.w3.org/2000/svg"),ce(e,"width","24"),ce(e,"height","24"),ce(e,"viewBox","0 0 24 24"),ce(e,"fill","none"),ce(e,"stroke","currentColor"),ce(e,"stroke-width","2"),ce(e,"stroke-linecap","round"),ce(e,"stroke-linejoin","round"),ce(e,"class","lucide lucide-alert-triangle")},m(a,o){Je(a,e,o),Se(e,r),Se(e,n),Se(e,i)},d(a){a&&Ze(e)}}}function K6(t){let e,r,n,i,a,o;return{c(){e=un("svg"),r=un("circle"),n=un("line"),i=un("line"),a=Fr(),o=Re("span"),o.textContent="[META_BIND_ERROR]",ce(r,"cx","12"),ce(r,"cy","12"),ce(r,"r","10"),ce(n,"x1","12"),ce(n,"x2","12"),ce(n,"y1","8"),ce(n,"y2","12"),ce(i,"x1","12"),ce(i,"x2","12.01"),ce(i,"y1","16"),ce(i,"y2","16"),ce(e,"xmlns","http://www.w3.org/2000/svg"),ce(e,"width","24"),ce(e,"height","24"),ce(e,"viewBox","0 0 24 24"),ce(e,"fill","none"),ce(e,"stroke","currentColor"),ce(e,"stroke-width","2"),ce(e,"stroke-linecap","round"),ce(e,"stroke-linejoin","round"),ce(e,"class","lucide lucide-alert-circle"),ce(o,"class","meta-bind-plugin-error")},m(c,u){Je(c,e,u),Se(e,r),Se(e,n),Se(e,i),Je(c,a,u),Je(c,o,u)},d(c){c&&Ze(e),c&&Ze(a),c&&Ze(o)}}}function eR(t){let e=!t[0].isEmpty(),r,n=e&&nw(t);return{c(){n&&n.c(),r=ci()},m(i,a){n&&n.m(i,a),Je(i,r,a)},p(i,[a]){a&1&&(e=!i[0].isEmpty()),e?n?n.p(i,a):(n=nw(i),n.c(),n.m(r.parentNode,r)):n&&(n.d(1),n=null)},i:ur,o:ur,d(i){n&&n.d(i),i&&Ze(r)}}}function rR(t,e,r){let{app:n}=e,{errorCollection:i}=e,{declaration:a}=e;function o(){new sl(n,i,a).open()}let c=()=>o();return t.$$set=u=>{"app"in u&&r(2,n=u.app),"errorCollection"in u&&r(0,i=u.errorCollection),"declaration"in u&&r(3,a=u.declaration)},[i,o,n,a,c]}var hm=class extends _r{constructor(e){super(),Wr(this,e,rR,eR,$r,{app:2,errorCollection:0,declaration:3})}},Fa=hm;var bo=(r=>(r.INLINE="inline",r.BLOCK="block",r))(bo||{}),Ss=class extends wo{constructor(r,n,i,a,o,c,u=void 0){super(r,n,a,o,c,u);if(this.errorCollection.merge(i.errorCollection),this.fullDeclaration=i.fullDeclaration,this.inputFieldDeclaration=i,this.writeSignal=new Mi(void 0),this.readSignal=new Mi(void 0),!this.errorCollection.hasErrors())try{this.inputFieldDeclaration.isBound&&(this.bindTargetDeclaration=this.plugin.api.bindTargetParser.parseBindTarget(this.inputFieldDeclaration.bindTarget,this.filePath)),this.inputField=Fs.createInputField(this.inputFieldDeclaration.inputFieldType,{renderChildType:n,inputFieldMDRC:this})}catch(s){this.errorCollection.add(s)}}registerSelfToMetadataManager(){var r;if(!(!((r=this.inputFieldDeclaration)!=null&&r.isBound)||!this.bindTargetDeclaration))return this.metadataManagerReadSignalListener=this.readSignal.registerListener({callback:this.updateMetadataManager.bind(this)}),this.plugin.metadataManager.register(this.bindTargetDeclaration.filePath,void 0,this.writeSignal,this.bindTargetDeclaration.metadataPath,this.uuid)}unregisterSelfFromMetadataManager(){var r;!((r=this.inputFieldDeclaration)!=null&&r.isBound)||!this.bindTargetDeclaration||(this.metadataManagerReadSignalListener&&this.readSignal.unregisterListener(this.metadataManagerReadSignalListener),this.plugin.metadataManager.unregister(this.bindTargetDeclaration.filePath,this.uuid))}updateMetadataManager(r){var n;!((n=this.inputFieldDeclaration)!=null&&n.isBound)||!this.bindTargetDeclaration||this.plugin.metadataManager.updatePropertyInCache(r,this.bindTargetDeclaration.metadataPath,this.bindTargetDeclaration.filePath,this.uuid)}getInitialValue(){var r,n,i,a;if(((r=this.inputFieldDeclaration)==null?void 0:r.isBound)&&this.bindTargetDeclaration){let o=(0,iw.traverseObjectByPath)(this.bindTargetDeclaration.metadataPath,(n=this.metadataCache)==null?void 0:n.metadata);return console.debug(`meta-bind | InputFieldMarkdownRenderChild >> setting initial value to ${o} (typeof ${typeof o}) for input field ${this.uuid}`),o!=null?o:(i=this.inputField)==null?void 0:i.getDefaultValue()}else return(a=this.inputField)==null?void 0:a.getDefaultValue()}getArguments(r){if(this.inputFieldDeclaration.errorCollection.hasErrors())throw new Qe("ERROR","can not retrieve arguments","inputFieldDeclaration has errors");return this.inputFieldDeclaration.argumentContainer.getAll(r)}getArgument(r){return this.getArguments(r).at(0)}addCardContainer(){return this.renderChildType==="block"&&(li(this.getArgument("showcase"))||li(this.getArgument("title"))||this.inputFieldDeclaration.inputFieldType==="select"||this.inputFieldDeclaration.inputFieldType==="multi_select")}hasValidBindTarget(){var r;return li((r=this.inputFieldDeclaration)==null?void 0:r.isBound)&&li(this.bindTargetDeclaration)}async onload(){var c,u;if(console.log("meta-bind | InputFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("meta-bind-plugin-input"),this.containerEl.empty(),!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new Qe("CRITICAL","can't render input field","input field is undefined")),this.errorCollection.hasErrors()){new Fa({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}});return}let r,n=this.getArgument("showcase"),i=this.getArgument("title");if(this.addCardContainer()){let s=this.containerEl.createDiv({cls:"meta-bind-plugin-card"});i&&s.createEl("h3",{text:i.value}),r=s}else r=this.containerEl;new Fa({target:r,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}}),this.hasValidBindTarget()&&(this.metadataCache=this.registerSelfToMetadataManager()),this.plugin.mdrcManager.registerMDRC(this);let a=createDiv();a.addClass("meta-bind-plugin-input-wrapper"),(c=this.inputField)==null||c.render(a);let o=this.getArguments("class");o&&((u=this.inputField)==null||u.getHtmlElement().addClasses(o.map(s=>s.value).flat())),r.appendChild(a),this.addCardContainer()&&n&&r.createEl("code",{text:this.fullDeclaration,cls:"meta-bind-none"})}onunload(){var r;console.log("meta-bind | InputFieldMarkdownRenderChild >> unload",this),(r=this.inputField)==null||r.destroy(),this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),this.containerEl.empty(),this.containerEl.createEl("span",{text:"unloaded meta bind input field",cls:"meta-bind-plugin-error"}),super.onunload()}};var lw=Yt(uw());var Ts=Yt(Wa()),yR=lw.Internal.getMetadataFromFileCache,xR=5,DR=5*60,cl=class{constructor(e){this.plugin=e,this.cache=new Map,this.plugin.registerEvent(this.plugin.app.metadataCache.on("changed",(r,n,i)=>this.updateCacheOnFrontmatterUpdate(r.path,n,i))),this.interval=window.setInterval(()=>this.update(),this.plugin.settings.syncInterval)}register(e,r,n,i,a){let o=this.getCacheForFile(e);if(o)return console.debug(`meta-bind | MetadataManager >> registered ${a} to existing file cache ${e} -> ${i}`),o.inactive=!1,o.cyclesSinceInactive=0,o.listeners.push({callback:c=>n.set(c),metadataPath:i,uuid:a}),n.set((0,Ts.traverseObjectByPath)(i,o.metadata)),o;{console.debug(`meta-bind | MetadataManager >> registered ${a} to newly created file cache ${e} -> ${i}`);let c=this.plugin.app.vault.getAbstractFileByPath(e),u={file:c,metadata:yR(c,this.plugin),listeners:[{callback:s=>n.set(s),metadataPath:i,uuid:a}],cyclesSinceLastChange:0,cyclesSinceInactive:0,inactive:!1,changed:!1};return console.log(`meta-bind | MetadataManager >> loaded metadata for file ${c.path}`,u.metadata),n.set((0,Ts.traverseObjectByPath)(i,u.metadata)),this.cache.set(e,u),u}}unregister(e,r){let n=this.getCacheForFile(e);!n||(console.debug(`meta-bind | MetadataManager >> unregistered ${r} to from file cache ${e}`),n.listeners=n.listeners.filter(i=>i.uuid!==r),n.listeners.length===0&&(console.debug(`meta-bind | MetadataManager >> marked unused file cache as inactive ${e}`),n.inactive=!0))}getCacheForFile(e){return this.cache.get(e)}update(){let e=[];for(let[r,n]of this.cache)n.changed&&this.updateFrontmatter(n),n.cyclesSinceLastChange+=1,n.inactive&&(n.cyclesSinceInactive+=1),n.cyclesSinceInactive>DR&&e.push(r);for(let r of e)this.cache.delete(r)}async updateFrontmatter(e){console.debug(`meta-bind | MetadataManager >> updating frontmatter of "${e.file.path}" to`,e.metadata),await this.plugin.app.fileManager.processFrontMatter(e.file,r=>{e.changed=!1,Object.assign(r,e.metadata)})}updateCache(e,r,n){console.debug(`meta-bind | MetadataManager >> updating metadata in ${r} metadata cache to`,e);let i=this.getCacheForFile(r);!i||(i.metadata=e,i.cyclesSinceLastChange=0,i.changed=!0,this.notifyListeners(i,void 0,n))}updatePropertyInCache(e,r,n,i){console.debug(`meta-bind | MetadataManager >> updating "${JSON.stringify(r)}" in "${n}" metadata cache to`,e);let a=this.getCacheForFile(n);if(!a)return;let{parent:o,child:c}=N1(r,a.metadata);if(o.value===void 0)throw Error(`The parent of "${JSON.stringify(r)}" does not exist in Object, please create the parent first`);if(c.value===e){console.debug(`meta-bind | MetadataManager >> skipping redundant update of "${JSON.stringify(r)}" in "${n}" metadata cache`,e);return}o.value[c.key]=e,a.cyclesSinceLastChange=0,a.changed=!0,this.notifyListeners(a,r,i)}updateCacheOnFrontmatterUpdate(e,r,n){let i=this.getCacheForFile(e);if(!i||i.cyclesSinceLastChange<xR)return;let a=Object.assign({},n.frontmatter);delete a.position,console.debug(`meta-bind | MetadataManager >> updating "${e}" on frontmatter update`,a),i.metadata=a,this.notifyListeners(i)}notifyListeners(e,r,n){let i;r&&(i=(0,Ts.traverseObjectByPath)(r,e.metadata));for(let a of e.listeners)if(!(n&&n===a.uuid))if(r)C1(r,a.metadataPath)&&(console.debug(`meta-bind | MetadataManager >> notifying input field ${a.uuid} of updated metadata value`,i),a.callback(i));else{let o=(0,Ts.traverseObjectByPath)(a.metadataPath,e.metadata);console.debug(`meta-bind | MetadataManager >> notifying input field ${a.uuid} of updated metadata`,a.metadataPath,e.metadata,o),a.callback(o)}}};var fl=class{constructor(e,r,n){this.api=e,this.filePath=r,this.container=n}createInputField(e,r,n){if(!this.container)throw new Error('inline API was instanced without a container, please use "createInputFieldInContainer"');return this.api.createInputField(e,r,n,this.filePath,this.container)}createInputFieldInContainer(e,r,n,i){return this.api.createInputField(e,r,n,this.filePath,i)}createInputFieldFromString(e,r,n){if(!this.container)throw new Error('inline API was instanced without a container, please use "createInputFieldFromStringInContainer"');return this.api.createInputFieldFromString(e,r,n,this.container)}createInputFieldFromStringInContainer(e,r,n,i){return this.api.createInputFieldFromString(e,r,n,i)}createDeclaration(e,r){return this.api.createInputFieldDeclaration(e,r)}createDeclarationFromString(e){return this.api.createInputFieldDeclarationFromString(e)}bindDeclaration(e,r,n){return this.api.bindInputFieldDeclaration(e,r,n)}};var ml=class{constructor(){this.roundBracesPair=new Cn("(",")");this.squareBracesPair=new Cn("[","]");this.curlyBracesPair=new Cn("{","}");this.allBracesPairs=[this.roundBracesPair,this.squareBracesPair,this.curlyBracesPair]}parseString(e){let r={};r.errorCollection=new Nn("ViewFieldDeclaration");try{r.fullDeclaration=e;let n=sr.getInBetween(e,this.squareBracesPair);if(Array.isArray(n))throw new or("CRITICAL","invalid view field declaration","expected exactly one square braces pair");r.declaration=n;let i=sr.getInBetween(r.declaration,this.curlyBracesPair);Array.isArray(i)?r.bindTargets=i:r.bindTargets=[i]}catch(n){r.errorCollection.add(n)}return r}parseJsString(e){let r={};r.errorCollection=new Nn("JsViewFieldDeclaration");try{r.fullDeclaration=e;let n=sr.split(r.fullDeclaration,`
---
`);if(n.length===1)throw new or("CRITICAL","failed to parse view field declaration",'missing "---"');r.variables=n[0],r.code=n.slice(1).join(`
---
`);let i=sr.split(r.variables,`
`);r.bindTargets=[];for(let a of i){let o=sr.split(a," as ");if(o.length!==2)throw new or("CRITICAL","failed to parse variable",'expected variable to include exactly one " as "');let c=o[0].trim();if(c.startsWith("{")&&c.endsWith("}"))c=c.substring(1,c.length-1);else throw new or("CRITICAL","failed to parse variable",'expected bind target to be wrapped with "{}"');if(!this.isValidVariableName(o[1]))throw new or("CRITICAL","failed to parse variable","invalid variable name");r.bindTargets.push({bindTarget:c,name:o[1]})}}catch(n){r.errorCollection.add(n)}return r}isValidVariableName(e){if(!e)throw new or("WARNING","failed to parse variable","variable name can not be empty");if(e.contains(" "))throw new or("WARNING","failed to parse variable","variable name can not contain a space");return!0}};var cw=Yt(Wa()),pl=class{constructor(e){this.plugin=e}parseBindTarget(e,r){if(!e)throw new ui("CRITICAL","failed to parse bind target","bind target is empty");let n={},i=e.split("#");if(i.length===1)n.fileName=r,n.metadataFieldName=e;else if(i.length===2)n.fileName=i[0],n.metadataFieldName=i[1];else throw new ui("CRITICAL","failed to parse bind target","bind target may only contain one '#' to specify the metadata field");try{n.metadataPath=(0,cw.parsePath)(n.metadataFieldName)}catch(o){if(o instanceof Error)throw new ui("CRITICAL","failed to parse bind target",`bind target path parsing error: ${o==null?void 0:o.message}`)}let a=this.plugin.getFilePathsByName(n.fileName);if(a.length===0)throw new ui("CRITICAL","failed to parse bind target","bind target file not found");if(a.length===1)n.filePath=a[0];else throw new ui("CRITICAL","failed to parse bind target","bind target resolves to multiple files, please also specify the file path");return n}};var Co=class{constructor(e){this.viewFieldMDRC=e}render(e){this.container=e,this.update()}async update(){if(!!this.container)try{this.container.innerText=await this.viewFieldMDRC.evaluateExpression(),this.container.removeClass("meta-bind-plugin-error")}catch(e){e instanceof Error&&(this.container.innerText=e.message,this.container.addClass("meta-bind-plugin-error"))}}};function et(){return et=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},et.apply(this,arguments)}var xm={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function He(t){return typeof t=="number"}function Le(t){return!t||typeof t!="object"||typeof t.constructor!="function"?!1:t.isBigNumber===!0&&typeof t.constructor.prototype=="object"&&t.constructor.prototype.isBigNumber===!0||typeof t.constructor.isDecimal=="function"&&t.constructor.isDecimal(t)===!0}function Wt(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isComplex===!0||!1}function Ti(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isFraction===!0||!1}function mn(t){return t&&t.constructor.prototype.isUnit===!0||!1}function lt(t){return typeof t=="string"}var lr=Array.isArray;function Fe(t){return t&&t.constructor.prototype.isMatrix===!0||!1}function St(t){return Array.isArray(t)||Fe(t)}function Ta(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function Jn(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function No(t){return t&&t.constructor.prototype.isRange===!0||!1}function Wi(t){return t&&t.constructor.prototype.isIndex===!0||!1}function fw(t){return typeof t=="boolean"}function mw(t){return t&&t.constructor.prototype.isResultSet===!0||!1}function dl(t){return t&&t.constructor.prototype.isHelp===!0||!1}function pw(t){return typeof t=="function"}function dw(t){return t instanceof Date}function hw(t){return t instanceof RegExp}function Os(t){return!!(t&&typeof t=="object"&&t.constructor===Object&&!Wt(t)&&!Ti(t))}function vw(t){return t===null}function gw(t){return t===void 0}function pn(t){return t&&t.isAccessorNode===!0&&t.constructor.prototype.isNode===!0||!1}function _t(t){return t&&t.isArrayNode===!0&&t.constructor.prototype.isNode===!0||!1}function yw(t){return t&&t.isAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function xw(t){return t&&t.isBlockNode===!0&&t.constructor.prototype.isNode===!0||!1}function Dw(t){return t&&t.isConditionalNode===!0&&t.constructor.prototype.isNode===!0||!1}function Xe(t){return t&&t.isConstantNode===!0&&t.constructor.prototype.isNode===!0||!1}function Bs(t){return Xe(t)||Rr(t)&&t.args.length===1&&Xe(t.args[0])&&"-+~".includes(t.op)}function vi(t){return t&&t.isFunctionAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gt(t){return t&&t.isFunctionNode===!0&&t.constructor.prototype.isNode===!0||!1}function Mn(t){return t&&t.isIndexNode===!0&&t.constructor.prototype.isNode===!0||!1}function er(t){return t&&t.isNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gi(t){return t&&t.isObjectNode===!0&&t.constructor.prototype.isNode===!0||!1}function Rr(t){return t&&t.isOperatorNode===!0&&t.constructor.prototype.isNode===!0||!1}function Rt(t){return t&&t.isParenthesisNode===!0&&t.constructor.prototype.isNode===!0||!1}function bw(t){return t&&t.isRangeNode===!0&&t.constructor.prototype.isNode===!0||!1}function ww(t){return t&&t.isRelationalNode===!0&&t.constructor.prototype.isNode===!0||!1}function Mr(t){return t&&t.isSymbolNode===!0&&t.constructor.prototype.isNode===!0||!1}function hl(t){return t&&t.constructor.prototype.isChain===!0||!1}function nr(t){var e=typeof t;return e==="object"?t===null?"null":Le(t)?"BigNumber":t.constructor&&t.constructor.name?t.constructor.name:"Object":e}function Ie(t){var e=typeof t;if(e==="number"||e==="string"||e==="boolean"||t===null||t===void 0)return t;if(typeof t.clone=="function")return t.clone();if(Array.isArray(t))return t.map(function(r){return Ie(r)});if(t instanceof Date)return new Date(t.valueOf());if(Le(t))return t;if(t instanceof RegExp)throw new TypeError("Cannot clone "+t);return bR(t,Ie)}function bR(t,e){var r={};for(var n in t)Te(t,n)&&(r[n]=e(t[n]));return r}function vl(t,e){for(var r in e)Te(e,r)&&(t[r]=e[r]);return t}function Zi(t,e){var r,n,i;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;n++)if(!Zi(t[n],e[n]))return!1;return!0}else{if(typeof t=="function")return t===e;if(t instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(r in t)if(!(r in e)||!Zi(t[r],e[r]))return!1;for(r in e)if(!(r in t))return!1;return!0}else return t===e}}function Ew(t,e,r){var n=!0,i;Object.defineProperty(t,e,{get:function(){return n&&(i=r(),n=!1),i},set:function(o){i=o,n=!1},configurable:!0,enumerable:!0})}function Te(t,e){return t&&Object.hasOwnProperty.call(t,e)}function Cw(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],a=t[i];a!==void 0&&(r[i]=a)}return r}var Nw=["Matrix","Array"],Aw=["number","BigNumber","Fraction"];var de=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(xm)};et(de,xm,{MATRIX_OPTIONS:Nw,NUMBER_OPTIONS:Aw});var Bm=Yt(wm(),1);function Ae(t){return typeof t=="boolean"?!0:isFinite(t)?t===Math.round(t):!1}var Tn=Math.sign||function(t){return t>0?1:t<0?-1:0},Fw=Math.log2||function(e){return Math.log(e)/Math.LN2},Sw=Math.log10||function(e){return Math.log(e)/Math.LN10},gl=Math.log1p||function(t){return Math.log(t+1)},Mw=Math.cbrt||function(e){if(e===0)return e;var r=e<0,n;return r&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,r?-n:n},Tw=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Em(t,e,r){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!Ae(r))throw new Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!Ae(t))throw new Error("Value must be an integer");t<0&&(t=t+2**r),a="i".concat(r)}var o="";return t<0&&(t=-t,o="-"),"".concat(o).concat(i).concat(t.toString(e)).concat(a)}function Xn(t,e){if(typeof e=="function")return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var r="auto",n,i;if(e&&(e.notation&&(r=e.notation),He(e)?n=e:He(e.precision)&&(n=e.precision),e.wordSize&&(i=e.wordSize,typeof i!="number")))throw new Error('Option "wordSize" must be a number');switch(r){case"fixed":return Cm(t,n);case"exponential":return Ow(t,n);case"engineering":return wR(t,n);case"bin":return Em(t,2,i);case"oct":return Em(t,8,i);case"hex":return Em(t,16,i);case"auto":return ER(t,n,e&&e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function yl(t){var e=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(c){return i-=c.length,""}).replace(/0*$/,"").split("").map(function(c){return parseInt(c)});return o.length===0&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function wR(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=yl(t),n=xl(r,e),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(He(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var c=Math.abs(i-o)-(a.length-1),u=0;u<c;u++)a.push(0);for(var s=Math.abs(i-o),l=1;s>0;)l++,s--;var f=a.slice(l).join(""),m=He(e)&&f.length||f.match(/[1-9]/)?"."+f:"",p=a.slice(0,l).join("")+m+"e"+(i>=0?"+":"")+o.toString();return n.sign+p}function Cm(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=yl(t),n=typeof e=="number"?xl(r,r.exponent+1+e):r,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(Ao(o-i.length))),a<0&&(i=Ao(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function Ow(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=yl(t),n=e?xl(r,e):r,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(Ao(e-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ER(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=r&&r.lowerExp!==void 0?r.lowerExp:-3,i=r&&r.upperExp!==void 0?r.upperExp:5,a=yl(t),o=e?xl(a,e):a;if(o.exponent<n||o.exponent>=i)return Ow(t,e);var c=o.coefficients,u=o.exponent;c.length<e&&(c=c.concat(Ao(e-c.length))),c=c.concat(Ao(u-c.length+1+(c.length<e?e-c.length:0))),c=Ao(-u).concat(c);var s=u>0?u:0;return s<c.length-1&&c.splice(s+1,0,"."),o.sign+c.join("")}function xl(t,e){for(var r={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=r.coefficients;e<=0;)n.unshift(0),r.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var a=e-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r}function Ao(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}function Bw(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var CR=Number.EPSILON||2220446049250313e-31;function ct(t,e,r){if(r==null)return t===e;if(t===e)return!0;if(isNaN(t)||isNaN(e))return!1;if(isFinite(t)&&isFinite(e)){var n=Math.abs(t-e);return n<CR?!0:n<=Math.max(Math.abs(t),Math.abs(e))*r}return!1}var Iw=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},_w=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},Rw=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},Dl=Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))/2},Pw=Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2},bl=Math.tanh||function(t){var e=Math.exp(2*t);return(e-1)/(e+1)};function Lw(t,e){var r=t>0?!0:t<0?!1:1/t===1/0,n=e>0?!0:e<0?!1:1/e===1/0;return r^n?-t:t}function Nm(t,e,r){var n=t.constructor,i=new n(2),a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!Ae(r))throw new Error("size must be an integer");if(t.greaterThan(i.pow(r-1).sub(1))||t.lessThan(i.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t.isInteger())throw new Error("Value must be an integer");t.lessThan(0)&&(t=t.add(i.pow(r))),a="i".concat(r)}switch(e){case 2:return"".concat(t.toBinary()).concat(a);case 8:return"".concat(t.toOctal()).concat(a);case 16:return"".concat(t.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function qw(t,e){if(typeof e=="function")return e(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var r="auto",n,i;if(e!==void 0&&(e.notation&&(r=e.notation),typeof e=="number"?n=e:e.precision!==void 0&&(n=e.precision),e.wordSize&&(i=e.wordSize,typeof i!="number")))throw new Error('Option "wordSize" must be a number');switch(r){case"fixed":return AR(t,n);case"exponential":return kw(t,n);case"engineering":return NR(t,n);case"bin":return Nm(t,2,i);case"oct":return Nm(t,8,i);case"hex":return Nm(t,16,i);case"auto":{var a=e&&e.lowerExp!==void 0?e.lowerExp:-3,o=e&&e.upperExp!==void 0?e.upperExp:5;if(t.isZero())return"0";var c,u=t.toSignificantDigits(n),s=u.e;return s>=a&&s<o?c=u.toFixed():c=kw(t,n),c.replace(/((\.\d*?)(0+))($|e)/,function(){var l=arguments[2],f=arguments[4];return l!=="."?l+f:f})}default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function NR(t,e){var r=t.e,n=r%3===0?r:r<0?r-3-r%3:r-r%3,i=t.mul(Math.pow(10,-n)),a=i.toPrecision(e);if(a.indexOf("e")!==-1){var o=t.constructor;a=new o(a).toFixed()}return a+"e"+(r>=0?"+":"")+n.toString()}function kw(t,e){return e!==void 0?t.toExponential(e-1):t.toExponential()}function AR(t,e){return t.toFixed(e)}function zw(t,e){var r=t.length-e.length,n=t.length;return t.substring(r,n)===e}function qe(t,e){var r=FR(t,e);return e&&typeof e=="object"&&"truncate"in e&&r.length>e.truncate?r.substring(0,e.truncate-3)+"...":r}function FR(t,e){if(typeof t=="number")return Xn(t,e);if(Le(t))return qw(t,e);if(SR(t))return!e||e.fraction!=="decimal"?t.s*t.n+"/"+t.d:t.toString();if(Array.isArray(t))return Uw(t,e);if(lt(t))return'"'+t+'"';if(typeof t=="function")return t.syntax?String(t.syntax):"function";if(t&&typeof t=="object"){if(typeof t.format=="function")return t.format(e);if(t&&t.toString(e)!=={}.toString())return t.toString(e);var r=Object.keys(t).map(n=>'"'+n+'": '+qe(t[n],e));return"{"+r.join(", ")+"}"}return String(t)}function Is(t){for(var e=String(t),r="",n=0;n<e.length;){var i=e.charAt(n);i==="\\"?(r+=i,n++,i=e.charAt(n),(i===""||'"\\/bfnrtu'.indexOf(i)===-1)&&(r+="\\"),r+=i):i==='"'?r+='\\"':r+=i,n++}return'"'+r+'"'}function Ct(t){var e=String(t);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function Uw(t,e){if(Array.isArray(t)){for(var r="[",n=t.length,i=0;i<n;i++)i!==0&&(r+=", "),r+=Uw(t[i],e);return r+="]",r}else return qe(t,e)}function SR(t){return t&&typeof t=="object"&&typeof t.s=="number"&&typeof t.n=="number"&&typeof t.d=="number"||!1}function wl(t,e){if(!lt(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+nr(t)+", index: 0)");if(!lt(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+nr(e)+", index: 1)");return t===e?0:t>e?1:-1}function Ue(t,e,r){if(!(this instanceof Ue))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Ue.prototype=new RangeError;Ue.prototype.constructor=RangeError;Ue.prototype.name="DimensionError";Ue.prototype.isDimensionError=!0;function Pt(t,e,r){if(!(this instanceof Pt))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=r),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}Pt.prototype=new RangeError;Pt.prototype.constructor=RangeError;Pt.prototype.name="IndexError";Pt.prototype.isIndexError=!0;function ze(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function Vw(t,e,r){var n,i=t.length;if(i!==e[r])throw new Ue(i,e[r]);if(r<e.length-1){var a=r+1;for(n=0;n<i;n++){var o=t[n];if(!Array.isArray(o))throw new Ue(e.length-1,e.length,"<");Vw(t[n],e,a)}}else for(n=0;n<i;n++)if(Array.isArray(t[n]))throw new Ue(e.length+1,e.length,">")}function Fm(t,e){var r=e.length===0;if(r){if(Array.isArray(t))throw new Ue(t.length,0)}else Vw(t,e,0)}function xr(t,e){if(!He(t)||!Ae(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||typeof e=="number"&&t>=e)throw new Pt(t,e)}function Qn(t,e,r){if(!Array.isArray(t)||!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(!He(i)||!Ae(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+qe(e)+")")});var n=r!==void 0?r:0;return Am(t,e,0,n),t}function Am(t,e,r,n){var i,a,o=t.length,c=e[r],u=Math.min(o,c);if(t.length=c,r<e.length-1){var s=r+1;for(i=0;i<u;i++)a=t[i],Array.isArray(a)||(a=[a],t[i]=a),Am(a,e,s,n);for(i=u;i<c;i++)a=[],t[i]=a,Am(a,e,s,n)}else{for(i=0;i<u;i++)for(;Array.isArray(t[i]);)t[i]=t[i][0];for(i=u;i<c;i++)t[i]=n}}function El(t,e){var r=Ge(t),n=r.length;if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Ue(0,n,"!=");e=_s(e,n);var i=$w(e);if(n!==i)throw new Ue(i,n,"!=");try{return MR(r,e)}catch(a){throw a instanceof Ue?new Ue(i,n,"!="):a}}function _s(t,e){var r=$w(t),n=t.slice(),i=-1,a=t.indexOf(i),o=t.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var c=a>=0,u=e%r===0;if(c)if(u)n[a]=-e/r;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-r);return n}function $w(t){return t.reduce((e,r)=>e*r,1)}function MR(t,e){for(var r=t,n,i=e.length-1;i>0;i--){var a=e[i];n=[];for(var o=r.length/a,c=0;c<o;c++)n.push(r.slice(c*a,(c+1)*a));r=n}return r}function Fo(t,e){for(var r=e||ze(t);Array.isArray(t)&&t.length===1;)t=t[0],r.shift();for(var n=r.length;r[n-1]===1;)n--;return n<r.length&&(t=Hw(t,n,0),r.length=n),t}function Hw(t,e,r){var n,i;if(r<e){var a=r+1;for(n=0,i=t.length;n<i;n++)t[n]=Hw(t[n],e,a)}else for(;Array.isArray(t);)t=t[0];return t}function Cl(t,e,r,n){var i=n||ze(t);if(r)for(var a=0;a<r;a++)t=[t],i.unshift(1);for(t=Ww(t,e,0);i.length<e;)i.push(1);return t}function Ww(t,e,r){var n,i;if(Array.isArray(t)){var a=r+1;for(n=0,i=t.length;n<i;n++)t[n]=Ww(t[n],e,a)}else for(var o=r;o<e;o++)t=[t];return t}function Ge(t){if(!Array.isArray(t))return t;var e=[];return t.forEach(function r(n){Array.isArray(n)?n.forEach(r):e.push(n)}),e}function Xt(t,e){return Array.prototype.map.call(t,e)}function ji(t,e){Array.prototype.forEach.call(t,e)}function Nl(t,e){if(ze(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,e)}function So(t,e){if(ze(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,r=>e.test(r))}function Sm(t,e){return Array.prototype.join.call(t,e)}function Oi(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(t.length===0)return t;var e=[],r=0;e[0]={value:t[0],identifier:0};for(var n=1;n<t.length;n++)t[n]===t[n-1]?r++:r=0,e.push({value:t[n],identifier:r});return e}function Mo(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(t.length===0)return t;for(var e=[],r=0;r<t.length;r++)e.push(t[r].value);return e}function Yi(t,e){for(var r,n=0,i=0;i<t.length;i++){var a=t[i],o=Array.isArray(a);if(i===0&&o&&(n=a.length),o&&a.length!==n)return;var c=o?Yi(a,e):e(a);if(r===void 0)r=c;else if(r!==c)return"mixed"}return r}function A(t,e,r,n){function i(a){var o=Cw(a,e.map(BR));return TR(t,e,a),r(o)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function TR(t,e,r){var n=e.filter(a=>!OR(a)).every(a=>r[a]!==void 0);if(!n){var i=e.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function OR(t){return t&&t[0]==="?"}function BR(t){return t&&t[0]==="?"?t.slice(1):t}function rt(t,e){if(jw(t)&&Al(t,e))return t[e];throw typeof t[e]=="function"&&Fl(t,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function gi(t,e,r){if(jw(t)&&Al(t,e))return t[e]=r,r;throw new Error('No access to property "'+e+'"')}function Gw(t,e){return e in t}function Al(t,e){return!t||typeof t!="object"?!1:Te(IR,e)?!0:!(e in Object.prototype||e in Function.prototype)}function Zw(t,e){if(!Fl(t,e))throw new Error('No access to method "'+e+'"')}function Fl(t,e){return t==null||typeof t[e]!="function"||Te(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t)?!1:Te(_R,e)?!0:!(e in Object.prototype||e in Function.prototype)}function jw(t){return typeof t=="object"&&t&&t.constructor===Object}var IR={length:!0,name:!0},_R={toString:!0,valueOf:!0,toLocaleString:!0};var Rs=class{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return rt(this.wrappedObject,e)}set(e,r){return gi(this.wrappedObject,e,r),this}has(e){return Gw(this.wrappedObject,e)}};function yi(){return new Map}function Bi(t){if(!t)return yi();if(Sl(t))return t;if(Os(t))return new Rs(t);throw new Error("createMap can create maps from objects or Maps")}function Yw(t){if(t instanceof Rs)return t.wrappedObject;var e={};for(var r of t.keys()){var n=t.get(r);gi(e,r,n)}return e}function Sl(t){return t?t instanceof Map||t instanceof Rs||typeof t.set=="function"&&typeof t.get=="function"&&typeof t.keys=="function"&&typeof t.has=="function":!1}function Mm(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];for(var i of r)if(!!i){if(Sl(i))for(var a of i.keys())t.set(a,i.get(a));else if(Os(i))for(var o of Object.keys(i))t.set(o,i[o])}return t}var Jw=function(){return Jw=Bm.default.create,Bm.default},RR=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Im=A("typed",RR,function(e){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=e,o=Jw();return o.clear(),o.addTypes([{name:"number",test:He},{name:"Complex",test:Wt},{name:"BigNumber",test:Le},{name:"Fraction",test:Ti},{name:"Unit",test:mn},{name:"identifier",test:c=>lt&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(c)},{name:"string",test:lt},{name:"Chain",test:hl},{name:"Array",test:lr},{name:"Matrix",test:Fe},{name:"DenseMatrix",test:Ta},{name:"SparseMatrix",test:Jn},{name:"Range",test:No},{name:"Index",test:Wi},{name:"boolean",test:fw},{name:"ResultSet",test:mw},{name:"Help",test:dl},{name:"function",test:pw},{name:"Date",test:dw},{name:"RegExp",test:hw},{name:"null",test:vw},{name:"undefined",test:gw},{name:"AccessorNode",test:pn},{name:"ArrayNode",test:_t},{name:"AssignmentNode",test:yw},{name:"BlockNode",test:xw},{name:"ConditionalNode",test:Dw},{name:"ConstantNode",test:Xe},{name:"FunctionNode",test:Gt},{name:"FunctionAssignmentNode",test:vi},{name:"IndexNode",test:Mn},{name:"Node",test:er},{name:"ObjectNode",test:Gi},{name:"OperatorNode",test:Rr},{name:"ParenthesisNode",test:Rt},{name:"RangeNode",test:bw},{name:"RelationalNode",test:ww},{name:"SymbolNode",test:Mr},{name:"Map",test:Sl},{name:"Object",test:Os}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(u){if(r||Tm(u),Bw(u)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+u+"). Use function bignumber(x) to convert to BigNumber.");return new r(u)}},{from:"number",to:"Complex",convert:function(u){return n||Ml(u),new n(u,0)}},{from:"BigNumber",to:"Complex",convert:function(u){return n||Ml(u),new n(u.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(u){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(u){return n||Ml(u),new n(u.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(u){a||Om(u);var s=new a(u);if(s.valueOf()!==u)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+u+"). Use function fraction(x) to convert to Fraction.");return s}},{from:"string",to:"number",convert:function(u){var s=Number(u);if(isNaN(s))throw new Error('Cannot convert "'+u+'" to a number');return s}},{from:"string",to:"BigNumber",convert:function(u){r||Tm(u);try{return new r(u)}catch(s){throw new Error('Cannot convert "'+u+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(u){a||Om(u);try{return new a(u)}catch(s){throw new Error('Cannot convert "'+u+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(u){n||Ml(u);try{return new n(u)}catch(s){throw new Error('Cannot convert "'+u+'" to Complex')}}},{from:"boolean",to:"number",convert:function(u){return+u}},{from:"boolean",to:"BigNumber",convert:function(u){return r||Tm(u),new r(+u)}},{from:"boolean",to:"Fraction",convert:function(u){return a||Om(u),new a(+u)}},{from:"boolean",to:"string",convert:function(u){return String(u)}},{from:"Array",to:"Matrix",convert:function(u){return i||PR(),new i(u)}},{from:"Matrix",to:"Array",convert:function(u){return u.valueOf()}}]),o.onMismatch=(c,u,s)=>{var l=o.createError(c,u,s);if(["wrongType","mismatch"].includes(l.data.category)&&u.length===1&&St(u[0])&&s.some(m=>!m.params.includes(","))){var f=new TypeError("Function '".concat(c,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(c,")'."));throw f.data=l.data,f}throw l},o.onMismatch=(c,u,s)=>{var l=o.createError(c,u,s);if(["wrongType","mismatch"].includes(l.data.category)&&u.length===1&&St(u[0])&&s.some(m=>!m.params.includes(","))){var f=new TypeError("Function '".concat(c,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(c,")'."));throw f.data=l.data,f}throw l},o});function Tm(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function Ml(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function PR(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Om(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var LR="ResultSet",kR=[],_m=A(LR,kR,()=>{function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(e){return new t(e.entries)},t},{isClass:!0});var To=9e15,Ki=1e9,Rm="0123456789abcdef",Ol="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Bl="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Pm={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-To,maxE:To,crypto:!1},eE,Ii,rr=!0,_l="[DecimalError] ",Qi=_l+"Invalid argument: ",rE=_l+"Precision limit exceeded",tE=_l+"crypto unavailable",nE="[object Decimal]",Ut=Math.floor,Nt=Math.pow,qR=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,zR=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,UR=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,iE=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ei=1e7,je=7,VR=9007199254740991,$R=Ol.length-1,Lm=Bl.length-1,ye={toStringTag:nE};ye.absoluteValue=ye.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ve(t)};ye.ceil=function(){return Ve(new this.constructor(this),this.e+1,2)};ye.clampedTo=ye.clamp=function(t,e){var r,n=this,i=n.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(Qi+e);return r=n.cmp(t),r<0?t:n.cmp(e)>0?e:new i(n)};ye.comparedTo=ye.cmp=function(t){var e,r,n,i,a=this,o=a.d,c=(t=new a.constructor(t)).d,u=a.s,s=t.s;if(!o||!c)return!u||!s?NaN:u!==s?u:o===c?0:!o^u<0?1:-1;if(!o[0]||!c[0])return o[0]?u:c[0]?-s:0;if(u!==s)return u;if(a.e!==t.e)return a.e>t.e^u<0?1:-1;for(n=o.length,i=c.length,e=0,r=n<i?n:i;e<r;++e)if(o[e]!==c[e])return o[e]>c[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1};ye.cosine=ye.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+je,n.rounding=1,r=HR(n,lE(n,r)),n.precision=t,n.rounding=e,Ve(Ii==2||Ii==3?r.neg():r,t,e,!0)):new n(1):new n(NaN)};ye.cubeRoot=ye.cbrt=function(){var t,e,r,n,i,a,o,c,u,s,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(rr=!1,a=l.s*Nt(l.s*l,1/3),!a||Math.abs(a)==1/0?(r=Lt(l.d),t=l.e,(a=(t-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=Nt(r,1/3),t=Ut((t+1)/3)-(t%3==(t<0?-1:2)),a==1/0?r="5e"+t:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t),n=new f(r),n.s=l.s):n=new f(a.toString()),o=(t=f.precision)+3;;)if(c=n,u=c.times(c).times(c),s=u.plus(l),n=qr(s.plus(l).times(c),s.plus(u),o+2,1),Lt(c.d).slice(0,o)===(r=Lt(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ve(c,t+1,0),c.times(c).times(c).eq(l))){n=c;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Ve(n,t+1,1),e=!n.times(n).times(n).eq(l));break}return rr=!0,Ve(n,t,f.rounding,e)};ye.decimalPlaces=ye.dp=function(){var t,e=this.d,r=NaN;if(e){if(t=e.length-1,r=(t-Ut(this.e/je))*je,t=e[t],t)for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r};ye.dividedBy=ye.div=function(t){return qr(this,new this.constructor(t))};ye.dividedToIntegerBy=ye.divToInt=function(t){var e=this,r=e.constructor;return Ve(qr(e,new r(t),0,1,1),r.precision,r.rounding)};ye.equals=ye.eq=function(t){return this.cmp(t)===0};ye.floor=function(){return Ve(new this.constructor(this),this.e+1,3)};ye.greaterThan=ye.gt=function(t){return this.cmp(t)>0};ye.greaterThanOrEqualTo=ye.gte=function(t){var e=this.cmp(t);return e==1||e===0};ye.hyperbolicCosine=ye.cosh=function(){var t,e,r,n,i,a=this,o=a.constructor,c=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return c;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(t=Math.ceil(i/3),e=(1/Pl(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),a=Oo(o,1,a.times(e),new o(1),!0);for(var u,s=t,l=new o(8);s--;)u=a.times(a),a=c.minus(u.times(l.minus(u.times(l))));return Ve(a,o.precision=r,o.rounding=n,!0)};ye.hyperbolicSine=ye.sinh=function(){var t,e,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=Oo(a,2,i,i,!0);else{t=1.4*Math.sqrt(n),t=t>16?16:t|0,i=i.times(1/Pl(5,t)),i=Oo(a,2,i,i,!0);for(var o,c=new a(5),u=new a(16),s=new a(20);t--;)o=i.times(i),i=i.times(c.plus(o.times(u.times(o).plus(s))))}return a.precision=e,a.rounding=r,Ve(i,e,r,!0)};ye.hyperbolicTangent=ye.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,qr(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)};ye.inverseCosine=ye.acos=function(){var t,e=this,r=e.constructor,n=e.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?n===0?e.isNeg()?Kn(r,i,a):new r(0):new r(NaN):e.isZero()?Kn(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,e=e.asin(),t=Kn(r,i+4,a).times(.5),r.precision=i,r.rounding=a,t.minus(e))};ye.inverseHyperbolicCosine=ye.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,rr=!1,r=r.times(r).minus(1).sqrt().plus(r),rr=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)};ye.inverseHyperbolicSine=ye.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,rr=!1,r=r.times(r).plus(1).sqrt().plus(r),rr=!0,n.precision=t,n.rounding=e,r.ln())};ye.inverseHyperbolicTangent=ye.atanh=function(){var t,e,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=a.precision,e=a.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?Ve(new a(i),t,e,!0):(a.precision=r=n-i.e,i=qr(i.plus(1),new a(1).minus(i),r+t,1),a.precision=t+4,a.rounding=1,i=i.ln(),a.precision=t,a.rounding=e,i.times(.5))):new a(NaN)};ye.inverseSine=ye.asin=function(){var t,e,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),r=a.precision,n=a.rounding,e!==-1?e===0?(t=Kn(a,r+4,n).times(.5),t.s=i.s,t):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))};ye.inverseTangent=ye.atan=function(){var t,e,r,n,i,a,o,c,u,s=this,l=s.constructor,f=l.precision,m=l.rounding;if(s.isFinite()){if(s.isZero())return new l(s);if(s.abs().eq(1)&&f+4<=Lm)return o=Kn(l,f+4,m).times(.25),o.s=s.s,o}else{if(!s.s)return new l(NaN);if(f+4<=Lm)return o=Kn(l,f+4,m).times(.5),o.s=s.s,o}for(l.precision=c=f+10,l.rounding=1,r=Math.min(28,c/je+2|0),t=r;t;--t)s=s.div(s.times(s).plus(1).sqrt().plus(1));for(rr=!1,e=Math.ceil(c/je),n=1,u=s.times(s),o=new l(s),i=s;t!==-1;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),o=a.plus(i.div(n+=2)),o.d[e]!==void 0)for(t=e;o.d[t]===a.d[t]&&t--;);return r&&(o=o.times(2<<r-1)),rr=!0,Ve(o,l.precision=f,l.rounding=m,!0)};ye.isFinite=function(){return!!this.d};ye.isInteger=ye.isInt=function(){return!!this.d&&Ut(this.e/je)>this.d.length-2};ye.isNaN=function(){return!this.s};ye.isNegative=ye.isNeg=function(){return this.s<0};ye.isPositive=ye.isPos=function(){return this.s>0};ye.isZero=function(){return!!this.d&&this.d[0]===0};ye.lessThan=ye.lt=function(t){return this.cmp(t)<0};ye.lessThanOrEqualTo=ye.lte=function(t){return this.cmp(t)<1};ye.logarithm=ye.log=function(t){var e,r,n,i,a,o,c,u,s=this,l=s.constructor,f=l.precision,m=l.rounding,p=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),r=t.d,t.s<0||!r||!r[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(r=s.d,s.s<0||!r||!r[0]||s.eq(1))return new l(r&&!r[0]?-1/0:s.s!=1?NaN:r?0:1/0);if(e)if(r.length>1)a=!0;else{for(i=r[0];i%10===0;)i/=10;a=i!==1}if(rr=!1,c=f+p,o=Xi(s,c),n=e?Il(l,c+10):Xi(t,c),u=qr(o,n,c,1),Ps(u.d,i=f,m))do if(c+=10,o=Xi(s,c),n=e?Il(l,c+10):Xi(t,c),u=qr(o,n,c,1),!a){+Lt(u.d).slice(i+1,i+15)+1==1e14&&(u=Ve(u,f+1,0));break}while(Ps(u.d,i+=10,m));return rr=!0,Ve(u,f,m)};ye.minus=ye.sub=function(t){var e,r,n,i,a,o,c,u,s,l,f,m,p=this,h=p.constructor;if(t=new h(t),!p.d||!t.d)return!p.s||!t.s?t=new h(NaN):p.d?t.s=-t.s:t=new h(t.d||p.s!==t.s?p:NaN),t;if(p.s!=t.s)return t.s=-t.s,p.plus(t);if(s=p.d,m=t.d,c=h.precision,u=h.rounding,!s[0]||!m[0]){if(m[0])t.s=-t.s;else if(s[0])t=new h(p);else return new h(u===3?-0:0);return rr?Ve(t,c,u):t}if(r=Ut(t.e/je),l=Ut(p.e/je),s=s.slice(),a=l-r,a){for(f=a<0,f?(e=s,a=-a,o=m.length):(e=m,r=l,o=s.length),n=Math.max(Math.ceil(c/je),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=m.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(s[n]!=m[n]){f=s[n]<m[n];break}a=0}for(f&&(e=s,s=m,m=e,t.s=-t.s),o=s.length,n=m.length-o;n>0;--n)s[o++]=0;for(n=m.length;n>a;){if(s[--n]<m[n]){for(i=n;i&&s[--i]===0;)s[i]=ei-1;--s[i],s[n]+=ei}s[n]-=m[n]}for(;s[--o]===0;)s.pop();for(;s[0]===0;s.shift())--r;return s[0]?(t.d=s,t.e=Rl(s,r),rr?Ve(t,c,u):t):new h(u===3?-0:0)};ye.modulo=ye.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?Ve(new n(r),n.precision,n.rounding):(rr=!1,n.modulo==9?(e=qr(r,t.abs(),0,3,1),e.s*=t.s):e=qr(r,t,0,n.modulo,1),e=e.times(t),rr=!0,r.minus(e))};ye.naturalExponential=ye.exp=function(){return km(this)};ye.naturalLogarithm=ye.ln=function(){return Xi(this)};ye.negated=ye.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ve(t)};ye.plus=ye.add=function(t){var e,r,n,i,a,o,c,u,s,l,f=this,m=f.constructor;if(t=new m(t),!f.d||!t.d)return!f.s||!t.s?t=new m(NaN):f.d||(t=new m(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(s=f.d,l=t.d,c=m.precision,u=m.rounding,!s[0]||!l[0])return l[0]||(t=new m(f)),rr?Ve(t,c,u):t;if(a=Ut(f.e/je),n=Ut(t.e/je),s=s.slice(),i=a-n,i){for(i<0?(r=s,i=-i,o=l.length):(r=l,n=a,o=s.length),a=Math.ceil(c/je),o=a>o?a+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=s.length,i=l.length,o-i<0&&(i=o,r=l,l=s,s=r),e=0;i;)e=(s[--i]=s[i]+l[i]+e)/ei|0,s[i]%=ei;for(e&&(s.unshift(e),++n),o=s.length;s[--o]==0;)s.pop();return t.d=s,t.e=Rl(s,n),rr?Ve(t,c,u):t};ye.precision=ye.sd=function(t){var e,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Qi+t);return r.d?(e=aE(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e};ye.round=function(){var t=this,e=t.constructor;return Ve(new e(t),t.e+1,e.rounding)};ye.sine=ye.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+je,n.rounding=1,r=GR(n,lE(n,r)),n.precision=t,n.rounding=e,Ve(Ii>2?r.neg():r,t,e,!0)):new n(NaN)};ye.squareRoot=ye.sqrt=function(){var t,e,r,n,i,a,o=this,c=o.d,u=o.e,s=o.s,l=o.constructor;if(s!==1||!c||!c[0])return new l(!s||s<0&&(!c||c[0])?NaN:c?o:1/0);for(rr=!1,s=Math.sqrt(+o),s==0||s==1/0?(e=Lt(c),(e.length+u)%2==0&&(e+="0"),s=Math.sqrt(e),u=Ut((u+1)/2)-(u<0||u%2),s==1/0?e="5e"+u:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new l(e)):n=new l(s.toString()),r=(u=l.precision)+3;;)if(a=n,n=a.plus(qr(o,a,r+2,1)).times(.5),Lt(a.d).slice(0,r)===(e=Lt(n.d)).slice(0,r))if(e=e.slice(r-3,r+1),e=="9999"||!i&&e=="4999"){if(!i&&(Ve(a,u+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Ve(n,u+1,1),t=!n.times(n).eq(o));break}return rr=!0,Ve(n,u,l.rounding,t)};ye.tangent=ye.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,r=r.sin(),r.s=1,r=qr(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Ve(Ii==2||Ii==4?r.neg():r,t,e,!0)):new n(NaN)};ye.times=ye.mul=function(t){var e,r,n,i,a,o,c,u,s,l=this,f=l.constructor,m=l.d,p=(t=new f(t)).d;if(t.s*=l.s,!m||!m[0]||!p||!p[0])return new f(!t.s||m&&!m[0]&&!p||p&&!p[0]&&!m?NaN:!m||!p?t.s/0:t.s*0);for(r=Ut(l.e/je)+Ut(t.e/je),u=m.length,s=p.length,u<s&&(a=m,m=p,p=a,o=u,u=s,s=o),a=[],o=u+s,n=o;n--;)a.push(0);for(n=s;--n>=0;){for(e=0,i=u+n;i>n;)c=a[i]+p[n]*m[i-n-1]+e,a[i--]=c%ei|0,e=c/ei|0;a[i]=(a[i]+e)%ei|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=Rl(a,r),rr?Ve(t,f.precision,f.rounding):t};ye.toBinary=function(t,e){return zm(this,2,t,e)};ye.toDecimalPlaces=ye.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(Qt(t,0,Ki),e===void 0?e=n.rounding:Qt(e,0,8),Ve(r,t+r.e+1,e))};ye.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=xi(n,!0):(Qt(t,0,Ki),e===void 0?e=i.rounding:Qt(e,0,8),n=Ve(new i(n),t+1,e),r=xi(n,!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r};ye.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?r=xi(i):(Qt(t,0,Ki),e===void 0?e=a.rounding:Qt(e,0,8),n=Ve(new a(i),t+i.e+1,e),r=xi(n,!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};ye.toFraction=function(t){var e,r,n,i,a,o,c,u,s,l,f,m,p=this,h=p.d,d=p.constructor;if(!h)return new d(p);if(s=r=new d(1),n=u=new d(0),e=new d(n),a=e.e=aE(h)-p.e-1,o=a%je,e.d[0]=Nt(10,o<0?je+o:o),t==null)t=a>0?e:s;else{if(c=new d(t),!c.isInt()||c.lt(s))throw Error(Qi+c);t=c.gt(e)?a>0?e:s:c}for(rr=!1,c=new d(Lt(h)),l=d.precision,d.precision=a=h.length*je*2;f=qr(c,e,0,1,1),i=r.plus(f.times(n)),i.cmp(t)!=1;)r=n,n=i,i=s,s=u.plus(f.times(i)),u=i,i=e,e=c.minus(f.times(i)),c=i;return i=qr(t.minus(r),n,0,1,1),u=u.plus(i.times(s)),r=r.plus(i.times(n)),u.s=s.s=p.s,m=qr(s,n,a,1).minus(p).abs().cmp(qr(u,r,a,1).minus(p).abs())<1?[s,n]:[u,r],d.precision=l,rr=!0,m};ye.toHexadecimal=ye.toHex=function(t,e){return zm(this,16,t,e)};ye.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),t==null){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),e===void 0?e=n.rounding:Qt(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(rr=!1,r=qr(r,t,0,e,1).times(t),rr=!0,Ve(r)):(t.s=r.s,r=t),r};ye.toNumber=function(){return+this};ye.toOctal=function(t,e){return zm(this,8,t,e)};ye.toPower=ye.pow=function(t){var e,r,n,i,a,o,c=this,u=c.constructor,s=+(t=new u(t));if(!c.d||!t.d||!c.d[0]||!t.d[0])return new u(Nt(+c,s));if(c=new u(c),c.eq(1))return c;if(n=u.precision,a=u.rounding,t.eq(1))return Ve(c,n,a);if(e=Ut(t.e/je),e>=t.d.length-1&&(r=s<0?-s:s)<=VR)return i=oE(u,c,r,n),t.s<0?new u(1).div(i):Ve(i,n,a);if(o=c.s,o<0){if(e<t.d.length-1)return new u(NaN);if((t.d[e]&1)==0&&(o=1),c.e==0&&c.d[0]==1&&c.d.length==1)return c.s=o,c}return r=Nt(+c,s),e=r==0||!isFinite(r)?Ut(s*(Math.log("0."+Lt(c.d))/Math.LN10+c.e+1)):new u(r+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?o/0:0):(rr=!1,u.rounding=c.s=1,r=Math.min(12,(e+"").length),i=km(t.times(Xi(c,n+r)),n),i.d&&(i=Ve(i,n+5,1),Ps(i.d,n,a)&&(e=n+10,i=Ve(km(t.times(Xi(c,e+r)),e),e+5,1),+Lt(i.d).slice(n+1,n+15)+1==1e14&&(i=Ve(i,n+1,0)))),i.s=o,rr=!0,u.rounding=a,Ve(i,n,a))};ye.toPrecision=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=xi(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Qt(t,1,Ki),e===void 0?e=i.rounding:Qt(e,0,8),n=Ve(new i(n),t,e),r=xi(n,t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r};ye.toSignificantDigits=ye.toSD=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(Qt(t,1,Ki),e===void 0?e=n.rounding:Qt(e,0,8)),Ve(new n(r),t,e)};ye.toString=function(){var t=this,e=t.constructor,r=xi(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};ye.truncated=ye.trunc=function(){return Ve(new this.constructor(this),this.e+1,1)};ye.valueOf=ye.toJSON=function(){var t=this,e=t.constructor,r=xi(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};function Lt(t){var e,r,n,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)n=t[e]+"",r=je-n.length,r&&(a+=Ji(r)),a+=n;o=t[e],n=o+"",r=je-n.length,r&&(a+=Ji(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function Qt(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Qi+t)}function Ps(t,e,r,n){var i,a,o,c;for(a=t[0];a>=10;a/=10)--e;return--e<0?(e+=je,i=0):(i=Math.ceil((e+1)/je),e%=je),a=Nt(10,je-e),c=t[i]%a|0,n==null?e<3?(e==0?c=c/100|0:e==1&&(c=c/10|0),o=r<4&&c==99999||r>3&&c==49999||c==5e4||c==0):o=(r<4&&c+1==a||r>3&&c+1==a/2)&&(t[i+1]/a/100|0)==Nt(10,e-2)-1||(c==a/2||c==0)&&(t[i+1]/a/100|0)==0:e<4?(e==0?c=c/1e3|0:e==1?c=c/100|0:e==2&&(c=c/10|0),o=(n||r<4)&&c==9999||!n&&r>3&&c==4999):o=((n||r<4)&&c+1==a||!n&&r>3&&c+1==a/2)&&(t[i+1]/a/1e3|0)==Nt(10,e-3)-1,o}function Tl(t,e,r){for(var n,i=[0],a,o=0,c=t.length;o<c;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=Rm.indexOf(t.charAt(o++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function HR(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?(r=Math.ceil(n/3),i=(1/Pl(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=Oo(t,1,e.times(i),new t(1));for(var a=r;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return t.precision-=r,e}var qr=function(){function t(n,i,a){var o,c=0,u=n.length;for(n=n.slice();u--;)o=n[u]*i+c,n[u]=o%a|0,c=o/a|0;return c&&n.unshift(c),n}function e(n,i,a,o){var c,u;if(a!=o)u=a>o?1:-1;else for(c=u=0;c<a;c++)if(n[c]!=i[c]){u=n[c]>i[c]?1:-1;break}return u}function r(n,i,a,o){for(var c=0;a--;)n[a]-=c,c=n[a]<i[a]?1:0,n[a]=c*o+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o,c,u){var s,l,f,m,p,h,d,g,D,N,v,w,b,y,E,F,S,C,B,I,L=n.constructor,k=n.s==i.s?1:-1,P=n.d,M=i.d;if(!P||!P[0]||!M||!M[0])return new L(!n.s||!i.s||(P?M&&P[0]==M[0]:!M)?NaN:P&&P[0]==0||!M?k*0:k/0);for(u?(p=1,l=n.e-i.e):(u=ei,p=je,l=Ut(n.e/p)-Ut(i.e/p)),B=M.length,S=P.length,D=new L(k),N=D.d=[],f=0;M[f]==(P[f]||0);f++);if(M[f]>(P[f]||0)&&l--,a==null?(y=a=L.precision,o=L.rounding):c?y=a+(n.e-i.e)+1:y=a,y<0)N.push(1),h=!0;else{if(y=y/p+2|0,f=0,B==1){for(m=0,M=M[0],y++;(f<S||m)&&y--;f++)E=m*u+(P[f]||0),N[f]=E/M|0,m=E%M|0;h=m||f<S}else{for(m=u/(M[0]+1)|0,m>1&&(M=t(M,m,u),P=t(P,m,u),B=M.length,S=P.length),F=B,v=P.slice(0,B),w=v.length;w<B;)v[w++]=0;I=M.slice(),I.unshift(0),C=M[0],M[1]>=u/2&&++C;do m=0,s=e(M,v,B,w),s<0?(b=v[0],B!=w&&(b=b*u+(v[1]||0)),m=b/C|0,m>1?(m>=u&&(m=u-1),d=t(M,m,u),g=d.length,w=v.length,s=e(d,v,g,w),s==1&&(m--,r(d,B<g?I:M,g,u))):(m==0&&(s=m=1),d=M.slice()),g=d.length,g<w&&d.unshift(0),r(v,d,w,u),s==-1&&(w=v.length,s=e(M,v,B,w),s<1&&(m++,r(v,B<w?I:M,w,u))),w=v.length):s===0&&(m++,v=[0]),N[f++]=m,s&&v[0]?v[w++]=P[F]||0:(v=[P[F]],w=1);while((F++<S||v[0]!==void 0)&&y--);h=v[0]!==void 0}N[0]||N.shift()}if(p==1)D.e=l,eE=h;else{for(f=1,m=N[0];m>=10;m/=10)f++;D.e=f+l*p-1,Ve(D,c?a+D.e+1:a,o,h)}return D}}();function Ve(t,e,r,n){var i,a,o,c,u,s,l,f,m,p=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,c=f[0];c>=10;c/=10)i++;if(a=e-i,a<0)a+=je,o=e,l=f[m=0],u=l/Nt(10,i-o-1)%10|0;else if(m=Math.ceil((a+1)/je),c=f.length,m>=c)if(n){for(;c++<=m;)f.push(0);l=u=0,i=1,a%=je,o=a-je+1}else break e;else{for(l=c=f[m],i=1;c>=10;c/=10)i++;a%=je,o=a-je+i,u=o<0?0:l/Nt(10,i-o-1)%10|0}if(n=n||e<0||f[m+1]!==void 0||(o<0?l:l%Nt(10,i-o-1)),s=r<4?(u||n)&&(r==0||r==(t.s<0?3:2)):u>5||u==5&&(r==4||n||r==6&&(a>0?o>0?l/Nt(10,i-o):0:f[m-1])%10&1||r==(t.s<0?8:7)),e<1||!f[0])return f.length=0,s?(e-=t.e+1,f[0]=Nt(10,(je-e%je)%je),t.e=-e||0):f[0]=t.e=0,t;if(a==0?(f.length=m,c=1,m--):(f.length=m+1,c=Nt(10,je-a),f[m]=o>0?(l/Nt(10,i-o)%Nt(10,o)|0)*c:0),s)for(;;)if(m==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=c,c=1;o>=10;o/=10)c++;a!=c&&(t.e++,f[0]==ei&&(f[0]=1));break}else{if(f[m]+=c,f[m]!=ei)break;f[m--]=0,c=1}for(a=f.length;f[--a]===0;)f.pop()}return rr&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function xi(t,e,r){if(!t.isFinite())return uE(t);var n,i=t.e,a=Lt(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+Ji(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(t.e<0?"e":"e+")+t.e):i<0?(a="0."+Ji(-i-1)+a,r&&(n=r-o)>0&&(a+=Ji(n))):i>=o?(a+=Ji(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+Ji(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=Ji(n))),a}function Rl(t,e){var r=t[0];for(e*=je;r>=10;r/=10)e++;return e}function Il(t,e,r){if(e>$R)throw rr=!0,r&&(t.precision=r),Error(rE);return Ve(new t(Ol),e,1,!0)}function Kn(t,e,r){if(e>Lm)throw Error(rE);return Ve(new t(Bl),e,r,!0)}function aE(t){var e=t.length-1,r=e*je+1;if(e=t[e],e){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function Ji(t){for(var e="";t--;)e+="0";return e}function oE(t,e,r,n){var i,a=new t(1),o=Math.ceil(n/je+4);for(rr=!1;;){if(r%2&&(a=a.times(e),Qw(a.d,o)&&(i=!0)),r=Ut(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}e=e.times(e),Qw(e.d,o)}return rr=!0,a}function Xw(t){return t.d[t.d.length-1]&1}function sE(t,e,r){for(var n,i=new t(e[0]),a=0;++a<e.length;)if(n=new t(e[a]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function km(t,e){var r,n,i,a,o,c,u,s=0,l=0,f=0,m=t.constructor,p=m.rounding,h=m.precision;if(!t.d||!t.d[0]||t.e>17)return new m(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:0/0);for(e==null?(rr=!1,u=h):u=e,c=new m(.03125);t.e>-2;)t=t.times(c),f+=5;for(n=Math.log(Nt(2,f))/Math.LN10*2+5|0,u+=n,r=a=o=new m(1),m.precision=u;;){if(a=Ve(a.times(t),u,1),r=r.times(++l),c=o.plus(qr(a,r,u,1)),Lt(c.d).slice(0,u)===Lt(o.d).slice(0,u)){for(i=f;i--;)o=Ve(o.times(o),u,1);if(e==null)if(s<3&&Ps(o.d,u-n,p,s))m.precision=u+=10,r=a=c=new m(1),l=0,s++;else return Ve(o,m.precision=h,p,rr=!0);else return m.precision=h,o}o=c}}function Xi(t,e){var r,n,i,a,o,c,u,s,l,f,m,p=1,h=10,d=t,g=d.d,D=d.constructor,N=D.rounding,v=D.precision;if(d.s<0||!g||!g[0]||!d.e&&g[0]==1&&g.length==1)return new D(g&&!g[0]?-1/0:d.s!=1?NaN:g?0:d);if(e==null?(rr=!1,l=v):l=e,D.precision=l+=h,r=Lt(g),n=r.charAt(0),Math.abs(a=d.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)d=d.times(t),r=Lt(d.d),n=r.charAt(0),p++;a=d.e,n>1?(d=new D("0."+r),a++):d=new D(n+"."+r.slice(1))}else return s=Il(D,l+2,v).times(a+""),d=Xi(new D(n+"."+r.slice(1)),l-h).plus(s),D.precision=v,e==null?Ve(d,v,N,rr=!0):d;for(f=d,u=o=d=qr(d.minus(1),d.plus(1),l,1),m=Ve(d.times(d),l,1),i=3;;){if(o=Ve(o.times(m),l,1),s=u.plus(qr(o,new D(i),l,1)),Lt(s.d).slice(0,l)===Lt(u.d).slice(0,l))if(u=u.times(2),a!==0&&(u=u.plus(Il(D,l+2,v).times(a+""))),u=qr(u,new D(p),l,1),e==null)if(Ps(u.d,l-h,N,c))D.precision=l+=h,s=o=d=qr(f.minus(1),f.plus(1),l,1),m=Ve(d.times(d),l,1),i=c=1;else return Ve(u,D.precision=v,N,rr=!0);else return D.precision=v,u;u=s,i+=2}}function uE(t){return String(t.s*t.s/0)}function qm(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%je,r<0&&(n+=je),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=je;n<i;)t.d.push(+e.slice(n,n+=je));e=e.slice(n),n=je-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),rr&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function WR(t,e){var r,n,i,a,o,c,u,s,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),iE.test(e))return qm(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(zR.test(e))r=16,e=e.toLowerCase();else if(qR.test(e))r=2;else if(UR.test(e))r=8;else throw Error(Qi+e);for(a=e.search(/p/i),a>0?(u=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,n=t.constructor,o&&(e=e.replace(".",""),c=e.length,a=c-a,i=oE(n,new n(r),a,a*2)),s=Tl(e,r,ei),l=s.length-1,a=l;s[a]===0;--a)s.pop();return a<0?new n(t.s*0):(t.e=Rl(s,l),t.d=s,rr=!1,o&&(t=qr(t,i,c*4)),u&&(t=t.times(Math.abs(u)<54?Nt(2,u):Ls.pow(2,u))),rr=!0,t)}function GR(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:Oo(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:r|0,e=e.times(1/Pl(5,r)),e=Oo(t,2,e,e);for(var i,a=new t(5),o=new t(16),c=new t(20);r--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(c))));return e}function Oo(t,e,r,n,i){var a,o,c,u,s=1,l=t.precision,f=Math.ceil(l/je);for(rr=!1,u=r.times(r),c=new t(n);;){if(o=qr(c.times(u),new t(e++*e++),l,1),c=i?n.plus(o):n.minus(o),n=qr(o.times(u),new t(e++*e++),l,1),o=c.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===c.d[a]&&a--;);if(a==-1)break}a=c,c=n,n=o,o=a,s++}return rr=!0,o.d.length=f+1,o}function Pl(t,e){for(var r=t;--e;)r*=t;return r}function lE(t,e){var r,n=e.s<0,i=Kn(t,t.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return Ii=n?4:1,e;if(r=e.divToInt(i),r.isZero())Ii=n?3:2;else{if(e=e.minus(r.times(i)),e.lte(a))return Ii=Xw(r)?n?2:3:n?4:1,e;Ii=Xw(r)?n?1:4:n?3:2}return e.minus(i).abs()}function zm(t,e,r,n){var i,a,o,c,u,s,l,f,m,p=t.constructor,h=r!==void 0;if(h?(Qt(r,1,Ki),n===void 0?n=p.rounding:Qt(n,0,8)):(r=p.precision,n=p.rounding),!t.isFinite())l=uE(t);else{for(l=xi(t),o=l.indexOf("."),h?(i=2,e==16?r=r*4-3:e==8&&(r=r*3-2)):i=e,o>=0&&(l=l.replace(".",""),m=new p(1),m.e=l.length-o,m.d=Tl(xi(m),10,i),m.e=m.d.length),f=Tl(l,10,i),a=u=f.length;f[--u]==0;)f.pop();if(!f[0])l=h?"0p+0":"0";else{if(o<0?a--:(t=new p(t),t.d=f,t.e=a,t=qr(t,m,r,n,0,i),f=t.d,a=t.e,s=eE),o=f[r],c=i/2,s=s||f[r+1]!==void 0,s=n<4?(o!==void 0||s)&&(n===0||n===(t.s<0?3:2)):o>c||o===c&&(n===4||s||n===6&&f[r-1]&1||n===(t.s<0?8:7)),f.length=r,s)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(o=0,l="";o<u;o++)l+=Rm.charAt(f[o]);if(h){if(u>1)if(e==16||e==8){for(o=e==16?4:3,--u;u%o;u++)l+="0";for(f=Tl(l,i,e),u=f.length;!f[u-1];--u);for(o=1,l="1.";o<u;o++)l+=Rm.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>u)for(a-=u;a--;)l+="0";else a<u&&(l=l.slice(0,a)+"."+l.slice(a))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function Qw(t,e){if(t.length>e)return t.length=e,!0}function ZR(t){return new this(t).abs()}function jR(t){return new this(t).acos()}function YR(t){return new this(t).acosh()}function JR(t,e){return new this(t).plus(e)}function XR(t){return new this(t).asin()}function QR(t){return new this(t).asinh()}function KR(t){return new this(t).atan()}function e5(t){return new this(t).atanh()}function r5(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,a=n+4;return!t.s||!e.s?r=new this(NaN):!t.d&&!e.d?(r=Kn(this,a,1).times(e.s>0?.25:.75),r.s=t.s):!e.d||t.isZero()?(r=e.s<0?Kn(this,n,i):new this(0),r.s=t.s):!t.d||e.isZero()?(r=Kn(this,a,1).times(.5),r.s=t.s):e.s<0?(this.precision=a,this.rounding=1,r=this.atan(qr(t,e,a,1)),e=Kn(this,a,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(qr(t,e,a,1)),r}function t5(t){return new this(t).cbrt()}function n5(t){return Ve(t=new this(t),t.e+1,2)}function i5(t,e,r){return new this(t).clamp(e,r)}function a5(t){if(!t||typeof t!="object")throw Error(_l+"Object expected");var e,r,n,i=t.defaults===!0,a=["precision",1,Ki,"rounding",0,8,"toExpNeg",-To,0,"toExpPos",0,To,"maxE",0,To,"minE",-To,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(r=a[e],i&&(this[r]=Pm[r]),(n=t[r])!==void 0)if(Ut(n)===n&&n>=a[e+1]&&n<=a[e+2])this[r]=n;else throw Error(Qi+r+": "+n);if(r="crypto",i&&(this[r]=Pm[r]),(n=t[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(tE);else this[r]=!1;else throw Error(Qi+r+": "+n);return this}function o5(t){return new this(t).cos()}function s5(t){return new this(t).cosh()}function cE(t){var e,r,n;function i(a){var o,c,u,s=this;if(!(s instanceof i))return new i(a);if(s.constructor=i,Kw(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(u=typeof a,u==="number"){if(a===0){s.s=1/a<0?-1:1,s.e=0,s.d=[0];return}if(a<0?(a=-a,s.s=-1):s.s=1,a===~~a&&a<1e7){for(o=0,c=a;c>=10;c/=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 qm(s,a.toString())}else if(u!=="string")throw Error(Qi+a);return(c=a.charCodeAt(0))===45?(a=a.slice(1),s.s=-1):(c===43&&(a=a.slice(1)),s.s=1),iE.test(a)?qm(s,a):WR(s,a)}if(i.prototype=ye,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=a5,i.clone=cE,i.isDecimal=Kw,i.abs=ZR,i.acos=jR,i.acosh=YR,i.add=JR,i.asin=XR,i.asinh=QR,i.atan=KR,i.atanh=e5,i.atan2=r5,i.cbrt=t5,i.ceil=n5,i.clamp=i5,i.cos=o5,i.cosh=s5,i.div=u5,i.exp=l5,i.floor=c5,i.hypot=f5,i.ln=m5,i.log=p5,i.log10=h5,i.log2=d5,i.max=v5,i.min=g5,i.mod=y5,i.mul=x5,i.pow=D5,i.random=b5,i.round=w5,i.sign=E5,i.sin=C5,i.sinh=N5,i.sqrt=A5,i.sub=F5,i.sum=S5,i.tan=M5,i.tanh=T5,i.trunc=O5,t===void 0&&(t={}),t&&t.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function u5(t,e){return new this(t).div(e)}function l5(t){return new this(t).exp()}function c5(t){return Ve(t=new this(t),t.e+1,3)}function f5(){var t,e,r=new this(0);for(rr=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return rr=!0,new this(1/0);r=e}return rr=!0,r.sqrt()}function Kw(t){return t instanceof Ls||t&&t.toStringTag===nE||!1}function m5(t){return new this(t).ln()}function p5(t,e){return new this(t).log(e)}function d5(t){return new this(t).log(2)}function h5(t){return new this(t).log(10)}function v5(){return sE(this,arguments,"lt")}function g5(){return sE(this,arguments,"gt")}function y5(t,e){return new this(t).mod(e)}function x5(t,e){return new this(t).mul(e)}function D5(t,e){return new this(t).pow(e)}function b5(t){var e,r,n,i,a=0,o=new this(1),c=[];if(t===void 0?t=this.precision:Qt(t,1,Ki),n=Math.ceil(t/je),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]:c[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):(c.push(i%1e7),a+=4);a=n/4}else throw Error(tE);else for(;a<n;)c[a++]=Math.random()*1e7|0;for(n=c[--a],t%=je,n&&t&&(i=Nt(10,je-t),c[a]=(n/i|0)*i);c[a]===0;a--)c.pop();if(a<0)r=0,c=[0];else{for(r=-1;c[0]===0;r-=je)c.shift();for(n=1,i=c[0];i>=10;i/=10)n++;n<je&&(r-=je-n)}return o.e=r,o.d=c,o}function w5(t){return Ve(t=new this(t),t.e+1,this.rounding)}function E5(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function C5(t){return new this(t).sin()}function N5(t){return new this(t).sinh()}function A5(t){return new this(t).sqrt()}function F5(t,e){return new this(t).sub(e)}function S5(){var t=0,e=arguments,r=new this(e[t]);for(rr=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return rr=!0,Ve(r,this.precision,this.rounding)}function M5(t){return new this(t).tan()}function T5(t){return new this(t).tanh()}function O5(t){return Ve(t=new this(t),t.e+1,1)}ye[Symbol.for("nodejs.util.inspect.custom")]=ye.toString;ye[Symbol.toStringTag]="Decimal";var Ls=ye.constructor=cE(Pm);Ol=new Ls(Ol);Bl=new Ls(Bl);var Oa=Ls;var B5="BigNumber",I5=["?on","config"],Um=A(B5,I5,t=>{var{on:e,config:r}=t,n=Oa.clone({precision:r.precision,modulo:Oa.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 Mt=Yt(mE(),1);var _5="Complex",R5=[],$m=A(_5,R5,()=>(Object.defineProperty(Mt.default,"name",{value:"Complex"}),Mt.default.prototype.constructor=Mt.default,Mt.default.prototype.type="Complex",Mt.default.prototype.isComplex=!0,Mt.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Mt.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Mt.default.prototype.format=function(t){var e="",r=this.im,n=this.re,i=Xn(this.re,t),a=Xn(this.im,t),o=He(t)?t:t?t.precision:null;if(o!==null){var c=Math.pow(10,-o);Math.abs(n/r)<c&&(n=0),Math.abs(r/n)<c&&(r=0)}return r===0?e=i:n===0?r===1?e="i":r===-1?e="-i":e=a+"i":r<0?r===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":r===1?e=i+" + i":e=i+" + "+a+"i",e},Mt.default.fromPolar=function(t){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,Mt.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var r=arguments[0],n=arguments[1];if(He(r)){if(mn(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),He(n))return new Mt.default({r,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Mt.default.prototype.valueOf=Mt.default.prototype.toString,Mt.default.fromJSON=function(t){return new Mt.default(t)},Mt.default.compare=function(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0},Mt.default),{isClass:!0});var Di=Yt(dE(),1);var P5="Fraction",L5=[],Wm=A(P5,L5,()=>(Object.defineProperty(Di.default,"name",{value:"Fraction"}),Di.default.prototype.constructor=Di.default,Di.default.prototype.type="Fraction",Di.default.prototype.isFraction=!0,Di.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Di.default.fromJSON=function(t){return new Di.default(t)},Di.default),{isClass:!0});var k5="Range",q5=[],Gm=A(k5,q5,()=>{function t(e,r,n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=r!=null,o=n!=null;if(i){if(Le(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(Le(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter end must be a number")}if(o){if(Le(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(r):0,this.step=o?parseFloat(n):1}return t.prototype.type="Range",t.prototype.isRange=!0,t.parse=function(e){if(typeof e!="string")return null;var r=e.split(":"),n=r.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[2],n[1]);default:return null}},t.prototype.clone=function(){return new t(this.start,this.end,this.step)},t.prototype.size=function(){var e=0,r=this.start,n=this.step,i=this.end,a=i-r;return Tn(n)===Tn(a)?e=Math.ceil(a/n):a===0&&(e=0),isNaN(e)&&(e=0),[e]},t.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},t.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},t.prototype.forEach=function(e){var r=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;r<i;)e(r,[a],this),r+=n,a++;else if(n<0)for(;r>i;)e(r,[a],this),r+=n,a++},t.prototype.map=function(e){var r=[];return this.forEach(function(n,i,a){r[i[0]]=e(n,i,a)}),r},t.prototype.toArray=function(){var e=[];return this.forEach(function(r,n){e[n[0]]=r}),e},t.prototype.valueOf=function(){return this.toArray()},t.prototype.format=function(e){var r=Xn(this.start,e);return this.step!==1&&(r+=":"+Xn(this.step,e)),r+=":"+Xn(this.end,e),r},t.prototype.toString=function(){return this.format()},t.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},t.fromJSON=function(e){return new t(e.start,e.end,e.step)},t},{isClass:!0});var z5="Matrix",U5=[],Zm=A(z5,U5,()=>{function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator")}return t.prototype.type="Matrix",t.prototype.isMatrix=!0,t.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},t.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},t.prototype.create=function(e,r){throw new Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(e,r,n){throw new Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(e,r,n){throw new Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(e,r){throw new Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(e,r){throw new Error("Cannot invoke reshape on a Matrix interface")},t.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(e,r){throw new Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},t.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},t.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},t},{isClass:!0});function hE(t){var e=0,r=1,n=Object.create(null),i=Object.create(null),a=0,o=function(u){var s=i[u];if(!!s&&(delete n[s],delete i[u],--e,r===s)){if(!e){a=0,r=1;return}for(;!hasOwnProperty.call(n,++r););}};return t=Math.abs(t),{hit:function(u){var s=i[u],l=++a;if(n[l]=u,i[u]=l,!s)return++e,e<=t?void 0:(u=n[r],o(u),u);if(delete n[s],r===s)for(;!hasOwnProperty.call(n,++r););},delete:o,clear:function(){e=a=0,r=1,n=Object.create(null),i=Object.create(null)}}}function Ba(t){var{hasher:e,limit:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return r=r==null?Number.POSITIVE_INFINITY:r,e=e==null?JSON.stringify:e,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:hE(r||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var c=t.apply(t,i);return n.cache.values.set(o,c),n.cache.values.delete(n.cache.lru.hit(o)),c}}function Ll(t){return Object.keys(t.signatures||{}).reduce(function(e,r){var n=(r.match(/,/g)||[]).length+1;return Math.max(e,n)},-1)}var V5="DenseMatrix",$5=["Matrix"],jm=A(V5,$5,t=>{var{Matrix:e}=t;function r(l,f){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!lt(f))throw new Error("Invalid datatype: "+f);if(Fe(l))l.type==="DenseMatrix"?(this._data=Ie(l._data),this._size=Ie(l._size),this._datatype=f||l._datatype):(this._data=l.toArray(),this._size=l.size(),this._datatype=f||l._datatype);else if(l&&lr(l.data)&&lr(l.size))this._data=l.data,this._size=l.size,Fm(this._data,this._size),this._datatype=f||l.datatype;else if(lr(l))this._data=s(l),this._size=ze(this._data),Fm(this._data,this._size),this._datatype=f;else{if(l)throw new TypeError("Unsupported type of data ("+nr(l)+")");this._data=[],this._size=[0],this._datatype=f}}r.prototype=new e,r.prototype.createDenseMatrix=function(l,f){return new r(l,f)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Yi(this._data,nr)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(l,f){return new r(l,f)},r.prototype.subset=function(l,f,m){switch(arguments.length){case 1:return n(this,l);case 2:case 3:return a(this,l,f,m);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(l){if(!lr(l))throw new TypeError("Array expected");if(l.length!==this._size.length)throw new Ue(l.length,this._size.length);for(var f=0;f<l.length;f++)xr(l[f],this._size[f]);for(var m=this._data,p=0,h=l.length;p<h;p++){var d=l[p];xr(d,m.length),m=m[d]}return m},r.prototype.set=function(l,f,m){if(!lr(l))throw new TypeError("Array expected");if(l.length<this._size.length)throw new Ue(l.length,this._size.length,"<");var p,h,d,g=l.map(function(N){return N+1});u(this,g,m);var D=this._data;for(p=0,h=l.length-1;p<h;p++)d=l[p],xr(d,D.length),D=D[d];return d=l[l.length-1],xr(d,D.length),D[d]=f,this};function n(l,f){if(!Wi(f))throw new TypeError("Invalid index");var m=f.isScalar();if(m)return l.get(f.min());var p=f.size();if(p.length!==l._size.length)throw new Ue(p.length,l._size.length);for(var h=f.min(),d=f.max(),g=0,D=l._size.length;g<D;g++)xr(h[g],l._size[g]),xr(d[g],l._size[g]);return new r(i(l._data,f,p.length,0),l._datatype)}function i(l,f,m,p){var h=p===m-1,d=f.dimension(p);return h?d.map(function(g){return xr(g,l.length),l[g]}).valueOf():d.map(function(g){xr(g,l.length);var D=l[g];return i(D,f,m,p+1)}).valueOf()}function a(l,f,m,p){if(!f||f.isIndex!==!0)throw new TypeError("Invalid index");var h=f.size(),d=f.isScalar(),g;if(Fe(m)?(g=m.size(),m=m.valueOf()):g=ze(m),d){if(g.length!==0)throw new TypeError("Scalar expected");l.set(f.min(),m,p)}else{if(h.length<l._size.length)throw new Ue(h.length,l._size.length,"<");if(g.length<h.length){for(var D=0,N=0;h[D]===1&&g[D]===1;)D++;for(;h[D]===1;)N++,D++;m=Cl(m,h.length,N,g)}if(!Zi(h,g))throw new Ue(h,g,">");var v=f.max().map(function(y){return y+1});u(l,v,p);var w=h.length,b=0;o(l._data,f,m,w,b)}return l}function o(l,f,m,p,h){var d=h===p-1,g=f.dimension(h);d?g.forEach(function(D,N){xr(D),l[D]=m[N[0]]}):g.forEach(function(D,N){xr(D),o(l[D],f,m[N[0]],p,h+1)})}r.prototype.resize=function(l,f,m){if(!St(l))throw new TypeError("Array or Matrix expected");var p=l.valueOf().map(d=>Array.isArray(d)&&d.length===1?d[0]:d),h=m?this.clone():this;return c(h,p,f)};function c(l,f,m){if(f.length===0){for(var p=l._data;lr(p);)p=p[0];return p}return l._size=f.slice(0),l._data=Qn(l._data,l._size,m),l}r.prototype.reshape=function(l,f){var m=f?this.clone():this;m._data=El(m._data,l);var p=m._size.reduce((h,d)=>h*d);return m._size=_s(l,p),m};function u(l,f,m){for(var p=l._size.slice(0),h=!1;p.length<f.length;)p.push(0),h=!0;for(var d=0,g=f.length;d<g;d++)f[d]>p[d]&&(p[d]=f[d],h=!0);h&&c(l,p,m)}r.prototype.clone=function(){var l=new r({data:Ie(this._data),size:Ie(this._size),datatype:this._datatype});return l},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(l){var f=this,m=Ll(l),p=function g(D,N){return lr(D)?D.map(function(v,w){return g(v,N.concat(w))}):m===1?l(D):m===2?l(D,N):l(D,N,f)},h=p(this._data,[]),d=this._datatype!==void 0?Yi(h,nr):void 0;return new r(h,d)},r.prototype.forEach=function(l){var f=this,m=function p(h,d){lr(h)?h.forEach(function(g,D){p(g,d.concat(D))}):l(h,d,f)};m(this._data,[])},r.prototype[Symbol.iterator]=function*(){var l=function*f(m,p){if(lr(m))for(var h=0;h<m.length;h++)yield*f(m[h],p.concat(h));else yield{value:m,index:p}};yield*l(this._data,[])},r.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 m=this._data;for(var p of m)l.push(new r([p],this._datatype));return l},r.prototype.columns=function(){var l=this,f=[],m=this.size();if(m.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var p=this._data,h=function(D){var N=p.map(v=>[v[D]]);f.push(new r(N,l._datatype))},d=0;d<m[1];d++)h(d);return f},r.prototype.toArray=function(){return Ie(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(l){return qe(this._data,l)},r.prototype.toString=function(){return qe(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(l){if(l){if(Le(l)&&(l=l.toNumber()),!He(l)||!Ae(l))throw new TypeError("The parameter k must be an integer number")}else l=0;for(var f=l>0?l:0,m=l<0?-l:0,p=this._size[0],h=this._size[1],d=Math.min(p-m,h-f),g=[],D=0;D<d;D++)g[D]=this._data[D+m][D+f];return new r({data:g,size:[d],datatype:this._datatype})},r.diagonal=function(l,f,m,p){if(!lr(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(E){if(Le(E)&&(E=E.toNumber()),!He(E)||!Ae(E)||E<1)throw new Error("Size values must be positive integers");return E}),m){if(Le(m)&&(m=m.toNumber()),!He(m)||!Ae(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var h=m>0?m:0,d=m<0?-m:0,g=l[0],D=l[1],N=Math.min(g-d,D-h),v;if(lr(f)){if(f.length!==N)throw new Error("Invalid value array length");v=function(F){return f[F]}}else if(Fe(f)){var w=f.size();if(w.length!==1||w[0]!==N)throw new Error("Invalid matrix length");v=function(F){return f.get([F])}}else v=function(){return f};p||(p=Le(v(0))?v(0).mul(0):0);var b=[];if(l.length>0){b=Qn(b,l,p);for(var y=0;y<N;y++)b[y+d][y+h]=v(y)}return new r({data:b,size:[g,D]})},r.fromJSON=function(l){return new r(l)},r.prototype.swapRows=function(l,f){if(!He(l)||!Ae(l)||!He(f)||!Ae(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 xr(l,this._size[0]),xr(f,this._size[0]),r._swapRows(l,f,this._data),this},r._swapRows=function(l,f,m){var p=m[l];m[l]=m[f],m[f]=p};function s(l){for(var f=0,m=l.length;f<m;f++){var p=l[f];lr(p)?l[f]=s(p):p&&p.isMatrix===!0&&(l[f]=s(p.valueOf()))}return l}return r},{isClass:!0});var vE="clone",H5=["typed"],Ym=A(vE,H5,t=>{var{typed:e}=t;return e(vE,{any:Ie})});function kl(t){var e=t.length,r=t[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<e;n++)o.push(t[n][i]);a.push(o)}return a}function On(t){for(var e=0;e<t.length;e++)if(St(t[e]))return!0;return!1}function Vt(t,e){Fe(t)&&(t=t.valueOf());for(var r=0,n=t.length;r<n;r++){var i=t[r];Array.isArray(i)?Vt(i,e):e(i)}}function Oe(t,e,r){return t&&typeof t.map=="function"?t.map(function(n){return Oe(n,e,r)}):e(t)}function ea(t,e,r){var n=Array.isArray(t)?ze(t):t.size();if(e<0||e>=n.length)throw new Pt(e,n.length);return Fe(t)?t.create(ql(t.valueOf(),e,r)):ql(t,e,r)}function ql(t,e,r){var n,i,a,o;if(e<=0)if(Array.isArray(t[0])){for(o=kl(t),i=[],n=0;n<o.length;n++)i[n]=ql(o[n],e-1,r);return i}else{for(a=t[0],n=1;n<t.length;n++)a=r(a,t[n]);return a}else{for(i=[],n=0;n<t.length;n++)i[n]=ql(t[n],e-1,r);return i}}function Jm(t,e,r,n,i,a,o,c,u,s,l){var f=t._values,m=t._index,p=t._ptr,h,d,g,D;if(n)for(d=p[e],g=p[e+1],h=d;h<g;h++)D=m[h],r[D]!==a?(r[D]=a,o.push(D),s?(n[D]=u?c(f[h],l):c(l,f[h]),i[D]=a):n[D]=f[h]):(n[D]=u?c(f[h],n[D]):c(n[D],f[h]),i[D]=a);else for(d=p[e],g=p[e+1],h=d;h<g;h++)D=m[h],r[D]!==a?(r[D]=a,o.push(D)):i[D]=a}var gE="isInteger",W5=["typed"],Xm=A(gE,W5,t=>{var{typed:e}=t;return e(gE,{number:Ae,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var Kt="number",_i="number, number";function Qm(t){return Math.abs(t)}Qm.signature=Kt;function Km(t,e){return t+e}Km.signature=_i;function G5(t,e){return t-e}G5.signature=_i;function ep(t,e){return t*e}ep.signature=_i;function Z5(t,e){return t/e}Z5.signature=_i;function rp(t){return-t}rp.signature=Kt;function tp(t){return t}tp.signature=Kt;function Bo(t){return Mw(t)}Bo.signature=Kt;function np(t){return t*t*t}np.signature=Kt;function ip(t){return Math.exp(t)}ip.signature=Kt;function ap(t){return Tw(t)}ap.signature=Kt;function op(t,e){if(!Ae(t)||!Ae(e))throw new Error("Parameters in function gcd must be integer numbers");for(var r;e!==0;)r=t%e,t=e,e=r;return t<0?-t:t}op.signature=_i;function sp(t,e){if(!Ae(t)||!Ae(e))throw new Error("Parameters in function lcm must be integer numbers");if(t===0||e===0)return 0;for(var r,n=t*e;e!==0;)r=e,e=t%r,t=r;return Math.abs(n/t)}sp.signature=_i;function yE(t,e){return e?Math.log(t)/Math.log(e):Math.log(t)}function up(t){return Sw(t)}up.signature=Kt;function lp(t){return Fw(t)}lp.signature=Kt;function j5(t){return gl(t)}j5.signature=Kt;function cp(t,e){if(e>0)return t-e*Math.floor(t/e);if(e===0)return t;throw new Error("Cannot calculate mod for a negative divisor")}cp.signature=_i;function fp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=e<0;if(r&&(e=-e),e===0)throw new Error("Root must be non-zero");if(t<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(t===0)return r?1/0:0;if(!isFinite(t))return r?0:t;var n=Math.pow(Math.abs(t),1/e);return n=t<0?-n:n,r?1/n:n}function zl(t){return Tn(t)}zl.signature=Kt;function Y5(t){return Math.sqrt(t)}Y5.signature=Kt;function mp(t){return t*t}mp.signature=Kt;function pp(t,e){var r,n,i,a=0,o=1,c=1,u=0;if(!Ae(t)||!Ae(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(t/e),i=t-n*e,r=a,a=o-n*a,o=r,r=c,c=u-n*c,u=r,t=e,e=i;var s;return t<0?s=[-t,-o,-u]:s=[t,t?o:0,u],s}pp.signature=_i;function dp(t,e){return t*t<1&&e===1/0||t*t>1&&e===-1/0?0:Math.pow(t,e)}dp.signature=_i;function hp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Ae(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(Cm(t,e))}function J5(t){return Math.abs(t)}J5.signature=Kt;var X5="number",Io="number, number";function vp(t,e){if(!Ae(t)||!Ae(e))throw new Error("Integers expected in function bitAnd");return t&e}vp.signature=Io;function gp(t){if(!Ae(t))throw new Error("Integer expected in function bitNot");return~t}gp.signature=X5;function yp(t,e){if(!Ae(t)||!Ae(e))throw new Error("Integers expected in function bitOr");return t|e}yp.signature=Io;function xp(t,e){if(!Ae(t)||!Ae(e))throw new Error("Integers expected in function bitXor");return t^e}xp.signature=Io;function Dp(t,e){if(!Ae(t)||!Ae(e))throw new Error("Integers expected in function leftShift");return t<<e}Dp.signature=Io;function bp(t,e){if(!Ae(t)||!Ae(e))throw new Error("Integers expected in function rightArithShift");return t>>e}bp.signature=Io;function wp(t,e){if(!Ae(t)||!Ae(e))throw new Error("Integers expected in function rightLogShift");return t>>>e}wp.signature=Io;function dn(t,e){if(e<t)return 1;if(e===t)return e;var r=e+t>>1;return dn(t,r)*dn(r+1,e)}function Ep(t,e){if(!Ae(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(!Ae(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>t)throw new TypeError("k must be less than or equal to n");for(var r=t-e,n=1,i=e<r?r+1:e+1,a=2,o=e<r?e:r,c=i;c<=t;++c)for(n*=c;a<=o&&n%a===0;)n/=a,++a;return a<=o&&(n/=dn(a,o)),n}Ep.signature="number, number";var xE=Math.PI,DE=2*Math.PI,bE=Math.E,wE=1.618033988749895;var Q5="number",Cp="number, number";function Np(t){return!t}Np.signature=Q5;function Ap(t,e){return!!(t||e)}Ap.signature=Cp;function Fp(t,e){return!!t!=!!e}Fp.signature=Cp;function Sp(t,e){return!!(t&&e)}Sp.signature=Cp;function ks(t){var e;if(Ae(t))return t<=0?isFinite(t)?1/0:NaN:t>171?1/0:dn(1,t-1);if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*ks(1-t));if(t>=171.35)return 1/0;if(t>85){var r=t*t,n=r*t,i=n*t,a=i*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*t))}--t,e=Ia[0];for(var o=1;o<Ia.length;++o)e+=Ia[o]/(t+o);var c=t+Mp+.5;return Math.sqrt(2*Math.PI)*Math.pow(c,t+.5)*Math.exp(-c)*e}ks.signature="number";var Mp=4.7421875,Ia=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Tp=.9189385332046728,K5=5,e7=7,EE=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function qs(t){if(t<0)return NaN;if(t===0)return 1/0;if(!isFinite(t))return t;if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-qs(1-t);t=t-1;for(var e=t+K5+.5,r=EE[0],n=e7-1;n>=1;n--)r+=EE[n]/(t+n);return Tp+(t+.5)*Math.log(e)-e+Math.log(r)}qs.signature="number";var Xr="number",r7="number, number";function t7(t){return Math.acos(t)}t7.signature=Xr;function Op(t){return Iw(t)}Op.signature=Xr;function Bp(t){return Math.atan(1/t)}Bp.signature=Xr;function Ip(t){return isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0}Ip.signature=Xr;function _p(t){return Math.asin(1/t)}_p.signature=Xr;function Rp(t){var e=1/t;return Math.log(e+Math.sqrt(e*e+1))}Rp.signature=Xr;function Pp(t){return Math.acos(1/t)}Pp.signature=Xr;function Lp(t){var e=1/t,r=Math.sqrt(e*e-1);return Math.log(r+e)}Lp.signature=Xr;function n7(t){return Math.asin(t)}n7.signature=Xr;function kp(t){return _w(t)}kp.signature=Xr;function i7(t){return Math.atan(t)}i7.signature=Xr;function a7(t,e){return Math.atan2(t,e)}a7.signature=r7;function qp(t){return Rw(t)}qp.signature=Xr;function o7(t){return Math.cos(t)}o7.signature=Xr;function s7(t){return Dl(t)}s7.signature=Xr;function zp(t){return 1/Math.tan(t)}zp.signature=Xr;function Up(t){var e=Math.exp(2*t);return(e+1)/(e-1)}Up.signature=Xr;function Vp(t){return 1/Math.sin(t)}Vp.signature=Xr;function $p(t){return t===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*Tn(t)}$p.signature=Xr;function Hp(t){return 1/Math.cos(t)}Hp.signature=Xr;function Wp(t){return 2/(Math.exp(t)+Math.exp(-t))}Wp.signature=Xr;function u7(t){return Math.sin(t)}u7.signature=Xr;function Gp(t){return Pw(t)}Gp.signature=Xr;function l7(t){return Math.tan(t)}l7.signature=Xr;function c7(t){return bl(t)}c7.signature=Xr;var zs="number";function f7(t){return Ae(t)}f7.signature=zs;function Zp(t){return t<0}Zp.signature=zs;function jp(t){return t>0}jp.signature=zs;function Yp(t){return t===0}Yp.signature=zs;function Jp(t){return Number.isNaN(t)}Jp.signature=zs;var CE="isNegative",m7=["typed"],Xp=A(CE,m7,t=>{var{typed:e}=t;return e(CE,{number:Zp,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:e.referToSelf(r=>n=>e.find(r,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var NE="isNumeric",p7=["typed"],Qp=A(NE,p7,t=>{var{typed:e}=t;return e(NE,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var AE="hasNumericValue",d7=["typed","isNumeric"],Kp=A(AE,d7,t=>{var{typed:e,isNumeric:r}=t;return e(AE,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var FE="isPositive",h7=["typed"],ed=A(FE,h7,t=>{var{typed:e}=t;return e(FE,{number:jp,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:e.referToSelf(r=>n=>e.find(r,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var SE="isZero",v7=["typed"],rd=A(SE,v7,t=>{var{typed:e}=t;return e(SE,{number:Yp,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:e.referToSelf(r=>n=>e.find(r,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var ME="isNaN",g7=["typed"],td=A(ME,g7,t=>{var{typed:e}=t;return e(ME,{number:Jp,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return Oe(n,Number.isNaN)}})});var TE="typeOf",y7=["typed"],nd=A(TE,y7,t=>{var{typed:e}=t;return e(TE,{any:nr})});function Tt(t,e,r){if(r==null)return t.eq(e);if(t.eq(e))return!0;if(t.isNaN()||e.isNaN())return!1;if(t.isFinite()&&e.isFinite()){var n=t.minus(e).abs();if(n.isZero())return!0;var i=t.constructor.max(t.abs(),e.abs());return n.lte(i.times(r))}return!1}function OE(t,e,r){return ct(t.re,e.re,r)&&ct(t.im,e.im,r)}var Bn=A("compareUnits",["typed"],t=>{var{typed:e}=t;return{"Unit, Unit":e.referToSelf(r=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(r,[n.valueType(),i.valueType()])(n.value,i.value)})}});var Ul="equalScalar",x7=["typed","config"],id=A(Ul,x7,t=>{var{typed:e,config:r}=t,n=Bn({typed:e});return e(Ul,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return ct(a,o,r.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||Tt(a,o,r.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return OE(a,o,r.epsilon)}},n)}),SY=A(Ul,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Ul,{"number, number":function(i,a){return ct(i,a,r.epsilon)}})});var D7="SparseMatrix",b7=["typed","equalScalar","Matrix"],ad=A(D7,b7,t=>{var{typed:e,equalScalar:r,Matrix:n}=t;function i(d,g){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(g&&!lt(g))throw new Error("Invalid datatype: "+g);if(Fe(d))a(this,d,g);else if(d&&lr(d.index)&&lr(d.ptr)&&lr(d.size))this._values=d.values,this._index=d.index,this._ptr=d.ptr,this._size=d.size,this._datatype=g||d.datatype;else if(lr(d))o(this,d,g);else{if(d)throw new TypeError("Unsupported type of data ("+nr(d)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=g}}function a(d,g,D){g.type==="SparseMatrix"?(d._values=g._values?Ie(g._values):void 0,d._index=Ie(g._index),d._ptr=Ie(g._ptr),d._size=Ie(g._size),d._datatype=D||g._datatype):o(d,g.valueOf(),D||g._datatype)}function o(d,g,D){d._values=[],d._index=[],d._ptr=[],d._datatype=D;var N=g.length,v=0,w=r,b=0;if(lt(D)&&(w=e.find(r,[D,D])||r,b=e.convert(0,D)),N>0){var y=0;do{d._ptr.push(d._index.length);for(var E=0;E<N;E++){var F=g[E];if(lr(F)){if(y===0&&v<F.length&&(v=F.length),y<F.length){var S=F[y];w(S,b)||(d._values.push(S),d._index.push(E))}}else y===0&&v<1&&(v=1),w(F,b)||(d._values.push(F),d._index.push(E))}y++}while(y<v)}d._ptr.push(d._index.length),d._size=[N,v]}i.prototype=new n,i.prototype.createSparseMatrix=function(d,g){return new i(d,g)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Yi(this._values,nr)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(d,g){return new i(d,g)},i.prototype.density=function(){var d=this._size[0],g=this._size[1];return d!==0&&g!==0?this._index.length/(d*g):0},i.prototype.subset=function(d,g,D){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return c(this,d);case 2:case 3:return u(this,d,g,D);default:throw new SyntaxError("Wrong number of arguments")}};function c(d,g){if(!Wi(g))throw new TypeError("Invalid index");var D=g.isScalar();if(D)return d.get(g.min());var N=g.size();if(N.length!==d._size.length)throw new Ue(N.length,d._size.length);var v,w,b,y,E=g.min(),F=g.max();for(v=0,w=d._size.length;v<w;v++)xr(E[v],d._size[v]),xr(F[v],d._size[v]);var S=d._values,C=d._index,B=d._ptr,I=g.dimension(0),L=g.dimension(1),k=[],P=[];I.forEach(function(_,z){P[_]=z[0],k[_]=!0});var M=S?[]:void 0,T=[],H=[];return L.forEach(function(_){for(H.push(T.length),b=B[_],y=B[_+1];b<y;b++)v=C[b],k[v]===!0&&(T.push(P[v]),M&&M.push(S[b]))}),H.push(T.length),new i({values:M,index:T,ptr:H,size:N,datatype:d._datatype})}function u(d,g,D,N){if(!g||g.isIndex!==!0)throw new TypeError("Invalid index");var v=g.size(),w=g.isScalar(),b;if(Fe(D)?(b=D.size(),D=D.toArray()):b=ze(D),w){if(b.length!==0)throw new TypeError("Scalar expected");d.set(g.min(),D,N)}else{if(v.length!==1&&v.length!==2)throw new Ue(v.length,d._size.length,"<");if(b.length<v.length){for(var y=0,E=0;v[y]===1&&b[y]===1;)y++;for(;v[y]===1;)E++,y++;D=Cl(D,v.length,E,b)}if(!Zi(v,b))throw new Ue(v,b,">");if(v.length===1){var F=g.dimension(0);F.forEach(function(B,I){xr(B),d.set([B,0],D[I[0]],N)})}else{var S=g.dimension(0),C=g.dimension(1);S.forEach(function(B,I){xr(B),C.forEach(function(L,k){xr(L),d.set([B,L],D[I[0]][k[0]],N)})})}}return d}i.prototype.get=function(d){if(!lr(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new Ue(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var g=d[0],D=d[1];xr(g,this._size[0]),xr(D,this._size[1]);var N=s(g,this._ptr[D],this._ptr[D+1],this._index);return N<this._ptr[D+1]&&this._index[N]===g?this._values[N]:0},i.prototype.set=function(d,g,D){if(!lr(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new Ue(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var N=d[0],v=d[1],w=this._size[0],b=this._size[1],y=r,E=0;lt(this._datatype)&&(y=e.find(r,[this._datatype,this._datatype])||r,E=e.convert(0,this._datatype)),(N>w-1||v>b-1)&&(m(this,Math.max(N+1,w),Math.max(v+1,b),D),w=this._size[0],b=this._size[1]),xr(N,w),xr(v,b);var F=s(N,this._ptr[v],this._ptr[v+1],this._index);return F<this._ptr[v+1]&&this._index[F]===N?y(g,E)?l(F,v,this._values,this._index,this._ptr):this._values[F]=g:y(g,E)||f(F,N,v,g,this._values,this._index,this._ptr),this};function s(d,g,D,N){if(D-g===0)return D;for(var v=g;v<D;v++)if(N[v]===d)return v;return g}function l(d,g,D,N,v){D.splice(d,1),N.splice(d,1);for(var w=g+1;w<v.length;w++)v[w]--}function f(d,g,D,N,v,w,b){v.splice(d,0,N),w.splice(d,0,g);for(var y=D+1;y<b.length;y++)b[y]++}i.prototype.resize=function(d,g,D){if(!St(d))throw new TypeError("Array or Matrix expected");var N=d.valueOf().map(w=>Array.isArray(w)&&w.length===1?w[0]:w);if(N.length!==2)throw new Error("Only two dimensions matrix are supported");N.forEach(function(w){if(!He(w)||!Ae(w)||w<0)throw new TypeError("Invalid size, must contain positive integers (size: "+qe(N)+")")});var v=D?this.clone():this;return m(v,N[0],N[1],g)};function m(d,g,D,N){var v=N||0,w=r,b=0;lt(d._datatype)&&(w=e.find(r,[d._datatype,d._datatype])||r,b=e.convert(0,d._datatype),v=e.convert(v,d._datatype));var y=!w(v,b),E=d._size[0],F=d._size[1],S,C,B;if(D>F){for(C=F;C<D;C++)if(d._ptr[C]=d._values.length,y)for(S=0;S<E;S++)d._values.push(v),d._index.push(S);d._ptr[D]=d._values.length}else D<F&&(d._ptr.splice(D+1,F-D),d._values.splice(d._ptr[D],d._values.length),d._index.splice(d._ptr[D],d._index.length));if(F=D,g>E){if(y){var I=0;for(C=0;C<F;C++){d._ptr[C]=d._ptr[C]+I,B=d._ptr[C+1]+I;var L=0;for(S=E;S<g;S++,L++)d._values.splice(B+L,0,v),d._index.splice(B+L,0,S),I++}d._ptr[F]=d._values.length}}else if(g<E){var k=0;for(C=0;C<F;C++){d._ptr[C]=d._ptr[C]-k;var P=d._ptr[C],M=d._ptr[C+1]-k;for(B=P;B<M;B++)S=d._index[B],S>g-1&&(d._values.splice(B,1),d._index.splice(B,1),k++)}d._ptr[C]=d._values.length}return d._size[0]=g,d._size[1]=D,d}i.prototype.reshape=function(d,g){if(!lr(d))throw new TypeError("Array expected");if(d.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");d.forEach(function(_){if(!He(_)||!Ae(_)||_<=-2||_===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+qe(d)+")")});var D=this._size[0]*this._size[1];d=_s(d,D);var N=d[0]*d[1];if(D!==N)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var v=g?this.clone():this;if(this._size[0]===d[0]&&this._size[1]===d[1])return v;for(var w=[],b=0;b<v._ptr.length;b++)for(var y=0;y<v._ptr[b+1]-v._ptr[b];y++)w.push(b);for(var E=v._values.slice(),F=v._index.slice(),S=0;S<v._index.length;S++){var C=F[S],B=w[S],I=C*v._size[1]+B;w[S]=I%d[1],F[S]=Math.floor(I/d[1])}v._values.length=0,v._index.length=0,v._ptr.length=d[1]+1,v._size=d.slice();for(var L=0;L<v._ptr.length;L++)v._ptr[L]=0;for(var k=0;k<E.length;k++){var P=F[k],M=w[k],T=E[k],H=s(P,v._ptr[M],v._ptr[M+1],v._index);f(H,P,M,T,v._values,v._index,v._ptr)}return v},i.prototype.clone=function(){var d=new i({values:this._values?Ie(this._values):void 0,index:Ie(this._index),ptr:Ie(this._ptr),size:Ie(this._size),datatype:this._datatype});return d},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(d,g){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var D=this,N=this._size[0],v=this._size[1],w=Ll(d),b=function(E,F,S){return w===1?d(E):w===2?d(E,[F,S]):d(E,[F,S],D)};return p(this,0,N-1,0,v-1,b,g)};function p(d,g,D,N,v,w,b){var y=[],E=[],F=[],S=r,C=0;lt(d._datatype)&&(S=e.find(r,[d._datatype,d._datatype])||r,C=e.convert(0,d._datatype));for(var B=function(q,J,ae){q=w(q,J,ae),S(q,C)||(y.push(q),E.push(J))},I=N;I<=v;I++){F.push(y.length);var L=d._ptr[I],k=d._ptr[I+1];if(b)for(var P=L;P<k;P++){var M=d._index[P];M>=g&&M<=D&&B(d._values[P],M-g,I-N)}else{for(var T={},H=L;H<k;H++){var _=d._index[H];T[_]=d._values[H]}for(var z=g;z<=D;z++){var Y=z in T?T[z]:0;B(Y,z-g,I-N)}}}return F.push(y.length),new i({values:y,index:E,ptr:F,size:[D-g+1,v-N+1]})}i.prototype.forEach=function(d,g){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var D=this,N=this._size[0],v=this._size[1],w=0;w<v;w++){var b=this._ptr[w],y=this._ptr[w+1];if(g)for(var E=b;E<y;E++){var F=this._index[E];d(this._values[E],[F,w],D)}else{for(var S={},C=b;C<y;C++){var B=this._index[C];S[B]=this._values[C]}for(var I=0;I<N;I++){var L=I in S?S[I]:0;d(L,[I,w],D)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var d=this._size[1],g=0;g<d;g++)for(var D=this._ptr[g],N=this._ptr[g+1],v=D;v<N;v++){var w=this._index[v];yield{value:this._values[v],index:[w,g]}}},i.prototype.toArray=function(){return h(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return h(this._values,this._index,this._ptr,this._size,!1)};function h(d,g,D,N,v){var w=N[0],b=N[1],y=[],E,F;for(E=0;E<w;E++)for(y[E]=[],F=0;F<b;F++)y[E][F]=0;for(F=0;F<b;F++)for(var S=D[F],C=D[F+1],B=S;B<C;B++)E=g[B],y[E][F]=d?v?Ie(d[B]):d[B]:1;return y}return i.prototype.format=function(d){for(var g=this._size[0],D=this._size[1],N=this.density(),v="Sparse Matrix ["+qe(g,d)+" x "+qe(D,d)+"] density: "+qe(N,d)+`
`,w=0;w<D;w++)for(var b=this._ptr[w],y=this._ptr[w+1],E=b;E<y;E++){var F=this._index[E];v+=`
(`+qe(F,d)+", "+qe(w,d)+") ==> "+(this._values?qe(this._values[E],d):"X")}return v},i.prototype.toString=function(){return qe(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(d){if(d){if(Le(d)&&(d=d.toNumber()),!He(d)||!Ae(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var g=d>0?d:0,D=d<0?-d:0,N=this._size[0],v=this._size[1],w=Math.min(N-D,v-g),b=[],y=[],E=[];E[0]=0;for(var F=g;F<v&&b.length<w;F++)for(var S=this._ptr[F],C=this._ptr[F+1],B=S;B<C;B++){var I=this._index[B];if(I===F-g+D){b.push(this._values[B]),y[b.length-1]=I-D;break}}return E.push(b.length),new i({values:b,index:y,ptr:E,size:[w,1]})},i.fromJSON=function(d){return new i(d)},i.diagonal=function(d,g,D,N,v){if(!lr(d))throw new TypeError("Array expected, size parameter");if(d.length!==2)throw new Error("Only two dimensions matrix are supported");if(d=d.map(function(_){if(Le(_)&&(_=_.toNumber()),!He(_)||!Ae(_)||_<1)throw new Error("Size values must be positive integers");return _}),D){if(Le(D)&&(D=D.toNumber()),!He(D)||!Ae(D))throw new TypeError("The parameter k must be an integer number")}else D=0;var w=r,b=0;lt(v)&&(w=e.find(r,[v,v])||r,b=e.convert(0,v));var y=D>0?D:0,E=D<0?-D:0,F=d[0],S=d[1],C=Math.min(F-E,S-y),B;if(lr(g)){if(g.length!==C)throw new Error("Invalid value array length");B=function(z){return g[z]}}else if(Fe(g)){var I=g.size();if(I.length!==1||I[0]!==C)throw new Error("Invalid matrix length");B=function(z){return g.get([z])}}else B=function(){return g};for(var L=[],k=[],P=[],M=0;M<S;M++){P.push(L.length);var T=M-y;if(T>=0&&T<C){var H=B(T);w(H,b)||(k.push(T+E),L.push(H))}}return P.push(L.length),new i({values:L,index:k,ptr:P,size:[F,S]})},i.prototype.swapRows=function(d,g){if(!He(d)||!Ae(d)||!He(g)||!Ae(g))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return xr(d,this._size[0]),xr(g,this._size[0]),i._swapRows(d,g,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(d,g,D,N,v){for(var w=N[d],b=N[d+1],y=w;y<b;y++)v(D[y],g[y])},i._swapRows=function(d,g,D,N,v,w){for(var b=0;b<D;b++){var y=w[b],E=w[b+1],F=s(d,y,E,v),S=s(g,y,E,v);if(F<E&&S<E&&v[F]===d&&v[S]===g){if(N){var C=N[F];N[F]=N[S],N[S]=C}continue}if(F<E&&v[F]===d&&(S>=E||v[S]!==g)){var B=N?N[F]:void 0;v.splice(S,0,g),N&&N.splice(S,0,B),v.splice(S<=F?F+1:F,1),N&&N.splice(S<=F?F+1:F,1);continue}if(S<E&&v[S]===g&&(F>=E||v[F]!==d)){var I=N?N[S]:void 0;v.splice(F,0,d),N&&N.splice(F,0,I),v.splice(F<=S?S+1:S,1),N&&N.splice(F<=S?S+1:S,1)}}},i},{isClass:!0});var w7="number",E7=["typed"];function C7(t){var e=t.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var r={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:t,radix:r,integerPart:n,fractionalPart:i}}else return null}function N7(t){for(var e=parseInt(t.integerPart,t.radix),r=0,n=0;n<t.fractionalPart.length;n++){var i=parseInt(t.fractionalPart[n],t.radix);r+=i/Math.pow(t.radix,n+1)}var a=e+r;if(isNaN(a))throw new SyntaxError('String "'+t.input+'" is no valid number');return a}var od=A(w7,E7,t=>{var{typed:e}=t,r=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=C7(i);if(a)return N7(a);var o=0,c=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);c&&(o=Number(c[2]),i=c[1]);var u=Number(i);if(isNaN(u))throw new SyntaxError('String "'+i+'" is no valid number');if(c){if(u>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));u>=2**(o-1)&&(u=u-2**o)}return u},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(n=>i=>Oe(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var BE="string",A7=["typed"],sd=A(BE,A7,t=>{var{typed:e}=t;return e(BE,{"":function(){return""},number:Xn,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r)),any:function(n){return String(n)}})});var IE="boolean",F7=["typed"],ud=A(IE,F7,t=>{var{typed:e}=t;return e(IE,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var S7="bignumber",M7=["typed","BigNumber"],ld=A(S7,M7,t=>{var{typed:e,BigNumber:r}=t;return e("bignumber",{"":function(){return new r(0)},number:function(i){return new r(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],c=r(a[1]),u=new r(2).pow(Number(o));if(c.gt(u.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var s=new r(2).pow(Number(o)-1);return c.gte(s)?c.sub(u):c}return new r(i)},BigNumber:function(i){return i},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Fraction:function(i){return new r(i.n).div(i.d).times(i.s)},null:function(i){return new r(0)},"Array | Matrix":e.referToSelf(n=>i=>Oe(i,n))})});var T7="complex",O7=["typed","Complex"],cd=A(T7,O7,t=>{var{typed:e,Complex:r}=t;return e("complex",{"":function(){return r.ZERO},number:function(i){return new r(i,0)},"number, number":function(i,a){return new r(i,a)},"BigNumber, BigNumber":function(i,a){return new r(i.toNumber(),a.toNumber())},Fraction:function(i){return new r(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return r(i)},null:function(i){return r(0)},Object:function(i){if("re"in i&&"im"in i)return new r(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new r(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":e.referToSelf(n=>i=>Oe(i,n))})});var B7="fraction",I7=["typed","Fraction"],fd=A(B7,I7,t=>{var{typed:e,Fraction:r}=t;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new r(i)},string:function(i){return new r(i)},"number, number":function(i,a){return new r(i,a)},null:function(i){return new r(0)},BigNumber:function(i){return new r(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Object:function(i){return new r(i)},"Array | Matrix":e.referToSelf(n=>i=>Oe(i,n))})});var _E="matrix",_7=["typed","Matrix","DenseMatrix","SparseMatrix"],md=A(_E,_7,t=>{var{typed:e,Matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(_E,{"":function(){return a([])},string:function(c){return a([],c)},"string, string":function(c,u){return a([],c,u)},Array:function(c){return a(c)},Matrix:function(c){return a(c,c.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,c,u){if(c==="dense"||c==="default"||c===void 0)return new n(o,u);if(c==="sparse")return new i(o,u);throw new TypeError("Unknown matrix type "+JSON.stringify(c)+".")}});var RE="matrixFromFunction",R7=["typed","matrix","isZero"],pd=A(RE,R7,t=>{var{typed:e,matrix:r,isZero:n}=t;return e(RE,{"Array | Matrix, function, string, string":function(o,c,u,s){return i(o,c,u,s)},"Array | Matrix, function, string":function(o,c,u){return i(o,c,u)},"Matrix, function":function(o,c){return i(o,c,"dense")},"Array, function":function(o,c){return i(o,c,"dense").toArray()},"Array | Matrix, string, function":function(o,c,u){return i(o,u,c)},"Array | Matrix, string, string, function":function(o,c,u,s){return i(o,s,c,u)}});function i(a,o,c,u){var s;return u!==void 0?s=r(c,u):s=r(c),s.resize(a),s.forEach(function(l,f){var m=o(f);n(m)||s.set(f,m)}),s}});var PE="matrixFromRows",P7=["typed","matrix","flatten","size"],dd=A(PE,P7,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(PE,{"...Array":function(u){return a(u)},"...Matrix":function(u){return r(a(u.map(s=>s.toArray())))}});function a(c){if(c.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var u=o(c[0]),s=[];for(var l of c){var f=o(l);if(f!==u)throw new TypeError("The vectors had different length: "+(u|0)+" \u2260 "+(f|0));s.push(n(l))}return s}function o(c){var u=i(c);if(u.length===1)return u[0];if(u.length===2){if(u[0]===1)return u[1];if(u[1]===1)return u[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var LE="matrixFromColumns",L7=["typed","matrix","flatten","size"],hd=A(LE,L7,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(LE,{"...Array":function(u){return a(u)},"...Matrix":function(u){return r(a(u.map(s=>s.toArray())))}});function a(c){if(c.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var u=o(c[0]),s=[],l=0;l<u;l++)s[l]=[];for(var f of c){var m=o(f);if(m!==u)throw new TypeError("The vectors had different length: "+(u|0)+" \u2260 "+(m|0));for(var p=n(f),h=0;h<u;h++)s[h].push(p[h])}return s}function o(c){var u=i(c);if(u.length===1)return u[0];if(u.length===2){if(u[0]===1)return u[1];if(u[1]===1)return u[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var kE="splitUnit",k7=["typed"],vd=A(kE,k7,t=>{var{typed:e}=t;return e(kE,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var qE="unaryMinus",q7=["typed"],gd=A(qE,q7,t=>{var{typed:e}=t;return e(qE,{number:rp,"Complex | BigNumber | Fraction":r=>r.neg(),Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=e.find(r,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r,!0))})});var zE="unaryPlus",z7=["typed","config","BigNumber"],yd=A(zE,z7,t=>{var{typed:e,config:r,BigNumber:n}=t;return e(zE,{number:tp,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":e.referToSelf(i=>a=>Oe(a,i,!0)),"boolean | string":function(a){return r.number==="BigNumber"?new n(+a):+a}})});var UE="abs",U7=["typed"],xd=A(UE,U7,t=>{var{typed:e}=t;return e(UE,{number:Qm,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r,!0))})});var VE="apply",V7=["typed","isInteger"],Us=A(VE,V7,t=>{var{typed:e,isInteger:r}=t;return e(VE,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!r(a))throw new TypeError("Integer number expected for dimension");var c=Array.isArray(i)?ze(i):i.size();if(a<0||a>=c.length)throw new Pt(a,c.length);return Fe(i)?i.create(Vl(i.valueOf(),a,o)):Vl(i,a,o)}})});function Vl(t,e,r){var n,i,a;if(e<=0)if(Array.isArray(t[0])){for(a=$7(t),i=[],n=0;n<a.length;n++)i[n]=Vl(a[n],e-1,r);return i}else return r(t);else{for(i=[],n=0;n<t.length;n++)i[n]=Vl(t[n],e-1,r);return i}}function $7(t){var e=t.length,r=t[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<e;n++)o.push(t[n][i]);a.push(o)}return a}var $E="addScalar",H7=["typed"],Dd=A($E,H7,t=>{var{typed:e}=t;return e($E,{"number, number":Km,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":e.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var HE="cbrt",W7=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],bd=A(HE,W7,t=>{var{config:e,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:c,Fraction:u}=t;return r(HE,{number:Bo,Complex:s,"Complex, boolean":s,BigNumber:function(m){return m.cbrt()},Unit:l});function s(f,m){var p=f.arg()/3,h=f.abs(),d=new o(Bo(h),0).mul(new o(0,p).exp());if(m){var g=[d,new o(Bo(h),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(Bo(h),0).mul(new o(0,p-Math.PI*2/3).exp())];return e.matrix==="Array"?g:a(g)}else return d}function l(f){if(f.value&&Wt(f.value)){var m=f.clone();return m.value=1,m=m.pow(1/3),m.value=s(f.value),m}else{var p=n(f.value);p&&(f.value=i(f.value));var h;Le(f.value)?h=new c(1).div(3):Ti(f.value)?h=new u(1,3):h=1/3;var d=f.pow(h);return p&&(d.value=i(d.value)),d}}});var G7="matAlgo11xS0s",Z7=["typed","equalScalar"],Dr=A(G7,Z7,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o,c){var u=i._values,s=i._index,l=i._ptr,f=i._size,m=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],d,g=r,D=0,N=o;typeof m=="string"&&(d=m,g=e.find(r,[d,d]),D=e.convert(0,d),a=e.convert(a,d),N=e.find(o,[d,d]));for(var v=[],w=[],b=[],y=0;y<h;y++){b[y]=w.length;for(var E=l[y],F=l[y+1],S=E;S<F;S++){var C=s[S],B=c?N(a,u[S]):N(u[S],a);g(B,D)||(w.push(C),v.push(B))}}return b[h]=w.length,i.createSparseMatrix({values:v,index:w,ptr:b,size:[p,h],datatype:d})}});var j7="matAlgo12xSfs",Y7=["typed","DenseMatrix"],cr=A(j7,Y7,t=>{var{typed:e,DenseMatrix:r}=t;return function(i,a,o,c){var u=i._values,s=i._index,l=i._ptr,f=i._size,m=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],d,g=o;typeof m=="string"&&(d=m,a=e.convert(a,d),g=e.find(o,[d,d]));for(var D=[],N=[],v=[],w=0;w<h;w++){for(var b=w+1,y=l[w],E=l[w+1],F=y;F<E;F++){var S=s[F];N[S]=u[F],v[S]=b}for(var C=0;C<p;C++)w===0&&(D[C]=[]),v[C]===b?D[C][w]=c?g(a,N[C]):g(N[C],a):D[C][w]=c?g(a,0):g(0,a)}return new r({data:D,size:[p,h],datatype:d})}});var J7="matAlgo14xDs",X7=["typed"],ft=A(J7,X7,t=>{var{typed:e}=t;return function(i,a,o,c){var u=i._data,s=i._size,l=i._datatype,f,m=o;typeof l=="string"&&(f=l,a=e.convert(a,f),m=e.find(o,[f,f]));var p=s.length>0?r(m,0,s,s[0],u,a,c):[];return i.createDenseMatrix({data:p,size:Ie(s),datatype:f})};function r(n,i,a,o,c,u,s){var l=[];if(i===a.length-1)for(var f=0;f<o;f++)l[f]=s?n(u,c[f]):n(c[f],u);else for(var m=0;m<o;m++)l[m]=r(n,i+1,a,a[i+1],c[m],u,s);return l}});var wd="ceil",Q7=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],K7=A(wd,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;return e(wd,{number:function(a){return ct(a,n(a),r.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(ct(a,n(a,o),r.epsilon))return n(a,o);var[c,u]="".concat(a,"e").split("e"),s=Math.ceil(Number("".concat(c,"e").concat(Number(u)+o)));return[c,u]="".concat(s,"e").split("e"),Number("".concat(c,"e").concat(Number(u)-o))}})}),Ed=A(wd,Q7,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:c}=t,u=Dr({typed:e,equalScalar:a}),s=cr({typed:e,DenseMatrix:c}),l=ft({typed:e}),f=K7({typed:e,config:r,round:n});return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,h){return p.ceil(h)},"Complex, BigNumber":function(p,h){return p.ceil(h.toNumber())},BigNumber:function(p){return Tt(p,n(p),r.epsilon)?n(p):p.ceil()},"BigNumber, BigNumber":function(p,h){return Tt(p,n(p,h),r.epsilon)?n(p,h):p.toDecimalPlaces(h.toNumber(),Oa.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,h){return p.ceil(h)},"Fraction, BigNumber":function(p,h){return p.ceil(h.toNumber())},"Array | Matrix":e.referToSelf(m=>p=>Oe(p,m,!0)),"Array, number | BigNumber":e.referToSelf(m=>(p,h)=>Oe(p,d=>m(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(m=>(p,h)=>u(p,h,m,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(m=>(p,h)=>l(p,h,m,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,h)=>l(i(h),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,h)=>a(p,0)?o(h.size(),h.storage()):h.storage()==="dense"?l(h,p,m,!0):s(h,p,m,!0))})});var WE="cube",e9=["typed"],Cd=A(WE,e9,t=>{var{typed:e}=t;return e(WE,{number:np,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var GE="exp",r9=["typed"],Nd=A(GE,r9,t=>{var{typed:e}=t;return e(GE,{number:ip,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var ZE="expm1",t9=["typed","Complex"],Ad=A(ZE,t9,t=>{var{typed:e,Complex:r}=t;return e(ZE,{number:ap,Complex:function(i){var a=Math.exp(i.re);return new r(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var Fd="fix",n9=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],i9=A(Fd,["typed","ceil","floor"],t=>{var{typed:e,ceil:r,floor:n}=t;return e(Fd,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),Sd=A(Fd,n9,t=>{var{typed:e,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:c,DenseMatrix:u}=t,s=cr({typed:e,DenseMatrix:u}),l=ft({typed:e}),f=i9({typed:e,ceil:i,floor:a});return e("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(p){return new r(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,h){return new r(p.re>0?a(p.re,h):i(p.re,h),p.im>0?a(p.im,h):i(p.im,h))},"Complex, BigNumber":function(p,h){var d=h.toNumber();return new r(p.re>0?a(p.re,d):i(p.re,d),p.im>0?a(p.im,d):i(p.im,d))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,h){return p.isNegative()?i(p,h):a(p,h)},Fraction:function(p){return p.s<0?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,h){return p.s<0?i(p,h):a(p,h)},"Array | Matrix":e.referToSelf(m=>p=>Oe(p,m,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(m=>(p,h)=>Oe(p,d=>m(d,h),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,h)=>l(n(h),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,h)=>o(p,0)?c(h.size(),h.storage()):h.storage()==="dense"?l(h,p,m,!0):s(h,p,m,!0))})});var Md="floor",a9=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],o9=A(Md,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;return e(Md,{number:function(a){return ct(a,n(a),r.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(ct(a,n(a,o),r.epsilon))return n(a,o);var[c,u]="".concat(a,"e").split("e"),s=Math.floor(Number("".concat(c,"e").concat(Number(u)+o)));return[c,u]="".concat(s,"e").split("e"),Number("".concat(c,"e").concat(Number(u)-o))}})}),Td=A(Md,a9,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:c}=t,u=Dr({typed:e,equalScalar:a}),s=cr({typed:e,DenseMatrix:c}),l=ft({typed:e}),f=o9({typed:e,config:r,round:n});return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,h){return p.floor(h)},"Complex, BigNumber":function(p,h){return p.floor(h.toNumber())},BigNumber:function(p){return Tt(p,n(p),r.epsilon)?n(p):p.floor()},"BigNumber, BigNumber":function(p,h){return Tt(p,n(p,h),r.epsilon)?n(p,h):p.toDecimalPlaces(h.toNumber(),Oa.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,h){return p.floor(h)},"Fraction, BigNumber":function(p,h){return p.floor(h.toNumber())},"Array | Matrix":e.referToSelf(m=>p=>Oe(p,m,!0)),"Array, number | BigNumber":e.referToSelf(m=>(p,h)=>Oe(p,d=>m(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(m=>(p,h)=>u(p,h,m,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(m=>(p,h)=>l(p,h,m,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,h)=>l(i(h),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,h)=>a(p,0)?o(h.size(),h.storage()):h.storage()==="dense"?l(h,p,m,!0):s(h,p,m,!0))})});var s9="matAlgo01xDSid",u9=["typed"],$t=A(s9,u9,t=>{var{typed:e}=t;return function(n,i,a,o){var c=n._data,u=n._size,s=n._datatype,l=i._values,f=i._index,m=i._ptr,p=i._size,h=i._datatype;if(u.length!==p.length)throw new Ue(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");if(!l)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],D=typeof s=="string"&&s===h?s:void 0,N=D?e.find(a,[D,D]):a,v,w,b=[];for(v=0;v<d;v++)b[v]=[];var y=[],E=[];for(w=0;w<g;w++){for(var F=w+1,S=m[w],C=m[w+1],B=S;B<C;B++)v=f[B],y[v]=o?N(l[B],c[v][w]):N(c[v][w],l[B]),E[v]=F;for(v=0;v<d;v++)E[v]===F?b[v][w]=y[v]:b[v][w]=c[v][w]}return n.createDenseMatrix({data:b,size:[d,g],datatype:D})}});var l9="matAlgo04xSidSid",c9=["typed","equalScalar"],_o=A(l9,c9,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var c=i._values,u=i._index,s=i._ptr,l=i._size,f=i._datatype,m=a._values,p=a._index,h=a._ptr,d=a._size,g=a._datatype;if(l.length!==d.length)throw new Ue(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");var D=l[0],N=l[1],v,w=r,b=0,y=o;typeof f=="string"&&f===g&&(v=f,w=e.find(r,[v,v]),b=e.convert(0,v),y=e.find(o,[v,v]));var E=c&&m?[]:void 0,F=[],S=[],C=c&&m?[]:void 0,B=c&&m?[]:void 0,I=[],L=[],k,P,M,T,H;for(P=0;P<N;P++){S[P]=F.length;var _=P+1;for(T=s[P],H=s[P+1],M=T;M<H;M++)k=u[M],F.push(k),I[k]=_,C&&(C[k]=c[M]);for(T=h[P],H=h[P+1],M=T;M<H;M++)if(k=p[M],I[k]===_){if(C){var z=y(C[k],m[M]);w(z,b)?I[k]=null:C[k]=z}}else F.push(k),L[k]=_,B&&(B[k]=m[M]);if(C&&B)for(M=S[P];M<F.length;)k=F[M],I[k]===_?(E[M]=C[k],M++):L[k]===_?(E[M]=B[k],M++):F.splice(M,1)}return S[N]=F.length,i.createSparseMatrix({values:E,index:F,ptr:S,size:[D,N],datatype:v})}});var f9="matAlgo10xSids",m9=["typed","DenseMatrix"],en=A(f9,m9,t=>{var{typed:e,DenseMatrix:r}=t;return function(i,a,o,c){var u=i._values,s=i._index,l=i._ptr,f=i._size,m=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],h=f[1],d,g=o;typeof m=="string"&&(d=m,a=e.convert(a,d),g=e.find(o,[d,d]));for(var D=[],N=[],v=[],w=0;w<h;w++){for(var b=w+1,y=l[w],E=l[w+1],F=y;F<E;F++){var S=s[F];N[S]=u[F],v[S]=b}for(var C=0;C<p;C++)w===0&&(D[C]=[]),v[C]===b?D[C][w]=c?g(a,N[C]):g(N[C],a):D[C][w]=a}return new r({data:D,size:[p,h],datatype:d})}});var p9="matAlgo13xDD",d9=["typed"],jE=A(p9,d9,t=>{var{typed:e}=t;return function(i,a,o){var c=i._data,u=i._size,s=i._datatype,l=a._data,f=a._size,m=a._datatype,p=[];if(u.length!==f.length)throw new Ue(u.length,f.length);for(var h=0;h<u.length;h++){if(u[h]!==f[h])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+f+")");p[h]=u[h]}var d,g=o;typeof s=="string"&&s===m&&(d=s,g=e.find(o,[d,d]));var D=p.length>0?r(g,0,p,p[0],c,l):[];return i.createDenseMatrix({data:D,size:p,datatype:d})};function r(n,i,a,o,c,u){var s=[];if(i===a.length-1)for(var l=0;l<o;l++)s[l]=n(c[l],u[l]);else for(var f=0;f<o;f++)s[f]=r(n,i+1,a,a[i+1],c[f],u[f]);return s}});var h9="broadcast",v9=["concat"],YE=A(h9,v9,t=>{var{concat:e}=t;return function(a,o){var c=Math.max(a._size.length,o._size.length);if(a._size.length===o._size.length&&a._size.every((g,D)=>g===o._size[D]))return[a,o];for(var u=r(a._size,c,0),s=r(o._size,c,0),l=[],f=0;f<c;f++)l[f]=Math.max(u[f],s[f]);for(var m=0;m<c;m++)i(u,l,m),i(s,l,m);var p=a.clone(),h=o.clone();p._size.length<c?p.reshape(r(p._size,c,1)):h._size.length<c&&h.reshape(r(h._size,c,1));for(var d=0;d<c;d++)p._size[d]<l[d]&&(p=n(p,l[d],d)),h._size[d]<l[d]&&(h=n(h,l[d],d));return[p,h]};function r(a,o,c){return[...Array(o-a.length).fill(c),...a]}function n(a,o,c){return e(...Array(o).fill(a),c)}function i(a,o,c){if(a[c]<o[c]&a[c]>1)throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(a,") not possible to broadcast dimension ").concat(c," with size ").concat(a[c]," to size ").concat(o[c]))}});var g9="matrixAlgorithmSuite",y9=["typed","matrix","concat"],$e=A(g9,y9,t=>{var{typed:e,matrix:r,concat:n}=t,i=jE({typed:e}),a=ft({typed:e}),o=YE({concat:n});return function(u){var s=u.elop,l=u.SD||u.DS,f;s?(f={"DenseMatrix, DenseMatrix":(d,g)=>i(...o(d,g),s),"Array, Array":(d,g)=>i(...o(r(d),r(g)),s).valueOf(),"Array, DenseMatrix":(d,g)=>i(...o(r(d),g),s),"DenseMatrix, Array":(d,g)=>i(...o(d,r(g)),s)},u.SS&&(f["SparseMatrix, SparseMatrix"]=(d,g)=>u.SS(...o(d,g),s,!1)),u.DS&&(f["DenseMatrix, SparseMatrix"]=(d,g)=>u.DS(...o(d,g),s,!1),f["Array, SparseMatrix"]=(d,g)=>u.DS(...o(r(d),g),s,!1)),l&&(f["SparseMatrix, DenseMatrix"]=(d,g)=>l(...o(g,d),s,!0),f["SparseMatrix, Array"]=(d,g)=>l(...o(r(g),d),s,!0))):(f={"DenseMatrix, DenseMatrix":e.referToSelf(d=>(g,D)=>i(...o(g,D),d)),"Array, Array":e.referToSelf(d=>(g,D)=>i(...o(r(g),r(D)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(g,D)=>i(...o(r(g),D),d)),"DenseMatrix, Array":e.referToSelf(d=>(g,D)=>i(...o(g,r(D)),d))},u.SS&&(f["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,D)=>u.SS(...o(g,D),d,!1))),u.DS&&(f["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,D)=>u.DS(...o(g,D),d,!1)),f["Array, SparseMatrix"]=e.referToSelf(d=>(g,D)=>u.DS(...o(r(g),D),d,!1))),l&&(f["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(g,D)=>l(...o(D,g),d,!0)),f["SparseMatrix, Array"]=e.referToSelf(d=>(g,D)=>l(...o(r(D),g),d,!0))));var m=u.scalar||"any",p=u.Ds||u.Ss;p&&(s?(f["DenseMatrix,"+m]=(d,g)=>a(d,g,s,!1),f[m+", DenseMatrix"]=(d,g)=>a(g,d,s,!0),f["Array,"+m]=(d,g)=>a(r(d),g,s,!1).valueOf(),f[m+", Array"]=(d,g)=>a(r(g),d,s,!0).valueOf()):(f["DenseMatrix,"+m]=e.referToSelf(d=>(g,D)=>a(g,D,d,!1)),f[m+", DenseMatrix"]=e.referToSelf(d=>(g,D)=>a(D,g,d,!0)),f["Array,"+m]=e.referToSelf(d=>(g,D)=>a(r(g),D,d,!1).valueOf()),f[m+", Array"]=e.referToSelf(d=>(g,D)=>a(r(D),g,d,!0).valueOf())));var h=u.sS!==void 0?u.sS:u.Ss;return s?(u.Ss&&(f["SparseMatrix,"+m]=(d,g)=>u.Ss(d,g,s,!1)),h&&(f[m+", SparseMatrix"]=(d,g)=>h(g,d,s,!0))):(u.Ss&&(f["SparseMatrix,"+m]=e.referToSelf(d=>(g,D)=>u.Ss(g,D,d,!1))),h&&(f[m+", SparseMatrix"]=e.referToSelf(d=>(g,D)=>h(D,g,d,!0)))),s&&s.signatures&&vl(f,s.signatures),f}});function Ri(t,e,r,n){if(!(this instanceof Ri))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=e,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+t+" ("+e+" provided, "+r+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}Ri.prototype=new Error;Ri.prototype.constructor=Error;Ri.prototype.name="ArgumentsError";Ri.prototype.isArgumentsError=!0;var JE="gcd",x9=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Od="number | BigNumber | Fraction | Matrix | Array",D9="".concat(Od,", ").concat(Od,", ...").concat(Od);function XE(t){return!t.some(e=>Array.isArray(e))}var Bd=A(JE,x9,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=t,c=$t({typed:e}),u=_o({typed:e,equalScalar:n}),s=en({typed:e,DenseMatrix:a}),l=$e({typed:e,matrix:r,concat:o});return e(JE,{"number, number":op,"BigNumber, BigNumber":f,"Fraction, Fraction":(m,p)=>m.gcd(p)},l({SS:u,DS:c,Ss:s}),{[D9]:e.referToSelf(m=>(p,h,d)=>{for(var g=m(p,h),D=0;D<d.length;D++)g=m(g,d[D]);return g}),Array:e.referToSelf(m=>p=>{if(p.length===1&&Array.isArray(p[0])&&XE(p[0]))return m(...p[0]);if(XE(p))return m(...p);throw new Ri("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(m=>p=>m(p.toArray()))});function f(m,p){if(!m.isInt()||!p.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var h=new i(0);!p.isZero();){var d=m.mod(p);m=p,p=d}return m.lt(h)?m.neg():m}});var b9="matAlgo02xDS0",w9=["typed","equalScalar"],mt=A(b9,w9,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o,c){var u=i._data,s=i._size,l=i._datatype,f=a._values,m=a._index,p=a._ptr,h=a._size,d=a._datatype;if(s.length!==h.length)throw new Ue(s.length,h.length);if(s[0]!==h[0]||s[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=s[0],D=s[1],N,v=r,w=0,b=o;typeof l=="string"&&l===d&&(N=l,v=e.find(r,[N,N]),w=e.convert(0,N),b=e.find(o,[N,N]));for(var y=[],E=[],F=[],S=0;S<D;S++){F[S]=E.length;for(var C=p[S],B=p[S+1],I=C;I<B;I++){var L=m[I],k=c?b(f[I],u[L][S]):b(u[L][S],f[I]);v(k,w)||(E.push(L),y.push(k))}}return F[D]=E.length,a.createSparseMatrix({values:y,index:E,ptr:F,size:[g,D],datatype:N})}});var E9="matAlgo06xS0S0",C9=["typed","equalScalar"],ra=A(E9,C9,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var c=i._values,u=i._size,s=i._datatype,l=a._values,f=a._size,m=a._datatype;if(u.length!==f.length)throw new Ue(u.length,f.length);if(u[0]!==f[0]||u[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+f+")");var p=u[0],h=u[1],d,g=r,D=0,N=o;typeof s=="string"&&s===m&&(d=s,g=e.find(r,[d,d]),D=e.convert(0,d),N=e.find(o,[d,d]));for(var v=c&&l?[]:void 0,w=[],b=[],y=v?[]:void 0,E=[],F=[],S=0;S<h;S++){b[S]=w.length;var C=S+1;if(Jm(i,S,E,y,F,C,w,N),Jm(a,S,E,y,F,C,w,N),y)for(var B=b[S];B<w.length;){var I=w[B];if(F[I]===C){var L=y[I];g(L,D)?w.splice(B,1):(v.push(L),B++)}else w.splice(B,1)}else for(var k=b[S];k<w.length;){var P=w[k];F[P]!==C?w.splice(k,1):k++}}return b[h]=w.length,i.createSparseMatrix({values:v,index:w,ptr:b,size:[p,h],datatype:d})}});var QE="lcm",N9=["typed","matrix","equalScalar","concat"],Id=A(QE,N9,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=mt({typed:e,equalScalar:n}),o=ra({typed:e,equalScalar:n}),c=Dr({typed:e,equalScalar:n}),u=$e({typed:e,matrix:r,concat:i}),s="number | BigNumber | Fraction | Matrix | Array",l={};return l["".concat(s,", ").concat(s,", ...").concat(s)]=e.referToSelf(m=>(p,h,d)=>{for(var g=m(p,h),D=0;D<d.length;D++)g=m(g,d[D]);return g}),e(QE,{"number, number":sp,"BigNumber, BigNumber":f,"Fraction, Fraction":(m,p)=>m.lcm(p)},u({SS:o,DS:a,Ss:c}),l);function f(m,p){if(!m.isInt()||!p.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(m.isZero())return m;if(p.isZero())return p;for(var h=m.times(p);!p.isZero();){var d=p;p=m.mod(d),m=d}return h.div(m).abs()}});var KE="log10",A9=["typed","config","Complex"],_d=A(KE,A9,t=>{var{typed:e,config:r,Complex:n}=t;return e(KE,{number:function(a){return a>=0||r.predictable?up(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||r.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>Oe(a,i))})});var eC="log2",F9=["typed","config","Complex"],Rd=A(eC,F9,t=>{var{typed:e,config:r,Complex:n}=t;return e(eC,{number:function(o){return o>=0||r.predictable?lp(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||r.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>Oe(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 S9="matAlgo03xDSf",M9=["typed"],Tr=A(S9,M9,t=>{var{typed:e}=t;return function(n,i,a,o){var c=n._data,u=n._size,s=n._datatype,l=i._values,f=i._index,m=i._ptr,p=i._size,h=i._datatype;if(u.length!==p.length)throw new Ue(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");if(!l)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],D,N=0,v=a;typeof s=="string"&&s===h&&(D=s,N=e.convert(0,D),v=e.find(a,[D,D]));for(var w=[],b=0;b<d;b++)w[b]=[];for(var y=[],E=[],F=0;F<g;F++){for(var S=F+1,C=m[F],B=m[F+1],I=C;I<B;I++){var L=f[I];y[L]=o?v(l[I],c[L][F]):v(c[L][F],l[I]),E[L]=S}for(var k=0;k<d;k++)E[k]===S?w[k][F]=y[k]:w[k][F]=o?v(N,c[k][F]):v(c[k][F],N)}return n.createDenseMatrix({data:w,size:[d,g],datatype:D})}});var T9="matAlgo05xSfSf",O9=["typed","equalScalar"],ta=A(T9,O9,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var c=i._values,u=i._index,s=i._ptr,l=i._size,f=i._datatype,m=a._values,p=a._index,h=a._ptr,d=a._size,g=a._datatype;if(l.length!==d.length)throw new Ue(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");var D=l[0],N=l[1],v,w=r,b=0,y=o;typeof f=="string"&&f===g&&(v=f,w=e.find(r,[v,v]),b=e.convert(0,v),y=e.find(o,[v,v]));var E=c&&m?[]:void 0,F=[],S=[],C=E?[]:void 0,B=E?[]:void 0,I=[],L=[],k,P,M,T;for(P=0;P<N;P++){S[P]=F.length;var H=P+1;for(M=s[P],T=s[P+1];M<T;M++)k=u[M],F.push(k),I[k]=H,C&&(C[k]=c[M]);for(M=h[P],T=h[P+1];M<T;M++)k=p[M],I[k]!==H&&F.push(k),L[k]=H,B&&(B[k]=m[M]);if(E)for(M=S[P];M<F.length;){k=F[M];var _=I[k],z=L[k];if(_===H||z===H){var Y=_===H?C[k]:b,X=z===H?B[k]:b,q=y(Y,X);w(q,b)?F.splice(M,1):(E.push(q),M++)}}}return S[N]=F.length,i.createSparseMatrix({values:E,index:F,ptr:S,size:[D,N],datatype:v})}});var rC="mod",B9=["typed","matrix","equalScalar","DenseMatrix","concat"],Pd=A(rC,B9,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=mt({typed:e,equalScalar:n}),c=Tr({typed:e}),u=ta({typed:e,equalScalar:n}),s=Dr({typed:e,equalScalar:n}),l=cr({typed:e,DenseMatrix:i}),f=$e({typed:e,matrix:r,concat:a});return e(rC,{"number, number":cp,"BigNumber, BigNumber":function(p,h){if(h.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return h.isZero()?p:p.mod(h)},"Fraction, Fraction":function(p,h){if(h.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return p.compare(0)>=0?p.mod(h):p.mod(h).add(h).mod(h)}},f({SS:u,DS:c,SD:o,Ss:s,sS:l}))});var I9="multiplyScalar",_9=["typed"],Ld=A(I9,_9,t=>{var{typed:e}=t;return e("multiplyScalar",{"number, number":ep,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(r,n)=>n.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,n)=>r.multiply(n)})});var tC="multiply",R9=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],kd=A(tC,R9,t=>{var{typed:e,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=t,c=Dr({typed:e,equalScalar:a}),u=ft({typed:e});function s(b,y){switch(b.length){case 1:switch(y.length){case 1:if(b[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(b[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+b[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(b[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+b[1]+") must match Vector length ("+y[0]+")");break;case 2:if(b[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+b[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 "+b.length+" dimensions)")}}function l(b,y,E){if(E===0)throw new Error("Cannot multiply two empty vectors");return o(b,y)}function f(b,y){if(y.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return m(b,y)}function m(b,y){var E=b._data,F=b._size,S=b._datatype,C=y._data,B=y._size,I=y._datatype,L=F[0],k=B[1],P,M=n,T=i;S&&I&&S===I&&typeof S=="string"&&(P=S,M=e.find(n,[P,P]),T=e.find(i,[P,P]));for(var H=[],_=0;_<k;_++){for(var z=T(E[0],C[0][_]),Y=1;Y<L;Y++)z=M(z,T(E[Y],C[Y][_]));H[_]=z}return b.createDenseMatrix({data:H,size:[k],datatype:P})}var p=e("_multiplyMatrixVector",{"DenseMatrix, any":d,"SparseMatrix, any":N}),h=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":g,"DenseMatrix, SparseMatrix":D,"SparseMatrix, DenseMatrix":v,"SparseMatrix, SparseMatrix":w});function d(b,y){var E=b._data,F=b._size,S=b._datatype,C=y._data,B=y._datatype,I=F[0],L=F[1],k,P=n,M=i;S&&B&&S===B&&typeof S=="string"&&(k=S,P=e.find(n,[k,k]),M=e.find(i,[k,k]));for(var T=[],H=0;H<I;H++){for(var _=E[H],z=M(_[0],C[0]),Y=1;Y<L;Y++)z=P(z,M(_[Y],C[Y]));T[H]=z}return b.createDenseMatrix({data:T,size:[I],datatype:k})}function g(b,y){var E=b._data,F=b._size,S=b._datatype,C=y._data,B=y._size,I=y._datatype,L=F[0],k=F[1],P=B[1],M,T=n,H=i;S&&I&&S===I&&typeof S=="string"&&(M=S,T=e.find(n,[M,M]),H=e.find(i,[M,M]));for(var _=[],z=0;z<L;z++){var Y=E[z];_[z]=[];for(var X=0;X<P;X++){for(var q=H(Y[0],C[0][X]),J=1;J<k;J++)q=T(q,H(Y[J],C[J][X]));_[z][X]=q}}return b.createDenseMatrix({data:_,size:[L,P],datatype:M})}function D(b,y){var E=b._data,F=b._size,S=b._datatype,C=y._values,B=y._index,I=y._ptr,L=y._size,k=y._datatype;if(!C)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var P=F[0],M=L[1],T,H=n,_=i,z=a,Y=0;S&&k&&S===k&&typeof S=="string"&&(T=S,H=e.find(n,[T,T]),_=e.find(i,[T,T]),z=e.find(a,[T,T]),Y=e.convert(0,T));for(var X=[],q=[],J=[],ae=y.createSparseMatrix({values:X,index:q,ptr:J,size:[P,M],datatype:T}),re=0;re<M;re++){J[re]=q.length;var fe=I[re],he=I[re+1];if(he>fe)for(var me=0,ie=0;ie<P;ie++){for(var xe=ie+1,Me=void 0,be=fe;be<he;be++){var Ce=B[be];me!==xe?(Me=_(E[ie][Ce],C[be]),me=xe):Me=H(Me,_(E[ie][Ce],C[be]))}me===xe&&!z(Me,Y)&&(q.push(ie),X.push(Me))}}return J[M]=q.length,ae}function N(b,y){var E=b._values,F=b._index,S=b._ptr,C=b._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var B=y._data,I=y._datatype,L=b._size[0],k=y._size[0],P=[],M=[],T=[],H,_=n,z=i,Y=a,X=0;C&&I&&C===I&&typeof C=="string"&&(H=C,_=e.find(n,[H,H]),z=e.find(i,[H,H]),Y=e.find(a,[H,H]),X=e.convert(0,H));var q=[],J=[];T[0]=0;for(var ae=0;ae<k;ae++){var re=B[ae];if(!Y(re,X))for(var fe=S[ae],he=S[ae+1],me=fe;me<he;me++){var ie=F[me];J[ie]?q[ie]=_(q[ie],z(re,E[me])):(J[ie]=!0,M.push(ie),q[ie]=z(re,E[me]))}}for(var xe=M.length,Me=0;Me<xe;Me++){var be=M[Me];P[Me]=q[be]}return T[1]=M.length,b.createSparseMatrix({values:P,index:M,ptr:T,size:[L,1],datatype:H})}function v(b,y){var E=b._values,F=b._index,S=b._ptr,C=b._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var B=y._data,I=y._datatype,L=b._size[0],k=y._size[0],P=y._size[1],M,T=n,H=i,_=a,z=0;C&&I&&C===I&&typeof C=="string"&&(M=C,T=e.find(n,[M,M]),H=e.find(i,[M,M]),_=e.find(a,[M,M]),z=e.convert(0,M));for(var Y=[],X=[],q=[],J=b.createSparseMatrix({values:Y,index:X,ptr:q,size:[L,P],datatype:M}),ae=[],re=[],fe=0;fe<P;fe++){q[fe]=X.length;for(var he=fe+1,me=0;me<k;me++){var ie=B[me][fe];if(!_(ie,z))for(var xe=S[me],Me=S[me+1],be=xe;be<Me;be++){var Ce=F[be];re[Ce]!==he?(re[Ce]=he,X.push(Ce),ae[Ce]=H(ie,E[be])):ae[Ce]=T(ae[Ce],H(ie,E[be]))}}for(var U=q[fe],G=X.length,oe=U;oe<G;oe++){var $=X[oe];Y[oe]=ae[$]}}return q[P]=X.length,J}function w(b,y){var E=b._values,F=b._index,S=b._ptr,C=b._datatype,B=y._values,I=y._index,L=y._ptr,k=y._datatype,P=b._size[0],M=y._size[1],T=E&&B,H,_=n,z=i;C&&k&&C===k&&typeof C=="string"&&(H=C,_=e.find(n,[H,H]),z=e.find(i,[H,H]));for(var Y=T?[]:void 0,X=[],q=[],J=b.createSparseMatrix({values:Y,index:X,ptr:q,size:[P,M],datatype:H}),ae=T?[]:void 0,re=[],fe,he,me,ie,xe,Me,be,Ce,U=0;U<M;U++){q[U]=X.length;var G=U+1;for(xe=L[U],Me=L[U+1],ie=xe;ie<Me;ie++)if(Ce=I[ie],T)for(he=S[Ce],me=S[Ce+1],fe=he;fe<me;fe++)be=F[fe],re[be]!==G?(re[be]=G,X.push(be),ae[be]=z(B[ie],E[fe])):ae[be]=_(ae[be],z(B[ie],E[fe]));else for(he=S[Ce],me=S[Ce+1],fe=he;fe<me;fe++)be=F[fe],re[be]!==G&&(re[be]=G,X.push(be));if(T)for(var oe=q[U],$=X.length,j=oe;j<$;j++){var te=X[j];Y[j]=ae[te]}}return q[M]=X.length,J}return e(tC,i,{"Array, Array":e.referTo("Matrix, Matrix",b=>(y,E)=>{s(ze(y),ze(E));var F=b(r(y),r(E));return Fe(F)?F.valueOf():F}),"Matrix, Matrix":function(y,E){var F=y.size(),S=E.size();return s(F,S),F.length===1?S.length===1?l(y,E,F[0]):f(y,E):S.length===1?p(y,E):h(y,E)},"Matrix, Array":e.referTo("Matrix,Matrix",b=>(y,E)=>b(y,r(E))),"Array, Matrix":e.referToSelf(b=>(y,E)=>b(r(y,E.storage()),E)),"SparseMatrix, any":function(y,E){return c(y,E,i,!1)},"DenseMatrix, any":function(y,E){return u(y,E,i,!1)},"any, SparseMatrix":function(y,E){return c(E,y,i,!0)},"any, DenseMatrix":function(y,E){return u(E,y,i,!0)},"Array, any":function(y,E){return u(r(y),E,i,!1).valueOf()},"any, Array":function(y,E){return u(r(E),y,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(b=>(y,E,F)=>{for(var S=b(y,E),C=0;C<F.length;C++)S=b(S,F[C]);return S})})});var nC="nthRoot",P9=["typed","matrix","equalScalar","BigNumber","concat"],qd=A(nC,P9,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,concat:a}=t,o=$t({typed:e}),c=mt({typed:e,equalScalar:n}),u=ra({typed:e,equalScalar:n}),s=Dr({typed:e,equalScalar:n}),l=$e({typed:e,matrix:r,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(nC,{number:fp,"number, number":fp,BigNumber:p=>m(p,new i(2)),"BigNumber, BigNumber":m,Complex:f,"Complex, number":f,Array:e.referTo("DenseMatrix,number",p=>h=>p(r(h),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",p=>h=>p(h,2)),SparseMatrix:e.referTo("SparseMatrix,number",p=>h=>p(h,2)),"SparseMatrix, SparseMatrix":e.referToSelf(p=>(h,d)=>{if(d.density()===1)return u(h,d,p);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(p=>(h,d)=>{if(d.density()===1)return o(h,d,p,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",p=>(h,d)=>p(r(h),d)),"number | BigNumber, SparseMatrix":e.referToSelf(p=>(h,d)=>{if(d.density()===1)return s(d,h,p,!0);throw new Error("Root must be non-zero")})},l({scalar:"number | BigNumber",SD:c,Ss:s,sS:!1}));function m(p,h){var d=i.precision,g=i.clone({precision:d+2}),D=new i(0),N=new g(1),v=h.isNegative();if(v&&(h=h.neg()),h.isZero())throw new Error("Root must be non-zero");if(p.isNegative()&&!h.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(p.isZero())return v?new g(1/0):0;if(!p.isFinite())return v?D:p;var w=p.abs().pow(N.div(h));return w=p.isNeg()?w.neg():w,new i((v?N.div(w):w).toPrecision(d))}});var iC="sign",L9=["typed","BigNumber","Fraction","complex"],zd=A(iC,L9,t=>{var{typed:e,BigNumber:r,complex:n,Fraction:i}=t;return e(iC,{number:zl,Complex:function(o){return o.im===0?n(zl(o.re)):o.sign()},BigNumber:function(o){return new r(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":e.referToSelf(a=>o=>Oe(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 k9="sqrt",q9=["config","typed","Complex"],Ud=A(k9,q9,t=>{var{config:e,typed:r,Complex:n}=t;return r("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||e.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||e.predictable?Math.sqrt(a):new n(a,0).sqrt()}});var aC="square",z9=["typed"],Vd=A(aC,z9,t=>{var{typed:e}=t;return e(aC,{number:mp,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var oC="subtract",U9=["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix","concat"],$d=A(oC,U9,t=>{var{typed:e,matrix:r,equalScalar:n,addScalar:i,unaryMinus:a,DenseMatrix:o,concat:c}=t,u=$t({typed:e}),s=Tr({typed:e}),l=ta({typed:e,equalScalar:n}),f=en({typed:e,DenseMatrix:o}),m=cr({typed:e,DenseMatrix:o}),p=$e({typed:e,matrix:r,concat:c});return e(oC,{"number, number":(h,d)=>h-d,"Complex, Complex":(h,d)=>h.sub(d),"BigNumber, BigNumber":(h,d)=>h.minus(d),"Fraction, Fraction":(h,d)=>h.sub(d),"Unit, Unit":e.referToSelf(h=>(d,g)=>{if(d.value===null)throw new Error("Parameter x contains a unit with undefined value");if(g.value===null)throw new Error("Parameter y contains a unit with undefined value");if(!d.equalBase(g))throw new Error("Units do not match");var D=d.clone();return D.value=e.find(h,[D.valueType(),g.valueType()])(D.value,g.value),D.fixPrefix=!1,D})},p({SS:l,DS:u,SD:s,Ss:m,sS:f}))});var sC="xgcd",V9=["typed","config","matrix","BigNumber"],Hd=A(sC,V9,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(sC,{"number, number":function(c,u){var s=pp(c,u);return r.matrix==="Array"?s:n(s)},"BigNumber, BigNumber":a});function a(o,c){var u,s,l,f=new i(0),m=new i(1),p=f,h=m,d=m,g=f;if(!o.isInt()||!c.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!c.isZero();)s=o.div(c).floor(),l=o.mod(c),u=p,p=h.minus(s.times(p)),h=u,u=d,d=g.minus(s.times(d)),g=u,o=c,c=l;var D;return o.lt(f)?D=[o.neg(),h.neg(),g.neg()]:D=[o,o.isZero()?0:h,g],r.matrix==="Array"?D:n(D)}});var uC="invmod",$9=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Wd=A(uC,$9,t=>{var{typed:e,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:c,add:u,isInteger:s}=t;return e(uC,{"number, number":l,"BigNumber, BigNumber":l});function l(f,m){if(!s(f)||!s(m))throw new Error("Parameters in function invmod must be integer numbers");if(f=c(f,m),a(m,0))throw new Error("Divisor must be non zero");var p=i(f,m);p=p.valueOf();var[h,d]=p;return a(h,n(1))?(d=c(d,m),o(d,n(0))&&(d=u(d,m)),d):NaN}});var H9="matAlgo09xS0Sf",W9=["typed","equalScalar"],$l=A(H9,W9,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var c=i._values,u=i._index,s=i._ptr,l=i._size,f=i._datatype,m=a._values,p=a._index,h=a._ptr,d=a._size,g=a._datatype;if(l.length!==d.length)throw new Ue(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");var D=l[0],N=l[1],v,w=r,b=0,y=o;typeof f=="string"&&f===g&&(v=f,w=e.find(r,[v,v]),b=e.convert(0,v),y=e.find(o,[v,v]));var E=c&&m?[]:void 0,F=[],S=[],C=E?[]:void 0,B=[],I,L,k,P,M;for(L=0;L<N;L++){S[L]=F.length;var T=L+1;if(C)for(P=h[L],M=h[L+1],k=P;k<M;k++)I=p[k],B[I]=T,C[I]=m[k];for(P=s[L],M=s[L+1],k=P;k<M;k++)if(I=u[k],C){var H=B[I]===T?C[I]:b,_=y(c[k],H);w(_,b)||(F.push(I),E.push(_))}else F.push(I)}return S[N]=F.length,i.createSparseMatrix({values:E,index:F,ptr:S,size:[D,N],datatype:v})}});var lC="dotMultiply",G9=["typed","matrix","equalScalar","multiplyScalar","concat"],Gd=A(lC,G9,t=>{var{typed:e,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=t,o=mt({typed:e,equalScalar:n}),c=$l({typed:e,equalScalar:n}),u=Dr({typed:e,equalScalar:n}),s=$e({typed:e,matrix:r,concat:a});return e(lC,s({elop:i,SS:c,DS:o,Ss:u}))});function cC(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);if(t.isZero()||e.eq(-1)||t.eq(e))return t;if(e.isZero()||t.eq(-1))return e;if(!t.isFinite()||!e.isFinite()){if(!t.isFinite()&&!e.isFinite())return t.isNegative()===e.isNegative()?t:new r(0);if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e;if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t}return Zd(t,e,function(n,i){return n&i})}function Ro(t){if(t.isFinite()&&!t.isInteger())throw new Error("Integer expected in function bitNot");var e=t.constructor,r=e.precision;e.config({precision:1e9});var n=t.plus(new e(1));return n.s=-n.s||null,e.config({precision:r}),n}function fC(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);var n=new r(-1);return t.isZero()||e.eq(n)||t.eq(e)?e:e.isZero()||t.eq(n)?t:!t.isFinite()||!e.isFinite()?!t.isFinite()&&!t.isNegative()&&e.isNegative()||t.isNegative()&&!e.isNegative()&&!e.isFinite()?n:t.isNegative()&&e.isNegative()?t.isFinite()?t:e:t.isFinite()?e:t:Zd(t,e,function(i,a){return i|a})}function Zd(t,e,r){var n=t.constructor,i,a,o=+(t.s<0),c=+(e.s<0);if(o){i=Hl(Ro(t));for(var u=0;u<i.length;++u)i[u]^=1}else i=Hl(t);if(c){a=Hl(Ro(e));for(var s=0;s<a.length;++s)a[s]^=1}else a=Hl(e);var l,f,m;i.length<=a.length?(l=i,f=a,m=o):(l=a,f=i,m=c);var p=l.length,h=f.length,d=r(o,c)^1,g=new n(d^1),D=new n(1),N=new n(2),v=n.precision;for(n.config({precision:1e9});p>0;)r(l[--p],f[--h])===d&&(g=g.plus(D)),D=D.times(N);for(;h>0;)r(m,f[--h])===d&&(g=g.plus(D)),D=D.times(N);return n.config({precision:v}),d===0&&(g.s=-g.s),g}function Hl(t){for(var e=t.d,r=e[0]+"",n=1;n<e.length;++n){for(var i=e[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;r.charAt(o)==="0";)o--;var c=t.e,u=r.slice(0,o+1||1),s=u.length;if(c>0)if(++c>s)for(c-=s;c--;)u+="0";else c<s&&(u=u.slice(0,c)+"."+u.slice(c));for(var l=[0],f=0;f<u.length;){for(var m=l.length;m--;)l[m]*=10;l[0]+=parseInt(u.charAt(f++));for(var p=0;p<l.length;++p)l[p]>1&&((l[p+1]===null||l[p+1]===void 0)&&(l[p+1]=0),l[p+1]+=l[p]>>1,l[p]&=1)}return l.reverse()}function mC(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);if(t.isZero())return e;if(e.isZero())return t;if(t.eq(e))return new r(0);var n=new r(-1);return t.eq(n)?Ro(e):e.eq(n)?Ro(t):!t.isFinite()||!e.isFinite()?!t.isFinite()&&!e.isFinite()?n:new r(t.isNegative()===e.isNegative()?1/0:-1/0):Zd(t,e,function(i,a){return i^a})}function pC(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var r=t.constructor;return t.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new r(NaN):t.isZero()||e.isZero()?t:!t.isFinite()&&!e.isFinite()?new r(NaN):e.lt(55)?t.times(Math.pow(2,e.toNumber())+""):t.times(new r(2).pow(e))}function dC(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var r=t.constructor;return t.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new r(NaN):t.isZero()||e.isZero()?t:e.isFinite()?e.lt(55)?t.div(Math.pow(2,e.toNumber())+"").floor():t.div(new r(2).pow(e)).floor():t.isNegative()?new r(-1):t.isFinite()?new r(0):new r(NaN)}var hC="bitAnd",Z9=["typed","matrix","equalScalar","concat"],jd=A(hC,Z9,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=mt({typed:e,equalScalar:n}),o=ra({typed:e,equalScalar:n}),c=Dr({typed:e,equalScalar:n}),u=$e({typed:e,matrix:r,concat:i});return e(hC,{"number, number":vp,"BigNumber, BigNumber":cC},u({SS:o,DS:a,Ss:c}))});var vC="bitNot",j9=["typed"],Yd=A(vC,j9,t=>{var{typed:e}=t;return e(vC,{number:gp,BigNumber:Ro,"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var gC="bitOr",Y9=["typed","matrix","equalScalar","DenseMatrix","concat"],Jd=A(gC,Y9,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=$t({typed:e}),c=_o({typed:e,equalScalar:n}),u=en({typed:e,DenseMatrix:i}),s=$e({typed:e,matrix:r,concat:a});return e(gC,{"number, number":yp,"BigNumber, BigNumber":fC},s({SS:c,DS:o,Ss:u}))});var J9="matAlgo07xSSf",X9=["typed","DenseMatrix"],wt=A(J9,X9,t=>{var{typed:e,DenseMatrix:r}=t;return function(a,o,c){var u=a._size,s=a._datatype,l=o._size,f=o._datatype;if(u.length!==l.length)throw new Ue(u.length,l.length);if(u[0]!==l[0]||u[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+l+")");var m=u[0],p=u[1],h,d=0,g=c;typeof s=="string"&&s===f&&(h=s,d=e.convert(0,h),g=e.find(c,[h,h]));var D,N,v=[];for(D=0;D<m;D++)v[D]=[];var w=[],b=[],y=[],E=[];for(N=0;N<p;N++){var F=N+1;for(n(a,N,y,w,F),n(o,N,E,b,F),D=0;D<m;D++){var S=y[D]===F?w[D]:d,C=E[D]===F?b[D]:d;v[D][N]=g(S,C)}}return new r({data:v,size:[m,p],datatype:h})};function n(i,a,o,c,u){for(var s=i._values,l=i._index,f=i._ptr,m=f[a],p=f[a+1];m<p;m++){var h=l[m];o[h]=u,c[h]=s[m]}}});var yC="bitXor",Q9=["typed","matrix","DenseMatrix","concat"],Xd=A(yC,Q9,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i}=t,a=Tr({typed:e}),o=wt({typed:e,DenseMatrix:n}),c=cr({typed:e,DenseMatrix:n}),u=$e({typed:e,matrix:r,concat:i});return e(yC,{"number, number":xp,"BigNumber, BigNumber":mC},u({SS:o,DS:a,Ss:c}))});var xC="arg",K9=["typed"],Qd=A(xC,K9,t=>{var{typed:e}=t;return e(xC,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var DC="conj",eP=["typed"],Kd=A(DC,eP,t=>{var{typed:e}=t;return e(DC,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var bC="im",rP=["typed"],eh=A(bC,rP,t=>{var{typed:e}=t;return e(bC,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var wC="re",tP=["typed"],rh=A(wC,tP,t=>{var{typed:e}=t;return e(wC,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var EC="not",nP=["typed"],th=A(EC,nP,t=>{var{typed:e}=t;return e(EC,{"null | undefined":()=>!0,number:Np,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:e.referToSelf(r=>n=>e.find(r,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var CC="or",iP=["typed","matrix","equalScalar","DenseMatrix","concat"],nh=A(CC,iP,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=Tr({typed:e}),c=ta({typed:e,equalScalar:n}),u=cr({typed:e,DenseMatrix:i}),s=$e({typed:e,matrix:r,concat:a});return e(CC,{"number, number":Ap,"Complex, Complex":function(f,m){return f.re!==0||f.im!==0||m.re!==0||m.im!==0},"BigNumber, BigNumber":function(f,m){return!f.isZero()&&!f.isNaN()||!m.isZero()&&!m.isNaN()},"Unit, Unit":e.referToSelf(l=>(f,m)=>l(f.value||0,m.value||0))},s({SS:c,DS:o,Ss:u}))});var NC="xor",aP=["typed","matrix","DenseMatrix","concat"],ih=A(NC,aP,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i}=t,a=Tr({typed:e}),o=wt({typed:e,DenseMatrix:n}),c=cr({typed:e,DenseMatrix:n}),u=$e({typed:e,matrix:r,concat:i});return e(NC,{"number, number":Fp,"Complex, Complex":function(l,f){return(l.re!==0||l.im!==0)!=(f.re!==0||f.im!==0)},"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))},u({SS:o,DS:a,Ss:c}))});var AC="concat",oP=["typed","matrix","isInteger"],Vs=A(AC,oP,t=>{var{typed:e,matrix:r,isInteger:n}=t;return e(AC,{"...Array | Matrix | number | BigNumber":function(a){var o,c=a.length,u=-1,s,l=!1,f=[];for(o=0;o<c;o++){var m=a[o];if(Fe(m)&&(l=!0),He(m)||Le(m)){if(o!==c-1)throw new Error("Dimension must be specified as last argument");if(s=u,u=m.valueOf(),!n(u))throw new TypeError("Integer number expected for dimension");if(u<0||o>0&&u>s)throw new Pt(u,s+1)}else{var p=Ie(m).valueOf(),h=ze(p);if(f[o]=p,s=u,u=h.length-1,o>0&&u!==s)throw new Ue(s+1,u+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=FC(d,f.shift(),u,0);return l?r(d):d},"...string":function(a){return a.join("")}})});function FC(t,e,r,n){if(n<r){if(t.length!==e.length)throw new Ue(t.length,e.length);for(var i=[],a=0;a<t.length;a++)i[a]=FC(t[a],e[a],r,n+1);return i}else return t.concat(e)}var SC="column",sP=["typed","Index","matrix","range"],$s=A(SC,sP,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(SC,{"Matrix, number":a,"Array, number":function(c,u){return a(n(Ie(c)),u).valueOf()}});function a(o,c){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");xr(c,o.size()[1]);var u=i(0,o.size()[0]),s=new r(u,c),l=o.subset(s);return Fe(l)?l:n([[l]])}});var MC="count",uP=["typed","size","prod"],ah=A(MC,uP,t=>{var{typed:e,size:r,prod:n}=t;return e(MC,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var TC="cross",lP=["typed","matrix","subtract","multiply"],oh=A(TC,lP,t=>{var{typed:e,matrix:r,subtract:n,multiply:i}=t;return e(TC,{"Matrix, Matrix":function(c,u){return r(a(c.toArray(),u.toArray()))},"Matrix, Array":function(c,u){return r(a(c.toArray(),u))},"Array, Matrix":function(c,u){return r(a(c,u.toArray()))},"Array, Array":a});function a(o,c){var u=Math.max(ze(o).length,ze(c).length);o=Fo(o),c=Fo(c);var s=ze(o),l=ze(c);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],c[2]),i(o[2],c[1])),n(i(o[2],c[0]),i(o[0],c[2])),n(i(o[0],c[1]),i(o[1],c[0]))];return u>1?[f]:f}});var OC="diag",cP=["typed","matrix","DenseMatrix","SparseMatrix"],sh=A(OC,cP,t=>{var{typed:e,matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(OC,{Array:function(s){return a(s,0,ze(s),null)},"Array, number":function(s,l){return a(s,l,ze(s),null)},"Array, BigNumber":function(s,l){return a(s,l.toNumber(),ze(s),null)},"Array, string":function(s,l){return a(s,0,ze(s),l)},"Array, number, string":function(s,l,f){return a(s,l,ze(s),f)},"Array, BigNumber, string":function(s,l,f){return a(s,l.toNumber(),ze(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(u,s,l,f){if(!Ae(s))throw new TypeError("Second parameter in function diag must be an integer");var m=s>0?s:0,p=s<0?-s:0;switch(l.length){case 1:return o(u,s,f,l[0],p,m);case 2:return c(u,s,f,l,p,m)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(u,s,l,f,m,p){var h=[f+m,f+p];if(l&&l!=="sparse"&&l!=="dense")throw new TypeError("Unknown matrix type ".concat(l,'"'));var d=l==="sparse"?i.diagonal(h,u,s):n.diagonal(h,u,s);return l!==null?d:d.valueOf()}function c(u,s,l,f,m,p){if(Fe(u)){var h=u.diagonal(s);return l!==null?l!==h.storage()?r(h,l):h:h.valueOf()}for(var d=Math.min(f[0]-m,f[1]-p),g=[],D=0;D<d;D++)g[D]=u[D+m][D+p];return l!==null?r(g):g}});var Hs=Yt(wm(),1);function In(t,e,r,n,i){if(Hs.default.isTypedFunction(t)){var a=[e,r,n],o=Hs.default.resolve(t,a);if(o)return f(o.implementation,a);var c=[e,r],u=Hs.default.resolve(t,c);if(u)return f(u.implementation,c);var s=[e],l=Hs.default.resolve(t,s);return l?f(l.implementation,s):f(t,a)}else return t(e,r,n);function f(m,p){try{return m.apply(m,p)}catch(g){var h;if(g instanceof TypeError&&((h=g.data)===null||h===void 0?void 0:h.category)==="wrongType"){var d=[];throw d.push("value: ".concat(nr(e))),p.length>=2&&d.push("index: ".concat(nr(r))),p.length>=3&&d.push("array: ".concat(nr(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(t.name,"(").concat(d.join(", "),") at index ").concat(JSON.stringify(r)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(t.name,": ").concat(g.message))}}}var fP="filter",mP=["typed"],uh=A(fP,mP,t=>{var{typed:e}=t;return e("filter",{"Array, function":BC,"Matrix, function":function(n,i){return n.create(BC(n.toArray(),i))},"Array, RegExp":So,"Matrix, RegExp":function(n,i){return n.create(So(n.toArray(),i))}})});function BC(t,e){return Nl(t,function(r,n,i){return In(e,r,[n],i,"filter")})}var IC="flatten",pP=["typed","matrix"],lh=A(IC,pP,t=>{var{typed:e,matrix:r}=t;return e(IC,{Array:function(i){return Ge(i)},Matrix:function(i){var a=Ge(i.toArray());return r(a)}})});var _C="forEach",dP=["typed"],ch=A(_C,dP,t=>{var{typed:e}=t;return e(_C,{"Array, function":hP,"Matrix, function":function(n,i){n.forEach(i)}})});function hP(t,e){var r=function n(i,a){if(Array.isArray(i))ji(i,function(o,c){n(o,a.concat(c))});else return In(e,i,a,t,"forEach")};r(t,[])}var RC="getMatrixDataType",vP=["typed"],fh=A(RC,vP,t=>{var{typed:e}=t;return e(RC,{Array:function(n){return Yi(n,nr)},Matrix:function(n){return n.getDataType()}})});var PC="identity",gP=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],mh=A(PC,gP,t=>{var{typed:e,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=t;return e(PC,{"":function(){return r.matrix==="Matrix"?n([]):[]},string:function(l){return n(l)},"number | BigNumber":function(l){return u(l,l,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(l,f){return u(l,l,f)},"number | BigNumber, number | BigNumber":function(l,f){return u(l,f,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(l,f,m){return u(l,f,m)},Array:function(l){return c(l)},"Array, string":function(l,f){return c(l,f)},Matrix:function(l){return c(l.valueOf(),l.storage())},"Matrix, string":function(l,f){return c(l.valueOf(),f)}});function c(s,l){switch(s.length){case 0:return l?n(l):[];case 1:return u(s[0],s[0],l);case 2:return u(s[0],s[1],l);default:throw new Error("Vector containing two values expected")}}function u(s,l,f){var m=Le(s)||Le(l)?i:null;if(Le(s)&&(s=s.toNumber()),Le(l)&&(l=l.toNumber()),!Ae(s)||s<1)throw new Error("Parameters in function identity must be positive integers");if(!Ae(l)||l<1)throw new Error("Parameters in function identity must be positive integers");var p=m?new i(1):1,h=m?new m(0):0,d=[s,l];if(f){if(f==="sparse")return o.diagonal(d,p,0,h);if(f==="dense")return a.diagonal(d,p,0,h);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var g=Qn([],d,h),D=s<l?s:l,N=0;N<D;N++)g[N][N]=p;return g}});var LC="kron",yP=["typed","matrix","multiplyScalar"],ph=A(LC,yP,t=>{var{typed:e,matrix:r,multiplyScalar:n}=t;return e(LC,{"Matrix, Matrix":function(o,c){return r(i(o.toArray(),c.toArray()))},"Matrix, Array":function(o,c){return r(i(o.toArray(),c))},"Array, Matrix":function(o,c){return r(i(o,c.toArray()))},"Array, Array":i});function i(a,o){if(ze(a).length===1&&(a=[a]),ze(o).length===1&&(o=[o]),ze(a).length>2||ze(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 c=[],u=[];return a.map(function(s){return o.map(function(l){return u=[],c.push(u),s.map(function(f){return l.map(function(m){return u.push(n(f,m))})})})})&&c}});var kC="map",xP=["typed"],dh=A(kC,xP,t=>{var{typed:e}=t;return e(kC,{"Array, function":DP,"Matrix, function":function(n,i){return n.map(i)}})});function DP(t,e){var r=function n(i,a){return Array.isArray(i)?i.map(function(o,c){return n(o,a.concat(c))}):In(e,i,a,t,"map")};return r(t,[])}var qC="diff",bP=["typed","matrix","subtract","number"],Ws=A(qC,bP,t=>{var{typed:e,matrix:r,subtract:n,number:i}=t;return e(qC,{"Array | Matrix":function(l){return Fe(l)?r(o(l.toArray())):o(l)},"Array | Matrix, number":function(l,f){if(!Ae(f))throw new RangeError("Dimension must be a whole number");return Fe(l)?r(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(Fe(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(m=>{f.push(a(m,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,m=1;m<f;m++)l.push(c(s[m-1],s[m]));return l}function c(s,l){Fe(s)&&(s=s.toArray()),Fe(l)&&(l=l.toArray());var f=Array.isArray(s),m=Array.isArray(l);if(f&&m)return u(s,l);if(!f&&!m)return n(l,s);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function u(s,l){if(s.length!==l.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],m=s.length,p=0;p<m;p++)f.push(c(s[p],l[p]));return f}});var wP="ones",EP=["typed","config","matrix","BigNumber"],hh=A(wP,EP,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e("ones",{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(s){var l=s[s.length-1];if(typeof l=="string"){var f=s.pop();return a(s,f)}else return r.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(u,s){var l=o(u),f=l?new i(1):1;if(c(u),s){var m=n(s);return u.length>0?m.resize(u,f):m}else{var p=[];return u.length>0?Qn(p,u,f):p}}function o(u){var s=!1;return u.forEach(function(l,f,m){Le(l)&&(s=!0,m[f]=l.toNumber())}),s}function c(u){u.forEach(function(s){if(typeof s!="number"||!Ae(s)||s<0)throw new Error("Parameters in function ones must be positive integers")})}});function Po(){throw new Error('No "bignumber" implementation available')}function Wl(){throw new Error('No "fraction" implementation available')}function Gl(){throw new Error('No "matrix" implementation available')}var zC="range",CP=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],Gs=A(zC,CP,t=>{var{typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:c,largerEq:u}=t;return e(zC,{string:l,"string, boolean":l,"number, number":function(D,N){return s(f(D,N,1))},"number, number, number":function(D,N,v){return s(f(D,N,v))},"number, number, boolean":function(D,N,v){return s(v?m(D,N,1):f(D,N,1))},"number, number, number, boolean":function(D,N,v,w){return s(w?m(D,N,v):f(D,N,v))},"BigNumber, BigNumber":function(D,N){var v=D.constructor;return s(p(D,N,new v(1)))},"BigNumber, BigNumber, BigNumber":function(D,N,v){return s(p(D,N,v))},"BigNumber, BigNumber, boolean":function(D,N,v){var w=D.constructor;return s(v?h(D,N,new w(1)):p(D,N,new w(1)))},"BigNumber, BigNumber, BigNumber, boolean":function(D,N,v,w){return s(w?h(D,N,v):p(D,N,v))}});function s(g){return r.matrix==="Matrix"?n?n(g):Gl():g}function l(g,D){var N=d(g);if(!N)throw new SyntaxError('String "'+g+'" is no valid range');var v;return r.number==="BigNumber"?(i===void 0&&Po(),v=D?h:p,s(v(i(N.start),i(N.end),i(N.step)))):(v=D?m:f,s(v(N.start,N.end,N.step)))}function f(g,D,N){var v=[],w=g;if(N>0)for(;a(w,D);)v.push(w),w+=N;else if(N<0)for(;c(w,D);)v.push(w),w+=N;return v}function m(g,D,N){var v=[],w=g;if(N>0)for(;o(w,D);)v.push(w),w+=N;else if(N<0)for(;u(w,D);)v.push(w),w+=N;return v}function p(g,D,N){var v=i(0),w=[],b=g;if(N.gt(v))for(;a(b,D);)w.push(b),b=b.plus(N);else if(N.lt(v))for(;c(b,D);)w.push(b),b=b.plus(N);return w}function h(g,D,N){var v=i(0),w=[],b=g;if(N.gt(v))for(;o(b,D);)w.push(b),b=b.plus(N);else if(N.lt(v))for(;u(b,D);)w.push(b),b=b.plus(N);return w}function d(g){var D=g.split(":"),N=D.map(function(w){return Number(w)}),v=N.some(function(w){return isNaN(w)});if(v)return null;switch(N.length){case 2:return{start:N[0],end:N[1],step:1};case 3:return{start:N[0],end:N[2],step:N[1]};default:return null}}});var UC="reshape",NP=["typed","isInteger","matrix"],vh=A(UC,NP,t=>{var{typed:e,isInteger:r}=t;return e(UC,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!r(o))throw new TypeError("Invalid size for dimension: "+o)}),El(i,a)}})});var AP="resize",FP=["config","matrix"],gh=A(AP,FP,t=>{var{config:e,matrix:r}=t;return function(a,o,c){if(arguments.length!==2&&arguments.length!==3)throw new Ri("resize",arguments.length,2,3);if(Fe(o)&&(o=o.valueOf()),Le(o[0])&&(o=o.map(function(l){return Le(l)?l.toNumber():l})),Fe(a))return a.resize(o,c,!0);if(typeof a=="string")return n(a,o,c);var u=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return Ie(a)}else{Array.isArray(a)||(a=[a]),a=Ie(a);var s=Qn(a,o,c);return u?r(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 Ue(a.length,1);var c=a[0];if(typeof c!="number"||!Ae(c))throw new TypeError("Invalid size, must contain positive integers (size: "+qe(a)+")");if(i.length>c)return i.substring(0,c);if(i.length<c){for(var u=i,s=0,l=c-i.length;s<l;s++)u+=o;return u}else return i}});var VC="rotate",SP=["typed","multiply","rotationMatrix"],yh=A(VC,SP,t=>{var{typed:e,multiply:r,rotationMatrix:n}=t;return e(VC,{"Array , number | BigNumber | Complex | Unit":function(o,c){i(o,2);var u=r(n(c),o);return u.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,c){return i(o,2),r(n(c),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,c,u){i(o,3);var s=r(n(c,u),o);return s},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,c,u){return i(o,3),r(n(c,u),o)}});function i(a,o){var c=Array.isArray(a)?ze(a):a.size();if(c.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(c.length===2&&c[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(c[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var $C="rotationMatrix",MP=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],xh=A($C,MP,t=>{var{typed:e,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:c,matrix:u,DenseMatrix:s,SparseMatrix:l,cos:f,sin:m}=t;return e($C,{"":function(){return r.matrix==="Matrix"?u([]):[]},string:function(v){return u(v)},"number | BigNumber | Complex | Unit":function(v){return p(v,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(v,w){return p(v,w)},"number | BigNumber | Complex | Unit, Array":function(v,w){var b=u(w);return h(b),D(v,b,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(v,w){h(w);var b=w.storage()||(r.matrix==="Matrix"?"dense":void 0);return D(v,w,b)},"number | BigNumber | Complex | Unit, Array, string":function(v,w,b){var y=u(w);return h(y),D(v,y,b)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,w,b){return h(w),D(v,w,b)}});function p(N,v){var w=Le(N),b=w?new c(-1):-1,y=f(N),E=m(N),F=[[y,n(b,E)],[E,y]];return g(F,v)}function h(N){var v=N.size();if(v.length<1||v[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function d(N){return N.reduce((v,w)=>n(v,w))}function g(N,v){if(v){if(v==="sparse")return new l(N);if(v==="dense")return new s(N);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return N}function D(N,v,w){var b=o(v);if(b===0)throw new RangeError("Rotation around zero vector");var y=Le(N)?c:null,E=y?new y(1):1,F=y?new y(-1):-1,S=y?new y(v.get([0])/b):v.get([0])/b,C=y?new y(v.get([1])/b):v.get([1])/b,B=y?new y(v.get([2])/b):v.get([2])/b,I=f(N),L=i(E,a(I)),k=m(N),P=i(I,d([S,S,L])),M=i(d([S,C,L]),d([F,B,k])),T=i(d([S,B,L]),d([C,k])),H=i(d([S,C,L]),d([B,k])),_=i(I,d([C,C,L])),z=i(d([C,B,L]),d([F,S,k])),Y=i(d([S,B,L]),d([F,C,k])),X=i(d([C,B,L]),d([S,k])),q=i(I,d([B,B,L])),J=[[P,M,T],[H,_,z],[Y,X,q]];return g(J,w)}});var HC="row",TP=["typed","Index","matrix","range"],Zs=A(HC,TP,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(HC,{"Matrix, number":a,"Array, number":function(c,u){return a(n(Ie(c)),u).valueOf()}});function a(o,c){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");xr(c,o.size()[0]);var u=i(0,o.size()[1]),s=new r(c,u),l=o.subset(s);return Fe(l)?l:n([[l]])}});var WC="size",OP=["typed","config","?matrix"],Dh=A(WC,OP,t=>{var{typed:e,config:r,matrix:n}=t;return e(WC,{Matrix:function(a){return a.create(a.size())},Array:ze,string:function(a){return r.matrix==="Array"?[a.length]:n([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return r.matrix==="Array"?[]:n?n([]):Gl()}})});var GC="squeeze",BP=["typed","matrix"],bh=A(GC,BP,t=>{var{typed:e,matrix:r}=t;return e(GC,{Array:function(i){return Fo(Ie(i))},Matrix:function(i){var a=Fo(i.toArray());return Array.isArray(a)?r(a):a},any:function(i){return Ie(i)}})});var ZC="subset",IP=["typed","matrix"],js=A(ZC,IP,t=>{var{typed:e,matrix:r}=t;return e(ZC,{"Array, Index":function(i,a){var o=r(i),c=o.subset(a);return a.isScalar()?c:c.valueOf()},"Matrix, Index":function(i,a){return i.subset(a)},"Object, Index":RP,"string, Index":_P,"Array, Index, any":function(i,a,o){return r(Ie(i)).subset(a,o,void 0).valueOf()},"Array, Index, any, any":function(i,a,o,c){return r(Ie(i)).subset(a,o,c).valueOf()},"Matrix, Index, any":function(i,a,o){return i.clone().subset(a,o)},"Matrix, Index, any, any":function(i,a,o,c){return i.clone().subset(a,o,c)},"string, Index, string":jC,"string, Index, string, string":jC,"Object, Index, any":PP})});function _P(t,e){if(!Wi(e))throw new TypeError("Index expected");if(e.size().length!==1)throw new Ue(e.size().length,1);var r=t.length;xr(e.min()[0],r),xr(e.max()[0],r);var n=e.dimension(0),i="";return n.forEach(function(a){i+=t.charAt(a)}),i}function jC(t,e,r,n){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(e.size().length!==1)throw new Ue(e.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=e.dimension(0),a=i.size()[0];if(a!==r.length)throw new Ue(i.size()[0],r.length);var o=t.length;xr(e.min()[0]),xr(e.max()[0]);for(var c=[],u=0;u<o;u++)c[u]=t.charAt(u);if(i.forEach(function(f,m){c[f]=r.charAt(m[0])}),c.length>o)for(var s=o-1,l=c.length;s<l;s++)c[s]||(c[s]=n);return c.join("")}function RP(t,e){if(e.size().length!==1)throw new Ue(e.size(),1);var r=e.dimension(0);if(typeof r!="string")throw new TypeError("String expected as index to retrieve an object property");return rt(t,r)}function PP(t,e,r){if(e.size().length!==1)throw new Ue(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=Ie(t);return gi(i,n,r),i}var YC="transpose",LP=["typed","matrix"],wh=A(YC,LP,t=>{var{typed:e,matrix:r}=t;return e(YC,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:Ie});function n(o){var c=o.size(),u;switch(c.length){case 1:u=o.clone();break;case 2:{var s=c[0],l=c[1];if(l===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+qe(c)+")");switch(o.storage()){case"dense":u=i(o,s,l);break;case"sparse":u=a(o,s,l);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+qe(c)+")")}return u}function i(o,c,u){for(var s=o._data,l=[],f,m=0;m<u;m++){f=l[m]=[];for(var p=0;p<c;p++)f[p]=Ie(s[p][m])}return o.createDenseMatrix({data:l,size:[u,c],datatype:o._datatype})}function a(o,c,u){for(var s=o._values,l=o._index,f=o._ptr,m=s?[]:void 0,p=[],h=[],d=[],g=0;g<c;g++)d[g]=0;var D,N,v;for(D=0,N=l.length;D<N;D++)d[l[D]]++;for(var w=0,b=0;b<c;b++)h.push(w),w+=d[b],d[b]=h[b];for(h.push(w),v=0;v<u;v++)for(var y=f[v],E=f[v+1],F=y;F<E;F++){var S=d[l[F]]++;p[S]=v,s&&(m[S]=Ie(s[F]))}return o.createSparseMatrix({values:m,index:p,ptr:h,size:[u,c],datatype:o._datatype})}});var JC="ctranspose",kP=["typed","transpose","conj"],Eh=A(JC,kP,t=>{var{typed:e,transpose:r,conj:n}=t;return e(JC,{any:function(a){return n(r(a))}})});var XC="zeros",qP=["typed","config","matrix","BigNumber"],Ch=A(XC,qP,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(XC,{"":function(){return r.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 r.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(u,s){var l=o(u),f=l?new i(0):0;if(c(u),s){var m=n(s);return u.length>0?m.resize(u,f):m}else{var p=[];return u.length>0?Qn(p,u,f):p}}function o(u){var s=!1;return u.forEach(function(l,f,m){Le(l)&&(s=!0,m[f]=l.toNumber())}),s}function c(u){u.forEach(function(s){if(typeof s!="number"||!Ae(s)||s<0)throw new Error("Parameters in function zeros must be positive integers")})}});var QC="fft",zP=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],Nh=A(QC,zP,t=>{var{typed:e,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:c,i:u,dotDivide:s,conj:l,pow:f,ceil:m,log2:p}=t;return e(QC,{Array:h,Matrix:function(v){return v.create(h(v.toArray()))}});function h(N){var v=ze(N);return v.length===1?D(N,v[0]):d(N.map(w=>h(w,v.slice(1))),0)}function d(N,v){var w=ze(N);if(v!==0)return new Array(w[0]).fill(0).map((y,E)=>d(N[E],v-1));if(w.length===1)return D(N);function b(y){var E=ze(y);return new Array(E[1]).fill(0).map((F,S)=>new Array(E[0]).fill(0).map((C,B)=>y[B][S]))}return b(d(b(N),1))}function g(N){for(var v=N.length,w=o(a(i(-1,i(u,c)),v)),b=[],y=1-v;y<v;y++)b.push(f(w,a(f(y,2),2)));for(var E=f(2,m(p(v+v-1))),F=[...new Array(v).fill(0).map((M,T)=>i(N[T],b[v-1+T])),...new Array(E-v).fill(0)],S=[...new Array(v+v-1).fill(0).map((M,T)=>a(1,b[T])),...new Array(E-(v+v-1)).fill(0)],C=D(F),B=D(S),I=new Array(E).fill(0).map((M,T)=>i(C[T],B[T])),L=s(l(h(l(I))),E),k=[],P=v-1;P<v+v-1;P++)k.push(i(L[P],b[P]));return k}function D(N){var v=N.length;if(v===1)return[N[0]];if(v%2===0){for(var w=[...D(N.filter((F,S)=>S%2===0),v/2),...D(N.filter((F,S)=>S%2===1),v/2)],b=0;b<v/2;b++){var y=w[b],E=i(w[b+v/2],o(i(i(c,u),a(-b,v))));w[b]=n(y,E),w[b+v/2]=n(y,i(-1,E))}return w}else return g(N)}});var KC="ifft",UP=["typed","fft","dotDivide","conj"],Ah=A(KC,UP,t=>{var{typed:e,fft:r,dotDivide:n,conj:i}=t;return e(KC,{"Array | Matrix":function(o){var c=Fe(o)?o.size():ze(o);return n(i(r(i(o))),c.reduce((u,s)=>u*s,1))}})});var VP="erf",$P=["typed"],Fh=A(VP,$P,t=>{var{typed:e}=t;return e("name",{number:function(o){var c=Math.abs(o);return c>=GP?Tn(o):c<=HP?Tn(o)*r(c):c<=4?Tn(o)*(1-n(c)):Tn(o)*(1-i(c))},"Array | Matrix":e.referToSelf(a=>o=>Oe(o,a))});function r(a){var o=a*a,c=Pi[0][4]*o,u=o,s;for(s=0;s<3;s+=1)c=(c+Pi[0][s])*o,u=(u+Lo[0][s])*o;return a*(c+Pi[0][3])/(u+Lo[0][3])}function n(a){var o=Pi[1][8]*a,c=a,u;for(u=0;u<7;u+=1)o=(o+Pi[1][u])*a,c=(c+Lo[1][u])*a;var s=(o+Pi[1][7])/(c+Lo[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),c=Pi[2][5]*o,u=o,s;for(s=0;s<4;s+=1)c=(c+Pi[2][s])*o,u=(u+Lo[2][s])*o;var l=o*(c+Pi[2][4])/(u+Lo[2][4]);l=(WP-l)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*l}}),HP=.46875,WP=.5641895835477563,Pi=[[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]],Lo=[[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]],GP=Math.pow(2,53);var eN="mode",ZP=["typed","isNaN","isNumeric"],Sh=A(eN,ZP,t=>{var{typed:e,isNaN:r,isNumeric:n}=t;return e(eN,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=Ge(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var c={},u=[],s=0,l=0;l<a.length;l++){var f=a[l];if(n(f)&&r(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in c||(c[f]=0),c[f]++,c[f]===s?u.push(f):c[f]>s&&(s=c[f],u=[f])}return u}});function Qr(t,e,r){var n;return String(t).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+nr(r)+", value: "+JSON.stringify(r)+")":" (type: "+t.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(t).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+nr(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):t}var rN="prod",jP=["typed","config","multiplyScalar","numeric"],Mh=A(rN,jP,t=>{var{typed:e,config:r,multiplyScalar:n,numeric:i}=t;return e(rN,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(c,u){throw new Error("prod(A, dim) is not yet supported")},"...":function(c){return a(c)}});function a(o){var c;if(Vt(o,function(u){try{c=c===void 0?u:n(c,u)}catch(s){throw Qr(s,"prod",u)}}),typeof c=="string"&&(c=i(c,r.number)),c===void 0)throw new Error("Cannot calculate prod of an empty array");return c}});var tN="format",YP=["typed"],Th=A(tN,YP,t=>{var{typed:e}=t;return e(tN,{any:qe,"any, Object | function | number":qe})});var nN="bin",JP=["typed","format"],Oh=A(nN,JP,t=>{var{typed:e,format:r}=t;return e(nN,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var iN="oct",XP=["typed","format"],Bh=A(iN,XP,t=>{var{typed:e,format:r}=t;return e(iN,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var aN="hex",QP=["typed","format"],Ih=A(aN,QP,t=>{var{typed:e,format:r}=t;return e(aN,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var oN="print",KP=["typed"],_h=A(oN,KP,t=>{var{typed:e}=t;return e(oN,{"string, Object | Array":sN,"string, Object | Array, number | Object":sN})});function sN(t,e,r){return t.replace(/\$([\w.]+)/g,function(n,i){for(var a=i.split("."),o=e[a.shift()];a.length&&o!==void 0;){var c=a.shift();o=c?o[c]:o+"."}return o!==void 0?lt(o)?o:qe(o,r):n})}var uN="to",eL=["typed","matrix","concat"],Rh=A(uN,eL,t=>{var{typed:e,matrix:r,concat:n}=t,i=$e({typed:e,matrix:r,concat:n});return e(uN,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var lN="isPrime",rL=["typed"],Ph=A(lN,rL,t=>{var{typed:e}=t;return e(lN,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(N,v,w){for(var b=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),N=N.mul(N).mod(w)):(v=v.sub(1),b=N.mul(b).mod(w));return b}var c=n.constructor.clone({precision:n.toFixed(0).length*2});n=new c(n);for(var u=0,s=n.sub(1);s.mod(2).eq(0);)s=s.div(2),u+=1;var l=null;if(n.lt("3317044064679887385961981"))l=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(N=>N<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 m=2;m<=f;m+=1)l.push(f)}for(var p=0;p<l.length;p+=1){var h=l[p],d=o(n.sub(n).add(h),s,n);if(!d.eq(1)){for(var g=0,D=d;!D.eq(n.sub(1));g+=1,D=D.mul(D).mod(n))if(g===u-1)return!1}}return!0},"Array | Matrix":e.referToSelf(r=>n=>Oe(n,r))})});var tL="numeric",nL=["number","?bignumber","?fraction"],Lh=A(tL,nL,t=>{var{number:e,bignumber:r,fraction:n}=t,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:r?o=>r(o):Po,Fraction:n?o=>n(o):Wl};return function(c){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",s=arguments.length>2?arguments[2]:void 0;if(s!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var l=nr(c);if(!(l in i))throw new TypeError("Cannot convert "+c+' of type "'+l+'"; valid input types are '+Object.keys(i).join(", "));if(!(u in a))throw new TypeError("Cannot convert "+c+' to type "'+u+'"; valid output types are '+Object.keys(a).join(", "));return u===l?c:a[u](c)}});var cN="divideScalar",iL=["typed","numeric"],kh=A(cN,iL,t=>{var{typed:e,numeric:r}=t;return e(cN,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var fN="pow",aL=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],qh=A(fN,aL,t=>{var{typed:e,config:r,identity:n,multiply:i,matrix:a,inv:o,number:c,fraction:u,Complex:s}=t;return e(fN,{"number, number":l,"Complex, Complex":function(h,d){return h.pow(d)},"BigNumber, BigNumber":function(h,d){return d.isInteger()||h>=0||r.predictable?h.pow(d):new s(h.toNumber(),0).pow(d.toNumber(),0)},"Fraction, Fraction":function(h,d){var g=h.pow(d);if(g!=null)return g;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(h.valueOf(),d.valueOf())},"Array, number":f,"Array, BigNumber":function(h,d){return f(h,d.toNumber())},"Matrix, number":m,"Matrix, BigNumber":function(h,d){return m(h,d.toNumber())},"Unit, number | BigNumber":function(h,d){return h.pow(d)}});function l(p,h){if(r.predictable&&!Ae(h)&&p<0)try{var d=u(h),g=c(d);if((h===g||Math.abs((h-g)/h)<1e-14)&&d.d%2===1)return(d.n%2===0?1:-1)*Math.pow(-p,h)}catch(D){}return r.predictable&&(p<-1&&h===1/0||p>-1&&p<0&&h===-1/0)?NaN:Ae(h)||p>=0||r.predictable?dp(p,h):p*p<1&&h===1/0||p*p>1&&h===-1/0?0:new s(p,0).pow(h,0)}function f(p,h){if(!Ae(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var d=ze(p);if(d.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+d.length+" dimensions)");if(d[0]!==d[1])throw new Error("For A^b, A must be square (size is "+d[0]+"x"+d[1]+")");if(h<0)try{return f(o(p),-h)}catch(N){throw N.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+h+")"):N}for(var g=n(d[0]).valueOf(),D=p;h>=1;)(h&1)===1&&(g=i(D,g)),h>>=1,D=i(D,D);return g}function m(p,h){return a(f(p.valueOf(),h))}});var ko="Number of decimals in function round must be an integer",mN="round",oL=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],zh=A(mN,oL,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,BigNumber:a,DenseMatrix:o}=t,c=Dr({typed:e,equalScalar:n}),u=cr({typed:e,DenseMatrix:o}),s=ft({typed:e});return e(mN,{number:hp,"number, number":hp,"number, BigNumber":function(f,m){if(!m.isInteger())throw new TypeError(ko);return new a(f).toDecimalPlaces(m.toNumber())},Complex:function(f){return f.round()},"Complex, number":function(f,m){if(m%1)throw new TypeError(ko);return f.round(m)},"Complex, BigNumber":function(f,m){if(!m.isInteger())throw new TypeError(ko);var p=m.toNumber();return f.round(p)},BigNumber:function(f){return f.toDecimalPlaces(0)},"BigNumber, BigNumber":function(f,m){if(!m.isInteger())throw new TypeError(ko);return f.toDecimalPlaces(m.toNumber())},Fraction:function(f){return f.round()},"Fraction, number":function(f,m){if(m%1)throw new TypeError(ko);return f.round(m)},"Fraction, BigNumber":function(f,m){if(!m.isInteger())throw new TypeError(ko);return f.round(m.toNumber())},"Array | Matrix":e.referToSelf(l=>f=>Oe(f,l,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(l=>(f,m)=>c(f,m,l,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(l=>(f,m)=>s(f,m,l,!1)),"Array, number | BigNumber":e.referToSelf(l=>(f,m)=>s(r(f),m,l,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(l=>(f,m)=>n(f,0)?i(m.size(),m.storage()):u(m,f,l,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(l=>(f,m)=>n(f,0)?i(m.size(),m.storage()):s(m,f,l,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(l=>(f,m)=>s(r(m),f,l,!0).valueOf())})});var pN="log",sL=["config","typed","divideScalar","Complex"],Uh=A(pN,sL,t=>{var{typed:e,config:r,divideScalar:n,Complex:i}=t;return e(pN,{number:function(o){return o>=0||r.predictable?yE(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||r.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":e.referToSelf(a=>(o,c)=>n(a(o),a(c)))})});var dN="log1p",uL=["typed","config","divideScalar","log","Complex"],Vh=A(dN,uL,t=>{var{typed:e,config:r,divideScalar:n,log:i,Complex:a}=t;return e(dN,{number:function(u){return u>=-1||r.predictable?gl(u):o(new a(u,0))},Complex:o,BigNumber:function(u){var s=u.plus(1);return!s.isNegative()||r.predictable?s.ln():o(new a(u.toNumber(),0))},"Array | Matrix":e.referToSelf(c=>u=>Oe(u,c)),"any, any":e.referToSelf(c=>(u,s)=>n(c(u),i(s)))});function o(c){var u=c.re+1;return new a(Math.log(Math.sqrt(u*u+c.im*c.im)),Math.atan2(c.im,u))}});var hN="nthRoots",lL=["config","typed","divideScalar","Complex"],$h=A(hN,lL,t=>{var{typed:e,config:r,divideScalar:n,Complex:i}=t,a=[function(u){return new i(u,0)},function(u){return new i(0,u)},function(u){return new i(-u,0)},function(u){return new i(0,-u)}];function o(c,u){if(u<0)throw new Error("Root must be greater than zero");if(u===0)throw new Error("Root must be non-zero");if(u%1!==0)throw new Error("Root must be an integer");if(c===0||c.abs()===0)return[new i(0,0)];var s=typeof c=="number",l;(s||c.re===0||c.im===0)&&(s?l=2*+(c<0):c.im===0?l=2*+(c.re<0):l=2*+(c.im<0)+1);for(var f=c.arg(),m=c.abs(),p=[],h=Math.pow(m,1/u),d=0;d<u;d++){var g=(l+4*d)/u;if(g===Math.round(g)){p.push(a[g%4](h));continue}p.push(new i({r:h,phi:(f+2*Math.PI*d)/u}))}return p}return e(hN,{Complex:function(u){return o(u,2)},"Complex, number":o})});var vN="dotPow",cL=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],Hh=A(vN,cL,t=>{var{typed:e,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o}=t,c=Tr({typed:e}),u=wt({typed:e,DenseMatrix:a}),s=Dr({typed:e,equalScalar:r}),l=cr({typed:e,DenseMatrix:a}),f=$e({typed:e,matrix:n,concat:o}),m={};for(var p in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,p)&&!p.includes("Matrix")&&!p.includes("Array")&&(m[p]=i.signatures[p]);var h=e(m);return e(vN,f({elop:h,SS:u,DS:c,Ss:s,sS:l}))});var gN="dotDivide",fL=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Wh=A(gN,fL,t=>{var{typed:e,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=t,c=mt({typed:e,equalScalar:n}),u=Tr({typed:e}),s=wt({typed:e,DenseMatrix:a}),l=Dr({typed:e,equalScalar:n}),f=cr({typed:e,DenseMatrix:a}),m=$e({typed:e,matrix:r,concat:o});return e(gN,m({elop:i,SS:s,DS:u,SD:c,Ss:l,sS:f}))});function bi(t){var{DenseMatrix:e}=t;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+qe(o)+")");var c=o[0],u=o[1];if(c!==u)throw new RangeError("Matrix must be square (size: "+qe(o)+")");var s=[];if(Fe(i)){var l=i.size(),f=i._data;if(l.length===1){if(l[0]!==c)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var m=0;m<c;m++)s[m]=[f[m]];return new e({data:s,size:[c,1],datatype:i._datatype})}if(l.length===2){if(l[0]!==c||l[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Ta(i)){if(a){s=[];for(var p=0;p<c;p++)s[p]=[f[p][0]];return new e({data:s,size:[c,1],datatype:i._datatype})}return i}if(Jn(i)){for(var h=0;h<c;h++)s[h]=[0];for(var d=i._values,g=i._index,D=i._ptr,N=D[1],v=D[0];v<N;v++){var w=g[v];s[w][0]=d[v]}return new e({data:s,size:[c,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(lr(i)){var b=ze(i);if(b.length===1){if(b[0]!==c)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var y=0;y<c;y++)s[y]=[i[y]];return new e({data:s,size:[c,1]})}if(b.length===2){if(b[0]!==c||b[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var E=0;E<c;E++)s[E]=[i[E][0]];return new e({data:s,size:[c,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var yN="lsolve",mL=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Gh=A(yN,mL,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:c}=t,u=bi({DenseMatrix:c});return e(yN,{"SparseMatrix, Array | Matrix":function(m,p){return l(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return s(m,p)},"Array, Array | Matrix":function(m,p){var h=r(m),d=s(h,p);return d.valueOf()}});function s(f,m){m=u(f,m,!0);for(var p=m._data,h=f._size[0],d=f._size[1],g=[],D=f._data,N=0;N<d;N++){var v=p[N][0]||0,w=void 0;if(o(v,0))w=0;else{var b=D[N][N];if(o(b,0))throw new Error("Linear system cannot be solved since matrix is singular");w=n(v,b);for(var y=N+1;y<h;y++)p[y]=[a(p[y][0]||0,i(w,D[y][N]))]}g[N]=[w]}return new c({data:g,size:[h,1]})}function l(f,m){m=u(f,m,!0);for(var p=m._data,h=f._size[0],d=f._size[1],g=f._values,D=f._index,N=f._ptr,v=[],w=0;w<d;w++){var b=p[w][0]||0;if(o(b,0))v[w]=[0];else{for(var y=0,E=[],F=[],S=N[w],C=N[w+1],B=S;B<C;B++){var I=D[B];I===w?y=g[B]:I>w&&(E.push(g[B]),F.push(I))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var L=n(b,y),k=0,P=F.length;k<P;k++){var M=F[k];p[M]=[a(p[M][0]||0,i(L,E[k]))]}v[w]=[L]}}return new c({data:v,size:[h,1]})}});var xN="usolve",pL=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Zh=A(xN,pL,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:c}=t,u=bi({DenseMatrix:c});return e(xN,{"SparseMatrix, Array | Matrix":function(m,p){return l(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return s(m,p)},"Array, Array | Matrix":function(m,p){var h=r(m),d=s(h,p);return d.valueOf()}});function s(f,m){m=u(f,m,!0);for(var p=m._data,h=f._size[0],d=f._size[1],g=[],D=f._data,N=d-1;N>=0;N--){var v=p[N][0]||0,w=void 0;if(o(v,0))w=0;else{var b=D[N][N];if(o(b,0))throw new Error("Linear system cannot be solved since matrix is singular");w=n(v,b);for(var y=N-1;y>=0;y--)p[y]=[a(p[y][0]||0,i(w,D[y][N]))]}g[N]=[w]}return new c({data:g,size:[h,1]})}function l(f,m){m=u(f,m,!0);for(var p=m._data,h=f._size[0],d=f._size[1],g=f._values,D=f._index,N=f._ptr,v=[],w=d-1;w>=0;w--){var b=p[w][0]||0;if(o(b,0))v[w]=[0];else{for(var y=0,E=[],F=[],S=N[w],C=N[w+1],B=C-1;B>=S;B--){var I=D[B];I===w?y=g[B]:I<w&&(E.push(g[B]),F.push(I))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var L=n(b,y),k=0,P=F.length;k<P;k++){var M=F[k];p[M]=[a(p[M][0],i(L,E[k]))]}v[w]=[L]}}return new c({data:v,size:[h,1]})}});var DN="lsolveAll",dL=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],jh=A(DN,dL,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:c}=t,u=bi({DenseMatrix:c});return e(DN,{"SparseMatrix, Array | Matrix":function(m,p){return l(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return s(m,p)},"Array, Array | Matrix":function(m,p){var h=r(m),d=s(h,p);return d.map(g=>g.valueOf())}});function s(f,m){for(var p=[u(f,m,!0)._data.map(F=>F[0])],h=f._data,d=f._size[0],g=f._size[1],D=0;D<g;D++)for(var N=p.length,v=0;v<N;v++){var w=p[v];if(o(h[D][D],0))if(o(w[D],0)){if(v===0){var y=[...w];y[D]=1;for(var E=D+1;E<g;E++)y[E]=a(y[E],h[E][D]);p.push(y)}}else{if(v===0)return[];p.splice(v,1),v-=1,N-=1}else{w[D]=n(w[D],h[D][D]);for(var b=D+1;b<g;b++)w[b]=a(w[b],i(w[D],h[b][D]))}}return p.map(F=>new c({data:F.map(S=>[S]),size:[d,1]}))}function l(f,m){for(var p=[u(f,m,!0)._data.map(Y=>Y[0])],h=f._size[0],d=f._size[1],g=f._values,D=f._index,N=f._ptr,v=0;v<d;v++)for(var w=p.length,b=0;b<w;b++){for(var y=p[b],E=[],F=[],S=N[v],C=N[v+1],B=0,I=S;I<C;I++){var L=D[I];L===v?B=g[I]:L>v&&(E.push(g[I]),F.push(L))}if(o(B,0))if(o(y[v],0)){if(b===0){var T=[...y];T[v]=1;for(var H=0,_=F.length;H<_;H++){var z=F[H];T[z]=a(T[z],E[H])}p.push(T)}}else{if(b===0)return[];p.splice(b,1),b-=1,w-=1}else{y[v]=n(y[v],B);for(var k=0,P=F.length;k<P;k++){var M=F[k];y[M]=a(y[M],i(y[v],E[k]))}}}return p.map(Y=>new c({data:Y.map(X=>[X]),size:[h,1]}))}});var bN="usolveAll",hL=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Yh=A(bN,hL,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:c}=t,u=bi({DenseMatrix:c});return e(bN,{"SparseMatrix, Array | Matrix":function(m,p){return l(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return s(m,p)},"Array, Array | Matrix":function(m,p){var h=r(m),d=s(h,p);return d.map(g=>g.valueOf())}});function s(f,m){for(var p=[u(f,m,!0)._data.map(F=>F[0])],h=f._data,d=f._size[0],g=f._size[1],D=g-1;D>=0;D--)for(var N=p.length,v=0;v<N;v++){var w=p[v];if(o(h[D][D],0))if(o(w[D],0)){if(v===0){var y=[...w];y[D]=1;for(var E=D-1;E>=0;E--)y[E]=a(y[E],h[E][D]);p.push(y)}}else{if(v===0)return[];p.splice(v,1),v-=1,N-=1}else{w[D]=n(w[D],h[D][D]);for(var b=D-1;b>=0;b--)w[b]=a(w[b],i(w[D],h[b][D]))}}return p.map(F=>new c({data:F.map(S=>[S]),size:[d,1]}))}function l(f,m){for(var p=[u(f,m,!0)._data.map(Y=>Y[0])],h=f._size[0],d=f._size[1],g=f._values,D=f._index,N=f._ptr,v=d-1;v>=0;v--)for(var w=p.length,b=0;b<w;b++){for(var y=p[b],E=[],F=[],S=N[v],C=N[v+1],B=0,I=C-1;I>=S;I--){var L=D[I];L===v?B=g[I]:L<v&&(E.push(g[I]),F.push(L))}if(o(B,0))if(o(y[v],0)){if(b===0){var T=[...y];T[v]=1;for(var H=0,_=F.length;H<_;H++){var z=F[H];T[z]=a(T[z],E[H])}p.push(T)}}else{if(b===0)return[];p.splice(b,1),b-=1,w-=1}else{y[v]=n(y[v],B);for(var k=0,P=F.length;k<P;k++){var M=F[k];y[M]=a(y[M],i(y[v],E[k]))}}}return p.map(Y=>new c({data:Y.map(X=>[X]),size:[h,1]}))}});var vL="matAlgo08xS0Sid",gL=["typed","equalScalar"],qo=A(vL,gL,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var c=i._values,u=i._index,s=i._ptr,l=i._size,f=i._datatype,m=a._values,p=a._index,h=a._ptr,d=a._size,g=a._datatype;if(l.length!==d.length)throw new Ue(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");if(!c||!m)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var D=l[0],N=l[1],v,w=r,b=0,y=o;typeof f=="string"&&f===g&&(v=f,w=e.find(r,[v,v]),b=e.convert(0,v),y=e.find(o,[v,v]));for(var E=[],F=[],S=[],C=[],B=[],I,L,k,P,M=0;M<N;M++){S[M]=F.length;var T=M+1;for(L=s[M],k=s[M+1],I=L;I<k;I++)P=u[I],B[P]=T,C[P]=c[I],F.push(P);for(L=h[M],k=h[M+1],I=L;I<k;I++)P=p[I],B[P]===T&&(C[P]=y(C[P],m[I]));for(I=S[M];I<F.length;){P=F[I];var H=C[P];w(H,b)?F.splice(I,1):(E.push(H),I++)}}return S[N]=F.length,i.createSparseMatrix({values:E,index:F,ptr:S,size:[D,N],datatype:v})}});var zo=A("useMatrixForArrayScalar",["typed","matrix"],t=>{var{typed:e,matrix:r}=t;return{"Array, number":e.referTo("DenseMatrix, number",n=>(i,a)=>n(r(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(r(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf())}});var wN="leftShift",yL=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Jh=A(wN,yL,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,c=$t({typed:e}),u=mt({typed:e,equalScalar:n}),s=qo({typed:e,equalScalar:n}),l=en({typed:e,DenseMatrix:a}),f=Dr({typed:e,equalScalar:n}),m=ft({typed:e}),p=$e({typed:e,matrix:r,concat:o}),h=zo({typed:e,matrix:r});return e(wN,{"number, number":Dp,"BigNumber, BigNumber":pC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,D)=>n(D,0)?g.clone():f(g,D,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,D)=>n(D,0)?g.clone():m(g,D,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,D)=>n(g,0)?i(D.size(),D.storage()):l(D,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,D)=>n(g,0)?i(D.size(),D.storage()):m(D,g,d,!0))},h,p({SS:s,DS:c,SD:u}))});var EN="rightArithShift",xL=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Xh=A(EN,xL,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,c=$t({typed:e}),u=mt({typed:e,equalScalar:n}),s=qo({typed:e,equalScalar:n}),l=en({typed:e,DenseMatrix:a}),f=Dr({typed:e,equalScalar:n}),m=ft({typed:e}),p=$e({typed:e,matrix:r,concat:o}),h=zo({typed:e,matrix:r});return e(EN,{"number, number":bp,"BigNumber, BigNumber":dC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,D)=>n(D,0)?g.clone():f(g,D,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,D)=>n(D,0)?g.clone():m(g,D,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,D)=>n(g,0)?i(D.size(),D.storage()):l(D,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,D)=>n(g,0)?i(D.size(),D.storage()):m(D,g,d,!0))},h,p({SS:s,DS:c,SD:u}))});var CN="rightLogShift",DL=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Qh=A(CN,DL,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,c=$t({typed:e}),u=mt({typed:e,equalScalar:n}),s=qo({typed:e,equalScalar:n}),l=en({typed:e,DenseMatrix:a}),f=Dr({typed:e,equalScalar:n}),m=ft({typed:e}),p=$e({typed:e,matrix:r,concat:o}),h=zo({typed:e,matrix:r});return e(CN,{"number, number":wp,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,D)=>n(D,0)?g.clone():f(g,D,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,D)=>n(D,0)?g.clone():m(g,D,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,D)=>n(g,0)?i(D.size(),D.storage()):l(D,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,D)=>n(g,0)?i(D.size(),D.storage()):m(D,g,d,!0))},h,p({SS:s,DS:c,SD:u}))});var NN="and",bL=["typed","matrix","equalScalar","zeros","not","concat"],Kh=A(NN,bL,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,c=mt({typed:e,equalScalar:n}),u=ra({typed:e,equalScalar:n}),s=Dr({typed:e,equalScalar:n}),l=ft({typed:e}),f=$e({typed:e,matrix:r,concat:o});return e(NN,{"number, number":Sp,"Complex, Complex":function(p,h){return(p.re!==0||p.im!==0)&&(h.re!==0||h.im!==0)},"BigNumber, BigNumber":function(p,h){return!p.isZero()&&!h.isZero()&&!p.isNaN()&&!h.isNaN()},"Unit, Unit":e.referToSelf(m=>(p,h)=>m(p.value||0,h.value||0)),"SparseMatrix, any":e.referToSelf(m=>(p,h)=>a(h)?i(p.size(),p.storage()):s(p,h,m,!1)),"DenseMatrix, any":e.referToSelf(m=>(p,h)=>a(h)?i(p.size(),p.storage()):l(p,h,m,!1)),"any, SparseMatrix":e.referToSelf(m=>(p,h)=>a(p)?i(p.size(),p.storage()):s(h,p,m,!0)),"any, DenseMatrix":e.referToSelf(m=>(p,h)=>a(p)?i(p.size(),p.storage()):l(h,p,m,!0)),"Array, any":e.referToSelf(m=>(p,h)=>m(r(p),h).valueOf()),"any, Array":e.referToSelf(m=>(p,h)=>m(p,r(h)).valueOf())},f({SS:u,DS:c}))});var Zl="compare",wL=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],ev=A(Zl,wL,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:c,concat:u}=t,s=Tr({typed:e}),l=ta({typed:e,equalScalar:n}),f=cr({typed:e,DenseMatrix:c}),m=$e({typed:e,matrix:i,concat:u}),p=Bn({typed:e});return e(Zl,EL({typed:e,config:r}),{"boolean, boolean":function(d,g){return d===g?0:d>g?1:-1},"BigNumber, BigNumber":function(d,g){return Tt(d,g,r.epsilon)?new a(0):new a(d.cmp(g))},"Fraction, Fraction":function(d,g){return new o(d.compare(g))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,m({SS:l,DS:s,Ss:f}))}),EL=A(Zl,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Zl,{"number, number":function(i,a){return ct(i,a,r.epsilon)?0:i>a?1:-1}})});var _a=Yt(FN(),1);var SN="compareNatural",CL=["typed","compare"],rv=A(SN,CL,t=>{var{typed:e,compare:r}=t,n=r.signatures["boolean,boolean"];return e(SN,{"any, any":i});function i(u,s){var l=nr(u),f=nr(s),m;if((l==="number"||l==="BigNumber"||l==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return m=r(u,s),m.toString()!=="0"?m>0?1:-1:(0,_a.default)(l,f);var p=["Array","DenseMatrix","SparseMatrix"];if(p.includes(l)||p.includes(f))return m=a(i,u,s),m!==0?m:(0,_a.default)(l,f);if(l!==f)return(0,_a.default)(l,f);if(l==="Complex")return NL(u,s);if(l==="Unit")return u.equalBase(s)?i(u.value,s.value):o(i,u.formatUnits(),s.formatUnits());if(l==="boolean")return n(u,s);if(l==="string")return(0,_a.default)(u,s);if(l==="Object")return c(i,u,s);if(l==="null"||l==="undefined")return 0;throw new TypeError('Unsupported type of value "'+l+'"')}function a(u,s,l){return Jn(s)&&Jn(l)?o(u,s.toJSON().values,l.toJSON().values):Jn(s)?a(u,s.toArray(),l):Jn(l)?a(u,s,l.toArray()):Ta(s)?a(u,s.toJSON().data,l):Ta(l)?a(u,s,l.toJSON().data):Array.isArray(s)?Array.isArray(l)?o(u,s,l):a(u,s,[l]):a(u,[s],l)}function o(u,s,l){for(var f=0,m=Math.min(s.length,l.length);f<m;f++){var p=u(s[f],l[f]);if(p!==0)return p}return s.length>l.length?1:s.length<l.length?-1:0}function c(u,s,l){var f=Object.keys(s),m=Object.keys(l);f.sort(_a.default),m.sort(_a.default);var p=o(u,f,m);if(p!==0)return p;for(var h=0;h<f.length;h++){var d=u(s[f[h]],l[m[h]]);if(d!==0)return d}return 0}});function NL(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0}var MN="compareText",AL=["typed","matrix","concat"];wl.signature="any, any";var tv=A(MN,AL,t=>{var{typed:e,matrix:r,concat:n}=t,i=$e({typed:e,matrix:r,concat:n});return e(MN,wl,i({elop:wl,Ds:!0}))});var jl="equal",FL=["typed","matrix","equalScalar","DenseMatrix","concat"],nv=A(jl,FL,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=Tr({typed:e}),c=wt({typed:e,DenseMatrix:i}),u=cr({typed:e,DenseMatrix:i}),s=$e({typed:e,matrix:r,concat:a});return e(jl,SL({typed:e,equalScalar:n}),s({elop:n,SS:c,DS:o,Ss:u}))}),SL=A(jl,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(jl,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:r(i,a)}})});var TN="equalText",ML=["typed","compareText","isZero"],iv=A(TN,ML,t=>{var{typed:e,compareText:r,isZero:n}=t;return e(TN,{"any, any":function(a,o){return n(r(a,o))}})});var Yl="smaller",TL=["typed","config","matrix","DenseMatrix","concat"],av=A(Yl,TL,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a}=t,o=Tr({typed:e}),c=wt({typed:e,DenseMatrix:i}),u=cr({typed:e,DenseMatrix:i}),s=$e({typed:e,matrix:n,concat:a}),l=Bn({typed:e});return e(Yl,OL({typed:e,config:r}),{"boolean, boolean":(f,m)=>f<m,"BigNumber, BigNumber":function(m,p){return m.lt(p)&&!Tt(m,p,r.epsilon)},"Fraction, Fraction":(f,m)=>f.compare(m)===-1,"Complex, Complex":function(m,p){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:c,DS:o,Ss:u}))}),OL=A(Yl,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Yl,{"number, number":function(i,a){return i<a&&!ct(i,a,r.epsilon)}})});var Jl="smallerEq",BL=["typed","config","matrix","DenseMatrix","concat"],ov=A(Jl,BL,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a}=t,o=Tr({typed:e}),c=wt({typed:e,DenseMatrix:i}),u=cr({typed:e,DenseMatrix:i}),s=$e({typed:e,matrix:n,concat:a}),l=Bn({typed:e});return e(Jl,IL({typed:e,config:r}),{"boolean, boolean":(f,m)=>f<=m,"BigNumber, BigNumber":function(m,p){return m.lte(p)||Tt(m,p,r.epsilon)},"Fraction, Fraction":(f,m)=>f.compare(m)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:c,DS:o,Ss:u}))}),IL=A(Jl,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Jl,{"number, number":function(i,a){return i<=a||ct(i,a,r.epsilon)}})});var Xl="larger",_L=["typed","config","matrix","DenseMatrix","concat"],sv=A(Xl,_L,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a}=t,o=Tr({typed:e}),c=wt({typed:e,DenseMatrix:i}),u=cr({typed:e,DenseMatrix:i}),s=$e({typed:e,matrix:n,concat:a}),l=Bn({typed:e});return e(Xl,RL({typed:e,config:r}),{"boolean, boolean":(f,m)=>f>m,"BigNumber, BigNumber":function(m,p){return m.gt(p)&&!Tt(m,p,r.epsilon)},"Fraction, Fraction":(f,m)=>f.compare(m)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:c,DS:o,Ss:u}))}),RL=A(Xl,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Xl,{"number, number":function(i,a){return i>a&&!ct(i,a,r.epsilon)}})});var Ql="largerEq",PL=["typed","config","matrix","DenseMatrix","concat"],uv=A(Ql,PL,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a}=t,o=Tr({typed:e}),c=wt({typed:e,DenseMatrix:i}),u=cr({typed:e,DenseMatrix:i}),s=$e({typed:e,matrix:n,concat:a}),l=Bn({typed:e});return e(Ql,LL({typed:e,config:r}),{"boolean, boolean":(f,m)=>f>=m,"BigNumber, BigNumber":function(m,p){return m.gte(p)||Tt(m,p,r.epsilon)},"Fraction, Fraction":(f,m)=>f.compare(m)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,s({SS:c,DS:o,Ss:u}))}),LL=A(Ql,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Ql,{"number, number":function(i,a){return i>=a||ct(i,a,r.epsilon)}})});var ON="deepEqual",kL=["typed","equal"],lv=A(ON,kL,t=>{var{typed:e,equal:r}=t;return e(ON,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var c=0;c<o;c++)if(!n(i[c],a[c]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:r(i,a)}});var Kl="unequal",qL=["typed","config","equalScalar","matrix","DenseMatrix","concat"],cv=A(Kl,qL,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=t,c=Tr({typed:e}),u=wt({typed:e,DenseMatrix:a}),s=cr({typed:e,DenseMatrix:a}),l=$e({typed:e,matrix:i,concat:o});return e(Kl,zL({typed:e,equalScalar:n}),l({elop:f,SS:u,DS:c,Ss:s}));function f(m,p){return!n(m,p)}}),zL=A(Kl,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(Kl,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!r(i,a)}})});var BN="partitionSelect",UL=["typed","isNumeric","isNaN","compare"],fv=A(BN,UL,t=>{var{typed:e,isNumeric:r,isNaN:n,compare:i}=t,a=i,o=(s,l)=>-i(s,l);return e(BN,{"Array | Matrix, number":function(l,f){return c(l,f,a)},"Array | Matrix, number, string":function(l,f,m){if(m==="asc")return c(l,f,a);if(m==="desc")return c(l,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":c});function c(s,l,f){if(!Ae(l)||l<0)throw new Error("k must be a non-negative integer");if(Fe(s)){var m=s.size();if(m.length>1)throw new Error("Only one dimensional matrices supported");return u(s.valueOf(),l,f)}if(Array.isArray(s))return u(s,l,f)}function u(s,l,f){if(l>=s.length)throw new Error("k out of bounds");for(var m=0;m<s.length;m++)if(r(s[m])&&n(s[m]))return s[m];for(var p=0,h=s.length-1;p<h;){for(var d=p,g=h,D=s[Math.floor(Math.random()*(h-p+1))+p];d<g;)if(f(s[d],D)>=0){var N=s[g];s[g]=s[d],s[d]=N,--g}else++d;f(s[d],D)>0&&--d,l<=d?h=d:p=d+1}return s[l]}});var IN="sort",VL=["typed","matrix","compare","compareNatural"],mv=A(IN,VL,t=>{var{typed:e,matrix:r,compare:n,compareNatural:i}=t,a=n,o=(l,f)=>-n(l,f);return e(IN,{Array:function(f){return u(f),f.sort(a)},Matrix:function(f){return s(f),r(f.toArray().sort(a),f.storage())},"Array, function":function(f,m){return u(f),f.sort(m)},"Matrix, function":function(f,m){return s(f),r(f.toArray().sort(m),f.storage())},"Array, string":function(f,m){return u(f),f.sort(c(m))},"Matrix, string":function(f,m){return s(f),r(f.toArray().sort(c(m)),f.storage())}});function c(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 u(l){if(ze(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 _N="max",$L=["typed","config","numeric","larger"],Ys=A(_N,$L,t=>{var{typed:e,config:r,numeric:n,larger:i}=t;return e(_N,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return ea(u,s.valueOf(),a)},"...":function(u){if(On(u))throw new TypeError("Scalar values expected in function max");return o(u)}});function a(c,u){try{return i(c,u)?c:u}catch(s){throw Qr(s,"max",u)}}function o(c){var u;if(Vt(c,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(l){throw Qr(l,"max",s)}}),u===void 0)throw new Error("Cannot calculate max of an empty array");return typeof u=="string"&&(u=n(u,r.number)),u}});var RN="min",HL=["typed","config","numeric","smaller"],Js=A(RN,HL,t=>{var{typed:e,config:r,numeric:n,smaller:i}=t;return e(RN,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return ea(u,s.valueOf(),a)},"...":function(u){if(On(u))throw new TypeError("Scalar values expected in function min");return o(u)}});function a(c,u){try{return i(c,u)?c:u}catch(s){throw Qr(s,"min",u)}}function o(c){var u;if(Vt(c,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(l){throw Qr(l,"min",s)}}),u===void 0)throw new Error("Cannot calculate min of an empty array");return typeof u=="string"&&(u=n(u,r.number)),u}});var WL="ImmutableDenseMatrix",GL=["smaller","DenseMatrix"],pv=A(WL,GL,t=>{var{smaller:e,DenseMatrix:r}=t;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!lt(a))throw new Error("Invalid datatype: "+a);if(Fe(i)||lr(i)){var o=new r(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&lr(i.data)&&lr(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min!="undefined"?i.min:null,this._max=typeof i.max!="undefined"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+nr(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=r.prototype.subset.call(this,i);return Fe(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:Ie(this._data),size:Ie(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 ZL="Index",jL=["ImmutableDenseMatrix"],dv=A(ZL,jL,t=>{var{ImmutableDenseMatrix:e}=t;function r(i){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var a=0,o=arguments.length;a<o;a++){var c=arguments[a];if(No(c))this._dimensions.push(c),this._isScalar=!1;else if(Array.isArray(c)||Fe(c)){var u=n(c.valueOf());this._dimensions.push(u);var s=u.size();(s.length!==1||s[0]!==1)&&(this._isScalar=!1)}else if(typeof c=="number")this._dimensions.push(n([c]));else if(typeof c=="string")this._dimensions.push(c);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range")}}r.prototype.type="Index",r.prototype.isIndex=!0;function n(i){for(var a=0,o=i.length;a<o;a++)if(typeof i[a]!="number"||!Ae(i[a]))throw new TypeError("Index parameters must be positive integer numbers");return new e(i)}return r.prototype.clone=function(){var i=new r;return i._dimensions=Ie(this._dimensions),i._isScalar=this._isScalar,i},r.create=function(i){var a=new r;return r.apply(a,i),a},r.prototype.size=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var c=this._dimensions[a];i[a]=typeof c=="string"?1:c.size()[0]}return i},r.prototype.max=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var c=this._dimensions[a];i[a]=typeof c=="string"?c:c.max()}return i},r.prototype.min=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var c=this._dimensions[a];i[a]=typeof c=="string"?c:c.min()}return i},r.prototype.forEach=function(i){for(var a=0,o=this._dimensions.length;a<o;a++)i(this._dimensions[a],a,this)},r.prototype.dimension=function(i){return this._dimensions[i]||null},r.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var c=this._dimensions[a];i.push(typeof c=="string"?c:c.toArray())}return i},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var c=this._dimensions[a];typeof c=="string"?i.push(JSON.stringify(c)):i.push(c.toString())}return"["+i.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(i){return r.create(i.dimensions)},r},{isClass:!0});var YL="FibonacciHeap",JL=["smaller","larger"],hv=A(YL,JL,t=>{var{smaller:e,larger:r}=t,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(l,f){var m={key:l,value:f,degree:0};if(this._minimum){var p=this._minimum;m.left=p,m.right=p.right,p.right=m,m.right.left=m,e(l,p.key)&&(this._minimum=m)}else m.left=m,m.right=m,this._minimum=m;return this._size++,m},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var l=this._minimum;if(l===null)return l;for(var f=this._minimum,m=l.degree,p=l.child;m>0;){var h=p.right;p.left.right=p.right,p.right.left=p.left,p.left=f,p.right=f.right,f.right=p,p.right.left=p,p.parent=null,p=h,m--}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,m){f.key=m;var p=f.parent;return p&&e(f.key,p.key)&&(o(l,f,p),c(l,p)),e(f.key,l.key)&&(l=f),l}function o(l,f,m){f.left.right=f.right,f.right.left=f.left,m.degree--,m.child===f&&(m.child=f.right),m.degree===0&&(m.child=null),f.left=l,f.right=l.right,l.right=f,f.right.left=f,f.parent=null,f.mark=!1}function c(l,f){var m=f.parent;!m||(f.mark?(o(l,f,m),c(m)):f.mark=!0)}var u=function(f,m){f.left.right=f.right,f.right.left=f.left,f.parent=m,m.child?(f.left=m.child,f.right=m.child.right,m.child.right=f,f.right.left=f):(m.child=f,f.right=f,f.left=f),m.degree++,f.mark=!1};function s(l,f){var m=Math.floor(Math.log(f)*n)+1,p=new Array(m),h=0,d=l;if(d)for(h++,d=d.right;d!==l;)h++,d=d.right;for(var g;h>0;){for(var D=d.degree,N=d.right;g=p[D],!!g;){if(r(d.key,g.key)){var v=g;g=d,d=v}u(g,d),p[D]=null,D++}p[D]=d,d=N,h--}l=null;for(var w=0;w<m;w++)g=p[w],g&&(l?(g.left.right=g.right,g.right.left=g.left,g.left=l,g.right=l.right,l.right=g,g.right.left=g,e(g.key,l.key)&&(l=g)):l=g);return l}return i},{isClass:!0});var XL="Spa",QL=["addScalar","equalScalar","FibonacciHeap"],vv=A(XL,QL,t=>{var{addScalar:e,equalScalar:r,FibonacciHeap:n}=t;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var c=this._heap.insert(a,o);this._values[a]=c}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var c=this._values[a];c?c.value=e(c.value,o):(c=this._heap.insert(a,o),this._values[a]=c)},i.prototype.forEach=function(a,o,c){var u=this._heap,s=this._values,l=[],f=u.extractMinimum();for(f&&l.push(f);f&&f.key<=o;)f.key>=a&&(r(f.value,0)||c(f.key,f.value,this)),f=u.extractMinimum(),f&&l.push(f);for(var m=0;m<l.length;m++){var p=l[m];f=u.insert(p.key,p.value),s[f.key]=f}},i.prototype.swap=function(a,o){var c=this._values[a],u=this._values[o];if(!c&&u)c=this._heap.insert(a,u.value),this._heap.remove(u),this._values[a]=c,this._values[o]=void 0;else if(c&&!u)u=this._heap.insert(o,c.value),this._heap.remove(c),this._values[o]=u,this._values[a]=void 0;else if(c&&u){var s=c.value;c.value=u.value,u.value=s}},i},{isClass:!0});function na(t){return na=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},na(t)}function gv(t,e){if(na(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(na(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yv(t){var e=gv(t,"string");return na(e)==="symbol"?e:String(e)}function hr(t,e,r){return e=yv(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var PN=Ba(function(t){return new t(1).exp()},{hasher:ec}),LN=Ba(function(t){return new t(1).plus(new t(5).sqrt()).div(2)},{hasher:ec}),Xs=Ba(function(t){return t.acos(-1)},{hasher:ec}),kN=Ba(function(t){return Xs(t).times(2)},{hasher:ec});function ec(t){return t[0].precision}function qN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function xv(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qN(Object(r),!0).forEach(function(n){hr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var KL="Unit",ek=["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],Dv=A(KL,ek,t=>{var{on:e,config:r,addScalar:n,subtract:i,multiplyScalar:a,divideScalar:o,pow:c,abs:u,fix:s,round:l,equal:f,isNumeric:m,format:p,number:h,Complex:d,BigNumber:g,Fraction:D}=t,N=h;function v(U,G){if(!(this instanceof v))throw new Error("Constructor must be called with the new operator");if(!(U==null||m(U)||Wt(U)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,G===void 0)this.units=[],this.dimensions=H.map($=>0);else if(typeof G=="string"){var oe=v.parse(G);this.units=oe.units,this.dimensions=oe.dimensions}else if(mn(G)&&G.value===null)this.fixPrefix=G.fixPrefix,this.skipAutomaticSimplification=G.skipAutomaticSimplification,this.dimensions=G.dimensions.slice(0),this.units=G.units.map($=>et({},$));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(U)}Object.defineProperty(v,"name",{value:"Unit"}),v.prototype.constructor=v,v.prototype.type="Unit",v.prototype.isUnit=!0;var w,b,y;function E(){for(;y===" "||y===" ";)C()}function F(U){return U>="0"&&U<="9"||U==="."}function S(U){return U>="0"&&U<="9"}function C(){b++,y=w.charAt(b)}function B(U){b=U,y=w.charAt(b)}function I(){var U="",G=b;if(y==="+"?C():y==="-"&&(U+=y,C()),!F(y))return B(G),null;if(y==="."){if(U+=y,C(),!S(y))return B(G),null}else{for(;S(y);)U+=y,C();y==="."&&(U+=y,C())}for(;S(y);)U+=y,C();if(y==="E"||y==="e"){var oe="",$=b;if(oe+=y,C(),(y==="+"||y==="-")&&(oe+=y,C()),!S(y))return B($),U;for(U=U+oe;S(y);)U+=y,C()}return U}function L(){for(var U="";S(y)||v.isValidAlpha(y);)U+=y,C();var G=U.charAt(0);return v.isValidAlpha(G)?U:null}function k(U){return y===U?(C(),U):null}v.parse=function(U,G){if(G=G||{},w=U,b=-1,y="",typeof w!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var oe=new v;oe.units=[];var $=1,j=!1;C(),E();var te=I(),ve=null;if(te){if(r.number==="BigNumber")ve=new g(te);else if(r.number==="Fraction")try{ve=new D(te)}catch(yt){ve=parseFloat(te)}else ve=parseFloat(te);E(),k("*")?($=1,j=!0):k("/")&&($=-1,j=!0)}for(var pe=[],Ne=1;;){for(E();y==="(";)pe.push($),Ne*=$,$=1,C(),E();var ge=void 0;if(y){var We=y;if(ge=L(),ge===null)throw new SyntaxError('Unexpected "'+We+'" in "'+w+'" at index '+b.toString())}else break;var Ke=P(ge);if(Ke===null)throw new SyntaxError('Unit "'+ge+'" not found.');var dr=$*Ne;if(E(),k("^")){E();var wr=I();if(wr===null)throw new SyntaxError('In "'+U+'", "^" must be followed by a floating-point number');dr*=wr}oe.units.push({unit:Ke.unit,prefix:Ke.prefix,power:dr});for(var Br=0;Br<H.length;Br++)oe.dimensions[Br]+=(Ke.unit.dimensions[Br]||0)*dr;for(E();y===")";){if(pe.length===0)throw new SyntaxError('Unmatched ")" in "'+w+'" at index '+b.toString());Ne/=pe.pop(),C(),E()}if(j=!1,k("*")?($=1,j=!0):k("/")?($=-1,j=!0):$=1,Ke.unit.base){var gt=Ke.unit.base.key;re.auto[gt]={unit:Ke.unit,prefix:Ke.prefix}}}if(E(),y)throw new SyntaxError('Could not parse: "'+U+'"');if(j)throw new SyntaxError('Trailing characters: "'+U+'"');if(pe.length!==0)throw new SyntaxError('Unmatched "(" in "'+w+'"');if(oe.units.length===0&&!G.allowNoUnits)throw new SyntaxError('"'+U+'" contains no units');return oe.value=ve!==void 0?oe._normalize(ve):null,oe},v.prototype.clone=function(){var U=new v;U.fixPrefix=this.fixPrefix,U.skipAutomaticSimplification=this.skipAutomaticSimplification,U.value=Ie(this.value),U.dimensions=this.dimensions.slice(0),U.units=[];for(var G=0;G<this.units.length;G++){U.units[G]={};for(var oe in this.units[G])Te(this.units[G],oe)&&(U.units[G][oe]=this.units[G][oe])}return U},v.prototype.valueType=function(){return nr(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(U){if(U==null||this.units.length===0)return U;for(var G=U,oe=v._getNumberConverter(nr(U)),$=0;$<this.units.length;$++){var j=oe(this.units[$].unit.value),te=oe(this.units[$].prefix.value),ve=oe(this.units[$].power);G=a(G,c(a(j,te),ve))}return G},v.prototype._denormalize=function(U,G){if(U==null||this.units.length===0)return U;for(var oe=U,$=v._getNumberConverter(nr(U)),j=0;j<this.units.length;j++){var te=$(this.units[j].unit.value),ve=$(this.units[j].prefix.value),pe=$(this.units[j].power);oe=o(oe,c(a(te,ve),pe))}return oe};var P=Ba(U=>{if(Te(q,U)){var G=q[U],oe=G.prefixes[""];return{unit:G,prefix:oe}}for(var $ in q)if(Te(q,$)&&zw(U,$)){var j=q[$],te=U.length-$.length,ve=U.substring(0,te),pe=Te(j.prefixes,ve)?j.prefixes[ve]:void 0;if(pe!==void 0)return{unit:j,prefix:pe}}return null},{hasher:U=>U[0],limit:100});v.isValuelessUnit=function(U){return P(U)!==null},v.prototype.hasBase=function(U){if(typeof U=="string"&&(U=_[U]),!U)return!1;for(var G=0;G<H.length;G++)if(Math.abs((this.dimensions[G]||0)-(U.dimensions[G]||0))>1e-12)return!1;return!0},v.prototype.equalBase=function(U){for(var G=0;G<H.length;G++)if(Math.abs((this.dimensions[G]||0)-(U.dimensions[G]||0))>1e-12)return!1;return!0},v.prototype.equals=function(U){return this.equalBase(U)&&f(this.value,U.value)},v.prototype.multiply=function(U){for(var G=this.clone(),oe=mn(U)?U:new v(U),$=0;$<H.length;$++)G.dimensions[$]=(this.dimensions[$]||0)+(oe.dimensions[$]||0);for(var j=0;j<oe.units.length;j++){var te=xv({},oe.units[j]);G.units.push(te)}if(this.value!==null||oe.value!==null){var ve=this.value===null?this._normalize(1):this.value,pe=oe.value===null?oe._normalize(1):oe.value;G.value=a(ve,pe)}else G.value=null;return mn(U)&&(G.skipAutomaticSimplification=!1),M(G)},v.prototype.divideInto=function(U){return new v(U).divide(this)},v.prototype.divide=function(U){for(var G=this.clone(),oe=mn(U)?U:new v(U),$=0;$<H.length;$++)G.dimensions[$]=(this.dimensions[$]||0)-(oe.dimensions[$]||0);for(var j=0;j<oe.units.length;j++){var te=xv(xv({},oe.units[j]),{},{power:-oe.units[j].power});G.units.push(te)}if(this.value!==null||oe.value!==null){var ve=this.value===null?this._normalize(1):this.value,pe=oe.value===null?oe._normalize(1):oe.value;G.value=o(ve,pe)}else G.value=null;return mn(U)&&(G.skipAutomaticSimplification=!1),M(G)},v.prototype.pow=function(U){for(var G=this.clone(),oe=0;oe<H.length;oe++)G.dimensions[oe]=(this.dimensions[oe]||0)*U;for(var $=0;$<G.units.length;$++)G.units[$].power*=U;return G.value!==null?G.value=c(G.value,U):G.value=null,G.skipAutomaticSimplification=!1,M(G)};function M(U){return U.equalBase(_.NONE)&&U.value!==null&&!r.predictable?U.value:U}v.prototype.abs=function(){var U=this.clone();if(U.value!==null)if(U._isDerived()||U.units[0].unit.offset===0)U.value=u(U.value);else{var G=U._numberConverter(),oe=G(U.units[0].unit.value),$=G(U.units[0].unit.offset),j=a(oe,$);U.value=i(u(n(U.value,j)),j)}for(var te in U.units)(U.units[te].unit.name==="VA"||U.units[te].unit.name==="VAR")&&(U.units[te].unit=q.W);return U},v.prototype.to=function(U){var G=this.value===null?this._normalize(1):this.value,oe;if(typeof U=="string")oe=v.parse(U);else if(mn(U))oe=U.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(oe))throw new Error("Units do not match ('".concat(oe.toString(),"' != '").concat(this.toString(),"')"));if(oe.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units[0].unit.offset===oe.units[0].unit.offset)oe.value=Ie(G);else{var $=v._getNumberConverter(nr(G)),j=$(this.units[0].unit.value),te=$(this.units[0].unit.offset),ve=a(j,te),pe=$(oe.units[0].unit.value),Ne=$(oe.units[0].unit.offset),ge=a(pe,Ne);oe.value=i(n(G,ve),ge)}return oe.fixPrefix=!0,oe.skipAutomaticSimplification=!0,oe},v.prototype.toNumber=function(U){return N(this.toNumeric(U))},v.prototype.toNumeric=function(U){var G;return U?G=this.to(U):G=this.clone(),G._isDerived()||G.units.length===0?G._denormalize(G.value):G._denormalize(G.value,G.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.formatUnits(),fixPrefix:this.fixPrefix}},v.fromJSON=function(U){var G=new v(U.value,U.unit);return G.fixPrefix=U.fixPrefix||!1,G},v.prototype.valueOf=v.prototype.toString,v.prototype.simplify=function(){var U=this.clone(),G=[],oe;for(var $ in fe)if(Te(fe,$)&&U.hasBase(_[$])){oe=$;break}if(oe==="NONE")U.units=[];else{var j;if(oe&&Te(fe,oe)&&(j=fe[oe]),j)U.units=[{unit:j.unit,prefix:j.prefix,power:1}];else{for(var te=!1,ve=0;ve<H.length;ve++){var pe=H[ve];Math.abs(U.dimensions[ve]||0)>1e-12&&(Te(fe,pe)?G.push({unit:fe[pe].unit,prefix:fe[pe].prefix,power:U.dimensions[ve]||0}):te=!0)}G.length<U.units.length&&!te&&(U.units=G)}}return U},v.prototype.toSI=function(){for(var U=this.clone(),G=[],oe=0;oe<H.length;oe++){var $=H[oe];if(Math.abs(U.dimensions[oe]||0)>1e-12)if(Te(re.si,$))G.push({unit:re.si[$].unit,prefix:re.si[$].prefix,power:U.dimensions[oe]||0});else throw new Error("Cannot express custom unit "+$+" in SI units")}return U.units=G,U.fixPrefix=!0,U.skipAutomaticSimplification=!0,U},v.prototype.formatUnits=function(){for(var U="",G="",oe=0,$=0,j=0;j<this.units.length;j++)this.units[j].power>0?(oe++,U+=" "+this.units[j].prefix.name+this.units[j].unit.name,Math.abs(this.units[j].power-1)>1e-15&&(U+="^"+this.units[j].power)):this.units[j].power<0&&$++;if($>0)for(var te=0;te<this.units.length;te++)this.units[te].power<0&&(oe>0?(G+=" "+this.units[te].prefix.name+this.units[te].unit.name,Math.abs(this.units[te].power+1)>1e-15&&(G+="^"+-this.units[te].power)):(G+=" "+this.units[te].prefix.name+this.units[te].unit.name,G+="^"+this.units[te].power));U=U.substr(1),G=G.substr(1),oe>1&&$>0&&(U="("+U+")"),$>1&&oe>0&&(G="("+G+")");var ve=U;return oe>0&&$>0&&(ve+=" / "),ve+=G,ve},v.prototype.format=function(U){var G=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),oe=!1;typeof G.value!="undefined"&&G.value!==null&&Wt(G.value)&&(oe=Math.abs(G.value.re)<1e-14);for(var $ in G.units)Te(G.units,$)&&G.units[$].unit&&(G.units[$].unit.name==="VA"&&oe?G.units[$].unit=q.VAR:G.units[$].unit.name==="VAR"&&!oe&&(G.units[$].unit=q.VA));G.units.length===1&&!G.fixPrefix&&Math.abs(G.units[0].power-Math.round(G.units[0].power))<1e-14&&(G.units[0].prefix=G._bestPrefix());var j=G._denormalize(G.value),te=G.value!==null?p(j,U||{}):"",ve=G.formatUnits();return G.value&&Wt(G.value)&&(te="("+te+")"),ve.length>0&&te.length>0&&(te+=" "),te+=ve,te},v.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var U=this.value!==null?u(this.value):0,G=u(this.units[0].unit.value),oe=this.units[0].prefix;if(U===0)return oe;var $=this.units[0].power,j=Math.log(U/Math.pow(oe.value*G,$))/Math.LN10-1.2;if(j>-2.200001&&j<1.800001)return oe;j=Math.abs(j);var te=this.units[0].unit.prefixes;for(var ve in te)if(Te(te,ve)){var pe=te[ve];if(pe.scientific){var Ne=Math.abs(Math.log(U/Math.pow(pe.value*G,$))/Math.LN10-1.2);(Ne<j||Ne===j&&pe.name.length<oe.name.length)&&(oe=pe,j=Ne)}}return oe},v.prototype.splitUnit=function(U){for(var G=this.clone(),oe=[],$=0;$<U.length&&(G=G.to(U[$]),$!==U.length-1);$++){var j=G.toNumeric(),te=l(j),ve=void 0,pe=f(te,j);pe?ve=te:ve=s(G.toNumeric());var Ne=new v(ve,U[$].toString());oe.push(Ne),G=i(G,Ne)}for(var ge=0,We=0;We<oe.length;We++)ge=n(ge,oe[We].value);return f(ge,this.value)&&(G.value=0),oe.push(G),oe};var T={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};T.SHORTLONG=et({},T.SHORT,T.LONG),T.BINARY_SHORT=et({},T.BINARY_SHORT_SI,T.BINARY_SHORT_IEC),T.BINARY_LONG=et({},T.BINARY_LONG_SI,T.BINARY_LONG_IEC);var H=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],_={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 z in _)Te(_,z)&&(_[z].key=z);var Y={},X={name:"",base:Y,value:1,offset:0,dimensions:H.map(U=>0)},q={meter:{name:"meter",base:_.LENGTH,prefixes:T.LONG,value:1,offset:0},inch:{name:"inch",base:_.LENGTH,prefixes:T.NONE,value:.0254,offset:0},foot:{name:"foot",base:_.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yard:{name:"yard",base:_.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mile:{name:"mile",base:_.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},link:{name:"link",base:_.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rod:{name:"rod",base:_.LENGTH,prefixes:T.NONE,value:5.0292,offset:0},chain:{name:"chain",base:_.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:_.LENGTH,prefixes:T.NONE,value:1e-10,offset:0},m:{name:"m",base:_.LENGTH,prefixes:T.SHORT,value:1,offset:0},in:{name:"in",base:_.LENGTH,prefixes:T.NONE,value:.0254,offset:0},ft:{name:"ft",base:_.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yd:{name:"yd",base:_.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mi:{name:"mi",base:_.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},li:{name:"li",base:_.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rd:{name:"rd",base:_.LENGTH,prefixes:T.NONE,value:5.02921,offset:0},ch:{name:"ch",base:_.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},mil:{name:"mil",base:_.LENGTH,prefixes:T.NONE,value:254e-7,offset:0},m2:{name:"m2",base:_.SURFACE,prefixes:T.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:_.SURFACE,prefixes:T.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:_.SURFACE,prefixes:T.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:_.SURFACE,prefixes:T.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:_.SURFACE,prefixes:T.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:_.SURFACE,prefixes:T.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:_.SURFACE,prefixes:T.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:_.SURFACE,prefixes:T.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:_.SURFACE,prefixes:T.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:_.SURFACE,prefixes:T.NONE,value:1e4,offset:0},m3:{name:"m3",base:_.VOLUME,prefixes:T.CUBIC,value:1,offset:0},L:{name:"L",base:_.VOLUME,prefixes:T.SHORT,value:.001,offset:0},l:{name:"l",base:_.VOLUME,prefixes:T.SHORT,value:.001,offset:0},litre:{name:"litre",base:_.VOLUME,prefixes:T.LONG,value:.001,offset:0},cuin:{name:"cuin",base:_.VOLUME,prefixes:T.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:_.VOLUME,prefixes:T.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:_.VOLUME,prefixes:T.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:_.VOLUME,prefixes:T.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:_.VOLUME,prefixes:T.NONE,value:15e-6,offset:0},drop:{name:"drop",base:_.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:_.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},minim:{name:"minim",base:_.VOLUME,prefixes:T.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:_.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:_.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:_.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:_.VOLUME,prefixes:T.NONE,value:1e-6,offset:0},cup:{name:"cup",base:_.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:_.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:_.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:_.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:_.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:_.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:_.VOLUME,prefixes:T.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:_.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:_.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:_.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:_.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:_.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:_.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:_.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:_.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},obl:{name:"obl",base:_.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},g:{name:"g",base:_.MASS,prefixes:T.SHORT,value:.001,offset:0},gram:{name:"gram",base:_.MASS,prefixes:T.LONG,value:.001,offset:0},ton:{name:"ton",base:_.MASS,prefixes:T.SHORT,value:907.18474,offset:0},t:{name:"t",base:_.MASS,prefixes:T.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:_.MASS,prefixes:T.LONG,value:1e3,offset:0},grain:{name:"grain",base:_.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:_.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:_.MASS,prefixes:T.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:_.MASS,prefixes:T.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:_.MASS,prefixes:T.NONE,value:45.359237,offset:0},stick:{name:"stick",base:_.MASS,prefixes:T.NONE,value:.115,offset:0},stone:{name:"stone",base:_.MASS,prefixes:T.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:_.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:_.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:_.MASS,prefixes:T.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:_.MASS,prefixes:T.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:_.MASS,prefixes:T.NONE,value:45.359237,offset:0},s:{name:"s",base:_.TIME,prefixes:T.SHORT,value:1,offset:0},min:{name:"min",base:_.TIME,prefixes:T.NONE,value:60,offset:0},h:{name:"h",base:_.TIME,prefixes:T.NONE,value:3600,offset:0},second:{name:"second",base:_.TIME,prefixes:T.LONG,value:1,offset:0},sec:{name:"sec",base:_.TIME,prefixes:T.LONG,value:1,offset:0},minute:{name:"minute",base:_.TIME,prefixes:T.NONE,value:60,offset:0},hour:{name:"hour",base:_.TIME,prefixes:T.NONE,value:3600,offset:0},day:{name:"day",base:_.TIME,prefixes:T.NONE,value:86400,offset:0},week:{name:"week",base:_.TIME,prefixes:T.NONE,value:7*86400,offset:0},month:{name:"month",base:_.TIME,prefixes:T.NONE,value:2629800,offset:0},year:{name:"year",base:_.TIME,prefixes:T.NONE,value:31557600,offset:0},decade:{name:"decade",base:_.TIME,prefixes:T.NONE,value:315576e3,offset:0},century:{name:"century",base:_.TIME,prefixes:T.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:_.TIME,prefixes:T.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:_.FREQUENCY,prefixes:T.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:_.FREQUENCY,prefixes:T.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:_.ANGLE,prefixes:T.SHORT,value:1,offset:0},radian:{name:"radian",base:_.ANGLE,prefixes:T.LONG,value:1,offset:0},deg:{name:"deg",base:_.ANGLE,prefixes:T.SHORT,value:null,offset:0},degree:{name:"degree",base:_.ANGLE,prefixes:T.LONG,value:null,offset:0},grad:{name:"grad",base:_.ANGLE,prefixes:T.SHORT,value:null,offset:0},gradian:{name:"gradian",base:_.ANGLE,prefixes:T.LONG,value:null,offset:0},cycle:{name:"cycle",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:_.ANGLE,prefixes:T.NONE,value:null,offset:0},A:{name:"A",base:_.CURRENT,prefixes:T.SHORT,value:1,offset:0},ampere:{name:"ampere",base:_.CURRENT,prefixes:T.LONG,value:1,offset:0},K:{name:"K",base:_.TEMPERATURE,prefixes:T.SHORT,value:1,offset:0},degC:{name:"degC",base:_.TEMPERATURE,prefixes:T.SHORT,value:1,offset:273.15},degF:{name:"degF",base:_.TEMPERATURE,prefixes:T.SHORT,value:1/1.8,offset:459.67},degR:{name:"degR",base:_.TEMPERATURE,prefixes:T.SHORT,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:_.TEMPERATURE,prefixes:T.LONG,value:1,offset:0},celsius:{name:"celsius",base:_.TEMPERATURE,prefixes:T.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:_.TEMPERATURE,prefixes:T.LONG,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:_.TEMPERATURE,prefixes:T.LONG,value:1/1.8,offset:0},mol:{name:"mol",base:_.AMOUNT_OF_SUBSTANCE,prefixes:T.SHORT,value:1,offset:0},mole:{name:"mole",base:_.AMOUNT_OF_SUBSTANCE,prefixes:T.LONG,value:1,offset:0},cd:{name:"cd",base:_.LUMINOUS_INTENSITY,prefixes:T.SHORT,value:1,offset:0},candela:{name:"candela",base:_.LUMINOUS_INTENSITY,prefixes:T.LONG,value:1,offset:0},N:{name:"N",base:_.FORCE,prefixes:T.SHORT,value:1,offset:0},newton:{name:"newton",base:_.FORCE,prefixes:T.LONG,value:1,offset:0},dyn:{name:"dyn",base:_.FORCE,prefixes:T.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:_.FORCE,prefixes:T.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:_.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:_.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:_.FORCE,prefixes:T.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:_.FORCE,prefixes:T.NONE,value:9.80665,offset:0},J:{name:"J",base:_.ENERGY,prefixes:T.SHORT,value:1,offset:0},joule:{name:"joule",base:_.ENERGY,prefixes:T.SHORT,value:1,offset:0},erg:{name:"erg",base:_.ENERGY,prefixes:T.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:_.ENERGY,prefixes:T.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:_.ENERGY,prefixes:T.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:_.ENERGY,prefixes:T.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:_.ENERGY,prefixes:T.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:_.POWER,prefixes:T.SHORT,value:1,offset:0},watt:{name:"watt",base:_.POWER,prefixes:T.LONG,value:1,offset:0},hp:{name:"hp",base:_.POWER,prefixes:T.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:_.POWER,prefixes:T.SHORT,value:d.I,offset:0},VA:{name:"VA",base:_.POWER,prefixes:T.SHORT,value:1,offset:0},Pa:{name:"Pa",base:_.PRESSURE,prefixes:T.SHORT,value:1,offset:0},psi:{name:"psi",base:_.PRESSURE,prefixes:T.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:_.PRESSURE,prefixes:T.NONE,value:101325,offset:0},bar:{name:"bar",base:_.PRESSURE,prefixes:T.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:_.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:_.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:_.PRESSURE,prefixes:T.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:_.PRESSURE,prefixes:T.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:_.ELECTRIC_CHARGE,prefixes:T.LONG,value:1,offset:0},C:{name:"C",base:_.ELECTRIC_CHARGE,prefixes:T.SHORT,value:1,offset:0},farad:{name:"farad",base:_.ELECTRIC_CAPACITANCE,prefixes:T.LONG,value:1,offset:0},F:{name:"F",base:_.ELECTRIC_CAPACITANCE,prefixes:T.SHORT,value:1,offset:0},volt:{name:"volt",base:_.ELECTRIC_POTENTIAL,prefixes:T.LONG,value:1,offset:0},V:{name:"V",base:_.ELECTRIC_POTENTIAL,prefixes:T.SHORT,value:1,offset:0},ohm:{name:"ohm",base:_.ELECTRIC_RESISTANCE,prefixes:T.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:_.ELECTRIC_INDUCTANCE,prefixes:T.LONG,value:1,offset:0},H:{name:"H",base:_.ELECTRIC_INDUCTANCE,prefixes:T.SHORT,value:1,offset:0},siemens:{name:"siemens",base:_.ELECTRIC_CONDUCTANCE,prefixes:T.LONG,value:1,offset:0},S:{name:"S",base:_.ELECTRIC_CONDUCTANCE,prefixes:T.SHORT,value:1,offset:0},weber:{name:"weber",base:_.MAGNETIC_FLUX,prefixes:T.LONG,value:1,offset:0},Wb:{name:"Wb",base:_.MAGNETIC_FLUX,prefixes:T.SHORT,value:1,offset:0},tesla:{name:"tesla",base:_.MAGNETIC_FLUX_DENSITY,prefixes:T.LONG,value:1,offset:0},T:{name:"T",base:_.MAGNETIC_FLUX_DENSITY,prefixes:T.SHORT,value:1,offset:0},b:{name:"b",base:_.BIT,prefixes:T.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:_.BIT,prefixes:T.BINARY_LONG,value:1,offset:0},B:{name:"B",base:_.BIT,prefixes:T.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:_.BIT,prefixes:T.BINARY_LONG,value:8,offset:0}},J={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function ae(U){if(U.number==="BigNumber"){var G=Xs(g);q.rad.value=new g(1),q.deg.value=G.div(180),q.grad.value=G.div(200),q.cycle.value=G.times(2),q.arcsec.value=G.div(648e3),q.arcmin.value=G.div(10800)}else q.rad.value=1,q.deg.value=Math.PI/180,q.grad.value=Math.PI/200,q.cycle.value=Math.PI*2,q.arcsec.value=Math.PI/648e3,q.arcmin.value=Math.PI/10800;q.radian.value=q.rad.value,q.degree.value=q.deg.value,q.gradian.value=q.grad.value}ae(r),e&&e("config",function(U,G){U.number!==G.number&&ae(U)});var re={si:{NONE:{unit:X,prefix:T.NONE[""]},LENGTH:{unit:q.m,prefix:T.SHORT[""]},MASS:{unit:q.g,prefix:T.SHORT.k},TIME:{unit:q.s,prefix:T.SHORT[""]},CURRENT:{unit:q.A,prefix:T.SHORT[""]},TEMPERATURE:{unit:q.K,prefix:T.SHORT[""]},LUMINOUS_INTENSITY:{unit:q.cd,prefix:T.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:q.mol,prefix:T.SHORT[""]},ANGLE:{unit:q.rad,prefix:T.SHORT[""]},BIT:{unit:q.bits,prefix:T.SHORT[""]},FORCE:{unit:q.N,prefix:T.SHORT[""]},ENERGY:{unit:q.J,prefix:T.SHORT[""]},POWER:{unit:q.W,prefix:T.SHORT[""]},PRESSURE:{unit:q.Pa,prefix:T.SHORT[""]},ELECTRIC_CHARGE:{unit:q.C,prefix:T.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:q.F,prefix:T.SHORT[""]},ELECTRIC_POTENTIAL:{unit:q.V,prefix:T.SHORT[""]},ELECTRIC_RESISTANCE:{unit:q.ohm,prefix:T.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:q.H,prefix:T.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:q.S,prefix:T.SHORT[""]},MAGNETIC_FLUX:{unit:q.Wb,prefix:T.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:q.T,prefix:T.SHORT[""]},FREQUENCY:{unit:q.Hz,prefix:T.SHORT[""]}}};re.cgs=JSON.parse(JSON.stringify(re.si)),re.cgs.LENGTH={unit:q.m,prefix:T.SHORT.c},re.cgs.MASS={unit:q.g,prefix:T.SHORT[""]},re.cgs.FORCE={unit:q.dyn,prefix:T.SHORT[""]},re.cgs.ENERGY={unit:q.erg,prefix:T.NONE[""]},re.us=JSON.parse(JSON.stringify(re.si)),re.us.LENGTH={unit:q.ft,prefix:T.NONE[""]},re.us.MASS={unit:q.lbm,prefix:T.NONE[""]},re.us.TEMPERATURE={unit:q.degF,prefix:T.NONE[""]},re.us.FORCE={unit:q.lbf,prefix:T.NONE[""]},re.us.ENERGY={unit:q.BTU,prefix:T.BTU[""]},re.us.POWER={unit:q.hp,prefix:T.NONE[""]},re.us.PRESSURE={unit:q.psi,prefix:T.NONE[""]},re.auto=JSON.parse(JSON.stringify(re.si));var fe=re.auto;v.setUnitSystem=function(U){if(Te(re,U))fe=re[U];else throw new Error("Unit system "+U+" does not exist. Choices are: "+Object.keys(re).join(", "))},v.getUnitSystem=function(){for(var U in re)if(Te(re,U)&&re[U]===fe)return U},v.typeConverters={BigNumber:function(G){return new g(G+"")},Fraction:function(G){return new D(G)},Complex:function(G){return G},number:function(G){return G}},v.prototype._numberConverter=function(){var U=v.typeConverters[this.valueType()];if(U)return U;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},v._getNumberConverter=function(U){if(!v.typeConverters[U])throw new TypeError('Unsupported type "'+U+'"');return v.typeConverters[U]};for(var he in q)if(Te(q,he)){var me=q[he];me.dimensions=me.base.dimensions}for(var ie in J)if(Te(J,ie)){var xe=q[J[ie]],Me={};for(var be in xe)Te(xe,be)&&(Me[be]=xe[be]);Me.name=ie,q[ie]=Me}v.isValidAlpha=function(G){return/^[a-zA-Z]$/.test(G)};function Ce(U){for(var G=0;G<U.length;G++){if(y=U.charAt(G),G===0&&!v.isValidAlpha(y))throw new Error('Invalid unit name (must begin with alpha character): "'+U+'"');if(G>0&&!(v.isValidAlpha(y)||S(y)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+U+'"')}}return v.createUnit=function(U,G){if(typeof U!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(G&&G.override){for(var oe in U)if(Te(U,oe)&&v.deleteUnit(oe),U[oe].aliases)for(var $=0;$<U[oe].aliases.length;$++)v.deleteUnit(U[oe].aliases[$])}var j;for(var te in U)Te(U,te)&&(j=v.createUnitSingle(te,U[te]));return j},v.createUnitSingle=function(U,G){if((typeof G=="undefined"||G===null)&&(G={}),typeof U!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Te(q,U))throw new Error('Cannot create unit "'+U+'": a unit with that name already exists');Ce(U);var oe=null,$=[],j=0,te,ve,pe;if(G&&G.type==="Unit")oe=G.clone();else if(typeof G=="string")G!==""&&(te=G);else if(typeof G=="object")te=G.definition,ve=G.prefixes,j=G.offset,pe=G.baseName,G.aliases&&($=G.aliases.valueOf());else throw new TypeError('Cannot create unit "'+U+'" from "'+G.toString()+'": expecting "string" or "Unit" or "Object"');if($){for(var Ne=0;Ne<$.length;Ne++)if(Te(q,$[Ne]))throw new Error('Cannot create alias "'+$[Ne]+'": a unit with that name already exists')}if(te&&typeof te=="string"&&!oe)try{oe=v.parse(te,{allowNoUnits:!0})}catch(De){throw De.message='Could not create unit "'+U+'" from "'+te+'": '+De.message,De}else te&&te.type==="Unit"&&(oe=te.clone());$=$||[],j=j||0,ve&&ve.toUpperCase?ve=T[ve.toUpperCase()]||T.NONE:ve=T.NONE;var ge={};if(oe){ge={name:U,value:oe.value,dimensions:oe.dimensions.slice(0),prefixes:ve,offset:j};var wr=!1;for(var Br in _)if(Te(_,Br)){for(var gt=!0,yt=0;yt<H.length;yt++)if(Math.abs((ge.dimensions[yt]||0)-(_[Br].dimensions[yt]||0))>1e-12){gt=!1;break}if(gt){wr=!0,ge.base=_[Br];break}}if(!wr){pe=pe||U+"_STUFF";var nn={dimensions:oe.dimensions.slice(0)};nn.key=pe,_[pe]=nn,fe[pe]={unit:ge,prefix:T.NONE[""]},ge.base=_[pe]}}else{if(pe=pe||U+"_STUFF",H.indexOf(pe)>=0)throw new Error('Cannot create new base unit "'+U+'": a base unit with that name already exists (and cannot be overridden)');H.push(pe);for(var We in _)Te(_,We)&&(_[We].dimensions[H.length-1]=0);for(var Ke={dimensions:[]},dr=0;dr<H.length;dr++)Ke.dimensions[dr]=0;Ke.dimensions[H.length-1]=1,Ke.key=pe,_[pe]=Ke,ge={name:U,value:1,dimensions:_[pe].dimensions.slice(0),prefixes:ve,offset:j,base:_[pe]},fe[pe]={unit:ge,prefix:T.NONE[""]}}v.UNITS[U]=ge;for(var W=0;W<$.length;W++){var K=$[W],se={};for(var le in ge)Te(ge,le)&&(se[le]=ge[le]);se.name=K,v.UNITS[K]=se}return delete P.cache,new v(null,U)},v.deleteUnit=function(U){delete v.UNITS[U]},v.PREFIXES=T,v.BASE_DIMENSIONS=H,v.BASE_UNITS=_,v.UNIT_SYSTEMS=re,v.UNITS=q,v},{isClass:!0});var zN="unit",rk=["typed","Unit"],bv=A(zN,rk,t=>{var{typed:e,Unit:r}=t;return e(zN,{Unit:function(i){return i.clone()},string:function(i){return r.isValuelessUnit(i)?new r(null,i):r.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new r(i,a)},"number | BigNumber | Fraction":function(i){return new r(i)},"Array | Matrix":e.referToSelf(n=>i=>Oe(i,n))})});var UN="sparse",tk=["typed","SparseMatrix"],wv=A(UN,tk,t=>{var{typed:e,SparseMatrix:r}=t;return e(UN,{"":function(){return new r([])},string:function(i){return new r([],i)},"Array | Matrix":function(i){return new r(i)},"Array | Matrix, string":function(i,a){return new r(i,a)}})});var VN="createUnit",nk=["typed","Unit"],Ev=A(VN,nk,t=>{var{typed:e,Unit:r}=t;return e(VN,{"Object, Object":function(i,a){return r.createUnit(i,a)},Object:function(i){return r.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var c={};return c[i]=a,r.createUnit(c,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,r.createUnit(o,{})},string:function(i){var a={};return a[i]={},r.createUnit(a,{})}})});var $N="acos",ik=["typed","config","Complex"],Cv=A($N,ik,t=>{var{typed:e,config:r,Complex:n}=t;return e($N,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var HN="acosh",ak=["typed","config","Complex"],Nv=A(HN,ak,t=>{var{typed:e,config:r,Complex:n}=t;return e(HN,{number:function(a){return a>=1||r.predictable?Op(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 WN="acot",ok=["typed","BigNumber"],Av=A(WN,ok,t=>{var{typed:e,BigNumber:r}=t;return e(WN,{number:Bp,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var GN="acoth",sk=["typed","config","Complex","BigNumber"],Fv=A(GN,sk,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(GN,{number:function(o){return o>=1||o<=-1||r.predictable?Ip(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var ZN="acsc",uk=["typed","config","Complex","BigNumber"],Sv=A(ZN,uk,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(ZN,{number:function(o){return o<=-1||o>=1||r.predictable?_p(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var jN="acsch",lk=["typed","BigNumber"],Mv=A(jN,lk,t=>{var{typed:e,BigNumber:r}=t;return e(jN,{number:Rp,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var YN="asec",ck=["typed","config","Complex","BigNumber"],Tv=A(YN,ck,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(YN,{number:function(o){return o<=-1||o>=1||r.predictable?Pp(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var JN="asech",fk=["typed","config","Complex","BigNumber"],Ov=A(JN,fk,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(JN,{number:function(o){if(o<=1&&o>=-1||r.predictable){var c=1/o;if(c>0||r.predictable)return Lp(o);var u=Math.sqrt(c*c-1);return new n(Math.log(u-c),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 XN="asin",mk=["typed","config","Complex"],Bv=A(XN,mk,t=>{var{typed:e,config:r,Complex:n}=t;return e(XN,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var pk="asinh",dk=["typed"],Iv=A(pk,dk,t=>{var{typed:e}=t;return e("asinh",{number:kp,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var hk="atan",vk=["typed"],_v=A(hk,vk,t=>{var{typed:e}=t;return e("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var QN="atan2",gk=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Rv=A(QN,gk,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=t,c=mt({typed:e,equalScalar:n}),u=Tr({typed:e}),s=$l({typed:e,equalScalar:n}),l=Dr({typed:e,equalScalar:n}),f=cr({typed:e,DenseMatrix:a}),m=$e({typed:e,matrix:r,concat:o});return e(QN,{"number, number":Math.atan2,"BigNumber, BigNumber":(p,h)=>i.atan2(p,h)},m({scalar:"number | BigNumber",SS:s,DS:u,SD:c,Ss:l,sS:f}))});var KN="atanh",yk=["typed","config","Complex"],Pv=A(KN,yk,t=>{var{typed:e,config:r,Complex:n}=t;return e(KN,{number:function(a){return a<=1&&a>=-1||r.predictable?qp(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var _n=A("trigUnit",["typed"],t=>{var{typed:e}=t;return{Unit:e.referToSelf(r=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(r,n.valueType())(n.value)})}});var eA="cos",xk=["typed"],Lv=A(eA,xk,t=>{var{typed:e}=t,r=_n({typed:e});return e(eA,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var rA="cosh",Dk=["typed"],kv=A(rA,Dk,t=>{var{typed:e}=t;return e(rA,{number:Dl,"Complex | BigNumber":r=>r.cosh()})});var tA="cot",bk=["typed","BigNumber"],qv=A(tA,bk,t=>{var{typed:e,BigNumber:r}=t,n=_n({typed:e});return e(tA,{number:zp,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var nA="coth",wk=["typed","BigNumber"],zv=A(nA,wk,t=>{var{typed:e,BigNumber:r}=t;return e(nA,{number:Up,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var iA="csc",Ek=["typed","BigNumber"],Uv=A(iA,Ek,t=>{var{typed:e,BigNumber:r}=t,n=_n({typed:e});return e(iA,{number:Vp,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var aA="csch",Ck=["typed","BigNumber"],Vv=A(aA,Ck,t=>{var{typed:e,BigNumber:r}=t;return e(aA,{number:$p,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var oA="sec",Nk=["typed","BigNumber"],$v=A(oA,Nk,t=>{var{typed:e,BigNumber:r}=t,n=_n({typed:e});return e(oA,{number:Hp,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var sA="sech",Ak=["typed","BigNumber"],Hv=A(sA,Ak,t=>{var{typed:e,BigNumber:r}=t;return e(sA,{number:Wp,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var uA="sin",Fk=["typed"],Wv=A(uA,Fk,t=>{var{typed:e}=t,r=_n({typed:e});return e(uA,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var lA="sinh",Sk=["typed"],Gv=A(lA,Sk,t=>{var{typed:e}=t;return e(lA,{number:Gp,"Complex | BigNumber":r=>r.sinh()})});var cA="tan",Mk=["typed"],Zv=A(cA,Mk,t=>{var{typed:e}=t,r=_n({typed:e});return e(cA,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var Tk="tanh",Ok=["typed"],jv=A(Tk,Ok,t=>{var{typed:e}=t;return e("tanh",{number:bl,"Complex | BigNumber":r=>r.tanh()})});var fA="setCartesian",Bk=["typed","size","subset","compareNatural","Index","DenseMatrix"],Yv=A(fA,Bk,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(fA,{"Array | Matrix, Array | Matrix":function(u,s){var l=[];if(n(r(u),new a(0))!==0&&n(r(s),new a(0))!==0){var f=Ge(Array.isArray(u)?u:u.toArray()).sort(i),m=Ge(Array.isArray(s)?s:s.toArray()).sort(i);l=[];for(var p=0;p<f.length;p++)for(var h=0;h<m.length;h++)l.push([f[p],m[h]])}return Array.isArray(u)&&Array.isArray(s)?l:new o(l)}})});var mA="setDifference",Ik=["typed","size","subset","compareNatural","Index","DenseMatrix"],Jv=A(mA,Ik,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(mA,{"Array | Matrix, Array | Matrix":function(u,s){var l;if(n(r(u),new a(0))===0)l=[];else{if(n(r(s),new a(0))===0)return Ge(u.toArray());var f=Oi(Ge(Array.isArray(u)?u:u.toArray()).sort(i)),m=Oi(Ge(Array.isArray(s)?s:s.toArray()).sort(i));l=[];for(var p,h=0;h<f.length;h++){p=!1;for(var d=0;d<m.length;d++)if(i(f[h].value,m[d].value)===0&&f[h].identifier===m[d].identifier){p=!0;break}p||l.push(f[h])}}return Array.isArray(u)&&Array.isArray(s)?Mo(l):new o(Mo(l))}})});var pA="setDistinct",_k=["typed","size","subset","compareNatural","Index","DenseMatrix"],Xv=A(pA,_k,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(pA,{"Array | Matrix":function(u){var s;if(n(r(u),new a(0))===0)s=[];else{var l=Ge(Array.isArray(u)?u:u.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(u)?s:new o(s)}})});var dA="setIntersect",Rk=["typed","size","subset","compareNatural","Index","DenseMatrix"],Qv=A(dA,Rk,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(dA,{"Array | Matrix, Array | Matrix":function(u,s){var l;if(n(r(u),new a(0))===0||n(r(s),new a(0))===0)l=[];else{var f=Oi(Ge(Array.isArray(u)?u:u.toArray()).sort(i)),m=Oi(Ge(Array.isArray(s)?s:s.toArray()).sort(i));l=[];for(var p=0;p<f.length;p++)for(var h=0;h<m.length;h++)if(i(f[p].value,m[h].value)===0&&f[p].identifier===m[h].identifier){l.push(f[p]);break}}return Array.isArray(u)&&Array.isArray(s)?Mo(l):new o(Mo(l))}})});var hA="setIsSubset",Pk=["typed","size","subset","compareNatural","Index"],Kv=A(hA,Pk,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(hA,{"Array | Matrix, Array | Matrix":function(c,u){if(n(r(c),new a(0))===0)return!0;if(n(r(u),new a(0))===0)return!1;for(var s=Oi(Ge(Array.isArray(c)?c:c.toArray()).sort(i)),l=Oi(Ge(Array.isArray(u)?u:u.toArray()).sort(i)),f,m=0;m<s.length;m++){f=!1;for(var p=0;p<l.length;p++)if(i(s[m].value,l[p].value)===0&&s[m].identifier===l[p].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var vA="setMultiplicity",Lk=["typed","size","subset","compareNatural","Index"],eg=A(vA,Lk,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(vA,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(c,u){if(n(r(u),new a(0))===0)return 0;for(var s=Ge(Array.isArray(u)?u:u.toArray()),l=0,f=0;f<s.length;f++)i(s[f],c)===0&&l++;return l}})});var gA="setPowerset",kk=["typed","size","subset","compareNatural","Index"],rg=A(gA,kk,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(gA,{"Array | Matrix":function(s){if(n(r(s),new a(0))===0)return[];for(var l=Ge(Array.isArray(s)?s:s.toArray()).sort(i),f=[],m=0;m.toString(2).length<=l.length;)f.push(o(l,m.toString(2).split("").reverse())),m++;return c(f)}});function o(u,s){for(var l=[],f=0;f<s.length;f++)s[f]==="1"&&l.push(u[f]);return l}function c(u){for(var s=[],l=u.length-1;l>0;l--)for(var f=0;f<l;f++)u[f].length>u[f+1].length&&(s=u[f],u[f]=u[f+1],u[f+1]=s);return u}});var yA="setSize",qk=["typed","compareNatural"],tg=A(yA,qk,t=>{var{typed:e,compareNatural:r}=t;return e(yA,{"Array | Matrix":function(i){return Array.isArray(i)?Ge(i).length:Ge(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?Ge(i).length:Ge(i.toArray()).length;for(var o=Ge(Array.isArray(i)?i:i.toArray()).sort(r),c=1,u=1;u<o.length;u++)r(o[u],o[u-1])!==0&&c++;return c}})});var xA="setSymDifference",zk=["typed","size","concat","subset","setDifference","Index"],ng=A(xA,zk,t=>{var{typed:e,size:r,concat:n,subset:i,setDifference:a,Index:o}=t;return e(xA,{"Array | Matrix, Array | Matrix":function(u,s){if(i(r(u),new o(0))===0)return Ge(s);if(i(r(s),new o(0))===0)return Ge(u);var l=Ge(u),f=Ge(s);return n(a(l,f),a(f,l))}})});var DA="setUnion",Uk=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],ig=A(DA,Uk,t=>{var{typed:e,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:c}=t;return e(DA,{"Array | Matrix, Array | Matrix":function(s,l){if(i(r(s),new c(0))===0)return Ge(l);if(i(r(l),new c(0))===0)return Ge(s);var f=Ge(s),m=Ge(l);return n(o(f,m),a(f,m))}})});var bA="add",Vk=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],ag=A(bA,Vk,t=>{var{typed:e,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:c}=t,u=$t({typed:e}),s=_o({typed:e,equalScalar:i}),l=en({typed:e,DenseMatrix:a}),f=$e({typed:e,matrix:r,concat:c});return e(bA,{"any, any":n,"any, any, ...any":e.referToSelf(m=>(p,h,d)=>{for(var g=m(p,h),D=0;D<d.length;D++)g=m(g,d[D]);return g})},f({elop:n,DS:u,SS:s,Ss:l}))});var wA="hypot",$k=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],og=A(wA,$k,t=>{var{typed:e,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:c,isPositive:u}=t;return e(wA,{"... number | BigNumber":s,Array:s,Matrix:l=>s(Ge(l.toArray()))});function s(l){for(var f=0,m=0,p=0;p<l.length;p++){if(Wt(l[p]))throw new TypeError("Unexpected type of argument to hypot");var h=r(l[p]);c(m,h)?(f=a(f,a(i(m,h),i(m,h))),f=n(f,1),m=h):f=n(f,u(h)?a(i(h,m),i(h,m)):h)}return a(m,o(f))}});var EA="norm",Hk=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],sg=A(EA,Hk,t=>{var{typed:e,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:c,equalScalar:u,larger:s,smaller:l,matrix:f,ctranspose:m,eigs:p}=t;return e(EA,{number:Math.abs,Complex:function(F){return F.abs()},BigNumber:function(F){return F.abs()},boolean:function(F){return Math.abs(F)},Array:function(F){return y(f(F),2)},Matrix:function(F){return y(F,2)},"Array, number | BigNumber | string":function(F,S){return y(f(F),S)},"Matrix, number | BigNumber | string":function(F,S){return y(F,S)}});function h(E){var F=0;return E.forEach(function(S){var C=r(S);s(C,F)&&(F=C)},!0),F}function d(E){var F;return E.forEach(function(S){var C=r(S);(!F||l(C,F))&&(F=C)},!0),F||0}function g(E,F){if(F===Number.POSITIVE_INFINITY||F==="inf")return h(E);if(F===Number.NEGATIVE_INFINITY||F==="-inf")return d(E);if(F==="fro")return y(E,2);if(typeof F=="number"&&!isNaN(F)){if(!u(F,0)){var S=0;return E.forEach(function(C){S=n(i(r(C),F),S)},!0),i(S,1/F)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function D(E){var F=0;return E.forEach(function(S,C){F=n(F,c(S,a(S)))}),r(o(F))}function N(E){var F=[],S=0;return E.forEach(function(C,B){var I=B[1],L=n(F[I]||0,r(C));s(L,S)&&(S=L),F[I]=L},!0),S}function v(E){var F=E.size();if(F[0]!==F[1])throw new RangeError("Invalid matrix dimensions");var S=m(E),C=c(S,E),B=p(C).values.toArray(),I=B[B.length-1];return r(o(I))}function w(E){var F=[],S=0;return E.forEach(function(C,B){var I=B[0],L=n(F[I]||0,r(C));s(L,S)&&(S=L),F[I]=L},!0),S}function b(E,F){if(F===1)return N(E);if(F===Number.POSITIVE_INFINITY||F==="inf")return w(E);if(F==="fro")return D(E);if(F===2)return v(E);throw new Error("Unsupported parameter value "+F)}function y(E,F){var S=E.size();if(S.length===1)return g(E,F);if(S.length===2){if(S[0]&&S[1])return b(E,F);throw new RangeError("Invalid matrix dimensions")}}});var CA="dot",Wk=["typed","addScalar","multiplyScalar","conj","size"],ug=A(CA,Wk,t=>{var{typed:e,addScalar:r,multiplyScalar:n,conj:i,size:a}=t;return e(CA,{"Array | DenseMatrix, Array | DenseMatrix":c,"SparseMatrix, SparseMatrix":u});function o(l,f){var m=s(l),p=s(f),h,d;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(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(h!==d)throw new RangeError("Vectors must have equal length ("+h+" != "+d+")");if(h===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return h}function c(l,f){var m=o(l,f),p=Fe(l)?l._data:l,h=Fe(l)?l._datatype:void 0,d=Fe(f)?f._data:f,g=Fe(f)?f._datatype:void 0,D=s(l).length===2,N=s(f).length===2,v=r,w=n;if(h&&g&&h===g&&typeof h=="string"){var b=h;v=e.find(r,[b,b]),w=e.find(n,[b,b])}if(!D&&!N){for(var y=w(i(p[0]),d[0]),E=1;E<m;E++)y=v(y,w(i(p[E]),d[E]));return y}if(!D&&N){for(var F=w(i(p[0]),d[0][0]),S=1;S<m;S++)F=v(F,w(i(p[S]),d[S][0]));return F}if(D&&!N){for(var C=w(i(p[0][0]),d[0]),B=1;B<m;B++)C=v(C,w(i(p[B][0]),d[B]));return C}if(D&&N){for(var I=w(i(p[0][0]),d[0][0]),L=1;L<m;L++)I=v(I,w(i(p[L][0]),d[L][0]));return I}}function u(l,f){o(l,f);for(var m=l._index,p=l._values,h=f._index,d=f._values,g=0,D=r,N=n,v=0,w=0;v<m.length&&w<h.length;){var b=m[v],y=h[w];if(b<y){v++;continue}if(b>y){w++;continue}b===y&&(g=D(g,N(p[v],d[w])),v++,w++)}return g}function s(l){return Fe(l)?l.size():a(l)}});var Gk="trace",Zk=["typed","matrix","add"],lg=A(Gk,Zk,t=>{var{typed:e,matrix:r,add:n}=t;return e("trace",{Array:function(c){return i(r(c))},SparseMatrix:a,DenseMatrix:i,any:Ie});function i(o){var c=o._size,u=o._data;switch(c.length){case 1:if(c[0]===1)return Ie(u[0]);throw new RangeError("Matrix must be square (size: "+qe(c)+")");case 2:{var s=c[0],l=c[1];if(s===l){for(var f=0,m=0;m<s;m++)f=n(f,u[m][m]);return f}else throw new RangeError("Matrix must be square (size: "+qe(c)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+qe(c)+")")}}function a(o){var c=o._values,u=o._index,s=o._ptr,l=o._size,f=l[0],m=l[1];if(f===m){var p=0;if(c.length>0)for(var h=0;h<m;h++)for(var d=s[h],g=s[h+1],D=d;D<g;D++){var N=u[D];if(N===h){p=n(p,c[D]);break}if(N>h)break}return p}throw new RangeError("Matrix must be square (size: "+qe(l)+")")}});var NA="index",jk=["typed","Index"],cg=A(NA,jk,t=>{var{typed:e,Index:r}=t;return e(NA,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(c){return Le(c)?c.toNumber():Array.isArray(c)||Fe(c)?c.map(function(u){return Le(u)?u.toNumber():u}):c}),o=new r;return r.apply(o,a),o}})});var rc=new Set(["end"]);var Yk="Node",Jk=["mathWithTransform"],fg=A(Yk,Jk,t=>{var{mathWithTransform:e}=t;function r(i){for(var a of[...rc])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={},c=null;function u(s){var l=Bi(s);return r(l),a(l,o,c)}return{evaluate:u}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!er(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(c,u){c.forEach(function(s,l,f){u(s,l,f),o(s,u)})}o(this,a)}transform(a){function o(c,u,s){var l=a(c,u,s);return l!==c?l:c.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(c,u,s){a(c,u,s)&&o.push(c)}),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&&Zi(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toString(a)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this.toHTML(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function Or(t){return t&&t.isIndexError?new Pt(t.index+1,t.min+1,t.max!==void 0?t.max+1:void 0):t}function tc(t){var{subset:e}=t;return function(n,i){try{if(Array.isArray(n))return e(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return e(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return rt(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Or(a)}}}var nc="AccessorNode",Xk=["subset","Node"],mg=A(nc,Xk,t=>{var{subset:e,Node:r}=t,n=tc({subset:e});function i(o){return!(pn(o)||_t(o)||Xe(o)||Gt(o)||Gi(o)||Rt(o)||Mr(o))}class a extends r{constructor(c,u){if(super(),!er(c))throw new TypeError('Node expected for parameter "object"');if(!Mn(u))throw new TypeError('IndexNode expected for parameter "index"');this.object=c,this.index=u}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return nc}get isAccessorNode(){return!0}_compile(c,u){var s=this.object._compile(c,u),l=this.index._compile(c,u);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(p,h,d){return rt(s(p,h,d),f)}}else return function(p,h,d){var g=s(p,h,d),D=l(p,h,g);return n(g,D)}}forEach(c){c(this.object,"object",this),c(this.index,"index",this)}map(c){return new a(this._ifNode(c(this.object,"object",this)),this._ifNode(c(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(c){var u=this.object.toString(c);return i(this.object)&&(u="("+u+")"),u+this.index.toString(c)}toHTML(c){var u=this.object.toHTML(c);return i(this.object)&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+this.index.toHTML(c)}_toTex(c){var u=this.object.toTex(c);return i(this.object)&&(u="\\left(' + object + '\\right)"),u+this.index.toTex(c)}toJSON(){return{mathjs:nc,object:this.object,index:this.index}}static fromJSON(c){return new a(c.object,c.index)}}return hr(a,"name",nc),a},{isClass:!0,isNode:!0});var ic="ArrayNode",Qk=["Node"],pg=A(ic,Qk,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(er))throw new TypeError("Array containing Nodes expected")}get type(){return ic}get isArrayNode(){return!0}_compile(i,a){var o=Xt(this.items,function(s){return s._compile(i,a)}),c=i.config.matrix!=="Array";if(c){var u=i.matrix;return function(l,f,m){return u(Xt(o,function(p){return p(l,f,m)}))}}else return function(l,f,m){return Xt(o,function(p){return p(l,f,m)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new r(a)}clone(){return new r(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:ic,items:this.items}}static fromJSON(i){return new r(i.items)}toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,c){var u=o.some(_t)&&!o.every(_t),s=c||u,l=s?"&":"\\\\",f=o.map(function(m){return m.items?a(m.items,!c):m.toTex(i)}).join(l);return u||!s||s&&!c?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return hr(r,"name",ic),r},{isClass:!0,isNode:!0});function AA(t){var{subset:e,matrix:r}=t;return function(i,a,o){try{if(Array.isArray(i))return r(i).subset(a,o).valueOf();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 gi(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(c){throw Or(c)}}}var Rn=[{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 ac(t,e){if(!e||e!=="auto")return t;for(var r=t;Rt(r);)r=r.content;return r}function vr(t,e,r,n){var i=t;e!=="keep"&&(i=t.getContent());for(var a=i.getIdentifier(),o=null,c=0;c<Rn.length;c++)if(a in Rn[c]){o=c;break}if(a==="OperatorNode:multiply"&&i.implicit&&r!=="show"){var u=ac(i.args[0],e);!(Xe(u)&&n&&n.getIdentifier()==="OperatorNode:divide"&&Bs(ac(n.args[0],e)))&&!(u.getIdentifier()==="OperatorNode:divide"&&Bs(ac(u.args[0],e))&&Xe(ac(u.args[1])))&&(o+=1)}return o}function Uo(t,e){var r=t;e!=="keep"&&(r=t.getContent());var n=r.getIdentifier(),i=vr(r,e);if(i===null)return null;var a=Rn[i][n];if(Te(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 oc(t,e,r){var n=r!=="keep"?t.getContent():t,i=r!=="keep"?t.getContent():e,a=n.getIdentifier(),o=i.getIdentifier(),c=vr(n,r);if(c===null)return null;var u=Rn[c][a];if(Te(u,"associativeWith")&&u.associativeWith instanceof Array){for(var s=0;s<u.associativeWith.length;s++)if(u.associativeWith[s]===o)return!0;return!1}return null}function FA(t){var e="OperatorNode:"+t;for(var r of Rn)if(e in r)return r[e].op;return null}var sc="AssignmentNode",Kk=["subset","?matrix","Node"],dg=A(sc,Kk,t=>{var{subset:e,matrix:r,Node:n}=t,i=tc({subset:e}),a=AA({subset:e,matrix:r});function o(u,s,l){s||(s="keep");var f=vr(u,s,l),m=vr(u.value,s,l);return s==="all"||m!==null&&m<=f}class c extends n{constructor(s,l,f){if(super(),this.object=s,this.index=f?l:null,this.value=f||l,!Mr(s)&&!pn(s))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Mr(s)&&s.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!Mn(this.index))throw new TypeError('IndexNode expected as "index"');if(!er(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 sc}get isAssignmentNode(){return!0}_compile(s,l){var f=this.object._compile(s,l),m=this.index?this.index._compile(s,l):null,p=this.value._compile(s,l),h=this.object.name;if(this.index)if(this.index.isObjectProperty()){var d=this.index.getObjectProperty();return function(w,b,y){var E=f(w,b,y),F=p(w,b,y);return gi(E,d,F),F}}else{if(Mr(this.object))return function(w,b,y){var E=f(w,b,y),F=p(w,b,y),S=m(w,b,E);return w.set(h,a(E,S,F)),F};var g=this.object.object._compile(s,l);if(this.object.index.isObjectProperty()){var D=this.object.index.getObjectProperty();return function(w,b,y){var E=g(w,b,y),F=rt(E,D),S=m(w,b,F),C=p(w,b,y);return gi(E,D,a(F,S,C)),C}}else{var N=this.object.index._compile(s,l);return function(w,b,y){var E=g(w,b,y),F=N(w,b,E),S=i(E,F),C=m(w,b,S),B=p(w,b,y);return a(E,F,a(S,C,B)),B}}}else{if(!Mr(this.object))throw new TypeError("SymbolNode expected as object");return function(w,b,y){var E=p(w,b,y);return w.set(h,E),E}}}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,m=this._ifNode(s(this.value,"value",this));return new c(l,f,m)}clone(){return new c(this.object,this.index,this.value)}_toString(s){var l=this.object.toString(s),f=this.index?this.index.toString(s):"",m=this.value.toString(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(m="("+m+")"),l+f+" = "+m}toJSON(){return{mathjs:sc,object:this.object,index:this.index,value:this.value}}static fromJSON(s){return new c(s.object,s.index,s.value)}toHTML(s){var l=this.object.toHTML(s),f=this.index?this.index.toHTML(s):"",m=this.value.toHTML(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(m='<span class="math-paranthesis math-round-parenthesis">(</span>'+m+'<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>'+m}_toTex(s){var l=this.object.toTex(s),f=this.index?this.index.toTex(s):"",m=this.value.toTex(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(m="\\left(".concat(m,"\\right)")),l+f+":="+m}}return hr(c,"name",sc),c},{isClass:!0,isNode:!0});var uc="BlockNode",eq=["ResultSet","Node"],hg=A(uc,eq,t=>{var{ResultSet:e,Node:r}=t;class n extends r{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var c=o&&o.node,u=o&&o.visible!==void 0?o.visible:!0;if(!er(c))throw new TypeError('Property "node" must be a Node');if(typeof u!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:c,visible:u}})}get type(){return uc}get isBlockNode(){return!0}_compile(a,o){var c=Xt(this.blocks,function(u){return{evaluate:u.node._compile(a,o),visible:u.visible}});return function(s,l,f){var m=[];return ji(c,function(h){var d=h.evaluate(s,l,f);h.visible&&m.push(d)}),new e(m)}}forEach(a){for(var o=0;o<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],c=0;c<this.blocks.length;c++){var u=this.blocks[c],s=this._ifNode(a(u.node,"blocks["+c+"].node",this));o[c]={node:s,visible:u.visible}}return new n(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new n(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
`)}toJSON(){return{mathjs:uc,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 hr(n,"name",uc),n},{isClass:!0,isNode:!0});var lc="ConditionalNode",rq=["Node"],vg=A(lc,rq,t=>{var{Node:e}=t;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(Le(i))return!i.isZero();if(Wt(i))return!!(i.re||i.im);if(mn(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+nr(i)+'"')}class n extends e{constructor(a,o,c){if(super(),!er(a))throw new TypeError("Parameter condition must be a Node");if(!er(o))throw new TypeError("Parameter trueExpr must be a Node");if(!er(c))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=c}get type(){return lc}get isConditionalNode(){return!0}_compile(a,o){var c=this.condition._compile(a,o),u=this.trueExpr._compile(a,o),s=this.falseExpr._compile(a,o);return function(f,m,p){return r(c(f,m,p))?u(f,m,p):s(f,m,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",c=vr(this,o,a&&a.implicit),u=this.condition.toString(a),s=vr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=c)&&(u="("+u+")");var l=this.trueExpr.toString(a),f=vr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=c)&&(l="("+l+")");var m=this.falseExpr.toString(a),p=vr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=c)&&(m="("+m+")"),u+" ? "+l+" : "+m}toJSON(){return{mathjs:lc,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",c=vr(this,o,a&&a.implicit),u=this.condition.toHTML(a),s=vr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=c)&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>');var l=this.trueExpr.toHTML(a),f=vr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=c)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var m=this.falseExpr.toHTML(a),p=vr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=c)&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+'<span class="math-operator math-conditional-operator">?</span>'+l+'<span class="math-operator math-conditional-operator">:</span>'+m}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return hr(n,"name",lc),n},{isClass:!0,isNode:!0});var OA=Yt(MA(),1);var yg={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{?}"},pr={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"},xg={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(pr.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(pr.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(pr.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(pr.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(pr.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(pr.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(pr.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(pr.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(pr.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(pr.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(pr.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(pr.bitAnd,"${args[1]}\\right)")},bitNot:{1:pr.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(pr.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(pr.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(pr.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(pr.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(pr.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(pr.and,"${args[1]}\\right)")},not:{1:pr.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(pr.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(pr.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(pr.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(pr.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(pr.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(pr.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(pr.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(pr.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(pr.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(pr.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(pr.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(pr.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(pr.to,"${args[1]}\\right)")},numeric:function(e,r){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(yg.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)"}},BA="\\mathrm{${name}}\\left(${args}\\right)",TA={deg:"^\\circ"};function cc(t){return(0,OA.default)(t,{preserveFormatting:!0})}function fc(t,e){return e=typeof e=="undefined"?!1:e,e?Te(TA,t)?TA[t]:"\\mathrm{"+cc(t)+"}":Te(yg,t)?yg[t]:cc(t)}var mc="ConstantNode",aq=["Node"],Dg=A(mc,aq,t=>{var{Node:e}=t;class r extends e{constructor(i){super(),this.value=i}get type(){return mc}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new r(this.value)}_toString(i){return qe(this.value,i)}toHTML(i){var a=this._toString(i);switch(nr(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:mc,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i);switch(nr(this.value)){case"string":return"\\mathtt{"+cc(a)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var o=a.toLowerCase().indexOf("e");if(o!==-1)return a.substring(0,o)+"\\cdot10^{"+a.substring(o+1)+"}"}return a;case"Fraction":return this.value.toLatex();default:return a}}}return hr(r,"name",mc),r},{isClass:!0,isNode:!0});var pc="FunctionAssignmentNode",oq=["typed","Node"],bg=A(pc,oq,t=>{var{typed:e,Node:r}=t;function n(a,o,c){var u=vr(a,o,c),s=vr(a.expr,o,c);return o==="all"||s!==null&&s<=u}class i extends r{constructor(o,c,u){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(c))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!er(u))throw new TypeError('Node expected for parameter "expr"');if(rc.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var s=new Set;for(var l of c){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=c.map(function(m){return m&&m.name||m}),this.types=c.map(function(m){return m&&m.type||"any"}),this.expr=u}get type(){return pc}get isFunctionAssignmentNode(){return!0}_compile(o,c){var u=Object.create(c);ji(this.params,function(h){u[h]=!0});var s=this.expr._compile(o,u),l=this.name,f=this.params,m=Sm(this.types,","),p=l+"("+Sm(this.params,", ")+")";return function(d,g,D){var N={};N[m]=function(){for(var w=Object.create(g),b=0;b<f.length;b++)w[f[b]]=arguments[b];return s(d,w,D)};var v=e(l,N);return v.syntax=p,d.set(l,v),v}}forEach(o){o(this.expr,"expr",this)}map(o){var c=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),c)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var c=o&&o.parenthesis?o.parenthesis:"keep",u=this.expr.toString(o);return n(this,c,o&&o.implicit)&&(u="("+u+")"),this.name+"("+this.params.join(", ")+") = "+u}toJSON(){var o=this.types;return{mathjs:pc,name:this.name,params:this.params.map(function(c,u){return{name:c,type:o[u]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}toHTML(o){for(var c=o&&o.parenthesis?o.parenthesis:"keep",u=[],s=0;s<this.params.length;s++)u.push('<span class="math-symbol math-parameter">'+Ct(this.params[s])+"</span>");var l=this.expr.toHTML(o);return n(this,c,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">'+Ct(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+u.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+l}_toTex(o){var c=o&&o.parenthesis?o.parenthesis:"keep",u=this.expr.toTex(o);return n(this,c,o&&o.implicit)&&(u="\\left(".concat(u,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(fc).join(",")+"\\right):="+u}}return hr(i,"name",pc),i},{isClass:!0,isNode:!0});var dc="IndexNode",sq=["Node","size"],wg=A(dc,sq,t=>{var{Node:e,size:r}=t;class n extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(er))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 dc}get isIndexNode(){return!0}_compile(a,o){var c=Xt(this.dimensions,function(s,l){var f=s.filter(h=>h.isSymbolNode&&h.name==="end").length>0;if(f){var m=Object.create(o);m.end=!0;var p=s._compile(a,m);return function(d,g,D){if(!Fe(D)&&!lr(D)&&!lt(D))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+nr(D));var N=r(D).valueOf(),v=Object.create(g);return v.end=N[l],p(d,v,D)}}else return s._compile(a,o)}),u=rt(a,"index");return function(l,f,m){var p=Xt(c,function(h){return h(l,f,m)});return u(...p)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],c=0;c<this.dimensions.length;c++)o[c]=this._ifNode(a(this.dimensions[c],"dimensions["+c+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&Xe(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:dc,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}toHTML(a){for(var o=[],c=0;c<this.dimensions.length;c++)o[c]=this.dimensions[c].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Ct(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(c){return c.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return hr(n,"name",dc),n},{isClass:!0,isNode:!0});var hc="ObjectNode",uq=["Node"],Eg=A(hc,uq,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return er(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return hc}get isObjectNode(){return!0}_compile(i,a){var o={};for(var c in this.properties)if(Te(this.properties,c)){var u=Is(c),s=JSON.parse(u);if(!Al(this.properties,s))throw new Error('No access to property "'+s+'"');o[s]=this.properties[c]._compile(i,a)}return function(f,m,p){var h={};for(var d in o)Te(o,d)&&(h[d]=o[d](f,m,p));return h}}forEach(i){for(var a in this.properties)Te(this.properties,a)&&i(this.properties[a],"properties["+Is(a)+"]",this)}map(i){var a={};for(var o in this.properties)Te(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Is(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)Te(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)Te(this.properties,o)&&a.push(Is(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:hc,properties:this.properties}}static fromJSON(i){return new r(i.properties)}toHTML(i){var a=[];for(var o in this.properties)Te(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Ct(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)Te(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var c="\\left\\{\\begin{array}{ll}"+a.join(`
`)+"\\end{array}\\right\\}";return c}}return hr(r,"name",hc),r},{isClass:!0,isNode:!0});var vc="OperatorNode",lq=["Node"],Cg=A(vc,lq,t=>{var{Node:e}=t;function r(a,o){var c=a;if(o==="auto")for(;Rt(c);)c=c.content;return Xe(c)?!0:Rr(c)?r(c.args[0],o):!1}function n(a,o,c,u,s){var l=vr(a,o,c),f=Uo(a,o);if(o==="all"||u.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return u.map(function(C){switch(C.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var m;switch(u.length){case 0:m=[];break;case 1:{var p=vr(u[0],o,c,a);if(s&&p!==null){var h,d;if(o==="keep"?(h=u[0].getIdentifier(),d=a.getIdentifier()):(h=u[0].getContent().getIdentifier(),d=a.getContent().getIdentifier()),Rn[l][d].latexLeftParens===!1){m=[!1];break}if(Rn[p][h].latexParens===!1){m=[!1];break}}if(p===null){m=[!1];break}if(p<=l){m=[!0];break}m=[!1]}break;case 2:{var g,D=vr(u[0],o,c,a),N=oc(a,u[0],o);D===null?g=!1:D===l&&f==="right"&&!N||D<l?g=!0:g=!1;var v,w=vr(u[1],o,c,a),b=oc(a,u[1],o);if(w===null?v=!1:w===l&&f==="left"&&!b||w<l?v=!0:v=!1,s){var y,E,F;o==="keep"?(y=a.getIdentifier(),E=a.args[0].getIdentifier(),F=a.args[1].getIdentifier()):(y=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),F=a.args[1].getContent().getIdentifier()),D!==null&&(Rn[l][y].latexLeftParens===!1&&(g=!1),Rn[D][E].latexParens===!1&&(g=!1)),w!==null&&(Rn[l][y].latexRightParens===!1&&(v=!1),Rn[w][F].latexParens===!1&&(v=!1))}m=[g,v]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(m=u.map(function(C){var B=vr(C,o,c,a),I=oc(a,C,o),L=Uo(C,o);return B===null?!1:l===B&&f===L&&!I?!0:B<l}));break}if(u.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&c==="hide")for(var S=1;S<m.length;++S)r(u[S],o)&&!m[S-1]&&(o!=="keep"||!Rt(u[S-1]))&&(m[S]=!0);return m}class i extends e{constructor(o,c,u,s,l){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof c!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(u)||!u.every(er))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=s===!0,this.isPercentage=l===!0,this.op=o,this.fn=c,this.args=u||[]}get type(){return vc}get isOperatorNode(){return!0}_compile(o,c){if(typeof this.fn!="string"||!Fl(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var u=rt(o,this.fn),s=Xt(this.args,function(p){return p._compile(o,c)});if(s.length===1){var l=s[0];return function(h,d,g){return u(l(h,d,g))}}else if(s.length===2){var f=s[0],m=s[1];return function(h,d,g){return u(f(h,d,g),m(h,d,g))}}else return function(h,d,g){return u.apply(null,Xt(s,function(D){return D(h,d,g)}))}}forEach(o){for(var c=0;c<this.args.length;c++)o(this.args[c],"args["+c+"]",this)}map(o){for(var c=[],u=0;u<this.args.length;u++)c[u]=this._ifNode(o(this.args[u],"args["+u+"]",this));return new i(this.op,this.fn,c,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 c=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,l=n(this,c,u,s,!1);if(s.length===1){var f=Uo(this,c),m=s[0].toString(o);l[0]&&(m="("+m+")");var p=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(p?" ":"")+m:f==="left"?m+(p?" ":"")+this.op:m+this.op}else if(s.length===2){var h=s[0].toString(o),d=s[1].toString(o);return l[0]&&(h="("+h+")"),l[1]&&(d="("+d+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?h+" "+d:h+" "+this.op+" "+d}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=s.map(function(D,N){return D=D.toString(o),l[N]&&(D="("+D+")"),D});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?g.join(" "):g.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:vc,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 c=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,l=n(this,c,u,s,!1);if(s.length===1){var f=Uo(this,c),m=s[0].toHTML(o);return l[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Ct(this.op)+"</span>"+m:m+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Ct(this.op)+"</span>"}else if(s.length===2){var p=s[0].toHTML(o),h=s[1].toHTML(o);return l[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l[1]&&(h='<span class="math-parenthesis math-round-parenthesis">(</span>'+h+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?p+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+h:p+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ct(this.op)+"</span>"+h}else{var d=s.map(function(g,D){return g=g.toHTML(o),l[D]&&(g='<span class="math-parenthesis math-round-parenthesis">(</span>'+g+'<span class="math-parenthesis math-round-parenthesis">)</span>'),g});return s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?d.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):d.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ct(this.op)+"</span>"):'<span class="math-function">'+Ct(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+d.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var c=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,l=n(this,c,u,s,!0),f=pr[this.fn];if(f=typeof f=="undefined"?this.op:f,s.length===1){var m=Uo(this,c),p=s[0].toTex(o);return l[0]&&(p="\\left(".concat(p,"\\right)")),m==="right"?f+p:p+f}else if(s.length===2){var h=s[0],d=h.toTex(o);l[0]&&(d="\\left(".concat(d,"\\right)"));var g=s[1],D=g.toTex(o);l[1]&&(D="\\left(".concat(D,"\\right)"));var N;switch(c==="keep"?N=h.getIdentifier():N=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+d+"}{"+D+"}";case"OperatorNode:pow":switch(d="{"+d+"}",D="{"+D+"}",N){case"ConditionalNode":case"OperatorNode:divide":d="\\left(".concat(d,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&u==="hide")return d+"~"+D}return d+f+D}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=s.map(function(w,b){return w=w.toTex(o),l[b]&&(w="\\left(".concat(w,"\\right)")),w});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&u==="hide"?v.join("~"):v.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+s.map(function(w){return w.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return hr(i,"name",vc),i},{isClass:!0,isNode:!0});var gc="ParenthesisNode",cq=["Node"],Ng=A(gc,cq,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),!er(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return gc}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new r(a)}clone(){return new r(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:gc,content:this.content}}static fromJSON(i){return new r(i.content)}toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return hr(r,"name",gc),r},{isClass:!0,isNode:!0});var yc="RangeNode",fq=["Node"],Ag=A(yc,fq,t=>{var{Node:e}=t;function r(i,a,o){var c=vr(i,a,o),u={},s=vr(i.start,a,o);if(u.start=s!==null&&s<=c||a==="all",i.step){var l=vr(i.step,a,o);u.step=l!==null&&l<=c||a==="all"}var f=vr(i.end,a,o);return u.end=f!==null&&f<=c||a==="all",u}class n extends e{constructor(a,o,c){if(super(),!er(a))throw new TypeError("Node expected");if(!er(o))throw new TypeError("Node expected");if(c&&!er(c))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=c||null}get type(){return yc}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Mr(o)&&o.name==="end"});return a.length>0}_compile(a,o){var c=a.range,u=this.start._compile(a,o),s=this.end._compile(a,o);if(this.step){var l=this.step._compile(a,o);return function(m,p,h){return c(u(m,p,h),s(m,p,h),l(m,p,h))}}else return function(m,p,h){return c(u(m,p,h),s(m,p,h))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new n(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",c=r(this,o,a&&a.implicit),u,s=this.start.toString(a);if(c.start&&(s="("+s+")"),u=s,this.step){var l=this.step.toString(a);c.step&&(l="("+l+")"),u+=":"+l}var f=this.end.toString(a);return c.end&&(f="("+f+")"),u+=":"+f,u}toJSON(){return{mathjs:yc,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",c=r(this,o,a&&a.implicit),u,s=this.start.toHTML(a);if(c.start&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u=s,this.step){var l=this.step.toHTML(a);c.step&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+='<span class="math-operator math-range-operator">:</span>'+l}var f=this.end.toHTML(a);return c.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+='<span class="math-operator math-range-operator">:</span>'+f,u}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",c=r(this,o,a&&a.implicit),u=this.start.toTex(a);if(c.start&&(u="\\left(".concat(u,"\\right)")),this.step){var s=this.step.toTex(a);c.step&&(s="\\left(".concat(s,"\\right)")),u+=":"+s}var l=this.end.toTex(a);return c.end&&(l="\\left(".concat(l,"\\right)")),u+=":"+l,u}}return hr(n,"name",yc),n},{isClass:!0,isNode:!0});var xc="RelationalNode",mq=["Node"],Fg=A(xc,mq,t=>{var{Node:e}=t,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends e{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return xc}get isRelationalNode(){return!0}_compile(a,o){var c=this,u=this.params.map(s=>s._compile(a,o));return function(l,f,m){for(var p,h=u[0](l,f,m),d=0;d<c.conditionals.length;d++){p=h,h=u[d+1](l,f,m);var g=rt(a,c.conditionals[d]);if(!g(p,h))return!1}return!0}}forEach(a){this.params.forEach((o,c)=>a(o,"params["+c+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,c)=>this._ifNode(a(o,"params["+c+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",c=vr(this,o,a&&a.implicit),u=this.params.map(function(f,m){var p=vr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=c?"("+f.toString(a)+")":f.toString(a)}),s=u[0],l=0;l<this.conditionals.length;l++)s+=" "+r[this.conditionals[l]],s+=" "+u[l+1];return s}toJSON(){return{mathjs:xc,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",c=vr(this,o,a&&a.implicit),u=this.params.map(function(f,m){var p=vr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=c?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),s=u[0],l=0;l<this.conditionals.length;l++)s+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ct(r[this.conditionals[l]])+"</span>"+u[l+1];return s}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",c=vr(this,o,a&&a.implicit),u=this.params.map(function(f,m){var p=vr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=c?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),s=u[0],l=0;l<this.conditionals.length;l++)s+=pr[this.conditionals[l]]+u[l+1];return s}}return hr(n,"name",xc),n},{isClass:!0,isNode:!0});var pq="SymbolNode",dq=["math","?Unit","Node"],Sg=A(pq,dq,t=>{var{math:e,Unit:r,Node:n}=t;function i(o){return r?r.isValuelessUnit(o):!1}class a extends n{constructor(c){if(super(),typeof c!="string")throw new TypeError('String expected for parameter "name"');this.name=c}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(c,u){var s=this.name;if(u[s]===!0)return function(f,m,p){return m[s]};if(s in c)return function(f,m,p){return f.has(s)?f.get(s):rt(c,s)};var l=i(s);return function(f,m,p){return f.has(s)?f.get(s):l?new r(null,s):a.onUndefinedSymbol(s)}}forEach(c){}map(c){return this.clone()}static onUndefinedSymbol(c){throw new Error("Undefined symbol "+c)}clone(){return new a(this.name)}_toString(c){return this.name}toHTML(c){var u=Ct(this.name);return u==="true"||u==="false"?'<span class="math-symbol math-boolean">'+u+"</span>":u==="i"?'<span class="math-symbol math-imaginary-symbol">'+u+"</span>":u==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+u+"</span>":u==="NaN"?'<span class="math-symbol math-nan-symbol">'+u+"</span>":u==="null"?'<span class="math-symbol math-null-symbol">'+u+"</span>":u==="undefined"?'<span class="math-symbol math-undefined-symbol">'+u+"</span>":'<span class="math-symbol">'+u+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(c){return new a(c.name)}_toTex(c){var u=!1;typeof e[this.name]=="undefined"&&i(this.name)&&(u=!0);var s=fc(this.name,u);return s[0]==="\\"?s:" "+s}}return a},{isClass:!0,isNode:!0});function Ra(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return typeof t.createSubScope=="function"?Mm(t.createSubScope(),...r):Mm(yi(),t,...r)}var Dc="FunctionNode",hq=["math","Node","SymbolNode"],Mg=A(Dc,hq,t=>{var{math:e,Node:r,SymbolNode:n}=t,i=c=>qe(c,{truncate:78});function a(c,u,s){for(var l="",f=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,p;(p=f.exec(c))!==null;)if(l+=c.substring(m,p.index),m=p.index,p[0]==="$$")l+="$",m++;else{m+=p[0].length;var h=u[p[1]];if(!h)throw new ReferenceError("Template: Property "+p[1]+" does not exist.");if(p[2]===void 0)switch(typeof h){case"string":l+=h;break;case"object":if(er(h))l+=h.toTex(s);else if(Array.isArray(h))l+=h.map(function(d,g){if(er(d))return d.toTex(s);throw new TypeError("Template: "+p[1]+"["+g+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+p[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+p[1]+" has to be a Node, String or array of Nodes")}else if(er(h[p[2]]&&h[p[2]]))l+=h[p[2]].toTex(s);else throw new TypeError("Template: "+p[1]+"["+p[2]+"] is not a Node.")}return l+=c.slice(m),l}class o extends r{constructor(u,s){if(super(),typeof u=="string"&&(u=new n(u)),!er(u))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(s)||!s.every(er))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=u,this.args=s||[]}get name(){return this.fn.name||""}get type(){return Dc}get isFunctionNode(){return!0}_compile(u,s){var l=this.args.map(E=>E._compile(u,s));if(Mr(this.fn)){var f=this.fn.name;if(s[f]){var g=this.args;return function(F,S,C){var B=S[f];if(typeof B!="function")throw new TypeError("Argument '".concat(f,"' was not a function; received: ").concat(i(B)));if(B.rawArgs)return B(g,u,Ra(F,S),F);var I=l.map(L=>L(F,S,C));return B.apply(B,I)}}else{var m=f in u?rt(u,f):void 0,p=typeof m=="function"&&m.rawArgs===!0,h=E=>{var F;if(E.has(f))F=E.get(f);else if(f in u)F=rt(u,f);else return o.onUndefinedFunction(f);if(typeof F=="function")return F;throw new TypeError("'".concat(f,`' is not a function; its value is:
`).concat(i(F)))};if(p){var d=this.args;return function(F,S,C){var B=h(F);return B(d,u,Ra(F,S),F)}}else switch(l.length){case 0:return function(F,S,C){var B=h(F);return B()};case 1:return function(F,S,C){var B=h(F),I=l[0];return B(I(F,S,C))};case 2:return function(F,S,C){var B=h(F),I=l[0],L=l[1];return B(I(F,S,C),L(F,S,C))};default:return function(F,S,C){var B=h(F),I=l.map(L=>L(F,S,C));return B(...I)}}}}else if(pn(this.fn)&&Mn(this.fn.index)&&this.fn.index.isObjectProperty()){var D=this.fn.object._compile(u,s),N=this.fn.index.getObjectProperty(),v=this.args;return function(F,S,C){var B=D(F,S,C);Zw(B,N);var I=B[N]&&B[N].rawArgs;if(I)return B[N](v,u,Ra(F,S),F);var L=l.map(k=>k(F,S,C));return B[N].apply(B,L)}}else{var w=this.fn.toString(),b=this.fn._compile(u,s),y=this.args;return function(F,S,C){var B=b(F,S,C);if(typeof B!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+`
`.concat(i(B)));if(B.rawArgs)return B(y,u,Ra(F,S),F);var I=l.map(L=>L(F,S,C));return B.apply(B,I)}}}forEach(u){u(this.fn,"fn",this);for(var s=0;s<this.args.length;s++)u(this.args[s],"args["+s+"]",this)}map(u){for(var s=this._ifNode(u(this.fn,"fn",this)),l=[],f=0;f<this.args.length;f++)l[f]=this._ifNode(u(this.args[f],"args["+f+"]",this));return new o(s,l)}clone(){return new o(this.fn,this.args.slice(0))}toString(u){var s,l=this.fn.toString(u);return u&&typeof u.handler=="object"&&Te(u.handler,l)&&(s=u.handler[l](this,u)),typeof s!="undefined"?s:super.toString(u)}_toString(u){var s=this.args.map(function(f){return f.toString(u)}),l=vi(this.fn)?"("+this.fn.toString(u)+")":this.fn.toString(u);return l+"("+s.join(", ")+")"}toJSON(){return{mathjs:Dc,fn:this.fn,args:this.args}}toHTML(u){var s=this.args.map(function(l){return l.toHTML(u)});return'<span class="math-function">'+Ct(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+s.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(u){var s;return u&&typeof u.handler=="object"&&Te(u.handler,this.name)&&(s=u.handler[this.name](this,u)),typeof s!="undefined"?s:super.toTex(u)}_toTex(u){var s=this.args.map(function(m){return m.toTex(u)}),l;xg[this.name]&&(l=xg[this.name]),e[this.name]&&(typeof e[this.name].toTex=="function"||typeof e[this.name].toTex=="object"||typeof e[this.name].toTex=="string")&&(l=e[this.name].toTex);var f;switch(typeof l){case"function":f=l(this,u);break;case"string":f=a(l,this,u);break;case"object":switch(typeof l[s.length]){case"function":f=l[s.length](this,u);break;case"string":f=a(l[s.length],this,u);break}}return typeof f!="undefined"?f:a(BA,this,u)}getIdentifier(){return this.type+":"+this.name}}return hr(o,"name",Dc),hr(o,"onUndefinedFunction",function(c){throw new Error("Undefined function "+c)}),hr(o,"fromJSON",function(c){return new o(c.fn,c.args)}),o},{isClass:!0,isNode:!0});var IA="parse",vq=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],Tg=A(IA,vq,t=>{var{typed:e,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:c,ConditionalNode:u,ConstantNode:s,FunctionAssignmentNode:l,FunctionNode:f,IndexNode:m,ObjectNode:p,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:D,SymbolNode:N}=t,v=e(IA,{string:function(O){return z(O,{})},"Array | Matrix":function(O){return w(O,{})},"string, Object":function(O,R){var V=R.nodes!==void 0?R.nodes:{};return z(O,V)},"Array | Matrix, Object":w});function w(x){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=O.nodes!==void 0?O.nodes:{};return Oe(x,function(V){if(typeof V!="string")throw new TypeError("String expected");return z(V,R)})}var b={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},y={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},F={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"];function C(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:b.NULL,nestingLevel:0,conditionalLevel:null}}function B(x,O){return x.expression.substr(x.index,O)}function I(x){return B(x,1)}function L(x){x.index++}function k(x){return x.expression.charAt(x.index-1)}function P(x){return x.expression.charAt(x.index+1)}function M(x){for(x.tokenType=b.NULL,x.token="",x.comment="";;){if(I(x)==="#")for(;I(x)!==`
`&&I(x)!=="";)x.comment+=I(x),L(x);if(v.isWhitespace(I(x),x.nestingLevel))L(x);else break}if(I(x)===""){x.tokenType=b.DELIMITER;return}if(I(x)===`
`&&!x.nestingLevel){x.tokenType=b.DELIMITER,x.token=I(x),L(x);return}var O=I(x),R=B(x,2),V=B(x,3);if(V.length===3&&y[V]){x.tokenType=b.DELIMITER,x.token=V,L(x),L(x),L(x);return}if(R.length===2&&y[R]){x.tokenType=b.DELIMITER,x.token=R,L(x),L(x);return}if(y[O]){x.tokenType=b.DELIMITER,x.token=O,L(x);return}if(v.isDigitDot(O)){x.tokenType=b.NUMBER;var ee=B(x,2);if(ee==="0b"||ee==="0o"||ee==="0x"){for(x.token+=I(x),L(x),x.token+=I(x),L(x);v.isHexDigit(I(x));)x.token+=I(x),L(x);if(I(x)===".")for(x.token+=".",L(x);v.isHexDigit(I(x));)x.token+=I(x),L(x);else if(I(x)==="i")for(x.token+="i",L(x);v.isDigit(I(x));)x.token+=I(x),L(x);return}if(I(x)==="."){if(x.token+=I(x),L(x),!v.isDigit(I(x))){x.tokenType=b.DELIMITER;return}}else{for(;v.isDigit(I(x));)x.token+=I(x),L(x);v.isDecimalMark(I(x),P(x))&&(x.token+=I(x),L(x))}for(;v.isDigit(I(x));)x.token+=I(x),L(x);if(I(x)==="E"||I(x)==="e"){if(v.isDigit(P(x))||P(x)==="-"||P(x)==="+"){if(x.token+=I(x),L(x),(I(x)==="+"||I(x)==="-")&&(x.token+=I(x),L(x)),!v.isDigit(I(x)))throw le(x,'Digit expected, got "'+I(x)+'"');for(;v.isDigit(I(x));)x.token+=I(x),L(x);if(v.isDecimalMark(I(x),P(x)))throw le(x,'Digit expected, got "'+I(x)+'"')}else if(P(x)===".")throw L(x),le(x,'Digit expected, got "'+I(x)+'"')}return}if(v.isAlpha(I(x),k(x),P(x))){for(;v.isAlpha(I(x),k(x),P(x))||v.isDigit(I(x));)x.token+=I(x),L(x);Te(E,x.token)?x.tokenType=b.DELIMITER:x.tokenType=b.SYMBOL;return}for(x.tokenType=b.UNKNOWN;I(x)!=="";)x.token+=I(x),L(x);throw le(x,'Syntax error in part "'+x.token+'"')}function T(x){do M(x);while(x.token===`
`)}function H(x){x.nestingLevel++}function _(x){x.nestingLevel--}v.isAlpha=function(O,R,V){return v.isValidLatinOrGreek(O)||v.isValidMathSymbol(O,V)||v.isValidMathSymbol(R,O)},v.isValidLatinOrGreek=function(O){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(O)},v.isValidMathSymbol=function(O,R){return/^[\uD835]$/.test(O)&&/^[\uDC00-\uDFFF]$/.test(R)&&/^[^\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(R)},v.isWhitespace=function(O,R){return O===" "||O===" "||O===`
`&&R>0},v.isDecimalMark=function(O,R){return O==="."&&R!=="/"&&R!=="*"&&R!=="^"},v.isDigitDot=function(O){return O>="0"&&O<="9"||O==="."},v.isDigit=function(O){return O>="0"&&O<="9"},v.isHexDigit=function(O){return O>="0"&&O<="9"||O>="a"&&O<="f"||O>="A"&&O<="F"};function z(x,O){var R=C();et(R,{expression:x,extraNodes:O}),M(R);var V=Y(R);if(R.token!=="")throw R.tokenType===b.DELIMITER?De(R,"Unexpected operator "+R.token):le(R,'Unexpected part "'+R.token+'"');return V}function Y(x){var O,R=[],V;for(x.token!==""&&x.token!==`
`&&x.token!==";"&&(O=X(x),x.comment&&(O.comment=x.comment));x.token===`
`||x.token===";";)R.length===0&&O&&(V=x.token!==";",R.push({node:O,visible:V})),M(x),x.token!==`
`&&x.token!==";"&&x.token!==""&&(O=X(x),x.comment&&(O.comment=x.comment),V=x.token!==";",R.push({node:O,visible:V}));return R.length>0?new c(R):(O||(O=new s(void 0),x.comment&&(O.comment=x.comment)),O)}function X(x){var O,R,V,ee,ue=q(x);if(x.token==="="){if(Mr(ue))return O=ue.name,T(x),V=X(x),new o(new N(O),V);if(pn(ue))return T(x),V=X(x),new o(ue.object,ue.index,V);if(Gt(ue)&&Mr(ue.fn)&&(ee=!0,R=[],O=ue.name,ue.args.forEach(function(ne,Pe){Mr(ne)?R[Pe]=ne.name:ee=!1}),ee))return T(x),V=X(x),new l(O,R,V);throw le(x,"Invalid left hand side of assignment operator =")}return ue}function q(x){for(var O=J(x);x.token==="?";){var R=x.conditionalLevel;x.conditionalLevel=x.nestingLevel,T(x);var V=O,ee=X(x);if(x.token!==":")throw le(x,"False part of conditional expression expected");x.conditionalLevel=null,T(x);var ue=X(x);O=new u(V,ee,ue),x.conditionalLevel=R}return O}function J(x){for(var O=ae(x);x.token==="or";)T(x),O=new h("or","or",[O,ae(x)]);return O}function ae(x){for(var O=re(x);x.token==="xor";)T(x),O=new h("xor","xor",[O,re(x)]);return O}function re(x){for(var O=fe(x);x.token==="and";)T(x),O=new h("and","and",[O,fe(x)]);return O}function fe(x){for(var O=he(x);x.token==="|";)T(x),O=new h("|","bitOr",[O,he(x)]);return O}function he(x){for(var O=me(x);x.token==="^|";)T(x),O=new h("^|","bitXor",[O,me(x)]);return O}function me(x){for(var O=ie(x);x.token==="&";)T(x),O=new h("&","bitAnd",[O,ie(x)]);return O}function ie(x){for(var O=[xe(x)],R=[],V={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Te(V,x.token);){var ee={name:x.token,fn:V[x.token]};R.push(ee),T(x),O.push(xe(x))}return O.length===1?O[0]:O.length===2?new h(R[0].name,R[0].fn,O):new D(R.map(ue=>ue.fn),O)}function xe(x){var O,R,V,ee;O=Me(x);for(var ue={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Te(ue,x.token);)R=x.token,V=ue[R],T(x),ee=[O,Me(x)],O=new h(R,V,ee);return O}function Me(x){var O,R,V,ee;O=be(x);for(var ue={to:"to",in:"to"};Te(ue,x.token);)R=x.token,V=ue[R],T(x),R==="in"&&x.token===""?O=new h("*","multiply",[O,new N("in")],!0):(ee=[O,be(x)],O=new h(R,V,ee));return O}function be(x){var O,R=[];if(x.token===":"?O=new s(1):O=Ce(x),x.token===":"&&x.conditionalLevel!==x.nestingLevel){for(R.push(O);x.token===":"&&R.length<3;)T(x),x.token===")"||x.token==="]"||x.token===","||x.token===""?R.push(new N("end")):R.push(Ce(x));R.length===3?O=new g(R[0],R[2],R[1]):O=new g(R[0],R[1])}return O}function Ce(x){var O,R,V,ee;O=U(x);for(var ue={"+":"add","-":"subtract"};Te(ue,x.token);){R=x.token,V=ue[R],T(x);var ne=U(x);ne.isPercentage?ee=[O,new h("*","multiply",[O,ne])]:ee=[O,ne],O=new h(R,V,ee)}return O}function U(x){var O,R,V,ee;O=G(x),R=O;for(var ue={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Te(ue,x.token);)V=x.token,ee=ue[V],T(x),R=G(x),O=new h(V,ee,[O,R]);return O}function G(x){var O,R;for(O=oe(x),R=O;x.tokenType===b.SYMBOL||x.token==="in"&&Xe(O)||x.tokenType===b.NUMBER&&!Xe(R)&&(!Rr(R)||R.op==="!")||x.token==="(";)R=oe(x),O=new h("*","multiply",[O,R],!0);return O}function oe(x){for(var O=$(x),R=O,V=[];x.token==="/"&&Bs(R);)if(V.push(et({},x)),T(x),x.tokenType===b.NUMBER)if(V.push(et({},x)),T(x),x.tokenType===b.SYMBOL||x.token==="(")et(x,V.pop()),V.pop(),R=$(x),O=new h("/","divide",[O,R]);else{V.pop(),et(x,V.pop());break}else{et(x,V.pop());break}return O}function $(x){var O,R,V,ee;O=j(x);for(var ue={"%":"mod",mod:"mod"};Te(ue,x.token);)R=x.token,V=ue[R],T(x),R==="%"&&x.tokenType===b.DELIMITER&&x.token!=="("?O=new h("/","divide",[O,new s(100)],!1,!0):(ee=[O,j(x)],O=new h(R,V,ee));return O}function j(x){var O,R,V,ee={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Te(ee,x.token)?(V=ee[x.token],O=x.token,T(x),R=[j(x)],new h(O,V,R)):te(x)}function te(x){var O,R,V,ee;return O=ve(x),(x.token==="^"||x.token===".^")&&(R=x.token,V=R==="^"?"pow":"dotPow",T(x),ee=[O,j(x)],O=new h(R,V,ee)),O}function ve(x){var O,R,V,ee;O=pe(x);for(var ue={"!":"factorial","'":"ctranspose"};Te(ue,x.token);)R=x.token,V=ue[R],M(x),ee=[O],O=new h(R,V,ee),O=ge(x,O);return O}function pe(x){var O=[];if(x.tokenType===b.SYMBOL&&Te(x.extraNodes,x.token)){var R=x.extraNodes[x.token];if(M(x),x.token==="("){if(O=[],H(x),M(x),x.token!==")")for(O.push(X(x));x.token===",";)M(x),O.push(X(x));if(x.token!==")")throw le(x,"Parenthesis ) expected");_(x),M(x)}return new R(O)}return Ne(x)}function Ne(x){var O,R;return x.tokenType===b.SYMBOL||x.tokenType===b.DELIMITER&&x.token in E?(R=x.token,M(x),Te(F,R)?O=new s(F[R]):S.indexOf(R)!==-1?O=new s(r(R,"number")):O=new N(R),O=ge(x,O),O):We(x)}function ge(x,O,R){for(var V;(x.token==="("||x.token==="["||x.token===".")&&(!R||R.indexOf(x.token)!==-1);)if(V=[],x.token==="(")if(Mr(O)||pn(O)){if(H(x),M(x),x.token!==")")for(V.push(X(x));x.token===",";)M(x),V.push(X(x));if(x.token!==")")throw le(x,"Parenthesis ) expected");_(x),M(x),O=new f(O,V)}else return O;else if(x.token==="["){if(H(x),M(x),x.token!=="]")for(V.push(X(x));x.token===",";)M(x),V.push(X(x));if(x.token!=="]")throw le(x,"Parenthesis ] expected");_(x),M(x),O=new i(O,new m(V))}else{if(M(x),x.tokenType!==b.SYMBOL)throw le(x,"Property name expected after dot");V.push(new s(x.token)),M(x);var ee=!0;O=new i(O,new m(V,ee))}return O}function We(x){var O,R;return x.token==='"'?(R=Ke(x),O=new s(R),O=ge(x,O),O):dr(x)}function Ke(x){for(var O="";I(x)!==""&&I(x)!=='"';)I(x)==="\\"&&(O+=I(x),L(x)),O+=I(x),L(x);if(M(x),x.token!=='"')throw le(x,'End of string " expected');return M(x),JSON.parse('"'+O+'"')}function dr(x){var O,R;return x.token==="'"?(R=wr(x),O=new s(R),O=ge(x,O),O):Br(x)}function wr(x){for(var O="";I(x)!==""&&I(x)!=="'";)I(x)==="\\"&&(O+=I(x),L(x)),O+=I(x),L(x);if(M(x),x.token!=="'")throw le(x,"End of string ' expected");return M(x),JSON.parse('"'+O+'"')}function Br(x){var O,R,V,ee;if(x.token==="["){if(H(x),M(x),x.token!=="]"){var ue=gt(x);if(x.token===";"){for(V=1,R=[ue];x.token===";";)M(x),R[V]=gt(x),V++;if(x.token!=="]")throw le(x,"End of matrix ] expected");_(x),M(x),ee=R[0].items.length;for(var ne=1;ne<V;ne++)if(R[ne].items.length!==ee)throw De(x,"Column dimensions mismatch ("+R[ne].items.length+" !== "+ee+")");O=new a(R)}else{if(x.token!=="]")throw le(x,"End of matrix ] expected");_(x),M(x),O=ue}}else _(x),M(x),O=new a([]);return ge(x,O)}return yt(x)}function gt(x){for(var O=[X(x)],R=1;x.token===",";)M(x),O[R]=X(x),R++;return new a(O)}function yt(x){if(x.token==="{"){H(x);var O,R={};do if(M(x),x.token!=="}"){if(x.token==='"')O=Ke(x);else if(x.token==="'")O=wr(x);else if(x.tokenType===b.SYMBOL||x.tokenType===b.DELIMITER&&x.token in E)O=x.token,M(x);else throw le(x,"Symbol or string expected as object key");if(x.token!==":")throw le(x,"Colon : expected after object key");M(x),R[O]=X(x)}while(x.token===",");if(x.token!=="}")throw le(x,"Comma , or bracket } expected after object value");_(x),M(x);var V=new p(R);return V=ge(x,V),V}return nn(x)}function nn(x){var O;return x.tokenType===b.NUMBER?(O=x.token,M(x),new s(r(O,n.number))):W(x)}function W(x){var O;if(x.token==="("){if(H(x),M(x),O=X(x),x.token!==")")throw le(x,"Parenthesis ) expected");return _(x),M(x),O=new d(O),O=ge(x,O),O}return K(x)}function K(x){throw x.token===""?le(x,"Unexpected end of expression"):le(x,"Value expected")}function se(x){return x.index-x.token.length+1}function le(x,O){var R=se(x),V=new SyntaxError(O+" (char "+R+")");return V.char=R,V}function De(x,O){var R=se(x),V=new SyntaxError(O+" (char "+R+")");return V.char=R,V}return e.addConversion({from:"string",to:"Node",convert:v}),v});var _A="compile",gq=["typed","parse"],Og=A(_A,gq,t=>{var{typed:e,parse:r}=t;return e(_A,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return Oe(i,function(a){return r(a).compile()})}})});var RA="evaluate",yq=["typed","parse"],Bg=A(RA,yq,t=>{var{typed:e,parse:r}=t;return e(RA,{string:function(i){var a=yi();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=yi();return Oe(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return Oe(i,function(o){return r(o).compile().evaluate(a)})}})});var xq="Parser",Dq=["evaluate"],Ig=A(xq,Dq,t=>{var{evaluate:e}=t;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:yi(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(n){return e(n,this.scope)},r.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},r.prototype.getAll=function(){return Yw(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(n,i){return this.scope.set(n,i),i},r.prototype.remove=function(n){this.scope.delete(n)},r.prototype.clear=function(){this.scope.clear()},r},{isClass:!0});var PA="parser",bq=["typed","Parser"],_g=A(PA,bq,t=>{var{typed:e,Parser:r}=t;return e(PA,{"":function(){return new r}})});var LA="lup",wq=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],Rg=A(LA,wq,t=>{var{typed:e,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtract:c,larger:u,equalScalar:s,unaryMinus:l,DenseMatrix:f,SparseMatrix:m,Spa:p}=t;return e(LA,{DenseMatrix:function(D){return h(D)},SparseMatrix:function(D){return d(D)},Array:function(D){var N=r(D),v=h(N);return{L:v.L.valueOf(),U:v.U.valueOf(),p:v.p}}});function h(g){var D=g._size[0],N=g._size[1],v=Math.min(D,N),w=Ie(g._data),b=[],y=[D,v],E=[],F=[v,N],S,C,B,I=[];for(S=0;S<D;S++)I[S]=S;for(C=0;C<N;C++){if(C>0)for(S=0;S<D;S++){var L=Math.min(S,C),k=0;for(B=0;B<L;B++)k=i(k,o(w[S][B],w[B][C]));w[S][C]=c(w[S][C],k)}var P=C,M=0,T=0;for(S=C;S<D;S++){var H=w[S][C],_=n(H);u(_,M)&&(P=S,M=_,T=H)}if(C!==P&&(I[C]=[I[P],I[P]=I[C]][0],f._swapRows(C,P,w)),C<D)for(S=C+1;S<D;S++){var z=w[S][C];s(z,0)||(w[S][C]=a(w[S][C],T))}}for(C=0;C<N;C++)for(S=0;S<D;S++){if(C===0&&(S<N&&(E[S]=[]),b[S]=[]),S<C){S<N&&(E[S][C]=w[S][C]),C<D&&(b[S][C]=0);continue}if(S===C){S<N&&(E[S][C]=w[S][C]),C<D&&(b[S][C]=1);continue}S<N&&(E[S][C]=0),C<D&&(b[S][C]=w[S][C])}var Y=new f({data:b,size:y}),X=new f({data:E,size:F}),q=[];for(S=0,v=I.length;S<v;S++)q[I[S]]=S;return{L:Y,U:X,p:q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function d(g){var D=g._size[0],N=g._size[1],v=Math.min(D,N),w=g._values,b=g._index,y=g._ptr,E=[],F=[],S=[],C=[D,v],B=[],I=[],L=[],k=[v,N],P,M,T,H=[],_=[];for(P=0;P<D;P++)H[P]=P,_[P]=P;var z=function(q,J){var ae=_[q],re=_[J];H[ae]=J,H[re]=q,_[q]=re,_[J]=ae},Y=function(){var q=new p;M<D&&(S.push(E.length),E.push(1),F.push(M)),L.push(B.length);var J=y[M],ae=y[M+1];for(T=J;T<ae;T++)P=b[T],q.set(H[P],w[T]);M>0&&q.forEach(0,M-1,function(me,ie){m._forEachRow(me,E,F,S,function(xe,Me){xe>me&&q.accumulate(xe,l(o(Me,ie)))})});var re=M,fe=q.get(M),he=n(fe);q.forEach(M+1,D-1,function(me,ie){var xe=n(ie);u(xe,he)&&(re=me,he=xe,fe=ie)}),M!==re&&(m._swapRows(M,re,C[1],E,F,S),m._swapRows(M,re,k[1],B,I,L),q.swap(M,re),z(M,re)),q.forEach(0,D-1,function(me,ie){me<=M?(B.push(ie),I.push(me)):(ie=a(ie,fe),s(ie,0)||(E.push(ie),F.push(me)))})};for(M=0;M<N;M++)Y();return L.push(B.length),S.push(E.length),{L:new m({values:E,index:F,ptr:S,size:C}),U:new m({values:B,index:I,ptr:L,size:k}),p:H,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var kA="qr",Eq=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract","complex"],Pg=A(kA,Eq,t=>{var{typed:e,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:c,sqrt:u,conj:s,unaryMinus:l,addScalar:f,divideScalar:m,multiplyScalar:p,subtract:h,complex:d}=t;return et(e(kA,{DenseMatrix:function(w){return D(w)},SparseMatrix:function(w){return N(w)},Array:function(w){var b=r(w),y=D(b);return{Q:y.Q.valueOf(),R:y.R.valueOf()}}}),{_denseQRimpl:g});function g(v){var w=v._size[0],b=v._size[1],y=i([w],"dense"),E=y._data,F=v.clone(),S=F._data,C,B,I,L=n([w],"");for(I=0;I<Math.min(b,w);++I){var k=S[I][I],P=l(o(k,0)?1:c(k)),M=s(P),T=0;for(C=I;C<w;C++)T=f(T,p(S[C][I],s(S[C][I])));var H=p(P,u(T));if(!a(H)){var _=h(k,H);for(L[I]=1,C=I+1;C<w;C++)L[C]=m(S[C][I],_);var z=l(s(m(_,H))),Y=void 0;for(B=I;B<b;B++){for(Y=0,C=I;C<w;C++)Y=f(Y,p(s(L[C]),S[C][B]));for(Y=p(Y,z),C=I;C<w;C++)S[C][B]=p(h(S[C][B],p(L[C],Y)),M)}for(C=0;C<w;C++){for(Y=0,B=I;B<w;B++)Y=f(Y,p(E[C][B],L[B]));for(Y=p(Y,z),B=I;B<w;++B)E[C][B]=m(h(E[C][B],p(Y,s(L[B]))),M)}}}return{Q:y,R:F,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function D(v){var w=g(v),b=w.R._data;if(v._data.length>0)for(var y=b[0][0].type==="Complex"?d(0):0,E=0;E<b.length;++E)for(var F=0;F<E&&F<(b[0]||[]).length;++F)b[E][F]=y;return w}function N(v){throw new Error("qr not implemented for sparse matrices yet")}});function qA(t,e,r,n){for(var i=t._values,a=t._index,o=t._ptr,c=t._size,u=t._datatype,s=c[0],l=c[1],f=n&&t._values?[]:null,m=[],p=[],h=0,d=0;d<l;d++){p[d]=h;for(var g=r?r[d]:d,D=o[g],N=o[g+1],v=D;v<N;v++){var w=e?e[a[v]]:a[v];m[h]=w,f&&(f[h]=i[v]),h++}}return p[l]=h,t.createSparseMatrix({values:f,index:m,ptr:p,size:[s,l],datatype:u})}function bc(t,e,r,n,i,a,o){var c=0;for(r[o]=t;c>=0;){var u=r[o+c],s=r[n+u];s===-1?(c--,a[e++]=u):(r[n+u]=r[i+s],++c,r[o+c]=s)}return e}function zA(t,e){if(!t)return null;var r=0,n,i=[],a=[],o=0,c=e,u=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)t[n]!==-1&&(a[c+n]=a[o+t[n]],a[o+t[n]]=n);for(n=0;n<e;n++)t[n]===-1&&(r=bc(n,r,a,o,c,i,u));return i}function UA(t,e){if(!t)return null;var r=t._index,n=t._ptr,i=t._size,a=i[0],o=i[1],c=[],u=[],s=0,l=o,f,m;if(e)for(f=0;f<a;f++)u[l+f]=-1;for(var p=0;p<o;p++){c[p]=-1,u[s+p]=-1;for(var h=n[p],d=n[p+1],g=h;g<d;g++){var D=r[g];for(f=e?u[l+D]:D;f!==-1&&f<p;f=m)m=u[s+f],u[s+f]=p,m===-1&&(c[f]=p);e&&(u[l+D]=p)}}return c}function VA(t,e,r){for(var n=t._values,i=t._index,a=t._ptr,o=t._size,c=o[1],u=0,s=0;s<c;s++){var l=a[s];for(a[s]=u;l<a[s+1];l++)e(i[l],s,n?n[l]:1,r)&&(i[u]=i[l],n&&(n[u]=n[l]),u++)}return a[c]=u,i.splice(u,i.length-u),n&&n.splice(u,n.length-u),u}function ri(t){return-t-2}var Cq="csAmd",Nq=["add","multiply","transpose"],$A=A(Cq,Nq,t=>{var{add:e,multiply:r,transpose:n}=t;return function(l,f){if(!f||l<=0||l>3)return null;var m=f._size,p=m[0],h=m[1],d=0,g=Math.max(16,10*Math.sqrt(h));g=Math.min(h-2,g);var D=i(l,f,p,h,g);VA(D,u,null);for(var N=D._index,v=D._ptr,w=v[h],b=[],y=[],E=0,F=h+1,S=2*(h+1),C=3*(h+1),B=4*(h+1),I=5*(h+1),L=6*(h+1),k=7*(h+1),P=b,M=a(h,v,y,E,C,P,S,k,F,L,B,I),T=o(h,v,y,I,B,L,g,F,C,P,S),H=0,_,z,Y,X,q,J,ae,re,fe,he,me,ie,xe,Me,be,Ce;T<h;){for(Y=-1;H<h&&(Y=y[C+H])===-1;H++);y[S+Y]!==-1&&(P[y[S+Y]]=-1),y[C+H]=y[S+Y];var U=y[B+Y],G=y[F+Y];T+=G;var oe=0;y[F+Y]=-G;var $=v[Y],j=U===0?$:w,te=j;for(X=1;X<=U+1;X++){for(X>U?(J=Y,ae=$,re=y[E+Y]-U):(J=N[$++],ae=v[J],re=y[E+J]),q=1;q<=re;q++)_=N[ae++],!((fe=y[F+_])<=0)&&(oe+=fe,y[F+_]=-fe,N[te++]=_,y[S+_]!==-1&&(P[y[S+_]]=P[_]),P[_]!==-1?y[S+P[_]]=y[S+_]:y[C+y[I+_]]=y[S+_]);J!==Y&&(v[J]=ri(Y),y[L+J]=0)}for(U!==0&&(w=te),y[I+Y]=oe,v[Y]=j,y[E+Y]=te-j,y[B+Y]=-2,M=c(M,d,y,L,h),he=j;he<te;he++)if(_=N[he],!((me=y[B+_])<=0)){fe=-y[F+_];var ve=M-fe;for($=v[_],ie=v[_]+me-1;$<=ie;$++)J=N[$],y[L+J]>=M?y[L+J]-=fe:y[L+J]!==0&&(y[L+J]=y[I+J]+ve)}for(he=j;he<te;he++){for(_=N[he],ie=v[_],xe=ie+y[B+_]-1,Me=ie,be=0,Ce=0,$=ie;$<=xe;$++)if(J=N[$],y[L+J]!==0){var pe=y[L+J]-M;pe>0?(Ce+=pe,N[Me++]=J,be+=J):(v[J]=ri(Y),y[L+J]=0)}y[B+_]=Me-ie+1;var Ne=Me,ge=ie+y[E+_];for($=xe+1;$<ge;$++){z=N[$];var We=y[F+z];We<=0||(Ce+=We,N[Me++]=z,be+=z)}Ce===0?(v[_]=ri(Y),fe=-y[F+_],oe-=fe,G+=fe,T+=fe,y[F+_]=0,y[B+_]=-1):(y[I+_]=Math.min(y[I+_],Ce),N[Me]=N[Ne],N[Ne]=N[ie],N[ie]=Y,y[E+_]=Me-ie+1,be=(be<0?-be:be)%h,y[S+_]=y[k+be],y[k+be]=_,P[_]=be)}for(y[I+Y]=oe,d=Math.max(d,oe),M=c(M+d,d,y,L,h),he=j;he<te;he++)if(_=N[he],!(y[F+_]>=0))for(be=P[_],_=y[k+be],y[k+be]=-1;_!==-1&&y[S+_]!==-1;_=y[S+_],M++){for(re=y[E+_],me=y[B+_],$=v[_]+1;$<=v[_]+re-1;$++)y[L+N[$]]=M;var Ke=_;for(z=y[S+_];z!==-1;){var dr=y[E+z]===re&&y[B+z]===me;for($=v[z]+1;dr&&$<=v[z]+re-1;$++)y[L+N[$]]!==M&&(dr=0);dr?(v[z]=ri(_),y[F+_]+=y[F+z],y[F+z]=0,y[B+z]=-1,z=y[S+z],y[S+Ke]=z):(Ke=z,z=y[S+z])}}for($=j,he=j;he<te;he++)_=N[he],!((fe=-y[F+_])<=0)&&(y[F+_]=fe,Ce=y[I+_]+oe-fe,Ce=Math.min(Ce,h-T-fe),y[C+Ce]!==-1&&(P[y[C+Ce]]=_),y[S+_]=y[C+Ce],P[_]=-1,y[C+Ce]=_,H=Math.min(H,Ce),y[I+_]=Ce,N[$++]=_);y[F+Y]=G,(y[E+Y]=$-j)===0&&(v[Y]=-1,y[L+Y]=0),U!==0&&(w=$)}for(_=0;_<h;_++)v[_]=ri(v[_]);for(z=0;z<=h;z++)y[C+z]=-1;for(z=h;z>=0;z--)y[F+z]>0||(y[S+z]=y[C+v[z]],y[C+v[z]]=z);for(J=h;J>=0;J--)y[F+J]<=0||v[J]!==-1&&(y[S+J]=y[C+v[J]],y[C+v[J]]=J);for(Y=0,_=0;_<=h;_++)v[_]===-1&&(Y=bc(_,Y,y,C,S,b,L));return b.splice(b.length-1,1),b};function i(s,l,f,m,p){var h=n(l);if(s===1&&m===f)return e(l,h);if(s===2){for(var d=h._index,g=h._ptr,D=0,N=0;N<f;N++){var v=g[N];if(g[N]=D,!(g[N+1]-v>p))for(var w=g[N+1];v<w;v++)d[D++]=d[v]}return g[f]=D,l=n(h),r(h,l)}return r(h,l)}function a(s,l,f,m,p,h,d,g,D,N,v,w){for(var b=0;b<s;b++)f[m+b]=l[b+1]-l[b];f[m+s]=0;for(var y=0;y<=s;y++)f[p+y]=-1,h[y]=-1,f[d+y]=-1,f[g+y]=-1,f[D+y]=1,f[N+y]=1,f[v+y]=0,f[w+y]=f[m+y];var E=c(0,0,f,N,s);return f[v+s]=-2,l[s]=-1,f[N+s]=0,E}function o(s,l,f,m,p,h,d,g,D,N,v){for(var w=0,b=0;b<s;b++){var y=f[m+b];if(y===0)f[p+b]=-2,w++,l[b]=-1,f[h+b]=0;else if(y>d)f[g+b]=0,f[p+b]=-1,w++,l[b]=ri(s),f[g+s]++;else{var E=f[D+y];E!==-1&&(N[E]=b),f[v+b]=f[D+y],f[D+y]=b}}return w}function c(s,l,f,m,p){if(s<2||s+l<0){for(var h=0;h<p;h++)f[m+h]!==0&&(f[m+h]=1);s=2}return s}function u(s,l){return s!==l}});function HA(t,e,r,n,i,a,o){var c,u,s=0,l;if(t<=e||r[n+e]<=r[i+t])return-1;r[i+t]=r[n+e];var f=r[a+t];if(r[a+t]=e,f===-1)s=1,l=t;else{for(s=2,l=f;l!==r[o+l];l=r[o+l]);for(c=f;c!==l;c=u)u=r[o+c],r[o+c]=l}return{jleaf:s,q:l}}var Aq="csCounts",Fq=["transpose"],WA=A(Aq,Fq,t=>{var{transpose:e}=t;return function(r,n,i,a){if(!r||!n||!i)return null;var o=r._size,c=o[0],u=o[1],s,l,f,m,p,h,d,g=4*u+(a?u+c+1:0),D=[],N=0,v=u,w=2*u,b=3*u,y=4*u,E=5*u+1;for(f=0;f<g;f++)D[f]=-1;var F=[],S=e(r),C=S._index,B=S._ptr;for(f=0;f<u;f++)for(l=i[f],F[l]=D[b+l]===-1?1:0;l!==-1&&D[b+l]===-1;l=n[l])D[b+l]=f;if(a){for(f=0;f<u;f++)D[i[f]]=f;for(s=0;s<c;s++){for(f=u,h=B[s],d=B[s+1],p=h;p<d;p++)f=Math.min(f,D[C[p]]);D[E+s]=D[y+f],D[y+f]=s}}for(s=0;s<u;s++)D[N+s]=s;for(f=0;f<u;f++){for(l=i[f],n[l]!==-1&&F[n[l]]--,m=a?D[y+f]:l;m!==-1;m=a?D[E+m]:-1)for(p=B[m];p<B[m+1];p++){s=C[p];var I=HA(s,l,D,b,v,w,N);I.jleaf>=1&&F[l]++,I.jleaf===2&&F[I.q]--}n[l]!==-1&&(D[N+l]=n[l])}for(l=0;l<u;l++)n[l]!==-1&&(F[n[l]]+=F[l]);return F}});var Sq="csSqr",Mq=["add","multiply","transpose"],GA=A(Sq,Mq,t=>{var{add:e,multiply:r,transpose:n}=t,i=$A({add:e,multiply:r,transpose:n}),a=WA({transpose:n});return function(u,s,l){var f=s._ptr,m=s._size,p=m[1],h,d={};if(d.q=i(u,s),u&&!d.q)return null;if(l){var g=u?qA(s,null,d.q,0):s;d.parent=UA(g,1);var D=zA(d.parent,p);if(d.cp=a(g,d.parent,D,1),g&&d.parent&&d.cp&&o(g,d))for(d.unz=0,h=0;h<p;h++)d.unz+=d.cp[h]}else d.unz=4*f[p]+p,d.lnz=d.unz;return d};function o(c,u){var s=c._ptr,l=c._index,f=c._size,m=f[0],p=f[1];u.pinv=[],u.leftmost=[];var h=u.parent,d=u.pinv,g=u.leftmost,D=[],N=0,v=m,w=m+p,b=m+2*p,y,E,F,S,C;for(E=0;E<p;E++)D[v+E]=-1,D[w+E]=-1,D[b+E]=0;for(y=0;y<m;y++)g[y]=-1;for(E=p-1;E>=0;E--)for(S=s[E],C=s[E+1],F=S;F<C;F++)g[l[F]]=E;for(y=m-1;y>=0;y--)d[y]=-1,E=g[y],E!==-1&&(D[b+E]++===0&&(D[w+E]=y),D[N+y]=D[v+E],D[v+E]=y);for(u.lnz=0,u.m2=m,E=0;E<p;E++)if(y=D[v+E],u.lnz++,y<0&&(y=u.m2++),d[y]=E,!(--b[E]<=0)){u.lnz+=D[b+E];var B=h[E];B!==-1&&(D[b+B]===0&&(D[w+B]=D[w+E]),D[N+D[w+E]]=D[v+B],D[v+B]=D[N+y],D[b+B]+=D[b+E])}for(y=0;y<m;y++)d[y]<0&&(d[y]=E++);return!0}});function Qs(t,e){return t[e]<0}function wc(t,e){t[e]=ri(t[e])}function Lg(t){return t<0?ri(t):t}function ZA(t,e,r,n,i){var a=e._index,o=e._ptr,c=e._size,u=c[1],s,l,f,m=0;for(n[0]=t;m>=0;){t=n[m];var p=i?i[t]:t;Qs(o,t)||(wc(o,t),n[u+m]=p<0?0:Lg(o[p]));var h=1;for(l=n[u+m],f=p<0?0:Lg(o[p+1]);l<f;l++)if(s=a[l],!Qs(o,s)){n[u+m]=l,n[++m]=s,h=0;break}h&&(m--,n[--r]=t)}return r}function jA(t,e,r,n,i){var a=t._ptr,o=t._size,c=e._index,u=e._ptr,s=o[1],l,f,m,p=s;for(f=u[r],m=u[r+1],l=f;l<m;l++){var h=c[l];Qs(a,h)||(p=ZA(h,t,p,n,i))}for(l=p;l<s;l++)wc(a,n[l]);return p}var Tq="csSpsolve",Oq=["divideScalar","multiply","subtract"],YA=A(Tq,Oq,t=>{var{divideScalar:e,multiply:r,subtract:n}=t;return function(a,o,c,u,s,l,f){var m=a._values,p=a._index,h=a._ptr,d=a._size,g=d[1],D=o._values,N=o._index,v=o._ptr,w,b,y,E,F=jA(a,o,c,u,l);for(w=F;w<g;w++)s[u[w]]=0;for(b=v[c],y=v[c+1],w=b;w<y;w++)s[N[w]]=D[w];for(var S=F;S<g;S++){var C=u[S],B=l?l[C]:C;if(!(B<0))for(b=h[B],y=h[B+1],s[C]=e(s[C],m[f?b:y-1]),w=f?b+1:b,E=f?y:y-1;w<E;w++){var I=p[w];s[I]=n(s[I],r(m[w],s[C]))}}return F}});var Bq="csLu",Iq=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],JA=A(Bq,Iq,t=>{var{abs:e,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:c}=t,u=YA({divideScalar:r,multiply:n,subtract:i});return function(l,f,m){if(!l)return null;var p=l._size,h=p[1],d,g=100,D=100;f&&(d=f.q,g=f.lnz||g,D=f.unz||D);var N=[],v=[],w=[],b=new c({values:N,index:v,ptr:w,size:[h,h]}),y=[],E=[],F=[],S=new c({values:y,index:E,ptr:F,size:[h,h]}),C=[],B,I,L=[],k=[];for(B=0;B<h;B++)L[B]=0,C[B]=-1,w[B+1]=0;g=0,D=0;for(var P=0;P<h;P++){w[P]=g,F[P]=D;var M=d?d[P]:P,T=u(b,l,M,k,L,C,1),H=-1,_=-1;for(I=T;I<h;I++)if(B=k[I],C[B]<0){var z=e(L[B]);a(z,_)&&(_=z,H=B)}else E[D]=C[B],y[D++]=L[B];if(H===-1||_<=0)return null;C[M]<0&&o(e(L[M]),n(_,m))&&(H=M);var Y=L[H];for(E[D]=P,y[D++]=Y,C[H]=P,v[g]=H,N[g++]=1,I=T;I<h;I++)B=k[I],C[B]<0&&(v[g]=B,N[g++]=r(L[B],Y)),L[B]=0}for(w[h]=g,F[h]=D,I=0;I<g;I++)v[I]=C[v[I]];return N.splice(g,N.length-g),v.splice(g,v.length-g),y.splice(D,y.length-D),E.splice(D,E.length-D),{L:b,U:S,pinv:C}}});var XA="slu",_q=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],kg=A(XA,_q,t=>{var{typed:e,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:c,larger:u,largerEq:s,SparseMatrix:l}=t,f=GA({add:n,multiply:i,transpose:a}),m=JA({abs:r,divideScalar:o,multiply:i,subtract:c,larger:u,largerEq:s,SparseMatrix:l});return e(XA,{"SparseMatrix, number, number":function(h,d,g){if(!Ae(d)||d<0||d>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(g<0||g>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var D=f(d,h,!1),N=m(h,D,g);return{L:N.L,U:N.U,p:N.pinv,q:D.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function qg(t,e){var r,n=e.length,i=[];if(t)for(r=0;r<n;r++)i[t[r]]=e[r];else for(r=0;r<n;r++)i[r]=e[r];return i}var QA="lusolve",Rq=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],zg=A(QA,Rq,t=>{var{typed:e,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:c}=t,u=bi({DenseMatrix:c});return e(QA,{"Array, Array | Matrix":function(m,p){m=r(m);var h=n(m),d=l(h.L,h.U,h.p,null,p);return d.valueOf()},"DenseMatrix, Array | Matrix":function(m,p){var h=n(m);return l(h.L,h.U,h.p,null,p)},"SparseMatrix, Array | Matrix":function(m,p){var h=n(m);return l(h.L,h.U,h.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(m,p,h,d){var g=i(m,h,d);return l(g.L,g.U,g.p,g.q,p)},"Object, Array | Matrix":function(m,p){return l(m.L,m.U,m.p,m.q,p)}});function s(f){if(Fe(f))return f;if(lr(f))return r(f);throw new TypeError("Invalid Matrix LU decomposition")}function l(f,m,p,h,d){f=s(f),m=s(m),p&&(d=u(f,d,!0),d._data=qg(p,d._data));var g=o(f,d),D=a(m,g);return h&&(D._data=qg(h,D._data)),D}});var KA="polynomialRoot",Pq=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],Ug=A(KA,Pq,t=>{var{typed:e,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:c,sqrt:u,unaryMinus:s,cbrt:l,typeOf:f,im:m,re:p}=t;return e(KA,{"number|Complex, ...number|Complex":(h,d)=>{for(var g=[h,...d];g.length>0&&r(g[g.length-1]);)g.pop();if(g.length<2)throw new RangeError("Polynomial [".concat(h,", ").concat(d,"] must have a non-zero non-constant coefficient"));switch(g.length){case 2:return[s(c(g[0],g[1]))];case 3:{var[D,N,v]=g,w=o(2,v),b=o(N,N),y=o(4,v,D);if(n(b,y))return[c(s(N),w)];var E=u(a(b,y));return[c(a(E,N),w),c(a(s(E),N),w)]}case 4:{var[F,S,C,B]=g,I=s(o(3,B)),L=o(C,C),k=o(3,B,S),P=i(o(2,C,C,C),o(27,B,B,F)),M=o(9,B,C,S);if(n(L,k)&&n(P,M))return[c(C,I)];var T=a(L,k),H=a(P,M),_=i(o(18,B,C,S,F),o(C,C,S,S)),z=i(o(4,C,C,C,F),o(4,B,S,S,S),o(27,B,B,F,F));if(n(_,z))return[c(a(o(4,B,C,S),i(o(9,B,B,F),o(C,C,C))),o(B,T)),c(a(o(9,B,F),o(C,S)),o(2,T))];var Y;n(L,k)?Y=H:Y=c(i(H,u(a(o(H,H),o(4,T,T,T)))),2);var X=!0,q=l(Y,X).toArray().map(J=>c(i(C,J,c(T,J)),I));return q.map(J=>f(J)==="Complex"&&n(p(J),p(J)+m(J))?p(J):J)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(g))}}})});var Lq="Help",kq=["parse"],Vg=A(Lq,kq,t=>{var{parse:e}=t;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=`
`;if(n.name&&(i+="Name: "+n.name+`
`),n.category&&(i+="Category: "+n.category+`
`),n.description&&(i+=`Description:
`+n.description+`
`),n.syntax&&(i+=`Syntax:
`+n.syntax.join(`
`)+`
`),n.examples){i+=`Examples:
`;for(var a={},o=0;o<n.examples.length;o++){var c=n.examples[o];i+=" "+c+`
`;var u=void 0;try{u=e(c).compile().evaluate(a)}catch(s){u=s}u!==void 0&&!dl(u)&&(i+=" "+qe(u,{precision:14})+`
`)}i+=`
`}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+`
`),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+`
`),i},r.prototype.toJSON=function(){var n=Ie(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0});var qq="Chain",zq=["?on","math","typed"],$g=A(qq,zq,t=>{var{on:e,math:r,typed:n}=t;function i(s){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");hl(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 qe(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]=c(l))}function o(s,l){Ew(i.prototype,s,function(){var m=l();if(typeof m=="function")return c(m)})}function c(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 m=n.resolve(s,l);if(m.params.length===1)throw new Error("chain function "+s.name+" cannot match rest parameter between chain value and additional arguments.");return new i(m.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(h){Te(s,h)&&u[h]===void 0&&o(h,()=>s[h])};for(var m in s)f(m)}};var u={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),e&&e("import",function(s,l,f){f||o(s,l)}),i},{isClass:!0});var Hg={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 eF={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var rF={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 tF={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 nF={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var iF={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var aF={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 oF={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 sF={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var uF={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var lF={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 Wg={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 cF={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 fF={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var mF={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 pF={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var dF={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var hF={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var vF={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 gF={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 yF={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 xF={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 DF={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:["[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var bF={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 wF={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var EF={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 CF={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 NF={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 AF={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 FF={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 SF={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 MF={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x })',"double(2)",'double("hello")'],seealso:[]};var TF={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 OF={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 BF={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 IF={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 _F={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 RF={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 PF={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 LF={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 kF={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 qF={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 zF={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 UF={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConatant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var VF={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 $F={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 HF={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 WF={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 GF={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 ZF={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var jF={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 YF={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 JF={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 XF={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 QF={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 KF={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 eS={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 rS={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 tS={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 nS={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 iS={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 aS={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 oS={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 sS={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 uS={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var lS={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)=NaN","invmod(7, 13)=2","invmod(15151, 15122)=10429"],seealso:["gcd","xgcd"]};var cS={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 fS={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 mS={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 pS={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 dS={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 hS={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 vS={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 gS={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 yS={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 xS={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 DS={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 bS={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],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)"],seealso:["ceil","floor","fix"]};var wS={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 ES={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 CS={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 NS={name:"sylvester",category:"Matrix",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]])","sylvester(A,B,C)"],seealso:["schur","lyap"]};var AS={name:"schur",category:"Matrix",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","schur(A)"],seealso:["lyap","sylvester"]};var FS={name:"lyap",category:"Matrix",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]])","lyap(A,Q)"],seealso:["schur","sylvester"]};var SS={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 MS={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 TS={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 OS={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var BS={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 IS={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 _S={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 RS={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 PS={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 LS={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 kS={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 qS={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 zS={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 US={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 VS={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 $S={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 HS={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 WS={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 GS={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 ZS={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 jS={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(" + 4 + ")")'],seealso:[]};var YS={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 JS={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 XS={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 QS={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 KS={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 e2={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 r2={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 t2={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 n2={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 i2={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 a2={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 o2={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 s2={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 u2={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 l2={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["diff([1, 2, 4, 7, 0])","diff([1, 2, 4, 7, 0], 0)","diff(matrix([1, 2, 4, 7, 0]))","diff([[1, 2], [3, 4]])","diff([[1, 2], [3, 4]], 0)","diff([[1, 2], [3, 4]], 1)","diff([[1, 2], [3, 4]], bignumber(1))","diff(matrix([[1, 2], [3, 4]]), 1)","diff([[1, 2], matrix([3, 4])], 1)"],seealso:["subtract","partitionSelect"]};var c2={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 f2={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],seealso:["inv"]};var m2={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 p2={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 d2={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 h2={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 v2={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 g2={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 y2={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 x2={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 D2={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var b2={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 w2={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 E2={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 C2={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 N2={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 A2={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")',"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 F2={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 S2={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 M2={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 T2={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 O2={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 B2={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 I2={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 _2={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 R2={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 P2={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 L2={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 k2={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 q2={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var z2={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var U2={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 V2={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 $2={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 H2={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 W2={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 G2={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 Z2={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 j2={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 Y2={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 J2={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 X2={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 Q2={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 K2={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 eM={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 rM={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 tM={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 nM={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 iM={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 aM={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 oM={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 sM={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 uM={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 lM={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 cM={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 fM={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 mM={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 pM={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 dM={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 hM={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 vM={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 gM={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 yM={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 xM={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 DM={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 bM={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 wM={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 EM={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 CM={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 NM={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 AM={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 FM={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber.
In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var SM={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 MM={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 TM={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 OM={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 BM={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 IM={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 _M={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 RM={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var PM={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 LM={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var kM={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 qM={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var zM={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 UM={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 VM={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 $M={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 HM={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 WM={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 GM={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 ZM={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 jM={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 YM={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 JM={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 XM={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 QM={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 KM={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 eT={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var rT={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 tT={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 nT={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 iT={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var aT={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 oT={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 sT={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 uT={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var lT={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 cT={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 fT={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 mT={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 pT={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 dT={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 hT={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 vT={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction)','numeric(4, "Fraction")','numeric(fraction(2, 5), "number)'],seealso:["number","fraction","bignumber","string","format"]};var gT={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var yT={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: $0, $1, $2", [6, 9, 4])'],seealso:["format"]};var xT={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 DT={bignumber:hF,boolean:vF,complex:gF,createUnit:yF,fraction:xF,index:DF,matrix:bF,number:wF,sparse:EF,splitUnit:CF,string:NF,unit:AF,e:Hg,E:Hg,false:eF,i:rF,Infinity:tF,LN2:iF,LN10:nF,LOG2E:oF,LOG10E:aF,NaN:sF,null:uF,pi:Wg,PI:Wg,phi:lF,SQRT1_2:cF,SQRT2:fF,tau:mF,true:pF,version:dF,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:TF,lsolve:BF,lsolveAll:IF,lup:_F,lusolve:RF,leafCount:OF,polynomialRoot:PF,resolve:qF,simplify:zF,simplifyConstant:UF,simplifyCore:VF,symbolicEqual:HF,rationalize:kF,slu:$F,usolve:WF,usolveAll:GF,qr:LF,abs:ZF,add:jF,cbrt:YF,ceil:JF,cube:XF,divide:QF,dotDivide:KF,dotMultiply:eS,dotPow:rS,exp:tS,expm:nS,expm1:iS,fix:aS,floor:oS,gcd:sS,hypot:uS,lcm:cS,log:fS,log2:dS,log1p:pS,log10:mS,mod:hS,multiply:vS,norm:gS,nthRoot:yS,nthRoots:xS,pow:DS,round:bS,sign:wS,sqrt:ES,sqrtm:CS,square:SS,subtract:MS,unaryMinus:TS,unaryPlus:OS,xgcd:BS,invmod:lS,bitAnd:IS,bitNot:_S,bitOr:RS,bitXor:PS,leftShift:LS,rightArithShift:kS,rightLogShift:qS,bellNumbers:zS,catalan:US,composition:VS,stirlingS2:$S,config:FF,import:SF,typed:MF,arg:HS,conj:WS,re:ZS,im:GS,evaluate:jS,help:YS,distance:JS,intersect:XS,and:QS,not:KS,or:e2,xor:r2,concat:n2,count:i2,cross:a2,column:t2,ctranspose:o2,det:s2,diag:u2,diff:l2,dot:c2,getMatrixDataType:h2,identity:v2,filter:m2,flatten:p2,forEach:d2,inv:g2,pinv:y2,eigs:f2,kron:x2,matrixFromFunction:w2,matrixFromRows:E2,matrixFromColumns:b2,map:D2,ones:C2,partitionSelect:N2,range:A2,resize:S2,reshape:F2,rotate:M2,rotationMatrix:T2,row:O2,size:B2,sort:I2,squeeze:_2,subset:R2,trace:P2,transpose:L2,zeros:k2,fft:q2,ifft:z2,sylvester:NS,schur:AS,lyap:FS,combinations:U2,combinationsWithRep:V2,factorial:$2,gamma:H2,kldivergence:G2,lgamma:W2,multinomial:Z2,permutations:j2,pickRandom:Y2,random:J2,randomInt:X2,compare:Q2,compareNatural:K2,compareText:eM,deepEqual:rM,equal:tM,equalText:nM,larger:iM,largerEq:aM,smaller:oM,smallerEq:sM,unequal:uM,setCartesian:lM,setDifference:cM,setDistinct:fM,setIntersect:mM,setIsSubset:pM,setMultiplicity:dM,setPowerset:hM,setSize:vM,setSymDifference:gM,setUnion:yM,erf:xM,cumsum:MM,mad:DM,max:bM,mean:wM,median:EM,min:CM,mode:NM,prod:AM,quantileSeq:FM,std:SM,sum:TM,variance:OM,acos:BM,acosh:IM,acot:_M,acoth:RM,acsc:PM,acsch:LM,asec:kM,asech:qM,asin:zM,asinh:UM,atan:VM,atanh:HM,atan2:$M,cos:WM,cosh:GM,cot:ZM,coth:jM,csc:YM,csch:JM,sec:XM,sech:QM,sin:KM,sinh:eT,tan:rT,tanh:tT,to:nT,clone:aT,format:oT,bin:iT,oct:gT,hex:uT,isNaN:cT,isInteger:lT,isNegative:fT,isNumeric:mT,hasNumericValue:sT,isPositive:pT,isPrime:dT,isZero:hT,print:yT,typeOf:xT,numeric:vT};var bT="help",Uq=["typed","mathWithTransform","Help"],Gg=A(bT,Uq,t=>{var{typed:e,mathWithTransform:r,Help:n}=t;return e(bT,{any:function(a){var o,c=a;if(typeof a!="string"){for(o in r)if(Te(r,o)&&a===r[o]){c=o;break}}var u=rt(DT,c);if(!u){var s=typeof c=="function"?c.name:c;throw new Error('No documentation found on "'+s+'"')}return new n(u)}})});var wT="chain",Vq=["typed","Chain"],Zg=A(wT,Vq,t=>{var{typed:e,Chain:r}=t;return e(wT,{"":function(){return new r},any:function(i){return new r(i)}})});var ET="det",$q=["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],jg=A(ET,$q,t=>{var{typed:e,matrix:r,subtract:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:c}=t;return e(ET,{any:function(l){return Ie(l)},"Array | Matrix":function(l){var f;switch(Fe(l)?f=l.size():Array.isArray(l)?(l=r(l),f=l.size()):f=[],f.length){case 0:return Ie(l);case 1:if(f[0]===1)return Ie(l.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+qe(f)+")");case 2:{var m=f[0],p=f[1];if(m===p)return u(l.clone().valueOf(),m,p);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+qe(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+qe(f)+")")}}});function u(s,l,f){if(l===1)return Ie(s[0][0]);if(l===2)return n(i(s[0][0],s[1][1]),i(s[1][0],s[0][1]));for(var m=!1,p=new Array(l).fill(0).map((E,F)=>F),h=0;h<l;h++){var d=p[h];if(o(s[d][h])){var g=void 0;for(g=h+1;g<l;g++)if(!o(s[p[g]][h])){d=p[g],p[g]=p[h],p[h]=d,m=!m;break}if(g===l)return s[d][h]}for(var D=s[d][h],N=h===0?1:s[p[h-1]][h-1],v=h+1;v<l;v++)for(var w=p[v],b=h+1;b<l;b++)s[w][b]=a(n(i(s[w][b],D),i(s[w][h],s[d][b])),N)}var y=s[p[l-1]][l-1];return m?c(y):y}});var CT="inv",Hq=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],Yg=A(CT,Hq,t=>{var{typed:e,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:c,identity:u,abs:s}=t;return e(CT,{"Array | Matrix":function(m){var p=Fe(m)?m.size():ze(m);switch(p.length){case 1:if(p[0]===1)return Fe(m)?r([n(1,m.valueOf()[0])]):[n(1,m[0])];throw new RangeError("Matrix must be square (size: "+qe(p)+")");case 2:{var h=p[0],d=p[1];if(h===d)return Fe(m)?r(l(m.valueOf(),h,d),m.storage()):l(m,h,d);throw new RangeError("Matrix must be square (size: "+qe(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+qe(p)+")")}},any:function(m){return n(1,m)}});function l(f,m,p){var h,d,g,D,N;if(m===1){if(D=f[0][0],D===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,D)]]}else if(m===2){var v=c(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 w=f.concat();for(h=0;h<m;h++)w[h]=w[h].concat();for(var b=u(m).valueOf(),y=0;y<p;y++){var E=s(w[y][y]),F=y;for(h=y+1;h<m;)s(w[h][y])>E&&(E=s(w[h][y]),F=h),h++;if(E===0)throw Error("Cannot calculate inverse, determinant is zero");h=F,h!==y&&(N=w[y],w[y]=w[h],w[h]=N,N=b[y],b[y]=b[h],b[h]=N);var S=w[y],C=b[y];for(h=0;h<m;h++){var B=w[h],I=b[h];if(h!==y){if(B[y]!==0){for(g=n(o(B[y]),S[y]),d=y;d<p;d++)B[d]=i(B[d],a(g,S[d]));for(d=0;d<p;d++)I[d]=i(I[d],a(g,C[d]))}}else{for(g=S[y],d=y;d<p;d++)B[d]=n(B[d],g);for(d=0;d<p;d++)I[d]=n(I[d],g)}}}return b}}});var NT="pinv",Wq=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Jg=A(NT,Wq,t=>{var{typed:e,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:c,ctranspose:u,divideScalar:s,multiply:l,add:f,Complex:m}=t;return e(NT,{"Array | Matrix":function(v){var w=Fe(v)?v.size():ze(v);switch(w.length){case 1:return D(v)?u(v):w[0]===1?n(v):o(u(v),c(v,v));case 2:{if(D(v))return u(v);var b=w[0],y=w[1];if(b===y)try{return n(v)}catch(E){if(!(E instanceof Error&&E.message.match(/Cannot calculate inverse, determinant is zero/)))throw E}return Fe(v)?r(p(v.valueOf(),b,y),v.storage()):p(v,b,y)}default:throw new RangeError("Matrix must be two dimensional (size: "+qe(w)+")")}},any:function(v){return a(v,0)?Ie(v):s(1,v)}});function p(N,v,w){var{C:b,F:y}=d(N,v,w),E=l(n(l(u(b),b)),u(b)),F=l(u(y),n(l(y,u(y))));return l(F,E)}function h(N,v,w){for(var b=Ie(N),y=0,E=0;E<v;E++){if(w<=y)return b;for(var F=E;g(b[F][y]);)if(F++,v===F&&(F=E,y++,w===y))return b;[b[F],b[E]]=[b[E],b[F]];for(var S=b[E][y],C=0;C<w;C++)b[E][C]=o(b[E][C],S);for(var B=0;B<v;B++)if(B!==E){S=b[B][y];for(var I=0;I<w;I++)b[B][I]=f(b[B][I],l(-1,l(S,b[E][I])))}y++}return b}function d(N,v,w){var b=h(N,v,w),y=N.map((F,S)=>F.filter((C,B)=>B<v&&!g(c(b[B],b[B])))),E=b.filter((F,S)=>!g(c(b[S],b[S])));return{C:y,F:E}}function g(N){return a(f(N,m(1,1)),f(0,m(1,1)))}function D(N){return i(f(N,m(1,1)),f(l(N,0),m(1,1)))}});function AT(t){var{addScalar:e,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:c,abs:u,bignumber:s,diag:l,inv:f,qr:m,usolve:p,usolveAll:h,equal:d,complex:g,larger:D,smaller:N,matrixFromColumns:v,dot:w}=t;function b(z,Y,X,q,J){J===void 0&&(J=!0);var ae=y(z,Y,X,q,J);E(z,Y,X,q,J,ae);var{values:re,C:fe}=F(z,Y,X,q,J),he;return J&&(he=S(z,Y,fe,ae,re,X,q),he=v(...he)),{values:re,vectors:he}}function y(z,Y,X,q,J){var ae=q==="BigNumber",re=q==="Complex",fe=ae?s(0):0,he=ae?s(1):re?g(1):1,me=ae?s(1):1,ie=ae?s(10):2,xe=a(ie,ie),Me;J&&(Me=Array(Y).fill(he));for(var be=!1;!be;){be=!0;for(var Ce=0;Ce<Y;Ce++){for(var U=fe,G=fe,oe=0;oe<Y;oe++)if(Ce!==oe){var $=u(z[Ce][oe]);U=e(U,$),G=e(G,$)}if(!d(U,0)&&!d(G,0)){for(var j=me,te=U,ve=o(G,ie),pe=a(G,ie);N(te,ve);)te=a(te,xe),j=a(j,ie);for(;D(te,pe);)te=o(te,xe),j=o(j,ie);var Ne=N(o(e(te,G),j),a(e(U,G),.95));if(Ne){be=!1;for(var ge=o(1,j),We=0;We<Y;We++)Ce!==We&&(z[Ce][We]=a(z[Ce][We],j),z[We][Ce]=a(z[We][Ce],ge));J&&(Me[Ce]=a(Me[Ce],j))}}}}return l(Me)}function E(z,Y,X,q,J,ae){var re=q==="BigNumber",fe=q==="Complex",he=re?s(0):fe?g(0):0;re&&(X=s(X));for(var me=0;me<Y-2;me++){for(var ie=0,xe=he,Me=me+1;Me<Y;Me++){var be=z[Me][me];N(u(xe),u(be))&&(xe=be,ie=Me)}if(!N(u(xe),X)){if(ie!==me+1){var Ce=z[ie];z[ie]=z[me+1],z[me+1]=Ce;for(var U=0;U<Y;U++){var G=z[U][ie];z[U][ie]=z[U][me+1],z[U][me+1]=G}if(J){var oe=ae[ie];ae[ie]=ae[me+1],ae[me+1]=oe}}for(var $=me+2;$<Y;$++){var j=o(z[$][me],xe);if(j!==0){for(var te=0;te<Y;te++)z[$][te]=r(z[$][te],a(j,z[me+1][te]));for(var ve=0;ve<Y;ve++)z[ve][me+1]=e(z[ve][me+1],a(j,z[ve][$]));if(J)for(var pe=0;pe<Y;pe++)ae[$][pe]=r(ae[$][pe],a(j,ae[me+1][pe]))}}}}return ae}function F(z,Y,X,q,J){var ae=q==="BigNumber",re=q==="Complex",fe=ae?s(1):re?g(1):1;ae&&(X=s(X));for(var he=Ie(z),me=[],ie=Y,xe=[],Me=J?l(Array(Y).fill(fe)):void 0,be=J?l(Array(ie).fill(fe)):void 0,Ce=0;Ce<=100;){Ce+=1;for(var U=0,G=0;G<ie;G++)he[G][G]=r(he[G][G],U);var{Q:oe,R:$}=m(he);he=i($,oe);for(var j=0;j<ie;j++)he[j][j]=e(he[j][j],U);if(J&&(be=i(be,oe)),ie===1||N(u(he[ie-1][ie-2]),X)){Ce=0,me.push(he[ie-1][ie-1]),J&&(xe.unshift([[1]]),I(be,Y),Me=i(Me,be),ie>1&&(be=l(Array(ie-1).fill(fe)))),ie-=1,he.pop();for(var te=0;te<ie;te++)he[te].pop()}else if(ie===2||N(u(he[ie-2][ie-3]),X)){Ce=0;var ve=C(he[ie-2][ie-2],he[ie-2][ie-1],he[ie-1][ie-2],he[ie-1][ie-1]);me.push(...ve),J&&(xe.unshift(B(he[ie-2][ie-2],he[ie-2][ie-1],he[ie-1][ie-2],he[ie-1][ie-1],ve[0],ve[1],X,q)),I(be,Y),Me=i(Me,be),ie>2&&(be=l(Array(ie-2).fill(fe)))),ie-=2,he.pop(),he.pop();for(var pe=0;pe<ie;pe++)he[pe].pop(),he[pe].pop()}if(ie===0)break}if(me.sort((We,Ke)=>+r(u(We),u(Ke))),Ce>100){var Ne=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+me.join(", "));throw Ne.values=me,Ne.vectors=[],Ne}var ge=J?i(Me,L(xe,Y)):void 0;return{values:me,C:ge}}function S(z,Y,X,q,J,ae,re){var fe=f(X),he=i(fe,z,X),me=re==="BigNumber",ie=re==="Complex",xe=me?s(0):ie?g(0):0,Me=me?s(1):ie?g(1):1,be=[],Ce=[];for(var U of J){var G=k(be,U,d);G===-1?(be.push(U),Ce.push(1)):Ce[G]+=1}for(var oe=[],$=be.length,j=Array(Y).fill(xe),te=l(Array(Y).fill(Me)),ve=[],pe=function(){var Ke=be[Ne],dr=r(he,i(Ke,te)),wr=h(dr,j);for(wr.shift();wr.length<Ce[Ne];){var Br=P(dr,Y,wr,ae,re);if(Br==null){ve.push(Ke);break}wr.push(Br)}var gt=i(f(q),X);wr=wr.map(yt=>i(gt,yt)),oe.push(...wr.map(yt=>n(yt)))},Ne=0;Ne<$;Ne++)pe();if(ve.length!==0){var ge=new Error("Failed to find eigenvectors for the following eigenvalues: "+ve.join(", "));throw ge.values=J,ge.vectors=oe,ge}return oe}function C(z,Y,X,q){var J=e(z,q),ae=r(a(z,q),a(Y,X)),re=a(J,.5),fe=a(c(r(a(J,J),a(4,ae))),.5);return[e(re,fe),r(re,fe)]}function B(z,Y,X,q,J,ae,re,fe){var he=fe==="BigNumber",me=fe==="Complex",ie=he?s(0):me?g(0):0,xe=he?s(1):me?g(1):1;if(N(u(X),re))return[[xe,ie],[ie,xe]];if(D(u(r(J,ae)),re))return[[r(J,q),r(ae,q)],[X,X]];var Me=r(z,J),be=r(Y,J),Ce=r(X,J),U=r(q,J);return N(u(be),re)?[[Me,xe],[Ce,ie]]:[[be,ie],[U,xe]]}function I(z,Y){for(var X=0;X<z.length;X++)z[X].push(...Array(Y-z[X].length).fill(0));for(var q=z.length;q<Y;q++)z.push(Array(Y).fill(0)),z[q][q]=1;return z}function L(z,Y){for(var X=[],q=0;q<Y;q++)X[q]=Array(Y).fill(0);var J=0;for(var ae of z){for(var re=ae.length,fe=0;fe<re;fe++)for(var he=0;he<re;he++)X[J+fe][J+he]=ae[fe][he];J+=re}return X}function k(z,Y,X){for(var q=0;q<z.length;q++)if(X(z[q],Y))return q;return-1}function P(z,Y,X,q,J){for(var ae=J==="BigNumber"?s(1e3):1e3,re,fe=0;re=M(Y,X,J),re=p(z,re),!D(H(re),ae);)if(++fe>=5)return null;for(fe=0;;){var he=p(z,re);if(N(H(T(re,[he])),q))break;if(++fe>=10)return null;re=_(he)}return re}function M(z,Y,X){var q=X==="BigNumber",J=X==="Complex",ae=Array(z).fill(0).map(re=>2*Math.random()-1);return q&&(ae=ae.map(re=>s(re))),J&&(ae=ae.map(re=>g(re))),ae=T(ae,Y),_(ae,X)}function T(z,Y){for(var X of Y)z=r(z,i(o(w(X,z),w(X,X)),X));return z}function H(z){return u(c(w(z,z)))}function _(z,Y){var X=Y==="BigNumber",q=Y==="Complex",J=X?s(1):q?g(1):1;return i(o(J,H(z)),z)}return b}function FT(t){var{config:e,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:c,multiplyScalar:u,inv:s,bignumber:l,multiply:f,add:m}=t;function p(C,B){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.epsilon,L=arguments.length>3?arguments[3]:void 0;if(L==="number")return h(C,I);if(L==="BigNumber")return d(C,I);throw TypeError("Unsupported data type: "+L)}function h(C,B){for(var I=C.length,L=Math.abs(B/I),k,P=new Array(I),M=0;M<I;M++)P[M]=S(I,0),P[M][M]=1;for(var T=y(C);Math.abs(T[1])>=Math.abs(L);){var H=T[0][0],_=T[0][1];k=g(C[H][H],C[_][_],C[H][_]),C=b(C,k,H,_),P=N(P,k,H,_),T=y(C)}for(var z=S(I,0),Y=0;Y<I;Y++)z[Y]=C[Y][Y];return F(Ie(z),Ie(P))}function d(C,B){for(var I=C.length,L=i(B/I),k,P=new Array(I),M=0;M<I;M++)P[M]=S(I,0),P[M][M]=1;for(var T=E(C);i(T[1])>=i(L);){var H=T[0][0],_=T[0][1];k=D(C[H][H],C[_][_],C[H][_]),C=w(C,k,H,_),P=v(P,k,H,_),T=E(C)}for(var z=S(I,0),Y=0;Y<I;Y++)z[Y]=C[Y][Y];return F(Ie(z),Ie(P))}function g(C,B,I){var L=B-C;return Math.abs(L)<=e.epsilon?Math.PI/4:.5*Math.atan(2*I/(B-C))}function D(C,B,I){var L=n(B,C);return i(L)<=e.epsilon?l(-1).acos().div(4):u(.5,a(f(2,I,s(L))))}function N(C,B,I,L){for(var k=C.length,P=Math.cos(B),M=Math.sin(B),T=S(k,0),H=S(k,0),_=0;_<k;_++)T[_]=P*C[_][I]-M*C[_][L],H[_]=M*C[_][I]+P*C[_][L];for(var z=0;z<k;z++)C[z][I]=T[z],C[z][L]=H[z];return C}function v(C,B,I,L){for(var k=C.length,P=o(B),M=c(B),T=S(k,l(0)),H=S(k,l(0)),_=0;_<k;_++)T[_]=n(u(P,C[_][I]),u(M,C[_][L])),H[_]=r(u(M,C[_][I]),u(P,C[_][L]));for(var z=0;z<k;z++)C[z][I]=T[z],C[z][L]=H[z];return C}function w(C,B,I,L){for(var k=C.length,P=l(o(B)),M=l(c(B)),T=u(P,P),H=u(M,M),_=S(k,l(0)),z=S(k,l(0)),Y=f(l(2),P,M,C[I][L]),X=r(n(u(T,C[I][I]),Y),u(H,C[L][L])),q=m(u(H,C[I][I]),Y,u(T,C[L][L])),J=0;J<k;J++)_[J]=n(u(P,C[I][J]),u(M,C[L][J])),z[J]=r(u(M,C[I][J]),u(P,C[L][J]));C[I][I]=X,C[L][L]=q,C[I][L]=l(0),C[L][I]=l(0);for(var ae=0;ae<k;ae++)ae!==I&&ae!==L&&(C[I][ae]=_[ae],C[ae][I]=_[ae],C[L][ae]=z[ae],C[ae][L]=z[ae]);return C}function b(C,B,I,L){for(var k=C.length,P=Math.cos(B),M=Math.sin(B),T=P*P,H=M*M,_=S(k,0),z=S(k,0),Y=T*C[I][I]-2*P*M*C[I][L]+H*C[L][L],X=H*C[I][I]+2*P*M*C[I][L]+T*C[L][L],q=0;q<k;q++)_[q]=P*C[I][q]-M*C[L][q],z[q]=M*C[I][q]+P*C[L][q];C[I][I]=Y,C[L][L]=X,C[I][L]=0,C[L][I]=0;for(var J=0;J<k;J++)J!==I&&J!==L&&(C[I][J]=_[J],C[J][I]=_[J],C[L][J]=z[J],C[J][L]=z[J]);return C}function y(C){for(var B=C.length,I=0,L=[0,1],k=0;k<B;k++)for(var P=k+1;P<B;P++)Math.abs(I)<Math.abs(C[k][P])&&(I=Math.abs(C[k][P]),L=[k,P]);return[L,I]}function E(C){for(var B=C.length,I=0,L=[0,1],k=0;k<B;k++)for(var P=k+1;P<B;P++)i(I)<i(C[k][P])&&(I=i(C[k][P]),L=[k,P]);return[L,I]}function F(C,B){for(var I=C.length,L=Array(I),k=Array(I),P=0;P<I;P++)k[P]=Array(I);for(var M=0;M<I;M++){for(var T=0,H=C[0],_=0;_<C.length;_++)i(C[_])<i(H)&&(T=_,H=C[T]);L[M]=C.splice(T,1)[0];for(var z=0;z<I;z++)k[z][M]=B[z][T],B[z].splice(T,1)}return{values:L,vectors:k}}function S(C,B){for(var I=new Array(C),L=0;L<C;L++)I[L]=B;return I}return p}var Gq="eigs",Zq=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],Xg=A(Gq,Zq,t=>{var{config:e,typed:r,matrix:n,addScalar:i,subtract:a,equal:o,abs:c,atan:u,cos:s,sin:l,multiplyScalar:f,divideScalar:m,inv:p,bignumber:h,multiply:d,add:g,larger:D,column:N,flatten:v,number:w,complex:b,sqrt:y,diag:E,qr:F,usolve:S,usolveAll:C,im:B,re:I,smaller:L,matrixFromColumns:k,dot:P}=t,M=FT({config:e,addScalar:i,subtract:a,column:N,flatten:v,equal:o,abs:c,atan:u,cos:s,sin:l,multiplyScalar:f,inv:p,bignumber:h,complex:b,multiply:d,add:g}),T=AT({config:e,addScalar:i,subtract:a,multiply:d,multiplyScalar:f,flatten:v,divideScalar:m,sqrt:y,abs:c,bignumber:h,diag:E,qr:F,inv:p,usolve:S,usolveAll:C,equal:o,complex:b,larger:D,smaller:L,matrixFromColumns:k,dot:P});return r("eigs",{Array:function(J){var ae=n(J);return H(ae)},"Array, number|BigNumber":function(J,ae){var re=n(J);return H(re,ae)},Matrix:function(J){var{values:ae,vectors:re}=H(J);return{values:n(ae),vectors:n(re)}},"Matrix, number|BigNumber":function(J,ae){var{values:re,vectors:fe}=H(J,ae);return{values:n(re),vectors:n(fe)}}});function H(q,J){J===void 0&&(J=e.epsilon);var ae=q.size();if(ae.length!==2||ae[0]!==ae[1])throw new RangeError("Matrix must be square (size: "+qe(ae)+")");var re=q.toArray(),fe=ae[0];if(z(re,fe,J)&&(Y(re,fe),_(re,fe,J))){var he=X(q,re,fe);return M(re,fe,J,he)}var me=X(q,re,fe);return T(re,fe,J,me)}function _(q,J,ae){for(var re=0;re<J;re++)for(var fe=re;fe<J;fe++)if(D(h(c(a(q[re][fe],q[fe][re]))),ae))return!1;return!0}function z(q,J,ae){for(var re=0;re<J;re++)for(var fe=0;fe<J;fe++)if(D(h(c(B(q[re][fe]))),ae))return!1;return!0}function Y(q,J){for(var ae=0;ae<J;ae++)for(var re=0;re<J;re++)q[ae][re]=I(q[ae][re])}function X(q,J,ae){var re=q.datatype();if(re==="number"||re==="BigNumber"||re==="Complex")return re;for(var fe=!1,he=!1,me=!1,ie=0;ie<ae;ie++)for(var xe=0;xe<ae;xe++){var Me=J[ie][xe];if(He(Me)||Ti(Me))fe=!0;else if(Le(Me))he=!0;else if(Wt(Me))me=!0;else throw TypeError("Unsupported type in Matrix: "+nr(Me))}if(he&&me&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),me){for(var be=0;be<ae;be++)for(var Ce=0;Ce<ae;Ce++)J[be][Ce]=b(J[be][Ce]);return"Complex"}if(he){for(var U=0;U<ae;U++)for(var G=0;G<ae;G++)J[U][G]=h(J[U][G]);return"BigNumber"}if(fe){for(var oe=0;oe<ae;oe++)for(var $=0;$<ae;$++)J[oe][$]=w(J[oe][$]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var ST="expm",jq=["typed","abs","add","identity","inv","multiply"],Qg=A(ST,jq,t=>{var{typed:e,abs:r,add:n,identity:i,inv:a,multiply:o}=t;return e(ST,{Matrix:function(f){var m=f.size();if(m.length!==2||m[0]!==m[1])throw new RangeError("Matrix must be square (size: "+qe(m)+")");for(var p=m[0],h=1e-15,d=c(f),g=u(d,h),D=g.q,N=g.j,v=o(f,Math.pow(2,-N)),w=i(p),b=i(p),y=1,E=v,F=-1,S=1;S<=D;S++)S>1&&(E=o(E,v),F=-F),y=y*(D-S+1)/((2*D-S+1)*S),w=n(w,o(y,E)),b=n(b,o(y*F,E));for(var C=o(a(b),w),B=0;B<N;B++)C=o(C,C);return Jn(f)?f.createSparseMatrix(C):C}});function c(l){for(var f=l.size()[0],m=0,p=0;p<f;p++){for(var h=0,d=0;d<f;d++)h+=r(l.get([p,d]));m=Math.max(h,m)}return m}function u(l,f){for(var m=30,p=0;p<m;p++)for(var h=0;h<=p;h++){var d=p-h;if(s(l,h,d)<f)return{q:h,j:d}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function s(l,f,m){for(var p=1,h=2;h<=f;h++)p*=h;for(var d=p,g=f+1;g<=2*f;g++)d*=g;var D=d*(2*f+1);return 8*Math.pow(l/Math.pow(2,m),2*f)*p*p/(d*D)}});var MT="sqrtm",Yq=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],Kg=A(MT,Yq,t=>{var{typed:e,abs:r,add:n,multiply:i,map:a,sqrt:o,subtract:c,inv:u,size:s,max:l,identity:f}=t,m=1e3,p=1e-6;function h(d){var g,D=0,N=d,v=f(s(d));do{var w=N;if(N=i(.5,n(w,u(v))),v=i(.5,n(v,u(w))),g=l(r(c(N,w))),g>p&&++D>m)throw new Error("computing square root of matrix: iterative method could not converge")}while(g>p);return N}return e(MT,{"Array | Matrix":function(g){var D=Fe(g)?g.size():ze(g);switch(D.length){case 1:if(D[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+qe(D)+")");case 2:{var N=D[0],v=D[1];if(N===v)return h(g);throw new RangeError("Matrix must be square (size: "+qe(D)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+qe(D)+")")}}})});var TT="sylvester",Jq=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],e0=A(TT,Jq,t=>{var{typed:e,schur:r,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:c,transpose:u,index:s,subset:l,add:f,subtract:m,identity:p,lusolve:h,abs:d}=t;return e(TT,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(N,v,w){return g(i(N),v,w)},"Array, Array, Matrix":function(N,v,w){return g(i(N),i(v),w)},"Array, Matrix, Array":function(N,v,w){return g(i(N),v,i(w))},"Matrix, Array, Matrix":function(N,v,w){return g(N,i(v),w)},"Matrix, Array, Array":function(N,v,w){return g(N,i(v),i(w))},"Matrix, Matrix, Array":function(N,v,w){return g(N,v,i(w))},"Array, Array, Array":function(N,v,w){return g(i(N),i(v),i(w)).toArray()}});function g(D,N,v){for(var w=N.size()[0],b=D.size()[0],y=r(D),E=y.T,F=y.U,S=r(a(-1,N)),C=S.T,B=S.U,I=a(a(u(F),v),B),L=o(0,b),k=[],P=(Me,be)=>c(Me,be,1),M=(Me,be)=>c(Me,be,0),T=0;T<w;T++)if(T<w-1&&d(l(C,s(T+1,T)))>1e-5){for(var H=M(l(I,s(L,T)),l(I,s(L,T+1))),_=0;_<T;_++)H=f(H,M(a(k[_],l(C,s(_,T))),a(k[_],l(C,s(_,T+1)))));var z=a(p(b),a(-1,l(C,s(T,T)))),Y=a(p(b),a(-1,l(C,s(T+1,T)))),X=a(p(b),a(-1,l(C,s(T,T+1)))),q=a(p(b),a(-1,l(C,s(T+1,T+1)))),J=M(P(f(E,z),Y),P(X,f(E,q))),ae=h(J,H);k[T]=ae.subset(s(o(0,b),0)),k[T+1]=ae.subset(s(o(b,2*b),0)),T++}else{for(var re=l(I,s(L,T)),fe=0;fe<T;fe++)re=f(re,a(k[fe],l(C,s(fe,T))));var he=l(C,s(T,T)),me=m(E,a(he,p(b)));k[T]=h(me,re)}var ie=i(n(...k)),xe=a(F,a(ie,u(B)));return xe}});var OT="schur",Xq=["typed","matrix","identity","multiply","qr","norm","subtract"],r0=A(OT,Xq,t=>{var{typed:e,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:c}=t;return e(OT,{Array:function(l){var f=u(r(l));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(l){return u(l)}});function u(s){var l=s.size()[0],f=s,m=n(l),p=0,h;do{h=f;var d=a(f),g=d.Q,D=d.R;if(f=i(D,g),m=i(m,g),p++>100)break}while(o(c(f,h))>1e-4);return{U:m,T:f}}});var BT="lyap",Qq=["typed","matrix","sylvester","multiply","transpose"],t0=A(BT,Qq,t=>{var{typed:e,matrix:r,sylvester:n,multiply:i,transpose:a}=t;return e(BT,{"Matrix, Matrix":function(c,u){return n(c,a(c),i(-1,u))},"Array, Matrix":function(c,u){return n(r(c),a(r(c)),i(-1,u))},"Matrix, Array":function(c,u){return n(c,a(r(c)),r(i(-1,u)))},"Array, Array":function(c,u){return n(r(c),a(r(c)),r(i(-1,u))).toArray()}})});var Kq="divide",ez=["typed","matrix","multiply","equalScalar","divideScalar","inv"],n0=A(Kq,ez,t=>{var{typed:e,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=t,c=Dr({typed:e,equalScalar:i}),u=ft({typed:e});return e("divide",vl({"Array | Matrix, Array | Matrix":function(l,f){return n(l,o(f))},"DenseMatrix, any":function(l,f){return u(l,f,a,!1)},"SparseMatrix, any":function(l,f){return c(l,f,a,!1)},"Array, any":function(l,f){return u(r(l),f,a,!1).valueOf()},"any, Array | Matrix":function(l,f){return n(l,o(f))}},a.signatures))});var IT="distance",rz=["typed","addScalar","subtract","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],i0=A(IT,rz,t=>{var{typed:e,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:c,abs:u}=t;return e(IT,{"Array, Array, Array":function(b,y,E){if(b.length===2&&y.length===2&&E.length===2){if(!l(b))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(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(y,E))throw new TypeError("LinePoint1 should not be same with LinePoint2");var F=n(E[1],y[1]),S=n(y[0],E[0]),C=n(i(E[0],y[1]),i(y[0],E[1]));return g(b[0],b[1],F,S,C)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(b,y,E){if(Object.keys(b).length===2&&Object.keys(y).length===2&&Object.keys(E).length===2){if(!l(b))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(E))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(y),h(E)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in b&&"pointY"in b&&"lineOnePtX"in y&&"lineOnePtY"in y&&"lineTwoPtX"in E&&"lineTwoPtY"in E){var F=n(E.lineTwoPtY,y.lineOnePtY),S=n(y.lineOnePtX,E.lineTwoPtX),C=n(i(E.lineTwoPtX,y.lineOnePtY),i(y.lineOnePtX,E.lineTwoPtY));return g(b.pointX,b.pointY,F,S,C)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(b,y){if(b.length===2&&y.length===3){if(!l(b))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 g(b[0],b[1],y[0],y[1],y[2])}else if(b.length===3&&y.length===6){if(!f(b))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(y))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return D(b[0],b[1],b[2],y[0],y[1],y[2],y[3],y[4],y[5])}else if(b.length===y.length&&b.length>0){if(!m(b))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(y))throw new TypeError("All values of an array should be numbers or BigNumbers");return N(b,y)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(b,y){if(Object.keys(b).length===2&&Object.keys(y).length===3){if(!l(b))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 b&&"pointY"in b&&"xCoeffLine"in y&&"yCoeffLine"in y&&"constant"in y)return g(b.pointX,b.pointY,y.xCoeffLine,y.yCoeffLine,y.constant);throw new TypeError("Key names do not match")}else if(Object.keys(b).length===3&&Object.keys(y).length===6){if(!f(b))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(y))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in b&&"pointY"in b&&"x0"in y&&"y0"in y&&"z0"in y&&"a"in y&&"b"in y&&"c"in y)return D(b.pointX,b.pointY,b.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(b).length===2&&Object.keys(y).length===2){if(!l(b))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 b&&"pointOneY"in b&&"pointTwoX"in y&&"pointTwoY"in y)return N([b.pointOneX,b.pointOneY],[y.pointTwoX,y.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(b).length===3&&Object.keys(y).length===3){if(!f(b))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 b&&"pointOneY"in b&&"pointOneZ"in b&&"pointTwoX"in y&&"pointTwoY"in y&&"pointTwoZ"in y)return N([b.pointOneX,b.pointOneY,b.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(b){if(!d(b))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return v(b)}});function s(w){return typeof w=="number"||Le(w)}function l(w){return w.constructor!==Array&&(w=h(w)),s(w[0])&&s(w[1])}function f(w){return w.constructor!==Array&&(w=h(w)),s(w[0])&&s(w[1])&&s(w[2])}function m(w){return Array.isArray(w)||(w=h(w)),w.every(s)}function p(w){return w.constructor!==Array&&(w=h(w)),s(w[0])&&s(w[1])&&s(w[2])&&s(w[3])&&s(w[4])&&s(w[5])}function h(w){for(var b=Object.keys(w),y=[],E=0;E<b.length;E++)y.push(w[b[E]]);return y}function d(w){if(w[0].length===2&&s(w[0][0])&&s(w[0][1])){if(w.some(b=>b.length!==2||!s(b[0])||!s(b[1])))return!1}else if(w[0].length===3&&s(w[0][0])&&s(w[0][1])&&s(w[0][2])){if(w.some(b=>b.length!==3||!s(b[0])||!s(b[1])||!s(b[2])))return!1}else return!1;return!0}function g(w,b,y,E,F){var S=u(r(r(i(y,w),i(E,b)),F)),C=c(r(i(y,y),i(E,E)));return a(S,C)}function D(w,b,y,E,F,S,C,B,I){var L=[n(i(n(F,b),I),i(n(S,y),B)),n(i(n(S,y),C),i(n(E,w),I)),n(i(n(E,w),B),i(n(F,b),C))];L=c(r(r(i(L[0],L[0]),i(L[1],L[1])),i(L[2],L[2])));var k=c(r(r(i(C,C),i(B,B)),i(I,I)));return a(L,k)}function N(w,b){for(var y=w.length,E=0,F=0,S=0;S<y;S++)F=n(w[S],b[S]),E=r(i(F,F),E);return c(E)}function v(w){for(var b=[],y=[],E=[],F=0;F<w.length-1;F++)for(var S=F+1;S<w.length;S++)w[0].length===2?(y=[w[F][0],w[F][1]],E=[w[S][0],w[S][1]]):w[0].length===3&&(y=[w[F][0],w[F][1],w[F][2]],E=[w[S][0],w[S][1],w[S][2]]),b.push(N(y,E));return b}});var tz="intersect",nz=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],a0=A(tz,nz,t=>{var{typed:e,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:c,multiplyScalar:u,divideScalar:s,subtract:l,smaller:f,equalScalar:m,flatten:p,isZero:h,isNumeric:d}=t;return e("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":D,"Matrix, Matrix, Matrix":function(B,I,L){var k=g(B.valueOf(),I.valueOf(),L.valueOf());return k===null?null:o(k)},"Matrix, Matrix, Matrix, Matrix":function(B,I,L,k){var P=D(B.valueOf(),I.valueOf(),L.valueOf(),k.valueOf());return P===null?null:o(P)}});function g(C,B,I){if(C=N(C),B=N(B),I=N(I),!w(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!b(I))throw new TypeError("Array with 4 numbers expected as third argument");return S(C[0],C[1],C[2],B[0],B[1],B[2],I[0],I[1],I[2],I[3])}function D(C,B,I,L){if(C=N(C),B=N(B),I=N(I),L=N(L),C.length===2){if(!v(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!v(B))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!v(I))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!v(L))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return y(C,B,I,L)}else if(C.length===3){if(!w(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(I))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!w(L))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return F(C[0],C[1],C[2],B[0],B[1],B[2],I[0],I[1],I[2],L[0],L[1],L[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function N(C){return C.length===1?C[0]:C.length>1&&Array.isArray(C[0])&&C.every(B=>Array.isArray(B)&&B.length===1)?p(C):C}function v(C){return C.length===2&&d(C[0])&&d(C[1])}function w(C){return C.length===3&&d(C[0])&&d(C[1])&&d(C[2])}function b(C){return C.length===4&&d(C[0])&&d(C[1])&&d(C[2])&&d(C[3])}function y(C,B,I,L){var k=C,P=I,M=l(k,B),T=l(P,L),H=l(u(M[0],T[1]),u(T[0],M[1]));if(h(H)||f(n(H),r.epsilon))return null;var _=u(T[0],k[1]),z=u(T[1],k[0]),Y=u(T[0],P[1]),X=u(T[1],P[0]),q=s(a(l(l(_,z),Y),X),H);return i(c(M,q),k)}function E(C,B,I,L,k,P,M,T,H,_,z,Y){var X=u(l(C,B),l(I,L)),q=u(l(k,P),l(M,T)),J=u(l(H,_),l(z,Y));return a(a(X,q),J)}function F(C,B,I,L,k,P,M,T,H,_,z,Y){var X=E(C,M,_,M,B,T,z,T,I,H,Y,H),q=E(_,M,L,C,z,T,k,B,Y,H,P,I),J=E(C,M,L,C,B,T,k,B,I,H,P,I),ae=E(_,M,_,M,z,T,z,T,Y,H,Y,H),re=E(L,C,L,C,k,B,k,B,P,I,P,I),fe=l(u(X,q),u(J,ae)),he=l(u(re,ae),u(q,q));if(h(he))return null;var me=s(fe,he),ie=s(a(X,u(me,q)),ae),xe=a(C,u(me,l(L,C))),Me=a(B,u(me,l(k,B))),be=a(I,u(me,l(P,I))),Ce=a(M,u(ie,l(_,M))),U=a(T,u(ie,l(z,T))),G=a(H,u(ie,l(Y,H)));return m(xe,Ce)&&m(Me,U)&&m(be,G)?[xe,Me,be]:null}function S(C,B,I,L,k,P,M,T,H,_){var z=u(C,M),Y=u(L,M),X=u(B,T),q=u(k,T),J=u(I,H),ae=u(P,H),re=l(l(l(_,z),X),J),fe=l(l(l(a(a(Y,q),ae),z),X),J),he=s(re,fe),me=a(C,u(he,l(L,C))),ie=a(B,u(he,l(k,B))),xe=a(I,u(he,l(P,I)));return[me,ie,xe]}});var _T="sum",iz=["typed","config","add","numeric"],Ks=A(_T,iz,t=>{var{typed:e,config:r,add:n,numeric:i}=t;return e(_T,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(u){if(On(u))throw new TypeError("Scalar values expected in function sum");return a(u)}});function a(c){var u;return Vt(c,function(s){try{u=u===void 0?s:n(u,s)}catch(l){throw Qr(l,"sum",s)}}),u===void 0&&(u=i(0,r.number)),typeof u=="string"&&(u=i(u,r.number)),u}function o(c,u){try{var s=ea(c,u,n);return s}catch(l){throw Qr(l,"sum")}}});var Ec="cumsum",az=["typed","add","unaryPlus"],eu=A(Ec,az,t=>{var{typed:e,add:r,unaryPlus:n}=t;return e(Ec,{Array:i,Matrix:function(s){return s.create(i(s.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(s,l){return s.create(o(s.valueOf(),l))},"...":function(s){if(On(s))throw new TypeError("All values expected to be scalar in function cumsum");return i(s)}});function i(u){try{return a(u)}catch(s){throw Qr(s,Ec)}}function a(u){if(u.length===0)return[];for(var s=[n(u[0])],l=1;l<u.length;++l)s.push(r(s[l-1],u[l]));return s}function o(u,s){var l=ze(u);if(s<0||s>=l.length)throw new Pt(s,l.length);try{return c(u,s)}catch(f){throw Qr(f,Ec)}}function c(u,s){var l,f,m;if(s<=0){var p=u[0][0];if(Array.isArray(p)){for(m=kl(u),f=[],l=0;l<m.length;l++)f[l]=c(m[l],s-1);return f}else return a(u)}else{for(f=[],l=0;l<u.length;l++)f[l]=c(u[l],s-1);return f}}});var RT="mean",oz=["typed","add","divide"],ru=A(RT,oz,t=>{var{typed:e,add:r,divide:n}=t;return e(RT,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(c){if(On(c))throw new TypeError("Scalar values expected in function mean");return a(c)}});function i(o,c){try{var u=ea(o,c,r),s=Array.isArray(o)?ze(o):o.size();return n(u,s[c])}catch(l){throw Qr(l,"mean")}}function a(o){var c,u=0;if(Vt(o,function(s){try{c=c===void 0?s:r(c,s),u++}catch(l){throw Qr(l,"mean",s)}}),u===0)throw new Error("Cannot calculate the mean of an empty array");return n(c,u)}});var PT="median",sz=["typed","add","divide","compare","partitionSelect"],o0=A(PT,sz,t=>{var{typed:e,add:r,divide:n,compare:i,partitionSelect:a}=t;function o(s){try{s=Ge(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,m=a(s,f+1),p=s[f],h=0;h<f;++h)i(s[h],p)>0&&(p=s[h]);return u(p,m)}else{var d=a(s,(l-1)/2);return c(d)}}catch(g){throw Qr(g,"median")}}var c=e({"number | BigNumber | Complex | Unit":function(l){return l}}),u=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(l,f){return n(r(l,f),2)}});return e(PT,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,f){throw new Error("median(A, dim) is not yet supported")},"...":function(l){if(On(l))throw new TypeError("Scalar values expected in function median");return o(l)}})});var LT="mad",uz=["typed","abs","map","median","subtract"],s0=A(LT,uz,t=>{var{typed:e,abs:r,map:n,median:i,subtract:a}=t;return e(LT,{"Array | Matrix":o,"...":function(u){return o(u)}});function o(c){if(c=Ge(c.valueOf()),c.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var u=i(c);return i(n(c,function(s){return r(a(s,u))}))}catch(s){throw s instanceof TypeError&&s.message.indexOf("median")!==-1?new TypeError(s.message.replace("median","mad")):Qr(s,"mad")}}});var u0="unbiased",kT="variance",lz=["typed","add","subtract","multiply","divide","apply","isNaN"],tu=A(kT,lz,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:c}=t;return e(kT,{"Array | Matrix":function(f){return u(f,u0)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(f,m){return s(f,m,u0)},"Array | Matrix, number | BigNumber, string":s,"...":function(f){return u(f,u0)}});function u(l,f){var m,p=0;if(l.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Vt(l,function(g){try{m=m===void 0?g:r(m,g),p++}catch(D){throw Qr(D,"variance",g)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var h=a(m,p);if(m=void 0,Vt(l,function(g){var D=n(g,h);m=m===void 0?i(D,D):r(m,i(D,D))}),c(m))return m;switch(f){case"uncorrected":return a(m,p);case"biased":return a(m,p+1);case"unbiased":{var d=Le(m)?m.mul(0):0;return p===1?d:a(m,p-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function s(l,f,m){try{if(l.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(l,f,p=>u(p,m))}catch(p){throw Qr(p,"variance")}}});var cz="quantileSeq",fz=["typed","add","multiply","partitionSelect","compare"],l0=A(cz,fz,t=>{var{typed:e,add:r,multiply:n,partitionSelect:i,compare:a}=t;function o(s,l,f){var m,p,h;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(St(s)){if(f=f||!1,typeof f=="boolean"){if(p=s.valueOf(),He(l)){if(l<0)throw new Error("N/prob must be non-negative");if(l<=1)return c(p,l,f);if(l>1){if(!Ae(l))throw new Error("N must be a positive integer");var d=l+1;m=new Array(l);for(var g=0;g<l;)m[g]=c(p,++g/d,f);return m}}if(Le(l)){var D=l.constructor;if(l.isNegative())throw new Error("N/prob must be non-negative");if(h=new D(1),l.lte(h))return new D(c(p,l,f));if(l.gt(h)){if(!l.isInteger())throw new Error("N must be a positive integer");var N=l.toNumber();if(N>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 v=new D(N+1);m=new Array(N);for(var w=0;w<N;)m[w]=new D(c(p,new D(++w).div(v),f));return m}}if(St(l)){var b=l.valueOf();m=new Array(b.length);for(var y=0;y<m.length;++y){var E=b[y];if(He(E)){if(E<0||E>1)throw new Error("Probability must be between 0 and 1, inclusive")}else if(Le(E)){if(h=new E.constructor(1),E.isNegative()||E.gt(h))throw new Error("Probability must be between 0 and 1, inclusive")}else throw new TypeError("Unexpected type of argument in function quantileSeq");m[y]=c(p,E,f)}return m}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}function c(s,l,f){var m=Ge(s),p=m.length;if(p===0)throw new Error("Cannot calculate quantile of an empty sequence");if(He(l)){var h=l*(p-1),d=h%1;if(d===0){var g=f?m[h]:i(m,h);return u(g),g}var D=Math.floor(h),N,v;if(f)N=m[D],v=m[D+1];else{v=i(m,D+1),N=m[D];for(var w=0;w<D;++w)a(m[w],N)>0&&(N=m[w])}return u(N),u(v),r(n(N,1-d),n(v,d))}var b=l.times(p-1);if(b.isInteger()){b=b.toNumber();var y=f?m[b]:i(m,b);return u(y),y}var E=b.floor(),F=b.minus(E),S=E.toNumber(),C,B;if(f)C=m[S],B=m[S+1];else{B=i(m,S+1),C=m[S];for(var I=0;I<S;++I)a(m[I],C)>0&&(C=m[I])}u(C),u(B);var L=new F.constructor(1);return r(n(C,L.minus(F)),n(B,F))}var u=e({"number | BigNumber | Unit":function(l){return l}});return o});var qT="std",mz=["typed","map","sqrt","variance"],nu=A(qT,mz,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t;return e(qT,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(c){return a(c)}});function a(o,c){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var u=i.apply(null,arguments);return St(u)?r(u,n):n(u)}catch(s){throw s instanceof TypeError&&s.message.indexOf(" variance")!==-1?new TypeError(s.message.replace(" variance"," std")):s}}});var zT="combinations",pz=["typed"],c0=A(zT,pz,t=>{var{typed:e}=t;return e(zT,{"number, number":Ep,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,c,u=n.minus(i),s=new a(1);if(!UT(n)||!UT(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=s,i.lt(u))for(c=s;c.lte(u);c=c.plus(s))o=o.times(i.plus(c)).dividedBy(c);else for(c=s;c.lte(i);c=c.plus(s))o=o.times(u.plus(c)).dividedBy(c);return o}})});function UT(t){return t.isInteger()&&t.gte(0)}var VT="combinationsWithRep",dz=["typed"],f0=A(VT,dz,t=>{var{typed:e}=t;return e(VT,{"number, number":function(n,i){if(!Ae(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ae(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=dn(n,n+i-1);return a/dn(1,i)}var o=dn(i+1,n+i-1);return o/dn(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,c,u=new a(1),s=n.minus(u);if(!$T(n)||!$T(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(u))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=u,i.lt(s))for(c=u;c.lte(s);c=c.plus(u))o=o.times(i.plus(c)).dividedBy(c);else for(c=u;c.lte(i);c=c.plus(u))o=o.times(s.plus(c)).dividedBy(c);return o}})});function $T(t){return t.isInteger()&&t.gte(0)}var HT="gamma",hz=["typed","config","multiplyScalar","pow","BigNumber","Complex"],m0=A(HT,hz,t=>{var{typed:e,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=t;function c(s){if(s.im===0)return ks(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(c(l))}s=new o(s.re-1,s.im);for(var m=new o(Ia[0],0),p=1;p<Ia.length;++p){var h=new o(Ia[p],0);m=m.add(h.div(s.add(p)))}var d=new o(s.re+Mp+.5,s.im),g=Math.sqrt(2*Math.PI),D=d.pow(s.add(.5)),N=d.neg().exp();return m.mul(g).mul(D).mul(N)}return e(HT,{number:ks,Complex:c,BigNumber:function(l){if(l.isInteger())return l.isNegative()||l.isZero()?new a(1/0):u(l.minus(1));if(!l.isFinite())return new a(l.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function u(s){if(s<8)return new a([1,1,2,6,24,120,720,5040][s]);var l=r.precision+(Math.log(s.toNumber())|0),f=a.clone({precision:l});if(s%2===1)return s.times(u(new a(s-1)));for(var m=s,p=new f(s),h=s.toNumber();m>2;)m-=2,h+=m,p=p.times(h);return new a(p.toPrecision(a.precision))}});var WT="lgamma",vz=["Complex","typed"],p0=A(WT,vz,t=>{var{Complex:e,typed:r}=t,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(WT,{number:qs,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,m=.1;if(s.isNaN())return new e(NaN,NaN);if(s.im===0)return new e(qs(s.re),0);if(s.re>=n||Math.abs(s.im)>=i)return c(s);if(s.re<=m){var p=Lw(l,s.im)*Math.floor(.5*s.re+.25),h=s.mul(Math.PI).sin().log(),d=o(new e(1-s.re,-s.im));return new e(f,p).sub(h).sub(d)}else return s.im>=0?u(s):u(s.conjugate()).conjugate()}function c(s){for(var l=s.sub(.5).mul(s.log()).sub(s).add(Tp),f=new e(1,0).div(s),m=f.div(s),p=a[0],h=a[1],d=2*m.re,g=m.re*m.re+m.im*m.im,D=2;D<8;D++){var N=h;h=-g*p+a[D],p=d*p+N}var v=f.mul(m.mul(p).add(h));return l.add(v)}function u(s){var l=0,f=0,m=s;for(s=s.add(1);s.re<=n;){m=m.mul(s);var p=m.im<0?1:0;p!==0&&f===0&&l++,f=p,s=s.add(1)}return c(s).sub(m.log()).sub(new e(0,l*2*Math.PI*1))}});var GT="factorial",gz=["typed","gamma"],d0=A(GT,gz,t=>{var{typed:e,gamma:r}=t;return e(GT,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return r(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return r(i.plus(1))},"Array | Matrix":e.referToSelf(n=>i=>Oe(i,n))})});var ZT="kldivergence",yz=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],h0=A(ZT,yz,t=>{var{typed:e,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:c,log:u,isNumeric:s}=t;return e(ZT,{"Array, Array":function(m,p){return l(r(m),r(p))},"Matrix, Array":function(m,p){return l(m,r(p))},"Array, Matrix":function(m,p){return l(r(m),p)},"Matrix, Matrix":function(m,p){return l(m,p)}});function l(f,m){var p=m.size().length,h=f.size().length;if(p>1)throw new Error("first object must be one dimensional");if(h>1)throw new Error("second object must be one dimensional");if(p!==h)throw new Error("Length of two vectors must be equal");var d=i(f);if(d===0)throw new Error("Sum of elements in first object must be non zero");var g=i(m);if(g===0)throw new Error("Sum of elements in second object must be non zero");var D=n(f,i(f)),N=n(m,i(m)),v=i(a(D,o(c(D,N),w=>u(w))));return s(v)?v:Number.NaN}});var jT="multinomial",xz=["typed","add","divide","multiply","factorial","isInteger","isPositive"],v0=A(jT,xz,t=>{var{typed:e,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:c}=t;return e(jT,{"Array | Matrix":function(s){var l=0,f=1;return Vt(s,function(m){if(!o(m)||!c(m))throw new TypeError("Positive integer value expected in function multinomial");l=r(l,m),f=i(f,a(m))}),n(a(l),f)}})});var YT="permutations",Dz=["typed","factorial"],g0=A(YT,Dz,t=>{var{typed:e,factorial:r}=t;return e(YT,{"number | BigNumber":r,"number, number":function(i,a){if(!Ae(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ae(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 dn(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,c;if(!JT(i)||!JT(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var u=i.mul(0).add(1);for(o=u,c=i.minus(a).plus(1);c.lte(i);c=c.plus(1))o=o.times(c);return o}})});function JT(t){return t.isInteger()&&t.gte(0)}var C0=Yt(m3(),1),Fz=(0,C0.default)(Date.now());function Li(t){var e;function r(i){e=i===null?Fz:(0,C0.default)(String(i))}r(t);function n(){return e()}return n}var p3="pickRandom",Sz=["typed","config","?on"],N0=A(p3,Sz,t=>{var{typed:e,config:r,on:n}=t,i=Li(r.randomSeed);return n&&n("config",function(o,c){o.randomSeed!==c.randomSeed&&(i=Li(o.randomSeed))}),e(p3,{"Array | Matrix":function(c){return a(c,{})},"Array | Matrix, Object":function(c,u){return a(c,u)},"Array | Matrix, number":function(c,u){return a(c,{number:u})},"Array | Matrix, Array | Matrix":function(c,u){return a(c,{weights:u})},"Array | Matrix, Array | Matrix, number":function(c,u,s){return a(c,{number:s,weights:u})},"Array | Matrix, number, Array | Matrix":function(c,u,s){return a(c,{number:u,weights:s})}});function a(o,c){var{number:u,weights:s,elementWise:l=!0}=c,f=typeof u=="undefined";f&&(u=1);var m=Fe(o)?o.create:Fe(s)?s.create:null;o=o.valueOf(),s&&(s=s.valueOf()),l===!0&&(o=Ge(o),s=Ge(s));var p=0;if(typeof s!="undefined"){if(s.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var h=0,d=s.length;h<d;h++){if(!He(s[h])||s[h]<0)throw new Error("Weights must be an array of positive numbers");p+=s[h]}}for(var g=o.length,D=[],N;D.length<u;){if(typeof s=="undefined")N=o[Math.floor(i()*g)];else for(var v=i()*p,w=0,b=o.length;w<b;w++)if(v-=s[w],v<0){N=o[w];break}D.push(N)}return f?D[0]:m?m(D):D}});function iu(t,e){var r=[];if(t=t.slice(0),t.length>1)for(var n=0,i=t.shift();n<i;n++)r.push(iu(t,e));else for(var a=0,o=t.shift();a<o;a++)r.push(e());return r}var d3="random",Mz=["typed","config","?on"],A0=A(d3,Mz,t=>{var{typed:e,config:r,on:n}=t,i=Li(r.randomSeed);return n&&n("config",function(c,u){c.randomSeed!==u.randomSeed&&(i=Li(c.randomSeed))}),e(d3,{"":()=>o(0,1),number:c=>o(0,c),"number, number":(c,u)=>o(c,u),"Array | Matrix":c=>a(c,0,1),"Array | Matrix, number":(c,u)=>a(c,0,u),"Array | Matrix, number, number":(c,u,s)=>a(c,u,s)});function a(c,u,s){var l=iu(c.valueOf(),()=>o(u,s));return Fe(c)?c.create(l):l}function o(c,u){return c+i()*(u-c)}});var h3="randomInt",Tz=["typed","config","?on"],F0=A(h3,Tz,t=>{var{typed:e,config:r,on:n}=t,i=Li(r.randomSeed);return n&&n("config",function(c,u){c.randomSeed!==u.randomSeed&&(i=Li(c.randomSeed))}),e(h3,{"":()=>o(0,1),number:c=>o(0,c),"number, number":(c,u)=>o(c,u),"Array | Matrix":c=>a(c,0,1),"Array | Matrix, number":(c,u)=>a(c,0,u),"Array | Matrix, number, number":(c,u,s)=>a(c,u,s)});function a(c,u,s){var l=iu(c.valueOf(),()=>o(u,s));return Fe(c)?c.create(l):l}function o(c,u){return Math.floor(c+i()*(u-c))}});var v3="stirlingS2",Oz=["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],S0=A(v3,Oz,t=>{var{typed:e,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:c,combinations:u,isNegative:s,isInteger:l,number:f,bignumber:m,larger:p}=t,h=[],d=[];return e(v3,{"number | BigNumber, number | BigNumber":function(D,N){if(!l(D)||s(D)||!l(N)||s(N))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(N,D))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(He(D)&&He(N)),w=v?d:h,b=v?m:f,y=f(D),E=f(N);if(w[y]&&w[y].length>E)return w[y][E];for(var F=0;F<=y;++F)if(w[F]||(w[F]=[b(F===0?1:0)]),F!==0)for(var S=w[F],C=w[F-1],B=S.length;B<=F&&B<=E;++B)B===F?S[B]=1:S[B]=r(i(b(B),C[B]),C[B-1]);return w[y][E]}})});var g3="bellNumbers",Bz=["typed","addScalar","isNegative","isInteger","stirlingS2"],M0=A(g3,Bz,t=>{var{typed:e,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=t;return e(g3,{"number | BigNumber":function(c){if(!i(c)||n(c))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var u=0,s=0;s<=c;s++)u=r(u,a(c,s));return u}})});var y3="catalan",Iz=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],T0=A(y3,Iz,t=>{var{typed:e,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:c}=t;return e(y3,{"number | BigNumber":function(s){if(!c(s)||o(s))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(s,2),s),r(s,1))}})});var x3="composition",_z=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],O0=A(x3,_z,t=>{var{typed:e,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:c}=t;return e(x3,{"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(c(l,s))throw new TypeError("k must be less than or equal to n in function composition");return n(r(s,-1),r(l,-1))}})});var D3="leafCount",Rz=["parse","typed"],B0=A(D3,Rz,t=>{var{parse:e,typed:r}=t;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(D3,{Node:function(a){return n(a)}})});function I0(t){return Xe(t)||Rr(t)&&t.isUnary()&&Xe(t.args[0])}function au(t){return!!(Xe(t)||(Gt(t)||Rr(t))&&t.args.every(au)||Rt(t)&&au(t.content))}function b3(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function _0(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?b3(Object(r),!0).forEach(function(n){hr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b3(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Pz="simplifyUtil",Lz=["FunctionNode","OperatorNode","SymbolNode"],Vo=A(Pz,Lz,t=>{var{FunctionNode:e,OperatorNode:r,SymbolNode:n}=t,i=!0,a=!1,o="defaultF",c={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},u={divide:{total:a},log:{total:a}},s={subtract:{total:a},abs:{trivial:i},log:{total:i}};function l(v,w){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,y=o;if(typeof v=="string"?y=v:Rr(v)?y=v.fn.toString():Gt(v)?y=v.name:Rt(v)&&(y="paren"),Te(b,y)){var E=b[y];if(Te(E,w))return E[w];if(Te(c,y))return c[y][w]}if(Te(b,o)){var F=b[o];return Te(F,w)?F[w]:c[o][w]}if(Te(c,y)){var S=c[y];if(Te(S,w))return S[w]}return c[o][w]}function f(v){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;return l(v,"commutative",w)}function m(v){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;return l(v,"associative",w)}function p(v,w){var b=_0({},v);for(var y in w)Te(v,y)?b[y]=_0(_0({},w[y]),v[y]):b[y]=w[y];return b}function h(v,w){if(!v.args||v.args.length===0)return v;v.args=d(v,w);for(var b=0;b<v.args.length;b++)h(v.args[b],w)}function d(v,w){var b,y=[],E=function F(S){for(var C=0;C<S.args.length;C++){var B=S.args[C];Rr(B)&&b===B.op?F(B):y.push(B)}};return m(v,w)?(b=v.op,E(v),y):v.args}function g(v,w){if(!(!v.args||v.args.length===0)){for(var b=N(v),y=v.args.length,E=0;E<y;E++)g(v.args[E],w);if(y>2&&m(v,w)){for(var F=v.args.pop();v.args.length>0;)F=b([v.args.pop(),F]);v.args=F.args}}}function D(v,w){if(!(!v.args||v.args.length===0)){for(var b=N(v),y=v.args.length,E=0;E<y;E++)D(v.args[E],w);if(y>2&&m(v,w)){for(var F=v.args.shift();v.args.length>0;)F=b([F,v.args.shift()]);v.args=F.args}}}function N(v){return Rr(v)?function(w){try{return new r(v.op,v.fn,w,v.implicit)}catch(b){return console.error(b),[]}}:function(w){return new e(new n(v.name),w)}}return{createMakeNodeFunction:N,hasProperty:l,isCommutative:f,isAssociative:m,mergeContext:p,flatten:h,allChildren:d,unflattenr:g,unflattenl:D,defaultContext:c,realContext:u,positiveContext:s}});var kz="simplify",qz=["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"],R0=A(kz,qz,t=>{var{config:e,typed:r,parse:n,add:i,subtract:a,multiply:o,divide:c,pow:u,isZero:s,equal:l,resolve:f,simplifyConstant:m,simplifyCore:p,fraction:h,bignumber:d,mathWithTransform:g,matrix:D,AccessorNode:N,ArrayNode:v,ConstantNode:w,FunctionNode:b,IndexNode:y,ObjectNode:E,OperatorNode:F,ParenthesisNode:S,SymbolNode:C}=t,{hasProperty:B,isCommutative:I,isAssociative:L,mergeContext:k,flatten:P,unflattenr:M,unflattenl:T,createMakeNodeFunction:H,defaultContext:_,realContext:z,positiveContext:Y}=Vo({FunctionNode:b,OperatorNode:F,SymbolNode:C});r.addConversion({from:"Object",to:"Map",convert:Bi});var X=r("simplify",{Node:me,"Node, Map":($,j)=>me($,!1,j),"Node, Map, Object":($,j,te)=>me($,!1,j,te),"Node, Array":me,"Node, Array, Map":me,"Node, Array, Map, Object":me});r.removeConversion({from:"Object",to:"Map",convert:Bi}),X.defaultContext=_,X.realContext=z,X.positiveContext=Y;function q($){return $.transform(function(j,te,ve){return Rt(j)?q(j.content):j})}var J={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};X.rules=[p,{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}}},m,{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}}},m,{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"},{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 ae($,j){var te={};if($.s){var ve=$.s.split("->");if(ve.length===2)te.l=ve[0],te.r=ve[1];else throw SyntaxError("Could not parse rule: "+$.s)}else te.l=$.l,te.r=$.r;te.l=q(n(te.l)),te.r=q(n(te.r));for(var pe of["imposeContext","repeat","assuming"])pe in $&&(te[pe]=$[pe]);if($.evaluate&&(te.evaluate=n($.evaluate)),L(te.l,j)){var Ne=!I(te.l,j),ge;Ne&&(ge=he());var We=H(te.l),Ke=he();te.expanded={},te.expanded.l=We([te.l,Ke]),P(te.expanded.l,j),M(te.expanded.l,j),te.expanded.r=We([te.r,Ke]),Ne&&(te.expandedNC1={},te.expandedNC1.l=We([ge,te.l]),te.expandedNC1.r=We([ge,te.r]),te.expandedNC2={},te.expandedNC2.l=We([ge,te.expanded.l]),te.expandedNC2.r=We([ge,te.expanded.r]))}return te}function re($,j){for(var te=[],ve=0;ve<$.length;ve++){var pe=$[ve],Ne=void 0,ge=typeof pe;switch(ge){case"string":pe={s:pe};case"object":Ne=ae(pe,j);break;case"function":Ne=pe;break;default:throw TypeError("Unsupported type of rule: "+ge)}te.push(Ne)}return te}var fe=0;function he(){return new C("_p"+fe++)}function me($,j){var te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yi(),ve=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},pe=ve.consoleDebug;j=re(j||X.rules,ve.context);var Ne=f($,te);Ne=q(Ne);for(var ge={},We=Ne.toString({parenthesis:"all"});!ge[We];){ge[We]=!0,fe=0;var Ke=We;pe&&console.log("Working on: ",We);for(var dr=0;dr<j.length;dr++){var wr="";if(typeof j[dr]=="function"?(Ne=j[dr](Ne,ve),pe&&(wr=j[dr].name)):(P(Ne,ve.context),Ne=xe(Ne,j[dr],ve.context),pe&&(wr="".concat(j[dr].l.toString()," -> ").concat(j[dr].r.toString()))),pe){var Br=Ne.toString({parenthesis:"all"});Br!==Ke&&(console.log("Applying",wr,"produced",Br),Ke=Br)}T(Ne,ve.context)}We=Ne.toString({parenthesis:"all"})}return Ne}function ie($,j,te){var ve=$;if($)for(var pe=0;pe<$.length;++pe){var Ne=xe($[pe],j,te);Ne!==$[pe]&&(ve===$&&(ve=$.slice()),ve[pe]=Ne)}return ve}function xe($,j,te){if(j.assuming){for(var ve in j.assuming)for(var pe in j.assuming[ve])if(B(ve,pe,te)!==j.assuming[ve][pe])return $}var Ne=k(j.imposeContext,te),ge=$;if(ge instanceof F||ge instanceof b){var We=ie(ge.args,j,te);We!==ge.args&&(ge=ge.clone(),ge.args=We)}else if(ge instanceof S){if(ge.content){var Ke=xe(ge.content,j,te);Ke!==ge.content&&(ge=new S(Ke))}}else if(ge instanceof v){var dr=ie(ge.items,j,te);dr!==ge.items&&(ge=new v(dr))}else if(ge instanceof N){var wr=ge.object;ge.object&&(wr=xe(ge.object,j,te));var Br=ge.index;ge.index&&(Br=xe(ge.index,j,te)),(wr!==ge.object||Br!==ge.index)&&(ge=new N(wr,Br))}else if(ge instanceof y){var gt=ie(ge.dimensions,j,te);gt!==ge.dimensions&&(ge=new y(gt))}else if(ge instanceof E){var yt=!1,nn={};for(var W in ge.properties)nn[W]=xe(ge.properties[W],j,te),nn[W]!==ge.properties[W]&&(yt=!0);yt&&(ge=new E(nn))}var K=j.r,se=G(j.l,ge,Ne)[0];if(!se&&j.expanded&&(K=j.expanded.r,se=G(j.expanded.l,ge,Ne)[0]),!se&&j.expandedNC1&&(K=j.expandedNC1.r,se=G(j.expandedNC1.l,ge,Ne)[0],se||(K=j.expandedNC2.r,se=G(j.expandedNC2.l,ge,Ne)[0])),se){var le=ge.implicit;ge=K.clone(),le&&"implicit"in K&&(ge.implicit=!0),ge=ge.transform(function(De){return De.isSymbolNode&&Te(se.placeholders,De.name)?se.placeholders[De.name].clone():De})}return j.repeat&&ge!==$&&(ge=xe(ge,j,te)),ge}function Me($,j){var te=[],ve,pe,Ne=H($);if(I($,j))for(var ge=0;ge<$.args.length;ge++)pe=$.args.slice(0),pe.splice(ge,1),ve=pe.length===1?pe[0]:Ne(pe),te.push(Ne([$.args[ge],ve]));else for(var We=1;We<$.args.length;We++){var Ke=$.args[0];We>1&&(Ke=Ne($.args.slice(0,We))),pe=$.args.slice(We),ve=pe.length===1?pe[0]:Ne(pe),te.push(Ne([Ke,ve]))}return te}function be($,j){var te={placeholders:{}};if(!$.placeholders&&!j.placeholders)return te;if($.placeholders){if(!j.placeholders)return $}else return j;for(var ve in $.placeholders)if(Te($.placeholders,ve)&&(te.placeholders[ve]=$.placeholders[ve],Te(j.placeholders,ve)&&!oe($.placeholders[ve],j.placeholders[ve])))return null;for(var pe in j.placeholders)Te(j.placeholders,pe)&&(te.placeholders[pe]=j.placeholders[pe]);return te}function Ce($,j){var te=[];if($.length===0||j.length===0)return te;for(var ve,pe=0;pe<$.length;pe++)for(var Ne=0;Ne<j.length;Ne++)ve=be($[pe],j[Ne]),ve&&te.push(ve);return te}function U($){if($.length===0)return $;for(var j=$.reduce(Ce),te=[],ve={},pe=0;pe<j.length;pe++){var Ne=JSON.stringify(j[pe]);ve[Ne]||(ve[Ne]=!0,te.push(j[pe]))}return te}function G($,j,te,ve){var pe=[{placeholders:{}}];if($ instanceof F&&j instanceof F||$ instanceof b&&j instanceof b){if($ instanceof F){if($.op!==j.op||$.fn!==j.fn)return[]}else if($ instanceof b&&$.name!==j.name)return[];if(j.args.length===1&&$.args.length===1||!L(j,te)&&j.args.length===$.args.length||ve){for(var Ne=[],ge=0;ge<$.args.length;ge++){var We=G($.args[ge],j.args[ge],te);if(We.length===0)break;Ne.push(We)}if(Ne.length!==$.args.length){if(!I(j,te)||$.args.length===1)return[];if($.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Ke=G($.args[0],j.args[1],te);if(Ke.length===0)return[];var dr=G($.args[1],j.args[0],te);if(dr.length===0)return[];Ne=[Ke,dr]}pe=U(Ne)}else if(j.args.length>=2&&$.args.length===2){for(var wr=Me(j,te),Br=[],gt=0;gt<wr.length;gt++){var yt=G($,wr[gt],te,!0);Br=Br.concat(yt)}return Br}else{if($.args.length>2)throw Error("Unexpected non-binary associative function: "+$.toString());return[]}}else if($ instanceof C){if($.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(J[$.name]){if($.name!==j.name)return[]}else switch($.name[1]>="a"&&$.name[1]<="z"?$.name.substring(0,2):$.name[0]){case"n":case"_p":pe[0].placeholders[$.name]=j;break;case"c":case"cl":if(Xe(j))pe[0].placeholders[$.name]=j;else return[];break;case"v":if(!Xe(j))pe[0].placeholders[$.name]=j;else return[];break;case"vl":if(Mr(j))pe[0].placeholders[$.name]=j;else return[];break;case"cd":if(I0(j))pe[0].placeholders[$.name]=j;else return[];break;case"vd":if(!I0(j))pe[0].placeholders[$.name]=j;else return[];break;case"ce":if(au(j))pe[0].placeholders[$.name]=j;else return[];break;case"ve":if(!au(j))pe[0].placeholders[$.name]=j;else return[];break;default:throw new Error("Invalid symbol in rule: "+$.name)}}else if($ instanceof w){if(!l($.value,j.value))return[]}else return[];return pe}function oe($,j){if($ instanceof w&&j instanceof w){if(!l($.value,j.value))return!1}else if($ instanceof C&&j instanceof C){if($.name!==j.name)return!1}else if($ instanceof F&&j instanceof F||$ instanceof b&&j instanceof b){if($ instanceof F){if($.op!==j.op||$.fn!==j.fn)return!1}else if($ instanceof b&&$.name!==j.name)return!1;if($.args.length!==j.args.length)return!1;for(var te=0;te<$.args.length;te++)if(!oe($.args[te],j.args[te]))return!1}else return!1;return!0}return X});var zz="simplifyConstant",Uz=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],P0=A(zz,Uz,t=>{var{typed:e,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:c,ArrayNode:u,ConstantNode:s,FunctionNode:l,IndexNode:f,ObjectNode:m,OperatorNode:p,SymbolNode:h}=t,{isCommutative:d,isAssociative:g,allChildren:D,createMakeNodeFunction:N}=Vo({FunctionNode:l,OperatorNode:p,SymbolNode:h}),v=e("simplifyConstant",{Node:P=>E(k(P,{})),"Node, Object":function(M,T){return E(k(M,T))}});function w(P){return Ti(P)?P.valueOf():P instanceof Array?P.map(w):Fe(P)?i(w(P.valueOf())):P}function b(P,M,T){try{return n[P].apply(null,M)}catch(H){return M=M.map(w),S(n[P].apply(null,M),T)}}var y=e({Fraction:B,number:function(M){return M<0?C(new s(-M)):new s(M)},BigNumber:function(M){return M<0?C(new s(-M)):new s(M)},Complex:function(M){throw new Error("Cannot convert Complex number to Node")},string:function(M){return new s(M)},Matrix:function(M){return new u(M.valueOf().map(T=>y(T)))}});function E(P){return er(P)?P:y(P)}function F(P,M){var T=M&&M.exactFractions!==!1;if(T&&isFinite(P)&&a){var H=a(P),_=M&&typeof M.fractionsLimit=="number"?M.fractionsLimit:1/0;if(H.valueOf()===P&&H.n<_&&H.d<_)return H}return P}var S=e({"string, Object":function(M,T){if(r.number==="BigNumber")return o===void 0&&Po(),o(M);if(r.number==="Fraction")return a===void 0&&Wl(),a(M);var H=parseFloat(M);return F(H,T)},"Fraction, Object":function(M,T){return M},"BigNumber, Object":function(M,T){return M},"number, Object":function(M,T){return F(M,T)},"Complex, Object":function(M,T){return M.im!==0?M:F(M.re,T)},"Matrix, Object":function(M,T){return i(F(M.valueOf()))},"Array, Object":function(M,T){return M.map(F)}});function C(P){return new p("-","unaryMinus",[P])}function B(P){var M,T=P.s*P.n;return T<0?M=new p("-","unaryMinus",[new s(-T)]):M=new s(T),P.d===1?M:new p("/","divide",[M,new s(P.d)])}function I(P,M,T){if(!Mn(M))return new c(E(P),E(M));if(_t(P)||Fe(P)){for(var H=Array.from(M.dimensions);H.length>0;)if(Xe(H[0])&&typeof H[0].value!="string"){var _=S(H.shift().value,T);_t(P)?P=P.items[_-1]:(P=P.valueOf()[_-1],P instanceof Array&&(P=i(P)))}else if(H.length>1&&Xe(H[1])&&typeof H[1].value!="string"){var z=S(H[1].value,T),Y=[],X=_t(P)?P.items:P.valueOf();for(var q of X)if(_t(q))Y.push(q.items[z-1]);else if(Fe(P))Y.push(q[z-1]);else break;if(Y.length===X.length)_t(P)?P=new u(Y):P=i(Y),H.splice(1,1);else break}else break;return H.length===M.dimensions.length?new c(E(P),M):H.length>0?(M=new f(H),new c(E(P),M)):P}if(Gi(P)&&M.dimensions.length===1&&Xe(M.dimensions[0])){var J=M.dimensions[0].value;return J in P.properties?P.properties[J]:new s}return new c(E(P),M)}function L(P,M,T,H){var _=M.shift(),z=M.reduce((Y,X)=>{if(!er(X)){var q=Y.pop();if(er(q))return[q,X];try{return Y.push(b(P,[q,X],H)),Y}catch(ae){Y.push(q)}}Y.push(E(Y.pop()));var J=Y.length===1?Y[0]:T(Y);return[T([J,E(X)])]},[_]);return z.length===1?z[0]:T([z[0],y(z[1])])}function k(P,M){switch(P.type){case"SymbolNode":return P;case"ConstantNode":switch(typeof P.value){case"number":return S(P.value,M);case"string":return P.value;default:if(!isNaN(P.value))return S(P.value,M)}return P;case"FunctionNode":if(n[P.name]&&n[P.name].rawArgs)return P;{var T=["add","multiply"];if(T.indexOf(P.name)===-1){var H=P.args.map(xe=>k(xe,M));if(!H.some(er))try{return b(P.name,H,M)}catch(xe){}if(P.name==="size"&&H.length===1&&_t(H[0])){for(var _=[],z=H[0];_t(z);)_.push(z.items.length),z=z.items[0];return i(_)}return new l(P.name,H.map(E))}}case"OperatorNode":{var Y=P.fn.toString(),X,q,J=N(P);if(Rr(P)&&P.isUnary())X=[k(P.args[0],M)],er(X[0])?q=J(X):q=b(Y,X,M);else if(g(P,M.context))if(X=D(P,M.context),X=X.map(xe=>k(xe,M)),d(Y,M.context)){for(var ae=[],re=[],fe=0;fe<X.length;fe++)er(X[fe])?re.push(X[fe]):ae.push(X[fe]);ae.length>1?(q=L(Y,ae,J,M),re.unshift(q),q=L(Y,re,J,M)):q=L(Y,X,J,M)}else q=L(Y,X,J,M);else X=P.args.map(xe=>k(xe,M)),q=L(Y,X,J,M);return q}case"ParenthesisNode":return k(P.content,M);case"AccessorNode":return I(k(P.object,M),k(P.index,M),M);case"ArrayNode":{var he=P.items.map(xe=>k(xe,M));return he.some(er)?new u(he.map(E)):i(he)}case"IndexNode":return new f(P.dimensions.map(xe=>v(xe,M)));case"ObjectNode":{var me={};for(var ie in P.properties)me[ie]=v(P.properties[ie],M);return new m(me)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(P.type))}}return v});var w3="simplifyCore",Vz=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],L0=A(w3,Vz,t=>{var{typed:e,parse:r,equal:n,isZero:i,add:a,subtract:o,multiply:c,divide:u,pow:s,AccessorNode:l,ArrayNode:f,ConstantNode:m,FunctionNode:p,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:D,SymbolNode:N}=t,v=new m(0),w=new m(1),b=new m(!0),y=new m(!1);function E(B){return Rr(B)&&["and","not","or"].includes(B.op)}var{hasProperty:F,isCommutative:S}=Vo({FunctionNode:p,OperatorNode:g,SymbolNode:N});function C(B){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=I?I.context:void 0;if(F(B,"trivial",L)){if(Gt(B)&&B.args.length===1)return C(B.args[0],I);var k=!1,P=0;if(B.forEach(re=>{++P,P===1&&(k=C(re,I))}),P===1)return k}var M=B;if(Gt(M)){var T=FA(M.name);if(T){if(M.args.length>2&&F(M,"associative",L))for(;M.args.length>2;){var H=M.args.pop(),_=M.args.pop();M.args.push(new g(T,M.name,[H,_]))}M=new g(T,M.name,M.args)}else return new p(C(M.fn),M.args.map(re=>C(re,I)))}if(Rr(M)&&M.isUnary()){var z=C(M.args[0],I);if(M.op==="~"&&Rr(z)&&z.isUnary()&&z.op==="~"||M.op==="not"&&Rr(z)&&z.isUnary()&&z.op==="not"&&E(z.args[0]))return z.args[0];var Y=!0;if(M.op==="-"&&Rr(z)&&(z.isBinary()&&z.fn==="subtract"&&(M=new g("-","subtract",[z.args[1],z.args[0]]),Y=!1),z.isUnary()&&z.op==="-"))return z.args[0];if(Y)return new g(M.op,M.fn,[z])}if(Rr(M)&&M.isBinary()){var X=C(M.args[0],I),q=C(M.args[1],I);if(M.op==="+"){if(Xe(X)&&i(X.value))return q;if(Xe(q)&&i(q.value))return X;Rr(q)&&q.isUnary()&&q.op==="-"&&(q=q.args[0],M=new g("-","subtract",[X,q]))}if(M.op==="-")return Rr(q)&&q.isUnary()&&q.op==="-"?C(new g("+","add",[X,q.args[0]]),I):Xe(X)&&i(X.value)?C(new g("-","unaryMinus",[q])):Xe(q)&&i(q.value)?X:new g(M.op,M.fn,[X,q]);if(M.op==="*"){if(Xe(X)){if(i(X.value))return v;if(n(X.value,1))return q}if(Xe(q)){if(i(q.value))return v;if(n(q.value,1))return X;if(S(M,L))return new g(M.op,M.fn,[q,X],M.implicit)}return new g(M.op,M.fn,[X,q],M.implicit)}if(M.op==="/")return Xe(X)&&i(X.value)?v:Xe(q)&&n(q.value,1)?X:new g(M.op,M.fn,[X,q]);if(M.op==="^"&&Xe(q)){if(i(q.value))return w;if(n(q.value,1))return X}if(M.op==="and"){if(Xe(X))if(X.value){if(E(q))return q}else return y;if(Xe(q))if(q.value){if(E(X))return X}else return y}if(M.op==="or"){if(Xe(X)){if(X.value)return b;if(E(q))return q}if(Xe(q)){if(q.value)return b;if(E(X))return X}}return new g(M.op,M.fn,[X,q])}if(Rr(M))return new g(M.op,M.fn,M.args.map(re=>C(re,I)));if(_t(M))return new f(M.items.map(re=>C(re,I)));if(pn(M))return new l(C(M.object,I),C(M.index,I));if(Mn(M))return new h(M.dimensions.map(re=>C(re,I)));if(Gi(M)){var J={};for(var ae in M.properties)J[ae]=C(M.properties[ae],I);return new d(J)}return M}return e(w3,{Node:C,"Node,Object":C})});var $z="resolve",Hz=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],k0=A($z,Hz,t=>{var{typed:e,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=t;function c(u,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!s)return u;if(Mr(u)){if(l.has(u.name)){var f=Array.from(l).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var m=s.get(u.name);if(er(m)){var p=new Set(l);return p.add(u.name),c(m,s,p)}else return typeof m=="number"?r(String(m)):m!==void 0?new n(m):u}else if(Rr(u)){var h=u.args.map(function(g){return c(g,s,l)});return new a(u.op,u.fn,h,u.implicit)}else{if(Rt(u))return new o(c(u.content,s,l));if(Gt(u)){var d=u.args.map(function(g){return c(g,s,l)});return new i(u.name,d)}}return u.map(g=>c(g,s,l))}return e("resolve",{Node:c,"Node, Map | null | undefined":c,"Node, Object":(u,s)=>c(u,Bi(s)),"Array | Matrix":e.referToSelf(u=>s=>s.map(l=>u(l))),"Array | Matrix, null | undefined":e.referToSelf(u=>s=>s.map(l=>u(l))),"Array, Object":e.referTo("Array,Map",u=>(s,l)=>u(s,Bi(l))),"Matrix, Object":e.referTo("Matrix,Map",u=>(s,l)=>u(s,Bi(l))),"Array | Matrix, Map":e.referToSelf(u=>(s,l)=>s.map(f=>u(f,l)))})});var E3="symbolicEqual",Wz=["parse","simplify","typed","OperatorNode"],q0=A(E3,Wz,t=>{var{parse:e,simplify:r,typed:n,OperatorNode:i}=t;function a(o,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=new i("-","subtract",[o,c]),l=r(s,{},u);return Xe(l)&&!l.value}return n(E3,{"Node, Node":a,"Node, Node, Object":a})});var C3="derivative",Gz=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],z0=A(C3,Gz,t=>{var{typed:e,config:r,parse:n,simplify:i,equal:a,isZero:o,numeric:c,ConstantNode:u,FunctionNode:s,OperatorNode:l,ParenthesisNode:f,SymbolNode:m}=t;function p(w,b){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},E={};g(E,w,b.name);var F=D(w,E);return y.simplify?i(F):F}e.addConversion({from:"identifier",to:"SymbolNode",convert:n});var h=e(C3,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p});e.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),h._simplify=!0,h.toTex=function(w){return d.apply(null,w.args)};var d=e("_derivTex",{"Node, SymbolNode":function(b,y){return Xe(b)&&nr(b.value)==="string"?d(n(b.value).toString(),y.toString(),1):d(b.toTex(),y.toString(),1)},"Node, ConstantNode":function(b,y){if(nr(y.value)==="string")return d(b,n(y.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(b,y,E){return d(b.toString(),y.name,E.value)},"string, string, number":function(b,y,E){var F;return E===1?F="{d\\over d"+y+"}":F="{d^{"+E+"}\\over d"+y+"^{"+E+"}}",F+"\\left[".concat(b,"\\right]")}}),g=e("constTag",{"Object, ConstantNode, string":function(b,y){return b[y]=!0,!0},"Object, SymbolNode, string":function(b,y,E){return y.name!==E?(b[y]=!0,!0):!1},"Object, ParenthesisNode, string":function(b,y,E){return g(b,y.content,E)},"Object, FunctionAssignmentNode, string":function(b,y,E){return y.params.indexOf(E)===-1?(b[y]=!0,!0):g(b,y.expr,E)},"Object, FunctionNode | OperatorNode, string":function(b,y,E){if(y.args.length>0){for(var F=g(b,y.args[0],E),S=1;S<y.args.length;++S)F=g(b,y.args[S],E)&&F;if(F)return b[y]=!0,!0}return!1}}),D=e("_derivative",{"ConstantNode, Object":function(b){return v(0)},"SymbolNode, Object":function(b,y){return y[b]!==void 0?v(0):v(1)},"ParenthesisNode, Object":function(b,y){return new f(D(b.content,y))},"FunctionAssignmentNode, Object":function(b,y){return y[b]!==void 0?v(0):D(b.expr,y)},"FunctionNode, Object":function(b,y){if(b.args.length!==1&&N(b),y[b]!==void 0)return v(0);var E=b.args[0],F,S=!1,C=!1,B;switch(b.name){case"cbrt":S=!0,B=new l("*","multiply",[v(3),new l("^","pow",[E,new l("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(b.args.length===1)S=!0,B=new l("*","multiply",[v(2),new s("sqrt",[E])]);else if(b.args.length===2)return F=new l("/","divide",[v(1),b.args[1]]),y[F]=y[b.args[1]],D(new l("^","pow",[E,F]),y);break;case"log10":F=v(10);case"log":if(!F&&b.args.length===1)B=E.clone(),S=!0;else if(b.args.length===1&&F||b.args.length===2&&y[b.args[1]]!==void 0)B=new l("*","multiply",[E.clone(),new s("log",[F||b.args[1]])]),S=!0;else if(b.args.length===2)return D(new l("/","divide",[new s("log",[E]),new s("log",[b.args[1]])]),y);break;case"pow":return y[F]=y[b.args[1]],D(new l("^","pow",[E,b.args[1]]),y);case"exp":B=new s("exp",[E.clone()]);break;case"sin":B=new s("cos",[E.clone()]);break;case"cos":B=new l("-","unaryMinus",[new s("sin",[E.clone()])]);break;case"tan":B=new l("^","pow",[new s("sec",[E.clone()]),v(2)]);break;case"sec":B=new l("*","multiply",[b,new s("tan",[E.clone()])]);break;case"csc":C=!0,B=new l("*","multiply",[b,new s("cot",[E.clone()])]);break;case"cot":C=!0,B=new l("^","pow",[new s("csc",[E.clone()]),v(2)]);break;case"asin":S=!0,B=new s("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[E.clone(),v(2)])])]);break;case"acos":S=!0,C=!0,B=new s("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[E.clone(),v(2)])])]);break;case"atan":S=!0,B=new l("+","add",[new l("^","pow",[E.clone(),v(2)]),v(1)]);break;case"asec":S=!0,B=new l("*","multiply",[new s("abs",[E.clone()]),new s("sqrt",[new l("-","subtract",[new l("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acsc":S=!0,C=!0,B=new l("*","multiply",[new s("abs",[E.clone()]),new s("sqrt",[new l("-","subtract",[new l("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acot":S=!0,C=!0,B=new l("+","add",[new l("^","pow",[E.clone(),v(2)]),v(1)]);break;case"sinh":B=new s("cosh",[E.clone()]);break;case"cosh":B=new s("sinh",[E.clone()]);break;case"tanh":B=new l("^","pow",[new s("sech",[E.clone()]),v(2)]);break;case"sech":C=!0,B=new l("*","multiply",[b,new s("tanh",[E.clone()])]);break;case"csch":C=!0,B=new l("*","multiply",[b,new s("coth",[E.clone()])]);break;case"coth":C=!0,B=new l("^","pow",[new s("csch",[E.clone()]),v(2)]);break;case"asinh":S=!0,B=new s("sqrt",[new l("+","add",[new l("^","pow",[E.clone(),v(2)]),v(1)])]);break;case"acosh":S=!0,B=new s("sqrt",[new l("-","subtract",[new l("^","pow",[E.clone(),v(2)]),v(1)])]);break;case"atanh":S=!0,B=new l("-","subtract",[v(1),new l("^","pow",[E.clone(),v(2)])]);break;case"asech":S=!0,C=!0,B=new l("*","multiply",[E.clone(),new s("sqrt",[new l("-","subtract",[v(1),new l("^","pow",[E.clone(),v(2)])])])]);break;case"acsch":S=!0,C=!0,B=new l("*","multiply",[new s("abs",[E.clone()]),new s("sqrt",[new l("+","add",[new l("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acoth":S=!0,C=!0,B=new l("-","subtract",[v(1),new l("^","pow",[E.clone(),v(2)])]);break;case"abs":B=new l("/","divide",[new s(new m("abs"),[E.clone()]),E.clone()]);break;case"gamma":default:throw new Error('Function "'+b.name+'" is not supported by derivative, or a wrong number of arguments is passed')}var I,L;S?(I="/",L="divide"):(I="*",L="multiply");var k=D(E,y);return C&&(k=new l("-","unaryMinus",[k])),new l(I,L,[k,B])},"OperatorNode, Object":function(b,y){if(y[b]!==void 0)return v(0);if(b.op==="+")return new l(b.op,b.fn,b.args.map(function(M){return D(M,y)}));if(b.op==="-"){if(b.isUnary())return new l(b.op,b.fn,[D(b.args[0],y)]);if(b.isBinary())return new l(b.op,b.fn,[D(b.args[0],y),D(b.args[1],y)])}if(b.op==="*"){var E=b.args.filter(function(M){return y[M]!==void 0});if(E.length>0){var F=b.args.filter(function(M){return y[M]===void 0}),S=F.length===1?F[0]:new l("*","multiply",F),C=E.concat(D(S,y));return new l("*","multiply",C)}return new l("+","add",b.args.map(function(M){return new l("*","multiply",b.args.map(function(T){return T===M?D(T,y):T.clone()}))}))}if(b.op==="/"&&b.isBinary()){var B=b.args[0],I=b.args[1];return y[I]!==void 0?new l("/","divide",[D(B,y),I]):y[B]!==void 0?new l("*","multiply",[new l("-","unaryMinus",[B]),new l("/","divide",[D(I,y),new l("^","pow",[I.clone(),v(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[D(B,y),I.clone()]),new l("*","multiply",[B.clone(),D(I,y)])]),new l("^","pow",[I.clone(),v(2)])])}if(b.op==="^"&&b.isBinary()){var L=b.args[0],k=b.args[1];if(y[L]!==void 0)return Xe(L)&&(o(L.value)||a(L.value,1))?v(0):new l("*","multiply",[b,new l("*","multiply",[new s("log",[L.clone()]),D(k.clone(),y)])]);if(y[k]!==void 0){if(Xe(k)){if(o(k.value))return v(0);if(a(k.value,1))return D(L,y)}var P=new l("^","pow",[L.clone(),new l("-","subtract",[k,v(1)])]);return new l("*","multiply",[k.clone(),new l("*","multiply",[D(L,y),P])])}return new l("*","multiply",[new l("^","pow",[L.clone(),k.clone()]),new l("+","add",[new l("*","multiply",[D(L,y),new l("/","divide",[k.clone(),L.clone()])]),new l("*","multiply",[D(k,y),new s("log",[L.clone()])])])])}throw new Error('Operator "'+b.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function N(w){if(!((w.name==="log"||w.name==="nthRoot"||w.name==="pow")&&w.args.length===2)){for(var b=0;b<w.args.length;++b)w.args[b]=v(0);throw w.compile().evaluate(),new Error("Expected TypeError, but none found")}}function v(w,b){return new u(c(w,b||r.number))}return h});var N3="rationalize",Zz=["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"],U0=A(N3,Zz,t=>{var{config:e,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:c,divide:u,pow:s,parse:l,simplifyConstant:f,simplifyCore:m,simplify:p,fraction:h,bignumber:d,mathWithTransform:g,matrix:D,AccessorNode:N,ArrayNode:v,ConstantNode:w,FunctionNode:b,IndexNode:y,ObjectNode:E,OperatorNode:F,SymbolNode:S,ParenthesisNode:C}=t;function B(M){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,_=L(),z=I(M,T,!0,_.firstRules),Y=z.variables.length,X={exactFractions:!1},q={exactFractions:!0};if(M=z.expression,Y>=1){M=k(M);var J,ae,re=!0,fe=!1;M=p(M,_.firstRules,{},X);for(var he;ae=re?_.distrDivRules:_.sucDivRules,M=p(M,ae,{},q),re=!re,he=M.toString(),he!==J;)fe=!0,J=he;fe&&(M=p(M,_.firstRulesAgain,{},X)),M=p(M,_.finalRules,{},X)}var me=[],ie={};return M.type==="OperatorNode"&&M.isBinary()&&M.op==="/"?(Y===1&&(M.args[0]=P(M.args[0],me),M.args[1]=P(M.args[1])),H&&(ie.numerator=M.args[0],ie.denominator=M.args[1])):(Y===1&&(M=P(M,me)),H&&(ie.numerator=M,ie.denominator=null)),H?(ie.coefficients=me,ie.variables=z.variables,ie.expression=M,ie):M}return r(N3,{Node:B,"Node, boolean":(M,T)=>B(M,{},T),"Node, Object":B,"Node, Object, boolean":B});function I(M,T,H,_){var z=[],Y=p(M,_,T,{exactFractions:!1});H=!!H;var X="+-*"+(H?"/":"");J(Y);var q={};return q.expression=Y,q.variables=z,q;function J(ae){var re=ae.type;if(re==="FunctionNode")throw new Error("There is an unsolved function call");if(re==="OperatorNode")if(ae.op==="^"){if(ae.args[1].type!=="ConstantNode"||!Ae(parseFloat(ae.args[1].value)))throw new Error("There is a non-integer exponent");J(ae.args[0])}else{if(X.indexOf(ae.op)===-1)throw new Error("Operator "+ae.op+" invalid in polynomial expression");for(var fe=0;fe<ae.args.length;fe++)J(ae.args[fe])}else if(re==="SymbolNode"){var he=ae.name,me=z.indexOf(he);me===-1&&z.push(he)}else if(re==="ParenthesisNode")J(ae.content);else if(re!=="ConstantNode")throw new Error("type "+re+" is not allowed in polynomial expression")}}function L(){var M=[m,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],T=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],H=[{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)"}],_=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],z={};return z.firstRules=M.concat(T,_),z.distrDivRules=H,z.sucDivRules=_,z.firstRulesAgain=M.concat(T),z.finalRules=[m,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],z}function k(M,T,H){var _=M.type,z=arguments.length>1;if(_==="OperatorNode"&&M.isBinary()){var Y=!1,X;if(M.op==="^"&&(M.args[0].type==="ParenthesisNode"||M.args[0].type==="OperatorNode")&&M.args[1].type==="ConstantNode"&&(X=parseFloat(M.args[1].value),Y=X>=2&&Ae(X)),Y){if(X>2){var q=M.args[0],J=new F("^","pow",[M.args[0].cloneDeep(),new w(X-1)]);M=new F("*","multiply",[q,J])}else M=new F("*","multiply",[M.args[0],M.args[0].cloneDeep()]);z&&(H==="content"?T.content=M:T.args[H]=M)}}if(_==="ParenthesisNode")k(M.content,M,"content");else if(_!=="ConstantNode"&&_!=="SymbolNode")for(var ae=0;ae<M.args.length;ae++)k(M.args[ae],M,ae);if(!z)return M}function P(M,T){T===void 0&&(T=[]),T[0]=0;var H={};H.cte=1,H.oper="+",H.fire="";var _=0,z="";he(M,null,H),_=T.length-1;for(var Y=!0,X,q=_;q>=0;q--)if(T[q]!==0){var J=new w(Y?T[q]:Math.abs(T[q])),ae=T[q]<0?"-":"+";if(q>0){var re=new S(z);if(q>1){var fe=new w(q);re=new F("^","pow",[re,fe])}T[q]===-1&&Y?J=new F("-","unaryMinus",[re]):Math.abs(T[q])===1?J=re:J=new F("*","multiply",[J,re])}Y?X=J:ae==="+"?X=new F("+","add",[X,J]):X=new F("-","subtract",[X,J]),Y=!1}if(Y)return new w(0);return X;function he(me,ie,xe){var Me=me.type;if(Me==="FunctionNode")throw new Error("There is an unsolved function call");if(Me==="OperatorNode"){if("+-*^".indexOf(me.op)===-1)throw new Error("Operator "+me.op+" invalid");if(ie!==null){if((me.fn==="unaryMinus"||me.fn==="pow")&&ie.fn!=="add"&&ie.fn!=="subtract"&&ie.fn!=="multiply")throw new Error("Invalid "+me.op+" placing");if((me.fn==="subtract"||me.fn==="add"||me.fn==="multiply")&&ie.fn!=="add"&&ie.fn!=="subtract")throw new Error("Invalid "+me.op+" placing");if((me.fn==="subtract"||me.fn==="add"||me.fn==="unaryMinus")&&xe.noFil!==0)throw new Error("Invalid "+me.op+" placing")}(me.op==="^"||me.op==="*")&&(xe.fire=me.op);for(var be=0;be<me.args.length;be++)me.fn==="unaryMinus"&&(xe.oper="-"),(me.op==="+"||me.fn==="subtract")&&(xe.fire="",xe.cte=1,xe.oper=be===0?"+":me.op),xe.noFil=be,he(me.args[be],me,xe)}else if(Me==="SymbolNode"){if(me.name!==z&&z!=="")throw new Error("There is more than one variable");if(z=me.name,ie===null){T[1]=1;return}if(ie.op==="^"&&xe.noFil!==0)throw new Error("In power the variable should be the first parameter");if(ie.op==="*"&&xe.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(xe.fire===""||xe.fire==="*")&&(_<1&&(T[1]=0),T[1]+=xe.cte*(xe.oper==="+"?1:-1),_=Math.max(1,_))}else if(Me==="ConstantNode"){var Ce=parseFloat(me.value);if(ie===null){T[0]=Ce;return}if(ie.op==="^"){if(xe.noFil!==1)throw new Error("Constant cannot be powered");if(!Ae(Ce)||Ce<=0)throw new Error("Non-integer exponent is not allowed");for(var U=_+1;U<Ce;U++)T[U]=0;Ce>_&&(T[Ce]=0),T[Ce]+=xe.cte*(xe.oper==="+"?1:-1),_=Math.max(Ce,_);return}xe.cte=Ce,xe.fire===""&&(T[0]+=xe.cte*(xe.oper==="+"?1:-1))}else throw new Error("Type "+Me+" is not allowed")}}});var jz="reviver",Yz=["classes"],V0=A(jz,Yz,t=>{var{classes:e}=t;return function(n,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var Jz="replacer",Xz=[],$0=A(Jz,Xz,()=>function(e,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r});var A3="11.8.1";var H0=A("true",[],()=>!0),W0=A("false",[],()=>!1),G0=A("null",[],()=>null),Z0=hn("Infinity",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1/0):1/0}),j0=hn("NaN",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(NaN):NaN}),Y0=hn("pi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?Xs(r):xE}),J0=hn("tau",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?kN(r):DE}),X0=hn("e",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?PN(r):bE}),Q0=hn("phi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?LN(r):wE}),K0=hn("LN2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).ln():Math.LN2}),ey=hn("LN10",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(10).ln():Math.LN10}),ry=hn("LOG2E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),ty=hn("LOG10E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),ny=hn("SQRT1_2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),iy=hn("SQRT2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),ay=hn("i",["Complex"],t=>{var{Complex:e}=t;return e.I});var oy=A("version",[],()=>A3);function hn(t,e,r){return A(t,e,r,{recreateOnConfigChange:!0})}var sy=tr("speedOfLight","299792458","m s^-1"),uy=tr("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),ly=tr("planckConstant","6.62607015e-34","J s"),cy=tr("reducedPlanckConstant","1.0545718176461565e-34","J s"),fy=tr("magneticConstant","1.25663706212e-6","N A^-2"),my=tr("electricConstant","8.8541878128e-12","F m^-1"),py=tr("vacuumImpedance","376.730313667","ohm"),dy=tr("coulomb","8.987551792261171e9","N m^2 C^-2"),hy=tr("elementaryCharge","1.602176634e-19","C"),vy=tr("bohrMagneton","9.2740100783e-24","J T^-1"),gy=tr("conductanceQuantum","7.748091729863649e-5","S"),yy=tr("inverseConductanceQuantum","12906.403729652257","ohm"),xy=tr("magneticFluxQuantum","2.0678338484619295e-15","Wb"),Dy=tr("nuclearMagneton","5.0507837461e-27","J T^-1"),by=tr("klitzing","25812.807459304513","ohm");var wy=tr("bohrRadius","5.29177210903e-11","m"),Ey=tr("classicalElectronRadius","2.8179403262e-15","m"),Cy=tr("electronMass","9.1093837015e-31","kg"),Ny=tr("fermiCoupling","1.1663787e-5","GeV^-2"),Ay=Nc("fineStructure",.0072973525693),Fy=tr("hartreeEnergy","4.3597447222071e-18","J"),Sy=tr("protonMass","1.67262192369e-27","kg"),My=tr("deuteronMass","3.3435830926e-27","kg"),Ty=tr("neutronMass","1.6749271613e-27","kg"),Oy=tr("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),By=tr("rydberg","10973731.568160","m^-1"),Iy=tr("thomsonCrossSection","6.6524587321e-29","m^2"),_y=Nc("weakMixingAngle",.2229),Ry=Nc("efimovFactor",22.7),Py=tr("atomicMass","1.66053906660e-27","kg"),Ly=tr("avogadro","6.02214076e23","mol^-1"),ky=tr("boltzmann","1.380649e-23","J K^-1"),qy=tr("faraday","96485.33212331001","C mol^-1"),zy=tr("firstRadiation","3.7417718521927573e-16","W m^2"),Uy=tr("loschmidt","2.686780111798444e25","m^-3"),Vy=tr("gasConstant","8.31446261815324","J K^-1 mol^-1"),$y=tr("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),Hy=tr("molarVolume","0.022413969545014137","m^3 mol^-1"),Wy=Nc("sackurTetrode",-1.16487052358),Gy=tr("secondRadiation","0.014387768775039337","m K"),Zy=tr("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),jy=tr("wienDisplacement","2.897771955e-3","m K"),Yy=tr("molarMass","0.99999999965e-3","kg mol^-1"),Jy=tr("molarMassC12","11.9999999958e-3","kg mol^-1"),Xy=tr("gravity","9.80665","m s^-2"),Qy=tr("planckLength","1.616255e-35","m"),Ky=tr("planckMass","2.176435e-8","kg"),ex=tr("planckTime","5.391245e-44","s"),rx=tr("planckCharge","1.87554603778e-18","C"),tx=tr("planckTemperature","1.416785e+32","K");function tr(t,e,r){var n=["config","Unit","BigNumber"];return A(t,n,i=>{var{config:a,Unit:o,BigNumber:c}=i,u=a.number==="BigNumber"?new c(e):parseFloat(e),s=new o(u,r);return s.fixPrefix=!0,s})}function Nc(t,e){var r=["config","BigNumber"];return A(t,r,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(e):e})}var Qz="apply",Kz=["typed","isInteger"],nx=A(Qz,Kz,t=>{var{typed:e,isInteger:r}=t,n=Us({typed:e,isInteger:r});return e("apply",{"...any":function(a){var o=a[1];He(o)?a[1]=o-1:Le(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(c){throw Or(c)}}})},{isTransformFunction:!0});var eU="column",rU=["typed","Index","matrix","range"],ix=A(eU,rU,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=$s({typed:e,Index:r,matrix:n,range:i});return e("column",{"...any":function(c){var u=c.length-1,s=c[u];He(s)&&(c[u]=s-1);try{return a.apply(null,c)}catch(l){throw Or(l)}}})},{isTransformFunction:!0});function $o(t,e,r){var n=t.filter(function(c){return Mr(c)&&!(c.name in e)&&!r.has(c.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+t+'"');var i=n.name,a=Ra(r),o=t.compile();return function(u){return a.set(i,u),o.evaluate(a)}}var tU="filter",nU=["typed"],ax=A(tU,nU,t=>{var{typed:e}=t;function r(i,a,o){var c,u;return i[0]&&(c=i[0].compile().evaluate(o)),i[1]&&(Mr(i[1])||vi(i[1])?u=i[1].compile().evaluate(o):u=$o(i[1],a,o)),n(c,u)}r.rawArgs=!0;var n=e("filter",{"Array, function":F3,"Matrix, function":function(a,o){return a.create(F3(a.toArray(),o))},"Array, RegExp":So,"Matrix, RegExp":function(a,o){return a.create(So(a.toArray(),o))}});return r},{isTransformFunction:!0});function F3(t,e){return Nl(t,function(r,n,i){return In(e,r,[n+1],i,"filter")})}var iU="forEach",aU=["typed"],ox=A(iU,aU,t=>{var{typed:e}=t;function r(i,a,o){var c,u;return i[0]&&(c=i[0].compile().evaluate(o)),i[1]&&(Mr(i[1])||vi(i[1])?u=i[1].compile().evaluate(o):u=$o(i[1],a,o)),n(c,u)}r.rawArgs=!0;var n=e("forEach",{"Array | Matrix, function":function(a,o){var c=function u(s,l){if(Array.isArray(s))ji(s,function(f,m){u(f,l.concat(m+1))});else return In(o,s,l,a,"forEach")};c(a.valueOf(),[])}});return r},{isTransformFunction:!0});var oU="index",sU=["Index"],sx=A(oU,sU,t=>{var{Index:e}=t;return function(){for(var n=[],i=0,a=arguments.length;i<a;i++){var o=arguments[i];if(No(o))o.start--,o.end-=o.step>0?0:2;else if(o&&o.isSet===!0)o=o.map(function(u){return u-1});else if(lr(o)||Fe(o))o=o.map(function(u){return u-1});else if(He(o))o--;else if(Le(o))o=o.toNumber()-1;else if(typeof o!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");n[i]=o}var c=new e;return e.apply(c,n),c}},{isTransformFunction:!0});var uU="map",lU=["typed"],ux=A(uU,lU,t=>{var{typed:e}=t;function r(i,a,o){var c,u;return i[0]&&(c=i[0].compile().evaluate(o)),i[1]&&(Mr(i[1])||vi(i[1])?u=i[1].compile().evaluate(o):u=$o(i[1],a,o)),n(c,u)}r.rawArgs=!0;var n=e("map",{"Array, function":function(a,o){return S3(a,o,a)},"Matrix, function":function(a,o){return a.create(S3(a.valueOf(),o,a))}});return r},{isTransformFunction:!0});function S3(t,e,r){function n(i,a){return Array.isArray(i)?Xt(i,function(o,c){return n(o,a.concat(c+1))}):In(e,i,a,r,"map")}return n(t,[])}function rn(t){if(t.length===2&&St(t[0])){t=t.slice();var e=t[1];He(e)?t[1]=e-1:Le(e)&&(t[1]=e.minus(1))}return t}var cU="max",fU=["typed","config","numeric","larger"],lx=A(cU,fU,t=>{var{typed:e,config:r,numeric:n,larger:i}=t,a=Ys({typed:e,config:r,numeric:n,larger:i});return e("max",{"...any":function(c){c=rn(c);try{return a.apply(null,c)}catch(u){throw Or(u)}}})},{isTransformFunction:!0});var mU="mean",pU=["typed","add","divide"],cx=A(mU,pU,t=>{var{typed:e,add:r,divide:n}=t,i=ru({typed:e,add:r,divide:n});return e("mean",{"...any":function(o){o=rn(o);try{return i.apply(null,o)}catch(c){throw Or(c)}}})},{isTransformFunction:!0});var dU="min",hU=["typed","config","numeric","smaller"],fx=A(dU,hU,t=>{var{typed:e,config:r,numeric:n,smaller:i}=t,a=Js({typed:e,config:r,numeric:n,smaller:i});return e("min",{"...any":function(c){c=rn(c);try{return a.apply(null,c)}catch(u){throw Or(u)}}})},{isTransformFunction:!0});var vU="range",gU=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],mx=A(vU,gU,t=>{var{typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:c,largerEq:u}=t,s=Gs({typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:c,largerEq:u});return e("range",{"...any":function(f){var m=f.length-1,p=f[m];return typeof p!="boolean"&&f.push(!0),s.apply(null,f)}})},{isTransformFunction:!0});var yU="row",xU=["typed","Index","matrix","range"],px=A(yU,xU,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=Zs({typed:e,Index:r,matrix:n,range:i});return e("row",{"...any":function(c){var u=c.length-1,s=c[u];He(s)&&(c[u]=s-1);try{return a.apply(null,c)}catch(l){throw Or(l)}}})},{isTransformFunction:!0});var DU="subset",bU=["typed","matrix"],dx=A(DU,bU,t=>{var{typed:e,matrix:r}=t,n=js({typed:e,matrix:r});return e("subset",{"...any":function(a){try{return n.apply(null,a)}catch(o){throw Or(o)}}})},{isTransformFunction:!0});var wU="concat",EU=["typed","matrix","isInteger"],hx=A(wU,EU,t=>{var{typed:e,matrix:r,isInteger:n}=t,i=Vs({typed:e,matrix:r,isInteger:n});return e("concat",{"...any":function(o){var c=o.length-1,u=o[c];He(u)?o[c]=u-1:Le(u)&&(o[c]=u.minus(1));try{return i.apply(null,o)}catch(s){throw Or(s)}}})},{isTransformFunction:!0});var M3="diff",CU=["typed","matrix","subtract","number","bignumber"],vx=A(M3,CU,t=>{var{typed:e,matrix:r,subtract:n,number:i,bignumber:a}=t,o=Ws({typed:e,matrix:r,subtract:n,number:i,bignumber:a});return e(M3,{"...any":function(u){u=rn(u);try{return o.apply(null,u)}catch(s){throw Or(s)}}})},{isTransformFunction:!0});var NU="std",AU=["typed","map","sqrt","variance"],gx=A(NU,AU,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t,a=nu({typed:e,map:r,sqrt:n,variance:i});return e("std",{"...any":function(c){c=rn(c);try{return a.apply(null,c)}catch(u){throw Or(u)}}})},{isTransformFunction:!0});var T3="sum",FU=["typed","config","add","numeric"],yx=A(T3,FU,t=>{var{typed:e,config:r,add:n,numeric:i}=t,a=Ks({typed:e,config:r,add:n,numeric:i});return e(T3,{"...any":function(c){c=rn(c);try{return a.apply(null,c)}catch(u){throw Or(u)}}})},{isTransformFunction:!0});var O3="cumsum",SU=["typed","add","unaryPlus"],xx=A(O3,SU,t=>{var{typed:e,add:r,unaryPlus:n}=t,i=eu({typed:e,add:r,unaryPlus:n});return e(O3,{"...any":function(o){if(o.length===2&&St(o[0])){var c=o[1];He(c)?o[1]=c-1:Le(c)&&(o[1]=c.minus(1))}try{return i.apply(null,o)}catch(u){throw Or(u)}}})},{isTransformFunction:!0});var B3="variance",MU=["typed","add","subtract","multiply","divide","apply","isNaN"],Dx=A(B3,MU,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:c}=t,u=tu({typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:c});return e(B3,{"...any":function(l){l=rn(l);try{return u.apply(null,l)}catch(f){throw Or(f)}}})},{isTransformFunction:!0});var we=Um({config:de}),zr=$m({}),bx=X0({BigNumber:we,config:de}),I3=W0({}),_3=Ay({BigNumber:we,config:de}),ia=Wm({}),wx=ay({Complex:zr}),R3=Z0({BigNumber:we,config:de}),P3=ey({BigNumber:we,config:de}),L3=ty({BigNumber:we,config:de}),ou=Zm({}),k3=j0({BigNumber:we,config:de}),q3=G0({}),z3=Q0({BigNumber:we,config:de}),U3=Gm({}),Ex=_m({}),V3=ny({BigNumber:we,config:de}),$3=Wy({BigNumber:we,config:de}),Cx=J0({BigNumber:we,config:de}),H3=H0({}),W3=oy({}),ar=jm({Matrix:ou}),G3=Ry({BigNumber:we,config:de}),Z3=K0({BigNumber:we,config:de}),Nx=Y0({BigNumber:we,config:de}),j3=$0({}),Y3=iy({BigNumber:we,config:de}),Z=Im({BigNumber:we,Complex:zr,DenseMatrix:ar,Fraction:ia}),Ac=yd({BigNumber:we,config:de,typed:Z}),J3=_y({BigNumber:we,config:de}),Zt=xd({typed:Z}),X3=Cv({Complex:zr,config:de,typed:Z}),Q3=Av({BigNumber:we,typed:Z}),K3=Sv({BigNumber:we,Complex:zr,config:de,typed:Z}),vt=Dd({typed:Z}),eO=Qd({typed:Z}),rO=Ov({BigNumber:we,Complex:zr,config:de,typed:Z}),tO=Iv({typed:Z}),Ax=_v({typed:Z}),nO=Pv({Complex:zr,config:de,typed:Z}),ti=ld({BigNumber:we,typed:Z}),iO=Yd({typed:Z}),aO=ud({typed:Z}),oO=Ym({typed:Z}),su=c0({typed:Z}),uu=cd({Complex:zr,typed:Z}),aa=Kd({typed:Z}),sO=kv({typed:Z}),uO=zv({BigNumber:we,typed:Z}),lO=Uv({BigNumber:we,typed:Z}),cO=Cd({typed:Z}),fr=id({config:de,typed:Z}),fO=Fh({typed:Z}),Fx=Nd({typed:Z}),mO=Ad({Complex:zr,typed:Z}),pO=uh({typed:Z}),dO=ch({typed:Z}),Ho=Th({typed:Z}),hO=fh({typed:Z}),vO=Ih({format:Ho,typed:Z}),Fc=eh({typed:Z}),vn=Xm({typed:Z}),La=Xp({typed:Z}),lu=ed({typed:Z}),Pn=rd({typed:Z}),gO=ry({BigNumber:we,config:de}),yO=p0({Complex:zr,typed:Z}),xO=_d({Complex:zr,config:de,typed:Z}),Sx=Rd({Complex:zr,config:de,typed:Z}),ka=dh({typed:Z}),tt=Ld({typed:Z}),Mx=th({typed:Z}),ki=od({typed:Z}),DO=Bh({format:Ho,typed:Z}),bO=N0({config:de,typed:Z}),wO=_h({typed:Z}),EO=A0({config:de,typed:Z}),Sc=rh({typed:Z}),CO=$v({BigNumber:we,typed:Z}),Tx=zd({BigNumber:we,Fraction:ia,complex:uu,typed:Z}),Mc=Wv({typed:Z}),wi=ad({Matrix:ou,equalScalar:fr,typed:Z}),NO=vd({typed:Z}),AO=Vd({typed:Z}),FO=sd({typed:Z}),SO=Zv({typed:Z}),Ox=nd({typed:Z}),MO=Nv({Complex:zr,config:de,typed:Z}),TO=Mv({BigNumber:we,typed:Z}),Tc=Us({isInteger:vn,typed:Z}),OO=Tv({BigNumber:we,Complex:zr,config:de,typed:Z}),BO=Oh({format:Ho,typed:Z}),IO=f0({typed:Z}),Oc=Lv({typed:Z}),_O=Vv({BigNumber:we,typed:Z}),Wo=td({typed:Z}),RO=Ph({typed:Z}),PO=F0({config:de,typed:Z}),LO=Hv({BigNumber:we,typed:Z}),kO=Gv({typed:Z}),qO=wv({SparseMatrix:wi,typed:Z}),ni=Ud({Complex:zr,config:de,typed:Z}),zO=jv({typed:Z}),Ei=gd({typed:Z}),UO=Fv({BigNumber:we,Complex:zr,config:de,typed:Z}),VO=qv({BigNumber:we,typed:Z}),qa=fd({Fraction:ia,typed:Z}),oa=Qp({typed:Z}),Ee=md({DenseMatrix:ar,Matrix:ou,SparseMatrix:wi,typed:Z}),$O=pd({isZero:Pn,matrix:Ee,typed:Z}),HO=Sh({isNaN:Wo,isNumeric:oa,typed:Z}),Ln=Lh({bignumber:ti,fraction:qa,number:ki}),Bx=Mh({config:de,multiplyScalar:tt,numeric:Ln,typed:Z}),WO=vh({isInteger:vn,matrix:Ee,typed:Z}),kt=Dh({matrix:Ee,config:de,typed:Z}),GO=bh({matrix:Ee,typed:Z}),tn=js({matrix:Ee,typed:Z}),Go=wh({matrix:Ee,typed:Z}),Ix=Hd({BigNumber:we,config:de,matrix:Ee,typed:Z}),ii=Ch({BigNumber:we,config:de,matrix:Ee,typed:Z}),ZO=Bv({Complex:zr,config:de,typed:Z}),_x=bd({BigNumber:we,Complex:zr,Fraction:ia,config:de,isNegative:La,matrix:Ee,typed:Z,unaryMinus:Ei}),br=Vs({isInteger:vn,matrix:Ee,typed:Z}),jO=ah({prod:Bx,size:kt,typed:Z}),Bc=Eh({conj:aa,transpose:Go,typed:Z}),Rx=sh({DenseMatrix:ar,SparseMatrix:wi,matrix:Ee,typed:Z}),Zr=kh({numeric:Ln,typed:Z}),Zo=Wh({DenseMatrix:ar,concat:br,divideScalar:Zr,equalScalar:fr,matrix:Ee,typed:Z}),kn=nv({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),jo=lh({matrix:Ee,typed:Z}),YO=Bd({BigNumber:we,DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),JO=Kp({isNumeric:oa,typed:Z}),qi=mh({BigNumber:we,DenseMatrix:ar,SparseMatrix:wi,config:de,matrix:Ee,typed:Z}),XO=ph({matrix:Ee,multiplyScalar:tt,typed:Z}),cu=uv({DenseMatrix:ar,concat:br,config:de,matrix:Ee,typed:Z}),QO=Jh({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z,zeros:ii}),Ic=hd({flatten:jo,matrix:Ee,size:kt,typed:Z}),Px=Pd({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),KO=qd({BigNumber:we,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),eB=hh({BigNumber:we,config:de,matrix:Ee,typed:Z}),rB=gh({config:de,matrix:Ee}),tB=Xh({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z,zeros:ii}),fu=zh({BigNumber:we,DenseMatrix:ar,equalScalar:fr,matrix:Ee,typed:Z,zeros:ii}),gn=av({DenseMatrix:ar,concat:br,config:de,matrix:Ee,typed:Z}),nB=Rh({concat:br,matrix:Ee,typed:Z}),iB=cv({DenseMatrix:ar,concat:br,config:de,equalScalar:fr,matrix:Ee,typed:Z}),aB=ih({DenseMatrix:ar,concat:br,matrix:Ee,typed:Z}),Ur=ag({DenseMatrix:ar,SparseMatrix:wi,addScalar:vt,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),oB=jd({concat:br,equalScalar:fr,matrix:Ee,typed:Z}),sB=Xd({DenseMatrix:ar,concat:br,matrix:Ee,typed:Z}),uB=T0({addScalar:vt,combinations:su,divideScalar:Zr,isInteger:vn,isNegative:La,multiplyScalar:tt,typed:Z}),za=ev({BigNumber:we,DenseMatrix:ar,Fraction:ia,concat:br,config:de,equalScalar:fr,matrix:Ee,typed:Z}),Lx=tv({concat:br,matrix:Ee,typed:Z}),lB=eu({add:Ur,typed:Z,unaryPlus:Ac}),_c=lv({equal:kn,typed:Z}),mu=ug({addScalar:vt,conj:aa,multiplyScalar:tt,size:kt,typed:Z}),cB=iv({compareText:Lx,isZero:Pn,typed:Z}),kx=Td({DenseMatrix:ar,config:de,equalScalar:fr,matrix:Ee,round:fu,typed:Z,zeros:ii}),fB=og({abs:Zt,addScalar:vt,divideScalar:Zr,isPositive:lu,multiplyScalar:tt,smaller:gn,sqrt:ni,typed:Z}),qx=pv({DenseMatrix:ar,smaller:gn}),qt=dv({ImmutableDenseMatrix:qx}),mB=Wd({BigNumber:we,add:Ur,config:de,equal:kn,isInteger:vn,mod:Px,smaller:gn,typed:Z,xgcd:Ix}),yn=sv({DenseMatrix:ar,concat:br,config:de,matrix:Ee,typed:Z}),Rc=Uh({Complex:zr,config:de,divideScalar:Zr,typed:Z}),pB=dd({flatten:jo,matrix:Ee,size:kt,typed:Z}),dB=Js({config:de,numeric:Ln,smaller:gn,typed:Z}),Vr=kd({addScalar:vt,dot:mu,equalScalar:fr,matrix:Ee,multiplyScalar:tt,typed:Z}),hB=$h({Complex:zr,config:de,divideScalar:Zr,typed:Z}),vB=nh({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),Pc=fv({compare:za,isNaN:Wo,isNumeric:oa,typed:Z}),gB=l0({add:Ur,compare:za,multiply:Vr,partitionSelect:Pc,typed:Z}),yB=Qh({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z,zeros:ii}),Lc=ov({DenseMatrix:ar,concat:br,config:de,matrix:Ee,typed:Z}),Pr=$d({DenseMatrix:ar,addScalar:vt,concat:br,equalScalar:fr,matrix:Ee,typed:Z,unaryMinus:Ei}),xB=lg({add:Ur,matrix:Ee,typed:Z}),kc=Zh({DenseMatrix:ar,divideScalar:Zr,equalScalar:fr,matrix:Ee,multiplyScalar:tt,subtract:Pr,typed:Z}),DB=Kh({concat:br,equalScalar:fr,matrix:Ee,not:Mx,typed:Z,zeros:ii}),bB=Jd({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),qc=Ed({DenseMatrix:ar,config:de,equalScalar:fr,matrix:Ee,round:fu,typed:Z,zeros:ii}),ai=rv({compare:za,typed:Z}),wB=O0({addScalar:vt,combinations:su,isInteger:vn,isNegative:La,isPositive:lu,larger:yn,typed:Z}),EB=oh({matrix:Ee,multiply:Vr,subtract:Pr,typed:Z}),zx=jg({divideScalar:Zr,isZero:Pn,matrix:Ee,multiply:Vr,subtract:Pr,typed:Z,unaryMinus:Ei}),CB=Ws({matrix:Ee,number:ki,subtract:Pr,typed:Z}),NB=i0({abs:Zt,addScalar:vt,deepEqual:_c,divideScalar:Zr,multiplyScalar:tt,sqrt:ni,subtract:Pr,typed:Z}),AB=Gd({concat:br,equalScalar:fr,matrix:Ee,multiplyScalar:tt,typed:Z}),Ux=hv({larger:yn,smaller:gn}),Vx=Sd({Complex:zr,DenseMatrix:ar,ceil:qc,equalScalar:fr,floor:kx,matrix:Ee,typed:Z,zeros:ii}),$x=cg({Index:qt,typed:Z}),FB=a0({abs:Zt,add:Ur,addScalar:vt,config:de,divideScalar:Zr,equalScalar:fr,flatten:jo,isNumeric:oa,isZero:Pn,matrix:Ee,multiply:Vr,multiplyScalar:tt,smaller:gn,subtract:Pr,typed:Z}),SB=Id({concat:br,equalScalar:fr,matrix:Ee,typed:Z}),MB=Vh({Complex:zr,config:de,divideScalar:Zr,log:Rc,typed:Z}),Hx=Gh({DenseMatrix:ar,divideScalar:Zr,equalScalar:fr,matrix:Ee,multiplyScalar:tt,subtract:Pr,typed:Z}),Wx=Ys({config:de,larger:yn,numeric:Ln,typed:Z}),zc=Pg({addScalar:vt,complex:uu,conj:aa,divideScalar:Zr,equal:kn,identity:qi,isZero:Pn,matrix:Ee,multiplyScalar:tt,sign:Tx,sqrt:ni,subtract:Pr,typed:Z,unaryMinus:Ei,zeros:ii}),Ua=Gs({bignumber:ti,matrix:Ee,config:de,larger:yn,largerEq:cu,smaller:gn,smallerEq:Lc,typed:Z}),TB=Zs({Index:qt,matrix:Ee,range:Ua,typed:Z}),OB=Yv({DenseMatrix:ar,Index:qt,compareNatural:ai,size:kt,subset:tn,typed:Z}),BB=Xv({DenseMatrix:ar,Index:qt,compareNatural:ai,size:kt,subset:tn,typed:Z}),IB=Kv({Index:qt,compareNatural:ai,size:kt,subset:tn,typed:Z}),_B=rg({Index:qt,compareNatural:ai,size:kt,subset:tn,typed:Z}),Gx=kg({SparseMatrix:wi,abs:Zt,add:Ur,divideScalar:Zr,larger:yn,largerEq:cu,multiply:Vr,subtract:Pr,transpose:Go,typed:Z}),Zx=vv({FibonacciHeap:Ux,addScalar:vt,equalScalar:fr}),jx=Ks({add:Ur,config:de,numeric:Ln,typed:Z}),Yx=Yh({DenseMatrix:ar,divideScalar:Zr,equalScalar:fr,matrix:Ee,multiplyScalar:tt,subtract:Pr,typed:Z}),RB=Rv({BigNumber:we,DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,typed:Z}),Jx=$s({Index:qt,matrix:Ee,range:Ua,typed:Z}),PB=jh({DenseMatrix:ar,divideScalar:Zr,equalScalar:fr,matrix:Ee,multiplyScalar:tt,subtract:Pr,typed:Z}),Xx=Jv({DenseMatrix:ar,Index:qt,compareNatural:ai,size:kt,subset:tn,typed:Z}),LB=eg({Index:qt,compareNatural:ai,size:kt,subset:tn,typed:Z}),Qx=ng({Index:qt,concat:br,setDifference:Xx,size:kt,subset:tn,typed:Z}),kB=mv({compare:za,compareNatural:ai,matrix:Ee,typed:Z}),sa=Yg({abs:Zt,addScalar:vt,det:zx,divideScalar:Zr,identity:qi,matrix:Ee,multiply:Vr,typed:Z,unaryMinus:Ei}),Kx=Rg({DenseMatrix:ar,Spa:Zx,SparseMatrix:wi,abs:Zt,addScalar:vt,divideScalar:Zr,equalScalar:fr,larger:yn,matrix:Ee,multiplyScalar:tt,subtract:Pr,typed:Z,unaryMinus:Ei}),qB=Jg({Complex:zr,add:Ur,ctranspose:Bc,deepEqual:_c,divideScalar:Zr,dot:mu,dotDivide:Zo,equal:kn,inv:sa,matrix:Ee,multiply:Vr,typed:Z}),oi=qh({Complex:zr,config:de,fraction:qa,identity:qi,inv:sa,matrix:Ee,multiply:Vr,number:ki,typed:Z}),e1=Qv({DenseMatrix:ar,Index:qt,compareNatural:ai,size:kt,subset:tn,typed:Z}),zB=ig({Index:qt,concat:br,setIntersect:e1,setSymDifference:Qx,size:kt,subset:tn,typed:Z}),UB=Kg({abs:Zt,add:Ur,identity:qi,inv:sa,map:ka,max:Wx,multiply:Vr,size:kt,sqrt:ni,subtract:Pr,typed:Z}),Ye=Dv({BigNumber:we,Complex:zr,Fraction:ia,abs:Zt,addScalar:vt,config:de,divideScalar:Zr,equal:kn,fix:Vx,format:Ho,isNumeric:oa,multiplyScalar:tt,number:ki,pow:oi,round:fu,subtract:Pr}),VB=py({BigNumber:we,Unit:Ye,config:de}),$B=jy({BigNumber:we,Unit:Ye,config:de}),HB=Py({BigNumber:we,Unit:Ye,config:de}),WB=vy({BigNumber:we,Unit:Ye,config:de}),GB=ky({BigNumber:we,Unit:Ye,config:de}),ZB=gy({BigNumber:we,Unit:Ye,config:de}),jB=Ev({Unit:Ye,typed:Z}),YB=My({BigNumber:we,Unit:Ye,config:de}),JB=Hh({DenseMatrix:ar,concat:br,equalScalar:fr,matrix:Ee,pow:oi,typed:Z}),XB=my({BigNumber:we,Unit:Ye,config:de}),QB=hy({BigNumber:we,Unit:Ye,config:de}),KB=Qg({abs:Zt,add:Ur,identity:qi,inv:sa,multiply:Vr,typed:Z}),eI=qy({BigNumber:we,Unit:Ye,config:de}),r1=Nh({addScalar:vt,ceil:qc,conj:aa,divideScalar:Zr,dotDivide:Zo,exp:Fx,i:wx,log2:Sx,matrix:Ee,multiplyScalar:tt,pow:oi,tau:Cx,typed:Z}),t1=m0({BigNumber:we,Complex:zr,config:de,multiplyScalar:tt,pow:oi,typed:Z}),rI=uy({BigNumber:we,Unit:Ye,config:de}),tI=Fy({BigNumber:we,Unit:Ye,config:de}),nI=Ah({conj:aa,dotDivide:Zo,fft:r1,typed:Z}),iI=by({BigNumber:we,Unit:Ye,config:de}),aI=Uy({BigNumber:we,Unit:Ye,config:de}),oI=fy({BigNumber:we,Unit:Ye,config:de}),sI=Yy({BigNumber:we,Unit:Ye,config:de}),uI=$y({BigNumber:we,Unit:Ye,config:de}),lI=Ty({BigNumber:we,Unit:Ye,config:de}),cI=Dy({BigNumber:we,Unit:Ye,config:de}),fI=rx({BigNumber:we,Unit:Ye,config:de}),mI=Qy({BigNumber:we,Unit:Ye,config:de}),pI=tx({BigNumber:we,Unit:Ye,config:de}),dI=Sy({BigNumber:we,Unit:Ye,config:de}),hI=cy({BigNumber:we,Unit:Ye,config:de}),vI=By({BigNumber:we,Unit:Ye,config:de}),gI=Gy({BigNumber:we,Unit:Ye,config:de}),yI=sy({BigNumber:we,Unit:Ye,config:de}),xI=Zy({BigNumber:we,Unit:Ye,config:de}),DI=Iy({BigNumber:we,Unit:Ye,config:de}),bI=Ly({BigNumber:we,Unit:Ye,config:de}),wI=wy({BigNumber:we,Unit:Ye,config:de}),EI=dy({BigNumber:we,Unit:Ye,config:de}),xn=n0({divideScalar:Zr,equalScalar:fr,inv:sa,matrix:Ee,multiply:Vr,typed:Z}),CI=Cy({BigNumber:we,Unit:Ye,config:de}),pu=d0({gamma:t1,typed:Z}),NI=zy({BigNumber:we,Unit:Ye,config:de}),AI=Vy({BigNumber:we,Unit:Ye,config:de}),FI=yy({BigNumber:we,Unit:Ye,config:de}),n1=zg({DenseMatrix:ar,lsolve:Hx,lup:Kx,matrix:Ee,slu:Gx,typed:Z,usolve:kc}),SI=xy({BigNumber:we,Unit:Ye,config:de}),MI=Jy({BigNumber:we,Unit:Ye,config:de}),TI=v0({add:Ur,divide:xn,factorial:pu,isInteger:vn,isPositive:lu,multiply:Vr,typed:Z}),OI=g0({factorial:pu,typed:Z}),BI=Ky({BigNumber:we,Unit:Ye,config:de}),II=Ug({add:Ur,cbrt:_x,divide:xn,equalScalar:fr,im:Fc,isZero:Pn,multiply:Vr,re:Sc,sqrt:ni,subtract:Pr,typeOf:Ox,typed:Z,unaryMinus:Ei}),_I=tg({compareNatural:ai,typed:Z}),i1=S0({bignumber:ti,addScalar:vt,combinations:su,divideScalar:Zr,factorial:pu,isInteger:vn,isNegative:La,larger:yn,multiplyScalar:tt,number:ki,pow:oi,subtract:Pr,typed:Z}),RI=bv({Unit:Ye,typed:Z}),PI=M0({addScalar:vt,isInteger:vn,isNegative:La,stirlingS2:i1,typed:Z}),a1=Xg({abs:Zt,add:Ur,addScalar:vt,atan:Ax,bignumber:ti,column:Jx,complex:uu,config:de,cos:Oc,diag:Rx,divideScalar:Zr,dot:mu,equal:kn,flatten:jo,im:Fc,inv:sa,larger:yn,matrix:Ee,matrixFromColumns:Ic,multiply:Vr,multiplyScalar:tt,number:ki,qr:zc,re:Sc,sin:Mc,smaller:gn,sqrt:ni,subtract:Pr,typed:Z,usolve:kc,usolveAll:Yx}),LI=Ny({BigNumber:we,Unit:Ye,config:de}),kI=Xy({BigNumber:we,Unit:Ye,config:de}),qI=h0({divide:xn,dotDivide:Zo,isNumeric:oa,log:Rc,map:ka,matrix:Ee,multiply:Vr,sum:jx,typed:Z}),zI=ru({add:Ur,divide:xn,typed:Z}),UI=Hy({BigNumber:we,Unit:Ye,config:de}),VI=ly({BigNumber:we,Unit:Ye,config:de}),$I=Oy({BigNumber:we,Unit:Ye,config:de}),Uc=tu({add:Ur,apply:Tc,divide:xn,isNaN:Wo,multiply:Vr,subtract:Pr,typed:Z}),HI=Ey({BigNumber:we,Unit:Ye,config:de}),o1=o0({add:Ur,compare:za,divide:xn,partitionSelect:Pc,typed:Z}),WI=ex({BigNumber:we,Unit:Ye,config:de}),GI=nu({map:ka,sqrt:ni,typed:Z,variance:Uc}),ZI=s0({abs:Zt,map:ka,median:o1,subtract:Pr,typed:Z}),Vc=sg({abs:Zt,add:Ur,conj:aa,ctranspose:Bc,eigs:a1,equalScalar:fr,larger:yn,matrix:Ee,multiply:Vr,pow:oi,smaller:gn,sqrt:ni,typed:Z}),s1=xh({BigNumber:we,DenseMatrix:ar,SparseMatrix:wi,addScalar:vt,config:de,cos:Oc,matrix:Ee,multiplyScalar:tt,norm:Vc,sin:Mc,typed:Z,unaryMinus:Ei}),jI=yh({multiply:Vr,rotationMatrix:s1,typed:Z}),u1=r0({identity:qi,matrix:Ee,multiply:Vr,norm:Vc,qr:zc,subtract:Pr,typed:Z}),l1=e0({abs:Zt,add:Ur,concat:br,identity:qi,index:$x,lusolve:n1,matrix:Ee,matrixFromColumns:Ic,multiply:Vr,range:Ua,schur:u1,subset:tn,subtract:Pr,transpose:Go,typed:Z}),YI=t0({matrix:Ee,multiply:Vr,sylvester:l1,transpose:Go,typed:Z});var Yo={},Jo={},JI={},Ht=fg({mathWithTransform:Jo}),Xo=Eg({Node:Ht}),zi=Cg({Node:Ht}),Va=Ng({Node:Ht}),XI=Fg({Node:Ht}),Qo=pg({Node:Ht}),QI=hg({Node:Ht,ResultSet:Ex}),KI=vg({Node:Ht}),ua=Dg({Node:Ht}),e_=Ag({Node:Ht}),TU=V0({classes:JI}),c1=$g({math:Yo,typed:Z}),r_=bg({Node:Ht,typed:Z}),OU=Zg({Chain:c1,typed:Z}),Ko=mg({Node:Ht,subset:tn}),es=wg({Node:Ht,size:kt}),t_=dg({matrix:Ee,Node:Ht,subset:tn}),la=Sg({Unit:Ye,Node:Ht,math:Yo}),ca=Mg({Node:Ht,SymbolNode:la,math:Yo}),si=Tg({AccessorNode:Ko,ArrayNode:Qo,AssignmentNode:t_,BlockNode:QI,ConditionalNode:KI,ConstantNode:ua,FunctionAssignmentNode:r_,FunctionNode:ca,IndexNode:es,ObjectNode:Xo,OperatorNode:zi,ParenthesisNode:Va,RangeNode:e_,RelationalNode:XI,SymbolNode:la,config:de,numeric:Ln,typed:Z}),n_=k0({ConstantNode:ua,FunctionNode:ca,OperatorNode:zi,ParenthesisNode:Va,parse:si,typed:Z}),f1=P0({bignumber:ti,fraction:qa,AccessorNode:Ko,ArrayNode:Qo,ConstantNode:ua,FunctionNode:ca,IndexNode:es,ObjectNode:Xo,OperatorNode:zi,SymbolNode:la,config:de,mathWithTransform:Jo,matrix:Ee,typed:Z}),m1=Og({parse:si,typed:Z}),i_=Bg({parse:si,typed:Z}),a_=Vg({parse:si}),o_=Ig({evaluate:i_}),p1=L0({AccessorNode:Ko,ArrayNode:Qo,ConstantNode:ua,FunctionNode:ca,IndexNode:es,ObjectNode:Xo,OperatorNode:zi,ParenthesisNode:Va,SymbolNode:la,add:Ur,divide:xn,equal:kn,isZero:Pn,multiply:Vr,parse:si,pow:oi,subtract:Pr,typed:Z}),BU=Gg({Help:a_,mathWithTransform:Jo,typed:Z}),$c=R0({bignumber:ti,fraction:qa,AccessorNode:Ko,ArrayNode:Qo,ConstantNode:ua,FunctionNode:ca,IndexNode:es,ObjectNode:Xo,OperatorNode:zi,ParenthesisNode:Va,SymbolNode:la,add:Ur,config:de,divide:xn,equal:kn,isZero:Pn,mathWithTransform:Jo,matrix:Ee,multiply:Vr,parse:si,pow:oi,resolve:n_,simplifyConstant:f1,simplifyCore:p1,subtract:Pr,typed:Z}),IU=q0({OperatorNode:zi,parse:si,simplify:$c,typed:Z}),_U=z0({ConstantNode:ua,FunctionNode:ca,OperatorNode:zi,ParenthesisNode:Va,SymbolNode:la,config:de,equal:kn,isZero:Pn,numeric:Ln,parse:si,simplify:$c,typed:Z}),RU=_g({Parser:o_,typed:Z}),PU=B0({parse:si,typed:Z}),LU=U0({bignumber:ti,fraction:qa,AccessorNode:Ko,ArrayNode:Qo,ConstantNode:ua,FunctionNode:ca,IndexNode:es,ObjectNode:Xo,OperatorNode:zi,ParenthesisNode:Va,SymbolNode:la,add:Ur,config:de,divide:xn,equal:kn,isZero:Pn,mathWithTransform:Jo,matrix:Ee,multiply:Vr,parse:si,pow:oi,simplify:$c,simplifyConstant:f1,simplifyCore:p1,subtract:Pr,typed:Z});et(Yo,{e:bx,false:I3,fineStructure:_3,i:wx,Infinity:R3,LN10:P3,LOG10E:L3,NaN:k3,null:q3,phi:z3,SQRT1_2:V3,sackurTetrode:$3,tau:Cx,true:H3,E:bx,version:W3,efimovFactor:G3,LN2:Z3,pi:Nx,replacer:j3,reviver:TU,SQRT2:Y3,typed:Z,unaryPlus:Ac,PI:Nx,weakMixingAngle:J3,abs:Zt,acos:X3,acot:Q3,acsc:K3,addScalar:vt,arg:eO,asech:rO,asinh:tO,atan:Ax,atanh:nO,bignumber:ti,bitNot:iO,boolean:aO,clone:oO,combinations:su,complex:uu,conj:aa,cosh:sO,coth:uO,csc:lO,cube:cO,equalScalar:fr,erf:fO,exp:Fx,expm1:mO,filter:pO,forEach:dO,format:Ho,getMatrixDataType:hO,hex:vO,im:Fc,isInteger:vn,isNegative:La,isPositive:lu,isZero:Pn,LOG2E:gO,lgamma:yO,log10:xO,log2:Sx,map:ka,multiplyScalar:tt,not:Mx,number:ki,oct:DO,pickRandom:bO,print:wO,random:EO,re:Sc,sec:CO,sign:Tx,sin:Mc,splitUnit:NO,square:AO,string:FO,tan:SO,typeOf:Ox,acosh:MO,acsch:TO,apply:Tc,asec:OO,bin:BO,chain:OU,combinationsWithRep:IO,cos:Oc,csch:_O,isNaN:Wo,isPrime:RO,randomInt:PO,sech:LO,sinh:kO,sparse:qO,sqrt:ni,tanh:zO,unaryMinus:Ei,acoth:UO,cot:VO,fraction:qa,isNumeric:oa,matrix:Ee,matrixFromFunction:$O,mode:HO,numeric:Ln,prod:Bx,reshape:WO,size:kt,squeeze:GO,subset:tn,transpose:Go,xgcd:Ix,zeros:ii,asin:ZO,cbrt:_x,concat:br,count:jO,ctranspose:Bc,diag:Rx,divideScalar:Zr,dotDivide:Zo,equal:kn,flatten:jo,gcd:YO,hasNumericValue:JO,identity:qi,kron:XO,largerEq:cu,leftShift:QO,matrixFromColumns:Ic,mod:Px,nthRoot:KO,ones:eB,resize:rB,rightArithShift:tB,round:fu,smaller:gn,to:nB,unequal:iB,xor:aB,add:Ur,bitAnd:oB,bitXor:sB,catalan:uB,compare:za,compareText:Lx,cumsum:lB,deepEqual:_c,dot:mu,equalText:cB,floor:kx,hypot:fB,invmod:mB,larger:yn,log:Rc,matrixFromRows:pB,min:dB,multiply:Vr,nthRoots:hB,or:vB,partitionSelect:Pc,quantileSeq:gB,rightLogShift:yB,smallerEq:Lc,subtract:Pr,trace:xB,usolve:kc,and:DB,bitOr:bB,ceil:qc,compareNatural:ai,composition:wB,cross:EB,det:zx,diff:CB,distance:NB,dotMultiply:AB,fix:Vx,index:$x,intersect:FB,lcm:SB,log1p:MB,lsolve:Hx,max:Wx,qr:zc,range:Ua,row:TB,setCartesian:OB,setDistinct:BB,setIsSubset:IB,setPowerset:_B,slu:Gx,sum:jx,usolveAll:Yx,atan2:RB,column:Jx,lsolveAll:PB,setDifference:Xx,setMultiplicity:LB,setSymDifference:Qx,sort:kB,inv:sa,lup:Kx,pinv:qB,pow:oi,setIntersect:e1,setUnion:zB,sqrtm:UB,vacuumImpedance:VB,wienDisplacement:$B,atomicMass:HB,bohrMagneton:WB,boltzmann:GB,conductanceQuantum:ZB,createUnit:jB,deuteronMass:YB,dotPow:JB,electricConstant:XB,elementaryCharge:QB,expm:KB,faraday:eI,fft:r1,gamma:t1,gravitationConstant:rI,hartreeEnergy:tI,ifft:nI,klitzing:iI,loschmidt:aI,magneticConstant:oI,molarMass:sI,molarPlanckConstant:uI,neutronMass:lI,nuclearMagneton:cI,planckCharge:fI,planckLength:mI,planckTemperature:pI,protonMass:dI,reducedPlanckConstant:hI,rydberg:vI,secondRadiation:gI,speedOfLight:yI,stefanBoltzmann:xI,thomsonCrossSection:DI,avogadro:bI,bohrRadius:wI,coulomb:EI,divide:xn,electronMass:CI,factorial:pu,firstRadiation:NI,gasConstant:AI,inverseConductanceQuantum:FI,lusolve:n1,magneticFluxQuantum:SI,molarMassC12:MI,multinomial:TI,permutations:OI,planckMass:BI,polynomialRoot:II,setSize:_I,stirlingS2:i1,unit:RI,bellNumbers:PI,eigs:a1,fermiCoupling:LI,gravity:kI,kldivergence:qI,mean:zI,molarVolume:UI,planckConstant:VI,quantumOfCirculation:$I,variance:Uc,classicalElectronRadius:HI,median:o1,parse:si,planckTime:WI,resolve:n_,simplifyConstant:f1,std:GI,compile:m1,evaluate:i_,mad:ZI,simplifyCore:p1,help:BU,norm:Vc,rotationMatrix:s1,simplify:$c,symbolicEqual:IU,derivative:_U,parser:RU,rotate:jI,leafCount:PU,rationalize:LU,schur:u1,sylvester:l1,lyap:YI,config:de});et(Jo,Yo,{filter:ax({typed:Z}),forEach:ox({typed:Z}),map:ux({typed:Z}),apply:nx({isInteger:vn,typed:Z}),subset:dx({matrix:Ee,typed:Z}),concat:hx({isInteger:vn,matrix:Ee,typed:Z}),max:lx({config:de,larger:yn,numeric:Ln,typed:Z}),sum:yx({add:Ur,config:de,numeric:Ln,typed:Z}),min:fx({config:de,numeric:Ln,smaller:gn,typed:Z}),cumsum:xx({add:Ur,typed:Z,unaryPlus:Ac}),diff:vx({bignumber:ti,matrix:Ee,number:ki,subtract:Pr,typed:Z}),index:sx({Index:qt}),range:mx({bignumber:ti,matrix:Ee,config:de,larger:yn,largerEq:cu,smaller:gn,smallerEq:Lc,typed:Z}),row:px({Index:qt,matrix:Ee,range:Ua,typed:Z}),column:ix({Index:qt,matrix:Ee,range:Ua,typed:Z}),mean:cx({add:Ur,divide:xn,typed:Z}),variance:Dx({add:Ur,apply:Tc,divide:xn,isNaN:Wo,multiply:Vr,subtract:Pr,typed:Z}),std:gx({map:ka,sqrt:ni,typed:Z,variance:Uc})});et(JI,{BigNumber:we,Complex:zr,Fraction:ia,Matrix:ou,Node:Ht,ObjectNode:Xo,OperatorNode:zi,ParenthesisNode:Va,Range:U3,RelationalNode:XI,ResultSet:Ex,ArrayNode:Qo,BlockNode:QI,ConditionalNode:KI,ConstantNode:ua,DenseMatrix:ar,RangeNode:e_,Chain:c1,FunctionAssignmentNode:r_,SparseMatrix:wi,AccessorNode:Ko,IndexNode:es,AssignmentNode:t_,ImmutableDenseMatrix:qx,Index:qt,FibonacciHeap:Ux,Spa:Zx,Unit:Ye,SymbolNode:la,FunctionNode:ca,Help:a_,Parser:o_});c1.createProxy(Yo);var rs=class extends wo{};var Hc=class extends rs{constructor(r,n,i,a,o,c,u=void 0){var s;super(r,n,a,o,c,u);if(this.errorCollection.merge(i.errorCollection),this.viewField=new Co(this),this.fullDeclaration=i.fullDeclaration,this.viewFieldDeclaration=i,this.variables=[],this.errorCollection.isEmpty())try{for(let l of(s=this.viewFieldDeclaration.bindTargets)!=null?s:[])this.variables.push({bindTargetDeclaration:this.plugin.api.bindTargetParser.parseBindTarget(l,this.filePath),writeSignal:new Mi(void 0),uuid:self.crypto.randomUUID(),metadataCache:void 0,writeSignalListener:void 0,contextName:void 0});this.parseExpression()}catch(l){this.errorCollection.add(l)}}parseExpression(){var i;let r=(i=this.viewFieldDeclaration.declaration)!=null?i:"",n=0;this.expressionStr=r.replace(/{.*?}/g,a=>{a=a.substring(1,a.length-1).trim();for(let o of this.variables)if(o.bindTargetDeclaration.metadataFieldName===a){let c=`MB_VAR_${n}`;return o.contextName=c,n+=1,c}return"MB_VAR_NOT_FOUND"}),this.expression=m1(this.expressionStr)}buildContext(){var n,i;let r={};for(let a of(n=this.variables)!=null?n:[])!a.contextName||!a.writeSignal||(r[a.contextName]=(i=a.writeSignal.get())!=null?i:"");return r}async evaluateExpression(){if(!this.expression)throw new pa("ERROR","failed to evaluate expression","expression is undefined");let r=this.buildContext();try{return this.expression.evaluate(r)}catch(n){throw new pa("ERROR","failed to evaluate expression",n,{declaration:this.viewFieldDeclaration.declaration,expression:this.expressionStr,context:r})}}registerSelfToMetadataManager(){for(let r of this.variables)r.writeSignalListener=r.writeSignal.registerListener({callback:()=>{this.viewField.update()}}),r.metadataCache=this.plugin.metadataManager.register(r.bindTargetDeclaration.filePath,this.frontmatter,r.writeSignal,r.bindTargetDeclaration.metadataPath,this.uuid+"/"+r.uuid)}unregisterSelfFromMetadataManager(){for(let r of this.variables)r.writeSignalListener&&r.writeSignal.unregisterListener(r.writeSignalListener),this.plugin.metadataManager.unregister(r.bindTargetDeclaration.filePath,this.uuid+"/"+r.uuid)}getInitialValue(){return""}async onload(){if(console.log("meta-bind | ViewFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("meta-bind-plugin-view"),this.containerEl.empty(),new Fa({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}}),this.errorCollection.hasErrors())return;this.registerSelfToMetadataManager(),this.plugin.mdrcManager.registerMDRC(this);let r=createDiv();r.addClass("meta-bind-plugin-view-wrapper"),this.viewField.render(r),this.containerEl.appendChild(r)}onunload(){console.log("meta-bind | ViewFieldMarkdownRenderChild >> unload",this),this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),this.containerEl.empty(),this.containerEl.createEl("span",{text:"unloaded meta bind view field",cls:"meta-bind-plugin-error"}),super.onunload()}};var s_=Yt(om());var Wc=class extends rs{constructor(r,n,i,a,o,c,u=void 0){var s;super(r,n,a,o,c,u);if(this.errorCollection.merge(i.errorCollection),this.viewField=new Co(this),this.fullDeclaration=i.fullDeclaration,this.viewFieldDeclaration=i,this.variables=[],this.errorCollection.isEmpty())try{for(let l of(s=this.viewFieldDeclaration.bindTargets)!=null?s:[])this.variables.push({bindTargetDeclaration:this.plugin.api.bindTargetParser.parseBindTarget(l.bindTarget,this.filePath),writeSignal:new Mi(void 0),uuid:self.crypto.randomUUID(),metadataCache:void 0,writeSignalListener:void 0,contextName:l.name});this.parseExpression()}catch(l){this.errorCollection.add(l)}}parseExpression(){if(!this.viewFieldDeclaration.code)return;let n=this.viewFieldDeclaration.code.contains("await")?async function(){}.constructor:Function;this.expression=n("app","mb","dv","filePath","context",this.viewFieldDeclaration.code)}buildContext(){var n,i;let r={};for(let a of(n=this.variables)!=null?n:[])!a.contextName||!a.writeSignal||(r[a.contextName]=(i=a.writeSignal.get())!=null?i:"");return r}async evaluateExpression(){if(!this.expression)throw new is("CRITICAL","Can't evaluate expression.","Expression is undefined.");if(!this.plugin.settings.enableJs)throw new is("CRITICAL","Can't evaluate expression.","JS expressions are disabled in the plugin settings.");let r=this.buildContext();try{return await Promise.resolve(this.expression(this.plugin.app,this.plugin.api,(0,s_.getAPI)(this.plugin.app),this.filePath,r))}catch(n){throw new pa("ERROR","failed to evaluate js expression",n,{declaration:this.viewFieldDeclaration.code,context:r})}}registerSelfToMetadataManager(){for(let r of this.variables)r.writeSignalListener=r.writeSignal.registerListener({callback:()=>{this.viewField.update()}}),r.metadataCache=this.plugin.metadataManager.register(r.bindTargetDeclaration.filePath,this.frontmatter,r.writeSignal,r.bindTargetDeclaration.metadataPath,this.uuid+"/"+r.uuid)}unregisterSelfFromMetadataManager(){for(let r of this.variables)r.writeSignalListener&&r.writeSignal.unregisterListener(r.writeSignalListener),this.plugin.metadataManager.unregister(r.bindTargetDeclaration.filePath,this.uuid+"/"+r.uuid)}getInitialValue(){return""}async onload(){if(console.log("meta-bind | ViewFieldMarkdownRenderChild >> load",this),this.containerEl.addClass("meta-bind-plugin-view"),this.containerEl.empty(),new Fa({target:this.containerEl,props:{app:this.plugin.app,errorCollection:this.errorCollection,declaration:this.fullDeclaration}}),this.errorCollection.hasErrors())return;this.registerSelfToMetadataManager(),this.plugin.mdrcManager.registerMDRC(this);let r=createDiv();r.addClass("meta-bind-plugin-view-wrapper"),this.viewField.render(r),this.containerEl.appendChild(r)}onunload(){console.log("meta-bind | ViewFieldMarkdownRenderChild >> unload",this),this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),this.containerEl.empty(),this.containerEl.createEl("span",{text:"unloaded meta bind view field",cls:"meta-bind-plugin-error"}),super.onunload()}};var Gc=class{constructor(e){this.plugin=e,this.inputFieldParser=new Iu,this.viewFieldParser=new ml,this.bindTargetParser=new pl(this.plugin)}createInlineAPI(e,r){return new fl(this,e,r)}createInputField(e,r,n,i,a){if(!Object.values(bo).contains(n))throw new or("CRITICAL","failed to create input field",`unknown render child type '${n}'`);return e=this.inputFieldParser.parseDeclaration(e,void 0,r),new Ss(a,n,e,this.plugin,i,self.crypto.randomUUID())}createInputFieldFromString(e,r,n,i){let a=this.inputFieldParser.parseString(e);return new Ss(i,r,a,this.plugin,n,self.crypto.randomUUID())}createViewFieldFromString(e,r,n,i){let a=this.viewFieldParser.parseString(e);return new Hc(i,r,a,this.plugin,n,self.crypto.randomUUID())}createJsViewFieldFromString(e,r,n,i){let a=this.viewFieldParser.parseJsString(e);return new Wc(i,r,a,this.plugin,n,self.crypto.randomUUID())}createInputFieldDeclaration(e,r){if(this.inputFieldParser.getInputFieldType(e)==="invalid")throw new or("CRITICAL","failed to create input field declaration",`input field type '${e}' is invalid`);let n=new Nn("InputFieldDeclaration");return{declaration:void 0,fullDeclaration:void 0,inputFieldType:e,argumentContainer:this.inputFieldParser.parseArguments(e,r,n),isBound:!1,bindTarget:"",errorCollection:n}}createInputFieldDeclarationFromString(e){return this.inputFieldParser.parseString(e)}bindInputFieldDeclaration(e,r,n){if(n&&!r)throw new ui("ERROR","failed to bind input field declaration","if a bind target file is specified, a bind target field must also be specified");return e.isBound=li(r),e.bindTarget=n?n+"#"+r:r,e}};(function(t){t(window.CodeMirror)})(function(t){"use strict";t.customOverlayMode=function(e,r,n){return{startState:()=>({base:t.startState(e),overlay:t.startState(r),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}),copyState:i=>({base:t.copyState(e,i.base),overlay:t.copyState(r,i.overlay),basePos:i.basePos,baseCur:null,overlayPos:i.overlayPos,overlayCur:null}),token:(i,a)=>((i!=a.streamSeen||Math.min(a.basePos,a.overlayPos)<i.start)&&(a.streamSeen=i,a.basePos=a.overlayPos=i.start),i.start==a.basePos&&(a.baseCur=e.token(i,a.base),a.basePos=i.pos),i.start==a.overlayPos&&(i.pos=i.start,a.overlayCur=r.token(i,a.overlay),a.overlayPos=i.pos),i.pos=Math.min(a.basePos,a.overlayPos),a.overlayCur==null?a.baseCur:a.baseCur!=null&&a.overlay.combineTokens||n&&a.overlay.combineTokens==null?a.baseCur+" "+a.overlayCur:a.overlayCur),indent:e.indent&&((i,a,o)=>e.indent(i.base,a,o)),electricChars:e.electricChars,innerMode:i=>({state:i.base,mode:e}),blankLine:i=>{let a,o;return e.blankLine&&(a=e.blankLine(i.base)),r.blankLine&&(o=r.blankLine(i.overlay)),o==null?a:n&&a!=null?a+" "+o:o}}}});var fa=require("@codemirror/view"),du=require("@codemirror/language"),Jc=require("obsidian");var l_=require("obsidian");var u_=require("@codemirror/view");var Zc=class extends u_.WidgetType{constructor(r,n,i,a){super();this.content=r,this.filePath=n,this.parentComponent=i,this.plugin=a}eq(r){return r.content===this.content}toDOM(r){let n=document.createElement("span");return n.addClass("cm-inline-code"),this.renderChild=this.createRenderChild(n),this.renderChild.load(),this.parentComponent.addChild(this.renderChild),n}destroy(r){var n;(n=this.renderChild)==null||n.unload(),super.destroy(r)}},jc=class extends Zc{createRenderChild(e){return this.plugin.api.createViewFieldFromString(this.content,"inline",this.filePath,e)}},Yc=class extends Zc{createRenderChild(e){return this.plugin.api.createInputFieldFromString(this.content,"inline",this.filePath,e)}},d1=(r=>(r.INPUT_FIELD_WIDGET="INPUT_FIELD_WIDGET",r.VIEW_FIELD_WIDGET="VIEW_FIELD_WIDGET",r))(d1||{});var Dn=class{static checkSelectionOverlap(e,r,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=r&&i.from<=n)return!0;return!1}static getContent(e,r,n){return e.sliceDoc(r,n)}static constructMarkdownRenderChildWidget(e,r,n,i,a){if(e==="INPUT_FIELD_WIDGET")return new Yc(r,n,i,a);if(e==="VIEW_FIELD_WIDGET")return new jc(r,n,i,a)}static getDeclarationPrefix(e){if(e==="INPUT_FIELD_WIDGET")return"INPUT";if(e==="VIEW_FIELD_WIDGET")return"VIEW";throw new Qe("ERROR","failed to get declaration prefix",`Invalid widget type "${e}"`)}static isDeclaration(e,r){let n=Dn.getDeclarationPrefix(e)+"[",i="]";return r.startsWith(n)&&r.endsWith(i)}static isDeclarationAndGetWidgetType(e){if(!!e.endsWith("]"))for(let r of Object.values(d1)){let n=Dn.getDeclarationPrefix(r)+"[";if(e.startsWith(n))return r}}static getCurrentFile(e){return e.state.field(l_.editorInfoField).file}static existsDecorationBetween(e,r,n){let i=!1;return e.between(r,n,()=>{i=!0}),i}};function c_(t){return fa.ViewPlugin.fromClass(class{constructor(e){var r;this.component=new Jc.Component,this.component.load(),this.decorations=(r=this.renderWidgets(e))!=null?r:fa.Decoration.none}update(e){var r;if(!e.state.field(Jc.editorLivePreviewField)){this.decorations=fa.Decoration.none;return}e.docChanged?(this.decorations=this.decorations.map(e.changes),this.updateTree(e.view)):e.selectionSet?this.updateTree(e.view):e.viewportChanged&&(this.decorations=(r=this.renderWidgets(e.view))!=null?r:fa.Decoration.none)}updateTree(e){for(let{from:r,to:n}of e.visibleRanges)(0,du.syntaxTree)(e.state).iterate({from:r,to:n,enter:i=>{let a=i.node,{shouldRender:o,content:c,widgetType:u}=this.getRenderInfo(e,a);o?u!==void 0&&c!==void 0&&this.addDecoration(a,e,c,u):u!==void 0&&c!==void 0&&this.removeDecoration(a)}})}removeDecoration(e){this.decorations.between(e.from-1,e.to+1,(r,n,i)=>{this.decorations=this.decorations.update({filterFrom:r,filterTo:n,filter:(a,o,c)=>!1})})}addDecoration(e,r,n,i){var s;let a=e.from-1,o=e.to+1;if(Dn.existsDecorationBetween(this.decorations,a,o))return;let c=Dn.getCurrentFile(r);if(!c)return;let u=(s=this.renderWidget(e,i,n,c))==null?void 0:s.value;!u||(this.decorations=this.decorations.update({add:[{from:a,to:o,value:u}]}))}getRenderInfo(e,r){let n=r.type.prop(du.tokenClassNodeProp),i=new Set(n==null?void 0:n.split(" "));if(i.has("inline-code")&&!i.has("formatting")){let a=e.state.selection,o=Dn.checkSelectionOverlap(a,r.from-1,r.to+1),c=this.readNode(e,r.from,r.to);return{shouldRender:!o,content:c.content,widgetType:c.widgetType}}return{shouldRender:!1,content:void 0,widgetType:void 0}}readNode(e,r,n){let i=Dn.getContent(e.state,r,n);return{content:i,widgetType:Dn.isDeclarationAndGetWidgetType(i)}}renderWidgets(e){let r=Dn.getCurrentFile(e);if(!r)return;let n=[];for(let i of e.visibleRanges)(0,du.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,c=this.getRenderInfo(e,o);if(!c.shouldRender||!c.widgetType||!c.content)return;let u=this.renderWidget(o,c.widgetType,c.content,r);u&&n.push(u)}});return fa.Decoration.set(n,!0)}renderWidget(e,r,n,i){let a=Dn.constructMarkdownRenderChildWidget(r,n,i.path,this.component,t);if(!!a)return fa.Decoration.replace({widget:a}).range(e.from-1,e.to+1)}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var Xc=class{constructor(){this.activeMDRCs=new Map}unload(){for(let e of this.activeMDRCs.values())console.debug(`meta-bind | MDRCManager >> unregistered MDRC ${e.uuid}`),e.unload()}registerMDRC(e){console.debug(`meta-bind | MDRCManager >> registered MDRC ${e.uuid}`),this.activeMDRCs.set(e.uuid,e)}unregisterMDRC(e){console.debug(`meta-bind | MDRCManager >> unregistered MDRC ${e.uuid}`),this.activeMDRCs.delete(e.uuid)}};var Do=class extends f_.Plugin{async onload(){console.log("meta-bind | Main >> load"),await this.loadSettings(),this.api=new Gc(this),Ar.dateFormat=this.settings.preferredDateFormat,this.api.inputFieldParser.parseTemplates(this.settings.inputTemplates),yf(this.settings.firstWeekday),this.mdrcManager=new Xc,this.metadataManager=new cl(this),this.registerMarkdownPostProcessor((r,n)=>{let i=r.querySelectorAll("code");for(let a=0;a<i.length;a++){let o=i.item(a);if(o.hasClass("meta-bind-none"))continue;let c=o.innerText,u=c.startsWith("INPUT[")&&c.endsWith("]"),s=c.startsWith("VIEW[")&&c.endsWith("]");if(u){let l=this.api.createInputFieldFromString(c,"inline",n.sourcePath,o);n.addChild(l)}if(s){let l=this.api.createViewFieldFromString(c,"inline",n.sourcePath,o);n.addChild(l)}}},100),this.registerMarkdownCodeBlockProcessor("meta-bind",(r,n,i)=>{let a=n,o=r.replace(/\n/g,"");if(o.startsWith("INPUT[")&&o.endsWith("]")){let u=this.api.createInputFieldFromString(o,"block",i.sourcePath,a);i.addChild(u)}}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(r,n,i)=>{let a=this.api.createJsViewFieldFromString(r,"block",i.sourcePath,n);i.addChild(a)}),this.registerEditorExtension(c_(this)),this.addCommand({id:"mb-test-command",name:"test command",editorCallback:(r,n)=>{n.file&&this.app.fileManager.processFrontMatter(n.file,i=>i)}}),this.addSettingTab(new yu(this.app,this))}async registerCodeMirrorMode(){let r=window.CodeMirror.getMode({},"javascript");if(r==null||r.name==="null"){console.log("Couldn't find js mode, can't enable syntax highlighting.");return}window.CodeMirror.defineMode("meta-bind-js",n=>({startState:()=>({...window.CodeMirror.startState(r)}),blankLine:a=>null,copyState:a=>({...window.CodeMirror.startState(r)}),token:(a,o)=>`line-HyperMD-codeblock ${r.token&&r.token(a,o)}`}))}onunload(){console.log("meta-bind | Main >> unload"),this.mdrcManager.unload()}getFilePathsByName(r){let n=w1(r),i=n?as(r):tf(as(r)),a=this.app.vault.getMarkdownFiles(),o=[];for(let c of a)n?as(c.path)===i&&o.push(c.path):tf(as(c.name))===i&&o.push(c.path);return o}async loadSettings(){console.log("meta-bind | Main >> settings load"),this.settings=Object.assign({},qn,await this.loadData())}async saveSettings(){console.log("meta-bind | Main >> settings save"),Ar.dateFormat=this.settings.preferredDateFormat,this.api.inputFieldParser.parseTemplates(this.settings.inputTemplates),yf(this.settings.firstWeekday),await this.saveData(this.settings)}};
/*!
* 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
*/
/**
* @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.
**/
/**
* @license Fraction.js v4.2.0 05/03/2022
* https://www.xarg.org/2014/03/rational-numbers-in-javascript/
*
* Copyright (c) 2021, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/