Files
cours/.obsidian/plugins/obsidian-meta-bind-plugin/main.js
T
2026-04-24 22:08:21 +02:00

141 lines
1.1 MiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Version: 1.4.8
-------------------------------------------
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
-------------------------------------------
Copyright (C) 2026 Moritz Jung
-------------------------------------------
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require(`obsidian`),d=require(`@codemirror/language`),f=require(`@codemirror/view`);var p=class{input;position;latestError;constructor(e,t){this.input=e,this.position=t}atEOF(){return this.position>=this.input.length}advanceTo(e){this.position=e}sliceTo(e){return this.input.slice(this.position,e)}succeedOffset(e,t){return this.succeedAt(this.position+e,t)}failOffset(e,t){return this.failAt(this.position+e,t)}succeed(e){return this.succeedAt(this.position,e)}fail(e){return this.failAt(this.position,e)}succeedAt(e,t){return this.advanceTo(e),{success:!0,value:t}}failAt(e,t){return this.advanceTo(e),this.addError(Array.isArray(t)?t:[t]),{success:!1,value:void 0}}addError(e){this.latestError===void 0||this.latestError.position<this.position?this.latestError={position:this.position,expected:e}:this.latestError.position===this.position&&(this.latestError.expected=E(this.latestError.expected,e)??e)}getAndClearLatestError(){let e=this.latestError;return this.latestError=void 0,e}mergeLatestError(e){e!==void 0&&(this.latestError===void 0||this.latestError.position<e.position?this.latestError=e:this.latestError.position===e.position&&(this.latestError.expected=E(this.latestError.expected,e.expected)??e.expected))}};function m(e,t,n){let{line:r,column:i}=g(e,t.furthest),a=`Expected ${t.expected.sort().join(` or `)}`,o=`Parse Failure: ${a} at index ${t.furthest}, line ${r}, column ${i}.`;if(n){let t=e.split(`
`)[r-1],n=`${r} | `;o+=`\n\n${n}${t}`,o+=`\n${` `.repeat(i-1+n.length)}^ (${a})`}return o}var h=class extends Error{constructor(e,t){super(m(e,t,!0))}};function g(e,t){let n=1,r=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
`?(n++,r=1):r++;return{line:n,column:r}}var _=class e{static sequence(...e){if(e.length===0)throw Error(`sequence must have at least one parser argument`);return new T(function(t){let n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r].p(t);if(!i.success)return i;n[r]=i.value}return{success:!0,value:n}})}static sequenceMap(e,...t){if(t.length===0)throw Error(`sequenceMap must have at least one parser argument`);return new T(function(n){let r=Array(t.length);for(let e=0;e<t.length;e++){let i=t[e].p(n);if(!i.success)return i;r[e]=i.value}return{success:!0,value:e(...r)}})}static createLanguage(t){let n={},r={},i={};for(let a in t)i[a]=e.reference(()=>t[a](n,i)),Object.defineProperty(r,a,{get:()=>{if(n[a]!==void 0)return n[a];throw Error(`Can not access rule '${a}' in language. Rule is not yet defined. Try to access it via 'ref'.`)}});for(let e in t)n[e]=t[e](r,i);return n}static or(...e){if(e.length===0)throw Error(`or must have at least one alternative`);return new T(function(t){let n=t.position;for(let r of e){let e=r;t.position=n;let i=e.p(t);if(i.success)return i}return{success:!1,value:void 0}})}static separateBy(t,n){return this.separateByNotEmpty(t,n).or(e.succeed([]))}static separateByNotEmpty(e,t){return this.sequenceMap(function(e,t){return t.unshift(e),t},e,t.then(e).many())}static string(e){let t=`'`+e+`'`;return new T(function(n){for(let r=0;r<e.length;r++)if(n.input[n.position+r]!==e[r])return n.fail(t);return n.succeedOffset(e.length,e)})}static regexp(e,t){O(e.flags);let n=e.source;return t===void 0?new T(function(t){let r=t.input.slice(t.position),i=e.exec(r);if(i!==null){let e=i[0];return t.succeedOffset(e.length,e)}else return t.fail(n)}):new T(function(r){let i=r.input.slice(r.position),a=e.exec(i);if(a!==null){let e=t??0;if(e>=0&&e<=a.length){let t=a[0],n=a[e];return r.succeedOffset(t.length,n)}let i=`expected valid match group (0 to `+a.length+`) in `+n;return r.fail(i)}else return r.fail(n)})}static succeed(e){return new T(function(t){return t.succeed(e)})}static fail(e){return new T(function(t){return t.fail(e)})}static oneOf(e){return k.test(function(t){return e.includes(t)},`one character of '${e}'`)}static noneOf(e){return k.test(function(t){return!e.includes(t)},`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(e=>this.string(e))).describe(e.map(e=>`'${e}'`).join(` or `))}static manyOf(e){return new T(function(t){let n=t.position;for(;n<t.input.length&&e.includes(t.input[n]);n++);return t.succeedAt(n,t.sliceTo(n))})}static manyNotOf(e){return new T(function(t){let n=t.position;for(;n<t.input.length&&!e.includes(t.input[n]);n++);return t.succeedAt(n,t.sliceTo(n))})}static custom(e){return new T(e)}static range(e,t){let n=e.charCodeAt(0),r=t.charCodeAt(0);return k.testCharCode(function(e){return n<=e&&e<=r},`${e}-${t}`)}static takeWhile(e){return new T(function(t){let n=t.position;for(;n<t.input.length&&e(t.input[n]);)n++;return t.succeedAt(n,t.input.slice(t.position,n))})}static reference(e){return new T(function(t){return e().p(t)})}},v=48,y=57,b=97,x=122,S=65,C=90,w=class e{static position(){return new T(e=>e.succeed(e.position))}static any(){return new T(e=>e.atEOF()?e.fail(`any character`):e.succeedOffset(1,e.input[e.position]))}static remaining(){return new T(e=>e.succeedAt(e.input.length,e.input.slice(e.position)))}static eof(){return new T(e=>e.atEOF()?e.succeed(void 0):e.fail(`eof`))}static digit(){return k.testCharCode(e=>e>=v&&e<=y,`a digit`)}static digits(){return k.testCharCodes(e=>e>=v&&e<=y,`multiple digits`)}static letter(){return k.testCharCode(e=>e>=b&&e<=x||e>=S&&e<=C,`a letter`)}static letters(){return k.testCharCodes(e=>e>=b&&e<=x||e>=S&&e<=C,`multiple letters`)}static unicodeLetter(){return _.regexp(/^\p{L}/iu).describe(`a unicode letter`)}static unicodeLetters(){return _.regexp(/^\p{L}+/iu).describe(`multiple unicode letters`)}static unicodeAlphanumeric(){return _.regexp(/^[\p{L}\p{N}]/iu).describe(`a unicode alphanumeric character`)}static unicodeAlphanumerics(){return _.regexp(/^[\p{L}\p{N}]+/iu).describe(`multiple unicode alphanumeric characters`)}static optionalWhitespace(){return new T(function(e){let t=e.position;for(;t<e.input.length;t++){let n=e.input[t];if(n!==` `&&n!==` `&&n!==`
`&&n!==`\r`)break}return e.succeedAt(t,void 0)})}static whitespace(){return new T(function(e){let t=e.position;for(;t<e.input.length;t++){let n=e.input[t];if(n!==` `&&n!==` `&&n!==`
`&&n!==`\r`)break}return t===e.position?e.fail(`whitespace`):e.succeedAt(t,void 0)})}static cr(){return new T(function(e){let t=e.input[e.position];return!e.atEOF()&&t===`\r`?e.succeedOffset(1,void 0):e.fail(`\\r`)})}static lf(){return new T(function(e){let t=e.input[e.position];return!e.atEOF()&&t===`
`?e.succeedOffset(1,void 0):e.fail(`\\n`)})}static crlf(){return new T(function(e){if(e.position+1>=e.input.length)return e.fail(`\\r\\n`);let t=e.input[e.position],n=e.input[e.position+1];return t===`\r`&&n===`
`?e.succeedOffset(2,void 0):e.fail(`\\r\\n`)})}static newline(){let e=`newline`;return new T(function(t){if(t.position>=t.input.length)return t.fail(e);let n=t.input[t.position];return n===`
`?t.succeedOffset(1,void 0):n===`\r`?t.position+1<t.input.length&&t.input[t.position+1]===`
`?t.succeedOffset(2,void 0):t.succeedOffset(1,void 0):t.fail(e)})}static prefix(e,t,n){return _.sequenceMap((e,t)=>e.reduce((e,t)=>n(t,e),t),e.many(),t)}static postfix(e,t,n){return _.sequenceMap((e,t)=>t.reduce((e,t)=>n(t,e),e),t,e.many())}static binaryRight(e,t,n){return _.sequenceMap((e,t)=>e.reverse().reduce((e,t)=>{let[r,i]=t;return n(r,i,e)},t),_.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,n){return _.sequenceMap((e,t)=>t.reduce((e,t)=>{let[r,i]=t;return n(e,r,i)},e),t,_.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(t,n,r){return _.sequenceMap((e,t,n)=>e.reverse().reduce((e,t)=>{let[i,a,o]=t;return r({from:i,to:n},a,o,e)},t),_.sequence(e.position(),n,t.trim(this.optionalWhitespace())).many(),n,e.position())}static binaryLeftRange(t,n,r){return _.sequenceMap((e,t,n)=>n.reduce((t,n)=>{let[i,a,o]=n;return r({from:e,to:o},t,i,a)},t),e.position(),n,_.sequence(t.trim(this.optionalWhitespace()),n,e.position()).many())}static func(e,t,n){let r=typeof e==`string`?_.string(e):e;return _.sequenceMap((e,t,r,i,a,o)=>n(e,i),r,_.string(`(`),this.optionalWhitespace(),t,this.optionalWhitespace(),_.string(`)`))}},T=class e{p;constructor(e){this.p=e}tryParse(e){let t=new p(e,0),n=this.p(t);return n.success?n:{success:!1,value:void 0,furthest:t.latestError.position,expected:t.latestError.expected}}parse(e){let t=this.tryParse(e);if(t.success)return t.value;throw new h(e,t)}or(e){let t=this;return _.or(t,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(_.string(e))}wrap(t,n){let r=this;return new e(function(e){let i=t.p(e);if(!i.success)return i;let a=r.p(e);if(!a.success)return a;let o=n.p(e);return o.success?a:o})}wrapString(e,t){return this.wrap(_.string(e),_.string(t))}then(t){let n=this;return new e(function(e){let r=n.p(e);if(!r.success)return r;let i=t.p(e);return i.success,i})}skip(t){let n=this;return new e(function(e){let r=n.p(e);if(!r.success)return r;let i=t.p(e);return i.success?r:i})}and(e){let t=this;return _.sequence(t,e)}many(){let t=this;return new e(function(e){let n=[];for(;;){let r=e.position,i=t.p(e);if(i.success){if(e.position===r)throw Error(`infinite loop in many() parser detected`);n.push(i.value)}else return e.position=r,{success:!0,value:n}}})}repeat(t,n){D(t,n);let r=this;return new e(function(e){let i=[],a=0;for(;a<n;){let n=e.position,o=r.p(e);if(o.success){if(e.position===n)throw Error(`infinite loop in many() parser detected`);i.push(o.value),a++}else return e.position=n,a>=t?{success:!0,value:i}:{success:!1,value:void 0}}return{success:!0,value:i}})}atMost(e){return this.repeat(0,e)}atLeast(e){return _.sequenceMap((e,t)=>e.concat(t),this.repeat(e,e),this.many())}separateBy(e){return _.separateBy(this,e)}separateByNotEmpty(e){return _.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(t){let n=this;return new e(function(e){let r=n.p(e);return r.success?{success:!0,value:t(r.value)}:r})}marker(){let e=this;return _.sequenceMap(function(e,t,n){return{value:t,range:{from:e,to:n}}},w.position(),e,w.position())}namedMarker(e){let t=this;return _.sequenceMap(function(t,n,r){return{value:n,name:e,range:{from:t,to:r}}},w.position(),t,w.position())}node(e){let t=this;return _.sequenceMap(function(t,n,r){return e(n,{from:t,to:r})},w.position(),t,w.position())}followedBy(e){return this.skip(k.followedBy(e))}notFollowedBy(e){return this.skip(k.notFollowedBy(e))}describe(t){typeof t==`string`&&(t=[t]);let n=this;return new e(function(e){let r=e.getAndClearLatestError(),i=n.p(e);return e.latestError!==void 0&&(e.latestError.expected=t),e.mergeLatestError(r),i})}box(t){let n=this;return new e(function(e){let r=e.getAndClearLatestError(),i=n.p(e);return e.latestError!==void 0&&(e.latestError.expected=[`(${e.latestError.expected.join(` or `)} as part of ${t})`]),e.mergeLatestError(r),i})}optional(e){return this.or(_.succeed(e))}chain(t){let n=this;return new e(function(e){let r=n.p(e);return r.success?t(r.value).p(e):r})}thenEof(){let t=this;return new e(function(e){let n=t.p(e);return n.success?e.atEOF()?n:e.fail(`eof`):n})}};function E(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n=[...e];for(let e of t)n.includes(e)||n.push(e);return n}function D(e,t){if(t<e)throw Error(`Invalid Range: max might not be smaller than min. Received [${e}, ${t}].`);if(e<0||t<0)throw Error(`Invalid Range: max and min might not be smaller than 0. Received [${e}, ${t}].`);if(e===1/0||t===1/0)throw Error(`Invalid Range: max and min might not be infinity. Received [${e}, ${t}].`);if(!Number.isInteger(e)||!Number.isInteger(t))throw Error(`Invalid Range: max and min must be integers. Received [${e}, ${t}].`)}function O(e){for(let t of e)if(t!==`i`&&t!==`m`&&t!==`s`&&t!==`u`)throw Error(`RegExp flag '${t}' is not allowed. The only allowed flags are 'i', 'm', 's' and 'u'.`)}var k=new class{followedBy(e){return new T(function(t){let n=t.position,r=e.p(t);return t.position=n,r})}notFollowedBy(e){return new T(function(t){let n=t.position,r=e.p(t),i=t.input.slice(n,t.position);return t.position=n,r.success?t.fail(`not '${i}'`):t.succeed(void 0)})}test(e,t){return new T(function(n){let r=n.input[n.position];return!n.atEOF()&&e(r)?n.succeedOffset(1,r):n.fail(t)})}testCharCode(e,t){return new T(function(n){let r=n.input.charCodeAt(n.position);return!n.atEOF()&&e(r)?n.succeedOffset(1,n.input[n.position]):n.fail(t)})}testCharCodes(e,t){return new T(function(n){let r=n.position;for(;r<n.input.length&&e(n.input.charCodeAt(r));r++);if(r>n.position){let e=n.input.slice(n.position,r);return n.succeedAt(r,e)}else return n.fail(t)})}},A=function(e){return e.INLINE=`inline`,e.BLOCK=`block`,e}({}),j=function(e){return e.INPUT=`INPUT`,e.VIEW=`VIEW`,e.JS_VIEW=`JS_VIEW`,e.TABLE=`TABLE`,e.BUTTON_GROUP=`BUTTON_GROUP`,e.BUTTON=`BUTTON`,e.EMBED=`EMBED`,e.EXCLUDED=`EXCLUDED`,e}({}),M=class{linePosition;constructor(e){this.linePosition=e}getPosition(){return this.linePosition}};function N(e){return e===j.INPUT||e===j.VIEW||e===j.BUTTON_GROUP}var P=function(e){return e.CRITICAL=`CRITICAL`,e.ERROR=`ERROR`,e.WARNING=`WARNING`,e}({}),F=function(e){return e.INTERNAL=`MB_INTERNAL`,e.PARSING=`MB_PARSING`,e.BIND_TARGET=`MB_BIND_TARGET`,e.VALUE=`MB_VALUE`,e.ARGUMENT=`MB_ARGUMENT`,e.JS=`MB_JS`,e.EXPRESSION=`MB_EXPRESSION`,e.PUBLISH=`MB_PUBLISH`,e.VALIDATION=`MB_VALIDATION`,e.PARSINOM=`MB_PARSINOM`,e.EXAMPLE=`MB_EXAMPLE`,e.EMBED=`MB_EMBED`,e.BUTTON=`MB_BUTTON`,e.DEPENDENCY=`MB_DEPENDENCY`,e.OTHER=`OTHER`,e}({}),I=class extends Error{errorLevel;effect;cause;tip;docs;context;positionContext;constructor(e){super(``),this.errorLevel=e.errorLevel,this.effect=e.effect,this.cause=e.cause,this.tip=e.tip,this.docs=e.docs,this.context=e.context,this.positionContext=e.positionContext,this.updateMessage()}updateMessage(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"`}log(){console.log(this.message,this.stack,this.context)}},L=class extends I{getErrorType(){return F.INTERNAL}},ee=class extends I{getErrorType(){return F.PARSING}},R=class extends I{getErrorType(){return F.VALIDATION}},te=class extends I{getErrorType(){return F.BIND_TARGET}},z=class extends I{getErrorType(){return F.ARGUMENT}},ne=class extends I{getErrorType(){return F.JS}},re=class extends I{getErrorType(){return F.EXPRESSION}},ie=class extends I{getErrorType(){return F.EXAMPLE}},ae=class extends I{getErrorType(){return F.BUTTON}},oe=class extends I{getErrorType(){return F.DEPENDENCY}};function se(e,t){let n=e.thenEof().tryParse(t);if(n.success)return n.value;throw new ce(P.ERROR,`parsiNOM parser`,t,n)}var ce=class extends I{str;parseFailure;source;constructor(e,t,n,r){super({errorLevel:e,effect:`Failed to parse. Check that your syntax is correct.`,cause:`expected ${r.expected.sort().join(` or `)}`}),this.str=n,this.parseFailure=r,this.source=t,this.updateMessage2()}getErrorType(){return F.PARSINOM}updateMessage2(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"\n`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"\n`;let e=g(this.str,this.parseFailure.furthest),t=this.str.split(`
`)[e.line-1]??``,n=`${e.line} | `;this.positionContext=`${n}${t}`,this.positionContext+=`\n${this.getUnderline(n.length,e.column)}\n`,this.message+=`
`+this.positionContext}getUnderline(e,t){return` `.repeat(t+e-1)+`^ (${this.cause})`}},le=class extends I{str;position;source;constructor(e,t,n,r,i,a){super({errorLevel:e,effect:`Failed to validate the result of the parser.`,cause:n,docs:a}),this.str=r,this.position=i,this.source=t,this.updateMessage2()}getErrorType(){return F.VALIDATION}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"\n`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"\n`,this.str&&this.position){let e=g(this.str,this.position.from),t=g(this.str,this.position.to),n=this.str.split(`
`)[e.line-1]??``,r=`${e.line} | `;this.positionContext=`${r}${n}`,this.positionContext+=`\n${this.getUnderline(r.length,n.length,e,t)}\n`,this.message+=`
`+this.positionContext}}getUnderline(e,t,n,r){if(this.position===void 0)return``;let i=` `.repeat(n.column+e-1),a=r.line===n.line?r.column:t+1;return i+`^`.repeat(Math.max(1,a-n.column))}},ue=_.sequence(_.or(w.unicodeLetter(),_.oneOf(`_$`)),_.or(w.unicodeAlphanumeric(),_.oneOf(`-_$`)).many()).map(e=>e[0]+e[1].join(``)).describe(`identifier`),de=_.sequenceMap((e,t)=>e+t.map(e=>e[0]+e[1]).join(``),ue,_.sequence(w.optionalWhitespace(),ue).many()).describe(`identifier with spaces`),fe=_.string(`\\`).then(w.any()).map(e=>e===`'`?`'`:e===`\\`?`\\`:`\\`+e);function pe(e){return _.or(fe,_.noneOf(e+`\\`)).many().map(e=>e.join(``)).trim(_.string(e))}var me=pe(`'`),he=pe(`"`),ge=_.manyNotOf(`{}[]#^|:?`).box(`file path`);function _e(e,t){return{value:e,position:t}}function ve(e){if(e!==void 0)return typeof e==`string`?{value:e}:e}var ye=function(e){return e.OBJECT=`object`,e.ARRAY=`array`,e}({}),be=class{parent;access;child;constructor(e,t,n){this.parent=e,this.access=t,this.child=n}};function xe(e,t){return e[t]}function Se(e,t,n){e[t]=n}var Ce=class{type;prop;index;constructor(e,t){if(this.type=e,this.prop=e===ye.OBJECT?t:``,this.index=e===ye.ARRAY?Number(t):0,Number.isNaN(this.index))throw Error(`can not access array with non number index`)}get(e){if(this.type===ye.OBJECT){if(typeof e!=`object`||!e)throw Error(`can not access property of non-object`);return new be(e,this,xe(e,this.prop))}else{if(typeof e!=`object`||!e||!Array.isArray(e))throw Error(`can not access property of non-array`);return new be(e,this,e[this.index])}}set(e,t){if(this.type===ye.OBJECT){if(typeof e!=`object`||!e)throw Error(`can not access property of non-object`);Se(e,this.prop,t)}else{if(typeof e!=`object`||!e||!Array.isArray(e))throw Error(`can not access property of non-array`);e[this.index]=t}}create(e){if(this.type===ye.OBJECT){if(typeof e!=`object`||!e)throw Error(`can not access property of non-object`);Se(e,this.prop,void 0)}else{if(typeof e!=`object`||!e||!Array.isArray(e))throw Error(`can not access property of non-array`);e[this.index]=void 0}}toUnvalidatedPropAccess(){return this.type===ye.OBJECT?{type:this.type,prop:{value:this.prop}}:{type:this.type,prop:{value:this.index.toString()}}}},we=ue.node((e,t)=>({type:ye.OBJECT,prop:_e(e,t)})),Te=_.or(w.digits().wrap(_.string(`[`),_.string(`]`)).node((e,t)=>({type:ye.ARRAY,prop:_e(e,t)})),he.wrap(_.string(`[`),_.string(`]`)).node((e,t)=>({type:ye.OBJECT,prop:_e(e,t)}))),Ee=_.or(_.sequenceMap(e=>({storagePath:void 0,listenToChildren:!0,storageProp:e}),Te.atLeast(1)),_.sequenceMap((e,t)=>({storagePath:void 0,listenToChildren:!0,storageProp:[e,...t]}),we,Te.many())),De=_.sequenceMap((e,t)=>[e,...t],we,Te.many()),Oe=_.sequenceMap((e,t)=>(e.storageProp=e.storageProp.concat(t.flat()),e),Ee,_.string(`.`).then(De).many()),ke=_.sequenceMap((e,t,n)=>(n.storageType=e,n.storagePath=t,n),ue.describe(`storage type`).node(_e).skip(_.string(`^`).describe(`storage type separator "^"`)).optional(),ge.describe(`storage path`).node(_e).skip(_.string(`#`).describe(`storage/file path separator "#"`)).optional(),Oe.describe(`property path`)).box(`bind target`),Ae=_.regexp(/^[^()',]+/).describe(`any character except parentheses, single quotation marks and commas`),je=_.or(me,Ae).node(_e),Me=_.separateBy(je,_.string(`,`).describe(`argument value separator ","`).trim(w.optionalWhitespace())),Ne=_.sequenceMap((e,t)=>({name:e,value:t}),ue.node(_e),Me.trim(w.optionalWhitespace()).wrap(_.string(`(`).describe(`argument value paren "("`),_.string(`)`).describe(`argument value paren ")"`)).optional([])),Pe=_.separateBy(Ne,_.string(`,`).describe(`argument separator ","`).trim(w.optionalWhitespace())),Fe=_.string(`\\`).then(w.any()).map(e=>e===`[`?`[`:e===`]`?`]`:e===`{`?`{`:e===`}`?`}`:e===`\\`?`\\`:`\\`+e),Ie=_.sequenceMap((e,t)=>e+t.flat().join(``),_.manyNotOf(`{}[]\\`),_.sequence(Fe,_.manyNotOf(`{}[]\\`)).many()).box(`View Field Content`),Le=_.sequenceMap((e,t)=>[e,...t.flat()],Ie,_.sequence(ke.wrapString(`{`,`}`),Ie).many()),Re=_.sequenceMap((e,t,n)=>({viewFieldType:e,writeToBindTarget:n===void 0?void 0:n[1],arguments:t,templateDeclaration:void 0}),ue.node(_e).trim(w.optionalWhitespace()).optional().describe(`input field type`),Pe.trim(w.optionalWhitespace()).wrapString(`(`,`)`).trim(w.optionalWhitespace()).optional([]),_.sequence(_.string(`:`).trim(w.optionalWhitespace()),ke).trim(w.optionalWhitespace()).optional()),ze=_.sequenceMap((e,t,n,r)=>r===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:t}:(r.templateDeclaration=t,r),_.string(`VIEW`),Le.wrapString(`[`,`]`),w.optionalWhitespace(),Re.wrapString(`[`,`]`).optional(),w.eof()),Be=_.sequenceMap((e,t,n,r)=>(t!==void 0&&(e.listenToChildren=!0),{bindTarget:e,name:r}),ke.wrapString(`{`,`}`),_.string(` and children`).optional(),_.string(` as `),ue),Ve=_.sequenceMap((e,t,n,r)=>({bindTargetMappings:e,writeToBindTarget:t,hidden:n!==void 0,code:r}),Be.separateBy(w.whitespace()).skip(w.whitespace()),_.string(`save to `).then(ke.wrapString(`{`,`}`)).skip(w.whitespace()).optional(),_.string(`hidden`).skip(w.whitespace()).optional(),_.string(`---`).then(w.remaining())),He=class{range;tokenClass;constructor(e,t){this.range=e,this.tokenClass=t}},Ue=function(e){return e.IDENT=`ident`,e.CONTROL=`control`,e.STRING=`string`,e.KEYWORD=`keyword`,e.ERROR=`error`,e}({}),We=class e{static sequence(...e){return _.sequenceMap((...e)=>e.flat(2).filter(e=>e!==void 0),...e)}static separateBy(t,n){return e.sequence(t,e.sequence(n,t).many()).optional([])}static highlight(e,t){return e.node((e,n)=>[new He(n,t)])}static highlightStr(t,n){return e.highlight(_.string(t),n)}},Ge=We.highlight(ue,Ue.IDENT),Ke=We.highlight(ue,Ue.KEYWORD),qe=We.highlightStr(`,`,Ue.CONTROL),Je=We.highlightStr(`(`,Ue.CONTROL),Ye=We.highlightStr(`)`,Ue.CONTROL),Xe=We.highlightStr(`[`,Ue.CONTROL),Ze=We.highlightStr(`]`,Ue.CONTROL),Qe=We.highlight(me,Ue.STRING),$e=We.highlight(Ae,Ue.IDENT),et=_.or($e,Qe),tt=We.separateBy(et,qe.trim(w.optionalWhitespace())),nt=We.sequence(Ke,We.sequence(Je,tt.trim(w.optionalWhitespace()),Ye).optional()),rt=We.separateBy(nt,qe.trim(w.optionalWhitespace())),it=We.sequence(We.sequence(Ge,We.highlightStr(`^`,Ue.CONTROL)).optional(),We.sequence(We.highlight(ge,Ue.IDENT),We.highlightStr(`#`,Ue.CONTROL)).optional(),We.highlight(Oe,Ue.IDENT)),at=We.sequence(Ke.trim(w.optionalWhitespace()),We.sequence(Je,rt.trim(w.optionalWhitespace()),Ye).trim(w.optionalWhitespace()).optional(),We.sequence(We.highlightStr(`:`,Ue.CONTROL).trim(w.optionalWhitespace()),it).trim(w.optionalWhitespace()).optional()),ot=We.sequence(Ke.trim(w.optionalWhitespace()).optional(),We.sequence(Je,rt.trim(w.optionalWhitespace()),Ye).trim(w.optionalWhitespace()).optional(),We.sequence(We.highlightStr(`:`,Ue.CONTROL).trim(w.optionalWhitespace()),it).trim(w.optionalWhitespace()).optional()),st=_.or(We.sequence(We.highlightStr(`INPUT`,Ue.CONTROL),Xe,Ge.trim(w.optionalWhitespace()),Ze.skip(w.optionalWhitespace()),Xe,ot,Ze),We.sequence(We.highlightStr(`INPUT`,Ue.CONTROL),Xe,at,Ze)),ct=We.highlight(Ie,Ue.IDENT),lt=We.sequence(We.highlightStr(`{`,Ue.STRING),it,We.highlightStr(`}`,Ue.STRING)),ut=We.sequence(ct,We.sequence(lt,ct).many()),dt=We.sequence(Ke.trim(w.optionalWhitespace()).optional(),We.sequence(Je,rt.trim(w.optionalWhitespace()).optional(),Ye).trim(w.optionalWhitespace()).optional(),We.sequence(We.highlightStr(`:`,Ue.CONTROL).trim(w.optionalWhitespace()),it).trim(w.optionalWhitespace()).optional()),ft=We.sequence(We.highlightStr(`VIEW`,Ue.CONTROL),Xe,ut,Ze,We.sequence(Xe.skip(w.optionalWhitespace()),dt,Ze).optional()),pt=We.sequence(We.highlightStr(`BUTTON`,Ue.CONTROL),Xe,We.separateBy(Ge,qe.trim(w.optionalWhitespace())),Ze),mt=class{str;highlights;parsingError;constructor(e,t,n){this.str=e,this.highlights=t.filter(e=>e.range.from!==e.range.to),this.parsingError=n}getHighlights(){if(this.parsingError===void 0)return this.highlights;let e=this.parsingError.parseFailure.furthest;return[new He({from:e,to:e+1},Ue.ERROR)]}};function ht(e,t,n){return Math.min(Math.max(e,t),n)}function gt(e,t,n){return e===void 0?void 0:Math.min(Math.max(e,t),n)}function _t(e,t,n,r,i){return(e-t)/(n-t)*(i-r)+r}function vt(e,t){return(e%t+t)%t}function yt(e,t){if(e===null&&t===null)return!0;if(e===null||t===null||typeof e!=typeof t)return!1;if(typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!yt(e[n],t[n]))return!1;return!0}if(Array.isArray(e)||Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!yt(e[r],t[r]))return!1;return!0}return e===t}function bt(e){return!!e}function xt(e){if(e===void 0)return e;let t=Reflect.ownKeys(e);for(let n of t){let t=e[n];(t&&typeof t==`object`||typeof t==`function`)&&xt(t)}return Object.freeze(e)}function St(){return window.crypto.randomUUID()}function Ct(e){try{return new URL(e),!0}catch{return!1}}function wt(e){window.open(e,`_blank`)}function Tt(e,t,n=`, `,r=`and`){return e.length===0?``:(e=e.map(t),e.length===1?e[0]:e.length===2?`${e[0]} ${r} ${e[1]}`:`${e.slice(0,-1).join(n)} ${r} ${e.slice(-1)}`)}function Et(e,t){e.innerHTML=``,e.className=``;let n=document.createElement(`span`);n.className=`mb-warning mb-unloaded`,n.innerText=`[MB_UNLOADED] ${t}`,e.appendChild(n)}var Dt=class{static createElement(e,t,n){let r=document.createElement(t);return n?.text&&(r.innerText=n.text),n?.class&&(r.className=n.class),e.appendChild(r),r}static addClass(e,t){e.classList.add(...t.split(` `))}static addClasses(e,t){e.classList.add(...t)}static removeClass(e,t){e.classList.remove(...t.split(` `))}static hasClass(e,t){return e.classList.contains(t)}static removeAllClasses(e){e.className=``}static empty(e){for(;e.lastChild;)e.removeChild(e.lastChild)}};function Ot(...e){if(e.length===0)return`/`;if(e.length===1)return kt(e[0]);let t=e[0].startsWith(`/`)?e[0].substring(1):e[0];for(let n=1;n<e.length;n++){if(e[n]===``||e[n]===`/`)continue;let r=t.endsWith(`/`),i=e[n].startsWith(`/`);r&&i?t+=e[n].substring(1):!r&&!i?t+=`/`+e[n]:t+=e[n]}return kt(t)}function kt(e){return e.startsWith(`/`)&&(e=e.substring(1)),e.endsWith(`/`)&&(e=e.substring(0,e.length-1)),e===``?`/`:e}function At(e,t){return t=t.startsWith(`.`)?t:`.`+t,e.endsWith(t)?e:e+t}function jt(e){return e===void 0?[]:Array.isArray(e)?e:[e]}var Mt=class{mb;constructor(e){this.mb=e}highlightInputFieldDeclaration(e,t){return this.highlightWithParser(e,t,st)}highlightViewFieldDeclaration(e,t){return this.highlightWithParser(e,t,ft)}highlightInlineButtonDeclaration(e,t){return this.highlightWithParser(e,t,pt)}highlight(e,t,n){if(t===j.INPUT)return this.highlightInputFieldDeclaration(e,n);if(t===j.VIEW)return this.highlightViewFieldDeclaration(e,n);if(t===j.BUTTON_GROUP)return this.highlightInlineButtonDeclaration(e,n);throw Error(`Unknown MDRCType ${t}`)}highlightBindTarget(e,t){return this.highlightWithParser(e,t,it)}highlightWithParser(e,t,n){try{return t?new mt(e,se(n.trim(w.optionalWhitespace()).thenEof(),e)):new mt(e,se(n.thenEof(),e))}catch(t){return t instanceof ce?new mt(e,[],t):(console.error(t),new mt(e,[]))}}},Nt=function(e){return e.DEFAULT=`default`,e.PRIMARY=`primary`,e.DESTRUCTIVE=`destructive`,e.PLAIN=`plain`,e}({}),Pt=function(e){return e.COMMAND=`command`,e.JS=`js`,e.OPEN=`open`,e.INPUT=`input`,e.SLEEP=`sleep`,e.TEMPLATER_CREATE_NOTE=`templaterCreateNote`,e.RUN_TEMPLATER_FILE=`runTemplaterFile`,e.UPDATE_METADATA=`updateMetadata`,e.CREATE_NOTE=`createNote`,e.REPLACE_IN_NOTE=`replaceInNote`,e.REGEXP_REPLACE_IN_NOTE=`regexpReplaceInNote`,e.REPLACE_SELF=`replaceSelf`,e.INSERT_INTO_NOTE=`insertIntoNote`,e.INLINE_JS=`inlineJS`,e}({}),Ft=class e{type;shiftKey;ctrlKey;altKey;constructor(e,t,n,r){this.type=e,this.shiftKey=t,this.ctrlKey=n,this.altKey=r}static fromMouseEvent(t,n){return new e(n,t.shiftKey,t.ctrlKey,t.altKey)}openInNewTab(){return this.type===It.MIDDLE||this.ctrlKey}},It=function(e){return e.LEFT=`left`,e.MIDDLE=`middle`,e}({}),Lt=class{actionType;mb;constructor(e,t){this.actionType=e,this.mb=t}},Rt=class extends Lt{constructor(e){super(Pt.COMMAND,e)}async run(e,t,n,r,i){this.mb.internal.executeCommandById(t.command)}create(){return{type:Pt.COMMAND,command:``}}getActionLabel(){return`Run a command`}},zt=class extends Lt{constructor(e){super(Pt.CREATE_NOTE,e)}async run(e,t,n,r,i){if(t.openIfAlreadyExists){let e=At(Ot(t.folderPath??``,t.fileName),`md`);if(await this.mb.file.exists(e)){await this.mb.file.open(e,``,!1);return}}await this.mb.file.create(t.folderPath??``,t.fileName,`md`,t.openNote??!1,i.openInNewTab())}create(){return{type:Pt.CREATE_NOTE,folderPath:`/`,fileName:`Untitled`,openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return`Create a new note`}},Bt=class extends Lt{constructor(e){super(Pt.INLINE_JS,e)}async run(e,t,n,r,i){if(!this.mb.getSettings().enableJs)throw new ne({errorLevel:P.CRITICAL,effect:`Can't run button action that requires JS evaluation.`,cause:`JS evaluation is disabled in the plugin settings.`});let a={buttonConfig:structuredClone(e),args:structuredClone(t.args),buttonContext:structuredClone(r),click:structuredClone(i)};(await this.mb.internal.jsEngineRunCode(t.code,n,a))()}create(){return{type:Pt.INLINE_JS,code:`console.log("Hello world")`,args:{}}}getActionLabel(){return`Run JavaScript code`}},Vt=class extends Lt{constructor(e){super(Pt.INPUT,e)}async run(e,t,n,r,i){let a=document.activeElement;a&&a instanceof HTMLInputElement&&(a.setRangeText(t.str,a.selectionStart,a.selectionEnd,`end`),a.dispatchEvent(new Event(`input`,{bubbles:!0})))}create(){return{type:Pt.INPUT,str:``}}getActionLabel(){return`Insert text at cursor`}},Ht=function(e){return e.ADD=`+`,e.SUB=`-`,e}({});function Ut(e){if(e===`+`)return Ht.ADD;if(e===`-`)return Ht.SUB;throw Error(`Invalid LineNumberOp: ${e}`)}function Wt(e){if(e===void 0||e===Ht.ADD)return 1;if(e===Ht.SUB)return-1;throw Error(`Invalid LineNumberOp: ${e}`)}var Gt=class{literal;op;number;constructor(e,t,n){this.literal=e,this.op=t,this.number=n}evaluate(e){let t=this.resolveLiteral(e),n=Wt(this.op);return t!==void 0&&this.number!==void 0?t+this.number*n:this.number===void 0?t===void 0?0:t:this.number*n}resolveLiteral(e){if(this.literal!==void 0){if(this.literal in e)return e[this.literal];throw Error(`Error while evaluating line number expression: Literal "${this.literal}" not available.`)}}},Kt=_.sequenceMap((e,t)=>e===void 0?t:-t,_.string(`-`).optional(),_.or(_.sequenceMap((e,t,n)=>Number(e+t+n),w.digits(),_.string(`.`),w.digits()),w.digits().map(e=>Number(e)))).thenEof(),qt=_.sequenceMap((e,t)=>e===void 0?t:-t,_.string(`-`).optional(),w.digits().map(e=>Number(e))).thenEof(),Jt=_.or(_.sequenceMap((e,t,n)=>new Gt(e,Ut(t),n),ue,_.or(_.string(`+`),_.string(`-`)).trim(w.optionalWhitespace()),qt),ue.map(e=>new Gt(e,void 0,void 0)),qt.map(e=>new Gt(void 0,void 0,e))),Yt=class extends Lt{constructor(e){super(Pt.INSERT_INTO_NOTE,e)}async run(e,t,n,r,i){let a=t.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(t.value),n):t.value,o=se(Jt,t.line.toString());await this.mb.file.atomicModify(n,e=>{let t=e.split(`
`),n=this.mb.file.createLineNumberContext(e,r.position),i=o.evaluate(n);if(i<1||i>t.length)throw Error(`Line number out of bounds`);return t=[...t.slice(0,i-1),a,...t.slice(i-1)],t.join(`
`)})}create(){return{type:Pt.INSERT_INTO_NOTE,line:0,value:`Some text`,templater:!1}}getActionLabel(){return`Insert text into the note`}},Xt=class extends Lt{constructor(e){super(Pt.JS,e)}async run(e,t,n,r,i){if(!this.mb.getSettings().enableJs)throw new ne({errorLevel:P.CRITICAL,effect:`Can't run button action that requires JS evaluation.`,cause:`JS evaluation is disabled in the plugin settings.`});let a={buttonConfig:structuredClone(e),args:structuredClone(t.args),buttonContext:structuredClone(r),click:structuredClone(i)};(await this.mb.internal.jsEngineRunFile(t.file,n,a))()}create(){return{type:Pt.JS,file:``,args:{}}}getActionLabel(){return`Run a JavaScript file`}},Zt=_.sequence(ge,_.or(_.string(`#`).then(_.manyNotOf(`[]#|:`)),_.string(`#`).result(void 0),_.succeed(void 0)),_.string(`|`).then(_.manyNotOf(`[]`)).optional()),Qt=_.or(_.sequenceMap((e,t)=>new en(e!==void 0,t[0],t[1],t[2],!0),_.string(`!`).optional(),Zt.wrapString(`[[`,`]]`)),_.sequenceMap((e,t,n)=>{let r=!Ct(n);return new en(e!==void 0,n,void 0,t,r)},_.string(`!`).optional(),_.manyNotOf(`[]`).wrapString(`[`,`]`),_.manyNotOf(`()`).wrapString(`(`,`)`))),$t=_.separateBy(Qt,_.string(`,`).trim(w.optionalWhitespace())),en=class e{isEmbed;target;block;alias;internal;constructor(e,t,n,r,i){this.isEmbed=e,this.target=t,this.block=n,this.alias=r,this.internal=i??!0}static fromUrl(t){return new e(!1,t.href,void 0,t.hostname,!1)}fullTarget(){return this.block?`${this.target}#${this.block}`:this.target}open(e,t,n){this.internal?e.file.open(this.fullTarget(),t,n):wt(this.target)}toString(){let e=this.isEmbed?`!`:``;if(this.internal){let t=this.alias?`|${this.alias}`:``;return`${e}[[${this.fullTarget()}${t}]]`}else return`${e}[${this.alias??this.fullTarget()}](${this.fullTarget()})`}},tn=class e{static parseLink(e){return se(Qt.thenEof(),e)}static parseLinkList(e){return se($t.thenEof(),e)}static isLink(e){return Qt.thenEof().tryParse(e).success}static urlToLink(e){return en.fromUrl(e)}static parseLinkOrUrl(t){return Ct(t)?e.urlToLink(new URL(t)):e.parseLink(t)}static interpretAsLink(e){let t=Qt.thenEof().tryParse(e);if(t.success)return t.value;let n=Zt.thenEof().tryParse(e);if(n.success)return new en(!1,n.value[0],n.value[1],n.value[2],!0);if(Ct(e)){let t=new URL(e);return en.fromUrl(t)}}},nn=class extends Lt{constructor(e){super(Pt.OPEN,e)}async run(e,t,n,r,i){let a=i.openInNewTab()||(t.newTab??!1),o=tn.interpretAsLink(t.link);if(!o)throw Error(`Invalid link`);o.open(this.mb,n,a)}create(){return{type:Pt.OPEN,link:``,newTab:!0}}getActionLabel(){return`Open a link`}},rn=class extends Lt{constructor(e){super(Pt.REGEXP_REPLACE_IN_NOTE,e)}async run(e,t,n,r,i){if(t.regexp===``)throw Error(`Regexp cannot be empty`);await this.mb.file.atomicModify(n,e=>e.replace(new RegExp(t.regexp,t.regexpFlags??`g`),t.replacement))}create(){return{type:Pt.REGEXP_REPLACE_IN_NOTE,regexp:`([A-Z])\\w+`,replacement:`Replacement text`,regexpFlags:`g`}}getActionLabel(){return`Replace text in note using regexp`}},an=class extends Lt{constructor(e){super(Pt.REPLACE_IN_NOTE,e)}async run(e,t,n,r,i){let a=t.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(t.replacement),n):t.replacement,o=se(Jt,t.fromLine.toString()),s=se(Jt,t.toLine.toString());await this.mb.file.atomicModify(n,e=>{let t=e.split(`
`),n=this.mb.file.createLineNumberContext(e,r.position),i=o.evaluate(n),c=s.evaluate(n);if(i>c)throw Error(`From line (${i}) can't be greater than to line (${c})`);if(i<1)throw Error(`From line (${i}) can't smaller than 1.`);if(c>t.length)throw Error(`To line (${c}) can't greater than the file length ${t.length}.`);return t=[...t.slice(0,i-1),a,...t.slice(c)],t.join(`
`)})}create(){return{type:Pt.REPLACE_IN_NOTE,fromLine:0,toLine:0,replacement:`Replacement text`,templater:!1}}getActionLabel(){return`Replace text in note`}},on=class extends Lt{constructor(e){super(Pt.REPLACE_SELF,e)}async run(e,t,n,r,i){if(r.isInline)throw Error(`Replace self action not supported for inline buttons`);if(r.position===void 0)throw Error(`Position of the button in the note is unknown`);if(r.position.lineStart>r.position.lineEnd)throw Error(`Position of the button in the note is invalid`);let a=r.position,o=t.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(t.replacement),n):t.replacement;await this.mb.file.atomicModify(n,e=>{let t=e.split(`
`);if(a.lineStart<0||a.lineEnd>t.length)throw Error(`Position of the button in the note is out of bounds`);return t=[...t.slice(0,a.lineStart),o,...t.slice(a.lineEnd+1)],t.join(`
`)})}create(){return{type:Pt.REPLACE_SELF,replacement:`Replacement text`,templater:!1}}getActionLabel(){return`Replace button with text`}},sn=class extends Lt{constructor(e){super(Pt.RUN_TEMPLATER_FILE,e)}async run(e,t,n,r,i){let a=this.mb.file.resolveFilePathLike(t.templateFile);await this.mb.internal.evaluateTemplaterTemplate(a,n)}create(){return{type:Pt.RUN_TEMPLATER_FILE,templateFile:``}}getActionLabel(){return`Run a templater file`}},cn=class extends Lt{constructor(e){super(Pt.SLEEP,e)}async run(e,t,n,r,i){await new Promise(e=>setTimeout(e,t.ms))}create(){return{type:Pt.SLEEP,ms:0}}getActionLabel(){return`Sleep for some time`}},ln=class extends Lt{constructor(e){super(Pt.TEMPLATER_CREATE_NOTE,e)}async run(e,t,n,r,i){if(t.openIfAlreadyExists&&t.fileName){let e=At(Ot(t.folderPath??``,t.fileName),`md`);if(await this.mb.file.exists(e)){await this.mb.file.open(e,``,!1);return}}await this.mb.internal.createNoteWithTemplater(t.templateFile,t.folderPath,t.fileName,t.openNote,i.openInNewTab())}create(){return{type:Pt.TEMPLATER_CREATE_NOTE,templateFile:``,folderPath:`/`,fileName:``,openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return`Create a new note using Templater`}};function un(e){if(e.toLowerCase()===`null`)return null;if(e===`true`)return!0;if(e===`false`)return!1;{let t=Kt.tryParse(e);return t.success?t.value:e}}function dn(e){return e==null?``:typeof e==`string`?e:typeof e==`boolean`?e?`true`:`false`:e.toString()}function fn(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`}function pn(e){if(e!=null){if(fn(e))return[e];if(typeof e==`object`&&Array.isArray(e))return e.filter(e=>fn(e))}}function mn(e){if(typeof e==`number`)return e;if(typeof e==`string`){let t=Kt.tryParse(e);if(t.success)return t.value}}function hn(e){return fn(e)?dn(e):void 0}function gn(e){return fn(e)?e:void 0}function _n(e,t){return Array.isArray(e)?e.map(e=>vn(e,t)).filter(e=>e!==``).join(`, `):vn(e,t)}function vn(e,t){return e==null?t?``:`null`:typeof e==`function`?`<function>`:typeof e==`object`||Array.isArray(e)?JSON.stringify(e):e.toString()}function yn(e,t){return Array.isArray(e)?e.map(e=>bn(e,t)).filter(e=>e!==``):bn(e,t)}function bn(e,t){return typeof e==`string`?tn.isLink(e)?tn.parseLink(e):Ct(e)?tn.urlToLink(new URL(e)):e:vn(e,t)}var xn=class extends Lt{constructor(e){super(Pt.UPDATE_METADATA,e)}async run(e,t,n,r,i){let a=this.mb.bindTargetParser.fromStringAndValidate(t.bindTarget,n);if(t.evaluate){if(!this.mb.getSettings().enableJs)throw new ne({errorLevel:P.CRITICAL,effect:`Can't run button action that requires JS evaluation.`,cause:`JS evaluation is disabled in the plugin settings.`});let e=Function(`x`,`getMetadata`,`return ${t.value};`);this.mb.api.updateMetadata(a,t=>e(t,e=>this.mb.api.getMetadata(this.mb.api.parseBindTarget(e,n))))}else this.mb.api.setMetadata(a,un(t.value))}create(){return{type:Pt.UPDATE_METADATA,bindTarget:``,evaluate:!1,value:``}}getActionLabel(){return`Update metadata`}},Sn=class{mb;actionContexts;constructor(e){this.mb=e,this.actionContexts={[Pt.COMMAND]:new Rt(e),[Pt.OPEN]:new nn(e),[Pt.JS]:new Xt(e),[Pt.INPUT]:new Vt(e),[Pt.SLEEP]:new cn(e),[Pt.TEMPLATER_CREATE_NOTE]:new ln(e),[Pt.UPDATE_METADATA]:new xn(e),[Pt.CREATE_NOTE]:new zt(e),[Pt.REPLACE_IN_NOTE]:new an(e),[Pt.REPLACE_SELF]:new on(e),[Pt.REGEXP_REPLACE_IN_NOTE]:new rn(e),[Pt.INSERT_INTO_NOTE]:new Yt(e),[Pt.INLINE_JS]:new Bt(e),[Pt.RUN_TEMPLATER_FILE]:new sn(e)}}createDefaultButtonConfig(){return{label:`This is a button`,icon:``,style:Nt.DEFAULT,class:``,cssStyle:``,backgroundImage:``,tooltip:``,id:``,hidden:!1,actions:[]}}async runButtonActions(e,t,n,r){try{if(e.action)await this.runAction(e,e.action,t,n,r);else if(e.actions)for(let i of e.actions)await this.runAction(e,i,t,n,r);else console.warn(`meta-bind | ButtonMDRC >> no action defined`)}catch(e){console.warn(`meta-bind | ButtonMDRC >> error while running action`,e),this.mb.internal.showNotice(`meta-bind | Error while running button action. Check the console for details.`)}}createDefaultAction(e){return this.actionContexts[e].create()}async runAction(e,t,n,r,i){let a=t.type;await this.actionContexts[a].run(e,t,n,r,i)}getActionLabel(e){return this.actionContexts[e].getActionLabel()}},Cn=class{errors;otherError;subject;constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof I?this.errors.push(e):this.otherError=e,console.warn(e)):(console.trace(``),console.warn(`[MB_ERROR_CONTAINER] received invalid error type`,e))}merge(e){return this.errors=this.errors.concat(e.errors),e.otherError&&(this.otherError=e.otherError),this}hasErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel===P.ERROR||e.errorLevel===P.CRITICAL)return!0;return!1}hasCriticalErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel===P.CRITICAL)return!0;return!1}hasWarnings(){for(let e of this.errors)if(e.errorLevel===P.WARNING)return!0;return!1}isEmpty(){return this.errors.length===0&&!this.otherError}getErrors(){let e=this.errors.filter(e=>e.errorLevel===P.ERROR||e.errorLevel===P.CRITICAL);return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel===P.WARNING)}},wn=class{value;count;constructor(e){this.value=e,this.count=1}getValue(){return this.value}increment(){return this.count+=1,this.count}decrement(){return--this.count,this.count}getCount(){return this.count}isEmpty(){return this.count===0}},Tn=class{mb;buttons;buttonLoadListeners;buttonTemplates;constructor(e){this.mb=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let t=new Set,n=new Cn(`ButtonManager`);this.buttonTemplates.clear();for(let r of e)r.id===void 0||r.id===``?n.add(new ae({errorLevel:P.ERROR,cause:`Button with label "${r.label}" has no id, but button templates must have an id.`,effect:`Button templates could not be saved.`})):t.has(r.id)?n.add(new ae({errorLevel:P.ERROR,cause:`Button id "${r.id}" is not unique. The same id is used by multiple buttons.`,effect:`Button templates could not be saved.`})):(t.add(r.id),this.buttonTemplates.set(r.id,r));return n.hasErrors()&&this.buttonTemplates.clear(),n}registerButtonLoadListener(e,t,n){let r=this.getButton(e,t);r&&n(r),this.buttonLoadListeners.has(e)||this.buttonLoadListeners.set(e,new Map);let i=this.buttonLoadListeners.get(e);i.has(t)||i.set(t,new Map);let a=i.get(t),o=St();return a.set(o,n),()=>this.removeButtonLoadListener(e,t,o)}notifyButtonLoadListeners(e,t){let n=this.getButton(e,t);if(!n)throw Error(`ButtonManager | button with id ${t} does not exist`);let r=this.buttonLoadListeners.get(e);if(!r)return;let i=r.get(t);if(i)for(let[e,t]of i)t(n)}removeButtonLoadListener(e,t,n){let r=this.buttonLoadListeners.get(e);if(!r)return;let i=r.get(t);i&&(i.delete(n),i.size===0&&r.delete(t),r.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,t){if(t.id===void 0||t.id===``)throw Error(`ButtonManager | button id is undefined`);if(this.buttonTemplates.has(t.id))throw Error(`ButtonManager | button with id "${t.id}" already exists in the button templates`);this.buttons.has(e)||this.buttons.set(e,new Map),this.buttons.get(e).set(t.id,new wn(t)),this.notifyButtonLoadListeners(e,t.id)}getButton(e,t){if(this.buttonTemplates.has(t))return this.buttonTemplates.get(t);let n=this.buttons.get(e);if(n)return n.get(t)?.getValue()}removeButton(e,t){let n=this.buttons.get(e);n&&(n.get(t)?.decrement(),n.get(t)?.isEmpty()&&n.delete(t),n.size===0&&this.buttons.delete(e))}},B=function(e){return e.TOGGLE=`toggle`,e.SLIDER=`slider`,e.TEXT=`text`,e.TEXT_AREA=`textArea`,e.SELECT=`select`,e.MULTI_SELECT=`multiSelect`,e.DATE=`date`,e.TIME=`time`,e.DATE_PICKER=`datePicker`,e.NUMBER=`number`,e.SUGGESTER=`suggester`,e.EDITOR=`editor`,e.IMAGE_SUGGESTER=`imageSuggester`,e.PROGRESS_BAR=`progressBar`,e.INLINE_SELECT=`inlineSelect`,e.LIST=`list`,e.LIST_SUGGESTER=`listSuggester`,e.INLINE_LIST_SUGGESTER=`inlineListSuggester`,e.INLINE_LIST=`inlineList`,e.IMAGE_LIST_SUGGESTER=`imageListSuggester`,e.DATE_TIME=`dateTime`,e.INVALID=`invalid`,e}({}),V=function(e){return e.CLASS=`class`,e.ADD_LABELS=`addLabels`,e.MIN_VALUE=`minValue`,e.MAX_VALUE=`maxValue`,e.STEP_SIZE=`stepSize`,e.OPTION=`option`,e.TITLE=`title`,e.OPTION_QUERY=`optionQuery`,e.SHOWCASE=`showcase`,e.ON_VALUE=`onValue`,e.OFF_VALUE=`offValue`,e.DEFAULT_VALUE=`defaultValue`,e.PLACEHOLDER=`placeholder`,e.USE_LINKS=`useLinks`,e.LIMIT=`limit`,e.MULTI_LINE=`multiLine`,e.ALLOW_OTHER=`allowOther`,e.INVALID=`invalid`,e}({}),En={[B.TOGGLE]:{type:B.TOGGLE,allowInBlock:!0,allowInline:!0},[B.SLIDER]:{type:B.SLIDER,allowInBlock:!0,allowInline:!0},[B.TEXT]:{type:B.TEXT,allowInBlock:!0,allowInline:!0},[B.TEXT_AREA]:{type:B.TEXT_AREA,allowInBlock:!0,allowInline:!0},[B.SELECT]:{type:B.SELECT,allowInBlock:!0,allowInline:!1},[B.MULTI_SELECT]:{type:B.MULTI_SELECT,allowInBlock:!0,allowInline:!1},[B.DATE]:{type:B.DATE,allowInBlock:!0,allowInline:!0},[B.TIME]:{type:B.TIME,allowInBlock:!0,allowInline:!0},[B.DATE_PICKER]:{type:B.DATE_PICKER,allowInBlock:!0,allowInline:!0},[B.NUMBER]:{type:B.NUMBER,allowInBlock:!0,allowInline:!0},[B.SUGGESTER]:{type:B.SUGGESTER,allowInBlock:!0,allowInline:!0},[B.EDITOR]:{type:B.EDITOR,allowInBlock:!0,allowInline:!1},[B.IMAGE_SUGGESTER]:{type:B.IMAGE_SUGGESTER,allowInBlock:!0,allowInline:!0},[B.PROGRESS_BAR]:{type:B.PROGRESS_BAR,allowInBlock:!0,allowInline:!1},[B.INLINE_SELECT]:{type:B.INLINE_SELECT,allowInBlock:!0,allowInline:!0},[B.LIST]:{type:B.LIST,allowInBlock:!0,allowInline:!1},[B.LIST_SUGGESTER]:{type:B.LIST_SUGGESTER,allowInBlock:!0,allowInline:!1},[B.INLINE_LIST_SUGGESTER]:{type:B.INLINE_LIST_SUGGESTER,allowInBlock:!0,allowInline:!0},[B.INLINE_LIST]:{type:B.INLINE_LIST,allowInBlock:!0,allowInline:!0},[B.IMAGE_LIST_SUGGESTER]:{type:B.IMAGE_LIST_SUGGESTER,allowInBlock:!0,allowInline:!1},[B.DATE_TIME]:{type:B.DATE_TIME,allowInBlock:!0,allowInline:!0},[B.INVALID]:{type:B.INVALID,allowInBlock:!1,allowInline:!1}},Dn=function(e){return e.TRUE=`true`,e.PARTIAL=`partial`,e.FALSE=`false`,e}({}),On={[V.ADD_LABELS]:{type:V.ADD_LABELS,allowedFieldTypes:[B.SLIDER,B.PROGRESS_BAR],values:[[],[{name:`value`,allowed:[`true`,`false`],description:``}]],allowMultiple:!1},[V.CLASS]:{type:V.CLASS,allowedFieldTypes:[],values:[[{name:`className`,allowed:[],description:`the name of the css class to add`}]],allowMultiple:!0},[V.DEFAULT_VALUE]:{type:V.DEFAULT_VALUE,allowedFieldTypes:[],values:[[{name:`value`,allowed:[],description:``}]],allowMultiple:!1},[V.MAX_VALUE]:{type:V.MAX_VALUE,allowedFieldTypes:[B.SLIDER,B.PROGRESS_BAR],values:[[{name:`value`,allowed:[`number`],description:`the maximally allowed value`}]],allowMultiple:!1},[V.MIN_VALUE]:{type:V.MIN_VALUE,allowedFieldTypes:[B.SLIDER,B.PROGRESS_BAR],values:[[{name:`value`,allowed:[`number`],description:`the minimally allowed value`}]],allowMultiple:!1},[V.STEP_SIZE]:{type:V.STEP_SIZE,allowedFieldTypes:[B.SLIDER,B.PROGRESS_BAR],values:[[{name:`value`,allowed:[`number`],description:`the step size for sliders`}]],allowMultiple:!1},[V.OFF_VALUE]:{type:V.OFF_VALUE,allowedFieldTypes:[B.TOGGLE],values:[[{name:`value`,allowed:[],description:`the value for the off state`}]],allowMultiple:!1},[V.ON_VALUE]:{type:V.ON_VALUE,allowedFieldTypes:[B.TOGGLE],values:[[{name:`value`,allowed:[],description:`the value for the off state`}]],allowMultiple:!1},[V.OPTION]:{type:V.OPTION,allowedFieldTypes:[B.SELECT,B.MULTI_SELECT,B.SUGGESTER,B.IMAGE_SUGGESTER,B.INLINE_SELECT,B.LIST_SUGGESTER,B.INLINE_LIST_SUGGESTER,B.IMAGE_LIST_SUGGESTER],values:[[{name:`value`,allowed:[],description:`the value and display name of the option`}],[{name:`value`,allowed:[],description:`the value of the option`},{name:`name`,allowed:[],description:`the display name of the option`}]],allowMultiple:!0},[V.OPTION_QUERY]:{type:V.OPTION_QUERY,allowedFieldTypes:[B.SUGGESTER,B.IMAGE_SUGGESTER,B.LIST_SUGGESTER,B.INLINE_LIST_SUGGESTER,B.IMAGE_LIST_SUGGESTER],values:[[{name:`value`,allowed:[],description:`the query for options`}]],allowMultiple:!0},[V.PLACEHOLDER]:{type:V.PLACEHOLDER,allowedFieldTypes:[B.TEXT,B.TEXT_AREA,B.NUMBER,B.LIST,B.INLINE_LIST],values:[[{name:`value`,allowed:[],description:``}]],allowMultiple:!1},[V.SHOWCASE]:{type:V.SHOWCASE,allowedFieldTypes:[],values:[[],[{name:`value`,allowed:[`true`,`false`],description:``}]],allowMultiple:!1},[V.TITLE]:{type:V.TITLE,allowedFieldTypes:[],values:[[{name:`value`,allowed:[],description:``}]],allowMultiple:!1},[V.USE_LINKS]:{type:V.USE_LINKS,allowedFieldTypes:[B.SUGGESTER,B.LIST_SUGGESTER,B.INLINE_LIST_SUGGESTER],values:[[],[{name:`value`,allowed:[Dn.TRUE,Dn.PARTIAL,Dn.FALSE],description:``}]],allowMultiple:!1},[V.LIMIT]:{type:V.LIMIT,allowedFieldTypes:[B.TEXT,B.TEXT_AREA,B.LIST,B.INLINE_LIST],values:[[{name:`value`,allowed:[`number`],description:`a character limit for text fields`}]],allowMultiple:!1},[V.MULTI_LINE]:{type:V.MULTI_LINE,allowedFieldTypes:[B.LIST],values:[[],[{name:`value`,allowed:[`true`,`false`],description:``}]],allowMultiple:!1},[V.ALLOW_OTHER]:{type:V.ALLOW_OTHER,allowedFieldTypes:[B.SUGGESTER,B.LIST_SUGGESTER,B.INLINE_LIST_SUGGESTER],values:[[],[{name:`value`,allowed:[`true`,`false`],description:``}]],allowMultiple:!1},[V.INVALID]:{type:V.INVALID,allowedFieldTypes:[],values:[[]],allowMultiple:!0}},kn=function(e){return e.MATH=`math`,e.TEXT=`text`,e.LINK=`link`,e.IMAGE=`image`,e.INVALID=`invalid`,e}({}),An=function(e){return e.RENDER_MARKDOWN=`renderMarkdown`,e.HIDDEN=`hidden`,e.CLASS=`class`,e.INVALID=`invalid`,e}({}),jn={[An.RENDER_MARKDOWN]:{type:An.RENDER_MARKDOWN,allowedFieldTypes:[kn.TEXT],values:[[],[{name:`value`,allowed:[`true`,`false`],description:``}]],allowMultiple:!1},[An.HIDDEN]:{type:An.HIDDEN,allowedFieldTypes:[],values:[[],[{name:`value`,allowed:[`true`,`false`],description:``}]],allowMultiple:!1},[An.CLASS]:{type:An.CLASS,allowedFieldTypes:[],values:[[{name:`className`,allowed:[],description:`the name of the css class to add`}]],allowMultiple:!0},[An.INVALID]:{type:An.INVALID,allowedFieldTypes:[],values:[[]],allowMultiple:!0}},Mn=Array.isArray,Nn=Array.prototype.indexOf,Pn=Array.prototype.includes,Fn=Array.from,In=Object.defineProperty,Ln=Object.getOwnPropertyDescriptor,Rn=Object.getOwnPropertyDescriptors,zn=Object.prototype,Bn=Array.prototype,Vn=Object.getPrototypeOf,Hn=Object.isExtensible,Un=()=>{};function Wn(e){for(var t=0;t<e.length;t++)e[t]()}function Gn(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var Kn=1024,qn=2048,Jn=4096,Yn=8192,Xn=16384,Zn=32768,Qn=1<<25,$n=65536,er=1<<19,tr=1<<20,nr=1<<25,rr=65536,ir=1<<21,ar=1<<22,or=1<<23,sr=Symbol(`$state`),cr=Symbol(`legacy props`),lr=Symbol(``),ur=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},dr=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function fr(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function pr(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function mr(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function hr(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function gr(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function _r(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function vr(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function yr(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function br(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function xr(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Sr(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Cr(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var wr={},Tr=Symbol(),Er=`http://www.w3.org/1999/xhtml`;function Dr(){console.warn(`https://svelte.dev/e/derived_inert`)}function Or(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function kr(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function Ar(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var jr=!1;function Mr(e){jr=e}var Nr;function Pr(e){if(e===null)throw Or(),wr;return Nr=e}function Fr(){return Pr(_a(Nr))}function H(e){if(jr){if(_a(Nr)!==null)throw Or(),wr;Nr=e}}function Ir(e=1){if(jr){for(var t=e,n=Nr;t--;)n=_a(n);Nr=n}}function Lr(e=!0){for(var t=0,n=Nr;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=_a(n);e&&n.remove(),n=i}}function Rr(e){if(!e||e.nodeType!==8)throw Or(),wr;return e.data}function zr(e){return e===this.v}function Br(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Vr(e){return!Br(e,this.v)}var Hr=!1,Ur=!1,Wr=[];function Gr(e,t=!1,n=!1){return Kr(e,new Map,``,Wr,null,n)}function Kr(e,t,n,r,i=null,a=!1){if(typeof e==`object`&&e){var o=t.get(e);if(o!==void 0)return o;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Mn(e)){var s=Array(e.length);t.set(e,s),i!==null&&t.set(i,s);for(var c=0;c<e.length;c+=1){var l=e[c];c in e&&(s[c]=Kr(l,t,n,r,null,a))}return s}if(Vn(e)===zn){s={},t.set(e,s),i!==null&&t.set(i,s);for(var u of Object.keys(e))s[u]=Kr(e[u],t,n,r,null,a);return s}if(e instanceof Date)return structuredClone(e);if(typeof e.toJSON==`function`&&!a)return Kr(e.toJSON(),t,n,r,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}var qr=null;function Jr(e){qr=e}function Yr(e,t=!1,n){qr={p:qr,i:!1,c:null,e:null,s:e,x:null,r:ao,l:Ur&&!t?{s:null,u:null,$:[]}:null}}function Xr(e){var t=qr,n=t.e;if(n!==null){t.e=null;for(var r of n)Na(r)}return e!==void 0&&(t.x=e),t.i=!0,qr=t.p,e??{}}function Zr(){return!Ur||qr!==null&&qr.l===null}var Qr=[];function $r(){var e=Qr;Qr=[],Wn(e)}function ei(e){if(Qr.length===0&&!_i){var t=Qr;queueMicrotask(()=>{t===Qr&&$r()})}Qr.push(e)}function ti(){for(;Qr.length>0;)$r()}function ni(e){var t=ao;if(t===null)return no.f|=or,e;if(!(t.f&32768)&&!(t.f&4))throw e;ri(e,t)}function ri(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var ii=~(qn|Jn|Kn);function ai(e,t){e.f=e.f&ii|t}function oi(e){e.f&512||e.deps===null?ai(e,Kn):ai(e,Jn)}function si(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=rr,si(t.deps))}function ci(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),si(e.deps),ai(e,Kn)}var li=!1,ui=!1;function di(e){var t=ui;try{return ui=!1,[e(),ui]}finally{ui=t}}var fi=new Set,pi=null,mi=null,hi=null,gi=null,_i=!1,vi=!1,yi=null,bi=null,xi=0,Si=1,Ci=class e{id=Si++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=new Set;#r=new Map;#i=new Map;#a=null;#o=[];#s=[];#c=new Set;#l=new Set;#u=new Map;#d=new Set;is_fork=!1;#f=!1;#p=new Set;#m(){return this.is_fork||this.#i.size>0}#h(){for(let n of this.#p)for(let r of n.#i.keys()){for(var e=!1,t=r;t.parent!==null;){if(this.#u.has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}skip_effect(e){this.#u.has(e)||this.#u.set(e,{d:[],m:[]}),this.#d.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#u.get(e);if(n){this.#u.delete(e);for(var r of n.d)ai(r,qn),t(r);for(r of n.m)ai(r,Jn),t(r)}this.#d.add(e)}#g(){if(xi++>1e3&&(fi.delete(this),Ti()),!this.#m()){for(let e of this.#c)this.#l.delete(e),ai(e,qn),this.schedule(e);for(let e of this.#l)ai(e,Jn),this.schedule(e)}let t=this.#o;this.#o=[],this.apply();var n=yi=[],r=[],i=bi=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Mi(e),t}if(pi=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(yi=null,bi=null,this.#m()||this.#h()){this.#v(r),this.#v(n);for(let[e,t]of this.#u)ji(e,t)}else{this.#r.size===0&&fi.delete(this),this.#c.clear(),this.#l.clear();for(let e of this.#e)e(this);this.#e.clear(),mi=this,Di(r),Di(n),mi=null,this.#a?.resolve()}var o=pi;if(this.#o.length>0){let e=o??=this;e.#o.push(...this.#o.filter(t=>!e.#o.includes(t)))}o!==null&&(fi.add(o),o.#g()),Hr&&!fi.has(this)&&this.#y()}#_(e,t,n){e.f^=Kn;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#u.has(r))&&r.fn!==null){a?r.f^=Kn:i&4?t.push(r):Hr&&i&16777224?n.push(r):yo(r)&&(i&16&&this.#l.add(r),wo(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(e){for(var t=0;t<e.length;t+=1)ci(e[t],this.#c,this.#l)}capture(e,t,n=!1){e.v!==Tr&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),hi?.set(e,t)),this.is_fork||(e.v=t)}activate(){pi=this}deactivate(){pi=null,hi=null}flush(){try{vi=!0,pi=this,this.#g()}finally{xi=0,gi=null,yi=null,bi=null,vi=!1,pi=null,hi=null,Zi.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear(),this.#n.clear(),fi.delete(this)}register_created_effect(e){this.#s.push(e)}#y(){for(let l of fi){var e=l.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(l.current.has(r)){var n=l.current.get(r)[0];if(e&&i!==n)l.current.set(r,[i,a]);else continue}t.push(r)}var r=[...l.current.keys()].filter(e=>!this.current.has(e));if(r.length===0)e&&l.discard();else if(t.length>0){if(e)for(let e of this.#d)l.unskip_effect(e,e=>{e.f&4194320?l.schedule(e):l.#v([e])});l.activate();var i=new Set,a=new Map;for(var o of t)Oi(o,r,i,a);a=new Map;var s=[...l.current.keys()].filter(e=>this.current.has(e)?this.current.get(e)[0]!==e:!0);for(let e of this.#s)!(e.f&155648)&&ki(e,s,a)&&(e.f&4194320?(ai(e,qn),l.schedule(e)):l.#c.add(e));if(l.#o.length>0){l.apply();for(var c of l.#o)l.#_(c,[],[]);l.#o=[]}l.deactivate()}}for(let e of fi)e.#p.has(this)&&(e.#p.delete(this),e.#p.size===0&&!e.#m()&&(e.activate(),e.#g()))}increment(e,t){let n=this.#r.get(t)??0;if(this.#r.set(t,n+1),e){let e=this.#i.get(t)??0;this.#i.set(t,e+1)}}decrement(e,t,n){let r=this.#r.get(t)??0;if(r===1?this.#r.delete(t):this.#r.set(t,r-1),e){let e=this.#i.get(t)??0;e===1?this.#i.delete(t):this.#i.set(t,e-1)}this.#f||n||(this.#f=!0,ei(()=>{this.#f=!1,this.flush()}))}transfer_effects(e,t){for(let t of e)this.#c.add(t);for(let e of t)this.#l.add(e);e.clear(),t.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}on_fork_commit(e){this.#n.add(e)}run_fork_commit_callbacks(){for(let e of this.#n)e(this);this.#n.clear()}settled(){return(this.#a??=Gn()).promise}static ensure(){if(pi===null){let t=pi=new e;vi||(fi.add(pi),_i||ei(()=>{pi===t&&t.flush()}))}return pi}apply(){if(!Hr||!this.is_fork&&fi.size===1){hi=null;return}hi=new Map;for(let[e,[t]]of this.current)hi.set(e,t);for(let n of fi)if(!(n===this||n.is_fork)){var e=!1,t=!1;if(n.id<this.id)for(let[r,[,i]]of n.current)i||(e||=this.current.has(r),t||=!this.current.has(r));if(e&&t)this.#p.add(n);else for(let[e,t]of n.previous)hi.has(e)||hi.set(e,t)}}schedule(e){if(gi=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(yi!==null&&t===ao&&(Hr||(no===null||!(no.f&2))&&!li))return;if(n&96){if(!(n&1024))return;t.f^=Kn}}this.#o.push(t)}};function wi(e){var t=_i;_i=!0;try{var n;for(e&&(pi!==null&&!pi.is_fork&&pi.flush(),n=e());;){if(ti(),pi===null)return n;pi.flush()}}finally{_i=t}}function Ti(){try{vr()}catch(e){ri(e,gi)}}var Ei=null;function Di(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&yo(r)&&(Ei=new Set,wo(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Ka(r),Ei?.size>0)){Zi.clear();for(let e of Ei){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Ei.has(n)&&(Ei.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||wo(n)}}Ei.clear()}}Ei=null}}function Oi(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Oi(i,t,n,r):e&4194320&&!(e&2048)&&ki(i,t,r)&&(ai(i,qn),Ai(i))}}function ki(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(Pn.call(t,r))return!0;if(r.f&2&&ki(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function Ai(e){pi.schedule(e)}function ji(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),ai(e,Kn);for(var n=e.first;n!==null;)ji(n,t),n=n.next}}function Mi(e){ai(e,Kn);for(var t=e.first;t!==null;)Mi(t),t=t.next}function Ni(e){let t=0,n=$i(0),r;return()=>{Aa()&&(K(n),La(()=>(t===0&&(r=Oo(()=>e(()=>aa(n)))),t+=1,()=>{ei(()=>{--t,t===0&&(r?.(),r=void 0,aa(n))})})))}}var Pi=$n|er;function Fi(e,t,n,r){new Ii(e,t,n,r)}var Ii=class{parent;is_pending=!1;transform_error;#e;#t=jr?Nr:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Ni(()=>(this.#m=$i(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=ao;t.b=this,t.f|=128,n(e)},this.parent=ao.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=za(()=>{if(jr){let e=this.#t;Fr();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},Pi),jr&&(this.#e=Nr)}#g(){try{this.#a=Ba(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Ba(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Ba(()=>e(this.#e)),ei(()=>{var e=this.#c=document.createDocumentFragment(),t=ha();e.append(t),this.#a=this.#x(()=>Ba(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,qa(this.#o,()=>{this.#o=null}),this.#b(pi))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Ba(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Za(this.#a,e);let t=this.#n.pending;this.#o=Ba(()=>t(this.#e))}else this.#b(pi)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){ci(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=ao,n=no,r=qr;oo(this.#i),io(this.#i),Jr(this.#i.ctx);try{return Ci.ensure(),e()}catch(e){return ni(e),null}finally{oo(t),io(n),Jr(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&qa(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,ei(()=>{this.#d=!1,this.#m&&ra(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),K(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;pi?.is_fork?(this.#a&&pi.skip_effect(this.#a),this.#o&&pi.skip_effect(this.#o),this.#s&&pi.skip_effect(this.#s),pi.on_fork_commit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(Wa(this.#a),null),this.#o&&=(Wa(this.#o),null),this.#s&&=(Wa(this.#s),null),jr&&(Pr(this.#t),Ir(),Pr(Lr()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){Ar();return}r=!0,i&&Cr(),this.#s!==null&&qa(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){ri(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Ba(()=>{var t=ao;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return ri(e,this.#i.parent),null}}))};ei(()=>{var t;try{t=this.transform_error(e)}catch(e){ri(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>ri(e,this.#i&&this.#i.parent)):o(t)})}};function Li(e,t,n,r){let i=Zr()?Vi:Wi;var a=e.filter(e=>!e.settled);if(n.length===0&&a.length===0){r(t.map(i));return}var o=ao,s=Ri(),c=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function l(e){s();try{r(e)}catch(e){o.f&16384||ri(e,o)}zi()}if(n.length===0){c.then(()=>l(t.map(i)));return}var u=Bi();function d(){Promise.all(n.map(e=>Hi(e))).then(e=>l([...t.map(i),...e])).catch(e=>ri(e,o)).finally(()=>u())}c?c.then(()=>{s(),d(),zi()}):d()}function Ri(){var e=ao,t=no,n=qr,r=pi;return function(i=!0){oo(e),io(t),Jr(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function zi(e=!0){oo(null),io(null),Jr(null),e&&pi?.deactivate()}function Bi(){var e=ao,t=e.b,n=pi,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(i=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,i)}}function Vi(e){var t=2|qn;return ao!==null&&(ao.f|=er),{ctx:qr,deps:null,effects:null,equals:zr,f:t,fn:e,reactions:null,rv:0,v:Tr,wv:0,parent:ao,ac:null}}function Hi(e,t,n){let r=ao;r===null&&pr();var i=void 0,a=$i(Tr),o=!no,s=new Map;return Ia(()=>{var t=ao,n=Gn();i=n.promise;try{Promise.resolve(e()).then(n.resolve,n.reject).finally(zi)}catch(e){n.reject(e),zi()}var c=pi;if(o){if(t.f&32768)var l=Bi();if(r.b.is_rendered())s.get(c)?.reject(ur),s.delete(c);else{for(let e of s.values())e.reject(ur);s.clear()}s.set(c,n)}let u=(e,n=void 0)=>{if(l&&l(n===ur),!(n===ur||t.f&16384)){if(c.activate(),n)a.f|=or,ra(a,n);else{a.f&8388608&&(a.f^=or),ra(a,e);for(let[e,t]of s){if(s.delete(e),e===c)break;t.reject(ur)}}c.deactivate()}};n.promise.then(u,e=>u(null,e||`unknown`))}),ja(()=>{for(let e of s.values())e.reject(ur)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function Ui(e){let t=Vi(e);return Hr||co(t),t}function Wi(e){let t=Vi(e);return t.equals=Vr,t}function Gi(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Wa(t[n])}}function Ki(e){var t,n=ao,r=e.parent;if(!eo&&r!==null&&r.f&24576)return Dr(),e.v;oo(r);try{e.f&=~rr,Gi(e),t=xo(e)}finally{oo(n)}return t}function qi(e){var t=Ki(e);if(!e.equals(t)&&(e.wv=vo(),(!pi?.is_fork||e.deps===null)&&(pi===null?e.v=t:pi.capture(e,t,!0),e.deps===null))){ai(e,Kn);return}eo||(hi===null?oi(e):(Aa()||pi?.is_fork)&&hi.set(e,t))}function Ji(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(ur),t.teardown=Un,t.ac=null,Co(t,0),Ha(t))}function Yi(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&wo(t)}var Xi=new Set,Zi=new Map,Qi=!1;function $i(e,t){return{f:0,v:e,reactions:null,equals:zr,rv:0,wv:0}}function ea(e,t){let n=$i(e,t);return co(n),n}function ta(e,t=!1,n=!0){let r=$i(e);return t||(r.equals=Vr),Ur&&n&&qr!==null&&qr.l!==null&&(qr.l.s??=[]).push(r),r}function na(e,t,n=!1){return no!==null&&(!ro||no.f&131072)&&Zr()&&no.f&4325394&&(so===null||!Pn.call(so,e))&&Sr(),ra(e,n?sa(t):t,bi)}function ra(e,t,n=null){if(!e.equals(t)){Zi.set(e,eo?t:e.v);var r=Ci.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Ki(t),hi===null&&oi(t)}e.wv=vo(),oa(e,qn,n),Zr()&&ao!==null&&ao.f&1024&&!(ao.f&96)&&(fo===null?po([e]):fo.push(e)),!r.is_fork&&Xi.size>0&&!Qi&&ia()}return t}function ia(){Qi=!1;for(let e of Xi)e.f&1024&&ai(e,Jn),yo(e)&&wo(e);Xi.clear()}function aa(e){na(e,e.v+1)}function oa(e,t,n){var r=e.reactions;if(r!==null)for(var i=Zr(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===ao)){var l=(c&qn)===0;if(l&&ai(s,t),c&2){var u=s;hi?.delete(u),c&65536||(c&512&&(s.f|=rr),oa(u,Jn,n))}else if(l){var d=s;c&16&&Ei!==null&&Ei.add(d),n===null?Ai(d):n.push(d)}}}}function sa(e){if(typeof e!=`object`||!e||sr in e)return e;let t=Vn(e);if(t!==zn&&t!==Bn)return e;var n=new Map,r=Mn(e),i=ea(0),a=null,o=go,s=e=>{if(go===o)return e();var t=no,n=go;io(null),_o(o);var r=e();return io(t),_o(n),r};return r&&n.set(`length`,ea(e.length,a)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&br();var i=n.get(t);return i===void 0?s(()=>{var e=ea(r.value,a);return n.set(t,e),e}):na(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>ea(Tr,a));n.set(t,e),aa(i)}}else na(r,Tr),aa(i);return!0},get(t,r,i){if(r===sr)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||Ln(t,r)?.writable)&&(o=s(()=>ea(sa(c?t[r]:Tr),a)),n.set(r,o)),o!==void 0){var l=K(o);return l===Tr?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);if(r&&`value`in r){var i=n.get(t);i&&(r.value=K(i))}else if(r===void 0){var a=n.get(t),o=a?.v;if(a!==void 0&&o!==Tr)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===sr)return!0;var r=n.get(t),i=r!==void 0&&r.v!==Tr||Reflect.has(e,t);return(r!==void 0||ao!==null&&(!i||Ln(e,t)?.writable))&&(r===void 0&&(r=s(()=>ea(i?sa(e[t]):Tr,a)),n.set(t,r)),K(r)===Tr)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;d<l.v;d+=1){var f=n.get(d+``);f===void 0?d in e&&(f=s(()=>ea(Tr,a)),n.set(d+``,f)):na(f,Tr)}if(l===void 0)(!u||Ln(e,t)?.writable)&&(l=s(()=>ea(void 0,a)),na(l,sa(o)),n.set(t,l));else{u=l.v!==Tr;var p=s(()=>sa(o));na(l,p)}var m=Reflect.getOwnPropertyDescriptor(e,t);if(m?.set&&m.set.call(c,o),!u){if(r&&typeof t==`string`){var h=n.get(`length`),g=Number(t);Number.isInteger(g)&&g>=h.v&&na(h,g+1)}aa(i)}return!0},ownKeys(e){K(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==Tr});for(var[r,a]of n)a.v!==Tr&&!(r in e)&&t.push(r);return t},setPrototypeOf(){xr()}})}function ca(e){try{if(typeof e==`object`&&e&&sr in e)return e[sr]}catch{}return e}function la(e,t){return Object.is(ca(e),ca(t))}var ua,da,fa,pa;function ma(){if(ua===void 0){ua=window,da=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;fa=Ln(t,`firstChild`).get,pa=Ln(t,`nextSibling`).get,Hn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Hn(n)&&(n.__t=void 0)}}function ha(e=``){return document.createTextNode(e)}function ga(e){return fa.call(e)}function _a(e){return pa.call(e)}function U(e,t){if(!jr)return ga(e);var n=ga(Nr);if(n===null)n=Nr.appendChild(ha());else if(t&&n.nodeType!==3){var r=ha();return n?.before(r),Pr(r),r}return t&&xa(n),Pr(n),n}function W(e,t=!1){if(!jr){var n=ga(e);return n instanceof Comment&&n.data===``?_a(n):n}if(t){if(Nr?.nodeType!==3){var r=ha();return Nr?.before(r),Pr(r),r}xa(Nr)}return Nr}function G(e,t=1,n=!1){let r=jr?Nr:e;for(var i;t--;)i=r,r=_a(r);if(!jr)return r;if(n){if(r?.nodeType!==3){var a=ha();return r===null?i?.after(a):r.before(a),Pr(a),a}xa(r)}return Pr(r),r}function va(e){e.textContent=``}function ya(){return!Hr||Ei!==null?!1:(ao.f&Zn)!==0}function ba(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??`http://www.w3.org/1999/xhtml`,e,r)}function xa(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Sa(e){jr&&ga(e)!==null&&va(e)}var Ca=!1;function wa(){Ca||(Ca=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Ta(e){var t=no,n=ao;io(null),oo(null);try{return e()}finally{io(t),oo(n)}}function Ea(e,t,n,r=n){e.addEventListener(t,()=>Ta(n));let i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),wa()}function Da(e){ao===null&&(no===null&&_r(e),gr()),eo&&hr(e)}function Oa(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function ka(e,t){var n=ao;n!==null&&n.f&8192&&(e|=Yn);var r={ctx:qr,deps:null,nodes:null,f:e|qn|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};pi?.register_created_effect(r);var i=r;if(e&4)yi===null?Ci.ensure().schedule(r):yi.push(r);else if(t!==null){try{wo(r)}catch(e){throw Wa(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=$n))}if(i!==null&&(i.parent=n,n!==null&&Oa(i,n),no!==null&&no.f&2&&!(e&64))){var a=no;(a.effects??=[]).push(i)}return r}function Aa(){return no!==null&&!ro}function ja(e){let t=ka(8,null);return ai(t,Kn),t.teardown=e,t}function Ma(e){Da(`$effect`);var t=ao.f;if(!no&&t&32&&!(t&32768)){var n=qr;(n.e??=[]).push(e)}else return Na(e)}function Na(e){return ka(4|tr,e)}function Pa(e){Ci.ensure();let t=ka(64|er,e);return(e={})=>new Promise(n=>{e.outro?qa(t,()=>{Wa(t),n(void 0)}):(Wa(t),n(void 0))})}function Fa(e){return ka(4,e)}function Ia(e){return ka(ar|er,e)}function La(e,t=0){return ka(8|t,e)}function Ra(e,t=[],n=[],r=[]){Li(r,t,n,t=>{ka(8,()=>e(...t.map(K)))})}function za(e,t=0){return ka(16|t,e)}function Ba(e){return ka(32|er,e)}function Va(e){var t=e.teardown;if(t!==null){let e=eo,n=no;to(!0),io(null);try{t.call(null)}finally{to(e),io(n)}}}function Ha(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Ta(()=>{e.abort(ur)});var r=n.next;n.f&64?n.parent=null:Wa(n,t),n=r}}function Ua(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Wa(t),t=n}}function Wa(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Ga(e.nodes.start,e.nodes.end),n=!0),ai(e,Qn),Ha(e,t&&!n),Co(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Va(e),e.f^=Qn,e.f|=Xn;var i=e.parent;i!==null&&i.first!==null&&Ka(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Ga(e,t){for(;e!==null;){var n=e===t?null:_a(e);e.remove(),e=n}}function Ka(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function qa(e,t,n=!0){var r=[];Ja(e,r,!0);var i=()=>{n&&Wa(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Ja(e,t,n){if(!(e.f&8192)){e.f^=Yn;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;Ja(i,t,o?n:!1)}i=a}}}function Ya(e){Xa(e,!0)}function Xa(e,t){if(e.f&8192){e.f^=Yn,e.f&1024||(ai(e,qn),Ci.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;Xa(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Za(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:_a(n);t.append(n),n=i}}var Qa=null,$a=!1,eo=!1;function to(e){eo=e}var no=null,ro=!1;function io(e){no=e}var ao=null;function oo(e){ao=e}var so=null;function co(e){no!==null&&(!Hr||no.f&2)&&(so===null?so=[e]:so.push(e))}var lo=null,uo=0,fo=null;function po(e){fo=e}var mo=1,ho=0,go=ho;function _o(e){go=e}function vo(){return++mo}function yo(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~rr),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(yo(a)&&qi(a),a.wv>e.wv)return!0}t&512&&hi===null&&ai(e,Kn)}return!1}function bo(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Hr&&so!==null&&Pn.call(so,e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?bo(a,t,!1):t===a&&(n?ai(a,qn):a.f&1024&&ai(a,Jn),Ai(a))}}function xo(e){var t=lo,n=uo,r=fo,i=no,a=so,o=qr,s=ro,c=go,l=e.f;lo=null,uo=0,fo=null,no=l&96?null:e,so=null,Jr(e.ctx),ro=!1,go=++ho,e.ac!==null&&(Ta(()=>{e.ac.abort(ur)}),e.ac=null);try{e.f|=ir;var u=e.fn,d=u();e.f|=Zn;var f=e.deps,p=pi?.is_fork;if(lo!==null){var m;if(p||Co(e,uo),f!==null&&uo>0)for(f.length=uo+lo.length,m=0;m<lo.length;m++)f[uo+m]=lo[m];else e.deps=f=lo;if(Aa()&&e.f&512)for(m=uo;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&uo<f.length&&(Co(e,uo),f.length=uo);if(Zr()&&fo!==null&&!ro&&f!==null&&!(e.f&6146))for(m=0;m<fo.length;m++)bo(fo[m],e);if(i!==null&&i!==e){if(ho++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=ho;if(t!==null)for(let e of t)e.rv=ho;fo!==null&&(r===null?r=fo:r.push(...fo))}return e.f&8388608&&(e.f^=or),d}catch(e){return ni(e)}finally{e.f^=ir,lo=t,uo=n,fo=r,no=i,so=a,Jr(o),ro=s,go=c}}function So(e,t){let n=t.reactions;if(n!==null){var r=Nn.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(lo===null||!Pn.call(lo,t))){var a=t;a.f&512&&(a.f^=512,a.f&=~rr),a.v!==Tr&&oi(a),Ji(a),Co(a,0)}}function Co(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)So(e,n[r])}function wo(e){var t=e.f;if(!(t&16384)){ai(e,Kn);var n=ao,r=$a;ao=e,$a=!0;try{t&16777232?Ua(e):Ha(e),Va(e);var i=xo(e);e.teardown=typeof i==`function`?i:null,e.wv=mo}finally{$a=r,ao=n}}}async function To(){if(Hr)return new Promise(e=>{requestAnimationFrame(()=>e()),setTimeout(()=>e())});await Promise.resolve(),wi()}function K(e){var t=(e.f&2)!=0;if(Qa?.add(e),no!==null&&!ro&&!(ao!==null&&ao.f&16384)&&(so===null||!Pn.call(so,e))){var n=no.deps;if(no.f&2097152)e.rv<ho&&(e.rv=ho,lo===null&&n!==null&&n[uo]===e?uo++:lo===null?lo=[e]:lo.push(e));else{(no.deps??=[]).push(e);var r=e.reactions;r===null?e.reactions=[no]:Pn.call(r,no)||r.push(no)}}if(eo&&Zi.has(e))return Zi.get(e);if(t){var i=e;if(eo){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Do(i))&&(a=Ki(i)),Zi.set(i,a),a}var o=(i.f&512)==0&&!ro&&no!==null&&($a||(no.f&512)!=0),s=(i.f&Zn)===0;yo(i)&&(o&&(i.f|=512),qi(i)),o&&!s&&(Yi(i),Eo(i))}if(hi?.has(e))return hi.get(e);if(e.f&8388608)throw e.v;return e.v}function Eo(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(Yi(t),Eo(t))}function Do(e){if(e.v===Tr)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Zi.has(t)||t.f&2&&Do(t))return!0;return!1}function Oo(e){var t=ro;try{return ro=!0,e()}finally{ro=t}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var ko=[`touchstart`,`touchmove`];function Ao(e){return ko.includes(e)}var jo=Symbol(`events`),Mo=new Set,No=new Set;function Po(e,t,n,r={}){function i(e){if(r.capture||zo.call(t,e),!e.cancelBubble)return Ta(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?ei(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Fo(e,t,n,r,i){var a={capture:r,passive:i},o=Po(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&ja(()=>{t.removeEventListener(e,o,a)})}function Io(e,t,n){(t[jo]??={})[e]=n}function Lo(e){for(var t=0;t<e.length;t++)Mo.add(e[t]);for(var n of No)n(e)}var Ro=null;function zo(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;Ro=e;var o=0,s=Ro===e&&e[jo];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[jo]=t;return}var l=i.indexOf(t);if(l===-1)return;c<=l&&(o=c)}if(a=i[o]||e.target,a!==t){In(e,`currentTarget`,{configurable:!0,get(){return a||n}});var u=no,d=ao;io(null),oo(null);try{for(var f,p=[];a!==null;){var m=a.assignedSlot||a.parentNode||a.host||null;try{var h=a[jo]?.[r];h!=null&&(!a.disabled||e.target===a)&&h.call(a,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble||m===t||m===null)break;a=m}if(f){for(let e of p)queueMicrotask(()=>{throw e});throw f}}finally{e[jo]=t,delete e.currentTarget,io(u),oo(d)}}}var Bo=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Vo(e){return Bo?.createHTML(e)??e}function Ho(e){var t=ba(`template`);return t.innerHTML=Vo(e.replaceAll(`<!>`,`<!---->`)),t.content}function Uo(e,t){var n=ao;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function q(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(jr)return Uo(Nr,null),Nr;i===void 0&&(i=Ho(a?e:`<!>`+e),n||(i=ga(i)));var t=r||da?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=ga(t),s=t.lastChild;Uo(o,s)}else Uo(t,t);return t}}function Wo(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=(t&1)!=0,a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(jr)return Uo(Nr,null),Nr;if(!o){var e=ga(Ho(a));if(i)for(o=document.createDocumentFragment();ga(e);)o.appendChild(ga(e));else o=ga(e)}var t=o.cloneNode(!0);if(i){var n=ga(t),r=t.lastChild;Uo(n,r)}else Uo(t,t);return t}}function Go(e,t){return Wo(e,t,`svg`)}function Ko(e=``){if(!jr){var t=ha(e+``);return Uo(t,t),t}var n=Nr;return n.nodeType===3?xa(n):(n.before(n=ha()),Pr(n)),Uo(n,n),n}function qo(){if(jr)return Uo(Nr,null),Nr;var e=document.createDocumentFragment(),t=document.createComment(``),n=ha();return e.append(t,n),Uo(t,n),e}function J(e,t){if(jr){var n=ao;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=Nr),Fr();return}e!==null&&e.before(t)}function Jo(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function Yo(e,t){return Zo(e,t)}var Xo=new Map;function Zo(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){ma();var c=void 0,l=Pa(()=>{var o=n??t.appendChild(ha());Fi(o,{pending:()=>{}},t=>{Yr({});var n=qr;if(a&&(n.c=a),i&&(r.$$events=i),jr&&Uo(t,null),c=e(t,r)||{},jr&&(ao.nodes.end=Nr,Nr===null||Nr.nodeType!==8||Nr.data!==`]`))throw Or(),wr;Xr()},s);var l=new Set,u=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!l.has(r)){l.add(r);var i=Ao(r);for(let e of[t,document]){var a=Xo.get(e);a===void 0&&(a=new Map,Xo.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,zo,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return u(Fn(Mo)),No.add(u),()=>{for(var e of l)for(let n of[t,document]){var r=Xo.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,zo),r.delete(e),r.size===0&&Xo.delete(n)):r.set(e,i)}No.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return Qo.set(c,l),c}var Qo=new WeakMap;function $o(e,t){let n=Qo.get(e);return n?(Qo.delete(e),n(t)):Promise.resolve()}var es=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Ya(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Wa(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Za(r,t),t.append(ha()),this.#n.set(e,{effect:r,fragment:t})}else Wa(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),qa(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Wa(n.effect),this.#n.delete(e))};ensure(e,t){var n=pi,r=ya();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=ha();i.append(a),this.#n.set(e,{effect:Ba(()=>t(a)),fragment:i})}else this.#t.set(e,Ba(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else jr&&(this.anchor=Nr),this.#a(n)}};function ts(e,t,n=!1){var r;jr&&(r=Nr,Fr());var i=new es(e),a=n?$n:0;function o(e,t){if(jr){var n=Rr(r);if(e!==parseInt(n.substring(1))){var a=Lr();Pr(a),i.anchor=a,Mr(!1),i.ensure(e,t),Mr(!0);return}}i.ensure(e,t)}za(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function ns(e,t){return t}function rs(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];qa(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;is(e,Fn(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else --o},!1)}if(o===0){var c=r.length===0&&n!==null;if(c){var l=n,u=l.parentNode;va(u),u.append(l),e.items.clear()}is(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function is(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=nr,Za(a,document.createDocumentFragment())):Wa(t[i],n)}}var as;function os(e,t,n,r,i,a=null){var o=e,s=new Map;if(t&4){var c=e;o=jr?Pr(ga(c)):c.appendChild(ha())}jr&&Fr();var l=null,u=Wi(()=>{var e=n();return Mn(e)?e:e==null?[]:Fn(e)}),d,f=new Map,p=!0;function m(e){g.effect.f&16384||(g.pending.delete(e),g.fallback=l,cs(g,d,o,t,r),l!==null&&(d.length===0?l.f&33554432?(l.f^=nr,us(l,null,o)):Ya(l):qa(l,()=>{l=null})))}function h(e){g.pending.delete(e)}var g={effect:za(()=>{d=K(u);var e=d.length;let c=!1;jr&&Rr(o)===`[!`!=(e===0)&&(o=Lr(),Pr(o),Mr(!1),c=!0);for(var g=new Set,_=pi,v=ya(),y=0;y<e;y+=1){jr&&Nr.nodeType===8&&Nr.data===`]`&&(o=Nr,c=!0,Mr(!1));var b=d[y],x=r(b,y),S=p?null:s.get(x);S?(S.v&&ra(S.v,b),S.i&&ra(S.i,y),v&&_.unskip_effect(S.e)):(S=ls(s,p?o:as??=ha(),b,x,y,i,t,n),p||(S.e.f|=nr),s.set(x,S)),g.add(x)}if(e===0&&a&&!l&&(p?l=Ba(()=>a(o)):(l=Ba(()=>a(as??=ha())),l.f|=nr)),e>g.size&&mr(``,``,``),jr&&e>0&&Pr(Lr()),!p)if(f.set(_,g),v){for(let[e,t]of s)g.has(e)||_.skip_effect(t.e);_.oncommit(m),_.ondiscard(h)}else m(_);c&&Mr(!0),K(u)}),flags:t,items:s,pending:f,outrogroups:null,fallback:l};p=!1,jr&&(o=Nr)}function ss(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function cs(e,t,n,r,i){var a=(r&8)!=0,o=t.length,s=e.items,c=ss(e.effect.first),l,u=null,d,f=[],p=[],m,h,g,_;if(a)for(_=0;_<o;_+=1)m=t[_],h=i(m,_),g=s.get(h).e,g.f&33554432||(g.nodes?.a?.measure(),(d??=new Set).add(g));for(_=0;_<o;_+=1){if(m=t[_],h=i(m,_),g=s.get(h).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(g),t.done.delete(g);if(g.f&8192&&(Ya(g),a&&(g.nodes?.a?.unfix(),(d??=new Set).delete(g))),g.f&33554432)if(g.f^=nr,g===c)us(g,null,n);else{var v=u?u.next:c;g===e.effect.last&&(e.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),ds(e,u,g),ds(e,g,v),us(g,v,n),u=g,f=[],p=[],c=ss(u.next);continue}if(g!==c){if(l!==void 0&&l.has(g)){if(f.length<p.length){var y=p[0],b;u=y.prev;var x=f[0],S=f[f.length-1];for(b=0;b<f.length;b+=1)us(f[b],y,n);for(b=0;b<p.length;b+=1)l.delete(p[b]);ds(e,x.prev,S.next),ds(e,u,x),ds(e,S,y),c=y,u=S,--_,f=[],p=[]}else l.delete(g),us(g,c,n),ds(e,g.prev,g.next),ds(e,g,u===null?e.effect.first:u.next),ds(e,u,g),u=g;continue}for(f=[],p=[];c!==null&&c!==g;)(l??=new Set).add(c),p.push(c),c=ss(c.next);if(c===null)continue}g.f&33554432||f.push(g),u=g,c=ss(g.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(is(e,Fn(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||l!==void 0){var C=[];if(l!==void 0)for(g of l)g.f&8192||C.push(g);for(;c!==null;)!(c.f&8192)&&c!==e.fallback&&C.push(c),c=ss(c.next);var w=C.length;if(w>0){var T=r&4&&o===0?n:null;if(a){for(_=0;_<w;_+=1)C[_].nodes?.a?.measure();for(_=0;_<w;_+=1)C[_].nodes?.a?.fix()}rs(e,C,T)}}a&&ei(()=>{if(d!==void 0)for(g of d)g.nodes?.a?.apply()})}function ls(e,t,n,r,i,a,o,s){var c=o&1?o&16?$i(n):ta(n,!1,!1):null,l=o&2?$i(i):null;return{v:c,i:l,e:Ba(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function us(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=_a(r);if(a.before(r),r===i)return;r=o}}function ds(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function fs(e,t,...n){var r=new es(e);za(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},$n)}function ps(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ps(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ms(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ps(e))&&(r&&(r+=` `),r+=t);return r}function hs(e){return typeof e==`object`?ms(e):e??``}var gs=[...`
\r\f\xA0\v`];function _s(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||gs.includes(r[o-1]))&&(s===r.length||gs.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function vs(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function ys(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function bs(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(ys)),i&&c.push(...Object.keys(i).map(ys));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=ys(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=vs(r)),i&&(n+=vs(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function xs(e,t,n,r,i,a){var o=e.__className;if(jr||o!==n||o===void 0){var s=_s(n,r,a);(!jr||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e.__className=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Ss(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Cs(e,t,n,r){var i=e.__style;if(jr||i!==t){var a=bs(t,r);(!jr||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e.__style=t}else r&&(Array.isArray(r)?(Ss(e,n?.[0],r[0]),Ss(e,n?.[1],r[1],`important`)):Ss(e,n,r));return r}function ws(e,t,n=!1){if(e.multiple){if(t==null)return;if(!Mn(t))return kr();for(var r of e.options)r.selected=t.includes(Ds(r));return}for(r of e.options)if(la(Ds(r),t)){r.selected=!0;return}(!n||t!==void 0)&&(e.selectedIndex=-1)}function Ts(e){var t=new MutationObserver(()=>{ws(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),ja(()=>{t.disconnect()})}function Es(e,t,n=t){var r=new WeakSet,i=!0;Ea(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),Ds);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&Ds(o)}n(a),e.__value=a,pi!==null&&r.add(pi)}),Fa(()=>{var a=t();if(e===document.activeElement){var o=Hr?mi:pi;if(r.has(o))return}if(ws(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=Ds(s),n(a))}e.__value=a,i=!1}),Ts(e)}function Ds(e){return`__value`in e?e.__value:e.value}var Os=Symbol(`is custom element`),ks=Symbol(`is html`),As=dr?`link`:`LINK`,js=dr?`progress`:`PROGRESS`;function Ms(e){if(jr){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Fs(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Fs(e,`checked`,null),e.checked=r}}};e.__on_r=n,ei(n),wa()}}function Ns(e,t){var n=Is(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==js)||(e.value=t??``)}function Ps(e,t){var n=Is(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Fs(e,t,n,r){var i=Is(e);jr&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===As)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[lr]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Rs(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Is(e){return e.__attributes??={[Os]:e.nodeName.includes(`-`),[ks]:e.namespaceURI===Er}}var Ls=new Map;function Rs(e){var t=e.getAttribute(`is`)||e.nodeName,n=Ls.get(t);if(n)return n;Ls.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=Rn(i),r)r[o].set&&n.push(o);i=Vn(i)}return n}function zs(e,t,n=t){var r=new WeakSet;Ea(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Bs(e)?Vs(a):a,n(a),pi!==null&&r.add(pi),await To(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(jr&&e.defaultValue!==e.value||Oo(t)==null&&e.value)&&(n(Bs(e)?Vs(e.value):e.value),pi!==null&&r.add(pi)),La(()=>{var n=t();if(e===document.activeElement){var i=Hr?mi:pi;if(r.has(i))return}Bs(e)&&n===Vs(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function Bs(e){var t=e.type;return t===`number`||t===`range`}function Vs(e){return e===``?null:+e}function Hs(e,t){return e===t||e?.[sr]===t}function Us(e={},t,n,r){var i=qr.r,a=ao;return Fa(()=>{var o,s;return La(()=>{o=s,s=r?.()||[],Oo(()=>{e!==n(...s)&&(t(e,...s),o&&Hs(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Hs(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Ws(e,t,n,r){var i=!Ur||(n&2)!=0,a=(n&8)!=0,o=(n&16)!=0,s=r,c=!0,l=()=>(c&&(c=!1,s=o?Oo(r):r),s);let u;if(a){var d=sr in e||cr in e;u=Ln(e,t)?.set??(d&&t in e?n=>e[t]=n:void 0)}var f,p=!1;a?[f,p]=di(()=>e[t]):f=e[t],f===void 0&&r!==void 0&&(f=l(),u&&(i&&yr(t),u(f)));var m=i?()=>{var n=e[t];return n===void 0?l():(c=!0,n)}:()=>{var n=e[t];return n!==void 0&&(s=void 0),n===void 0?s:n};if(i&&!(n&4))return m;if(u){var h=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||h||p)&&u(t?m():e),e):m()})}var g=!1,_=(n&1?Vi:Wi)(()=>(g=!1,m()));a&&K(_);var v=ao;return(function(e,t){if(arguments.length>0){let n=t?K(_):i&&a?sa(e):e;return na(_,n),g=!0,s!==void 0&&(s=n),e}return eo&&g||v.f&16384?_.v:K(_)})}function Gs(e){qr===null&&fr(`onMount`),Ur&&qr.l!==null?qs(qr).m.push(e):Ma(()=>{let t=Oo(e);if(typeof t==`function`)return t})}function Ks(e){qr===null&&fr(`onDestroy`),Gs(()=>()=>Oo(e))}function qs(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}var Js=class{mb;svelteComponent;svelteComponentInstance;mounted;onValueChange;constructor(e,t,n){this.mb=e,this.mounted=!1,this.svelteComponent=t,this.onValueChange=n}setValue(e){this.svelteComponentInstance?.setValue(e)}getInstance(){return this.svelteComponentInstance}mount(e,t,n={}){let r=Object.assign({mb:this.mb,value:t,onValueChange:this.onValueChange},n);this.svelteComponentInstance=Yo(this.svelteComponent,{target:e,props:r}),this.mounted=!0}unmount(){this.svelteComponentInstance&&$o(this.svelteComponentInstance),this.mounted=!1}isMounted(){return this.mounted}},Ys=class{mounted;targetEl;onUnmountCbs;constructor(){this.mounted=!1,this.targetEl=void 0,this.onUnmountCbs=[]}isMounted(){return this.mounted}getTargetEl(){return this.targetEl}mount(e){if(this.mounted||this.targetEl){console.warn(`Mountable is already mounted`,this);return}if(e===void 0){console.error(`Mountable target element is undefined`,this);return}this.mounted=!0,this.targetEl=e,this.onMount(e)}unmount(){if(!this.mounted||!this.targetEl){console.warn(`Mountable is not mounted`,this);return}this.mounted=!1,this.onUnmount(this.targetEl);for(let e of this.onUnmountCbs)e();this.targetEl=void 0}registerUnmountCb(e){this.onUnmountCbs.push(e)}},Xs=class{listeners;constructor(){this.listeners=[]}registerListener(e){let t=e;return t.uuid=St(),this.listeners.push(t),t}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(t=>t.uuid!==e)}unregisterAllListeners(){this.listeners=[]}notifyListeners(e){for(let t of this.listeners)try{t.callback(e)}catch(e){let t=e instanceof Error?e:String(e);console.error(new L({errorLevel:P.ERROR,effect:`error while calling listener callback`,cause:t}))}}},Zs=class extends Xs{value;constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},Qs=class extends Xs{value;mapFn;constructor(e,t){super(),this.value=t(e),this.mapFn=t}get(){return this.value}set(e){this.value=this.mapFn(e),this.notifyListeners(this.value)}setDirect(e){this.value=e,this.notifyListeners(e)}},$s=class extends Ys{mb;mountable;svelteWrapper;inputSignal;metadataSubscription;mountTarget;constructor(e){super(),this.mountable=e,this.mb=e.mb}reverseMapValue(e){let t=this.rawReverseMapValue(e);if(t!==void 0)return t;let n=this.rawReverseMapValue(this.getDefaultValue());return n===void 0?this.getFallbackDefaultValue():n}mapValue(e){return this.rawMapValue(e)}getValue(){return this.inputSignal?this.inputSignal.get():this.getDefaultValue()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.inputSignal?.setDirect(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){this.metadataSubscription?.write(e)}getDefaultValue(){let e=this.mountable.getArgument(V.DEFAULT_VALUE);if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let t=this.filterValue(e.value);return t===void 0?this.mapValue(this.getFallbackDefaultValue()):t}updateDataAttributes(e){this.mountTarget&&(this.mountTarget.dataset.internalValue=JSON.stringify(e))}getMountArgs(){return{}}onMount(e){this.mountTarget=e,this.svelteWrapper=new Js(this.mb,this.getSvelteComponent(),e=>{this.updateDataAttributes(e),this.notifySubscription(this.mapValue(e))}),this.inputSignal=new Qs(void 0,e=>{let t=this.filterValue(e);return t===void 0?this.getDefaultValue():t}),this.inputSignal.registerListener({callback:e=>this.svelteWrapper?.setValue(this.reverseMapValue(e))}),this.inputSignal.registerListener({callback:e=>{this.updateDataAttributes(this.reverseMapValue(e))}}),this.updateDataAttributes(this.getInternalValue());let t=this.mountable.getBindTarget();t&&(this.metadataSubscription=this.mountable.mb.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,t,()=>this.mountable.unmount())),this.svelteWrapper.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.mountTarget=void 0,this.inputSignal?.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.svelteWrapper?.unmount()}};typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var ec=q(`<input type="date"/>`);function tc(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}var i={setValue:r},a=ec();return Ms(a),Io(`input`,a,()=>t.onValueChange(Gr(K(n)))),zs(a,()=>K(n),e=>na(n,e)),J(e,a),Xr(i)}Lo([`input`]);var nc;function rc(){return nc.apply(null,arguments)}function ic(e){nc=e}function ac(e){return e instanceof Array||Object.prototype.toString.call(e)===`[object Array]`}function oc(e){return e!=null&&Object.prototype.toString.call(e)===`[object Object]`}function sc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function cc(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;for(var t in e)if(sc(e,t))return!1;return!0}function lc(e){return e===void 0}function uc(e){return typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`}function dc(e){return e instanceof Date||Object.prototype.toString.call(e)===`[object Date]`}function fc(e,t){var n=[],r,i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function pc(e,t){for(var n in t)sc(t,n)&&(e[n]=t[n]);return sc(t,`toString`)&&(e.toString=t.toString),sc(t,`valueOf`)&&(e.valueOf=t.valueOf),e}function mc(e,t,n,r){return Jd(e,t,n,r,!0).utc()}function hc(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function gc(e){return e._pf??=hc(),e._pf}var _c=Array.prototype.some?Array.prototype.some:function(e){var t=Object(this),n=t.length>>>0,r;for(r=0;r<n;r++)if(r in t&&e.call(this,t[r],r,t))return!0;return!1};function vc(e){var t=null,n=!1,r=e._d&&!isNaN(e._d.getTime());if(r&&(t=gc(e),n=_c.call(t.parsedDateParts,function(e){return e!=null}),r=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict&&(r=r&&t.charsLeftOver===0&&t.unusedTokens.length===0&&t.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(e))e._isValid=r;else return r;return e._isValid}function yc(e){var t=mc(NaN);return e==null?gc(t).userInvalidated=!0:pc(gc(t),e),t}var bc=rc.momentProperties=[],xc=!1;function Sc(e,t){var n,r,i,a=bc.length;if(lc(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),lc(t._i)||(e._i=t._i),lc(t._f)||(e._f=t._f),lc(t._l)||(e._l=t._l),lc(t._strict)||(e._strict=t._strict),lc(t._tzm)||(e._tzm=t._tzm),lc(t._isUTC)||(e._isUTC=t._isUTC),lc(t._offset)||(e._offset=t._offset),lc(t._pf)||(e._pf=gc(t)),lc(t._locale)||(e._locale=t._locale),a>0)for(n=0;n<a;n++)r=bc[n],i=t[r],lc(i)||(e[r]=i);return e}function Cc(e){Sc(this,e),this._d=new Date(e._d==null?NaN:e._d.getTime()),this.isValid()||(this._d=new Date(NaN)),xc===!1&&(xc=!0,rc.updateOffset(this),xc=!1)}function wc(e){return e instanceof Cc||e!=null&&e._isAMomentObject!=null}function Tc(e){rc.suppressDeprecationWarnings===!1&&typeof console<`u`&&console.warn&&console.warn(`Deprecation warning: `+e)}function Ec(e,t){var n=!0;return pc(function(){if(rc.deprecationHandler!=null&&rc.deprecationHandler(null,e),n){var r=[],i,a,o,s=arguments.length;for(a=0;a<s;a++){if(i=``,typeof arguments[a]==`object`){for(o in i+=`
[`+a+`] `,arguments[0])sc(arguments[0],o)&&(i+=o+`: `+arguments[0][o]+`, `);i=i.slice(0,-2)}else i=arguments[a];r.push(i)}Tc(e+`
Arguments: `+Array.prototype.slice.call(r).join(``)+`
`+Error().stack),n=!1}return t.apply(this,arguments)},t)}var Dc={};function Oc(e,t){rc.deprecationHandler!=null&&rc.deprecationHandler(e,t),Dc[e]||(Tc(t),Dc[e]=!0)}rc.suppressDeprecationWarnings=!1,rc.deprecationHandler=null;function kc(e){return typeof Function<`u`&&e instanceof Function||Object.prototype.toString.call(e)===`[object Function]`}function Ac(e){var t,n;for(n in e)sc(e,n)&&(t=e[n],kc(t)?this[n]=t:this[`_`+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+`|\\d{1,2}`)}function jc(e,t){var n=pc({},e),r;for(r in t)sc(t,r)&&(oc(e[r])&&oc(t[r])?(n[r]={},pc(n[r],e[r]),pc(n[r],t[r])):t[r]==null?delete n[r]:n[r]=t[r]);for(r in e)sc(e,r)&&!sc(t,r)&&oc(e[r])&&(n[r]=pc({},n[r]));return n}function Mc(e){e!=null&&this.set(e)}var Nc=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)sc(e,t)&&n.push(t);return n},Pc={sameDay:`[Today at] LT`,nextDay:`[Tomorrow at] LT`,nextWeek:`dddd [at] LT`,lastDay:`[Yesterday at] LT`,lastWeek:`[Last] dddd [at] LT`,sameElse:`L`};function Fc(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return kc(r)?r.call(t,n):r}function Ic(e,t,n){var r=``+Math.abs(e),i=t-r.length;return(e>=0?n?`+`:``:`-`)+(10**Math.max(0,i)).toString().substr(1)+r}var Lc=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Rc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,zc={},Bc={};function Vc(e,t,n,r){var i=r;typeof r==`string`&&(i=function(){return this[r]()}),e&&(Bc[e]=i),t&&(Bc[t[0]]=function(){return Ic(i.apply(this,arguments),t[1],t[2])}),n&&(Bc[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function Hc(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,``):e.replace(/\\/g,``)}function Uc(e){var t=e.match(Lc),n,r;for(n=0,r=t.length;n<r;n++)Bc[t[n]]?t[n]=Bc[t[n]]:t[n]=Hc(t[n]);return function(n){var i=``,a;for(a=0;a<r;a++)i+=kc(t[a])?t[a].call(n,e):t[a];return i}}function Wc(e,t){return e.isValid()?(t=Gc(t,e.localeData()),zc[t]=zc[t]||Uc(t),zc[t](e)):e.localeData().invalidDate()}function Gc(e,t){var n=5;function r(e){return t.longDateFormat(e)||e}for(Rc.lastIndex=0;n>=0&&Rc.test(e);)e=e.replace(Rc,r),Rc.lastIndex=0,--n;return e}var Kc={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`};function qc(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(Lc).map(function(e){return e===`MMMM`||e===`MM`||e===`DD`||e===`dddd`?e.slice(1):e}).join(``),this._longDateFormat[e])}var Jc=`Invalid date`;function Yc(){return this._invalidDate}var Xc=`%d`,Zc=/\d{1,2}/;function Qc(e){return this._ordinal.replace(`%d`,e)}var $c={future:`in %s`,past:`%s ago`,s:`a few seconds`,ss:`%d seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,w:`a week`,ww:`%d weeks`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function el(e,t,n,r){var i=this._relativeTime[n];return kc(i)?i(e,t,n,r):i.replace(/%d/i,e)}function tl(e,t){var n=this._relativeTime[e>0?`future`:`past`];return kc(n)?n(t):n.replace(/%s/i,t)}var nl={D:`date`,dates:`date`,date:`date`,d:`day`,days:`day`,day:`day`,e:`weekday`,weekdays:`weekday`,weekday:`weekday`,E:`isoWeekday`,isoweekdays:`isoWeekday`,isoweekday:`isoWeekday`,DDD:`dayOfYear`,dayofyears:`dayOfYear`,dayofyear:`dayOfYear`,h:`hour`,hours:`hour`,hour:`hour`,ms:`millisecond`,milliseconds:`millisecond`,millisecond:`millisecond`,m:`minute`,minutes:`minute`,minute:`minute`,M:`month`,months:`month`,month:`month`,Q:`quarter`,quarters:`quarter`,quarter:`quarter`,s:`second`,seconds:`second`,second:`second`,gg:`weekYear`,weekyears:`weekYear`,weekyear:`weekYear`,GG:`isoWeekYear`,isoweekyears:`isoWeekYear`,isoweekyear:`isoWeekYear`,w:`week`,weeks:`week`,week:`week`,W:`isoWeek`,isoweeks:`isoWeek`,isoweek:`isoWeek`,y:`year`,years:`year`,year:`year`};function rl(e){return typeof e==`string`?nl[e]||nl[e.toLowerCase()]:void 0}function il(e){var t={},n,r;for(r in e)sc(e,r)&&(n=rl(r),n&&(t[n]=e[r]));return t}var al={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ol(e){var t=[],n;for(n in e)sc(e,n)&&t.push({unit:n,priority:al[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}var sl=/\d/,cl=/\d\d/,ll=/\d{3}/,ul=/\d{4}/,dl=/[+-]?\d{6}/,fl=/\d\d?/,pl=/\d\d\d\d?/,ml=/\d\d\d\d\d\d?/,hl=/\d{1,3}/,gl=/\d{1,4}/,_l=/[+-]?\d{1,6}/,vl=/\d+/,yl=/[+-]?\d+/,bl=/Z|[+-]\d\d:?\d\d/gi,xl=/Z|[+-]\d\d(?::?\d\d)?/gi,Sl=/[+-]?\d+(\.\d{1,3})?/,Cl=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,wl=/^[1-9]\d?/,Tl=/^([1-9]\d|\d)/,El={};function Dl(e,t,n){El[e]=kc(t)?t:function(e,r){return e&&n?n:t}}function Ol(e,t){return sc(El,e)?El[e](t._strict,t._locale):new RegExp(kl(e))}function kl(e){return Al(e.replace(`\\`,``).replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,r,i){return t||n||r||i}))}function Al(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,`\\$&`)}function jl(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Ml(e){var t=+e,n=0;return t!==0&&isFinite(t)&&(n=jl(t)),n}var Nl={};function Pl(e,t){var n,r=t,i;for(typeof e==`string`&&(e=[e]),uc(t)&&(r=function(e,n){n[t]=Ml(e)}),i=e.length,n=0;n<i;n++)Nl[e[n]]=r}function Fl(e,t){Pl(e,function(e,n,r,i){r._w=r._w||{},t(e,r._w,r,i)})}function Il(e,t,n){t!=null&&sc(Nl,e)&&Nl[e](t,n._a,n,e)}function Ll(e){return e%4==0&&e%100!=0||e%400==0}var Rl=0,zl=1,Bl=2,Vl=3,Hl=4,Ul=5,Wl=6,Gl=7,Kl=8;Vc(`Y`,0,0,function(){var e=this.year();return e<=9999?Ic(e,4):`+`+e}),Vc(0,[`YY`,2],0,function(){return this.year()%100}),Vc(0,[`YYYY`,4],0,`year`),Vc(0,[`YYYYY`,5],0,`year`),Vc(0,[`YYYYYY`,6,!0],0,`year`),Dl(`Y`,yl),Dl(`YY`,fl,cl),Dl(`YYYY`,gl,ul),Dl(`YYYYY`,_l,dl),Dl(`YYYYYY`,_l,dl),Pl([`YYYYY`,`YYYYYY`],Rl),Pl(`YYYY`,function(e,t){t[Rl]=e.length===2?rc.parseTwoDigitYear(e):Ml(e)}),Pl(`YY`,function(e,t){t[Rl]=rc.parseTwoDigitYear(e)}),Pl(`Y`,function(e,t){t[Rl]=parseInt(e,10)});function ql(e){return Ll(e)?366:365}rc.parseTwoDigitYear=function(e){return Ml(e)+(Ml(e)>68?1900:2e3)};var Jl=Xl(`FullYear`,!0);function Yl(){return Ll(this.year())}function Xl(e,t){return function(n){return n==null?Zl(this,e):(Ql(this,e,n),rc.updateOffset(this,t),this)}}function Zl(e,t){if(!e.isValid())return NaN;var n=e._d,r=e._isUTC;switch(t){case`Milliseconds`:return r?n.getUTCMilliseconds():n.getMilliseconds();case`Seconds`:return r?n.getUTCSeconds():n.getSeconds();case`Minutes`:return r?n.getUTCMinutes():n.getMinutes();case`Hours`:return r?n.getUTCHours():n.getHours();case`Date`:return r?n.getUTCDate():n.getDate();case`Day`:return r?n.getUTCDay():n.getDay();case`Month`:return r?n.getUTCMonth():n.getMonth();case`FullYear`:return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Ql(e,t,n){var r,i,a,o,s;if(!(!e.isValid()||isNaN(n))){switch(r=e._d,i=e._isUTC,t){case`Milliseconds`:i?r.setUTCMilliseconds(n):r.setMilliseconds(n);return;case`Seconds`:i?r.setUTCSeconds(n):r.setSeconds(n);return;case`Minutes`:i?r.setUTCMinutes(n):r.setMinutes(n);return;case`Hours`:i?r.setUTCHours(n):r.setHours(n);return;case`Date`:i?r.setUTCDate(n):r.setDate(n);return;case`FullYear`:break;default:return}a=n,o=e.month(),s=e.date(),s=s===29&&o===1&&!Ll(a)?28:s,i?r.setUTCFullYear(a,o,s):r.setFullYear(a,o,s)}}function $l(e){return e=rl(e),kc(this[e])?this[e]():this}function eu(e,t){if(typeof e==`object`){e=il(e);var n=ol(e),r,i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(e=rl(e),kc(this[e]))return this[e](t);return this}function tu(e,t){return(e%t+t)%t}var nu=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1};function ru(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=tu(t,12);return e+=(t-n)/12,n===1?Ll(e)?29:28:31-n%7%2}Vc(`M`,[`MM`,2],`Mo`,function(){return this.month()+1}),Vc(`MMM`,0,0,function(e){return this.localeData().monthsShort(this,e)}),Vc(`MMMM`,0,0,function(e){return this.localeData().months(this,e)}),Dl(`M`,fl,wl),Dl(`MM`,fl,cl),Dl(`MMM`,function(e,t){return t.monthsShortRegex(e)}),Dl(`MMMM`,function(e,t){return t.monthsRegex(e)}),Pl([`M`,`MM`],function(e,t){t[zl]=Ml(e)-1}),Pl([`MMM`,`MMMM`],function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);i==null?gc(n).invalidMonth=e:t[zl]=i});var iu=`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),au=`Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec`.split(`_`),ou=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,su=Cl,cu=Cl;function lu(e,t){return e?ac(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||ou).test(t)?`format`:`standalone`][e.month()]:ac(this._months)?this._months:this._months.standalone}function uu(e,t){return e?ac(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[ou.test(t)?`format`:`standalone`][e.month()]:ac(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function du(e,t,n){var r,i,a,o=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)a=mc([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(a,``).toLocaleLowerCase(),this._longMonthsParse[r]=this.months(a,``).toLocaleLowerCase();return n?t===`MMM`?(i=nu.call(this._shortMonthsParse,o),i===-1?null:i):(i=nu.call(this._longMonthsParse,o),i===-1?null:i):t===`MMM`?(i=nu.call(this._shortMonthsParse,o),i===-1?(i=nu.call(this._longMonthsParse,o),i===-1?null:i):i):(i=nu.call(this._longMonthsParse,o),i===-1?(i=nu.call(this._shortMonthsParse,o),i===-1?null:i):i)}function fu(e,t,n){var r,i,a;if(this._monthsParseExact)return du.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++)if(i=mc([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=RegExp(`^`+this.months(i,``).replace(`.`,``)+`$`,`i`),this._shortMonthsParse[r]=RegExp(`^`+this.monthsShort(i,``).replace(`.`,``)+`$`,`i`)),!n&&!this._monthsParse[r]&&(a=`^`+this.months(i,``)+`|^`+this.monthsShort(i,``),this._monthsParse[r]=new RegExp(a.replace(`.`,``),`i`)),n&&t===`MMMM`&&this._longMonthsParse[r].test(e)||n&&t===`MMM`&&this._shortMonthsParse[r].test(e)||!n&&this._monthsParse[r].test(e))return r}function pu(e,t){if(!e.isValid())return e;if(typeof t==`string`){if(/^\d+$/.test(t))t=Ml(t);else if(t=e.localeData().monthsParse(t),!uc(t))return e}var n=t,r=e.date();return r=r<29?r:Math.min(r,ru(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,r):e._d.setMonth(n,r),e}function mu(e){return e==null?Zl(this,`Month`):(pu(this,e),rc.updateOffset(this,!0),this)}function hu(){return ru(this.year(),this.month())}function gu(e){return this._monthsParseExact?(sc(this,`_monthsRegex`)||vu.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(sc(this,`_monthsShortRegex`)||(this._monthsShortRegex=su),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function _u(e){return this._monthsParseExact?(sc(this,`_monthsRegex`)||vu.call(this),e?this._monthsStrictRegex:this._monthsRegex):(sc(this,`_monthsRegex`)||(this._monthsRegex=cu),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function vu(){function e(e,t){return t.length-e.length}var t=[],n=[],r=[],i,a,o,s;for(i=0;i<12;i++)a=mc([2e3,i]),o=Al(this.monthsShort(a,``)),s=Al(this.months(a,``)),t.push(o),n.push(s),r.push(s),r.push(o);t.sort(e),n.sort(e),r.sort(e),this._monthsRegex=RegExp(`^(`+r.join(`|`)+`)`,`i`),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp(`^(`+n.join(`|`)+`)`,`i`),this._monthsShortStrictRegex=RegExp(`^(`+t.join(`|`)+`)`,`i`)}function yu(e,t,n,r,i,a,o){var s;return e<100&&e>=0?(s=new Date(e+400,t,n,r,i,a,o),isFinite(s.getFullYear())&&s.setFullYear(e)):s=new Date(e,t,n,r,i,a,o),s}function bu(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function xu(e,t,n){var r=7+t-n;return-((7+bu(e,0,r).getUTCDay()-t)%7)+r-1}function Su(e,t,n,r,i){var a=(7+n-r)%7,o=xu(e,r,i),s=1+7*(t-1)+a+o,c,l;return s<=0?(c=e-1,l=ql(c)+s):s>ql(e)?(c=e+1,l=s-ql(e)):(c=e,l=s),{year:c,dayOfYear:l}}function Cu(e,t,n){var r=xu(e.year(),t,n),i=Math.floor((e.dayOfYear()-r-1)/7)+1,a,o;return i<1?(o=e.year()-1,a=i+wu(o,t,n)):i>wu(e.year(),t,n)?(a=i-wu(e.year(),t,n),o=e.year()+1):(o=e.year(),a=i),{week:a,year:o}}function wu(e,t,n){var r=xu(e,t,n),i=xu(e+1,t,n);return(ql(e)-r+i)/7}Vc(`w`,[`ww`,2],`wo`,`week`),Vc(`W`,[`WW`,2],`Wo`,`isoWeek`),Dl(`w`,fl,wl),Dl(`ww`,fl,cl),Dl(`W`,fl,wl),Dl(`WW`,fl,cl),Fl([`w`,`ww`,`W`,`WW`],function(e,t,n,r){t[r.substr(0,1)]=Ml(e)});function Tu(e){return Cu(e,this._week.dow,this._week.doy).week}var Eu={dow:0,doy:6};function Du(){return this._week.dow}function Ou(){return this._week.doy}function ku(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,`d`)}function Au(e){var t=Cu(this,1,4).week;return e==null?t:this.add((e-t)*7,`d`)}Vc(`d`,0,`do`,`day`),Vc(`dd`,0,0,function(e){return this.localeData().weekdaysMin(this,e)}),Vc(`ddd`,0,0,function(e){return this.localeData().weekdaysShort(this,e)}),Vc(`dddd`,0,0,function(e){return this.localeData().weekdays(this,e)}),Vc(`e`,0,0,`weekday`),Vc(`E`,0,0,`isoWeekday`),Dl(`d`,fl),Dl(`e`,fl),Dl(`E`,fl),Dl(`dd`,function(e,t){return t.weekdaysMinRegex(e)}),Dl(`ddd`,function(e,t){return t.weekdaysShortRegex(e)}),Dl(`dddd`,function(e,t){return t.weekdaysRegex(e)}),Fl([`dd`,`ddd`,`dddd`],function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);i==null?gc(n).invalidWeekday=e:t.d=i}),Fl([`d`,`e`,`E`],function(e,t,n,r){t[r]=Ml(e)});function ju(e,t){return typeof e==`string`?isNaN(e)?(e=t.weekdaysParse(e),typeof e==`number`?e:null):parseInt(e,10):e}function Mu(e,t){return typeof e==`string`?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Nu(e,t){return e.slice(t,7).concat(e.slice(0,t))}var Pu=`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),Fu=`Sun_Mon_Tue_Wed_Thu_Fri_Sat`.split(`_`),Iu=`Su_Mo_Tu_We_Th_Fr_Sa`.split(`_`),Lu=Cl,Ru=Cl,zu=Cl;function Bu(e,t){var n=ac(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?`format`:`standalone`];return e===!0?Nu(n,this._week.dow):e?n[e.day()]:n}function Vu(e){return e===!0?Nu(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Hu(e){return e===!0?Nu(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function Uu(e,t,n){var r,i,a,o=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)a=mc([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(a,``).toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(a,``).toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(a,``).toLocaleLowerCase();return n?t===`dddd`?(i=nu.call(this._weekdaysParse,o),i===-1?null:i):t===`ddd`?(i=nu.call(this._shortWeekdaysParse,o),i===-1?null:i):(i=nu.call(this._minWeekdaysParse,o),i===-1?null:i):t===`dddd`?(i=nu.call(this._weekdaysParse,o),i!==-1||(i=nu.call(this._shortWeekdaysParse,o),i!==-1)?i:(i=nu.call(this._minWeekdaysParse,o),i===-1?null:i)):t===`ddd`?(i=nu.call(this._shortWeekdaysParse,o),i!==-1||(i=nu.call(this._weekdaysParse,o),i!==-1)?i:(i=nu.call(this._minWeekdaysParse,o),i===-1?null:i)):(i=nu.call(this._minWeekdaysParse,o),i!==-1||(i=nu.call(this._weekdaysParse,o),i!==-1)?i:(i=nu.call(this._shortWeekdaysParse,o),i===-1?null:i))}function Wu(e,t,n){var r,i,a;if(this._weekdaysParseExact)return Uu.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++)if(i=mc([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=RegExp(`^`+this.weekdays(i,``).replace(`.`,`\\.?`)+`$`,`i`),this._shortWeekdaysParse[r]=RegExp(`^`+this.weekdaysShort(i,``).replace(`.`,`\\.?`)+`$`,`i`),this._minWeekdaysParse[r]=RegExp(`^`+this.weekdaysMin(i,``).replace(`.`,`\\.?`)+`$`,`i`)),this._weekdaysParse[r]||(a=`^`+this.weekdays(i,``)+`|^`+this.weekdaysShort(i,``)+`|^`+this.weekdaysMin(i,``),this._weekdaysParse[r]=new RegExp(a.replace(`.`,``),`i`)),n&&t===`dddd`&&this._fullWeekdaysParse[r].test(e)||n&&t===`ddd`&&this._shortWeekdaysParse[r].test(e)||n&&t===`dd`&&this._minWeekdaysParse[r].test(e)||!n&&this._weekdaysParse[r].test(e))return r}function Gu(e){if(!this.isValid())return e==null?NaN:this;var t=Zl(this,`Day`);return e==null?t:(e=ju(e,this.localeData()),this.add(e-t,`d`))}function Ku(e){if(!this.isValid())return e==null?NaN:this;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,`d`)}function qu(e){if(!this.isValid())return e==null?NaN:this;if(e!=null){var t=Mu(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function Ju(e){return this._weekdaysParseExact?(sc(this,`_weekdaysRegex`)||Zu.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(sc(this,`_weekdaysRegex`)||(this._weekdaysRegex=Lu),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Yu(e){return this._weekdaysParseExact?(sc(this,`_weekdaysRegex`)||Zu.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(sc(this,`_weekdaysShortRegex`)||(this._weekdaysShortRegex=Ru),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Xu(e){return this._weekdaysParseExact?(sc(this,`_weekdaysRegex`)||Zu.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(sc(this,`_weekdaysMinRegex`)||(this._weekdaysMinRegex=zu),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Zu(){function e(e,t){return t.length-e.length}var t=[],n=[],r=[],i=[],a,o,s,c,l;for(a=0;a<7;a++)o=mc([2e3,1]).day(a),s=Al(this.weekdaysMin(o,``)),c=Al(this.weekdaysShort(o,``)),l=Al(this.weekdays(o,``)),t.push(s),n.push(c),r.push(l),i.push(s),i.push(c),i.push(l);t.sort(e),n.sort(e),r.sort(e),i.sort(e),this._weekdaysRegex=RegExp(`^(`+i.join(`|`)+`)`,`i`),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp(`^(`+r.join(`|`)+`)`,`i`),this._weekdaysShortStrictRegex=RegExp(`^(`+n.join(`|`)+`)`,`i`),this._weekdaysMinStrictRegex=RegExp(`^(`+t.join(`|`)+`)`,`i`)}function Qu(){return this.hours()%12||12}function $u(){return this.hours()||24}Vc(`H`,[`HH`,2],0,`hour`),Vc(`h`,[`hh`,2],0,Qu),Vc(`k`,[`kk`,2],0,$u),Vc(`hmm`,0,0,function(){return``+Qu.apply(this)+Ic(this.minutes(),2)}),Vc(`hmmss`,0,0,function(){return``+Qu.apply(this)+Ic(this.minutes(),2)+Ic(this.seconds(),2)}),Vc(`Hmm`,0,0,function(){return``+this.hours()+Ic(this.minutes(),2)}),Vc(`Hmmss`,0,0,function(){return``+this.hours()+Ic(this.minutes(),2)+Ic(this.seconds(),2)});function ed(e,t){Vc(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}ed(`a`,!0),ed(`A`,!1);function td(e,t){return t._meridiemParse}Dl(`a`,td),Dl(`A`,td),Dl(`H`,fl,Tl),Dl(`h`,fl,wl),Dl(`k`,fl,wl),Dl(`HH`,fl,cl),Dl(`hh`,fl,cl),Dl(`kk`,fl,cl),Dl(`hmm`,pl),Dl(`hmmss`,ml),Dl(`Hmm`,pl),Dl(`Hmmss`,ml),Pl([`H`,`HH`],Vl),Pl([`k`,`kk`],function(e,t,n){var r=Ml(e);t[Vl]=r===24?0:r}),Pl([`a`,`A`],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),Pl([`h`,`hh`],function(e,t,n){t[Vl]=Ml(e),gc(n).bigHour=!0}),Pl(`hmm`,function(e,t,n){var r=e.length-2;t[Vl]=Ml(e.substr(0,r)),t[Hl]=Ml(e.substr(r)),gc(n).bigHour=!0}),Pl(`hmmss`,function(e,t,n){var r=e.length-4,i=e.length-2;t[Vl]=Ml(e.substr(0,r)),t[Hl]=Ml(e.substr(r,2)),t[Ul]=Ml(e.substr(i)),gc(n).bigHour=!0}),Pl(`Hmm`,function(e,t,n){var r=e.length-2;t[Vl]=Ml(e.substr(0,r)),t[Hl]=Ml(e.substr(r))}),Pl(`Hmmss`,function(e,t,n){var r=e.length-4,i=e.length-2;t[Vl]=Ml(e.substr(0,r)),t[Hl]=Ml(e.substr(r,2)),t[Ul]=Ml(e.substr(i))});function nd(e){return(e+``).toLowerCase().charAt(0)===`p`}var rd=/[ap]\.?m?\.?/i,id=Xl(`Hours`,!0);function ad(e,t,n){return e>11?n?`pm`:`PM`:n?`am`:`AM`}var od={calendar:Pc,longDateFormat:Kc,invalidDate:Jc,ordinal:Xc,dayOfMonthOrdinalParse:Zc,relativeTime:$c,months:iu,monthsShort:au,week:Eu,weekdays:Pu,weekdaysMin:Iu,weekdaysShort:Fu,meridiemParse:rd},sd={},cd={},ld;function ud(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n<r;n+=1)if(e[n]!==t[n])return n;return r}function dd(e){return e&&e.toLowerCase().replace(`_`,`-`)}function fd(e){for(var t=0,n,r,i,a;t<e.length;){for(a=dd(e[t]).split(`-`),n=a.length,r=dd(e[t+1]),r=r?r.split(`-`):null;n>0;){if(i=md(a.slice(0,n).join(`-`)),i)return i;if(r&&r.length>=n&&ud(a,r)>=n-1)break;n--}t++}return ld}function pd(e){return!!(e&&e.match(`^[^/\\\\]*$`))}function md(e){var t=null,n;if(sd[e]===void 0&&typeof module<`u`&&module&&module.exports&&pd(e))try{t=ld._abbr,n=require,n(`./locale/`+e),hd(t)}catch{sd[e]=null}return sd[e]}function hd(e,t){var n;return e&&(n=lc(t)?vd(e):gd(e,t),n?ld=n:typeof console<`u`&&console.warn&&console.warn(`Locale `+e+` not found. Did you forget to load it?`)),ld._abbr}function gd(e,t){if(t!==null){var n,r=od;if(t.abbr=e,sd[e]!=null)Oc(`defineLocaleOverride`,`use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info.`),r=sd[e]._config;else if(t.parentLocale!=null)if(sd[t.parentLocale]!=null)r=sd[t.parentLocale]._config;else if(n=md(t.parentLocale),n!=null)r=n._config;else return cd[t.parentLocale]||(cd[t.parentLocale]=[]),cd[t.parentLocale].push({name:e,config:t}),null;return sd[e]=new Mc(jc(r,t)),cd[e]&&cd[e].forEach(function(e){gd(e.name,e.config)}),hd(e),sd[e]}else return delete sd[e],null}function _d(e,t){if(t!=null){var n,r,i=od;sd[e]!=null&&sd[e].parentLocale!=null?sd[e].set(jc(sd[e]._config,t)):(r=md(e),r!=null&&(i=r._config),t=jc(i,t),r??(t.abbr=e),n=new Mc(t),n.parentLocale=sd[e],sd[e]=n),hd(e)}else sd[e]!=null&&(sd[e].parentLocale==null?sd[e]!=null&&delete sd[e]:(sd[e]=sd[e].parentLocale,e===hd()&&hd(e)));return sd[e]}function vd(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ld;if(!ac(e)){if(t=md(e),t)return t;e=[e]}return fd(e)}function yd(){return Nc(sd)}function bd(e){var t,n=e._a;return n&&gc(e).overflow===-2&&(t=n[zl]<0||n[zl]>11?zl:n[Bl]<1||n[Bl]>ru(n[Rl],n[zl])?Bl:n[Vl]<0||n[Vl]>24||n[Vl]===24&&(n[Hl]!==0||n[Ul]!==0||n[Wl]!==0)?Vl:n[Hl]<0||n[Hl]>59?Hl:n[Ul]<0||n[Ul]>59?Ul:n[Wl]<0||n[Wl]>999?Wl:-1,gc(e)._overflowDayOfYear&&(t<Rl||t>Bl)&&(t=Bl),gc(e)._overflowWeeks&&t===-1&&(t=Gl),gc(e)._overflowWeekday&&t===-1&&(t=Kl),gc(e).overflow=t),e}var xd=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sd=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Cd=/Z|[+-]\d\d(?::?\d\d)?/,wd=[[`YYYYYY-MM-DD`,/[+-]\d{6}-\d\d-\d\d/],[`YYYY-MM-DD`,/\d{4}-\d\d-\d\d/],[`GGGG-[W]WW-E`,/\d{4}-W\d\d-\d/],[`GGGG-[W]WW`,/\d{4}-W\d\d/,!1],[`YYYY-DDD`,/\d{4}-\d{3}/],[`YYYY-MM`,/\d{4}-\d\d/,!1],[`YYYYYYMMDD`,/[+-]\d{10}/],[`YYYYMMDD`,/\d{8}/],[`GGGG[W]WWE`,/\d{4}W\d{3}/],[`GGGG[W]WW`,/\d{4}W\d{2}/,!1],[`YYYYDDD`,/\d{7}/],[`YYYYMM`,/\d{6}/,!1],[`YYYY`,/\d{4}/,!1]],Td=[[`HH:mm:ss.SSSS`,/\d\d:\d\d:\d\d\.\d+/],[`HH:mm:ss,SSSS`,/\d\d:\d\d:\d\d,\d+/],[`HH:mm:ss`,/\d\d:\d\d:\d\d/],[`HH:mm`,/\d\d:\d\d/],[`HHmmss.SSSS`,/\d\d\d\d\d\d\.\d+/],[`HHmmss,SSSS`,/\d\d\d\d\d\d,\d+/],[`HHmmss`,/\d\d\d\d\d\d/],[`HHmm`,/\d\d\d\d/],[`HH`,/\d\d/]],Ed=/^\/?Date\((-?\d+)/i,Dd=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Od={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function kd(e){var t,n,r=e._i,i=xd.exec(r)||Sd.exec(r),a,o,s,c,l=wd.length,u=Td.length;if(i){for(gc(e).iso=!0,t=0,n=l;t<n;t++)if(wd[t][1].exec(i[1])){o=wd[t][0],a=wd[t][2]!==!1;break}if(o==null){e._isValid=!1;return}if(i[3]){for(t=0,n=u;t<n;t++)if(Td[t][1].exec(i[3])){s=(i[2]||` `)+Td[t][0];break}if(s==null){e._isValid=!1;return}}if(!a&&s!=null){e._isValid=!1;return}if(i[4])if(Cd.exec(i[4]))c=`Z`;else{e._isValid=!1;return}e._f=o+(s||``)+(c||``),Vd(e)}else e._isValid=!1}function Ad(e,t,n,r,i,a){var o=[jd(e),au.indexOf(t),parseInt(n,10),parseInt(r,10),parseInt(i,10)];return a&&o.push(parseInt(a,10)),o}function jd(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Md(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).replace(/^\s\s*/,``).replace(/\s\s*$/,``)}function Nd(e,t,n){return e&&Fu.indexOf(e)!==new Date(t[0],t[1],t[2]).getDay()?(gc(n).weekdayMismatch=!0,n._isValid=!1,!1):!0}function Pd(e,t,n){if(e)return Od[e];if(t)return 0;var r=parseInt(n,10),i=r%100;return(r-i)/100*60+i}function Fd(e){var t=Dd.exec(Md(e._i)),n;if(t){if(n=Ad(t[4],t[3],t[2],t[5],t[6],t[7]),!Nd(t[1],n,e))return;e._a=n,e._tzm=Pd(t[8],t[9],t[10]),e._d=bu.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),gc(e).rfc2822=!0}else e._isValid=!1}function Id(e){var t=Ed.exec(e._i);if(t!==null){e._d=new Date(+t[1]);return}if(kd(e),e._isValid===!1)delete e._isValid;else return;if(Fd(e),e._isValid===!1)delete e._isValid;else return;e._strict?e._isValid=!1:rc.createFromInputFallback(e)}rc.createFromInputFallback=Ec(`value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.`,function(e){e._d=new Date(e._i+(e._useUTC?` UTC`:``))});function Ld(e,t,n){return e??t??n}function Rd(e){var t=new Date(rc.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function zd(e){var t,n,r=[],i,a,o;if(!e._d){for(i=Rd(e),e._w&&e._a[Bl]==null&&e._a[zl]==null&&Bd(e),e._dayOfYear!=null&&(o=Ld(e._a[Rl],i[Rl]),(e._dayOfYear>ql(o)||e._dayOfYear===0)&&(gc(e)._overflowDayOfYear=!0),n=bu(o,0,e._dayOfYear),e._a[zl]=n.getUTCMonth(),e._a[Bl]=n.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=r[t]=i[t];for(;t<7;t++)e._a[t]=r[t]=e._a[t]==null?+(t===2):e._a[t];e._a[Vl]===24&&e._a[Hl]===0&&e._a[Ul]===0&&e._a[Wl]===0&&(e._nextDay=!0,e._a[Vl]=0),e._d=(e._useUTC?bu:yu).apply(null,r),a=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Vl]=24),e._w&&e._w.d!==void 0&&e._w.d!==a&&(gc(e).weekdayMismatch=!0)}}function Bd(e){var t=e._w,n,r,i,a,o,s,c,l;t.GG!=null||t.W!=null||t.E!=null?(a=1,o=4,n=Ld(t.GG,e._a[Rl],Cu(Yd(),1,4).year),r=Ld(t.W,1),i=Ld(t.E,1),(i<1||i>7)&&(c=!0)):(a=e._locale._week.dow,o=e._locale._week.doy,l=Cu(Yd(),a,o),n=Ld(t.gg,e._a[Rl],l.year),r=Ld(t.w,l.week),t.d==null?t.e==null?i=a:(i=t.e+a,(t.e<0||t.e>6)&&(c=!0)):(i=t.d,(i<0||i>6)&&(c=!0))),r<1||r>wu(n,a,o)?gc(e)._overflowWeeks=!0:c==null?(s=Su(n,r,i,a,o),e._a[Rl]=s.year,e._dayOfYear=s.dayOfYear):gc(e)._overflowWeekday=!0}rc.ISO_8601=function(){},rc.RFC_2822=function(){};function Vd(e){if(e._f===rc.ISO_8601){kd(e);return}if(e._f===rc.RFC_2822){Fd(e);return}e._a=[],gc(e).empty=!0;var t=``+e._i,n,r,i,a,o,s=t.length,c=0,l,u;for(i=Gc(e._f,e._locale).match(Lc)||[],u=i.length,n=0;n<u;n++)a=i[n],r=(t.match(Ol(a,e))||[])[0],r&&(o=t.substr(0,t.indexOf(r)),o.length>0&&gc(e).unusedInput.push(o),t=t.slice(t.indexOf(r)+r.length),c+=r.length),Bc[a]?(r?gc(e).empty=!1:gc(e).unusedTokens.push(a),Il(a,r,e)):e._strict&&!r&&gc(e).unusedTokens.push(a);gc(e).charsLeftOver=s-c,t.length>0&&gc(e).unusedInput.push(t),e._a[Vl]<=12&&gc(e).bigHour===!0&&e._a[Vl]>0&&(gc(e).bigHour=void 0),gc(e).parsedDateParts=e._a.slice(0),gc(e).meridiem=e._meridiem,e._a[Vl]=Hd(e._locale,e._a[Vl],e._meridiem),l=gc(e).era,l!==null&&(e._a[Rl]=e._locale.erasConvertYear(l,e._a[Rl])),zd(e),bd(e)}function Hd(e,t,n){var r;return n==null?t:e.meridiemHour==null?e.isPM==null?t:(r=e.isPM(n),r&&t<12&&(t+=12),!r&&t===12&&(t=0),t):e.meridiemHour(t,n)}function Ud(e){var t,n,r,i,a,o,s=!1,c=e._f.length;if(c===0){gc(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<c;i++)a=0,o=!1,t=Sc({},e),e._useUTC!=null&&(t._useUTC=e._useUTC),t._f=e._f[i],Vd(t),vc(t)&&(o=!0),a+=gc(t).charsLeftOver,a+=gc(t).unusedTokens.length*10,gc(t).score=a,s?a<r&&(r=a,n=t):(r==null||a<r||o)&&(r=a,n=t,o&&(s=!0));pc(e,n||t)}function Wd(e){if(!e._d){var t=il(e._i),n=t.day===void 0?t.date:t.day;e._a=fc([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),zd(e)}}function Gd(e){var t=new Cc(bd(Kd(e)));return t._nextDay&&=(t.add(1,`d`),void 0),t}function Kd(e){var t=e._i,n=e._f;return e._locale=e._locale||vd(e._l),t===null||n===void 0&&t===``?yc({nullInput:!0}):(typeof t==`string`&&(e._i=t=e._locale.preparse(t)),wc(t)?new Cc(bd(t)):(dc(t)?e._d=t:ac(n)?Ud(e):n?Vd(e):qd(e),vc(e)||(e._d=null),e))}function qd(e){var t=e._i;lc(t)?e._d=new Date(rc.now()):dc(t)?e._d=new Date(t.valueOf()):typeof t==`string`?Id(e):ac(t)?(e._a=fc(t.slice(0),function(e){return parseInt(e,10)}),zd(e)):oc(t)?Wd(e):uc(t)?e._d=new Date(t):rc.createFromInputFallback(e)}function Jd(e,t,n,r,i){var a={};return(t===!0||t===!1)&&(r=t,t=void 0),(n===!0||n===!1)&&(r=n,n=void 0),(oc(e)&&cc(e)||ac(e)&&e.length===0)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=r,Gd(a)}function Yd(e,t,n,r){return Jd(e,t,n,r,!1)}var Xd=Ec(`moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/`,function(){var e=Yd.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:yc()}),Zd=Ec(`moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/`,function(){var e=Yd.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:yc()});function Qd(e,t){var n,r;if(t.length===1&&ac(t[0])&&(t=t[0]),!t.length)return Yd();for(n=t[0],r=1;r<t.length;++r)(!t[r].isValid()||t[r][e](n))&&(n=t[r]);return n}function $d(){return Qd(`isBefore`,[].slice.call(arguments,0))}function ef(){return Qd(`isAfter`,[].slice.call(arguments,0))}var tf=function(){return Date.now?Date.now():+new Date},nf=[`year`,`quarter`,`month`,`week`,`day`,`hour`,`minute`,`second`,`millisecond`];function rf(e){var t,n=!1,r,i=nf.length;for(t in e)if(sc(e,t)&&!(nu.call(nf,t)!==-1&&(e[t]==null||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[nf[r]]){if(n)return!1;parseFloat(e[nf[r]])!==Ml(e[nf[r]])&&(n=!0)}return!0}function af(){return this._isValid}function of(){return kf(NaN)}function sf(e){var t=il(e),n=t.year||0,r=t.quarter||0,i=t.month||0,a=t.week||t.isoWeek||0,o=t.day||0,s=t.hour||0,c=t.minute||0,l=t.second||0,u=t.millisecond||0;this._isValid=rf(t),this._milliseconds=+u+l*1e3+c*6e4+s*1e3*60*60,this._days=+o+a*7,this._months=+i+r*3+n*12,this._data={},this._locale=vd(),this._bubble()}function cf(e){return e instanceof sf}function lf(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function uf(e,t,n){var r=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),a=0,o;for(o=0;o<r;o++)(n&&e[o]!==t[o]||!n&&Ml(e[o])!==Ml(t[o]))&&a++;return a+i}function df(e,t){Vc(e,0,0,function(){var e=this.utcOffset(),n=`+`;return e<0&&(e=-e,n=`-`),n+Ic(~~(e/60),2)+t+Ic(~~e%60,2)})}df(`Z`,`:`),df(`ZZ`,``),Dl(`Z`,xl),Dl(`ZZ`,xl),Pl([`Z`,`ZZ`],function(e,t,n){n._useUTC=!0,n._tzm=pf(xl,e)});var ff=/([\+\-]|\d\d)/gi;function pf(e,t){var n=(t||``).match(e),r,i,a;return n===null?null:(r=n[n.length-1]||[],i=(r+``).match(ff)||[`-`,0,0],a=+(i[1]*60)+Ml(i[2]),a===0?0:i[0]===`+`?a:-a)}function mf(e,t){var n,r;return t._isUTC?(n=t.clone(),r=(wc(e)||dc(e)?e.valueOf():Yd(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+r),rc.updateOffset(n,!1),n):Yd(e).local()}function hf(e){return-Math.round(e._d.getTimezoneOffset())}rc.updateOffset=function(){};function gf(e,t,n){var r=this._offset||0,i;if(!this.isValid())return e==null?NaN:this;if(e!=null){if(typeof e==`string`){if(e=pf(xl,e),e===null)return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(i=hf(this)),this._offset=e,this._isUTC=!0,i!=null&&this.add(i,`m`),r!==e&&(!t||this._changeInProgress?Pf(this,kf(e-r,`m`),1,!1):this._changeInProgress||=(this._changeInProgress=!0,rc.updateOffset(this,!0),null)),this}else return this._isUTC?r:hf(this)}function _f(e,t){return e==null?-this.utcOffset():(typeof e!=`string`&&(e=-e),this.utcOffset(e,t),this)}function vf(e){return this.utcOffset(0,e)}function yf(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(hf(this),`m`)),this}function bf(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i==`string`){var e=pf(bl,this._i);e==null?this.utcOffset(0,!0):this.utcOffset(e)}return this}function xf(e){return this.isValid()?(e=e?Yd(e).utcOffset():0,(this.utcOffset()-e)%60==0):!1}function Sf(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Cf(){if(!lc(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Sc(e,this),e=Kd(e),e._a?(t=e._isUTC?mc(e._a):Yd(e._a),this._isDSTShifted=this.isValid()&&uf(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function wf(){return this.isValid()?!this._isUTC:!1}function Tf(){return this.isValid()?this._isUTC:!1}function Ef(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Df=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Of=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function kf(e,t){var n=e,r=null,i,a,o;return cf(e)?n={ms:e._milliseconds,d:e._days,M:e._months}:uc(e)||!isNaN(+e)?(n={},t?n[t]=+e:n.milliseconds=+e):(r=Df.exec(e))?(i=r[1]===`-`?-1:1,n={y:0,d:Ml(r[Bl])*i,h:Ml(r[Vl])*i,m:Ml(r[Hl])*i,s:Ml(r[Ul])*i,ms:Ml(lf(r[Wl]*1e3))*i}):(r=Of.exec(e))?(i=r[1]===`-`?-1:1,n={y:Af(r[2],i),M:Af(r[3],i),w:Af(r[4],i),d:Af(r[5],i),h:Af(r[6],i),m:Af(r[7],i),s:Af(r[8],i)}):n==null?n={}:typeof n==`object`&&(`from`in n||`to`in n)&&(o=Mf(Yd(n.from),Yd(n.to)),n={},n.ms=o.milliseconds,n.M=o.months),a=new sf(n),cf(e)&&sc(e,`_locale`)&&(a._locale=e._locale),cf(e)&&sc(e,`_isValid`)&&(a._isValid=e._isValid),a}kf.fn=sf.prototype,kf.invalid=of;function Af(e,t){var n=e&&parseFloat(e.replace(`,`,`.`));return(isNaN(n)?0:n)*t}function jf(e,t){var n={};return n.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(n.months,`M`).isAfter(t)&&--n.months,n.milliseconds=t-+e.clone().add(n.months,`M`),n}function Mf(e,t){var n;return e.isValid()&&t.isValid()?(t=mf(t,e),e.isBefore(t)?n=jf(e,t):(n=jf(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Nf(e,t){return function(n,r){var i,a;return r!==null&&!isNaN(+r)&&(Oc(t,`moment().`+t+`(period, number) is deprecated. Please use moment().`+t+`(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.`),a=n,n=r,r=a),i=kf(n,r),Pf(this,i,e),this}}function Pf(e,t,n,r){var i=t._milliseconds,a=lf(t._days),o=lf(t._months);e.isValid()&&(r??=!0,o&&pu(e,Zl(e,`Month`)+o*n),a&&Ql(e,`Date`,Zl(e,`Date`)+a*n),i&&e._d.setTime(e._d.valueOf()+i*n),r&&rc.updateOffset(e,a||o))}var Ff=Nf(1,`add`),If=Nf(-1,`subtract`);function Lf(e){return typeof e==`string`||e instanceof String}function Rf(e){return wc(e)||dc(e)||Lf(e)||uc(e)||Bf(e)||zf(e)||e==null}function zf(e){var t=oc(e)&&!cc(e),n=!1,r=[`years`,`year`,`y`,`months`,`month`,`M`,`days`,`day`,`d`,`dates`,`date`,`D`,`hours`,`hour`,`h`,`minutes`,`minute`,`m`,`seconds`,`second`,`s`,`milliseconds`,`millisecond`,`ms`],i,a,o=r.length;for(i=0;i<o;i+=1)a=r[i],n||=sc(e,a);return t&&n}function Bf(e){var t=ac(e),n=!1;return t&&(n=e.filter(function(t){return!uc(t)&&Lf(e)}).length===0),t&&n}function Vf(e){var t=oc(e)&&!cc(e),n=!1,r=[`sameDay`,`nextDay`,`lastDay`,`nextWeek`,`lastWeek`,`sameElse`],i,a;for(i=0;i<r.length;i+=1)a=r[i],n||=sc(e,a);return t&&n}function Hf(e,t){var n=e.diff(t,`days`,!0);return n<-6?`sameElse`:n<-1?`lastWeek`:n<0?`lastDay`:n<1?`sameDay`:n<2?`nextDay`:n<7?`nextWeek`:`sameElse`}function Uf(e,t){arguments.length===1&&(arguments[0]?Rf(arguments[0])?(e=arguments[0],t=void 0):Vf(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||Yd(),r=mf(n,this).startOf(`day`),i=rc.calendarFormat(this,r)||`sameElse`,a=t&&(kc(t[i])?t[i].call(this,n):t[i]);return this.format(a||this.localeData().calendar(i,this,Yd(n)))}function Wf(){return new Cc(this)}function Gf(e,t){var n=wc(e)?e:Yd(e);return this.isValid()&&n.isValid()?(t=rl(t)||`millisecond`,t===`millisecond`?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf()):!1}function Kf(e,t){var n=wc(e)?e:Yd(e);return this.isValid()&&n.isValid()?(t=rl(t)||`millisecond`,t===`millisecond`?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf()):!1}function qf(e,t,n,r){var i=wc(e)?e:Yd(e),a=wc(t)?t:Yd(t);return this.isValid()&&i.isValid()&&a.isValid()?(r||=`()`,(r[0]===`(`?this.isAfter(i,n):!this.isBefore(i,n))&&(r[1]===`)`?this.isBefore(a,n):!this.isAfter(a,n))):!1}function Jf(e,t){var n=wc(e)?e:Yd(e),r;return this.isValid()&&n.isValid()?(t=rl(t)||`millisecond`,t===`millisecond`?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf())):!1}function Yf(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Xf(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Zf(e,t,n){var r,i,a;if(!this.isValid()||(r=mf(e,this),!r.isValid()))return NaN;switch(i=(r.utcOffset()-this.utcOffset())*6e4,t=rl(t),t){case`year`:a=Qf(this,r)/12;break;case`month`:a=Qf(this,r);break;case`quarter`:a=Qf(this,r)/3;break;case`second`:a=(this-r)/1e3;break;case`minute`:a=(this-r)/6e4;break;case`hour`:a=(this-r)/36e5;break;case`day`:a=(this-r-i)/864e5;break;case`week`:a=(this-r-i)/6048e5;break;default:a=this-r}return n?a:jl(a)}function Qf(e,t){if(e.date()<t.date())return-Qf(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),r=e.clone().add(n,`months`),i,a;return t-r<0?(i=e.clone().add(n-1,`months`),a=(t-r)/(r-i)):(i=e.clone().add(n+1,`months`),a=(t-r)/(i-r)),-(n+a)||0}rc.defaultFormat=`YYYY-MM-DDTHH:mm:ssZ`,rc.defaultFormatUtc=`YYYY-MM-DDTHH:mm:ss[Z]`;function $f(){return this.clone().locale(`en`).format(`ddd MMM DD YYYY HH:mm:ss [GMT]ZZ`)}function ep(e){if(!this.isValid())return null;var t=e!==!0,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?Wc(n,t?`YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]`:`YYYYYY-MM-DD[T]HH:mm:ss.SSSZ`):kc(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace(`Z`,Wc(n,`Z`)):Wc(n,t?`YYYY-MM-DD[T]HH:mm:ss.SSS[Z]`:`YYYY-MM-DD[T]HH:mm:ss.SSSZ`)}function tp(){if(!this.isValid())return`moment.invalid(/* `+this._i+` */)`;var e=`moment`,t=``,n,r,i,a;return this.isLocal()||(e=this.utcOffset()===0?`moment.utc`:`moment.parseZone`,t=`Z`),n=`[`+e+`("]`,r=0<=this.year()&&this.year()<=9999?`YYYY`:`YYYYYY`,i=`-MM-DD[T]HH:mm:ss.SSS`,a=t+`[")]`,this.format(n+r+i+a)}function np(e){e||=this.isUtc()?rc.defaultFormatUtc:rc.defaultFormat;var t=Wc(this,e);return this.localeData().postformat(t)}function rp(e,t){return this.isValid()&&(wc(e)&&e.isValid()||Yd(e).isValid())?kf({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ip(e){return this.from(Yd(),e)}function ap(e,t){return this.isValid()&&(wc(e)&&e.isValid()||Yd(e).isValid())?kf({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function op(e){return this.to(Yd(),e)}function sp(e){var t;return e===void 0?this._locale._abbr:(t=vd(e),t!=null&&(this._locale=t),this)}var cp=Ec(`moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.`,function(e){return e===void 0?this.localeData():this.locale(e)});function lp(){return this._locale}var up=1e3,dp=60*up,fp=60*dp,pp=146097*24*fp;function mp(e,t){return(e%t+t)%t}function hp(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-pp:new Date(e,t,n).valueOf()}function gp(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-pp:Date.UTC(e,t,n)}function _p(e){var t,n;if(e=rl(e),e===void 0||e===`millisecond`||!this.isValid())return this;switch(n=this._isUTC?gp:hp,e){case`year`:t=n(this.year(),0,1);break;case`quarter`:t=n(this.year(),this.month()-this.month()%3,1);break;case`month`:t=n(this.year(),this.month(),1);break;case`week`:t=n(this.year(),this.month(),this.date()-this.weekday());break;case`isoWeek`:t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case`day`:case`date`:t=n(this.year(),this.month(),this.date());break;case`hour`:t=this._d.valueOf(),t-=mp(t+(this._isUTC?0:this.utcOffset()*dp),fp);break;case`minute`:t=this._d.valueOf(),t-=mp(t,dp);break;case`second`:t=this._d.valueOf(),t-=mp(t,up);break}return this._d.setTime(t),rc.updateOffset(this,!0),this}function vp(e){var t,n;if(e=rl(e),e===void 0||e===`millisecond`||!this.isValid())return this;switch(n=this._isUTC?gp:hp,e){case`year`:t=n(this.year()+1,0,1)-1;break;case`quarter`:t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case`month`:t=n(this.year(),this.month()+1,1)-1;break;case`week`:t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case`isoWeek`:t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case`day`:case`date`:t=n(this.year(),this.month(),this.date()+1)-1;break;case`hour`:t=this._d.valueOf(),t+=fp-mp(t+(this._isUTC?0:this.utcOffset()*dp),fp)-1;break;case`minute`:t=this._d.valueOf(),t+=dp-mp(t,dp)-1;break;case`second`:t=this._d.valueOf(),t+=up-mp(t,up)-1;break}return this._d.setTime(t),rc.updateOffset(this,!0),this}function yp(){return this._d.valueOf()-(this._offset||0)*6e4}function bp(){return Math.floor(this.valueOf()/1e3)}function xp(){return new Date(this.valueOf())}function Sp(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Cp(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function wp(){return this.isValid()?this.toISOString():null}function Tp(){return vc(this)}function Ep(){return pc({},gc(this))}function Dp(){return gc(this).overflow}function Op(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Vc(`N`,0,0,`eraAbbr`),Vc(`NN`,0,0,`eraAbbr`),Vc(`NNN`,0,0,`eraAbbr`),Vc(`NNNN`,0,0,`eraName`),Vc(`NNNNN`,0,0,`eraNarrow`),Vc(`y`,[`y`,1],`yo`,`eraYear`),Vc(`y`,[`yy`,2],0,`eraYear`),Vc(`y`,[`yyy`,3],0,`eraYear`),Vc(`y`,[`yyyy`,4],0,`eraYear`),Dl(`N`,zp),Dl(`NN`,zp),Dl(`NNN`,zp),Dl(`NNNN`,Bp),Dl(`NNNNN`,Vp),Pl([`N`,`NN`,`NNN`,`NNNN`,`NNNNN`],function(e,t,n,r){var i=n._locale.erasParse(e,r,n._strict);i?gc(n).era=i:gc(n).invalidEra=e}),Dl(`y`,vl),Dl(`yy`,vl),Dl(`yyy`,vl),Dl(`yyyy`,vl),Dl(`yo`,Hp),Pl([`y`,`yy`,`yyy`,`yyyy`],Rl),Pl([`yo`],function(e,t,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[Rl]=n._locale.eraYearOrdinalParse(e,i):t[Rl]=parseInt(e,10)});function kp(e,t){var n,r,i,a=this._eras||vd(`en`)._eras;for(n=0,r=a.length;n<r;++n){switch(typeof a[n].since){case`string`:i=rc(a[n].since).startOf(`day`),a[n].since=i.valueOf();break}switch(typeof a[n].until){case`undefined`:a[n].until=1/0;break;case`string`:i=rc(a[n].until).startOf(`day`).valueOf(),a[n].until=i.valueOf();break}}return a}function Ap(e,t,n){var r,i,a=this.eras(),o,s,c;for(e=e.toUpperCase(),r=0,i=a.length;r<i;++r)if(o=a[r].name.toUpperCase(),s=a[r].abbr.toUpperCase(),c=a[r].narrow.toUpperCase(),n)switch(t){case`N`:case`NN`:case`NNN`:if(s===e)return a[r];break;case`NNNN`:if(o===e)return a[r];break;case`NNNNN`:if(c===e)return a[r];break}else if([o,s,c].indexOf(e)>=0)return a[r]}function jp(e,t){var n=e.since<=e.until?1:-1;return t===void 0?rc(e.since).year():rc(e.since).year()+(t-e.offset)*n}function Mp(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(n=this.clone().startOf(`day`).valueOf(),r[e].since<=n&&n<=r[e].until||r[e].until<=n&&n<=r[e].since)return r[e].name;return``}function Np(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(n=this.clone().startOf(`day`).valueOf(),r[e].since<=n&&n<=r[e].until||r[e].until<=n&&n<=r[e].since)return r[e].narrow;return``}function Pp(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(n=this.clone().startOf(`day`).valueOf(),r[e].since<=n&&n<=r[e].until||r[e].until<=n&&n<=r[e].since)return r[e].abbr;return``}function Fp(){var e,t,n,r,i=this.localeData().eras();for(e=0,t=i.length;e<t;++e)if(n=i[e].since<=i[e].until?1:-1,r=this.clone().startOf(`day`).valueOf(),i[e].since<=r&&r<=i[e].until||i[e].until<=r&&r<=i[e].since)return(this.year()-rc(i[e].since).year())*n+i[e].offset;return this.year()}function Ip(e){return sc(this,`_erasNameRegex`)||Up.call(this),e?this._erasNameRegex:this._erasRegex}function Lp(e){return sc(this,`_erasAbbrRegex`)||Up.call(this),e?this._erasAbbrRegex:this._erasRegex}function Rp(e){return sc(this,`_erasNarrowRegex`)||Up.call(this),e?this._erasNarrowRegex:this._erasRegex}function zp(e,t){return t.erasAbbrRegex(e)}function Bp(e,t){return t.erasNameRegex(e)}function Vp(e,t){return t.erasNarrowRegex(e)}function Hp(e,t){return t._eraYearOrdinalRegex||vl}function Up(){var e=[],t=[],n=[],r=[],i,a,o,s,c,l=this.eras();for(i=0,a=l.length;i<a;++i)o=Al(l[i].name),s=Al(l[i].abbr),c=Al(l[i].narrow),t.push(o),e.push(s),n.push(c),r.push(o),r.push(s),r.push(c);this._erasRegex=RegExp(`^(`+r.join(`|`)+`)`,`i`),this._erasNameRegex=RegExp(`^(`+t.join(`|`)+`)`,`i`),this._erasAbbrRegex=RegExp(`^(`+e.join(`|`)+`)`,`i`),this._erasNarrowRegex=RegExp(`^(`+n.join(`|`)+`)`,`i`)}Vc(0,[`gg`,2],0,function(){return this.weekYear()%100}),Vc(0,[`GG`,2],0,function(){return this.isoWeekYear()%100});function Wp(e,t){Vc(0,[e,e.length],0,t)}Wp(`gggg`,`weekYear`),Wp(`ggggg`,`weekYear`),Wp(`GGGG`,`isoWeekYear`),Wp(`GGGGG`,`isoWeekYear`),Dl(`G`,yl),Dl(`g`,yl),Dl(`GG`,fl,cl),Dl(`gg`,fl,cl),Dl(`GGGG`,gl,ul),Dl(`gggg`,gl,ul),Dl(`GGGGG`,_l,dl),Dl(`ggggg`,_l,dl),Fl([`gggg`,`ggggg`,`GGGG`,`GGGGG`],function(e,t,n,r){t[r.substr(0,2)]=Ml(e)}),Fl([`gg`,`GG`],function(e,t,n,r){t[r]=rc.parseTwoDigitYear(e)});function Gp(e){return Zp.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Kp(e){return Zp.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function qp(){return wu(this.year(),1,4)}function Jp(){return wu(this.isoWeekYear(),1,4)}function Yp(){var e=this.localeData()._week;return wu(this.year(),e.dow,e.doy)}function Xp(){var e=this.localeData()._week;return wu(this.weekYear(),e.dow,e.doy)}function Zp(e,t,n,r,i){var a;return e==null?Cu(this,r,i).year:(a=wu(e,r,i),t>a&&(t=a),Qp.call(this,e,t,n,r,i))}function Qp(e,t,n,r,i){var a=Su(e,t,n,r,i),o=bu(a.year,0,a.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}Vc(`Q`,0,`Qo`,`quarter`),Dl(`Q`,sl),Pl(`Q`,function(e,t){t[zl]=(Ml(e)-1)*3});function $p(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Vc(`D`,[`DD`,2],`Do`,`date`),Dl(`D`,fl,wl),Dl(`DD`,fl,cl),Dl(`Do`,function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),Pl([`D`,`DD`],Bl),Pl(`Do`,function(e,t){t[Bl]=Ml(e.match(fl)[0])});var em=Xl(`Date`,!0);Vc(`DDD`,[`DDDD`,3],`DDDo`,`dayOfYear`),Dl(`DDD`,hl),Dl(`DDDD`,ll),Pl([`DDD`,`DDDD`],function(e,t,n){n._dayOfYear=Ml(e)});function tm(e){var t=Math.round((this.clone().startOf(`day`)-this.clone().startOf(`year`))/864e5)+1;return e==null?t:this.add(e-t,`d`)}Vc(`m`,[`mm`,2],0,`minute`),Dl(`m`,fl,Tl),Dl(`mm`,fl,cl),Pl([`m`,`mm`],Hl);var nm=Xl(`Minutes`,!1);Vc(`s`,[`ss`,2],0,`second`),Dl(`s`,fl,Tl),Dl(`ss`,fl,cl),Pl([`s`,`ss`],Ul);var rm=Xl(`Seconds`,!1);Vc(`S`,0,0,function(){return~~(this.millisecond()/100)}),Vc(0,[`SS`,2],0,function(){return~~(this.millisecond()/10)}),Vc(0,[`SSS`,3],0,`millisecond`),Vc(0,[`SSSS`,4],0,function(){return this.millisecond()*10}),Vc(0,[`SSSSS`,5],0,function(){return this.millisecond()*100}),Vc(0,[`SSSSSS`,6],0,function(){return this.millisecond()*1e3}),Vc(0,[`SSSSSSS`,7],0,function(){return this.millisecond()*1e4}),Vc(0,[`SSSSSSSS`,8],0,function(){return this.millisecond()*1e5}),Vc(0,[`SSSSSSSSS`,9],0,function(){return this.millisecond()*1e6}),Dl(`S`,hl,sl),Dl(`SS`,hl,cl),Dl(`SSS`,hl,ll);var im,am;for(im=`SSSS`;im.length<=9;im+=`S`)Dl(im,vl);function om(e,t){t[Wl]=Ml((`0.`+e)*1e3)}for(im=`S`;im.length<=9;im+=`S`)Pl(im,om);am=Xl(`Milliseconds`,!1),Vc(`z`,0,0,`zoneAbbr`),Vc(`zz`,0,0,`zoneName`);function sm(){return this._isUTC?`UTC`:``}function cm(){return this._isUTC?`Coordinated Universal Time`:``}var Y=Cc.prototype;Y.add=Ff,Y.calendar=Uf,Y.clone=Wf,Y.diff=Zf,Y.endOf=vp,Y.format=np,Y.from=rp,Y.fromNow=ip,Y.to=ap,Y.toNow=op,Y.get=$l,Y.invalidAt=Dp,Y.isAfter=Gf,Y.isBefore=Kf,Y.isBetween=qf,Y.isSame=Jf,Y.isSameOrAfter=Yf,Y.isSameOrBefore=Xf,Y.isValid=Tp,Y.lang=cp,Y.locale=sp,Y.localeData=lp,Y.max=Zd,Y.min=Xd,Y.parsingFlags=Ep,Y.set=eu,Y.startOf=_p,Y.subtract=If,Y.toArray=Sp,Y.toObject=Cp,Y.toDate=xp,Y.toISOString=ep,Y.inspect=tp,typeof Symbol<`u`&&Symbol.for!=null&&(Y[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return`Moment<`+this.format()+`>`}),Y.toJSON=wp,Y.toString=$f,Y.unix=bp,Y.valueOf=yp,Y.creationData=Op,Y.eraName=Mp,Y.eraNarrow=Np,Y.eraAbbr=Pp,Y.eraYear=Fp,Y.year=Jl,Y.isLeapYear=Yl,Y.weekYear=Gp,Y.isoWeekYear=Kp,Y.quarter=Y.quarters=$p,Y.month=mu,Y.daysInMonth=hu,Y.week=Y.weeks=ku,Y.isoWeek=Y.isoWeeks=Au,Y.weeksInYear=Yp,Y.weeksInWeekYear=Xp,Y.isoWeeksInYear=qp,Y.isoWeeksInISOWeekYear=Jp,Y.date=em,Y.day=Y.days=Gu,Y.weekday=Ku,Y.isoWeekday=qu,Y.dayOfYear=tm,Y.hour=Y.hours=id,Y.minute=Y.minutes=nm,Y.second=Y.seconds=rm,Y.millisecond=Y.milliseconds=am,Y.utcOffset=gf,Y.utc=vf,Y.local=yf,Y.parseZone=bf,Y.hasAlignedHourOffset=xf,Y.isDST=Sf,Y.isLocal=wf,Y.isUtcOffset=Tf,Y.isUtc=Ef,Y.isUTC=Ef,Y.zoneAbbr=sm,Y.zoneName=cm,Y.dates=Ec(`dates accessor is deprecated. Use date instead.`,em),Y.months=Ec(`months accessor is deprecated. Use month instead`,mu),Y.years=Ec(`years accessor is deprecated. Use year instead`,Jl),Y.zone=Ec(`moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/`,_f),Y.isDSTShifted=Ec(`isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information`,Cf);function lm(e){return Yd(e*1e3)}function um(){return Yd.apply(null,arguments).parseZone()}function dm(e){return e}var fm=Mc.prototype;fm.calendar=Fc,fm.longDateFormat=qc,fm.invalidDate=Yc,fm.ordinal=Qc,fm.preparse=dm,fm.postformat=dm,fm.relativeTime=el,fm.pastFuture=tl,fm.set=Ac,fm.eras=kp,fm.erasParse=Ap,fm.erasConvertYear=jp,fm.erasAbbrRegex=Lp,fm.erasNameRegex=Ip,fm.erasNarrowRegex=Rp,fm.months=lu,fm.monthsShort=uu,fm.monthsParse=fu,fm.monthsRegex=_u,fm.monthsShortRegex=gu,fm.week=Tu,fm.firstDayOfYear=Ou,fm.firstDayOfWeek=Du,fm.weekdays=Bu,fm.weekdaysMin=Hu,fm.weekdaysShort=Vu,fm.weekdaysParse=Wu,fm.weekdaysRegex=Ju,fm.weekdaysShortRegex=Yu,fm.weekdaysMinRegex=Xu,fm.isPM=nd,fm.meridiem=ad;function pm(e,t,n,r){var i=vd(),a=mc().set(r,t);return i[n](a,e)}function mm(e,t,n){if(uc(e)&&(t=e,e=void 0),e||=``,t!=null)return pm(e,t,n,`month`);var r,i=[];for(r=0;r<12;r++)i[r]=pm(e,r,n,`month`);return i}function hm(e,t,n,r){typeof e==`boolean`?(uc(t)&&(n=t,t=void 0),t||=``):(t=e,n=t,e=!1,uc(t)&&(n=t,t=void 0),t||=``);var i=vd(),a=e?i._week.dow:0,o,s=[];if(n!=null)return pm(t,(n+a)%7,r,`day`);for(o=0;o<7;o++)s[o]=pm(t,(o+a)%7,r,`day`);return s}function gm(e,t){return mm(e,t,`months`)}function _m(e,t){return mm(e,t,`monthsShort`)}function vm(e,t,n){return hm(e,t,n,`weekdays`)}function ym(e,t,n){return hm(e,t,n,`weekdaysShort`)}function bm(e,t,n){return hm(e,t,n,`weekdaysMin`)}hd(`en`,{eras:[{since:`0001-01-01`,until:1/0,offset:1,name:`Anno Domini`,narrow:`AD`,abbr:`AD`},{since:`0000-12-31`,until:-1/0,offset:1,name:`Before Christ`,narrow:`BC`,abbr:`BC`}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(Ml(e%100/10)===1?`th`:t===1?`st`:t===2?`nd`:t===3?`rd`:`th`)}}),rc.lang=Ec(`moment.lang is deprecated. Use moment.locale instead.`,hd),rc.langData=Ec(`moment.langData is deprecated. Use moment.localeData instead.`,vd);var xm=Math.abs;function Sm(){var e=this._data;return this._milliseconds=xm(this._milliseconds),this._days=xm(this._days),this._months=xm(this._months),e.milliseconds=xm(e.milliseconds),e.seconds=xm(e.seconds),e.minutes=xm(e.minutes),e.hours=xm(e.hours),e.months=xm(e.months),e.years=xm(e.years),this}function Cm(e,t,n,r){var i=kf(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function wm(e,t){return Cm(this,e,t,1)}function Tm(e,t){return Cm(this,e,t,-1)}function Em(e){return e<0?Math.floor(e):Math.ceil(e)}function Dm(){var e=this._milliseconds,t=this._days,n=this._months,r=this._data,i,a,o,s,c;return e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0||(e+=Em(km(n)+t)*864e5,t=0,n=0),r.milliseconds=e%1e3,i=jl(e/1e3),r.seconds=i%60,a=jl(i/60),r.minutes=a%60,o=jl(a/60),r.hours=o%24,t+=jl(o/24),c=jl(Om(t)),n+=c,t-=Em(km(c)),s=jl(n/12),n%=12,r.days=t,r.months=n,r.years=s,this}function Om(e){return e*4800/146097}function km(e){return e*146097/4800}function Am(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if(e=rl(e),e===`month`||e===`quarter`||e===`year`)switch(t=this._days+r/864e5,n=this._months+Om(t),e){case`month`:return n;case`quarter`:return n/3;case`year`:return n/12}else switch(t=this._days+Math.round(km(this._months)),e){case`week`:return t/7+r/6048e5;case`day`:return t+r/864e5;case`hour`:return t*24+r/36e5;case`minute`:return t*1440+r/6e4;case`second`:return t*86400+r/1e3;case`millisecond`:return Math.floor(t*864e5)+r;default:throw Error(`Unknown unit `+e)}}function jm(e){return function(){return this.as(e)}}var Mm=jm(`ms`),Nm=jm(`s`),Pm=jm(`m`),Fm=jm(`h`),Im=jm(`d`),Lm=jm(`w`),Rm=jm(`M`),zm=jm(`Q`),Bm=jm(`y`),Vm=Mm;function Hm(){return kf(this)}function Um(e){return e=rl(e),this.isValid()?this[e+`s`]():NaN}function Wm(e){return function(){return this.isValid()?this._data[e]:NaN}}var Gm=Wm(`milliseconds`),Km=Wm(`seconds`),qm=Wm(`minutes`),Jm=Wm(`hours`),Ym=Wm(`days`),Xm=Wm(`months`),Zm=Wm(`years`);function Qm(){return jl(this.days()/7)}var $m=Math.round,eh={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function th(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function nh(e,t,n,r){var i=kf(e).abs(),a=$m(i.as(`s`)),o=$m(i.as(`m`)),s=$m(i.as(`h`)),c=$m(i.as(`d`)),l=$m(i.as(`M`)),u=$m(i.as(`w`)),d=$m(i.as(`y`)),f=a<=n.ss&&[`s`,a]||a<n.s&&[`ss`,a]||o<=1&&[`m`]||o<n.m&&[`mm`,o]||s<=1&&[`h`]||s<n.h&&[`hh`,s]||c<=1&&[`d`]||c<n.d&&[`dd`,c];return n.w!=null&&(f=f||u<=1&&[`w`]||u<n.w&&[`ww`,u]),f=f||l<=1&&[`M`]||l<n.M&&[`MM`,l]||d<=1&&[`y`]||[`yy`,d],f[2]=t,f[3]=+e>0,f[4]=r,th.apply(null,f)}function rh(e){return e===void 0?$m:typeof e==`function`?($m=e,!0):!1}function ih(e,t){return eh[e]===void 0?!1:t===void 0?eh[e]:(eh[e]=t,e===`s`&&(eh.ss=t-1),!0)}function ah(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,r=eh,i,a;return typeof e==`object`&&(t=e,e=!1),typeof e==`boolean`&&(n=e),typeof t==`object`&&(r=Object.assign({},eh,t),t.s!=null&&t.ss==null&&(r.ss=t.s-1)),i=this.localeData(),a=nh(this,!n,r,i),n&&(a=i.pastFuture(+this,a)),i.postformat(a)}var oh=Math.abs;function sh(e){return(e>0)-(e<0)||+e}function ch(){if(!this.isValid())return this.localeData().invalidDate();var e=oh(this._milliseconds)/1e3,t=oh(this._days),n=oh(this._months),r,i,a,o,s=this.asSeconds(),c,l,u,d;return s?(r=jl(e/60),i=jl(r/60),e%=60,r%=60,a=jl(n/12),n%=12,o=e?e.toFixed(3).replace(/\.?0+$/,``):``,c=s<0?`-`:``,l=sh(this._months)===sh(s)?``:`-`,u=sh(this._days)===sh(s)?``:`-`,d=sh(this._milliseconds)===sh(s)?``:`-`,c+`P`+(a?l+a+`Y`:``)+(n?l+n+`M`:``)+(t?u+t+`D`:``)+(i||r||e?`T`:``)+(i?d+i+`H`:``)+(r?d+r+`M`:``)+(e?d+o+`S`:``)):`P0D`}var lh=sf.prototype;lh.isValid=af,lh.abs=Sm,lh.add=wm,lh.subtract=Tm,lh.as=Am,lh.asMilliseconds=Mm,lh.asSeconds=Nm,lh.asMinutes=Pm,lh.asHours=Fm,lh.asDays=Im,lh.asWeeks=Lm,lh.asMonths=Rm,lh.asQuarters=zm,lh.asYears=Bm,lh.valueOf=Vm,lh._bubble=Dm,lh.clone=Hm,lh.get=Um,lh.milliseconds=Gm,lh.seconds=Km,lh.minutes=qm,lh.hours=Jm,lh.days=Ym,lh.weeks=Qm,lh.months=Xm,lh.years=Zm,lh.humanize=ah,lh.toISOString=ch,lh.toString=ch,lh.toJSON=ch,lh.locale=sp,lh.localeData=lp,lh.toIsoString=Ec(`toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)`,ch),lh.lang=cp,Vc(`X`,0,0,`unix`),Vc(`x`,0,0,`valueOf`),Dl(`x`,yl),Dl(`X`,Sl),Pl(`X`,function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),Pl(`x`,function(e,t,n){n._d=new Date(Ml(e))}),rc.version=`2.30.1`,ic(Yd),rc.fn=Y,rc.min=$d,rc.max=ef,rc.now=tf,rc.utc=mc,rc.unix=lm,rc.months=gm,rc.isDate=dc,rc.locale=hd,rc.invalid=yc,rc.duration=kf,rc.isMoment=wc,rc.weekdays=vm,rc.parseZone=um,rc.localeData=vd,rc.isDuration=cf,rc.monthsShort=_m,rc.weekdaysMin=bm,rc.defineLocale=gd,rc.updateLocale=_d,rc.locales=yd,rc.weekdaysShort=ym,rc.normalizeUnits=rl,rc.relativeTimeRounding=rh,rc.relativeTimeThreshold=ih,rc.calendarFormat=Hf,rc.prototype=Y,rc.HTML5_FMT={DATETIME_LOCAL:`YYYY-MM-DDTHH:mm`,DATETIME_LOCAL_SECONDS:`YYYY-MM-DDTHH:mm:ss`,DATETIME_LOCAL_MS:`YYYY-MM-DDTHH:mm:ss.SSS`,DATE:`YYYY-MM-DD`,TIME:`HH:mm`,TIME_SECONDS:`HH:mm:ss`,TIME_MS:`HH:mm:ss.SSS`,WEEK:`GGGG-[W]WW`,MONTH:`YYYY-MM`};var uh=class e{static dateFormat;static stringify(e){return e.format(this.dateFormat)}static parse(t){return rc(t,e.dateFormat)}static getDefaultDate(){return rc(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}},dh=class extends $s{filterValue(e){return hn(e)}getFallbackDefaultValue(){return uh.stringify(uh.getDefaultDate())}getSvelteComponent(){return tc}rawMapValue(e){return e}rawReverseMapValue(e){return e}},fh=q(`<div class="mb-icon-wrapper"></div>`);function ph(e,t){Yr(t,!0);let n=Ws(t,`iconName`,3,``),r=ea(void 0);Ma(()=>K(r)?t.mb.internal.setIcon(K(r),n()):void 0);var i=qo(),a=W(i),o=e=>{var t=fh();Us(t,e=>na(r,e),()=>K(r)),J(e,t)};ts(a,e=>{n().length>0&&e(o)}),J(e,i),Xr()}var mh=q(`<div class="mb-date-picker-input" role="button" tabindex="0"><span class="mb-date-picker-text"> </span> <!></div>`);function hh(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(){t.showDatePicker()}function a(e){e.key===` `&&t.showDatePicker()}var o={setValue:r},s=mh(),c=U(s),l=U(c,!0);return H(c),ph(G(c,2),{get mb(){return t.mb},iconName:`calendar`}),H(s),Ra(e=>Jo(l,e),[()=>K(n)?K(n).format(t.dateFormat):`none`]),Io(`click`,s,i),Io(`keydown`,s,a),J(e,s),Xr(o)}Lo([`click`,`keydown`]);var gh=class extends $s{options;constructor(e){super(e),this.options=this.mountable.getArguments(V.OPTION)}filterValue(e){if(e===null)return null;if(e===void 0||typeof e!=`string`)return;let t=uh.parse(e);if(t.isValid())return uh.stringify(t)}getFallbackDefaultValue(){return uh.getDefaultDate()}getSvelteComponent(){return hh}rawMapValue(e){return e===null?null:(console.log(`value`,e,uh.stringify(e),uh.dateFormat),uh.stringify(e))}rawReverseMapValue(e){if(e===null)return null;let t=uh.parse(e);if(t.isValid())return t}getMountArgs(){return{dateFormat:this.mountable.mb.getSettings().preferredDateFormat,showDatePicker:()=>{this.mountable.mb.internal.openDatePickerModal(this.getInternalValue(),e=>this.setInternalValue(e))}}}},_h=q(`<input type="datetime-local"/>`);function vh(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}var i={setValue:r},a=_h();return Ms(a),Io(`input`,a,()=>t.onValueChange(Gr(K(n)))),zs(a,()=>K(n),e=>na(n,e)),J(e,a),Xr(i)}Lo([`input`]);var yh=class extends $s{filterValue(e){return hn(e)}getFallbackDefaultValue(){return uh.stringify(uh.getDefaultDate())}getSvelteComponent(){return vh}rawMapValue(e){return e}rawReverseMapValue(e){return e}},bh=q(`<div></div>`);function xh(e,t){Yr(t,!0);let n,r;Ks(()=>{r?.()});async function i(e){r?.(),Dt.empty(n),r=await t.mb.internal.renderMarkdown(e,n,t.filePath)}Ma(()=>void i(t.value));var a=bh();Us(a,e=>n=e,()=>n),J(e,a),Xr()}var Sh=q(`<textarea></textarea>`),Ch=q(`<div class="mb-editor-input card" role="button" tabindex="0"><!></div>`);function wh(e,t){Yr(t,!0);let n=ea(sa(t.value)),r=ea(!1);function i(e){na(n,e,!0)}function a(){na(r,!1)}function o(){na(r,!0)}function s(e){e.key===` `&&o()}var c={setValue:i},l=Ch(),u=U(l),d=e=>{var r=Sh();Sa(r),Io(`focusout`,r,()=>a()),Io(`input`,r,()=>t.onValueChange(Gr(K(n)))),zs(r,()=>K(n),e=>na(n,e)),J(e,r)},f=e=>{xh(e,{get value(){return K(n)},get mb(){return t.mb},get filePath(){return t.filePath}})};return ts(u,e=>{K(r)?e(d):e(f,-1)}),H(l),Io(`click`,l,()=>o()),Fo(`keypress`,l,e=>s(e)),J(e,l),Xr(c)}Lo([`click`,`focusout`,`input`]);var Th=class extends $s{mdUnloadCallback;filterValue(e){return fn(e)?e?.toString():void 0}getFallbackDefaultValue(){return``}getSvelteComponent(){return wh}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,t)=>void this.renderInElement(e,t),filePath:this.mountable.getFilePath()}}async renderInElement(e,t){this.mdUnloadCallback?.(),e.innerHTML=``,this.mdUnloadCallback=await this.mountable.mb.internal.renderMarkdown(t,e,this.mountable.getFilePath())}onUnmount(){super.onUnmount(),this.mdUnloadCallback?.()}},Eh=q(`<button><!></button>`);function Dh(e,t){Yr(t,!0);let n=Ws(t,`variant`,19,()=>Nt.DEFAULT),r=Ws(t,`disabled`,3,!1),i=Ws(t,`tooltip`,3,``),a=Ws(t,`classes`,3,``),o=Ws(t,`onclick`,3,()=>{});var s=Eh();let c;fs(U(s),()=>t.children),H(s),Ra(()=>{c=xs(s,1,`mb-button-inner ${a()??``}`,null,c,{"mod-cta":n()===Nt.PRIMARY,"mod-warning":n()===Nt.DESTRUCTIVE,"mod-plain":n()===Nt.PLAIN,disabled:r()}),Fs(s,`aria-label`,i()),s.disabled=r()}),Io(`click`,s,function(...e){o()?.apply(this,e)}),J(e,s),Xr()}Lo([`click`]);var Oh=q(`<div class="mb-image-card" role="listitem"><img class="mb-image-card-image"/></div>`),kh=q(`<div class="mb-image-card-grid"></div> <div class="mb-list-input"><!></div>`,1);function Ah(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e){K(n).push(e),t.onValueChange(Gr(K(n)))}function a(e){K(n).splice(e,1),t.onValueChange(Gr(K(n)))}function o(e,r){let i=[];r>0&&i.push({name:`Move left`,icon:`arrow-left`,onclick:()=>{let e=K(n)[r-1];K(n)[r-1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),r<K(n).length-1&&i.push({name:`Move right`,icon:`arrow-right`,onclick:()=>{let e=K(n)[r+1];K(n)[r+1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),i.push({name:`Copy image path`,icon:`copy`,onclick:()=>{let e=K(n)[r];navigator.clipboard.writeText(e).then(()=>{t.mb.internal.showNotice(`Image path copied to clipboard`)}).catch(()=>{t.mb.internal.showNotice(`Failed to copy image path to clipboard`)})}}),i.push({name:`Remove`,icon:`x`,warning:!0,onclick:()=>a(r)}),t.mb.internal.createContextMenu(i).showWithEvent(e)}var s={setValue:r,pushValue:i},c=kh(),l=W(c);os(l,21,()=>K(n),ns,(e,n,r)=>{var i=Oh(),a=U(i);H(i),Ra((e,t)=>{Fs(i,`data-value`,e),Fs(a,`src`,t),Fs(a,`alt`,K(n)),Fs(a,`aria-label`,K(n))},[()=>dn(K(n)),()=>t.mb.internal.imagePathToUri(K(n))]),Io(`contextmenu`,i,e=>o(e,r)),J(e,i)}),H(l);var u=G(l,2);return Dh(U(u),{get variant(){return Nt.DEFAULT},onclick:()=>t.showSuggester(),children:(e,t)=>{Ir(),J(e,Ko(`Add new image`))},$$slots:{default:!0}}),H(u),J(e,c),Xr(s)}Lo([`contextmenu`]);var jh=class extends $s{filterValue(e){return pn(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Ah}rawMapValue(e){return e}rawReverseMapValue(e){return e.map(e=>dn(e)).filter(e=>e!==void 0)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.mb.internal.openImageSuggesterModal(this,!1,e=>{e!==void 0&&this.svelteWrapper?.getInstance()?.pushValue(e)})}},Mh=q(`<div class="mb-image-card"><img class="mb-image-card-image"/> <!></div>`),Nh=q(`<div class="mb-image-empty"><!></div>`);function Ph(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e){let n=[];n.push({name:`Edit`,icon:`pencil`,onclick:()=>{t.showSuggester()}}),n.push({name:`Remove`,icon:`x`,warning:!0,onclick:()=>t.clear()}),t.mb.internal.createContextMenu(n).showWithEvent(e)}var a={setValue:r},o=qo(),s=W(o),c=e=>{var r=Mh(),a=U(r);Dh(G(a,2),{get variant(){return Nt.PLAIN},onclick:e=>i(e),classes:`mb-image-card-button`,children:(e,n)=>{ph(e,{iconName:`ellipsis-vertical`,get mb(){return t.mb}})},$$slots:{default:!0}}),H(r),Ra(e=>{Fs(a,`src`,e),Fs(a,`alt`,K(n)),Fs(a,`aria-label`,K(n))},[()=>t.mb.internal.imagePathToUri(K(n))]),Io(`contextmenu`,r,e=>i(e)),J(e,r)},l=e=>{var n=Nh();Dh(U(n),{get variant(){return Nt.PLAIN},onclick:()=>t.showSuggester(),tooltip:`Select image`,children:(e,t)=>{Ir(),J(e,Ko(`No image selected. Click to select.`))},$$slots:{default:!0}}),H(n),J(e,n)};return ts(s,e=>{K(n)?e(c):e(l,-1)}),J(e,o),Xr(a)}Lo([`contextmenu`]);var Fh=class extends $s{filterValue(e){return fn(e)?e:void 0}getFallbackDefaultValue(){}getSvelteComponent(){return Ph}rawMapValue(e){return e}rawReverseMapValue(e){return dn(e)}getMountArgs(){return{showSuggester:()=>this.openModal(),clear:()=>this.setInternalValue(void 0)}}openModal(){this.mountable.mb.internal.openImageSuggesterModal(this,!0,e=>this.setInternalValue(e))}},Ih=q(`<a target="_blank" rel="noopener"> </a>`);function Lh(e,t){Yr(t,!0);let n=Ui(()=>t.mdLink.block?`${t.mdLink.target}#${t.mdLink.block}`:t.mdLink.target),r=Ui(()=>t.mdLink.internal?`internal-link`:`external-link`),i=Ui(()=>t.mdLink.alias?K(n):void 0),a=Ui(()=>t.mdLink.alias?t.mdLink.alias:t.mdLink.block?`${t.mdLink.target} > ${t.mdLink.block}`:t.mdLink.target);var o=Ih(),s=U(o,!0);H(o),Ra(()=>{Fs(o,`data-href`,K(n)),Fs(o,`href`,K(n)),xs(o,1,hs(K(r))),Fs(o,`aria-label`,K(i)),Jo(s,K(a))}),J(e,o),Xr()}var Rh=q(`<!><span>,</span> <span></span>`,1),zh=q(`<!> <!>`,1);function Bh(e,t){Yr(t,!0);let n=Ws(t,`elements`,19,()=>[]);var r=zh(),i=W(r);os(i,17,()=>n().slice(0,n().length-1),ns,(e,n)=>{var r=Rh();fs(W(r),()=>t.children,()=>K(n)),Ir(3),J(e,r)}),fs(G(i,2),()=>t.children,()=>n()[n().length-1]),J(e,r),Xr()}var Vh=q(`<span class="mb-whitespace-pre"> </span>`),Hh=q(`<span> </span>`),Uh=q(`<span><!></span>`),Wh=q(`<span><!></span>`);function Gh(e,t){Yr(t,!0);let n=Ws(t,`value`,3,void 0),r=Ui(()=>yn(n(),!1));var i=qo(),a=W(i),o=e=>{var t=Vh(),n=U(t,!0);H(t),Ra(()=>Jo(n,K(r))),J(e,t)},s=e=>{var t=Uh();Bh(U(t),{get elements(){return K(r)},children:(e,t=Un)=>{var n=qo(),r=W(n),i=e=>{var n=Hh(),r=U(n,!0);H(n),Ra(()=>Jo(r,t())),J(e,n)},a=e=>{Lh(e,{get mdLink(){return t()}})};ts(r,e=>{typeof t()==`string`?e(i):e(a,-1)}),J(e,n)},$$slots:{default:!0}}),H(t),J(e,t)},c=Ui(()=>Array.isArray(K(r))),l=e=>{var t=Wh();Lh(U(t),{get mdLink(){return K(r)}}),H(t),J(e,t)};ts(a,e=>{typeof K(r)==`string`?e(o):K(c)?e(s,1):e(l,-1)}),J(e,i),Xr()}var Kh=q(`<div class="mb-inline-list-item" role="listitem"><!></div>`),qh=q(`<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>`);function Jh(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e){K(n).push(e),t.onValueChange(Gr(K(n)))}function a(e){K(n).splice(e,1),t.onValueChange(Gr(K(n)))}function o(e){e.key===` `&&t.showInput()}function s(e,r){let i=[];r>0&&i.push({name:`Move left`,icon:`arrow-left`,onclick:()=>{let e=K(n)[r-1];K(n)[r-1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),r<K(n).length-1&&i.push({name:`Move right`,icon:`arrow-right`,onclick:()=>{let e=K(n)[r+1];K(n)[r+1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),i.push({name:`Edit`,icon:`pencil`,onclick:()=>{t.mb.internal.openTextPromptModal({title:`Meta Bind List`,subTitle:`Edit the value of a list item.`,value:dn(K(n)[r]),multiline:!1,onSubmit:e=>{K(n)[r]=e,t.onValueChange(Gr(K(n)))},onCancel:()=>{}})}}),i.push({name:`Remove`,icon:`x`,warning:!0,onclick:()=>a(r)}),t.mb.internal.createContextMenu(i).showWithEvent(e)}var c={setValue:r,pushValue:i},l=qh(),u=U(l);os(u,17,()=>K(n),ns,(e,t,n)=>{var r=Kh();Gh(U(r),{get value(){return K(t)}}),H(r),Ra(e=>Fs(r,`data-value`,e),[()=>dn(K(t))]),Io(`contextmenu`,r,e=>s(e,n)),J(e,r)});var d=G(u,2);return ph(G(U(d),2),{get mb(){return t.mb},iconName:`plus`}),H(d),H(l),Io(`click`,d,()=>t.showInput()),Io(`keydown`,d,o),J(e,l),Xr(c)}Lo([`contextmenu`,`click`,`keydown`]);var Yh=class extends $s{filterValue(e){return pn(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Jh}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showInput:()=>this.openModal()}}openModal(){this.mountable.mb.internal.openTextPromptModal({title:`Meta Bind List`,subTitle:`Create a new List Element.`,value:``,multiline:!1,onSubmit:e=>{this.svelteWrapper?.getInstance()?.pushValue(e)},onCancel:()=>{}})}},Xh=q(`<div class="mb-inline-list-item" role="listitem"><!></div>`),Zh=q(`<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>`);function Qh(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e){K(n).push(e),t.onValueChange(Gr(K(n)))}function a(e){K(n).splice(e,1),t.onValueChange(Gr(K(n)))}function o(e){if(!t.allowOther){t.showSuggester();return}t.mb.internal.createContextMenu([{name:`From Options`,onclick:()=>t.showSuggester()},{name:`From Text`,onclick:()=>t.showTextPrompt()}]).showWithEvent(e)}function s(e){e.key===` `&&t.showSuggester()}function c(e,r){let i=[];r>0&&i.push({name:`Move left`,icon:`arrow-left`,onclick:()=>{let e=K(n)[r-1];K(n)[r-1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),r<K(n).length-1&&i.push({name:`Move right`,icon:`arrow-right`,onclick:()=>{let e=K(n)[r+1];K(n)[r+1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),i.push({name:`Remove`,icon:`x`,warning:!0,onclick:()=>a(r)}),t.mb.internal.createContextMenu(i).showWithEvent(e)}var l={setValue:r,pushValue:i},u=Zh(),d=U(u);os(d,17,()=>K(n),ns,(e,t,n)=>{var r=Xh();Gh(U(r),{get value(){return K(t)}}),H(r),Ra(e=>Fs(r,`data-value`,e),[()=>dn(K(t))]),Io(`contextmenu`,r,e=>c(e,n)),J(e,r)});var f=G(d,2);return ph(G(U(f),2),{get mb(){return t.mb},iconName:`plus`}),H(f),H(u),Io(`click`,f,o),Io(`keydown`,f,s),J(e,u),Xr(l)}Lo([`contextmenu`,`click`,`keydown`]);var $h=class extends $s{filterValue(e){return pn(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return Qh}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument(V.ALLOW_OTHER)?.value===!0}}openModal(){this.mountable.mb.internal.openSuggesterModal(this,e=>{this.svelteWrapper?.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.mb.internal.openTextPromptModal({title:`Meta Bind List Suggester`,subTitle:`Create a new List Element.`,value:``,multiline:!1,onSubmit:e=>{this.svelteWrapper?.getInstance()?.pushValue(e)},onCancel:()=>{}})}},eg=q(`<option> </option>`),tg=q(`<select class="dropdown"></select>`);function ng(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(){t.onValueChange(Gr(K(n)))}var a={setValue:r},o=tg();return os(o,21,()=>t.options,ns,(e,t)=>{var n=eg(),r=U(n,!0);H(n);var i={};Ra(()=>{Jo(r,K(t).name),i!==(i=K(t).value)&&(n.value=(n.__value=K(t).value)??``)}),J(e,n)}),H(o),Io(`change`,o,()=>i()),Es(o,()=>K(n),e=>na(n,e)),J(e,o),Xr(a)}Lo([`change`]);var rg=class extends $s{options;constructor(e){super(e),this.options=this.mountable.getArguments(V.OPTION)}filterValue(e){return gn(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return ng}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}},ig=q(`<div class="mb-list-item" role="listitem"><!></div>`),ag=q(`<span class="mb-list-empty">Empty</span>`),og=q(`<textarea tabindex="0"></textarea>`),sg=q(`<input type="text" tabindex="0"/>`),cg=q(`<span> </span>`),lg=q(`<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!> <!></div>`,1);function ug(e,t){Yr(t,!0);let n=ea(sa(t.value)),r=ea(``);function i(e){na(n,e,!0)}function a(){K(n).push(K(r)),t.onValueChange(Gr(K(n))),na(r,``)}function o(e){K(n).splice(e,1),t.onValueChange(Gr(K(n)))}function s(e,t){let n=t.toString();return`${e.toString().padStart(n.length,`0`)}/${n}`}function c(e,r){let i=[];r>0&&i.push({name:`Move up`,icon:`arrow-up`,onclick:()=>{let e=K(n)[r-1];K(n)[r-1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),r<K(n).length-1&&i.push({name:`Move down`,icon:`arrow-down`,onclick:()=>{let e=K(n)[r+1];K(n)[r+1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),i.push({name:`Edit`,icon:`pencil`,onclick:()=>{t.mb.internal.openTextPromptModal({title:`Meta Bind List`,subTitle:`Edit the value of a list item.`,value:dn(K(n)[r]),multiline:t.multiLine,onSubmit:e=>{K(n)[r]=e,t.onValueChange(Gr(K(n)))},onCancel:()=>{}})}}),i.push({name:`Remove`,icon:`x`,warning:!0,onclick:()=>o(r)}),t.mb.internal.createContextMenu(i).showWithEvent(e)}var l={setValue:i},u=lg(),d=W(u);os(d,21,()=>K(n),ns,(e,t,n)=>{var r=ig();Gh(U(r),{get value(){return K(t)}}),H(r),Ra(e=>Fs(r,`data-value`,e),[()=>dn(K(t))]),Io(`contextmenu`,r,e=>c(e,n)),J(e,r)},e=>{J(e,ag())}),H(d);var f=G(d,2),p=U(f),m=e=>{var n=og();Sa(n),Ra(()=>{Fs(n,`placeholder`,t.placeholder),Fs(n,`maxlength`,t.limit)}),zs(n,()=>K(r),e=>na(r,e)),J(e,n)},h=e=>{var n=sg();Ms(n),Ra(()=>{Fs(n,`placeholder`,t.placeholder),Fs(n,`maxlength`,t.limit)}),Io(`keyup`,n,e=>{e.key===`Enter`&&K(r).length>0&&a()}),zs(n,()=>K(r),e=>na(r,e)),J(e,n)};ts(p,e=>{t.multiLine?e(m):e(h,-1)});var g=G(p,2),_=e=>{var r=cg(),i=U(r,!0);H(r),Ra(e=>{xs(r,1,`mb-content-limit-indicator ${K(n).length>t.limit?`mb-content-limit-indicator-overflow`:``}`),Jo(i,e)},[()=>s(K(n).length,t.limit)]),J(e,r)};ts(g,e=>{t.limit!==void 0&&e(_)});var v=G(g,2);{let e=Ui(()=>!K(r));Dh(v,{onclick:()=>a(),get disabled(){return K(e)},children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`plus`})},$$slots:{default:!0}})}return H(f),J(e,u),Xr(l)}Lo([`contextmenu`,`keyup`]);var dg=class extends $s{filterValue(e){return pn(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return ug}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument(V.PLACEHOLDER)?.value??`New Entry...`,limit:this.mountable.getArgument(V.LIMIT)?.value,multiLine:this.mountable.getArgument(V.MULTI_LINE)?.value===!0}}},fg=q(`<div class="mb-list-item" role="listitem"><!></div>`),pg=q(`<span class="mb-list-empty">Empty</span>`),mg=q(`<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!></div>`,1);function hg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e){K(n).push(e),t.onValueChange(Gr(K(n)))}function a(e){K(n).splice(e,1),t.onValueChange(Gr(K(n)))}function o(e,r){let i=[];r>0&&i.push({name:`Move up`,icon:`arrow-up`,onclick:()=>{let e=K(n)[r-1];K(n)[r-1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),r<K(n).length-1&&i.push({name:`Move down`,icon:`arrow-down`,onclick:()=>{let e=K(n)[r+1];K(n)[r+1]=K(n)[r],K(n)[r]=e,t.onValueChange(Gr(K(n)))}}),i.push({name:`Remove`,icon:`x`,warning:!0,onclick:()=>a(r)}),t.mb.internal.createContextMenu(i).showWithEvent(e)}var s={setValue:r,pushValue:i},c=mg(),l=W(c);os(l,21,()=>K(n),ns,(e,t,n)=>{var r=fg();Gh(U(r),{get value(){return K(t)}}),H(r),Ra(e=>Fs(r,`data-value`,e),[()=>dn(K(t))]),Io(`contextmenu`,r,e=>o(e,n)),J(e,r)},e=>{J(e,pg())}),H(l);var u=G(l,2),d=U(u);Dh(d,{get variant(){return Nt.DEFAULT},onclick:()=>t.showSuggester(),children:(e,t)=>{Ir(),J(e,Ko(`Add new item`))},$$slots:{default:!0}});var f=G(d,2),p=e=>{Dh(e,{get variant(){return Nt.DEFAULT},onclick:()=>t.showTextPrompt(),children:(e,t)=>{Ir(),J(e,Ko(`Add other item`))},$$slots:{default:!0}})};return ts(f,e=>{t.allowOther&&e(p)}),H(u),J(e,c),Xr(s)}Lo([`contextmenu`]);var gg=class extends $s{filterValue(e){return pn(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return hg}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument(V.ALLOW_OTHER)?.value===!0}}openModal(){this.mountable.mb.internal.openSuggesterModal(this,e=>{this.svelteWrapper?.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.mb.internal.openTextPromptModal({title:`Meta Bind List Suggester`,subTitle:`Create a new List Element.`,value:``,multiline:!1,onSubmit:e=>{this.svelteWrapper?.getInstance()?.pushValue(e)},onCancel:()=>{}})}},_g=q(`<div role="button" tabindex="0"><input type="checkbox"/> <!></div>`);function vg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e){K(n).includes(e)?na(n,K(n).filter(t=>t!==e),!0):K(n).push(e),t.onValueChange(Gr(K(n)))}function a(e,t){e.key===` `&&i(t)}var o={setValue:r},s=qo();return os(W(s),17,()=>t.options,ns,(e,t)=>{var r=_g();let o;var s=U(r);Ms(s),Gh(G(s,2),{get value(){return K(t).name}}),H(r),Ra((e,t,n)=>{o=xs(r,1,`mb-select-input-element mb-mod-multi`,null,o,e),Fs(r,`data-value`,t),Ps(s,n)},[()=>({"is-selected":K(n).includes(K(t).value)}),()=>dn(K(t).value),()=>K(n).includes(K(t).value)]),Io(`click`,r,e=>{e.target instanceof HTMLInputElement||i(K(t).value)}),Fo(`keypress`,r,e=>a(e,K(t).value)),Io(`input`,s,()=>i(K(t).value)),J(e,r)}),J(e,s),Xr(o)}Lo([`click`,`input`]);var yg=class extends $s{options;constructor(e){super(e),this.options=this.mountable.getArguments(V.OPTION)}filterValue(e){return pn(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return vg}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}},bg=q(`<input type="number" tabindex="0"/>`);function xg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}var i={setValue:r},a=bg();return Ms(a),Ra(()=>Fs(a,`placeholder`,t.placeholder)),Io(`input`,a,()=>t.onValueChange(Gr(K(n)))),zs(a,()=>K(n),e=>na(n,e)),J(e,a),Xr(i)}Lo([`input`]);var Sg=class extends $s{filterValue(e){return mn(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return xg}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument(V.PLACEHOLDER)?.value??`Number`}}},Cg=q(`<span class="mb-progress-bar-value"> </span> <span class="mb-progress-bar-label-left"> </span> <span class="mb-progress-bar-label-right"> </span>`,1),wg=q(`<div class="mb-progress-bar-input" tabindex="0" role="button"><div class="mb-progress-bar-progress" role="slider" tabindex="0"></div> <!></div>`);function Tg(e,t){Yr(t,!0);let n=ea(sa(t.value)),r=!1,i,a=0,o;function s(e){na(n,e,!0)}function c(e){na(n,e,!0),t.onValueChange(e)}function l(e){return e=ht(e,t.minValue,t.maxValue),_t(e,t.minValue,t.maxValue,0,100)}function u(){r=!0}function d(){r=!1}function f(e){u(),p(e)}function p(e){r&&(e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),m(e instanceof TouchEvent?e.touches[0].clientX:e.clientX))}function m(e){let n=i.getBoundingClientRect();e=ht(e,n.left,n.right);let r=_t(e,n.left,n.right,t.minValue,t.maxValue);r=h(r,t.stepSize),c(r)}function h(e,t){return Number.parseFloat((Math.round(e/t)*t).toFixed(10))}function g(e){a<50&&(a+=1);let r=Math.ceil(a/5);(e.key===`ArrowUp`||e.key===`ArrowRight`)&&c(ht(K(n)+r,t.minValue,t.maxValue)),(e.key===`ArrowDown`||e.key===`ArrowLeft`)&&c(ht(K(n)-r,t.minValue,t.maxValue)),window.clearTimeout(o),o=window.setTimeout(()=>a=1,100)}var _={setValue:s},v=wg();Fo(`touchmove`,ua,p,void 0,!1),Fo(`touchcancel`,ua,d),Fo(`touchend`,ua,d),Fo(`mousemove`,ua,p),Fo(`mouseup`,ua,d);var y=U(v),b=G(y,2),x=e=>{var r=Cg(),i=W(r),a=U(i,!0);H(i);var o=G(i,2),s=U(o,!0);H(o);var c=G(o,2),l=U(c,!0);H(c),Ra(()=>{Jo(a,K(n)),Jo(s,t.minValue),Jo(l,t.maxValue)}),J(e,r)};return ts(b,e=>{t.addLabels&&e(x)}),H(v),Us(v,e=>i=e,()=>i),Ra((e,r)=>{Fs(v,`aria-label`,e),Cs(y,r),Fs(y,`aria-valuemin`,t.minValue),Fs(y,`aria-valuemax`,t.maxValue),Fs(y,`aria-valuenow`,K(n))},[()=>K(n).toString(),()=>`width: ${l(K(n))}%`]),Io(`keydown`,v,g),Io(`mousedown`,v,f),Io(`touchstart`,v,f,void 0,!0),Fo(`dragstart`,y,()=>r=!0),J(e,v),Xr(_)}Lo([`keydown`,`mousedown`,`touchstart`]);var Eg=class extends $s{minValue;maxValue;stepSize;constructor(e){if(super(e),this.minValue=this.mountable.getArgument(V.MIN_VALUE)?.value??0,this.maxValue=this.mountable.getArgument(V.MAX_VALUE)?.value??100,this.stepSize=this.mountable.getArgument(V.STEP_SIZE)?.value??1,this.minValue>=this.maxValue)throw new z({errorLevel:P.ERROR,effect:`can not create progress bar input field`,cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return gt(mn(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return Tg}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:(this.mountable.getArgument(V.ADD_LABELS)?.value??!0)===!0}}},Dg=q(`<div role="button" tabindex="0"><input type="checkbox"/> <!></div>`);function Og(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e){K(n)===e?na(n,null):na(n,e,!0),t.onValueChange(Gr(K(n)))}function a(e,t){e.key===` `&&i(t)}var o={setValue:r},s=qo();return os(W(s),17,()=>t.options,ns,(e,t)=>{var r=Dg();let o;var s=U(r);Ms(s),Gh(G(s,2),{get value(){return K(t).name}}),H(r),Ra(e=>{o=xs(r,1,`mb-select-input-element`,null,o,{"is-selected":K(t).value===K(n)}),Fs(r,`data-value`,e),Ps(s,K(t).value===K(n))},[()=>dn(K(t).value)]),Io(`click`,r,e=>{e.target instanceof HTMLInputElement||i(K(t).value)}),Fo(`keypress`,r,e=>a(e,K(t).value)),Io(`input`,s,()=>i(K(t).value)),J(e,r)}),J(e,s),Xr(o)}Lo([`click`,`input`]);var kg=class extends $s{options;constructor(e){super(e),this.options=this.mountable.getArguments(V.OPTION)}filterValue(e){return gn(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return Og}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}},Ag=q(`<span class="mb-slider-input-label"> </span>`),jg=q(`<span class="mb-slider-input-label"> </span>`),Mg=q(`<!> <input class="mb-slider-input slider" type="range" tabindex="0"/> <!>`,1);function Ng(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}var i={setValue:r},a=Mg(),o=W(a),s=e=>{var n=Ag(),r=U(n,!0);H(n),Ra(()=>Jo(r,t.minValue)),J(e,n)};ts(o,e=>{t.addLabels&&e(s)});var c=G(o,2);Ms(c);var l=G(c,2),u=e=>{var n=jg(),r=U(n,!0);H(n),Ra(()=>Jo(r,t.maxValue)),J(e,n)};return ts(l,e=>{t.addLabels&&e(u)}),Ra(e=>{Fs(c,`aria-label`,e),Fs(c,`min`,t.minValue),Fs(c,`max`,t.maxValue),Fs(c,`step`,t.stepSize)},[()=>K(n).toString()]),Io(`input`,c,()=>t.onValueChange(Gr(K(n)))),zs(c,()=>K(n),e=>na(n,e)),J(e,a),Xr(i)}Lo([`input`]);var Pg=class extends $s{minValue;maxValue;stepSize;constructor(e){if(super(e),this.minValue=this.mountable.getArgument(V.MIN_VALUE)?.value??0,this.maxValue=this.mountable.getArgument(V.MAX_VALUE)?.value??100,this.stepSize=this.mountable.getArgument(V.STEP_SIZE)?.value??1,this.minValue>=this.maxValue)throw new z({errorLevel:P.ERROR,effect:`can not create slider input field`,cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return gt(mn(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return Ng}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:this.mountable.getArgument(V.ADD_LABELS)?.value===!0}}},Fg=q(`<span> </span>`),Ig=q(`<div class="mb-suggest-input"><div class="mb-suggest-text"><!></div> <!> <!></div>`);function Lg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}let i=Ui(()=>K(n)?.toString()??`null`),a=Ui(()=>{if(tn.isLink(K(i)))try{return tn.parseLink(K(i))}catch(e){console.warn(e)}});var o={setValue:r},s=Ig(),c=U(s),l=U(c),u=e=>{Lh(e,{get mdLink(){return K(a)}})},d=e=>{var t=Fg(),n=U(t,!0);H(t),Ra(()=>Jo(n,K(i))),J(e,t)};ts(l,e=>{K(a)===void 0?e(d,-1):e(u)}),H(c);var f=G(c,2);Dh(f,{get variant(){return Nt.PLAIN},get onclick(){return t.showSuggester},children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`list`})},$$slots:{default:!0}});var p=G(f,2),m=e=>{Dh(e,{get variant(){return Nt.PLAIN},get onclick(){return t.showTextPrompt},children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`pencil`})},$$slots:{default:!0}})};return ts(p,e=>{t.allowOther&&e(m)}),H(s),J(e,s),Xr(o)}var Rg=class extends $s{filterValue(e){return gn(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return Lg}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument(V.ALLOW_OTHER)?.value===!0}}openModal(){this.mountable.mb.internal.openSuggesterModal(this,e=>this.setInternalValue(e.value))}openTextModal(){this.mountable.mb.internal.openTextPromptModal({title:`Meta Bind Suggester`,subTitle:`Set the suggester value.`,value:``,multiline:!1,onSubmit:e=>{this.setInternalValue(e)},onCancel:()=>{}})}},zg=q(`<span> </span>`),Bg=q(`<input type="text" tabindex="0"/> <!>`,1);function Vg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(e,t){let n=t.toString();return`${e.toString().padStart(n.length,`0`)}/${n}`}var a={setValue:r},o=Bg(),s=W(o);Ms(s);var c=G(s,2),l=e=>{var r=zg(),a=U(r,!0);H(r),Ra(e=>{xs(r,1,`mb-content-limit-indicator ${K(n).length>t.limit?`mb-content-limit-indicator-overflow`:``}`),Jo(a,e)},[()=>i(K(n).length,t.limit)]),J(e,r)};return ts(c,e=>{t.limit!==void 0&&e(l)}),Ra(()=>{Fs(s,`placeholder`,t.placeholder),Fs(s,`maxlength`,t.limit)}),Io(`input`,s,()=>t.onValueChange(Gr(K(n)))),zs(s,()=>K(n),e=>na(n,e)),J(e,o),Xr(a)}Lo([`input`]);var Hg=class extends $s{filterValue(e){return hn(e)}getFallbackDefaultValue(){return``}getSvelteComponent(){return Vg}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument(V.PLACEHOLDER)?.value??`Text`,limit:this.mountable.getArgument(V.LIMIT)?.value}}},Ug=q(`<textarea class="mb-input-textarea" tabindex="0"></textarea>`);function Wg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}var i={setValue:r},a=Ug();return Sa(a),Ra(()=>{Fs(a,`placeholder`,t.placeholder),Fs(a,`maxlength`,t.limit)}),Io(`input`,a,()=>t.onValueChange(Gr(K(n)))),zs(a,()=>K(n),e=>na(n,e)),J(e,a),Xr(i)}Lo([`input`]);var Gg=class extends $s{filterValue(e){return hn(e)}getFallbackDefaultValue(){return``}getSvelteComponent(){return Wg}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument(V.PLACEHOLDER)?.value??`Text`,limit:this.mountable.getArgument(V.LIMIT)?.value}}},Kg=q(`<input type="time"/>`);function qg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}var i={setValue:r},a=Kg();return Ms(a),Io(`input`,a,()=>t.onValueChange(Gr(K(n)))),zs(a,()=>K(n),e=>na(n,e)),J(e,a),Xr(i)}Lo([`input`]);var Jg=class extends $s{filterValue(e){return hn(e)}getFallbackDefaultValue(){return`00:00`}getSvelteComponent(){return qg}rawMapValue(e){return e}rawReverseMapValue(e){return e}},Yg=q(`<div role="switch" tabindex="0"><input type="checkbox" tabindex="-1"/></div>`);function Xg(e,t){Yr(t,!0);let n=ea(sa(t.value));function r(e){na(n,e,!0)}function i(){na(n,!K(n)),t.onValueChange(Gr(K(n)))}function a(e){e.key===` `&&i()}var o={setValue:r},s=Yg();let c;var l=U(s);return Ms(l),H(s),Ra(()=>{c=xs(s,1,`checkbox-container`,null,c,{"is-enabled":K(n)}),Fs(s,`aria-checked`,K(n)),Ps(l,K(n))}),Io(`click`,s,()=>i()),Io(`keydown`,s,e=>a(e)),J(e,s),Xr(o)}Lo([`click`,`keydown`]);var Zg=class extends $s{onValue;offValue;constructor(e){super(e),this.onValue=this.mountable.getArgument(V.ON_VALUE)?.value??!0,this.offValue=this.mountable.getArgument(V.OFF_VALUE)?.value??!1}filterValue(e){return e===this.onValue||e===this.offValue?gn(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return Xg}rawReverseMapValue(e){return e===this.onValue?!0:(this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}},Qg=class{static linkToInputField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfields/${e.toLowerCase()}/`}static linkToInputFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfieldarguments/${e.toLowerCase()}/`}static linkToViewField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfields/${e.toLowerCase()}/`}static linkToViewFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfieldarguments/${e.toLowerCase()}/`}static linkToInputFields(){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/inputfields/`}static linkToViewFields(){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/viewfields/`}static linkToButtons(){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration`}static linkToButtonConfig(){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration`}static linkToSearch(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/?s=${encodeURIComponent(e)}`}static linkToHome(){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/`}static linkToGithub(){return`https://github.com/mProjectsCode/obsidian-meta-bind-plugin`}static linkToIssues(){return`https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues`}static linkToCanaryBuilds(){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/installation/#canary-builds`}static open(e){wt(e)}},$g=class{mb;constructor(e){this.mb=e}createInputField(e){let t=e.declaration.inputFieldType,n=e.renderChildType;if(t!==B.INVALID&&this.checkRenderChildTypeAllowed(t,n),t===B.TOGGLE)return new Zg(e);if(t===B.SLIDER)return new Pg(e);if(t===B.TEXT)return new Hg(e);if(t===B.TEXT_AREA)return new Gg(e);if(t===B.SELECT)return new kg(e);if(t===B.MULTI_SELECT)return new yg(e);if(t===B.DATE_PICKER)return new gh(e);if(t===B.NUMBER)return new Sg(e);if(t===B.SUGGESTER)return new Rg(e);if(t===B.EDITOR)return new Th(e);if(t===B.PROGRESS_BAR)return new Eg(e);if(t===B.INLINE_SELECT)return new rg(e);if(t===B.IMAGE_SUGGESTER)return new Fh(e);if(t===B.LIST)return new dg(e);if(t===B.LIST_SUGGESTER)return new gg(e);if(t===B.DATE)return new dh(e);if(t===B.TIME)return new Jg(e);if(t===B.INLINE_LIST_SUGGESTER)return new $h(e);if(t===B.INLINE_LIST)return new Yh(e);if(t===B.IMAGE_LIST_SUGGESTER)return new jh(e);if(t===B.DATE_TIME)return new yh(e)}checkRenderChildTypeAllowed(e,t){if(this.mb.getSettings().ignoreCodeBlockRestrictions)return;let n=En[e];if(t===A.BLOCK&&!n.allowInBlock)throw new ee({errorLevel:P.ERROR,effect:`can not create input field`,cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[Qg.linkToInputField(e)]});if(t===A.INLINE&&!n.allowInline)throw new ee({errorLevel:P.ERROR,effect:`can not create input field`,cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[Qg.linkToInputField(e)]})}},e_=class extends Ys{mb;mountable;metadataSubscription;variables;hidden;constructor(e){super(),this.mountable=e,this.mb=e.mb,this.variables=[],this.hidden=!1}async initialRender(e){Dt.addClass(e,`mb-view-text`),this.hidden=this.mountable.getArgument(An.HIDDEN)?.value??!1,this.hidden&&Dt.addClass(e,`mb-view-hidden`),await this.onInitialRender(e)}async rerender(e,t){this.hidden||await this.onRerender(e,t)}onMount(e){this.buildVariables(),this.initialRender(e),this.metadataSubscription=this.mountable.mb.metadataManager.subscribeDerived(this.mountable.getUuid(),this.mountable.getDeclaration().writeToBindTarget,this.variables.map(e=>e.bindTargetDeclaration),this.variables.map(e=>e.metadataSignal),async()=>{let t=await this.computeValue();return this.rerender(e,t),this.mapValue(t)},()=>this.mountable.unmount())}onUnmount(){this.metadataSubscription?.unsubscribe()}},t_=q(`<div class="mb-image-card"><img class="mb-image-card-image"/></div>`);function n_(e,t){Yr(t,!0);let n=Ws(t,`internal`,3,!0),r=Ui(()=>n()?t.mb.internal.imagePathToUri(t.image):t.image);var i=t_(),a=U(i);H(i),Ra(()=>{Fs(a,`src`,K(r)),Fs(a,`alt`,t.image)}),J(e,i),Xr()}var r_=q(`<span>No images</span>`),i_=q(`<div class="mb-image-card-grid"></div>`);function a_(e,t){Yr(t,!0);let n=Ws(t,`images`,23,()=>[]);function r(e){n(e)}var i={updateImages:r},a=i_();return os(a,21,n,ns,(e,n)=>{n_(e,{get mb(){return t.mb},get image(){return K(n).link},get internal(){return K(n).internal}})},e=>{J(e,r_())}),H(a),J(e,a),Xr(i)}var o_=class extends e_{component;linkVariable;constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(e=>typeof e==`string`?e:!0);if(e.length!==1)throw new R({errorLevel:P.ERROR,effect:`can not create view field`,cause:`image view filed only supports exactly a single bind target and not text content`});let t=e[0];if(typeof t==`string`)throw new R({errorLevel:P.ERROR,effect:`can not create view field`,cause:`image view filed only supports exactly a single bind target and not text content`});t.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:t,metadataSignal:new Zs(void 0),uuid:St(),contextName:`MB_VAR_0`},this.variables.push(this.linkVariable)}computeValue(){let e=this.linkVariable.metadataSignal.get();if(typeof e==`string`){let t=tn.interpretAsLink(e);return t===void 0?void 0:[t]}else if(Array.isArray(e))return e.filter(e=>typeof e==`string`).map(e=>tn.interpretAsLink(e)).filter(e=>e!==void 0);else return}mapValue(e){return e===void 0?``:Array.isArray(e)?e.map(e=>e.toString()):e.toString()}onInitialRender(e){this.component=Yo(a_,{target:e,props:{images:[],mb:this.mountable.mb}})}async onRerender(e,t){this.component?.updateImages(jt(t).map(e=>({link:e.target,internal:e.internal})))}onUnmount(){super.onUnmount(),this.component&&$o(this.component)}},s_=q(`<span></span>`);function c_(e,t){Yr(t,!0);let n=Ws(t,`mdLinkList`,7);function r(e){n(e)}var i={updateList:r},a=qo(),o=W(a),s=e=>{J(e,s_())},c=e=>{Lh(e,{get mdLink(){return n()[0]}})},l=e=>{Bh(e,{get elements(){return n()},children:(e,t=Un)=>{Lh(e,{get mdLink(){return t()}})},$$slots:{default:!0}})};return ts(o,e=>{n().length===0?e(s):n().length===1?e(c,1):e(l,-1)}),J(e,a),Xr(i)}var l_=class extends e_{component;linkVariable;aliasVariable;constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(e=>typeof e==`string`?e:!0);if(e.length!==1&&e.length!==2&&e.length!==3)throw new R({errorLevel:P.ERROR,effect:`can not create view field`,cause:`link view field must be of form "{bindTarget}" or "{bindTarget}|{bindTarget}"`});let t=e[0],n=e[1],r=e[2];if(this.variables=[],e.length===1){if(typeof t==`string`)throw new R({errorLevel:P.ERROR,effect:`can not create view field`,cause:`link view field must be of form "{bindTarget}" or "{bindTarget}|{bindTarget}"`});t.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:t,metadataSignal:new Zs(void 0),uuid:St(),contextName:`MB_VAR_0`},this.variables.push(this.linkVariable)}else if(e.length===2||e.length===3){if(typeof t==`string`||typeof n!=`string`)throw new R({errorLevel:P.ERROR,effect:`can not create view field`,cause:`link view field must be of form "{bindTarget}", "{bindTarget}|alias", or "{bindTarget}|{bindTarget}"`});t.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:t,metadataSignal:new Zs(void 0),uuid:St(),contextName:`MB_VAR_0`},this.variables.push(this.linkVariable),e.length===2?this.aliasVariable=n.slice(1):typeof r==`string`?this.aliasVariable=r:(r.listenToChildren=!0,this.aliasVariable={bindTargetDeclaration:r,metadataSignal:new Zs(void 0),uuid:St(),contextName:`MB_VAR_1`},this.variables.push(this.aliasVariable))}else throw Error(`unreachable`)}getAlias(){if(this.aliasVariable)return typeof this.aliasVariable==`string`?this.aliasVariable:_n(this.aliasVariable.metadataSignal.get(),this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)}computeValue(){let e=this.linkVariable.metadataSignal.get(),t=this.getAlias();if(typeof e==`string`){let n=tn.interpretAsLink(e);return n===void 0?void 0:(t&&(n.alias=t),[n])}else if(Array.isArray(e))return e.filter(e=>typeof e==`string`).map(e=>tn.interpretAsLink(e)).filter(e=>e!==void 0);else return}mapValue(e){return e===void 0?``:Array.isArray(e)?e.map(e=>e.toString()):e.toString()}onInitialRender(e){this.component=Yo(c_,{target:e,props:{mdLinkList:[]}})}async onRerender(e,t){this.component?.updateList(jt(t))}onUnmount(){super.onUnmount(),this.component&&$o(this.component)}},u_=class extends e_{container;expression;expressionStr;hidden;constructor(e){super(e),this.hidden=!1}buildVariables(){let e=0;this.expressionStr=``,this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!=`string`){let n={bindTargetDeclaration:t,metadataSignal:new Zs(void 0),uuid:St(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.expressionStr+=n.contextName,e+=1}else this.expressionStr+=t;this.expression=this.mb.math.compile(this.expressionStr)}buildMathJSContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.metadataSignal||(e[t.contextName]=t.metadataSignal.get()??``);return e}computeValue(){if(!this.expression)return this.handleComputeError(new re({errorLevel:P.ERROR,effect:`failed to evaluate expression`,cause:`expression is undefined`}));let e=this.buildMathJSContext();try{return{value:un(`${this.expression.evaluate(e)}`),error:!1}}catch(t){return t instanceof Error?this.handleComputeError(new re({errorLevel:P.ERROR,effect:`failed to evaluate expression`,cause:t,context:{expression:this.expressionStr,context:e}})):this.handleComputeError(Error(`failed to evaluate js expression because of unexpected thrown value`))}}mapValue(e){return e.value}onInitialRender(e){}onRerender(e,t){let n=_n(t?.value,this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)??``;t?.error?Dt.addClass(e,`mb-error`):Dt.removeClass(e,`mb-error`),e.innerText=n}handleComputeError(e){return console.warn(e),{error:!0,value:e.message}}},d_=class extends e_{textParts;renderMarkdown;markdownUnloadCallback;constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){this.textParts=[];let e=0;this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!=`string`){let n={bindTargetDeclaration:t,metadataSignal:new Zs(void 0),uuid:St(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.textParts.push(n),e+=1}else this.textParts.push(t)}computeValue(){if(!this.textParts)throw new re({errorLevel:P.CRITICAL,effect:`failed to evaluate text view field`,cause:`content parts is undefined`});return this.textParts.map(e=>typeof e==`string`?e:_n(e.metadataSignal.get(),this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)).join(``)}mapValue(e){return e}onInitialRender(e){this.renderMarkdown=this.mountable.getArgument(An.RENDER_MARKDOWN)?.value??!1,this.renderMarkdown&&Dt.addClass(e,`mb-view-markdown`)}async onRerender(e,t){let n=_n(t,this.mountable.mb.getSettings().viewFieldDisplayNullAsEmpty)??``;this.renderMarkdown?(this.markdownUnloadCallback?.(),Dt.empty(e),this.markdownUnloadCallback=await this.mountable.mb.internal.renderMarkdown(n,e,this.mountable.getFilePath())):e.innerText=n}onUnmount(){super.onUnmount(),this.markdownUnloadCallback?.()}},f_=class{mb;constructor(e){this.mb=e}createViewField(e){let t=e.declaration.viewFieldType;if(t===kn.MATH)return new u_(e);if(t===kn.TEXT)return new d_(e);if(t===kn.LINK)return new l_(e);if(t===kn.IMAGE)return new o_(e)}},p_=class extends Error{},m_=class extends Error{},h_=function(e){return this instanceof h_?(this.v=e,this):new h_(e)},g_;(function(e){e[e.SHORTEST=0]=`SHORTEST`,e[e.LONGEST=1]=`LONGEST`,e[e.STRICT_EQUAL=2]=`STRICT_EQUAL`})(g_||={});function*__(e,t,...n){if(n.length===0)return;let r=[];for(let e of n)r.push(T_(e));iterate:for(;;){let n=y_(r,e=>e.next()),i=[],a=!0,o=!1;for(let e of n){let n;e.done?(a=!1,n=t):(o=!0,n=e.value),i.push(n)}if(!a&&o)switch(e){case g_.SHORTEST:break iterate;case g_.STRICT_EQUAL:throw new m_(`Iterators must have equal lengths`)}if(!o)break;yield i}}var v_=function(e){return this instanceof v_?(this.v=e,this):new v_(e)};function*y_(e,t){for(let n of w_(e))yield t(n)}function b_(e,t){for(let n of w_(e))if(t(n))return!0;return!1}function x_(e){return e==null?!1:typeof e[Symbol.iterator]==`function`}function S_(e){return e==null?!1:e.next!==void 0&&typeof e.next==`function`}var C_=function(e){return this instanceof C_?(this.v=e,this):new C_(e)};function w_(e){if(x_(e))return e;if(S_(e))return{[Symbol.iterator](){return e}};if(typeof e==`object`&&e)return(function*(){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(yield[t,e[t]])})();throw new p_(`Given collection is not iterable or iterator.`)}function T_(e){if(S_(e))return e;if(x_(e))return(function*(){for(let t of e)yield t})();throw new p_(`Given collection is not iterable or iterator.`)}var E_=function(e){return this instanceof E_?(this.v=e,this):new E_(e)};function*D_(...e){for(let t of __(g_.SHORTEST,void 0,...e))yield t}var O_=class{uuid;metadataManager;bindTarget;dependencies;dependencySignals;dependencySubscriptions;computeFunction;deleted;onDelete;constructor(e,t,n,r,i,a,o){this.uuid=e,this.metadataManager=t,this.bindTarget=n,this.dependencies=r,this.dependencySignals=i,this.dependencySubscriptions=[],this.computeFunction=a,this.onDelete=o,this.deleted=!1}init(){for(let[e,t]of D_(this.dependencies,this.dependencySignals)){let n=this.uuid+`/`+St();this.dependencySubscriptions.push(this.metadataManager.subscribe(n,t,e,()=>this.delete())),t.registerListener({callback:()=>void this.computeValue()})}this.computeValue(!0)}async computeValue(e=!1){if(!(e&&this.dependencySignals.some(e=>e.get()===void 0)))try{let e=await this.computeFunction();this.bindTarget&&(yt(this.metadataManager.readShortLived(this.bindTarget),e)||this.metadataManager.write(e,this.bindTarget,this.uuid))}catch(e){let t=e instanceof Error?e:String(e);console.warn(new L({errorLevel:P.ERROR,effect:`Failed to run derived metadata computation`,cause:t}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}onUpdate(e){return!1}updatable(){return!1}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}},k_=class{uuid;metadataManager;bindTarget;dependencies;dependencySignals;dependencySubscriptions;effectFunction;deleted;onDelete;constructor(e,t,n,r,i,a){this.uuid=e,this.metadataManager=t,this.bindTarget=void 0,this.dependencies=n,this.dependencySignals=r,this.dependencySubscriptions=[],this.effectFunction=i,this.deleted=!1,this.onDelete=a}init(){for(let[e,t]of D_(this.dependencies,this.dependencySignals)){let n=this.uuid+`/`+St();this.dependencySubscriptions.push(this.metadataManager.subscribe(n,t,e,()=>this.delete())),t.registerListener({callback:()=>void this.runEffect()})}this.runEffect()}async runEffect(){try{await this.effectFunction()}catch(e){let t=e instanceof Error?e:String(e);console.warn(new L({errorLevel:P.ERROR,effect:`Failed to run metadata effect`,cause:t}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}onUpdate(e){return!1}updatable(){return!1}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}},A_=class{uuid;callbackSignal;value;metadataManager;bindTarget;deleted;onDelete;constructor(e,t,n,r,i){this.uuid=e,this.callbackSignal=t,this.metadataManager=n,this.bindTarget=r,this.onDelete=i,this.deleted=!1,this.value=void 0}unsubscribe(){this.metadataManager.unsubscribe(this)}write(e){yt(this.metadataManager.readShortLived(this.bindTarget),e)||(this.value=e,this.metadataManager.write(e,this.bindTarget,this.uuid))}read(){return this.metadataManager.read(this.bindTarget)}onUpdate(e){try{if(!yt(this.value,e)){let t=structuredClone(e);return this.value=t,this.callbackSignal.set(t),!0}}catch(e){let t=e instanceof Error?e:String(e);console.warn(new L({errorLevel:P.ERROR,effect:`Failed to notify subscription of updated value in the cache`,cause:t}))}return!1}updatable(){return!0}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}},j_=class{static get(e,t){return t.get(e).child}static tryGet(e,t){return t.tryGet(e)?.child}static fullGet(e,t){return t.get(e)}static set(e,t,n){t.set(e,n)}static setAndCreate(e,t,n){t.setAndCreate(e,n)}};function M_(e,t){return e===void 0||t===void 0||e.storageType!==t.storageType||e.storagePath!==t.storagePath?!1:N_(e.storageProp,t.storageProp,t.listenToChildren)}function N_(e,t,n){let r=e.path,i=t.path;for(let e=0;e<Math.min(r.length,i.length);e++)if(r[e].type!==i[e].type||r[e].prop!==i[e].prop)return!1;return r.length>i.length?n:!0}function P_(e){return e===void 0?`undefined`:`${e.storagePath}#${e.storageProp.toString()}`}var F_=class{sources;defaultSource;constructor(){this.sources=new Map,this.defaultSource=`CHANGE_THE_DEFAULT_SOURCE`}registerSource(e){this.sources.set(e.id,e)}setDefaultSource(e){if(this.sources.has(e))this.defaultSource=e;else throw new L({errorLevel:P.CRITICAL,effect:`can not set default source`,cause:`Source "${e}" does not exist`})}unregisterSource(e){this.sources.delete(e.id)}getSource(e){return this.sources.get(e)}iterateSources(){return this.sources.keys()}subscribe(e,t,n,r){let i=new A_(e,t,this,n,r);return this.subscribeSubscription(i),i}subscribeDerived(e,t,n,r,i,a){let o=new O_(e,this,t,n,r,i,a);return this.checkForLoops(o),o.init(),this.subscribeSubscription(o),o}subscribeEffect(e,t,n,r,i){let a=new k_(e,this,t,n,r,i);return a.init(),this.subscribeSubscription(a),a}unsubscribe(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new L({errorLevel:P.ERROR,effect:`can not unsubscribe subscription`,cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=t.unsubscribe(e);n.subscriptions.length===0&&(n.cyclesWithoutListeners=0)}subscribeSubscription(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new L({errorLevel:P.ERROR,effect:`can not subscribe subscription`,cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=t.subscribe(e);n.cyclesWithoutListeners=0;let r=t.readCacheItem(n,e.bindTarget.storageProp);e.onUpdate(r)}checkForLoops(e){for(let t of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,t])}recCheckForLoops(e){let t=e.at(0),n=e.at(-1);if(!(n===void 0||t===void 0)){if(M_(t.bindTarget,n.bindTarget))throw new te({errorLevel:P.ERROR,effect:`bind target dependency loop detected`,cause:`the loop is as follows: ${e.map(e=>`"${P_(e.bindTarget)}"`).join(` -> `)}`,docs:[`https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies`]});for(let t of this.getAllSubscriptionsToDependencies(n))this.recCheckForLoops([...e,t])}}getAllSubscriptionsToDependencies(e){return e.getDependencies().map(e=>this.getAllSubscriptionsToBindTarget(e)).flat()}getAllSubscriptionsToBindTarget(e){if(e===void 0)return[];let t=this.getCacheItemForBindTarget(e);return t?t.subscriptions.filter(t=>M_(t.bindTarget,e)):[]}getCacheItemForBindTarget(e){return this.getSource(e.storageType)?.getCacheItemForStoragePath(e.storagePath)}async cycle(){let e=[];for(let t of this.sources.values())e.push(this.cycleSource(t));for(let t of await Promise.allSettled(e))t.status===`rejected`&&console.warn(`meta-bind | MetadataManager >> failed to cycle source`,t.reason)}async cycleSource(e){let t=[],n=await Promise.allSettled(e.getCacheItems().map(async n=>{if(e.onCycle(n),n.dirty)try{await e.syncExternal(n),n.dirty=!1}catch(t){console.warn(`failed to sync changes to external source for ${e.id}`,t)}n.externalWriteLock>0&&--n.externalWriteLock,n.subscriptions.length===0&&(n.cyclesWithoutListeners+=1),n.cyclesWithoutListeners>300&&e.shouldDelete(n)&&t.push(n)}));for(let t of n)t.status===`rejected`&&console.warn(`meta-bind | MetadataManager >> failed to cycle cache item in source ${e.id}`,t.reason);for(let n of t)n.subscriptions.length===0&&n.cyclesWithoutListeners>300&&e.shouldDelete(n)&&e.deleteCache(n)}write(e,t,n){let r=this.getSource(t.storageType);if(r===void 0)throw new L({errorLevel:P.ERROR,effect:`can not write to cache`,cause:`Source "${t.storageType}" does not exist`});let i=r.writeCache(structuredClone(e),t);i.dirty=!0,i.externalWriteLock=5,this.notifyListeners(t,n)}read(e){let t=this.getSource(e.storageType);if(t===void 0)throw new L({errorLevel:P.ERROR,effect:`can not read metadata`,cause:`Source "${e.storageType}" does not exist`});return structuredClone(t.readCache(e))}readShortLived(e){let t=this.getSource(e.storageType);if(t===void 0)throw new L({errorLevel:P.ERROR,effect:`can not read metadata`,cause:`Source "${e.storageType}" does not exist`});return t.readCache(e)}isCacheExternalWriteLocked(e){return e.externalWriteLock>0}notifyListeners(e,t){let n=this.getSource(e.storageType);if(n===void 0)throw new L({errorLevel:P.ERROR,effect:`can notify listeners metadata`,cause:`Source "${e.storageType}" does not exist`});let r=n.getCacheItemForStoragePath(e.storagePath);if(r!==void 0){for(let i of r.subscriptions)if(!(t!==void 0&&t===i.uuid||i.bindTarget===void 0||!i.updatable())&&N_(e.storageProp,i.bindTarget.storageProp,i.bindTarget.listenToChildren)){let e=n.readCache(i.bindTarget);i.onUpdate(e)}}}notifyAllListeners(e,t){for(let n of t.subscriptions){if(n.bindTarget===void 0)continue;let t=e.readCache(n.bindTarget);n.onUpdate(t)}}deleteCachesForStoragePath(e){for(let t of this.sources.values()){if(!t.usesStoragePath())continue;let n=t.getCacheItemForStoragePath(e);if(n!==void 0){for(let e of[...n.subscriptions])e.delete();t.deleteCache(n)}}}constructDefaultCacheItem(){return{subscriptions:[],externalWriteLock:0,dirty:!1,cyclesWithoutListeners:0}}onExternalUpdate(e,t,n){let r=e.getCacheItemForStoragePath(t);if(r===void 0||this.isCacheExternalWriteLocked(r))return;e.writeEntireCache(n,r);let i=0;for(let e of r.subscriptions){if(e.bindTarget===void 0||!e.updatable())continue;let t=j_.tryGet(n,e.bindTarget.storageProp);e.onUpdate(t)&&(i+=1)}}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,t){this.deleteCachesForStoragePath(e)}},I_=class{activeMountables;constructor(){this.activeMountables=new Map}unloadFile(e){for(let t of this.activeMountables.values())t.getFilePath()===e&&t.unmount()}unload(){for(let e of this.activeMountables.values())e.unmount()}registerMountable(e){this.activeMountables.set(e.getUuid(),e)}unregisterMountable(e){this.activeMountables.delete(e.getUuid())}},L_=function(e){return e.FRONTMATTER=`frontmatter`,e.MEMORY=`memory`,e.GLOBAL_MEMORY=`globalMemory`,e.SCOPE=`scope`,e}({}),R_=class e{path;constructor(e){this.path=e}get(e){if(this.path.length===0)throw Error(`can not use empty path to access object`);let t=this.path[0].get(e);for(let e of this.path.slice(1))t=e.get(t.child);return t}tryGet(e){try{return this.get(e)}catch{return}}set(e,t){if(this.path.length===0)throw Error(`can not use empty path to access object`);let n=this.path[0].get(e);for(let e of this.path.slice(1))n=e.get(n.child);n.access.set(n.parent,t)}setAndCreate(e,t){if(this.path.length===0)throw Error(`can not use empty path to access object`);let n=this.path[0].get(e);n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(0,t)),n=n.access.get(n.parent));for(let e=1;e<this.path.length;e++)n=this.path[e].get(n.child),n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(e,t)),n=n.access.get(n.parent));n.access.set(n.parent,t)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,t){let n=this.getNextPathElement(e);return n===void 0?t:n.type===ye.OBJECT?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(`.`)}concat(t){return new e(this.path.concat(t.path))}compareDiffArray(e){let t=Math.min(this.path.length,e.length);for(let n=0;n<t;n++){let t=this.path[n],r=e[n];if(t.prop!==r.toString())return!1}return!0}},z_=class{mb;constructor(e){this.mb=e}fromString(e){return se(ke,e)}fromStringAndValidate(e,t,n){return this.validate(e,this.fromString(e),t,n)}fromExistingDeclaration(e){if(e!==void 0)return{storageType:ve(e.storageType),storagePath:ve(e.storagePath),storageProp:e.storageProp.path.map(e=>e.toUnvalidatedPropAccess()),listenToChildren:e.listenToChildren}}validate(e,t,n,r){let i=new R_(t.storageProp.map(e=>new Ce(e.type,e.prop.value))),a;a=t.storageType===void 0?this.mb.metadataManager.defaultSource:this.validateStorageType(t.storageType,e);let o=t.storagePath!==void 0,s=t.storagePath??{value:n},c=this.mb.metadataManager.getSource(a);if(c===void 0)throw new L({errorLevel:P.CRITICAL,effect:`can not validate bind target`,cause:`Source '${a}' not found. But validation was successful. This should not happen.`,context:{fullDeclaration:e,sources:[...this.mb.metadataManager.sources.keys()]}});let l=c.validateStoragePath(s,o,e,this),u={storageType:a,storagePath:l,storageProp:i,listenToChildren:t.listenToChildren};return c.id===L_.SCOPE?this.resolveScope(u,r):u}resolveScope(e,t){if(t===void 0)throw new le(P.ERROR,`Bind Target Scope Validator`,`Failed to resolve bind target scope, no scope provided`);return e.storageType=t.scope.storageType,e.storagePath=t.scope.storagePath,e.storageProp=t.scope.storageProp.concat(e.storageProp),e}validateStorageType(e,t){for(let t of this.mb.metadataManager.iterateSources())if(t===e.value)return t;throw new le(P.ERROR,`Bind Target Validator`,`Encountered invalid identifier. Expected token to be a storage type but received '${e?.value}'.`,t,e?.position)}validateStoragePathAsFilePath(e,t){let n=e?.value;if(n===void 0)throw new le(P.ERROR,`Bind Target Validator`,`Failed to parse bind target. Bind target storage path is undefined.`,t,e?.position);let r=this.mb.file.getPathByName(n);if(r===void 0)throw new le(P.ERROR,`Bind Target Validator`,`Failed to parse bind target. Bind target file path '${n}' not found.`,t,e?.position);return r}};Object.freeze({status:`aborted`});function X(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var B_=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},V_=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},H_={};function U_(e){return e&&Object.assign(H_,e),H_}function W_(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function G_(e,t){return typeof t==`bigint`?t.toString():t}function K_(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function q_(e){return e==null}function J_(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Y_(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var X_=Symbol(`evaluating`);function Z_(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==X_)return r===void 0&&(r=X_,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Q_(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function $_(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ev(e){return JSON.stringify(e)}function tv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var nv=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function rv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var iv=K_(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function av(e){if(rv(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(rv(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ov(e){return av(e)?{...e}:Array.isArray(e)?[...e]:e}var sv=new Set([`string`,`number`,`symbol`]);function cv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function lv(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function uv(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function dv(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var fv={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function pv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return lv(e,$_(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Q_(this,`shape`,e),e},checks:[]}))}function mv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return lv(e,$_(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Q_(this,`shape`,r),r},checks:[]}))}function hv(e,t){if(!av(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return lv(e,$_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Q_(this,`shape`,n),n}}))}function gv(e,t){if(!av(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return lv(e,$_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Q_(this,`shape`,n),n}}))}function _v(e,t){return lv(e,$_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Q_(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function vv(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return lv(t,$_(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Q_(this,`shape`,i),i},checks:[]}))}function yv(e,t,n){return lv(t,$_(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Q_(this,`shape`,i),i}}))}function bv(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function xv(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Sv(e){return typeof e==`string`?e:e?.message}function Cv(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Sv(e.inst?._zod.def?.error?.(e))??Sv(t?.error?.(e))??Sv(n.customError?.(e))??Sv(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function wv(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Tv(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ev=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,G_,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Dv=X(`$ZodError`,Ev),Ov=X(`$ZodError`,Ev,{Parent:Error});function kv(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Av(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var jv=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new B_;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Cv(e,a,U_())));throw nv(t,i?.callee),t}return o.value},Mv=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Cv(e,a,U_())));throw nv(t,i?.callee),t}return o.value},Nv=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new B_;return a.issues.length?{success:!1,error:new(e??Dv)(a.issues.map(e=>Cv(e,i,U_())))}:{success:!0,data:a.value}},Pv=Nv(Ov),Fv=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Cv(e,i,U_())))}:{success:!0,data:a.value}},Iv=Fv(Ov),Lv=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return jv(e)(t,n,i)},Rv=e=>(t,n,r)=>jv(e)(t,n,r),zv=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Mv(e)(t,n,i)},Bv=e=>async(t,n,r)=>Mv(e)(t,n,r),Vv=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Nv(e)(t,n,i)},Hv=e=>(t,n,r)=>Nv(e)(t,n,r),Uv=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Fv(e)(t,n,i)},Wv=e=>async(t,n,r)=>Fv(e)(t,n,r),Gv=/^[cC][^\s-]{8,}$/,Kv=/^[0-9a-z]+$/,qv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Jv=/^[0-9a-vA-V]{20}$/,Yv=/^[A-Za-z0-9]{27}$/,Xv=/^[a-zA-Z0-9_-]{21}$/,Zv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qv=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$v=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ey=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ty=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ny(){return new RegExp(ty,`u`)}var ry=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,iy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ay=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,oy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sy=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cy=/^[A-Za-z0-9_-]*$/,ly=/^\+[1-9]\d{6,14}$/,uy=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,dy=RegExp(`^${uy}$`);function fy(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function py(e){return RegExp(`^${fy(e)}$`)}function my(e){let t=fy({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${uy}T(?:${r})$`)}var hy=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},gy=/^-?\d+$/,_y=/^-?\d+(?:\.\d+)?$/,vy=/^(?:true|false)$/i,yy=/^[^A-Z]*$/,by=/^[^a-z]*$/,xy=X(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Sy={number:`number`,bigint:`bigint`,object:`date`},Cy=X(`$ZodCheckLessThan`,(e,t)=>{xy.init(e,t);let n=Sy[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wy=X(`$ZodCheckGreaterThan`,(e,t)=>{xy.init(e,t);let n=Sy[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ty=X(`$ZodCheckMultipleOf`,(e,t)=>{xy.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Y_(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ey=X(`$ZodCheckNumberFormat`,(e,t)=>{xy.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=fv[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=gy)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Dy=X(`$ZodCheckMaxLength`,(e,t)=>{var n;xy.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!q_(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=wv(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Oy=X(`$ZodCheckMinLength`,(e,t)=>{var n;xy.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!q_(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=wv(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ky=X(`$ZodCheckLengthEquals`,(e,t)=>{var n;xy.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!q_(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=wv(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ay=X(`$ZodCheckStringFormat`,(e,t)=>{var n,r;xy.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),jy=X(`$ZodCheckRegex`,(e,t)=>{Ay.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),My=X(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=yy,Ay.init(e,t)}),Ny=X(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=by,Ay.init(e,t)}),Py=X(`$ZodCheckIncludes`,(e,t)=>{xy.init(e,t);let n=cv(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Fy=X(`$ZodCheckStartsWith`,(e,t)=>{xy.init(e,t);let n=RegExp(`^${cv(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Iy=X(`$ZodCheckEndsWith`,(e,t)=>{xy.init(e,t);let n=RegExp(`.*${cv(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ly=X(`$ZodCheckOverwrite`,(e,t)=>{xy.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ry=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
`))}},zy={major:4,minor:3,patch:6},By=X(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zy;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=bv(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new B_;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=bv(e,t))});else{if(e.issues.length===t)continue;r||=bv(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(bv(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new B_;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new B_;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Z_(e,`~standard`,()=>({validate:t=>{try{let n=Pv(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Iv(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Vy=X(`$ZodString`,(e,t)=>{By.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hy(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Hy=X(`$ZodStringFormat`,(e,t)=>{Ay.init(e,t),Vy.init(e,t)}),Uy=X(`$ZodGUID`,(e,t)=>{t.pattern??=Qv,Hy.init(e,t)}),Wy=X(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=$v(e)}else t.pattern??=$v();Hy.init(e,t)}),Gy=X(`$ZodEmail`,(e,t)=>{t.pattern??=ey,Hy.init(e,t)}),Ky=X(`$ZodURL`,(e,t)=>{Hy.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),qy=X(`$ZodEmoji`,(e,t)=>{t.pattern??=ny(),Hy.init(e,t)}),Jy=X(`$ZodNanoID`,(e,t)=>{t.pattern??=Xv,Hy.init(e,t)}),Yy=X(`$ZodCUID`,(e,t)=>{t.pattern??=Gv,Hy.init(e,t)}),Xy=X(`$ZodCUID2`,(e,t)=>{t.pattern??=Kv,Hy.init(e,t)}),Zy=X(`$ZodULID`,(e,t)=>{t.pattern??=qv,Hy.init(e,t)}),Qy=X(`$ZodXID`,(e,t)=>{t.pattern??=Jv,Hy.init(e,t)}),$y=X(`$ZodKSUID`,(e,t)=>{t.pattern??=Yv,Hy.init(e,t)}),eb=X(`$ZodISODateTime`,(e,t)=>{t.pattern??=my(t),Hy.init(e,t)}),tb=X(`$ZodISODate`,(e,t)=>{t.pattern??=dy,Hy.init(e,t)}),nb=X(`$ZodISOTime`,(e,t)=>{t.pattern??=py(t),Hy.init(e,t)}),rb=X(`$ZodISODuration`,(e,t)=>{t.pattern??=Zv,Hy.init(e,t)}),ib=X(`$ZodIPv4`,(e,t)=>{t.pattern??=ry,Hy.init(e,t),e._zod.bag.format=`ipv4`}),ab=X(`$ZodIPv6`,(e,t)=>{t.pattern??=iy,Hy.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),ob=X(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ay,Hy.init(e,t)}),sb=X(`$ZodCIDRv6`,(e,t)=>{t.pattern??=oy,Hy.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function cb(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var lb=X(`$ZodBase64`,(e,t)=>{t.pattern??=sy,Hy.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{cb(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ub(e){if(!cy.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return cb(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var db=X(`$ZodBase64URL`,(e,t)=>{t.pattern??=cy,Hy.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ub(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),fb=X(`$ZodE164`,(e,t)=>{t.pattern??=ly,Hy.init(e,t)});function pb(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var mb=X(`$ZodJWT`,(e,t)=>{Hy.init(e,t),e._zod.check=n=>{pb(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),hb=X(`$ZodNumber`,(e,t)=>{By.init(e,t),e._zod.pattern=e._zod.bag.pattern??_y,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),gb=X(`$ZodNumberFormat`,(e,t)=>{Ey.init(e,t),hb.init(e,t)}),_b=X(`$ZodBoolean`,(e,t)=>{By.init(e,t),e._zod.pattern=vy,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),vb=X(`$ZodAny`,(e,t)=>{By.init(e,t),e._zod.parse=e=>e}),yb=X(`$ZodUnknown`,(e,t)=>{By.init(e,t),e._zod.parse=e=>e}),bb=X(`$ZodNever`,(e,t)=>{By.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function xb(e,t,n){e.issues.length&&t.issues.push(...xv(n,e.issues)),t.value[n]=e.value}var Sb=X(`$ZodArray`,(e,t)=>{By.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>xb(t,n,e))):xb(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Cb(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...xv(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function wb(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=dv(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Tb(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Cb(e,n,i,t,u))):Cb(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Eb=X(`$ZodObject`,(e,t)=>{if(By.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=K_(()=>wb(t));Z_(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=rv,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Cb(n,t,e,s,r))):Cb(i,t,e,s,r)}return i?Tb(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Db=X(`$ZodObjectJIT`,(e,t)=>{Eb.init(e,t);let n=e._zod.parse,r=K_(()=>wb(t)),i=e=>{let t=new Ry([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ev(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ev(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
if (${n}.issues.length) {
if (${o} in input) {
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
...iss,
path: iss.path ? [${o}, ...iss.path] : [${o}]
})));
}
}
if (${n}.value === undefined) {
if (${o} in input) {
newResult[${o}] = undefined;
}
} else {
newResult[${o}] = ${n}.value;
}
`):t.write(`
if (${n}.issues.length) {
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
...iss,
path: iss.path ? [${o}, ...iss.path] : [${o}]
})));
}
if (${n}.value === undefined) {
if (${o} in input) {
newResult[${o}] = undefined;
}
} else {
newResult[${o}] = ${n}.value;
}
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=rv,s=!H_.jitless,c=s&&iv.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Tb([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Ob(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!bv(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Cv(e,r,U_())))}),t)}var kb=X(`$ZodUnion`,(e,t)=>{By.init(e,t),Z_(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Z_(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Z_(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Z_(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>J_(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Ob(t,i,e,a)):Ob(s,i,e,a)}}),Ab=X(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,kb.init(e,t);let n=e._zod.parse;Z_(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=K_(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!rv(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),jb=X(`$ZodIntersection`,(e,t)=>{By.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Nb(e,t,n)):Nb(e,i,a)}});function Mb(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(av(e)&&av(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Mb(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Mb(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Nb(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),bv(e))return e;let o=Mb(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Pb=X(`$ZodRecord`,(e,t)=>{By.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!av(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...xv(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...xv(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&_y.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Cv(e,r,U_())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...xv(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...xv(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Fb=X(`$ZodEnum`,(e,t)=>{By.init(e,t);let n=W_(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>sv.has(typeof e)).map(e=>typeof e==`string`?cv(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ib=X(`$ZodLiteral`,(e,t)=>{if(By.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?cv(e):e?cv(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Lb=X(`$ZodTransform`,(e,t)=>{By.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new V_(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new B_;return n.value=i,n}});function Rb(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var zb=X(`$ZodOptional`,(e,t)=>{By.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Z_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Z_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${J_(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Rb(t,e.value)):Rb(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Bb=X(`$ZodExactOptional`,(e,t)=>{zb.init(e,t),Z_(e._zod,`values`,()=>t.innerType._zod.values),Z_(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Vb=X(`$ZodNullable`,(e,t)=>{By.init(e,t),Z_(e._zod,`optin`,()=>t.innerType._zod.optin),Z_(e._zod,`optout`,()=>t.innerType._zod.optout),Z_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${J_(e.source)}|null)$`):void 0}),Z_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Hb=X(`$ZodDefault`,(e,t)=>{By.init(e,t),e._zod.optin=`optional`,Z_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ub(e,t)):Ub(r,t)}});function Ub(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Wb=X(`$ZodPrefault`,(e,t)=>{By.init(e,t),e._zod.optin=`optional`,Z_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Gb=X(`$ZodNonOptional`,(e,t)=>{By.init(e,t),Z_(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Kb(t,e)):Kb(i,e)}});function Kb(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var qb=X(`$ZodCatch`,(e,t)=>{By.init(e,t),Z_(e._zod,`optin`,()=>t.innerType._zod.optin),Z_(e._zod,`optout`,()=>t.innerType._zod.optout),Z_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Cv(e,n,U_()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Cv(e,n,U_()))},input:e.value}),e.issues=[]),e)}}),Jb=X(`$ZodPipe`,(e,t)=>{By.init(e,t),Z_(e._zod,`values`,()=>t.in._zod.values),Z_(e._zod,`optin`,()=>t.in._zod.optin),Z_(e._zod,`optout`,()=>t.out._zod.optout),Z_(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Yb(e,t.in,n)):Yb(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Yb(e,t.out,n)):Yb(r,t.out,n)}});function Yb(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Xb=X(`$ZodReadonly`,(e,t)=>{By.init(e,t),Z_(e._zod,`propValues`,()=>t.innerType._zod.propValues),Z_(e._zod,`values`,()=>t.innerType._zod.values),Z_(e._zod,`optin`,()=>t.innerType?._zod?.optin),Z_(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Zb):Zb(r)}});function Zb(e){return e.value=Object.freeze(e.value),e}var Qb=X(`$ZodCustom`,(e,t)=>{xy.init(e,t),By.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>$b(t,n,r,e));$b(i,n,r,e)}});function $b(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Tv(e))}}var ex,tx=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function nx(){return new tx}(ex=globalThis).__zod_globalRegistry??(ex.__zod_globalRegistry=nx());var rx=globalThis.__zod_globalRegistry;function ix(e,t){return new e({type:`string`,...uv(t)})}function ax(e,t){return new e({type:`string`,coerce:!0,...uv(t)})}function ox(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...uv(t)})}function sx(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...uv(t)})}function cx(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...uv(t)})}function lx(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...uv(t)})}function ux(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...uv(t)})}function dx(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...uv(t)})}function fx(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...uv(t)})}function px(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...uv(t)})}function mx(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...uv(t)})}function hx(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...uv(t)})}function gx(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...uv(t)})}function _x(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...uv(t)})}function vx(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...uv(t)})}function yx(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...uv(t)})}function bx(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...uv(t)})}function xx(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...uv(t)})}function Sx(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...uv(t)})}function Cx(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...uv(t)})}function wx(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...uv(t)})}function Tx(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...uv(t)})}function Ex(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...uv(t)})}function Dx(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...uv(t)})}function Ox(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...uv(t)})}function kx(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...uv(t)})}function Ax(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...uv(t)})}function jx(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...uv(t)})}function Mx(e,t){return new e({type:`number`,checks:[],...uv(t)})}function Nx(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...uv(t)})}function Px(e,t){return new e({type:`boolean`,...uv(t)})}function Fx(e){return new e({type:`any`})}function Ix(e){return new e({type:`unknown`})}function Lx(e,t){return new e({type:`never`,...uv(t)})}function Rx(e,t){return new Cy({check:`less_than`,...uv(t),value:e,inclusive:!1})}function zx(e,t){return new Cy({check:`less_than`,...uv(t),value:e,inclusive:!0})}function Bx(e,t){return new wy({check:`greater_than`,...uv(t),value:e,inclusive:!1})}function Vx(e,t){return new wy({check:`greater_than`,...uv(t),value:e,inclusive:!0})}function Hx(e,t){return new Ty({check:`multiple_of`,...uv(t),value:e})}function Ux(e,t){return new Dy({check:`max_length`,...uv(t),maximum:e})}function Wx(e,t){return new Oy({check:`min_length`,...uv(t),minimum:e})}function Gx(e,t){return new ky({check:`length_equals`,...uv(t),length:e})}function Kx(e,t){return new jy({check:`string_format`,format:`regex`,...uv(t),pattern:e})}function qx(e){return new My({check:`string_format`,format:`lowercase`,...uv(e)})}function Jx(e){return new Ny({check:`string_format`,format:`uppercase`,...uv(e)})}function Yx(e,t){return new Py({check:`string_format`,format:`includes`,...uv(t),includes:e})}function Xx(e,t){return new Fy({check:`string_format`,format:`starts_with`,...uv(t),prefix:e})}function Zx(e,t){return new Iy({check:`string_format`,format:`ends_with`,...uv(t),suffix:e})}function Qx(e){return new Ly({check:`overwrite`,tx:e})}function $x(e){return Qx(t=>t.normalize(e))}function eS(){return Qx(e=>e.trim())}function tS(){return Qx(e=>e.toLowerCase())}function nS(){return Qx(e=>e.toUpperCase())}function rS(){return Qx(e=>tv(e))}function iS(e,t,n){return new e({type:`array`,element:t,...uv(n)})}function aS(e,t,n){let r=uv(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function oS(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...uv(n)})}function sS(e){let t=cS(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Tv(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Tv(r))}},e(n.value,n)));return t}function cS(e,t){let n=new xy({check:`custom`,...uv(t)});return n._zod.check=e,n}function lS(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??rx,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function uS(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,uS(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&pS(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function dS(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function fS(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:hS(t,`input`,e.processors),output:hS(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function pS(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return pS(r.element,n);if(r.type===`set`)return pS(r.valueType,n);if(r.type===`lazy`)return pS(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return pS(r.innerType,n);if(r.type===`intersection`)return pS(r.left,n)||pS(r.right,n);if(r.type===`record`||r.type===`map`)return pS(r.keyType,n)||pS(r.valueType,n);if(r.type===`pipe`)return pS(r.in,n)||pS(r.out,n);if(r.type===`object`){for(let e in r.shape)if(pS(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(pS(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(pS(e,n))return!0;return!!(r.rest&&pS(r.rest,n))}return!1}var mS=(e,t={})=>n=>{let r=lS({...n,processors:t});return uS(e,r),dS(r,e),fS(r,e)},hS=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=lS({...i??{},target:a,io:t,processors:n});return uS(e,o),dS(o,e),fS(o,e)},gS={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_S=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=gS[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},vS=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},yS=(e,t,n,r)=>{n.type=`boolean`},bS=(e,t,n,r)=>{n.not={}},xS=(e,t,n,r)=>{let i=e._zod.def,a=W_(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},SS=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},CS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},wS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},TS=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=uS(a.element,t,{...r,path:[...r.path,`items`]})},ES=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=uS(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=uS(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},DS=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>uS(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},OS=(e,t,n,r)=>{let i=e._zod.def,a=uS(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=uS(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},kS=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=uS(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=uS(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=uS(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},AS=(e,t,n,r)=>{let i=e._zod.def,a=uS(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},jS=(e,t,n,r)=>{let i=e._zod.def;uS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},MS=(e,t,n,r)=>{let i=e._zod.def;uS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},NS=(e,t,n,r)=>{let i=e._zod.def;uS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},PS=(e,t,n,r)=>{let i=e._zod.def;uS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},FS=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;uS(a,t,r);let o=t.seen.get(e);o.ref=a},IS=(e,t,n,r)=>{let i=e._zod.def;uS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},LS=(e,t,n,r)=>{let i=e._zod.def;uS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},RS=X(`ZodISODateTime`,(e,t)=>{eb.init(e,t),uC.init(e,t)});function zS(e){return Ox(RS,e)}var BS=X(`ZodISODate`,(e,t)=>{tb.init(e,t),uC.init(e,t)});function VS(e){return kx(BS,e)}var HS=X(`ZodISOTime`,(e,t)=>{nb.init(e,t),uC.init(e,t)});function US(e){return Ax(HS,e)}var WS=X(`ZodISODuration`,(e,t)=>{rb.init(e,t),uC.init(e,t)});function GS(e){return jx(WS,e)}var KS=(e,t)=>{Dv.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Av(e,t)},flatten:{value:t=>kv(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,G_,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,G_,2)}},isEmpty:{get(){return e.issues.length===0}}})};X(`ZodError`,KS);var qS=X(`ZodError`,KS,{Parent:Error}),JS=jv(qS),YS=Mv(qS),XS=Nv(qS),ZS=Fv(qS),QS=Lv(qS),$S=Rv(qS),eC=zv(qS),tC=Bv(qS),nC=Vv(qS),rC=Hv(qS),iC=Uv(qS),aC=Wv(qS),oC=X(`ZodType`,(e,t)=>(By.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:hS(e,`input`),output:hS(e,`output`)}}),e.toJSONSchema=mS(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone($_(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>lv(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>JS(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>XS(e,t,n),e.parseAsync=async(t,n)=>YS(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ZS(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>QS(e,t,n),e.decode=(t,n)=>$S(e,t,n),e.encodeAsync=async(t,n)=>eC(e,t,n),e.decodeAsync=async(t,n)=>tC(e,t,n),e.safeEncode=(t,n)=>nC(e,t,n),e.safeDecode=(t,n)=>rC(e,t,n),e.safeEncodeAsync=async(t,n)=>iC(e,t,n),e.safeDecodeAsync=async(t,n)=>aC(e,t,n),e.refine=(t,n)=>e.check(Ew(t,n)),e.superRefine=t=>e.check(Dw(t)),e.overwrite=t=>e.check(Qx(t)),e.optional=()=>sw(e),e.exactOptional=()=>lw(e),e.nullable=()=>dw(e),e.nullish=()=>sw(dw(e)),e.nonoptional=t=>_w(e,t),e.array=()=>UC(e),e.or=t=>qC([e,t]),e.and=t=>ZC(e,t),e.transform=t=>xw(e,aw(t)),e.default=t=>pw(e,t),e.prefault=t=>hw(e,t),e.catch=t=>yw(e,t),e.pipe=t=>xw(e,t),e.readonly=()=>Cw(e),e.describe=t=>{let n=e.clone();return rx.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return rx.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return rx.get(e);let n=e.clone();return rx.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),sC=X(`_ZodString`,(e,t)=>{Vy.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_S(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Kx(...t)),e.includes=(...t)=>e.check(Yx(...t)),e.startsWith=(...t)=>e.check(Xx(...t)),e.endsWith=(...t)=>e.check(Zx(...t)),e.min=(...t)=>e.check(Wx(...t)),e.max=(...t)=>e.check(Ux(...t)),e.length=(...t)=>e.check(Gx(...t)),e.nonempty=(...t)=>e.check(Wx(1,...t)),e.lowercase=t=>e.check(qx(t)),e.uppercase=t=>e.check(Jx(t)),e.trim=()=>e.check(eS()),e.normalize=(...t)=>e.check($x(...t)),e.toLowerCase=()=>e.check(tS()),e.toUpperCase=()=>e.check(nS()),e.slugify=()=>e.check(rS())}),cC=X(`ZodString`,(e,t)=>{Vy.init(e,t),sC.init(e,t),e.email=t=>e.check(ox(dC,t)),e.url=t=>e.check(fx(mC,t)),e.jwt=t=>e.check(Dx(kC,t)),e.emoji=t=>e.check(px(hC,t)),e.guid=t=>e.check(sx(fC,t)),e.uuid=t=>e.check(cx(pC,t)),e.uuidv4=t=>e.check(lx(pC,t)),e.uuidv6=t=>e.check(ux(pC,t)),e.uuidv7=t=>e.check(dx(pC,t)),e.nanoid=t=>e.check(mx(gC,t)),e.guid=t=>e.check(sx(fC,t)),e.cuid=t=>e.check(hx(_C,t)),e.cuid2=t=>e.check(gx(vC,t)),e.ulid=t=>e.check(_x(yC,t)),e.base64=t=>e.check(wx(EC,t)),e.base64url=t=>e.check(Tx(DC,t)),e.xid=t=>e.check(vx(bC,t)),e.ksuid=t=>e.check(yx(xC,t)),e.ipv4=t=>e.check(bx(SC,t)),e.ipv6=t=>e.check(xx(CC,t)),e.cidrv4=t=>e.check(Sx(wC,t)),e.cidrv6=t=>e.check(Cx(TC,t)),e.e164=t=>e.check(Ex(OC,t)),e.datetime=t=>e.check(zS(t)),e.date=t=>e.check(VS(t)),e.time=t=>e.check(US(t)),e.duration=t=>e.check(GS(t))});function lC(e){return ix(cC,e)}var uC=X(`ZodStringFormat`,(e,t)=>{Hy.init(e,t),sC.init(e,t)}),dC=X(`ZodEmail`,(e,t)=>{Gy.init(e,t),uC.init(e,t)}),fC=X(`ZodGUID`,(e,t)=>{Uy.init(e,t),uC.init(e,t)}),pC=X(`ZodUUID`,(e,t)=>{Wy.init(e,t),uC.init(e,t)}),mC=X(`ZodURL`,(e,t)=>{Ky.init(e,t),uC.init(e,t)}),hC=X(`ZodEmoji`,(e,t)=>{qy.init(e,t),uC.init(e,t)}),gC=X(`ZodNanoID`,(e,t)=>{Jy.init(e,t),uC.init(e,t)}),_C=X(`ZodCUID`,(e,t)=>{Yy.init(e,t),uC.init(e,t)}),vC=X(`ZodCUID2`,(e,t)=>{Xy.init(e,t),uC.init(e,t)}),yC=X(`ZodULID`,(e,t)=>{Zy.init(e,t),uC.init(e,t)}),bC=X(`ZodXID`,(e,t)=>{Qy.init(e,t),uC.init(e,t)}),xC=X(`ZodKSUID`,(e,t)=>{$y.init(e,t),uC.init(e,t)}),SC=X(`ZodIPv4`,(e,t)=>{ib.init(e,t),uC.init(e,t)}),CC=X(`ZodIPv6`,(e,t)=>{ab.init(e,t),uC.init(e,t)}),wC=X(`ZodCIDRv4`,(e,t)=>{ob.init(e,t),uC.init(e,t)}),TC=X(`ZodCIDRv6`,(e,t)=>{sb.init(e,t),uC.init(e,t)}),EC=X(`ZodBase64`,(e,t)=>{lb.init(e,t),uC.init(e,t)}),DC=X(`ZodBase64URL`,(e,t)=>{db.init(e,t),uC.init(e,t)}),OC=X(`ZodE164`,(e,t)=>{fb.init(e,t),uC.init(e,t)}),kC=X(`ZodJWT`,(e,t)=>{mb.init(e,t),uC.init(e,t)}),AC=X(`ZodNumber`,(e,t)=>{hb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vS(e,t,n,r),e.gt=(t,n)=>e.check(Bx(t,n)),e.gte=(t,n)=>e.check(Vx(t,n)),e.min=(t,n)=>e.check(Vx(t,n)),e.lt=(t,n)=>e.check(Rx(t,n)),e.lte=(t,n)=>e.check(zx(t,n)),e.max=(t,n)=>e.check(zx(t,n)),e.int=t=>e.check(NC(t)),e.safe=t=>e.check(NC(t)),e.positive=t=>e.check(Bx(0,t)),e.nonnegative=t=>e.check(Vx(0,t)),e.negative=t=>e.check(Rx(0,t)),e.nonpositive=t=>e.check(zx(0,t)),e.multipleOf=(t,n)=>e.check(Hx(t,n)),e.step=(t,n)=>e.check(Hx(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function jC(e){return Mx(AC,e)}var MC=X(`ZodNumberFormat`,(e,t)=>{gb.init(e,t),AC.init(e,t)});function NC(e){return Nx(MC,e)}var PC=X(`ZodBoolean`,(e,t)=>{_b.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yS(e,t,n,r)});function FC(e){return Px(PC,e)}var IC=X(`ZodAny`,(e,t)=>{vb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function LC(){return Fx(IC)}var RC=X(`ZodUnknown`,(e,t)=>{yb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function zC(){return Ix(RC)}var BC=X(`ZodNever`,(e,t)=>{bb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bS(e,t,n,r)});function VC(e){return Lx(BC,e)}var HC=X(`ZodArray`,(e,t)=>{Sb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>TS(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Wx(t,n)),e.nonempty=t=>e.check(Wx(1,t)),e.max=(t,n)=>e.check(Ux(t,n)),e.length=(t,n)=>e.check(Gx(t,n)),e.unwrap=()=>e.element});function UC(e,t){return iS(HC,e,t)}var WC=X(`ZodObject`,(e,t)=>{Db.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ES(e,t,n,r),Z_(e,`shape`,()=>t.shape),e.keyof=()=>tw(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:zC()}),e.loose=()=>e.clone({...e._zod.def,catchall:zC()}),e.strict=()=>e.clone({...e._zod.def,catchall:VC()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>hv(e,t),e.safeExtend=t=>gv(e,t),e.merge=t=>_v(e,t),e.pick=t=>pv(e,t),e.omit=t=>mv(e,t),e.partial=(...t)=>vv(ow,e,t[0]),e.required=(...t)=>yv(gw,e,t[0])});function GC(e,t){return new WC({type:`object`,shape:e??{},...uv(t)})}var KC=X(`ZodUnion`,(e,t)=>{kb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>DS(e,t,n,r),e.options=t.options});function qC(e,t){return new KC({type:`union`,options:e,...uv(t)})}var JC=X(`ZodDiscriminatedUnion`,(e,t)=>{KC.init(e,t),Ab.init(e,t)});function YC(e,t,n){return new JC({type:`union`,options:t,discriminator:e,...uv(n)})}var XC=X(`ZodIntersection`,(e,t)=>{jb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>OS(e,t,n,r)});function ZC(e,t){return new XC({type:`intersection`,left:e,right:t})}var QC=X(`ZodRecord`,(e,t)=>{Pb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kS(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function $C(e,t,n){return new QC({type:`record`,keyType:e,valueType:t,...uv(n)})}var ew=X(`ZodEnum`,(e,t)=>{Fb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xS(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ew({...t,checks:[],...uv(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ew({...t,checks:[],...uv(r),entries:i})}});function tw(e,t){return new ew({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...uv(t)})}var nw=X(`ZodLiteral`,(e,t)=>{Ib.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>SS(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function rw(e,t){return new nw({type:`literal`,values:Array.isArray(e)?e:[e],...uv(t)})}var iw=X(`ZodTransform`,(e,t)=>{Lb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wS(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new V_(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Tv(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Tv(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function aw(e){return new iw({type:`transform`,transform:e})}var ow=X(`ZodOptional`,(e,t)=>{zb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>LS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sw(e){return new ow({type:`optional`,innerType:e})}var cw=X(`ZodExactOptional`,(e,t)=>{Bb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>LS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lw(e){return new cw({type:`optional`,innerType:e})}var uw=X(`ZodNullable`,(e,t)=>{Vb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>AS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dw(e){return new uw({type:`nullable`,innerType:e})}var fw=X(`ZodDefault`,(e,t)=>{Hb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>MS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pw(e,t){return new fw({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ov(t)}})}var mw=X(`ZodPrefault`,(e,t)=>{Wb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>NS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hw(e,t){return new mw({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ov(t)}})}var gw=X(`ZodNonOptional`,(e,t)=>{Gb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _w(e,t){return new gw({type:`nonoptional`,innerType:e,...uv(t)})}var vw=X(`ZodCatch`,(e,t)=>{qb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>PS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yw(e,t){return new vw({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var bw=X(`ZodPipe`,(e,t)=>{Jb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>FS(e,t,n,r),e.in=t.in,e.out=t.out});function xw(e,t){return new bw({type:`pipe`,in:e,out:t})}var Sw=X(`ZodReadonly`,(e,t)=>{Xb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>IS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cw(e){return new Sw({type:`readonly`,innerType:e})}var ww=X(`ZodCustom`,(e,t)=>{Qb.init(e,t),oC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>CS(e,t,n,r)});function Tw(e,t){return aS(ww,e??(()=>!0),t)}function Ew(e,t={}){return oS(ww,e,t)}function Dw(e){return sS(e)}function Ow(e,t={}){let n=new ww({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...uv(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function kw(e){return ax(cC,e)}function Aw(){return Tw(e=>typeof e==`function`)}function jw(e,t){return function(n){return n.refine(n=>{let r=n;return r[e]===void 0!=(r[t]===void 0)},{message:`Either ${e} or ${t} must be used, but not both.`,path:[t]})}}function Mw(){return function(e){return e}}function Nw(e,t){let n=e.safeParse(t);if(!n.success)throw new L({errorLevel:P.CRITICAL,effect:`Failed to run function due to invalid arguments. Check that the arguments that you are passing to the function match the type definition of the function.`,cause:n.error})}function Pw(e,t){return e.safeParse(t)}var Fw=[`zeroth`,`first`,`second`,`third`,`fourth`,`fifth`,`sixth`,`seventh`,`eighth`,`ninth`,`tenth`,`eleventh`,`twelfth`,`thirteenth`,`fourteenth`,`fifteenth`,`sixteenth`,`seventeenth`,`eighteenth`,`nineteenth`],Iw=[`twent`,`thirt`,`fort`,`fift`,`sixt`,`sevent`,`eight`,`ninet`];function Lw(e){return e<20?Fw[e]:e%10==0?Iw[Math.floor(e/10)-2]+`ieth`:Iw[Math.floor(e/10)-2]+`y-`+Fw[e%10]}function Rw(e){let t=``;for(let n of e.issues){let e=zw(n.path);t+=`✖ ${n.message??n.code} \n → at '${e}'\n`}return t.trim()}function zw(e){return!e||e.length===0?`unknown location`:e.map(e=>typeof e==`string`?e:typeof e==`symbol`?e.toString():Lw(e+1)+` element`).join(` > `)}function Bw(e,t,n){return jC({error:r=>r.input===void 0?`The ${e} action requires a specified ${n} with the '${t}' field.`:`The ${e} action requires the value of the '${t}' fields to be a number, but got ${typeof r.input}.`})}function Vw(e,t,n){return lC({error:r=>r.input===void 0?`The ${e} action requires a specified ${n} with the '${t}' field.`:`The ${e} action requires the value of the '${t}' fields to be a string, but got ${typeof r.input}.`})}function Hw(e,t,n){return kw({error:r=>r.input===void 0?`The ${e} action requires a specified ${n} with the '${t}' field.`:`The ${e} action requires the value of the '${t}' fields to be a string, but got ${typeof r.input}.`})}function Uw(e,t,n){return FC({error:r=>r.input===void 0?`The ${e} action requires a specified ${n} with the '${t}' field.`:`The ${e} action requires the value of the '${t}' fields to be a boolean, but got ${typeof r.input}.`})}var Ww=Mw()(GC({type:rw(Pt.COMMAND),command:Vw(`command`,`command`,`command to run`)})),Gw=Mw()(GC({type:rw(Pt.JS),file:Vw(`js`,`file`,`file path to the file to run`),args:$C(lC(),zC()).optional()})),Kw=Mw()(GC({type:rw(Pt.OPEN),link:Vw(`open`,`link`,`link to open`),newTab:Uw(`open`,`newTab`,``).optional()})),qw=Mw()(GC({type:rw(Pt.INPUT),str:Vw(`input`,`str`,`value to input`)})),Jw=Mw()(GC({type:rw(Pt.SLEEP),ms:Bw(`sleep`,`ms`,`duration`)})),Yw=Mw()(GC({type:rw(Pt.TEMPLATER_CREATE_NOTE),templateFile:Vw(`templaterCreateNote`,`templateFile`,`template file path`),folderPath:Vw(`templaterCreateNote`,`folderPath`,`folder path`).optional(),fileName:Vw(`templaterCreateNote`,`fileName`,`file name`).optional(),openNote:Uw(`templaterCreateNote`,`openNote`,`value for whether to open the note`).optional(),openIfAlreadyExists:Uw(`templaterCreateNote`,`openIfAlreadyExists`,`value for whether to open the note if it already exists`).optional()})),Xw=Mw()(GC({type:rw(Pt.RUN_TEMPLATER_FILE),templateFile:Vw(`runTemplaterFile`,`templateFile`,`template file path`)})),Zw=Mw()(GC({type:rw(Pt.UPDATE_METADATA),bindTarget:Vw(`updateMetadata`,`bindTarget`,`bind target to the metadata to update`),evaluate:Uw(`updateMetadata`,`evaluate`,`value for whether to evaluate the value as a JavaScript expression`),value:Hw(`updateMetadata`,`value for the update`,`value`)})),Qw=Mw()(GC({type:rw(Pt.CREATE_NOTE),folderPath:Vw(`createNote`,`folderPath`,`folder path`).optional(),fileName:Vw(`createNote`,`fileName`,`file name`),openNote:Uw(`createNote`,`openNote`,`value for whether to open the note`).optional(),openIfAlreadyExists:Uw(`createNote`,`openIfAlreadyExists`,`value for whether to open the note if it already exists`).optional()})),$w=Mw()(GC({type:rw(Pt.REPLACE_IN_NOTE),fromLine:Hw(`replaceInNote`,`fromLine`,`line to replace from`),toLine:Hw(`replaceInNote`,`toLine`,`line to replace to`),replacement:Vw(`replaceInNote`,`replacement`,`replacement string`),templater:Uw(`replaceInNote`,`templater`,`value for whether to use Templater`).optional()})),eT=Mw()(GC({type:rw(Pt.REPLACE_SELF),replacement:Vw(`replaceSelf`,`replacement`,`replacement string`),templater:Uw(`replaceSelf`,`templater`,`value for whether to use Templater`).optional()})),tT=Mw()(GC({type:rw(Pt.REGEXP_REPLACE_IN_NOTE),regexp:Vw(`regexpReplaceInNote`,`regexp`,`search regular expression`),regexpFlags:Vw(`regexpReplaceInNote`,`regexpFlags`,`regular expression flags string`).optional(),replacement:Vw(`regexpReplaceInNote`,`replacement`,`replacement string`)})),nT=Mw()(GC({type:rw(Pt.INSERT_INTO_NOTE),line:Hw(`insertIntoNote`,`line`,`line to insert at`),value:Vw(`insertIntoNote`,`value`,`string to insert`),templater:Uw(`insertIntoNote`,`templater`,`value for whether to use Templater`).optional()})),rT=Mw()(GC({type:rw(Pt.INLINE_JS),code:Vw(`inlineJS`,`code`,`code string to run`),args:$C(lC(),zC()).optional()})),iT=Mw()(YC(`type`,[Ww,Gw,Kw,qw,Jw,Yw,Zw,Qw,$w,eT,tT,nT,rT,Xw])),aT=tw(Nt),oT=Mw()(jw(`action`,`actions`)(GC({label:lC(),icon:lC().optional(),style:aT,class:lC().optional(),cssStyle:lC().optional(),backgroundImage:lC().optional(),tooltip:lC().optional(),id:lC().optional(),hidden:FC().optional(),action:iT.optional(),actions:iT.array().optional()}))),sT=_.sequenceMap((e,t)=>t,_.string(`BUTTON`),_.manyNotOf(`[],^`).separateBy(_.string(`,`).trim(w.optionalWhitespace())).wrapString(`[`,`]`)),cT=class{mb;constructor(e){this.mb=e}fromGroupString(e){let t=new Cn(`ButtonGroup`),n=[];try{n=se(sT,e)}catch(e){t.add(e)}return{declarationString:e,referencedButtonIds:n,errorCollection:t}}validateGroup(e){return{declarationString:void 0,referencedButtonIds:e.referencedButtonIds,errorCollection:new Cn(`ButtonGroup`)}}fromString(e){let t=new Cn(`Button`),n;try{let t=this.mb.internal.parseYaml(e);n=this.validateConfig(t)}catch(e){t.add(e)}return{declarationString:e,config:n,errorCollection:t}}validateConfig(e){let t=Pw(oT,e);if(!t.success){let e=Rw(t.error);throw new ae({errorLevel:P.ERROR,effect:`The validation for the button config failed.`,cause:`Your button syntax seems to be invalid. Check that your button config follows what is described in the docs.`,positionContext:e,docs:[Qg.linkToButtonConfig()]})}return t.data}validate(e){let t=new Cn(`Button`),n;try{n=this.validateConfig(e)}catch(e){t.add(e)}return{declarationString:void 0,config:n,errorCollection:t}}},lT=class{arguments=[];add(e){this.arguments.push(e)}validate(){let e={};for(let t of Object.values(V))e[t]=0;for(let t of this.arguments){let n=t.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new z({errorLevel:P.ERROR,effect:`failed to validate argument container`,cause:`argument '${n.type}' does not allow duplicates`,docs:[Qg.linkToSearch(n.type)]})}}mergeByOverride(e){for(let t of e.arguments){let e=t.getConfig();e.allowMultiple||(this.arguments=this.arguments.filter(t=>t.getConfig().type!==e.type)),this.arguments.push(t)}return this.validate(),this}mergeByThrow(e){for(let t of e.arguments){let e=t.getConfig();if(!e.allowMultiple&&this.arguments.filter(t=>t.getConfig().type===e.type).length>0)throw new z({errorLevel:P.ERROR,effect:`failed to merge argument container`,cause:`can not merge FieldArgumentContainers, since arguments overlap`});this.arguments.push(t)}return this.validate(),this}getAll(e){return this.arguments.filter(t=>t.getConfig().type===e)}get(e){return this.getAll(e).at(0)}},uT=class extends lT{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}},dT=class{value;parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,t){if(t.find(t=>t.length===e.length)===void 0)throw new z({errorLevel:P.WARNING,effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${t.map(e=>e.length===0?`none`:e.map(e=>`'${e.name}'`).join(`, `)).join(` or `)}. Received arguments of length ${e.length}.`,docs:[Qg.linkToSearch(this.getConfig().type)]})}isAllowed(e){return this.getConfig().allowedFieldTypes.length===0?!0:this.getConfig().allowedFieldTypes.includes(e)}getAllowedFieldsAsString(){return this.getConfig().allowedFieldTypes.length===0?`all`:this.getConfig().allowedFieldTypes.join(`, `)}},fT=class extends dT{},pT=class extends fT{value=!0;_parseValue(e){this.value=e[0]===void 0||e[0]?.value.toLowerCase()===`true`}getConfig(){return On.addLabels}},mT=class extends fT{value=!0;_parseValue(e){this.value=e[0]===void 0||e[0]?.value.toLowerCase()===`true`}getConfig(){return On.allowOther}},hT=class extends fT{value=[];_parseValue(e){this.value=e[0].value.split(` `)}getConfig(){return On.class}},gT=class extends fT{value=``;_parseValue(e){this.value=un(e[0].value)}getConfig(){return On.defaultValue}},_T=class extends fT{value=void 0;_parseValue(e){if(this.value=Number.parseInt(e[0].value),Number.isNaN(this.value))throw new z({errorLevel:P.WARNING,effect:`failed to set value for input field argument`,cause:`value of argument 'limit' must be of type number`,docs:[Qg.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new z({errorLevel:P.WARNING,effect:`failed to set value for input field argument`,cause:`value of argument 'limit' must be a positive number`,docs:[Qg.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return On.limit}},vT=class extends fT{value=100;_parseValue(e){if(this.value=Number.parseFloat(e[0].value),Number.isNaN(this.value))throw new z({errorLevel:P.WARNING,effect:`failed to set value for input field argument`,cause:`value of argument 'maxValue' must be of type number`,docs:[Qg.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return On.maxValue}},yT=class extends fT{value=0;_parseValue(e){if(this.value=Number.parseFloat(e[0].value),Number.isNaN(this.value))throw new z({errorLevel:P.WARNING,effect:`failed to set value for input field argument`,cause:`value of argument 'minValue' must be of type number`,docs:[Qg.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return On.minValue}},bT=class extends fT{value=!0;_parseValue(e){this.value=e[0]===void 0||e[0]?.value.toLowerCase()===`true`}getConfig(){return On.multiLine}},xT=class extends fT{value=!1;_parseValue(e){this.value=un(e[0].value)}getConfig(){return On.offValue}},ST=class extends fT{value=!0;_parseValue(e){this.value=un(e[0].value)}getConfig(){return On.onValue}},CT=class extends fT{value=``;name=``;_parseValue(e){e.length===1?(this.value=un(e[0].value),this.name=e[0].value):e.length===2&&(this.value=un(e[0].value),this.name=e[1].value)}getConfig(){return On.option}},wT=class extends fT{value=``;_parseValue(e){this.value=e[0].value}getConfig(){return On.optionQuery}},TT=class extends fT{value=``;_parseValue(e){this.value=e[0].value}getConfig(){return On.placeholder}},ET=class extends fT{value=!0;_parseValue(e){this.value=e[0]===void 0||e[0]?.value.toLowerCase()===`true`}getConfig(){return On.showcase}},DT=class extends fT{value=0;_parseValue(e){if(this.value=Number.parseFloat(e[0].value),Number.isNaN(this.value))throw new z({errorLevel:P.WARNING,effect:`failed to set value for input field argument`,cause:`value of argument 'stepSize' must be of type number`,docs:[Qg.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new z({errorLevel:P.WARNING,effect:`failed to set value for input field argument`,cause:`value of argument 'stepSize' must be a positive number`,docs:[Qg.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return On.stepSize}},OT=class extends fT{value=``;_parseValue(e){this.value=e[0].value}getConfig(){return On.title}};function kT(e,t,n){return n===Dn.TRUE?`[[${e}|${t}]]`:n===Dn.PARTIAL?`[[${t}]]`:`${t}`}var AT=class extends fT{value=Dn.TRUE;_parseValue(e){let t=e[0]?.value.toLowerCase();if(t===void 0){this.value=Dn.TRUE;return}if(t===Dn.TRUE||t===Dn.PARTIAL||t===Dn.FALSE){this.value=t;return}throw new z({errorLevel:P.WARNING,effect:`failed to set value for input field argument`,cause:`value of argument 'useLinks' must be one of ${Tt([Dn.TRUE,Dn.PARTIAL,Dn.FALSE],e=>`'${e}'`,`, `,`or`)}`,docs:[Qg.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return On.useLinks}},jT={[V.CLASS]:hT,[V.ADD_LABELS]:pT,[V.MIN_VALUE]:yT,[V.MAX_VALUE]:vT,[V.STEP_SIZE]:DT,[V.OPTION]:CT,[V.TITLE]:OT,[V.OPTION_QUERY]:wT,[V.SHOWCASE]:ET,[V.OFF_VALUE]:xT,[V.ON_VALUE]:ST,[V.DEFAULT_VALUE]:gT,[V.PLACEHOLDER]:TT,[V.USE_LINKS]:AT,[V.LIMIT]:_T,[V.ALLOW_OTHER]:mT,[V.MULTI_LINE]:bT},MT=class{static createInputFieldArgument(e){if(e in jT){let t=jT[e];if(t)return new t}throw new ee({errorLevel:P.WARNING,effect:`can not crate input field argument`,cause:`unknown argument '${e}'`})}},NT=class{unvalidatedDeclaration;errorCollection;filePath;mb;constructor(e,t,n){this.mb=e,this.unvalidatedDeclaration=t,this.filePath=n,this.errorCollection=new Cn(`input field declaration`)}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),r=this.validateArguments(t),i={declarationString:this.unvalidatedDeclaration.declarationString,inputFieldType:t,bindTarget:n,argumentContainer:r,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(i),i}validateInputFieldType(){let e=this.unvalidatedDeclaration.inputFieldType;for(let t of Object.entries(B))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new le(P.ERROR,`Declaration Validator`,`Encountered invalid identifier. Expected an input field type but received '${e?.value}'.`,this.unvalidatedDeclaration.declarationString,e?.position)),B.INVALID}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.bindTarget!==void 0)try{return this.mb.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.bindTarget,this.filePath,e)}catch(e){this.errorCollection.add(e)}}validateArguments(e){let t=new uT;for(let n of this.unvalidatedDeclaration.arguments){let r=this.validateArgumentType(n.name);if(r===V.INVALID)continue;let i=MT.createInputFieldArgument(r);if(!i.isAllowed(e)){this.errorCollection.add(new le(P.WARNING,`Declaration Validator`,`Failed to parse input field arguments. Argument "${n.name.value}" is only applicable to "${i.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.declarationString,n.name.position));continue}try{i.parseValue(n.value)}catch(e){this.errorCollection.add(e);continue}t.add(i)}try{t.validate()}catch(e){this.errorCollection.add(e)}return t}validateArgumentType(e){for(let t of Object.entries(V))if(t[1]===e.value)return t[1];return this.errorCollection.add(new le(P.WARNING,`Declaration Validator`,`Encountered invalid identifier. Expected an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),V.INVALID}},PT=_.sequenceMap((e,t,n)=>({inputFieldType:e,arguments:t,bindTarget:n===void 0?void 0:n[1]}),ue.node(_e).trim(w.optionalWhitespace()).describe(`input field type`),Pe.trim(w.optionalWhitespace()).wrap(_.string(`(`).describe(`arguments paren "("`),_.string(`)`).describe(`arguments paren ")"`)).trim(w.optionalWhitespace()).optional([]),_.sequence(_.string(`:`).trim(w.optionalWhitespace()).describe(`bind target separator ":"`),ke).trim(w.optionalWhitespace()).optional()),FT=_.sequenceMap((e,t,n)=>({inputFieldType:e,arguments:t,bindTarget:n===void 0?void 0:n[1]}),ue.node(_e).trim(w.optionalWhitespace()).optional().describe(`input field type`),Pe.trim(w.optionalWhitespace()).wrap(_.string(`(`).describe(`arguments paren "("`),_.string(`)`).describe(`arguments paren ")"`)).trim(w.optionalWhitespace()).optional([]),_.sequence(_.string(`:`).trim(w.optionalWhitespace()).describe(`bind target separator ":"`),ke).trim(w.optionalWhitespace()).optional()),IT=_.or(_.sequenceMap((e,t,n)=>(n.templateName=t,n),_.string(`INPUT`),_.sequenceMap((e,t,n)=>t,_.string(`[`),de.node(_e).trim(w.optionalWhitespace()).describe(`template name`),_.string(`]`).skip(w.optionalWhitespace())),FT.wrap(_.string(`[`),_.string(`]`)),w.eof()),_.sequenceMap((e,t)=>t,_.string(`INPUT`),PT.wrap(_.string(`[`),_.string(`]`)),w.eof())),LT=_.sequenceMap((e,t)=>t,_.string(`INPUT`),FT.wrap(_.string(`[`),_.string(`]`)),w.eof()),RT=class{mb;templates;constructor(e){this.mb=e,this.templates=[]}fromString(e){let t=new Cn(`InputField`);try{let n=se(IT,e),r=this.partialToFullDeclaration(n,e,t);return r=this.applyTemplate(r),r}catch(e){t.add(e)}return{declarationString:e,inputFieldType:{value:B.INVALID},bindTarget:void 0,arguments:[],errorCollection:t}}fromStringAndValidate(e,t,n){return this.validate(this.fromString(e),t,n)}fromSimpleDeclaration(e){return{declarationString:void 0,inputFieldType:ve(e.inputFieldType),bindTarget:this.mb.bindTargetParser.fromExistingDeclaration(e.bindTarget),arguments:(e.arguments??[]).map(e=>({name:ve(e.name),value:e.value.map(e=>ve(e))})),errorCollection:new Cn(`InputField`)}}fromSimpleDeclarationAndValidate(e,t,n){return this.validate(this.fromSimpleDeclaration(e),t,n)}partialToFullDeclaration(e,t,n){return{...structuredClone(e),declarationString:t,errorCollection:n}}validate(e,t,n){return new NT(this.mb,e,t).validate(n)}merge(e,t){let n;return e.bindTarget===void 0?n=t.bindTarget:(n=e.bindTarget,t.bindTarget?.storagePath!==void 0&&(n.storagePath=t.bindTarget.storagePath),t.bindTarget?.storageProp!==void 0&&(n.storageProp=t.bindTarget.storageProp)),{declarationString:t.declarationString,inputFieldType:t.inputFieldType??e.inputFieldType,bindTarget:n,arguments:t.arguments.concat(e.arguments).reduce((e,t)=>(e.find(e=>e.name===t.name)===void 0&&e.push(t),e),[]),errorCollection:new Cn(`input field declaration`).merge(e.errorCollection).merge(t.errorCollection)}}parseTemplateString(e){let t=new Cn(`InputFieldParser`);try{let n=se(LT,e);return this.partialToFullDeclaration(n,e,t)}catch(e){t.add(e)}return{declarationString:e,inputFieldType:{value:B.INVALID},bindTarget:void 0,arguments:[],errorCollection:t}}parseTemplates(e){this.templates=[];let t=new Cn(`input field template parser`);for(let n of e){let e=this.parseTemplateString(n.declaration);t.merge(e.errorCollection);let r={name:n.name,template:e};this.templates.push(xt(r))}return t}getTemplate(e){return this.templates.find(t=>t.name===e)?.template}applyTemplate(e){if(e.templateName===void 0)return e;let t=this.getTemplate(e.templateName.value);return t===void 0?(e.errorCollection.add(new le(P.WARNING,`Input Field Parser`,`Invalid template name. Could not find a template with the name '${e.templateName.value}'.`,e.declarationString,e.templateName.position,[`https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/templates/`])),e):this.merge(t,e)}},zT=class{mb;constructor(e){this.mb=e}fromString(e){let t=new Cn(`JsViewFieldDeclaration`);try{let n=se(Ve,e);return this.partialToFullDeclaration(n,e,t)}catch(e){t.add(e)}return{declarationString:e,errorCollection:t,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:``}}fromStringAndValidate(e,t){return this.validate(this.fromString(e),t)}fromSimpleDeclaration(e){let t=new Cn(`JsViewFieldDeclaration`);return{declarationString:void 0,code:e.code,bindTargetMappings:e.bindTargetMappings.map(e=>({bindTarget:this.mb.bindTargetParser.fromExistingDeclaration(e.bindTarget),name:e.name})),writeToBindTarget:this.mb.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),hidden:e.hidden??!1,errorCollection:t}}fromSimpleDeclarationAndValidate(e,t){return this.validate(this.fromSimpleDeclaration(e),t)}partialToFullDeclaration(e,t,n){let r=e;return r.declarationString=t,r.errorCollection=n,r.bindTargetMappings=[...r.bindTargetMappings],r}validate(e,t){let n={};n.declarationString=e.declarationString,n.errorCollection=e.errorCollection;try{return n.bindTargetMappings=e.bindTargetMappings.map(n=>({bindTarget:this.mb.bindTargetParser.validate(e.declarationString,n.bindTarget,t),name:n.name})),e.writeToBindTarget!==void 0&&(n.writeToBindTarget=this.mb.bindTargetParser.validate(e.declarationString,e.writeToBindTarget,t)),n.code=e.code,n.hidden=e.hidden,n}catch(e){n.errorCollection.add(e)}return{declarationString:e.declarationString,errorCollection:n.errorCollection,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:``}}},BT=class extends lT{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}},VT=class extends dT{},HT=class extends VT{value=[];_parseValue(e){this.value=e[0].value.split(` `)}getConfig(){return jn.class}},UT=class extends VT{value=!0;_parseValue(e){this.value=e[0]===void 0||e[0]?.value.toLowerCase()===`true`}getConfig(){return jn.hidden}},WT=class extends VT{value=!0;_parseValue(e){this.value=e[0]===void 0||e[0]?.value.toLowerCase()===`true`}getConfig(){return jn.renderMarkdown}},GT={[An.RENDER_MARKDOWN]:WT,[An.HIDDEN]:UT,[An.CLASS]:HT},KT=class{static createViewFieldArgument(e){if(e in GT){let t=GT[e];if(t)return new t}throw new ee({errorLevel:P.WARNING,effect:`can not crate view field argument`,cause:`unknown argument '${e}'`})}},qT=class{unvalidatedDeclaration;errorCollection;filePath;mb;constructor(e,t,n){this.unvalidatedDeclaration=e,this.mb=n,this.filePath=t,this.errorCollection=new Cn(`view field declaration`)}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),r=this.validateArguments(t),i=this.validateTemplateDeclaration(e),a={declarationString:this.unvalidatedDeclaration.declarationString,viewFieldType:t,writeToBindTarget:n,argumentContainer:r,templateDeclaration:i,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(a),a}validateInputFieldType(){let e=this.unvalidatedDeclaration.viewFieldType;if(e===void 0)return kn.MATH;for(let t of Object.entries(kn))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new le(P.ERROR,`Declaration Validator`,`Encountered invalid identifier. Expected a view field type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),kn.INVALID}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.writeToBindTarget!==void 0)return this.mb.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.writeToBindTarget,this.filePath,e)}validateArguments(e){let t=new BT;for(let n of this.unvalidatedDeclaration.arguments){let r=this.validateArgumentType(n.name);if(r===An.INVALID)continue;let i=KT.createViewFieldArgument(r);if(!i.isAllowed(e)){this.errorCollection.add(new le(P.WARNING,`Declaration Validator`,`Failed to parse view field arguments. Argument "${n.name.value}" is only applicable to "${i.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.declarationString,n.name.position));continue}try{i.parseValue(n.value)}catch(e){this.errorCollection.add(e);continue}t.add(i)}try{t.validate()}catch(e){this.errorCollection.add(e)}return t}validateArgumentType(e){for(let t of Object.entries(An))if(t[1]===e.value)return t[1];return this.errorCollection.add(new le(P.WARNING,`Declaration Validator`,`Encountered invalid identifier. Expected a view field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),An.INVALID}validateTemplateDeclaration(e){try{return this.unvalidatedDeclaration.templateDeclaration?.map(t=>typeof t==`string`?t:this.mb.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,t,this.filePath,e))??[]}catch(e){return this.errorCollection.add(e),[]}}},JT=class{mb;constructor(e){this.mb=e}fromString(e){let t=new Cn(`ViewFieldDeclaration`);try{let n=se(ze,e);return this.partialToFullDeclaration(n,e,t)}catch(e){t.add(e)}return{declarationString:e,errorCollection:t,viewFieldType:{value:kn.INVALID},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}fromStringAndValidate(e,t,n){return this.validate(this.fromString(e),t,n)}fromSimpleDeclaration(e){let t=new Cn(`ViewFieldDeclaration`);return{declarationString:void 0,templateDeclaration:(e.templateDeclaration??[]).map(e=>typeof e==`string`?e:this.mb.bindTargetParser.fromExistingDeclaration(e)),viewFieldType:ve(e.viewFieldType),arguments:(e.arguments??[]).map(e=>({name:ve(e.name),value:e.value.map(e=>ve(e))})),writeToBindTarget:this.mb.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),errorCollection:t}}fromSimpleDeclarationAndValidate(e,t,n){return this.validate(this.fromSimpleDeclaration(e),t,n)}partialToFullDeclaration(e,t,n){return{...structuredClone(e),declarationString:t,errorCollection:n}}validate(e,t,n){return new qT(e,t,this.mb).validate(n)}},YT=l(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):n.moment=r()})(e,(function(){"use strict";var e;function n(){return e.apply(null,arguments)}function r(t){e=t}function i(e){return e instanceof Array||Object.prototype.toString.call(e)===`[object Array]`}function a(e){return e!=null&&Object.prototype.toString.call(e)===`[object Object]`}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;for(var t in e)if(o(e,t))return!1;return!0}function c(e){return e===void 0}function l(e){return typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`}function u(e){return e instanceof Date||Object.prototype.toString.call(e)===`[object Date]`}function d(e,t){var n=[],r,i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function f(e,t){for(var n in t)o(t,n)&&(e[n]=t[n]);return o(t,`toString`)&&(e.toString=t.toString),o(t,`valueOf`)&&(e.valueOf=t.valueOf),e}function p(e,t,n,r){return or(e,t,n,r,!0).utc()}function m(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function h(e){return e._pf??=m(),e._pf}var g=Array.prototype.some?Array.prototype.some:function(e){var t=Object(this),n=t.length>>>0,r;for(r=0;r<n;r++)if(r in t&&e.call(this,t[r],r,t))return!0;return!1};function _(e){var t=null,n=!1,r=e._d&&!isNaN(e._d.getTime());if(r&&(t=h(e),n=g.call(t.parsedDateParts,function(e){return e!=null}),r=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict&&(r=r&&t.charsLeftOver===0&&t.unusedTokens.length===0&&t.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(e))e._isValid=r;else return r;return e._isValid}function v(e){var t=p(NaN);return e==null?h(t).userInvalidated=!0:f(h(t),e),t}var y=n.momentProperties=[],b=!1;function x(e,t){var n,r,i,a=y.length;if(c(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),c(t._i)||(e._i=t._i),c(t._f)||(e._f=t._f),c(t._l)||(e._l=t._l),c(t._strict)||(e._strict=t._strict),c(t._tzm)||(e._tzm=t._tzm),c(t._isUTC)||(e._isUTC=t._isUTC),c(t._offset)||(e._offset=t._offset),c(t._pf)||(e._pf=h(t)),c(t._locale)||(e._locale=t._locale),a>0)for(n=0;n<a;n++)r=y[n],i=t[r],c(i)||(e[r]=i);return e}function S(e){x(this,e),this._d=new Date(e._d==null?NaN:e._d.getTime()),this.isValid()||(this._d=new Date(NaN)),b===!1&&(b=!0,n.updateOffset(this),b=!1)}function C(e){return e instanceof S||e!=null&&e._isAMomentObject!=null}function w(e){n.suppressDeprecationWarnings===!1&&typeof console<`u`&&console.warn&&console.warn(`Deprecation warning: `+e)}function T(e,t){var r=!0;return f(function(){if(n.deprecationHandler!=null&&n.deprecationHandler(null,e),r){var i=[],a,s,c,l=arguments.length;for(s=0;s<l;s++){if(a=``,typeof arguments[s]==`object`){for(c in a+=`
[`+s+`] `,arguments[0])o(arguments[0],c)&&(a+=c+`: `+arguments[0][c]+`, `);a=a.slice(0,-2)}else a=arguments[s];i.push(a)}w(e+`
Arguments: `+Array.prototype.slice.call(i).join(``)+`
`+Error().stack),r=!1}return t.apply(this,arguments)},t)}var E={};function D(e,t){n.deprecationHandler!=null&&n.deprecationHandler(e,t),E[e]||(w(t),E[e]=!0)}n.suppressDeprecationWarnings=!1,n.deprecationHandler=null;function O(e){return typeof Function<`u`&&e instanceof Function||Object.prototype.toString.call(e)===`[object Function]`}function k(e){var t,n;for(n in e)o(e,n)&&(t=e[n],O(t)?this[n]=t:this[`_`+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+`|\\d{1,2}`)}function A(e,t){var n=f({},e),r;for(r in t)o(t,r)&&(a(e[r])&&a(t[r])?(n[r]={},f(n[r],e[r]),f(n[r],t[r])):t[r]==null?delete n[r]:n[r]=t[r]);for(r in e)o(e,r)&&!o(t,r)&&a(e[r])&&(n[r]=f({},n[r]));return n}function j(e){e!=null&&this.set(e)}var M=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)o(e,t)&&n.push(t);return n},N={sameDay:`[Today at] LT`,nextDay:`[Tomorrow at] LT`,nextWeek:`dddd [at] LT`,lastDay:`[Yesterday at] LT`,lastWeek:`[Last] dddd [at] LT`,sameElse:`L`};function P(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return O(r)?r.call(t,n):r}function F(e,t,n){var r=``+Math.abs(e),i=t-r.length;return(e>=0?n?`+`:``:`-`)+(10**Math.max(0,i)).toString().substr(1)+r}var I=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,L=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ee={},R={};function te(e,t,n,r){var i=r;typeof r==`string`&&(i=function(){return this[r]()}),e&&(R[e]=i),t&&(R[t[0]]=function(){return F(i.apply(this,arguments),t[1],t[2])}),n&&(R[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function z(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,``):e.replace(/\\/g,``)}function ne(e){var t=e.match(I),n,r;for(n=0,r=t.length;n<r;n++)R[t[n]]?t[n]=R[t[n]]:t[n]=z(t[n]);return function(n){var i=``,a;for(a=0;a<r;a++)i+=O(t[a])?t[a].call(n,e):t[a];return i}}function re(e,t){return e.isValid()?(t=ie(t,e.localeData()),ee[t]=ee[t]||ne(t),ee[t](e)):e.localeData().invalidDate()}function ie(e,t){var n=5;function r(e){return t.longDateFormat(e)||e}for(L.lastIndex=0;n>=0&&L.test(e);)e=e.replace(L,r),L.lastIndex=0,--n;return e}var ae={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`};function oe(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(I).map(function(e){return e===`MMMM`||e===`MM`||e===`DD`||e===`dddd`?e.slice(1):e}).join(``),this._longDateFormat[e])}var se=`Invalid date`;function ce(){return this._invalidDate}var le=`%d`,ue=/\d{1,2}/;function de(e){return this._ordinal.replace(`%d`,e)}var fe={future:`in %s`,past:`%s ago`,s:`a few seconds`,ss:`%d seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,w:`a week`,ww:`%d weeks`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function pe(e,t,n,r){var i=this._relativeTime[n];return O(i)?i(e,t,n,r):i.replace(/%d/i,e)}function me(e,t){var n=this._relativeTime[e>0?`future`:`past`];return O(n)?n(t):n.replace(/%s/i,t)}var he={D:`date`,dates:`date`,date:`date`,d:`day`,days:`day`,day:`day`,e:`weekday`,weekdays:`weekday`,weekday:`weekday`,E:`isoWeekday`,isoweekdays:`isoWeekday`,isoweekday:`isoWeekday`,DDD:`dayOfYear`,dayofyears:`dayOfYear`,dayofyear:`dayOfYear`,h:`hour`,hours:`hour`,hour:`hour`,ms:`millisecond`,milliseconds:`millisecond`,millisecond:`millisecond`,m:`minute`,minutes:`minute`,minute:`minute`,M:`month`,months:`month`,month:`month`,Q:`quarter`,quarters:`quarter`,quarter:`quarter`,s:`second`,seconds:`second`,second:`second`,gg:`weekYear`,weekyears:`weekYear`,weekyear:`weekYear`,GG:`isoWeekYear`,isoweekyears:`isoWeekYear`,isoweekyear:`isoWeekYear`,w:`week`,weeks:`week`,week:`week`,W:`isoWeek`,isoweeks:`isoWeek`,isoweek:`isoWeek`,y:`year`,years:`year`,year:`year`};function ge(e){return typeof e==`string`?he[e]||he[e.toLowerCase()]:void 0}function _e(e){var t={},n,r;for(r in e)o(e,r)&&(n=ge(r),n&&(t[n]=e[r]));return t}var ve={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ye(e){var t=[],n;for(n in e)o(e,n)&&t.push({unit:n,priority:ve[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}var be=/\d/,xe=/\d\d/,Se=/\d{3}/,Ce=/\d{4}/,we=/[+-]?\d{6}/,Te=/\d\d?/,Ee=/\d\d\d\d?/,De=/\d\d\d\d\d\d?/,Oe=/\d{1,3}/,ke=/\d{1,4}/,Ae=/[+-]?\d{1,6}/,je=/\d+/,Me=/[+-]?\d+/,Ne=/Z|[+-]\d\d:?\d\d/gi,Pe=/Z|[+-]\d\d(?::?\d\d)?/gi,Fe=/[+-]?\d+(\.\d{1,3})?/,Ie=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Le=/^[1-9]\d?/,Re=/^([1-9]\d|\d)/,ze={};function Be(e,t,n){ze[e]=O(t)?t:function(e,r){return e&&n?n:t}}function Ve(e,t){return o(ze,e)?ze[e](t._strict,t._locale):new RegExp(He(e))}function He(e){return Ue(e.replace(`\\`,``).replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,r,i){return t||n||r||i}))}function Ue(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,`\\$&`)}function We(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Ge(e){var t=+e,n=0;return t!==0&&isFinite(t)&&(n=We(t)),n}var Ke={};function qe(e,t){var n,r=t,i;for(typeof e==`string`&&(e=[e]),l(t)&&(r=function(e,n){n[t]=Ge(e)}),i=e.length,n=0;n<i;n++)Ke[e[n]]=r}function Je(e,t){qe(e,function(e,n,r,i){r._w=r._w||{},t(e,r._w,r,i)})}function Ye(e,t,n){t!=null&&o(Ke,e)&&Ke[e](t,n._a,n,e)}function Xe(e){return e%4==0&&e%100!=0||e%400==0}var Ze=0,Qe=1,$e=2,et=3,tt=4,nt=5,rt=6,it=7,at=8;te(`Y`,0,0,function(){var e=this.year();return e<=9999?F(e,4):`+`+e}),te(0,[`YY`,2],0,function(){return this.year()%100}),te(0,[`YYYY`,4],0,`year`),te(0,[`YYYYY`,5],0,`year`),te(0,[`YYYYYY`,6,!0],0,`year`),Be(`Y`,Me),Be(`YY`,Te,xe),Be(`YYYY`,ke,Ce),Be(`YYYYY`,Ae,we),Be(`YYYYYY`,Ae,we),qe([`YYYYY`,`YYYYYY`],Ze),qe(`YYYY`,function(e,t){t[Ze]=e.length===2?n.parseTwoDigitYear(e):Ge(e)}),qe(`YY`,function(e,t){t[Ze]=n.parseTwoDigitYear(e)}),qe(`Y`,function(e,t){t[Ze]=parseInt(e,10)});function ot(e){return Xe(e)?366:365}n.parseTwoDigitYear=function(e){return Ge(e)+(Ge(e)>68?1900:2e3)};var st=lt(`FullYear`,!0);function ct(){return Xe(this.year())}function lt(e,t){return function(r){return r==null?ut(this,e):(dt(this,e,r),n.updateOffset(this,t),this)}}function ut(e,t){if(!e.isValid())return NaN;var n=e._d,r=e._isUTC;switch(t){case`Milliseconds`:return r?n.getUTCMilliseconds():n.getMilliseconds();case`Seconds`:return r?n.getUTCSeconds():n.getSeconds();case`Minutes`:return r?n.getUTCMinutes():n.getMinutes();case`Hours`:return r?n.getUTCHours():n.getHours();case`Date`:return r?n.getUTCDate():n.getDate();case`Day`:return r?n.getUTCDay():n.getDay();case`Month`:return r?n.getUTCMonth():n.getMonth();case`FullYear`:return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function dt(e,t,n){var r,i,a,o,s;if(!(!e.isValid()||isNaN(n))){switch(r=e._d,i=e._isUTC,t){case`Milliseconds`:i?r.setUTCMilliseconds(n):r.setMilliseconds(n);return;case`Seconds`:i?r.setUTCSeconds(n):r.setSeconds(n);return;case`Minutes`:i?r.setUTCMinutes(n):r.setMinutes(n);return;case`Hours`:i?r.setUTCHours(n):r.setHours(n);return;case`Date`:i?r.setUTCDate(n):r.setDate(n);return;case`FullYear`:break;default:return}a=n,o=e.month(),s=e.date(),s=s===29&&o===1&&!Xe(a)?28:s,i?r.setUTCFullYear(a,o,s):r.setFullYear(a,o,s)}}function ft(e){return e=ge(e),O(this[e])?this[e]():this}function pt(e,t){if(typeof e==`object`){e=_e(e);var n=ye(e),r,i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(e=ge(e),O(this[e]))return this[e](t);return this}function mt(e,t){return(e%t+t)%t}var ht=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1};function gt(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=mt(t,12);return e+=(t-n)/12,n===1?Xe(e)?29:28:31-n%7%2}te(`M`,[`MM`,2],`Mo`,function(){return this.month()+1}),te(`MMM`,0,0,function(e){return this.localeData().monthsShort(this,e)}),te(`MMMM`,0,0,function(e){return this.localeData().months(this,e)}),Be(`M`,Te,Le),Be(`MM`,Te,xe),Be(`MMM`,function(e,t){return t.monthsShortRegex(e)}),Be(`MMMM`,function(e,t){return t.monthsRegex(e)}),qe([`M`,`MM`],function(e,t){t[Qe]=Ge(e)-1}),qe([`MMM`,`MMMM`],function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);i==null?h(n).invalidMonth=e:t[Qe]=i});var _t=`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),vt=`Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec`.split(`_`),yt=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,bt=Ie,xt=Ie;function St(e,t){return e?i(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||yt).test(t)?`format`:`standalone`][e.month()]:i(this._months)?this._months:this._months.standalone}function Ct(e,t){return e?i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[yt.test(t)?`format`:`standalone`][e.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function wt(e,t,n){var r,i,a,o=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)a=p([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(a,``).toLocaleLowerCase(),this._longMonthsParse[r]=this.months(a,``).toLocaleLowerCase();return n?t===`MMM`?(i=ht.call(this._shortMonthsParse,o),i===-1?null:i):(i=ht.call(this._longMonthsParse,o),i===-1?null:i):t===`MMM`?(i=ht.call(this._shortMonthsParse,o),i===-1?(i=ht.call(this._longMonthsParse,o),i===-1?null:i):i):(i=ht.call(this._longMonthsParse,o),i===-1?(i=ht.call(this._shortMonthsParse,o),i===-1?null:i):i)}function Tt(e,t,n){var r,i,a;if(this._monthsParseExact)return wt.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++)if(i=p([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=RegExp(`^`+this.months(i,``).replace(`.`,``)+`$`,`i`),this._shortMonthsParse[r]=RegExp(`^`+this.monthsShort(i,``).replace(`.`,``)+`$`,`i`)),!n&&!this._monthsParse[r]&&(a=`^`+this.months(i,``)+`|^`+this.monthsShort(i,``),this._monthsParse[r]=new RegExp(a.replace(`.`,``),`i`)),n&&t===`MMMM`&&this._longMonthsParse[r].test(e)||n&&t===`MMM`&&this._shortMonthsParse[r].test(e)||!n&&this._monthsParse[r].test(e))return r}function Et(e,t){if(!e.isValid())return e;if(typeof t==`string`){if(/^\d+$/.test(t))t=Ge(t);else if(t=e.localeData().monthsParse(t),!l(t))return e}var n=t,r=e.date();return r=r<29?r:Math.min(r,gt(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,r):e._d.setMonth(n,r),e}function Dt(e){return e==null?ut(this,`Month`):(Et(this,e),n.updateOffset(this,!0),this)}function Ot(){return gt(this.year(),this.month())}function kt(e){return this._monthsParseExact?(o(this,`_monthsRegex`)||jt.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(o(this,`_monthsShortRegex`)||(this._monthsShortRegex=bt),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function At(e){return this._monthsParseExact?(o(this,`_monthsRegex`)||jt.call(this),e?this._monthsStrictRegex:this._monthsRegex):(o(this,`_monthsRegex`)||(this._monthsRegex=xt),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function jt(){function e(e,t){return t.length-e.length}var t=[],n=[],r=[],i,a,o,s;for(i=0;i<12;i++)a=p([2e3,i]),o=Ue(this.monthsShort(a,``)),s=Ue(this.months(a,``)),t.push(o),n.push(s),r.push(s),r.push(o);t.sort(e),n.sort(e),r.sort(e),this._monthsRegex=RegExp(`^(`+r.join(`|`)+`)`,`i`),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp(`^(`+n.join(`|`)+`)`,`i`),this._monthsShortStrictRegex=RegExp(`^(`+t.join(`|`)+`)`,`i`)}function Mt(e,t,n,r,i,a,o){var s;return e<100&&e>=0?(s=new Date(e+400,t,n,r,i,a,o),isFinite(s.getFullYear())&&s.setFullYear(e)):s=new Date(e,t,n,r,i,a,o),s}function Nt(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Pt(e,t,n){var r=7+t-n;return-((7+Nt(e,0,r).getUTCDay()-t)%7)+r-1}function Ft(e,t,n,r,i){var a=(7+n-r)%7,o=Pt(e,r,i),s=1+7*(t-1)+a+o,c,l;return s<=0?(c=e-1,l=ot(c)+s):s>ot(e)?(c=e+1,l=s-ot(e)):(c=e,l=s),{year:c,dayOfYear:l}}function It(e,t,n){var r=Pt(e.year(),t,n),i=Math.floor((e.dayOfYear()-r-1)/7)+1,a,o;return i<1?(o=e.year()-1,a=i+Lt(o,t,n)):i>Lt(e.year(),t,n)?(a=i-Lt(e.year(),t,n),o=e.year()+1):(o=e.year(),a=i),{week:a,year:o}}function Lt(e,t,n){var r=Pt(e,t,n),i=Pt(e+1,t,n);return(ot(e)-r+i)/7}te(`w`,[`ww`,2],`wo`,`week`),te(`W`,[`WW`,2],`Wo`,`isoWeek`),Be(`w`,Te,Le),Be(`ww`,Te,xe),Be(`W`,Te,Le),Be(`WW`,Te,xe),Je([`w`,`ww`,`W`,`WW`],function(e,t,n,r){t[r.substr(0,1)]=Ge(e)});function Rt(e){return It(e,this._week.dow,this._week.doy).week}var zt={dow:0,doy:6};function Bt(){return this._week.dow}function Vt(){return this._week.doy}function Ht(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,`d`)}function Ut(e){var t=It(this,1,4).week;return e==null?t:this.add((e-t)*7,`d`)}te(`d`,0,`do`,`day`),te(`dd`,0,0,function(e){return this.localeData().weekdaysMin(this,e)}),te(`ddd`,0,0,function(e){return this.localeData().weekdaysShort(this,e)}),te(`dddd`,0,0,function(e){return this.localeData().weekdays(this,e)}),te(`e`,0,0,`weekday`),te(`E`,0,0,`isoWeekday`),Be(`d`,Te),Be(`e`,Te),Be(`E`,Te),Be(`dd`,function(e,t){return t.weekdaysMinRegex(e)}),Be(`ddd`,function(e,t){return t.weekdaysShortRegex(e)}),Be(`dddd`,function(e,t){return t.weekdaysRegex(e)}),Je([`dd`,`ddd`,`dddd`],function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);i==null?h(n).invalidWeekday=e:t.d=i}),Je([`d`,`e`,`E`],function(e,t,n,r){t[r]=Ge(e)});function Wt(e,t){return typeof e==`string`?isNaN(e)?(e=t.weekdaysParse(e),typeof e==`number`?e:null):parseInt(e,10):e}function Gt(e,t){return typeof e==`string`?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Kt(e,t){return e.slice(t,7).concat(e.slice(0,t))}var qt=`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),Jt=`Sun_Mon_Tue_Wed_Thu_Fri_Sat`.split(`_`),Yt=`Su_Mo_Tu_We_Th_Fr_Sa`.split(`_`),Xt=Ie,Zt=Ie,Qt=Ie;function $t(e,t){var n=i(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?`format`:`standalone`];return e===!0?Kt(n,this._week.dow):e?n[e.day()]:n}function en(e){return e===!0?Kt(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function tn(e){return e===!0?Kt(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function nn(e,t,n){var r,i,a,o=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)a=p([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(a,``).toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(a,``).toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(a,``).toLocaleLowerCase();return n?t===`dddd`?(i=ht.call(this._weekdaysParse,o),i===-1?null:i):t===`ddd`?(i=ht.call(this._shortWeekdaysParse,o),i===-1?null:i):(i=ht.call(this._minWeekdaysParse,o),i===-1?null:i):t===`dddd`?(i=ht.call(this._weekdaysParse,o),i!==-1||(i=ht.call(this._shortWeekdaysParse,o),i!==-1)?i:(i=ht.call(this._minWeekdaysParse,o),i===-1?null:i)):t===`ddd`?(i=ht.call(this._shortWeekdaysParse,o),i!==-1||(i=ht.call(this._weekdaysParse,o),i!==-1)?i:(i=ht.call(this._minWeekdaysParse,o),i===-1?null:i)):(i=ht.call(this._minWeekdaysParse,o),i!==-1||(i=ht.call(this._weekdaysParse,o),i!==-1)?i:(i=ht.call(this._shortWeekdaysParse,o),i===-1?null:i))}function rn(e,t,n){var r,i,a;if(this._weekdaysParseExact)return nn.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++)if(i=p([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=RegExp(`^`+this.weekdays(i,``).replace(`.`,`\\.?`)+`$`,`i`),this._shortWeekdaysParse[r]=RegExp(`^`+this.weekdaysShort(i,``).replace(`.`,`\\.?`)+`$`,`i`),this._minWeekdaysParse[r]=RegExp(`^`+this.weekdaysMin(i,``).replace(`.`,`\\.?`)+`$`,`i`)),this._weekdaysParse[r]||(a=`^`+this.weekdays(i,``)+`|^`+this.weekdaysShort(i,``)+`|^`+this.weekdaysMin(i,``),this._weekdaysParse[r]=new RegExp(a.replace(`.`,``),`i`)),n&&t===`dddd`&&this._fullWeekdaysParse[r].test(e)||n&&t===`ddd`&&this._shortWeekdaysParse[r].test(e)||n&&t===`dd`&&this._minWeekdaysParse[r].test(e)||!n&&this._weekdaysParse[r].test(e))return r}function an(e){if(!this.isValid())return e==null?NaN:this;var t=ut(this,`Day`);return e==null?t:(e=Wt(e,this.localeData()),this.add(e-t,`d`))}function on(e){if(!this.isValid())return e==null?NaN:this;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,`d`)}function sn(e){if(!this.isValid())return e==null?NaN:this;if(e!=null){var t=Gt(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function cn(e){return this._weekdaysParseExact?(o(this,`_weekdaysRegex`)||dn.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(o(this,`_weekdaysRegex`)||(this._weekdaysRegex=Xt),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function ln(e){return this._weekdaysParseExact?(o(this,`_weekdaysRegex`)||dn.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(o(this,`_weekdaysShortRegex`)||(this._weekdaysShortRegex=Zt),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function un(e){return this._weekdaysParseExact?(o(this,`_weekdaysRegex`)||dn.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(o(this,`_weekdaysMinRegex`)||(this._weekdaysMinRegex=Qt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function dn(){function e(e,t){return t.length-e.length}var t=[],n=[],r=[],i=[],a,o,s,c,l;for(a=0;a<7;a++)o=p([2e3,1]).day(a),s=Ue(this.weekdaysMin(o,``)),c=Ue(this.weekdaysShort(o,``)),l=Ue(this.weekdays(o,``)),t.push(s),n.push(c),r.push(l),i.push(s),i.push(c),i.push(l);t.sort(e),n.sort(e),r.sort(e),i.sort(e),this._weekdaysRegex=RegExp(`^(`+i.join(`|`)+`)`,`i`),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp(`^(`+r.join(`|`)+`)`,`i`),this._weekdaysShortStrictRegex=RegExp(`^(`+n.join(`|`)+`)`,`i`),this._weekdaysMinStrictRegex=RegExp(`^(`+t.join(`|`)+`)`,`i`)}function fn(){return this.hours()%12||12}function pn(){return this.hours()||24}te(`H`,[`HH`,2],0,`hour`),te(`h`,[`hh`,2],0,fn),te(`k`,[`kk`,2],0,pn),te(`hmm`,0,0,function(){return``+fn.apply(this)+F(this.minutes(),2)}),te(`hmmss`,0,0,function(){return``+fn.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)}),te(`Hmm`,0,0,function(){return``+this.hours()+F(this.minutes(),2)}),te(`Hmmss`,0,0,function(){return``+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)});function mn(e,t){te(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}mn(`a`,!0),mn(`A`,!1);function hn(e,t){return t._meridiemParse}Be(`a`,hn),Be(`A`,hn),Be(`H`,Te,Re),Be(`h`,Te,Le),Be(`k`,Te,Le),Be(`HH`,Te,xe),Be(`hh`,Te,xe),Be(`kk`,Te,xe),Be(`hmm`,Ee),Be(`hmmss`,De),Be(`Hmm`,Ee),Be(`Hmmss`,De),qe([`H`,`HH`],et),qe([`k`,`kk`],function(e,t,n){var r=Ge(e);t[et]=r===24?0:r}),qe([`a`,`A`],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),qe([`h`,`hh`],function(e,t,n){t[et]=Ge(e),h(n).bigHour=!0}),qe(`hmm`,function(e,t,n){var r=e.length-2;t[et]=Ge(e.substr(0,r)),t[tt]=Ge(e.substr(r)),h(n).bigHour=!0}),qe(`hmmss`,function(e,t,n){var r=e.length-4,i=e.length-2;t[et]=Ge(e.substr(0,r)),t[tt]=Ge(e.substr(r,2)),t[nt]=Ge(e.substr(i)),h(n).bigHour=!0}),qe(`Hmm`,function(e,t,n){var r=e.length-2;t[et]=Ge(e.substr(0,r)),t[tt]=Ge(e.substr(r))}),qe(`Hmmss`,function(e,t,n){var r=e.length-4,i=e.length-2;t[et]=Ge(e.substr(0,r)),t[tt]=Ge(e.substr(r,2)),t[nt]=Ge(e.substr(i))});function gn(e){return(e+``).toLowerCase().charAt(0)===`p`}var _n=/[ap]\.?m?\.?/i,vn=lt(`Hours`,!0);function yn(e,t,n){return e>11?n?`pm`:`PM`:n?`am`:`AM`}var bn={calendar:N,longDateFormat:ae,invalidDate:se,ordinal:le,dayOfMonthOrdinalParse:ue,relativeTime:fe,months:_t,monthsShort:vt,week:zt,weekdays:qt,weekdaysMin:Yt,weekdaysShort:Jt,meridiemParse:_n},xn={},Sn={},Cn;function wn(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n<r;n+=1)if(e[n]!==t[n])return n;return r}function Tn(e){return e&&e.toLowerCase().replace(`_`,`-`)}function B(e){for(var t=0,n,r,i,a;t<e.length;){for(a=Tn(e[t]).split(`-`),n=a.length,r=Tn(e[t+1]),r=r?r.split(`-`):null;n>0;){if(i=En(a.slice(0,n).join(`-`)),i)return i;if(r&&r.length>=n&&wn(a,r)>=n-1)break;n--}t++}return Cn}function V(e){return!!(e&&e.match(`^[^/\\\\]*$`))}function En(e){var n=null,r;if(xn[e]===void 0&&t!==void 0&&t&&t.exports&&V(e))try{n=Cn._abbr,r=require,r(`./locale/`+e),Dn(n)}catch{xn[e]=null}return xn[e]}function Dn(e,t){var n;return e&&(n=c(t)?An(e):On(e,t),n?Cn=n:typeof console<`u`&&console.warn&&console.warn(`Locale `+e+` not found. Did you forget to load it?`)),Cn._abbr}function On(e,t){if(t!==null){var n,r=bn;if(t.abbr=e,xn[e]!=null)D(`defineLocaleOverride`,`use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info.`),r=xn[e]._config;else if(t.parentLocale!=null)if(xn[t.parentLocale]!=null)r=xn[t.parentLocale]._config;else if(n=En(t.parentLocale),n!=null)r=n._config;else return Sn[t.parentLocale]||(Sn[t.parentLocale]=[]),Sn[t.parentLocale].push({name:e,config:t}),null;return xn[e]=new j(A(r,t)),Sn[e]&&Sn[e].forEach(function(e){On(e.name,e.config)}),Dn(e),xn[e]}else return delete xn[e],null}function kn(e,t){if(t!=null){var n,r,i=bn;xn[e]!=null&&xn[e].parentLocale!=null?xn[e].set(A(xn[e]._config,t)):(r=En(e),r!=null&&(i=r._config),t=A(i,t),r??(t.abbr=e),n=new j(t),n.parentLocale=xn[e],xn[e]=n),Dn(e)}else xn[e]!=null&&(xn[e].parentLocale==null?xn[e]!=null&&delete xn[e]:(xn[e]=xn[e].parentLocale,e===Dn()&&Dn(e)));return xn[e]}function An(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Cn;if(!i(e)){if(t=En(e),t)return t;e=[e]}return B(e)}function jn(){return M(xn)}function Mn(e){var t,n=e._a;return n&&h(e).overflow===-2&&(t=n[Qe]<0||n[Qe]>11?Qe:n[$e]<1||n[$e]>gt(n[Ze],n[Qe])?$e:n[et]<0||n[et]>24||n[et]===24&&(n[tt]!==0||n[nt]!==0||n[rt]!==0)?et:n[tt]<0||n[tt]>59?tt:n[nt]<0||n[nt]>59?nt:n[rt]<0||n[rt]>999?rt:-1,h(e)._overflowDayOfYear&&(t<Ze||t>$e)&&(t=$e),h(e)._overflowWeeks&&t===-1&&(t=it),h(e)._overflowWeekday&&t===-1&&(t=at),h(e).overflow=t),e}var Nn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Pn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Fn=/Z|[+-]\d\d(?::?\d\d)?/,In=[[`YYYYYY-MM-DD`,/[+-]\d{6}-\d\d-\d\d/],[`YYYY-MM-DD`,/\d{4}-\d\d-\d\d/],[`GGGG-[W]WW-E`,/\d{4}-W\d\d-\d/],[`GGGG-[W]WW`,/\d{4}-W\d\d/,!1],[`YYYY-DDD`,/\d{4}-\d{3}/],[`YYYY-MM`,/\d{4}-\d\d/,!1],[`YYYYYYMMDD`,/[+-]\d{10}/],[`YYYYMMDD`,/\d{8}/],[`GGGG[W]WWE`,/\d{4}W\d{3}/],[`GGGG[W]WW`,/\d{4}W\d{2}/,!1],[`YYYYDDD`,/\d{7}/],[`YYYYMM`,/\d{6}/,!1],[`YYYY`,/\d{4}/,!1]],Ln=[[`HH:mm:ss.SSSS`,/\d\d:\d\d:\d\d\.\d+/],[`HH:mm:ss,SSSS`,/\d\d:\d\d:\d\d,\d+/],[`HH:mm:ss`,/\d\d:\d\d:\d\d/],[`HH:mm`,/\d\d:\d\d/],[`HHmmss.SSSS`,/\d\d\d\d\d\d\.\d+/],[`HHmmss,SSSS`,/\d\d\d\d\d\d,\d+/],[`HHmmss`,/\d\d\d\d\d\d/],[`HHmm`,/\d\d\d\d/],[`HH`,/\d\d/]],Rn=/^\/?Date\((-?\d+)/i,zn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Bn={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Vn(e){var t,n,r=e._i,i=Nn.exec(r)||Pn.exec(r),a,o,s,c,l=In.length,u=Ln.length;if(i){for(h(e).iso=!0,t=0,n=l;t<n;t++)if(In[t][1].exec(i[1])){o=In[t][0],a=In[t][2]!==!1;break}if(o==null){e._isValid=!1;return}if(i[3]){for(t=0,n=u;t<n;t++)if(Ln[t][1].exec(i[3])){s=(i[2]||` `)+Ln[t][0];break}if(s==null){e._isValid=!1;return}}if(!a&&s!=null){e._isValid=!1;return}if(i[4])if(Fn.exec(i[4]))c=`Z`;else{e._isValid=!1;return}e._f=o+(s||``)+(c||``),$n(e)}else e._isValid=!1}function Hn(e,t,n,r,i,a){var o=[Un(e),vt.indexOf(t),parseInt(n,10),parseInt(r,10),parseInt(i,10)];return a&&o.push(parseInt(a,10)),o}function Un(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Wn(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).replace(/^\s\s*/,``).replace(/\s\s*$/,``)}function Gn(e,t,n){return e&&Jt.indexOf(e)!==new Date(t[0],t[1],t[2]).getDay()?(h(n).weekdayMismatch=!0,n._isValid=!1,!1):!0}function Kn(e,t,n){if(e)return Bn[e];if(t)return 0;var r=parseInt(n,10),i=r%100;return(r-i)/100*60+i}function qn(e){var t=zn.exec(Wn(e._i)),n;if(t){if(n=Hn(t[4],t[3],t[2],t[5],t[6],t[7]),!Gn(t[1],n,e))return;e._a=n,e._tzm=Kn(t[8],t[9],t[10]),e._d=Nt.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),h(e).rfc2822=!0}else e._isValid=!1}function Jn(e){var t=Rn.exec(e._i);if(t!==null){e._d=new Date(+t[1]);return}if(Vn(e),e._isValid===!1)delete e._isValid;else return;if(qn(e),e._isValid===!1)delete e._isValid;else return;e._strict?e._isValid=!1:n.createFromInputFallback(e)}n.createFromInputFallback=T(`value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.`,function(e){e._d=new Date(e._i+(e._useUTC?` UTC`:``))});function Yn(e,t,n){return e??t??n}function Xn(e){var t=new Date(n.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Zn(e){var t,n,r=[],i,a,o;if(!e._d){for(i=Xn(e),e._w&&e._a[$e]==null&&e._a[Qe]==null&&Qn(e),e._dayOfYear!=null&&(o=Yn(e._a[Ze],i[Ze]),(e._dayOfYear>ot(o)||e._dayOfYear===0)&&(h(e)._overflowDayOfYear=!0),n=Nt(o,0,e._dayOfYear),e._a[Qe]=n.getUTCMonth(),e._a[$e]=n.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=r[t]=i[t];for(;t<7;t++)e._a[t]=r[t]=e._a[t]==null?+(t===2):e._a[t];e._a[et]===24&&e._a[tt]===0&&e._a[nt]===0&&e._a[rt]===0&&(e._nextDay=!0,e._a[et]=0),e._d=(e._useUTC?Nt:Mt).apply(null,r),a=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[et]=24),e._w&&e._w.d!==void 0&&e._w.d!==a&&(h(e).weekdayMismatch=!0)}}function Qn(e){var t=e._w,n,r,i,a,o,s,c,l;t.GG!=null||t.W!=null||t.E!=null?(a=1,o=4,n=Yn(t.GG,e._a[Ze],It(sr(),1,4).year),r=Yn(t.W,1),i=Yn(t.E,1),(i<1||i>7)&&(c=!0)):(a=e._locale._week.dow,o=e._locale._week.doy,l=It(sr(),a,o),n=Yn(t.gg,e._a[Ze],l.year),r=Yn(t.w,l.week),t.d==null?t.e==null?i=a:(i=t.e+a,(t.e<0||t.e>6)&&(c=!0)):(i=t.d,(i<0||i>6)&&(c=!0))),r<1||r>Lt(n,a,o)?h(e)._overflowWeeks=!0:c==null?(s=Ft(n,r,i,a,o),e._a[Ze]=s.year,e._dayOfYear=s.dayOfYear):h(e)._overflowWeekday=!0}n.ISO_8601=function(){},n.RFC_2822=function(){};function $n(e){if(e._f===n.ISO_8601){Vn(e);return}if(e._f===n.RFC_2822){qn(e);return}e._a=[],h(e).empty=!0;var t=``+e._i,r,i,a,o,s,c=t.length,l=0,u,d;for(a=ie(e._f,e._locale).match(I)||[],d=a.length,r=0;r<d;r++)o=a[r],i=(t.match(Ve(o,e))||[])[0],i&&(s=t.substr(0,t.indexOf(i)),s.length>0&&h(e).unusedInput.push(s),t=t.slice(t.indexOf(i)+i.length),l+=i.length),R[o]?(i?h(e).empty=!1:h(e).unusedTokens.push(o),Ye(o,i,e)):e._strict&&!i&&h(e).unusedTokens.push(o);h(e).charsLeftOver=c-l,t.length>0&&h(e).unusedInput.push(t),e._a[et]<=12&&h(e).bigHour===!0&&e._a[et]>0&&(h(e).bigHour=void 0),h(e).parsedDateParts=e._a.slice(0),h(e).meridiem=e._meridiem,e._a[et]=er(e._locale,e._a[et],e._meridiem),u=h(e).era,u!==null&&(e._a[Ze]=e._locale.erasConvertYear(u,e._a[Ze])),Zn(e),Mn(e)}function er(e,t,n){var r;return n==null?t:e.meridiemHour==null?e.isPM==null?t:(r=e.isPM(n),r&&t<12&&(t+=12),!r&&t===12&&(t=0),t):e.meridiemHour(t,n)}function tr(e){var t,n,r,i,a,o,s=!1,c=e._f.length;if(c===0){h(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<c;i++)a=0,o=!1,t=x({},e),e._useUTC!=null&&(t._useUTC=e._useUTC),t._f=e._f[i],$n(t),_(t)&&(o=!0),a+=h(t).charsLeftOver,a+=h(t).unusedTokens.length*10,h(t).score=a,s?a<r&&(r=a,n=t):(r==null||a<r||o)&&(r=a,n=t,o&&(s=!0));f(e,n||t)}function nr(e){if(!e._d){var t=_e(e._i),n=t.day===void 0?t.date:t.day;e._a=d([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),Zn(e)}}function rr(e){var t=new S(Mn(ir(e)));return t._nextDay&&=(t.add(1,`d`),void 0),t}function ir(e){var t=e._i,n=e._f;return e._locale=e._locale||An(e._l),t===null||n===void 0&&t===``?v({nullInput:!0}):(typeof t==`string`&&(e._i=t=e._locale.preparse(t)),C(t)?new S(Mn(t)):(u(t)?e._d=t:i(n)?tr(e):n?$n(e):ar(e),_(e)||(e._d=null),e))}function ar(e){var t=e._i;c(t)?e._d=new Date(n.now()):u(t)?e._d=new Date(t.valueOf()):typeof t==`string`?Jn(e):i(t)?(e._a=d(t.slice(0),function(e){return parseInt(e,10)}),Zn(e)):a(t)?nr(e):l(t)?e._d=new Date(t):n.createFromInputFallback(e)}function or(e,t,n,r,o){var c={};return(t===!0||t===!1)&&(r=t,t=void 0),(n===!0||n===!1)&&(r=n,n=void 0),(a(e)&&s(e)||i(e)&&e.length===0)&&(e=void 0),c._isAMomentObject=!0,c._useUTC=c._isUTC=o,c._l=n,c._i=e,c._f=t,c._strict=r,rr(c)}function sr(e,t,n,r){return or(e,t,n,r,!1)}var cr=T(`moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/`,function(){var e=sr.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:v()}),lr=T(`moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/`,function(){var e=sr.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:v()});function ur(e,t){var n,r;if(t.length===1&&i(t[0])&&(t=t[0]),!t.length)return sr();for(n=t[0],r=1;r<t.length;++r)(!t[r].isValid()||t[r][e](n))&&(n=t[r]);return n}function dr(){return ur(`isBefore`,[].slice.call(arguments,0))}function fr(){return ur(`isAfter`,[].slice.call(arguments,0))}var pr=function(){return Date.now?Date.now():+new Date},mr=[`year`,`quarter`,`month`,`week`,`day`,`hour`,`minute`,`second`,`millisecond`];function hr(e){var t,n=!1,r,i=mr.length;for(t in e)if(o(e,t)&&!(ht.call(mr,t)!==-1&&(e[t]==null||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[mr[r]]){if(n)return!1;parseFloat(e[mr[r]])!==Ge(e[mr[r]])&&(n=!0)}return!0}function gr(){return this._isValid}function _r(){return zr(NaN)}function vr(e){var t=_e(e),n=t.year||0,r=t.quarter||0,i=t.month||0,a=t.week||t.isoWeek||0,o=t.day||0,s=t.hour||0,c=t.minute||0,l=t.second||0,u=t.millisecond||0;this._isValid=hr(t),this._milliseconds=+u+l*1e3+c*6e4+s*1e3*60*60,this._days=+o+a*7,this._months=+i+r*3+n*12,this._data={},this._locale=An(),this._bubble()}function yr(e){return e instanceof vr}function br(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function xr(e,t,n){var r=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),a=0,o;for(o=0;o<r;o++)(n&&e[o]!==t[o]||!n&&Ge(e[o])!==Ge(t[o]))&&a++;return a+i}function Sr(e,t){te(e,0,0,function(){var e=this.utcOffset(),n=`+`;return e<0&&(e=-e,n=`-`),n+F(~~(e/60),2)+t+F(~~e%60,2)})}Sr(`Z`,`:`),Sr(`ZZ`,``),Be(`Z`,Pe),Be(`ZZ`,Pe),qe([`Z`,`ZZ`],function(e,t,n){n._useUTC=!0,n._tzm=wr(Pe,e)});var Cr=/([\+\-]|\d\d)/gi;function wr(e,t){var n=(t||``).match(e),r,i,a;return n===null?null:(r=n[n.length-1]||[],i=(r+``).match(Cr)||[`-`,0,0],a=+(i[1]*60)+Ge(i[2]),a===0?0:i[0]===`+`?a:-a)}function Tr(e,t){var r,i;return t._isUTC?(r=t.clone(),i=(C(e)||u(e)?e.valueOf():sr(e).valueOf())-r.valueOf(),r._d.setTime(r._d.valueOf()+i),n.updateOffset(r,!1),r):sr(e).local()}function Er(e){return-Math.round(e._d.getTimezoneOffset())}n.updateOffset=function(){};function Dr(e,t,r){var i=this._offset||0,a;if(!this.isValid())return e==null?NaN:this;if(e!=null){if(typeof e==`string`){if(e=wr(Pe,e),e===null)return this}else Math.abs(e)<16&&!r&&(e*=60);return!this._isUTC&&t&&(a=Er(this)),this._offset=e,this._isUTC=!0,a!=null&&this.add(a,`m`),i!==e&&(!t||this._changeInProgress?Wr(this,zr(e-i,`m`),1,!1):this._changeInProgress||=(this._changeInProgress=!0,n.updateOffset(this,!0),null)),this}else return this._isUTC?i:Er(this)}function Or(e,t){return e==null?-this.utcOffset():(typeof e!=`string`&&(e=-e),this.utcOffset(e,t),this)}function kr(e){return this.utcOffset(0,e)}function Ar(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Er(this),`m`)),this}function jr(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i==`string`){var e=wr(Ne,this._i);e==null?this.utcOffset(0,!0):this.utcOffset(e)}return this}function Mr(e){return this.isValid()?(e=e?sr(e).utcOffset():0,(this.utcOffset()-e)%60==0):!1}function Nr(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Pr(){if(!c(this._isDSTShifted))return this._isDSTShifted;var e={},t;return x(e,this),e=ir(e),e._a?(t=e._isUTC?p(e._a):sr(e._a),this._isDSTShifted=this.isValid()&&xr(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Fr(){return this.isValid()?!this._isUTC:!1}function H(){return this.isValid()?this._isUTC:!1}function Ir(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Lr=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Rr=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function zr(e,t){var n=e,r=null,i,a,s;return yr(e)?n={ms:e._milliseconds,d:e._days,M:e._months}:l(e)||!isNaN(+e)?(n={},t?n[t]=+e:n.milliseconds=+e):(r=Lr.exec(e))?(i=r[1]===`-`?-1:1,n={y:0,d:Ge(r[$e])*i,h:Ge(r[et])*i,m:Ge(r[tt])*i,s:Ge(r[nt])*i,ms:Ge(br(r[rt]*1e3))*i}):(r=Rr.exec(e))?(i=r[1]===`-`?-1:1,n={y:Br(r[2],i),M:Br(r[3],i),w:Br(r[4],i),d:Br(r[5],i),h:Br(r[6],i),m:Br(r[7],i),s:Br(r[8],i)}):n==null?n={}:typeof n==`object`&&(`from`in n||`to`in n)&&(s=Hr(sr(n.from),sr(n.to)),n={},n.ms=s.milliseconds,n.M=s.months),a=new vr(n),yr(e)&&o(e,`_locale`)&&(a._locale=e._locale),yr(e)&&o(e,`_isValid`)&&(a._isValid=e._isValid),a}zr.fn=vr.prototype,zr.invalid=_r;function Br(e,t){var n=e&&parseFloat(e.replace(`,`,`.`));return(isNaN(n)?0:n)*t}function Vr(e,t){var n={};return n.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(n.months,`M`).isAfter(t)&&--n.months,n.milliseconds=t-+e.clone().add(n.months,`M`),n}function Hr(e,t){var n;return e.isValid()&&t.isValid()?(t=Tr(t,e),e.isBefore(t)?n=Vr(e,t):(n=Vr(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Ur(e,t){return function(n,r){var i,a;return r!==null&&!isNaN(+r)&&(D(t,`moment().`+t+`(period, number) is deprecated. Please use moment().`+t+`(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.`),a=n,n=r,r=a),i=zr(n,r),Wr(this,i,e),this}}function Wr(e,t,r,i){var a=t._milliseconds,o=br(t._days),s=br(t._months);e.isValid()&&(i??=!0,s&&Et(e,ut(e,`Month`)+s*r),o&&dt(e,`Date`,ut(e,`Date`)+o*r),a&&e._d.setTime(e._d.valueOf()+a*r),i&&n.updateOffset(e,o||s))}var Gr=Ur(1,`add`),Kr=Ur(-1,`subtract`);function qr(e){return typeof e==`string`||e instanceof String}function Jr(e){return C(e)||u(e)||qr(e)||l(e)||Xr(e)||Yr(e)||e==null}function Yr(e){var t=a(e)&&!s(e),n=!1,r=[`years`,`year`,`y`,`months`,`month`,`M`,`days`,`day`,`d`,`dates`,`date`,`D`,`hours`,`hour`,`h`,`minutes`,`minute`,`m`,`seconds`,`second`,`s`,`milliseconds`,`millisecond`,`ms`],i,c,l=r.length;for(i=0;i<l;i+=1)c=r[i],n||=o(e,c);return t&&n}function Xr(e){var t=i(e),n=!1;return t&&(n=e.filter(function(t){return!l(t)&&qr(e)}).length===0),t&&n}function Zr(e){var t=a(e)&&!s(e),n=!1,r=[`sameDay`,`nextDay`,`lastDay`,`nextWeek`,`lastWeek`,`sameElse`],i,c;for(i=0;i<r.length;i+=1)c=r[i],n||=o(e,c);return t&&n}function Qr(e,t){var n=e.diff(t,`days`,!0);return n<-6?`sameElse`:n<-1?`lastWeek`:n<0?`lastDay`:n<1?`sameDay`:n<2?`nextDay`:n<7?`nextWeek`:`sameElse`}function $r(e,t){arguments.length===1&&(arguments[0]?Jr(arguments[0])?(e=arguments[0],t=void 0):Zr(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var r=e||sr(),i=Tr(r,this).startOf(`day`),a=n.calendarFormat(this,i)||`sameElse`,o=t&&(O(t[a])?t[a].call(this,r):t[a]);return this.format(o||this.localeData().calendar(a,this,sr(r)))}function ei(){return new S(this)}function ti(e,t){var n=C(e)?e:sr(e);return this.isValid()&&n.isValid()?(t=ge(t)||`millisecond`,t===`millisecond`?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf()):!1}function ni(e,t){var n=C(e)?e:sr(e);return this.isValid()&&n.isValid()?(t=ge(t)||`millisecond`,t===`millisecond`?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf()):!1}function ri(e,t,n,r){var i=C(e)?e:sr(e),a=C(t)?t:sr(t);return this.isValid()&&i.isValid()&&a.isValid()?(r||=`()`,(r[0]===`(`?this.isAfter(i,n):!this.isBefore(i,n))&&(r[1]===`)`?this.isBefore(a,n):!this.isAfter(a,n))):!1}function ii(e,t){var n=C(e)?e:sr(e),r;return this.isValid()&&n.isValid()?(t=ge(t)||`millisecond`,t===`millisecond`?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf())):!1}function ai(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function oi(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function si(e,t,n){var r,i,a;if(!this.isValid()||(r=Tr(e,this),!r.isValid()))return NaN;switch(i=(r.utcOffset()-this.utcOffset())*6e4,t=ge(t),t){case`year`:a=ci(this,r)/12;break;case`month`:a=ci(this,r);break;case`quarter`:a=ci(this,r)/3;break;case`second`:a=(this-r)/1e3;break;case`minute`:a=(this-r)/6e4;break;case`hour`:a=(this-r)/36e5;break;case`day`:a=(this-r-i)/864e5;break;case`week`:a=(this-r-i)/6048e5;break;default:a=this-r}return n?a:We(a)}function ci(e,t){if(e.date()<t.date())return-ci(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),r=e.clone().add(n,`months`),i,a;return t-r<0?(i=e.clone().add(n-1,`months`),a=(t-r)/(r-i)):(i=e.clone().add(n+1,`months`),a=(t-r)/(i-r)),-(n+a)||0}n.defaultFormat=`YYYY-MM-DDTHH:mm:ssZ`,n.defaultFormatUtc=`YYYY-MM-DDTHH:mm:ss[Z]`;function li(){return this.clone().locale(`en`).format(`ddd MMM DD YYYY HH:mm:ss [GMT]ZZ`)}function ui(e){if(!this.isValid())return null;var t=e!==!0,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?re(n,t?`YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]`:`YYYYYY-MM-DD[T]HH:mm:ss.SSSZ`):O(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace(`Z`,re(n,`Z`)):re(n,t?`YYYY-MM-DD[T]HH:mm:ss.SSS[Z]`:`YYYY-MM-DD[T]HH:mm:ss.SSSZ`)}function di(){if(!this.isValid())return`moment.invalid(/* `+this._i+` */)`;var e=`moment`,t=``,n,r,i,a;return this.isLocal()||(e=this.utcOffset()===0?`moment.utc`:`moment.parseZone`,t=`Z`),n=`[`+e+`("]`,r=0<=this.year()&&this.year()<=9999?`YYYY`:`YYYYYY`,i=`-MM-DD[T]HH:mm:ss.SSS`,a=t+`[")]`,this.format(n+r+i+a)}function fi(e){e||=this.isUtc()?n.defaultFormatUtc:n.defaultFormat;var t=re(this,e);return this.localeData().postformat(t)}function pi(e,t){return this.isValid()&&(C(e)&&e.isValid()||sr(e).isValid())?zr({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function mi(e){return this.from(sr(),e)}function hi(e,t){return this.isValid()&&(C(e)&&e.isValid()||sr(e).isValid())?zr({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function gi(e){return this.to(sr(),e)}function _i(e){var t;return e===void 0?this._locale._abbr:(t=An(e),t!=null&&(this._locale=t),this)}var vi=T(`moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.`,function(e){return e===void 0?this.localeData():this.locale(e)});function yi(){return this._locale}var bi=1e3,xi=60*bi,Si=60*xi,Ci=146097*24*Si;function wi(e,t){return(e%t+t)%t}function Ti(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-Ci:new Date(e,t,n).valueOf()}function Ei(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-Ci:Date.UTC(e,t,n)}function Di(e){var t,r;if(e=ge(e),e===void 0||e===`millisecond`||!this.isValid())return this;switch(r=this._isUTC?Ei:Ti,e){case`year`:t=r(this.year(),0,1);break;case`quarter`:t=r(this.year(),this.month()-this.month()%3,1);break;case`month`:t=r(this.year(),this.month(),1);break;case`week`:t=r(this.year(),this.month(),this.date()-this.weekday());break;case`isoWeek`:t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case`day`:case`date`:t=r(this.year(),this.month(),this.date());break;case`hour`:t=this._d.valueOf(),t-=wi(t+(this._isUTC?0:this.utcOffset()*xi),Si);break;case`minute`:t=this._d.valueOf(),t-=wi(t,xi);break;case`second`:t=this._d.valueOf(),t-=wi(t,bi);break}return this._d.setTime(t),n.updateOffset(this,!0),this}function Oi(e){var t,r;if(e=ge(e),e===void 0||e===`millisecond`||!this.isValid())return this;switch(r=this._isUTC?Ei:Ti,e){case`year`:t=r(this.year()+1,0,1)-1;break;case`quarter`:t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case`month`:t=r(this.year(),this.month()+1,1)-1;break;case`week`:t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case`isoWeek`:t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case`day`:case`date`:t=r(this.year(),this.month(),this.date()+1)-1;break;case`hour`:t=this._d.valueOf(),t+=Si-wi(t+(this._isUTC?0:this.utcOffset()*xi),Si)-1;break;case`minute`:t=this._d.valueOf(),t+=xi-wi(t,xi)-1;break;case`second`:t=this._d.valueOf(),t+=bi-wi(t,bi)-1;break}return this._d.setTime(t),n.updateOffset(this,!0),this}function ki(){return this._d.valueOf()-(this._offset||0)*6e4}function Ai(){return Math.floor(this.valueOf()/1e3)}function ji(){return new Date(this.valueOf())}function Mi(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Ni(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Pi(){return this.isValid()?this.toISOString():null}function Fi(){return _(this)}function Ii(){return f({},h(this))}function Li(){return h(this).overflow}function Ri(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}te(`N`,0,0,`eraAbbr`),te(`NN`,0,0,`eraAbbr`),te(`NNN`,0,0,`eraAbbr`),te(`NNNN`,0,0,`eraName`),te(`NNNNN`,0,0,`eraNarrow`),te(`y`,[`y`,1],`yo`,`eraYear`),te(`y`,[`yy`,2],0,`eraYear`),te(`y`,[`yyy`,3],0,`eraYear`),te(`y`,[`yyyy`,4],0,`eraYear`),Be(`N`,Yi),Be(`NN`,Yi),Be(`NNN`,Yi),Be(`NNNN`,Xi),Be(`NNNNN`,Zi),qe([`N`,`NN`,`NNN`,`NNNN`,`NNNNN`],function(e,t,n,r){var i=n._locale.erasParse(e,r,n._strict);i?h(n).era=i:h(n).invalidEra=e}),Be(`y`,je),Be(`yy`,je),Be(`yyy`,je),Be(`yyyy`,je),Be(`yo`,Qi),qe([`y`,`yy`,`yyy`,`yyyy`],Ze),qe([`yo`],function(e,t,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[Ze]=n._locale.eraYearOrdinalParse(e,i):t[Ze]=parseInt(e,10)});function zi(e,t){var r,i,a,o=this._eras||An(`en`)._eras;for(r=0,i=o.length;r<i;++r){switch(typeof o[r].since){case`string`:a=n(o[r].since).startOf(`day`),o[r].since=a.valueOf();break}switch(typeof o[r].until){case`undefined`:o[r].until=1/0;break;case`string`:a=n(o[r].until).startOf(`day`).valueOf(),o[r].until=a.valueOf();break}}return o}function Bi(e,t,n){var r,i,a=this.eras(),o,s,c;for(e=e.toUpperCase(),r=0,i=a.length;r<i;++r)if(o=a[r].name.toUpperCase(),s=a[r].abbr.toUpperCase(),c=a[r].narrow.toUpperCase(),n)switch(t){case`N`:case`NN`:case`NNN`:if(s===e)return a[r];break;case`NNNN`:if(o===e)return a[r];break;case`NNNNN`:if(c===e)return a[r];break}else if([o,s,c].indexOf(e)>=0)return a[r]}function Vi(e,t){var r=e.since<=e.until?1:-1;return t===void 0?n(e.since).year():n(e.since).year()+(t-e.offset)*r}function Hi(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(n=this.clone().startOf(`day`).valueOf(),r[e].since<=n&&n<=r[e].until||r[e].until<=n&&n<=r[e].since)return r[e].name;return``}function Ui(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(n=this.clone().startOf(`day`).valueOf(),r[e].since<=n&&n<=r[e].until||r[e].until<=n&&n<=r[e].since)return r[e].narrow;return``}function Wi(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e)if(n=this.clone().startOf(`day`).valueOf(),r[e].since<=n&&n<=r[e].until||r[e].until<=n&&n<=r[e].since)return r[e].abbr;return``}function Gi(){var e,t,r,i,a=this.localeData().eras();for(e=0,t=a.length;e<t;++e)if(r=a[e].since<=a[e].until?1:-1,i=this.clone().startOf(`day`).valueOf(),a[e].since<=i&&i<=a[e].until||a[e].until<=i&&i<=a[e].since)return(this.year()-n(a[e].since).year())*r+a[e].offset;return this.year()}function Ki(e){return o(this,`_erasNameRegex`)||$i.call(this),e?this._erasNameRegex:this._erasRegex}function qi(e){return o(this,`_erasAbbrRegex`)||$i.call(this),e?this._erasAbbrRegex:this._erasRegex}function Ji(e){return o(this,`_erasNarrowRegex`)||$i.call(this),e?this._erasNarrowRegex:this._erasRegex}function Yi(e,t){return t.erasAbbrRegex(e)}function Xi(e,t){return t.erasNameRegex(e)}function Zi(e,t){return t.erasNarrowRegex(e)}function Qi(e,t){return t._eraYearOrdinalRegex||je}function $i(){var e=[],t=[],n=[],r=[],i,a,o,s,c,l=this.eras();for(i=0,a=l.length;i<a;++i)o=Ue(l[i].name),s=Ue(l[i].abbr),c=Ue(l[i].narrow),t.push(o),e.push(s),n.push(c),r.push(o),r.push(s),r.push(c);this._erasRegex=RegExp(`^(`+r.join(`|`)+`)`,`i`),this._erasNameRegex=RegExp(`^(`+t.join(`|`)+`)`,`i`),this._erasAbbrRegex=RegExp(`^(`+e.join(`|`)+`)`,`i`),this._erasNarrowRegex=RegExp(`^(`+n.join(`|`)+`)`,`i`)}te(0,[`gg`,2],0,function(){return this.weekYear()%100}),te(0,[`GG`,2],0,function(){return this.isoWeekYear()%100});function ea(e,t){te(0,[e,e.length],0,t)}ea(`gggg`,`weekYear`),ea(`ggggg`,`weekYear`),ea(`GGGG`,`isoWeekYear`),ea(`GGGGG`,`isoWeekYear`),Be(`G`,Me),Be(`g`,Me),Be(`GG`,Te,xe),Be(`gg`,Te,xe),Be(`GGGG`,ke,Ce),Be(`gggg`,ke,Ce),Be(`GGGGG`,Ae,we),Be(`ggggg`,Ae,we),Je([`gggg`,`ggggg`,`GGGG`,`GGGGG`],function(e,t,n,r){t[r.substr(0,2)]=Ge(e)}),Je([`gg`,`GG`],function(e,t,r,i){t[i]=n.parseTwoDigitYear(e)});function ta(e){return sa.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function na(e){return sa.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function ra(){return Lt(this.year(),1,4)}function ia(){return Lt(this.isoWeekYear(),1,4)}function aa(){var e=this.localeData()._week;return Lt(this.year(),e.dow,e.doy)}function oa(){var e=this.localeData()._week;return Lt(this.weekYear(),e.dow,e.doy)}function sa(e,t,n,r,i){var a;return e==null?It(this,r,i).year:(a=Lt(e,r,i),t>a&&(t=a),ca.call(this,e,t,n,r,i))}function ca(e,t,n,r,i){var a=Ft(e,t,n,r,i),o=Nt(a.year,0,a.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}te(`Q`,0,`Qo`,`quarter`),Be(`Q`,be),qe(`Q`,function(e,t){t[Qe]=(Ge(e)-1)*3});function la(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}te(`D`,[`DD`,2],`Do`,`date`),Be(`D`,Te,Le),Be(`DD`,Te,xe),Be(`Do`,function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),qe([`D`,`DD`],$e),qe(`Do`,function(e,t){t[$e]=Ge(e.match(Te)[0])});var ua=lt(`Date`,!0);te(`DDD`,[`DDDD`,3],`DDDo`,`dayOfYear`),Be(`DDD`,Oe),Be(`DDDD`,Se),qe([`DDD`,`DDDD`],function(e,t,n){n._dayOfYear=Ge(e)});function da(e){var t=Math.round((this.clone().startOf(`day`)-this.clone().startOf(`year`))/864e5)+1;return e==null?t:this.add(e-t,`d`)}te(`m`,[`mm`,2],0,`minute`),Be(`m`,Te,Re),Be(`mm`,Te,xe),qe([`m`,`mm`],tt);var fa=lt(`Minutes`,!1);te(`s`,[`ss`,2],0,`second`),Be(`s`,Te,Re),Be(`ss`,Te,xe),qe([`s`,`ss`],nt);var pa=lt(`Seconds`,!1);te(`S`,0,0,function(){return~~(this.millisecond()/100)}),te(0,[`SS`,2],0,function(){return~~(this.millisecond()/10)}),te(0,[`SSS`,3],0,`millisecond`),te(0,[`SSSS`,4],0,function(){return this.millisecond()*10}),te(0,[`SSSSS`,5],0,function(){return this.millisecond()*100}),te(0,[`SSSSSS`,6],0,function(){return this.millisecond()*1e3}),te(0,[`SSSSSSS`,7],0,function(){return this.millisecond()*1e4}),te(0,[`SSSSSSSS`,8],0,function(){return this.millisecond()*1e5}),te(0,[`SSSSSSSSS`,9],0,function(){return this.millisecond()*1e6}),Be(`S`,Oe,be),Be(`SS`,Oe,xe),Be(`SSS`,Oe,Se);var ma,ha;for(ma=`SSSS`;ma.length<=9;ma+=`S`)Be(ma,je);function ga(e,t){t[rt]=Ge((`0.`+e)*1e3)}for(ma=`S`;ma.length<=9;ma+=`S`)qe(ma,ga);ha=lt(`Milliseconds`,!1),te(`z`,0,0,`zoneAbbr`),te(`zz`,0,0,`zoneName`);function _a(){return this._isUTC?`UTC`:``}function U(){return this._isUTC?`Coordinated Universal Time`:``}var W=S.prototype;W.add=Gr,W.calendar=$r,W.clone=ei,W.diff=si,W.endOf=Oi,W.format=fi,W.from=pi,W.fromNow=mi,W.to=hi,W.toNow=gi,W.get=ft,W.invalidAt=Li,W.isAfter=ti,W.isBefore=ni,W.isBetween=ri,W.isSame=ii,W.isSameOrAfter=ai,W.isSameOrBefore=oi,W.isValid=Fi,W.lang=vi,W.locale=_i,W.localeData=yi,W.max=lr,W.min=cr,W.parsingFlags=Ii,W.set=pt,W.startOf=Di,W.subtract=Kr,W.toArray=Mi,W.toObject=Ni,W.toDate=ji,W.toISOString=ui,W.inspect=di,typeof Symbol<`u`&&Symbol.for!=null&&(W[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return`Moment<`+this.format()+`>`}),W.toJSON=Pi,W.toString=li,W.unix=Ai,W.valueOf=ki,W.creationData=Ri,W.eraName=Hi,W.eraNarrow=Ui,W.eraAbbr=Wi,W.eraYear=Gi,W.year=st,W.isLeapYear=ct,W.weekYear=ta,W.isoWeekYear=na,W.quarter=W.quarters=la,W.month=Dt,W.daysInMonth=Ot,W.week=W.weeks=Ht,W.isoWeek=W.isoWeeks=Ut,W.weeksInYear=aa,W.weeksInWeekYear=oa,W.isoWeeksInYear=ra,W.isoWeeksInISOWeekYear=ia,W.date=ua,W.day=W.days=an,W.weekday=on,W.isoWeekday=sn,W.dayOfYear=da,W.hour=W.hours=vn,W.minute=W.minutes=fa,W.second=W.seconds=pa,W.millisecond=W.milliseconds=ha,W.utcOffset=Dr,W.utc=kr,W.local=Ar,W.parseZone=jr,W.hasAlignedHourOffset=Mr,W.isDST=Nr,W.isLocal=Fr,W.isUtcOffset=H,W.isUtc=Ir,W.isUTC=Ir,W.zoneAbbr=_a,W.zoneName=U,W.dates=T(`dates accessor is deprecated. Use date instead.`,ua),W.months=T(`months accessor is deprecated. Use month instead`,Dt),W.years=T(`years accessor is deprecated. Use year instead`,st),W.zone=T(`moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/`,Or),W.isDSTShifted=T(`isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information`,Pr);function G(e){return sr(e*1e3)}function va(){return sr.apply(null,arguments).parseZone()}function ya(e){return e}var ba=j.prototype;ba.calendar=P,ba.longDateFormat=oe,ba.invalidDate=ce,ba.ordinal=de,ba.preparse=ya,ba.postformat=ya,ba.relativeTime=pe,ba.pastFuture=me,ba.set=k,ba.eras=zi,ba.erasParse=Bi,ba.erasConvertYear=Vi,ba.erasAbbrRegex=qi,ba.erasNameRegex=Ki,ba.erasNarrowRegex=Ji,ba.months=St,ba.monthsShort=Ct,ba.monthsParse=Tt,ba.monthsRegex=At,ba.monthsShortRegex=kt,ba.week=Rt,ba.firstDayOfYear=Vt,ba.firstDayOfWeek=Bt,ba.weekdays=$t,ba.weekdaysMin=tn,ba.weekdaysShort=en,ba.weekdaysParse=rn,ba.weekdaysRegex=cn,ba.weekdaysShortRegex=ln,ba.weekdaysMinRegex=un,ba.isPM=gn,ba.meridiem=yn;function xa(e,t,n,r){var i=An(),a=p().set(r,t);return i[n](a,e)}function Sa(e,t,n){if(l(e)&&(t=e,e=void 0),e||=``,t!=null)return xa(e,t,n,`month`);var r,i=[];for(r=0;r<12;r++)i[r]=xa(e,r,n,`month`);return i}function Ca(e,t,n,r){typeof e==`boolean`?(l(t)&&(n=t,t=void 0),t||=``):(t=e,n=t,e=!1,l(t)&&(n=t,t=void 0),t||=``);var i=An(),a=e?i._week.dow:0,o,s=[];if(n!=null)return xa(t,(n+a)%7,r,`day`);for(o=0;o<7;o++)s[o]=xa(t,(o+a)%7,r,`day`);return s}function wa(e,t){return Sa(e,t,`months`)}function Ta(e,t){return Sa(e,t,`monthsShort`)}function Ea(e,t,n){return Ca(e,t,n,`weekdays`)}function Da(e,t,n){return Ca(e,t,n,`weekdaysShort`)}function Oa(e,t,n){return Ca(e,t,n,`weekdaysMin`)}Dn(`en`,{eras:[{since:`0001-01-01`,until:1/0,offset:1,name:`Anno Domini`,narrow:`AD`,abbr:`AD`},{since:`0000-12-31`,until:-1/0,offset:1,name:`Before Christ`,narrow:`BC`,abbr:`BC`}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(Ge(e%100/10)===1?`th`:t===1?`st`:t===2?`nd`:t===3?`rd`:`th`)}}),n.lang=T(`moment.lang is deprecated. Use moment.locale instead.`,Dn),n.langData=T(`moment.langData is deprecated. Use moment.localeData instead.`,An);var ka=Math.abs;function Aa(){var e=this._data;return this._milliseconds=ka(this._milliseconds),this._days=ka(this._days),this._months=ka(this._months),e.milliseconds=ka(e.milliseconds),e.seconds=ka(e.seconds),e.minutes=ka(e.minutes),e.hours=ka(e.hours),e.months=ka(e.months),e.years=ka(e.years),this}function ja(e,t,n,r){var i=zr(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Ma(e,t){return ja(this,e,t,1)}function Na(e,t){return ja(this,e,t,-1)}function Pa(e){return e<0?Math.floor(e):Math.ceil(e)}function Fa(){var e=this._milliseconds,t=this._days,n=this._months,r=this._data,i,a,o,s,c;return e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0||(e+=Pa(La(n)+t)*864e5,t=0,n=0),r.milliseconds=e%1e3,i=We(e/1e3),r.seconds=i%60,a=We(i/60),r.minutes=a%60,o=We(a/60),r.hours=o%24,t+=We(o/24),c=We(Ia(t)),n+=c,t-=Pa(La(c)),s=We(n/12),n%=12,r.days=t,r.months=n,r.years=s,this}function Ia(e){return e*4800/146097}function La(e){return e*146097/4800}function Ra(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if(e=ge(e),e===`month`||e===`quarter`||e===`year`)switch(t=this._days+r/864e5,n=this._months+Ia(t),e){case`month`:return n;case`quarter`:return n/3;case`year`:return n/12}else switch(t=this._days+Math.round(La(this._months)),e){case`week`:return t/7+r/6048e5;case`day`:return t+r/864e5;case`hour`:return t*24+r/36e5;case`minute`:return t*1440+r/6e4;case`second`:return t*86400+r/1e3;case`millisecond`:return Math.floor(t*864e5)+r;default:throw Error(`Unknown unit `+e)}}function za(e){return function(){return this.as(e)}}var Ba=za(`ms`),Va=za(`s`),Ha=za(`m`),Ua=za(`h`),Wa=za(`d`),Ga=za(`w`),Ka=za(`M`),qa=za(`Q`),Ja=za(`y`),Ya=Ba;function Xa(){return zr(this)}function Za(e){return e=ge(e),this.isValid()?this[e+`s`]():NaN}function Qa(e){return function(){return this.isValid()?this._data[e]:NaN}}var $a=Qa(`milliseconds`),eo=Qa(`seconds`),to=Qa(`minutes`),no=Qa(`hours`),ro=Qa(`days`),io=Qa(`months`),ao=Qa(`years`);function oo(){return We(this.days()/7)}var so=Math.round,co={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function lo(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function uo(e,t,n,r){var i=zr(e).abs(),a=so(i.as(`s`)),o=so(i.as(`m`)),s=so(i.as(`h`)),c=so(i.as(`d`)),l=so(i.as(`M`)),u=so(i.as(`w`)),d=so(i.as(`y`)),f=a<=n.ss&&[`s`,a]||a<n.s&&[`ss`,a]||o<=1&&[`m`]||o<n.m&&[`mm`,o]||s<=1&&[`h`]||s<n.h&&[`hh`,s]||c<=1&&[`d`]||c<n.d&&[`dd`,c];return n.w!=null&&(f=f||u<=1&&[`w`]||u<n.w&&[`ww`,u]),f=f||l<=1&&[`M`]||l<n.M&&[`MM`,l]||d<=1&&[`y`]||[`yy`,d],f[2]=t,f[3]=+e>0,f[4]=r,lo.apply(null,f)}function fo(e){return e===void 0?so:typeof e==`function`?(so=e,!0):!1}function po(e,t){return co[e]===void 0?!1:t===void 0?co[e]:(co[e]=t,e===`s`&&(co.ss=t-1),!0)}function mo(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,r=co,i,a;return typeof e==`object`&&(t=e,e=!1),typeof e==`boolean`&&(n=e),typeof t==`object`&&(r=Object.assign({},co,t),t.s!=null&&t.ss==null&&(r.ss=t.s-1)),i=this.localeData(),a=uo(this,!n,r,i),n&&(a=i.pastFuture(+this,a)),i.postformat(a)}var ho=Math.abs;function go(e){return(e>0)-(e<0)||+e}function _o(){if(!this.isValid())return this.localeData().invalidDate();var e=ho(this._milliseconds)/1e3,t=ho(this._days),n=ho(this._months),r,i,a,o,s=this.asSeconds(),c,l,u,d;return s?(r=We(e/60),i=We(r/60),e%=60,r%=60,a=We(n/12),n%=12,o=e?e.toFixed(3).replace(/\.?0+$/,``):``,c=s<0?`-`:``,l=go(this._months)===go(s)?``:`-`,u=go(this._days)===go(s)?``:`-`,d=go(this._milliseconds)===go(s)?``:`-`,c+`P`+(a?l+a+`Y`:``)+(n?l+n+`M`:``)+(t?u+t+`D`:``)+(i||r||e?`T`:``)+(i?d+i+`H`:``)+(r?d+r+`M`:``)+(e?d+o+`S`:``)):`P0D`}var vo=vr.prototype;return vo.isValid=gr,vo.abs=Aa,vo.add=Ma,vo.subtract=Na,vo.as=Ra,vo.asMilliseconds=Ba,vo.asSeconds=Va,vo.asMinutes=Ha,vo.asHours=Ua,vo.asDays=Wa,vo.asWeeks=Ga,vo.asMonths=Ka,vo.asQuarters=qa,vo.asYears=Ja,vo.valueOf=Ya,vo._bubble=Fa,vo.clone=Xa,vo.get=Za,vo.milliseconds=$a,vo.seconds=eo,vo.minutes=to,vo.hours=no,vo.days=ro,vo.weeks=oo,vo.months=io,vo.years=ao,vo.humanize=mo,vo.toISOString=_o,vo.toString=_o,vo.toJSON=_o,vo.locale=_i,vo.localeData=yi,vo.toIsoString=T(`toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)`,_o),vo.lang=vi,te(`X`,0,0,`unix`),te(`x`,0,0,`valueOf`),Be(`x`,Me),Be(`X`,Fe),qe(`X`,function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),qe(`x`,function(e,t,n){n._d=new Date(Ge(e))}),n.version=`2.30.1`,r(sr),n.fn=W,n.min=dr,n.max=fr,n.now=pr,n.utc=p,n.unix=G,n.months=wa,n.isDate=u,n.locale=Dn,n.invalid=v,n.duration=zr,n.isMoment=C,n.weekdays=Ea,n.parseZone=va,n.localeData=An,n.isDuration=yr,n.monthsShort=Ta,n.weekdaysMin=Oa,n.defineLocale=On,n.updateLocale=kn,n.locales=jn,n.weekdaysShort=Da,n.normalizeUnits=ge,n.relativeTimeRounding=fo,n.relativeTimeThreshold=po,n.calendarFormat=Qr,n.prototype=W,n.HTML5_FMT={DATETIME_LOCAL:`YYYY-MM-DDTHH:mm`,DATETIME_LOCAL_SECONDS:`YYYY-MM-DDTHH:mm:ss`,DATETIME_LOCAL_MS:`YYYY-MM-DDTHH:mm:ss.SSS`,DATE:`YYYY-MM-DD`,TIME:`HH:mm`,TIME_SECONDS:`HH:mm:ss`,TIME_MS:`HH:mm:ss.SSS`,WEEK:`GGGG-[W]WW`,MONTH:`YYYY-MM`},n}))}))()),XT=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],ZT=[{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`}],QT={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:`YYYY-MM-DD`,firstWeekday:ZT[1],syncInterval:200,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:[`templates`]},$T=1e3,eE=ZT[1];function tE(e){eE=e}function nE(e){return XT[e]}function rE(e,t){let n=(0,YT.default)(new Date(t,e)).daysInMonth(),r=Array(42).fill(0),i=iE(new Date(t,e,1));for(let e=0;e<n;e++)r[e+i]=e+1;return r=r[r.length-7]?r:r.slice(0,-7),r=r[r.length-7]?r:r.slice(0,-7),r}function iE(e){return vt(e.getDay()-eE.index,7)}function aE(){return ZT.map(e=>({index:vt(e.index-eE.index,7),name:e.name,shortName:e.shortName})).sort((e,t)=>e.index-t.index).map(e=>e.shortName)}function oE(){return oE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oE.apply(null,arguments)}var sE={relTol:1e-12,absTol:1e-15,matrix:`Matrix`,number:`number`,numberFallback:`number`,precision:64,predictable:!1,randomSeed:null,legacySubset:!1};function cE(e,t){if(uE(e,t)||dE(e,t))return e[t];throw mE(e,t)?Error(`Cannot access method "${t}" as a property`):e==null?TypeError(`Cannot access property "${t}": object is ${e}`):Error(`No access to property "`+t+`"`)}function lE(e,t,n){if(uE(e,t)||dE(e,t))return e[t]=n,n;throw Error(`No access to property "${t}"`)}function uE(e,t){return hE(e)?!(t in Object.prototype):!1}function dE(e,t){return Array.isArray(e)?typeof t==`number`||typeof t==`string`&&fE(t)||t===`length`:!1}function fE(e){return/^\d+$/.test(e)}function pE(e,t){if(!mE(e,t))throw Error(`No access to method "`+t+`"`);return e[t]}function mE(e,t){return e==null||typeof e[t]!=`function`||SD(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)?!1:gE.has(t)?!0:!(t in Object.prototype||t in Function.prototype)}function hE(e){return typeof e==`object`&&e&&e.constructor===Object}var gE=new Set([`toString`,`valueOf`,`toLocaleString`]),_E=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return cE(this.wrappedObject,e)}set(e,t){return lE(this.wrappedObject,e,t),this}has(e){return uE(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return yE(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){uE(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}},vE=class{constructor(e,t,n){this.a=e,this.b=t,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return yE(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function yE(e,t){return{next:()=>{var n=e.next();return n.done?n:{value:t(n.value),done:!1}}}}function bE(){return new Map}function xE(e){if(!e)return bE();if(WE(e))return e;if(UE(e))return new _E(e);throw Error(`createMap can create maps from objects or Maps`)}function SE(e){if(e instanceof _E)return e.wrappedObject;var t={};for(var n of e.keys())lE(t,n,e.get(n));return t}function CE(e){return typeof e==`number`}function wE(e){return!e||typeof e!=`object`||typeof e.constructor!=`function`?!1:e.isBigNumber===!0&&typeof e.constructor.prototype==`object`&&e.constructor.prototype.isBigNumber===!0||typeof e.constructor.isDecimal==`function`&&e.constructor.isDecimal(e)===!0}function TE(e){return typeof e==`bigint`}function EE(e){return e&&typeof e==`object`&&Object.getPrototypeOf(e).isComplex===!0||!1}function DE(e){return e&&typeof e==`object`&&Object.getPrototypeOf(e).isFraction===!0||!1}function OE(e){return e&&e.constructor.prototype.isUnit===!0||!1}function kE(e){return typeof e==`string`}var AE=Array.isArray;function jE(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function ME(e){return Array.isArray(e)||jE(e)}function NE(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function PE(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function FE(e){return e&&e.constructor.prototype.isRange===!0||!1}function IE(e){return e&&e.constructor.prototype.isIndex===!0||!1}function LE(e){return typeof e==`boolean`}function RE(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function zE(e){return e&&e.constructor.prototype.isHelp===!0||!1}function BE(e){return typeof e==`function`}function VE(e){return e instanceof Date}function HE(e){return e instanceof RegExp}function UE(e){return!!(e&&typeof e==`object`&&e.constructor===Object&&!EE(e)&&!DE(e))}function WE(e){return e?e instanceof Map||e instanceof _E||typeof e.set==`function`&&typeof e.get==`function`&&typeof e.keys==`function`&&typeof e.has==`function`:!1}function GE(e){return WE(e)&&WE(e.a)&&WE(e.b)}function KE(e){return WE(e)&&UE(e.wrappedObject)}function qE(e){return e===null}function JE(e){return e===void 0}function YE(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function XE(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function ZE(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function QE(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function $E(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function eD(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function tD(e){return eD(e)||sD(e)&&e.args.length===1&&eD(e.args[0])&&`-+~`.includes(e.op)}function nD(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function rD(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function iD(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function aD(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function oD(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function sD(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function cD(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function lD(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function uD(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function dD(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function fD(e){return e&&e.constructor.prototype.isChain===!0||!1}function pD(e){var t=typeof e;return t===`object`?e===null?`null`:wE(e)?`BigNumber`:e.constructor&&e.constructor.name?e.constructor.name:`Object`:t}function mD(e){var t=typeof e;if(t===`number`||t===`bigint`||t===`string`||t===`boolean`||e==null)return e;if(typeof e.clone==`function`)return e.clone();if(Array.isArray(e))return e.map(function(e){return mD(e)});if(e instanceof Date)return new Date(e.valueOf());if(wE(e))return e;if(UE(e))return hD(e,mD);if(t===`function`)return e;throw TypeError(`Cannot clone: unknown type of value (value: ${e})`)}function hD(e,t){var n={};for(var r in e)SD(e,r)&&(n[r]=t(e[r]));return n}function gD(e,t){for(var n in t)SD(t,n)&&(e[n]=t[n]);return e}function _D(e,t){if(Array.isArray(t))throw TypeError(`Arrays are not supported by deepExtend`);for(var n in t)if(SD(t,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(t[n]&&t[n].constructor===Object)e[n]===void 0&&(e[n]={}),e[n]&&e[n].constructor===Object?_D(e[n],t[n]):e[n]=t[n];else if(Array.isArray(t[n]))throw TypeError(`Arrays are not supported by deepExtend`);else e[n]=t[n];return e}function vD(e,t){var n,r,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(r=0,i=e.length;r<i;r++)if(!vD(e[r],t[r]))return!1;return!0}else if(typeof e==`function`)return e===t;else if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(n in e)if(!(n in t)||!vD(e[n],t[n]))return!1;for(n in t)if(!(n in e))return!1;return!0}else return e===t}function yD(e){var t={};return bD(e,t),t}function bD(e,t){for(var n in e)if(SD(e,n)){var r=e[n];typeof r==`object`&&r?bD(r,t):t[n]=r}}function xD(e,t,n){var r=!0,i;Object.defineProperty(e,t,{get:function(){return r&&=(i=n(),!1),i},set:function(e){i=e,r=!1},configurable:!0,enumerable:!0})}function SD(e,t){return e&&Object.hasOwnProperty.call(e,t)}function CD(e){return e&&typeof e.factory==`function`}function wD(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r],a=e[i];a!==void 0&&(n[i]=a)}return n}var TD=[`Matrix`,`Array`],ED=[`number`,`BigNumber`,`bigint`,`Fraction`];function DD(e,t){function n(r){if(r){if(r.epsilon!==void 0){console.warn(`Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.`);var i=mD(r);return i.relTol=r.epsilon,i.absTol=r.epsilon*.001,delete i.epsilon,n(i)}r.legacySubset===!0&&console.warn(`Warning: The configuration option "legacySubset" is for compatibility only and might be deprecated in the future.`);var a=mD(e);OD(r,`matrix`,TD),OD(r,`number`,ED),_D(e,r);var o=mD(e);return t(`config`,o,a,mD(r)),o}else return mD(e)}return n.MATRIX_OPTIONS=TD,n.NUMBER_OPTIONS=ED,Object.keys(sE).forEach(t=>{Object.defineProperty(n,t,{get:()=>e[t],enumerable:!0,configurable:!0})}),n}function OD(e,t,n){e[t]!==void 0&&!n.includes(e[t])&&console.warn(`Warning: Unknown value "`+e[t]+`" for configuration option "`+t+`". Available options: `+n.map(e=>JSON.stringify(e)).join(`, `)+`.`)}var kD=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.typed=r())})(e,(function(){"use strict";function e(){return!0}function t(){return!1}function n(){}let r=`Argument is not a typed-function.`;function i(){function a(e){return typeof e==`object`&&!!e&&e.constructor===Object}let o=[{name:`number`,test:function(e){return typeof e==`number`}},{name:`string`,test:function(e){return typeof e==`string`}},{name:`boolean`,test:function(e){return typeof e==`boolean`}},{name:`Function`,test:function(e){return typeof e==`function`}},{name:`Array`,test:Array.isArray},{name:`Date`,test:function(e){return e instanceof Date}},{name:`RegExp`,test:function(e){return e instanceof RegExp}},{name:`Object`,test:a},{name:`null`,test:function(e){return e===null}},{name:`undefined`,test:function(e){return e===void 0}}],s={name:`any`,test:e,isAny:!0},c,l,u=0,d={createCount:0};function f(e){let t=c.get(e);if(t)return t;let n=`Unknown type "`+e+`"`,r=e.toLowerCase(),i;for(i of l)if(i.toLowerCase()===r){n+=`. Did you mean "`+i+`" ?`;break}throw TypeError(n)}function p(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`any`,n=t?f(t).index:l.length,r=[];for(let t=0;t<e.length;++t){if(!e[t]||typeof e[t].name!=`string`||typeof e[t].test!=`function`)throw TypeError(`Object with properties {name: string, test: function} expected`);let i=e[t].name;if(c.has(i))throw TypeError(`Duplicate type name "`+i+`"`);r.push(i),c.set(i,{name:i,test:e[t].test,isAny:e[t].isAny,index:n+t,conversionsTo:[]})}let i=l.slice(n);l=l.slice(0,n).concat(r).concat(i);for(let e=n+r.length;e<l.length;++e)c.get(l[e]).index=e}function m(){c=new Map,l=[],u=0,p([s],!1)}m(),p(o);function h(){let e;for(e of l)c.get(e).conversionsTo=[];u=0}function g(e){let t=l.filter(t=>{let n=c.get(t);return!n.isAny&&n.test(e)});return t.length?t:[`any`]}function _(e){return e&&typeof e==`function`&&`_typedFunctionData`in e}function v(e,t,n){if(!_(e))throw TypeError(r);let i=n&&n.exact,a=T(Array.isArray(t)?t.join(`,`):t),o=x(a);if(!i||o in e.signatures){let t=e._typedFunctionData.signatureMap.get(o);if(t)return t}let s=a.length,c;if(i){c=[];let t;for(t in e.signatures)c.push(e._typedFunctionData.signatureMap.get(t))}else c=e._typedFunctionData.signatures;for(let e=0;e<s;++e){let t=a[e],n=[],r;for(r of c){let i=k(r.params,e);if(!(!i||t.restParam&&!i.restParam)){if(!i.hasAny){let e=w(i);if(t.types.some(t=>!e.has(t.name)))continue}n.push(r)}}if(c=n,c.length===0)break}let l;for(l of c)if(l.params.length<=s)return l;throw TypeError(`Signature not found (signature: `+(e.name||`unnamed`)+`(`+x(a,`, `)+`))`)}function y(e,t,n){return v(e,t,n).implementation}function b(e,t){let n=f(t);if(n.test(e))return e;let r=n.conversionsTo;if(r.length===0)throw Error(`There are no conversions to `+t+` defined.`);for(let t=0;t<r.length;t++)if(f(r[t].from).test(e))return r[t].convert(e);throw Error(`Cannot convert `+e+` to `+t)}function x(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`,`;return e.map(e=>e.name).join(t)}function S(e){let t=e.indexOf(`...`)===0,n=(t?e.length>3?e.slice(3):`any`:e).split(`|`).map(e=>f(e.trim())),r=!1,i=t?`...`:``;return{types:n.map(function(e){return r=e.isAny||r,i+=e.name+`|`,{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}}),name:i.slice(0,-1),hasAny:r,hasConversion:!1,restParam:t}}function C(e){let t=ee(e.types.map(e=>e.name)),n=e.hasAny,r=e.name,i=t.map(function(e){let t=f(e.from);return n=t.isAny||n,r+=`|`+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:r,hasAny:n,hasConversion:i.length>0,restParam:e.restParam}}function w(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach(t=>e.typeSet.add(t.name))),e.typeSet}function T(e){let t=[];if(typeof e!=`string`)throw TypeError(`Signatures must be strings`);let n=e.trim();if(n===``)return t;let r=n.split(`,`);for(let e=0;e<r.length;++e){let n=S(r[e].trim());if(n.restParam&&e!==r.length-1)throw SyntaxError(`Unexpected rest parameter "`+r[e]+`": only allowed for the last parameter`);if(n.types.length===0)return null;t.push(n)}return t}function E(e){let t=ue(e);return t?t.restParam:!1}function D(t){if(!t||t.types.length===0)return e;if(t.types.length===1)return f(t.types[0].name).test;if(t.types.length===2){let e=f(t.types[0].name).test,n=f(t.types[1].name).test;return function(t){return e(t)||n(t)}}else{let e=t.types.map(function(e){return f(e.name).test});return function(t){for(let n=0;n<e.length;n++)if(e[n](t))return!0;return!1}}}function O(e){let t,n,r;if(E(e)){t=le(e).map(D);let n=t.length,r=D(ue(e)),i=function(e){for(let t=n;t<e.length;t++)if(!r(e[t]))return!1;return!0};return function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return i(e)&&e.length>=n+1}}else if(e.length===0)return function(e){return e.length===0};else if(e.length===1)return n=D(e[0]),function(e){return n(e[0])&&e.length===1};else if(e.length===2)return n=D(e[0]),r=D(e[1]),function(e){return n(e[0])&&r(e[1])&&e.length===2};else return t=e.map(D),function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return e.length===t.length}}function k(e,t){return t<e.length?e[t]:E(e)?ue(e):null}function A(e,t){let n=k(e,t);return n?w(n):new Set}function j(e){return e.conversion===null||e.conversion===void 0}function M(e,t){let n=new Set;return e.forEach(e=>{let r=A(e.params,t),i;for(i of r)n.add(i)}),n.has(`any`)?[`any`]:Array.from(n)}function N(e,t,n){let r,i,a=e||`unnamed`,o=n,s;for(s=0;s<t.length;s++){let e=[];if(o.forEach(n=>{let r=D(k(n.params,s));(s<n.params.length||E(n.params))&&r(t[s])&&e.push(n)}),e.length===0){if(i=M(o,s),i.length>0){let e=g(t[s]);return r=TypeError(`Unexpected type of argument in function `+a+` (expected: `+i.join(` or `)+`, actual: `+e.join(` | `)+`, index: `+s+`)`),r.data={category:`wrongType`,fn:a,index:s,actual:e,expected:i},r}}else o=e}let c=o.map(function(e){return E(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,c))return i=M(o,s),r=TypeError(`Too few arguments in function `+a+` (expected: `+i.join(` or `)+`, index: `+t.length+`)`),r.data={category:`tooFewArgs`,fn:a,index:t.length,expected:i},r;let l=Math.max.apply(null,c);if(t.length>l)return r=TypeError(`Too many arguments in function `+a+` (expected: `+l+`, actual: `+t.length+`)`),r.data={category:`tooManyArgs`,fn:a,index:t.length,expectedLength:l},r;let u=[];for(let e=0;e<t.length;++e)u.push(g(t[e]).join(`|`));return r=TypeError(`Arguments of type "`+u.join(`, `)+`" do not match any of the defined signatures of function `+a+`.`),r.data={category:`mismatch`,actual:u},r}function P(e){let t=l.length+1;for(let n=0;n<e.types.length;n++)t=Math.min(t,e.types[n].typeIndex);return t}function F(e){let t=u+1;for(let n=0;n<e.types.length;n++)j(e.types[n])||(t=Math.min(t,e.types[n].conversionIndex));return t}function I(e,t){if(e.hasAny){if(!t.hasAny)return .1}else if(t.hasAny)return-.1;if(e.restParam){if(!t.restParam)return .01}else if(t.restParam)return-.01;let n=P(e)-P(t);if(n<0)return-.001;if(n>0)return .001;let r=F(e),i=F(t);if(e.hasConversion){if(!t.hasConversion)return(1+r)*1e-6}else if(t.hasConversion)return-(1+i)*1e-6;let a=r-i;return a<0?-1e-7:a>0?1e-7:0}function L(e,t){let n=e.params,r=t.params,i=ue(n),a=ue(r),o=E(n),s=E(r);if(o&&i.hasAny){if(!s||!a.hasAny)return 1e7}else if(s&&a.hasAny)return-1e7;let c=0,l=0,u;for(u of n)u.hasAny&&++c,u.hasConversion&&++l;let d=0,f=0;for(u of r)u.hasAny&&++d,u.hasConversion&&++f;if(c!==d)return(c-d)*1e6;if(o&&i.hasConversion){if(!s||!a.hasConversion)return 1e5}else if(s&&a.hasConversion)return-1e5;if(l!==f)return(l-f)*1e4;if(o){if(!s)return 1e3}else if(s)return-1e3;let p=(n.length-r.length)*(o?-100:100);if(p!==0)return p;let m=[],h=0;for(let e=0;e<n.length;++e){let t=I(n[e],r[e]);m.push(t),h+=t}if(h!==0)return(h<0?-10:10)+h;let g,_=9,v=_/(m.length+1);for(g of m){if(g!==0)return(g<0?-_:_)+g;_-=v}return 0}function ee(e){if(e.length===0)return[];let t=e.map(f);if(e.length===1)return t[0].conversionsTo;let n=new Set(e),r=new Set;for(let e=0;e<t.length;++e)for(let i of t[e].conversionsTo)n.has(i.from)||r.add(i.from);let i=[];for(let e of r){let n=u+1,r=null;for(let i=0;i<t.length;++i)for(let a of t[i].conversionsTo)a.from===e&&a.index<n&&(n=a.index,r=a);i.push(r)}return i}function R(e,t){let n=t,r=``;if(e.some(e=>e.hasConversion)){let i=E(e),a=e.map(te);r=a.map(e=>e.name).join(`;`),n=function(){let e=[],n=i?arguments.length-1:arguments.length;for(let t=0;t<n;t++)e[t]=a[t](arguments[t]);return i&&(e[n]=arguments[n].map(a[n])),t.apply(this,e)}}let i=n;if(E(e)){let t=e.length-1;i=function(){return n.apply(this,de(arguments,0,t).concat([de(arguments,t)]))}}return r&&Object.defineProperty(i,`name`,{value:r}),i}function te(e){let t,n,r,i,a=[],o=[],s=``;e.types.forEach(function(e){e.conversion&&(s+=e.conversion.from+`~>`+e.conversion.to+`,`,a.push(f(e.conversion.from).test),o.push(e.conversion.convert))}),s=s?s.slice(0,-1):`pass`;let c=e=>e;switch(o.length){case 0:break;case 1:t=a[0],r=o[0],c=function(e){return t(e)?r(e):e};break;case 2:t=a[0],n=a[1],r=o[0],i=o[1],c=function(e){return t(e)?r(e):n(e)?i(e):e};break;default:c=function(e){for(let t=0;t<o.length;t++)if(a[t](e))return o[t](e);return e}}return Object.defineProperty(c,`name`,{value:s}),c}function z(e){function t(e,n,r){if(n<e.length){let i=e[n],a=[];if(i.restParam){let e=i.types.filter(j);e.length<i.types.length&&a.push({types:e,name:`...`+e.map(e=>e.name).join(`|`),hasAny:e.some(e=>e.isAny),hasConversion:!1,restParam:!0}),a.push(i)}else a=i.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return pe(a,function(i){return t(e,n+1,r.concat([i]))})}else return[r]}return t(e,0,[])}function ne(e,t){let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=A(e,r),i=A(t,r),a=!1,o;for(o of i)if(n.has(o)){a=!0;break}if(!a)return!1}let r=e.length,i=t.length,a=E(e),o=E(t);return a?o?r===i:i>=r:o?r>=i:r===i}function re(e){return e.map(e=>ve(e)?ge(e.referToSelf.callback):_e(e)?he(e.referTo.references,e.referTo.callback):e)}function ie(e,t,n){let r=[],i;for(i of e){let e=n[i];if(typeof e!=`number`)throw TypeError(`No definition for referenced signature "`+i+`"`);if(e=t[e],typeof e!=`function`)return!1;r.push(e)}return r}function ae(e,t,n){let r=re(e),i=Array(r.length).fill(!1),a=!0;for(;a;){a=!1;let e=!0;for(let o=0;o<r.length;++o){if(i[o])continue;let s=r[o];if(ve(s))r[o]=s.referToSelf.callback(n),r[o].referToSelf=s.referToSelf,i[o]=!0,e=!1;else if(_e(s)){let n=ie(s.referTo.references,r,t);n?(r[o]=s.referTo.callback.apply(this,n),r[o].referTo=s.referTo,i[o]=!0,e=!1):a=!0}}if(e&&a)throw SyntaxError(`Circular reference detected in resolving typed.referTo`)}return r}function oe(e){let t=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach(n=>{let r=e[n];if(t.test(r.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function se(e,r){if(d.createCount++,Object.keys(r).length===0)throw SyntaxError(`No signatures provided`);d.warnAgainstDeprecatedThis&&oe(r);let i=[],a=[],o={},s=[],c;for(c in r){if(!Object.prototype.hasOwnProperty.call(r,c))continue;let e=T(c);if(!e)continue;i.forEach(function(t){if(ne(t,e))throw TypeError(`Conflicting signatures "`+x(t)+`" and "`+x(e)+`".`)}),i.push(e);let t=a.length;a.push(r[c]);let n=e.map(C),l;for(l of z(n)){let e=x(l);s.push({params:l,name:e,fn:t}),l.every(e=>!e.hasConversion)&&(o[e]=t)}}s.sort(L);let l=ae(a,o,Se),u;for(u in o)Object.prototype.hasOwnProperty.call(o,u)&&(o[u]=l[o[u]]);let f=[],p=new Map;for(u of s)p.has(u.name)||(u.fn=l[u.fn],f.push(u),p.set(u.name,u));let m=f[0]&&f[0].params.length<=2&&!E(f[0].params),h=f[1]&&f[1].params.length<=2&&!E(f[1].params),g=f[2]&&f[2].params.length<=2&&!E(f[2].params),_=f[3]&&f[3].params.length<=2&&!E(f[3].params),v=f[4]&&f[4].params.length<=2&&!E(f[4].params),y=f[5]&&f[5].params.length<=2&&!E(f[5].params),b=m&&h&&g&&_&&v&&y;for(let e=0;e<f.length;++e)f[e].test=O(f[e].params);let S=m?D(f[0].params[0]):t,w=h?D(f[1].params[0]):t,k=g?D(f[2].params[0]):t,A=_?D(f[3].params[0]):t,j=v?D(f[4].params[0]):t,M=y?D(f[5].params[0]):t,N=m?D(f[0].params[1]):t,P=h?D(f[1].params[1]):t,F=g?D(f[2].params[1]):t,I=_?D(f[3].params[1]):t,ee=v?D(f[4].params[1]):t,te=y?D(f[5].params[1]):t;for(let e=0;e<f.length;++e)f[e].implementation=R(f[e].params,f[e].fn);let re=m?f[0].implementation:n,ie=h?f[1].implementation:n,se=g?f[2].implementation:n,ce=_?f[3].implementation:n,le=v?f[4].implementation:n,ue=y?f[5].implementation:n,de=m?f[0].params.length:-1,fe=h?f[1].params.length:-1,pe=g?f[2].params.length:-1,me=_?f[3].params.length:-1,he=v?f[4].params.length:-1,ge=y?f[5].params.length:-1,_e=b?6:0,ve=f.length,ye=f.map(e=>e.test),be=f.map(e=>e.implementation),xe=function(){for(let e=_e;e<ve;e++)if(ye[e](arguments))return be[e].apply(this,arguments);return d.onMismatch(e,arguments,f)};function Se(e,t){return arguments.length===de&&S(e)&&N(t)?re.apply(this,arguments):arguments.length===fe&&w(e)&&P(t)?ie.apply(this,arguments):arguments.length===pe&&k(e)&&F(t)?se.apply(this,arguments):arguments.length===me&&A(e)&&I(t)?ce.apply(this,arguments):arguments.length===he&&j(e)&&ee(t)?le.apply(this,arguments):arguments.length===ge&&M(e)&&te(t)?ue.apply(this,arguments):xe.apply(this,arguments)}try{Object.defineProperty(Se,`name`,{value:e})}catch{}return Se.signatures=o,Se._typedFunctionData={signatures:f,signatureMap:p},Se}function ce(e,t,n){throw N(e,t,n)}function le(e){return de(e,0,e.length-1)}function ue(e){return e[e.length-1]}function de(e,t,n){return Array.prototype.slice.call(e,t,n)}function fe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n]}function pe(e,t){return Array.prototype.concat.apply([],e.map(t))}function me(){let e=le(arguments).map(e=>x(T(e))),t=ue(arguments);if(typeof t!=`function`)throw TypeError(`Callback function expected as last argument`);return he(e,t)}function he(e,t){return{referTo:{references:e,callback:t}}}function ge(e){if(typeof e!=`function`)throw TypeError(`Callback function expected as first argument`);return{referToSelf:{callback:e}}}function _e(e){return e&&typeof e.referTo==`object`&&Array.isArray(e.referTo.references)&&typeof e.referTo.callback==`function`}function ve(e){return e&&typeof e.referToSelf==`object`&&typeof e.referToSelf.callback==`function`}function ye(e,t){if(!e)return t;if(t&&t!==e){let n=Error(`Function names do not match (expected: `+e+`, actual: `+t+`)`);throw n.data={actual:t,expected:e},n}return e}function be(e){let t;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(_(e[n])||typeof e[n].signature==`string`)&&(t=ye(t,e[n].name));return t}function xe(e,t){let n;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(n in e&&t[n]!==e[n]){let r=Error(`Signature "`+n+`" is defined twice`);throw r.data={signature:n,sourceFunction:t[n],destFunction:e[n]},r}e[n]=t[n]}}let Se=d;d=function(e){let t=typeof e==`string`,n=+!!t,r=t?e:``,i={};for(let e=n;e<arguments.length;++e){let n=arguments[e],o={},s;if(typeof n==`function`?(s=n.name,typeof n.signature==`string`?o[n.signature]=n:_(n)&&(o=n.signatures)):a(n)&&(o=n,t||(s=be(n))),Object.keys(o).length===0){let t=TypeError(`Argument to 'typed' at index `+e+` is not a (typed) function, nor an object with signatures as keys and functions as values.`);throw t.data={index:e,argument:n},t}t||(r=ye(r,s)),xe(i,o)}return se(r||``,i)},d.create=i,d.createCount=Se.createCount,d.onMismatch=ce,d.throwMismatchError=ce,d.createError=N,d.clear=m,d.clearConversions=h,d.addTypes=p,d._findType=f,d.referTo=me,d.referToSelf=ge,d.convert=b,d.findSignature=v,d.find=y,d.isTypedFunction=_,d.warnAgainstDeprecatedThis=!0,d.addType=function(e,t){let n=`any`;t!==!1&&c.has(`Object`)&&(n=`Object`),d.addTypes([e],n)};function Ce(e){if(!e||typeof e.from!=`string`||typeof e.to!=`string`||typeof e.convert!=`function`)throw TypeError(`Object with properties {from: string, to: string, convert: function} expected`);if(e.to===e.from)throw SyntaxError(`Illegal to define conversion from "`+e.from+`" to itself.`)}return d.addConversion=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};Ce(e);let n=f(e.to),r=n.conversionsTo.find(t=>t.from===e.from);if(r)if(t&&t.override)d.removeConversion({from:r.from,to:e.to,convert:r.convert});else throw Error(`There is already a conversion from "`+e.from+`" to "`+n.name+`"`);n.conversionsTo.push({from:e.from,to:n.name,convert:e.convert,index:u++})},d.addConversions=function(e,t){e.forEach(e=>d.addConversion(e,t))},d.removeConversion=function(e){Ce(e);let t=f(e.to),n=fe(t.conversionsTo,t=>t.from===e.from);if(!n)throw Error(`Attempt to remove nonexistent conversion from `+e.from+` to `+e.to);if(n.convert!==e.convert)throw Error(`Conversion to remove does not match existing conversion`);let r=t.conversionsTo.indexOf(n);t.conversionsTo.splice(r,1)},d.resolve=function(e,t){if(!_(e))throw TypeError(r);let n=e._typedFunctionData.signatures;for(let e=0;e<n.length;++e)if(n[e].test(t))return n[e];return null},d}return i()}))}));function Z(e,t,n,r){function i(r){var i=wD(r,t.map(ND));return jD(e,t,r),n(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),r&&(i.meta=r),i}function AD(e){return typeof e==`function`&&typeof e.fn==`string`&&Array.isArray(e.dependencies)}function jD(e,t,n){if(!t.filter(e=>!MD(e)).every(e=>n[e]!==void 0)){var r=t.filter(e=>n[e]===void 0);throw Error(`Cannot create function "${e}", some dependencies are missing: ${r.map(e=>`"${e}"`).join(`, `)}.`)}}function MD(e){return e&&e[0]===`?`}function ND(e){return e&&e[0]===`?`?e.slice(1):e}function PD(e){return typeof e==`boolean`?!0:Number.isFinite(e)?e===Math.round(e):!1}function FD(e,t){if(t.number===`bigint`)try{BigInt(e)}catch{return t.numberFallback}return t.number}var ID=Math.sign||function(e){return e>0?1:e<0?-1:0},LD=Math.log2||function(e){return Math.log(e)/Math.LN2},RD=Math.log10||function(e){return Math.log(e)/Math.LN10},zD=Math.log1p||function(e){return Math.log(e+1)},BD=Math.cbrt||function(e){if(e===0)return e;var t=e<0,n;return t&&(e=-e),Number.isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},VD=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function HD(e,t,n){var r={2:`0b`,8:`0o`,16:`0x`}[t],i=``;if(n){if(n<1)throw Error(`size must be in greater than 0`);if(!PD(n))throw Error(`size must be an integer`);if(e>2**(n-1)-1||e<-(2**(n-1)))throw Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!PD(e))throw Error(`Value must be an integer`);e<0&&(e+=2**n),i=`i${n}`}var a=``;return e<0&&(e=-e,a=`-`),`${a}${r}${e.toString(t)}${i}`}function UD(e,t){if(typeof t==`function`)return t(e);if(e===1/0)return`Infinity`;if(e===-1/0)return`-Infinity`;if(isNaN(e))return`NaN`;var{notation:n,precision:r,wordSize:i}=WD(t);switch(n){case`fixed`:return qD(e,r);case`exponential`:return JD(e,r);case`engineering`:return KD(e,r);case`bin`:return HD(e,2,i);case`oct`:return HD(e,8,i);case`hex`:return HD(e,16,i);case`auto`:return YD(e,r,t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return e===`.`?t:e+t});default:throw Error(`Unknown notation "`+n+`". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.`)}}function WD(e){var t=`auto`,n,r;if(e!==void 0)if(CE(e))n=e;else if(wE(e))n=e.toNumber();else if(UE(e))e.precision!==void 0&&(n=sO(e.precision,()=>{throw Error(`Option "precision" must be a number or BigNumber`)})),e.wordSize!==void 0&&(r=sO(e.wordSize,()=>{throw Error(`Option "wordSize" must be a number or BigNumber`)})),e.notation&&(t=e.notation);else throw Error(`Unsupported type of options, number, BigNumber, or object expected`);return{notation:t,precision:n,wordSize:r}}function GD(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError(`Invalid number `+e);var n=t[1],r=t[2],i=parseFloat(t[4]||`0`),a=r.indexOf(`.`);i+=a===-1?r.length-1:a-1;var o=r.replace(`.`,``).replace(/^0*/,function(e){return i-=e.length,``}).replace(/0*$/,``).split(``).map(function(e){return parseInt(e)});return o.length===0&&(o.push(0),i++),{sign:n,coefficients:o,exponent:i}}function KD(e,t){if(isNaN(e)||!Number.isFinite(e))return String(e);var n=XD(GD(e),t),r=n.exponent,i=n.coefficients,a=r%3==0?r:r<0?r-3-r%3:r-r%3;if(CE(t))for(;t>i.length||r-a+1>i.length;)i.push(0);else for(var o=Math.abs(r-a)-(i.length-1),s=0;s<o;s++)i.push(0);for(var c=Math.abs(r-a),l=1;c>0;)l++,c--;var u=i.slice(l).join(``),d=CE(t)&&u.length||u.match(/[1-9]/)?`.`+u:``,f=i.slice(0,l).join(``)+d+`e`+(r>=0?`+`:``)+a.toString();return n.sign+f}function qD(e,t){if(isNaN(e)||!Number.isFinite(e))return String(e);var n=GD(e),r=typeof t==`number`?XD(n,n.exponent+1+t):n,i=r.coefficients,a=r.exponent+1,o=a+(t||0);return i.length<o&&(i=i.concat(ZD(o-i.length))),a<0&&(i=ZD(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?`0.`:`.`),r.sign+i.join(``)}function JD(e,t){if(isNaN(e)||!Number.isFinite(Number(e)))return String(e);var n=GD(e),r=t?XD(n,t):n,i=r.coefficients,a=r.exponent;i.length<t&&(i=i.concat(ZD(t-i.length)));var o=i.shift();return r.sign+o+(i.length>0?`.`+i.join(``):``)+`e`+(a>=0?`+`:``)+a}function YD(e,t,n){if(isNaN(e)||!Number.isFinite(e))return String(e);var r=cO(n?.lowerExp,-3),i=cO(n?.upperExp,5),a=GD(e),o=t?XD(a,t):a;if(o.exponent<r||o.exponent>=i)return JD(e,t);var s=o.coefficients,c=o.exponent;s.length<t&&(s=s.concat(ZD(t-s.length))),s=s.concat(ZD(c-s.length+1+(s.length<t?t-s.length:0))),s=ZD(-c).concat(s);var l=c>0?c:0;return l<s.length-1&&s.splice(l+1,0,`.`),o.sign+s.join(``)}function XD(e,t){for(var n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=n.coefficients;t<=0;)r.unshift(0),n.exponent++,t++;if(r.length>t&&r.splice(t,r.length-t)[0]>=5){var i=t-1;for(r[i]++;r[i]===10;)r.pop(),i===0&&(r.unshift(0),n.exponent++,i++),i--,r[i]++}return n}function ZD(e){for(var t=[],n=0;n<e;n++)t.push(0);return t}function QD(e){return e.toExponential().replace(/e.*$/,``).replace(/^0\.?0*|\./,``).length}function $D(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(n<=0)throw Error(`Relative tolerance must be greater than 0`);if(r<0)throw Error(`Absolute tolerance must be at least 0`);return isNaN(e)||isNaN(t)?!1:!Number.isFinite(e)||!Number.isFinite(t)?e===t:e===t?!0:Math.abs(e-t)<=Math.max(n*Math.max(Math.abs(e),Math.abs(t)),r)}var eO=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},tO=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},nO=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},rO=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},iO=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},aO=Math.tanh||function(e){var t=Math.exp(2*e);return(t-1)/(t+1)};function oO(e,t){return(e>0?!0:e<0?!1:1/e==1/0)^(t>0?!0:t<0?!1:1/t==1/0)?-e:e}function sO(e,t){if(CE(e))return e;if(wE(e))return e.toNumber();t()}function cO(e,t){return CE(e)?e:wE(e)?e.toNumber():t}var lO=l(kD(),1),uO=function(){return uO=lO.default.create,lO.default},dO=Z(`typed`,[`?BigNumber`,`?Complex`,`?DenseMatrix`,`?Fraction`],function(e){var{BigNumber:t,Complex:n,DenseMatrix:r,Fraction:i}=e,a=uO();return a.clear(),a.addTypes([{name:`number`,test:CE},{name:`Complex`,test:EE},{name:`BigNumber`,test:wE},{name:`bigint`,test:TE},{name:`Fraction`,test:DE},{name:`Unit`,test:OE},{name:`identifier`,test:e=>kE&&/^(?:[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-\u088F\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\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]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])(?:[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-\u088F\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\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]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])*$/.test(e)},{name:`string`,test:kE},{name:`Chain`,test:fD},{name:`Array`,test:AE},{name:`Matrix`,test:jE},{name:`DenseMatrix`,test:NE},{name:`SparseMatrix`,test:PE},{name:`Range`,test:FE},{name:`Index`,test:IE},{name:`boolean`,test:LE},{name:`ResultSet`,test:RE},{name:`Help`,test:zE},{name:`function`,test:BE},{name:`Date`,test:VE},{name:`RegExp`,test:HE},{name:`null`,test:qE},{name:`undefined`,test:JE},{name:`AccessorNode`,test:YE},{name:`ArrayNode`,test:XE},{name:`AssignmentNode`,test:ZE},{name:`BlockNode`,test:QE},{name:`ConditionalNode`,test:$E},{name:`ConstantNode`,test:eD},{name:`FunctionNode`,test:rD},{name:`FunctionAssignmentNode`,test:nD},{name:`IndexNode`,test:iD},{name:`Node`,test:aD},{name:`ObjectNode`,test:oD},{name:`OperatorNode`,test:sD},{name:`ParenthesisNode`,test:cD},{name:`RangeNode`,test:lD},{name:`RelationalNode`,test:uD},{name:`SymbolNode`,test:dD},{name:`Map`,test:WE},{name:`Object`,test:UE}]),a.addConversions([{from:`number`,to:`BigNumber`,convert:function(e){if(t||fO(e),QD(e)>15)throw TypeError(`Cannot implicitly convert a number with >15 significant digits to BigNumber (value: `+e+`). Use function bignumber(x) to convert to BigNumber.`);return new t(e)}},{from:`number`,to:`Complex`,convert:function(e){return n||pO(e),new n(e,0)}},{from:`BigNumber`,to:`Complex`,convert:function(e){return n||pO(e),new n(e.toNumber(),0)}},{from:`bigint`,to:`number`,convert:function(e){if(e>2**53-1)throw TypeError(`Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: `+e+`)`);return Number(e)}},{from:`bigint`,to:`BigNumber`,convert:function(e){return t||fO(e),new t(e.toString())}},{from:`bigint`,to:`Fraction`,convert:function(e){return i||hO(e),new i(e)}},{from:`Fraction`,to:`BigNumber`,convert:function(e){throw 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(e){return n||pO(e),new n(e.valueOf(),0)}},{from:`number`,to:`Fraction`,convert:function(e){i||hO(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError(`Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: `+e+`). Use function fraction(x) to convert to Fraction.`);return t}},{from:`string`,to:`number`,convert:function(e){var t=Number(e);if(isNaN(t))throw Error(`Cannot convert "`+e+`" to a number`);return t}},{from:`string`,to:`BigNumber`,convert:function(e){t||fO(e);try{return new t(e)}catch{throw Error(`Cannot convert "`+e+`" to BigNumber`)}}},{from:`string`,to:`bigint`,convert:function(e){try{return BigInt(e)}catch{throw Error(`Cannot convert "`+e+`" to BigInt`)}}},{from:`string`,to:`Fraction`,convert:function(e){i||hO(e);try{return new i(e)}catch{throw Error(`Cannot convert "`+e+`" to Fraction`)}}},{from:`string`,to:`Complex`,convert:function(e){n||pO(e);try{return new n(e)}catch{throw Error(`Cannot convert "`+e+`" to Complex`)}}},{from:`boolean`,to:`number`,convert:function(e){return+e}},{from:`boolean`,to:`BigNumber`,convert:function(e){return t||fO(e),new t(+e)}},{from:`boolean`,to:`bigint`,convert:function(e){return BigInt(+e)}},{from:`boolean`,to:`Fraction`,convert:function(e){return i||hO(e),new i(+e)}},{from:`boolean`,to:`string`,convert:function(e){return String(e)}},{from:`Array`,to:`Matrix`,convert:function(e){return r||mO(),new r(e)}},{from:`Matrix`,to:`Array`,convert:function(e){return e.valueOf()}}]),a.onMismatch=(e,t,n)=>{var r=a.createError(e,t,n);if([`wrongType`,`mismatch`].includes(r.data.category)&&t.length===1&&ME(t[0])&&n.some(e=>!e.params.includes(`,`))){var i=TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw i.data=r.data,i}throw r},a.onMismatch=(e,t,n)=>{var r=a.createError(e,t,n);if([`wrongType`,`mismatch`].includes(r.data.category)&&t.length===1&&ME(t[0])&&n.some(e=>!e.params.includes(`,`))){var i=TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw i.data=r.data,i}throw r},a});function fO(e){throw Error(`Cannot convert value ${e} into a BigNumber: no class 'BigNumber' provided`)}function pO(e){throw Error(`Cannot convert value ${e} into a Complex number: no class 'Complex' provided`)}function mO(){throw Error(`Cannot convert array into a Matrix: no class 'DenseMatrix' provided`)}function hO(e){throw Error(`Cannot convert value ${e} into a Fraction, no class 'Fraction' provided.`)}var gO=Z(`ResultSet`,[],()=>{function e(t){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`);this.entries=t||[]}return e.prototype.type=`ResultSet`,e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return`[`+this.entries.map(String).join(`, `)+`]`},e.prototype.toJSON=function(){return{mathjs:`ResultSet`,entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e},{isClass:!0}),_O=9e15,vO=1e9,yO=`0123456789abcdef`,bO=`2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058`,xO=`3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789`,SO={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-_O,maxE:_O,crypto:!1},CO,wO,TO=!0,EO=`[DecimalError] `,DO=EO+`Invalid argument: `,OO=EO+`Precision limit exceeded`,kO=EO+`crypto unavailable`,AO=`[object Decimal]`,jO=Math.floor,MO=Math.pow,NO=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,PO=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,FO=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,IO=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,LO=1e7,RO=7,zO=9007199254740991,BO=bO.length-1,VO=xO.length-1,Q={toStringTag:AO};Q.absoluteValue=Q.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),JO(e)},Q.ceil=function(){return JO(new this.constructor(this),this.e+1,2)},Q.clampedTo=Q.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(DO+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)},Q.comparedTo=Q.cmp=function(e){var t,n,r,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,c=a.s,l=e.s;if(!o||!s)return!c||!l?NaN:c===l?o===s?0:!o^c<0?1:-1:c;if(!o[0]||!s[0])return o[0]?c:s[0]?-l:0;if(c!==l)return c;if(a.e!==e.e)return a.e>e.e^c<0?1:-1;for(r=o.length,i=s.length,t=0,n=r<i?r:i;t<n;++t)if(o[t]!==s[t])return o[t]>s[t]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},Q.cosine=Q.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+RO,r.rounding=1,n=KO(r,fk(r,n)),r.precision=e,r.rounding=t,JO(wO==2||wO==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)},Q.cubeRoot=Q.cbrt=function(){var e,t,n,r,i,a,o,s,c,l,u=this,d=u.constructor;if(!u.isFinite()||u.isZero())return new d(u);for(TO=!1,a=u.s*MO(u.s*u,1/3),!a||Math.abs(a)==1/0?(n=HO(u.d),e=u.e,(a=(e-n.length+1)%3)&&(n+=a==1||a==-2?`0`:`00`),a=MO(n,1/3),e=jO((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?n=`5e`+e:(n=a.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+e),r=new d(n),r.s=u.s):r=new d(a.toString()),o=(e=d.precision)+3;;)if(s=r,c=s.times(s).times(s),l=c.plus(u),r=qO(l.plus(u).times(s),l.plus(c),o+2,1),HO(s.d).slice(0,o)===(n=HO(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n==`9999`||!i&&n==`4999`){if(!i&&(JO(s,e+1,0),s.times(s).times(s).eq(u))){r=s;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(JO(r,e+1,1),t=!r.times(r).times(r).eq(u));break}return TO=!0,JO(r,e,d.rounding,t)},Q.decimalPlaces=Q.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-jO(this.e/RO))*RO,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},Q.dividedBy=Q.div=function(e){return qO(this,new this.constructor(e))},Q.dividedToIntegerBy=Q.divToInt=function(e){var t=this,n=t.constructor;return JO(qO(t,new n(e),0,1,1),n.precision,n.rounding)},Q.equals=Q.eq=function(e){return this.cmp(e)===0},Q.floor=function(){return JO(new this.constructor(this),this.e+1,3)},Q.greaterThan=Q.gt=function(e){return this.cmp(e)>0},Q.greaterThanOrEqualTo=Q.gte=function(e){var t=this.cmp(e);return t==1||t===0},Q.hyperbolicCosine=Q.cosh=function(){var e,t,n,r,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;n=o.precision,r=o.rounding,o.precision=n+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/dk(4,e)).toString()):(e=16,t=`2.3283064365386962890625e-10`),a=uk(o,1,a.times(t),new o(1),!0);for(var c,l=e,u=new o(8);l--;)c=a.times(a),a=s.minus(c.times(u.minus(c.times(u))));return JO(a,o.precision=n,o.rounding=r,!0)},Q.hyperbolicSine=Q.sinh=function(){var e,t,n,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=uk(a,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/dk(5,e)),i=uk(a,2,i,i,!0);for(var o,s=new a(5),c=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(c.times(o).plus(l))))}return a.precision=t,a.rounding=n,JO(i,t,n,!0)},Q.hyperbolicTangent=Q.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,qO(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},Q.inverseCosine=Q.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return n===-1?e.isZero()?QO(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2)):n===0?e.isNeg()?QO(t,r,i):new t(0):new t(NaN)},Q.inverseHyperbolicCosine=Q.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,TO=!1,n=n.times(n).minus(1).sqrt().plus(n),TO=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},Q.inverseHyperbolicSine=Q.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,TO=!1,n=n.times(n).plus(1).sqrt().plus(n),TO=!0,r.precision=e,r.rounding=t,n.ln())},Q.inverseHyperbolicTangent=Q.atanh=function(){var e,t,n,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?JO(new a(i),e,t,!0):(a.precision=n=r-i.e,i=qO(i.plus(1),new a(1).minus(i),n+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},Q.inverseSine=Q.asin=function(){var e,t,n,r,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),n=a.precision,r=a.rounding,t===-1?(a.precision=n+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=n,a.rounding=r,i.times(2)):t===0?(e=QO(a,n+4,r).times(.5),e.s=i.s,e):new a(NaN))},Q.inverseTangent=Q.atan=function(){var e,t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding;if(!l.isFinite()){if(!l.s)return new u(NaN);if(d+4<=VO)return o=QO(u,d+4,f).times(.5),o.s=l.s,o}else if(l.isZero())return new u(l);else if(l.abs().eq(1)&&d+4<=VO)return o=QO(u,d+4,f).times(.25),o.s=l.s,o;for(u.precision=s=d+10,u.rounding=1,n=Math.min(28,s/RO+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(TO=!1,t=Math.ceil(s/RO),r=1,c=l.times(l),o=new u(l),i=l;e!==-1;)if(i=i.times(c),a=o.minus(i.div(r+=2)),i=i.times(c),o=a.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),TO=!0,JO(o,u.precision=d,u.rounding=f,!0)},Q.isFinite=function(){return!!this.d},Q.isInteger=Q.isInt=function(){return!!this.d&&jO(this.e/RO)>this.d.length-2},Q.isNaN=function(){return!this.s},Q.isNegative=Q.isNeg=function(){return this.s<0},Q.isPositive=Q.isPos=function(){return this.s>0},Q.isZero=function(){return!!this.d&&this.d[0]===0},Q.lessThan=Q.lt=function(e){return this.cmp(e)<0},Q.lessThanOrEqualTo=Q.lte=function(e){return this.cmp(e)<1},Q.logarithm=Q.log=function(e){var t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding,p=5;if(e==null)e=new u(10),t=!0;else{if(e=new u(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new u(n&&!n[0]?-1/0:l.s==1?n?0:1/0:NaN);if(t)if(n.length>1)a=!0;else{for(i=n[0];i%10==0;)i/=10;a=i!==1}if(TO=!1,s=d+p,o=ak(l,s),r=t?ZO(u,s+10):ak(e,s),c=qO(o,r,s,1),WO(c.d,i=d,f))do if(s+=10,o=ak(l,s),r=t?ZO(u,s+10):ak(e,s),c=qO(o,r,s,1),!a){+HO(c.d).slice(i+1,i+15)+1==0x5af3107a4000&&(c=JO(c,d+1,0));break}while(WO(c.d,i+=10,f));return TO=!0,JO(c,d,f)},Q.minus=Q.sub=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d?e.s=-e.s:e=new m(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,s=m.precision,c=m.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new m(p);else return new m(c===3?-0:0);return TO?JO(e,s,c):e}if(n=jO(e.e/RO),u=jO(p.e/RO),l=l.slice(),a=u-n,a){for(d=a<0,d?(t=l,a=-a,o=f.length):(t=f,n=u,o=l.length),r=Math.max(Math.ceil(s/RO),o)+2,a>r&&(a=r,t.length=1),t.reverse(),r=a;r--;)t.push(0);t.reverse()}else{for(r=l.length,o=f.length,d=r<o,d&&(o=r),r=0;r<o;r++)if(l[r]!=f[r]){d=l[r]<f[r];break}a=0}for(d&&(t=l,l=f,f=t,e.s=-e.s),o=l.length,r=f.length-o;r>0;--r)l[o++]=0;for(r=f.length;r>a;){if(l[--r]<f[r]){for(i=r;i&&l[--i]===0;)l[i]=LO-1;--l[i],l[r]+=LO}l[r]-=f[r]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--n;return l[0]?(e.d=l,e.e=XO(l,n),TO?JO(e,s,c):e):new m(c===3?-0:0)},Q.modulo=Q.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?JO(new r(n),r.precision,r.rounding):(TO=!1,r.modulo==9?(t=qO(n,e.abs(),0,3,1),t.s*=e.s):t=qO(n,e,0,r.modulo,1),t=t.times(e),TO=!0,n.minus(t))},Q.naturalExponential=Q.exp=function(){return ik(this)},Q.naturalLogarithm=Q.ln=function(){return ak(this)},Q.negated=Q.neg=function(){var e=new this.constructor(this);return e.s=-e.s,JO(e)},Q.plus=Q.add=function(e){var t,n,r,i,a,o,s,c,l,u,d=this,f=d.constructor;if(e=new f(e),!d.d||!e.d)return!d.s||!e.s?e=new f(NaN):d.d||(e=new f(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(l=d.d,u=e.d,s=f.precision,c=f.rounding,!l[0]||!u[0])return u[0]||(e=new f(d)),TO?JO(e,s,c):e;if(a=jO(d.e/RO),r=jO(e.e/RO),l=l.slice(),i=a-r,i){for(i<0?(n=l,i=-i,o=u.length):(n=u,r=a,o=l.length),a=Math.ceil(s/RO),o=a>o?a+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=l.length,i=u.length,o-i<0&&(i=o,n=u,u=l,l=n),t=0;i;)t=(l[--i]=l[i]+u[i]+t)/LO|0,l[i]%=LO;for(t&&(l.unshift(t),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=XO(l,r),TO?JO(e,s,c):e},Q.precision=Q.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(DO+e);return n.d?(t=$O(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},Q.round=function(){var e=this,t=e.constructor;return JO(new t(e),e.e+1,t.rounding)},Q.sine=Q.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+RO,r.rounding=1,n=lk(r,fk(r,n)),r.precision=e,r.rounding=t,JO(wO>2?n.neg():n,e,t,!0)):new r(NaN)},Q.squareRoot=Q.sqrt=function(){var e,t,n,r,i,a,o=this,s=o.d,c=o.e,l=o.s,u=o.constructor;if(l!==1||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);for(TO=!1,l=Math.sqrt(+o),l==0||l==1/0?(t=HO(s),(t.length+c)%2==0&&(t+=`0`),l=Math.sqrt(t),c=jO((c+1)/2)-(c<0||c%2),l==1/0?t=`5e`+c:(t=l.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+c),r=new u(t)):r=new u(l.toString()),n=(c=u.precision)+3;;)if(a=r,r=a.plus(qO(o,a,n+2,1)).times(.5),HO(a.d).slice(0,n)===(t=HO(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t==`9999`||!i&&t==`4999`){if(!i&&(JO(a,c+1,0),a.times(a).eq(o))){r=a;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)==`5`)&&(JO(r,c+1,1),e=!r.times(r).eq(o));break}return TO=!0,JO(r,c,u.rounding,e)},Q.tangent=Q.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=qO(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,JO(wO==2||wO==4?n.neg():n,e,t,!0)):new r(NaN)},Q.times=Q.mul=function(e){var t,n,r,i,a,o,s,c,l,u=this,d=u.constructor,f=u.d,p=(e=new d(e)).d;if(e.s*=u.s,!f||!f[0]||!p||!p[0])return new d(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=jO(u.e/RO)+jO(e.e/RO),c=f.length,l=p.length,c<l&&(a=f,f=p,p=a,o=c,c=l,l=o),a=[],o=c+l,r=o;r--;)a.push(0);for(r=l;--r>=0;){for(t=0,i=c+r;i>r;)s=a[i]+p[r]*f[i-r-1]+t,a[i--]=s%LO|0,t=s/LO|0;a[i]=(a[i]+t)%LO|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=XO(a,n),TO?JO(e,d.precision,d.rounding):e},Q.toBinary=function(e,t){return pk(this,2,e,t)},Q.toDecimalPlaces=Q.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(UO(e,0,vO),t===void 0?t=r.rounding:UO(t,0,8),JO(n,e+n.e+1,t))},Q.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=YO(r,!0):(UO(e,0,vO),t===void 0?t=i.rounding:UO(t,0,8),r=JO(new i(r),e+1,t),n=YO(r,!0,e+1)),r.isNeg()&&!r.isZero()?`-`+n:n},Q.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?n=YO(i):(UO(e,0,vO),t===void 0?t=a.rounding:UO(t,0,8),r=JO(new a(i),e+i.e+1,t),n=YO(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?`-`+n:n},Q.toFraction=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.d,h=p.constructor;if(!m)return new h(p);if(l=n=new h(1),r=c=new h(0),t=new h(r),a=t.e=$O(m)-p.e-1,o=a%RO,t.d[0]=MO(10,o<0?RO+o:o),e==null)e=a>0?t:l;else{if(s=new h(e),!s.isInt()||s.lt(l))throw Error(DO+s);e=s.gt(t)?a>0?t:l:s}for(TO=!1,s=new h(HO(m)),u=h.precision,h.precision=a=m.length*RO*2;d=qO(s,t,0,1,1),i=n.plus(d.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=c.plus(d.times(i)),c=i,i=t,t=s.minus(d.times(i)),s=i;return i=qO(e.minus(n),r,0,1,1),c=c.plus(i.times(l)),n=n.plus(i.times(r)),c.s=l.s=p.s,f=qO(l,r,a,1).minus(p).abs().cmp(qO(c,n,a,1).minus(p).abs())<1?[l,r]:[c,n],h.precision=u,TO=!0,f},Q.toHexadecimal=Q.toHex=function(e,t){return pk(this,16,e,t)},Q.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:UO(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&=n.s,e}return e.d[0]?(TO=!1,n=qO(n,e,0,t,1).times(e),TO=!0,JO(n)):(e.s=n.s,n=e),n},Q.toNumber=function(){return+this},Q.toOctal=function(e,t){return pk(this,8,e,t)},Q.toPower=Q.pow=function(e){var t,n,r,i,a,o,s=this,c=s.constructor,l=+(e=new c(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new c(MO(+s,l));if(s=new c(s),s.eq(1))return s;if(r=c.precision,a=c.rounding,e.eq(1))return JO(s,r,a);if(t=jO(e.e/RO),t>=e.d.length-1&&(n=l<0?-l:l)<=zO)return i=tk(c,s,n,r),e.s<0?new c(1).div(i):JO(i,r,a);if(o=s.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=o,s}return n=MO(+s,l),t=n==0||!isFinite(n)?jO(l*(Math.log(`0.`+HO(s.d))/Math.LN10+s.e+1)):new c(n+``).e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(TO=!1,c.rounding=s.s=1,n=Math.min(12,(t+``).length),i=ik(e.times(ak(s,r+n)),r),i.d&&(i=JO(i,r+5,1),WO(i.d,r,a)&&(t=r+10,i=JO(ik(e.times(ak(s,t+n)),t),t+5,1),+HO(i.d).slice(r+1,r+15)+1==0x5af3107a4000&&(i=JO(i,r+1,0)))),i.s=o,TO=!0,c.rounding=a,JO(i,r,a))},Q.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=YO(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(UO(e,1,vO),t===void 0?t=i.rounding:UO(t,0,8),r=JO(new i(r),e,t),n=YO(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?`-`+n:n},Q.toSignificantDigits=Q.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(UO(e,1,vO),t===void 0?t=r.rounding:UO(t,0,8)),JO(new r(n),e,t)},Q.toString=function(){var e=this,t=e.constructor,n=YO(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?`-`+n:n},Q.truncated=Q.trunc=function(){return JO(new this.constructor(this),this.e+1,1)},Q.valueOf=Q.toJSON=function(){var e=this,t=e.constructor,n=YO(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?`-`+n:n};function HO(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+``,n=RO-r.length,n&&(a+=ek(n)),a+=r;o=e[t],r=o+``,n=RO-r.length,n&&(a+=ek(n))}else if(o===0)return`0`;for(;o%10==0;)o/=10;return a+o}function UO(e,t,n){if(e!==~~e||e<t||e>n)throw Error(DO+e)}function WO(e,t,n,r){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=RO,i=0):(i=Math.ceil((t+1)/RO),t%=RO),a=MO(10,RO-t),s=e[i]%a|0,r==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=n<4&&s==99999||n>3&&s==49999||s==5e4||s==0):o=(n<4&&s+1==a||n>3&&s+1==a/2)&&(e[i+1]/a/100|0)==MO(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(r||n<4)&&s==9999||!r&&n>3&&s==4999):o=((r||n<4)&&s+1==a||!r&&n>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==MO(10,t-3)-1,o}function GO(e,t,n){for(var r,i=[0],a,o=0,s=e.length;o<s;){for(a=i.length;a--;)i[a]*=t;for(i[0]+=yO.indexOf(e.charAt(o++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function KO(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/dk(4,n)).toString()):(n=16,i=`2.3283064365386962890625e-10`),e.precision+=n,t=uk(e,1,t.times(i),new e(1));for(var a=n;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var qO=(function(){function e(e,t,n){var r,i=0,a=e.length;for(e=e.slice();a--;)r=e[a]*t+i,e[a]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,a,o,s,c){var l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k=r.constructor,A=r.s==i.s?1:-1,j=r.d,M=i.d;if(!j||!j[0]||!M||!M[0])return new k(!r.s||!i.s||(j?M&&j[0]==M[0]:!M)?NaN:j&&j[0]==0||!M?A*0:A/0);for(c?(p=1,u=r.e-i.e):(c=LO,p=RO,u=jO(r.e/p)-jO(i.e/p)),D=M.length,T=j.length,_=new k(A),v=_.d=[],d=0;M[d]==(j[d]||0);d++);if(M[d]>(j[d]||0)&&u--,a==null?(S=a=k.precision,o=k.rounding):S=s?a+(r.e-i.e)+1:a,S<0)v.push(1),m=!0;else{if(S=S/p+2|0,d=0,D==1){for(f=0,M=M[0],S++;(d<T||f)&&S--;d++)C=f*c+(j[d]||0),v[d]=C/M|0,f=C%M|0;m=f||d<T}else{for(f=c/(M[0]+1)|0,f>1&&(M=e(M,f,c),j=e(j,f,c),D=M.length,T=j.length),w=D,y=j.slice(0,D),b=y.length;b<D;)y[b++]=0;O=M.slice(),O.unshift(0),E=M[0],M[1]>=c/2&&++E;do f=0,l=t(M,y,D,b),l<0?(x=y[0],D!=b&&(x=x*c+(y[1]||0)),f=x/E|0,f>1?(f>=c&&(f=c-1),h=e(M,f,c),g=h.length,b=y.length,l=t(h,y,g,b),l==1&&(f--,n(h,D<g?O:M,g,c))):(f==0&&(l=f=1),h=M.slice()),g=h.length,g<b&&h.unshift(0),n(y,h,b,c),l==-1&&(b=y.length,l=t(M,y,D,b),l<1&&(f++,n(y,D<b?O:M,b,c))),b=y.length):l===0&&(f++,y=[0]),v[d++]=f,l&&y[0]?y[b++]=j[w]||0:(y=[j[w]],b=1);while((w++<T||y[0]!==void 0)&&S--);m=y[0]!==void 0}v[0]||v.shift()}if(p==1)_.e=u,CO=m;else{for(d=1,f=v[0];f>=10;f/=10)d++;_.e=d+u*p-1,JO(_,s?a+_.e+1:a,o,m)}return _}})();function JO(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor;out:if(t!=null){if(d=e.d,!d)return e;for(i=1,s=d[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=RO,o=t,u=d[f=0],c=u/MO(10,i-o-1)%10|0;else if(f=Math.ceil((a+1)/RO),s=d.length,f>=s)if(r){for(;s++<=f;)d.push(0);u=c=0,i=1,a%=RO,o=a-RO+1}else break out;else{for(u=s=d[f],i=1;s>=10;s/=10)i++;a%=RO,o=a-RO+i,c=o<0?0:u/MO(10,i-o-1)%10|0}if(r=r||t<0||d[f+1]!==void 0||(o<0?u:u%MO(10,i-o-1)),l=n<4?(c||r)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(a>0?o>0?u/MO(10,i-o):0:d[f-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,l?(t-=e.e+1,d[0]=MO(10,(RO-t%RO)%RO),e.e=-t||0):d[0]=e.e=0,e;if(a==0?(d.length=f,s=1,f--):(d.length=f+1,s=MO(10,RO-a),d[f]=o>0?(u/MO(10,i-o)%MO(10,o)|0)*s:0),l)for(;;)if(f==0){for(a=1,o=d[0];o>=10;o/=10)a++;for(o=d[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,d[0]==LO&&(d[0]=1));break}else{if(d[f]+=s,d[f]!=LO)break;d[f--]=0,s=1}for(a=d.length;d[--a]===0;)d.pop()}return TO&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function YO(e,t,n){if(!e.isFinite())return ok(e);var r,i=e.e,a=HO(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+`.`+a.slice(1)+ek(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(e.e<0?`e`:`e+`)+e.e):i<0?(a=`0.`+ek(-i-1)+a,n&&(r=n-o)>0&&(a+=ek(r))):i>=o?(a+=ek(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+ek(r))):((r=i+1)<o&&(a=a.slice(0,r)+`.`+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+=`.`),a+=ek(r))),a}function XO(e,t){var n=e[0];for(t*=RO;n>=10;n/=10)t++;return t}function ZO(e,t,n){if(t>BO)throw TO=!0,n&&(e.precision=n),Error(OO);return JO(new e(bO),t,1,!0)}function QO(e,t,n){if(t>VO)throw Error(OO);return JO(new e(xO),t,n,!0)}function $O(e){var t=e.length-1,n=t*RO+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function ek(e){for(var t=``;e--;)t+=`0`;return t}function tk(e,t,n,r){var i,a=new e(1),o=Math.ceil(r/RO+4);for(TO=!1;;){if(n%2&&(a=a.times(t),mk(a.d,o)&&(i=!0)),n=jO(n/2),n===0){n=a.d.length-1,i&&a.d[n]===0&&++a.d[n];break}t=t.times(t),mk(t.d,o)}return TO=!0,a}function nk(e){return e.d[e.d.length-1]&1}function rk(e,t,n){for(var r,i,a=new e(t[0]),o=0;++o<t.length;){if(i=new e(t[o]),!i.s){a=i;break}r=a.cmp(i),(r===n||r===0&&a.s===n)&&(a=i)}return a}function ik(e,t){var n,r,i,a,o,s,c,l=0,u=0,d=0,f=e.constructor,p=f.rounding,m=f.precision;if(!e.d||!e.d[0]||e.e>17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(TO=!1,c=m):c=t,s=new f(.03125);e.e>-2;)e=e.times(s),d+=5;for(r=Math.log(MO(2,d))/Math.LN10*2+5|0,c+=r,n=a=o=new f(1),f.precision=c;;){if(a=JO(a.times(e),c,1),n=n.times(++u),s=o.plus(qO(a,n,c,1)),HO(s.d).slice(0,c)===HO(o.d).slice(0,c)){for(i=d;i--;)o=JO(o.times(o),c,1);if(t==null)if(l<3&&WO(o.d,c-r,p,l))f.precision=c+=10,n=a=s=new f(1),u=0,l++;else return JO(o,f.precision=m,p,TO=!0);else return f.precision=m,o}o=s}}function ak(e,t){var n,r,i,a,o,s,c,l,u,d,f,p=1,m=10,h=e,g=h.d,_=h.constructor,v=_.rounding,y=_.precision;if(h.s<0||!g||!g[0]||!h.e&&g[0]==1&&g.length==1)return new _(g&&!g[0]?-1/0:h.s==1?g?0:h:NaN);if(t==null?(TO=!1,u=y):u=t,_.precision=u+=m,n=HO(g),r=n.charAt(0),Math.abs(a=h.e)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=HO(h.d),r=n.charAt(0),p++;a=h.e,r>1?(h=new _(`0.`+n),a++):h=new _(r+`.`+n.slice(1))}else return l=ZO(_,u+2,y).times(a+``),h=ak(new _(r+`.`+n.slice(1)),u-m).plus(l),_.precision=y,t==null?JO(h,y,v,TO=!0):h;for(d=h,c=o=h=qO(h.minus(1),h.plus(1),u,1),f=JO(h.times(h),u,1),i=3;;){if(o=JO(o.times(f),u,1),l=c.plus(qO(o,new _(i),u,1)),HO(l.d).slice(0,u)===HO(c.d).slice(0,u))if(c=c.times(2),a!==0&&(c=c.plus(ZO(_,u+2,y).times(a+``))),c=qO(c,new _(p),u,1),t==null)if(WO(c.d,u-m,v,s))_.precision=u+=m,l=o=h=qO(d.minus(1),d.plus(1),u,1),f=JO(h.times(h),u,1),i=s=1;else return JO(c,_.precision=y,v,TO=!0);else return _.precision=y,c;c=l,i+=2}}function ok(e){return String(e.s*e.s/0)}function sk(e,t){var n,r,i;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%RO,n<0&&(r+=RO),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=RO;r<i;)e.d.push(+t.slice(r,r+=RO));t=t.slice(r),r=RO-t.length}else r-=i;for(;r--;)t+=`0`;e.d.push(+t),TO&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function ck(e,t){var n,r,i,a,o,s,c,l,u;if(t.indexOf(`_`)>-1){if(t=t.replace(/(\d)_(?=\d)/g,`$1`),IO.test(t))return sk(e,t)}else if(t===`Infinity`||t===`NaN`)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(PO.test(t))n=16,t=t.toLowerCase();else if(NO.test(t))n=2;else if(FO.test(t))n=8;else throw Error(DO+t);for(a=t.search(/p/i),a>0?(c=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf(`.`),o=a>=0,r=e.constructor,o&&(t=t.replace(`.`,``),s=t.length,a=s-a,i=tk(r,new r(n),a,a*2)),l=GO(t,n,LO),u=l.length-1,a=u;l[a]===0;--a)l.pop();return a<0?new r(e.s*0):(e.e=XO(l,u),e.d=l,TO=!1,o&&(e=qO(e,i,s*4)),c&&(e=e.times(Math.abs(c)<54?MO(2,c):nA.pow(2,c))),TO=!0,e)}function lk(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:uk(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/dk(5,n)),t=uk(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function uk(e,t,n,r,i){var a,o,s,c,l=1,u=e.precision,d=Math.ceil(u/RO);for(TO=!1,c=n.times(n),s=new e(r);;){if(o=qO(s.times(c),new e(t++*t++),u,1),s=i?r.plus(o):r.minus(o),r=qO(o.times(c),new e(t++*t++),u,1),o=s.plus(r),o.d[d]!==void 0){for(a=d;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=r,r=o,o=a,l++}return TO=!0,o.d.length=d+1,o}function dk(e,t){for(var n=e;--t;)n*=e;return n}function fk(e,t){var n,r=t.s<0,i=QO(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return wO=r?4:1,t;if(n=t.divToInt(i),n.isZero())wO=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(a))return wO=nk(n)?r?2:3:r?4:1,t;wO=nk(n)?r?1:4:r?3:2}return t.minus(i).abs()}function pk(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor,m=n!==void 0;if(m?(UO(n,1,vO),r===void 0?r=p.rounding:UO(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())u=ok(e);else{for(u=YO(e),o=u.indexOf(`.`),m?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(u=u.replace(`.`,``),f=new p(1),f.e=u.length-o,f.d=GO(YO(f),10,i),f.e=f.d.length),d=GO(u,10,i),a=c=d.length;d[--c]==0;)d.pop();if(!d[0])u=m?`0p+0`:`0`;else{if(o<0?a--:(e=new p(e),e.d=d,e.e=a,e=qO(e,f,n,r,0,i),d=e.d,a=e.e,l=CO),o=d[n],s=i/2,l||=d[n+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(e.s<0?3:2)):o>s||o===s&&(r===4||l||r===6&&d[n-1]&1||r===(e.s<0?8:7)),d.length=n,l)for(;++d[--n]>i-1;)d[n]=0,n||(++a,d.unshift(1));for(c=d.length;!d[c-1];--c);for(o=0,u=``;o<c;o++)u+=yO.charAt(d[o]);if(m){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)u+=`0`;for(d=GO(u,i,t),c=d.length;!d[c-1];--c);for(o=1,u=`1.`;o<c;o++)u+=yO.charAt(d[o])}else u=u.charAt(0)+`.`+u.slice(1);u=u+(a<0?`p`:`p+`)+a}else if(a<0){for(;++a;)u=`0`+u;u=`0.`+u}else if(++a>c)for(a-=c;a--;)u+=`0`;else a<c&&(u=u.slice(0,a)+`.`+u.slice(a))}u=(t==16?`0x`:t==2?`0b`:t==8?`0o`:``)+u}return e.s<0?`-`+u:u}function mk(e,t){if(e.length>t)return e.length=t,!0}function hk(e){return new this(e).abs()}function gk(e){return new this(e).acos()}function _k(e){return new this(e).acosh()}function vk(e,t){return new this(e).plus(t)}function yk(e){return new this(e).asin()}function bk(e){return new this(e).asinh()}function xk(e){return new this(e).atan()}function Sk(e){return new this(e).atanh()}function Ck(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,a=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=QO(this,a,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?QO(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=QO(this,a,1).times(.5),n.s=e.s):t.s<0?(this.precision=a,this.rounding=1,n=this.atan(qO(e,t,a,1)),t=QO(this,a,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(qO(e,t,a,1)),n}function wk(e){return new this(e).cbrt()}function Tk(e){return JO(e=new this(e),e.e+1,2)}function Ek(e,t,n){return new this(e).clamp(t,n)}function Dk(e){if(!e||typeof e!=`object`)throw Error(EO+`Object expected`);var t,n,r,i=e.defaults===!0,a=[`precision`,1,vO,`rounding`,0,8,`toExpNeg`,-_O,0,`toExpPos`,0,_O,`maxE`,0,_O,`minE`,-_O,0,`modulo`,0,9];for(t=0;t<a.length;t+=3)if(n=a[t],i&&(this[n]=SO[n]),(r=e[n])!==void 0)if(jO(r)===r&&r>=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(DO+n+`: `+r);if(n=`crypto`,i&&(this[n]=SO[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(kO);else this[n]=!1;else throw Error(DO+n+`: `+r);return this}function Ok(e){return new this(e).cos()}function kk(e){return new this(e).cosh()}function Ak(e){var t,n,r;function i(e){var t,n,r,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,Fk(e)){a.s=e.s,TO?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d);return}if(r=typeof e,r===`number`){if(e===0){a.s=1/e<0?-1:1,a.e=0,a.d=[0];return}if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;TO?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]);return}if(e*0!=0){e||(a.s=NaN),a.e=NaN,a.d=null;return}return sk(a,e.toString())}if(r===`string`)return(n=e.charCodeAt(0))===45?(e=e.slice(1),a.s=-1):(n===43&&(e=e.slice(1)),a.s=1),IO.test(e)?sk(a,e):ck(a,e);if(r===`bigint`)return e<0?(e=-e,a.s=-1):a.s=1,sk(a,e.toString());throw Error(DO+e)}if(i.prototype=Q,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=Dk,i.clone=Ak,i.isDecimal=Fk,i.abs=hk,i.acos=gk,i.acosh=_k,i.add=vk,i.asin=yk,i.asinh=bk,i.atan=xk,i.atanh=Sk,i.atan2=Ck,i.cbrt=wk,i.ceil=Tk,i.clamp=Ek,i.cos=Ok,i.cosh=kk,i.div=jk,i.exp=Mk,i.floor=Nk,i.hypot=Pk,i.ln=Ik,i.log=Lk,i.log10=zk,i.log2=Rk,i.max=Bk,i.min=Vk,i.mod=Hk,i.mul=Uk,i.pow=Wk,i.random=Gk,i.round=Kk,i.sign=qk,i.sin=Jk,i.sinh=Yk,i.sqrt=Xk,i.sub=Zk,i.sum=Qk,i.tan=$k,i.tanh=eA,i.trunc=tA,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`maxE`,`minE`,`modulo`,`crypto`],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function jk(e,t){return new this(e).div(t)}function Mk(e){return new this(e).exp()}function Nk(e){return JO(e=new this(e),e.e+1,3)}function Pk(){var e,t,n=new this(0);for(TO=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return TO=!0,new this(1/0);n=t}return TO=!0,n.sqrt()}function Fk(e){return e instanceof nA||e&&e.toStringTag===AO||!1}function Ik(e){return new this(e).ln()}function Lk(e,t){return new this(e).log(t)}function Rk(e){return new this(e).log(2)}function zk(e){return new this(e).log(10)}function Bk(){return rk(this,arguments,-1)}function Vk(){return rk(this,arguments,1)}function Hk(e,t){return new this(e).mod(t)}function Uk(e,t){return new this(e).mul(t)}function Wk(e,t){return new this(e).pow(t)}function Gk(e){var t,n,r,i,a=0,o=new this(1),s=[];if(e===void 0?e=this.precision:UO(e,1,vO),r=Math.ceil(e/RO),!this.crypto)for(;a<r;)s[a++]=Math.random()*1e7|0;else if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));a<r;)i=t[a],i>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);a<r;)i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((t[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=r/4}else throw Error(kO);for(r=s[--a],e%=RO,r&&e&&(i=MO(10,RO-e),s[a]=(r/i|0)*i);s[a]===0;a--)s.pop();if(a<0)n=0,s=[0];else{for(n=-1;s[0]===0;n-=RO)s.shift();for(r=1,i=s[0];i>=10;i/=10)r++;r<RO&&(n-=RO-r)}return o.e=n,o.d=s,o}function Kk(e){return JO(e=new this(e),e.e+1,this.rounding)}function qk(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Jk(e){return new this(e).sin()}function Yk(e){return new this(e).sinh()}function Xk(e){return new this(e).sqrt()}function Zk(e,t){return new this(e).sub(t)}function Qk(){var e=0,t=arguments,n=new this(t[e]);for(TO=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return TO=!0,JO(n,this.precision,this.rounding)}function $k(e){return new this(e).tan()}function eA(e){return new this(e).tanh()}function tA(e){return JO(e=new this(e),e.e+1,1)}Q[Symbol.for(`nodejs.util.inspect.custom`)]=Q.toString,Q[Symbol.toStringTag]=`Decimal`;var nA=Q.constructor=Ak(SO);bO=new nA(bO),xO=new nA(xO);var rA=Z(`BigNumber`,[`?on`,`config`],e=>{var{on:t,config:n}=e,r=nA.clone({precision:n.precision,modulo:nA.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type=`BigNumber`,r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:`BigNumber`,value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t(`config`,function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})}),r},{isClass:!0}),iA=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:(Math.exp(e)+Math.exp(-e))*.5},aA=Math.sinh||function(e){return Math.abs(e)<1e-9?e:(Math.exp(e)-Math.exp(-e))*.5},oA=e=>{let t=Math.sin(.5*e);return-2*t*t},sA=function(e,t){return e=Math.abs(e),t=Math.abs(t),e<t&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},cA=function(){throw SyntaxError(`Invalid Param`)};function lA(e,t){let n=Math.abs(e),r=Math.abs(t);return e===0?Math.log(r):t===0?Math.log(n):n<3e3&&r<3e3?Math.log(e*e+t*t)*.5:(e*=.5,t*=.5,.5*Math.log(e*e+t*t)+Math.LN2)}var uA={re:0,im:0},dA=function(e,t){let n=uA;if(e==null)n.re=n.im=0;else if(t!==void 0)n.re=e,n.im=t;else switch(typeof e){case`object`:if(`im`in e&&`re`in e)n.re=e.re,n.im=e.im;else if(`abs`in e&&`arg`in e){if(!isFinite(e.abs)&&isFinite(e.arg))return $.INFINITY;n.re=e.abs*Math.cos(e.arg),n.im=e.abs*Math.sin(e.arg)}else if(`r`in e&&`phi`in e){if(!isFinite(e.r)&&isFinite(e.phi))return $.INFINITY;n.re=e.r*Math.cos(e.phi),n.im=e.r*Math.sin(e.phi)}else e.length===2?(n.re=e[0],n.im=e[1]):cA();break;case`string`:n.im=n.re=0;let t=e.replace(/_/g,``).match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),r=1,i=0;t===null&&cA();for(let e=0;e<t.length;e++){let a=t[e];a===` `||a===` `||a===`
`||(a===`+`?r++:a===`-`?i++:a===`i`||a===`I`?(r+i===0&&cA(),t[e+1]!==` `&&!isNaN(t[e+1])?(n.im+=parseFloat((i%2?`-`:``)+t[e+1]),e++):n.im+=parseFloat((i%2?`-`:``)+`1`),r=i=0):((r+i===0||isNaN(a))&&cA(),t[e+1]===`i`||t[e+1]===`I`?(n.im+=parseFloat((i%2?`-`:``)+a),e++):n.re+=parseFloat((i%2?`-`:``)+a),r=i=0))}r+i>0&&cA();break;case`number`:n.im=0,n.re=e;break;default:cA()}return isNaN(n.re)||isNaN(n.im),n};function $(e,t){if(!(this instanceof $))return new $(e,t);let n=dA(e,t);this.re=n.re,this.im=n.im}$.prototype={re:0,im:0,sign:function(){let e=sA(this.re,this.im);return new $(this.re/e,this.im/e)},add:function(e,t){let n=dA(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?$.NAN:$.INFINITY:new $(this.re+n.re,this.im+n.im)},sub:function(e,t){let n=dA(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?$.NAN:$.INFINITY:new $(this.re-n.re,this.im-n.im)},mul:function(e,t){let n=dA(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),a=this.re===0&&this.im===0,o=n.re===0&&n.im===0;return r&&o||i&&a?$.NAN:r||i?$.INFINITY:n.im===0&&this.im===0?new $(this.re*n.re,0):new $(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(e,t){let n=dA(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),a=this.re===0&&this.im===0,o=n.re===0&&n.im===0;if(a&&o||r&&i)return $.NAN;if(o||r)return $.INFINITY;if(a||i)return $.ZERO;if(n.im===0)return new $(this.re/n.re,this.im/n.re);if(Math.abs(n.re)<Math.abs(n.im)){let e=n.re/n.im,t=n.re*e+n.im;return new $((this.re*e+this.im)/t,(this.im*e-this.re)/t)}else{let e=n.im/n.re,t=n.im*e+n.re;return new $((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let n=dA(e,t),r=this.re===0&&this.im===0;if(n.re===0&&n.im===0)return $.ONE;if(n.im===0){if(this.im===0&&this.re>0)return new $(this.re**+n.re,0);if(this.re===0)switch((n.re%4+4)%4){case 0:return new $(this.im**+n.re,0);case 1:return new $(0,this.im**+n.re);case 2:return new $(-(this.im**+n.re),0);case 3:return new $(0,-(this.im**+n.re))}}if(r&&n.re>0)return $.ZERO;let i=Math.atan2(this.im,this.re),a=lA(this.re,this.im),o=Math.exp(n.re*a-n.im*i),s=n.im*a+n.re*i;return new $(o*Math.cos(s),o*Math.sin(s))},sqrt:function(){let e=this.re,t=this.im;if(t===0)return e>=0?new $(Math.sqrt(e),0):new $(0,Math.sqrt(-e));let n=sA(e,t),r=Math.sqrt(.5*(n+Math.abs(e))),i=Math.abs(t)/(2*r);return e>=0?new $(r,t<0?-i:i):new $(i,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return this.im===0?new $(e,0):new $(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new $(Math.expm1(e)*Math.cos(t)+oA(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return t===0&&e>0?new $(Math.log(e),0):new $(lA(e,t),Math.atan2(t,e))},abs:function(){return sA(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new $(Math.sin(e)*iA(t),Math.cos(e)*aA(t))},cos:function(){let e=this.re,t=this.im;return new $(Math.cos(e)*iA(t),-Math.sin(e)*aA(t))},tan:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)+iA(t);return new $(Math.sin(e)/n,aA(t)/n)},cot:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)-iA(t);return new $(-Math.sin(e)/n,aA(t)/n)},sec:function(){let e=this.re,t=this.im,n=.5*iA(2*t)+.5*Math.cos(2*e);return new $(Math.cos(e)*iA(t)/n,Math.sin(e)*aA(t)/n)},csc:function(){let e=this.re,t=this.im,n=.5*iA(2*t)-.5*Math.cos(2*e);return new $(Math.sin(e)*iA(t)/n,-Math.cos(e)*aA(t)/n)},asin:function(){let e=this.re,t=this.im,n=new $(t*t-e*e+1,-2*e*t).sqrt(),r=new $(n.re-t,n.im+e).log();return new $(r.im,-r.re)},acos:function(){let e=this.re,t=this.im,n=new $(t*t-e*e+1,-2*e*t).sqrt(),r=new $(n.re-t,n.im+e).log();return new $(Math.PI/2-r.im,r.re)},atan:function(){let e=this.re,t=this.im;if(e===0){if(t===1)return new $(0,1/0);if(t===-1)return new $(0,-1/0)}let n=e*e+(1-t)*(1-t),r=new $((1-t*t-e*e)/n,-2*e/n).log();return new $(-.5*r.im,.5*r.re)},acot:function(){let e=this.re,t=this.im;if(t===0)return new $(Math.atan2(1,e),0);let n=e*e+t*t;return n===0?new $(e===0?0:e/0,t===0?0:-t/0).atan():new $(e/n,-t/n).atan()},asec:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new $(0,1/0);let n=e*e+t*t;return n===0?new $(e===0?0:e/0,t===0?0:-t/0).acos():new $(e/n,-t/n).acos()},acsc:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new $(Math.PI/2,1/0);let n=e*e+t*t;return n===0?new $(e===0?0:e/0,t===0?0:-t/0).asin():new $(e/n,-t/n).asin()},sinh:function(){let e=this.re,t=this.im;return new $(aA(e)*Math.cos(t),iA(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new $(iA(e)*Math.cos(t),aA(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,n=iA(e)+Math.cos(t);return new $(aA(e)/n,Math.sin(t)/n)},coth:function(){let e=2*this.re,t=2*this.im,n=iA(e)-Math.cos(t);return new $(aA(e)/n,-Math.sin(t)/n)},csch:function(){let e=this.re,t=this.im,n=Math.cos(2*t)-iA(2*e);return new $(-2*aA(e)*Math.cos(t)/n,2*iA(e)*Math.sin(t)/n)},sech:function(){let e=this.re,t=this.im,n=Math.cos(2*t)+iA(2*e);return new $(2*iA(e)*Math.cos(t)/n,-2*aA(e)*Math.sin(t)/n)},asinh:function(){let e=this.re,t=this.im;if(t===0){if(e===0)return new $(0,0);let t=Math.abs(e),n=Math.log(t+Math.sqrt(t*t+1));return new $(e<0?-n:n,0)}let n=new $(e*e-t*t+1,2*e*t).sqrt();return new $(e+n.re,t+n.im).log()},acosh:function(){let e=this.re,t=this.im;if(t===0){if(e>1)return new $(Math.log(e+Math.sqrt(e-1)*Math.sqrt(e+1)),0);if(e<-1){let t=Math.sqrt(e*e-1);return new $(Math.log(-e+t),Math.PI)}return new $(0,Math.acos(e))}let n=new $(e-1,t).sqrt(),r=new $(e+1,t).sqrt();return new $(e+n.re*r.re-n.im*r.im,t+n.re*r.im+n.im*r.re).log()},atanh:function(){let e=this.re,t=this.im;if(t===0){if(e===0)return new $(0,0);if(e===1)return new $(1/0,0);if(e===-1)return new $(-1/0,0);if(-1<e&&e<1)return new $(.5*Math.log((1+e)/(1-e)),0);if(e>1){let t=(e+1)/(e-1);return new $(.5*Math.log(t),-Math.PI/2)}let t=(1+e)/(1-e);return new $(.5*Math.log(-t),Math.PI/2)}let n=1-e,r=1+e,i=n*n+t*t;if(i===0)return new $(e===-1?0:e/0,t===0?0:t/0);let a=(r*n-t*t)/i,o=(t*n+r*t)/i;return new $(lA(a,o)/2,Math.atan2(o,a)/2)},acoth:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new $(0,Math.PI/2);let n=e*e+t*t;return n===0?new $(e===0?0:e/0,t===0?0:-t/0).atanh():new $(e/n,-t/n).atanh()},acsch:function(){let e=this.re,t=this.im;if(t===0){if(e===0)return new $(1/0,0);let t=1/e;return new $(Math.log(t+Math.sqrt(t*t+1)),0)}let n=e*e+t*t;return n===0?new $(e===0?0:e/0,t===0?0:-t/0).asinh():new $(e/n,-t/n).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return $.INFINITY;let n=e*e+t*t;return n===0?new $(e===0?0:e/0,t===0?0:-t/0).acosh():new $(e/n,-t/n).acosh()},inverse:function(){if(this.isZero())return $.INFINITY;if(this.isInfinite())return $.ZERO;let e=this.re,t=this.im,n=e*e+t*t;return new $(e/n,-t/n)},conjugate:function(){return new $(this.re,-this.im)},neg:function(){return new $(-this.re,-this.im)},ceil:function(e){return e=10**(e||0),new $(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=10**(e||0),new $(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=10**(e||0),new $(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let n=dA(e,t);return Math.abs(n.re-this.re)<=$.EPSILON&&Math.abs(n.im-this.im)<=$.EPSILON},clone:function(){return new $(this.re,this.im)},toString:function(){let e=this.re,t=this.im,n=``;return this.isNaN()?`NaN`:this.isInfinite()?`Infinity`:(Math.abs(e)<$.EPSILON&&(e=0),Math.abs(t)<$.EPSILON&&(t=0),t===0?n+e:(e===0?t<0&&(t=-t,n+=`-`):(n+=e,n+=` `,t<0?(t=-t,n+=`-`):n+=`+`,n+=` `),t!==1&&(n+=t),n+`i`))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},$.ZERO=new $(0,0),$.ONE=new $(1,0),$.I=new $(0,1),$.PI=new $(Math.PI,0),$.E=new $(Math.E,0),$.INFINITY=new $(1/0,1/0),$.NAN=new $(NaN,NaN),$.EPSILON=1e-15;var fA=Z(`Complex`,[],()=>(Object.defineProperty($,`name`,{value:`Complex`}),$.prototype.constructor=$,$.prototype.type=`Complex`,$.prototype.isComplex=!0,$.prototype.toJSON=function(){return{mathjs:`Complex`,re:this.re,im:this.im}},$.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},$.prototype.format=function(e){var t=``,n=this.im,r=this.re,i=UD(this.re,e),a=UD(this.im,e),o=CE(e)?e:e?e.precision:null;if(o!==null){var s=10**-o;Math.abs(r/n)<s&&(r=0),Math.abs(n/r)<s&&(n=0)}return t=n===0?i:r===0?n===1?`i`:n===-1?`-i`:a+`i`:n<0?n===-1?i+` - i`:i+` - `+a.substring(1)+`i`:n===1?i+` + i`:i+` + `+a+`i`,t},$.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if(typeof t==`object`)return $(t);throw TypeError(`Input has to be an object with r and phi keys.`);case 2:var n=arguments[0],r=arguments[1];if(CE(n)){if(OE(r)&&r.hasBase(`ANGLE`)&&(r=r.toNumber(`rad`)),CE(r))return new $({r:n,phi:r});throw TypeError(`Phi is not a number nor an angle unit.`)}else throw TypeError(`Radius r is not a number.`);default:throw SyntaxError(`Wrong number of arguments in function fromPolar`)}},$.prototype.valueOf=$.prototype.toString,$.fromJSON=function(e){return new $(e)},$.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},$),{isClass:!0});typeof BigInt>`u`&&(BigInt=function(e){if(isNaN(e))throw Error(``);return e});var pA=BigInt(0),mA=BigInt(1),hA=BigInt(2),gA=BigInt(3),_A=BigInt(5),vA=BigInt(10);BigInt(2**53-1);var yA=2e3,bA={s:mA,n:pA,d:mA};function xA(e,t){try{e=BigInt(e)}catch{throw NA()}return e*t}function SA(e){return typeof e==`bigint`?e:Math.floor(e)}function CA(e,t){if(t===pA)throw MA();let n=Object.create(jA.prototype);n.s=e<pA?-mA:mA,e=e<pA?-e:e;let r=AA(e,t);return n.n=e/r,n.d=t/r,n}var wA=[hA*hA,hA,hA*hA,hA,hA*hA,hA*gA,hA,hA*gA];function TA(e){let t=Object.create(null);if(e<=mA)return t[e]=mA,t;let n=e=>{t[e]=(t[e]||pA)+mA};for(;e%hA===pA;)n(hA),e/=hA;for(;e%gA===pA;)n(gA),e/=gA;for(;e%_A===pA;)n(_A),e/=_A;for(let t=0,r=hA+_A;r*r<=e;){for(;e%r===pA;)n(r),e/=r;r+=wA[t],t=t+1&7}return e>mA&&n(e),t}var EA=function(e,t){let n=pA,r=mA,i=mA;if(e!=null)if(t!==void 0){if(typeof e==`bigint`)n=e;else if(isNaN(e))throw NA();else if(e%1!=0)throw PA();else n=BigInt(e);if(typeof t==`bigint`)r=t;else if(isNaN(t))throw NA();else if(t%1!=0)throw PA();else r=BigInt(t);i=n*r}else if(typeof e==`object`){if(`d`in e&&`n`in e)n=BigInt(e.n),r=BigInt(e.d),`s`in e&&(n*=BigInt(e.s));else if(0 in e)n=BigInt(e[0]),1 in e&&(r=BigInt(e[1]));else if(typeof e==`bigint`)n=e;else throw NA();i=n*r}else if(typeof e==`number`){if(isNaN(e))throw NA();if(e<0&&(i=-mA,e=-e),e%1==0)n=BigInt(e);else{let t=1,i=0,a=1,o=1,s=1,c=1e7;for(e>=1&&(t=10**Math.floor(1+Math.log10(e)),e/=t);a<=c&&s<=c;){let t=(i+o)/(a+s);if(e===t){a+s<=c?(n=i+o,r=a+s):s>a?(n=o,r=s):(n=i,r=a);break}else e>t?(i+=o,a+=s):(o+=i,s+=a),a>c?(n=o,r=s):(n=i,r=a)}n=BigInt(n)*BigInt(t),r=BigInt(r)}}else if(typeof e==`string`){let t=0,a=pA,o=pA,s=pA,c=mA,l=mA,u=e.replace(/_/g,``).match(/\d+|./g);if(u===null)throw NA();if(u[t]===`-`?(i=-mA,t++):u[t]===`+`&&t++,u.length===t+1?o=xA(u[t++],i):u[t+1]===`.`||u[t]===`.`?(u[t]!==`.`&&(a=xA(u[t++],i)),t++,(t+1===u.length||u[t+1]===`(`&&u[t+3]===`)`||u[t+1]===`'`&&u[t+3]===`'`)&&(o=xA(u[t],i),c=vA**BigInt(u[t].length),t++),(u[t]===`(`&&u[t+2]===`)`||u[t]===`'`&&u[t+2]===`'`)&&(s=xA(u[t+1],i),l=vA**BigInt(u[t+1].length)-mA,t+=3)):u[t+1]===`/`||u[t+1]===`:`?(o=xA(u[t],i),c=xA(u[t+2],mA),t+=3):u[t+3]===`/`&&u[t+1]===` `&&(a=xA(u[t],i),o=xA(u[t+2],i),c=xA(u[t+4],mA),t+=5),u.length<=t)r=c*l,i=n=s+r*a+l*o;else throw NA()}else if(typeof e==`bigint`)n=e,i=e,r=mA;else throw NA();if(r===pA)throw MA();bA.s=i<pA?-mA:mA,bA.n=n<pA?-n:n,bA.d=r<pA?-r:r};function DA(e,t,n){let r=mA;for(;t>pA;e=e*e%n,t>>=mA)t&mA&&(r=r*e%n);return r}function OA(e,t){for(;t%hA===pA;t/=hA);for(;t%_A===pA;t/=_A);if(t===mA)return pA;let n=vA%t,r=1;for(;n!==mA;r++)if(n=n*vA%t,r>yA)return pA;return BigInt(r)}function kA(e,t,n){let r=mA,i=DA(vA,n,t);for(let e=0;e<300;e++){if(r===i)return BigInt(e);r=r*vA%t,i=i*vA%t}return 0}function AA(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}}function jA(e,t){if(EA(e,t),this instanceof jA)e=AA(bA.d,bA.n),this.s=bA.s,this.n=bA.n/e,this.d=bA.d/e;else return CA(bA.s*bA.n,bA.d)}var MA=function(){return Error(`Division by Zero`)},NA=function(){return Error(`Invalid argument`)},PA=function(){return Error(`Parameters must be integer`)};jA.prototype={s:mA,n:pA,d:mA,abs:function(){return CA(this.n,this.d)},neg:function(){return CA(-this.s*this.n,this.d)},add:function(e,t){return EA(e,t),CA(this.s*this.n*bA.d+bA.s*this.d*bA.n,this.d*bA.d)},sub:function(e,t){return EA(e,t),CA(this.s*this.n*bA.d-bA.s*this.d*bA.n,this.d*bA.d)},mul:function(e,t){return EA(e,t),CA(this.s*bA.s*this.n*bA.n,this.d*bA.d)},div:function(e,t){return EA(e,t),CA(this.s*bA.s*this.n*bA.d,this.d*bA.n)},clone:function(){return CA(this.s*this.n,this.d)},mod:function(e,t){if(e===void 0)return CA(this.s*this.n%this.d,mA);if(EA(e,t),pA===bA.n*this.d)throw MA();return CA(this.s*(bA.d*this.n)%(bA.n*this.d),bA.d*this.d)},gcd:function(e,t){return EA(e,t),CA(AA(bA.n,this.n)*AA(bA.d,this.d),bA.d*this.d)},lcm:function(e,t){return EA(e,t),bA.n===pA&&this.n===pA?CA(pA,mA):CA(bA.n*this.n,AA(bA.n,this.n)*AA(bA.d,this.d))},inverse:function(){return CA(this.s*this.d,this.n)},pow:function(e,t){if(EA(e,t),bA.d===mA)return bA.s<pA?CA((this.s*this.d)**bA.n,this.n**bA.n):CA((this.s*this.n)**bA.n,this.d**bA.n);if(this.s<pA)return null;let n=TA(this.n),r=TA(this.d),i=mA,a=mA;for(let e in n)if(e!==`1`){if(e===`0`){i=pA;break}if(n[e]*=bA.n,n[e]%bA.d===pA)n[e]/=bA.d;else return null;i*=BigInt(e)**n[e]}for(let e in r)if(e!==`1`){if(r[e]*=bA.n,r[e]%bA.d===pA)r[e]/=bA.d;else return null;a*=BigInt(e)**r[e]}return bA.s<pA?CA(a,i):CA(i,a)},log:function(e,t){if(EA(e,t),this.s<=pA||bA.s<=pA)return null;let n=Object.create(null),r=TA(bA.n),i=TA(bA.d),a=TA(this.n),o=TA(this.d);for(let e in i)r[e]=(r[e]||pA)-i[e];for(let e in o)a[e]=(a[e]||pA)-o[e];for(let e in r)e!==`1`&&(n[e]=!0);for(let e in a)e!==`1`&&(n[e]=!0);let s=null,c=null;for(let e in n){let t=r[e]||pA,n=a[e]||pA;if(t===pA){if(n!==pA)return null;continue}let i=n,o=t,l=AA(i,o);if(i/=l,o/=l,s===null&&c===null)s=i,c=o;else if(i*c!==s*o)return null}return s!==null&&c!==null?CA(s,c):null},equals:function(e,t){return EA(e,t),this.s*this.n*bA.d===bA.s*bA.n*this.d},lt:function(e,t){return EA(e,t),this.s*this.n*bA.d<bA.s*bA.n*this.d},lte:function(e,t){return EA(e,t),this.s*this.n*bA.d<=bA.s*bA.n*this.d},gt:function(e,t){return EA(e,t),this.s*this.n*bA.d>bA.s*bA.n*this.d},gte:function(e,t){return EA(e,t),this.s*this.n*bA.d>=bA.s*bA.n*this.d},compare:function(e,t){EA(e,t);let n=this.s*this.n*bA.d-bA.s*bA.n*this.d;return(pA<n)-(n<pA)},ceil:function(e){return e=vA**BigInt(e||0),CA(SA(this.s*e*this.n/this.d)+(e*this.n%this.d>pA&&this.s>=pA?mA:pA),e)},floor:function(e){return e=vA**BigInt(e||0),CA(SA(this.s*e*this.n/this.d)-(e*this.n%this.d>pA&&this.s<pA?mA:pA),e)},round:function(e){return e=vA**BigInt(e||0),CA(SA(this.s*e*this.n/this.d)+this.s*((this.s>=pA?mA:pA)+hA*(e*this.n%this.d)>this.d?mA:pA),e)},roundTo:function(e,t){EA(e,t);let n=this.n*bA.d,r=this.d*bA.n,i=n%r,a=SA(n/r);return i+i>=r&&a++,CA(this.s*a*bA.n,bA.d)},divisible:function(e,t){return EA(e,t),bA.n===pA?!1:this.n*bA.d%(bA.n*this.d)===pA},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(e=15){let t=this.n,n=this.d,r=OA(t,n),i=kA(t,n,r),a=this.s<pA?`-`:``;if(a+=SA(t/n),t%=n,t*=vA,t&&(a+=`.`),r){for(let e=i;e--;)a+=SA(t/n),t%=n,t*=vA;a+=`(`;for(let e=r;e--;)a+=SA(t/n),t%=n,t*=vA;a+=`)`}else for(let r=e;t&&r--;)a+=SA(t/n),t%=n,t*=vA;return a},toFraction:function(e=!1){let t=this.n,n=this.d,r=this.s<pA?`-`:``;if(n===mA)r+=t;else{let i=SA(t/n);e&&i>pA&&(r+=i,r+=` `,t%=n),r+=t,r+=`/`,r+=n}return r},toLatex:function(e=!1){let t=this.n,n=this.d,r=this.s<pA?`-`:``;if(n===mA)r+=t;else{let i=SA(t/n);e&&i>pA&&(r+=i,t%=n),r+=`\\frac{`,r+=t,r+=`}{`,r+=n,r+=`}`}return r},toContinued:function(){let e=this.n,t=this.d,n=[];for(;t;){n.push(SA(e/t));let r=e%t;e=t,t=r}return n},simplify:function(e=.001){let t=BigInt(Math.ceil(1/e)),n=this.abs(),r=n.toContinued();for(let e=1;e<r.length;e++){let i=CA(r[e-1],mA);for(let t=e-2;t>=0;t--)i=i.inverse().add(r[t]);let a=i.sub(n);if(a.n*t<a.d)return i.mul(this.s)}return this}};var FA=Z(`Fraction`,[],()=>(Object.defineProperty(jA,`name`,{value:`Fraction`}),jA.prototype.constructor=jA,jA.prototype.type=`Fraction`,jA.prototype.isFraction=!0,jA.prototype.toJSON=function(){return{mathjs:`Fraction`,n:String(this.s*this.n),d:String(this.d)}},jA.fromJSON=function(e){return new jA(e)},jA),{isClass:!0}),IA=Z(`Range`,[],()=>{function e(t,n,r){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`);var i=t!=null,a=n!=null,o=r!=null;if(i){if(wE(t))t=t.toNumber();else if(typeof t!=`number`&&!TE(t))throw TypeError(`Parameter start must be a number or bigint`)}if(a){if(wE(n))n=n.toNumber();else if(typeof n!=`number`&&!TE(n))throw TypeError(`Parameter end must be a number or bigint`)}if(o){if(wE(r))r=r.toNumber();else if(typeof r!=`number`&&!TE(r))throw TypeError(`Parameter step must be a number or bigint`)}if(this.start=i?parseFloat(t):0,this.end=a?parseFloat(n):0,this.step=o?parseFloat(r):1,o&&$D(this.step,0))throw Error(`Step must not be zero`)}return e.prototype.type=`Range`,e.prototype.isRange=!0,e.parse=function(t){if(typeof t!=`string`)return null;var n=t.split(`:`).map(function(e){return parseFloat(e)});if(n.some(function(e){return isNaN(e)}))return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var e=0,t=this.start,n=this.step,r=this.end-t;return ID(n)===ID(r)?e=Math.ceil(r/n):r===0&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},e.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},e.prototype.forEach=function(e){var t=this.start,n=this.step,r=this.end,i=0;if(n>0)for(;t<r;)e(t,[i],this),t+=n,i++;else if(n<0)for(;t>r;)e(t,[i],this),t+=n,i++},e.prototype.map=function(e){var t=[];return this.forEach(function(n,r,i){t[r[0]]=e(n,r,i)}),t},e.prototype.toArray=function(){var e=[];return this.forEach(function(t,n){e[n[0]]=t}),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var t=UD(this.start,e);return this.step!==1&&(t+=`:`+UD(this.step,e)),t+=`:`+UD(this.end,e),t},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:`Range`,start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e},{isClass:!0}),LA=Z(`Matrix`,[],()=>{function e(){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`)}return e.prototype.type=`Matrix`,e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error(`Cannot invoke storage on a Matrix interface`)},e.prototype.datatype=function(){throw Error(`Cannot invoke datatype on a Matrix interface`)},e.prototype.create=function(e,t){throw Error(`Cannot invoke create on a Matrix interface`)},e.prototype.subset=function(e,t,n){throw Error(`Cannot invoke subset on a Matrix interface`)},e.prototype.get=function(e){throw Error(`Cannot invoke get on a Matrix interface`)},e.prototype.set=function(e,t,n){throw Error(`Cannot invoke set on a Matrix interface`)},e.prototype.resize=function(e,t){throw Error(`Cannot invoke resize on a Matrix interface`)},e.prototype.reshape=function(e,t){throw Error(`Cannot invoke reshape on a Matrix interface`)},e.prototype.clone=function(){throw Error(`Cannot invoke clone on a Matrix interface`)},e.prototype.size=function(){throw Error(`Cannot invoke size on a Matrix interface`)},e.prototype.map=function(e,t){throw Error(`Cannot invoke map on a Matrix interface`)},e.prototype.forEach=function(e){throw Error(`Cannot invoke forEach on a Matrix interface`)},e.prototype[Symbol.iterator]=function(){throw Error(`Cannot iterate a Matrix interface`)},e.prototype.toArray=function(){throw Error(`Cannot invoke toArray on a Matrix interface`)},e.prototype.valueOf=function(){throw Error(`Cannot invoke valueOf on a Matrix interface`)},e.prototype.format=function(e){throw Error(`Cannot invoke format on a Matrix interface`)},e.prototype.toString=function(){throw Error(`Cannot invoke toString on a Matrix interface`)},e},{isClass:!0});function RA(e,t,n){var r=e.constructor,i=new r(2),a=``;if(n){if(n<1)throw Error(`size must be in greater than 0`);if(!PD(n))throw Error(`size must be an integer`);if(e.greaterThan(i.pow(n-1).sub(1))||e.lessThan(i.pow(n-1).mul(-1)))throw Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!e.isInteger())throw Error(`Value must be an integer`);e.lessThan(0)&&(e=e.add(i.pow(n))),a=`i${n}`}switch(t){case 2:return`${e.toBinary()}${a}`;case 8:return`${e.toOctal()}${a}`;case 16:return`${e.toHexadecimal()}${a}`;default:throw Error(`Base ${t} not supported `)}}function zA(e,t){if(typeof t==`function`)return t(e);if(!e.isFinite())return e.isNaN()?`NaN`:e.gt(0)?`Infinity`:`-Infinity`;var{notation:n,precision:r,wordSize:i}=WD(t);switch(n){case`fixed`:return HA(e,r);case`exponential`:return VA(e,r);case`engineering`:return BA(e,r);case`bin`:return RA(e,2,i);case`oct`:return RA(e,8,i);case`hex`:return RA(e,16,i);case`auto`:var a=UA(t?.lowerExp,-3),o=UA(t?.upperExp,5);if(e.isZero())return`0`;var s,c=e.toSignificantDigits(r),l=c.e;return s=l>=a&&l<o?c.toFixed():VA(e,r),s.replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return e===`.`?t:e+t});default:throw Error(`Unknown notation "`+n+`". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.`)}}function BA(e,t){var n=e.e,r=n%3==0?n:n<0?n-3-n%3:n-n%3,i=e.mul(10**-r).toPrecision(t);if(i.includes(`e`)){var a=e.constructor;i=new a(i).toFixed()}return i+`e`+(n>=0?`+`:``)+r.toString()}function VA(e,t){return t===void 0?e.toExponential():e.toExponential(t-1)}function HA(e,t){return e.toFixed(t)}function UA(e,t){return CE(e)?e:wE(e)?e.toNumber():t}function WA(e,t){var n=e.length-t.length,r=e.length;return e.substring(n,r)===t}function GA(e,t){var n=KA(e,t);return t&&typeof t==`object`&&`truncate`in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+`...`:n}function KA(e,t){return typeof e==`number`?UD(e,t):wE(e)?zA(e,t):ZA(e)?!t||t.fraction!==`decimal`?`${e.s*e.n}/${e.d}`:e.toString():Array.isArray(e)?XA(e,t):kE(e)?qA(e):typeof e==`function`?e.syntax?String(e.syntax):`function`:e&&typeof e==`object`?typeof e.format==`function`?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):`{`+Object.keys(e).map(n=>qA(n)+`: `+GA(e[n],t)).join(`, `)+`}`:String(e)}function qA(e){for(var t=String(e),n=``,r=0;r<t.length;){var i=t.charAt(r);n+=i in JA?JA[i]:i,r++}return`"`+n+`"`}var JA={'"':`\\"`,"\\":`\\\\`,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`};function YA(e){var t=String(e);return t=t.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),t}function XA(e,t){if(Array.isArray(e)){for(var n=`[`,r=e.length,i=0;i<r;i++)i!==0&&(n+=`, `),n+=XA(e[i],t);return n+=`]`,n}else return GA(e,t)}function ZA(e){return e&&typeof e==`object`&&typeof e.s==`bigint`&&typeof e.n==`bigint`&&typeof e.d==`bigint`||!1}function QA(e,t){if(!kE(e))throw TypeError(`Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: `+pD(e)+`, index: 0)`);if(!kE(t))throw TypeError(`Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: `+pD(t)+`, index: 1)`);return e===t?0:e>t?1:-1}function $A(e,t,n){if(!(this instanceof $A))throw SyntaxError(`Constructor must be called with the new operator`);this.actual=e,this.expected=t,this.relation=n,this.message=`Dimension mismatch (`+(Array.isArray(e)?`[`+e.join(`, `)+`]`:e)+` `+(this.relation||`!=`)+` `+(Array.isArray(t)?`[`+t.join(`, `)+`]`:t)+`)`,this.stack=Error().stack}$A.prototype=RangeError(),$A.prototype.constructor=RangeError,$A.prototype.name=`DimensionError`,$A.prototype.isDimensionError=!0;function ej(e,t,n){if(!(this instanceof ej))throw SyntaxError(`Constructor must be called with the new operator`);this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),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=Error().stack}ej.prototype=RangeError(),ej.prototype.constructor=RangeError,ej.prototype.name=`IndexError`,ej.prototype.isIndexError=!0;function tj(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function nj(e,t,n){var r,i=e.length;if(i!==t[n])throw new $A(i,t[n]);if(n<t.length-1){var a=n+1;for(r=0;r<i;r++){var o=e[r];if(!Array.isArray(o))throw new $A(t.length-1,t.length,`<`);nj(e[r],t,a)}}else for(r=0;r<i;r++)if(Array.isArray(e[r]))throw new $A(t.length+1,t.length,`>`)}function rj(e,t){if(t.length===0){if(Array.isArray(e))throw new $A(e.length,0)}else nj(e,t,0)}function ij(e,t){var n=e.isMatrix?e._size:tj(e);t._sourceSize.forEach((e,t)=>{if(e!==null&&e!==n[t])throw new $A(e,n[t])})}function aj(e,t){if(e!==void 0){if(!CE(e)||!PD(e))throw TypeError(`Index must be an integer (value: `+e+`)`);if(e<0||typeof t==`number`&&e>=t)throw new ej(e,t)}}function oj(e){for(var t=0;t<e._dimensions.length;++t){var n=e._dimensions[t];if(n._data&&AE(n._data)){if(n._size[0]===0)return!0}else if(n.isRange){if(n.start===n.end)return!0}else if(kE(n)&&n.length===0)return!0}return!1}function sj(e,t,n){if(!Array.isArray(t))throw TypeError(`Array expected`);if(t.length===0)throw Error(`Resizing to scalar is not supported`);return t.forEach(function(e){if(!CE(e)||!PD(e)||e<0)throw TypeError(`Invalid size, must contain positive integers (size: `+GA(t)+`)`)}),(CE(e)||wE(e))&&(e=[e]),cj(e,t,0,n===void 0?0:n),e}function cj(e,t,n,r){var i,a,o=e.length,s=t[n],c=Math.min(o,s);if(e.length=s,n<t.length-1){var l=n+1;for(i=0;i<c;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),cj(a,t,l,r);for(i=c;i<s;i++)a=[],e[i]=a,cj(a,t,l,r)}else{for(i=0;i<c;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=c;i<s;i++)e[i]=r}}function lj(e,t){var n=_j(e,!0),r=n.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError(`Array expected`);if(t.length===0)throw new $A(0,r,`!=`);t=uj(t,r);var i=dj(t);if(r!==i)throw new $A(i,r,`!=`);try{return fj(n,t)}catch(e){throw e instanceof $A?new $A(i,r,`!=`):e}}function uj(e,t){var n=dj(e),r=e.slice(),i=-1,a=e.indexOf(i);if(e.indexOf(i,a+1)>=0)throw Error(`More than one wildcard in sizes`);var o=a>=0,s=t%n===0;if(o)if(s)r[a]=-t/n;else throw Error(`Could not replace wildcard, since `+t+` is no multiple of `+-n);return r}function dj(e){return e.reduce((e,t)=>e*t,1)}function fj(e,t){for(var n=e,r,i=t.length-1;i>0;i--){var a=t[i];r=[];for(var o=n.length/a,s=0;s<o;s++)r.push(n.slice(s*a,(s+1)*a));n=r}return n}function pj(e,t){for(var n=t||tj(e);Array.isArray(e)&&e.length===1;)e=e[0],n.shift();for(var r=n.length;n[r-1]===1;)r--;return r<n.length&&(e=mj(e,r,0),n.length=r),e}function mj(e,t,n){var r,i;if(n<t){var a=n+1;for(r=0,i=e.length;r<i;r++)e[r]=mj(e[r],t,a)}else for(;Array.isArray(e);)e=e[0];return e}function hj(e,t,n,r){var i=r||tj(e);if(n)for(var a=0;a<n;a++)e=[e],i.unshift(1);for(e=gj(e,t,0);i.length<t;)i.push(1);return e}function gj(e,t,n){var r,i;if(Array.isArray(e)){var a=n+1;for(r=0,i=e.length;r<i;r++)e[r]=gj(e[r],t,a)}else for(var o=n;o<t;o++)e=[e];return e}function _j(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!Array.isArray(e))return e;if(typeof t!=`boolean`)throw TypeError(`Boolean expected for second argument of flatten`);var n=[];return t?i(e):r(e),n;function r(e){for(var t=0;t<e.length;t++){var i=e[t];Array.isArray(i)?r(i):n.push(i)}}function i(e){if(Array.isArray(e[0]))for(var t=0;t<e.length;t++)i(e[t]);else for(var r=0;r<e.length;r++)n.push(e[r])}}function vj(e,t){return Array.prototype.map.call(e,t)}function yj(e,t){Array.prototype.forEach.call(e,t)}function bj(e,t){if(tj(e).length!==1)throw Error(`Only one dimensional matrices supported`);return Array.prototype.filter.call(e,t)}function xj(e,t){if(tj(e).length!==1)throw Error(`Only one dimensional matrices supported`);return Array.prototype.filter.call(e,e=>t.test(e))}function Sj(e,t){return Array.prototype.join.call(e,t)}function Cj(e){if(!Array.isArray(e))throw TypeError(`Array input expected`);if(e.length===0)return e;var t=[],n=0;t[0]={value:e[0],identifier:0};for(var r=1;r<e.length;r++)e[r]===e[r-1]?n++:n=0,t.push({value:e[r],identifier:n});return t}function wj(e){if(!Array.isArray(e))throw TypeError(`Array input expected`);if(e.length===0)return e;for(var t=[],n=0;n<e.length;n++)t.push(e[n].value);return t}function Tj(e,t){for(var n,r=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(i===0&&o&&(r=a.length),o&&a.length!==r)return;var s=o?Tj(a,t):t(a);if(n===void 0)n=s;else if(n!==s)return`mixed`}return n}function Ej(e,t,n,r){if(r<n){if(e.length!==t.length)throw new $A(e.length,t.length);for(var i=[],a=0;a<e.length;a++)i[a]=Ej(e[a],t[a],n,r+1);return i}else return e.concat(t)}function Dj(){var e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(e.length===1)return e[0];if(e.length>1)return e.slice(1).reduce(function(e,n){return Ej(e,n,t,0)},e[0]);throw Error(`Wrong number of arguments in function concat`)}function Oj(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=t.map(e=>e.length),i=Math.max(...r),a=Array(i).fill(null),o=0;o<t.length;o++)for(var s=t[o],c=r[o],l=0;l<c;l++){var u=i-c+l;s[l]>a[u]&&(a[u]=s[l])}for(var d=0;d<t.length;d++)kj(t[d],a);return a}function kj(e,t){for(var n=t.length,r=e.length,i=0;i<r;i++){var a=n-r+i;if(e[i]<t[a]&&e[i]>1||e[i]>t[a])throw Error(`shape mismatch: mismatch is found in arg with shape (${e}) not possible to broadcast dimension ${r} with size ${e[i]} to size ${t[a]}`)}}function Aj(e,t){var n=tj(e);if(vD(n,t))return e;kj(n,t);var r=Oj(n,t),i=r.length,a=[...Array(i-n.length).fill(1),...n],o=Fj(e);n.length<i&&(o=lj(o,a),n=tj(o));for(var s=0;s<i;s++)n[s]<r[s]&&(o=jj(o,r[s],s),n=tj(o));return o}function jj(e,t,n){return Dj(...Array(t).fill(e),n)}function Mj(e,t){if(!Array.isArray(e))throw Error(`Array expected`);if(!Array.isArray(t))throw Error(`Array expected for index`);var n=tj(e);if(t.length!==n.length)throw new $A(t.length,n.length);for(var r=0;r<t.length;r++)aj(t[r],n[r]);return t.reduce((e,t)=>e[t],e)}function Nj(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e.length===0)return[];if(n)return a(e);var r=[];return i(e,0);function i(n,a){if(Array.isArray(n)){for(var o=n.length,s=Array(o),c=0;c<o;c++)r[a]=c,s[c]=i(n[c],a+1);return s}else return t(n,r.slice(0,a),e)}function a(e){if(Array.isArray(e)){for(var n=e.length,r=Array(n),i=0;i<n;i++)r[i]=a(e[i]);return r}else return t(e)}}function Pj(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e.length===0)return;if(n){a(e);return}var r=[];i(e,0);function i(n,a){if(Array.isArray(n))for(var o=n.length,s=0;s<o;s++)r[a]=s,i(n[s],a+1);else t(n,r.slice(0,a),e)}function a(e){if(Array.isArray(e))for(var n=e.length,r=0;r<n;r++)a(e[r]);else t(e)}}function Fj(e){return oE([],e)}function Ij(e,t,n,r){if(lO.default.isTypedFunction(e)){var i;if(r)i=1;else{var a=t.isMatrix?t.size():tj(t);if(!a.length||a[a.length-1]===0)return{isUnary:r,fn:e};var o=a.map(()=>0);i=zj(e,t.isMatrix?t.get(o):Mj(t,o),o,t)}var s;if(t.isMatrix&&t.dataType!==`mixed`&&t.dataType!==void 0){var c=Lj(e,i);s=c===void 0?e:c}else s=e;return i>=1&&i<=3?{isUnary:i===1,fn:function(){for(var t=arguments.length,r=Array(t),a=0;a<t;a++)r[a]=arguments[a];return Bj(s,r.slice(0,i),n,e.name)}}:{isUnary:!1,fn:function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return Bj(s,r,n,e.name)}}}return r===void 0?{isUnary:Rj(e),fn:e}:{isUnary:r,fn:e}}function Lj(e,t){var n=[];if(Object.entries(e.signatures).forEach(e=>{var[r,i]=e;r.split(`,`).length===t&&n.push(i)}),n.length===1)return n[0]}function Rj(e){if(e.length!==1)return!1;var t=e.toString();if(/arguments/.test(t))return!1;var n=t.match(/\(.*?\)/);return!/\.\.\./.test(n)}function zj(e,t,n,r){for(var i=[t,n,r],a=3;a>0;a--){var o=i.slice(0,a);if(lO.default.resolve(e,o)!==null)return a}}function Bj(e,t,n,r){try{return e(...t)}catch(e){Vj(e,t,n,r)}}function Vj(e,t,n,r){if(e instanceof TypeError&&e.data?.category===`wrongType`){var i=[];throw i.push(`value: ${pD(t[0])}`),t.length>=2&&i.push(`index: ${pD(t[1])}`),t.length>=3&&i.push(`array: ${pD(t[2])}`),TypeError(`Function ${n} cannot apply callback arguments ${r}(${i.join(`, `)}) at index ${JSON.stringify(t[1])}`)}else throw TypeError(`Function ${n} cannot apply callback arguments to function ${r}: ${e.message}`)}var Hj=Z(`DenseMatrix`,[`Matrix`,`config`],e=>{var{Matrix:t,config:n}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!kE(t))throw Error(`Invalid datatype: `+t);if(jE(e))e.type===`DenseMatrix`?(this._data=mD(e._data),this._size=mD(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&AE(e.data)&&AE(e.size))this._data=e.data,this._size=e.size,rj(this._data,this._size),this._datatype=t||e.datatype;else if(AE(e))this._data=u(e),this._size=tj(this._data),rj(this._data,this._size),this._datatype=t;else if(e)throw TypeError(`Unsupported type of data (`+pD(e)+`)`);else this._data=[],this._size=[0],this._datatype=t}r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,`name`,{value:`DenseMatrix`}),r.prototype.constructor=r,r.prototype.type=`DenseMatrix`,r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Tj(this._data,pD)},r.prototype.storage=function(){return`dense`},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return i(this,e);case 2:case 3:return o(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}},r.prototype.get=function(e){return Mj(this._data,e)},r.prototype.set=function(e,t,n){if(!AE(e))throw TypeError(`Array expected`);if(e.length<this._size.length)throw new $A(e.length,this._size.length,`<`);var r,i,a,o=e.map(function(e){return e+1});l(this,o,n);var s=this._data;for(r=0,i=e.length-1;r<i;r++)a=e[r],aj(a,s.length),s=s[a];return a=e[e.length-1],aj(a,s.length),s[a]=t,this};function i(e,t){if(!IE(t))throw TypeError(`Invalid index`);if(n.legacySubset?t.size().every(e=>e===1):t.isScalar())return e.get(t.min());var i=t.size();if(i.length!==e._size.length)throw new $A(i.length,e._size.length);for(var o=t.min(),s=t.max(),c=0,l=e._size.length;c<l;c++)aj(o[c],e._size[c]),aj(s[c],e._size[c]);var u=new r,d=a(e._data,t);return u._size=d.size,u._datatype=e._datatype,u._data=d.data,n.legacySubset?u.reshape(t.size()):u}function a(e,t){var n=t.size().length-1,r=Array(n);return{data:i(e),size:r.filter(e=>e!==null)};function i(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=t.dimension(a);function s(e,t){return CE(e)?t(e):e.map(t).valueOf()}return CE(o)?r[a]=null:r[a]=o.size()[0],a<n?s(o,t=>(aj(t,e.length),i(e[t],a+1))):s(o,t=>(aj(t,e.length),e[t]))}}function o(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),o;if(jE(n)?(o=n.size(),n=n.valueOf()):o=tj(n),a){if(o.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(!vD(o,i)){if(o.length===0)n=Aj([n],i);else try{n=Aj(n,i)}catch{}o=tj(n)}if(i.length<e._size.length)throw new $A(i.length,e._size.length,`<`);if(o.length<i.length){for(var c=0,u=0;i[c]===1&&o[c]===1;)c++;for(;i[c]===1;)u++,c++;n=hj(n,i.length,u,o)}if(!vD(i,o))throw new $A(i,o,`>`);l(e,t.max().map(function(e){return e+1}),r),s(e._data,t,n)}return e}function s(e,t,n){var r=t.size().length-1;i(e,n);function i(e,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=t.dimension(a),s=(t,r)=>{aj(t,e.length),i(e[t],n[r[0]],a+1)},c=(t,r)=>{aj(t,e.length),e[t]=n[r[0]]};a<r?CE(o)?s(o,[0]):o.forEach(s):CE(o)?c(o,[0]):o.forEach(c)}}r.prototype.resize=function(e,t,n){if(!ME(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e);return c(n?this.clone():this,r,t)};function c(e,t,n){if(t.length===0){for(var r=e._data;AE(r);)r=r[0];return r}return e._size=t.slice(0),e._data=sj(e._data,e._size,n),e}r.prototype.reshape=function(e,t){var n=t?this.clone():this;return n._data=lj(n._data,e),n._size=uj(e,n._size.reduce((e,t)=>e*t)),n};function l(e,t,n){for(var r=e._size.slice(0),i=!1;r.length<t.length;)r.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>r[a]&&(r[a]=t[a],i=!0);i&&c(e,r,n)}r.prototype.clone=function(){return new r({data:mD(this._data),size:mD(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){arguments.length>1&&arguments[1]!==void 0&&arguments[1];var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=this,r=n._size.length-1;if(r<0)return n.clone();var i=Ij(e,n,`map`,t),a=i.fn,o=n.create(void 0,n._datatype);if(o._size=n._size,t||i.isUnary)return o._data=f(n._data),o;if(r===0){for(var s=n.valueOf(),c=Array(s.length),l=0;l<s.length;l++)c[l]=a(s[l],[l],n);return o._data=c,o}var u=[];return o._data=d(n._data),o;function d(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=Array(e.length);if(t<r)for(var o=0;o<e.length;o++)u[t]=o,i[o]=d(e[o],t+1);else for(var s=0;s<e.length;s++)u[t]=s,i[s]=a(e[s],u.slice(),n);return i}function f(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=Array(e.length);if(t<r)for(var i=0;i<e.length;i++)n[i]=f(e[i],t+1);else for(var o=0;o<e.length;o++)n[o]=a(e[o]);return n}},r.prototype.forEach=function(e){arguments.length>1&&arguments[1]!==void 0&&arguments[1];var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=this,r=n._size.length-1;if(r<0)return;var i=Ij(e,n,`map`,t),a=i.fn;if(t||i.isUnary){l(n._data);return}if(r===0){for(var o=0;o<n._data.length;o++)a(n._data[o],[o],n);return}var s=[];c(n._data);function c(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t<r)for(var i=0;i<e.length;i++)s[t]=i,c(e[i],t+1);else for(var o=0;o<e.length;o++)s[t]=o,a(e[o],s.slice(),n)}function l(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t<r)for(var n=0;n<e.length;n++)l(e[n],t+1);else for(var i=0;i<e.length;i++)a(e[i])}},r.prototype[Symbol.iterator]=function*(){var e=this._size.length-1;if(!(e<0)){if(e===0){for(var t=0;t<this._data.length;t++)yield{value:this._data[t],index:[t]};return}for(var n=Array(e+1).fill(0),r=this._size.reduce((e,t)=>e*t,1),i=0;i<r;i++){for(var a=this._data,o=0;o<e;o++)a=a[n[o]];yield{value:a[n[e]],index:n.slice()};for(var s=e;s>=0&&(n[s]++,!(n[s]<this._size[s]));s--)n[s]=0}}},r.prototype.rows=function(){var e=[];if(this.size().length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(n.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var i=this._data,a=function(n){var a=i.map(e=>[e[n]]);t.push(new r(a,e._datatype))},o=0;o<n[1];o++)a(o);return t},r.prototype.toArray=function(){return mD(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return GA(this._data,e)},r.prototype.toString=function(){return GA(this._data)},r.prototype.toJSON=function(){return{mathjs:`DenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(wE(e)&&(e=e.toNumber()),!CE(e)||!PD(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=this._size[0],a=this._size[1],o=Math.min(i-n,a-t),s=[],c=0;c<o;c++)s[c]=this._data[c+n][c+t];return new r({data:s,size:[o],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!AE(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(wE(e)&&(e=e.toNumber()),!CE(e)||!PD(e)||e<1)throw Error(`Size values must be positive integers`);return e}),n){if(wE(n)&&(n=n.toNumber()),!CE(n)||!PD(n))throw TypeError(`The parameter k must be an integer number`)}else n=0;var a=n>0?n:0,o=n<0?-n:0,s=e[0],c=e[1],l=Math.min(s-o,c-a),u;if(AE(t)){if(t.length!==l)throw Error(`Invalid value array length`);u=function(e){return t[e]}}else if(jE(t)){var d=t.size();if(d.length!==1||d[0]!==l)throw Error(`Invalid matrix length`);u=function(e){return t.get([e])}}else u=function(){return t};i||=wE(u(0))?u(0).mul(0):0;var f=[];if(e.length>0){f=sj(f,e,i);for(var p=0;p<l;p++)f[p+o][p+a]=u(p)}return new r({data:f,size:[s,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!CE(e)||!PD(e)||!CE(t)||!PD(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return aj(e,this._size[0]),aj(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r};function u(e){return jE(e)?u(e.valueOf()):AE(e)?e.map(u):e}return r},{isClass:!0}),Uj=`clone`,Wj=Z(Uj,[`typed`],e=>{var{typed:t}=e;return t(Uj,{any:mD})});function Gj(e){var t=e.length,n=e[0].length,r,i,a=[];for(i=0;i<n;i++){var o=[];for(r=0;r<t;r++)o.push(e[r][i]);a.push(o)}return a}function Kj(e){for(var t=0;t<e.length;t++)if(ME(e[t]))return!0;return!1}function qj(e,t){jE(e)?e.forEach(e=>t(e),!1,!0):Pj(e,t,!0)}function Jj(e,t,n){if(!n)return jE(e)?e.map(e=>t(e),!1,!0):Nj(e,t,!0);var r=e=>e===0?e:t(e);return jE(e)?e.map(e=>r(e),!1,!0):Nj(e,r,!0)}function Yj(e,t,n){var r=Array.isArray(e)?tj(e):e.size();if(t<0||t>=r.length)throw new ej(t,r.length);return jE(e)?e.create(Xj(e.valueOf(),t,n),e.datatype()):Xj(e,t,n)}function Xj(e,t,n){var r,i,a,o;if(t<=0)if(Array.isArray(e[0])){for(o=Gj(e),i=[],r=0;r<o.length;r++)i[r]=Xj(o[r],t-1,n);return i}else{for(a=e[0],r=1;r<e.length;r++)a=n(a,e[r]);return a}else{for(i=[],r=0;r<e.length;r++)i[r]=Xj(e[r],t-1,n);return i}}function Zj(e,t,n,r,i,a,o,s,c,l,u){var d=e._values,f=e._index,p=e._ptr,m,h,g,_;if(r)for(h=p[t],g=p[t+1],m=h;m<g;m++)_=f[m],n[_]===a?(r[_]=c?s(d[m],r[_]):s(r[_],d[m]),i[_]=a):(n[_]=a,o.push(_),l?(r[_]=c?s(d[m],u):s(u,d[m]),i[_]=a):r[_]=d[m]);else for(h=p[t],g=p[t+1],m=h;m<g;m++)_=f[m],n[_]===a?i[_]=a:(n[_]=a,o.push(_))}var Qj=`isInteger`,$j=Z(Qj,[`typed`,`equal`],e=>{var{typed:t,equal:n}=e;return t(Qj,{number:e=>Number.isFinite(e)?n(e,Math.round(e)):!1,BigNumber:e=>e.isFinite()?n(e.round(),e):!1,bigint:e=>!0,Fraction:e=>e.d===1n,"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),eM=`number`,tM=`number, number`;function nM(e){return Math.abs(e)}nM.signature=eM;function rM(e,t){return e+t}rM.signature=tM;function iM(e,t){return e-t}iM.signature=tM;function aM(e,t){return e*t}aM.signature=tM;function oM(e,t){return e/t}oM.signature=tM;function sM(e){return-e}sM.signature=eM;function cM(e){return e}cM.signature=eM;function lM(e){return BD(e)}lM.signature=eM;function uM(e){return e*e*e}uM.signature=eM;function dM(e){return Math.exp(e)}dM.signature=eM;function fM(e){return VD(e)}fM.signature=eM;function pM(e,t){if(!PD(e)||!PD(t))throw Error(`Parameters in function gcd must be integer numbers`);for(var n;t!==0;)n=e%t,e=t,t=n;return e<0?-e:e}pM.signature=tM;function mM(e,t){if(!PD(e)||!PD(t))throw Error(`Parameters in function lcm must be integer numbers`);if(e===0||t===0)return 0;for(var n,r=e*t;t!==0;)n=t,t=e%n,e=n;return Math.abs(r/e)}mM.signature=tM;function hM(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function gM(e){return RD(e)}gM.signature=eM;function _M(e){return LD(e)}_M.signature=eM;function vM(e){return zD(e)}vM.signature=eM;function yM(e,t){return t===0?e:e-t*Math.floor(e/t)}yM.signature=tM;function bM(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,n=t<0;if(n&&(t=-t),t===0)throw Error(`Root must be non-zero`);if(e<0&&Math.abs(t)%2!=1)throw Error(`Root must be odd when a is negative.`);if(e===0)return n?1/0:0;if(!isFinite(e))return n?0:e;var r=Math.abs(e)**(1/t);return r=e<0?-r:r,n?1/r:r}function xM(e){return ID(e)}xM.signature=eM;function SM(e){return Math.sqrt(e)}SM.signature=eM;function CM(e){return e*e}CM.signature=eM;function wM(e,t){var n,r,i,a=0,o=1,s=1,c=0;if(!PD(e)||!PD(t))throw Error(`Parameters in function xgcd must be integer numbers`);for(;t;)r=Math.floor(e/t),i=e-r*t,n=a,a=o-r*a,o=n,n=s,s=c-r*s,c=n,e=t,t=i;return e<0?[-e,-o,-c]:[e,e?o:0,c]}wM.signature=tM;function TM(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:e**+t}TM.signature=tM;function EM(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!PD(t)||t<0||t>15)throw Error(`Number of decimals in function round must be an integer from 0 to 15 inclusive`);return parseFloat(qD(e,t))}function DM(e){return Math.abs(e)}DM.signature=eM;var OM=`number`,kM=`number, number`;function AM(e,t){if(!PD(e)||!PD(t))throw Error(`Integers expected in function bitAnd`);return e&t}AM.signature=kM;function jM(e){if(!PD(e))throw Error(`Integer expected in function bitNot`);return~e}jM.signature=OM;function MM(e,t){if(!PD(e)||!PD(t))throw Error(`Integers expected in function bitOr`);return e|t}MM.signature=kM;function NM(e,t){if(!PD(e)||!PD(t))throw Error(`Integers expected in function bitXor`);return e^t}NM.signature=kM;function PM(e,t){if(!PD(e)||!PD(t))throw Error(`Integers expected in function leftShift`);return e<<t}PM.signature=kM;function FM(e,t){if(!PD(e)||!PD(t))throw Error(`Integers expected in function rightArithShift`);return e>>t}FM.signature=kM;function IM(e,t){if(!PD(e)||!PD(t))throw Error(`Integers expected in function rightLogShift`);return e>>>t}IM.signature=kM;function LM(e,t){if(t<e)return 1;if(t===e)return t;var n=t+e>>1;return LM(e,n)*LM(n+1,t)}function RM(e,t){if(!PD(e)||e<0||!PD(t)||t<0)throw TypeError(`Positive integer value expected in function combinations`);if(t>e)throw TypeError(`k must be less than or equal to n`);for(var n=e-t,r=1,i=t<n?n+1:t+1,a=2,o=t<n?t:n,s=i;s<=e;++s)for(r*=s;a<=o&&r%a===0;)r/=a,++a;return a<=o&&(r/=LM(a,o)),r}RM.signature=`number, number`;var zM=Math.PI,BM=2*Math.PI,VM=Math.E,HM=1.618033988749895,UM=`number`,WM=`number, number`;function GM(e){return!e}GM.signature=UM;function KM(e,t){return!!(e||t)}KM.signature=WM;function qM(e,t){return!!e!=!!t}qM.signature=WM;function JM(e,t){return!!(e&&t)}JM.signature=WM;function YM(e){var t;if(PD(e))return e<=0?Number.isFinite(e)?1/0:NaN:e>171?1/0:LM(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*YM(1-e));if(e>=171.35)return 1/0;if(e>85){var n=e*e,r=n*e,i=r*e,a=i*e;return Math.sqrt(2*Math.PI/e)*(e/Math.E)**+e*(1+1/(12*e)+1/(288*n)-139/(51840*r)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=ZM[0];for(var o=1;o<ZM.length;++o)t+=ZM[o]/(e+o);var s=e+XM+.5;return Math.sqrt(2*Math.PI)*s**+(e+.5)*Math.exp(-s)*t}YM.signature=`number`;var XM=4.7421875,ZM=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],QM=.9189385332046728,$M=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function eN(e){if(e<0)return NaN;if(e===0)return 1/0;if(!Number.isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-eN(1-e);--e;for(var t=e+5+.5,n=$M[0],r=6;r>=1;r--)n+=$M[r]/(e+r);return QM+(e+.5)*Math.log(t)-t+Math.log(n)}eN.signature=`number`;var tN=`number`,nN=`number, number`;function rN(e){return Math.acos(e)}rN.signature=tN;function iN(e){return eO(e)}iN.signature=tN;function aN(e){return Math.atan(1/e)}aN.signature=tN;function oN(e){return Number.isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}oN.signature=tN;function sN(e){return Math.asin(1/e)}sN.signature=tN;function cN(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}cN.signature=tN;function lN(e){return Math.acos(1/e)}lN.signature=tN;function uN(e){var t=1/e,n=Math.sqrt(t*t-1);return Math.log(n+t)}uN.signature=tN;function dN(e){return Math.asin(e)}dN.signature=tN;function fN(e){return tO(e)}fN.signature=tN;function pN(e){return Math.atan(e)}pN.signature=tN;function mN(e,t){return Math.atan2(e,t)}mN.signature=nN;function hN(e){return nO(e)}hN.signature=tN;function gN(e){return Math.cos(e)}gN.signature=tN;function _N(e){return rO(e)}_N.signature=tN;function vN(e){return 1/Math.tan(e)}vN.signature=tN;function yN(e){var t=Math.exp(2*e);return(t+1)/(t-1)}yN.signature=tN;function bN(e){return 1/Math.sin(e)}bN.signature=tN;function xN(e){return e===0?1/0:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*ID(e)}xN.signature=tN;function SN(e){return 1/Math.cos(e)}SN.signature=tN;function CN(e){return 2/(Math.exp(e)+Math.exp(-e))}CN.signature=tN;function wN(e){return Math.sin(e)}wN.signature=tN;function TN(e){return iO(e)}TN.signature=tN;function EN(e){return Math.tan(e)}EN.signature=tN;function DN(e){return aO(e)}DN.signature=tN;var ON=`number`;function kN(e){return PD(e)}kN.signature=ON;function AN(e){return e<0}AN.signature=ON;function jN(e){return e>0}jN.signature=ON;function MN(e){return e===0}MN.signature=ON;function NN(e){return Number.isNaN(e)}NN.signature=ON;function PN(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(n<=0)throw Error(`Relative tolerance must be greater than 0`);if(r<0)throw Error(`Absolute tolerance must be at least 0`);return e.isNaN()||t.isNaN()?!1:!e.isFinite()||!t.isFinite()?e.eq(t):e.eq(t)?!0:e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(n),r))}var FN=`isNegative`,IN=Z(FN,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(FN,{number:e=>$D(e,0,n.relTol,n.absTol)?!1:AN(e),BigNumber:e=>PN(e,new e.constructor(0),n.relTol,n.absTol)?!1:e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0n,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),LN=`isNumeric`,RN=Z(LN,[`typed`],e=>{var{typed:t}=e;return t(LN,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),zN=`hasNumericValue`,BN=Z(zN,[`typed`,`isNumeric`],e=>{var{typed:t,isNumeric:n}=e;return t(zN,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})}),VN=`isPositive`,HN=Z(VN,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(VN,{number:e=>$D(e,0,n.relTol,n.absTol)?!1:jN(e),BigNumber:e=>PN(e,new e.constructor(0),n.relTol,n.absTol)?!1:!e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e>0n,Fraction:e=>e.s>0n&&e.n>0n,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),UN=`isZero`,WN=Z(UN,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return t(UN,{"number | BigNumber | Complex | Fraction":e=>n(e,0),bigint:e=>e===0n,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),GN=`isNaN`,KN=Z(GN,[`typed`],e=>{var{typed:t}=e;return t(GN,{number:NN,BigNumber:function(e){return e.isNaN()},bigint:function(e){return!1},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),qN=`isBounded`,JN=Z(qN,[`typed`],e=>{var{typed:t}=e;return t(qN,{number:e=>Number.isFinite(e),"BigNumber | Complex":e=>e.isFinite(),"bigint | Fraction":()=>!0,"null | undefined":()=>!1,Unit:t.referToSelf(e=>t=>e(t.value)),"Array | Matrix":t.referToSelf(e=>t=>(Array.isArray(t)||(t=t.valueOf()),t.every(t=>e(t))))})}),YN=`isFinite`,XN=Z(YN,[`typed`,`isBounded`,`map`],e=>{var{typed:t,isBounded:n,map:r}=e;return t(YN,{"Array | Matrix":e=>r(e,n),any:e=>n(e)})}),ZN=`typeOf`,QN=Z(ZN,[`typed`],e=>{var{typed:t}=e;return t(ZN,{any:pD})});function $N(e,t,n,r){return $D(e.re,t.re,n,r)&&$D(e.im,t.im,n,r)}var eP=Z(`compareUnits`,[`typed`],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(e=>(n,r)=>{if(!n.equalBase(r))throw Error(`Cannot compare units with different base`);return t.find(e,[n.valueType(),r.valueType()])(n.value,r.value)})}}),tP=`equalScalar`,nP=Z(tP,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(tP,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return $D(e,t,n.relTol,n.absTol)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||PN(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e===t},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return $N(e,t,n.relTol,n.absTol)}},eP({typed:t}))});Z(tP,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(tP,{"number, number":function(e,t){return $D(e,t,n.relTol,n.absTol)}})});var rP=Z(`SparseMatrix`,[`typed`,`equalScalar`,`Matrix`],e=>{var{typed:t,equalScalar:n,Matrix:r}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!kE(t))throw Error(`Invalid datatype: `+t);if(jE(e))a(this,e,t);else if(e&&AE(e.index)&&AE(e.ptr)&&AE(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(AE(e))o(this,e,t);else if(e)throw TypeError(`Unsupported type of data (`+pD(e)+`)`);else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function a(e,t,n){t.type===`SparseMatrix`?(e._values=t._values?mD(t._values):void 0,e._index=mD(t._index),e._ptr=mD(t._ptr),e._size=mD(t._size),e._datatype=n||t._datatype):o(e,t.valueOf(),n||t._datatype)}function o(e,r,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=r.length,o=0,s=n,c=0;if(kE(i)&&(s=t.find(n,[i,i])||n,c=t.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var u=0;u<a;u++){var d=r[u];if(AE(d)){if(l===0&&o<d.length&&(o=d.length),l<d.length){var f=d[l];s(f,c)||(e._values.push(f),e._index.push(u))}}else l===0&&o<1&&(o=1),s(d,c)||(e._values.push(d),e._index.push(u))}l++}while(l<o)}for(;e._ptr.length<=o;)e._ptr.push(e._index.length);e._size=[a,o]}i.prototype=new r,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,`name`,{value:`SparseMatrix`}),i.prototype.constructor=i,i.prototype.type=`SparseMatrix`,i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Tj(this._values,pD)},i.prototype.storage=function(){return`sparse`},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return e!==0&&t!==0?this._index.length/(e*t):0},i.prototype.subset=function(e,t,n){if(!this._values)throw Error(`Cannot invoke subset on a Pattern only matrix`);switch(arguments.length){case 1:return s(this,e);case 2:case 3:return c(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}};function s(e,t){if(!IE(t))throw TypeError(`Invalid index`);if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new $A(n.length,e._size.length);var r,a,o,s,c=t.min(),l=t.max();for(r=0,a=e._size.length;r<a;r++)aj(c[r],e._size[r]),aj(l[r],e._size[r]);var u=e._values,d=e._index,f=e._ptr,p=t.dimension(0),m=t.dimension(1),h=[],g=[];function _(e,t){g[e]=t[0],h[e]=!0}Number.isInteger(p)?_(p,[0]):p.forEach(_);var v=u?[]:void 0,y=[],b=[];function x(e){for(b.push(y.length),o=f[e],s=f[e+1];o<s;o++)r=d[o],h[r]===!0&&(y.push(g[r]),v&&v.push(u[o]))}return Number.isInteger(m)?x(m):m.forEach(x),b.push(y.length),new i({values:v,index:y,ptr:b,size:n,datatype:e._datatype})}function c(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),o;if(jE(n)?(o=n.size(),n=n.toArray()):o=tj(n),a){if(o.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(i.length!==1&&i.length!==2)throw new $A(i.length,e._size.length,`<`);if(o.length<i.length){for(var s=0,c=0;i[s]===1&&o[s]===1;)s++;for(;i[s]===1;)c++,s++;n=hj(n,i.length,c,o)}if(!vD(i,o))throw new $A(i,o,`>`);if(i.length===1)d(t.dimension(0),(t,i)=>{aj(t),e.set([t,0],n[i[0]],r)});else{var l=t.dimension(0),u=t.dimension(1);d(l,(t,i)=>{aj(t),d(u,(a,o)=>{aj(a),e.set([t,a],n[i[0]][o[0]],r)})})}}return e;function d(e,t){CE(e)?t(e,[0]):e.forEach(t)}}i.prototype.get=function(e){if(!AE(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new $A(e.length,this._size.length);if(!this._values)throw Error(`Cannot invoke get on a Pattern only matrix`);var t=e[0],n=e[1];aj(t,this._size[0]),aj(n,this._size[1]);var r=l(t,this._ptr[n],this._ptr[n+1],this._index);return r<this._ptr[n+1]&&this._index[r]===t?this._values[r]:0},i.prototype.set=function(e,r,i){if(!AE(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new $A(e.length,this._size.length);if(!this._values)throw Error(`Cannot invoke set on a Pattern only matrix`);var a=e[0],o=e[1],s=this._size[0],c=this._size[1],p=n,m=0;kE(this._datatype)&&(p=t.find(n,[this._datatype,this._datatype])||n,m=t.convert(0,this._datatype)),(a>s-1||o>c-1)&&(f(this,Math.max(a+1,s),Math.max(o+1,c),i),s=this._size[0],c=this._size[1]),aj(a,s),aj(o,c);var h=l(a,this._ptr[o],this._ptr[o+1],this._index);return h<this._ptr[o+1]&&this._index[h]===a?p(r,m)?u(h,o,this._values,this._index,this._ptr):this._values[h]=r:p(r,m)||d(h,a,o,r,this._values,this._index,this._ptr),this};function l(e,t,n,r){if(n-t===0)return n;for(var i=t;i<n;i++)if(r[i]===e)return i;return t}function u(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(var a=t+1;a<i.length;a++)i[a]--}function d(e,t,n,r,i,a,o){i.splice(e,0,r),a.splice(e,0,t);for(var s=n+1;s<o.length;s++)o[s]++}i.prototype.resize=function(e,t,n){if(!ME(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e);if(r.length!==2)throw Error(`Only two dimensions matrix are supported`);return r.forEach(function(e){if(!CE(e)||!PD(e)||e<0)throw TypeError(`Invalid size, must contain positive integers (size: `+GA(r)+`)`)}),f(n?this.clone():this,r[0],r[1],t)};function f(e,r,i,a){var o=a||0,s=n,c=0;kE(e._datatype)&&(s=t.find(n,[e._datatype,e._datatype])||n,c=t.convert(0,e._datatype),o=t.convert(o,e._datatype));var l=!s(o,c),u=e._size[0],d=e._size[1],f,p,m;if(i>d){for(p=d;p<i;p++)if(e._ptr[p]=e._values.length,l)for(f=0;f<u;f++)e._values.push(o),e._index.push(f);e._ptr[i]=e._values.length}else i<d&&(e._ptr.splice(i+1,d-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(d=i,r>u){if(l){var h=0;for(p=0;p<d;p++){e._ptr[p]=e._ptr[p]+h,m=e._ptr[p+1]+h;var g=0;for(f=u;f<r;f++,g++)e._values.splice(m+g,0,o),e._index.splice(m+g,0,f),h++}e._ptr[d]=e._values.length}}else if(r<u){var _=0;for(p=0;p<d;p++){e._ptr[p]=e._ptr[p]-_;var v=e._ptr[p],y=e._ptr[p+1]-_;for(m=v;m<y;m++)f=e._index[m],f>r-1&&(e._values.splice(m,1),e._index.splice(m,1),_++)}e._ptr[p]=e._values.length}return e._size[0]=r,e._size[1]=i,e}i.prototype.reshape=function(e,t){if(!AE(e))throw TypeError(`Array expected`);if(e.length!==2)throw Error(`Sparse matrices can only be reshaped in two dimensions`);e.forEach(function(t){if(!CE(t)||!PD(t)||t<=-2||t===0)throw TypeError(`Invalid size, must contain positive integers or -1 (size: `+GA(e)+`)`)});var n=this._size[0]*this._size[1];if(e=uj(e,n),n!==e[0]*e[1])throw Error(`Reshaping sparse matrix will result in the wrong number of elements`);var r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;for(var i=[],a=0;a<r._ptr.length;a++)for(var o=0;o<r._ptr[a+1]-r._ptr[a];o++)i.push(a);for(var s=r._values.slice(),c=r._index.slice(),u=0;u<r._index.length;u++){var f=c[u],p=i[u],m=f*r._size[1]+p;i[u]=m%e[1],c[u]=Math.floor(m/e[1])}r._values.length=0,r._index.length=0,r._ptr.length=e[1]+1,r._size=e.slice();for(var h=0;h<r._ptr.length;h++)r._ptr[h]=0;for(var g=0;g<s.length;g++){var _=c[g],v=i[g],y=s[g];d(l(_,r._ptr[v],r._ptr[v+1],r._index),_,v,y,r._values,r._index,r._ptr)}return r},i.prototype.clone=function(){return new i({values:this._values?mD(this._values):void 0,index:mD(this._index),ptr:mD(this._ptr),size:mD(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,t){if(!this._values)throw Error(`Cannot invoke map on a Pattern only matrix`);var n=this,r=this._size[0],i=this._size[1],a=Ij(e,n,`map`);return p(this,0,r-1,0,i-1,function(e,t,r){return a.fn(e,[t,r],n)},t)};function p(e,r,a,o,s,c,l){var u=[],d=[],f=[],p=n,m=0;kE(e._datatype)&&(p=t.find(n,[e._datatype,e._datatype])||n,m=t.convert(0,e._datatype));for(var h=function(e,t,n){var r=c(e,t,n);p(r,m)||(u.push(r),d.push(t))},g=o;g<=s;g++){f.push(u.length);var _=e._ptr[g],v=e._ptr[g+1];if(l)for(var y=_;y<v;y++){var b=e._index[y];b>=r&&b<=a&&h(e._values[y],b-r,g-o)}else{for(var x={},S=_;S<v;S++){var C=e._index[S];x[C]=e._values[S]}for(var w=r;w<=a;w++)h(w in x?x[w]:0,w-r,g-o)}}return f.push(u.length),new i({values:u,index:d,ptr:f,size:[a-r+1,s-o+1]})}i.prototype.forEach=function(e,t){if(!this._values)throw Error(`Cannot invoke forEach on a Pattern only matrix`);for(var n=this,r=this._size[0],i=this._size[1],a=Ij(e,n,`forEach`),o=0;o<i;o++){var s=this._ptr[o],c=this._ptr[o+1];if(t)for(var l=s;l<c;l++){var u=this._index[l];a.fn(this._values[l],[u,o],n)}else{for(var d={},f=s;f<c;f++){var p=this._index[f];d[p]=this._values[f]}for(var m=0;m<r;m++){var h=m in d?d[m]:0;a.fn(h,[m,o],n)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error(`Cannot iterate a Pattern only matrix`);for(var e=this._size[1],t=0;t<e;t++)for(var n=this._ptr[t],r=this._ptr[t+1],i=n;i<r;i++){var a=this._index[i];yield{value:this._values[i],index:[a,t]}}},i.prototype.toArray=function(){return m(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return m(this._values,this._index,this._ptr,this._size,!1)};function m(e,t,n,r,i){var a=r[0],o=r[1],s=[],c,l;for(c=0;c<a;c++)for(s[c]=[],l=0;l<o;l++)s[c][l]=0;for(l=0;l<o;l++)for(var u=n[l],d=n[l+1],f=u;f<d;f++)c=t[f],s[c][l]=e?i?mD(e[f]):e[f]:1;return s}return i.prototype.format=function(e){for(var t=this._size[0],n=this._size[1],r=this.density(),i=`Sparse Matrix [`+GA(t,e)+` x `+GA(n,e)+`] density: `+GA(r,e)+`
`,a=0;a<n;a++)for(var o=this._ptr[a],s=this._ptr[a+1],c=o;c<s;c++){var l=this._index[c];i+=`
(`+GA(l,e)+`, `+GA(a,e)+`) ==> `+(this._values?GA(this._values[c],e):`X`)}return i},i.prototype.toString=function(){return GA(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(e){if(e){if(wE(e)&&(e=e.toNumber()),!CE(e)||!PD(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;var t=e>0?e:0,n=e<0?-e:0,r=this._size[0],a=this._size[1],o=Math.min(r-n,a-t),s=[],c=[],l=[];l[0]=0;for(var u=t;u<a&&s.length<o;u++)for(var d=this._ptr[u],f=this._ptr[u+1],p=d;p<f;p++){var m=this._index[p];if(m===u-t+n){s.push(this._values[p]),c[s.length-1]=m-n;break}}return l.push(s.length),new i({values:s,index:c,ptr:l,size:[o,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,r,a,o,s){if(!AE(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(wE(e)&&(e=e.toNumber()),!CE(e)||!PD(e)||e<1)throw Error(`Size values must be positive integers`);return e}),a){if(wE(a)&&(a=a.toNumber()),!CE(a)||!PD(a))throw TypeError(`The parameter k must be an integer number`)}else a=0;var c=n,l=0;kE(s)&&(c=t.find(n,[s,s])||n,l=t.convert(0,s));var u=a>0?a:0,d=a<0?-a:0,f=e[0],p=e[1],m=Math.min(f-d,p-u),h;if(AE(r)){if(r.length!==m)throw Error(`Invalid value array length`);h=function(e){return r[e]}}else if(jE(r)){var g=r.size();if(g.length!==1||g[0]!==m)throw Error(`Invalid matrix length`);h=function(e){return r.get([e])}}else h=function(){return r};for(var _=[],v=[],y=[],b=0;b<p;b++){y.push(_.length);var x=b-u;if(x>=0&&x<m){var S=h(x);c(S,l)||(v.push(x+d),_.push(S))}}return y.push(_.length),new i({values:_,index:v,ptr:y,size:[f,p]})},i.prototype.swapRows=function(e,t){if(!CE(e)||!PD(e)||!CE(t)||!PD(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return aj(e,this._size[0]),aj(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,n,r,i){for(var a=r[e],o=r[e+1],s=a;s<o;s++)i(n[s],t[s])},i._swapRows=function(e,t,n,r,i,a){for(var o=0;o<n;o++){var s=a[o],c=a[o+1],u=l(e,s,c,i),d=l(t,s,c,i);if(u<c&&d<c&&i[u]===e&&i[d]===t){if(r){var f=r[u];r[u]=r[d],r[d]=f}continue}if(u<c&&i[u]===e&&(d>=c||i[d]!==t)){var p=r?r[u]:void 0;i.splice(d,0,t),r&&r.splice(d,0,p),i.splice(d<=u?u+1:u,1),r&&r.splice(d<=u?u+1:u,1);continue}if(d<c&&i[d]===t&&(u>=c||i[u]!==e)){var m=r?r[d]:void 0;i.splice(u,0,e),r&&r.splice(u,0,m),i.splice(u<=d?d+1:d,1),r&&r.splice(u<=d?d+1:d,1)}}},i},{isClass:!0}),iP=`number`,aP=[`typed`];function oP(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);return t?{input:e,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null}function sP(e){for(var t=parseInt(e.integerPart,e.radix),n=0,r=0;r<e.fractionalPart.length;r++){var i=parseInt(e.fractionalPart[r],e.radix);n+=i/e.radix**+(r+1)}var a=t+n;if(isNaN(a))throw SyntaxError(`String "`+e.input+`" is not a valid number`);return a}var cP=Z(iP,aP,e=>{var{typed:t}=e,n=t(`number`,{"":function(){return 0},number:function(e){return e},string:function(e){if(e===`NaN`)return NaN;var t=oP(e);if(t)return sP(t);var n=0,r=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);r&&(n=Number(r[2]),e=r[1]);var i=Number(e);if(isNaN(i))throw SyntaxError(`String "`+e+`" is not a valid number`);if(r){if(i>2**n-1)throw SyntaxError(`String "${e}" is out of range`);i>=2**(n-1)&&(i-=2**n)}return i},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf(e=>t=>{var n=t.clone();return n.value=e(t.value),n}),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))});return n.fromJSON=function(e){return parseFloat(e.value)},n}),lP=Z(`bigint`,[`typed`],e=>{var{typed:t}=e,n=t(`bigint`,{"":function(){return 0n},bigint:function(e){return e},number:function(e){return BigInt(e.toFixed())},BigNumber:function(e){return BigInt(e.round().toString())},Fraction:function(e){return BigInt(e.valueOf().toFixed())},"string | boolean":function(e){return BigInt(e)},null:function(e){return 0n},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))});return n.fromJSON=function(e){return BigInt(e.value)},n}),uP=`string`,dP=Z(uP,[`typed`],e=>{var{typed:t}=e;return t(uP,{"":function(){return``},number:UD,null:function(e){return`null`},boolean:function(e){return e+``},string:function(e){return e},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e)),any:function(e){return String(e)}})}),fP=`boolean`,pP=Z(fP,[`typed`],e=>{var{typed:t}=e;return t(fP,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var t=e.toLowerCase();if(t===`true`)return!0;if(t===`false`)return!1;var n=Number(e);if(e!==``&&!isNaN(n))return!!n;throw Error(`Cannot convert "`+e+`" to a boolean`)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),mP=Z(`bignumber`,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(`bignumber`,{"":function(){return new n(0)},number:function(e){return new n(e+``)},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var r=t[2],i=n(t[1]),a=new n(2).pow(Number(r));if(i.gt(a.sub(1)))throw SyntaxError(`String "${e}" is out of range`);var o=new n(2).pow(Number(r)-1);return i.gte(o)?i.sub(a):i}return new n(e)},BigNumber:function(e){return e},bigint:function(e){return new n(e.toString())},Unit:t.referToSelf(e=>t=>{var n=t.clone();return n.value=e(t.value),n}),Fraction:function(e){return new n(String(e.n)).div(String(e.d)).times(String(e.s))},null:function(e){return new n(0)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),hP=Z(`complex`,[`typed`,`Complex`],e=>{var{typed:t,Complex:n}=e;return t(`complex`,{"":function(){return n.ZERO},number:function(e){return new n(e,0)},"number, number":function(e,t){return new n(e,t)},"BigNumber, BigNumber":function(e,t){return new n(e.toNumber(),t.toNumber())},Fraction:function(e){return new n(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return n(e)},null:function(e){return n(0)},Object:function(e){if(`re`in e&&`im`in e)return new n(e.re,e.im);if(`r`in e&&`phi`in e||`abs`in e&&`arg`in e)return new n(e);throw Error(`Expected object with properties (re and im) or (r and phi) or (abs and arg)`)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),gP=Z(`fraction`,[`typed`,`Fraction`],e=>{var{typed:t,Fraction:n}=e;return t(`fraction`,{number:function(e){if(!Number.isFinite(e)||isNaN(e))throw Error(e+` cannot be represented as a fraction`);return new n(e)},string:function(e){return new n(e)},"number, number":function(e,t){return new n(e,t)},"bigint, bigint":function(e,t){return new n(e,t)},null:function(e){return new n(0)},BigNumber:function(e){return new n(e.toString())},bigint:function(e){return new n(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf(e=>t=>{var n=t.clone();return n.value=e(t.value),n}),Object:function(e){return new n(e)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),_P=`matrix`,vP=Z(_P,[`typed`,`Matrix`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,Matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(_P,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,t){return a([],e,t)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,t,n){if(t===`dense`||t===`default`||t===void 0)return new r(e,n);if(t===`sparse`)return new i(e,n);throw TypeError(`Unknown matrix type `+JSON.stringify(t)+`.`)}}),yP=`matrixFromFunction`,bP=Z(yP,[`typed`,`matrix`,`isZero`],e=>{var{typed:t,matrix:n,isZero:r}=e;return t(yP,{"Array | Matrix, function, string, string":function(e,t,n,r){return i(e,t,n,r)},"Array | Matrix, function, string":function(e,t,n){return i(e,t,n)},"Matrix, function":function(e,t){return i(e,t,`dense`)},"Array, function":function(e,t){return i(e,t,`dense`).toArray()},"Array | Matrix, string, function":function(e,t,n){return i(e,n,t)},"Array | Matrix, string, string, function":function(e,t,n,r){return i(e,r,t,n)}});function i(e,t,i,a){var o=a===void 0?n(i):n(i,a);return o.resize(e),o.forEach(function(e,n){var i=t(n);r(i)||o.set(n,i)}),o}}),xP=`matrixFromRows`,SP=Z(xP,[`typed`,`matrix`,`flatten`,`size`],e=>{var{typed:t,matrix:n,flatten:r,size:i}=e;return t(xP,{"...Array":function(e){return a(e)},"...Matrix":function(e){return n(a(e.map(e=>e.toArray())))}});function a(e){if(e.length===0)throw TypeError(`At least one row is needed to construct a matrix.`);var t=o(e[0]),n=[];for(var i of e){var a=o(i);if(a!==t)throw TypeError(`The vectors had different length: `+(t|0)+` ≠ `+(a|0));n.push(r(i))}return n}function o(e){var t=i(e);if(t.length===1)return t[0];if(t.length===2){if(t[0]===1)return t[1];if(t[1]===1)return t[0];throw TypeError(`At least one of the arguments is not a vector.`)}else throw TypeError(`Only one- or two-dimensional vectors are supported.`)}}),CP=`matrixFromColumns`,wP=Z(CP,[`typed`,`matrix`,`flatten`,`size`],e=>{var{typed:t,matrix:n,flatten:r,size:i}=e;return t(CP,{"...Array":function(e){return a(e)},"...Matrix":function(e){return n(a(e.map(e=>e.toArray())))}});function a(e){if(e.length===0)throw TypeError(`At least one column is needed to construct a matrix.`);for(var t=o(e[0]),n=[],i=0;i<t;i++)n[i]=[];for(var a of e){var s=o(a);if(s!==t)throw TypeError(`The vectors had different length: `+(t|0)+` ≠ `+(s|0));for(var c=r(a),l=0;l<t;l++)n[l].push(c[l])}return n}function o(e){var t=i(e);if(t.length===1)return t[0];if(t.length===2){if(t[0]===1)return t[1];if(t[1]===1)return t[0];throw TypeError(`At least one of the arguments is not a vector.`)}else throw TypeError(`Only one- or two-dimensional vectors are supported.`)}}),TP=`splitUnit`,EP=Z(TP,[`typed`],e=>{var{typed:t}=e;return t(TP,{"Unit, Array":function(e,t){return e.splitUnit(t)}})}),DP=`unaryMinus`,OP=Z(DP,[`typed`],e=>{var{typed:t}=e;return t(DP,{number:sM,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:t.referToSelf(e=>n=>{var r=n.clone();return r.value=t.find(e,r.valueType())(n.value),r}),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0))})}),kP=`unaryPlus`,AP=Z(kP,[`typed`,`config`,`numeric`],e=>{var{typed:t,config:n,numeric:r}=e;return t(kP,{number:cM,Complex:function(e){return e},BigNumber:function(e){return e},bigint:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0)),boolean:function(e){return r(+!!e,n.number)},string:function(e){return r(e,FD(e,n))}})}),jP=`abs`,MP=Z(jP,[`typed`],e=>{var{typed:t}=e;return t(jP,{number:nM,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0))})}),NP=`mapSlices`,PP=Z(NP,[`typed`,`isInteger`],e=>{var{typed:t,isInteger:n}=e;return t(NP,{"Array | Matrix, number | BigNumber, function":function(e,t,r){if(!n(t))throw TypeError(`Integer number expected for dimension`);var i=Array.isArray(e)?tj(e):e.size();if(t<0||t>=i.length)throw new ej(t,i.length);return jE(e)?e.create(FP(e.valueOf(),t,r),e.datatype()):FP(e,t,r)}})},{formerly:`apply`});function FP(e,t,n){var r,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=IP(e),i=[],r=0;r<a.length;r++)i[r]=FP(a[r],t-1,n);return i}else return n(e);else{for(i=[],r=0;r<e.length;r++)i[r]=FP(e[r],t-1,n);return i}}function IP(e){var t=e.length,n=e[0].length,r,i,a=[];for(i=0;i<n;i++){var o=[];for(r=0;r<t;r++)o.push(e[r][i]);a.push(o)}return a}var LP=`addScalar`,RP=Z(LP,[`typed`],e=>{var{typed:t}=e;return t(LP,{"number, number":rM,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"bigint, bigint":function(e,t){return e+t},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf(e=>(n,r)=>{if(n.value===null||n.value===void 0)throw Error(`Parameter x contains a unit with undefined value`);if(r.value===null||r.value===void 0)throw Error(`Parameter y contains a unit with undefined value`);if(!n.equalBase(r))throw Error(`Units do not match`);var i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i})})}),zP=`subtractScalar`,BP=Z(zP,[`typed`],e=>{var{typed:t}=e;return t(zP,{"number, number":iM,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"bigint, bigint":function(e,t){return e-t},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf(e=>(n,r)=>{if(n.value===null||n.value===void 0)throw Error(`Parameter x contains a unit with undefined value`);if(r.value===null||r.value===void 0)throw Error(`Parameter y contains a unit with undefined value`);if(!n.equalBase(r))throw Error(`Units do not match`);var i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i})})}),VP=`cbrt`,HP=Z(VP,[`config`,`typed`,`isNegative`,`unaryMinus`,`matrix`,`Complex`,`BigNumber`,`Fraction`],e=>{var{config:t,typed:n,isNegative:r,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:c}=e;return n(VP,{number:lM,Complex:l,"Complex, boolean":l,BigNumber:function(e){return e.cbrt()},Unit:u});function l(e,n){var r=e.arg()/3,i=e.abs(),s=new o(lM(i),0).mul(new o(0,r).exp());if(n){var c=[s,new o(lM(i),0).mul(new o(0,r+Math.PI*2/3).exp()),new o(lM(i),0).mul(new o(0,r-Math.PI*2/3).exp())];return t.matrix===`Array`?c:a(c)}else return s}function u(e){if(e.value&&EE(e.value)){var t=e.clone();return t.value=1,t=t.pow(1/3),t.value=l(e.value),t}else{var n=r(e.value);n&&(e.value=i(e.value));var a=wE(e.value)?new s(1).div(3):DE(e.value)?new c(1,3):1/3,o=e.pow(a);return n&&(o.value=i(o.value)),o}}}),UP=Z(`matAlgo11xS0s`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i,a){var o=e._values,s=e._index,c=e._ptr,l=e._size,u=e._datatype;if(!o)throw Error(`Cannot perform operation on Pattern Sparse Matrix and Scalar value`);var d=l[0],f=l[1],p,m=n,h=0,g=i;typeof u==`string`&&(p=u,m=t.find(n,[p,p]),h=t.convert(0,p),r=t.convert(r,p),g=t.find(i,[p,p]));for(var _=[],v=[],y=[],b=0;b<f;b++){y[b]=v.length;for(var x=c[b],S=c[b+1],C=x;C<S;C++){var w=s[C],T=a?g(r,o[C]):g(o[C],r);m(T,h)||(v.push(w),_.push(T))}}return y[f]=v.length,e.createSparseMatrix({values:_,index:v,ptr:y,size:[d,f],datatype:p})}}),WP=Z(`matAlgo12xSfs`,[`typed`,`DenseMatrix`],e=>{var{typed:t,DenseMatrix:n}=e;return function(e,r,i,a){var o=e._values,s=e._index,c=e._ptr,l=e._size,u=e._datatype;if(!o)throw Error(`Cannot perform operation on Pattern Sparse Matrix and Scalar value`);var d=l[0],f=l[1],p,m=i;typeof u==`string`&&(p=u,r=t.convert(r,p),m=t.find(i,[p,p]));for(var h=[],g=[],_=[],v=0;v<f;v++){for(var y=v+1,b=c[v],x=c[v+1],S=b;S<x;S++){var C=s[S];g[C]=o[S],_[C]=y}for(var w=0;w<d;w++)v===0&&(h[w]=[]),_[w]===y?h[w][v]=a?m(r,g[w]):m(g[w],r):h[w][v]=a?m(r,0):m(0,r)}return new n({data:h,size:[d,f],datatype:p})}}),GP=Z(`matAlgo14xDs`,[`typed`],e=>{var{typed:t}=e;return function(e,r,i,a){var o=e._data,s=e._size,c=e._datatype,l,u=i;typeof c==`string`&&(l=c,r=t.convert(r,l),u=t.find(i,[l,l]));var d=s.length>0?n(u,0,s,s[0],o,r,a):[];return e.createDenseMatrix({data:d,size:mD(s),datatype:l})};function n(e,t,r,i,a,o,s){var c=[];if(t===r.length-1)for(var l=0;l<i;l++)c[l]=s?e(o,a[l]):e(a[l],o);else for(var u=0;u<i;u++)c[u]=n(e,t+1,r,r[t+1],a[u],o,s);return c}}),KP=`ceil`,qP=[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`],JP=new nA(10),YP=Z(KP,[`typed`,`config`,`round`],e=>{var{typed:t,config:n,round:r}=e;function i(e){var t=Math.ceil(e),i=r(e);return t===i?t:$D(e,i,n.relTol,n.absTol)&&!$D(e,t,n.relTol,n.absTol)?i:t}return t(KP,{number:i,"number, number":function(e,t){if(!PD(t))throw RangeError(`number of decimals in function ceil must be an integer`);if(t<0||t>15)throw RangeError(`number of decimals in ceil number must be in range 0-15`);var n=10**t;return i(e*n)/n}})}),XP=Z(KP,qP,e=>{var{typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,c=UP({typed:t,equalScalar:a}),l=WP({typed:t,DenseMatrix:s}),u=GP({typed:t}),d=YP({typed:t,config:n,round:r});function f(e){var t=(e,t)=>PN(e,t,n.relTol,n.absTol),i=e.ceil(),a=r(e);return i.eq(a)?i:t(e,a)&&!t(e,i)?a:i}return t(`ceil`,{number:d.signatures.number,"number,number":d.signatures[`number,number`],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:f,"BigNumber, BigNumber":function(e,t){var n=JP.pow(t);return f(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Jj(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0)),"Array, number | BigNumber":t.referToSelf(e=>(t,n)=>Jj(t,t=>e(t,n),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>c(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>u(t,n,e,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(e=>(t,n)=>u(i(n),t,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(e=>(t,n)=>a(t,0)?o(n.size(),n.storage()):n.storage()===`dense`?u(n,t,e,!0):l(n,t,e,!0))})}),ZP=`cube`,QP=Z(ZP,[`typed`],e=>{var{typed:t}=e;return t(ZP,{number:uM,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},bigint:function(e){return e*e*e},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})}),$P=`exp`,eF=Z($P,[`typed`],e=>{var{typed:t}=e;return t($P,{number:dM,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})}),tF=`expm1`,nF=Z(tF,[`typed`,`Complex`],e=>{var{typed:t,Complex:n}=e;return t(tF,{number:fM,Complex:function(e){var t=Math.exp(e.re);return new n(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})}),rF=`fix`,iF=[`typed`,`Complex`,`matrix`,`ceil`,`floor`,`equalScalar`,`zeros`,`DenseMatrix`],aF=Z(rF,[`typed`,`ceil`,`floor`],e=>{var{typed:t,ceil:n,floor:r}=e;return t(rF,{number:function(e){return e>0?r(e):n(e)},"number, number":function(e,t){return e>0?r(e,t):n(e,t)}})}),oF=Z(rF,iF,e=>{var{typed:t,Complex:n,matrix:r,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:c}=e,l=WP({typed:t,DenseMatrix:c}),u=GP({typed:t}),d=aF({typed:t,ceil:i,floor:a});return t(`fix`,{number:d.signatures.number,"number, number | BigNumber":d.signatures[`number,number`],Complex:function(e){return new n(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,t){return new n(e.re>0?a(e.re,t):i(e.re,t),e.im>0?a(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){var r=t.toNumber();return new n(e.re>0?a(e.re,r):i(e.re,r),e.im>0?a(e.im,r):i(e.im,r))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):a(e,t)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.s<0n?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0n?i(e,t):a(e,t)},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Jj(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0)),"Array | Matrix, number | BigNumber":t.referToSelf(e=>(t,n)=>Jj(t,t=>e(t,n),!0)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(e=>(t,n)=>u(r(n),t,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(e=>(t,n)=>o(t,0)?s(n.size(),n.storage()):n.storage()===`dense`?u(n,t,e,!0):l(n,t,e,!0))})}),sF=`floor`,cF=[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`],lF=new nA(10),uF=Z(sF,[`typed`,`config`,`round`],e=>{var{typed:t,config:n,round:r}=e;function i(e){var t=Math.floor(e),i=r(e);return t===i?t:$D(e,i,n.relTol,n.absTol)&&!$D(e,t,n.relTol,n.absTol)?i:t}return t(sF,{number:i,"number, number":function(e,t){if(!PD(t))throw RangeError(`number of decimals in function floor must be an integer`);if(t<0||t>15)throw RangeError(`number of decimals in floor number must be in range 0 - 15`);var n=10**t;return i(e*n)/n}})}),dF=Z(sF,cF,e=>{var{typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,c=UP({typed:t,equalScalar:a}),l=WP({typed:t,DenseMatrix:s}),u=GP({typed:t}),d=uF({typed:t,config:n,round:r});function f(e){var t=(e,t)=>PN(e,t,n.relTol,n.absTol),i=e.floor(),a=r(e);return i.eq(a)?i:t(e,a)&&!t(e,i)?a:i}return t(`floor`,{number:d.signatures.number,"number,number":d.signatures[`number,number`],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:f,"BigNumber, BigNumber":function(e,t){var n=lF.pow(t);return f(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Jj(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0)),"Array, number | BigNumber":t.referToSelf(e=>(t,n)=>Jj(t,t=>e(t,n),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>c(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>u(t,n,e,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(e=>(t,n)=>u(i(n),t,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(e=>(t,n)=>a(t,0)?o(n.size(),n.storage()):n.storage()===`dense`?u(n,t,e,!0):l(n,t,e,!0))})}),fF=Z(`matAlgo02xDS0`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i,a){var o=e._data,s=e._size,c=e._datatype||e.getDataType(),l=r._values,u=r._index,d=r._ptr,f=r._size,p=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(s.length!==f.length)throw new $A(s.length,f.length);if(s[0]!==f[0]||s[1]!==f[1])throw RangeError(`Dimension mismatch. Matrix A (`+s+`) must match Matrix B (`+f+`)`);if(!l)throw Error(`Cannot perform operation on Dense Matrix and Pattern Sparse Matrix`);var m=s[0],h=s[1],g,_=n,v=0,y=i;typeof c==`string`&&c===p&&c!==`mixed`&&(g=c,_=t.find(n,[g,g]),v=t.convert(0,g),y=t.find(i,[g,g]));for(var b=[],x=[],S=[],C=0;C<h;C++){S[C]=x.length;for(var w=d[C],T=d[C+1],E=w;E<T;E++){var D=u[E],O=a?y(l[E],o[D][C]):y(o[D][C],l[E]);_(O,v)||(x.push(D),b.push(O))}}return S[h]=x.length,r.createSparseMatrix({values:b,index:x,ptr:S,size:[m,h],datatype:c===e._datatype&&p===r._datatype?g:void 0})}}),pF=Z(`matAlgo03xDSf`,[`typed`],e=>{var{typed:t}=e;return function(e,n,r,i){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._values,l=n._index,u=n._ptr,d=n._size,f=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(o.length!==d.length)throw new $A(o.length,d.length);if(o[0]!==d[0]||o[1]!==d[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+d+`)`);if(!c)throw Error(`Cannot perform operation on Dense Matrix and Pattern Sparse Matrix`);var p=o[0],m=o[1],h,g=0,_=r;typeof s==`string`&&s===f&&s!==`mixed`&&(h=s,g=t.convert(0,h),_=t.find(r,[h,h]));for(var v=[],y=0;y<p;y++)v[y]=[];for(var b=[],x=[],S=0;S<m;S++){for(var C=S+1,w=u[S],T=u[S+1],E=w;E<T;E++){var D=l[E];b[D]=i?_(c[E],a[D][S]):_(a[D][S],c[E]),x[D]=C}for(var O=0;O<p;O++)x[O]===C?v[O][S]=b[O]:v[O][S]=i?_(g,a[O][S]):_(a[O][S],g)}return e.createDenseMatrix({data:v,size:[p,m],datatype:s===e._datatype&&f===n._datatype?h:void 0})}}),mF=Z(`matAlgo05xSfSf`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new $A(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));var x=a&&u?[]:void 0,S=[],C=[],w=x?[]:void 0,T=x?[]:void 0,E=[],D=[],O,k,A,j;for(k=0;k<g;k++){C[k]=S.length;var M=k+1;for(A=s[k],j=s[k+1];A<j;A++)O=o[A],S.push(O),E[O]=M,w&&(w[O]=a[A]);for(A=f[k],j=f[k+1];A<j;A++)O=d[A],E[O]!==M&&S.push(O),D[O]=M,T&&(T[O]=u[A]);if(x)for(A=C[k];A<S.length;){O=S[A];var N=E[O],P=D[O];if(N===M||P===M){var F=N===M?w[O]:y,I=P===M?T[O]:y,L=b(F,I);v(L,y)?S.splice(A,1):(x.push(L),A++)}}}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),hF=Z(`matAlgo13xDD`,[`typed`],e=>{var{typed:t}=e;return function(e,r,i){var a=e._data,o=e._size,s=e._datatype,c=r._data,l=r._size,u=r._datatype,d=[];if(o.length!==l.length)throw new $A(o.length,l.length);for(var f=0;f<o.length;f++){if(o[f]!==l[f])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+l+`)`);d[f]=o[f]}var p,m=i;typeof s==`string`&&s===u&&(p=s,m=t.find(i,[p,p]));var h=d.length>0?n(m,0,d,d[0],a,c):[];return e.createDenseMatrix({data:h,size:d,datatype:p})};function n(e,t,r,i,a,o){var s=[];if(t===r.length-1)for(var c=0;c<i;c++)s[c]=e(a[c],o[c]);else for(var l=0;l<i;l++)s[l]=n(e,t+1,r,r[t+1],a[l],o[l]);return s}});function gF(e,t){if(vD(e.size(),t.size()))return[e,t];var n=Oj(e.size(),t.size());return[e,t].map(e=>_F(e,n))}function _F(e,t){return vD(e.size(),t)?e:e.create(Aj(e.valueOf(),t),e.datatype())}var vF=Z(`matrixAlgorithmSuite`,[`typed`,`matrix`],e=>{var{typed:t,matrix:n}=e,r=hF({typed:t}),i=GP({typed:t});return function(e){var a=e.elop,o=e.SD||e.DS,s;a?(s={"DenseMatrix, DenseMatrix":(e,t)=>r(...gF(e,t),a),"Array, Array":(e,t)=>r(...gF(n(e),n(t)),a).valueOf(),"Array, DenseMatrix":(e,t)=>r(...gF(n(e),t),a),"DenseMatrix, Array":(e,t)=>r(...gF(e,n(t)),a)},e.SS&&(s[`SparseMatrix, SparseMatrix`]=(t,n)=>e.SS(...gF(t,n),a,!1)),e.DS&&(s[`DenseMatrix, SparseMatrix`]=(t,n)=>e.DS(...gF(t,n),a,!1),s[`Array, SparseMatrix`]=(t,r)=>e.DS(...gF(n(t),r),a,!1)),o&&(s[`SparseMatrix, DenseMatrix`]=(e,t)=>o(...gF(t,e),a,!0),s[`SparseMatrix, Array`]=(e,t)=>o(...gF(n(t),e),a,!0))):(s={"DenseMatrix, DenseMatrix":t.referToSelf(e=>(t,n)=>r(...gF(t,n),e)),"Array, Array":t.referToSelf(e=>(t,i)=>r(...gF(n(t),n(i)),e).valueOf()),"Array, DenseMatrix":t.referToSelf(e=>(t,i)=>r(...gF(n(t),i),e)),"DenseMatrix, Array":t.referToSelf(e=>(t,i)=>r(...gF(t,n(i)),e))},e.SS&&(s[`SparseMatrix, SparseMatrix`]=t.referToSelf(t=>(n,r)=>e.SS(...gF(n,r),t,!1))),e.DS&&(s[`DenseMatrix, SparseMatrix`]=t.referToSelf(t=>(n,r)=>e.DS(...gF(n,r),t,!1)),s[`Array, SparseMatrix`]=t.referToSelf(t=>(r,i)=>e.DS(...gF(n(r),i),t,!1))),o&&(s[`SparseMatrix, DenseMatrix`]=t.referToSelf(e=>(t,n)=>o(...gF(n,t),e,!0)),s[`SparseMatrix, Array`]=t.referToSelf(e=>(t,r)=>o(...gF(n(r),t),e,!0))));var c=e.scalar||`any`;(e.Ds||e.Ss)&&(a?(s[`DenseMatrix,`+c]=(e,t)=>i(e,t,a,!1),s[c+`, DenseMatrix`]=(e,t)=>i(t,e,a,!0),s[`Array,`+c]=(e,t)=>i(n(e),t,a,!1).valueOf(),s[c+`, Array`]=(e,t)=>i(n(t),e,a,!0).valueOf()):(s[`DenseMatrix,`+c]=t.referToSelf(e=>(t,n)=>i(t,n,e,!1)),s[c+`, DenseMatrix`]=t.referToSelf(e=>(t,n)=>i(n,t,e,!0)),s[`Array,`+c]=t.referToSelf(e=>(t,r)=>i(n(t),r,e,!1).valueOf()),s[c+`, Array`]=t.referToSelf(e=>(t,r)=>i(n(r),t,e,!0).valueOf())));var l=e.sS===void 0?e.Ss:e.sS;return a?(e.Ss&&(s[`SparseMatrix,`+c]=(t,n)=>e.Ss(t,n,a,!1)),l&&(s[c+`, SparseMatrix`]=(e,t)=>l(t,e,a,!0))):(e.Ss&&(s[`SparseMatrix,`+c]=t.referToSelf(t=>(n,r)=>e.Ss(n,r,t,!1))),l&&(s[c+`, SparseMatrix`]=t.referToSelf(e=>(t,n)=>l(n,t,e,!0)))),a&&a.signatures&&gD(s,a.signatures),s}}),yF=`mod`,bF=Z(yF,[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:c}=e,l=dF({typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),u=fF({typed:t,equalScalar:a}),d=pF({typed:t}),f=mF({typed:t,equalScalar:a}),p=UP({typed:t,equalScalar:a}),m=WP({typed:t,DenseMatrix:s}),h=vF({typed:t,matrix:i,concat:c});return t(yF,{"number, number":g,"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(l(e.div(t))))},"bigint, bigint":function(e,t){if(t===0n)return e;if(e<0){var n=e%t;return n===0n?n:n+t}return e%t},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(l(e.div(t))))}},h({SS:f,DS:d,SD:u,Ss:p,sS:m}));function g(e,t){return t===0?e:e-t*l(e/t)}}),xF=Z(`matAlgo01xDSid`,[`typed`],e=>{var{typed:t}=e;return function(e,n,r,i){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._values,l=n._index,u=n._ptr,d=n._size,f=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(o.length!==d.length)throw new $A(o.length,d.length);if(o[0]!==d[0]||o[1]!==d[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+d+`)`);if(!c)throw Error(`Cannot perform operation on Dense Matrix and Pattern Sparse Matrix`);var p=o[0],m=o[1],h=typeof s==`string`&&s!==`mixed`&&s===f?s:void 0,g=h?t.find(r,[h,h]):r,_,v,y=[];for(_=0;_<p;_++)y[_]=[];var b=[],x=[];for(v=0;v<m;v++){for(var S=v+1,C=u[v],w=u[v+1],T=C;T<w;T++)_=l[T],b[_]=i?g(c[T],a[_][v]):g(a[_][v],c[T]),x[_]=S;for(_=0;_<p;_++)x[_]===S?y[_][v]=b[_]:y[_][v]=a[_][v]}return e.createDenseMatrix({data:y,size:[p,m],datatype:s===e._datatype&&f===n._datatype?h:void 0})}}),SF=Z(`matAlgo04xSidSid`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new $A(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));var x=a&&u?[]:void 0,S=[],C=[],w=a&&u?[]:void 0,T=a&&u?[]:void 0,E=[],D=[],O,k,A,j,M;for(k=0;k<g;k++){C[k]=S.length;var N=k+1;for(j=s[k],M=s[k+1],A=j;A<M;A++)O=o[A],S.push(O),E[O]=N,w&&(w[O]=a[A]);for(j=f[k],M=f[k+1],A=j;A<M;A++)if(O=d[A],E[O]===N){if(w){var P=b(w[O],u[A]);v(P,y)?E[O]=null:w[O]=P}}else S.push(O),D[O]=N,T&&(T[O]=u[A]);if(w&&T)for(A=C[k];A<S.length;)O=S[A],E[O]===N?(x[A]=w[O],A++):D[O]===N?(x[A]=T[O],A++):S.splice(A,1)}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),CF=Z(`matAlgo10xSids`,[`typed`,`DenseMatrix`],e=>{var{typed:t,DenseMatrix:n}=e;return function(e,r,i,a){var o=e._values,s=e._index,c=e._ptr,l=e._size,u=e._datatype;if(!o)throw Error(`Cannot perform operation on Pattern Sparse Matrix and Scalar value`);var d=l[0],f=l[1],p,m=i;typeof u==`string`&&(p=u,r=t.convert(r,p),m=t.find(i,[p,p]));for(var h=[],g=[],_=[],v=0;v<f;v++){for(var y=v+1,b=c[v],x=c[v+1],S=b;S<x;S++){var C=s[S];g[C]=o[S],_[C]=y}for(var w=0;w<d;w++)v===0&&(h[w]=[]),_[w]===y?h[w][v]=a?m(r,g[w]):m(g[w],r):h[w][v]=r}return new n({data:h,size:[d,f],datatype:p})}});function wF(e,t,n,r){if(!(this instanceof wF))throw SyntaxError(`Constructor must be called with the new operator`);this.fn=e,this.count=t,this.min=n,this.max=r,this.message=`Wrong number of arguments in function `+e+` (`+t+` provided, `+n+(r==null?``:`-`+r)+` expected)`,this.stack=Error().stack}wF.prototype=Error(),wF.prototype.constructor=Error,wF.prototype.name=`ArgumentsError`,wF.prototype.isArgumentsError=!0;var TF=`gcd`,EF=[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`BigNumber`,`DenseMatrix`,`concat`],DF=`number | BigNumber | Fraction | Matrix | Array`,OF=`${DF}, ${DF}, ...${DF}`;function kF(e){return!e.some(e=>Array.isArray(e))}var AF=Z(TF,EF,e=>{var{typed:t,matrix:n,config:r,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:c,concat:l}=e,u=bF({typed:t,config:r,round:i,matrix:n,equalScalar:a,zeros:o,DenseMatrix:c,concat:l}),d=xF({typed:t}),f=SF({typed:t,equalScalar:a}),p=CF({typed:t,DenseMatrix:c}),m=vF({typed:t,matrix:n,concat:l});return t(TF,{"number, number":h,"BigNumber, BigNumber":g,"Fraction, Fraction":(e,t)=>e.gcd(t)},m({SS:f,DS:d,Ss:p}),{[OF]:t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i}),Array:t.referToSelf(e=>t=>{if(t.length===1&&Array.isArray(t[0])&&kF(t[0]))return e(...t[0]);if(kF(t))return e(...t);throw new wF(`gcd() supports only 1d matrices!`)}),Matrix:t.referToSelf(e=>t=>e(t.toArray()))});function h(e,t){if(!PD(e)||!PD(t))throw Error(`Parameters in function gcd must be integer numbers`);for(var n;t!==0;)n=u(e,t),e=t,t=n;return e<0?-e:e}function g(e,t){if(!e.isInt()||!t.isInt())throw Error(`Parameters in function gcd must be integer numbers`);for(var n=new s(0);!t.isZero();){var r=u(e,t);e=t,t=r}return e.lt(n)?e.neg():e}}),jF=Z(`matAlgo06xS0S0`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._size,s=e._datatype||e._data===void 0?e._datatype:e.getDataType(),c=r._values,l=r._size,u=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(o.length!==l.length)throw new $A(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+l+`)`);var d=o[0],f=o[1],p,m=n,h=0,g=i;typeof s==`string`&&s===u&&s!==`mixed`&&(p=s,m=t.find(n,[p,p]),h=t.convert(0,p),g=t.find(i,[p,p]));for(var _=a&&c?[]:void 0,v=[],y=[],b=_?[]:void 0,x=[],S=[],C=0;C<f;C++){y[C]=v.length;var w=C+1;if(Zj(e,C,x,b,S,w,v,g),Zj(r,C,x,b,S,w,v,g),b)for(var T=y[C];T<v.length;){var E=v[T];if(S[E]===w){var D=b[E];m(D,h)?v.splice(T,1):(_.push(D),T++)}else v.splice(T,1)}else for(var O=y[C];O<v.length;)S[v[O]]===w?O++:v.splice(O,1)}return y[f]=v.length,e.createSparseMatrix({values:_,index:v,ptr:y,size:[d,f],datatype:s===e._datatype&&u===r._datatype?p:void 0})}}),MF=`lcm`,NF=Z(MF,[`typed`,`matrix`,`equalScalar`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,concat:i}=e,a=fF({typed:t,equalScalar:r}),o=jF({typed:t,equalScalar:r}),s=UP({typed:t,equalScalar:r}),c=vF({typed:t,matrix:n,concat:i}),l=`number | BigNumber | Fraction | Matrix | Array`,u={};return u[`${l}, ${l}, ...${l}`]=t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i}),t(MF,{"number, number":mM,"BigNumber, BigNumber":d,"Fraction, Fraction":(e,t)=>e.lcm(t)},c({SS:o,DS:a,Ss:s}),u);function d(e,t){if(!e.isInt()||!t.isInt())throw Error(`Parameters in function lcm must be integer numbers`);if(e.isZero())return e;if(t.isZero())return t;for(var n=e.times(t);!t.isZero();){var r=t;t=e.mod(r),e=r}return n.div(e).abs()}});function PF(e,t,n,r){return function(i){if(i>0||n.predictable){if(i<=0)return NaN;var a=i.toString(16),o=a.substring(0,15);return e*(a.length-o.length)+t(Number(`0x`+o))}return r(i.toNumber())}}var FF=`log10`,IF=[`typed`,`config`,`Complex`],LF=gM(16),RF=Z(FF,IF,e=>{var{typed:t,config:n,Complex:r}=e;function i(e){return e.log().div(Math.LN10)}function a(e){return i(new r(e,0))}return t(FF,{number:function(e){return e>=0||n.predictable?gM(e):a(e)},bigint:PF(LF,gM,n,a),Complex:i,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log():a(e.toNumber())},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),zF=`log2`,BF=Z(zF,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;function i(e){return a(new r(e,0))}return t(zF,{number:function(e){return e>=0||n.predictable?_M(e):i(e)},bigint:PF(4,_M,n,i),Complex:a,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log(2):i(e.toNumber())},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))});function a(e){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new r(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}}),VF=Z(`multiplyScalar`,[`typed`],e=>{var{typed:t}=e;return t(`multiplyScalar`,{"number, number":aM,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"bigint, bigint":function(e,t){return e*t},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})}),HF=`multiply`,UF=Z(HF,[`typed`,`matrix`,`addScalar`,`multiplyScalar`,`equalScalar`,`dot`],e=>{var{typed:t,matrix:n,addScalar:r,multiplyScalar:i,equalScalar:a,dot:o}=e,s=UP({typed:t,equalScalar:a}),c=GP({typed:t});function l(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Vectors must have the same length`);break;case 2:if(e[0]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Vector length (`+e[0]+`) must match Matrix rows (`+t[0]+`)`);break;default:throw Error(`Can only multiply a 1 or 2 dimensional matrix (Matrix B has `+t.length+` dimensions)`)}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Matrix columns (`+e[1]+`) must match Vector length (`+t[0]+`)`);break;case 2:if(e[1]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Matrix A columns (`+e[1]+`) must match Matrix B rows (`+t[0]+`)`);break;default:throw Error(`Can only multiply a 1 or 2 dimensional matrix (Matrix B has `+t.length+` dimensions)`)}break;default:throw Error(`Can only multiply a 1 or 2 dimensional matrix (Matrix A has `+e.length+` dimensions)`)}}function u(e,t,n){if(n===0)throw Error(`Cannot multiply two empty vectors`);return o(e,t)}function d(e,t){if(t.storage()!==`dense`)throw Error(`Support for SparseMatrix not implemented`);return f(e,t)}function f(e,n){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._data,l=n._size,u=n._datatype||n.getDataType(),d=o[0],f=l[1],p,m=r,h=i;s&&u&&s===u&&typeof s==`string`&&s!==`mixed`&&(p=s,m=t.find(r,[p,p]),h=t.find(i,[p,p]));for(var g=[],_=0;_<f;_++){for(var v=h(a[0],c[0][_]),y=1;y<d;y++)v=m(v,h(a[y],c[y][_]));g[_]=v}return e.createDenseMatrix({data:g,size:[f],datatype:s===e._datatype&&u===n._datatype?p:void 0})}var p=t(`_multiplyMatrixVector`,{"DenseMatrix, any":h,"SparseMatrix, any":v}),m=t(`_multiplyMatrixMatrix`,{"DenseMatrix, DenseMatrix":g,"DenseMatrix, SparseMatrix":_,"SparseMatrix, DenseMatrix":y,"SparseMatrix, SparseMatrix":b});function h(e,n){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._data,l=n._datatype||n.getDataType(),u=o[0],d=o[1],f,p=r,m=i;s&&l&&s===l&&typeof s==`string`&&s!==`mixed`&&(f=s,p=t.find(r,[f,f]),m=t.find(i,[f,f]));for(var h=[],g=0;g<u;g++){for(var _=a[g],v=m(_[0],c[0]),y=1;y<d;y++)v=p(v,m(_[y],c[y]));h[g]=v}return e.createDenseMatrix({data:h,size:[u],datatype:s===e._datatype&&l===n._datatype?f:void 0})}function g(e,n){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._data,l=n._size,u=n._datatype||n.getDataType(),d=o[0],f=o[1],p=l[1],m,h=r,g=i;s&&u&&s===u&&typeof s==`string`&&s!==`mixed`&&s!==`mixed`&&(m=s,h=t.find(r,[m,m]),g=t.find(i,[m,m]));for(var _=[],v=0;v<d;v++){var y=a[v];_[v]=[];for(var b=0;b<p;b++){for(var x=g(y[0],c[0][b]),S=1;S<f;S++)x=h(x,g(y[S],c[S][b]));_[v][b]=x}}return e.createDenseMatrix({data:_,size:[d,p],datatype:s===e._datatype&&u===n._datatype?m:void 0})}function _(e,n){var o=e._data,s=e._size,c=e._datatype||e.getDataType(),l=n._values,u=n._index,d=n._ptr,f=n._size,p=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(!l)throw Error(`Cannot multiply Dense Matrix times Pattern only Matrix`);var m=s[0],h=f[1],g,_=r,v=i,y=a,b=0;c&&p&&c===p&&typeof c==`string`&&c!==`mixed`&&(g=c,_=t.find(r,[g,g]),v=t.find(i,[g,g]),y=t.find(a,[g,g]),b=t.convert(0,g));for(var x=[],S=[],C=[],w=n.createSparseMatrix({values:x,index:S,ptr:C,size:[m,h],datatype:c===e._datatype&&p===n._datatype?g:void 0}),T=0;T<h;T++){C[T]=S.length;var E=d[T],D=d[T+1];if(D>E)for(var O=0,k=0;k<m;k++){for(var A=k+1,j=void 0,M=E;M<D;M++){var N=u[M];O===A?j=_(j,v(o[k][N],l[M])):(j=v(o[k][N],l[M]),O=A)}O===A&&!y(j,b)&&(S.push(k),x.push(j))}}return C[h]=S.length,w}function v(e,n){var o=e._values,s=e._index,c=e._ptr,l=e._datatype||e._data===void 0?e._datatype:e.getDataType();if(!o)throw Error(`Cannot multiply Pattern only Matrix times Dense Matrix`);var u=n._data,d=n._datatype||n.getDataType(),f=e._size[0],p=n._size[0],m=[],h=[],g=[],_,v=r,y=i,b=a,x=0;l&&d&&l===d&&typeof l==`string`&&l!==`mixed`&&(_=l,v=t.find(r,[_,_]),y=t.find(i,[_,_]),b=t.find(a,[_,_]),x=t.convert(0,_));var S=[],C=[];g[0]=0;for(var w=0;w<p;w++){var T=u[w];if(!b(T,x))for(var E=c[w],D=c[w+1],O=E;O<D;O++){var k=s[O];C[k]?S[k]=v(S[k],y(T,o[O])):(C[k]=!0,h.push(k),S[k]=y(T,o[O]))}}for(var A=h.length,j=0;j<A;j++)m[j]=S[h[j]];return g[1]=h.length,e.createSparseMatrix({values:m,index:h,ptr:g,size:[f,1],datatype:l===e._datatype&&d===n._datatype?_:void 0})}function y(e,n){var o=e._values,s=e._index,c=e._ptr,l=e._datatype||e._data===void 0?e._datatype:e.getDataType();if(!o)throw Error(`Cannot multiply Pattern only Matrix times Dense Matrix`);var u=n._data,d=n._datatype||n.getDataType(),f=e._size[0],p=n._size[0],m=n._size[1],h,g=r,_=i,v=a,y=0;l&&d&&l===d&&typeof l==`string`&&l!==`mixed`&&(h=l,g=t.find(r,[h,h]),_=t.find(i,[h,h]),v=t.find(a,[h,h]),y=t.convert(0,h));for(var b=[],x=[],S=[],C=e.createSparseMatrix({values:b,index:x,ptr:S,size:[f,m],datatype:l===e._datatype&&d===n._datatype?h:void 0}),w=[],T=[],E=0;E<m;E++){S[E]=x.length;for(var D=E+1,O=0;O<p;O++){var k=u[O][E];if(!v(k,y))for(var A=c[O],j=c[O+1],M=A;M<j;M++){var N=s[M];T[N]===D?w[N]=g(w[N],_(k,o[M])):(T[N]=D,x.push(N),w[N]=_(k,o[M]))}}for(var P=S[E],F=x.length,I=P;I<F;I++)b[I]=w[x[I]]}return S[m]=x.length,C}function b(e,n){var a=e._values,o=e._index,s=e._ptr,c=e._datatype||e._data===void 0?e._datatype:e.getDataType(),l=n._values,u=n._index,d=n._ptr,f=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=e._size[0],m=n._size[1],h=a&&l,g,_=r,v=i;c&&f&&c===f&&typeof c==`string`&&c!==`mixed`&&(g=c,_=t.find(r,[g,g]),v=t.find(i,[g,g]));for(var y=h?[]:void 0,b=[],x=[],S=e.createSparseMatrix({values:y,index:b,ptr:x,size:[p,m],datatype:c===e._datatype&&f===n._datatype?g:void 0}),C=h?[]:void 0,w=[],T,E,D,O,k,A,j,M,N=0;N<m;N++){x[N]=b.length;var P=N+1;for(k=d[N],A=d[N+1],O=k;O<A;O++)if(M=u[O],h)for(E=s[M],D=s[M+1],T=E;T<D;T++)j=o[T],w[j]===P?C[j]=_(C[j],v(l[O],a[T])):(w[j]=P,b.push(j),C[j]=v(l[O],a[T]));else for(E=s[M],D=s[M+1],T=E;T<D;T++)j=o[T],w[j]!==P&&(w[j]=P,b.push(j));if(h)for(var F=x[N],I=b.length,L=F;L<I;L++)y[L]=C[b[L]]}return x[m]=b.length,S}return t(HF,i,{"Array, Array":t.referTo(`Matrix, Matrix`,e=>(t,r)=>{l(tj(t),tj(r));var i=e(n(t),n(r));return jE(i)?i.valueOf():i}),"Matrix, Matrix":function(e,t){var n=e.size(),r=t.size();return l(n,r),n.length===1?r.length===1?u(e,t,n[0]):d(e,t):r.length===1?p(e,t):m(e,t)},"Matrix, Array":t.referTo(`Matrix,Matrix`,e=>(t,r)=>e(t,n(r))),"Array, Matrix":t.referToSelf(e=>(t,r)=>e(n(t,r.storage()),r)),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return c(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return c(t,e,i,!0)},"Array, any":function(e,t){return c(n(e),t,i,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i})})}),WF=`nthRoot`,GF=Z(WF,[`typed`,`matrix`,`equalScalar`,`BigNumber`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,BigNumber:i,concat:a}=e,o=xF({typed:t}),s=fF({typed:t,equalScalar:r}),c=jF({typed:t,equalScalar:r}),l=UP({typed:t,equalScalar:r}),u=vF({typed:t,matrix:n,concat:a});function d(){throw Error(`Complex number not supported in function nthRoot. Use nthRoots instead.`)}return t(WF,{number:bM,"number, number":bM,BigNumber:e=>f(e,new i(2)),"BigNumber, BigNumber":f,Complex:d,"Complex, number":d,Array:t.referTo(`DenseMatrix,number`,e=>t=>e(n(t),2).valueOf()),DenseMatrix:t.referTo(`DenseMatrix,number`,e=>t=>e(t,2)),SparseMatrix:t.referTo(`SparseMatrix,number`,e=>t=>e(t,2)),"SparseMatrix, SparseMatrix":t.referToSelf(e=>(t,n)=>{if(n.density()===1)return c(t,n,e);throw Error(`Root must be non-zero`)}),"DenseMatrix, SparseMatrix":t.referToSelf(e=>(t,n)=>{if(n.density()===1)return o(t,n,e,!1);throw Error(`Root must be non-zero`)}),"Array, SparseMatrix":t.referTo(`DenseMatrix,SparseMatrix`,e=>(t,r)=>e(n(t),r)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>{if(n.density()===1)return l(n,t,e,!0);throw Error(`Root must be non-zero`)})},u({scalar:`number | BigNumber`,SD:s,Ss:l,sS:!1}));function f(e,t){var n=i.precision,r=i.clone({precision:n+2}),a=new i(0),o=new r(1),s=t.isNegative();if(s&&(t=t.neg()),t.isZero())throw Error(`Root must be non-zero`);if(e.isNegative()&&!t.abs().mod(2).equals(1))throw Error(`Root must be odd when a is negative.`);if(e.isZero())return s?new r(1/0):0;if(!e.isFinite())return s?a:e;var c=e.abs().pow(o.div(t));return c=e.isNeg()?c.neg():c,new i((s?o.div(c):c).toPrecision(n))}}),KF=`sign`,qF=Z(KF,[`typed`,`BigNumber`,`Fraction`,`complex`],e=>{var{typed:t,BigNumber:n,complex:r,Fraction:i}=e;return t(KF,{number:xM,Complex:function(e){return e.im===0?r(xM(e.re)):e.sign()},BigNumber:function(e){return new n(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return e.n===0n?new i(0):new i(e.s)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0)),Unit:t.referToSelf(e=>n=>{if(!n._isDerived()&&n.units[0].unit.offset!==0)throw TypeError(`sign is ambiguous for units with offset`);return t.find(e,n.valueType())(n.value)})})}),JF=Z(`sqrt`,[`config`,`typed`,`Complex`],e=>{var{config:t,typed:n,Complex:r}=e;return n(`sqrt`,{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new r(e,0).sqrt()}}),YF=`square`,XF=Z(YF,[`typed`],e=>{var{typed:t}=e;return t(YF,{number:CM,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},bigint:function(e){return e*e},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})}),ZF=`subtract`,QF=Z(ZF,[`typed`,`matrix`,`equalScalar`,`subtractScalar`,`unaryMinus`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,c=xF({typed:t}),l=pF({typed:t}),u=mF({typed:t,equalScalar:r}),d=CF({typed:t,DenseMatrix:o}),f=WP({typed:t,DenseMatrix:o}),p=vF({typed:t,matrix:n,concat:s});return t(ZF,{"any, any":i},p({elop:i,SS:u,DS:c,SD:l,Ss:f,sS:d}))}),$F=`xgcd`,eI=Z($F,[`typed`,`config`,`matrix`,`BigNumber`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i}=e;return t($F,{"number, number":function(e,t){var i=wM(e,t);return n.matrix===`Array`?i:r(i)},"BigNumber, BigNumber":a});function a(e,t){var a,o,s,c=new i(0),l=new i(1),u=c,d=l,f=l,p=c;if(!e.isInt()||!t.isInt())throw Error(`Parameters in function xgcd must be integer numbers`);for(;!t.isZero();)o=e.div(t).floor(),s=e.mod(t),a=u,u=d.minus(o.times(u)),d=a,a=f,f=p.minus(o.times(f)),p=a,e=t,t=s;var m=e.lt(c)?[e.neg(),d.neg(),p.neg()]:[e,e.isZero()?0:d,p];return n.matrix===`Array`?m:r(m)}}),tI=`invmod`,nI=Z(tI,[`typed`,`config`,`BigNumber`,`xgcd`,`equal`,`smaller`,`mod`,`add`,`isInteger`],e=>{var{typed:t,config:n,BigNumber:r,xgcd:i,equal:a,smaller:o,mod:s,add:c,isInteger:l}=e;return t(tI,{"number, number":u,"BigNumber, BigNumber":u});function u(e,t){if(!l(e)||!l(t))throw Error(`Parameters in function invmod must be integer numbers`);if(e=s(e,t),a(t,0))throw Error(`Divisor must be non zero`);var n=i(e,t);n=n.valueOf();var[u,d]=n;return a(u,r(1))?(d=s(d,t),o(d,r(0))&&(d=c(d,t)),d):NaN}}),rI=Z(`matAlgo09xS0Sf`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new $A(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));var x=a&&u?[]:void 0,S=[],C=[],w=x?[]:void 0,T=[],E,D,O,k,A;for(D=0;D<g;D++){C[D]=S.length;var j=D+1;if(w)for(k=f[D],A=f[D+1],O=k;O<A;O++)E=d[O],T[E]=j,w[E]=u[O];for(k=s[D],A=s[D+1],O=k;O<A;O++)if(E=o[O],w){var M=T[E]===j?w[E]:y,N=b(a[O],M);v(N,y)||(S.push(E),x.push(N))}else S.push(E)}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),iI=`dotMultiply`,aI=Z(iI,[`typed`,`matrix`,`equalScalar`,`multiplyScalar`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,multiplyScalar:i,concat:a}=e,o=fF({typed:t,equalScalar:r}),s=rI({typed:t,equalScalar:r}),c=UP({typed:t,equalScalar:r});return t(iI,vF({typed:t,matrix:n,concat:a})({elop:i,SS:s,DS:o,Ss:c}))});function oI(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function bitAnd`);var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new n(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new n(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new n(0):e}return lI(e,t,function(e,t){return e&t})}function sI(e){if(e.isFinite()&&!e.isInteger())throw Error(`Integer expected in function bitNot`);var t=e.constructor,n=t.precision;t.config({precision:1e9});var r=e.plus(new t(1));return r.s=-r.s||null,t.config({precision:n}),r}function cI(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function bitOr`);var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);var r=new n(-1);return e.isZero()||t.eq(r)||e.eq(t)?t:t.isZero()||e.eq(r)?e:!e.isFinite()||!t.isFinite()?!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?r:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e:lI(e,t,function(e,t){return e|t})}function lI(e,t,n){var r=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=uI(sI(e));for(var c=0;c<i.length;++c)i[c]^=1}else i=uI(e);if(s){a=uI(sI(t));for(var l=0;l<a.length;++l)a[l]^=1}else a=uI(t);var u,d,f;i.length<=a.length?(u=i,d=a,f=o):(u=a,d=i,f=s);var p=u.length,m=d.length,h=n(o,s)^1,g=new r(h^1),_=new r(1),v=new r(2),y=r.precision;for(r.config({precision:1e9});p>0;)n(u[--p],d[--m])===h&&(g=g.plus(_)),_=_.times(v);for(;m>0;)n(f,d[--m])===h&&(g=g.plus(_)),_=_.times(v);return r.config({precision:y}),h===0&&(g.s=-g.s),g}function uI(e){for(var t=e.d,n=t[0]+``,r=1;r<t.length;++r){for(var i=t[r]+``,a=7-i.length;a--;)i=`0`+i;n+=i}for(var o=n.length;n.charAt(o)===`0`;)o--;var s=e.e,c=n.slice(0,o+1||1),l=c.length;if(s>0)if(++s>l)for(s-=l;s--;)c+=`0`;else s<l&&(c=c.slice(0,s)+`.`+c.slice(s));for(var u=[0],d=0;d<c.length;){for(var f=u.length;f--;)u[f]*=10;u[0]+=parseInt(c.charAt(d++));for(var p=0;p<u.length;++p)u[p]>1&&((u[p+1]===null||u[p+1]===void 0)&&(u[p+1]=0),u[p+1]+=u[p]>>1,u[p]&=1)}return u.reverse()}function dI(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function bitXor`);var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new n(0);var r=new n(-1);return e.eq(r)?sI(t):t.eq(r)?sI(e):!e.isFinite()||!t.isFinite()?!e.isFinite()&&!t.isFinite()?r:new n(e.isNegative()===t.isNegative()?1/0:-1/0):lI(e,t,function(e,t){return e^t})}function fI(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function leftShift`);var n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:!e.isFinite()&&!t.isFinite()?new n(NaN):t.lt(55)?e.times(2**t.toNumber()+``):e.times(new n(2).pow(t))}function pI(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function rightArithShift`);var n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(2**t.toNumber()+``).floor():e.div(new n(2).pow(t)).floor():e.isNegative()?new n(-1):e.isFinite()?new n(0):new n(NaN)}var mI=`bitAnd`,hI=Z(mI,[`typed`,`matrix`,`equalScalar`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,concat:i}=e,a=fF({typed:t,equalScalar:r}),o=jF({typed:t,equalScalar:r}),s=UP({typed:t,equalScalar:r}),c=vF({typed:t,matrix:n,concat:i});return t(mI,{"number, number":AM,"BigNumber, BigNumber":oI,"bigint, bigint":(e,t)=>e&t},c({SS:o,DS:a,Ss:s}))}),gI=`bitNot`,_I=Z(gI,[`typed`],e=>{var{typed:t}=e;return t(gI,{number:jM,BigNumber:sI,bigint:e=>~e,"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),vI=`bitOr`,yI=Z(vI,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=xF({typed:t}),s=SF({typed:t,equalScalar:r}),c=CF({typed:t,DenseMatrix:i}),l=vF({typed:t,matrix:n,concat:a});return t(vI,{"number, number":MM,"BigNumber, BigNumber":cI,"bigint, bigint":(e,t)=>e|t},l({SS:s,DS:o,Ss:c}))}),bI=Z(`matAlgo07xSSf`,[`typed`,`SparseMatrix`],e=>{var{typed:t,SparseMatrix:n}=e;return function(e,i,a){var o=e._size,s=e._datatype||e._data===void 0?e._datatype:e.getDataType(),c=i._size,l=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(o.length!==c.length)throw new $A(o.length,c.length);if(o[0]!==c[0]||o[1]!==c[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+c+`)`);var u=o[0],d=o[1],f,p=0,m=a;typeof s==`string`&&s===l&&s!==`mixed`&&(f=s,p=t.convert(0,f),m=t.find(a,[f,f]));for(var h=[],g=[],_=Array(d+1).fill(0),v=[],y=[],b=[],x=[],S=0;S<d;S++){var C=S+1,w=0;r(e,S,b,v,C),r(i,S,x,y,C);for(var T=0;T<u;T++){var E=b[T]===C?v[T]:p,D=x[T]===C?y[T]:p,O=m(E,D);O!==0&&O!==!1&&(g.push(T),h.push(O),w++)}_[S+1]=_[S]+w}return new n({values:h,index:g,ptr:_,size:[u,d],datatype:s===e._datatype&&l===i._datatype?f:void 0})};function r(e,t,n,r,i){for(var a=e._values,o=e._index,s=e._ptr,c=s[t],l=s[t+1];c<l;c++){var u=o[c];n[u]=i,r[u]=a[c]}}}),xI=`bitXor`,SI=Z(xI,[`typed`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:a}=e,o=pF({typed:t}),s=bI({typed:t,SparseMatrix:a}),c=WP({typed:t,DenseMatrix:r}),l=vF({typed:t,matrix:n,concat:i});return t(xI,{"number, number":NM,"BigNumber, BigNumber":dI,"bigint, bigint":(e,t)=>e^t},l({SS:s,DS:o,Ss:c}))}),CI=`arg`,wI=Z(CI,[`typed`],e=>{var{typed:t}=e;return t(CI,{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),TI=`conj`,EI=Z(TI,[`typed`],e=>{var{typed:t}=e;return t(TI,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),Unit:t.referToSelf(e=>t=>new t.constructor(e(t.toNumeric()),t.formatUnits())),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),DI=`im`,OI=Z(DI,[`typed`],e=>{var{typed:t}=e;return t(DI,{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),kI=`re`,AI=Z(kI,[`typed`],e=>{var{typed:t}=e;return t(kI,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),jI=`not`,MI=Z(jI,[`typed`],e=>{var{typed:t}=e;return t(jI,{"null | undefined":()=>!0,number:GM,Complex:function(e){return e.re===0&&e.im===0},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),NI=`nullish`,PI=Z(NI,[`typed`,`matrix`,`size`,`flatten`,`deepEqual`],e=>{var{typed:t,matrix:n,size:r,flatten:i,deepEqual:a}=e,o=pF({typed:t}),s=GP({typed:t}),c=hF({typed:t});return t(NI,{"number|bigint|Complex|BigNumber|Fraction|Unit|string|boolean|SparseMatrix, any":(e,t)=>e,"null, any":(e,t)=>t,"undefined, any":(e,t)=>t,"SparseMatrix, Array | Matrix":(e,t)=>{var n=r(e),i=r(t);if(a(n,i))return e;throw new $A(n,i)},"DenseMatrix, DenseMatrix":t.referToSelf(e=>(t,n)=>c(t,n,e)),"DenseMatrix, SparseMatrix":t.referToSelf(e=>(t,n)=>o(t,n,e,!1)),"DenseMatrix, Array":t.referToSelf(e=>(t,r)=>c(t,n(r),e)),"DenseMatrix, any":t.referToSelf(e=>(t,n)=>s(t,n,e,!1)),"Array, Array":t.referToSelf(e=>(t,r)=>c(n(t),n(r),e).valueOf()),"Array, DenseMatrix":t.referToSelf(e=>(t,r)=>c(n(t),r,e)),"Array, SparseMatrix":t.referToSelf(e=>(t,r)=>o(n(t),r,e,!1)),"Array, any":t.referToSelf(e=>(t,r)=>s(n(t),r,e,!1).valueOf())})}),FI=`or`,II=Z(FI,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=pF({typed:t}),s=mF({typed:t,equalScalar:r}),c=WP({typed:t,DenseMatrix:i}),l=vF({typed:t,matrix:n,concat:a});return t(FI,{"number, number":KM,"Complex, Complex":function(e,t){return e.re!==0||e.im!==0||t.re!==0||t.im!==0},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"bigint, bigint":KM,"Unit, Unit":t.referToSelf(e=>(t,n)=>e(t.value||0,n.value||0))},l({SS:s,DS:o,Ss:c}))}),LI=`xor`,RI=Z(LI,[`typed`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:a}=e,o=pF({typed:t}),s=bI({typed:t,SparseMatrix:a}),c=WP({typed:t,DenseMatrix:r}),l=vF({typed:t,matrix:n,concat:i});return t(LI,{"number, number":qM,"Complex, Complex":function(e,t){return(e.re!==0||e.im!==0)!=(t.re!==0||t.im!==0)},"bigint, bigint":qM,"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf(e=>(t,n)=>e(t.value||0,n.value||0))},l({SS:s,DS:o,Ss:c}))}),zI=`concat`,BI=Z(zI,[`typed`,`matrix`,`isInteger`],e=>{var{typed:t,matrix:n,isInteger:r}=e;return t(zI,{"...Array | Matrix | number | BigNumber":function(e){var t,i=e.length,a=-1,o,s=!1,c=[];for(t=0;t<i;t++){var l=e[t];if(jE(l)&&(s=!0),CE(l)||wE(l)){if(t!==i-1)throw Error(`Dimension must be specified as last argument`);if(o=a,a=l.valueOf(),!r(a))throw TypeError(`Integer number expected for dimension`);if(a<0||t>0&&a>o)throw new ej(a,o+1)}else{var u=mD(l).valueOf(),d=tj(u);if(c[t]=u,o=a,a=d.length-1,t>0&&a!==o)throw new $A(o+1,a+1)}}if(c.length===0)throw SyntaxError(`At least one matrix expected`);for(var f=c.shift();c.length;)f=Dj(f,c.shift(),a);return s?n(f):f},"...string":function(e){return e.join(``)}})}),VI=`column`,HI=Z(VI,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e;return t(VI,{"Matrix, number":a,"Array, number":function(e,t){return a(r(mD(e)),t).valueOf()}});function a(e,t){if(e.size().length!==2)throw Error(`Only two dimensional matrix is supported`);aj(t,e.size()[1]);var a=new n(i(0,e.size()[0]),[t]),o=e.subset(a);return jE(o)?o:r([[o]])}}),UI=`count`,WI=Z(UI,[`typed`,`size`,`prod`],e=>{var{typed:t,size:n,prod:r}=e;return t(UI,{string:function(e){return e.length},"Matrix | Array":function(e){return r(n(e))}})}),GI=`cross`,KI=Z(GI,[`typed`,`matrix`,`subtract`,`multiply`],e=>{var{typed:t,matrix:n,subtract:r,multiply:i}=e;return t(GI,{"Matrix, Matrix":function(e,t){return n(a(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(a(e.toArray(),t))},"Array, Matrix":function(e,t){return n(a(e,t.toArray()))},"Array, Array":a});function a(e,t){var n=Math.max(tj(e).length,tj(t).length);e=pj(e),t=pj(t);var a=tj(e),o=tj(t);if(a.length!==1||o.length!==1||a[0]!==3||o[0]!==3)throw RangeError(`Vectors with length 3 expected (Size A = [`+a.join(`, `)+`], B = [`+o.join(`, `)+`])`);var s=[r(i(e[1],t[2]),i(e[2],t[1])),r(i(e[2],t[0]),i(e[0],t[2])),r(i(e[0],t[1]),i(e[1],t[0]))];return n>1?[s]:s}}),qI=`diag`,JI=Z(qI,[`typed`,`matrix`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(qI,{Array:function(e){return a(e,0,tj(e),null)},"Array, number":function(e,t){return a(e,t,tj(e),null)},"Array, BigNumber":function(e,t){return a(e,t.toNumber(),tj(e),null)},"Array, string":function(e,t){return a(e,0,tj(e),t)},"Array, number, string":function(e,t,n){return a(e,t,tj(e),n)},"Array, BigNumber, string":function(e,t,n){return a(e,t.toNumber(),tj(e),n)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return a(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return a(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return a(e,0,e.size(),t)},"Matrix, number, string":function(e,t,n){return a(e,t,e.size(),n)},"Matrix, BigNumber, string":function(e,t,n){return a(e,t.toNumber(),e.size(),n)}});function a(e,t,n,r){if(!PD(t))throw TypeError(`Second parameter in function diag must be an integer`);var i=t>0?t:0,a=t<0?-t:0;switch(n.length){case 1:return o(e,t,r,n[0],a,i);case 2:return s(e,t,r,n,a,i)}throw RangeError(`Matrix for function diag must be 2 dimensional`)}function o(e,t,n,a,o,s){var c=[a+o,a+s];if(n&&n!==`sparse`&&n!==`dense`)throw TypeError(`Unknown matrix type ${n}"`);var l=n===`sparse`?i.diagonal(c,e,t):r.diagonal(c,e,t);return n===null?l.valueOf():l}function s(e,t,r,i,a,o){if(jE(e)){var s=e.diagonal(t);return r===null?s.valueOf():r===s.storage()?s:n(s,r)}for(var c=Math.min(i[0]-a,i[1]-o),l=[],u=0;u<c;u++)l[u]=e[u+a][u+o];return r===null?l:n(l)}}),YI=Z(`filter`,[`typed`],e=>{var{typed:t}=e;return t(`filter`,{"Array, function":XI,"Matrix, function":function(e,t){return e.create(XI(e.valueOf(),t),e.datatype())},"Array, RegExp":xj,"Matrix, RegExp":function(e,t){return e.create(xj(e.valueOf(),t),e.datatype())}})});function XI(e,t){var n=Ij(t,e,`filter`);return n.isUnary?bj(e,n.fn):bj(e,function(e,t,r){return n.fn(e,[t],r)})}var ZI=`flatten`,QI=Z(ZI,[`typed`],e=>{var{typed:t}=e;return t(ZI,{Array:function(e){return _j(e)},DenseMatrix:function(e){return e.create(_j(e.valueOf(),!0),e.datatype())},SparseMatrix:function(e){throw TypeError(`SparseMatrix is not supported by function flatten because it does not support 1D vectors. Convert to a DenseMatrix or Array first. Example: flatten(x.toArray())`)}})}),$I=`forEach`,eL=Z($I,[`typed`],e=>{var{typed:t}=e;return t($I,{"Array, function":tL,"Matrix, function":function(e,t){e.forEach(t)}})});function tL(e,t){var n=Ij(t,e,$I);Pj(e,n.fn,n.isUnary)}var nL=`getMatrixDataType`,rL=Z(nL,[`typed`],e=>{var{typed:t}=e;return t(nL,{Array:function(e){return Tj(e,pD)},Matrix:function(e){return e.getDataType()}})}),iL=`identity`,aL=Z(iL,[`typed`,`config`,`matrix`,`BigNumber`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(iL,{"":function(){return n.matrix===`Matrix`?r([]):[]},string:function(e){return r(e)},"number | BigNumber":function(e){return c(e,e,n.matrix===`Matrix`?`dense`:void 0)},"number | BigNumber, string":function(e,t){return c(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return c(e,t,n.matrix===`Matrix`?`dense`:void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,n){return c(e,t,n)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?r(t):[];case 1:return c(e[0],e[0],t);case 2:return c(e[0],e[1],t);default:throw Error(`Vector containing two values expected`)}}function c(e,t,n){var r=wE(e)||wE(t)?i:null;if(wE(e)&&(e=e.toNumber()),wE(t)&&(t=t.toNumber()),!PD(e)||e<1||!PD(t)||t<1)throw Error(`Parameters in function identity must be positive integers`);var s=r?new i(1):1,c=r?new r(0):0,l=[e,t];if(n){if(n===`sparse`)return o.diagonal(l,s,0,c);if(n===`dense`)return a.diagonal(l,s,0,c);throw TypeError(`Unknown matrix type "${n}"`)}for(var u=sj([],l,c),d=e<t?e:t,f=0;f<d;f++)u[f][f]=s;return u}}),oL=`kron`,sL=Z(oL,[`typed`,`matrix`,`multiplyScalar`],e=>{var{typed:t,matrix:n,multiplyScalar:r}=e;return t(oL,{"Matrix, Matrix":function(e,t){return n(a(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(a(e.toArray(),t))},"Array, Matrix":function(e,t){return n(a(e,t.toArray()))},"Array, Array":a});function i(e,t){return e.flatMap(e=>t.map(t=>r(e,t)))}function a(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1;if(n<0){var r=tj(e).length,o=tj(t).length;for(n=Math.max(r,o);r++<n;)e=[e];for(;o++<n;)t=[t]}return n===1?i(e,t):e.flatMap(e=>t.map(t=>a(e,t,n-1)))}}),cL=`map`,lL=Z(cL,[`typed`],e=>{var{typed:t}=e;return t(cL,{"Array, function":s,"Matrix, function":function(e,t){return e.map(t)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,t,r)=>n([e,t,...r.slice(0,r.length-1)],r[r.length-1])});function n(e,n){if(typeof n!=`function`)throw Error(`Last argument must be a callback function`);var c=e[0].isMatrix,l=e.map(e=>e.isMatrix?e.size():tj(e)),u=Oj(...l),d=e.length,f=c?(e,t)=>e.get(t):Mj,p=e.map((e,t)=>{var n=l[t].map(()=>0);return e.isMatrix?e.get(n):Mj(e,n)}),m=t.isTypedFunction(n)?o(n,p,u.map(()=>0),e):a(n,d);if(m<2)return r(e,i(m,n,null));var h=c?e.map(t=>t.isMatrix?t.create(Aj(t.toArray(),u),t.datatype()):e[0].create(Aj(t.valueOf(),u))):e.map(e=>e.isMatrix?Aj(e.toArray(),u):Aj(e,u)),g=i(m,n,h),_=(e,t)=>g([e,...h.slice(1).map(e=>f(e,t))],t);return c?h[0].map(_):s(h[0],_)}function r(e,t){var n=e[0],r=e.map(e=>e.isMatrix?e.valueOf():e),i=e.map(e=>e.isMatrix?e.size():tj(e)),a=Oj(...i),o=i.map(e=>a.length-e.length),s=a.length-1,c=t.length>1?[]:null,l=d(r,0);if(n.isMatrix){var u=n.create();return u._data=l,u._size=a,u}else return l;function d(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=a[n],i=Array(r);if(n<s)for(var l=function(t){c&&(c[n]=t),i[t]=d(e.map((e,r)=>o[r]>n?e:e.length===1?e[0]:e[t]),n+1)},u=0;u<r;u++)l(u);else for(var f=function(r){c&&(c[n]=r),i[r]=t(e.map(e=>e.length===1?e[0]:e[r]),c?c.slice():void 0)},p=0;p<r;p++)f(p);return i}}function i(e,t,n){switch(e){case 0:return e=>t(...e);case 1:return(e,n)=>t(...e,n);case 2:return(e,r)=>t(...e,r,...n)}}function a(e,t){var n=e.toString();if(/arguments/.test(n))return 2;var r=n.match(/\(.*?\)/);return/\.\.\./.test(r)||e.length>t+1?2:+(e.length===t+1)}function o(e,n,r,i){return t.resolve(e,[...n,r,...i])===null?t.resolve(e,[...n,r])===null?(t.resolve(e,n),0):1:2}function s(e,t){var n=Ij(t,e,cL);return Nj(e,n.fn,n.isUnary)}}),uL=`diff`,dL=Z(uL,[`typed`,`matrix`,`subtract`,`number`],e=>{var{typed:t,matrix:n,subtract:r,number:i}=e;return t(uL,{"Array | Matrix":function(e){return jE(e)?n(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,t){if(!PD(t))throw RangeError(`Dimension must be a whole number`);return jE(e)?n(a(e.toArray(),t)):a(e,t)},"Array, BigNumber":t.referTo(`Array,number`,e=>(t,n)=>e(t,i(n))),"Matrix, BigNumber":t.referTo(`Matrix,number`,e=>(t,n)=>e(t,i(n)))});function a(e,t){if(jE(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError(`Array/Matrix does not have that many dimensions`);if(t>0){var n=[];return e.forEach(e=>{n.push(a(e,t-1))}),n}else if(t===0)return o(e);else throw RangeError(`Cannot have negative dimension`)}function o(e){for(var t=[],n=e.length,r=1;r<n;r++)t.push(s(e[r-1],e[r]));return t}function s(e,t){jE(e)&&(e=e.toArray()),jE(t)&&(t=t.toArray());var n=Array.isArray(e),i=Array.isArray(t);if(n&&i)return c(e,t);if(!n&&!i)return r(t,e);throw TypeError(`Cannot calculate difference between 1 array and 1 non-array`)}function c(e,t){if(e.length!==t.length)throw RangeError(`Not all sub-arrays have the same length`);for(var n=[],r=e.length,i=0;i<r;i++)n.push(s(e[i],t[i]));return n}}),fL=Z(`ones`,[`typed`,`config`,`matrix`,`BigNumber`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(`ones`,{"":function(){return n.matrix===`Array`?a([]):a([],`default`)},"...number | BigNumber | string":function(e){return typeof e[e.length-1]==`string`?a(e,e.pop()):n.matrix===`Array`?a(e):a(e,`default`)},Array:a,Matrix:function(e){var t=e.storage();return a(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return a(e.valueOf(),t)}});function a(e,t){var n=o(e)?new i(1):1;if(s(e),t){var a=r(t);return e.length>0?a.resize(e,n):a}else{var c=[];return e.length>0?sj(c,e,n):c}}function o(e){var t=!1;return e.forEach(function(e,n,r){wE(e)&&(t=!0,r[n]=e.toNumber())}),t}function s(e){e.forEach(function(e){if(typeof e!=`number`||!PD(e)||e<0)throw Error(`Parameters in function ones must be positive integers`)})}});function pL(){throw Error(`No "bignumber" implementation available`)}function mL(){throw Error(`No "fraction" implementation available`)}function hL(){throw Error(`No "matrix" implementation available`)}var gL=`range`,_L=Z(gL,[`typed`,`config`,`?matrix`,`?bignumber`,`equal`,`smaller`,`smallerEq`,`larger`,`largerEq`,`add`,`isZero`,`isPositive`],e=>{var{typed:t,config:n,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:c,add:l,isZero:u,isPositive:d}=e;return t(gL,{string:p,"string, boolean":p,number:function(e){throw TypeError(`Too few arguments to function range(): ${e}`)},boolean:function(e){throw TypeError(`Unexpected type of argument 1 to function range(): ${e}, number|bigint|BigNumber|Fraction`)},"number, number":function(e,t){return f(m(e,t,1,!1))},"number, number, number":function(e,t,n){return f(m(e,t,n,!1))},"number, number, boolean":function(e,t,n){return f(m(e,t,1,n))},"number, number, number, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"bigint, bigint|number":function(e,t){return f(m(e,t,1n,!1))},"number, bigint":function(e,t){return f(m(BigInt(e),t,1n,!1))},"bigint, bigint|number, bigint|number":function(e,t,n){return f(m(e,t,BigInt(n),!1))},"number, bigint, bigint|number":function(e,t,n){return f(m(BigInt(e),t,BigInt(n),!1))},"bigint, bigint|number, boolean":function(e,t,n){return f(m(e,t,1n,n))},"number, bigint, boolean":function(e,t,n){return f(m(BigInt(e),t,1n,n))},"bigint, bigint|number, bigint|number, boolean":function(e,t,n,r){return f(m(e,t,BigInt(n),r))},"number, bigint, bigint|number, boolean":function(e,t,n,r){return f(m(BigInt(e),t,BigInt(n),r))},"BigNumber, BigNumber":function(e,t){var n=e.constructor;return f(m(e,t,new n(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,n){return f(m(e,t,n,!1))},"BigNumber, BigNumber, boolean":function(e,t,n){var r=e.constructor;return f(m(e,t,new r(1),n))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Fraction, Fraction":function(e,t){return f(m(e,t,1,!1))},"Fraction, Fraction, Fraction":function(e,t,n){return f(m(e,t,n,!1))},"Fraction, Fraction, boolean":function(e,t,n){return f(m(e,t,1,n))},"Fraction, Fraction, Fraction, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Unit, Unit, Unit":function(e,t,n){return f(m(e,t,n,!1))},"Unit, Unit, Unit, boolean":function(e,t,n,r){return f(m(e,t,n,r))}});function f(e){return n.matrix===`Matrix`?r?r(e):hL():e}function p(e,t){var r=h(e);if(!r)throw SyntaxError(`String "`+e+`" is no valid range`);return n.number===`BigNumber`?(i===void 0&&pL(),f(m(i(r.start),i(r.end),i(r.step)),t)):f(m(r.start,r.end,r.step,t))}function m(e,t,n,r){var i=[];if(u(n))throw Error(`Step must be non-zero`);for(var f=d(n)?r?o:a:r?c:s,p=e;f(p,t);)i.push(p),p=l(p,n);return i}function h(e){var t=e.split(`:`).map(function(e){return Number(e)});if(t.some(function(e){return isNaN(e)}))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}}),vL=`reshape`,yL=Z(vL,[`typed`,`isInteger`,`matrix`],e=>{var{typed:t,isInteger:n}=e;return t(vL,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach(function(e){if(!n(e))throw TypeError(`Invalid size for dimension: `+e)}),lj(e,t)}})}),bL=Z(`resize`,[`config`,`matrix`],e=>{var{config:t,matrix:n}=e;return function(e,i,a){if(arguments.length!==2&&arguments.length!==3)throw new wF(`resize`,arguments.length,2,3);if(jE(i)&&(i=i.valueOf()),wE(i[0])&&(i=i.map(function(e){return wE(e)?e.toNumber():e})),jE(e))return e.resize(i,a,!0);if(typeof e==`string`)return r(e,i,a);var o=Array.isArray(e)?!1:t.matrix!==`Array`;if(i.length===0){for(;Array.isArray(e);)e=e[0];return mD(e)}else{Array.isArray(e)||(e=[e]),e=mD(e);var s=sj(e,i,a);return o?n(s):s}};function r(e,t,n){if(n!==void 0){if(typeof n!=`string`||n.length!==1)throw TypeError(`Single character expected as defaultValue`)}else n=` `;if(t.length!==1)throw new $A(t.length,1);var r=t[0];if(typeof r!=`number`||!PD(r))throw TypeError(`Invalid size, must contain positive integers (size: `+GA(t)+`)`);if(e.length>r)return e.substring(0,r);if(e.length<r){for(var i=e,a=0,o=r-e.length;a<o;a++)i+=n;return i}else return e}}),xL=`rotate`,SL=Z(xL,[`typed`,`multiply`,`rotationMatrix`],e=>{var{typed:t,multiply:n,rotationMatrix:r}=e;return t(xL,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,a){return i(e,3),n(r(t,a),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,a){return i(e,3),n(r(t,a),e)}});function i(e,t){var n=Array.isArray(e)?tj(e):e.size();if(n.length>2||n.length===2&&n[1]!==1||n[0]!==t)throw RangeError(`Vector must be of dimensions 1x${t}`)}}),CL=`rotationMatrix`,wL=Z(CL,[`typed`,`config`,`multiplyScalar`,`addScalar`,`unaryMinus`,`norm`,`matrix`,`BigNumber`,`DenseMatrix`,`SparseMatrix`,`cos`,`sin`],e=>{var{typed:t,config:n,multiplyScalar:r,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:c,DenseMatrix:l,SparseMatrix:u,cos:d,sin:f}=e;return t(CL,{"":function(){return n.matrix===`Matrix`?c([]):[]},string:function(e){return c(e)},"number | BigNumber | Complex | Unit":function(e){return p(e,n.matrix===`Matrix`?`dense`:void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return p(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){var n=c(t);return m(n),_(e,n,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){return m(t),_(e,t,t.storage()||(n.matrix===`Matrix`?`dense`:void 0))},"number | BigNumber | Complex | Unit, Array, string":function(e,t,n){var r=c(t);return m(r),_(e,r,n)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,n){return m(t),_(e,t,n)}});function p(e,t){var n=wE(e)?new s(-1):-1,i=d(e),a=f(e);return g([[i,r(n,a)],[a,i]],t)}function m(e){var t=e.size();if(t.length<1||t[0]!==3)throw RangeError(`Vector must be of dimensions 1x3`)}function h(e){return e.reduce((e,t)=>r(e,t))}function g(e,t){if(t){if(t===`sparse`)return new u(e);if(t===`dense`)return new l(e);throw TypeError(`Unknown matrix type "${t}"`)}return e}function _(e,t,n){var r=o(t);if(r===0)throw RangeError(`Rotation around zero vector`);var c=wE(e)?s:null,l=c?new c(1):1,u=c?new c(-1):-1,p=c?new c(t.get([0])/r):t.get([0])/r,m=c?new c(t.get([1])/r):t.get([1])/r,_=c?new c(t.get([2])/r):t.get([2])/r,v=d(e),y=i(l,a(v)),b=f(e),x=i(v,h([p,p,y])),S=i(h([p,m,y]),h([u,_,b])),C=i(h([p,_,y]),h([m,b])),w=i(h([p,m,y]),h([_,b])),T=i(v,h([m,m,y])),E=i(h([m,_,y]),h([u,p,b])),D=i(h([p,_,y]),h([u,m,b])),O=i(h([m,_,y]),h([p,b])),k=i(v,h([_,_,y]));return g([[x,S,C],[w,T,E],[D,O,k]],n)}}),TL=`row`,EL=Z(TL,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e;return t(TL,{"Matrix, number":a,"Array, number":function(e,t){return a(r(mD(e)),t).valueOf()}});function a(e,t){if(e.size().length!==2)throw Error(`Only two dimensional matrix is supported`);aj(t,e.size()[0]);var a=i(0,e.size()[1]),o=new n([t],a),s=e.subset(o);return jE(s)?s:r([[s]])}}),DL=`size`,OL=Z(DL,[`typed`],e=>{var{typed:t}=e;return t(DL,{Matrix:e=>e.size(),Array:tj,string:e=>[e.length],"number | Complex | BigNumber | Unit | boolean | null":e=>[]})}),kL=`squeeze`,AL=Z(kL,[`typed`],e=>{var{typed:t}=e;return t(kL,{Array:function(e){return pj(mD(e))},Matrix:function(e){var t=pj(e.toArray());return Array.isArray(t)?e.create(t,e.datatype()):t},any:function(e){return mD(e)}})}),jL=`subset`,ML=Z(jL,[`typed`,`matrix`,`zeros`,`add`],e=>{var{typed:t,matrix:n,zeros:r,add:i}=e;return t(jL,{"Matrix, Index":function(e,t){return oj(t)?n():(ij(e,t),e.subset(t))},"Array, Index":t.referTo(`Matrix, Index`,function(e){return function(t,r){var i=e(n(t),r);return r.isScalar()?i:i.valueOf()}}),"Object, Index":FL,"string, Index":NL,"Matrix, Index, any, any":function(e,t,n,r){return oj(t)?e:(ij(e,t),e.clone().subset(t,a(n,t),r))},"Array, Index, any, any":t.referTo(`Matrix, Index, any, any`,function(e){return function(t,r,i,a){var o=e(n(t),r,i,a);return o.isMatrix?o.valueOf():o}}),"Array, Index, any":t.referTo(`Matrix, Index, any, any`,function(e){return function(t,r,i){return e(n(t),r,i,void 0).valueOf()}}),"Matrix, Index, any":t.referTo(`Matrix, Index, any, any`,function(e){return function(t,n,r){return e(t,n,r,void 0)}}),"string, Index, string":PL,"string, Index, string, string":PL,"Object, Index, any":IL});function a(e,t){if(typeof e==`string`)throw Error(`can't boradcast a string`);if(t.isScalar())return e;var n=t.size();if(n.every(e=>e>0))try{return i(e,r(n))}catch{return e}else return e}});function NL(e,t){if(!IE(t))throw TypeError(`Index expected`);if(oj(t))return``;if(ij(Array.from(e),t),t.size().length!==1)throw new $A(t.size().length,1);var n=e.length;aj(t.min()[0],n),aj(t.max()[0],n);var r=t.dimension(0),i=``;function a(t){i+=e.charAt(t)}return Number.isInteger(r)?a(r):r.forEach(a),i}function PL(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Index expected`);if(oj(t))return e;if(ij(Array.from(e),t),t.size().length!==1)throw new $A(t.size().length,1);if(r!==void 0){if(typeof r!=`string`||r.length!==1)throw TypeError(`Single character expected as defaultValue`)}else r=` `;var i=t.dimension(0);if((Number.isInteger(i)?1:i.size()[0])!==n.length)throw new $A(i.size()[0],n.length);var a=e.length;aj(t.min()[0]),aj(t.max()[0]);for(var o=[],s=0;s<a;s++)o[s]=e.charAt(s);function c(e,t){o[e]=n.charAt(t[0])}if(Number.isInteger(i)?c(i,[0]):i.forEach(c),o.length>a)for(var l=a-1,u=o.length;l<u;l++)o[l]||(o[l]=r);return o.join(``)}function FL(e,t){if(!oj(t)){if(t.size().length!==1)throw new $A(t.size(),1);var n=t.dimension(0);if(typeof n!=`string`)throw TypeError(`String expected as index to retrieve an object property`);return cE(e,n)}}function IL(e,t,n){if(oj(t))return e;if(t.size().length!==1)throw new $A(t.size(),1);var r=t.dimension(0);if(typeof r!=`string`)throw TypeError(`String expected as index to retrieve an object property`);var i=mD(e);return lE(i,r,n),i}var LL=`transpose`,RL=Z(LL,[`typed`,`matrix`],e=>{var{typed:t,matrix:n}=e;return t(LL,{Array:e=>r(n(e)).valueOf(),Matrix:r,any:mD});function r(e){var t=e.size(),n;switch(t.length){case 1:n=e.clone();break;case 2:var r=t[0],o=t[1];if(o===0)throw RangeError(`Cannot transpose a 2D matrix with no columns (size: `+GA(t)+`)`);switch(e.storage()){case`dense`:n=i(e,r,o);break;case`sparse`:n=a(e,r,o);break}break;default:throw RangeError(`Matrix must be a vector or two dimensional (size: `+GA(t)+`)`)}return n}function i(e,t,n){for(var r=e._data,i=[],a,o=0;o<n;o++){a=i[o]=[];for(var s=0;s<t;s++)a[s]=mD(r[s][o])}return e.createDenseMatrix({data:i,size:[n,t],datatype:e._datatype})}function a(e,t,n){for(var r=e._values,i=e._index,a=e._ptr,o=r?[]:void 0,s=[],c=[],l=[],u=0;u<t;u++)l[u]=0;var d,f,p;for(d=0,f=i.length;d<f;d++)l[i[d]]++;for(var m=0,h=0;h<t;h++)c.push(m),m+=l[h],l[h]=c[h];for(c.push(m),p=0;p<n;p++)for(var g=a[p],_=a[p+1],v=g;v<_;v++){var y=l[i[v]]++;s[y]=p,r&&(o[y]=mD(r[v]))}return e.createSparseMatrix({values:o,index:s,ptr:c,size:[n,t],datatype:e._datatype})}}),zL=`ctranspose`,BL=Z(zL,[`typed`,`transpose`,`conj`],e=>{var{typed:t,transpose:n,conj:r}=e;return t(zL,{any:function(e){return r(n(e))}})}),VL=`zeros`,HL=Z(VL,[`typed`,`config`,`matrix`,`BigNumber`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(VL,{"":function(){return n.matrix===`Array`?a([]):a([],`default`)},"...number | BigNumber | string":function(e){return typeof e[e.length-1]==`string`?a(e,e.pop()):n.matrix===`Array`?a(e):a(e,`default`)},Array:a,Matrix:function(e){var t=e.storage();return a(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return a(e.valueOf(),t)}});function a(e,t){var n=o(e)?new i(0):0;if(s(e),t){var a=r(t);return e.length>0?a.resize(e,n):a}else{var c=[];return e.length>0?sj(c,e,n):c}}function o(e){var t=!1;return e.forEach(function(e,n,r){wE(e)&&(t=!0,r[n]=e.toNumber())}),t}function s(e){e.forEach(function(e){if(typeof e!=`number`||!PD(e)||e<0)throw Error(`Parameters in function zeros must be positive integers`)})}}),UL=`fft`,WL=Z(UL,[`typed`,`matrix`,`addScalar`,`multiplyScalar`,`divideScalar`,`exp`,`tau`,`i`,`dotDivide`,`conj`,`pow`,`ceil`,`log2`],e=>{var{typed:t,matrix:n,addScalar:r,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:c,dotDivide:l,conj:u,pow:d,ceil:f,log2:p}=e;return t(UL,{Array:m,Matrix:function(e){return e.create(m(e.valueOf()),e.datatype())}});function m(e){var t=tj(e);return t.length===1?_(e,t[0]):h(e.map(e=>m(e,t.slice(1))),0)}function h(e,t){var n=tj(e);if(t!==0)return Array(n[0]).fill(0).map((n,r)=>h(e[r],t-1));if(n.length===1)return _(e);function r(e){var t=tj(e);return Array(t[1]).fill(0).map((n,r)=>Array(t[0]).fill(0).map((t,n)=>e[n][r]))}return r(h(r(e),1))}function g(e){for(var t=e.length,n=o(a(i(-1,i(c,s)),t)),r=[],h=1-t;h<t;h++)r.push(d(n,a(d(h,2),2)));for(var g=d(2,f(p(t+t-1))),v=[...Array(t).fill(0).map((n,a)=>i(e[a],r[t-1+a])),...Array(g-t).fill(0)],y=[...Array(t+t-1).fill(0).map((e,t)=>a(1,r[t])),...Array(g-(t+t-1)).fill(0)],b=_(v),x=_(y),S=l(u(m(u(Array(g).fill(0).map((e,t)=>i(b[t],x[t]))))),g),C=[],w=t-1;w<t+t-1;w++)C.push(i(S[w],r[w]));return C}function _(e){var t=e.length;if(t===1)return[e[0]];if(t%2==0){for(var n=[..._(e.filter((e,t)=>t%2==0),t/2),..._(e.filter((e,t)=>t%2==1),t/2)],l=0;l<t/2;l++){var u=n[l],d=i(n[l+t/2],o(i(i(s,c),a(-l,t))));n[l]=r(u,d),n[l+t/2]=r(u,i(-1,d))}return n}else return g(e)}}),GL=`ifft`,KL=Z(GL,[`typed`,`fft`,`dotDivide`,`conj`],e=>{var{typed:t,fft:n,dotDivide:r,conj:i}=e;return t(GL,{"Array | Matrix":function(e){var t=jE(e)?e.size():tj(e);return r(i(n(i(e))),t.reduce((e,t)=>e*t,1))}})});function qL(e){"@babel/helpers - typeof";return qL=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},qL(e)}function JL(e,t){if(qL(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(qL(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function YL(e){var t=JL(e,`string`);return qL(t)==`symbol`?t:t+``}function XL(e,t,n){return(t=YL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function QL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ZL(Object(n),!0).forEach(function(t){XL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var $L=Z(`solveODE`,[`typed`,`add`,`subtract`,`multiply`,`divide`,`max`,`map`,`abs`,`isPositive`,`isNegative`,`larger`,`smaller`,`matrix`,`bignumber`,`unaryMinus`],e=>{var{typed:t,add:n,subtract:r,multiply:i,divide:a,max:o,map:s,abs:c,isPositive:l,isNegative:u,larger:d,smaller:f,matrix:p,bignumber:m,unaryMinus:h}=e;function g(e){return function(t,p,g,_){if(!(p.length===2&&(p.every(S)||p.every(OE))))throw Error(`"tspan" must be an Array of two numeric values or two units [tStart, tEnd]`);var v=p[0],y=p[1],C=d(y,v),w=_.firstStep;if(w!==void 0&&!l(w))throw Error(`"firstStep" must be positive`);var T=_.maxStep;if(T!==void 0&&!l(T))throw Error(`"maxStep" must be positive`);var E=_.minStep;if(E&&u(E))throw Error(`"minStep" must be positive or zero`);var D=[v,y,w,E,T].filter(e=>e!==void 0);if(!(D.every(S)||D.every(OE)))throw Error(`Inconsistent type of "t" dependant variables`);for(var O=1,k=_.tol?_.tol:1e-4,A=_.minDelta?_.minDelta:.2,j=_.maxDelta?_.maxDelta:5,M=_.maxIter?_.maxIter:1e4,N=[v,y,...g,T,E].some(wE),[P,F,I,L]=N?[m(e.a),m(e.c),m(e.b),m(e.bp)]:[e.a,e.c,e.b,e.bp],ee=w?C?w:h(w):a(r(y,v),O),R=[v],te=[g],z=r(I,L),ne=0,re=0,ie=b(C),ae=x(C);ie(R[ne],y);){var oe=[];ee=ae(R[ne],y,ee),oe.push(t(R[ne],te[ne]));for(var se=1;se<F.length;++se)oe.push(t(n(R[ne],i(F[se],ee)),n(te[ne],i(ee,P[se],oe))));var ce=o(c(s(i(z,oe),e=>OE(e)?e.value:e)));ce<k&&k/ce>1/4&&(R.push(n(R[ne],ee)),te.push(n(te[ne],i(ee,I,oe))),ne++);var le=.84*(k/ce)**(1/5);if(f(le,A)?le=A:d(le,j)&&(le=j),le=N?m(le):le,ee=i(ee,le),T&&d(c(ee),T)?ee=C?T:h(T):E&&f(c(ee),E)&&(ee=C?E:h(E)),re++,re>M)throw Error(`Maximum number of iterations reached, try changing options`)}return{t:R,y:te}}}function _(e,t,n,r){return g({a:[[],[1/2],[0,3/4],[2/9,1/3,4/9]],c:[null,1/2,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(e,t,n,r)}function v(e,t,n,r){return g({a:[[],[1/5],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,1/5,3/10,4/5,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40]})(e,t,n,r)}function y(e,t,n,r){var i=r.method?r.method:`RK45`,a={RK23:_,RK45:v};if(i.toUpperCase()in a){var o=QL({},r);return delete o.method,a[i.toUpperCase()](e,t,n,o)}else{var s=Object.keys(a).map(e=>`"${e}"`),c=`${s.slice(0,-1).join(`, `)} and ${s.slice(-1)}`;throw Error(`Unavailable method "${i}". Available methods are ${c}`)}}function b(e){return e?f:d}function x(e){var t=e?d:f;return function(e,i,a){return t(n(e,a),i)?r(i,e):a}}function S(e){return wE(e)||CE(e)}function C(e,t,n,r){var i=y(e,t.toArray(),n.toArray(),r);return{t:p(i.t),y:p(i.y)}}return t(`solveODE`,{"function, Array, Array, Object":y,"function, Matrix, Matrix, Object":C,"function, Array, Array":(e,t,n)=>y(e,t,n,{}),"function, Matrix, Matrix":(e,t,n)=>C(e,t,n,{}),"function, Array, number | BigNumber | Unit":(e,t,n)=>{var r=y(e,t,[n],{});return{t:r.t,y:r.y.map(e=>e[0])}},"function, Matrix, number | BigNumber | Unit":(e,t,n)=>{var r=y(e,t.toArray(),[n],{});return{t:p(r.t),y:p(r.y.map(e=>e[0]))}},"function, Array, number | BigNumber | Unit, Object":(e,t,n,r)=>{var i=y(e,t,[n],r);return{t:i.t,y:i.y.map(e=>e[0])}},"function, Matrix, number | BigNumber | Unit, Object":(e,t,n,r)=>{var i=y(e,t.toArray(),[n],r);return{t:p(i.t),y:p(i.y.map(e=>e[0]))}}})}),eR=Z(`erf`,[`typed`],e=>{var{typed:t}=e;return t(`name`,{number:function(e){var t=Math.abs(e);return t>=aR?ID(e):t<=tR?ID(e)*n(t):t<=4?ID(e)*(1-r(t)):ID(e)*(1-i(t))},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))});function n(e){var t=e*e,n=rR[0][4]*t,r=t,i;for(i=0;i<3;i+=1)n=(n+rR[0][i])*t,r=(r+iR[0][i])*t;return e*(n+rR[0][3])/(r+iR[0][3])}function r(e){var t=rR[1][8]*e,n=e,r;for(r=0;r<7;r+=1)t=(t+rR[1][r])*e,n=(n+iR[1][r])*e;var i=(t+rR[1][7])/(n+iR[1][7]),a=parseInt(e*16)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}function i(e){var t=1/(e*e),n=rR[2][5]*t,r=t,i;for(i=0;i<4;i+=1)n=(n+rR[2][i])*t,r=(r+iR[2][i])*t;var a=t*(n+rR[2][4])/(r+iR[2][4]);a=(nR-a)/e,t=parseInt(e*16)/16;var o=(e-t)*(e+t);return Math.exp(-t*t)*Math.exp(-o)*a}}),tR=.46875,nR=.5641895835477563,rR=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],iR=[[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]],aR=2**53,oR=`zeta`,sR=Z(oR,[`typed`,`config`,`multiply`,`pow`,`divide`,`factorial`,`equal`,`smallerEq`,`isBounded`,`isNegative`,`gamma`,`sin`,`subtract`,`add`,`?Complex`,`?BigNumber`,`pi`],e=>{var{typed:t,config:n,multiply:r,pow:i,divide:a,factorial:o,equal:s,smallerEq:c,isBounded:l,isNegative:u,gamma:d,sin:f,subtract:p,add:m,Complex:h,BigNumber:g,pi:_}=e;return t(oR,{number:e=>v(e,e=>e,()=>20),BigNumber:e=>v(e,e=>new g(e),()=>Math.abs(Math.log10(n.relTol))),Complex:y});function v(e,t,n){return s(e,0)?t(-.5):s(e,1)?t(NaN):l(e)?b(e,t,n,e=>e):u(e)?t(NaN):t(1)}function y(e){return e.re===0&&e.im===0?new h(-.5):e.re===1?new h(NaN,NaN):e.re===1/0&&e.im===0?new h(1):e.im===1/0||e.re===-1/0?new h(NaN,NaN):b(e,e=>e,e=>Math.round(1.3*15+.9*Math.abs(e.im)),e=>e.re)}function b(e,t,n,o){var s=n(e);if(o(e)>-(s-1)/2)return S(e,t(s),t);var c=r(i(2,e),i(t(_),p(e,1)));return c=r(c,f(r(a(t(_),2),e))),c=r(c,d(p(1,e))),r(c,b(p(1,e),t,n,o))}function x(e,t){for(var n=e,s=e;c(s,t);s=m(s,1)){var l=a(r(o(m(t,p(s,1))),i(4,s)),r(o(p(t,s)),o(r(2,s))));n=m(n,l)}return r(t,n)}function S(e,t,n){for(var o=a(1,r(x(n(0),t),p(1,i(2,p(1,e))))),s=n(0),l=n(1);c(l,t);l=m(l,1))s=m(s,a(r((-1)**(l-1),x(l,t)),i(l,e)));return r(o,s)}}),cR=`mode`,lR=Z(cR,[`typed`,`isNaN`,`isNumeric`],e=>{var{typed:t,isNaN:n,isNumeric:r}=e;return t(cR,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(e=_j(e.valueOf()),e.length===0)throw Error(`Cannot calculate mode of an empty array`);for(var t={},i=[],a=0,o=0;o<e.length;o++){var s=e[o];if(r(s)&&n(s))throw Error(`Cannot calculate mode of an array containing NaN values`);s in t||(t[s]=0),t[s]++,t[s]===a?i.push(s):t[s]>a&&(a=t[s],i=[s])}return i}});function uR(e,t,n){var r;return String(e).includes(`Unexpected type`)?(r=arguments.length>2?` (type: `+pD(n)+`, value: `+JSON.stringify(n)+`)`:` (type: `+e.data.actual+`)`,TypeError(`Cannot calculate `+t+`, unexpected type of argument`+r)):String(e).includes(`complex numbers`)?(r=arguments.length>2?` (type: `+pD(n)+`, value: `+JSON.stringify(n)+`)`:``,TypeError(`Cannot calculate `+t+`, no ordering relation is defined for complex numbers`+r)):e}var dR=`prod`,fR=Z(dR,[`typed`,`config`,`multiplyScalar`,`numeric`],e=>{var{typed:t,config:n,multiplyScalar:r,numeric:i}=e;return t(dR,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw Error(`prod(A, dim) is not yet supported`)},"...":function(e){return a(e)}});function a(e){var t;if(qj(e,function(e){try{t=t===void 0?e:r(t,e)}catch(t){throw uR(t,`prod`,e)}}),typeof t==`string`&&(t=i(t,FD(t,n))),t===void 0)throw Error(`Cannot calculate prod of an empty array`);return t}}),pR=`format`,mR=Z(pR,[`typed`],e=>{var{typed:t}=e;return t(pR,{any:GA,"any, Object | function | number | BigNumber":GA})}),hR=`bin`,gR=Z(hR,[`typed`,`format`],e=>{var{typed:t,format:n}=e;return t(hR,{"number | BigNumber":function(e){return n(e,{notation:`bin`})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:`bin`,wordSize:t})}})}),_R=`oct`,vR=Z(_R,[`typed`,`format`],e=>{var{typed:t,format:n}=e;return t(_R,{"number | BigNumber":function(e){return n(e,{notation:`oct`})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:`oct`,wordSize:t})}})}),yR=`hex`,bR=Z(yR,[`typed`,`format`],e=>{var{typed:t,format:n}=e;return t(yR,{"number | BigNumber":function(e){return n(e,{notation:`hex`})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:`hex`,wordSize:t})}})}),xR=/\$([\w.]+)/g,SR=`print`,CR=Z(SR,[`typed`],e=>{var{typed:t}=e;return t(SR,{"string, Object | Array":wR,"string, Object | Array, number | Object":wR})});function wR(e,t,n){return e.replace(xR,function(e,r){var i=r.split(`.`),a=t[i.shift()];for(a!==void 0&&a.isMatrix&&(a=a.toArray());i.length&&a!==void 0;){var o=i.shift();a=o?a[o]:a+`.`}return a===void 0?e:kE(a)?a:GA(a,n)})}var TR=`to`,ER=Z(TR,[`typed`,`matrix`,`concat`],e=>{var{typed:t,matrix:n,concat:r}=e;return t(TR,{"Unit, Unit | string":(e,t)=>e.to(t)},vF({typed:t,matrix:n,concat:r})({Ds:!0}))}),DR=`toBest`,OR=Z(DR,[`typed`],e=>{var{typed:t}=e;return t(DR,{Unit:e=>e.toBest(),"Unit, string":(e,t)=>e.toBest(t.split(`,`)),"Unit, string, Object":(e,t,n)=>e.toBest(t.split(`,`),n),"Unit, Array":(e,t)=>e.toBest(t),"Unit, Array, Object":(e,t,n)=>e.toBest(t,n)})}),kR=`isPrime`,AR=Z(kR,[`typed`],e=>{var{typed:t}=e;return t(kR,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(var t=5;t*t<=e;t+=6)if(e%t===0||e%(t+2)===0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;if(e%2n==0n||e%3n==0n)return!1;for(var t=5n;t*t<=e;t+=6n)if(e%t===0n||e%(t+2n)===0n)return!1;return!0},BigNumber:function(e){if(e.lte(3))return e.gt(1);if(e.mod(2).eq(0)||e.mod(3).eq(0))return!1;if(e.lt(2**32)){for(var t=e.toNumber(),n=5;n*n<=t;n+=6)if(t%n===0||t%(n+2)===0)return!1;return!0}function r(e,t,n){for(var r=1;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(n)):(t=t.sub(1),r=e.mul(r).mod(n));return r}e=new(e.constructor.clone({precision:e.toFixed(0).length*2}))(e);for(var i=0,a=e.sub(1);a.mod(2).eq(0);)a=a.div(2),i+=1;var o=null;if(e.lt(`3317044064679887385961981`))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(t=>t<e);else{var s=Math.min(e.toNumber()-2,Math.floor(2*(e.toFixed(0).length*Math.log(10))**2));o=[];for(var c=2;c<=s;c+=1)o.push(s)}for(var l=0;l<o.length;l+=1){var u=o[l],d=r(e.sub(e).add(u),a,e);if(!d.eq(1)){for(var f=0,p=d;!p.eq(e.sub(1));f+=1,p=p.mul(p).mod(e))if(f===i-1)return!1}}return!0},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),jR=Z(`numeric`,[`number`,`?bignumber`,`?fraction`],e=>{var{number:t,bignumber:n,fraction:r}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:e=>t(e),BigNumber:n?e=>n(e):pL,bigint:e=>BigInt(e),Fraction:r?e=>r(e):mL};return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`number`;if((arguments.length>2?arguments[2]:void 0)!==void 0)throw SyntaxError(`numeric() takes one or two arguments`);var n=pD(e);if(!(n in i))throw TypeError(`Cannot convert `+e+` of type "`+n+`"; valid input types are `+Object.keys(i).join(`, `));if(!(t in a))throw TypeError(`Cannot convert `+e+` to type "`+t+`"; valid output types are `+Object.keys(a).join(`, `));return t===n?e:a[t](e)}}),MR=`divideScalar`,NR=Z(MR,[`typed`,`numeric`],e=>{var{typed:t,numeric:n}=e;return t(MR,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"bigint, bigint":function(e,t){return e/t},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})}),PR=`pow`,FR=Z(PR,[`typed`,`config`,`identity`,`multiply`,`matrix`,`inv`,`fraction`,`number`,`Complex`],e=>{var{typed:t,config:n,identity:r,multiply:i,matrix:a,inv:o,number:s,fraction:c,Complex:l}=e;return t(PR,{"number, number":u,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||n.predictable?e.pow(t):new l(e.toNumber(),0).pow(t.toNumber(),0)},"bigint, bigint":(e,t)=>e**t,"Fraction, Fraction":function(e,t){var r=e.pow(t);if(r!=null)return r;if(n.predictable)throw Error(`Result of pow is non-rational and cannot be expressed as a fraction`);return u(e.valueOf(),t.valueOf())},"Array, number":d,"Array, BigNumber":function(e,t){return d(e,t.toNumber())},"Matrix, number":f,"Matrix, BigNumber":function(e,t){return f(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function u(e,t){if(n.predictable&&!PD(t)&&e<0)try{var r=c(t),i=s(r);if((t===i||Math.abs((t-i)/t)<1e-14)&&r.d%2n==1n)return(r.n%2n==0n?1:-1)*(-e)**+t}catch{}return n.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:PD(t)||e>=0||n.predictable?TM(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new l(e,0).pow(t,0)}function d(e,t){if(!PD(t))throw TypeError(`For A^b, b must be an integer (value is `+t+`)`);var n=tj(e);if(n.length!==2)throw Error(`For A^b, A must be 2 dimensional (A has `+n.length+` dimensions)`);if(n[0]!==n[1])throw Error(`For A^b, A must be square (size is `+n[0]+`x`+n[1]+`)`);if(t<0)try{return d(o(e),-t)}catch(e){throw e.message===`Cannot calculate inverse, determinant is zero`?TypeError(`For A^b, when A is not invertible, b must be a positive integer (value is `+t+`)`):e}for(var a=r(n[0]).valueOf(),s=e;t>=1;)(t&1)==1&&(a=i(s,a)),t>>=1,s=i(s,s);return a}function f(e,t){return a(d(e.valueOf(),t))}}),IR=`Number of decimals in function round must be an integer`,LR=`round`,RR=Z(LR,[`typed`,`config`,`matrix`,`equalScalar`,`zeros`,`BigNumber`,`DenseMatrix`],e=>{var{typed:t,config:n,matrix:r,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,c=UP({typed:t,equalScalar:i}),l=WP({typed:t,DenseMatrix:s}),u=GP({typed:t});function d(e){return Math.abs(GD(e).exponent)}return t(LR,{number:function(e){var t=EM(e,d(n.relTol));return EM($D(e,t,n.relTol,n.absTol)?t:e)},"number, number":function(e,t){var r=d(n.relTol);if(t>=r)return EM(e,t);var i=EM(e,r);return EM($D(e,i,n.relTol,n.absTol)?i:e,t)},"number, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(IR);return new o(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw TypeError(IR);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(IR);var n=t.toNumber();return e.round(n)},BigNumber:function(e){var t=new o(e).toDecimalPlaces(d(n.relTol));return(PN(e,t,n.relTol,n.absTol)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(IR);var r=d(n.relTol);if(t>=r)return e.toDecimalPlaces(t.toNumber());var i=e.toDecimalPlaces(r);return(PN(e,i,n.relTol,n.absTol)?i:e).toDecimalPlaces(t.toNumber())},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw TypeError(IR);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(IR);return e.round(t.toNumber())},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Jj(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e,!0)),"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>c(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>u(t,n,e,!1)),"Array, number | BigNumber":t.referToSelf(e=>(t,n)=>u(r(t),n,e,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(e=>(t,n)=>i(t,0)?a(n.size(),n.storage()):l(n,t,e,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(e=>(t,n)=>i(t,0)?a(n.size(),n.storage()):u(n,t,e,!0)),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(e=>(t,n)=>u(r(n),t,e,!0).valueOf())})}),zR=`log`,BR=[`config`,`typed`,`typeOf`,`divideScalar`,`Complex`],VR=Math.log(16),HR=Z(zR,BR,e=>{var{typed:t,typeOf:n,config:r,divideScalar:i,Complex:a}=e;function o(e){return e.log()}function s(e){return o(new a(e,0))}return t(zR,{number:function(e){return e>=0||r.predictable?hM(e):s(e)},bigint:PF(VR,hM,r,s),Complex:o,BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():s(e.toNumber())},"any, any":t.referToSelf(e=>(t,r)=>{if(n(t)===`Fraction`&&n(r)===`Fraction`){var a=t.log(r);if(a!==null)return a}return i(e(t),e(r))})})}),UR=`log1p`,WR=Z(UR,[`typed`,`config`,`divideScalar`,`log`,`Complex`],e=>{var{typed:t,config:n,divideScalar:r,log:i,Complex:a}=e;return t(UR,{number:function(e){return e>=-1||n.predictable?zD(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var t=e.plus(1);return!t.isNegative()||n.predictable?t.ln():o(new a(e.toNumber(),0))},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e)),"any, any":t.referToSelf(e=>(t,n)=>r(e(t),i(n)))});function o(e){var t=e.re+1;return new a(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}}),GR=`nthRoots`,KR=Z(GR,[`config`,`typed`,`divideScalar`,`Complex`],e=>{var{typed:t,config:n,divideScalar:r,Complex:i}=e,a=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function o(e,t){if(t<0)throw Error(`Root must be greater than zero`);if(t===0)throw Error(`Root must be non-zero`);if(t%1!=0)throw Error(`Root must be an integer`);if(e===0||e.abs()===0)return[new i(0,0)];var n=typeof e==`number`,r;(n||e.re===0||e.im===0)&&(r=n?2*(e<0):e.im===0?2*(e.re<0):2*(e.im<0)+1);for(var o=e.arg(),s=e.abs(),c=[],l=s**(1/t),u=0;u<t;u++){var d=(r+4*u)/t;if(d===Math.round(d)){c.push(a[d%4](l));continue}c.push(new i({r:l,phi:(o+2*Math.PI*u)/t}))}return c}return t(GR,{Complex:function(e){return o(e,2)},"Complex, number":o})}),qR=`dotPow`,JR=Z(qR,[`typed`,`equalScalar`,`matrix`,`pow`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,equalScalar:n,matrix:r,pow:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=pF({typed:t}),l=bI({typed:t,SparseMatrix:s}),u=UP({typed:t,equalScalar:n}),d=WP({typed:t,DenseMatrix:a}),f=vF({typed:t,matrix:r,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&!m.includes(`Matrix`)&&!m.includes(`Array`)&&(p[m]=i.signatures[m]);return t(qR,f({elop:t(p),SS:l,DS:c,Ss:u,sS:d}))}),YR=`dotDivide`,XR=Z(YR,[`typed`,`matrix`,`equalScalar`,`divideScalar`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,matrix:n,equalScalar:r,divideScalar:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=fF({typed:t,equalScalar:r}),l=pF({typed:t}),u=bI({typed:t,SparseMatrix:s}),d=UP({typed:t,equalScalar:r}),f=WP({typed:t,DenseMatrix:a});return t(YR,vF({typed:t,matrix:n,concat:o})({elop:i,SS:u,DS:l,SD:c,Ss:d,sS:f}))});function ZR(e){var{DenseMatrix:t}=e;return function(e,n,r){var i=e.size();if(i.length!==2)throw RangeError(`Matrix must be two dimensional (size: `+GA(i)+`)`);var a=i[0];if(a!==i[1])throw RangeError(`Matrix must be square (size: `+GA(i)+`)`);var o=[];if(jE(n)){var s=n.size(),c=n._data;if(s.length===1){if(s[0]!==a)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);for(var l=0;l<a;l++)o[l]=[c[l]];return new t({data:o,size:[a,1],datatype:n._datatype})}if(s.length===2){if(s[0]!==a||s[1]!==1)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);if(NE(n)){if(r){o=[];for(var u=0;u<a;u++)o[u]=[c[u][0]];return new t({data:o,size:[a,1],datatype:n._datatype})}return n}if(PE(n)){for(var d=0;d<a;d++)o[d]=[0];for(var f=n._values,p=n._index,m=n._ptr,h=m[1],g=m[0];g<h;g++){var _=p[g];o[_][0]=f[g]}return new t({data:o,size:[a,1],datatype:n._datatype})}}throw RangeError(`Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.`)}if(AE(n)){var v=tj(n);if(v.length===1){if(v[0]!==a)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);for(var y=0;y<a;y++)o[y]=[n[y]];return new t({data:o,size:[a,1]})}if(v.length===2){if(v[0]!==a||v[1]!==1)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);for(var b=0;b<a;b++)o[b]=[n[b][0]];return new t({data:o,size:[a,1]})}throw RangeError(`Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.`)}}}var QR=`lsolve`,$R=Z(QR,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ZR({DenseMatrix:s});return t(QR,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).valueOf()}});function l(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=[],f=e._data,p=0;p<u;p++){var m=n[p][0]||0,h=void 0;if(o(m,0))h=0;else{var g=f[p][p];if(o(g,0))throw Error(`Linear system cannot be solved since matrix is singular`);h=r(m,g);for(var _=p+1;_<l;_++)n[_]=[a(n[_][0]||0,i(h,f[_][p]))]}d[p]=[h]}return new s({data:d,size:[l,1]})}function u(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=[],h=0;h<u;h++){var g=n[h][0]||0;if(o(g,0))m[h]=[0];else{for(var _=0,v=[],y=[],b=p[h],x=p[h+1],S=b;S<x;S++){var C=f[S];C===h?_=d[S]:C>h&&(v.push(d[S]),y.push(C))}if(o(_,0))throw Error(`Linear system cannot be solved since matrix is singular`);for(var w=r(g,_),T=0,E=y.length;T<E;T++){var D=y[T];n[D]=[a(n[D][0]||0,i(w,v[T]))]}m[h]=[w]}}return new s({data:m,size:[l,1]})}}),ez=`usolve`,tz=Z(ez,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ZR({DenseMatrix:s});return t(ez,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).valueOf()}});function l(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=[],f=e._data,p=u-1;p>=0;p--){var m=n[p][0]||0,h=void 0;if(o(m,0))h=0;else{var g=f[p][p];if(o(g,0))throw Error(`Linear system cannot be solved since matrix is singular`);h=r(m,g);for(var _=p-1;_>=0;_--)n[_]=[a(n[_][0]||0,i(h,f[_][p]))]}d[p]=[h]}return new s({data:d,size:[l,1]})}function u(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=[],h=u-1;h>=0;h--){var g=n[h][0]||0;if(o(g,0))m[h]=[0];else{for(var _=0,v=[],y=[],b=p[h],x=p[h+1]-1;x>=b;x--){var S=f[x];S===h?_=d[x]:S<h&&(v.push(d[x]),y.push(S))}if(o(_,0))throw Error(`Linear system cannot be solved since matrix is singular`);for(var C=r(g,_),w=0,T=y.length;w<T;w++){var E=y[w];n[E]=[a(n[E][0],i(C,v[w]))]}m[h]=[C]}}return new s({data:m,size:[l,1]})}}),nz=`lsolveAll`,rz=Z(nz,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ZR({DenseMatrix:s});return t(nz,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).map(e=>e.valueOf())}});function l(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._data,u=e._size[0],d=e._size[1],f=0;f<d;f++)for(var p=n.length,m=0;m<p;m++){var h=n[m];if(!o(l[f][f],0)){h[f]=r(h[f],l[f][f]);for(var g=f+1;g<d;g++)h[g]=a(h[g],i(h[f],l[g][f]))}else if(!o(h[f],0)){if(m===0)return[];n.splice(m,1),--m,--p}else if(m===0){var _=[...h];_[f]=1;for(var v=f+1;v<d;v++)_[v]=a(_[v],l[v][f]);n.push(_)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[u,1]}))}function u(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=0;m<u;m++)for(var h=n.length,g=0;g<h;g++){for(var _=n[g],v=[],y=[],b=p[m],x=p[m+1],S=0,C=b;C<x;C++){var w=f[C];w===m?S=d[C]:w>m&&(v.push(d[C]),y.push(w))}if(!o(S,0)){_[m]=r(_[m],S);for(var T=0,E=y.length;T<E;T++){var D=y[T];_[D]=a(_[D],i(_[m],v[T]))}}else if(!o(_[m],0)){if(g===0)return[];n.splice(g,1),--g,--h}else if(g===0){var O=[..._];O[m]=1;for(var k=0,A=y.length;k<A;k++){var j=y[k];O[j]=a(O[j],v[k])}n.push(O)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}}),iz=`usolveAll`,az=Z(iz,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ZR({DenseMatrix:s});return t(iz,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).map(e=>e.valueOf())}});function l(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._data,u=e._size[0],d=e._size[1]-1;d>=0;d--)for(var f=n.length,p=0;p<f;p++){var m=n[p];if(!o(l[d][d],0)){m[d]=r(m[d],l[d][d]);for(var h=d-1;h>=0;h--)m[h]=a(m[h],i(m[d],l[h][d]))}else if(!o(m[d],0)){if(p===0)return[];n.splice(p,1),--p,--f}else if(p===0){var g=[...m];g[d]=1;for(var _=d-1;_>=0;_--)g[_]=a(g[_],l[_][d]);n.push(g)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[u,1]}))}function u(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=u-1;m>=0;m--)for(var h=n.length,g=0;g<h;g++){for(var _=n[g],v=[],y=[],b=p[m],x=p[m+1],S=0,C=x-1;C>=b;C--){var w=f[C];w===m?S=d[C]:w<m&&(v.push(d[C]),y.push(w))}if(!o(S,0)){_[m]=r(_[m],S);for(var T=0,E=y.length;T<E;T++){var D=y[T];_[D]=a(_[D],i(_[m],v[T]))}}else if(!o(_[m],0)){if(g===0)return[];n.splice(g,1),--g,--h}else if(g===0){var O=[..._];O[m]=1;for(var k=0,A=y.length;k<A;k++){var j=y[k];O[j]=a(O[j],v[k])}n.push(O)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}}),oz=Z(`matAlgo08xS0Sid`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new $A(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);if(!a||!u)throw Error(`Cannot perform operation on Pattern Sparse Matrices`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));for(var x=[],S=[],C=[],w=[],T=[],E,D,O,k,A=0;A<g;A++){C[A]=S.length;var j=A+1;for(D=s[A],O=s[A+1],E=D;E<O;E++)k=o[E],T[k]=j,w[k]=a[E],S.push(k);for(D=f[A],O=f[A+1],E=D;E<O;E++)k=d[E],T[k]===j&&(w[k]=b(w[k],u[E]));for(E=C[A];E<S.length;){k=S[E];var M=w[k];v(M,y)?S.splice(E,1):(x.push(M),E++)}}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),sz=Z(`useMatrixForArrayScalar`,[`typed`,`matrix`],e=>{var{typed:t,matrix:n}=e;return{"Array, number":t.referTo(`DenseMatrix, number`,e=>(t,r)=>e(n(t),r).valueOf()),"Array, BigNumber":t.referTo(`DenseMatrix, BigNumber`,e=>(t,r)=>e(n(t),r).valueOf()),"number, Array":t.referTo(`number, DenseMatrix`,e=>(t,r)=>e(t,n(r)).valueOf()),"BigNumber, Array":t.referTo(`BigNumber, DenseMatrix`,e=>(t,r)=>e(t,n(r)).valueOf())}}),cz=`leftShift`,lz=Z(cz,[`typed`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=e,s=xF({typed:t}),c=fF({typed:t,equalScalar:r}),l=oz({typed:t,equalScalar:r}),u=CF({typed:t,DenseMatrix:a}),d=UP({typed:t,equalScalar:r}),f=GP({typed:t}),p=vF({typed:t,matrix:n,concat:o}),m=sz({typed:t,matrix:n});return t(cz,{"number, number":PM,"BigNumber, BigNumber":fI,"bigint, bigint":(e,t)=>e<<t,"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():d(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):u(n,t,e,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):f(n,t,e,!0))},m,p({SS:l,DS:s,SD:c}))}),uz=`rightArithShift`,dz=Z(uz,[`typed`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=e,s=xF({typed:t}),c=fF({typed:t,equalScalar:r}),l=oz({typed:t,equalScalar:r}),u=CF({typed:t,DenseMatrix:a}),d=UP({typed:t,equalScalar:r}),f=GP({typed:t}),p=vF({typed:t,matrix:n,concat:o}),m=sz({typed:t,matrix:n});return t(uz,{"number, number":FM,"BigNumber, BigNumber":pI,"bigint, bigint":(e,t)=>e>>t,"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():d(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):u(n,t,e,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):f(n,t,e,!0))},m,p({SS:l,DS:s,SD:c}))}),fz=`rightLogShift`,pz=Z(fz,[`typed`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=e,s=xF({typed:t}),c=fF({typed:t,equalScalar:r}),l=oz({typed:t,equalScalar:r}),u=CF({typed:t,DenseMatrix:a}),d=UP({typed:t,equalScalar:r}),f=GP({typed:t}),p=vF({typed:t,matrix:n,concat:o}),m=sz({typed:t,matrix:n});return t(fz,{"number, number":IM,"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():d(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):u(n,t,e,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):f(n,t,e,!0))},m,p({SS:l,DS:s,SD:c}))}),mz=`and`,hz=Z(mz,[`typed`,`matrix`,`equalScalar`,`zeros`,`not`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o}=e,s=fF({typed:t,equalScalar:r}),c=jF({typed:t,equalScalar:r}),l=UP({typed:t,equalScalar:r}),u=GP({typed:t}),d=vF({typed:t,matrix:n,concat:o});return t(mz,{"number, number":JM,"Complex, Complex":function(e,t){return(e.re!==0||e.im!==0)&&(t.re!==0||t.im!==0)},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!t.isZero()&&!e.isNaN()&&!t.isNaN()},"bigint, bigint":JM,"Unit, Unit":t.referToSelf(e=>(t,n)=>e(t.value||0,n.value||0)),"SparseMatrix, any":t.referToSelf(e=>(t,n)=>a(n)?i(t.size(),t.storage()):l(t,n,e,!1)),"DenseMatrix, any":t.referToSelf(e=>(t,n)=>a(n)?i(t.size(),t.storage()):u(t,n,e,!1)),"any, SparseMatrix":t.referToSelf(e=>(t,n)=>a(t)?i(t.size(),t.storage()):l(n,t,e,!0)),"any, DenseMatrix":t.referToSelf(e=>(t,n)=>a(t)?i(t.size(),t.storage()):u(n,t,e,!0)),"Array, any":t.referToSelf(e=>(t,r)=>e(n(t),r).valueOf()),"any, Array":t.referToSelf(e=>(t,r)=>e(t,n(r)).valueOf())},d({SS:c,DS:s}))}),gz=`compare`,_z=Z(gz,[`typed`,`config`,`matrix`,`equalScalar`,`BigNumber`,`Fraction`,`DenseMatrix`,`concat`],e=>{var{typed:t,config:n,equalScalar:r,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:c}=e,l=pF({typed:t}),u=mF({typed:t,equalScalar:r}),d=WP({typed:t,DenseMatrix:s}),f=vF({typed:t,matrix:i,concat:c}),p=eP({typed:t});return t(gz,vz({typed:t,config:n}),{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return PN(e,t,n.relTol,n.absTol)?new a(0):new a(e.cmp(t))},"bigint, bigint":function(e,t){return e===t?0n:e>t?1n:-1n},"Fraction, Fraction":function(e,t){return new o(e.compare(t))},"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},p,f({SS:u,DS:l,Ss:d}))}),vz=Z(gz,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(gz,{"number, number":function(e,t){return $D(e,t,n.relTol,n.absTol)?0:e>t?1:-1}})}),yz=l(o(((e,t)=>{t.exports=function e(t,n){"use strict";var r=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,s=/^0/,c=function(t){return e.insensitive&&(``+t).toLowerCase()||``+t},l=c(t).replace(i,``)||``,u=c(n).replace(i,``)||``,d=l.replace(r,`\0$1\0`).replace(/\0$/,``).replace(/^\0/,``).split(`\0`),f=u.replace(r,`\0$1\0`).replace(/\0$/,``).replace(/^\0/,``).split(`\0`),p=parseInt(l.match(o),16)||d.length!==1&&l.match(a)&&Date.parse(l),m=parseInt(u.match(o),16)||p&&u.match(a)&&Date.parse(u)||null,h,g;if(m){if(p<m)return-1;if(p>m)return 1}for(var _=0,v=Math.max(d.length,f.length);_<v;_++){if(h=!(d[_]||``).match(s)&&parseFloat(d[_])||d[_]||0,g=!(f[_]||``).match(s)&&parseFloat(f[_])||f[_]||0,isNaN(h)!==isNaN(g))return isNaN(h)?1:-1;if(typeof h!=typeof g&&(h+=``,g+=``),h<g)return-1;if(h>g)return 1}return 0}}))(),1),bz=`compareNatural`,xz=Z(bz,[`typed`,`compare`],e=>{var{typed:t,compare:n}=e,r=n.signatures[`boolean,boolean`];return t(bz,{"any, any":i});function i(e,t){var c=pD(e),l=pD(t),u;if((c===`number`||c===`BigNumber`||c===`Fraction`||c===`bigint`)&&(l===`number`||l===`BigNumber`||l===`Fraction`||l===`bigint`))return u=n(e,t),u.toString()===`0`?(0,yz.default)(c,l):u>0?1:-1;var d=[`Array`,`DenseMatrix`,`SparseMatrix`];if(d.includes(c)||d.includes(l))return u=a(i,e,t),u===0?(0,yz.default)(c,l):u;if(c!==l)return(0,yz.default)(c,l);if(c===`Complex`)return Sz(e,t);if(c===`Unit`)return e.equalBase(t)?i(e.value,t.value):o(i,e.formatUnits(),t.formatUnits());if(c===`boolean`)return r(e,t);if(c===`string`)return(0,yz.default)(e,t);if(c===`Object`)return s(i,e,t);if(c===`null`||c===`undefined`)return 0;throw TypeError(`Unsupported type of value "`+c+`"`)}function a(e,t,n){return PE(t)&&PE(n)?o(e,t.toJSON().values,n.toJSON().values):PE(t)?a(e,t.toArray(),n):PE(n)?a(e,t,n.toArray()):NE(t)?a(e,t.toJSON().data,n):NE(n)?a(e,t,n.toJSON().data):Array.isArray(t)?Array.isArray(n)?o(e,t,n):a(e,t,[n]):a(e,[t],n)}function o(e,t,n){for(var r=0,i=Math.min(t.length,n.length);r<i;r++){var a=e(t[r],n[r]);if(a!==0)return a}return t.length>n.length?1:t.length<n.length?-1:0}function s(e,t,n){var r=Object.keys(t),i=Object.keys(n);r.sort(yz.default),i.sort(yz.default);var a=o(e,r,i);if(a!==0)return a;for(var s=0;s<r.length;s++){var c=e(t[r[s]],n[i[s]]);if(c!==0)return c}return 0}});function Sz(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0}var Cz=`compareText`,wz=[`typed`,`matrix`,`concat`];QA.signature=`any, any`;var Tz=Z(Cz,wz,e=>{var{typed:t,matrix:n,concat:r}=e;return t(Cz,QA,vF({typed:t,matrix:n,concat:r})({elop:QA,Ds:!0}))}),Ez=`equal`,Dz=Z(Ez,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=pF({typed:t}),c=bI({typed:t,SparseMatrix:o}),l=WP({typed:t,DenseMatrix:i}),u=vF({typed:t,matrix:n});return t(Ez,Oz({typed:t,equalScalar:r}),u({elop:r,SS:c,DS:s,Ss:l}))}),Oz=Z(Ez,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return t(Ez,{"any, any":function(e,t){return e===null?t===null:t===null?e===null:e===void 0?t===void 0:t===void 0?e===void 0:n(e,t)}})}),kz=`equalText`,Az=Z(kz,[`typed`,`compareText`,`isZero`],e=>{var{typed:t,compareText:n,isZero:r}=e;return t(kz,{"any, any":function(e,t){return r(n(e,t))}})}),jz=`smaller`,Mz=Z(jz,[`typed`,`config`,`bignumber`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=pF({typed:t}),l=bI({typed:t,SparseMatrix:s}),u=WP({typed:t,DenseMatrix:a}),d=vF({typed:t,matrix:i,concat:o}),f=eP({typed:t});function p(e,t){return e.lt(t)&&!PN(e,t,n.relTol,n.absTol)}return t(jz,Nz({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<t,"BigNumber, BigNumber":p,"bigint, bigint":(e,t)=>e<t,"Fraction, Fraction":(e,t)=>e.compare(t)===-1,"Fraction, BigNumber":function(e,t){return p(r(e),t)},"BigNumber, Fraction":function(e,t){return p(e,r(t))},"Complex, Complex":function(e,t){throw TypeError(`No ordering relation is defined for complex numbers`)}},f,d({SS:l,DS:c,Ss:u}))}),Nz=Z(jz,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(jz,{"number, number":function(e,t){return e<t&&!$D(e,t,n.relTol,n.absTol)}})}),Pz=`smallerEq`,Fz=Z(Pz,[`typed`,`config`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,matrix:r,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=pF({typed:t}),c=bI({typed:t,SparseMatrix:o}),l=WP({typed:t,DenseMatrix:i}),u=vF({typed:t,matrix:r,concat:a}),d=eP({typed:t});return t(Pz,Iz({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<=t,"BigNumber, BigNumber":function(e,t){return e.lte(t)||PN(e,t,n.relTol,n.absTol)},"bigint, bigint":(e,t)=>e<=t,"Fraction, Fraction":(e,t)=>e.compare(t)!==1,"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},d,u({SS:c,DS:s,Ss:l}))}),Iz=Z(Pz,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Pz,{"number, number":function(e,t){return e<=t||$D(e,t,n.relTol,n.absTol)}})}),Lz=`larger`,Rz=Z(Lz,[`typed`,`config`,`bignumber`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=pF({typed:t}),l=bI({typed:t,SparseMatrix:s}),u=WP({typed:t,DenseMatrix:a}),d=vF({typed:t,matrix:i,concat:o}),f=eP({typed:t});function p(e,t){return e.gt(t)&&!PN(e,t,n.relTol,n.absTol)}return t(Lz,zz({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>t,"BigNumber, BigNumber":p,"bigint, bigint":(e,t)=>e>t,"Fraction, Fraction":(e,t)=>e.compare(t)===1,"Fraction, BigNumber":function(e,t){return p(r(e),t)},"BigNumber, Fraction":function(e,t){return p(e,r(t))},"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},f,d({SS:l,DS:c,Ss:u}))}),zz=Z(Lz,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Lz,{"number, number":function(e,t){return e>t&&!$D(e,t,n.relTol,n.absTol)}})}),Bz=`largerEq`,Vz=Z(Bz,[`typed`,`config`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,matrix:r,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=pF({typed:t}),c=bI({typed:t,SparseMatrix:o}),l=WP({typed:t,DenseMatrix:i}),u=vF({typed:t,matrix:r,concat:a}),d=eP({typed:t});return t(Bz,Hz({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>=t,"BigNumber, BigNumber":function(e,t){return e.gte(t)||PN(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e>=t},"Fraction, Fraction":(e,t)=>e.compare(t)!==-1,"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},d,u({SS:c,DS:s,Ss:l}))}),Hz=Z(Bz,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Bz,{"number, number":function(e,t){return e>=t||$D(e,t,n.relTol,n.absTol)}})}),Uz=`deepEqual`,Wz=Z(Uz,[`typed`,`equal`],e=>{var{typed:t,equal:n}=e;return t(Uz,{"any, any":function(e,t){return r(e.valueOf(),t.valueOf())}});function r(e,t){if(Array.isArray(e))if(Array.isArray(t)){var i=e.length;if(i!==t.length)return!1;for(var a=0;a<i;a++)if(!r(e[a],t[a]))return!1;return!0}else return!1;else if(Array.isArray(t))return!1;else return n(e,t)}}),Gz=`unequal`,Kz=Z(Gz,[`typed`,`config`,`equalScalar`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,equalScalar:r,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=pF({typed:t}),l=bI({typed:t,SparseMatrix:s}),u=WP({typed:t,DenseMatrix:a}),d=vF({typed:t,matrix:i,concat:o});return t(Gz,qz({typed:t,equalScalar:r}),d({elop:f,SS:l,DS:c,Ss:u}));function f(e,t){return!r(e,t)}}),qz=Z(Gz,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return t(Gz,{"any, any":function(e,t){return e===null?t!==null:t===null?e!==null:e===void 0?t!==void 0:t===void 0?e!==void 0:!n(e,t)}})}),Jz=`partitionSelect`,Yz=Z(Jz,[`typed`,`isNumeric`,`isNaN`,`compare`],e=>{var{typed:t,isNumeric:n,isNaN:r,compare:i}=e,a=i,o=(e,t)=>-i(e,t);return t(Jz,{"Array | Matrix, number":function(e,t){return s(e,t,a)},"Array | Matrix, number, string":function(e,t,n){if(n===`asc`)return s(e,t,a);if(n===`desc`)return s(e,t,o);throw Error(`Compare string must be "asc" or "desc"`)},"Array | Matrix, number, function":s});function s(e,t,n){if(!PD(t)||t<0)throw Error(`k must be a non-negative integer`);if(jE(e)){if(e.size().length>1)throw Error(`Only one dimensional matrices supported`);return c(e.valueOf(),t,n)}if(Array.isArray(e))return c(e,t,n)}function c(e,t,i){if(t>=e.length)throw Error(`k out of bounds`);for(var a=0;a<e.length;a++)if(n(e[a])&&r(e[a]))return e[a];for(var o=0,s=e.length-1;o<s;){for(var c=o,l=s,u=e[Math.floor(Math.random()*(s-o+1))+o];c<l;)if(i(e[c],u)>=0){var d=e[l];e[l]=e[c],e[c]=d,--l}else ++c;i(e[c],u)>0&&--c,t<=c?s=c:o=c+1}return e[t]}}),Xz=`sort`,Zz=Z(Xz,[`typed`,`matrix`,`compare`,`compareNatural`],e=>{var{typed:t,matrix:n,compare:r,compareNatural:i}=e,a=r,o=(e,t)=>-r(e,t);return t(Xz,{Array:function(e){return c(e),e.sort(a)},Matrix:function(e){return l(e),n(e.toArray().sort(a),e.storage())},"Array, function":function(e,t){return c(e),e.sort(t)},"Matrix, function":function(e,t){return l(e),n(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return c(e),e.sort(s(t))},"Matrix, string":function(e,t){return l(e),n(e.toArray().sort(s(t)),e.storage())}});function s(e){if(e===`asc`)return a;if(e===`desc`)return o;if(e===`natural`)return i;throw Error(`String "asc", "desc", or "natural" expected`)}function c(e){if(tj(e).length!==1)throw Error(`One dimensional array expected`)}function l(e){if(e.size().length!==1)throw Error(`One dimensional matrix expected`)}}),Qz=`max`,$z=Z(Qz,[`typed`,`config`,`numeric`,`larger`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,larger:i,isNaN:a}=e;return t(Qz,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){return Yj(e,t.valueOf(),o)},"...":function(e){if(Kj(e))throw TypeError(`Scalar values expected in function max`);return s(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw uR(e,`max`,t)}}function s(e){var t;if(qj(e,function(e){try{(a(e)||t===void 0||i(e,t))&&(t=e)}catch(t){throw uR(t,`max`,e)}}),t===void 0)throw Error(`Cannot calculate max of an empty array`);return typeof t==`string`&&(t=r(t,FD(t,n))),t}}),eB=`min`,tB=Z(eB,[`typed`,`config`,`numeric`,`smaller`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,smaller:i,isNaN:a}=e;return t(eB,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){return Yj(e,t.valueOf(),o)},"...":function(e){if(Kj(e))throw TypeError(`Scalar values expected in function min`);return s(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw uR(e,`min`,t)}}function s(e){var t;if(qj(e,function(e){try{(a(e)||t===void 0||i(e,t))&&(t=e)}catch(t){throw uR(t,`min`,e)}}),t===void 0)throw Error(`Cannot calculate min of an empty array`);return typeof t==`string`&&(t=r(t,FD(t,n))),t}}),nB=Z(`ImmutableDenseMatrix`,[`smaller`,`DenseMatrix`],e=>{var{smaller:t,DenseMatrix:n}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!kE(t))throw Error(`Invalid datatype: `+t);if(jE(e)||AE(e)){var i=new n(e,t);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&AE(e.data)&&AE(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=e.min===void 0?null:e.min,this._max=e.max===void 0?null:e.max;else if(e)throw TypeError(`Unsupported type of data (`+pD(e)+`)`);else this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}return r.prototype=new n,r.prototype.type=`ImmutableDenseMatrix`,r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(e){switch(arguments.length){case 1:var t=n.prototype.subset.call(this,e);return jE(t)?new r({data:t._data,size:t._size,datatype:t._datatype}):t;case 2:case 3:throw Error(`Cannot invoke set subset on an Immutable Matrix instance`);default:throw SyntaxError(`Wrong number of arguments`)}},r.prototype.set=function(){throw Error(`Cannot invoke set on an Immutable Matrix instance`)},r.prototype.resize=function(){throw Error(`Cannot invoke resize on an Immutable Matrix instance`)},r.prototype.reshape=function(){throw Error(`Cannot invoke reshape on an Immutable Matrix instance`)},r.prototype.clone=function(){return new r({data:mD(this._data),size:mD(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:`ImmutableDenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(){throw Error(`Cannot invoke swapRows on an Immutable Matrix instance`)},r.prototype.min=function(){if(this._min===null){var e=null;this.forEach(function(n){(e===null||t(n,e))&&(e=n)}),this._min=e===null?void 0:e}return this._min},r.prototype.max=function(){if(this._max===null){var e=null;this.forEach(function(n){(e===null||t(e,n))&&(e=n)}),this._max=e===null?void 0:e}return this._max},r},{isClass:!0}),rB=Z(`Index`,[`ImmutableDenseMatrix`,`getMatrixDataType`],e=>{var{ImmutableDenseMatrix:t,getMatrixDataType:n}=e;function r(){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var e=0,t=arguments.length;e<t;e++){var a=e<0||arguments.length<=e?void 0:arguments[e],o=AE(a),s=jE(a),c=typeof a,l=null;if(FE(a))this._dimensions.push(a),this._isScalar=!1;else if(o||s){var u=void 0;this._isScalar=!1,n(a)===`boolean`?(o&&(u=i(iB(a).valueOf())),s&&(u=i(iB(a._data).valueOf())),l=a.valueOf().length):u=i(a.valueOf()),this._dimensions.push(u)}else if(c===`number`)this._dimensions.push(a);else if(c===`bigint`)this._dimensions.push(Number(a));else if(c===`string`)this._dimensions.push(a);else throw TypeError(`Dimension must be an Array, Matrix, number, bigint, string, or Range`);this._sourceSize.push(l)}}r.prototype.type=`Index`,r.prototype.isIndex=!0;function i(e){for(var n=0,r=e.length;n<r;n++)if(!CE(e[n])||!PD(e[n]))throw TypeError(`Index parameters must be positive integer numbers`);var i=new t;return i._data=e,i._size=[e.length],i}return r.prototype.clone=function(){var e=new r;return e._dimensions=mD(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},r.create=function(e){var t=new r;return r.apply(t,e),t},r.prototype.size=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e[t]=kE(r)||CE(r)?1:r.size()[0]}return e},r.prototype.max=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e[t]=kE(r)||CE(r)?r:r.max()}return e},r.prototype.min=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e[t]=kE(r)||CE(r)?r:r.min()}return e},r.prototype.forEach=function(e){for(var t=0,n=this._dimensions.length;t<n;t++)e(this._dimensions[t],t,this)},r.prototype.dimension=function(e){return CE(e)?this._dimensions[e]??null:null},r.prototype.isObjectProperty=function(){return this._dimensions.length===1&&kE(this._dimensions[0])},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e.push(kE(r)||CE(r)?r:r.toArray())}return e},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];kE(r)?e.push(JSON.stringify(r)):e.push(r.toString())}return`[`+e.join(`, `)+`]`},r.prototype.toJSON=function(){return{mathjs:`Index`,dimensions:this._dimensions}},r.fromJSON=function(e){return r.create(e.dimensions)},r},{isClass:!0});function iB(e){var t=[];return e.forEach((e,n)=>{e&&t.push(n)}),t}var aB=Z(`FibonacciHeap`,[`smaller`,`larger`],e=>{var{smaller:t,larger:n}=e,r=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw 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(e,n){var r={key:e,value:n,degree:0};if(this._minimum){var i=this._minimum;r.left=i,r.right=i.right,i.right=r,r.right.left=r,t(e,i.key)&&(this._minimum=r)}else r.left=r,r.right=r,this._minimum=r;return this._size++,r},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 e=this._minimum;if(e===null)return e;for(var t=this._minimum,n=e.degree,r=e.child;n>0;){var i=r.right;r.left.right=r.right,r.right.left=r.left,r.left=t,r.right=t.right,t.right=r,r.right.left=r,r.parent=null,r=i,n--}return e.left.right=e.right,e.right.left=e.left,e===e.right?t=null:(t=e.right,t=l(t,this._size)),this._size--,this._minimum=t,e},i.prototype.remove=function(e){this._minimum=a(this._minimum,e,-1),this.extractMinimum()};function a(e,n,r){n.key=r;var i=n.parent;return i&&t(n.key,i.key)&&(o(e,n,i),s(e,i)),t(n.key,e.key)&&(e=n),e}function o(e,t,n){t.left.right=t.right,t.right.left=t.left,n.degree--,n.child===t&&(n.child=t.right),n.degree===0&&(n.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function s(e,t){var n=t.parent;n&&(t.mark?(o(e,t,n),s(n)):t.mark=!0)}var c=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1};function l(e,i){var a=Math.floor(Math.log(i)*r)+1,o=Array(a),s=0,l=e;if(l)for(s++,l=l.right;l!==e;)s++,l=l.right;for(var u;s>0;){for(var d=l.degree,f=l.right;u=o[d],u;){if(n(l.key,u.key)){var p=u;u=l,l=p}c(u,l),o[d]=null,d++}o[d]=l,l=f,s--}e=null;for(var m=0;m<a;m++)u=o[m],u&&(e?(u.left.right=u.right,u.right.left=u.left,u.left=e,u.right=e.right,e.right=u,u.right.left=u,t(u.key,e.key)&&(e=u)):e=u);return e}return i},{isClass:!0}),oB=Z(`Spa`,[`addScalar`,`equalScalar`,`FibonacciHeap`],e=>{var{addScalar:t,equalScalar:n,FibonacciHeap:r}=e;function i(){if(!(this instanceof i))throw SyntaxError(`Constructor must be called with the new operator`);this._values=[],this._heap=new r}return i.prototype.type=`Spa`,i.prototype.isSpa=!0,i.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{var n=this._heap.insert(e,t);this._values[e]=n}},i.prototype.get=function(e){var t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,n){var r=this._values[e];r?r.value=t(r.value,n):(r=this._heap.insert(e,n),this._values[e]=r)},i.prototype.forEach=function(e,t,r){var i=this._heap,a=this._values,o=[],s=i.extractMinimum();for(s&&o.push(s);s&&s.key<=t;)s.key>=e&&(n(s.value,0)||r(s.key,s.value,this)),s=i.extractMinimum(),s&&o.push(s);for(var c=0;c<o.length;c++){var l=o[c];s=i.insert(l.key,l.value),a[s.key]=s}},i.prototype.swap=function(e,t){var n=this._values[e],r=this._values[t];if(!n&&r)n=this._heap.insert(e,r.value),this._heap.remove(r),this._values[e]=n,this._values[t]=void 0;else if(n&&!r)r=this._heap.insert(t,n.value),this._heap.remove(n),this._values[t]=r,this._values[e]=void 0;else if(n&&r){var i=n.value;n.value=r.value,r.value=i}},i},{isClass:!0});function sB(e){var t=0,n=1,r=Object.create(null),i=Object.create(null),a=0,o=function(e){var o=i[e];if(o&&(delete r[o],delete i[e],--t,n===o)){if(!t){a=0,n=1;return}for(;!Object.prototype.hasOwnProperty.call(r,++n););}};return e=Math.abs(e),{hit:function(s){var c=i[s],l=++a;if(r[l]=s,i[s]=l,!c)return++t,t<=e?void 0:(s=r[n],o(s),s);if(delete r[c],n===c)for(;!Object.prototype.hasOwnProperty.call(r,++n););},delete:o,clear:function(){t=a=0,n=1,r=Object.create(null),i=Object.create(null)}}}function cB(e){var{hasher:t,limit:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n??=1/0,t??=JSON.stringify,function r(){typeof r.cache!=`object`&&(r.cache={values:new Map,lru:sB(n||1/0)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=t(i);if(r.cache.values.has(o))return r.cache.lru.hit(o),r.cache.values.get(o);var s=e.apply(e,i);return r.cache.values.set(o,s),r.cache.values.delete(r.cache.lru.hit(o)),s}}var lB=cB(function(e){return new e(1).exp()},{hasher:pB}),uB=cB(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:pB}),dB=cB(function(e){return e.acos(-1)},{hasher:pB}),fB=cB(function(e){return dB(e).times(2)},{hasher:pB});function pB(e){return e[0].precision}function mB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hB(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?mB(Object(n),!0).forEach(function(t){XL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mB(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var gB=Z(`Unit`,[`?on`,`config`,`addScalar`,`subtractScalar`,`multiplyScalar`,`divideScalar`,`pow`,`abs`,`fix`,`round`,`equal`,`isNumeric`,`format`,`number`,`Complex`,`BigNumber`,`Fraction`],e=>{var{on:t,config:n,addScalar:r,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:s,abs:c,fix:l,round:u,equal:d,isNumeric:f,format:p,number:m,Complex:h,BigNumber:g,Fraction:_}=e,v=m,y=!1,b=!0;function x(e,t){if(!(this instanceof x))throw Error(`Constructor must be called with the new operator`);if(!(e==null||f(e)||EE(e)))throw TypeError(`First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined`);if(this.fixPrefix=y,this.skipAutomaticSimplification=b,t===void 0)this.units=[],this.dimensions=te.map(e=>0);else if(typeof t==`string`){var n=x.parse(t);this.units=n.units,this.dimensions=n.dimensions}else if(OE(t)&&t.value===null)this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map(e=>oE({},e));else throw TypeError(`Second parameter in Unit constructor must be a string or valueless Unit`);this.value=this._normalize(e)}Object.defineProperty(x,`name`,{value:`Unit`}),x.prototype.constructor=x,x.prototype.type=`Unit`,x.prototype.isUnit=!0;var S,C,w;function T(){for(;w===` `||w===` `;)O()}function E(e){return e>=`0`&&e<=`9`||e===`.`}function D(e){return e>=`0`&&e<=`9`}function O(){C++,w=S.charAt(C)}function k(e){C=e,w=S.charAt(C)}function A(){var e=``,t=C;if(w===`+`?O():w===`-`&&(e+=w,O()),!E(w))return k(t),null;if(w===`.`){if(e+=w,O(),!D(w))return k(t),null}else{for(;D(w);)e+=w,O();w===`.`&&(e+=w,O())}for(;D(w);)e+=w,O();if(w===`E`||w===`e`){var n=``,r=C;if(n+=w,O(),(w===`+`||w===`-`)&&(n+=w,O()),!D(w))return k(r),e;for(e+=n;D(w);)e+=w,O()}return e}function j(){for(var e=``;D(w)||x.isValidAlpha(w);)e+=w,O();var t=e.charAt(0);return x.isValidAlpha(t)?e:null}function M(e){return w===e?(O(),e):null}x.parse=function(e,t){if(t||={},S=e,C=-1,w=``,typeof S!=`string`)throw TypeError(`Invalid argument in Unit.parse, string expected`);var r=new x;r.units=[];var i=1,a=!1;O(),T();var o=A(),s=null;if(o){if(n.number===`BigNumber`)s=new g(o);else if(n.number===`Fraction`)try{s=new _(o)}catch{s=parseFloat(o)}else s=parseFloat(o);T(),M(`*`)?(i=1,a=!0):M(`/`)&&(i=-1,a=!0)}for(var c=[],l=1;;){for(T();w===`(`;)c.push(i),l*=i,i=1,O(),T();var u=void 0;if(w){var d=w;if(u=j(),u===null)throw SyntaxError(`Unexpected "`+d+`" in "`+S+`" at index `+C.toString())}else break;var f=N(u);if(f===null)throw SyntaxError(`Unit "`+u+`" not found.`);var p=i*l;if(T(),M(`^`)){T();var m=A();if(m===null)throw SyntaxError(`In "`+e+`", "^" must be followed by a floating-point number`);p*=m}r.units.push({unit:f.unit,prefix:f.prefix,power:p});for(var h=0;h<te.length;h++)r.dimensions[h]+=(f.unit.dimensions[h]||0)*p;for(T();w===`)`;){if(c.length===0)throw SyntaxError(`Unmatched ")" in "`+S+`" at index `+C.toString());l/=c.pop(),O(),T()}if(a=!1,M(`*`)?(i=1,a=!0):M(`/`)?(i=-1,a=!0):i=1,f.unit.base){var v=f.unit.base.key;se.auto[v]={unit:f.unit,prefix:f.prefix}}}if(T(),w)throw SyntaxError(`Could not parse: "`+e+`"`);if(a)throw SyntaxError(`Trailing characters: "`+e+`"`);if(c.length!==0)throw SyntaxError(`Unmatched "(" in "`+S+`"`);if(r.units.length===0&&!t.allowNoUnits)throw SyntaxError(`"`+e+`" contains no units`);return r.value=s===void 0?null:r._normalize(s),r},x.prototype.clone=function(){var e=new x;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=mD(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var t=0;t<this.units.length;t++)for(var n in e.units[t]={},this.units[t])SD(this.units[t],n)&&(e.units[t][n]=this.units[t][n]);return e},x.prototype.valueType=function(){return pD(this.value)},x.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},x.prototype._normalize=function(e){if(e==null||this.units.length===0)return e;for(var t=e,n=x._getNumberConverter(pD(e)),r=0;r<this.units.length;r++){var i=n(this.units[r].unit.value),o=n(this.units[r].prefix.value),c=n(this.units[r].power);t=a(t,s(a(i,o),c))}return t},x.prototype._denormalize=function(e,t){if(e==null||this.units.length===0)return e;for(var n=e,r=x._getNumberConverter(pD(e)),i=0;i<this.units.length;i++){var c=r(this.units[i].unit.value),l=r(this.units[i].prefix.value),u=r(this.units[i].power);n=o(n,s(a(c,l),u))}return n};var N=cB(e=>{if(SD(ie,e)){var t=ie[e];return{unit:t,prefix:t.prefixes[``]}}for(var n in ie)if(SD(ie,n)&&WA(e,n)){var r=ie[n],i=e.length-n.length,a=e.substring(0,i),o=SD(r.prefixes,a)?r.prefixes[a]:void 0;if(o!==void 0)return{unit:r,prefix:o}}return null},{hasher:e=>e[0],limit:100});x.isValuelessUnit=function(e){return N(e)!==null},x.prototype.hasBase=function(e){if(typeof e==`string`&&(e=z[e]),!e)return!1;for(var t=0;t<te.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},x.prototype.equalBase=function(e){for(var t=0;t<te.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},x.prototype.equals=function(e){return this.equalBase(e)&&d(this.value,e.value)},x.prototype.multiply=function(e){for(var t=this.clone(),n=OE(e)?e:new x(e),r=0;r<te.length;r++)t.dimensions[r]=(this.dimensions[r]||0)+(n.dimensions[r]||0);for(var i=0;i<n.units.length;i++){var o=hB({},n.units[i]);t.units.push(o)}return this.value!==null||n.value!==null?t.value=a(this.value===null?this._normalize(F(n.value)):this.value,n.value===null?n._normalize(F(this.value)):n.value):t.value=null,OE(e)&&(t.skipAutomaticSimplification=!1),P(t)},x.prototype.divideInto=function(e){return new x(e).divide(this)},x.prototype.divide=function(e){for(var t=this.clone(),n=OE(e)?e:new x(e),r=0;r<te.length;r++)t.dimensions[r]=(this.dimensions[r]||0)-(n.dimensions[r]||0);for(var i=0;i<n.units.length;i++){var a=hB(hB({},n.units[i]),{},{power:-n.units[i].power});t.units.push(a)}return this.value!==null||n.value!==null?t.value=o(this.value===null?this._normalize(F(n.value)):this.value,n.value===null?n._normalize(F(this.value)):n.value):t.value=null,OE(e)&&(t.skipAutomaticSimplification=!1),P(t)},x.prototype.pow=function(e){for(var t=this.clone(),n=0;n<te.length;n++)t.dimensions[n]=(this.dimensions[n]||0)*e;for(var r=0;r<t.units.length;r++)t.units[r].power*=e;return t.value===null?t.value=null:t.value=s(t.value,e),t.skipAutomaticSimplification=!1,P(t)};function P(e){return e.equalBase(z.NONE)&&e.value!==null&&!n.predictable?e.value:e}function F(e){return x._getNumberConverter(pD(e))(1)}x.prototype.abs=function(){var e=this.clone();if(e.value!==null)if(e._isDerived()||e.units.length===0||e.units[0].unit.offset===0)e.value=c(e.value);else{var t=e._numberConverter(),n=a(t(e.units[0].unit.value),t(e.units[0].unit.offset));e.value=i(c(r(e.value,n)),n)}for(var o in e.units)(e.units[o].unit.name===`VA`||e.units[o].unit.name===`VAR`)&&(e.units[o].unit=ie.W);return e},x.prototype.to=function(e){var t=this.value===null?this._normalize(1):this.value,n;if(typeof e==`string`)n=x.parse(e);else if(OE(e))n=e.clone();else throw Error(`String or Unit expected as parameter`);if(!this.equalBase(n))throw Error(`Units do not match ('${n.toString()}' != '${this.toString()}')`);if(n.value!==null)throw Error(`Cannot convert to a unit with a value`);if(this.value===null||this._isDerived()||this.units.length===0||n.units.length===0||this.units[0].unit.offset===n.units[0].unit.offset)n.value=mD(t);else{var o=x._getNumberConverter(pD(t)),s=this.units[0].unit.value,c=this.units[0].unit.offset,l=a(s,c),u=n.units[0].unit.value,d=n.units[0].unit.offset,f=a(u,d);n.value=r(t,o(i(l,f)))}return n.fixPrefix=!0,n.skipAutomaticSimplification=!0,n},x.prototype.toNumber=function(e){return v(this.toNumeric(e))},x.prototype.toNumeric=function(e){var t=e?this.to(e):this.clone();return t._isDerived()||t.units.length===0?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},x.prototype.toString=function(){return this.format()},x.prototype.toJSON=function(){return{mathjs:`Unit`,value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix,skipSimp:this.skipAutomaticSimplification}},x.fromJSON=function(e){var t=new x(e.value,e.unit??void 0);return t.fixPrefix=e.fixPrefix??y,t.skipAutomaticSimplification=e.skipSimp??b,t},x.prototype.valueOf=x.prototype.toString,x.prototype.simplify=function(){var e=this.clone(),t=[],n;for(var r in ce)if(SD(ce,r)&&e.hasBase(z[r])){n=r;break}if(n===`NONE`)e.units=[];else{var i;if(n&&SD(ce,n)&&(i=ce[n]),i)e.units=[{unit:i.unit,prefix:i.prefix,power:1}];else{for(var a=!1,o=0;o<te.length;o++){var s=te[o];Math.abs(e.dimensions[o]||0)>1e-12&&(SD(ce,s)?t.push({unit:ce[s].unit,prefix:ce[s].prefix,power:e.dimensions[o]||0}):a=!0)}t.length<e.units.length&&!a&&(e.units=t)}}return e},x.prototype.toSI=function(){for(var e=this.clone(),t=[],n=0;n<te.length;n++){var r=te[n];if(Math.abs(e.dimensions[n]||0)>1e-12)if(SD(se.si,r))t.push({unit:se.si[r].unit,prefix:se.si[r].prefix,power:e.dimensions[n]||0});else throw Error(`Cannot express custom unit `+r+` in SI units`)}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,this.value===null?e:(e.value=null,this.to(e))},x.prototype.formatUnits=function(){for(var e=``,t=``,n=0,r=0,i=0;i<this.units.length;i++)this.units[i].power>0?(n++,e+=` `+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+=`^`+this.units[i].power)):this.units[i].power<0&&r++;if(r>0)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(n>0?(t+=` `+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(t+=`^`+-this.units[a].power)):(t+=` `+this.units[a].prefix.name+this.units[a].unit.name,t+=`^`+this.units[a].power));e=e.substr(1),t=t.substr(1),n>1&&r>0&&(e=`(`+e+`)`),r>1&&n>0&&(t=`(`+t+`)`);var o=e;return n>0&&r>0&&(o+=` / `),o+=t,o},x.prototype.toBest=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e&&!Array.isArray(e))throw Error(`Invalid unit type. Expected string or Unit.`);var n=this.units[0].unit.prefixes;if(e&&e.length>0){var r=e.map(e=>{var t=null;if(typeof e==`string`){if(t=x.parse(e),!t)throw Error(`Invalid unit type. Expected compatible string or Unit.`)}else if(!OE(e))throw Error(`Invalid unit type. Expected compatible string or Unit.`);t===null&&(t=e.clone());try{return this.to(t.formatUnits()),t}catch{throw Error(`Invalid unit type. Expected compatible string or Unit.`)}}).map(e=>e.units[0].prefix);this.units[0].unit.prefixes=r.reduce((e,t)=>(e[t.name]=t,e),{}),this.units[0].prefix=r[0]}var i=I(this,t).simp;return this.units[0].unit.prefixes=n,i.fixPrefix=!0,i},x.prototype.format=function(e){var{simp:t,valueStr:n,unitStr:r}=I(this,e),i=n;return t.value&&EE(t.value)&&(i=`(`+i+`)`),r.length>0&&i.length>0&&(i+=` `),i+=r,i};function I(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.skipAutomaticSimplification||e.value===null?e.clone():e.simplify();L(n),ee(n,t.offset);var r=n._denormalize(n.value);return{simp:n,valueStr:n.value===null?``:p(r,t||{}),unitStr:n.formatUnits()}}function L(e){var t=!1;for(var n in e.value!==void 0&&e.value!==null&&EE(e.value)&&(t=Math.abs(e.value.re)<1e-14),e.units)SD(e.units,n)&&e.units[n].unit&&(e.units[n].unit.name===`VA`&&t?e.units[n].unit=ie.VAR:e.units[n].unit.name===`VAR`&&!t&&(e.units[n].unit=ie.VA))}function ee(e,t){e.units.length===1&&!e.fixPrefix&&Math.abs(e.units[0].power-Math.round(e.units[0].power))<1e-14&&(e.units[0].prefix=e._bestPrefix(t))}x.prototype._bestPrefix=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1.2;if(this.units.length!==1||Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw Error(`Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!`);var t=this.value===null?0:c(this.value),n=c(this.units[0].unit.value),r=this.units[0].prefix;if(t===0)return r;var i=this.units[0].power,a=Math.log(t/(r.value*n)**+i)/Math.LN10-e;if(a>-2.200001&&a<1.800001)return r;a=Math.abs(a);var o=this.units[0].unit.prefixes;for(var s in o)if(SD(o,s)){var l=o[s];if(l.scientific){var u=Math.abs(Math.log(t/(l.value*n)**+i)/Math.LN10-e);(u<a||u===a&&l.name.length<r.name.length)&&(r=l,a=u)}}return r},x.prototype.splitUnit=function(e){for(var t=this.clone(),n=[],a=0;a<e.length&&(t=t.to(e[a]),a!==e.length-1);a++){var o=t.toNumeric(),s=u(o),c=void 0;c=d(s,o)?s:l(t.toNumeric());var f=new x(c,e[a].toString());n.push(f),t=i(t,f)}for(var p=0,m=0;m<n.length;m++)p=r(p,n[m].value);return d(p,this.value)&&(t.value=0),n.push(t),n};var R={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:0xe8d4a51000,scientific:!0},P:{name:`P`,value:0x38d7ea4c68000,scientific:!0},E:{name:`E`,value:0xde0b6b3a7640000,scientific:!0},Z:{name:`Z`,value:1e21,scientific:!0},Y:{name:`Y`,value:1e24,scientific:!0},R:{name:`R`,value:1e27,scientific:!0},Q:{name:`Q`,value:1e30,scientific:!0},d:{name:`d`,value:.1,scientific:!1},c:{name:`c`,value:.01,scientific:!1},m:{name:`m`,value:.001,scientific:!0},u:{name:`u`,value:1e-6,scientific:!0},n:{name:`n`,value:1e-9,scientific:!0},p:{name:`p`,value:1e-12,scientific:!0},f:{name:`f`,value:1e-15,scientific:!0},a:{name:`a`,value:1e-18,scientific:!0},z:{name:`z`,value:1e-21,scientific:!0},y:{name:`y`,value:1e-24,scientific:!0},r:{name:`r`,value:1e-27,scientific:!0},q:{name:`q`,value:1e-30,scientific:!0}},LONG:{"":{name:``,value:1,scientific:!0},deca:{name:`deca`,value:10,scientific:!1},hecto:{name:`hecto`,value:100,scientific:!1},kilo:{name:`kilo`,value:1e3,scientific:!0},mega:{name:`mega`,value:1e6,scientific:!0},giga:{name:`giga`,value:1e9,scientific:!0},tera:{name:`tera`,value:0xe8d4a51000,scientific:!0},peta:{name:`peta`,value:0x38d7ea4c68000,scientific:!0},exa:{name:`exa`,value:0xde0b6b3a7640000,scientific:!0},zetta:{name:`zetta`,value:1e21,scientific:!0},yotta:{name:`yotta`,value:1e24,scientific:!0},ronna:{name:`ronna`,value:1e27,scientific:!0},quetta:{name:`quetta`,value:1e30,scientific:!0},deci:{name:`deci`,value:.1,scientific:!1},centi:{name:`centi`,value:.01,scientific:!1},milli:{name:`milli`,value:.001,scientific:!0},micro:{name:`micro`,value:1e-6,scientific:!0},nano:{name:`nano`,value:1e-9,scientific:!0},pico:{name:`pico`,value:1e-12,scientific:!0},femto:{name:`femto`,value:1e-15,scientific:!0},atto:{name:`atto`,value:1e-18,scientific:!0},zepto:{name:`zepto`,value:1e-21,scientific:!0},yocto:{name:`yocto`,value:1e-24,scientific:!0},ronto:{name:`ronto`,value:1e-27,scientific:!0},quecto:{name:`quecto`,value:1e-30,scientific:!0}},SQUARED:{"":{name:``,value:1,scientific:!0},da:{name:`da`,value:100,scientific:!1},h:{name:`h`,value:1e4,scientific:!1},k:{name:`k`,value:1e6,scientific:!0},M:{name:`M`,value:0xe8d4a51000,scientific:!0},G:{name:`G`,value:0xde0b6b3a7640000,scientific:!0},T:{name:`T`,value:1e24,scientific:!0},P:{name:`P`,value:1e30,scientific:!0},E:{name:`E`,value:1e36,scientific:!0},Z:{name:`Z`,value:1e42,scientific:!0},Y:{name:`Y`,value:1e48,scientific:!0},R:{name:`R`,value:1e54,scientific:!0},Q:{name:`Q`,value:1e60,scientific:!0},d:{name:`d`,value:.01,scientific:!1},c:{name:`c`,value:1e-4,scientific:!1},m:{name:`m`,value:1e-6,scientific:!0},u:{name:`u`,value:1e-12,scientific:!0},n:{name:`n`,value:1e-18,scientific:!0},p:{name:`p`,value:1e-24,scientific:!0},f:{name:`f`,value:1e-30,scientific:!0},a:{name:`a`,value:1e-36,scientific:!0},z:{name:`z`,value:1e-42,scientific:!0},y:{name:`y`,value:1e-48,scientific:!0},r:{name:`r`,value:1e-54,scientific:!0},q:{name:`q`,value:1e-60,scientific:!0}},CUBIC:{"":{name:``,value:1,scientific:!0},da:{name:`da`,value:1e3,scientific:!1},h:{name:`h`,value:1e6,scientific:!1},k:{name:`k`,value:1e9,scientific:!0},M:{name:`M`,value:0xde0b6b3a7640000,scientific:!0},G:{name:`G`,value:1e27,scientific:!0},T:{name:`T`,value:1e36,scientific:!0},P:{name:`P`,value:1e45,scientific:!0},E:{name:`E`,value:1e54,scientific:!0},Z:{name:`Z`,value:1e63,scientific:!0},Y:{name:`Y`,value:1e72,scientific:!0},R:{name:`R`,value:1e81,scientific:!0},Q:{name:`Q`,value:1e90,scientific:!0},d:{name:`d`,value:.001,scientific:!1},c:{name:`c`,value:1e-6,scientific:!1},m:{name:`m`,value:1e-9,scientific:!0},u:{name:`u`,value:1e-18,scientific:!0},n:{name:`n`,value:1e-27,scientific:!0},p:{name:`p`,value:1e-36,scientific:!0},f:{name:`f`,value:1e-45,scientific:!0},a:{name:`a`,value:1e-54,scientific:!0},z:{name:`z`,value:1e-63,scientific:!0},y:{name:`y`,value:1e-72,scientific:!0},r:{name:`r`,value:1e-81,scientific:!0},q:{name:`q`,value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:``,value:1,scientific:!0},k:{name:`k`,value:1e3,scientific:!0},M:{name:`M`,value:1e6,scientific:!0},G:{name:`G`,value:1e9,scientific:!0},T:{name:`T`,value:0xe8d4a51000,scientific:!0},P:{name:`P`,value:0x38d7ea4c68000,scientific:!0},E:{name:`E`,value:0xde0b6b3a7640000,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:1024**2,scientific:!0},Gi:{name:`Gi`,value:1024**3,scientific:!0},Ti:{name:`Ti`,value:1024**4,scientific:!0},Pi:{name:`Pi`,value:1024**5,scientific:!0},Ei:{name:`Ei`,value:1024**6,scientific:!0},Zi:{name:`Zi`,value:1024**7,scientific:!0},Yi:{name:`Yi`,value: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:0xe8d4a51000,scientific:!0},peta:{name:`peta`,value:0x38d7ea4c68000,scientific:!0},exa:{name:`exa`,value:0xde0b6b3a7640000,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:1024**2,scientific:!0},gibi:{name:`gibi`,value:1024**3,scientific:!0},tebi:{name:`tebi`,value:1024**4,scientific:!0},pebi:{name:`pebi`,value:1024**5,scientific:!0},exi:{name:`exi`,value:1024**6,scientific:!0},zebi:{name:`zebi`,value:1024**7,scientific:!0},yobi:{name:`yobi`,value:1024**8,scientific:!0}},BTU:{"":{name:``,value:1,scientific:!0},MM:{name:`MM`,value:1e6,scientific:!0}}};R.SHORTLONG=oE({},R.SHORT,R.LONG),R.BINARY_SHORT=oE({},R.BINARY_SHORT_SI,R.BINARY_SHORT_IEC),R.BINARY_LONG=oE({},R.BINARY_LONG_SI,R.BINARY_LONG_IEC);var te=[`MASS`,`LENGTH`,`TIME`,`CURRENT`,`TEMPERATURE`,`LUMINOUS_INTENSITY`,`AMOUNT_OF_SUBSTANCE`,`ANGLE`,`BIT`],z={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 ne in z)SD(z,ne)&&(z[ne].key=ne);var re={name:``,base:{},value:1,offset:0,dimensions:te.map(e=>0)},ie={meter:{name:`meter`,base:z.LENGTH,prefixes:R.LONG,value:1,offset:0},inch:{name:`inch`,base:z.LENGTH,prefixes:R.NONE,value:.0254,offset:0},foot:{name:`foot`,base:z.LENGTH,prefixes:R.NONE,value:.3048,offset:0},yard:{name:`yard`,base:z.LENGTH,prefixes:R.NONE,value:.9144,offset:0},mile:{name:`mile`,base:z.LENGTH,prefixes:R.NONE,value:1609.344,offset:0},link:{name:`link`,base:z.LENGTH,prefixes:R.NONE,value:.201168,offset:0},rod:{name:`rod`,base:z.LENGTH,prefixes:R.NONE,value:5.0292,offset:0},chain:{name:`chain`,base:z.LENGTH,prefixes:R.NONE,value:20.1168,offset:0},angstrom:{name:`angstrom`,base:z.LENGTH,prefixes:R.NONE,value:1e-10,offset:0},m:{name:`m`,base:z.LENGTH,prefixes:R.SHORT,value:1,offset:0},in:{name:`in`,base:z.LENGTH,prefixes:R.NONE,value:.0254,offset:0},ft:{name:`ft`,base:z.LENGTH,prefixes:R.NONE,value:.3048,offset:0},yd:{name:`yd`,base:z.LENGTH,prefixes:R.NONE,value:.9144,offset:0},mi:{name:`mi`,base:z.LENGTH,prefixes:R.NONE,value:1609.344,offset:0},li:{name:`li`,base:z.LENGTH,prefixes:R.NONE,value:.201168,offset:0},rd:{name:`rd`,base:z.LENGTH,prefixes:R.NONE,value:5.02921,offset:0},ch:{name:`ch`,base:z.LENGTH,prefixes:R.NONE,value:20.1168,offset:0},mil:{name:`mil`,base:z.LENGTH,prefixes:R.NONE,value:254e-7,offset:0},m2:{name:`m2`,base:z.SURFACE,prefixes:R.SQUARED,value:1,offset:0},sqin:{name:`sqin`,base:z.SURFACE,prefixes:R.NONE,value:64516e-8,offset:0},sqft:{name:`sqft`,base:z.SURFACE,prefixes:R.NONE,value:.09290304,offset:0},sqyd:{name:`sqyd`,base:z.SURFACE,prefixes:R.NONE,value:.83612736,offset:0},sqmi:{name:`sqmi`,base:z.SURFACE,prefixes:R.NONE,value:2589988.110336,offset:0},sqrd:{name:`sqrd`,base:z.SURFACE,prefixes:R.NONE,value:25.29295,offset:0},sqch:{name:`sqch`,base:z.SURFACE,prefixes:R.NONE,value:404.6873,offset:0},sqmil:{name:`sqmil`,base:z.SURFACE,prefixes:R.NONE,value:64516e-14,offset:0},acre:{name:`acre`,base:z.SURFACE,prefixes:R.NONE,value:4046.86,offset:0},hectare:{name:`hectare`,base:z.SURFACE,prefixes:R.NONE,value:1e4,offset:0},m3:{name:`m3`,base:z.VOLUME,prefixes:R.CUBIC,value:1,offset:0},L:{name:`L`,base:z.VOLUME,prefixes:R.SHORT,value:.001,offset:0},l:{name:`l`,base:z.VOLUME,prefixes:R.SHORT,value:.001,offset:0},litre:{name:`litre`,base:z.VOLUME,prefixes:R.LONG,value:.001,offset:0},cuin:{name:`cuin`,base:z.VOLUME,prefixes:R.NONE,value:16387064e-12,offset:0},cuft:{name:`cuft`,base:z.VOLUME,prefixes:R.NONE,value:.028316846592,offset:0},cuyd:{name:`cuyd`,base:z.VOLUME,prefixes:R.NONE,value:.764554857984,offset:0},teaspoon:{name:`teaspoon`,base:z.VOLUME,prefixes:R.NONE,value:5e-6,offset:0},tablespoon:{name:`tablespoon`,base:z.VOLUME,prefixes:R.NONE,value:15e-6,offset:0},drop:{name:`drop`,base:z.VOLUME,prefixes:R.NONE,value:5e-8,offset:0},gtt:{name:`gtt`,base:z.VOLUME,prefixes:R.NONE,value:5e-8,offset:0},minim:{name:`minim`,base:z.VOLUME,prefixes:R.NONE,value:6.1611519921875e-8,offset:0},fluiddram:{name:`fluiddram`,base:z.VOLUME,prefixes:R.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:`fluidounce`,base:z.VOLUME,prefixes:R.NONE,value:295735295625e-16,offset:0},gill:{name:`gill`,base:z.VOLUME,prefixes:R.NONE,value:.00011829411825,offset:0},cc:{name:`cc`,base:z.VOLUME,prefixes:R.NONE,value:1e-6,offset:0},cup:{name:`cup`,base:z.VOLUME,prefixes:R.NONE,value:.0002365882365,offset:0},pint:{name:`pint`,base:z.VOLUME,prefixes:R.NONE,value:.000473176473,offset:0},quart:{name:`quart`,base:z.VOLUME,prefixes:R.NONE,value:.000946352946,offset:0},gallon:{name:`gallon`,base:z.VOLUME,prefixes:R.NONE,value:.003785411784,offset:0},beerbarrel:{name:`beerbarrel`,base:z.VOLUME,prefixes:R.NONE,value:.117347765304,offset:0},oilbarrel:{name:`oilbarrel`,base:z.VOLUME,prefixes:R.NONE,value:.158987294928,offset:0},hogshead:{name:`hogshead`,base:z.VOLUME,prefixes:R.NONE,value:.238480942392,offset:0},g:{name:`g`,base:z.MASS,prefixes:R.SHORT,value:.001,offset:0},gram:{name:`gram`,base:z.MASS,prefixes:R.LONG,value:.001,offset:0},ton:{name:`ton`,base:z.MASS,prefixes:R.SHORT,value:907.18474,offset:0},t:{name:`t`,base:z.MASS,prefixes:R.SHORT,value:1e3,offset:0},tonne:{name:`tonne`,base:z.MASS,prefixes:R.LONG,value:1e3,offset:0},grain:{name:`grain`,base:z.MASS,prefixes:R.NONE,value:6479891e-11,offset:0},dram:{name:`dram`,base:z.MASS,prefixes:R.NONE,value:.0017718451953125,offset:0},ounce:{name:`ounce`,base:z.MASS,prefixes:R.NONE,value:.028349523125,offset:0},poundmass:{name:`poundmass`,base:z.MASS,prefixes:R.NONE,value:.45359237,offset:0},hundredweight:{name:`hundredweight`,base:z.MASS,prefixes:R.NONE,value:45.359237,offset:0},stick:{name:`stick`,base:z.MASS,prefixes:R.NONE,value:.115,offset:0},stone:{name:`stone`,base:z.MASS,prefixes:R.NONE,value:6.35029318,offset:0},gr:{name:`gr`,base:z.MASS,prefixes:R.NONE,value:6479891e-11,offset:0},dr:{name:`dr`,base:z.MASS,prefixes:R.NONE,value:.0017718451953125,offset:0},oz:{name:`oz`,base:z.MASS,prefixes:R.NONE,value:.028349523125,offset:0},lbm:{name:`lbm`,base:z.MASS,prefixes:R.NONE,value:.45359237,offset:0},cwt:{name:`cwt`,base:z.MASS,prefixes:R.NONE,value:45.359237,offset:0},s:{name:`s`,base:z.TIME,prefixes:R.SHORT,value:1,offset:0},min:{name:`min`,base:z.TIME,prefixes:R.NONE,value:60,offset:0},h:{name:`h`,base:z.TIME,prefixes:R.NONE,value:3600,offset:0},second:{name:`second`,base:z.TIME,prefixes:R.LONG,value:1,offset:0},sec:{name:`sec`,base:z.TIME,prefixes:R.LONG,value:1,offset:0},minute:{name:`minute`,base:z.TIME,prefixes:R.NONE,value:60,offset:0},hour:{name:`hour`,base:z.TIME,prefixes:R.NONE,value:3600,offset:0},day:{name:`day`,base:z.TIME,prefixes:R.NONE,value:86400,offset:0},week:{name:`week`,base:z.TIME,prefixes:R.NONE,value:7*86400,offset:0},month:{name:`month`,base:z.TIME,prefixes:R.NONE,value:2629800,offset:0},year:{name:`year`,base:z.TIME,prefixes:R.NONE,value:31557600,offset:0},decade:{name:`decade`,base:z.TIME,prefixes:R.NONE,value:315576e3,offset:0},century:{name:`century`,base:z.TIME,prefixes:R.NONE,value:315576e4,offset:0},millennium:{name:`millennium`,base:z.TIME,prefixes:R.NONE,value:315576e5,offset:0},hertz:{name:`Hertz`,base:z.FREQUENCY,prefixes:R.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:`Hz`,base:z.FREQUENCY,prefixes:R.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:`rad`,base:z.ANGLE,prefixes:R.SHORT,value:1,offset:0},radian:{name:`radian`,base:z.ANGLE,prefixes:R.LONG,value:1,offset:0},deg:{name:`deg`,base:z.ANGLE,prefixes:R.SHORT,value:null,offset:0},degree:{name:`degree`,base:z.ANGLE,prefixes:R.LONG,value:null,offset:0},grad:{name:`grad`,base:z.ANGLE,prefixes:R.SHORT,value:null,offset:0},gradian:{name:`gradian`,base:z.ANGLE,prefixes:R.LONG,value:null,offset:0},cycle:{name:`cycle`,base:z.ANGLE,prefixes:R.NONE,value:null,offset:0},arcsec:{name:`arcsec`,base:z.ANGLE,prefixes:R.NONE,value:null,offset:0},arcmin:{name:`arcmin`,base:z.ANGLE,prefixes:R.NONE,value:null,offset:0},A:{name:`A`,base:z.CURRENT,prefixes:R.SHORT,value:1,offset:0},ampere:{name:`ampere`,base:z.CURRENT,prefixes:R.LONG,value:1,offset:0},K:{name:`K`,base:z.TEMPERATURE,prefixes:R.SHORT,value:1,offset:0},degC:{name:`degC`,base:z.TEMPERATURE,prefixes:R.SHORT,value:1,offset:273.15},degF:{name:`degF`,base:z.TEMPERATURE,prefixes:R.SHORT,value:new _(5,9),offset:459.67},degR:{name:`degR`,base:z.TEMPERATURE,prefixes:R.SHORT,value:new _(5,9),offset:0},kelvin:{name:`kelvin`,base:z.TEMPERATURE,prefixes:R.LONG,value:1,offset:0},celsius:{name:`celsius`,base:z.TEMPERATURE,prefixes:R.LONG,value:1,offset:273.15},fahrenheit:{name:`fahrenheit`,base:z.TEMPERATURE,prefixes:R.LONG,value:new _(5,9),offset:459.67},rankine:{name:`rankine`,base:z.TEMPERATURE,prefixes:R.LONG,value:new _(5,9),offset:0},mol:{name:`mol`,base:z.AMOUNT_OF_SUBSTANCE,prefixes:R.SHORT,value:1,offset:0},mole:{name:`mole`,base:z.AMOUNT_OF_SUBSTANCE,prefixes:R.LONG,value:1,offset:0},cd:{name:`cd`,base:z.LUMINOUS_INTENSITY,prefixes:R.SHORT,value:1,offset:0},candela:{name:`candela`,base:z.LUMINOUS_INTENSITY,prefixes:R.LONG,value:1,offset:0},N:{name:`N`,base:z.FORCE,prefixes:R.SHORT,value:1,offset:0},newton:{name:`newton`,base:z.FORCE,prefixes:R.LONG,value:1,offset:0},dyn:{name:`dyn`,base:z.FORCE,prefixes:R.SHORT,value:1e-5,offset:0},dyne:{name:`dyne`,base:z.FORCE,prefixes:R.LONG,value:1e-5,offset:0},lbf:{name:`lbf`,base:z.FORCE,prefixes:R.NONE,value:4.4482216152605,offset:0},poundforce:{name:`poundforce`,base:z.FORCE,prefixes:R.NONE,value:4.4482216152605,offset:0},kip:{name:`kip`,base:z.FORCE,prefixes:R.LONG,value:4448.2216,offset:0},kilogramforce:{name:`kilogramforce`,base:z.FORCE,prefixes:R.NONE,value:9.80665,offset:0},J:{name:`J`,base:z.ENERGY,prefixes:R.SHORT,value:1,offset:0},joule:{name:`joule`,base:z.ENERGY,prefixes:R.LONG,value:1,offset:0},erg:{name:`erg`,base:z.ENERGY,prefixes:R.SHORTLONG,value:1e-7,offset:0},Wh:{name:`Wh`,base:z.ENERGY,prefixes:R.SHORT,value:3600,offset:0},BTU:{name:`BTU`,base:z.ENERGY,prefixes:R.BTU,value:1055.05585262,offset:0},eV:{name:`eV`,base:z.ENERGY,prefixes:R.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:`electronvolt`,base:z.ENERGY,prefixes:R.LONG,value:1602176565e-28,offset:0},W:{name:`W`,base:z.POWER,prefixes:R.SHORT,value:1,offset:0},watt:{name:`watt`,base:z.POWER,prefixes:R.LONG,value:1,offset:0},hp:{name:`hp`,base:z.POWER,prefixes:R.NONE,value:745.6998715386,offset:0},VAR:{name:`VAR`,base:z.POWER,prefixes:R.SHORT,value:h.I,offset:0},VA:{name:`VA`,base:z.POWER,prefixes:R.SHORT,value:1,offset:0},Pa:{name:`Pa`,base:z.PRESSURE,prefixes:R.SHORT,value:1,offset:0},psi:{name:`psi`,base:z.PRESSURE,prefixes:R.NONE,value:6894.75729276459,offset:0},atm:{name:`atm`,base:z.PRESSURE,prefixes:R.NONE,value:101325,offset:0},bar:{name:`bar`,base:z.PRESSURE,prefixes:R.SHORTLONG,value:1e5,offset:0},torr:{name:`torr`,base:z.PRESSURE,prefixes:R.NONE,value:133.322,offset:0},mmHg:{name:`mmHg`,base:z.PRESSURE,prefixes:R.NONE,value:133.322,offset:0},mmH2O:{name:`mmH2O`,base:z.PRESSURE,prefixes:R.NONE,value:9.80665,offset:0},cmH2O:{name:`cmH2O`,base:z.PRESSURE,prefixes:R.NONE,value:98.0665,offset:0},coulomb:{name:`coulomb`,base:z.ELECTRIC_CHARGE,prefixes:R.LONG,value:1,offset:0},C:{name:`C`,base:z.ELECTRIC_CHARGE,prefixes:R.SHORT,value:1,offset:0},Ah:{name:`Ah`,base:z.ELECTRIC_CHARGE,prefixes:R.SHORT,value:3600,offset:0},farad:{name:`farad`,base:z.ELECTRIC_CAPACITANCE,prefixes:R.LONG,value:1,offset:0},F:{name:`F`,base:z.ELECTRIC_CAPACITANCE,prefixes:R.SHORT,value:1,offset:0},volt:{name:`volt`,base:z.ELECTRIC_POTENTIAL,prefixes:R.LONG,value:1,offset:0},V:{name:`V`,base:z.ELECTRIC_POTENTIAL,prefixes:R.SHORT,value:1,offset:0},ohm:{name:`ohm`,base:z.ELECTRIC_RESISTANCE,prefixes:R.SHORTLONG,value:1,offset:0},henry:{name:`henry`,base:z.ELECTRIC_INDUCTANCE,prefixes:R.LONG,value:1,offset:0},H:{name:`H`,base:z.ELECTRIC_INDUCTANCE,prefixes:R.SHORT,value:1,offset:0},siemens:{name:`siemens`,base:z.ELECTRIC_CONDUCTANCE,prefixes:R.LONG,value:1,offset:0},S:{name:`S`,base:z.ELECTRIC_CONDUCTANCE,prefixes:R.SHORT,value:1,offset:0},weber:{name:`weber`,base:z.MAGNETIC_FLUX,prefixes:R.LONG,value:1,offset:0},Wb:{name:`Wb`,base:z.MAGNETIC_FLUX,prefixes:R.SHORT,value:1,offset:0},tesla:{name:`tesla`,base:z.MAGNETIC_FLUX_DENSITY,prefixes:R.LONG,value:1,offset:0},T:{name:`T`,base:z.MAGNETIC_FLUX_DENSITY,prefixes:R.SHORT,value:1,offset:0},b:{name:`b`,base:z.BIT,prefixes:R.BINARY_SHORT,value:1,offset:0},bits:{name:`bits`,base:z.BIT,prefixes:R.BINARY_LONG,value:1,offset:0},B:{name:`B`,base:z.BIT,prefixes:R.BINARY_SHORT,value:8,offset:0},bytes:{name:`bytes`,base:z.BIT,prefixes:R.BINARY_LONG,value:8,offset:0}},ae={meters:`meter`,inches:`inch`,feet:`foot`,yards:`yard`,miles:`mile`,links:`link`,rods:`rod`,chains:`chain`,angstroms:`angstrom`,lt:`l`,litres:`litre`,liter:`litre`,liters:`litre`,teaspoons:`teaspoon`,tablespoons:`tablespoon`,minims:`minim`,fldr:`fluiddram`,fluiddrams:`fluiddram`,floz:`fluidounce`,fluidounces:`fluidounce`,gi:`gill`,gills:`gill`,cp:`cup`,cups:`cup`,pt:`pint`,pints:`pint`,qt:`quart`,quarts:`quart`,gal:`gallon`,gallons:`gallon`,bbl:`beerbarrel`,beerbarrels:`beerbarrel`,obl:`oilbarrel`,oilbarrels:`oilbarrel`,hogsheads:`hogshead`,gtts:`gtt`,grams:`gram`,tons:`ton`,tonnes:`tonne`,grains:`grain`,drams:`dram`,ounces:`ounce`,poundmasses:`poundmass`,hundredweights:`hundredweight`,sticks:`stick`,lb:`lbm`,lbs:`lbm`,kips:`kip`,kgf:`kilogramforce`,acres:`acre`,hectares:`hectare`,sqfeet:`sqft`,sqyard:`sqyd`,sqmile:`sqmi`,sqmiles:`sqmi`,mmhg:`mmHg`,mmh2o:`mmH2O`,cmh2o:`cmH2O`,seconds:`second`,secs:`second`,minutes:`minute`,mins:`minute`,hours:`hour`,hr:`hour`,hrs:`hour`,days:`day`,weeks:`week`,months:`month`,years:`year`,decades:`decade`,centuries:`century`,millennia:`millennium`,hertz:`hertz`,radians:`radian`,degrees:`degree`,gradians:`gradian`,cycles:`cycle`,arcsecond:`arcsec`,arcseconds:`arcsec`,arcminute:`arcmin`,arcminutes:`arcmin`,BTUs:`BTU`,watts:`watt`,joules:`joule`,amperes:`ampere`,amps:`ampere`,amp:`ampere`,coulombs:`coulomb`,volts:`volt`,ohms:`ohm`,farads:`farad`,webers:`weber`,teslas:`tesla`,electronvolts:`electronvolt`,moles:`mole`,bit:`bits`,byte:`bytes`};function oe(e){if(e.number===`BigNumber`){var t=dB(g);ie.rad.value=new g(1),ie.deg.value=t.div(180),ie.grad.value=t.div(200),ie.cycle.value=t.times(2),ie.arcsec.value=t.div(648e3),ie.arcmin.value=t.div(10800)}else ie.rad.value=1,ie.deg.value=Math.PI/180,ie.grad.value=Math.PI/200,ie.cycle.value=Math.PI*2,ie.arcsec.value=Math.PI/648e3,ie.arcmin.value=Math.PI/10800;ie.radian.value=ie.rad.value,ie.degree.value=ie.deg.value,ie.gradian.value=ie.grad.value}oe(n),t&&t(`config`,function(e,t){e.number!==t.number&&oe(e)});var se={si:{NONE:{unit:re,prefix:R.NONE[``]},LENGTH:{unit:ie.m,prefix:R.SHORT[``]},MASS:{unit:ie.g,prefix:R.SHORT.k},TIME:{unit:ie.s,prefix:R.SHORT[``]},CURRENT:{unit:ie.A,prefix:R.SHORT[``]},TEMPERATURE:{unit:ie.K,prefix:R.SHORT[``]},LUMINOUS_INTENSITY:{unit:ie.cd,prefix:R.SHORT[``]},AMOUNT_OF_SUBSTANCE:{unit:ie.mol,prefix:R.SHORT[``]},ANGLE:{unit:ie.rad,prefix:R.SHORT[``]},BIT:{unit:ie.bits,prefix:R.SHORT[``]},FORCE:{unit:ie.N,prefix:R.SHORT[``]},ENERGY:{unit:ie.J,prefix:R.SHORT[``]},POWER:{unit:ie.W,prefix:R.SHORT[``]},PRESSURE:{unit:ie.Pa,prefix:R.SHORT[``]},ELECTRIC_CHARGE:{unit:ie.C,prefix:R.SHORT[``]},ELECTRIC_CAPACITANCE:{unit:ie.F,prefix:R.SHORT[``]},ELECTRIC_POTENTIAL:{unit:ie.V,prefix:R.SHORT[``]},ELECTRIC_RESISTANCE:{unit:ie.ohm,prefix:R.SHORT[``]},ELECTRIC_INDUCTANCE:{unit:ie.H,prefix:R.SHORT[``]},ELECTRIC_CONDUCTANCE:{unit:ie.S,prefix:R.SHORT[``]},MAGNETIC_FLUX:{unit:ie.Wb,prefix:R.SHORT[``]},MAGNETIC_FLUX_DENSITY:{unit:ie.T,prefix:R.SHORT[``]},FREQUENCY:{unit:ie.Hz,prefix:R.SHORT[``]}}};se.cgs=JSON.parse(JSON.stringify(se.si)),se.cgs.LENGTH={unit:ie.m,prefix:R.SHORT.c},se.cgs.MASS={unit:ie.g,prefix:R.SHORT[``]},se.cgs.FORCE={unit:ie.dyn,prefix:R.SHORT[``]},se.cgs.ENERGY={unit:ie.erg,prefix:R.NONE[``]},se.us=JSON.parse(JSON.stringify(se.si)),se.us.LENGTH={unit:ie.ft,prefix:R.NONE[``]},se.us.MASS={unit:ie.lbm,prefix:R.NONE[``]},se.us.TEMPERATURE={unit:ie.degF,prefix:R.NONE[``]},se.us.FORCE={unit:ie.lbf,prefix:R.NONE[``]},se.us.ENERGY={unit:ie.BTU,prefix:R.BTU[``]},se.us.POWER={unit:ie.hp,prefix:R.NONE[``]},se.us.PRESSURE={unit:ie.psi,prefix:R.NONE[``]},se.auto=JSON.parse(JSON.stringify(se.si));var ce=se.auto;for(var le in x.setUnitSystem=function(e){if(SD(se,e))ce=se[e];else throw Error(`Unit system `+e+` does not exist. Choices are: `+Object.keys(se).join(`, `))},x.getUnitSystem=function(){for(var e in se)if(SD(se,e)&&se[e]===ce)return e},x.typeConverters={BigNumber:function(e){return e!=null&&e.isFraction?new g(String(e.n)).div(String(e.d)).times(String(e.s)):new g(e+``)},Fraction:function(e){return new _(e)},Complex:function(e){return e},number:function(e){return e!=null&&e.isFraction?m(e):e}},x.prototype._numberConverter=function(){var e=x.typeConverters[this.valueType()];if(e)return e;throw TypeError(`Unsupported Unit value type "`+this.valueType()+`"`)},x._getNumberConverter=function(e){if(!x.typeConverters[e])throw TypeError(`Unsupported type "`+e+`"`);return x.typeConverters[e]},ie)if(SD(ie,le)){var ue=ie[le];ue.dimensions=ue.base.dimensions}for(var de in ae)if(SD(ae,de)){var fe=ie[ae[de]],pe={};for(var me in fe)SD(fe,me)&&(pe[me]=fe[me]);pe.name=de,ie[de]=pe}x.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)};function he(e){for(var t=0;t<e.length;t++){if(w=e.charAt(t),t===0&&!x.isValidAlpha(w))throw Error(`Invalid unit name (must begin with alpha character): "`+e+`"`);if(t>0&&!(x.isValidAlpha(w)||D(w)))throw Error(`Invalid unit name (only alphanumeric characters are allowed): "`+e+`"`)}}return x.createUnit=function(e,t){if(typeof e!=`object`)throw TypeError(`createUnit expects first parameter to be of type 'Object'`);if(t&&t.override){for(var n in e)if(SD(e,n)&&x.deleteUnit(n),e[n].aliases)for(var r=0;r<e[n].aliases.length;r++)x.deleteUnit(e[n].aliases[r])}var i;for(var a in e)SD(e,a)&&(i=x.createUnitSingle(a,e[a]));return i},x.createUnitSingle=function(e,t){if(t??={},typeof e!=`string`)throw TypeError(`createUnitSingle expects first parameter to be of type 'string'`);if(SD(ie,e))throw Error(`Cannot create unit "`+e+`": a unit with that name already exists`);he(e);var n=null,r=[],i=0,a,o,s;if(t&&t.type===`Unit`)n=t.clone();else if(typeof t==`string`)t!==``&&(a=t);else if(typeof t==`object`)a=t.definition,o=t.prefixes,i=t.offset,s=t.baseName,t.aliases&&(r=t.aliases.valueOf());else throw TypeError(`Cannot create unit "`+e+`" from "`+t.toString()+`": expecting "string" or "Unit" or "Object"`);if(r){for(var c=0;c<r.length;c++)if(SD(ie,r[c]))throw Error(`Cannot create alias "`+r[c]+`": a unit with that name already exists`)}if(a&&typeof a==`string`&&!n)try{n=x.parse(a,{allowNoUnits:!0})}catch(t){throw t.message=`Could not create unit "`+e+`" from "`+a+`": `+t.message,t}else a&&a.type===`Unit`&&(n=a.clone());r||=[],i||=0,o=o&&o.toUpperCase&&R[o.toUpperCase()]||R.NONE;var l={};if(n){l={name:e,value:n.value,dimensions:n.dimensions.slice(0),prefixes:o,offset:i};var u=!1;for(var d in z)if(SD(z,d)){for(var f=!0,p=0;p<te.length;p++)if(Math.abs((l.dimensions[p]||0)-(z[d].dimensions[p]||0))>1e-12){f=!1;break}if(f){u=!0,l.base=z[d];break}}if(!u){s||=e+`_STUFF`;var m={dimensions:n.dimensions.slice(0)};m.key=s,z[s]=m,ce[s]={unit:l,prefix:R.NONE[``]},l.base=z[s]}}else{if(s||=e+`_STUFF`,te.indexOf(s)>=0)throw Error(`Cannot create new base unit "`+e+`": a base unit with that name already exists (and cannot be overridden)`);for(var h in te.push(s),z)SD(z,h)&&(z[h].dimensions[te.length-1]=0);for(var g={dimensions:[]},_=0;_<te.length;_++)g.dimensions[_]=0;g.dimensions[te.length-1]=1,g.key=s,z[s]=g,l={name:e,value:1,dimensions:z[s].dimensions.slice(0),prefixes:o,offset:i,base:z[s]},ce[s]={unit:l,prefix:R.NONE[``]}}x.UNITS[e]=l;for(var v=0;v<r.length;v++){var y=r[v],b={};for(var S in l)SD(l,S)&&(b[S]=l[S]);b.name=y,x.UNITS[y]=b}return delete N.cache,new x(null,e)},x.deleteUnit=function(e){delete x.UNITS[e],delete N.cache},x.PREFIXES=R,x.BASE_DIMENSIONS=te,x.BASE_UNITS=z,x.UNIT_SYSTEMS=se,x.UNITS=ie,x},{isClass:!0}),_B=`unit`,vB=Z(_B,[`typed`,`Unit`],e=>{var{typed:t,Unit:n}=e;return t(_B,{Unit:function(e){return e.clone()},string:function(e){return n.isValuelessUnit(e)?new n(null,e):n.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new n(e,t)},"number | BigNumber | Fraction":function(e){return new n(e)},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),yB=`sparse`,bB=Z(yB,[`typed`,`SparseMatrix`],e=>{var{typed:t,SparseMatrix:n}=e;return t(yB,{"":function(){return new n([])},string:function(e){return new n([],e)},"Array | Matrix":function(e){return new n(e)},"Array | Matrix, string":function(e,t){return new n(e,t)}})}),xB=`createUnit`,SB=Z(xB,[`typed`,`Unit`],e=>{var{typed:t,Unit:n}=e;return t(xB,{"Object, Object":function(e,t){return n.createUnit(e,t)},Object:function(e){return n.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,r){var i={};return i[e]=t,n.createUnit(i,r)},"string, Unit | string | Object":function(e,t){var r={};return r[e]=t,n.createUnit(r,{})},string:function(e){var t={};return t[e]={},n.createUnit(t,{})}})}),CB=`acos`,wB=Z(CB,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(CB,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.acos(e):new r(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})}),TB=`acosh`,EB=Z(TB,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(TB,{number:function(e){return e>=1||n.predictable?iN(e):e<=-1?new r(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new r(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})}),DB=`acot`,OB=Z(DB,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(DB,{number:aN,Complex:function(e){return e.acot()},BigNumber:function(e){return new n(1).div(e).atan()}})}),kB=`acoth`,AB=Z(kB,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(kB,{number:function(e){return e>=1||e<=-1||n.predictable?oN(e):new r(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})}),jB=`acsc`,MB=Z(jB,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(jB,{number:function(e){return e<=-1||e>=1||n.predictable?sN(e):new r(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})}),NB=`acsch`,PB=Z(NB,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(NB,{number:cN,Complex:function(e){return e.acsch()},BigNumber:function(e){return new n(1).div(e).asinh()}})}),FB=`asec`,IB=Z(FB,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(FB,{number:function(e){return e<=-1||e>=1||n.predictable?lN(e):new r(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})}),LB=`asech`,RB=Z(LB,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(LB,{number:function(e){if(e<=1&&e>=-1||n.predictable){var t=1/e;if(t>0||n.predictable)return uN(e);var i=Math.sqrt(t*t-1);return new r(Math.log(i-t),Math.PI)}return new r(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})}),zB=`asin`,BB=Z(zB,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(zB,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.asin(e):new r(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})}),VB=Z(`asinh`,[`typed`],e=>{var{typed:t}=e;return t(`asinh`,{number:fN,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})}),HB=Z(`atan`,[`typed`],e=>{var{typed:t}=e;return t(`atan`,{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})}),UB=`atan2`,WB=Z(UB,[`typed`,`matrix`,`equalScalar`,`BigNumber`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,BigNumber:i,DenseMatrix:a,concat:o}=e,s=fF({typed:t,equalScalar:r}),c=pF({typed:t}),l=rI({typed:t,equalScalar:r}),u=UP({typed:t,equalScalar:r}),d=WP({typed:t,DenseMatrix:a}),f=vF({typed:t,matrix:n,concat:o});return t(UB,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,t)=>i.atan2(e,t)},f({scalar:`number | BigNumber`,SS:l,DS:c,SD:s,Ss:u,sS:d}))}),GB=`atanh`,KB=Z(GB,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(GB,{number:function(e){return e<=1&&e>=-1||n.predictable?hN(e):new r(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})}),qB=Z(`trigUnit`,[`typed`],e=>{var{typed:t}=e;return{Unit:t.referToSelf(e=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw TypeError(`Unit in function cot is no angle`);return t.find(e,n.valueType())(n.value)})}}),JB=`cos`,YB=Z(JB,[`typed`],e=>{var{typed:t}=e,n=qB({typed:t});return t(JB,{number:Math.cos,"Complex | BigNumber":e=>e.cos()},n)}),XB=`cosh`,ZB=Z(XB,[`typed`],e=>{var{typed:t}=e;return t(XB,{number:rO,"Complex | BigNumber":e=>e.cosh()})}),QB=`cot`,$B=Z(QB,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e,r=qB({typed:t});return t(QB,{number:vN,Complex:e=>e.cot(),BigNumber:e=>new n(1).div(e.tan())},r)}),eV=`coth`,tV=Z(eV,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(eV,{number:yN,Complex:e=>e.coth(),BigNumber:e=>new n(1).div(e.tanh())})}),nV=`csc`,rV=Z(nV,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e,r=qB({typed:t});return t(nV,{number:bN,Complex:e=>e.csc(),BigNumber:e=>new n(1).div(e.sin())},r)}),iV=`csch`,aV=Z(iV,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(iV,{number:xN,Complex:e=>e.csch(),BigNumber:e=>new n(1).div(e.sinh())})}),oV=`sec`,sV=Z(oV,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e,r=qB({typed:t});return t(oV,{number:SN,Complex:e=>e.sec(),BigNumber:e=>new n(1).div(e.cos())},r)}),cV=`sech`,lV=Z(cV,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(cV,{number:CN,Complex:e=>e.sech(),BigNumber:e=>new n(1).div(e.cosh())})}),uV=`sin`,dV=Z(uV,[`typed`],e=>{var{typed:t}=e,n=qB({typed:t});return t(uV,{number:Math.sin,"Complex | BigNumber":e=>e.sin()},n)}),fV=`sinh`,pV=Z(fV,[`typed`],e=>{var{typed:t}=e;return t(fV,{number:TN,"Complex | BigNumber":e=>e.sinh()})}),mV=`tan`,hV=Z(mV,[`typed`],e=>{var{typed:t}=e,n=qB({typed:t});return t(mV,{number:Math.tan,"Complex | BigNumber":e=>e.tan()},n)}),gV=Z(`tanh`,[`typed`],e=>{var{typed:t}=e;return t(`tanh`,{number:aO,"Complex | BigNumber":e=>e.tanh()})}),_V=`setCartesian`,vV=Z(_V,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(_V,{"Array | Matrix, Array | Matrix":function(e,t){var s=[];if(r(n(e),new a(0))!==0&&r(n(t),new a(0))!==0){var c=_j(Array.isArray(e)?e:e.toArray()).sort(i),l=_j(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(var u=0;u<c.length;u++)for(var d=0;d<l.length;d++)s.push([c[u],l[d]])}return Array.isArray(e)&&Array.isArray(t)?s:new o(s)}})}),yV=`setDifference`,bV=Z(yV,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(yV,{"Array | Matrix, Array | Matrix":function(e,t){var s;if(r(n(e),new a(0))===0)s=[];else if(r(n(t),new a(0))===0)return _j(e.toArray());else{var c=Cj(_j(Array.isArray(e)?e:e.toArray()).sort(i)),l=Cj(_j(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(var u,d=0;d<c.length;d++){u=!1;for(var f=0;f<l.length;f++)if(i(c[d].value,l[f].value)===0&&c[d].identifier===l[f].identifier){u=!0;break}u||s.push(c[d])}}return Array.isArray(e)&&Array.isArray(t)?wj(s):new o(wj(s))}})}),xV=`setDistinct`,SV=Z(xV,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(xV,{"Array | Matrix":function(e){var t;if(r(n(e),new a(0))===0)t=[];else{var s=_j(Array.isArray(e)?e:e.toArray()).sort(i);t=[],t.push(s[0]);for(var c=1;c<s.length;c++)i(s[c],s[c-1])!==0&&t.push(s[c])}return Array.isArray(e)?t:new o(t)}})}),CV=`setIntersect`,wV=Z(CV,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(CV,{"Array | Matrix, Array | Matrix":function(e,t){var s;if(r(n(e),new a(0))===0||r(n(t),new a(0))===0)s=[];else{var c=Cj(_j(Array.isArray(e)?e:e.toArray()).sort(i)),l=Cj(_j(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(var u=0;u<c.length;u++)for(var d=0;d<l.length;d++)if(i(c[u].value,l[d].value)===0&&c[u].identifier===l[d].identifier){s.push(c[u]);break}}return Array.isArray(e)&&Array.isArray(t)?wj(s):new o(wj(s))}})}),TV=`setIsSubset`,EV=Z(TV,[`typed`,`size`,`subset`,`compareNatural`,`Index`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a}=e;return t(TV,{"Array | Matrix, Array | Matrix":function(e,t){if(r(n(e),new a(0))===0)return!0;if(r(n(t),new a(0))===0)return!1;for(var o=Cj(_j(Array.isArray(e)?e:e.toArray()).sort(i)),s=Cj(_j(Array.isArray(t)?t:t.toArray()).sort(i)),c,l=0;l<o.length;l++){c=!1;for(var u=0;u<s.length;u++)if(i(o[l].value,s[u].value)===0&&o[l].identifier===s[u].identifier){c=!0;break}if(c===!1)return!1}return!0}})}),DV=`setMultiplicity`,OV=Z(DV,[`typed`,`size`,`subset`,`compareNatural`,`Index`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a}=e;return t(DV,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(r(n(t),new a(0))===0)return 0;for(var o=_j(Array.isArray(t)?t:t.toArray()),s=0,c=0;c<o.length;c++)i(o[c],e)===0&&s++;return s}})}),kV=`setPowerset`,AV=Z(kV,[`typed`,`size`,`subset`,`compareNatural`,`Index`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a}=e;return t(kV,{"Array | Matrix":function(e){if(r(n(e),new a(0))===0)return[];for(var t=_j(Array.isArray(e)?e:e.toArray()).sort(i),c=[],l=0;l.toString(2).length<=t.length;)c.push(o(t,l.toString(2).split(``).reverse())),l++;return s(c)}});function o(e,t){for(var n=[],r=0;r<t.length;r++)t[r]===`1`&&n.push(e[r]);return n}function s(e){for(var t=[],n=e.length-1;n>0;n--)for(var r=0;r<n;r++)e[r].length>e[r+1].length&&(t=e[r],e[r]=e[r+1],e[r+1]=t);return e}}),jV=`setSize`,MV=Z(jV,[`typed`,`compareNatural`],e=>{var{typed:t,compareNatural:n}=e;return t(jV,{"Array | Matrix":function(e){return Array.isArray(e)?_j(e).length:_j(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(t===!1||e.length===0)return Array.isArray(e)?_j(e).length:_j(e.toArray()).length;for(var r=_j(Array.isArray(e)?e:e.toArray()).sort(n),i=1,a=1;a<r.length;a++)n(r[a],r[a-1])!==0&&i++;return i}})}),NV=`setSymDifference`,PV=Z(NV,[`typed`,`size`,`concat`,`subset`,`setDifference`,`Index`],e=>{var{typed:t,size:n,concat:r,subset:i,setDifference:a,Index:o}=e;return t(NV,{"Array | Matrix, Array | Matrix":function(e,t){if(i(n(e),new o(0))===0)return _j(t);if(i(n(t),new o(0))===0)return _j(e);var s=_j(e),c=_j(t);return r(a(s,c),a(c,s))}})}),FV=`setUnion`,IV=Z(FV,[`typed`,`size`,`concat`,`subset`,`setIntersect`,`setSymDifference`,`Index`],e=>{var{typed:t,size:n,concat:r,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(FV,{"Array | Matrix, Array | Matrix":function(e,t){if(i(n(e),new s(0))===0)return _j(t);if(i(n(t),new s(0))===0)return _j(e);var c=_j(e),l=_j(t);return r(o(c,l),a(c,l))}})}),LV=`add`,RV=Z(LV,[`typed`,`matrix`,`addScalar`,`equalScalar`,`DenseMatrix`,`SparseMatrix`,`concat`],e=>{var{typed:t,matrix:n,addScalar:r,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,c=xF({typed:t}),l=SF({typed:t,equalScalar:i}),u=CF({typed:t,DenseMatrix:a}),d=vF({typed:t,matrix:n,concat:s});return t(LV,{"any, any":r,"any, any, ...any":t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i})},d({elop:r,DS:c,SS:l,Ss:u}))}),zV=`hypot`,BV=Z(zV,[`typed`,`abs`,`addScalar`,`divideScalar`,`multiplyScalar`,`sqrt`,`smaller`,`isPositive`],e=>{var{typed:t,abs:n,addScalar:r,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:c}=e;return t(zV,{"... number | BigNumber":l,Array:l,Matrix:e=>l(_j(e.toArray(),!0))});function l(e){for(var t=0,l=0,u=0;u<e.length;u++){if(EE(e[u]))throw TypeError(`Unexpected type of argument to hypot`);var d=n(e[u]);s(l,d)?(t=a(t,a(i(l,d),i(l,d))),t=r(t,1),l=d):t=r(t,c(d)?a(i(d,l),i(d,l)):d)}return a(l,o(t))}}),VV=`norm`,HV=Z(VV,[`typed`,`abs`,`add`,`pow`,`conj`,`sqrt`,`multiply`,`equalScalar`,`larger`,`smaller`,`matrix`,`ctranspose`,`eigs`],e=>{var{typed:t,abs:n,add:r,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:c,larger:l,smaller:u,matrix:d,ctranspose:f,eigs:p}=e;return t(VV,{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return S(d(e),2)},Matrix:function(e){return S(e,2)},"Array, number | BigNumber | string":function(e,t){return S(d(e),t)},"Matrix, number | BigNumber | string":function(e,t){return S(e,t)}});function m(e){var t=0;return e.forEach(function(e){var r=n(e);l(r,t)&&(t=r)},!0),t}function h(e){var t;return e.forEach(function(e){var r=n(e);(!t||u(r,t))&&(t=r)},!0),t||0}function g(e,t){if(t===1/0||t===`inf`)return m(e);if(t===-1/0||t===`-inf`)return h(e);if(t===`fro`)return S(e,2);if(typeof t==`number`&&!isNaN(t)){if(!c(t,0)){var a=0;return e.forEach(function(e){a=r(i(n(e),t),a)},!0),i(a,1/t)}return 1/0}throw Error(`Unsupported parameter value`)}function _(e){var t=0;return e.forEach(function(e,n){t=r(t,s(e,a(e)))}),n(o(t))}function v(e){var t=[],i=0;return e.forEach(function(e,a){var o=a[1],s=r(t[o]||0,n(e));l(s,i)&&(i=s),t[o]=s},!0),i}function y(e){var t=e.size();if(t[0]!==t[1])throw RangeError(`Invalid matrix dimensions`);var r=p(s(f(e),e)).values.toArray(),i=r[r.length-1];return n(o(i))}function b(e){var t=[],i=0;return e.forEach(function(e,a){var o=a[0],s=r(t[o]||0,n(e));l(s,i)&&(i=s),t[o]=s},!0),i}function x(e,t){if(t===1)return v(e);if(t===1/0||t===`inf`)return b(e);if(t===`fro`)return _(e);if(t===2)return y(e);throw Error(`Unsupported parameter value `+t)}function S(e,t){var n=e.size();if(n.length===1)return g(e,t);if(n.length===2){if(n[0]&&n[1])return x(e,t);throw RangeError(`Invalid matrix dimensions`)}}}),UV=`dot`,WV=Z(UV,[`typed`,`addScalar`,`multiplyScalar`,`conj`,`size`],e=>{var{typed:t,addScalar:n,multiplyScalar:r,conj:i,size:a}=e;return t(UV,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":c});function o(e,t){var n=a(e),r=a(t),i,o;if(n.length===1)i=n[0];else if(n.length===2&&n[1]===1)i=n[0];else throw RangeError(`Expected a column vector, instead got a matrix of size (`+n.join(`, `)+`)`);if(r.length===1)o=r[0];else if(r.length===2&&r[1]===1)o=r[0];else throw RangeError(`Expected a column vector, instead got a matrix of size (`+r.join(`, `)+`)`);if(i!==o)throw RangeError(`Vectors must have equal length (`+i+` != `+o+`)`);if(i===0)throw RangeError(`Cannot calculate the dot product of empty vectors`);return i}function s(e,s){var c=o(e,s),l=jE(e)?e._data:e,u=jE(e)?e._datatype||e.getDataType():void 0,d=jE(s)?s._data:s,f=jE(s)?s._datatype||s.getDataType():void 0,p=a(e).length===2,m=a(s).length===2,h=n,g=r;if(u&&f&&u===f&&typeof u==`string`&&u!==`mixed`){var _=u;h=t.find(n,[_,_]),g=t.find(r,[_,_])}if(!p&&!m){for(var v=g(i(l[0]),d[0]),y=1;y<c;y++)v=h(v,g(i(l[y]),d[y]));return v}if(!p&&m){for(var b=g(i(l[0]),d[0][0]),x=1;x<c;x++)b=h(b,g(i(l[x]),d[x][0]));return b}if(p&&!m){for(var S=g(i(l[0][0]),d[0]),C=1;C<c;C++)S=h(S,g(i(l[C][0]),d[C]));return S}if(p&&m){for(var w=g(i(l[0][0]),d[0][0]),T=1;T<c;T++)w=h(w,g(i(l[T][0]),d[T][0]));return w}}function c(e,t){o(e,t);for(var i=e._index,a=e._values,s=t._index,c=t._values,l=0,u=n,d=r,f=0,p=0;f<i.length&&p<s.length;){var m=i[f],h=s[p];if(m<h){f++;continue}if(m>h){p++;continue}m===h&&(l=u(l,d(a[f],c[p])),f++,p++)}return l}}),GV=Z(`trace`,[`typed`,`matrix`,`add`],e=>{var{typed:t,matrix:n,add:r}=e;return t(`trace`,{Array:function(e){return i(n(e))},SparseMatrix:a,DenseMatrix:i,any:mD});function i(e){var t=e._size,n=e._data;switch(t.length){case 1:if(t[0]===1)return mD(n[0]);throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);case 2:var i=t[0];if(i===t[1]){for(var a=0,o=0;o<i;o++)a=r(a,n[o][o]);return a}else throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);default:throw RangeError(`Matrix must be two dimensional (size: `+GA(t)+`)`)}}function a(e){var t=e._values,n=e._index,i=e._ptr,a=e._size,o=a[0],s=a[1];if(o===s){var c=0;if(t.length>0)for(var l=0;l<s;l++)for(var u=i[l],d=i[l+1],f=u;f<d;f++){var p=n[f];if(p===l){c=r(c,t[f]);break}if(p>l)break}return c}throw RangeError(`Matrix must be square (size: `+GA(a)+`)`)}}),KV=`index`,qV=Z(KV,[`typed`,`Index`],e=>{var{typed:t,Index:n}=e;return t(KV,{"...number | string | BigNumber | Range | Array | Matrix":function(e){var t=e.map(function(e){return wE(e)?e.toNumber():AE(e)||jE(e)?e.map(function(e){return wE(e)?e.toNumber():e}):e}),r=new n;return n.apply(r,t),r}})}),JV=new Set([`end`]),YV=Z(`Node`,[`mathWithTransform`],e=>{var{mathWithTransform:t}=e;function n(e){for(var t of[...JV])if(e.has(t))throw Error(`Scope contains an illegal symbol, "`+t+`" is a reserved keyword`)}class r{get type(){return`Node`}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){var e=this._compile(t,{}),r={},i=null;function a(t){var a=xE(t);return n(a),e(a,r,i)}return{evaluate:a}}_compile(e,t){throw Error(`Method _compile must be implemented by type `+this.type)}forEach(e){throw Error(`Cannot run forEach on a Node interface`)}map(e){throw Error(`Cannot run map on a Node interface`)}_ifNode(e){if(!aD(e))throw TypeError(`Callback function must return a Node`);return e}traverse(e){e(this,null,null);function t(e,n){e.forEach(function(e,r,i){n(e,r,i),t(e,n)})}t(this,e)}transform(e){function t(n,r,i){var a=e(n,r,i);return a===n?n.map(t):a}return t(this,null,null)}filter(e){var t=[];return this.traverse(function(n,r,i){e(n,r,i)&&t.push(n)}),t}clone(){throw Error(`Cannot clone a Node interface`)}cloneDeep(){return this.map(function(e){return e.cloneDeep()})}equals(e){return e?this.type===e.type&&vD(this,e):!1}toString(e){var t=this._getCustomString(e);return t===void 0?this._toString(e):t}_toString(){throw Error(`_toString not implemented for `+this.type)}toJSON(){throw Error(`Cannot serialize object: toJSON not implemented by `+this.type)}toHTML(e){var t=this._getCustomString(e);return t===void 0?this._toHTML(e):t}_toHTML(){throw Error(`_toHTML not implemented for `+this.type)}toTex(e){var t=this._getCustomString(e);return t===void 0?this._toTex(e):t}_toTex(e){throw Error(`_toTex not implemented for `+this.type)}_getCustomString(e){if(e&&typeof e==`object`)switch(typeof e.handler){case`object`:case`undefined`:return;case`function`:return e.handler(this,e);default:throw TypeError(`Object or function expected as callback`)}}getIdentifier(){return this.type}getContent(){return this}}return r},{isClass:!0,isNode:!0});function XV(e){return e&&e.isIndexError?new ej(e.index+1,e.min+1,e.max===void 0?void 0:e.max+1):e}function ZV(e){var{subset:t}=e;return function(e,n){try{if(Array.isArray(e))return t(e,n);if(e&&typeof e.subset==`function`)return e.subset(n);if(typeof e==`string`)return t(e,n);if(typeof e==`object`){if(!n.isObjectProperty())throw TypeError(`Cannot apply a numeric index as object property`);return cE(e,n.getObjectProperty())}else throw TypeError(`Cannot apply index: unsupported type of object`)}catch(e){throw XV(e)}}}var QV=`AccessorNode`,$V=Z(QV,[`subset`,`Node`],e=>{var{subset:t,Node:n}=e,r=ZV({subset:t});function i(e){return!(YE(e)||XE(e)||eD(e)||rD(e)||oD(e)||cD(e)||dD(e))}class a extends n{constructor(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(super(),!aD(e))throw TypeError(`Node expected for parameter "object"`);if(!iD(t))throw TypeError(`IndexNode expected for parameter "index"`);this.object=e,this.index=t,this.optionalChaining=n}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():``:this.object.name||``}get type(){return QV}get isAccessorNode(){return!0}_compile(e,t){var n=this.object._compile(e,t),i=this.index._compile(e,t),a=this.optionalChaining,o=YE(this.object)&&this.object.optionalChaining;if(this.index.isObjectProperty()){var s=this.index.getObjectProperty();return function(e,t,r){var i=r||{},c=n(e,t,i);if(a&&c==null){i.optionalShortCircuit=!0;return}if(!(o&&i!=null&&i.optionalShortCircuit))return cE(c,s)}}else return function(e,t,s){var c=s||{},l=n(e,t,c);if(a&&l==null){c.optionalShortCircuit=!0;return}if(!(o&&c!=null&&c.optionalShortCircuit))return r(l,i(e,t,l))}}forEach(e){e(this.object,`object`,this),e(this.index,`index`,this)}map(e){return new a(this._ifNode(e(this.object,`object`,this)),this._ifNode(e(this.index,`index`,this)),this.optionalChaining)}clone(){return new a(this.object,this.index,this.optionalChaining)}_toString(e){var t=this.object.toString(e);i(this.object)&&(t=`(`+t+`)`);var n=this.optionalChaining?this.index.dotNotation?`?`:`?.`:``;return t+n+this.index.toString(e)}_toHTML(e){var t=this.object.toHTML(e);return i(this.object)&&(t=`<span class="math-parenthesis math-round-parenthesis">(</span>`+t+`<span class="math-parenthesis math-round-parenthesis">)</span>`),t+this.index.toHTML(e)}_toTex(e){var t=this.object.toTex(e);return i(this.object)&&(t=`\\left(' + object + '\\right)`),t+this.index.toTex(e)}toJSON(){return{mathjs:QV,object:this.object,index:this.index,optionalChaining:this.optionalChaining}}static fromJSON(e){return new a(e.object,e.index,e.optionalChaining)}}return XL(a,`name`,QV),a},{isClass:!0,isNode:!0}),eH=`ArrayNode`,tH=Z(eH,[`Node`],e=>{var{Node:t}=e;class n extends t{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(aD))throw TypeError(`Array containing Nodes expected`)}get type(){return eH}get isArrayNode(){return!0}_compile(e,t){var n=vj(this.items,function(n){return n._compile(e,t)});if(e.config.matrix!==`Array`){var r=e.matrix;return function(e,t,i){return r(vj(n,function(n){return n(e,t,i)}))}}else return function(e,t,r){return vj(n,function(n){return n(e,t,r)})}}forEach(e){for(var t=0;t<this.items.length;t++){var n=this.items[t];e(n,`items[`+t+`]`,this)}}map(e){for(var t=[],r=0;r<this.items.length;r++)t[r]=this._ifNode(e(this.items[r],`items[`+r+`]`,this));return new n(t)}clone(){return new n(this.items.slice(0))}_toString(e){return`[`+this.items.map(function(t){return t.toString(e)}).join(`, `)+`]`}toJSON(){return{mathjs:eH,items:this.items}}static fromJSON(e){return new n(e.items)}_toHTML(e){return`<span class="math-parenthesis math-square-parenthesis">[</span>`+this.items.map(function(t){return t.toHTML(e)}).join(`<span class="math-separator">,</span>`)+`<span class="math-parenthesis math-square-parenthesis">]</span>`}_toTex(e){function t(n,r){var i=n.some(XE)&&!n.every(XE),a=r||i,o=a?`&`:`\\\\`,s=n.map(function(n){return n.items?t(n.items,!r):n.toTex(e)}).join(o);return i||!a||a&&!r?`\\begin{bmatrix}`+s+`\\end{bmatrix}`:s}return t(this.items,!1)}}return XL(n,`name`,eH),n},{isClass:!0,isNode:!0});function nH(e){var{subset:t,matrix:n}=e;return function(e,r,i){try{if(Array.isArray(e))return n(e).subset(r,i).valueOf().forEach((t,n)=>{e[n]=t}),e;if(e&&typeof e.subset==`function`)return e.subset(r,i);if(typeof e==`string`)return t(e,r,i);if(typeof e==`object`){if(!r.isObjectProperty())throw TypeError(`Cannot apply a numeric index as object property`);return lE(e,r.getObjectProperty(),i),e}else throw TypeError(`Cannot apply index: unsupported type of object`)}catch(e){throw XV(e)}}}var rH=[{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:nullish":{op:`??`,associativity:`left`,associativeWith:[]}},{"OperatorNode:factorial":{op:`!`,associativity:`left`}},{"OperatorNode:ctranspose":{op:`'`,associativity:`left`}}];function iH(e,t){if(!t||t!==`auto`)return e;for(var n=e;cD(n);)n=n.content;return n}function aH(e,t,n,r){var i=e;t!==`keep`&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<rH.length;s++)if(a in rH[s]){o=s;break}if(a===`OperatorNode:multiply`&&i.implicit&&n!==`show`){var c=iH(i.args[0],t);!(eD(c)&&r&&r.getIdentifier()===`OperatorNode:divide`&&tD(iH(r.args[0],t)))&&!(c.getIdentifier()===`OperatorNode:divide`&&tD(iH(c.args[0],t))&&eD(iH(c.args[1])))&&(o+=1)}return o}function oH(e,t){var n=e;t!==`keep`&&(n=e.getContent());var r=n.getIdentifier(),i=aH(n,t);if(i===null)return null;var a=rH[i][r];if(SD(a,`associativity`)){if(a.associativity===`left`)return`left`;if(a.associativity===`right`)return`right`;throw Error(`'`+r+`' has the invalid associativity '`+a.associativity+`'.`)}return null}function sH(e,t,n){var r=n===`keep`?e:e.getContent(),i=n===`keep`?t:e.getContent(),a=r.getIdentifier(),o=i.getIdentifier(),s=aH(r,n);if(s===null)return null;var c=rH[s][a];if(SD(c,`associativeWith`)&&c.associativeWith instanceof Array){for(var l=0;l<c.associativeWith.length;l++)if(c.associativeWith[l]===o)return!0;return!1}return null}function cH(e){var t=`OperatorNode:`+e;for(var n of rH)if(t in n)return n[t].op;return null}var lH=`AssignmentNode`,uH=Z(lH,[`subset`,`?matrix`,`Node`],e=>{var{subset:t,matrix:n,Node:r}=e,i=ZV({subset:t}),a=nH({subset:t,matrix:n});function o(e,t,n){t||=`keep`;var r=aH(e,t,n),i=aH(e.value,t,n);return t===`all`||i!==null&&i<=r}class s extends r{constructor(e,t,n){if(super(),this.object=e,this.index=n?t:null,this.value=n||t,!dD(e)&&!YE(e))throw TypeError(`SymbolNode or AccessorNode expected as "object"`);if(dD(e)&&e.name===`end`)throw Error(`Cannot assign to symbol "end"`);if(this.index&&!iD(this.index))throw TypeError(`IndexNode expected as "index"`);if(!aD(this.value))throw TypeError(`Node expected as "value"`)}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():``:this.object.name||``}get type(){return lH}get isAssignmentNode(){return!0}_compile(e,t){var n=this.object._compile(e,t),r=this.index?this.index._compile(e,t):null,o=this.value._compile(e,t),s=this.object.name;if(!this.index){if(!dD(this.object))throw TypeError(`SymbolNode expected as object`);return function(e,t,n){var r=o(e,t,n);return e.set(s,r),r}}else if(this.index.isObjectProperty()){var c=this.index.getObjectProperty();return function(e,t,r){var i=n(e,t,r),a=o(e,t,r);return lE(i,c,a),a}}else if(dD(this.object))return function(e,t,i){var c=n(e,t,i),l=o(e,t,i),u=r(e,t,c);return e.set(s,a(c,u,l)),l};else{var l=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){var u=this.object.index.getObjectProperty();return function(e,t,n){var i=l(e,t,n),s=cE(i,u),c=r(e,t,s),d=o(e,t,n);return lE(i,u,a(s,c,d)),d}}else{var d=this.object.index._compile(e,t);return function(e,t,n){var s=l(e,t,n),c=d(e,t,s),u=i(s,c),f=r(e,t,u),p=o(e,t,n);return a(s,c,a(u,f,p)),p}}}}forEach(e){e(this.object,`object`,this),this.index&&e(this.index,`index`,this),e(this.value,`value`,this)}map(e){return new s(this._ifNode(e(this.object,`object`,this)),this.index?this._ifNode(e(this.index,`index`,this)):null,this._ifNode(e(this.value,`value`,this)))}clone(){return new s(this.object,this.index,this.value)}_toString(e){var t=this.object.toString(e),n=this.index?this.index.toString(e):``,r=this.value.toString(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(r=`(`+r+`)`),t+n+` = `+r}toJSON(){return{mathjs:lH,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new s(e.object,e.index,e.value)}_toHTML(e){var t=this.object.toHTML(e),n=this.index?this.index.toHTML(e):``,r=this.value.toHTML(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(r=`<span class="math-paranthesis math-round-parenthesis">(</span>`+r+`<span class="math-paranthesis math-round-parenthesis">)</span>`),t+n+`<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>`+r}_toTex(e){var t=this.object.toTex(e),n=this.index?this.index.toTex(e):``,r=this.value.toTex(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(r=`\\left(${r}\\right)`),t+n+`=`+r}}return XL(s,`name`,lH),s},{isClass:!0,isNode:!0}),dH=`BlockNode`,fH=Z(dH,[`ResultSet`,`Node`],e=>{var{ResultSet:t,Node:n}=e;class r extends n{constructor(e){if(super(),!Array.isArray(e))throw Error(`Array expected`);this.blocks=e.map(function(e){var t=e&&e.node,n=e&&e.visible!==void 0?e.visible:!0;if(!aD(t))throw TypeError(`Property "node" must be a Node`);if(typeof n!=`boolean`)throw TypeError(`Property "visible" must be a boolean`);return{node:t,visible:n}})}get type(){return dH}get isBlockNode(){return!0}_compile(e,n){var r=vj(this.blocks,function(t){return{evaluate:t.node._compile(e,n),visible:t.visible}});return function(e,n,i){var a=[];return yj(r,function(t){var r=t.evaluate(e,n,i);t.visible&&a.push(r)}),new t(a)}}forEach(e){for(var t=0;t<this.blocks.length;t++)e(this.blocks[t].node,`blocks[`+t+`].node`,this)}map(e){for(var t=[],n=0;n<this.blocks.length;n++){var i=this.blocks[n];t[n]={node:this._ifNode(e(i.node,`blocks[`+n+`].node`,this)),visible:i.visible}}return new r(t)}clone(){return new r(this.blocks.map(function(e){return{node:e.node,visible:e.visible}}))}_toString(e){return this.blocks.map(function(t){return t.node.toString(e)+(t.visible?``:`;`)}).join(`
`)}toJSON(){return{mathjs:dH,blocks:this.blocks}}static fromJSON(e){return new r(e.blocks)}_toHTML(e){return this.blocks.map(function(t){return t.node.toHTML(e)+(t.visible?``:`<span class="math-separator">;</span>`)}).join(`<span class="math-separator"><br /></span>`)}_toTex(e){return this.blocks.map(function(t){return t.node.toTex(e)+(t.visible?``:`;`)}).join(`\\;\\;
`)}}return XL(r,`name`,dH),r},{isClass:!0,isNode:!0}),pH=`ConditionalNode`,mH=Z(pH,[`Node`],e=>{var{Node:t}=e;function n(e){if(typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return!!e;if(e){if(wE(e))return!e.isZero();if(EE(e))return!!(e.re||e.im);if(OE(e))return!!e.value}if(e==null)return!1;throw TypeError(`Unsupported type of condition "`+pD(e)+`"`)}class r extends t{constructor(e,t,n){if(super(),!aD(e))throw TypeError(`Parameter condition must be a Node`);if(!aD(t))throw TypeError(`Parameter trueExpr must be a Node`);if(!aD(n))throw TypeError(`Parameter falseExpr must be a Node`);this.condition=e,this.trueExpr=t,this.falseExpr=n}get type(){return pH}get isConditionalNode(){return!0}_compile(e,t){var r=this.condition._compile(e,t),i=this.trueExpr._compile(e,t),a=this.falseExpr._compile(e,t);return function(e,t,o){return n(r(e,t,o))?i(e,t,o):a(e,t,o)}}forEach(e){e(this.condition,`condition`,this),e(this.trueExpr,`trueExpr`,this),e(this.falseExpr,`falseExpr`,this)}map(e){return new r(this._ifNode(e(this.condition,`condition`,this)),this._ifNode(e(this.trueExpr,`trueExpr`,this)),this._ifNode(e(this.falseExpr,`falseExpr`,this)))}clone(){return new r(this.condition,this.trueExpr,this.falseExpr)}_toString(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=aH(this,t,e&&e.implicit),r=this.condition.toString(e),i=aH(this.condition,t,e&&e.implicit);(t===`all`||this.condition.type===`OperatorNode`||i!==null&&i<=n)&&(r=`(`+r+`)`);var a=this.trueExpr.toString(e),o=aH(this.trueExpr,t,e&&e.implicit);(t===`all`||this.trueExpr.type===`OperatorNode`||o!==null&&o<=n)&&(a=`(`+a+`)`);var s=this.falseExpr.toString(e),c=aH(this.falseExpr,t,e&&e.implicit);return(t===`all`||this.falseExpr.type===`OperatorNode`||c!==null&&c<=n)&&(s=`(`+s+`)`),r+` ? `+a+` : `+s}toJSON(){return{mathjs:pH,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new r(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=aH(this,t,e&&e.implicit),r=this.condition.toHTML(e),i=aH(this.condition,t,e&&e.implicit);(t===`all`||this.condition.type===`OperatorNode`||i!==null&&i<=n)&&(r=`<span class="math-parenthesis math-round-parenthesis">(</span>`+r+`<span class="math-parenthesis math-round-parenthesis">)</span>`);var a=this.trueExpr.toHTML(e),o=aH(this.trueExpr,t,e&&e.implicit);(t===`all`||this.trueExpr.type===`OperatorNode`||o!==null&&o<=n)&&(a=`<span class="math-parenthesis math-round-parenthesis">(</span>`+a+`<span class="math-parenthesis math-round-parenthesis">)</span>`);var s=this.falseExpr.toHTML(e),c=aH(this.falseExpr,t,e&&e.implicit);return(t===`all`||this.falseExpr.type===`OperatorNode`||c!==null&&c<=n)&&(s=`<span class="math-parenthesis math-round-parenthesis">(</span>`+s+`<span class="math-parenthesis math-round-parenthesis">)</span>`),r+`<span class="math-operator math-conditional-operator">?</span>`+a+`<span class="math-operator math-conditional-operator">:</span>`+s}_toTex(e){return`\\begin{cases} {`+this.trueExpr.toTex(e)+`}, &\\quad{\\text{if }\\;`+this.condition.toTex(e)+`}\\\\{`+this.falseExpr.toTex(e)+`}, &\\quad{\\text{otherwise}}\\end{cases}`}}return XL(r,`name`,pH),r},{isClass:!0,isNode:!0}),hH=l(o(((e,t)=>{var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r={"{":`\\{`,"}":`\\}`,"\\":`\\textbackslash{}`,"#":`\\#`,$:`\\$`,"%":`\\%`,"&":`\\&`,"^":`\\textasciicircum{}`,_:`\\_`,"~":`\\textasciitilde{}`},i={"":`\\--`,"—":`\\---`," ":`~`," ":`\\qquad{}`,"\r\n":`\\newline{}`,"\n":`\\newline{}`},a=function(e,t){return n({},e,t)};t.exports=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=t.preserveFormatting,s=o===void 0?!1:o,c=t.escapeMapFn,l=c===void 0?a:c,u=String(e),d=``,f=l(n({},r),s?n({},i):{}),p=Object.keys(f),m=function(){var e=!1;p.forEach(function(t,n){e||u.length>=t.length&&u.slice(0,t.length)===t&&(d+=f[p[n]],u=u.slice(t.length,u.length),e=!0)}),e||(d+=u.slice(0,1),u=u.slice(1,u.length))};u;)m();return d}}))(),1),gH={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{?}`},_H={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`},vH={abs:{1:"\\left|${args[0]}\\right|"},add:{2:`\\left(\${args[0]}${_H.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]}${_H.dotDivide}\${args[1]}\\right)`},dotMultiply:{2:`\\left(\${args[0]}${_H.dotMultiply}\${args[1]}\\right)`},dotPow:{2:`\\left(\${args[0]}${_H.dotPow}\${args[1]}\\right)`},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:`\\left(e${_H.pow}{\${args[0]}}-1\\right)`,fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},fraction:{2:"\\frac{${args[0]}}{${args[1]}}"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:`\\left(\${args[0]}${_H.mod}\${args[1]}\\right)`},multiply:{2:`\\left(\${args[0]}${_H.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)${_H.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]}${_H.subtract}\${args[1]}\\right)`},unaryMinus:{1:`${_H.unaryMinus}\\left(\${args[0]}\\right)`},unaryPlus:{1:`${_H.unaryPlus}\\left(\${args[0]}\\right)`},bitAnd:{2:`\\left(\${args[0]}${_H.bitAnd}\${args[1]}\\right)`},bitNot:{1:_H.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:`\\left(\${args[0]}${_H.bitOr}\${args[1]}\\right)`},bitXor:{2:`\\left(\${args[0]}${_H.bitXor}\${args[1]}\\right)`},leftShift:{2:`\\left(\${args[0]}${_H.leftShift}\${args[1]}\\right)`},rightArithShift:{2:`\\left(\${args[0]}${_H.rightArithShift}\${args[1]}\\right)`},rightLogShift:{2:`\\left(\${args[0]}${_H.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]}${_H.and}\${args[1]}\\right)`},not:{1:_H.not+"\\left(${args[0]}\\right)"},or:{2:`\\left(\${args[0]}${_H.or}\${args[1]}\\right)`},xor:{2:`\\left(\${args[0]}${_H.xor}\${args[1]}\\right)`},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:`\\left(\${args[0]}\\right)${_H.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]}}${_H.pow}{\\frac{1}{2}}`},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:`\\left(\${args[0]}\\right)${_H.transpose}`},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:`\\left(\${args[0]}\\right)${_H.factorial}`},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:`\\left(\${args[0]}${_H.equal}\${args[1]}\\right)`},larger:{2:`\\left(\${args[0]}${_H.larger}\${args[1]}\\right)`},largerEq:{2:`\\left(\${args[0]}${_H.largerEq}\${args[1]}\\right)`},smaller:{2:`\\left(\${args[0]}${_H.smaller}\${args[1]}\\right)`},smallerEq:{2:`\\left(\${args[0]}${_H.smallerEq}\${args[1]}\\right)`},unequal:{2:`\\left(\${args[0]}${_H.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]}${_H.to}\${args[1]}\\right)`},numeric:function(e,t){return e.args[0].toTex()},number:{0:`0`,1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:`\\mathtt{""}`,1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:`0`,1:"\\left(${args[0]}\\right)"},bigint:{0:`0`,1:"\\left(${args[0]}\\right)"},complex:{0:`0`,1:"\\left(${args[0]}\\right)",2:`\\left(\\left(\${args[0]}\\right)+${gH.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)"}},yH="\\mathrm{${name}}\\left(${args}\\right)",bH={deg:`^\\circ`};function xH(e){return(0,hH.default)(e,{preserveFormatting:!0})}function SH(e,t){return t=t===void 0?!1:t,t?SD(bH,e)?bH[e]:`\\mathrm{`+xH(e)+`}`:SD(gH,e)?gH[e]:xH(e)}var CH=`ConstantNode`,wH=Z(CH,[`Node`,`isBounded`],e=>{var{Node:t,isBounded:n}=e;class r extends t{constructor(e){super(),this.value=e}get type(){return CH}get isConstantNode(){return!0}_compile(e,t){var n=this.value;return function(){return n}}forEach(e){}map(e){return this.clone()}clone(){return new r(this.value)}_toString(e){return GA(this.value,e)}_toHTML(e){var t=this._toString(e);switch(pD(this.value)){case`number`:case`bigint`:case`BigNumber`:case`Fraction`:return`<span class="math-number">`+t+`</span>`;case`string`:return`<span class="math-string">`+t+`</span>`;case`boolean`:return`<span class="math-boolean">`+t+`</span>`;case`null`:return`<span class="math-null-symbol">`+t+`</span>`;case`undefined`:return`<span class="math-undefined">`+t+`</span>`;default:return`<span class="math-symbol">`+t+`</span>`}}toJSON(){return{mathjs:CH,value:this.value}}static fromJSON(e){return new r(e.value)}_toTex(e){var t=this._toString(e);switch(pD(this.value)){case`string`:return`\\mathtt{`+xH(t)+`}`;case`number`:case`BigNumber`:if(!n(this.value))return this.value.valueOf()<0?`-\\infty`:`\\infty`;var r=t.toLowerCase().indexOf(`e`);return r===-1?t:t.substring(0,r)+`\\cdot10^{`+t.substring(r+1)+`}`;case`bigint`:return t.toString();case`Fraction`:return this.value.toLatex();default:return t}}}return XL(r,`name`,CH),r},{isClass:!0,isNode:!0}),TH=`FunctionAssignmentNode`,EH=Z(TH,[`typed`,`Node`],e=>{var{typed:t,Node:n}=e;function r(e,t,n){var r=aH(e,t,n),i=aH(e.expr,t,n);return t===`all`||i!==null&&i<=r}class i extends n{constructor(e,t,n){if(super(),typeof e!=`string`)throw TypeError(`String expected for parameter "name"`);if(!Array.isArray(t))throw TypeError(`Array containing strings or objects expected for parameter "params"`);if(!aD(n))throw TypeError(`Node expected for parameter "expr"`);if(JV.has(e))throw Error(`Illegal function name, "`+e+`" is a reserved keyword`);var r=new Set;for(var i of t){var a=typeof i==`string`?i:i.name;if(r.has(a))throw Error(`Duplicate parameter name "${a}"`);r.add(a)}this.name=e,this.params=t.map(function(e){return e&&e.name||e}),this.types=t.map(function(e){return e&&e.type||`any`}),this.expr=n}get type(){return TH}get isFunctionAssignmentNode(){return!0}_compile(e,n){var r=Object.create(n);yj(this.params,function(e){r[e]=!0});var i=this.expr,a=i._compile(e,r),o=this.name,s=this.params,c=Sj(this.types,`,`),l=o+`(`+Sj(this.params,`, `)+`)`;return function(e,n,r){var u={};u[c]=function(){for(var t=Object.create(n),i=0;i<s.length;i++)t[s[i]]=arguments[i];return a(e,t,r)};var d=t(o,u);return d.syntax=l,d.expr=i.toString(),e.set(o,d),d}}forEach(e){e(this.expr,`expr`,this)}map(e){var t=this._ifNode(e(this.expr,`expr`,this));return new i(this.name,this.params.slice(0),t)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=this.expr.toString(e);return r(this,t,e&&e.implicit)&&(n=`(`+n+`)`),this.name+`(`+this.params.join(`, `)+`) = `+n}toJSON(){var e=this.types;return{mathjs:TH,name:this.name,params:this.params.map(function(t,n){return{name:t,type:e[n]}}),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,n=[],i=0;i<this.params.length;i++)n.push(`<span class="math-symbol math-parameter">`+YA(this.params[i])+`</span>`);var a=this.expr.toHTML(e);return r(this,t,e&&e.implicit)&&(a=`<span class="math-parenthesis math-round-parenthesis">(</span>`+a+`<span class="math-parenthesis math-round-parenthesis">)</span>`),`<span class="math-function">`+YA(this.name)+`</span><span class="math-parenthesis math-round-parenthesis">(</span>`+n.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>`+a}_toTex(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=this.expr.toTex(e);return r(this,t,e&&e.implicit)&&(n=`\\left(${n}\\right)`),`\\mathrm{`+this.name+`}\\left(`+this.params.map(SH).join(`,`)+`\\right)=`+n}}return XL(i,`name`,TH),i},{isClass:!0,isNode:!0}),DH=`IndexNode`,OH=Z(DH,[`Node`,`size`],e=>{var{Node:t,size:n}=e;class r extends t{constructor(e,t){if(super(),this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(aD))throw TypeError(`Array containing Nodes expected for parameter "dimensions"`);if(this.dotNotation&&!this.isObjectProperty())throw Error(`dotNotation only applicable for object properties`)}get type(){return DH}get isIndexNode(){return!0}_compile(e,t){var r=vj(this.dimensions,function(r,i){if(r.filter(e=>e.isSymbolNode&&e.name===`end`).length>0){var a=Object.create(t);a.end=!0;var o=r._compile(e,a);return function(e,t,r){if(!jE(r)&&!AE(r)&&!kE(r))throw TypeError(`Cannot resolve "end": context must be a Matrix, Array, or string but is `+pD(r));var a=n(r),s=Object.create(t);return s.end=a[i],o(e,s,r)}}else return r._compile(e,t)}),i=cE(e,`index`);return function(e,t,n){return i(...vj(r,function(r){return r(e,t,n)}))}}forEach(e){for(var t=0;t<this.dimensions.length;t++)e(this.dimensions[t],`dimensions[`+t+`]`,this)}map(e){for(var t=[],n=0;n<this.dimensions.length;n++)t[n]=this._ifNode(e(this.dimensions[n],`dimensions[`+n+`]`,this));return new r(t,this.dotNotation)}clone(){return new r(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&eD(this.dimensions[0])&&typeof this.dimensions[0].value==`string`}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(e){return this.dotNotation?`.`+this.getObjectProperty():`[`+this.dimensions.join(`, `)+`]`}toJSON(){return{mathjs:DH,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new r(e.dimensions,e.dotNotation)}_toHTML(e){for(var t=[],n=0;n<this.dimensions.length;n++)t[n]=this.dimensions[n].toHTML();return this.dotNotation?`<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">`+YA(this.getObjectProperty())+`</span>`:`<span class="math-parenthesis math-square-parenthesis">[</span>`+t.join(`<span class="math-separator">,</span>`)+`<span class="math-parenthesis math-square-parenthesis">]</span>`}_toTex(e){var t=this.dimensions.map(function(t){return t.toTex(e)});return this.dotNotation?`.`+this.getObjectProperty():`_{`+t.join(`,`)+`}`}}return XL(r,`name`,DH),r},{isClass:!0,isNode:!0}),kH=`ObjectNode`,AH=Z(kH,[`Node`],e=>{var{Node:t}=e;class n extends t{constructor(e){if(super(),this.properties=e||{},e&&(typeof e!=`object`||!Object.keys(e).every(function(t){return aD(e[t])})))throw TypeError(`Object containing Nodes expected`)}get type(){return kH}get isObjectNode(){return!0}_compile(e,t){var n={};for(var r in this.properties)if(SD(this.properties,r)){var i=qA(r),a=JSON.parse(i);n[a]=cE(this.properties,r)._compile(e,t)}return function(e,t,r){var i={};for(var a in n)SD(n,a)&&(i[a]=n[a](e,t,r));return i}}forEach(e){for(var t in this.properties)SD(this.properties,t)&&e(this.properties[t],`properties[`+qA(t)+`]`,this)}map(e){var t={};for(var r in this.properties)SD(this.properties,r)&&(t[r]=this._ifNode(e(this.properties[r],`properties[`+qA(r)+`]`,this)));return new n(t)}clone(){var e={};for(var t in this.properties)SD(this.properties,t)&&(e[t]=this.properties[t]);return new n(e)}_toString(e){var t=[];for(var n in this.properties)SD(this.properties,n)&&t.push(qA(n)+`: `+this.properties[n].toString(e));return`{`+t.join(`, `)+`}`}toJSON(){return{mathjs:kH,properties:this.properties}}static fromJSON(e){return new n(e.properties)}_toHTML(e){var t=[];for(var n in this.properties)SD(this.properties,n)&&t.push(`<span class="math-symbol math-property">`+YA(n)+`</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>`+this.properties[n].toHTML(e));return`<span class="math-parenthesis math-curly-parenthesis">{</span>`+t.join(`<span class="math-separator">,</span>`)+`<span class="math-parenthesis math-curly-parenthesis">}</span>`}_toTex(e){var t=[];for(var n in this.properties)SD(this.properties,n)&&t.push(`\\mathbf{`+n+`:} & `+this.properties[n].toTex(e)+`\\\\`);return`\\left\\{\\begin{array}{ll}`+t.join(`
`)+`\\end{array}\\right\\}`}}return XL(n,`name`,kH),n},{isClass:!0,isNode:!0});function jH(e,t){return new vE(e,new _E(t),new Set(Object.keys(t)))}var MH=`OperatorNode`,NH=Z(MH,[`Node`],e=>{var{Node:t}=e;function n(e,t){var r=e;if(t===`auto`)for(;cD(r);)r=r.content;return eD(r)?!0:sD(r)?n(r.args[0],t):!1}function r(e,t,r,i,a){var o=aH(e,t,r),s=oH(e,t);if(t===`all`||i.length>2&&e.getIdentifier()!==`OperatorNode:add`&&e.getIdentifier()!==`OperatorNode:multiply`)return i.map(function(e){switch(e.getContent().type){case`ArrayNode`:case`ConstantNode`:case`SymbolNode`:case`ParenthesisNode`:return!1;default:return!0}});var c;switch(i.length){case 0:c=[];break;case 1:var l=aH(i[0],t,r,e);if(a&&l!==null){var u,d;if(t===`keep`?(u=i[0].getIdentifier(),d=e.getIdentifier()):(u=i[0].getContent().getIdentifier(),d=e.getContent().getIdentifier()),rH[o][d].latexLeftParens===!1){c=[!1];break}if(rH[l][u].latexParens===!1){c=[!1];break}}if(l===null){c=[!1];break}if(l<=o){c=[!0];break}c=[!1];break;case 2:var f,p=aH(i[0],t,r,e),m=sH(e,i[0],t);f=p===null?!1:p===o&&s===`right`&&!m?!0:p<o;var h,g=aH(i[1],t,r,e),_=sH(e,i[1],t);if(h=g===null?!1:g===o&&s===`left`&&!_?!0:g<o,a){var v,y,b;t===`keep`?(v=e.getIdentifier(),y=e.args[0].getIdentifier(),b=e.args[1].getIdentifier()):(v=e.getContent().getIdentifier(),y=e.args[0].getContent().getIdentifier(),b=e.args[1].getContent().getIdentifier()),p!==null&&(rH[o][v].latexLeftParens===!1&&(f=!1),rH[p][y].latexParens===!1&&(f=!1)),g!==null&&(rH[o][v].latexRightParens===!1&&(h=!1),rH[g][b].latexParens===!1&&(h=!1))}c=[f,h];break;default:(e.getIdentifier()===`OperatorNode:add`||e.getIdentifier()===`OperatorNode:multiply`)&&(c=i.map(function(n){var i=aH(n,t,r,e),a=sH(e,n,t),c=oH(n,t);return i===null?!1:o===i&&s===c&&!a?!0:i<o}));break}if(i.length>=2&&e.getIdentifier()===`OperatorNode:multiply`&&e.implicit&&t!==`all`&&r===`hide`)for(var x=1;x<c.length;++x)n(i[x],t)&&!c[x-1]&&(t!==`keep`||!cD(i[x-1]))&&(c[x]=!0);return c}class i extends t{constructor(e,t,n,r,i){if(super(),typeof e!=`string`)throw TypeError(`string expected for parameter "op"`);if(typeof t!=`string`)throw TypeError(`string expected for parameter "fn"`);if(!Array.isArray(n)||!n.every(aD))throw TypeError(`Array containing Nodes expected for parameter "args"`);this.implicit=r===!0,this.isPercentage=i===!0,this.op=e,this.fn=t,this.args=n||[]}get type(){return MH}get isOperatorNode(){return!0}_compile(e,t){if(typeof this.fn!=`string`||!mE(e,this.fn))throw e[this.fn]?Error(`No access to function "`+this.fn+`"`):Error(`Function `+this.fn+` missing in provided namespace "math"`);var n=cE(e,this.fn),r=vj(this.args,function(n){return n._compile(e,t)});if(typeof n==`function`&&n.rawArgs===!0){var i=this.args;return function(t,r,a){return n(i,e,jH(t,r))}}else if(r.length===1){var a=r[0];return function(e,t,r){return n(a(e,t,r))}}else if(r.length===2){var o=r[0],s=r[1];return function(e,t,r){return n(o(e,t,r),s(e,t,r))}}else return function(e,t,i){return n.apply(null,vj(r,function(n){return n(e,t,i)}))}}forEach(e){for(var t=0;t<this.args.length;t++)e(this.args[t],`args[`+t+`]`,this)}map(e){for(var t=[],n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],`args[`+n+`]`,this));return new i(this.op,this.fn,t,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(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=e&&e.implicit?e.implicit:`hide`,i=this.args,a=r(this,t,n,i,!1);if(i.length===1){var o=oH(this,t),s=i[0].toString(e);a[0]&&(s=`(`+s+`)`);var c=/[a-zA-Z]+/.test(this.op);return o===`right`?this.op+(c?` `:``)+s:o===`left`?s+(c?` `:``)+this.op:s+this.op}else if(i.length===2){var l=i[0].toString(e),u=i[1].toString(e);return a[0]&&(l=`(`+l+`)`),a[1]&&(u=`(`+u+`)`),this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?l+` `+u:l+` `+this.op+` `+u}else if(i.length>2&&(this.getIdentifier()===`OperatorNode:add`||this.getIdentifier()===`OperatorNode:multiply`)){var d=i.map(function(t,n){return t=t.toString(e),a[n]&&(t=`(`+t+`)`),t});return this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?d.join(` `):d.join(` `+this.op+` `)}else return this.fn+`(`+this.args.join(`, `)+`)`}toJSON(){return{mathjs:MH,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new i(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=e&&e.implicit?e.implicit:`hide`,i=this.args,a=r(this,t,n,i,!1);if(i.length===1){var o=oH(this,t),s=i[0].toHTML(e);return a[0]&&(s=`<span class="math-parenthesis math-round-parenthesis">(</span>`+s+`<span class="math-parenthesis math-round-parenthesis">)</span>`),o===`right`?`<span class="math-operator math-unary-operator math-lefthand-unary-operator">`+YA(this.op)+`</span>`+s:s+`<span class="math-operator math-unary-operator math-righthand-unary-operator">`+YA(this.op)+`</span>`}else if(i.length===2){var c=i[0].toHTML(e),l=i[1].toHTML(e);return a[0]&&(c=`<span class="math-parenthesis math-round-parenthesis">(</span>`+c+`<span class="math-parenthesis math-round-parenthesis">)</span>`),a[1]&&(l=`<span class="math-parenthesis math-round-parenthesis">(</span>`+l+`<span class="math-parenthesis math-round-parenthesis">)</span>`),this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?c+`<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>`+l:c+`<span class="math-operator math-binary-operator math-explicit-binary-operator">`+YA(this.op)+`</span>`+l}else{var u=i.map(function(t,n){return t=t.toHTML(e),a[n]&&(t=`<span class="math-parenthesis math-round-parenthesis">(</span>`+t+`<span class="math-parenthesis math-round-parenthesis">)</span>`),t});return i.length>2&&(this.getIdentifier()===`OperatorNode:add`||this.getIdentifier()===`OperatorNode:multiply`)?this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?u.join(`<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>`):u.join(`<span class="math-operator math-binary-operator math-explicit-binary-operator">`+YA(this.op)+`</span>`):`<span class="math-function">`+YA(this.fn)+`</span><span class="math-paranthesis math-round-parenthesis">(</span>`+u.join(`<span class="math-separator">,</span>`)+`<span class="math-paranthesis math-round-parenthesis">)</span>`}}_toTex(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=e&&e.implicit?e.implicit:`hide`,i=this.args,a=r(this,t,n,i,!0),o=_H[this.fn];if(o=o===void 0?this.op:o,i.length===1){var s=oH(this,t),c=i[0].toTex(e);return a[0]&&(c=`\\left(${c}\\right)`),s===`right`?o+c:c+o}else if(i.length===2){var l=i[0],u=l.toTex(e);a[0]&&(u=`\\left(${u}\\right)`);var d=i[1].toTex(e);a[1]&&(d=`\\left(${d}\\right)`);var f=t===`keep`?l.getIdentifier():l.getContent().getIdentifier();switch(this.getIdentifier()){case`OperatorNode:divide`:return o+`{`+u+`}{`+d+`}`;case`OperatorNode:pow`:switch(u=`{`+u+`}`,d=`{`+d+`}`,f){case`ConditionalNode`:case`OperatorNode:divide`:u=`\\left(${u}\\right)`}break;case`OperatorNode:multiply`:if(this.implicit&&n===`hide`)return u+`~`+d}return u+o+d}else if(i.length>2&&(this.getIdentifier()===`OperatorNode:add`||this.getIdentifier()===`OperatorNode:multiply`)){var p=i.map(function(t,n){return t=t.toTex(e),a[n]&&(t=`\\left(${t}\\right)`),t});return this.getIdentifier()===`OperatorNode:multiply`&&this.implicit&&n===`hide`?p.join(`~`):p.join(o)}else return`\\mathrm{`+this.fn+`}\\left(`+i.map(function(t){return t.toTex(e)}).join(`,`)+`\\right)`}getIdentifier(){return this.type+`:`+this.fn}}return XL(i,`name`,MH),i},{isClass:!0,isNode:!0}),PH=`ParenthesisNode`,FH=Z(PH,[`Node`],e=>{var{Node:t}=e;class n extends t{constructor(e){if(super(),!aD(e))throw TypeError(`Node expected for parameter "content"`);this.content=e}get type(){return PH}get isParenthesisNode(){return!0}_compile(e,t){return this.content._compile(e,t)}getContent(){return this.content.getContent()}forEach(e){e(this.content,`content`,this)}map(e){return new n(e(this.content,`content`,this))}clone(){return new n(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&e.parenthesis===`keep`?`(`+this.content.toString(e)+`)`:this.content.toString(e)}toJSON(){return{mathjs:PH,content:this.content}}static fromJSON(e){return new n(e.content)}_toHTML(e){return!e||e&&!e.parenthesis||e&&e.parenthesis===`keep`?`<span class="math-parenthesis math-round-parenthesis">(</span>`+this.content.toHTML(e)+`<span class="math-parenthesis math-round-parenthesis">)</span>`:this.content.toHTML(e)}_toTex(e){return!e||e&&!e.parenthesis||e&&e.parenthesis===`keep`?`\\left(${this.content.toTex(e)}\\right)`:this.content.toTex(e)}}return XL(n,`name`,PH),n},{isClass:!0,isNode:!0}),IH=`RangeNode`,LH=Z(IH,[`Node`],e=>{var{Node:t}=e;function n(e,t,n){var r=aH(e,t,n),i={},a=aH(e.start,t,n);if(i.start=a!==null&&a<=r||t===`all`,e.step){var o=aH(e.step,t,n);i.step=o!==null&&o<=r||t===`all`}var s=aH(e.end,t,n);return i.end=s!==null&&s<=r||t===`all`,i}class r extends t{constructor(e,t,n){if(super(),!aD(e)||!aD(t)||n&&!aD(n))throw TypeError(`Node expected`);if(arguments.length>3)throw Error(`Too many arguments`);this.start=e,this.end=t,this.step=n||null}get type(){return IH}get isRangeNode(){return!0}needsEnd(){return this.filter(function(e){return dD(e)&&e.name===`end`}).length>0}_compile(e,t){var n=e.range,r=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){var a=this.step._compile(e,t);return function(e,t,o){return n(r(e,t,o),i(e,t,o),a(e,t,o))}}else return function(e,t,a){return n(r(e,t,a),i(e,t,a))}}forEach(e){e(this.start,`start`,this),e(this.end,`end`,this),this.step&&e(this.step,`step`,this)}map(e){return new r(this._ifNode(e(this.start,`start`,this)),this._ifNode(e(this.end,`end`,this)),this.step&&this._ifNode(e(this.step,`step`,this)))}clone(){return new r(this.start,this.end,this.step&&this.step)}_toString(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,r=n(this,t,e&&e.implicit),i,a=this.start.toString(e);if(r.start&&(a=`(`+a+`)`),i=a,this.step){var o=this.step.toString(e);r.step&&(o=`(`+o+`)`),i+=`:`+o}var s=this.end.toString(e);return r.end&&(s=`(`+s+`)`),i+=`:`+s,i}toJSON(){return{mathjs:IH,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new r(e.start,e.end,e.step)}_toHTML(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,r=n(this,t,e&&e.implicit),i,a=this.start.toHTML(e);if(r.start&&(a=`<span class="math-parenthesis math-round-parenthesis">(</span>`+a+`<span class="math-parenthesis math-round-parenthesis">)</span>`),i=a,this.step){var o=this.step.toHTML(e);r.step&&(o=`<span class="math-parenthesis math-round-parenthesis">(</span>`+o+`<span class="math-parenthesis math-round-parenthesis">)</span>`),i+=`<span class="math-operator math-range-operator">:</span>`+o}var s=this.end.toHTML(e);return r.end&&(s=`<span class="math-parenthesis math-round-parenthesis">(</span>`+s+`<span class="math-parenthesis math-round-parenthesis">)</span>`),i+=`<span class="math-operator math-range-operator">:</span>`+s,i}_toTex(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,r=n(this,t,e&&e.implicit),i=this.start.toTex(e);if(r.start&&(i=`\\left(${i}\\right)`),this.step){var a=this.step.toTex(e);r.step&&(a=`\\left(${a}\\right)`),i+=`:`+a}var o=this.end.toTex(e);return r.end&&(o=`\\left(${o}\\right)`),i+=`:`+o,i}}return XL(r,`name`,IH),r},{isClass:!0,isNode:!0}),RH=`RelationalNode`,zH=Z(RH,[`Node`],e=>{var{Node:t}=e,n={equal:`==`,unequal:`!=`,smaller:`<`,larger:`>`,smallerEq:`<=`,largerEq:`>=`};class r extends t{constructor(e,t){if(super(),!Array.isArray(e))throw TypeError(`Parameter conditionals must be an array`);if(!Array.isArray(t))throw TypeError(`Parameter params must be an array`);if(e.length!==t.length-1)throw TypeError(`Parameter params must contain exactly one more element than parameter conditionals`);this.conditionals=e,this.params=t}get type(){return RH}get isRelationalNode(){return!0}_compile(e,t){var n=this,r=this.params.map(n=>n._compile(e,t));return function(t,i,a){for(var o,s=r[0](t,i,a),c=0;c<n.conditionals.length;c++)if(o=s,s=r[c+1](t,i,a),!cE(e,n.conditionals[c])(o,s))return!1;return!0}}forEach(e){this.params.forEach((t,n)=>e(t,`params[`+n+`]`,this),this)}map(e){return new r(this.conditionals.slice(),this.params.map((t,n)=>this._ifNode(e(t,`params[`+n+`]`,this)),this))}clone(){return new r(this.conditionals,this.params)}_toString(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,r=aH(this,t,e&&e.implicit),i=this.params.map(function(n,i){var a=aH(n,t,e&&e.implicit);return t===`all`||a!==null&&a<=r?`(`+n.toString(e)+`)`:n.toString(e)}),a=i[0],o=0;o<this.conditionals.length;o++)a+=` `+n[this.conditionals[o]],a+=` `+i[o+1];return a}toJSON(){return{mathjs:RH,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new r(e.conditionals,e.params)}_toHTML(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,r=aH(this,t,e&&e.implicit),i=this.params.map(function(n,i){var a=aH(n,t,e&&e.implicit);return t===`all`||a!==null&&a<=r?`<span class="math-parenthesis math-round-parenthesis">(</span>`+n.toHTML(e)+`<span class="math-parenthesis math-round-parenthesis">)</span>`:n.toHTML(e)}),a=i[0],o=0;o<this.conditionals.length;o++)a+=`<span class="math-operator math-binary-operator math-explicit-binary-operator">`+YA(n[this.conditionals[o]])+`</span>`+i[o+1];return a}_toTex(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,n=aH(this,t,e&&e.implicit),r=this.params.map(function(r,i){var a=aH(r,t,e&&e.implicit);return t===`all`||a!==null&&a<=n?`\\left(`+r.toTex(e)+`\right)`:r.toTex(e)}),i=r[0],a=0;a<this.conditionals.length;a++)i+=_H[this.conditionals[a]]+r[a+1];return i}}return XL(r,`name`,RH),r},{isClass:!0,isNode:!0}),BH=Z(`SymbolNode`,[`math`,`?Unit`,`Node`],e=>{var{math:t,Unit:n,Node:r}=e;function i(e){return n?n.isValuelessUnit(e):!1}class a extends r{constructor(e){if(super(),typeof e!=`string`)throw TypeError(`String expected for parameter "name"`);this.name=e}get type(){return`SymbolNode`}get isSymbolNode(){return!0}_compile(e,t){var r=this.name;if(t[r]===!0)return function(e,t,n){return cE(t,r)};if(r in e)return function(t,n,i){return t.has(r)?t.get(r):cE(e,r)};var o=i(r);return function(e,t,i){return e.has(r)?e.get(r):o?new n(null,r):a.onUndefinedSymbol(r)}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw Error(`Undefined symbol `+e)}clone(){return new a(this.name)}_toString(e){return this.name}_toHTML(e){var t=YA(this.name);return t===`true`||t===`false`?`<span class="math-symbol math-boolean">`+t+`</span>`:t===`i`?`<span class="math-symbol math-imaginary-symbol">`+t+`</span>`:t===`Infinity`?`<span class="math-symbol math-infinity-symbol">`+t+`</span>`:t===`NaN`?`<span class="math-symbol math-nan-symbol">`+t+`</span>`:t===`null`?`<span class="math-symbol math-null-symbol">`+t+`</span>`:t===`undefined`?`<span class="math-symbol math-undefined-symbol">`+t+`</span>`:`<span class="math-symbol">`+t+`</span>`}toJSON(){return{mathjs:`SymbolNode`,name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){var n=!1;t[this.name]===void 0&&i(this.name)&&(n=!0);var r=SH(this.name,n);return r[0]===`\\`?r:` `+r}}return a},{isClass:!0,isNode:!0}),VH=`FunctionNode`,HH=Z(VH,[`math`,`Node`,`SymbolNode`],e=>{var t,{math:n,Node:r,SymbolNode:i}=e,a=e=>GA(e,{truncate:78});function o(e,t,n){for(var r=``,i=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,a=0,o;(o=i.exec(e))!==null;)if(r+=e.substring(a,o.index),a=o.index,o[0]===`$$`)r+=`$`,a++;else{a+=o[0].length;var s=t[o[1]];if(!s)throw ReferenceError(`Template: Property `+o[1]+` does not exist.`);if(o[2]===void 0)switch(typeof s){case`string`:r+=s;break;case`object`:if(aD(s))r+=s.toTex(n);else if(Array.isArray(s))r+=s.map(function(e,t){if(aD(e))return e.toTex(n);throw TypeError(`Template: `+o[1]+`[`+t+`] is not a Node.`)}).join(`,`);else throw TypeError(`Template: `+o[1]+` has to be a Node, String or array of Nodes`);break;default:throw TypeError(`Template: `+o[1]+` has to be a Node, String or array of Nodes`)}else if(aD(s[o[2]]&&s[o[2]]))r+=s[o[2]].toTex(n);else throw TypeError(`Template: `+o[1]+`[`+o[2]+`] is not a Node.`)}return r+=e.slice(a),r}class s extends r{constructor(e,t,n){if(super(),typeof e==`string`&&(e=new i(e)),!aD(e))throw TypeError(`Node expected as parameter "fn"`);if(!Array.isArray(t)||!t.every(aD))throw TypeError(`Array containing Nodes expected for parameter "args"`);var r=typeof n;if(!(r===`undefined`||r===`boolean`))throw TypeError(`optional flag, if specified, must be boolean`);this.fn=e,this.args=t||[],this.optional=!!n}get name(){return this.fn.name||``}get type(){return VH}get isFunctionNode(){return!0}_compile(e,t){var n=this.args.map(n=>n._compile(e,t)),r=this.optional||YE(this.fn)&&this.fn.optionalChaining;if(dD(this.fn)){var i=this.fn.name;if(t[i]){var o=this.args;return function(t,s,c){var l=cE(s,i);if(!(r&&l===void 0)){if(typeof l!=`function`)throw TypeError(`Argument '${i}' was not a function; received: ${a(l)}`);if(l.rawArgs)return l(o,e,jH(t,s));var u=n.map(e=>e(t,s,c));return l.apply(l,u)}}}else{var c=i in e?cE(e,i):void 0,l=typeof c==`function`&&c.rawArgs===!0,u=t=>{var n;if(t.has(i))n=t.get(i);else if(i in e)n=cE(e,i);else if(r)n=void 0;else return s.onUndefinedFunction(i);if(typeof n==`function`||r&&n===void 0)return n;throw TypeError(`'${i}' is not a function; its value is:
${a(n)}`)};if(l){var d=this.args;return function(t,r,i){var a=u(t);return a.rawArgs===!0?a(d,e,jH(t,r)):a(...n.map(e=>e(t,r,i)))}}else switch(n.length){case 0:return function(e,t,n){var i=u(e);if(!(r&&i===void 0))return i()};case 1:return function(e,t,i){var a=u(e);if(!(r&&a===void 0)){var o=n[0];return a(o(e,t,i))}};case 2:return function(e,t,i){var a=u(e);if(!(r&&a===void 0)){var o=n[0],s=n[1];return a(o(e,t,i),s(e,t,i))}};default:return function(e,t,i){var a=u(e);if(!(r&&a===void 0))return a(...n.map(n=>n(e,t,i)))}}}}else if(YE(this.fn)&&iD(this.fn.index)&&this.fn.index.isObjectProperty()){var f=this.fn.object._compile(e,t),p=this.fn.index.getObjectProperty(),m=this.args;return function(t,i,a){var o=f(t,i,a);if(!(r&&(o==null||o[p]===void 0))){var s=pE(o,p);if(s!=null&&s.rawArgs)return s(m,e,jH(t,i));var c=n.map(e=>e(t,i,a));return s.apply(o,c)}}}else{var h=this.fn.toString(),g=this.fn._compile(e,t),_=this.args;return function(t,i,o){var s=g(t,i,o);if(!(r&&s===void 0)){if(typeof s!=`function`)throw TypeError(`Expression '${h}' did not evaluate to a function; value is:
${a(s)}`);if(s.rawArgs)return s(_,e,jH(t,i));var c=n.map(e=>e(t,i,o));return s.apply(s,c)}}}}forEach(e){e(this.fn,`fn`,this);for(var t=0;t<this.args.length;t++)e(this.args[t],`args[`+t+`]`,this)}map(e){for(var t=this._ifNode(e(this.fn,`fn`,this)),n=[],r=0;r<this.args.length;r++)n[r]=this._ifNode(e(this.args[r],`args[`+r+`]`,this));return new s(t,n)}clone(){return new s(this.fn,this.args.slice(0))}toString(e){var t,n=this.fn.toString(e);return e&&typeof e.handler==`object`&&SD(e.handler,n)&&(t=e.handler[n](this,e)),t===void 0?super.toString(e):t}_toString(e){var t=this.args.map(function(t){return t.toString(e)});return(nD(this.fn)?`(`+this.fn.toString(e)+`)`:this.fn.toString(e))+`(`+t.join(`, `)+`)`}toJSON(){return{mathjs:VH,fn:this.fn,args:this.args}}_toHTML(e){var t=this.args.map(function(t){return t.toHTML(e)});return`<span class="math-function">`+YA(this.fn)+`</span><span class="math-paranthesis math-round-parenthesis">(</span>`+t.join(`<span class="math-separator">,</span>`)+`<span class="math-paranthesis math-round-parenthesis">)</span>`}toTex(e){var t;return e&&typeof e.handler==`object`&&SD(e.handler,this.name)&&(t=e.handler[this.name](this,e)),t===void 0?super.toTex(e):t}_toTex(e){var t=this.args.map(function(t){return t.toTex(e)}),r;vH[this.name]&&(r=vH[this.name]),n[this.name]&&(typeof n[this.name].toTex==`function`||typeof n[this.name].toTex==`object`||typeof n[this.name].toTex==`string`)&&(r=n[this.name].toTex);var i;switch(typeof r){case`function`:i=r(this,e);break;case`string`:i=o(r,this,e);break;case`object`:switch(typeof r[t.length]){case`function`:i=r[t.length](this,e);break;case`string`:i=o(r[t.length],this,e);break}}return i===void 0?o(yH,this,e):i}getIdentifier(){return this.type+`:`+this.name}}return t=s,XL(s,`name`,VH),XL(s,`onUndefinedFunction`,function(e){throw Error(`Undefined function `+e)}),XL(s,`fromJSON`,function(e){return new t(e.fn,e.args)}),s},{isClass:!0,isNode:!0}),UH=`parse`,WH=Z(UH,[`typed`,`numeric`,`config`,`AccessorNode`,`ArrayNode`,`AssignmentNode`,`BlockNode`,`ConditionalNode`,`ConstantNode`,`FunctionAssignmentNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`ParenthesisNode`,`RangeNode`,`RelationalNode`,`SymbolNode`],e=>{var{typed:t,numeric:n,config:r,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:c,ConstantNode:l,FunctionAssignmentNode:u,FunctionNode:d,IndexNode:f,ObjectNode:p,OperatorNode:m,ParenthesisNode:h,RangeNode:g,RelationalNode:_,SymbolNode:v}=e,y=t(UH,{string:function(e){return L(e,{})},"Array | Matrix":function(e){return b(e,{})},"string, Object":function(e,t){return L(e,t.nodes===void 0?{}:t.nodes)},"Array | Matrix, Object":b});function b(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.nodes===void 0?{}:t.nodes;return Jj(e,function(e){if(typeof e!=`string`)throw TypeError(`String expected`);return L(e,n)})}var x={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},S={",":!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,">>":!0,">>>":!0},C={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},w={true:!0,false:!1,null:null,undefined:void 0},T=[`NaN`,`Infinity`],E={'"':`"`,"'":`'`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
`,r:`\r`,t:` `};function D(){return{extraNodes:{},expression:``,comment:``,index:0,token:``,tokenType:x.NULL,nestingLevel:0,conditionalLevel:null}}function O(e,t){return e.expression.substr(e.index,t)}function k(e){return O(e,1)}function A(e){e.index++}function j(e){return e.expression.charAt(e.index-1)}function M(e){return e.expression.charAt(e.index+1)}function N(e){for(e.tokenType=x.NULL,e.token=``,e.comment=``;;){if(k(e)===`#`)for(;k(e)!==`
`&&k(e)!==``;)e.comment+=k(e),A(e);if(y.isWhitespace(k(e),e.nestingLevel))A(e);else break}if(k(e)===``){e.tokenType=x.DELIMITER;return}if(k(e)===`
`&&!e.nestingLevel){e.tokenType=x.DELIMITER,e.token=k(e),A(e);return}var t=k(e),n=O(e,2),r=O(e,3);if(r.length===3&&S[r]){e.tokenType=x.DELIMITER,e.token=r,A(e),A(e),A(e);return}if(n.length===2&&S[n]&&(n!==`?.`||!y.isDigit(e.expression.charAt(e.index+2)))){e.tokenType=x.DELIMITER,e.token=n,A(e),A(e);return}if(S[t]){e.tokenType=x.DELIMITER,e.token=t,A(e);return}if(y.isDigitDot(t)){e.tokenType=x.NUMBER;var i=O(e,2);if(i===`0b`||i===`0o`||i===`0x`){for(e.token+=k(e),A(e),e.token+=k(e),A(e);y.isAlpha(k(e),j(e),M(e))||y.isDigit(k(e));)e.token+=k(e),A(e);if(k(e)===`.`)for(e.token+=`.`,A(e);y.isAlpha(k(e),j(e),M(e))||y.isDigit(k(e));)e.token+=k(e),A(e);else if(k(e)===`i`)for(e.token+=`i`,A(e);y.isDigit(k(e));)e.token+=k(e),A(e);return}if(k(e)===`.`){if(e.token+=k(e),A(e),!y.isDigit(k(e))){e.tokenType=x.DELIMITER;return}}else{for(;y.isDigit(k(e));)e.token+=k(e),A(e);y.isDecimalMark(k(e),M(e))&&(e.token+=k(e),A(e))}for(;y.isDigit(k(e));)e.token+=k(e),A(e);if(k(e)===`E`||k(e)===`e`){if(y.isDigit(M(e))||M(e)===`-`||M(e)===`+`){if(e.token+=k(e),A(e),(k(e)===`+`||k(e)===`-`)&&(e.token+=k(e),A(e)),!y.isDigit(k(e)))throw Me(e,`Digit expected, got "`+k(e)+`"`);for(;y.isDigit(k(e));)e.token+=k(e),A(e);if(y.isDecimalMark(k(e),M(e)))throw Me(e,`Digit expected, got "`+k(e)+`"`)}else if(y.isDecimalMark(M(e),e.expression.charAt(e.index+2)))throw A(e),Me(e,`Digit expected, got "`+k(e)+`"`)}return}if(y.isAlpha(k(e),j(e),M(e))){for(;y.isAlpha(k(e),j(e),M(e))||y.isDigit(k(e));)e.token+=k(e),A(e);SD(C,e.token)?e.tokenType=x.DELIMITER:e.tokenType=x.SYMBOL;return}for(e.tokenType=x.UNKNOWN;k(e)!==``;)e.token+=k(e),A(e);throw Me(e,`Syntax error in part "`+e.token+`"`)}function P(e){do N(e);while(e.token===`
`)}function F(e){e.nestingLevel++}function I(e){e.nestingLevel--}y.isAlpha=function(e,t,n){return y.isValidLatinOrGreek(e)||y.isValidMathSymbol(e,n)||y.isValidMathSymbol(t,e)},y.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},y.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\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(t)},y.isWhitespace=function(e,t){return e===` `||e===` `||e===`\xA0`||e===`
`&&t>0},y.isDecimalMark=function(e,t){return e===`.`&&t!==`/`&&t!==`*`&&t!==`^`},y.isDigitDot=function(e){return e>=`0`&&e<=`9`||e===`.`},y.isDigit=function(e){return e>=`0`&&e<=`9`};function L(e,t){var n=D();oE(n,{expression:e,extraNodes:t}),N(n);var r=ee(n);if(n.token!==``)throw n.tokenType===x.DELIMITER?Ne(n,`Unexpected operator `+n.token):Me(n,`Unexpected part "`+n.token+`"`);return r}function ee(e){var t,n=[],r;for(e.token!==``&&e.token!==`
`&&e.token!==`;`&&(t=R(e),e.comment&&(t.comment=e.comment));e.token===`
`||e.token===`;`;)n.length===0&&t&&(r=e.token!==`;`,n.push({node:t,visible:r})),N(e),e.token!==`
`&&e.token!==`;`&&e.token!==``&&(t=R(e),e.comment&&(t.comment=e.comment),r=e.token!==`;`,n.push({node:t,visible:r}));return n.length>0?new s(n):(t||(t=new l(void 0),e.comment&&(t.comment=e.comment)),t)}function R(e){var t,n,r,i,a=te(e);if(e.token===`=`){if(dD(a))return t=a.name,P(e),r=R(e),new o(new v(t),r);if(YE(a)){if(a.optionalChaining)throw Me(e,`Cannot assign to optional chain`);return P(e),r=R(e),new o(a.object,a.index,r)}else if(rD(a)&&dD(a.fn)&&(i=!0,n=[],t=a.name,a.args.forEach(function(e,t){dD(e)?n[t]=e.name:i=!1}),i))return P(e),r=R(e),new u(t,n,r);throw Me(e,`Invalid left hand side of assignment operator =`)}return a}function te(e){for(var t=z(e);e.token===`?`;){var n=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,P(e);var r=t,i=R(e);if(e.token!==`:`)throw Me(e,`False part of conditional expression expected`);e.conditionalLevel=null,P(e),t=new c(r,i,R(e)),e.conditionalLevel=n}return t}function z(e){for(var t=ne(e);e.token===`or`;)P(e),t=new m(`or`,`or`,[t,ne(e)]);return t}function ne(e){for(var t=re(e);e.token===`xor`;)P(e),t=new m(`xor`,`xor`,[t,re(e)]);return t}function re(e){for(var t=ie(e);e.token===`and`;)P(e),t=new m(`and`,`and`,[t,ie(e)]);return t}function ie(e){for(var t=ae(e);e.token===`|`;)P(e),t=new m(`|`,`bitOr`,[t,ae(e)]);return t}function ae(e){for(var t=oe(e);e.token===`^|`;)P(e),t=new m(`^|`,`bitXor`,[t,oe(e)]);return t}function oe(e){for(var t=se(e);e.token===`&`;)P(e),t=new m(`&`,`bitAnd`,[t,se(e)]);return t}function se(e){for(var t=[ce(e)],n=[],r={"==":`equal`,"!=":`unequal`,"<":`smaller`,">":`larger`,"<=":`smallerEq`,">=":`largerEq`};SD(r,e.token);){var i={name:e.token,fn:r[e.token]};n.push(i),P(e),t.push(ce(e))}return t.length===1?t[0]:t.length===2?new m(n[0].name,n[0].fn,t):new _(n.map(e=>e.fn),t)}function ce(e){for(var t=le(e),n,r,i,a={"<<":`leftShift`,">>":`rightArithShift`,">>>":`rightLogShift`};SD(a,e.token);)n=e.token,r=a[n],P(e),i=[t,le(e)],t=new m(n,r,i);return t}function le(e){for(var t=ue(e),n,r,i,a={to:`to`,in:`to`};SD(a,e.token);)n=e.token,r=a[n],P(e),n===`in`&&`])},;`.includes(e.token)?t=new m(`*`,`multiply`,[t,new v(`in`)],!0):(i=[t,ue(e)],t=new m(n,r,i));return t}function ue(e){var t,n=[];if(e.token===`:`){if(e.conditionalLevel===e.nestingLevel)throw Me(e,`The true-expression of a conditional operator may not be empty`);t=new l(1)}else t=de(e);if(e.token===`:`&&e.conditionalLevel!==e.nestingLevel){for(n.push(t);e.token===`:`&&n.length<3;)P(e),e.token===`)`||e.token===`]`||e.token===`,`||e.token===``?n.push(new v(`end`)):n.push(de(e));t=n.length===3?new g(n[0],n[2],n[1]):new g(n[0],n[1])}return t}function de(e){for(var t=fe(e),n,r,i,a={"+":`add`,"-":`subtract`};SD(a,e.token);){n=e.token,r=a[n],P(e);var o=fe(e);i=o.isPercentage?[t,new m(`*`,`multiply`,[t,o])]:[t,o],t=new m(n,r,i)}return t}function fe(e){for(var t=pe(e),n=t,r,i,a={"*":`multiply`,".*":`dotMultiply`,"/":`divide`,"./":`dotDivide`,"%":`mod`,mod:`mod`};SD(a,e.token);)r=e.token,i=a[r],P(e),n=pe(e),t=new m(r,i,[t,n]);return t}function pe(e){for(var t=me(e),n=t;e.tokenType===x.SYMBOL||e.token===`in`&&eD(t)||e.token===`in`&&sD(t)&&t.fn===`unaryMinus`&&eD(t.args[0])||e.tokenType===x.NUMBER&&!eD(n)&&(!sD(n)||n.op===`!`)||e.token===`(`;)n=me(e),t=new m(`*`,`multiply`,[t,n],!0);return t}function me(e){for(var t=he(e),n=t,r=[];e.token===`/`&&tD(n);)if(r.push(oE({},e)),P(e),e.tokenType===x.NUMBER)if(r.push(oE({},e)),P(e),e.tokenType===x.SYMBOL||e.token===`(`||e.token===`in`)oE(e,r.pop()),r.pop(),n=he(e),t=new m(`/`,`divide`,[t,n]);else{r.pop(),oE(e,r.pop());break}else{oE(e,r.pop());break}return t}function he(e){var t=ge(e);if(e.token===`%`){var n=oE({},e);P(e);try{ge(e),oE(e,n)}catch{t=new m(`/`,`divide`,[t,new l(100)],!1,!0)}}return t}function ge(e){var t,n,r,i={"-":`unaryMinus`,"+":`unaryPlus`,"~":`bitNot`,not:`not`};return SD(i,e.token)?(r=i[e.token],t=e.token,P(e),n=[ge(e)],new m(t,r,n)):_e(e)}function _e(e){var t=ve(e),n,r,i;return(e.token===`^`||e.token===`.^`)&&(n=e.token,r=n===`^`?`pow`:`dotPow`,P(e),i=[t,ge(e)],t=new m(n,r,i)),t}function ve(e){for(var t=ye(e);e.token===`??`;)P(e),t=new m(`??`,`nullish`,[t,ye(e)]);return t}function ye(e){for(var t=be(e),n,r,i,a={"!":`factorial`,"'":`ctranspose`};SD(a,e.token);)n=e.token,r=a[n],N(e),i=[t],t=new m(n,r,i),t=Se(e,t);return t}function be(e){var t=[];if(e.tokenType===x.SYMBOL&&SD(e.extraNodes,e.token)){var n=e.extraNodes[e.token];if(N(e),e.token===`(`){if(t=[],F(e),N(e),e.token!==`)`)for(t.push(R(e));e.token===`,`;)N(e),t.push(R(e));if(e.token!==`)`)throw Me(e,`Parenthesis ) expected`);I(e),N(e)}return new n(t)}return xe(e)}function xe(e){var t,r;return e.tokenType===x.SYMBOL||e.tokenType===x.DELIMITER&&e.token in C?(r=e.token,N(e),t=SD(w,r)?new l(w[r]):T.includes(r)?new l(n(r,`number`)):new v(r),t=Se(e,t),t):Ce(e)}function Se(e,t,n){for(var r;;){var a=!1;e.token===`?.`&&(a=!0,N(e));var o=(e.token===`(`||e.token===`[`||e.token===`.`)&&(!n||n.includes(e.token));if(!(a||o))break;if(r=[],e.token===`(`)if(a||dD(t)||YE(t)){if(F(e),N(e),e.token!==`)`)for(r.push(R(e));e.token===`,`;)N(e),r.push(R(e));if(e.token!==`)`)throw Me(e,`Parenthesis ) expected`);I(e),N(e),t=new d(t,r,a)}else return t;else if(e.token===`[`){if(F(e),N(e),e.token!==`]`)for(r.push(R(e));e.token===`,`;)N(e),r.push(R(e));if(e.token!==`]`)throw Me(e,`Parenthesis ] expected`);I(e),N(e),t=new i(t,new f(r),a)}else{if(a||N(e),!(e.tokenType===x.SYMBOL||e.tokenType===x.DELIMITER&&e.token in C)){var s=`Property name expected after `;throw s+=a?`optional chain`:`dot`,Me(e,s)}r.push(new l(e.token)),N(e),t=new i(t,new f(r,!0),a)}}return t}function Ce(e){var t,n;return e.token===`"`||e.token===`'`?(n=we(e,e.token),t=new l(n),t=Se(e,t),t):Te(e)}function we(e,t){for(var n=``;k(e)!==``&&k(e)!==t;)if(k(e)===`\\`){A(e);var r=k(e),i=E[r];if(i!==void 0)n+=i,e.index+=1;else if(r===`u`){var a=e.expression.slice(e.index+1,e.index+5);if(/^[0-9A-Fa-f]{4}$/.test(a))n+=String.fromCharCode(parseInt(a,16)),e.index+=5;else throw Me(e,`Invalid unicode character \\u${a}`)}else throw Me(e,`Bad escape character \\${r}`)}else n+=k(e),A(e);if(N(e),e.token!==t)throw Me(e,`End of string ${t} expected`);return N(e),n}function Te(e){var t,n,r,i;if(e.token===`[`){if(F(e),N(e),e.token!==`]`){var o=Ee(e);if(e.token===`;`){for(r=1,n=[o];e.token===`;`;)N(e),e.token!==`]`&&(n[r]=Ee(e),r++);if(e.token!==`]`)throw Me(e,`End of matrix ] expected`);I(e),N(e),i=n[0].items.length;for(var s=1;s<r;s++)if(n[s].items.length!==i)throw Ne(e,`Column dimensions mismatch (`+n[s].items.length+` !== `+i+`)`);t=new a(n)}else{if(e.token!==`]`)throw Me(e,`End of matrix ] expected`);I(e),N(e),t=o}}else I(e),N(e),t=new a([]);return Se(e,t)}return De(e)}function Ee(e){for(var t=[R(e)],n=1;e.token===`,`;)N(e),e.token!==`]`&&e.token!==`;`&&(t[n]=R(e),n++);return new a(t)}function De(e){if(e.token===`{`){F(e);var t,n={};do if(N(e),e.token!==`}`){if(e.token===`"`||e.token===`'`)t=we(e,e.token);else if(e.tokenType===x.SYMBOL||e.tokenType===x.DELIMITER&&e.token in C)t=e.token,N(e);else throw Me(e,`Symbol or string expected as object key`);if(e.token!==`:`)throw Me(e,`Colon : expected after object key`);N(e),n[t]=R(e)}while(e.token===`,`);if(e.token!==`}`)throw Me(e,`Comma , or bracket } expected after object value`);I(e),N(e);var r=new p(n);return r=Se(e,r),r}return Oe(e)}function Oe(e){var t;if(e.tokenType===x.NUMBER){t=e.token,N(e);var i=FD(t,r);return new l(n(t,i))}return ke(e)}function ke(e){var t;if(e.token===`(`){if(F(e),N(e),t=R(e),e.token!==`)`)throw Me(e,`Parenthesis ) expected`);return I(e),N(e),t=new h(t),t=Se(e,t),t}return Ae(e)}function Ae(e){throw e.token===``?Me(e,`Unexpected end of expression`):Me(e,`Value expected`)}function je(e){return e.index-e.token.length+1}function Me(e,t){var n=je(e),r=SyntaxError(t+` (char `+n+`)`);return r.char=n,r}function Ne(e,t){var n=je(e),r=SyntaxError(t+` (char `+n+`)`);return r.char=n,r}return t.addConversion({from:`string`,to:`Node`,convert:y}),y}),GH=`compile`,KH=Z(GH,[`typed`,`parse`],e=>{var{typed:t,parse:n}=e;return t(GH,{string:function(e){return n(e).compile()},"Array | Matrix":function(e){return Jj(e,function(e){return n(e).compile()})}})}),qH=`evaluate`,JH=Z(qH,[`typed`,`parse`],e=>{var{typed:t,parse:n}=e;return t(qH,{string:function(e){var t=bE();return n(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return n(e).compile().evaluate(t)},"Array | Matrix":function(e){var t=bE();return Jj(e,function(e){return n(e).compile().evaluate(t)})},"Array | Matrix, Map | Object":function(e,t){return Jj(e,function(e){return n(e).compile().evaluate(t)})}})}),YH=Z(`Parser`,[`evaluate`,`parse`],e=>{var{evaluate:t,parse:n}=e;function r(){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);Object.defineProperty(this,`scope`,{value:bE(),writable:!1})}r.prototype.type=`Parser`,r.prototype.isParser=!0,r.prototype.evaluate=function(e){return t(e,this.scope)},r.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},r.prototype.getAll=function(){return SE(this.scope)},r.prototype.getAllAsMap=function(){return this.scope};function i(e){if(e.length===0)return!1;for(var t=0;t<e.length;t++){var r=e.charAt(t-1),i=e.charAt(t),a=e.charAt(t+1);if(!(n.isAlpha(i,r,a)||t>0&&n.isDigit(i)))return!1}return!0}return r.prototype.set=function(e,t){if(!i(e))throw Error(`Invalid variable name: '${e}'. Variable names must follow the specified rules.`);return this.scope.set(e,t),t},r.prototype.remove=function(e){this.scope.delete(e)},r.prototype.clear=function(){this.scope.clear()},r.prototype.toJSON=function(){var e={mathjs:`Parser`,variables:{},functions:{}};for(var[t,n]of this.scope)if(BE(n)){if(!XH(n))throw Error(`Cannot serialize external function ${t}`);e.functions[t]=`${n.syntax} = ${n.expr}`}else e.variables[t]=n;return e},r.fromJSON=function(e){var t=new r;return Object.entries(e.variables).forEach(e=>{var[n,r]=e;return t.set(n,r)}),Object.entries(e.functions).forEach(e=>{var[n,r]=e;return t.evaluate(r)}),t},r},{isClass:!0});function XH(e){return typeof e==`function`&&typeof e.syntax==`string`&&typeof e.expr==`string`}var ZH=`parser`,QH=Z(ZH,[`typed`,`Parser`],e=>{var{typed:t,Parser:n}=e;return t(ZH,{"":function(){return new n}})}),$H=`lup`,eU=Z($H,[`typed`,`matrix`,`abs`,`addScalar`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`larger`,`equalScalar`,`unaryMinus`,`DenseMatrix`,`SparseMatrix`,`Spa`],e=>{var{typed:t,matrix:n,abs:r,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:s,larger:c,equalScalar:l,unaryMinus:u,DenseMatrix:d,SparseMatrix:f,Spa:p}=e;return t($H,{DenseMatrix:function(e){return m(e)},SparseMatrix:function(e){return h(e)},Array:function(e){var t=m(n(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function m(e){var t=e._size[0],n=e._size[1],u=Math.min(t,n),f=mD(e._data),p=[],m=[t,u],h=[],g=[u,n],_,v,y,b=[];for(_=0;_<t;_++)b[_]=_;for(v=0;v<n;v++){if(v>0)for(_=0;_<t;_++){var x=Math.min(_,v),S=0;for(y=0;y<x;y++)S=i(S,o(f[_][y],f[y][v]));f[_][v]=s(f[_][v],S)}var C=v,w=0,T=0;for(_=v;_<t;_++){var E=f[_][v],D=r(E);c(D,w)&&(C=_,w=D,T=E)}if(v!==C&&(b[v]=[b[C],b[C]=b[v]][0],d._swapRows(v,C,f)),v<t)for(_=v+1;_<t;_++){var O=f[_][v];l(O,0)||(f[_][v]=a(f[_][v],T))}}for(v=0;v<n;v++)for(_=0;_<t;_++){if(v===0&&(_<n&&(h[_]=[]),p[_]=[]),_<v){_<n&&(h[_][v]=f[_][v]),v<t&&(p[_][v]=0);continue}if(_===v){_<n&&(h[_][v]=f[_][v]),v<t&&(p[_][v]=1);continue}_<n&&(h[_][v]=0),v<t&&(p[_][v]=f[_][v])}var k=new d({data:p,size:m}),A=new d({data:h,size:g}),j=[];for(_=0,u=b.length;_<u;_++)j[b[_]]=_;return{L:k,U:A,p:j,toString:function(){return`L: `+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function h(e){var t=e._size[0],n=e._size[1],i=Math.min(t,n),s=e._values,d=e._index,m=e._ptr,h=[],g=[],_=[],v=[t,i],y=[],b=[],x=[],S=[i,n],C,w,T,E=[],D=[];for(C=0;C<t;C++)E[C]=C,D[C]=C;var O=function(e,t){var n=D[e],r=D[t];E[n]=t,E[r]=e,D[e]=r,D[t]=n},k=function(){var e=new p;w<t&&(_.push(h.length),h.push(1),g.push(w)),x.push(y.length);var n=m[w],i=m[w+1];for(T=n;T<i;T++)C=d[T],e.set(E[C],s[T]);w>0&&e.forEach(0,w-1,function(t,n){f._forEachRow(t,h,g,_,function(r,i){r>t&&e.accumulate(r,u(o(i,n)))})});var D=w,k=e.get(w),A=r(k);e.forEach(w+1,t-1,function(e,t){var n=r(t);c(n,A)&&(D=e,A=n,k=t)}),w!==D&&(f._swapRows(w,D,v[1],h,g,_),f._swapRows(w,D,S[1],y,b,x),e.swap(w,D),O(w,D)),e.forEach(0,t-1,function(e,t){e<=w?(y.push(t),b.push(e)):(t=a(t,k),l(t,0)||(h.push(t),g.push(e)))})};for(w=0;w<n;w++)k();return x.push(y.length),_.push(h.length),{L:new f({values:h,index:g,ptr:_,size:v}),U:new f({values:y,index:b,ptr:x,size:S}),p:E,toString:function(){return`L: `+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}}),tU=`qr`,nU=Z(tU,[`typed`,`matrix`,`zeros`,`identity`,`isZero`,`equal`,`sign`,`sqrt`,`conj`,`unaryMinus`,`addScalar`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`complex`],e=>{var{typed:t,matrix:n,zeros:r,identity:i,isZero:a,equal:o,sign:s,sqrt:c,conj:l,unaryMinus:u,addScalar:d,divideScalar:f,multiplyScalar:p,subtractScalar:m,complex:h}=e;return oE(t(tU,{DenseMatrix:function(e){return _(e)},SparseMatrix:function(e){return v(e)},Array:function(e){var t=_(n(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:g});function g(e){var t=e._size[0],n=e._size[1],h=i([t],`dense`),g=h._data,_=e.clone(),v=_._data,y,b,x,S=r([t],``);for(x=0;x<Math.min(n,t);++x){var C=v[x][x],w=u(o(C,0)?1:s(C)),T=l(w),E=0;for(y=x;y<t;y++)E=d(E,p(v[y][x],l(v[y][x])));var D=p(w,c(E));if(!a(D)){var O=m(C,D);for(S[x]=1,y=x+1;y<t;y++)S[y]=f(v[y][x],O);var k=u(l(f(O,D))),A=void 0;for(b=x;b<n;b++){for(A=0,y=x;y<t;y++)A=d(A,p(l(S[y]),v[y][b]));for(A=p(A,k),y=x;y<t;y++)v[y][b]=p(m(v[y][b],p(S[y],A)),T)}for(y=0;y<t;y++){for(A=0,b=x;b<t;b++)A=d(A,p(g[y][b],S[b]));for(A=p(A,k),b=x;b<t;++b)g[y][b]=f(m(g[y][b],p(A,l(S[b]))),T)}}}return{Q:h,R:_,toString:function(){return`Q: `+this.Q.toString()+`
R: `+this.R.toString()}}}function _(e){var t=g(e),n=t.R._data;if(e._data.length>0)for(var r=n[0][0].type===`Complex`?h(0):0,i=0;i<n.length;++i)for(var a=0;a<i&&a<(n[0]||[]).length;++a)n[i][a]=r;return t}function v(e){throw Error(`qr not implemented for sparse matrices yet`)}});function rU(e,t,n,r){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,c=e._datatype,l=s[0],u=s[1],d=r&&e._values?[]:null,f=[],p=[],m=0,h=0;h<u;h++){p[h]=m;for(var g=n?n[h]:h,_=o[g],v=o[g+1],y=_;y<v;y++)f[m]=t?t[a[y]]:a[y],d&&(d[m]=i[y]),m++}return p[u]=m,e.createSparseMatrix({values:d,index:f,ptr:p,size:[l,u],datatype:c})}function iU(e,t,n,r,i,a,o){var s=0;for(n[o]=e;s>=0;){var c=n[o+s],l=n[r+c];l===-1?(s--,a[t++]=c):(n[r+c]=n[i+l],++s,n[o+s]=l)}return t}function aU(e,t){if(!e)return null;var n=0,r,i=[],a=[],o=0,s=t,c=2*t;for(r=0;r<t;r++)a[o+r]=-1;for(r=t-1;r>=0;r--)e[r]!==-1&&(a[s+r]=a[o+e[r]],a[o+e[r]]=r);for(r=0;r<t;r++)e[r]===-1&&(n=iU(r,n,a,o,s,i,c));return i}function oU(e,t){if(!e)return null;var n=e._index,r=e._ptr,i=e._size,a=i[0],o=i[1],s=[],c=[],l=0,u=o,d,f;if(t)for(d=0;d<a;d++)c[u+d]=-1;for(var p=0;p<o;p++){s[p]=-1,c[l+p]=-1;for(var m=r[p],h=r[p+1],g=m;g<h;g++){var _=n[g];for(d=t?c[u+_]:_;d!==-1&&d<p;d=f)f=c[l+d],c[l+d]=p,f===-1&&(s[d]=p);t&&(c[u+_]=p)}}return s}function sU(e,t,n){for(var r=e._values,i=e._index,a=e._ptr,o=e._size[1],s=0,c=0;c<o;c++){var l=a[c];for(a[c]=s;l<a[c+1];l++)t(i[l],c,r?r[l]:1,n)&&(i[s]=i[l],r&&(r[s]=r[l]),s++)}return a[o]=s,i.splice(s,i.length-s),r&&r.splice(s,r.length-s),s}function cU(e){return-e-2}var lU=Z(`csAmd`,[`add`,`multiply`,`transpose`],e=>{var{add:t,multiply:n,transpose:r}=e;return function(e,t){if(!t||e<=0||e>3)return null;var n=t._size,r=n[0],l=n[1],u=0,d=Math.max(16,10*Math.sqrt(l));d=Math.min(l-2,d);var f=i(e,t,r,l,d);sU(f,c,null);for(var p=f._index,m=f._ptr,h=m[l],g=[],_=[],v=0,y=l+1,b=2*(l+1),x=3*(l+1),S=4*(l+1),C=5*(l+1),w=6*(l+1),T=7*(l+1),E=g,D=a(l,m,_,v,x,E,b,T,y,w,S,C),O=o(l,m,_,C,S,w,d,y,x,E,b),k=0,A,j,M,N,P,F,I,L,ee,R,te,z,ne,re,ie,ae;O<l;){for(M=-1;k<l&&(M=_[x+k])===-1;k++);_[b+M]!==-1&&(E[_[b+M]]=-1),_[x+k]=_[b+M];var oe=_[S+M],se=_[y+M];O+=se;var ce=0;_[y+M]=-se;var le=m[M],ue=oe===0?le:h,de=ue;for(N=1;N<=oe+1;N++){for(N>oe?(F=M,I=le,L=_[v+M]-oe):(F=p[le++],I=m[F],L=_[v+F]),P=1;P<=L;P++)A=p[I++],!((ee=_[y+A])<=0)&&(ce+=ee,_[y+A]=-ee,p[de++]=A,_[b+A]!==-1&&(E[_[b+A]]=E[A]),E[A]===-1?_[x+_[C+A]]=_[b+A]:_[b+E[A]]=_[b+A]);F!==M&&(m[F]=cU(M),_[w+F]=0)}for(oe!==0&&(h=de),_[C+M]=ce,m[M]=ue,_[v+M]=de-ue,_[S+M]=-2,D=s(D,u,_,w,l),R=ue;R<de;R++)if(A=p[R],!((te=_[S+A])<=0)){ee=-_[y+A];var fe=D-ee;for(le=m[A],z=m[A]+te-1;le<=z;le++)F=p[le],_[w+F]>=D?_[w+F]-=ee:_[w+F]!==0&&(_[w+F]=_[C+F]+fe)}for(R=ue;R<de;R++){for(A=p[R],z=m[A],ne=z+_[S+A]-1,re=z,ie=0,ae=0,le=z;le<=ne;le++)if(F=p[le],_[w+F]!==0){var pe=_[w+F]-D;pe>0?(ae+=pe,p[re++]=F,ie+=F):(m[F]=cU(M),_[w+F]=0)}_[S+A]=re-z+1;var me=re,he=z+_[v+A];for(le=ne+1;le<he;le++){j=p[le];var ge=_[y+j];ge<=0||(ae+=ge,p[re++]=j,ie+=j)}ae===0?(m[A]=cU(M),ee=-_[y+A],ce-=ee,se+=ee,O+=ee,_[y+A]=0,_[S+A]=-1):(_[C+A]=Math.min(_[C+A],ae),p[re]=p[me],p[me]=p[z],p[z]=M,_[v+A]=re-z+1,ie=(ie<0?-ie:ie)%l,_[b+A]=_[T+ie],_[T+ie]=A,E[A]=ie)}for(_[C+M]=ce,u=Math.max(u,ce),D=s(D+u,u,_,w,l),R=ue;R<de;R++)if(A=p[R],!(_[y+A]>=0))for(ie=E[A],A=_[T+ie],_[T+ie]=-1;A!==-1&&_[b+A]!==-1;A=_[b+A],D++){for(L=_[v+A],te=_[S+A],le=m[A]+1;le<=m[A]+L-1;le++)_[w+p[le]]=D;var _e=A;for(j=_[b+A];j!==-1;){var ve=_[v+j]===L&&_[S+j]===te;for(le=m[j]+1;ve&&le<=m[j]+L-1;le++)_[w+p[le]]!==D&&(ve=0);ve?(m[j]=cU(A),_[y+A]+=_[y+j],_[y+j]=0,_[S+j]=-1,j=_[b+j],_[b+_e]=j):(_e=j,j=_[b+j])}}for(le=ue,R=ue;R<de;R++)A=p[R],!((ee=-_[y+A])<=0)&&(_[y+A]=ee,ae=_[C+A]+ce-ee,ae=Math.min(ae,l-O-ee),_[x+ae]!==-1&&(E[_[x+ae]]=A),_[b+A]=_[x+ae],E[A]=-1,_[x+ae]=A,k=Math.min(k,ae),_[C+A]=ae,p[le++]=A);_[y+M]=se,(_[v+M]=le-ue)===0&&(m[M]=-1,_[w+M]=0),oe!==0&&(h=le)}for(A=0;A<l;A++)m[A]=cU(m[A]);for(j=0;j<=l;j++)_[x+j]=-1;for(j=l;j>=0;j--)_[y+j]>0||(_[b+j]=_[x+m[j]],_[x+m[j]]=j);for(F=l;F>=0;F--)_[y+F]<=0||m[F]!==-1&&(_[b+F]=_[x+m[F]],_[x+m[F]]=F);for(M=0,A=0;A<=l;A++)m[A]===-1&&(M=iU(A,M,_,x,b,g,w));return g.splice(g.length-1,1),g};function i(e,i,a,o,s){var c=r(i);if(e===1&&o===a)return t(i,c);if(e===2){for(var l=c._index,u=c._ptr,d=0,f=0;f<a;f++){var p=u[f];if(u[f]=d,!(u[f+1]-p>s))for(var m=u[f+1];p<m;p++)l[d++]=l[p]}return u[a]=d,i=r(c),n(c,i)}return n(c,i)}function a(e,t,n,r,i,a,o,c,l,u,d,f){for(var p=0;p<e;p++)n[r+p]=t[p+1]-t[p];n[r+e]=0;for(var m=0;m<=e;m++)n[i+m]=-1,a[m]=-1,n[o+m]=-1,n[c+m]=-1,n[l+m]=1,n[u+m]=1,n[d+m]=0,n[f+m]=n[r+m];var h=s(0,0,n,u,e);return n[d+e]=-2,t[e]=-1,n[u+e]=0,h}function o(e,t,n,r,i,a,o,s,c,l,u){for(var d=0,f=0;f<e;f++){var p=n[r+f];if(p===0)n[i+f]=-2,d++,t[f]=-1,n[a+f]=0;else if(p>o)n[s+f]=0,n[i+f]=-1,d++,t[f]=cU(e),n[s+e]++;else{var m=n[c+p];m!==-1&&(l[m]=f),n[u+f]=n[c+p],n[c+p]=f}}return d}function s(e,t,n,r,i){if(e<2||e+t<0){for(var a=0;a<i;a++)n[r+a]!==0&&(n[r+a]=1);e=2}return e}function c(e,t){return e!==t}});function uU(e,t,n,r,i,a,o){var s,c,l=0,u;if(e<=t||n[r+t]<=n[i+e])return-1;n[i+e]=n[r+t];var d=n[a+e];if(n[a+e]=t,d===-1)l=1,u=e;else{for(l=2,u=d;u!==n[o+u];u=n[o+u]);for(s=d;s!==u;s=c)c=n[o+s],n[o+s]=u}return{jleaf:l,q:u}}var dU=Z(`csCounts`,[`transpose`],e=>{var{transpose:t}=e;return function(e,n,r,i){if(!e||!n||!r)return null;var a=e._size,o=a[0],s=a[1],c,l,u,d,f,p,m,h=4*s+(i?s+o+1:0),g=[],_=0,v=s,y=2*s,b=3*s,x=4*s,S=5*s+1;for(u=0;u<h;u++)g[u]=-1;var C=[],w=t(e),T=w._index,E=w._ptr;for(u=0;u<s;u++)for(l=r[u],C[l]=+(g[b+l]===-1);l!==-1&&g[b+l]===-1;l=n[l])g[b+l]=u;if(i){for(u=0;u<s;u++)g[r[u]]=u;for(c=0;c<o;c++){for(u=s,p=E[c],m=E[c+1],f=p;f<m;f++)u=Math.min(u,g[T[f]]);g[S+c]=g[x+u],g[x+u]=c}}for(c=0;c<s;c++)g[_+c]=c;for(u=0;u<s;u++){for(l=r[u],n[l]!==-1&&C[n[l]]--,d=i?g[x+u]:l;d!==-1;d=i?g[S+d]:-1)for(f=E[d];f<E[d+1];f++){c=T[f];var D=uU(c,l,g,b,v,y,_);D.jleaf>=1&&C[l]++,D.jleaf===2&&C[D.q]--}n[l]!==-1&&(g[_+l]=n[l])}for(l=0;l<s;l++)n[l]!==-1&&(C[n[l]]+=C[l]);return C}}),fU=Z(`csSqr`,[`add`,`multiply`,`transpose`],e=>{var{add:t,multiply:n,transpose:r}=e,i=lU({add:t,multiply:n,transpose:r}),a=dU({transpose:r});return function(e,t,n){var r=t._ptr,s=t._size[1],c,l={};if(l.q=i(e,t),e&&!l.q)return null;if(n){var u=e?rU(t,null,l.q,0):t;l.parent=oU(u,1);var d=aU(l.parent,s);if(l.cp=a(u,l.parent,d,1),u&&l.parent&&l.cp&&o(u,l))for(l.unz=0,c=0;c<s;c++)l.unz+=l.cp[c]}else l.unz=4*r[s]+s,l.lnz=l.unz;return l};function o(e,t){var n=e._ptr,r=e._index,i=e._size,a=i[0],o=i[1];t.pinv=[],t.leftmost=[];var s=t.parent,c=t.pinv,l=t.leftmost,u=[],d=0,f=a,p=a+o,m=a+2*o,h,g,_,v,y;for(g=0;g<o;g++)u[f+g]=-1,u[p+g]=-1,u[m+g]=0;for(h=0;h<a;h++)l[h]=-1;for(g=o-1;g>=0;g--)for(v=n[g],y=n[g+1],_=v;_<y;_++)l[r[_]]=g;for(h=a-1;h>=0;h--)c[h]=-1,g=l[h],g!==-1&&(u[m+g]++===0&&(u[p+g]=h),u[d+h]=u[f+g],u[f+g]=h);for(t.lnz=0,t.m2=a,g=0;g<o;g++)if(h=u[f+g],t.lnz++,h<0&&(h=t.m2++),c[h]=g,!(--m[g]<=0)){t.lnz+=u[m+g];var b=s[g];b!==-1&&(u[m+b]===0&&(u[p+b]=u[p+g]),u[d+u[p+g]]=u[f+b],u[f+b]=u[d+h],u[m+b]+=u[m+g])}for(h=0;h<a;h++)c[h]<0&&(c[h]=g++);return!0}});function pU(e,t){return e[t]<0}function mU(e,t){e[t]=cU(e[t])}function hU(e){return e<0?cU(e):e}function gU(e,t,n,r,i){var a=t._index,o=t._ptr,s=t._size[1],c,l,u,d=0;for(r[0]=e;d>=0;){e=r[d];var f=i?i[e]:e;pU(o,e)||(mU(o,e),r[s+d]=f<0?0:hU(o[f]));var p=1;for(l=r[s+d],u=f<0?0:hU(o[f+1]);l<u;l++)if(c=a[l],!pU(o,c)){r[s+d]=l,r[++d]=c,p=0;break}p&&(d--,r[--n]=e)}return n}function _U(e,t,n,r,i){var a=e._ptr,o=e._size,s=t._index,c=t._ptr,l=o[1],u,d,f,p=l;for(d=c[n],f=c[n+1],u=d;u<f;u++){var m=s[u];pU(a,m)||(p=gU(m,e,p,r,i))}for(u=p;u<l;u++)mU(a,r[u]);return p}var vU=Z(`csSpsolve`,[`divideScalar`,`multiply`,`subtract`],e=>{var{divideScalar:t,multiply:n,subtract:r}=e;return function(e,i,a,o,s,c,l){var u=e._values,d=e._index,f=e._ptr,p=e._size[1],m=i._values,h=i._index,g=i._ptr,_,v,y,b,x=_U(e,i,a,o,c);for(_=x;_<p;_++)s[o[_]]=0;for(v=g[a],y=g[a+1],_=v;_<y;_++)s[h[_]]=m[_];for(var S=x;S<p;S++){var C=o[S],w=c?c[C]:C;if(!(w<0))for(v=f[w],y=f[w+1],s[C]=t(s[C],u[l?v:y-1]),_=l?v+1:v,b=l?y:y-1;_<b;_++){var T=d[_];s[T]=r(s[T],n(u[_],s[C]))}}return x}}),yU=Z(`csLu`,[`abs`,`divideScalar`,`multiply`,`subtract`,`larger`,`largerEq`,`SparseMatrix`],e=>{var{abs:t,divideScalar:n,multiply:r,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,c=vU({divideScalar:n,multiply:r,subtract:i});return function(e,i,l){if(!e)return null;var u=e._size[1],d,f=100,p=100;i&&(d=i.q,f=i.lnz||f,p=i.unz||p);var m=[],h=[],g=[],_=new s({values:m,index:h,ptr:g,size:[u,u]}),v=[],y=[],b=[],x=new s({values:v,index:y,ptr:b,size:[u,u]}),S=[],C,w,T=[],E=[];for(C=0;C<u;C++)T[C]=0,S[C]=-1,g[C+1]=0;f=0,p=0;for(var D=0;D<u;D++){g[D]=f,b[D]=p;var O=d?d[D]:D,k=c(_,e,O,E,T,S,1),A=-1,j=-1;for(w=k;w<u;w++)if(C=E[w],S[C]<0){var M=t(T[C]);a(M,j)&&(j=M,A=C)}else y[p]=S[C],v[p++]=T[C];if(A===-1||j<=0)return null;S[O]<0&&o(t(T[O]),r(j,l))&&(A=O);var N=T[A];for(y[p]=D,v[p++]=N,S[A]=D,h[f]=A,m[f++]=1,w=k;w<u;w++)C=E[w],S[C]<0&&(h[f]=C,m[f++]=n(T[C],N)),T[C]=0}for(g[u]=f,b[u]=p,w=0;w<f;w++)h[w]=S[h[w]];return m.splice(f,m.length-f),h.splice(f,h.length-f),v.splice(p,v.length-p),y.splice(p,y.length-p),{L:_,U:x,pinv:S}}}),bU=`slu`,xU=Z(bU,[`typed`,`abs`,`add`,`multiply`,`transpose`,`divideScalar`,`subtract`,`larger`,`largerEq`,`SparseMatrix`],e=>{var{typed:t,abs:n,add:r,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:c,largerEq:l,SparseMatrix:u}=e,d=fU({add:r,multiply:i,transpose:a}),f=yU({abs:n,divideScalar:o,multiply:i,subtract:s,larger:c,largerEq:l,SparseMatrix:u});return t(bU,{"SparseMatrix, number, number":function(e,t,n){if(!PD(t)||t<0||t>3)throw Error(`Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]`);if(n<0||n>1)throw Error(`Partial pivoting threshold must be a number from 0 to 1`);var r=d(t,e,!1),i=f(e,r,n);return{L:i.L,U:i.U,p:i.pinv,q:r.q,toString:function(){return`L: `+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():``)+`
`}}}})});function SU(e,t){var n,r=t.length,i=[];if(e)for(n=0;n<r;n++)i[e[n]]=t[n];else for(n=0;n<r;n++)i[n]=t[n];return i}var CU=`lusolve`,wU=Z(CU,[`typed`,`matrix`,`lup`,`slu`,`usolve`,`lsolve`,`DenseMatrix`],e=>{var{typed:t,matrix:n,lup:r,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,c=ZR({DenseMatrix:s});return t(CU,{"Array, Array | Matrix":function(e,t){e=n(e);var i=r(e);return u(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){var n=r(e);return u(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){var n=r(e);return u(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,n,r){var a=i(e,n,r);return u(a.L,a.U,a.p,a.q,t)},"Object, Array | Matrix":function(e,t){return u(e.L,e.U,e.p,e.q,t)}});function l(e){if(jE(e))return e;if(AE(e))return n(e);throw TypeError(`Invalid Matrix LU decomposition`)}function u(e,t,n,r,i){e=l(e),t=l(t),n&&(i=c(e,i,!0),i._data=SU(n,i._data));var s=o(e,i),u=a(t,s);return r&&(u._data=SU(r,u._data)),u}}),TU=`polynomialRoot`,EU=Z(TU,[`typed`,`isZero`,`equalScalar`,`add`,`subtract`,`multiply`,`divide`,`sqrt`,`unaryMinus`,`cbrt`,`typeOf`,`im`,`re`],e=>{var{typed:t,isZero:n,equalScalar:r,add:i,subtract:a,multiply:o,divide:s,sqrt:c,unaryMinus:l,cbrt:u,typeOf:d,im:f,re:p}=e;return t(TU,{"number|Complex, ...number|Complex":(e,t)=>{for(var m=[e,...t];m.length>0&&n(m[m.length-1]);)m.pop();if(m.length<2)throw RangeError(`Polynomial [${e}, ${t}] must have a non-zero non-constant coefficient`);switch(m.length){case 2:return[l(s(m[0],m[1]))];case 3:var[h,g,_]=m,v=o(2,_),y=o(g,g),b=o(4,_,h);if(r(y,b))return[s(l(g),v)];var x=c(a(y,b));return[s(a(x,g),v),s(a(l(x),g),v)];case 4:var[S,C,w,T]=m,E=l(o(3,T)),D=o(w,w),O=o(3,T,C),k=i(o(2,w,w,w),o(27,T,T,S)),A=o(9,T,w,C);if(r(D,O)&&r(k,A))return[s(w,E)];var j=a(D,O),M=a(k,A);return r(i(o(18,T,w,C,S),o(w,w,C,C)),i(o(4,w,w,w,S),o(4,T,C,C,C),o(27,T,T,S,S)))?[s(a(o(4,T,w,C),i(o(9,T,T,S),o(w,w,w))),o(T,j)),s(a(o(9,T,S),o(w,C)),o(2,j))]:u(r(D,O)?M:s(i(M,c(a(o(M,M),o(4,j,j,j)))),2),!0).toArray().map(e=>s(i(w,e,s(j,e)),E)).map(e=>d(e)===`Complex`&&r(p(e),p(e)+f(e))?p(e):e);default:throw RangeError(`only implemented for cubic or lower-order polynomials, not ${m}`)}}})}),DU=Z(`Help`,[`evaluate`],e=>{var{evaluate:t}=e;function n(e){if(!(this instanceof n))throw SyntaxError(`Constructor must be called with the new operator`);if(!e)throw Error(`Argument "doc" missing`);this.doc=e}return n.prototype.type=`Help`,n.prototype.isHelp=!0,n.prototype.toString=function(){var e=this.doc||{},n=`
`;if(e.name&&(n+=`Name: `+e.name+`
`),e.category&&(n+=`Category: `+e.category+`
`),e.description&&(n+=`Description:
`+e.description+`
`),e.syntax&&(n+=`Syntax:
`+e.syntax.join(`
`)+`
`),e.examples){n+=`Examples:
`;for(var r=!1,i=t(`config()`),a={config:e=>(r=!0,t(`config(newConfig)`,{newConfig:e}))},o=0;o<e.examples.length;o++){var s=e.examples[o];n+=` `+s+`
`;var c=void 0;try{c=t(s,a)}catch(e){c=e}c!==void 0&&!zE(c)&&(n+=` `+GA(c,{precision:14})+`
`)}n+=`
`,r&&t(`config(originalConfig)`,{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(n+=`Throws: `+e.mayThrow.join(`, `)+`
`),e.seealso&&e.seealso.length&&(n+=`See also: `+e.seealso.join(`, `)+`
`),n},n.prototype.toJSON=function(){var e=mD(this.doc);return e.mathjs=`Help`,e},n.fromJSON=function(e){var t={};return Object.keys(e).filter(e=>e!==`mathjs`).forEach(n=>{t[n]=e[n]}),new n(t)},n.prototype.valueOf=n.prototype.toString,n},{isClass:!0}),OU=Z(`Chain`,[`?on`,`math`,`typed`],e=>{var{on:t,math:n,typed:r}=e;function i(e){if(!(this instanceof i))throw SyntaxError(`Constructor must be called with the new operator`);fD(e)?this.value=e.value:this.value=e}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 GA(this.value)},i.prototype.toJSON=function(){return{mathjs:`Chain`,value:this.value}},i.fromJSON=function(e){return new i(e.value)};function a(e,t){typeof t==`function`&&(i.prototype[e]=s(t))}function o(e,t){xD(i.prototype,e,function(){var e=t();if(typeof e==`function`)return s(e)})}function s(e){return function(){if(arguments.length===0)return new i(e(this.value));for(var t=[this.value],n=0;n<arguments.length;n++)t[n+1]=arguments[n];if(r.isTypedFunction(e)){var a=r.resolve(e,t);if(a.params.length===1)throw Error(`chain function `+e.name+` cannot match rest parameter between chain value and additional arguments.`);return new i(a.implementation.apply(e,t))}return new i(e.apply(e,t))}}i.createProxy=function(e,t){if(typeof e==`string`)a(e,t);else{var n=function(t){SD(e,t)&&c[t]===void 0&&o(t,()=>e[t])};for(var r in e)n(r)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(n),t&&t(`import`,function(e,t,n){n||o(e,t)}),i},{isClass:!0}),kU={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`]},AU={name:`false`,category:`Constants`,syntax:[`false`],description:`Boolean value false`,examples:[`false`],seealso:[`true`]},jU={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:[]},MU={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:[]},NU={name:`LN10`,category:`Constants`,syntax:[`LN10`],description:`Returns the natural logarithm of 10, approximately equal to 2.302`,examples:[`LN10`,`log(10)`],seealso:[]},PU={name:`LN2`,category:`Constants`,syntax:[`LN2`],description:`Returns the natural logarithm of 2, approximately equal to 0.693`,examples:[`LN2`,`log(2)`],seealso:[]},FU={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:[]},IU={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:[]},LU={name:`NaN`,category:`Constants`,syntax:[`NaN`],description:`Not a number`,examples:[`NaN`,`0 / 0`],seealso:[]},RU={name:`null`,category:`Constants`,syntax:[`null`],description:`Value null`,examples:[`null`],seealso:[`true`,`false`]},zU={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:[]},BU={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`]},VU={bignumber:{name:`bignumber`,category:`Construction`,syntax:[`bignumber(x)`],description:`Create a big number from a number or string.`,examples:[`0.1 + 0.2`,`bignumber(0.1) + bignumber(0.2)`,`bignumber("7.2")`,`bignumber("7.2e500")`,`bignumber([0.1, 0.2, 0.3])`],seealso:[`boolean`,`bigint`,`complex`,`fraction`,`index`,`matrix`,`string`,`unit`]},bigint:{name:`bigint`,category:`Construction`,syntax:[`bigint(x)`],description:`Create a bigint, an integer with an arbitrary number of digits, from a number or string.`,examples:[`123123123123123123 # a large number will lose digits`,`bigint("123123123123123123")`,`bignumber(["1", "3", "5"])`],seealso:[`boolean`,`bignumber`,`number`,`complex`,`fraction`,`index`,`matrix`,`string`,`unit`]},boolean:{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`]},complex:{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`]},createUnit:{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`]},fraction:{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`]},index:{name:`index`,category:`Construction`,syntax:[`[start]`,`[start:end]`,`[start:step:end]`,`[start1, start 2, ...]`,`[start1:end1, start2:end2, ...]`,`[start1:step1:end1, start2:step2:end2, ...]`],description:`Create an index to get or replace a subset of a matrix`,examples:[`A = [1, 2, 3; 4, 5, 6]`,`A[1, :]`,`A[1, 2] = 50`,`A[1:2, 1:2] = 1`,`B = [1, 2, 3]`,`B[B>1 and B<3]`],seealso:[`bignumber`,`boolean`,`complex`,`matrix`,`number`,`range`,`string`,`unit`]},matrix:{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`]},number:{name:`number`,category:`Construction`,syntax:[`x`,`number(x)`,`number(unit, valuelessUnit)`],description:`Create a number or convert a string or boolean into a number.`,examples:[`2`,`2e3`,`4.05`,`number(2)`,`number("7.2")`,`number(true)`,`number([true, false, true, true])`,`number(unit("52cm"), "m")`],seealso:[`bignumber`,`bigint`,`boolean`,`complex`,`fraction`,`index`,`matrix`,`string`,`unit`]},sparse:{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`]},splitUnit:{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`]},string:{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`]},unit:{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`]},e:kU,E:kU,false:AU,i:jU,Infinity:MU,LN2:PU,LN10:NU,LOG2E:IU,LOG10E:FU,NaN:LU,null:RU,pi:BU,PI:BU,phi:zU,SQRT1_2:{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:[]},SQRT2:{name:`SQRT2`,category:`Constants`,syntax:[`SQRT2`],description:`Returns the square root of 2, approximately equal to 1.414`,examples:[`SQRT2`,`sqrt(2)`],seealso:[]},tau:{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`]},true:{name:`true`,category:`Constants`,syntax:[`true`],description:`Boolean value true`,examples:[`true`],seealso:[`false`]},version:{name:`version`,category:`Constants`,syntax:[`version`],description:`A string with the version number of math.js`,examples:[`version`],seealso:[]},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. Deprecated in favor of coulombConstant`,examples:[`coulombConstant`]},coulombConstant:{description:`Coulomb's constant`,examples:[`coulombConstant`]},elementaryCharge:{description:`Elementary charge`,examples:[`elementaryCharge`]},bohrMagneton:{description:`Bohr magneton`,examples:[`bohrMagneton`]},conductanceQuantum:{description:`Conductance quantum`,examples:[`conductanceQuantum`]},inverseConductanceQuantum:{description:`Inverse conductance quantum`,examples:[`inverseConductanceQuantum`]},magneticFluxQuantum:{description:`Magnetic flux quantum`,examples:[`magneticFluxQuantum`]},nuclearMagneton:{description:`Nuclear magneton`,examples:[`nuclearMagneton`]},klitzing:{description:`Von Klitzing constant`,examples:[`klitzing`]},bohrRadius:{description:`Bohr radius`,examples:[`bohrRadius`]},classicalElectronRadius:{description:`Classical electron radius`,examples:[`classicalElectronRadius`]},electronMass:{description:`Electron mass`,examples:[`electronMass`]},fermiCoupling:{description:`Fermi coupling constant`,examples:[`fermiCoupling`]},fineStructure:{description:`Fine-structure constant`,examples:[`fineStructure`]},hartreeEnergy:{description:`Hartree energy`,examples:[`hartreeEnergy`]},protonMass:{description:`Proton mass`,examples:[`protonMass`]},deuteronMass:{description:`Deuteron Mass`,examples:[`deuteronMass`]},neutronMass:{description:`Neutron mass`,examples:[`neutronMass`]},quantumOfCirculation:{description:`Quantum of circulation`,examples:[`quantumOfCirculation`]},rydberg:{description:`Rydberg constant`,examples:[`rydberg`]},thomsonCrossSection:{description:`Thomson cross section`,examples:[`thomsonCrossSection`]},weakMixingAngle:{description:`Weak mixing angle`,examples:[`weakMixingAngle`]},efimovFactor:{description:`Efimov factor`,examples:[`efimovFactor`]},atomicMass:{description:`Atomic mass constant`,examples:[`atomicMass`]},avogadro:{description:`Avogadro's number`,examples:[`avogadro`]},boltzmann:{description:`Boltzmann constant`,examples:[`boltzmann`]},faraday:{description:`Faraday constant`,examples:[`faraday`]},firstRadiation:{description:`First radiation constant`,examples:[`firstRadiation`]},loschmidt:{description:`Loschmidt constant at T=273.15 K and p=101.325 kPa`,examples:[`loschmidt`]},gasConstant:{description:`Gas constant`,examples:[`gasConstant`]},molarPlanckConstant:{description:`Molar Planck constant`,examples:[`molarPlanckConstant`]},molarVolume:{description:`Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa`,examples:[`molarVolume`]},sackurTetrode:{description:`Sackur-Tetrode constant at T=1 K and p=101.325 kPa`,examples:[`sackurTetrode`]},secondRadiation:{description:`Second radiation constant`,examples:[`secondRadiation`]},stefanBoltzmann:{description:`Stefan-Boltzmann constant`,examples:[`stefanBoltzmann`]},wienDisplacement:{description:`Wien displacement law constant`,examples:[`wienDisplacement`]},molarMass:{description:`Molar mass constant`,examples:[`molarMass`]},molarMassC12:{description:`Molar mass constant of carbon-12`,examples:[`molarMassC12`]},gravity:{description:`Standard acceleration of gravity (standard acceleration of free-fall on Earth)`,examples:[`gravity`]},planckLength:{description:`Planck length`,examples:[`planckLength`]},planckMass:{description:`Planck mass`,examples:[`planckMass`]},planckTime:{description:`Planck time`,examples:[`planckTime`]},planckCharge:{description:`Planck charge`,examples:[`planckCharge`]},planckTemperature:{description:`Planck temperature`,examples:[`planckTemperature`]},derivative:{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`]},lsolve:{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`]},lsolveAll:{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`]},lup:{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`]},lusolve:{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`]},leafCount:{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`]},polynomialRoot:{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`]},resolve:{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`]},simplify:{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`]},simplifyConstant:{name:`simplifyConstant`,category:`Algebra`,syntax:[`simplifyConstant(expr)`,`simplifyConstant(expr, options)`],description:`Replace constant subexpressions of node with their values.`,examples:[`simplifyConstant("(3-3)*x")`,`simplifyConstant(parse("z-cos(tau/8)"))`],seealso:[`simplify`,`simplifyCore`,`evaluate`]},simplifyCore:{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`]},symbolicEqual:{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`]},rationalize:{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`]},slu:{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`]},usolve:{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`]},usolveAll:{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`]},qr:{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`]},abs:{name:`abs`,category:`Arithmetic`,syntax:[`abs(x)`],description:`Compute the absolute value.`,examples:[`abs(3.5)`,`abs(-4.2)`],seealso:[`sign`]},add:{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`]},cbrt:{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`]},ceil:{name:`ceil`,category:`Arithmetic`,syntax:[`ceil(x)`,`ceil(x, n)`,`ceil(unit, valuelessUnit)`,`ceil(unit, n, valuelessUnit)`],description:`Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.`,examples:[`ceil(3.2)`,`ceil(3.8)`,`ceil(-4.2)`,`ceil(3.241cm, cm)`,`ceil(3.241cm, 2, cm)`],seealso:[`floor`,`fix`,`round`]},cube:{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`]},divide:{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`]},dotDivide:{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`]},dotMultiply:{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`]},dotPow:{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`]},exp:{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`]},expm:{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`]},expm1:{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`]},fix:{name:`fix`,category:`Arithmetic`,syntax:[`fix(x)`,`fix(x, n)`,`fix(unit, valuelessUnit)`,`fix(unit, n, valuelessUnit)`],description:`Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.`,examples:[`fix(3.2)`,`fix(3.8)`,`fix(-4.2)`,`fix(-4.8)`,`fix(3.241cm, cm)`,`fix(3.241cm, 2, cm)`],seealso:[`ceil`,`floor`,`round`]},floor:{name:`floor`,category:`Arithmetic`,syntax:[`floor(x)`,`floor(x, n)`,`floor(unit, valuelessUnit)`,`floor(unit, n, valuelessUnit)`],description:`Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.`,examples:[`floor(3.2)`,`floor(3.8)`,`floor(-4.2)`,`floor(3.241cm, cm)`,`floor(3.241cm, 2, cm)`],seealso:[`ceil`,`fix`,`round`]},gcd:{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`]},hypot:{name:`hypot`,category:`Arithmetic`,syntax:[`hypot(a, b, c, ...)`,`hypot([a, b, c, ...])`],description:`Calculate the hypotenuse of a list with values.`,examples:[`hypot(3, 4)`,`sqrt(3^2 + 4^2)`,`hypot(-2)`,`hypot([3, 4, 5])`],seealso:[`abs`,`norm`]},lcm:{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`]},log:{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`]},log2:{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`]},log1p:{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`]},log10:{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`]},mod:{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`]},multiply:{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`]},norm:{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")`]},nthRoot:{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`]},nthRoots:{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`]},pow:{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`]},round:{name:`round`,category:`Arithmetic`,syntax:[`round(x)`,`round(x, n)`,`round(unit, valuelessUnit)`,`round(unit, n, valuelessUnit)`],description:`round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.`,examples:[`round(3.2)`,`round(3.8)`,`round(-4.2)`,`round(-4.8)`,`round(pi, 3)`,`round(123.45678, 2)`,`round(3.241cm, 2, cm)`,`round([3.2, 3.8, -4.7])`],seealso:[`ceil`,`floor`,`fix`]},sign:{name:`sign`,category:`Arithmetic`,syntax:[`sign(x)`],description:`Compute the sign of a value. The sign of a value x is 1 when x>0, -1 when x<0, and 0 when x=0.`,examples:[`sign(3.5)`,`sign(-4.2)`,`sign(0)`],seealso:[`abs`]},sqrt:{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`]},sqrtm:{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`]},square:{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`]},subtract:{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`]},unaryMinus:{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`]},unaryPlus:{name:`unaryPlus`,category:`Operators`,syntax:[`+x`,`unaryPlus(x)`],description:`Converts booleans and strings to numbers.`,examples:[`+true`,`+"2"`],seealso:[`add`,`subtract`,`unaryMinus`]},xgcd:{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`]},invmod:{name:`invmod`,category:`Arithmetic`,syntax:[`invmod(a, b)`],description:`Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)`,examples:[`invmod(8, 12)`,`invmod(7, 13)`,`invmod(15151, 15122)`],seealso:[`gcd`,`xgcd`]},num:{name:`num`,category:`Fraction`,syntax:[`num(x)`],description:`Get the numerator of a fraction.`,examples:[`num(fraction(2, 3))`,`num(fraction(5, 8))`],seealso:[`den`,`fraction`]},den:{name:`den`,category:`Fraction`,syntax:[`den(x)`],description:`Get the denominator of a fraction.`,examples:[`den(fraction(2, 3))`,`den(fraction(5, 8))`],seealso:[`num`,`fraction`]},bitAnd:{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`]},bitNot:{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`]},bitOr:{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`]},bitXor:{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`]},leftShift:{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`]},rightArithShift:{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`]},rightLogShift:{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`]},bellNumbers:{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`]},catalan:{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`]},composition:{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`]},stirlingS2:{name:`stirlingS2`,category:`Combinatorics`,syntax:[`stirlingS2(n, k)`],description:"The 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`,`bernoulli`]},config:{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:[]},import:{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:[]},typed:{name:`typed`,category:`Core`,syntax:[`typed(signatures)`,`typed(name, signatures)`],description:`Create a typed function.`,examples:[`double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })`,`double(2)`,`double("hello")`],seealso:[]},arg:{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`]},conj:{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`]},re:{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`]},im:{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`]},evaluate:{name:`evaluate`,category:`Expression`,syntax:[`evaluate(expression)`,`evaluate(expression, scope)`,`evaluate([expr1, expr2, expr3, ...])`,`evaluate([expr1, expr2, expr3, ...], scope)`],description:`Evaluate an expression or an array with expressions.`,examples:[`evaluate("2 + 3")`,`evaluate("sqrt(16)")`,`evaluate("2 inch to cm")`,`evaluate("sin(x * pi)", { "x": 1/2 })`,`evaluate(["width=2", "height=4","width*height"])`],seealso:[`parser`,`parse`,`compile`]},help:{name:`help`,category:`Expression`,syntax:[`help(object)`,`help(string)`],description:`Display documentation on a function or data type.`,examples:[`help(sqrt)`,`help("complex")`],seealso:[]},parse:{name:`parse`,category:`Expression`,syntax:[`parse(expr)`,`parse(expr, options)`,`parse([expr1, expr2, expr3, ...])`,`parse([expr1, expr2, expr3, ...], options)`],description:`Parse an expression. Returns a node tree, which can be evaluated by invoking node.evaluate() or transformed into a functional object via node.compile().`,examples:[`node1 = parse("sqrt(3^2 + 4^2)")`,`node1.evaluate()`,`code1 = node1.compile()`,`code1.evaluate()`,`scope = {a: 3, b: 4}`,`node2 = parse("a * b")`,`node2.evaluate(scope)`,`code2 = node2.compile()`,`code2.evaluate(scope)`],seealso:[`parser`,`evaluate`,`compile`]},parser:{name:`parser`,category:`Expression`,syntax:[`parser()`],description:`Create a parser object that keeps a context of variables and their values, allowing the evaluation of expressions in that context.`,examples:[`myParser = parser()`,`myParser.evaluate("sqrt(3^2 + 4^2)")`,`myParser.set("x", 3)`,`myParser.evaluate("y = x + 3")`,`myParser.evaluate(["y = x + 3", "y = y + 1"])`,`myParser.get("y")`],seealso:[`evaluate`,`parse`,`compile`]},compile:{name:`compile`,category:`Expression`,syntax:[`compile(expr) `,`compile([expr1, expr2, expr3, ...])`],description:`Parse and compile an expression. Returns a an object with a function evaluate([scope]) to evaluate the compiled expression.`,examples:[`code1 = compile("sqrt(3^2 + 4^2)")`,`code1.evaluate() `,`code2 = compile("a * b")`,`code2.evaluate({a: 3, b: 4})`],seealso:[`parser`,`parse`,`evaluate`]},distance:{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:[]},intersect:{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:[]},and:{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`]},not:{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`]},nullish:{name:`nullish`,category:`Logical`,syntax:[`x ?? y`,`nullish(x, y)`],description:`Nullish coalescing operator. Returns the right-hand operand when the left-hand operand is null or undefined, and otherwise returns the left-hand operand.`,examples:[`null ?? 42`,`undefined ?? 42`,`0 ?? 42`,`false ?? 42`,`null ?? undefined ?? 42`],seealso:[`and`,`or`,`not`]},or:{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`]},xor:{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`]},mapSlices:{name:`mapSlices`,category:`Matrix`,syntax:[`mapSlices(A, dim, callback)`],description:`Generate a matrix one dimension less than A by applying callback to each slice of A along dimension dim.`,examples:[`A = [[1, 2], [3, 4]]`,`mapSlices(A, 1, sum)`,`mapSlices(A, 2, prod)`],seealso:[`map`,`forEach`]},concat:{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`]},count:{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`]},cross:{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`]},column:{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`]},ctranspose:{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`]},det:{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`]},diag:{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`]},diff:{name:`diff`,category:`Matrix`,syntax:[`diff(arr)`,`diff(arr, dim)`],description:[`Create a new matrix or array with the difference of the passed matrix or array.`,`Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference`,`If no dimension parameter is passed it is assumed as dimension 0`,`Dimension is zero-based in javascript and one-based in the parser`,`Arrays must be 'rectangular' meaning arrays like [1, 2]`,`If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays`],examples:[`A = [1, 2, 4, 7, 0]`,`diff(A)`,`diff(A, 1)`,`B = [[1, 2], [3, 4]]`,`diff(B)`,`diff(B, 1)`,`diff(B, 2)`,`diff(B, bignumber(2))`,`diff([[1, 2], matrix([3, 4])], 2)`],seealso:[`subtract`,`partitionSelect`]},dot:{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`]},getMatrixDataType:{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`]},identity:{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`]},filter:{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`]},flatten:{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`]},forEach:{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`]},inv:{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`]},pinv:{name:`pinv`,category:`Matrix`,syntax:[`pinv(x)`],description:`Calculate the MoorePenrose inverse of a matrix`,examples:[`pinv([1, 2; 3, 4])`,`pinv([[1, 0], [0, 1], [0, 1]])`,`pinv(4)`],seealso:[`inv`]},eigs:{name:`eigs`,category:`Matrix`,syntax:[`eigs(x)`],description:`Calculate the eigenvalues and optionally eigenvectors of a square matrix`,examples:[`eigs([[5, 2.3], [2.3, 1]])`,`eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })`],seealso:[`inv`]},kron:{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`]},matrixFromFunction:{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`]},matrixFromRows:{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`]},matrixFromColumns:{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`]},map:{name:`map`,category:`Matrix`,syntax:[`map(x, callback)`,`map(x, y, ..., callback)`],description:`Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.`,examples:[`map([1, 2, 3], square)`,`map([1, 2], [3, 4], f(a,b) = a + b)`],seealso:[`filter`,`forEach`]},ones:{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`]},partitionSelect:{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`]},range:{name:`range`,category:`Type`,syntax:[`start:end`,`start:step:end`,`range(start, end)`,`range(start, end, step)`,`range(string)`],description:`Create a range. Lower bound of the range is included, upper bound is excluded.`,examples:[`1:5`,`3:-1:-3`,`range(3, 7)`,`range(0, 12, 2)`,`range("4:10")`,`range(1m, 1m, 3m)`,`a = [1, 2, 3, 4; 5, 6, 7, 8]`,`a[1:2, 1:2]`],seealso:[`concat`,`det`,`diag`,`identity`,`inv`,`ones`,`size`,`squeeze`,`subset`,`trace`,`transpose`,`zeros`]},resize:{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`]},reshape:{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`]},rotate:{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`]},rotationMatrix:{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`]},row:{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`]},size:{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`]},sort:{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`]},squeeze:{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`]},subset:{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`]},trace:{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`]},transpose:{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`]},zeros:{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`]},fft:{name:`fft`,category:`Matrix`,syntax:[`fft(x)`],description:`Calculate N-dimensional Fourier transform`,examples:[`fft([[1, 0], [1, 0]])`],seealso:[`ifft`]},ifft:{name:`ifft`,category:`Matrix`,syntax:[`ifft(x)`],description:`Calculate N-dimensional inverse Fourier transform`,examples:[`ifft([[2, 2], [0, 0]])`],seealso:[`fft`]},sylvester:{name:`sylvester`,category:`Algebra`,syntax:[`sylvester(A,B,C)`],description:`Solves the real-valued Sylvester equation AX+XB=C for X`,examples:[`sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])`,`A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]`,`sylvester(A, B, C)`],seealso:[`schur`,`lyap`]},schur:{name:`schur`,category:`Algebra`,syntax:[`schur(A)`],description:`Performs a real Schur decomposition of the real matrix A = UTU'`,examples:[`schur([[1, 0], [-4, 3]])`,`A = [[1, 0], [-4, 3]]`,`schur(A)`],seealso:[`lyap`,`sylvester`]},lyap:{name:`lyap`,category:`Algebra`,syntax:[`lyap(A,Q)`],description:`Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P`,examples:[`lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])`,`A = [[-2, 0], [1, -4]]`,`Q = [[3, 1], [1, 3]]`,`lyap(A,Q)`],seealso:[`schur`,`sylvester`]},solveODE:{name:`solveODE`,category:`Numeric`,syntax:[`solveODE(func, tspan, y0)`,`solveODE(func, tspan, y0, options)`],description:`Numerical Integration of Ordinary Differential Equations.`,examples:[`f(t,y) = y`,`tspan = [0, 4]`,`solveODE(f, tspan, 1)`,`solveODE(f, tspan, [1, 2])`,`solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })`],seealso:[`derivative`,`simplifyCore`]},bernoulli:{name:`bernoulli`,category:`Probability`,syntax:[`bernoulli(n)`],description:`The nth Bernoulli number`,examples:[`bernoulli(4)`,`bernoulli(fraction(12))`],seealso:[`combinations`,`gamma`,`stirlingS2`]},combinations:{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`]},combinationsWithRep:{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`]},factorial:{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`]},gamma:{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`]},kldivergence:{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:[]},lgamma:{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`]},multinomial:{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`]},permutations:{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`]},pickRandom:{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`]},random:{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`]},randomInt:{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`]},compare:{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`]},compareNatural:{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`]},compareText:{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`]},deepEqual:{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`]},equal:{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`]},equalText:{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`]},larger:{name:`larger`,category:`Relational`,syntax:[`x > y`,`larger(x, y)`],description:`Check if value x is larger than y. Returns true if x is larger than y, and false if not. Comparing a value with NaN returns false.`,examples:[`2 > 3`,`5 > 2*2`,`a = 3.3`,`b = 6-2.8`,`(a > b)`,`(b < a)`,`5 cm > 2 inch`],seealso:[`equal`,`unequal`,`smaller`,`smallerEq`,`largerEq`,`compare`]},largerEq:{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`]},smaller:{name:`smaller`,category:`Relational`,syntax:[`x < y`,`smaller(x, y)`],description:`Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not. Comparing a value with NaN returns false.`,examples:[`2 < 3`,`5 < 2*2`,`a = 3.3`,`b = 6-2.8`,`(a < b)`,`5 cm < 2 inch`],seealso:[`equal`,`unequal`,`larger`,`smallerEq`,`largerEq`,`compare`]},smallerEq:{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`]},unequal:{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`]},setCartesian:{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`]},setDifference:{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`]},setDistinct:{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`]},setIntersect:{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`]},setIsSubset:{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`]},setMultiplicity:{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`]},setPowerset:{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`]},setSize:{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`]},setSymDifference:{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`]},setUnion:{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`]},zpk2tf:{name:`zpk2tf`,category:`Signal`,syntax:[`zpk2tf(z, p, k)`],description:`Compute the transfer function of a zero-pole-gain model.`,examples:[`zpk2tf([1, 2], [-1, -2], 1)`,`zpk2tf([1, 2], [-1, -2])`,`zpk2tf([1 - 3i, 2 + 2i], [-1, -2])`],seealso:[]},freqz:{name:`freqz`,category:`Signal`,syntax:[`freqz(b, a)`,`freqz(b, a, w)`],description:`Calculates the frequency response of a filter given its numerator and denominator coefficients.`,examples:[`freqz([1, 2], [1, 2, 3])`,`freqz([1, 2], [1, 2, 3], [0, 1])`,`freqz([1, 2], [1, 2, 3], 512)`],seealso:[]},erf:{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:[]},zeta:{name:`zeta`,category:`Special`,syntax:[`zeta(s)`],description:`Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane`,examples:[`zeta(0.2)`,`zeta(-0.5)`,`zeta(4)`],seealso:[]},cumsum:{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`]},mad:{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`]},max:{name:`max`,category:`Statistics`,syntax:[`max(a, b, c, ...)`,`max(A)`,`max(A, dimension)`],description:`Compute the maximum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.`,examples:[`max(2, 3, 4, 1)`,`max([2, 3, 4, 1])`,`max([2, 5; 4, 3])`,`max([2, 5; 4, 3], 1)`,`max([2, 5; 4, 3], 2)`,`max(2.7, 7.1, -4.5, 2.0, 4.1)`,`min(2.7, 7.1, -4.5, 2.0, 4.1)`],seealso:[`mean`,`median`,`min`,`prod`,`std`,`sum`,`variance`]},mean:{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`]},median:{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`]},min:{name:`min`,category:`Statistics`,syntax:[`min(a, b, c, ...)`,`min(A)`,`min(A, dimension)`],description:`Compute the minimum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.`,examples:[`min(2, 3, 4, 1)`,`min([2, 3, 4, 1])`,`min([2, 5; 4, 3])`,`min([2, 5; 4, 3], 1)`,`min([2, 5; 4, 3], 2)`,`min(2.7, 7.1, -4.5, 2.0, 4.1)`,`max(2.7, 7.1, -4.5, 2.0, 4.1)`],seealso:[`max`,`mean`,`median`,`prod`,`std`,`sum`,`variance`]},mode:{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`]},prod:{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`]},quantileSeq:{name:`quantileSeq`,category:`Statistics`,syntax:[`quantileSeq(A, prob[, sorted])`,`quantileSeq(A, [prob1, prob2, ...][, sorted])`,`quantileSeq(A, N[, sorted])`],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber.
In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:[`quantileSeq([3, -1, 5, 7], 0.5)`,`quantileSeq([3, -1, 5, 7], [1/3, 2/3])`,`quantileSeq([3, -1, 5, 7], 2)`,`quantileSeq([-1, 3, 5, 7], 0.5, true)`],seealso:[`mean`,`median`,`min`,`max`,`prod`,`std`,`sum`,`variance`]},std:{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`]},sum:{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`,`variance`]},variance:{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`]},corr:{name:`corr`,category:`Statistics`,syntax:[`corr(A,B)`],description:`Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.`,examples:[`corr([2, 4, 6, 8],[1, 2, 3, 6])`,`corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))`],seealso:[`max`,`mean`,`min`,`median`,`min`,`prod`,`std`,`sum`]},acos:{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`]},acosh:{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`]},acot:{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`]},acoth:{name:`acoth`,category:`Trigonometry`,syntax:[`acoth(x)`],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:[`acoth(2)`,`acoth(0.5)`],seealso:[`acsch`,`asech`]},acsc:{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`]},acsch:{name:`acsch`,category:`Trigonometry`,syntax:[`acsch(x)`],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:[`acsch(0.5)`],seealso:[`asech`,`acoth`]},asec:{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`]},asech:{name:`asech`,category:`Trigonometry`,syntax:[`asech(x)`],description:`Calculate the inverse secant of a value.`,examples:[`asech(0.5)`],seealso:[`acsch`,`acoth`]},asin:{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`]},asinh:{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`]},atan:{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`]},atanh:{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`]},atan2:{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`]},cos:{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`]},cosh:{name:`cosh`,category:`Trigonometry`,syntax:[`cosh(x)`],description:`Compute the hyperbolic cosine of x in radians.`,examples:[`cosh(0.5)`],seealso:[`sinh`,`tanh`,`coth`]},cot:{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`]},coth:{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`]},csc:{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`]},csch:{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`]},sec:{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`]},sech:{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`]},sin:{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`]},sinh:{name:`sinh`,category:`Trigonometry`,syntax:[`sinh(x)`],description:`Compute the hyperbolic sine of x in radians.`,examples:[`sinh(0.5)`],seealso:[`cosh`,`tanh`]},tan:{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`]},tanh:{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`]},to:{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:[]},toBest:{name:`toBest`,category:`Units`,syntax:[`toBest(x)`,`toBest(x, unitList)`,`toBest(x, unitList, options)`],description:`Converts to the most appropriate display unit.`,examples:[`toBest(unit(5000, "m"))`,`toBest(unit(3500000, "W"))`,`toBest(unit(0.000000123, "A"))`,`toBest(unit(10, "m"), "cm")`,`toBest(unit(10, "m"), "mm,km", {offset: 1.5})`],seealso:[]},clone:{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:[]},format:{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`]},bin:{name:`bin`,category:`Utils`,syntax:[`bin(value)`],description:`Format a number as binary`,examples:[`bin(2)`],seealso:[`oct`,`hex`]},oct:{name:`oct`,category:`Utils`,syntax:[`oct(value)`],description:`Format a number as octal`,examples:[`oct(56)`],seealso:[`bin`,`hex`]},hex:{name:`hex`,category:`Utils`,syntax:[`hex(value)`],description:`Format a number as hexadecimal`,examples:[`hex(240)`],seealso:[`bin`,`oct`]},isNaN:{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`,`isFinite`,`isBounded`]},isBounded:{name:`isBounded`,category:`Utils`,syntax:[`isBounded(x)`],description:`Test whether a value or its entries are bounded.`,examples:[`isBounded(Infinity)`,`isBounded(bigint(3))`,`isBounded([3, -Infinity, -3])`],seealso:[`isFinite`,`isNumeric`,`isNaN`,`isNegative`,`isPositive`]},isFinite:{name:`isFinite`,category:`Utils`,syntax:[`isFinite(x)`],description:`Test whether a value is finite, elementwise on collections.`,examples:[`isFinite(Infinity)`,`isFinite(bigint(3))`,`isFinite([3, -Infinity, -3])`],seealso:[`isBounded`,`isNumeric`,`isNaN`,`isNegative`,`isPositive`]},isInteger:{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`]},isNegative:{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`]},isNumeric:{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`,`isFinite`,`isBounded`]},hasNumericValue:{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`]},isPositive:{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`]},isPrime:{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`]},isZero:{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`]},print:{name:`print`,category:`Utils`,syntax:[`print(template, values)`,`print(template, values, precision)`],description:`Interpolate values into a string template.`,examples:[`print("Lucy is $age years old", {age: 5})`,`print("The value of pi is $pi", {pi: pi}, 3)`,`print("Hello, $user.name!", {user: {name: "John"}})`,`print("Values: $1, $2, $3", [6, 9, 4])`],seealso:[`format`]},typeOf:{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`]},numeric:{name:`numeric`,category:`Utils`,syntax:[`numeric(x)`],description:`Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.`,examples:[`numeric("4")`,`numeric("4", "number")`,`numeric("4", "bigint")`,`numeric("4", "BigNumber")`,`numeric("4", "Fraction")`,`numeric(4, "Fraction")`,`numeric(fraction(2, 5), "number")`],seealso:[`number`,`bigint`,`fraction`,`bignumber`,`string`,`format`]}},HU=`help`,UU=Z(HU,[`typed`,`mathWithTransform`,`Help`],e=>{var{typed:t,mathWithTransform:n,Help:r}=e;return t(HU,{any:function(e){var t,i=e;if(typeof e!=`string`){for(t in n)if(SD(n,t)&&e===n[t]){i=t;break}}var a=cE(VU,i);if(!a){var o=typeof i==`function`?i.name:i;throw Error(`No documentation found on "`+o+`"`)}return new r(a)}})}),WU=`chain`,GU=Z(WU,[`typed`,`Chain`],e=>{var{typed:t,Chain:n}=e;return t(WU,{"":function(){return new n},any:function(e){return new n(e)}})}),KU=`det`,qU=Z(KU,[`typed`,`matrix`,`subtractScalar`,`multiply`,`divideScalar`,`isZero`,`unaryMinus`],e=>{var{typed:t,matrix:n,subtractScalar:r,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(KU,{any:function(e){return mD(e)},"Array | Matrix":function(e){var t;switch(jE(e)?t=e.size():Array.isArray(e)?(e=n(e),t=e.size()):t=[],t.length){case 0:return mD(e);case 1:if(t[0]===1)return mD(e.valueOf()[0]);if(t[0]===0)return 1;throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);case 2:var r=t[0],i=t[1];if(r===i)return c(e.clone().valueOf(),r,i);if(i===0)return 1;throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);default:throw RangeError(`Matrix must be two dimensional (size: `+GA(t)+`)`)}}});function c(e,t,n){if(t===1)return mD(e[0][0]);if(t===2)return r(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var c=!1,l=Array(t).fill(0).map((e,t)=>t),u=0;u<t;u++){var d=l[u];if(o(e[d][u])){var f=void 0;for(f=u+1;f<t;f++)if(!o(e[l[f]][u])){d=l[f],l[f]=l[u],l[u]=d,c=!c;break}if(f===t)return e[d][u]}for(var p=e[d][u],m=u===0?1:e[l[u-1]][u-1],h=u+1;h<t;h++)for(var g=l[h],_=u+1;_<t;_++)e[g][_]=a(r(i(e[g][_],p),i(e[g][u],e[d][_])),m)}var v=e[l[t-1]][t-1];return c?s(v):v}}),JU=`inv`,YU=Z(JU,[`typed`,`matrix`,`divideScalar`,`addScalar`,`multiply`,`unaryMinus`,`det`,`identity`,`abs`],e=>{var{typed:t,matrix:n,divideScalar:r,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:c,abs:l}=e;return t(JU,{"Array | Matrix":function(e){var t=jE(e)?e.size():tj(e);switch(t.length){case 1:if(t[0]===1)return jE(e)?n([r(1,e.valueOf()[0])]):[r(1,e[0])];throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);case 2:var i=t[0],a=t[1];if(i===a)return jE(e)?n(u(e.valueOf(),i,a),e.storage()):u(e,i,a);throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);default:throw RangeError(`Matrix must be two dimensional (size: `+GA(t)+`)`)}},any:function(e){return r(1,e)}});function u(e,t,n){var u,d,f,p,m;if(t===1){if(p=e[0][0],p===0)throw Error(`Cannot calculate inverse, determinant is zero`);return[[r(1,p)]]}else if(t===2){var h=s(e);if(h===0)throw Error(`Cannot calculate inverse, determinant is zero`);return[[r(e[1][1],h),r(o(e[0][1]),h)],[r(o(e[1][0]),h),r(e[0][0],h)]]}else{var g=e.concat();for(u=0;u<t;u++)g[u]=g[u].concat();for(var _=c(t).valueOf(),v=0;v<n;v++){var y=l(g[v][v]),b=v;for(u=v+1;u<t;)l(g[u][v])>y&&(y=l(g[u][v]),b=u),u++;if(y===0)throw Error(`Cannot calculate inverse, determinant is zero`);u=b,u!==v&&(m=g[v],g[v]=g[u],g[u]=m,m=_[v],_[v]=_[u],_[u]=m);var x=g[v],S=_[v];for(u=0;u<t;u++){var C=g[u],w=_[u];if(u!==v){if(C[v]!==0){for(f=r(o(C[v]),x[v]),d=v;d<n;d++)C[d]=i(C[d],a(f,x[d]));for(d=0;d<n;d++)w[d]=i(w[d],a(f,S[d]))}}else{for(f=x[v],d=v;d<n;d++)C[d]=r(C[d],f);for(d=0;d<n;d++)w[d]=r(w[d],f)}}}return _}}}),XU=`pinv`,ZU=Z(XU,[`typed`,`matrix`,`inv`,`deepEqual`,`equal`,`dotDivide`,`dot`,`ctranspose`,`divideScalar`,`multiply`,`add`,`Complex`],e=>{var{typed:t,matrix:n,inv:r,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:c,divideScalar:l,multiply:u,add:d,Complex:f}=e;return t(XU,{"Array | Matrix":function(e){var t=jE(e)?e.size():tj(e);switch(t.length){case 1:return _(e)?c(e):t[0]===1?r(e):o(c(e),s(e,e));case 2:if(_(e))return c(e);var i=t[0],a=t[1];if(i===a)try{return r(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return jE(e)?n(p(e.valueOf(),i,a),e.storage()):p(e,i,a);default:throw RangeError(`Matrix must be two dimensional (size: `+GA(t)+`)`)}},any:function(e){return a(e,0)?mD(e):l(1,e)}});function p(e,t,n){var{C:i,F:a}=h(e,t,n),o=u(r(u(c(i),i)),c(i));return u(u(c(a),r(u(a,c(a)))),o)}function m(e,t,n){for(var r=mD(e),i=0,a=0;a<t;a++){if(n<=i)return r;for(var s=a;g(r[s][i]);)if(s++,t===s&&(s=a,i++,n===i))return r;[r[s],r[a]]=[r[a],r[s]];for(var c=r[a][i],l=0;l<n;l++)r[a][l]=o(r[a][l],c);for(var f=0;f<t;f++)if(f!==a){c=r[f][i];for(var p=0;p<n;p++)r[f][p]=d(r[f][p],u(-1,u(c,r[a][p])))}i++}return r}function h(e,t,n){var r=m(e,t,n);return{C:e.map((e,n)=>e.filter((e,n)=>n<t&&!g(s(r[n],r[n])))),F:r.filter((e,t)=>!g(s(r[t],r[t])))}}function g(e){return a(d(e,f(1,1)),d(0,f(1,1)))}function _(e){return i(d(e,f(1,1)),d(u(e,0),f(1,1)))}});function QU(e){var{addScalar:t,subtract:n,flatten:r,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:c,bignumber:l,diag:u,size:d,reshape:f,inv:p,qr:m,usolve:h,usolveAll:g,equal:_,complex:v,larger:y,smaller:b,matrixFromColumns:x,dot:S}=e;function C(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=w(e,t,n,r,i);T(e,t,n,r,i,a);var{values:o,C:s}=E(e,t,n,r,i);return i?{values:o,eigenvectors:D(e,t,s,a,o,n,r)}:{values:o}}function w(e,n,r,i,s){var d=i===`BigNumber`,f=i===`Complex`,p=d?l(0):0,m=d?l(1):f?v(1):1,h=d?l(1):1,g=d?l(10):2,x=a(g,g),S;s&&(S=Array(n).fill(m));for(var C=!1;!C;){C=!0;for(var w=0;w<n;w++){for(var T=p,E=p,D=0;D<n;D++)w!==D&&(T=t(T,c(e[D][w])),E=t(E,c(e[w][D])));if(!_(T,0)&&!_(E,0)){for(var O=h,k=T,A=o(E,g),j=a(E,g);b(k,A);)k=a(k,x),O=a(O,g);for(;y(k,j);)k=o(k,x),O=o(O,g);if(b(o(t(k,E),O),a(t(T,E),.95))){C=!1;for(var M=o(1,O),N=0;N<n;N++)w!==N&&(e[w][N]=a(e[w][N],M),e[N][w]=a(e[N][w],O));s&&(S[w]=a(S[w],M))}}}}return s?u(S):null}function T(e,r,i,s,u,d){var f=s===`BigNumber`,p=f?l(0):s===`Complex`?v(0):0;f&&(i=l(i));for(var m=0;m<r-2;m++){for(var h=0,g=p,_=m+1;_<r;_++){var y=e[_][m];b(c(g),c(y))&&(g=y,h=_)}if(!b(c(g),i)){if(h!==m+1){var x=e[h];e[h]=e[m+1],e[m+1]=x;for(var S=0;S<r;S++){var C=e[S][h];e[S][h]=e[S][m+1],e[S][m+1]=C}if(u){var w=d[h];d[h]=d[m+1],d[m+1]=w}}for(var T=m+2;T<r;T++){var E=o(e[T][m],g);if(E!==0){for(var D=0;D<r;D++)e[T][D]=n(e[T][D],a(E,e[m+1][D]));for(var O=0;O<r;O++)e[O][m+1]=t(e[O][m+1],a(E,e[O][T]));if(u)for(var k=0;k<r;k++)d[T][k]=n(d[T][k],a(E,d[m+1][k]))}}}}return d}function E(e,r,a,o,s){var d=o===`BigNumber`,f=d?l(1):o===`Complex`?v(1):1;d&&(a=l(a));for(var p=mD(e),h=[],g=r,_=[],y=s?u(Array(r).fill(f)):void 0,x=s?u(Array(g).fill(f)):void 0,S=0;S<=100;){S+=1;for(var C=p[g-1][g-1],w=0;w<g;w++)p[w][w]=n(p[w][w],C);var{Q:T,R:E}=m(p);p=i(E,T);for(var D=0;D<g;D++)p[D][D]=t(p[D][D],C);if(s&&(x=i(x,T)),g===1||b(c(p[g-1][g-2]),a)){S=0,h.push(p[g-1][g-1]),s&&(_.unshift([[1]]),A(x,r),y=i(y,x),g>1&&(x=u(Array(g-1).fill(f)))),--g,p.pop();for(var M=0;M<g;M++)p[M].pop()}else if(g===2||b(c(p[g-2][g-3]),a)){S=0;var N=O(p[g-2][g-2],p[g-2][g-1],p[g-1][g-2],p[g-1][g-1]);h.push(...N),s&&(_.unshift(k(p[g-2][g-2],p[g-2][g-1],p[g-1][g-2],p[g-1][g-1],N[0],N[1],a,o)),A(x,r),y=i(y,x),g>2&&(x=u(Array(g-2).fill(f)))),g-=2,p.pop(),p.pop();for(var P=0;P<g;P++)p[P].pop(),p[P].pop()}if(g===0)break}if(h.sort((e,t)=>+n(c(e),c(t))),S>100){var F=Error(`The eigenvalues failed to converge. Only found these eigenvalues: `+h.join(`, `));throw F.values=h,F.vectors=[],F}return{values:h,C:s?i(y,j(_,r)):void 0}}function D(e,t,a,o,s,c,d){var f=i(p(a),e,a),m=d===`BigNumber`,h=d===`Complex`,y=m?l(0):h?v(0):0,b=m?l(1):h?v(1):1,x=[],S=[];for(var C of s){var w=M(x,C,_);w===-1?(x.push(C),S.push(1)):S[w]+=1}for(var T=[],E=x.length,D=Array(t).fill(y),O=u(Array(t).fill(b)),k=function(){var e=x[A],s=n(f,i(e,O)),l=g(s,D);for(l.shift();l.length<S[A];){var u=N(s,t,l,c,d);if(u===null)break;l.push(u)}var m=i(p(o),a);l=l.map(e=>i(m,e)),T.push(...l.map(t=>({value:e,vector:r(t)})))},A=0;A<E;A++)k();return T}function O(e,r,i,o){var c=t(e,o),l=n(a(e,o),a(r,i)),u=a(c,.5),d=a(s(n(a(c,c),a(4,l))),.5);return[t(u,d),n(u,d)]}function k(e,t,r,i,a,o,s,u){var d=u===`BigNumber`,f=u===`Complex`,p=d?l(0):f?v(0):0,m=d?l(1):f?v(1):1;if(b(c(r),s))return[[m,p],[p,m]];if(y(c(n(a,o)),s))return[[n(a,i),n(o,i)],[r,r]];var h=n(e,a),g=n(i,a);return b(c(t),s)&&b(c(g),s)?[[h,m],[r,p]]:[[t,p],[g,m]]}function A(e,t){for(var n=0;n<e.length;n++)e[n].push(...Array(t-e[n].length).fill(0));for(var r=e.length;r<t;r++)e.push(Array(t).fill(0)),e[r][r]=1;return e}function j(e,t){for(var n=[],r=0;r<t;r++)n[r]=Array(t).fill(0);var i=0;for(var a of e){for(var o=a.length,s=0;s<o;s++)for(var c=0;c<o;c++)n[i+s][i+c]=a[s][c];i+=o}return n}function M(e,t,n){for(var r=0;r<e.length;r++)if(n(e[r],t))return r;return-1}function N(e,t,n,r,i){for(var a=i===`BigNumber`?l(1e3):1e3,o,s=0;s<5;++s){o=P(t,n,i);try{o=h(e,o)}catch{continue}if(y(I(o),a))break}if(s>=5)return null;for(s=0;;){var c=h(e,o);if(b(I(F(o,[c])),r))break;if(++s>=10)return null;o=L(c)}return o}function P(e,t,n){var r=n===`BigNumber`,i=n===`Complex`,a=Array(e).fill(0).map(e=>2*Math.random()-1);return r&&(a=a.map(e=>l(e))),i&&(a=a.map(e=>v(e))),a=F(a,t),L(a,n)}function F(e,t){var r=d(e);for(var a of t)a=f(a,r),e=n(e,i(o(S(a,e),S(a,a)),a));return e}function I(e){return c(s(S(e,e)))}function L(e,t){return i(o(t===`BigNumber`?l(1):t===`Complex`?v(1):1,I(e)),e)}return C}function $U(e){var{config:t,addScalar:n,subtract:r,abs:i,atan:a,cos:o,sin:s,multiplyScalar:c,inv:l,bignumber:u,multiply:d,add:f}=e;function p(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.relTol,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if(i===`number`)return m(e,r,a);if(i===`BigNumber`)return h(e,r,a);throw TypeError(`Unsupported data type: `+i)}function m(e,t,n){var r=e.length,i=Math.abs(t/r),a,o;if(n){o=Array(r);for(var s=0;s<r;s++)o[s]=Array(r).fill(0),o[s][s]=1}for(var c=S(e);Math.abs(c[1])>=Math.abs(i);){var l=c[0][0],u=c[0][1];a=g(e[l][l],e[u][u],e[l][u]),e=x(e,a,l,u),n&&(o=v(o,a,l,u)),c=S(e)}for(var d=Array(r).fill(0),f=0;f<r;f++)d[f]=e[f][f];return w(mD(d),o,n)}function h(e,t,n){var r=e.length,a=i(t/r),o,s;if(n){s=Array(r);for(var c=0;c<r;c++)s[c]=Array(r).fill(0),s[c][c]=1}for(var l=C(e);i(l[1])>=i(a);){var u=l[0][0],d=l[0][1];o=_(e[u][u],e[d][d],e[u][d]),e=b(e,o,u,d),n&&(s=y(s,o,u,d)),l=C(e)}for(var f=Array(r).fill(0),p=0;p<r;p++)f[p]=e[p][p];return w(mD(f),s,n)}function g(e,n,r){var i=n-e;return Math.abs(i)<=t.relTol?Math.PI/4:.5*Math.atan(2*r/(n-e))}function _(e,n,o){var s=r(n,e);return i(s)<=t.relTol?u(-1).acos().div(4):c(.5,a(d(2,o,l(s))))}function v(e,t,n,r){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),s=Array(i).fill(0),c=Array(i).fill(0),l=0;l<i;l++)s[l]=a*e[l][n]-o*e[l][r],c[l]=o*e[l][n]+a*e[l][r];for(var u=0;u<i;u++)e[u][n]=s[u],e[u][r]=c[u];return e}function y(e,t,i,a){for(var l=e.length,d=o(t),f=s(t),p=Array(l).fill(u(0)),m=Array(l).fill(u(0)),h=0;h<l;h++)p[h]=r(c(d,e[h][i]),c(f,e[h][a])),m[h]=n(c(f,e[h][i]),c(d,e[h][a]));for(var g=0;g<l;g++)e[g][i]=p[g],e[g][a]=m[g];return e}function b(e,t,i,a){for(var l=e.length,p=u(o(t)),m=u(s(t)),h=c(p,p),g=c(m,m),_=Array(l).fill(u(0)),v=Array(l).fill(u(0)),y=d(u(2),p,m,e[i][a]),b=n(r(c(h,e[i][i]),y),c(g,e[a][a])),x=f(c(g,e[i][i]),y,c(h,e[a][a])),S=0;S<l;S++)_[S]=r(c(p,e[i][S]),c(m,e[a][S])),v[S]=n(c(m,e[i][S]),c(p,e[a][S]));e[i][i]=b,e[a][a]=x,e[i][a]=u(0),e[a][i]=u(0);for(var C=0;C<l;C++)C!==i&&C!==a&&(e[i][C]=_[C],e[C][i]=_[C],e[a][C]=v[C],e[C][a]=v[C]);return e}function x(e,t,n,r){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),s=a*a,c=o*o,l=Array(i).fill(0),u=Array(i).fill(0),d=s*e[n][n]-2*a*o*e[n][r]+c*e[r][r],f=c*e[n][n]+2*a*o*e[n][r]+s*e[r][r],p=0;p<i;p++)l[p]=a*e[n][p]-o*e[r][p],u[p]=o*e[n][p]+a*e[r][p];e[n][n]=d,e[r][r]=f,e[n][r]=0,e[r][n]=0;for(var m=0;m<i;m++)m!==n&&m!==r&&(e[n][m]=l[m],e[m][n]=l[m],e[r][m]=u[m],e[m][r]=u[m]);return e}function S(e){for(var t=e.length,n=0,r=[0,1],i=0;i<t;i++)for(var a=i+1;a<t;a++)Math.abs(n)<Math.abs(e[i][a])&&(n=Math.abs(e[i][a]),r=[i,a]);return[r,n]}function C(e){for(var t=e.length,n=0,r=[0,1],a=0;a<t;a++)for(var o=a+1;o<t;o++)i(n)<i(e[a][o])&&(n=i(e[a][o]),r=[a,o]);return[r,n]}function w(e,t,n){var r=e.length,a=Array(r),o;if(n){o=Array(r);for(var s=0;s<r;s++)o[s]=Array(r)}for(var c=0;c<r;c++){for(var l=0,u=e[0],d=0;d<e.length;d++)i(e[d])<i(u)&&(l=d,u=e[l]);if(a[c]=e.splice(l,1)[0],n)for(var f=0;f<r;f++)o[c][f]=t[f][l],t[f].splice(l,1)}return n?{values:a,eigenvectors:o.map((e,t)=>({value:a[t],vector:e}))}:{values:a}}return p}var eW=Z(`eigs`,`config.typed.matrix.addScalar.equal.subtract.abs.atan.cos.sin.multiplyScalar.divideScalar.inv.bignumber.multiply.add.larger.column.flatten.number.complex.sqrt.diag.size.reshape.qr.usolve.usolveAll.im.re.smaller.matrixFromColumns.dot`.split(`.`),e=>{var{config:t,typed:n,matrix:r,addScalar:i,subtract:a,equal:o,abs:s,atan:c,cos:l,sin:u,multiplyScalar:d,divideScalar:f,inv:p,bignumber:m,multiply:h,add:g,larger:_,column:v,flatten:y,number:b,complex:x,sqrt:S,diag:C,size:w,reshape:T,qr:E,usolve:D,usolveAll:O,im:k,re:A,smaller:j,matrixFromColumns:M,dot:N}=e,P=$U({config:t,addScalar:i,subtract:a,column:v,flatten:y,equal:o,abs:s,atan:c,cos:l,sin:u,multiplyScalar:d,inv:p,bignumber:m,complex:x,multiply:h,add:g}),F=QU({config:t,addScalar:i,subtract:a,multiply:h,multiplyScalar:d,flatten:y,divideScalar:f,sqrt:S,abs:s,bignumber:m,diag:C,size:w,reshape:T,qr:E,inv:p,usolve:D,usolveAll:O,equal:o,complex:x,larger:_,smaller:j,matrixFromColumns:M,dot:N});return n(`eigs`,{Array:function(e){return I(r(e))},"Array, number|BigNumber":function(e,t){return I(r(e),{precision:t})},"Array, Object"(e,t){return I(r(e),t)},Matrix:function(e){return I(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return I(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){var n={matricize:!0};return oE(n,t),I(e,n)}});function I(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=`eigenvectors`in n?n.eigenvectors:!0,a=L(e,n.precision??t.relTol,i);return n.matricize&&(a.values=r(a.values),i&&(a.eigenvectors=a.eigenvectors.map(e=>{var{value:t,vector:n}=e;return{value:t,vector:r(n)}}))),i&&Object.defineProperty(a,`vectors`,{enumerable:!1,get:()=>{throw Error(`eigs(M).vectors replaced with eigs(M).eigenvectors`)}}),a}function L(e,t,n){var r=e.toArray(),i=e.size();if(i.length!==2||i[0]!==i[1])throw RangeError(`Matrix must be square (size: ${GA(i)})`);var a=i[0];return R(r,a,t)&&(te(r,a),ee(r,a,t))?P(r,a,t,z(e,r,a),n):F(r,a,t,z(e,r,a),n)}function ee(e,t,n){for(var r=0;r<t;r++)for(var i=r;i<t;i++)if(_(m(s(a(e[r][i],e[i][r]))),n))return!1;return!0}function R(e,t,n){for(var r=0;r<t;r++)for(var i=0;i<t;i++)if(_(m(s(k(e[r][i]))),n))return!1;return!0}function te(e,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)e[n][r]=A(e[n][r])}function z(e,t,n){var r=e.datatype();if(r===`number`||r===`BigNumber`||r===`Complex`)return r;for(var i=!1,a=!1,o=!1,s=0;s<n;s++)for(var c=0;c<n;c++){var l=t[s][c];if(CE(l)||DE(l))i=!0;else if(wE(l))a=!0;else if(EE(l))o=!0;else throw TypeError(`Unsupported type in Matrix: `+pD(l))}if(a&&o&&console.warn(`Complex BigNumbers not supported, this operation will lose precission.`),o){for(var u=0;u<n;u++)for(var d=0;d<n;d++)t[u][d]=x(t[u][d]);return`Complex`}if(a){for(var f=0;f<n;f++)for(var p=0;p<n;p++)t[f][p]=m(t[f][p]);return`BigNumber`}if(i){for(var h=0;h<n;h++)for(var g=0;g<n;g++)t[h][g]=b(t[h][g]);return`number`}else throw TypeError(`Matrix contains unsupported types only.`)}}),tW=`expm`,nW=Z(tW,[`typed`,`abs`,`add`,`identity`,`inv`,`multiply`],e=>{var{typed:t,abs:n,add:r,identity:i,inv:a,multiply:o}=e;return t(tW,{Matrix:function(e){var t=e.size();if(t.length!==2||t[0]!==t[1])throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);for(var n=t[0],l=c(s(e),1e-15),u=l.q,d=l.j,f=o(e,2**-d),p=i(n),m=i(n),h=1,g=f,_=-1,v=1;v<=u;v++)v>1&&(g=o(g,f),_=-_),h=h*(u-v+1)/((2*u-v+1)*v),p=r(p,o(h,g)),m=r(m,o(h*_,g));for(var y=o(a(m),p),b=0;b<d;b++)y=o(y,y);return PE(e)?e.createSparseMatrix(y):y}});function s(e){for(var t=e.size()[0],r=0,i=0;i<t;i++){for(var a=0,o=0;o<t;o++)a+=n(e.get([i,o]));r=Math.max(a,r)}return r}function c(e,t){for(var n=30,r=0;r<n;r++)for(var i=0;i<=r;i++){var a=r-i;if(l(e,i,a)<t)return{q:i,j:a}}throw Error(`Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)`)}function l(e,t,n){for(var r=1,i=2;i<=t;i++)r*=i;for(var a=r,o=t+1;o<=2*t;o++)a*=o;var s=a*(2*t+1);return 8*(e/2**n)**(2*t)*r*r/(a*s)}}),rW=`sqrtm`,iW=Z(rW,[`typed`,`abs`,`add`,`multiply`,`map`,`sqrt`,`subtract`,`inv`,`size`,`max`,`identity`],e=>{var{typed:t,abs:n,add:r,multiply:i,map:a,sqrt:o,subtract:s,inv:c,size:l,max:u,identity:d}=e,f=1e3,p=1e-6;function m(e){var t,a=0,o=e,m=d(l(e));do{var h=o;if(o=i(.5,r(h,c(m))),m=i(.5,r(m,c(h))),t=u(n(s(o,h))),t>p&&++a>f)throw Error(`computing square root of matrix: iterative method could not converge`)}while(t>p);return o}return t(rW,{"Array | Matrix":function(e){var t=jE(e)?e.size():tj(e);switch(t.length){case 1:if(t[0]===1)return a(e,o);throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);case 2:if(t[0]===t[1])return m(e);throw RangeError(`Matrix must be square (size: `+GA(t)+`)`);default:throw RangeError(`Matrix must be at most two dimensional (size: `+GA(t)+`)`)}}})}),aW=`sylvester`,oW=Z(aW,[`typed`,`schur`,`matrixFromColumns`,`matrix`,`multiply`,`range`,`concat`,`transpose`,`index`,`subset`,`add`,`subtract`,`identity`,`lusolve`,`abs`],e=>{var{typed:t,schur:n,matrixFromColumns:r,matrix:i,multiply:a,range:o,concat:s,transpose:c,index:l,subset:u,add:d,subtract:f,identity:p,lusolve:m,abs:h,config:g}=e;return t(aW,{"Matrix, Matrix, Matrix":_,"Array, Matrix, Matrix":function(e,t,n){return _(i(e),t,n)},"Array, Array, Matrix":function(e,t,n){return _(i(e),i(t),n)},"Array, Matrix, Array":function(e,t,n){return _(i(e),t,i(n))},"Matrix, Array, Matrix":function(e,t,n){return _(e,i(t),n)},"Matrix, Array, Array":function(e,t,n){return _(e,i(t),i(n))},"Matrix, Matrix, Array":function(e,t,n){return _(e,t,i(n))},"Array, Array, Array":function(e,t,n){return _(i(e),i(t),i(n)).toArray()}});function _(e,t,g){for(var _=t.size()[0],v=e.size()[0],y=n(e),b=y.T,x=y.U,S=n(a(-1,t)),C=S.T,w=S.U,T=a(a(c(x),g),w),E=o(0,v),D=[],O=(e,t)=>s(e,t,1),k=(e,t)=>s(e,t,0),A=0;A<_;A++)if(A<_-1&&h(u(C,l(A+1,A)))>1e-5){for(var j=k(u(T,l(E,[A])),u(T,l(E,[A+1]))),M=0;M<A;M++)j=d(j,k(a(D[M],u(C,l(M,A))),a(D[M],u(C,l(M,A+1)))));var N=a(p(v),a(-1,u(C,l(A,A)))),P=a(p(v),a(-1,u(C,l(A+1,A)))),F=a(p(v),a(-1,u(C,l(A,A+1)))),I=a(p(v),a(-1,u(C,l(A+1,A+1)))),L=m(k(O(d(b,N),P),O(F,d(b,I))),j);D[A]=L.subset(l(o(0,v),[0])),D[A+1]=L.subset(l(o(v,2*v),[0])),A++}else{for(var ee=u(T,l(E,[A])),R=0;R<A;R++)ee=d(ee,a(D[R],u(C,l(R,A))));D[A]=m(f(b,a(u(C,l(A,A)),p(v))),ee)}return a(x,a(i(r(...D)),c(w)))}}),sW=`schur`,cW=Z(sW,[`typed`,`matrix`,`identity`,`multiply`,`qr`,`norm`,`subtract`],e=>{var{typed:t,matrix:n,identity:r,multiply:i,qr:a,norm:o,subtract:s}=e;return t(sW,{Array:function(e){var t=c(n(e));return{U:t.U.valueOf(),T:t.T.valueOf()}},Matrix:function(e){return c(e)}});function c(e){var t=e.size()[0],n=e,c=r(t),l=0,u;do{u=n;var d=a(n),f=d.Q,p=d.R;if(n=i(p,f),c=i(c,f),l++>100)break}while(o(s(n,u))>1e-4);return{U:c,T:n}}}),lW=`lyap`,uW=Z(lW,[`typed`,`matrix`,`sylvester`,`multiply`,`transpose`],e=>{var{typed:t,matrix:n,sylvester:r,multiply:i,transpose:a}=e;return t(lW,{"Matrix, Matrix":function(e,t){return r(e,a(e),i(-1,t))},"Array, Matrix":function(e,t){return r(n(e),a(n(e)),i(-1,t))},"Matrix, Array":function(e,t){return r(e,a(n(e)),n(i(-1,t)))},"Array, Array":function(e,t){return r(n(e),a(n(e)),n(i(-1,t))).toArray()}})}),dW=Z(`divide`,[`typed`,`matrix`,`multiply`,`equalScalar`,`divideScalar`,`inv`],e=>{var{typed:t,matrix:n,multiply:r,equalScalar:i,divideScalar:a,inv:o}=e,s=UP({typed:t,equalScalar:i}),c=GP({typed:t});return t(`divide`,gD({"Array | Matrix, Array | Matrix":function(e,t){return r(e,o(t))},"DenseMatrix, any":function(e,t){return c(e,t,a,!1)},"SparseMatrix, any":function(e,t){return s(e,t,a,!1)},"Array, any":function(e,t){return c(n(e),t,a,!1).valueOf()},"any, Array | Matrix":function(e,t){return r(e,o(t))}},a.signatures))}),fW=`distance`,pW=Z(fW,[`typed`,`addScalar`,`subtractScalar`,`divideScalar`,`multiplyScalar`,`deepEqual`,`sqrt`,`abs`],e=>{var{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:c}=e;return t(fW,{"Array, Array, Array":function(e,t,n){if(e.length===2&&t.length===2&&n.length===2){if(!u(e))throw TypeError(`Array with 2 numbers or BigNumbers expected for first argument`);if(!u(t))throw TypeError(`Array with 2 numbers or BigNumbers expected for second argument`);if(!u(n))throw TypeError(`Array with 2 numbers or BigNumbers expected for third argument`);if(o(t,n))throw TypeError(`LinePoint1 should not be same with LinePoint2`);var a=r(n[1],t[1]),s=r(t[0],n[0]),c=r(i(n[0],t[1]),i(t[0],n[1]));return g(e[0],e[1],a,s,c)}else throw TypeError(`Invalid Arguments: Try again`)},"Object, Object, Object":function(e,t,n){if(Object.keys(e).length===2&&Object.keys(t).length===2&&Object.keys(n).length===2){if(!u(e))throw TypeError(`Values of pointX and pointY should be numbers or BigNumbers`);if(!u(t))throw TypeError(`Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers`);if(!u(n))throw TypeError(`Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers`);if(o(m(t),m(n)))throw TypeError(`LinePoint1 should not be same with LinePoint2`);if(`pointX`in e&&`pointY`in e&&`lineOnePtX`in t&&`lineOnePtY`in t&&`lineTwoPtX`in n&&`lineTwoPtY`in n){var a=r(n.lineTwoPtY,t.lineOnePtY),s=r(t.lineOnePtX,n.lineTwoPtX),c=r(i(n.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,n.lineTwoPtY));return g(e.pointX,e.pointY,a,s,c)}else throw TypeError(`Key names do not match`)}else throw TypeError(`Invalid Arguments: Try again`)},"Array, Array":function(e,t){if(e.length===2&&t.length===3){if(!u(e))throw TypeError(`Array with 2 numbers or BigNumbers expected for first argument`);if(!d(t))throw TypeError(`Array with 3 numbers or BigNumbers expected for second argument`);return g(e[0],e[1],t[0],t[1],t[2])}else if(e.length===3&&t.length===6){if(!d(e))throw TypeError(`Array with 3 numbers or BigNumbers expected for first argument`);if(!p(t))throw TypeError(`Array with 6 numbers or BigNumbers expected for second argument`);return _(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}else if(e.length===t.length&&e.length>0){if(!f(e)||!f(t))throw TypeError(`All values of an array should be numbers or BigNumbers`);return v(e,t)}else throw TypeError(`Invalid Arguments: Try again`)},"Object, Object":function(e,t){if(Object.keys(e).length===2&&Object.keys(t).length===3){if(!u(e))throw TypeError(`Values of pointX and pointY should be numbers or BigNumbers`);if(!d(t))throw TypeError(`Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers`);if(`pointX`in e&&`pointY`in e&&`xCoeffLine`in t&&`yCoeffLine`in t&&`constant`in t)return g(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw TypeError(`Key names do not match`)}else if(Object.keys(e).length===3&&Object.keys(t).length===6){if(!d(e))throw TypeError(`Values of pointX, pointY and pointZ should be numbers or BigNumbers`);if(!p(t))throw TypeError(`Values of x0, y0, z0, a, b and c should be numbers or BigNumbers`);if(`pointX`in e&&`pointY`in e&&`x0`in t&&`y0`in t&&`z0`in t&&`a`in t&&`b`in t&&`c`in t)return _(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw TypeError(`Key names do not match`)}else if(Object.keys(e).length===2&&Object.keys(t).length===2){if(!u(e))throw TypeError(`Values of pointOneX and pointOneY should be numbers or BigNumbers`);if(!u(t))throw TypeError(`Values of pointTwoX and pointTwoY should be numbers or BigNumbers`);if(`pointOneX`in e&&`pointOneY`in e&&`pointTwoX`in t&&`pointTwoY`in t)return v([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw TypeError(`Key names do not match`)}else if(Object.keys(e).length===3&&Object.keys(t).length===3){if(!d(e))throw TypeError(`Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers`);if(!d(t))throw TypeError(`Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers`);if(`pointOneX`in e&&`pointOneY`in e&&`pointOneZ`in e&&`pointTwoX`in t&&`pointTwoY`in t&&`pointTwoZ`in t)return v([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw TypeError(`Key names do not match`)}else throw TypeError(`Invalid Arguments: Try again`)},Array:function(e){if(!h(e))throw TypeError(`Incorrect array format entered for pairwise distance calculation`);return y(e)}});function l(e){return typeof e==`number`||wE(e)}function u(e){return e.constructor!==Array&&(e=m(e)),l(e[0])&&l(e[1])}function d(e){return e.constructor!==Array&&(e=m(e)),l(e[0])&&l(e[1])&&l(e[2])}function f(e){return Array.isArray(e)||(e=m(e)),e.every(l)}function p(e){return e.constructor!==Array&&(e=m(e)),l(e[0])&&l(e[1])&&l(e[2])&&l(e[3])&&l(e[4])&&l(e[5])}function m(e){for(var t=Object.keys(e),n=[],r=0;r<t.length;r++)n.push(e[t[r]]);return n}function h(e){if(e[0].length===2&&l(e[0][0])&&l(e[0][1])){if(e.some(e=>e.length!==2||!l(e[0])||!l(e[1])))return!1}else if(e[0].length===3&&l(e[0][0])&&l(e[0][1])&&l(e[0][2])){if(e.some(e=>e.length!==3||!l(e[0])||!l(e[1])||!l(e[2])))return!1}else return!1;return!0}function g(e,t,r,o,l){return a(c(n(n(i(r,e),i(o,t)),l)),s(n(i(r,r),i(o,o))))}function _(e,t,o,c,l,u,d,f,p){var m=[r(i(r(l,t),p),i(r(u,o),f)),r(i(r(u,o),d),i(r(c,e),p)),r(i(r(c,e),f),i(r(l,t),d))];m=s(n(n(i(m[0],m[0]),i(m[1],m[1])),i(m[2],m[2])));var h=s(n(n(i(d,d),i(f,f)),i(p,p)));return a(m,h)}function v(e,t){for(var a=e.length,o=0,c=0,l=0;l<a;l++)c=r(e[l],t[l]),o=n(i(c,c),o);return s(o)}function y(e){for(var t=[],n=[],r=[],i=0;i<e.length-1;i++)for(var a=i+1;a<e.length;a++)e[0].length===2?(n=[e[i][0],e[i][1]],r=[e[a][0],e[a][1]]):e[0].length===3&&(n=[e[i][0],e[i][1],e[i][2]],r=[e[a][0],e[a][1],e[a][2]]),t.push(v(n,r));return t}}),mW=Z(`intersect`,[`typed`,`config`,`abs`,`add`,`addScalar`,`matrix`,`multiply`,`multiplyScalar`,`divideScalar`,`subtract`,`smaller`,`equalScalar`,`flatten`,`isZero`,`isNumeric`],e=>{var{typed:t,config:n,abs:r,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:c,divideScalar:l,subtract:u,smaller:d,equalScalar:f,flatten:p,isZero:m,isNumeric:h}=e;return t(`intersect`,{"Array, Array, Array":g,"Array, Array, Array, Array":_,"Matrix, Matrix, Matrix":function(e,t,n){var r=g(e.valueOf(),t.valueOf(),n.valueOf());return r===null?null:o(r)},"Matrix, Matrix, Matrix, Matrix":function(e,t,n,r){var i=_(e.valueOf(),t.valueOf(),n.valueOf(),r.valueOf());return i===null?null:o(i)}});function g(e,t,n){if(e=v(e),t=v(t),n=v(n),!b(e))throw TypeError(`Array with 3 numbers or BigNumbers expected for first argument`);if(!b(t))throw TypeError(`Array with 3 numbers or BigNumbers expected for second argument`);if(!x(n))throw TypeError(`Array with 4 numbers expected as third argument`);return T(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],n[3])}function _(e,t,n,r){if(e=v(e),t=v(t),n=v(n),r=v(r),e.length===2){if(!y(e))throw TypeError(`Array with 2 numbers or BigNumbers expected for first argument`);if(!y(t))throw TypeError(`Array with 2 numbers or BigNumbers expected for second argument`);if(!y(n))throw TypeError(`Array with 2 numbers or BigNumbers expected for third argument`);if(!y(r))throw TypeError(`Array with 2 numbers or BigNumbers expected for fourth argument`);return S(e,t,n,r)}else if(e.length===3){if(!b(e))throw TypeError(`Array with 3 numbers or BigNumbers expected for first argument`);if(!b(t))throw TypeError(`Array with 3 numbers or BigNumbers expected for second argument`);if(!b(n))throw TypeError(`Array with 3 numbers or BigNumbers expected for third argument`);if(!b(r))throw TypeError(`Array with 3 numbers or BigNumbers expected for fourth argument`);return w(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],r[0],r[1],r[2])}else throw TypeError(`Arrays with two or thee dimensional points expected`)}function v(e){return e.length===1?e[0]:e.length>1&&Array.isArray(e[0])&&e.every(e=>Array.isArray(e)&&e.length===1)?p(e):e}function y(e){return e.length===2&&h(e[0])&&h(e[1])}function b(e){return e.length===3&&h(e[0])&&h(e[1])&&h(e[2])}function x(e){return e.length===4&&h(e[0])&&h(e[1])&&h(e[2])&&h(e[3])}function S(e,t,o,f){var p=e,h=o,g=u(p,t),_=u(h,f),v=u(c(g[0],_[1]),c(_[0],g[1]));if(m(v)||d(r(v),n.relTol))return null;var y=c(_[0],p[1]),b=c(_[1],p[0]),x=c(_[0],h[1]),S=c(_[1],h[0]);return i(s(g,l(a(u(u(y,b),x),S),v)),p)}function C(e,t,n,r,i,o,s,l,d,f,p,m){var h=c(u(e,t),u(n,r)),g=c(u(i,o),u(s,l)),_=c(u(d,f),u(p,m));return a(a(h,g),_)}function w(e,t,n,r,i,o,s,d,p,h,g,_){var v=C(e,s,h,s,t,d,g,d,n,p,_,p),y=C(h,s,r,e,g,d,i,t,_,p,o,n),b=C(e,s,r,e,t,d,i,t,n,p,o,n),x=C(h,s,h,s,g,d,g,d,_,p,_,p),S=C(r,e,r,e,i,t,i,t,o,n,o,n),w=u(c(v,y),c(b,x)),T=u(c(S,x),c(y,y));if(m(T))return null;var E=l(w,T),D=l(a(v,c(E,y)),x),O=a(e,c(E,u(r,e))),k=a(t,c(E,u(i,t))),A=a(n,c(E,u(o,n))),j=a(s,c(D,u(h,s))),M=a(d,c(D,u(g,d))),N=a(p,c(D,u(_,p)));return f(O,j)&&f(k,M)&&f(A,N)?[O,k,A]:null}function T(e,t,n,r,i,o,s,d,f,p){var m=c(e,s),h=c(r,s),g=c(t,d),_=c(i,d),v=c(n,f),y=c(o,f),b=l(u(u(u(p,m),g),v),u(u(u(a(a(h,_),y),m),g),v));return[a(e,c(b,u(r,e))),a(t,c(b,u(i,t))),a(n,c(b,u(o,n)))]}}),hW=`sum`,gW=Z(hW,[`typed`,`config`,`add`,`numeric`],e=>{var{typed:t,config:n,add:r,numeric:i}=e;return t(hW,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(e){if(Kj(e))throw TypeError(`Scalar values expected in function sum`);return a(e)}});function a(e){var t;return qj(e,function(e){try{t=t===void 0?e:r(t,e)}catch(t){throw uR(t,`sum`,e)}}),t===void 0&&(t=i(0,n.number)),typeof t==`string`&&(t=i(t,FD(t,n))),t}function o(e,t){try{return Yj(e,t,r)}catch(e){throw uR(e,`sum`)}}}),_W=`cumsum`,vW=Z(_W,[`typed`,`add`,`unaryPlus`],e=>{var{typed:t,add:n,unaryPlus:r}=e;return t(_W,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,t){return e.create(o(e.valueOf(),t),e.datatype())},"...":function(e){if(Kj(e))throw TypeError(`All values expected to be scalar in function cumsum`);return i(e)}});function i(e){try{return a(e)}catch(e){throw uR(e,_W)}}function a(e){if(e.length===0)return[];for(var t=[r(e[0])],i=1;i<e.length;++i)t.push(n(t[i-1],e[i]));return t}function o(e,t){var n=tj(e);if(t<0||t>=n.length)throw new ej(t,n.length);try{return s(e,t)}catch(e){throw uR(e,_W)}}function s(e,t){var n,r,i;if(t<=0){var o=e[0][0];if(Array.isArray(o)){for(i=Gj(e),r=[],n=0;n<i.length;n++)r[n]=s(i[n],t-1);return r}else return a(e)}else{for(r=[],n=0;n<e.length;n++)r[n]=s(e[n],t-1);return r}}}),yW=`mean`,bW=Z(yW,[`typed`,`add`,`divide`],e=>{var{typed:t,add:n,divide:r}=e;return t(yW,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(e){if(Kj(e))throw TypeError(`Scalar values expected in function mean`);return a(e)}});function i(e,t){try{return r(Yj(e,t,n),(Array.isArray(e)?tj(e):e.size())[t])}catch(e){throw uR(e,`mean`)}}function a(e){var t,i=0;if(qj(e,function(e){try{t=t===void 0?e:n(t,e),i++}catch(t){throw uR(t,`mean`,e)}}),i===0)throw Error(`Cannot calculate the mean of an empty array`);return r(t,i)}}),xW=`median`,SW=Z(xW,[`typed`,`add`,`divide`,`compare`,`partitionSelect`],e=>{var{typed:t,add:n,divide:r,compare:i,partitionSelect:a}=e;function o(e){try{e=_j(e.valueOf());var t=e.length;if(t===0)throw Error(`Cannot calculate median of an empty array`);if(t%2==0){for(var n=t/2-1,r=a(e,n+1),o=e[n],l=0;l<n;++l)i(e[l],o)>0&&(o=e[l]);return c(o,r)}else return s(a(e,(t-1)/2))}catch(e){throw uR(e,`median`)}}var s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),c=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return r(n(e,t),2)}});return t(xW,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw Error(`median(A, dim) is not yet supported`)},"...":function(e){if(Kj(e))throw TypeError(`Scalar values expected in function median`);return o(e)}})}),CW=`mad`,wW=Z(CW,[`typed`,`abs`,`map`,`median`,`subtract`],e=>{var{typed:t,abs:n,map:r,median:i,subtract:a}=e;return t(CW,{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(e=_j(e.valueOf()),e.length===0)throw Error(`Cannot calculate median absolute deviation (mad) of an empty array`);try{var t=i(e);return i(r(e,function(e){return n(a(e,t))}))}catch(e){throw e instanceof TypeError&&e.message.includes(`median`)?TypeError(e.message.replace(`median`,`mad`)):uR(e,`mad`)}}}),TW=`unbiased`,EW=`variance`,DW=Z(EW,[`typed`,`add`,`subtract`,`multiply`,`divide`,`mapSlices`,`isNaN`],e=>{var{typed:t,add:n,subtract:r,multiply:i,divide:a,mapSlices:o,isNaN:s}=e;return t(EW,{"Array | Matrix":function(e){return c(e,TW)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(e,t){return l(e,t,TW)},"Array | Matrix, number | BigNumber, string":l,"...":function(e){return c(e,TW)}});function c(e,t){var o,c=0;if(e.length===0)throw SyntaxError(`Function variance requires one or more parameters (0 provided)`);if(qj(e,function(e){try{o=o===void 0?e:n(o,e),c++}catch(t){throw uR(t,`variance`,e)}}),c===0)throw Error(`Cannot calculate variance of an empty array`);var l=a(o,c);if(o=void 0,qj(e,function(e){var t=r(e,l);o=o===void 0?i(t,t):n(o,i(t,t))}),s(o))return o;switch(t){case`uncorrected`:return a(o,c);case`biased`:return a(o,c+1);case`unbiased`:var u=wE(o)?o.mul(0):0;return c===1?u:a(o,c-1);default:throw Error(`Unknown normalization "`+t+`". Choose "unbiased" (default), "uncorrected", or "biased".`)}}function l(e,t,n){try{if(e.length===0)throw SyntaxError(`Function variance requires one or more parameters (0 provided)`);return o(e,t,e=>c(e,n))}catch(e){throw uR(e,`variance`)}}}),OW=`quantileSeq`,kW=Z(OW,[`typed`,`?bignumber`,`add`,`subtract`,`divide`,`multiply`,`partitionSelect`,`compare`,`isInteger`,`smaller`,`smallerEq`,`larger`,`mapSlices`],e=>{var{typed:t,bignumber:n,add:r,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:c,isInteger:l,smaller:u,smallerEq:d,larger:f,mapSlices:p}=e;return t(OW,{"Array | Matrix, number | BigNumber":(e,t)=>h(e,t,!1),"Array | Matrix, number | BigNumber, number":(e,t,n)=>m(e,t,!1,n,h),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>m(e,t,n,r,h),"Array | Matrix, Array | Matrix":(e,t)=>g(e,t,!1),"Array | Matrix, Array | Matrix, number":(e,t,n)=>m(e,t,!1,n,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>m(e,t,n,r,g)});function m(e,t,n,r,i){return p(e,r,e=>i(e,t,n))}function h(e,t,i){var o,s=e.valueOf();if(u(t,0))throw Error(`N/prob must be non-negative`);if(d(t,1))return CE(t)?_(s,t,i):n(_(s,t,i));if(f(t,1)){if(!l(t))throw Error(`N must be a positive integer`);if(f(t,4294967295))throw Error(`N must be less than or equal to 2^32-1, as that is the maximum length of an Array`);var c=r(t,1);o=[];for(var p=0;u(p,t);p++){var m=a(p+1,c);o.push(_(s,m,i))}return CE(t)?o:n(o)}}function g(e,t,n){for(var r=e.valueOf(),i=t.valueOf(),a=[],o=0;o<i.length;++o)a.push(_(r,i[o],n));return a}function _(e,t,n){var a=_j(e),u=a.length;if(u===0)throw Error(`Cannot calculate quantile of an empty sequence`);var d=CE(t)?t*(u-1):t.times(u-1),f=CE(t)?Math.floor(d):d.floor().toNumber(),p=CE(t)?d%1:d.minus(f);if(l(d))return n?a[d]:s(a,CE(t)?d:d.valueOf());var m,h;if(n)m=a[f],h=a[f+1];else{h=s(a,f+1),m=a[f];for(var g=0;g<f;++g)c(a[g],m)>0&&(m=a[g])}return r(o(m,i(1,p)),o(h,p))}}),AW=`std`,jW=Z(AW,[`typed`,`map`,`sqrt`,`variance`],e=>{var{typed:t,map:n,sqrt:r,variance:i}=e;return t(AW,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,t){if(e.length===0)throw SyntaxError(`Function std requires one or more parameters (0 provided)`);try{var a=i.apply(null,arguments);return ME(a)?n(a,r):r(a)}catch(e){throw e instanceof TypeError&&e.message.includes(` variance`)?TypeError(e.message.replace(` variance`,` std`)):e}}}),MW=`corr`,NW=Z(MW,[`typed`,`matrix`,`mean`,`sqrt`,`sum`,`add`,`subtract`,`multiply`,`pow`,`divide`],e=>{var{typed:t,matrix:n,sqrt:r,sum:i,add:a,subtract:o,multiply:s,pow:c,divide:l}=e;return t(MW,{"Array, Array":function(e,t){return u(e,t)},"Matrix, Matrix":function(e,t){var r=u(e.toArray(),t.toArray());return Array.isArray(r)?n(r):r}});function u(e,t){var n=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw SyntaxError(`Dimension mismatch. Array A and B must have the same length.`);for(var r=0;r<e.length;r++){if(e[r].length!==t[r].length)throw SyntaxError(`Dimension mismatch. Array A and B must have the same number of elements.`);n.push(d(e[r],t[r]))}return n}else{if(e.length!==t.length)throw SyntaxError(`Dimension mismatch. Array A and B must have the same number of elements.`);return d(e,t)}}function d(e,t){var n=e.length,u=i(e),d=i(t),f=e.reduce((e,n,r)=>a(e,s(n,t[r])),0),p=i(e.map(e=>c(e,2))),m=i(t.map(e=>c(e,2)));return l(o(s(n,f),s(u,d)),r(s(o(s(n,p),c(u,2)),o(s(n,m),c(d,2)))))}}),PW=`bernoulli`,FW=Z(PW,[`typed`,`config`,`isInteger`,`number`,`?BigNumber`,`?Fraction`],e=>{var{typed:t,config:n,number:r,BigNumber:i,Fraction:a}=e,o=[void 0],s=[void 0],c=[void 0],l=50;return t(PW,{number:e=>IW(e,e=>e,o,(e,t)=>e+t,(e,t)=>e*t,(e,t)=>e/t),"bigint | Fraction":e=>IW(r(e),e=>new a(e),s,(e,t)=>e.add(t),(e,t)=>e.mul(t),(e,t)=>e.div(t)),BigNumber:e=>(n.precision!==l&&(c=[void 0],l=n.precision),IW(r(e),e=>new i(e),c,(e,t)=>e.add(t),(e,t)=>e.mul(t),(e,t)=>e.div(t)))})});function IW(e,t,n,r,i,a){if(e<0||!PD(e))throw RangeError(`Bernoulli index must be nonnegative integer`);if(e===0)return t(1);if(e===1)return a(t(-1),t(2));if(e%2==1)return t(0);var o=t(1);n.length===1&&n.push([a(o,t(-3)),a(o,t(-2)),a(o,t(6))]);for(var s=e/2,c=t(0),l=t(2);n.length<=s;){for(var u=n.length,d=Math.floor((u+1)/2),f=c,p=1;p<d;++p)f=r(f,i(n[p][0],n[u-p][0]));f=i(f,l),u%2==0&&(f=r(f,i(n[d][0],n[d][0]))),f=a(f,t(-(2*u+1)));var m=a(i(n[u-1][1],t(-u*(2*u-1))),l);n.push([f,m,i(m,f)])}return n[s][2]}var LW=`combinations`,RW=Z(LW,[`typed`],e=>{var{typed:t}=e;return t(LW,{"number, number":RM,"BigNumber, BigNumber":function(e,t){var n=e.constructor,r,i,a=e.minus(t),o=new n(1);if(!zW(e)||!zW(t))throw TypeError(`Positive integer value expected in function combinations`);if(t.gt(e))throw TypeError(`k must be less than n in function combinations`);if(r=o,t.lt(a))for(i=o;i.lte(a);i=i.plus(o))r=r.times(t.plus(i)).dividedBy(i);else for(i=o;i.lte(t);i=i.plus(o))r=r.times(a.plus(i)).dividedBy(i);return r}})});function zW(e){return e.isInteger()&&e.gte(0)}var BW=`combinationsWithRep`,VW=Z(BW,[`typed`],e=>{var{typed:t}=e;return t(BW,{"number, number":function(e,t){if(!PD(e)||e<0||!PD(t)||t<0)throw TypeError(`Positive integer value expected in function combinationsWithRep`);if(e<1)throw TypeError(`k must be less than or equal to n + k - 1`);return t<e-1?LM(e,e+t-1)/LM(1,t):LM(t+1,e+t-1)/LM(1,e-1)},"BigNumber, BigNumber":function(e,t){var n=e.constructor,r,i,a=new n(1),o=e.minus(a);if(!HW(e)||!HW(t))throw TypeError(`Positive integer value expected in function combinationsWithRep`);if(e.lt(a))throw TypeError(`k must be less than or equal to n + k - 1 in function combinationsWithRep`);if(r=a,t.lt(o))for(i=a;i.lte(o);i=i.plus(a))r=r.times(t.plus(i)).dividedBy(i);else for(i=a;i.lte(t);i=i.plus(a))r=r.times(o.plus(i)).dividedBy(i);return r}})});function HW(e){return e.isInteger()&&e.gte(0)}var UW=`gamma`,WW=Z(UW,[`typed`,`config`,`multiplyScalar`,`pow`,`BigNumber`,`Complex`],e=>{var{typed:t,config:n,multiplyScalar:r,pow:i,BigNumber:a,Complex:o}=e;function s(e){if(e.im===0)return YM(e.re);if(e.re<.5){var t=new o(1-e.re,-e.im),n=new o(Math.PI*e.re,Math.PI*e.im);return new o(Math.PI).div(n.sin()).div(s(t))}e=new o(e.re-1,e.im);for(var r=new o(ZM[0],0),i=1;i<ZM.length;++i){var a=new o(ZM[i],0);r=r.add(a.div(e.add(i)))}var c=new o(e.re+XM+.5,e.im),l=Math.sqrt(2*Math.PI),u=c.pow(e.add(.5)),d=c.neg().exp();return r.mul(l).mul(u).mul(d)}return t(UW,{number:YM,Complex:s,BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new a(1/0):c(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw Error(`Integer BigNumber expected`)}});function c(e){if(e<8)return new a([1,1,2,6,24,120,720,5040][e]);var t=n.precision+(Math.log(e.toNumber())|0),r=a.clone({precision:t});if(e%2==1)return e.times(c(new a(e-1)));for(var i=e,o=new r(e),s=e.toNumber();i>2;)i-=2,s+=i,o=o.times(s);return new a(o.toPrecision(a.precision))}}),GW=`lgamma`,KW=Z(GW,[`Complex`,`typed`],e=>{var{Complex:t,typed:n}=e,r=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return n(GW,{number:eN,Complex:o,BigNumber:function(){throw Error(`mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber`)}});function o(e){var n=6.283185307179586,a=1.1447298858494002,l=.1;if(e.isNaN())return new t(NaN,NaN);if(e.im===0)return new t(eN(e.re),0);if(e.re>=r||Math.abs(e.im)>=i)return s(e);if(e.re<=l){var u=oO(n,e.im)*Math.floor(.5*e.re+.25),d=e.mul(Math.PI).sin().log(),f=o(new t(1-e.re,-e.im));return new t(a,u).sub(d).sub(f)}else if(e.im>=0)return c(e);else return c(e.conjugate()).conjugate()}function s(e){for(var n=e.sub(.5).mul(e.log()).sub(e).add(QM),r=new t(1,0).div(e),i=r.div(e),o=a[0],s=a[1],c=2*i.re,l=i.re*i.re+i.im*i.im,u=2;u<8;u++){var d=s;s=-l*o+a[u],o=c*o+d}var f=r.mul(i.mul(o).add(s));return n.add(f)}function c(e){var n=0,i=0,a=e;for(e=e.add(1);e.re<=r;){a=a.mul(e);var o=+(a.im<0);o!==0&&i===0&&n++,i=o,e=e.add(1)}return s(e).sub(a.log()).sub(new t(0,n*2*Math.PI*1))}}),qW=`factorial`,JW=Z(qW,[`typed`,`gamma`],e=>{var{typed:t,gamma:n}=e;return t(qW,{number:function(e){if(e<0)throw Error(`Value must be non-negative`);return n(e+1)},BigNumber:function(e){if(e.isNegative())throw Error(`Value must be non-negative`);return n(e.plus(1))},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),YW=`kldivergence`,XW=Z(YW,[`typed`,`matrix`,`divide`,`sum`,`multiply`,`map`,`dotDivide`,`log`,`isNumeric`],e=>{var{typed:t,matrix:n,divide:r,sum:i,multiply:a,map:o,dotDivide:s,log:c,isNumeric:l}=e;return t(YW,{"Array, Array":function(e,t){return u(n(e),n(t))},"Matrix, Array":function(e,t){return u(e,n(t))},"Array, Matrix":function(e,t){return u(n(e),t)},"Matrix, Matrix":function(e,t){return u(e,t)}});function u(e,t){var n=t.size().length,u=e.size().length;if(n>1)throw Error(`first object must be one dimensional`);if(u>1)throw Error(`second object must be one dimensional`);if(n!==u)throw Error(`Length of two vectors must be equal`);if(i(e)===0)throw Error(`Sum of elements in first object must be non zero`);if(i(t)===0)throw Error(`Sum of elements in second object must be non zero`);var d=r(e,i(e)),f=i(a(d,o(s(d,r(t,i(t))),e=>c(e))));return l(f)?f:NaN}}),ZW=`multinomial`,QW=Z(ZW,[`typed`,`add`,`divide`,`multiply`,`factorial`,`isInteger`,`isPositive`],e=>{var{typed:t,add:n,divide:r,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(ZW,{"Array | Matrix":function(e){var t=0,c=1;return qj(e,function(e){if(!o(e)||!s(e))throw TypeError(`Positive integer value expected in function multinomial`);t=n(t,e),c=i(c,a(e))}),r(a(t),c)}})}),$W=`permutations`,eG=Z($W,[`typed`,`factorial`],e=>{var{typed:t,factorial:n}=e;return t($W,{"number | BigNumber":n,"number, number":function(e,t){if(!PD(e)||e<0||!PD(t)||t<0)throw TypeError(`Positive integer value expected in function permutations`);if(t>e)throw TypeError(`second argument k must be less than or equal to first argument n`);return LM(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var n,r;if(!tG(e)||!tG(t))throw TypeError(`Positive integer value expected in function permutations`);if(t.gt(e))throw TypeError(`second argument k must be less than or equal to first argument n`);for(n=e.mul(0).add(1),r=e.minus(t).plus(1);r.lte(e);r=r.plus(1))n=n.times(r);return n}})});function tG(e){return e.isInteger()&&e.gte(0)}var nG=o(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=o();t.next=function(){var e=2091639*t.s0+t.c*23283064365386963e-26;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=e|0)},t.c=1,t.s0=n(` `),t.s1=n(` `),t.s2=n(` `),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function i(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function a(e,t){var n=new r(e),a=t&&t.state,o=n.next;return o.int32=function(){return n.next()*4294967296|0},o.double=function(){return o()+(o()*2097152|0)*11102230246251565e-32},o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}function o(){var e=4022871197;return function(t){t=String(t);for(var n=0;n<t.length;n++){e+=t.charCodeAt(n);var r=.02519603282416938*e;e=r>>>0,r-=e,r*=e,e=r>>>0,r-=e,e+=r*4294967296}return(e>>>0)*23283064365386963e-26}}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.alea=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),rG=o(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=``;t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(e|0)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=n.charCodeAt(r)|0,t.next()}function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function a(e,t){var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xor128=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),iG=o(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=``;t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^(e^e<<1))|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(e|0)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=n.charCodeAt(r)|0,r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function a(e,t){var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xorwow=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),aG=o(((e,t)=>{(function(e,t,n){function r(e){var t=this;t.next=function(){var e=t.x,n=t.i,r=e[n],i;return r^=r>>>7,i=r^r<<24,r=e[n+1&7],i^=r^r>>>10,r=e[n+3&7],i^=r^r>>>3,r=e[n+4&7],i^=r^r<<7,r=e[n+7&7],r^=r<<13,i^=r^r<<9,e[n]=i,t.i=n+1&7,i};function n(e,t){var n,r=[];if(t===(t|0))r[0]=t;else for(t=``+t,n=0;n<t.length;++n)r[n&7]=r[n&7]<<15^t.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&r[n]===0;++n);for(n==8?r[7]=-1:r[n],e.x=r,e.i=0,n=256;n>0;--n)e.next()}n(t,e)}function i(e,t){return t.x=e.x.slice(),t.i=e.i,t}function a(e,t){e??=+new Date;var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(a.x&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xorshift7=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),oG=o(((e,t)=>{(function(e,t,n){function r(e){var t=this;t.next=function(){var e=t.w,n=t.X,r=t.i,i,a;return t.w=e=e+1640531527|0,a=n[r+34&127],i=n[r=r+1&127],a^=a<<13,i^=i<<17,a^=a>>>15,i^=i>>>12,a=n[r]=a^i,t.i=r,a+(e^e>>>16)|0};function n(e,t){var n,r,i,a,o,s=[],c=128;for(t===(t|0)?(r=t,t=null):(t+=`\0`,r=0,c=Math.max(c,t.length)),i=0,a=-32;a<c;++a)t&&(r^=t.charCodeAt((a+32)%t.length)),a===0&&(o=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,a>=0&&(o=o+1640531527|0,n=s[a&127]^=r+o,i=n==0?i+1:0);for(i>=128&&(s[(t&&t.length||0)&127]=-1),i=127,a=512;a>0;--a)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;e.w=o,e.X=s,e.i=i}n(t,e)}function i(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function a(e,t){e??=+new Date;var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(a.X&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xor4096=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),sG=o(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=``;t.next=function(){var e=t.b,n=t.c,r=t.d,i=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=e|0):n+=e;for(var r=0;r<n.length+20;r++)t.b^=n.charCodeAt(r)|0,t.next()}function i(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function a(e,t){var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.tychei=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),cG=o(((e,t)=>{(function(e,n,r){var i=256,a=6,o=52,s=`random`,c=r.pow(i,a),l=r.pow(2,o),u=l*2,d=i-1,f;function p(e,t,o){var d=[];t=t==1?{entropy:!0}:t||{};var f=_(g(t.entropy?[e,y(n)]:e??v(),3),d),p=new m(d),b=function(){for(var e=p.g(a),t=c,n=0;e<l;)e=(e+n)*i,t*=i,n=p.g(1);for(;e>=u;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return p.g(4)|0},b.quick=function(){return p.g(4)/4294967296},b.double=b,_(y(p.S),n),(t.pass||o||function(e,t,n,i){return i&&(i.S&&h(i,p),e.state=function(){return h(p,{})}),n?(r[s]=e,t):e})(b,f,`global`in t?t.global:this==r,t.state)}function m(e){var t,n=e.length,r=this,a=0,o=r.i=r.j=0,s=r.S=[];for(n||(e=[n++]);a<i;)s[a]=a++;for(a=0;a<i;a++)s[a]=s[o=d&o+e[a%n]+(t=s[a])],s[o]=t;(r.g=function(e){for(var t,n=0,a=r.i,o=r.j,s=r.S;e--;)t=s[a=d&a+1],n=n*i+s[d&(s[a]=s[o=d&o+t])+(s[o]=t)];return r.i=a,r.j=o,n})(i)}function h(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var n=[],r=typeof e,i;if(t&&r==`object`)for(i in e)try{n.push(g(e[i],t-1))}catch{}return n.length?n:r==`string`?e:e+`\0`}function _(e,t){for(var n=e+``,r,i=0;i<n.length;)t[d&i]=d&(r^=t[d&i]*19)+n.charCodeAt(i++);return y(t)}function v(){try{var t;return f&&(t=f.randomBytes)?t=t(i):(t=new Uint8Array(i),(e.crypto||e.msCrypto).getRandomValues(t)),y(t)}catch{var r=e.navigator,a=r&&r.plugins;return[+new Date,e,a,e.screen,y(n)]}}function y(e){return String.fromCharCode.apply(0,e)}if(_(r.random(),n),typeof t==`object`&&t.exports){t.exports=p;try{f=require(`crypto`)}catch{}}else typeof define==`function`&&define.amd?define(function(){return p}):r[`seed`+s]=p})(typeof self<`u`?self:e,[],Math)})),lG=l(o(((e,t)=>{var n=nG(),r=rG(),i=iG(),a=aG(),o=oG(),s=sG(),c=cG();c.alea=n,c.xor128=r,c.xorwow=i,c.xorshift7=a,c.xor4096=o,c.tychei=s,t.exports=c}))(),1),uG=(0,lG.default)(Date.now());function dG(e){var t;function n(e){t=e===null?uG:(0,lG.default)(String(e))}n(e);function r(){return t()}return r}var fG=`pickRandom`,pG=Z(fG,[`typed`,`config`,`?on`],e=>{var{typed:t,config:n,on:r}=e,i=dG(n.randomSeed);return r&&r(`config`,function(e,t){e.randomSeed!==t.randomSeed&&(i=dG(e.randomSeed))}),t(fG,{"Array | Matrix":function(e){return a(e,{})},"Array | Matrix, Object":function(e,t){return a(e,t)},"Array | Matrix, number":function(e,t){return a(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return a(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,n){return a(e,{number:n,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,n){return a(e,{number:t,weights:n})}});function a(e,t){var{number:n,weights:r,elementWise:a=!0}=t,o=n===void 0;o&&(n=1);var s=jE(e)?e.create:jE(r)?r.create:null;e=e.valueOf(),r&&=r.valueOf(),a===!0&&(e=_j(e),r=_j(r));var c=0;if(r!==void 0){if(r.length!==e.length)throw Error(`Weights must have the same length as possibles`);for(var l=0,u=r.length;l<u;l++){if(!CE(r[l])||r[l]<0)throw Error(`Weights must be an array of positive numbers`);c+=r[l]}}for(var d=e.length,f=[],p;f.length<n;){if(r===void 0)p=e[Math.floor(i()*d)];else for(var m=i()*c,h=0,g=e.length;h<g;h++)if(m-=r[h],m<0){p=e[h];break}f.push(p)}return o?f[0]:s?s(f):f}});function mG(e,t){var n=[];if(e=e.slice(0),e.length>1)for(var r=0,i=e.shift();r<i;r++)n.push(mG(e,t));else for(var a=0,o=e.shift();a<o;a++)n.push(t());return n}var hG=`random`,gG=Z(hG,[`typed`,`config`,`?on`],e=>{var{typed:t,config:n,on:r}=e,i=dG(n.randomSeed);return r&&r(`config`,function(e,t){e.randomSeed!==t.randomSeed&&(i=dG(e.randomSeed))}),t(hG,{"":()=>o(0,1),number:e=>o(0,e),"number, number":(e,t)=>o(e,t),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,t)=>a(e,0,t),"Array | Matrix, number, number":(e,t,n)=>a(e,t,n)});function a(e,t,n){var r=mG(e.valueOf(),()=>o(t,n));return jE(e)?e.create(r,`number`):r}function o(e,t){return e+i()*(t-e)}}),_G=`randomInt`,vG=Z(_G,[`typed`,`config`,`log2`,`?on`],e=>{var{typed:t,config:n,log2:r,on:i}=e,a=dG(n.randomSeed);return i&&i(`config`,function(e,t){e.randomSeed!==t.randomSeed&&(a=dG(e.randomSeed))}),t(_G,{"":()=>s(0,2),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),bigint:e=>c(0n,e),"bigint, bigint":c,"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,n)=>o(e,t,n)});function o(e,t,n){var r=mG(e.valueOf(),()=>s(t,n));return jE(e)?e.create(r,`number`):r}function s(e,t){return Math.floor(e+a()*(t-e))}function c(e,t){var n=2n**30n,i=t-e;if(i<=n)return e+BigInt(s(0,Number(i)));for(var o=r(i),c=i;c>=i;){c=0n;for(var l=0;l<o;++l)c=2n*c+(a()<.5?0n:1n)}return e+c}}),yG=`stirlingS2`,bG=Z(yG,[`typed`,`addScalar`,`subtractScalar`,`multiplyScalar`,`divideScalar`,`pow`,`factorial`,`combinations`,`isNegative`,`isInteger`,`number`,`?bignumber`,`larger`],e=>{var{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:c,isNegative:l,isInteger:u,number:d,bignumber:f,larger:p}=e,m=[],h=[];return t(yG,{"number | BigNumber, number | BigNumber":function(e,t){if(!u(e)||l(e)||!u(t)||l(t))throw TypeError(`Non-negative integer value expected in function stirlingS2`);if(p(t,e))throw TypeError(`k must be less than or equal to n in function stirlingS2`);var r=!(CE(e)&&CE(t)),a=r?h:m,o=r?f:d,s=d(e),c=d(t);if(a[s]&&a[s].length>c)return a[s][c];for(var g=0;g<=s;++g)if(a[g]||(a[g]=[o(+(g===0))]),g!==0)for(var _=a[g],v=a[g-1],y=_.length;y<=g&&y<=c;++y)y===g?_[y]=1:_[y]=n(i(o(y),v[y]),v[y-1]);return a[s][c]}})}),xG=`bellNumbers`,SG=Z(xG,[`typed`,`addScalar`,`isNegative`,`isInteger`,`stirlingS2`],e=>{var{typed:t,addScalar:n,isNegative:r,isInteger:i,stirlingS2:a}=e;return t(xG,{"number | BigNumber":function(e){if(!i(e)||r(e))throw TypeError(`Non-negative integer value expected in function bellNumbers`);for(var t=0,o=0;o<=e;o++)t=n(t,a(e,o));return t}})}),CG=`catalan`,wG=Z(CG,[`typed`,`addScalar`,`divideScalar`,`multiplyScalar`,`combinations`,`isNegative`,`isInteger`],e=>{var{typed:t,addScalar:n,divideScalar:r,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(CG,{"number | BigNumber":function(e){if(!s(e)||o(e))throw TypeError(`Non-negative integer value expected in function catalan`);return r(a(i(e,2),e),n(e,1))}})}),TG=`composition`,EG=Z(TG,[`typed`,`addScalar`,`combinations`,`isNegative`,`isPositive`,`isInteger`,`larger`],e=>{var{typed:t,addScalar:n,combinations:r,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(TG,{"number | BigNumber, number | BigNumber":function(e,t){if(!o(e)||!i(e)||!o(t)||!i(t))throw TypeError(`Positive integer value expected in function composition`);if(s(t,e))throw TypeError(`k must be less than or equal to n in function composition`);return r(n(e,-1),n(t,-1))}})}),DG=`leafCount`,OG=Z(DG,[`parse`,`typed`],e=>{var{parse:t,typed:n}=e;function r(e){var t=0;return e.forEach(e=>{t+=r(e)}),t||1}return n(DG,{Node:function(e){return r(e)}})});function kG(e){return eD(e)||sD(e)&&e.isUnary()&&eD(e.args[0])}function AG(e){return!!(eD(e)||(rD(e)||sD(e))&&e.args.every(AG)||cD(e)&&AG(e.content))}function jG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MG(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jG(Object(n),!0).forEach(function(t){XL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var NG=Z(`simplifyUtil`,[`FunctionNode`,`OperatorNode`,`SymbolNode`],e=>{var{FunctionNode:t,OperatorNode:n,SymbolNode:r}=e,i=!0,a=!1,o=`defaultF`,s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},c={divide:{total:a},log:{total:a}},l={subtract:{total:a},abs:{trivial:i},log:{total:i}};function u(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,r=o;if(typeof e==`string`?r=e:sD(e)?r=e.fn.toString():rD(e)?r=e.name:cD(e)&&(r=`paren`),SD(n,r)){var i=n[r];if(SD(i,t))return i[t];if(SD(s,r))return s[r][t]}if(SD(n,o)){var a=n[o];return SD(a,t)?a[t]:s[o][t]}if(SD(s,r)){var c=s[r];if(SD(c,t))return c[t]}return s[o][t]}function d(e){return u(e,`commutative`,arguments.length>1&&arguments[1]!==void 0?arguments[1]:s)}function f(e){return u(e,`associative`,arguments.length>1&&arguments[1]!==void 0?arguments[1]:s)}function p(e,t){var n=MG({},e);for(var r in t)SD(e,r)?n[r]=MG(MG({},t[r]),e[r]):n[r]=t[r];return n}function m(e,t){if(!e.args||e.args.length===0)return e;e.args=h(e,t);for(var n=0;n<e.args.length;n++)m(e.args[n],t)}function h(e,t){var n,r=[],i=function(e){for(var t=0;t<e.args.length;t++){var a=e.args[t];sD(a)&&n===a.op?i(a):r.push(a)}};return f(e,t)?(n=e.op,i(e),r):e.args}function g(e,t){if(!(!e.args||e.args.length===0)){for(var n=v(e),r=e.args.length,i=0;i<r;i++)g(e.args[i],t);if(r>2&&f(e,t)){for(var a=e.args.pop();e.args.length>0;)a=n([e.args.pop(),a]);e.args=a.args}}}function _(e,t){if(!(!e.args||e.args.length===0)){for(var n=v(e),r=e.args.length,i=0;i<r;i++)_(e.args[i],t);if(r>2&&f(e,t)){for(var a=e.args.shift();e.args.length>0;)a=n([a,e.args.shift()]);e.args=a.args}}}function v(e){return sD(e)?function(t){try{return new n(e.op,e.fn,t,e.implicit)}catch(e){return console.error(e),[]}}:function(n){return new t(new r(e.name),n)}}return{createMakeNodeFunction:v,hasProperty:u,isCommutative:d,isAssociative:f,mergeContext:p,flatten:m,allChildren:h,unflattenr:g,unflattenl:_,defaultContext:s,realContext:c,positiveContext:l}}),PG=Z(`simplify`,[`typed`,`parse`,`equal`,`resolve`,`simplifyConstant`,`simplifyCore`,`AccessorNode`,`ArrayNode`,`ConstantNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`ParenthesisNode`,`SymbolNode`,`replacer`],e=>{var{typed:t,parse:n,equal:r,resolve:i,simplifyConstant:a,simplifyCore:o,AccessorNode:s,ArrayNode:c,ConstantNode:l,FunctionNode:u,IndexNode:d,ObjectNode:f,OperatorNode:p,ParenthesisNode:m,SymbolNode:h,replacer:g}=e,{hasProperty:_,isCommutative:v,isAssociative:y,mergeContext:b,flatten:x,unflattenr:S,unflattenl:C,createMakeNodeFunction:w,defaultContext:T,realContext:E,positiveContext:D}=NG({FunctionNode:u,OperatorNode:p,SymbolNode:h});t.addConversion({from:`Object`,to:`Map`,convert:xE});var O=t(`simplify`,{Node:F,"Node, Map":(e,t)=>F(e,!1,t),"Node, Map, Object":(e,t,n)=>F(e,!1,t,n),"Node, Array":F,"Node, Array, Map":F,"Node, Array, Map, Object":F});t.removeConversion({from:`Object`,to:`Map`,convert:xE}),O.defaultContext=T,O.realContext=E,O.positiveContext=D;function k(e){return e.transform(function(e){return cD(e)?k(e.content):e})}var A={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};O.rules=[o,{l:`log(e)`,r:`1`},{s:`n-n1 -> n+-n1`,assuming:{subtract:{total:!0}}},{s:`n-n -> 0`,assuming:{subtract:{total:!1}}},{s:`-(cl*v) -> v * (-cl)`,assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:`-(cl*v) -> (-cl) * v`,assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:`-(v*cl) -> v * (-cl)`,assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:`-(n1/n2)`,r:`-n1/n2`},{l:`-v`,r:`v * (-1)`},{l:`(n1 + n2)*(-1)`,r:`n1*(-1) + n2*(-1)`,repeat:!0},{l:`n/n1^n2`,r:`n*n1^-n2`},{l:`n/n1`,r:`n*n1^-1`},{s:`(n1*n2)^n3 -> n1^n3 * n2^n3`,assuming:{multiply:{commutative:!0}}},{s:`(n1*n2)^(-1) -> n2^(-1) * n1^(-1)`,assuming:{multiply:{commutative:!1}}},{s:`(n ^ n1) ^ n2 -> n ^ (n1 * n2)`,assuming:{divide:{total:!0}}},{l:` vd * ( vd * n1 + n2)`,r:`vd^2 * n1 + vd * n2`},{s:` vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2`,assuming:{divide:{total:!0}}},{s:`vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2`,assuming:{divide:{total:!0}}},{s:`vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2`,assuming:{divide:{total:!0}}},{l:`n*n`,r:`n^2`},{s:`n * n^n1 -> n^(n1+1)`,assuming:{divide:{total:!0}}},{s:`n^n1 * n^n2 -> n^(n1+n2)`,assuming:{divide:{total:!0}}},a,{s:`n+n -> 2*n`,assuming:{add:{total:!0}}},{l:`n+-n`,r:`0`},{l:`vd*n + vd`,r:`vd*(n+1)`},{l:`n3*n1 + n3*n2`,r:`n3*(n1+n2)`},{l:`n3^(-n4)*n1 + n3 * n2`,r:`n3^(-n4)*(n1 + n3^(n4+1) *n2)`},{l:`n3^(-n4)*n1 + n3^n5 * n2`,r:`n3^(-n4)*(n1 + n3^(n4+n5)*n2)`},{s:`n*vd + vd -> (n+1)*vd`,assuming:{multiply:{commutative:!1}}},{s:`vd + n*vd -> (1+n)*vd`,assuming:{multiply:{commutative:!1}}},{s:`n1*n3 + n2*n3 -> (n1+n2)*n3`,assuming:{multiply:{commutative:!1}}},{s:`n^n1 * n -> n^(n1+1)`,assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:`n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)`,assuming:{multiply:{commutative:!1}}},{s:`n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)`,assuming:{multiply:{commutative:!1}}},{l:`n*cd + cd`,r:`(n+1)*cd`},{s:`cd*n + cd -> cd*(n+1)`,assuming:{multiply:{commutative:!1}}},{s:`cd + cd*n -> cd*(1+n)`,assuming:{multiply:{commutative:!1}}},a,{s:`(-n)*n1 -> -(n*n1)`,assuming:{subtract:{total:!0}}},{s:`n1*(-n) -> -(n1*n)`,assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:`ce+ve -> ve+ce`,assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:`vd*cd -> cd*vd`,assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:`n+-n1`,r:`n-n1`},{l:`n+-(n1)`,r:`n-(n1)`},{s:`n*(n1^-1) -> n/n1`,assuming:{multiply:{commutative:!0}}},{s:`n*n1^-n2 -> n/n1^n2`,assuming:{multiply:{commutative:!0}}},{s:`n^-1 -> 1/n`,assuming:{multiply:{commutative:!0}}},{l:`n^1`,r:`n`},{s:`n*(n1/n2) -> (n*n1)/n2`,assuming:{multiply:{associative:!0}}},{s:`n-(n1+n2) -> n-n1-n2`,assuming:{addition:{associative:!0,commutative:!0}}},{l:`1*n`,r:`n`,imposeContext:{multiply:{commutative:!0}}},{s:`n1/(n2/n3) -> (n1*n3)/n2`,assuming:{multiply:{associative:!0}}},{l:`n1/(-n2)`,r:`-n1/n2`}];function j(e,t){var r={};if(e.s){var i=e.s.split(`->`);if(i.length===2)r.l=i[0],r.r=i[1];else throw SyntaxError(`Could not parse rule: `+e.s)}else r.l=e.l,r.r=e.r;r.l=k(n(r.l)),r.r=k(n(r.r));for(var a of[`imposeContext`,`repeat`,`assuming`])a in e&&(r[a]=e[a]);if(e.evaluate&&(r.evaluate=n(e.evaluate)),y(r.l,t)){var o=!v(r.l,t),s;o&&(s=P());var c=w(r.l),l=P();r.expanded={},r.expanded.l=c([r.l,l]),x(r.expanded.l,t),S(r.expanded.l,t),r.expanded.r=c([r.r,l]),o&&(r.expandedNC1={},r.expandedNC1.l=c([s,r.l]),r.expandedNC1.r=c([s,r.r]),r.expandedNC2={},r.expandedNC2.l=c([s,r.expanded.l]),r.expandedNC2.r=c([s,r.expanded.r]))}return r}function M(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=void 0,o=typeof i;switch(o){case`string`:i={s:i};case`object`:a=j(i,t);break;case`function`:a=i;break;default:throw TypeError(`Unsupported type of rule: `+o)}n.push(a)}return n}var N=0;function P(){return new h(`_p`+ N++)}function F(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bE(),r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.consoleDebug;t=M(t||O.rules,r.context);var o=i(e,n);o=k(o);for(var s={},c=o.toString({parenthesis:`all`});!s[c];){s[c]=!0,N=0;var l=c;a&&console.log(`Working on: `,c);for(var u=0;u<t.length;u++){var d=``;if(typeof t[u]==`function`?(o=t[u](o,r),a&&(d=t[u].name)):(x(o,r.context),o=L(o,t[u],r.context),a&&(d=`${t[u].l.toString()} -> ${t[u].r.toString()}`)),a){var f=o.toString({parenthesis:`all`});f!==l&&(console.log(`Applying`,d,`produced`,f),l=f)}C(o,r.context)}c=o.toString({parenthesis:`all`})}return o}function I(e,t,n){var r=e;if(e)for(var i=0;i<e.length;++i){var a=L(e[i],t,n);a!==e[i]&&(r===e&&(r=e.slice()),r[i]=a)}return r}function L(e,t,n){if(t.assuming){for(var r in t.assuming)for(var i in t.assuming[r])if(_(r,i,n)!==t.assuming[r][i])return e}var a=b(t.imposeContext,n),o=e;if(o instanceof p||o instanceof u){var l=I(o.args,t,n);l!==o.args&&(o=o.clone(),o.args=l)}else if(o instanceof m){if(o.content){var h=L(o.content,t,n);h!==o.content&&(o=new m(h))}}else if(o instanceof c){var g=I(o.items,t,n);g!==o.items&&(o=new c(g))}else if(o instanceof s){var v=o.object;o.object&&(v=L(o.object,t,n));var y=o.index;o.index&&(y=L(o.index,t,n)),(v!==o.object||y!==o.index)&&(o=new s(v,y))}else if(o instanceof d){var x=I(o.dimensions,t,n);x!==o.dimensions&&(o=new d(x))}else if(o instanceof f){var S=!1,C={};for(var w in o.properties)C[w]=L(o.properties[w],t,n),C[w]!==o.properties[w]&&(S=!0);S&&(o=new f(C))}var T=t.r,E=ne(t.l,o,a)[0];if(!E&&t.expanded&&(T=t.expanded.r,E=ne(t.expanded.l,o,a)[0]),!E&&t.expandedNC1&&(T=t.expandedNC1.r,E=ne(t.expandedNC1.l,o,a)[0],E||=(T=t.expandedNC2.r,ne(t.expandedNC2.l,o,a)[0])),E){var D=o.implicit;o=T.clone(),D&&`implicit`in T&&(o.implicit=!0),o=o.transform(function(e){return e.isSymbolNode&&SD(E.placeholders,e.name)?E.placeholders[e.name].clone():e})}return t.repeat&&o!==e&&(o=L(o,t,n)),o}function ee(e,t){var n=[],r,i,a=w(e);if(v(e,t))for(var o=0;o<e.args.length;o++)i=e.args.slice(0),i.splice(o,1),r=i.length===1?i[0]:a(i),n.push(a([e.args[o],r]));else for(var s=1;s<e.args.length;s++){var c=e.args[0];s>1&&(c=a(e.args.slice(0,s))),i=e.args.slice(s),r=i.length===1?i[0]:a(i),n.push(a([c,r]))}return n}function R(e,t){var n={placeholders:{}};if(!e.placeholders&&!t.placeholders)return n;if(!e.placeholders)return t;if(!t.placeholders)return e;for(var r in e.placeholders)if(SD(e.placeholders,r)&&(n.placeholders[r]=e.placeholders[r],SD(t.placeholders,r)&&!re(e.placeholders[r],t.placeholders[r])))return null;for(var i in t.placeholders)SD(t.placeholders,i)&&(n.placeholders[i]=t.placeholders[i]);return n}function te(e,t){var n=[];if(e.length===0||t.length===0)return n;for(var r,i=0;i<e.length;i++)for(var a=0;a<t.length;a++)r=R(e[i],t[a]),r&&n.push(r);return n}function z(e){if(e.length===0)return e;for(var t=e.reduce(te),n=[],r={},i=0;i<t.length;i++){var a=JSON.stringify(t[i],g);r[a]||(r[a]=!0,n.push(t[i]))}return n}function ne(e,t,n,i){var a=[{placeholders:{}}];if(e instanceof p&&t instanceof p||e instanceof u&&t instanceof u){if(e instanceof p){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof u&&e.name!==t.name)return[];if(t.args.length===1&&e.args.length===1||!y(t,n)&&t.args.length===e.args.length||i){for(var o=[],s=0;s<e.args.length;s++){var c=ne(e.args[s],t.args[s],n);if(c.length===0)break;o.push(c)}if(o.length!==e.args.length){if(!v(t,n)||e.args.length===1)return[];if(e.args.length>2)throw Error(`permuting >2 commutative non-associative rule arguments not yet implemented`);var d=ne(e.args[0],t.args[1],n);if(d.length===0)return[];var f=ne(e.args[1],t.args[0],n);if(f.length===0)return[];o=[d,f]}a=z(o)}else if(t.args.length>=2&&e.args.length===2){for(var m=ee(t,n),g=[],_=0;_<m.length;_++){var b=ne(e,m[_],n,!0);g=g.concat(b)}return g}else if(e.args.length>2)throw Error(`Unexpected non-binary associative function: `+e.toString());else return[]}else if(e instanceof h){if(e.name.length===0)throw Error(`Symbol in rule has 0 length...!?`);if(A[e.name]){if(e.name!==t.name)return[]}else switch(e.name[1]>=`a`&&e.name[1]<=`z`?e.name.substring(0,2):e.name[0]){case`n`:case`_p`:a[0].placeholders[e.name]=t;break;case`c`:case`cl`:if(eD(t))a[0].placeholders[e.name]=t;else return[];break;case`v`:if(!eD(t))a[0].placeholders[e.name]=t;else return[];break;case`vl`:if(dD(t))a[0].placeholders[e.name]=t;else return[];break;case`cd`:if(kG(t))a[0].placeholders[e.name]=t;else return[];break;case`vd`:if(!kG(t))a[0].placeholders[e.name]=t;else return[];break;case`ce`:if(AG(t))a[0].placeholders[e.name]=t;else return[];break;case`ve`:if(!AG(t))a[0].placeholders[e.name]=t;else return[];break;default:throw Error(`Invalid symbol in rule: `+e.name)}}else if(e instanceof l){if(!r(e.value,t.value))return[]}else return[];return a}function re(e,t){if(e instanceof l&&t instanceof l){if(!r(e.value,t.value))return!1}else if(e instanceof h&&t instanceof h){if(e.name!==t.name)return!1}else if(e instanceof p&&t instanceof p||e instanceof u&&t instanceof u){if(e instanceof p){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof u&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(var n=0;n<e.args.length;n++)if(!re(e.args[n],t.args[n]))return!1}else return!1;return!0}return O}),FG=Z(`simplifyConstant`,[`typed`,`config`,`mathWithTransform`,`matrix`,`isBounded`,`?fraction`,`?bignumber`,`AccessorNode`,`ArrayNode`,`ConstantNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`SymbolNode`],e=>{var{typed:t,config:n,mathWithTransform:r,matrix:i,isBounded:a,fraction:o,bignumber:s,AccessorNode:c,ArrayNode:l,ConstantNode:u,FunctionNode:d,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=e,{isCommutative:g,isAssociative:_,allChildren:v,createMakeNodeFunction:y}=NG({FunctionNode:d,OperatorNode:m,SymbolNode:h}),b=t(`simplifyConstant`,{Node:e=>w(j(e,{})),"Node, Object":function(e,t){return w(j(e,t))}});function x(e){return DE(e)?e.valueOf():e instanceof Array?e.map(x):jE(e)?i(x(e.valueOf())):e}function S(e,t,n){try{return r[e].apply(null,t)}catch{return t=t.map(x),E(r[e].apply(null,t),n)}}var C=t({Fraction:O,number:function(e){return e<0?D(new u(-e)):new u(e)},BigNumber:function(e){return e<0?D(new u(-e)):new u(e)},bigint:function(e){return e<0n?D(new u(-e)):new u(e)},Complex:function(e){throw Error(`Cannot convert Complex number to Node`)},string:function(e){return new u(e)},Matrix:function(e){return new l(e.valueOf().map(e=>C(e)))}});function w(e){return aD(e)?e:C(e)}function T(e,t){if(t&&t.exactFractions!==!1&&a(e)&&o){var n=o(e),r=t&&typeof t.fractionsLimit==`number`?t.fractionsLimit:1/0;if(n.valueOf()===e&&n.n<r&&n.d<r)return n}return e}var E=t({"string, Object":function(e,t){var r=FD(e,n);return r===`BigNumber`?(s===void 0&&pL(),s(e)):r===`bigint`?BigInt(e):r===`Fraction`?(o===void 0&&mL(),o(e)):T(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return T(e,t)},"bigint, Object":function(e,t){return e},"Complex, Object":function(e,t){return e.im===0?T(e.re,t):e},"Matrix, Object":function(e,t){return i(T(e.valueOf()))},"Array, Object":function(e,t){return e.map(T)}});function D(e){return new m(`-`,`unaryMinus`,[e])}function O(e){var t=e=>n.number===`BigNumber`&&s?s(e):Number(e),r=e.s*e.n,i=r<0n?new m(`-`,`unaryMinus`,[new u(-t(r))]):new u(t(r));return e.d===1n?i:new m(`/`,`divide`,[i,new u(t(e.d))])}function k(e,t,n){if(!iD(t))return new c(w(e),w(t));if(XE(e)||jE(e)){for(var r=Array.from(t.dimensions);r.length>0;)if(eD(r[0])&&typeof r[0].value!=`string`){var a=E(r.shift().value,n);XE(e)?e=e.items[a-1]:(e=e.valueOf()[a-1],e instanceof Array&&(e=i(e)))}else if(r.length>1&&eD(r[1])&&typeof r[1].value!=`string`){var o=E(r[1].value,n),s=[],d=XE(e)?e.items:e.valueOf();for(var p of d)if(XE(p))s.push(p.items[o-1]);else if(jE(e))s.push(p[o-1]);else break;if(s.length===d.length)e=XE(e)?new l(s):i(s),r.splice(1,1);else break}else break;return r.length===t.dimensions.length?new c(w(e),t):r.length>0?(t=new f(r),new c(w(e),t)):e}if(oD(e)&&t.dimensions.length===1&&eD(t.dimensions[0])){var m=t.dimensions[0].value;return m in e.properties?e.properties[m]:new u}return new c(w(e),t)}function A(e,t,n,r){var i=t.shift(),a=t.reduce((t,i)=>{if(!aD(i)){var a=t.pop();if(aD(a))return[a,i];try{return t.push(S(e,[a,i],r)),t}catch{t.push(a)}}return t.push(w(t.pop())),[n([t.length===1?t[0]:n(t),w(i)])]},[i]);return a.length===1?a[0]:n([a[0],C(a[1])])}function j(e,t){switch(e.type){case`SymbolNode`:return e;case`ConstantNode`:switch(typeof e.value){case`number`:return E(e.value,t);case`bigint`:return E(e.value,t);case`string`:return e.value;default:if(!isNaN(e.value))return E(e.value,t)}return e;case`FunctionNode`:if(r[e.name]&&r[e.name].rawArgs)return e;if(![`add`,`multiply`].includes(e.name)){var n=e.args.map(e=>j(e,t));if(!n.some(aD))try{return S(e.name,n,t)}catch{}if(e.name===`size`&&n.length===1&&XE(n[0])){for(var a=[],o=n[0];XE(o);)a.push(o.items.length),o=o.items[0];return i(a)}return new d(e.name,n.map(w))}case`OperatorNode`:var s=e.fn.toString(),c,u,m=y(e);if(sD(e)&&e.isUnary())c=[j(e.args[0],t)],u=aD(c[0])?m(c):S(s,c,t);else if(_(e,t.context))if(c=v(e,t.context),c=c.map(e=>j(e,t)),g(s,t.context)){for(var h=[],x=[],C=0;C<c.length;C++)aD(c[C])?x.push(c[C]):h.push(c[C]);h.length>1?(u=A(s,h,m,t),x.unshift(u),u=A(s,x,m,t)):u=A(s,c,m,t)}else u=A(s,c,m,t);else c=e.args.map(e=>j(e,t)),u=A(s,c,m,t);return u;case`ParenthesisNode`:return j(e.content,t);case`AccessorNode`:return k(j(e.object,t),j(e.index,t),t);case`ArrayNode`:var T=e.items.map(e=>j(e,t));return T.some(aD)?new l(T.map(w)):i(T);case`IndexNode`:return new f(e.dimensions.map(e=>b(e,t)));case`ObjectNode`:var D={};for(var O in e.properties)D[O]=b(e.properties[O],t);return new p(D);default:throw Error(`Unimplemented node type in simplifyConstant: ${e.type}`)}}return b}),IG=`simplifyCore`,LG=Z(IG,[`typed`,`parse`,`equal`,`isZero`,`add`,`subtract`,`multiply`,`divide`,`pow`,`AccessorNode`,`ArrayNode`,`ConstantNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`ParenthesisNode`,`SymbolNode`],e=>{var{typed:t,parse:n,equal:r,isZero:i,add:a,subtract:o,multiply:s,divide:c,pow:l,AccessorNode:u,ArrayNode:d,ConstantNode:f,FunctionNode:p,IndexNode:m,ObjectNode:h,OperatorNode:g,ParenthesisNode:_,SymbolNode:v}=e,y=new f(0),b=new f(1),x=new f(!0),S=new f(!1);function C(e){return sD(e)&&[`and`,`not`,`or`].includes(e.op)}var{hasProperty:w,isCommutative:T}=NG({FunctionNode:p,OperatorNode:g,SymbolNode:v});function E(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t?t.context:void 0;if(w(e,`trivial`,n)){if(rD(e)&&e.args.length===1)return E(e.args[0],t);var a=!1,o=0;if(e.forEach(e=>{++o,o===1&&(a=E(e,t))}),o===1)return a}var s=e;if(rD(s)){var c=cH(s.name);if(c){if(s.args.length>2&&w(s,`associative`,n))for(;s.args.length>2;){var l=s.args.pop(),f=s.args.pop();s.args.push(new g(c,s.name,[l,f]))}s=new g(c,s.name,s.args)}else return new p(E(s.fn),s.args.map(e=>E(e,t)))}if(sD(s)&&s.isUnary()){var _=E(s.args[0],t);if(s.op===`~`&&sD(_)&&_.isUnary()&&_.op===`~`||s.op===`not`&&sD(_)&&_.isUnary()&&_.op===`not`&&C(_.args[0]))return _.args[0];var v=!0;if(s.op===`-`&&sD(_)&&(_.isBinary()&&_.fn===`subtract`&&(s=new g(`-`,`subtract`,[_.args[1],_.args[0]]),v=!1),_.isUnary()&&_.op===`-`))return _.args[0];if(v)return new g(s.op,s.fn,[_])}if(sD(s)&&s.isBinary()){var D=E(s.args[0],t),O=E(s.args[1],t);if(s.op===`+`){if(eD(D)&&i(D.value))return O;if(eD(O)&&i(O.value))return D;sD(O)&&O.isUnary()&&O.op===`-`&&(O=O.args[0],s=new g(`-`,`subtract`,[D,O]))}if(s.op===`-`)return sD(O)&&O.isUnary()&&O.op===`-`?E(new g(`+`,`add`,[D,O.args[0]]),t):eD(D)&&i(D.value)?E(new g(`-`,`unaryMinus`,[O])):eD(O)&&i(O.value)?D:new g(s.op,s.fn,[D,O]);if(s.op===`*`){if(eD(D)){if(i(D.value))return y;if(r(D.value,1))return O}if(eD(O)){if(i(O.value))return y;if(r(O.value,1))return D;if(T(s,n))return new g(s.op,s.fn,[O,D],s.implicit)}return new g(s.op,s.fn,[D,O],s.implicit)}if(s.op===`/`)return eD(D)&&i(D.value)?y:eD(O)&&r(O.value,1)?D:new g(s.op,s.fn,[D,O]);if(s.op===`^`&&eD(O)){if(i(O.value))return b;if(r(O.value,1))return D}if(s.op===`and`){if(eD(D))if(D.value){if(C(O))return O;if(eD(O))return O.value?x:S}else return S;if(eD(O))if(O.value){if(C(D))return D}else return S}if(s.op===`or`){if(eD(D)){if(D.value)return x;if(C(O))return O}if(eD(O)){if(O.value)return x;if(C(D))return D}}return new g(s.op,s.fn,[D,O])}if(sD(s))return new g(s.op,s.fn,s.args.map(e=>E(e,t)));if(XE(s))return new d(s.items.map(e=>E(e,t)));if(YE(s))return new u(E(s.object,t),E(s.index,t));if(iD(s))return new m(s.dimensions.map(e=>E(e,t)));if(oD(s)){var k={};for(var A in s.properties)k[A]=E(s.properties[A],t);return new h(k)}return s}return t(IG,{Node:E,"Node,Object":E})}),RG=Z(`resolve`,[`typed`,`parse`,`ConstantNode`,`FunctionNode`,`OperatorNode`,`ParenthesisNode`],e=>{var{typed:t,parse:n,ConstantNode:r,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(e,t){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!t)return e;if(dD(e)){if(c.has(e.name)){var l=Array.from(c).join(`, `);throw ReferenceError(`recursive loop of variable definitions among {${l}}`)}var u=t.get(e.name);if(aD(u)){var d=new Set(c);return d.add(e.name),s(u,t,d)}else if(typeof u==`number`)return n(String(u));else if(u!==void 0)return new r(u);else return e}else if(sD(e)){var f=e.args.map(function(e){return s(e,t,c)});return new a(e.op,e.fn,f,e.implicit)}else if(cD(e))return new o(s(e.content,t,c));else if(rD(e)){var p=e.args.map(function(e){return s(e,t,c)});return new i(e.name,p)}return e.map(e=>s(e,t,c))}return t(`resolve`,{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,t)=>s(e,xE(t)),"Array | Matrix":t.referToSelf(e=>t=>t.map(t=>e(t))),"Array | Matrix, null | undefined":t.referToSelf(e=>t=>t.map(t=>e(t))),"Array, Object":t.referTo(`Array,Map`,e=>(t,n)=>e(t,xE(n))),"Matrix, Object":t.referTo(`Matrix,Map`,e=>(t,n)=>e(t,xE(n))),"Array | Matrix, Map":t.referToSelf(e=>(t,n)=>t.map(t=>e(t,n)))})}),zG=`symbolicEqual`,BG=Z(zG,[`parse`,`simplify`,`typed`,`OperatorNode`],e=>{var{parse:t,simplify:n,typed:r,OperatorNode:i}=e;function a(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n(new i(`-`,`subtract`,[e,t]),{},r);return eD(a)&&!a.value}return r(zG,{"Node, Node":a,"Node, Node, Object":a})}),VG=`derivative`,HG=Z(VG,[`typed`,`config`,`parse`,`simplify`,`equal`,`isZero`,`numeric`,`ConstantNode`,`FunctionNode`,`OperatorNode`,`ParenthesisNode`,`SymbolNode`],e=>{var{typed:t,config:n,parse:r,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:c,FunctionNode:l,OperatorNode:u,ParenthesisNode:d,SymbolNode:f}=e;function p(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},r=new Map,a=t.name;function o(e){var t=r.get(e);if(t!==void 0)return t;var n=_(o,e,a);return r.set(e,n),n}var s=v(e,o);return n.simplify?i(s):s}function m(e){var t=r(e);if(!t.isSymbolNode)throw TypeError(`Invalid variable. Cannot parse ${JSON.stringify(e)} into a variable in function derivative`);return t}var h=t(VG,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p,"Node, string":(e,t)=>p(e,m(t)),"Node, string, Object":(e,t,n)=>p(e,m(t),n)});h._simplify=!0,h.toTex=function(e){return g.apply(null,e.args)};var g=t(`_derivTex`,{"Node, SymbolNode":function(e,t){return eD(e)&&pD(e.value)===`string`?g(r(e.value).toString(),t.toString(),1):g(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if(pD(t.value)===`string`)return g(e,r(t.value));throw Error(`The second parameter to 'derivative' is a non-string constant`)},"Node, SymbolNode, ConstantNode":function(e,t,n){return g(e.toString(),t.name,n.value)},"string, string, number":function(e,t,n){return(n===1?`{d\\over d`+t+`}`:`{d^{`+n+`}\\over d`+t+`^{`+n+`}}`)+`\\left[${e}\\right]`}}),_=t(`_isConst`,{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(e,t,n){return t.name!==n},"function, ParenthesisNode, string":function(e,t,n){return e(t.content,n)},"function, FunctionAssignmentNode, string":function(e,t,n){return t.params.includes(n)?e(t.expr,n):!0},"function, FunctionNode | OperatorNode, string":function(e,t,n){return t.args.every(t=>e(t,n))}}),v=t(`_derivative`,{"ConstantNode, function":function(){return y(0)},"SymbolNode, function":function(e,t){return t(e)?y(0):y(1)},"ParenthesisNode, function":function(e,t){return new d(v(e.content,t))},"FunctionAssignmentNode, function":function(e,t){return t(e)?y(0):v(e.expr,t)},"FunctionNode, function":function(e,t){if(t(e))return y(0);var n=e.args[0],r,i=!1,a=!1,o;switch(e.name){case`cbrt`:i=!0,o=new u(`*`,`multiply`,[y(3),new u(`^`,`pow`,[n,new u(`/`,`divide`,[y(2),y(3)])])]);break;case`sqrt`:case`nthRoot`:if(e.args.length===1)i=!0,o=new u(`*`,`multiply`,[y(2),new l(`sqrt`,[n])]);else if(e.args.length===2)return r=new u(`/`,`divide`,[y(1),e.args[1]]),v(new u(`^`,`pow`,[n,r]),t);break;case`log10`:r=y(10);case`log`:if(!r&&e.args.length===1)o=n.clone(),i=!0;else if(e.args.length===1&&r||e.args.length===2&&t(e.args[1]))o=new u(`*`,`multiply`,[n.clone(),new l(`log`,[r||e.args[1]])]),i=!0;else if(e.args.length===2)return v(new u(`/`,`divide`,[new l(`log`,[n]),new l(`log`,[e.args[1]])]),t);break;case`pow`:if(e.args.length===2)return v(new u(`^`,`pow`,[n,e.args[1]]),t);break;case`exp`:o=new l(`exp`,[n.clone()]);break;case`sin`:o=new l(`cos`,[n.clone()]);break;case`cos`:o=new u(`-`,`unaryMinus`,[new l(`sin`,[n.clone()])]);break;case`tan`:o=new u(`^`,`pow`,[new l(`sec`,[n.clone()]),y(2)]);break;case`sec`:o=new u(`*`,`multiply`,[e,new l(`tan`,[n.clone()])]);break;case`csc`:a=!0,o=new u(`*`,`multiply`,[e,new l(`cot`,[n.clone()])]);break;case`cot`:a=!0,o=new u(`^`,`pow`,[new l(`csc`,[n.clone()]),y(2)]);break;case`asin`:i=!0,o=new l(`sqrt`,[new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])])]);break;case`acos`:i=!0,a=!0,o=new l(`sqrt`,[new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])])]);break;case`atan`:i=!0,o=new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)]);break;case`asec`:i=!0,o=new u(`*`,`multiply`,[new l(`abs`,[n.clone()]),new l(`sqrt`,[new u(`-`,`subtract`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])])]);break;case`acsc`:i=!0,a=!0,o=new u(`*`,`multiply`,[new l(`abs`,[n.clone()]),new l(`sqrt`,[new u(`-`,`subtract`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])])]);break;case`acot`:i=!0,a=!0,o=new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)]);break;case`sinh`:o=new l(`cosh`,[n.clone()]);break;case`cosh`:o=new l(`sinh`,[n.clone()]);break;case`tanh`:o=new u(`^`,`pow`,[new l(`sech`,[n.clone()]),y(2)]);break;case`sech`:a=!0,o=new u(`*`,`multiply`,[e,new l(`tanh`,[n.clone()])]);break;case`csch`:a=!0,o=new u(`*`,`multiply`,[e,new l(`coth`,[n.clone()])]);break;case`coth`:a=!0,o=new u(`^`,`pow`,[new l(`csch`,[n.clone()]),y(2)]);break;case`asinh`:i=!0,o=new l(`sqrt`,[new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])]);break;case`acosh`:i=!0,o=new l(`sqrt`,[new u(`-`,`subtract`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])]);break;case`atanh`:i=!0,o=new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])]);break;case`asech`:i=!0,a=!0,o=new u(`*`,`multiply`,[n.clone(),new l(`sqrt`,[new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])])])]);break;case`acsch`:i=!0,a=!0,o=new u(`*`,`multiply`,[new l(`abs`,[n.clone()]),new l(`sqrt`,[new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])])]);break;case`acoth`:i=!0,a=!0,o=new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])]);break;case`abs`:o=new u(`/`,`divide`,[new l(new f(`abs`),[n.clone()]),n.clone()]);break;default:throw Error(`Cannot process function "`+e.name+`" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported`)}var s,c;i?(s=`/`,c=`divide`):(s=`*`,c=`multiply`);var d=v(n,t);return a&&(d=new u(`-`,`unaryMinus`,[d])),new u(s,c,[d,o])},"OperatorNode, function":function(e,t){if(t(e))return y(0);if(e.op===`+`)return new u(e.op,e.fn,e.args.map(function(e){return v(e,t)}));if(e.op===`-`){if(e.isUnary())return new u(e.op,e.fn,[v(e.args[0],t)]);if(e.isBinary())return new u(e.op,e.fn,[v(e.args[0],t),v(e.args[1],t)])}if(e.op===`*`){var n=e.args.filter(function(e){return t(e)});if(n.length>0){var r=e.args.filter(function(e){return!t(e)}),i=r.length===1?r[0]:new u(`*`,`multiply`,r);return new u(`*`,`multiply`,n.concat(v(i,t)))}return new u(`+`,`add`,e.args.map(function(n){return new u(`*`,`multiply`,e.args.map(function(e){return e===n?v(e,t):e.clone()}))}))}if(e.op===`/`&&e.isBinary()){var s=e.args[0],c=e.args[1];return t(c)?new u(`/`,`divide`,[v(s,t),c]):t(s)?new u(`*`,`multiply`,[new u(`-`,`unaryMinus`,[s]),new u(`/`,`divide`,[v(c,t),new u(`^`,`pow`,[c.clone(),y(2)])])]):new u(`/`,`divide`,[new u(`-`,`subtract`,[new u(`*`,`multiply`,[v(s,t),c.clone()]),new u(`*`,`multiply`,[s.clone(),v(c,t)])]),new u(`^`,`pow`,[c.clone(),y(2)])])}if(e.op===`^`&&e.isBinary()){var d=e.args[0],f=e.args[1];if(t(d))return eD(d)&&(o(d.value)||a(d.value,1))?y(0):new u(`*`,`multiply`,[e,new u(`*`,`multiply`,[new l(`log`,[d.clone()]),v(f.clone(),t)])]);if(t(f)){if(eD(f)){if(o(f.value))return y(0);if(a(f.value,1))return v(d,t)}var p=new u(`^`,`pow`,[d.clone(),new u(`-`,`subtract`,[f,y(1)])]);return new u(`*`,`multiply`,[f.clone(),new u(`*`,`multiply`,[v(d,t),p])])}return new u(`*`,`multiply`,[new u(`^`,`pow`,[d.clone(),f.clone()]),new u(`+`,`add`,[new u(`*`,`multiply`,[v(d,t),new u(`/`,`divide`,[f.clone(),d.clone()])]),new u(`*`,`multiply`,[v(f,t),new l(`log`,[d.clone()])])])])}throw Error(`Cannot process operator "`+e.op+`" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported`)}});function y(e,t){return new c(s(e,t||FD(String(e),n)))}return h}),UG=`rationalize`,WG=Z(UG,`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`.split(`.`),e=>{var{config:t,typed:n,equal:r,isZero:i,add:a,subtract:o,multiply:s,divide:c,pow:l,parse:u,simplifyConstant:d,simplifyCore:f,simplify:p,fraction:m,bignumber:h,mathWithTransform:g,matrix:_,AccessorNode:v,ArrayNode:y,ConstantNode:b,FunctionNode:x,IndexNode:S,ObjectNode:C,OperatorNode:w,SymbolNode:T,ParenthesisNode:E}=e;function D(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=k(),i=O(e,t,!0,r.firstRules),a=i.variables.length,o={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,a>=1){e=A(e);var c,l,u=!0,d=!1;e=p(e,r.firstRules,{},o);for(var f;l=u?r.distrDivRules:r.sucDivRules,e=p(e,l,{},s),u=!u,f=e.toString(),f!==c;)d=!0,c=f;d&&(e=p(e,r.firstRulesAgain,{},o)),e=p(e,r.finalRules,{},o)}var m=[],h={};return e.type===`OperatorNode`&&e.isBinary()&&e.op===`/`?(a===1&&(e.args[0]=j(e.args[0],m),e.args[1]=j(e.args[1])),n&&(h.numerator=e.args[0],h.denominator=e.args[1])):(a===1&&(e=j(e,m)),n&&(h.numerator=e,h.denominator=null)),n?(h.coefficients=m,h.variables=i.variables,h.expression=e,h):e}return n(UG,{Node:D,"Node, boolean":(e,t)=>D(e,{},t),"Node, Object":D,"Node, Object, boolean":D});function O(e,t,n,r){var i=[],a=p(e,r,t,{exactFractions:!1});n=!!n;var o=`+-*`+(n?`/`:``);c(a);var s={};return s.expression=a,s.variables=i,s;function c(e){var t=e.type;if(t===`FunctionNode`)throw Error(`There is an unsolved function call`);if(t===`OperatorNode`)if(e.op===`^`){if(e.args[1].type!==`ConstantNode`||!PD(parseFloat(e.args[1].value)))throw Error(`There is a non-integer exponent`);c(e.args[0])}else{if(!o.includes(e.op))throw Error(`Operator `+e.op+` invalid in polynomial expression`);for(var n=0;n<e.args.length;n++)c(e.args[n])}else if(t===`SymbolNode`){var r=e.name;i.indexOf(r)===-1&&i.push(r)}else if(t===`ParenthesisNode`)c(e.content);else if(t!==`ConstantNode`)throw Error(`type `+t+` is not allowed in polynomial expression`)}}function k(){var e=[f,{l:`n+n`,r:`2*n`},{l:`n+-n`,r:`0`},d,{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)`}],n=[{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)`}],r=[{l:`(n1/(n2/n3))`,r:`((n1*n3)/n2)`},{l:`(n1/n2/n3)`,r:`(n1/(n2*n3))`}],i={};return i.firstRules=e.concat(t,r),i.distrDivRules=n,i.sucDivRules=r,i.firstRulesAgain=e.concat(t),i.finalRules=[f,{l:`n*-n`,r:`-n^2`},{l:`n*n`,r:`n^2`},d,{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))`}],i}function A(e,t,n){var r=e.type,i=arguments.length>1;if(r===`OperatorNode`&&e.isBinary()){var a=!1,o;if(e.op===`^`&&(e.args[0].type===`ParenthesisNode`||e.args[0].type===`OperatorNode`)&&e.args[1].type===`ConstantNode`&&(o=parseFloat(e.args[1].value),a=o>=2&&PD(o)),a){if(o>2){var s=e.args[0];e=new w(`*`,`multiply`,[s,new w(`^`,`pow`,[e.args[0].cloneDeep(),new b(o-1)])])}else e=new w(`*`,`multiply`,[e.args[0],e.args[0].cloneDeep()]);i&&(n===`content`?t.content=e:t.args[n]=e)}}if(r===`ParenthesisNode`)A(e.content,e,`content`);else if(r!==`ConstantNode`&&r!==`SymbolNode`)for(var c=0;c<e.args.length;c++)A(e.args[c],e,c);if(!i)return e}function j(e,t){t===void 0&&(t=[]),t[0]=0;var n={};n.cte=1,n.oper=`+`,n.fire=``;var r=0,i=``;f(e,null,n),r=t.length-1;for(var a=!0,o,s=r;s>=0;s--)if(t[s]!==0){var c=new b(a?t[s]:Math.abs(t[s])),l=t[s]<0?`-`:`+`;if(s>0){var u=new T(i);if(s>1){var d=new b(s);u=new w(`^`,`pow`,[u,d])}c=t[s]===-1&&a?new w(`-`,`unaryMinus`,[u]):Math.abs(t[s])===1?u:new w(`*`,`multiply`,[c,u])}o=a?c:l===`+`?new w(`+`,`add`,[o,c]):new w(`-`,`subtract`,[o,c]),a=!1}if(a)return new b(0);return o;function f(e,n,a){var o=e.type;if(o===`FunctionNode`)throw Error(`There is an unsolved function call`);if(o===`OperatorNode`){if(!`+-*^`.includes(e.op))throw Error(`Operator `+e.op+` invalid`);if(n!==null&&((e.fn===`unaryMinus`||e.fn===`pow`)&&n.fn!==`add`&&n.fn!==`subtract`&&n.fn!==`multiply`||(e.fn===`subtract`||e.fn===`add`||e.fn===`multiply`)&&n.fn!==`add`&&n.fn!==`subtract`||(e.fn===`subtract`||e.fn===`add`||e.fn===`unaryMinus`)&&a.noFil!==0))throw Error(`Invalid `+e.op+` placing`);(e.op===`^`||e.op===`*`)&&(a.fire=e.op);for(var s=0;s<e.args.length;s++)e.fn===`unaryMinus`&&(a.oper=`-`),(e.op===`+`||e.fn===`subtract`)&&(a.fire=``,a.cte=1,a.oper=s===0?`+`:e.op),a.noFil=s,f(e.args[s],e,a)}else if(o===`SymbolNode`){if(e.name!==i&&i!==``)throw Error(`There is more than one variable`);if(i=e.name,n===null){t[1]=1;return}if(n.op===`^`&&a.noFil!==0)throw Error(`In power the variable should be the first parameter`);if(n.op===`*`&&a.noFil!==1)throw Error(`In multiply the variable should be the second parameter`);(a.fire===``||a.fire===`*`)&&(r<1&&(t[1]=0),t[1]+=a.cte*(a.oper===`+`?1:-1),r=Math.max(1,r))}else if(o===`ConstantNode`){var c=parseFloat(e.value);if(n===null){t[0]=c;return}if(n.op===`^`){if(a.noFil!==1)throw Error(`Constant cannot be powered`);if(!PD(c)||c<=0)throw Error(`Non-integer exponent is not allowed`);for(var l=r+1;l<c;l++)t[l]=0;c>r&&(t[c]=0),t[c]+=a.cte*(a.oper===`+`?1:-1),r=Math.max(c,r);return}a.cte=c,a.fire===``&&(t[0]+=a.cte*(a.oper===`+`?1:-1))}else throw Error(`Type `+o+` is not allowed`)}}}),GG=`zpk2tf`,KG=Z(GG,[`typed`,`add`,`multiply`,`Complex`,`number`],e=>{var{typed:t,add:n,multiply:r,Complex:i,number:a}=e;return t(GG,{"Array,Array,number":function(e,t,n){return o(e,t,n)},"Array,Array":function(e,t){return o(e,t,1)},"Matrix,Matrix,number":function(e,t,n){return o(e.valueOf(),t.valueOf(),n)},"Matrix,Matrix":function(e,t){return o(e.valueOf(),t.valueOf(),1)}});function o(e,t,n){e.some(e=>e.type===`BigNumber`)&&(e=e.map(e=>a(e))),t.some(e=>e.type===`BigNumber`)&&(t=t.map(e=>a(e)));for(var o=[i(1,0)],c=[i(1,0)],l=0;l<e.length;l++){var u=e[l];typeof u==`number`&&(u=i(u,0)),o=s(o,[i(1,0),i(-u.re,-u.im)])}for(var d=0;d<t.length;d++){var f=t[d];typeof f==`number`&&(f=i(f,0)),c=s(c,[i(1,0),i(-f.re,-f.im)])}for(var p=0;p<o.length;p++)o[p]=r(o[p],n);return[o,c]}function s(e,t){for(var a=[],o=0;o<e.length+t.length-1;o++){a[o]=i(0,0);for(var s=0;s<e.length;s++)o-s>=0&&o-s<t.length&&(a[o]=n(a[o],r(e[s],t[o-s])))}return a}}),qG=`freqz`,JG=Z(qG,[`typed`,`add`,`multiply`,`Complex`,`divide`,`matrix`],e=>{var{typed:t,add:n,multiply:r,Complex:i,divide:a,matrix:o}=e;return t(qG,{"Array, Array":function(e,t){return s(e,t,c(512))},"Array, Array, Array":function(e,t,n){return s(e,t,n)},"Array, Array, number":function(e,t,n){if(n<0)throw Error(`w must be a positive number`);return s(e,t,c(n))},"Matrix, Matrix":function(e,t){var n=c(512),{w:r,h:i}=s(e.valueOf(),t.valueOf(),n);return{w:o(r),h:o(i)}},"Matrix, Matrix, Matrix":function(e,t,n){var{h:r}=s(e.valueOf(),t.valueOf(),n.valueOf());return{h:o(r),w:o(n)}},"Matrix, Matrix, number":function(e,t,n){if(n<0)throw Error(`w must be a positive number`);var r=c(n),{h:i}=s(e.valueOf(),t.valueOf(),r);return{h:o(i),w:o(r)}}});function s(e,t,o){for(var s=[],c=[],l=0;l<o.length;l++){for(var u=i(0,0),d=i(0,0),f=0;f<e.length;f++)u=n(u,r(e[f],i(Math.cos(-f*o[l]),Math.sin(-f*o[l]))));for(var p=0;p<t.length;p++)d=n(d,r(t[p],i(Math.cos(-p*o[l]),Math.sin(-p*o[l]))));s.push(u),c.push(d)}for(var m=[],h=0;h<s.length;h++)m.push(a(s[h],c[h]));return{h:m,w:o}}function c(e){for(var t=[],n=0;n<e;n++)t.push(n/e*Math.PI);return t}}),YG=Z(`reviver`,[`classes`],e=>{var{classes:t}=e;return function(e,n){var r=t[n&&n.mathjs];return r&&typeof r.fromJSON==`function`?r.fromJSON(n):n}}),XG=Z(`replacer`,[],()=>function(e,t){return typeof t==`number`&&(!Number.isFinite(t)||isNaN(t))?{mathjs:`number`,value:String(t)}:typeof t==`bigint`?{mathjs:`bigint`,value:String(t)}:t}),ZG=`15.2.0`,QG=Z(`true`,[],()=>!0),$G=Z(`false`,[],()=>!1),eK=Z(`null`,[],()=>null),tK=_K(`Infinity`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(1/0):1/0}),nK=_K(`NaN`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(NaN):NaN}),rK=_K(`pi`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?dB(n):zM}),iK=_K(`tau`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?fB(n):BM}),aK=_K(`e`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?lB(n):VM}),oK=_K(`phi`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?uB(n):HM}),sK=_K(`LN2`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(2).ln():Math.LN2}),cK=_K(`LN10`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(10).ln():Math.LN10}),lK=_K(`LOG2E`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(1).div(new n(2).ln()):Math.LOG2E}),uK=_K(`LOG10E`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(1).div(new n(10).ln()):Math.LOG10E}),dK=_K(`SQRT1_2`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(`0.5`).sqrt():Math.SQRT1_2}),fK=_K(`SQRT2`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(2).sqrt():Math.SQRT2}),pK=_K(`i`,[`Complex`],e=>{var{Complex:t}=e;return t.I}),mK=Z(`PI`,[`pi`],e=>{var{pi:t}=e;return t}),hK=Z(`E`,[`e`],e=>{var{e:t}=e;return t}),gK=Z(`version`,[],()=>ZG);function _K(e,t,n){return Z(e,t,n,{recreateOnConfigChange:!0})}var vK=hq(`speedOfLight`,`299792458`,`m s^-1`),yK=hq(`gravitationConstant`,`6.67430e-11`,`m^3 kg^-1 s^-2`),bK=hq(`planckConstant`,`6.62607015e-34`,`J s`),xK=hq(`reducedPlanckConstant`,`1.0545718176461565e-34`,`J s`),SK=hq(`magneticConstant`,`1.25663706212e-6`,`N A^-2`),CK=hq(`electricConstant`,`8.8541878128e-12`,`F m^-1`),wK=hq(`vacuumImpedance`,`376.730313667`,`ohm`),TK=hq(`coulomb`,`8.987551792261171e9`,`N m^2 C^-2`),EK=hq(`coulombConstant`,`8.987551792261171e9`,`N m^2 C^-2`),DK=hq(`elementaryCharge`,`1.602176634e-19`,`C`),OK=hq(`bohrMagneton`,`9.2740100783e-24`,`J T^-1`),kK=hq(`conductanceQuantum`,`7.748091729863649e-5`,`S`),AK=hq(`inverseConductanceQuantum`,`12906.403729652257`,`ohm`),jK=hq(`magneticFluxQuantum`,`2.0678338484619295e-15`,`Wb`),MK=hq(`nuclearMagneton`,`5.0507837461e-27`,`J T^-1`),NK=hq(`klitzing`,`25812.807459304513`,`ohm`),PK=hq(`bohrRadius`,`5.29177210903e-11`,`m`),FK=hq(`classicalElectronRadius`,`2.8179403262e-15`,`m`),IK=hq(`electronMass`,`9.1093837015e-31`,`kg`),LK=hq(`fermiCoupling`,`1.1663787e-5`,`GeV^-2`),RK=gq(`fineStructure`,.0072973525693),zK=hq(`hartreeEnergy`,`4.3597447222071e-18`,`J`),BK=hq(`protonMass`,`1.67262192369e-27`,`kg`),VK=hq(`deuteronMass`,`3.3435830926e-27`,`kg`),HK=hq(`neutronMass`,`1.6749271613e-27`,`kg`),UK=hq(`quantumOfCirculation`,`3.6369475516e-4`,`m^2 s^-1`),WK=hq(`rydberg`,`10973731.568160`,`m^-1`),GK=hq(`thomsonCrossSection`,`6.6524587321e-29`,`m^2`),KK=gq(`weakMixingAngle`,.2229),qK=gq(`efimovFactor`,22.7),JK=hq(`atomicMass`,`1.66053906660e-27`,`kg`),YK=hq(`avogadro`,`6.02214076e23`,`mol^-1`),XK=hq(`boltzmann`,`1.380649e-23`,`J K^-1`),ZK=hq(`faraday`,`96485.33212331001`,`C mol^-1`),QK=hq(`firstRadiation`,`3.7417718521927573e-16`,`W m^2`),$K=hq(`loschmidt`,`2.686780111798444e25`,`m^-3`),eq=hq(`gasConstant`,`8.31446261815324`,`J K^-1 mol^-1`),tq=hq(`molarPlanckConstant`,`3.990312712893431e-10`,`J s mol^-1`),nq=hq(`molarVolume`,`0.022413969545014137`,`m^3 mol^-1`),rq=gq(`sackurTetrode`,-1.16487052358),iq=hq(`secondRadiation`,`0.014387768775039337`,`m K`),aq=hq(`stefanBoltzmann`,`5.67037441918443e-8`,`W m^-2 K^-4`),oq=hq(`wienDisplacement`,`2.897771955e-3`,`m K`),sq=hq(`molarMass`,`0.99999999965e-3`,`kg mol^-1`),cq=hq(`molarMassC12`,`11.9999999958e-3`,`kg mol^-1`),lq=hq(`gravity`,`9.80665`,`m s^-2`),uq=hq(`planckLength`,`1.616255e-35`,`m`),dq=hq(`planckMass`,`2.176435e-8`,`kg`),fq=hq(`planckTime`,`5.391245e-44`,`s`),pq=hq(`planckCharge`,`1.87554603778e-18`,`C`),mq=hq(`planckTemperature`,`1.416785e+32`,`K`);function hq(e,t,n){return Z(e,[`config`,`Unit`,`BigNumber`],e=>{var{config:r,Unit:i,BigNumber:a}=e,o=new i(r.number===`BigNumber`?new a(t):parseFloat(t),n);return o.fixPrefix=!0,o})}function gq(e,t){return Z(e,[`config`,`BigNumber`],e=>{var{config:n,BigNumber:r}=e;return n.number===`BigNumber`?new r(t):t})}function _q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_q(Object(n),!0).forEach(function(t){XL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var yq=Z(`mapSlices`,[`typed`,`isInteger`],e=>{var{typed:t,isInteger:n}=e,r=PP({typed:t,isInteger:n});return t(`mapSlices`,{"...any":function(e){var t=e[1];CE(t)?e[1]=t-1:wE(t)&&(e[1]=t.minus(1));try{return r.apply(null,e)}catch(e){throw XV(e)}}})},vq({isTransformFunction:!0},PP.meta)),bq=Z(`column`,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e,a=HI({typed:t,Index:n,matrix:r,range:i});return t(`column`,{"...any":function(e){var t=e.length-1,n=e[t];CE(n)&&(e[t]=n-1);try{return a.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0});function xq(e,t,n){var r=e.filter(function(e){return dD(e)&&!(e.name in t)&&!n.has(e.name)})[0];if(!r)throw Error(`No undefined variable found in inline expression "`+e+`"`);var i=r.name,a=new Map,o=new vE(n,a,new Set([i])),s=e.compile();return function(e){return a.set(i,e),s.evaluate(o)}}var Sq=Z(`transformCallback`,[`typed`],e=>{var{typed:t}=e;return function(e,r){return t.isTypedFunction(e)?n(e,r):Cq(e,e.length,r)};function n(e,r){var i=Object.fromEntries(Object.entries(e.signatures).map(e=>{var[i,a]=e,o=i.split(`,`).length;return t.isTypedFunction(a)?[i,n(a,r)]:[i,Cq(a,o,r)]}));return typeof e.name==`string`?t(e.name,i):t(i)}});function Cq(e,t,n){return t===n?e:t===n+1?function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var a=r.slice(0,n),o=wq(r[n]);return e(...a,o)}:t>n+1?function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var a=r.slice(0,n),o=wq(r[n]),s=r.slice(n+1);return e(...a,o,...s)}:e}function wq(e){return e.map(e=>e+1)}var Tq=Z(`filter`,[`typed`],e=>{var{typed:t}=e;function n(e,n,i){var a=YI({typed:t}),o=Sq({typed:t});if(e.length===0)return a();var s=e[0];if(e.length===1)return a(s);var c=e.length-1,l=e[c];return s&&=r(s,i),l&&=dD(l)||nD(l)?r(l,i):xq(l,n,i),a(s,o(l,c))}n.rawArgs=!0;function r(e,t){return e.compile().evaluate(t)}return n},{isTransformFunction:!0}),Eq=Z(`forEach`,[`typed`],e=>{var{typed:t}=e,n=eL({typed:t}),r=Sq({typed:t});function i(e,t,i){if(e.length===0)return n();var o=e[0];if(e.length===1)return n(o);var s=e.length-1,c=e[s];return o&&=a(o,i),c&&=dD(c)||nD(c)?a(c,i):xq(c,t,i),n(o,r(c,s))}i.rawArgs=!0;function a(e,t){return e.compile().evaluate(t)}return i},{isTransformFunction:!0}),Dq=Z(`index`,[`Index`,`getMatrixDataType`],e=>{var{Index:t,getMatrixDataType:n}=e;return function(){for(var e=[],r=0,i=arguments.length;r<i;r++){var a=arguments[r];if(FE(a))a.start--,a.end-=a.step>0?0:2;else if(a&&a.isSet===!0)a=a.map(function(e){return e-1});else if(AE(a)||jE(a))n(a)!==`boolean`&&(a=a.map(function(e){return e-1}));else if(CE(a)||TE(a))a--;else if(wE(a))a=a.toNumber()-1;else if(typeof a!=`string`)throw TypeError(`Dimension must be an Array, Matrix, number, bigint, string, or Range`);e[r]=a}var o=new t;return t.apply(o,e),o}},{isTransformFunction:!0}),Oq=Z(`map`,[`typed`],e=>{var{typed:t}=e,n=lL({typed:t}),r=Sq({typed:t});function i(e,t,i){if(e.length===0)return n();if(e.length===1)return n(e[0]);var a=e.length-1,o=e.slice(0,a),s=e[a];return o=o.map(e=>c(e,i)),s&&=dD(s)||nD(s)?c(s,i):xq(s,t,i),n(...o,r(s,a));function c(e,t){return e.compile().evaluate(t)}}return i.rawArgs=!0,i},{isTransformFunction:!0});function kq(e){return CE(e)?e-1:wE(e)?e.minus(1):e}function Aq(e){return CE(e)||wE(e)}function jq(e){if(e.length===2&&ME(e[0])){e=e.slice();var t=e[1];Aq(t)&&(e[1]=kq(t))}return e}var Mq=Z(`max`,[`typed`,`config`,`numeric`,`larger`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,larger:i,isNaN:a}=e,o=$z({typed:t,config:n,numeric:r,larger:i,isNaN:a});return t(`max`,{"...any":function(e){e=jq(e);try{return o.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Nq=Z(`mean`,[`typed`,`add`,`divide`],e=>{var{typed:t,add:n,divide:r}=e,i=bW({typed:t,add:n,divide:r});return t(`mean`,{"...any":function(e){e=jq(e);try{return i.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Pq=Z(`min`,[`typed`,`config`,`numeric`,`smaller`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,smaller:i,isNaN:a}=e,o=tB({typed:t,config:n,numeric:r,smaller:i,isNaN:a});return t(`min`,{"...any":function(e){e=jq(e);try{return o.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Fq=Z(`range`,[`typed`,`config`,`?matrix`,`?bignumber`,`equal`,`smaller`,`smallerEq`,`larger`,`largerEq`,`add`,`isZero`,`isPositive`],e=>{var{typed:t,config:n,matrix:r,bignumber:i,equal:a,smaller:o,smallerEq:s,larger:c,largerEq:l,add:u,isZero:d,isPositive:f}=e,p=_L({typed:t,config:n,matrix:r,bignumber:i,equal:a,smaller:o,smallerEq:s,larger:c,largerEq:l,add:u,isZero:d,isPositive:f});return t(`range`,{"...any":function(e){return typeof e[e.length-1]!=`boolean`&&e.push(!0),p.apply(null,e)}})},{isTransformFunction:!0}),Iq=Z(`row`,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e,a=EL({typed:t,Index:n,matrix:r,range:i});return t(`row`,{"...any":function(e){var t=e.length-1,n=e[t];CE(n)&&(e[t]=n-1);try{return a.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Lq=Z(`subset`,[`typed`,`matrix`,`zeros`,`add`],e=>{var{typed:t,matrix:n,zeros:r,add:i}=e,a=ML({typed:t,matrix:n,zeros:r,add:i});return t(`subset`,{"...any":function(e){try{return a.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Rq=Z(`concat`,[`typed`,`matrix`,`isInteger`],e=>{var{typed:t,matrix:n,isInteger:r}=e,i=BI({typed:t,matrix:n,isInteger:r});return t(`concat`,{"...any":function(e){var t=e.length-1,n=e[t];CE(n)?e[t]=n-1:wE(n)&&(e[t]=n.minus(1));try{return i.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),zq=`diff`,Bq=Z(zq,[`typed`,`matrix`,`subtract`,`number`,`bignumber`],e=>{var{typed:t,matrix:n,subtract:r,number:i,bignumber:a}=e,o=dL({typed:t,matrix:n,subtract:r,number:i,bignumber:a});return t(zq,{"...any":function(e){e=jq(e);try{return o.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Vq=Z(`std`,[`typed`,`map`,`sqrt`,`variance`],e=>{var{typed:t,map:n,sqrt:r,variance:i}=e,a=jW({typed:t,map:n,sqrt:r,variance:i});return t(`std`,{"...any":function(e){e=jq(e);try{return a.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Hq=`sum`,Uq=Z(Hq,[`typed`,`config`,`add`,`numeric`],e=>{var{typed:t,config:n,add:r,numeric:i}=e,a=gW({typed:t,config:n,add:r,numeric:i});return t(Hq,{"...any":function(e){e=jq(e);try{return a.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Wq=Z(`quantileSeq`,[`typed`,`bignumber`,`add`,`subtract`,`divide`,`multiply`,`partitionSelect`,`compare`,`isInteger`,`smaller`,`smallerEq`,`larger`,`mapSlices`],e=>{var{typed:t,bignumber:n,add:r,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:c,isInteger:l,smaller:u,smallerEq:d,larger:f,mapSlices:p}=e,m=kW({typed:t,bignumber:n,add:r,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:c,isInteger:l,smaller:u,smallerEq:d,larger:f,mapSlices:p});return t(`quantileSeq`,{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(e,t,n)=>m(e,t,h(n)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>m(e,t,n,h(r)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(e,t,n)=>m(e,t,h(n)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>m(e,t,n,h(r))});function h(e){return jq([[],e])[1]}},{isTransformFunction:!0}),Gq=`cumsum`,Kq=Z(Gq,[`typed`,`add`,`unaryPlus`],e=>{var{typed:t,add:n,unaryPlus:r}=e,i=vW({typed:t,add:n,unaryPlus:r});return t(Gq,{"...any":function(e){if(e.length===2&&ME(e[0])){var t=e[1];CE(t)?e[1]=t-1:wE(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),qq=`variance`,Jq=Z(qq,[`typed`,`add`,`subtract`,`multiply`,`divide`,`mapSlices`,`isNaN`],e=>{var{typed:t,add:n,subtract:r,multiply:i,divide:a,mapSlices:o,isNaN:s}=e,c=DW({typed:t,add:n,subtract:r,multiply:i,divide:a,mapSlices:o,isNaN:s});return t(qq,{"...any":function(e){e=jq(e);try{return c.apply(null,e)}catch(e){throw XV(e)}}})},{isTransformFunction:!0}),Yq=`print`,Xq=Z(Yq,[`typed`,`matrix`,`zeros`,`add`],e=>{var{typed:t,matrix:n,zeros:r,add:i}=e,a=CR({typed:t,matrix:n,zeros:r,add:i});return t(Yq,{"string, Object | Array":function(e,t){return a(o(e),t)},"string, Object | Array, number | Object":function(e,t,n){return a(o(e),t,n)}});function o(e){return e.replace(xR,e=>`$`+e.slice(1).split(`.`).map(function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e}).join(`.`))}},{isTransformFunction:!0}),Zq=Z(`and`,[`typed`,`matrix`,`zeros`,`add`,`equalScalar`,`not`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o}=e,s=hz({typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o});function c(e,t,n){var r=e[0].compile().evaluate(n);return!ME(r)&&!s(r,!0)?!1:s(r,e[1].compile().evaluate(n))}return c.rawArgs=!0,c},{isTransformFunction:!0}),Qq=Z(`or`,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=II({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a});function s(e,t,n){var r=e[0].compile().evaluate(n);return!ME(r)&&o(r,!1)?!0:o(r,e[1].compile().evaluate(n))}return s.rawArgs=!0,s},{isTransformFunction:!0}),$q=Z(`nullish`,[`typed`,`matrix`,`size`,`flatten`,`deepEqual`],e=>{var{typed:t,matrix:n,size:r,flatten:i,deepEqual:a}=e,o=PI({typed:t,matrix:n,size:r,flatten:i,deepEqual:a});function s(e,t,n){var r=e[0].compile().evaluate(n);return!ME(r)&&r!=null&&r!==void 0?r:o(r,e[1].compile().evaluate(n))}return s.rawArgs=!0,s},{isTransformFunction:!0}),eJ=Z(`bitAnd`,[`typed`,`matrix`,`zeros`,`add`,`equalScalar`,`not`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o}=e,s=hI({typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o});function c(e,t,n){var r=e[0].compile().evaluate(n);if(!ME(r)){if(isNaN(r))return NaN;if(r===0||r===!1)return 0}return s(r,e[1].compile().evaluate(n))}return c.rawArgs=!0,c},{isTransformFunction:!0}),tJ=Z(`bitOr`,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=yI({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a});function s(e,t,n){var r=e[0].compile().evaluate(n);if(!ME(r)){if(isNaN(r))return NaN;if(r===-1)return-1;if(r===!0)return 1}return o(r,e[1].compile().evaluate(n))}return s.rawArgs=!0,s},{isTransformFunction:!0}),nJ=`num`,rJ=Z(nJ,[`typed`,`fraction`],e=>{var{typed:t,fraction:n}=e;return t(nJ,{Fraction:e=>e.s*e.n,BigNumber:e=>{var t=n(e);return t.s*t.n},"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),iJ=`den`,aJ=Z(iJ,[`typed`,`fraction`],e=>{var{typed:t,fraction:n}=e;return t(iJ,{Fraction:e=>e.d,BigNumber:e=>n(e).d,"Array | Matrix":t.referToSelf(e=>t=>Jj(t,e))})}),oJ=s({createAbs:()=>MP,createAccessorNode:()=>$V,createAcos:()=>wB,createAcosh:()=>EB,createAcot:()=>OB,createAcoth:()=>AB,createAcsc:()=>MB,createAcsch:()=>PB,createAdd:()=>RV,createAddScalar:()=>RP,createAnd:()=>hz,createAndTransform:()=>Zq,createArg:()=>wI,createArrayNode:()=>tH,createAsec:()=>IB,createAsech:()=>RB,createAsin:()=>BB,createAsinh:()=>VB,createAssignmentNode:()=>uH,createAtan:()=>HB,createAtan2:()=>WB,createAtanh:()=>KB,createAtomicMass:()=>JK,createAvogadro:()=>YK,createBellNumbers:()=>SG,createBernoulli:()=>FW,createBigNumberClass:()=>rA,createBigint:()=>lP,createBignumber:()=>mP,createBin:()=>gR,createBitAnd:()=>hI,createBitAndTransform:()=>eJ,createBitNot:()=>_I,createBitOr:()=>yI,createBitOrTransform:()=>tJ,createBitXor:()=>SI,createBlockNode:()=>fH,createBohrMagneton:()=>OK,createBohrRadius:()=>PK,createBoltzmann:()=>XK,createBoolean:()=>pP,createCatalan:()=>wG,createCbrt:()=>HP,createCeil:()=>XP,createChain:()=>GU,createChainClass:()=>OU,createClassicalElectronRadius:()=>FK,createClone:()=>Wj,createColumn:()=>HI,createColumnTransform:()=>bq,createCombinations:()=>RW,createCombinationsWithRep:()=>VW,createCompare:()=>_z,createCompareNatural:()=>xz,createCompareText:()=>Tz,createCompile:()=>KH,createComplex:()=>hP,createComplexClass:()=>fA,createComposition:()=>EG,createConcat:()=>BI,createConcatTransform:()=>Rq,createConditionalNode:()=>mH,createConductanceQuantum:()=>kK,createConj:()=>EI,createConstantNode:()=>wH,createCorr:()=>NW,createCos:()=>YB,createCosh:()=>ZB,createCot:()=>$B,createCoth:()=>tV,createCoulomb:()=>TK,createCoulombConstant:()=>EK,createCount:()=>WI,createCreateUnit:()=>SB,createCross:()=>KI,createCsc:()=>rV,createCsch:()=>aV,createCtranspose:()=>BL,createCube:()=>QP,createCumSum:()=>vW,createCumSumTransform:()=>Kq,createDeepEqual:()=>Wz,createDen:()=>aJ,createDenseMatrixClass:()=>Hj,createDerivative:()=>HG,createDet:()=>qU,createDeuteronMass:()=>VK,createDiag:()=>JI,createDiff:()=>dL,createDiffTransform:()=>Bq,createDistance:()=>pW,createDivide:()=>dW,createDivideScalar:()=>NR,createDot:()=>WV,createDotDivide:()=>XR,createDotMultiply:()=>aI,createDotPow:()=>JR,createE:()=>aK,createEfimovFactor:()=>qK,createEigs:()=>eW,createElectricConstant:()=>CK,createElectronMass:()=>IK,createElementaryCharge:()=>DK,createEqual:()=>Dz,createEqualScalar:()=>nP,createEqualText:()=>Az,createErf:()=>eR,createEvaluate:()=>JH,createExp:()=>eF,createExpm:()=>nW,createExpm1:()=>nF,createFactorial:()=>JW,createFalse:()=>$G,createFaraday:()=>ZK,createFermiCoupling:()=>LK,createFft:()=>WL,createFibonacciHeapClass:()=>aB,createFilter:()=>YI,createFilterTransform:()=>Tq,createFineStructure:()=>RK,createFirstRadiation:()=>QK,createFix:()=>oF,createFlatten:()=>QI,createFloor:()=>dF,createForEach:()=>eL,createForEachTransform:()=>Eq,createFormat:()=>mR,createFraction:()=>gP,createFractionClass:()=>FA,createFreqz:()=>JG,createFunctionAssignmentNode:()=>EH,createFunctionNode:()=>HH,createGamma:()=>WW,createGasConstant:()=>eq,createGcd:()=>AF,createGetMatrixDataType:()=>rL,createGravitationConstant:()=>yK,createGravity:()=>lq,createHartreeEnergy:()=>zK,createHasNumericValue:()=>BN,createHelp:()=>UU,createHelpClass:()=>DU,createHex:()=>bR,createHypot:()=>BV,createI:()=>pK,createIdentity:()=>aL,createIfft:()=>KL,createIm:()=>OI,createImmutableDenseMatrixClass:()=>nB,createIndex:()=>qV,createIndexClass:()=>rB,createIndexNode:()=>OH,createIndexTransform:()=>Dq,createInfinity:()=>tK,createIntersect:()=>mW,createInv:()=>YU,createInverseConductanceQuantum:()=>AK,createInvmod:()=>nI,createIsBounded:()=>JN,createIsFinite:()=>XN,createIsInteger:()=>$j,createIsNaN:()=>KN,createIsNegative:()=>IN,createIsNumeric:()=>RN,createIsPositive:()=>HN,createIsPrime:()=>AR,createIsZero:()=>WN,createKldivergence:()=>XW,createKlitzing:()=>NK,createKron:()=>sL,createLN10:()=>cK,createLN2:()=>sK,createLOG10E:()=>uK,createLOG2E:()=>lK,createLarger:()=>Rz,createLargerEq:()=>Vz,createLcm:()=>NF,createLeafCount:()=>OG,createLeftShift:()=>lz,createLgamma:()=>KW,createLog:()=>HR,createLog10:()=>RF,createLog1p:()=>WR,createLog2:()=>BF,createLoschmidt:()=>$K,createLsolve:()=>$R,createLsolveAll:()=>rz,createLup:()=>eU,createLusolve:()=>wU,createLyap:()=>uW,createMad:()=>wW,createMagneticConstant:()=>SK,createMagneticFluxQuantum:()=>jK,createMap:()=>lL,createMapSlices:()=>PP,createMapSlicesTransform:()=>yq,createMapTransform:()=>Oq,createMatrix:()=>vP,createMatrixClass:()=>LA,createMatrixFromColumns:()=>wP,createMatrixFromFunction:()=>bP,createMatrixFromRows:()=>SP,createMax:()=>$z,createMaxTransform:()=>Mq,createMean:()=>bW,createMeanTransform:()=>Nq,createMedian:()=>SW,createMin:()=>tB,createMinTransform:()=>Pq,createMod:()=>bF,createMode:()=>lR,createMolarMass:()=>sq,createMolarMassC12:()=>cq,createMolarPlanckConstant:()=>tq,createMolarVolume:()=>nq,createMultinomial:()=>QW,createMultiply:()=>UF,createMultiplyScalar:()=>VF,createNaN:()=>nK,createNeutronMass:()=>HK,createNode:()=>YV,createNorm:()=>HV,createNot:()=>MI,createNthRoot:()=>GF,createNthRoots:()=>KR,createNuclearMagneton:()=>MK,createNull:()=>eK,createNullish:()=>PI,createNullishTransform:()=>$q,createNum:()=>rJ,createNumber:()=>cP,createNumeric:()=>jR,createObjectNode:()=>AH,createOct:()=>vR,createOnes:()=>fL,createOperatorNode:()=>NH,createOr:()=>II,createOrTransform:()=>Qq,createParenthesisNode:()=>FH,createParse:()=>WH,createParser:()=>QH,createParserClass:()=>YH,createPartitionSelect:()=>Yz,createPermutations:()=>eG,createPhi:()=>oK,createPi:()=>rK,createPickRandom:()=>pG,createPinv:()=>ZU,createPlanckCharge:()=>pq,createPlanckConstant:()=>bK,createPlanckLength:()=>uq,createPlanckMass:()=>dq,createPlanckTemperature:()=>mq,createPlanckTime:()=>fq,createPolynomialRoot:()=>EU,createPow:()=>FR,createPrint:()=>CR,createPrintTransform:()=>Xq,createProd:()=>fR,createProtonMass:()=>BK,createQr:()=>nU,createQuantileSeq:()=>kW,createQuantileSeqTransform:()=>Wq,createQuantumOfCirculation:()=>UK,createRandom:()=>gG,createRandomInt:()=>vG,createRange:()=>_L,createRangeClass:()=>IA,createRangeNode:()=>LH,createRangeTransform:()=>Fq,createRationalize:()=>WG,createRe:()=>AI,createReducedPlanckConstant:()=>xK,createRelationalNode:()=>zH,createReplacer:()=>XG,createReshape:()=>yL,createResize:()=>bL,createResolve:()=>RG,createResultSet:()=>gO,createReviver:()=>YG,createRightArithShift:()=>dz,createRightLogShift:()=>pz,createRotate:()=>SL,createRotationMatrix:()=>wL,createRound:()=>RR,createRow:()=>EL,createRowTransform:()=>Iq,createRydberg:()=>WK,createSQRT1_2:()=>dK,createSQRT2:()=>fK,createSackurTetrode:()=>rq,createSchur:()=>cW,createSec:()=>sV,createSech:()=>lV,createSecondRadiation:()=>iq,createSetCartesian:()=>vV,createSetDifference:()=>bV,createSetDistinct:()=>SV,createSetIntersect:()=>wV,createSetIsSubset:()=>EV,createSetMultiplicity:()=>OV,createSetPowerset:()=>AV,createSetSize:()=>MV,createSetSymDifference:()=>PV,createSetUnion:()=>IV,createSign:()=>qF,createSimplify:()=>PG,createSimplifyConstant:()=>FG,createSimplifyCore:()=>LG,createSin:()=>dV,createSinh:()=>pV,createSize:()=>OL,createSlu:()=>xU,createSmaller:()=>Mz,createSmallerEq:()=>Fz,createSolveODE:()=>$L,createSort:()=>Zz,createSpaClass:()=>oB,createSparse:()=>bB,createSparseMatrixClass:()=>rP,createSpeedOfLight:()=>vK,createSplitUnit:()=>EP,createSqrt:()=>JF,createSqrtm:()=>iW,createSquare:()=>XF,createSqueeze:()=>AL,createStd:()=>jW,createStdTransform:()=>Vq,createStefanBoltzmann:()=>aq,createStirlingS2:()=>bG,createString:()=>dP,createSubset:()=>ML,createSubsetTransform:()=>Lq,createSubtract:()=>QF,createSubtractScalar:()=>BP,createSum:()=>gW,createSumTransform:()=>Uq,createSylvester:()=>oW,createSymbolNode:()=>BH,createSymbolicEqual:()=>BG,createTan:()=>hV,createTanh:()=>gV,createTau:()=>iK,createThomsonCrossSection:()=>GK,createTo:()=>ER,createToBest:()=>OR,createTrace:()=>GV,createTranspose:()=>RL,createTrue:()=>QG,createTypeOf:()=>QN,createTyped:()=>dO,createUnaryMinus:()=>OP,createUnaryPlus:()=>AP,createUnequal:()=>Kz,createUnitClass:()=>gB,createUnitFunction:()=>vB,createUppercaseE:()=>hK,createUppercasePi:()=>mK,createUsolve:()=>tz,createUsolveAll:()=>az,createVacuumImpedance:()=>wK,createVariance:()=>DW,createVarianceTransform:()=>Jq,createVersion:()=>gK,createWeakMixingAngle:()=>KK,createWienDisplacement:()=>oq,createXgcd:()=>eI,createXor:()=>RI,createZeros:()=>HL,createZeta:()=>sR,createZpk2tf:()=>KG}),sJ=l(o(((e,t)=>{function n(){}n.prototype={on:function(e,t,n){var r=this.e||={};return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||={})[e]||[]).slice(),r=0,i=n.length;r<i;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||={},r=n[e],i=[];if(r&&t)for(var a=0,o=r.length;a<o;a++)r[a].fn!==t&&r[a].fn._!==t&&i.push(r[a]);return i.length?n[e]=i:delete n[e],this}},t.exports=n,t.exports.TinyEmitter=n}))(),1);function cJ(e){var t=new sJ.default;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}function lJ(e,t,n,r){function i(e,t){var n=arguments.length;if(n!==1&&n!==2)throw new wF(`import`,n,1,2);t||={};function r(e,n,i){if(Array.isArray(n))n.forEach(t=>r(e,t));else if(UE(n)||d(n))for(var a in n)SD(n,a)&&r(e,n[a],a);else if(AD(n)||i!==void 0){var o=AD(n)?h(n)?n.fn+`.transform`:n.fn:i;if(SD(e,o)&&e[o]!==n&&!t.silent)throw Error(`Cannot import "`+o+`" twice`);e[o]=n}else if(!t.silent)throw TypeError(`Factory, Object, or Array expected`)}var i={};for(var o in r(i,e),i)if(SD(i,o)){var s=i[o];if(AD(s))l(s,t);else if(u(s))a(o,s,t);else if(!t.silent)throw TypeError(`Factory, Object, or Array expected`)}}function a(t,i,a){if(a.wrap&&typeof i==`function`&&(i=c(i)),f(i)&&(i=e(t,{[i.signature]:i})),e.isTypedFunction(n[t])&&e.isTypedFunction(i)){i=a.override?e(t,i.signatures):e(n[t],i),n[t]=i,delete r[t],o(t,i),n.emit(`import`,t,function(){return i});return}var s=n[t]!==void 0,l=n.Unit?.isValuelessUnit(t);if(!s&&!l||a.override){n[t]=i,delete r[t],o(t,i),n.emit(`import`,t,function(){return i});return}if(!a.silent)throw Error(`Cannot import "`+t+`": already exists`)}function o(e,t){t&&typeof t.transform==`function`?(n.expression.transform[e]=t.transform,p(e)&&(n.expression.mathWithTransform[e]=t.transform)):(delete n.expression.transform[e],p(e)&&(n.expression.mathWithTransform[e]=t))}function s(e){delete n.expression.transform[e],p(e)?n.expression.mathWithTransform[e]=n[e]:delete n.expression.mathWithTransform[e]}function c(e){var t=function(){for(var t=[],r=0,i=arguments.length;r<i;r++){var a=arguments[r];t[r]=a&&a.valueOf()}return e.apply(n,t)};return e.transform&&(t.transform=e.transform),t}function l(t,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.fn;if(a.includes(`.`))throw Error(`Factory name should not contain a nested path. Name: `+JSON.stringify(a));var o=h(t)?n.expression.transform:n,c=a in n.expression.transform,l=SD(o,a)?o[a]:void 0,u=function(){var r={};t.dependencies.map(ND).forEach(e=>{if(e.includes(`.`))throw Error(`Factory dependency should not contain a nested path. Name: `+JSON.stringify(e));e===`math`?r.math=n:e===`mathWithTransform`?r.mathWithTransform=n.expression.mathWithTransform:e===`classes`?r.classes=n:r[e]=n[e]});var o=t(r);if(o&&typeof o.transform==`function`)throw Error(`Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"`);if(l===void 0||i.override)return o;if(e.isTypedFunction(l)&&e.isTypedFunction(o))return e(l,o);if(i.silent)return l;throw Error(`Cannot import "`+a+`": already exists`)},d=t.meta?.formerly??``,f=h(t)||m(t),p=n.expression.mathWithTransform;!t.meta||t.meta.lazy!==!1?(xD(o,a,u),d&&xD(o,d,u),l&&c?(s(a),d&&s(d)):f&&(xD(p,a,()=>o[a]),d&&xD(p,d,()=>o[a]))):(o[a]=u(),d&&(o[d]=o[a]),l&&c?(s(a),d&&s(d)):f&&(xD(p,a,()=>o[a]),d&&xD(p,d,()=>o[a]))),r[a]=t,n.emit(`import`,a,u)}function u(e){return typeof e==`function`||typeof e==`number`||typeof e==`string`||typeof e==`boolean`||e===null||OE(e)||EE(e)||wE(e)||DE(e)||jE(e)||Array.isArray(e)}function d(e){return typeof e==`object`&&e[Symbol.toStringTag]===`Module`}function f(e){return typeof e==`function`&&typeof e.signature==`string`}function p(e){return!SD(g,e)}function m(e){return!e.fn.includes(`.`)&&!SD(g,e.fn)&&(!e.meta||!e.meta.isClass)}function h(e){return e!==void 0&&e.meta!==void 0&&e.meta.isTransformFunction===!0||!1}var g={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return i}function uJ(e,t){var n=oE({},sE,t);if(typeof Object.create!=`function`)throw Error(`ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.`);var r=cJ({isNumber:CE,isComplex:EE,isBigNumber:wE,isBigInt:TE,isFraction:DE,isUnit:OE,isString:kE,isArray:AE,isMatrix:jE,isCollection:ME,isDenseMatrix:NE,isSparseMatrix:PE,isRange:FE,isIndex:IE,isBoolean:LE,isResultSet:RE,isHelp:zE,isFunction:BE,isDate:VE,isRegExp:HE,isObject:UE,isMap:WE,isPartitionedMap:GE,isObjectWrappingMap:KE,isNull:qE,isUndefined:JE,isAccessorNode:YE,isArrayNode:XE,isAssignmentNode:ZE,isBlockNode:QE,isConditionalNode:$E,isConstantNode:eD,isFunctionAssignmentNode:nD,isFunctionNode:rD,isIndexNode:iD,isNode:aD,isObjectNode:oD,isOperatorNode:sD,isParenthesisNode:cD,isRangeNode:lD,isRelationalNode:uD,isSymbolNode:dD,isChain:fD});r.config=DD(n,r.emit),r.expression={transform:{},mathWithTransform:{config:r.config}};var i=[],a=[];function o(e){if(AD(e))return e(r);var t=e[Object.keys(e)[0]];if(AD(t))return t(r);if(!CD(e))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",e),Error("Factory object with properties `type`, `name`, and `factory` expected");var s=i.indexOf(e),c;return s===-1?(c=e.math===!0?e.factory(r.type,n,o,r.typed,r):e.factory(r.type,n,o,r.typed),i.push(e),a.push(c)):c=a[s],c}var s={};function c(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.typed.apply(r.typed,t)}c.isTypedFunction=lO.default.isTypedFunction;var l=lJ(c,o,r,s);return r.import=l,r.on(`config`,()=>{Object.values(s).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&l(e,{override:!0})})}),r.create=uJ.bind(null,e),r.factory=Z,r.import(Object.values(yD(e))),r.ArgumentsError=wF,r.DimensionError=$A,r.IndexError=ej,r}function dJ(){return uJ(oJ,{})}var fJ=function(e){return e.DEV=`dev`,e.CANARY=`canary`,e.RELEASE=`release`,e}({}),pJ=class{api;internal;file;inputFieldParser;viewFieldParser;jsViewFieldParser;buttonParser;bindTargetParser;syntaxHighlighting;inputFieldFactory;viewFieldFactory;buttonActionRunner;buttonManager;metadataManager;mountableManager;math;build;constructor(){this.inputFieldParser=new RT(this),this.viewFieldParser=new JT(this),this.jsViewFieldParser=new zT(this),this.buttonParser=new cT(this),this.bindTargetParser=new z_(this),this.syntaxHighlighting=new Mt(this),this.inputFieldFactory=new $g(this),this.viewFieldFactory=new f_(this),this.buttonActionRunner=new Sn(this),this.buttonManager=new Tn(this),this.metadataManager=new F_,this.mountableManager=new I_,this.math=dJ(),this.build=`1.4.8`.includes(`canary`)?fJ.CANARY:fJ.RELEASE}setComponents(e){Object.assign(this,e)}setSettings(e){this.updateInternalSettings(e),this.saveSettings(e)}updateSettings(e){let t=this.getSettings();e(t),this.setSettings(t)}loadTemplates(){let e=this.getSettings(),t=this.inputFieldParser.parseTemplates(e.inputFieldTemplates);t.hasErrors()&&console.warn(`meta-bind | failed to parse input field templates`,t);let n=this.buttonManager.setButtonTemplates(e.buttonTemplates);n.hasErrors()&&console.warn(`meta-bind | failed to parse button templates`,n)}updateInternalSettings(e){uh.dateFormat=e.preferredDateFormat,tE(e.firstWeekday),this.loadTemplates()}destroy(){this.mountableManager.unload()}},mJ=class{id;manager;cache;constructor(e,t){this.id=e,this.manager=t,this.cache=new Map}validateStoragePath(e,t,n,r){return r.validateStoragePathAsFilePath(e,n)}resolveBindTargetScope(e,t,n){return e}getOrCreateCacheItem(e){let t=this.getCacheItemForStoragePath(e);return t===void 0&&(t=this.getDefaultCacheItem(e),this.cache.set(e,t)),t}subscribe(e){if(e.bindTarget===void 0)throw new L({errorLevel:P.CRITICAL,effect:`can not subscribe`,cause:`subscription bind target undefined`});let t=this.getOrCreateCacheItem(e.bindTarget.storagePath);return t.subscriptions.push(e),t}unsubscribe(e){if(e.bindTarget===void 0)throw new L({errorLevel:P.CRITICAL,effect:`can not unsubscribe`,cause:`subscription bind target undefined`});let t=this.cache.get(e.bindTarget.storagePath);if(t===void 0)throw new L({errorLevel:P.CRITICAL,effect:`can not unsubscribe`,cause:`cache item does not exist`});return t.subscriptions=t.subscriptions.filter(t=>t.uuid!==e.uuid),t}getCacheItemForStoragePath(e){return this.cache.get(e)}onCycle(e){}getCacheItems(){return Array.from(this.cache.values())}shouldDelete(e){return!0}deleteCache(e){this.cache.delete(e.storagePath)}writeCache(e,t){let n=this.getOrCreateCacheItem(t.storagePath);return j_.setAndCreate(n.data,t.storageProp,e),n}writeEntireCache(e,t){t.data=e}readCache(e){if(e.storageType!==this.id)throw new L({errorLevel:P.ERROR,effect:`can not read cache`,cause:`Source "${e.storageType}" does not match`});let t=this.getCacheItemForStoragePath(e.storagePath);return t===void 0?j_.tryGet(this.readExternal(e.storagePath),e.storageProp):this.readCacheItem(t,e.storageProp)}readCacheItem(e,t){return j_.tryGet(e.data,t)}readEntireCacheItem(e){return e.data}usesStoragePath(){return!0}},hJ=class extends mJ{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.constructDefaultCacheItem()}}syncExternal(e){return Promise.resolve()}},gJ=class{id;manager;cache;constructor(e,t){this.id=e,this.manager=t,this.cache={data:{},...this.manager.constructDefaultCacheItem()}}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,t,n,r){if(t)throw new le(P.ERROR,`Bind target validator`,`Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.`,n,e.position);return``}deleteCache(e){}getCacheItemForStoragePath(e){return this.cache}getCacheItems(){return[this.cache]}onCycle(e){}readCache(e){return this.readCacheItem(this.cache,e.storageProp)}readCacheItem(e,t){return j_.tryGet(e.data,t)}shouldDelete(e){return!1}subscribe(e){return this.cache.subscriptions.push(e),this.cache}syncExternal(e){return Promise.resolve()}unsubscribe(e){return this.cache.subscriptions=this.cache.subscriptions.filter(t=>t.uuid!==e.uuid),this.cache}writeCache(e,t){return j_.setAndCreate(this.cache.data,t.storageProp,e),this.cache}writeEntireCache(e,t){t.data=e}readEntireCacheItem(e){return e.data}usesStoragePath(){return!1}},_J=class{id;manager;constructor(e,t){this.id=e,this.manager=t}getOrCreateCacheItem(e){throw new L({errorLevel:P.CRITICAL,effect:`action not permitted`,cause:`source 'scope' should have no cache items or subscriptions`})}validateStoragePath(e,t,n,r){if(t)throw new le(P.ERROR,`Bind Target Validator`,`Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.`,n,e.position);return``}deleteCache(e){}getCacheItemForStoragePath(e){}getCacheItems(){return[]}onCycle(e){}readCache(e){}readCacheItem(e,t){}shouldDelete(e){return!0}subscribe(e){throw new L({errorLevel:P.CRITICAL,effect:`action not permitted`,cause:`source 'scope' should have no cache items or subscriptions`})}syncExternal(e){return Promise.resolve()}unsubscribe(e){throw new L({errorLevel:P.CRITICAL,effect:`action not permitted`,cause:`source 'scope' should have no cache items or subscriptions`})}writeCache(e,t){throw new L({errorLevel:P.CRITICAL,effect:`action not permitted`,cause:`source 'scope' should have no cache items or subscriptions`})}writeEntireCache(e,t){}readEntireCacheItem(e){throw new L({errorLevel:P.CRITICAL,effect:`action not permitted`,cause:`source 'scope' should have no cache items or subscriptions`})}usesStoragePath(){return!1}};function vJ(e){var t=e.statementIndent,n=e.jsonld,r=e.json||n,i=e.typescript,a=e.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function e(e){return{type:e,style:`keyword`}}var t=e(`keyword a`),n=e(`keyword b`),r=e(`keyword c`),i=e(`keyword d`),a=e(`operator`),o={type:`atom`,style:`atom`};return{if:e(`if`),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:e(`new`),delete:r,void:r,throw:r,debugger:e(`debugger`),var:e(`var`),const:e(`var`),let:e(`var`),function:e(`function`),catch:e(`catch`),for:e(`for`),switch:e(`switch`),case:e(`case`),default:e(`default`),in:a,typeof:a,instanceof:a,true:o,false:o,null:o,undefined:o,NaN:o,Infinity:o,this:e(`this`),class:e(`class`),super:e(`atom`),yield:r,export:e(`export`),import:e(`import`),extends:r,await:r}}(),s=/[+\-*&%=<>!?|~^@]/,c=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function l(e){for(var t=!1,n,r=!1;(n=e.next())!=null;){if(!t){if(n==`/`&&!r)return;n==`[`?r=!0:r&&n==`]`&&(r=!1)}t=!t&&n==`\\`}}var u,d;function f(e,t,n){return u=e,d=n,t}function p(e,t){var n=e.next();if(n==`"`||n==`'`)return t.tokenize=m(n),t.tokenize(e,t);if(n==`.`&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return f(`number`,`number`);if(n==`.`&&e.match(`..`))return f(`spread`,`meta`);if(/[\[\]{}\(\),;\:\.]/.test(n))return f(n);if(n==`=`&&e.eat(`>`))return f(`=>`,`operator`);if(n==`0`&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return f(`number`,`number`);if(/\d/.test(n))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),f(`number`,`number`);if(n==`/`)return e.eat(`*`)?(t.tokenize=h,h(e,t)):e.eat(`/`)?(e.skipToEnd(),f(`comment`,`comment`)):mt(e,t,1)?(l(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),f(`regexp`,`string.special`)):(e.eat(`=`),f(`operator`,`operator`,e.current()));if(n=="`")return t.tokenize=g,g(e,t);if(n==`#`&&e.peek()==`!`)return e.skipToEnd(),f(`meta`,`meta`);if(n==`#`&&e.eatWhile(a))return f(`variable`,`property`);if(n==`<`&&e.match(`!--`)||n==`-`&&e.match(`->`)&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),f(`comment`,`comment`);if(s.test(n))return(n!=`>`||!t.lexical||t.lexical.type!=`>`)&&(e.eat(`=`)?(n==`!`||n==`=`)&&e.eat(`=`):/[<>*+\-|&?]/.test(n)&&(e.eat(n),n==`>`&&e.eat(n))),n==`?`&&e.eat(`.`)?f(`.`):f(`operator`,`operator`,e.current());if(a.test(n)){e.eatWhile(a);var r=e.current();if(t.lastType!=`.`){if(o.propertyIsEnumerable(r)){var i=o[r];return f(i.type,i.style,r)}if(r==`async`&&e.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return f(`async`,`keyword`,r)}return f(`variable`,`variable`,r)}}function m(e){return function(t,r){var i=!1,a;if(n&&t.peek()==`@`&&t.match(c))return r.tokenize=p,f(`jsonld-keyword`,`meta`);for(;(a=t.next())!=null&&!(a==e&&!i);)i=!i&&a==`\\`;return i||(r.tokenize=p),f(`string`,`string`)}}function h(e,t){for(var n=!1,r;r=e.next();){if(r==`/`&&n){t.tokenize=p;break}n=r==`*`}return f(`comment`,`comment`)}function g(e,t){for(var n=!1,r;(r=e.next())!=null;){if(!n&&(r=="`"||r==`$`&&e.eat(`{`))){t.tokenize=p;break}n=!n&&r==`\\`}return f(`quasi`,`string.special`,e.current())}var _=`([{}])`;function v(e,t){t.fatArrowAt&&=null;var n=e.string.indexOf(`=>`,e.start);if(!(n<0)){if(i){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n));r&&(n=r.index)}for(var o=0,s=!1,c=n-1;c>=0;--c){var l=e.string.charAt(c),u=_.indexOf(l);if(u>=0&&u<3){if(!o){++c;break}if(--o==0){l==`(`&&(s=!0);break}}else if(u>=3&&u<6)++o;else if(a.test(l))s=!0;else if(/["'\/`]/.test(l))for(;;--c){if(c==0)return;if(e.string.charAt(c-1)==l&&e.string.charAt(c-2)!=`\\`){c--;break}}else if(s&&!o){++c;break}}s&&!o&&(t.fatArrowAt=c)}}var y={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function b(e,t,n,r,i,a){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=a,r!=null&&(this.align=r)}function x(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function S(e,t,n,i,a){var o=e.cc;for(C.state=e,C.stream=a,C.marked=null,C.cc=o,C.style=t,e.lexical.hasOwnProperty(`align`)||(e.lexical.align=!0);;)if((o.length?o.pop():r?z:R)(n,i)){for(;o.length&&o[o.length-1].lex;)o.pop()();return C.marked?C.marked:n==`variable`&&x(e,i)?`variableName.local`:t}}var C={state:null,column:null,marked:null,cc:null};function w(){for(var e=arguments.length-1;e>=0;e--)C.cc.push(arguments[e])}function T(){return w.apply(null,arguments),!0}function E(e,t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}function D(t){var n=C.state;if(C.marked=`def`,n.context){if(n.lexical.info==`var`&&n.context&&n.context.block){var r=O(t,n.context);if(r!=null){n.context=r;return}}else if(!E(t,n.localVars)){n.localVars=new j(t,n.localVars);return}}e.globalVars&&!E(t,n.globalVars)&&(n.globalVars=new j(t,n.globalVars))}function O(e,t){if(!t)return null;if(t.block){var n=O(e,t.prev);return n?n==t.prev?t:new A(n,t.vars,!0):null}else if(E(e,t.vars))return t;else return new A(t.prev,new j(e,t.vars),!1)}function k(e){return e==`public`||e==`private`||e==`protected`||e==`abstract`||e==`readonly`}function A(e,t,n){this.prev=e,this.vars=t,this.block=n}function j(e,t){this.name=e,this.next=t}var M=new j(`this`,new j(`arguments`,null));function N(){C.state.context=new A(C.state.context,C.state.localVars,!1),C.state.localVars=M}function P(){C.state.context=new A(C.state.context,C.state.localVars,!0),C.state.localVars=null}N.lex=P.lex=!0;function F(){C.state.localVars=C.state.context.vars,C.state.context=C.state.context.prev}F.lex=!0;function I(e,t){var n=function(){var n=C.state,r=n.indented;if(n.lexical.type==`stat`)r=n.lexical.indented;else for(var i=n.lexical;i&&i.type==`)`&&i.align;i=i.prev)r=i.indented;n.lexical=new b(r,C.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function L(){var e=C.state;e.lexical.prev&&(e.lexical.type==`)`&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}L.lex=!0;function ee(e){function t(n){return n==e?T():e==`;`||n==`}`||n==`)`||n==`]`?w():T(t)}return t}function R(e,t){return e==`var`?T(I(`vardef`,t),Re,ee(`;`),L):e==`keyword a`?T(I(`form`),re,R,L):e==`keyword b`?T(I(`form`),R,L):e==`keyword d`?C.stream.match(/^\s*$/,!1)?T():T(I(`stat`),ae,ee(`;`),L):e==`debugger`?T(ee(`;`)):e==`{`?T(I(`}`),P,Se,L,F):e==`;`?T():e==`if`?(C.state.lexical.info==`else`&&C.state.cc[C.state.cc.length-1]==L&&C.state.cc.pop()(),T(I(`form`),re,R,L,We)):e==`function`?T(Je):e==`for`?T(I(`form`),P,Ge,R,F,L):e==`class`||i&&t==`interface`?(C.marked=`keyword`,T(I(`form`,e==`class`?e:t),$e,L)):e==`variable`?i&&t==`declare`?(C.marked=`keyword`,T(R)):i&&(t==`module`||t==`enum`||t==`type`)&&C.stream.match(/^\s*\w/,!1)?(C.marked=`keyword`,t==`enum`?T(dt):t==`type`?T(Xe,ee(`operator`),De,ee(`;`)):T(I(`form`),ze,ee(`{`),I(`}`),Se,L,L)):i&&t==`namespace`?(C.marked=`keyword`,T(I(`form`),z,R,L)):i&&t==`abstract`?(C.marked=`keyword`,T(R)):T(I(`stat`),he):e==`switch`?T(I(`form`),re,ee(`{`),I(`}`,`switch`),P,Se,L,L,F):e==`case`?T(z,ee(`:`)):e==`default`?T(ee(`:`)):e==`catch`?T(I(`form`),N,te,R,L,F):e==`export`?T(I(`stat`),rt,L):e==`import`?T(I(`stat`),at,L):e==`async`?T(R):t==`@`?T(z,R):w(I(`stat`),z,ee(`;`),L)}function te(e){if(e==`(`)return T(Ze,ee(`)`))}function z(e,t){return ie(e,t,!1)}function ne(e,t){return ie(e,t,!0)}function re(e){return e==`(`?T(I(`)`),ae,ee(`)`),L):w()}function ie(e,t,n){if(C.state.fatArrowAt==C.stream.start){var r=n?de:ue;if(e==`(`)return T(N,I(`)`),be(Ze,`)`),L,ee(`=>`),r,F);if(e==`variable`)return w(N,ze,ee(`=>`),r,F)}var a=n?se:oe;return y.hasOwnProperty(e)?T(a):e==`function`?T(Je,a):e==`class`||i&&t==`interface`?(C.marked=`keyword`,T(I(`form`),Qe,L)):e==`keyword c`||e==`async`?T(n?ne:z):e==`(`?T(I(`)`),ae,ee(`)`),L,a):e==`operator`||e==`spread`?T(n?ne:z):e==`[`?T(I(`]`),ut,L,a):e==`{`?xe(_e,`}`,null,a):e==`quasi`?w(ce,a):e==`new`?T(fe(n)):T()}function ae(e){return e.match(/[;\}\)\],]/)?w():w(z)}function oe(e,t){return e==`,`?T(ae):se(e,t,!1)}function se(e,t,n){var r=n==0?oe:se,a=n==0?z:ne;if(e==`=>`)return T(N,n?de:ue,F);if(e==`operator`)return/\+\+|--/.test(t)||i&&t==`!`?T(r):i&&t==`<`&&C.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?T(I(`>`),be(De,`>`),L,r):t==`?`?T(z,ee(`:`),a):T(a);if(e==`quasi`)return w(ce,r);if(e!=`;`){if(e==`(`)return xe(ne,`)`,`call`,r);if(e==`.`)return T(ge,r);if(e==`[`)return T(I(`]`),ae,ee(`]`),L,r);if(i&&t==`as`)return C.marked=`keyword`,T(De,r);if(e==`regexp`)return C.state.lastType=C.marked=`operator`,C.stream.backUp(C.stream.pos-C.stream.start-1),T(a)}}function ce(e,t){return e==`quasi`?t.slice(t.length-2)=="${"?T(ae,le):T(ce):w()}function le(e){if(e==`}`)return C.marked=`string.special`,C.state.tokenize=g,T(ce)}function ue(e){return v(C.stream,C.state),w(e==`{`?R:z)}function de(e){return v(C.stream,C.state),w(e==`{`?R:ne)}function fe(e){return function(t){return t==`.`?T(e?me:pe):t==`variable`&&i?T(Fe,e?se:oe):w(e?ne:z)}}function pe(e,t){if(t==`target`)return C.marked=`keyword`,T(oe)}function me(e,t){if(t==`target`)return C.marked=`keyword`,T(se)}function he(e){return e==`:`?T(L,R):w(oe,ee(`;`),L)}function ge(e){if(e==`variable`)return C.marked=`property`,T()}function _e(e,t){if(e==`async`)return C.marked=`property`,T(_e);if(e==`variable`||C.style==`keyword`){if(C.marked=`property`,t==`get`||t==`set`)return T(ve);var r;return i&&C.state.fatArrowAt==C.stream.start&&(r=C.stream.match(/^\s*:\s*/,!1))&&(C.state.fatArrowAt=C.stream.pos+r[0].length),T(ye)}else if(e==`number`||e==`string`)return C.marked=n?`property`:C.style+` property`,T(ye);else if(e==`jsonld-keyword`)return T(ye);else if(i&&k(t))return C.marked=`keyword`,T(_e);else if(e==`[`)return T(z,Ce,ee(`]`),ye);else if(e==`spread`)return T(ne,ye);else if(t==`*`)return C.marked=`keyword`,T(_e);else if(e==`:`)return w(ye)}function ve(e){return e==`variable`?(C.marked=`property`,T(Je)):w(ye)}function ye(e){if(e==`:`)return T(ne);if(e==`(`)return w(Je)}function be(e,t,n){function r(i,a){if(n?n.indexOf(i)>-1:i==`,`){var o=C.state.lexical;return o.info==`call`&&(o.pos=(o.pos||0)+1),T(function(n,r){return n==t||r==t?w():w(e)},r)}return i==t||a==t?T():n&&n.indexOf(`;`)>-1?w(e):T(ee(t))}return function(n,i){return n==t||i==t?T():w(e,r)}}function xe(e,t,n){for(var r=3;r<arguments.length;r++)C.cc.push(arguments[r]);return T(I(t,n),be(e,t),L)}function Se(e){return e==`}`?T():w(R,Se)}function Ce(e,t){if(i){if(e==`:`)return T(De);if(t==`?`)return T(Ce)}}function we(e,t){if(i&&(e==`:`||t==`in`))return T(De)}function Te(e){if(i&&e==`:`)return C.stream.match(/^\s*\w+\s+is\b/,!1)?T(z,Ee,De):T(De)}function Ee(e,t){if(t==`is`)return C.marked=`keyword`,T()}function De(e,t){if(t==`keyof`||t==`typeof`||t==`infer`||t==`readonly`)return C.marked=`keyword`,T(t==`typeof`?ne:De);if(e==`variable`||t==`void`)return C.marked=`type`,T(Pe);if(t==`|`||t==`&`)return T(De);if(e==`string`||e==`number`||e==`atom`)return T(Pe);if(e==`[`)return T(I(`]`),be(De,`]`,`,`),L,Pe);if(e==`{`)return T(I(`}`),ke,L,Pe);if(e==`(`)return T(be(Ne,`)`),Oe,Pe);if(e==`<`)return T(be(De,`>`),De);if(e==`quasi`)return w(je,Pe)}function Oe(e){if(e==`=>`)return T(De)}function ke(e){return e.match(/[\}\)\]]/)?T():e==`,`||e==`;`?T(ke):w(Ae,ke)}function Ae(e,t){if(e==`variable`||C.style==`keyword`)return C.marked=`property`,T(Ae);if(t==`?`||e==`number`||e==`string`)return T(Ae);if(e==`:`)return T(De);if(e==`[`)return T(ee(`variable`),we,ee(`]`),Ae);if(e==`(`)return w(Ye,Ae);if(!e.match(/[;\}\)\],]/))return T()}function je(e,t){return e==`quasi`?t.slice(t.length-2)=="${"?T(De,Me):T(je):w()}function Me(e){if(e==`}`)return C.marked=`string.special`,C.state.tokenize=g,T(je)}function Ne(e,t){return e==`variable`&&C.stream.match(/^\s*[?:]/,!1)||t==`?`?T(Ne):e==`:`?T(De):e==`spread`?T(Ne):w(De)}function Pe(e,t){if(t==`<`)return T(I(`>`),be(De,`>`),L,Pe);if(t==`|`||e==`.`||t==`&`)return T(De);if(e==`[`)return T(De,ee(`]`),Pe);if(t==`extends`||t==`implements`)return C.marked=`keyword`,T(De);if(t==`?`)return T(De,ee(`:`),De)}function Fe(e,t){if(t==`<`)return T(I(`>`),be(De,`>`),L,Pe)}function Ie(){return w(De,Le)}function Le(e,t){if(t==`=`)return T(De)}function Re(e,t){return t==`enum`?(C.marked=`keyword`,T(dt)):w(ze,Ce,He,Ue)}function ze(e,t){if(i&&k(t))return C.marked=`keyword`,T(ze);if(e==`variable`)return D(t),T();if(e==`spread`)return T(ze);if(e==`[`)return xe(Ve,`]`);if(e==`{`)return xe(Be,`}`)}function Be(e,t){return e==`variable`&&!C.stream.match(/^\s*:/,!1)?(D(t),T(He)):(e==`variable`&&(C.marked=`property`),e==`spread`?T(ze):e==`}`?w():e==`[`?T(z,ee(`]`),ee(`:`),Be):T(ee(`:`),ze,He))}function Ve(){return w(ze,He)}function He(e,t){if(t==`=`)return T(ne)}function Ue(e){if(e==`,`)return T(Re)}function We(e,t){if(e==`keyword b`&&t==`else`)return T(I(`form`,`else`),R,L)}function Ge(e,t){if(t==`await`)return T(Ge);if(e==`(`)return T(I(`)`),Ke,L)}function Ke(e){return e==`var`?T(Re,qe):e==`variable`?T(qe):w(qe)}function qe(e,t){return e==`)`?T():e==`;`?T(qe):t==`in`||t==`of`?(C.marked=`keyword`,T(z,qe)):w(z,qe)}function Je(e,t){if(t==`*`)return C.marked=`keyword`,T(Je);if(e==`variable`)return D(t),T(Je);if(e==`(`)return T(N,I(`)`),be(Ze,`)`),L,Te,R,F);if(i&&t==`<`)return T(I(`>`),be(Ie,`>`),L,Je)}function Ye(e,t){if(t==`*`)return C.marked=`keyword`,T(Ye);if(e==`variable`)return D(t),T(Ye);if(e==`(`)return T(N,I(`)`),be(Ze,`)`),L,Te,F);if(i&&t==`<`)return T(I(`>`),be(Ie,`>`),L,Ye)}function Xe(e,t){if(e==`keyword`||e==`variable`)return C.marked=`type`,T(Xe);if(t==`<`)return T(I(`>`),be(Ie,`>`),L)}function Ze(e,t){return t==`@`&&T(z,Ze),e==`spread`?T(Ze):i&&k(t)?(C.marked=`keyword`,T(Ze)):i&&e==`this`?T(Ce,He):w(ze,Ce,He)}function Qe(e,t){return e==`variable`?$e(e,t):et(e,t)}function $e(e,t){if(e==`variable`)return D(t),T(et)}function et(e,t){if(t==`<`)return T(I(`>`),be(Ie,`>`),L,et);if(t==`extends`||t==`implements`||i&&e==`,`)return t==`implements`&&(C.marked=`keyword`),T(i?De:z,et);if(e==`{`)return T(I(`}`),tt,L)}function tt(e,t){if(e==`async`||e==`variable`&&(t==`static`||t==`get`||t==`set`||i&&k(t))&&C.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return C.marked=`keyword`,T(tt);if(e==`variable`||C.style==`keyword`)return C.marked=`property`,T(nt,tt);if(e==`number`||e==`string`)return T(nt,tt);if(e==`[`)return T(z,Ce,ee(`]`),nt,tt);if(t==`*`)return C.marked=`keyword`,T(tt);if(i&&e==`(`)return w(Ye,tt);if(e==`;`||e==`,`)return T(tt);if(e==`}`)return T();if(t==`@`)return T(z,tt)}function nt(e,t){if(t==`!`||t==`?`)return T(nt);if(e==`:`)return T(De,He);if(t==`=`)return T(ne);var n=C.state.lexical.prev;return w(n&&n.info==`interface`?Ye:Je)}function rt(e,t){return t==`*`?(C.marked=`keyword`,T(lt,ee(`;`))):t==`default`?(C.marked=`keyword`,T(z,ee(`;`))):e==`{`?T(be(it,`}`),lt,ee(`;`)):w(R)}function it(e,t){if(t==`as`)return C.marked=`keyword`,T(ee(`variable`));if(e==`variable`)return w(ne,it)}function at(e){return e==`string`?T():e==`(`?w(z):e==`.`?w(oe):w(ot,st,lt)}function ot(e,t){return e==`{`?xe(ot,`}`):(e==`variable`&&D(t),t==`*`&&(C.marked=`keyword`),T(ct))}function st(e){if(e==`,`)return T(ot,st)}function ct(e,t){if(t==`as`)return C.marked=`keyword`,T(ot)}function lt(e,t){if(t==`from`)return C.marked=`keyword`,T(z)}function ut(e){return e==`]`?T():w(be(ne,`]`))}function dt(){return w(I(`form`),ze,ee(`{`),I(`}`),be(ft,`}`),L,L)}function ft(){return w(ze,He)}function pt(e,t){return e.lastType==`operator`||e.lastType==`,`||s.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}function mt(e,t,n){return t.tokenize==p&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||t.lastType==`quasi`&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}return{name:e.name,startState:function(t){var n={tokenize:p,lastType:`sof`,cc:[],lexical:new b(-t,0,`block`,!1),localVars:e.localVars,context:e.localVars&&new A(null,null,!1),indented:0};return e.globalVars&&typeof e.globalVars==`object`&&(n.globalVars=e.globalVars),n},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty(`align`)||(t.lexical.align=!1),t.indented=e.indentation(),v(e,t)),t.tokenize!=h&&e.eatSpace())return null;var n=t.tokenize(e,t);return u==`comment`?n:(t.lastType=u==`operator`&&(d==`++`||d==`--`)?`incdec`:u,S(t,n,u,d,e))},indent:function(n,r,i){if(n.tokenize==h||n.tokenize==g)return null;if(n.tokenize!=p)return 0;var a=r&&r.charAt(0),o=n.lexical,s;if(!/^\s*else\b/.test(r))for(var c=n.cc.length-1;c>=0;--c){var l=n.cc[c];if(l==L)o=o.prev;else if(l!=We&&l!=F)break}for(;(o.type==`stat`||o.type==`form`)&&(a==`}`||(s=n.cc[n.cc.length-1])&&(s==oe||s==se)&&!/^[,\.=+\-*:?[\(]/.test(r));)o=o.prev;t&&o.type==`)`&&o.prev.type==`stat`&&(o=o.prev);var u=o.type,d=a==u;return u==`vardef`?o.indented+(n.lastType==`operator`||n.lastType==`,`?o.info.length+1:0):u==`form`&&a==`{`?o.indented:u==`form`?o.indented+i.unit:u==`stat`?o.indented+(pt(n,r)?t||i.unit:0):o.info==`switch`&&!d&&e.doubleIndentSwitch!=0?o.indented+(/^(?:case|default)\b/.test(r)?i.unit:2*i.unit):o.align?o.column+ +!d:o.indented+(d?0:i.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:r?void 0:{line:`//`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},wordChars:`$`}}}var yJ=vJ({name:`javascript`});vJ({name:`json`,json:!0}),vJ({name:`json`,jsonld:!0}),vJ({name:`typescript`,typescript:!0});var bJ=RegExp(`\\b((`+[`true`,`false`,`on`,`off`,`yes`,`no`].join(`)|(`)+`))$`,`i`),xJ={name:`yaml`,token:function(e,t){var n=e.peek(),r=t.escaped;if(t.escaped=!1,n==`#`&&(e.pos==0||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),`comment`;if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return`string`;if(t.literal&&e.indentation()>t.keyCol)return e.skipToEnd(),`string`;if(t.literal&&=!1,e.sol()){if(t.keyCol=0,t.pair=!1,t.pairStart=!1,e.match(`---`)||e.match(`...`))return`def`;if(e.match(/^\s*-\s+/))return`meta`}if(e.match(/^(\{|\}|\[|\])/))return n==`{`?t.inlinePairs++:n==`}`?t.inlinePairs--:n==`[`?t.inlineList++:t.inlineList--,`meta`;if(t.inlineList>0&&!r&&n==`,`)return e.next(),`meta`;if(t.inlinePairs>0&&!r&&n==`,`)return t.keyCol=0,t.pair=!1,t.pairStart=!1,e.next(),`meta`;if(t.pairStart){if(e.match(/^\s*(\||\>)\s*/))return t.literal=!0,`meta`;if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return`variable`;if(t.inlinePairs==0&&e.match(/^\s*-?[0-9\.\,]+\s?$/)||t.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return`number`;if(e.match(bJ))return`keyword`}return!t.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(t.pair=!0,t.keyCol=e.indentation(),`atom`):t.pair&&e.match(/^:\s*/)?(t.pairStart=!0,`meta`):(t.pairStart=!1,t.escaped=n==`\\`,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:`#`}}};function SJ(e){if(!e.getSettings().enableSyntaxHighlighting)return;window.CodeMirror.defineMode(`meta-bind-button`,e=>({startState:()=>xJ.startState?.(4),blankLine:e=>xJ.blankLine?.(e,4),copyState:e=>xJ.startState?.(4),token:(e,t)=>`line-HyperMD-codeblock ${xJ.token?.(e,t)}`})),window.CodeMirror.defineMode(`meta-bind-js-view`,e=>({startState:()=>yJ.startState?.(4),blankLine:e=>yJ.blankLine?.(e,4),copyState:e=>yJ.startState?.(4),token:(e,t)=>`line-HyperMD-codeblock ${yJ.token?.(e,t)}`}));let t=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode(`meta-bind`,n=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(n,r)=>{if(r.str===void 0){let i=[n.string],a=1,o=n.lookAhead(a);for(;o!==void 0&&!t.test(o)&&(i.push(o),a+=1,o=n.lookAhead(a),!(a>100)););r.str=i.filter(e=>e.trim()!==``).join(`
`);let s=e.api.isInlineFieldDeclarationAndGetType(r.str.trim());s===void 0?r.highlights=new mt(r.str,[]):(r.fieldType=s,r.highlights=e.syntaxHighlighting.highlight(r.str,r.fieldType,!0))}let i=r.highlights.getHighlights().map(e=>({highlight:e,from:g(r.str,e.range.from),to:g(r.str,e.range.to)})).filter(e=>e.from.line===r.line).find(e=>e.from.column===n.pos+1);return i===void 0?(n.next(),n.eol()&&(r.line+=1),`line-HyperMD-codeblock`):(n.eatWhile(()=>i.to.line===r.line?n.pos+1<i.to.column:!n.eol())||n.next(),n.eol()&&(r.line+=1),`line-HyperMD-codeblock mb-highlight-${i.highlight.tokenClass}`)}}))}var CJ=function(e){return e.FIELD=`field`,e.HIGHLIGHT=`highlight`,e}({}),wJ=class{static checkSelectionOverlap(e,t,n){if(!e)return!1;for(let r of e.ranges)if(r.to>=t&&r.from<=n)return!0;return!1}static checkRangeOverlap(e,t,n,r){return e<=r&&n<=t}static getContent(e,t,n){return e.sliceDoc(t,n)}static getCurrentFile(e){return e.state.field(u.editorInfoField).file}static existsDecorationBetween(e,t,n){let r=!1;return e.between(t,n,()=>{r=!0}),r}static existsDecorationOfTypeBetween(e,t,n,r){let i=!1;return e.between(n,r,(e,n,r)=>{r.spec.mb_widgetType===t&&(i=!0)}),i}};function TJ(e){return f.ViewPlugin.fromClass(class{decorations;component;constructor(e){this.component=new u.Component,this.component.load(),this.decorations=this.renderWidgets(e)??f.Decoration.none,e.dom.addEventListener(`click`,e=>this.handleClick(e))}handleClick(e){if(e.target instanceof HTMLElement){let t=e.target;for(;t!==null;){if(t.classList.contains(`mb-input`)){e.stopPropagation();break}t=t.parentElement}}}isLivePreview(e){return e.field(u.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(t,n,r)=>b_(e.visibleRanges,e=>wJ.checkRangeOverlap(t,n,e.from,e.to))?!0:(r.spec.mb_unload?.(),!1)});for(let{from:t,to:n}of e.visibleRanges)(0,d.syntaxTree)(e.state).iterate({from:t,to:n,enter:t=>{let n=t.node,r=this.getRenderInfo(e,n);if(!r.data)return;if(!r.data.widgetType){this.removeDecoration(n);return}let i=r.data;r.shouldRender?(this.removeDecoration(n,CJ.FIELD),this.addDecoration(n,e,CJ.FIELD,i)):r.shouldHighlight?(this.removeDecoration(n),this.addDecoration(n,e,CJ.HIGHLIGHT,i)):this.removeDecoration(n)}})}removeDecoration(e,t){this.decorations=this.decorations.update({filterFrom:e.from-1,filterTo:e.to+1,filter:(e,n,r)=>{let i=r.spec;return!i.mb_widgetType||t&&i.mb_widgetType===t?!0:(i.mb_unload?.(),!1)}})}addDecoration(e,t,n,r){if(wJ.existsDecorationOfTypeBetween(this.decorations,n,e.from,e.to))return;let i=wJ.getCurrentFile(t);if(!i)return;let a=this.renderWidget(e,n,r,i),o=Array.isArray(a)?a:[a];o.length!==0&&(this.decorations=this.decorations.update({add:o}))}getRenderInfo(t,n){let r=new Set(n.type.name?.split(`_`));if(r.has(`inline-code`)&&!r.has(`formatting`)){let r=this.readNode(t,n.from,n.to);if(!r.trulyInline)return{shouldRender:!1,shouldHighlight:!1,data:void 0};let i=wJ.checkSelectionOverlap(t.state.selection,n.from,n.to),a=this.isLivePreview(t.state),o=!i&&a;return{shouldRender:o,shouldHighlight:!o&&e.getSettings().enableSyntaxHighlighting,data:r}}return{shouldRender:!1,shouldHighlight:!1,data:void 0}}readNode(t,n,r){let i=!1;try{let e=wJ.getContent(t.state,n-1,r+1);i=e.startsWith("`")&&e.endsWith("`")}catch{}let a=wJ.getContent(t.state,n,r);return{content:a,widgetType:e.api.isInlineFieldDeclarationAndGetType(a),trulyInline:i}}renderWidgets(e){let t=wJ.getCurrentFile(e);if(!t)return;let n=[];for(let r of e.visibleRanges)(0,d.syntaxTree)(e.state).iterate({from:r.from,to:r.to,enter:r=>{let i=r.node,a=this.getRenderInfo(e,i);if(!a.data?.widgetType)return;let o=a.data,s;a.shouldRender?s=this.renderWidget(i,CJ.FIELD,o,t):a.shouldHighlight&&(s=this.renderWidget(i,CJ.HIGHLIGHT,o,t)),s&&(Array.isArray(s)?n.push(...s):n.push(s))}});return f.Decoration.set(n,!0)}renderWidget(t,n,r,i){if(n===CJ.FIELD){let n=e.api.constructMDRCWidget(r.widgetType,r.content,i.path,this.component);return f.Decoration.replace({widget:n,mb_widgetType:CJ.FIELD,mb_unload:()=>{n.renderChild?.unload()}}).range(t.from-1,t.to+1)}else return e.syntaxHighlighting.highlight(r.content,r.widgetType,!1).getHighlights().map(e=>f.Decoration.mark({class:`mb-highlight-${e.tokenClass}`,mb_widgetType:CJ.HIGHLIGHT}).range(t.from+e.range.from,t.from+e.range.to))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var EJ=_.sequenceMap((e,t,n,r)=>new DJ(parseInt(e),parseInt(t),parseInt(n),r),w.digits().skip(_.string(`.`)),w.digits().skip(_.string(`.`)),w.digits(),_.string(`-`).then(w.remaining()).optional()),DJ=class e{major;minor;patch;prerelease;constructor(e,t,n,r){this.major=e,this.minor=t,this.patch=n,this.prerelease=r}static fromString(e){return se(EJ,e)}static lessThan(e,t){return e.major<t.major?!0:e.major>t.major?!1:e.minor<t.minor?!0:e.minor>t.minor?!1:e.patch<t.patch?!0:e.patch>t.patch||e.prerelease===void 0?!1:t.prerelease===void 0?!0:e.prerelease<t.prerelease}static greaterThan(t,n){return e.lessThan(n,t)}static equals(e,t){return e.major===t.major&&e.minor===t.minor&&e.patch===t.patch&&e.prerelease===t.prerelease}toString(){return`${this.major}.${this.minor}.${this.patch}${this.prerelease===void 0?``:`-${this.prerelease}`}`}},OJ=class{mb;dependencies;constructor(e,t){this.mb=e,this.dependencies=t}getDependency(e){let t=this.dependencies.find(t=>t.pluginId===e);if(t===void 0)throw new oe({errorLevel:P.CRITICAL,effect:`Dependency violation detected`,cause:`Attempted to access dependency ${e} which is not a listed dependency. Please report this error.`});return t}getPlugin(e){return this.mb.app.plugins.getPlugin(e)}throwPluginNotFound(e){this.throwDependencyError(`Plugin ${e} is required, but not installed. Please install the plugin.`)}throwDependencyError(e){throw new u.Notice(`meta-bind | Dependency Error: ${e}`,0),new oe({errorLevel:P.ERROR,effect:`Dependency violation detected`,cause:e})}checkDependencyVersion(e,t){DJ.lessThan(t,e.minVersion)&&this.throwDependencyError(`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${t}. Please update the plugin.`),e.maxVersion!==void 0&&(DJ.greaterThan(t,e.maxVersion)||DJ.equals(t,e.maxVersion))&&this.throwDependencyError(`Plugin ${e.pluginId} is too new. Required version is lower than ${e.maxVersion}, installed version is ${t}. Please downgrade the plugin.`)}checkDependency(e){let t=this.getDependency(e),n=this.getPlugin(e);if(n==null)throw this.throwPluginNotFound(e),Error(`unreachable`);let r=DJ.fromString(n.manifest.version);return this.checkDependencyVersion(t,r),n}},kJ={date:`date`,datePicker:`datePicker`,dateTime:`dateTime`,editor:`editor`,imageSuggester:`imageSuggester(optionQuery(""))`,imageListSuggester:`imageListSuggester(optionQuery(""))`,inlineList:`inlineList`,inlineListSuggester:`inlineListSuggester(option(apple), option(banana), option(lemon))`,inlineSelect:`inlineSelect(option(apple), option(banana), option(lemon))`,list:`list`,listSuggester:`listSuggester(option(apple), option(banana), option(lemon))`,multiSelect:`multiSelect(option(apple), option(banana), option(lemon))`,number:`number`,progressBar:`progressBar`,select:`select(option(apple), option(banana), option(lemon))`,slider:`slider(addLabels)`,suggester:`suggester(option(apple), option(banana), option(lemon))`,text:`text`,textArea:`textArea`,time:`time`,toggle:`toggle`,invalid:``},AJ={image:[{title:`Image`,declaration:`VIEW[{globalMemory^MB_VF_image_example}][image]`,display:`VIEW[{imageExampleProperty}][image]`,inputField:`INPUT[imageSuggester(optionQuery("")):globalMemory^MB_VF_image_example]`}],link:[{title:`Link`,declaration:`VIEW[{globalMemory^MB_VF_link_example}][link]`,display:`VIEW[{linkExampleProperty}][link]`,inputField:`INPUT[suggester(optionQuery("")):globalMemory^MB_VF_link_example]`}],math:[{title:`Math`,declaration:`VIEW[{globalMemory^MB_VF_math_example} + 2][math]`,display:`VIEW[{mathExampleProperty} + 2][math]`,inputField:`INPUT[number:globalMemory^MB_VF_math_example]`}],text:[{title:`Text`,declaration:`VIEW[some text {globalMemory^MB_VF_text_example}][text]`,display:`VIEW[some text {textExampleProperty}][text]`,inputField:`INPUT[text:globalMemory^MB_VF_text_example]`},{title:`Markdown`,declaration:`VIEW[**some markdown** {globalMemory^MB_VF_text_markdown_example}][text(renderMarkdown)]`,display:`VIEW[**some markdown** {markdownExampleProperty}][text(renderMarkdown)]`,inputField:`INPUT[text:globalMemory^MB_VF_text_markdown_example]`}],invalid:[]};function jJ(e){let t=[];for(let[n,r]of Object.entries(kJ)){if(r===``)continue;let i=e.inputFieldParser.fromString(`INPUT[${r}]`),a=e.inputFieldParser.fromSimpleDeclaration({inputFieldType:void 0,templateName:void 0,bindTarget:void 0,arguments:[{name:V.SHOWCASE,value:[`true`]},{name:V.TITLE,value:[n]}]});i=e.inputFieldParser.merge(i,a),i.declarationString=`INPUT[${r}]`;let o=e.inputFieldParser.validate(i,``,void 0);t.push([n,o])}return t}function MJ(e){let t=[];for(let[e,n]of Object.entries(kJ)){if(n===``)continue;let r=e,i=``;i=En[r].allowInline?`\`INPUT[${n}:exampleProperty]\``:`\n\`\`\`meta-bind\nINPUT[${n}:exampleProperty]\n\`\`\`\n`,t.push([r,i])}return t.sort((e,t)=>e[0].localeCompare(t[0])),t}function NJ(e){let t=[];for(let e of Object.values(AJ))for(let n of e)t.push([n.title,`\`${n.display}\``]);return t.sort((e,t)=>e[0].localeCompare(t[0])),t}function PJ(e,t,n){let r=MJ(n),i=NJ(n);e.addItem(e=>{e.setTitle(`Meta Bind`),e.setIcon(`blocks`);let a=e.setSubmenu();a.addItem(e=>{e.setTitle(`Input Field`);let n=e.setSubmenu();for(let[e,i]of r)n.addItem(n=>{n.setTitle(e),n.onClick(()=>FJ(t,i))})}),a.addItem(e=>{e.setTitle(`View Field`);let n=e.setSubmenu();for(let[e,r]of i)n.addItem(n=>{n.setTitle(e),n.onClick(()=>FJ(t,r))})}),a.addItem(e=>{e.setTitle(`Inline Button`),e.onClick(()=>{FJ(t,"`BUTTON[example-id]`")})}),a.addItem(e=>{e.setTitle(`Button`),e.onClick(()=>{n.internal.openButtonBuilderModal({onOkay:e=>{FJ(t,`\`\`\`meta-bind-button\n${(0,u.stringifyYaml)(e)}\n\`\`\``)},submitText:`Insert`})})})})}function FJ(e,t){e.replaceSelection(t)}var IJ=class extends Ys{mb;filePath;uuid;constructor(e,t,n){super(),this.mb=e,this.filePath=n,this.uuid=t}getUuid(){return this.uuid}getFilePath(){return this.filePath}onMount(e){this.mb.mountableManager.registerMountable(this)}onUnmount(e){this.mb.mountableManager.unregisterMountable(this)}},LJ=class{scope;constructor(e){this.scope=e}},RJ=Mw()(lC()),zJ=Mw()(tw(A)),BJ=Mw()(tw(j)),VJ=Mw()(tw(B)),HJ=Mw()(LC()),UJ=Mw()(Ow(LJ));Mw()(Ow(Zs)),Mw()(Aw()),Mw()(Ow(IJ));var WJ=Mw()(Ow(Ys)),GJ=Mw()(Ow(M)),KJ=Mw()(GC({from:jC(),to:jC()})),qJ=Mw()(GC({value:lC(),position:KJ.optional()})),JJ=Mw()(GC({name:qJ,value:qJ.array()})),YJ=Mw()(GC({type:tw(ye),prop:qJ})),XJ=Mw()(GC({storageType:qJ.optional(),storagePath:qJ.optional(),storageProp:YJ.array(),listenToChildren:FC()}));Mw()(GC({declarationString:lC().optional(),inputFieldType:qJ.optional(),templateName:qJ.optional(),bindTarget:XJ.optional(),arguments:JJ.array(),errorCollection:Ow(Cn)})),Mw()(GC({declarationString:lC().optional(),templateDeclaration:UC(qC([lC(),XJ])).optional(),viewFieldType:qJ.optional(),arguments:JJ.array(),writeToBindTarget:XJ.optional(),errorCollection:Ow(Cn)}));var ZJ=Mw()(GC({storageType:lC(),storagePath:lC(),storageProp:Ow(R_),listenToChildren:FC()})),QJ=Mw()(GC({name:lC(),value:lC().array()}));Mw()(GC({type:tw(ye),prop:lC()}));var $J=Mw()(GC({inputFieldType:VJ.optional(),templateName:lC().optional(),bindTarget:ZJ.optional(),arguments:QJ.array().optional()})),eY=Mw()(GC({viewFieldType:VJ.optional(),templateDeclaration:qC([lC(),ZJ]).array().optional(),arguments:QJ.array().optional(),writeToBindTarget:ZJ.optional()})),tY=Mw()(GC({bindTarget:ZJ,name:lC()})),nY=Mw()(GC({bindTargetMappings:tY.array(),writeToBindTarget:ZJ.optional(),code:lC()})),rY=Mw()(GC({referencedButtonIds:lC().array()})),iY=Mw()(GC({renderChildType:zJ,declaration:qC([lC(),$J]),scope:UJ.optional()})),aY=Mw()(GC({renderChildType:zJ,declaration:qC([lC(),eY]),scope:UJ.optional()})),oY=Mw()(GC({declaration:qC([lC(),nY])})),sY=Mw()(GC({bindTarget:ZJ,tableHead:lC().array(),columns:UC(qC([$J,eY,lC()]))})),cY=Mw()(GC({renderChildType:zJ,declaration:qC([lC(),rY]),position:GJ.optional()})),lY=Mw()(GC({declaration:qC([lC(),oT]),position:GJ.optional(),isPreview:FC()})),uY=Mw()(GC({depth:jC(),content:lC()})),dY=q(`<button><!> </button>`);function fY(e,t){Yr(t,!0);let n=Ws(t,`variant`,19,()=>Nt.DEFAULT),r=Ws(t,`disabled`,7,!1),i=Ws(t,`tooltip`,3,``),a=Ws(t,`label`,3,``),o=Ws(t,`icon`,3,``),s=Ws(t,`cssStyle`,3,``),c=Ws(t,`backgroundImage`,3,``),l=Ws(t,`error`,3,!1),u=Ws(t,`onclick`,3,()=>{}),d=Ws(t,`onauxclick`,3,()=>{});async function f(e,t){if(!r()){r(!0);try{t===It.LEFT?await u()(e):t===It.MIDDLE&&await d()(e)}catch(e){console.warn(`failed to run button component on click`,e)}finally{r(!1)}}}var p=dY();let m,h;var g=U(p),_=e=>{ph(e,{get mb(){return t.mb},get iconName(){return o()}})};ts(g,e=>{o()&&e(_)});var v=G(g);H(p),Ra(()=>{m=xs(p,1,`mb-button-inner`,null,m,{"mod-cta":n()===Nt.PRIMARY,"mod-warning":n()===Nt.DESTRUCTIVE,"mod-plain":n()===Nt.PLAIN,disabled:r(),"mb-error":l()}),h=Cs(p,s(),h,{"background-image":c()?`url("${c()}")`:void 0}),Fs(p,`aria-label`,i()),p.disabled=r(),Jo(v,` ${a()??``}`)}),Io(`click`,p,e=>f(e,It.LEFT)),Fo(`auxclick`,p,e=>f(e,It.MIDDLE)),J(e,p),Xr()}Lo([`click`]);var pY=class extends Ys{mb;config;filePath;isInline;position;buttonComponent;isInGroup;isPreview;constructor(e,t,n,r,i,a,o){super(),this.mb=e,this.config=t,this.filePath=n,this.isInline=r===A.INLINE,this.position=i,this.isInGroup=a,this.isPreview=o}onMount(e){Dt.empty(e),Dt.removeAllClasses(e),Dt.addClasses(e,[`mb-button`,this.isInline?`mb-button-inline`:`mb-button-block`]),!(!this.isInline&&!this.isPreview&&!this.isInGroup&&(this.config.id&&this.mb.buttonManager.addButton(this.filePath,this.config),this.config.hidden))&&(this.config.class&&Dt.addClasses(e,this.config.class.split(` `).filter(e=>e!==``)),this.buttonComponent=Yo(fY,{target:e,props:{mb:this.mb,icon:this.config.icon,variant:this.config.style,label:this.config.label,tooltip:bt(this.config.tooltip)?this.config.tooltip:void 0,cssStyle:this.config.cssStyle,backgroundImage:bt(this.config.backgroundImage)?this.mb.internal.imagePathToUri(this.config.backgroundImage):void 0,onclick:async e=>{await this.mb.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),Ft.fromMouseEvent(e,It.LEFT))},onauxclick:async e=>{await this.mb.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),Ft.fromMouseEvent(e,It.LEFT))}}}))}getContext(){return{position:this.position?.getPosition(),isInGroup:this.isInGroup,isInline:this.isInline}}onUnmount(){this.buttonComponent&&$o(this.buttonComponent),!this.isInline&&!this.isPreview&&this.config?.id&&this.mb.buttonManager.removeButton(this.filePath,this.config.id)}},mY=class extends Ys{mb;referencedIds;filePath;renderChildType;notePosition;constructor(e,t,n,r,i){super(),this.mb=e,this.referencedIds=t,this.filePath=n,this.renderChildType=r,this.notePosition=i}renderInitialButton(e,t){return Dt.removeAllClasses(e),Dt.addClasses(e,[`mb-button`,this.renderChildType===A.INLINE?`mb-button-inline`:`mb-button-block`]),Yo(fY,{target:e,props:{mb:this.mb,variant:Nt.DEFAULT,label:`Button ID not Found`,tooltip:`No button with id '${t}' found`,error:!0,onclick:async()=>{}}})}onMount(e){Dt.empty(e),Dt.addClasses(e,[`mb-button-group`,this.renderChildType===A.INLINE?`mb-button-group-inline`:`mb-button-group-block`]);for(let t of this.referencedIds){let n=Dt.createElement(e,`span`),r=this.renderInitialButton(n,t),i,a=this.mb.buttonManager.registerButtonLoadListener(this.filePath,t,e=>{r&&$o(r),r=void 0,i=new pY(this.mb,e,this.filePath,this.renderChildType,this.notePosition,!0,!1),i.mount(n)});this.registerUnmountCb(()=>{r&&$o(r),r=void 0,i?.unmount(),a()})}}onUnmount(e){Dt.empty(e)}},hY=class extends IJ{errorCollection;declaration;buttonField;renderChildType;position;constructor(e,t,n,r,i,a){super(e,t,n),this.declaration=r,this.errorCollection=new Cn(this.getUuid()),this.errorCollection.merge(r.errorCollection),this.renderChildType=i,this.position=a}onMount(e){if(super.onMount(e),Dt.removeAllClasses(e),this.declaration.errorCollection.isEmpty())try{this.buttonField=new mY(this.mb,this.declaration.referencedButtonIds,this.getFilePath(),this.renderChildType,this.position),this.buttonField.mount(e)}catch(t){this.errorCollection.add(t),this.renderErrorIndicator(e)}else this.renderErrorIndicator(e)}renderErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:`Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.`,warningText:`Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.`,code:this.declaration.declarationString})}onUnmount(e){super.onUnmount(e),this.buttonField?.unmount(),Et(e,`inline button`)}},gY=class extends IJ{errorCollection;declaration;position;buttonField;isPreview;constructor(e,t,n,r,i,a){super(e,t,n),this.declaration=r,this.position=i,this.isPreview=a,this.errorCollection=new Cn(this.getUuid()),this.errorCollection.merge(r.errorCollection)}onMount(e){if(super.onMount(e),Dt.removeAllClasses(e),this.declaration.config&&this.declaration.errorCollection.isEmpty())try{this.buttonField=new pY(this.mb,this.declaration.config,this.getFilePath(),A.BLOCK,this.position,!1,this.isPreview),this.buttonField.mount(e)}catch(t){this.errorCollection.add(t),this.renderErrorIndicator(e)}else this.renderErrorIndicator(e)}renderErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:`Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.`,warningText:`Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.`,code:this.declaration.declarationString})}onUnmount(e){super.onUnmount(e),this.buttonField?.unmount(),Et(e,`button`)}},_Y=class extends IJ{depth;content;markdownUnloadCallback;constructor(e,t,n,r,i){super(e,t,n),this.depth=r,this.content=i}async parseContent(){let e=this.content.split(`
`).map(e=>e.trim()).filter(e=>e.length>0);if(e.length===0)return{content:``};if(e.length>1)return{error:`Embed may only contain one link`};let t=e[0],n=tn.parseLink(t);if(!n.internal)return{error:`${t} is not an internal link`};let r=this.mb.file.getPathByName(n.target,this.getFilePath());return r===void 0?{error:`"${n.target}" is not created yet`}:{content:await this.mb.file.read(r)}}exceedsMaxDepth(){return this.depth>8}createEmbedMessage(e,t){e.createSpan({text:t,cls:`mb-embed-message`})}async renderContent(e){try{if(this.exceedsMaxDepth()){this.createEmbedMessage(e,`Max embed depth exceeded`);return}let t=await this.parseContent();if(t.error){this.createEmbedMessage(e,t.error);return}if(t.content===void 0){this.createEmbedMessage(e,`Embed content not found`);return}let n=t.content.replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=await this.mb.internal.renderMarkdown(n,e,this.getFilePath())}catch(t){let n=new Cn(`Embed`);n.add(t),this.mb.internal.createErrorIndicator(e,{errorCollection:n})}}onMount(e){super.onMount(e),e.addClass(`mb-embed`),this.renderContent(e)}onUnmount(e){super.onUnmount(e),e.removeClass(`mb-embed`),this.markdownUnloadCallback?.(),Et(e,`Embed`)}},vY=class extends IJ{constructor(e,t,n){super(e,t,n)}onMount(e){super.onMount(e),Dt.empty(e),Dt.createElement(e,`span`,{text:`[META_BIND] This folder has been excluded in the settings`,class:`mb-error`})}onUnmount(e){super.onUnmount(e),Dt.empty(e),Et(e,`Excluded`)}},yY=class extends IJ{renderChildType;errorCollection;inputField;declarationString;declaration;constructor(e,t,n,r,i){super(e,t,n),this.renderChildType=r,this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new Cn(this.getUuid()),this.errorCollection.merge(i.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new L({errorLevel:P.CRITICAL,effect:`can not retrieve arguments`,cause:`inputFieldDeclaration has errors`});return this.declaration.argumentContainer.getAll(e)}getBindTarget(){return this.declaration.bindTarget}shouldAddCardContainer(){let e=this.declaration.inputFieldType===B.SELECT||this.declaration.inputFieldType===B.MULTI_SELECT||this.declaration.inputFieldType===B.LIST,t=this.hasArgument(V.SHOWCASE)||this.hasArgument(V.TITLE);return this.renderChildType===A.BLOCK&&(e||t)}createContainer(e){if(this.shouldAddCardContainer()){let t=Dt.createElement(e,`div`);Dt.addClass(t,`mb-card`);let n=this.getArgument(V.TITLE);return n&&Dt.createElement(t,`h3`,{text:n.value}),t}return e}addShowcase(e){if(this.getArgument(V.SHOWCASE)&&this.shouldAddCardContainer()){let t=Dt.createElement(e,`code`,{class:`mb-none`}),n=Dt.createElement(t,`a`,{text:this.declarationString,class:`mb-no-link`});n.href=Qg.linkToInputField(this.declaration.inputFieldType)}}createInputField(){if(!this.errorCollection.hasErrors())try{this.inputField=this.mb.inputFieldFactory.createInputField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new L({errorLevel:P.CRITICAL,effect:`can't render input field`,cause:`input field is undefined`}))}createErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:`Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.`,warningText:`Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.`,code:this.declarationString})}onMount(e){if(super.onMount(e),Dt.empty(e),Dt.addClass(e,`mb-input`),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=this.createContainer(e);this.createErrorIndicator(t);let n=Dt.createElement(t,`div`,{class:`mb-input-wrapper`});this.inputField?.mount(n);let r=this.getArguments(V.CLASS);for(let e of r)Dt.addClasses(n,e.value);Dt.addClass(n,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType===A.BLOCK?Dt.addClass(e,`mb-input-block`):Dt.addClass(e,`mb-input-inline`),this.addShowcase(t)}onUnmount(e){super.onUnmount(e),this.inputField?.unmount(),Et(e,`input field`)}},bY=q(`<div></div>`);function xY(e,t){Yr(t,!0);let n,r;Ma(()=>{r?.unmount(),r=t.mountable,r.mount(n)}),Ks(()=>{r?.unmount()});var i=bY();Us(i,e=>n=e,()=>n),J(e,i),Xr()}var SY=q(`<th> </th>`),CY=q(`<td><!></td>`),wY=q(`<td class="meta-bind-error">invalid data</td>`),TY=q(`<tr><!><td class="mb-html-table-button-cell"><!></td></tr>`),EY=q(`<div class="mb-table-wrapper"><table class="mb-html-table"><thead><tr><!><th class="mb-html-table-button-cell"></th></tr></thead><tbody></tbody></table></div> <!>`,1);function DY(e,t){Yr(t,!0);let n=Ws(t,`tableHead`,19,()=>[]),r=ea(sa([]));function i(e){na(r,e,!0)}var a={updateTable:i},o=EY(),s=W(o),c=U(s),l=U(c),u=U(l);os(U(u),17,n,ns,(e,t)=>{var n=SY(),r=U(n,!0);H(n),Ra(()=>Jo(r,K(t))),J(e,n)}),Ir(),H(u),H(l);var d=G(l);return os(d,21,()=>K(r),e=>e.index,(e,r)=>{var i=TY(),a=U(i),o=e=>{var t=qo();os(W(t),17,()=>K(r).cells,ns,(e,t)=>{var n=CY();xY(U(n),{get mountable(){return K(t)}}),H(n),J(e,n)}),J(e,t)},s=e=>{var t=wY();Ra(()=>Fs(t,`colspan`,n().length)),J(e,t)};ts(a,e=>{K(r).isValid?e(o):e(s,-1)});var c=G(a);Dh(U(c),{onclick:()=>t.table.removeColumn(K(r).index),children:(e,n)=>{ph(e,{get mb(){return t.table.mb},iconName:`x`})},$$slots:{default:!0}}),H(c),H(i),J(e,i)}),H(d),H(c),H(s),Dh(G(s,2),{onclick:()=>t.table.addColumn(),children:(e,t)=>{Ir(),J(e,Ko(`Add Row`))},$$slots:{default:!0}}),J(e,o),Xr(a)}function OY(e){return new R_(e.map(e=>qt.tryParse(e).success?new Ce(ye.ARRAY,e):new Ce(ye.OBJECT,e)))}var kY=class extends IJ{bindTarget;tableHead;columns;tableComponent;inputSignal;metadataSubscription;constructor(e,t,n,r,i,a){super(e,t,n),this.bindTarget=r,this.tableHead=i,this.columns=a,this.inputSignal=new Zs(void 0)}registerSelfToMetadataManager(){this.metadataSubscription=this.mb.metadataManager.subscribe(this.getUuid(),this.inputSignal,this.bindTarget,()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataSubscription?.unsubscribe()}updateMetadataManager(e){this.metadataSubscription?.write(e)}getValue(){return this.parseTableData(this.metadataSubscription?.read())}parseTableData(e){return Array.isArray(e)?e:[]}updateDisplayValue(e){e??=[];let t=[];for(let n=0;n<e.length;n++)if(typeof e[n]==`object`){let r=new LJ({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(OY([n.toString()])),storagePath:this.bindTarget.storagePath,listenToChildren:!1}),i=this.columns.map(e=>{if(typeof e==`string`)return this.mb.api.createInlineFieldFromString(e,this.getFilePath(),r,A.INLINE);if(`inputFieldType`in e)return this.mb.api.createInputFieldMountable(this.getFilePath(),{declaration:e,scope:r,renderChildType:A.INLINE});if(`viewFieldType`in e)return this.mb.api.createViewFieldMountable(this.getFilePath(),{declaration:e,scope:r,renderChildType:A.INLINE});throw Error(`Unknown column type: ${JSON.stringify(e)}`)});t.push({cells:i,index:n,value:e[n],isValid:!0})}else t.push({cells:[],index:n,value:e[n],isValid:!1});this.tableComponent?.updateTable(t)}removeColumn(e){let t=this.getValue();t.splice(e,1),this.updateDisplayValue(t),this.updateMetadataManager(t)}addColumn(){let e=this.getValue();e.push({}),this.updateDisplayValue(e),this.updateMetadataManager(e)}onMount(e){super.onMount(e),this.tableComponent=Yo(DY,{target:e,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:e=>{this.updateDisplayValue(this.parseTableData(e))}}),this.registerSelfToMetadataManager()}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),this.tableComponent&&$o(this.tableComponent),Et(e,`table`)}},AY=class extends IJ{errorCollection;declarationString;declaration;variables;metadataSubscription;jsRenderer;constructor(e,t,n,r){super(e,t,n),this.declaration=r,this.declarationString=r.declarationString,this.errorCollection=new Cn(this.getUuid()),this.errorCollection.merge(r.errorCollection),this.variables=[],this.buildVariables()}buildVariables(){if(this.errorCollection.isEmpty())try{for(let e of this.declaration.bindTargetMappings??[])this.variables.push({bindTargetDeclaration:e.bindTarget,metadataSignal:new Zs(void 0),uuid:St(),contextName:e.name})}catch(e){this.errorCollection.add(e)}}buildContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.metadataSignal||(e[t.contextName]=t.metadataSignal.get());return e}async evaluate(){return this.jsRenderer?.evaluate({bound:this.buildContext()})}registerSelfToMetadataManager(){this.metadataSubscription=this.mb.metadataManager.subscribeDerived(this.getUuid(),this.declaration.writeToBindTarget,this.variables.map(e=>e.bindTargetDeclaration),this.variables.map(e=>e.metadataSignal),async()=>await this.evaluate(),()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataSubscription?.unsubscribe()}createErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:`Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.`,warningText:`Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.`,code:this.declarationString})}onMount(e){if(super.onMount(e),Dt.addClass(e,`mb-view`),Dt.empty(e),this.mb.internal.isJsEngineAvailable()||this.errorCollection.add(new ne({errorLevel:P.ERROR,effect:`can not create js view field`,cause:`The JS Engine plugin is not installed and enabled.`})),this.mb.getSettings().enableJs||this.errorCollection.add(new ne({errorLevel:P.CRITICAL,effect:`Can't evaluate expression.`,cause:`JS evaluation is disabled in the plugin settings.`})),this.createErrorIndicator(e),this.errorCollection.hasErrors())return;let t=document.createElement(`div`);Dt.addClass(t,`mb-view-wrapper`),this.jsRenderer=this.mb.internal.createJsRenderer(t,this.getFilePath(),this.declaration.code,this.declaration.hidden),this.registerSelfToMetadataManager(),e.appendChild(t)}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),Et(e,`js view field`)}},jY=class extends IJ{renderChildType;errorCollection;viewField;declarationString;declaration;constructor(e,t,n,r,i){super(e,t,n),this.renderChildType=r,this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new Cn(this.getUuid()),this.errorCollection.merge(i.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new L({errorLevel:P.ERROR,effect:`an not retrieve arguments`,cause:`viewFieldDeclaration has errors`});return this.declaration.argumentContainer.getAll(e)}getDeclaration(){return this.declaration}createViewField(){if(!this.errorCollection.hasErrors())try{this.viewField=this.mb.viewFieldFactory.createViewField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.viewField&&this.errorCollection.add(new L({errorLevel:P.CRITICAL,effect:`can't render view field`,cause:`view field is undefined`}))}createErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:`Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.`,warningText:`Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.`,code:this.declarationString})}onMount(e){if(super.onMount(e),Dt.empty(e),Dt.addClass(e,`mb-view`),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=document.createElement(`div`);Dt.addClass(t,`mb-view-wrapper`);try{this.viewField?.mount(t)}catch(e){this.errorCollection.add(e)}this.createErrorIndicator(e),e.append(t);let n=this.getArguments(An.CLASS);for(let e of n)Dt.addClasses(t,e.value);Dt.addClass(t,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType===A.BLOCK?Dt.addClass(e,`mb-view-block`):Dt.addClass(e,`mb-view-inline`)}onUnmount(e){super.onUnmount(e),this.viewField?.unmount(),Et(e,`view field`)}},MY=class{mb;constructor(e){this.mb=e}createField(e,t,n,r=!0){if(Nw(GC({type:BJ,filePath:RJ,options:LC(),honorExcludedSetting:FC()}),{type:e,filePath:t,options:n,honorExcludedSetting:r}),this.mb.file.isExcludedFromRendering(t)&&r)return this.createExcludedMountable(t);if(e===j.INPUT)return this.createInputFieldMountable(t,n);if(e===j.VIEW)return this.createViewFieldMountable(t,n);if(e===j.JS_VIEW)return this.createJsViewFieldMountable(t,n);if(e===j.TABLE)return this.createTableMountable(t,n);if(e===j.BUTTON_GROUP)return this.createButtonGroupMountable(t,n);if(e===j.BUTTON)return this.createButtonMountable(t,n);if(e===j.EMBED)return this.createEmbedMountable(t,n);if(e===j.EXCLUDED)return this.createExcludedMountable(t);throw Error(`Unknown field type: ${e}`)}createInlineFieldFromString(e,t,n,r=A.INLINE,i,a=!0){Nw(GC({fieldString:lC(),filePath:RJ,scope:UJ.optional(),renderChildType:zJ,honorExcludedSetting:FC()}),{fieldString:e,filePath:t,scope:n,renderChildType:r,honorExcludedSetting:a});let o=this.isInlineFieldDeclarationAndGetType(e);if(o===void 0)throw new L({errorLevel:P.CRITICAL,effect:`failed to create inline field`,cause:`Invalid inline mdrc type "${o}"`});return this.createInlineFieldOfTypeFromString(o,e,t,n,r,i,a)}createInlineFieldOfTypeFromString(e,t,n,r,i=A.INLINE,a,o=!0){if(Nw(GC({type:BJ,declaration:lC(),filePath:RJ,scope:UJ.optional(),renderChildType:zJ,honorExcludedSetting:FC()}),{type:e,declaration:t,filePath:n,scope:r,renderChildType:i,honorExcludedSetting:o}),this.mb.file.isExcludedFromRendering(n)&&o)return this.createExcludedMountable(n);if(e===j.INPUT)return this.createInputFieldMountable(n,{renderChildType:i,declaration:t,scope:r});if(e===j.VIEW)return this.createViewFieldMountable(n,{renderChildType:i,declaration:t,scope:r});if(e===j.BUTTON_GROUP)return this.createButtonGroupMountable(n,{renderChildType:i,declaration:t,position:a});throw new L({errorLevel:P.CRITICAL,effect:`failed to create inline field`,cause:`Invalid inline mdrc type "${e}"`})}createInputFieldMountable(e,t){Nw(GC({filePath:RJ,options:iY}),{filePath:e,options:t});let n=St(),r;return r=typeof t.declaration==`string`?this.mb.inputFieldParser.fromStringAndValidate(t.declaration,e,t.scope):this.mb.inputFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new yY(this.mb,n,e,t.renderChildType,r)}createViewFieldMountable(e,t){Nw(GC({filePath:RJ,options:aY}),{filePath:e,options:t});let n=St(),r;return r=typeof t.declaration==`string`?this.mb.viewFieldParser.fromStringAndValidate(t.declaration,e,t.scope):this.mb.viewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new jY(this.mb,n,e,t.renderChildType,r)}createJsViewFieldMountable(e,t){Nw(GC({filePath:RJ,options:oY}),{filePath:e,options:t});let n=St(),r;return r=typeof t.declaration==`string`?this.mb.jsViewFieldParser.fromStringAndValidate(t.declaration,e):this.mb.jsViewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e),new AY(this.mb,n,e,r)}createTableMountable(e,t){Nw(GC({filePath:RJ,options:sY}),{filePath:e,options:t});let n=St();return new kY(this.mb,n,e,t.bindTarget,t.tableHead,t.columns)}createButtonGroupMountable(e,t){Nw(GC({filePath:RJ,options:cY}),{filePath:e,options:t});let n=St(),r;return r=typeof t.declaration==`string`?this.mb.buttonParser.fromGroupString(t.declaration):this.mb.buttonParser.validateGroup(t.declaration),new hY(this.mb,n,e,r,t.renderChildType,t.position)}createButtonMountable(e,t){Nw(GC({filePath:RJ,options:lY}),{filePath:e,options:t});let n=St(),r;return r=typeof t.declaration==`string`?this.mb.buttonParser.fromString(t.declaration):this.mb.buttonParser.validate(t.declaration),new gY(this.mb,n,e,r,t.position,t.isPreview)}createEmbedMountable(e,t){Nw(GC({filePath:RJ,options:uY}),{filePath:e,options:t});let n=St();return new _Y(this.mb,n,e,t.depth,t.content)}createExcludedMountable(e){Nw(GC({filePath:RJ}),{filePath:e});let t=St();return new vY(this.mb,t,e)}getInlineFieldDeclarationPrefix(e){if(Nw(GC({fieldType:BJ}),{fieldType:e}),e===j.INPUT)return`INPUT`;if(e===j.VIEW)return`VIEW`;if(e===j.BUTTON_GROUP)return`BUTTON`;throw new L({errorLevel:P.CRITICAL,effect:`failed to get declaration prefix`,cause:`Invalid inline mdrc type "${e}"`})}isInlineFieldDeclaration(e,t){Nw(GC({fieldType:BJ,str:lC()}),{fieldType:e,str:t});let n=this.getInlineFieldDeclarationPrefix(e)+`[`;return t.startsWith(n)&&t.endsWith(`]`)}isInlineFieldDeclarationAndGetType(e){if(Nw(GC({str:lC()}),{str:e}),e.endsWith(`]`))for(let t of Object.values(j)){if(!N(t))continue;let n=this.getInlineFieldDeclarationPrefix(t)+`[`;if(e.startsWith(n))return t}}createSignal(e){return new Zs(e)}createBindTarget(e,t,n,r=!1){return Nw(GC({storageType:lC(),storagePath:lC(),property:lC().array(),listenToChildren:FC()}),{storageType:e,storagePath:t,property:n,listenToChildren:r}),{storageType:e,storagePath:t,storageProp:OY(n),listenToChildren:r}}parseBindTarget(e,t,n){return Nw(GC({declarationString:lC(),filePath:RJ,scope:UJ.optional()}),{declarationString:e,filePath:t,scope:n}),this.mb.bindTargetParser.fromStringAndValidate(e,t,n)}setMetadata(e,t){Nw(GC({bindTarget:ZJ}),{bindTarget:e}),this.mb.metadataManager.write(t,e)}getMetadata(e){return Nw(GC({bindTarget:ZJ}),{bindTarget:e}),this.mb.metadataManager.read(e)}updateMetadata(e,t){Nw(GC({bindTarget:ZJ,updateFn:Aw()}),{bindTarget:e,updateFn:t});let n=t(this.mb.metadataManager.read(e));this.mb.metadataManager.write(n,e)}subscribeToMetadata(e,t,n){Nw(GC({bindTarget:ZJ,lifecycleHook:this.mb.internal.getLifecycleHookValidator(),callback:Aw()}),{bindTarget:e,lifecycleHook:t,callback:n});let r=St(),i=new Zs(void 0);i.registerListener({callback:n});let a=this.mb.metadataManager.subscribe(r,i,e,()=>{i.unregisterAllListeners()});t.register(()=>{a.unsubscribe()})}createNotePosition(e,t){return Nw(GC({lineStart:jC(),lineEnd:jC()}),{lineStart:e,lineEnd:t}),new M({lineStart:e,lineEnd:t})}mathJSImport(e,t){this.mb.math.import(e,t)}},NY=class extends f.WidgetType{mb;type;content;filePath;parentComponent;renderChild;constructor(e,t,n,r,i){super(),this.type=e,this.content=t,this.filePath=n,this.parentComponent=r,this.mb=i}eq(e){return e.content===this.content}toDOM(e){let t=document.createElement(`span`);t.addClass(`cm-inline-code`);let n=this.mb.api.createInlineFieldOfTypeFromString(this.type,this.content,this.filePath,void 0);return this.renderChild=this.mb.api.wrapInMDRC(n,t,this.parentComponent),t}destroy(e){this.renderChild?.unload(),super.destroy(e)}},PY=class extends u.MarkdownRenderChild{mb;mountable;constructor(e,t,n){super(n),this.mb=e,this.mountable=t,this.mountable.registerUnmountCb(()=>{this.unload()})}onload(){this.containerEl.addClass(`interactive-child`),this.mountable.mount(this.containerEl),super.onload()}onunload(){this.mountable.isMounted()&&this.mountable.unmount(),super.onunload()}};function FY(e){return e.dependencyManager.checkDependency(`dataview`).api}function IY(e){return e.dependencyManager.checkDependency(`js-engine`).api}var LY=function(e){return e[e.CreateNewFromTemplate=0]=`CreateNewFromTemplate`,e[e.AppendActiveFile=1]=`AppendActiveFile`,e[e.OverwriteFile=2]=`OverwriteFile`,e[e.OverwriteActiveFile=3]=`OverwriteActiveFile`,e[e.DynamicProcessor=4]=`DynamicProcessor`,e[e.StartupTemplate=5]=`StartupTemplate`,e}({});function RY(e){return e.dependencyManager.checkDependency(`templater-obsidian`).templater}var zY=GC({addChild:Aw()}),BY=class extends MY{omb;constructor(e){super(e),this.omb=e}wrapInMDRC(e,t,n){Nw(GC({field:WJ,containerEl:HJ,component:zY}),{field:e,containerEl:t,component:n});let r=new PY(this.omb,e,t);return n.addChild(r),r}constructMDRCWidget(e,t,n,r){if(N(e))return new NY(e,t,n,r,this.omb);throw new L({errorLevel:P.CRITICAL,effect:`failed to construct mdrc`,cause:`Invalid inline field type "${e}"`})}reactiveMetadata(e,t,n){Nw(GC({bindTargets:ZJ.array(),lifecycleHook:this.mb.internal.getLifecycleHookValidator(),callback:Aw()}),{bindTargets:e,lifecycleHook:t,callback:n});let r=IY(this.omb),i=St(),a=e.map(()=>new Zs(void 0)),o=()=>Promise.resolve(),s=this.mb.metadataManager.subscribeEffect(i,e,a,()=>o(),()=>{});t.register(()=>s.unsubscribe());let c=r.reactive(n,...a.map(e=>e.get()));return o=()=>c.refresh(...a.map(e=>e.get())),c}},VY=class{mb;constructor(e){this.mb=e}getFrontmatterLocation(e){let t=e.split(`
`);if(t.at(0)===`---`){for(let e=1;e<t.length;e++)if(t.at(e)===`---`)return{lineStart:1,lineEnd:e+1}}}isExcludedFromRendering(e){for(let t of this.mb.getSettings().excludedFolders)if(e.startsWith(t))return!0;return!1}resolveFilePathLike(e,t){let n=tn.isLink(e)?tn.parseLink(e).target:e,r=this.mb.file.getPathByName(n,t);if(r===void 0)throw new ee({errorLevel:P.ERROR,cause:`Could not find a file that matches "${e}".`,effect:`Could not resolve path or link "${e}" relative to "${t}".`});return r}createLineNumberContext(e,t){let n=e.split(`
`).length,r=this.mb.file.getFrontmatterLocation(e);return{fileStart:1,fileEnd:n,frontmatterStart:r?r.lineStart:1,frontmatterEnd:r?r.lineEnd:1,contentStart:r?r.lineEnd+1:1,contentEnd:n,selfStart:t?t.lineStart+1:void 0,selfEnd:t?t.lineEnd+1:void 0}}},HY=class extends VY{app;constructor(e){super(e),this.app=e.app}async read(e){let t=this.app.vault.getAbstractFileByPath(e);if(!t||!(t instanceof u.TFile))throw Error(`file not found: ${e}`);return this.app.vault.cachedRead(t)}async write(e,t){let n=this.app.vault.getFileByPath(e);if(!n)throw Error(`file not found: ${e}`);await this.app.vault.modify(n,t)}async exists(e){return this.app.vault.getFileByPath(e)!==null}async atomicModify(e,t){let n=this.app.vault.getFileByPath(e);if(!n)throw Error(`file not found: ${e}`);await this.app.vault.process(n,e=>t(e))}async create(e,t,n,r=!1,i=!1){let a=this.app.vault.getAvailablePath((0,u.normalizePath)(e+`/`+t),n),o=await this.app.vault.create(a,``);return r&&await this.openInSourceMode(o,i),o.path}getAllFiles(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof u.TFile).map(e=>e.path)}getAllFolders(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof u.TFolder).map(e=>e.path)}async open(e,t,n){this.app.workspace.openLinkText(e,t,n)}async openInSourceMode(e,t){let n=this.app.workspace.getLeaf(t?`tab`:!1);n&&await n.openFile(e,{state:{mode:`source`}})}getPathByName(e,t=``){return this.app.metadataCache.getFirstLinkpathDest(e,t)?.path}},UY=q(`<div class="mb-calendar-cell mb-calendar-header-cell"><span class="mb-calendar-cell-text"> </span></div>`),WY=q(`<div role="button" tabindex="0"><span class="mb-calendar-cell-text"> </span></div>`),GY=q(`<div class="mb-calendar"><div class="mb-calendar-header"></div> <div class="mb-calendar-content"></div></div>`);function KY(e,t){Yr(t,!0);let n=Ui(()=>rE(t.month,t.year));function r(e){e&&t.dateChange(rc(new Date(t.year,t.month,e)))}function i(e,t){e.key===` `&&r(t)}var a=GY(),o=U(a);os(o,21,aE,ns,(e,t)=>{var n=UY(),r=U(n),i=U(r,!0);H(r),H(n),Ra(()=>Jo(i,K(t))),J(e,n)}),H(o);var s=G(o,2);os(s,21,()=>K(n),ns,(e,n)=>{var a=WY();let o;var s=U(a),c=U(s,!0);H(s),H(a),Ra(e=>{o=xs(a,1,`mb-calendar-cell`,null,o,e),Jo(c,K(n)||``)},[()=>({"mb-calendar-highlight":K(n),"mb-calendar-content-cell":K(n),"mb-calendar-selected":t.selectedDate?.year()===t.year&&t.selectedDate?.month()===t.month&&t.selectedDate?.date()===K(n)})]),Io(`click`,a,()=>r(K(n))),Io(`keydown`,a,e=>i(e,K(n))),J(e,a)}),H(s),H(a),J(e,a),Xr()}Lo([`click`,`keydown`]);var qY=q(`<div class="mb-date-picker"><div class="mb-date-picker-header"><button class="mb-date-picker-month-switch-button">Prev</button> <div class="mb-date-picker-header-text"><span class="mb-date-picker-header-text-month"> </span> <input class="mb-date-picker-header-text-year" type="number"/></div> <button class="mb-date-picker-month-switch-button">Next</button></div> <!> <div class="mb-date-picker-footer"><button class="mb-date-picker-util-button">Set no Date</button> <button class="mb-date-picker-util-button">Set to Now</button></div></div>`);function JY(e,t){Yr(t,!0);let n=Ws(t,`selectedDate`,23,rc),r=ea(0),i=ea(0);Ma(()=>{if(n())na(r,n().month(),!0),na(i,n().year(),!0);else{let e=rc();na(r,e.month(),!0),na(i,e.year(),!0)}});function a(){if(K(r)===11){na(r,0),na(i,K(i)+1);return}na(r,K(r)+1)}function o(){if(K(r)===0){na(r,11),na(i,K(i)-1);return}na(r,K(r)-1)}function s(e){let t=e.target.value,n=Number.parseInt(t);Number.isNaN(n)||na(i,n,!0)}function c(e){n(e),t.dateChangeCallback(e)}function l(){n(null),t.dateChangeCallback(null)}function u(){n(rc()),t.dateChangeCallback(n())}var d=qY(),f=U(d),p=U(f),m=G(p,2),h=U(m),g=U(h,!0);H(h);var _=G(h,2);Ms(_),H(m);var v=G(m,2);H(f);var y=G(f,2);KY(y,{dateChange:c,get month(){return K(r)},get year(){return K(i)},get selectedDate(){return n()}});var b=G(y,2),x=U(b),S=G(x,2);H(b),H(d),Ra((e,t)=>{Jo(g,e),Ns(_,t)},[()=>nE(K(r)),()=>K(i).toString()]),Io(`click`,p,o),Io(`input`,_,s),Io(`click`,v,a),Io(`click`,x,l),Io(`click`,S,u),J(e,d),Xr()}Lo([`click`,`input`]);var YY=class extends Ys{modal;setModal(e){this.modal=e}closeModal(){if(this.modal!==void 0)this.modal.close();else throw new L({errorLevel:P.CRITICAL,effect:`Failed to close modal`,cause:`Modal reference in ModalContent is undefined`})}},XY=q(`<div><div class="setting-item-info"><div class="setting-item-name"> </div> <div class="setting-item-description"> </div></div> <div><!></div></div>`);function ZY(e,t){let n=Ws(t,`name`,3,``),r=Ws(t,`description`,3,``),i=Ws(t,`heading`,3,!1),a=Ws(t,`vertical`,3,!1);var o=XY();let s;var c=U(o),l=U(c),u=U(l,!0);H(l);var d=G(l,2),f=U(d,!0);H(d),H(c);var p=G(c,2);let m;var h=U(p),g=e=>{var n=qo();fs(W(n),()=>t.children),J(e,n)};ts(h,e=>{t.children&&e(g)}),H(p),H(o),Ra(()=>{s=xs(o,1,`setting-item`,null,s,{"setting-item-heading":i(),"mb-vertical":a()}),Jo(u,n()),Jo(f,r()),m=xs(p,1,`setting-item-control`,null,m,{"mb-vertical-control":a()})}),J(e,o)}function QY(e,t){Yr(t,!0);let n=Ws(t,`action`,15);function r(){t.mb.internal.openCommandSelectModal(e=>{n(n().command=e.id,!0)})}{let t=Ui(()=>n().command||`none`);ZY(e,{get name(){return`Command: ${K(t)??``}`},description:`The command to execute when this action runs.`,children:(e,t)=>{Dh(e,{get variant(){return Nt.PRIMARY},onclick:()=>r(),children:(e,t)=>{Ir(),J(e,Ko(`Change`))},$$slots:{default:!0}})},$$slots:{default:!0}})}Xr()}var $Y=q(`<div role="switch" tabindex="0"><input type="checkbox" tabindex="-1"/></div>`);function eX(e,t){Yr(t,!0);let n=Ws(t,`checked`,15),r=Ui(()=>n()??!1);var i=$Y();let a;var o=U(i);Ms(o),H(i),Ra(()=>{a=xs(i,1,`checkbox-container`,null,a,{"is-enabled":K(r)}),Fs(i,`aria-checked`,K(r)),Ps(o,K(r))}),Io(`click`,i,()=>n(!K(r))),Io(`keydown`,i,e=>{e.key===` `&&n(!K(r))}),J(e,i),Xr()}Lo([`click`,`keydown`]);var tX=q(`<input type="text" placeholder="some name"/>`),nX=q(`<!> <!> <!> <!>`,1);function rX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);function r(){t.mb.internal.openFolderSelectModal(e=>{n(n().folderPath=e,!0)})}var i=nX(),a=W(i);{let e=Ui(()=>n().folderPath||`none`);ZY(a,{get name(){return`Folder: ${K(e)??``}`},description:`The folder to create a new note in.`,children:(e,t)=>{Dh(e,{get variant(){return Nt.PRIMARY},onclick:()=>r(),tooltip:`Select from vault`,children:(e,t)=>{Ir(),J(e,Ko(`Change`))},$$slots:{default:!0}})},$$slots:{default:!0}})}var o=G(a,2);{let e=Ui(()=>n().fileName||`default`);ZY(o,{get name(){return`File name: ${K(e)??``}`},description:`The file name of the new note.`,children:(e,t)=>{var r=tX();Ms(r),zs(r,()=>n().fileName,e=>n(n().fileName=e,!0)),J(e,r)},$$slots:{default:!0}})}var s=G(o,2);ZY(s,{name:`Open note`,description:`Whether to open the new note after this action ran.`,children:(e,t)=>{eX(e,{get checked(){return n().openNote},set checked(e){n(n().openNote=e,!0)}})},$$slots:{default:!0}}),ZY(G(s,2),{name:`Open if note already exists`,description:`Whether to open the note instead of creating a new one if the note already exists.`,children:(e,t)=>{eX(e,{get checked(){return n().openIfAlreadyExists},set checked(e){n(n().openIfAlreadyExists=e,!0)}})},$$slots:{default:!0}}),J(e,i),Xr()}function iX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);function r(){t.mb.internal.openMarkdownFileSelectModal(e=>{n(n().templateFile=e,!0)})}{let t=Ui(()=>n().templateFile||`default`);ZY(e,{get name(){return`File path: ${K(t)??``}`},description:`The path to the templater file, relative to the vault root.`,children:(e,t)=>{Dh(e,{get variant(){return Nt.PRIMARY},onclick:()=>r(),tooltip:`Select from vault`,children:(e,t)=>{Ir(),J(e,Ko(`Change`))},$$slots:{default:!0}})},$$slots:{default:!0}})}Xr()}var aX=q(`<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>`,1);function oX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);var r=aX(),i=W(r);ZY(i,{name:`JS code`,description:`The JavaScript code to run.`});var a=G(i,2),o=U(a);Sa(o),H(a),zs(o,()=>n().code,e=>n(n().code=e,!0)),J(e,r),Xr()}var sX=q(`<input type="text" placeholder="some text"/>`);function cX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);ZY(e,{name:`Text`,description:`The text to input at the cursor.`,children:(e,t)=>{var r=sX();Ms(r),zs(r,()=>n().str,e=>n(n().str=e,!0)),J(e,r)},$$slots:{default:!0}}),Xr()}var lX=q(`<input type="number" placeholder="0"/>`),uX=q(`<!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>`,1);function dX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);var r=uX(),i=W(r);ZY(i,{name:`Line`,description:`The line number to insert at.`,children:(e,t)=>{var r=lX();Ms(r),zs(r,()=>n().line,e=>n(n().line=e,!0)),J(e,r)},$$slots:{default:!0}});var a=G(i,2);ZY(a,{name:`Text to insert`,description:`The text to insert into the note.`});var o=G(a,2),s=U(o);Sa(s),H(o),zs(s,()=>n().value,e=>n(n().value=e,!0)),J(e,r),Xr()}function fX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);function r(){t.mb.internal.openFilteredFileSelectModal(e=>{n(n().file=e,!0)},e=>e.endsWith(`.js`))}ZY(e,{name:`JS file`,description:`The JavaScript file to run.`,children:(e,t)=>{Dh(e,{get variant(){return Nt.PRIMARY},onclick:()=>r(),tooltip:`Select from vault`,children:(e,t)=>{Ir(),J(e,Ko(`Change`))},$$slots:{default:!0}})},$$slots:{default:!0}}),Xr()}var pX=q(`<input type="text" placeholder="[[Some Note]] or https://www.example.com"/> <!>`,1),mX=q(`<!> <!>`,1);function hX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);function r(){t.mb.internal.openMarkdownFileSelectModal(e=>{n(n().link=e,!0)})}var i=mX(),a=W(i);ZY(a,{name:`Link`,description:`The link to open.`,children:(e,i)=>{var a=pX(),o=W(a);Ms(o),Dh(G(o,2),{get variant(){return Nt.PRIMARY},onclick:()=>r(),tooltip:`Select from vault`,children:(e,n)=>{ph(e,{iconName:`list`,get mb(){return t.mb}})},$$slots:{default:!0}}),zs(o,()=>n().link,e=>n(n().link=e,!0)),J(e,a)},$$slots:{default:!0}}),ZY(G(a,2),{name:`New tab`,description:`Whether to open the link in a new tab.`,children:(e,t)=>{eX(e,{get checked(){return n().newTab},set checked(e){n(n().newTab=e,!0)}})},$$slots:{default:!0}}),J(e,i),Xr()}var gX=q(`<input type="text"/>`),_X=q(`<input type="text" placeholder="g"/>`),vX=q(`<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>`,1);function yX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);var r=vX(),i=W(r);ZY(i,{name:`Regexp`,description:`The regexp to find replacements.`,children:(e,t)=>{var r=gX();Ms(r),zs(r,()=>n().regexp,e=>n(n().regexp=e,!0)),J(e,r)},$$slots:{default:!0}});var a=G(i,2);ZY(a,{name:`Regexp flags`,description:`The regexp flags for this regexp.`,children:(e,t)=>{var r=_X();Ms(r),zs(r,()=>n().regexpFlags,e=>n(n().regexpFlags=e,!0)),J(e,r)},$$slots:{default:!0}});var o=G(a,2);ZY(o,{name:`Replacement text`,description:`The text to replace the button with.`});var s=G(o,2),c=U(s);Sa(c),H(s),zs(c,()=>n().replacement,e=>n(n().replacement=e,!0)),J(e,r),Xr()}var bX=q(`<input type="number" placeholder="0"/>`),xX=q(`<input type="number" placeholder="0"/>`),SX=q(`<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>`,1);function CX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);var r=SX(),i=W(r);ZY(i,{name:`Line from`,description:`The line that marks the start of the area to replace.`,children:(e,t)=>{var r=bX();Ms(r),zs(r,()=>n().fromLine,e=>n(n().fromLine=e,!0)),J(e,r)},$$slots:{default:!0}});var a=G(i,2);ZY(a,{name:`Line to`,description:`The line that marks the end of the area to replace.`,children:(e,t)=>{var r=xX();Ms(r),zs(r,()=>n().toLine,e=>n(n().toLine=e,!0)),J(e,r)},$$slots:{default:!0}});var o=G(a,2);ZY(o,{name:`Replacement text`,description:`The text to replace the note section.`});var s=G(o,2),c=U(s);Sa(c),H(s),zs(c,()=>n().replacement,e=>n(n().replacement=e,!0)),J(e,r),Xr()}var wX=q(`<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>`,1);function TX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);var r=wX(),i=W(r);ZY(i,{name:`Replacement text`,description:`The text to replace the match with.`});var a=G(i,2),o=U(a);Sa(o),H(a),zs(o,()=>n().replacement,e=>n(n().replacement=e,!0)),J(e,r),Xr()}var EX=q(`<input type="number" placeholder="100 ms"/>`);function DX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);ZY(e,{name:`Sleep time`,description:`The time to sleep in milliseconds.`,children:(e,t)=>{var r=EX();Ms(r),zs(r,()=>n().ms,e=>n(n().ms=e,!0)),J(e,r)},$$slots:{default:!0}}),Xr()}var OX=q(`<input type="text" placeholder="some name"/>`),kX=q(`<!> <!> <!> <!> <!>`,1);function AX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);function r(e){t.mb.internal.openFileSelectModal(t=>{e.templateFile=t})}function i(e){t.mb.internal.openFolderSelectModal(t=>{e.folderPath=t})}var a=kX(),o=W(a);{let e=Ui(()=>n().templateFile||`none`);ZY(o,{get name(){return`Template file: ${K(e)??``}`},description:`The template file to create a new note of.`,children:(e,t)=>{Dh(e,{get variant(){return Nt.PRIMARY},onclick:()=>r(n()),tooltip:`Select from vault`,children:(e,t)=>{Ir(),J(e,Ko(`Change`))},$$slots:{default:!0}})},$$slots:{default:!0}})}var s=G(o,2);{let e=Ui(()=>n().folderPath||`none`);ZY(s,{get name(){return`Folder: ${K(e)??``}`},description:`The folder to create a new note in.`,children:(e,t)=>{Dh(e,{get variant(){return Nt.PRIMARY},onclick:()=>i(n()),tooltip:`Select from vault`,children:(e,t)=>{Ir(),J(e,Ko(`Change`))},$$slots:{default:!0}})},$$slots:{default:!0}})}var c=G(s,2);{let e=Ui(()=>n().fileName||`default`);ZY(c,{get name(){return`File name: ${K(e)??``}`},description:`The file name of the new note.`,children:(e,t)=>{var r=OX();Ms(r),zs(r,()=>n().fileName,e=>n(n().fileName=e,!0)),J(e,r)},$$slots:{default:!0}})}var l=G(c,2);ZY(l,{name:`Open note`,description:`Whether to open the new note after this action ran.`,children:(e,t)=>{eX(e,{get checked(){return n().openNote},set checked(e){n(n().openNote=e,!0)}})},$$slots:{default:!0}}),ZY(G(l,2),{name:`Open if note already exists`,description:`Whether to open the note instead of creating a new one if the note already exists.`,children:(e,t)=>{eX(e,{get checked(){return n().openIfAlreadyExists},set checked(e){n(n().openIfAlreadyExists=e,!0)}})},$$slots:{default:!0}}),J(e,a),Xr()}var jX=q(`<input type="text" placeholder="some value"/>`),MX=q(`<input type="text" placeholder="some value"/>`),NX=q(`<!> <!> <!>`,1);function PX(e,t){Yr(t,!0);let n=Ws(t,`action`,15);var r=NX(),i=W(r);ZY(i,{name:`Metadata property`,description:`The metadata property in form of a bind target.`,children:(e,t)=>{var r=jX();Ms(r),zs(r,()=>n().bindTarget,e=>n(n().bindTarget=e,!0)),J(e,r)},$$slots:{default:!0}});var a=G(i,2);ZY(a,{name:`Value`,description:`The new value.`,children:(e,t)=>{var r=MX();Ms(r),zs(r,()=>n().value,e=>n(n().value=e,!0)),J(e,r)},$$slots:{default:!0}}),ZY(G(a,2),{name:`Evaluate`,description:`Whether to evaluate the value as a JS expression.`,children:(e,t)=>{eX(e,{get checked(){return n().evaluate},set checked(e){n(n().evaluate=e,!0)}})},$$slots:{default:!0}}),J(e,r),Xr()}var FX=q(`<div><!></div>`);function IX(e,t){Yr(t,!0);let n=Ws(t,`reverse`,3,!1),r=Ws(t,`stretchChildren`,3,!1),i=Ui(()=>[n()?`mb-flex-row-reverse`:`mb-flex-row`,r()?`mb-flex-row-stretch`:``].join(` `));var a=FX();fs(U(a),()=>t.children),H(a),Ra(()=>xs(a,1,hs(K(i)))),J(e,a),Xr()}var LX=q(`<div class="modal-button-container"><!></div>`);function RX(e,t){var n=LX();fs(U(n),()=>t.children),H(n),J(e,n)}var zX=q(`<input type="text"/>`),BX=q(`<input type="text"/>`),VX=q(`<option> </option>`),HX=q(`<select class="dropdown"></select>`),UX=q(`<input type="text"/>`),WX=q(`<input type="text"/>`),GX=q(`<span style="word-break: break-word"> </span> <!> <!>`,1),KX=q(`<input type="text"/>`),qX=q(`<input type="text"/>`),JX=q(`<option> </option>`),YX=q(`<h5> </h5> <!>`,1),XX=q(`<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>`,1),ZX=q(`<!> <!>`,1),QX=q(`<!> <!> <!> <!> <!> <!> <!> <!> <!> <h4>Actions</h4> Add action of type <select class="dropdown"></select> <!> <!> <h4>Preview</h4> <div></div> <!>`,1);function $X(e,t){Yr(t,!0);let n=sa(t.buttonConfig),r,i,a=ea(sa(Pt.COMMAND));Ks(()=>{i?.unmount()}),Ma(()=>{i?.unmount(),r&&(Dt.empty(r),i=new pY(t.mb,Gr(n),``,A.BLOCK,void 0,!1,!0),i.mount(r))});function o(){n.actions?.push(t.mb.buttonActionRunner.createDefaultAction(K(a)))}function s(e){n.actions?.splice(e,1)}function c(e){return t.mb.buttonActionRunner.getActionLabel(e)}function l(e,r){if(n.actions===void 0)return;let i=[];e>0&&i.push({name:`Move up`,icon:`arrow-up`,onclick:()=>{if(n.actions===void 0)return;let t=n.actions[e-1];n.actions[e-1]=n.actions[e],n.actions[e]=t}}),e<n.actions.length-1&&i.push({name:`Move down`,icon:`arrow-down`,onclick:()=>{if(n.actions===void 0)return;let t=n.actions[e+1];n.actions[e+1]=n.actions[e],n.actions[e]=t}}),i.push({name:`Remove`,icon:`x`,warning:!0,onclick:()=>s(e)}),t.mb.internal.createContextMenu(i).showWithEvent(r)}function u(){t.mb.internal.openImageFileSelectModal(e=>{n.backgroundImage=e})}function d(){n.backgroundImage=void 0}var f=QX(),p=W(f);ZY(p,{name:`Label`,description:`The label shown on the button.`,children:(e,t)=>{var r=zX();Ms(r),zs(r,()=>n.label,e=>n.label=e),J(e,r)},$$slots:{default:!0}});var m=G(p,2);ZY(m,{name:`Icon`,description:`The icon shown on the button. If left empty, no icon will show`,children:(e,t)=>{var r=BX();Ms(r),zs(r,()=>n.icon,e=>n.icon=e),J(e,r)},$$slots:{default:!0}});var h=G(m,2);ZY(h,{name:`Style`,description:`The style variant of the button`,children:(e,t)=>{var r=HX();os(r,21,()=>Object.values(Nt),ns,(e,t)=>{var n=VX(),r=U(n,!0);H(n);var i={};Ra(()=>{Jo(r,K(t)),i!==(i=K(t))&&(n.value=(n.__value=K(t))??``)}),J(e,n)}),H(r),Es(r,()=>n.style,e=>n.style=e),J(e,r)},$$slots:{default:!0}});var g=G(h,2);ZY(g,{name:`CSS classes`,description:`A list of CSS classes to add to the button. Multiple classes should be separated by a space.`,children:(e,t)=>{var r=UX();Ms(r),zs(r,()=>n.class,e=>n.class=e),J(e,r)},$$slots:{default:!0}});var _=G(g,2);ZY(_,{name:`CSS styles`,description:`CSS styles to directly apply to the button.`,children:(e,t)=>{var r=WX();Ms(r),zs(r,()=>n.cssStyle,e=>n.cssStyle=e),J(e,r)},$$slots:{default:!0}});var v=G(_,2);ZY(v,{name:`Background image`,description:`A background image to use in the button.`,children:(e,r)=>{var i=GX(),a=W(i),o=U(a,!0);H(a);var s=G(a,2);Dh(s,{get variant(){return Nt.PRIMARY},onclick:()=>u(),tooltip:`Select from vault`,children:(e,t)=>{Ir(),J(e,Ko(`Change`))},$$slots:{default:!0}}),Dh(G(s,2),{get variant(){return Nt.DEFAULT},onclick:()=>d(),tooltip:`Reset to none`,children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`x`})},$$slots:{default:!0}}),Ra(()=>Jo(o,n.backgroundImage||`none`)),J(e,i)},$$slots:{default:!0}});var y=G(v,2);ZY(y,{name:`Tooltip`,description:`A tooltip to show when hovering the button. If not set, the button label will be shown instead.`,children:(e,t)=>{var r=KX();Ms(r),zs(r,()=>n.tooltip,e=>n.tooltip=e),J(e,r)},$$slots:{default:!0}});var b=G(y,2);ZY(b,{name:`ID`,description:`An ID that allows the button to be referenced in inline buttons.`,children:(e,t)=>{var r=qX();Ms(r),zs(r,()=>n.id,e=>n.id=e),J(e,r)},$$slots:{default:!0}});var x=G(b,2);ZY(x,{name:`Hidden`,description:`Whether to not render this button. This can be useful when using inline buttons.`,children:(e,t)=>{eX(e,{get checked(){return n.hidden},set checked(e){n.hidden=e}})},$$slots:{default:!0}});var S=G(x,4);os(S,21,()=>Object.values(Pt),ns,(e,t)=>{var n=JX(),r=U(n,!0);H(n);var i={};Ra(()=>{Jo(r,K(t)),i!==(i=K(t))&&(n.value=(n.__value=K(t))??``)}),J(e,n)}),H(S);var C=G(S,2);Dh(C,{get variant(){return Nt.PRIMARY},onclick:()=>o(),children:(e,t)=>{Ir(),J(e,Ko(`Add Action`))},$$slots:{default:!0}});var w=G(C,2),T=e=>{var r=qo();os(W(r),17,()=>n.actions??[],ns,(e,r,i)=>{var a=XX(),o=W(a);IX(o,{children:(e,n)=>{var a=YX(),o=W(a),s=U(o,!0);H(o),Dh(G(o,2),{get variant(){return Nt.PLAIN},onclick:e=>l(i,e),children:(e,n)=>{ph(e,{iconName:`more-vertical`,get mb(){return t.mb}})},$$slots:{default:!0}}),Ra(e=>Jo(s,e),[()=>c(K(r).type)]),J(e,a)},$$slots:{default:!0}});var s=G(o,2),u=e=>{QY(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(s,e=>{K(r).type===Pt.COMMAND&&e(u)});var d=G(s,2),f=e=>{hX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(d,e=>{K(r).type===Pt.OPEN&&e(f)});var p=G(d,2),m=e=>{fX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(p,e=>{K(r).type===Pt.JS&&e(m)});var h=G(p,2),g=e=>{cX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(h,e=>{K(r).type===Pt.INPUT&&e(g)});var _=G(h,2),v=e=>{DX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(_,e=>{K(r).type===Pt.SLEEP&&e(v)});var y=G(_,2),b=e=>{AX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(y,e=>{K(r).type===Pt.TEMPLATER_CREATE_NOTE&&e(b)});var x=G(y,2),S=e=>{PX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(x,e=>{K(r).type===Pt.UPDATE_METADATA&&e(S)});var C=G(x,2),w=e=>{rX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(C,e=>{K(r).type===Pt.CREATE_NOTE&&e(w)});var T=G(C,2),E=e=>{iX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(T,e=>{K(r).type===Pt.RUN_TEMPLATER_FILE&&e(E)});var D=G(T,2),O=e=>{CX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(D,e=>{K(r).type===Pt.REPLACE_IN_NOTE&&e(O)});var k=G(D,2),A=e=>{yX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(k,e=>{K(r).type===Pt.REGEXP_REPLACE_IN_NOTE&&e(A)});var j=G(k,2),M=e=>{TX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(j,e=>{K(r).type===Pt.REPLACE_SELF&&e(M)});var N=G(j,2),P=e=>{dX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(N,e=>{K(r).type===Pt.INSERT_INTO_NOTE&&e(P)});var F=G(N,2),I=e=>{oX(e,{get mb(){return t.mb},get action(){return n.actions[i]},set action(e){n.actions[i]=e}})};ts(F,e=>{K(r).type===Pt.INLINE_JS&&e(I)}),J(e,a)}),J(e,r)};ts(w,e=>{n.actions&&e(T)});var E=G(w,4);Us(E,e=>r=e,()=>r),RX(G(E,2),{children:(e,r)=>{var i=ZX(),a=W(i);Dh(a,{get variant(){return Nt.PRIMARY},onclick:()=>t.modal.okay(Gr(n)),children:(e,n)=>{Ir();var r=Ko();Ra(()=>Jo(r,t.modal.options.submitText)),J(e,r)},$$slots:{default:!0}}),Dh(G(a,2),{get variant(){return Nt.DEFAULT},onclick:()=>t.modal.cancel(),children:(e,t)=>{Ir(),J(e,Ko(`Cancel`))},$$slots:{default:!0}}),J(e,i)},$$slots:{default:!0}}),Es(S,()=>K(a),e=>na(a,e)),J(e,f),Xr()}var eZ=class extends YY{mb;component;options;constructor(e,t){super(),this.mb=e,this.options=t}onMount(e){Dt.empty(e),this.component&&$o(this.component),this.component=Yo($X,{target:e,props:{mb:this.mb,modal:this,buttonConfig:this.options.config??this.mb.buttonActionRunner.createDefaultButtonConfig()}})}onUnmount(e){Dt.empty(e),this.component&&$o(this.component)}okay(e){this.closeModal(),this.options.onOkay(e)}cancel(){this.closeModal()}},tZ=q(`<div class="mb-image-card" role="button" tabindex="0"><img class="mb-image-card-image"/> <div class="mb-image-card-footer"><span> </span></div></div>`);function nZ(e,t){Yr(t,!0);function n(e,n){e.key===` `&&t.onSelect(n)}var r=tZ(),i=U(r),a=G(i,2),o=U(a),s=U(o,!0);H(o),H(a),H(r),Ra(e=>{Fs(i,`src`,e),Fs(i,`alt`,t.image),Jo(s,t.image)},[()=>t.mb.internal.imagePathToUri(t.image)]),Io(`click`,r,()=>t.onSelect(t.image)),Io(`keydown`,r,e=>n(e,t.image)),J(e,r),Xr()}Lo([`click`,`keydown`]);var rZ=q(`<!> <!>`,1),iZ=q(`<div class="mb-image-modal-header"><input type="text" placeholder="Search images..."/></div> <div class="mb-image-card-grid"></div> <!>`,1);function aZ(e,t){Yr(t,!0);let n=ea(``),r=t.mb.internal.createFuzzySearch(),i=Ui(()=>K(n)?(r.setSearch(K(n)),r.filterItems(t.options,e=>e.value)):t.options);var a=iZ(),o=W(a),s=U(o);Ms(s),H(o);var c=G(o,2);os(c,21,()=>K(i),ns,(e,n)=>{nZ(e,{get mb(){return t.mb},get image(){return K(n).value},get onSelect(){return t.onSelect}})}),H(c),RX(G(c,2),{children:(e,n)=>{var r=rZ(),i=W(r),a=e=>{Dh(e,{get variant(){return Nt.PRIMARY},onclick:()=>t.onSelect(void 0),children:(e,t)=>{Ir(),J(e,Ko(`Select none`))},$$slots:{default:!0}})};ts(i,e=>{t.canSelectNone&&e(a)}),Dh(G(i,2),{onclick:()=>t.onCancel(),children:(e,t)=>{Ir(),J(e,Ko(`Cancel`))},$$slots:{default:!0}}),J(e,r)},$$slots:{default:!0}}),zs(s,()=>K(n),e=>na(n,e)),J(e,a),Xr()}var oZ=class extends YY{component;createComponent;constructor(e){super(),this.createComponent=e}onMount(e){Dt.empty(e),this.component=this.createComponent(this,e)}onUnmount(e){this.component&&$o(this.component),Dt.empty(e)}},sZ=q(`<textarea></textarea>`),cZ=q(`<input type="text"/>`),lZ=q(`<!> <!>`,1),uZ=q(`<p> </p> <div class="mb-full-width-text-input"><!></div> <!>`,1);function dZ(e,t){Yr(t,!0);let n=ea(sa(t.options.value));var r=uZ(),i=W(r),a=U(i,!0);H(i);var o=G(i,2),s=U(o),c=e=>{var t=sZ();Sa(t),zs(t,()=>K(n),e=>na(n,e)),J(e,t)},l=e=>{var t=cZ();Ms(t),zs(t,()=>K(n),e=>na(n,e)),J(e,t)};ts(s,e=>{t.options.multiline?e(c):e(l,-1)}),H(o),RX(G(o,2),{children:(e,r)=>{var i=lZ(),a=W(i);Dh(a,{get variant(){return Nt.PRIMARY},onclick:()=>t.options.onSubmit(Gr(K(n))),children:(e,t)=>{Ir(),J(e,Ko(`OK`))},$$slots:{default:!0}}),Dh(G(a,2),{onclick:()=>t.options.onCancel(),children:(e,t)=>{Ir(),J(e,Ko(`Cancel`))},$$slots:{default:!0}}),J(e,i)},$$slots:{default:!0}}),Ra(()=>Jo(a,t.options.subTitle)),J(e,r),Xr()}var fZ=class{mb;selectCallback;constructor(e,t){this.mb=e,this.selectCallback=t}onSelected(e){this.selectCallback(e)}},pZ=class extends fZ{getItemText(e){return e.name}getItemDescription(e){}getItems(){return this.mb.internal.getAllCommands()}},mZ=class extends fZ{filterFunction;constructor(e,t,n){super(e,t),this.filterFunction=n}getItemText(e){return e}getItemDescription(e){}getItems(){return this.filterFunction===void 0?this.mb.file.getAllFiles():this.mb.file.getAllFiles().filter(e=>this.filterFunction(e))}},hZ=class extends fZ{getItemText(e){return e}getItemDescription(e){}getItems(){return this.mb.file.getAllFolders()}},gZ=class extends fZ{ipf;constructor(e,t,n){super(e,t),this.ipf=n}getItemText(e){return e.displayValue}getItemDescription(e){return e.displayDescription}getItems(){return this.mb.internal.getSuggesterOptions(this.ipf)}},_Z=q(`<pre class="mb-pre"><code class="language-none mb-none"> </code></pre>`),vZ=q(`<tr><td>Tip</td><td> </td></tr>`),yZ=q(`<a> </a><br/>`,1),bZ=q(`<tr><td>Docs</td><td></td></tr>`),xZ=q(`<tr><td>Context</td><td><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></td></tr>`),SZ=q(`<div class="mb-card mb-card-full-width markdown-rendered"><h6><span> </span> </h6> <!> <table><tbody><tr><td>Cause</td><td> </td></tr><tr><td>Effect</td><td> </td></tr><!><!><!></tbody></table></div>`),CZ=q(`<div class="mb-card"><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></div>`);function wZ(e,t){Yr(t,!0);var n=qo(),r=W(n),i=e=>{var n=SZ(),r=U(n),i=U(r),a=U(i);H(i);var o=G(i);H(r);var s=G(r,2),c=e=>{var n=_Z(),r=U(n),i=U(r,!0);H(r),H(n),Ra(()=>Jo(i,t.error.positionContext)),J(e,n)};ts(s,e=>{t.error.positionContext&&e(c)});var l=G(s,2),u=U(l),d=U(u),f=G(U(d)),p=U(f,!0);H(f),H(d);var m=G(d),h=G(U(m)),g=U(h,!0);H(h),H(m);var _=G(m),v=e=>{var n=vZ(),r=G(U(n)),i=U(r,!0);H(r),H(n),Ra(()=>Jo(i,t.error.tip)),J(e,n)};ts(_,e=>{t.error.tip&&e(v)});var y=G(_),b=e=>{var n=bZ(),r=G(U(n));os(r,21,()=>t.error.docs,ns,(e,t)=>{var n=yZ(),r=W(n),i=U(r,!0);H(r),Ir(),Ra(()=>{Fs(r,`href`,K(t)),Jo(i,K(t))}),J(e,n)}),H(r),H(n),J(e,n)};ts(y,e=>{t.error.docs&&e(b)});var x=G(y),S=e=>{var n=xZ(),r=G(U(n)),i=U(r),a=U(i),o=U(a,!0);H(a),H(i),H(r),H(n),Ra(e=>Jo(o,e),[()=>JSON.stringify(t.error.context,null,4)]),J(e,n)};ts(x,e=>{t.error.context&&e(S)}),H(u),H(l),H(n),Ra(e=>{xs(i,1,hs(t.error.errorLevel===P.WARNING?`mb-warning-text`:`mb-error-text`)),Jo(a,`${t.error.errorLevel??``}
[${e??``}]`),Jo(o,` - ${t.error.effect??``}`),Jo(p,t.error.cause),Jo(g,t.error.effect)},[()=>t.error.getErrorType()]),J(e,n)},a=e=>{var n=CZ(),r=U(n),i=U(r),a=U(i,!0);H(i),H(r),H(n),Ra(()=>Jo(a,t.error.stack)),J(e,n)};ts(r,e=>{t.error instanceof I?e(i):e(a,-1)}),J(e,n),Xr()}var TZ=q(`<p> </p>`),EZ=q(`<pre class="mb-pre"><code class="language-none meta-bind-none"> </code></pre>`),DZ=q(`<p> </p>`),OZ=q(`<h6>Errors</h6> <!> <!>`,1),kZ=q(`<p> </p>`),AZ=q(`<h6>Warnings</h6> <!> <!>`,1),jZ=q(`<!> <!> <!> <!>`,1);function MZ(e,t){Yr(t,!0);var n=jZ(),r=W(n),i=e=>{var n=TZ(),r=U(n,!0);H(n),Ra(()=>Jo(r,t.settings.text)),J(e,n)};ts(r,e=>{t.settings.text&&e(i)});var a=G(r,2),o=e=>{var n=EZ(),r=U(n),i=U(r,!0);H(r),H(n),Ra(()=>Jo(i,t.settings.code)),J(e,n)};ts(a,e=>{t.settings.code&&e(o)});var s=G(a,2),c=e=>{var n=OZ(),r=G(W(n),2),i=e=>{var n=DZ(),r=U(n,!0);H(n),Ra(()=>Jo(r,t.settings.errorText)),J(e,n)};ts(r,e=>{t.settings.errorText&&e(i)}),os(G(r,2),17,()=>t.settings.errorCollection.getErrors(),ns,(e,t)=>{wZ(e,{get error(){return K(t)}})}),J(e,n)},l=Ui(()=>t.settings.errorCollection.hasErrors());ts(s,e=>{K(l)&&e(c)});var u=G(s,2),d=e=>{var n=AZ(),r=G(W(n),2),i=e=>{var n=kZ(),r=U(n,!0);H(n),Ra(()=>Jo(r,t.settings.warningText)),J(e,n)};ts(r,e=>{t.settings.warningText&&e(i)}),os(G(r,2),17,()=>t.settings.errorCollection.getWarnings(),ns,(e,t)=>{wZ(e,{get error(){return K(t)}})}),J(e,n)},f=Ui(()=>t.settings.errorCollection.hasWarnings());ts(u,e=>{K(f)&&e(d)}),J(e,n),Xr()}var NZ=q(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" x2="12" y1="8" y2="12"></line><line x1="12" x2="12.01" y1="16" y2="16"></line></svg> <span class="mb-error">[META_BIND_ERROR]</span>`,1),PZ=Go(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-triangle"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path><line x1="12" x2="12" y1="9" y2="13"></line><line x1="12" x2="12.01" y1="17" y2="17"></line></svg>`),FZ=Go(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-info"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path></svg>`),IZ=q(`<div class="mb-error-collection" role="button" tabindex="0" aria-label="Click to view errors and warnings"><!></div>`);function LZ(e,t){Yr(t,!0);function n(){t.mb.internal.openErrorCollectionViewModal(t.settings)}var r=qo(),i=W(r),a=e=>{var r=IZ(),i=U(r),a=e=>{var t=NZ();Ir(2),J(e,t)},o=Ui(()=>t.settings.errorCollection.hasErrors()),s=e=>{J(e,PZ())},c=Ui(()=>t.settings.errorCollection.hasWarnings()),l=e=>{J(e,FZ())};ts(i,e=>{K(o)?e(a):K(c)?e(s,1):e(l,-1)}),H(r),Io(`click`,r,()=>n()),Io(`keydown`,r,e=>{e.key===` `&&n()}),J(e,r)},o=Ui(()=>!t.settings.errorCollection.isEmpty());ts(i,e=>{K(o)&&e(a)}),J(e,r),Xr()}Lo([`click`,`keydown`]);var RZ=[`apng`,`avif`,`gif`,`jpg`,`jpeg`,`jfif`,`pjpeg`,`pjp`,`png`,`svg`,`webp`],zZ=RZ.map(e=>`.${e}`),BZ=class{mb;constructor(e){this.mb=e}openCommandSelectModal(e){this.createSearchModal(new pZ(this.mb,e)).open()}openFileSelectModal(e){this.createSearchModal(new mZ(this.mb,e)).open()}openFilteredFileSelectModal(e,t){this.createSearchModal(new mZ(this.mb,e,t)).open()}openMarkdownFileSelectModal(e){this.openFilteredFileSelectModal(e,e=>e.endsWith(`.md`))}openImageFileSelectModal(e){this.openFilteredFileSelectModal(e,e=>zZ.some(t=>e.endsWith(t)))}openFolderSelectModal(e){this.createSearchModal(new hZ(this.mb,e)).open()}openButtonBuilderModal(e){this.createModal(new eZ(this.mb,e),{title:`Meta Bind Button Builder`}).open()}openSuggesterModal(e,t){this.createSearchModal(new gZ(this.mb,t,e)).open()}openImageSuggesterModal(e,t,n){this.createModal(new oZ((r,i)=>Yo(aZ,{target:i,props:{mb:this.mb,options:this.getImageSuggesterOptions(e),canSelectNone:t,onSelect:e=>{n(e),r.closeModal()},onCancel:()=>{r.closeModal()}}})),{title:`Select an image from your Vault`,classes:[`mb-image-suggester-modal`]}).open()}openDatePickerModal(e,t){this.createModal(new oZ((n,r)=>Yo(JY,{target:r,props:{selectedDate:e,dateChangeCallback:e=>{t(e),n.closeModal()}}})),{title:`Meta Bind date picker`}).open()}openTextPromptModal(e){this.createModal(new oZ((t,n)=>Yo(dZ,{target:n,props:{options:{...e,onSubmit:n=>{e.onSubmit(n),t.closeModal()},onCancel:()=>{e.onCancel(),t.closeModal()}}}})),e).open()}openErrorCollectionViewModal(e){this.createModal(new oZ((t,n)=>Yo(MZ,{target:n,props:{settings:e}})),{title:`Meta Bind error overview`,classes:[`mb-error-collection-modal`,`markdown-rendered`]}).open()}createErrorIndicator(e,t){let n=Yo(LZ,{target:e,props:{mb:this.mb,settings:t}});return()=>{$o(n)}}},VZ=class{preparedSearch;constructor(){}setSearch(e){this.preparedSearch=(0,u.prepareFuzzySearch)(e)}filterItems(e,t){return this.preparedSearch?e.filter(e=>this.preparedSearch?.(t(e))?.score!=null):e}},HZ=class{value;displayValue;displayDescription;constructor(e,t,n){this.value=e,this.displayValue=t,this.displayDescription=n}valueAsString(){return this.value?.toString()??`null`}};function UZ(e){let t=[];for(let n of e.children)n instanceof u.TFile&&GZ(n.extension)&&t.push(new HZ(n.path,n.name)),n instanceof u.TFolder&&t.push(...UZ(n));return t}function WZ(e,t,n){let r=[];for(let t of n){let n=t.value;if(n.startsWith(`"`)&&n.endsWith(`"`))n=n.substring(1,n.length-1);else{let e=new z({errorLevel:P.ERROR,effect:`failed to get suggest options`,cause:`expected suggest option query for image suggester to start and end with double quotation marks`});new u.Notice(`meta-bind | ${e.message}`),console.warn(e);continue}let i;if(i=n===``||n===`.`?e.app.vault.getRoot():e.app.vault.getAbstractFileByPath(n),i==null){let e=new z({errorLevel:P.ERROR,effect:`failed to get suggest options`,cause:`expected suggest option query ${n} for image suggester to exist`});new u.Notice(`meta-bind | ${e.message}`),console.warn(e);continue}if(!(i instanceof u.TFolder)){let e=new z({errorLevel:P.ERROR,effect:`failed to get suggest options`,cause:`expected suggest option query ${t.value} for image suggester to be a folder`});new u.Notice(`meta-bind | ${e.message}`),console.warn(e);continue}r.push(...UZ(i))}for(let n of t){let t=dn(n.value);if(!t){let e=new z({errorLevel:P.ERROR,effect:`failed to get suggest options`,cause:`expected suggest option ${n.value} to be truthy`});new u.Notice(`meta-bind | ${e.message}`),console.warn(e);continue}let i=e.app.vault.getAbstractFileByPath(t);if(!i){let e=new z({errorLevel:P.ERROR,effect:`failed to get suggest options`,cause:`expected suggest option ${n.value} for image suggester to exist`});new u.Notice(`meta-bind | ${e.message}`),console.warn(e);continue}if(!(i instanceof u.TFile)){let e=new z({errorLevel:P.ERROR,effect:`failed to get suggest options`,cause:`expected suggest option ${n.value} for image suggester to be a file`});new u.Notice(`meta-bind | ${e.message}`),console.warn(e);continue}if(!GZ(i.extension)){let e=new z({errorLevel:P.ERROR,effect:`failed to get suggest options`,cause:`expected suggest option ${n.value} for image suggester to be an image file`});new u.Notice(`meta-bind | ${e.message}`),console.warn(e);continue}r.push(new HZ(i.path,i.name))}return r}function GZ(e){return RZ.contains(e)}function KZ(e,t){return WZ(e,t.mountable.getArguments(V.OPTION),t.mountable.getArguments(V.OPTION_QUERY))}var qZ=class extends u.Modal{content;options;constructor(e,t,n){super(e.app),this.options=n,this.content=t,t.setModal(this)}onOpen(){this.options?.title&&this.titleEl.setText(this.options.title),this.options?.classes&&Dt.addClasses(this.modalEl,this.options.classes),this.content.mount(this.contentEl)}onClose(){this.content.unmount()}},JZ=class extends u.FuzzySuggestModal{content;constructor(e,t){super(e.app),this.content=t}renderSuggestion(e,t){(0,u.renderResults)(t.createDiv(),this.content.getItemText(e.item),e.match);let n=this.content.getItemDescription(e.item);n&&(0,u.renderResults)(t.createEl(`small`,{cls:`mb-search-modal-element-description`}),n,{score:0,matches:[]})}getItems(){return this.content.getItems()}getItemText(e){return this.content.getItemText(e)}onChooseItem(e,t){this.content.onSelected(e)}};function YZ(e,t,n,r,i){let a=[];for(let e of n)a.push(new HZ(e.value,e.name,`option`));if(r.length>0){let n;try{n=FY(e)}catch(e){return new u.Notice(`meta-bind | Dataview needs to be installed and enabled to use suggest option queries. Check the console for more information.`),console.warn(`meta-bind | failed to get dataview api`,e),a}let o=GC({name:lC().min(1),path:lC().min(1)});for(let e of r)n.pages(e.value,t).forEach(e=>{try{let t=e.file;if(!o.safeParse(t).success)return;let n=kT(t.path,t.name,i);a.push(new HZ(n,t.name,`file: ${t.path}`))}catch(e){console.warn(`meta-bind | error while computing suggest options`,e)}})}return a}function XZ(e,t){let n=t.mountable.getArguments(V.OPTION),r=t.mountable.getArguments(V.OPTION_QUERY),i=t.mountable.getArgument(V.USE_LINKS);return YZ(e,t.mountable.getFilePath(),n,r,i===void 0?Dn.TRUE:i.value)}var ZZ=class{menu;constructor(){this.menu=new u.Menu}setItems(e){for(let t of e)this.menu.addItem(e=>{e.setTitle(t.name),t.icon&&e.setIcon(t.icon),t.warning&&e.setWarning(t.warning),e.onClick(t.onclick)})}show(e,t){this.menu.showAtPosition({x:e,y:t},document)}showWithEvent(e){this.menu.showAtMouseEvent(e),e.stopImmediatePropagation(),e.preventDefault()}},QZ=class{mb;containerEl;filePath;jsEngine;code;hidden;renderComponent;constructor(e,t,n,r,i){this.mb=e,this.containerEl=t,this.filePath=n,this.code=r,this.hidden=i,this.jsEngine=IY(this.mb),this.renderComponent=new u.Component}async evaluateCode(e){let t=await this.jsEngine.internal.getContextForMarkdownOther(this.filePath);return this.jsEngine.internal.execute({code:this.code,context:t,container:this.containerEl,component:this.renderComponent,contextOverrides:e})}async evaluate(e){try{Dt.empty(this.containerEl),Dt.removeClass(this.containerEl,`mb-error`),this.renderComponent.unload(),this.renderComponent=new u.Component,this.renderComponent.load();let t=await this.evaluateCode(e),n=this.jsEngine.internal.createRenderer(this.containerEl,this.filePath,this.renderComponent);return this.hidden||await n.render(t.result),n.convertToSimpleObject(t.result)}catch(e){e instanceof Error&&(this.containerEl.innerText=e.message,Dt.addClass(this.containerEl,`mb-error`));return}}unload(){this.renderComponent.unload()}},$Z=class extends BZ{omb;app;constructor(e){super(e),this.omb=e,this.app=e.app}getLifecycleHookValidator(){return Ow(u.Component)}getImageSuggesterOptions(e){return KZ(this.omb,e)}getSuggesterOptions(e){return XZ(this.omb,e)}async renderMarkdown(e,t,n){let r=new u.Component;return r.load(),await u.MarkdownRenderer.render(this.app,e,t,n,r),()=>r.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return IY(this.omb),!0}catch{return!1}}async jsEngineRunFile(e,t,n,r){let i=IY(this.omb),a=await i.internal.getContextForMarkdownCallingJSFile(t,e),o=new u.Component;return await i.internal.executeFile(e,{component:o,container:r,context:a,contextOverrides:n}),()=>o.unload()}async jsEngineRunCode(e,t,n,r){let i=IY(this.omb),a=await i.internal.getContextForMarkdownOther(t),o=new u.Component;return await i.internal.execute({code:e,component:o,container:r,context:a,contextOverrides:n}),()=>o.unload()}createJsRenderer(e,t,n,r){return new QZ(this.omb,e,t,n,r)}showNotice(e){new u.Notice(e)}parseYaml(e){return(0,u.parseYaml)(e)}stringifyYaml(e){return(0,u.stringifyYaml)(e)}setIcon(e,t){(0,u.setIcon)(e,t)}imagePathToUri(e){return this.app.vault.adapter.getResourcePath(e)}createModal(e,t){return new qZ(this.omb,e,t)}createSearchModal(e){return new JZ(this.omb,e)}getAllCommands(){return this.app.commands.listCommands().map(e=>({id:e.id,name:e.name}))}createFuzzySearch(){return new VZ}createContextMenu(e){let t=new ZZ;return t.setItems(e),t}async evaluateTemplaterTemplate(e,t){let n=RY(this.omb),r=this.app.vault.getAbstractFileByPath(e);if(!r||!(r instanceof u.TFile))throw Error(`Template file not found: ${e}`);let i=this.app.vault.getAbstractFileByPath(t);if(!i||!(i instanceof u.TFile))throw Error(`Target file not found: ${t}`);let a=n.create_running_config(r,i,LY.DynamicProcessor);return await n.read_and_parse_template(a)}async createNoteWithTemplater(e,t,n,r=!1,i=!1){let a=RY(this.omb),o=this.app.vault.getAbstractFileByPath(e);if(!o||!(o instanceof u.TFile))throw Error(`Template file not found: ${e}`);let s;if(t!==void 0){let e=this.app.vault.getAbstractFileByPath(t);if(!e||!(e instanceof u.TFolder))throw Error(`Folder not found: ${t}`);s=e}let c=await a.create_new_note_from_template(o,s,n,!1);return r&&c&&await this.mb.file.openInSourceMode(c,i),c?.path}},eQ=class extends mJ{mb;constructor(e,t,n){super(t,n),this.mb=e,this.mb.plugin.registerEvent(this.mb.app.metadataCache.on(`changed`,(e,t,n)=>{this.manager.onExternalUpdate(this,e.path,structuredClone(n.frontmatter)??{})}))}readExternal(e){let t=this.mb.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof u.TFile))throw new L({errorLevel:P.CRITICAL,effect:`can not get default cache item`,cause:`no file for path "${e}" found or path is not a file`});let n=this.mb.app.metadataCache.getFileCache(t)?.frontmatter;return structuredClone(n)??{}}getDefaultCacheItem(e){let t=this.mb.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof u.TFile))throw new L({errorLevel:P.CRITICAL,effect:`can not get default cache item`,cause:`no file for path "${e}" found or path is not a file`});let n=this.mb.app.metadataCache.getFileCache(t)?.frontmatter;return{data:structuredClone(n)??{},storagePath:e,file:t,...this.manager.constructDefaultCacheItem()}}async syncExternal(e){return this.mb.app.fileManager.processFrontMatter(e.file,t=>{Object.assign(t,e.data)})}},tQ=class extends M{ctx;element;constructor(e,t){super(void 0),this.ctx=e,this.element=t}getPosition(){let e=this.ctx.getSectionInfo(this.element);if(e)return{lineStart:e.lineStart,lineEnd:e.lineEnd}}};function nQ(e,t){Yr(t,!0);let n=new yY(t.mb,St(),``,A.BLOCK,t.declaration);xY(e,{get mountable(){return n}}),Xr()}var rQ=q(`<div class="mb-card"><h3> </h3> <!> <!> <code> </code></div>`);function iQ(e,t){Yr(t,!0);let n=t.mb.api.createInlineFieldFromString(t.declaration.inputField,``,void 0,A.BLOCK),r=t.mb.api.createInlineFieldFromString(t.declaration.declaration,``,void 0,A.BLOCK);var i=rQ(),a=U(i),o=U(a,!0);H(a);var s=G(a,2);xY(s,{get mountable(){return n}});var c=G(s,2);xY(c,{get mountable(){return r}});var l=G(c,2),u=U(l,!0);H(l),H(i),Ra(()=>{Jo(o,t.declaration.title),Jo(u,t.declaration.display)}),J(e,i),Xr()}var aQ=q(`<h1>Meta Bind Playground</h1> <span><!> <!> <!></span>`,1),oQ=q(`<div class="mb-faq-view markdown-rendered"><!> <h2>Quick Reference</h2> <h3>Error Messages</h3> <p>When creating <a>Input Fields</a> or <a>View Fields</a> <strong>warnings</strong> ( <!> ) and <strong>errors</strong> ( <!> ) can occur. These are <strong>clickable</strong> and will show a modal with detailed information about the error
when clicked.</p> <h3>Unloaded Message</h3> <p>A message like this <span class="mb-warning">[MB_UNLOADED] ...</span> means that Obsidian told Meta Bind to unload
the field that was once displayed there. This usually happens when Meta Bind was disabled, such as after a plugin
update, or when another plugin is interfering with Meta Bind.</p> <p>Usually reopening the note or restarting Obsidian causes the field to display normally again.</p> <h3>Bind Targets</h3> <p><a href="https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/inputfields/#binding-to-metadata">Bind Targets</a> let the plugin know what frontmatter properties to bind <a>Input Fields</a> and <a>View Fields</a> to.</p> <h2>Playground</h2> <h3>Input Fields</h3> <p><a>Input Fields</a> let you change the frontmatter of your notes from inside
of notes.</p> <!> <h3>View Fields</h3> <p><a>View Fields</a> let you view and perform calculations using the frontmatter
of your notes from inside of notes. They will update instantly to reflect changes to the frontmatter made by input
fields and as fast as obsidian allows it for changes from other sources.</p> <!></div>`);function sQ(e,t){Yr(t,!0);let n=sa(new Cn(`exampleWarningErrorCollection`)),r=sa(new Cn(`exampleErrorErrorCollection`));Gs(()=>{n.add(new ie({errorLevel:P.WARNING,effect:`some example warning`,cause:`some example reason`})),r.add(new ie({errorLevel:P.ERROR,effect:`some example error`,cause:`some example reason`}))});var i=oQ(),a=U(i);IX(a,{children:(e,t)=>{var n=aQ(),r=G(W(n),2),i=U(r);Dh(i,{get variant(){return Nt.PRIMARY},onclick:()=>{Qg.open(Qg.linkToHome())},children:(e,t)=>{Ir(),J(e,Ko(`Docs`))},$$slots:{default:!0}});var a=G(i,2);Dh(a,{onclick:()=>{Qg.open(Qg.linkToGithub())},children:(e,t)=>{Ir(),J(e,Ko(`GitHub`))},$$slots:{default:!0}}),Dh(G(a,2),{onclick:()=>{Qg.open(Qg.linkToIssues())},children:(e,t)=>{Ir(),J(e,Ko(`Report Issue`))},$$slots:{default:!0}}),H(r),J(e,n)},$$slots:{default:!0}});var o=G(a,6),s=G(U(o)),c=G(s,2),l=G(c,4);{let e=Ui(()=>({errorCollection:n,code:`INPUT[someInputFieldDeclaration]`}));LZ(l,{get mb(){return t.mb},get settings(){return K(e)}})}var u=G(l,4);{let e=Ui(()=>({errorCollection:r,code:`INPUT[someInputFieldDeclaration]`}));LZ(u,{get mb(){return t.mb},get settings(){return K(e)}})}Ir(3),H(o);var d=G(o,10),f=G(U(d),2),p=G(f,2);Ir(),H(d);var m=G(d,6),h=U(m);Ir(),H(m);var g=G(m,2);os(g,17,()=>jJ(t.mb),ns,(e,n)=>{nQ(e,{get declaration(){return K(n)[1]},get mb(){return t.mb}})});var _=G(g,4),v=U(_);Ir(),H(_),os(G(_,2),17,()=>Object.values(AJ),ns,(e,n)=>{var r=qo();os(W(r),17,()=>K(n),ns,(e,n)=>{iQ(e,{get declaration(){return K(n)},get mb(){return t.mb}})}),J(e,r)}),H(i),Ra((e,t,n,r,i,a)=>{Fs(s,`href`,e),Fs(c,`href`,t),Fs(f,`href`,n),Fs(p,`href`,r),Fs(h,`href`,i),Fs(v,`href`,a)},[()=>Qg.linkToInputFields(),()=>Qg.linkToViewFields(),()=>Qg.linkToInputFields(),()=>Qg.linkToViewFields(),()=>Qg.linkToInputFields(),()=>Qg.linkToViewFields()]),J(e,i),Xr()}var cQ=`mb-playground-view-type`,lQ=class extends u.ItemView{component;mb;constructor(e,t){super(e),this.mb=t}getViewType(){return cQ}getDisplayText(){return`Meta Bind playground`}async onOpen(){this.contentEl.empty(),this.component=Yo(sQ,{target:this.contentEl,props:{mb:this.mb}})}async onClose(){this.component&&$o(this.component)}},uQ=q(`<span> </span> <!> <!> <!>`,1),dQ=q(`<div class="mb-card markdown-rendered"><!> <pre class="mb-pre"><code class="mb-none"> </code></pre></div>`);function fQ(e,t){Yr(t,!0);let n=Ws(t,`template`,15);function r(){t.mb.internal.openButtonBuilderModal({submitText:`Submit`,config:Gr(n()),onOkay:e=>{n(e)}})}function i(){let e=(0,u.stringifyYaml)(Gr(n()));navigator.clipboard.writeText(e),new u.Notice(`meta-bind | Copied to clipboard`)}var a=dQ(),o=U(a);IX(o,{stretchChildren:!0,children:(e,a)=>{var o=uQ(),s=W(o),c=U(s,!0);H(s);var l=G(s,2);Dh(l,{onclick:()=>r(),get variant(){return Nt.PRIMARY},tooltip:`Edit`,children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`pen-line`})},$$slots:{default:!0}});var u=G(l,2);Dh(u,{onclick:()=>i(),get variant(){return Nt.DEFAULT},tooltip:`Copy`,children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`copy`})},$$slots:{default:!0}}),Dh(G(u,2),{onclick:()=>t.onDelete(n()),get variant(){return Nt.DESTRUCTIVE},tooltip:`Delete`,children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`x`})},$$slots:{default:!0}}),Ra(()=>Jo(c,n().id)),J(e,o)},$$slots:{default:!0}});var s=G(o,2),c=U(s),l=U(c,!0);H(c),H(s),H(a),Ra(e=>Jo(l,e),[()=>(0,u.stringifyYaml)(n())]),J(e,a),Xr()}var pQ=q(`<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>`),mQ=q(`<!> <!>`,1),hQ=q(`<div><h2>Meta Bind Button Templates</h2> <!> <!> <!> <!> <!></div>`);function gQ(e,t){Yr(t,!0);let n=ea(void 0),r=ea(sa(t.buttonConfigs));function i(e){na(r,K(r).filter(t=>t!==e),!0)}function a(){K(r).push(t.modal.mb.buttonActionRunner.createDefaultButtonConfig())}async function o(){let e;try{e=(0,u.parseYaml)(await navigator.clipboard.readText())}catch(e){console.warn(e),new u.Notice(`meta-bind | Can not parse button config. Check your button syntax. See the console for more details.`);return}let t=oT.safeParse(e);if(!t.success){let e=Rw(t.error);console.warn(new ae({errorLevel:P.ERROR,effect:`can not parse button config`,cause:`zod validation failed. Check your button syntax`,positionContext:e,docs:[Qg.linkToButtonConfig()]})),new u.Notice(`meta-bind | Can not parse button config. Check your button syntax. See the console for more details.`);return}K(r).push(e)}function s(){na(n,t.modal.save(Gr(K(r))),!0),K(n)===void 0&&t.modal.close()}function c(){t.modal.close()}var l=hQ(),d=G(U(l),2);os(d,17,()=>K(r),ns,(e,n,a)=>{fQ(e,{get mb(){return t.modal.mb},onDelete:i,get template(){return K(r)[a]},set template(e){K(r)[a]=e}})});var f=G(d,2);Dh(f,{onclick:()=>a(),get variant(){return Nt.PRIMARY},tooltip:`Create new template`,children:(e,t)=>{Ir(),J(e,Ko(`Add Template`))},$$slots:{default:!0}});var p=G(f,2);Dh(p,{onclick:()=>o(),get variant(){return Nt.DEFAULT},tooltip:`Create new template from YAML in clipboard`,children:(e,t)=>{Ir(),J(e,Ko(`Add Template from Clipboard`))},$$slots:{default:!0}});var m=G(p,2),h=e=>{var t=pQ(),r=G(U(t),2);{let e=Ui(()=>({errorCollection:K(n)}));MZ(r,{get settings(){return K(e)}})}H(t),J(e,t)};ts(m,e=>{K(n)&&e(h)}),RX(G(m,2),{children:(e,t)=>{var n=mQ(),r=W(n);Dh(r,{onclick:()=>s(),get variant(){return Nt.PRIMARY},tooltip:`Save changes`,children:(e,t)=>{Ir(),J(e,Ko(`Save`))},$$slots:{default:!0}}),Dh(G(r,2),{onclick:()=>c(),tooltip:`Revert changes`,children:(e,t)=>{Ir(),J(e,Ko(`Cancel`))},$$slots:{default:!0}}),J(e,n)},$$slots:{default:!0}}),H(l),J(e,l),Xr()}var _Q=class extends u.Modal{mb;component;constructor(e,t){super(e),this.mb=t}onOpen(){this.contentEl.empty(),this.component&&$o(this.component),this.component=Yo(gQ,{target:this.contentEl,props:{buttonConfigs:structuredClone(this.mb.getSettings().buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&$o(this.component)}save(e){let t=this.mb.buttonManager.setButtonTemplates(e);if(t.hasErrors())return t;this.mb.updateSettings(t=>{t.buttonTemplates=e})}},vQ=q(`<tr><td class="mb-excluded-folders-table-input-cell"><input type="text" placeholder="path/to/folder"/></td><td><!></td></tr>`),yQ=q(`<div><h3 class="mod-error">Some folder paths are invalid</h3> <!></div>`),bQ=q(`<!> <!>`,1),xQ=q(`<div><table class="mb-excluded-folders-table"><thead><tr><th>Folder Path</th><th></th></tr></thead><tbody></tbody></table> <!> <!> <!></div>`);function SQ(e,t){Yr(t,!0);let n=ea(void 0),r=ea(sa(t.excludedFolders));function i(e){na(r,K(r).filter(t=>t!==e),!0)}function a(){K(r).push(``)}function o(){na(n,t.modal.save(Gr(K(r))),!0),K(n)===void 0&&t.modal.close()}function s(){t.modal.close()}var c=xQ(),l=U(c),u=G(U(l));os(u,21,()=>K(r),ns,(e,n,a)=>{var o=vQ(),s=U(o),c=U(s);Ms(c),H(s);var l=G(s);Dh(U(l),{onclick:()=>i(K(n)),tooltip:`Delete`,children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`x`})},$$slots:{default:!0}}),H(l),H(o),zs(c,()=>K(r)[a],e=>K(r)[a]=e),J(e,o)}),H(u),H(l);var d=G(l,2);Dh(d,{onclick:()=>a(),get variant(){return Nt.PRIMARY},tooltip:`Add new excluded folder`,children:(e,t)=>{Ir(),J(e,Ko(`Add folder`))},$$slots:{default:!0}});var f=G(d,2),p=e=>{var t=yQ(),r=G(U(t),2);{let e=Ui(()=>({errorCollection:K(n)}));MZ(r,{get settings(){return K(e)}})}H(t),J(e,t)};ts(f,e=>{K(n)&&e(p)}),RX(G(f,2),{children:(e,t)=>{var n=bQ(),r=W(n);Dh(r,{onclick:()=>o(),get variant(){return Nt.PRIMARY},tooltip:`Save changes`,children:(e,t)=>{Ir(),J(e,Ko(`Save`))},$$slots:{default:!0}}),Dh(G(r,2),{onclick:()=>s(),tooltip:`Revert changes`,children:(e,t)=>{Ir(),J(e,Ko(`Cancel`))},$$slots:{default:!0}}),J(e,n)},$$slots:{default:!0}}),H(c),J(e,c),Xr()}var CQ=class extends u.Modal{mb;component;constructor(e,t){super(e),this.mb=t}onOpen(){this.contentEl.empty(),this.component&&$o(this.component),this.component=Yo(SQ,{target:this.contentEl,props:{excludedFolders:structuredClone(this.mb.getSettings().excludedFolders),modal:this,mb:this.mb}})}onClose(){this.contentEl.empty(),this.component&&$o(this.component)}save(e){for(let t of e)if(t===``){let e=new Cn(`Excluded folders`);return e.add(Error(`Invalid Folder Path '${t}'. Folder path may not be empty.`)),e}this.mb.updateSettings(t=>{t.excludedFolders=e})}},wQ=q(`<input type="text" placeholder="template-name"/> <!>`,1),TQ=q(`<div class="mb-card"><!> <textarea placeholder="INPUT[slider(addLabels)]" class="mb-textarea"></textarea></div>`);function EQ(e,t){Yr(t,!0);let n=Ws(t,`template`,15);var r=TQ(),i=U(r);IX(i,{children:(e,r)=>{var i=wQ(),a=W(i);Ms(a),Dh(G(a,2),{onclick:()=>t.onDelete(n()),get variant(){return Nt.DESTRUCTIVE},tooltip:`Delete Template`,children:(e,n)=>{ph(e,{get mb(){return t.mb},iconName:`x`})},$$slots:{default:!0}}),zs(a,()=>n().name,e=>n(n().name=e,!0)),J(e,i)},$$slots:{default:!0}});var a=G(i,2);Sa(a),H(r),zs(a,()=>n().declaration,e=>n(n().declaration=e,!0)),J(e,r),Xr()}var DQ=q(`<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>`),OQ=q(`<!> <!>`,1),kQ=q(`<div><h2>Meta Bind Input Field Templates</h2> <!> <!> <!> <!></div>`);function AQ(e,t){Yr(t,!0);let n=ea(void 0),r=ea(sa(t.inputFieldTemplates));function i(e){na(r,K(r).filter(t=>t!==e),!0)}function a(){K(r).push({name:``,declaration:``})}function o(){na(n,t.modal.save(Gr(K(r))),!0),K(n)===void 0&&t.modal.close()}function s(){t.modal.close()}var c=kQ(),l=G(U(c),2);os(l,17,()=>K(r),ns,(e,n)=>{EQ(e,{get mb(){return t.modal.mb},get template(){return K(n)},onDelete:i})});var u=G(l,2);Dh(u,{onclick:()=>a(),get variant(){return Nt.PRIMARY},tooltip:`Create New Template`,children:(e,t)=>{Ir(),J(e,Ko(`Add Template`))},$$slots:{default:!0}});var d=G(u,2),f=e=>{var t=DQ(),r=G(U(t),2);{let e=Ui(()=>({errorCollection:K(n)}));MZ(r,{get settings(){return K(e)}})}H(t),J(e,t)};ts(d,e=>{K(n)&&e(f)}),RX(G(d,2),{children:(e,t)=>{var n=OQ(),r=W(n);Dh(r,{onclick:()=>o(),get variant(){return Nt.PRIMARY},tooltip:`Save Changes`,children:(e,t)=>{Ir(),J(e,Ko(`Save`))},$$slots:{default:!0}}),Dh(G(r,2),{onclick:()=>s(),tooltip:`Revert Changes`,children:(e,t)=>{Ir(),J(e,Ko(`Cancel`))},$$slots:{default:!0}}),J(e,n)},$$slots:{default:!0}}),H(c),J(e,c),Xr()}var jQ=class extends u.Modal{mb;component;constructor(e,t){super(e),this.mb=t}onOpen(){this.contentEl.empty(),this.component&&$o(this.component),this.component=Yo(AQ,{target:this.contentEl,props:{inputFieldTemplates:structuredClone(this.mb.getSettings().inputFieldTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&$o(this.component)}save(e){let t=this.mb.inputFieldParser.parseTemplates(e);if(t.hasErrors())return t;this.mb.updateSettings(t=>{t.inputFieldTemplates=e})}},MQ=class extends u.PluginSettingTab{mb;constructor(e,t){super(e,t.plugin),this.mb=t}display(){let{containerEl:e}=this;if(e.empty(),this.mb.build===fJ.DEV||this.mb.build===fJ.CANARY){e.createEl(`p`,{text:`You are using a ${this.mb.build} build (1.4.8). This build is not intended for production use. Use at your own risk.`,cls:`mb-error`});let t=new u.ButtonComponent(e);t.setButtonText(`Learn About Canary Builds`),t.setCta(),t.onClick(()=>{Qg.open(Qg.linkToCanaryBuilds())})}new u.Setting(e).setName(`Quick access`).addButton(e=>{e.setCta(),e.setButtonText(`Docs`),e.onClick(()=>{Qg.open(Qg.linkToHome())})}).addButton(e=>{e.setButtonText(`Open FAQ`),e.onClick(()=>{this.mb.activateView(cQ)})}).addButton(e=>{e.setButtonText(`GitHub`),e.onClick(()=>{Qg.open(Qg.linkToGithub())})}).addButton(e=>{e.setButtonText(`Report issue`),e.onClick(()=>{Qg.open(Qg.linkToIssues())})}),new u.Setting(e).setName(`Enable syntax highlighting`).setDesc(`Enable syntax highlighting for meta bind syntax. RESTART REQUIRED.`).addToggle(e=>{e.setValue(this.mb.getSettings().enableSyntaxHighlighting),e.onChange(e=>{this.mb.updateSettings(t=>{t.enableSyntaxHighlighting=e})})}),new u.Setting(e).setName(`Enable editor right-click menu`).setDesc(`Enable a meta bind menu section in the editor right-click menu. RESTART REQUIRED.`).addToggle(e=>{e.setValue(this.mb.getSettings().enableEditorRightClickMenu),e.onChange(e=>{this.mb.updateSettings(t=>{t.enableEditorRightClickMenu=e})})}),new u.Setting(e).setName(`Input field templates`).setDesc("You can specify input field templates here, and access them using `INPUT[template_name][overrides (optional)]` in your notes.").addButton(e=>{e.setButtonText(`Edit templates`),e.onClick(()=>{new jQ(this.app,this.mb).open()})}),new u.Setting(e).setName(`Button templates`).setDesc(`You can specify button field templates here, and access them in inline buttons.`).addButton(e=>{e.setButtonText(`Edit templates`),e.onClick(()=>{new _Q(this.app,this.mb).open()})}),new u.Setting(e).setName(`Excluded folders`).setDesc(`You can specify excluded folders here. The plugin will not work within excluded folders.`).addButton(e=>{e.setButtonText(`Edit excluded folders`),e.onClick(()=>{new CQ(this.app,this.mb).open()})}),new u.Setting(e).setName(`View fields display null as empty`).setDesc(`Display nothing instead of null, if the frontmatter value is empty, in text view fields.`).addToggle(e=>{e.setValue(this.mb.getSettings().viewFieldDisplayNullAsEmpty),e.onChange(e=>{this.mb.updateSettings(t=>{t.viewFieldDisplayNullAsEmpty=e})})}),new u.Setting(e).setName(`Enable JavaScript`).setDesc(`Enable features that run user written JavaScript. This is potentially DANGEROUS, thus it's disabled by default. RESTART REQUIRED.`).addToggle(e=>{e.setValue(this.mb.getSettings().enableJs),e.onChange(e=>{this.mb.updateSettings(t=>{t.enableJs=e})})}),new u.Setting(e).setName(`Date and time`).setHeading(),new u.Setting(e).setName(`Date format`).setDesc(`The date format to be used by this plugin. Changing this setting will break the parsing of existing date inputs. Here is a list of all available date tokes https://momentjs.com/docs/#/displaying/.`).addText(e=>{e.setValue(this.mb.getSettings().preferredDateFormat),e.onChange(e=>{this.mb.updateSettings(t=>{t.preferredDateFormat=e})})}),new u.Setting(e).setName(`First weekday`).setDesc(`Specify the first weekday for the datepicker.`).addDropdown(e=>{for(let t of ZT)e.addOption(t.name,t.name);e.setValue(this.mb.getSettings().firstWeekday.name),e.onChange(e=>{this.mb.updateSettings(t=>{t.firstWeekday=ZT.find(t=>t.name===e)})})}),new u.Setting(e).setName(`Advanced`).setHeading(),new u.Setting(e).setName(`Dev mode`).setDesc(`Enable dev mode. Not recommended unless you want to debug this plugin.`).addToggle(e=>{e.setValue(this.mb.getSettings().devMode),e.onChange(e=>{this.mb.updateSettings(t=>{t.devMode=e})})}),new u.Setting(e).setName(`Disable code block restrictions`).setDesc(`Disable restrictions on which input fields can be created in which code blocks. Not recommended unless you know what you are doing.`).addToggle(e=>{e.setValue(this.mb.getSettings().ignoreCodeBlockRestrictions),e.onChange(e=>{this.mb.updateSettings(t=>{t.ignoreCodeBlockRestrictions=e})})}),new u.Setting(e).setName(`Sync interval`).setDesc(`The interval in milli-seconds between disk writes. Changing this number is not recommended except if your hard drive is exceptionally slow. Standard: ${QT.syncInterval}; Minimum: 50; Maximum: ${$T}`).addText(e=>{e.setValue(this.mb.getSettings().syncInterval.toString()),e.onChange(e=>{this.mb.updateSettings(t=>{t.syncInterval=Number.parseInt(e),Number.isNaN(t.syncInterval)&&(t.syncInterval=QT.syncInterval),t.syncInterval<50&&(t.syncInterval=50),t.syncInterval>1e3&&(t.syncInterval=$T)})})})}},NQ=class extends pJ{app;plugin;dependencyManager;constructor(e){super(),this.app=e.app,this.plugin=e,this.setComponents({api:new BY(this),internal:new $Z(this),file:new HY(this)}),this.plugin.addSettingTab(new MQ(this.app,this)),this.dependencyManager=new OJ(this,[]),this.setUpDependencies(),this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.plugin.registerEditorExtension(TJ(this)),this.addCommands(),SJ(this),this.plugin.registerView(cQ,e=>new lQ(e,this)),this.addStatusBarBuildIndicator(),this.getSettings().enableEditorRightClickMenu&&this.plugin.registerEvent(this.app.workspace.on(`editor-menu`,(e,t)=>{PJ(e,t,this)}))}setUpDependencies(){this.dependencyManager.dependencies=[{name:`Dataview`,pluginId:`dataview`,minVersion:new DJ(0,5,64)},{name:`JS Engine`,pluginId:`js-engine`,minVersion:new DJ(0,3,0)},{name:`Templater`,pluginId:`templater-obsidian`,minVersion:new DJ(2,2,3)}]}setUpMetadataManager(){this.metadataManager=new F_,this.metadataManager.registerSource(new eQ(this,L_.FRONTMATTER,this.metadataManager)),this.metadataManager.registerSource(new hJ(L_.MEMORY,this.metadataManager)),this.metadataManager.registerSource(new gJ(L_.GLOBAL_MEMORY,this.metadataManager)),this.metadataManager.registerSource(new _J(L_.SCOPE,this.metadataManager)),this.metadataManager.setDefaultSource(L_.FRONTMATTER),this.plugin.registerEvent(this.app.vault.on(`rename`,(e,t)=>{this.mountableManager.unloadFile(t),this.metadataManager.onStoragePathRenamed(t,e.path)})),this.plugin.registerEvent(this.app.vault.on(`delete`,e=>{this.mountableManager.unloadFile(e.path),this.metadataManager.onStoragePathDeleted(e.path)})),this.plugin.registerInterval(window.setInterval(()=>this.metadataManager.cycle(),this.getSettings().syncInterval))}addPostProcessors(){this.plugin.registerMarkdownPostProcessor((e,t)=>{let n=e.querySelectorAll(`code`),r=t.sourcePath;for(let e=0;e<n.length;e++){let i=n.item(e);if(i.hasClass(`mb-none`))continue;let a=i.innerText,o=this.api.isInlineFieldDeclarationAndGetType(a);if(o===void 0)continue;let s=this.api.createInlineFieldOfTypeFromString(o,a,r,void 0);this.api.wrapInMDRC(s,i,t)}},1),this.plugin.registerMarkdownCodeBlockProcessor(`meta-bind`,async(e,t,n)=>{await(0,u.loadPrism)();let r=t,i=e.trim(),a=n.sourcePath,o=this.api.isInlineFieldDeclarationAndGetType(i);if(o===void 0)return;let s=this.api.createInlineFieldOfTypeFromString(o,i,a,void 0,A.BLOCK,new tQ(n,t));this.api.wrapInMDRC(s,r,n)}),this.plugin.registerMarkdownCodeBlockProcessor(`meta-bind-js-view`,async(e,t,n)=>{await(0,u.loadPrism)();let r=this.api.createJsViewFieldMountable(n.sourcePath,{declaration:e});this.api.wrapInMDRC(r,t,n)}),this.plugin.registerMarkdownCodeBlockProcessor(`meta-bind-embed`,async(e,t,n)=>{await(0,u.loadPrism)();let r=this.api.createEmbedMountable(n.sourcePath,{content:e,depth:0});this.api.wrapInMDRC(r,t,n)});for(let e=1;e<=8;e++)this.plugin.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,async(t,n,r)=>{await(0,u.loadPrism)();let i=this.api.createEmbedMountable(r.sourcePath,{content:t,depth:e});this.api.wrapInMDRC(i,n,r)});this.plugin.registerMarkdownCodeBlockProcessor(`meta-bind-button`,async(e,t,n)=>{await(0,u.loadPrism)();let r=this.api.createButtonMountable(n.sourcePath,{declaration:e,isPreview:!1,position:new tQ(n,t)});this.api.wrapInMDRC(r,t,n)})}addCommands(){this.plugin.addCommand({id:`open-docs`,name:`Open docs`,callback:()=>{window.open(`https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/`,`_blank`)}}),this.plugin.addCommand({id:`open-playground`,name:`Open playground`,callback:()=>{this.activateView(cQ)}}),this.plugin.addCommand({id:`open-help`,name:`Open Help`,callback:()=>{this.activateView(cQ)}}),this.plugin.addCommand({id:`open-button-builder`,name:`Open button builder`,callback:()=>{this.internal.openButtonBuilderModal({onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button\n${(0,u.stringifyYaml)(e)}\n\`\`\``)},submitText:`Copy to Clipboard`})}}),this.plugin.addCommand({id:`copy-command-id`,name:`Select and copy command id`,callback:()=>{this.internal.openCommandSelectModal(e=>{window.navigator.clipboard.writeText(e.id)})}})}addStatusBarBuildIndicator(){if(this.build===fJ.DEV){let e=this.plugin.addStatusBarItem();e.setText(`Meta Bind Dev Build`),e.addClass(`mb-error`),this.plugin.register(()=>e.remove())}if(this.build===fJ.CANARY){let e=this.plugin.addStatusBarItem();e.setText(`Meta Bind Canary Build (1.4.8)`),e.addClass(`mb-error`),this.plugin.register(()=>e.remove())}}async activateView(e){let{workspace:t}=this.app,n,r=t.getLeavesOfType(e);r.length>0?n=r[0]:(n=t.getLeaf(`tab`),await n.setViewState({type:e,active:!0})),await t.revealLeaf(n)}getSettings(){return this.plugin.settings}saveSettings(e){this.plugin.settings=e,this.plugin.saveSettings()}},PQ=class extends u.Plugin{mb;api;settings;async onload(){console.log(`meta-bind | Main >> loading`),console.time(`meta-bind | Main >> load-time`),await this.loadSettings(),this.mb=new NQ(this),this.api=this.mb.api,this.mb.updateInternalSettings(this.settings),console.timeEnd(`meta-bind | Main >> load-time`)}onunload(){this.mb.destroy(),console.log(`meta-bind | Main >> unload`)}async loadSettings(){console.log(`meta-bind | Main >> loading settings`);let e=await this.loadData()??{};typeof e==`object`&&e&&(delete e.inputTemplates,delete e.useUsDateInputOrder),this.settings=Object.assign({},QT,e),yt(e,this.settings)||await this.saveSettings()}async saveSettings(){console.log(`meta-bind | Main >> settings save`),await this.saveData(this.settings)}async onExternalSettingsChange(){await this.loadSettings(),this.mb.updateInternalSettings(this.settings)}};exports.ObsMetaBind=NQ,exports.default=PQ;
/* nosourcemap */