@devtable/dashboard 8.50.3 → 8.50.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,7 +72,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
72
72
  `].includes(Mt)})},[T]),Qe=function(Ct,cn,Tn){var _r=!0,fi=Ct;N==null||N(null);var ca=Tn?null:OX(Ct,T);return b!=="combobox"&&ca&&(fi="",P==null||P(ca),Le(!1),_r=!1),k&&Ze!==fi&&k(fi,{source:cn?"typing":"effect"}),_r},lt=function(Ct){!Ct||!Ct.trim()||k(Ct,{source:"submit"})};U.useEffect(function(){!wt&&!te&&b!=="combobox"&&Qe("",!1,!1)},[wt]),U.useEffect(function(){Xe&&D&&rt(!1),D&&Re(!1)},[D]);var Lt=ON(),ir=Xr(Lt,2),nn=ir[0],an=ir[1],zn=function(Ct){var cn=nn(),Tn=Ct.which;if(Tn===qe.ENTER&&(b!=="combobox"&&Ct.preventDefault(),wt||Le(!0)),an(!!Ze),Tn===qe.BACKSPACE&&!cn&&te&&!Ze&&d.length){for(var _r=vi(d),fi=null,ca=_r.length-1;ca>=0;ca-=1){var cd=_r[ca];if(!cd.disabled){_r.splice(ca,1),fi=cd;break}}fi&&f(_r,{type:"remove",values:[fi]})}for(var ns=arguments.length,mu=new Array(ns>1?ns-1:0),is=1;is<ns;is++)mu[is-1]=arguments[is];if(wt&&Ce.current){var f6;(f6=Ce.current).onKeyDown.apply(f6,[Ct].concat(mu))}J==null||J.apply(void 0,[Ct].concat(mu))},br=function(Ct){for(var cn=arguments.length,Tn=new Array(cn>1?cn-1:0),_r=1;_r<cn;_r++)Tn[_r-1]=arguments[_r];if(wt&&Ce.current){var fi;(fi=Ce.current).onKeyUp.apply(fi,[Ct].concat(Tn))}q==null||q.apply(void 0,[Ct].concat(Tn))},de=function(Ct){var cn=d.filter(function(Tn){return Tn!==Ct});f(cn,{type:"remove",values:[Ct]})},Fe=U.useRef(!1),$e=function(){Re(!0),D||(ve&&!Fe.current&&ve.apply(void 0,arguments),ge.includes("focus")&&Le(!0)),Fe.current=!0},Ye=function(){Re(!1,function(){Fe.current=!1,Le(!1)}),!D&&(Ze&&(b==="tags"?k(Ze,{source:"submit"}):b==="multiple"&&k("",{source:"blur"})),Ee&&Ee.apply(void 0,arguments))},Je=[];U.useEffect(function(){return function(){Je.forEach(function(Mt){return clearTimeout(Mt)}),Je.splice(0,Je.length)}},[]);var nt=function(Ct){var cn,Tn=Ct.target,_r=(cn=_e.current)===null||cn===void 0?void 0:cn.getPopupElement();if(_r&&_r.contains(Tn)){var fi=setTimeout(function(){var mu=Je.indexOf(fi);if(mu!==-1&&Je.splice(mu,1),dt(),!W&&!_r.contains(document.activeElement)){var is;(is=Ae.current)===null||is===void 0||is.focus()}});Je.push(fi)}for(var ca=arguments.length,cd=new Array(ca>1?ca-1:0),ns=1;ns<ca;ns++)cd[ns-1]=arguments[ns];ce==null||ce.apply(void 0,[Ct].concat(cd))},ht=U.useState(null),st=Xr(ht,2),_t=st[0],St=st[1],Bt=U.useState({}),Ar=Xr(Bt,2),mn=Ar[1];function Wn(){mn({})}Ba(function(){if(yr){var Mt,Ct=Math.ceil((Mt=me.current)===null||Mt===void 0?void 0:Mt.offsetWidth);_t!==Ct&&!Number.isNaN(Ct)&&St(Ct)}},[yr]);var Br;B&&(Br=function(Ct){Le(Ct)}),m7(function(){var Mt;return[me.current,(Mt=_e.current)===null||Mt===void 0?void 0:Mt.getPopupElement()]},yr,Le,!!B);var Fi=U.useMemo(function(){return Kr(Kr({},e),{},{notFoundContent:v,open:wt,triggerOpen:yr,id:i,showSearch:ae,multiple:te,toggleOpen:Le})},[e,v,yr,wt,i,ae,te,Le]),ua=L!==void 0?L:x||!te&&b!=="combobox",_n;ua&&(_n=h(Rd,{className:dr("".concat(a,"-arrow"),jr({},"".concat(a,"-arrow-loading"),x)),customizeIcon:I,customizeIconProps:{loading:x,searchValue:Ze,open:wt,focused:Ve,showSearch:ae}}));var Mn,Gs=function(){var Ct;y==null||y(),(Ct=Ae.current)===null||Ct===void 0||Ct.focus(),f([],{type:"clear",values:d}),Qe("",!1,!1)};!D&&O&&(d.length||Ze)&&!(b==="combobox"&&Ze==="")&&(Mn=h(Rd,{className:"".concat(a,"-clear"),onMouseDown:Gs,customizeIcon:V,children:"\xD7"}));var Hn=h(H,{ref:Ce}),un=dr(a,o,(n={},jr(n,"".concat(a,"-focused"),Ve),jr(n,"".concat(a,"-multiple"),te),jr(n,"".concat(a,"-single"),!te),jr(n,"".concat(a,"-allow-clear"),O),jr(n,"".concat(a,"-show-arrow"),ua),jr(n,"".concat(a,"-disabled"),D),jr(n,"".concat(a,"-loading"),x),jr(n,"".concat(a,"-open"),wt),jr(n,"".concat(a,"-customize-input"),bt),jr(n,"".concat(a,"-show-search"),ae),n)),ld=h(U_,{ref:_e,disabled:D,prefixCls:a,visible:yr,popupElement:Hn,containerWidth:_t,animation:Z,transitionName:G,dropdownStyle:Y,dropdownClassName:re,direction:u,dropdownMatchSelectWidth:ne,dropdownRender:pe,dropdownAlign:he,placement:le,getPopupContainer:fe,empty:p,getTriggerDOMNode:function(){return we.current},onPopupVisibleChange:Br,onPopupMouseEnter:Wn,children:B?U.cloneElement(B,{ref:ie}):h(aA,{...e,domRef:we,prefixCls:a,inputElement:bt,ref:Ae,id:i,showSearch:ae,autoClearSearchValue:F,mode:b,activeDescendantId:M,tagRender:l,values:d,open:wt,onToggleOpen:Le,activeValue:_,searchValue:Ze,onSearch:Qe,onSearchSubmit:lt,onRemove:de,tokenWithEnter:Ke})}),ud;return B?ud=ld:ud=$("div",{className:un,...De,ref:me,onMouseDown:nt,onKeyDown:zn,onKeyUp:br,onFocus:$e,onBlur:Ye,children:[Ve&&!wt&&h("span",{style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0},"aria-live":"polite",children:"".concat(d.map(function(Mt){var Ct=Mt.label,cn=Mt.value;return["number","string"].includes($a(Ct))?Ct:cn}).join(", "))}),ld,_n,Mn]}),h(MN.Provider,{value:Fi,children:ud})});process.env.NODE_ENV!=="production"&&(lx.displayName="BaseSelect");const kX=function(e,t){var r=U.useRef({values:new Map,options:new Map}),n=U.useMemo(function(){var a=r.current,o=a.values,s=a.options,l=e.map(function(d){if(d.label===void 0){var f;return Kr(Kr({},d),{},{label:(f=o.get(d.value))===null||f===void 0?void 0:f.label})}return d}),u=new Map,c=new Map;return l.forEach(function(d){u.set(d.value,d),c.set(d.value,t.get(d.value)||s.get(d.value))}),r.current.values=u,r.current.options=c,l},[e,t]),i=U.useCallback(function(a){return t.get(a)||r.current.options.get(a)},[t]);return[n,i]};function ux(e,t){return M1(e).join("").toUpperCase().includes(t)}const PX=function(e,t,r,n,i){return U.useMemo(function(){if(!r||n===!1)return e;var a=t.options,o=t.label,s=t.value,l=[],u=typeof n=="function",c=r.toUpperCase(),d=u?n:function(p,m){return i?ux(m[i],c):m[a]?ux(m[o!=="children"?o:"label"],c):ux(m[s],c)},f=u?function(p){return sx(p)}:function(p){return p};return e.forEach(function(p){if(p[a]){var m=d(r,f(p));if(m)l.push(p);else{var v=p[a].filter(function(y){return d(r,f(y))});v.length&&l.push(Kr(Kr({},p),{},jr({},a,v)))}return}d(r,f(p))&&l.push(p)}),l},[e,n,i,r,t])};var j_=0,FX=process.env.NODE_ENV!=="test"&&Ks();function $X(){var e;return FX?(e=j_,j_+=1):e="TEST_OR_SSR",e}function K_(e){var t=U.useState(),r=Xr(t,2),n=r[0],i=r[1];return U.useEffect(function(){i("rc_select_".concat($X()))},[]),e||n}var BX=["children","value"],zX=["children"];function LX(e){var t=e,r=t.key,n=t.props,i=n.children,a=n.value,o=js(n,BX);return Kr({key:r,value:a!==void 0?a:r,children:i},o)}function cx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return wo(e).map(function(r,n){if(!U.isValidElement(r)||!r.type)return null;var i=r,a=i.type.isSelectOptGroup,o=i.key,s=i.props,l=s.children,u=js(s,zX);return t||!a?LX(r):Kr(Kr({key:"__RC_SELECT_GRP__".concat(o===null?n:o,"__"),label:o},u),{},{options:cx(l)})}).filter(function(r){return r})}function VX(e,t,r,n,i){return U.useMemo(function(){var a=e,o=!e;o&&(a=cx(t));var s=new Map,l=new Map,u=function(f,p,m){m&&typeof m=="string"&&f.set(p[m],p)};function c(d){for(var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p=0;p<d.length;p+=1){var m=d[p];!m[r.options]||f?(s.set(m[r.value],m),u(l,m,r.label),u(l,m,n),u(l,m,i)):c(m[r.options],!0)}}return c(a),{options:a,valueOptions:s,labelOptions:l}},[e,t,r,n,i])}function Y_(e){var t=U.useRef();t.current=e;var r=U.useCallback(function(){return t.current.apply(t,arguments)},[]);return r}var X_=function(){return null};X_.isSelectOptGroup=!0;var Z_=function(){return null};Z_.isSelectOption=!0;function Q_(e,t){var r=Rn({},e);return Array.isArray(t)&&t.forEach(function(n){delete r[n]}),r}function Do(e){return Do=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Do(e)}function qX(e,t){if(Do(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Do(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function J_(e){var t=qX(e,"string");return Do(t)==="symbol"?t:String(t)}function Bu(e,t,r){return t=J_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function e2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function zu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?e2(Object(r),!0).forEach(function(n){Bu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):e2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function GX(e){if(Array.isArray(e))return e}function UX(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function t2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function WX(e,t){if(!!e){if(typeof e=="string")return t2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t2(e,t)}}function HX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
73
73
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eo(e,t){return GX(e)||UX(e,t)||WX(e,t)||HX()}function jX(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function KX(e,t){if(e==null)return{};var r=jX(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(r[n]=e[n]))}return r}var r2=U.forwardRef(function(e,t){var r=e.height,n=e.offset,i=e.children,a=e.prefixCls,o=e.onInnerResize,s={},l={display:"flex",flexDirection:"column"};return n!==void 0&&(s={height:r,position:"relative",overflow:"hidden"},l=zu(zu({},l),{},{transform:"translateY(".concat(n,"px)"),position:"absolute",left:0,right:0,top:0})),h("div",{style:s,children:h(Td,{onResize:function(c){var d=c.offsetHeight;d&&o&&o()},children:h("div",{style:l,className:dr(Bu({},"".concat(a,"-holder-inner"),a)),ref:t,children:i})})})});r2.displayName="Filler";function n2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,J_(n.key),n)}}function a2(e,t,r){return t&&i2(e.prototype,t),r&&i2(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function dx(e,t){return dx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},dx(e,t)}function YX(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dx(e,t)}function nf(e){return nf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},nf(e)}function XX(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ZX(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function QX(e,t){if(t&&(Do(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ZX(e)}function JX(e){var t=XX();return function(){var n=nf(e),i;if(t){var a=nf(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return QX(this,i)}}var eZ=20;function o2(e){return"touches"in e?e.touches[0].pageY:e.pageY}var tZ=function(e){YX(r,e);var t=JX(r);function r(){var n;n2(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=t.call.apply(t,[this].concat(a)),n.moveRaf=null,n.scrollbarRef=U.createRef(),n.thumbRef=U.createRef(),n.visibleTimeout=null,n.state={dragging:!1,pageY:null,startTop:null,visible:!1},n.delayHidden=function(){clearTimeout(n.visibleTimeout),n.setState({visible:!0}),n.visibleTimeout=setTimeout(function(){n.setState({visible:!1})},2e3)},n.onScrollbarTouchStart=function(s){s.preventDefault()},n.onContainerMouseDown=function(s){s.stopPropagation(),s.preventDefault()},n.patchEvents=function(){window.addEventListener("mousemove",n.onMouseMove),window.addEventListener("mouseup",n.onMouseUp),n.thumbRef.current.addEventListener("touchmove",n.onMouseMove),n.thumbRef.current.addEventListener("touchend",n.onMouseUp)},n.removeEvents=function(){var s;window.removeEventListener("mousemove",n.onMouseMove),window.removeEventListener("mouseup",n.onMouseUp),(s=n.scrollbarRef.current)===null||s===void 0||s.removeEventListener("touchstart",n.onScrollbarTouchStart),n.thumbRef.current&&(n.thumbRef.current.removeEventListener("touchstart",n.onMouseDown),n.thumbRef.current.removeEventListener("touchmove",n.onMouseMove),n.thumbRef.current.removeEventListener("touchend",n.onMouseUp)),Zr.cancel(n.moveRaf)},n.onMouseDown=function(s){var l=n.props.onStartMove;n.setState({dragging:!0,pageY:o2(s),startTop:n.getTop()}),l(),n.patchEvents(),s.stopPropagation(),s.preventDefault()},n.onMouseMove=function(s){var l=n.state,u=l.dragging,c=l.pageY,d=l.startTop,f=n.props.onScroll;if(Zr.cancel(n.moveRaf),u){var p=o2(s)-c,m=d+p,v=n.getEnableScrollRange(),y=n.getEnableHeightRange(),b=y?m/y:0,D=Math.ceil(b*v);n.moveRaf=Zr(function(){f(D)})}},n.onMouseUp=function(){var s=n.props.onStopMove;n.setState({dragging:!1}),s(),n.removeEvents()},n.getSpinHeight=function(){var s=n.props,l=s.height,u=s.count,c=l/u*10;return c=Math.max(c,eZ),c=Math.min(c,l/2),Math.floor(c)},n.getEnableScrollRange=function(){var s=n.props,l=s.scrollHeight,u=s.height;return l-u||0},n.getEnableHeightRange=function(){var s=n.props.height,l=n.getSpinHeight();return s-l||0},n.getTop=function(){var s=n.props.scrollTop,l=n.getEnableScrollRange(),u=n.getEnableHeightRange();if(s===0||l===0)return 0;var c=s/l;return c*u},n.showScroll=function(){var s=n.props,l=s.height,u=s.scrollHeight;return u>l},n}return a2(r,[{key:"componentDidMount",value:function(){this.scrollbarRef.current.addEventListener("touchstart",this.onScrollbarTouchStart),this.thumbRef.current.addEventListener("touchstart",this.onMouseDown)}},{key:"componentDidUpdate",value:function(i){i.scrollTop!==this.props.scrollTop&&this.delayHidden()}},{key:"componentWillUnmount",value:function(){this.removeEvents(),clearTimeout(this.visibleTimeout)}},{key:"render",value:function(){var i=this.state,a=i.dragging,o=i.visible,s=this.props.prefixCls,l=this.getSpinHeight(),u=this.getTop(),c=this.showScroll(),d=c&&o;return h("div",{ref:this.scrollbarRef,className:dr("".concat(s,"-scrollbar"),Bu({},"".concat(s,"-scrollbar-show"),c)),style:{width:8,top:0,bottom:0,right:0,position:"absolute",display:d?null:"none"},onMouseDown:this.onContainerMouseDown,onMouseMove:this.delayHidden,children:h("div",{ref:this.thumbRef,className:dr("".concat(s,"-scrollbar-thumb"),Bu({},"".concat(s,"-scrollbar-thumb-moving"),a)),style:{width:"100%",height:l,top:u,left:0,position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"},onMouseDown:this.onMouseDown})})}}]),r}(U.Component);function rZ(e){var t=e.children,r=e.setRef,n=U.useCallback(function(i){r(i)},[]);return U.cloneElement(t,{ref:n})}function nZ(e,t,r,n,i,a){var o=a.getKey;return e.slice(t,r+1).map(function(s,l){var u=t+l,c=i(s,u,{}),d=o(s);return h(rZ,{setRef:function(p){return n(s,p)},children:c},d)})}var iZ=function(){function e(){n2(this,e),this.maps=void 0,this.maps=Object.create(null)}return a2(e,[{key:"set",value:function(r,n){this.maps[r]=n}},{key:"get",value:function(r){return this.maps[r]}}]),e}();function aZ(e,t,r){var n=U.useState(0),i=Eo(n,2),a=i[0],o=i[1],s=z.useRef(new Map),l=z.useRef(new iZ),u=z.useRef();function c(){Zr.cancel(u.current)}function d(){c(),u.current=Zr(function(){s.current.forEach(function(p,m){if(p&&p.offsetParent){var v=Mu(p),y=v.offsetHeight;l.current.get(m)!==y&&l.current.set(m,v.offsetHeight)}}),o(function(p){return p+1})})}function f(p,m){var v=e(p),y=s.current.get(v);m?(s.current.set(v,m),d()):s.current.delete(v),!y!=!m&&(m?t==null||t(p):r==null||r(p))}return z.useEffect(function(){return c},[]),[f,d,l.current,a]}function oZ(e,t,r,n,i,a,o,s){var l=U.useRef();return function(u){if(u==null){s();return}if(Zr.cancel(l.current),typeof u=="number")o(u);else if(u&&Do(u)==="object"){var c,d=u.align;"index"in u?c=u.index:c=t.findIndex(function(v){return i(v)===u.key});var f=u.offset,p=f===void 0?0:f,m=function v(y,b){if(!(y<0||!e.current)){var D=e.current.clientHeight,x=!1,S=b;if(D){for(var w=b||d,C=0,E=0,A=0,_=Math.min(t.length,c),N=0;N<=_;N+=1){var M=i(t[N]);E=C;var R=r.get(M);A=E+(R===void 0?n:R),C=A,N===c&&R===void 0&&(x=!0)}var F=null;switch(w){case"top":F=E-p;break;case"bottom":F=A-D+p;break;default:{var k=e.current.scrollTop,P=k+D;E<k?S="top":A>P&&(S="bottom")}}F!==null&&F!==e.current.scrollTop&&o(F)}l.current=Zr(function(){x&&a(),v(y-1,S)})}};m(3)}}}function sZ(e,t,r){var n=e.length,i=t.length,a,o;if(n===0&&i===0)return null;n<i?(a=e,o=t):(a=t,o=e);var s={__EMPTY_ITEM__:!0};function l(m){return m!==void 0?r(m):s}for(var u=null,c=Math.abs(n-i)!==1,d=0;d<o.length;d+=1){var f=l(a[d]),p=l(o[d]);if(f!==p){u=d,c=c||f!==l(o[d+1]);break}}return u===null?null:{index:u,multiple:c}}function lZ(e,t,r){var n=U.useState(e),i=Eo(n,2),a=i[0],o=i[1],s=U.useState(null),l=Eo(s,2),u=l[0],c=l[1];return U.useEffect(function(){var d=sZ(a||[],e||[],t);(d==null?void 0:d.index)!==void 0&&(r==null||r(d.index),c(e[d.index])),o(e)},[e]),[u]}var uZ=(typeof navigator>"u"?"undefined":Do(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const s2=function(e,t){var r=z.useRef(!1),n=z.useRef(null);function i(){clearTimeout(n.current),r.current=!0,n.current=setTimeout(function(){r.current=!1},50)}var a=z.useRef({top:e,bottom:t});return a.current.top=e,a.current.bottom=t,function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,l=o<0&&a.current.top||o>0&&a.current.bottom;return s&&l?(clearTimeout(n.current),r.current=!1):(!l||r.current)&&i(),!r.current&&l}};function cZ(e,t,r,n){var i=z.useRef(0),a=z.useRef(null),o=z.useRef(null),s=z.useRef(!1),l=s2(t,r);function u(d){if(!!e){Zr.cancel(a.current);var f=d.deltaY;i.current+=f,o.current=f,!l(f)&&(uZ||d.preventDefault(),a.current=Zr(function(){var p=s.current?10:1;n(i.current*p),i.current=0}))}}function c(d){!e||(s.current=d.detail===o.current)}return[u,c]}var dZ=14/15;function fZ(e,t,r){var n=z.useRef(!1),i=z.useRef(0),a=z.useRef(null),o=z.useRef(null),s,l=function(f){if(n.current){var p=Math.ceil(f.touches[0].pageY),m=i.current-p;i.current=p,r(m)&&f.preventDefault(),clearInterval(o.current),o.current=setInterval(function(){m*=dZ,(!r(m,!0)||Math.abs(m)<=.1)&&clearInterval(o.current)},16)}},u=function(){n.current=!1,s()},c=function(f){s(),f.touches.length===1&&!n.current&&(n.current=!0,i.current=Math.ceil(f.touches[0].pageY),a.current=f.target,a.current.addEventListener("touchmove",l),a.current.addEventListener("touchend",u))};s=function(){a.current&&(a.current.removeEventListener("touchmove",l),a.current.removeEventListener("touchend",u))},Ba(function(){return e&&t.current.addEventListener("touchstart",c),function(){var d;(d=t.current)===null||d===void 0||d.removeEventListener("touchstart",c),s(),clearInterval(o.current)}},[e])}var pZ=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","component","onScroll","onVisibleChange"],hZ=[],mZ={overflowY:"auto",overflowAnchor:"none"};function vZ(e,t){var r=e.prefixCls,n=r===void 0?"rc-virtual-list":r,i=e.className,a=e.height,o=e.itemHeight,s=e.fullHeight,l=s===void 0?!0:s,u=e.style,c=e.data,d=e.children,f=e.itemKey,p=e.virtual,m=e.component,v=m===void 0?"div":m,y=e.onScroll,b=e.onVisibleChange,D=KX(e,pZ),x=!!(p!==!1&&a&&o),S=x&&c&&o*c.length>a,w=z.useState(0),C=Eo(w,2),E=C[0],A=C[1],_=z.useState(!1),N=Eo(_,2),M=N[0],R=N[1],F=dr(n,i),k=c||hZ,P=z.useRef(),T=z.useRef(),O=z.useRef(),L=U.useCallback(function(Te){return typeof f=="function"?f(Te):Te==null?void 0:Te[f]},[f]),I={getKey:L};function V(Te){A(function(Ve){var Re;typeof Te=="function"?Re=Te(Ve):Re=Te;var dt=te(Re);return P.current.scrollTop=dt,dt})}var H=z.useRef({start:0,end:k.length}),Z=z.useRef(),G=lZ(k,L),Y=Eo(G,1),re=Y[0];Z.current=re;var ne=aZ(L,null,null),pe=Eo(ne,4),he=pe[0],le=pe[1],fe=pe[2],xe=pe[3],ge=U.useMemo(function(){if(!x)return{scrollHeight:void 0,start:0,end:k.length-1,offset:void 0};if(!S){var Te;return{scrollHeight:((Te=T.current)===null||Te===void 0?void 0:Te.offsetHeight)||0,start:0,end:k.length-1,offset:void 0}}for(var Ve=0,Re,dt,Ze,bt=k.length,B=0;B<bt;B+=1){var ie=k[B],ye=L(ie),Oe=fe.get(ye),Xe=Ve+(Oe===void 0?o:Oe);Xe>=E&&Re===void 0&&(Re=B,dt=Ve),Xe>E+a&&Ze===void 0&&(Ze=B),Ve=Xe}return Re===void 0&&(Re=0,dt=0,Ze=Math.ceil(a/o)),Ze===void 0&&(Ze=k.length-1),Ze=Math.min(Ze+1,k.length),{scrollHeight:Ve,start:Re,end:Ze,offset:dt}},[S,x,E,k,xe,a]),ve=ge.scrollHeight,Ee=ge.start,q=ge.end,J=ge.offset;H.current.start=Ee,H.current.end=q;var ce=ve-a,X=z.useRef(ce);X.current=ce;function te(Te){var Ve=Te;return Number.isNaN(X.current)||(Ve=Math.min(Ve,X.current)),Ve=Math.max(Ve,0),Ve}var ae=E<=0,De=E>=ce,be=s2(ae,De);function K(Te){var Ve=Te;V(Ve)}function W(Te){var Ve=Te.currentTarget.scrollTop;Ve!==E&&V(Ve),y==null||y(Te)}var ue=cZ(x,ae,De,function(Te){V(function(Ve){var Re=Ve+Te;return Re})}),me=Eo(ue,2),we=me[0],_e=me[1];fZ(x,P,function(Te,Ve){return be(Te,Ve)?!1:(we({preventDefault:function(){},deltaY:Te}),!0)}),Ba(function(){function Te(Ve){x&&Ve.preventDefault()}return P.current.addEventListener("wheel",we),P.current.addEventListener("DOMMouseScroll",_e),P.current.addEventListener("MozMousePixelScroll",Te),function(){P.current&&(P.current.removeEventListener("wheel",we),P.current.removeEventListener("DOMMouseScroll",_e),P.current.removeEventListener("MozMousePixelScroll",Te))}},[x]);var Ae=oZ(P,k,fe,o,L,le,V,function(){var Te;(Te=O.current)===null||Te===void 0||Te.delayHidden()});U.useImperativeHandle(t,function(){return{scrollTo:Ae}}),Ba(function(){if(b){var Te=k.slice(Ee,q+1);b(Te,k)}},[Ee,q,k]);var Ce=nZ(k,Ee,q,he,d,I),Me=null;return a&&(Me=zu(Bu({},l?"height":"maxHeight",a),mZ),x&&(Me.overflowY="hidden",M&&(Me.pointerEvents="none"))),$("div",{style:zu(zu({},u),{},{position:"relative"}),className:F,...D,children:[h(v,{className:"".concat(n,"-holder"),style:Me,ref:P,onScroll:W,children:h(r2,{prefixCls:n,height:ve,offset:J,onInnerResize:le,ref:T,children:Ce})}),x&&h(tZ,{ref:O,prefixCls:n,scrollTop:E,height:a,scrollHeight:ve,count:k.length,onScroll:K,onStartMove:function(){R(!0)},onStopMove:function(){R(!1)}})]})}var fx=U.forwardRef(vZ);fx.displayName="List";function gZ(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var l2=U.createContext(null),yZ=["disabled","title","children","style","className"];function u2(e){return typeof e=="string"||typeof e=="number"}var bZ=function(t,r){var n=TN(),i=n.prefixCls,a=n.id,o=n.open,s=n.multiple,l=n.mode,u=n.searchValue,c=n.toggleOpen,d=n.notFoundContent,f=n.onPopupScroll,p=U.useContext(l2),m=p.flattenOptions,v=p.onActiveValue,y=p.defaultActiveFirstOption,b=p.onSelect,D=p.menuItemSelectedIcon,x=p.rawValues,S=p.fieldNames,w=p.virtual,C=p.listHeight,E=p.listItemHeight,A="".concat(i,"-item"),_=C1(function(){return m},[o,m],function(Y,re){return re[0]&&Y[1]!==re[1]}),N=U.useRef(null),M=function(re){re.preventDefault()},R=function(re){N.current&&N.current.scrollTo(typeof re=="number"?{index:re}:re)},F=function(re){for(var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,pe=_.length,he=0;he<pe;he+=1){var le=(re+he*ne+pe)%pe,fe=_[le],xe=fe.group,ge=fe.data;if(!xe&&!ge.disabled)return le}return-1},k=U.useState(function(){return F(0)}),P=Xr(k,2),T=P[0],O=P[1],L=function(re){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;O(re);var pe={source:ne?"keyboard":"mouse"},he=_[re];if(!he){v(null,-1,pe);return}v(he.value,re,pe)};z.useEffect(function(){L(y!==!1?F(0):-1)},[_.length,u]);var I=U.useCallback(function(Y){return x.has(Y)&&l!=="combobox"},[l,vi(x).toString(),x.size]);z.useEffect(function(){var Y=setTimeout(function(){if(!s&&o&&x.size===1){var ne=Array.from(x)[0],pe=_.findIndex(function(he){var le=he.data;return le.value===ne});pe!==-1&&(L(pe),R(pe))}});if(o){var re;(re=N.current)===null||re===void 0||re.scrollTo(void 0)}return function(){return clearTimeout(Y)}},[o,u]);var V=function(re){re!==void 0&&b(re,{selected:!x.has(re)}),s||c(!1)};if(U.useImperativeHandle(r,function(){return{onKeyDown:function(re){var ne=re.which,pe=re.ctrlKey;switch(ne){case qe.N:case qe.P:case qe.UP:case qe.DOWN:{var he=0;if(ne===qe.UP?he=-1:ne===qe.DOWN?he=1:gZ()&&pe&&(ne===qe.N?he=1:ne===qe.P&&(he=-1)),he!==0){var le=F(T+he,he);R(le),L(le,!0)}break}case qe.ENTER:{var fe=_[T];fe&&!fe.data.disabled?V(fe.value):V(void 0),o&&re.preventDefault();break}case qe.ESC:c(!1),o&&re.stopPropagation()}},onKeyUp:function(){},scrollTo:function(re){R(re)}}}),_.length===0)return h("div",{role:"listbox",id:"".concat(a,"_list"),className:"".concat(A,"-empty"),onMouseDown:M,children:d});var H=Object.keys(S).map(function(Y){return S[Y]}),Z=function(re){return re.label},G=function(re){var ne=_[re];if(!ne)return null;var pe=ne.data||{},he=pe.value,le=ne.group,fe=Ys(pe,!0),xe=Z(ne);return ne?z.createElement("div",{"aria-label":typeof xe=="string"&&!le?xe:null,...fe,key:re,role:le?"presentation":"option",id:"".concat(a,"_list_").concat(re),"aria-selected":I(he)},he):null};return $(tt,{children:[$("div",{role:"listbox",id:"".concat(a,"_list"),style:{height:0,width:0,overflow:"hidden"},children:[G(T-1),G(T),G(T+1)]}),h(fx,{itemKey:"key",ref:N,data:_,height:C,itemHeight:E,fullHeight:!1,onMouseDown:M,onScroll:f,virtual:w,children:function(Y,re){var ne,pe=Y.group,he=Y.groupOption,le=Y.data,fe=Y.label,xe=Y.value,ge=le.key;if(pe){var ve,Ee=(ve=le.title)!==null&&ve!==void 0?ve:u2(fe)?fe.toString():void 0;return h("div",{className:dr(A,"".concat(A,"-group")),title:Ee,children:fe!==void 0?fe:ge})}var q=le.disabled,J=le.title;le.children;var ce=le.style,X=le.className,te=js(le,yZ),ae=Q_(te,H),De=I(xe),be="".concat(A,"-option"),K=dr(A,be,X,(ne={},jr(ne,"".concat(be,"-grouped"),he),jr(ne,"".concat(be,"-active"),T===re&&!q),jr(ne,"".concat(be,"-disabled"),q),jr(ne,"".concat(be,"-selected"),De),ne)),W=Z(Y),ue=!D||typeof D=="function"||De,me=typeof W=="number"?W:W||xe,we=u2(me)?me.toString():void 0;return J!==void 0&&(we=J),$("div",{...Ys(ae),"aria-selected":De,className:K,title:we,onMouseMove:function(){T===re||q||L(re)},onClick:function(){q||V(xe)},style:ce,children:[h("div",{className:"".concat(be,"-content"),children:me}),U.isValidElement(D)||De,ue&&h(Rd,{className:"".concat(A,"-option-state"),customizeIcon:D,customizeIconProps:{isSelected:De},children:De?"\u2713":null})]})}})]})},c2=U.forwardRef(bZ);c2.displayName="OptionList";function xZ(e){var t=e.mode,r=e.options,n=e.children,i=e.backfill,a=e.allowClear,o=e.placeholder,s=e.getInputElement,l=e.showSearch,u=e.onSearch,c=e.defaultOpen,d=e.autoFocus,f=e.labelInValue,p=e.value,m=e.inputValue,v=e.optionLabelProp,y=rf(t),b=l!==void 0?l:y||t==="combobox",D=r||cx(n);if(Zt(t!=="tags"||D.every(function(C){return!C.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),t==="tags"||t==="combobox"){var x=D.some(function(C){return C.options?C.options.some(function(E){return typeof("value"in E?E.value:E.key)=="number"}):typeof("value"in C?C.value:C.key)=="number"});Zt(!x,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Zt(t!=="combobox"||!v,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Zt(t==="combobox"||!i,"`backfill` only works with `combobox` mode."),Zt(t==="combobox"||!s,"`getInputElement` only work with `combobox` mode."),SN(t!=="combobox"||!s||!a||!o,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),u&&!b&&t!=="combobox"&&t!=="tags"&&Zt(!1,"`onSearch` should work with `showSearch` instead of use alone."),SN(!c||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),p!=null){var S=M1(p);Zt(!f||S.every(function(C){return $a(C)==="object"&&("key"in C||"value"in C)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Zt(!y||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(n){var w=null;wo(n).some(function(C){if(!U.isValidElement(C)||!C.type)return!1;var E=C,A=E.type;if(A.isSelectOption)return!1;if(A.isSelectOptGroup){var _=wo(C.props.children).every(function(N){return!U.isValidElement(N)||!C.type||N.type.isSelectOption?!0:(w=N.type,!1)});return!_}return w=A,!0}),w&&Zt(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(w.displayName||w.name||w,"`.")),Zt(m===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}function wZ(e,t){if(e){var r=function n(i){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=0;o<i.length;o++){var s=i[o];if(s[t==null?void 0:t.value]===null)return Zt(!1,"`value` in Select options should not be `null`."),!0;if(!a&&Array.isArray(s[t==null?void 0:t.options])&&n(s[t==null?void 0:t.options],!0))break}};r(e)}}var CZ=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","listHeight","listItemHeight","value","defaultValue","labelInValue","onChange"],SZ=["inputValue"];function DZ(e){return!e||$a(e)!=="object"}var d2=U.forwardRef(function(e,t){var r=e.id,n=e.mode,i=e.prefixCls,a=i===void 0?"rc-select":i,o=e.backfill,s=e.fieldNames,l=e.inputValue,u=e.searchValue,c=e.onSearch,d=e.autoClearSearchValue,f=d===void 0?!0:d,p=e.onSelect,m=e.onDeselect,v=e.dropdownMatchSelectWidth,y=v===void 0?!0:v,b=e.filterOption,D=e.filterSort,x=e.optionFilterProp,S=e.optionLabelProp,w=e.options,C=e.children,E=e.defaultActiveFirstOption,A=e.menuItemSelectedIcon,_=e.virtual,N=e.listHeight,M=N===void 0?200:N,R=e.listItemHeight,F=R===void 0?20:R,k=e.value,P=e.defaultValue,T=e.labelInValue,O=e.onChange,L=js(e,CZ),I=K_(r),V=rf(n),H=!!(!w&&C),Z=U.useMemo(function(){return b===void 0&&n==="combobox"?!1:b},[b,n]),G=U.useMemo(function(){return H_(s,H)},[JSON.stringify(s),H]),Y=Du("",{value:u!==void 0?u:l,postState:function(Ke){return Ke||""}}),re=Xr(Y,2),ne=re[0],pe=re[1],he=VX(w,C,G,x,S),le=he.valueOptions,fe=he.labelOptions,xe=he.options,ge=U.useCallback(function(Le){var Ke=M1(Le);return Ke.map(function(Qe){var lt,Lt,ir,nn,an;if(DZ(Qe))lt=Qe;else{var zn;ir=Qe.key,Lt=Qe.label,lt=(zn=Qe.value)!==null&&zn!==void 0?zn:ir}var br=le.get(lt);if(br){var de;if(Lt===void 0&&(Lt=br==null?void 0:br[S||G.label]),ir===void 0&&(ir=(de=br==null?void 0:br.key)!==null&&de!==void 0?de:lt),nn=br==null?void 0:br.disabled,an=br==null?void 0:br.title,process.env.NODE_ENV!=="production"&&!S){var Fe=br==null?void 0:br[G.label];Fe!==void 0&&Fe!==Lt&&Zt(!1,"`label` of `value` is not same as `label` in Select options.")}}return{label:Lt,value:lt,key:ir,disabled:nn,title:an}})},[G,S,le]),ve=Du(P,{value:k}),Ee=Xr(ve,2),q=Ee[0],J=Ee[1],ce=U.useMemo(function(){var Le,Ke=ge(q);return n==="combobox"&&!((Le=Ke[0])!==null&&Le!==void 0&&Le.value)?[]:Ke},[q,ge,n]),X=kX(ce,le),te=Xr(X,2),ae=te[0],De=te[1],be=U.useMemo(function(){if(!n&&ae.length===1){var Le=ae[0];if(Le.value===null&&(Le.label===null||Le.label===void 0))return[]}return ae.map(function(Ke){var Qe;return Kr(Kr({},Ke),{},{label:(Qe=Ke.label)!==null&&Qe!==void 0?Qe:Ke.value})})},[n,ae]),K=U.useMemo(function(){return new Set(ae.map(function(Le){return Le.value}))},[ae]);U.useEffect(function(){if(n==="combobox"){var Le,Ke=(Le=ae[0])===null||Le===void 0?void 0:Le.value;pe(xq(Ke)?String(Ke):"")}},[ae]);var W=Y_(function(Le,Ke){var Qe,lt=Ke!=null?Ke:Le;return Qe={},jr(Qe,G.value,Le),jr(Qe,G.label,lt),Qe}),ue=U.useMemo(function(){if(n!=="tags")return xe;var Le=vi(xe),Ke=function(lt){return le.has(lt)};return vi(ae).sort(function(Qe,lt){return Qe.value<lt.value?-1:1}).forEach(function(Qe){var lt=Qe.value;Ke(lt)||Le.push(W(lt,Qe.label))}),Le},[W,xe,le,ae,n]),me=PX(ue,G,ne,Z,x),we=U.useMemo(function(){return n!=="tags"||!ne||me.some(function(Le){return Le[x||"value"]===ne})?me:[W(ne)].concat(vi(me))},[W,x,n,me,ne]),_e=U.useMemo(function(){return D?vi(we).sort(function(Le,Ke){return D(Le,Ke)}):we},[we,D]),Ae=U.useMemo(function(){return TX(_e,{fieldNames:G,childrenAsData:H})},[_e,G,H]),Ce=function(Ke){var Qe=ge(Ke);if(J(Qe),O&&(Qe.length!==ae.length||Qe.some(function(ir,nn){var an;return((an=ae[nn])===null||an===void 0?void 0:an.value)!==(ir==null?void 0:ir.value)}))){var lt=T?Qe:Qe.map(function(ir){return ir.value}),Lt=Qe.map(function(ir){return sx(De(ir.value))});O(V?lt:lt[0],V?Lt:Lt[0])}},Me=U.useState(null),Te=Xr(Me,2),Ve=Te[0],Re=Te[1],dt=U.useState(0),Ze=Xr(dt,2),bt=Ze[0],B=Ze[1],ie=E!==void 0?E:n!=="combobox",ye=U.useCallback(function(Le,Ke){var Qe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},lt=Qe.source,Lt=lt===void 0?"keyboard":lt;B(Ke),o&&n==="combobox"&&Le!==null&&Lt==="keyboard"&&Re(String(Le))},[o,n]),Oe=function(Ke,Qe,lt){var Lt=function(){var Je,nt=De(Ke);return[T?{label:nt==null?void 0:nt[G.label],value:Ke,key:(Je=nt==null?void 0:nt.key)!==null&&Je!==void 0?Je:Ke}:Ke,sx(nt)]};if(Qe&&p){var ir=Lt(),nn=Xr(ir,2),an=nn[0],zn=nn[1];p(an,zn)}else if(!Qe&&m&&lt!=="clear"){var br=Lt(),de=Xr(br,2),Fe=de[0],$e=de[1];m(Fe,$e)}},Xe=Y_(function(Le,Ke){var Qe,lt=V?Ke.selected:!0;lt?Qe=V?[].concat(vi(ae),[Le]):[Le]:Qe=ae.filter(function(Lt){return Lt.value!==Le}),Ce(Qe),Oe(Le,lt),n==="combobox"?Re(""):(!rf||f)&&(pe(""),Re(""))}),rt=function(Ke,Qe){Ce(Ke);var lt=Qe.type,Lt=Qe.values;(lt==="remove"||lt==="clear")&&Lt.forEach(function(ir){Oe(ir.value,!1,lt)})},wt=function(Ke,Qe){if(pe(Ke),Re(null),Qe.source==="submit"){var lt=(Ke||"").trim();if(lt){var Lt=Array.from(new Set([].concat(vi(K),[lt])));Ce(Lt),Oe(lt,!0),pe("")}return}Qe.source!=="blur"&&(n==="combobox"&&Ce(Ke),c==null||c(Ke))},ur=function(Ke){var Qe=Ke;n!=="tags"&&(Qe=Ke.map(function(Lt){var ir=fe.get(Lt);return ir==null?void 0:ir.value}).filter(function(Lt){return Lt!==void 0}));var lt=Array.from(new Set([].concat(vi(K),vi(Qe))));Ce(lt),lt.forEach(function(Lt){Oe(Lt,!0)})},yr=U.useMemo(function(){var Le=_!==!1&&y!==!1;return Kr(Kr({},he),{},{flattenOptions:Ae,onActiveValue:ye,defaultActiveFirstOption:ie,onSelect:Xe,menuItemSelectedIcon:A,rawValues:K,fieldNames:G,virtual:Le,listHeight:M,listItemHeight:F,childrenAsData:H})},[he,Ae,ye,ie,Xe,A,K,G,_,y,M,F,H]);return process.env.NODE_ENV!=="production"&&(xZ(e),wZ(xe,G)),h(l2.Provider,{value:yr,children:h(lx,{...L,id:I,prefixCls:a,ref:t,omitDomProps:SZ,mode:n,displayValues:be,onDisplayValuesChange:rt,searchValue:ne,onSearch:wt,autoClearSearchValue:f,onSearchSplit:ur,dropdownMatchSelectWidth:y,OptionList:c2,emptyOptions:!Ae.length,activeValue:Ve,activeDescendantId:"".concat(I,"_list_").concat(bt)})})});process.env.NODE_ENV!=="production"&&(d2.displayName="Select");var f2=d2;f2.Option=Z_,f2.OptGroup=X_;function p2(e,t){var r=new Set;return e.forEach(function(n){t.has(n)||r.add(n)}),r}function EZ(e){var t=e||{},r=t.disabled,n=t.disableCheckbox,i=t.checkable;return!!(r||n)||i===!1}function NZ(e,t,r,n){for(var i=new Set(e),a=new Set,o=0;o<=r;o+=1){var s=t.get(o)||new Set;s.forEach(function(d){var f=d.key,p=d.node,m=d.children,v=m===void 0?[]:m;i.has(f)&&!n(p)&&v.filter(function(y){return!n(y.node)}).forEach(function(y){i.add(y.key)})})}for(var l=new Set,u=r;u>=0;u-=1){var c=t.get(u)||new Set;c.forEach(function(d){var f=d.parent,p=d.node;if(!(n(p)||!d.parent||l.has(d.parent.key))){if(n(d.parent.node)){l.add(f.key);return}var m=!0,v=!1;(f.children||[]).filter(function(y){return!n(y.node)}).forEach(function(y){var b=y.key,D=i.has(b);m&&!D&&(m=!1),!v&&(D||a.has(b))&&(v=!0)}),m&&i.add(f.key),v&&a.add(f.key),l.add(f.key)}})}return{checkedKeys:Array.from(i),halfCheckedKeys:Array.from(p2(a,i))}}function AZ(e,t,r,n,i){for(var a=new Set(e),o=new Set(t),s=0;s<=n;s+=1){var l=r.get(s)||new Set;l.forEach(function(f){var p=f.key,m=f.node,v=f.children,y=v===void 0?[]:v;!a.has(p)&&!o.has(p)&&!i(m)&&y.filter(function(b){return!i(b.node)}).forEach(function(b){a.delete(b.key)})})}o=new Set;for(var u=new Set,c=n;c>=0;c-=1){var d=r.get(c)||new Set;d.forEach(function(f){var p=f.parent,m=f.node;if(!(i(m)||!f.parent||u.has(f.parent.key))){if(i(f.parent.node)){u.add(p.key);return}var v=!0,y=!1;(p.children||[]).filter(function(b){return!i(b.node)}).forEach(function(b){var D=b.key,x=a.has(D);v&&!x&&(v=!1),!y&&(x||o.has(D))&&(y=!0)}),v||a.delete(p.key),y&&o.add(p.key),u.add(p.key)}})}return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(p2(o,a))}}function cl(e,t,r,n){var i=[],a;n?a=n:a=EZ;var o=new Set(e.filter(function(c){var d=!!r[c];return d||i.push(c),d})),s=new Map,l=0;Object.keys(r).forEach(function(c){var d=r[c],f=d.level,p=s.get(f);p||(p=new Set,s.set(f,p)),p.add(d),l=Math.max(l,f)}),Zt(!i.length,"Tree missing follow keys: ".concat(i.slice(0,100).map(function(c){return"'".concat(c,"'")}).join(", ")));var u;return t===!0?u=NZ(o,s,l,a):u=AZ(o,t.halfCheckedKeys,s,l,a),u}function af(){return af=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},af.apply(this,arguments)}function Ga(e){return Ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ga(e)}function _Z(e,t){if(Ga(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ga(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function h2(e){var t=_Z(e,"string");return Ga(t)==="symbol"?t:String(t)}function Lr(e,t,r){return t=h2(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function yn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?m2(Object(r),!0).forEach(function(n){Lr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function px(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function MZ(e){if(Array.isArray(e))return px(e)}function TZ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v2(e,t){if(!!e){if(typeof e=="string")return px(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return px(e,t)}}function OZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
74
74
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ds(e){return MZ(e)||TZ(e)||v2(e)||OZ()}function g2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h2(n.key),n)}}function b2(e,t,r){return t&&y2(e.prototype,t),r&&y2(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ua(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hx(e,t){return hx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},hx(e,t)}function x2(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hx(e,t)}function of(e){return of=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},of(e)}function RZ(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function IZ(e,t){if(t&&(Ga(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ua(e)}function w2(e){var t=RZ();return function(){var n=of(e),i;if(t){var a=of(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return IZ(this,i)}}var mx=U.createContext(null);function kZ(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function sf(e,t){if(e==null)return{};var r=kZ(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(r[n]=e[n]))}return r}var PZ=function(t){for(var r=t.prefixCls,n=t.level,i=t.isStart,a=t.isEnd,o="".concat(r,"-indent-unit"),s=[],l=0;l<n;l+=1){var u;s.push(h("span",{className:dr(o,(u={},Lr(u,"".concat(o,"-start"),i[l]),Lr(u,"".concat(o,"-end"),a[l]),u))},l))}return h("span",{"aria-hidden":"true",className:"".concat(r,"-indent"),children:s})};const FZ=U.memo(PZ);var $Z=["children"];function Lu(e,t){return e!=null?e:t}function lf(e){var t=e||{},r=t.title,n=t._title,i=t.key,a=t.children,o=r||"title";return{title:o,_title:n||[o],key:i||"key",children:a||"children"}}function BZ(e,t){var r=new Map;function n(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(i||[]).forEach(function(o){var s=o[t.key],l=o[t.children];Zt(s!=null,"Tree node must have a certain key: [".concat(a).concat(s,"]"));var u=String(s);Zt(!r.has(u)||s===null||s===void 0,"Same 'key' exist in the Tree: ".concat(u)),r.set(u,!0),n(l,"".concat(a).concat(u," > "))})}n(e)}function zZ(e){function t(r){var n=wo(r);return n.map(function(i){if(!UZ(i))return Zt(!i,"Tree/TreeNode can only accept TreeNode as children."),null;var a=i.key,o=i.props,s=o.children,l=sf(o,$Z),u=yn({key:a},l),c=t(s);return c.length&&(u.children=c),u}).filter(function(i){return i})}return t(e)}function vx(e,t,r){var n=lf(r),i=n._title,a=n.key,o=n.children,s=new Set(t===!0?[]:t),l=[];function u(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map(function(f,p){for(var m=E2(d?d.pos:"0",p),v=Lu(f[a],m),y,b=0;b<i.length;b+=1){var D=i[b];if(f[D]!==void 0){y=f[D];break}}var x=yn(yn({},Q_(f,[].concat(ds(i),[a,o]))),{},{title:y,key:v,parent:d,pos:m,children:null,data:f,isStart:[].concat(ds(d?d.isStart:[]),[p===0]),isEnd:[].concat(ds(d?d.isEnd:[]),[p===c.length-1])});return l.push(x),t===!0||s.has(v)?x.children=u(f[o]||[],x):x.children=[],x})}return u(e),l}function LZ(e,t,r){var n={};Ga(r)==="object"?n=r:n={externalGetKey:r},n=n||{};var i=n,a=i.childrenPropName,o=i.externalGetKey,s=i.fieldNames,l=lf(s),u=l.key,c=l.children,d=a||c,f;o?typeof o=="string"?f=function(v){return v[o]}:typeof o=="function"&&(f=function(v){return o(v)}):f=function(v,y){return Lu(v[u],y)};function p(m,v,y,b){var D=m?m[d]:e,x=m?E2(y.pos,v):"0",S=m?[].concat(ds(b),[m]):[];if(m){var w=f(m,x),C={node:m,index:v,pos:x,key:w,parentPos:y.node?y.pos:null,level:y.level+1,nodes:S};t(C)}D&&D.forEach(function(E,A){p(E,A,{node:m,pos:x,level:y?y.level+1:-1},S)})}p(null)}function C2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.initWrapper,n=t.processEntity,i=t.onProcessFinished,a=t.externalGetKey,o=t.childrenPropName,s=t.fieldNames,l=arguments.length>2?arguments[2]:void 0,u=a||l,c={},d={},f={posEntities:c,keyEntities:d};return r&&(f=r(f)||f),LZ(e,function(p){var m=p.node,v=p.index,y=p.pos,b=p.key,D=p.parentPos,x=p.level,S=p.nodes,w={node:m,nodes:S,index:v,key:b,pos:y,level:x},C=Lu(b,y);c[y]=w,d[C]=w,w.parent=c[D],w.parent&&(w.parent.children=w.parent.children||[],w.parent.children.push(w)),n&&n(w,f)},{externalGetKey:u,childrenPropName:o,fieldNames:s}),i&&i(f),f}function Vu(e,t){var r=t.expandedKeys,n=t.selectedKeys,i=t.loadedKeys,a=t.loadingKeys,o=t.checkedKeys,s=t.halfCheckedKeys,l=t.dragOverNodeKey,u=t.dropPosition,c=t.keyEntities,d=c[e],f={eventKey:e,expanded:r.indexOf(e)!==-1,selected:n.indexOf(e)!==-1,loaded:i.indexOf(e)!==-1,loading:a.indexOf(e)!==-1,checked:o.indexOf(e)!==-1,halfChecked:s.indexOf(e)!==-1,pos:String(d?d.pos:""),dragOver:l===e&&u===0,dragOverGapTop:l===e&&u===-1,dragOverGapBottom:l===e&&u===1};return f}function Qr(e){var t=e.data,r=e.expanded,n=e.selected,i=e.checked,a=e.loaded,o=e.loading,s=e.halfChecked,l=e.dragOver,u=e.dragOverGapTop,c=e.dragOverGapBottom,d=e.pos,f=e.active,p=e.eventKey,m=yn(yn({},t),{},{expanded:r,selected:n,checked:i,loaded:a,loading:o,halfChecked:s,dragOver:l,dragOverGapTop:u,dragOverGapBottom:c,pos:d,active:f,key:p});return"props"in m||Object.defineProperty(m,"props",{get:function(){return Zt(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}}),m}var VZ=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],S2="open",D2="close",qZ="---",GZ=function(e){x2(r,e);var t=w2(r);function r(){var n;g2(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=t.call.apply(t,[this].concat(a)),n.state={dragNodeHighlight:!1},n.selectHandle=void 0,n.onSelectorClick=function(s){var l=n.props.context.onNodeClick;l(s,Qr(n.props)),n.isSelectable()?n.onSelect(s):n.onCheck(s)},n.onSelectorDoubleClick=function(s){var l=n.props.context.onNodeDoubleClick;l(s,Qr(n.props))},n.onSelect=function(s){if(!n.isDisabled()){var l=n.props.context.onNodeSelect;s.preventDefault(),l(s,Qr(n.props))}},n.onCheck=function(s){if(!n.isDisabled()){var l=n.props,u=l.disableCheckbox,c=l.checked,d=n.props.context.onNodeCheck;if(!(!n.isCheckable()||u)){s.preventDefault();var f=!c;d(s,Qr(n.props),f)}}},n.onMouseEnter=function(s){var l=n.props.context.onNodeMouseEnter;l(s,Qr(n.props))},n.onMouseLeave=function(s){var l=n.props.context.onNodeMouseLeave;l(s,Qr(n.props))},n.onContextMenu=function(s){var l=n.props.context.onNodeContextMenu;l(s,Qr(n.props))},n.onDragStart=function(s){var l=n.props.context.onNodeDragStart;s.stopPropagation(),n.setState({dragNodeHighlight:!0}),l(s,Ua(n));try{s.dataTransfer.setData("text/plain","")}catch{}},n.onDragEnter=function(s){var l=n.props.context.onNodeDragEnter;s.preventDefault(),s.stopPropagation(),l(s,Ua(n))},n.onDragOver=function(s){var l=n.props.context.onNodeDragOver;s.preventDefault(),s.stopPropagation(),l(s,Ua(n))},n.onDragLeave=function(s){var l=n.props.context.onNodeDragLeave;s.stopPropagation(),l(s,Ua(n))},n.onDragEnd=function(s){var l=n.props.context.onNodeDragEnd;s.stopPropagation(),n.setState({dragNodeHighlight:!1}),l(s,Ua(n))},n.onDrop=function(s){var l=n.props.context.onNodeDrop;s.preventDefault(),s.stopPropagation(),n.setState({dragNodeHighlight:!1}),l(s,Ua(n))},n.onExpand=function(s){var l=n.props,u=l.loading,c=l.context.onNodeExpand;u||c(s,Qr(n.props))},n.setSelectHandle=function(s){n.selectHandle=s},n.getNodeState=function(){var s=n.props.expanded;return n.isLeaf()?null:s?S2:D2},n.hasChildren=function(){var s=n.props.eventKey,l=n.props.context.keyEntities,u=l[s]||{},c=u.children;return!!(c||[]).length},n.isLeaf=function(){var s=n.props,l=s.isLeaf,u=s.loaded,c=n.props.context.loadData,d=n.hasChildren();return l===!1?!1:l||!c&&!d||c&&u&&!d},n.isDisabled=function(){var s=n.props.disabled,l=n.props.context.disabled;return!!(l||s)},n.isCheckable=function(){var s=n.props.checkable,l=n.props.context.checkable;return!l||s===!1?!1:l},n.syncLoadData=function(s){var l=s.expanded,u=s.loading,c=s.loaded,d=n.props.context,f=d.loadData,p=d.onNodeLoad;u||f&&l&&!n.isLeaf()&&!n.hasChildren()&&!c&&p(Qr(n.props))},n.isDraggable=function(){var s=n.props,l=s.data,u=s.context.draggable;return!!(u&&(!u.nodeDraggable||u.nodeDraggable(l)))},n.renderDragHandler=function(){var s=n.props.context,l=s.draggable,u=s.prefixCls;return l!=null&&l.icon?h("span",{className:"".concat(u,"-draggable-icon"),children:l.icon}):null},n.renderSwitcherIconDom=function(s){var l=n.props.switcherIcon,u=n.props.context.switcherIcon,c=l||u;return typeof c=="function"?c(yn(yn({},n.props),{},{isLeaf:s})):c},n.renderSwitcher=function(){var s=n.props.expanded,l=n.props.context.prefixCls;if(n.isLeaf()){var u=n.renderSwitcherIconDom(!0);return u!==!1?h("span",{className:dr("".concat(l,"-switcher"),"".concat(l,"-switcher-noop")),children:u}):null}var c=dr("".concat(l,"-switcher"),"".concat(l,"-switcher_").concat(s?S2:D2)),d=n.renderSwitcherIconDom(!1);return d!==!1?h("span",{onClick:n.onExpand,className:c,children:d}):null},n.renderCheckbox=function(){var s=n.props,l=s.checked,u=s.halfChecked,c=s.disableCheckbox,d=n.props.context.prefixCls,f=n.isDisabled(),p=n.isCheckable();if(!p)return null;var m=typeof p!="boolean"?p:null;return h("span",{className:dr("".concat(d,"-checkbox"),l&&"".concat(d,"-checkbox-checked"),!l&&u&&"".concat(d,"-checkbox-indeterminate"),(f||c)&&"".concat(d,"-checkbox-disabled")),onClick:n.onCheck,children:m})},n.renderIcon=function(){var s=n.props.loading,l=n.props.context.prefixCls;return h("span",{className:dr("".concat(l,"-iconEle"),"".concat(l,"-icon__").concat(n.getNodeState()||"docu"),s&&"".concat(l,"-icon_loading"))})},n.renderSelector=function(){var s=n.state.dragNodeHighlight,l=n.props,u=l.title,c=l.selected,d=l.icon,f=l.loading,p=l.data,m=n.props.context,v=m.prefixCls,y=m.showIcon,b=m.icon,D=m.loadData,x=m.titleRender,S=n.isDisabled(),w="".concat(v,"-node-content-wrapper"),C;if(y){var E=d||b;C=E?h("span",{className:dr("".concat(v,"-iconEle"),"".concat(v,"-icon__customize")),children:typeof E=="function"?E(n.props):E}):n.renderIcon()}else D&&f&&(C=n.renderIcon());var A;typeof u=="function"?A=u(p):x?A=x(p):A=u;var _=h("span",{className:"".concat(v,"-title"),children:A});return $("span",{ref:n.setSelectHandle,title:typeof u=="string"?u:"",className:dr("".concat(w),"".concat(w,"-").concat(n.getNodeState()||"normal"),!S&&(c||s)&&"".concat(v,"-node-selected")),onMouseEnter:n.onMouseEnter,onMouseLeave:n.onMouseLeave,onContextMenu:n.onContextMenu,onClick:n.onSelectorClick,onDoubleClick:n.onSelectorDoubleClick,children:[C,_,n.renderDropIndicator()]})},n.renderDropIndicator=function(){var s=n.props,l=s.disabled,u=s.eventKey,c=n.props.context,d=c.draggable,f=c.dropLevelOffset,p=c.dropPosition,m=c.prefixCls,v=c.indent,y=c.dropIndicatorRender,b=c.dragOverNodeKey,D=c.direction,x=!!d,S=!l&&x&&b===u;return S?y({dropPosition:p,dropLevelOffset:f,indent:v,prefixCls:m,direction:D}):null},n}return b2(r,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var i=this.props.selectable,a=this.props.context.selectable;return typeof i=="boolean"?i:a}},{key:"render",value:function(){var i,a=this.props,o=a.eventKey,s=a.className,l=a.style,u=a.dragOver,c=a.dragOverGapTop,d=a.dragOverGapBottom,f=a.isLeaf,p=a.isStart,m=a.isEnd,v=a.expanded,y=a.selected,b=a.checked,D=a.halfChecked,x=a.loading,S=a.domRef,w=a.active;a.data;var C=a.onMouseMove,E=a.selectable,A=sf(a,VZ),_=this.props.context,N=_.prefixCls,M=_.filterTreeNode,R=_.keyEntities,F=_.dropContainerKey,k=_.dropTargetKey,P=_.draggingNodeKey,T=this.isDisabled(),O=Ys(A,{aria:!0,data:!0}),L=R[o]||{},I=L.level,V=m[m.length-1],H=this.isDraggable(),Z=!T&&H,G=P===o,Y=E!==void 0?{"aria-selected":!!E}:void 0;return $("div",{ref:S,className:dr(s,"".concat(N,"-treenode"),(i={},Lr(i,"".concat(N,"-treenode-disabled"),T),Lr(i,"".concat(N,"-treenode-switcher-").concat(v?"open":"close"),!f),Lr(i,"".concat(N,"-treenode-checkbox-checked"),b),Lr(i,"".concat(N,"-treenode-checkbox-indeterminate"),D),Lr(i,"".concat(N,"-treenode-selected"),y),Lr(i,"".concat(N,"-treenode-loading"),x),Lr(i,"".concat(N,"-treenode-active"),w),Lr(i,"".concat(N,"-treenode-leaf-last"),V),Lr(i,"".concat(N,"-treenode-draggable"),H),Lr(i,"dragging",G),Lr(i,"drop-target",k===o),Lr(i,"drop-container",F===o),Lr(i,"drag-over",!T&&u),Lr(i,"drag-over-gap-top",!T&&c),Lr(i,"drag-over-gap-bottom",!T&&d),Lr(i,"filter-node",M&&M(Qr(this.props))),i)),style:l,draggable:Z,"aria-grabbed":G,onDragStart:Z?this.onDragStart:void 0,onDragEnter:H?this.onDragEnter:void 0,onDragOver:H?this.onDragOver:void 0,onDragLeave:H?this.onDragLeave:void 0,onDrop:H?this.onDrop:void 0,onDragEnd:H?this.onDragEnd:void 0,onMouseMove:C,...Y,...O,children:[h(FZ,{prefixCls:N,level:I,isStart:p,isEnd:m}),this.renderDragHandler(),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector()]})}}]),r}(U.Component),dl=function(t){return h(mx.Consumer,{children:function(r){return h(GZ,{...t,context:r})}})};dl.displayName="TreeNode",dl.defaultProps={title:qZ},dl.isTreeNode=1;function Wa(e,t){if(!e)return[];var r=e.slice(),n=r.indexOf(t);return n>=0&&r.splice(n,1),r}function No(e,t){var r=(e||[]).slice();return r.indexOf(t)===-1&&r.push(t),r}function gx(e){return e.split("-")}function E2(e,t){return"".concat(e,"-").concat(t)}function UZ(e){return e&&e.type&&e.type.isTreeNode}function WZ(e,t){var r=[],n=t[e];function i(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];a.forEach(function(o){var s=o.key,l=o.children;r.push(s),i(l)})}return i(n.children),r}function HZ(e){if(e.parent){var t=gx(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1}function jZ(e){var t=gx(e.pos);return Number(t[t.length-1])===0}function N2(e,t,r,n,i,a,o,s,l,u){var c,d=e.clientX,f=e.clientY,p=e.target.getBoundingClientRect(),m=p.top,v=p.height,y=(u==="rtl"?-1:1)*(((i==null?void 0:i.x)||0)-d),b=(y-12)/n,D=s[r.props.eventKey];if(f<m+v/2){var x=o.findIndex(function(P){return P.key===D.key}),S=x<=0?0:x-1,w=o[S].key;D=s[w]}var C=D.key,E=D,A=D.key,_=0,N=0;if(!l.includes(C))for(var M=0;M<b&&HZ(D);M+=1)D=D.parent,N+=1;var R=t.props.data,F=D.node,k=!0;return jZ(D)&&D.level===0&&f<m+v/2&&a({dragNode:R,dropNode:F,dropPosition:-1})&&D.key===r.props.eventKey?_=-1:(E.children||[]).length&&l.includes(A)?a({dragNode:R,dropNode:F,dropPosition:0})?_=0:k=!1:N===0?b>-1.5?a({dragNode:R,dropNode:F,dropPosition:1})?_=1:k=!1:a({dragNode:R,dropNode:F,dropPosition:0})?_=0:a({dragNode:R,dropNode:F,dropPosition:1})?_=1:k=!1:a({dragNode:R,dropNode:F,dropPosition:1})?_=1:k=!1,{dropPosition:_,dropLevelOffset:N,dropTargetKey:D.key,dropTargetPos:D.pos,dragOverNodeKey:A,dropContainerKey:_===0?null:((c=D.parent)===null||c===void 0?void 0:c.key)||null,dropAllowed:k}}function A2(e,t){if(!!e){var r=t.multiple;return r?e.slice():e.length?[e[0]]:e}}function yx(e){if(!e)return null;var t;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else if(Ga(e)==="object")t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0};else return Zt(!1,"`checkedKeys` is not an array or an object"),null;return t}function _2(e,t){var r=new Set;function n(i){if(!r.has(i)){var a=t[i];if(!!a){r.add(i);var o=a.parent,s=a.node;s.disabled||o&&n(o.key)}}}return(e||[]).forEach(function(i){n(i)}),ds(r)}function M2(e){if(e==null)throw new TypeError("Cannot destructure "+e)}function KZ(e){if(Array.isArray(e))return e}function YZ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function XZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
75
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fl(e,t){return KZ(e)||YZ(e,t)||v2(e,t)||XZ()}var ZZ=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],T2=function(t,r){var n=t.className,i=t.style,a=t.motion,o=t.motionNodes,s=t.motionType,l=t.onMotionStart,u=t.onMotionEnd,c=t.active,d=t.treeNodeRequiredProps,f=sf(t,ZZ),p=U.useState(!0),m=fl(p,2),v=m[0],y=m[1],b=U.useContext(mx),D=b.prefixCls,x=U.useRef(!1),S=function(){x.current||u(),x.current=!0};return z.useEffect(function(){o&&s==="hide"&&v&&y(!1)},[o]),z.useEffect(function(){return o&&l(),function(){o&&S()}},[]),o?h(Ld,{ref:r,visible:v,...a,motionAppear:s==="show",onAppearEnd:S,onLeaveEnd:S,children:function(w,C){var E=w.className,A=w.style;return h("div",{ref:C,className:dr("".concat(D,"-treenode-motion"),E),style:A,children:o.map(function(_){var N=af({},(M2(_.data),_.data)),M=_.title,R=_.key,F=_.isStart,k=_.isEnd;delete N.children;var P=Vu(R,d);return z.createElement(dl,{...N,...P,title:M,active:c,data:_.data,key:R,isStart:F,isEnd:k})})})}}):h(dl,{domRef:r,className:n,style:i,...f,active:c})};T2.displayName="MotionTreeNode";var QZ=U.forwardRef(T2);function JZ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=e.length,n=t.length;if(Math.abs(r-n)!==1)return{add:!1,key:null};function i(a,o){var s=new Map;a.forEach(function(u){s.set(u,!0)});var l=o.filter(function(u){return!s.has(u)});return l.length===1?l[0]:null}return r<n?{add:!0,key:i(e,t)}:{add:!1,key:i(t,e)}}function O2(e,t,r){var n=e.findIndex(function(s){return s.key===r}),i=e[n+1],a=t.findIndex(function(s){return s.key===r});if(i){var o=t.findIndex(function(s){return s.key===i.key});return t.slice(a+1,o)}return t.slice(a+1)}var eQ=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],R2={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},tQ=function(){},fs="RC_TREE_MOTION_".concat(Math.random()),bx={key:fs},I2={key:fs,level:0,index:0,pos:"0",node:bx,nodes:[bx]},k2={parent:null,children:[],pos:I2.pos,data:bx,title:null,key:fs,isStart:[],isEnd:[]};function P2(e,t,r,n){return t===!1||!r?e:e.slice(0,Math.ceil(r/n)+1)}function F2(e){var t=e.key,r=e.pos;return Lu(t,r)}function rQ(e){for(var t=String(e.data.key),r=e;r.parent;)r=r.parent,t="".concat(r.data.key," > ").concat(t);return t}var $2=U.forwardRef(function(e,t){var r=e.prefixCls,n=e.data;e.selectable,e.checkable;var i=e.expandedKeys,a=e.selectedKeys,o=e.checkedKeys,s=e.loadedKeys,l=e.loadingKeys,u=e.halfCheckedKeys,c=e.keyEntities,d=e.disabled,f=e.dragging,p=e.dragOverNodeKey,m=e.dropPosition,v=e.motion,y=e.height,b=e.itemHeight,D=e.virtual,x=e.focusable,S=e.activeItem,w=e.focused,C=e.tabIndex,E=e.onKeyDown,A=e.onFocus,_=e.onBlur,N=e.onActiveChange,M=e.onListChangeStart,R=e.onListChangeEnd,F=sf(e,eQ),k=U.useRef(null),P=U.useRef(null);U.useImperativeHandle(t,function(){return{scrollTo:function(De){k.current.scrollTo(De)},getIndentWidth:function(){return P.current.offsetWidth}}});var T=U.useState(i),O=fl(T,2),L=O[0],I=O[1],V=U.useState(n),H=fl(V,2),Z=H[0],G=H[1],Y=U.useState(n),re=fl(Y,2),ne=re[0],pe=re[1],he=U.useState([]),le=fl(he,2),fe=le[0],xe=le[1],ge=U.useState(null),ve=fl(ge,2),Ee=ve[0],q=ve[1],J=U.useRef(n);J.current=n;function ce(){var ae=J.current;G(ae),pe(ae),xe([]),q(null),R()}U.useEffect(function(){I(i);var ae=JZ(L,i);if(ae.key!==null)if(ae.add){var De=Z.findIndex(function(we){var _e=we.key;return _e===ae.key}),be=P2(O2(Z,n,ae.key),D,y,b),K=Z.slice();K.splice(De+1,0,k2),pe(K),xe(be),q("show")}else{var W=n.findIndex(function(we){var _e=we.key;return _e===ae.key}),ue=P2(O2(n,Z,ae.key),D,y,b),me=n.slice();me.splice(W+1,0,k2),pe(me),xe(ue),q("hide")}else Z!==n&&(G(n),pe(n))},[i,n]),U.useEffect(function(){f||ce()},[f]);var X=v?ne:n,te={expandedKeys:i,selectedKeys:a,loadedKeys:s,loadingKeys:l,checkedKeys:o,halfCheckedKeys:u,dragOverNodeKey:p,dropPosition:m,keyEntities:c};return $(tt,{children:[w&&S&&h("span",{style:R2,"aria-live":"assertive",children:rQ(S)}),h("div",{children:h("input",{style:R2,disabled:x===!1||d,tabIndex:x!==!1?C:null,onKeyDown:E,onFocus:A,onBlur:_,value:"",onChange:tQ,"aria-label":"for screen reader"})}),h("div",{className:"".concat(r,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0},children:h("div",{className:"".concat(r,"-indent"),children:h("div",{ref:P,className:"".concat(r,"-indent-unit")})})}),h(fx,{...F,data:X,itemKey:F2,height:y,fullHeight:!1,virtual:D,itemHeight:b,prefixCls:"".concat(r,"-list"),ref:k,onVisibleChange:function(De,be){var K=new Set(De),W=be.filter(function(ue){return!K.has(ue)});W.some(function(ue){return F2(ue)===fs})&&ce()},children:function(ae){var De=ae.pos,be=af({},(M2(ae.data),ae.data)),K=ae.title,W=ae.key,ue=ae.isStart,me=ae.isEnd,we=Lu(W,De);delete be.key,delete be.children;var _e=Vu(we,te);return h(QZ,{...be,..._e,title:K,active:!!S&&W===S.key,pos:De,data:ae.data,isStart:ue,isEnd:me,motion:v,motionNodes:W===fs?fe:null,motionType:Ee,onMotionStart:M,onMotionEnd:ce,treeNodeRequiredProps:te,onMouseMove:function(){N(null)}})}})]})});$2.displayName="NodeList";function nQ(e){var t=e.dropPosition,r=e.dropLevelOffset,n=e.indent,i={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(t){case-1:i.top=0,i.left=-r*n;break;case 1:i.bottom=0,i.left=-r*n;break;case 0:i.bottom=0,i.left=n;break}return h("div",{style:i})}var iQ=10,xx=function(e){x2(r,e);var t=w2(r);function r(){var n;g2(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=t.call.apply(t,[this].concat(a)),n.destroyed=!1,n.delayedDragEnterLogic=void 0,n.loadingRetryTimes={},n.state={keyEntities:{},indent:null,selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null,fieldNames:lf()},n.dragStartMousePosition=null,n.dragNode=void 0,n.currentMouseOverDroppableNodeKey=null,n.listRef=U.createRef(),n.onNodeDragStart=function(s,l){var u=n.state,c=u.expandedKeys,d=u.keyEntities,f=n.props.onDragStart,p=l.props.eventKey;n.dragNode=l,n.dragStartMousePosition={x:s.clientX,y:s.clientY};var m=Wa(c,p);n.setState({draggingNodeKey:p,dragChildrenKeys:WZ(p,d),indent:n.listRef.current.getIndentWidth()}),n.setExpandedKeys(m),window.addEventListener("dragend",n.onWindowDragEnd),f==null||f({event:s,node:Qr(l.props)})},n.onNodeDragEnter=function(s,l){var u=n.state,c=u.expandedKeys,d=u.keyEntities,f=u.dragChildrenKeys,p=u.flattenNodes,m=u.indent,v=n.props,y=v.onDragEnter,b=v.onExpand,D=v.allowDrop,x=v.direction,S=l.props,w=S.pos,C=S.eventKey,E=Ua(n),A=E.dragNode;if(n.currentMouseOverDroppableNodeKey!==C&&(n.currentMouseOverDroppableNodeKey=C),!A){n.resetDragState();return}var _=N2(s,A,l,m,n.dragStartMousePosition,D,p,d,c,x),N=_.dropPosition,M=_.dropLevelOffset,R=_.dropTargetKey,F=_.dropContainerKey,k=_.dropTargetPos,P=_.dropAllowed,T=_.dragOverNodeKey;if(f.indexOf(R)!==-1||!P){n.resetDragState();return}if(n.delayedDragEnterLogic||(n.delayedDragEnterLogic={}),Object.keys(n.delayedDragEnterLogic).forEach(function(O){clearTimeout(n.delayedDragEnterLogic[O])}),A.props.eventKey!==l.props.eventKey&&(s.persist(),n.delayedDragEnterLogic[w]=window.setTimeout(function(){if(n.state.draggingNodeKey!==null){var O=ds(c),L=d[l.props.eventKey];L&&(L.children||[]).length&&(O=No(c,l.props.eventKey)),"expandedKeys"in n.props||n.setExpandedKeys(O),b==null||b(O,{node:Qr(l.props),expanded:!0,nativeEvent:s.nativeEvent})}},800)),A.props.eventKey===R&&M===0){n.resetDragState();return}n.setState({dragOverNodeKey:T,dropPosition:N,dropLevelOffset:M,dropTargetKey:R,dropContainerKey:F,dropTargetPos:k,dropAllowed:P}),y==null||y({event:s,node:Qr(l.props),expandedKeys:c})},n.onNodeDragOver=function(s,l){var u=n.state,c=u.dragChildrenKeys,d=u.flattenNodes,f=u.keyEntities,p=u.expandedKeys,m=u.indent,v=n.props,y=v.onDragOver,b=v.allowDrop,D=v.direction,x=Ua(n),S=x.dragNode;if(!!S){var w=N2(s,S,l,m,n.dragStartMousePosition,b,d,f,p,D),C=w.dropPosition,E=w.dropLevelOffset,A=w.dropTargetKey,_=w.dropContainerKey,N=w.dropAllowed,M=w.dropTargetPos,R=w.dragOverNodeKey;c.indexOf(A)!==-1||!N||(S.props.eventKey===A&&E===0?n.state.dropPosition===null&&n.state.dropLevelOffset===null&&n.state.dropTargetKey===null&&n.state.dropContainerKey===null&&n.state.dropTargetPos===null&&n.state.dropAllowed===!1&&n.state.dragOverNodeKey===null||n.resetDragState():C===n.state.dropPosition&&E===n.state.dropLevelOffset&&A===n.state.dropTargetKey&&_===n.state.dropContainerKey&&M===n.state.dropTargetPos&&N===n.state.dropAllowed&&R===n.state.dragOverNodeKey||n.setState({dropPosition:C,dropLevelOffset:E,dropTargetKey:A,dropContainerKey:_,dropTargetPos:M,dropAllowed:N,dragOverNodeKey:R}),y==null||y({event:s,node:Qr(l.props)}))}},n.onNodeDragLeave=function(s,l){n.currentMouseOverDroppableNodeKey===l.props.eventKey&&!s.currentTarget.contains(s.relatedTarget)&&(n.resetDragState(),n.currentMouseOverDroppableNodeKey=null);var u=n.props.onDragLeave;u==null||u({event:s,node:Qr(l.props)})},n.onWindowDragEnd=function(s){n.onNodeDragEnd(s,null,!0),window.removeEventListener("dragend",n.onWindowDragEnd)},n.onNodeDragEnd=function(s,l){var u=n.props.onDragEnd;n.setState({dragOverNodeKey:null}),n.cleanDragState(),u==null||u({event:s,node:Qr(l.props)}),n.dragNode=null,window.removeEventListener("dragend",n.onWindowDragEnd)},n.onNodeDrop=function(s,l){var u,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,d=n.state,f=d.dragChildrenKeys,p=d.dropPosition,m=d.dropTargetKey,v=d.dropTargetPos,y=d.dropAllowed;if(!!y){var b=n.props.onDrop;if(n.setState({dragOverNodeKey:null}),n.cleanDragState(),m!==null){var D=yn(yn({},Vu(m,n.getTreeNodeRequiredProps())),{},{active:((u=n.getActiveItem())===null||u===void 0?void 0:u.key)===m,data:n.state.keyEntities[m].node}),x=f.indexOf(m)!==-1;Zt(!x,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var S=gx(v),w={event:s,node:Qr(D),dragNode:n.dragNode?Qr(n.dragNode.props):null,dragNodesKeys:[n.dragNode.props.eventKey].concat(f),dropToGap:p!==0,dropPosition:p+Number(S[S.length-1])};c||b==null||b(w),n.dragNode=null}}},n.cleanDragState=function(){var s=n.state.draggingNodeKey;s!==null&&n.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),n.dragStartMousePosition=null,n.currentMouseOverDroppableNodeKey=null},n.triggerExpandActionExpand=function(s,l){var u=n.state,c=u.expandedKeys,d=u.flattenNodes,f=l.expanded,p=l.key,m=l.isLeaf;if(!(m||s.shiftKey||s.metaKey||s.ctrlKey)){var v=d.filter(function(b){return b.key===p})[0],y=Qr(yn(yn({},Vu(p,n.getTreeNodeRequiredProps())),{},{data:v.data}));n.setExpandedKeys(f?Wa(c,p):No(c,p)),n.onNodeExpand(s,y)}},n.onNodeClick=function(s,l){var u=n.props,c=u.onClick,d=u.expandAction;d==="click"&&n.triggerExpandActionExpand(s,l),c==null||c(s,l)},n.onNodeDoubleClick=function(s,l){var u=n.props,c=u.onDoubleClick,d=u.expandAction;d==="doubleClick"&&n.triggerExpandActionExpand(s,l),c==null||c(s,l)},n.onNodeSelect=function(s,l){var u=n.state.selectedKeys,c=n.state,d=c.keyEntities,f=c.fieldNames,p=n.props,m=p.onSelect,v=p.multiple,y=l.selected,b=l[f.key],D=!y;D?v?u=No(u,b):u=[b]:u=Wa(u,b);var x=u.map(function(S){var w=d[S];return w?w.node:null}).filter(function(S){return S});n.setUncontrolledState({selectedKeys:u}),m==null||m(u,{event:"select",selected:D,node:l,selectedNodes:x,nativeEvent:s.nativeEvent})},n.onNodeCheck=function(s,l,u){var c=n.state,d=c.keyEntities,f=c.checkedKeys,p=c.halfCheckedKeys,m=n.props,v=m.checkStrictly,y=m.onCheck,b=l.key,D,x={event:"check",node:l,checked:u,nativeEvent:s.nativeEvent};if(v){var S=u?No(f,b):Wa(f,b),w=Wa(p,b);D={checked:S,halfChecked:w},x.checkedNodes=S.map(function(M){return d[M]}).filter(function(M){return M}).map(function(M){return M.node}),n.setUncontrolledState({checkedKeys:S})}else{var C=cl([].concat(ds(f),[b]),!0,d),E=C.checkedKeys,A=C.halfCheckedKeys;if(!u){var _=new Set(E);_.delete(b);var N=cl(Array.from(_),{checked:!1,halfCheckedKeys:A},d);E=N.checkedKeys,A=N.halfCheckedKeys}D=E,x.checkedNodes=[],x.checkedNodesPositions=[],x.halfCheckedKeys=A,E.forEach(function(M){var R=d[M];if(!!R){var F=R.node,k=R.pos;x.checkedNodes.push(F),x.checkedNodesPositions.push({node:F,pos:k})}}),n.setUncontrolledState({checkedKeys:E},!1,{halfCheckedKeys:A})}y==null||y(D,x)},n.onNodeLoad=function(s){var l=s.key,u=new Promise(function(c,d){n.setState(function(f){var p=f.loadedKeys,m=p===void 0?[]:p,v=f.loadingKeys,y=v===void 0?[]:v,b=n.props,D=b.loadData,x=b.onLoad;if(!D||m.indexOf(l)!==-1||y.indexOf(l)!==-1)return null;var S=D(s);return S.then(function(){var w=n.state.loadedKeys,C=No(w,l);x==null||x(C,{event:"load",node:s}),n.setUncontrolledState({loadedKeys:C}),n.setState(function(E){return{loadingKeys:Wa(E.loadingKeys,l)}}),c()}).catch(function(w){if(n.setState(function(E){return{loadingKeys:Wa(E.loadingKeys,l)}}),n.loadingRetryTimes[l]=(n.loadingRetryTimes[l]||0)+1,n.loadingRetryTimes[l]>=iQ){var C=n.state.loadedKeys;Zt(!1,"Retry for `loadData` many times but still failed. No more retry."),n.setUncontrolledState({loadedKeys:No(C,l)}),c()}d(w)}),{loadingKeys:No(y,l)}})});return u.catch(function(){}),u},n.onNodeMouseEnter=function(s,l){var u=n.props.onMouseEnter;u==null||u({event:s,node:l})},n.onNodeMouseLeave=function(s,l){var u=n.props.onMouseLeave;u==null||u({event:s,node:l})},n.onNodeContextMenu=function(s,l){var u=n.props.onRightClick;u&&(s.preventDefault(),u({event:s,node:l}))},n.onFocus=function(){var s=n.props.onFocus;n.setState({focused:!0});for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];s==null||s.apply(void 0,u)},n.onBlur=function(){var s=n.props.onBlur;n.setState({focused:!1}),n.onActiveChange(null);for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];s==null||s.apply(void 0,u)},n.getTreeNodeRequiredProps=function(){var s=n.state,l=s.expandedKeys,u=s.selectedKeys,c=s.loadedKeys,d=s.loadingKeys,f=s.checkedKeys,p=s.halfCheckedKeys,m=s.dragOverNodeKey,v=s.dropPosition,y=s.keyEntities;return{expandedKeys:l||[],selectedKeys:u||[],loadedKeys:c||[],loadingKeys:d||[],checkedKeys:f||[],halfCheckedKeys:p||[],dragOverNodeKey:m,dropPosition:v,keyEntities:y}},n.setExpandedKeys=function(s){var l=n.state,u=l.treeData,c=l.fieldNames,d=vx(u,s,c);n.setUncontrolledState({expandedKeys:s,flattenNodes:d},!0)},n.onNodeExpand=function(s,l){var u=n.state.expandedKeys,c=n.state,d=c.listChanging,f=c.fieldNames,p=n.props,m=p.onExpand,v=p.loadData,y=l.expanded,b=l[f.key];if(!d){var D=u.indexOf(b),x=!y;if(Zt(y&&D!==-1||!y&&D===-1,"Expand state not sync with index check"),x?u=No(u,b):u=Wa(u,b),n.setExpandedKeys(u),m==null||m(u,{node:l,expanded:x,nativeEvent:s.nativeEvent}),x&&v){var S=n.onNodeLoad(l);S&&S.then(function(){var w=vx(n.state.treeData,u,f);n.setUncontrolledState({flattenNodes:w})}).catch(function(){var w=n.state.expandedKeys,C=Wa(w,b);n.setExpandedKeys(C)})}}},n.onListChangeStart=function(){n.setUncontrolledState({listChanging:!0})},n.onListChangeEnd=function(){setTimeout(function(){n.setUncontrolledState({listChanging:!1})})},n.onActiveChange=function(s){var l=n.state.activeKey,u=n.props.onActiveChange;l!==s&&(n.setState({activeKey:s}),s!==null&&n.scrollTo({key:s}),u==null||u(s))},n.getActiveItem=function(){var s=n.state,l=s.activeKey,u=s.flattenNodes;return l===null?null:u.find(function(c){var d=c.key;return d===l})||null},n.offsetActiveKey=function(s){var l=n.state,u=l.flattenNodes,c=l.activeKey,d=u.findIndex(function(m){var v=m.key;return v===c});d===-1&&s<0&&(d=u.length),d=(d+s+u.length)%u.length;var f=u[d];if(f){var p=f.key;n.onActiveChange(p)}else n.onActiveChange(null)},n.onKeyDown=function(s){var l=n.state,u=l.activeKey,c=l.expandedKeys,d=l.checkedKeys,f=l.fieldNames,p=n.props,m=p.onKeyDown,v=p.checkable,y=p.selectable;switch(s.which){case qe.UP:{n.offsetActiveKey(-1),s.preventDefault();break}case qe.DOWN:{n.offsetActiveKey(1),s.preventDefault();break}}var b=n.getActiveItem();if(b&&b.data){var D=n.getTreeNodeRequiredProps(),x=b.data.isLeaf===!1||!!(b.data[f.children]||[]).length,S=Qr(yn(yn({},Vu(u,D)),{},{data:b.data,active:!0}));switch(s.which){case qe.LEFT:{x&&c.includes(u)?n.onNodeExpand({},S):b.parent&&n.onActiveChange(b.parent.key),s.preventDefault();break}case qe.RIGHT:{x&&!c.includes(u)?n.onNodeExpand({},S):b.children&&b.children.length&&n.onActiveChange(b.children[0].key),s.preventDefault();break}case qe.ENTER:case qe.SPACE:{v&&!S.disabled&&S.checkable!==!1&&!S.disableCheckbox?n.onNodeCheck({},S,!d.includes(u)):!v&&y&&!S.disabled&&S.selectable!==!1&&n.onNodeSelect({},S);break}}}m==null||m(s)},n.setUncontrolledState=function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!n.destroyed){var c=!1,d=!0,f={};Object.keys(s).forEach(function(p){if(p in n.props){d=!1;return}c=!0,f[p]=s[p]}),c&&(!l||d)&&n.setState(yn(yn({},f),u))}},n.scrollTo=function(s){n.listRef.current.scrollTo(s)},n}return b2(r,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var i=this.props.activeKey;i!==void 0&&i!==this.state.activeKey&&(this.setState({activeKey:i}),i!==null&&this.scrollTo({key:i}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var i,a=this.state,o=a.focused,s=a.flattenNodes,l=a.keyEntities,u=a.draggingNodeKey,c=a.activeKey,d=a.dropLevelOffset,f=a.dropContainerKey,p=a.dropTargetKey,m=a.dropPosition,v=a.dragOverNodeKey,y=a.indent,b=this.props,D=b.prefixCls,x=b.className,S=b.style,w=b.showLine,C=b.focusable,E=b.tabIndex,A=E===void 0?0:E,_=b.selectable,N=b.showIcon,M=b.icon,R=b.switcherIcon,F=b.draggable,k=b.checkable,P=b.checkStrictly,T=b.disabled,O=b.motion,L=b.loadData,I=b.filterTreeNode,V=b.height,H=b.itemHeight,Z=b.virtual,G=b.titleRender,Y=b.dropIndicatorRender,re=b.onContextMenu,ne=b.onScroll,pe=b.direction,he=b.rootClassName,le=b.rootStyle,fe=Ys(this.props,{aria:!0,data:!0}),xe;return F&&(Ga(F)==="object"?xe=F:typeof F=="function"?xe={nodeDraggable:F}:xe={}),h(mx.Provider,{value:{prefixCls:D,selectable:_,showIcon:N,icon:M,switcherIcon:R,draggable:xe,draggingNodeKey:u,checkable:k,checkStrictly:P,disabled:T,keyEntities:l,dropLevelOffset:d,dropContainerKey:f,dropTargetKey:p,dropPosition:m,dragOverNodeKey:v,indent:y,direction:pe,dropIndicatorRender:Y,loadData:L,filterTreeNode:I,titleRender:G,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop},children:h("div",{role:"tree",className:dr(D,x,he,(i={},Lr(i,"".concat(D,"-show-line"),w),Lr(i,"".concat(D,"-focused"),o),Lr(i,"".concat(D,"-active-focused"),c!==null),i)),style:le,children:h($2,{ref:this.listRef,prefixCls:D,style:S,data:s,disabled:T,selectable:_,checkable:!!k,motion:O,dragging:u!==null,height:V,itemHeight:H,virtual:Z,focusable:C,focused:o,tabIndex:A,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:re,onScroll:ne,...this.getTreeNodeRequiredProps(),...fe})})})}}],[{key:"getDerivedStateFromProps",value:function(i,a){var o=a.prevProps,s={prevProps:i};function l(C){return!o&&C in i||o&&o[C]!==i[C]}var u,c=a.fieldNames;if(l("fieldNames")&&(c=lf(i.fieldNames),s.fieldNames=c),l("treeData")?u=i.treeData:l("children")&&(Zt(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),u=zZ(i.children)),u){s.treeData=u;var d=C2(u,{fieldNames:c});s.keyEntities=yn(Lr({},fs,I2),d.keyEntities),process.env.NODE_ENV!=="production"&&BZ(u,c)}var f=s.keyEntities||a.keyEntities;if(l("expandedKeys")||o&&l("autoExpandParent"))s.expandedKeys=i.autoExpandParent||!o&&i.defaultExpandParent?_2(i.expandedKeys,f):i.expandedKeys;else if(!o&&i.defaultExpandAll){var p=yn({},f);delete p[fs],s.expandedKeys=Object.keys(p).map(function(C){return p[C].key})}else!o&&i.defaultExpandedKeys&&(s.expandedKeys=i.autoExpandParent||i.defaultExpandParent?_2(i.defaultExpandedKeys,f):i.defaultExpandedKeys);if(s.expandedKeys||delete s.expandedKeys,u||s.expandedKeys){var m=vx(u||a.treeData,s.expandedKeys||a.expandedKeys,c);s.flattenNodes=m}if(i.selectable&&(l("selectedKeys")?s.selectedKeys=A2(i.selectedKeys,i):!o&&i.defaultSelectedKeys&&(s.selectedKeys=A2(i.defaultSelectedKeys,i))),i.checkable){var v;if(l("checkedKeys")?v=yx(i.checkedKeys)||{}:!o&&i.defaultCheckedKeys?v=yx(i.defaultCheckedKeys)||{}:u&&(v=yx(i.checkedKeys)||{checkedKeys:a.checkedKeys,halfCheckedKeys:a.halfCheckedKeys}),v){var y=v,b=y.checkedKeys,D=b===void 0?[]:b,x=y.halfCheckedKeys,S=x===void 0?[]:x;if(!i.checkStrictly){var w=cl(D,!0,f);D=w.checkedKeys,S=w.halfCheckedKeys}s.checkedKeys=D,s.halfCheckedKeys=S}}return l("loadedKeys")&&(s.loadedKeys=i.loadedKeys),s}}]),r}(U.Component);xx.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:nQ,allowDrop:function(){return!0},expandAction:!1},xx.TreeNode=dl;var B2=U.createContext(null),z2=U.createContext(null);function L2(e){return Array.isArray(e)?e:e!==void 0?[e]:[]}function aQ(e){var t=e||{},r=t.label,n=t.value,i=t.children,a=n||"value";return{_title:r?[r]:["title","label"],value:a,key:a,children:i||"children"}}function wx(e){return!e||e.disabled||e.disableCheckbox||e.checkable===!1}function oQ(e,t){var r=[];function n(i){i.forEach(function(a){var o=a[t.children];o&&(r.push(a[t.value]),n(o))})}return n(e),r}function Cx(e){return e==null}var sQ={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},lQ=function(t,r){var n=TN(),i=n.prefixCls,a=n.multiple,o=n.searchValue,s=n.toggleOpen,l=n.open,u=n.notFoundContent,c=U.useContext(z2),d=c.virtual,f=c.listHeight,p=c.listItemHeight,m=c.treeData,v=c.fieldNames,y=c.onSelect,b=c.dropdownMatchSelectWidth,D=c.treeExpandAction,x=U.useContext(B2),S=x.checkable,w=x.checkedKeys,C=x.halfCheckedKeys,E=x.treeExpandedKeys,A=x.treeDefaultExpandAll,_=x.treeDefaultExpandedKeys,N=x.onTreeExpand,M=x.treeIcon,R=x.showTreeIcon,F=x.switcherIcon,k=x.treeLine,P=x.treeNodeFilterProp,T=x.loadData,O=x.treeLoadedKeys,L=x.treeMotion,I=x.onTreeLoad,V=x.keyEntities,H=U.useRef(),Z=C1(function(){return m},[l,m],function(W,ue){return ue[0]&&W[1]!==ue[1]}),G=U.useMemo(function(){return S?{checked:w,halfChecked:C}:null},[S,w,C]);U.useEffect(function(){if(l&&!a&&w.length){var W;(W=H.current)===null||W===void 0||W.scrollTo({key:w[0]})}},[l]);var Y=String(o).toLowerCase(),re=function(ue){return Y?String(ue[P]).toLowerCase().includes(Y):!1},ne=U.useState(_),pe=bo(ne,2),he=pe[0],le=pe[1],fe=U.useState(null),xe=bo(fe,2),ge=xe[0],ve=xe[1],Ee=U.useMemo(function(){return E?yo(E):o?ge:he},[he,ge,E,o]);U.useEffect(function(){o&&ve(oQ(m,v))},[o]);var q=function(ue){le(ue),ve(ue),N&&N(ue)},J=function(ue){ue.preventDefault()},ce=function(ue,me){var we=me.node;S&&wx(we)||(y(we.key,{selected:!w.includes(we.key)}),a||s(!1))},X=U.useState(null),te=bo(X,2),ae=te[0],De=te[1],be=V[ae];if(U.useImperativeHandle(r,function(){var W;return{scrollTo:(W=H.current)===null||W===void 0?void 0:W.scrollTo,onKeyDown:function(me){var we,_e=me.which;switch(_e){case qe.UP:case qe.DOWN:case qe.LEFT:case qe.RIGHT:(we=H.current)===null||we===void 0||we.onKeyDown(me);break;case qe.ENTER:{if(be){var Ae=(be==null?void 0:be.node)||{},Ce=Ae.selectable,Me=Ae.value;Ce!==!1&&ce(null,{node:{key:ae},selected:!w.includes(Me)})}break}case qe.ESC:s(!1)}},onKeyUp:function(){}}}),Z.length===0)return h("div",{role:"listbox",className:"".concat(i,"-empty"),onMouseDown:J,children:u});var K={fieldNames:v};return O&&(K.loadedKeys=O),Ee&&(K.expandedKeys=Ee),$("div",{onMouseDown:J,children:[be&&l&&h("span",{style:sQ,"aria-live":"assertive",children:be.node.value}),h(xx,{ref:H,focusable:!1,prefixCls:"".concat(i,"-tree"),treeData:Z,height:f,itemHeight:p,virtual:d!==!1&&b!==!1,multiple:a,icon:M,showIcon:R,switcherIcon:F,showLine:k,loadData:o?null:T,motion:L,activeKey:ae,checkable:S,checkStrictly:!0,checkedKeys:G,selectedKeys:S?[]:w,defaultExpandAll:A,...K,onActiveChange:De,onSelect:ce,onCheck:ce,onExpand:q,onLoad:I,filterTreeNode:re,expandAction:D})]})},V2=U.forwardRef(lQ);V2.displayName="OptionList";var q2=function(){return null},uQ="SHOW_ALL",Sx="SHOW_PARENT",Dx="SHOW_CHILD";function G2(e,t,r,n){var i=new Set(e);return t===Dx?e.filter(function(a){var o=r[a];return!(o&&o.children&&o.children.some(function(s){var l=s.node;return i.has(l[n.value])})&&o.children.every(function(s){var l=s.node;return wx(l)||i.has(l[n.value])}))}):t===Sx?e.filter(function(a){var o=r[a],s=o?o.parent:null;return!(s&&!wx(s.node)&&i.has(s.key))}):e}var cQ=["children","value"];function U2(e){return wo(e).map(function(t){if(!U.isValidElement(t)||!t.type)return null;var r=t,n=r.key,i=r.props,a=i.children,o=i.value,s=pN(i,cQ),l=mi({key:n,value:o},s),u=U2(a);return u.length&&(l.children=u),l}).filter(function(t){return t})}function Ex(e){if(!e)return e;var t=mi({},e);return"props"in t||Object.defineProperty(t,"props",{get:function(){return Zt(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),t}}),t}function dQ(e,t,r,n,i,a){var o=null,s=null;function l(){function u(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return c.map(function(p,m){var v="".concat(d,"-").concat(m),y=p[a.value],b=r.includes(y),D=u(p[a.children]||[],v,b),x=h(q2,{...p,children:D.map(function(w){return w.node})});if(t===y&&(o=x),b){var S={pos:v,node:x,children:D};return f||s.push(S),S}return null}).filter(function(p){return p})}s||(s=[],u(n),s.sort(function(c,d){var f=c.node.props.value,p=d.node.props.value,m=r.indexOf(f),v=r.indexOf(p);return m-v}))}Object.defineProperty(e,"triggerNode",{get:function(){return Zt(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),l(),o}}),Object.defineProperty(e,"allCheckedNodes",{get:function(){return Zt(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),l(),i?s:s.map(function(c){var d=c.node;return d})}})}function fQ(e,t){var r=t.id,n=t.pId,i=t.rootPId,a={},o=[],s=e.map(function(l){var u=mi({},l),c=u[r];return a[c]=u,u.key=u.key||c,u});return s.forEach(function(l){var u=l[n],c=a[u];c&&(c.children=c.children||[],c.children.push(l)),(u===i||!c&&i===null)&&o.push(l)}),o}function pQ(e,t,r){return U.useMemo(function(){return e?r?fQ(e,mi({id:"id",pId:"pId",rootPId:null},r!==!0?r:{})):e:U2(t)},[t,r,e])}const hQ=function(e){var t=U.useRef({valueLabels:new Map});return U.useMemo(function(){var r=t.current.valueLabels,n=new Map,i=e.map(function(a){var o,s=a.value,l=(o=a.label)!==null&&o!==void 0?o:r.get(s);return n.set(s,l),mi(mi({},a),{},{label:l})});return t.current.valueLabels=n,[i]},[e])};function W2(e){var t=U.useRef();t.current=e;var r=U.useCallback(function(){return t.current.apply(t,arguments)},[]);return r}const mQ=function(e,t){return U.useMemo(function(){var r=C2(e,{fieldNames:t,initWrapper:function(i){return mi(mi({},i),{},{valueEntities:new Map})},processEntity:function(i,a){var o=i.node[t.value];if(process.env.NODE_ENV!=="production"){var s=i.node.key;Zt(!Cx(o),"TreeNode `value` is invalidate: undefined"),Zt(!a.valueEntities.has(o),"Same `value` exist in the tree: ".concat(o)),Zt(!s||String(s)===String(o),"`key` or `value` with TreeNode must be the same or you can remove one of them. key: ".concat(s,", value: ").concat(o,"."))}a.valueEntities.set(o,i)}});return r},[e,t])},vQ=function(e,t,r,n){return U.useMemo(function(){var i=e.map(function(l){var u=l.value;return u}),a=t.map(function(l){var u=l.value;return u}),o=i.filter(function(l){return!n[l]});if(r){var s=cl(i,!0,n);i=s.checkedKeys,a=s.halfCheckedKeys}return[Array.from(new Set([].concat(yo(o),yo(i)))),a]},[e,t,r,n])},gQ=function(e,t,r){var n=r.treeNodeFilterProp,i=r.filterTreeNode,a=r.fieldNames,o=a.children;return U.useMemo(function(){if(!t||i===!1)return e;var s;if(typeof i=="function")s=i;else{var l=t.toUpperCase();s=function(d,f){var p=f[n];return String(p).toUpperCase().includes(l)}}function u(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return c.map(function(f){var p=f[o],m=d||s(t,Ex(f)),v=u(p||[],m);return m||v.length?mi(mi({},f),{},dN({isLeaf:void 0},o,v)):null}).filter(function(f){return f})}return u(e)},[e,t,o,n,i])};function yQ(e){var t=e.searchPlaceholder,r=e.treeCheckStrictly,n=e.treeCheckable,i=e.labelInValue,a=e.value,o=e.multiple;Zt(!t,"`searchPlaceholder` has been removed."),r&&i===!1&&Zt(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(i||r)&&Zt(L2(a).every(function(s){return s&&ls(s)==="object"&&"value"in s}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),r||o||n?Zt(!a||Array.isArray(a),"`value` should be an array when `TreeSelect` is checkable or multiple."):Zt(!Array.isArray(a),"`value` should not be array when `TreeSelect` is single mode.")}var bQ=["id","prefixCls","value","defaultValue","onChange","onSelect","onDeselect","searchValue","inputValue","onSearch","autoClearSearchValue","filterTreeNode","treeNodeFilterProp","showCheckedStrategy","treeNodeLabelProp","multiple","treeCheckable","treeCheckStrictly","labelInValue","fieldNames","treeDataSimpleMode","treeData","children","loadData","treeLoadedKeys","onTreeLoad","treeDefaultExpandAll","treeExpandedKeys","treeDefaultExpandedKeys","onTreeExpand","treeExpandAction","virtual","listHeight","listItemHeight","onDropdownVisibleChange","dropdownMatchSelectWidth","treeLine","treeIcon","showTreeIcon","switcherIcon","treeMotion"];function xQ(e){return!e||ls(e)!=="object"}var H2=U.forwardRef(function(e,t){var r=e.id,n=e.prefixCls,i=n===void 0?"rc-tree-select":n,a=e.value,o=e.defaultValue,s=e.onChange,l=e.onSelect,u=e.onDeselect,c=e.searchValue,d=e.inputValue,f=e.onSearch,p=e.autoClearSearchValue,m=p===void 0?!0:p,v=e.filterTreeNode,y=e.treeNodeFilterProp,b=y===void 0?"value":y,D=e.showCheckedStrategy,x=D===void 0?Dx:D,S=e.treeNodeLabelProp,w=e.multiple,C=e.treeCheckable,E=e.treeCheckStrictly,A=e.labelInValue,_=e.fieldNames,N=e.treeDataSimpleMode,M=e.treeData,R=e.children,F=e.loadData,k=e.treeLoadedKeys,P=e.onTreeLoad,T=e.treeDefaultExpandAll,O=e.treeExpandedKeys,L=e.treeDefaultExpandedKeys,I=e.onTreeExpand,V=e.treeExpandAction,H=e.virtual,Z=e.listHeight,G=Z===void 0?200:Z,Y=e.listItemHeight,re=Y===void 0?20:Y,ne=e.onDropdownVisibleChange,pe=e.dropdownMatchSelectWidth,he=pe===void 0?!0:pe,le=e.treeLine,fe=e.treeIcon,xe=e.showTreeIcon,ge=e.switcherIcon,ve=e.treeMotion,Ee=pN(e,bQ),q=K_(r),J=C&&!E,ce=C||E,X=E||A,te=ce||w,ae=Du(o,{value:a}),De=bo(ae,2),be=De[0],K=De[1];process.env.NODE_ENV!=="production"&&yQ(e);var W=U.useMemo(function(){return aQ(_)},[JSON.stringify(_)]),ue=Du("",{value:c!==void 0?c:d,postState:function(Ye){return Ye||""}}),me=bo(ue,2),we=me[0],_e=me[1],Ae=function(Ye){_e(Ye),f==null||f(Ye)},Ce=pQ(M,R,N),Me=mQ(Ce,W),Te=Me.keyEntities,Ve=Me.valueEntities,Re=U.useCallback(function($e){var Ye=[],Je=[];return $e.forEach(function(nt){Ve.has(nt)?Je.push(nt):Ye.push(nt)}),{missingRawValues:Ye,existRawValues:Je}},[Ve]),dt=gQ(Ce,we,{fieldNames:W,treeNodeFilterProp:b,filterTreeNode:v}),Ze=U.useCallback(function($e){if($e){if(S)return $e[S];for(var Ye=W._title,Je=0;Je<Ye.length;Je+=1){var nt=$e[Ye[Je]];if(nt!==void 0)return nt}}},[W,S]),bt=U.useCallback(function($e){var Ye=L2($e);return Ye.map(function(Je){return xQ(Je)?{value:Je}:Je})},[]),B=U.useCallback(function($e){var Ye=bt($e);return Ye.map(function(Je){var nt=Je.label,ht=Je.value,st=Je.halfChecked,_t,St=Ve.get(ht);if(St){var Bt;nt=(Bt=nt)!==null&&Bt!==void 0?Bt:Ze(St.node),_t=St.node.disabled}else if(nt===void 0){var Ar=bt(be).find(function(mn){return mn.value===ht});nt=Ar.label}return{label:nt,value:ht,halfChecked:st,disabled:_t}})},[Ve,Ze,bt,be]),ie=U.useMemo(function(){return bt(be)},[bt,be]),ye=U.useMemo(function(){var $e=[],Ye=[];return ie.forEach(function(Je){Je.halfChecked?Ye.push(Je):$e.push(Je)}),[$e,Ye]},[ie]),Oe=bo(ye,2),Xe=Oe[0],rt=Oe[1],wt=U.useMemo(function(){return Xe.map(function($e){return $e.value})},[Xe]),ur=vQ(Xe,rt,J,Te),yr=bo(ur,2),Le=yr[0],Ke=yr[1],Qe=U.useMemo(function(){var $e=G2(Le,x,Te,W),Ye=$e.map(function(st){var _t,St,Bt;return(_t=(St=Te[st])===null||St===void 0||(Bt=St.node)===null||Bt===void 0?void 0:Bt[W.value])!==null&&_t!==void 0?_t:st}),Je=Ye.map(function(st){var _t=Xe.find(function(St){return St.value===st});return{value:st,label:_t==null?void 0:_t.label}}),nt=B(Je),ht=nt[0];return!te&&ht&&Cx(ht.value)&&Cx(ht.label)?[]:nt.map(function(st){var _t;return mi(mi({},st),{},{label:(_t=st.label)!==null&&_t!==void 0?_t:st.value})})},[W,te,Le,Xe,B,x,Te]),lt=hQ(Qe),Lt=bo(lt,1),ir=Lt[0],nn=W2(function($e,Ye,Je){var nt=B($e);if(K(nt),m&&_e(""),s){var ht=$e;if(J){var st=G2($e,x,Te,W);ht=st.map(function(_n){var Mn=Ve.get(_n);return Mn?Mn.node[W.value]:_n})}var _t=Ye||{triggerValue:void 0,selected:void 0},St=_t.triggerValue,Bt=_t.selected,Ar=ht;if(E){var mn=rt.filter(function(_n){return!ht.includes(_n.value)});Ar=[].concat(yo(Ar),yo(mn))}var Wn=B(Ar),Br={preValue:Xe,triggerValue:St},Fi=!0;(E||Je==="selection"&&!Bt)&&(Fi=!1),dQ(Br,St,$e,Ce,Fi,W),ce?Br.checked=Bt:Br.selected=Bt;var ua=X?Wn:Wn.map(function(_n){return _n.value});s(te?ua:ua[0],X?null:Wn.map(function(_n){return _n.label}),Br)}}),an=U.useCallback(function($e,Ye){var Je,nt=Ye.selected,ht=Ye.source,st=Te[$e],_t=st==null?void 0:st.node,St=(Je=_t==null?void 0:_t[W.value])!==null&&Je!==void 0?Je:$e;if(!te)nn([St],{selected:!0,triggerValue:St},"option");else{var Bt=nt?[].concat(yo(wt),[St]):Le.filter(function(Mn){return Mn!==St});if(J){var Ar=Re(Bt),mn=Ar.missingRawValues,Wn=Ar.existRawValues,Br=Wn.map(function(Mn){return Ve.get(Mn).key}),Fi;if(nt){var ua=cl(Br,!0,Te);Fi=ua.checkedKeys}else{var _n=cl(Br,{checked:!1,halfCheckedKeys:Ke},Te);Fi=_n.checkedKeys}Bt=[].concat(yo(mn),yo(Fi.map(function(Mn){return Te[Mn].node[W.value]})))}nn(Bt,{selected:nt,triggerValue:St},ht||"option")}nt||!te?l==null||l(St,Ex(_t)):u==null||u(St,Ex(_t))},[Re,Ve,Te,W,te,wt,nn,J,l,u,Le,Ke]),zn=U.useCallback(function($e){if(ne){var Ye={};Object.defineProperty(Ye,"documentClickClose",{get:function(){return Zt(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),ne($e,Ye)}},[ne]),br=W2(function($e,Ye){var Je=$e.map(function(nt){return nt.value});if(Ye.type==="clear"){nn(Je,{},"selection");return}Ye.values.length&&an(Ye.values[0].value,{selected:!1,source:"selection"})}),de=U.useMemo(function(){return{virtual:H,dropdownMatchSelectWidth:he,listHeight:G,listItemHeight:re,treeData:dt,fieldNames:W,onSelect:an,treeExpandAction:V}},[H,he,G,re,dt,W,an,V]),Fe=U.useMemo(function(){return{checkable:ce,loadData:F,treeLoadedKeys:k,onTreeLoad:P,checkedKeys:Le,halfCheckedKeys:Ke,treeDefaultExpandAll:T,treeExpandedKeys:O,treeDefaultExpandedKeys:L,onTreeExpand:I,treeIcon:fe,treeMotion:ve,showTreeIcon:xe,switcherIcon:ge,treeLine:le,treeNodeFilterProp:b,keyEntities:Te}},[ce,F,k,P,Le,Ke,T,O,L,I,fe,ve,xe,ge,le,b,Te]);return h(z2.Provider,{value:de,children:h(B2.Provider,{value:Fe,children:h(lx,{ref:t,...Ee,id:q,prefixCls:i,mode:te?"multiple":void 0,displayValues:ir,onDisplayValuesChange:br,searchValue:we,onSearch:Ae,OptionList:V2,emptyOptions:!Ce.length,onDropdownVisibleChange:zn,dropdownMatchSelectWidth:he})})})});process.env.NODE_ENV!=="production"&&(H2.displayName="TreeSelect");var qu=H2;qu.TreeNode=q2,qu.SHOW_ALL=uQ,qu.SHOW_PARENT=Sx,qu.SHOW_CHILD=Dx;const wQ=({rotate:e,onClick:t})=>h("svg",{onClick:t,className:"caret-icon",viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"14px",height:"14px",fill:"currentColor","aria-hidden":"true",transform:`rotate(${e})`,children:h("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})}),CQ=({expanded:e,isLeaf:t,value:r,onClick:n,...i})=>(r==="0-0-value"&&console.log(i),t?h("span",{style:{width:"14px",display:"inline-block"}}):h(wQ,{rotate:e?"0":"-90",onClick:n,...i})),SQ=({onClick:e})=>$("svg",{onClick:e,className:"checkbox-icon",width:"16",height:"16",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[h("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),h("rect",{className:"border",x:"4",y:"4",width:"16",height:"16",rx:"2"}),h("rect",{className:"checkmark-indeterminate",x:"8",y:"8",width:"8",height:"8",rx:"2",stroke:"none"}),h("path",{className:"checkmark-checked",d:"M9 12l2 2l4 -4"})]}),DQ=({onClick:e,...t})=>h(SQ,{onClick:e,...t}),EQ=g.createStyles((e,{radius:t=4})=>({root:{borderRadius:e.fn.radius(t),display:"flex",flexWrap:"nowrap",border:"1px solid #ced4da",paddingLeft:"0px",paddingRight:"30px",backgroundColor:"#fff",transition:"border-color 100ms ease",borderColor:"#e9ecef","&.rc-tree-select.rc-tree-select-open":{borderColor:"#228be6 !important",".rc-tree-select-selection-overflow-item-rest":{display:"none"},".rc-tree-select-selection-overflow-item-suffix":{display:"block"}},".rc-tree-select-selector":{height:"auto",lineHeight:1.55,paddingLeft:"12px",resize:"none",boxSizing:"border-box",fontSize:"14px",width:"100%",color:"#000",display:"block",textAlign:"left",minHeight:"36px",cursor:"pointer",flexGrow:1},".rc-tree-select-selection-search-mirror":{display:"none"},".rc-tree-select-selection-search":{flexGrow:1,width:"auto !important"},".rc-tree-select-selection-overflow":{display:"flex",minHeight:"34px",alignItems:"center",flexWrap:"nowrap",marginLeft:"calc(-10px / 2)",boxSizing:"border-box"},".rc-tree-select-selection-overflow-item":{display:"flex",alignItems:"center",backgroundColor:"#f1f3f5",color:"#495057",height:"24px",paddingLeft:"12px",paddingRight:"12px",fontWeight:500,fontSize:"12px",borderRadius:"4px",cursor:"default",userSelect:"none",maxWidth:"calc(100% - 20px)",margin:"calc(10px / 2 - 2px) calc(10px / 2)"},".rc-tree-select-selection-overflow-item-rest":{cursor:"pointer"},".rc-tree-select-selection-overflow-item-suffix":{display:"none",backgroundColor:"transparent",width:"100%",maxWidth:"100%",height:"28px",margin:0,paddingLeft:0,paddingRight:0},input:{flex:1,minWidth:"60px",backgroundColor:"transparent",border:0,outline:0,fontSize:"14px",padding:0,marginLeft:0,color:"inherit",height:"28px",lineHeight:"32px",cursor:"pointer",width:"100%","&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{display:"none"}},".rc-tree-select-clear":{marginRight:"-24px",alignSelf:"center",cursor:"pointer"},"&.rc-tree-select-disabled":{backgroundColor:"rgb(241, 243, 245)",color:"rgb(144, 146, 150)",opacity:.6,"&, .rc-tree-select-selector, input":{cursor:"not-allowed"}}},label:{fontSize:e.fontSizes.sm,fontWeight:500,color:"#212529"},dropdown:{fontSize:e.fontSizes.xs,zIndex:300,paddingTop:"6px","&.rc-tree-select-dropdown-slide-up-leave-active":{display:"none"},".rc-tree-select-tree-list .rc-tree-select-tree-list-holder":{},".rc-tree-select-tree-list, .rc-tree-select-empty":{backgroundColor:"#fff",border:"1px solid #e9ecef",padding:0,boxShadow:"0 1px 3px rgb(0 0 0 / 5%), rgb(0 0 0 / 5%) 0px 10px 15px -5px, rgb(0 0 0 / 4%) 0px 7px 7px -5px",borderRadius:"4px"},".rc-tree-select-empty":{padding:"8px 12px"},".rc-tree-select-tree-treenode":{boxSizing:"border-box",textAlign:"left",width:"100%",padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#000",borderRadius:"4px",display:"flex",flexWrap:"nowrap",overflow:"hidden","&:hover":{backgroundColor:"#f1f3f5"},"&.rc-tree-select-tree-treenode-checkbox-checked":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-checked":{stroke:"rgb(64, 192, 87)",animation:"check 200ms linear forwards"}},"&.rc-tree-select-tree-treenode-checkbox-indeterminate":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-indeterminate":{fill:"rgb(64, 192, 87)"}},".rc-tree-select-tree-switcher":{height:"16px",alignSelf:"center",paddingRight:"2px",transition:"color 200ms ease","&:hover":{color:"#228be6","svg.caret-icon":{color:"#228be6"}},"svg.caret-icon":{color:"#ced4da",transition:"all 200ms ease"}},".rc-tree-select-tree-node-content-wrapper":{display:"flex",flexWrap:"nowrap",overflow:"hidden",alignItems:"center",gap:"8px",transition:"color 200ms ease","&:hover":{color:"#228be6"}},".rc-tree-select-tree-iconEle":{height:"16px","svg .border":{stroke:"#ced4da"},".checkbox-icon .checkmark-indeterminate":{fill:"transparent",transition:"fill 200ms ease"},".checkbox-icon .checkmark-checked":{transform:"scale(1.2)",transformOrigin:"center center",strokeDasharray:10,strokeDashoffset:-10},"@keyframes check":{"0%":{strokeDashoffset:10},"100%":{strokeDashoffset:0}}},".rc-tree-select-tree-title":{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",".rc-tree-select-tree-title-desc":{fontSize:"12px",maxWidth:"100%",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},".rc-tree-select-tree-indent":{flexGrow:0,height:0,verticalAlign:"bottom"},".rc-tree-select-tree-indent-unit":{display:"inline-block",width:"1em"}}}})),NQ=({disabled:e,classNames:t,styles:r,unstyled:n,radius:i,style:a,label:o,value:s,onChange:l,treeData:u})=>{const{classes:c,cx:d}=EQ({radius:i},{name:"FilterTreeSelectWidget",classNames:t,styles:r,unstyled:n}),[f,p]=z.useState((s==null?void 0:s.length)>0),m=y=>{p(y)},v=f&&(s==null?void 0:s.length)>0;return $(g.Stack,{spacing:3,children:[$(g.Group,{position:"apart",children:[h(g.Text,{className:c.label,children:o}),v&&h(g.Tooltip,{label:`${s.length} selected`,children:h(g.Badge,{children:s.length})})]}),h(qu,{disabled:e,allowClear:!0,className:d(c.root,"check-select"),dropdownClassName:d(c.dropdown,""),onDropdownVisibleChange:m,transitionName:"rc-tree-select-dropdown-slide-up",choiceTransitionName:"rc-tree-select-selection__choice-zoom",style:a,treeLine:!0,clearIcon:()=>h(g.CloseButton,{}),switcherIcon:CQ,treeIcon:DQ,maxTagTextLength:10,value:s,treeData:u,treeNodeFilterProp:"filterBasis",treeCheckable:!0,showCheckedStrategy:Sx,onChange:l,onSelect:console.log,maxTagCount:0,maxTagPlaceholder:y=>`${y.length} selected`})]})};function AQ(e){return e.map(t=>{const{label:r,description:n,...i}=t,a={...i,filterBasis:`${r}___${n!=null?n:""}`,description:n,label:r};return n&&(a.label=$("div",{children:[h(g.Text,{title:t.label,children:t.label}),h(g.Text,{className:"rc-tree-select-tree-title-desc",color:"dimmed",title:t.description,children:t.description})]})),a})}const _Q=ke.observer(({label:e,config:t,value:r,onChange:n})=>{const i=ut(),{state:a,dataProxy:o,len:s}=i.getDataStuffByID(t.options_query_id),l=a==="loading",u=z.useMemo(()=>{if(!o)return[];const p=[...o],m=AQ(p);return U9(m)},[o,s]);z.useEffect(()=>{const{default_selection_count:p}=t;if(!p)return;if(u.length===0){console.log("[filter.tree-select] Resetting to empty"),n([],!0);return}const m=u.slice(0,p).map(v=>v.value);console.log(`[filter.tree-select] Selecting first ${p} option(s)`),n(m,!0)},[t.default_selection_count,u]);const c=t.min_width?t.min_width:"200px",f=!!t.options_query_id?l:!1;return h(NQ,{disabled:f,style:{minWidth:c,maxWidth:f?c:"unset",borderColor:"#e9ecef"},value:r,onChange:p=>n(p,!1),treeData:u,label:e})}),MQ=ke.observer(({filter:{type:e,config:t,key:r,...n},formFieldProps:i})=>{switch(e){case"select":return h(q9,{...n,...i,config:t});case"multi-select":return h(V9,{...n,...i,config:t});case"tree-select":return h(_Q,{...n,...i,config:t});case"text-input":return h(G9,{...n,...i,config:t});case"date-range":return h(aN,{...n,...i,config:t});case"checkbox":return h(B9,{...n,...i,config:t});default:return null}}),j2=ke.observer(Pe.default.forwardRef(({filter:e,...t},r)=>h("div",{className:"filter-root",ref:r,children:h(ri,{children:h(MQ,{filter:e,formFieldProps:t})})}))),K2=ke.observer(function({view:t}){const r=ut(),{control:n,handleSubmit:i,reset:a}=ee.useForm({defaultValues:r.filters.values,reValidateMode:"onBlur"}),o=ee.useWatch({control:n});z.useEffect(()=>{a(r.filters.values)},[r.filters.values,a]),z.useEffect(()=>{r.filters.updatePreviewValues(o)},[o]);const s=r.filters.visibleInView(t.id),l=z.useMemo(()=>s.every(f=>f.should_auto_submit),[s]),u=z.useMemo(()=>s.filter(f=>Ne.default.get(f,"config.required",!1)),[s]),c=z.useMemo(()=>u.length===0?!1:u.some(f=>!f.requiredAndPass(o[f.key])),[o,u]);if(s.length===0)return null;const d=(f,p)=>(m,v)=>{p(m),(f.should_auto_submit||v)&&r.filters.setValueByKey(f.key,m)};return h("form",{onSubmit:i(r.filters.setValues),children:$(g.Group,{className:"dashboard-filters",position:"apart",noWrap:!0,sx:l?{}:{border:"1px solid #e9ecef",borderRadius:"4px",padding:"16px"},children:[h(g.Group,{align:"flex-start",children:s.map(f=>h(ee.Controller,{name:f.key,control:n,render:({field:p})=>h(j2,{filter:f,value:p.value,onChange:d(f,p.onChange)})},f.id))}),!l&&h(g.Group,{sx:{alignSelf:"flex-end"},children:h(g.Button,{color:"blue",size:"sm",type:"submit",disabled:c,children:"Search"})})]})})}),gke="";function TQ(e){return e?["<p><br></p>","<p></p>"].includes(e):!0}const Y2=ke.observer(()=>{const{freezeLayout:e}=Pe.default.useContext(ss),[t,r]=Pe.default.useState(!1),{panel:n}=gn();return Pe.default.useEffect(()=>{e(t)},[t]),TQ(n.description)?null:$(tt,{children:[h(g.Modal,{opened:t,onClose:()=>r(!1),title:n.title,withCloseButton:!1,withinPortal:!0,zIndex:310,children:h(Dd,{value:n.description,styles:{root:{border:"none"},content:{padding:0}}})}),h(g.Tooltip,{label:"Click to see description",position:"top-start",withinPortal:!0,children:h(g.ActionIcon,{variant:"subtle",color:"blue",onClick:()=>r(i=>!i),sx:{verticalAlign:"baseline",cursor:"pointer"},children:h(Be.InfoCircle,{size:20})})})]})}),OQ=ke.observer(({view:e})=>{const t=ut(),r=da.useModals(),{panel:n}=gn(),{id:i,query:a}=n,{inEditMode:o}=Pe.default.useContext(ss),s=()=>a==null?void 0:a.fetchData(),{viewPanelInFullScreen:l,inFullScreen:u}=Pe.default.useContext(i1),c=()=>{t.duplicatePanelByID(i,e.id)},d=()=>{t.editor.open(["_VIEWS_",e.id,"_PANELS_",i])},f=()=>r.openConfirmModal({title:"Delete this panel?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>t.removePanelByID(i,e.id),confirmProps:{color:"red"},zIndex:320}),p=Pe.default.useCallback(()=>{l(i)},[i,l]),m=!u&&e.type!==Xt.Modal;return h(tt,{children:h(g.Box,{sx:{position:"absolute",top:0,left:0,right:0,zIndex:300},children:$(g.Menu,{withinPortal:!0,children:[h(g.Menu.Target,{children:h(g.Box,{className:"panel-dropdown-target",sx:{width:"100%",height:"25px"}})}),$(g.Menu.Dropdown,{children:[h(g.Menu.Item,{onClick:s,icon:h(Be.Refresh,{size:14}),children:"Refresh"}),h(g.Menu.Item,{onClick:()=>{var v;return t.queries.downloadDataByQueryID((v=a==null?void 0:a.id)!=null?v:"")},icon:h(Be.Download,{size:14}),children:"Download Data"}),m&&h(g.Menu.Item,{onClick:p,icon:h(Be.ArrowsMaximize,{size:14}),disabled:o,children:"Full Screen"}),o&&$(tt,{children:[h(g.Divider,{label:"Edit",labelPosition:"center"}),h(g.Menu.Item,{onClick:d,icon:h(Be.Settings,{size:14}),children:"Settings"}),h(g.Menu.Item,{onClick:c,icon:h(Be.Copy,{size:14}),children:"Duplicate"}),h(g.Menu.Item,{color:"red",onClick:f,icon:h(Be.Trash,{size:14}),children:"Delete"})]})]})]})})})}),yke="",RQ=ke.observer(function(){const{panel:t}=gn(),{title:r}=t;return r?h(g.Group,{grow:!0,position:"center",px:20,className:"panel-title-wrapper",sx:{flexGrow:1},children:h(g.Text,{align:"center",lineClamp:1,weight:"bold",children:r})}):null}),ma=(e,t)=>{const[r,n]=z.useState([]);return z.useEffect(()=>e.watchTriggerSnapshotList(i=>n(i.filter(a=>a.schemaRef===t))),[]),r};class pl{constructor(t,r){this.root=t,this.path=r}async deleteItem(t){t===null&&await this.root.deleteItem(this.path);const r=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,Se.omit(r,t))}async getItem(t){const r=await this.root.getItem(this.path);return t===null?r:Se.get(r,t)}async setItem(t,r){if(t===null)await this.root.setItem(this.path,r);else{const n=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,{...n,[t]:r})}return await this.getItem(t)}watchItem(t,r,n){return t===null?this.root.watchItem(this.path,(i,a)=>{r(i,a)},n):this.root.watchItem(this.path,(i,a)=>{const o=Se.get(i,t),s=Se.get(a,t);o!==s&&r(o,s)},n)}}class Nx{constructor(t,r,n){at(this,"attachmentStorage");this.instance=t,this.attachmentKey=r,this.constructInstance=n,this.attachmentStorage=new pl(t.instanceData,r)}async getInstance(t){if(await this.attachmentStorage.getItem(t))return this.constructInstance(new pl(this.attachmentStorage,t))}async create(t,r){return await this.attachmentStorage.setItem(t,r),this.constructInstance(new pl(this.attachmentStorage,t))}async remove(t){await this.attachmentStorage.deleteItem(t)}async list(){const t=await this.attachmentStorage.getItem(null);return Promise.all(Se.values(t).map(r=>this.constructInstance(new pl(this.attachmentStorage,r.id))))}}class X2{constructor(t){at(this,"rootRef");this.rootRef=cr.observable({current:t})}async deleteItem(t){cr.runInAction(()=>{Se.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?cr.toJS(this.rootRef.current):Se.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(Se.isObject(r))cr.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else cr.runInAction(()=>{Se.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,n){return cr.reaction(()=>this.getValueFromRoot(t),(i,a)=>{r(i,a)},{requiresObservable:!0,fireImmediately:Se.get(n,"fireImmediately",!1)})}}class IQ{constructor(){at(this,"channels",new Map);at(this,"globalChannel",new pE.default)}getChannel(t){const r=this.channels.get(t);if(r)return r;const n=new pE.default;return this.channels.set(t,n),n}}class kQ{constructor(t){at(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const r=this.instances.get(t.id);if(r)return r;const n={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new IQ,instanceData:new X2(t.viz.conf)};return this.instances.set(t.id,n),n}}function Z2(e,t,r,n){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new X2({}),colorPalette:{getColor(){return()=>""}},data:t,variables:n}}const PQ=e=>{const{panel:t,vizManager:r,data:n,variables:i}=e,a=r.resolveComponent(t.viz.type),o=r.getOrCreateInstance(t),s={...Z2(o,n,r,i),viewport:{width:t.layout.w,height:t.layout.h}},l=a.viewRender;return h(l,{context:s,instance:o,...Se.omit(e,["panel","vizManager","data"])})},FQ=e=>{const{vizManager:t,panel:r,panelInfoEditor:n,data:i,variables:a}=e,o=t.resolveComponent(r.viz.type),s=t.getOrCreateInstance(r),l={...Z2(s,i,t,a),panelInfoEditor:n},u=o.configRender;return h(u,{context:l,instance:s,...Se.omit(e,["panel","vizManager","data","panelInfoEditor"])})},Q2=(e,t)=>{const r=bu.default.bezier(e),n=bu.default.bezier(t);return function(i){return i<50?r(i*2/100).hex():n((i-50)*2/100).hex()}},uf=e=>{const t=bu.default.bezier(e);return function(r){return t(r/100).hex()}},$Q={type:"interpolation",displayName:"Red / Green",getColor:Q2(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},BQ={type:"interpolation",displayName:"Yellow / Blue",getColor:Q2(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},zQ={type:"interpolation",displayName:"Red",getColor:uf(["#fff7f1","darkred"]),name:"red",category:"sequential"},LQ={type:"interpolation",displayName:"Green",getColor:uf(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},VQ={type:"interpolation",displayName:"Blue",getColor:uf(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},qQ={type:"interpolation",displayName:"Orange",getColor:uf(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"},J2="@devtable/dashboard",Ax="8.50.3",eM="Apache-2.0",tM={access:"public",registry:"https://registry.npmjs.org/"},rM=["dist"],nM="./dist/dashboard.umd.js",iM="./dist/dashboard.es.js",aM="./dist/index.d.ts",oM={".":{import:"./dist/dashboard.es.js",require:"./dist/dashboard.umd.js"},"./dist/style.css":{import:"./dist/style.css",require:"./dist/style.css"}},sM={"dev-build":"tsc && vite build --watch",build:"tsc && vite build",preview:"vite preview",test:"vitest","test:ui":"vitest --ui",coverage:"vitest --coverage"},lM={"@monaco-editor/react":"4.4.6","@types/chroma-js":"^2.1.4","file-saver":"2.0.5",mathjs:"11.7.0","monaco-editor":"0.36.0","performant-array-to-tree":"1.11.0",popmotion:"^11.0.3","rc-tree-select":"5.5.5",reactflow:"^11.5.3"},uM={"@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/form":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"^1.118.0","@testing-library/cypress":"^8.0.3","@testing-library/jest-dom":"^5.16.4","@testing-library/react":"^13.3.0","@testing-library/react-hooks":"^8.0.1","@testing-library/user-event":"^14.3.0","@tiptap/extension-code-block-lowlight":"2.0.1","@tiptap/extension-color":"2.0.1","@tiptap/extension-highlight":"2.0.1","@tiptap/extension-link":"2.0.1","@tiptap/extension-placeholder":"2.0.1","@tiptap/extension-subscript":"2.0.1","@tiptap/extension-superscript":"2.0.1","@tiptap/extension-table":"2.0.1","@tiptap/extension-table-cell":"2.0.1","@tiptap/extension-table-header":"2.0.1","@tiptap/extension-table-row":"2.0.1","@tiptap/extension-text-align":"2.0.1","@tiptap/extension-text-style":"2.0.1","@tiptap/extension-underline":"2.0.1","@tiptap/pm":"2.0.1","@tiptap/react":"2.0.1","@tiptap/starter-kit":"2.0.1","@types/crypto-js":"v4.1.1","@types/d3-array":"3.0.3","@types/eventemitter2":"^4.1.0","@types/file-saver":"2.0.5","@types/lodash":"^4.14.182","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@types/react-grid-layout":"^1.3.2",ahooks:"^3.3.11",ajv:"8.11.0",axios:"^0.27.2","crypto-js":"^4.1.1",cypress:"^10.6.0","cypress-wait-until":"^1.7.2",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",jsdom:"^20.0.0","jsdom-testing-mocks":"^1.5.0",lodash:"^4.17.21",lowlight:"^2.8.0",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","rollup-plugin-visualizer":"5.6.0","tabler-icons-react":"^1.48.0",typescript:"^4.6.3","vite-plugin-static-copy":"0.13.1"},cM={"@emotion/react":"11.10.0","@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/form":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"^1.118.0","@tanstack/react-table":"^8.5.13","@tiptap/extension-code-block-lowlight":"2.0.1","@tiptap/extension-color":"2.0.1","@tiptap/extension-highlight":"2.0.1","@tiptap/extension-link":"2.0.1","@tiptap/extension-placeholder":"2.0.1","@tiptap/extension-subscript":"2.0.1","@tiptap/extension-superscript":"2.0.1","@tiptap/extension-table":"2.0.1","@tiptap/extension-table-cell":"2.0.1","@tiptap/extension-table-header":"2.0.1","@tiptap/extension-table-row":"2.0.1","@tiptap/extension-text-align":"2.0.1","@tiptap/extension-text-style":"2.0.1","@tiptap/extension-underline":"2.0.1","@tiptap/pm":"2.0.1","@tiptap/react":"2.0.1","@tiptap/starter-kit":"2.0.1",ahooks:"^3.3.11",axios:"^0.27.2","chroma-js":"^2.4.2","d3-array":"3.2.0","d3-regression":"1.2.8",dayjs:"1.11.6",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",eventemitter2:"^6.4.6",jszip:"3.10.1",lodash:"^4.17.21",lowlight:"^2.8.0",mobx:"^6.6.1","mobx-react-lite":"^3.4.0","mobx-state-tree":"^5.1.5",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2",react:"^16.8.0 || 17.x || 18.x","react-dom":"^16.8.0 || 17.x || 18.x","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","react-virtual":"^2.10.4","tabler-icons-react":"^1.48.0"},GQ=Object.freeze(Object.defineProperty({__proto__:null,name:J2,version:Ax,license:eM,publishConfig:tM,files:rM,main:nM,module:iM,types:aM,exports:oM,scripts:sM,dependencies:lM,devDependencies:uM,peerDependencies:cM,default:{name:J2,version:Ax,license:eM,publishConfig:tM,files:rM,main:nM,module:iM,types:aM,exports:oM,scripts:sM,dependencies:lM,devDependencies:uM,peerDependencies:cM}},Symbol.toStringTag,{value:"Module"}));class UQ{constructor(t){at(this,"staticColors",new Map);at(this,"interpolations",new Map);t.installedPlugins.forEach(r=>{r.manifest.color.forEach(n=>{this.register(n)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const r=this.encodeColor(t);t.type==="single"?(this.staticColors.has(r)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(r,t)):t.type==="interpolation"&&(this.interpolations.has(r)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(r,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class WQ{constructor(){at(this,"plugins",new Map);at(this,"vizComponents",new Map);at(this,"factory",{viz:t=>{const r=this.vizComponents.get(t);if(r)return r;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const r of t.manifest.viz){if(this.vizComponents.has(r.name))throw new Error(`Viz Component (${r.name}) has been installed before`);this.vizComponents.set(r.name,r)}}get installedPlugins(){return Array.from(this.plugins.values())}}class HQ{constructor(){at(this,"migrations",[])}version(t,r){return this.migrations.push({version:t,handler:r}),this}run(t,r,n){var o;if(t.from===t.to)return r;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(s=>s.version>t.from&&s.version<=t.to),a=Se.orderBy(i,"version","asc");if(((o=Se.last(a))==null?void 0:o.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((s,l)=>l.handler(s,n),r)}}class Jr extends HQ{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(n,i)=>({version:t,...r(n,i)}))}async migrate({configData:t,panelModel:r}){const n=await t.getItem(null),i=Se.get(n,"version",0),a=this.run({from:i,to:this.VERSION},n,{panelModel:r});await t.setItem(null,a)}async needMigration({configData:t}){const r=await t.getItem(null);return Se.get(r,"version",0)<this.VERSION}}const Et=(e,t)=>{const[r,{setFalse:n}]=Wt.useBoolean(!0),[i,a]=z.useState();z.useEffect(()=>(e.getItem(t).then(s=>{a(s),n()}),e.watchItem(t,s=>{a(s)})));const o=z.useCallback(async s=>{await e.setItem(t,s),a(s)},[e,t]);return{loading:r,value:i,set:o}},_x={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};wr.use([mt.GridComponent,mt.VisualMapComponent,mt.LegendComponent,mt.TooltipComponent,ei.CanvasRenderer]);function jQ({context:e}){const{value:t}=Et(e.instanceData,"config"),r=e.data,{width:n,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:o,z_axis_data_key:s,xAxis3D:l,yAxis3D:u,zAxis3D:c}=Se.defaults({},t,_x),d=z.useMemo(()=>{const m=Se.minBy(r,v=>v[s]);return Se.get(m,s)},[r,s]),f=z.useMemo(()=>{const m=Se.maxBy(r,v=>v[s]);return Se.get(m,s)},[r,s]),p={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:d,max:f,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:l,yAxis3D:u,zAxis3D:c,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:r.map(m=>[m[a],m[o],m[s]])}]};return t?h(ti.default,{echarts:wr,option:p,style:{width:n,height:i},notMerge:!0,theme:"merico-light"}):null}function KQ({label:e,required:t,value:r,onChange:n,data:i,clearable:a=!1,sx:o,...s},l){const u=Pe.default.useMemo(()=>{if(!Array.isArray(i)||i.length===0)return[];const d=Object.keys(i[0]).map(f=>({label:f,value:f}));return a?d.concat([{label:"unset",value:""}]):d},[i]);return h(g.Select,{ref:l,label:e,data:u,value:r,onChange:n,required:t,sx:o,...s})}const It=Pe.default.forwardRef(KQ);function YQ({context:e}){const{value:t,set:r}=Et(e.instanceData,"config"),n=e.data,i=Se.defaults({},t,_x),{control:a,handleSubmit:o,reset:s}=ee.useForm({defaultValues:i});return z.useEffect(()=>{s(i)},[t]),t?h(g.Stack,{spacing:"xs",children:$("form",{onSubmit:o(r),children:[h(g.Text,{children:"X Axis"}),$(g.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[h(ee.Controller,{name:"x_axis_data_key",control:a,render:({field:l})=>h(It,{label:"Data Field",required:!0,data:n,...l})}),h(ee.Controller,{name:"xAxis3D.name",control:a,render:({field:l})=>h(g.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...l})})]}),h(g.Text,{mt:"lg",children:"Y Axis"}),$(g.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[h(ee.Controller,{name:"y_axis_data_key",control:a,render:({field:l})=>h(It,{label:"Data Field",required:!0,data:n,...l})}),h(ee.Controller,{name:"yAxis3D.name",control:a,render:({field:l})=>h(g.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...l})})]}),h(g.Text,{mt:"lg",children:"Z Axis"}),$(g.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[h(ee.Controller,{name:"z_axis_data_key",control:a,render:({field:l})=>h(It,{label:"Data Field",required:!0,data:n,...l})}),h(ee.Controller,{name:"zAxis3D.name",control:a,render:({field:l})=>h(g.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...l})})]}),h(g.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:$(g.Button,{color:"blue",type:"submit",children:[h(Be.DeviceFloppy,{size:20}),h(g.Text,{ml:"md",children:"Save"})]})})]})}):null}class XQ extends Jr{constructor(){super(...arguments);at(this,"VERSION",1)}configVersions(){this.version(1,r=>({version:1,config:r}))}}const ZQ={displayName:"Bar Chart (3D)",displayGroup:"ECharts-based charts",migrator:new XQ,name:"bar-3d",viewRender:jQ,configRender:YQ,createConfig(){return{version:1,config:Se.cloneDeep(_x)}}},Kn={mantissa:0,output:"number",trimMantissa:!1,average:!1};function QQ({value:e,onChange:t},r){const n=s=>{t({...e,output:s})},i=s=>{const l=s===0?!1:e.trimMantissa;t({...e,mantissa:s,trimMantissa:l})},a=s=>{t({...e,trimMantissa:s.currentTarget.checked})},o=s=>{t({...e,average:s.currentTarget.checked})};return $(g.Stack,{ref:r,children:[$(g.Group,{grow:!0,children:[h(g.Select,{label:"Format",data:[{label:"1234",value:"number"},{label:"99%",value:"percent"}],value:e.output,onChange:n,sx:{flexGrow:1}}),h(g.Switch,{label:$(g.Stack,{spacing:0,children:[h(g.Text,{children:"Average"}),h(g.Text,{size:12,color:"gray",children:"like 1.234k, 1.234m"})]}),checked:e.average,onChange:o,disabled:e.output!=="number",sx:{flexGrow:1},styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"},label:{display:"block"}}})]}),$(g.Group,{grow:!0,children:[h(g.NumberInput,{label:"Mantissa",defaultValue:0,min:0,step:1,max:4,value:e.mantissa,onChange:i}),h(g.Switch,{label:"Trim mantissa",checked:e.trimMantissa,onChange:a,disabled:e.mantissa===0,styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"}}})]}),$(g.Stack,{spacing:0,children:[h(g.Text,{weight:"bold",children:"Preview"}),h(ri,{children:$(g.Group,{position:"apart",children:[$(g.Text,{size:12,color:"gray",children:["123456789 ",h(Be.ArrowRight,{size:9})," ",Tr.default(123456789).format(e)]}),$(g.Text,{size:12,color:"gray",children:["1234 ",h(Be.ArrowRight,{size:9})," ",Tr.default(1234).format(e)]}),$(g.Text,{size:12,color:"gray",children:["0.1234 ",h(Be.ArrowRight,{size:9})," ",Tr.default(.1234).format(e)]})]})})]})]})}const va=Pe.default.forwardRef(QQ),ga={enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
75
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fl(e,t){return KZ(e)||YZ(e,t)||v2(e,t)||XZ()}var ZZ=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],T2=function(t,r){var n=t.className,i=t.style,a=t.motion,o=t.motionNodes,s=t.motionType,l=t.onMotionStart,u=t.onMotionEnd,c=t.active,d=t.treeNodeRequiredProps,f=sf(t,ZZ),p=U.useState(!0),m=fl(p,2),v=m[0],y=m[1],b=U.useContext(mx),D=b.prefixCls,x=U.useRef(!1),S=function(){x.current||u(),x.current=!0};return z.useEffect(function(){o&&s==="hide"&&v&&y(!1)},[o]),z.useEffect(function(){return o&&l(),function(){o&&S()}},[]),o?h(Ld,{ref:r,visible:v,...a,motionAppear:s==="show",onAppearEnd:S,onLeaveEnd:S,children:function(w,C){var E=w.className,A=w.style;return h("div",{ref:C,className:dr("".concat(D,"-treenode-motion"),E),style:A,children:o.map(function(_){var N=af({},(M2(_.data),_.data)),M=_.title,R=_.key,F=_.isStart,k=_.isEnd;delete N.children;var P=Vu(R,d);return z.createElement(dl,{...N,...P,title:M,active:c,data:_.data,key:R,isStart:F,isEnd:k})})})}}):h(dl,{domRef:r,className:n,style:i,...f,active:c})};T2.displayName="MotionTreeNode";var QZ=U.forwardRef(T2);function JZ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=e.length,n=t.length;if(Math.abs(r-n)!==1)return{add:!1,key:null};function i(a,o){var s=new Map;a.forEach(function(u){s.set(u,!0)});var l=o.filter(function(u){return!s.has(u)});return l.length===1?l[0]:null}return r<n?{add:!0,key:i(e,t)}:{add:!1,key:i(t,e)}}function O2(e,t,r){var n=e.findIndex(function(s){return s.key===r}),i=e[n+1],a=t.findIndex(function(s){return s.key===r});if(i){var o=t.findIndex(function(s){return s.key===i.key});return t.slice(a+1,o)}return t.slice(a+1)}var eQ=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],R2={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},tQ=function(){},fs="RC_TREE_MOTION_".concat(Math.random()),bx={key:fs},I2={key:fs,level:0,index:0,pos:"0",node:bx,nodes:[bx]},k2={parent:null,children:[],pos:I2.pos,data:bx,title:null,key:fs,isStart:[],isEnd:[]};function P2(e,t,r,n){return t===!1||!r?e:e.slice(0,Math.ceil(r/n)+1)}function F2(e){var t=e.key,r=e.pos;return Lu(t,r)}function rQ(e){for(var t=String(e.data.key),r=e;r.parent;)r=r.parent,t="".concat(r.data.key," > ").concat(t);return t}var $2=U.forwardRef(function(e,t){var r=e.prefixCls,n=e.data;e.selectable,e.checkable;var i=e.expandedKeys,a=e.selectedKeys,o=e.checkedKeys,s=e.loadedKeys,l=e.loadingKeys,u=e.halfCheckedKeys,c=e.keyEntities,d=e.disabled,f=e.dragging,p=e.dragOverNodeKey,m=e.dropPosition,v=e.motion,y=e.height,b=e.itemHeight,D=e.virtual,x=e.focusable,S=e.activeItem,w=e.focused,C=e.tabIndex,E=e.onKeyDown,A=e.onFocus,_=e.onBlur,N=e.onActiveChange,M=e.onListChangeStart,R=e.onListChangeEnd,F=sf(e,eQ),k=U.useRef(null),P=U.useRef(null);U.useImperativeHandle(t,function(){return{scrollTo:function(De){k.current.scrollTo(De)},getIndentWidth:function(){return P.current.offsetWidth}}});var T=U.useState(i),O=fl(T,2),L=O[0],I=O[1],V=U.useState(n),H=fl(V,2),Z=H[0],G=H[1],Y=U.useState(n),re=fl(Y,2),ne=re[0],pe=re[1],he=U.useState([]),le=fl(he,2),fe=le[0],xe=le[1],ge=U.useState(null),ve=fl(ge,2),Ee=ve[0],q=ve[1],J=U.useRef(n);J.current=n;function ce(){var ae=J.current;G(ae),pe(ae),xe([]),q(null),R()}U.useEffect(function(){I(i);var ae=JZ(L,i);if(ae.key!==null)if(ae.add){var De=Z.findIndex(function(we){var _e=we.key;return _e===ae.key}),be=P2(O2(Z,n,ae.key),D,y,b),K=Z.slice();K.splice(De+1,0,k2),pe(K),xe(be),q("show")}else{var W=n.findIndex(function(we){var _e=we.key;return _e===ae.key}),ue=P2(O2(n,Z,ae.key),D,y,b),me=n.slice();me.splice(W+1,0,k2),pe(me),xe(ue),q("hide")}else Z!==n&&(G(n),pe(n))},[i,n]),U.useEffect(function(){f||ce()},[f]);var X=v?ne:n,te={expandedKeys:i,selectedKeys:a,loadedKeys:s,loadingKeys:l,checkedKeys:o,halfCheckedKeys:u,dragOverNodeKey:p,dropPosition:m,keyEntities:c};return $(tt,{children:[w&&S&&h("span",{style:R2,"aria-live":"assertive",children:rQ(S)}),h("div",{children:h("input",{style:R2,disabled:x===!1||d,tabIndex:x!==!1?C:null,onKeyDown:E,onFocus:A,onBlur:_,value:"",onChange:tQ,"aria-label":"for screen reader"})}),h("div",{className:"".concat(r,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0},children:h("div",{className:"".concat(r,"-indent"),children:h("div",{ref:P,className:"".concat(r,"-indent-unit")})})}),h(fx,{...F,data:X,itemKey:F2,height:y,fullHeight:!1,virtual:D,itemHeight:b,prefixCls:"".concat(r,"-list"),ref:k,onVisibleChange:function(De,be){var K=new Set(De),W=be.filter(function(ue){return!K.has(ue)});W.some(function(ue){return F2(ue)===fs})&&ce()},children:function(ae){var De=ae.pos,be=af({},(M2(ae.data),ae.data)),K=ae.title,W=ae.key,ue=ae.isStart,me=ae.isEnd,we=Lu(W,De);delete be.key,delete be.children;var _e=Vu(we,te);return h(QZ,{...be,..._e,title:K,active:!!S&&W===S.key,pos:De,data:ae.data,isStart:ue,isEnd:me,motion:v,motionNodes:W===fs?fe:null,motionType:Ee,onMotionStart:M,onMotionEnd:ce,treeNodeRequiredProps:te,onMouseMove:function(){N(null)}})}})]})});$2.displayName="NodeList";function nQ(e){var t=e.dropPosition,r=e.dropLevelOffset,n=e.indent,i={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(t){case-1:i.top=0,i.left=-r*n;break;case 1:i.bottom=0,i.left=-r*n;break;case 0:i.bottom=0,i.left=n;break}return h("div",{style:i})}var iQ=10,xx=function(e){x2(r,e);var t=w2(r);function r(){var n;g2(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=t.call.apply(t,[this].concat(a)),n.destroyed=!1,n.delayedDragEnterLogic=void 0,n.loadingRetryTimes={},n.state={keyEntities:{},indent:null,selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null,fieldNames:lf()},n.dragStartMousePosition=null,n.dragNode=void 0,n.currentMouseOverDroppableNodeKey=null,n.listRef=U.createRef(),n.onNodeDragStart=function(s,l){var u=n.state,c=u.expandedKeys,d=u.keyEntities,f=n.props.onDragStart,p=l.props.eventKey;n.dragNode=l,n.dragStartMousePosition={x:s.clientX,y:s.clientY};var m=Wa(c,p);n.setState({draggingNodeKey:p,dragChildrenKeys:WZ(p,d),indent:n.listRef.current.getIndentWidth()}),n.setExpandedKeys(m),window.addEventListener("dragend",n.onWindowDragEnd),f==null||f({event:s,node:Qr(l.props)})},n.onNodeDragEnter=function(s,l){var u=n.state,c=u.expandedKeys,d=u.keyEntities,f=u.dragChildrenKeys,p=u.flattenNodes,m=u.indent,v=n.props,y=v.onDragEnter,b=v.onExpand,D=v.allowDrop,x=v.direction,S=l.props,w=S.pos,C=S.eventKey,E=Ua(n),A=E.dragNode;if(n.currentMouseOverDroppableNodeKey!==C&&(n.currentMouseOverDroppableNodeKey=C),!A){n.resetDragState();return}var _=N2(s,A,l,m,n.dragStartMousePosition,D,p,d,c,x),N=_.dropPosition,M=_.dropLevelOffset,R=_.dropTargetKey,F=_.dropContainerKey,k=_.dropTargetPos,P=_.dropAllowed,T=_.dragOverNodeKey;if(f.indexOf(R)!==-1||!P){n.resetDragState();return}if(n.delayedDragEnterLogic||(n.delayedDragEnterLogic={}),Object.keys(n.delayedDragEnterLogic).forEach(function(O){clearTimeout(n.delayedDragEnterLogic[O])}),A.props.eventKey!==l.props.eventKey&&(s.persist(),n.delayedDragEnterLogic[w]=window.setTimeout(function(){if(n.state.draggingNodeKey!==null){var O=ds(c),L=d[l.props.eventKey];L&&(L.children||[]).length&&(O=No(c,l.props.eventKey)),"expandedKeys"in n.props||n.setExpandedKeys(O),b==null||b(O,{node:Qr(l.props),expanded:!0,nativeEvent:s.nativeEvent})}},800)),A.props.eventKey===R&&M===0){n.resetDragState();return}n.setState({dragOverNodeKey:T,dropPosition:N,dropLevelOffset:M,dropTargetKey:R,dropContainerKey:F,dropTargetPos:k,dropAllowed:P}),y==null||y({event:s,node:Qr(l.props),expandedKeys:c})},n.onNodeDragOver=function(s,l){var u=n.state,c=u.dragChildrenKeys,d=u.flattenNodes,f=u.keyEntities,p=u.expandedKeys,m=u.indent,v=n.props,y=v.onDragOver,b=v.allowDrop,D=v.direction,x=Ua(n),S=x.dragNode;if(!!S){var w=N2(s,S,l,m,n.dragStartMousePosition,b,d,f,p,D),C=w.dropPosition,E=w.dropLevelOffset,A=w.dropTargetKey,_=w.dropContainerKey,N=w.dropAllowed,M=w.dropTargetPos,R=w.dragOverNodeKey;c.indexOf(A)!==-1||!N||(S.props.eventKey===A&&E===0?n.state.dropPosition===null&&n.state.dropLevelOffset===null&&n.state.dropTargetKey===null&&n.state.dropContainerKey===null&&n.state.dropTargetPos===null&&n.state.dropAllowed===!1&&n.state.dragOverNodeKey===null||n.resetDragState():C===n.state.dropPosition&&E===n.state.dropLevelOffset&&A===n.state.dropTargetKey&&_===n.state.dropContainerKey&&M===n.state.dropTargetPos&&N===n.state.dropAllowed&&R===n.state.dragOverNodeKey||n.setState({dropPosition:C,dropLevelOffset:E,dropTargetKey:A,dropContainerKey:_,dropTargetPos:M,dropAllowed:N,dragOverNodeKey:R}),y==null||y({event:s,node:Qr(l.props)}))}},n.onNodeDragLeave=function(s,l){n.currentMouseOverDroppableNodeKey===l.props.eventKey&&!s.currentTarget.contains(s.relatedTarget)&&(n.resetDragState(),n.currentMouseOverDroppableNodeKey=null);var u=n.props.onDragLeave;u==null||u({event:s,node:Qr(l.props)})},n.onWindowDragEnd=function(s){n.onNodeDragEnd(s,null,!0),window.removeEventListener("dragend",n.onWindowDragEnd)},n.onNodeDragEnd=function(s,l){var u=n.props.onDragEnd;n.setState({dragOverNodeKey:null}),n.cleanDragState(),u==null||u({event:s,node:Qr(l.props)}),n.dragNode=null,window.removeEventListener("dragend",n.onWindowDragEnd)},n.onNodeDrop=function(s,l){var u,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,d=n.state,f=d.dragChildrenKeys,p=d.dropPosition,m=d.dropTargetKey,v=d.dropTargetPos,y=d.dropAllowed;if(!!y){var b=n.props.onDrop;if(n.setState({dragOverNodeKey:null}),n.cleanDragState(),m!==null){var D=yn(yn({},Vu(m,n.getTreeNodeRequiredProps())),{},{active:((u=n.getActiveItem())===null||u===void 0?void 0:u.key)===m,data:n.state.keyEntities[m].node}),x=f.indexOf(m)!==-1;Zt(!x,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var S=gx(v),w={event:s,node:Qr(D),dragNode:n.dragNode?Qr(n.dragNode.props):null,dragNodesKeys:[n.dragNode.props.eventKey].concat(f),dropToGap:p!==0,dropPosition:p+Number(S[S.length-1])};c||b==null||b(w),n.dragNode=null}}},n.cleanDragState=function(){var s=n.state.draggingNodeKey;s!==null&&n.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),n.dragStartMousePosition=null,n.currentMouseOverDroppableNodeKey=null},n.triggerExpandActionExpand=function(s,l){var u=n.state,c=u.expandedKeys,d=u.flattenNodes,f=l.expanded,p=l.key,m=l.isLeaf;if(!(m||s.shiftKey||s.metaKey||s.ctrlKey)){var v=d.filter(function(b){return b.key===p})[0],y=Qr(yn(yn({},Vu(p,n.getTreeNodeRequiredProps())),{},{data:v.data}));n.setExpandedKeys(f?Wa(c,p):No(c,p)),n.onNodeExpand(s,y)}},n.onNodeClick=function(s,l){var u=n.props,c=u.onClick,d=u.expandAction;d==="click"&&n.triggerExpandActionExpand(s,l),c==null||c(s,l)},n.onNodeDoubleClick=function(s,l){var u=n.props,c=u.onDoubleClick,d=u.expandAction;d==="doubleClick"&&n.triggerExpandActionExpand(s,l),c==null||c(s,l)},n.onNodeSelect=function(s,l){var u=n.state.selectedKeys,c=n.state,d=c.keyEntities,f=c.fieldNames,p=n.props,m=p.onSelect,v=p.multiple,y=l.selected,b=l[f.key],D=!y;D?v?u=No(u,b):u=[b]:u=Wa(u,b);var x=u.map(function(S){var w=d[S];return w?w.node:null}).filter(function(S){return S});n.setUncontrolledState({selectedKeys:u}),m==null||m(u,{event:"select",selected:D,node:l,selectedNodes:x,nativeEvent:s.nativeEvent})},n.onNodeCheck=function(s,l,u){var c=n.state,d=c.keyEntities,f=c.checkedKeys,p=c.halfCheckedKeys,m=n.props,v=m.checkStrictly,y=m.onCheck,b=l.key,D,x={event:"check",node:l,checked:u,nativeEvent:s.nativeEvent};if(v){var S=u?No(f,b):Wa(f,b),w=Wa(p,b);D={checked:S,halfChecked:w},x.checkedNodes=S.map(function(M){return d[M]}).filter(function(M){return M}).map(function(M){return M.node}),n.setUncontrolledState({checkedKeys:S})}else{var C=cl([].concat(ds(f),[b]),!0,d),E=C.checkedKeys,A=C.halfCheckedKeys;if(!u){var _=new Set(E);_.delete(b);var N=cl(Array.from(_),{checked:!1,halfCheckedKeys:A},d);E=N.checkedKeys,A=N.halfCheckedKeys}D=E,x.checkedNodes=[],x.checkedNodesPositions=[],x.halfCheckedKeys=A,E.forEach(function(M){var R=d[M];if(!!R){var F=R.node,k=R.pos;x.checkedNodes.push(F),x.checkedNodesPositions.push({node:F,pos:k})}}),n.setUncontrolledState({checkedKeys:E},!1,{halfCheckedKeys:A})}y==null||y(D,x)},n.onNodeLoad=function(s){var l=s.key,u=new Promise(function(c,d){n.setState(function(f){var p=f.loadedKeys,m=p===void 0?[]:p,v=f.loadingKeys,y=v===void 0?[]:v,b=n.props,D=b.loadData,x=b.onLoad;if(!D||m.indexOf(l)!==-1||y.indexOf(l)!==-1)return null;var S=D(s);return S.then(function(){var w=n.state.loadedKeys,C=No(w,l);x==null||x(C,{event:"load",node:s}),n.setUncontrolledState({loadedKeys:C}),n.setState(function(E){return{loadingKeys:Wa(E.loadingKeys,l)}}),c()}).catch(function(w){if(n.setState(function(E){return{loadingKeys:Wa(E.loadingKeys,l)}}),n.loadingRetryTimes[l]=(n.loadingRetryTimes[l]||0)+1,n.loadingRetryTimes[l]>=iQ){var C=n.state.loadedKeys;Zt(!1,"Retry for `loadData` many times but still failed. No more retry."),n.setUncontrolledState({loadedKeys:No(C,l)}),c()}d(w)}),{loadingKeys:No(y,l)}})});return u.catch(function(){}),u},n.onNodeMouseEnter=function(s,l){var u=n.props.onMouseEnter;u==null||u({event:s,node:l})},n.onNodeMouseLeave=function(s,l){var u=n.props.onMouseLeave;u==null||u({event:s,node:l})},n.onNodeContextMenu=function(s,l){var u=n.props.onRightClick;u&&(s.preventDefault(),u({event:s,node:l}))},n.onFocus=function(){var s=n.props.onFocus;n.setState({focused:!0});for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];s==null||s.apply(void 0,u)},n.onBlur=function(){var s=n.props.onBlur;n.setState({focused:!1}),n.onActiveChange(null);for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];s==null||s.apply(void 0,u)},n.getTreeNodeRequiredProps=function(){var s=n.state,l=s.expandedKeys,u=s.selectedKeys,c=s.loadedKeys,d=s.loadingKeys,f=s.checkedKeys,p=s.halfCheckedKeys,m=s.dragOverNodeKey,v=s.dropPosition,y=s.keyEntities;return{expandedKeys:l||[],selectedKeys:u||[],loadedKeys:c||[],loadingKeys:d||[],checkedKeys:f||[],halfCheckedKeys:p||[],dragOverNodeKey:m,dropPosition:v,keyEntities:y}},n.setExpandedKeys=function(s){var l=n.state,u=l.treeData,c=l.fieldNames,d=vx(u,s,c);n.setUncontrolledState({expandedKeys:s,flattenNodes:d},!0)},n.onNodeExpand=function(s,l){var u=n.state.expandedKeys,c=n.state,d=c.listChanging,f=c.fieldNames,p=n.props,m=p.onExpand,v=p.loadData,y=l.expanded,b=l[f.key];if(!d){var D=u.indexOf(b),x=!y;if(Zt(y&&D!==-1||!y&&D===-1,"Expand state not sync with index check"),x?u=No(u,b):u=Wa(u,b),n.setExpandedKeys(u),m==null||m(u,{node:l,expanded:x,nativeEvent:s.nativeEvent}),x&&v){var S=n.onNodeLoad(l);S&&S.then(function(){var w=vx(n.state.treeData,u,f);n.setUncontrolledState({flattenNodes:w})}).catch(function(){var w=n.state.expandedKeys,C=Wa(w,b);n.setExpandedKeys(C)})}}},n.onListChangeStart=function(){n.setUncontrolledState({listChanging:!0})},n.onListChangeEnd=function(){setTimeout(function(){n.setUncontrolledState({listChanging:!1})})},n.onActiveChange=function(s){var l=n.state.activeKey,u=n.props.onActiveChange;l!==s&&(n.setState({activeKey:s}),s!==null&&n.scrollTo({key:s}),u==null||u(s))},n.getActiveItem=function(){var s=n.state,l=s.activeKey,u=s.flattenNodes;return l===null?null:u.find(function(c){var d=c.key;return d===l})||null},n.offsetActiveKey=function(s){var l=n.state,u=l.flattenNodes,c=l.activeKey,d=u.findIndex(function(m){var v=m.key;return v===c});d===-1&&s<0&&(d=u.length),d=(d+s+u.length)%u.length;var f=u[d];if(f){var p=f.key;n.onActiveChange(p)}else n.onActiveChange(null)},n.onKeyDown=function(s){var l=n.state,u=l.activeKey,c=l.expandedKeys,d=l.checkedKeys,f=l.fieldNames,p=n.props,m=p.onKeyDown,v=p.checkable,y=p.selectable;switch(s.which){case qe.UP:{n.offsetActiveKey(-1),s.preventDefault();break}case qe.DOWN:{n.offsetActiveKey(1),s.preventDefault();break}}var b=n.getActiveItem();if(b&&b.data){var D=n.getTreeNodeRequiredProps(),x=b.data.isLeaf===!1||!!(b.data[f.children]||[]).length,S=Qr(yn(yn({},Vu(u,D)),{},{data:b.data,active:!0}));switch(s.which){case qe.LEFT:{x&&c.includes(u)?n.onNodeExpand({},S):b.parent&&n.onActiveChange(b.parent.key),s.preventDefault();break}case qe.RIGHT:{x&&!c.includes(u)?n.onNodeExpand({},S):b.children&&b.children.length&&n.onActiveChange(b.children[0].key),s.preventDefault();break}case qe.ENTER:case qe.SPACE:{v&&!S.disabled&&S.checkable!==!1&&!S.disableCheckbox?n.onNodeCheck({},S,!d.includes(u)):!v&&y&&!S.disabled&&S.selectable!==!1&&n.onNodeSelect({},S);break}}}m==null||m(s)},n.setUncontrolledState=function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!n.destroyed){var c=!1,d=!0,f={};Object.keys(s).forEach(function(p){if(p in n.props){d=!1;return}c=!0,f[p]=s[p]}),c&&(!l||d)&&n.setState(yn(yn({},f),u))}},n.scrollTo=function(s){n.listRef.current.scrollTo(s)},n}return b2(r,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var i=this.props.activeKey;i!==void 0&&i!==this.state.activeKey&&(this.setState({activeKey:i}),i!==null&&this.scrollTo({key:i}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var i,a=this.state,o=a.focused,s=a.flattenNodes,l=a.keyEntities,u=a.draggingNodeKey,c=a.activeKey,d=a.dropLevelOffset,f=a.dropContainerKey,p=a.dropTargetKey,m=a.dropPosition,v=a.dragOverNodeKey,y=a.indent,b=this.props,D=b.prefixCls,x=b.className,S=b.style,w=b.showLine,C=b.focusable,E=b.tabIndex,A=E===void 0?0:E,_=b.selectable,N=b.showIcon,M=b.icon,R=b.switcherIcon,F=b.draggable,k=b.checkable,P=b.checkStrictly,T=b.disabled,O=b.motion,L=b.loadData,I=b.filterTreeNode,V=b.height,H=b.itemHeight,Z=b.virtual,G=b.titleRender,Y=b.dropIndicatorRender,re=b.onContextMenu,ne=b.onScroll,pe=b.direction,he=b.rootClassName,le=b.rootStyle,fe=Ys(this.props,{aria:!0,data:!0}),xe;return F&&(Ga(F)==="object"?xe=F:typeof F=="function"?xe={nodeDraggable:F}:xe={}),h(mx.Provider,{value:{prefixCls:D,selectable:_,showIcon:N,icon:M,switcherIcon:R,draggable:xe,draggingNodeKey:u,checkable:k,checkStrictly:P,disabled:T,keyEntities:l,dropLevelOffset:d,dropContainerKey:f,dropTargetKey:p,dropPosition:m,dragOverNodeKey:v,indent:y,direction:pe,dropIndicatorRender:Y,loadData:L,filterTreeNode:I,titleRender:G,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop},children:h("div",{role:"tree",className:dr(D,x,he,(i={},Lr(i,"".concat(D,"-show-line"),w),Lr(i,"".concat(D,"-focused"),o),Lr(i,"".concat(D,"-active-focused"),c!==null),i)),style:le,children:h($2,{ref:this.listRef,prefixCls:D,style:S,data:s,disabled:T,selectable:_,checkable:!!k,motion:O,dragging:u!==null,height:V,itemHeight:H,virtual:Z,focusable:C,focused:o,tabIndex:A,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:re,onScroll:ne,...this.getTreeNodeRequiredProps(),...fe})})})}}],[{key:"getDerivedStateFromProps",value:function(i,a){var o=a.prevProps,s={prevProps:i};function l(C){return!o&&C in i||o&&o[C]!==i[C]}var u,c=a.fieldNames;if(l("fieldNames")&&(c=lf(i.fieldNames),s.fieldNames=c),l("treeData")?u=i.treeData:l("children")&&(Zt(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),u=zZ(i.children)),u){s.treeData=u;var d=C2(u,{fieldNames:c});s.keyEntities=yn(Lr({},fs,I2),d.keyEntities),process.env.NODE_ENV!=="production"&&BZ(u,c)}var f=s.keyEntities||a.keyEntities;if(l("expandedKeys")||o&&l("autoExpandParent"))s.expandedKeys=i.autoExpandParent||!o&&i.defaultExpandParent?_2(i.expandedKeys,f):i.expandedKeys;else if(!o&&i.defaultExpandAll){var p=yn({},f);delete p[fs],s.expandedKeys=Object.keys(p).map(function(C){return p[C].key})}else!o&&i.defaultExpandedKeys&&(s.expandedKeys=i.autoExpandParent||i.defaultExpandParent?_2(i.defaultExpandedKeys,f):i.defaultExpandedKeys);if(s.expandedKeys||delete s.expandedKeys,u||s.expandedKeys){var m=vx(u||a.treeData,s.expandedKeys||a.expandedKeys,c);s.flattenNodes=m}if(i.selectable&&(l("selectedKeys")?s.selectedKeys=A2(i.selectedKeys,i):!o&&i.defaultSelectedKeys&&(s.selectedKeys=A2(i.defaultSelectedKeys,i))),i.checkable){var v;if(l("checkedKeys")?v=yx(i.checkedKeys)||{}:!o&&i.defaultCheckedKeys?v=yx(i.defaultCheckedKeys)||{}:u&&(v=yx(i.checkedKeys)||{checkedKeys:a.checkedKeys,halfCheckedKeys:a.halfCheckedKeys}),v){var y=v,b=y.checkedKeys,D=b===void 0?[]:b,x=y.halfCheckedKeys,S=x===void 0?[]:x;if(!i.checkStrictly){var w=cl(D,!0,f);D=w.checkedKeys,S=w.halfCheckedKeys}s.checkedKeys=D,s.halfCheckedKeys=S}}return l("loadedKeys")&&(s.loadedKeys=i.loadedKeys),s}}]),r}(U.Component);xx.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:nQ,allowDrop:function(){return!0},expandAction:!1},xx.TreeNode=dl;var B2=U.createContext(null),z2=U.createContext(null);function L2(e){return Array.isArray(e)?e:e!==void 0?[e]:[]}function aQ(e){var t=e||{},r=t.label,n=t.value,i=t.children,a=n||"value";return{_title:r?[r]:["title","label"],value:a,key:a,children:i||"children"}}function wx(e){return!e||e.disabled||e.disableCheckbox||e.checkable===!1}function oQ(e,t){var r=[];function n(i){i.forEach(function(a){var o=a[t.children];o&&(r.push(a[t.value]),n(o))})}return n(e),r}function Cx(e){return e==null}var sQ={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},lQ=function(t,r){var n=TN(),i=n.prefixCls,a=n.multiple,o=n.searchValue,s=n.toggleOpen,l=n.open,u=n.notFoundContent,c=U.useContext(z2),d=c.virtual,f=c.listHeight,p=c.listItemHeight,m=c.treeData,v=c.fieldNames,y=c.onSelect,b=c.dropdownMatchSelectWidth,D=c.treeExpandAction,x=U.useContext(B2),S=x.checkable,w=x.checkedKeys,C=x.halfCheckedKeys,E=x.treeExpandedKeys,A=x.treeDefaultExpandAll,_=x.treeDefaultExpandedKeys,N=x.onTreeExpand,M=x.treeIcon,R=x.showTreeIcon,F=x.switcherIcon,k=x.treeLine,P=x.treeNodeFilterProp,T=x.loadData,O=x.treeLoadedKeys,L=x.treeMotion,I=x.onTreeLoad,V=x.keyEntities,H=U.useRef(),Z=C1(function(){return m},[l,m],function(W,ue){return ue[0]&&W[1]!==ue[1]}),G=U.useMemo(function(){return S?{checked:w,halfChecked:C}:null},[S,w,C]);U.useEffect(function(){if(l&&!a&&w.length){var W;(W=H.current)===null||W===void 0||W.scrollTo({key:w[0]})}},[l]);var Y=String(o).toLowerCase(),re=function(ue){return Y?String(ue[P]).toLowerCase().includes(Y):!1},ne=U.useState(_),pe=bo(ne,2),he=pe[0],le=pe[1],fe=U.useState(null),xe=bo(fe,2),ge=xe[0],ve=xe[1],Ee=U.useMemo(function(){return E?yo(E):o?ge:he},[he,ge,E,o]);U.useEffect(function(){o&&ve(oQ(m,v))},[o]);var q=function(ue){le(ue),ve(ue),N&&N(ue)},J=function(ue){ue.preventDefault()},ce=function(ue,me){var we=me.node;S&&wx(we)||(y(we.key,{selected:!w.includes(we.key)}),a||s(!1))},X=U.useState(null),te=bo(X,2),ae=te[0],De=te[1],be=V[ae];if(U.useImperativeHandle(r,function(){var W;return{scrollTo:(W=H.current)===null||W===void 0?void 0:W.scrollTo,onKeyDown:function(me){var we,_e=me.which;switch(_e){case qe.UP:case qe.DOWN:case qe.LEFT:case qe.RIGHT:(we=H.current)===null||we===void 0||we.onKeyDown(me);break;case qe.ENTER:{if(be){var Ae=(be==null?void 0:be.node)||{},Ce=Ae.selectable,Me=Ae.value;Ce!==!1&&ce(null,{node:{key:ae},selected:!w.includes(Me)})}break}case qe.ESC:s(!1)}},onKeyUp:function(){}}}),Z.length===0)return h("div",{role:"listbox",className:"".concat(i,"-empty"),onMouseDown:J,children:u});var K={fieldNames:v};return O&&(K.loadedKeys=O),Ee&&(K.expandedKeys=Ee),$("div",{onMouseDown:J,children:[be&&l&&h("span",{style:sQ,"aria-live":"assertive",children:be.node.value}),h(xx,{ref:H,focusable:!1,prefixCls:"".concat(i,"-tree"),treeData:Z,height:f,itemHeight:p,virtual:d!==!1&&b!==!1,multiple:a,icon:M,showIcon:R,switcherIcon:F,showLine:k,loadData:o?null:T,motion:L,activeKey:ae,checkable:S,checkStrictly:!0,checkedKeys:G,selectedKeys:S?[]:w,defaultExpandAll:A,...K,onActiveChange:De,onSelect:ce,onCheck:ce,onExpand:q,onLoad:I,filterTreeNode:re,expandAction:D})]})},V2=U.forwardRef(lQ);V2.displayName="OptionList";var q2=function(){return null},uQ="SHOW_ALL",Sx="SHOW_PARENT",Dx="SHOW_CHILD";function G2(e,t,r,n){var i=new Set(e);return t===Dx?e.filter(function(a){var o=r[a];return!(o&&o.children&&o.children.some(function(s){var l=s.node;return i.has(l[n.value])})&&o.children.every(function(s){var l=s.node;return wx(l)||i.has(l[n.value])}))}):t===Sx?e.filter(function(a){var o=r[a],s=o?o.parent:null;return!(s&&!wx(s.node)&&i.has(s.key))}):e}var cQ=["children","value"];function U2(e){return wo(e).map(function(t){if(!U.isValidElement(t)||!t.type)return null;var r=t,n=r.key,i=r.props,a=i.children,o=i.value,s=pN(i,cQ),l=mi({key:n,value:o},s),u=U2(a);return u.length&&(l.children=u),l}).filter(function(t){return t})}function Ex(e){if(!e)return e;var t=mi({},e);return"props"in t||Object.defineProperty(t,"props",{get:function(){return Zt(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),t}}),t}function dQ(e,t,r,n,i,a){var o=null,s=null;function l(){function u(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return c.map(function(p,m){var v="".concat(d,"-").concat(m),y=p[a.value],b=r.includes(y),D=u(p[a.children]||[],v,b),x=h(q2,{...p,children:D.map(function(w){return w.node})});if(t===y&&(o=x),b){var S={pos:v,node:x,children:D};return f||s.push(S),S}return null}).filter(function(p){return p})}s||(s=[],u(n),s.sort(function(c,d){var f=c.node.props.value,p=d.node.props.value,m=r.indexOf(f),v=r.indexOf(p);return m-v}))}Object.defineProperty(e,"triggerNode",{get:function(){return Zt(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),l(),o}}),Object.defineProperty(e,"allCheckedNodes",{get:function(){return Zt(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),l(),i?s:s.map(function(c){var d=c.node;return d})}})}function fQ(e,t){var r=t.id,n=t.pId,i=t.rootPId,a={},o=[],s=e.map(function(l){var u=mi({},l),c=u[r];return a[c]=u,u.key=u.key||c,u});return s.forEach(function(l){var u=l[n],c=a[u];c&&(c.children=c.children||[],c.children.push(l)),(u===i||!c&&i===null)&&o.push(l)}),o}function pQ(e,t,r){return U.useMemo(function(){return e?r?fQ(e,mi({id:"id",pId:"pId",rootPId:null},r!==!0?r:{})):e:U2(t)},[t,r,e])}const hQ=function(e){var t=U.useRef({valueLabels:new Map});return U.useMemo(function(){var r=t.current.valueLabels,n=new Map,i=e.map(function(a){var o,s=a.value,l=(o=a.label)!==null&&o!==void 0?o:r.get(s);return n.set(s,l),mi(mi({},a),{},{label:l})});return t.current.valueLabels=n,[i]},[e])};function W2(e){var t=U.useRef();t.current=e;var r=U.useCallback(function(){return t.current.apply(t,arguments)},[]);return r}const mQ=function(e,t){return U.useMemo(function(){var r=C2(e,{fieldNames:t,initWrapper:function(i){return mi(mi({},i),{},{valueEntities:new Map})},processEntity:function(i,a){var o=i.node[t.value];if(process.env.NODE_ENV!=="production"){var s=i.node.key;Zt(!Cx(o),"TreeNode `value` is invalidate: undefined"),Zt(!a.valueEntities.has(o),"Same `value` exist in the tree: ".concat(o)),Zt(!s||String(s)===String(o),"`key` or `value` with TreeNode must be the same or you can remove one of them. key: ".concat(s,", value: ").concat(o,"."))}a.valueEntities.set(o,i)}});return r},[e,t])},vQ=function(e,t,r,n){return U.useMemo(function(){var i=e.map(function(l){var u=l.value;return u}),a=t.map(function(l){var u=l.value;return u}),o=i.filter(function(l){return!n[l]});if(r){var s=cl(i,!0,n);i=s.checkedKeys,a=s.halfCheckedKeys}return[Array.from(new Set([].concat(yo(o),yo(i)))),a]},[e,t,r,n])},gQ=function(e,t,r){var n=r.treeNodeFilterProp,i=r.filterTreeNode,a=r.fieldNames,o=a.children;return U.useMemo(function(){if(!t||i===!1)return e;var s;if(typeof i=="function")s=i;else{var l=t.toUpperCase();s=function(d,f){var p=f[n];return String(p).toUpperCase().includes(l)}}function u(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return c.map(function(f){var p=f[o],m=d||s(t,Ex(f)),v=u(p||[],m);return m||v.length?mi(mi({},f),{},dN({isLeaf:void 0},o,v)):null}).filter(function(f){return f})}return u(e)},[e,t,o,n,i])};function yQ(e){var t=e.searchPlaceholder,r=e.treeCheckStrictly,n=e.treeCheckable,i=e.labelInValue,a=e.value,o=e.multiple;Zt(!t,"`searchPlaceholder` has been removed."),r&&i===!1&&Zt(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(i||r)&&Zt(L2(a).every(function(s){return s&&ls(s)==="object"&&"value"in s}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),r||o||n?Zt(!a||Array.isArray(a),"`value` should be an array when `TreeSelect` is checkable or multiple."):Zt(!Array.isArray(a),"`value` should not be array when `TreeSelect` is single mode.")}var bQ=["id","prefixCls","value","defaultValue","onChange","onSelect","onDeselect","searchValue","inputValue","onSearch","autoClearSearchValue","filterTreeNode","treeNodeFilterProp","showCheckedStrategy","treeNodeLabelProp","multiple","treeCheckable","treeCheckStrictly","labelInValue","fieldNames","treeDataSimpleMode","treeData","children","loadData","treeLoadedKeys","onTreeLoad","treeDefaultExpandAll","treeExpandedKeys","treeDefaultExpandedKeys","onTreeExpand","treeExpandAction","virtual","listHeight","listItemHeight","onDropdownVisibleChange","dropdownMatchSelectWidth","treeLine","treeIcon","showTreeIcon","switcherIcon","treeMotion"];function xQ(e){return!e||ls(e)!=="object"}var H2=U.forwardRef(function(e,t){var r=e.id,n=e.prefixCls,i=n===void 0?"rc-tree-select":n,a=e.value,o=e.defaultValue,s=e.onChange,l=e.onSelect,u=e.onDeselect,c=e.searchValue,d=e.inputValue,f=e.onSearch,p=e.autoClearSearchValue,m=p===void 0?!0:p,v=e.filterTreeNode,y=e.treeNodeFilterProp,b=y===void 0?"value":y,D=e.showCheckedStrategy,x=D===void 0?Dx:D,S=e.treeNodeLabelProp,w=e.multiple,C=e.treeCheckable,E=e.treeCheckStrictly,A=e.labelInValue,_=e.fieldNames,N=e.treeDataSimpleMode,M=e.treeData,R=e.children,F=e.loadData,k=e.treeLoadedKeys,P=e.onTreeLoad,T=e.treeDefaultExpandAll,O=e.treeExpandedKeys,L=e.treeDefaultExpandedKeys,I=e.onTreeExpand,V=e.treeExpandAction,H=e.virtual,Z=e.listHeight,G=Z===void 0?200:Z,Y=e.listItemHeight,re=Y===void 0?20:Y,ne=e.onDropdownVisibleChange,pe=e.dropdownMatchSelectWidth,he=pe===void 0?!0:pe,le=e.treeLine,fe=e.treeIcon,xe=e.showTreeIcon,ge=e.switcherIcon,ve=e.treeMotion,Ee=pN(e,bQ),q=K_(r),J=C&&!E,ce=C||E,X=E||A,te=ce||w,ae=Du(o,{value:a}),De=bo(ae,2),be=De[0],K=De[1];process.env.NODE_ENV!=="production"&&yQ(e);var W=U.useMemo(function(){return aQ(_)},[JSON.stringify(_)]),ue=Du("",{value:c!==void 0?c:d,postState:function(Ye){return Ye||""}}),me=bo(ue,2),we=me[0],_e=me[1],Ae=function(Ye){_e(Ye),f==null||f(Ye)},Ce=pQ(M,R,N),Me=mQ(Ce,W),Te=Me.keyEntities,Ve=Me.valueEntities,Re=U.useCallback(function($e){var Ye=[],Je=[];return $e.forEach(function(nt){Ve.has(nt)?Je.push(nt):Ye.push(nt)}),{missingRawValues:Ye,existRawValues:Je}},[Ve]),dt=gQ(Ce,we,{fieldNames:W,treeNodeFilterProp:b,filterTreeNode:v}),Ze=U.useCallback(function($e){if($e){if(S)return $e[S];for(var Ye=W._title,Je=0;Je<Ye.length;Je+=1){var nt=$e[Ye[Je]];if(nt!==void 0)return nt}}},[W,S]),bt=U.useCallback(function($e){var Ye=L2($e);return Ye.map(function(Je){return xQ(Je)?{value:Je}:Je})},[]),B=U.useCallback(function($e){var Ye=bt($e);return Ye.map(function(Je){var nt=Je.label,ht=Je.value,st=Je.halfChecked,_t,St=Ve.get(ht);if(St){var Bt;nt=(Bt=nt)!==null&&Bt!==void 0?Bt:Ze(St.node),_t=St.node.disabled}else if(nt===void 0){var Ar=bt(be).find(function(mn){return mn.value===ht});nt=Ar.label}return{label:nt,value:ht,halfChecked:st,disabled:_t}})},[Ve,Ze,bt,be]),ie=U.useMemo(function(){return bt(be)},[bt,be]),ye=U.useMemo(function(){var $e=[],Ye=[];return ie.forEach(function(Je){Je.halfChecked?Ye.push(Je):$e.push(Je)}),[$e,Ye]},[ie]),Oe=bo(ye,2),Xe=Oe[0],rt=Oe[1],wt=U.useMemo(function(){return Xe.map(function($e){return $e.value})},[Xe]),ur=vQ(Xe,rt,J,Te),yr=bo(ur,2),Le=yr[0],Ke=yr[1],Qe=U.useMemo(function(){var $e=G2(Le,x,Te,W),Ye=$e.map(function(st){var _t,St,Bt;return(_t=(St=Te[st])===null||St===void 0||(Bt=St.node)===null||Bt===void 0?void 0:Bt[W.value])!==null&&_t!==void 0?_t:st}),Je=Ye.map(function(st){var _t=Xe.find(function(St){return St.value===st});return{value:st,label:_t==null?void 0:_t.label}}),nt=B(Je),ht=nt[0];return!te&&ht&&Cx(ht.value)&&Cx(ht.label)?[]:nt.map(function(st){var _t;return mi(mi({},st),{},{label:(_t=st.label)!==null&&_t!==void 0?_t:st.value})})},[W,te,Le,Xe,B,x,Te]),lt=hQ(Qe),Lt=bo(lt,1),ir=Lt[0],nn=W2(function($e,Ye,Je){var nt=B($e);if(K(nt),m&&_e(""),s){var ht=$e;if(J){var st=G2($e,x,Te,W);ht=st.map(function(_n){var Mn=Ve.get(_n);return Mn?Mn.node[W.value]:_n})}var _t=Ye||{triggerValue:void 0,selected:void 0},St=_t.triggerValue,Bt=_t.selected,Ar=ht;if(E){var mn=rt.filter(function(_n){return!ht.includes(_n.value)});Ar=[].concat(yo(Ar),yo(mn))}var Wn=B(Ar),Br={preValue:Xe,triggerValue:St},Fi=!0;(E||Je==="selection"&&!Bt)&&(Fi=!1),dQ(Br,St,$e,Ce,Fi,W),ce?Br.checked=Bt:Br.selected=Bt;var ua=X?Wn:Wn.map(function(_n){return _n.value});s(te?ua:ua[0],X?null:Wn.map(function(_n){return _n.label}),Br)}}),an=U.useCallback(function($e,Ye){var Je,nt=Ye.selected,ht=Ye.source,st=Te[$e],_t=st==null?void 0:st.node,St=(Je=_t==null?void 0:_t[W.value])!==null&&Je!==void 0?Je:$e;if(!te)nn([St],{selected:!0,triggerValue:St},"option");else{var Bt=nt?[].concat(yo(wt),[St]):Le.filter(function(Mn){return Mn!==St});if(J){var Ar=Re(Bt),mn=Ar.missingRawValues,Wn=Ar.existRawValues,Br=Wn.map(function(Mn){return Ve.get(Mn).key}),Fi;if(nt){var ua=cl(Br,!0,Te);Fi=ua.checkedKeys}else{var _n=cl(Br,{checked:!1,halfCheckedKeys:Ke},Te);Fi=_n.checkedKeys}Bt=[].concat(yo(mn),yo(Fi.map(function(Mn){return Te[Mn].node[W.value]})))}nn(Bt,{selected:nt,triggerValue:St},ht||"option")}nt||!te?l==null||l(St,Ex(_t)):u==null||u(St,Ex(_t))},[Re,Ve,Te,W,te,wt,nn,J,l,u,Le,Ke]),zn=U.useCallback(function($e){if(ne){var Ye={};Object.defineProperty(Ye,"documentClickClose",{get:function(){return Zt(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),ne($e,Ye)}},[ne]),br=W2(function($e,Ye){var Je=$e.map(function(nt){return nt.value});if(Ye.type==="clear"){nn(Je,{},"selection");return}Ye.values.length&&an(Ye.values[0].value,{selected:!1,source:"selection"})}),de=U.useMemo(function(){return{virtual:H,dropdownMatchSelectWidth:he,listHeight:G,listItemHeight:re,treeData:dt,fieldNames:W,onSelect:an,treeExpandAction:V}},[H,he,G,re,dt,W,an,V]),Fe=U.useMemo(function(){return{checkable:ce,loadData:F,treeLoadedKeys:k,onTreeLoad:P,checkedKeys:Le,halfCheckedKeys:Ke,treeDefaultExpandAll:T,treeExpandedKeys:O,treeDefaultExpandedKeys:L,onTreeExpand:I,treeIcon:fe,treeMotion:ve,showTreeIcon:xe,switcherIcon:ge,treeLine:le,treeNodeFilterProp:b,keyEntities:Te}},[ce,F,k,P,Le,Ke,T,O,L,I,fe,ve,xe,ge,le,b,Te]);return h(z2.Provider,{value:de,children:h(B2.Provider,{value:Fe,children:h(lx,{ref:t,...Ee,id:q,prefixCls:i,mode:te?"multiple":void 0,displayValues:ir,onDisplayValuesChange:br,searchValue:we,onSearch:Ae,OptionList:V2,emptyOptions:!Ce.length,onDropdownVisibleChange:zn,dropdownMatchSelectWidth:he})})})});process.env.NODE_ENV!=="production"&&(H2.displayName="TreeSelect");var qu=H2;qu.TreeNode=q2,qu.SHOW_ALL=uQ,qu.SHOW_PARENT=Sx,qu.SHOW_CHILD=Dx;const wQ=({rotate:e,onClick:t})=>h("svg",{onClick:t,className:"caret-icon",viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"14px",height:"14px",fill:"currentColor","aria-hidden":"true",transform:`rotate(${e})`,children:h("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})}),CQ=({expanded:e,isLeaf:t,value:r,onClick:n,...i})=>(r==="0-0-value"&&console.log(i),t?h("span",{style:{width:"14px",display:"inline-block"}}):h(wQ,{rotate:e?"0":"-90",onClick:n,...i})),SQ=({onClick:e})=>$("svg",{onClick:e,className:"checkbox-icon",width:"16",height:"16",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[h("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),h("rect",{className:"border",x:"4",y:"4",width:"16",height:"16",rx:"2"}),h("rect",{className:"checkmark-indeterminate",x:"8",y:"8",width:"8",height:"8",rx:"2",stroke:"none"}),h("path",{className:"checkmark-checked",d:"M9 12l2 2l4 -4"})]}),DQ=({onClick:e,...t})=>h(SQ,{onClick:e,...t}),EQ=g.createStyles((e,{radius:t=4})=>({root:{borderRadius:e.fn.radius(t),display:"flex",flexWrap:"nowrap",border:"1px solid #ced4da",paddingLeft:"0px",paddingRight:"30px",backgroundColor:"#fff",transition:"border-color 100ms ease",borderColor:"#e9ecef","&.rc-tree-select.rc-tree-select-open":{borderColor:"#228be6 !important",".rc-tree-select-selection-overflow-item-rest":{display:"none"},".rc-tree-select-selection-overflow-item-suffix":{display:"block"}},".rc-tree-select-selector":{height:"auto",lineHeight:1.55,paddingLeft:"12px",resize:"none",boxSizing:"border-box",fontSize:"14px",width:"100%",color:"#000",display:"block",textAlign:"left",minHeight:"36px",cursor:"pointer",flexGrow:1},".rc-tree-select-selection-search-mirror":{display:"none"},".rc-tree-select-selection-search":{flexGrow:1,width:"auto !important"},".rc-tree-select-selection-overflow":{display:"flex",minHeight:"34px",alignItems:"center",flexWrap:"nowrap",marginLeft:"calc(-10px / 2)",boxSizing:"border-box"},".rc-tree-select-selection-overflow-item":{display:"flex",alignItems:"center",backgroundColor:"#f1f3f5",color:"#495057",height:"24px",paddingLeft:"12px",paddingRight:"12px",fontWeight:500,fontSize:"12px",borderRadius:"4px",cursor:"default",userSelect:"none",maxWidth:"calc(100% - 20px)",margin:"calc(10px / 2 - 2px) calc(10px / 2)"},".rc-tree-select-selection-overflow-item-rest":{cursor:"pointer"},".rc-tree-select-selection-overflow-item-suffix":{display:"none",backgroundColor:"transparent",width:"100%",maxWidth:"100%",height:"28px",margin:0,paddingLeft:0,paddingRight:0},input:{flex:1,minWidth:"60px",backgroundColor:"transparent",border:0,outline:0,fontSize:"14px",padding:0,marginLeft:0,color:"inherit",height:"28px",lineHeight:"32px",cursor:"pointer",width:"100%","&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{display:"none"}},".rc-tree-select-clear":{marginRight:"-24px",alignSelf:"center",cursor:"pointer"},"&.rc-tree-select-disabled":{backgroundColor:"rgb(241, 243, 245)",color:"rgb(144, 146, 150)",opacity:.6,"&, .rc-tree-select-selector, input":{cursor:"not-allowed"}}},label:{fontSize:e.fontSizes.sm,fontWeight:500,color:"#212529"},dropdown:{fontSize:e.fontSizes.xs,zIndex:300,paddingTop:"6px","&.rc-tree-select-dropdown-slide-up-leave-active":{display:"none"},".rc-tree-select-tree-list .rc-tree-select-tree-list-holder":{},".rc-tree-select-tree-list, .rc-tree-select-empty":{backgroundColor:"#fff",border:"1px solid #e9ecef",padding:0,boxShadow:"0 1px 3px rgb(0 0 0 / 5%), rgb(0 0 0 / 5%) 0px 10px 15px -5px, rgb(0 0 0 / 4%) 0px 7px 7px -5px",borderRadius:"4px"},".rc-tree-select-empty":{padding:"8px 12px"},".rc-tree-select-tree-treenode":{boxSizing:"border-box",textAlign:"left",width:"100%",padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#000",borderRadius:"4px",display:"flex",flexWrap:"nowrap",overflow:"hidden","&:hover":{backgroundColor:"#f1f3f5"},"&.rc-tree-select-tree-treenode-checkbox-checked":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-checked":{stroke:"rgb(64, 192, 87)",animation:"check 200ms linear forwards"}},"&.rc-tree-select-tree-treenode-checkbox-indeterminate":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-indeterminate":{fill:"rgb(64, 192, 87)"}},".rc-tree-select-tree-switcher":{height:"16px",alignSelf:"center",paddingRight:"2px",transition:"color 200ms ease","&:hover":{color:"#228be6","svg.caret-icon":{color:"#228be6"}},"svg.caret-icon":{color:"#ced4da",transition:"all 200ms ease"}},".rc-tree-select-tree-node-content-wrapper":{display:"flex",flexWrap:"nowrap",overflow:"hidden",alignItems:"center",gap:"8px",transition:"color 200ms ease","&:hover":{color:"#228be6"}},".rc-tree-select-tree-iconEle":{height:"16px","svg .border":{stroke:"#ced4da"},".checkbox-icon .checkmark-indeterminate":{fill:"transparent",transition:"fill 200ms ease"},".checkbox-icon .checkmark-checked":{transform:"scale(1.2)",transformOrigin:"center center",strokeDasharray:10,strokeDashoffset:-10},"@keyframes check":{"0%":{strokeDashoffset:10},"100%":{strokeDashoffset:0}}},".rc-tree-select-tree-title":{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",".rc-tree-select-tree-title-desc":{fontSize:"12px",maxWidth:"100%",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},".rc-tree-select-tree-indent":{flexGrow:0,height:0,verticalAlign:"bottom"},".rc-tree-select-tree-indent-unit":{display:"inline-block",width:"1em"}}}})),NQ=({disabled:e,classNames:t,styles:r,unstyled:n,radius:i,style:a,label:o,value:s,onChange:l,treeData:u})=>{const{classes:c,cx:d}=EQ({radius:i},{name:"FilterTreeSelectWidget",classNames:t,styles:r,unstyled:n}),[f,p]=z.useState((s==null?void 0:s.length)>0),m=y=>{p(y)},v=f&&(s==null?void 0:s.length)>0;return $(g.Stack,{spacing:3,children:[$(g.Group,{position:"apart",children:[h(g.Text,{className:c.label,children:o}),v&&h(g.Tooltip,{label:`${s.length} selected`,children:h(g.Badge,{children:s.length})})]}),h(qu,{disabled:e,allowClear:!0,className:d(c.root,"check-select"),dropdownClassName:d(c.dropdown,""),onDropdownVisibleChange:m,transitionName:"rc-tree-select-dropdown-slide-up",choiceTransitionName:"rc-tree-select-selection__choice-zoom",style:a,treeLine:!0,clearIcon:()=>h(g.CloseButton,{}),switcherIcon:CQ,treeIcon:DQ,maxTagTextLength:10,value:s,treeData:u,treeNodeFilterProp:"filterBasis",treeCheckable:!0,showCheckedStrategy:Sx,onChange:l,onSelect:console.log,maxTagCount:0,maxTagPlaceholder:y=>`${y.length} selected`})]})};function AQ(e){return e.map(t=>{const{label:r,description:n,...i}=t,a={...i,filterBasis:`${r}___${n!=null?n:""}`,description:n,label:r};return n&&(a.label=$("div",{children:[h(g.Text,{title:t.label,children:t.label}),h(g.Text,{className:"rc-tree-select-tree-title-desc",color:"dimmed",title:t.description,children:t.description})]})),a})}const _Q=ke.observer(({label:e,config:t,value:r,onChange:n})=>{const i=ut(),{state:a,dataProxy:o,len:s}=i.getDataStuffByID(t.options_query_id),l=a==="loading",u=z.useMemo(()=>{if(!o)return[];const p=[...o],m=AQ(p);return U9(m)},[o,s]);z.useEffect(()=>{const{default_selection_count:p}=t;if(!p)return;if(u.length===0){console.log("[filter.tree-select] Resetting to empty"),n([],!0);return}const m=u.slice(0,p).map(v=>v.value);console.log(`[filter.tree-select] Selecting first ${p} option(s)`),n(m,!0)},[t.default_selection_count,u]);const c=t.min_width?t.min_width:"200px",f=!!t.options_query_id?l:!1;return h(NQ,{disabled:f,style:{minWidth:c,maxWidth:f?c:"unset",borderColor:"#e9ecef"},value:r,onChange:p=>n(p,!1),treeData:u,label:e})}),MQ=ke.observer(({filter:{type:e,config:t,key:r,...n},formFieldProps:i})=>{switch(e){case"select":return h(q9,{...n,...i,config:t});case"multi-select":return h(V9,{...n,...i,config:t});case"tree-select":return h(_Q,{...n,...i,config:t});case"text-input":return h(G9,{...n,...i,config:t});case"date-range":return h(aN,{...n,...i,config:t});case"checkbox":return h(B9,{...n,...i,config:t});default:return null}}),j2=ke.observer(Pe.default.forwardRef(({filter:e,...t},r)=>h("div",{className:"filter-root",ref:r,children:h(ri,{children:h(MQ,{filter:e,formFieldProps:t})})}))),K2=ke.observer(function({view:t}){const r=ut(),{control:n,handleSubmit:i,reset:a}=ee.useForm({defaultValues:r.filters.values,reValidateMode:"onBlur"}),o=ee.useWatch({control:n});z.useEffect(()=>{a(r.filters.values)},[r.filters.values,a]),z.useEffect(()=>{r.filters.updatePreviewValues(o)},[o]);const s=r.filters.visibleInView(t.id),l=z.useMemo(()=>s.every(f=>f.should_auto_submit),[s]),u=z.useMemo(()=>s.filter(f=>Ne.default.get(f,"config.required",!1)),[s]),c=z.useMemo(()=>u.length===0?!1:u.some(f=>!f.requiredAndPass(o[f.key])),[o,u]);if(s.length===0)return null;const d=(f,p)=>(m,v)=>{p(m),(f.should_auto_submit||v)&&r.filters.setValueByKey(f.key,m)};return h("form",{onSubmit:i(r.filters.setValues),children:$(g.Group,{className:"dashboard-filters",position:"apart",noWrap:!0,sx:l?{}:{border:"1px solid #e9ecef",borderRadius:"4px",padding:"16px"},children:[h(g.Group,{align:"flex-start",children:s.map(f=>h(ee.Controller,{name:f.key,control:n,render:({field:p})=>h(j2,{filter:f,value:p.value,onChange:d(f,p.onChange)})},f.id))}),!l&&h(g.Group,{sx:{alignSelf:"flex-end"},children:h(g.Button,{color:"blue",size:"sm",type:"submit",disabled:c,children:"Search"})})]})})}),gke="";function TQ(e){return e?["<p><br></p>","<p></p>"].includes(e):!0}const Y2=ke.observer(()=>{const{freezeLayout:e}=Pe.default.useContext(ss),[t,r]=Pe.default.useState(!1),{panel:n}=gn();return Pe.default.useEffect(()=>{e(t)},[t]),TQ(n.description)?null:$(tt,{children:[h(g.Modal,{opened:t,onClose:()=>r(!1),title:n.title,withCloseButton:!1,withinPortal:!0,zIndex:310,children:h(Dd,{value:n.description,styles:{root:{border:"none"},content:{padding:0}}})}),h(g.Tooltip,{label:"Click to see description",position:"top-start",withinPortal:!0,children:h(g.ActionIcon,{variant:"subtle",color:"blue",onClick:()=>r(i=>!i),sx:{verticalAlign:"baseline",cursor:"pointer"},children:h(Be.InfoCircle,{size:20})})})]})}),OQ=ke.observer(({view:e})=>{const t=ut(),r=da.useModals(),{panel:n}=gn(),{id:i,query:a}=n,{inEditMode:o}=Pe.default.useContext(ss),s=()=>a==null?void 0:a.fetchData(),{viewPanelInFullScreen:l,inFullScreen:u}=Pe.default.useContext(i1),c=()=>{t.duplicatePanelByID(i,e.id)},d=()=>{t.editor.open(["_VIEWS_",e.id,"_PANELS_",i])},f=()=>r.openConfirmModal({title:"Delete this panel?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>t.removePanelByID(i,e.id),confirmProps:{color:"red"},zIndex:320}),p=Pe.default.useCallback(()=>{l(i)},[i,l]),m=!u&&e.type!==Xt.Modal;return h(tt,{children:h(g.Box,{sx:{position:"absolute",top:0,left:0,right:0,zIndex:300},children:$(g.Menu,{withinPortal:!0,children:[h(g.Menu.Target,{children:h(g.Box,{className:"panel-dropdown-target",sx:{width:"100%",height:"25px"}})}),$(g.Menu.Dropdown,{children:[h(g.Menu.Item,{onClick:s,icon:h(Be.Refresh,{size:14}),children:"Refresh"}),h(g.Menu.Item,{onClick:()=>{var v;return t.queries.downloadDataByQueryID((v=a==null?void 0:a.id)!=null?v:"")},icon:h(Be.Download,{size:14}),children:"Download Data"}),m&&h(g.Menu.Item,{onClick:p,icon:h(Be.ArrowsMaximize,{size:14}),disabled:o,children:"Full Screen"}),o&&$(tt,{children:[h(g.Divider,{label:"Edit",labelPosition:"center"}),h(g.Menu.Item,{onClick:d,icon:h(Be.Settings,{size:14}),children:"Settings"}),h(g.Menu.Item,{onClick:c,icon:h(Be.Copy,{size:14}),children:"Duplicate"}),h(g.Menu.Item,{color:"red",onClick:f,icon:h(Be.Trash,{size:14}),children:"Delete"})]})]})]})})})}),yke="",RQ=ke.observer(function(){const{panel:t}=gn(),{title:r}=t;return r?h(g.Group,{grow:!0,position:"center",px:20,className:"panel-title-wrapper",sx:{flexGrow:1},children:h(g.Text,{align:"center",lineClamp:1,weight:"bold",children:r})}):null}),ma=(e,t)=>{const[r,n]=z.useState([]);return z.useEffect(()=>e.watchTriggerSnapshotList(i=>n(i.filter(a=>a.schemaRef===t))),[]),r};class pl{constructor(t,r){this.root=t,this.path=r}async deleteItem(t){t===null&&await this.root.deleteItem(this.path);const r=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,Se.omit(r,t))}async getItem(t){const r=await this.root.getItem(this.path);return t===null?r:Se.get(r,t)}async setItem(t,r){if(t===null)await this.root.setItem(this.path,r);else{const n=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,{...n,[t]:r})}return await this.getItem(t)}watchItem(t,r,n){return t===null?this.root.watchItem(this.path,(i,a)=>{r(i,a)},n):this.root.watchItem(this.path,(i,a)=>{const o=Se.get(i,t),s=Se.get(a,t);o!==s&&r(o,s)},n)}}class Nx{constructor(t,r,n){at(this,"attachmentStorage");this.instance=t,this.attachmentKey=r,this.constructInstance=n,this.attachmentStorage=new pl(t.instanceData,r)}async getInstance(t){if(await this.attachmentStorage.getItem(t))return this.constructInstance(new pl(this.attachmentStorage,t))}async create(t,r){return await this.attachmentStorage.setItem(t,r),this.constructInstance(new pl(this.attachmentStorage,t))}async remove(t){await this.attachmentStorage.deleteItem(t)}async list(){const t=await this.attachmentStorage.getItem(null);return Promise.all(Se.values(t).map(r=>this.constructInstance(new pl(this.attachmentStorage,r.id))))}}class X2{constructor(t){at(this,"rootRef");this.rootRef=cr.observable({current:t})}async deleteItem(t){cr.runInAction(()=>{Se.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?cr.toJS(this.rootRef.current):Se.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(Se.isObject(r))cr.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else cr.runInAction(()=>{Se.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,n){return cr.reaction(()=>this.getValueFromRoot(t),(i,a)=>{r(i,a)},{requiresObservable:!0,fireImmediately:Se.get(n,"fireImmediately",!1)})}}class IQ{constructor(){at(this,"channels",new Map);at(this,"globalChannel",new pE.default)}getChannel(t){const r=this.channels.get(t);if(r)return r;const n=new pE.default;return this.channels.set(t,n),n}}class kQ{constructor(t){at(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const r=this.instances.get(t.id);if(r)return r;const n={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new IQ,instanceData:new X2(t.viz.conf)};return this.instances.set(t.id,n),n}}function Z2(e,t,r,n){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new X2({}),colorPalette:{getColor(){return()=>""}},data:t,variables:n}}const PQ=e=>{const{panel:t,vizManager:r,data:n,variables:i}=e,a=r.resolveComponent(t.viz.type),o=r.getOrCreateInstance(t),s={...Z2(o,n,r,i),viewport:{width:t.layout.w,height:t.layout.h}},l=a.viewRender;return h(l,{context:s,instance:o,...Se.omit(e,["panel","vizManager","data"])})},FQ=e=>{const{vizManager:t,panel:r,panelInfoEditor:n,data:i,variables:a}=e,o=t.resolveComponent(r.viz.type),s=t.getOrCreateInstance(r),l={...Z2(s,i,t,a),panelInfoEditor:n},u=o.configRender;return h(u,{context:l,instance:s,...Se.omit(e,["panel","vizManager","data","panelInfoEditor"])})},Q2=(e,t)=>{const r=bu.default.bezier(e),n=bu.default.bezier(t);return function(i){return i<50?r(i*2/100).hex():n((i-50)*2/100).hex()}},uf=e=>{const t=bu.default.bezier(e);return function(r){return t(r/100).hex()}},$Q={type:"interpolation",displayName:"Red / Green",getColor:Q2(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},BQ={type:"interpolation",displayName:"Yellow / Blue",getColor:Q2(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},zQ={type:"interpolation",displayName:"Red",getColor:uf(["#fff7f1","darkred"]),name:"red",category:"sequential"},LQ={type:"interpolation",displayName:"Green",getColor:uf(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},VQ={type:"interpolation",displayName:"Blue",getColor:uf(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},qQ={type:"interpolation",displayName:"Orange",getColor:uf(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"},J2="@devtable/dashboard",Ax="8.50.4",eM="Apache-2.0",tM={access:"public",registry:"https://registry.npmjs.org/"},rM=["dist"],nM="./dist/dashboard.umd.js",iM="./dist/dashboard.es.js",aM="./dist/index.d.ts",oM={".":{import:"./dist/dashboard.es.js",require:"./dist/dashboard.umd.js"},"./dist/style.css":{import:"./dist/style.css",require:"./dist/style.css"}},sM={"dev-build":"tsc && vite build --watch",build:"tsc && vite build",preview:"vite preview",test:"vitest","test:ui":"vitest --ui",coverage:"vitest --coverage"},lM={"@monaco-editor/react":"4.4.6","@types/chroma-js":"^2.1.4","file-saver":"2.0.5",mathjs:"11.7.0","monaco-editor":"0.36.0","performant-array-to-tree":"1.11.0",popmotion:"^11.0.3","rc-tree-select":"5.5.5",reactflow:"^11.5.3"},uM={"@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/form":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"^1.118.0","@testing-library/cypress":"^8.0.3","@testing-library/jest-dom":"^5.16.4","@testing-library/react":"^13.3.0","@testing-library/react-hooks":"^8.0.1","@testing-library/user-event":"^14.3.0","@tiptap/extension-code-block-lowlight":"2.0.1","@tiptap/extension-color":"2.0.1","@tiptap/extension-highlight":"2.0.1","@tiptap/extension-link":"2.0.1","@tiptap/extension-placeholder":"2.0.1","@tiptap/extension-subscript":"2.0.1","@tiptap/extension-superscript":"2.0.1","@tiptap/extension-table":"2.0.1","@tiptap/extension-table-cell":"2.0.1","@tiptap/extension-table-header":"2.0.1","@tiptap/extension-table-row":"2.0.1","@tiptap/extension-text-align":"2.0.1","@tiptap/extension-text-style":"2.0.1","@tiptap/extension-underline":"2.0.1","@tiptap/pm":"2.0.1","@tiptap/react":"2.0.1","@tiptap/starter-kit":"2.0.1","@types/crypto-js":"v4.1.1","@types/d3-array":"3.0.3","@types/eventemitter2":"^4.1.0","@types/file-saver":"2.0.5","@types/lodash":"^4.14.182","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@types/react-grid-layout":"^1.3.2",ahooks:"^3.3.11",ajv:"8.11.0",axios:"^0.27.2","crypto-js":"^4.1.1",cypress:"^10.6.0","cypress-wait-until":"^1.7.2",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",jsdom:"^20.0.0","jsdom-testing-mocks":"^1.5.0",lodash:"^4.17.21",lowlight:"^2.8.0",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","rollup-plugin-visualizer":"5.6.0","tabler-icons-react":"^1.48.0",typescript:"^4.6.3","vite-plugin-static-copy":"0.13.1"},cM={"@emotion/react":"11.10.0","@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/form":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"^1.118.0","@tanstack/react-table":"^8.5.13","@tiptap/extension-code-block-lowlight":"2.0.1","@tiptap/extension-color":"2.0.1","@tiptap/extension-highlight":"2.0.1","@tiptap/extension-link":"2.0.1","@tiptap/extension-placeholder":"2.0.1","@tiptap/extension-subscript":"2.0.1","@tiptap/extension-superscript":"2.0.1","@tiptap/extension-table":"2.0.1","@tiptap/extension-table-cell":"2.0.1","@tiptap/extension-table-header":"2.0.1","@tiptap/extension-table-row":"2.0.1","@tiptap/extension-text-align":"2.0.1","@tiptap/extension-text-style":"2.0.1","@tiptap/extension-underline":"2.0.1","@tiptap/pm":"2.0.1","@tiptap/react":"2.0.1","@tiptap/starter-kit":"2.0.1",ahooks:"^3.3.11",axios:"^0.27.2","chroma-js":"^2.4.2","d3-array":"3.2.0","d3-regression":"1.2.8",dayjs:"1.11.6",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",eventemitter2:"^6.4.6",jszip:"3.10.1",lodash:"^4.17.21",lowlight:"^2.8.0",mobx:"^6.6.1","mobx-react-lite":"^3.4.0","mobx-state-tree":"^5.1.5",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2",react:"^16.8.0 || 17.x || 18.x","react-dom":"^16.8.0 || 17.x || 18.x","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","react-virtual":"^2.10.4","tabler-icons-react":"^1.48.0"},GQ=Object.freeze(Object.defineProperty({__proto__:null,name:J2,version:Ax,license:eM,publishConfig:tM,files:rM,main:nM,module:iM,types:aM,exports:oM,scripts:sM,dependencies:lM,devDependencies:uM,peerDependencies:cM,default:{name:J2,version:Ax,license:eM,publishConfig:tM,files:rM,main:nM,module:iM,types:aM,exports:oM,scripts:sM,dependencies:lM,devDependencies:uM,peerDependencies:cM}},Symbol.toStringTag,{value:"Module"}));class UQ{constructor(t){at(this,"staticColors",new Map);at(this,"interpolations",new Map);t.installedPlugins.forEach(r=>{r.manifest.color.forEach(n=>{this.register(n)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const r=this.encodeColor(t);t.type==="single"?(this.staticColors.has(r)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(r,t)):t.type==="interpolation"&&(this.interpolations.has(r)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(r,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class WQ{constructor(){at(this,"plugins",new Map);at(this,"vizComponents",new Map);at(this,"factory",{viz:t=>{const r=this.vizComponents.get(t);if(r)return r;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const r of t.manifest.viz){if(this.vizComponents.has(r.name))throw new Error(`Viz Component (${r.name}) has been installed before`);this.vizComponents.set(r.name,r)}}get installedPlugins(){return Array.from(this.plugins.values())}}class HQ{constructor(){at(this,"migrations",[])}version(t,r){return this.migrations.push({version:t,handler:r}),this}run(t,r,n){var o;if(t.from===t.to)return r;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(s=>s.version>t.from&&s.version<=t.to),a=Se.orderBy(i,"version","asc");if(((o=Se.last(a))==null?void 0:o.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((s,l)=>l.handler(s,n),r)}}class Jr extends HQ{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(n,i)=>({version:t,...r(n,i)}))}async migrate({configData:t,panelModel:r}){const n=await t.getItem(null),i=Se.get(n,"version",0),a=this.run({from:i,to:this.VERSION},n,{panelModel:r});await t.setItem(null,a)}async needMigration({configData:t}){const r=await t.getItem(null);return Se.get(r,"version",0)<this.VERSION}}const Et=(e,t)=>{const[r,{setFalse:n}]=Wt.useBoolean(!0),[i,a]=z.useState();z.useEffect(()=>(e.getItem(t).then(s=>{a(s),n()}),e.watchItem(t,s=>{a(s)})));const o=z.useCallback(async s=>{await e.setItem(t,s),a(s)},[e,t]);return{loading:r,value:i,set:o}},_x={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};wr.use([mt.GridComponent,mt.VisualMapComponent,mt.LegendComponent,mt.TooltipComponent,ei.CanvasRenderer]);function jQ({context:e}){const{value:t}=Et(e.instanceData,"config"),r=e.data,{width:n,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:o,z_axis_data_key:s,xAxis3D:l,yAxis3D:u,zAxis3D:c}=Se.defaults({},t,_x),d=z.useMemo(()=>{const m=Se.minBy(r,v=>v[s]);return Se.get(m,s)},[r,s]),f=z.useMemo(()=>{const m=Se.maxBy(r,v=>v[s]);return Se.get(m,s)},[r,s]),p={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:d,max:f,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:l,yAxis3D:u,zAxis3D:c,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:r.map(m=>[m[a],m[o],m[s]])}]};return t?h(ti.default,{echarts:wr,option:p,style:{width:n,height:i},notMerge:!0,theme:"merico-light"}):null}function KQ({label:e,required:t,value:r,onChange:n,data:i,clearable:a=!1,sx:o,...s},l){const u=Pe.default.useMemo(()=>{if(!Array.isArray(i)||i.length===0)return[];const d=Object.keys(i[0]).map(f=>({label:f,value:f}));return a?d.concat([{label:"unset",value:""}]):d},[i]);return h(g.Select,{ref:l,label:e,data:u,value:r,onChange:n,required:t,sx:o,...s})}const It=Pe.default.forwardRef(KQ);function YQ({context:e}){const{value:t,set:r}=Et(e.instanceData,"config"),n=e.data,i=Se.defaults({},t,_x),{control:a,handleSubmit:o,reset:s}=ee.useForm({defaultValues:i});return z.useEffect(()=>{s(i)},[t]),t?h(g.Stack,{spacing:"xs",children:$("form",{onSubmit:o(r),children:[h(g.Text,{children:"X Axis"}),$(g.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[h(ee.Controller,{name:"x_axis_data_key",control:a,render:({field:l})=>h(It,{label:"Data Field",required:!0,data:n,...l})}),h(ee.Controller,{name:"xAxis3D.name",control:a,render:({field:l})=>h(g.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...l})})]}),h(g.Text,{mt:"lg",children:"Y Axis"}),$(g.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[h(ee.Controller,{name:"y_axis_data_key",control:a,render:({field:l})=>h(It,{label:"Data Field",required:!0,data:n,...l})}),h(ee.Controller,{name:"yAxis3D.name",control:a,render:({field:l})=>h(g.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...l})})]}),h(g.Text,{mt:"lg",children:"Z Axis"}),$(g.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[h(ee.Controller,{name:"z_axis_data_key",control:a,render:({field:l})=>h(It,{label:"Data Field",required:!0,data:n,...l})}),h(ee.Controller,{name:"zAxis3D.name",control:a,render:({field:l})=>h(g.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...l})})]}),h(g.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:$(g.Button,{color:"blue",type:"submit",children:[h(Be.DeviceFloppy,{size:20}),h(g.Text,{ml:"md",children:"Save"})]})})]})}):null}class XQ extends Jr{constructor(){super(...arguments);at(this,"VERSION",1)}configVersions(){this.version(1,r=>({version:1,config:r}))}}const ZQ={displayName:"Bar Chart (3D)",displayGroup:"ECharts-based charts",migrator:new XQ,name:"bar-3d",viewRender:jQ,configRender:YQ,createConfig(){return{version:1,config:Se.cloneDeep(_x)}}},Kn={mantissa:0,output:"number",trimMantissa:!1,average:!1};function QQ({value:e,onChange:t},r){const n=s=>{t({...e,output:s})},i=s=>{const l=s===0?!1:e.trimMantissa;t({...e,mantissa:s,trimMantissa:l})},a=s=>{t({...e,trimMantissa:s.currentTarget.checked})},o=s=>{t({...e,average:s.currentTarget.checked})};return $(g.Stack,{ref:r,children:[$(g.Group,{grow:!0,children:[h(g.Select,{label:"Format",data:[{label:"1234",value:"number"},{label:"99%",value:"percent"}],value:e.output,onChange:n,sx:{flexGrow:1}}),h(g.Switch,{label:$(g.Stack,{spacing:0,children:[h(g.Text,{children:"Average"}),h(g.Text,{size:12,color:"gray",children:"like 1.234k, 1.234m"})]}),checked:e.average,onChange:o,disabled:e.output!=="number",sx:{flexGrow:1},styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"},label:{display:"block"}}})]}),$(g.Group,{grow:!0,children:[h(g.NumberInput,{label:"Mantissa",defaultValue:0,min:0,step:1,max:4,value:e.mantissa,onChange:i}),h(g.Switch,{label:"Trim mantissa",checked:e.trimMantissa,onChange:a,disabled:e.mantissa===0,styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"}}})]}),$(g.Stack,{spacing:0,children:[h(g.Text,{weight:"bold",children:"Preview"}),h(ri,{children:$(g.Group,{position:"apart",children:[$(g.Text,{size:12,color:"gray",children:["123456789 ",h(Be.ArrowRight,{size:9})," ",Tr.default(123456789).format(e)]}),$(g.Text,{size:12,color:"gray",children:["1234 ",h(Be.ArrowRight,{size:9})," ",Tr.default(1234).format(e)]}),$(g.Text,{size:12,color:"gray",children:["0.1234 ",h(Be.ArrowRight,{size:9})," ",Tr.default(.1234).format(e)]})]})})]})]})}const va=Pe.default.forwardRef(QQ),ga={enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
76
76
  `)},dM={id:"builtin:echarts:click-echart:series",displayName:"Click Chart Series",nameRender:eJ,configRender:JQ,payload:[{name:"type",description:"Always 'click'",valueType:"string"},{name:"seriesType",description:"'boxplot'",valueType:"string"},{name:"name",description:"Name of the series clicked",valueType:"string"},{name:"color",description:"Color",valueType:"string"},{name:"value",description:"Record of 'name', 'min', 'q1', 'median', 'q3', 'max'",valueType:"object"},{name:"rowData",description:"Data of the row",valueType:"object"}]};function JQ(e){return h(tt,{})}function eJ(e){return h(g.Text,{children:"Click chart's series"})}const tJ=[{label:"Truncate",value:"truncate"},{label:"Break Line",value:"break"},{label:"Break Word",value:"breakAll"}],cf=z.forwardRef(({sectionTitle:e,value:t,onChange:r},n)=>{const i=a=>o=>{const s=Ne.default.cloneDeep(t);Ne.default.set(s,a,o),r(s)};return $(g.Stack,{spacing:0,children:[e&&h(g.Divider,{mb:-5,mt:5,variant:"dotted",label:e,labelPosition:"right",labelProps:{color:"dimmed"}}),$(g.Group,{grow:!0,noWrap:!0,children:[h(g.NumberInput,{label:"Max Width",hideControls:!0,value:t.width,onChange:i("width")}),h(g.Select,{label:"Overflow",data:tJ,value:t.overflow,onChange:i("overflow")}),h(g.TextInput,{label:"Ellipsis",value:t.ellipsis,disabled:!0})]})]})}),ps=z.forwardRef(({value:e,onChange:t},r)=>{const n=a=>{t({...e,on_axis:a})},i=a=>{t({...e,in_tooltip:a})};return $(g.Stack,{ref:r,spacing:0,children:[h(cf,{sectionTitle:"Overflow on Axis",value:e.on_axis,onChange:n}),h(cf,{sectionTitle:"Overflow in Tooltip",value:e.in_tooltip,onChange:i})]})}),Ha={on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}};function Ao({overflow:e,width:t}){const r={truncate:"initial",break:"break-all",breakAll:"break-word"}[e],n=e==="truncate"?"nowrap":"initial",i={truncate:"ellipsis",break:"clip",breakAll:"clip"}[e];return`
77
77
  max-width: ${t}px;
78
78
  word-break: ${r};
@@ -107,28 +107,28 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
107
107
  * Dual licensed under the MIT or GPL Version 2 licenses.
108
108
  **/(function(e,t){(function(r){var n=2e3,i={s:1,n:0,d:1};function a(m,v){if(isNaN(m=parseInt(m,10)))throw p.InvalidParameter;return m*v}function o(m,v){if(v===0)throw p.DivisionByZero;var y=Object.create(p.prototype);y.s=m<0?-1:1,m=m<0?-m:m;var b=f(m,v);return y.n=m/b,y.d=v/b,y}function s(m){for(var v={},y=m,b=2,D=4;D<=y;){for(;y%b===0;)y/=b,v[b]=(v[b]||0)+1;D+=1+2*b++}return y!==m?y>1&&(v[y]=(v[y]||0)+1):v[m]=(v[m]||0)+1,v}var l=function(m,v){var y=0,b=1,D=1,x=0,S=0,w=0,C=1,E=1,A=0,_=1,N=1,M=1,R=1e7,F;if(m!=null)if(v!==void 0){if(y=m,b=v,D=y*b,y%1!==0||b%1!==0)throw p.NonIntegerParameter}else switch(typeof m){case"object":{if("d"in m&&"n"in m)y=m.n,b=m.d,"s"in m&&(y*=m.s);else if(0 in m)y=m[0],1 in m&&(b=m[1]);else throw p.InvalidParameter;D=y*b;break}case"number":{if(m<0&&(D=m,m=-m),m%1===0)y=m;else if(m>0){for(m>=1&&(E=Math.pow(10,Math.floor(1+Math.log(m)/Math.LN10)),m/=E);_<=R&&M<=R;)if(F=(A+N)/(_+M),m===F){_+M<=R?(y=A+N,b=_+M):M>_?(y=N,b=M):(y=A,b=_);break}else m>F?(A+=N,_+=M):(N+=A,M+=_),_>R?(y=N,b=M):(y=A,b=_);y*=E}else(isNaN(m)||isNaN(v))&&(b=y=NaN);break}case"string":{if(_=m.match(/\d+|./g),_===null)throw p.InvalidParameter;if(_[A]==="-"?(D=-1,A++):_[A]==="+"&&A++,_.length===A+1?S=a(_[A++],D):_[A+1]==="."||_[A]==="."?(_[A]!=="."&&(x=a(_[A++],D)),A++,(A+1===_.length||_[A+1]==="("&&_[A+3]===")"||_[A+1]==="'"&&_[A+3]==="'")&&(S=a(_[A],D),C=Math.pow(10,_[A].length),A++),(_[A]==="("&&_[A+2]===")"||_[A]==="'"&&_[A+2]==="'")&&(w=a(_[A+1],D),E=Math.pow(10,_[A+1].length)-1,A+=3)):_[A+1]==="/"||_[A+1]===":"?(S=a(_[A],D),C=a(_[A+2],1),A+=3):_[A+3]==="/"&&_[A+1]===" "&&(x=a(_[A],D),S=a(_[A+2],D),C=a(_[A+4],1),A+=5),_.length<=A){b=C*E,D=y=w+b*x+E*S;break}}default:throw p.InvalidParameter}if(b===0)throw p.DivisionByZero;i.s=D<0?-1:1,i.n=Math.abs(y),i.d=Math.abs(b)};function u(m,v,y){for(var b=1;v>0;m=m*m%y,v>>=1)v&1&&(b=b*m%y);return b}function c(m,v){for(;v%2===0;v/=2);for(;v%5===0;v/=5);if(v===1)return 0;for(var y=10%v,b=1;y!==1;b++)if(y=y*10%v,b>n)return 0;return b}function d(m,v,y){for(var b=1,D=u(10,y,v),x=0;x<300;x++){if(b===D)return x;b=b*10%v,D=D*10%v}return 0}function f(m,v){if(!m)return v;if(!v)return m;for(;;){if(m%=v,!m)return v;if(v%=m,!v)return m}}function p(m,v){if(l(m,v),this instanceof p)m=f(i.d,i.n),this.s=i.s,this.n=i.n/m,this.d=i.d/m;else return o(i.s*i.n,i.d)}p.DivisionByZero=new Error("Division by Zero"),p.InvalidParameter=new Error("Invalid argument"),p.NonIntegerParameter=new Error("Parameters must be integer"),p.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(m,v){return l(m,v),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(m,v){return l(m,v),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(m,v){return l(m,v),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(m,v){return l(m,v),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(m,v){if(isNaN(this.n)||isNaN(this.d))return new p(NaN);if(m===void 0)return o(this.s*this.n%this.d,1);if(l(m,v),i.n===0&&this.d===0)throw p.DivisionByZero;return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(m,v){return l(m,v),o(f(i.n,this.n)*f(i.d,this.d),i.d*this.d)},lcm:function(m,v){return l(m,v),i.n===0&&this.n===0?o(0,1):o(i.n*this.n,f(i.n,this.n)*f(i.d,this.d))},ceil:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.ceil(m*this.s*this.n/this.d),m)},floor:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.floor(m*this.s*this.n/this.d),m)},round:function(m){return m=Math.pow(10,m||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.round(m*this.s*this.n/this.d),m)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(m,v){if(l(m,v),i.d===1)return i.s<0?o(Math.pow(this.s*this.d,i.n),Math.pow(this.n,i.n)):o(Math.pow(this.s*this.n,i.n),Math.pow(this.d,i.n));if(this.s<0)return null;var y=s(this.n),b=s(this.d),D=1,x=1;for(var S in y)if(S!=="1"){if(S==="0"){D=0;break}if(y[S]*=i.n,y[S]%i.d===0)y[S]/=i.d;else return null;D*=Math.pow(S,y[S])}for(var S in b)if(S!=="1"){if(b[S]*=i.n,b[S]%i.d===0)b[S]/=i.d;else return null;x*=Math.pow(S,b[S])}return i.s<0?o(x,D):o(D,x)},equals:function(m,v){return l(m,v),this.s*this.n*i.d===i.s*i.n*this.d},compare:function(m,v){l(m,v);var y=this.s*this.n*i.d-i.s*i.n*this.d;return(0<y)-(y<0)},simplify:function(m){if(isNaN(this.n)||isNaN(this.d))return this;m=m||.001;for(var v=this.abs(),y=v.toContinued(),b=1;b<y.length;b++){for(var D=o(y[b-1],1),x=b-2;x>=0;x--)D=D.inverse().add(y[x]);if(D.sub(v).abs().valueOf()<m)return D.mul(this.s)}return this},divisible:function(m,v){return l(m,v),!(!(i.n*this.d)||this.n*i.d%(i.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(m){var v,y="",b=this.n,D=this.d;return this.s<0&&(y+="-"),D===1?y+=b:(m&&(v=Math.floor(b/D))>0&&(y+=v,y+=" ",b%=D),y+=b,y+="/",y+=D),y},toLatex:function(m){var v,y="",b=this.n,D=this.d;return this.s<0&&(y+="-"),D===1?y+=b:(m&&(v=Math.floor(b/D))>0&&(y+=v,b%=D),y+="\\frac{",y+=b,y+="}{",y+=D,y+="}"),y},toContinued:function(){var m,v=this.n,y=this.d,b=[];if(isNaN(v)||isNaN(y))return b;do b.push(Math.floor(v/y)),m=v%y,v=y,y=m;while(v!==1);return b},toString:function(m){var v=this.n,y=this.d;if(isNaN(v)||isNaN(y))return"NaN";m=m||15;var b=c(v,y),D=d(v,y,b),x=this.s<0?"-":"";if(x+=v/y|0,v%=y,v*=10,v&&(x+="."),b){for(var S=D;S--;)x+=v/y|0,v%=y,v*=10;x+="(";for(var S=b;S--;)x+=v/y|0,v%=y,v*=10;x+=")"}else for(var S=m;v&&S--;)x+=v/y|0,v%=y,v*=10;return x}},Object.defineProperty(p,"__esModule",{value:!0}),p.default=p,p.Fraction=p,e.exports=p})()})(rT);const Za=r1(rT.exports);var jee="Fraction",Kee=[],Ff=Q(jee,Kee,()=>(Object.defineProperty(Za,"name",{value:"Fraction"}),Za.prototype.constructor=Za,Za.prototype.type="Fraction",Za.prototype.isFraction=!0,Za.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Za.fromJSON=function(e){return new Za(e)},Za),{isClass:!0}),Yee="Range",Xee=[],$f=Q(Yee,Xee,()=>{function e(t,r,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var i=t!=null,a=r!=null,o=n!=null;if(i){if(kt(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter start must be a number")}if(a){if(kt(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter end must be a number")}if(o){if(kt(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(t):0,this.end=a?parseFloat(r):0,this.step=o?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if(typeof t!="string")return null;var r=t.split(":"),n=r.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new 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 t=0,r=this.start,n=this.step,i=this.end,a=i-r;return Oo(n)===Oo(a)?t=Math.ceil(a/n):a===0&&(t=0),isNaN(t)&&(t=0),[t]},e.prototype.min=function(){var t=this.size()[0];if(t>0)return this.step>0?this.start:this.start+(t-1)*this.step},e.prototype.max=function(){var t=this.size()[0];if(t>0)return this.step>0?this.start+(t-1)*this.step:this.start},e.prototype.forEach=function(t){var r=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;r<i;)t(r,[a],this),r+=n,a++;else if(n<0)for(;r>i;)t(r,[a],this),r+=n,a++},e.prototype.map=function(t){var r=[];return this.forEach(function(n,i,a){r[i[0]]=t(n,i,a)}),r},e.prototype.toArray=function(){var t=[];return this.forEach(function(r,n){t[n[0]]=r}),t},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(t){var r=ms(this.start,t);return this.step!==1&&(r+=":"+ms(this.step,t)),r+=":"+ms(this.end,t),r},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}),Zee="Matrix",Qee=[],Bf=Q(Zee,Qee,()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(t,r){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(t,r,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(t,r,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(t,r){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(t,r){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(t,r){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function Jee(e){var t=0,r=1,n=Object.create(null),i=Object.create(null),a=0,o=function(l){var u=i[l];if(!!u&&(delete n[u],delete i[l],--t,r===u)){if(!t){a=0,r=1;return}for(;!hasOwnProperty.call(n,++r););}};return e=Math.abs(e),{hit:function(l){var u=i[l],c=++a;if(n[c]=l,i[l]=c,!u)return++t,t<=e?void 0:(l=n[r],o(l),l);if(delete n[u],r===u)for(;!hasOwnProperty.call(n,++r););},delete:o,clear:function(){t=a=0,r=1,n=Object.create(null),i=Object.create(null)}}}function Zu(e){var{hasher:t,limit:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return r=r==null?Number.POSITIVE_INFINITY:r,t=t==null?JSON.stringify:t,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:Jee(r||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=t(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var s=e.apply(e,i);return n.cache.values.set(o,s),n.cache.values.delete(n.cache.lru.hit(o)),s}}function $o(e){return Object.keys(e.signatures||{}).reduce(function(t,r){var n=(r.match(/,/g)||[]).length+1;return Math.max(t,n)},-1)}var ete="DenseMatrix",tte=["Matrix"],zf=Q(ete,tte,e=>{var{Matrix:t}=e;function r(c,d){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(d&&!bn(d))throw new Error("Invalid datatype: "+d);if(ft(c))c.type==="DenseMatrix"?(this._data=pt(c._data),this._size=pt(c._size),this._datatype=d||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=d||c._datatype);else if(c&&or(c.data)&&or(c.size))this._data=c.data,this._size=c.size,_M(this._data,this._size),this._datatype=d||c.datatype;else if(or(c))this._data=u(c),this._size=qt(this._data),_M(this._data,this._size),this._datatype=d;else{if(c)throw new TypeError("Unsupported type of data ("+Or(c)+")");this._data=[],this._size=[0],this._datatype=d}}r.prototype=new t,r.prototype.createDenseMatrix=function(c,d){return new r(c,d)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Ku(this._data,Or)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(c,d){return new r(c,d)},r.prototype.subset=function(c,d,f){switch(arguments.length){case 1:return n(this,c);case 2:case 3:return a(this,c,d,f);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(c){if(!or(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new Ot(c.length,this._size.length);for(var d=0;d<c.length;d++)hr(c[d],this._size[d]);for(var f=this._data,p=0,m=c.length;p<m;p++){var v=c[p];hr(v,f.length),f=f[v]}return f},r.prototype.set=function(c,d,f){if(!or(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new Ot(c.length,this._size.length,"<");var p,m,v,y=c.map(function(D){return D+1});l(this,y,f);var b=this._data;for(p=0,m=c.length-1;p<m;p++)v=c[p],hr(v,b.length),b=b[v];return v=c[c.length-1],hr(v,b.length),b[v]=d,this};function n(c,d){if(!ml(d))throw new TypeError("Invalid index");var f=d.isScalar();if(f)return c.get(d.min());var p=d.size();if(p.length!==c._size.length)throw new Ot(p.length,c._size.length);for(var m=d.min(),v=d.max(),y=0,b=c._size.length;y<b;y++)hr(m[y],c._size[y]),hr(v[y],c._size[y]);return new r(i(c._data,d,p.length,0),c._datatype)}function i(c,d,f,p){var m=p===f-1,v=d.dimension(p);return m?v.map(function(y){return hr(y,c.length),c[y]}).valueOf():v.map(function(y){hr(y,c.length);var b=c[y];return i(b,d,f,p+1)}).valueOf()}function a(c,d,f,p){if(!d||d.isIndex!==!0)throw new TypeError("Invalid index");var m=d.size(),v=d.isScalar(),y;if(ft(f)?(y=f.size(),f=f.valueOf()):y=qt(f),v){if(y.length!==0)throw new TypeError("Scalar expected");c.set(d.min(),f,p)}else{if(m.length<c._size.length)throw new Ot(m.length,c._size.length,"<");if(y.length<m.length){for(var b=0,D=0;m[b]===1&&y[b]===1;)b++;for(;m[b]===1;)D++,b++;f=RM(f,m.length,D,y)}if(!ju(m,y))throw new Ot(m,y,">");var x=d.max().map(function(C){return C+1});l(c,x,p);var S=m.length,w=0;o(c._data,d,f,S,w)}return c}function o(c,d,f,p,m){var v=m===p-1,y=d.dimension(m);v?y.forEach(function(b,D){hr(b),c[b]=f[D[0]]}):y.forEach(function(b,D){hr(b),o(c[b],d,f[D[0]],p,m+1)})}r.prototype.resize=function(c,d,f){if(!xi(c))throw new TypeError("Array or Matrix expected");var p=c.valueOf().map(v=>Array.isArray(v)&&v.length===1?v[0]:v),m=f?this.clone():this;return s(m,p,d)};function s(c,d,f){if(d.length===0){for(var p=c._data;or(p);)p=p[0];return p}return c._size=d.slice(0),c._data=xl(c._data,c._size,f),c}r.prototype.reshape=function(c,d){var f=d?this.clone():this;f._data=MM(f._data,c);var p=f._size.reduce((m,v)=>m*v);return f._size=Xx(c,p),f};function l(c,d,f){for(var p=c._size.slice(0),m=!1;p.length<d.length;)p.push(0),m=!0;for(var v=0,y=d.length;v<y;v++)d[v]>p[v]&&(p[v]=d[v],m=!0);m&&s(c,p,f)}r.prototype.clone=function(){var c=new r({data:pt(this._data),size:pt(this._size),datatype:this._datatype});return c},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(c){var d=this,f=$o(c),p=function y(b,D){return or(b)?b.map(function(x,S){return y(x,D.concat(S))}):f===1?c(b):f===2?c(b,D):c(b,D,d)},m=p(this._data,[]),v=this._datatype!==void 0?Ku(m,Or):void 0;return new r(m,v)},r.prototype.forEach=function(c){var d=this,f=function p(m,v){or(m)?m.forEach(function(y,b){p(y,v.concat(b))}):c(m,v,d)};f(this._data,[])},r.prototype[Symbol.iterator]=function*(){var c=function*d(f,p){if(or(f))for(var m=0;m<f.length;m++)yield*d(f[m],p.concat(m));else yield{value:f,index:p}};yield*c(this._data,[])},r.prototype.rows=function(){var c=[],d=this.size();if(d.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var f=this._data;for(var p of f)c.push(new r([p],this._datatype));return c},r.prototype.columns=function(){var c=this,d=[],f=this.size();if(f.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var p=this._data,m=function(b){var D=p.map(x=>[x[b]]);d.push(new r(D,c._datatype))},v=0;v<f[1];v++)m(v);return d},r.prototype.toArray=function(){return pt(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(c){return Pt(this._data,c)},r.prototype.toString=function(){return Pt(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(c){if(c){if(kt(c)&&(c=c.toNumber()),!Ut(c)||!ot(c))throw new TypeError("The parameter k must be an integer number")}else c=0;for(var d=c>0?c:0,f=c<0?-c:0,p=this._size[0],m=this._size[1],v=Math.min(p-f,m-d),y=[],b=0;b<v;b++)y[b]=this._data[b+f][b+d];return new r({data:y,size:[v],datatype:this._datatype})},r.diagonal=function(c,d,f,p){if(!or(c))throw new TypeError("Array expected, size parameter");if(c.length!==2)throw new Error("Only two dimensions matrix are supported");if(c=c.map(function(E){if(kt(E)&&(E=E.toNumber()),!Ut(E)||!ot(E)||E<1)throw new Error("Size values must be positive integers");return E}),f){if(kt(f)&&(f=f.toNumber()),!Ut(f)||!ot(f))throw new TypeError("The parameter k must be an integer number")}else f=0;var m=f>0?f:0,v=f<0?-f:0,y=c[0],b=c[1],D=Math.min(y-v,b-m),x;if(or(d)){if(d.length!==D)throw new Error("Invalid value array length");x=function(A){return d[A]}}else if(ft(d)){var S=d.size();if(S.length!==1||S[0]!==D)throw new Error("Invalid matrix length");x=function(A){return d.get([A])}}else x=function(){return d};p||(p=kt(x(0))?x(0).mul(0):0);var w=[];if(c.length>0){w=xl(w,c,p);for(var C=0;C<D;C++)w[C+v][C+m]=x(C)}return new r({data:w,size:[y,b]})},r.fromJSON=function(c){return new r(c)},r.prototype.swapRows=function(c,d){if(!Ut(c)||!ot(c)||!Ut(d)||!ot(d))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return hr(c,this._size[0]),hr(d,this._size[0]),r._swapRows(c,d,this._data),this},r._swapRows=function(c,d,f){var p=f[c];f[c]=f[d],f[d]=p};function u(c){for(var d=0,f=c.length;d<f;d++){var p=c[d];or(p)?c[d]=u(p):p&&p.isMatrix===!0&&(c[d]=u(p.valueOf()))}return c}return r},{isClass:!0}),nT="clone",rte=["typed"],Lf=Q(nT,rte,e=>{var{typed:t}=e;return t(nT,{any:pt})});function iT(e){var t=e.length,r=e[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<t;n++)o.push(e[n][i]);a.push(o)}return a}function Al(e){for(var t=0;t<e.length;t++)if(xi(e[t]))return!0;return!1}function Qa(e,t){ft(e)&&(e=e.valueOf());for(var r=0,n=e.length;r<n;r++){var i=e[r];Array.isArray(i)?Qa(i,t):t(i)}}function zt(e,t,r){return e&&typeof e.map=="function"?e.map(function(n){return zt(n,t)}):t(e)}function Vf(e,t,r){var n=Array.isArray(e)?qt(e):e.size();if(t<0||t>=n.length)throw new ii(t,n.length);return ft(e)?e.create(qf(e.valueOf(),t,r)):qf(e,t,r)}function qf(e,t,r){var n,i,a,o;if(t<=0)if(Array.isArray(e[0])){for(o=iT(e),i=[],n=0;n<o.length;n++)i[n]=qf(o[n],t-1,r);return i}else{for(a=e[0],n=1;n<e.length;n++)a=r(a,e[n]);return a}else{for(i=[],n=0;n<e.length;n++)i[n]=qf(e[n],t-1,r);return i}}function aT(e,t,r,n,i,a,o,s,l,u,c){var d=e._values,f=e._index,p=e._ptr,m,v,y,b;if(n)for(v=p[t],y=p[t+1],m=v;m<y;m++)b=f[m],r[b]!==a?(r[b]=a,o.push(b),u?(n[b]=l?s(d[m],c):s(c,d[m]),i[b]=a):n[b]=d[m]):(n[b]=l?s(d[m],n[b]):s(n[b],d[m]),i[b]=a);else for(v=p[t],y=p[t+1],m=v;m<y;m++)b=f[m],r[b]!==a?(r[b]=a,o.push(b)):i[b]=a}var oT="isInteger",nte=["typed"],Gf=Q(oT,nte,e=>{var{typed:t}=e;return t(oT,{number:ot,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),Gi="number",vs="number, number";function sT(e){return Math.abs(e)}sT.signature=Gi;function lT(e,t){return e+t}lT.signature=vs;function uT(e,t){return e*t}uT.signature=vs;function cT(e){return-e}cT.signature=Gi;function dT(e){return e}dT.signature=Gi;function Qu(e){return bJ(e)}Qu.signature=Gi;function fT(e){return e*e*e}fT.signature=Gi;function pT(e){return Math.exp(e)}pT.signature=Gi;function hT(e){return xJ(e)}hT.signature=Gi;function mT(e,t){if(!ot(e)||!ot(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;t!==0;)r=e%t,e=t,t=r;return e<0?-e:e}mT.signature=vs;function vT(e,t){if(!ot(e)||!ot(t))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||t===0)return 0;for(var r,n=e*t;t!==0;)r=t,t=e%r,e=r;return Math.abs(n/e)}vT.signature=vs;function ite(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function gT(e){return gJ(e)}gT.signature=Gi;function yT(e){return vJ(e)}yT.signature=Gi;function bT(e,t){if(t>0)return e-t*Math.floor(e/t);if(t===0)return e;throw new Error("Cannot calculate mod for a negative divisor")}bT.signature=vs;function xT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=t<0;if(r&&(t=-t),t===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function uw(e){return Oo(e)}uw.signature=Gi;function wT(e){return e*e}wT.signature=Gi;function CT(e,t){var r,n,i,a=0,o=1,s=1,l=0;if(!ot(e)||!ot(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)n=Math.floor(e/t),i=e-n*t,r=a,a=o-n*a,o=r,r=s,s=l-n*s,l=r,e=t,t=i;var u;return e<0?u=[-e,-o,-l]:u=[e,e?o:0,l],u}CT.signature=vs;function ST(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}ST.signature=vs;function DT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!ot(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(SM(e,t))}var ate="number",_l="number, number";function ET(e,t){if(!ot(e)||!ot(t))throw new Error("Integers expected in function bitAnd");return e&t}ET.signature=_l;function NT(e){if(!ot(e))throw new Error("Integer expected in function bitNot");return~e}NT.signature=ate;function AT(e,t){if(!ot(e)||!ot(t))throw new Error("Integers expected in function bitOr");return e|t}AT.signature=_l;function _T(e,t){if(!ot(e)||!ot(t))throw new Error("Integers expected in function bitXor");return e^t}_T.signature=_l;function MT(e,t){if(!ot(e)||!ot(t))throw new Error("Integers expected in function leftShift");return e<<t}MT.signature=_l;function TT(e,t){if(!ot(e)||!ot(t))throw new Error("Integers expected in function rightArithShift");return e>>t}TT.signature=_l;function OT(e,t){if(!ot(e)||!ot(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}OT.signature=_l;function Ja(e,t){if(t<e)return 1;if(t===e)return t;var r=t+e>>1;return Ja(e,r)*Ja(r+1,t)}function RT(e,t){if(!ot(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!ot(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");for(var r=e-t,n=1,i=t<r?r+1:t+1,a=2,o=t<r?t:r,s=i;s<=e;++s)for(n*=s;a<=o&&n%a===0;)n/=a,++a;return a<=o&&(n/=Ja(a,o)),n}RT.signature="number, number";var ote=Math.PI,ste=2*Math.PI,lte=Math.E,ute=1.618033988749895,cte="number",cw="number, number";function IT(e){return!e}IT.signature=cte;function kT(e,t){return!!(e||t)}kT.signature=cw;function PT(e,t){return!!e!=!!t}PT.signature=cw;function FT(e,t){return!!(e&&t)}FT.signature=cw;function Uf(e){var t;if(ot(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:Ja(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Uf(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=Ml[0];for(var o=1;o<Ml.length;++o)t+=Ml[o]/(e+o);var s=e+$T+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,e+.5)*Math.exp(-s)*t}Uf.signature="number";var $T=4.7421875,Ml=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],BT=.9189385332046728,dte=5,fte=7,zT=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Wf(e){if(e<0)return NaN;if(e===0)return 1/0;if(!isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-Wf(1-e);e=e-1;for(var t=e+dte+.5,r=zT[0],n=fte-1;n>=1;n--)r+=zT[n]/(e+n);return BT+(e+.5)*Math.log(t)-t+Math.log(r)}Wf.signature="number";var kn="number";function LT(e){return EJ(e)}LT.signature=kn;function VT(e){return Math.atan(1/e)}VT.signature=kn;function qT(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}qT.signature=kn;function GT(e){return Math.asin(1/e)}GT.signature=kn;function UT(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}UT.signature=kn;function WT(e){return Math.acos(1/e)}WT.signature=kn;function HT(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}HT.signature=kn;function jT(e){return NJ(e)}jT.signature=kn;function KT(e){return AJ(e)}KT.signature=kn;function YT(e){return 1/Math.tan(e)}YT.signature=kn;function XT(e){var t=Math.exp(2*e);return(t+1)/(t-1)}XT.signature=kn;function ZT(e){return 1/Math.sin(e)}ZT.signature=kn;function QT(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Oo(e)}QT.signature=kn;function JT(e){return 1/Math.cos(e)}JT.signature=kn;function eO(e){return 2/(Math.exp(e)+Math.exp(-e))}eO.signature=kn;function tO(e){return MJ(e)}tO.signature=kn;var Hf="number";function rO(e){return e<0}rO.signature=Hf;function nO(e){return e>0}nO.signature=Hf;function iO(e){return e===0}iO.signature=Hf;function aO(e){return Number.isNaN(e)}aO.signature=Hf;var oO="isNegative",pte=["typed"],jf=Q(oO,pte,e=>{var{typed:t}=e;return t(oO,{number:rO,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),sO="isNumeric",hte=["typed"],Kf=Q(sO,hte,e=>{var{typed:t}=e;return t(sO,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),lO="hasNumericValue",mte=["typed","isNumeric"],Yf=Q(lO,mte,e=>{var{typed:t,isNumeric:r}=e;return t(lO,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})}),uO="isPositive",vte=["typed"],Xf=Q(uO,vte,e=>{var{typed:t}=e;return t(uO,{number:nO,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),cO="isZero",gte=["typed"],Zf=Q(cO,gte,e=>{var{typed:t}=e;return t(cO,{number:iO,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),dO="isNaN",yte=["typed"],Qf=Q(dO,yte,e=>{var{typed:t}=e;return t(dO,{number:aO,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return zt(n,Number.isNaN)}})}),fO="typeOf",bte=["typed"],Jf=Q(fO,bte,e=>{var{typed:t}=e;return t(fO,{any:Or})});function xa(e,t,r){if(r==null)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}function xte(e,t,r){return ni(e.re,t.re,r)&&ni(e.im,t.im,r)}var Tl=Q("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return t.find(r,[n.valueType(),i.valueType()])(n.value,i.value)})}}),ep="equalScalar",wte=["typed","config"],tp=Q(ep,wte,e=>{var{typed:t,config:r}=e,n=Tl({typed:t});return t(ep,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return ni(a,o,r.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||xa(a,o,r.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return xte(a,o,r.epsilon)}},n)});Q(ep,["typed","config"],e=>{var{typed:t,config:r}=e;return t(ep,{"number, number":function(i,a){return ni(i,a,r.epsilon)}})});var Cte="SparseMatrix",Ste=["typed","equalScalar","Matrix"],rp=Q(Cte,Ste,e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(v,y){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(y&&!bn(y))throw new Error("Invalid datatype: "+y);if(ft(v))a(this,v,y);else if(v&&or(v.index)&&or(v.ptr)&&or(v.size))this._values=v.values,this._index=v.index,this._ptr=v.ptr,this._size=v.size,this._datatype=y||v.datatype;else if(or(v))o(this,v,y);else{if(v)throw new TypeError("Unsupported type of data ("+Or(v)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=y}}function a(v,y,b){y.type==="SparseMatrix"?(v._values=y._values?pt(y._values):void 0,v._index=pt(y._index),v._ptr=pt(y._ptr),v._size=pt(y._size),v._datatype=b||y._datatype):o(v,y.valueOf(),b||y._datatype)}function o(v,y,b){v._values=[],v._index=[],v._ptr=[],v._datatype=b;var D=y.length,x=0,S=r,w=0;if(bn(b)&&(S=t.find(r,[b,b])||r,w=t.convert(0,b)),D>0){var C=0;do{v._ptr.push(v._index.length);for(var E=0;E<D;E++){var A=y[E];if(or(A)){if(C===0&&x<A.length&&(x=A.length),C<A.length){var _=A[C];S(_,w)||(v._values.push(_),v._index.push(E))}}else C===0&&x<1&&(x=1),S(A,w)||(v._values.push(A),v._index.push(E))}C++}while(C<x)}v._ptr.push(v._index.length),v._size=[D,x]}i.prototype=new n,i.prototype.createSparseMatrix=function(v,y){return new i(v,y)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Ku(this._values,Or)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(v,y){return new i(v,y)},i.prototype.density=function(){var v=this._size[0],y=this._size[1];return v!==0&&y!==0?this._index.length/(v*y):0},i.prototype.subset=function(v,y,b){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return s(this,v);case 2:case 3:return l(this,v,y,b);default:throw new SyntaxError("Wrong number of arguments")}};function s(v,y){if(!ml(y))throw new TypeError("Invalid index");var b=y.isScalar();if(b)return v.get(y.min());var D=y.size();if(D.length!==v._size.length)throw new Ot(D.length,v._size.length);var x,S,w,C,E=y.min(),A=y.max();for(x=0,S=v._size.length;x<S;x++)hr(E[x],v._size[x]),hr(A[x],v._size[x]);var _=v._values,N=v._index,M=v._ptr,R=y.dimension(0),F=y.dimension(1),k=[],P=[];R.forEach(function(I,V){P[I]=V[0],k[I]=!0});var T=_?[]:void 0,O=[],L=[];return F.forEach(function(I){for(L.push(O.length),w=M[I],C=M[I+1];w<C;w++)x=N[w],k[x]===!0&&(O.push(P[x]),T&&T.push(_[w]))}),L.push(O.length),new i({values:T,index:O,ptr:L,size:D,datatype:v._datatype})}function l(v,y,b,D){if(!y||y.isIndex!==!0)throw new TypeError("Invalid index");var x=y.size(),S=y.isScalar(),w;if(ft(b)?(w=b.size(),b=b.toArray()):w=qt(b),S){if(w.length!==0)throw new TypeError("Scalar expected");v.set(y.min(),b,D)}else{if(x.length!==1&&x.length!==2)throw new Ot(x.length,v._size.length,"<");if(w.length<x.length){for(var C=0,E=0;x[C]===1&&w[C]===1;)C++;for(;x[C]===1;)E++,C++;b=RM(b,x.length,E,w)}if(!ju(x,w))throw new Ot(x,w,">");if(x.length===1){var A=y.dimension(0);A.forEach(function(M,R){hr(M),v.set([M,0],b[R[0]],D)})}else{var _=y.dimension(0),N=y.dimension(1);_.forEach(function(M,R){hr(M),N.forEach(function(F,k){hr(F),v.set([M,F],b[R[0]][k[0]],D)})})}}return v}i.prototype.get=function(v){if(!or(v))throw new TypeError("Array expected");if(v.length!==this._size.length)throw new Ot(v.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var y=v[0],b=v[1];hr(y,this._size[0]),hr(b,this._size[1]);var D=u(y,this._ptr[b],this._ptr[b+1],this._index);return D<this._ptr[b+1]&&this._index[D]===y?this._values[D]:0},i.prototype.set=function(v,y,b){if(!or(v))throw new TypeError("Array expected");if(v.length!==this._size.length)throw new Ot(v.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var D=v[0],x=v[1],S=this._size[0],w=this._size[1],C=r,E=0;bn(this._datatype)&&(C=t.find(r,[this._datatype,this._datatype])||r,E=t.convert(0,this._datatype)),(D>S-1||x>w-1)&&(f(this,Math.max(D+1,S),Math.max(x+1,w),b),S=this._size[0],w=this._size[1]),hr(D,S),hr(x,w);var A=u(D,this._ptr[x],this._ptr[x+1],this._index);return A<this._ptr[x+1]&&this._index[A]===D?C(y,E)?c(A,x,this._values,this._index,this._ptr):this._values[A]=y:C(y,E)||d(A,D,x,y,this._values,this._index,this._ptr),this};function u(v,y,b,D){if(b-y===0)return b;for(var x=y;x<b;x++)if(D[x]===v)return x;return y}function c(v,y,b,D,x){b.splice(v,1),D.splice(v,1);for(var S=y+1;S<x.length;S++)x[S]--}function d(v,y,b,D,x,S,w){x.splice(v,0,D),S.splice(v,0,y);for(var C=b+1;C<w.length;C++)w[C]++}i.prototype.resize=function(v,y,b){if(!xi(v))throw new TypeError("Array or Matrix expected");var D=v.valueOf().map(S=>Array.isArray(S)&&S.length===1?S[0]:S);if(D.length!==2)throw new Error("Only two dimensions matrix are supported");D.forEach(function(S){if(!Ut(S)||!ot(S)||S<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Pt(D)+")")});var x=b?this.clone():this;return f(x,D[0],D[1],y)};function f(v,y,b,D){var x=D||0,S=r,w=0;bn(v._datatype)&&(S=t.find(r,[v._datatype,v._datatype])||r,w=t.convert(0,v._datatype),x=t.convert(x,v._datatype));var C=!S(x,w),E=v._size[0],A=v._size[1],_,N,M;if(b>A){for(N=A;N<b;N++)if(v._ptr[N]=v._values.length,C)for(_=0;_<E;_++)v._values.push(x),v._index.push(_);v._ptr[b]=v._values.length}else b<A&&(v._ptr.splice(b+1,A-b),v._values.splice(v._ptr[b],v._values.length),v._index.splice(v._ptr[b],v._index.length));if(A=b,y>E){if(C){var R=0;for(N=0;N<A;N++){v._ptr[N]=v._ptr[N]+R,M=v._ptr[N+1]+R;var F=0;for(_=E;_<y;_++,F++)v._values.splice(M+F,0,x),v._index.splice(M+F,0,_),R++}v._ptr[A]=v._values.length}}else if(y<E){var k=0;for(N=0;N<A;N++){v._ptr[N]=v._ptr[N]-k;var P=v._ptr[N],T=v._ptr[N+1]-k;for(M=P;M<T;M++)_=v._index[M],_>y-1&&(v._values.splice(M,1),v._index.splice(M,1),k++)}v._ptr[N]=v._values.length}return v._size[0]=y,v._size[1]=b,v}i.prototype.reshape=function(v,y){if(!or(v))throw new TypeError("Array expected");if(v.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");v.forEach(function(I){if(!Ut(I)||!ot(I)||I<=-2||I===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Pt(v)+")")});var b=this._size[0]*this._size[1];v=Xx(v,b);var D=v[0]*v[1];if(b!==D)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var x=y?this.clone():this;if(this._size[0]===v[0]&&this._size[1]===v[1])return x;for(var S=[],w=0;w<x._ptr.length;w++)for(var C=0;C<x._ptr[w+1]-x._ptr[w];C++)S.push(w);for(var E=x._values.slice(),A=x._index.slice(),_=0;_<x._index.length;_++){var N=A[_],M=S[_],R=N*x._size[1]+M;S[_]=R%v[1],A[_]=Math.floor(R/v[1])}x._values.length=0,x._index.length=0,x._ptr.length=v[1]+1,x._size=v.slice();for(var F=0;F<x._ptr.length;F++)x._ptr[F]=0;for(var k=0;k<E.length;k++){var P=A[k],T=S[k],O=E[k],L=u(P,x._ptr[T],x._ptr[T+1],x._index);d(L,P,T,O,x._values,x._index,x._ptr)}return x},i.prototype.clone=function(){var v=new i({values:this._values?pt(this._values):void 0,index:pt(this._index),ptr:pt(this._ptr),size:pt(this._size),datatype:this._datatype});return v},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(v,y){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var b=this,D=this._size[0],x=this._size[1],S=$o(v),w=function(E,A,_){return S===1?v(E):S===2?v(E,[A,_]):v(E,[A,_],b)};return p(this,0,D-1,0,x-1,w,y)};function p(v,y,b,D,x,S,w){var C=[],E=[],A=[],_=r,N=0;bn(v._datatype)&&(_=t.find(r,[v._datatype,v._datatype])||r,N=t.convert(0,v._datatype));for(var M=function(G,Y,re){G=S(G,Y,re),_(G,N)||(C.push(G),E.push(Y))},R=D;R<=x;R++){A.push(C.length);var F=v._ptr[R],k=v._ptr[R+1];if(w)for(var P=F;P<k;P++){var T=v._index[P];T>=y&&T<=b&&M(v._values[P],T-y,R-D)}else{for(var O={},L=F;L<k;L++){var I=v._index[L];O[I]=v._values[L]}for(var V=y;V<=b;V++){var H=V in O?O[V]:0;M(H,V-y,R-D)}}}return A.push(C.length),new i({values:C,index:E,ptr:A,size:[b-y+1,x-D+1]})}i.prototype.forEach=function(v,y){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var b=this,D=this._size[0],x=this._size[1],S=0;S<x;S++){var w=this._ptr[S],C=this._ptr[S+1];if(y)for(var E=w;E<C;E++){var A=this._index[E];v(this._values[E],[A,S],b)}else{for(var _={},N=w;N<C;N++){var M=this._index[N];_[M]=this._values[N]}for(var R=0;R<D;R++){var F=R in _?_[R]:0;v(F,[R,S],b)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var v=this._size[1],y=0;y<v;y++)for(var b=this._ptr[y],D=this._ptr[y+1],x=b;x<D;x++){var S=this._index[x];yield{value:this._values[x],index:[S,y]}}},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(v,y,b,D,x){var S=D[0],w=D[1],C=[],E,A;for(E=0;E<S;E++)for(C[E]=[],A=0;A<w;A++)C[E][A]=0;for(A=0;A<w;A++)for(var _=b[A],N=b[A+1],M=_;M<N;M++)E=y[M],C[E][A]=v?x?pt(v[M]):v[M]:1;return C}return i.prototype.format=function(v){for(var y=this._size[0],b=this._size[1],D=this.density(),x="Sparse Matrix ["+Pt(y,v)+" x "+Pt(b,v)+"] density: "+Pt(D,v)+`
109
109
  `,S=0;S<b;S++)for(var w=this._ptr[S],C=this._ptr[S+1],E=w;E<C;E++){var A=this._index[E];x+=`
110
- (`+Pt(A,v)+", "+Pt(S,v)+") ==> "+(this._values?Pt(this._values[E],v):"X")}return x},i.prototype.toString=function(){return Pt(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(v){if(v){if(kt(v)&&(v=v.toNumber()),!Ut(v)||!ot(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var y=v>0?v:0,b=v<0?-v:0,D=this._size[0],x=this._size[1],S=Math.min(D-b,x-y),w=[],C=[],E=[];E[0]=0;for(var A=y;A<x&&w.length<S;A++)for(var _=this._ptr[A],N=this._ptr[A+1],M=_;M<N;M++){var R=this._index[M];if(R===A-y+b){w.push(this._values[M]),C[w.length-1]=R-b;break}}return E.push(w.length),new i({values:w,index:C,ptr:E,size:[S,1]})},i.fromJSON=function(v){return new i(v)},i.diagonal=function(v,y,b,D,x){if(!or(v))throw new TypeError("Array expected, size parameter");if(v.length!==2)throw new Error("Only two dimensions matrix are supported");if(v=v.map(function(I){if(kt(I)&&(I=I.toNumber()),!Ut(I)||!ot(I)||I<1)throw new Error("Size values must be positive integers");return I}),b){if(kt(b)&&(b=b.toNumber()),!Ut(b)||!ot(b))throw new TypeError("The parameter k must be an integer number")}else b=0;var S=r,w=0;bn(x)&&(S=t.find(r,[x,x])||r,w=t.convert(0,x));var C=b>0?b:0,E=b<0?-b:0,A=v[0],_=v[1],N=Math.min(A-E,_-C),M;if(or(y)){if(y.length!==N)throw new Error("Invalid value array length");M=function(V){return y[V]}}else if(ft(y)){var R=y.size();if(R.length!==1||R[0]!==N)throw new Error("Invalid matrix length");M=function(V){return y.get([V])}}else M=function(){return y};for(var F=[],k=[],P=[],T=0;T<_;T++){P.push(F.length);var O=T-C;if(O>=0&&O<N){var L=M(O);S(L,w)||(k.push(O+E),F.push(L))}}return P.push(F.length),new i({values:F,index:k,ptr:P,size:[A,_]})},i.prototype.swapRows=function(v,y){if(!Ut(v)||!ot(v)||!Ut(y)||!ot(y))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return hr(v,this._size[0]),hr(y,this._size[0]),i._swapRows(v,y,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(v,y,b,D,x){for(var S=D[v],w=D[v+1],C=S;C<w;C++)x(b[C],y[C])},i._swapRows=function(v,y,b,D,x,S){for(var w=0;w<b;w++){var C=S[w],E=S[w+1],A=u(v,C,E,x),_=u(y,C,E,x);if(A<E&&_<E&&x[A]===v&&x[_]===y){if(D){var N=D[A];D[A]=D[_],D[_]=N}continue}if(A<E&&x[A]===v&&(_>=E||x[_]!==y)){var M=D?D[A]:void 0;x.splice(_,0,y),D&&D.splice(_,0,M),x.splice(_<=A?A+1:A,1),D&&D.splice(_<=A?A+1:A,1);continue}if(_<E&&x[_]===y&&(A>=E||x[A]!==v)){var R=D?D[_]:void 0;x.splice(A,0,v),D&&D.splice(A,0,R),x.splice(A<=_?_+1:_,1),D&&D.splice(A<=_?_+1:_,1)}}},i},{isClass:!0}),Dte="number",Ete=["typed"];function Nte(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(t){var r={"0b":2,"0o":8,"0x":16}[t[1]],n=t[2],i=t[3];return{input:e,radix:r,integerPart:n,fractionalPart:i}}else return null}function Ate(e){for(var t=parseInt(e.integerPart,e.radix),r=0,n=0;n<e.fractionalPart.length;n++){var i=parseInt(e.fractionalPart[n],e.radix);r+=i/Math.pow(e.radix,n+1)}var a=t+r;if(isNaN(a))throw new SyntaxError('String "'+e.input+'" is no valid number');return a}var np=Q(Dte,Ete,e=>{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=Nte(i);if(a)return Ate(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is no valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:function(i){throw new Error("Second argument with valueless unit expected")},null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r}),pO="string",_te=["typed"],ip=Q(pO,_te,e=>{var{typed:t}=e;return t(pO,{"":function(){return""},number:ms,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r)),any:function(n){return String(n)}})}),hO="boolean",Mte=["typed"],ap=Q(hO,Mte,e=>{var{typed:t}=e;return t(hO,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),Tte="bignumber",Ote=["typed","BigNumber"],op=Q(Tte,Ote,e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(i){return new r(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],s=r(a[1]),l=new r(2).pow(Number(o));if(s.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var u=new r(2).pow(Number(o)-1);return s.gte(u)?s.sub(l):s}return new r(i)},BigNumber:function(i){return i},Fraction:function(i){return new r(i.n).div(i.d).times(i.s)},null:function(i){return new r(0)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),Rte="complex",Ite=["typed","Complex"],sp=Q(Rte,Ite,e=>{var{typed:t,Complex:r}=e;return t("complex",{"":function(){return r.ZERO},number:function(i){return new r(i,0)},"number, number":function(i,a){return new r(i,a)},"BigNumber, BigNumber":function(i,a){return new r(i.toNumber(),a.toNumber())},Fraction:function(i){return new r(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return r(i)},null:function(i){return r(0)},Object:function(i){if("re"in i&&"im"in i)return new r(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new r(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),kte="fraction",Pte=["typed","Fraction"],lp=Q(kte,Pte,e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new r(i)},string:function(i){return new r(i)},"number, number":function(i,a){return new r(i,a)},null:function(i){return new r(0)},BigNumber:function(i){return new r(i.toString())},Fraction:function(i){return i},Object:function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),mO="matrix",Fte=["typed","Matrix","DenseMatrix","SparseMatrix"],up=Q(mO,Fte,e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(mO,{"":function(){return a([])},string:function(s){return a([],s)},"string, string":function(s,l){return a([],s,l)},Array:function(s){return a(s)},Matrix:function(s){return a(s,s.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,s,l){if(s==="dense"||s==="default"||s===void 0)return new n(o,l);if(s==="sparse")return new i(o,l);throw new TypeError("Unknown matrix type "+JSON.stringify(s)+".")}}),vO="matrixFromFunction",$te=["typed","matrix","isZero"],cp=Q(vO,$te,e=>{var{typed:t,matrix:r,isZero:n}=e;return t(vO,{"Array | Matrix, function, string, string":function(o,s,l,u){return i(o,s,l,u)},"Array | Matrix, function, string":function(o,s,l){return i(o,s,l)},"Matrix, function":function(o,s){return i(o,s,"dense")},"Array, function":function(o,s){return i(o,s,"dense").toArray()},"Array | Matrix, string, function":function(o,s,l){return i(o,l,s)},"Array | Matrix, string, string, function":function(o,s,l,u){return i(o,u,s,l)}});function i(a,o,s,l){var u;return l!==void 0?u=r(s,l):u=r(s),u.resize(a),u.forEach(function(c,d){var f=o(d);n(f)||u.set(d,f)}),u}}),gO="matrixFromRows",Bte=["typed","matrix","flatten","size"],dp=Q(gO,Bte,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(gO,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var l=o(s[0]),u=[];for(var c of s){var d=o(c);if(d!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(d|0));u.push(n(c))}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),yO="matrixFromColumns",zte=["typed","matrix","flatten","size"],fp=Q(yO,zte,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(yO,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var l=o(s[0]),u=[],c=0;c<l;c++)u[c]=[];for(var d of s){var f=o(d);if(f!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(f|0));for(var p=n(d),m=0;m<l;m++)u[m].push(p[m])}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),bO="splitUnit",Lte=["typed"],pp=Q(bO,Lte,e=>{var{typed:t}=e;return t(bO,{"Unit, Array":function(n,i){return n.splitUnit(i)}})}),xO="unaryMinus",Vte=["typed"],hp=Q(xO,Vte,e=>{var{typed:t}=e;return t(xO,{number:cT,"Complex | BigNumber | Fraction":r=>r.neg(),Unit:t.referToSelf(r=>n=>{var i=n.clone();return i.value=t.find(r,i.valueType())(n.value),i}),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),wO="unaryPlus",qte=["typed","config","BigNumber"],mp=Q(wO,qte,e=>{var{typed:t,config:r,BigNumber:n}=e;return t(wO,{number:dT,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":t.referToSelf(i=>a=>zt(a,i)),"boolean | string":function(a){return r.number==="BigNumber"?new n(+a):+a}})}),CO="abs",Gte=["typed"],vp=Q(CO,Gte,e=>{var{typed:t}=e;return t(CO,{number:sT,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),SO="apply",Ute=["typed","isInteger"],Ju=Q(SO,Ute,e=>{var{typed:t,isInteger:r}=e;return t(SO,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!r(a))throw new TypeError("Integer number expected for dimension");var s=Array.isArray(i)?qt(i):i.size();if(a<0||a>=s.length)throw new ii(a,s.length);return ft(i)?i.create(gp(i.valueOf(),a,o)):gp(i,a,o)}})});function gp(e,t,r){var n,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=Wte(e),i=[],n=0;n<a.length;n++)i[n]=gp(a[n],t-1,r);return i}else return r(e);else{for(i=[],n=0;n<e.length;n++)i[n]=gp(e[n],t-1,r);return i}}function Wte(e){var t=e.length,r=e[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<t;n++)o.push(e[n][i]);a.push(o)}return a}var DO="addScalar",Hte=["typed"],yp=Q(DO,Hte,e=>{var{typed:t}=e;return t(DO,{"number, number":lT,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=t.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})}),EO="cbrt",jte=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],bp=Q(EO,jte,e=>{var{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=e;return r(EO,{number:Qu,Complex:u,"Complex, boolean":u,BigNumber:function(f){return f.cbrt()},Unit:c});function u(d,f){var p=d.arg()/3,m=d.abs(),v=new o(Qu(m),0).mul(new o(0,p).exp());if(f){var y=[v,new o(Qu(m),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(Qu(m),0).mul(new o(0,p-Math.PI*2/3).exp())];return t.matrix==="Array"?y:a(y)}else return v}function c(d){if(d.value&&yi(d.value)){var f=d.clone();return f.value=1,f=f.pow(1/3),f.value=u(d.value),f}else{var p=n(d.value);p&&(d.value=i(d.value));var m;kt(d.value)?m=new s(1).div(3):Mo(d.value)?m=new l(1,3):m=1/3;var v=d.pow(m);return p&&(v.value=i(v.value)),v}}}),Kte="matAlgo11xS0s",Yte=["typed","equalScalar"],Cn=Q(Kte,Yte,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,d=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=d[0],m=d[1],v,y=r,b=0,D=o;typeof f=="string"&&(v=f,y=t.find(r,[v,v]),b=t.convert(0,v),a=t.convert(a,v),D=t.find(o,[v,v]));for(var x=[],S=[],w=[],C=0;C<m;C++){w[C]=S.length;for(var E=c[C],A=c[C+1],_=E;_<A;_++){var N=u[_],M=s?D(a,l[_]):D(l[_],a);y(M,b)||(S.push(N),x.push(M))}}return w[m]=S.length,i.createSparseMatrix({values:x,index:S,ptr:w,size:[p,m],datatype:v})}}),Xte="matAlgo12xSfs",Zte=["typed","DenseMatrix"],sn=Q(Xte,Zte,e=>{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,d=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=d[0],m=d[1],v,y=o;typeof f=="string"&&(v=f,a=t.convert(a,v),y=t.find(o,[v,v]));for(var b=[],D=[],x=[],S=0;S<m;S++){for(var w=S+1,C=c[S],E=c[S+1],A=C;A<E;A++){var _=u[A];D[_]=l[A],x[_]=w}for(var N=0;N<p;N++)S===0&&(b[N]=[]),x[N]===w?b[N][S]=s?y(a,D[N]):y(D[N],a):b[N][S]=s?y(a,0):y(0,a)}return new r({data:b,size:[p,m],datatype:v})}}),Qte="matAlgo14xDs",Jte=["typed"],Ui=Q(Qte,Jte,e=>{var{typed:t}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,d,f=o;typeof c=="string"&&(d=c,a=t.convert(a,d),f=t.find(o,[d,d]));var p=u.length>0?r(f,0,u,u[0],l,a,s):[];return i.createDenseMatrix({data:p,size:pt(u),datatype:d})};function r(n,i,a,o,s,l,u){var c=[];if(i===a.length-1)for(var d=0;d<o;d++)c[d]=u?n(l,s[d]):n(s[d],l);else for(var f=0;f<o;f++)c[f]=r(n,i+1,a,a[i+1],s[f],l,u);return c}}),dw="ceil",ere=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],tre=Q(dw,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(dw,{number:function(a){return ni(a,n(a),r.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(ni(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.ceil(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),xp=Q(dw,ere,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Cn({typed:t,equalScalar:a}),u=sn({typed:t,DenseMatrix:s}),c=Ui({typed:t}),d=tre({typed:t,config:r,round:n});return t("ceil",{number:d.signatures.number,"number,number":d.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,m){return p.ceil(m)},"Complex, BigNumber":function(p,m){return p.ceil(m.toNumber())},BigNumber:function(p){return xa(p,n(p),r.epsilon)?n(p):p.ceil()},"BigNumber, BigNumber":function(p,m){return xa(p,n(p,m),r.epsilon)?n(p,m):p.toDecimalPlaces(m.toNumber(),Fo.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,m){return p.ceil(m)},"Fraction, BigNumber":function(p,m){return p.ceil(m.toNumber())},"Array | Matrix":t.referToSelf(f=>p=>zt(p,f)),"Array, number | BigNumber":t.referToSelf(f=>(p,m)=>zt(p,v=>f(v,m))),"SparseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>l(p,m,f,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>c(p,m,f,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(f=>(p,m)=>c(i(m),p,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(f=>(p,m)=>a(p,0)?o(m.size(),m.storage()):m.storage()==="dense"?c(m,p,f,!0):u(m,p,f,!0))})}),NO="cube",rre=["typed"],wp=Q(NO,rre,e=>{var{typed:t}=e;return t(NO,{number:fT,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})}),AO="exp",nre=["typed"],Cp=Q(AO,nre,e=>{var{typed:t}=e;return t(AO,{number:pT,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})}),_O="expm1",ire=["typed","Complex"],Sp=Q(_O,ire,e=>{var{typed:t,Complex:r}=e;return t(_O,{number:hT,Complex:function(i){var a=Math.exp(i.re);return new r(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})}),fw="fix",are=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],ore=Q(fw,["typed","ceil","floor"],e=>{var{typed:t,ceil:r,floor:n}=e;return t(fw,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),Dp=Q(fw,are,e=>{var{typed:t,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:l}=e,u=sn({typed:t,DenseMatrix:l}),c=Ui({typed:t}),d=ore({typed:t,ceil:i,floor:a});return t("fix",{number:d.signatures.number,"number, number | BigNumber":d.signatures["number,number"],Complex:function(p){return new r(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,m){return new r(p.re>0?a(p.re,m):i(p.re,m),p.im>0?a(p.im,m):i(p.im,m))},"Complex, BigNumber":function(p,m){var v=m.toNumber();return new r(p.re>0?a(p.re,v):i(p.re,v),p.im>0?a(p.im,v):i(p.im,v))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,m){return p.isNegative()?i(p,m):a(p,m)},Fraction:function(p){return p.s<0?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,m){return p.s<0?i(p,m):a(p,m)},"Array | Matrix":t.referToSelf(f=>p=>zt(p,f)),"Array | Matrix, number | BigNumber":t.referToSelf(f=>(p,m)=>zt(p,v=>f(v,m))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(f=>(p,m)=>c(n(m),p,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(f=>(p,m)=>o(p,0)?s(m.size(),m.storage()):m.storage()==="dense"?c(m,p,f,!0):u(m,p,f,!0))})}),pw="floor",sre=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],lre=Q(pw,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(pw,{number:function(a){return ni(a,n(a),r.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(ni(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.floor(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),Ep=Q(pw,sre,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Cn({typed:t,equalScalar:a}),u=sn({typed:t,DenseMatrix:s}),c=Ui({typed:t}),d=lre({typed:t,config:r,round:n});return t("floor",{number:d.signatures.number,"number,number":d.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,m){return p.floor(m)},"Complex, BigNumber":function(p,m){return p.floor(m.toNumber())},BigNumber:function(p){return xa(p,n(p),r.epsilon)?n(p):p.floor()},"BigNumber, BigNumber":function(p,m){return xa(p,n(p,m),r.epsilon)?n(p,m):p.toDecimalPlaces(m.toNumber(),Fo.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,m){return p.floor(m)},"Fraction, BigNumber":function(p,m){return p.floor(m.toNumber())},"Array | Matrix":t.referToSelf(f=>p=>zt(p,f)),"Array, number | BigNumber":t.referToSelf(f=>(p,m)=>zt(p,v=>f(v,m))),"SparseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>l(p,m,f,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>c(p,m,f,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(f=>(p,m)=>c(i(m),p,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(f=>(p,m)=>a(p,0)?o(m.size(),m.storage()):m.storage()==="dense"?c(m,p,f,!0):u(m,p,f,!0))})}),ure="matAlgo01xDSid",cre=["typed"],Bo=Q(ure,cre,e=>{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype,c=i._values,d=i._index,f=i._ptr,p=i._size,m=i._datatype;if(l.length!==p.length)throw new Ot(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=l[0],y=l[1],b=typeof u=="string"&&u===m?u:void 0,D=b?t.find(a,[b,b]):a,x,S,w=[];for(x=0;x<v;x++)w[x]=[];var C=[],E=[];for(S=0;S<y;S++){for(var A=S+1,_=f[S],N=f[S+1],M=_;M<N;M++)x=d[M],C[x]=o?D(c[M],s[x][S]):D(s[x][S],c[M]),E[x]=A;for(x=0;x<v;x++)E[x]===A?w[x][S]=C[x]:w[x][S]=s[x][S]}return n.createDenseMatrix({data:w,size:[v,y],datatype:b})}}),dre="matAlgo04xSidSid",fre=["typed","equalScalar"],hw=Q(dre,fre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));var E=s&&f?[]:void 0,A=[],_=[],N=s&&f?[]:void 0,M=s&&f?[]:void 0,R=[],F=[],k,P,T,O,L;for(P=0;P<D;P++){_[P]=A.length;var I=P+1;for(O=u[P],L=u[P+1],T=O;T<L;T++)k=l[T],A.push(k),R[k]=I,N&&(N[k]=s[T]);for(O=m[P],L=m[P+1],T=O;T<L;T++)if(k=p[T],R[k]===I){if(N){var V=C(N[k],f[T]);S(V,w)?R[k]=null:N[k]=V}}else A.push(k),F[k]=I,M&&(M[k]=f[T]);if(N&&M)for(T=_[P];T<A.length;)k=A[T],R[k]===I?(E[T]=N[k],T++):F[k]===I?(E[T]=M[k],T++):A.splice(T,1)}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),pre="matAlgo10xSids",hre=["typed","DenseMatrix"],gs=Q(pre,hre,e=>{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,d=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=d[0],m=d[1],v,y=o;typeof f=="string"&&(v=f,a=t.convert(a,v),y=t.find(o,[v,v]));for(var b=[],D=[],x=[],S=0;S<m;S++){for(var w=S+1,C=c[S],E=c[S+1],A=C;A<E;A++){var _=u[A];D[_]=l[A],x[_]=w}for(var N=0;N<p;N++)S===0&&(b[N]=[]),x[N]===w?b[N][S]=s?y(a,D[N]):y(D[N],a):b[N][S]=a}return new r({data:b,size:[p,m],datatype:v})}}),mre="matAlgo13xDD",vre=["typed"],gre=Q(mre,vre,e=>{var{typed:t}=e;return function(i,a,o){var s=i._data,l=i._size,u=i._datatype,c=a._data,d=a._size,f=a._datatype,p=[];if(l.length!==d.length)throw new Ot(l.length,d.length);for(var m=0;m<l.length;m++){if(l[m]!==d[m])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");p[m]=l[m]}var v,y=o;typeof u=="string"&&u===f&&(v=u,y=t.find(o,[v,v]));var b=p.length>0?r(y,0,p,p[0],s,c):[];return i.createDenseMatrix({data:b,size:p,datatype:v})};function r(n,i,a,o,s,l){var u=[];if(i===a.length-1)for(var c=0;c<o;c++)u[c]=n(s[c],l[c]);else for(var d=0;d<o;d++)u[d]=r(n,i+1,a,a[i+1],s[d],l[d]);return u}}),yre="broadcast",bre=["concat"],xre=Q(yre,bre,e=>{var{concat:t}=e;return function(a,o){var s=Math.max(a._size.length,o._size.length);if(a._size.length===o._size.length&&a._size.every((y,b)=>y===o._size[b]))return[a,o];for(var l=r(a._size,s,0),u=r(o._size,s,0),c=[],d=0;d<s;d++)c[d]=Math.max(l[d],u[d]);for(var f=0;f<s;f++)i(l,c,f),i(u,c,f);var p=a.clone(),m=o.clone();p._size.length<s?p.reshape(r(p._size,s,1)):m._size.length<s&&m.reshape(r(m._size,s,1));for(var v=0;v<s;v++)p._size[v]<c[v]&&(p=n(p,c[v],v)),m._size[v]<c[v]&&(m=n(m,c[v],v));return[p,m]};function r(a,o,s){return[...Array(o-a.length).fill(s),...a]}function n(a,o,s){return t(...Array(o).fill(a),s)}function i(a,o,s){if(a[s]<o[s]&a[s]>1)throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(a,") not possible to broadcast dimension ").concat(s," with size ").concat(a[s]," to size ").concat(o[s]))}}),wre="matrixAlgorithmSuite",Cre=["typed","matrix","concat"],vr=Q(wre,Cre,e=>{var{typed:t,matrix:r,concat:n}=e,i=gre({typed:t}),a=Ui({typed:t}),o=xre({concat:n});return function(l){var u=l.elop,c=l.SD||l.DS,d;u?(d={"DenseMatrix, DenseMatrix":(v,y)=>i(...o(v,y),u),"Array, Array":(v,y)=>i(...o(r(v),r(y)),u).valueOf(),"Array, DenseMatrix":(v,y)=>i(...o(r(v),y),u),"DenseMatrix, Array":(v,y)=>i(...o(v,r(y)),u)},l.SS&&(d["SparseMatrix, SparseMatrix"]=(v,y)=>l.SS(...o(v,y),u,!1)),l.DS&&(d["DenseMatrix, SparseMatrix"]=(v,y)=>l.DS(...o(v,y),u,!1),d["Array, SparseMatrix"]=(v,y)=>l.DS(...o(r(v),y),u,!1)),c&&(d["SparseMatrix, DenseMatrix"]=(v,y)=>c(...o(y,v),u,!0),d["SparseMatrix, Array"]=(v,y)=>c(...o(r(y),v),u,!0))):(d={"DenseMatrix, DenseMatrix":t.referToSelf(v=>(y,b)=>i(...o(y,b),v)),"Array, Array":t.referToSelf(v=>(y,b)=>i(...o(r(y),r(b)),v).valueOf()),"Array, DenseMatrix":t.referToSelf(v=>(y,b)=>i(...o(r(y),b),v)),"DenseMatrix, Array":t.referToSelf(v=>(y,b)=>i(...o(y,r(b)),v))},l.SS&&(d["SparseMatrix, SparseMatrix"]=t.referToSelf(v=>(y,b)=>l.SS(...o(y,b),v,!1))),l.DS&&(d["DenseMatrix, SparseMatrix"]=t.referToSelf(v=>(y,b)=>l.DS(...o(y,b),v,!1)),d["Array, SparseMatrix"]=t.referToSelf(v=>(y,b)=>l.DS(...o(r(y),b),v,!1))),c&&(d["SparseMatrix, DenseMatrix"]=t.referToSelf(v=>(y,b)=>c(...o(b,y),v,!0)),d["SparseMatrix, Array"]=t.referToSelf(v=>(y,b)=>c(...o(r(b),y),v,!0))));var f=l.scalar||"any",p=l.Ds||l.Ss;p&&(u?(d["DenseMatrix,"+f]=(v,y)=>a(v,y,u,!1),d[f+", DenseMatrix"]=(v,y)=>a(y,v,u,!0),d["Array,"+f]=(v,y)=>a(r(v),y,u,!1).valueOf(),d[f+", Array"]=(v,y)=>a(r(y),v,u,!0).valueOf()):(d["DenseMatrix,"+f]=t.referToSelf(v=>(y,b)=>a(y,b,v,!1)),d[f+", DenseMatrix"]=t.referToSelf(v=>(y,b)=>a(b,y,v,!0)),d["Array,"+f]=t.referToSelf(v=>(y,b)=>a(r(y),b,v,!1).valueOf()),d[f+", Array"]=t.referToSelf(v=>(y,b)=>a(r(b),y,v,!0).valueOf())));var m=l.sS!==void 0?l.sS:l.Ss;return u?(l.Ss&&(d["SparseMatrix,"+f]=(v,y)=>l.Ss(v,y,u,!1)),m&&(d[f+", SparseMatrix"]=(v,y)=>m(y,v,u,!0))):(l.Ss&&(d["SparseMatrix,"+f]=t.referToSelf(v=>(y,b)=>l.Ss(y,b,v,!1))),m&&(d[f+", SparseMatrix"]=t.referToSelf(v=>(y,b)=>m(b,y,v,!0)))),u&&u.signatures&&hM(d,u.signatures),d}});function wa(e,t,r,n){if(!(this instanceof wa))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}wa.prototype=new Error,wa.prototype.constructor=Error,wa.prototype.name="ArgumentsError",wa.prototype.isArgumentsError=!0;var MO="gcd",Sre=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],mw="number | BigNumber | Fraction | Matrix | Array",Dre="".concat(mw,", ").concat(mw,", ...").concat(mw);function TO(e){return!e.some(t=>Array.isArray(t))}var Np=Q(MO,Sre,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=hw({typed:t,equalScalar:n}),u=gs({typed:t,DenseMatrix:a}),c=vr({typed:t,matrix:r,concat:o});return t(MO,{"number, number":mT,"BigNumber, BigNumber":d,"Fraction, Fraction":(f,p)=>f.gcd(p)},c({SS:l,DS:s,Ss:u}),{[Dre]:t.referToSelf(f=>(p,m,v)=>{for(var y=f(p,m),b=0;b<v.length;b++)y=f(y,v[b]);return y}),Array:t.referToSelf(f=>p=>{if(p.length===1&&Array.isArray(p[0])&&TO(p[0]))return f(...p[0]);if(TO(p))return f(...p);throw new wa("gcd() supports only 1d matrices!")}),Matrix:t.referToSelf(f=>p=>f(p.toArray()))});function d(f,p){if(!f.isInt()||!p.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var m=new i(0);!p.isZero();){var v=f.mod(p);f=p,p=v}return f.lt(m)?f.neg():f}}),Ere="matAlgo02xDS0",Nre=["typed","equalScalar"],Wi=Q(Ere,Nre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,d=a._values,f=a._index,p=a._ptr,m=a._size,v=a._datatype;if(u.length!==m.length)throw new Ot(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!d)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var y=u[0],b=u[1],D,x=r,S=0,w=o;typeof c=="string"&&c===v&&(D=c,x=t.find(r,[D,D]),S=t.convert(0,D),w=t.find(o,[D,D]));for(var C=[],E=[],A=[],_=0;_<b;_++){A[_]=E.length;for(var N=p[_],M=p[_+1],R=N;R<M;R++){var F=f[R],k=s?w(d[R],l[F][_]):w(l[F][_],d[R]);x(k,S)||(E.push(F),C.push(k))}}return A[b]=E.length,a.createSparseMatrix({values:C,index:E,ptr:A,size:[y,b],datatype:D})}}),Are="matAlgo06xS0S0",_re=["typed","equalScalar"],Ap=Q(Are,_re,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._size,u=i._datatype,c=a._values,d=a._size,f=a._datatype;if(l.length!==d.length)throw new Ot(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");var p=l[0],m=l[1],v,y=r,b=0,D=o;typeof u=="string"&&u===f&&(v=u,y=t.find(r,[v,v]),b=t.convert(0,v),D=t.find(o,[v,v]));for(var x=s&&c?[]:void 0,S=[],w=[],C=x?[]:void 0,E=[],A=[],_=0;_<m;_++){w[_]=S.length;var N=_+1;if(aT(i,_,E,C,A,N,S,D),aT(a,_,E,C,A,N,S,D),C)for(var M=w[_];M<S.length;){var R=S[M];if(A[R]===N){var F=C[R];y(F,b)?S.splice(M,1):(x.push(F),M++)}else S.splice(M,1)}else for(var k=w[_];k<S.length;){var P=S[k];A[P]!==N?S.splice(k,1):k++}}return w[m]=S.length,i.createSparseMatrix({values:x,index:S,ptr:w,size:[p,m],datatype:v})}}),OO="lcm",Mre=["typed","matrix","equalScalar","concat"],_p=Q(OO,Mre,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=Wi({typed:t,equalScalar:n}),o=Ap({typed:t,equalScalar:n}),s=Cn({typed:t,equalScalar:n}),l=vr({typed:t,matrix:r,concat:i}),u="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(u,", ").concat(u,", ...").concat(u)]=t.referToSelf(f=>(p,m,v)=>{for(var y=f(p,m),b=0;b<v.length;b++)y=f(y,v[b]);return y}),t(OO,{"number, number":vT,"BigNumber, BigNumber":d,"Fraction, Fraction":(f,p)=>f.lcm(p)},l({SS:o,DS:a,Ss:s}),c);function d(f,p){if(!f.isInt()||!p.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(f.isZero())return f;if(p.isZero())return p;for(var m=f.times(p);!p.isZero();){var v=p;p=f.mod(v),f=v}return m.div(f).abs()}}),RO="log10",Tre=["typed","config","Complex"],Mp=Q(RO,Tre,e=>{var{typed:t,config:r,Complex:n}=e;return t(RO,{number:function(a){return a>=0||r.predictable?gT(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||r.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf(i=>a=>zt(a,i))})}),IO="log2",Ore=["typed","config","Complex"],Tp=Q(IO,Ore,e=>{var{typed:t,config:r,Complex:n}=e;return t(IO,{number:function(o){return o>=0||r.predictable?yT(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||r.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":t.referToSelf(a=>o=>zt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}}),Rre="matAlgo03xDSf",Ire=["typed"],Vn=Q(Rre,Ire,e=>{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype,c=i._values,d=i._index,f=i._ptr,p=i._size,m=i._datatype;if(l.length!==p.length)throw new Ot(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=l[0],y=l[1],b,D=0,x=a;typeof u=="string"&&u===m&&(b=u,D=t.convert(0,b),x=t.find(a,[b,b]));for(var S=[],w=0;w<v;w++)S[w]=[];for(var C=[],E=[],A=0;A<y;A++){for(var _=A+1,N=f[A],M=f[A+1],R=N;R<M;R++){var F=d[R];C[F]=o?x(c[R],s[F][A]):x(s[F][A],c[R]),E[F]=_}for(var k=0;k<v;k++)E[k]===_?S[k][A]=C[k]:S[k][A]=o?x(D,s[k][A]):x(s[k][A],D)}return n.createDenseMatrix({data:S,size:[v,y],datatype:b})}}),kre="matAlgo05xSfSf",Pre=["typed","equalScalar"],Op=Q(kre,Pre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));var E=s&&f?[]:void 0,A=[],_=[],N=E?[]:void 0,M=E?[]:void 0,R=[],F=[],k,P,T,O;for(P=0;P<D;P++){_[P]=A.length;var L=P+1;for(T=u[P],O=u[P+1];T<O;T++)k=l[T],A.push(k),R[k]=L,N&&(N[k]=s[T]);for(T=m[P],O=m[P+1];T<O;T++)k=p[T],R[k]!==L&&A.push(k),F[k]=L,M&&(M[k]=f[T]);if(E)for(T=_[P];T<A.length;){k=A[T];var I=R[k],V=F[k];if(I===L||V===L){var H=I===L?N[k]:w,Z=V===L?M[k]:w,G=C(H,Z);S(G,w)?A.splice(T,1):(E.push(G),T++)}}}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),kO="mod",Fre=["typed","matrix","equalScalar","DenseMatrix","concat"],Rp=Q(kO,Fre,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Wi({typed:t,equalScalar:n}),s=Vn({typed:t}),l=Op({typed:t,equalScalar:n}),u=Cn({typed:t,equalScalar:n}),c=sn({typed:t,DenseMatrix:i}),d=vr({typed:t,matrix:r,concat:a});return t(kO,{"number, number":bT,"BigNumber, BigNumber":function(p,m){if(m.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return m.isZero()?p:p.mod(m)},"Fraction, Fraction":function(p,m){if(m.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return p.compare(0)>=0?p.mod(m):p.mod(m).add(m).mod(m)}},d({SS:l,DS:s,SD:o,Ss:u,sS:c}))}),$re="multiplyScalar",Bre=["typed"],Ip=Q($re,Bre,e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":uT,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(r,n)=>n.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,n)=>r.multiply(n)})}),PO="multiply",zre=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],kp=Q(PO,zre,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=Cn({typed:t,equalScalar:a}),l=Ui({typed:t});function u(w,C){switch(w.length){case 1:switch(C.length){case 1:if(w[0]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(w[0]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+w[0]+") must match Matrix rows ("+C[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+C.length+" dimensions)")}break;case 2:switch(C.length){case 1:if(w[1]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+w[1]+") must match Vector length ("+C[0]+")");break;case 2:if(w[1]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+w[1]+") must match Matrix B rows ("+C[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+C.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+w.length+" dimensions)")}}function c(w,C,E){if(E===0)throw new Error("Cannot multiply two empty vectors");return o(w,C)}function d(w,C){if(C.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return f(w,C)}function f(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._data,M=C._size,R=C._datatype,F=A[0],k=M[1],P,T=n,O=i;_&&R&&_===R&&typeof _=="string"&&(P=_,T=t.find(n,[P,P]),O=t.find(i,[P,P]));for(var L=[],I=0;I<k;I++){for(var V=O(E[0],N[0][I]),H=1;H<F;H++)V=T(V,O(E[H],N[H][I]));L[I]=V}return w.createDenseMatrix({data:L,size:[k],datatype:P})}var p=t("_multiplyMatrixVector",{"DenseMatrix, any":v,"SparseMatrix, any":D}),m=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":y,"DenseMatrix, SparseMatrix":b,"SparseMatrix, DenseMatrix":x,"SparseMatrix, SparseMatrix":S});function v(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._data,M=C._datatype,R=A[0],F=A[1],k,P=n,T=i;_&&M&&_===M&&typeof _=="string"&&(k=_,P=t.find(n,[k,k]),T=t.find(i,[k,k]));for(var O=[],L=0;L<R;L++){for(var I=E[L],V=T(I[0],N[0]),H=1;H<F;H++)V=P(V,T(I[H],N[H]));O[L]=V}return w.createDenseMatrix({data:O,size:[R],datatype:k})}function y(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._data,M=C._size,R=C._datatype,F=A[0],k=A[1],P=M[1],T,O=n,L=i;_&&R&&_===R&&typeof _=="string"&&(T=_,O=t.find(n,[T,T]),L=t.find(i,[T,T]));for(var I=[],V=0;V<F;V++){var H=E[V];I[V]=[];for(var Z=0;Z<P;Z++){for(var G=L(H[0],N[0][Z]),Y=1;Y<k;Y++)G=O(G,L(H[Y],N[Y][Z]));I[V][Z]=G}}return w.createDenseMatrix({data:I,size:[F,P],datatype:T})}function b(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._values,M=C._index,R=C._ptr,F=C._size,k=C._datatype;if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var P=A[0],T=F[1],O,L=n,I=i,V=a,H=0;_&&k&&_===k&&typeof _=="string"&&(O=_,L=t.find(n,[O,O]),I=t.find(i,[O,O]),V=t.find(a,[O,O]),H=t.convert(0,O));for(var Z=[],G=[],Y=[],re=C.createSparseMatrix({values:Z,index:G,ptr:Y,size:[P,T],datatype:O}),ne=0;ne<T;ne++){Y[ne]=G.length;var pe=R[ne],he=R[ne+1];if(he>pe)for(var le=0,fe=0;fe<P;fe++){for(var xe=fe+1,ge=void 0,ve=pe;ve<he;ve++){var Ee=M[ve];le!==xe?(ge=I(E[fe][Ee],N[ve]),le=xe):ge=L(ge,I(E[fe][Ee],N[ve]))}le===xe&&!V(ge,H)&&(G.push(fe),Z.push(ge))}}return Y[T]=G.length,re}function D(w,C){var E=w._values,A=w._index,_=w._ptr,N=w._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=C._data,R=C._datatype,F=w._size[0],k=C._size[0],P=[],T=[],O=[],L,I=n,V=i,H=a,Z=0;N&&R&&N===R&&typeof N=="string"&&(L=N,I=t.find(n,[L,L]),V=t.find(i,[L,L]),H=t.find(a,[L,L]),Z=t.convert(0,L));var G=[],Y=[];O[0]=0;for(var re=0;re<k;re++){var ne=M[re];if(!H(ne,Z))for(var pe=_[re],he=_[re+1],le=pe;le<he;le++){var fe=A[le];Y[fe]?G[fe]=I(G[fe],V(ne,E[le])):(Y[fe]=!0,T.push(fe),G[fe]=V(ne,E[le]))}}for(var xe=T.length,ge=0;ge<xe;ge++){var ve=T[ge];P[ge]=G[ve]}return O[1]=T.length,w.createSparseMatrix({values:P,index:T,ptr:O,size:[F,1],datatype:L})}function x(w,C){var E=w._values,A=w._index,_=w._ptr,N=w._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=C._data,R=C._datatype,F=w._size[0],k=C._size[0],P=C._size[1],T,O=n,L=i,I=a,V=0;N&&R&&N===R&&typeof N=="string"&&(T=N,O=t.find(n,[T,T]),L=t.find(i,[T,T]),I=t.find(a,[T,T]),V=t.convert(0,T));for(var H=[],Z=[],G=[],Y=w.createSparseMatrix({values:H,index:Z,ptr:G,size:[F,P],datatype:T}),re=[],ne=[],pe=0;pe<P;pe++){G[pe]=Z.length;for(var he=pe+1,le=0;le<k;le++){var fe=M[le][pe];if(!I(fe,V))for(var xe=_[le],ge=_[le+1],ve=xe;ve<ge;ve++){var Ee=A[ve];ne[Ee]!==he?(ne[Ee]=he,Z.push(Ee),re[Ee]=L(fe,E[ve])):re[Ee]=O(re[Ee],L(fe,E[ve]))}}for(var q=G[pe],J=Z.length,ce=q;ce<J;ce++){var X=Z[ce];H[ce]=re[X]}}return G[P]=Z.length,Y}function S(w,C){var E=w._values,A=w._index,_=w._ptr,N=w._datatype,M=C._values,R=C._index,F=C._ptr,k=C._datatype,P=w._size[0],T=C._size[1],O=E&&M,L,I=n,V=i;N&&k&&N===k&&typeof N=="string"&&(L=N,I=t.find(n,[L,L]),V=t.find(i,[L,L]));for(var H=O?[]:void 0,Z=[],G=[],Y=w.createSparseMatrix({values:H,index:Z,ptr:G,size:[P,T],datatype:L}),re=O?[]:void 0,ne=[],pe,he,le,fe,xe,ge,ve,Ee,q=0;q<T;q++){G[q]=Z.length;var J=q+1;for(xe=F[q],ge=F[q+1],fe=xe;fe<ge;fe++)if(Ee=R[fe],O)for(he=_[Ee],le=_[Ee+1],pe=he;pe<le;pe++)ve=A[pe],ne[ve]!==J?(ne[ve]=J,Z.push(ve),re[ve]=V(M[fe],E[pe])):re[ve]=I(re[ve],V(M[fe],E[pe]));else for(he=_[Ee],le=_[Ee+1],pe=he;pe<le;pe++)ve=A[pe],ne[ve]!==J&&(ne[ve]=J,Z.push(ve));if(O)for(var ce=G[q],X=Z.length,te=ce;te<X;te++){var ae=Z[te];H[te]=re[ae]}}return G[T]=Z.length,Y}return t(PO,i,{"Array, Array":t.referTo("Matrix, Matrix",w=>(C,E)=>{u(qt(C),qt(E));var A=w(r(C),r(E));return ft(A)?A.valueOf():A}),"Matrix, Matrix":function(C,E){var A=C.size(),_=E.size();return u(A,_),A.length===1?_.length===1?c(C,E,A[0]):d(C,E):_.length===1?p(C,E):m(C,E)},"Matrix, Array":t.referTo("Matrix,Matrix",w=>(C,E)=>w(C,r(E))),"Array, Matrix":t.referToSelf(w=>(C,E)=>w(r(C,E.storage()),E)),"SparseMatrix, any":function(C,E){return s(C,E,i,!1)},"DenseMatrix, any":function(C,E){return l(C,E,i,!1)},"any, SparseMatrix":function(C,E){return s(E,C,i,!0)},"any, DenseMatrix":function(C,E){return l(E,C,i,!0)},"Array, any":function(C,E){return l(r(C),E,i,!1).valueOf()},"any, Array":function(C,E){return l(r(E),C,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(w=>(C,E,A)=>{for(var _=w(C,E),N=0;N<A.length;N++)_=w(_,A[N]);return _})})}),FO="nthRoot",Lre=["typed","matrix","equalScalar","BigNumber","concat"],Pp=Q(FO,Lre,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,concat:a}=e,o=Bo({typed:t}),s=Wi({typed:t,equalScalar:n}),l=Ap({typed:t,equalScalar:n}),u=Cn({typed:t,equalScalar:n}),c=vr({typed:t,matrix:r,concat:a});function d(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(FO,{number:xT,"number, number":xT,BigNumber:p=>f(p,new i(2)),"BigNumber, BigNumber":f,Complex:d,"Complex, number":d,Array:t.referTo("DenseMatrix,number",p=>m=>p(r(m),2).valueOf()),DenseMatrix:t.referTo("DenseMatrix,number",p=>m=>p(m,2)),SparseMatrix:t.referTo("SparseMatrix,number",p=>m=>p(m,2)),"SparseMatrix, SparseMatrix":t.referToSelf(p=>(m,v)=>{if(v.density()===1)return l(m,v,p);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":t.referToSelf(p=>(m,v)=>{if(v.density()===1)return o(m,v,p,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",p=>(m,v)=>p(r(m),v)),"number | BigNumber, SparseMatrix":t.referToSelf(p=>(m,v)=>{if(v.density()===1)return u(v,m,p,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:s,Ss:u,sS:!1}));function f(p,m){var v=i.precision,y=i.clone({precision:v+2}),b=new i(0),D=new y(1),x=m.isNegative();if(x&&(m=m.neg()),m.isZero())throw new Error("Root must be non-zero");if(p.isNegative()&&!m.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(p.isZero())return x?new y(1/0):0;if(!p.isFinite())return x?b:p;var S=p.abs().pow(D.div(m));return S=p.isNeg()?S.neg():S,new i((x?D.div(S):S).toPrecision(v))}}),$O="sign",Vre=["typed","BigNumber","Fraction","complex"],Fp=Q($O,Vre,e=>{var{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t($O,{number:uw,Complex:function(o){return o.im===0?n(uw(o.re)):o.sign()},BigNumber:function(o){return new r(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":t.referToSelf(a=>o=>zt(o,a)),Unit:t.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return t.find(a,o.valueType())(o.value)})})}),qre="sqrt",Gre=["config","typed","Complex"],$p=Q(qre,Gre,e=>{var{config:t,typed:r,Complex:n}=e;return r("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||t.predictable?Math.sqrt(a):new n(a,0).sqrt()}}),BO="square",Ure=["typed"],Bp=Q(BO,Ure,e=>{var{typed:t}=e;return t(BO,{number:wT,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})}),zO="subtract",Wre=["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix","concat"],zp=Q(zO,Wre,e=>{var{typed:t,matrix:r,equalScalar:n,addScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,l=Bo({typed:t}),u=Vn({typed:t}),c=Op({typed:t,equalScalar:n}),d=gs({typed:t,DenseMatrix:o}),f=sn({typed:t,DenseMatrix:o}),p=vr({typed:t,matrix:r,concat:s});return t(zO,{"number, number":(m,v)=>m-v,"Complex, Complex":(m,v)=>m.sub(v),"BigNumber, BigNumber":(m,v)=>m.minus(v),"Fraction, Fraction":(m,v)=>m.sub(v),"Unit, Unit":t.referToSelf(m=>(v,y)=>{if(v.value===null)throw new Error("Parameter x contains a unit with undefined value");if(y.value===null)throw new Error("Parameter y contains a unit with undefined value");if(!v.equalBase(y))throw new Error("Units do not match");var b=v.clone();return b.value=t.find(m,[b.valueType(),y.valueType()])(b.value,y.value),b.fixPrefix=!1,b})},p({SS:c,DS:l,SD:u,Ss:f,sS:d}))}),LO="xgcd",Hre=["typed","config","matrix","BigNumber"],Lp=Q(LO,Hre,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(LO,{"number, number":function(s,l){var u=CT(s,l);return r.matrix==="Array"?u:n(u)},"BigNumber, BigNumber":a});function a(o,s){var l,u,c,d=new i(0),f=new i(1),p=d,m=f,v=f,y=d;if(!o.isInt()||!s.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!s.isZero();)u=o.div(s).floor(),c=o.mod(s),l=p,p=m.minus(u.times(p)),m=l,l=v,v=y.minus(u.times(v)),y=l,o=s,s=c;var b;return o.lt(d)?b=[o.neg(),m.neg(),y.neg()]:b=[o,o.isZero()?0:m,y],r.matrix==="Array"?b:n(b)}}),VO="invmod",jre=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Vp=Q(VO,jre,e=>{var{typed:t,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=e;return t(VO,{"number, number":c,"BigNumber, BigNumber":c});function c(d,f){if(!u(d)||!u(f))throw new Error("Parameters in function invmod must be integer numbers");if(d=s(d,f),a(f,0))throw new Error("Divisor must be non zero");var p=i(d,f);p=p.valueOf();var[m,v]=p;return a(m,n(1))?(v=s(v,f),o(v,n(0))&&(v=l(v,f)),v):NaN}}),Kre="matAlgo09xS0Sf",Yre=["typed","equalScalar"],qO=Q(Kre,Yre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));var E=s&&f?[]:void 0,A=[],_=[],N=E?[]:void 0,M=[],R,F,k,P,T;for(F=0;F<D;F++){_[F]=A.length;var O=F+1;if(N)for(P=m[F],T=m[F+1],k=P;k<T;k++)R=p[k],M[R]=O,N[R]=f[k];for(P=u[F],T=u[F+1],k=P;k<T;k++)if(R=l[k],N){var L=M[R]===O?N[R]:w,I=C(s[k],L);S(I,w)||(A.push(R),E.push(I))}else A.push(R)}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),GO="dotMultiply",Xre=["typed","matrix","equalScalar","multiplyScalar","concat"],qp=Q(GO,Xre,e=>{var{typed:t,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=e,o=Wi({typed:t,equalScalar:n}),s=qO({typed:t,equalScalar:n}),l=Cn({typed:t,equalScalar:n}),u=vr({typed:t,matrix:r,concat:a});return t(GO,u({elop:i,SS:s,DS:o,Ss:l}))});function Zre(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(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 r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return vw(e,t,function(n,i){return n&i})}function ec(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function Qre(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);var n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:!e.isFinite()||!t.isFinite()?!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e:vw(e,t,function(i,a){return i|a})}function vw(e,t,r){var n=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=Gp(ec(e));for(var l=0;l<i.length;++l)i[l]^=1}else i=Gp(e);if(s){a=Gp(ec(t));for(var u=0;u<a.length;++u)a[u]^=1}else a=Gp(t);var c,d,f;i.length<=a.length?(c=i,d=a,f=o):(c=a,d=i,f=s);var p=c.length,m=d.length,v=r(o,s)^1,y=new n(v^1),b=new n(1),D=new n(2),x=n.precision;for(n.config({precision:1e9});p>0;)r(c[--p],d[--m])===v&&(y=y.plus(b)),b=b.times(D);for(;m>0;)r(f,d[--m])===v&&(y=y.plus(b)),b=b.times(D);return n.config({precision:x}),v===0&&(y.s=-y.s),y}function Gp(e){for(var t=e.d,r=t[0]+"",n=1;n<t.length;++n){for(var i=t[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;r.charAt(o)==="0";)o--;var s=e.e,l=r.slice(0,o+1||1),u=l.length;if(s>0)if(++s>u)for(s-=u;s--;)l+="0";else s<u&&(l=l.slice(0,s)+"."+l.slice(s));for(var c=[0],d=0;d<l.length;){for(var f=c.length;f--;)c[f]*=10;c[0]+=parseInt(l.charAt(d++));for(var p=0;p<c.length;++p)c[p]>1&&((c[p+1]===null||c[p+1]===void 0)&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function Jre(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?ec(t):t.eq(n)?ec(e):!e.isFinite()||!t.isFinite()?!e.isFinite()&&!t.isFinite()?n:new r(e.isNegative()===t.isNegative()?1/0:-1/0):vw(e,t,function(i,a){return i^a})}function ene(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:!e.isFinite()&&!t.isFinite()?new r(NaN):t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t))}function tne(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}var UO="bitAnd",rne=["typed","matrix","equalScalar","concat"],Up=Q(UO,rne,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=Wi({typed:t,equalScalar:n}),o=Ap({typed:t,equalScalar:n}),s=Cn({typed:t,equalScalar:n}),l=vr({typed:t,matrix:r,concat:i});return t(UO,{"number, number":ET,"BigNumber, BigNumber":Zre},l({SS:o,DS:a,Ss:s}))}),WO="bitNot",nne=["typed"],Wp=Q(WO,nne,e=>{var{typed:t}=e;return t(WO,{number:NT,BigNumber:ec,"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),HO="bitOr",ine=["typed","matrix","equalScalar","DenseMatrix","concat"],Hp=Q(HO,ine,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:t}),s=hw({typed:t,equalScalar:n}),l=gs({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:r,concat:a});return t(HO,{"number, number":AT,"BigNumber, BigNumber":Qre},u({SS:s,DS:o,Ss:l}))}),ane="matAlgo07xSSf",one=["typed","DenseMatrix"],Ca=Q(ane,one,e=>{var{typed:t,DenseMatrix:r}=e;return function(a,o,s){var l=a._size,u=a._datatype,c=o._size,d=o._datatype;if(l.length!==c.length)throw new Ot(l.length,c.length);if(l[0]!==c[0]||l[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+c+")");var f=l[0],p=l[1],m,v=0,y=s;typeof u=="string"&&u===d&&(m=u,v=t.convert(0,m),y=t.find(s,[m,m]));var b,D,x=[];for(b=0;b<f;b++)x[b]=[];var S=[],w=[],C=[],E=[];for(D=0;D<p;D++){var A=D+1;for(n(a,D,C,S,A),n(o,D,E,w,A),b=0;b<f;b++){var _=C[b]===A?S[b]:v,N=E[b]===A?w[b]:v;x[b][D]=y(_,N)}}return new r({data:x,size:[f,p],datatype:m})};function n(i,a,o,s,l){for(var u=i._values,c=i._index,d=i._ptr,f=d[a],p=d[a+1];f<p;f++){var m=c[f];o[m]=l,s[m]=u[f]}}}),jO="bitXor",sne=["typed","matrix","DenseMatrix","concat"],jp=Q(jO,sne,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=Vn({typed:t}),o=Ca({typed:t,DenseMatrix:n}),s=sn({typed:t,DenseMatrix:n}),l=vr({typed:t,matrix:r,concat:i});return t(jO,{"number, number":_T,"BigNumber, BigNumber":Jre},l({SS:o,DS:a,Ss:s}))}),KO="arg",lne=["typed"],Kp=Q(KO,lne,e=>{var{typed:t}=e;return t(KO,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),YO="conj",une=["typed"],Yp=Q(YO,une,e=>{var{typed:t}=e;return t(YO,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),XO="im",cne=["typed"],Xp=Q(XO,cne,e=>{var{typed:t}=e;return t(XO,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),ZO="re",dne=["typed"],Zp=Q(ZO,dne,e=>{var{typed:t}=e;return t(ZO,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),QO="not",fne=["typed"],Qp=Q(QO,fne,e=>{var{typed:t}=e;return t(QO,{"null | undefined":()=>!0,number:IT,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),JO="or",pne=["typed","matrix","equalScalar","DenseMatrix","concat"],Jp=Q(JO,pne,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Op({typed:t,equalScalar:n}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:r,concat:a});return t(JO,{"number, number":kT,"Complex, Complex":function(d,f){return d.re!==0||d.im!==0||f.re!==0||f.im!==0},"BigNumber, BigNumber":function(d,f){return!d.isZero()&&!d.isNaN()||!f.isZero()&&!f.isNaN()},"Unit, Unit":t.referToSelf(c=>(d,f)=>c(d.value||0,f.value||0))},u({SS:s,DS:o,Ss:l}))}),eR="xor",hne=["typed","matrix","DenseMatrix","concat"],eh=Q(eR,hne,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=Vn({typed:t}),o=Ca({typed:t,DenseMatrix:n}),s=sn({typed:t,DenseMatrix:n}),l=vr({typed:t,matrix:r,concat:i});return t(eR,{"number, number":PT,"Complex, Complex":function(c,d){return(c.re!==0||c.im!==0)!=(d.re!==0||d.im!==0)},"BigNumber, BigNumber":function(c,d){return(!c.isZero()&&!c.isNaN())!=(!d.isZero()&&!d.isNaN())},"Unit, Unit":t.referToSelf(u=>(c,d)=>u(c.value||0,d.value||0))},l({SS:o,DS:a,Ss:s}))}),tR="concat",mne=["typed","matrix","isInteger"],tc=Q(tR,mne,e=>{var{typed:t,matrix:r,isInteger:n}=e;return t(tR,{"...Array | Matrix | number | BigNumber":function(a){var o,s=a.length,l=-1,u,c=!1,d=[];for(o=0;o<s;o++){var f=a[o];if(ft(f)&&(c=!0),Ut(f)||kt(f)){if(o!==s-1)throw new Error("Dimension must be specified as last argument");if(u=l,l=f.valueOf(),!n(l))throw new TypeError("Integer number expected for dimension");if(l<0||o>0&&l>u)throw new ii(l,u+1)}else{var p=pt(f).valueOf(),m=qt(p);if(d[o]=p,u=l,l=m.length-1,o>0&&l!==u)throw new Ot(u+1,l+1)}}if(d.length===0)throw new SyntaxError("At least one matrix expected");for(var v=d.shift();d.length;)v=rR(v,d.shift(),l,0);return c?r(v):v},"...string":function(a){return a.join("")}})});function rR(e,t,r,n){if(n<r){if(e.length!==t.length)throw new Ot(e.length,t.length);for(var i=[],a=0;a<e.length;a++)i[a]=rR(e[a],t[a],r,n+1);return i}else return e.concat(t)}var nR="column",vne=["typed","Index","matrix","range"],rc=Q(nR,vne,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(nR,{"Matrix, number":a,"Array, number":function(s,l){return a(n(pt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");hr(s,o.size()[1]);var l=i(0,o.size()[0]),u=new r(l,s),c=o.subset(u);return ft(c)?c:n([[c]])}}),iR="count",gne=["typed","size","prod"],th=Q(iR,gne,e=>{var{typed:t,size:r,prod:n}=e;return t(iR,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})}),aR="cross",yne=["typed","matrix","subtract","multiply"],rh=Q(aR,yne,e=>{var{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(aR,{"Matrix, Matrix":function(s,l){return r(a(s.toArray(),l.toArray()))},"Matrix, Array":function(s,l){return r(a(s.toArray(),l))},"Array, Matrix":function(s,l){return r(a(s,l.toArray()))},"Array, Array":a});function a(o,s){var l=Math.max(qt(o).length,qt(s).length);o=xf(o),s=xf(s);var u=qt(o),c=qt(s);if(u.length!==1||c.length!==1||u[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+c.join(", ")+"])");var d=[n(i(o[1],s[2]),i(o[2],s[1])),n(i(o[2],s[0]),i(o[0],s[2])),n(i(o[0],s[1]),i(o[1],s[0]))];return l>1?[d]:d}}),oR="diag",bne=["typed","matrix","DenseMatrix","SparseMatrix"],nh=Q(oR,bne,e=>{var{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(oR,{Array:function(u){return a(u,0,qt(u),null)},"Array, number":function(u,c){return a(u,c,qt(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),qt(u),null)},"Array, string":function(u,c){return a(u,0,qt(u),c)},"Array, number, string":function(u,c,d){return a(u,c,qt(u),d)},"Array, BigNumber, string":function(u,c,d){return a(u,c.toNumber(),qt(u),d)},Matrix:function(u){return a(u,0,u.size(),u.storage())},"Matrix, number":function(u,c){return a(u,c,u.size(),u.storage())},"Matrix, BigNumber":function(u,c){return a(u,c.toNumber(),u.size(),u.storage())},"Matrix, string":function(u,c){return a(u,0,u.size(),c)},"Matrix, number, string":function(u,c,d){return a(u,c,u.size(),d)},"Matrix, BigNumber, string":function(u,c,d){return a(u,c.toNumber(),u.size(),d)}});function a(l,u,c,d){if(!ot(u))throw new TypeError("Second parameter in function diag must be an integer");var f=u>0?u:0,p=u<0?-u:0;switch(c.length){case 1:return o(l,u,d,c[0],p,f);case 2:return s(l,u,d,c,p,f)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(l,u,c,d,f,p){var m=[d+f,d+p];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var v=c==="sparse"?i.diagonal(m,l,u):n.diagonal(m,l,u);return c!==null?v:v.valueOf()}function s(l,u,c,d,f,p){if(ft(l)){var m=l.diagonal(u);return c!==null?c!==m.storage()?r(m,c):m:m.valueOf()}for(var v=Math.min(d[0]-f,d[1]-p),y=[],b=0;b<v;b++)y[b]=l[b+f][b+p];return c!==null?r(y):y}}),xne="filter",wne=["typed"],ih=Q(xne,wne,e=>{var{typed:t}=e;return t("filter",{"Array, function":sR,"Matrix, function":function(n,i){return n.create(sR(n.toArray(),i))},"Array, RegExp":Cf,"Matrix, RegExp":function(n,i){return n.create(Cf(n.toArray(),i))}})});function sR(e,t){var r=$o(t);return kM(e,function(n,i,a){return r===1?t(n):r===2?t(n,[i]):t(n,[i],a)})}var lR="flatten",Cne=["typed","matrix"],ah=Q(lR,Cne,e=>{var{typed:t,matrix:r}=e;return t(lR,{Array:function(i){return Qt(i)},Matrix:function(i){var a=Qt(i.toArray());return r(a)}})}),uR="forEach",Sne=["typed"],oh=Q(uR,Sne,e=>{var{typed:t}=e;return t(uR,{"Array, function":Dne,"Matrix, function":function(n,i){n.forEach(i)}})});function Dne(e,t){var r=$o(t),n=function i(a,o){Array.isArray(a)?wf(a,function(s,l){i(s,o.concat(l))}):r===1?t(a):r===2?t(a,o):t(a,o,e)};n(e,[])}var cR="getMatrixDataType",Ene=["typed"],sh=Q(cR,Ene,e=>{var{typed:t}=e;return t(cR,{Array:function(n){return Ku(n,Or)},Matrix:function(n){return n.getDataType()}})}),dR="identity",Nne=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],lh=Q(dR,Nne,e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(dR,{"":function(){return r.matrix==="Matrix"?n([]):[]},string:function(c){return n(c)},"number | BigNumber":function(c){return l(c,c,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,d){return l(c,c,d)},"number | BigNumber, number | BigNumber":function(c,d){return l(c,d,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,d,f){return l(c,d,f)},Array:function(c){return s(c)},"Array, string":function(c,d){return s(c,d)},Matrix:function(c){return s(c.valueOf(),c.storage())},"Matrix, string":function(c,d){return s(c.valueOf(),d)}});function s(u,c){switch(u.length){case 0:return c?n(c):[];case 1:return l(u[0],u[0],c);case 2:return l(u[0],u[1],c);default:throw new Error("Vector containing two values expected")}}function l(u,c,d){var f=kt(u)||kt(c)?i:null;if(kt(u)&&(u=u.toNumber()),kt(c)&&(c=c.toNumber()),!ot(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!ot(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var p=f?new i(1):1,m=f?new f(0):0,v=[u,c];if(d){if(d==="sparse")return o.diagonal(v,p,0,m);if(d==="dense")return a.diagonal(v,p,0,m);throw new TypeError('Unknown matrix type "'.concat(d,'"'))}for(var y=xl([],v,m),b=u<c?u:c,D=0;D<b;D++)y[D][D]=p;return y}}),fR="kron",Ane=["typed","matrix","multiplyScalar"],uh=Q(fR,Ane,e=>{var{typed:t,matrix:r,multiplyScalar:n}=e;return t(fR,{"Matrix, Matrix":function(o,s){return r(i(o.toArray(),s.toArray()))},"Matrix, Array":function(o,s){return r(i(o.toArray(),s))},"Array, Matrix":function(o,s){return r(i(o,s.toArray()))},"Array, Array":i});function i(a,o){if(qt(a).length===1&&(a=[a]),qt(o).length===1&&(o=[o]),qt(a).length>2||qt(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var s=[],l=[];return a.map(function(u){return o.map(function(c){return l=[],s.push(l),u.map(function(d){return c.map(function(f){return l.push(n(d,f))})})})})&&s}}),pR="map",_ne=["typed"],ch=Q(pR,_ne,e=>{var{typed:t}=e;return t(pR,{"Array, function":Mne,"Matrix, function":function(n,i){return n.map(i)}})});function Mne(e,t){var r=$o(t),n=function i(a,o){if(Array.isArray(a))return a.map(function(u,c){return i(u,o.concat(c))});try{return r===1?t(a):r===2?t(a,o):t(a,o,e)}catch(u){if(u instanceof TypeError&&"data"in u&&u.data.category==="wrongType"){var s="map attempted to call '".concat(u.data.fn,"(").concat(a),l=JSON.stringify(o);throw r===2?s+=","+l:r!==1&&(s+=",".concat(l,",").concat(e)),s+=")' but argument ".concat(u.data.index+1," of type "),s+="".concat(u.data.actual," does not match expected type "),s+=u.data.expected.join(" or "),new TypeError(s)}throw u}};return n(e,[])}var hR="diff",Tne=["typed","matrix","subtract","number"],nc=Q(hR,Tne,e=>{var{typed:t,matrix:r,subtract:n,number:i}=e;return t(hR,{"Array | Matrix":function(c){return ft(c)?r(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,d){if(!ot(d))throw new RangeError("Dimension must be a whole number");return ft(c)?r(a(c.toArray(),d)):a(c,d)},"Array, BigNumber":t.referTo("Array,number",u=>(c,d)=>u(c,i(d))),"Matrix, BigNumber":t.referTo("Matrix,number",u=>(c,d)=>u(c,i(d)))});function a(u,c){if(ft(u)&&(u=u.toArray()),!Array.isArray(u))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var d=[];return u.forEach(f=>{d.push(a(f,c-1))}),d}else{if(c===0)return o(u);throw RangeError("Cannot have negative dimension")}}function o(u){for(var c=[],d=u.length,f=1;f<d;f++)c.push(s(u[f-1],u[f]));return c}function s(u,c){ft(u)&&(u=u.toArray()),ft(c)&&(c=c.toArray());var d=Array.isArray(u),f=Array.isArray(c);if(d&&f)return l(u,c);if(!d&&!f)return n(c,u);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function l(u,c){if(u.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var d=[],f=u.length,p=0;p<f;p++)d.push(s(u[p],c[p]));return d}}),One="ones",Rne=["typed","config","matrix","BigNumber"],dh=Q(One,Rne,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t("ones",{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var d=u.pop();return a(u,d)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),d=c?new i(1):1;if(s(l),u){var f=n(u);return l.length>0?f.resize(l,d):f}else{var p=[];return l.length>0?xl(p,l,d):p}}function o(l){var u=!1;return l.forEach(function(c,d,f){kt(c)&&(u=!0,f[d]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!ot(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function gw(){throw new Error('No "bignumber" implementation available')}function mR(){throw new Error('No "fraction" implementation available')}function vR(){throw new Error('No "matrix" implementation available')}var gR="range",Ine=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],ic=Q(gR,Ine,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l}=e;return t(gR,{string:c,"string, boolean":c,"number, number":function(b,D){return u(d(b,D,1))},"number, number, number":function(b,D,x){return u(d(b,D,x))},"number, number, boolean":function(b,D,x){return u(x?f(b,D,1):d(b,D,1))},"number, number, number, boolean":function(b,D,x,S){return u(S?f(b,D,x):d(b,D,x))},"BigNumber, BigNumber":function(b,D){var x=b.constructor;return u(p(b,D,new x(1)))},"BigNumber, BigNumber, BigNumber":function(b,D,x){return u(p(b,D,x))},"BigNumber, BigNumber, boolean":function(b,D,x){var S=b.constructor;return u(x?m(b,D,new S(1)):p(b,D,new S(1)))},"BigNumber, BigNumber, BigNumber, boolean":function(b,D,x,S){return u(S?m(b,D,x):p(b,D,x))}});function u(y){return r.matrix==="Matrix"?n?n(y):vR():y}function c(y,b){var D=v(y);if(!D)throw new SyntaxError('String "'+y+'" is no valid range');var x;return r.number==="BigNumber"?(i===void 0&&gw(),x=b?m:p,u(x(i(D.start),i(D.end),i(D.step)))):(x=b?f:d,u(x(D.start,D.end,D.step)))}function d(y,b,D){var x=[],S=y;if(D>0)for(;a(S,b);)x.push(S),S+=D;else if(D<0)for(;s(S,b);)x.push(S),S+=D;return x}function f(y,b,D){var x=[],S=y;if(D>0)for(;o(S,b);)x.push(S),S+=D;else if(D<0)for(;l(S,b);)x.push(S),S+=D;return x}function p(y,b,D){var x=i(0),S=[],w=y;if(D.gt(x))for(;a(w,b);)S.push(w),w=w.plus(D);else if(D.lt(x))for(;s(w,b);)S.push(w),w=w.plus(D);return S}function m(y,b,D){var x=i(0),S=[],w=y;if(D.gt(x))for(;o(w,b);)S.push(w),w=w.plus(D);else if(D.lt(x))for(;l(w,b);)S.push(w),w=w.plus(D);return S}function v(y){var b=y.split(":"),D=b.map(function(S){return Number(S)}),x=D.some(function(S){return isNaN(S)});if(x)return null;switch(D.length){case 2:return{start:D[0],end:D[1],step:1};case 3:return{start:D[0],end:D[2],step:D[1]};default:return null}}}),yR="reshape",kne=["typed","isInteger","matrix"],fh=Q(yR,kne,e=>{var{typed:t,isInteger:r}=e;return t(yR,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!r(o))throw new TypeError("Invalid size for dimension: "+o)}),MM(i,a)}})}),Pne="resize",Fne=["config","matrix"],ph=Q(Pne,Fne,e=>{var{config:t,matrix:r}=e;return function(a,o,s){if(arguments.length!==2&&arguments.length!==3)throw new wa("resize",arguments.length,2,3);if(ft(o)&&(o=o.valueOf()),kt(o[0])&&(o=o.map(function(c){return kt(c)?c.toNumber():c})),ft(a))return a.resize(o,s,!0);if(typeof a=="string")return n(a,o,s);var l=Array.isArray(a)?!1:t.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return pt(a)}else{Array.isArray(a)||(a=[a]),a=pt(a);var u=xl(a,o,s);return l?r(u):u}};function n(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new Ot(a.length,1);var s=a[0];if(typeof s!="number"||!ot(s))throw new TypeError("Invalid size, must contain positive integers (size: "+Pt(a)+")");if(i.length>s)return i.substring(0,s);if(i.length<s){for(var l=i,u=0,c=s-i.length;u<c;u++)l+=o;return l}else return i}}),bR="rotate",$ne=["typed","multiply","rotationMatrix"],hh=Q(bR,$ne,e=>{var{typed:t,multiply:r,rotationMatrix:n}=e;return t(bR,{"Array , number | BigNumber | Complex | Unit":function(o,s){i(o,2);var l=r(n(s),o);return l.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,s){return i(o,2),r(n(s),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){i(o,3);var u=r(n(s,l),o);return u},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){return i(o,3),r(n(s,l),o)}});function i(a,o){var s=Array.isArray(a)?qt(a):a.size();if(s.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s.length===2&&s[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}}),xR="rotationMatrix",Bne=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],mh=Q(xR,Bne,e=>{var{typed:t,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:l,DenseMatrix:u,SparseMatrix:c,cos:d,sin:f}=e;return t(xR,{"":function(){return r.matrix==="Matrix"?l([]):[]},string:function(x){return l(x)},"number | BigNumber | Complex | Unit":function(x){return p(x,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(x,S){return p(x,S)},"number | BigNumber | Complex | Unit, Array":function(x,S){var w=l(S);return m(w),b(x,w,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(x,S){m(S);var w=S.storage()||(r.matrix==="Matrix"?"dense":void 0);return b(x,S,w)},"number | BigNumber | Complex | Unit, Array, string":function(x,S,w){var C=l(S);return m(C),b(x,C,w)},"number | BigNumber | Complex | Unit, Matrix, string":function(x,S,w){return m(S),b(x,S,w)}});function p(D,x){var S=kt(D),w=S?new s(-1):-1,C=d(D),E=f(D),A=[[C,n(w,E)],[E,C]];return y(A,x)}function m(D){var x=D.size();if(x.length<1||x[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function v(D){return D.reduce((x,S)=>n(x,S))}function y(D,x){if(x){if(x==="sparse")return new c(D);if(x==="dense")return new u(D);throw new TypeError('Unknown matrix type "'.concat(x,'"'))}return D}function b(D,x,S){var w=o(x);if(w===0)throw new RangeError("Rotation around zero vector");var C=kt(D)?s:null,E=C?new C(1):1,A=C?new C(-1):-1,_=C?new C(x.get([0])/w):x.get([0])/w,N=C?new C(x.get([1])/w):x.get([1])/w,M=C?new C(x.get([2])/w):x.get([2])/w,R=d(D),F=i(E,a(R)),k=f(D),P=i(R,v([_,_,F])),T=i(v([_,N,F]),v([A,M,k])),O=i(v([_,M,F]),v([N,k])),L=i(v([_,N,F]),v([M,k])),I=i(R,v([N,N,F])),V=i(v([N,M,F]),v([A,_,k])),H=i(v([_,M,F]),v([A,N,k])),Z=i(v([N,M,F]),v([_,k])),G=i(R,v([M,M,F])),Y=[[P,T,O],[L,I,V],[H,Z,G]];return y(Y,S)}}),wR="row",zne=["typed","Index","matrix","range"],ac=Q(wR,zne,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(wR,{"Matrix, number":a,"Array, number":function(s,l){return a(n(pt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");hr(s,o.size()[0]);var l=i(0,o.size()[1]),u=new r(s,l),c=o.subset(u);return ft(c)?c:n([[c]])}}),CR="size",Lne=["typed","config","?matrix"],vh=Q(CR,Lne,e=>{var{typed:t,config:r,matrix:n}=e;return t(CR,{Matrix:function(a){return a.create(a.size())},Array:qt,string:function(a){return r.matrix==="Array"?[a.length]:n([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return r.matrix==="Array"?[]:n?n([]):vR()}})}),SR="squeeze",Vne=["typed","matrix"],gh=Q(SR,Vne,e=>{var{typed:t,matrix:r}=e;return t(SR,{Array:function(i){return xf(pt(i))},Matrix:function(i){var a=xf(i.toArray());return Array.isArray(a)?r(a):a},any:function(i){return pt(i)}})}),DR="subset",qne=["typed","matrix"],oc=Q(DR,qne,e=>{var{typed:t,matrix:r}=e;return t(DR,{"Array, Index":function(i,a){var o=r(i),s=o.subset(a);return a.isScalar()?s:s.valueOf()},"Matrix, Index":function(i,a){return i.subset(a)},"Object, Index":Une,"string, Index":Gne,"Array, Index, any":function(i,a,o){return r(pt(i)).subset(a,o,void 0).valueOf()},"Array, Index, any, any":function(i,a,o,s){return r(pt(i)).subset(a,o,s).valueOf()},"Matrix, Index, any":function(i,a,o){return i.clone().subset(a,o)},"Matrix, Index, any, any":function(i,a,o,s){return i.clone().subset(a,o,s)},"string, Index, string":ER,"string, Index, string, string":ER,"Object, Index, any":Wne})});function Gne(e,t){if(!ml(t))throw new TypeError("Index expected");if(t.size().length!==1)throw new Ot(t.size().length,1);var r=e.length;hr(t.min()[0],r),hr(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach(function(a){i+=e.charAt(a)}),i}function ER(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(t.size().length!==1)throw new Ot(t.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0),a=i.size()[0];if(a!==r.length)throw new Ot(i.size()[0],r.length);var o=e.length;hr(t.min()[0]),hr(t.max()[0]);for(var s=[],l=0;l<o;l++)s[l]=e.charAt(l);if(i.forEach(function(d,f){s[d]=r.charAt(f[0])}),s.length>o)for(var u=o-1,c=s.length;u<c;u++)s[u]||(s[u]=n);return s.join("")}function Une(e,t){if(t.size().length!==1)throw new Ot(t.size(),1);var r=t.dimension(0);if(typeof r!="string")throw new TypeError("String expected as index to retrieve an object property");return Si(e,r)}function Wne(e,t,r){if(t.size().length!==1)throw new Ot(t.size(),1);var n=t.dimension(0);if(typeof n!="string")throw new TypeError("String expected as index to retrieve an object property");var i=pt(e);return Cl(i,n,r),i}var NR="transpose",Hne=["typed","matrix"],yh=Q(NR,Hne,e=>{var{typed:t,matrix:r}=e;return t(NR,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:pt});function n(o){var s=o.size(),l;switch(s.length){case 1:l=o.clone();break;case 2:{var u=s[0],c=s[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Pt(s)+")");switch(o.storage()){case"dense":l=i(o,u,c);break;case"sparse":l=a(o,u,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Pt(s)+")")}return l}function i(o,s,l){for(var u=o._data,c=[],d,f=0;f<l;f++){d=c[f]=[];for(var p=0;p<s;p++)d[p]=pt(u[p][f])}return o.createDenseMatrix({data:c,size:[l,s],datatype:o._datatype})}function a(o,s,l){for(var u=o._values,c=o._index,d=o._ptr,f=u?[]:void 0,p=[],m=[],v=[],y=0;y<s;y++)v[y]=0;var b,D,x;for(b=0,D=c.length;b<D;b++)v[c[b]]++;for(var S=0,w=0;w<s;w++)m.push(S),S+=v[w],v[w]=m[w];for(m.push(S),x=0;x<l;x++)for(var C=d[x],E=d[x+1],A=C;A<E;A++){var _=v[c[A]]++;p[_]=x,u&&(f[_]=pt(u[A]))}return o.createSparseMatrix({values:f,index:p,ptr:m,size:[l,s],datatype:o._datatype})}}),AR="ctranspose",jne=["typed","transpose","conj"],bh=Q(AR,jne,e=>{var{typed:t,transpose:r,conj:n}=e;return t(AR,{any:function(a){return n(r(a))}})}),_R="zeros",Kne=["typed","config","matrix","BigNumber"],xh=Q(_R,Kne,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(_R,{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var d=u.pop();return a(u,d)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),d=c?new i(0):0;if(s(l),u){var f=n(u);return l.length>0?f.resize(l,d):f}else{var p=[];return l.length>0?xl(p,l,d):p}}function o(l){var u=!1;return l.forEach(function(c,d,f){kt(c)&&(u=!0,f[d]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!ot(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}}),MR="fft",Yne=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],wh=Q(MR,Yne,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:l,dotDivide:u,conj:c,pow:d,ceil:f,log2:p}=e;return t(MR,{Array:m,Matrix:function(x){return x.create(m(x.toArray()))}});function m(D){var x=qt(D);return x.length===1?b(D,x[0]):v(D.map(S=>m(S,x.slice(1))),0)}function v(D,x){var S=qt(D);if(x!==0)return new Array(S[0]).fill(0).map((C,E)=>v(D[E],x-1));if(S.length===1)return b(D);function w(C){var E=qt(C);return new Array(E[1]).fill(0).map((A,_)=>new Array(E[0]).fill(0).map((N,M)=>C[M][_]))}return w(v(w(D),1))}function y(D){for(var x=D.length,S=o(a(i(-1,i(l,s)),x)),w=[],C=1-x;C<x;C++)w.push(d(S,a(d(C,2),2)));for(var E=d(2,f(p(x+x-1))),A=[...new Array(x).fill(0).map((T,O)=>i(D[O],w[x-1+O])),...new Array(E-x).fill(0)],_=[...new Array(x+x-1).fill(0).map((T,O)=>a(1,w[O])),...new Array(E-(x+x-1)).fill(0)],N=b(A),M=b(_),R=new Array(E).fill(0).map((T,O)=>i(N[O],M[O])),F=u(c(m(c(R))),E),k=[],P=x-1;P<x+x-1;P++)k.push(i(F[P],w[P]));return k}function b(D){var x=D.length;if(x===1)return[D[0]];if(x%2===0){for(var S=[...b(D.filter((A,_)=>_%2===0)),...b(D.filter((A,_)=>_%2===1))],w=0;w<x/2;w++){var C=S[w],E=i(S[w+x/2],o(i(i(s,l),a(-w,x))));S[w]=n(C,E),S[w+x/2]=n(C,i(-1,E))}return S}else return y(D)}}),TR="ifft",Xne=["typed","fft","dotDivide","conj"],Ch=Q(TR,Xne,e=>{var{typed:t,fft:r,dotDivide:n,conj:i}=e;return t(TR,{"Array | Matrix":function(o){var s=ft(o)?o.size():qt(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})}),Zne="erf",Qne=["typed"],Sh=Q(Zne,Qne,e=>{var{typed:t}=e;return t("name",{number:function(o){var s=Math.abs(o);return s>=tie?Oo(o):s<=Jne?Oo(o)*r(s):s<=4?Oo(o)*(1-n(s)):Oo(o)*(1-i(s))},"Array | Matrix":t.referToSelf(a=>o=>zt(o,a))});function r(a){var o=a*a,s=eo[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+eo[0][u])*o,l=(l+Ol[0][u])*o;return a*(s+eo[0][3])/(l+Ol[0][3])}function n(a){var o=eo[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+eo[1][l])*a,s=(s+Ol[1][l])*a;var u=(o+eo[1][7])/(s+Ol[1][7]),c=parseInt(a*16)/16,d=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-d)*u}function i(a){var o=1/(a*a),s=eo[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+eo[2][u])*o,l=(l+Ol[2][u])*o;var c=o*(s+eo[2][4])/(l+Ol[2][4]);c=(eie-c)/a,o=parseInt(a*16)/16;var d=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-d)*c}}),Jne=.46875,eie=.5641895835477563,eo=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Ol=[[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]],tie=Math.pow(2,53),OR="mode",rie=["typed","isNaN","isNumeric"],Dh=Q(OR,rie,e=>{var{typed:t,isNaN:r,isNumeric:n}=e;return t(OR,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=Qt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var s={},l=[],u=0,c=0;c<a.length;c++){var d=a[c];if(n(d)&&r(d))throw new Error("Cannot calculate mode of an array containing NaN values");d in s||(s[d]=0),s[d]++,s[d]===u?l.push(d):s[d]>u&&(u=s[d],l=[d])}return l}});function qn(e,t,r){var n;return String(e).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+Or(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):String(e).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+Or(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var RR="prod",nie=["typed","config","multiplyScalar","numeric"],Eh=Q(RR,nie,e=>{var{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(RR,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(s,l){throw new Error("prod(A, dim) is not yet supported")},"...":function(s){return a(s)}});function a(o){var s;if(Qa(o,function(l){try{s=s===void 0?l:n(s,l)}catch(u){throw qn(u,"prod",l)}}),typeof s=="string"&&(s=i(s,r.number)),s===void 0)throw new Error("Cannot calculate prod of an empty array");return s}}),IR="format",iie=["typed"],Nh=Q(IR,iie,e=>{var{typed:t}=e;return t(IR,{any:Pt,"any, Object | function | number":Pt})}),kR="bin",aie=["typed","format"],Ah=Q(kR,aie,e=>{var{typed:t,format:r}=e;return t(kR,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"bin",wordSize:a})}})}),PR="oct",oie=["typed","format"],_h=Q(PR,oie,e=>{var{typed:t,format:r}=e;return t(PR,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"oct",wordSize:a})}})}),FR="hex",sie=["typed","format"],Mh=Q(FR,sie,e=>{var{typed:t,format:r}=e;return t(FR,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"hex",wordSize:a})}})}),$R="print",lie=["typed"],Th=Q($R,lie,e=>{var{typed:t}=e;return t($R,{"string, Object | Array":BR,"string, Object | Array, number | Object":BR})});function BR(e,t,r){return e.replace(/\$([\w.]+)/g,function(n,i){for(var a=i.split("."),o=t[a.shift()];a.length&&o!==void 0;){var s=a.shift();o=s?o[s]:o+"."}return o!==void 0?bn(o)?o:Pt(o,r):n})}var zR="to",uie=["typed","matrix","concat"],Oh=Q(zR,uie,e=>{var{typed:t,matrix:r,concat:n}=e,i=vr({typed:t,matrix:r,concat:n});return t(zR,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))}),LR="isPrime",cie=["typed"],Rh=Q(LR,cie,e=>{var{typed:t}=e;return t(LR,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(D,x,S){for(var w=1;!x.eq(0);)x.mod(2).eq(0)?(x=x.div(2),D=D.mul(D).mod(S)):(x=x.sub(1),w=D.mul(w).mod(S));return w}var s=n.constructor.clone({precision:n.toFixed(0).length*2});n=new s(n);for(var l=0,u=n.sub(1);u.mod(2).eq(0);)u=u.div(2),l+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(D=>D<n);else{var d=Math.min(n.toNumber()-2,Math.floor(2*Math.pow(n.toFixed(0).length*Math.log(10),2)));c=[];for(var f=2;f<=d;f+=1)c.push(d)}for(var p=0;p<c.length;p+=1){var m=c[p],v=o(n.sub(n).add(m),u,n);if(!v.eq(1)){for(var y=0,b=v;!b.eq(n.sub(1));y+=1,b=b.mul(b).mod(n))if(y===l-1)return!1}}return!0},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),die="numeric",fie=["number","?bignumber","?fraction"],Ih=Q(die,fie,e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>t(o),BigNumber:r?o=>r(o):gw,Fraction:n?o=>n(o):mR};return function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",u=arguments.length>2?arguments[2]:void 0;if(u!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=Or(s);if(!(c in i))throw new TypeError("Cannot convert "+s+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in a))throw new TypeError("Cannot convert "+s+' to type "'+l+'"; valid output types are '+Object.keys(a).join(", "));return l===c?s:a[l](s)}}),VR="divideScalar",pie=["typed","numeric"],kh=Q(VR,pie,e=>{var{typed:t,numeric:r}=e;return t(VR,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})}),qR="pow",hie=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Ph=Q(qR,hie,e=>{var{typed:t,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=e;return t(qR,{"number, number":c,"Complex, Complex":function(m,v){return m.pow(v)},"BigNumber, BigNumber":function(m,v){return v.isInteger()||m>=0||r.predictable?m.pow(v):new u(m.toNumber(),0).pow(v.toNumber(),0)},"Fraction, Fraction":function(m,v){var y=m.pow(v);if(y!=null)return y;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(m.valueOf(),v.valueOf())},"Array, number":d,"Array, BigNumber":function(m,v){return d(m,v.toNumber())},"Matrix, number":f,"Matrix, BigNumber":function(m,v){return f(m,v.toNumber())},"Unit, number | BigNumber":function(m,v){return m.pow(v)}});function c(p,m){if(r.predictable&&!ot(m)&&p<0)try{var v=l(m),y=s(v);if((m===y||Math.abs((m-y)/m)<1e-14)&&v.d%2===1)return(v.n%2===0?1:-1)*Math.pow(-p,m)}catch{}return r.predictable&&(p<-1&&m===1/0||p>-1&&p<0&&m===-1/0)?NaN:ot(m)||p>=0||r.predictable?ST(p,m):p*p<1&&m===1/0||p*p>1&&m===-1/0?0:new u(p,0).pow(m,0)}function d(p,m){if(!ot(m))throw new TypeError("For A^b, b must be an integer (value is "+m+")");var v=qt(p);if(v.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+v.length+" dimensions)");if(v[0]!==v[1])throw new Error("For A^b, A must be square (size is "+v[0]+"x"+v[1]+")");if(m<0)try{return d(o(p),-m)}catch(D){throw D.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+m+")"):D}for(var y=n(v[0]).valueOf(),b=p;m>=1;)(m&1)===1&&(y=i(b,y)),m>>=1,b=i(b,b);return y}function f(p,m){return a(d(p.valueOf(),m))}}),Rl="Number of decimals in function round must be an integer",GR="round",mie=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Fh=Q(GR,mie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,BigNumber:a,DenseMatrix:o}=e,s=Cn({typed:t,equalScalar:n}),l=sn({typed:t,DenseMatrix:o}),u=Ui({typed:t});return t(GR,{number:DT,"number, number":DT,"number, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);return new a(d).toDecimalPlaces(f.toNumber())},Complex:function(d){return d.round()},"Complex, number":function(d,f){if(f%1)throw new TypeError(Rl);return d.round(f)},"Complex, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);var p=f.toNumber();return d.round(p)},BigNumber:function(d){return d.toDecimalPlaces(0)},"BigNumber, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);return d.toDecimalPlaces(f.toNumber())},Fraction:function(d){return d.round()},"Fraction, number":function(d,f){if(f%1)throw new TypeError(Rl);return d.round(f)},"Fraction, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);return d.round(f.toNumber())},"Array | Matrix":t.referToSelf(c=>d=>zt(d,c)),"SparseMatrix, number | BigNumber":t.referToSelf(c=>(d,f)=>s(d,f,c,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(c=>(d,f)=>u(d,f,c,!1)),"Array, number | BigNumber":t.referToSelf(c=>(d,f)=>u(r(d),f,c,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(c=>(d,f)=>n(d,0)?i(f.size(),f.storage()):l(f,d,c,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(c=>(d,f)=>n(d,0)?i(f.size(),f.storage()):u(f,d,c,!0)),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(c=>(d,f)=>u(r(f),d,c,!0).valueOf())})}),UR="log",vie=["config","typed","divideScalar","Complex"],$h=Q(UR,vie,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e;return t(UR,{number:function(o){return o>=0||r.predictable?ite(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||r.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":t.referToSelf(a=>(o,s)=>n(a(o),a(s)))})}),WR="log1p",gie=["typed","config","divideScalar","log","Complex"],Bh=Q(WR,gie,e=>{var{typed:t,config:r,divideScalar:n,log:i,Complex:a}=e;return t(WR,{number:function(l){return l>=-1||r.predictable?yJ(l):o(new a(l,0))},Complex:o,BigNumber:function(l){var u=l.plus(1);return!u.isNegative()||r.predictable?u.ln():o(new a(l.toNumber(),0))},"Array | Matrix":t.referToSelf(s=>l=>zt(l,s)),"any, any":t.referToSelf(s=>(l,u)=>n(s(l),i(u)))});function o(s){var l=s.re+1;return new a(Math.log(Math.sqrt(l*l+s.im*s.im)),Math.atan2(s.im,l))}}),HR="nthRoots",yie=["config","typed","divideScalar","Complex"],zh=Q(HR,yie,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e,a=[function(l){return new i(l,0)},function(l){return new i(0,l)},function(l){return new i(-l,0)},function(l){return new i(0,-l)}];function o(s,l){if(l<0)throw new Error("Root must be greater than zero");if(l===0)throw new Error("Root must be non-zero");if(l%1!==0)throw new Error("Root must be an integer");if(s===0||s.abs()===0)return[new i(0,0)];var u=typeof s=="number",c;(u||s.re===0||s.im===0)&&(u?c=2*+(s<0):s.im===0?c=2*+(s.re<0):c=2*+(s.im<0)+1);for(var d=s.arg(),f=s.abs(),p=[],m=Math.pow(f,1/l),v=0;v<l;v++){var y=(c+4*v)/l;if(y===Math.round(y)){p.push(a[y%4](m));continue}p.push(new i({r:m,phi:(d+2*Math.PI*v)/l}))}return p}return t(HR,{Complex:function(l){return o(l,2)},"Complex, number":o})}),jR="dotPow",bie=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],Lh=Q(jR,bie,e=>{var{typed:t,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o}=e,s=Vn({typed:t}),l=Ca({typed:t,DenseMatrix:a}),u=Cn({typed:t,equalScalar:r}),c=sn({typed:t,DenseMatrix:a}),d=vr({typed:t,matrix:n,concat:o}),f={};for(var p in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,p)&&!p.includes("Matrix")&&!p.includes("Array")&&(f[p]=i.signatures[p]);var m=t(f);return t(jR,d({elop:m,SS:l,DS:s,Ss:u,sS:c}))}),KR="dotDivide",xie=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Vh=Q(KR,xie,e=>{var{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=Wi({typed:t,equalScalar:n}),l=Vn({typed:t}),u=Ca({typed:t,DenseMatrix:a}),c=Cn({typed:t,equalScalar:n}),d=sn({typed:t,DenseMatrix:a}),f=vr({typed:t,matrix:r,concat:o});return t(KR,f({elop:i,SS:u,DS:l,SD:s,Ss:c,sS:d}))});function sc(e){var{DenseMatrix:t}=e;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Pt(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+Pt(o)+")");var u=[];if(ft(i)){var c=i.size(),d=i._data;if(c.length===1){if(c[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var f=0;f<s;f++)u[f]=[d[f]];return new t({data:u,size:[s,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==s||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(hl(i)){if(a){u=[];for(var p=0;p<s;p++)u[p]=[d[p][0]];return new t({data:u,size:[s,1],datatype:i._datatype})}return i}if(ja(i)){for(var m=0;m<s;m++)u[m]=[0];for(var v=i._values,y=i._index,b=i._ptr,D=b[1],x=b[0];x<D;x++){var S=y[x];u[S][0]=v[x]}return new t({data:u,size:[s,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(or(i)){var w=qt(i);if(w.length===1){if(w[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var C=0;C<s;C++)u[C]=[i[C]];return new t({data:u,size:[s,1]})}if(w.length===2){if(w[0]!==s||w[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var E=0;E<s;E++)u[E]=[i[E][0]];return new t({data:u,size:[s,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var YR="lsolve",wie=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],qh=Q(YR,wie,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(YR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.valueOf()}});function u(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=[],b=d._data,D=0;D<v;D++){var x=p[D][0]||0,S=void 0;if(o(x,0))S=0;else{var w=b[D][D];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");S=n(x,w);for(var C=D+1;C<m;C++)p[C]=[a(p[C][0]||0,i(S,b[C][D]))]}y[D]=[S]}return new s({data:y,size:[m,1]})}function c(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=[],S=0;S<v;S++){var w=p[S][0]||0;if(o(w,0))x[S]=[0];else{for(var C=0,E=[],A=[],_=D[S],N=D[S+1],M=_;M<N;M++){var R=b[M];R===S?C=y[M]:R>S&&(E.push(y[M]),A.push(R))}if(o(C,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var F=n(w,C),k=0,P=A.length;k<P;k++){var T=A[k];p[T]=[a(p[T][0]||0,i(F,E[k]))]}x[S]=[F]}}return new s({data:x,size:[m,1]})}}),XR="usolve",Cie=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Gh=Q(XR,Cie,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(XR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.valueOf()}});function u(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=[],b=d._data,D=v-1;D>=0;D--){var x=p[D][0]||0,S=void 0;if(o(x,0))S=0;else{var w=b[D][D];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");S=n(x,w);for(var C=D-1;C>=0;C--)p[C]=[a(p[C][0]||0,i(S,b[C][D]))]}y[D]=[S]}return new s({data:y,size:[m,1]})}function c(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=[],S=v-1;S>=0;S--){var w=p[S][0]||0;if(o(w,0))x[S]=[0];else{for(var C=0,E=[],A=[],_=D[S],N=D[S+1],M=N-1;M>=_;M--){var R=b[M];R===S?C=y[M]:R<S&&(E.push(y[M]),A.push(R))}if(o(C,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var F=n(w,C),k=0,P=A.length;k<P;k++){var T=A[k];p[T]=[a(p[T][0],i(F,E[k]))]}x[S]=[F]}}return new s({data:x,size:[m,1]})}}),ZR="lsolveAll",Sie=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Uh=Q(ZR,Sie,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(ZR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.map(y=>y.valueOf())}});function u(d,f){for(var p=[l(d,f,!0)._data.map(A=>A[0])],m=d._data,v=d._size[0],y=d._size[1],b=0;b<y;b++)for(var D=p.length,x=0;x<D;x++){var S=p[x];if(o(m[b][b],0))if(o(S[b],0)){if(x===0){var C=[...S];C[b]=1;for(var E=b+1;E<y;E++)C[E]=a(C[E],m[E][b]);p.push(C)}}else{if(x===0)return[];p.splice(x,1),x-=1,D-=1}else{S[b]=n(S[b],m[b][b]);for(var w=b+1;w<y;w++)S[w]=a(S[w],i(S[b],m[w][b]))}}return p.map(A=>new s({data:A.map(_=>[_]),size:[v,1]}))}function c(d,f){for(var p=[l(d,f,!0)._data.map(H=>H[0])],m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=0;x<v;x++)for(var S=p.length,w=0;w<S;w++){for(var C=p[w],E=[],A=[],_=D[x],N=D[x+1],M=0,R=_;R<N;R++){var F=b[R];F===x?M=y[R]:F>x&&(E.push(y[R]),A.push(F))}if(o(M,0))if(o(C[x],0)){if(w===0){var O=[...C];O[x]=1;for(var L=0,I=A.length;L<I;L++){var V=A[L];O[V]=a(O[V],E[L])}p.push(O)}}else{if(w===0)return[];p.splice(w,1),w-=1,S-=1}else{C[x]=n(C[x],M);for(var k=0,P=A.length;k<P;k++){var T=A[k];C[T]=a(C[T],i(C[x],E[k]))}}}return p.map(H=>new s({data:H.map(Z=>[Z]),size:[m,1]}))}}),QR="usolveAll",Die=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Wh=Q(QR,Die,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(QR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.map(y=>y.valueOf())}});function u(d,f){for(var p=[l(d,f,!0)._data.map(A=>A[0])],m=d._data,v=d._size[0],y=d._size[1],b=y-1;b>=0;b--)for(var D=p.length,x=0;x<D;x++){var S=p[x];if(o(m[b][b],0))if(o(S[b],0)){if(x===0){var C=[...S];C[b]=1;for(var E=b-1;E>=0;E--)C[E]=a(C[E],m[E][b]);p.push(C)}}else{if(x===0)return[];p.splice(x,1),x-=1,D-=1}else{S[b]=n(S[b],m[b][b]);for(var w=b-1;w>=0;w--)S[w]=a(S[w],i(S[b],m[w][b]))}}return p.map(A=>new s({data:A.map(_=>[_]),size:[v,1]}))}function c(d,f){for(var p=[l(d,f,!0)._data.map(H=>H[0])],m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=v-1;x>=0;x--)for(var S=p.length,w=0;w<S;w++){for(var C=p[w],E=[],A=[],_=D[x],N=D[x+1],M=0,R=N-1;R>=_;R--){var F=b[R];F===x?M=y[R]:F<x&&(E.push(y[R]),A.push(F))}if(o(M,0))if(o(C[x],0)){if(w===0){var O=[...C];O[x]=1;for(var L=0,I=A.length;L<I;L++){var V=A[L];O[V]=a(O[V],E[L])}p.push(O)}}else{if(w===0)return[];p.splice(w,1),w-=1,S-=1}else{C[x]=n(C[x],M);for(var k=0,P=A.length;k<P;k++){var T=A[k];C[T]=a(C[T],i(C[x],E[k]))}}}return p.map(H=>new s({data:H.map(Z=>[Z]),size:[m,1]}))}}),Eie="matAlgo08xS0Sid",Nie=["typed","equalScalar"],yw=Q(Eie,Nie,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");if(!s||!f)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));for(var E=[],A=[],_=[],N=[],M=[],R,F,k,P,T=0;T<D;T++){_[T]=A.length;var O=T+1;for(F=u[T],k=u[T+1],R=F;R<k;R++)P=l[R],M[P]=O,N[P]=s[R],A.push(P);for(F=m[T],k=m[T+1],R=F;R<k;R++)P=p[R],M[P]===O&&(N[P]=C(N[P],f[R]));for(R=_[T];R<A.length;){P=A[R];var L=N[P];S(L,w)?A.splice(R,1):(E.push(L),R++)}}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),bw=Q("useMatrixForArrayScalar",["typed","matrix"],e=>{var{typed:t,matrix:r}=e;return{"Array, number":t.referTo("DenseMatrix, number",n=>(i,a)=>n(r(i),a).valueOf()),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(r(i),a).valueOf()),"number, Array":t.referTo("number, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf()),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf())}}),JR="leftShift",Aie=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Hh=Q(JR,Aie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=Wi({typed:t,equalScalar:n}),u=yw({typed:t,equalScalar:n}),c=gs({typed:t,DenseMatrix:a}),d=Cn({typed:t,equalScalar:n}),f=Ui({typed:t}),p=vr({typed:t,matrix:r,concat:o}),m=bw({typed:t,matrix:r});return t(JR,{"number, number":MT,"BigNumber, BigNumber":ene,"SparseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():d(y,b,v,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():f(y,b,v,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):c(b,y,v,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):f(b,y,v,!0))},m,p({SS:u,DS:s,SD:l}))}),e3="rightArithShift",_ie=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],jh=Q(e3,_ie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=Wi({typed:t,equalScalar:n}),u=yw({typed:t,equalScalar:n}),c=gs({typed:t,DenseMatrix:a}),d=Cn({typed:t,equalScalar:n}),f=Ui({typed:t}),p=vr({typed:t,matrix:r,concat:o}),m=bw({typed:t,matrix:r});return t(e3,{"number, number":TT,"BigNumber, BigNumber":tne,"SparseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():d(y,b,v,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():f(y,b,v,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):c(b,y,v,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):f(b,y,v,!0))},m,p({SS:u,DS:s,SD:l}))}),t3="rightLogShift",Mie=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Kh=Q(t3,Mie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=Wi({typed:t,equalScalar:n}),u=yw({typed:t,equalScalar:n}),c=gs({typed:t,DenseMatrix:a}),d=Cn({typed:t,equalScalar:n}),f=Ui({typed:t}),p=vr({typed:t,matrix:r,concat:o}),m=bw({typed:t,matrix:r});return t(t3,{"number, number":OT,"SparseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():d(y,b,v,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():f(y,b,v,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):c(b,y,v,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):f(b,y,v,!0))},m,p({SS:u,DS:s,SD:l}))}),r3="and",Tie=["typed","matrix","equalScalar","zeros","not","concat"],Yh=Q(r3,Tie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=Wi({typed:t,equalScalar:n}),l=Ap({typed:t,equalScalar:n}),u=Cn({typed:t,equalScalar:n}),c=Ui({typed:t}),d=vr({typed:t,matrix:r,concat:o});return t(r3,{"number, number":FT,"Complex, Complex":function(p,m){return(p.re!==0||p.im!==0)&&(m.re!==0||m.im!==0)},"BigNumber, BigNumber":function(p,m){return!p.isZero()&&!m.isZero()&&!p.isNaN()&&!m.isNaN()},"Unit, Unit":t.referToSelf(f=>(p,m)=>f(p.value||0,m.value||0)),"SparseMatrix, any":t.referToSelf(f=>(p,m)=>a(m)?i(p.size(),p.storage()):u(p,m,f,!1)),"DenseMatrix, any":t.referToSelf(f=>(p,m)=>a(m)?i(p.size(),p.storage()):c(p,m,f,!1)),"any, SparseMatrix":t.referToSelf(f=>(p,m)=>a(p)?i(p.size(),p.storage()):u(m,p,f,!0)),"any, DenseMatrix":t.referToSelf(f=>(p,m)=>a(p)?i(p.size(),p.storage()):c(m,p,f,!0)),"Array, any":t.referToSelf(f=>(p,m)=>f(r(p),m).valueOf()),"any, Array":t.referToSelf(f=>(p,m)=>f(p,r(m)).valueOf())},d({SS:l,DS:s}))}),Xh="compare",Oie=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],Zh=Q(Xh,Oie,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=e,u=Vn({typed:t}),c=Op({typed:t,equalScalar:n}),d=sn({typed:t,DenseMatrix:s}),f=vr({typed:t,matrix:i,concat:l}),p=Tl({typed:t});return t(Xh,Rie({typed:t,config:r}),{"boolean, boolean":function(v,y){return v===y?0:v>y?1:-1},"BigNumber, BigNumber":function(v,y){return xa(v,y,r.epsilon)?new a(0):new a(v.cmp(y))},"Fraction, Fraction":function(v,y){return new o(v.compare(y))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:d}))}),Rie=Q(Xh,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Xh,{"number, number":function(i,a){return ni(i,a,r.epsilon)?0:i>a?1:-1}})}),Il=function e(t,r){var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,s=/^0/,l=function(x){return e.insensitive&&(""+x).toLowerCase()||""+x},u=l(t).replace(i,"")||"",c=l(r).replace(i,"")||"",d=u.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),f=c.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(u.match(o),16)||d.length!==1&&u.match(a)&&Date.parse(u),m=parseInt(c.match(o),16)||p&&c.match(a)&&Date.parse(c)||null,v,y;if(m){if(p<m)return-1;if(p>m)return 1}for(var b=0,D=Math.max(d.length,f.length);b<D;b++){if(v=!(d[b]||"").match(s)&&parseFloat(d[b])||d[b]||0,y=!(f[b]||"").match(s)&&parseFloat(f[b])||f[b]||0,isNaN(v)!==isNaN(y))return isNaN(v)?1:-1;if(typeof v!=typeof y&&(v+="",y+=""),v<y)return-1;if(v>y)return 1}return 0},n3="compareNatural",Iie=["typed","compare"],Qh=Q(n3,Iie,e=>{var{typed:t,compare:r}=e,n=r.signatures["boolean,boolean"];return t(n3,{"any, any":i});function i(l,u){var c=Or(l),d=Or(u),f;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(d==="number"||d==="BigNumber"||d==="Fraction"))return f=r(l,u),f.toString()!=="0"?f>0?1:-1:Il(c,d);var p=["Array","DenseMatrix","SparseMatrix"];if(p.includes(c)||p.includes(d))return f=a(i,l,u),f!==0?f:Il(c,d);if(c!==d)return Il(c,d);if(c==="Complex")return kie(l,u);if(c==="Unit")return l.equalBase(u)?i(l.value,u.value):o(i,l.formatUnits(),u.formatUnits());if(c==="boolean")return n(l,u);if(c==="string")return Il(l,u);if(c==="Object")return s(i,l,u);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(l,u,c){return ja(u)&&ja(c)?o(l,u.toJSON().values,c.toJSON().values):ja(u)?a(l,u.toArray(),c):ja(c)?a(l,u,c.toArray()):hl(u)?a(l,u.toJSON().data,c):hl(c)?a(l,u,c.toJSON().data):Array.isArray(u)?Array.isArray(c)?o(l,u,c):a(l,u,[c]):a(l,[u],c)}function o(l,u,c){for(var d=0,f=Math.min(u.length,c.length);d<f;d++){var p=l(u[d],c[d]);if(p!==0)return p}return u.length>c.length?1:u.length<c.length?-1:0}function s(l,u,c){var d=Object.keys(u),f=Object.keys(c);d.sort(Il),f.sort(Il);var p=o(l,d,f);if(p!==0)return p;for(var m=0;m<d.length;m++){var v=l(u[d[m]],c[f[m]]);if(v!==0)return v}return 0}});function kie(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 i3="compareText",Pie=["typed","matrix","concat"];Kx.signature="any, any";var Jh=Q(i3,Pie,e=>{var{typed:t,matrix:r,concat:n}=e,i=vr({typed:t,matrix:r,concat:n});return t(i3,Kx,i({elop:Kx,Ds:!0}))}),em="equal",Fie=["typed","matrix","equalScalar","DenseMatrix","concat"],tm=Q(em,Fie,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:r,concat:a});return t(em,$ie({typed:t,equalScalar:n}),u({elop:n,SS:s,DS:o,Ss:l}))}),$ie=Q(em,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(em,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:r(i,a)}})}),a3="equalText",Bie=["typed","compareText","isZero"],rm=Q(a3,Bie,e=>{var{typed:t,compareText:r,isZero:n}=e;return t(a3,{"any, any":function(a,o){return n(r(a,o))}})}),nm="smaller",zie=["typed","config","matrix","DenseMatrix","concat"],im=Q(nm,zie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(nm,Lie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d<f,"BigNumber, BigNumber":function(f,p){return f.lt(p)&&!xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)===-1,"Complex, Complex":function(f,p){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),Lie=Q(nm,["typed","config"],e=>{var{typed:t,config:r}=e;return t(nm,{"number, number":function(i,a){return i<a&&!ni(i,a,r.epsilon)}})}),am="smallerEq",Vie=["typed","config","matrix","DenseMatrix","concat"],om=Q(am,Vie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(am,qie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d<=f,"BigNumber, BigNumber":function(f,p){return f.lte(p)||xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),qie=Q(am,["typed","config"],e=>{var{typed:t,config:r}=e;return t(am,{"number, number":function(i,a){return i<=a||ni(i,a,r.epsilon)}})}),sm="larger",Gie=["typed","config","matrix","DenseMatrix","concat"],lm=Q(sm,Gie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(sm,Uie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d>f,"BigNumber, BigNumber":function(f,p){return f.gt(p)&&!xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),Uie=Q(sm,["typed","config"],e=>{var{typed:t,config:r}=e;return t(sm,{"number, number":function(i,a){return i>a&&!ni(i,a,r.epsilon)}})}),um="largerEq",Wie=["typed","config","matrix","DenseMatrix","concat"],cm=Q(um,Wie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(um,Hie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d>=f,"BigNumber, BigNumber":function(f,p){return f.gte(p)||xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),Hie=Q(um,["typed","config"],e=>{var{typed:t,config:r}=e;return t(um,{"number, number":function(i,a){return i>=a||ni(i,a,r.epsilon)}})}),o3="deepEqual",jie=["typed","equal"],dm=Q(o3,jie,e=>{var{typed:t,equal:r}=e;return t(o3,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;s++)if(!n(i[s],a[s]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:r(i,a)}}),fm="unequal",Kie=["typed","config","equalScalar","matrix","DenseMatrix","concat"],pm=Q(fm,Kie,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=e,s=Vn({typed:t}),l=Ca({typed:t,DenseMatrix:a}),u=sn({typed:t,DenseMatrix:a}),c=vr({typed:t,matrix:i,concat:o});return t(fm,Yie({typed:t,equalScalar:n}),c({elop:d,SS:l,DS:s,Ss:u}));function d(f,p){return!n(f,p)}}),Yie=Q(fm,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(fm,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!r(i,a)}})}),s3="partitionSelect",Xie=["typed","isNumeric","isNaN","compare"],hm=Q(s3,Xie,e=>{var{typed:t,isNumeric:r,isNaN:n,compare:i}=e,a=i,o=(u,c)=>-i(u,c);return t(s3,{"Array | Matrix, number":function(c,d){return s(c,d,a)},"Array | Matrix, number, string":function(c,d,f){if(f==="asc")return s(c,d,a);if(f==="desc")return s(c,d,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(u,c,d){if(!ot(c)||c<0)throw new Error("k must be a non-negative integer");if(ft(u)){var f=u.size();if(f.length>1)throw new Error("Only one dimensional matrices supported");return l(u.valueOf(),c,d)}if(Array.isArray(u))return l(u,c,d)}function l(u,c,d){if(c>=u.length)throw new Error("k out of bounds");for(var f=0;f<u.length;f++)if(r(u[f])&&n(u[f]))return u[f];for(var p=0,m=u.length-1;p<m;){for(var v=p,y=m,b=u[Math.floor(Math.random()*(m-p+1))+p];v<y;)if(d(u[v],b)>=0){var D=u[y];u[y]=u[v],u[v]=D,--y}else++v;d(u[v],b)>0&&--v,c<=v?m=v:p=v+1}return u[c]}}),l3="sort",Zie=["typed","matrix","compare","compareNatural"],mm=Q(l3,Zie,e=>{var{typed:t,matrix:r,compare:n,compareNatural:i}=e,a=n,o=(c,d)=>-n(c,d);return t(l3,{Array:function(d){return l(d),d.sort(a)},Matrix:function(d){return u(d),r(d.toArray().sort(a),d.storage())},"Array, function":function(d,f){return l(d),d.sort(f)},"Matrix, function":function(d,f){return u(d),r(d.toArray().sort(f),d.storage())},"Array, string":function(d,f){return l(d),d.sort(s(f))},"Matrix, string":function(d,f){return u(d),r(d.toArray().sort(s(f)),d.storage())}});function s(c){if(c==="asc")return a;if(c==="desc")return o;if(c==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function l(c){if(qt(c).length!==1)throw new Error("One dimensional array expected")}function u(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}}),u3="max",Qie=["typed","config","numeric","larger"],lc=Q(u3,Qie,e=>{var{typed:t,config:r,numeric:n,larger:i}=e;return t(u3,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Vf(l,u.valueOf(),a)},"...":function(l){if(Al(l))throw new TypeError("Scalar values expected in function max");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw qn(u,"max",l)}}function o(s){var l;if(Qa(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw qn(c,"max",u)}}),l===void 0)throw new Error("Cannot calculate max of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}}),c3="min",Jie=["typed","config","numeric","smaller"],uc=Q(c3,Jie,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e;return t(c3,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Vf(l,u.valueOf(),a)},"...":function(l){if(Al(l))throw new TypeError("Scalar values expected in function min");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw qn(u,"min",l)}}function o(s){var l;if(Qa(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw qn(c,"min",u)}}),l===void 0)throw new Error("Cannot calculate min of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}}),eae="ImmutableDenseMatrix",tae=["smaller","DenseMatrix"],vm=Q(eae,tae,e=>{var{smaller:t,DenseMatrix:r}=e;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!bn(a))throw new Error("Invalid datatype: "+a);if(ft(i)||or(i)){var o=new r(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&or(i.data)&&or(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+Or(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=r.prototype.subset.call(this,i);return ft(a)?new n({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:pt(this._data),size:pt(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(i){return new n(i)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||t(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||t(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},n},{isClass:!0}),rae="Index",nae=["ImmutableDenseMatrix"],gm=Q(rae,nae,e=>{var{ImmutableDenseMatrix:t}=e;function r(i){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var a=0,o=arguments.length;a<o;a++){var s=arguments[a];if(Uu(s))this._dimensions.push(s),this._isScalar=!1;else if(Array.isArray(s)||ft(s)){var l=n(s.valueOf());this._dimensions.push(l);var u=l.size();(u.length!==1||u[0]!==1)&&(this._isScalar=!1)}else if(typeof s=="number")this._dimensions.push(n([s]));else if(typeof s=="string")this._dimensions.push(s);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range")}}r.prototype.type="Index",r.prototype.isIndex=!0;function n(i){for(var a=0,o=i.length;a<o;a++)if(typeof i[a]!="number"||!ot(i[a]))throw new TypeError("Index parameters must be positive integer numbers");return new t(i)}return r.prototype.clone=function(){var i=new r;return i._dimensions=pt(this._dimensions),i._isScalar=this._isScalar,i},r.create=function(i){var a=new r;return r.apply(a,i),a},r.prototype.size=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i[a]=typeof s=="string"?1:s.size()[0]}return i},r.prototype.max=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i[a]=typeof s=="string"?s:s.max()}return i},r.prototype.min=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i[a]=typeof s=="string"?s:s.min()}return i},r.prototype.forEach=function(i){for(var a=0,o=this._dimensions.length;a<o;a++)i(this._dimensions[a],a,this)},r.prototype.dimension=function(i){return this._dimensions[i]||null},r.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i.push(typeof s=="string"?s:s.toArray())}return i},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];typeof s=="string"?i.push(JSON.stringify(s)):i.push(s.toString())}return"["+i.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(i){return r.create(i.dimensions)},r},{isClass:!0}),iae="FibonacciHeap",aae=["smaller","larger"],ym=Q(iae,aae,e=>{var{smaller:t,larger:r}=e,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,d){var f={key:c,value:d,degree:0};if(this._minimum){var p=this._minimum;f.left=p,f.right=p.right,p.right=f,f.right.left=f,t(c,p.key)&&(this._minimum=f)}else f.left=f,f.right=f,this._minimum=f;return this._size++,f},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var c=this._minimum;if(c===null)return c;for(var d=this._minimum,f=c.degree,p=c.child;f>0;){var m=p.right;p.left.right=p.right,p.right.left=p.left,p.left=d,p.right=d.right,d.right=p,p.right.left=p,p.parent=null,p=m,f--}return c.left.right=c.right,c.right.left=c.left,c===c.right?d=null:(d=c.right,d=u(d,this._size)),this._size--,this._minimum=d,c},i.prototype.remove=function(c){this._minimum=a(this._minimum,c,-1),this.extractMinimum()};function a(c,d,f){d.key=f;var p=d.parent;return p&&t(d.key,p.key)&&(o(c,d,p),s(c,p)),t(d.key,c.key)&&(c=d),c}function o(c,d,f){d.left.right=d.right,d.right.left=d.left,f.degree--,f.child===d&&(f.child=d.right),f.degree===0&&(f.child=null),d.left=c,d.right=c.right,c.right=d,d.right.left=d,d.parent=null,d.mark=!1}function s(c,d){var f=d.parent;!f||(d.mark?(o(c,d,f),s(f)):d.mark=!0)}var l=function(d,f){d.left.right=d.right,d.right.left=d.left,d.parent=f,f.child?(d.left=f.child,d.right=f.child.right,f.child.right=d,d.right.left=d):(f.child=d,d.right=d,d.left=d),f.degree++,d.mark=!1};function u(c,d){var f=Math.floor(Math.log(d)*n)+1,p=new Array(f),m=0,v=c;if(v)for(m++,v=v.right;v!==c;)m++,v=v.right;for(var y;m>0;){for(var b=v.degree,D=v.right;y=p[b],!!y;){if(r(v.key,y.key)){var x=y;y=v,v=x}l(y,v),p[b]=null,b++}p[b]=v,v=D,m--}c=null;for(var S=0;S<f;S++)y=p[S],y&&(c?(y.left.right=y.right,y.right.left=y.left,y.left=c,y.right=c.right,c.right=y,y.right.left=y,t(y.key,c.key)&&(c=y)):c=y);return c}return i},{isClass:!0}),oae="Spa",sae=["addScalar","equalScalar","FibonacciHeap"],bm=Q(oae,sae,e=>{var{addScalar:t,equalScalar:r,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var s=this._heap.insert(a,o);this._values[a]=s}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var s=this._values[a];s?s.value=t(s.value,o):(s=this._heap.insert(a,o),this._values[a]=s)},i.prototype.forEach=function(a,o,s){var l=this._heap,u=this._values,c=[],d=l.extractMinimum();for(d&&c.push(d);d&&d.key<=o;)d.key>=a&&(r(d.value,0)||s(d.key,d.value,this)),d=l.extractMinimum(),d&&c.push(d);for(var f=0;f<c.length;f++){var p=c[f];d=l.insert(p.key,p.value),u[d.key]=d}},i.prototype.swap=function(a,o){var s=this._values[a],l=this._values[o];if(!s&&l)s=this._heap.insert(a,l.value),this._heap.remove(l),this._values[a]=s,this._values[o]=void 0;else if(s&&!l)l=this._heap.insert(o,s.value),this._heap.remove(s),this._values[o]=l,this._values[a]=void 0;else if(s&&l){var u=s.value;s.value=l.value,l.value=u}},i},{isClass:!0});function cc(e){return cc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cc(e)}function lae(e,t){if(cc(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(cc(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uae(e){var t=lae(e,"string");return cc(t)==="symbol"?t:String(t)}function pn(e,t,r){return t=uae(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cae=Zu(function(e){return new e(1).exp()},{hasher:xm}),dae=Zu(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:xm}),xw=Zu(function(e){return e.acos(-1)},{hasher:xm}),fae=Zu(function(e){return xw(e).times(2)},{hasher:xm});function xm(e){return e[0].precision}function d3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ww(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?d3(Object(r),!0).forEach(function(n){pn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var pae="Unit",hae=["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],wm=Q(pae,hae,e=>{var{on:t,config:r,addScalar:n,subtract:i,multiplyScalar:a,divideScalar:o,pow:s,abs:l,fix:u,round:c,equal:d,isNumeric:f,format:p,number:m,Complex:v,BigNumber:y,Fraction:b}=e,D=m;function x(q,J){if(!(this instanceof x))throw new Error("Constructor must be called with the new operator");if(!(q==null||f(q)||yi(q)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,J===void 0)this.units=[],this.dimensions=L.map(X=>0);else if(typeof J=="string"){var ce=x.parse(J);this.units=ce.units,this.dimensions=ce.dimensions}else if(bi(J)&&J.value===null)this.fixPrefix=J.fixPrefix,this.skipAutomaticSimplification=J.skipAutomaticSimplification,this.dimensions=J.dimensions.slice(0),this.units=J.units.map(X=>fn({},X));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(q)}Object.defineProperty(x,"name",{value:"Unit"}),x.prototype.constructor=x,x.prototype.type="Unit",x.prototype.isUnit=!0;var S,w,C;function E(){for(;C===" "||C===" ";)N()}function A(q){return q>="0"&&q<="9"||q==="."}function _(q){return q>="0"&&q<="9"}function N(){w++,C=S.charAt(w)}function M(q){w=q,C=S.charAt(w)}function R(){var q="",J=w;if(C==="+"?N():C==="-"&&(q+=C,N()),!A(C))return M(J),null;if(C==="."){if(q+=C,N(),!_(C))return M(J),null}else{for(;_(C);)q+=C,N();C==="."&&(q+=C,N())}for(;_(C);)q+=C,N();if(C==="E"||C==="e"){var ce="",X=w;if(ce+=C,N(),(C==="+"||C==="-")&&(ce+=C,N()),!_(C))return M(X),q;for(q=q+ce;_(C);)q+=C,N()}return q}function F(){for(var q="";_(C)||x.isValidAlpha(C);)q+=C,N();var J=q.charAt(0);return x.isValidAlpha(J)?q:null}function k(q){return C===q?(N(),q):null}x.parse=function(q,J){if(J=J||{},S=q,w=-1,C="",typeof S!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var ce=new x;ce.units=[];var X=1,te=!1;N(),E();var ae=R(),De=null;if(ae){if(r.number==="BigNumber")De=new y(ae);else if(r.number==="Fraction")try{De=new b(ae)}catch{De=parseFloat(ae)}else De=parseFloat(ae);E(),k("*")?(X=1,te=!0):k("/")&&(X=-1,te=!0)}for(var be=[],K=1;;){for(E();C==="(";)be.push(X),K*=X,X=1,N(),E();var W=void 0;if(C){var ue=C;if(W=F(),W===null)throw new SyntaxError('Unexpected "'+ue+'" in "'+S+'" at index '+w.toString())}else break;var me=P(W);if(me===null)throw new SyntaxError('Unit "'+W+'" not found.');var we=X*K;if(E(),k("^")){E();var _e=R();if(_e===null)throw new SyntaxError('In "'+q+'", "^" must be followed by a floating-point number');we*=_e}ce.units.push({unit:me.unit,prefix:me.prefix,power:we});for(var Ae=0;Ae<L.length;Ae++)ce.dimensions[Ae]+=(me.unit.dimensions[Ae]||0)*we;for(E();C===")";){if(be.length===0)throw new SyntaxError('Unmatched ")" in "'+S+'" at index '+w.toString());K/=be.pop(),N(),E()}if(te=!1,k("*")?(X=1,te=!0):k("/")?(X=-1,te=!0):X=1,me.unit.base){var Ce=me.unit.base.key;ne.auto[Ce]={unit:me.unit,prefix:me.prefix}}}if(E(),C)throw new SyntaxError('Could not parse: "'+q+'"');if(te)throw new SyntaxError('Trailing characters: "'+q+'"');if(be.length!==0)throw new SyntaxError('Unmatched "(" in "'+S+'"');if(ce.units.length===0&&!J.allowNoUnits)throw new SyntaxError('"'+q+'" contains no units');return ce.value=De!==void 0?ce._normalize(De):null,ce},x.prototype.clone=function(){var q=new x;q.fixPrefix=this.fixPrefix,q.skipAutomaticSimplification=this.skipAutomaticSimplification,q.value=pt(this.value),q.dimensions=this.dimensions.slice(0),q.units=[];for(var J=0;J<this.units.length;J++){q.units[J]={};for(var ce in this.units[J])et(this.units[J],ce)&&(q.units[J][ce]=this.units[J][ce])}return q},x.prototype.valueType=function(){return Or(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(q){if(q==null||this.units.length===0)return q;for(var J=q,ce=x._getNumberConverter(Or(q)),X=0;X<this.units.length;X++){var te=ce(this.units[X].unit.value),ae=ce(this.units[X].prefix.value),De=ce(this.units[X].power);J=a(J,s(a(te,ae),De))}return J},x.prototype._denormalize=function(q,J){if(q==null||this.units.length===0)return q;for(var ce=q,X=x._getNumberConverter(Or(q)),te=0;te<this.units.length;te++){var ae=X(this.units[te].unit.value),De=X(this.units[te].prefix.value),be=X(this.units[te].power);ce=o(ce,s(a(ae,De),be))}return ce};var P=Zu(q=>{if(et(G,q)){var J=G[q],ce=J.prefixes[""];return{unit:J,prefix:ce}}for(var X in G)if(et(G,X)&&PJ(q,X)){var te=G[X],ae=q.length-X.length,De=q.substring(0,ae),be=et(te.prefixes,De)?te.prefixes[De]:void 0;if(be!==void 0)return{unit:te,prefix:be}}return null},{hasher:q=>q[0],limit:100});x.isValuelessUnit=function(q){return P(q)!==null},x.prototype.hasBase=function(q){if(typeof q=="string"&&(q=I[q]),!q)return!1;for(var J=0;J<L.length;J++)if(Math.abs((this.dimensions[J]||0)-(q.dimensions[J]||0))>1e-12)return!1;return!0},x.prototype.equalBase=function(q){for(var J=0;J<L.length;J++)if(Math.abs((this.dimensions[J]||0)-(q.dimensions[J]||0))>1e-12)return!1;return!0},x.prototype.equals=function(q){return this.equalBase(q)&&d(this.value,q.value)},x.prototype.multiply=function(q){for(var J=this.clone(),ce=bi(q)?q:new x(q),X=0;X<L.length;X++)J.dimensions[X]=(this.dimensions[X]||0)+(ce.dimensions[X]||0);for(var te=0;te<ce.units.length;te++){var ae=ww({},ce.units[te]);J.units.push(ae)}if(this.value!==null||ce.value!==null){var De=this.value===null?this._normalize(1):this.value,be=ce.value===null?ce._normalize(1):ce.value;J.value=a(De,be)}else J.value=null;return bi(q)&&(J.skipAutomaticSimplification=!1),T(J)},x.prototype.divideInto=function(q){return new x(q).divide(this)},x.prototype.divide=function(q){for(var J=this.clone(),ce=bi(q)?q:new x(q),X=0;X<L.length;X++)J.dimensions[X]=(this.dimensions[X]||0)-(ce.dimensions[X]||0);for(var te=0;te<ce.units.length;te++){var ae=ww(ww({},ce.units[te]),{},{power:-ce.units[te].power});J.units.push(ae)}if(this.value!==null||ce.value!==null){var De=this.value===null?this._normalize(1):this.value,be=ce.value===null?ce._normalize(1):ce.value;J.value=o(De,be)}else J.value=null;return bi(q)&&(J.skipAutomaticSimplification=!1),T(J)},x.prototype.pow=function(q){for(var J=this.clone(),ce=0;ce<L.length;ce++)J.dimensions[ce]=(this.dimensions[ce]||0)*q;for(var X=0;X<J.units.length;X++)J.units[X].power*=q;return J.value!==null?J.value=s(J.value,q):J.value=null,J.skipAutomaticSimplification=!1,T(J)};function T(q){return q.equalBase(I.NONE)&&q.value!==null&&!r.predictable?q.value:q}x.prototype.abs=function(){var q=this.clone();if(q.value!==null)if(q._isDerived()||q.units[0].unit.offset===0)q.value=l(q.value);else{var J=q._numberConverter(),ce=J(q.units[0].unit.value),X=J(q.units[0].unit.offset),te=a(ce,X);q.value=i(l(n(q.value,te)),te)}for(var ae in q.units)(q.units[ae].unit.name==="VA"||q.units[ae].unit.name==="VAR")&&(q.units[ae].unit=G.W);return q},x.prototype.to=function(q){var J=this.value===null?this._normalize(1):this.value,ce;if(typeof q=="string")ce=x.parse(q);else if(bi(q))ce=q.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(ce))throw new Error("Units do not match ('".concat(ce.toString(),"' != '").concat(this.toString(),"')"));if(ce.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units[0].unit.offset===ce.units[0].unit.offset)ce.value=pt(J);else{var X=x._getNumberConverter(Or(J)),te=X(this.units[0].unit.value),ae=X(this.units[0].unit.offset),De=a(te,ae),be=X(ce.units[0].unit.value),K=X(ce.units[0].unit.offset),W=a(be,K);ce.value=i(n(J,De),W)}return ce.fixPrefix=!0,ce.skipAutomaticSimplification=!0,ce},x.prototype.toNumber=function(q){return D(this.toNumeric(q))},x.prototype.toNumeric=function(q){var J;return q?J=this.to(q):J=this.clone(),J._isDerived()||J.units.length===0?J._denormalize(J.value):J._denormalize(J.value,J.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.formatUnits(),fixPrefix:this.fixPrefix}},x.fromJSON=function(q){var J=new x(q.value,q.unit);return J.fixPrefix=q.fixPrefix||!1,J},x.prototype.valueOf=x.prototype.toString,x.prototype.simplify=function(){var q=this.clone(),J=[],ce;for(var X in pe)if(et(pe,X)&&q.hasBase(I[X])){ce=X;break}if(ce==="NONE")q.units=[];else{var te;if(ce&&et(pe,ce)&&(te=pe[ce]),te)q.units=[{unit:te.unit,prefix:te.prefix,power:1}];else{for(var ae=!1,De=0;De<L.length;De++){var be=L[De];Math.abs(q.dimensions[De]||0)>1e-12&&(et(pe,be)?J.push({unit:pe[be].unit,prefix:pe[be].prefix,power:q.dimensions[De]||0}):ae=!0)}J.length<q.units.length&&!ae&&(q.units=J)}}return q},x.prototype.toSI=function(){for(var q=this.clone(),J=[],ce=0;ce<L.length;ce++){var X=L[ce];if(Math.abs(q.dimensions[ce]||0)>1e-12)if(et(ne.si,X))J.push({unit:ne.si[X].unit,prefix:ne.si[X].prefix,power:q.dimensions[ce]||0});else throw new Error("Cannot express custom unit "+X+" in SI units")}return q.units=J,q.fixPrefix=!0,q.skipAutomaticSimplification=!0,q},x.prototype.formatUnits=function(){for(var q="",J="",ce=0,X=0,te=0;te<this.units.length;te++)this.units[te].power>0?(ce++,q+=" "+this.units[te].prefix.name+this.units[te].unit.name,Math.abs(this.units[te].power-1)>1e-15&&(q+="^"+this.units[te].power)):this.units[te].power<0&&X++;if(X>0)for(var ae=0;ae<this.units.length;ae++)this.units[ae].power<0&&(ce>0?(J+=" "+this.units[ae].prefix.name+this.units[ae].unit.name,Math.abs(this.units[ae].power+1)>1e-15&&(J+="^"+-this.units[ae].power)):(J+=" "+this.units[ae].prefix.name+this.units[ae].unit.name,J+="^"+this.units[ae].power));q=q.substr(1),J=J.substr(1),ce>1&&X>0&&(q="("+q+")"),X>1&&ce>0&&(J="("+J+")");var De=q;return ce>0&&X>0&&(De+=" / "),De+=J,De},x.prototype.format=function(q){var J=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),ce=!1;typeof J.value<"u"&&J.value!==null&&yi(J.value)&&(ce=Math.abs(J.value.re)<1e-14);for(var X in J.units)et(J.units,X)&&J.units[X].unit&&(J.units[X].unit.name==="VA"&&ce?J.units[X].unit=G.VAR:J.units[X].unit.name==="VAR"&&!ce&&(J.units[X].unit=G.VA));J.units.length===1&&!J.fixPrefix&&Math.abs(J.units[0].power-Math.round(J.units[0].power))<1e-14&&(J.units[0].prefix=J._bestPrefix());var te=J._denormalize(J.value),ae=J.value!==null?p(te,q||{}):"",De=J.formatUnits();return J.value&&yi(J.value)&&(ae="("+ae+")"),De.length>0&&ae.length>0&&(ae+=" "),ae+=De,ae},x.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var q=this.value!==null?l(this.value):0,J=l(this.units[0].unit.value),ce=this.units[0].prefix;if(q===0)return ce;var X=this.units[0].power,te=Math.log(q/Math.pow(ce.value*J,X))/Math.LN10-1.2;if(te>-2.200001&&te<1.800001)return ce;te=Math.abs(te);var ae=this.units[0].unit.prefixes;for(var De in ae)if(et(ae,De)){var be=ae[De];if(be.scientific){var K=Math.abs(Math.log(q/Math.pow(be.value*J,X))/Math.LN10-1.2);(K<te||K===te&&be.name.length<ce.name.length)&&(ce=be,te=K)}}return ce},x.prototype.splitUnit=function(q){for(var J=this.clone(),ce=[],X=0;X<q.length&&(J=J.to(q[X]),X!==q.length-1);X++){var te=J.toNumeric(),ae=c(te),De=void 0,be=d(ae,te);be?De=ae:De=u(J.toNumeric());var K=new x(De,q[X].toString());ce.push(K),J=i(J,K)}for(var W=0,ue=0;ue<ce.length;ue++)W=n(W,ce[ue].value);return d(W,this.value)&&(J.value=0),ce.push(J),ce};var O={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};O.SHORTLONG=fn({},O.SHORT,O.LONG),O.BINARY_SHORT=fn({},O.BINARY_SHORT_SI,O.BINARY_SHORT_IEC),O.BINARY_LONG=fn({},O.BINARY_LONG_SI,O.BINARY_LONG_IEC);var L=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],I={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 V in I)et(I,V)&&(I[V].key=V);var H={},Z={name:"",base:H,value:1,offset:0,dimensions:L.map(q=>0)},G={meter:{name:"meter",base:I.LENGTH,prefixes:O.LONG,value:1,offset:0},inch:{name:"inch",base:I.LENGTH,prefixes:O.NONE,value:.0254,offset:0},foot:{name:"foot",base:I.LENGTH,prefixes:O.NONE,value:.3048,offset:0},yard:{name:"yard",base:I.LENGTH,prefixes:O.NONE,value:.9144,offset:0},mile:{name:"mile",base:I.LENGTH,prefixes:O.NONE,value:1609.344,offset:0},link:{name:"link",base:I.LENGTH,prefixes:O.NONE,value:.201168,offset:0},rod:{name:"rod",base:I.LENGTH,prefixes:O.NONE,value:5.0292,offset:0},chain:{name:"chain",base:I.LENGTH,prefixes:O.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:I.LENGTH,prefixes:O.NONE,value:1e-10,offset:0},m:{name:"m",base:I.LENGTH,prefixes:O.SHORT,value:1,offset:0},in:{name:"in",base:I.LENGTH,prefixes:O.NONE,value:.0254,offset:0},ft:{name:"ft",base:I.LENGTH,prefixes:O.NONE,value:.3048,offset:0},yd:{name:"yd",base:I.LENGTH,prefixes:O.NONE,value:.9144,offset:0},mi:{name:"mi",base:I.LENGTH,prefixes:O.NONE,value:1609.344,offset:0},li:{name:"li",base:I.LENGTH,prefixes:O.NONE,value:.201168,offset:0},rd:{name:"rd",base:I.LENGTH,prefixes:O.NONE,value:5.02921,offset:0},ch:{name:"ch",base:I.LENGTH,prefixes:O.NONE,value:20.1168,offset:0},mil:{name:"mil",base:I.LENGTH,prefixes:O.NONE,value:254e-7,offset:0},m2:{name:"m2",base:I.SURFACE,prefixes:O.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:I.SURFACE,prefixes:O.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:I.SURFACE,prefixes:O.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:I.SURFACE,prefixes:O.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:I.SURFACE,prefixes:O.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:I.SURFACE,prefixes:O.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:I.SURFACE,prefixes:O.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:I.SURFACE,prefixes:O.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:I.SURFACE,prefixes:O.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:I.SURFACE,prefixes:O.NONE,value:1e4,offset:0},m3:{name:"m3",base:I.VOLUME,prefixes:O.CUBIC,value:1,offset:0},L:{name:"L",base:I.VOLUME,prefixes:O.SHORT,value:.001,offset:0},l:{name:"l",base:I.VOLUME,prefixes:O.SHORT,value:.001,offset:0},litre:{name:"litre",base:I.VOLUME,prefixes:O.LONG,value:.001,offset:0},cuin:{name:"cuin",base:I.VOLUME,prefixes:O.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:I.VOLUME,prefixes:O.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:I.VOLUME,prefixes:O.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:I.VOLUME,prefixes:O.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:I.VOLUME,prefixes:O.NONE,value:15e-6,offset:0},drop:{name:"drop",base:I.VOLUME,prefixes:O.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:I.VOLUME,prefixes:O.NONE,value:5e-8,offset:0},minim:{name:"minim",base:I.VOLUME,prefixes:O.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:I.VOLUME,prefixes:O.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:I.VOLUME,prefixes:O.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:I.VOLUME,prefixes:O.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:I.VOLUME,prefixes:O.NONE,value:1e-6,offset:0},cup:{name:"cup",base:I.VOLUME,prefixes:O.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:I.VOLUME,prefixes:O.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:I.VOLUME,prefixes:O.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:I.VOLUME,prefixes:O.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:I.VOLUME,prefixes:O.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:I.VOLUME,prefixes:O.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:I.VOLUME,prefixes:O.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:I.VOLUME,prefixes:O.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:I.VOLUME,prefixes:O.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:I.VOLUME,prefixes:O.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:I.VOLUME,prefixes:O.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:I.VOLUME,prefixes:O.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:I.VOLUME,prefixes:O.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:I.VOLUME,prefixes:O.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:I.VOLUME,prefixes:O.NONE,value:.1173478,offset:0},obl:{name:"obl",base:I.VOLUME,prefixes:O.NONE,value:.1589873,offset:0},g:{name:"g",base:I.MASS,prefixes:O.SHORT,value:.001,offset:0},gram:{name:"gram",base:I.MASS,prefixes:O.LONG,value:.001,offset:0},ton:{name:"ton",base:I.MASS,prefixes:O.SHORT,value:907.18474,offset:0},t:{name:"t",base:I.MASS,prefixes:O.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:I.MASS,prefixes:O.LONG,value:1e3,offset:0},grain:{name:"grain",base:I.MASS,prefixes:O.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:I.MASS,prefixes:O.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:I.MASS,prefixes:O.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:I.MASS,prefixes:O.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:I.MASS,prefixes:O.NONE,value:45.359237,offset:0},stick:{name:"stick",base:I.MASS,prefixes:O.NONE,value:.115,offset:0},stone:{name:"stone",base:I.MASS,prefixes:O.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:I.MASS,prefixes:O.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:I.MASS,prefixes:O.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:I.MASS,prefixes:O.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:I.MASS,prefixes:O.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:I.MASS,prefixes:O.NONE,value:45.359237,offset:0},s:{name:"s",base:I.TIME,prefixes:O.SHORT,value:1,offset:0},min:{name:"min",base:I.TIME,prefixes:O.NONE,value:60,offset:0},h:{name:"h",base:I.TIME,prefixes:O.NONE,value:3600,offset:0},second:{name:"second",base:I.TIME,prefixes:O.LONG,value:1,offset:0},sec:{name:"sec",base:I.TIME,prefixes:O.LONG,value:1,offset:0},minute:{name:"minute",base:I.TIME,prefixes:O.NONE,value:60,offset:0},hour:{name:"hour",base:I.TIME,prefixes:O.NONE,value:3600,offset:0},day:{name:"day",base:I.TIME,prefixes:O.NONE,value:86400,offset:0},week:{name:"week",base:I.TIME,prefixes:O.NONE,value:7*86400,offset:0},month:{name:"month",base:I.TIME,prefixes:O.NONE,value:2629800,offset:0},year:{name:"year",base:I.TIME,prefixes:O.NONE,value:31557600,offset:0},decade:{name:"decade",base:I.TIME,prefixes:O.NONE,value:315576e3,offset:0},century:{name:"century",base:I.TIME,prefixes:O.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:I.TIME,prefixes:O.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:I.FREQUENCY,prefixes:O.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:I.FREQUENCY,prefixes:O.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:I.ANGLE,prefixes:O.SHORT,value:1,offset:0},radian:{name:"radian",base:I.ANGLE,prefixes:O.LONG,value:1,offset:0},deg:{name:"deg",base:I.ANGLE,prefixes:O.SHORT,value:null,offset:0},degree:{name:"degree",base:I.ANGLE,prefixes:O.LONG,value:null,offset:0},grad:{name:"grad",base:I.ANGLE,prefixes:O.SHORT,value:null,offset:0},gradian:{name:"gradian",base:I.ANGLE,prefixes:O.LONG,value:null,offset:0},cycle:{name:"cycle",base:I.ANGLE,prefixes:O.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:I.ANGLE,prefixes:O.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:I.ANGLE,prefixes:O.NONE,value:null,offset:0},A:{name:"A",base:I.CURRENT,prefixes:O.SHORT,value:1,offset:0},ampere:{name:"ampere",base:I.CURRENT,prefixes:O.LONG,value:1,offset:0},K:{name:"K",base:I.TEMPERATURE,prefixes:O.SHORT,value:1,offset:0},degC:{name:"degC",base:I.TEMPERATURE,prefixes:O.SHORT,value:1,offset:273.15},degF:{name:"degF",base:I.TEMPERATURE,prefixes:O.SHORT,value:1/1.8,offset:459.67},degR:{name:"degR",base:I.TEMPERATURE,prefixes:O.SHORT,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:I.TEMPERATURE,prefixes:O.LONG,value:1,offset:0},celsius:{name:"celsius",base:I.TEMPERATURE,prefixes:O.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:I.TEMPERATURE,prefixes:O.LONG,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:I.TEMPERATURE,prefixes:O.LONG,value:1/1.8,offset:0},mol:{name:"mol",base:I.AMOUNT_OF_SUBSTANCE,prefixes:O.SHORT,value:1,offset:0},mole:{name:"mole",base:I.AMOUNT_OF_SUBSTANCE,prefixes:O.LONG,value:1,offset:0},cd:{name:"cd",base:I.LUMINOUS_INTENSITY,prefixes:O.SHORT,value:1,offset:0},candela:{name:"candela",base:I.LUMINOUS_INTENSITY,prefixes:O.LONG,value:1,offset:0},N:{name:"N",base:I.FORCE,prefixes:O.SHORT,value:1,offset:0},newton:{name:"newton",base:I.FORCE,prefixes:O.LONG,value:1,offset:0},dyn:{name:"dyn",base:I.FORCE,prefixes:O.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:I.FORCE,prefixes:O.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:I.FORCE,prefixes:O.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:I.FORCE,prefixes:O.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:I.FORCE,prefixes:O.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:I.FORCE,prefixes:O.NONE,value:9.80665,offset:0},J:{name:"J",base:I.ENERGY,prefixes:O.SHORT,value:1,offset:0},joule:{name:"joule",base:I.ENERGY,prefixes:O.SHORT,value:1,offset:0},erg:{name:"erg",base:I.ENERGY,prefixes:O.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:I.ENERGY,prefixes:O.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:I.ENERGY,prefixes:O.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:I.ENERGY,prefixes:O.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:I.ENERGY,prefixes:O.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:I.POWER,prefixes:O.SHORT,value:1,offset:0},watt:{name:"watt",base:I.POWER,prefixes:O.LONG,value:1,offset:0},hp:{name:"hp",base:I.POWER,prefixes:O.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:I.POWER,prefixes:O.SHORT,value:v.I,offset:0},VA:{name:"VA",base:I.POWER,prefixes:O.SHORT,value:1,offset:0},Pa:{name:"Pa",base:I.PRESSURE,prefixes:O.SHORT,value:1,offset:0},psi:{name:"psi",base:I.PRESSURE,prefixes:O.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:I.PRESSURE,prefixes:O.NONE,value:101325,offset:0},bar:{name:"bar",base:I.PRESSURE,prefixes:O.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:I.PRESSURE,prefixes:O.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:I.PRESSURE,prefixes:O.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:I.PRESSURE,prefixes:O.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:I.PRESSURE,prefixes:O.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:I.ELECTRIC_CHARGE,prefixes:O.LONG,value:1,offset:0},C:{name:"C",base:I.ELECTRIC_CHARGE,prefixes:O.SHORT,value:1,offset:0},farad:{name:"farad",base:I.ELECTRIC_CAPACITANCE,prefixes:O.LONG,value:1,offset:0},F:{name:"F",base:I.ELECTRIC_CAPACITANCE,prefixes:O.SHORT,value:1,offset:0},volt:{name:"volt",base:I.ELECTRIC_POTENTIAL,prefixes:O.LONG,value:1,offset:0},V:{name:"V",base:I.ELECTRIC_POTENTIAL,prefixes:O.SHORT,value:1,offset:0},ohm:{name:"ohm",base:I.ELECTRIC_RESISTANCE,prefixes:O.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:I.ELECTRIC_INDUCTANCE,prefixes:O.LONG,value:1,offset:0},H:{name:"H",base:I.ELECTRIC_INDUCTANCE,prefixes:O.SHORT,value:1,offset:0},siemens:{name:"siemens",base:I.ELECTRIC_CONDUCTANCE,prefixes:O.LONG,value:1,offset:0},S:{name:"S",base:I.ELECTRIC_CONDUCTANCE,prefixes:O.SHORT,value:1,offset:0},weber:{name:"weber",base:I.MAGNETIC_FLUX,prefixes:O.LONG,value:1,offset:0},Wb:{name:"Wb",base:I.MAGNETIC_FLUX,prefixes:O.SHORT,value:1,offset:0},tesla:{name:"tesla",base:I.MAGNETIC_FLUX_DENSITY,prefixes:O.LONG,value:1,offset:0},T:{name:"T",base:I.MAGNETIC_FLUX_DENSITY,prefixes:O.SHORT,value:1,offset:0},b:{name:"b",base:I.BIT,prefixes:O.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:I.BIT,prefixes:O.BINARY_LONG,value:1,offset:0},B:{name:"B",base:I.BIT,prefixes:O.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:I.BIT,prefixes:O.BINARY_LONG,value:8,offset:0}},Y={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function re(q){if(q.number==="BigNumber"){var J=xw(y);G.rad.value=new y(1),G.deg.value=J.div(180),G.grad.value=J.div(200),G.cycle.value=J.times(2),G.arcsec.value=J.div(648e3),G.arcmin.value=J.div(10800)}else G.rad.value=1,G.deg.value=Math.PI/180,G.grad.value=Math.PI/200,G.cycle.value=Math.PI*2,G.arcsec.value=Math.PI/648e3,G.arcmin.value=Math.PI/10800;G.radian.value=G.rad.value,G.degree.value=G.deg.value,G.gradian.value=G.grad.value}re(r),t&&t("config",function(q,J){q.number!==J.number&&re(q)});var ne={si:{NONE:{unit:Z,prefix:O.NONE[""]},LENGTH:{unit:G.m,prefix:O.SHORT[""]},MASS:{unit:G.g,prefix:O.SHORT.k},TIME:{unit:G.s,prefix:O.SHORT[""]},CURRENT:{unit:G.A,prefix:O.SHORT[""]},TEMPERATURE:{unit:G.K,prefix:O.SHORT[""]},LUMINOUS_INTENSITY:{unit:G.cd,prefix:O.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:G.mol,prefix:O.SHORT[""]},ANGLE:{unit:G.rad,prefix:O.SHORT[""]},BIT:{unit:G.bits,prefix:O.SHORT[""]},FORCE:{unit:G.N,prefix:O.SHORT[""]},ENERGY:{unit:G.J,prefix:O.SHORT[""]},POWER:{unit:G.W,prefix:O.SHORT[""]},PRESSURE:{unit:G.Pa,prefix:O.SHORT[""]},ELECTRIC_CHARGE:{unit:G.C,prefix:O.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:G.F,prefix:O.SHORT[""]},ELECTRIC_POTENTIAL:{unit:G.V,prefix:O.SHORT[""]},ELECTRIC_RESISTANCE:{unit:G.ohm,prefix:O.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:G.H,prefix:O.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:G.S,prefix:O.SHORT[""]},MAGNETIC_FLUX:{unit:G.Wb,prefix:O.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:G.T,prefix:O.SHORT[""]},FREQUENCY:{unit:G.Hz,prefix:O.SHORT[""]}}};ne.cgs=JSON.parse(JSON.stringify(ne.si)),ne.cgs.LENGTH={unit:G.m,prefix:O.SHORT.c},ne.cgs.MASS={unit:G.g,prefix:O.SHORT[""]},ne.cgs.FORCE={unit:G.dyn,prefix:O.SHORT[""]},ne.cgs.ENERGY={unit:G.erg,prefix:O.NONE[""]},ne.us=JSON.parse(JSON.stringify(ne.si)),ne.us.LENGTH={unit:G.ft,prefix:O.NONE[""]},ne.us.MASS={unit:G.lbm,prefix:O.NONE[""]},ne.us.TEMPERATURE={unit:G.degF,prefix:O.NONE[""]},ne.us.FORCE={unit:G.lbf,prefix:O.NONE[""]},ne.us.ENERGY={unit:G.BTU,prefix:O.BTU[""]},ne.us.POWER={unit:G.hp,prefix:O.NONE[""]},ne.us.PRESSURE={unit:G.psi,prefix:O.NONE[""]},ne.auto=JSON.parse(JSON.stringify(ne.si));var pe=ne.auto;x.setUnitSystem=function(q){if(et(ne,q))pe=ne[q];else throw new Error("Unit system "+q+" does not exist. Choices are: "+Object.keys(ne).join(", "))},x.getUnitSystem=function(){for(var q in ne)if(et(ne,q)&&ne[q]===pe)return q},x.typeConverters={BigNumber:function(J){return new y(J+"")},Fraction:function(J){return new b(J)},Complex:function(J){return J},number:function(J){return J}},x.prototype._numberConverter=function(){var q=x.typeConverters[this.valueType()];if(q)return q;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},x._getNumberConverter=function(q){if(!x.typeConverters[q])throw new TypeError('Unsupported type "'+q+'"');return x.typeConverters[q]};for(var he in G)if(et(G,he)){var le=G[he];le.dimensions=le.base.dimensions}for(var fe in Y)if(et(Y,fe)){var xe=G[Y[fe]],ge={};for(var ve in xe)et(xe,ve)&&(ge[ve]=xe[ve]);ge.name=fe,G[fe]=ge}x.isValidAlpha=function(J){return/^[a-zA-Z]$/.test(J)};function Ee(q){for(var J=0;J<q.length;J++){if(C=q.charAt(J),J===0&&!x.isValidAlpha(C))throw new Error('Invalid unit name (must begin with alpha character): "'+q+'"');if(J>0&&!(x.isValidAlpha(C)||_(C)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+q+'"')}}return x.createUnit=function(q,J){if(typeof q!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(J&&J.override){for(var ce in q)if(et(q,ce)&&x.deleteUnit(ce),q[ce].aliases)for(var X=0;X<q[ce].aliases.length;X++)x.deleteUnit(q[ce].aliases[X])}var te;for(var ae in q)et(q,ae)&&(te=x.createUnitSingle(ae,q[ae]));return te},x.createUnitSingle=function(q,J){if((typeof J>"u"||J===null)&&(J={}),typeof q!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(et(G,q))throw new Error('Cannot create unit "'+q+'": a unit with that name already exists');Ee(q);var ce=null,X=[],te=0,ae,De,be;if(J&&J.type==="Unit")ce=J.clone();else if(typeof J=="string")J!==""&&(ae=J);else if(typeof J=="object")ae=J.definition,De=J.prefixes,te=J.offset,be=J.baseName,J.aliases&&(X=J.aliases.valueOf());else throw new TypeError('Cannot create unit "'+q+'" from "'+J.toString()+'": expecting "string" or "Unit" or "Object"');if(X){for(var K=0;K<X.length;K++)if(et(G,X[K]))throw new Error('Cannot create alias "'+X[K]+'": a unit with that name already exists')}if(ae&&typeof ae=="string"&&!ce)try{ce=x.parse(ae,{allowNoUnits:!0})}catch(bt){throw bt.message='Could not create unit "'+q+'" from "'+ae+'": '+bt.message,bt}else ae&&ae.type==="Unit"&&(ce=ae.clone());X=X||[],te=te||0,De&&De.toUpperCase?De=O[De.toUpperCase()]||O.NONE:De=O.NONE;var W={};if(ce){W={name:q,value:ce.value,dimensions:ce.dimensions.slice(0),prefixes:De,offset:te};var _e=!1;for(var Ae in I)if(et(I,Ae)){for(var Ce=!0,Me=0;Me<L.length;Me++)if(Math.abs((W.dimensions[Me]||0)-(I[Ae].dimensions[Me]||0))>1e-12){Ce=!1;break}if(Ce){_e=!0,W.base=I[Ae];break}}if(!_e){be=be||q+"_STUFF";var Te={dimensions:ce.dimensions.slice(0)};Te.key=be,I[be]=Te,pe[be]={unit:W,prefix:O.NONE[""]},W.base=I[be]}}else{if(be=be||q+"_STUFF",L.indexOf(be)>=0)throw new Error('Cannot create new base unit "'+q+'": a base unit with that name already exists (and cannot be overridden)');L.push(be);for(var ue in I)et(I,ue)&&(I[ue].dimensions[L.length-1]=0);for(var me={dimensions:[]},we=0;we<L.length;we++)me.dimensions[we]=0;me.dimensions[L.length-1]=1,me.key=be,I[be]=me,W={name:q,value:1,dimensions:I[be].dimensions.slice(0),prefixes:De,offset:te,base:I[be]},pe[be]={unit:W,prefix:O.NONE[""]}}x.UNITS[q]=W;for(var Ve=0;Ve<X.length;Ve++){var Re=X[Ve],dt={};for(var Ze in W)et(W,Ze)&&(dt[Ze]=W[Ze]);dt.name=Re,x.UNITS[Re]=dt}return delete P.cache,new x(null,q)},x.deleteUnit=function(q){delete x.UNITS[q]},x.PREFIXES=O,x.BASE_DIMENSIONS=L,x.BASE_UNITS=I,x.UNIT_SYSTEMS=ne,x.UNITS=G,x},{isClass:!0}),f3="unit",mae=["typed","Unit"],Cm=Q(f3,mae,e=>{var{typed:t,Unit:r}=e;return t(f3,{Unit:function(i){return i.clone()},string:function(i){return r.isValuelessUnit(i)?new r(null,i):r.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new r(i,a)},"number | BigNumber | Fraction":function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),p3="sparse",vae=["typed","SparseMatrix"],Sm=Q(p3,vae,e=>{var{typed:t,SparseMatrix:r}=e;return t(p3,{"":function(){return new r([])},string:function(i){return new r([],i)},"Array | Matrix":function(i){return new r(i)},"Array | Matrix, string":function(i,a){return new r(i,a)}})}),h3="createUnit",gae=["typed","Unit"],Dm=Q(h3,gae,e=>{var{typed:t,Unit:r}=e;return t(h3,{"Object, Object":function(i,a){return r.createUnit(i,a)},Object:function(i){return r.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var s={};return s[i]=a,r.createUnit(s,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,r.createUnit(o,{})},string:function(i){var a={};return a[i]={},r.createUnit(a,{})}})}),m3="acos",yae=["typed","config","Complex"],Em=Q(m3,yae,e=>{var{typed:t,config:r,Complex:n}=e;return t(m3,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})}),v3="acosh",bae=["typed","config","Complex"],Nm=Q(v3,bae,e=>{var{typed:t,config:r,Complex:n}=e;return t(v3,{number:function(a){return a>=1||r.predictable?LT(a):a<=-1?new n(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new n(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})}),g3="acot",xae=["typed","BigNumber"],Am=Q(g3,xae,e=>{var{typed:t,BigNumber:r}=e;return t(g3,{number:VT,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})}),y3="acoth",wae=["typed","config","Complex","BigNumber"],_m=Q(y3,wae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(y3,{number:function(o){return o>=1||o<=-1||r.predictable?qT(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})}),b3="acsc",Cae=["typed","config","Complex","BigNumber"],Mm=Q(b3,Cae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(b3,{number:function(o){return o<=-1||o>=1||r.predictable?GT(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})}),x3="acsch",Sae=["typed","BigNumber"],Tm=Q(x3,Sae,e=>{var{typed:t,BigNumber:r}=e;return t(x3,{number:UT,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})}),w3="asec",Dae=["typed","config","Complex","BigNumber"],Om=Q(w3,Dae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(w3,{number:function(o){return o<=-1||o>=1||r.predictable?WT(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})}),C3="asech",Eae=["typed","config","Complex","BigNumber"],Rm=Q(C3,Eae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(C3,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return HT(o);var l=Math.sqrt(s*s-1);return new n(Math.log(l-s),Math.PI)}return new n(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})}),S3="asin",Nae=["typed","config","Complex"],Im=Q(S3,Nae,e=>{var{typed:t,config:r,Complex:n}=e;return t(S3,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})}),Aae="asinh",_ae=["typed"],km=Q(Aae,_ae,e=>{var{typed:t}=e;return t("asinh",{number:jT,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})}),Mae="atan",Tae=["typed"],Pm=Q(Mae,Tae,e=>{var{typed:t}=e;return t("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})}),D3="atan2",Oae=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Fm=Q(D3,Oae,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=Wi({typed:t,equalScalar:n}),l=Vn({typed:t}),u=qO({typed:t,equalScalar:n}),c=Cn({typed:t,equalScalar:n}),d=sn({typed:t,DenseMatrix:a}),f=vr({typed:t,matrix:r,concat:o});return t(D3,{"number, number":Math.atan2,"BigNumber, BigNumber":(p,m)=>i.atan2(p,m)},f({scalar:"number | BigNumber",SS:u,DS:l,SD:s,Ss:c,sS:d}))}),E3="atanh",Rae=["typed","config","Complex"],$m=Q(E3,Rae,e=>{var{typed:t,config:r,Complex:n}=e;return t(E3,{number:function(a){return a<=1&&a>=-1||r.predictable?KT(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})}),kl=Q("trigUnit",["typed"],e=>{var{typed:t}=e;return{Unit:t.referToSelf(r=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(r,n.valueType())(n.value)})}}),N3="cos",Iae=["typed"],Bm=Q(N3,Iae,e=>{var{typed:t}=e,r=kl({typed:t});return t(N3,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)}),A3="cosh",kae=["typed"],zm=Q(A3,kae,e=>{var{typed:t}=e;return t(A3,{number:_J,"Complex | BigNumber":r=>r.cosh()})}),_3="cot",Pae=["typed","BigNumber"],Lm=Q(_3,Pae,e=>{var{typed:t,BigNumber:r}=e,n=kl({typed:t});return t(_3,{number:YT,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)}),M3="coth",Fae=["typed","BigNumber"],Vm=Q(M3,Fae,e=>{var{typed:t,BigNumber:r}=e;return t(M3,{number:XT,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})}),T3="csc",$ae=["typed","BigNumber"],qm=Q(T3,$ae,e=>{var{typed:t,BigNumber:r}=e,n=kl({typed:t});return t(T3,{number:ZT,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)}),O3="csch",Bae=["typed","BigNumber"],Gm=Q(O3,Bae,e=>{var{typed:t,BigNumber:r}=e;return t(O3,{number:QT,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})}),R3="sec",zae=["typed","BigNumber"],Um=Q(R3,zae,e=>{var{typed:t,BigNumber:r}=e,n=kl({typed:t});return t(R3,{number:JT,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)}),I3="sech",Lae=["typed","BigNumber"],Wm=Q(I3,Lae,e=>{var{typed:t,BigNumber:r}=e;return t(I3,{number:eO,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})}),k3="sin",Vae=["typed"],Hm=Q(k3,Vae,e=>{var{typed:t}=e,r=kl({typed:t});return t(k3,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)}),P3="sinh",qae=["typed"],jm=Q(P3,qae,e=>{var{typed:t}=e;return t(P3,{number:tO,"Complex | BigNumber":r=>r.sinh()})}),F3="tan",Gae=["typed"],Km=Q(F3,Gae,e=>{var{typed:t}=e,r=kl({typed:t});return t(F3,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)}),Uae="tanh",Wae=["typed"],Ym=Q(Uae,Wae,e=>{var{typed:t}=e;return t("tanh",{number:TJ,"Complex | BigNumber":r=>r.tanh()})}),$3="setCartesian",Hae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Xm=Q($3,Hae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t($3,{"Array | Matrix, Array | Matrix":function(l,u){var c=[];if(n(r(l),new a(0))!==0&&n(r(u),new a(0))!==0){var d=Qt(Array.isArray(l)?l:l.toArray()).sort(i),f=Qt(Array.isArray(u)?u:u.toArray()).sort(i);c=[];for(var p=0;p<d.length;p++)for(var m=0;m<f.length;m++)c.push([d[p],f[m]])}return Array.isArray(l)&&Array.isArray(u)?c:new o(c)}})}),B3="setDifference",jae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Zm=Q(B3,jae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(B3,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0)c=[];else{if(n(r(u),new a(0))===0)return Qt(l.toArray());var d=wl(Qt(Array.isArray(l)?l:l.toArray()).sort(i)),f=wl(Qt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p,m=0;m<d.length;m++){p=!1;for(var v=0;v<f.length;v++)if(i(d[m].value,f[v].value)===0&&d[m].identifier===f[v].identifier){p=!0;break}p||c.push(d[m])}}return Array.isArray(l)&&Array.isArray(u)?Sf(c):new o(Sf(c))}})}),z3="setDistinct",Kae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Qm=Q(z3,Kae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(z3,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=Qt(Array.isArray(l)?l:l.toArray()).sort(i);u=[],u.push(c[0]);for(var d=1;d<c.length;d++)i(c[d],c[d-1])!==0&&u.push(c[d])}return Array.isArray(l)?u:new o(u)}})}),L3="setIntersect",Yae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Jm=Q(L3,Yae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(L3,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0||n(r(u),new a(0))===0)c=[];else{var d=wl(Qt(Array.isArray(l)?l:l.toArray()).sort(i)),f=wl(Qt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p=0;p<d.length;p++)for(var m=0;m<f.length;m++)if(i(d[p].value,f[m].value)===0&&d[p].identifier===f[m].identifier){c.push(d[p]);break}}return Array.isArray(l)&&Array.isArray(u)?Sf(c):new o(Sf(c))}})}),V3="setIsSubset",Xae=["typed","size","subset","compareNatural","Index"],ev=Q(V3,Xae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(V3,{"Array | Matrix, Array | Matrix":function(s,l){if(n(r(s),new a(0))===0)return!0;if(n(r(l),new a(0))===0)return!1;for(var u=wl(Qt(Array.isArray(s)?s:s.toArray()).sort(i)),c=wl(Qt(Array.isArray(l)?l:l.toArray()).sort(i)),d,f=0;f<u.length;f++){d=!1;for(var p=0;p<c.length;p++)if(i(u[f].value,c[p].value)===0&&u[f].identifier===c[p].identifier){d=!0;break}if(d===!1)return!1}return!0}})}),q3="setMultiplicity",Zae=["typed","size","subset","compareNatural","Index"],tv=Q(q3,Zae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(q3,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=Qt(Array.isArray(l)?l:l.toArray()),c=0,d=0;d<u.length;d++)i(u[d],s)===0&&c++;return c}})}),G3="setPowerset",Qae=["typed","size","subset","compareNatural","Index"],rv=Q(G3,Qae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(G3,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=Qt(Array.isArray(u)?u:u.toArray()).sort(i),d=[],f=0;f.toString(2).length<=c.length;)d.push(o(c,f.toString(2).split("").reverse())),f++;return s(d)}});function o(l,u){for(var c=[],d=0;d<u.length;d++)u[d]==="1"&&c.push(l[d]);return c}function s(l){for(var u=[],c=l.length-1;c>0;c--)for(var d=0;d<c;d++)l[d].length>l[d+1].length&&(u=l[d],l[d]=l[d+1],l[d+1]=u);return l}}),U3="setSize",Jae=["typed","compareNatural"],nv=Q(U3,Jae,e=>{var{typed:t,compareNatural:r}=e;return t(U3,{"Array | Matrix":function(i){return Array.isArray(i)?Qt(i).length:Qt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?Qt(i).length:Qt(i.toArray()).length;for(var o=Qt(Array.isArray(i)?i:i.toArray()).sort(r),s=1,l=1;l<o.length;l++)r(o[l],o[l-1])!==0&&s++;return s}})}),W3="setSymDifference",eoe=["typed","size","concat","subset","setDifference","Index"],iv=Q(W3,eoe,e=>{var{typed:t,size:r,concat:n,subset:i,setDifference:a,Index:o}=e;return t(W3,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return Qt(u);if(i(r(u),new o(0))===0)return Qt(l);var c=Qt(l),d=Qt(u);return n(a(c,d),a(d,c))}})}),H3="setUnion",toe=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],av=Q(H3,toe,e=>{var{typed:t,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(H3,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return Qt(c);if(i(r(c),new s(0))===0)return Qt(u);var d=Qt(u),f=Qt(c);return n(o(d,f),a(d,f))}})}),j3="add",roe=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],ov=Q(j3,roe,e=>{var{typed:t,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,l=Bo({typed:t}),u=hw({typed:t,equalScalar:i}),c=gs({typed:t,DenseMatrix:a}),d=vr({typed:t,matrix:r,concat:s});return t(j3,{"any, any":n,"any, any, ...any":t.referToSelf(f=>(p,m,v)=>{for(var y=f(p,m),b=0;b<v.length;b++)y=f(y,v[b]);return y})},d({elop:n,DS:l,SS:u,Ss:c}))}),K3="hypot",noe=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],sv=Q(K3,noe,e=>{var{typed:t,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:l}=e;return t(K3,{"... number | BigNumber":u,Array:u,Matrix:c=>u(Qt(c.toArray()))});function u(c){for(var d=0,f=0,p=0;p<c.length;p++){if(yi(c[p]))throw new TypeError("Unexpected type of argument to hypot");var m=r(c[p]);s(f,m)?(d=a(d,a(i(f,m),i(f,m))),d=n(d,1),f=m):d=n(d,l(m)?a(i(m,f),i(m,f)):m)}return a(f,o(d))}}),Y3="norm",ioe=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],lv=Q(Y3,ioe,e=>{var{typed:t,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:l,larger:u,smaller:c,matrix:d,ctranspose:f,eigs:p}=e;return t(Y3,{number:Math.abs,Complex:function(A){return A.abs()},BigNumber:function(A){return A.abs()},boolean:function(A){return Math.abs(A)},Array:function(A){return C(d(A),2)},Matrix:function(A){return C(A,2)},"Array, number | BigNumber | string":function(A,_){return C(d(A),_)},"Matrix, number | BigNumber | string":function(A,_){return C(A,_)}});function m(E){var A=0;return E.forEach(function(_){var N=r(_);u(N,A)&&(A=N)},!0),A}function v(E){var A;return E.forEach(function(_){var N=r(_);(!A||c(N,A))&&(A=N)},!0),A||0}function y(E,A){if(A===Number.POSITIVE_INFINITY||A==="inf")return m(E);if(A===Number.NEGATIVE_INFINITY||A==="-inf")return v(E);if(A==="fro")return C(E,2);if(typeof A=="number"&&!isNaN(A)){if(!l(A,0)){var _=0;return E.forEach(function(N){_=n(i(r(N),A),_)},!0),i(_,1/A)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function b(E){var A=0;return E.forEach(function(_,N){A=n(A,s(_,a(_)))}),r(o(A))}function D(E){var A=[],_=0;return E.forEach(function(N,M){var R=M[1],F=n(A[R]||0,r(N));u(F,_)&&(_=F),A[R]=F},!0),_}function x(E){var A=E.size();if(A[0]!==A[1])throw new RangeError("Invalid matrix dimensions");var _=f(E),N=s(_,E),M=p(N).values.toArray(),R=M[M.length-1];return r(o(R))}function S(E){var A=[],_=0;return E.forEach(function(N,M){var R=M[0],F=n(A[R]||0,r(N));u(F,_)&&(_=F),A[R]=F},!0),_}function w(E,A){if(A===1)return D(E);if(A===Number.POSITIVE_INFINITY||A==="inf")return S(E);if(A==="fro")return b(E);if(A===2)return x(E);throw new Error("Unsupported parameter value "+A)}function C(E,A){var _=E.size();if(_.length===1)return y(E,A);if(_.length===2){if(_[0]&&_[1])return w(E,A);throw new RangeError("Invalid matrix dimensions")}}}),X3="dot",aoe=["typed","addScalar","multiplyScalar","conj","size"],uv=Q(X3,aoe,e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:a}=e;return t(X3,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":l});function o(c,d){var f=u(c),p=u(d),m,v;if(f.length===1)m=f[0];else if(f.length===2&&f[1]===1)m=f[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+f.join(", ")+")");if(p.length===1)v=p[0];else if(p.length===2&&p[1]===1)v=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(m!==v)throw new RangeError("Vectors must have equal length ("+m+" != "+v+")");if(m===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return m}function s(c,d){var f=o(c,d),p=ft(c)?c._data:c,m=ft(c)?c._datatype:void 0,v=ft(d)?d._data:d,y=ft(d)?d._datatype:void 0,b=u(c).length===2,D=u(d).length===2,x=r,S=n;if(m&&y&&m===y&&typeof m=="string"){var w=m;x=t.find(r,[w,w]),S=t.find(n,[w,w])}if(!b&&!D){for(var C=S(i(p[0]),v[0]),E=1;E<f;E++)C=x(C,S(i(p[E]),v[E]));return C}if(!b&&D){for(var A=S(i(p[0]),v[0][0]),_=1;_<f;_++)A=x(A,S(i(p[_]),v[_][0]));return A}if(b&&!D){for(var N=S(i(p[0][0]),v[0]),M=1;M<f;M++)N=x(N,S(i(p[M][0]),v[M]));return N}if(b&&D){for(var R=S(i(p[0][0]),v[0][0]),F=1;F<f;F++)R=x(R,S(i(p[F][0]),v[F][0]));return R}}function l(c,d){o(c,d);for(var f=c._index,p=c._values,m=d._index,v=d._values,y=0,b=r,D=n,x=0,S=0;x<f.length&&S<m.length;){var w=f[x],C=m[S];if(w<C){x++;continue}if(w>C){S++;continue}w===C&&(y=b(y,D(p[x],v[S])),x++,S++)}return y}function u(c){return ft(c)?c.size():a(c)}}),ooe="trace",soe=["typed","matrix","add"],cv=Q(ooe,soe,e=>{var{typed:t,matrix:r,add:n}=e;return t("trace",{Array:function(s){return i(r(s))},SparseMatrix:a,DenseMatrix:i,any:pt});function i(o){var s=o._size,l=o._data;switch(s.length){case 1:if(s[0]===1)return pt(l[0]);throw new RangeError("Matrix must be square (size: "+Pt(s)+")");case 2:{var u=s[0],c=s[1];if(u===c){for(var d=0,f=0;f<u;f++)d=n(d,l[f][f]);return d}else throw new RangeError("Matrix must be square (size: "+Pt(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(s)+")")}}function a(o){var s=o._values,l=o._index,u=o._ptr,c=o._size,d=c[0],f=c[1];if(d===f){var p=0;if(s.length>0)for(var m=0;m<f;m++)for(var v=u[m],y=u[m+1],b=v;b<y;b++){var D=l[b];if(D===m){p=n(p,s[b]);break}if(D>m)break}return p}throw new RangeError("Matrix must be square (size: "+Pt(c)+")")}}),Z3="index",loe=["typed","Index"],dv=Q(Z3,loe,e=>{var{typed:t,Index:r}=e;return t(Z3,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(s){return kt(s)?s.toNumber():Array.isArray(s)||ft(s)?s.map(function(l){return kt(l)?l.toNumber():l}):s}),o=new r;return r.apply(o,a),o}})}),Q3=new Set(["end"]),uoe="Node",coe=["mathWithTransform"],fv=Q(uoe,coe,e=>{var{mathWithTransform:t}=e;function r(i){for(var a of[...Q3])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(t,{}),o={},s=null;function l(u){var c=Dl(u);return r(c),a(c,o,s)}return{evaluate:l}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!sr(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(s,l){s.forEach(function(u,c,d){l(u,c,d),o(u,l)})}o(this,a)}transform(a){function o(s,l,u){var c=a(s,l,u);return c!==s?c:s.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(s,l,u){a(s,l,u)&&o.push(s)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&ju(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toString(a)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o<"u"?o:this.toHTML(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function Gn(e){return e&&e.isIndexError?new ii(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function J3(e){var{subset:t}=e;return function(n,i){try{if(Array.isArray(n))return t(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return t(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Si(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Gn(a)}}}var pv="AccessorNode",doe=["subset","Node"],hv=Q(pv,doe,e=>{var{subset:t,Node:r}=e,n=J3({subset:t});function i(o){return!(Ka(o)||Yn(o)||Kt(o)||ya(o)||vl(o)||zi(o)||en(o))}class a extends r{constructor(s,l){if(super(),!sr(s))throw new TypeError('Node expected for parameter "object"');if(!To(l))throw new TypeError('IndexNode expected for parameter "index"');this.object=s,this.index=l}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return pv}get isAccessorNode(){return!0}_compile(s,l){var u=this.object._compile(s,l),c=this.index._compile(s,l);if(this.index.isObjectProperty()){var d=this.index.getObjectProperty();return function(p,m,v){return Si(u(p,m,v),d)}}else return function(p,m,v){var y=u(p,m,v),b=c(p,m,y);return n(y,b)}}forEach(s){s(this.object,"object",this),s(this.index,"index",this)}map(s){return new a(this._ifNode(s(this.object,"object",this)),this._ifNode(s(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(s){var l=this.object.toString(s);return i(this.object)&&(l="("+l+")"),l+this.index.toString(s)}toHTML(s){var l=this.object.toHTML(s);return i(this.object)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+this.index.toHTML(s)}_toTex(s){var l=this.object.toTex(s);return i(this.object)&&(l="\\left(' + object + '\\right)"),l+this.index.toTex(s)}toJSON(){return{mathjs:pv,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return pn(a,"name",pv),a},{isClass:!0,isNode:!0}),mv="ArrayNode",foe=["Node"],vv=Q(mv,foe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(sr))throw new TypeError("Array containing Nodes expected")}get type(){return mv}get isArrayNode(){return!0}_compile(i,a){var o=Ya(this.items,function(u){return u._compile(i,a)}),s=i.config.matrix!=="Array";if(s){var l=i.matrix;return function(c,d,f){return l(Ya(o,function(p){return p(c,d,f)}))}}else return function(c,d,f){return Ya(o,function(p){return p(c,d,f)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new r(a)}clone(){return new r(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:mv,items:this.items}}static fromJSON(i){return new r(i.items)}toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,s){var l=o.some(Yn)&&!o.every(Yn),u=s||l,c=u?"&":"\\\\",d=o.map(function(f){return f.items?a(f.items,!s):f.toTex(i)}).join(c);return l||!u||u&&!s?"\\begin{bmatrix}"+d+"\\end{bmatrix}":d}return a(this.items,!1)}}return pn(r,"name",mv),r},{isClass:!0,isNode:!0});function poe(e){var{subset:t,matrix:r}=e;return function(i,a,o){try{if(Array.isArray(i))return r(i).subset(a,o).valueOf();if(i&&typeof i.subset=="function")return i.subset(a,o);if(typeof i=="string")return t(i,a,o);if(typeof i=="object"){if(!a.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Cl(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(s){throw Gn(s)}}}var Hi=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function gv(e,t){if(!t||t!=="auto")return e;for(var r=e;zi(r);)r=r.content;return r}function mr(e,t,r,n){var i=e;t!=="keep"&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<Hi.length;s++)if(a in Hi[s]){o=s;break}if(a==="OperatorNode:multiply"&&i.implicit&&r!=="show"){var l=gv(i.args[0],t);!(Kt(l)&&n&&n.getIdentifier()==="OperatorNode:divide"&&Lx(gv(n.args[0],t)))&&!(l.getIdentifier()==="OperatorNode:divide"&&Lx(gv(l.args[0],t))&&Kt(gv(l.args[1])))&&(o+=1)}return o}function dc(e,t){var r=e;t!=="keep"&&(r=e.getContent());var n=r.getIdentifier(),i=mr(r,t);if(i===null)return null;var a=Hi[i][n];if(et(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function Cw(e,t,r){var n=r!=="keep"?e.getContent():e,i=r!=="keep"?e.getContent():t,a=n.getIdentifier(),o=i.getIdentifier(),s=mr(n,r);if(s===null)return null;var l=Hi[s][a];if(et(l,"associativeWith")&&l.associativeWith instanceof Array){for(var u=0;u<l.associativeWith.length;u++)if(l.associativeWith[u]===o)return!0;return!1}return null}function hoe(e){var t="OperatorNode:"+e;for(var r of Hi)if(t in r)return r[t].op;return null}var yv="AssignmentNode",moe=["subset","?matrix","Node"],bv=Q(yv,moe,e=>{var{subset:t,matrix:r,Node:n}=e,i=J3({subset:t}),a=poe({subset:t,matrix:r});function o(l,u,c){u||(u="keep");var d=mr(l,u,c),f=mr(l.value,u,c);return u==="all"||f!==null&&f<=d}class s extends n{constructor(u,c,d){if(super(),this.object=u,this.index=d?c:null,this.value=d||c,!en(u)&&!Ka(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(en(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!To(this.index))throw new TypeError('IndexNode expected as "index"');if(!sr(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return yv}get isAssignmentNode(){return!0}_compile(u,c){var d=this.object._compile(u,c),f=this.index?this.index._compile(u,c):null,p=this.value._compile(u,c),m=this.object.name;if(this.index)if(this.index.isObjectProperty()){var v=this.index.getObjectProperty();return function(S,w,C){var E=d(S,w,C),A=p(S,w,C);return Cl(E,v,A),A}}else{if(en(this.object))return function(S,w,C){var E=d(S,w,C),A=p(S,w,C),_=f(S,w,E);return S.set(m,a(E,_,A)),A};var y=this.object.object._compile(u,c);if(this.object.index.isObjectProperty()){var b=this.object.index.getObjectProperty();return function(S,w,C){var E=y(S,w,C),A=Si(E,b),_=f(S,w,A),N=p(S,w,C);return Cl(E,b,a(A,_,N)),N}}else{var D=this.object.index._compile(u,c);return function(S,w,C){var E=y(S,w,C),A=D(S,w,E),_=i(E,A),N=f(S,w,_),M=p(S,w,C);return a(E,A,a(_,N,M)),M}}}else{if(!en(this.object))throw new TypeError("SymbolNode expected as object");return function(S,w,C){var E=p(S,w,C);return S.set(m,E),E}}}forEach(u){u(this.object,"object",this),this.index&&u(this.index,"index",this),u(this.value,"value",this)}map(u){var c=this._ifNode(u(this.object,"object",this)),d=this.index?this._ifNode(u(this.index,"index",this)):null,f=this._ifNode(u(this.value,"value",this));return new s(c,d,f)}clone(){return new s(this.object,this.index,this.value)}_toString(u){var c=this.object.toString(u),d=this.index?this.index.toString(u):"",f=this.value.toString(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(f="("+f+")"),c+d+" = "+f}toJSON(){return{mathjs:yv,object:this.object,index:this.index,value:this.value}}static fromJSON(u){return new s(u.object,u.index,u.value)}toHTML(u){var c=this.object.toHTML(u),d=this.index?this.index.toHTML(u):"",f=this.value.toHTML(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(f='<span class="math-paranthesis math-round-parenthesis">(</span>'+f+'<span class="math-paranthesis math-round-parenthesis">)</span>'),c+d+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+f}_toTex(u){var c=this.object.toTex(u),d=this.index?this.index.toTex(u):"",f=this.value.toTex(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(f="\\left(".concat(f,"\\right)")),c+d+":="+f}}return pn(s,"name",yv),s},{isClass:!0,isNode:!0}),xv="BlockNode",voe=["ResultSet","Node"],wv=Q(xv,voe,e=>{var{ResultSet:t,Node:r}=e;class n extends r{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var s=o&&o.node,l=o&&o.visible!==void 0?o.visible:!0;if(!sr(s))throw new TypeError('Property "node" must be a Node');if(typeof l!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:s,visible:l}})}get type(){return xv}get isBlockNode(){return!0}_compile(a,o){var s=Ya(this.blocks,function(l){return{evaluate:l.node._compile(a,o),visible:l.visible}});return function(u,c,d){var f=[];return wf(s,function(m){var v=m.evaluate(u,c,d);m.visible&&f.push(v)}),new t(f)}}forEach(a){for(var o=0;o<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],s=0;s<this.blocks.length;s++){var l=this.blocks[s],u=this._ifNode(a(l.node,"blocks["+s+"].node",this));o[s]={node:u,visible:l.visible}}return new n(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new n(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
110
+ (`+Pt(A,v)+", "+Pt(S,v)+") ==> "+(this._values?Pt(this._values[E],v):"X")}return x},i.prototype.toString=function(){return Pt(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(v){if(v){if(kt(v)&&(v=v.toNumber()),!Ut(v)||!ot(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var y=v>0?v:0,b=v<0?-v:0,D=this._size[0],x=this._size[1],S=Math.min(D-b,x-y),w=[],C=[],E=[];E[0]=0;for(var A=y;A<x&&w.length<S;A++)for(var _=this._ptr[A],N=this._ptr[A+1],M=_;M<N;M++){var R=this._index[M];if(R===A-y+b){w.push(this._values[M]),C[w.length-1]=R-b;break}}return E.push(w.length),new i({values:w,index:C,ptr:E,size:[S,1]})},i.fromJSON=function(v){return new i(v)},i.diagonal=function(v,y,b,D,x){if(!or(v))throw new TypeError("Array expected, size parameter");if(v.length!==2)throw new Error("Only two dimensions matrix are supported");if(v=v.map(function(I){if(kt(I)&&(I=I.toNumber()),!Ut(I)||!ot(I)||I<1)throw new Error("Size values must be positive integers");return I}),b){if(kt(b)&&(b=b.toNumber()),!Ut(b)||!ot(b))throw new TypeError("The parameter k must be an integer number")}else b=0;var S=r,w=0;bn(x)&&(S=t.find(r,[x,x])||r,w=t.convert(0,x));var C=b>0?b:0,E=b<0?-b:0,A=v[0],_=v[1],N=Math.min(A-E,_-C),M;if(or(y)){if(y.length!==N)throw new Error("Invalid value array length");M=function(V){return y[V]}}else if(ft(y)){var R=y.size();if(R.length!==1||R[0]!==N)throw new Error("Invalid matrix length");M=function(V){return y.get([V])}}else M=function(){return y};for(var F=[],k=[],P=[],T=0;T<_;T++){P.push(F.length);var O=T-C;if(O>=0&&O<N){var L=M(O);S(L,w)||(k.push(O+E),F.push(L))}}return P.push(F.length),new i({values:F,index:k,ptr:P,size:[A,_]})},i.prototype.swapRows=function(v,y){if(!Ut(v)||!ot(v)||!Ut(y)||!ot(y))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return hr(v,this._size[0]),hr(y,this._size[0]),i._swapRows(v,y,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(v,y,b,D,x){for(var S=D[v],w=D[v+1],C=S;C<w;C++)x(b[C],y[C])},i._swapRows=function(v,y,b,D,x,S){for(var w=0;w<b;w++){var C=S[w],E=S[w+1],A=u(v,C,E,x),_=u(y,C,E,x);if(A<E&&_<E&&x[A]===v&&x[_]===y){if(D){var N=D[A];D[A]=D[_],D[_]=N}continue}if(A<E&&x[A]===v&&(_>=E||x[_]!==y)){var M=D?D[A]:void 0;x.splice(_,0,y),D&&D.splice(_,0,M),x.splice(_<=A?A+1:A,1),D&&D.splice(_<=A?A+1:A,1);continue}if(_<E&&x[_]===y&&(A>=E||x[A]!==v)){var R=D?D[_]:void 0;x.splice(A,0,v),D&&D.splice(A,0,R),x.splice(A<=_?_+1:_,1),D&&D.splice(A<=_?_+1:_,1)}}},i},{isClass:!0}),Dte="number",Ete=["typed"];function Nte(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(t){var r={"0b":2,"0o":8,"0x":16}[t[1]],n=t[2],i=t[3];return{input:e,radix:r,integerPart:n,fractionalPart:i}}else return null}function Ate(e){for(var t=parseInt(e.integerPart,e.radix),r=0,n=0;n<e.fractionalPart.length;n++){var i=parseInt(e.fractionalPart[n],e.radix);r+=i/Math.pow(e.radix,n+1)}var a=t+r;if(isNaN(a))throw new SyntaxError('String "'+e.input+'" is no valid number');return a}var np=Q(Dte,Ete,e=>{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=Nte(i);if(a)return Ate(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is no valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:function(i){throw new Error("Second argument with valueless unit expected")},null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r}),pO="string",_te=["typed"],ip=Q(pO,_te,e=>{var{typed:t}=e;return t(pO,{"":function(){return""},number:ms,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r)),any:function(n){return String(n)}})}),hO="boolean",Mte=["typed"],ap=Q(hO,Mte,e=>{var{typed:t}=e;return t(hO,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),Tte="bignumber",Ote=["typed","BigNumber"],op=Q(Tte,Ote,e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(i){return new r(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],s=r(a[1]),l=new r(2).pow(Number(o));if(s.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var u=new r(2).pow(Number(o)-1);return s.gte(u)?s.sub(l):s}return new r(i)},BigNumber:function(i){return i},Fraction:function(i){return new r(i.n).div(i.d).times(i.s)},null:function(i){return new r(0)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),Rte="complex",Ite=["typed","Complex"],sp=Q(Rte,Ite,e=>{var{typed:t,Complex:r}=e;return t("complex",{"":function(){return r.ZERO},number:function(i){return new r(i,0)},"number, number":function(i,a){return new r(i,a)},"BigNumber, BigNumber":function(i,a){return new r(i.toNumber(),a.toNumber())},Fraction:function(i){return new r(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return r(i)},null:function(i){return r(0)},Object:function(i){if("re"in i&&"im"in i)return new r(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new r(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),kte="fraction",Pte=["typed","Fraction"],lp=Q(kte,Pte,e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new r(i)},string:function(i){return new r(i)},"number, number":function(i,a){return new r(i,a)},null:function(i){return new r(0)},BigNumber:function(i){return new r(i.toString())},Fraction:function(i){return i},Object:function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),mO="matrix",Fte=["typed","Matrix","DenseMatrix","SparseMatrix"],up=Q(mO,Fte,e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(mO,{"":function(){return a([])},string:function(s){return a([],s)},"string, string":function(s,l){return a([],s,l)},Array:function(s){return a(s)},Matrix:function(s){return a(s,s.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,s,l){if(s==="dense"||s==="default"||s===void 0)return new n(o,l);if(s==="sparse")return new i(o,l);throw new TypeError("Unknown matrix type "+JSON.stringify(s)+".")}}),vO="matrixFromFunction",$te=["typed","matrix","isZero"],cp=Q(vO,$te,e=>{var{typed:t,matrix:r,isZero:n}=e;return t(vO,{"Array | Matrix, function, string, string":function(o,s,l,u){return i(o,s,l,u)},"Array | Matrix, function, string":function(o,s,l){return i(o,s,l)},"Matrix, function":function(o,s){return i(o,s,"dense")},"Array, function":function(o,s){return i(o,s,"dense").toArray()},"Array | Matrix, string, function":function(o,s,l){return i(o,l,s)},"Array | Matrix, string, string, function":function(o,s,l,u){return i(o,u,s,l)}});function i(a,o,s,l){var u;return l!==void 0?u=r(s,l):u=r(s),u.resize(a),u.forEach(function(c,d){var f=o(d);n(f)||u.set(d,f)}),u}}),gO="matrixFromRows",Bte=["typed","matrix","flatten","size"],dp=Q(gO,Bte,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(gO,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var l=o(s[0]),u=[];for(var c of s){var d=o(c);if(d!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(d|0));u.push(n(c))}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),yO="matrixFromColumns",zte=["typed","matrix","flatten","size"],fp=Q(yO,zte,e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(yO,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var l=o(s[0]),u=[],c=0;c<l;c++)u[c]=[];for(var d of s){var f=o(d);if(f!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(f|0));for(var p=n(d),m=0;m<l;m++)u[m].push(p[m])}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),bO="splitUnit",Lte=["typed"],pp=Q(bO,Lte,e=>{var{typed:t}=e;return t(bO,{"Unit, Array":function(n,i){return n.splitUnit(i)}})}),xO="unaryMinus",Vte=["typed"],hp=Q(xO,Vte,e=>{var{typed:t}=e;return t(xO,{number:cT,"Complex | BigNumber | Fraction":r=>r.neg(),Unit:t.referToSelf(r=>n=>{var i=n.clone();return i.value=t.find(r,i.valueType())(n.value),i}),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),wO="unaryPlus",qte=["typed","config","BigNumber"],mp=Q(wO,qte,e=>{var{typed:t,config:r,BigNumber:n}=e;return t(wO,{number:dT,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":t.referToSelf(i=>a=>zt(a,i)),"boolean | string":function(a){return r.number==="BigNumber"?new n(+a):+a}})}),CO="abs",Gte=["typed"],vp=Q(CO,Gte,e=>{var{typed:t}=e;return t(CO,{number:sT,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),SO="apply",Ute=["typed","isInteger"],Ju=Q(SO,Ute,e=>{var{typed:t,isInteger:r}=e;return t(SO,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!r(a))throw new TypeError("Integer number expected for dimension");var s=Array.isArray(i)?qt(i):i.size();if(a<0||a>=s.length)throw new ii(a,s.length);return ft(i)?i.create(gp(i.valueOf(),a,o)):gp(i,a,o)}})});function gp(e,t,r){var n,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=Wte(e),i=[],n=0;n<a.length;n++)i[n]=gp(a[n],t-1,r);return i}else return r(e);else{for(i=[],n=0;n<e.length;n++)i[n]=gp(e[n],t-1,r);return i}}function Wte(e){var t=e.length,r=e[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<t;n++)o.push(e[n][i]);a.push(o)}return a}var DO="addScalar",Hte=["typed"],yp=Q(DO,Hte,e=>{var{typed:t}=e;return t(DO,{"number, number":lT,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":t.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=t.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})}),EO="cbrt",jte=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],bp=Q(EO,jte,e=>{var{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=e;return r(EO,{number:Qu,Complex:u,"Complex, boolean":u,BigNumber:function(f){return f.cbrt()},Unit:c});function u(d,f){var p=d.arg()/3,m=d.abs(),v=new o(Qu(m),0).mul(new o(0,p).exp());if(f){var y=[v,new o(Qu(m),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(Qu(m),0).mul(new o(0,p-Math.PI*2/3).exp())];return t.matrix==="Array"?y:a(y)}else return v}function c(d){if(d.value&&yi(d.value)){var f=d.clone();return f.value=1,f=f.pow(1/3),f.value=u(d.value),f}else{var p=n(d.value);p&&(d.value=i(d.value));var m;kt(d.value)?m=new s(1).div(3):Mo(d.value)?m=new l(1,3):m=1/3;var v=d.pow(m);return p&&(v.value=i(v.value)),v}}}),Kte="matAlgo11xS0s",Yte=["typed","equalScalar"],Cn=Q(Kte,Yte,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,d=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=d[0],m=d[1],v,y=r,b=0,D=o;typeof f=="string"&&(v=f,y=t.find(r,[v,v]),b=t.convert(0,v),a=t.convert(a,v),D=t.find(o,[v,v]));for(var x=[],S=[],w=[],C=0;C<m;C++){w[C]=S.length;for(var E=c[C],A=c[C+1],_=E;_<A;_++){var N=u[_],M=s?D(a,l[_]):D(l[_],a);y(M,b)||(S.push(N),x.push(M))}}return w[m]=S.length,i.createSparseMatrix({values:x,index:S,ptr:w,size:[p,m],datatype:v})}}),Xte="matAlgo12xSfs",Zte=["typed","DenseMatrix"],sn=Q(Xte,Zte,e=>{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,d=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=d[0],m=d[1],v,y=o;typeof f=="string"&&(v=f,a=t.convert(a,v),y=t.find(o,[v,v]));for(var b=[],D=[],x=[],S=0;S<m;S++){for(var w=S+1,C=c[S],E=c[S+1],A=C;A<E;A++){var _=u[A];D[_]=l[A],x[_]=w}for(var N=0;N<p;N++)S===0&&(b[N]=[]),x[N]===w?b[N][S]=s?y(a,D[N]):y(D[N],a):b[N][S]=s?y(a,0):y(0,a)}return new r({data:b,size:[p,m],datatype:v})}}),Qte="matAlgo14xDs",Jte=["typed"],Ui=Q(Qte,Jte,e=>{var{typed:t}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,d,f=o;typeof c=="string"&&(d=c,a=t.convert(a,d),f=t.find(o,[d,d]));var p=u.length>0?r(f,0,u,u[0],l,a,s):[];return i.createDenseMatrix({data:p,size:pt(u),datatype:d})};function r(n,i,a,o,s,l,u){var c=[];if(i===a.length-1)for(var d=0;d<o;d++)c[d]=u?n(l,s[d]):n(s[d],l);else for(var f=0;f<o;f++)c[f]=r(n,i+1,a,a[i+1],s[f],l,u);return c}}),dw="ceil",ere=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],tre=Q(dw,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(dw,{number:function(a){return ni(a,n(a),r.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(ni(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.ceil(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),xp=Q(dw,ere,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Cn({typed:t,equalScalar:a}),u=sn({typed:t,DenseMatrix:s}),c=Ui({typed:t}),d=tre({typed:t,config:r,round:n});return t("ceil",{number:d.signatures.number,"number,number":d.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,m){return p.ceil(m)},"Complex, BigNumber":function(p,m){return p.ceil(m.toNumber())},BigNumber:function(p){return xa(p,n(p),r.epsilon)?n(p):p.ceil()},"BigNumber, BigNumber":function(p,m){return xa(p,n(p,m),r.epsilon)?n(p,m):p.toDecimalPlaces(m.toNumber(),Fo.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,m){return p.ceil(m)},"Fraction, BigNumber":function(p,m){return p.ceil(m.toNumber())},"Array | Matrix":t.referToSelf(f=>p=>zt(p,f)),"Array, number | BigNumber":t.referToSelf(f=>(p,m)=>zt(p,v=>f(v,m))),"SparseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>l(p,m,f,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>c(p,m,f,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(f=>(p,m)=>c(i(m),p,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(f=>(p,m)=>a(p,0)?o(m.size(),m.storage()):m.storage()==="dense"?c(m,p,f,!0):u(m,p,f,!0))})}),NO="cube",rre=["typed"],wp=Q(NO,rre,e=>{var{typed:t}=e;return t(NO,{number:fT,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})}),AO="exp",nre=["typed"],Cp=Q(AO,nre,e=>{var{typed:t}=e;return t(AO,{number:pT,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})}),_O="expm1",ire=["typed","Complex"],Sp=Q(_O,ire,e=>{var{typed:t,Complex:r}=e;return t(_O,{number:hT,Complex:function(i){var a=Math.exp(i.re);return new r(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})}),fw="fix",are=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],ore=Q(fw,["typed","ceil","floor"],e=>{var{typed:t,ceil:r,floor:n}=e;return t(fw,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),Dp=Q(fw,are,e=>{var{typed:t,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:l}=e,u=sn({typed:t,DenseMatrix:l}),c=Ui({typed:t}),d=ore({typed:t,ceil:i,floor:a});return t("fix",{number:d.signatures.number,"number, number | BigNumber":d.signatures["number,number"],Complex:function(p){return new r(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,m){return new r(p.re>0?a(p.re,m):i(p.re,m),p.im>0?a(p.im,m):i(p.im,m))},"Complex, BigNumber":function(p,m){var v=m.toNumber();return new r(p.re>0?a(p.re,v):i(p.re,v),p.im>0?a(p.im,v):i(p.im,v))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,m){return p.isNegative()?i(p,m):a(p,m)},Fraction:function(p){return p.s<0?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,m){return p.s<0?i(p,m):a(p,m)},"Array | Matrix":t.referToSelf(f=>p=>zt(p,f)),"Array | Matrix, number | BigNumber":t.referToSelf(f=>(p,m)=>zt(p,v=>f(v,m))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(f=>(p,m)=>c(n(m),p,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(f=>(p,m)=>o(p,0)?s(m.size(),m.storage()):m.storage()==="dense"?c(m,p,f,!0):u(m,p,f,!0))})}),pw="floor",sre=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],lre=Q(pw,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(pw,{number:function(a){return ni(a,n(a),r.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(ni(a,n(a,o),r.epsilon))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.floor(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),Ep=Q(pw,sre,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,l=Cn({typed:t,equalScalar:a}),u=sn({typed:t,DenseMatrix:s}),c=Ui({typed:t}),d=lre({typed:t,config:r,round:n});return t("floor",{number:d.signatures.number,"number,number":d.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,m){return p.floor(m)},"Complex, BigNumber":function(p,m){return p.floor(m.toNumber())},BigNumber:function(p){return xa(p,n(p),r.epsilon)?n(p):p.floor()},"BigNumber, BigNumber":function(p,m){return xa(p,n(p,m),r.epsilon)?n(p,m):p.toDecimalPlaces(m.toNumber(),Fo.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,m){return p.floor(m)},"Fraction, BigNumber":function(p,m){return p.floor(m.toNumber())},"Array | Matrix":t.referToSelf(f=>p=>zt(p,f)),"Array, number | BigNumber":t.referToSelf(f=>(p,m)=>zt(p,v=>f(v,m))),"SparseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>l(p,m,f,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(f=>(p,m)=>c(p,m,f,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(f=>(p,m)=>c(i(m),p,f,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(f=>(p,m)=>a(p,0)?o(m.size(),m.storage()):m.storage()==="dense"?c(m,p,f,!0):u(m,p,f,!0))})}),ure="matAlgo01xDSid",cre=["typed"],Bo=Q(ure,cre,e=>{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype,c=i._values,d=i._index,f=i._ptr,p=i._size,m=i._datatype;if(l.length!==p.length)throw new Ot(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=l[0],y=l[1],b=typeof u=="string"&&u===m?u:void 0,D=b?t.find(a,[b,b]):a,x,S,w=[];for(x=0;x<v;x++)w[x]=[];var C=[],E=[];for(S=0;S<y;S++){for(var A=S+1,_=f[S],N=f[S+1],M=_;M<N;M++)x=d[M],C[x]=o?D(c[M],s[x][S]):D(s[x][S],c[M]),E[x]=A;for(x=0;x<v;x++)E[x]===A?w[x][S]=C[x]:w[x][S]=s[x][S]}return n.createDenseMatrix({data:w,size:[v,y],datatype:b})}}),dre="matAlgo04xSidSid",fre=["typed","equalScalar"],hw=Q(dre,fre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));var E=s&&f?[]:void 0,A=[],_=[],N=s&&f?[]:void 0,M=s&&f?[]:void 0,R=[],F=[],k,P,T,O,L;for(P=0;P<D;P++){_[P]=A.length;var I=P+1;for(O=u[P],L=u[P+1],T=O;T<L;T++)k=l[T],A.push(k),R[k]=I,N&&(N[k]=s[T]);for(O=m[P],L=m[P+1],T=O;T<L;T++)if(k=p[T],R[k]===I){if(N){var V=C(N[k],f[T]);S(V,w)?R[k]=null:N[k]=V}}else A.push(k),F[k]=I,M&&(M[k]=f[T]);if(N&&M)for(T=_[P];T<A.length;)k=A[T],R[k]===I?(E[T]=N[k],T++):F[k]===I?(E[T]=M[k],T++):A.splice(T,1)}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),pre="matAlgo10xSids",hre=["typed","DenseMatrix"],gs=Q(pre,hre,e=>{var{typed:t,DenseMatrix:r}=e;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,d=i._size,f=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=d[0],m=d[1],v,y=o;typeof f=="string"&&(v=f,a=t.convert(a,v),y=t.find(o,[v,v]));for(var b=[],D=[],x=[],S=0;S<m;S++){for(var w=S+1,C=c[S],E=c[S+1],A=C;A<E;A++){var _=u[A];D[_]=l[A],x[_]=w}for(var N=0;N<p;N++)S===0&&(b[N]=[]),x[N]===w?b[N][S]=s?y(a,D[N]):y(D[N],a):b[N][S]=a}return new r({data:b,size:[p,m],datatype:v})}}),mre="matAlgo13xDD",vre=["typed"],gre=Q(mre,vre,e=>{var{typed:t}=e;return function(i,a,o){var s=i._data,l=i._size,u=i._datatype,c=a._data,d=a._size,f=a._datatype,p=[];if(l.length!==d.length)throw new Ot(l.length,d.length);for(var m=0;m<l.length;m++){if(l[m]!==d[m])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");p[m]=l[m]}var v,y=o;typeof u=="string"&&u===f&&(v=u,y=t.find(o,[v,v]));var b=p.length>0?r(y,0,p,p[0],s,c):[];return i.createDenseMatrix({data:b,size:p,datatype:v})};function r(n,i,a,o,s,l){var u=[];if(i===a.length-1)for(var c=0;c<o;c++)u[c]=n(s[c],l[c]);else for(var d=0;d<o;d++)u[d]=r(n,i+1,a,a[i+1],s[d],l[d]);return u}}),yre="broadcast",bre=["concat"],xre=Q(yre,bre,e=>{var{concat:t}=e;return function(a,o){var s=Math.max(a._size.length,o._size.length);if(a._size.length===o._size.length&&a._size.every((y,b)=>y===o._size[b]))return[a,o];for(var l=r(a._size,s,0),u=r(o._size,s,0),c=[],d=0;d<s;d++)c[d]=Math.max(l[d],u[d]);for(var f=0;f<s;f++)i(l,c,f),i(u,c,f);var p=a.clone(),m=o.clone();p._size.length<s?p.reshape(r(p._size,s,1)):m._size.length<s&&m.reshape(r(m._size,s,1));for(var v=0;v<s;v++)p._size[v]<c[v]&&(p=n(p,c[v],v)),m._size[v]<c[v]&&(m=n(m,c[v],v));return[p,m]};function r(a,o,s){return[...Array(o-a.length).fill(s),...a]}function n(a,o,s){return t(...Array(o).fill(a),s)}function i(a,o,s){if(a[s]<o[s]&a[s]>1)throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(a,") not possible to broadcast dimension ").concat(s," with size ").concat(a[s]," to size ").concat(o[s]))}}),wre="matrixAlgorithmSuite",Cre=["typed","matrix","concat"],vr=Q(wre,Cre,e=>{var{typed:t,matrix:r,concat:n}=e,i=gre({typed:t}),a=Ui({typed:t}),o=xre({concat:n});return function(l){var u=l.elop,c=l.SD||l.DS,d;u?(d={"DenseMatrix, DenseMatrix":(v,y)=>i(...o(v,y),u),"Array, Array":(v,y)=>i(...o(r(v),r(y)),u).valueOf(),"Array, DenseMatrix":(v,y)=>i(...o(r(v),y),u),"DenseMatrix, Array":(v,y)=>i(...o(v,r(y)),u)},l.SS&&(d["SparseMatrix, SparseMatrix"]=(v,y)=>l.SS(...o(v,y),u,!1)),l.DS&&(d["DenseMatrix, SparseMatrix"]=(v,y)=>l.DS(...o(v,y),u,!1),d["Array, SparseMatrix"]=(v,y)=>l.DS(...o(r(v),y),u,!1)),c&&(d["SparseMatrix, DenseMatrix"]=(v,y)=>c(...o(y,v),u,!0),d["SparseMatrix, Array"]=(v,y)=>c(...o(r(y),v),u,!0))):(d={"DenseMatrix, DenseMatrix":t.referToSelf(v=>(y,b)=>i(...o(y,b),v)),"Array, Array":t.referToSelf(v=>(y,b)=>i(...o(r(y),r(b)),v).valueOf()),"Array, DenseMatrix":t.referToSelf(v=>(y,b)=>i(...o(r(y),b),v)),"DenseMatrix, Array":t.referToSelf(v=>(y,b)=>i(...o(y,r(b)),v))},l.SS&&(d["SparseMatrix, SparseMatrix"]=t.referToSelf(v=>(y,b)=>l.SS(...o(y,b),v,!1))),l.DS&&(d["DenseMatrix, SparseMatrix"]=t.referToSelf(v=>(y,b)=>l.DS(...o(y,b),v,!1)),d["Array, SparseMatrix"]=t.referToSelf(v=>(y,b)=>l.DS(...o(r(y),b),v,!1))),c&&(d["SparseMatrix, DenseMatrix"]=t.referToSelf(v=>(y,b)=>c(...o(b,y),v,!0)),d["SparseMatrix, Array"]=t.referToSelf(v=>(y,b)=>c(...o(r(b),y),v,!0))));var f=l.scalar||"any",p=l.Ds||l.Ss;p&&(u?(d["DenseMatrix,"+f]=(v,y)=>a(v,y,u,!1),d[f+", DenseMatrix"]=(v,y)=>a(y,v,u,!0),d["Array,"+f]=(v,y)=>a(r(v),y,u,!1).valueOf(),d[f+", Array"]=(v,y)=>a(r(y),v,u,!0).valueOf()):(d["DenseMatrix,"+f]=t.referToSelf(v=>(y,b)=>a(y,b,v,!1)),d[f+", DenseMatrix"]=t.referToSelf(v=>(y,b)=>a(b,y,v,!0)),d["Array,"+f]=t.referToSelf(v=>(y,b)=>a(r(y),b,v,!1).valueOf()),d[f+", Array"]=t.referToSelf(v=>(y,b)=>a(r(b),y,v,!0).valueOf())));var m=l.sS!==void 0?l.sS:l.Ss;return u?(l.Ss&&(d["SparseMatrix,"+f]=(v,y)=>l.Ss(v,y,u,!1)),m&&(d[f+", SparseMatrix"]=(v,y)=>m(y,v,u,!0))):(l.Ss&&(d["SparseMatrix,"+f]=t.referToSelf(v=>(y,b)=>l.Ss(y,b,v,!1))),m&&(d[f+", SparseMatrix"]=t.referToSelf(v=>(y,b)=>m(b,y,v,!0)))),u&&u.signatures&&hM(d,u.signatures),d}});function wa(e,t,r,n){if(!(this instanceof wa))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}wa.prototype=new Error,wa.prototype.constructor=Error,wa.prototype.name="ArgumentsError",wa.prototype.isArgumentsError=!0;var MO="gcd",Sre=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],mw="number | BigNumber | Fraction | Matrix | Array",Dre="".concat(mw,", ").concat(mw,", ...").concat(mw);function TO(e){return!e.some(t=>Array.isArray(t))}var Np=Q(MO,Sre,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=hw({typed:t,equalScalar:n}),u=gs({typed:t,DenseMatrix:a}),c=vr({typed:t,matrix:r,concat:o});return t(MO,{"number, number":mT,"BigNumber, BigNumber":d,"Fraction, Fraction":(f,p)=>f.gcd(p)},c({SS:l,DS:s,Ss:u}),{[Dre]:t.referToSelf(f=>(p,m,v)=>{for(var y=f(p,m),b=0;b<v.length;b++)y=f(y,v[b]);return y}),Array:t.referToSelf(f=>p=>{if(p.length===1&&Array.isArray(p[0])&&TO(p[0]))return f(...p[0]);if(TO(p))return f(...p);throw new wa("gcd() supports only 1d matrices!")}),Matrix:t.referToSelf(f=>p=>f(p.toArray()))});function d(f,p){if(!f.isInt()||!p.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var m=new i(0);!p.isZero();){var v=f.mod(p);f=p,p=v}return f.lt(m)?f.neg():f}}),Ere="matAlgo02xDS0",Nre=["typed","equalScalar"],Wi=Q(Ere,Nre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,d=a._values,f=a._index,p=a._ptr,m=a._size,v=a._datatype;if(u.length!==m.length)throw new Ot(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!d)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var y=u[0],b=u[1],D,x=r,S=0,w=o;typeof c=="string"&&c===v&&(D=c,x=t.find(r,[D,D]),S=t.convert(0,D),w=t.find(o,[D,D]));for(var C=[],E=[],A=[],_=0;_<b;_++){A[_]=E.length;for(var N=p[_],M=p[_+1],R=N;R<M;R++){var F=f[R],k=s?w(d[R],l[F][_]):w(l[F][_],d[R]);x(k,S)||(E.push(F),C.push(k))}}return A[b]=E.length,a.createSparseMatrix({values:C,index:E,ptr:A,size:[y,b],datatype:D})}}),Are="matAlgo06xS0S0",_re=["typed","equalScalar"],Ap=Q(Are,_re,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._size,u=i._datatype,c=a._values,d=a._size,f=a._datatype;if(l.length!==d.length)throw new Ot(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");var p=l[0],m=l[1],v,y=r,b=0,D=o;typeof u=="string"&&u===f&&(v=u,y=t.find(r,[v,v]),b=t.convert(0,v),D=t.find(o,[v,v]));for(var x=s&&c?[]:void 0,S=[],w=[],C=x?[]:void 0,E=[],A=[],_=0;_<m;_++){w[_]=S.length;var N=_+1;if(aT(i,_,E,C,A,N,S,D),aT(a,_,E,C,A,N,S,D),C)for(var M=w[_];M<S.length;){var R=S[M];if(A[R]===N){var F=C[R];y(F,b)?S.splice(M,1):(x.push(F),M++)}else S.splice(M,1)}else for(var k=w[_];k<S.length;){var P=S[k];A[P]!==N?S.splice(k,1):k++}}return w[m]=S.length,i.createSparseMatrix({values:x,index:S,ptr:w,size:[p,m],datatype:v})}}),OO="lcm",Mre=["typed","matrix","equalScalar","concat"],_p=Q(OO,Mre,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=Wi({typed:t,equalScalar:n}),o=Ap({typed:t,equalScalar:n}),s=Cn({typed:t,equalScalar:n}),l=vr({typed:t,matrix:r,concat:i}),u="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(u,", ").concat(u,", ...").concat(u)]=t.referToSelf(f=>(p,m,v)=>{for(var y=f(p,m),b=0;b<v.length;b++)y=f(y,v[b]);return y}),t(OO,{"number, number":vT,"BigNumber, BigNumber":d,"Fraction, Fraction":(f,p)=>f.lcm(p)},l({SS:o,DS:a,Ss:s}),c);function d(f,p){if(!f.isInt()||!p.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(f.isZero())return f;if(p.isZero())return p;for(var m=f.times(p);!p.isZero();){var v=p;p=f.mod(v),f=v}return m.div(f).abs()}}),RO="log10",Tre=["typed","config","Complex"],Mp=Q(RO,Tre,e=>{var{typed:t,config:r,Complex:n}=e;return t(RO,{number:function(a){return a>=0||r.predictable?gT(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||r.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf(i=>a=>zt(a,i))})}),IO="log2",Ore=["typed","config","Complex"],Tp=Q(IO,Ore,e=>{var{typed:t,config:r,Complex:n}=e;return t(IO,{number:function(o){return o>=0||r.predictable?yT(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||r.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":t.referToSelf(a=>o=>zt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}}),Rre="matAlgo03xDSf",Ire=["typed"],Vn=Q(Rre,Ire,e=>{var{typed:t}=e;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype,c=i._values,d=i._index,f=i._ptr,p=i._size,m=i._datatype;if(l.length!==p.length)throw new Ot(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=l[0],y=l[1],b,D=0,x=a;typeof u=="string"&&u===m&&(b=u,D=t.convert(0,b),x=t.find(a,[b,b]));for(var S=[],w=0;w<v;w++)S[w]=[];for(var C=[],E=[],A=0;A<y;A++){for(var _=A+1,N=f[A],M=f[A+1],R=N;R<M;R++){var F=d[R];C[F]=o?x(c[R],s[F][A]):x(s[F][A],c[R]),E[F]=_}for(var k=0;k<v;k++)E[k]===_?S[k][A]=C[k]:S[k][A]=o?x(D,s[k][A]):x(s[k][A],D)}return n.createDenseMatrix({data:S,size:[v,y],datatype:b})}}),kre="matAlgo05xSfSf",Pre=["typed","equalScalar"],Op=Q(kre,Pre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));var E=s&&f?[]:void 0,A=[],_=[],N=E?[]:void 0,M=E?[]:void 0,R=[],F=[],k,P,T,O;for(P=0;P<D;P++){_[P]=A.length;var L=P+1;for(T=u[P],O=u[P+1];T<O;T++)k=l[T],A.push(k),R[k]=L,N&&(N[k]=s[T]);for(T=m[P],O=m[P+1];T<O;T++)k=p[T],R[k]!==L&&A.push(k),F[k]=L,M&&(M[k]=f[T]);if(E)for(T=_[P];T<A.length;){k=A[T];var I=R[k],V=F[k];if(I===L||V===L){var H=I===L?N[k]:w,Z=V===L?M[k]:w,G=C(H,Z);S(G,w)?A.splice(T,1):(E.push(G),T++)}}}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),kO="mod",Fre=["typed","matrix","equalScalar","DenseMatrix","concat"],Rp=Q(kO,Fre,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Wi({typed:t,equalScalar:n}),s=Vn({typed:t}),l=Op({typed:t,equalScalar:n}),u=Cn({typed:t,equalScalar:n}),c=sn({typed:t,DenseMatrix:i}),d=vr({typed:t,matrix:r,concat:a});return t(kO,{"number, number":bT,"BigNumber, BigNumber":function(p,m){if(m.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return m.isZero()?p:p.mod(m)},"Fraction, Fraction":function(p,m){if(m.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return p.compare(0)>=0?p.mod(m):p.mod(m).add(m).mod(m)}},d({SS:l,DS:s,SD:o,Ss:u,sS:c}))}),$re="multiplyScalar",Bre=["typed"],Ip=Q($re,Bre,e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":uT,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(r,n)=>n.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,n)=>r.multiply(n)})}),PO="multiply",zre=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],kp=Q(PO,zre,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=Cn({typed:t,equalScalar:a}),l=Ui({typed:t});function u(w,C){switch(w.length){case 1:switch(C.length){case 1:if(w[0]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(w[0]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+w[0]+") must match Matrix rows ("+C[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+C.length+" dimensions)")}break;case 2:switch(C.length){case 1:if(w[1]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+w[1]+") must match Vector length ("+C[0]+")");break;case 2:if(w[1]!==C[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+w[1]+") must match Matrix B rows ("+C[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+C.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+w.length+" dimensions)")}}function c(w,C,E){if(E===0)throw new Error("Cannot multiply two empty vectors");return o(w,C)}function d(w,C){if(C.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return f(w,C)}function f(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._data,M=C._size,R=C._datatype,F=A[0],k=M[1],P,T=n,O=i;_&&R&&_===R&&typeof _=="string"&&(P=_,T=t.find(n,[P,P]),O=t.find(i,[P,P]));for(var L=[],I=0;I<k;I++){for(var V=O(E[0],N[0][I]),H=1;H<F;H++)V=T(V,O(E[H],N[H][I]));L[I]=V}return w.createDenseMatrix({data:L,size:[k],datatype:P})}var p=t("_multiplyMatrixVector",{"DenseMatrix, any":v,"SparseMatrix, any":D}),m=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":y,"DenseMatrix, SparseMatrix":b,"SparseMatrix, DenseMatrix":x,"SparseMatrix, SparseMatrix":S});function v(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._data,M=C._datatype,R=A[0],F=A[1],k,P=n,T=i;_&&M&&_===M&&typeof _=="string"&&(k=_,P=t.find(n,[k,k]),T=t.find(i,[k,k]));for(var O=[],L=0;L<R;L++){for(var I=E[L],V=T(I[0],N[0]),H=1;H<F;H++)V=P(V,T(I[H],N[H]));O[L]=V}return w.createDenseMatrix({data:O,size:[R],datatype:k})}function y(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._data,M=C._size,R=C._datatype,F=A[0],k=A[1],P=M[1],T,O=n,L=i;_&&R&&_===R&&typeof _=="string"&&(T=_,O=t.find(n,[T,T]),L=t.find(i,[T,T]));for(var I=[],V=0;V<F;V++){var H=E[V];I[V]=[];for(var Z=0;Z<P;Z++){for(var G=L(H[0],N[0][Z]),Y=1;Y<k;Y++)G=O(G,L(H[Y],N[Y][Z]));I[V][Z]=G}}return w.createDenseMatrix({data:I,size:[F,P],datatype:T})}function b(w,C){var E=w._data,A=w._size,_=w._datatype,N=C._values,M=C._index,R=C._ptr,F=C._size,k=C._datatype;if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var P=A[0],T=F[1],O,L=n,I=i,V=a,H=0;_&&k&&_===k&&typeof _=="string"&&(O=_,L=t.find(n,[O,O]),I=t.find(i,[O,O]),V=t.find(a,[O,O]),H=t.convert(0,O));for(var Z=[],G=[],Y=[],re=C.createSparseMatrix({values:Z,index:G,ptr:Y,size:[P,T],datatype:O}),ne=0;ne<T;ne++){Y[ne]=G.length;var pe=R[ne],he=R[ne+1];if(he>pe)for(var le=0,fe=0;fe<P;fe++){for(var xe=fe+1,ge=void 0,ve=pe;ve<he;ve++){var Ee=M[ve];le!==xe?(ge=I(E[fe][Ee],N[ve]),le=xe):ge=L(ge,I(E[fe][Ee],N[ve]))}le===xe&&!V(ge,H)&&(G.push(fe),Z.push(ge))}}return Y[T]=G.length,re}function D(w,C){var E=w._values,A=w._index,_=w._ptr,N=w._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=C._data,R=C._datatype,F=w._size[0],k=C._size[0],P=[],T=[],O=[],L,I=n,V=i,H=a,Z=0;N&&R&&N===R&&typeof N=="string"&&(L=N,I=t.find(n,[L,L]),V=t.find(i,[L,L]),H=t.find(a,[L,L]),Z=t.convert(0,L));var G=[],Y=[];O[0]=0;for(var re=0;re<k;re++){var ne=M[re];if(!H(ne,Z))for(var pe=_[re],he=_[re+1],le=pe;le<he;le++){var fe=A[le];Y[fe]?G[fe]=I(G[fe],V(ne,E[le])):(Y[fe]=!0,T.push(fe),G[fe]=V(ne,E[le]))}}for(var xe=T.length,ge=0;ge<xe;ge++){var ve=T[ge];P[ge]=G[ve]}return O[1]=T.length,w.createSparseMatrix({values:P,index:T,ptr:O,size:[F,1],datatype:L})}function x(w,C){var E=w._values,A=w._index,_=w._ptr,N=w._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=C._data,R=C._datatype,F=w._size[0],k=C._size[0],P=C._size[1],T,O=n,L=i,I=a,V=0;N&&R&&N===R&&typeof N=="string"&&(T=N,O=t.find(n,[T,T]),L=t.find(i,[T,T]),I=t.find(a,[T,T]),V=t.convert(0,T));for(var H=[],Z=[],G=[],Y=w.createSparseMatrix({values:H,index:Z,ptr:G,size:[F,P],datatype:T}),re=[],ne=[],pe=0;pe<P;pe++){G[pe]=Z.length;for(var he=pe+1,le=0;le<k;le++){var fe=M[le][pe];if(!I(fe,V))for(var xe=_[le],ge=_[le+1],ve=xe;ve<ge;ve++){var Ee=A[ve];ne[Ee]!==he?(ne[Ee]=he,Z.push(Ee),re[Ee]=L(fe,E[ve])):re[Ee]=O(re[Ee],L(fe,E[ve]))}}for(var q=G[pe],J=Z.length,ce=q;ce<J;ce++){var X=Z[ce];H[ce]=re[X]}}return G[P]=Z.length,Y}function S(w,C){var E=w._values,A=w._index,_=w._ptr,N=w._datatype,M=C._values,R=C._index,F=C._ptr,k=C._datatype,P=w._size[0],T=C._size[1],O=E&&M,L,I=n,V=i;N&&k&&N===k&&typeof N=="string"&&(L=N,I=t.find(n,[L,L]),V=t.find(i,[L,L]));for(var H=O?[]:void 0,Z=[],G=[],Y=w.createSparseMatrix({values:H,index:Z,ptr:G,size:[P,T],datatype:L}),re=O?[]:void 0,ne=[],pe,he,le,fe,xe,ge,ve,Ee,q=0;q<T;q++){G[q]=Z.length;var J=q+1;for(xe=F[q],ge=F[q+1],fe=xe;fe<ge;fe++)if(Ee=R[fe],O)for(he=_[Ee],le=_[Ee+1],pe=he;pe<le;pe++)ve=A[pe],ne[ve]!==J?(ne[ve]=J,Z.push(ve),re[ve]=V(M[fe],E[pe])):re[ve]=I(re[ve],V(M[fe],E[pe]));else for(he=_[Ee],le=_[Ee+1],pe=he;pe<le;pe++)ve=A[pe],ne[ve]!==J&&(ne[ve]=J,Z.push(ve));if(O)for(var ce=G[q],X=Z.length,te=ce;te<X;te++){var ae=Z[te];H[te]=re[ae]}}return G[T]=Z.length,Y}return t(PO,i,{"Array, Array":t.referTo("Matrix, Matrix",w=>(C,E)=>{u(qt(C),qt(E));var A=w(r(C),r(E));return ft(A)?A.valueOf():A}),"Matrix, Matrix":function(C,E){var A=C.size(),_=E.size();return u(A,_),A.length===1?_.length===1?c(C,E,A[0]):d(C,E):_.length===1?p(C,E):m(C,E)},"Matrix, Array":t.referTo("Matrix,Matrix",w=>(C,E)=>w(C,r(E))),"Array, Matrix":t.referToSelf(w=>(C,E)=>w(r(C,E.storage()),E)),"SparseMatrix, any":function(C,E){return s(C,E,i,!1)},"DenseMatrix, any":function(C,E){return l(C,E,i,!1)},"any, SparseMatrix":function(C,E){return s(E,C,i,!0)},"any, DenseMatrix":function(C,E){return l(E,C,i,!0)},"Array, any":function(C,E){return l(r(C),E,i,!1).valueOf()},"any, Array":function(C,E){return l(r(E),C,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(w=>(C,E,A)=>{for(var _=w(C,E),N=0;N<A.length;N++)_=w(_,A[N]);return _})})}),FO="nthRoot",Lre=["typed","matrix","equalScalar","BigNumber","concat"],Pp=Q(FO,Lre,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,concat:a}=e,o=Bo({typed:t}),s=Wi({typed:t,equalScalar:n}),l=Ap({typed:t,equalScalar:n}),u=Cn({typed:t,equalScalar:n}),c=vr({typed:t,matrix:r,concat:a});function d(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(FO,{number:xT,"number, number":xT,BigNumber:p=>f(p,new i(2)),"BigNumber, BigNumber":f,Complex:d,"Complex, number":d,Array:t.referTo("DenseMatrix,number",p=>m=>p(r(m),2).valueOf()),DenseMatrix:t.referTo("DenseMatrix,number",p=>m=>p(m,2)),SparseMatrix:t.referTo("SparseMatrix,number",p=>m=>p(m,2)),"SparseMatrix, SparseMatrix":t.referToSelf(p=>(m,v)=>{if(v.density()===1)return l(m,v,p);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":t.referToSelf(p=>(m,v)=>{if(v.density()===1)return o(m,v,p,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",p=>(m,v)=>p(r(m),v)),"number | BigNumber, SparseMatrix":t.referToSelf(p=>(m,v)=>{if(v.density()===1)return u(v,m,p,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:s,Ss:u,sS:!1}));function f(p,m){var v=i.precision,y=i.clone({precision:v+2}),b=new i(0),D=new y(1),x=m.isNegative();if(x&&(m=m.neg()),m.isZero())throw new Error("Root must be non-zero");if(p.isNegative()&&!m.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(p.isZero())return x?new y(1/0):0;if(!p.isFinite())return x?b:p;var S=p.abs().pow(D.div(m));return S=p.isNeg()?S.neg():S,new i((x?D.div(S):S).toPrecision(v))}}),$O="sign",Vre=["typed","BigNumber","Fraction","complex"],Fp=Q($O,Vre,e=>{var{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t($O,{number:uw,Complex:function(o){return o.im===0?n(uw(o.re)):o.sign()},BigNumber:function(o){return new r(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":t.referToSelf(a=>o=>zt(o,a)),Unit:t.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return t.find(a,o.valueType())(o.value)})})}),qre="sqrt",Gre=["config","typed","Complex"],$p=Q(qre,Gre,e=>{var{config:t,typed:r,Complex:n}=e;return r("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||t.predictable?Math.sqrt(a):new n(a,0).sqrt()}}),BO="square",Ure=["typed"],Bp=Q(BO,Ure,e=>{var{typed:t}=e;return t(BO,{number:wT,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})}),zO="subtract",Wre=["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix","concat"],zp=Q(zO,Wre,e=>{var{typed:t,matrix:r,equalScalar:n,addScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,l=Bo({typed:t}),u=Vn({typed:t}),c=Op({typed:t,equalScalar:n}),d=gs({typed:t,DenseMatrix:o}),f=sn({typed:t,DenseMatrix:o}),p=vr({typed:t,matrix:r,concat:s});return t(zO,{"number, number":(m,v)=>m-v,"Complex, Complex":(m,v)=>m.sub(v),"BigNumber, BigNumber":(m,v)=>m.minus(v),"Fraction, Fraction":(m,v)=>m.sub(v),"Unit, Unit":t.referToSelf(m=>(v,y)=>{if(v.value===null)throw new Error("Parameter x contains a unit with undefined value");if(y.value===null)throw new Error("Parameter y contains a unit with undefined value");if(!v.equalBase(y))throw new Error("Units do not match");var b=v.clone();return b.value=t.find(m,[b.valueType(),y.valueType()])(b.value,y.value),b.fixPrefix=!1,b})},p({SS:c,DS:l,SD:u,Ss:f,sS:d}))}),LO="xgcd",Hre=["typed","config","matrix","BigNumber"],Lp=Q(LO,Hre,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(LO,{"number, number":function(s,l){var u=CT(s,l);return r.matrix==="Array"?u:n(u)},"BigNumber, BigNumber":a});function a(o,s){var l,u,c,d=new i(0),f=new i(1),p=d,m=f,v=f,y=d;if(!o.isInt()||!s.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!s.isZero();)u=o.div(s).floor(),c=o.mod(s),l=p,p=m.minus(u.times(p)),m=l,l=v,v=y.minus(u.times(v)),y=l,o=s,s=c;var b;return o.lt(d)?b=[o.neg(),m.neg(),y.neg()]:b=[o,o.isZero()?0:m,y],r.matrix==="Array"?b:n(b)}}),VO="invmod",jre=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Vp=Q(VO,jre,e=>{var{typed:t,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=e;return t(VO,{"number, number":c,"BigNumber, BigNumber":c});function c(d,f){if(!u(d)||!u(f))throw new Error("Parameters in function invmod must be integer numbers");if(d=s(d,f),a(f,0))throw new Error("Divisor must be non zero");var p=i(d,f);p=p.valueOf();var[m,v]=p;return a(m,n(1))?(v=s(v,f),o(v,n(0))&&(v=l(v,f)),v):NaN}}),Kre="matAlgo09xS0Sf",Yre=["typed","equalScalar"],qO=Q(Kre,Yre,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));var E=s&&f?[]:void 0,A=[],_=[],N=E?[]:void 0,M=[],R,F,k,P,T;for(F=0;F<D;F++){_[F]=A.length;var O=F+1;if(N)for(P=m[F],T=m[F+1],k=P;k<T;k++)R=p[k],M[R]=O,N[R]=f[k];for(P=u[F],T=u[F+1],k=P;k<T;k++)if(R=l[k],N){var L=M[R]===O?N[R]:w,I=C(s[k],L);S(I,w)||(A.push(R),E.push(I))}else A.push(R)}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),GO="dotMultiply",Xre=["typed","matrix","equalScalar","multiplyScalar","concat"],qp=Q(GO,Xre,e=>{var{typed:t,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=e,o=Wi({typed:t,equalScalar:n}),s=qO({typed:t,equalScalar:n}),l=Cn({typed:t,equalScalar:n}),u=vr({typed:t,matrix:r,concat:a});return t(GO,u({elop:i,SS:s,DS:o,Ss:l}))});function Zre(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(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 r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return vw(e,t,function(n,i){return n&i})}function ec(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function Qre(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);var n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:!e.isFinite()||!t.isFinite()?!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e:vw(e,t,function(i,a){return i|a})}function vw(e,t,r){var n=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=Gp(ec(e));for(var l=0;l<i.length;++l)i[l]^=1}else i=Gp(e);if(s){a=Gp(ec(t));for(var u=0;u<a.length;++u)a[u]^=1}else a=Gp(t);var c,d,f;i.length<=a.length?(c=i,d=a,f=o):(c=a,d=i,f=s);var p=c.length,m=d.length,v=r(o,s)^1,y=new n(v^1),b=new n(1),D=new n(2),x=n.precision;for(n.config({precision:1e9});p>0;)r(c[--p],d[--m])===v&&(y=y.plus(b)),b=b.times(D);for(;m>0;)r(f,d[--m])===v&&(y=y.plus(b)),b=b.times(D);return n.config({precision:x}),v===0&&(y.s=-y.s),y}function Gp(e){for(var t=e.d,r=t[0]+"",n=1;n<t.length;++n){for(var i=t[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;r.charAt(o)==="0";)o--;var s=e.e,l=r.slice(0,o+1||1),u=l.length;if(s>0)if(++s>u)for(s-=u;s--;)l+="0";else s<u&&(l=l.slice(0,s)+"."+l.slice(s));for(var c=[0],d=0;d<l.length;){for(var f=c.length;f--;)c[f]*=10;c[0]+=parseInt(l.charAt(d++));for(var p=0;p<c.length;++p)c[p]>1&&((c[p+1]===null||c[p+1]===void 0)&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function Jre(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?ec(t):t.eq(n)?ec(e):!e.isFinite()||!t.isFinite()?!e.isFinite()&&!t.isFinite()?n:new r(e.isNegative()===t.isNegative()?1/0:-1/0):vw(e,t,function(i,a){return i^a})}function ene(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:!e.isFinite()&&!t.isFinite()?new r(NaN):t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t))}function tne(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}var UO="bitAnd",rne=["typed","matrix","equalScalar","concat"],Up=Q(UO,rne,e=>{var{typed:t,matrix:r,equalScalar:n,concat:i}=e,a=Wi({typed:t,equalScalar:n}),o=Ap({typed:t,equalScalar:n}),s=Cn({typed:t,equalScalar:n}),l=vr({typed:t,matrix:r,concat:i});return t(UO,{"number, number":ET,"BigNumber, BigNumber":Zre},l({SS:o,DS:a,Ss:s}))}),WO="bitNot",nne=["typed"],Wp=Q(WO,nne,e=>{var{typed:t}=e;return t(WO,{number:NT,BigNumber:ec,"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),HO="bitOr",ine=["typed","matrix","equalScalar","DenseMatrix","concat"],Hp=Q(HO,ine,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:t}),s=hw({typed:t,equalScalar:n}),l=gs({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:r,concat:a});return t(HO,{"number, number":AT,"BigNumber, BigNumber":Qre},u({SS:s,DS:o,Ss:l}))}),ane="matAlgo07xSSf",one=["typed","DenseMatrix"],Ca=Q(ane,one,e=>{var{typed:t,DenseMatrix:r}=e;return function(a,o,s){var l=a._size,u=a._datatype,c=o._size,d=o._datatype;if(l.length!==c.length)throw new Ot(l.length,c.length);if(l[0]!==c[0]||l[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+c+")");var f=l[0],p=l[1],m,v=0,y=s;typeof u=="string"&&u===d&&(m=u,v=t.convert(0,m),y=t.find(s,[m,m]));var b,D,x=[];for(b=0;b<f;b++)x[b]=[];var S=[],w=[],C=[],E=[];for(D=0;D<p;D++){var A=D+1;for(n(a,D,C,S,A),n(o,D,E,w,A),b=0;b<f;b++){var _=C[b]===A?S[b]:v,N=E[b]===A?w[b]:v;x[b][D]=y(_,N)}}return new r({data:x,size:[f,p],datatype:m})};function n(i,a,o,s,l){for(var u=i._values,c=i._index,d=i._ptr,f=d[a],p=d[a+1];f<p;f++){var m=c[f];o[m]=l,s[m]=u[f]}}}),jO="bitXor",sne=["typed","matrix","DenseMatrix","concat"],jp=Q(jO,sne,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=Vn({typed:t}),o=Ca({typed:t,DenseMatrix:n}),s=sn({typed:t,DenseMatrix:n}),l=vr({typed:t,matrix:r,concat:i});return t(jO,{"number, number":_T,"BigNumber, BigNumber":Jre},l({SS:o,DS:a,Ss:s}))}),KO="arg",lne=["typed"],Kp=Q(KO,lne,e=>{var{typed:t}=e;return t(KO,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),YO="conj",une=["typed"],Yp=Q(YO,une,e=>{var{typed:t}=e;return t(YO,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),XO="im",cne=["typed"],Xp=Q(XO,cne,e=>{var{typed:t}=e;return t(XO,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),ZO="re",dne=["typed"],Zp=Q(ZO,dne,e=>{var{typed:t}=e;return t(ZO,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),QO="not",fne=["typed"],Qp=Q(QO,fne,e=>{var{typed:t}=e;return t(QO,{"null | undefined":()=>!0,number:IT,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:t.referToSelf(r=>n=>t.find(r,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),JO="or",pne=["typed","matrix","equalScalar","DenseMatrix","concat"],Jp=Q(JO,pne,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Op({typed:t,equalScalar:n}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:r,concat:a});return t(JO,{"number, number":kT,"Complex, Complex":function(d,f){return d.re!==0||d.im!==0||f.re!==0||f.im!==0},"BigNumber, BigNumber":function(d,f){return!d.isZero()&&!d.isNaN()||!f.isZero()&&!f.isNaN()},"Unit, Unit":t.referToSelf(c=>(d,f)=>c(d.value||0,f.value||0))},u({SS:s,DS:o,Ss:l}))}),eR="xor",hne=["typed","matrix","DenseMatrix","concat"],eh=Q(eR,hne,e=>{var{typed:t,matrix:r,DenseMatrix:n,concat:i}=e,a=Vn({typed:t}),o=Ca({typed:t,DenseMatrix:n}),s=sn({typed:t,DenseMatrix:n}),l=vr({typed:t,matrix:r,concat:i});return t(eR,{"number, number":PT,"Complex, Complex":function(c,d){return(c.re!==0||c.im!==0)!=(d.re!==0||d.im!==0)},"BigNumber, BigNumber":function(c,d){return(!c.isZero()&&!c.isNaN())!=(!d.isZero()&&!d.isNaN())},"Unit, Unit":t.referToSelf(u=>(c,d)=>u(c.value||0,d.value||0))},l({SS:o,DS:a,Ss:s}))}),tR="concat",mne=["typed","matrix","isInteger"],tc=Q(tR,mne,e=>{var{typed:t,matrix:r,isInteger:n}=e;return t(tR,{"...Array | Matrix | number | BigNumber":function(a){var o,s=a.length,l=-1,u,c=!1,d=[];for(o=0;o<s;o++){var f=a[o];if(ft(f)&&(c=!0),Ut(f)||kt(f)){if(o!==s-1)throw new Error("Dimension must be specified as last argument");if(u=l,l=f.valueOf(),!n(l))throw new TypeError("Integer number expected for dimension");if(l<0||o>0&&l>u)throw new ii(l,u+1)}else{var p=pt(f).valueOf(),m=qt(p);if(d[o]=p,u=l,l=m.length-1,o>0&&l!==u)throw new Ot(u+1,l+1)}}if(d.length===0)throw new SyntaxError("At least one matrix expected");for(var v=d.shift();d.length;)v=rR(v,d.shift(),l,0);return c?r(v):v},"...string":function(a){return a.join("")}})});function rR(e,t,r,n){if(n<r){if(e.length!==t.length)throw new Ot(e.length,t.length);for(var i=[],a=0;a<e.length;a++)i[a]=rR(e[a],t[a],r,n+1);return i}else return e.concat(t)}var nR="column",vne=["typed","Index","matrix","range"],rc=Q(nR,vne,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(nR,{"Matrix, number":a,"Array, number":function(s,l){return a(n(pt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");hr(s,o.size()[1]);var l=i(0,o.size()[0]),u=new r(l,s),c=o.subset(u);return ft(c)?c:n([[c]])}}),iR="count",gne=["typed","size","prod"],th=Q(iR,gne,e=>{var{typed:t,size:r,prod:n}=e;return t(iR,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})}),aR="cross",yne=["typed","matrix","subtract","multiply"],rh=Q(aR,yne,e=>{var{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(aR,{"Matrix, Matrix":function(s,l){return r(a(s.toArray(),l.toArray()))},"Matrix, Array":function(s,l){return r(a(s.toArray(),l))},"Array, Matrix":function(s,l){return r(a(s,l.toArray()))},"Array, Array":a});function a(o,s){var l=Math.max(qt(o).length,qt(s).length);o=xf(o),s=xf(s);var u=qt(o),c=qt(s);if(u.length!==1||c.length!==1||u[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+c.join(", ")+"])");var d=[n(i(o[1],s[2]),i(o[2],s[1])),n(i(o[2],s[0]),i(o[0],s[2])),n(i(o[0],s[1]),i(o[1],s[0]))];return l>1?[d]:d}}),oR="diag",bne=["typed","matrix","DenseMatrix","SparseMatrix"],nh=Q(oR,bne,e=>{var{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(oR,{Array:function(u){return a(u,0,qt(u),null)},"Array, number":function(u,c){return a(u,c,qt(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),qt(u),null)},"Array, string":function(u,c){return a(u,0,qt(u),c)},"Array, number, string":function(u,c,d){return a(u,c,qt(u),d)},"Array, BigNumber, string":function(u,c,d){return a(u,c.toNumber(),qt(u),d)},Matrix:function(u){return a(u,0,u.size(),u.storage())},"Matrix, number":function(u,c){return a(u,c,u.size(),u.storage())},"Matrix, BigNumber":function(u,c){return a(u,c.toNumber(),u.size(),u.storage())},"Matrix, string":function(u,c){return a(u,0,u.size(),c)},"Matrix, number, string":function(u,c,d){return a(u,c,u.size(),d)},"Matrix, BigNumber, string":function(u,c,d){return a(u,c.toNumber(),u.size(),d)}});function a(l,u,c,d){if(!ot(u))throw new TypeError("Second parameter in function diag must be an integer");var f=u>0?u:0,p=u<0?-u:0;switch(c.length){case 1:return o(l,u,d,c[0],p,f);case 2:return s(l,u,d,c,p,f)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(l,u,c,d,f,p){var m=[d+f,d+p];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var v=c==="sparse"?i.diagonal(m,l,u):n.diagonal(m,l,u);return c!==null?v:v.valueOf()}function s(l,u,c,d,f,p){if(ft(l)){var m=l.diagonal(u);return c!==null?c!==m.storage()?r(m,c):m:m.valueOf()}for(var v=Math.min(d[0]-f,d[1]-p),y=[],b=0;b<v;b++)y[b]=l[b+f][b+p];return c!==null?r(y):y}}),xne="filter",wne=["typed"],ih=Q(xne,wne,e=>{var{typed:t}=e;return t("filter",{"Array, function":sR,"Matrix, function":function(n,i){return n.create(sR(n.toArray(),i))},"Array, RegExp":Cf,"Matrix, RegExp":function(n,i){return n.create(Cf(n.toArray(),i))}})});function sR(e,t){var r=$o(t);return kM(e,function(n,i,a){return r===1?t(n):r===2?t(n,[i]):t(n,[i],a)})}var lR="flatten",Cne=["typed","matrix"],ah=Q(lR,Cne,e=>{var{typed:t,matrix:r}=e;return t(lR,{Array:function(i){return Qt(i)},Matrix:function(i){var a=Qt(i.toArray());return r(a)}})}),uR="forEach",Sne=["typed"],oh=Q(uR,Sne,e=>{var{typed:t}=e;return t(uR,{"Array, function":Dne,"Matrix, function":function(n,i){n.forEach(i)}})});function Dne(e,t){var r=$o(t),n=function i(a,o){Array.isArray(a)?wf(a,function(s,l){i(s,o.concat(l))}):r===1?t(a):r===2?t(a,o):t(a,o,e)};n(e,[])}var cR="getMatrixDataType",Ene=["typed"],sh=Q(cR,Ene,e=>{var{typed:t}=e;return t(cR,{Array:function(n){return Ku(n,Or)},Matrix:function(n){return n.getDataType()}})}),dR="identity",Nne=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],lh=Q(dR,Nne,e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(dR,{"":function(){return r.matrix==="Matrix"?n([]):[]},string:function(c){return n(c)},"number | BigNumber":function(c){return l(c,c,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,d){return l(c,c,d)},"number | BigNumber, number | BigNumber":function(c,d){return l(c,d,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,d,f){return l(c,d,f)},Array:function(c){return s(c)},"Array, string":function(c,d){return s(c,d)},Matrix:function(c){return s(c.valueOf(),c.storage())},"Matrix, string":function(c,d){return s(c.valueOf(),d)}});function s(u,c){switch(u.length){case 0:return c?n(c):[];case 1:return l(u[0],u[0],c);case 2:return l(u[0],u[1],c);default:throw new Error("Vector containing two values expected")}}function l(u,c,d){var f=kt(u)||kt(c)?i:null;if(kt(u)&&(u=u.toNumber()),kt(c)&&(c=c.toNumber()),!ot(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!ot(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var p=f?new i(1):1,m=f?new f(0):0,v=[u,c];if(d){if(d==="sparse")return o.diagonal(v,p,0,m);if(d==="dense")return a.diagonal(v,p,0,m);throw new TypeError('Unknown matrix type "'.concat(d,'"'))}for(var y=xl([],v,m),b=u<c?u:c,D=0;D<b;D++)y[D][D]=p;return y}}),fR="kron",Ane=["typed","matrix","multiplyScalar"],uh=Q(fR,Ane,e=>{var{typed:t,matrix:r,multiplyScalar:n}=e;return t(fR,{"Matrix, Matrix":function(o,s){return r(i(o.toArray(),s.toArray()))},"Matrix, Array":function(o,s){return r(i(o.toArray(),s))},"Array, Matrix":function(o,s){return r(i(o,s.toArray()))},"Array, Array":i});function i(a,o){if(qt(a).length===1&&(a=[a]),qt(o).length===1&&(o=[o]),qt(a).length>2||qt(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var s=[],l=[];return a.map(function(u){return o.map(function(c){return l=[],s.push(l),u.map(function(d){return c.map(function(f){return l.push(n(d,f))})})})})&&s}}),pR="map",_ne=["typed"],ch=Q(pR,_ne,e=>{var{typed:t}=e;return t(pR,{"Array, function":Mne,"Matrix, function":function(n,i){return n.map(i)}})});function Mne(e,t){var r=$o(t),n=function i(a,o){if(Array.isArray(a))return a.map(function(u,c){return i(u,o.concat(c))});try{return r===1?t(a):r===2?t(a,o):t(a,o,e)}catch(u){if(u instanceof TypeError&&"data"in u&&u.data.category==="wrongType"){var s="map attempted to call '".concat(u.data.fn,"(").concat(a),l=JSON.stringify(o);throw r===2?s+=","+l:r!==1&&(s+=",".concat(l,",").concat(e)),s+=")' but argument ".concat(u.data.index+1," of type "),s+="".concat(u.data.actual," does not match expected type "),s+=u.data.expected.join(" or "),new TypeError(s)}throw u}};return n(e,[])}var hR="diff",Tne=["typed","matrix","subtract","number"],nc=Q(hR,Tne,e=>{var{typed:t,matrix:r,subtract:n,number:i}=e;return t(hR,{"Array | Matrix":function(c){return ft(c)?r(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,d){if(!ot(d))throw new RangeError("Dimension must be a whole number");return ft(c)?r(a(c.toArray(),d)):a(c,d)},"Array, BigNumber":t.referTo("Array,number",u=>(c,d)=>u(c,i(d))),"Matrix, BigNumber":t.referTo("Matrix,number",u=>(c,d)=>u(c,i(d)))});function a(u,c){if(ft(u)&&(u=u.toArray()),!Array.isArray(u))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var d=[];return u.forEach(f=>{d.push(a(f,c-1))}),d}else{if(c===0)return o(u);throw RangeError("Cannot have negative dimension")}}function o(u){for(var c=[],d=u.length,f=1;f<d;f++)c.push(s(u[f-1],u[f]));return c}function s(u,c){ft(u)&&(u=u.toArray()),ft(c)&&(c=c.toArray());var d=Array.isArray(u),f=Array.isArray(c);if(d&&f)return l(u,c);if(!d&&!f)return n(c,u);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function l(u,c){if(u.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var d=[],f=u.length,p=0;p<f;p++)d.push(s(u[p],c[p]));return d}}),One="ones",Rne=["typed","config","matrix","BigNumber"],dh=Q(One,Rne,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t("ones",{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var d=u.pop();return a(u,d)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),d=c?new i(1):1;if(s(l),u){var f=n(u);return l.length>0?f.resize(l,d):f}else{var p=[];return l.length>0?xl(p,l,d):p}}function o(l){var u=!1;return l.forEach(function(c,d,f){kt(c)&&(u=!0,f[d]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!ot(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function gw(){throw new Error('No "bignumber" implementation available')}function mR(){throw new Error('No "fraction" implementation available')}function vR(){throw new Error('No "matrix" implementation available')}var gR="range",Ine=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],ic=Q(gR,Ine,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l}=e;return t(gR,{string:c,"string, boolean":c,"number, number":function(b,D){return u(d(b,D,1))},"number, number, number":function(b,D,x){return u(d(b,D,x))},"number, number, boolean":function(b,D,x){return u(x?f(b,D,1):d(b,D,1))},"number, number, number, boolean":function(b,D,x,S){return u(S?f(b,D,x):d(b,D,x))},"BigNumber, BigNumber":function(b,D){var x=b.constructor;return u(p(b,D,new x(1)))},"BigNumber, BigNumber, BigNumber":function(b,D,x){return u(p(b,D,x))},"BigNumber, BigNumber, boolean":function(b,D,x){var S=b.constructor;return u(x?m(b,D,new S(1)):p(b,D,new S(1)))},"BigNumber, BigNumber, BigNumber, boolean":function(b,D,x,S){return u(S?m(b,D,x):p(b,D,x))}});function u(y){return r.matrix==="Matrix"?n?n(y):vR():y}function c(y,b){var D=v(y);if(!D)throw new SyntaxError('String "'+y+'" is no valid range');var x;return r.number==="BigNumber"?(i===void 0&&gw(),x=b?m:p,u(x(i(D.start),i(D.end),i(D.step)))):(x=b?f:d,u(x(D.start,D.end,D.step)))}function d(y,b,D){var x=[],S=y;if(D>0)for(;a(S,b);)x.push(S),S+=D;else if(D<0)for(;s(S,b);)x.push(S),S+=D;return x}function f(y,b,D){var x=[],S=y;if(D>0)for(;o(S,b);)x.push(S),S+=D;else if(D<0)for(;l(S,b);)x.push(S),S+=D;return x}function p(y,b,D){var x=i(0),S=[],w=y;if(D.gt(x))for(;a(w,b);)S.push(w),w=w.plus(D);else if(D.lt(x))for(;s(w,b);)S.push(w),w=w.plus(D);return S}function m(y,b,D){var x=i(0),S=[],w=y;if(D.gt(x))for(;o(w,b);)S.push(w),w=w.plus(D);else if(D.lt(x))for(;l(w,b);)S.push(w),w=w.plus(D);return S}function v(y){var b=y.split(":"),D=b.map(function(S){return Number(S)}),x=D.some(function(S){return isNaN(S)});if(x)return null;switch(D.length){case 2:return{start:D[0],end:D[1],step:1};case 3:return{start:D[0],end:D[2],step:D[1]};default:return null}}}),yR="reshape",kne=["typed","isInteger","matrix"],fh=Q(yR,kne,e=>{var{typed:t,isInteger:r}=e;return t(yR,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!r(o))throw new TypeError("Invalid size for dimension: "+o)}),MM(i,a)}})}),Pne="resize",Fne=["config","matrix"],ph=Q(Pne,Fne,e=>{var{config:t,matrix:r}=e;return function(a,o,s){if(arguments.length!==2&&arguments.length!==3)throw new wa("resize",arguments.length,2,3);if(ft(o)&&(o=o.valueOf()),kt(o[0])&&(o=o.map(function(c){return kt(c)?c.toNumber():c})),ft(a))return a.resize(o,s,!0);if(typeof a=="string")return n(a,o,s);var l=Array.isArray(a)?!1:t.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return pt(a)}else{Array.isArray(a)||(a=[a]),a=pt(a);var u=xl(a,o,s);return l?r(u):u}};function n(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new Ot(a.length,1);var s=a[0];if(typeof s!="number"||!ot(s))throw new TypeError("Invalid size, must contain positive integers (size: "+Pt(a)+")");if(i.length>s)return i.substring(0,s);if(i.length<s){for(var l=i,u=0,c=s-i.length;u<c;u++)l+=o;return l}else return i}}),bR="rotate",$ne=["typed","multiply","rotationMatrix"],hh=Q(bR,$ne,e=>{var{typed:t,multiply:r,rotationMatrix:n}=e;return t(bR,{"Array , number | BigNumber | Complex | Unit":function(o,s){i(o,2);var l=r(n(s),o);return l.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,s){return i(o,2),r(n(s),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){i(o,3);var u=r(n(s,l),o);return u},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){return i(o,3),r(n(s,l),o)}});function i(a,o){var s=Array.isArray(a)?qt(a):a.size();if(s.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s.length===2&&s[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}}),xR="rotationMatrix",Bne=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],mh=Q(xR,Bne,e=>{var{typed:t,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:l,DenseMatrix:u,SparseMatrix:c,cos:d,sin:f}=e;return t(xR,{"":function(){return r.matrix==="Matrix"?l([]):[]},string:function(x){return l(x)},"number | BigNumber | Complex | Unit":function(x){return p(x,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(x,S){return p(x,S)},"number | BigNumber | Complex | Unit, Array":function(x,S){var w=l(S);return m(w),b(x,w,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(x,S){m(S);var w=S.storage()||(r.matrix==="Matrix"?"dense":void 0);return b(x,S,w)},"number | BigNumber | Complex | Unit, Array, string":function(x,S,w){var C=l(S);return m(C),b(x,C,w)},"number | BigNumber | Complex | Unit, Matrix, string":function(x,S,w){return m(S),b(x,S,w)}});function p(D,x){var S=kt(D),w=S?new s(-1):-1,C=d(D),E=f(D),A=[[C,n(w,E)],[E,C]];return y(A,x)}function m(D){var x=D.size();if(x.length<1||x[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function v(D){return D.reduce((x,S)=>n(x,S))}function y(D,x){if(x){if(x==="sparse")return new c(D);if(x==="dense")return new u(D);throw new TypeError('Unknown matrix type "'.concat(x,'"'))}return D}function b(D,x,S){var w=o(x);if(w===0)throw new RangeError("Rotation around zero vector");var C=kt(D)?s:null,E=C?new C(1):1,A=C?new C(-1):-1,_=C?new C(x.get([0])/w):x.get([0])/w,N=C?new C(x.get([1])/w):x.get([1])/w,M=C?new C(x.get([2])/w):x.get([2])/w,R=d(D),F=i(E,a(R)),k=f(D),P=i(R,v([_,_,F])),T=i(v([_,N,F]),v([A,M,k])),O=i(v([_,M,F]),v([N,k])),L=i(v([_,N,F]),v([M,k])),I=i(R,v([N,N,F])),V=i(v([N,M,F]),v([A,_,k])),H=i(v([_,M,F]),v([A,N,k])),Z=i(v([N,M,F]),v([_,k])),G=i(R,v([M,M,F])),Y=[[P,T,O],[L,I,V],[H,Z,G]];return y(Y,S)}}),wR="row",zne=["typed","Index","matrix","range"],ac=Q(wR,zne,e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(wR,{"Matrix, number":a,"Array, number":function(s,l){return a(n(pt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");hr(s,o.size()[0]);var l=i(0,o.size()[1]),u=new r(s,l),c=o.subset(u);return ft(c)?c:n([[c]])}}),CR="size",Lne=["typed","config","?matrix"],vh=Q(CR,Lne,e=>{var{typed:t,config:r,matrix:n}=e;return t(CR,{Matrix:function(a){return a.create(a.size())},Array:qt,string:function(a){return r.matrix==="Array"?[a.length]:n([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return r.matrix==="Array"?[]:n?n([]):vR()}})}),SR="squeeze",Vne=["typed","matrix"],gh=Q(SR,Vne,e=>{var{typed:t,matrix:r}=e;return t(SR,{Array:function(i){return xf(pt(i))},Matrix:function(i){var a=xf(i.toArray());return Array.isArray(a)?r(a):a},any:function(i){return pt(i)}})}),DR="subset",qne=["typed","matrix"],oc=Q(DR,qne,e=>{var{typed:t,matrix:r}=e;return t(DR,{"Array, Index":function(i,a){var o=r(i),s=o.subset(a);return a.isScalar()?s:s.valueOf()},"Matrix, Index":function(i,a){return i.subset(a)},"Object, Index":Une,"string, Index":Gne,"Array, Index, any":function(i,a,o){return r(pt(i)).subset(a,o,void 0).valueOf()},"Array, Index, any, any":function(i,a,o,s){return r(pt(i)).subset(a,o,s).valueOf()},"Matrix, Index, any":function(i,a,o){return i.clone().subset(a,o)},"Matrix, Index, any, any":function(i,a,o,s){return i.clone().subset(a,o,s)},"string, Index, string":ER,"string, Index, string, string":ER,"Object, Index, any":Wne})});function Gne(e,t){if(!ml(t))throw new TypeError("Index expected");if(t.size().length!==1)throw new Ot(t.size().length,1);var r=e.length;hr(t.min()[0],r),hr(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach(function(a){i+=e.charAt(a)}),i}function ER(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(t.size().length!==1)throw new Ot(t.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0),a=i.size()[0];if(a!==r.length)throw new Ot(i.size()[0],r.length);var o=e.length;hr(t.min()[0]),hr(t.max()[0]);for(var s=[],l=0;l<o;l++)s[l]=e.charAt(l);if(i.forEach(function(d,f){s[d]=r.charAt(f[0])}),s.length>o)for(var u=o-1,c=s.length;u<c;u++)s[u]||(s[u]=n);return s.join("")}function Une(e,t){if(t.size().length!==1)throw new Ot(t.size(),1);var r=t.dimension(0);if(typeof r!="string")throw new TypeError("String expected as index to retrieve an object property");return Si(e,r)}function Wne(e,t,r){if(t.size().length!==1)throw new Ot(t.size(),1);var n=t.dimension(0);if(typeof n!="string")throw new TypeError("String expected as index to retrieve an object property");var i=pt(e);return Cl(i,n,r),i}var NR="transpose",Hne=["typed","matrix"],yh=Q(NR,Hne,e=>{var{typed:t,matrix:r}=e;return t(NR,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:pt});function n(o){var s=o.size(),l;switch(s.length){case 1:l=o.clone();break;case 2:{var u=s[0],c=s[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Pt(s)+")");switch(o.storage()){case"dense":l=i(o,u,c);break;case"sparse":l=a(o,u,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Pt(s)+")")}return l}function i(o,s,l){for(var u=o._data,c=[],d,f=0;f<l;f++){d=c[f]=[];for(var p=0;p<s;p++)d[p]=pt(u[p][f])}return o.createDenseMatrix({data:c,size:[l,s],datatype:o._datatype})}function a(o,s,l){for(var u=o._values,c=o._index,d=o._ptr,f=u?[]:void 0,p=[],m=[],v=[],y=0;y<s;y++)v[y]=0;var b,D,x;for(b=0,D=c.length;b<D;b++)v[c[b]]++;for(var S=0,w=0;w<s;w++)m.push(S),S+=v[w],v[w]=m[w];for(m.push(S),x=0;x<l;x++)for(var C=d[x],E=d[x+1],A=C;A<E;A++){var _=v[c[A]]++;p[_]=x,u&&(f[_]=pt(u[A]))}return o.createSparseMatrix({values:f,index:p,ptr:m,size:[l,s],datatype:o._datatype})}}),AR="ctranspose",jne=["typed","transpose","conj"],bh=Q(AR,jne,e=>{var{typed:t,transpose:r,conj:n}=e;return t(AR,{any:function(a){return n(r(a))}})}),_R="zeros",Kne=["typed","config","matrix","BigNumber"],xh=Q(_R,Kne,e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(_R,{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var d=u.pop();return a(u,d)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),d=c?new i(0):0;if(s(l),u){var f=n(u);return l.length>0?f.resize(l,d):f}else{var p=[];return l.length>0?xl(p,l,d):p}}function o(l){var u=!1;return l.forEach(function(c,d,f){kt(c)&&(u=!0,f[d]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!ot(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}}),MR="fft",Yne=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],wh=Q(MR,Yne,e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:l,dotDivide:u,conj:c,pow:d,ceil:f,log2:p}=e;return t(MR,{Array:m,Matrix:function(x){return x.create(m(x.toArray()))}});function m(D){var x=qt(D);return x.length===1?b(D,x[0]):v(D.map(S=>m(S,x.slice(1))),0)}function v(D,x){var S=qt(D);if(x!==0)return new Array(S[0]).fill(0).map((C,E)=>v(D[E],x-1));if(S.length===1)return b(D);function w(C){var E=qt(C);return new Array(E[1]).fill(0).map((A,_)=>new Array(E[0]).fill(0).map((N,M)=>C[M][_]))}return w(v(w(D),1))}function y(D){for(var x=D.length,S=o(a(i(-1,i(l,s)),x)),w=[],C=1-x;C<x;C++)w.push(d(S,a(d(C,2),2)));for(var E=d(2,f(p(x+x-1))),A=[...new Array(x).fill(0).map((T,O)=>i(D[O],w[x-1+O])),...new Array(E-x).fill(0)],_=[...new Array(x+x-1).fill(0).map((T,O)=>a(1,w[O])),...new Array(E-(x+x-1)).fill(0)],N=b(A),M=b(_),R=new Array(E).fill(0).map((T,O)=>i(N[O],M[O])),F=u(c(m(c(R))),E),k=[],P=x-1;P<x+x-1;P++)k.push(i(F[P],w[P]));return k}function b(D){var x=D.length;if(x===1)return[D[0]];if(x%2===0){for(var S=[...b(D.filter((A,_)=>_%2===0)),...b(D.filter((A,_)=>_%2===1))],w=0;w<x/2;w++){var C=S[w],E=i(S[w+x/2],o(i(i(s,l),a(-w,x))));S[w]=n(C,E),S[w+x/2]=n(C,i(-1,E))}return S}else return y(D)}}),TR="ifft",Xne=["typed","fft","dotDivide","conj"],Ch=Q(TR,Xne,e=>{var{typed:t,fft:r,dotDivide:n,conj:i}=e;return t(TR,{"Array | Matrix":function(o){var s=ft(o)?o.size():qt(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})}),Zne="erf",Qne=["typed"],Sh=Q(Zne,Qne,e=>{var{typed:t}=e;return t("name",{number:function(o){var s=Math.abs(o);return s>=tie?Oo(o):s<=Jne?Oo(o)*r(s):s<=4?Oo(o)*(1-n(s)):Oo(o)*(1-i(s))},"Array | Matrix":t.referToSelf(a=>o=>zt(o,a))});function r(a){var o=a*a,s=eo[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+eo[0][u])*o,l=(l+Ol[0][u])*o;return a*(s+eo[0][3])/(l+Ol[0][3])}function n(a){var o=eo[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+eo[1][l])*a,s=(s+Ol[1][l])*a;var u=(o+eo[1][7])/(s+Ol[1][7]),c=parseInt(a*16)/16,d=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-d)*u}function i(a){var o=1/(a*a),s=eo[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+eo[2][u])*o,l=(l+Ol[2][u])*o;var c=o*(s+eo[2][4])/(l+Ol[2][4]);c=(eie-c)/a,o=parseInt(a*16)/16;var d=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-d)*c}}),Jne=.46875,eie=.5641895835477563,eo=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Ol=[[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]],tie=Math.pow(2,53),OR="mode",rie=["typed","isNaN","isNumeric"],Dh=Q(OR,rie,e=>{var{typed:t,isNaN:r,isNumeric:n}=e;return t(OR,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=Qt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var s={},l=[],u=0,c=0;c<a.length;c++){var d=a[c];if(n(d)&&r(d))throw new Error("Cannot calculate mode of an array containing NaN values");d in s||(s[d]=0),s[d]++,s[d]===u?l.push(d):s[d]>u&&(u=s[d],l=[d])}return l}});function qn(e,t,r){var n;return String(e).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+Or(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):String(e).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+Or(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var RR="prod",nie=["typed","config","multiplyScalar","numeric"],Eh=Q(RR,nie,e=>{var{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(RR,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(s,l){throw new Error("prod(A, dim) is not yet supported")},"...":function(s){return a(s)}});function a(o){var s;if(Qa(o,function(l){try{s=s===void 0?l:n(s,l)}catch(u){throw qn(u,"prod",l)}}),typeof s=="string"&&(s=i(s,r.number)),s===void 0)throw new Error("Cannot calculate prod of an empty array");return s}}),IR="format",iie=["typed"],Nh=Q(IR,iie,e=>{var{typed:t}=e;return t(IR,{any:Pt,"any, Object | function | number":Pt})}),kR="bin",aie=["typed","format"],Ah=Q(kR,aie,e=>{var{typed:t,format:r}=e;return t(kR,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"bin",wordSize:a})}})}),PR="oct",oie=["typed","format"],_h=Q(PR,oie,e=>{var{typed:t,format:r}=e;return t(PR,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"oct",wordSize:a})}})}),FR="hex",sie=["typed","format"],Mh=Q(FR,sie,e=>{var{typed:t,format:r}=e;return t(FR,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number":function(i,a){return r(i,{notation:"hex",wordSize:a})}})}),$R="print",lie=["typed"],Th=Q($R,lie,e=>{var{typed:t}=e;return t($R,{"string, Object | Array":BR,"string, Object | Array, number | Object":BR})});function BR(e,t,r){return e.replace(/\$([\w.]+)/g,function(n,i){for(var a=i.split("."),o=t[a.shift()];a.length&&o!==void 0;){var s=a.shift();o=s?o[s]:o+"."}return o!==void 0?bn(o)?o:Pt(o,r):n})}var zR="to",uie=["typed","matrix","concat"],Oh=Q(zR,uie,e=>{var{typed:t,matrix:r,concat:n}=e,i=vr({typed:t,matrix:r,concat:n});return t(zR,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))}),LR="isPrime",cie=["typed"],Rh=Q(LR,cie,e=>{var{typed:t}=e;return t(LR,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(D,x,S){for(var w=1;!x.eq(0);)x.mod(2).eq(0)?(x=x.div(2),D=D.mul(D).mod(S)):(x=x.sub(1),w=D.mul(w).mod(S));return w}var s=n.constructor.clone({precision:n.toFixed(0).length*2});n=new s(n);for(var l=0,u=n.sub(1);u.mod(2).eq(0);)u=u.div(2),l+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(D=>D<n);else{var d=Math.min(n.toNumber()-2,Math.floor(2*Math.pow(n.toFixed(0).length*Math.log(10),2)));c=[];for(var f=2;f<=d;f+=1)c.push(d)}for(var p=0;p<c.length;p+=1){var m=c[p],v=o(n.sub(n).add(m),u,n);if(!v.eq(1)){for(var y=0,b=v;!b.eq(n.sub(1));y+=1,b=b.mul(b).mod(n))if(y===l-1)return!1}}return!0},"Array | Matrix":t.referToSelf(r=>n=>zt(n,r))})}),die="numeric",fie=["number","?bignumber","?fraction"],Ih=Q(die,fie,e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>t(o),BigNumber:r?o=>r(o):gw,Fraction:n?o=>n(o):mR};return function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",u=arguments.length>2?arguments[2]:void 0;if(u!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=Or(s);if(!(c in i))throw new TypeError("Cannot convert "+s+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in a))throw new TypeError("Cannot convert "+s+' to type "'+l+'"; valid output types are '+Object.keys(a).join(", "));return l===c?s:a[l](s)}}),VR="divideScalar",pie=["typed","numeric"],kh=Q(VR,pie,e=>{var{typed:t,numeric:r}=e;return t(VR,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})}),qR="pow",hie=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Ph=Q(qR,hie,e=>{var{typed:t,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=e;return t(qR,{"number, number":c,"Complex, Complex":function(m,v){return m.pow(v)},"BigNumber, BigNumber":function(m,v){return v.isInteger()||m>=0||r.predictable?m.pow(v):new u(m.toNumber(),0).pow(v.toNumber(),0)},"Fraction, Fraction":function(m,v){var y=m.pow(v);if(y!=null)return y;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(m.valueOf(),v.valueOf())},"Array, number":d,"Array, BigNumber":function(m,v){return d(m,v.toNumber())},"Matrix, number":f,"Matrix, BigNumber":function(m,v){return f(m,v.toNumber())},"Unit, number | BigNumber":function(m,v){return m.pow(v)}});function c(p,m){if(r.predictable&&!ot(m)&&p<0)try{var v=l(m),y=s(v);if((m===y||Math.abs((m-y)/m)<1e-14)&&v.d%2===1)return(v.n%2===0?1:-1)*Math.pow(-p,m)}catch{}return r.predictable&&(p<-1&&m===1/0||p>-1&&p<0&&m===-1/0)?NaN:ot(m)||p>=0||r.predictable?ST(p,m):p*p<1&&m===1/0||p*p>1&&m===-1/0?0:new u(p,0).pow(m,0)}function d(p,m){if(!ot(m))throw new TypeError("For A^b, b must be an integer (value is "+m+")");var v=qt(p);if(v.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+v.length+" dimensions)");if(v[0]!==v[1])throw new Error("For A^b, A must be square (size is "+v[0]+"x"+v[1]+")");if(m<0)try{return d(o(p),-m)}catch(D){throw D.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+m+")"):D}for(var y=n(v[0]).valueOf(),b=p;m>=1;)(m&1)===1&&(y=i(b,y)),m>>=1,b=i(b,b);return y}function f(p,m){return a(d(p.valueOf(),m))}}),Rl="Number of decimals in function round must be an integer",GR="round",mie=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Fh=Q(GR,mie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,BigNumber:a,DenseMatrix:o}=e,s=Cn({typed:t,equalScalar:n}),l=sn({typed:t,DenseMatrix:o}),u=Ui({typed:t});return t(GR,{number:DT,"number, number":DT,"number, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);return new a(d).toDecimalPlaces(f.toNumber())},Complex:function(d){return d.round()},"Complex, number":function(d,f){if(f%1)throw new TypeError(Rl);return d.round(f)},"Complex, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);var p=f.toNumber();return d.round(p)},BigNumber:function(d){return d.toDecimalPlaces(0)},"BigNumber, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);return d.toDecimalPlaces(f.toNumber())},Fraction:function(d){return d.round()},"Fraction, number":function(d,f){if(f%1)throw new TypeError(Rl);return d.round(f)},"Fraction, BigNumber":function(d,f){if(!f.isInteger())throw new TypeError(Rl);return d.round(f.toNumber())},"Array | Matrix":t.referToSelf(c=>d=>zt(d,c)),"SparseMatrix, number | BigNumber":t.referToSelf(c=>(d,f)=>s(d,f,c,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(c=>(d,f)=>u(d,f,c,!1)),"Array, number | BigNumber":t.referToSelf(c=>(d,f)=>u(r(d),f,c,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(c=>(d,f)=>n(d,0)?i(f.size(),f.storage()):l(f,d,c,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(c=>(d,f)=>n(d,0)?i(f.size(),f.storage()):u(f,d,c,!0)),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(c=>(d,f)=>u(r(f),d,c,!0).valueOf())})}),UR="log",vie=["config","typed","divideScalar","Complex"],$h=Q(UR,vie,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e;return t(UR,{number:function(o){return o>=0||r.predictable?ite(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||r.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":t.referToSelf(a=>(o,s)=>n(a(o),a(s)))})}),WR="log1p",gie=["typed","config","divideScalar","log","Complex"],Bh=Q(WR,gie,e=>{var{typed:t,config:r,divideScalar:n,log:i,Complex:a}=e;return t(WR,{number:function(l){return l>=-1||r.predictable?yJ(l):o(new a(l,0))},Complex:o,BigNumber:function(l){var u=l.plus(1);return!u.isNegative()||r.predictable?u.ln():o(new a(l.toNumber(),0))},"Array | Matrix":t.referToSelf(s=>l=>zt(l,s)),"any, any":t.referToSelf(s=>(l,u)=>n(s(l),i(u)))});function o(s){var l=s.re+1;return new a(Math.log(Math.sqrt(l*l+s.im*s.im)),Math.atan2(s.im,l))}}),HR="nthRoots",yie=["config","typed","divideScalar","Complex"],zh=Q(HR,yie,e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e,a=[function(l){return new i(l,0)},function(l){return new i(0,l)},function(l){return new i(-l,0)},function(l){return new i(0,-l)}];function o(s,l){if(l<0)throw new Error("Root must be greater than zero");if(l===0)throw new Error("Root must be non-zero");if(l%1!==0)throw new Error("Root must be an integer");if(s===0||s.abs()===0)return[new i(0,0)];var u=typeof s=="number",c;(u||s.re===0||s.im===0)&&(u?c=2*+(s<0):s.im===0?c=2*+(s.re<0):c=2*+(s.im<0)+1);for(var d=s.arg(),f=s.abs(),p=[],m=Math.pow(f,1/l),v=0;v<l;v++){var y=(c+4*v)/l;if(y===Math.round(y)){p.push(a[y%4](m));continue}p.push(new i({r:m,phi:(d+2*Math.PI*v)/l}))}return p}return t(HR,{Complex:function(l){return o(l,2)},"Complex, number":o})}),jR="dotPow",bie=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],Lh=Q(jR,bie,e=>{var{typed:t,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o}=e,s=Vn({typed:t}),l=Ca({typed:t,DenseMatrix:a}),u=Cn({typed:t,equalScalar:r}),c=sn({typed:t,DenseMatrix:a}),d=vr({typed:t,matrix:n,concat:o}),f={};for(var p in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,p)&&!p.includes("Matrix")&&!p.includes("Array")&&(f[p]=i.signatures[p]);var m=t(f);return t(jR,d({elop:m,SS:l,DS:s,Ss:u,sS:c}))}),KR="dotDivide",xie=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Vh=Q(KR,xie,e=>{var{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=Wi({typed:t,equalScalar:n}),l=Vn({typed:t}),u=Ca({typed:t,DenseMatrix:a}),c=Cn({typed:t,equalScalar:n}),d=sn({typed:t,DenseMatrix:a}),f=vr({typed:t,matrix:r,concat:o});return t(KR,f({elop:i,SS:u,DS:l,SD:s,Ss:c,sS:d}))});function sc(e){var{DenseMatrix:t}=e;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Pt(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+Pt(o)+")");var u=[];if(ft(i)){var c=i.size(),d=i._data;if(c.length===1){if(c[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var f=0;f<s;f++)u[f]=[d[f]];return new t({data:u,size:[s,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==s||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(hl(i)){if(a){u=[];for(var p=0;p<s;p++)u[p]=[d[p][0]];return new t({data:u,size:[s,1],datatype:i._datatype})}return i}if(ja(i)){for(var m=0;m<s;m++)u[m]=[0];for(var v=i._values,y=i._index,b=i._ptr,D=b[1],x=b[0];x<D;x++){var S=y[x];u[S][0]=v[x]}return new t({data:u,size:[s,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(or(i)){var w=qt(i);if(w.length===1){if(w[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var C=0;C<s;C++)u[C]=[i[C]];return new t({data:u,size:[s,1]})}if(w.length===2){if(w[0]!==s||w[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var E=0;E<s;E++)u[E]=[i[E][0]];return new t({data:u,size:[s,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var YR="lsolve",wie=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],qh=Q(YR,wie,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(YR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.valueOf()}});function u(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=[],b=d._data,D=0;D<v;D++){var x=p[D][0]||0,S=void 0;if(o(x,0))S=0;else{var w=b[D][D];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");S=n(x,w);for(var C=D+1;C<m;C++)p[C]=[a(p[C][0]||0,i(S,b[C][D]))]}y[D]=[S]}return new s({data:y,size:[m,1]})}function c(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=[],S=0;S<v;S++){var w=p[S][0]||0;if(o(w,0))x[S]=[0];else{for(var C=0,E=[],A=[],_=D[S],N=D[S+1],M=_;M<N;M++){var R=b[M];R===S?C=y[M]:R>S&&(E.push(y[M]),A.push(R))}if(o(C,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var F=n(w,C),k=0,P=A.length;k<P;k++){var T=A[k];p[T]=[a(p[T][0]||0,i(F,E[k]))]}x[S]=[F]}}return new s({data:x,size:[m,1]})}}),XR="usolve",Cie=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Gh=Q(XR,Cie,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(XR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.valueOf()}});function u(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=[],b=d._data,D=v-1;D>=0;D--){var x=p[D][0]||0,S=void 0;if(o(x,0))S=0;else{var w=b[D][D];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");S=n(x,w);for(var C=D-1;C>=0;C--)p[C]=[a(p[C][0]||0,i(S,b[C][D]))]}y[D]=[S]}return new s({data:y,size:[m,1]})}function c(d,f){f=l(d,f,!0);for(var p=f._data,m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=[],S=v-1;S>=0;S--){var w=p[S][0]||0;if(o(w,0))x[S]=[0];else{for(var C=0,E=[],A=[],_=D[S],N=D[S+1],M=N-1;M>=_;M--){var R=b[M];R===S?C=y[M]:R<S&&(E.push(y[M]),A.push(R))}if(o(C,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var F=n(w,C),k=0,P=A.length;k<P;k++){var T=A[k];p[T]=[a(p[T][0],i(F,E[k]))]}x[S]=[F]}}return new s({data:x,size:[m,1]})}}),ZR="lsolveAll",Sie=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Uh=Q(ZR,Sie,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(ZR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.map(y=>y.valueOf())}});function u(d,f){for(var p=[l(d,f,!0)._data.map(A=>A[0])],m=d._data,v=d._size[0],y=d._size[1],b=0;b<y;b++)for(var D=p.length,x=0;x<D;x++){var S=p[x];if(o(m[b][b],0))if(o(S[b],0)){if(x===0){var C=[...S];C[b]=1;for(var E=b+1;E<y;E++)C[E]=a(C[E],m[E][b]);p.push(C)}}else{if(x===0)return[];p.splice(x,1),x-=1,D-=1}else{S[b]=n(S[b],m[b][b]);for(var w=b+1;w<y;w++)S[w]=a(S[w],i(S[b],m[w][b]))}}return p.map(A=>new s({data:A.map(_=>[_]),size:[v,1]}))}function c(d,f){for(var p=[l(d,f,!0)._data.map(H=>H[0])],m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=0;x<v;x++)for(var S=p.length,w=0;w<S;w++){for(var C=p[w],E=[],A=[],_=D[x],N=D[x+1],M=0,R=_;R<N;R++){var F=b[R];F===x?M=y[R]:F>x&&(E.push(y[R]),A.push(F))}if(o(M,0))if(o(C[x],0)){if(w===0){var O=[...C];O[x]=1;for(var L=0,I=A.length;L<I;L++){var V=A[L];O[V]=a(O[V],E[L])}p.push(O)}}else{if(w===0)return[];p.splice(w,1),w-=1,S-=1}else{C[x]=n(C[x],M);for(var k=0,P=A.length;k<P;k++){var T=A[k];C[T]=a(C[T],i(C[x],E[k]))}}}return p.map(H=>new s({data:H.map(Z=>[Z]),size:[m,1]}))}}),QR="usolveAll",Die=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Wh=Q(QR,Die,e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(QR,{"SparseMatrix, Array | Matrix":function(f,p){return c(f,p)},"DenseMatrix, Array | Matrix":function(f,p){return u(f,p)},"Array, Array | Matrix":function(f,p){var m=r(f),v=u(m,p);return v.map(y=>y.valueOf())}});function u(d,f){for(var p=[l(d,f,!0)._data.map(A=>A[0])],m=d._data,v=d._size[0],y=d._size[1],b=y-1;b>=0;b--)for(var D=p.length,x=0;x<D;x++){var S=p[x];if(o(m[b][b],0))if(o(S[b],0)){if(x===0){var C=[...S];C[b]=1;for(var E=b-1;E>=0;E--)C[E]=a(C[E],m[E][b]);p.push(C)}}else{if(x===0)return[];p.splice(x,1),x-=1,D-=1}else{S[b]=n(S[b],m[b][b]);for(var w=b-1;w>=0;w--)S[w]=a(S[w],i(S[b],m[w][b]))}}return p.map(A=>new s({data:A.map(_=>[_]),size:[v,1]}))}function c(d,f){for(var p=[l(d,f,!0)._data.map(H=>H[0])],m=d._size[0],v=d._size[1],y=d._values,b=d._index,D=d._ptr,x=v-1;x>=0;x--)for(var S=p.length,w=0;w<S;w++){for(var C=p[w],E=[],A=[],_=D[x],N=D[x+1],M=0,R=N-1;R>=_;R--){var F=b[R];F===x?M=y[R]:F<x&&(E.push(y[R]),A.push(F))}if(o(M,0))if(o(C[x],0)){if(w===0){var O=[...C];O[x]=1;for(var L=0,I=A.length;L<I;L++){var V=A[L];O[V]=a(O[V],E[L])}p.push(O)}}else{if(w===0)return[];p.splice(w,1),w-=1,S-=1}else{C[x]=n(C[x],M);for(var k=0,P=A.length;k<P;k++){var T=A[k];C[T]=a(C[T],i(C[x],E[k]))}}}return p.map(H=>new s({data:H.map(Z=>[Z]),size:[m,1]}))}}),Eie="matAlgo08xS0Sid",Nie=["typed","equalScalar"],yw=Q(Eie,Nie,e=>{var{typed:t,equalScalar:r}=e;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,d=i._datatype,f=a._values,p=a._index,m=a._ptr,v=a._size,y=a._datatype;if(c.length!==v.length)throw new Ot(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");if(!s||!f)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var b=c[0],D=c[1],x,S=r,w=0,C=o;typeof d=="string"&&d===y&&(x=d,S=t.find(r,[x,x]),w=t.convert(0,x),C=t.find(o,[x,x]));for(var E=[],A=[],_=[],N=[],M=[],R,F,k,P,T=0;T<D;T++){_[T]=A.length;var O=T+1;for(F=u[T],k=u[T+1],R=F;R<k;R++)P=l[R],M[P]=O,N[P]=s[R],A.push(P);for(F=m[T],k=m[T+1],R=F;R<k;R++)P=p[R],M[P]===O&&(N[P]=C(N[P],f[R]));for(R=_[T];R<A.length;){P=A[R];var L=N[P];S(L,w)?A.splice(R,1):(E.push(L),R++)}}return _[D]=A.length,i.createSparseMatrix({values:E,index:A,ptr:_,size:[b,D],datatype:x})}}),bw=Q("useMatrixForArrayScalar",["typed","matrix"],e=>{var{typed:t,matrix:r}=e;return{"Array, number":t.referTo("DenseMatrix, number",n=>(i,a)=>n(r(i),a).valueOf()),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(r(i),a).valueOf()),"number, Array":t.referTo("number, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf()),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf())}}),JR="leftShift",Aie=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Hh=Q(JR,Aie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=Wi({typed:t,equalScalar:n}),u=yw({typed:t,equalScalar:n}),c=gs({typed:t,DenseMatrix:a}),d=Cn({typed:t,equalScalar:n}),f=Ui({typed:t}),p=vr({typed:t,matrix:r,concat:o}),m=bw({typed:t,matrix:r});return t(JR,{"number, number":MT,"BigNumber, BigNumber":ene,"SparseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():d(y,b,v,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():f(y,b,v,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):c(b,y,v,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):f(b,y,v,!0))},m,p({SS:u,DS:s,SD:l}))}),eI="rightArithShift",_ie=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],jh=Q(eI,_ie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=Wi({typed:t,equalScalar:n}),u=yw({typed:t,equalScalar:n}),c=gs({typed:t,DenseMatrix:a}),d=Cn({typed:t,equalScalar:n}),f=Ui({typed:t}),p=vr({typed:t,matrix:r,concat:o}),m=bw({typed:t,matrix:r});return t(eI,{"number, number":TT,"BigNumber, BigNumber":tne,"SparseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():d(y,b,v,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():f(y,b,v,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):c(b,y,v,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):f(b,y,v,!0))},m,p({SS:u,DS:s,SD:l}))}),tI="rightLogShift",Mie=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Kh=Q(tI,Mie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:t}),l=Wi({typed:t,equalScalar:n}),u=yw({typed:t,equalScalar:n}),c=gs({typed:t,DenseMatrix:a}),d=Cn({typed:t,equalScalar:n}),f=Ui({typed:t}),p=vr({typed:t,matrix:r,concat:o}),m=bw({typed:t,matrix:r});return t(tI,{"number, number":OT,"SparseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():d(y,b,v,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(v=>(y,b)=>n(b,0)?y.clone():f(y,b,v,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):c(b,y,v,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(v=>(y,b)=>n(y,0)?i(b.size(),b.storage()):f(b,y,v,!0))},m,p({SS:u,DS:s,SD:l}))}),rI="and",Tie=["typed","matrix","equalScalar","zeros","not","concat"],Yh=Q(rI,Tie,e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=e,s=Wi({typed:t,equalScalar:n}),l=Ap({typed:t,equalScalar:n}),u=Cn({typed:t,equalScalar:n}),c=Ui({typed:t}),d=vr({typed:t,matrix:r,concat:o});return t(rI,{"number, number":FT,"Complex, Complex":function(p,m){return(p.re!==0||p.im!==0)&&(m.re!==0||m.im!==0)},"BigNumber, BigNumber":function(p,m){return!p.isZero()&&!m.isZero()&&!p.isNaN()&&!m.isNaN()},"Unit, Unit":t.referToSelf(f=>(p,m)=>f(p.value||0,m.value||0)),"SparseMatrix, any":t.referToSelf(f=>(p,m)=>a(m)?i(p.size(),p.storage()):u(p,m,f,!1)),"DenseMatrix, any":t.referToSelf(f=>(p,m)=>a(m)?i(p.size(),p.storage()):c(p,m,f,!1)),"any, SparseMatrix":t.referToSelf(f=>(p,m)=>a(p)?i(p.size(),p.storage()):u(m,p,f,!0)),"any, DenseMatrix":t.referToSelf(f=>(p,m)=>a(p)?i(p.size(),p.storage()):c(m,p,f,!0)),"Array, any":t.referToSelf(f=>(p,m)=>f(r(p),m).valueOf()),"any, Array":t.referToSelf(f=>(p,m)=>f(p,r(m)).valueOf())},d({SS:l,DS:s}))}),Xh="compare",Oie=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],Zh=Q(Xh,Oie,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=e,u=Vn({typed:t}),c=Op({typed:t,equalScalar:n}),d=sn({typed:t,DenseMatrix:s}),f=vr({typed:t,matrix:i,concat:l}),p=Tl({typed:t});return t(Xh,Rie({typed:t,config:r}),{"boolean, boolean":function(v,y){return v===y?0:v>y?1:-1},"BigNumber, BigNumber":function(v,y){return xa(v,y,r.epsilon)?new a(0):new a(v.cmp(y))},"Fraction, Fraction":function(v,y){return new o(v.compare(y))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:d}))}),Rie=Q(Xh,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Xh,{"number, number":function(i,a){return ni(i,a,r.epsilon)?0:i>a?1:-1}})}),Il=function e(t,r){var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,s=/^0/,l=function(x){return e.insensitive&&(""+x).toLowerCase()||""+x},u=l(t).replace(i,"")||"",c=l(r).replace(i,"")||"",d=u.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),f=c.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(u.match(o),16)||d.length!==1&&u.match(a)&&Date.parse(u),m=parseInt(c.match(o),16)||p&&c.match(a)&&Date.parse(c)||null,v,y;if(m){if(p<m)return-1;if(p>m)return 1}for(var b=0,D=Math.max(d.length,f.length);b<D;b++){if(v=!(d[b]||"").match(s)&&parseFloat(d[b])||d[b]||0,y=!(f[b]||"").match(s)&&parseFloat(f[b])||f[b]||0,isNaN(v)!==isNaN(y))return isNaN(v)?1:-1;if(typeof v!=typeof y&&(v+="",y+=""),v<y)return-1;if(v>y)return 1}return 0},nI="compareNatural",Iie=["typed","compare"],Qh=Q(nI,Iie,e=>{var{typed:t,compare:r}=e,n=r.signatures["boolean,boolean"];return t(nI,{"any, any":i});function i(l,u){var c=Or(l),d=Or(u),f;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(d==="number"||d==="BigNumber"||d==="Fraction"))return f=r(l,u),f.toString()!=="0"?f>0?1:-1:Il(c,d);var p=["Array","DenseMatrix","SparseMatrix"];if(p.includes(c)||p.includes(d))return f=a(i,l,u),f!==0?f:Il(c,d);if(c!==d)return Il(c,d);if(c==="Complex")return kie(l,u);if(c==="Unit")return l.equalBase(u)?i(l.value,u.value):o(i,l.formatUnits(),u.formatUnits());if(c==="boolean")return n(l,u);if(c==="string")return Il(l,u);if(c==="Object")return s(i,l,u);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(l,u,c){return ja(u)&&ja(c)?o(l,u.toJSON().values,c.toJSON().values):ja(u)?a(l,u.toArray(),c):ja(c)?a(l,u,c.toArray()):hl(u)?a(l,u.toJSON().data,c):hl(c)?a(l,u,c.toJSON().data):Array.isArray(u)?Array.isArray(c)?o(l,u,c):a(l,u,[c]):a(l,[u],c)}function o(l,u,c){for(var d=0,f=Math.min(u.length,c.length);d<f;d++){var p=l(u[d],c[d]);if(p!==0)return p}return u.length>c.length?1:u.length<c.length?-1:0}function s(l,u,c){var d=Object.keys(u),f=Object.keys(c);d.sort(Il),f.sort(Il);var p=o(l,d,f);if(p!==0)return p;for(var m=0;m<d.length;m++){var v=l(u[d[m]],c[f[m]]);if(v!==0)return v}return 0}});function kie(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 iI="compareText",Pie=["typed","matrix","concat"];Kx.signature="any, any";var Jh=Q(iI,Pie,e=>{var{typed:t,matrix:r,concat:n}=e,i=vr({typed:t,matrix:r,concat:n});return t(iI,Kx,i({elop:Kx,Ds:!0}))}),em="equal",Fie=["typed","matrix","equalScalar","DenseMatrix","concat"],tm=Q(em,Fie,e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:r,concat:a});return t(em,$ie({typed:t,equalScalar:n}),u({elop:n,SS:s,DS:o,Ss:l}))}),$ie=Q(em,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(em,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:r(i,a)}})}),aI="equalText",Bie=["typed","compareText","isZero"],rm=Q(aI,Bie,e=>{var{typed:t,compareText:r,isZero:n}=e;return t(aI,{"any, any":function(a,o){return n(r(a,o))}})}),nm="smaller",zie=["typed","config","matrix","DenseMatrix","concat"],im=Q(nm,zie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(nm,Lie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d<f,"BigNumber, BigNumber":function(f,p){return f.lt(p)&&!xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)===-1,"Complex, Complex":function(f,p){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),Lie=Q(nm,["typed","config"],e=>{var{typed:t,config:r}=e;return t(nm,{"number, number":function(i,a){return i<a&&!ni(i,a,r.epsilon)}})}),am="smallerEq",Vie=["typed","config","matrix","DenseMatrix","concat"],om=Q(am,Vie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(am,qie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d<=f,"BigNumber, BigNumber":function(f,p){return f.lte(p)||xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),qie=Q(am,["typed","config"],e=>{var{typed:t,config:r}=e;return t(am,{"number, number":function(i,a){return i<=a||ni(i,a,r.epsilon)}})}),sm="larger",Gie=["typed","config","matrix","DenseMatrix","concat"],lm=Q(sm,Gie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(sm,Uie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d>f,"BigNumber, BigNumber":function(f,p){return f.gt(p)&&!xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),Uie=Q(sm,["typed","config"],e=>{var{typed:t,config:r}=e;return t(sm,{"number, number":function(i,a){return i>a&&!ni(i,a,r.epsilon)}})}),um="largerEq",Wie=["typed","config","matrix","DenseMatrix","concat"],cm=Q(um,Wie,e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i,concat:a}=e,o=Vn({typed:t}),s=Ca({typed:t,DenseMatrix:i}),l=sn({typed:t,DenseMatrix:i}),u=vr({typed:t,matrix:n,concat:a}),c=Tl({typed:t});return t(um,Hie({typed:t,config:r}),{"boolean, boolean":(d,f)=>d>=f,"BigNumber, BigNumber":function(f,p){return f.gte(p)||xa(f,p,r.epsilon)},"Fraction, Fraction":(d,f)=>d.compare(f)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,u({SS:s,DS:o,Ss:l}))}),Hie=Q(um,["typed","config"],e=>{var{typed:t,config:r}=e;return t(um,{"number, number":function(i,a){return i>=a||ni(i,a,r.epsilon)}})}),oI="deepEqual",jie=["typed","equal"],dm=Q(oI,jie,e=>{var{typed:t,equal:r}=e;return t(oI,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;s++)if(!n(i[s],a[s]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:r(i,a)}}),fm="unequal",Kie=["typed","config","equalScalar","matrix","DenseMatrix","concat"],pm=Q(fm,Kie,e=>{var{typed:t,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=e,s=Vn({typed:t}),l=Ca({typed:t,DenseMatrix:a}),u=sn({typed:t,DenseMatrix:a}),c=vr({typed:t,matrix:i,concat:o});return t(fm,Yie({typed:t,equalScalar:n}),c({elop:d,SS:l,DS:s,Ss:u}));function d(f,p){return!n(f,p)}}),Yie=Q(fm,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(fm,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!r(i,a)}})}),sI="partitionSelect",Xie=["typed","isNumeric","isNaN","compare"],hm=Q(sI,Xie,e=>{var{typed:t,isNumeric:r,isNaN:n,compare:i}=e,a=i,o=(u,c)=>-i(u,c);return t(sI,{"Array | Matrix, number":function(c,d){return s(c,d,a)},"Array | Matrix, number, string":function(c,d,f){if(f==="asc")return s(c,d,a);if(f==="desc")return s(c,d,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(u,c,d){if(!ot(c)||c<0)throw new Error("k must be a non-negative integer");if(ft(u)){var f=u.size();if(f.length>1)throw new Error("Only one dimensional matrices supported");return l(u.valueOf(),c,d)}if(Array.isArray(u))return l(u,c,d)}function l(u,c,d){if(c>=u.length)throw new Error("k out of bounds");for(var f=0;f<u.length;f++)if(r(u[f])&&n(u[f]))return u[f];for(var p=0,m=u.length-1;p<m;){for(var v=p,y=m,b=u[Math.floor(Math.random()*(m-p+1))+p];v<y;)if(d(u[v],b)>=0){var D=u[y];u[y]=u[v],u[v]=D,--y}else++v;d(u[v],b)>0&&--v,c<=v?m=v:p=v+1}return u[c]}}),lI="sort",Zie=["typed","matrix","compare","compareNatural"],mm=Q(lI,Zie,e=>{var{typed:t,matrix:r,compare:n,compareNatural:i}=e,a=n,o=(c,d)=>-n(c,d);return t(lI,{Array:function(d){return l(d),d.sort(a)},Matrix:function(d){return u(d),r(d.toArray().sort(a),d.storage())},"Array, function":function(d,f){return l(d),d.sort(f)},"Matrix, function":function(d,f){return u(d),r(d.toArray().sort(f),d.storage())},"Array, string":function(d,f){return l(d),d.sort(s(f))},"Matrix, string":function(d,f){return u(d),r(d.toArray().sort(s(f)),d.storage())}});function s(c){if(c==="asc")return a;if(c==="desc")return o;if(c==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function l(c){if(qt(c).length!==1)throw new Error("One dimensional array expected")}function u(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}}),uI="max",Qie=["typed","config","numeric","larger"],lc=Q(uI,Qie,e=>{var{typed:t,config:r,numeric:n,larger:i}=e;return t(uI,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Vf(l,u.valueOf(),a)},"...":function(l){if(Al(l))throw new TypeError("Scalar values expected in function max");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw qn(u,"max",l)}}function o(s){var l;if(Qa(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw qn(c,"max",u)}}),l===void 0)throw new Error("Cannot calculate max of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}}),cI="min",Jie=["typed","config","numeric","smaller"],uc=Q(cI,Jie,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e;return t(cI,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return Vf(l,u.valueOf(),a)},"...":function(l){if(Al(l))throw new TypeError("Scalar values expected in function min");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw qn(u,"min",l)}}function o(s){var l;if(Qa(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw qn(c,"min",u)}}),l===void 0)throw new Error("Cannot calculate min of an empty array");return typeof l=="string"&&(l=n(l,r.number)),l}}),eae="ImmutableDenseMatrix",tae=["smaller","DenseMatrix"],vm=Q(eae,tae,e=>{var{smaller:t,DenseMatrix:r}=e;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!bn(a))throw new Error("Invalid datatype: "+a);if(ft(i)||or(i)){var o=new r(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&or(i.data)&&or(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+Or(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=r.prototype.subset.call(this,i);return ft(a)?new n({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:pt(this._data),size:pt(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(i){return new n(i)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||t(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||t(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},n},{isClass:!0}),rae="Index",nae=["ImmutableDenseMatrix"],gm=Q(rae,nae,e=>{var{ImmutableDenseMatrix:t}=e;function r(i){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var a=0,o=arguments.length;a<o;a++){var s=arguments[a];if(Uu(s))this._dimensions.push(s),this._isScalar=!1;else if(Array.isArray(s)||ft(s)){var l=n(s.valueOf());this._dimensions.push(l);var u=l.size();(u.length!==1||u[0]!==1)&&(this._isScalar=!1)}else if(typeof s=="number")this._dimensions.push(n([s]));else if(typeof s=="string")this._dimensions.push(s);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range")}}r.prototype.type="Index",r.prototype.isIndex=!0;function n(i){for(var a=0,o=i.length;a<o;a++)if(typeof i[a]!="number"||!ot(i[a]))throw new TypeError("Index parameters must be positive integer numbers");return new t(i)}return r.prototype.clone=function(){var i=new r;return i._dimensions=pt(this._dimensions),i._isScalar=this._isScalar,i},r.create=function(i){var a=new r;return r.apply(a,i),a},r.prototype.size=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i[a]=typeof s=="string"?1:s.size()[0]}return i},r.prototype.max=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i[a]=typeof s=="string"?s:s.max()}return i},r.prototype.min=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i[a]=typeof s=="string"?s:s.min()}return i},r.prototype.forEach=function(i){for(var a=0,o=this._dimensions.length;a<o;a++)i(this._dimensions[a],a,this)},r.prototype.dimension=function(i){return this._dimensions[i]||null},r.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];i.push(typeof s=="string"?s:s.toArray())}return i},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var i=[],a=0,o=this._dimensions.length;a<o;a++){var s=this._dimensions[a];typeof s=="string"?i.push(JSON.stringify(s)):i.push(s.toString())}return"["+i.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(i){return r.create(i.dimensions)},r},{isClass:!0}),iae="FibonacciHeap",aae=["smaller","larger"],ym=Q(iae,aae,e=>{var{smaller:t,larger:r}=e,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,d){var f={key:c,value:d,degree:0};if(this._minimum){var p=this._minimum;f.left=p,f.right=p.right,p.right=f,f.right.left=f,t(c,p.key)&&(this._minimum=f)}else f.left=f,f.right=f,this._minimum=f;return this._size++,f},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var c=this._minimum;if(c===null)return c;for(var d=this._minimum,f=c.degree,p=c.child;f>0;){var m=p.right;p.left.right=p.right,p.right.left=p.left,p.left=d,p.right=d.right,d.right=p,p.right.left=p,p.parent=null,p=m,f--}return c.left.right=c.right,c.right.left=c.left,c===c.right?d=null:(d=c.right,d=u(d,this._size)),this._size--,this._minimum=d,c},i.prototype.remove=function(c){this._minimum=a(this._minimum,c,-1),this.extractMinimum()};function a(c,d,f){d.key=f;var p=d.parent;return p&&t(d.key,p.key)&&(o(c,d,p),s(c,p)),t(d.key,c.key)&&(c=d),c}function o(c,d,f){d.left.right=d.right,d.right.left=d.left,f.degree--,f.child===d&&(f.child=d.right),f.degree===0&&(f.child=null),d.left=c,d.right=c.right,c.right=d,d.right.left=d,d.parent=null,d.mark=!1}function s(c,d){var f=d.parent;!f||(d.mark?(o(c,d,f),s(f)):d.mark=!0)}var l=function(d,f){d.left.right=d.right,d.right.left=d.left,d.parent=f,f.child?(d.left=f.child,d.right=f.child.right,f.child.right=d,d.right.left=d):(f.child=d,d.right=d,d.left=d),f.degree++,d.mark=!1};function u(c,d){var f=Math.floor(Math.log(d)*n)+1,p=new Array(f),m=0,v=c;if(v)for(m++,v=v.right;v!==c;)m++,v=v.right;for(var y;m>0;){for(var b=v.degree,D=v.right;y=p[b],!!y;){if(r(v.key,y.key)){var x=y;y=v,v=x}l(y,v),p[b]=null,b++}p[b]=v,v=D,m--}c=null;for(var S=0;S<f;S++)y=p[S],y&&(c?(y.left.right=y.right,y.right.left=y.left,y.left=c,y.right=c.right,c.right=y,y.right.left=y,t(y.key,c.key)&&(c=y)):c=y);return c}return i},{isClass:!0}),oae="Spa",sae=["addScalar","equalScalar","FibonacciHeap"],bm=Q(oae,sae,e=>{var{addScalar:t,equalScalar:r,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var s=this._heap.insert(a,o);this._values[a]=s}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var s=this._values[a];s?s.value=t(s.value,o):(s=this._heap.insert(a,o),this._values[a]=s)},i.prototype.forEach=function(a,o,s){var l=this._heap,u=this._values,c=[],d=l.extractMinimum();for(d&&c.push(d);d&&d.key<=o;)d.key>=a&&(r(d.value,0)||s(d.key,d.value,this)),d=l.extractMinimum(),d&&c.push(d);for(var f=0;f<c.length;f++){var p=c[f];d=l.insert(p.key,p.value),u[d.key]=d}},i.prototype.swap=function(a,o){var s=this._values[a],l=this._values[o];if(!s&&l)s=this._heap.insert(a,l.value),this._heap.remove(l),this._values[a]=s,this._values[o]=void 0;else if(s&&!l)l=this._heap.insert(o,s.value),this._heap.remove(s),this._values[o]=l,this._values[a]=void 0;else if(s&&l){var u=s.value;s.value=l.value,l.value=u}},i},{isClass:!0});function cc(e){return cc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cc(e)}function lae(e,t){if(cc(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(cc(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uae(e){var t=lae(e,"string");return cc(t)==="symbol"?t:String(t)}function pn(e,t,r){return t=uae(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cae=Zu(function(e){return new e(1).exp()},{hasher:xm}),dae=Zu(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:xm}),xw=Zu(function(e){return e.acos(-1)},{hasher:xm}),fae=Zu(function(e){return xw(e).times(2)},{hasher:xm});function xm(e){return e[0].precision}function dI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ww(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dI(Object(r),!0).forEach(function(n){pn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dI(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var pae="Unit",hae=["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],wm=Q(pae,hae,e=>{var{on:t,config:r,addScalar:n,subtract:i,multiplyScalar:a,divideScalar:o,pow:s,abs:l,fix:u,round:c,equal:d,isNumeric:f,format:p,number:m,Complex:v,BigNumber:y,Fraction:b}=e,D=m;function x(q,J){if(!(this instanceof x))throw new Error("Constructor must be called with the new operator");if(!(q==null||f(q)||yi(q)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,J===void 0)this.units=[],this.dimensions=L.map(X=>0);else if(typeof J=="string"){var ce=x.parse(J);this.units=ce.units,this.dimensions=ce.dimensions}else if(bi(J)&&J.value===null)this.fixPrefix=J.fixPrefix,this.skipAutomaticSimplification=J.skipAutomaticSimplification,this.dimensions=J.dimensions.slice(0),this.units=J.units.map(X=>fn({},X));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(q)}Object.defineProperty(x,"name",{value:"Unit"}),x.prototype.constructor=x,x.prototype.type="Unit",x.prototype.isUnit=!0;var S,w,C;function E(){for(;C===" "||C===" ";)N()}function A(q){return q>="0"&&q<="9"||q==="."}function _(q){return q>="0"&&q<="9"}function N(){w++,C=S.charAt(w)}function M(q){w=q,C=S.charAt(w)}function R(){var q="",J=w;if(C==="+"?N():C==="-"&&(q+=C,N()),!A(C))return M(J),null;if(C==="."){if(q+=C,N(),!_(C))return M(J),null}else{for(;_(C);)q+=C,N();C==="."&&(q+=C,N())}for(;_(C);)q+=C,N();if(C==="E"||C==="e"){var ce="",X=w;if(ce+=C,N(),(C==="+"||C==="-")&&(ce+=C,N()),!_(C))return M(X),q;for(q=q+ce;_(C);)q+=C,N()}return q}function F(){for(var q="";_(C)||x.isValidAlpha(C);)q+=C,N();var J=q.charAt(0);return x.isValidAlpha(J)?q:null}function k(q){return C===q?(N(),q):null}x.parse=function(q,J){if(J=J||{},S=q,w=-1,C="",typeof S!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var ce=new x;ce.units=[];var X=1,te=!1;N(),E();var ae=R(),De=null;if(ae){if(r.number==="BigNumber")De=new y(ae);else if(r.number==="Fraction")try{De=new b(ae)}catch{De=parseFloat(ae)}else De=parseFloat(ae);E(),k("*")?(X=1,te=!0):k("/")&&(X=-1,te=!0)}for(var be=[],K=1;;){for(E();C==="(";)be.push(X),K*=X,X=1,N(),E();var W=void 0;if(C){var ue=C;if(W=F(),W===null)throw new SyntaxError('Unexpected "'+ue+'" in "'+S+'" at index '+w.toString())}else break;var me=P(W);if(me===null)throw new SyntaxError('Unit "'+W+'" not found.');var we=X*K;if(E(),k("^")){E();var _e=R();if(_e===null)throw new SyntaxError('In "'+q+'", "^" must be followed by a floating-point number');we*=_e}ce.units.push({unit:me.unit,prefix:me.prefix,power:we});for(var Ae=0;Ae<L.length;Ae++)ce.dimensions[Ae]+=(me.unit.dimensions[Ae]||0)*we;for(E();C===")";){if(be.length===0)throw new SyntaxError('Unmatched ")" in "'+S+'" at index '+w.toString());K/=be.pop(),N(),E()}if(te=!1,k("*")?(X=1,te=!0):k("/")?(X=-1,te=!0):X=1,me.unit.base){var Ce=me.unit.base.key;ne.auto[Ce]={unit:me.unit,prefix:me.prefix}}}if(E(),C)throw new SyntaxError('Could not parse: "'+q+'"');if(te)throw new SyntaxError('Trailing characters: "'+q+'"');if(be.length!==0)throw new SyntaxError('Unmatched "(" in "'+S+'"');if(ce.units.length===0&&!J.allowNoUnits)throw new SyntaxError('"'+q+'" contains no units');return ce.value=De!==void 0?ce._normalize(De):null,ce},x.prototype.clone=function(){var q=new x;q.fixPrefix=this.fixPrefix,q.skipAutomaticSimplification=this.skipAutomaticSimplification,q.value=pt(this.value),q.dimensions=this.dimensions.slice(0),q.units=[];for(var J=0;J<this.units.length;J++){q.units[J]={};for(var ce in this.units[J])et(this.units[J],ce)&&(q.units[J][ce]=this.units[J][ce])}return q},x.prototype.valueType=function(){return Or(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(q){if(q==null||this.units.length===0)return q;for(var J=q,ce=x._getNumberConverter(Or(q)),X=0;X<this.units.length;X++){var te=ce(this.units[X].unit.value),ae=ce(this.units[X].prefix.value),De=ce(this.units[X].power);J=a(J,s(a(te,ae),De))}return J},x.prototype._denormalize=function(q,J){if(q==null||this.units.length===0)return q;for(var ce=q,X=x._getNumberConverter(Or(q)),te=0;te<this.units.length;te++){var ae=X(this.units[te].unit.value),De=X(this.units[te].prefix.value),be=X(this.units[te].power);ce=o(ce,s(a(ae,De),be))}return ce};var P=Zu(q=>{if(et(G,q)){var J=G[q],ce=J.prefixes[""];return{unit:J,prefix:ce}}for(var X in G)if(et(G,X)&&PJ(q,X)){var te=G[X],ae=q.length-X.length,De=q.substring(0,ae),be=et(te.prefixes,De)?te.prefixes[De]:void 0;if(be!==void 0)return{unit:te,prefix:be}}return null},{hasher:q=>q[0],limit:100});x.isValuelessUnit=function(q){return P(q)!==null},x.prototype.hasBase=function(q){if(typeof q=="string"&&(q=I[q]),!q)return!1;for(var J=0;J<L.length;J++)if(Math.abs((this.dimensions[J]||0)-(q.dimensions[J]||0))>1e-12)return!1;return!0},x.prototype.equalBase=function(q){for(var J=0;J<L.length;J++)if(Math.abs((this.dimensions[J]||0)-(q.dimensions[J]||0))>1e-12)return!1;return!0},x.prototype.equals=function(q){return this.equalBase(q)&&d(this.value,q.value)},x.prototype.multiply=function(q){for(var J=this.clone(),ce=bi(q)?q:new x(q),X=0;X<L.length;X++)J.dimensions[X]=(this.dimensions[X]||0)+(ce.dimensions[X]||0);for(var te=0;te<ce.units.length;te++){var ae=ww({},ce.units[te]);J.units.push(ae)}if(this.value!==null||ce.value!==null){var De=this.value===null?this._normalize(1):this.value,be=ce.value===null?ce._normalize(1):ce.value;J.value=a(De,be)}else J.value=null;return bi(q)&&(J.skipAutomaticSimplification=!1),T(J)},x.prototype.divideInto=function(q){return new x(q).divide(this)},x.prototype.divide=function(q){for(var J=this.clone(),ce=bi(q)?q:new x(q),X=0;X<L.length;X++)J.dimensions[X]=(this.dimensions[X]||0)-(ce.dimensions[X]||0);for(var te=0;te<ce.units.length;te++){var ae=ww(ww({},ce.units[te]),{},{power:-ce.units[te].power});J.units.push(ae)}if(this.value!==null||ce.value!==null){var De=this.value===null?this._normalize(1):this.value,be=ce.value===null?ce._normalize(1):ce.value;J.value=o(De,be)}else J.value=null;return bi(q)&&(J.skipAutomaticSimplification=!1),T(J)},x.prototype.pow=function(q){for(var J=this.clone(),ce=0;ce<L.length;ce++)J.dimensions[ce]=(this.dimensions[ce]||0)*q;for(var X=0;X<J.units.length;X++)J.units[X].power*=q;return J.value!==null?J.value=s(J.value,q):J.value=null,J.skipAutomaticSimplification=!1,T(J)};function T(q){return q.equalBase(I.NONE)&&q.value!==null&&!r.predictable?q.value:q}x.prototype.abs=function(){var q=this.clone();if(q.value!==null)if(q._isDerived()||q.units[0].unit.offset===0)q.value=l(q.value);else{var J=q._numberConverter(),ce=J(q.units[0].unit.value),X=J(q.units[0].unit.offset),te=a(ce,X);q.value=i(l(n(q.value,te)),te)}for(var ae in q.units)(q.units[ae].unit.name==="VA"||q.units[ae].unit.name==="VAR")&&(q.units[ae].unit=G.W);return q},x.prototype.to=function(q){var J=this.value===null?this._normalize(1):this.value,ce;if(typeof q=="string")ce=x.parse(q);else if(bi(q))ce=q.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(ce))throw new Error("Units do not match ('".concat(ce.toString(),"' != '").concat(this.toString(),"')"));if(ce.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units[0].unit.offset===ce.units[0].unit.offset)ce.value=pt(J);else{var X=x._getNumberConverter(Or(J)),te=X(this.units[0].unit.value),ae=X(this.units[0].unit.offset),De=a(te,ae),be=X(ce.units[0].unit.value),K=X(ce.units[0].unit.offset),W=a(be,K);ce.value=i(n(J,De),W)}return ce.fixPrefix=!0,ce.skipAutomaticSimplification=!0,ce},x.prototype.toNumber=function(q){return D(this.toNumeric(q))},x.prototype.toNumeric=function(q){var J;return q?J=this.to(q):J=this.clone(),J._isDerived()||J.units.length===0?J._denormalize(J.value):J._denormalize(J.value,J.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.formatUnits(),fixPrefix:this.fixPrefix}},x.fromJSON=function(q){var J=new x(q.value,q.unit);return J.fixPrefix=q.fixPrefix||!1,J},x.prototype.valueOf=x.prototype.toString,x.prototype.simplify=function(){var q=this.clone(),J=[],ce;for(var X in pe)if(et(pe,X)&&q.hasBase(I[X])){ce=X;break}if(ce==="NONE")q.units=[];else{var te;if(ce&&et(pe,ce)&&(te=pe[ce]),te)q.units=[{unit:te.unit,prefix:te.prefix,power:1}];else{for(var ae=!1,De=0;De<L.length;De++){var be=L[De];Math.abs(q.dimensions[De]||0)>1e-12&&(et(pe,be)?J.push({unit:pe[be].unit,prefix:pe[be].prefix,power:q.dimensions[De]||0}):ae=!0)}J.length<q.units.length&&!ae&&(q.units=J)}}return q},x.prototype.toSI=function(){for(var q=this.clone(),J=[],ce=0;ce<L.length;ce++){var X=L[ce];if(Math.abs(q.dimensions[ce]||0)>1e-12)if(et(ne.si,X))J.push({unit:ne.si[X].unit,prefix:ne.si[X].prefix,power:q.dimensions[ce]||0});else throw new Error("Cannot express custom unit "+X+" in SI units")}return q.units=J,q.fixPrefix=!0,q.skipAutomaticSimplification=!0,q},x.prototype.formatUnits=function(){for(var q="",J="",ce=0,X=0,te=0;te<this.units.length;te++)this.units[te].power>0?(ce++,q+=" "+this.units[te].prefix.name+this.units[te].unit.name,Math.abs(this.units[te].power-1)>1e-15&&(q+="^"+this.units[te].power)):this.units[te].power<0&&X++;if(X>0)for(var ae=0;ae<this.units.length;ae++)this.units[ae].power<0&&(ce>0?(J+=" "+this.units[ae].prefix.name+this.units[ae].unit.name,Math.abs(this.units[ae].power+1)>1e-15&&(J+="^"+-this.units[ae].power)):(J+=" "+this.units[ae].prefix.name+this.units[ae].unit.name,J+="^"+this.units[ae].power));q=q.substr(1),J=J.substr(1),ce>1&&X>0&&(q="("+q+")"),X>1&&ce>0&&(J="("+J+")");var De=q;return ce>0&&X>0&&(De+=" / "),De+=J,De},x.prototype.format=function(q){var J=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),ce=!1;typeof J.value<"u"&&J.value!==null&&yi(J.value)&&(ce=Math.abs(J.value.re)<1e-14);for(var X in J.units)et(J.units,X)&&J.units[X].unit&&(J.units[X].unit.name==="VA"&&ce?J.units[X].unit=G.VAR:J.units[X].unit.name==="VAR"&&!ce&&(J.units[X].unit=G.VA));J.units.length===1&&!J.fixPrefix&&Math.abs(J.units[0].power-Math.round(J.units[0].power))<1e-14&&(J.units[0].prefix=J._bestPrefix());var te=J._denormalize(J.value),ae=J.value!==null?p(te,q||{}):"",De=J.formatUnits();return J.value&&yi(J.value)&&(ae="("+ae+")"),De.length>0&&ae.length>0&&(ae+=" "),ae+=De,ae},x.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var q=this.value!==null?l(this.value):0,J=l(this.units[0].unit.value),ce=this.units[0].prefix;if(q===0)return ce;var X=this.units[0].power,te=Math.log(q/Math.pow(ce.value*J,X))/Math.LN10-1.2;if(te>-2.200001&&te<1.800001)return ce;te=Math.abs(te);var ae=this.units[0].unit.prefixes;for(var De in ae)if(et(ae,De)){var be=ae[De];if(be.scientific){var K=Math.abs(Math.log(q/Math.pow(be.value*J,X))/Math.LN10-1.2);(K<te||K===te&&be.name.length<ce.name.length)&&(ce=be,te=K)}}return ce},x.prototype.splitUnit=function(q){for(var J=this.clone(),ce=[],X=0;X<q.length&&(J=J.to(q[X]),X!==q.length-1);X++){var te=J.toNumeric(),ae=c(te),De=void 0,be=d(ae,te);be?De=ae:De=u(J.toNumeric());var K=new x(De,q[X].toString());ce.push(K),J=i(J,K)}for(var W=0,ue=0;ue<ce.length;ue++)W=n(W,ce[ue].value);return d(W,this.value)&&(J.value=0),ce.push(J),ce};var O={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};O.SHORTLONG=fn({},O.SHORT,O.LONG),O.BINARY_SHORT=fn({},O.BINARY_SHORT_SI,O.BINARY_SHORT_IEC),O.BINARY_LONG=fn({},O.BINARY_LONG_SI,O.BINARY_LONG_IEC);var L=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],I={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 V in I)et(I,V)&&(I[V].key=V);var H={},Z={name:"",base:H,value:1,offset:0,dimensions:L.map(q=>0)},G={meter:{name:"meter",base:I.LENGTH,prefixes:O.LONG,value:1,offset:0},inch:{name:"inch",base:I.LENGTH,prefixes:O.NONE,value:.0254,offset:0},foot:{name:"foot",base:I.LENGTH,prefixes:O.NONE,value:.3048,offset:0},yard:{name:"yard",base:I.LENGTH,prefixes:O.NONE,value:.9144,offset:0},mile:{name:"mile",base:I.LENGTH,prefixes:O.NONE,value:1609.344,offset:0},link:{name:"link",base:I.LENGTH,prefixes:O.NONE,value:.201168,offset:0},rod:{name:"rod",base:I.LENGTH,prefixes:O.NONE,value:5.0292,offset:0},chain:{name:"chain",base:I.LENGTH,prefixes:O.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:I.LENGTH,prefixes:O.NONE,value:1e-10,offset:0},m:{name:"m",base:I.LENGTH,prefixes:O.SHORT,value:1,offset:0},in:{name:"in",base:I.LENGTH,prefixes:O.NONE,value:.0254,offset:0},ft:{name:"ft",base:I.LENGTH,prefixes:O.NONE,value:.3048,offset:0},yd:{name:"yd",base:I.LENGTH,prefixes:O.NONE,value:.9144,offset:0},mi:{name:"mi",base:I.LENGTH,prefixes:O.NONE,value:1609.344,offset:0},li:{name:"li",base:I.LENGTH,prefixes:O.NONE,value:.201168,offset:0},rd:{name:"rd",base:I.LENGTH,prefixes:O.NONE,value:5.02921,offset:0},ch:{name:"ch",base:I.LENGTH,prefixes:O.NONE,value:20.1168,offset:0},mil:{name:"mil",base:I.LENGTH,prefixes:O.NONE,value:254e-7,offset:0},m2:{name:"m2",base:I.SURFACE,prefixes:O.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:I.SURFACE,prefixes:O.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:I.SURFACE,prefixes:O.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:I.SURFACE,prefixes:O.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:I.SURFACE,prefixes:O.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:I.SURFACE,prefixes:O.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:I.SURFACE,prefixes:O.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:I.SURFACE,prefixes:O.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:I.SURFACE,prefixes:O.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:I.SURFACE,prefixes:O.NONE,value:1e4,offset:0},m3:{name:"m3",base:I.VOLUME,prefixes:O.CUBIC,value:1,offset:0},L:{name:"L",base:I.VOLUME,prefixes:O.SHORT,value:.001,offset:0},l:{name:"l",base:I.VOLUME,prefixes:O.SHORT,value:.001,offset:0},litre:{name:"litre",base:I.VOLUME,prefixes:O.LONG,value:.001,offset:0},cuin:{name:"cuin",base:I.VOLUME,prefixes:O.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:I.VOLUME,prefixes:O.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:I.VOLUME,prefixes:O.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:I.VOLUME,prefixes:O.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:I.VOLUME,prefixes:O.NONE,value:15e-6,offset:0},drop:{name:"drop",base:I.VOLUME,prefixes:O.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:I.VOLUME,prefixes:O.NONE,value:5e-8,offset:0},minim:{name:"minim",base:I.VOLUME,prefixes:O.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:I.VOLUME,prefixes:O.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:I.VOLUME,prefixes:O.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:I.VOLUME,prefixes:O.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:I.VOLUME,prefixes:O.NONE,value:1e-6,offset:0},cup:{name:"cup",base:I.VOLUME,prefixes:O.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:I.VOLUME,prefixes:O.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:I.VOLUME,prefixes:O.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:I.VOLUME,prefixes:O.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:I.VOLUME,prefixes:O.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:I.VOLUME,prefixes:O.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:I.VOLUME,prefixes:O.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:I.VOLUME,prefixes:O.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:I.VOLUME,prefixes:O.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:I.VOLUME,prefixes:O.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:I.VOLUME,prefixes:O.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:I.VOLUME,prefixes:O.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:I.VOLUME,prefixes:O.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:I.VOLUME,prefixes:O.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:I.VOLUME,prefixes:O.NONE,value:.1173478,offset:0},obl:{name:"obl",base:I.VOLUME,prefixes:O.NONE,value:.1589873,offset:0},g:{name:"g",base:I.MASS,prefixes:O.SHORT,value:.001,offset:0},gram:{name:"gram",base:I.MASS,prefixes:O.LONG,value:.001,offset:0},ton:{name:"ton",base:I.MASS,prefixes:O.SHORT,value:907.18474,offset:0},t:{name:"t",base:I.MASS,prefixes:O.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:I.MASS,prefixes:O.LONG,value:1e3,offset:0},grain:{name:"grain",base:I.MASS,prefixes:O.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:I.MASS,prefixes:O.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:I.MASS,prefixes:O.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:I.MASS,prefixes:O.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:I.MASS,prefixes:O.NONE,value:45.359237,offset:0},stick:{name:"stick",base:I.MASS,prefixes:O.NONE,value:.115,offset:0},stone:{name:"stone",base:I.MASS,prefixes:O.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:I.MASS,prefixes:O.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:I.MASS,prefixes:O.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:I.MASS,prefixes:O.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:I.MASS,prefixes:O.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:I.MASS,prefixes:O.NONE,value:45.359237,offset:0},s:{name:"s",base:I.TIME,prefixes:O.SHORT,value:1,offset:0},min:{name:"min",base:I.TIME,prefixes:O.NONE,value:60,offset:0},h:{name:"h",base:I.TIME,prefixes:O.NONE,value:3600,offset:0},second:{name:"second",base:I.TIME,prefixes:O.LONG,value:1,offset:0},sec:{name:"sec",base:I.TIME,prefixes:O.LONG,value:1,offset:0},minute:{name:"minute",base:I.TIME,prefixes:O.NONE,value:60,offset:0},hour:{name:"hour",base:I.TIME,prefixes:O.NONE,value:3600,offset:0},day:{name:"day",base:I.TIME,prefixes:O.NONE,value:86400,offset:0},week:{name:"week",base:I.TIME,prefixes:O.NONE,value:7*86400,offset:0},month:{name:"month",base:I.TIME,prefixes:O.NONE,value:2629800,offset:0},year:{name:"year",base:I.TIME,prefixes:O.NONE,value:31557600,offset:0},decade:{name:"decade",base:I.TIME,prefixes:O.NONE,value:315576e3,offset:0},century:{name:"century",base:I.TIME,prefixes:O.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:I.TIME,prefixes:O.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:I.FREQUENCY,prefixes:O.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:I.FREQUENCY,prefixes:O.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:I.ANGLE,prefixes:O.SHORT,value:1,offset:0},radian:{name:"radian",base:I.ANGLE,prefixes:O.LONG,value:1,offset:0},deg:{name:"deg",base:I.ANGLE,prefixes:O.SHORT,value:null,offset:0},degree:{name:"degree",base:I.ANGLE,prefixes:O.LONG,value:null,offset:0},grad:{name:"grad",base:I.ANGLE,prefixes:O.SHORT,value:null,offset:0},gradian:{name:"gradian",base:I.ANGLE,prefixes:O.LONG,value:null,offset:0},cycle:{name:"cycle",base:I.ANGLE,prefixes:O.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:I.ANGLE,prefixes:O.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:I.ANGLE,prefixes:O.NONE,value:null,offset:0},A:{name:"A",base:I.CURRENT,prefixes:O.SHORT,value:1,offset:0},ampere:{name:"ampere",base:I.CURRENT,prefixes:O.LONG,value:1,offset:0},K:{name:"K",base:I.TEMPERATURE,prefixes:O.SHORT,value:1,offset:0},degC:{name:"degC",base:I.TEMPERATURE,prefixes:O.SHORT,value:1,offset:273.15},degF:{name:"degF",base:I.TEMPERATURE,prefixes:O.SHORT,value:1/1.8,offset:459.67},degR:{name:"degR",base:I.TEMPERATURE,prefixes:O.SHORT,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:I.TEMPERATURE,prefixes:O.LONG,value:1,offset:0},celsius:{name:"celsius",base:I.TEMPERATURE,prefixes:O.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:I.TEMPERATURE,prefixes:O.LONG,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:I.TEMPERATURE,prefixes:O.LONG,value:1/1.8,offset:0},mol:{name:"mol",base:I.AMOUNT_OF_SUBSTANCE,prefixes:O.SHORT,value:1,offset:0},mole:{name:"mole",base:I.AMOUNT_OF_SUBSTANCE,prefixes:O.LONG,value:1,offset:0},cd:{name:"cd",base:I.LUMINOUS_INTENSITY,prefixes:O.SHORT,value:1,offset:0},candela:{name:"candela",base:I.LUMINOUS_INTENSITY,prefixes:O.LONG,value:1,offset:0},N:{name:"N",base:I.FORCE,prefixes:O.SHORT,value:1,offset:0},newton:{name:"newton",base:I.FORCE,prefixes:O.LONG,value:1,offset:0},dyn:{name:"dyn",base:I.FORCE,prefixes:O.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:I.FORCE,prefixes:O.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:I.FORCE,prefixes:O.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:I.FORCE,prefixes:O.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:I.FORCE,prefixes:O.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:I.FORCE,prefixes:O.NONE,value:9.80665,offset:0},J:{name:"J",base:I.ENERGY,prefixes:O.SHORT,value:1,offset:0},joule:{name:"joule",base:I.ENERGY,prefixes:O.SHORT,value:1,offset:0},erg:{name:"erg",base:I.ENERGY,prefixes:O.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:I.ENERGY,prefixes:O.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:I.ENERGY,prefixes:O.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:I.ENERGY,prefixes:O.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:I.ENERGY,prefixes:O.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:I.POWER,prefixes:O.SHORT,value:1,offset:0},watt:{name:"watt",base:I.POWER,prefixes:O.LONG,value:1,offset:0},hp:{name:"hp",base:I.POWER,prefixes:O.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:I.POWER,prefixes:O.SHORT,value:v.I,offset:0},VA:{name:"VA",base:I.POWER,prefixes:O.SHORT,value:1,offset:0},Pa:{name:"Pa",base:I.PRESSURE,prefixes:O.SHORT,value:1,offset:0},psi:{name:"psi",base:I.PRESSURE,prefixes:O.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:I.PRESSURE,prefixes:O.NONE,value:101325,offset:0},bar:{name:"bar",base:I.PRESSURE,prefixes:O.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:I.PRESSURE,prefixes:O.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:I.PRESSURE,prefixes:O.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:I.PRESSURE,prefixes:O.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:I.PRESSURE,prefixes:O.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:I.ELECTRIC_CHARGE,prefixes:O.LONG,value:1,offset:0},C:{name:"C",base:I.ELECTRIC_CHARGE,prefixes:O.SHORT,value:1,offset:0},farad:{name:"farad",base:I.ELECTRIC_CAPACITANCE,prefixes:O.LONG,value:1,offset:0},F:{name:"F",base:I.ELECTRIC_CAPACITANCE,prefixes:O.SHORT,value:1,offset:0},volt:{name:"volt",base:I.ELECTRIC_POTENTIAL,prefixes:O.LONG,value:1,offset:0},V:{name:"V",base:I.ELECTRIC_POTENTIAL,prefixes:O.SHORT,value:1,offset:0},ohm:{name:"ohm",base:I.ELECTRIC_RESISTANCE,prefixes:O.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:I.ELECTRIC_INDUCTANCE,prefixes:O.LONG,value:1,offset:0},H:{name:"H",base:I.ELECTRIC_INDUCTANCE,prefixes:O.SHORT,value:1,offset:0},siemens:{name:"siemens",base:I.ELECTRIC_CONDUCTANCE,prefixes:O.LONG,value:1,offset:0},S:{name:"S",base:I.ELECTRIC_CONDUCTANCE,prefixes:O.SHORT,value:1,offset:0},weber:{name:"weber",base:I.MAGNETIC_FLUX,prefixes:O.LONG,value:1,offset:0},Wb:{name:"Wb",base:I.MAGNETIC_FLUX,prefixes:O.SHORT,value:1,offset:0},tesla:{name:"tesla",base:I.MAGNETIC_FLUX_DENSITY,prefixes:O.LONG,value:1,offset:0},T:{name:"T",base:I.MAGNETIC_FLUX_DENSITY,prefixes:O.SHORT,value:1,offset:0},b:{name:"b",base:I.BIT,prefixes:O.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:I.BIT,prefixes:O.BINARY_LONG,value:1,offset:0},B:{name:"B",base:I.BIT,prefixes:O.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:I.BIT,prefixes:O.BINARY_LONG,value:8,offset:0}},Y={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function re(q){if(q.number==="BigNumber"){var J=xw(y);G.rad.value=new y(1),G.deg.value=J.div(180),G.grad.value=J.div(200),G.cycle.value=J.times(2),G.arcsec.value=J.div(648e3),G.arcmin.value=J.div(10800)}else G.rad.value=1,G.deg.value=Math.PI/180,G.grad.value=Math.PI/200,G.cycle.value=Math.PI*2,G.arcsec.value=Math.PI/648e3,G.arcmin.value=Math.PI/10800;G.radian.value=G.rad.value,G.degree.value=G.deg.value,G.gradian.value=G.grad.value}re(r),t&&t("config",function(q,J){q.number!==J.number&&re(q)});var ne={si:{NONE:{unit:Z,prefix:O.NONE[""]},LENGTH:{unit:G.m,prefix:O.SHORT[""]},MASS:{unit:G.g,prefix:O.SHORT.k},TIME:{unit:G.s,prefix:O.SHORT[""]},CURRENT:{unit:G.A,prefix:O.SHORT[""]},TEMPERATURE:{unit:G.K,prefix:O.SHORT[""]},LUMINOUS_INTENSITY:{unit:G.cd,prefix:O.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:G.mol,prefix:O.SHORT[""]},ANGLE:{unit:G.rad,prefix:O.SHORT[""]},BIT:{unit:G.bits,prefix:O.SHORT[""]},FORCE:{unit:G.N,prefix:O.SHORT[""]},ENERGY:{unit:G.J,prefix:O.SHORT[""]},POWER:{unit:G.W,prefix:O.SHORT[""]},PRESSURE:{unit:G.Pa,prefix:O.SHORT[""]},ELECTRIC_CHARGE:{unit:G.C,prefix:O.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:G.F,prefix:O.SHORT[""]},ELECTRIC_POTENTIAL:{unit:G.V,prefix:O.SHORT[""]},ELECTRIC_RESISTANCE:{unit:G.ohm,prefix:O.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:G.H,prefix:O.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:G.S,prefix:O.SHORT[""]},MAGNETIC_FLUX:{unit:G.Wb,prefix:O.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:G.T,prefix:O.SHORT[""]},FREQUENCY:{unit:G.Hz,prefix:O.SHORT[""]}}};ne.cgs=JSON.parse(JSON.stringify(ne.si)),ne.cgs.LENGTH={unit:G.m,prefix:O.SHORT.c},ne.cgs.MASS={unit:G.g,prefix:O.SHORT[""]},ne.cgs.FORCE={unit:G.dyn,prefix:O.SHORT[""]},ne.cgs.ENERGY={unit:G.erg,prefix:O.NONE[""]},ne.us=JSON.parse(JSON.stringify(ne.si)),ne.us.LENGTH={unit:G.ft,prefix:O.NONE[""]},ne.us.MASS={unit:G.lbm,prefix:O.NONE[""]},ne.us.TEMPERATURE={unit:G.degF,prefix:O.NONE[""]},ne.us.FORCE={unit:G.lbf,prefix:O.NONE[""]},ne.us.ENERGY={unit:G.BTU,prefix:O.BTU[""]},ne.us.POWER={unit:G.hp,prefix:O.NONE[""]},ne.us.PRESSURE={unit:G.psi,prefix:O.NONE[""]},ne.auto=JSON.parse(JSON.stringify(ne.si));var pe=ne.auto;x.setUnitSystem=function(q){if(et(ne,q))pe=ne[q];else throw new Error("Unit system "+q+" does not exist. Choices are: "+Object.keys(ne).join(", "))},x.getUnitSystem=function(){for(var q in ne)if(et(ne,q)&&ne[q]===pe)return q},x.typeConverters={BigNumber:function(J){return new y(J+"")},Fraction:function(J){return new b(J)},Complex:function(J){return J},number:function(J){return J}},x.prototype._numberConverter=function(){var q=x.typeConverters[this.valueType()];if(q)return q;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},x._getNumberConverter=function(q){if(!x.typeConverters[q])throw new TypeError('Unsupported type "'+q+'"');return x.typeConverters[q]};for(var he in G)if(et(G,he)){var le=G[he];le.dimensions=le.base.dimensions}for(var fe in Y)if(et(Y,fe)){var xe=G[Y[fe]],ge={};for(var ve in xe)et(xe,ve)&&(ge[ve]=xe[ve]);ge.name=fe,G[fe]=ge}x.isValidAlpha=function(J){return/^[a-zA-Z]$/.test(J)};function Ee(q){for(var J=0;J<q.length;J++){if(C=q.charAt(J),J===0&&!x.isValidAlpha(C))throw new Error('Invalid unit name (must begin with alpha character): "'+q+'"');if(J>0&&!(x.isValidAlpha(C)||_(C)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+q+'"')}}return x.createUnit=function(q,J){if(typeof q!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(J&&J.override){for(var ce in q)if(et(q,ce)&&x.deleteUnit(ce),q[ce].aliases)for(var X=0;X<q[ce].aliases.length;X++)x.deleteUnit(q[ce].aliases[X])}var te;for(var ae in q)et(q,ae)&&(te=x.createUnitSingle(ae,q[ae]));return te},x.createUnitSingle=function(q,J){if((typeof J>"u"||J===null)&&(J={}),typeof q!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(et(G,q))throw new Error('Cannot create unit "'+q+'": a unit with that name already exists');Ee(q);var ce=null,X=[],te=0,ae,De,be;if(J&&J.type==="Unit")ce=J.clone();else if(typeof J=="string")J!==""&&(ae=J);else if(typeof J=="object")ae=J.definition,De=J.prefixes,te=J.offset,be=J.baseName,J.aliases&&(X=J.aliases.valueOf());else throw new TypeError('Cannot create unit "'+q+'" from "'+J.toString()+'": expecting "string" or "Unit" or "Object"');if(X){for(var K=0;K<X.length;K++)if(et(G,X[K]))throw new Error('Cannot create alias "'+X[K]+'": a unit with that name already exists')}if(ae&&typeof ae=="string"&&!ce)try{ce=x.parse(ae,{allowNoUnits:!0})}catch(bt){throw bt.message='Could not create unit "'+q+'" from "'+ae+'": '+bt.message,bt}else ae&&ae.type==="Unit"&&(ce=ae.clone());X=X||[],te=te||0,De&&De.toUpperCase?De=O[De.toUpperCase()]||O.NONE:De=O.NONE;var W={};if(ce){W={name:q,value:ce.value,dimensions:ce.dimensions.slice(0),prefixes:De,offset:te};var _e=!1;for(var Ae in I)if(et(I,Ae)){for(var Ce=!0,Me=0;Me<L.length;Me++)if(Math.abs((W.dimensions[Me]||0)-(I[Ae].dimensions[Me]||0))>1e-12){Ce=!1;break}if(Ce){_e=!0,W.base=I[Ae];break}}if(!_e){be=be||q+"_STUFF";var Te={dimensions:ce.dimensions.slice(0)};Te.key=be,I[be]=Te,pe[be]={unit:W,prefix:O.NONE[""]},W.base=I[be]}}else{if(be=be||q+"_STUFF",L.indexOf(be)>=0)throw new Error('Cannot create new base unit "'+q+'": a base unit with that name already exists (and cannot be overridden)');L.push(be);for(var ue in I)et(I,ue)&&(I[ue].dimensions[L.length-1]=0);for(var me={dimensions:[]},we=0;we<L.length;we++)me.dimensions[we]=0;me.dimensions[L.length-1]=1,me.key=be,I[be]=me,W={name:q,value:1,dimensions:I[be].dimensions.slice(0),prefixes:De,offset:te,base:I[be]},pe[be]={unit:W,prefix:O.NONE[""]}}x.UNITS[q]=W;for(var Ve=0;Ve<X.length;Ve++){var Re=X[Ve],dt={};for(var Ze in W)et(W,Ze)&&(dt[Ze]=W[Ze]);dt.name=Re,x.UNITS[Re]=dt}return delete P.cache,new x(null,q)},x.deleteUnit=function(q){delete x.UNITS[q]},x.PREFIXES=O,x.BASE_DIMENSIONS=L,x.BASE_UNITS=I,x.UNIT_SYSTEMS=ne,x.UNITS=G,x},{isClass:!0}),fI="unit",mae=["typed","Unit"],Cm=Q(fI,mae,e=>{var{typed:t,Unit:r}=e;return t(fI,{Unit:function(i){return i.clone()},string:function(i){return r.isValuelessUnit(i)?new r(null,i):r.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new r(i,a)},"number | BigNumber | Fraction":function(i){return new r(i)},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),pI="sparse",vae=["typed","SparseMatrix"],Sm=Q(pI,vae,e=>{var{typed:t,SparseMatrix:r}=e;return t(pI,{"":function(){return new r([])},string:function(i){return new r([],i)},"Array | Matrix":function(i){return new r(i)},"Array | Matrix, string":function(i,a){return new r(i,a)}})}),hI="createUnit",gae=["typed","Unit"],Dm=Q(hI,gae,e=>{var{typed:t,Unit:r}=e;return t(hI,{"Object, Object":function(i,a){return r.createUnit(i,a)},Object:function(i){return r.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var s={};return s[i]=a,r.createUnit(s,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,r.createUnit(o,{})},string:function(i){var a={};return a[i]={},r.createUnit(a,{})}})}),mI="acos",yae=["typed","config","Complex"],Em=Q(mI,yae,e=>{var{typed:t,config:r,Complex:n}=e;return t(mI,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})}),vI="acosh",bae=["typed","config","Complex"],Nm=Q(vI,bae,e=>{var{typed:t,config:r,Complex:n}=e;return t(vI,{number:function(a){return a>=1||r.predictable?LT(a):a<=-1?new n(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new n(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})}),gI="acot",xae=["typed","BigNumber"],Am=Q(gI,xae,e=>{var{typed:t,BigNumber:r}=e;return t(gI,{number:VT,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})}),yI="acoth",wae=["typed","config","Complex","BigNumber"],_m=Q(yI,wae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(yI,{number:function(o){return o>=1||o<=-1||r.predictable?qT(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})}),bI="acsc",Cae=["typed","config","Complex","BigNumber"],Mm=Q(bI,Cae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(bI,{number:function(o){return o<=-1||o>=1||r.predictable?GT(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})}),xI="acsch",Sae=["typed","BigNumber"],Tm=Q(xI,Sae,e=>{var{typed:t,BigNumber:r}=e;return t(xI,{number:UT,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})}),wI="asec",Dae=["typed","config","Complex","BigNumber"],Om=Q(wI,Dae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(wI,{number:function(o){return o<=-1||o>=1||r.predictable?WT(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})}),CI="asech",Eae=["typed","config","Complex","BigNumber"],Rm=Q(CI,Eae,e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(CI,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return HT(o);var l=Math.sqrt(s*s-1);return new n(Math.log(l-s),Math.PI)}return new n(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})}),SI="asin",Nae=["typed","config","Complex"],Im=Q(SI,Nae,e=>{var{typed:t,config:r,Complex:n}=e;return t(SI,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})}),Aae="asinh",_ae=["typed"],km=Q(Aae,_ae,e=>{var{typed:t}=e;return t("asinh",{number:jT,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})}),Mae="atan",Tae=["typed"],Pm=Q(Mae,Tae,e=>{var{typed:t}=e;return t("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})}),DI="atan2",Oae=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Fm=Q(DI,Oae,e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=Wi({typed:t,equalScalar:n}),l=Vn({typed:t}),u=qO({typed:t,equalScalar:n}),c=Cn({typed:t,equalScalar:n}),d=sn({typed:t,DenseMatrix:a}),f=vr({typed:t,matrix:r,concat:o});return t(DI,{"number, number":Math.atan2,"BigNumber, BigNumber":(p,m)=>i.atan2(p,m)},f({scalar:"number | BigNumber",SS:u,DS:l,SD:s,Ss:c,sS:d}))}),EI="atanh",Rae=["typed","config","Complex"],$m=Q(EI,Rae,e=>{var{typed:t,config:r,Complex:n}=e;return t(EI,{number:function(a){return a<=1&&a>=-1||r.predictable?KT(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})}),kl=Q("trigUnit",["typed"],e=>{var{typed:t}=e;return{Unit:t.referToSelf(r=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(r,n.valueType())(n.value)})}}),NI="cos",Iae=["typed"],Bm=Q(NI,Iae,e=>{var{typed:t}=e,r=kl({typed:t});return t(NI,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)}),AI="cosh",kae=["typed"],zm=Q(AI,kae,e=>{var{typed:t}=e;return t(AI,{number:_J,"Complex | BigNumber":r=>r.cosh()})}),_I="cot",Pae=["typed","BigNumber"],Lm=Q(_I,Pae,e=>{var{typed:t,BigNumber:r}=e,n=kl({typed:t});return t(_I,{number:YT,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)}),MI="coth",Fae=["typed","BigNumber"],Vm=Q(MI,Fae,e=>{var{typed:t,BigNumber:r}=e;return t(MI,{number:XT,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})}),TI="csc",$ae=["typed","BigNumber"],qm=Q(TI,$ae,e=>{var{typed:t,BigNumber:r}=e,n=kl({typed:t});return t(TI,{number:ZT,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)}),OI="csch",Bae=["typed","BigNumber"],Gm=Q(OI,Bae,e=>{var{typed:t,BigNumber:r}=e;return t(OI,{number:QT,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})}),RI="sec",zae=["typed","BigNumber"],Um=Q(RI,zae,e=>{var{typed:t,BigNumber:r}=e,n=kl({typed:t});return t(RI,{number:JT,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)}),II="sech",Lae=["typed","BigNumber"],Wm=Q(II,Lae,e=>{var{typed:t,BigNumber:r}=e;return t(II,{number:eO,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})}),kI="sin",Vae=["typed"],Hm=Q(kI,Vae,e=>{var{typed:t}=e,r=kl({typed:t});return t(kI,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)}),PI="sinh",qae=["typed"],jm=Q(PI,qae,e=>{var{typed:t}=e;return t(PI,{number:tO,"Complex | BigNumber":r=>r.sinh()})}),FI="tan",Gae=["typed"],Km=Q(FI,Gae,e=>{var{typed:t}=e,r=kl({typed:t});return t(FI,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)}),Uae="tanh",Wae=["typed"],Ym=Q(Uae,Wae,e=>{var{typed:t}=e;return t("tanh",{number:TJ,"Complex | BigNumber":r=>r.tanh()})}),$I="setCartesian",Hae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Xm=Q($I,Hae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t($I,{"Array | Matrix, Array | Matrix":function(l,u){var c=[];if(n(r(l),new a(0))!==0&&n(r(u),new a(0))!==0){var d=Qt(Array.isArray(l)?l:l.toArray()).sort(i),f=Qt(Array.isArray(u)?u:u.toArray()).sort(i);c=[];for(var p=0;p<d.length;p++)for(var m=0;m<f.length;m++)c.push([d[p],f[m]])}return Array.isArray(l)&&Array.isArray(u)?c:new o(c)}})}),BI="setDifference",jae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Zm=Q(BI,jae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(BI,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0)c=[];else{if(n(r(u),new a(0))===0)return Qt(l.toArray());var d=wl(Qt(Array.isArray(l)?l:l.toArray()).sort(i)),f=wl(Qt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p,m=0;m<d.length;m++){p=!1;for(var v=0;v<f.length;v++)if(i(d[m].value,f[v].value)===0&&d[m].identifier===f[v].identifier){p=!0;break}p||c.push(d[m])}}return Array.isArray(l)&&Array.isArray(u)?Sf(c):new o(Sf(c))}})}),zI="setDistinct",Kae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Qm=Q(zI,Kae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(zI,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=Qt(Array.isArray(l)?l:l.toArray()).sort(i);u=[],u.push(c[0]);for(var d=1;d<c.length;d++)i(c[d],c[d-1])!==0&&u.push(c[d])}return Array.isArray(l)?u:new o(u)}})}),LI="setIntersect",Yae=["typed","size","subset","compareNatural","Index","DenseMatrix"],Jm=Q(LI,Yae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(LI,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0||n(r(u),new a(0))===0)c=[];else{var d=wl(Qt(Array.isArray(l)?l:l.toArray()).sort(i)),f=wl(Qt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p=0;p<d.length;p++)for(var m=0;m<f.length;m++)if(i(d[p].value,f[m].value)===0&&d[p].identifier===f[m].identifier){c.push(d[p]);break}}return Array.isArray(l)&&Array.isArray(u)?Sf(c):new o(Sf(c))}})}),VI="setIsSubset",Xae=["typed","size","subset","compareNatural","Index"],ev=Q(VI,Xae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(VI,{"Array | Matrix, Array | Matrix":function(s,l){if(n(r(s),new a(0))===0)return!0;if(n(r(l),new a(0))===0)return!1;for(var u=wl(Qt(Array.isArray(s)?s:s.toArray()).sort(i)),c=wl(Qt(Array.isArray(l)?l:l.toArray()).sort(i)),d,f=0;f<u.length;f++){d=!1;for(var p=0;p<c.length;p++)if(i(u[f].value,c[p].value)===0&&u[f].identifier===c[p].identifier){d=!0;break}if(d===!1)return!1}return!0}})}),qI="setMultiplicity",Zae=["typed","size","subset","compareNatural","Index"],tv=Q(qI,Zae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(qI,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=Qt(Array.isArray(l)?l:l.toArray()),c=0,d=0;d<u.length;d++)i(u[d],s)===0&&c++;return c}})}),GI="setPowerset",Qae=["typed","size","subset","compareNatural","Index"],rv=Q(GI,Qae,e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(GI,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=Qt(Array.isArray(u)?u:u.toArray()).sort(i),d=[],f=0;f.toString(2).length<=c.length;)d.push(o(c,f.toString(2).split("").reverse())),f++;return s(d)}});function o(l,u){for(var c=[],d=0;d<u.length;d++)u[d]==="1"&&c.push(l[d]);return c}function s(l){for(var u=[],c=l.length-1;c>0;c--)for(var d=0;d<c;d++)l[d].length>l[d+1].length&&(u=l[d],l[d]=l[d+1],l[d+1]=u);return l}}),UI="setSize",Jae=["typed","compareNatural"],nv=Q(UI,Jae,e=>{var{typed:t,compareNatural:r}=e;return t(UI,{"Array | Matrix":function(i){return Array.isArray(i)?Qt(i).length:Qt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?Qt(i).length:Qt(i.toArray()).length;for(var o=Qt(Array.isArray(i)?i:i.toArray()).sort(r),s=1,l=1;l<o.length;l++)r(o[l],o[l-1])!==0&&s++;return s}})}),WI="setSymDifference",eoe=["typed","size","concat","subset","setDifference","Index"],iv=Q(WI,eoe,e=>{var{typed:t,size:r,concat:n,subset:i,setDifference:a,Index:o}=e;return t(WI,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return Qt(u);if(i(r(u),new o(0))===0)return Qt(l);var c=Qt(l),d=Qt(u);return n(a(c,d),a(d,c))}})}),HI="setUnion",toe=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],av=Q(HI,toe,e=>{var{typed:t,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(HI,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return Qt(c);if(i(r(c),new s(0))===0)return Qt(u);var d=Qt(u),f=Qt(c);return n(o(d,f),a(d,f))}})}),jI="add",roe=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],ov=Q(jI,roe,e=>{var{typed:t,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,l=Bo({typed:t}),u=hw({typed:t,equalScalar:i}),c=gs({typed:t,DenseMatrix:a}),d=vr({typed:t,matrix:r,concat:s});return t(jI,{"any, any":n,"any, any, ...any":t.referToSelf(f=>(p,m,v)=>{for(var y=f(p,m),b=0;b<v.length;b++)y=f(y,v[b]);return y})},d({elop:n,DS:l,SS:u,Ss:c}))}),KI="hypot",noe=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],sv=Q(KI,noe,e=>{var{typed:t,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:l}=e;return t(KI,{"... number | BigNumber":u,Array:u,Matrix:c=>u(Qt(c.toArray()))});function u(c){for(var d=0,f=0,p=0;p<c.length;p++){if(yi(c[p]))throw new TypeError("Unexpected type of argument to hypot");var m=r(c[p]);s(f,m)?(d=a(d,a(i(f,m),i(f,m))),d=n(d,1),f=m):d=n(d,l(m)?a(i(m,f),i(m,f)):m)}return a(f,o(d))}}),YI="norm",ioe=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],lv=Q(YI,ioe,e=>{var{typed:t,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:l,larger:u,smaller:c,matrix:d,ctranspose:f,eigs:p}=e;return t(YI,{number:Math.abs,Complex:function(A){return A.abs()},BigNumber:function(A){return A.abs()},boolean:function(A){return Math.abs(A)},Array:function(A){return C(d(A),2)},Matrix:function(A){return C(A,2)},"Array, number | BigNumber | string":function(A,_){return C(d(A),_)},"Matrix, number | BigNumber | string":function(A,_){return C(A,_)}});function m(E){var A=0;return E.forEach(function(_){var N=r(_);u(N,A)&&(A=N)},!0),A}function v(E){var A;return E.forEach(function(_){var N=r(_);(!A||c(N,A))&&(A=N)},!0),A||0}function y(E,A){if(A===Number.POSITIVE_INFINITY||A==="inf")return m(E);if(A===Number.NEGATIVE_INFINITY||A==="-inf")return v(E);if(A==="fro")return C(E,2);if(typeof A=="number"&&!isNaN(A)){if(!l(A,0)){var _=0;return E.forEach(function(N){_=n(i(r(N),A),_)},!0),i(_,1/A)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function b(E){var A=0;return E.forEach(function(_,N){A=n(A,s(_,a(_)))}),r(o(A))}function D(E){var A=[],_=0;return E.forEach(function(N,M){var R=M[1],F=n(A[R]||0,r(N));u(F,_)&&(_=F),A[R]=F},!0),_}function x(E){var A=E.size();if(A[0]!==A[1])throw new RangeError("Invalid matrix dimensions");var _=f(E),N=s(_,E),M=p(N).values.toArray(),R=M[M.length-1];return r(o(R))}function S(E){var A=[],_=0;return E.forEach(function(N,M){var R=M[0],F=n(A[R]||0,r(N));u(F,_)&&(_=F),A[R]=F},!0),_}function w(E,A){if(A===1)return D(E);if(A===Number.POSITIVE_INFINITY||A==="inf")return S(E);if(A==="fro")return b(E);if(A===2)return x(E);throw new Error("Unsupported parameter value "+A)}function C(E,A){var _=E.size();if(_.length===1)return y(E,A);if(_.length===2){if(_[0]&&_[1])return w(E,A);throw new RangeError("Invalid matrix dimensions")}}}),XI="dot",aoe=["typed","addScalar","multiplyScalar","conj","size"],uv=Q(XI,aoe,e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:a}=e;return t(XI,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":l});function o(c,d){var f=u(c),p=u(d),m,v;if(f.length===1)m=f[0];else if(f.length===2&&f[1]===1)m=f[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+f.join(", ")+")");if(p.length===1)v=p[0];else if(p.length===2&&p[1]===1)v=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(m!==v)throw new RangeError("Vectors must have equal length ("+m+" != "+v+")");if(m===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return m}function s(c,d){var f=o(c,d),p=ft(c)?c._data:c,m=ft(c)?c._datatype:void 0,v=ft(d)?d._data:d,y=ft(d)?d._datatype:void 0,b=u(c).length===2,D=u(d).length===2,x=r,S=n;if(m&&y&&m===y&&typeof m=="string"){var w=m;x=t.find(r,[w,w]),S=t.find(n,[w,w])}if(!b&&!D){for(var C=S(i(p[0]),v[0]),E=1;E<f;E++)C=x(C,S(i(p[E]),v[E]));return C}if(!b&&D){for(var A=S(i(p[0]),v[0][0]),_=1;_<f;_++)A=x(A,S(i(p[_]),v[_][0]));return A}if(b&&!D){for(var N=S(i(p[0][0]),v[0]),M=1;M<f;M++)N=x(N,S(i(p[M][0]),v[M]));return N}if(b&&D){for(var R=S(i(p[0][0]),v[0][0]),F=1;F<f;F++)R=x(R,S(i(p[F][0]),v[F][0]));return R}}function l(c,d){o(c,d);for(var f=c._index,p=c._values,m=d._index,v=d._values,y=0,b=r,D=n,x=0,S=0;x<f.length&&S<m.length;){var w=f[x],C=m[S];if(w<C){x++;continue}if(w>C){S++;continue}w===C&&(y=b(y,D(p[x],v[S])),x++,S++)}return y}function u(c){return ft(c)?c.size():a(c)}}),ooe="trace",soe=["typed","matrix","add"],cv=Q(ooe,soe,e=>{var{typed:t,matrix:r,add:n}=e;return t("trace",{Array:function(s){return i(r(s))},SparseMatrix:a,DenseMatrix:i,any:pt});function i(o){var s=o._size,l=o._data;switch(s.length){case 1:if(s[0]===1)return pt(l[0]);throw new RangeError("Matrix must be square (size: "+Pt(s)+")");case 2:{var u=s[0],c=s[1];if(u===c){for(var d=0,f=0;f<u;f++)d=n(d,l[f][f]);return d}else throw new RangeError("Matrix must be square (size: "+Pt(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(s)+")")}}function a(o){var s=o._values,l=o._index,u=o._ptr,c=o._size,d=c[0],f=c[1];if(d===f){var p=0;if(s.length>0)for(var m=0;m<f;m++)for(var v=u[m],y=u[m+1],b=v;b<y;b++){var D=l[b];if(D===m){p=n(p,s[b]);break}if(D>m)break}return p}throw new RangeError("Matrix must be square (size: "+Pt(c)+")")}}),ZI="index",loe=["typed","Index"],dv=Q(ZI,loe,e=>{var{typed:t,Index:r}=e;return t(ZI,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(s){return kt(s)?s.toNumber():Array.isArray(s)||ft(s)?s.map(function(l){return kt(l)?l.toNumber():l}):s}),o=new r;return r.apply(o,a),o}})}),QI=new Set(["end"]),uoe="Node",coe=["mathWithTransform"],fv=Q(uoe,coe,e=>{var{mathWithTransform:t}=e;function r(i){for(var a of[...QI])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(t,{}),o={},s=null;function l(u){var c=Dl(u);return r(c),a(c,o,s)}return{evaluate:l}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!sr(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(s,l){s.forEach(function(u,c,d){l(u,c,d),o(u,l)})}o(this,a)}transform(a){function o(s,l,u){var c=a(s,l,u);return c!==s?c:s.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(s,l,u){a(s,l,u)&&o.push(s)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&ju(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toString(a)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o<"u"?o:this.toHTML(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function Gn(e){return e&&e.isIndexError?new ii(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function JI(e){var{subset:t}=e;return function(n,i){try{if(Array.isArray(n))return t(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return t(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Si(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Gn(a)}}}var pv="AccessorNode",doe=["subset","Node"],hv=Q(pv,doe,e=>{var{subset:t,Node:r}=e,n=JI({subset:t});function i(o){return!(Ka(o)||Yn(o)||Kt(o)||ya(o)||vl(o)||zi(o)||en(o))}class a extends r{constructor(s,l){if(super(),!sr(s))throw new TypeError('Node expected for parameter "object"');if(!To(l))throw new TypeError('IndexNode expected for parameter "index"');this.object=s,this.index=l}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return pv}get isAccessorNode(){return!0}_compile(s,l){var u=this.object._compile(s,l),c=this.index._compile(s,l);if(this.index.isObjectProperty()){var d=this.index.getObjectProperty();return function(p,m,v){return Si(u(p,m,v),d)}}else return function(p,m,v){var y=u(p,m,v),b=c(p,m,y);return n(y,b)}}forEach(s){s(this.object,"object",this),s(this.index,"index",this)}map(s){return new a(this._ifNode(s(this.object,"object",this)),this._ifNode(s(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(s){var l=this.object.toString(s);return i(this.object)&&(l="("+l+")"),l+this.index.toString(s)}toHTML(s){var l=this.object.toHTML(s);return i(this.object)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+this.index.toHTML(s)}_toTex(s){var l=this.object.toTex(s);return i(this.object)&&(l="\\left(' + object + '\\right)"),l+this.index.toTex(s)}toJSON(){return{mathjs:pv,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return pn(a,"name",pv),a},{isClass:!0,isNode:!0}),mv="ArrayNode",foe=["Node"],vv=Q(mv,foe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(sr))throw new TypeError("Array containing Nodes expected")}get type(){return mv}get isArrayNode(){return!0}_compile(i,a){var o=Ya(this.items,function(u){return u._compile(i,a)}),s=i.config.matrix!=="Array";if(s){var l=i.matrix;return function(c,d,f){return l(Ya(o,function(p){return p(c,d,f)}))}}else return function(c,d,f){return Ya(o,function(p){return p(c,d,f)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new r(a)}clone(){return new r(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:mv,items:this.items}}static fromJSON(i){return new r(i.items)}toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,s){var l=o.some(Yn)&&!o.every(Yn),u=s||l,c=u?"&":"\\\\",d=o.map(function(f){return f.items?a(f.items,!s):f.toTex(i)}).join(c);return l||!u||u&&!s?"\\begin{bmatrix}"+d+"\\end{bmatrix}":d}return a(this.items,!1)}}return pn(r,"name",mv),r},{isClass:!0,isNode:!0});function poe(e){var{subset:t,matrix:r}=e;return function(i,a,o){try{if(Array.isArray(i))return r(i).subset(a,o).valueOf();if(i&&typeof i.subset=="function")return i.subset(a,o);if(typeof i=="string")return t(i,a,o);if(typeof i=="object"){if(!a.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Cl(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(s){throw Gn(s)}}}var Hi=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function gv(e,t){if(!t||t!=="auto")return e;for(var r=e;zi(r);)r=r.content;return r}function mr(e,t,r,n){var i=e;t!=="keep"&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<Hi.length;s++)if(a in Hi[s]){o=s;break}if(a==="OperatorNode:multiply"&&i.implicit&&r!=="show"){var l=gv(i.args[0],t);!(Kt(l)&&n&&n.getIdentifier()==="OperatorNode:divide"&&Lx(gv(n.args[0],t)))&&!(l.getIdentifier()==="OperatorNode:divide"&&Lx(gv(l.args[0],t))&&Kt(gv(l.args[1])))&&(o+=1)}return o}function dc(e,t){var r=e;t!=="keep"&&(r=e.getContent());var n=r.getIdentifier(),i=mr(r,t);if(i===null)return null;var a=Hi[i][n];if(et(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function Cw(e,t,r){var n=r!=="keep"?e.getContent():e,i=r!=="keep"?e.getContent():t,a=n.getIdentifier(),o=i.getIdentifier(),s=mr(n,r);if(s===null)return null;var l=Hi[s][a];if(et(l,"associativeWith")&&l.associativeWith instanceof Array){for(var u=0;u<l.associativeWith.length;u++)if(l.associativeWith[u]===o)return!0;return!1}return null}function hoe(e){var t="OperatorNode:"+e;for(var r of Hi)if(t in r)return r[t].op;return null}var yv="AssignmentNode",moe=["subset","?matrix","Node"],bv=Q(yv,moe,e=>{var{subset:t,matrix:r,Node:n}=e,i=JI({subset:t}),a=poe({subset:t,matrix:r});function o(l,u,c){u||(u="keep");var d=mr(l,u,c),f=mr(l.value,u,c);return u==="all"||f!==null&&f<=d}class s extends n{constructor(u,c,d){if(super(),this.object=u,this.index=d?c:null,this.value=d||c,!en(u)&&!Ka(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(en(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!To(this.index))throw new TypeError('IndexNode expected as "index"');if(!sr(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return yv}get isAssignmentNode(){return!0}_compile(u,c){var d=this.object._compile(u,c),f=this.index?this.index._compile(u,c):null,p=this.value._compile(u,c),m=this.object.name;if(this.index)if(this.index.isObjectProperty()){var v=this.index.getObjectProperty();return function(S,w,C){var E=d(S,w,C),A=p(S,w,C);return Cl(E,v,A),A}}else{if(en(this.object))return function(S,w,C){var E=d(S,w,C),A=p(S,w,C),_=f(S,w,E);return S.set(m,a(E,_,A)),A};var y=this.object.object._compile(u,c);if(this.object.index.isObjectProperty()){var b=this.object.index.getObjectProperty();return function(S,w,C){var E=y(S,w,C),A=Si(E,b),_=f(S,w,A),N=p(S,w,C);return Cl(E,b,a(A,_,N)),N}}else{var D=this.object.index._compile(u,c);return function(S,w,C){var E=y(S,w,C),A=D(S,w,E),_=i(E,A),N=f(S,w,_),M=p(S,w,C);return a(E,A,a(_,N,M)),M}}}else{if(!en(this.object))throw new TypeError("SymbolNode expected as object");return function(S,w,C){var E=p(S,w,C);return S.set(m,E),E}}}forEach(u){u(this.object,"object",this),this.index&&u(this.index,"index",this),u(this.value,"value",this)}map(u){var c=this._ifNode(u(this.object,"object",this)),d=this.index?this._ifNode(u(this.index,"index",this)):null,f=this._ifNode(u(this.value,"value",this));return new s(c,d,f)}clone(){return new s(this.object,this.index,this.value)}_toString(u){var c=this.object.toString(u),d=this.index?this.index.toString(u):"",f=this.value.toString(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(f="("+f+")"),c+d+" = "+f}toJSON(){return{mathjs:yv,object:this.object,index:this.index,value:this.value}}static fromJSON(u){return new s(u.object,u.index,u.value)}toHTML(u){var c=this.object.toHTML(u),d=this.index?this.index.toHTML(u):"",f=this.value.toHTML(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(f='<span class="math-paranthesis math-round-parenthesis">(</span>'+f+'<span class="math-paranthesis math-round-parenthesis">)</span>'),c+d+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+f}_toTex(u){var c=this.object.toTex(u),d=this.index?this.index.toTex(u):"",f=this.value.toTex(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(f="\\left(".concat(f,"\\right)")),c+d+":="+f}}return pn(s,"name",yv),s},{isClass:!0,isNode:!0}),xv="BlockNode",voe=["ResultSet","Node"],wv=Q(xv,voe,e=>{var{ResultSet:t,Node:r}=e;class n extends r{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var s=o&&o.node,l=o&&o.visible!==void 0?o.visible:!0;if(!sr(s))throw new TypeError('Property "node" must be a Node');if(typeof l!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:s,visible:l}})}get type(){return xv}get isBlockNode(){return!0}_compile(a,o){var s=Ya(this.blocks,function(l){return{evaluate:l.node._compile(a,o),visible:l.visible}});return function(u,c,d){var f=[];return wf(s,function(m){var v=m.evaluate(u,c,d);m.visible&&f.push(v)}),new t(f)}}forEach(a){for(var o=0;o<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],s=0;s<this.blocks.length;s++){var l=this.blocks[s],u=this._ifNode(a(l.node,"blocks["+s+"].node",this));o[s]={node:u,visible:l.visible}}return new n(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new n(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
111
111
  `)}toJSON(){return{mathjs:xv,blocks:this.blocks}}static fromJSON(a){return new n(a.blocks)}toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
112
- `)}}return pn(n,"name",xv),n},{isClass:!0,isNode:!0}),Cv="ConditionalNode",goe=["Node"],Sv=Q(Cv,goe,e=>{var{Node:t}=e;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(kt(i))return!i.isZero();if(yi(i))return!!(i.re||i.im);if(bi(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+Or(i)+'"')}class n extends t{constructor(a,o,s){if(super(),!sr(a))throw new TypeError("Parameter condition must be a Node");if(!sr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!sr(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return Cv}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(d,f,p){return r(s(d,f,p))?l(d,f,p):u(d,f,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.condition.toString(a),u=mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),d=mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||d!==null&&d<=s)&&(c="("+c+")");var f=this.falseExpr.toString(a),p=mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(f="("+f+")"),l+" ? "+c+" : "+f}toJSON(){return{mathjs:Cv,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),d=mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||d!==null&&d<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var f=this.falseExpr.toHTML(a),p=mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+f}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return pn(n,"name",Cv),n},{isClass:!0,isNode:!0}),Sw=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yoe={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},boe={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},xoe=function(t,r){return Sw({},t,r)},woe=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.preserveFormatting,n=r===void 0?!1:r,i=t.escapeMapFn,a=i===void 0?xoe:i,o=String(e),s="",l=a(Sw({},yoe),n?Sw({},boe):{}),u=Object.keys(l),c=function(){var f=!1;u.forEach(function(p,m){f||o.length>=p.length&&o.slice(0,p.length)===p&&(s+=l[u[m]],o=o.slice(p.length,o.length),f=!0)}),f||(s+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return s};const Coe=woe;var Dw={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{?}"},Jt={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"},eI={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Jt.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Jt.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Jt.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Jt.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Jt.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Jt.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Jt.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Jt.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Jt.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Jt.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Jt.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Jt.bitAnd,"${args[1]}\\right)")},bitNot:{1:Jt.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Jt.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Jt.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Jt.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Jt.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Jt.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Jt.and,"${args[1]}\\right)")},not:{1:Jt.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Jt.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Jt.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Jt.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Jt.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Jt.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Jt.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Jt.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Jt.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Jt.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Jt.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Jt.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Jt.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Jt.to,"${args[1]}\\right)")},numeric:function(t,r){return t.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(Dw.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)"}},Soe="\\mathrm{${name}}\\left(${args}\\right)",tI={deg:"^\\circ"};function Ew(e){return Coe(e,{preserveFormatting:!0})}function rI(e,t){return t=typeof t>"u"?!1:t,t?et(tI,e)?tI[e]:"\\mathrm{"+Ew(e)+"}":et(Dw,e)?Dw[e]:Ew(e)}var Dv="ConstantNode",Doe=["Node"],Ev=Q(Dv,Doe,e=>{var{Node:t}=e;class r extends t{constructor(i){super(),this.value=i}get type(){return Dv}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new r(this.value)}_toString(i){return Pt(this.value,i)}toHTML(i){var a=this._toString(i);switch(Or(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:Dv,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i);switch(Or(this.value)){case"string":return"\\mathtt{"+Ew(a)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var o=a.toLowerCase().indexOf("e");if(o!==-1)return a.substring(0,o)+"\\cdot10^{"+a.substring(o+1)+"}"}return a;case"Fraction":return this.value.toLatex();default:return a}}}return pn(r,"name",Dv),r},{isClass:!0,isNode:!0}),Nv="FunctionAssignmentNode",Eoe=["typed","Node"],Av=Q(Nv,Eoe,e=>{var{typed:t,Node:r}=e;function n(a,o,s){var l=mr(a,o,s),u=mr(a.expr,o,s);return o==="all"||u!==null&&u<=l}class i extends r{constructor(o,s,l){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(s))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!sr(l))throw new TypeError('Node expected for parameter "expr"');if(Q3.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var u=new Set;for(var c of s){var d=typeof c=="string"?c:c.name;if(u.has(d))throw new Error('Duplicate parameter name "'.concat(d,'"'));u.add(d)}this.name=o,this.params=s.map(function(f){return f&&f.name||f}),this.types=s.map(function(f){return f&&f.type||"any"}),this.expr=l}get type(){return Nv}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);wf(this.params,function(m){l[m]=!0});var u=this.expr._compile(o,l),c=this.name,d=this.params,f=PM(this.types,","),p=c+"("+PM(this.params,", ")+")";return function(v,y,b){var D={};D[f]=function(){for(var S=Object.create(y),w=0;w<d.length;w++)S[d[w]]=arguments[w];return u(v,S,b)};var x=t(c,D);return x.syntax=p,v.set(c,x),x}}forEach(o){o(this.expr,"expr",this)}map(o){var s=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),s)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toString(o);return n(this,s,o&&o.implicit)&&(l="("+l+")"),this.name+"("+this.params.join(", ")+") = "+l}toJSON(){var o=this.types;return{mathjs:Nv,name:this.name,params:this.params.map(function(s,l){return{name:s,type:o[l]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}toHTML(o){for(var s=o&&o.parenthesis?o.parenthesis:"keep",l=[],u=0;u<this.params.length;u++)l.push('<span class="math-symbol math-parameter">'+Ci(this.params[u])+"</span>");var c=this.expr.toHTML(o);return n(this,s,o&&o.implicit)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Ci(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+l.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+c}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toTex(o);return n(this,s,o&&o.implicit)&&(l="\\left(".concat(l,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(rI).join(",")+"\\right):="+l}}return pn(i,"name",Nv),i},{isClass:!0,isNode:!0}),_v="IndexNode",Noe=["Node","size"],Mv=Q(_v,Noe,e=>{var{Node:t,size:r}=e;class n extends t{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(sr))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return _v}get isIndexNode(){return!0}_compile(a,o){var s=Ya(this.dimensions,function(u,c){var d=u.filter(m=>m.isSymbolNode&&m.name==="end").length>0;if(d){var f=Object.create(o);f.end=!0;var p=u._compile(a,f);return function(v,y,b){if(!ft(b)&&!or(b)&&!bn(b))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Or(b));var D=r(b).valueOf(),x=Object.create(y);return x.end=D[c],p(v,x,b)}}else return u._compile(a,o)}),l=Si(a,"index");return function(c,d,f){var p=Ya(s,function(m){return m(c,d,f)});return l(...p)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this._ifNode(a(this.dimensions[s],"dimensions["+s+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&Kt(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(a){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:_v,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}toHTML(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this.dimensions[s].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Ci(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(s){return s.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return pn(n,"name",_v),n},{isClass:!0,isNode:!0}),Tv="ObjectNode",Aoe=["Node"],Ov=Q(Tv,Aoe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return sr(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Tv}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(et(this.properties,s)){var l=bf(s),u=JSON.parse(l);if(!Zx(this.properties,u))throw new Error('No access to property "'+u+'"');o[u]=this.properties[s]._compile(i,a)}return function(d,f,p){var m={};for(var v in o)et(o,v)&&(m[v]=o[v](d,f,p));return m}}forEach(i){for(var a in this.properties)et(this.properties,a)&&i(this.properties[a],"properties["+bf(a)+"]",this)}map(i){var a={};for(var o in this.properties)et(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+bf(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)et(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)et(this.properties,o)&&a.push(bf(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Tv,properties:this.properties}}static fromJSON(i){return new r(i.properties)}toHTML(i){var a=[];for(var o in this.properties)et(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Ci(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)et(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var s="\\left\\{\\begin{array}{ll}"+a.join(`
113
- `)+"\\end{array}\\right\\}";return s}}return pn(r,"name",Tv),r},{isClass:!0,isNode:!0}),Rv="OperatorNode",_oe=["Node"],Iv=Q(Rv,_oe,e=>{var{Node:t}=e;function r(a,o){var s=a;if(o==="auto")for(;zi(s);)s=s.content;return Kt(s)?!0:Wr(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=mr(a,o,s),d=dc(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(N){switch(N.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var f;switch(l.length){case 0:f=[];break;case 1:{var p=mr(l[0],o,s,a);if(u&&p!==null){var m,v;if(o==="keep"?(m=l[0].getIdentifier(),v=a.getIdentifier()):(m=l[0].getContent().getIdentifier(),v=a.getContent().getIdentifier()),Hi[c][v].latexLeftParens===!1){f=[!1];break}if(Hi[p][m].latexParens===!1){f=[!1];break}}if(p===null){f=[!1];break}if(p<=c){f=[!0];break}f=[!1]}break;case 2:{var y,b=mr(l[0],o,s,a),D=Cw(a,l[0],o);b===null?y=!1:b===c&&d==="right"&&!D||b<c?y=!0:y=!1;var x,S=mr(l[1],o,s,a),w=Cw(a,l[1],o);if(S===null?x=!1:S===c&&d==="left"&&!w||S<c?x=!0:x=!1,u){var C,E,A;o==="keep"?(C=a.getIdentifier(),E=a.args[0].getIdentifier(),A=a.args[1].getIdentifier()):(C=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),A=a.args[1].getContent().getIdentifier()),b!==null&&(Hi[c][C].latexLeftParens===!1&&(y=!1),Hi[b][E].latexParens===!1&&(y=!1)),S!==null&&(Hi[c][C].latexRightParens===!1&&(x=!1),Hi[S][A].latexParens===!1&&(x=!1))}f=[y,x]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(f=l.map(function(N){var M=mr(N,o,s,a),R=Cw(a,N,o),F=dc(N,o);return M===null?!1:c===M&&d===F&&!R?!0:M<c}));break}if(l.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var _=1;_<f.length;++_)r(l[_],o)&&!f[_-1]&&(o!=="keep"||!zi(l[_-1]))&&(f[_]=!0);return f}class i extends t{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(sr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return Rv}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!Qx(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var l=Si(o,this.fn),u=Ya(this.args,function(p){return p._compile(o,s)});if(u.length===1){var c=u[0];return function(m,v,y){return l(c(m,v,y))}}else if(u.length===2){var d=u[0],f=u[1];return function(m,v,y){return l(d(m,v,y),f(m,v,y))}}else return function(m,v,y){return l.apply(null,Ya(u,function(b){return b(m,v,y)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var d=dc(this,s),f=u[0].toString(o);c[0]&&(f="("+f+")");var p=/[a-zA-Z]+/.test(this.op);return d==="right"?this.op+(p?" ":"")+f:d==="left"?f+(p?" ":"")+this.op:f+this.op}else if(u.length===2){var m=u[0].toString(o),v=u[1].toString(o);return c[0]&&(m="("+m+")"),c[1]&&(v="("+v+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?m+" "+v:m+" "+this.op+" "+v}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var y=u.map(function(b,D){return b=b.toString(o),c[D]&&(b="("+b+")"),b});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?y.join(" "):y.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Rv,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}toHTML(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var d=dc(this,s),f=u[0].toHTML(o);return c[0]&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),d==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Ci(this.op)+"</span>"+f:f+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Ci(this.op)+"</span>"}else if(u.length===2){var p=u[0].toHTML(o),m=u[1].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?p+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+m:p+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ci(this.op)+"</span>"+m}else{var v=u.map(function(y,b){return y=y.toHTML(o),c[b]&&(y='<span class="math-parenthesis math-round-parenthesis">(</span>'+y+'<span class="math-parenthesis math-round-parenthesis">)</span>'),y});return u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?v.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):v.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ci(this.op)+"</span>"):'<span class="math-function">'+Ci(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+v.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!0),d=Jt[this.fn];if(d=typeof d>"u"?this.op:d,u.length===1){var f=dc(this,s),p=u[0].toTex(o);return c[0]&&(p="\\left(".concat(p,"\\right)")),f==="right"?d+p:p+d}else if(u.length===2){var m=u[0],v=m.toTex(o);c[0]&&(v="\\left(".concat(v,"\\right)"));var y=u[1],b=y.toTex(o);c[1]&&(b="\\left(".concat(b,"\\right)"));var D;switch(s==="keep"?D=m.getIdentifier():D=m.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return d+"{"+v+"}{"+b+"}";case"OperatorNode:pow":switch(v="{"+v+"}",b="{"+b+"}",D){case"ConditionalNode":case"OperatorNode:divide":v="\\left(".concat(v,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&l==="hide")return v+"~"+b}return v+d+b}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var x=u.map(function(S,w){return S=S.toTex(o),c[w]&&(S="\\left(".concat(S,"\\right)")),S});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&l==="hide"?x.join("~"):x.join(d)}else return"\\mathrm{"+this.fn+"}\\left("+u.map(function(S){return S.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return pn(i,"name",Rv),i},{isClass:!0,isNode:!0}),kv="ParenthesisNode",Moe=["Node"],Pv=Q(kv,Moe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),!sr(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return kv}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new r(a)}clone(){return new r(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:kv,content:this.content}}static fromJSON(i){return new r(i.content)}toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return pn(r,"name",kv),r},{isClass:!0,isNode:!0}),Fv="RangeNode",Toe=["Node"],$v=Q(Fv,Toe,e=>{var{Node:t}=e;function r(i,a,o){var s=mr(i,a,o),l={},u=mr(i.start,a,o);if(l.start=u!==null&&u<=s||a==="all",i.step){var c=mr(i.step,a,o);l.step=c!==null&&c<=s||a==="all"}var d=mr(i.end,a,o);return l.end=d!==null&&d<=s||a==="all",l}class n extends t{constructor(a,o,s){if(super(),!sr(a))throw new TypeError("Node expected");if(!sr(o))throw new TypeError("Node expected");if(s&&!sr(s))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=s||null}get type(){return Fv}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return en(o)&&o.name==="end"});return a.length>0}_compile(a,o){var s=a.range,l=this.start._compile(a,o),u=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(f,p,m){return s(l(f,p,m),u(f,p,m),c(f,p,m))}}else return function(f,p,m){return s(l(f,p,m),u(f,p,m))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new n(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toString(a);if(s.start&&(u="("+u+")"),l=u,this.step){var c=this.step.toString(a);s.step&&(c="("+c+")"),l+=":"+c}var d=this.end.toString(a);return s.end&&(d="("+d+")"),l+=":"+d,l}toJSON(){return{mathjs:Fv,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new n(a.start,a.end,a.step)}toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toHTML(a);if(s.start&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l=u,this.step){var c=this.step.toHTML(a);s.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+c}var d=this.end.toHTML(a);return s.end&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+d,l}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l=this.start.toTex(a);if(s.start&&(l="\\left(".concat(l,"\\right)")),this.step){var u=this.step.toTex(a);s.step&&(u="\\left(".concat(u,"\\right)")),l+=":"+u}var c=this.end.toTex(a);return s.end&&(c="\\left(".concat(c,"\\right)")),l+=":"+c,l}}return pn(n,"name",Fv),n},{isClass:!0,isNode:!0}),Bv="RelationalNode",Ooe=["Node"],zv=Q(Bv,Ooe,e=>{var{Node:t}=e,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends t{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return Bv}get isRelationalNode(){return!0}_compile(a,o){var s=this,l=this.params.map(u=>u._compile(a,o));return function(c,d,f){for(var p,m=l[0](c,d,f),v=0;v<s.conditionals.length;v++){p=m,m=l[v+1](c,d,f);var y=Si(a,s.conditionals[v]);if(!y(p,m))return!1}return!0}}forEach(a){this.params.forEach((o,s)=>a(o,"params["+s+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,s)=>this._ifNode(a(o,"params["+s+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.params.map(function(d,f){var p=mr(d,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"("+d.toString(a)+")":d.toString(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=" "+r[this.conditionals[c]],u+=" "+l[c+1];return u}toJSON(){return{mathjs:Bv,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new n(a.conditionals,a.params)}toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.params.map(function(d,f){var p=mr(d,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?'<span class="math-parenthesis math-round-parenthesis">(</span>'+d.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':d.toHTML(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ci(r[this.conditionals[c]])+"</span>"+l[c+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.params.map(function(d,f){var p=mr(d,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"\\left("+d.toTex(a)+"\right)":d.toTex(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=Jt[this.conditionals[c]]+l[c+1];return u}}return pn(n,"name",Bv),n},{isClass:!0,isNode:!0}),Roe="SymbolNode",Ioe=["math","?Unit","Node"],Lv=Q(Roe,Ioe,e=>{var{math:t,Unit:r,Node:n}=e;function i(o){return r?r.isValuelessUnit(o):!1}class a extends n{constructor(s){if(super(),typeof s!="string")throw new TypeError('String expected for parameter "name"');this.name=s}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(s,l){var u=this.name;if(l[u]===!0)return function(d,f,p){return f[u]};if(u in s)return function(d,f,p){return d.has(u)?d.get(u):Si(s,u)};var c=i(u);return function(d,f,p){return d.has(u)?d.get(u):c?new r(null,u):a.onUndefinedSymbol(u)}}forEach(s){}map(s){return this.clone()}static onUndefinedSymbol(s){throw new Error("Undefined symbol "+s)}clone(){return new a(this.name)}_toString(s){return this.name}toHTML(s){var l=Ci(this.name);return l==="true"||l==="false"?'<span class="math-symbol math-boolean">'+l+"</span>":l==="i"?'<span class="math-symbol math-imaginary-symbol">'+l+"</span>":l==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+l+"</span>":l==="NaN"?'<span class="math-symbol math-nan-symbol">'+l+"</span>":l==="null"?'<span class="math-symbol math-null-symbol">'+l+"</span>":l==="undefined"?'<span class="math-symbol math-undefined-symbol">'+l+"</span>":'<span class="math-symbol">'+l+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(s){return new a(s.name)}_toTex(s){var l=!1;typeof t[this.name]>"u"&&i(this.name)&&(l=!0);var u=rI(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});function fc(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return typeof e.createSubScope=="function"?zM(e.createSubScope(),...r):zM(Sl(),e,...r)}var Vv="FunctionNode",koe=["math","Node","SymbolNode"],qv=Q(Vv,koe,e=>{var{math:t,Node:r,SymbolNode:n}=e,i=s=>Pt(s,{truncate:78});function a(s,l,u){for(var c="",d=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,f=0,p;(p=d.exec(s))!==null;)if(c+=s.substring(f,p.index),f=p.index,p[0]==="$$")c+="$",f++;else{f+=p[0].length;var m=l[p[1]];if(!m)throw new ReferenceError("Template: Property "+p[1]+" does not exist.");if(p[2]===void 0)switch(typeof m){case"string":c+=m;break;case"object":if(sr(m))c+=m.toTex(u);else if(Array.isArray(m))c+=m.map(function(v,y){if(sr(v))return v.toTex(u);throw new TypeError("Template: "+p[1]+"["+y+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+p[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+p[1]+" has to be a Node, String or array of Nodes")}else if(sr(m[p[2]]&&m[p[2]]))c+=m[p[2]].toTex(u);else throw new TypeError("Template: "+p[1]+"["+p[2]+"] is not a Node.")}return c+=s.slice(f),c}class o extends r{constructor(l,u){if(super(),typeof l=="string"&&(l=new n(l)),!sr(l))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(u)||!u.every(sr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=l,this.args=u||[]}get name(){return this.fn.name||""}get type(){return Vv}get isFunctionNode(){return!0}_compile(l,u){var c=this.args.map(E=>E._compile(l,u));if(en(this.fn)){var d=this.fn.name;if(u[d]){var y=this.args;return function(A,_,N){var M=_[d];if(typeof M!="function")throw new TypeError("Argument '".concat(d,"' was not a function; received: ").concat(i(M)));if(M.rawArgs)return M(y,l,fc(A,_),A);var R=c.map(F=>F(A,_,N));return M.apply(M,R)}}else{var f=d in l?Si(l,d):void 0,p=typeof f=="function"&&f.rawArgs===!0,m=E=>{var A;if(E.has(d))A=E.get(d);else if(d in l)A=Si(l,d);else return o.onUndefinedFunction(d);if(typeof A=="function")return A;throw new TypeError("'".concat(d,`' is not a function; its value is:
112
+ `)}}return pn(n,"name",xv),n},{isClass:!0,isNode:!0}),Cv="ConditionalNode",goe=["Node"],Sv=Q(Cv,goe,e=>{var{Node:t}=e;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(kt(i))return!i.isZero();if(yi(i))return!!(i.re||i.im);if(bi(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+Or(i)+'"')}class n extends t{constructor(a,o,s){if(super(),!sr(a))throw new TypeError("Parameter condition must be a Node");if(!sr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!sr(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return Cv}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(d,f,p){return r(s(d,f,p))?l(d,f,p):u(d,f,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.condition.toString(a),u=mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),d=mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||d!==null&&d<=s)&&(c="("+c+")");var f=this.falseExpr.toString(a),p=mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(f="("+f+")"),l+" ? "+c+" : "+f}toJSON(){return{mathjs:Cv,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),d=mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||d!==null&&d<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var f=this.falseExpr.toHTML(a),p=mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+f}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return pn(n,"name",Cv),n},{isClass:!0,isNode:!0}),Sw=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yoe={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},boe={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},xoe=function(t,r){return Sw({},t,r)},woe=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.preserveFormatting,n=r===void 0?!1:r,i=t.escapeMapFn,a=i===void 0?xoe:i,o=String(e),s="",l=a(Sw({},yoe),n?Sw({},boe):{}),u=Object.keys(l),c=function(){var f=!1;u.forEach(function(p,m){f||o.length>=p.length&&o.slice(0,p.length)===p&&(s+=l[u[m]],o=o.slice(p.length,o.length),f=!0)}),f||(s+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return s};const Coe=woe;var Dw={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{?}"},Jt={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"},e3={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Jt.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Jt.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Jt.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Jt.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Jt.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Jt.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Jt.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Jt.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Jt.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Jt.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Jt.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Jt.bitAnd,"${args[1]}\\right)")},bitNot:{1:Jt.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Jt.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Jt.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Jt.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Jt.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Jt.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Jt.and,"${args[1]}\\right)")},not:{1:Jt.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Jt.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Jt.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Jt.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Jt.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Jt.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Jt.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Jt.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Jt.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Jt.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Jt.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Jt.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Jt.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Jt.to,"${args[1]}\\right)")},numeric:function(t,r){return t.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(Dw.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)"}},Soe="\\mathrm{${name}}\\left(${args}\\right)",t3={deg:"^\\circ"};function Ew(e){return Coe(e,{preserveFormatting:!0})}function r3(e,t){return t=typeof t>"u"?!1:t,t?et(t3,e)?t3[e]:"\\mathrm{"+Ew(e)+"}":et(Dw,e)?Dw[e]:Ew(e)}var Dv="ConstantNode",Doe=["Node"],Ev=Q(Dv,Doe,e=>{var{Node:t}=e;class r extends t{constructor(i){super(),this.value=i}get type(){return Dv}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new r(this.value)}_toString(i){return Pt(this.value,i)}toHTML(i){var a=this._toString(i);switch(Or(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:Dv,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i);switch(Or(this.value)){case"string":return"\\mathtt{"+Ew(a)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var o=a.toLowerCase().indexOf("e");if(o!==-1)return a.substring(0,o)+"\\cdot10^{"+a.substring(o+1)+"}"}return a;case"Fraction":return this.value.toLatex();default:return a}}}return pn(r,"name",Dv),r},{isClass:!0,isNode:!0}),Nv="FunctionAssignmentNode",Eoe=["typed","Node"],Av=Q(Nv,Eoe,e=>{var{typed:t,Node:r}=e;function n(a,o,s){var l=mr(a,o,s),u=mr(a.expr,o,s);return o==="all"||u!==null&&u<=l}class i extends r{constructor(o,s,l){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(s))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!sr(l))throw new TypeError('Node expected for parameter "expr"');if(QI.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var u=new Set;for(var c of s){var d=typeof c=="string"?c:c.name;if(u.has(d))throw new Error('Duplicate parameter name "'.concat(d,'"'));u.add(d)}this.name=o,this.params=s.map(function(f){return f&&f.name||f}),this.types=s.map(function(f){return f&&f.type||"any"}),this.expr=l}get type(){return Nv}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);wf(this.params,function(m){l[m]=!0});var u=this.expr._compile(o,l),c=this.name,d=this.params,f=PM(this.types,","),p=c+"("+PM(this.params,", ")+")";return function(v,y,b){var D={};D[f]=function(){for(var S=Object.create(y),w=0;w<d.length;w++)S[d[w]]=arguments[w];return u(v,S,b)};var x=t(c,D);return x.syntax=p,v.set(c,x),x}}forEach(o){o(this.expr,"expr",this)}map(o){var s=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),s)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toString(o);return n(this,s,o&&o.implicit)&&(l="("+l+")"),this.name+"("+this.params.join(", ")+") = "+l}toJSON(){var o=this.types;return{mathjs:Nv,name:this.name,params:this.params.map(function(s,l){return{name:s,type:o[l]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}toHTML(o){for(var s=o&&o.parenthesis?o.parenthesis:"keep",l=[],u=0;u<this.params.length;u++)l.push('<span class="math-symbol math-parameter">'+Ci(this.params[u])+"</span>");var c=this.expr.toHTML(o);return n(this,s,o&&o.implicit)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Ci(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+l.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+c}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toTex(o);return n(this,s,o&&o.implicit)&&(l="\\left(".concat(l,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(r3).join(",")+"\\right):="+l}}return pn(i,"name",Nv),i},{isClass:!0,isNode:!0}),_v="IndexNode",Noe=["Node","size"],Mv=Q(_v,Noe,e=>{var{Node:t,size:r}=e;class n extends t{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(sr))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return _v}get isIndexNode(){return!0}_compile(a,o){var s=Ya(this.dimensions,function(u,c){var d=u.filter(m=>m.isSymbolNode&&m.name==="end").length>0;if(d){var f=Object.create(o);f.end=!0;var p=u._compile(a,f);return function(v,y,b){if(!ft(b)&&!or(b)&&!bn(b))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Or(b));var D=r(b).valueOf(),x=Object.create(y);return x.end=D[c],p(v,x,b)}}else return u._compile(a,o)}),l=Si(a,"index");return function(c,d,f){var p=Ya(s,function(m){return m(c,d,f)});return l(...p)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this._ifNode(a(this.dimensions[s],"dimensions["+s+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&Kt(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(a){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:_v,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}toHTML(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this.dimensions[s].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Ci(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(s){return s.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return pn(n,"name",_v),n},{isClass:!0,isNode:!0}),Tv="ObjectNode",Aoe=["Node"],Ov=Q(Tv,Aoe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return sr(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Tv}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(et(this.properties,s)){var l=bf(s),u=JSON.parse(l);if(!Zx(this.properties,u))throw new Error('No access to property "'+u+'"');o[u]=this.properties[s]._compile(i,a)}return function(d,f,p){var m={};for(var v in o)et(o,v)&&(m[v]=o[v](d,f,p));return m}}forEach(i){for(var a in this.properties)et(this.properties,a)&&i(this.properties[a],"properties["+bf(a)+"]",this)}map(i){var a={};for(var o in this.properties)et(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+bf(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)et(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)et(this.properties,o)&&a.push(bf(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Tv,properties:this.properties}}static fromJSON(i){return new r(i.properties)}toHTML(i){var a=[];for(var o in this.properties)et(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Ci(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)et(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var s="\\left\\{\\begin{array}{ll}"+a.join(`
113
+ `)+"\\end{array}\\right\\}";return s}}return pn(r,"name",Tv),r},{isClass:!0,isNode:!0}),Rv="OperatorNode",_oe=["Node"],Iv=Q(Rv,_oe,e=>{var{Node:t}=e;function r(a,o){var s=a;if(o==="auto")for(;zi(s);)s=s.content;return Kt(s)?!0:Wr(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=mr(a,o,s),d=dc(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(N){switch(N.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var f;switch(l.length){case 0:f=[];break;case 1:{var p=mr(l[0],o,s,a);if(u&&p!==null){var m,v;if(o==="keep"?(m=l[0].getIdentifier(),v=a.getIdentifier()):(m=l[0].getContent().getIdentifier(),v=a.getContent().getIdentifier()),Hi[c][v].latexLeftParens===!1){f=[!1];break}if(Hi[p][m].latexParens===!1){f=[!1];break}}if(p===null){f=[!1];break}if(p<=c){f=[!0];break}f=[!1]}break;case 2:{var y,b=mr(l[0],o,s,a),D=Cw(a,l[0],o);b===null?y=!1:b===c&&d==="right"&&!D||b<c?y=!0:y=!1;var x,S=mr(l[1],o,s,a),w=Cw(a,l[1],o);if(S===null?x=!1:S===c&&d==="left"&&!w||S<c?x=!0:x=!1,u){var C,E,A;o==="keep"?(C=a.getIdentifier(),E=a.args[0].getIdentifier(),A=a.args[1].getIdentifier()):(C=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),A=a.args[1].getContent().getIdentifier()),b!==null&&(Hi[c][C].latexLeftParens===!1&&(y=!1),Hi[b][E].latexParens===!1&&(y=!1)),S!==null&&(Hi[c][C].latexRightParens===!1&&(x=!1),Hi[S][A].latexParens===!1&&(x=!1))}f=[y,x]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(f=l.map(function(N){var M=mr(N,o,s,a),R=Cw(a,N,o),F=dc(N,o);return M===null?!1:c===M&&d===F&&!R?!0:M<c}));break}if(l.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var _=1;_<f.length;++_)r(l[_],o)&&!f[_-1]&&(o!=="keep"||!zi(l[_-1]))&&(f[_]=!0);return f}class i extends t{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(sr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return Rv}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!Qx(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var l=Si(o,this.fn),u=Ya(this.args,function(p){return p._compile(o,s)});if(u.length===1){var c=u[0];return function(m,v,y){return l(c(m,v,y))}}else if(u.length===2){var d=u[0],f=u[1];return function(m,v,y){return l(d(m,v,y),f(m,v,y))}}else return function(m,v,y){return l.apply(null,Ya(u,function(b){return b(m,v,y)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var d=dc(this,s),f=u[0].toString(o);c[0]&&(f="("+f+")");var p=/[a-zA-Z]+/.test(this.op);return d==="right"?this.op+(p?" ":"")+f:d==="left"?f+(p?" ":"")+this.op:f+this.op}else if(u.length===2){var m=u[0].toString(o),v=u[1].toString(o);return c[0]&&(m="("+m+")"),c[1]&&(v="("+v+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?m+" "+v:m+" "+this.op+" "+v}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var y=u.map(function(b,D){return b=b.toString(o),c[D]&&(b="("+b+")"),b});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?y.join(" "):y.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Rv,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}toHTML(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var d=dc(this,s),f=u[0].toHTML(o);return c[0]&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),d==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Ci(this.op)+"</span>"+f:f+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Ci(this.op)+"</span>"}else if(u.length===2){var p=u[0].toHTML(o),m=u[1].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?p+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+m:p+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ci(this.op)+"</span>"+m}else{var v=u.map(function(y,b){return y=y.toHTML(o),c[b]&&(y='<span class="math-parenthesis math-round-parenthesis">(</span>'+y+'<span class="math-parenthesis math-round-parenthesis">)</span>'),y});return u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?v.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):v.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ci(this.op)+"</span>"):'<span class="math-function">'+Ci(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+v.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!0),d=Jt[this.fn];if(d=typeof d>"u"?this.op:d,u.length===1){var f=dc(this,s),p=u[0].toTex(o);return c[0]&&(p="\\left(".concat(p,"\\right)")),f==="right"?d+p:p+d}else if(u.length===2){var m=u[0],v=m.toTex(o);c[0]&&(v="\\left(".concat(v,"\\right)"));var y=u[1],b=y.toTex(o);c[1]&&(b="\\left(".concat(b,"\\right)"));var D;switch(s==="keep"?D=m.getIdentifier():D=m.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return d+"{"+v+"}{"+b+"}";case"OperatorNode:pow":switch(v="{"+v+"}",b="{"+b+"}",D){case"ConditionalNode":case"OperatorNode:divide":v="\\left(".concat(v,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&l==="hide")return v+"~"+b}return v+d+b}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var x=u.map(function(S,w){return S=S.toTex(o),c[w]&&(S="\\left(".concat(S,"\\right)")),S});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&l==="hide"?x.join("~"):x.join(d)}else return"\\mathrm{"+this.fn+"}\\left("+u.map(function(S){return S.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return pn(i,"name",Rv),i},{isClass:!0,isNode:!0}),kv="ParenthesisNode",Moe=["Node"],Pv=Q(kv,Moe,e=>{var{Node:t}=e;class r extends t{constructor(i){if(super(),!sr(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return kv}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new r(a)}clone(){return new r(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:kv,content:this.content}}static fromJSON(i){return new r(i.content)}toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return pn(r,"name",kv),r},{isClass:!0,isNode:!0}),Fv="RangeNode",Toe=["Node"],$v=Q(Fv,Toe,e=>{var{Node:t}=e;function r(i,a,o){var s=mr(i,a,o),l={},u=mr(i.start,a,o);if(l.start=u!==null&&u<=s||a==="all",i.step){var c=mr(i.step,a,o);l.step=c!==null&&c<=s||a==="all"}var d=mr(i.end,a,o);return l.end=d!==null&&d<=s||a==="all",l}class n extends t{constructor(a,o,s){if(super(),!sr(a))throw new TypeError("Node expected");if(!sr(o))throw new TypeError("Node expected");if(s&&!sr(s))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=s||null}get type(){return Fv}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return en(o)&&o.name==="end"});return a.length>0}_compile(a,o){var s=a.range,l=this.start._compile(a,o),u=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(f,p,m){return s(l(f,p,m),u(f,p,m),c(f,p,m))}}else return function(f,p,m){return s(l(f,p,m),u(f,p,m))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new n(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toString(a);if(s.start&&(u="("+u+")"),l=u,this.step){var c=this.step.toString(a);s.step&&(c="("+c+")"),l+=":"+c}var d=this.end.toString(a);return s.end&&(d="("+d+")"),l+=":"+d,l}toJSON(){return{mathjs:Fv,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new n(a.start,a.end,a.step)}toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toHTML(a);if(s.start&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l=u,this.step){var c=this.step.toHTML(a);s.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+c}var d=this.end.toHTML(a);return s.end&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+d,l}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l=this.start.toTex(a);if(s.start&&(l="\\left(".concat(l,"\\right)")),this.step){var u=this.step.toTex(a);s.step&&(u="\\left(".concat(u,"\\right)")),l+=":"+u}var c=this.end.toTex(a);return s.end&&(c="\\left(".concat(c,"\\right)")),l+=":"+c,l}}return pn(n,"name",Fv),n},{isClass:!0,isNode:!0}),Bv="RelationalNode",Ooe=["Node"],zv=Q(Bv,Ooe,e=>{var{Node:t}=e,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends t{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return Bv}get isRelationalNode(){return!0}_compile(a,o){var s=this,l=this.params.map(u=>u._compile(a,o));return function(c,d,f){for(var p,m=l[0](c,d,f),v=0;v<s.conditionals.length;v++){p=m,m=l[v+1](c,d,f);var y=Si(a,s.conditionals[v]);if(!y(p,m))return!1}return!0}}forEach(a){this.params.forEach((o,s)=>a(o,"params["+s+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,s)=>this._ifNode(a(o,"params["+s+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.params.map(function(d,f){var p=mr(d,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"("+d.toString(a)+")":d.toString(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=" "+r[this.conditionals[c]],u+=" "+l[c+1];return u}toJSON(){return{mathjs:Bv,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new n(a.conditionals,a.params)}toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.params.map(function(d,f){var p=mr(d,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?'<span class="math-parenthesis math-round-parenthesis">(</span>'+d.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':d.toHTML(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ci(r[this.conditionals[c]])+"</span>"+l[c+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=mr(this,o,a&&a.implicit),l=this.params.map(function(d,f){var p=mr(d,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"\\left("+d.toTex(a)+"\right)":d.toTex(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=Jt[this.conditionals[c]]+l[c+1];return u}}return pn(n,"name",Bv),n},{isClass:!0,isNode:!0}),Roe="SymbolNode",Ioe=["math","?Unit","Node"],Lv=Q(Roe,Ioe,e=>{var{math:t,Unit:r,Node:n}=e;function i(o){return r?r.isValuelessUnit(o):!1}class a extends n{constructor(s){if(super(),typeof s!="string")throw new TypeError('String expected for parameter "name"');this.name=s}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(s,l){var u=this.name;if(l[u]===!0)return function(d,f,p){return f[u]};if(u in s)return function(d,f,p){return d.has(u)?d.get(u):Si(s,u)};var c=i(u);return function(d,f,p){return d.has(u)?d.get(u):c?new r(null,u):a.onUndefinedSymbol(u)}}forEach(s){}map(s){return this.clone()}static onUndefinedSymbol(s){throw new Error("Undefined symbol "+s)}clone(){return new a(this.name)}_toString(s){return this.name}toHTML(s){var l=Ci(this.name);return l==="true"||l==="false"?'<span class="math-symbol math-boolean">'+l+"</span>":l==="i"?'<span class="math-symbol math-imaginary-symbol">'+l+"</span>":l==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+l+"</span>":l==="NaN"?'<span class="math-symbol math-nan-symbol">'+l+"</span>":l==="null"?'<span class="math-symbol math-null-symbol">'+l+"</span>":l==="undefined"?'<span class="math-symbol math-undefined-symbol">'+l+"</span>":'<span class="math-symbol">'+l+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(s){return new a(s.name)}_toTex(s){var l=!1;typeof t[this.name]>"u"&&i(this.name)&&(l=!0);var u=r3(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});function fc(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return typeof e.createSubScope=="function"?zM(e.createSubScope(),...r):zM(Sl(),e,...r)}var Vv="FunctionNode",koe=["math","Node","SymbolNode"],qv=Q(Vv,koe,e=>{var{math:t,Node:r,SymbolNode:n}=e,i=s=>Pt(s,{truncate:78});function a(s,l,u){for(var c="",d=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,f=0,p;(p=d.exec(s))!==null;)if(c+=s.substring(f,p.index),f=p.index,p[0]==="$$")c+="$",f++;else{f+=p[0].length;var m=l[p[1]];if(!m)throw new ReferenceError("Template: Property "+p[1]+" does not exist.");if(p[2]===void 0)switch(typeof m){case"string":c+=m;break;case"object":if(sr(m))c+=m.toTex(u);else if(Array.isArray(m))c+=m.map(function(v,y){if(sr(v))return v.toTex(u);throw new TypeError("Template: "+p[1]+"["+y+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+p[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+p[1]+" has to be a Node, String or array of Nodes")}else if(sr(m[p[2]]&&m[p[2]]))c+=m[p[2]].toTex(u);else throw new TypeError("Template: "+p[1]+"["+p[2]+"] is not a Node.")}return c+=s.slice(f),c}class o extends r{constructor(l,u){if(super(),typeof l=="string"&&(l=new n(l)),!sr(l))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(u)||!u.every(sr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=l,this.args=u||[]}get name(){return this.fn.name||""}get type(){return Vv}get isFunctionNode(){return!0}_compile(l,u){var c=this.args.map(E=>E._compile(l,u));if(en(this.fn)){var d=this.fn.name;if(u[d]){var y=this.args;return function(A,_,N){var M=_[d];if(typeof M!="function")throw new TypeError("Argument '".concat(d,"' was not a function; received: ").concat(i(M)));if(M.rawArgs)return M(y,l,fc(A,_),A);var R=c.map(F=>F(A,_,N));return M.apply(M,R)}}else{var f=d in l?Si(l,d):void 0,p=typeof f=="function"&&f.rawArgs===!0,m=E=>{var A;if(E.has(d))A=E.get(d);else if(d in l)A=Si(l,d);else return o.onUndefinedFunction(d);if(typeof A=="function")return A;throw new TypeError("'".concat(d,`' is not a function; its value is:
114
114
  `).concat(i(A)))};if(p){var v=this.args;return function(A,_,N){var M=m(A);return M(v,l,fc(A,_),A)}}else switch(c.length){case 0:return function(A,_,N){var M=m(A);return M()};case 1:return function(A,_,N){var M=m(A),R=c[0];return M(R(A,_,N))};case 2:return function(A,_,N){var M=m(A),R=c[0],F=c[1];return M(R(A,_,N),F(A,_,N))};default:return function(A,_,N){var M=m(A),R=c.map(F=>F(A,_,N));return M(...R)}}}}else if(Ka(this.fn)&&To(this.fn.index)&&this.fn.index.isObjectProperty()){var b=this.fn.object._compile(l,u),D=this.fn.index.getObjectProperty(),x=this.args;return function(A,_,N){var M=b(A,_,N);qJ(M,D);var R=M[D]&&M[D].rawArgs;if(R)return M[D](x,l,fc(A,_),A);var F=c.map(k=>k(A,_,N));return M[D].apply(M,F)}}else{var S=this.fn.toString(),w=this.fn._compile(l,u),C=this.args;return function(A,_,N){var M=w(A,_,N);if(typeof M!="function")throw new TypeError("Expression '".concat(S,"' did not evaluate to a function; value is:")+`
115
- `.concat(i(M)));if(M.rawArgs)return M(C,l,fc(A,_),A);var R=c.map(F=>F(A,_,N));return M.apply(M,R)}}}forEach(l){l(this.fn,"fn",this);for(var u=0;u<this.args.length;u++)l(this.args[u],"args["+u+"]",this)}map(l){for(var u=this._ifNode(l(this.fn,"fn",this)),c=[],d=0;d<this.args.length;d++)c[d]=this._ifNode(l(this.args[d],"args["+d+"]",this));return new o(u,c)}clone(){return new o(this.fn,this.args.slice(0))}toString(l){var u,c=this.fn.toString(l);return l&&typeof l.handler=="object"&&et(l.handler,c)&&(u=l.handler[c](this,l)),typeof u<"u"?u:super.toString(l)}_toString(l){var u=this.args.map(function(d){return d.toString(l)}),c=hs(this.fn)?"("+this.fn.toString(l)+")":this.fn.toString(l);return c+"("+u.join(", ")+")"}toJSON(){return{mathjs:Vv,fn:this.fn,args:this.args}}toHTML(l){var u=this.args.map(function(c){return c.toHTML(l)});return'<span class="math-function">'+Ci(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(l){var u;return l&&typeof l.handler=="object"&&et(l.handler,this.name)&&(u=l.handler[this.name](this,l)),typeof u<"u"?u:super.toTex(l)}_toTex(l){var u=this.args.map(function(f){return f.toTex(l)}),c;eI[this.name]&&(c=eI[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(c=t[this.name].toTex);var d;switch(typeof c){case"function":d=c(this,l);break;case"string":d=a(c,this,l);break;case"object":switch(typeof c[u.length]){case"function":d=c[u.length](this,l);break;case"string":d=a(c[u.length],this,l);break}}return typeof d<"u"?d:a(Soe,this,l)}getIdentifier(){return this.type+":"+this.name}}return pn(o,"name",Vv),pn(o,"onUndefinedFunction",function(s){throw new Error("Undefined function "+s)}),pn(o,"fromJSON",function(s){return new o(s.fn,s.args)}),o},{isClass:!0,isNode:!0}),nI="parse",Poe=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],Gv=Q(nI,Poe,e=>{var{typed:t,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:d,IndexNode:f,ObjectNode:p,OperatorNode:m,ParenthesisNode:v,RangeNode:y,RelationalNode:b,SymbolNode:D}=e,x=t(nI,{string:function(ie){return V(ie,{})},"Array | Matrix":function(ie){return S(ie,{})},"string, Object":function(ie,ye){var Oe=ye.nodes!==void 0?ye.nodes:{};return V(ie,Oe)},"Array | Matrix, Object":S});function S(B){var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye=ie.nodes!==void 0?ie.nodes:{};return zt(B,function(Oe){if(typeof Oe!="string")throw new TypeError("String expected");return V(Oe,ye)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},C={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"];function N(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null}}function M(B,ie){return B.expression.substr(B.index,ie)}function R(B){return M(B,1)}function F(B){B.index++}function k(B){return B.expression.charAt(B.index-1)}function P(B){return B.expression.charAt(B.index+1)}function T(B){for(B.tokenType=w.NULL,B.token="",B.comment="";;){if(R(B)==="#")for(;R(B)!==`
115
+ `.concat(i(M)));if(M.rawArgs)return M(C,l,fc(A,_),A);var R=c.map(F=>F(A,_,N));return M.apply(M,R)}}}forEach(l){l(this.fn,"fn",this);for(var u=0;u<this.args.length;u++)l(this.args[u],"args["+u+"]",this)}map(l){for(var u=this._ifNode(l(this.fn,"fn",this)),c=[],d=0;d<this.args.length;d++)c[d]=this._ifNode(l(this.args[d],"args["+d+"]",this));return new o(u,c)}clone(){return new o(this.fn,this.args.slice(0))}toString(l){var u,c=this.fn.toString(l);return l&&typeof l.handler=="object"&&et(l.handler,c)&&(u=l.handler[c](this,l)),typeof u<"u"?u:super.toString(l)}_toString(l){var u=this.args.map(function(d){return d.toString(l)}),c=hs(this.fn)?"("+this.fn.toString(l)+")":this.fn.toString(l);return c+"("+u.join(", ")+")"}toJSON(){return{mathjs:Vv,fn:this.fn,args:this.args}}toHTML(l){var u=this.args.map(function(c){return c.toHTML(l)});return'<span class="math-function">'+Ci(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(l){var u;return l&&typeof l.handler=="object"&&et(l.handler,this.name)&&(u=l.handler[this.name](this,l)),typeof u<"u"?u:super.toTex(l)}_toTex(l){var u=this.args.map(function(f){return f.toTex(l)}),c;e3[this.name]&&(c=e3[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(c=t[this.name].toTex);var d;switch(typeof c){case"function":d=c(this,l);break;case"string":d=a(c,this,l);break;case"object":switch(typeof c[u.length]){case"function":d=c[u.length](this,l);break;case"string":d=a(c[u.length],this,l);break}}return typeof d<"u"?d:a(Soe,this,l)}getIdentifier(){return this.type+":"+this.name}}return pn(o,"name",Vv),pn(o,"onUndefinedFunction",function(s){throw new Error("Undefined function "+s)}),pn(o,"fromJSON",function(s){return new o(s.fn,s.args)}),o},{isClass:!0,isNode:!0}),n3="parse",Poe=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],Gv=Q(n3,Poe,e=>{var{typed:t,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:d,IndexNode:f,ObjectNode:p,OperatorNode:m,ParenthesisNode:v,RangeNode:y,RelationalNode:b,SymbolNode:D}=e,x=t(n3,{string:function(ie){return V(ie,{})},"Array | Matrix":function(ie){return S(ie,{})},"string, Object":function(ie,ye){var Oe=ye.nodes!==void 0?ye.nodes:{};return V(ie,Oe)},"Array | Matrix, Object":S});function S(B){var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye=ie.nodes!==void 0?ie.nodes:{};return zt(B,function(Oe){if(typeof Oe!="string")throw new TypeError("String expected");return V(Oe,ye)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},C={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"];function N(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null}}function M(B,ie){return B.expression.substr(B.index,ie)}function R(B){return M(B,1)}function F(B){B.index++}function k(B){return B.expression.charAt(B.index-1)}function P(B){return B.expression.charAt(B.index+1)}function T(B){for(B.tokenType=w.NULL,B.token="",B.comment="";;){if(R(B)==="#")for(;R(B)!==`
116
116
  `&&R(B)!=="";)B.comment+=R(B),F(B);if(x.isWhitespace(R(B),B.nestingLevel))F(B);else break}if(R(B)===""){B.tokenType=w.DELIMITER;return}if(R(B)===`
117
117
  `&&!B.nestingLevel){B.tokenType=w.DELIMITER,B.token=R(B),F(B);return}var ie=R(B),ye=M(B,2),Oe=M(B,3);if(Oe.length===3&&C[Oe]){B.tokenType=w.DELIMITER,B.token=Oe,F(B),F(B),F(B);return}if(ye.length===2&&C[ye]){B.tokenType=w.DELIMITER,B.token=ye,F(B),F(B);return}if(C[ie]){B.tokenType=w.DELIMITER,B.token=ie,F(B);return}if(x.isDigitDot(ie)){B.tokenType=w.NUMBER;var Xe=M(B,2);if(Xe==="0b"||Xe==="0o"||Xe==="0x"){for(B.token+=R(B),F(B),B.token+=R(B),F(B);x.isHexDigit(R(B));)B.token+=R(B),F(B);if(R(B)===".")for(B.token+=".",F(B);x.isHexDigit(R(B));)B.token+=R(B),F(B);else if(R(B)==="i")for(B.token+="i",F(B);x.isDigit(R(B));)B.token+=R(B),F(B);return}if(R(B)==="."){if(B.token+=R(B),F(B),!x.isDigit(R(B))){B.tokenType=w.DELIMITER;return}}else{for(;x.isDigit(R(B));)B.token+=R(B),F(B);x.isDecimalMark(R(B),P(B))&&(B.token+=R(B),F(B))}for(;x.isDigit(R(B));)B.token+=R(B),F(B);if(R(B)==="E"||R(B)==="e"){if(x.isDigit(P(B))||P(B)==="-"||P(B)==="+"){if(B.token+=R(B),F(B),(R(B)==="+"||R(B)==="-")&&(B.token+=R(B),F(B)),!x.isDigit(R(B)))throw Ze(B,'Digit expected, got "'+R(B)+'"');for(;x.isDigit(R(B));)B.token+=R(B),F(B);if(x.isDecimalMark(R(B),P(B)))throw Ze(B,'Digit expected, got "'+R(B)+'"')}else if(P(B)===".")throw F(B),Ze(B,'Digit expected, got "'+R(B)+'"')}return}if(x.isAlpha(R(B),k(B),P(B))){for(;x.isAlpha(R(B),k(B),P(B))||x.isDigit(R(B));)B.token+=R(B),F(B);et(E,B.token)?B.tokenType=w.DELIMITER:B.tokenType=w.SYMBOL;return}for(B.tokenType=w.UNKNOWN;R(B)!=="";)B.token+=R(B),F(B);throw Ze(B,'Syntax error in part "'+B.token+'"')}function O(B){do T(B);while(B.token===`
118
118
  `)}function L(B){B.nestingLevel++}function I(B){B.nestingLevel--}x.isAlpha=function(ie,ye,Oe){return x.isValidLatinOrGreek(ie)||x.isValidMathSymbol(ie,Oe)||x.isValidMathSymbol(ye,ie)},x.isValidLatinOrGreek=function(ie){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(ie)},x.isValidMathSymbol=function(ie,ye){return/^[\uD835]$/.test(ie)&&/^[\uDC00-\uDFFF]$/.test(ye)&&/^[^\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(ye)},x.isWhitespace=function(ie,ye){return ie===" "||ie===" "||ie===`
119
119
  `&&ye>0},x.isDecimalMark=function(ie,ye){return ie==="."&&ye!=="/"&&ye!=="*"&&ye!=="^"},x.isDigitDot=function(ie){return ie>="0"&&ie<="9"||ie==="."},x.isDigit=function(ie){return ie>="0"&&ie<="9"},x.isHexDigit=function(ie){return ie>="0"&&ie<="9"||ie>="a"&&ie<="f"||ie>="A"&&ie<="F"};function V(B,ie){var ye=N();fn(ye,{expression:B,extraNodes:ie}),T(ye);var Oe=H(ye);if(ye.token!=="")throw ye.tokenType===w.DELIMITER?bt(ye,"Unexpected operator "+ye.token):Ze(ye,'Unexpected part "'+ye.token+'"');return Oe}function H(B){var ie,ye=[],Oe;for(B.token!==""&&B.token!==`
120
120
  `&&B.token!==";"&&(ie=Z(B),B.comment&&(ie.comment=B.comment));B.token===`
121
121
  `||B.token===";";)ye.length===0&&ie&&(Oe=B.token!==";",ye.push({node:ie,visible:Oe})),T(B),B.token!==`
122
- `&&B.token!==";"&&B.token!==""&&(ie=Z(B),B.comment&&(ie.comment=B.comment),Oe=B.token!==";",ye.push({node:ie,visible:Oe}));return ye.length>0?new s(ye):(ie||(ie=new u(void 0),B.comment&&(ie.comment=B.comment)),ie)}function Z(B){var ie,ye,Oe,Xe,rt=G(B);if(B.token==="="){if(en(rt))return ie=rt.name,O(B),Oe=Z(B),new o(new D(ie),Oe);if(Ka(rt))return O(B),Oe=Z(B),new o(rt.object,rt.index,Oe);if(ya(rt)&&en(rt.fn)&&(Xe=!0,ye=[],ie=rt.name,rt.args.forEach(function(wt,ur){en(wt)?ye[ur]=wt.name:Xe=!1}),Xe))return O(B),Oe=Z(B),new c(ie,ye,Oe);throw Ze(B,"Invalid left hand side of assignment operator =")}return rt}function G(B){for(var ie=Y(B);B.token==="?";){var ye=B.conditionalLevel;B.conditionalLevel=B.nestingLevel,O(B);var Oe=ie,Xe=Z(B);if(B.token!==":")throw Ze(B,"False part of conditional expression expected");B.conditionalLevel=null,O(B);var rt=Z(B);ie=new l(Oe,Xe,rt),B.conditionalLevel=ye}return ie}function Y(B){for(var ie=re(B);B.token==="or";)O(B),ie=new m("or","or",[ie,re(B)]);return ie}function re(B){for(var ie=ne(B);B.token==="xor";)O(B),ie=new m("xor","xor",[ie,ne(B)]);return ie}function ne(B){for(var ie=pe(B);B.token==="and";)O(B),ie=new m("and","and",[ie,pe(B)]);return ie}function pe(B){for(var ie=he(B);B.token==="|";)O(B),ie=new m("|","bitOr",[ie,he(B)]);return ie}function he(B){for(var ie=le(B);B.token==="^|";)O(B),ie=new m("^|","bitXor",[ie,le(B)]);return ie}function le(B){for(var ie=fe(B);B.token==="&";)O(B),ie=new m("&","bitAnd",[ie,fe(B)]);return ie}function fe(B){for(var ie=[xe(B)],ye=[],Oe={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};et(Oe,B.token);){var Xe={name:B.token,fn:Oe[B.token]};ye.push(Xe),O(B),ie.push(xe(B))}return ie.length===1?ie[0]:ie.length===2?new m(ye[0].name,ye[0].fn,ie):new b(ye.map(rt=>rt.fn),ie)}function xe(B){var ie,ye,Oe,Xe;ie=ge(B);for(var rt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};et(rt,B.token);)ye=B.token,Oe=rt[ye],O(B),Xe=[ie,ge(B)],ie=new m(ye,Oe,Xe);return ie}function ge(B){var ie,ye,Oe,Xe;ie=ve(B);for(var rt={to:"to",in:"to"};et(rt,B.token);)ye=B.token,Oe=rt[ye],O(B),ye==="in"&&B.token===""?ie=new m("*","multiply",[ie,new D("in")],!0):(Xe=[ie,ve(B)],ie=new m(ye,Oe,Xe));return ie}function ve(B){var ie,ye=[];if(B.token===":"?ie=new u(1):ie=Ee(B),B.token===":"&&B.conditionalLevel!==B.nestingLevel){for(ye.push(ie);B.token===":"&&ye.length<3;)O(B),B.token===")"||B.token==="]"||B.token===","||B.token===""?ye.push(new D("end")):ye.push(Ee(B));ye.length===3?ie=new y(ye[0],ye[2],ye[1]):ie=new y(ye[0],ye[1])}return ie}function Ee(B){var ie,ye,Oe,Xe;ie=q(B);for(var rt={"+":"add","-":"subtract"};et(rt,B.token);){ye=B.token,Oe=rt[ye],O(B);var wt=q(B);wt.isPercentage?Xe=[ie,new m("*","multiply",[ie,wt])]:Xe=[ie,wt],ie=new m(ye,Oe,Xe)}return ie}function q(B){var ie,ye,Oe,Xe;ie=J(B),ye=ie;for(var rt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};et(rt,B.token);)Oe=B.token,Xe=rt[Oe],O(B),ye=J(B),ie=new m(Oe,Xe,[ie,ye]);return ie}function J(B){var ie,ye;for(ie=ce(B),ye=ie;B.tokenType===w.SYMBOL||B.token==="in"&&Kt(ie)||B.tokenType===w.NUMBER&&!Kt(ye)&&(!Wr(ye)||ye.op==="!")||B.token==="(";)ye=ce(B),ie=new m("*","multiply",[ie,ye],!0);return ie}function ce(B){for(var ie=X(B),ye=ie,Oe=[];B.token==="/"&&Lx(ye);)if(Oe.push(fn({},B)),O(B),B.tokenType===w.NUMBER)if(Oe.push(fn({},B)),O(B),B.tokenType===w.SYMBOL||B.token==="(")fn(B,Oe.pop()),Oe.pop(),ye=X(B),ie=new m("/","divide",[ie,ye]);else{Oe.pop(),fn(B,Oe.pop());break}else{fn(B,Oe.pop());break}return ie}function X(B){var ie,ye,Oe,Xe;ie=te(B);for(var rt={"%":"mod",mod:"mod"};et(rt,B.token);)ye=B.token,Oe=rt[ye],O(B),ye==="%"&&B.tokenType===w.DELIMITER&&B.token!=="("?ie=new m("/","divide",[ie,new u(100)],!1,!0):(Xe=[ie,te(B)],ie=new m(ye,Oe,Xe));return ie}function te(B){var ie,ye,Oe,Xe={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return et(Xe,B.token)?(Oe=Xe[B.token],ie=B.token,O(B),ye=[te(B)],new m(ie,Oe,ye)):ae(B)}function ae(B){var ie,ye,Oe,Xe;return ie=De(B),(B.token==="^"||B.token===".^")&&(ye=B.token,Oe=ye==="^"?"pow":"dotPow",O(B),Xe=[ie,te(B)],ie=new m(ye,Oe,Xe)),ie}function De(B){var ie,ye,Oe,Xe;ie=be(B);for(var rt={"!":"factorial","'":"ctranspose"};et(rt,B.token);)ye=B.token,Oe=rt[ye],T(B),Xe=[ie],ie=new m(ye,Oe,Xe),ie=W(B,ie);return ie}function be(B){var ie=[];if(B.tokenType===w.SYMBOL&&et(B.extraNodes,B.token)){var ye=B.extraNodes[B.token];if(T(B),B.token==="("){if(ie=[],L(B),T(B),B.token!==")")for(ie.push(Z(B));B.token===",";)T(B),ie.push(Z(B));if(B.token!==")")throw Ze(B,"Parenthesis ) expected");I(B),T(B)}return new ye(ie)}return K(B)}function K(B){var ie,ye;return B.tokenType===w.SYMBOL||B.tokenType===w.DELIMITER&&B.token in E?(ye=B.token,T(B),et(A,ye)?ie=new u(A[ye]):_.indexOf(ye)!==-1?ie=new u(r(ye,"number")):ie=new D(ye),ie=W(B,ie),ie):ue(B)}function W(B,ie,ye){for(var Oe;(B.token==="("||B.token==="["||B.token===".")&&(!ye||ye.indexOf(B.token)!==-1);)if(Oe=[],B.token==="(")if(en(ie)||Ka(ie)){if(L(B),T(B),B.token!==")")for(Oe.push(Z(B));B.token===",";)T(B),Oe.push(Z(B));if(B.token!==")")throw Ze(B,"Parenthesis ) expected");I(B),T(B),ie=new d(ie,Oe)}else return ie;else if(B.token==="["){if(L(B),T(B),B.token!=="]")for(Oe.push(Z(B));B.token===",";)T(B),Oe.push(Z(B));if(B.token!=="]")throw Ze(B,"Parenthesis ] expected");I(B),T(B),ie=new i(ie,new f(Oe))}else{if(T(B),B.tokenType!==w.SYMBOL)throw Ze(B,"Property name expected after dot");Oe.push(new u(B.token)),T(B);var Xe=!0;ie=new i(ie,new f(Oe,Xe))}return ie}function ue(B){var ie,ye;return B.token==='"'?(ye=me(B),ie=new u(ye),ie=W(B,ie),ie):we(B)}function me(B){for(var ie="";R(B)!==""&&R(B)!=='"';)R(B)==="\\"&&(ie+=R(B),F(B)),ie+=R(B),F(B);if(T(B),B.token!=='"')throw Ze(B,'End of string " expected');return T(B),JSON.parse('"'+ie+'"')}function we(B){var ie,ye;return B.token==="'"?(ye=_e(B),ie=new u(ye),ie=W(B,ie),ie):Ae(B)}function _e(B){for(var ie="";R(B)!==""&&R(B)!=="'";)R(B)==="\\"&&(ie+=R(B),F(B)),ie+=R(B),F(B);if(T(B),B.token!=="'")throw Ze(B,"End of string ' expected");return T(B),JSON.parse('"'+ie+'"')}function Ae(B){var ie,ye,Oe,Xe;if(B.token==="["){if(L(B),T(B),B.token!=="]"){var rt=Ce(B);if(B.token===";"){for(Oe=1,ye=[rt];B.token===";";)T(B),ye[Oe]=Ce(B),Oe++;if(B.token!=="]")throw Ze(B,"End of matrix ] expected");I(B),T(B),Xe=ye[0].items.length;for(var wt=1;wt<Oe;wt++)if(ye[wt].items.length!==Xe)throw bt(B,"Column dimensions mismatch ("+ye[wt].items.length+" !== "+Xe+")");ie=new a(ye)}else{if(B.token!=="]")throw Ze(B,"End of matrix ] expected");I(B),T(B),ie=rt}}else I(B),T(B),ie=new a([]);return W(B,ie)}return Me(B)}function Ce(B){for(var ie=[Z(B)],ye=1;B.token===",";)T(B),ie[ye]=Z(B),ye++;return new a(ie)}function Me(B){if(B.token==="{"){L(B);var ie,ye={};do if(T(B),B.token!=="}"){if(B.token==='"')ie=me(B);else if(B.token==="'")ie=_e(B);else if(B.tokenType===w.SYMBOL||B.tokenType===w.DELIMITER&&B.token in E)ie=B.token,T(B);else throw Ze(B,"Symbol or string expected as object key");if(B.token!==":")throw Ze(B,"Colon : expected after object key");T(B),ye[ie]=Z(B)}while(B.token===",");if(B.token!=="}")throw Ze(B,"Comma , or bracket } expected after object value");I(B),T(B);var Oe=new p(ye);return Oe=W(B,Oe),Oe}return Te(B)}function Te(B){var ie;return B.tokenType===w.NUMBER?(ie=B.token,T(B),new u(r(ie,n.number))):Ve(B)}function Ve(B){var ie;if(B.token==="("){if(L(B),T(B),ie=Z(B),B.token!==")")throw Ze(B,"Parenthesis ) expected");return I(B),T(B),ie=new v(ie),ie=W(B,ie),ie}return Re(B)}function Re(B){throw B.token===""?Ze(B,"Unexpected end of expression"):Ze(B,"Value expected")}function dt(B){return B.index-B.token.length+1}function Ze(B,ie){var ye=dt(B),Oe=new SyntaxError(ie+" (char "+ye+")");return Oe.char=ye,Oe}function bt(B,ie){var ye=dt(B),Oe=new SyntaxError(ie+" (char "+ye+")");return Oe.char=ye,Oe}return t.addConversion({from:"string",to:"Node",convert:x}),x}),iI="compile",Foe=["typed","parse"],Uv=Q(iI,Foe,e=>{var{typed:t,parse:r}=e;return t(iI,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return zt(i,function(a){return r(a).compile()})}})}),aI="evaluate",$oe=["typed","parse"],Wv=Q(aI,$oe,e=>{var{typed:t,parse:r}=e;return t(aI,{string:function(i){var a=Sl();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=Sl();return zt(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return zt(i,function(o){return r(o).compile().evaluate(a)})}})}),Boe="Parser",zoe=["evaluate"],Hv=Q(Boe,zoe,e=>{var{evaluate:t}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Sl(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(n){return t(n,this.scope)},r.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},r.prototype.getAll=function(){return WJ(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(n,i){return this.scope.set(n,i),i},r.prototype.remove=function(n){this.scope.delete(n)},r.prototype.clear=function(){this.scope.clear()},r},{isClass:!0}),oI="parser",Loe=["typed","Parser"],jv=Q(oI,Loe,e=>{var{typed:t,Parser:r}=e;return t(oI,{"":function(){return new r}})}),sI="lup",Voe=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],Kv=Q(sI,Voe,e=>{var{typed:t,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtract:s,larger:l,equalScalar:u,unaryMinus:c,DenseMatrix:d,SparseMatrix:f,Spa:p}=e;return t(sI,{DenseMatrix:function(b){return m(b)},SparseMatrix:function(b){return v(b)},Array:function(b){var D=r(b),x=m(D);return{L:x.L.valueOf(),U:x.U.valueOf(),p:x.p}}});function m(y){var b=y._size[0],D=y._size[1],x=Math.min(b,D),S=pt(y._data),w=[],C=[b,x],E=[],A=[x,D],_,N,M,R=[];for(_=0;_<b;_++)R[_]=_;for(N=0;N<D;N++){if(N>0)for(_=0;_<b;_++){var F=Math.min(_,N),k=0;for(M=0;M<F;M++)k=i(k,o(S[_][M],S[M][N]));S[_][N]=s(S[_][N],k)}var P=N,T=0,O=0;for(_=N;_<b;_++){var L=S[_][N],I=n(L);l(I,T)&&(P=_,T=I,O=L)}if(N!==P&&(R[N]=[R[P],R[P]=R[N]][0],d._swapRows(N,P,S)),N<b)for(_=N+1;_<b;_++){var V=S[_][N];u(V,0)||(S[_][N]=a(S[_][N],O))}}for(N=0;N<D;N++)for(_=0;_<b;_++){if(N===0&&(_<D&&(E[_]=[]),w[_]=[]),_<N){_<D&&(E[_][N]=S[_][N]),N<b&&(w[_][N]=0);continue}if(_===N){_<D&&(E[_][N]=S[_][N]),N<b&&(w[_][N]=1);continue}_<D&&(E[_][N]=0),N<b&&(w[_][N]=S[_][N])}var H=new d({data:w,size:C}),Z=new d({data:E,size:A}),G=[];for(_=0,x=R.length;_<x;_++)G[R[_]]=_;return{L:H,U:Z,p:G,toString:function(){return"L: "+this.L.toString()+`
122
+ `&&B.token!==";"&&B.token!==""&&(ie=Z(B),B.comment&&(ie.comment=B.comment),Oe=B.token!==";",ye.push({node:ie,visible:Oe}));return ye.length>0?new s(ye):(ie||(ie=new u(void 0),B.comment&&(ie.comment=B.comment)),ie)}function Z(B){var ie,ye,Oe,Xe,rt=G(B);if(B.token==="="){if(en(rt))return ie=rt.name,O(B),Oe=Z(B),new o(new D(ie),Oe);if(Ka(rt))return O(B),Oe=Z(B),new o(rt.object,rt.index,Oe);if(ya(rt)&&en(rt.fn)&&(Xe=!0,ye=[],ie=rt.name,rt.args.forEach(function(wt,ur){en(wt)?ye[ur]=wt.name:Xe=!1}),Xe))return O(B),Oe=Z(B),new c(ie,ye,Oe);throw Ze(B,"Invalid left hand side of assignment operator =")}return rt}function G(B){for(var ie=Y(B);B.token==="?";){var ye=B.conditionalLevel;B.conditionalLevel=B.nestingLevel,O(B);var Oe=ie,Xe=Z(B);if(B.token!==":")throw Ze(B,"False part of conditional expression expected");B.conditionalLevel=null,O(B);var rt=Z(B);ie=new l(Oe,Xe,rt),B.conditionalLevel=ye}return ie}function Y(B){for(var ie=re(B);B.token==="or";)O(B),ie=new m("or","or",[ie,re(B)]);return ie}function re(B){for(var ie=ne(B);B.token==="xor";)O(B),ie=new m("xor","xor",[ie,ne(B)]);return ie}function ne(B){for(var ie=pe(B);B.token==="and";)O(B),ie=new m("and","and",[ie,pe(B)]);return ie}function pe(B){for(var ie=he(B);B.token==="|";)O(B),ie=new m("|","bitOr",[ie,he(B)]);return ie}function he(B){for(var ie=le(B);B.token==="^|";)O(B),ie=new m("^|","bitXor",[ie,le(B)]);return ie}function le(B){for(var ie=fe(B);B.token==="&";)O(B),ie=new m("&","bitAnd",[ie,fe(B)]);return ie}function fe(B){for(var ie=[xe(B)],ye=[],Oe={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};et(Oe,B.token);){var Xe={name:B.token,fn:Oe[B.token]};ye.push(Xe),O(B),ie.push(xe(B))}return ie.length===1?ie[0]:ie.length===2?new m(ye[0].name,ye[0].fn,ie):new b(ye.map(rt=>rt.fn),ie)}function xe(B){var ie,ye,Oe,Xe;ie=ge(B);for(var rt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};et(rt,B.token);)ye=B.token,Oe=rt[ye],O(B),Xe=[ie,ge(B)],ie=new m(ye,Oe,Xe);return ie}function ge(B){var ie,ye,Oe,Xe;ie=ve(B);for(var rt={to:"to",in:"to"};et(rt,B.token);)ye=B.token,Oe=rt[ye],O(B),ye==="in"&&B.token===""?ie=new m("*","multiply",[ie,new D("in")],!0):(Xe=[ie,ve(B)],ie=new m(ye,Oe,Xe));return ie}function ve(B){var ie,ye=[];if(B.token===":"?ie=new u(1):ie=Ee(B),B.token===":"&&B.conditionalLevel!==B.nestingLevel){for(ye.push(ie);B.token===":"&&ye.length<3;)O(B),B.token===")"||B.token==="]"||B.token===","||B.token===""?ye.push(new D("end")):ye.push(Ee(B));ye.length===3?ie=new y(ye[0],ye[2],ye[1]):ie=new y(ye[0],ye[1])}return ie}function Ee(B){var ie,ye,Oe,Xe;ie=q(B);for(var rt={"+":"add","-":"subtract"};et(rt,B.token);){ye=B.token,Oe=rt[ye],O(B);var wt=q(B);wt.isPercentage?Xe=[ie,new m("*","multiply",[ie,wt])]:Xe=[ie,wt],ie=new m(ye,Oe,Xe)}return ie}function q(B){var ie,ye,Oe,Xe;ie=J(B),ye=ie;for(var rt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};et(rt,B.token);)Oe=B.token,Xe=rt[Oe],O(B),ye=J(B),ie=new m(Oe,Xe,[ie,ye]);return ie}function J(B){var ie,ye;for(ie=ce(B),ye=ie;B.tokenType===w.SYMBOL||B.token==="in"&&Kt(ie)||B.tokenType===w.NUMBER&&!Kt(ye)&&(!Wr(ye)||ye.op==="!")||B.token==="(";)ye=ce(B),ie=new m("*","multiply",[ie,ye],!0);return ie}function ce(B){for(var ie=X(B),ye=ie,Oe=[];B.token==="/"&&Lx(ye);)if(Oe.push(fn({},B)),O(B),B.tokenType===w.NUMBER)if(Oe.push(fn({},B)),O(B),B.tokenType===w.SYMBOL||B.token==="(")fn(B,Oe.pop()),Oe.pop(),ye=X(B),ie=new m("/","divide",[ie,ye]);else{Oe.pop(),fn(B,Oe.pop());break}else{fn(B,Oe.pop());break}return ie}function X(B){var ie,ye,Oe,Xe;ie=te(B);for(var rt={"%":"mod",mod:"mod"};et(rt,B.token);)ye=B.token,Oe=rt[ye],O(B),ye==="%"&&B.tokenType===w.DELIMITER&&B.token!=="("?ie=new m("/","divide",[ie,new u(100)],!1,!0):(Xe=[ie,te(B)],ie=new m(ye,Oe,Xe));return ie}function te(B){var ie,ye,Oe,Xe={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return et(Xe,B.token)?(Oe=Xe[B.token],ie=B.token,O(B),ye=[te(B)],new m(ie,Oe,ye)):ae(B)}function ae(B){var ie,ye,Oe,Xe;return ie=De(B),(B.token==="^"||B.token===".^")&&(ye=B.token,Oe=ye==="^"?"pow":"dotPow",O(B),Xe=[ie,te(B)],ie=new m(ye,Oe,Xe)),ie}function De(B){var ie,ye,Oe,Xe;ie=be(B);for(var rt={"!":"factorial","'":"ctranspose"};et(rt,B.token);)ye=B.token,Oe=rt[ye],T(B),Xe=[ie],ie=new m(ye,Oe,Xe),ie=W(B,ie);return ie}function be(B){var ie=[];if(B.tokenType===w.SYMBOL&&et(B.extraNodes,B.token)){var ye=B.extraNodes[B.token];if(T(B),B.token==="("){if(ie=[],L(B),T(B),B.token!==")")for(ie.push(Z(B));B.token===",";)T(B),ie.push(Z(B));if(B.token!==")")throw Ze(B,"Parenthesis ) expected");I(B),T(B)}return new ye(ie)}return K(B)}function K(B){var ie,ye;return B.tokenType===w.SYMBOL||B.tokenType===w.DELIMITER&&B.token in E?(ye=B.token,T(B),et(A,ye)?ie=new u(A[ye]):_.indexOf(ye)!==-1?ie=new u(r(ye,"number")):ie=new D(ye),ie=W(B,ie),ie):ue(B)}function W(B,ie,ye){for(var Oe;(B.token==="("||B.token==="["||B.token===".")&&(!ye||ye.indexOf(B.token)!==-1);)if(Oe=[],B.token==="(")if(en(ie)||Ka(ie)){if(L(B),T(B),B.token!==")")for(Oe.push(Z(B));B.token===",";)T(B),Oe.push(Z(B));if(B.token!==")")throw Ze(B,"Parenthesis ) expected");I(B),T(B),ie=new d(ie,Oe)}else return ie;else if(B.token==="["){if(L(B),T(B),B.token!=="]")for(Oe.push(Z(B));B.token===",";)T(B),Oe.push(Z(B));if(B.token!=="]")throw Ze(B,"Parenthesis ] expected");I(B),T(B),ie=new i(ie,new f(Oe))}else{if(T(B),B.tokenType!==w.SYMBOL)throw Ze(B,"Property name expected after dot");Oe.push(new u(B.token)),T(B);var Xe=!0;ie=new i(ie,new f(Oe,Xe))}return ie}function ue(B){var ie,ye;return B.token==='"'?(ye=me(B),ie=new u(ye),ie=W(B,ie),ie):we(B)}function me(B){for(var ie="";R(B)!==""&&R(B)!=='"';)R(B)==="\\"&&(ie+=R(B),F(B)),ie+=R(B),F(B);if(T(B),B.token!=='"')throw Ze(B,'End of string " expected');return T(B),JSON.parse('"'+ie+'"')}function we(B){var ie,ye;return B.token==="'"?(ye=_e(B),ie=new u(ye),ie=W(B,ie),ie):Ae(B)}function _e(B){for(var ie="";R(B)!==""&&R(B)!=="'";)R(B)==="\\"&&(ie+=R(B),F(B)),ie+=R(B),F(B);if(T(B),B.token!=="'")throw Ze(B,"End of string ' expected");return T(B),JSON.parse('"'+ie+'"')}function Ae(B){var ie,ye,Oe,Xe;if(B.token==="["){if(L(B),T(B),B.token!=="]"){var rt=Ce(B);if(B.token===";"){for(Oe=1,ye=[rt];B.token===";";)T(B),ye[Oe]=Ce(B),Oe++;if(B.token!=="]")throw Ze(B,"End of matrix ] expected");I(B),T(B),Xe=ye[0].items.length;for(var wt=1;wt<Oe;wt++)if(ye[wt].items.length!==Xe)throw bt(B,"Column dimensions mismatch ("+ye[wt].items.length+" !== "+Xe+")");ie=new a(ye)}else{if(B.token!=="]")throw Ze(B,"End of matrix ] expected");I(B),T(B),ie=rt}}else I(B),T(B),ie=new a([]);return W(B,ie)}return Me(B)}function Ce(B){for(var ie=[Z(B)],ye=1;B.token===",";)T(B),ie[ye]=Z(B),ye++;return new a(ie)}function Me(B){if(B.token==="{"){L(B);var ie,ye={};do if(T(B),B.token!=="}"){if(B.token==='"')ie=me(B);else if(B.token==="'")ie=_e(B);else if(B.tokenType===w.SYMBOL||B.tokenType===w.DELIMITER&&B.token in E)ie=B.token,T(B);else throw Ze(B,"Symbol or string expected as object key");if(B.token!==":")throw Ze(B,"Colon : expected after object key");T(B),ye[ie]=Z(B)}while(B.token===",");if(B.token!=="}")throw Ze(B,"Comma , or bracket } expected after object value");I(B),T(B);var Oe=new p(ye);return Oe=W(B,Oe),Oe}return Te(B)}function Te(B){var ie;return B.tokenType===w.NUMBER?(ie=B.token,T(B),new u(r(ie,n.number))):Ve(B)}function Ve(B){var ie;if(B.token==="("){if(L(B),T(B),ie=Z(B),B.token!==")")throw Ze(B,"Parenthesis ) expected");return I(B),T(B),ie=new v(ie),ie=W(B,ie),ie}return Re(B)}function Re(B){throw B.token===""?Ze(B,"Unexpected end of expression"):Ze(B,"Value expected")}function dt(B){return B.index-B.token.length+1}function Ze(B,ie){var ye=dt(B),Oe=new SyntaxError(ie+" (char "+ye+")");return Oe.char=ye,Oe}function bt(B,ie){var ye=dt(B),Oe=new SyntaxError(ie+" (char "+ye+")");return Oe.char=ye,Oe}return t.addConversion({from:"string",to:"Node",convert:x}),x}),i3="compile",Foe=["typed","parse"],Uv=Q(i3,Foe,e=>{var{typed:t,parse:r}=e;return t(i3,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return zt(i,function(a){return r(a).compile()})}})}),a3="evaluate",$oe=["typed","parse"],Wv=Q(a3,$oe,e=>{var{typed:t,parse:r}=e;return t(a3,{string:function(i){var a=Sl();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=Sl();return zt(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return zt(i,function(o){return r(o).compile().evaluate(a)})}})}),Boe="Parser",zoe=["evaluate"],Hv=Q(Boe,zoe,e=>{var{evaluate:t}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Sl(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(n){return t(n,this.scope)},r.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},r.prototype.getAll=function(){return WJ(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(n,i){return this.scope.set(n,i),i},r.prototype.remove=function(n){this.scope.delete(n)},r.prototype.clear=function(){this.scope.clear()},r},{isClass:!0}),o3="parser",Loe=["typed","Parser"],jv=Q(o3,Loe,e=>{var{typed:t,Parser:r}=e;return t(o3,{"":function(){return new r}})}),s3="lup",Voe=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],Kv=Q(s3,Voe,e=>{var{typed:t,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtract:s,larger:l,equalScalar:u,unaryMinus:c,DenseMatrix:d,SparseMatrix:f,Spa:p}=e;return t(s3,{DenseMatrix:function(b){return m(b)},SparseMatrix:function(b){return v(b)},Array:function(b){var D=r(b),x=m(D);return{L:x.L.valueOf(),U:x.U.valueOf(),p:x.p}}});function m(y){var b=y._size[0],D=y._size[1],x=Math.min(b,D),S=pt(y._data),w=[],C=[b,x],E=[],A=[x,D],_,N,M,R=[];for(_=0;_<b;_++)R[_]=_;for(N=0;N<D;N++){if(N>0)for(_=0;_<b;_++){var F=Math.min(_,N),k=0;for(M=0;M<F;M++)k=i(k,o(S[_][M],S[M][N]));S[_][N]=s(S[_][N],k)}var P=N,T=0,O=0;for(_=N;_<b;_++){var L=S[_][N],I=n(L);l(I,T)&&(P=_,T=I,O=L)}if(N!==P&&(R[N]=[R[P],R[P]=R[N]][0],d._swapRows(N,P,S)),N<b)for(_=N+1;_<b;_++){var V=S[_][N];u(V,0)||(S[_][N]=a(S[_][N],O))}}for(N=0;N<D;N++)for(_=0;_<b;_++){if(N===0&&(_<D&&(E[_]=[]),w[_]=[]),_<N){_<D&&(E[_][N]=S[_][N]),N<b&&(w[_][N]=0);continue}if(_===N){_<D&&(E[_][N]=S[_][N]),N<b&&(w[_][N]=1);continue}_<D&&(E[_][N]=0),N<b&&(w[_][N]=S[_][N])}var H=new d({data:w,size:C}),Z=new d({data:E,size:A}),G=[];for(_=0,x=R.length;_<x;_++)G[R[_]]=_;return{L:H,U:Z,p:G,toString:function(){return"L: "+this.L.toString()+`
123
123
  U: `+this.U.toString()+`
124
124
  P: `+this.p}}}function v(y){var b=y._size[0],D=y._size[1],x=Math.min(b,D),S=y._values,w=y._index,C=y._ptr,E=[],A=[],_=[],N=[b,x],M=[],R=[],F=[],k=[x,D],P,T,O,L=[],I=[];for(P=0;P<b;P++)L[P]=P,I[P]=P;var V=function(G,Y){var re=I[G],ne=I[Y];L[re]=Y,L[ne]=G,I[G]=ne,I[Y]=re},H=function(){var G=new p;T<b&&(_.push(E.length),E.push(1),A.push(T)),F.push(M.length);var Y=C[T],re=C[T+1];for(O=Y;O<re;O++)P=w[O],G.set(L[P],S[O]);T>0&&G.forEach(0,T-1,function(le,fe){f._forEachRow(le,E,A,_,function(xe,ge){xe>le&&G.accumulate(xe,c(o(ge,fe)))})});var ne=T,pe=G.get(T),he=n(pe);G.forEach(T+1,b-1,function(le,fe){var xe=n(fe);l(xe,he)&&(ne=le,he=xe,pe=fe)}),T!==ne&&(f._swapRows(T,ne,N[1],E,A,_),f._swapRows(T,ne,k[1],M,R,F),G.swap(T,ne),V(T,ne)),G.forEach(0,b-1,function(le,fe){le<=T?(M.push(fe),R.push(le)):(fe=a(fe,pe),u(fe,0)||(E.push(fe),A.push(le)))})};for(T=0;T<D;T++)H();return F.push(M.length),_.push(E.length),{L:new f({values:E,index:A,ptr:_,size:N}),U:new f({values:M,index:R,ptr:F,size:k}),p:L,toString:function(){return"L: "+this.L.toString()+`
125
125
  U: `+this.U.toString()+`
126
- P: `+this.p}}}}),lI="qr",qoe=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract","complex"],Yv=Q(lI,qoe,e=>{var{typed:t,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:s,sqrt:l,conj:u,unaryMinus:c,addScalar:d,divideScalar:f,multiplyScalar:p,subtract:m,complex:v}=e;return fn(t(lI,{DenseMatrix:function(S){return b(S)},SparseMatrix:function(S){return D()},Array:function(S){var w=r(S),C=b(w);return{Q:C.Q.valueOf(),R:C.R.valueOf()}}}),{_denseQRimpl:y});function y(x){var S=x._size[0],w=x._size[1],C=i([S],"dense"),E=C._data,A=x.clone(),_=A._data,N,M,R,F=n([S],"");for(R=0;R<Math.min(w,S);++R){var k=_[R][R],P=c(o(k,0)?1:s(k)),T=u(P),O=0;for(N=R;N<S;N++)O=d(O,p(_[N][R],u(_[N][R])));var L=p(P,l(O));if(!a(L)){var I=m(k,L);for(F[R]=1,N=R+1;N<S;N++)F[N]=f(_[N][R],I);var V=c(u(f(I,L))),H=void 0;for(M=R;M<w;M++){for(H=0,N=R;N<S;N++)H=d(H,p(u(F[N]),_[N][M]));for(H=p(H,V),N=R;N<S;N++)_[N][M]=p(m(_[N][M],p(F[N],H)),T)}for(N=0;N<S;N++){for(H=0,M=R;M<S;M++)H=d(H,p(E[N][M],F[M]));for(H=p(H,V),M=R;M<S;++M)E[N][M]=f(m(E[N][M],p(H,u(F[M]))),T)}}}return{Q:C,R:A,toString:function(){return"Q: "+this.Q.toString()+`
127
- R: `+this.R.toString()}}}function b(x){var S=y(x),w=S.R._data;if(x._data.length>0)for(var C=w[0][0].type==="Complex"?v(0):0,E=0;E<w.length;++E)for(var A=0;A<E&&A<(w[0]||[]).length;++A)w[E][A]=C;return S}function D(x){throw new Error("qr not implemented for sparse matrices yet")}});function Goe(e,t,r,n){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,l=e._datatype,u=s[0],c=s[1],d=n&&e._values?[]:null,f=[],p=[],m=0,v=0;v<c;v++){p[v]=m;for(var y=r?r[v]:v,b=o[y],D=o[y+1],x=b;x<D;x++){var S=t?t[a[x]]:a[x];f[m]=S,d&&(d[m]=i[x]),m++}}return p[c]=m,e.createSparseMatrix({values:d,index:f,ptr:p,size:[u,c],datatype:l})}function uI(e,t,r,n,i,a,o){var s=0;for(r[o]=e;s>=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[t++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return t}function Uoe(e,t){if(!e)return null;var r=0,n,i=[],a=[],o=0,s=t,l=2*t;for(n=0;n<t;n++)a[o+n]=-1;for(n=t-1;n>=0;n--)e[n]!==-1&&(a[s+n]=a[o+e[n]],a[o+e[n]]=n);for(n=0;n<t;n++)e[n]===-1&&(r=uI(n,r,a,o,s,i,l));return i}function Woe(e,t){if(!e)return null;var r=e._index,n=e._ptr,i=e._size,a=i[0],o=i[1],s=[],l=[],u=0,c=o,d,f;if(t)for(d=0;d<a;d++)l[c+d]=-1;for(var p=0;p<o;p++){s[p]=-1,l[u+p]=-1;for(var m=n[p],v=n[p+1],y=m;y<v;y++){var b=r[y];for(d=t?l[c+b]:b;d!==-1&&d<p;d=f)f=l[u+d],l[u+d]=p,f===-1&&(s[d]=p);t&&(l[c+b]=p)}}return s}function Hoe(e,t,r){for(var n=e._values,i=e._index,a=e._ptr,o=e._size,s=o[1],l=0,u=0;u<s;u++){var c=a[u];for(a[u]=l;c<a[u+1];c++)t(i[c],u,n?n[c]:1,r)&&(i[l]=i[c],n&&(n[l]=n[c]),l++)}return a[s]=l,i.splice(l,i.length-l),n&&n.splice(l,n.length-l),l}function zo(e){return-e-2}var joe="csAmd",Koe=["add","multiply","transpose"],Yoe=Q(joe,Koe,e=>{var{add:t,multiply:r,transpose:n}=e;return function(c,d){if(!d||c<=0||c>3)return null;var f=d._size,p=f[0],m=f[1],v=0,y=Math.max(16,10*Math.sqrt(m));y=Math.min(m-2,y);var b=i(c,d,p,m,y);Hoe(b,l,null);for(var D=b._index,x=b._ptr,S=x[m],w=[],C=[],E=0,A=m+1,_=2*(m+1),N=3*(m+1),M=4*(m+1),R=5*(m+1),F=6*(m+1),k=7*(m+1),P=w,T=a(m,x,C,E,N,P,_,k,A,F,M,R),O=o(m,x,C,R,M,F,y,A,N,P,_),L=0,I,V,H,Z,G,Y,re,ne,pe,he,le,fe,xe,ge,ve,Ee;O<m;){for(H=-1;L<m&&(H=C[N+L])===-1;L++);C[_+H]!==-1&&(P[C[_+H]]=-1),C[N+L]=C[_+H];var q=C[M+H],J=C[A+H];O+=J;var ce=0;C[A+H]=-J;var X=x[H],te=q===0?X:S,ae=te;for(Z=1;Z<=q+1;Z++){for(Z>q?(Y=H,re=X,ne=C[E+H]-q):(Y=D[X++],re=x[Y],ne=C[E+Y]),G=1;G<=ne;G++)I=D[re++],!((pe=C[A+I])<=0)&&(ce+=pe,C[A+I]=-pe,D[ae++]=I,C[_+I]!==-1&&(P[C[_+I]]=P[I]),P[I]!==-1?C[_+P[I]]=C[_+I]:C[N+C[R+I]]=C[_+I]);Y!==H&&(x[Y]=zo(H),C[F+Y]=0)}for(q!==0&&(S=ae),C[R+H]=ce,x[H]=te,C[E+H]=ae-te,C[M+H]=-2,T=s(T,v,C,F,m),he=te;he<ae;he++)if(I=D[he],!((le=C[M+I])<=0)){pe=-C[A+I];var De=T-pe;for(X=x[I],fe=x[I]+le-1;X<=fe;X++)Y=D[X],C[F+Y]>=T?C[F+Y]-=pe:C[F+Y]!==0&&(C[F+Y]=C[R+Y]+De)}for(he=te;he<ae;he++){for(I=D[he],fe=x[I],xe=fe+C[M+I]-1,ge=fe,ve=0,Ee=0,X=fe;X<=xe;X++)if(Y=D[X],C[F+Y]!==0){var be=C[F+Y]-T;be>0?(Ee+=be,D[ge++]=Y,ve+=Y):(x[Y]=zo(H),C[F+Y]=0)}C[M+I]=ge-fe+1;var K=ge,W=fe+C[E+I];for(X=xe+1;X<W;X++){V=D[X];var ue=C[A+V];ue<=0||(Ee+=ue,D[ge++]=V,ve+=V)}Ee===0?(x[I]=zo(H),pe=-C[A+I],ce-=pe,J+=pe,O+=pe,C[A+I]=0,C[M+I]=-1):(C[R+I]=Math.min(C[R+I],Ee),D[ge]=D[K],D[K]=D[fe],D[fe]=H,C[E+I]=ge-fe+1,ve=(ve<0?-ve:ve)%m,C[_+I]=C[k+ve],C[k+ve]=I,P[I]=ve)}for(C[R+H]=ce,v=Math.max(v,ce),T=s(T+v,v,C,F,m),he=te;he<ae;he++)if(I=D[he],!(C[A+I]>=0))for(ve=P[I],I=C[k+ve],C[k+ve]=-1;I!==-1&&C[_+I]!==-1;I=C[_+I],T++){for(ne=C[E+I],le=C[M+I],X=x[I]+1;X<=x[I]+ne-1;X++)C[F+D[X]]=T;var me=I;for(V=C[_+I];V!==-1;){var we=C[E+V]===ne&&C[M+V]===le;for(X=x[V]+1;we&&X<=x[V]+ne-1;X++)C[F+D[X]]!==T&&(we=0);we?(x[V]=zo(I),C[A+I]+=C[A+V],C[A+V]=0,C[M+V]=-1,V=C[_+V],C[_+me]=V):(me=V,V=C[_+V])}}for(X=te,he=te;he<ae;he++)I=D[he],!((pe=-C[A+I])<=0)&&(C[A+I]=pe,Ee=C[R+I]+ce-pe,Ee=Math.min(Ee,m-O-pe),C[N+Ee]!==-1&&(P[C[N+Ee]]=I),C[_+I]=C[N+Ee],P[I]=-1,C[N+Ee]=I,L=Math.min(L,Ee),C[R+I]=Ee,D[X++]=I);C[A+H]=J,(C[E+H]=X-te)===0&&(x[H]=-1,C[F+H]=0),q!==0&&(S=X)}for(I=0;I<m;I++)x[I]=zo(x[I]);for(V=0;V<=m;V++)C[N+V]=-1;for(V=m;V>=0;V--)C[A+V]>0||(C[_+V]=C[N+x[V]],C[N+x[V]]=V);for(Y=m;Y>=0;Y--)C[A+Y]<=0||x[Y]!==-1&&(C[_+Y]=C[N+x[Y]],C[N+x[Y]]=Y);for(H=0,I=0;I<=m;I++)x[I]===-1&&(H=uI(I,H,C,N,_,w,F));return w.splice(w.length-1,1),w};function i(u,c,d,f,p){var m=n(c);if(u===1&&f===d)return t(c,m);if(u===2){for(var v=m._index,y=m._ptr,b=0,D=0;D<d;D++){var x=y[D];if(y[D]=b,!(y[D+1]-x>p))for(var S=y[D+1];x<S;x++)v[b++]=v[x]}return y[d]=b,c=n(m),r(m,c)}return r(m,c)}function a(u,c,d,f,p,m,v,y,b,D,x,S){for(var w=0;w<u;w++)d[f+w]=c[w+1]-c[w];d[f+u]=0;for(var C=0;C<=u;C++)d[p+C]=-1,m[C]=-1,d[v+C]=-1,d[y+C]=-1,d[b+C]=1,d[D+C]=1,d[x+C]=0,d[S+C]=d[f+C];var E=s(0,0,d,D,u);return d[x+u]=-2,c[u]=-1,d[D+u]=0,E}function o(u,c,d,f,p,m,v,y,b,D,x){for(var S=0,w=0;w<u;w++){var C=d[f+w];if(C===0)d[p+w]=-2,S++,c[w]=-1,d[m+w]=0;else if(C>v)d[y+w]=0,d[p+w]=-1,S++,c[w]=zo(u),d[y+u]++;else{var E=d[b+C];E!==-1&&(D[E]=w),d[x+w]=d[b+C],d[b+C]=w}}return S}function s(u,c,d,f,p){if(u<2||u+c<0){for(var m=0;m<p;m++)d[f+m]!==0&&(d[f+m]=1);u=2}return u}function l(u,c){return u!==c}});function Xoe(e,t,r,n,i,a,o){var s,l,u=0,c;if(e<=t||r[n+t]<=r[i+e])return-1;r[i+e]=r[n+t];var d=r[a+e];if(r[a+e]=t,d===-1)u=1,c=e;else{for(u=2,c=d;c!==r[o+c];c=r[o+c]);for(s=d;s!==c;s=l)l=r[o+s],r[o+s]=c}return{jleaf:u,q:c}}var Zoe="csCounts",Qoe=["transpose"],Joe=Q(Zoe,Qoe,e=>{var{transpose:t}=e;return function(r,n,i,a){if(!r||!n||!i)return null;var o=r._size,s=o[0],l=o[1],u,c,d,f,p,m,v,y=4*l+(a?l+s+1:0),b=[],D=0,x=l,S=2*l,w=3*l,C=4*l,E=5*l+1;for(d=0;d<y;d++)b[d]=-1;var A=[],_=t(r),N=_._index,M=_._ptr;for(d=0;d<l;d++)for(c=i[d],A[c]=b[w+c]===-1?1:0;c!==-1&&b[w+c]===-1;c=n[c])b[w+c]=d;if(a){for(d=0;d<l;d++)b[i[d]]=d;for(u=0;u<s;u++){for(d=l,m=M[u],v=M[u+1],p=m;p<v;p++)d=Math.min(d,b[N[p]]);b[E+u]=b[C+d],b[C+d]=u}}for(u=0;u<l;u++)b[D+u]=u;for(d=0;d<l;d++){for(c=i[d],n[c]!==-1&&A[n[c]]--,f=a?b[C+d]:c;f!==-1;f=a?b[E+f]:-1)for(p=M[f];p<M[f+1];p++){u=N[p];var R=Xoe(u,c,b,w,x,S,D);R.jleaf>=1&&A[c]++,R.jleaf===2&&A[R.q]--}n[c]!==-1&&(b[D+c]=n[c])}for(c=0;c<l;c++)n[c]!==-1&&(A[n[c]]+=A[c]);return A}}),ese="csSqr",tse=["add","multiply","transpose"],rse=Q(ese,tse,e=>{var{add:t,multiply:r,transpose:n}=e,i=Yoe({add:t,multiply:r,transpose:n}),a=Joe({transpose:n});return function(l,u,c){var d=u._ptr,f=u._size,p=f[1],m,v={};if(v.q=i(l,u),l&&!v.q)return null;if(c){var y=l?Goe(u,null,v.q,0):u;v.parent=Woe(y,1);var b=Uoe(v.parent,p);if(v.cp=a(y,v.parent,b,1),y&&v.parent&&v.cp&&o(y,v))for(v.unz=0,m=0;m<p;m++)v.unz+=v.cp[m]}else v.unz=4*d[p]+p,v.lnz=v.unz;return v};function o(s,l){var u=s._ptr,c=s._index,d=s._size,f=d[0],p=d[1];l.pinv=[],l.leftmost=[];var m=l.parent,v=l.pinv,y=l.leftmost,b=[],D=0,x=f,S=f+p,w=f+2*p,C,E,A,_,N;for(E=0;E<p;E++)b[x+E]=-1,b[S+E]=-1,b[w+E]=0;for(C=0;C<f;C++)y[C]=-1;for(E=p-1;E>=0;E--)for(_=u[E],N=u[E+1],A=_;A<N;A++)y[c[A]]=E;for(C=f-1;C>=0;C--)v[C]=-1,E=y[C],E!==-1&&(b[w+E]++===0&&(b[S+E]=C),b[D+C]=b[x+E],b[x+E]=C);for(l.lnz=0,l.m2=f,E=0;E<p;E++)if(C=b[x+E],l.lnz++,C<0&&(C=l.m2++),v[C]=E,!(--w[E]<=0)){l.lnz+=b[w+E];var M=m[E];M!==-1&&(b[w+M]===0&&(b[S+M]=b[S+E]),b[D+b[S+E]]=b[x+M],b[x+M]=b[D+C],b[w+M]+=b[w+E])}for(C=0;C<f;C++)v[C]<0&&(v[C]=E++);return!0}});function Nw(e,t){return e[t]<0}function cI(e,t){e[t]=zo(e[t])}function dI(e){return e<0?zo(e):e}function nse(e,t,r,n,i){var a=t._index,o=t._ptr,s=t._size,l=s[1],u,c,d,f=0;for(n[0]=e;f>=0;){e=n[f];var p=i?i[e]:e;Nw(o,e)||(cI(o,e),n[l+f]=p<0?0:dI(o[p]));var m=1;for(c=n[l+f],d=p<0?0:dI(o[p+1]);c<d;c++)if(u=a[c],!Nw(o,u)){n[l+f]=c,n[++f]=u,m=0;break}m&&(f--,n[--r]=e)}return r}function ise(e,t,r,n,i){var a=e._ptr,o=e._size,s=t._index,l=t._ptr,u=o[1],c,d,f,p=u;for(d=l[r],f=l[r+1],c=d;c<f;c++){var m=s[c];Nw(a,m)||(p=nse(m,e,p,n,i))}for(c=p;c<u;c++)cI(a,n[c]);return p}var ase="csSpsolve",ose=["divideScalar","multiply","subtract"],sse=Q(ase,ose,e=>{var{divideScalar:t,multiply:r,subtract:n}=e;return function(a,o,s,l,u,c,d){var f=a._values,p=a._index,m=a._ptr,v=a._size,y=v[1],b=o._values,D=o._index,x=o._ptr,S,w,C,E,A=ise(a,o,s,l,c);for(S=A;S<y;S++)u[l[S]]=0;for(w=x[s],C=x[s+1],S=w;S<C;S++)u[D[S]]=b[S];for(var _=A;_<y;_++){var N=l[_],M=c?c[N]:N;if(!(M<0))for(w=m[M],C=m[M+1],u[N]=t(u[N],f[d?w:C-1]),S=d?w+1:w,E=d?C:C-1;S<E;S++){var R=p[S];u[R]=n(u[R],r(f[S],u[N]))}}return A}}),lse="csLu",use=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],cse=Q(lse,use,e=>{var{abs:t,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,l=sse({divideScalar:r,multiply:n,subtract:i});return function(c,d,f){if(!c)return null;var p=c._size,m=p[1],v,y=100,b=100;d&&(v=d.q,y=d.lnz||y,b=d.unz||b);var D=[],x=[],S=[],w=new s({values:D,index:x,ptr:S,size:[m,m]}),C=[],E=[],A=[],_=new s({values:C,index:E,ptr:A,size:[m,m]}),N=[],M,R,F=[],k=[];for(M=0;M<m;M++)F[M]=0,N[M]=-1,S[M+1]=0;y=0,b=0;for(var P=0;P<m;P++){S[P]=y,A[P]=b;var T=v?v[P]:P,O=l(w,c,T,k,F,N,1),L=-1,I=-1;for(R=O;R<m;R++)if(M=k[R],N[M]<0){var V=t(F[M]);a(V,I)&&(I=V,L=M)}else E[b]=N[M],C[b++]=F[M];if(L===-1||I<=0)return null;N[T]<0&&o(t(F[T]),n(I,f))&&(L=T);var H=F[L];for(E[b]=P,C[b++]=H,N[L]=P,x[y]=L,D[y++]=1,R=O;R<m;R++)M=k[R],N[M]<0&&(x[y]=M,D[y++]=r(F[M],H)),F[M]=0}for(S[m]=y,A[m]=b,R=0;R<y;R++)x[R]=N[x[R]];return D.splice(y,D.length-y),x.splice(y,x.length-y),C.splice(b,C.length-b),E.splice(b,E.length-b),{L:w,U:_,pinv:N}}}),fI="slu",dse=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],Xv=Q(fI,dse,e=>{var{typed:t,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:l,largerEq:u,SparseMatrix:c}=e,d=rse({add:n,multiply:i,transpose:a}),f=cse({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return t(fI,{"SparseMatrix, number, number":function(m,v,y){if(!ot(v)||v<0||v>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(y<0||y>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var b=d(v,m,!1),D=f(m,b,y);return{L:D.L,U:D.U,p:D.pinv,q:b.q,toString:function(){return"L: "+this.L.toString()+`
126
+ P: `+this.p}}}}),l3="qr",qoe=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract","complex"],Yv=Q(l3,qoe,e=>{var{typed:t,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:s,sqrt:l,conj:u,unaryMinus:c,addScalar:d,divideScalar:f,multiplyScalar:p,subtract:m,complex:v}=e;return fn(t(l3,{DenseMatrix:function(S){return b(S)},SparseMatrix:function(S){return D()},Array:function(S){var w=r(S),C=b(w);return{Q:C.Q.valueOf(),R:C.R.valueOf()}}}),{_denseQRimpl:y});function y(x){var S=x._size[0],w=x._size[1],C=i([S],"dense"),E=C._data,A=x.clone(),_=A._data,N,M,R,F=n([S],"");for(R=0;R<Math.min(w,S);++R){var k=_[R][R],P=c(o(k,0)?1:s(k)),T=u(P),O=0;for(N=R;N<S;N++)O=d(O,p(_[N][R],u(_[N][R])));var L=p(P,l(O));if(!a(L)){var I=m(k,L);for(F[R]=1,N=R+1;N<S;N++)F[N]=f(_[N][R],I);var V=c(u(f(I,L))),H=void 0;for(M=R;M<w;M++){for(H=0,N=R;N<S;N++)H=d(H,p(u(F[N]),_[N][M]));for(H=p(H,V),N=R;N<S;N++)_[N][M]=p(m(_[N][M],p(F[N],H)),T)}for(N=0;N<S;N++){for(H=0,M=R;M<S;M++)H=d(H,p(E[N][M],F[M]));for(H=p(H,V),M=R;M<S;++M)E[N][M]=f(m(E[N][M],p(H,u(F[M]))),T)}}}return{Q:C,R:A,toString:function(){return"Q: "+this.Q.toString()+`
127
+ R: `+this.R.toString()}}}function b(x){var S=y(x),w=S.R._data;if(x._data.length>0)for(var C=w[0][0].type==="Complex"?v(0):0,E=0;E<w.length;++E)for(var A=0;A<E&&A<(w[0]||[]).length;++A)w[E][A]=C;return S}function D(x){throw new Error("qr not implemented for sparse matrices yet")}});function Goe(e,t,r,n){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,l=e._datatype,u=s[0],c=s[1],d=n&&e._values?[]:null,f=[],p=[],m=0,v=0;v<c;v++){p[v]=m;for(var y=r?r[v]:v,b=o[y],D=o[y+1],x=b;x<D;x++){var S=t?t[a[x]]:a[x];f[m]=S,d&&(d[m]=i[x]),m++}}return p[c]=m,e.createSparseMatrix({values:d,index:f,ptr:p,size:[u,c],datatype:l})}function u3(e,t,r,n,i,a,o){var s=0;for(r[o]=e;s>=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[t++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return t}function Uoe(e,t){if(!e)return null;var r=0,n,i=[],a=[],o=0,s=t,l=2*t;for(n=0;n<t;n++)a[o+n]=-1;for(n=t-1;n>=0;n--)e[n]!==-1&&(a[s+n]=a[o+e[n]],a[o+e[n]]=n);for(n=0;n<t;n++)e[n]===-1&&(r=u3(n,r,a,o,s,i,l));return i}function Woe(e,t){if(!e)return null;var r=e._index,n=e._ptr,i=e._size,a=i[0],o=i[1],s=[],l=[],u=0,c=o,d,f;if(t)for(d=0;d<a;d++)l[c+d]=-1;for(var p=0;p<o;p++){s[p]=-1,l[u+p]=-1;for(var m=n[p],v=n[p+1],y=m;y<v;y++){var b=r[y];for(d=t?l[c+b]:b;d!==-1&&d<p;d=f)f=l[u+d],l[u+d]=p,f===-1&&(s[d]=p);t&&(l[c+b]=p)}}return s}function Hoe(e,t,r){for(var n=e._values,i=e._index,a=e._ptr,o=e._size,s=o[1],l=0,u=0;u<s;u++){var c=a[u];for(a[u]=l;c<a[u+1];c++)t(i[c],u,n?n[c]:1,r)&&(i[l]=i[c],n&&(n[l]=n[c]),l++)}return a[s]=l,i.splice(l,i.length-l),n&&n.splice(l,n.length-l),l}function zo(e){return-e-2}var joe="csAmd",Koe=["add","multiply","transpose"],Yoe=Q(joe,Koe,e=>{var{add:t,multiply:r,transpose:n}=e;return function(c,d){if(!d||c<=0||c>3)return null;var f=d._size,p=f[0],m=f[1],v=0,y=Math.max(16,10*Math.sqrt(m));y=Math.min(m-2,y);var b=i(c,d,p,m,y);Hoe(b,l,null);for(var D=b._index,x=b._ptr,S=x[m],w=[],C=[],E=0,A=m+1,_=2*(m+1),N=3*(m+1),M=4*(m+1),R=5*(m+1),F=6*(m+1),k=7*(m+1),P=w,T=a(m,x,C,E,N,P,_,k,A,F,M,R),O=o(m,x,C,R,M,F,y,A,N,P,_),L=0,I,V,H,Z,G,Y,re,ne,pe,he,le,fe,xe,ge,ve,Ee;O<m;){for(H=-1;L<m&&(H=C[N+L])===-1;L++);C[_+H]!==-1&&(P[C[_+H]]=-1),C[N+L]=C[_+H];var q=C[M+H],J=C[A+H];O+=J;var ce=0;C[A+H]=-J;var X=x[H],te=q===0?X:S,ae=te;for(Z=1;Z<=q+1;Z++){for(Z>q?(Y=H,re=X,ne=C[E+H]-q):(Y=D[X++],re=x[Y],ne=C[E+Y]),G=1;G<=ne;G++)I=D[re++],!((pe=C[A+I])<=0)&&(ce+=pe,C[A+I]=-pe,D[ae++]=I,C[_+I]!==-1&&(P[C[_+I]]=P[I]),P[I]!==-1?C[_+P[I]]=C[_+I]:C[N+C[R+I]]=C[_+I]);Y!==H&&(x[Y]=zo(H),C[F+Y]=0)}for(q!==0&&(S=ae),C[R+H]=ce,x[H]=te,C[E+H]=ae-te,C[M+H]=-2,T=s(T,v,C,F,m),he=te;he<ae;he++)if(I=D[he],!((le=C[M+I])<=0)){pe=-C[A+I];var De=T-pe;for(X=x[I],fe=x[I]+le-1;X<=fe;X++)Y=D[X],C[F+Y]>=T?C[F+Y]-=pe:C[F+Y]!==0&&(C[F+Y]=C[R+Y]+De)}for(he=te;he<ae;he++){for(I=D[he],fe=x[I],xe=fe+C[M+I]-1,ge=fe,ve=0,Ee=0,X=fe;X<=xe;X++)if(Y=D[X],C[F+Y]!==0){var be=C[F+Y]-T;be>0?(Ee+=be,D[ge++]=Y,ve+=Y):(x[Y]=zo(H),C[F+Y]=0)}C[M+I]=ge-fe+1;var K=ge,W=fe+C[E+I];for(X=xe+1;X<W;X++){V=D[X];var ue=C[A+V];ue<=0||(Ee+=ue,D[ge++]=V,ve+=V)}Ee===0?(x[I]=zo(H),pe=-C[A+I],ce-=pe,J+=pe,O+=pe,C[A+I]=0,C[M+I]=-1):(C[R+I]=Math.min(C[R+I],Ee),D[ge]=D[K],D[K]=D[fe],D[fe]=H,C[E+I]=ge-fe+1,ve=(ve<0?-ve:ve)%m,C[_+I]=C[k+ve],C[k+ve]=I,P[I]=ve)}for(C[R+H]=ce,v=Math.max(v,ce),T=s(T+v,v,C,F,m),he=te;he<ae;he++)if(I=D[he],!(C[A+I]>=0))for(ve=P[I],I=C[k+ve],C[k+ve]=-1;I!==-1&&C[_+I]!==-1;I=C[_+I],T++){for(ne=C[E+I],le=C[M+I],X=x[I]+1;X<=x[I]+ne-1;X++)C[F+D[X]]=T;var me=I;for(V=C[_+I];V!==-1;){var we=C[E+V]===ne&&C[M+V]===le;for(X=x[V]+1;we&&X<=x[V]+ne-1;X++)C[F+D[X]]!==T&&(we=0);we?(x[V]=zo(I),C[A+I]+=C[A+V],C[A+V]=0,C[M+V]=-1,V=C[_+V],C[_+me]=V):(me=V,V=C[_+V])}}for(X=te,he=te;he<ae;he++)I=D[he],!((pe=-C[A+I])<=0)&&(C[A+I]=pe,Ee=C[R+I]+ce-pe,Ee=Math.min(Ee,m-O-pe),C[N+Ee]!==-1&&(P[C[N+Ee]]=I),C[_+I]=C[N+Ee],P[I]=-1,C[N+Ee]=I,L=Math.min(L,Ee),C[R+I]=Ee,D[X++]=I);C[A+H]=J,(C[E+H]=X-te)===0&&(x[H]=-1,C[F+H]=0),q!==0&&(S=X)}for(I=0;I<m;I++)x[I]=zo(x[I]);for(V=0;V<=m;V++)C[N+V]=-1;for(V=m;V>=0;V--)C[A+V]>0||(C[_+V]=C[N+x[V]],C[N+x[V]]=V);for(Y=m;Y>=0;Y--)C[A+Y]<=0||x[Y]!==-1&&(C[_+Y]=C[N+x[Y]],C[N+x[Y]]=Y);for(H=0,I=0;I<=m;I++)x[I]===-1&&(H=u3(I,H,C,N,_,w,F));return w.splice(w.length-1,1),w};function i(u,c,d,f,p){var m=n(c);if(u===1&&f===d)return t(c,m);if(u===2){for(var v=m._index,y=m._ptr,b=0,D=0;D<d;D++){var x=y[D];if(y[D]=b,!(y[D+1]-x>p))for(var S=y[D+1];x<S;x++)v[b++]=v[x]}return y[d]=b,c=n(m),r(m,c)}return r(m,c)}function a(u,c,d,f,p,m,v,y,b,D,x,S){for(var w=0;w<u;w++)d[f+w]=c[w+1]-c[w];d[f+u]=0;for(var C=0;C<=u;C++)d[p+C]=-1,m[C]=-1,d[v+C]=-1,d[y+C]=-1,d[b+C]=1,d[D+C]=1,d[x+C]=0,d[S+C]=d[f+C];var E=s(0,0,d,D,u);return d[x+u]=-2,c[u]=-1,d[D+u]=0,E}function o(u,c,d,f,p,m,v,y,b,D,x){for(var S=0,w=0;w<u;w++){var C=d[f+w];if(C===0)d[p+w]=-2,S++,c[w]=-1,d[m+w]=0;else if(C>v)d[y+w]=0,d[p+w]=-1,S++,c[w]=zo(u),d[y+u]++;else{var E=d[b+C];E!==-1&&(D[E]=w),d[x+w]=d[b+C],d[b+C]=w}}return S}function s(u,c,d,f,p){if(u<2||u+c<0){for(var m=0;m<p;m++)d[f+m]!==0&&(d[f+m]=1);u=2}return u}function l(u,c){return u!==c}});function Xoe(e,t,r,n,i,a,o){var s,l,u=0,c;if(e<=t||r[n+t]<=r[i+e])return-1;r[i+e]=r[n+t];var d=r[a+e];if(r[a+e]=t,d===-1)u=1,c=e;else{for(u=2,c=d;c!==r[o+c];c=r[o+c]);for(s=d;s!==c;s=l)l=r[o+s],r[o+s]=c}return{jleaf:u,q:c}}var Zoe="csCounts",Qoe=["transpose"],Joe=Q(Zoe,Qoe,e=>{var{transpose:t}=e;return function(r,n,i,a){if(!r||!n||!i)return null;var o=r._size,s=o[0],l=o[1],u,c,d,f,p,m,v,y=4*l+(a?l+s+1:0),b=[],D=0,x=l,S=2*l,w=3*l,C=4*l,E=5*l+1;for(d=0;d<y;d++)b[d]=-1;var A=[],_=t(r),N=_._index,M=_._ptr;for(d=0;d<l;d++)for(c=i[d],A[c]=b[w+c]===-1?1:0;c!==-1&&b[w+c]===-1;c=n[c])b[w+c]=d;if(a){for(d=0;d<l;d++)b[i[d]]=d;for(u=0;u<s;u++){for(d=l,m=M[u],v=M[u+1],p=m;p<v;p++)d=Math.min(d,b[N[p]]);b[E+u]=b[C+d],b[C+d]=u}}for(u=0;u<l;u++)b[D+u]=u;for(d=0;d<l;d++){for(c=i[d],n[c]!==-1&&A[n[c]]--,f=a?b[C+d]:c;f!==-1;f=a?b[E+f]:-1)for(p=M[f];p<M[f+1];p++){u=N[p];var R=Xoe(u,c,b,w,x,S,D);R.jleaf>=1&&A[c]++,R.jleaf===2&&A[R.q]--}n[c]!==-1&&(b[D+c]=n[c])}for(c=0;c<l;c++)n[c]!==-1&&(A[n[c]]+=A[c]);return A}}),ese="csSqr",tse=["add","multiply","transpose"],rse=Q(ese,tse,e=>{var{add:t,multiply:r,transpose:n}=e,i=Yoe({add:t,multiply:r,transpose:n}),a=Joe({transpose:n});return function(l,u,c){var d=u._ptr,f=u._size,p=f[1],m,v={};if(v.q=i(l,u),l&&!v.q)return null;if(c){var y=l?Goe(u,null,v.q,0):u;v.parent=Woe(y,1);var b=Uoe(v.parent,p);if(v.cp=a(y,v.parent,b,1),y&&v.parent&&v.cp&&o(y,v))for(v.unz=0,m=0;m<p;m++)v.unz+=v.cp[m]}else v.unz=4*d[p]+p,v.lnz=v.unz;return v};function o(s,l){var u=s._ptr,c=s._index,d=s._size,f=d[0],p=d[1];l.pinv=[],l.leftmost=[];var m=l.parent,v=l.pinv,y=l.leftmost,b=[],D=0,x=f,S=f+p,w=f+2*p,C,E,A,_,N;for(E=0;E<p;E++)b[x+E]=-1,b[S+E]=-1,b[w+E]=0;for(C=0;C<f;C++)y[C]=-1;for(E=p-1;E>=0;E--)for(_=u[E],N=u[E+1],A=_;A<N;A++)y[c[A]]=E;for(C=f-1;C>=0;C--)v[C]=-1,E=y[C],E!==-1&&(b[w+E]++===0&&(b[S+E]=C),b[D+C]=b[x+E],b[x+E]=C);for(l.lnz=0,l.m2=f,E=0;E<p;E++)if(C=b[x+E],l.lnz++,C<0&&(C=l.m2++),v[C]=E,!(--w[E]<=0)){l.lnz+=b[w+E];var M=m[E];M!==-1&&(b[w+M]===0&&(b[S+M]=b[S+E]),b[D+b[S+E]]=b[x+M],b[x+M]=b[D+C],b[w+M]+=b[w+E])}for(C=0;C<f;C++)v[C]<0&&(v[C]=E++);return!0}});function Nw(e,t){return e[t]<0}function c3(e,t){e[t]=zo(e[t])}function d3(e){return e<0?zo(e):e}function nse(e,t,r,n,i){var a=t._index,o=t._ptr,s=t._size,l=s[1],u,c,d,f=0;for(n[0]=e;f>=0;){e=n[f];var p=i?i[e]:e;Nw(o,e)||(c3(o,e),n[l+f]=p<0?0:d3(o[p]));var m=1;for(c=n[l+f],d=p<0?0:d3(o[p+1]);c<d;c++)if(u=a[c],!Nw(o,u)){n[l+f]=c,n[++f]=u,m=0;break}m&&(f--,n[--r]=e)}return r}function ise(e,t,r,n,i){var a=e._ptr,o=e._size,s=t._index,l=t._ptr,u=o[1],c,d,f,p=u;for(d=l[r],f=l[r+1],c=d;c<f;c++){var m=s[c];Nw(a,m)||(p=nse(m,e,p,n,i))}for(c=p;c<u;c++)c3(a,n[c]);return p}var ase="csSpsolve",ose=["divideScalar","multiply","subtract"],sse=Q(ase,ose,e=>{var{divideScalar:t,multiply:r,subtract:n}=e;return function(a,o,s,l,u,c,d){var f=a._values,p=a._index,m=a._ptr,v=a._size,y=v[1],b=o._values,D=o._index,x=o._ptr,S,w,C,E,A=ise(a,o,s,l,c);for(S=A;S<y;S++)u[l[S]]=0;for(w=x[s],C=x[s+1],S=w;S<C;S++)u[D[S]]=b[S];for(var _=A;_<y;_++){var N=l[_],M=c?c[N]:N;if(!(M<0))for(w=m[M],C=m[M+1],u[N]=t(u[N],f[d?w:C-1]),S=d?w+1:w,E=d?C:C-1;S<E;S++){var R=p[S];u[R]=n(u[R],r(f[S],u[N]))}}return A}}),lse="csLu",use=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],cse=Q(lse,use,e=>{var{abs:t,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,l=sse({divideScalar:r,multiply:n,subtract:i});return function(c,d,f){if(!c)return null;var p=c._size,m=p[1],v,y=100,b=100;d&&(v=d.q,y=d.lnz||y,b=d.unz||b);var D=[],x=[],S=[],w=new s({values:D,index:x,ptr:S,size:[m,m]}),C=[],E=[],A=[],_=new s({values:C,index:E,ptr:A,size:[m,m]}),N=[],M,R,F=[],k=[];for(M=0;M<m;M++)F[M]=0,N[M]=-1,S[M+1]=0;y=0,b=0;for(var P=0;P<m;P++){S[P]=y,A[P]=b;var T=v?v[P]:P,O=l(w,c,T,k,F,N,1),L=-1,I=-1;for(R=O;R<m;R++)if(M=k[R],N[M]<0){var V=t(F[M]);a(V,I)&&(I=V,L=M)}else E[b]=N[M],C[b++]=F[M];if(L===-1||I<=0)return null;N[T]<0&&o(t(F[T]),n(I,f))&&(L=T);var H=F[L];for(E[b]=P,C[b++]=H,N[L]=P,x[y]=L,D[y++]=1,R=O;R<m;R++)M=k[R],N[M]<0&&(x[y]=M,D[y++]=r(F[M],H)),F[M]=0}for(S[m]=y,A[m]=b,R=0;R<y;R++)x[R]=N[x[R]];return D.splice(y,D.length-y),x.splice(y,x.length-y),C.splice(b,C.length-b),E.splice(b,E.length-b),{L:w,U:_,pinv:N}}}),f3="slu",dse=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],Xv=Q(f3,dse,e=>{var{typed:t,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:l,largerEq:u,SparseMatrix:c}=e,d=rse({add:n,multiply:i,transpose:a}),f=cse({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return t(f3,{"SparseMatrix, number, number":function(m,v,y){if(!ot(v)||v<0||v>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(y<0||y>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var b=d(v,m,!1),D=f(m,b,y);return{L:D.L,U:D.U,p:D.pinv,q:b.q,toString:function(){return"L: "+this.L.toString()+`
128
128
  U: `+this.U.toString()+`
129
129
  p: `+this.p.toString()+(this.q?`
130
130
  q: `+this.q.toString():"")+`
131
- `}}}})});function pI(e,t){var r,n=t.length,i=[];if(e)for(r=0;r<n;r++)i[e[r]]=t[r];else for(r=0;r<n;r++)i[r]=t[r];return i}var hI="lusolve",fse=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],Zv=Q(hI,fse,e=>{var{typed:t,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(hI,{"Array, Array | Matrix":function(f,p){f=r(f);var m=n(f),v=c(m.L,m.U,m.p,null,p);return v.valueOf()},"DenseMatrix, Array | Matrix":function(f,p){var m=n(f);return c(m.L,m.U,m.p,null,p)},"SparseMatrix, Array | Matrix":function(f,p){var m=n(f);return c(m.L,m.U,m.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(f,p,m,v){var y=i(f,m,v);return c(y.L,y.U,y.p,y.q,p)},"Object, Array | Matrix":function(f,p){return c(f.L,f.U,f.p,f.q,p)}});function u(d){if(ft(d))return d;if(or(d))return r(d);throw new TypeError("Invalid Matrix LU decomposition")}function c(d,f,p,m,v){d=u(d),f=u(f),p&&(v=l(d,v,!0),v._data=pI(p,v._data));var y=o(d,v),b=a(f,y);return m&&(b._data=pI(m,b._data)),b}}),mI="polynomialRoot",pse=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],Qv=Q(mI,pse,e=>{var{typed:t,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:d,im:f,re:p}=e;return t(mI,{"number|Complex, ...number|Complex":(m,v)=>{for(var y=[m,...v];y.length>0&&r(y[y.length-1]);)y.pop();if(y.length<2)throw new RangeError("Polynomial [".concat(m,", ").concat(v,"] must have a non-zero non-constant coefficient"));switch(y.length){case 2:return[u(s(y[0],y[1]))];case 3:{var[b,D,x]=y,S=o(2,x),w=o(D,D),C=o(4,x,b);if(n(w,C))return[s(u(D),S)];var E=l(a(w,C));return[s(a(E,D),S),s(a(u(E),D),S)]}case 4:{var[A,_,N,M]=y,R=u(o(3,M)),F=o(N,N),k=o(3,M,_),P=i(o(2,N,N,N),o(27,M,M,A)),T=o(9,M,N,_);if(n(F,k)&&n(P,T))return[s(N,R)];var O=a(F,k),L=a(P,T),I=i(o(18,M,N,_,A),o(N,N,_,_)),V=i(o(4,N,N,N,A),o(4,M,_,_,_),o(27,M,M,A,A));if(n(I,V))return[s(a(o(4,M,N,_),i(o(9,M,M,A),o(N,N,N))),o(M,O)),s(a(o(9,M,A),o(N,_)),o(2,O))];var H;n(F,k)?H=L:H=s(i(L,l(a(o(L,L),o(4,O,O,O)))),2);var Z=!0,G=c(H,Z).toArray().map(Y=>s(i(N,Y,s(O,Y)),R));return G.map(Y=>d(Y)==="Complex"&&n(p(Y),p(Y)+f(Y))?p(Y):Y)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(y))}}})}),hse="Help",mse=["parse"],Jv=Q(hse,mse,e=>{var{parse:t}=e;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=`
131
+ `}}}})});function p3(e,t){var r,n=t.length,i=[];if(e)for(r=0;r<n;r++)i[e[r]]=t[r];else for(r=0;r<n;r++)i[r]=t[r];return i}var h3="lusolve",fse=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],Zv=Q(h3,fse,e=>{var{typed:t,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,l=sc({DenseMatrix:s});return t(h3,{"Array, Array | Matrix":function(f,p){f=r(f);var m=n(f),v=c(m.L,m.U,m.p,null,p);return v.valueOf()},"DenseMatrix, Array | Matrix":function(f,p){var m=n(f);return c(m.L,m.U,m.p,null,p)},"SparseMatrix, Array | Matrix":function(f,p){var m=n(f);return c(m.L,m.U,m.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(f,p,m,v){var y=i(f,m,v);return c(y.L,y.U,y.p,y.q,p)},"Object, Array | Matrix":function(f,p){return c(f.L,f.U,f.p,f.q,p)}});function u(d){if(ft(d))return d;if(or(d))return r(d);throw new TypeError("Invalid Matrix LU decomposition")}function c(d,f,p,m,v){d=u(d),f=u(f),p&&(v=l(d,v,!0),v._data=p3(p,v._data));var y=o(d,v),b=a(f,y);return m&&(b._data=p3(m,b._data)),b}}),m3="polynomialRoot",pse=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],Qv=Q(m3,pse,e=>{var{typed:t,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:d,im:f,re:p}=e;return t(m3,{"number|Complex, ...number|Complex":(m,v)=>{for(var y=[m,...v];y.length>0&&r(y[y.length-1]);)y.pop();if(y.length<2)throw new RangeError("Polynomial [".concat(m,", ").concat(v,"] must have a non-zero non-constant coefficient"));switch(y.length){case 2:return[u(s(y[0],y[1]))];case 3:{var[b,D,x]=y,S=o(2,x),w=o(D,D),C=o(4,x,b);if(n(w,C))return[s(u(D),S)];var E=l(a(w,C));return[s(a(E,D),S),s(a(u(E),D),S)]}case 4:{var[A,_,N,M]=y,R=u(o(3,M)),F=o(N,N),k=o(3,M,_),P=i(o(2,N,N,N),o(27,M,M,A)),T=o(9,M,N,_);if(n(F,k)&&n(P,T))return[s(N,R)];var O=a(F,k),L=a(P,T),I=i(o(18,M,N,_,A),o(N,N,_,_)),V=i(o(4,N,N,N,A),o(4,M,_,_,_),o(27,M,M,A,A));if(n(I,V))return[s(a(o(4,M,N,_),i(o(9,M,M,A),o(N,N,N))),o(M,O)),s(a(o(9,M,A),o(N,_)),o(2,O))];var H;n(F,k)?H=L:H=s(i(L,l(a(o(L,L),o(4,O,O,O)))),2);var Z=!0,G=c(H,Z).toArray().map(Y=>s(i(N,Y,s(O,Y)),R));return G.map(Y=>d(Y)==="Complex"&&n(p(Y),p(Y)+f(Y))?p(Y):Y)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(y))}}})}),hse="Help",mse=["parse"],Jv=Q(hse,mse,e=>{var{parse:t}=e;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=`
132
132
  `;if(n.name&&(i+="Name: "+n.name+`
133
133
 
134
134
  `),n.category&&(i+="Category: "+n.category+`
@@ -147,9 +147,9 @@ q: `+this.q.toString():"")+`
147
147
  `}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+`
148
148
 
149
149
  `),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+`
150
- `),i},r.prototype.toJSON=function(){var n=pt(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0}),vse="Chain",gse=["?on","math","typed"],eg=Q(vse,gse,e=>{var{on:t,math:r,typed:n}=e;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");mf(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Pt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){vf(i.prototype,u,function(){var f=c();if(typeof f=="function")return s(f)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],d=0;d<arguments.length;d++)c[d+1]=arguments[d];if(n.isTypedFunction(u)){var f=n.resolve(u,c);if(f.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(f.implementation.apply(u,c))}return new i(u.apply(u,c))}}i.createProxy=function(u,c){if(typeof u=="string")a(u,c);else{var d=function(m){et(u,m)&&l[m]===void 0&&o(m,()=>u[m])};for(var f in u)d(f)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),t&&t("import",function(u,c,d){d||o(u,c)}),i},{isClass:!0}),vI={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"]},yse={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},bse={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:[]},xse={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:[]},wse={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},Cse={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},Sse={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:[]},Dse={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:[]},Ese={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},Nse={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},Ase={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:[]},gI={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"]},_se={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:[]},Mse={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},Tse={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"]},Ose={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},Rse={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},Ise={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},kse={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"]},Pse={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"]},Fse={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"]},$se={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"]},Bse={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},zse={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"]},Lse={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},Vse={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"]},qse={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"]},Gse={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"]},Use={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"]},Wse={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:[]},Hse={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:[]},jse={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x })',"double(2)",'double("hello")'],seealso:[]},Kse={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"]},Yse={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"]},Xse={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"]},Zse={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"]},Qse={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"]},Jse={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"]},ele={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"]},tle={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"]},rle={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"]},nle={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"]},ile={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"]},ale={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConatant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},ole={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"]},sle={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"]},lle={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"]},ule={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"]},cle={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"]},dle={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},fle={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"]},ple={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"]},hle={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},mle={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"]},vle={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"]},gle={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"]},yle={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"]},ble={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"]},xle={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"]},wle={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"]},Cle={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"]},Sle={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},Dle={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},Ele={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"]},Nle={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},Ale={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \u2263 1 (mod b)",examples:["invmod(8, 12)=NaN","invmod(7, 13)=2","invmod(15151, 15122)=10429"],seealso:["gcd","xgcd"]},_le={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"]},Mle={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"]},Tle={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"]},Ole={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"]},Rle={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"]},Ile={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"]},kle={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"]},Ple={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")']},Fle={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"]},$le={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"]},Ble={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"]},zle={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]},Lle={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},Vle={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"]},qle={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"]},Gle={name:"sylvester",category:"Matrix",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","sylvester(A,B,C)"],seealso:["schur","lyap"]},Ule={name:"schur",category:"Matrix",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","schur(A)"],seealso:["lyap","sylvester"]},Wle={name:"lyap",category:"Matrix",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","lyap(A,Q)"],seealso:["schur","sylvester"]},Hle={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"]},jle={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"]},Kle={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"]},Yle={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},Xle={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"]},Zle={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"]},Qle={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"]},Jle={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"]},eue={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"]},tue={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"]},rue={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"]},nue={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"]},iue={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"]},aue={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"]},oue={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"]},sue={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},lue={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"]},uue={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"]},cue={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"]},due={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"]},fue={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(" + 4 + ")")'],seealso:[]},pue={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},hue={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:[]},mue={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:[]},vue={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"]},gue={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"]},yue={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"]},bue={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"]},xue={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"]},wue={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"]},Cue={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"]},Sue={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"]},Due={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"]},Eue={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"]},Nue={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"]},Aue={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["diff([1, 2, 4, 7, 0])","diff([1, 2, 4, 7, 0], 0)","diff(matrix([1, 2, 4, 7, 0]))","diff([[1, 2], [3, 4]])","diff([[1, 2], [3, 4]], 0)","diff([[1, 2], [3, 4]], 1)","diff([[1, 2], [3, 4]], bignumber(1))","diff(matrix([[1, 2], [3, 4]]), 1)","diff([[1, 2], matrix([3, 4])], 1)"],seealso:["subtract","partitionSelect"]},_ue={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"]},Mue={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],seealso:["inv"]},Tue={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"]},Oue={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"]},Rue={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"]},Iue={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"]},kue={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"]},Pue={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"]},Fue={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},$ue={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"]},Bue={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},zue={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"]},Lue={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"]},Vue={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"]},que={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"]},Gue={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"]},Uue={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},Wue={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"]},Hue={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"]},jue={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"]},Kue={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"]},Yue={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"]},Xue={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"]},Zue={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"]},Que={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"]},Jue={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"]},ece={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"]},tce={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"]},rce={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"]},nce={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ice={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},ace={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"]},oce={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"]},sce={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"]},lce={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"]},uce={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"]},cce={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:[]},dce={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"]},fce={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"]},pce={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"]},hce={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"]},mce={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"]},vce={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"]},gce={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"]},yce={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"]},bce={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"]},xce={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"]},wce={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"]},Cce={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},Sce={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"]},Dce={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},Ece={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"]},Nce={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"]},Ace={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"]},_ce={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"]},Mce={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"]},Tce={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"]},Oce={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"]},Rce={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"]},Ice={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"]},kce={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"]},Pce={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"]},Fce={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"]},$ce={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:[]},Bce={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"]},zce={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},Lce={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"]},Vce={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"]},qce={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},Gce={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"]},Uce={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"]},Wce={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber.
150
+ `),i},r.prototype.toJSON=function(){var n=pt(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0}),vse="Chain",gse=["?on","math","typed"],eg=Q(vse,gse,e=>{var{on:t,math:r,typed:n}=e;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");mf(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Pt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){vf(i.prototype,u,function(){var f=c();if(typeof f=="function")return s(f)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],d=0;d<arguments.length;d++)c[d+1]=arguments[d];if(n.isTypedFunction(u)){var f=n.resolve(u,c);if(f.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(f.implementation.apply(u,c))}return new i(u.apply(u,c))}}i.createProxy=function(u,c){if(typeof u=="string")a(u,c);else{var d=function(m){et(u,m)&&l[m]===void 0&&o(m,()=>u[m])};for(var f in u)d(f)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),t&&t("import",function(u,c,d){d||o(u,c)}),i},{isClass:!0}),v3={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"]},yse={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},bse={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:[]},xse={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:[]},wse={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},Cse={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},Sse={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:[]},Dse={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:[]},Ese={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},Nse={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},Ase={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:[]},g3={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"]},_se={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:[]},Mse={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},Tse={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"]},Ose={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},Rse={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},Ise={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},kse={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"]},Pse={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"]},Fse={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"]},$se={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"]},Bse={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},zse={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"]},Lse={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},Vse={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"]},qse={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"]},Gse={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"]},Use={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"]},Wse={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:[]},Hse={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:[]},jse={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x })',"double(2)",'double("hello")'],seealso:[]},Kse={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"]},Yse={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"]},Xse={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"]},Zse={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"]},Qse={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"]},Jse={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"]},ele={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"]},tle={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"]},rle={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"]},nle={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"]},ile={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"]},ale={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConatant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},ole={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"]},sle={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"]},lle={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"]},ule={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"]},cle={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"]},dle={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},fle={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"]},ple={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"]},hle={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},mle={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"]},vle={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"]},gle={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"]},yle={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"]},ble={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"]},xle={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"]},wle={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"]},Cle={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"]},Sle={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},Dle={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},Ele={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"]},Nle={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},Ale={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \u2263 1 (mod b)",examples:["invmod(8, 12)=NaN","invmod(7, 13)=2","invmod(15151, 15122)=10429"],seealso:["gcd","xgcd"]},_le={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"]},Mle={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"]},Tle={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"]},Ole={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"]},Rle={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"]},Ile={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"]},kle={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"]},Ple={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")']},Fle={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"]},$le={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"]},Ble={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"]},zle={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]},Lle={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},Vle={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"]},qle={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"]},Gle={name:"sylvester",category:"Matrix",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","sylvester(A,B,C)"],seealso:["schur","lyap"]},Ule={name:"schur",category:"Matrix",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","schur(A)"],seealso:["lyap","sylvester"]},Wle={name:"lyap",category:"Matrix",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","lyap(A,Q)"],seealso:["schur","sylvester"]},Hle={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"]},jle={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"]},Kle={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"]},Yle={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},Xle={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"]},Zle={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"]},Qle={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"]},Jle={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"]},eue={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"]},tue={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"]},rue={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"]},nue={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"]},iue={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"]},aue={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"]},oue={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"]},sue={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},lue={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"]},uue={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"]},cue={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"]},due={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"]},fue={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(" + 4 + ")")'],seealso:[]},pue={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},hue={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:[]},mue={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:[]},vue={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"]},gue={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"]},yue={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"]},bue={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"]},xue={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"]},wue={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"]},Cue={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"]},Sue={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"]},Due={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"]},Eue={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"]},Nue={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"]},Aue={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["diff([1, 2, 4, 7, 0])","diff([1, 2, 4, 7, 0], 0)","diff(matrix([1, 2, 4, 7, 0]))","diff([[1, 2], [3, 4]])","diff([[1, 2], [3, 4]], 0)","diff([[1, 2], [3, 4]], 1)","diff([[1, 2], [3, 4]], bignumber(1))","diff(matrix([[1, 2], [3, 4]]), 1)","diff([[1, 2], matrix([3, 4])], 1)"],seealso:["subtract","partitionSelect"]},_ue={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"]},Mue={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],seealso:["inv"]},Tue={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"]},Oue={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"]},Rue={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"]},Iue={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"]},kue={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"]},Pue={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"]},Fue={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},$ue={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"]},Bue={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},zue={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"]},Lue={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"]},Vue={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"]},que={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"]},Gue={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"]},Uue={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},Wue={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"]},Hue={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"]},jue={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"]},Kue={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"]},Yue={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"]},Xue={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"]},Zue={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"]},Que={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"]},Jue={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"]},ece={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"]},tce={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"]},rce={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"]},nce={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ice={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},ace={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"]},oce={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"]},sce={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"]},lce={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"]},uce={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"]},cce={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:[]},dce={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"]},fce={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"]},pce={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"]},hce={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"]},mce={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"]},vce={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"]},gce={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"]},yce={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"]},bce={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"]},xce={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"]},wce={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"]},Cce={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},Sce={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"]},Dce={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},Ece={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"]},Nce={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"]},Ace={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"]},_ce={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"]},Mce={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"]},Tce={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"]},Oce={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"]},Rce={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"]},Ice={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"]},kce={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"]},Pce={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"]},Fce={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"]},$ce={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:[]},Bce={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"]},zce={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},Lce={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"]},Vce={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"]},qce={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},Gce={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"]},Uce={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"]},Wce={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber.
151
151
 
152
- 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"]},Hce={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"]},jce={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"]},Kce={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},Yce={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"]},Xce={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"]},Zce={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"]},Qce={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"]},Jce={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},ede={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"]},tde={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},rde={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"]},nde={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},ide={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"]},ade={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"]},ode={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"]},sde={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"]},lde={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"]},ude={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"]},cde={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},dde={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"]},fde={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"]},pde={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"]},hde={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"]},mde={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"]},vde={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"]},gde={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"]},yde={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},bde={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"]},xde={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"]},wde={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:[]},Cde={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},Sde={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:[]},Dde={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"]},Ede={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"]},Nde={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},Ade={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"]},_de={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"]},Mde={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"]},Tde={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"]},Ode={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"]},Rde={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"]},Ide={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"]},kde={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction)','numeric(4, "Fraction")','numeric(fraction(2, 5), "number)'],seealso:["number","fraction","bignumber","string","format"]},Pde={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},Fde={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $0, $1, $2", [6, 9, 4])'],seealso:["format"]},$de={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"]},yI={bignumber:Ise,boolean:kse,complex:Pse,createUnit:Fse,fraction:$se,index:Bse,matrix:zse,number:Lse,sparse:Vse,splitUnit:qse,string:Gse,unit:Use,e:vI,E:vI,false:yse,i:bse,Infinity:xse,LN2:Cse,LN10:wse,LOG2E:Dse,LOG10E:Sse,NaN:Ese,null:Nse,pi:gI,PI:gI,phi:Ase,SQRT1_2:_se,SQRT2:Mse,tau:Tse,true:Ose,version:Rse,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:Kse,lsolve:Xse,lsolveAll:Zse,lup:Qse,lusolve:Jse,leafCount:Yse,polynomialRoot:ele,resolve:nle,simplify:ile,simplifyConstant:ale,simplifyCore:ole,symbolicEqual:lle,rationalize:rle,slu:sle,usolve:ule,usolveAll:cle,qr:tle,abs:dle,add:fle,cbrt:ple,ceil:hle,cube:mle,divide:vle,dotDivide:gle,dotMultiply:yle,dotPow:ble,exp:xle,expm:wle,expm1:Cle,fix:Sle,floor:Dle,gcd:Ele,hypot:Nle,lcm:_le,log:Mle,log2:Rle,log1p:Ole,log10:Tle,mod:Ile,multiply:kle,norm:Ple,nthRoot:Fle,nthRoots:$le,pow:Ble,round:zle,sign:Lle,sqrt:Vle,sqrtm:qle,square:Hle,subtract:jle,unaryMinus:Kle,unaryPlus:Yle,xgcd:Xle,invmod:Ale,bitAnd:Zle,bitNot:Qle,bitOr:Jle,bitXor:eue,leftShift:tue,rightArithShift:rue,rightLogShift:nue,bellNumbers:iue,catalan:aue,composition:oue,stirlingS2:sue,config:Wse,import:Hse,typed:jse,arg:lue,conj:uue,re:due,im:cue,evaluate:fue,help:pue,distance:hue,intersect:mue,and:vue,not:gue,or:yue,xor:bue,concat:wue,count:Cue,cross:Sue,column:xue,ctranspose:Due,det:Eue,diag:Nue,diff:Aue,dot:_ue,getMatrixDataType:Iue,identity:kue,filter:Tue,flatten:Oue,forEach:Rue,inv:Pue,pinv:Fue,eigs:Mue,kron:$ue,matrixFromFunction:Lue,matrixFromRows:Vue,matrixFromColumns:zue,map:Bue,ones:que,partitionSelect:Gue,range:Uue,resize:Hue,reshape:Wue,rotate:jue,rotationMatrix:Kue,row:Yue,size:Xue,sort:Zue,squeeze:Que,subset:Jue,trace:ece,transpose:tce,zeros:rce,fft:nce,ifft:ice,sylvester:Gle,schur:Ule,lyap:Wle,combinations:ace,combinationsWithRep:oce,factorial:sce,gamma:lce,kldivergence:cce,lgamma:uce,multinomial:dce,permutations:fce,pickRandom:pce,random:hce,randomInt:mce,compare:vce,compareNatural:gce,compareText:yce,deepEqual:bce,equal:xce,equalText:wce,larger:Cce,largerEq:Sce,smaller:Dce,smallerEq:Ece,unequal:Nce,setCartesian:Ace,setDifference:_ce,setDistinct:Mce,setIntersect:Tce,setIsSubset:Oce,setMultiplicity:Rce,setPowerset:Ice,setSize:kce,setSymDifference:Pce,setUnion:Fce,erf:$ce,cumsum:jce,mad:Bce,max:zce,mean:Lce,median:Vce,min:qce,mode:Gce,prod:Uce,quantileSeq:Wce,std:Hce,sum:Kce,variance:Yce,acos:Xce,acosh:Zce,acot:Qce,acoth:Jce,acsc:ede,acsch:tde,asec:rde,asech:nde,asin:ide,asinh:ade,atan:ode,atanh:lde,atan2:sde,cos:ude,cosh:cde,cot:dde,coth:fde,csc:pde,csch:hde,sec:mde,sech:vde,sin:gde,sinh:yde,tan:bde,tanh:xde,to:wde,clone:Sde,format:Dde,bin:Cde,oct:Pde,hex:Nde,isNaN:_de,isInteger:Ade,isNegative:Mde,isNumeric:Tde,hasNumericValue:Ede,isPositive:Ode,isPrime:Rde,isZero:Ide,print:Fde,typeOf:$de,numeric:kde},bI="help",Bde=["typed","mathWithTransform","Help"],tg=Q(bI,Bde,e=>{var{typed:t,mathWithTransform:r,Help:n}=e;return t(bI,{any:function(a){var o,s=a;if(typeof a!="string"){for(o in r)if(et(r,o)&&a===r[o]){s=o;break}}var l=Si(yI,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})}),xI="chain",zde=["typed","Chain"],rg=Q(xI,zde,e=>{var{typed:t,Chain:r}=e;return t(xI,{"":function(){return new r},any:function(i){return new r(i)}})}),wI="det",Lde=["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],ng=Q(wI,Lde,e=>{var{typed:t,matrix:r,subtract:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(wI,{any:function(c){return pt(c)},"Array | Matrix":function(c){var d;switch(ft(c)?d=c.size():Array.isArray(c)?(c=r(c),d=c.size()):d=[],d.length){case 0:return pt(c);case 1:if(d[0]===1)return pt(c.valueOf()[0]);if(d[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Pt(d)+")");case 2:{var f=d[0],p=d[1];if(f===p)return l(c.clone().valueOf(),f);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+Pt(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(d)+")")}}});function l(u,c,d){if(c===1)return pt(u[0][0]);if(c===2)return n(i(u[0][0],u[1][1]),i(u[1][0],u[0][1]));for(var f=!1,p=new Array(c).fill(0).map((E,A)=>A),m=0;m<c;m++){var v=p[m];if(o(u[v][m])){var y=void 0;for(y=m+1;y<c;y++)if(!o(u[p[y]][m])){v=p[y],p[y]=p[m],p[m]=v,f=!f;break}if(y===c)return u[v][m]}for(var b=u[v][m],D=m===0?1:u[p[m-1]][m-1],x=m+1;x<c;x++)for(var S=p[x],w=m+1;w<c;w++)u[S][w]=a(n(i(u[S][w],b),i(u[S][m],u[v][w])),D)}var C=u[p[c-1]][c-1];return f?s(C):C}}),CI="inv",Vde=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],ig=Q(CI,Vde,e=>{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:l,abs:u}=e;return t(CI,{"Array | Matrix":function(f){var p=ft(f)?f.size():qt(f);switch(p.length){case 1:if(p[0]===1)return ft(f)?r([n(1,f.valueOf()[0])]):[n(1,f[0])];throw new RangeError("Matrix must be square (size: "+Pt(p)+")");case 2:{var m=p[0],v=p[1];if(m===v)return ft(f)?r(c(f.valueOf(),m,v),f.storage()):c(f,m,v);throw new RangeError("Matrix must be square (size: "+Pt(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(p)+")")}},any:function(f){return n(1,f)}});function c(d,f,p){var m,v,y,b,D;if(f===1){if(b=d[0][0],b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,b)]]}else if(f===2){var x=s(d);if(x===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(d[1][1],x),n(o(d[0][1]),x)],[n(o(d[1][0]),x),n(d[0][0],x)]]}else{var S=d.concat();for(m=0;m<f;m++)S[m]=S[m].concat();for(var w=l(f).valueOf(),C=0;C<p;C++){var E=u(S[C][C]),A=C;for(m=C+1;m<f;)u(S[m][C])>E&&(E=u(S[m][C]),A=m),m++;if(E===0)throw Error("Cannot calculate inverse, determinant is zero");m=A,m!==C&&(D=S[C],S[C]=S[m],S[m]=D,D=w[C],w[C]=w[m],w[m]=D);var _=S[C],N=w[C];for(m=0;m<f;m++){var M=S[m],R=w[m];if(m!==C){if(M[C]!==0){for(y=n(o(M[C]),_[C]),v=C;v<p;v++)M[v]=i(M[v],a(y,_[v]));for(v=0;v<p;v++)R[v]=i(R[v],a(y,N[v]))}}else{for(y=_[C],v=C;v<p;v++)M[v]=n(M[v],y);for(v=0;v<p;v++)R[v]=n(R[v],y)}}}return w}}}),SI="pinv",qde=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],ag=Q(SI,qde,e=>{var{typed:t,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:l,divideScalar:u,multiply:c,add:d,Complex:f}=e;return t(SI,{"Array | Matrix":function(x){var S=ft(x)?x.size():qt(x);switch(S.length){case 1:return b(x)?l(x):S[0]===1?n(x):o(l(x),s(x,x));case 2:{if(b(x))return l(x);var w=S[0],C=S[1];if(w===C)try{return n(x)}catch(E){if(!(E instanceof Error&&E.message.match(/Cannot calculate inverse, determinant is zero/)))throw E}return ft(x)?r(p(x.valueOf(),w,C),x.storage()):p(x,w,C)}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(S)+")")}},any:function(x){return a(x,0)?pt(x):u(1,x)}});function p(D,x,S){var{C:w,F:C}=v(D,x,S),E=c(n(c(l(w),w)),l(w)),A=c(l(C),n(c(C,l(C))));return c(A,E)}function m(D,x,S){for(var w=pt(D),C=0,E=0;E<x;E++){if(S<=C)return w;for(var A=E;y(w[A][C]);)if(A++,x===A&&(A=E,C++,S===C))return w;[w[A],w[E]]=[w[E],w[A]];for(var _=w[E][C],N=0;N<S;N++)w[E][N]=o(w[E][N],_);for(var M=0;M<x;M++)if(M!==E){_=w[M][C];for(var R=0;R<S;R++)w[M][R]=d(w[M][R],c(-1,c(_,w[E][R])))}C++}return w}function v(D,x,S){var w=m(D,x,S),C=D.map((A,_)=>A.filter((N,M)=>M<x&&!y(s(w[M],w[M])))),E=w.filter((A,_)=>!y(s(w[_],w[_])));return{C,F:E}}function y(D){return a(d(D,f(1,1)),d(0,f(1,1)))}function b(D){return i(d(D,f(1,1)),d(c(D,0),f(1,1)))}});function Gde(e){var{addScalar:t,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:l,bignumber:u,diag:c,inv:d,qr:f,usolve:p,usolveAll:m,equal:v,complex:y,larger:b,smaller:D,matrixFromColumns:x,dot:S}=e;function w(V,H,Z,G,Y){Y===void 0&&(Y=!0);var re=C(V,H,Z,G,Y);E(V,H,Z,G,Y,re);var{values:ne,C:pe}=A(V,H,Z,G,Y),he;return Y&&(he=_(V,H,pe,re,ne,Z,G),he=x(...he)),{values:ne,vectors:he}}function C(V,H,Z,G,Y){var re=G==="BigNumber",ne=G==="Complex",pe=re?u(0):0,he=re?u(1):ne?y(1):1,le=re?u(1):1,fe=re?u(10):2,xe=a(fe,fe),ge;Y&&(ge=Array(H).fill(he));for(var ve=!1;!ve;){ve=!0;for(var Ee=0;Ee<H;Ee++){for(var q=pe,J=pe,ce=0;ce<H;ce++)if(Ee!==ce){var X=l(V[Ee][ce]);q=t(q,X),J=t(J,X)}if(!v(q,0)&&!v(J,0)){for(var te=le,ae=q,De=o(J,fe),be=a(J,fe);D(ae,De);)ae=a(ae,xe),te=a(te,fe);for(;b(ae,be);)ae=o(ae,xe),te=o(te,fe);var K=D(o(t(ae,J),te),a(t(q,J),.95));if(K){ve=!1;for(var W=o(1,te),ue=0;ue<H;ue++)Ee!==ue&&(V[Ee][ue]=a(V[Ee][ue],te),V[ue][Ee]=a(V[ue][Ee],W));Y&&(ge[Ee]=a(ge[Ee],te))}}}}return c(ge)}function E(V,H,Z,G,Y,re){var ne=G==="BigNumber",pe=G==="Complex",he=ne?u(0):pe?y(0):0;ne&&(Z=u(Z));for(var le=0;le<H-2;le++){for(var fe=0,xe=he,ge=le+1;ge<H;ge++){var ve=V[ge][le];D(l(xe),l(ve))&&(xe=ve,fe=ge)}if(!D(l(xe),Z)){if(fe!==le+1){var Ee=V[fe];V[fe]=V[le+1],V[le+1]=Ee;for(var q=0;q<H;q++){var J=V[q][fe];V[q][fe]=V[q][le+1],V[q][le+1]=J}if(Y){var ce=re[fe];re[fe]=re[le+1],re[le+1]=ce}}for(var X=le+2;X<H;X++){var te=o(V[X][le],xe);if(te!==0){for(var ae=0;ae<H;ae++)V[X][ae]=r(V[X][ae],a(te,V[le+1][ae]));for(var De=0;De<H;De++)V[De][le+1]=t(V[De][le+1],a(te,V[De][X]));if(Y)for(var be=0;be<H;be++)re[X][be]=r(re[X][be],a(te,re[le+1][be]))}}}}return re}function A(V,H,Z,G,Y){var re=G==="BigNumber",ne=G==="Complex",pe=re?u(1):ne?y(1):1;re&&(Z=u(Z));for(var he=pt(V),le=[],fe=H,xe=[],ge=Y?c(Array(H).fill(pe)):void 0,ve=Y?c(Array(fe).fill(pe)):void 0,Ee=0;Ee<=100;){Ee+=1;for(var q=0,J=0;J<fe;J++)he[J][J]=r(he[J][J],q);var{Q:ce,R:X}=f(he);he=i(X,ce);for(var te=0;te<fe;te++)he[te][te]=t(he[te][te],q);if(Y&&(ve=i(ve,ce)),fe===1||D(l(he[fe-1][fe-2]),Z)){Ee=0,le.push(he[fe-1][fe-1]),Y&&(xe.unshift([[1]]),R(ve,H),ge=i(ge,ve),fe>1&&(ve=c(Array(fe-1).fill(pe)))),fe-=1,he.pop();for(var ae=0;ae<fe;ae++)he[ae].pop()}else if(fe===2||D(l(he[fe-2][fe-3]),Z)){Ee=0;var De=N(he[fe-2][fe-2],he[fe-2][fe-1],he[fe-1][fe-2],he[fe-1][fe-1]);le.push(...De),Y&&(xe.unshift(M(he[fe-2][fe-2],he[fe-2][fe-1],he[fe-1][fe-2],he[fe-1][fe-1],De[0],De[1],Z,G)),R(ve,H),ge=i(ge,ve),fe>2&&(ve=c(Array(fe-2).fill(pe)))),fe-=2,he.pop(),he.pop();for(var be=0;be<fe;be++)he[be].pop(),he[be].pop()}if(fe===0)break}if(le.sort((ue,me)=>+r(l(ue),l(me))),Ee>100){var K=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+le.join(", "));throw K.values=le,K.vectors=[],K}var W=Y?i(ge,F(xe,H)):void 0;return{values:le,C:W}}function _(V,H,Z,G,Y,re,ne){var pe=d(Z),he=i(pe,V,Z),le=ne==="BigNumber",fe=ne==="Complex",xe=le?u(0):fe?y(0):0,ge=le?u(1):fe?y(1):1,ve=[],Ee=[];for(var q of Y){var J=k(ve,q,v);J===-1?(ve.push(q),Ee.push(1)):Ee[J]+=1}for(var ce=[],X=ve.length,te=Array(H).fill(xe),ae=c(Array(H).fill(ge)),De=[],be=function(me){var we=ve[me],_e=r(he,i(we,ae)),Ae=m(_e,te);for(Ae.shift();Ae.length<Ee[me];){var Ce=P(_e,H,Ae,re,ne);if(Ce==null){De.push(we);break}Ae.push(Ce)}var Me=i(d(G),Z);Ae=Ae.map(Te=>i(Me,Te)),ce.push(...Ae.map(Te=>n(Te)))},K=0;K<X;K++)be(K);if(De.length!==0){var W=new Error("Failed to find eigenvectors for the following eigenvalues: "+De.join(", "));throw W.values=Y,W.vectors=ce,W}return ce}function N(V,H,Z,G){var Y=t(V,G),re=r(a(V,G),a(H,Z)),ne=a(Y,.5),pe=a(s(r(a(Y,Y),a(4,re))),.5);return[t(ne,pe),r(ne,pe)]}function M(V,H,Z,G,Y,re,ne,pe){var he=pe==="BigNumber",le=pe==="Complex",fe=he?u(0):le?y(0):0,xe=he?u(1):le?y(1):1;if(D(l(Z),ne))return[[xe,fe],[fe,xe]];if(b(l(r(Y,re)),ne))return[[r(Y,G),r(re,G)],[Z,Z]];var ge=r(V,Y),ve=r(H,Y),Ee=r(Z,Y),q=r(G,Y);return D(l(ve),ne)?[[ge,xe],[Ee,fe]]:[[ve,fe],[q,xe]]}function R(V,H){for(var Z=0;Z<V.length;Z++)V[Z].push(...Array(H-V[Z].length).fill(0));for(var G=V.length;G<H;G++)V.push(Array(H).fill(0)),V[G][G]=1;return V}function F(V,H){for(var Z=[],G=0;G<H;G++)Z[G]=Array(H).fill(0);var Y=0;for(var re of V){for(var ne=re.length,pe=0;pe<ne;pe++)for(var he=0;he<ne;he++)Z[Y+pe][Y+he]=re[pe][he];Y+=ne}return Z}function k(V,H,Z){for(var G=0;G<V.length;G++)if(Z(V[G],H))return G;return-1}function P(V,H,Z,G,Y){for(var re=Y==="BigNumber"?u(1e3):1e3,ne,pe=0;ne=T(H,Z,Y),ne=p(V,ne),!b(L(ne),re);)if(++pe>=5)return null;for(pe=0;;){var he=p(V,ne);if(D(L(O(ne,[he])),G))break;if(++pe>=10)return null;ne=I(he)}return ne}function T(V,H,Z){var G=Z==="BigNumber",Y=Z==="Complex",re=Array(V).fill(0).map(ne=>2*Math.random()-1);return G&&(re=re.map(ne=>u(ne))),Y&&(re=re.map(ne=>y(ne))),re=O(re,H),I(re,Z)}function O(V,H){for(var Z of H)V=r(V,i(o(S(Z,V),S(Z,Z)),Z));return V}function L(V){return l(s(S(V,V)))}function I(V,H){var Z=H==="BigNumber",G=H==="Complex",Y=Z?u(1):G?y(1):1;return i(o(Y,L(V)),V)}return w}function Ude(e){var{config:t,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:l,inv:u,bignumber:c,multiply:d,add:f}=e;function p(N,M){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.epsilon,F=arguments.length>3?arguments[3]:void 0;if(F==="number")return m(N,R);if(F==="BigNumber")return v(N,R);throw TypeError("Unsupported data type: "+F)}function m(N,M){for(var R=N.length,F=Math.abs(M/R),k,P=new Array(R),T=0;T<R;T++)P[T]=_(R,0),P[T][T]=1;for(var O=C(N);Math.abs(O[1])>=Math.abs(F);){var L=O[0][0],I=O[0][1];k=y(N[L][L],N[I][I],N[L][I]),N=w(N,k,L,I),P=D(P,k,L,I),O=C(N)}for(var V=_(R,0),H=0;H<R;H++)V[H]=N[H][H];return A(pt(V),pt(P))}function v(N,M){for(var R=N.length,F=i(M/R),k,P=new Array(R),T=0;T<R;T++)P[T]=_(R,0),P[T][T]=1;for(var O=E(N);i(O[1])>=i(F);){var L=O[0][0],I=O[0][1];k=b(N[L][L],N[I][I],N[L][I]),N=S(N,k,L,I),P=x(P,k,L,I),O=E(N)}for(var V=_(R,0),H=0;H<R;H++)V[H]=N[H][H];return A(pt(V),pt(P))}function y(N,M,R){var F=M-N;return Math.abs(F)<=t.epsilon?Math.PI/4:.5*Math.atan(2*R/(M-N))}function b(N,M,R){var F=n(M,N);return i(F)<=t.epsilon?c(-1).acos().div(4):l(.5,a(d(2,R,u(F))))}function D(N,M,R,F){for(var k=N.length,P=Math.cos(M),T=Math.sin(M),O=_(k,0),L=_(k,0),I=0;I<k;I++)O[I]=P*N[I][R]-T*N[I][F],L[I]=T*N[I][R]+P*N[I][F];for(var V=0;V<k;V++)N[V][R]=O[V],N[V][F]=L[V];return N}function x(N,M,R,F){for(var k=N.length,P=o(M),T=s(M),O=_(k,c(0)),L=_(k,c(0)),I=0;I<k;I++)O[I]=n(l(P,N[I][R]),l(T,N[I][F])),L[I]=r(l(T,N[I][R]),l(P,N[I][F]));for(var V=0;V<k;V++)N[V][R]=O[V],N[V][F]=L[V];return N}function S(N,M,R,F){for(var k=N.length,P=c(o(M)),T=c(s(M)),O=l(P,P),L=l(T,T),I=_(k,c(0)),V=_(k,c(0)),H=d(c(2),P,T,N[R][F]),Z=r(n(l(O,N[R][R]),H),l(L,N[F][F])),G=f(l(L,N[R][R]),H,l(O,N[F][F])),Y=0;Y<k;Y++)I[Y]=n(l(P,N[R][Y]),l(T,N[F][Y])),V[Y]=r(l(T,N[R][Y]),l(P,N[F][Y]));N[R][R]=Z,N[F][F]=G,N[R][F]=c(0),N[F][R]=c(0);for(var re=0;re<k;re++)re!==R&&re!==F&&(N[R][re]=I[re],N[re][R]=I[re],N[F][re]=V[re],N[re][F]=V[re]);return N}function w(N,M,R,F){for(var k=N.length,P=Math.cos(M),T=Math.sin(M),O=P*P,L=T*T,I=_(k,0),V=_(k,0),H=O*N[R][R]-2*P*T*N[R][F]+L*N[F][F],Z=L*N[R][R]+2*P*T*N[R][F]+O*N[F][F],G=0;G<k;G++)I[G]=P*N[R][G]-T*N[F][G],V[G]=T*N[R][G]+P*N[F][G];N[R][R]=H,N[F][F]=Z,N[R][F]=0,N[F][R]=0;for(var Y=0;Y<k;Y++)Y!==R&&Y!==F&&(N[R][Y]=I[Y],N[Y][R]=I[Y],N[F][Y]=V[Y],N[Y][F]=V[Y]);return N}function C(N){for(var M=N.length,R=0,F=[0,1],k=0;k<M;k++)for(var P=k+1;P<M;P++)Math.abs(R)<Math.abs(N[k][P])&&(R=Math.abs(N[k][P]),F=[k,P]);return[F,R]}function E(N){for(var M=N.length,R=0,F=[0,1],k=0;k<M;k++)for(var P=k+1;P<M;P++)i(R)<i(N[k][P])&&(R=i(N[k][P]),F=[k,P]);return[F,R]}function A(N,M){for(var R=N.length,F=Array(R),k=Array(R),P=0;P<R;P++)k[P]=Array(R);for(var T=0;T<R;T++){for(var O=0,L=N[0],I=0;I<N.length;I++)i(N[I])<i(L)&&(O=I,L=N[O]);F[T]=N.splice(O,1)[0];for(var V=0;V<R;V++)k[V][T]=M[V][O],M[V].splice(O,1)}return{values:F,vectors:k}}function _(N,M){for(var R=new Array(N),F=0;F<N;F++)R[F]=M;return R}return p}var Wde="eigs",Hde=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],og=Q(Wde,Hde,e=>{var{config:t,typed:r,matrix:n,addScalar:i,subtract:a,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:d,divideScalar:f,inv:p,bignumber:m,multiply:v,add:y,larger:b,column:D,flatten:x,number:S,complex:w,sqrt:C,diag:E,qr:A,usolve:_,usolveAll:N,im:M,re:R,smaller:F,matrixFromColumns:k,dot:P}=e,T=Ude({config:t,addScalar:i,subtract:a,column:D,flatten:x,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:d,inv:p,bignumber:m,complex:w,multiply:v,add:y}),O=Gde({config:t,addScalar:i,subtract:a,multiply:v,multiplyScalar:d,flatten:x,divideScalar:f,sqrt:C,abs:s,bignumber:m,diag:E,qr:A,inv:p,usolve:_,usolveAll:N,equal:o,complex:w,larger:b,smaller:F,matrixFromColumns:k,dot:P});return r("eigs",{Array:function(Y){var re=n(Y);return L(re)},"Array, number|BigNumber":function(Y,re){var ne=n(Y);return L(ne,re)},Matrix:function(Y){var{values:re,vectors:ne}=L(Y);return{values:n(re),vectors:n(ne)}},"Matrix, number|BigNumber":function(Y,re){var{values:ne,vectors:pe}=L(Y,re);return{values:n(ne),vectors:n(pe)}}});function L(G,Y){Y===void 0&&(Y=t.epsilon);var re=G.size();if(re.length!==2||re[0]!==re[1])throw new RangeError("Matrix must be square (size: "+Pt(re)+")");var ne=G.toArray(),pe=re[0];if(V(ne,pe,Y)&&(H(ne,pe),I(ne,pe,Y))){var he=Z(G,ne,pe);return T(ne,pe,Y,he)}var le=Z(G,ne,pe);return O(ne,pe,Y,le)}function I(G,Y,re){for(var ne=0;ne<Y;ne++)for(var pe=ne;pe<Y;pe++)if(b(m(s(a(G[ne][pe],G[pe][ne]))),re))return!1;return!0}function V(G,Y,re){for(var ne=0;ne<Y;ne++)for(var pe=0;pe<Y;pe++)if(b(m(s(M(G[ne][pe]))),re))return!1;return!0}function H(G,Y){for(var re=0;re<Y;re++)for(var ne=0;ne<Y;ne++)G[re][ne]=R(G[re][ne])}function Z(G,Y,re){var ne=G.datatype();if(ne==="number"||ne==="BigNumber"||ne==="Complex")return ne;for(var pe=!1,he=!1,le=!1,fe=0;fe<re;fe++)for(var xe=0;xe<re;xe++){var ge=Y[fe][xe];if(Ut(ge)||Mo(ge))pe=!0;else if(kt(ge))he=!0;else if(yi(ge))le=!0;else throw TypeError("Unsupported type in Matrix: "+Or(ge))}if(he&&le&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),le){for(var ve=0;ve<re;ve++)for(var Ee=0;Ee<re;Ee++)Y[ve][Ee]=w(Y[ve][Ee]);return"Complex"}if(he){for(var q=0;q<re;q++)for(var J=0;J<re;J++)Y[q][J]=m(Y[q][J]);return"BigNumber"}if(pe){for(var ce=0;ce<re;ce++)for(var X=0;X<re;X++)Y[ce][X]=S(Y[ce][X]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),DI="expm",jde=["typed","abs","add","identity","inv","multiply"],sg=Q(DI,jde,e=>{var{typed:t,abs:r,add:n,identity:i,inv:a,multiply:o}=e;return t(DI,{Matrix:function(d){var f=d.size();if(f.length!==2||f[0]!==f[1])throw new RangeError("Matrix must be square (size: "+Pt(f)+")");for(var p=f[0],m=1e-15,v=s(d),y=l(v,m),b=y.q,D=y.j,x=o(d,Math.pow(2,-D)),S=i(p),w=i(p),C=1,E=x,A=-1,_=1;_<=b;_++)_>1&&(E=o(E,x),A=-A),C=C*(b-_+1)/((2*b-_+1)*_),S=n(S,o(C,E)),w=n(w,o(C*A,E));for(var N=o(a(w),S),M=0;M<D;M++)N=o(N,N);return ja(d)?d.createSparseMatrix(N):N}});function s(c){for(var d=c.size()[0],f=0,p=0;p<d;p++){for(var m=0,v=0;v<d;v++)m+=r(c.get([p,v]));f=Math.max(m,f)}return f}function l(c,d){for(var f=30,p=0;p<f;p++)for(var m=0;m<=p;m++){var v=p-m;if(u(c,m,v)<d)return{q:m,j:v}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function u(c,d,f){for(var p=1,m=2;m<=d;m++)p*=m;for(var v=p,y=d+1;y<=2*d;y++)v*=y;var b=v*(2*d+1);return 8*Math.pow(c/Math.pow(2,f),2*d)*p*p/(v*b)}}),EI="sqrtm",Kde=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],lg=Q(EI,Kde,e=>{var{typed:t,abs:r,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:l,size:u,max:c,identity:d}=e,f=1e3,p=1e-6;function m(v){var y,b=0,D=v,x=d(u(v));do{var S=D;if(D=i(.5,n(S,l(x))),x=i(.5,n(x,l(S))),y=c(r(s(D,S))),y>p&&++b>f)throw new Error("computing square root of matrix: iterative method could not converge")}while(y>p);return D}return t(EI,{"Array | Matrix":function(y){var b=ft(y)?y.size():qt(y);switch(b.length){case 1:if(b[0]===1)return a(y,o);throw new RangeError("Matrix must be square (size: "+Pt(b)+")");case 2:{var D=b[0],x=b[1];if(D===x)return m(y);throw new RangeError("Matrix must be square (size: "+Pt(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Pt(b)+")")}}})}),NI="sylvester",Yde=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],ug=Q(NI,Yde,e=>{var{typed:t,schur:r,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:l,index:u,subset:c,add:d,subtract:f,identity:p,lusolve:m,abs:v}=e;return t(NI,{"Matrix, Matrix, Matrix":y,"Array, Matrix, Matrix":function(D,x,S){return y(i(D),x,S)},"Array, Array, Matrix":function(D,x,S){return y(i(D),i(x),S)},"Array, Matrix, Array":function(D,x,S){return y(i(D),x,i(S))},"Matrix, Array, Matrix":function(D,x,S){return y(D,i(x),S)},"Matrix, Array, Array":function(D,x,S){return y(D,i(x),i(S))},"Matrix, Matrix, Array":function(D,x,S){return y(D,x,i(S))},"Array, Array, Array":function(D,x,S){return y(i(D),i(x),i(S)).toArray()}});function y(b,D,x){for(var S=D.size()[0],w=b.size()[0],C=r(b),E=C.T,A=C.U,_=r(a(-1,D)),N=_.T,M=_.U,R=a(a(l(A),x),M),F=o(0,w),k=[],P=(ge,ve)=>s(ge,ve,1),T=(ge,ve)=>s(ge,ve,0),O=0;O<S;O++)if(O<S-1&&v(c(N,u(O+1,O)))>1e-5){for(var L=T(c(R,u(F,O)),c(R,u(F,O+1))),I=0;I<O;I++)L=d(L,T(a(k[I],c(N,u(I,O))),a(k[I],c(N,u(I,O+1)))));var V=a(p(w),a(-1,c(N,u(O,O)))),H=a(p(w),a(-1,c(N,u(O+1,O)))),Z=a(p(w),a(-1,c(N,u(O,O+1)))),G=a(p(w),a(-1,c(N,u(O+1,O+1)))),Y=T(P(d(E,V),H),P(Z,d(E,G))),re=m(Y,L);k[O]=re.subset(u(o(0,w),0)),k[O+1]=re.subset(u(o(w,2*w),0)),O++}else{for(var ne=c(R,u(F,O)),pe=0;pe<O;pe++)ne=d(ne,a(k[pe],c(N,u(pe,O))));var he=c(N,u(O,O)),le=f(E,a(he,p(w)));k[O]=m(le,ne)}var fe=i(n(...k)),xe=a(A,a(fe,l(M)));return xe}}),AI="schur",Xde=["typed","matrix","identity","multiply","qr","norm","subtract"],cg=Q(AI,Xde,e=>{var{typed:t,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:s}=e;return t(AI,{Array:function(c){var d=l(r(c));return{U:d.U.valueOf(),T:d.T.valueOf()}},Matrix:function(c){return l(c)}});function l(u){var c=u.size()[0],d=u,f=n(c),p=0,m;do{m=d;var v=a(d),y=v.Q,b=v.R;if(d=i(b,y),f=i(f,y),p++>100)break}while(o(s(d,m))>1e-4);return{U:f,T:d}}}),_I="lyap",Zde=["typed","matrix","sylvester","multiply","transpose"],dg=Q(_I,Zde,e=>{var{typed:t,matrix:r,sylvester:n,multiply:i,transpose:a}=e;return t(_I,{"Matrix, Matrix":function(s,l){return n(s,a(s),i(-1,l))},"Array, Matrix":function(s,l){return n(r(s),a(r(s)),i(-1,l))},"Matrix, Array":function(s,l){return n(s,a(r(s)),r(i(-1,l)))},"Array, Array":function(s,l){return n(r(s),a(r(s)),r(i(-1,l))).toArray()}})}),Qde="divide",Jde=["typed","matrix","multiply","equalScalar","divideScalar","inv"],fg=Q(Qde,Jde,e=>{var{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=Cn({typed:t,equalScalar:i}),l=Ui({typed:t});return t("divide",hM({"Array | Matrix, Array | Matrix":function(c,d){return n(c,o(d))},"DenseMatrix, any":function(c,d){return l(c,d,a,!1)},"SparseMatrix, any":function(c,d){return s(c,d,a,!1)},"Array, any":function(c,d){return l(r(c),d,a,!1).valueOf()},"any, Array | Matrix":function(c,d){return n(c,o(d))}},a.signatures))}),MI="distance",efe=["typed","addScalar","subtract","divideScalar","multiplyScalar","unaryMinus","sqrt","abs"],pg=Q(MI,efe,e=>{var{typed:t,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,unaryMinus:o,sqrt:s,abs:l}=e;return t(MI,{"Array, Array, Array":function(w,C,E){if(w.length===2&&C.length===2&&E.length===2){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");var A=a(n(E[1],E[0]),n(C[1],C[0])),_=i(i(A,A),C[0]),N=o(i(A,C[0])),M=w[1];return y(w[0],w[1],_,N,M)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(w,C,E){if(Object.keys(w).length===2&&Object.keys(C).length===2&&Object.keys(E).length===2){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(C))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(E))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"lineOnePtX"in C&&"lineOnePtY"in C&&"lineTwoPtX"in E&&"lineTwoPtY"in E){var A=a(n(E.lineTwoPtY,E.lineTwoPtX),n(C.lineOnePtY,C.lineOnePtX)),_=i(i(A,A),C.lineOnePtX),N=o(i(A,C.lineOnePtX)),M=w.pointX;return y(w.pointX,w.pointY,_,N,M)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(w,C){if(w.length===2&&C.length===3){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!d(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return y(w[0],w[1],C[0],C[1],C[2])}else if(w.length===3&&C.length===6){if(!d(w))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(C))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return b(w[0],w[1],w[2],C[0],C[1],C[2],C[3],C[4],C[5])}else if(w.length===C.length&&w.length>0){if(!f(w))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!f(C))throw new TypeError("All values of an array should be numbers or BigNumbers");return D(w,C)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(w,C){if(Object.keys(w).length===2&&Object.keys(C).length===3){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!d(C))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"xCoeffLine"in C&&"yCoeffLine"in C&&"constant"in C)return y(w.pointX,w.pointY,C.xCoeffLine,C.yCoeffLine,C.constant);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(C).length===6){if(!d(w))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(C))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"x0"in C&&"y0"in C&&"z0"in C&&"a"in C&&"b"in C&&"c"in C)return b(w.pointX,w.pointY,w.pointZ,C.x0,C.y0,C.z0,C.a,C.b,C.c);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===2&&Object.keys(C).length===2){if(!c(w))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(C))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointTwoX"in C&&"pointTwoY"in C)return D([w.pointOneX,w.pointOneY],[C.pointTwoX,C.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(C).length===3){if(!d(w))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!d(C))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointOneZ"in w&&"pointTwoX"in C&&"pointTwoY"in C&&"pointTwoZ"in C)return D([w.pointOneX,w.pointOneY,w.pointOneZ],[C.pointTwoX,C.pointTwoY,C.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(w){if(!v(w))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return x(w)}});function u(S){return typeof S=="number"||kt(S)}function c(S){return S.constructor!==Array&&(S=m(S)),u(S[0])&&u(S[1])}function d(S){return S.constructor!==Array&&(S=m(S)),u(S[0])&&u(S[1])&&u(S[2])}function f(S){return Array.isArray(S)||(S=m(S)),S.every(u)}function p(S){return S.constructor!==Array&&(S=m(S)),u(S[0])&&u(S[1])&&u(S[2])&&u(S[3])&&u(S[4])&&u(S[5])}function m(S){for(var w=Object.keys(S),C=[],E=0;E<w.length;E++)C.push(S[w[E]]);return C}function v(S){if(S[0].length===2&&u(S[0][0])&&u(S[0][1])){if(S.some(w=>w.length!==2||!u(w[0])||!u(w[1])))return!1}else if(S[0].length===3&&u(S[0][0])&&u(S[0][1])&&u(S[0][2])){if(S.some(w=>w.length!==3||!u(w[0])||!u(w[1])||!u(w[2])))return!1}else return!1;return!0}function y(S,w,C,E,A){var _=l(r(r(i(C,S),i(E,w)),A)),N=s(r(i(C,C),i(E,E)));return a(_,N)}function b(S,w,C,E,A,_,N,M,R){var F=[n(i(n(A,w),R),i(n(_,C),M)),n(i(n(_,C),N),i(n(E,S),R)),n(i(n(E,S),M),i(n(A,w),N))];F=s(r(r(i(F[0],F[0]),i(F[1],F[1])),i(F[2],F[2])));var k=s(r(r(i(N,N),i(M,M)),i(R,R)));return a(F,k)}function D(S,w){for(var C=S.length,E=0,A=0,_=0;_<C;_++)A=n(S[_],w[_]),E=r(i(A,A),E);return s(E)}function x(S){for(var w=[],C=[],E=[],A=0;A<S.length-1;A++)for(var _=A+1;_<S.length;_++)S[0].length===2?(C=[S[A][0],S[A][1]],E=[S[_][0],S[_][1]]):S[0].length===3&&(C=[S[A][0],S[A][1],S[A][2]],E=[S[_][0],S[_][1],S[_][2]]),w.push(D(C,E));return w}}),tfe="intersect",rfe=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],hg=Q(tfe,rfe,e=>{var{typed:t,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:l,divideScalar:u,subtract:c,smaller:d,equalScalar:f,flatten:p,isZero:m,isNumeric:v}=e;return t("intersect",{"Array, Array, Array":y,"Array, Array, Array, Array":b,"Matrix, Matrix, Matrix":function(M,R,F){var k=y(M.valueOf(),R.valueOf(),F.valueOf());return k===null?null:o(k)},"Matrix, Matrix, Matrix, Matrix":function(M,R,F,k){var P=b(M.valueOf(),R.valueOf(),F.valueOf(),k.valueOf());return P===null?null:o(P)}});function y(N,M,R){if(N=D(N),M=D(M),R=D(R),!S(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(R))throw new TypeError("Array with 4 numbers expected as third argument");return _(N[0],N[1],N[2],M[0],M[1],M[2],R[0],R[1],R[2],R[3])}function b(N,M,R,F){if(N=D(N),M=D(M),R=D(R),F=D(F),N.length===2){if(!x(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!x(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!x(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!x(F))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return C(N,M,R,F)}else if(N.length===3){if(!S(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!S(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!S(F))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return A(N[0],N[1],N[2],M[0],M[1],M[2],R[0],R[1],R[2],F[0],F[1],F[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function D(N){return N.length===1?N[0]:N.length>1&&Array.isArray(N[0])&&N.every(M=>Array.isArray(M)&&M.length===1)?p(N):N}function x(N){return N.length===2&&v(N[0])&&v(N[1])}function S(N){return N.length===3&&v(N[0])&&v(N[1])&&v(N[2])}function w(N){return N.length===4&&v(N[0])&&v(N[1])&&v(N[2])&&v(N[3])}function C(N,M,R,F){var k=N,P=R,T=c(k,M),O=c(P,F),L=c(l(T[0],O[1]),l(O[0],T[1]));if(m(L)||d(n(L),r.epsilon))return null;var I=l(O[0],k[1]),V=l(O[1],k[0]),H=l(O[0],P[1]),Z=l(O[1],P[0]),G=u(a(c(c(I,V),H),Z),L);return i(s(T,G),k)}function E(N,M,R,F,k,P,T,O,L,I,V,H){var Z=l(c(N,M),c(R,F)),G=l(c(k,P),c(T,O)),Y=l(c(L,I),c(V,H));return a(a(Z,G),Y)}function A(N,M,R,F,k,P,T,O,L,I,V,H){var Z=E(N,T,I,T,M,O,V,O,R,L,H,L),G=E(I,T,F,N,V,O,k,M,H,L,P,R),Y=E(N,T,F,N,M,O,k,M,R,L,P,R),re=E(I,T,I,T,V,O,V,O,H,L,H,L),ne=E(F,N,F,N,k,M,k,M,P,R,P,R),pe=c(l(Z,G),l(Y,re)),he=c(l(ne,re),l(G,G));if(m(he))return null;var le=u(pe,he),fe=u(a(Z,l(le,G)),re),xe=a(N,l(le,c(F,N))),ge=a(M,l(le,c(k,M))),ve=a(R,l(le,c(P,R))),Ee=a(T,l(fe,c(I,T))),q=a(O,l(fe,c(V,O))),J=a(L,l(fe,c(H,L)));return f(xe,Ee)&&f(ge,q)&&f(ve,J)?[xe,ge,ve]:null}function _(N,M,R,F,k,P,T,O,L,I){var V=l(N,T),H=l(F,T),Z=l(M,O),G=l(k,O),Y=l(R,L),re=l(P,L),ne=c(c(c(I,V),Z),Y),pe=c(c(c(a(a(H,G),re),V),Z),Y),he=u(ne,pe),le=a(N,l(he,c(F,N))),fe=a(M,l(he,c(k,M))),xe=a(R,l(he,c(P,R)));return[le,fe,xe]}}),TI="sum",nfe=["typed","config","add","numeric"],pc=Q(TI,nfe,e=>{var{typed:t,config:r,add:n,numeric:i}=e;return t(TI,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(l){if(Al(l))throw new TypeError("Scalar values expected in function sum");return a(l)}});function a(s){var l;return Qa(s,function(u){try{l=l===void 0?u:n(l,u)}catch(c){throw qn(c,"sum",u)}}),l===void 0&&(l=i(0,r.number)),typeof l=="string"&&(l=i(l,r.number)),l}function o(s,l){try{var u=Vf(s,l,n);return u}catch(c){throw qn(c,"sum")}}}),mg="cumsum",ife=["typed","add","unaryPlus"],hc=Q(mg,ife,e=>{var{typed:t,add:r,unaryPlus:n}=e;return t(mg,{Array:i,Matrix:function(u){return u.create(i(u.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(u,c){return u.create(o(u.valueOf(),c))},"...":function(u){if(Al(u))throw new TypeError("All values expected to be scalar in function cumsum");return i(u)}});function i(l){try{return a(l)}catch(u){throw qn(u,mg)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c<l.length;++c)u.push(r(u[c-1],l[c]));return u}function o(l,u){var c=qt(l);if(u<0||u>=c.length)throw new ii(u,c.length);try{return s(l,u)}catch(d){throw qn(d,mg)}}function s(l,u){var c,d,f;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(f=iT(l),d=[],c=0;c<f.length;c++)d[c]=s(f[c],u-1);return d}else return a(l)}else{for(d=[],c=0;c<l.length;c++)d[c]=s(l[c],u-1);return d}}}),OI="mean",afe=["typed","add","divide"],mc=Q(OI,afe,e=>{var{typed:t,add:r,divide:n}=e;return t(OI,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(s){if(Al(s))throw new TypeError("Scalar values expected in function mean");return a(s)}});function i(o,s){try{var l=Vf(o,s,r),u=Array.isArray(o)?qt(o):o.size();return n(l,u[s])}catch(c){throw qn(c,"mean")}}function a(o){var s,l=0;if(Qa(o,function(u){try{s=s===void 0?u:r(s,u),l++}catch(c){throw qn(c,"mean",u)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(s,l)}}),RI="median",ofe=["typed","add","divide","compare","partitionSelect"],vg=Q(RI,ofe,e=>{var{typed:t,add:r,divide:n,compare:i,partitionSelect:a}=e;function o(u){try{u=Qt(u.valueOf());var c=u.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var d=c/2-1,f=a(u,d+1),p=u[d],m=0;m<d;++m)i(u[m],p)>0&&(p=u[m]);return l(p,f)}else{var v=a(u,(c-1)/2);return s(v)}}catch(y){throw qn(y,"median")}}var s=t({"number | BigNumber | Complex | Unit":function(c){return c}}),l=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,d){return n(r(c,d),2)}});return t(RI,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,d){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(Al(c))throw new TypeError("Scalar values expected in function median");return o(c)}})}),II="mad",sfe=["typed","abs","map","median","subtract"],gg=Q(II,sfe,e=>{var{typed:t,abs:r,map:n,median:i,subtract:a}=e;return t(II,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=Qt(s.valueOf()),s.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var l=i(s);return i(n(s,function(u){return r(a(u,l))}))}catch(u){throw u instanceof TypeError&&u.message.indexOf("median")!==-1?new TypeError(u.message.replace("median","mad")):qn(u,"mad")}}}),Aw="unbiased",kI="variance",lfe=["typed","add","subtract","multiply","divide","apply","isNaN"],vc=Q(kI,lfe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e;return t(kI,{"Array | Matrix":function(d){return l(d,Aw)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(d,f){return u(d,f,Aw)},"Array | Matrix, number | BigNumber, string":u,"...":function(d){return l(d,Aw)}});function l(c,d){var f,p=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Qa(c,function(y){try{f=f===void 0?y:r(f,y),p++}catch(b){throw qn(b,"variance",y)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var m=a(f,p);if(f=void 0,Qa(c,function(y){var b=n(y,m);f=f===void 0?i(b,b):r(f,i(b,b))}),s(f))return f;switch(d){case"uncorrected":return a(f,p);case"biased":return a(f,p+1);case"unbiased":{var v=kt(f)?f.mul(0):0;return p===1?v:a(f,p-1)}default:throw new Error('Unknown normalization "'+d+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(c,d,f){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,d,p=>l(p,f))}catch(p){throw qn(p,"variance")}}}),ufe="quantileSeq",cfe=["typed","add","multiply","partitionSelect","compare"],yg=Q(ufe,cfe,e=>{var{typed:t,add:r,multiply:n,partitionSelect:i,compare:a}=e;function o(u,c,d){var f,p,m;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(xi(u)){if(d=d||!1,typeof d=="boolean"){if(p=u.valueOf(),Ut(c)){if(c<0)throw new Error("N/prob must be non-negative");if(c<=1)return s(p,c,d);if(c>1){if(!ot(c))throw new Error("N must be a positive integer");var v=c+1;f=new Array(c);for(var y=0;y<c;)f[y]=s(p,++y/v,d);return f}}if(kt(c)){var b=c.constructor;if(c.isNegative())throw new Error("N/prob must be non-negative");if(m=new b(1),c.lte(m))return new b(s(p,c,d));if(c.gt(m)){if(!c.isInteger())throw new Error("N must be a positive integer");var D=c.toNumber();if(D>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var x=new b(D+1);f=new Array(D);for(var S=0;S<D;)f[S]=new b(s(p,new b(++S).div(x),d));return f}}if(xi(c)){var w=c.valueOf();f=new Array(w.length);for(var C=0;C<f.length;++C){var E=w[C];if(Ut(E)){if(E<0||E>1)throw new Error("Probability must be between 0 and 1, inclusive")}else if(kt(E)){if(m=new E.constructor(1),E.isNegative()||E.gt(m))throw new Error("Probability must be between 0 and 1, inclusive")}else throw new TypeError("Unexpected type of argument in function quantileSeq");f[C]=s(p,E,d)}return f}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}function s(u,c,d){var f=Qt(u),p=f.length;if(p===0)throw new Error("Cannot calculate quantile of an empty sequence");if(Ut(c)){var m=c*(p-1),v=m%1;if(v===0){var y=d?f[m]:i(f,m);return l(y),y}var b=Math.floor(m),D,x;if(d)D=f[b],x=f[b+1];else{x=i(f,b+1),D=f[b];for(var S=0;S<b;++S)a(f[S],D)>0&&(D=f[S])}return l(D),l(x),r(n(D,1-v),n(x,v))}var w=c.times(p-1);if(w.isInteger()){w=w.toNumber();var C=d?f[w]:i(f,w);return l(C),C}var E=w.floor(),A=w.minus(E),_=E.toNumber(),N,M;if(d)N=f[_],M=f[_+1];else{M=i(f,_+1),N=f[_];for(var R=0;R<_;++R)a(f[R],N)>0&&(N=f[R])}l(N),l(M);var F=new A.constructor(1);return r(n(N,F.minus(A)),n(M,A))}var l=t({"number | BigNumber | Unit":function(c){return c}});return o}),PI="std",dfe=["typed","map","sqrt","variance"],gc=Q(PI,dfe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e;return t(PI,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(s){return a(s)}});function a(o,s){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var l=i.apply(null,arguments);return xi(l)?r(l,n):n(l)}catch(u){throw u instanceof TypeError&&u.message.indexOf(" variance")!==-1?new TypeError(u.message.replace(" variance"," std")):u}}}),FI="combinations",ffe=["typed"],bg=Q(FI,ffe,e=>{var{typed:t}=e;return t(FI,{"number, number":RT,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!$I(n)||!$I(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=u,i.lt(l))for(s=u;s.lte(l);s=s.plus(u))o=o.times(i.plus(s)).dividedBy(s);else for(s=u;s.lte(i);s=s.plus(u))o=o.times(l.plus(s)).dividedBy(s);return o}})});function $I(e){return e.isInteger()&&e.gte(0)}var BI="combinationsWithRep",pfe=["typed"],xg=Q(BI,pfe,e=>{var{typed:t}=e;return t(BI,{"number, number":function(n,i){if(!ot(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ot(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i<n-1){var a=Ja(n,n+i-1);return a/Ja(1,i)}var o=Ja(i+1,n+i-1);return o/Ja(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=new a(1),u=n.minus(l);if(!zI(n)||!zI(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(l))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=l,i.lt(u))for(s=l;s.lte(u);s=s.plus(l))o=o.times(i.plus(s)).dividedBy(s);else for(s=l;s.lte(i);s=s.plus(l))o=o.times(u.plus(s)).dividedBy(s);return o}})});function zI(e){return e.isInteger()&&e.gte(0)}var LI="gamma",hfe=["typed","config","multiplyScalar","pow","BigNumber","Complex"],wg=Q(LI,hfe,e=>{var{typed:t,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;function s(u){if(u.im===0)return Uf(u.re);if(u.re<.5){var c=new o(1-u.re,-u.im),d=new o(Math.PI*u.re,Math.PI*u.im);return new o(Math.PI).div(d.sin()).div(s(c))}u=new o(u.re-1,u.im);for(var f=new o(Ml[0],0),p=1;p<Ml.length;++p){var m=new o(Ml[p],0);f=f.add(m.div(u.add(p)))}var v=new o(u.re+$T+.5,u.im),y=Math.sqrt(2*Math.PI),b=v.pow(u.add(.5)),D=v.neg().exp();return f.mul(y).mul(b).mul(D)}return t(LI,{number:Uf,Complex:s,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):l(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function l(u){if(u<8)return new a([1,1,2,6,24,120,720,5040][u]);var c=r.precision+(Math.log(u.toNumber())|0),d=a.clone({precision:c});if(u%2===1)return u.times(l(new a(u-1)));for(var f=u,p=new d(u),m=u.toNumber();f>2;)f-=2,m+=f,p=p.times(m);return new a(p.toPrecision(a.precision))}}),VI="lgamma",mfe=["Complex","typed"],Cg=Q(VI,mfe,e=>{var{Complex:t,typed:r}=e,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(VI,{number:Wf,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(u){var c=6.283185307179586,d=1.1447298858494002,f=.1;if(u.isNaN())return new t(NaN,NaN);if(u.im===0)return new t(Wf(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=f){var p=OJ(c,u.im)*Math.floor(.5*u.re+.25),m=u.mul(Math.PI).sin().log(),v=o(new t(1-u.re,-u.im));return new t(d,p).sub(m).sub(v)}else return u.im>=0?l(u):l(u.conjugate()).conjugate()}function s(u){for(var c=u.sub(.5).mul(u.log()).sub(u).add(BT),d=new t(1,0).div(u),f=d.div(u),p=a[0],m=a[1],v=2*f.re,y=f.re*f.re+f.im*f.im,b=2;b<8;b++){var D=m;m=-y*p+a[b],p=v*p+D}var x=d.mul(f.mul(p).add(m));return c.add(x)}function l(u){var c=0,d=0,f=u;for(u=u.add(1);u.re<=n;){f=f.mul(u);var p=f.im<0?1:0;p!==0&&d===0&&c++,d=p,u=u.add(1)}return s(u).sub(f.log()).sub(new t(0,c*2*Math.PI*1))}}),qI="factorial",vfe=["typed","gamma"],Sg=Q(qI,vfe,e=>{var{typed:t,gamma:r}=e;return t(qI,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return r(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return r(i.plus(1))},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),GI="kldivergence",gfe=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],Dg=Q(GI,gfe,e=>{var{typed:t,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=e;return t(GI,{"Array, Array":function(f,p){return c(r(f),r(p))},"Matrix, Array":function(f,p){return c(f,r(p))},"Array, Matrix":function(f,p){return c(r(f),p)},"Matrix, Matrix":function(f,p){return c(f,p)}});function c(d,f){var p=f.size().length,m=d.size().length;if(p>1)throw new Error("first object must be one dimensional");if(m>1)throw new Error("second object must be one dimensional");if(p!==m)throw new Error("Length of two vectors must be equal");var v=i(d);if(v===0)throw new Error("Sum of elements in first object must be non zero");var y=i(f);if(y===0)throw new Error("Sum of elements in second object must be non zero");var b=n(d,i(d)),D=n(f,i(f)),x=i(a(b,o(s(b,D),S=>l(S))));return u(x)?x:Number.NaN}}),UI="multinomial",yfe=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Eg=Q(UI,yfe,e=>{var{typed:t,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(UI,{"Array | Matrix":function(u){var c=0,d=1;return Qa(u,function(f){if(!o(f)||!s(f))throw new TypeError("Positive integer value expected in function multinomial");c=r(c,f),d=i(d,a(f))}),n(a(c),d)}})}),WI="permutations",bfe=["typed","factorial"],Ng=Q(WI,bfe,e=>{var{typed:t,factorial:r}=e;return t(WI,{"number | BigNumber":r,"number, number":function(i,a){if(!ot(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!ot(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(a>i)throw new TypeError("second argument k must be less than or equal to first argument n");return Ja(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,s;if(!HI(i)||!HI(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var l=i.mul(0).add(1);for(o=l,s=i.minus(a).plus(1);s.lte(i);s=s.plus(1))o=o.times(s);return o}})});function HI(e){return e.isInteger()&&e.gte(0)}var jI={exports:{}};(function(e){(function(t,r,n){function i(l){var u=this,c=s();u.next=function(){var d=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=d-(u.c=d|0)},u.c=1,u.s0=c(" "),u.s1=c(" "),u.s2=c(" "),u.s0-=c(l),u.s0<0&&(u.s0+=1),u.s1-=c(l),u.s1<0&&(u.s1+=1),u.s2-=c(l),u.s2<0&&(u.s2+=1),c=null}function a(l,u){return u.c=l.c,u.s0=l.s0,u.s1=l.s1,u.s2=l.s2,u}function o(l,u){var c=new i(l),d=u&&u.state,f=c.next;return f.int32=function(){return c.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,d&&(typeof d=="object"&&a(d,c),f.state=function(){return a(c,{})}),f}function s(){var l=4022871197,u=function(c){c=String(c);for(var d=0;d<c.length;d++){l+=c.charCodeAt(d);var f=.02519603282416938*l;l=f>>>0,f-=l,f*=l,l=f>>>0,f-=l,l+=f*4294967296}return(l>>>0)*23283064365386963e-26};return u}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.alea=o})(vt,e,!1)})(jI);var KI={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this,u="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var d=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^d^d>>>8},s===(s|0)?l.x=s:u+=s;for(var c=0;c<u.length+64;c++)l.x^=u.charCodeAt(c)|0,l.next()}function a(s,l){return l.x=s.x,l.y=s.y,l.z=s.z,l.w=s.w,l}function o(s,l){var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xor128=o})(vt,e,!1)})(KI);var YI={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this,u="";l.next=function(){var d=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(d^d<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,s===(s|0)?l.x=s:u+=s;for(var c=0;c<u.length+64;c++)l.x^=u.charCodeAt(c)|0,c==u.length&&(l.d=l.x<<10^l.x>>>4),l.next()}function a(s,l){return l.x=s.x,l.y=s.y,l.z=s.z,l.w=s.w,l.v=s.v,l.d=s.d,l}function o(s,l){var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xorwow=o})(vt,e,!1)})(YI);var XI={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this;l.next=function(){var c=l.x,d=l.i,f,p;return f=c[d],f^=f>>>7,p=f^f<<24,f=c[d+1&7],p^=f^f>>>10,f=c[d+3&7],p^=f^f>>>3,f=c[d+4&7],p^=f^f<<7,f=c[d+7&7],f=f^f<<13,p^=f^f<<9,c[d]=p,l.i=d+1&7,p};function u(c,d){var f,p=[];if(d===(d|0))p[0]=d;else for(d=""+d,f=0;f<d.length;++f)p[f&7]=p[f&7]<<15^d.charCodeAt(f)+p[f+1&7]<<13;for(;p.length<8;)p.push(0);for(f=0;f<8&&p[f]===0;++f);for(f==8?p[7]=-1:p[f],c.x=p,c.i=0,f=256;f>0;--f)c.next()}u(l,s)}function a(s,l){return l.x=s.x.slice(),l.i=s.i,l}function o(s,l){s==null&&(s=+new Date);var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(c.x&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xorshift7=o})(vt,e,!1)})(XI);var ZI={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this;l.next=function(){var c=l.w,d=l.X,f=l.i,p,m;return l.w=c=c+1640531527|0,m=d[f+34&127],p=d[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,m=d[f]=m^p,l.i=f,m+(c^c>>>16)|0};function u(c,d){var f,p,m,v,y,b=[],D=128;for(d===(d|0)?(p=d,d=null):(d=d+"\0",p=0,D=Math.max(D,d.length)),m=0,v=-32;v<D;++v)d&&(p^=d.charCodeAt((v+32)%d.length)),v===0&&(y=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,v>=0&&(y=y+1640531527|0,f=b[v&127]^=p+y,m=f==0?m+1:0);for(m>=128&&(b[(d&&d.length||0)&127]=-1),m=127,v=4*128;v>0;--v)p=b[m+34&127],f=b[m=m+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,b[m]=p^f;c.w=y,c.X=b,c.i=m}u(l,s)}function a(s,l){return l.i=s.i,l.w=s.w,l.X=s.X.slice(),l}function o(s,l){s==null&&(s=+new Date);var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(c.X&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xor4096=o})(vt,e,!1)})(ZI);var QI={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this,u="";l.next=function(){var d=l.b,f=l.c,p=l.d,m=l.a;return d=d<<25^d>>>7^f,f=f-p|0,p=p<<24^p>>>8^m,m=m-d|0,l.b=d=d<<20^d>>>12^f,l.c=f=f-p|0,l.d=p<<16^f>>>16^m,l.a=m-d|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,s===Math.floor(s)?(l.a=s/4294967296|0,l.b=s|0):u+=s;for(var c=0;c<u.length+20;c++)l.b^=u.charCodeAt(c)|0,l.next()}function a(s,l){return l.a=s.a,l.b=s.b,l.c=s.c,l.d=s.d,l}function o(s,l){var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.tychei=o})(vt,e,!1)})(QI);var JI={exports:{}};const xfe=O6(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));(function(e){(function(t,r,n){var i=256,a=6,o=52,s="random",l=n.pow(i,a),u=n.pow(2,o),c=u*2,d=i-1,f;function p(S,w,C){var E=[];w=w==!0?{entropy:!0}:w||{};var A=b(y(w.entropy?[S,x(r)]:S==null?D():S,3),E),_=new m(E),N=function(){for(var M=_.g(a),R=l,F=0;M<u;)M=(M+F)*i,R*=i,F=_.g(1);for(;M>=c;)M/=2,R/=2,F>>>=1;return(M+F)/R};return N.int32=function(){return _.g(4)|0},N.quick=function(){return _.g(4)/4294967296},N.double=N,b(x(_.S),r),(w.pass||C||function(M,R,F,k){return k&&(k.S&&v(k,_),M.state=function(){return v(_,{})}),F?(n[s]=M,R):M})(N,A,"global"in w?w.global:this==n,w.state)}function m(S){var w,C=S.length,E=this,A=0,_=E.i=E.j=0,N=E.S=[];for(C||(S=[C++]);A<i;)N[A]=A++;for(A=0;A<i;A++)N[A]=N[_=d&_+S[A%C]+(w=N[A])],N[_]=w;(E.g=function(M){for(var R,F=0,k=E.i,P=E.j,T=E.S;M--;)R=T[k=d&k+1],F=F*i+T[d&(T[k]=T[P=d&P+R])+(T[P]=R)];return E.i=k,E.j=P,F})(i)}function v(S,w){return w.i=S.i,w.j=S.j,w.S=S.S.slice(),w}function y(S,w){var C=[],E=typeof S,A;if(w&&E=="object")for(A in S)try{C.push(y(S[A],w-1))}catch{}return C.length?C:E=="string"?S:S+"\0"}function b(S,w){for(var C=S+"",E,A=0;A<C.length;)w[d&A]=d&(E^=w[d&A]*19)+C.charCodeAt(A++);return x(w)}function D(){try{var S;return f&&(S=f.randomBytes)?S=S(i):(S=new Uint8Array(i),(t.crypto||t.msCrypto).getRandomValues(S)),x(S)}catch{var w=t.navigator,C=w&&w.plugins;return[+new Date,t,C,t.screen,x(r)]}}function x(S){return String.fromCharCode.apply(0,S)}if(b(n.random(),r),e.exports){e.exports=p;try{f=xfe}catch{}}else n["seed"+s]=p})(typeof self<"u"?self:vt,[],Math)})(JI);var wfe=jI.exports,Cfe=KI.exports,Sfe=YI.exports,Dfe=XI.exports,Efe=ZI.exports,Nfe=QI.exports,ys=JI.exports;ys.alea=wfe,ys.xor128=Cfe,ys.xorwow=Sfe,ys.xorshift7=Dfe,ys.xor4096=Efe,ys.tychei=Nfe;var ek=ys,Afe=ek(Date.now());function Pl(e){var t;function r(i){t=i===null?Afe:ek(String(i))}r(e);function n(){return t()}return n}var tk="pickRandom",_fe=["typed","config","?on"],Ag=Q(tk,_fe,e=>{var{typed:t,config:r,on:n}=e,i=Pl(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=Pl(o.randomSeed))}),t(tk,{"Array | Matrix":function(s){return a(s,{})},"Array | Matrix, Object":function(s,l){return a(s,l)},"Array | Matrix, number":function(s,l){return a(s,{number:l})},"Array | Matrix, Array | Matrix":function(s,l){return a(s,{weights:l})},"Array | Matrix, Array | Matrix, number":function(s,l,u){return a(s,{number:u,weights:l})},"Array | Matrix, number, Array | Matrix":function(s,l,u){return a(s,{number:l,weights:u})}});function a(o,s){var{number:l,weights:u,elementWise:c=!0}=s,d=typeof l>"u";d&&(l=1);var f=ft(o)?o.create:ft(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),c===!0&&(o=Qt(o),u=Qt(u));var p=0;if(typeof u<"u"){if(u.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var m=0,v=u.length;m<v;m++){if(!Ut(u[m])||u[m]<0)throw new Error("Weights must be an array of positive numbers");p+=u[m]}}for(var y=o.length,b=[],D;b.length<l;){if(typeof u>"u")D=o[Math.floor(i()*y)];else for(var x=i()*p,S=0,w=o.length;S<w;S++)if(x-=u[S],x<0){D=o[S];break}b.push(D)}return d?b[0]:f?f(b):b}});function _w(e,t){var r=[];if(e=e.slice(0),e.length>1)for(var n=0,i=e.shift();n<i;n++)r.push(_w(e,t));else for(var a=0,o=e.shift();a<o;a++)r.push(t());return r}var rk="random",Mfe=["typed","config","?on"],_g=Q(rk,Mfe,e=>{var{typed:t,config:r,on:n}=e,i=Pl(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=Pl(s.randomSeed))}),t(rk,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=_w(s.valueOf(),()=>o(l,u));return ft(s)?s.create(c):c}function o(s,l){return s+i()*(l-s)}}),nk="randomInt",Tfe=["typed","config","?on"],Mg=Q(nk,Tfe,e=>{var{typed:t,config:r,on:n}=e,i=Pl(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=Pl(s.randomSeed))}),t(nk,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=_w(s.valueOf(),()=>o(l,u));return ft(s)?s.create(c):c}function o(s,l){return Math.floor(s+i()*(l-s))}}),ik="stirlingS2",Ofe=["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],Tg=Q(ik,Ofe,e=>{var{typed:t,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:l,isNegative:u,isInteger:c,number:d,bignumber:f,larger:p}=e,m=[],v=[];return t(ik,{"number | BigNumber, number | BigNumber":function(b,D){if(!c(b)||u(b)||!c(D)||u(D))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(D,b))throw new TypeError("k must be less than or equal to n in function stirlingS2");var x=!(Ut(b)&&Ut(D)),S=x?v:m,w=x?f:d,C=d(b),E=d(D);if(S[C]&&S[C].length>E)return S[C][E];for(var A=0;A<=C;++A)if(S[A]||(S[A]=[w(A===0?1:0)]),A!==0)for(var _=S[A],N=S[A-1],M=_.length;M<=A&&M<=E;++M)M===A?_[M]=1:_[M]=r(i(w(M),N[M]),N[M-1]);return S[C][E]}})}),ak="bellNumbers",Rfe=["typed","addScalar","isNegative","isInteger","stirlingS2"],Og=Q(ak,Rfe,e=>{var{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=e;return t(ak,{"number | BigNumber":function(s){if(!i(s)||n(s))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var l=0,u=0;u<=s;u++)l=r(l,a(s,u));return l}})}),ok="catalan",Ife=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Rg=Q(ok,Ife,e=>{var{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(ok,{"number | BigNumber":function(u){if(!s(u)||o(u))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(u,2),u),r(u,1))}})}),sk="composition",kfe=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Ig=Q(sk,kfe,e=>{var{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(sk,{"number | BigNumber, number | BigNumber":function(u,c){if(!o(u)||!i(u)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(s(c,u))throw new TypeError("k must be less than or equal to n in function composition");return n(r(u,-1),r(c,-1))}})}),lk="leafCount",Pfe=["parse","typed"],kg=Q(lk,Pfe,e=>{var{parse:t,typed:r}=e;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(lk,{Node:function(a){return n(a)}})});function uk(e){return Kt(e)||Wr(e)&&e.isUnary()&&Kt(e.args[0])}function Pg(e){return!!(Kt(e)||(ya(e)||Wr(e))&&e.args.every(Pg)||zi(e)&&Pg(e.content))}function ck(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ck(Object(r),!0).forEach(function(n){pn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ck(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ffe="simplifyUtil",$fe=["FunctionNode","OperatorNode","SymbolNode"],Tw=Q(Ffe,$fe,e=>{var{FunctionNode:t,OperatorNode:r,SymbolNode:n}=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}},l={divide:{total:a},log:{total:a}},u={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(x,S){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,C=o;if(typeof x=="string"?C=x:Wr(x)?C=x.fn.toString():ya(x)?C=x.name:zi(x)&&(C="paren"),et(w,C)){var E=w[C];if(et(E,S))return E[S];if(et(s,C))return s[C][S]}if(et(w,o)){var A=w[o];return et(A,S)?A[S]:s[o][S]}if(et(s,C)){var _=s[C];if(et(_,S))return _[S]}return s[o][S]}function d(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(x,"commutative",S)}function f(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(x,"associative",S)}function p(x,S){var w=Mw({},x);for(var C in S)et(x,C)?w[C]=Mw(Mw({},S[C]),x[C]):w[C]=S[C];return w}function m(x,S){if(!x.args||x.args.length===0)return x;x.args=v(x,S);for(var w=0;w<x.args.length;w++)m(x.args[w],S)}function v(x,S){var w,C=[],E=function A(_){for(var N=0;N<_.args.length;N++){var M=_.args[N];Wr(M)&&w===M.op?A(M):C.push(M)}};return f(x,S)?(w=x.op,E(x),C):x.args}function y(x,S){if(!(!x.args||x.args.length===0)){for(var w=D(x),C=x.args.length,E=0;E<C;E++)y(x.args[E],S);if(C>2&&f(x,S)){for(var A=x.args.pop();x.args.length>0;)A=w([x.args.pop(),A]);x.args=A.args}}}function b(x,S){if(!(!x.args||x.args.length===0)){for(var w=D(x),C=x.args.length,E=0;E<C;E++)b(x.args[E],S);if(C>2&&f(x,S)){for(var A=x.args.shift();x.args.length>0;)A=w([A,x.args.shift()]);x.args=A.args}}}function D(x){return Wr(x)?function(S){try{return new r(x.op,x.fn,S,x.implicit)}catch(w){return console.error(w),[]}}:function(S){return new t(new n(x.name),S)}}return{createMakeNodeFunction:D,hasProperty:c,isCommutative:d,isAssociative:f,mergeContext:p,flatten:m,allChildren:v,unflattenr:y,unflattenl:b,defaultContext:s,realContext:l,positiveContext:u}}),Bfe="simplify",zfe=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Fg=Q(Bfe,zfe,e=>{var{config:t,typed:r,parse:n,add:i,subtract:a,multiply:o,divide:s,pow:l,isZero:u,equal:c,resolve:d,simplifyConstant:f,simplifyCore:p,fraction:m,bignumber:v,mathWithTransform:y,matrix:b,AccessorNode:D,ArrayNode:x,ConstantNode:S,FunctionNode:w,IndexNode:C,ObjectNode:E,OperatorNode:A,ParenthesisNode:_,SymbolNode:N}=e,{hasProperty:M,isCommutative:R,isAssociative:F,mergeContext:k,flatten:P,unflattenr:T,unflattenl:O,createMakeNodeFunction:L,defaultContext:I,realContext:V,positiveContext:H}=Tw({FunctionNode:w,OperatorNode:A,SymbolNode:N});r.addConversion({from:"Object",to:"Map",convert:Dl});var Z=r("simplify",{Node:le,"Node, Map":(X,te)=>le(X,!1,te),"Node, Map, Object":(X,te,ae)=>le(X,!1,te,ae),"Node, Array":le,"Node, Array, Map":le,"Node, Array, Map, Object":le});r.removeConversion({from:"Object",to:"Map",convert:Dl}),Z.defaultContext=I,Z.realContext=V,Z.positiveContext=H;function G(X){return X.transform(function(te,ae,De){return zi(te)?G(te.content):te})}var Y={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};Z.rules=[p,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},f,{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}}},f,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function re(X,te){var ae={};if(X.s){var De=X.s.split("->");if(De.length===2)ae.l=De[0],ae.r=De[1];else throw SyntaxError("Could not parse rule: "+X.s)}else ae.l=X.l,ae.r=X.r;ae.l=G(n(ae.l)),ae.r=G(n(ae.r));for(var be of["imposeContext","repeat","assuming"])be in X&&(ae[be]=X[be]);if(X.evaluate&&(ae.evaluate=n(X.evaluate)),F(ae.l,te)){var K=!R(ae.l,te),W;K&&(W=he());var ue=L(ae.l),me=he();ae.expanded={},ae.expanded.l=ue([ae.l,me]),P(ae.expanded.l,te),T(ae.expanded.l,te),ae.expanded.r=ue([ae.r,me]),K&&(ae.expandedNC1={},ae.expandedNC1.l=ue([W,ae.l]),ae.expandedNC1.r=ue([W,ae.r]),ae.expandedNC2={},ae.expandedNC2.l=ue([W,ae.expanded.l]),ae.expandedNC2.r=ue([W,ae.expanded.r]))}return ae}function ne(X,te){for(var ae=[],De=0;De<X.length;De++){var be=X[De],K=void 0,W=typeof be;switch(W){case"string":be={s:be};case"object":K=re(be,te);break;case"function":K=be;break;default:throw TypeError("Unsupported type of rule: "+W)}ae.push(K)}return ae}var pe=0;function he(){return new N("_p"+pe++)}function le(X,te){var ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Sl(),De=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},be=De.consoleDebug;te=ne(te||Z.rules,De.context);var K=d(X,ae);K=G(K);for(var W={},ue=K.toString({parenthesis:"all"});!W[ue];){W[ue]=!0,pe=0;var me=ue;be&&console.log("Working on: ",ue);for(var we=0;we<te.length;we++){var _e="";if(typeof te[we]=="function"?(K=te[we](K,De),be&&(_e=te[we].name)):(P(K,De.context),K=xe(K,te[we],De.context),be&&(_e="".concat(te[we].l.toString()," -> ").concat(te[we].r.toString()))),be){var Ae=K.toString({parenthesis:"all"});Ae!==me&&(console.log("Applying",_e,"produced",Ae),me=Ae)}O(K,De.context)}ue=K.toString({parenthesis:"all"})}return K}function fe(X,te,ae){var De=X;if(X)for(var be=0;be<X.length;++be){var K=xe(X[be],te,ae);K!==X[be]&&(De===X&&(De=X.slice()),De[be]=K)}return De}function xe(X,te,ae){if(te.assuming){for(var De in te.assuming)for(var be in te.assuming[De])if(M(De,be,ae)!==te.assuming[De][be])return X}var K=k(te.imposeContext,ae),W=X;if(W instanceof A||W instanceof w){var ue=fe(W.args,te,ae);ue!==W.args&&(W=W.clone(),W.args=ue)}else if(W instanceof _){if(W.content){var me=xe(W.content,te,ae);me!==W.content&&(W=new _(me))}}else if(W instanceof x){var we=fe(W.items,te,ae);we!==W.items&&(W=new x(we))}else if(W instanceof D){var _e=W.object;W.object&&(_e=xe(W.object,te,ae));var Ae=W.index;W.index&&(Ae=xe(W.index,te,ae)),(_e!==W.object||Ae!==W.index)&&(W=new D(_e,Ae))}else if(W instanceof C){var Ce=fe(W.dimensions,te,ae);Ce!==W.dimensions&&(W=new C(Ce))}else if(W instanceof E){var Me=!1,Te={};for(var Ve in W.properties)Te[Ve]=xe(W.properties[Ve],te,ae),Te[Ve]!==W.properties[Ve]&&(Me=!0);Me&&(W=new E(Te))}var Re=te.r,dt=J(te.l,W,K)[0];if(!dt&&te.expanded&&(Re=te.expanded.r,dt=J(te.expanded.l,W,K)[0]),!dt&&te.expandedNC1&&(Re=te.expandedNC1.r,dt=J(te.expandedNC1.l,W,K)[0],dt||(Re=te.expandedNC2.r,dt=J(te.expandedNC2.l,W,K)[0])),dt){var Ze=W.implicit;W=Re.clone(),Ze&&"implicit"in Re&&(W.implicit=!0),W=W.transform(function(bt){return bt.isSymbolNode&&et(dt.placeholders,bt.name)?dt.placeholders[bt.name].clone():bt})}return te.repeat&&W!==X&&(W=xe(W,te,ae)),W}function ge(X,te){var ae=[],De,be,K=L(X);if(R(X,te))for(var W=0;W<X.args.length;W++)be=X.args.slice(0),be.splice(W,1),De=be.length===1?be[0]:K(be),ae.push(K([X.args[W],De]));else for(var ue=1;ue<X.args.length;ue++){var me=X.args[0];ue>1&&(me=K(X.args.slice(0,ue))),be=X.args.slice(ue),De=be.length===1?be[0]:K(be),ae.push(K([me,De]))}return ae}function ve(X,te){var ae={placeholders:{}};if(!X.placeholders&&!te.placeholders)return ae;if(X.placeholders){if(!te.placeholders)return X}else return te;for(var De in X.placeholders)if(et(X.placeholders,De)&&(ae.placeholders[De]=X.placeholders[De],et(te.placeholders,De)&&!ce(X.placeholders[De],te.placeholders[De])))return null;for(var be in te.placeholders)et(te.placeholders,be)&&(ae.placeholders[be]=te.placeholders[be]);return ae}function Ee(X,te){var ae=[];if(X.length===0||te.length===0)return ae;for(var De,be=0;be<X.length;be++)for(var K=0;K<te.length;K++)De=ve(X[be],te[K]),De&&ae.push(De);return ae}function q(X){if(X.length===0)return X;for(var te=X.reduce(Ee),ae=[],De={},be=0;be<te.length;be++){var K=JSON.stringify(te[be]);De[K]||(De[K]=!0,ae.push(te[be]))}return ae}function J(X,te,ae,De){var be=[{placeholders:{}}];if(X instanceof A&&te instanceof A||X instanceof w&&te instanceof w){if(X instanceof A){if(X.op!==te.op||X.fn!==te.fn)return[]}else if(X instanceof w&&X.name!==te.name)return[];if(te.args.length===1&&X.args.length===1||!F(te,ae)&&te.args.length===X.args.length||De){for(var K=[],W=0;W<X.args.length;W++){var ue=J(X.args[W],te.args[W],ae);if(ue.length===0)break;K.push(ue)}if(K.length!==X.args.length){if(!R(te,ae)||X.args.length===1)return[];if(X.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var me=J(X.args[0],te.args[1],ae);if(me.length===0)return[];var we=J(X.args[1],te.args[0],ae);if(we.length===0)return[];K=[me,we]}be=q(K)}else if(te.args.length>=2&&X.args.length===2){for(var _e=ge(te,ae),Ae=[],Ce=0;Ce<_e.length;Ce++){var Me=J(X,_e[Ce],ae,!0);Ae=Ae.concat(Me)}return Ae}else{if(X.args.length>2)throw Error("Unexpected non-binary associative function: "+X.toString());return[]}}else if(X instanceof N){if(X.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(Y[X.name]){if(X.name!==te.name)return[]}else switch(X.name[1]>="a"&&X.name[1]<="z"?X.name.substring(0,2):X.name[0]){case"n":case"_p":be[0].placeholders[X.name]=te;break;case"c":case"cl":if(Kt(te))be[0].placeholders[X.name]=te;else return[];break;case"v":if(!Kt(te))be[0].placeholders[X.name]=te;else return[];break;case"vl":if(en(te))be[0].placeholders[X.name]=te;else return[];break;case"cd":if(uk(te))be[0].placeholders[X.name]=te;else return[];break;case"vd":if(!uk(te))be[0].placeholders[X.name]=te;else return[];break;case"ce":if(Pg(te))be[0].placeholders[X.name]=te;else return[];break;case"ve":if(!Pg(te))be[0].placeholders[X.name]=te;else return[];break;default:throw new Error("Invalid symbol in rule: "+X.name)}}else if(X instanceof S){if(!c(X.value,te.value))return[]}else return[];return be}function ce(X,te){if(X instanceof S&&te instanceof S){if(!c(X.value,te.value))return!1}else if(X instanceof N&&te instanceof N){if(X.name!==te.name)return!1}else if(X instanceof A&&te instanceof A||X instanceof w&&te instanceof w){if(X instanceof A){if(X.op!==te.op||X.fn!==te.fn)return!1}else if(X instanceof w&&X.name!==te.name)return!1;if(X.args.length!==te.args.length)return!1;for(var ae=0;ae<X.args.length;ae++)if(!ce(X.args[ae],te.args[ae]))return!1}else return!1;return!0}return Z}),Lfe="simplifyConstant",Vfe=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],$g=Q(Lfe,Vfe,e=>{var{typed:t,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:d,ObjectNode:f,OperatorNode:p,SymbolNode:m}=e,{isCommutative:v,isAssociative:y,allChildren:b,createMakeNodeFunction:D}=Tw({FunctionNode:c,OperatorNode:p,SymbolNode:m}),x=t("simplifyConstant",{Node:P=>E(k(P,{})),"Node, Object":function(T,O){return E(k(T,O))}});function S(P){return Mo(P)?P.valueOf():P instanceof Array?P.map(S):ft(P)?i(S(P.valueOf())):P}function w(P,T,O){try{return n[P].apply(null,T)}catch{return T=T.map(S),_(n[P].apply(null,T),O)}}var C=t({Fraction:M,number:function(T){return T<0?N(new u(-T)):new u(T)},BigNumber:function(T){return T<0?N(new u(-T)):new u(T)},Complex:function(T){throw new Error("Cannot convert Complex number to Node")},string:function(T){return new u(T)},Matrix:function(T){return new l(T.valueOf().map(O=>C(O)))}});function E(P){return sr(P)?P:C(P)}function A(P,T){var O=T&&T.exactFractions!==!1;if(O&&isFinite(P)&&a){var L=a(P),I=T&&typeof T.fractionsLimit=="number"?T.fractionsLimit:1/0;if(L.valueOf()===P&&L.n<I&&L.d<I)return L}return P}var _=t({"string, Object":function(T,O){if(r.number==="BigNumber")return o===void 0&&gw(),o(T);if(r.number==="Fraction")return a===void 0&&mR(),a(T);var L=parseFloat(T);return A(L,O)},"Fraction, Object":function(T,O){return T},"BigNumber, Object":function(T,O){return T},"number, Object":function(T,O){return A(T,O)},"Complex, Object":function(T,O){return T.im!==0?T:A(T.re,O)},"Matrix, Object":function(T,O){return i(A(T.valueOf()))},"Array, Object":function(T,O){return T.map(A)}});function N(P){return new p("-","unaryMinus",[P])}function M(P){var T,O=P.s*P.n;return O<0?T=new p("-","unaryMinus",[new u(-O)]):T=new u(O),P.d===1?T:new p("/","divide",[T,new u(P.d)])}function R(P,T,O){if(!To(T))return new s(E(P),E(T));if(Yn(P)||ft(P)){for(var L=Array.from(T.dimensions);L.length>0;)if(Kt(L[0])&&typeof L[0].value!="string"){var I=_(L.shift().value,O);Yn(P)?P=P.items[I-1]:(P=P.valueOf()[I-1],P instanceof Array&&(P=i(P)))}else if(L.length>1&&Kt(L[1])&&typeof L[1].value!="string"){var V=_(L[1].value,O),H=[],Z=Yn(P)?P.items:P.valueOf();for(var G of Z)if(Yn(G))H.push(G.items[V-1]);else if(ft(P))H.push(G[V-1]);else break;if(H.length===Z.length)Yn(P)?P=new l(H):P=i(H),L.splice(1,1);else break}else break;return L.length===T.dimensions.length?new s(E(P),T):L.length>0?(T=new d(L),new s(E(P),T)):P}if(vl(P)&&T.dimensions.length===1&&Kt(T.dimensions[0])){var Y=T.dimensions[0].value;return Y in P.properties?P.properties[Y]:new u}return new s(E(P),T)}function F(P,T,O,L){var I=T.shift(),V=T.reduce((H,Z)=>{if(!sr(Z)){var G=H.pop();if(sr(G))return[G,Z];try{return H.push(w(P,[G,Z],L)),H}catch{H.push(G)}}H.push(E(H.pop()));var Y=H.length===1?H[0]:O(H);return[O([Y,E(Z)])]},[I]);return V.length===1?V[0]:O([V[0],C(V[1])])}function k(P,T){switch(P.type){case"SymbolNode":return P;case"ConstantNode":switch(typeof P.value){case"number":return _(P.value,T);case"string":return P.value;default:if(!isNaN(P.value))return _(P.value,T)}return P;case"FunctionNode":if(n[P.name]&&n[P.name].rawArgs)return P;{var O=["add","multiply"];if(O.indexOf(P.name)===-1){var L=P.args.map(xe=>k(xe,T));if(!L.some(sr))try{return w(P.name,L,T)}catch{}if(P.name==="size"&&L.length===1&&Yn(L[0])){for(var I=[],V=L[0];Yn(V);)I.push(V.items.length),V=V.items[0];return i(I)}return new c(P.name,L.map(E))}}case"OperatorNode":{var H=P.fn.toString(),Z,G,Y=D(P);if(Wr(P)&&P.isUnary())Z=[k(P.args[0],T)],sr(Z[0])?G=Y(Z):G=w(H,Z,T);else if(y(P,T.context))if(Z=b(P,T.context),Z=Z.map(xe=>k(xe,T)),v(H,T.context)){for(var re=[],ne=[],pe=0;pe<Z.length;pe++)sr(Z[pe])?ne.push(Z[pe]):re.push(Z[pe]);re.length>1?(G=F(H,re,Y,T),ne.unshift(G),G=F(H,ne,Y,T)):G=F(H,Z,Y,T)}else G=F(H,Z,Y,T);else Z=P.args.map(xe=>k(xe,T)),G=F(H,Z,Y,T);return G}case"ParenthesisNode":return k(P.content,T);case"AccessorNode":return R(k(P.object,T),k(P.index,T),T);case"ArrayNode":{var he=P.items.map(xe=>k(xe,T));return he.some(sr)?new l(he.map(E)):i(he)}case"IndexNode":return new d(P.dimensions.map(xe=>x(xe,T)));case"ObjectNode":{var le={};for(var fe in P.properties)le[fe]=x(P.properties[fe],T);return new f(le)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(P.type))}}return x}),dk="simplifyCore",qfe=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Bg=Q(dk,qfe,e=>{var{typed:t,parse:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,AccessorNode:c,ArrayNode:d,ConstantNode:f,FunctionNode:p,IndexNode:m,ObjectNode:v,OperatorNode:y,ParenthesisNode:b,SymbolNode:D}=e,x=new f(0),S=new f(1),w=new f(!0),C=new f(!1);function E(M){return Wr(M)&&["and","not","or"].includes(M.op)}var{hasProperty:A,isCommutative:_}=Tw({FunctionNode:p,OperatorNode:y,SymbolNode:D});function N(M){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},F=R?R.context:void 0;if(A(M,"trivial",F)){if(ya(M)&&M.args.length===1)return N(M.args[0],R);var k=!1,P=0;if(M.forEach(ne=>{++P,P===1&&(k=N(ne,R))}),P===1)return k}var T=M;if(ya(T)){var O=hoe(T.name);if(O){if(T.args.length>2&&A(T,"associative",F))for(;T.args.length>2;){var L=T.args.pop(),I=T.args.pop();T.args.push(new y(O,T.name,[L,I]))}T=new y(O,T.name,T.args)}else return new p(N(T.fn),T.args.map(ne=>N(ne,R)))}if(Wr(T)&&T.isUnary()){var V=N(T.args[0],R);if(T.op==="~"&&Wr(V)&&V.isUnary()&&V.op==="~"||T.op==="not"&&Wr(V)&&V.isUnary()&&V.op==="not"&&E(V.args[0]))return V.args[0];var H=!0;if(T.op==="-"&&Wr(V)&&(V.isBinary()&&V.fn==="subtract"&&(T=new y("-","subtract",[V.args[1],V.args[0]]),H=!1),V.isUnary()&&V.op==="-"))return V.args[0];if(H)return new y(T.op,T.fn,[V])}if(Wr(T)&&T.isBinary()){var Z=N(T.args[0],R),G=N(T.args[1],R);if(T.op==="+"){if(Kt(Z)&&i(Z.value))return G;if(Kt(G)&&i(G.value))return Z;Wr(G)&&G.isUnary()&&G.op==="-"&&(G=G.args[0],T=new y("-","subtract",[Z,G]))}if(T.op==="-")return Wr(G)&&G.isUnary()&&G.op==="-"?N(new y("+","add",[Z,G.args[0]]),R):Kt(Z)&&i(Z.value)?N(new y("-","unaryMinus",[G])):Kt(G)&&i(G.value)?Z:new y(T.op,T.fn,[Z,G]);if(T.op==="*"){if(Kt(Z)){if(i(Z.value))return x;if(n(Z.value,1))return G}if(Kt(G)){if(i(G.value))return x;if(n(G.value,1))return Z;if(_(T,F))return new y(T.op,T.fn,[G,Z],T.implicit)}return new y(T.op,T.fn,[Z,G],T.implicit)}if(T.op==="/")return Kt(Z)&&i(Z.value)?x:Kt(G)&&n(G.value,1)?Z:new y(T.op,T.fn,[Z,G]);if(T.op==="^"&&Kt(G)){if(i(G.value))return S;if(n(G.value,1))return Z}if(T.op==="and"){if(Kt(Z))if(Z.value){if(E(G))return G}else return C;if(Kt(G))if(G.value){if(E(Z))return Z}else return C}if(T.op==="or"){if(Kt(Z)){if(Z.value)return w;if(E(G))return G}if(Kt(G)){if(G.value)return w;if(E(Z))return Z}}return new y(T.op,T.fn,[Z,G])}if(Wr(T))return new y(T.op,T.fn,T.args.map(ne=>N(ne,R)));if(Yn(T))return new d(T.items.map(ne=>N(ne,R)));if(Ka(T))return new c(N(T.object,R),N(T.index,R));if(To(T))return new m(T.dimensions.map(ne=>N(ne,R)));if(vl(T)){var Y={};for(var re in T.properties)Y[re]=N(T.properties[re],R);return new v(Y)}return T}return t(dk,{Node:N,"Node,Object":N})}),Gfe="resolve",Ufe=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],zg=Q(Gfe,Ufe,e=>{var{typed:t,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(l,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!u)return l;if(en(l)){if(c.has(l.name)){var d=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(d,"}"))}var f=u.get(l.name);if(sr(f)){var p=new Set(c);return p.add(l.name),s(f,u,p)}else return typeof f=="number"?r(String(f)):f!==void 0?new n(f):l}else if(Wr(l)){var m=l.args.map(function(y){return s(y,u,c)});return new a(l.op,l.fn,m,l.implicit)}else{if(zi(l))return new o(s(l.content,u,c));if(ya(l)){var v=l.args.map(function(y){return s(y,u,c)});return new i(l.name,v)}}return l.map(y=>s(y,u,c))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(l,u)=>s(l,Dl(u)),"Array | Matrix":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array | Matrix, null | undefined":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array, Object":t.referTo("Array,Map",l=>(u,c)=>l(u,Dl(c))),"Matrix, Object":t.referTo("Matrix,Map",l=>(u,c)=>l(u,Dl(c))),"Array | Matrix, Map":t.referToSelf(l=>(u,c)=>u.map(d=>l(d,c)))})}),fk="symbolicEqual",Wfe=["parse","simplify","typed","OperatorNode"],Lg=Q(fk,Wfe,e=>{var{parse:t,simplify:r,typed:n,OperatorNode:i}=e;function a(o,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=new i("-","subtract",[o,s]),c=r(u,{},l);return Kt(c)&&!c.value}return n(fk,{"Node, Node":a,"Node, Node, Object":a})}),pk="derivative",Hfe=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Vg=Q(pk,Hfe,e=>{var{typed:t,config:r,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:l,FunctionNode:u,OperatorNode:c,ParenthesisNode:d,SymbolNode:f}=e;function p(S,w){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},E={};y(E,S,w.name);var A=b(S,E);return C.simplify?i(A):A}t.addConversion({from:"identifier",to:"SymbolNode",convert:n});var m=t(pk,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p});t.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),m._simplify=!0,m.toTex=function(S){return v.apply(null,S.args)};var v=t("_derivTex",{"Node, SymbolNode":function(w,C){return Kt(w)&&Or(w.value)==="string"?v(n(w.value).toString(),C.toString(),1):v(w.toTex(),C.toString(),1)},"Node, ConstantNode":function(w,C){if(Or(C.value)==="string")return v(w,n(C.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(w,C,E){return v(w.toString(),C.name,E.value)},"string, string, number":function(w,C,E){var A;return E===1?A="{d\\over d"+C+"}":A="{d^{"+E+"}\\over d"+C+"^{"+E+"}}",A+"\\left[".concat(w,"\\right]")}}),y=t("constTag",{"Object, ConstantNode, string":function(w,C){return w[C]=!0,!0},"Object, SymbolNode, string":function(w,C,E){return C.name!==E?(w[C]=!0,!0):!1},"Object, ParenthesisNode, string":function(w,C,E){return y(w,C.content,E)},"Object, FunctionAssignmentNode, string":function(w,C,E){return C.params.indexOf(E)===-1?(w[C]=!0,!0):y(w,C.expr,E)},"Object, FunctionNode | OperatorNode, string":function(w,C,E){if(C.args.length>0){for(var A=y(w,C.args[0],E),_=1;_<C.args.length;++_)A=y(w,C.args[_],E)&&A;if(A)return w[C]=!0,!0}return!1}}),b=t("_derivative",{"ConstantNode, Object":function(w){return x(0)},"SymbolNode, Object":function(w,C){return C[w]!==void 0?x(0):x(1)},"ParenthesisNode, Object":function(w,C){return new d(b(w.content,C))},"FunctionAssignmentNode, Object":function(w,C){return C[w]!==void 0?x(0):b(w.expr,C)},"FunctionNode, Object":function(w,C){if(w.args.length!==1&&D(w),C[w]!==void 0)return x(0);var E=w.args[0],A,_=!1,N=!1,M;switch(w.name){case"cbrt":_=!0,M=new c("*","multiply",[x(3),new c("^","pow",[E,new c("/","divide",[x(2),x(3)])])]);break;case"sqrt":case"nthRoot":if(w.args.length===1)_=!0,M=new c("*","multiply",[x(2),new u("sqrt",[E])]);else if(w.args.length===2)return A=new c("/","divide",[x(1),w.args[1]]),C[A]=C[w.args[1]],b(new c("^","pow",[E,A]),C);break;case"log10":A=x(10);case"log":if(!A&&w.args.length===1)M=E.clone(),_=!0;else if(w.args.length===1&&A||w.args.length===2&&C[w.args[1]]!==void 0)M=new c("*","multiply",[E.clone(),new u("log",[A||w.args[1]])]),_=!0;else if(w.args.length===2)return b(new c("/","divide",[new u("log",[E]),new u("log",[w.args[1]])]),C);break;case"pow":return C[A]=C[w.args[1]],b(new c("^","pow",[E,w.args[1]]),C);case"exp":M=new u("exp",[E.clone()]);break;case"sin":M=new u("cos",[E.clone()]);break;case"cos":M=new c("-","unaryMinus",[new u("sin",[E.clone()])]);break;case"tan":M=new c("^","pow",[new u("sec",[E.clone()]),x(2)]);break;case"sec":M=new c("*","multiply",[w,new u("tan",[E.clone()])]);break;case"csc":N=!0,M=new c("*","multiply",[w,new u("cot",[E.clone()])]);break;case"cot":N=!0,M=new c("^","pow",[new u("csc",[E.clone()]),x(2)]);break;case"asin":_=!0,M=new u("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])])]);break;case"acos":_=!0,N=!0,M=new u("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])])]);break;case"atan":_=!0,M=new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)]);break;case"asec":_=!0,M=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),x(2)]),x(1)])])]);break;case"acsc":_=!0,N=!0,M=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),x(2)]),x(1)])])]);break;case"acot":_=!0,N=!0,M=new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)]);break;case"sinh":M=new u("cosh",[E.clone()]);break;case"cosh":M=new u("sinh",[E.clone()]);break;case"tanh":M=new c("^","pow",[new u("sech",[E.clone()]),x(2)]);break;case"sech":N=!0,M=new c("*","multiply",[w,new u("tanh",[E.clone()])]);break;case"csch":N=!0,M=new c("*","multiply",[w,new u("coth",[E.clone()])]);break;case"coth":N=!0,M=new c("^","pow",[new u("csch",[E.clone()]),x(2)]);break;case"asinh":_=!0,M=new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)])]);break;case"acosh":_=!0,M=new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),x(2)]),x(1)])]);break;case"atanh":_=!0,M=new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])]);break;case"asech":_=!0,N=!0,M=new c("*","multiply",[E.clone(),new u("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])])])]);break;case"acsch":_=!0,N=!0,M=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)])])]);break;case"acoth":_=!0,N=!0,M=new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])]);break;case"abs":M=new c("/","divide",[new u(new f("abs"),[E.clone()]),E.clone()]);break;case"gamma":default:throw new Error('Function "'+w.name+'" is not supported by derivative, or a wrong number of arguments is passed')}var R,F;_?(R="/",F="divide"):(R="*",F="multiply");var k=b(E,C);return N&&(k=new c("-","unaryMinus",[k])),new c(R,F,[k,M])},"OperatorNode, Object":function(w,C){if(C[w]!==void 0)return x(0);if(w.op==="+")return new c(w.op,w.fn,w.args.map(function(T){return b(T,C)}));if(w.op==="-"){if(w.isUnary())return new c(w.op,w.fn,[b(w.args[0],C)]);if(w.isBinary())return new c(w.op,w.fn,[b(w.args[0],C),b(w.args[1],C)])}if(w.op==="*"){var E=w.args.filter(function(T){return C[T]!==void 0});if(E.length>0){var A=w.args.filter(function(T){return C[T]===void 0}),_=A.length===1?A[0]:new c("*","multiply",A),N=E.concat(b(_,C));return new c("*","multiply",N)}return new c("+","add",w.args.map(function(T){return new c("*","multiply",w.args.map(function(O){return O===T?b(O,C):O.clone()}))}))}if(w.op==="/"&&w.isBinary()){var M=w.args[0],R=w.args[1];return C[R]!==void 0?new c("/","divide",[b(M,C),R]):C[M]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[M]),new c("/","divide",[b(R,C),new c("^","pow",[R.clone(),x(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[b(M,C),R.clone()]),new c("*","multiply",[M.clone(),b(R,C)])]),new c("^","pow",[R.clone(),x(2)])])}if(w.op==="^"&&w.isBinary()){var F=w.args[0],k=w.args[1];if(C[F]!==void 0)return Kt(F)&&(o(F.value)||a(F.value,1))?x(0):new c("*","multiply",[w,new c("*","multiply",[new u("log",[F.clone()]),b(k.clone(),C)])]);if(C[k]!==void 0){if(Kt(k)){if(o(k.value))return x(0);if(a(k.value,1))return b(F,C)}var P=new c("^","pow",[F.clone(),new c("-","subtract",[k,x(1)])]);return new c("*","multiply",[k.clone(),new c("*","multiply",[b(F,C),P])])}return new c("*","multiply",[new c("^","pow",[F.clone(),k.clone()]),new c("+","add",[new c("*","multiply",[b(F,C),new c("/","divide",[k.clone(),F.clone()])]),new c("*","multiply",[b(k,C),new u("log",[F.clone()])])])])}throw new Error('Operator "'+w.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function D(S){if(!((S.name==="log"||S.name==="nthRoot"||S.name==="pow")&&S.args.length===2)){for(var w=0;w<S.args.length;++w)S.args[w]=x(0);throw S.compile().evaluate(),new Error("Expected TypeError, but none found")}}function x(S,w){return new l(s(S,w||r.number))}return m}),hk="rationalize",jfe=["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"],qg=Q(hk,jfe,e=>{var{config:t,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,parse:c,simplifyConstant:d,simplifyCore:f,simplify:p,fraction:m,bignumber:v,mathWithTransform:y,matrix:b,AccessorNode:D,ArrayNode:x,ConstantNode:S,FunctionNode:w,IndexNode:C,ObjectNode:E,OperatorNode:A,SymbolNode:_,ParenthesisNode:N}=e;function M(T){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,I=F(),V=R(T,O,!0,I.firstRules),H=V.variables.length,Z={exactFractions:!1},G={exactFractions:!0};if(T=V.expression,H>=1){T=k(T);var Y,re,ne=!0,pe=!1;T=p(T,I.firstRules,{},Z);for(var he;re=ne?I.distrDivRules:I.sucDivRules,T=p(T,re,{},G),ne=!ne,he=T.toString(),he!==Y;)pe=!0,Y=he;pe&&(T=p(T,I.firstRulesAgain,{},Z)),T=p(T,I.finalRules,{},Z)}var le=[],fe={};return T.type==="OperatorNode"&&T.isBinary()&&T.op==="/"?(H===1&&(T.args[0]=P(T.args[0],le),T.args[1]=P(T.args[1])),L&&(fe.numerator=T.args[0],fe.denominator=T.args[1])):(H===1&&(T=P(T,le)),L&&(fe.numerator=T,fe.denominator=null)),L?(fe.coefficients=le,fe.variables=V.variables,fe.expression=T,fe):T}return r(hk,{Node:M,"Node, boolean":(T,O)=>M(T,{},O),"Node, Object":M,"Node, Object, boolean":M});function R(T,O,L,I){var V=[],H=p(T,I,O,{exactFractions:!1});L=!!L;var Z="+-*"+(L?"/":"");Y(H);var G={};return G.expression=H,G.variables=V,G;function Y(re){var ne=re.type;if(ne==="FunctionNode")throw new Error("There is an unsolved function call");if(ne==="OperatorNode")if(re.op==="^"){if(re.args[1].type!=="ConstantNode"||!ot(parseFloat(re.args[1].value)))throw new Error("There is a non-integer exponent");Y(re.args[0])}else{if(Z.indexOf(re.op)===-1)throw new Error("Operator "+re.op+" invalid in polynomial expression");for(var pe=0;pe<re.args.length;pe++)Y(re.args[pe])}else if(ne==="SymbolNode"){var he=re.name,le=V.indexOf(he);le===-1&&V.push(he)}else if(ne==="ParenthesisNode")Y(re.content);else if(ne!=="ConstantNode")throw new Error("type "+ne+" is not allowed in polynomial expression")}}function F(){var T=[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"}],O=[{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)"}],L=[{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)"}],I=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],V={};return V.firstRules=T.concat(O,I),V.distrDivRules=L,V.sucDivRules=I,V.firstRulesAgain=T.concat(O),V.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))"}],V}function k(T,O,L){var I=T.type,V=arguments.length>1;if(I==="OperatorNode"&&T.isBinary()){var H=!1,Z;if(T.op==="^"&&(T.args[0].type==="ParenthesisNode"||T.args[0].type==="OperatorNode")&&T.args[1].type==="ConstantNode"&&(Z=parseFloat(T.args[1].value),H=Z>=2&&ot(Z)),H){if(Z>2){var G=T.args[0],Y=new A("^","pow",[T.args[0].cloneDeep(),new S(Z-1)]);T=new A("*","multiply",[G,Y])}else T=new A("*","multiply",[T.args[0],T.args[0].cloneDeep()]);V&&(L==="content"?O.content=T:O.args[L]=T)}}if(I==="ParenthesisNode")k(T.content,T,"content");else if(I!=="ConstantNode"&&I!=="SymbolNode")for(var re=0;re<T.args.length;re++)k(T.args[re],T,re);if(!V)return T}function P(T,O){O===void 0&&(O=[]),O[0]=0;var L={};L.cte=1,L.oper="+",L.fire="";var I=0,V="";he(T,null,L),I=O.length-1;for(var H=!0,Z,G=I;G>=0;G--)if(O[G]!==0){var Y=new S(H?O[G]:Math.abs(O[G])),re=O[G]<0?"-":"+";if(G>0){var ne=new _(V);if(G>1){var pe=new S(G);ne=new A("^","pow",[ne,pe])}O[G]===-1&&H?Y=new A("-","unaryMinus",[ne]):Math.abs(O[G])===1?Y=ne:Y=new A("*","multiply",[Y,ne])}H?Z=Y:re==="+"?Z=new A("+","add",[Z,Y]):Z=new A("-","subtract",[Z,Y]),H=!1}if(H)return new S(0);return Z;function he(le,fe,xe){var ge=le.type;if(ge==="FunctionNode")throw new Error("There is an unsolved function call");if(ge==="OperatorNode"){if("+-*^".indexOf(le.op)===-1)throw new Error("Operator "+le.op+" invalid");if(fe!==null){if((le.fn==="unaryMinus"||le.fn==="pow")&&fe.fn!=="add"&&fe.fn!=="subtract"&&fe.fn!=="multiply")throw new Error("Invalid "+le.op+" placing");if((le.fn==="subtract"||le.fn==="add"||le.fn==="multiply")&&fe.fn!=="add"&&fe.fn!=="subtract")throw new Error("Invalid "+le.op+" placing");if((le.fn==="subtract"||le.fn==="add"||le.fn==="unaryMinus")&&xe.noFil!==0)throw new Error("Invalid "+le.op+" placing")}(le.op==="^"||le.op==="*")&&(xe.fire=le.op);for(var ve=0;ve<le.args.length;ve++)le.fn==="unaryMinus"&&(xe.oper="-"),(le.op==="+"||le.fn==="subtract")&&(xe.fire="",xe.cte=1,xe.oper=ve===0?"+":le.op),xe.noFil=ve,he(le.args[ve],le,xe)}else if(ge==="SymbolNode"){if(le.name!==V&&V!=="")throw new Error("There is more than one variable");if(V=le.name,fe===null){O[1]=1;return}if(fe.op==="^"&&xe.noFil!==0)throw new Error("In power the variable should be the first parameter");if(fe.op==="*"&&xe.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(xe.fire===""||xe.fire==="*")&&(I<1&&(O[1]=0),O[1]+=xe.cte*(xe.oper==="+"?1:-1),I=Math.max(1,I))}else if(ge==="ConstantNode"){var Ee=parseFloat(le.value);if(fe===null){O[0]=Ee;return}if(fe.op==="^"){if(xe.noFil!==1)throw new Error("Constant cannot be powered");if(!ot(Ee)||Ee<=0)throw new Error("Non-integer exponent is not allowed");for(var q=I+1;q<Ee;q++)O[q]=0;Ee>I&&(O[Ee]=0),O[Ee]+=xe.cte*(xe.oper==="+"?1:-1),I=Math.max(Ee,I);return}xe.cte=Ee,xe.fire===""&&(O[0]+=xe.cte*(xe.oper==="+"?1:-1))}else throw new Error("Type "+ge+" is not allowed")}}}),Kfe="reviver",Yfe=["classes"],Gg=Q(Kfe,Yfe,e=>{var{classes:t}=e;return function(n,i){var a=t[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}}),Xfe="replacer",Zfe=[],Ug=Q(Xfe,Zfe,()=>function(t,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r}),Qfe="11.7.0",Wg=Q("true",[],()=>!0),Hg=Q("false",[],()=>!1),jg=Q("null",[],()=>null),Kg=ai("Infinity",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1/0):1/0}),Yg=ai("NaN",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(NaN):NaN}),Xg=ai("pi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?xw(r):ote}),Zg=ai("tau",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?fae(r):ste}),Qg=ai("e",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?cae(r):lte}),Jg=ai("phi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?dae(r):ute}),e0=ai("LN2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).ln():Math.LN2}),t0=ai("LN10",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(10).ln():Math.LN10}),r0=ai("LOG2E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),n0=ai("LOG10E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),i0=ai("SQRT1_2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),a0=ai("SQRT2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),o0=ai("i",["Complex"],e=>{var{Complex:t}=e;return t.I}),Ow=Q("PI",["pi"],e=>{var{pi:t}=e;return t}),Rw=Q("E",["e"],e=>{var{e:t}=e;return t}),s0=Q("version",[],()=>Qfe);function ai(e,t,r){return Q(e,t,r,{recreateOnConfigChange:!0})}var l0=At("speedOfLight","299792458","m s^-1"),u0=At("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),c0=At("planckConstant","6.62607015e-34","J s"),d0=At("reducedPlanckConstant","1.0545718176461565e-34","J s"),f0=At("magneticConstant","1.25663706212e-6","N A^-2"),p0=At("electricConstant","8.8541878128e-12","F m^-1"),h0=At("vacuumImpedance","376.730313667","ohm"),m0=At("coulomb","8.987551792261171e9","N m^2 C^-2"),v0=At("elementaryCharge","1.602176634e-19","C"),g0=At("bohrMagneton","9.2740100783e-24","J T^-1"),y0=At("conductanceQuantum","7.748091729863649e-5","S"),b0=At("inverseConductanceQuantum","12906.403729652257","ohm"),x0=At("magneticFluxQuantum","2.0678338484619295e-15","Wb"),w0=At("nuclearMagneton","5.0507837461e-27","J T^-1"),C0=At("klitzing","25812.807459304513","ohm"),S0=At("bohrRadius","5.29177210903e-11","m"),D0=At("classicalElectronRadius","2.8179403262e-15","m"),E0=At("electronMass","9.1093837015e-31","kg"),N0=At("fermiCoupling","1.1663787e-5","GeV^-2"),A0=iy("fineStructure",.0072973525693),_0=At("hartreeEnergy","4.3597447222071e-18","J"),M0=At("protonMass","1.67262192369e-27","kg"),T0=At("deuteronMass","3.3435830926e-27","kg"),O0=At("neutronMass","1.6749271613e-27","kg"),R0=At("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),I0=At("rydberg","10973731.568160","m^-1"),k0=At("thomsonCrossSection","6.6524587321e-29","m^2"),P0=iy("weakMixingAngle",.2229),F0=iy("efimovFactor",22.7),$0=At("atomicMass","1.66053906660e-27","kg"),B0=At("avogadro","6.02214076e23","mol^-1"),z0=At("boltzmann","1.380649e-23","J K^-1"),L0=At("faraday","96485.33212331001","C mol^-1"),V0=At("firstRadiation","3.7417718521927573e-16","W m^2"),q0=At("loschmidt","2.686780111798444e25","m^-3"),G0=At("gasConstant","8.31446261815324","J K^-1 mol^-1"),U0=At("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),W0=At("molarVolume","0.022413969545014137","m^3 mol^-1"),H0=iy("sackurTetrode",-1.16487052358),j0=At("secondRadiation","0.014387768775039337","m K"),K0=At("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Y0=At("wienDisplacement","2.897771955e-3","m K"),X0=At("molarMass","0.99999999965e-3","kg mol^-1"),Z0=At("molarMassC12","11.9999999958e-3","kg mol^-1"),Q0=At("gravity","9.80665","m s^-2"),J0=At("planckLength","1.616255e-35","m"),ey=At("planckMass","2.176435e-8","kg"),ty=At("planckTime","5.391245e-44","s"),ry=At("planckCharge","1.87554603778e-18","C"),ny=At("planckTemperature","1.416785e+32","K");function At(e,t,r){var n=["config","Unit","BigNumber"];return Q(e,n,i=>{var{config:a,Unit:o,BigNumber:s}=i,l=a.number==="BigNumber"?new s(t):parseFloat(t),u=new o(l,r);return u.fixPrefix=!0,u})}function iy(e,t){var r=["config","BigNumber"];return Q(e,r,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(t):t})}var Jfe="apply",epe=["typed","isInteger"],ay=Q(Jfe,epe,e=>{var{typed:t,isInteger:r}=e,n=Ju({typed:t,isInteger:r});return t("apply",{"...any":function(a){var o=a[1];Ut(o)?a[1]=o-1:kt(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw Gn(s)}}})},{isTransformFunction:!0}),tpe="column",rpe=["typed","Index","matrix","range"],oy=Q(tpe,rpe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=rc({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(s){var l=s.length-1,u=s[l];Ut(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Gn(c)}}})},{isTransformFunction:!0});function Iw(e,t,r){var n=e.filter(function(s){return en(s)&&!(s.name in t)&&!r.has(s.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=fc(r),o=e.compile();return function(l){return a.set(i,l),o.evaluate(a)}}var npe="filter",ipe=["typed"],sy=Q(npe,ipe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(en(i[1])||hs(i[1])?l=i[1].compile().evaluate(o):l=Iw(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("filter",{"Array, function":mk,"Matrix, function":function(a,o){return a.create(mk(a.toArray(),o))},"Array, RegExp":Cf,"Matrix, RegExp":function(a,o){return a.create(Cf(a.toArray(),o))}});return r},{isTransformFunction:!0});function mk(e,t){var r=$o(t);return kM(e,function(n,i,a){return r===1?t(n):r===2?t(n,[i+1]):t(n,[i+1],a)})}var ape="forEach",ope=["typed"],ly=Q(ape,ope,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(en(i[1])||hs(i[1])?l=i[1].compile().evaluate(o):l=Iw(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("forEach",{"Array | Matrix, function":function(a,o){var s=$o(o),l=function u(c,d){Array.isArray(c)?wf(c,function(f,p){u(f,d.concat(p+1))}):s===1?o(c):s===2?o(c,d):o(c,d,a)};l(a.valueOf(),[])}});return r},{isTransformFunction:!0}),spe="index",lpe=["Index"],uy=Q(spe,lpe,e=>{var{Index:t}=e;return function(){for(var n=[],i=0,a=arguments.length;i<a;i++){var o=arguments[i];if(Uu(o))o.start--,o.end-=o.step>0?0:2;else if(o&&o.isSet===!0)o=o.map(function(l){return l-1});else if(or(o)||ft(o))o=o.map(function(l){return l-1});else if(Ut(o))o--;else if(kt(o))o=o.toNumber()-1;else if(typeof o!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");n[i]=o}var s=new t;return t.apply(s,n),s}},{isTransformFunction:!0}),upe="map",cpe=["typed"],cy=Q(upe,cpe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(en(i[1])||hs(i[1])?l=i[1].compile().evaluate(o):l=Iw(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("map",{"Array, function":function(a,o){return vk(a,o,a)},"Matrix, function":function(a,o){return a.create(vk(a.valueOf(),o,a))}});return r},{isTransformFunction:!0});function vk(e,t,r){var n=$o(t);function i(a,o){return Array.isArray(a)?Ya(a,function(s,l){return i(s,o.concat(l+1))}):n===1?t(a):n===2?t(a,o):t(a,o,r)}return i(e,[])}function bs(e){if(e.length===2&&xi(e[0])){e=e.slice();var t=e[1];Ut(t)?e[1]=t-1:kt(t)&&(e[1]=t.minus(1))}return e}var dpe="max",fpe=["typed","config","numeric","larger"],dy=Q(dpe,fpe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e,a=lc({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),ppe="mean",hpe=["typed","add","divide"],fy=Q(ppe,hpe,e=>{var{typed:t,add:r,divide:n}=e,i=mc({typed:t,add:r,divide:n});return t("mean",{"...any":function(o){o=bs(o);try{return i.apply(null,o)}catch(s){throw Gn(s)}}})},{isTransformFunction:!0}),mpe="min",vpe=["typed","config","numeric","smaller"],py=Q(mpe,vpe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e,a=uc({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),gpe="range",ype=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],hy=Q(gpe,ype,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l}=e,u=ic({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l});return t("range",{"...any":function(d){var f=d.length-1,p=d[f];return typeof p!="boolean"&&d.push(!0),u.apply(null,d)}})},{isTransformFunction:!0}),bpe="row",xpe=["typed","Index","matrix","range"],my=Q(bpe,xpe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=ac({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(s){var l=s.length-1,u=s[l];Ut(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Gn(c)}}})},{isTransformFunction:!0}),wpe="subset",Cpe=["typed","matrix"],vy=Q(wpe,Cpe,e=>{var{typed:t,matrix:r}=e,n=oc({typed:t,matrix:r});return t("subset",{"...any":function(a){try{return n.apply(null,a)}catch(o){throw Gn(o)}}})},{isTransformFunction:!0}),Spe="concat",Dpe=["typed","matrix","isInteger"],gy=Q(Spe,Dpe,e=>{var{typed:t,matrix:r,isInteger:n}=e,i=tc({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(o){var s=o.length-1,l=o[s];Ut(l)?o[s]=l-1:kt(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw Gn(u)}}})},{isTransformFunction:!0}),gk="diff",Epe=["typed","matrix","subtract","number","bignumber"],yy=Q(gk,Epe,e=>{var{typed:t,matrix:r,subtract:n,number:i,bignumber:a}=e,o=nc({typed:t,matrix:r,subtract:n,number:i,bignumber:a});return t(gk,{"...any":function(l){l=bs(l);try{return o.apply(null,l)}catch(u){throw Gn(u)}}})},{isTransformFunction:!0}),Npe="std",Ape=["typed","map","sqrt","variance"],by=Q(Npe,Ape,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e,a=gc({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),yk="sum",_pe=["typed","config","add","numeric"],xy=Q(yk,_pe,e=>{var{typed:t,config:r,add:n,numeric:i}=e,a=pc({typed:t,config:r,add:n,numeric:i});return t(yk,{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),bk="cumsum",Mpe=["typed","add","unaryPlus"],wy=Q(bk,Mpe,e=>{var{typed:t,add:r,unaryPlus:n}=e,i=hc({typed:t,add:r,unaryPlus:n});return t(bk,{"...any":function(o){if(o.length===2&&xi(o[0])){var s=o[1];Ut(s)?o[1]=s-1:kt(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),xk="variance",Tpe=["typed","add","subtract","multiply","divide","apply","isNaN"],Cy=Q(xk,Tpe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e,l=vc({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return t(xk,{"...any":function(c){c=bs(c);try{return l.apply(null,c)}catch(d){throw Gn(d)}}})},{isTransformFunction:!0});const Ope=Object.freeze(Object.defineProperty({__proto__:null,createTyped:Df,createResultSet:Nf,createBigNumberClass:kf,createComplexClass:Pf,createFractionClass:Ff,createRangeClass:$f,createMatrixClass:Bf,createDenseMatrixClass:zf,createClone:Lf,createIsInteger:Gf,createIsNegative:jf,createIsNumeric:Kf,createHasNumericValue:Yf,createIsPositive:Xf,createIsZero:Zf,createIsNaN:Qf,createTypeOf:Jf,createEqualScalar:tp,createSparseMatrixClass:rp,createNumber:np,createString:ip,createBoolean:ap,createBignumber:op,createComplex:sp,createFraction:lp,createMatrix:up,createMatrixFromFunction:cp,createMatrixFromRows:dp,createMatrixFromColumns:fp,createSplitUnit:pp,createUnaryMinus:hp,createUnaryPlus:mp,createAbs:vp,createApply:Ju,createAddScalar:yp,createCbrt:bp,createCeil:xp,createCube:wp,createExp:Cp,createExpm1:Sp,createFix:Dp,createFloor:Ep,createGcd:Np,createLcm:_p,createLog10:Mp,createLog2:Tp,createMod:Rp,createMultiplyScalar:Ip,createMultiply:kp,createNthRoot:Pp,createSign:Fp,createSqrt:$p,createSquare:Bp,createSubtract:zp,createXgcd:Lp,createInvmod:Vp,createDotMultiply:qp,createBitAnd:Up,createBitNot:Wp,createBitOr:Hp,createBitXor:jp,createArg:Kp,createConj:Yp,createIm:Xp,createRe:Zp,createNot:Qp,createOr:Jp,createXor:eh,createConcat:tc,createColumn:rc,createCount:th,createCross:rh,createDiag:nh,createFilter:ih,createFlatten:ah,createForEach:oh,createGetMatrixDataType:sh,createIdentity:lh,createKron:uh,createMap:ch,createDiff:nc,createOnes:dh,createRange:ic,createReshape:fh,createResize:ph,createRotate:hh,createRotationMatrix:mh,createRow:ac,createSize:vh,createSqueeze:gh,createSubset:oc,createTranspose:yh,createCtranspose:bh,createZeros:xh,createFft:wh,createIfft:Ch,createErf:Sh,createMode:Dh,createProd:Eh,createFormat:Nh,createBin:Ah,createOct:_h,createHex:Mh,createPrint:Th,createTo:Oh,createIsPrime:Rh,createNumeric:Ih,createDivideScalar:kh,createPow:Ph,createRound:Fh,createLog:$h,createLog1p:Bh,createNthRoots:zh,createDotPow:Lh,createDotDivide:Vh,createLsolve:qh,createUsolve:Gh,createLsolveAll:Uh,createUsolveAll:Wh,createLeftShift:Hh,createRightArithShift:jh,createRightLogShift:Kh,createAnd:Yh,createCompare:Zh,createCompareNatural:Qh,createCompareText:Jh,createEqual:tm,createEqualText:rm,createSmaller:im,createSmallerEq:om,createLarger:lm,createLargerEq:cm,createDeepEqual:dm,createUnequal:pm,createPartitionSelect:hm,createSort:mm,createMax:lc,createMin:uc,createImmutableDenseMatrixClass:vm,createIndexClass:gm,createFibonacciHeapClass:ym,createSpaClass:bm,createUnitClass:wm,createUnitFunction:Cm,createSparse:Sm,createCreateUnit:Dm,createAcos:Em,createAcosh:Nm,createAcot:Am,createAcoth:_m,createAcsc:Mm,createAcsch:Tm,createAsec:Om,createAsech:Rm,createAsin:Im,createAsinh:km,createAtan:Pm,createAtan2:Fm,createAtanh:$m,createCos:Bm,createCosh:zm,createCot:Lm,createCoth:Vm,createCsc:qm,createCsch:Gm,createSec:Um,createSech:Wm,createSin:Hm,createSinh:jm,createTan:Km,createTanh:Ym,createSetCartesian:Xm,createSetDifference:Zm,createSetDistinct:Qm,createSetIntersect:Jm,createSetIsSubset:ev,createSetMultiplicity:tv,createSetPowerset:rv,createSetSize:nv,createSetSymDifference:iv,createSetUnion:av,createAdd:ov,createHypot:sv,createNorm:lv,createDot:uv,createTrace:cv,createIndex:dv,createNode:fv,createAccessorNode:hv,createArrayNode:vv,createAssignmentNode:bv,createBlockNode:wv,createConditionalNode:Sv,createConstantNode:Ev,createFunctionAssignmentNode:Av,createIndexNode:Mv,createObjectNode:Ov,createOperatorNode:Iv,createParenthesisNode:Pv,createRangeNode:$v,createRelationalNode:zv,createSymbolNode:Lv,createFunctionNode:qv,createParse:Gv,createCompile:Uv,createEvaluate:Wv,createParserClass:Hv,createParser:jv,createLup:Kv,createQr:Yv,createSlu:Xv,createLusolve:Zv,createPolynomialRoot:Qv,createHelpClass:Jv,createChainClass:eg,createHelp:tg,createChain:rg,createDet:ng,createInv:ig,createPinv:ag,createEigs:og,createExpm:sg,createSqrtm:lg,createSylvester:ug,createSchur:cg,createLyap:dg,createDivide:fg,createDistance:pg,createIntersect:hg,createSum:pc,createCumSum:hc,createMean:mc,createMedian:vg,createMad:gg,createVariance:vc,createQuantileSeq:yg,createStd:gc,createCombinations:bg,createCombinationsWithRep:xg,createGamma:wg,createLgamma:Cg,createFactorial:Sg,createKldivergence:Dg,createMultinomial:Eg,createPermutations:Ng,createPickRandom:Ag,createRandom:_g,createRandomInt:Mg,createStirlingS2:Tg,createBellNumbers:Og,createCatalan:Rg,createComposition:Ig,createLeafCount:kg,createSimplify:Fg,createSimplifyConstant:$g,createSimplifyCore:Bg,createResolve:zg,createSymbolicEqual:Lg,createDerivative:Vg,createRationalize:qg,createReviver:Gg,createReplacer:Ug,createE:Qg,createUppercaseE:Rw,createFalse:Hg,createI:o0,createInfinity:Kg,createLN10:t0,createLN2:e0,createLOG10E:n0,createLOG2E:r0,createNaN:Yg,createNull:jg,createPhi:Jg,createPi:Xg,createUppercasePi:Ow,createSQRT1_2:i0,createSQRT2:a0,createTau:Zg,createTrue:Wg,createVersion:s0,createAtomicMass:$0,createAvogadro:B0,createBohrMagneton:g0,createBohrRadius:S0,createBoltzmann:z0,createClassicalElectronRadius:D0,createConductanceQuantum:y0,createCoulomb:m0,createDeuteronMass:T0,createEfimovFactor:F0,createElectricConstant:p0,createElectronMass:E0,createElementaryCharge:v0,createFaraday:L0,createFermiCoupling:N0,createFineStructure:A0,createFirstRadiation:V0,createGasConstant:G0,createGravitationConstant:u0,createGravity:Q0,createHartreeEnergy:_0,createInverseConductanceQuantum:b0,createKlitzing:C0,createLoschmidt:q0,createMagneticConstant:f0,createMagneticFluxQuantum:x0,createMolarMass:X0,createMolarMassC12:Z0,createMolarPlanckConstant:U0,createMolarVolume:W0,createNeutronMass:O0,createNuclearMagneton:w0,createPlanckCharge:ry,createPlanckConstant:c0,createPlanckLength:J0,createPlanckMass:ey,createPlanckTemperature:ny,createPlanckTime:ty,createProtonMass:M0,createQuantumOfCirculation:R0,createReducedPlanckConstant:d0,createRydberg:I0,createSackurTetrode:H0,createSecondRadiation:j0,createSpeedOfLight:l0,createStefanBoltzmann:K0,createThomsonCrossSection:k0,createVacuumImpedance:h0,createWeakMixingAngle:P0,createWienDisplacement:Y0,createApplyTransform:ay,createColumnTransform:oy,createFilterTransform:sy,createForEachTransform:ly,createIndexTransform:uy,createMapTransform:cy,createMaxTransform:dy,createMeanTransform:fy,createMinTransform:py,createRangeTransform:hy,createRowTransform:my,createSubsetTransform:vy,createConcatTransform:gy,createDiffTransform:yy,createStdTransform:by,createSumTransform:xy,createCumSumTransform:wy,createVarianceTransform:Cy},Symbol.toStringTag,{value:"Module"}));var Ge=kf({config:Ie}),Sr=Pf({}),kw=Qg({BigNumber:Ge,config:Ie}),wk=Hg({}),Ck=A0({BigNumber:Ge,config:Ie}),Lo=Ff({}),Pw=o0({Complex:Sr}),Sk=Kg({BigNumber:Ge,config:Ie}),Dk=t0({BigNumber:Ge,config:Ie}),Ek=n0({BigNumber:Ge,config:Ie}),yc=Bf({}),Nk=Yg({BigNumber:Ge,config:Ie}),Ak=jg({}),_k=Jg({BigNumber:Ge,config:Ie}),Mk=$f({}),Fw=Nf({}),Tk=i0({BigNumber:Ge,config:Ie}),Ok=H0({BigNumber:Ge,config:Ie}),$w=Zg({BigNumber:Ge,config:Ie}),Rk=Wg({}),Ik=s0({}),Rt=zf({Matrix:yc}),kk=F0({BigNumber:Ge,config:Ie}),Pk=e0({BigNumber:Ge,config:Ie}),Bw=Xg({BigNumber:Ge,config:Ie}),Fk=Ug({}),$k=a0({BigNumber:Ge,config:Ie}),oe=Df({BigNumber:Ge,Complex:Sr,DenseMatrix:Rt,Fraction:Lo}),Sy=mp({BigNumber:Ge,config:Ie,typed:oe}),Bk=P0({BigNumber:Ge,config:Ie}),Un=vp({typed:oe}),zk=Em({Complex:Sr,config:Ie,typed:oe}),Lk=Am({BigNumber:Ge,typed:oe}),Vk=Mm({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),Yr=yp({typed:oe}),qk=Kp({typed:oe}),Gk=Rm({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),Uk=km({typed:oe}),zw=Pm({typed:oe}),Wk=$m({Complex:Sr,config:Ie,typed:oe}),ji=op({BigNumber:Ge,typed:oe}),Hk=Wp({typed:oe}),jk=ap({typed:oe}),Kk=Lf({typed:oe}),bc=bg({typed:oe}),xc=sp({Complex:Sr,typed:oe}),Vo=Yp({typed:oe}),Yk=zm({typed:oe}),Xk=Vm({BigNumber:Ge,typed:oe}),Zk=qm({BigNumber:Ge,typed:oe}),Qk=wp({typed:oe}),jt=tp({config:Ie,typed:oe}),Jk=Sh({typed:oe}),Lw=Cp({typed:oe}),eP=Sp({Complex:Sr,typed:oe}),tP=ih({typed:oe}),rP=oh({typed:oe}),Fl=Nh({typed:oe}),nP=sh({typed:oe}),iP=Mh({format:Fl,typed:oe}),Dy=Xp({typed:oe}),oi=Gf({typed:oe}),xs=jf({typed:oe}),wc=Xf({typed:oe}),Di=Zf({typed:oe}),aP=r0({BigNumber:Ge,config:Ie}),oP=Cg({Complex:Sr,typed:oe}),sP=Mp({Complex:Sr,config:Ie,typed:oe}),Vw=Tp({Complex:Sr,config:Ie,typed:oe}),ws=ch({typed:oe}),Vr=Ip({typed:oe}),qw=Qp({typed:oe}),to=np({typed:oe}),lP=_h({format:Fl,typed:oe}),uP=Ag({config:Ie,typed:oe}),cP=Th({typed:oe}),dP=_g({config:Ie,typed:oe}),Ey=Zp({typed:oe}),fP=Um({BigNumber:Ge,typed:oe}),Gw=Fp({BigNumber:Ge,Fraction:Lo,complex:xc,typed:oe}),Ny=Hm({typed:oe}),Sa=rp({Matrix:yc,equalScalar:jt,typed:oe}),pP=pp({typed:oe}),hP=Bp({typed:oe}),mP=ip({typed:oe}),vP=Km({typed:oe}),Uw=Jf({typed:oe}),gP=Nm({Complex:Sr,config:Ie,typed:oe}),yP=Tm({BigNumber:Ge,typed:oe}),Ay=Ju({isInteger:oi,typed:oe}),bP=Om({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),xP=Ah({format:Fl,typed:oe}),wP=xg({typed:oe}),_y=Bm({typed:oe}),CP=Gm({BigNumber:Ge,typed:oe}),$l=Qf({typed:oe}),SP=Rh({typed:oe}),DP=Mg({config:Ie,typed:oe}),EP=Wm({BigNumber:Ge,typed:oe}),NP=jm({typed:oe}),AP=Sm({SparseMatrix:Sa,typed:oe}),Ki=$p({Complex:Sr,config:Ie,typed:oe}),_P=Ym({typed:oe}),Yi=hp({typed:oe}),MP=_m({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),TP=Lm({BigNumber:Ge,typed:oe}),Cs=lp({Fraction:Lo,typed:oe}),qo=Kf({typed:oe}),We=up({DenseMatrix:Rt,Matrix:yc,SparseMatrix:Sa,typed:oe}),OP=cp({isZero:Di,matrix:We,typed:oe}),RP=Dh({isNaN:$l,isNumeric:qo,typed:oe}),Ei=Ih({bignumber:ji,fraction:Cs,number:to}),Ww=Eh({config:Ie,multiplyScalar:Vr,numeric:Ei,typed:oe}),IP=fh({isInteger:oi,matrix:We,typed:oe}),Sn=vh({matrix:We,config:Ie,typed:oe}),kP=gh({matrix:We,typed:oe}),Zn=oc({matrix:We,typed:oe}),Bl=yh({matrix:We,typed:oe}),Hw=Lp({BigNumber:Ge,config:Ie,matrix:We,typed:oe}),Xi=xh({BigNumber:Ge,config:Ie,matrix:We,typed:oe}),PP=Im({Complex:Sr,config:Ie,typed:oe}),jw=bp({BigNumber:Ge,Complex:Sr,Fraction:Lo,config:Ie,isNegative:xs,matrix:We,typed:oe,unaryMinus:Yi}),nr=tc({isInteger:oi,matrix:We,typed:oe}),FP=th({prod:Ww,size:Sn,typed:oe}),My=bh({conj:Vo,transpose:Bl,typed:oe}),Kw=nh({DenseMatrix:Rt,SparseMatrix:Sa,matrix:We,typed:oe}),Fr=kh({numeric:Ei,typed:oe}),zl=Vh({DenseMatrix:Rt,concat:nr,divideScalar:Fr,equalScalar:jt,matrix:We,typed:oe}),Ni=tm({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),Ll=ah({matrix:We,typed:oe}),$P=Np({BigNumber:Ge,DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),BP=Yf({isNumeric:qo,typed:oe}),ro=lh({BigNumber:Ge,DenseMatrix:Rt,SparseMatrix:Sa,config:Ie,matrix:We,typed:oe}),zP=uh({matrix:We,multiplyScalar:Vr,typed:oe}),Cc=cm({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),LP=Hh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),Ty=fp({flatten:Ll,matrix:We,size:Sn,typed:oe}),Yw=Rp({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),VP=Pp({BigNumber:Ge,concat:nr,equalScalar:jt,matrix:We,typed:oe}),qP=dh({BigNumber:Ge,config:Ie,matrix:We,typed:oe}),GP=ph({config:Ie,matrix:We}),UP=jh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),Sc=Fh({BigNumber:Ge,DenseMatrix:Rt,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),si=im({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),WP=Oh({concat:nr,matrix:We,typed:oe}),HP=pm({DenseMatrix:Rt,concat:nr,config:Ie,equalScalar:jt,matrix:We,typed:oe}),jP=eh({DenseMatrix:Rt,concat:nr,matrix:We,typed:oe}),Dr=ov({DenseMatrix:Rt,SparseMatrix:Sa,addScalar:Yr,concat:nr,equalScalar:jt,matrix:We,typed:oe}),KP=Up({concat:nr,equalScalar:jt,matrix:We,typed:oe}),YP=jp({DenseMatrix:Rt,concat:nr,matrix:We,typed:oe}),XP=Rg({addScalar:Yr,combinations:bc,divideScalar:Fr,isInteger:oi,isNegative:xs,multiplyScalar:Vr,typed:oe}),Ss=Zh({BigNumber:Ge,DenseMatrix:Rt,Fraction:Lo,concat:nr,config:Ie,equalScalar:jt,matrix:We,typed:oe}),Xw=Jh({concat:nr,matrix:We,typed:oe}),ZP=hc({add:Dr,typed:oe,unaryPlus:Sy}),Zw=dm({equal:Ni,typed:oe}),Dc=uv({addScalar:Yr,conj:Vo,multiplyScalar:Vr,size:Sn,typed:oe}),QP=rm({compareText:Xw,isZero:Di,typed:oe}),Qw=Ep({DenseMatrix:Rt,config:Ie,equalScalar:jt,matrix:We,round:Sc,typed:oe,zeros:Xi}),JP=sv({abs:Un,addScalar:Yr,divideScalar:Fr,isPositive:wc,multiplyScalar:Vr,smaller:si,sqrt:Ki,typed:oe}),Jw=vm({DenseMatrix:Rt,smaller:si}),Dn=gm({ImmutableDenseMatrix:Jw}),eF=Vp({BigNumber:Ge,add:Dr,config:Ie,equal:Ni,isInteger:oi,mod:Yw,smaller:si,typed:oe,xgcd:Hw}),li=lm({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),Oy=$h({Complex:Sr,config:Ie,divideScalar:Fr,typed:oe}),tF=dp({flatten:Ll,matrix:We,size:Sn,typed:oe}),rF=uc({config:Ie,numeric:Ei,smaller:si,typed:oe}),Er=kp({addScalar:Yr,dot:Dc,equalScalar:jt,matrix:We,multiplyScalar:Vr,typed:oe}),nF=zh({Complex:Sr,config:Ie,divideScalar:Fr,typed:oe}),iF=Jp({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),Ry=hm({compare:Ss,isNaN:$l,isNumeric:qo,typed:oe}),aF=yg({add:Dr,compare:Ss,multiply:Er,partitionSelect:Ry,typed:oe}),oF=Kh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),Iy=om({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),gr=zp({DenseMatrix:Rt,addScalar:Yr,concat:nr,equalScalar:jt,matrix:We,typed:oe,unaryMinus:Yi}),sF=cv({add:Dr,matrix:We,typed:oe}),ky=Gh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),lF=Yh({concat:nr,equalScalar:jt,matrix:We,not:qw,typed:oe,zeros:Xi}),uF=Hp({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),Py=xp({DenseMatrix:Rt,config:Ie,equalScalar:jt,matrix:We,round:Sc,typed:oe,zeros:Xi}),Zi=Qh({compare:Ss,typed:oe}),cF=Ig({addScalar:Yr,combinations:bc,isInteger:oi,isNegative:xs,isPositive:wc,larger:li,typed:oe}),dF=rh({matrix:We,multiply:Er,subtract:gr,typed:oe}),eC=ng({divideScalar:Fr,isZero:Di,matrix:We,multiply:Er,subtract:gr,typed:oe,unaryMinus:Yi}),fF=nc({matrix:We,number:to,subtract:gr,typed:oe}),pF=pg({abs:Un,addScalar:Yr,divideScalar:Fr,multiplyScalar:Vr,sqrt:Ki,subtract:gr,typed:oe,unaryMinus:Yi}),hF=qp({concat:nr,equalScalar:jt,matrix:We,multiplyScalar:Vr,typed:oe}),tC=ym({larger:li,smaller:si}),rC=Dp({Complex:Sr,DenseMatrix:Rt,ceil:Py,equalScalar:jt,floor:Qw,matrix:We,typed:oe,zeros:Xi}),nC=dv({Index:Dn,typed:oe}),mF=hg({abs:Un,add:Dr,addScalar:Yr,config:Ie,divideScalar:Fr,equalScalar:jt,flatten:Ll,isNumeric:qo,isZero:Di,matrix:We,multiply:Er,multiplyScalar:Vr,smaller:si,subtract:gr,typed:oe}),vF=_p({concat:nr,equalScalar:jt,matrix:We,typed:oe}),gF=Bh({Complex:Sr,config:Ie,divideScalar:Fr,log:Oy,typed:oe}),iC=qh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),aC=lc({config:Ie,larger:li,numeric:Ei,typed:oe}),Fy=Yv({addScalar:Yr,complex:xc,conj:Vo,divideScalar:Fr,equal:Ni,identity:ro,isZero:Di,matrix:We,multiplyScalar:Vr,sign:Gw,sqrt:Ki,subtract:gr,typed:oe,unaryMinus:Yi,zeros:Xi}),Ds=ic({bignumber:ji,matrix:We,config:Ie,larger:li,largerEq:Cc,smaller:si,smallerEq:Iy,typed:oe}),yF=ac({Index:Dn,matrix:We,range:Ds,typed:oe}),bF=Xm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),xF=Qm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),wF=ev({Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),CF=rv({Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),oC=Xv({SparseMatrix:Sa,abs:Un,add:Dr,divideScalar:Fr,larger:li,largerEq:Cc,multiply:Er,subtract:gr,transpose:Bl,typed:oe}),sC=bm({FibonacciHeap:tC,addScalar:Yr,equalScalar:jt}),lC=pc({add:Dr,config:Ie,numeric:Ei,typed:oe}),uC=Wh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),SF=Fm({BigNumber:Ge,DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),cC=rc({Index:Dn,matrix:We,range:Ds,typed:oe}),DF=Uh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),dC=Zm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),EF=tv({Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),fC=iv({Index:Dn,concat:nr,setDifference:dC,size:Sn,subset:Zn,typed:oe}),NF=mm({compare:Ss,compareNatural:Zi,matrix:We,typed:oe}),Go=ig({abs:Un,addScalar:Yr,det:eC,divideScalar:Fr,identity:ro,matrix:We,multiply:Er,typed:oe,unaryMinus:Yi}),pC=Kv({DenseMatrix:Rt,Spa:sC,SparseMatrix:Sa,abs:Un,addScalar:Yr,divideScalar:Fr,equalScalar:jt,larger:li,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe,unaryMinus:Yi}),AF=ag({Complex:Sr,add:Dr,ctranspose:My,deepEqual:Zw,divideScalar:Fr,dot:Dc,dotDivide:zl,equal:Ni,inv:Go,matrix:We,multiply:Er,typed:oe}),Qi=Ph({Complex:Sr,config:Ie,fraction:Cs,identity:ro,inv:Go,matrix:We,multiply:Er,number:to,typed:oe}),hC=Jm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),_F=av({Index:Dn,concat:nr,setIntersect:hC,setSymDifference:fC,size:Sn,subset:Zn,typed:oe}),MF=lg({abs:Un,add:Dr,identity:ro,inv:Go,map:ws,max:aC,multiply:Er,size:Sn,sqrt:Ki,subtract:gr,typed:oe}),yt=wm({BigNumber:Ge,Complex:Sr,Fraction:Lo,abs:Un,addScalar:Yr,config:Ie,divideScalar:Fr,equal:Ni,fix:rC,format:Fl,isNumeric:qo,multiplyScalar:Vr,number:to,pow:Qi,round:Sc,subtract:gr}),TF=h0({BigNumber:Ge,Unit:yt,config:Ie}),OF=Y0({BigNumber:Ge,Unit:yt,config:Ie}),RF=$0({BigNumber:Ge,Unit:yt,config:Ie}),IF=g0({BigNumber:Ge,Unit:yt,config:Ie}),kF=z0({BigNumber:Ge,Unit:yt,config:Ie}),PF=y0({BigNumber:Ge,Unit:yt,config:Ie}),FF=Dm({Unit:yt,typed:oe}),$F=T0({BigNumber:Ge,Unit:yt,config:Ie}),BF=Lh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,pow:Qi,typed:oe}),zF=p0({BigNumber:Ge,Unit:yt,config:Ie}),LF=v0({BigNumber:Ge,Unit:yt,config:Ie}),VF=sg({abs:Un,add:Dr,identity:ro,inv:Go,multiply:Er,typed:oe}),qF=L0({BigNumber:Ge,Unit:yt,config:Ie}),mC=wh({addScalar:Yr,ceil:Py,conj:Vo,divideScalar:Fr,dotDivide:zl,exp:Lw,i:Pw,log2:Vw,matrix:We,multiplyScalar:Vr,pow:Qi,tau:$w,typed:oe}),vC=wg({BigNumber:Ge,Complex:Sr,config:Ie,multiplyScalar:Vr,pow:Qi,typed:oe}),GF=u0({BigNumber:Ge,Unit:yt,config:Ie}),UF=_0({BigNumber:Ge,Unit:yt,config:Ie}),WF=Ch({conj:Vo,dotDivide:zl,fft:mC,typed:oe}),HF=C0({BigNumber:Ge,Unit:yt,config:Ie}),jF=q0({BigNumber:Ge,Unit:yt,config:Ie}),KF=f0({BigNumber:Ge,Unit:yt,config:Ie}),YF=X0({BigNumber:Ge,Unit:yt,config:Ie}),XF=U0({BigNumber:Ge,Unit:yt,config:Ie}),ZF=O0({BigNumber:Ge,Unit:yt,config:Ie}),QF=w0({BigNumber:Ge,Unit:yt,config:Ie}),JF=ry({BigNumber:Ge,Unit:yt,config:Ie}),e$=J0({BigNumber:Ge,Unit:yt,config:Ie}),t$=ny({BigNumber:Ge,Unit:yt,config:Ie}),r$=M0({BigNumber:Ge,Unit:yt,config:Ie}),n$=d0({BigNumber:Ge,Unit:yt,config:Ie}),i$=I0({BigNumber:Ge,Unit:yt,config:Ie}),a$=j0({BigNumber:Ge,Unit:yt,config:Ie}),o$=l0({BigNumber:Ge,Unit:yt,config:Ie}),s$=K0({BigNumber:Ge,Unit:yt,config:Ie}),l$=k0({BigNumber:Ge,Unit:yt,config:Ie}),u$=B0({BigNumber:Ge,Unit:yt,config:Ie}),c$=S0({BigNumber:Ge,Unit:yt,config:Ie}),d$=m0({BigNumber:Ge,Unit:yt,config:Ie}),ui=fg({divideScalar:Fr,equalScalar:jt,inv:Go,matrix:We,multiply:Er,typed:oe}),f$=E0({BigNumber:Ge,Unit:yt,config:Ie}),Ec=Sg({gamma:vC,typed:oe}),p$=V0({BigNumber:Ge,Unit:yt,config:Ie}),h$=G0({BigNumber:Ge,Unit:yt,config:Ie}),m$=b0({BigNumber:Ge,Unit:yt,config:Ie}),gC=Zv({DenseMatrix:Rt,lsolve:iC,lup:pC,matrix:We,slu:oC,typed:oe,usolve:ky}),v$=x0({BigNumber:Ge,Unit:yt,config:Ie}),g$=Z0({BigNumber:Ge,Unit:yt,config:Ie}),y$=Eg({add:Dr,divide:ui,factorial:Ec,isInteger:oi,isPositive:wc,multiply:Er,typed:oe}),b$=Ng({factorial:Ec,typed:oe}),x$=ey({BigNumber:Ge,Unit:yt,config:Ie}),w$=Qv({add:Dr,cbrt:jw,divide:ui,equalScalar:jt,im:Dy,isZero:Di,multiply:Er,re:Ey,sqrt:Ki,subtract:gr,typeOf:Uw,typed:oe,unaryMinus:Yi}),C$=nv({compareNatural:Zi,typed:oe}),yC=Tg({bignumber:ji,addScalar:Yr,combinations:bc,divideScalar:Fr,factorial:Ec,isInteger:oi,isNegative:xs,larger:li,multiplyScalar:Vr,number:to,pow:Qi,subtract:gr,typed:oe}),S$=Cm({Unit:yt,typed:oe}),D$=Og({addScalar:Yr,isInteger:oi,isNegative:xs,stirlingS2:yC,typed:oe}),bC=og({abs:Un,add:Dr,addScalar:Yr,atan:zw,bignumber:ji,column:cC,complex:xc,config:Ie,cos:_y,diag:Kw,divideScalar:Fr,dot:Dc,equal:Ni,flatten:Ll,im:Dy,inv:Go,larger:li,matrix:We,matrixFromColumns:Ty,multiply:Er,multiplyScalar:Vr,number:to,qr:Fy,re:Ey,sin:Ny,smaller:si,sqrt:Ki,subtract:gr,typed:oe,usolve:ky,usolveAll:uC}),E$=N0({BigNumber:Ge,Unit:yt,config:Ie}),N$=Q0({BigNumber:Ge,Unit:yt,config:Ie}),A$=Dg({divide:ui,dotDivide:zl,isNumeric:qo,log:Oy,map:ws,matrix:We,multiply:Er,sum:lC,typed:oe}),xC=mc({add:Dr,divide:ui,typed:oe}),_$=W0({BigNumber:Ge,Unit:yt,config:Ie}),M$=c0({BigNumber:Ge,Unit:yt,config:Ie}),T$=R0({BigNumber:Ge,Unit:yt,config:Ie}),$y=vc({add:Dr,apply:Ay,divide:ui,isNaN:$l,multiply:Er,subtract:gr,typed:oe}),O$=D0({BigNumber:Ge,Unit:yt,config:Ie}),wC=vg({add:Dr,compare:Ss,divide:ui,partitionSelect:Ry,typed:oe}),R$=ty({BigNumber:Ge,Unit:yt,config:Ie}),By=gc({map:ws,sqrt:Ki,typed:oe,variance:$y}),I$=gg({abs:Un,map:ws,median:wC,subtract:gr,typed:oe}),zy=lv({abs:Un,add:Dr,conj:Vo,ctranspose:My,eigs:bC,equalScalar:jt,larger:li,matrix:We,multiply:Er,pow:Qi,smaller:si,sqrt:Ki,typed:oe}),CC=mh({BigNumber:Ge,DenseMatrix:Rt,SparseMatrix:Sa,addScalar:Yr,config:Ie,cos:_y,matrix:We,multiplyScalar:Vr,norm:zy,sin:Ny,typed:oe,unaryMinus:Yi}),k$=hh({multiply:Er,rotationMatrix:CC,typed:oe}),SC=cg({identity:ro,matrix:We,multiply:Er,norm:zy,qr:Fy,subtract:gr,typed:oe}),DC=ug({abs:Un,add:Dr,concat:nr,identity:ro,index:nC,lusolve:gC,matrix:We,matrixFromColumns:Ty,multiply:Er,range:Ds,schur:SC,subset:Zn,subtract:gr,transpose:Bl,typed:oe}),P$=dg({matrix:We,multiply:Er,sylvester:DC,transpose:Bl,typed:oe}),Vl={},ql={},F$={},En=fv({mathWithTransform:ql}),Es=Ov({Node:En}),Da=Iv({Node:En}),Uo=Pv({Node:En}),EC=zv({Node:En}),Ns=vv({Node:En}),NC=wv({Node:En,ResultSet:Fw}),AC=Sv({Node:En}),no=Ev({Node:En}),_C=$v({Node:En}),$$=Gg({classes:F$}),Ly=eg({math:Vl,typed:oe}),MC=Av({Node:En,typed:oe}),B$=rg({Chain:Ly,typed:oe}),As=hv({Node:En,subset:Zn}),_s=Mv({Node:En,size:Sn}),TC=bv({matrix:We,Node:En,subset:Zn}),io=Lv({Unit:yt,Node:En,math:Vl}),ao=qv({Node:En,SymbolNode:io,math:Vl}),Ai=Gv({AccessorNode:As,ArrayNode:Ns,AssignmentNode:TC,BlockNode:NC,ConditionalNode:AC,ConstantNode:no,FunctionAssignmentNode:MC,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,RangeNode:_C,RelationalNode:EC,SymbolNode:io,config:Ie,numeric:Ei,typed:oe}),OC=zg({ConstantNode:no,FunctionNode:ao,OperatorNode:Da,ParenthesisNode:Uo,parse:Ai,typed:oe}),Vy=$g({bignumber:ji,fraction:Cs,AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,SymbolNode:io,config:Ie,mathWithTransform:ql,matrix:We,typed:oe}),z$=Uv({parse:Ai,typed:oe}),RC=Wv({parse:Ai,typed:oe}),IC=Jv({parse:Ai}),kC=Hv({evaluate:RC}),qy=Bg({AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,add:Dr,divide:ui,equal:Ni,isZero:Di,multiply:Er,parse:Ai,pow:Qi,subtract:gr,typed:oe}),L$=tg({Help:IC,mathWithTransform:ql,typed:oe}),Nc=Fg({bignumber:ji,fraction:Cs,AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,add:Dr,config:Ie,divide:ui,equal:Ni,isZero:Di,mathWithTransform:ql,matrix:We,multiply:Er,parse:Ai,pow:Qi,resolve:OC,simplifyConstant:Vy,simplifyCore:qy,subtract:gr,typed:oe}),V$=Lg({OperatorNode:Da,parse:Ai,simplify:Nc,typed:oe}),q$=Vg({ConstantNode:no,FunctionNode:ao,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,config:Ie,equal:Ni,isZero:Di,numeric:Ei,parse:Ai,simplify:Nc,typed:oe}),G$=jv({Parser:kC,typed:oe}),U$=kg({parse:Ai,typed:oe}),W$=qg({bignumber:ji,fraction:Cs,AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,add:Dr,config:Ie,divide:ui,equal:Ni,isZero:Di,mathWithTransform:ql,matrix:We,multiply:Er,parse:Ai,pow:Qi,simplify:Nc,simplifyConstant:Vy,simplifyCore:qy,subtract:gr,typed:oe});fn(Vl,{e:kw,false:wk,fineStructure:Ck,i:Pw,Infinity:Sk,LN10:Dk,LOG10E:Ek,NaN:Nk,null:Ak,phi:_k,SQRT1_2:Tk,sackurTetrode:Ok,tau:$w,true:Rk,E:kw,version:Ik,efimovFactor:kk,LN2:Pk,pi:Bw,replacer:Fk,reviver:$$,SQRT2:$k,typed:oe,unaryPlus:Sy,PI:Bw,weakMixingAngle:Bk,abs:Un,acos:zk,acot:Lk,acsc:Vk,addScalar:Yr,arg:qk,asech:Gk,asinh:Uk,atan:zw,atanh:Wk,bignumber:ji,bitNot:Hk,boolean:jk,clone:Kk,combinations:bc,complex:xc,conj:Vo,cosh:Yk,coth:Xk,csc:Zk,cube:Qk,equalScalar:jt,erf:Jk,exp:Lw,expm1:eP,filter:tP,forEach:rP,format:Fl,getMatrixDataType:nP,hex:iP,im:Dy,isInteger:oi,isNegative:xs,isPositive:wc,isZero:Di,LOG2E:aP,lgamma:oP,log10:sP,log2:Vw,map:ws,multiplyScalar:Vr,not:qw,number:to,oct:lP,pickRandom:uP,print:cP,random:dP,re:Ey,sec:fP,sign:Gw,sin:Ny,splitUnit:pP,square:hP,string:mP,tan:vP,typeOf:Uw,acosh:gP,acsch:yP,apply:Ay,asec:bP,bin:xP,chain:B$,combinationsWithRep:wP,cos:_y,csch:CP,isNaN:$l,isPrime:SP,randomInt:DP,sech:EP,sinh:NP,sparse:AP,sqrt:Ki,tanh:_P,unaryMinus:Yi,acoth:MP,cot:TP,fraction:Cs,isNumeric:qo,matrix:We,matrixFromFunction:OP,mode:RP,numeric:Ei,prod:Ww,reshape:IP,size:Sn,squeeze:kP,subset:Zn,transpose:Bl,xgcd:Hw,zeros:Xi,asin:PP,cbrt:jw,concat:nr,count:FP,ctranspose:My,diag:Kw,divideScalar:Fr,dotDivide:zl,equal:Ni,flatten:Ll,gcd:$P,hasNumericValue:BP,identity:ro,kron:zP,largerEq:Cc,leftShift:LP,matrixFromColumns:Ty,mod:Yw,nthRoot:VP,ones:qP,resize:GP,rightArithShift:UP,round:Sc,smaller:si,to:WP,unequal:HP,xor:jP,add:Dr,bitAnd:KP,bitXor:YP,catalan:XP,compare:Ss,compareText:Xw,cumsum:ZP,deepEqual:Zw,dot:Dc,equalText:QP,floor:Qw,hypot:JP,invmod:eF,larger:li,log:Oy,matrixFromRows:tF,min:rF,multiply:Er,nthRoots:nF,or:iF,partitionSelect:Ry,quantileSeq:aF,rightLogShift:oF,smallerEq:Iy,subtract:gr,trace:sF,usolve:ky,and:lF,bitOr:uF,ceil:Py,compareNatural:Zi,composition:cF,cross:dF,det:eC,diff:fF,distance:pF,dotMultiply:hF,fix:rC,index:nC,intersect:mF,lcm:vF,log1p:gF,lsolve:iC,max:aC,qr:Fy,range:Ds,row:yF,setCartesian:bF,setDistinct:xF,setIsSubset:wF,setPowerset:CF,slu:oC,sum:lC,usolveAll:uC,atan2:SF,column:cC,lsolveAll:DF,setDifference:dC,setMultiplicity:EF,setSymDifference:fC,sort:NF,inv:Go,lup:pC,pinv:AF,pow:Qi,setIntersect:hC,setUnion:_F,sqrtm:MF,vacuumImpedance:TF,wienDisplacement:OF,atomicMass:RF,bohrMagneton:IF,boltzmann:kF,conductanceQuantum:PF,createUnit:FF,deuteronMass:$F,dotPow:BF,electricConstant:zF,elementaryCharge:LF,expm:VF,faraday:qF,fft:mC,gamma:vC,gravitationConstant:GF,hartreeEnergy:UF,ifft:WF,klitzing:HF,loschmidt:jF,magneticConstant:KF,molarMass:YF,molarPlanckConstant:XF,neutronMass:ZF,nuclearMagneton:QF,planckCharge:JF,planckLength:e$,planckTemperature:t$,protonMass:r$,reducedPlanckConstant:n$,rydberg:i$,secondRadiation:a$,speedOfLight:o$,stefanBoltzmann:s$,thomsonCrossSection:l$,avogadro:u$,bohrRadius:c$,coulomb:d$,divide:ui,electronMass:f$,factorial:Ec,firstRadiation:p$,gasConstant:h$,inverseConductanceQuantum:m$,lusolve:gC,magneticFluxQuantum:v$,molarMassC12:g$,multinomial:y$,permutations:b$,planckMass:x$,polynomialRoot:w$,setSize:C$,stirlingS2:yC,unit:S$,bellNumbers:D$,eigs:bC,fermiCoupling:E$,gravity:N$,kldivergence:A$,mean:xC,molarVolume:_$,planckConstant:M$,quantumOfCirculation:T$,variance:$y,classicalElectronRadius:O$,median:wC,parse:Ai,planckTime:R$,resolve:OC,simplifyConstant:Vy,std:By,compile:z$,evaluate:RC,mad:I$,simplifyCore:qy,help:L$,norm:zy,rotationMatrix:CC,simplify:Nc,symbolicEqual:V$,derivative:q$,parser:G$,rotate:k$,leafCount:U$,rationalize:W$,schur:SC,sylvester:DC,lyap:P$,config:Ie}),fn(ql,Vl,{filter:sy({typed:oe}),forEach:ly({typed:oe}),map:cy({typed:oe}),apply:ay({isInteger:oi,typed:oe}),subset:vy({matrix:We,typed:oe}),concat:gy({isInteger:oi,matrix:We,typed:oe}),max:dy({config:Ie,larger:li,numeric:Ei,typed:oe}),sum:xy({add:Dr,config:Ie,numeric:Ei,typed:oe}),min:py({config:Ie,numeric:Ei,smaller:si,typed:oe}),cumsum:wy({add:Dr,typed:oe,unaryPlus:Sy}),diff:yy({bignumber:ji,matrix:We,number:to,subtract:gr,typed:oe}),index:uy({Index:Dn}),range:hy({bignumber:ji,matrix:We,config:Ie,larger:li,largerEq:Cc,smaller:si,smallerEq:Iy,typed:oe}),row:my({Index:Dn,matrix:We,range:Ds,typed:oe}),column:oy({Index:Dn,matrix:We,range:Ds,typed:oe}),mean:fy({add:Dr,divide:ui,typed:oe}),variance:Cy({add:Dr,apply:Ay,divide:ui,isNaN:$l,multiply:Er,subtract:gr,typed:oe}),std:by({map:ws,sqrt:Ki,typed:oe,variance:$y})}),fn(F$,{BigNumber:Ge,Complex:Sr,Fraction:Lo,Matrix:yc,Node:En,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,Range:Mk,RelationalNode:EC,ResultSet:Fw,ArrayNode:Ns,BlockNode:NC,ConditionalNode:AC,ConstantNode:no,DenseMatrix:Rt,RangeNode:_C,Chain:Ly,FunctionAssignmentNode:MC,SparseMatrix:Sa,AccessorNode:As,IndexNode:_s,AssignmentNode:TC,ImmutableDenseMatrix:Jw,Index:Dn,FibonacciHeap:tC,Spa:sC,Unit:yt,SymbolNode:io,FunctionNode:ao,Help:IC,Parser:kC}),Ly.createProxy(Vl);var Ue={createBigNumberClass:kf},Rr={createComplexClass:Pf},Gy={createMatrixClass:Bf},Ft={MatrixDependencies:Gy,createDenseMatrixClass:zf},Ms={createFractionClass:Ff},se={BigNumberDependencies:Ue,ComplexDependencies:Rr,DenseMatrixDependencies:Ft,FractionDependencies:Ms,createTyped:Df},Qn={typedDependencies:se,createAbs:vp},Pn={createNode:fv},Yt={typedDependencies:se,createEqualScalar:tp},oo={MatrixDependencies:Gy,equalScalarDependencies:Yt,typedDependencies:se,createSparseMatrixClass:rp},je={DenseMatrixDependencies:Ft,MatrixDependencies:Gy,SparseMatrixDependencies:oo,typedDependencies:se,createMatrix:up},ci={matrixDependencies:je,typedDependencies:se,createSubset:oc},Gl={NodeDependencies:Pn,subsetDependencies:ci,createAccessorNode:hv},Rpe={ComplexDependencies:Rr,typedDependencies:se,createAcos:Em},Ipe={ComplexDependencies:Rr,typedDependencies:se,createAcosh:Nm},kpe={BigNumberDependencies:Ue,typedDependencies:se,createAcot:Am},Ppe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAcoth:_m},Fpe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAcsc:Mm},$pe={BigNumberDependencies:Ue,typedDependencies:se,createAcsch:Tm},tn={typedDependencies:se,createAddScalar:yp},_i={typedDependencies:se,createIsInteger:Gf},lr={isIntegerDependencies:_i,matrixDependencies:je,typedDependencies:se,createConcat:tc},Ir={DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,addScalarDependencies:tn,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createAdd:ov},H$={typedDependencies:se,createNot:Qp},Ea={BigNumberDependencies:Ue,matrixDependencies:je,typedDependencies:se,createZeros:xh},Bpe={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,notDependencies:H$,typedDependencies:se,zerosDependencies:Ea,createAnd:Yh},PC={isIntegerDependencies:_i,typedDependencies:se,createApply:Ju},zpe={isIntegerDependencies:_i,typedDependencies:se,createApplyTransform:ay},Lpe={typedDependencies:se,createArg:Kp},Ul={NodeDependencies:Pn,createArrayNode:vv},Vpe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAsec:Om},qpe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAsech:Rm},Gpe={ComplexDependencies:Rr,typedDependencies:se,createAsin:Im},Upe={typedDependencies:se,createAsinh:km},j$={matrixDependencies:je,NodeDependencies:Pn,subsetDependencies:ci,createAssignmentNode:bv},K$={typedDependencies:se,createAtan:Pm},Wpe={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createAtan2:Fm},Hpe={ComplexDependencies:Rr,typedDependencies:se,createAtanh:$m},Na={BigNumberDependencies:Ue,typedDependencies:se,createBignumber:op},Wl={FractionDependencies:Ms,typedDependencies:se,createFraction:lp},Wo={typedDependencies:se,createNumber:np},Ji={bignumberDependencies:Na,fractionDependencies:Wl,numberDependencies:Wo,createNumeric:Ih},$r={numericDependencies:Ji,typedDependencies:se,createDivideScalar:kh},ea={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createEqual:tm},Uy={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createRound:Fh},FC={DenseMatrixDependencies:Ft,equalScalarDependencies:Yt,matrixDependencies:je,roundDependencies:Uy,typedDependencies:se,zerosDependencies:Ea,createCeil:xp},Y$={DenseMatrixDependencies:Ft,equalScalarDependencies:Yt,matrixDependencies:je,roundDependencies:Uy,typedDependencies:se,zerosDependencies:Ea,createFloor:Ep},X$={ComplexDependencies:Rr,DenseMatrixDependencies:Ft,ceilDependencies:FC,equalScalarDependencies:Yt,floorDependencies:Y$,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createFix:Dp},Ac={typedDependencies:se,createFormat:Nh},Ts={typedDependencies:se,createIsNumeric:Kf},Hr={typedDependencies:se,createMultiplyScalar:Ip},Ho={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,matrixDependencies:je,typedDependencies:se,createIdentity:lh},ta={typedDependencies:se,createIsZero:Zf},Os={typedDependencies:se,createConj:Yp},Fn={matrixDependencies:je,typedDependencies:se,createSize:vh},Wy={addScalarDependencies:tn,conjDependencies:Os,multiplyScalarDependencies:Hr,sizeDependencies:Fn,typedDependencies:se,createDot:uv},kr={addScalarDependencies:tn,dotDependencies:Wy,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,typedDependencies:se,createMultiply:kp},Aa={typedDependencies:se,createUnaryMinus:hp},Nr={DenseMatrixDependencies:Ft,addScalarDependencies:tn,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,unaryMinusDependencies:Aa,createSubtract:zp},Z$={divideScalarDependencies:$r,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,createDet:ng},Rs={absDependencies:Qn,addScalarDependencies:tn,detDependencies:Z$,divideScalarDependencies:$r,identityDependencies:Ho,matrixDependencies:je,multiplyDependencies:kr,typedDependencies:se,unaryMinusDependencies:Aa,createInv:ig},_a={ComplexDependencies:Rr,fractionDependencies:Wl,identityDependencies:Ho,invDependencies:Rs,matrixDependencies:je,multiplyDependencies:kr,numberDependencies:Wo,typedDependencies:se,createPow:Ph},xt={BigNumberDependencies:Ue,ComplexDependencies:Rr,FractionDependencies:Ms,absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,equalDependencies:ea,fixDependencies:X$,formatDependencies:Ac,isNumericDependencies:Ts,multiplyScalarDependencies:Hr,numberDependencies:Wo,powDependencies:_a,roundDependencies:Uy,subtractDependencies:Nr,createUnitClass:wm},jpe={BigNumberDependencies:Ue,UnitDependencies:xt,createAtomicMass:$0},Kpe={BigNumberDependencies:Ue,UnitDependencies:xt,createAvogadro:B0},Hl={typedDependencies:se,createIsNegative:jf},Hy={typedDependencies:se,createCombinations:bg},Q$={BigNumberDependencies:Ue,ComplexDependencies:Rr,multiplyScalarDependencies:Hr,powDependencies:_a,typedDependencies:se,createGamma:wg},jy={gammaDependencies:Q$,typedDependencies:se,createFactorial:Sg},Mi={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createLarger:lm},J$={bignumberDependencies:Na,addScalarDependencies:tn,combinationsDependencies:Hy,divideScalarDependencies:$r,factorialDependencies:jy,isIntegerDependencies:_i,isNegativeDependencies:Hl,largerDependencies:Mi,multiplyScalarDependencies:Hr,numberDependencies:Wo,powDependencies:_a,subtractDependencies:Nr,typedDependencies:se,createStirlingS2:Tg},Ype={addScalarDependencies:tn,isIntegerDependencies:_i,isNegativeDependencies:Hl,stirlingS2Dependencies:J$,typedDependencies:se,createBellNumbers:Og},Xpe={formatDependencies:Ac,typedDependencies:se,createBin:Ah},Zpe={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createBitAnd:Up},Qpe={typedDependencies:se,createBitNot:Wp},Jpe={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createBitOr:Hp},ehe={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createBitXor:jp},eB={createResultSet:Nf},tB={NodeDependencies:Pn,ResultSetDependencies:eB,createBlockNode:wv},the={BigNumberDependencies:Ue,UnitDependencies:xt,createBohrMagneton:g0},rhe={BigNumberDependencies:Ue,UnitDependencies:xt,createBohrRadius:S0},nhe={BigNumberDependencies:Ue,UnitDependencies:xt,createBoltzmann:z0},ihe={typedDependencies:se,createBoolean:ap},ahe={addScalarDependencies:tn,combinationsDependencies:Hy,divideScalarDependencies:$r,isIntegerDependencies:_i,isNegativeDependencies:Hl,multiplyScalarDependencies:Hr,typedDependencies:se,createCatalan:Rg},rB={BigNumberDependencies:Ue,ComplexDependencies:Rr,FractionDependencies:Ms,isNegativeDependencies:Hl,matrixDependencies:je,typedDependencies:se,unaryMinusDependencies:Aa,createCbrt:bp},nB={typedDependencies:se,createChainClass:eg},ohe={ChainDependencies:nB,typedDependencies:se,createChain:rg},she={BigNumberDependencies:Ue,UnitDependencies:xt,createClassicalElectronRadius:D0},lhe={typedDependencies:se,createClone:Lf},Ti={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createSmaller:im},iB={DenseMatrixDependencies:Ft,smallerDependencies:Ti,createImmutableDenseMatrixClass:vm},$n={ImmutableDenseMatrixDependencies:iB,createIndexClass:gm},Ky={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createLargerEq:cm},$C={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createSmallerEq:om},jl={bignumberDependencies:Na,matrixDependencies:je,largerDependencies:Mi,largerEqDependencies:Ky,smallerDependencies:Ti,smallerEqDependencies:$C,typedDependencies:se,createRange:ic},aB={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createColumn:rc},uhe={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createColumnTransform:oy},che={typedDependencies:se,createCombinationsWithRep:xg},Kl={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,FractionDependencies:Ms,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createCompare:Zh},Ma={compareDependencies:Kl,typedDependencies:se,createCompareNatural:Qh},oB={concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createCompareText:Jh},sB={NodeDependencies:Pn,createConditionalNode:Sv},jo={NodeDependencies:Pn,createConstantNode:Ev},lB={NodeDependencies:Pn,typedDependencies:se,createFunctionAssignmentNode:Av},Ko={UnitDependencies:xt,NodeDependencies:Pn,createSymbolNode:Lv},Yo={NodeDependencies:Pn,SymbolNodeDependencies:Ko,createFunctionNode:qv},Yl={NodeDependencies:Pn,sizeDependencies:Fn,createIndexNode:Mv},Xl={NodeDependencies:Pn,createObjectNode:Ov},so={NodeDependencies:Pn,createOperatorNode:Iv},Is={NodeDependencies:Pn,createParenthesisNode:Pv},uB={NodeDependencies:Pn,createRangeNode:$v},cB={NodeDependencies:Pn,createRelationalNode:zv},ra={AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,AssignmentNodeDependencies:j$,BlockNodeDependencies:tB,ConditionalNodeDependencies:sB,ConstantNodeDependencies:jo,FunctionAssignmentNodeDependencies:lB,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,RangeNodeDependencies:uB,RelationalNodeDependencies:cB,SymbolNodeDependencies:Ko,numericDependencies:Ji,typedDependencies:se,createParse:Gv},dhe={parseDependencies:ra,typedDependencies:se,createCompile:Uv},Yy={ComplexDependencies:Rr,typedDependencies:se,createComplex:sp},Xy={typedDependencies:se,createIsPositive:Xf},fhe={addScalarDependencies:tn,combinationsDependencies:Hy,isIntegerDependencies:_i,isNegativeDependencies:Hl,isPositiveDependencies:Xy,largerDependencies:Mi,typedDependencies:se,createComposition:Ig},phe={isIntegerDependencies:_i,matrixDependencies:je,typedDependencies:se,createConcatTransform:gy},hhe={BigNumberDependencies:Ue,UnitDependencies:xt,createConductanceQuantum:y0},BC={typedDependencies:se,createCos:Bm},mhe={typedDependencies:se,createCosh:zm},vhe={BigNumberDependencies:Ue,typedDependencies:se,createCot:Lm},ghe={BigNumberDependencies:Ue,typedDependencies:se,createCoth:Vm},yhe={BigNumberDependencies:Ue,UnitDependencies:xt,createCoulomb:m0},dB={multiplyScalarDependencies:Hr,numericDependencies:Ji,typedDependencies:se,createProd:Eh},bhe={prodDependencies:dB,sizeDependencies:Fn,typedDependencies:se,createCount:th},xhe={UnitDependencies:xt,typedDependencies:se,createCreateUnit:Dm},whe={matrixDependencies:je,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,createCross:rh},Che={BigNumberDependencies:Ue,typedDependencies:se,createCsc:qm},She={BigNumberDependencies:Ue,typedDependencies:se,createCsch:Gm},_c={matrixDependencies:je,typedDependencies:se,createTranspose:yh},zC={conjDependencies:Os,transposeDependencies:_c,typedDependencies:se,createCtranspose:bh},Dhe={typedDependencies:se,createCube:wp},LC={BigNumberDependencies:Ue,typedDependencies:se,createUnaryPlus:mp},Ehe={addDependencies:Ir,typedDependencies:se,unaryPlusDependencies:LC,createCumSum:hc},Nhe={addDependencies:Ir,typedDependencies:se,unaryPlusDependencies:LC,createCumSumTransform:wy},fB={equalDependencies:ea,typedDependencies:se,createDeepEqual:dm},Oi={divideScalarDependencies:$r,equalScalarDependencies:Yt,invDependencies:Rs,matrixDependencies:je,multiplyDependencies:kr,typedDependencies:se,createDivide:fg},pB={ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,parseDependencies:ra,typedDependencies:se,createResolve:zg},VC={bignumberDependencies:Na,fractionDependencies:Wl,AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,SymbolNodeDependencies:Ko,matrixDependencies:je,typedDependencies:se,createSimplifyConstant:$g},qC={AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,addDependencies:Ir,divideDependencies:Oi,equalDependencies:ea,isZeroDependencies:ta,multiplyDependencies:kr,parseDependencies:ra,powDependencies:_a,subtractDependencies:Nr,typedDependencies:se,createSimplifyCore:Bg},Zy={bignumberDependencies:Na,fractionDependencies:Wl,AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,addDependencies:Ir,divideDependencies:Oi,equalDependencies:ea,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,parseDependencies:ra,powDependencies:_a,resolveDependencies:pB,simplifyConstantDependencies:VC,simplifyCoreDependencies:qC,subtractDependencies:Nr,typedDependencies:se,createSimplify:Fg},Ahe={ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,equalDependencies:ea,isZeroDependencies:ta,numericDependencies:Ji,parseDependencies:ra,simplifyDependencies:Zy,typedDependencies:se,createDerivative:Vg},_he={BigNumberDependencies:Ue,UnitDependencies:xt,createDeuteronMass:T0},hB={DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,matrixDependencies:je,typedDependencies:se,createDiag:nh},Mhe={matrixDependencies:je,numberDependencies:Wo,subtractDependencies:Nr,typedDependencies:se,createDiff:nc},The={bignumberDependencies:Na,matrixDependencies:je,numberDependencies:Wo,subtractDependencies:Nr,typedDependencies:se,createDiffTransform:yy},Ta={ComplexDependencies:Rr,typedDependencies:se,createSqrt:$p},Ohe={absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,multiplyScalarDependencies:Hr,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,createDistance:pg},Mc={DenseMatrixDependencies:Ft,concatDependencies:lr,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createDotDivide:Vh},Rhe={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,typedDependencies:se,createDotMultiply:qp},Ihe={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,powDependencies:_a,typedDependencies:se,createDotPow:Lh},mB={BigNumberDependencies:Ue,createE:Qg},khe={BigNumberDependencies:Ue,createEfimovFactor:F0},Tc={matrixDependencies:je,typedDependencies:se,createFlatten:ah},GC={typedDependencies:se,createIm:Xp},UC={flattenDependencies:Tc,matrixDependencies:je,sizeDependencies:Fn,typedDependencies:se,createMatrixFromColumns:fp},vB={BigNumberDependencies:Ue,FractionDependencies:Ms,complexDependencies:Yy,typedDependencies:se,createSign:Fp},WC={addScalarDependencies:tn,complexDependencies:Yy,conjDependencies:Os,divideScalarDependencies:$r,equalDependencies:ea,identityDependencies:Ho,isZeroDependencies:ta,matrixDependencies:je,multiplyScalarDependencies:Hr,signDependencies:vB,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,zerosDependencies:Ea,createQr:Yv},HC={typedDependencies:se,createRe:Zp},jC={typedDependencies:se,createSin:Hm},KC={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createUsolve:Gh},gB={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createUsolveAll:Wh},yB={absDependencies:Qn,addDependencies:Ir,addScalarDependencies:tn,atanDependencies:K$,bignumberDependencies:Na,columnDependencies:aB,complexDependencies:Yy,cosDependencies:BC,diagDependencies:hB,divideScalarDependencies:$r,dotDependencies:Wy,equalDependencies:ea,flattenDependencies:Tc,imDependencies:GC,invDependencies:Rs,largerDependencies:Mi,matrixDependencies:je,matrixFromColumnsDependencies:UC,multiplyDependencies:kr,multiplyScalarDependencies:Hr,numberDependencies:Wo,qrDependencies:WC,reDependencies:HC,sinDependencies:jC,smallerDependencies:Ti,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,usolveDependencies:KC,usolveAllDependencies:gB,createEigs:og},Phe={BigNumberDependencies:Ue,UnitDependencies:xt,createElectricConstant:p0},Fhe={BigNumberDependencies:Ue,UnitDependencies:xt,createElectronMass:E0},$he={BigNumberDependencies:Ue,UnitDependencies:xt,createElementaryCharge:v0},Bhe={compareTextDependencies:oB,isZeroDependencies:ta,typedDependencies:se,createEqualText:rm},zhe={typedDependencies:se,createErf:Sh},bB={parseDependencies:ra,typedDependencies:se,createEvaluate:Wv},xB={typedDependencies:se,createExp:Cp},Lhe={absDependencies:Qn,addDependencies:Ir,identityDependencies:Ho,invDependencies:Rs,multiplyDependencies:kr,typedDependencies:se,createExpm:sg},Vhe={ComplexDependencies:Rr,typedDependencies:se,createExpm1:Sp},qhe={createFalse:Hg},Ghe={BigNumberDependencies:Ue,UnitDependencies:xt,createFaraday:L0},Uhe={BigNumberDependencies:Ue,UnitDependencies:xt,createFermiCoupling:N0},wB={ComplexDependencies:Rr,createI:o0},CB={ComplexDependencies:Rr,typedDependencies:se,createLog2:Tp},SB={BigNumberDependencies:Ue,createTau:Zg},DB={addScalarDependencies:tn,ceilDependencies:FC,conjDependencies:Os,divideScalarDependencies:$r,dotDivideDependencies:Mc,expDependencies:xB,iDependencies:wB,log2Dependencies:CB,matrixDependencies:je,multiplyScalarDependencies:Hr,powDependencies:_a,tauDependencies:SB,typedDependencies:se,createFft:wh},EB={largerDependencies:Mi,smallerDependencies:Ti,createFibonacciHeapClass:ym},Whe={typedDependencies:se,createFilter:ih},Hhe={typedDependencies:se,createFilterTransform:sy},jhe={BigNumberDependencies:Ue,createFineStructure:A0},Khe={BigNumberDependencies:Ue,UnitDependencies:xt,createFirstRadiation:V0},Yhe={typedDependencies:se,createForEach:oh},Xhe={typedDependencies:se,createForEachTransform:ly},Zhe={BigNumberDependencies:Ue,UnitDependencies:xt,createGasConstant:G0},Qhe={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createGcd:Np},Jhe={typedDependencies:se,createGetMatrixDataType:sh},eme={BigNumberDependencies:Ue,UnitDependencies:xt,createGravitationConstant:u0},tme={BigNumberDependencies:Ue,UnitDependencies:xt,createGravity:Q0},rme={BigNumberDependencies:Ue,UnitDependencies:xt,createHartreeEnergy:_0},nme={isNumericDependencies:Ts,typedDependencies:se,createHasNumericValue:Yf},NB={parseDependencies:ra,createHelpClass:Jv},ime={HelpDependencies:NB,typedDependencies:se,createHelp:tg},ame={formatDependencies:Ac,typedDependencies:se,createHex:Mh},ome={absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,isPositiveDependencies:Xy,multiplyScalarDependencies:Hr,smallerDependencies:Ti,sqrtDependencies:Ta,typedDependencies:se,createHypot:sv},sme={conjDependencies:Os,dotDivideDependencies:Mc,fftDependencies:DB,typedDependencies:se,createIfft:Ch},AB={IndexDependencies:$n,typedDependencies:se,createIndex:dv},lme={IndexDependencies:$n,createIndexTransform:uy},ume={BigNumberDependencies:Ue,createInfinity:Kg},cme={absDependencies:Qn,addDependencies:Ir,addScalarDependencies:tn,divideScalarDependencies:$r,equalScalarDependencies:Yt,flattenDependencies:Tc,isNumericDependencies:Ts,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,multiplyScalarDependencies:Hr,smallerDependencies:Ti,subtractDependencies:Nr,typedDependencies:se,createIntersect:hg},dme={BigNumberDependencies:Ue,UnitDependencies:xt,createInverseConductanceQuantum:b0},_B={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createMod:Rp},MB={BigNumberDependencies:Ue,matrixDependencies:je,typedDependencies:se,createXgcd:Lp},fme={BigNumberDependencies:Ue,addDependencies:Ir,equalDependencies:ea,isIntegerDependencies:_i,modDependencies:_B,smallerDependencies:Ti,typedDependencies:se,xgcdDependencies:MB,createInvmod:Vp},Oc={typedDependencies:se,createIsNaN:Qf},pme={typedDependencies:se,createIsPrime:Rh},YC={ComplexDependencies:Rr,divideScalarDependencies:$r,typedDependencies:se,createLog:$h},Zl={typedDependencies:se,createMap:ch},TB={addDependencies:Ir,numericDependencies:Ji,typedDependencies:se,createSum:pc},hme={divideDependencies:Oi,dotDivideDependencies:Mc,isNumericDependencies:Ts,logDependencies:YC,mapDependencies:Zl,matrixDependencies:je,multiplyDependencies:kr,sumDependencies:TB,typedDependencies:se,createKldivergence:Dg},mme={BigNumberDependencies:Ue,UnitDependencies:xt,createKlitzing:C0},vme={matrixDependencies:je,multiplyScalarDependencies:Hr,typedDependencies:se,createKron:uh},gme={BigNumberDependencies:Ue,createLN10:t0},yme={BigNumberDependencies:Ue,createLN2:e0},bme={BigNumberDependencies:Ue,createLOG10E:n0},xme={BigNumberDependencies:Ue,createLOG2E:r0},wme={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createLcm:_p},Cme={parseDependencies:ra,typedDependencies:se,createLeafCount:kg},Sme={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createLeftShift:Hh},Dme={ComplexDependencies:Rr,typedDependencies:se,createLgamma:Cg},Eme={ComplexDependencies:Rr,typedDependencies:se,createLog10:Mp},Nme={ComplexDependencies:Rr,divideScalarDependencies:$r,logDependencies:YC,typedDependencies:se,createLog1p:Bh},Ame={BigNumberDependencies:Ue,UnitDependencies:xt,createLoschmidt:q0},OB={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createLsolve:qh},_me={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createLsolveAll:Uh},RB={FibonacciHeapDependencies:EB,addScalarDependencies:tn,equalScalarDependencies:Yt,createSpaClass:bm},IB={DenseMatrixDependencies:Ft,SpaDependencies:RB,SparseMatrixDependencies:oo,absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,equalScalarDependencies:Yt,largerDependencies:Mi,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,createLup:Kv},kB={SparseMatrixDependencies:oo,absDependencies:Qn,addDependencies:Ir,divideScalarDependencies:$r,largerDependencies:Mi,largerEqDependencies:Ky,multiplyDependencies:kr,subtractDependencies:Nr,transposeDependencies:_c,typedDependencies:se,createSlu:Xv},PB={DenseMatrixDependencies:Ft,lsolveDependencies:OB,lupDependencies:IB,matrixDependencies:je,sluDependencies:kB,typedDependencies:se,usolveDependencies:KC,createLusolve:Zv},XC={absDependencies:Qn,addDependencies:Ir,conjDependencies:Os,ctransposeDependencies:zC,eigsDependencies:yB,equalScalarDependencies:Yt,largerDependencies:Mi,matrixDependencies:je,multiplyDependencies:kr,powDependencies:_a,smallerDependencies:Ti,sqrtDependencies:Ta,typedDependencies:se,createNorm:lv},FB={identityDependencies:Ho,matrixDependencies:je,multiplyDependencies:kr,normDependencies:XC,qrDependencies:WC,subtractDependencies:Nr,typedDependencies:se,createSchur:cg},$B={absDependencies:Qn,addDependencies:Ir,concatDependencies:lr,identityDependencies:Ho,indexDependencies:AB,lusolveDependencies:PB,matrixDependencies:je,matrixFromColumnsDependencies:UC,multiplyDependencies:kr,rangeDependencies:jl,schurDependencies:FB,subsetDependencies:ci,subtractDependencies:Nr,transposeDependencies:_c,typedDependencies:se,createSylvester:ug},Mme={matrixDependencies:je,multiplyDependencies:kr,sylvesterDependencies:$B,transposeDependencies:_c,typedDependencies:se,createLyap:dg},ZC={compareDependencies:Kl,isNaNDependencies:Oc,isNumericDependencies:Ts,typedDependencies:se,createPartitionSelect:hm},BB={addDependencies:Ir,compareDependencies:Kl,divideDependencies:Oi,partitionSelectDependencies:ZC,typedDependencies:se,createMedian:vg},Tme={absDependencies:Qn,mapDependencies:Zl,medianDependencies:BB,subtractDependencies:Nr,typedDependencies:se,createMad:gg},Ome={BigNumberDependencies:Ue,UnitDependencies:xt,createMagneticConstant:f0},Rme={BigNumberDependencies:Ue,UnitDependencies:xt,createMagneticFluxQuantum:x0},Ime={typedDependencies:se,createMapTransform:cy},kme={isZeroDependencies:ta,matrixDependencies:je,typedDependencies:se,createMatrixFromFunction:cp},Pme={flattenDependencies:Tc,matrixDependencies:je,sizeDependencies:Fn,typedDependencies:se,createMatrixFromRows:dp},zB={largerDependencies:Mi,numericDependencies:Ji,typedDependencies:se,createMax:lc},Fme={largerDependencies:Mi,numericDependencies:Ji,typedDependencies:se,createMaxTransform:dy},$me={addDependencies:Ir,divideDependencies:Oi,typedDependencies:se,createMean:mc},Bme={addDependencies:Ir,divideDependencies:Oi,typedDependencies:se,createMeanTransform:fy},zme={numericDependencies:Ji,smallerDependencies:Ti,typedDependencies:se,createMin:uc},Lme={numericDependencies:Ji,smallerDependencies:Ti,typedDependencies:se,createMinTransform:py},Vme={isNaNDependencies:Oc,isNumericDependencies:Ts,typedDependencies:se,createMode:Dh},qme={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarMass:X0},Gme={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarMassC12:Z0},Ume={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarPlanckConstant:U0},Wme={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarVolume:W0},Hme={addDependencies:Ir,divideDependencies:Oi,factorialDependencies:jy,isIntegerDependencies:_i,isPositiveDependencies:Xy,multiplyDependencies:kr,typedDependencies:se,createMultinomial:Eg},jme={BigNumberDependencies:Ue,createNaN:Yg},Kme={BigNumberDependencies:Ue,UnitDependencies:xt,createNeutronMass:O0},Yme={BigNumberDependencies:Ue,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createNthRoot:Pp},Xme={ComplexDependencies:Rr,divideScalarDependencies:$r,typedDependencies:se,createNthRoots:zh},Zme={BigNumberDependencies:Ue,UnitDependencies:xt,createNuclearMagneton:w0},Qme={createNull:jg},Jme={formatDependencies:Ac,typedDependencies:se,createOct:_h},eve={BigNumberDependencies:Ue,matrixDependencies:je,typedDependencies:se,createOnes:dh},tve={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createOr:Jp},LB={evaluateDependencies:bB,createParserClass:Hv},rve={ParserDependencies:LB,typedDependencies:se,createParser:jv},nve={factorialDependencies:jy,typedDependencies:se,createPermutations:Ng},ive={BigNumberDependencies:Ue,createPhi:Jg},VB={BigNumberDependencies:Ue,createPi:Xg},ave={typedDependencies:se,createPickRandom:Ag},ove={ComplexDependencies:Rr,addDependencies:Ir,ctransposeDependencies:zC,deepEqualDependencies:fB,divideScalarDependencies:$r,dotDependencies:Wy,dotDivideDependencies:Mc,equalDependencies:ea,invDependencies:Rs,matrixDependencies:je,multiplyDependencies:kr,typedDependencies:se,createPinv:ag},sve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckCharge:ry},lve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckConstant:c0},uve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckLength:J0},cve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckMass:ey},dve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckTemperature:ny},fve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckTime:ty},qB={typedDependencies:se,createTypeOf:Jf},pve={addDependencies:Ir,cbrtDependencies:rB,divideDependencies:Oi,equalScalarDependencies:Yt,imDependencies:GC,isZeroDependencies:ta,multiplyDependencies:kr,reDependencies:HC,sqrtDependencies:Ta,subtractDependencies:Nr,typeOfDependencies:qB,typedDependencies:se,unaryMinusDependencies:Aa,createPolynomialRoot:Qv},hve={typedDependencies:se,createPrint:Th},mve={BigNumberDependencies:Ue,UnitDependencies:xt,createProtonMass:M0},vve={addDependencies:Ir,compareDependencies:Kl,multiplyDependencies:kr,partitionSelectDependencies:ZC,typedDependencies:se,createQuantileSeq:yg},gve={BigNumberDependencies:Ue,UnitDependencies:xt,createQuantumOfCirculation:R0},yve={typedDependencies:se,createRandom:_g},bve={typedDependencies:se,createRandomInt:Mg},xve={createRangeClass:$f},wve={bignumberDependencies:Na,matrixDependencies:je,largerDependencies:Mi,largerEqDependencies:Ky,smallerDependencies:Ti,smallerEqDependencies:$C,typedDependencies:se,createRangeTransform:hy},Cve={bignumberDependencies:Na,fractionDependencies:Wl,AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,addDependencies:Ir,divideDependencies:Oi,equalDependencies:ea,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,parseDependencies:ra,powDependencies:_a,simplifyDependencies:Zy,simplifyConstantDependencies:VC,simplifyCoreDependencies:qC,subtractDependencies:Nr,typedDependencies:se,createRationalize:qg},Sve={BigNumberDependencies:Ue,UnitDependencies:xt,createReducedPlanckConstant:d0},Dve={createReplacer:Ug},Eve={isIntegerDependencies:_i,matrixDependencies:je,typedDependencies:se,createReshape:fh},Nve={matrixDependencies:je,createResize:ph},Ave={createReviver:Gg},_ve={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createRightArithShift:jh},Mve={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createRightLogShift:Kh},GB={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,addScalarDependencies:tn,cosDependencies:BC,matrixDependencies:je,multiplyScalarDependencies:Hr,normDependencies:XC,sinDependencies:jC,typedDependencies:se,unaryMinusDependencies:Aa,createRotationMatrix:mh},Tve={multiplyDependencies:kr,rotationMatrixDependencies:GB,typedDependencies:se,createRotate:hh},Ove={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createRow:ac},Rve={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createRowTransform:my},Ive={BigNumberDependencies:Ue,UnitDependencies:xt,createRydberg:I0},kve={BigNumberDependencies:Ue,createSQRT1_2:i0},Pve={BigNumberDependencies:Ue,createSQRT2:a0},Fve={BigNumberDependencies:Ue,createSackurTetrode:H0},$ve={BigNumberDependencies:Ue,typedDependencies:se,createSec:Um},Bve={BigNumberDependencies:Ue,typedDependencies:se,createSech:Wm},zve={BigNumberDependencies:Ue,UnitDependencies:xt,createSecondRadiation:j0},Lve={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetCartesian:Xm},UB={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetDifference:Zm},Vve={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetDistinct:Qm},WB={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetIntersect:Jm},qve={IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetIsSubset:ev},Gve={IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetMultiplicity:tv},Uve={IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetPowerset:rv},Wve={compareNaturalDependencies:Ma,typedDependencies:se,createSetSize:nv},HB={IndexDependencies:$n,concatDependencies:lr,setDifferenceDependencies:UB,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetSymDifference:iv},Hve={IndexDependencies:$n,concatDependencies:lr,setIntersectDependencies:WB,setSymDifferenceDependencies:HB,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetUnion:av},jve={typedDependencies:se,createSinh:jm},Kve={compareDependencies:Kl,compareNaturalDependencies:Ma,matrixDependencies:je,typedDependencies:se,createSort:mm},Yve={SparseMatrixDependencies:oo,typedDependencies:se,createSparse:Sm},Xve={BigNumberDependencies:Ue,UnitDependencies:xt,createSpeedOfLight:l0},Zve={typedDependencies:se,createSplitUnit:pp},Qve={absDependencies:Qn,addDependencies:Ir,identityDependencies:Ho,invDependencies:Rs,mapDependencies:Zl,maxDependencies:zB,multiplyDependencies:kr,sizeDependencies:Fn,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,createSqrtm:lg},Jve={typedDependencies:se,createSquare:Bp},ege={matrixDependencies:je,typedDependencies:se,createSqueeze:gh},QC={addDependencies:Ir,applyDependencies:PC,divideDependencies:Oi,isNaNDependencies:Oc,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,createVariance:vc},tge={mapDependencies:Zl,sqrtDependencies:Ta,typedDependencies:se,varianceDependencies:QC,createStd:gc},rge={mapDependencies:Zl,sqrtDependencies:Ta,typedDependencies:se,varianceDependencies:QC,createStdTransform:by},nge={BigNumberDependencies:Ue,UnitDependencies:xt,createStefanBoltzmann:K0},ige={typedDependencies:se,createString:ip},age={matrixDependencies:je,typedDependencies:se,createSubsetTransform:vy},oge={addDependencies:Ir,numericDependencies:Ji,typedDependencies:se,createSumTransform:xy},sge={OperatorNodeDependencies:so,parseDependencies:ra,simplifyDependencies:Zy,typedDependencies:se,createSymbolicEqual:Lg},lge={typedDependencies:se,createTan:Km},uge={typedDependencies:se,createTanh:Ym},cge={BigNumberDependencies:Ue,UnitDependencies:xt,createThomsonCrossSection:k0},dge={concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createTo:Oh},fge={addDependencies:Ir,matrixDependencies:je,typedDependencies:se,createTrace:cv},pge={createTrue:Wg},hge={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createUnequal:pm},mge={UnitDependencies:xt,typedDependencies:se,createUnitFunction:Cm},vge={eDependencies:mB,createUppercaseE:Rw},gge={piDependencies:VB,createUppercasePi:Ow},yge={BigNumberDependencies:Ue,UnitDependencies:xt,createVacuumImpedance:h0},bge={addDependencies:Ir,applyDependencies:PC,divideDependencies:Oi,isNaNDependencies:Oc,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,createVarianceTransform:Cy},xge={createVersion:s0},wge={BigNumberDependencies:Ue,createWeakMixingAngle:P0},Cge={BigNumberDependencies:Ue,UnitDependencies:xt,createWienDisplacement:Y0},Sge={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createXor:eh},Dge=Ope,JC={exports:{}};function eS(){}eS.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;for(n;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var a=0,o=n.length;a<o;a++)n[a].fn!==t&&n[a].fn._!==t&&i.push(n[a]);return i.length?r[e]=i:delete r[e],this}},JC.exports=eS,JC.exports.TinyEmitter=eS;function Ege(e){var t=new JC.exports;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 Nge(e,t,r,n){function i(y,b){var D=arguments.length;if(D!==1&&D!==2)throw new wa("import",D,1,2);b||(b={});function x(E,A,_){if(Array.isArray(A))A.forEach(R=>x(E,R));else if(typeof A=="object")for(var N in A)et(A,N)&&x(E,A[N],N);else if(Yu(A)||_!==void 0){var M=Yu(A)?m(A)?A.fn+".transform":A.fn:_;if(et(E,M)&&E[M]!==A&&!b.silent)throw new Error('Cannot import "'+M+'" twice');E[M]=A}else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}var S={};x(S,y);for(var w in S)if(et(S,w)){var C=S[w];if(Yu(C))u(C,b);else if(c(C))a(w,C,b);else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}}function a(y,b,D){if(D.wrap&&typeof b=="function"&&(b=l(b)),d(b)&&(b=e(y,{[b.signature]:b})),e.isTypedFunction(r[y])&&e.isTypedFunction(b)){D.override?b=e(y,b.signatures):b=e(r[y],b),r[y]=b,delete n[y],o(y,b),r.emit("import",y,function(){return b});return}if(r[y]===void 0||D.override){r[y]=b,delete n[y],o(y,b),r.emit("import",y,function(){return b});return}if(!D.silent)throw new Error('Cannot import "'+y+'": already exists')}function o(y,b){b&&typeof b.transform=="function"?(r.expression.transform[y]=b.transform,f(y)&&(r.expression.mathWithTransform[y]=b.transform)):(delete r.expression.transform[y],f(y)&&(r.expression.mathWithTransform[y]=b))}function s(y){delete r.expression.transform[y],f(y)?r.expression.mathWithTransform[y]=r[y]:delete r.expression.mathWithTransform[y]}function l(y){var b=function(){for(var x=[],S=0,w=arguments.length;S<w;S++){var C=arguments[S];x[S]=C&&C.valueOf()}return y.apply(r,x)};return y.transform&&(b.transform=y.transform),b}function u(y,b){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.fn;if(FM(D,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(D));var x=m(y)?r.expression.transform:r,S=D in r.expression.transform,w=et(x,D)?x[D]:void 0,C=function(){var A={};y.dependencies.map($M).forEach(N=>{if(FM(N,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(N));N==="math"?A.math=r:N==="mathWithTransform"?A.mathWithTransform=r.expression.mathWithTransform:N==="classes"?A.classes=r:A[N]=r[N]});var _=y(A);if(_&&typeof _.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(w===void 0||b.override)return _;if(e.isTypedFunction(w)&&e.isTypedFunction(_))return e(w,_);if(b.silent)return w;throw new Error('Cannot import "'+D+'": already exists')};!y.meta||y.meta.lazy!==!1?(vf(x,D,C),w&&S?s(D):(m(y)||p(y))&&vf(r.expression.mathWithTransform,D,()=>x[D])):(x[D]=C(),w&&S?s(D):(m(y)||p(y))&&vf(r.expression.mathWithTransform,D,()=>x[D])),n[D]=y,r.emit("import",D,C)}function c(y){return typeof y=="function"||typeof y=="number"||typeof y=="string"||typeof y=="boolean"||y===null||bi(y)||yi(y)||kt(y)||Mo(y)||ft(y)||Array.isArray(y)}function d(y){return typeof y=="function"&&typeof y.signature=="string"}function f(y){return!et(v,y)}function p(y){return y.fn.indexOf(".")===-1&&!et(v,y.fn)&&(!y.meta||!y.meta.isClass)}function m(y){return y!==void 0&&y.meta!==void 0&&y.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return i}function jB(e,t){var r=fn({},pf,t);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=Ege({isNumber:Ut,isComplex:yi,isBigNumber:kt,isFraction:Mo,isUnit:bi,isString:bn,isArray:or,isMatrix:ft,isCollection:xi,isDenseMatrix:hl,isSparseMatrix:ja,isRange:Uu,isIndex:ml,isBoolean:Tx,isResultSet:Ox,isHelp:hf,isFunction:Rx,isDate:Ix,isRegExp:kx,isObject:Wu,isNull:Px,isUndefined:Fx,isAccessorNode:Ka,isArrayNode:Yn,isAssignmentNode:$x,isBlockNode:Bx,isConditionalNode:zx,isConstantNode:Kt,isFunctionAssignmentNode:hs,isFunctionNode:ya,isIndexNode:To,isNode:sr,isObjectNode:vl,isOperatorNode:Wr,isParenthesisNode:zi,isRangeNode:Vx,isRelationalNode:qx,isSymbolNode:en,isChain:mf});n.config=pJ(r,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var i=[],a=[];function o(c){if(Yu(c))return c(n);var d=c[Object.keys(c)[0]];if(Yu(d))return d(n);if(!dJ(c))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",c),new Error("Factory object with properties `type`, `name`, and `factory` expected");var f=i.indexOf(c),p;return f===-1?(c.math===!0?p=c.factory(n.type,r,o,n.typed,n):p=c.factory(n.type,r,o,n.typed),i.push(c),a.push(p)):p=a[f],p}var s={};function l(){for(var c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];return n.typed.apply(n.typed,d)}l.isTypedFunction=Wx.isTypedFunction;var u=Nge(l,o,n,s);return n.import=u,n.on("config",()=>{gM(s).forEach(c=>{c&&c.meta&&c.meta.recreateOnConfigChange&&u(c,{override:!0})})}),n.create=jB.bind(null,e),n.factory=Q,n.import(gM(cJ(e))),n.ArgumentsError=wa,n.DimensionError=Ot,n.IndexError=ii,n}const Age=Object.freeze(Object.defineProperty({__proto__:null,config:Ie,IndexError:ii,DimensionError:Ot,ArgumentsError:wa,create:jB,factory:Q,BigNumber:Ge,Complex:Sr,e:kw,_false:wk,fineStructure:Ck,Fraction:Lo,i:Pw,_Infinity:Sk,LN10:Dk,LOG10E:Ek,Matrix:yc,_NaN:Nk,_null:Ak,phi:_k,Range:Mk,ResultSet:Fw,SQRT1_2:Tk,sackurTetrode:Ok,tau:$w,_true:Rk,version:Ik,DenseMatrix:Rt,efimovFactor:kk,LN2:Pk,pi:Bw,replacer:Fk,SQRT2:$k,typed:oe,unaryPlus:Sy,weakMixingAngle:Bk,abs:Un,acos:zk,acot:Lk,acsc:Vk,addScalar:Yr,arg:qk,asech:Gk,asinh:Uk,atan:zw,atanh:Wk,bignumber:ji,bitNot:Hk,boolean:jk,clone:Kk,combinations:bc,complex:xc,conj:Vo,cosh:Yk,coth:Xk,csc:Zk,cube:Qk,equalScalar:jt,erf:Jk,exp:Lw,expm1:eP,filter:tP,forEach:rP,format:Fl,getMatrixDataType:nP,hex:iP,im:Dy,isInteger:oi,isNegative:xs,isPositive:wc,isZero:Di,LOG2E:aP,lgamma:oP,log10:sP,log2:Vw,map:ws,multiplyScalar:Vr,not:qw,number:to,oct:lP,pickRandom:uP,print:cP,random:dP,re:Ey,sec:fP,sign:Gw,sin:Ny,SparseMatrix:Sa,splitUnit:pP,square:hP,string:mP,tan:vP,typeOf:Uw,acosh:gP,acsch:yP,apply:Ay,asec:bP,bin:xP,combinationsWithRep:wP,cos:_y,csch:CP,isNaN:$l,isPrime:SP,randomInt:DP,sech:EP,sinh:NP,sparse:AP,sqrt:Ki,tanh:_P,unaryMinus:Yi,acoth:MP,cot:TP,fraction:Cs,isNumeric:qo,matrix:We,matrixFromFunction:OP,mode:RP,numeric:Ei,prod:Ww,reshape:IP,size:Sn,squeeze:kP,subset:Zn,transpose:Bl,xgcd:Hw,zeros:Xi,asin:PP,cbrt:jw,concat:nr,count:FP,ctranspose:My,diag:Kw,divideScalar:Fr,dotDivide:zl,equal:Ni,flatten:Ll,gcd:$P,hasNumericValue:BP,identity:ro,kron:zP,largerEq:Cc,leftShift:LP,matrixFromColumns:Ty,mod:Yw,nthRoot:VP,ones:qP,resize:GP,rightArithShift:UP,round:Sc,smaller:si,to:WP,unequal:HP,xor:jP,add:Dr,bitAnd:KP,bitXor:YP,catalan:XP,compare:Ss,compareText:Xw,cumsum:ZP,deepEqual:Zw,dot:Dc,equalText:QP,floor:Qw,hypot:JP,ImmutableDenseMatrix:Jw,Index:Dn,invmod:eF,larger:li,log:Oy,matrixFromRows:tF,min:rF,multiply:Er,nthRoots:nF,or:iF,partitionSelect:Ry,quantileSeq:aF,rightLogShift:oF,smallerEq:Iy,subtract:gr,trace:sF,usolve:ky,and:lF,bitOr:uF,ceil:Py,compareNatural:Zi,composition:cF,cross:dF,det:eC,diff:fF,distance:pF,dotMultiply:hF,FibonacciHeap:tC,fix:rC,index:nC,intersect:mF,lcm:vF,log1p:gF,lsolve:iC,max:aC,qr:Fy,range:Ds,row:yF,setCartesian:bF,setDistinct:xF,setIsSubset:wF,setPowerset:CF,slu:oC,Spa:sC,sum:lC,usolveAll:uC,atan2:SF,column:cC,lsolveAll:DF,setDifference:dC,setMultiplicity:EF,setSymDifference:fC,sort:NF,inv:Go,lup:pC,pinv:AF,pow:Qi,setIntersect:hC,setUnion:_F,sqrtm:MF,Unit:yt,vacuumImpedance:TF,wienDisplacement:OF,atomicMass:RF,bohrMagneton:IF,boltzmann:kF,conductanceQuantum:PF,createUnit:FF,deuteronMass:$F,dotPow:BF,electricConstant:zF,elementaryCharge:LF,expm:VF,faraday:qF,fft:mC,gamma:vC,gravitationConstant:GF,hartreeEnergy:UF,ifft:WF,klitzing:HF,loschmidt:jF,magneticConstant:KF,molarMass:YF,molarPlanckConstant:XF,neutronMass:ZF,nuclearMagneton:QF,planckCharge:JF,planckLength:e$,planckTemperature:t$,protonMass:r$,reducedPlanckConstant:n$,rydberg:i$,secondRadiation:a$,speedOfLight:o$,stefanBoltzmann:s$,thomsonCrossSection:l$,avogadro:u$,bohrRadius:c$,coulomb:d$,divide:ui,electronMass:f$,factorial:Ec,firstRadiation:p$,gasConstant:h$,inverseConductanceQuantum:m$,lusolve:gC,magneticFluxQuantum:v$,molarMassC12:g$,multinomial:y$,permutations:b$,planckMass:x$,polynomialRoot:w$,setSize:C$,stirlingS2:yC,unit:S$,bellNumbers:D$,eigs:bC,fermiCoupling:E$,gravity:N$,kldivergence:A$,mean:xC,molarVolume:_$,planckConstant:M$,quantumOfCirculation:T$,variance:$y,classicalElectronRadius:O$,median:wC,planckTime:R$,std:By,mad:I$,norm:zy,rotationMatrix:CC,rotate:k$,schur:SC,sylvester:DC,lyap:P$,docs:yI,Node:En,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,RelationalNode:EC,ArrayNode:Ns,BlockNode:NC,ConditionalNode:AC,ConstantNode:no,RangeNode:_C,reviver:$$,Chain:Ly,FunctionAssignmentNode:MC,chain:B$,AccessorNode:As,IndexNode:_s,AssignmentNode:TC,SymbolNode:io,FunctionNode:ao,parse:Ai,resolve:OC,simplifyConstant:Vy,compile:z$,evaluate:RC,Help:IC,Parser:kC,simplifyCore:qy,help:L$,simplify:Nc,symbolicEqual:V$,derivative:q$,parser:G$,leafCount:U$,rationalize:W$,isAccessorNode:Ka,isArray:or,isArrayNode:Yn,isAssignmentNode:$x,isBigNumber:kt,isBlockNode:Bx,isBoolean:Tx,isChain:mf,isCollection:xi,isComplex:yi,isConditionalNode:zx,isConstantNode:Kt,isDate:Ix,isDenseMatrix:hl,isFraction:Mo,isFunction:Rx,isFunctionAssignmentNode:hs,isFunctionNode:ya,isHelp:hf,isIndex:ml,isIndexNode:To,isMatrix:ft,isNode:sr,isNull:Px,isNumber:Ut,isString:bn,isUndefined:Fx,isObject:Wu,isObjectNode:vl,isOperatorNode:Wr,isParenthesisNode:zi,isRange:Uu,isRangeNode:Vx,isRelationalNode:qx,isRegExp:kx,isResultSet:Ox,isSparseMatrix:ja,isSymbolNode:en,isUnit:bi,absDependencies:Qn,AccessorNodeDependencies:Gl,acosDependencies:Rpe,acoshDependencies:Ipe,acotDependencies:kpe,acothDependencies:Ppe,acscDependencies:Fpe,acschDependencies:$pe,addDependencies:Ir,addScalarDependencies:tn,andDependencies:Bpe,applyDependencies:PC,applyTransformDependencies:zpe,argDependencies:Lpe,ArrayNodeDependencies:Ul,asecDependencies:Vpe,asechDependencies:qpe,asinDependencies:Gpe,asinhDependencies:Upe,AssignmentNodeDependencies:j$,atanDependencies:K$,atan2Dependencies:Wpe,atanhDependencies:Hpe,atomicMassDependencies:jpe,avogadroDependencies:Kpe,bellNumbersDependencies:Ype,BigNumberDependencies:Ue,bignumberDependencies:Na,binDependencies:Xpe,bitAndDependencies:Zpe,bitNotDependencies:Qpe,bitOrDependencies:Jpe,bitXorDependencies:ehe,BlockNodeDependencies:tB,bohrMagnetonDependencies:the,bohrRadiusDependencies:rhe,boltzmannDependencies:nhe,booleanDependencies:ihe,catalanDependencies:ahe,cbrtDependencies:rB,ceilDependencies:FC,chainDependencies:ohe,ChainDependencies:nB,classicalElectronRadiusDependencies:she,cloneDependencies:lhe,columnDependencies:aB,columnTransformDependencies:uhe,combinationsDependencies:Hy,combinationsWithRepDependencies:che,compareDependencies:Kl,compareNaturalDependencies:Ma,compareTextDependencies:oB,compileDependencies:dhe,complexDependencies:Yy,ComplexDependencies:Rr,compositionDependencies:fhe,concatDependencies:lr,concatTransformDependencies:phe,ConditionalNodeDependencies:sB,conductanceQuantumDependencies:hhe,conjDependencies:Os,ConstantNodeDependencies:jo,cosDependencies:BC,coshDependencies:mhe,cotDependencies:vhe,cothDependencies:ghe,coulombDependencies:yhe,countDependencies:bhe,createUnitDependencies:xhe,crossDependencies:whe,cscDependencies:Che,cschDependencies:She,ctransposeDependencies:zC,cubeDependencies:Dhe,cumsumDependencies:Ehe,cumsumTransformDependencies:Nhe,deepEqualDependencies:fB,DenseMatrixDependencies:Ft,derivativeDependencies:Ahe,detDependencies:Z$,deuteronMassDependencies:_he,diagDependencies:hB,diffDependencies:Mhe,diffTransformDependencies:The,distanceDependencies:Ohe,divideDependencies:Oi,divideScalarDependencies:$r,dotDependencies:Wy,dotDivideDependencies:Mc,dotMultiplyDependencies:Rhe,dotPowDependencies:Ihe,eDependencies:mB,efimovFactorDependencies:khe,eigsDependencies:yB,electricConstantDependencies:Phe,electronMassDependencies:Fhe,elementaryChargeDependencies:$he,equalDependencies:ea,equalScalarDependencies:Yt,equalTextDependencies:Bhe,erfDependencies:zhe,evaluateDependencies:bB,expDependencies:xB,expmDependencies:Lhe,expm1Dependencies:Vhe,factorialDependencies:jy,falseDependencies:qhe,faradayDependencies:Ghe,fermiCouplingDependencies:Uhe,fftDependencies:DB,FibonacciHeapDependencies:EB,filterDependencies:Whe,filterTransformDependencies:Hhe,fineStructureDependencies:jhe,firstRadiationDependencies:Khe,fixDependencies:X$,flattenDependencies:Tc,floorDependencies:Y$,forEachDependencies:Yhe,forEachTransformDependencies:Xhe,formatDependencies:Ac,fractionDependencies:Wl,FractionDependencies:Ms,FunctionAssignmentNodeDependencies:lB,FunctionNodeDependencies:Yo,gammaDependencies:Q$,gasConstantDependencies:Zhe,gcdDependencies:Qhe,getMatrixDataTypeDependencies:Jhe,gravitationConstantDependencies:eme,gravityDependencies:tme,hartreeEnergyDependencies:rme,hasNumericValueDependencies:nme,helpDependencies:ime,HelpDependencies:NB,hexDependencies:ame,hypotDependencies:ome,iDependencies:wB,identityDependencies:Ho,ifftDependencies:sme,imDependencies:GC,ImmutableDenseMatrixDependencies:iB,indexDependencies:AB,IndexDependencies:$n,IndexNodeDependencies:Yl,indexTransformDependencies:lme,InfinityDependencies:ume,intersectDependencies:cme,invDependencies:Rs,inverseConductanceQuantumDependencies:dme,invmodDependencies:fme,isIntegerDependencies:_i,isNaNDependencies:Oc,isNegativeDependencies:Hl,isNumericDependencies:Ts,isPositiveDependencies:Xy,isPrimeDependencies:pme,isZeroDependencies:ta,kldivergenceDependencies:hme,klitzingDependencies:mme,kronDependencies:vme,LN10Dependencies:gme,LN2Dependencies:yme,LOG10EDependencies:bme,LOG2EDependencies:xme,largerDependencies:Mi,largerEqDependencies:Ky,lcmDependencies:wme,leafCountDependencies:Cme,leftShiftDependencies:Sme,lgammaDependencies:Dme,logDependencies:YC,log10Dependencies:Eme,log1pDependencies:Nme,log2Dependencies:CB,loschmidtDependencies:Ame,lsolveDependencies:OB,lsolveAllDependencies:_me,lupDependencies:IB,lusolveDependencies:PB,lyapDependencies:Mme,madDependencies:Tme,magneticConstantDependencies:Ome,magneticFluxQuantumDependencies:Rme,mapDependencies:Zl,mapTransformDependencies:Ime,matrixDependencies:je,MatrixDependencies:Gy,matrixFromColumnsDependencies:UC,matrixFromFunctionDependencies:kme,matrixFromRowsDependencies:Pme,maxDependencies:zB,maxTransformDependencies:Fme,meanDependencies:$me,meanTransformDependencies:Bme,medianDependencies:BB,minDependencies:zme,minTransformDependencies:Lme,modDependencies:_B,modeDependencies:Vme,molarMassDependencies:qme,molarMassC12Dependencies:Gme,molarPlanckConstantDependencies:Ume,molarVolumeDependencies:Wme,multinomialDependencies:Hme,multiplyDependencies:kr,multiplyScalarDependencies:Hr,NaNDependencies:jme,neutronMassDependencies:Kme,NodeDependencies:Pn,normDependencies:XC,notDependencies:H$,nthRootDependencies:Yme,nthRootsDependencies:Xme,nuclearMagnetonDependencies:Zme,nullDependencies:Qme,numberDependencies:Wo,numericDependencies:Ji,ObjectNodeDependencies:Xl,octDependencies:Jme,onesDependencies:eve,OperatorNodeDependencies:so,orDependencies:tve,ParenthesisNodeDependencies:Is,parseDependencies:ra,parserDependencies:rve,ParserDependencies:LB,partitionSelectDependencies:ZC,permutationsDependencies:nve,phiDependencies:ive,piDependencies:VB,pickRandomDependencies:ave,pinvDependencies:ove,planckChargeDependencies:sve,planckConstantDependencies:lve,planckLengthDependencies:uve,planckMassDependencies:cve,planckTemperatureDependencies:dve,planckTimeDependencies:fve,polynomialRootDependencies:pve,powDependencies:_a,printDependencies:hve,prodDependencies:dB,protonMassDependencies:mve,qrDependencies:WC,quantileSeqDependencies:vve,quantumOfCirculationDependencies:gve,randomDependencies:yve,randomIntDependencies:bve,rangeDependencies:jl,RangeDependencies:xve,RangeNodeDependencies:uB,rangeTransformDependencies:wve,rationalizeDependencies:Cve,reDependencies:HC,reducedPlanckConstantDependencies:Sve,RelationalNodeDependencies:cB,replacerDependencies:Dve,reshapeDependencies:Eve,resizeDependencies:Nve,resolveDependencies:pB,ResultSetDependencies:eB,reviverDependencies:Ave,rightArithShiftDependencies:_ve,rightLogShiftDependencies:Mve,rotateDependencies:Tve,rotationMatrixDependencies:GB,roundDependencies:Uy,rowDependencies:Ove,rowTransformDependencies:Rve,rydbergDependencies:Ive,SQRT1_2Dependencies:kve,SQRT2Dependencies:Pve,sackurTetrodeDependencies:Fve,schurDependencies:FB,secDependencies:$ve,sechDependencies:Bve,secondRadiationDependencies:zve,setCartesianDependencies:Lve,setDifferenceDependencies:UB,setDistinctDependencies:Vve,setIntersectDependencies:WB,setIsSubsetDependencies:qve,setMultiplicityDependencies:Gve,setPowersetDependencies:Uve,setSizeDependencies:Wve,setSymDifferenceDependencies:HB,setUnionDependencies:Hve,signDependencies:vB,simplifyDependencies:Zy,simplifyConstantDependencies:VC,simplifyCoreDependencies:qC,sinDependencies:jC,sinhDependencies:jve,sizeDependencies:Fn,sluDependencies:kB,smallerDependencies:Ti,smallerEqDependencies:$C,sortDependencies:Kve,SpaDependencies:RB,sparseDependencies:Yve,SparseMatrixDependencies:oo,speedOfLightDependencies:Xve,splitUnitDependencies:Zve,sqrtDependencies:Ta,sqrtmDependencies:Qve,squareDependencies:Jve,squeezeDependencies:ege,stdDependencies:tge,stdTransformDependencies:rge,stefanBoltzmannDependencies:nge,stirlingS2Dependencies:J$,stringDependencies:ige,subsetDependencies:ci,subsetTransformDependencies:age,subtractDependencies:Nr,sumDependencies:TB,sumTransformDependencies:oge,sylvesterDependencies:$B,SymbolNodeDependencies:Ko,symbolicEqualDependencies:sge,tanDependencies:lge,tanhDependencies:uge,tauDependencies:SB,thomsonCrossSectionDependencies:cge,toDependencies:dge,traceDependencies:fge,transposeDependencies:_c,trueDependencies:pge,typeOfDependencies:qB,typedDependencies:se,unaryMinusDependencies:Aa,unaryPlusDependencies:LC,unequalDependencies:hge,UnitDependencies:xt,unitDependencies:mge,EDependencies:vge,PIDependencies:gge,usolveDependencies:KC,usolveAllDependencies:gB,vacuumImpedanceDependencies:yge,varianceDependencies:QC,varianceTransformDependencies:bge,versionDependencies:xge,weakMixingAngleDependencies:wge,wienDisplacementDependencies:Cge,xgcdDependencies:MB,xorDependencies:Sge,zerosDependencies:Ea,all:Dge,createTyped:Df,createResultSet:Nf,createBigNumberClass:kf,createComplexClass:Pf,createFractionClass:Ff,createRangeClass:$f,createMatrixClass:Bf,createDenseMatrixClass:zf,createClone:Lf,createIsInteger:Gf,createIsNegative:jf,createIsNumeric:Kf,createHasNumericValue:Yf,createIsPositive:Xf,createIsZero:Zf,createIsNaN:Qf,createTypeOf:Jf,createEqualScalar:tp,createSparseMatrixClass:rp,createNumber:np,createString:ip,createBoolean:ap,createBignumber:op,createComplex:sp,createFraction:lp,createMatrix:up,createMatrixFromFunction:cp,createMatrixFromRows:dp,createMatrixFromColumns:fp,createSplitUnit:pp,createUnaryMinus:hp,createUnaryPlus:mp,createAbs:vp,createApply:Ju,createAddScalar:yp,createCbrt:bp,createCeil:xp,createCube:wp,createExp:Cp,createExpm1:Sp,createFix:Dp,createFloor:Ep,createGcd:Np,createLcm:_p,createLog10:Mp,createLog2:Tp,createMod:Rp,createMultiplyScalar:Ip,createMultiply:kp,createNthRoot:Pp,createSign:Fp,createSqrt:$p,createSquare:Bp,createSubtract:zp,createXgcd:Lp,createInvmod:Vp,createDotMultiply:qp,createBitAnd:Up,createBitNot:Wp,createBitOr:Hp,createBitXor:jp,createArg:Kp,createConj:Yp,createIm:Xp,createRe:Zp,createNot:Qp,createOr:Jp,createXor:eh,createConcat:tc,createColumn:rc,createCount:th,createCross:rh,createDiag:nh,createFilter:ih,createFlatten:ah,createForEach:oh,createGetMatrixDataType:sh,createIdentity:lh,createKron:uh,createMap:ch,createDiff:nc,createOnes:dh,createRange:ic,createReshape:fh,createResize:ph,createRotate:hh,createRotationMatrix:mh,createRow:ac,createSize:vh,createSqueeze:gh,createSubset:oc,createTranspose:yh,createCtranspose:bh,createZeros:xh,createFft:wh,createIfft:Ch,createErf:Sh,createMode:Dh,createProd:Eh,createFormat:Nh,createBin:Ah,createOct:_h,createHex:Mh,createPrint:Th,createTo:Oh,createIsPrime:Rh,createNumeric:Ih,createDivideScalar:kh,createPow:Ph,createRound:Fh,createLog:$h,createLog1p:Bh,createNthRoots:zh,createDotPow:Lh,createDotDivide:Vh,createLsolve:qh,createUsolve:Gh,createLsolveAll:Uh,createUsolveAll:Wh,createLeftShift:Hh,createRightArithShift:jh,createRightLogShift:Kh,createAnd:Yh,createCompare:Zh,createCompareNatural:Qh,createCompareText:Jh,createEqual:tm,createEqualText:rm,createSmaller:im,createSmallerEq:om,createLarger:lm,createLargerEq:cm,createDeepEqual:dm,createUnequal:pm,createPartitionSelect:hm,createSort:mm,createMax:lc,createMin:uc,createImmutableDenseMatrixClass:vm,createIndexClass:gm,createFibonacciHeapClass:ym,createSpaClass:bm,createUnitClass:wm,createUnitFunction:Cm,createSparse:Sm,createCreateUnit:Dm,createAcos:Em,createAcosh:Nm,createAcot:Am,createAcoth:_m,createAcsc:Mm,createAcsch:Tm,createAsec:Om,createAsech:Rm,createAsin:Im,createAsinh:km,createAtan:Pm,createAtan2:Fm,createAtanh:$m,createCos:Bm,createCosh:zm,createCot:Lm,createCoth:Vm,createCsc:qm,createCsch:Gm,createSec:Um,createSech:Wm,createSin:Hm,createSinh:jm,createTan:Km,createTanh:Ym,createSetCartesian:Xm,createSetDifference:Zm,createSetDistinct:Qm,createSetIntersect:Jm,createSetIsSubset:ev,createSetMultiplicity:tv,createSetPowerset:rv,createSetSize:nv,createSetSymDifference:iv,createSetUnion:av,createAdd:ov,createHypot:sv,createNorm:lv,createDot:uv,createTrace:cv,createIndex:dv,createNode:fv,createAccessorNode:hv,createArrayNode:vv,createAssignmentNode:bv,createBlockNode:wv,createConditionalNode:Sv,createConstantNode:Ev,createFunctionAssignmentNode:Av,createIndexNode:Mv,createObjectNode:Ov,createOperatorNode:Iv,createParenthesisNode:Pv,createRangeNode:$v,createRelationalNode:zv,createSymbolNode:Lv,createFunctionNode:qv,createParse:Gv,createCompile:Uv,createEvaluate:Wv,createParserClass:Hv,createParser:jv,createLup:Kv,createQr:Yv,createSlu:Xv,createLusolve:Zv,createPolynomialRoot:Qv,createHelpClass:Jv,createChainClass:eg,createHelp:tg,createChain:rg,createDet:ng,createInv:ig,createPinv:ag,createEigs:og,createExpm:sg,createSqrtm:lg,createSylvester:ug,createSchur:cg,createLyap:dg,createDivide:fg,createDistance:pg,createIntersect:hg,createSum:pc,createCumSum:hc,createMean:mc,createMedian:vg,createMad:gg,createVariance:vc,createQuantileSeq:yg,createStd:gc,createCombinations:bg,createCombinationsWithRep:xg,createGamma:wg,createLgamma:Cg,createFactorial:Sg,createKldivergence:Dg,createMultinomial:Eg,createPermutations:Ng,createPickRandom:Ag,createRandom:_g,createRandomInt:Mg,createStirlingS2:Tg,createBellNumbers:Og,createCatalan:Rg,createComposition:Ig,createLeafCount:kg,createSimplify:Fg,createSimplifyConstant:$g,createSimplifyCore:Bg,createResolve:zg,createSymbolicEqual:Lg,createDerivative:Vg,createRationalize:qg,createReviver:Gg,createReplacer:Ug,createE:Qg,createUppercaseE:Rw,createFalse:Hg,createI:o0,createInfinity:Kg,createLN10:t0,createLN2:e0,createLOG10E:n0,createLOG2E:r0,createNaN:Yg,createNull:jg,createPhi:Jg,createPi:Xg,createUppercasePi:Ow,createSQRT1_2:i0,createSQRT2:a0,createTau:Zg,createTrue:Wg,createVersion:s0,createAtomicMass:$0,createAvogadro:B0,createBohrMagneton:g0,createBohrRadius:S0,createBoltzmann:z0,createClassicalElectronRadius:D0,createConductanceQuantum:y0,createCoulomb:m0,createDeuteronMass:T0,createEfimovFactor:F0,createElectricConstant:p0,createElectronMass:E0,createElementaryCharge:v0,createFaraday:L0,createFermiCoupling:N0,createFineStructure:A0,createFirstRadiation:V0,createGasConstant:G0,createGravitationConstant:u0,createGravity:Q0,createHartreeEnergy:_0,createInverseConductanceQuantum:b0,createKlitzing:C0,createLoschmidt:q0,createMagneticConstant:f0,createMagneticFluxQuantum:x0,createMolarMass:X0,createMolarMassC12:Z0,createMolarPlanckConstant:U0,createMolarVolume:W0,createNeutronMass:O0,createNuclearMagneton:w0,createPlanckCharge:ry,createPlanckConstant:c0,createPlanckLength:J0,createPlanckMass:ey,createPlanckTemperature:ny,createPlanckTime:ty,createProtonMass:M0,createQuantumOfCirculation:R0,createReducedPlanckConstant:d0,createRydberg:I0,createSackurTetrode:H0,createSecondRadiation:j0,createSpeedOfLight:l0,createStefanBoltzmann:K0,createThomsonCrossSection:k0,createVacuumImpedance:h0,createWeakMixingAngle:P0,createWienDisplacement:Y0,createApplyTransform:ay,createColumnTransform:oy,createFilterTransform:sy,createForEachTransform:ly,createIndexTransform:uy,createMapTransform:cy,createMaxTransform:dy,createMeanTransform:fy,createMinTransform:py,createRangeTransform:hy,createRowTransform:my,createSubsetTransform:vy,createConcatTransform:gy,createDiffTransform:yy,createStdTransform:by,createSumTransform:xy,createCumSumTransform:wy,createVarianceTransform:Cy},Symbol.toStringTag,{value:"Module"})),Rc={type:"none",config:{}};function _ge(e){const t=Array.from(e).sort((n,i)=>n-i),r=Math.floor(t.length/2);return t.length%2===0?(t[r-1]+t[r])/2:t[r]}function Mge(e,t){const r=e[t],n=Number(r);return isFinite(n)?n:0}function Ic(e,t,r){var n,i,a;try{const o=e.map(s=>Mge(s,t));switch(r.type){case"sum":return Ne.default.sum(o);case"mean":return Ne.default.mean(o);case"median":return _ge(o);case"max":return(n=Ne.default.max(o))!=null?n:0;case"min":return(i=Ne.default.min(o))!=null?i:0;case"quantile":return(a=gu.quantile(o,r.config.p))!=null?a:0;case"CV":const s=By(...o),l=xC(...o);return l?s/l:"N/A";case"std":return By(...o);default:return o}}catch(o){return console.error(o),null}}var KB=function(){},kc=function(){};process.env.NODE_ENV!=="production"&&(KB=function(e,t){!e&&typeof console<"u"&&console.warn(t)},kc=function(e,t){if(!e)throw new Error(t)});const Tge=(e,t,r)=>Math.min(Math.max(r,e),t),YB=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n},tS=(e,t,r)=>-r*e+r*t+e,XB=(e,t)=>r=>Math.max(Math.min(r,t),e),Pc=e=>e%1?Number(e.toFixed(5)):e,Qy=/(-)?([\d]*\.?[\d])+/g,rS=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,Oge=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function Fc(e){return typeof e=="string"}const Jy={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},ZB=Object.assign(Object.assign({},Jy),{transform:XB(0,1)});Object.assign(Object.assign({},Jy),{default:1});const $c=(e=>({test:t=>Fc(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}))("%");Object.assign(Object.assign({},$c),{parse:e=>$c.parse(e)/100,transform:e=>$c.transform(e*100)});const nS=(e,t)=>r=>Boolean(Fc(r)&&Oge.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),QB=(e,t,r)=>n=>{if(!Fc(n))return n;const[i,a,o,s]=n.match(Qy);return{[e]:parseFloat(i),[t]:parseFloat(a),[r]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},ks={test:nS("hsl","hue"),parse:QB("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+$c.transform(Pc(t))+", "+$c.transform(Pc(r))+", "+Pc(ZB.transform(n))+")"},Rge=XB(0,255),iS=Object.assign(Object.assign({},Jy),{transform:e=>Math.round(Rge(e))}),Xo={test:nS("rgb","red"),parse:QB("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+iS.transform(e)+", "+iS.transform(t)+", "+iS.transform(r)+", "+Pc(ZB.transform(n))+")"};function Ige(e){let t="",r="",n="",i="";return e.length>5?(t=e.substr(1,2),r=e.substr(3,2),n=e.substr(5,2),i=e.substr(7,2)):(t=e.substr(1,1),r=e.substr(2,1),n=e.substr(3,1),i=e.substr(4,1),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const aS={test:nS("#"),parse:Ige,transform:Xo.transform},eb={test:e=>Xo.test(e)||aS.test(e)||ks.test(e),parse:e=>Xo.test(e)?Xo.parse(e):ks.test(e)?ks.parse(e):aS.parse(e),transform:e=>Fc(e)?e:e.hasOwnProperty("red")?Xo.transform(e):ks.transform(e)},JB="${c}",e4="${n}";function kge(e){var t,r,n,i;return isNaN(e)&&Fc(e)&&((r=(t=e.match(Qy))===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0)+((i=(n=e.match(rS))===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0)>0}function t4(e){typeof e=="number"&&(e=`${e}`);const t=[];let r=0;const n=e.match(rS);n&&(r=n.length,e=e.replace(rS,JB),t.push(...n.map(eb.parse)));const i=e.match(Qy);return i&&(e=e.replace(Qy,e4),t.push(...i.map(Jy.parse))),{values:t,numColors:r,tokenised:e}}function r4(e){return t4(e).values}function n4(e){const{values:t,numColors:r,tokenised:n}=t4(e),i=t.length;return a=>{let o=n;for(let s=0;s<i;s++)o=o.replace(s<r?JB:e4,s<r?eb.transform(a[s]):Pc(a[s]));return o}}const Pge=e=>typeof e=="number"?0:e;function Fge(e){const t=r4(e);return n4(e)(t.map(Pge))}const i4={test:kge,parse:r4,createTransformer:n4,getAnimatableNone:Fge};function oS(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function a4({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let i=0,a=0,o=0;if(!t)i=a=o=r;else{const s=r<.5?r*(1+t):r+t-r*t,l=2*r-s;i=oS(l,s,e+1/3),a=oS(l,s,e),o=oS(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:n}}const $ge=(e,t,r)=>{const n=e*e,i=t*t;return Math.sqrt(Math.max(0,r*(i-n)+n))},Bge=[aS,Xo,ks],o4=e=>Bge.find(t=>t.test(e)),s4=e=>`'${e}' is not an animatable color. Use the equivalent color code instead.`,l4=(e,t)=>{let r=o4(e),n=o4(t);kc(!!r,s4(e)),kc(!!n,s4(t));let i=r.parse(e),a=n.parse(t);r===ks&&(i=a4(i),r=Xo),n===ks&&(a=a4(a),n=Xo);const o=Object.assign({},i);return s=>{for(const l in o)l!=="alpha"&&(o[l]=$ge(i[l],a[l],s));return o.alpha=tS(i.alpha,a.alpha,s),r.transform(o)}},zge=e=>typeof e=="number",Lge=(e,t)=>r=>t(e(r)),u4=(...e)=>e.reduce(Lge);function c4(e,t){return zge(e)?r=>tS(e,t,r):eb.test(e)?l4(e,t):p4(e,t)}const d4=(e,t)=>{const r=[...e],n=r.length,i=e.map((a,o)=>c4(a,t[o]));return a=>{for(let o=0;o<n;o++)r[o]=i[o](a);return r}},Vge=(e,t)=>{const r=Object.assign(Object.assign({},e),t),n={};for(const i in r)e[i]!==void 0&&t[i]!==void 0&&(n[i]=c4(e[i],t[i]));return i=>{for(const a in n)r[a]=n[a](i);return r}};function f4(e){const t=i4.parse(e),r=t.length;let n=0,i=0,a=0;for(let o=0;o<r;o++)n||typeof t[o]=="number"?n++:t[o].hue!==void 0?a++:i++;return{parsed:t,numNumbers:n,numRGB:i,numHSL:a}}const p4=(e,t)=>{const r=i4.createTransformer(t),n=f4(e),i=f4(t);return n.numHSL===i.numHSL&&n.numRGB===i.numRGB&&n.numNumbers>=i.numNumbers?u4(d4(n.parsed,i.parsed),r):(KB(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),o=>`${o>0?t:e}`)},qge=(e,t)=>r=>tS(e,t,r);function Gge(e){if(typeof e=="number")return qge;if(typeof e=="string")return eb.test(e)?l4:p4;if(Array.isArray(e))return d4;if(typeof e=="object")return Vge}function Uge(e,t,r){const n=[],i=r||Gge(e[0]),a=e.length-1;for(let o=0;o<a;o++){let s=i(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]:t;s=u4(l,s)}n.push(s)}return n}function Wge([e,t],[r]){return n=>r(YB(e,t,n))}function Hge(e,t){const r=e.length,n=r-1;return i=>{let a=0,o=!1;if(i<=e[0]?o=!0:i>=e[n]&&(a=n-1,o=!0),!o){let l=1;for(;l<r&&!(e[l]>i||l===n);l++);a=l-1}const s=YB(e[a],e[a+1],i);return t[a](s)}}function tb(e,t,{clamp:r=!0,ease:n,mixer:i}={}){const a=e.length;kc(a===t.length,"Both input and output ranges must be the same length"),kc(!n||!Array.isArray(n)||n.length===a-1,"Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values."),e[0]>e[a-1]&&(e=[].concat(e),t=[].concat(t),e.reverse(),t.reverse());const o=Uge(t,n,i),s=a===2?Wge(e,o):Hge(e,o);return r?l=>s(Tge(e[0],e[a-1],l)):s}class jge{constructor({valueRange:t,colorRange:r}){at(this,"mapper");this.mapper=tb(t,r)}getColor(t){return this.mapper(t)}}function Kge(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`Array(${e.length})`:e.toString()}function Bc({data_field:e,aggregation:t},r){return Ic(r,e,t)}function Ps({formatter:e},t){return["string","number"].includes(typeof t)?Tr.default(t).format(e):Kge(t)}function Yge(e,t){if(e.type==="static")return e.staticColor;if(e.type==="continuous")try{if(typeof t!="number")throw new Error(`[getColorByColorConf] Invalid type of aggregated value: ${t}`);return new jge(e).getColor(t)}catch(r){return console.error(r),"black"}return"black"}function h4(e,t){const{color:r,data_field:n,aggregation:i,size:a,weight:o}=e,s=Ic(t,n,i),l=Ps(e,s);return h(g.Text,{sx:{fontSize:a,display:"inline"},color:Yge(r,s),weight:o,children:l})}function Xge(e,t){const r={};return e.forEach(n=>{const i=n.name;r[i]=h4(n,t)}),r}function Zge(e){return e.split(" ").map((t,r)=>$(Pe.default.Fragment,{children:[t,"\xA0"]},r))}function Qge(e){const r=e.replaceAll("<br />","<br/>").replaceAll(`
152
+ 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"]},Hce={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"]},jce={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"]},Kce={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},Yce={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"]},Xce={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"]},Zce={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"]},Qce={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"]},Jce={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},ede={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"]},tde={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},rde={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"]},nde={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},ide={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"]},ade={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"]},ode={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"]},sde={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"]},lde={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"]},ude={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"]},cde={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},dde={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"]},fde={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"]},pde={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"]},hde={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"]},mde={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"]},vde={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"]},gde={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"]},yde={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},bde={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"]},xde={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"]},wde={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:[]},Cde={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},Sde={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:[]},Dde={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"]},Ede={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"]},Nde={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},Ade={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"]},_de={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"]},Mde={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"]},Tde={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"]},Ode={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"]},Rde={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"]},Ide={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"]},kde={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction)','numeric(4, "Fraction")','numeric(fraction(2, 5), "number)'],seealso:["number","fraction","bignumber","string","format"]},Pde={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},Fde={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $0, $1, $2", [6, 9, 4])'],seealso:["format"]},$de={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"]},y3={bignumber:Ise,boolean:kse,complex:Pse,createUnit:Fse,fraction:$se,index:Bse,matrix:zse,number:Lse,sparse:Vse,splitUnit:qse,string:Gse,unit:Use,e:v3,E:v3,false:yse,i:bse,Infinity:xse,LN2:Cse,LN10:wse,LOG2E:Dse,LOG10E:Sse,NaN:Ese,null:Nse,pi:g3,PI:g3,phi:Ase,SQRT1_2:_se,SQRT2:Mse,tau:Tse,true:Ose,version:Rse,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:Kse,lsolve:Xse,lsolveAll:Zse,lup:Qse,lusolve:Jse,leafCount:Yse,polynomialRoot:ele,resolve:nle,simplify:ile,simplifyConstant:ale,simplifyCore:ole,symbolicEqual:lle,rationalize:rle,slu:sle,usolve:ule,usolveAll:cle,qr:tle,abs:dle,add:fle,cbrt:ple,ceil:hle,cube:mle,divide:vle,dotDivide:gle,dotMultiply:yle,dotPow:ble,exp:xle,expm:wle,expm1:Cle,fix:Sle,floor:Dle,gcd:Ele,hypot:Nle,lcm:_le,log:Mle,log2:Rle,log1p:Ole,log10:Tle,mod:Ile,multiply:kle,norm:Ple,nthRoot:Fle,nthRoots:$le,pow:Ble,round:zle,sign:Lle,sqrt:Vle,sqrtm:qle,square:Hle,subtract:jle,unaryMinus:Kle,unaryPlus:Yle,xgcd:Xle,invmod:Ale,bitAnd:Zle,bitNot:Qle,bitOr:Jle,bitXor:eue,leftShift:tue,rightArithShift:rue,rightLogShift:nue,bellNumbers:iue,catalan:aue,composition:oue,stirlingS2:sue,config:Wse,import:Hse,typed:jse,arg:lue,conj:uue,re:due,im:cue,evaluate:fue,help:pue,distance:hue,intersect:mue,and:vue,not:gue,or:yue,xor:bue,concat:wue,count:Cue,cross:Sue,column:xue,ctranspose:Due,det:Eue,diag:Nue,diff:Aue,dot:_ue,getMatrixDataType:Iue,identity:kue,filter:Tue,flatten:Oue,forEach:Rue,inv:Pue,pinv:Fue,eigs:Mue,kron:$ue,matrixFromFunction:Lue,matrixFromRows:Vue,matrixFromColumns:zue,map:Bue,ones:que,partitionSelect:Gue,range:Uue,resize:Hue,reshape:Wue,rotate:jue,rotationMatrix:Kue,row:Yue,size:Xue,sort:Zue,squeeze:Que,subset:Jue,trace:ece,transpose:tce,zeros:rce,fft:nce,ifft:ice,sylvester:Gle,schur:Ule,lyap:Wle,combinations:ace,combinationsWithRep:oce,factorial:sce,gamma:lce,kldivergence:cce,lgamma:uce,multinomial:dce,permutations:fce,pickRandom:pce,random:hce,randomInt:mce,compare:vce,compareNatural:gce,compareText:yce,deepEqual:bce,equal:xce,equalText:wce,larger:Cce,largerEq:Sce,smaller:Dce,smallerEq:Ece,unequal:Nce,setCartesian:Ace,setDifference:_ce,setDistinct:Mce,setIntersect:Tce,setIsSubset:Oce,setMultiplicity:Rce,setPowerset:Ice,setSize:kce,setSymDifference:Pce,setUnion:Fce,erf:$ce,cumsum:jce,mad:Bce,max:zce,mean:Lce,median:Vce,min:qce,mode:Gce,prod:Uce,quantileSeq:Wce,std:Hce,sum:Kce,variance:Yce,acos:Xce,acosh:Zce,acot:Qce,acoth:Jce,acsc:ede,acsch:tde,asec:rde,asech:nde,asin:ide,asinh:ade,atan:ode,atanh:lde,atan2:sde,cos:ude,cosh:cde,cot:dde,coth:fde,csc:pde,csch:hde,sec:mde,sech:vde,sin:gde,sinh:yde,tan:bde,tanh:xde,to:wde,clone:Sde,format:Dde,bin:Cde,oct:Pde,hex:Nde,isNaN:_de,isInteger:Ade,isNegative:Mde,isNumeric:Tde,hasNumericValue:Ede,isPositive:Ode,isPrime:Rde,isZero:Ide,print:Fde,typeOf:$de,numeric:kde},b3="help",Bde=["typed","mathWithTransform","Help"],tg=Q(b3,Bde,e=>{var{typed:t,mathWithTransform:r,Help:n}=e;return t(b3,{any:function(a){var o,s=a;if(typeof a!="string"){for(o in r)if(et(r,o)&&a===r[o]){s=o;break}}var l=Si(y3,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})}),x3="chain",zde=["typed","Chain"],rg=Q(x3,zde,e=>{var{typed:t,Chain:r}=e;return t(x3,{"":function(){return new r},any:function(i){return new r(i)}})}),w3="det",Lde=["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],ng=Q(w3,Lde,e=>{var{typed:t,matrix:r,subtract:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(w3,{any:function(c){return pt(c)},"Array | Matrix":function(c){var d;switch(ft(c)?d=c.size():Array.isArray(c)?(c=r(c),d=c.size()):d=[],d.length){case 0:return pt(c);case 1:if(d[0]===1)return pt(c.valueOf()[0]);if(d[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Pt(d)+")");case 2:{var f=d[0],p=d[1];if(f===p)return l(c.clone().valueOf(),f);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+Pt(d)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(d)+")")}}});function l(u,c,d){if(c===1)return pt(u[0][0]);if(c===2)return n(i(u[0][0],u[1][1]),i(u[1][0],u[0][1]));for(var f=!1,p=new Array(c).fill(0).map((E,A)=>A),m=0;m<c;m++){var v=p[m];if(o(u[v][m])){var y=void 0;for(y=m+1;y<c;y++)if(!o(u[p[y]][m])){v=p[y],p[y]=p[m],p[m]=v,f=!f;break}if(y===c)return u[v][m]}for(var b=u[v][m],D=m===0?1:u[p[m-1]][m-1],x=m+1;x<c;x++)for(var S=p[x],w=m+1;w<c;w++)u[S][w]=a(n(i(u[S][w],b),i(u[S][m],u[v][w])),D)}var C=u[p[c-1]][c-1];return f?s(C):C}}),C3="inv",Vde=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],ig=Q(C3,Vde,e=>{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:l,abs:u}=e;return t(C3,{"Array | Matrix":function(f){var p=ft(f)?f.size():qt(f);switch(p.length){case 1:if(p[0]===1)return ft(f)?r([n(1,f.valueOf()[0])]):[n(1,f[0])];throw new RangeError("Matrix must be square (size: "+Pt(p)+")");case 2:{var m=p[0],v=p[1];if(m===v)return ft(f)?r(c(f.valueOf(),m,v),f.storage()):c(f,m,v);throw new RangeError("Matrix must be square (size: "+Pt(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(p)+")")}},any:function(f){return n(1,f)}});function c(d,f,p){var m,v,y,b,D;if(f===1){if(b=d[0][0],b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,b)]]}else if(f===2){var x=s(d);if(x===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(d[1][1],x),n(o(d[0][1]),x)],[n(o(d[1][0]),x),n(d[0][0],x)]]}else{var S=d.concat();for(m=0;m<f;m++)S[m]=S[m].concat();for(var w=l(f).valueOf(),C=0;C<p;C++){var E=u(S[C][C]),A=C;for(m=C+1;m<f;)u(S[m][C])>E&&(E=u(S[m][C]),A=m),m++;if(E===0)throw Error("Cannot calculate inverse, determinant is zero");m=A,m!==C&&(D=S[C],S[C]=S[m],S[m]=D,D=w[C],w[C]=w[m],w[m]=D);var _=S[C],N=w[C];for(m=0;m<f;m++){var M=S[m],R=w[m];if(m!==C){if(M[C]!==0){for(y=n(o(M[C]),_[C]),v=C;v<p;v++)M[v]=i(M[v],a(y,_[v]));for(v=0;v<p;v++)R[v]=i(R[v],a(y,N[v]))}}else{for(y=_[C],v=C;v<p;v++)M[v]=n(M[v],y);for(v=0;v<p;v++)R[v]=n(R[v],y)}}}return w}}}),S3="pinv",qde=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],ag=Q(S3,qde,e=>{var{typed:t,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:l,divideScalar:u,multiply:c,add:d,Complex:f}=e;return t(S3,{"Array | Matrix":function(x){var S=ft(x)?x.size():qt(x);switch(S.length){case 1:return b(x)?l(x):S[0]===1?n(x):o(l(x),s(x,x));case 2:{if(b(x))return l(x);var w=S[0],C=S[1];if(w===C)try{return n(x)}catch(E){if(!(E instanceof Error&&E.message.match(/Cannot calculate inverse, determinant is zero/)))throw E}return ft(x)?r(p(x.valueOf(),w,C),x.storage()):p(x,w,C)}default:throw new RangeError("Matrix must be two dimensional (size: "+Pt(S)+")")}},any:function(x){return a(x,0)?pt(x):u(1,x)}});function p(D,x,S){var{C:w,F:C}=v(D,x,S),E=c(n(c(l(w),w)),l(w)),A=c(l(C),n(c(C,l(C))));return c(A,E)}function m(D,x,S){for(var w=pt(D),C=0,E=0;E<x;E++){if(S<=C)return w;for(var A=E;y(w[A][C]);)if(A++,x===A&&(A=E,C++,S===C))return w;[w[A],w[E]]=[w[E],w[A]];for(var _=w[E][C],N=0;N<S;N++)w[E][N]=o(w[E][N],_);for(var M=0;M<x;M++)if(M!==E){_=w[M][C];for(var R=0;R<S;R++)w[M][R]=d(w[M][R],c(-1,c(_,w[E][R])))}C++}return w}function v(D,x,S){var w=m(D,x,S),C=D.map((A,_)=>A.filter((N,M)=>M<x&&!y(s(w[M],w[M])))),E=w.filter((A,_)=>!y(s(w[_],w[_])));return{C,F:E}}function y(D){return a(d(D,f(1,1)),d(0,f(1,1)))}function b(D){return i(d(D,f(1,1)),d(c(D,0),f(1,1)))}});function Gde(e){var{addScalar:t,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:l,bignumber:u,diag:c,inv:d,qr:f,usolve:p,usolveAll:m,equal:v,complex:y,larger:b,smaller:D,matrixFromColumns:x,dot:S}=e;function w(V,H,Z,G,Y){Y===void 0&&(Y=!0);var re=C(V,H,Z,G,Y);E(V,H,Z,G,Y,re);var{values:ne,C:pe}=A(V,H,Z,G,Y),he;return Y&&(he=_(V,H,pe,re,ne,Z,G),he=x(...he)),{values:ne,vectors:he}}function C(V,H,Z,G,Y){var re=G==="BigNumber",ne=G==="Complex",pe=re?u(0):0,he=re?u(1):ne?y(1):1,le=re?u(1):1,fe=re?u(10):2,xe=a(fe,fe),ge;Y&&(ge=Array(H).fill(he));for(var ve=!1;!ve;){ve=!0;for(var Ee=0;Ee<H;Ee++){for(var q=pe,J=pe,ce=0;ce<H;ce++)if(Ee!==ce){var X=l(V[Ee][ce]);q=t(q,X),J=t(J,X)}if(!v(q,0)&&!v(J,0)){for(var te=le,ae=q,De=o(J,fe),be=a(J,fe);D(ae,De);)ae=a(ae,xe),te=a(te,fe);for(;b(ae,be);)ae=o(ae,xe),te=o(te,fe);var K=D(o(t(ae,J),te),a(t(q,J),.95));if(K){ve=!1;for(var W=o(1,te),ue=0;ue<H;ue++)Ee!==ue&&(V[Ee][ue]=a(V[Ee][ue],te),V[ue][Ee]=a(V[ue][Ee],W));Y&&(ge[Ee]=a(ge[Ee],te))}}}}return c(ge)}function E(V,H,Z,G,Y,re){var ne=G==="BigNumber",pe=G==="Complex",he=ne?u(0):pe?y(0):0;ne&&(Z=u(Z));for(var le=0;le<H-2;le++){for(var fe=0,xe=he,ge=le+1;ge<H;ge++){var ve=V[ge][le];D(l(xe),l(ve))&&(xe=ve,fe=ge)}if(!D(l(xe),Z)){if(fe!==le+1){var Ee=V[fe];V[fe]=V[le+1],V[le+1]=Ee;for(var q=0;q<H;q++){var J=V[q][fe];V[q][fe]=V[q][le+1],V[q][le+1]=J}if(Y){var ce=re[fe];re[fe]=re[le+1],re[le+1]=ce}}for(var X=le+2;X<H;X++){var te=o(V[X][le],xe);if(te!==0){for(var ae=0;ae<H;ae++)V[X][ae]=r(V[X][ae],a(te,V[le+1][ae]));for(var De=0;De<H;De++)V[De][le+1]=t(V[De][le+1],a(te,V[De][X]));if(Y)for(var be=0;be<H;be++)re[X][be]=r(re[X][be],a(te,re[le+1][be]))}}}}return re}function A(V,H,Z,G,Y){var re=G==="BigNumber",ne=G==="Complex",pe=re?u(1):ne?y(1):1;re&&(Z=u(Z));for(var he=pt(V),le=[],fe=H,xe=[],ge=Y?c(Array(H).fill(pe)):void 0,ve=Y?c(Array(fe).fill(pe)):void 0,Ee=0;Ee<=100;){Ee+=1;for(var q=0,J=0;J<fe;J++)he[J][J]=r(he[J][J],q);var{Q:ce,R:X}=f(he);he=i(X,ce);for(var te=0;te<fe;te++)he[te][te]=t(he[te][te],q);if(Y&&(ve=i(ve,ce)),fe===1||D(l(he[fe-1][fe-2]),Z)){Ee=0,le.push(he[fe-1][fe-1]),Y&&(xe.unshift([[1]]),R(ve,H),ge=i(ge,ve),fe>1&&(ve=c(Array(fe-1).fill(pe)))),fe-=1,he.pop();for(var ae=0;ae<fe;ae++)he[ae].pop()}else if(fe===2||D(l(he[fe-2][fe-3]),Z)){Ee=0;var De=N(he[fe-2][fe-2],he[fe-2][fe-1],he[fe-1][fe-2],he[fe-1][fe-1]);le.push(...De),Y&&(xe.unshift(M(he[fe-2][fe-2],he[fe-2][fe-1],he[fe-1][fe-2],he[fe-1][fe-1],De[0],De[1],Z,G)),R(ve,H),ge=i(ge,ve),fe>2&&(ve=c(Array(fe-2).fill(pe)))),fe-=2,he.pop(),he.pop();for(var be=0;be<fe;be++)he[be].pop(),he[be].pop()}if(fe===0)break}if(le.sort((ue,me)=>+r(l(ue),l(me))),Ee>100){var K=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+le.join(", "));throw K.values=le,K.vectors=[],K}var W=Y?i(ge,F(xe,H)):void 0;return{values:le,C:W}}function _(V,H,Z,G,Y,re,ne){var pe=d(Z),he=i(pe,V,Z),le=ne==="BigNumber",fe=ne==="Complex",xe=le?u(0):fe?y(0):0,ge=le?u(1):fe?y(1):1,ve=[],Ee=[];for(var q of Y){var J=k(ve,q,v);J===-1?(ve.push(q),Ee.push(1)):Ee[J]+=1}for(var ce=[],X=ve.length,te=Array(H).fill(xe),ae=c(Array(H).fill(ge)),De=[],be=function(me){var we=ve[me],_e=r(he,i(we,ae)),Ae=m(_e,te);for(Ae.shift();Ae.length<Ee[me];){var Ce=P(_e,H,Ae,re,ne);if(Ce==null){De.push(we);break}Ae.push(Ce)}var Me=i(d(G),Z);Ae=Ae.map(Te=>i(Me,Te)),ce.push(...Ae.map(Te=>n(Te)))},K=0;K<X;K++)be(K);if(De.length!==0){var W=new Error("Failed to find eigenvectors for the following eigenvalues: "+De.join(", "));throw W.values=Y,W.vectors=ce,W}return ce}function N(V,H,Z,G){var Y=t(V,G),re=r(a(V,G),a(H,Z)),ne=a(Y,.5),pe=a(s(r(a(Y,Y),a(4,re))),.5);return[t(ne,pe),r(ne,pe)]}function M(V,H,Z,G,Y,re,ne,pe){var he=pe==="BigNumber",le=pe==="Complex",fe=he?u(0):le?y(0):0,xe=he?u(1):le?y(1):1;if(D(l(Z),ne))return[[xe,fe],[fe,xe]];if(b(l(r(Y,re)),ne))return[[r(Y,G),r(re,G)],[Z,Z]];var ge=r(V,Y),ve=r(H,Y),Ee=r(Z,Y),q=r(G,Y);return D(l(ve),ne)?[[ge,xe],[Ee,fe]]:[[ve,fe],[q,xe]]}function R(V,H){for(var Z=0;Z<V.length;Z++)V[Z].push(...Array(H-V[Z].length).fill(0));for(var G=V.length;G<H;G++)V.push(Array(H).fill(0)),V[G][G]=1;return V}function F(V,H){for(var Z=[],G=0;G<H;G++)Z[G]=Array(H).fill(0);var Y=0;for(var re of V){for(var ne=re.length,pe=0;pe<ne;pe++)for(var he=0;he<ne;he++)Z[Y+pe][Y+he]=re[pe][he];Y+=ne}return Z}function k(V,H,Z){for(var G=0;G<V.length;G++)if(Z(V[G],H))return G;return-1}function P(V,H,Z,G,Y){for(var re=Y==="BigNumber"?u(1e3):1e3,ne,pe=0;ne=T(H,Z,Y),ne=p(V,ne),!b(L(ne),re);)if(++pe>=5)return null;for(pe=0;;){var he=p(V,ne);if(D(L(O(ne,[he])),G))break;if(++pe>=10)return null;ne=I(he)}return ne}function T(V,H,Z){var G=Z==="BigNumber",Y=Z==="Complex",re=Array(V).fill(0).map(ne=>2*Math.random()-1);return G&&(re=re.map(ne=>u(ne))),Y&&(re=re.map(ne=>y(ne))),re=O(re,H),I(re,Z)}function O(V,H){for(var Z of H)V=r(V,i(o(S(Z,V),S(Z,Z)),Z));return V}function L(V){return l(s(S(V,V)))}function I(V,H){var Z=H==="BigNumber",G=H==="Complex",Y=Z?u(1):G?y(1):1;return i(o(Y,L(V)),V)}return w}function Ude(e){var{config:t,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:l,inv:u,bignumber:c,multiply:d,add:f}=e;function p(N,M){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.epsilon,F=arguments.length>3?arguments[3]:void 0;if(F==="number")return m(N,R);if(F==="BigNumber")return v(N,R);throw TypeError("Unsupported data type: "+F)}function m(N,M){for(var R=N.length,F=Math.abs(M/R),k,P=new Array(R),T=0;T<R;T++)P[T]=_(R,0),P[T][T]=1;for(var O=C(N);Math.abs(O[1])>=Math.abs(F);){var L=O[0][0],I=O[0][1];k=y(N[L][L],N[I][I],N[L][I]),N=w(N,k,L,I),P=D(P,k,L,I),O=C(N)}for(var V=_(R,0),H=0;H<R;H++)V[H]=N[H][H];return A(pt(V),pt(P))}function v(N,M){for(var R=N.length,F=i(M/R),k,P=new Array(R),T=0;T<R;T++)P[T]=_(R,0),P[T][T]=1;for(var O=E(N);i(O[1])>=i(F);){var L=O[0][0],I=O[0][1];k=b(N[L][L],N[I][I],N[L][I]),N=S(N,k,L,I),P=x(P,k,L,I),O=E(N)}for(var V=_(R,0),H=0;H<R;H++)V[H]=N[H][H];return A(pt(V),pt(P))}function y(N,M,R){var F=M-N;return Math.abs(F)<=t.epsilon?Math.PI/4:.5*Math.atan(2*R/(M-N))}function b(N,M,R){var F=n(M,N);return i(F)<=t.epsilon?c(-1).acos().div(4):l(.5,a(d(2,R,u(F))))}function D(N,M,R,F){for(var k=N.length,P=Math.cos(M),T=Math.sin(M),O=_(k,0),L=_(k,0),I=0;I<k;I++)O[I]=P*N[I][R]-T*N[I][F],L[I]=T*N[I][R]+P*N[I][F];for(var V=0;V<k;V++)N[V][R]=O[V],N[V][F]=L[V];return N}function x(N,M,R,F){for(var k=N.length,P=o(M),T=s(M),O=_(k,c(0)),L=_(k,c(0)),I=0;I<k;I++)O[I]=n(l(P,N[I][R]),l(T,N[I][F])),L[I]=r(l(T,N[I][R]),l(P,N[I][F]));for(var V=0;V<k;V++)N[V][R]=O[V],N[V][F]=L[V];return N}function S(N,M,R,F){for(var k=N.length,P=c(o(M)),T=c(s(M)),O=l(P,P),L=l(T,T),I=_(k,c(0)),V=_(k,c(0)),H=d(c(2),P,T,N[R][F]),Z=r(n(l(O,N[R][R]),H),l(L,N[F][F])),G=f(l(L,N[R][R]),H,l(O,N[F][F])),Y=0;Y<k;Y++)I[Y]=n(l(P,N[R][Y]),l(T,N[F][Y])),V[Y]=r(l(T,N[R][Y]),l(P,N[F][Y]));N[R][R]=Z,N[F][F]=G,N[R][F]=c(0),N[F][R]=c(0);for(var re=0;re<k;re++)re!==R&&re!==F&&(N[R][re]=I[re],N[re][R]=I[re],N[F][re]=V[re],N[re][F]=V[re]);return N}function w(N,M,R,F){for(var k=N.length,P=Math.cos(M),T=Math.sin(M),O=P*P,L=T*T,I=_(k,0),V=_(k,0),H=O*N[R][R]-2*P*T*N[R][F]+L*N[F][F],Z=L*N[R][R]+2*P*T*N[R][F]+O*N[F][F],G=0;G<k;G++)I[G]=P*N[R][G]-T*N[F][G],V[G]=T*N[R][G]+P*N[F][G];N[R][R]=H,N[F][F]=Z,N[R][F]=0,N[F][R]=0;for(var Y=0;Y<k;Y++)Y!==R&&Y!==F&&(N[R][Y]=I[Y],N[Y][R]=I[Y],N[F][Y]=V[Y],N[Y][F]=V[Y]);return N}function C(N){for(var M=N.length,R=0,F=[0,1],k=0;k<M;k++)for(var P=k+1;P<M;P++)Math.abs(R)<Math.abs(N[k][P])&&(R=Math.abs(N[k][P]),F=[k,P]);return[F,R]}function E(N){for(var M=N.length,R=0,F=[0,1],k=0;k<M;k++)for(var P=k+1;P<M;P++)i(R)<i(N[k][P])&&(R=i(N[k][P]),F=[k,P]);return[F,R]}function A(N,M){for(var R=N.length,F=Array(R),k=Array(R),P=0;P<R;P++)k[P]=Array(R);for(var T=0;T<R;T++){for(var O=0,L=N[0],I=0;I<N.length;I++)i(N[I])<i(L)&&(O=I,L=N[O]);F[T]=N.splice(O,1)[0];for(var V=0;V<R;V++)k[V][T]=M[V][O],M[V].splice(O,1)}return{values:F,vectors:k}}function _(N,M){for(var R=new Array(N),F=0;F<N;F++)R[F]=M;return R}return p}var Wde="eigs",Hde=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],og=Q(Wde,Hde,e=>{var{config:t,typed:r,matrix:n,addScalar:i,subtract:a,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:d,divideScalar:f,inv:p,bignumber:m,multiply:v,add:y,larger:b,column:D,flatten:x,number:S,complex:w,sqrt:C,diag:E,qr:A,usolve:_,usolveAll:N,im:M,re:R,smaller:F,matrixFromColumns:k,dot:P}=e,T=Ude({config:t,addScalar:i,subtract:a,column:D,flatten:x,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:d,inv:p,bignumber:m,complex:w,multiply:v,add:y}),O=Gde({config:t,addScalar:i,subtract:a,multiply:v,multiplyScalar:d,flatten:x,divideScalar:f,sqrt:C,abs:s,bignumber:m,diag:E,qr:A,inv:p,usolve:_,usolveAll:N,equal:o,complex:w,larger:b,smaller:F,matrixFromColumns:k,dot:P});return r("eigs",{Array:function(Y){var re=n(Y);return L(re)},"Array, number|BigNumber":function(Y,re){var ne=n(Y);return L(ne,re)},Matrix:function(Y){var{values:re,vectors:ne}=L(Y);return{values:n(re),vectors:n(ne)}},"Matrix, number|BigNumber":function(Y,re){var{values:ne,vectors:pe}=L(Y,re);return{values:n(ne),vectors:n(pe)}}});function L(G,Y){Y===void 0&&(Y=t.epsilon);var re=G.size();if(re.length!==2||re[0]!==re[1])throw new RangeError("Matrix must be square (size: "+Pt(re)+")");var ne=G.toArray(),pe=re[0];if(V(ne,pe,Y)&&(H(ne,pe),I(ne,pe,Y))){var he=Z(G,ne,pe);return T(ne,pe,Y,he)}var le=Z(G,ne,pe);return O(ne,pe,Y,le)}function I(G,Y,re){for(var ne=0;ne<Y;ne++)for(var pe=ne;pe<Y;pe++)if(b(m(s(a(G[ne][pe],G[pe][ne]))),re))return!1;return!0}function V(G,Y,re){for(var ne=0;ne<Y;ne++)for(var pe=0;pe<Y;pe++)if(b(m(s(M(G[ne][pe]))),re))return!1;return!0}function H(G,Y){for(var re=0;re<Y;re++)for(var ne=0;ne<Y;ne++)G[re][ne]=R(G[re][ne])}function Z(G,Y,re){var ne=G.datatype();if(ne==="number"||ne==="BigNumber"||ne==="Complex")return ne;for(var pe=!1,he=!1,le=!1,fe=0;fe<re;fe++)for(var xe=0;xe<re;xe++){var ge=Y[fe][xe];if(Ut(ge)||Mo(ge))pe=!0;else if(kt(ge))he=!0;else if(yi(ge))le=!0;else throw TypeError("Unsupported type in Matrix: "+Or(ge))}if(he&&le&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),le){for(var ve=0;ve<re;ve++)for(var Ee=0;Ee<re;Ee++)Y[ve][Ee]=w(Y[ve][Ee]);return"Complex"}if(he){for(var q=0;q<re;q++)for(var J=0;J<re;J++)Y[q][J]=m(Y[q][J]);return"BigNumber"}if(pe){for(var ce=0;ce<re;ce++)for(var X=0;X<re;X++)Y[ce][X]=S(Y[ce][X]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),D3="expm",jde=["typed","abs","add","identity","inv","multiply"],sg=Q(D3,jde,e=>{var{typed:t,abs:r,add:n,identity:i,inv:a,multiply:o}=e;return t(D3,{Matrix:function(d){var f=d.size();if(f.length!==2||f[0]!==f[1])throw new RangeError("Matrix must be square (size: "+Pt(f)+")");for(var p=f[0],m=1e-15,v=s(d),y=l(v,m),b=y.q,D=y.j,x=o(d,Math.pow(2,-D)),S=i(p),w=i(p),C=1,E=x,A=-1,_=1;_<=b;_++)_>1&&(E=o(E,x),A=-A),C=C*(b-_+1)/((2*b-_+1)*_),S=n(S,o(C,E)),w=n(w,o(C*A,E));for(var N=o(a(w),S),M=0;M<D;M++)N=o(N,N);return ja(d)?d.createSparseMatrix(N):N}});function s(c){for(var d=c.size()[0],f=0,p=0;p<d;p++){for(var m=0,v=0;v<d;v++)m+=r(c.get([p,v]));f=Math.max(m,f)}return f}function l(c,d){for(var f=30,p=0;p<f;p++)for(var m=0;m<=p;m++){var v=p-m;if(u(c,m,v)<d)return{q:m,j:v}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function u(c,d,f){for(var p=1,m=2;m<=d;m++)p*=m;for(var v=p,y=d+1;y<=2*d;y++)v*=y;var b=v*(2*d+1);return 8*Math.pow(c/Math.pow(2,f),2*d)*p*p/(v*b)}}),E3="sqrtm",Kde=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],lg=Q(E3,Kde,e=>{var{typed:t,abs:r,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:l,size:u,max:c,identity:d}=e,f=1e3,p=1e-6;function m(v){var y,b=0,D=v,x=d(u(v));do{var S=D;if(D=i(.5,n(S,l(x))),x=i(.5,n(x,l(S))),y=c(r(s(D,S))),y>p&&++b>f)throw new Error("computing square root of matrix: iterative method could not converge")}while(y>p);return D}return t(E3,{"Array | Matrix":function(y){var b=ft(y)?y.size():qt(y);switch(b.length){case 1:if(b[0]===1)return a(y,o);throw new RangeError("Matrix must be square (size: "+Pt(b)+")");case 2:{var D=b[0],x=b[1];if(D===x)return m(y);throw new RangeError("Matrix must be square (size: "+Pt(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Pt(b)+")")}}})}),N3="sylvester",Yde=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],ug=Q(N3,Yde,e=>{var{typed:t,schur:r,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:l,index:u,subset:c,add:d,subtract:f,identity:p,lusolve:m,abs:v}=e;return t(N3,{"Matrix, Matrix, Matrix":y,"Array, Matrix, Matrix":function(D,x,S){return y(i(D),x,S)},"Array, Array, Matrix":function(D,x,S){return y(i(D),i(x),S)},"Array, Matrix, Array":function(D,x,S){return y(i(D),x,i(S))},"Matrix, Array, Matrix":function(D,x,S){return y(D,i(x),S)},"Matrix, Array, Array":function(D,x,S){return y(D,i(x),i(S))},"Matrix, Matrix, Array":function(D,x,S){return y(D,x,i(S))},"Array, Array, Array":function(D,x,S){return y(i(D),i(x),i(S)).toArray()}});function y(b,D,x){for(var S=D.size()[0],w=b.size()[0],C=r(b),E=C.T,A=C.U,_=r(a(-1,D)),N=_.T,M=_.U,R=a(a(l(A),x),M),F=o(0,w),k=[],P=(ge,ve)=>s(ge,ve,1),T=(ge,ve)=>s(ge,ve,0),O=0;O<S;O++)if(O<S-1&&v(c(N,u(O+1,O)))>1e-5){for(var L=T(c(R,u(F,O)),c(R,u(F,O+1))),I=0;I<O;I++)L=d(L,T(a(k[I],c(N,u(I,O))),a(k[I],c(N,u(I,O+1)))));var V=a(p(w),a(-1,c(N,u(O,O)))),H=a(p(w),a(-1,c(N,u(O+1,O)))),Z=a(p(w),a(-1,c(N,u(O,O+1)))),G=a(p(w),a(-1,c(N,u(O+1,O+1)))),Y=T(P(d(E,V),H),P(Z,d(E,G))),re=m(Y,L);k[O]=re.subset(u(o(0,w),0)),k[O+1]=re.subset(u(o(w,2*w),0)),O++}else{for(var ne=c(R,u(F,O)),pe=0;pe<O;pe++)ne=d(ne,a(k[pe],c(N,u(pe,O))));var he=c(N,u(O,O)),le=f(E,a(he,p(w)));k[O]=m(le,ne)}var fe=i(n(...k)),xe=a(A,a(fe,l(M)));return xe}}),A3="schur",Xde=["typed","matrix","identity","multiply","qr","norm","subtract"],cg=Q(A3,Xde,e=>{var{typed:t,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:s}=e;return t(A3,{Array:function(c){var d=l(r(c));return{U:d.U.valueOf(),T:d.T.valueOf()}},Matrix:function(c){return l(c)}});function l(u){var c=u.size()[0],d=u,f=n(c),p=0,m;do{m=d;var v=a(d),y=v.Q,b=v.R;if(d=i(b,y),f=i(f,y),p++>100)break}while(o(s(d,m))>1e-4);return{U:f,T:d}}}),_3="lyap",Zde=["typed","matrix","sylvester","multiply","transpose"],dg=Q(_3,Zde,e=>{var{typed:t,matrix:r,sylvester:n,multiply:i,transpose:a}=e;return t(_3,{"Matrix, Matrix":function(s,l){return n(s,a(s),i(-1,l))},"Array, Matrix":function(s,l){return n(r(s),a(r(s)),i(-1,l))},"Matrix, Array":function(s,l){return n(s,a(r(s)),r(i(-1,l)))},"Array, Array":function(s,l){return n(r(s),a(r(s)),r(i(-1,l))).toArray()}})}),Qde="divide",Jde=["typed","matrix","multiply","equalScalar","divideScalar","inv"],fg=Q(Qde,Jde,e=>{var{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=Cn({typed:t,equalScalar:i}),l=Ui({typed:t});return t("divide",hM({"Array | Matrix, Array | Matrix":function(c,d){return n(c,o(d))},"DenseMatrix, any":function(c,d){return l(c,d,a,!1)},"SparseMatrix, any":function(c,d){return s(c,d,a,!1)},"Array, any":function(c,d){return l(r(c),d,a,!1).valueOf()},"any, Array | Matrix":function(c,d){return n(c,o(d))}},a.signatures))}),M3="distance",efe=["typed","addScalar","subtract","divideScalar","multiplyScalar","unaryMinus","sqrt","abs"],pg=Q(M3,efe,e=>{var{typed:t,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,unaryMinus:o,sqrt:s,abs:l}=e;return t(M3,{"Array, Array, Array":function(w,C,E){if(w.length===2&&C.length===2&&E.length===2){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");var A=a(n(E[1],E[0]),n(C[1],C[0])),_=i(i(A,A),C[0]),N=o(i(A,C[0])),M=w[1];return y(w[0],w[1],_,N,M)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(w,C,E){if(Object.keys(w).length===2&&Object.keys(C).length===2&&Object.keys(E).length===2){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(C))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(E))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"lineOnePtX"in C&&"lineOnePtY"in C&&"lineTwoPtX"in E&&"lineTwoPtY"in E){var A=a(n(E.lineTwoPtY,E.lineTwoPtX),n(C.lineOnePtY,C.lineOnePtX)),_=i(i(A,A),C.lineOnePtX),N=o(i(A,C.lineOnePtX)),M=w.pointX;return y(w.pointX,w.pointY,_,N,M)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(w,C){if(w.length===2&&C.length===3){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!d(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return y(w[0],w[1],C[0],C[1],C[2])}else if(w.length===3&&C.length===6){if(!d(w))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(C))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return b(w[0],w[1],w[2],C[0],C[1],C[2],C[3],C[4],C[5])}else if(w.length===C.length&&w.length>0){if(!f(w))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!f(C))throw new TypeError("All values of an array should be numbers or BigNumbers");return D(w,C)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(w,C){if(Object.keys(w).length===2&&Object.keys(C).length===3){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!d(C))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"xCoeffLine"in C&&"yCoeffLine"in C&&"constant"in C)return y(w.pointX,w.pointY,C.xCoeffLine,C.yCoeffLine,C.constant);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(C).length===6){if(!d(w))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(C))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"x0"in C&&"y0"in C&&"z0"in C&&"a"in C&&"b"in C&&"c"in C)return b(w.pointX,w.pointY,w.pointZ,C.x0,C.y0,C.z0,C.a,C.b,C.c);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===2&&Object.keys(C).length===2){if(!c(w))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(C))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointTwoX"in C&&"pointTwoY"in C)return D([w.pointOneX,w.pointOneY],[C.pointTwoX,C.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(C).length===3){if(!d(w))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!d(C))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointOneZ"in w&&"pointTwoX"in C&&"pointTwoY"in C&&"pointTwoZ"in C)return D([w.pointOneX,w.pointOneY,w.pointOneZ],[C.pointTwoX,C.pointTwoY,C.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(w){if(!v(w))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return x(w)}});function u(S){return typeof S=="number"||kt(S)}function c(S){return S.constructor!==Array&&(S=m(S)),u(S[0])&&u(S[1])}function d(S){return S.constructor!==Array&&(S=m(S)),u(S[0])&&u(S[1])&&u(S[2])}function f(S){return Array.isArray(S)||(S=m(S)),S.every(u)}function p(S){return S.constructor!==Array&&(S=m(S)),u(S[0])&&u(S[1])&&u(S[2])&&u(S[3])&&u(S[4])&&u(S[5])}function m(S){for(var w=Object.keys(S),C=[],E=0;E<w.length;E++)C.push(S[w[E]]);return C}function v(S){if(S[0].length===2&&u(S[0][0])&&u(S[0][1])){if(S.some(w=>w.length!==2||!u(w[0])||!u(w[1])))return!1}else if(S[0].length===3&&u(S[0][0])&&u(S[0][1])&&u(S[0][2])){if(S.some(w=>w.length!==3||!u(w[0])||!u(w[1])||!u(w[2])))return!1}else return!1;return!0}function y(S,w,C,E,A){var _=l(r(r(i(C,S),i(E,w)),A)),N=s(r(i(C,C),i(E,E)));return a(_,N)}function b(S,w,C,E,A,_,N,M,R){var F=[n(i(n(A,w),R),i(n(_,C),M)),n(i(n(_,C),N),i(n(E,S),R)),n(i(n(E,S),M),i(n(A,w),N))];F=s(r(r(i(F[0],F[0]),i(F[1],F[1])),i(F[2],F[2])));var k=s(r(r(i(N,N),i(M,M)),i(R,R)));return a(F,k)}function D(S,w){for(var C=S.length,E=0,A=0,_=0;_<C;_++)A=n(S[_],w[_]),E=r(i(A,A),E);return s(E)}function x(S){for(var w=[],C=[],E=[],A=0;A<S.length-1;A++)for(var _=A+1;_<S.length;_++)S[0].length===2?(C=[S[A][0],S[A][1]],E=[S[_][0],S[_][1]]):S[0].length===3&&(C=[S[A][0],S[A][1],S[A][2]],E=[S[_][0],S[_][1],S[_][2]]),w.push(D(C,E));return w}}),tfe="intersect",rfe=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],hg=Q(tfe,rfe,e=>{var{typed:t,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:l,divideScalar:u,subtract:c,smaller:d,equalScalar:f,flatten:p,isZero:m,isNumeric:v}=e;return t("intersect",{"Array, Array, Array":y,"Array, Array, Array, Array":b,"Matrix, Matrix, Matrix":function(M,R,F){var k=y(M.valueOf(),R.valueOf(),F.valueOf());return k===null?null:o(k)},"Matrix, Matrix, Matrix, Matrix":function(M,R,F,k){var P=b(M.valueOf(),R.valueOf(),F.valueOf(),k.valueOf());return P===null?null:o(P)}});function y(N,M,R){if(N=D(N),M=D(M),R=D(R),!S(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(R))throw new TypeError("Array with 4 numbers expected as third argument");return _(N[0],N[1],N[2],M[0],M[1],M[2],R[0],R[1],R[2],R[3])}function b(N,M,R,F){if(N=D(N),M=D(M),R=D(R),F=D(F),N.length===2){if(!x(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!x(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!x(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!x(F))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return C(N,M,R,F)}else if(N.length===3){if(!S(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!S(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!S(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!S(F))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return A(N[0],N[1],N[2],M[0],M[1],M[2],R[0],R[1],R[2],F[0],F[1],F[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function D(N){return N.length===1?N[0]:N.length>1&&Array.isArray(N[0])&&N.every(M=>Array.isArray(M)&&M.length===1)?p(N):N}function x(N){return N.length===2&&v(N[0])&&v(N[1])}function S(N){return N.length===3&&v(N[0])&&v(N[1])&&v(N[2])}function w(N){return N.length===4&&v(N[0])&&v(N[1])&&v(N[2])&&v(N[3])}function C(N,M,R,F){var k=N,P=R,T=c(k,M),O=c(P,F),L=c(l(T[0],O[1]),l(O[0],T[1]));if(m(L)||d(n(L),r.epsilon))return null;var I=l(O[0],k[1]),V=l(O[1],k[0]),H=l(O[0],P[1]),Z=l(O[1],P[0]),G=u(a(c(c(I,V),H),Z),L);return i(s(T,G),k)}function E(N,M,R,F,k,P,T,O,L,I,V,H){var Z=l(c(N,M),c(R,F)),G=l(c(k,P),c(T,O)),Y=l(c(L,I),c(V,H));return a(a(Z,G),Y)}function A(N,M,R,F,k,P,T,O,L,I,V,H){var Z=E(N,T,I,T,M,O,V,O,R,L,H,L),G=E(I,T,F,N,V,O,k,M,H,L,P,R),Y=E(N,T,F,N,M,O,k,M,R,L,P,R),re=E(I,T,I,T,V,O,V,O,H,L,H,L),ne=E(F,N,F,N,k,M,k,M,P,R,P,R),pe=c(l(Z,G),l(Y,re)),he=c(l(ne,re),l(G,G));if(m(he))return null;var le=u(pe,he),fe=u(a(Z,l(le,G)),re),xe=a(N,l(le,c(F,N))),ge=a(M,l(le,c(k,M))),ve=a(R,l(le,c(P,R))),Ee=a(T,l(fe,c(I,T))),q=a(O,l(fe,c(V,O))),J=a(L,l(fe,c(H,L)));return f(xe,Ee)&&f(ge,q)&&f(ve,J)?[xe,ge,ve]:null}function _(N,M,R,F,k,P,T,O,L,I){var V=l(N,T),H=l(F,T),Z=l(M,O),G=l(k,O),Y=l(R,L),re=l(P,L),ne=c(c(c(I,V),Z),Y),pe=c(c(c(a(a(H,G),re),V),Z),Y),he=u(ne,pe),le=a(N,l(he,c(F,N))),fe=a(M,l(he,c(k,M))),xe=a(R,l(he,c(P,R)));return[le,fe,xe]}}),T3="sum",nfe=["typed","config","add","numeric"],pc=Q(T3,nfe,e=>{var{typed:t,config:r,add:n,numeric:i}=e;return t(T3,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(l){if(Al(l))throw new TypeError("Scalar values expected in function sum");return a(l)}});function a(s){var l;return Qa(s,function(u){try{l=l===void 0?u:n(l,u)}catch(c){throw qn(c,"sum",u)}}),l===void 0&&(l=i(0,r.number)),typeof l=="string"&&(l=i(l,r.number)),l}function o(s,l){try{var u=Vf(s,l,n);return u}catch(c){throw qn(c,"sum")}}}),mg="cumsum",ife=["typed","add","unaryPlus"],hc=Q(mg,ife,e=>{var{typed:t,add:r,unaryPlus:n}=e;return t(mg,{Array:i,Matrix:function(u){return u.create(i(u.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(u,c){return u.create(o(u.valueOf(),c))},"...":function(u){if(Al(u))throw new TypeError("All values expected to be scalar in function cumsum");return i(u)}});function i(l){try{return a(l)}catch(u){throw qn(u,mg)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c<l.length;++c)u.push(r(u[c-1],l[c]));return u}function o(l,u){var c=qt(l);if(u<0||u>=c.length)throw new ii(u,c.length);try{return s(l,u)}catch(d){throw qn(d,mg)}}function s(l,u){var c,d,f;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(f=iT(l),d=[],c=0;c<f.length;c++)d[c]=s(f[c],u-1);return d}else return a(l)}else{for(d=[],c=0;c<l.length;c++)d[c]=s(l[c],u-1);return d}}}),O3="mean",afe=["typed","add","divide"],mc=Q(O3,afe,e=>{var{typed:t,add:r,divide:n}=e;return t(O3,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(s){if(Al(s))throw new TypeError("Scalar values expected in function mean");return a(s)}});function i(o,s){try{var l=Vf(o,s,r),u=Array.isArray(o)?qt(o):o.size();return n(l,u[s])}catch(c){throw qn(c,"mean")}}function a(o){var s,l=0;if(Qa(o,function(u){try{s=s===void 0?u:r(s,u),l++}catch(c){throw qn(c,"mean",u)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(s,l)}}),R3="median",ofe=["typed","add","divide","compare","partitionSelect"],vg=Q(R3,ofe,e=>{var{typed:t,add:r,divide:n,compare:i,partitionSelect:a}=e;function o(u){try{u=Qt(u.valueOf());var c=u.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var d=c/2-1,f=a(u,d+1),p=u[d],m=0;m<d;++m)i(u[m],p)>0&&(p=u[m]);return l(p,f)}else{var v=a(u,(c-1)/2);return s(v)}}catch(y){throw qn(y,"median")}}var s=t({"number | BigNumber | Complex | Unit":function(c){return c}}),l=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,d){return n(r(c,d),2)}});return t(R3,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,d){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(Al(c))throw new TypeError("Scalar values expected in function median");return o(c)}})}),I3="mad",sfe=["typed","abs","map","median","subtract"],gg=Q(I3,sfe,e=>{var{typed:t,abs:r,map:n,median:i,subtract:a}=e;return t(I3,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=Qt(s.valueOf()),s.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var l=i(s);return i(n(s,function(u){return r(a(u,l))}))}catch(u){throw u instanceof TypeError&&u.message.indexOf("median")!==-1?new TypeError(u.message.replace("median","mad")):qn(u,"mad")}}}),Aw="unbiased",k3="variance",lfe=["typed","add","subtract","multiply","divide","apply","isNaN"],vc=Q(k3,lfe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e;return t(k3,{"Array | Matrix":function(d){return l(d,Aw)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(d,f){return u(d,f,Aw)},"Array | Matrix, number | BigNumber, string":u,"...":function(d){return l(d,Aw)}});function l(c,d){var f,p=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Qa(c,function(y){try{f=f===void 0?y:r(f,y),p++}catch(b){throw qn(b,"variance",y)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var m=a(f,p);if(f=void 0,Qa(c,function(y){var b=n(y,m);f=f===void 0?i(b,b):r(f,i(b,b))}),s(f))return f;switch(d){case"uncorrected":return a(f,p);case"biased":return a(f,p+1);case"unbiased":{var v=kt(f)?f.mul(0):0;return p===1?v:a(f,p-1)}default:throw new Error('Unknown normalization "'+d+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(c,d,f){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,d,p=>l(p,f))}catch(p){throw qn(p,"variance")}}}),ufe="quantileSeq",cfe=["typed","add","multiply","partitionSelect","compare"],yg=Q(ufe,cfe,e=>{var{typed:t,add:r,multiply:n,partitionSelect:i,compare:a}=e;function o(u,c,d){var f,p,m;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(xi(u)){if(d=d||!1,typeof d=="boolean"){if(p=u.valueOf(),Ut(c)){if(c<0)throw new Error("N/prob must be non-negative");if(c<=1)return s(p,c,d);if(c>1){if(!ot(c))throw new Error("N must be a positive integer");var v=c+1;f=new Array(c);for(var y=0;y<c;)f[y]=s(p,++y/v,d);return f}}if(kt(c)){var b=c.constructor;if(c.isNegative())throw new Error("N/prob must be non-negative");if(m=new b(1),c.lte(m))return new b(s(p,c,d));if(c.gt(m)){if(!c.isInteger())throw new Error("N must be a positive integer");var D=c.toNumber();if(D>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var x=new b(D+1);f=new Array(D);for(var S=0;S<D;)f[S]=new b(s(p,new b(++S).div(x),d));return f}}if(xi(c)){var w=c.valueOf();f=new Array(w.length);for(var C=0;C<f.length;++C){var E=w[C];if(Ut(E)){if(E<0||E>1)throw new Error("Probability must be between 0 and 1, inclusive")}else if(kt(E)){if(m=new E.constructor(1),E.isNegative()||E.gt(m))throw new Error("Probability must be between 0 and 1, inclusive")}else throw new TypeError("Unexpected type of argument in function quantileSeq");f[C]=s(p,E,d)}return f}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}function s(u,c,d){var f=Qt(u),p=f.length;if(p===0)throw new Error("Cannot calculate quantile of an empty sequence");if(Ut(c)){var m=c*(p-1),v=m%1;if(v===0){var y=d?f[m]:i(f,m);return l(y),y}var b=Math.floor(m),D,x;if(d)D=f[b],x=f[b+1];else{x=i(f,b+1),D=f[b];for(var S=0;S<b;++S)a(f[S],D)>0&&(D=f[S])}return l(D),l(x),r(n(D,1-v),n(x,v))}var w=c.times(p-1);if(w.isInteger()){w=w.toNumber();var C=d?f[w]:i(f,w);return l(C),C}var E=w.floor(),A=w.minus(E),_=E.toNumber(),N,M;if(d)N=f[_],M=f[_+1];else{M=i(f,_+1),N=f[_];for(var R=0;R<_;++R)a(f[R],N)>0&&(N=f[R])}l(N),l(M);var F=new A.constructor(1);return r(n(N,F.minus(A)),n(M,A))}var l=t({"number | BigNumber | Unit":function(c){return c}});return o}),P3="std",dfe=["typed","map","sqrt","variance"],gc=Q(P3,dfe,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e;return t(P3,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(s){return a(s)}});function a(o,s){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var l=i.apply(null,arguments);return xi(l)?r(l,n):n(l)}catch(u){throw u instanceof TypeError&&u.message.indexOf(" variance")!==-1?new TypeError(u.message.replace(" variance"," std")):u}}}),F3="combinations",ffe=["typed"],bg=Q(F3,ffe,e=>{var{typed:t}=e;return t(F3,{"number, number":RT,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!$3(n)||!$3(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=u,i.lt(l))for(s=u;s.lte(l);s=s.plus(u))o=o.times(i.plus(s)).dividedBy(s);else for(s=u;s.lte(i);s=s.plus(u))o=o.times(l.plus(s)).dividedBy(s);return o}})});function $3(e){return e.isInteger()&&e.gte(0)}var B3="combinationsWithRep",pfe=["typed"],xg=Q(B3,pfe,e=>{var{typed:t}=e;return t(B3,{"number, number":function(n,i){if(!ot(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ot(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i<n-1){var a=Ja(n,n+i-1);return a/Ja(1,i)}var o=Ja(i+1,n+i-1);return o/Ja(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=new a(1),u=n.minus(l);if(!z3(n)||!z3(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(l))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=l,i.lt(u))for(s=l;s.lte(u);s=s.plus(l))o=o.times(i.plus(s)).dividedBy(s);else for(s=l;s.lte(i);s=s.plus(l))o=o.times(u.plus(s)).dividedBy(s);return o}})});function z3(e){return e.isInteger()&&e.gte(0)}var L3="gamma",hfe=["typed","config","multiplyScalar","pow","BigNumber","Complex"],wg=Q(L3,hfe,e=>{var{typed:t,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;function s(u){if(u.im===0)return Uf(u.re);if(u.re<.5){var c=new o(1-u.re,-u.im),d=new o(Math.PI*u.re,Math.PI*u.im);return new o(Math.PI).div(d.sin()).div(s(c))}u=new o(u.re-1,u.im);for(var f=new o(Ml[0],0),p=1;p<Ml.length;++p){var m=new o(Ml[p],0);f=f.add(m.div(u.add(p)))}var v=new o(u.re+$T+.5,u.im),y=Math.sqrt(2*Math.PI),b=v.pow(u.add(.5)),D=v.neg().exp();return f.mul(y).mul(b).mul(D)}return t(L3,{number:Uf,Complex:s,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):l(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function l(u){if(u<8)return new a([1,1,2,6,24,120,720,5040][u]);var c=r.precision+(Math.log(u.toNumber())|0),d=a.clone({precision:c});if(u%2===1)return u.times(l(new a(u-1)));for(var f=u,p=new d(u),m=u.toNumber();f>2;)f-=2,m+=f,p=p.times(m);return new a(p.toPrecision(a.precision))}}),V3="lgamma",mfe=["Complex","typed"],Cg=Q(V3,mfe,e=>{var{Complex:t,typed:r}=e,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(V3,{number:Wf,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(u){var c=6.283185307179586,d=1.1447298858494002,f=.1;if(u.isNaN())return new t(NaN,NaN);if(u.im===0)return new t(Wf(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=f){var p=OJ(c,u.im)*Math.floor(.5*u.re+.25),m=u.mul(Math.PI).sin().log(),v=o(new t(1-u.re,-u.im));return new t(d,p).sub(m).sub(v)}else return u.im>=0?l(u):l(u.conjugate()).conjugate()}function s(u){for(var c=u.sub(.5).mul(u.log()).sub(u).add(BT),d=new t(1,0).div(u),f=d.div(u),p=a[0],m=a[1],v=2*f.re,y=f.re*f.re+f.im*f.im,b=2;b<8;b++){var D=m;m=-y*p+a[b],p=v*p+D}var x=d.mul(f.mul(p).add(m));return c.add(x)}function l(u){var c=0,d=0,f=u;for(u=u.add(1);u.re<=n;){f=f.mul(u);var p=f.im<0?1:0;p!==0&&d===0&&c++,d=p,u=u.add(1)}return s(u).sub(f.log()).sub(new t(0,c*2*Math.PI*1))}}),q3="factorial",vfe=["typed","gamma"],Sg=Q(q3,vfe,e=>{var{typed:t,gamma:r}=e;return t(q3,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return r(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return r(i.plus(1))},"Array | Matrix":t.referToSelf(n=>i=>zt(i,n))})}),G3="kldivergence",gfe=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],Dg=Q(G3,gfe,e=>{var{typed:t,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=e;return t(G3,{"Array, Array":function(f,p){return c(r(f),r(p))},"Matrix, Array":function(f,p){return c(f,r(p))},"Array, Matrix":function(f,p){return c(r(f),p)},"Matrix, Matrix":function(f,p){return c(f,p)}});function c(d,f){var p=f.size().length,m=d.size().length;if(p>1)throw new Error("first object must be one dimensional");if(m>1)throw new Error("second object must be one dimensional");if(p!==m)throw new Error("Length of two vectors must be equal");var v=i(d);if(v===0)throw new Error("Sum of elements in first object must be non zero");var y=i(f);if(y===0)throw new Error("Sum of elements in second object must be non zero");var b=n(d,i(d)),D=n(f,i(f)),x=i(a(b,o(s(b,D),S=>l(S))));return u(x)?x:Number.NaN}}),U3="multinomial",yfe=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Eg=Q(U3,yfe,e=>{var{typed:t,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(U3,{"Array | Matrix":function(u){var c=0,d=1;return Qa(u,function(f){if(!o(f)||!s(f))throw new TypeError("Positive integer value expected in function multinomial");c=r(c,f),d=i(d,a(f))}),n(a(c),d)}})}),W3="permutations",bfe=["typed","factorial"],Ng=Q(W3,bfe,e=>{var{typed:t,factorial:r}=e;return t(W3,{"number | BigNumber":r,"number, number":function(i,a){if(!ot(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!ot(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(a>i)throw new TypeError("second argument k must be less than or equal to first argument n");return Ja(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,s;if(!H3(i)||!H3(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var l=i.mul(0).add(1);for(o=l,s=i.minus(a).plus(1);s.lte(i);s=s.plus(1))o=o.times(s);return o}})});function H3(e){return e.isInteger()&&e.gte(0)}var j3={exports:{}};(function(e){(function(t,r,n){function i(l){var u=this,c=s();u.next=function(){var d=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=d-(u.c=d|0)},u.c=1,u.s0=c(" "),u.s1=c(" "),u.s2=c(" "),u.s0-=c(l),u.s0<0&&(u.s0+=1),u.s1-=c(l),u.s1<0&&(u.s1+=1),u.s2-=c(l),u.s2<0&&(u.s2+=1),c=null}function a(l,u){return u.c=l.c,u.s0=l.s0,u.s1=l.s1,u.s2=l.s2,u}function o(l,u){var c=new i(l),d=u&&u.state,f=c.next;return f.int32=function(){return c.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,d&&(typeof d=="object"&&a(d,c),f.state=function(){return a(c,{})}),f}function s(){var l=4022871197,u=function(c){c=String(c);for(var d=0;d<c.length;d++){l+=c.charCodeAt(d);var f=.02519603282416938*l;l=f>>>0,f-=l,f*=l,l=f>>>0,f-=l,l+=f*4294967296}return(l>>>0)*23283064365386963e-26};return u}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.alea=o})(vt,e,!1)})(j3);var K3={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this,u="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var d=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^d^d>>>8},s===(s|0)?l.x=s:u+=s;for(var c=0;c<u.length+64;c++)l.x^=u.charCodeAt(c)|0,l.next()}function a(s,l){return l.x=s.x,l.y=s.y,l.z=s.z,l.w=s.w,l}function o(s,l){var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xor128=o})(vt,e,!1)})(K3);var Y3={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this,u="";l.next=function(){var d=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(d^d<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,s===(s|0)?l.x=s:u+=s;for(var c=0;c<u.length+64;c++)l.x^=u.charCodeAt(c)|0,c==u.length&&(l.d=l.x<<10^l.x>>>4),l.next()}function a(s,l){return l.x=s.x,l.y=s.y,l.z=s.z,l.w=s.w,l.v=s.v,l.d=s.d,l}function o(s,l){var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xorwow=o})(vt,e,!1)})(Y3);var X3={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this;l.next=function(){var c=l.x,d=l.i,f,p;return f=c[d],f^=f>>>7,p=f^f<<24,f=c[d+1&7],p^=f^f>>>10,f=c[d+3&7],p^=f^f>>>3,f=c[d+4&7],p^=f^f<<7,f=c[d+7&7],f=f^f<<13,p^=f^f<<9,c[d]=p,l.i=d+1&7,p};function u(c,d){var f,p=[];if(d===(d|0))p[0]=d;else for(d=""+d,f=0;f<d.length;++f)p[f&7]=p[f&7]<<15^d.charCodeAt(f)+p[f+1&7]<<13;for(;p.length<8;)p.push(0);for(f=0;f<8&&p[f]===0;++f);for(f==8?p[7]=-1:p[f],c.x=p,c.i=0,f=256;f>0;--f)c.next()}u(l,s)}function a(s,l){return l.x=s.x.slice(),l.i=s.i,l}function o(s,l){s==null&&(s=+new Date);var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(c.x&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xorshift7=o})(vt,e,!1)})(X3);var Z3={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this;l.next=function(){var c=l.w,d=l.X,f=l.i,p,m;return l.w=c=c+1640531527|0,m=d[f+34&127],p=d[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,m=d[f]=m^p,l.i=f,m+(c^c>>>16)|0};function u(c,d){var f,p,m,v,y,b=[],D=128;for(d===(d|0)?(p=d,d=null):(d=d+"\0",p=0,D=Math.max(D,d.length)),m=0,v=-32;v<D;++v)d&&(p^=d.charCodeAt((v+32)%d.length)),v===0&&(y=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,v>=0&&(y=y+1640531527|0,f=b[v&127]^=p+y,m=f==0?m+1:0);for(m>=128&&(b[(d&&d.length||0)&127]=-1),m=127,v=4*128;v>0;--v)p=b[m+34&127],f=b[m=m+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,b[m]=p^f;c.w=y,c.X=b,c.i=m}u(l,s)}function a(s,l){return l.i=s.i,l.w=s.w,l.X=s.X.slice(),l}function o(s,l){s==null&&(s=+new Date);var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(c.X&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xor4096=o})(vt,e,!1)})(Z3);var Q3={exports:{}};(function(e){(function(t,r,n){function i(s){var l=this,u="";l.next=function(){var d=l.b,f=l.c,p=l.d,m=l.a;return d=d<<25^d>>>7^f,f=f-p|0,p=p<<24^p>>>8^m,m=m-d|0,l.b=d=d<<20^d>>>12^f,l.c=f=f-p|0,l.d=p<<16^f>>>16^m,l.a=m-d|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,s===Math.floor(s)?(l.a=s/4294967296|0,l.b=s|0):u+=s;for(var c=0;c<u.length+20;c++)l.b^=u.charCodeAt(c)|0,l.next()}function a(s,l){return l.a=s.a,l.b=s.b,l.c=s.c,l.d=s.d,l}function o(s,l){var u=new i(s),c=l&&l.state,d=function(){return(u.next()>>>0)/4294967296};return d.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},d.int32=u.next,d.quick=d,c&&(typeof c=="object"&&a(c,u),d.state=function(){return a(u,{})}),d}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.tychei=o})(vt,e,!1)})(Q3);var J3={exports:{}};const xfe=O6(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));(function(e){(function(t,r,n){var i=256,a=6,o=52,s="random",l=n.pow(i,a),u=n.pow(2,o),c=u*2,d=i-1,f;function p(S,w,C){var E=[];w=w==!0?{entropy:!0}:w||{};var A=b(y(w.entropy?[S,x(r)]:S==null?D():S,3),E),_=new m(E),N=function(){for(var M=_.g(a),R=l,F=0;M<u;)M=(M+F)*i,R*=i,F=_.g(1);for(;M>=c;)M/=2,R/=2,F>>>=1;return(M+F)/R};return N.int32=function(){return _.g(4)|0},N.quick=function(){return _.g(4)/4294967296},N.double=N,b(x(_.S),r),(w.pass||C||function(M,R,F,k){return k&&(k.S&&v(k,_),M.state=function(){return v(_,{})}),F?(n[s]=M,R):M})(N,A,"global"in w?w.global:this==n,w.state)}function m(S){var w,C=S.length,E=this,A=0,_=E.i=E.j=0,N=E.S=[];for(C||(S=[C++]);A<i;)N[A]=A++;for(A=0;A<i;A++)N[A]=N[_=d&_+S[A%C]+(w=N[A])],N[_]=w;(E.g=function(M){for(var R,F=0,k=E.i,P=E.j,T=E.S;M--;)R=T[k=d&k+1],F=F*i+T[d&(T[k]=T[P=d&P+R])+(T[P]=R)];return E.i=k,E.j=P,F})(i)}function v(S,w){return w.i=S.i,w.j=S.j,w.S=S.S.slice(),w}function y(S,w){var C=[],E=typeof S,A;if(w&&E=="object")for(A in S)try{C.push(y(S[A],w-1))}catch{}return C.length?C:E=="string"?S:S+"\0"}function b(S,w){for(var C=S+"",E,A=0;A<C.length;)w[d&A]=d&(E^=w[d&A]*19)+C.charCodeAt(A++);return x(w)}function D(){try{var S;return f&&(S=f.randomBytes)?S=S(i):(S=new Uint8Array(i),(t.crypto||t.msCrypto).getRandomValues(S)),x(S)}catch{var w=t.navigator,C=w&&w.plugins;return[+new Date,t,C,t.screen,x(r)]}}function x(S){return String.fromCharCode.apply(0,S)}if(b(n.random(),r),e.exports){e.exports=p;try{f=xfe}catch{}}else n["seed"+s]=p})(typeof self<"u"?self:vt,[],Math)})(J3);var wfe=j3.exports,Cfe=K3.exports,Sfe=Y3.exports,Dfe=X3.exports,Efe=Z3.exports,Nfe=Q3.exports,ys=J3.exports;ys.alea=wfe,ys.xor128=Cfe,ys.xorwow=Sfe,ys.xorshift7=Dfe,ys.xor4096=Efe,ys.tychei=Nfe;var ek=ys,Afe=ek(Date.now());function Pl(e){var t;function r(i){t=i===null?Afe:ek(String(i))}r(e);function n(){return t()}return n}var tk="pickRandom",_fe=["typed","config","?on"],Ag=Q(tk,_fe,e=>{var{typed:t,config:r,on:n}=e,i=Pl(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=Pl(o.randomSeed))}),t(tk,{"Array | Matrix":function(s){return a(s,{})},"Array | Matrix, Object":function(s,l){return a(s,l)},"Array | Matrix, number":function(s,l){return a(s,{number:l})},"Array | Matrix, Array | Matrix":function(s,l){return a(s,{weights:l})},"Array | Matrix, Array | Matrix, number":function(s,l,u){return a(s,{number:u,weights:l})},"Array | Matrix, number, Array | Matrix":function(s,l,u){return a(s,{number:l,weights:u})}});function a(o,s){var{number:l,weights:u,elementWise:c=!0}=s,d=typeof l>"u";d&&(l=1);var f=ft(o)?o.create:ft(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),c===!0&&(o=Qt(o),u=Qt(u));var p=0;if(typeof u<"u"){if(u.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var m=0,v=u.length;m<v;m++){if(!Ut(u[m])||u[m]<0)throw new Error("Weights must be an array of positive numbers");p+=u[m]}}for(var y=o.length,b=[],D;b.length<l;){if(typeof u>"u")D=o[Math.floor(i()*y)];else for(var x=i()*p,S=0,w=o.length;S<w;S++)if(x-=u[S],x<0){D=o[S];break}b.push(D)}return d?b[0]:f?f(b):b}});function _w(e,t){var r=[];if(e=e.slice(0),e.length>1)for(var n=0,i=e.shift();n<i;n++)r.push(_w(e,t));else for(var a=0,o=e.shift();a<o;a++)r.push(t());return r}var rk="random",Mfe=["typed","config","?on"],_g=Q(rk,Mfe,e=>{var{typed:t,config:r,on:n}=e,i=Pl(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=Pl(s.randomSeed))}),t(rk,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=_w(s.valueOf(),()=>o(l,u));return ft(s)?s.create(c):c}function o(s,l){return s+i()*(l-s)}}),nk="randomInt",Tfe=["typed","config","?on"],Mg=Q(nk,Tfe,e=>{var{typed:t,config:r,on:n}=e,i=Pl(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=Pl(s.randomSeed))}),t(nk,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=_w(s.valueOf(),()=>o(l,u));return ft(s)?s.create(c):c}function o(s,l){return Math.floor(s+i()*(l-s))}}),ik="stirlingS2",Ofe=["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],Tg=Q(ik,Ofe,e=>{var{typed:t,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:l,isNegative:u,isInteger:c,number:d,bignumber:f,larger:p}=e,m=[],v=[];return t(ik,{"number | BigNumber, number | BigNumber":function(b,D){if(!c(b)||u(b)||!c(D)||u(D))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(D,b))throw new TypeError("k must be less than or equal to n in function stirlingS2");var x=!(Ut(b)&&Ut(D)),S=x?v:m,w=x?f:d,C=d(b),E=d(D);if(S[C]&&S[C].length>E)return S[C][E];for(var A=0;A<=C;++A)if(S[A]||(S[A]=[w(A===0?1:0)]),A!==0)for(var _=S[A],N=S[A-1],M=_.length;M<=A&&M<=E;++M)M===A?_[M]=1:_[M]=r(i(w(M),N[M]),N[M-1]);return S[C][E]}})}),ak="bellNumbers",Rfe=["typed","addScalar","isNegative","isInteger","stirlingS2"],Og=Q(ak,Rfe,e=>{var{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=e;return t(ak,{"number | BigNumber":function(s){if(!i(s)||n(s))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var l=0,u=0;u<=s;u++)l=r(l,a(s,u));return l}})}),ok="catalan",Ife=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Rg=Q(ok,Ife,e=>{var{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(ok,{"number | BigNumber":function(u){if(!s(u)||o(u))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(u,2),u),r(u,1))}})}),sk="composition",kfe=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Ig=Q(sk,kfe,e=>{var{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(sk,{"number | BigNumber, number | BigNumber":function(u,c){if(!o(u)||!i(u)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(s(c,u))throw new TypeError("k must be less than or equal to n in function composition");return n(r(u,-1),r(c,-1))}})}),lk="leafCount",Pfe=["parse","typed"],kg=Q(lk,Pfe,e=>{var{parse:t,typed:r}=e;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(lk,{Node:function(a){return n(a)}})});function uk(e){return Kt(e)||Wr(e)&&e.isUnary()&&Kt(e.args[0])}function Pg(e){return!!(Kt(e)||(ya(e)||Wr(e))&&e.args.every(Pg)||zi(e)&&Pg(e.content))}function ck(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ck(Object(r),!0).forEach(function(n){pn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ck(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ffe="simplifyUtil",$fe=["FunctionNode","OperatorNode","SymbolNode"],Tw=Q(Ffe,$fe,e=>{var{FunctionNode:t,OperatorNode:r,SymbolNode:n}=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}},l={divide:{total:a},log:{total:a}},u={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(x,S){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,C=o;if(typeof x=="string"?C=x:Wr(x)?C=x.fn.toString():ya(x)?C=x.name:zi(x)&&(C="paren"),et(w,C)){var E=w[C];if(et(E,S))return E[S];if(et(s,C))return s[C][S]}if(et(w,o)){var A=w[o];return et(A,S)?A[S]:s[o][S]}if(et(s,C)){var _=s[C];if(et(_,S))return _[S]}return s[o][S]}function d(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(x,"commutative",S)}function f(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(x,"associative",S)}function p(x,S){var w=Mw({},x);for(var C in S)et(x,C)?w[C]=Mw(Mw({},S[C]),x[C]):w[C]=S[C];return w}function m(x,S){if(!x.args||x.args.length===0)return x;x.args=v(x,S);for(var w=0;w<x.args.length;w++)m(x.args[w],S)}function v(x,S){var w,C=[],E=function A(_){for(var N=0;N<_.args.length;N++){var M=_.args[N];Wr(M)&&w===M.op?A(M):C.push(M)}};return f(x,S)?(w=x.op,E(x),C):x.args}function y(x,S){if(!(!x.args||x.args.length===0)){for(var w=D(x),C=x.args.length,E=0;E<C;E++)y(x.args[E],S);if(C>2&&f(x,S)){for(var A=x.args.pop();x.args.length>0;)A=w([x.args.pop(),A]);x.args=A.args}}}function b(x,S){if(!(!x.args||x.args.length===0)){for(var w=D(x),C=x.args.length,E=0;E<C;E++)b(x.args[E],S);if(C>2&&f(x,S)){for(var A=x.args.shift();x.args.length>0;)A=w([A,x.args.shift()]);x.args=A.args}}}function D(x){return Wr(x)?function(S){try{return new r(x.op,x.fn,S,x.implicit)}catch(w){return console.error(w),[]}}:function(S){return new t(new n(x.name),S)}}return{createMakeNodeFunction:D,hasProperty:c,isCommutative:d,isAssociative:f,mergeContext:p,flatten:m,allChildren:v,unflattenr:y,unflattenl:b,defaultContext:s,realContext:l,positiveContext:u}}),Bfe="simplify",zfe=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Fg=Q(Bfe,zfe,e=>{var{config:t,typed:r,parse:n,add:i,subtract:a,multiply:o,divide:s,pow:l,isZero:u,equal:c,resolve:d,simplifyConstant:f,simplifyCore:p,fraction:m,bignumber:v,mathWithTransform:y,matrix:b,AccessorNode:D,ArrayNode:x,ConstantNode:S,FunctionNode:w,IndexNode:C,ObjectNode:E,OperatorNode:A,ParenthesisNode:_,SymbolNode:N}=e,{hasProperty:M,isCommutative:R,isAssociative:F,mergeContext:k,flatten:P,unflattenr:T,unflattenl:O,createMakeNodeFunction:L,defaultContext:I,realContext:V,positiveContext:H}=Tw({FunctionNode:w,OperatorNode:A,SymbolNode:N});r.addConversion({from:"Object",to:"Map",convert:Dl});var Z=r("simplify",{Node:le,"Node, Map":(X,te)=>le(X,!1,te),"Node, Map, Object":(X,te,ae)=>le(X,!1,te,ae),"Node, Array":le,"Node, Array, Map":le,"Node, Array, Map, Object":le});r.removeConversion({from:"Object",to:"Map",convert:Dl}),Z.defaultContext=I,Z.realContext=V,Z.positiveContext=H;function G(X){return X.transform(function(te,ae,De){return zi(te)?G(te.content):te})}var Y={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};Z.rules=[p,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},f,{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}}},f,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function re(X,te){var ae={};if(X.s){var De=X.s.split("->");if(De.length===2)ae.l=De[0],ae.r=De[1];else throw SyntaxError("Could not parse rule: "+X.s)}else ae.l=X.l,ae.r=X.r;ae.l=G(n(ae.l)),ae.r=G(n(ae.r));for(var be of["imposeContext","repeat","assuming"])be in X&&(ae[be]=X[be]);if(X.evaluate&&(ae.evaluate=n(X.evaluate)),F(ae.l,te)){var K=!R(ae.l,te),W;K&&(W=he());var ue=L(ae.l),me=he();ae.expanded={},ae.expanded.l=ue([ae.l,me]),P(ae.expanded.l,te),T(ae.expanded.l,te),ae.expanded.r=ue([ae.r,me]),K&&(ae.expandedNC1={},ae.expandedNC1.l=ue([W,ae.l]),ae.expandedNC1.r=ue([W,ae.r]),ae.expandedNC2={},ae.expandedNC2.l=ue([W,ae.expanded.l]),ae.expandedNC2.r=ue([W,ae.expanded.r]))}return ae}function ne(X,te){for(var ae=[],De=0;De<X.length;De++){var be=X[De],K=void 0,W=typeof be;switch(W){case"string":be={s:be};case"object":K=re(be,te);break;case"function":K=be;break;default:throw TypeError("Unsupported type of rule: "+W)}ae.push(K)}return ae}var pe=0;function he(){return new N("_p"+pe++)}function le(X,te){var ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Sl(),De=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},be=De.consoleDebug;te=ne(te||Z.rules,De.context);var K=d(X,ae);K=G(K);for(var W={},ue=K.toString({parenthesis:"all"});!W[ue];){W[ue]=!0,pe=0;var me=ue;be&&console.log("Working on: ",ue);for(var we=0;we<te.length;we++){var _e="";if(typeof te[we]=="function"?(K=te[we](K,De),be&&(_e=te[we].name)):(P(K,De.context),K=xe(K,te[we],De.context),be&&(_e="".concat(te[we].l.toString()," -> ").concat(te[we].r.toString()))),be){var Ae=K.toString({parenthesis:"all"});Ae!==me&&(console.log("Applying",_e,"produced",Ae),me=Ae)}O(K,De.context)}ue=K.toString({parenthesis:"all"})}return K}function fe(X,te,ae){var De=X;if(X)for(var be=0;be<X.length;++be){var K=xe(X[be],te,ae);K!==X[be]&&(De===X&&(De=X.slice()),De[be]=K)}return De}function xe(X,te,ae){if(te.assuming){for(var De in te.assuming)for(var be in te.assuming[De])if(M(De,be,ae)!==te.assuming[De][be])return X}var K=k(te.imposeContext,ae),W=X;if(W instanceof A||W instanceof w){var ue=fe(W.args,te,ae);ue!==W.args&&(W=W.clone(),W.args=ue)}else if(W instanceof _){if(W.content){var me=xe(W.content,te,ae);me!==W.content&&(W=new _(me))}}else if(W instanceof x){var we=fe(W.items,te,ae);we!==W.items&&(W=new x(we))}else if(W instanceof D){var _e=W.object;W.object&&(_e=xe(W.object,te,ae));var Ae=W.index;W.index&&(Ae=xe(W.index,te,ae)),(_e!==W.object||Ae!==W.index)&&(W=new D(_e,Ae))}else if(W instanceof C){var Ce=fe(W.dimensions,te,ae);Ce!==W.dimensions&&(W=new C(Ce))}else if(W instanceof E){var Me=!1,Te={};for(var Ve in W.properties)Te[Ve]=xe(W.properties[Ve],te,ae),Te[Ve]!==W.properties[Ve]&&(Me=!0);Me&&(W=new E(Te))}var Re=te.r,dt=J(te.l,W,K)[0];if(!dt&&te.expanded&&(Re=te.expanded.r,dt=J(te.expanded.l,W,K)[0]),!dt&&te.expandedNC1&&(Re=te.expandedNC1.r,dt=J(te.expandedNC1.l,W,K)[0],dt||(Re=te.expandedNC2.r,dt=J(te.expandedNC2.l,W,K)[0])),dt){var Ze=W.implicit;W=Re.clone(),Ze&&"implicit"in Re&&(W.implicit=!0),W=W.transform(function(bt){return bt.isSymbolNode&&et(dt.placeholders,bt.name)?dt.placeholders[bt.name].clone():bt})}return te.repeat&&W!==X&&(W=xe(W,te,ae)),W}function ge(X,te){var ae=[],De,be,K=L(X);if(R(X,te))for(var W=0;W<X.args.length;W++)be=X.args.slice(0),be.splice(W,1),De=be.length===1?be[0]:K(be),ae.push(K([X.args[W],De]));else for(var ue=1;ue<X.args.length;ue++){var me=X.args[0];ue>1&&(me=K(X.args.slice(0,ue))),be=X.args.slice(ue),De=be.length===1?be[0]:K(be),ae.push(K([me,De]))}return ae}function ve(X,te){var ae={placeholders:{}};if(!X.placeholders&&!te.placeholders)return ae;if(X.placeholders){if(!te.placeholders)return X}else return te;for(var De in X.placeholders)if(et(X.placeholders,De)&&(ae.placeholders[De]=X.placeholders[De],et(te.placeholders,De)&&!ce(X.placeholders[De],te.placeholders[De])))return null;for(var be in te.placeholders)et(te.placeholders,be)&&(ae.placeholders[be]=te.placeholders[be]);return ae}function Ee(X,te){var ae=[];if(X.length===0||te.length===0)return ae;for(var De,be=0;be<X.length;be++)for(var K=0;K<te.length;K++)De=ve(X[be],te[K]),De&&ae.push(De);return ae}function q(X){if(X.length===0)return X;for(var te=X.reduce(Ee),ae=[],De={},be=0;be<te.length;be++){var K=JSON.stringify(te[be]);De[K]||(De[K]=!0,ae.push(te[be]))}return ae}function J(X,te,ae,De){var be=[{placeholders:{}}];if(X instanceof A&&te instanceof A||X instanceof w&&te instanceof w){if(X instanceof A){if(X.op!==te.op||X.fn!==te.fn)return[]}else if(X instanceof w&&X.name!==te.name)return[];if(te.args.length===1&&X.args.length===1||!F(te,ae)&&te.args.length===X.args.length||De){for(var K=[],W=0;W<X.args.length;W++){var ue=J(X.args[W],te.args[W],ae);if(ue.length===0)break;K.push(ue)}if(K.length!==X.args.length){if(!R(te,ae)||X.args.length===1)return[];if(X.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var me=J(X.args[0],te.args[1],ae);if(me.length===0)return[];var we=J(X.args[1],te.args[0],ae);if(we.length===0)return[];K=[me,we]}be=q(K)}else if(te.args.length>=2&&X.args.length===2){for(var _e=ge(te,ae),Ae=[],Ce=0;Ce<_e.length;Ce++){var Me=J(X,_e[Ce],ae,!0);Ae=Ae.concat(Me)}return Ae}else{if(X.args.length>2)throw Error("Unexpected non-binary associative function: "+X.toString());return[]}}else if(X instanceof N){if(X.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(Y[X.name]){if(X.name!==te.name)return[]}else switch(X.name[1]>="a"&&X.name[1]<="z"?X.name.substring(0,2):X.name[0]){case"n":case"_p":be[0].placeholders[X.name]=te;break;case"c":case"cl":if(Kt(te))be[0].placeholders[X.name]=te;else return[];break;case"v":if(!Kt(te))be[0].placeholders[X.name]=te;else return[];break;case"vl":if(en(te))be[0].placeholders[X.name]=te;else return[];break;case"cd":if(uk(te))be[0].placeholders[X.name]=te;else return[];break;case"vd":if(!uk(te))be[0].placeholders[X.name]=te;else return[];break;case"ce":if(Pg(te))be[0].placeholders[X.name]=te;else return[];break;case"ve":if(!Pg(te))be[0].placeholders[X.name]=te;else return[];break;default:throw new Error("Invalid symbol in rule: "+X.name)}}else if(X instanceof S){if(!c(X.value,te.value))return[]}else return[];return be}function ce(X,te){if(X instanceof S&&te instanceof S){if(!c(X.value,te.value))return!1}else if(X instanceof N&&te instanceof N){if(X.name!==te.name)return!1}else if(X instanceof A&&te instanceof A||X instanceof w&&te instanceof w){if(X instanceof A){if(X.op!==te.op||X.fn!==te.fn)return!1}else if(X instanceof w&&X.name!==te.name)return!1;if(X.args.length!==te.args.length)return!1;for(var ae=0;ae<X.args.length;ae++)if(!ce(X.args[ae],te.args[ae]))return!1}else return!1;return!0}return Z}),Lfe="simplifyConstant",Vfe=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],$g=Q(Lfe,Vfe,e=>{var{typed:t,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:d,ObjectNode:f,OperatorNode:p,SymbolNode:m}=e,{isCommutative:v,isAssociative:y,allChildren:b,createMakeNodeFunction:D}=Tw({FunctionNode:c,OperatorNode:p,SymbolNode:m}),x=t("simplifyConstant",{Node:P=>E(k(P,{})),"Node, Object":function(T,O){return E(k(T,O))}});function S(P){return Mo(P)?P.valueOf():P instanceof Array?P.map(S):ft(P)?i(S(P.valueOf())):P}function w(P,T,O){try{return n[P].apply(null,T)}catch{return T=T.map(S),_(n[P].apply(null,T),O)}}var C=t({Fraction:M,number:function(T){return T<0?N(new u(-T)):new u(T)},BigNumber:function(T){return T<0?N(new u(-T)):new u(T)},Complex:function(T){throw new Error("Cannot convert Complex number to Node")},string:function(T){return new u(T)},Matrix:function(T){return new l(T.valueOf().map(O=>C(O)))}});function E(P){return sr(P)?P:C(P)}function A(P,T){var O=T&&T.exactFractions!==!1;if(O&&isFinite(P)&&a){var L=a(P),I=T&&typeof T.fractionsLimit=="number"?T.fractionsLimit:1/0;if(L.valueOf()===P&&L.n<I&&L.d<I)return L}return P}var _=t({"string, Object":function(T,O){if(r.number==="BigNumber")return o===void 0&&gw(),o(T);if(r.number==="Fraction")return a===void 0&&mR(),a(T);var L=parseFloat(T);return A(L,O)},"Fraction, Object":function(T,O){return T},"BigNumber, Object":function(T,O){return T},"number, Object":function(T,O){return A(T,O)},"Complex, Object":function(T,O){return T.im!==0?T:A(T.re,O)},"Matrix, Object":function(T,O){return i(A(T.valueOf()))},"Array, Object":function(T,O){return T.map(A)}});function N(P){return new p("-","unaryMinus",[P])}function M(P){var T,O=P.s*P.n;return O<0?T=new p("-","unaryMinus",[new u(-O)]):T=new u(O),P.d===1?T:new p("/","divide",[T,new u(P.d)])}function R(P,T,O){if(!To(T))return new s(E(P),E(T));if(Yn(P)||ft(P)){for(var L=Array.from(T.dimensions);L.length>0;)if(Kt(L[0])&&typeof L[0].value!="string"){var I=_(L.shift().value,O);Yn(P)?P=P.items[I-1]:(P=P.valueOf()[I-1],P instanceof Array&&(P=i(P)))}else if(L.length>1&&Kt(L[1])&&typeof L[1].value!="string"){var V=_(L[1].value,O),H=[],Z=Yn(P)?P.items:P.valueOf();for(var G of Z)if(Yn(G))H.push(G.items[V-1]);else if(ft(P))H.push(G[V-1]);else break;if(H.length===Z.length)Yn(P)?P=new l(H):P=i(H),L.splice(1,1);else break}else break;return L.length===T.dimensions.length?new s(E(P),T):L.length>0?(T=new d(L),new s(E(P),T)):P}if(vl(P)&&T.dimensions.length===1&&Kt(T.dimensions[0])){var Y=T.dimensions[0].value;return Y in P.properties?P.properties[Y]:new u}return new s(E(P),T)}function F(P,T,O,L){var I=T.shift(),V=T.reduce((H,Z)=>{if(!sr(Z)){var G=H.pop();if(sr(G))return[G,Z];try{return H.push(w(P,[G,Z],L)),H}catch{H.push(G)}}H.push(E(H.pop()));var Y=H.length===1?H[0]:O(H);return[O([Y,E(Z)])]},[I]);return V.length===1?V[0]:O([V[0],C(V[1])])}function k(P,T){switch(P.type){case"SymbolNode":return P;case"ConstantNode":switch(typeof P.value){case"number":return _(P.value,T);case"string":return P.value;default:if(!isNaN(P.value))return _(P.value,T)}return P;case"FunctionNode":if(n[P.name]&&n[P.name].rawArgs)return P;{var O=["add","multiply"];if(O.indexOf(P.name)===-1){var L=P.args.map(xe=>k(xe,T));if(!L.some(sr))try{return w(P.name,L,T)}catch{}if(P.name==="size"&&L.length===1&&Yn(L[0])){for(var I=[],V=L[0];Yn(V);)I.push(V.items.length),V=V.items[0];return i(I)}return new c(P.name,L.map(E))}}case"OperatorNode":{var H=P.fn.toString(),Z,G,Y=D(P);if(Wr(P)&&P.isUnary())Z=[k(P.args[0],T)],sr(Z[0])?G=Y(Z):G=w(H,Z,T);else if(y(P,T.context))if(Z=b(P,T.context),Z=Z.map(xe=>k(xe,T)),v(H,T.context)){for(var re=[],ne=[],pe=0;pe<Z.length;pe++)sr(Z[pe])?ne.push(Z[pe]):re.push(Z[pe]);re.length>1?(G=F(H,re,Y,T),ne.unshift(G),G=F(H,ne,Y,T)):G=F(H,Z,Y,T)}else G=F(H,Z,Y,T);else Z=P.args.map(xe=>k(xe,T)),G=F(H,Z,Y,T);return G}case"ParenthesisNode":return k(P.content,T);case"AccessorNode":return R(k(P.object,T),k(P.index,T),T);case"ArrayNode":{var he=P.items.map(xe=>k(xe,T));return he.some(sr)?new l(he.map(E)):i(he)}case"IndexNode":return new d(P.dimensions.map(xe=>x(xe,T)));case"ObjectNode":{var le={};for(var fe in P.properties)le[fe]=x(P.properties[fe],T);return new f(le)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(P.type))}}return x}),dk="simplifyCore",qfe=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Bg=Q(dk,qfe,e=>{var{typed:t,parse:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,AccessorNode:c,ArrayNode:d,ConstantNode:f,FunctionNode:p,IndexNode:m,ObjectNode:v,OperatorNode:y,ParenthesisNode:b,SymbolNode:D}=e,x=new f(0),S=new f(1),w=new f(!0),C=new f(!1);function E(M){return Wr(M)&&["and","not","or"].includes(M.op)}var{hasProperty:A,isCommutative:_}=Tw({FunctionNode:p,OperatorNode:y,SymbolNode:D});function N(M){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},F=R?R.context:void 0;if(A(M,"trivial",F)){if(ya(M)&&M.args.length===1)return N(M.args[0],R);var k=!1,P=0;if(M.forEach(ne=>{++P,P===1&&(k=N(ne,R))}),P===1)return k}var T=M;if(ya(T)){var O=hoe(T.name);if(O){if(T.args.length>2&&A(T,"associative",F))for(;T.args.length>2;){var L=T.args.pop(),I=T.args.pop();T.args.push(new y(O,T.name,[L,I]))}T=new y(O,T.name,T.args)}else return new p(N(T.fn),T.args.map(ne=>N(ne,R)))}if(Wr(T)&&T.isUnary()){var V=N(T.args[0],R);if(T.op==="~"&&Wr(V)&&V.isUnary()&&V.op==="~"||T.op==="not"&&Wr(V)&&V.isUnary()&&V.op==="not"&&E(V.args[0]))return V.args[0];var H=!0;if(T.op==="-"&&Wr(V)&&(V.isBinary()&&V.fn==="subtract"&&(T=new y("-","subtract",[V.args[1],V.args[0]]),H=!1),V.isUnary()&&V.op==="-"))return V.args[0];if(H)return new y(T.op,T.fn,[V])}if(Wr(T)&&T.isBinary()){var Z=N(T.args[0],R),G=N(T.args[1],R);if(T.op==="+"){if(Kt(Z)&&i(Z.value))return G;if(Kt(G)&&i(G.value))return Z;Wr(G)&&G.isUnary()&&G.op==="-"&&(G=G.args[0],T=new y("-","subtract",[Z,G]))}if(T.op==="-")return Wr(G)&&G.isUnary()&&G.op==="-"?N(new y("+","add",[Z,G.args[0]]),R):Kt(Z)&&i(Z.value)?N(new y("-","unaryMinus",[G])):Kt(G)&&i(G.value)?Z:new y(T.op,T.fn,[Z,G]);if(T.op==="*"){if(Kt(Z)){if(i(Z.value))return x;if(n(Z.value,1))return G}if(Kt(G)){if(i(G.value))return x;if(n(G.value,1))return Z;if(_(T,F))return new y(T.op,T.fn,[G,Z],T.implicit)}return new y(T.op,T.fn,[Z,G],T.implicit)}if(T.op==="/")return Kt(Z)&&i(Z.value)?x:Kt(G)&&n(G.value,1)?Z:new y(T.op,T.fn,[Z,G]);if(T.op==="^"&&Kt(G)){if(i(G.value))return S;if(n(G.value,1))return Z}if(T.op==="and"){if(Kt(Z))if(Z.value){if(E(G))return G}else return C;if(Kt(G))if(G.value){if(E(Z))return Z}else return C}if(T.op==="or"){if(Kt(Z)){if(Z.value)return w;if(E(G))return G}if(Kt(G)){if(G.value)return w;if(E(Z))return Z}}return new y(T.op,T.fn,[Z,G])}if(Wr(T))return new y(T.op,T.fn,T.args.map(ne=>N(ne,R)));if(Yn(T))return new d(T.items.map(ne=>N(ne,R)));if(Ka(T))return new c(N(T.object,R),N(T.index,R));if(To(T))return new m(T.dimensions.map(ne=>N(ne,R)));if(vl(T)){var Y={};for(var re in T.properties)Y[re]=N(T.properties[re],R);return new v(Y)}return T}return t(dk,{Node:N,"Node,Object":N})}),Gfe="resolve",Ufe=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],zg=Q(Gfe,Ufe,e=>{var{typed:t,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(l,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!u)return l;if(en(l)){if(c.has(l.name)){var d=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(d,"}"))}var f=u.get(l.name);if(sr(f)){var p=new Set(c);return p.add(l.name),s(f,u,p)}else return typeof f=="number"?r(String(f)):f!==void 0?new n(f):l}else if(Wr(l)){var m=l.args.map(function(y){return s(y,u,c)});return new a(l.op,l.fn,m,l.implicit)}else{if(zi(l))return new o(s(l.content,u,c));if(ya(l)){var v=l.args.map(function(y){return s(y,u,c)});return new i(l.name,v)}}return l.map(y=>s(y,u,c))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(l,u)=>s(l,Dl(u)),"Array | Matrix":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array | Matrix, null | undefined":t.referToSelf(l=>u=>u.map(c=>l(c))),"Array, Object":t.referTo("Array,Map",l=>(u,c)=>l(u,Dl(c))),"Matrix, Object":t.referTo("Matrix,Map",l=>(u,c)=>l(u,Dl(c))),"Array | Matrix, Map":t.referToSelf(l=>(u,c)=>u.map(d=>l(d,c)))})}),fk="symbolicEqual",Wfe=["parse","simplify","typed","OperatorNode"],Lg=Q(fk,Wfe,e=>{var{parse:t,simplify:r,typed:n,OperatorNode:i}=e;function a(o,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=new i("-","subtract",[o,s]),c=r(u,{},l);return Kt(c)&&!c.value}return n(fk,{"Node, Node":a,"Node, Node, Object":a})}),pk="derivative",Hfe=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Vg=Q(pk,Hfe,e=>{var{typed:t,config:r,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:l,FunctionNode:u,OperatorNode:c,ParenthesisNode:d,SymbolNode:f}=e;function p(S,w){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},E={};y(E,S,w.name);var A=b(S,E);return C.simplify?i(A):A}t.addConversion({from:"identifier",to:"SymbolNode",convert:n});var m=t(pk,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p});t.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),m._simplify=!0,m.toTex=function(S){return v.apply(null,S.args)};var v=t("_derivTex",{"Node, SymbolNode":function(w,C){return Kt(w)&&Or(w.value)==="string"?v(n(w.value).toString(),C.toString(),1):v(w.toTex(),C.toString(),1)},"Node, ConstantNode":function(w,C){if(Or(C.value)==="string")return v(w,n(C.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(w,C,E){return v(w.toString(),C.name,E.value)},"string, string, number":function(w,C,E){var A;return E===1?A="{d\\over d"+C+"}":A="{d^{"+E+"}\\over d"+C+"^{"+E+"}}",A+"\\left[".concat(w,"\\right]")}}),y=t("constTag",{"Object, ConstantNode, string":function(w,C){return w[C]=!0,!0},"Object, SymbolNode, string":function(w,C,E){return C.name!==E?(w[C]=!0,!0):!1},"Object, ParenthesisNode, string":function(w,C,E){return y(w,C.content,E)},"Object, FunctionAssignmentNode, string":function(w,C,E){return C.params.indexOf(E)===-1?(w[C]=!0,!0):y(w,C.expr,E)},"Object, FunctionNode | OperatorNode, string":function(w,C,E){if(C.args.length>0){for(var A=y(w,C.args[0],E),_=1;_<C.args.length;++_)A=y(w,C.args[_],E)&&A;if(A)return w[C]=!0,!0}return!1}}),b=t("_derivative",{"ConstantNode, Object":function(w){return x(0)},"SymbolNode, Object":function(w,C){return C[w]!==void 0?x(0):x(1)},"ParenthesisNode, Object":function(w,C){return new d(b(w.content,C))},"FunctionAssignmentNode, Object":function(w,C){return C[w]!==void 0?x(0):b(w.expr,C)},"FunctionNode, Object":function(w,C){if(w.args.length!==1&&D(w),C[w]!==void 0)return x(0);var E=w.args[0],A,_=!1,N=!1,M;switch(w.name){case"cbrt":_=!0,M=new c("*","multiply",[x(3),new c("^","pow",[E,new c("/","divide",[x(2),x(3)])])]);break;case"sqrt":case"nthRoot":if(w.args.length===1)_=!0,M=new c("*","multiply",[x(2),new u("sqrt",[E])]);else if(w.args.length===2)return A=new c("/","divide",[x(1),w.args[1]]),C[A]=C[w.args[1]],b(new c("^","pow",[E,A]),C);break;case"log10":A=x(10);case"log":if(!A&&w.args.length===1)M=E.clone(),_=!0;else if(w.args.length===1&&A||w.args.length===2&&C[w.args[1]]!==void 0)M=new c("*","multiply",[E.clone(),new u("log",[A||w.args[1]])]),_=!0;else if(w.args.length===2)return b(new c("/","divide",[new u("log",[E]),new u("log",[w.args[1]])]),C);break;case"pow":return C[A]=C[w.args[1]],b(new c("^","pow",[E,w.args[1]]),C);case"exp":M=new u("exp",[E.clone()]);break;case"sin":M=new u("cos",[E.clone()]);break;case"cos":M=new c("-","unaryMinus",[new u("sin",[E.clone()])]);break;case"tan":M=new c("^","pow",[new u("sec",[E.clone()]),x(2)]);break;case"sec":M=new c("*","multiply",[w,new u("tan",[E.clone()])]);break;case"csc":N=!0,M=new c("*","multiply",[w,new u("cot",[E.clone()])]);break;case"cot":N=!0,M=new c("^","pow",[new u("csc",[E.clone()]),x(2)]);break;case"asin":_=!0,M=new u("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])])]);break;case"acos":_=!0,N=!0,M=new u("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])])]);break;case"atan":_=!0,M=new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)]);break;case"asec":_=!0,M=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),x(2)]),x(1)])])]);break;case"acsc":_=!0,N=!0,M=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),x(2)]),x(1)])])]);break;case"acot":_=!0,N=!0,M=new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)]);break;case"sinh":M=new u("cosh",[E.clone()]);break;case"cosh":M=new u("sinh",[E.clone()]);break;case"tanh":M=new c("^","pow",[new u("sech",[E.clone()]),x(2)]);break;case"sech":N=!0,M=new c("*","multiply",[w,new u("tanh",[E.clone()])]);break;case"csch":N=!0,M=new c("*","multiply",[w,new u("coth",[E.clone()])]);break;case"coth":N=!0,M=new c("^","pow",[new u("csch",[E.clone()]),x(2)]);break;case"asinh":_=!0,M=new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)])]);break;case"acosh":_=!0,M=new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),x(2)]),x(1)])]);break;case"atanh":_=!0,M=new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])]);break;case"asech":_=!0,N=!0,M=new c("*","multiply",[E.clone(),new u("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])])])]);break;case"acsch":_=!0,N=!0,M=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),x(2)]),x(1)])])]);break;case"acoth":_=!0,N=!0,M=new c("-","subtract",[x(1),new c("^","pow",[E.clone(),x(2)])]);break;case"abs":M=new c("/","divide",[new u(new f("abs"),[E.clone()]),E.clone()]);break;case"gamma":default:throw new Error('Function "'+w.name+'" is not supported by derivative, or a wrong number of arguments is passed')}var R,F;_?(R="/",F="divide"):(R="*",F="multiply");var k=b(E,C);return N&&(k=new c("-","unaryMinus",[k])),new c(R,F,[k,M])},"OperatorNode, Object":function(w,C){if(C[w]!==void 0)return x(0);if(w.op==="+")return new c(w.op,w.fn,w.args.map(function(T){return b(T,C)}));if(w.op==="-"){if(w.isUnary())return new c(w.op,w.fn,[b(w.args[0],C)]);if(w.isBinary())return new c(w.op,w.fn,[b(w.args[0],C),b(w.args[1],C)])}if(w.op==="*"){var E=w.args.filter(function(T){return C[T]!==void 0});if(E.length>0){var A=w.args.filter(function(T){return C[T]===void 0}),_=A.length===1?A[0]:new c("*","multiply",A),N=E.concat(b(_,C));return new c("*","multiply",N)}return new c("+","add",w.args.map(function(T){return new c("*","multiply",w.args.map(function(O){return O===T?b(O,C):O.clone()}))}))}if(w.op==="/"&&w.isBinary()){var M=w.args[0],R=w.args[1];return C[R]!==void 0?new c("/","divide",[b(M,C),R]):C[M]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[M]),new c("/","divide",[b(R,C),new c("^","pow",[R.clone(),x(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[b(M,C),R.clone()]),new c("*","multiply",[M.clone(),b(R,C)])]),new c("^","pow",[R.clone(),x(2)])])}if(w.op==="^"&&w.isBinary()){var F=w.args[0],k=w.args[1];if(C[F]!==void 0)return Kt(F)&&(o(F.value)||a(F.value,1))?x(0):new c("*","multiply",[w,new c("*","multiply",[new u("log",[F.clone()]),b(k.clone(),C)])]);if(C[k]!==void 0){if(Kt(k)){if(o(k.value))return x(0);if(a(k.value,1))return b(F,C)}var P=new c("^","pow",[F.clone(),new c("-","subtract",[k,x(1)])]);return new c("*","multiply",[k.clone(),new c("*","multiply",[b(F,C),P])])}return new c("*","multiply",[new c("^","pow",[F.clone(),k.clone()]),new c("+","add",[new c("*","multiply",[b(F,C),new c("/","divide",[k.clone(),F.clone()])]),new c("*","multiply",[b(k,C),new u("log",[F.clone()])])])])}throw new Error('Operator "'+w.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function D(S){if(!((S.name==="log"||S.name==="nthRoot"||S.name==="pow")&&S.args.length===2)){for(var w=0;w<S.args.length;++w)S.args[w]=x(0);throw S.compile().evaluate(),new Error("Expected TypeError, but none found")}}function x(S,w){return new l(s(S,w||r.number))}return m}),hk="rationalize",jfe=["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"],qg=Q(hk,jfe,e=>{var{config:t,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,parse:c,simplifyConstant:d,simplifyCore:f,simplify:p,fraction:m,bignumber:v,mathWithTransform:y,matrix:b,AccessorNode:D,ArrayNode:x,ConstantNode:S,FunctionNode:w,IndexNode:C,ObjectNode:E,OperatorNode:A,SymbolNode:_,ParenthesisNode:N}=e;function M(T){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,I=F(),V=R(T,O,!0,I.firstRules),H=V.variables.length,Z={exactFractions:!1},G={exactFractions:!0};if(T=V.expression,H>=1){T=k(T);var Y,re,ne=!0,pe=!1;T=p(T,I.firstRules,{},Z);for(var he;re=ne?I.distrDivRules:I.sucDivRules,T=p(T,re,{},G),ne=!ne,he=T.toString(),he!==Y;)pe=!0,Y=he;pe&&(T=p(T,I.firstRulesAgain,{},Z)),T=p(T,I.finalRules,{},Z)}var le=[],fe={};return T.type==="OperatorNode"&&T.isBinary()&&T.op==="/"?(H===1&&(T.args[0]=P(T.args[0],le),T.args[1]=P(T.args[1])),L&&(fe.numerator=T.args[0],fe.denominator=T.args[1])):(H===1&&(T=P(T,le)),L&&(fe.numerator=T,fe.denominator=null)),L?(fe.coefficients=le,fe.variables=V.variables,fe.expression=T,fe):T}return r(hk,{Node:M,"Node, boolean":(T,O)=>M(T,{},O),"Node, Object":M,"Node, Object, boolean":M});function R(T,O,L,I){var V=[],H=p(T,I,O,{exactFractions:!1});L=!!L;var Z="+-*"+(L?"/":"");Y(H);var G={};return G.expression=H,G.variables=V,G;function Y(re){var ne=re.type;if(ne==="FunctionNode")throw new Error("There is an unsolved function call");if(ne==="OperatorNode")if(re.op==="^"){if(re.args[1].type!=="ConstantNode"||!ot(parseFloat(re.args[1].value)))throw new Error("There is a non-integer exponent");Y(re.args[0])}else{if(Z.indexOf(re.op)===-1)throw new Error("Operator "+re.op+" invalid in polynomial expression");for(var pe=0;pe<re.args.length;pe++)Y(re.args[pe])}else if(ne==="SymbolNode"){var he=re.name,le=V.indexOf(he);le===-1&&V.push(he)}else if(ne==="ParenthesisNode")Y(re.content);else if(ne!=="ConstantNode")throw new Error("type "+ne+" is not allowed in polynomial expression")}}function F(){var T=[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"}],O=[{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)"}],L=[{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)"}],I=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],V={};return V.firstRules=T.concat(O,I),V.distrDivRules=L,V.sucDivRules=I,V.firstRulesAgain=T.concat(O),V.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))"}],V}function k(T,O,L){var I=T.type,V=arguments.length>1;if(I==="OperatorNode"&&T.isBinary()){var H=!1,Z;if(T.op==="^"&&(T.args[0].type==="ParenthesisNode"||T.args[0].type==="OperatorNode")&&T.args[1].type==="ConstantNode"&&(Z=parseFloat(T.args[1].value),H=Z>=2&&ot(Z)),H){if(Z>2){var G=T.args[0],Y=new A("^","pow",[T.args[0].cloneDeep(),new S(Z-1)]);T=new A("*","multiply",[G,Y])}else T=new A("*","multiply",[T.args[0],T.args[0].cloneDeep()]);V&&(L==="content"?O.content=T:O.args[L]=T)}}if(I==="ParenthesisNode")k(T.content,T,"content");else if(I!=="ConstantNode"&&I!=="SymbolNode")for(var re=0;re<T.args.length;re++)k(T.args[re],T,re);if(!V)return T}function P(T,O){O===void 0&&(O=[]),O[0]=0;var L={};L.cte=1,L.oper="+",L.fire="";var I=0,V="";he(T,null,L),I=O.length-1;for(var H=!0,Z,G=I;G>=0;G--)if(O[G]!==0){var Y=new S(H?O[G]:Math.abs(O[G])),re=O[G]<0?"-":"+";if(G>0){var ne=new _(V);if(G>1){var pe=new S(G);ne=new A("^","pow",[ne,pe])}O[G]===-1&&H?Y=new A("-","unaryMinus",[ne]):Math.abs(O[G])===1?Y=ne:Y=new A("*","multiply",[Y,ne])}H?Z=Y:re==="+"?Z=new A("+","add",[Z,Y]):Z=new A("-","subtract",[Z,Y]),H=!1}if(H)return new S(0);return Z;function he(le,fe,xe){var ge=le.type;if(ge==="FunctionNode")throw new Error("There is an unsolved function call");if(ge==="OperatorNode"){if("+-*^".indexOf(le.op)===-1)throw new Error("Operator "+le.op+" invalid");if(fe!==null){if((le.fn==="unaryMinus"||le.fn==="pow")&&fe.fn!=="add"&&fe.fn!=="subtract"&&fe.fn!=="multiply")throw new Error("Invalid "+le.op+" placing");if((le.fn==="subtract"||le.fn==="add"||le.fn==="multiply")&&fe.fn!=="add"&&fe.fn!=="subtract")throw new Error("Invalid "+le.op+" placing");if((le.fn==="subtract"||le.fn==="add"||le.fn==="unaryMinus")&&xe.noFil!==0)throw new Error("Invalid "+le.op+" placing")}(le.op==="^"||le.op==="*")&&(xe.fire=le.op);for(var ve=0;ve<le.args.length;ve++)le.fn==="unaryMinus"&&(xe.oper="-"),(le.op==="+"||le.fn==="subtract")&&(xe.fire="",xe.cte=1,xe.oper=ve===0?"+":le.op),xe.noFil=ve,he(le.args[ve],le,xe)}else if(ge==="SymbolNode"){if(le.name!==V&&V!=="")throw new Error("There is more than one variable");if(V=le.name,fe===null){O[1]=1;return}if(fe.op==="^"&&xe.noFil!==0)throw new Error("In power the variable should be the first parameter");if(fe.op==="*"&&xe.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(xe.fire===""||xe.fire==="*")&&(I<1&&(O[1]=0),O[1]+=xe.cte*(xe.oper==="+"?1:-1),I=Math.max(1,I))}else if(ge==="ConstantNode"){var Ee=parseFloat(le.value);if(fe===null){O[0]=Ee;return}if(fe.op==="^"){if(xe.noFil!==1)throw new Error("Constant cannot be powered");if(!ot(Ee)||Ee<=0)throw new Error("Non-integer exponent is not allowed");for(var q=I+1;q<Ee;q++)O[q]=0;Ee>I&&(O[Ee]=0),O[Ee]+=xe.cte*(xe.oper==="+"?1:-1),I=Math.max(Ee,I);return}xe.cte=Ee,xe.fire===""&&(O[0]+=xe.cte*(xe.oper==="+"?1:-1))}else throw new Error("Type "+ge+" is not allowed")}}}),Kfe="reviver",Yfe=["classes"],Gg=Q(Kfe,Yfe,e=>{var{classes:t}=e;return function(n,i){var a=t[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}}),Xfe="replacer",Zfe=[],Ug=Q(Xfe,Zfe,()=>function(t,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r}),Qfe="11.7.0",Wg=Q("true",[],()=>!0),Hg=Q("false",[],()=>!1),jg=Q("null",[],()=>null),Kg=ai("Infinity",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1/0):1/0}),Yg=ai("NaN",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(NaN):NaN}),Xg=ai("pi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?xw(r):ote}),Zg=ai("tau",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?fae(r):ste}),Qg=ai("e",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?cae(r):lte}),Jg=ai("phi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?dae(r):ute}),e0=ai("LN2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).ln():Math.LN2}),t0=ai("LN10",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(10).ln():Math.LN10}),r0=ai("LOG2E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),n0=ai("LOG10E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),i0=ai("SQRT1_2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),a0=ai("SQRT2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return t.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),o0=ai("i",["Complex"],e=>{var{Complex:t}=e;return t.I}),Ow=Q("PI",["pi"],e=>{var{pi:t}=e;return t}),Rw=Q("E",["e"],e=>{var{e:t}=e;return t}),s0=Q("version",[],()=>Qfe);function ai(e,t,r){return Q(e,t,r,{recreateOnConfigChange:!0})}var l0=At("speedOfLight","299792458","m s^-1"),u0=At("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),c0=At("planckConstant","6.62607015e-34","J s"),d0=At("reducedPlanckConstant","1.0545718176461565e-34","J s"),f0=At("magneticConstant","1.25663706212e-6","N A^-2"),p0=At("electricConstant","8.8541878128e-12","F m^-1"),h0=At("vacuumImpedance","376.730313667","ohm"),m0=At("coulomb","8.987551792261171e9","N m^2 C^-2"),v0=At("elementaryCharge","1.602176634e-19","C"),g0=At("bohrMagneton","9.2740100783e-24","J T^-1"),y0=At("conductanceQuantum","7.748091729863649e-5","S"),b0=At("inverseConductanceQuantum","12906.403729652257","ohm"),x0=At("magneticFluxQuantum","2.0678338484619295e-15","Wb"),w0=At("nuclearMagneton","5.0507837461e-27","J T^-1"),C0=At("klitzing","25812.807459304513","ohm"),S0=At("bohrRadius","5.29177210903e-11","m"),D0=At("classicalElectronRadius","2.8179403262e-15","m"),E0=At("electronMass","9.1093837015e-31","kg"),N0=At("fermiCoupling","1.1663787e-5","GeV^-2"),A0=iy("fineStructure",.0072973525693),_0=At("hartreeEnergy","4.3597447222071e-18","J"),M0=At("protonMass","1.67262192369e-27","kg"),T0=At("deuteronMass","3.3435830926e-27","kg"),O0=At("neutronMass","1.6749271613e-27","kg"),R0=At("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),I0=At("rydberg","10973731.568160","m^-1"),k0=At("thomsonCrossSection","6.6524587321e-29","m^2"),P0=iy("weakMixingAngle",.2229),F0=iy("efimovFactor",22.7),$0=At("atomicMass","1.66053906660e-27","kg"),B0=At("avogadro","6.02214076e23","mol^-1"),z0=At("boltzmann","1.380649e-23","J K^-1"),L0=At("faraday","96485.33212331001","C mol^-1"),V0=At("firstRadiation","3.7417718521927573e-16","W m^2"),q0=At("loschmidt","2.686780111798444e25","m^-3"),G0=At("gasConstant","8.31446261815324","J K^-1 mol^-1"),U0=At("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),W0=At("molarVolume","0.022413969545014137","m^3 mol^-1"),H0=iy("sackurTetrode",-1.16487052358),j0=At("secondRadiation","0.014387768775039337","m K"),K0=At("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Y0=At("wienDisplacement","2.897771955e-3","m K"),X0=At("molarMass","0.99999999965e-3","kg mol^-1"),Z0=At("molarMassC12","11.9999999958e-3","kg mol^-1"),Q0=At("gravity","9.80665","m s^-2"),J0=At("planckLength","1.616255e-35","m"),ey=At("planckMass","2.176435e-8","kg"),ty=At("planckTime","5.391245e-44","s"),ry=At("planckCharge","1.87554603778e-18","C"),ny=At("planckTemperature","1.416785e+32","K");function At(e,t,r){var n=["config","Unit","BigNumber"];return Q(e,n,i=>{var{config:a,Unit:o,BigNumber:s}=i,l=a.number==="BigNumber"?new s(t):parseFloat(t),u=new o(l,r);return u.fixPrefix=!0,u})}function iy(e,t){var r=["config","BigNumber"];return Q(e,r,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(t):t})}var Jfe="apply",epe=["typed","isInteger"],ay=Q(Jfe,epe,e=>{var{typed:t,isInteger:r}=e,n=Ju({typed:t,isInteger:r});return t("apply",{"...any":function(a){var o=a[1];Ut(o)?a[1]=o-1:kt(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw Gn(s)}}})},{isTransformFunction:!0}),tpe="column",rpe=["typed","Index","matrix","range"],oy=Q(tpe,rpe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=rc({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(s){var l=s.length-1,u=s[l];Ut(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Gn(c)}}})},{isTransformFunction:!0});function Iw(e,t,r){var n=e.filter(function(s){return en(s)&&!(s.name in t)&&!r.has(s.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=fc(r),o=e.compile();return function(l){return a.set(i,l),o.evaluate(a)}}var npe="filter",ipe=["typed"],sy=Q(npe,ipe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(en(i[1])||hs(i[1])?l=i[1].compile().evaluate(o):l=Iw(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("filter",{"Array, function":mk,"Matrix, function":function(a,o){return a.create(mk(a.toArray(),o))},"Array, RegExp":Cf,"Matrix, RegExp":function(a,o){return a.create(Cf(a.toArray(),o))}});return r},{isTransformFunction:!0});function mk(e,t){var r=$o(t);return kM(e,function(n,i,a){return r===1?t(n):r===2?t(n,[i+1]):t(n,[i+1],a)})}var ape="forEach",ope=["typed"],ly=Q(ape,ope,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(en(i[1])||hs(i[1])?l=i[1].compile().evaluate(o):l=Iw(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("forEach",{"Array | Matrix, function":function(a,o){var s=$o(o),l=function u(c,d){Array.isArray(c)?wf(c,function(f,p){u(f,d.concat(p+1))}):s===1?o(c):s===2?o(c,d):o(c,d,a)};l(a.valueOf(),[])}});return r},{isTransformFunction:!0}),spe="index",lpe=["Index"],uy=Q(spe,lpe,e=>{var{Index:t}=e;return function(){for(var n=[],i=0,a=arguments.length;i<a;i++){var o=arguments[i];if(Uu(o))o.start--,o.end-=o.step>0?0:2;else if(o&&o.isSet===!0)o=o.map(function(l){return l-1});else if(or(o)||ft(o))o=o.map(function(l){return l-1});else if(Ut(o))o--;else if(kt(o))o=o.toNumber()-1;else if(typeof o!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");n[i]=o}var s=new t;return t.apply(s,n),s}},{isTransformFunction:!0}),upe="map",cpe=["typed"],cy=Q(upe,cpe,e=>{var{typed:t}=e;function r(i,a,o){var s,l;return i[0]&&(s=i[0].compile().evaluate(o)),i[1]&&(en(i[1])||hs(i[1])?l=i[1].compile().evaluate(o):l=Iw(i[1],a,o)),n(s,l)}r.rawArgs=!0;var n=t("map",{"Array, function":function(a,o){return vk(a,o,a)},"Matrix, function":function(a,o){return a.create(vk(a.valueOf(),o,a))}});return r},{isTransformFunction:!0});function vk(e,t,r){var n=$o(t);function i(a,o){return Array.isArray(a)?Ya(a,function(s,l){return i(s,o.concat(l+1))}):n===1?t(a):n===2?t(a,o):t(a,o,r)}return i(e,[])}function bs(e){if(e.length===2&&xi(e[0])){e=e.slice();var t=e[1];Ut(t)?e[1]=t-1:kt(t)&&(e[1]=t.minus(1))}return e}var dpe="max",fpe=["typed","config","numeric","larger"],dy=Q(dpe,fpe,e=>{var{typed:t,config:r,numeric:n,larger:i}=e,a=lc({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),ppe="mean",hpe=["typed","add","divide"],fy=Q(ppe,hpe,e=>{var{typed:t,add:r,divide:n}=e,i=mc({typed:t,add:r,divide:n});return t("mean",{"...any":function(o){o=bs(o);try{return i.apply(null,o)}catch(s){throw Gn(s)}}})},{isTransformFunction:!0}),mpe="min",vpe=["typed","config","numeric","smaller"],py=Q(mpe,vpe,e=>{var{typed:t,config:r,numeric:n,smaller:i}=e,a=uc({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),gpe="range",ype=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],hy=Q(gpe,ype,e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l}=e,u=ic({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l});return t("range",{"...any":function(d){var f=d.length-1,p=d[f];return typeof p!="boolean"&&d.push(!0),u.apply(null,d)}})},{isTransformFunction:!0}),bpe="row",xpe=["typed","Index","matrix","range"],my=Q(bpe,xpe,e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=ac({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(s){var l=s.length-1,u=s[l];Ut(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Gn(c)}}})},{isTransformFunction:!0}),wpe="subset",Cpe=["typed","matrix"],vy=Q(wpe,Cpe,e=>{var{typed:t,matrix:r}=e,n=oc({typed:t,matrix:r});return t("subset",{"...any":function(a){try{return n.apply(null,a)}catch(o){throw Gn(o)}}})},{isTransformFunction:!0}),Spe="concat",Dpe=["typed","matrix","isInteger"],gy=Q(Spe,Dpe,e=>{var{typed:t,matrix:r,isInteger:n}=e,i=tc({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(o){var s=o.length-1,l=o[s];Ut(l)?o[s]=l-1:kt(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw Gn(u)}}})},{isTransformFunction:!0}),gk="diff",Epe=["typed","matrix","subtract","number","bignumber"],yy=Q(gk,Epe,e=>{var{typed:t,matrix:r,subtract:n,number:i,bignumber:a}=e,o=nc({typed:t,matrix:r,subtract:n,number:i,bignumber:a});return t(gk,{"...any":function(l){l=bs(l);try{return o.apply(null,l)}catch(u){throw Gn(u)}}})},{isTransformFunction:!0}),Npe="std",Ape=["typed","map","sqrt","variance"],by=Q(Npe,Ape,e=>{var{typed:t,map:r,sqrt:n,variance:i}=e,a=gc({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),yk="sum",_pe=["typed","config","add","numeric"],xy=Q(yk,_pe,e=>{var{typed:t,config:r,add:n,numeric:i}=e,a=pc({typed:t,config:r,add:n,numeric:i});return t(yk,{"...any":function(s){s=bs(s);try{return a.apply(null,s)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),bk="cumsum",Mpe=["typed","add","unaryPlus"],wy=Q(bk,Mpe,e=>{var{typed:t,add:r,unaryPlus:n}=e,i=hc({typed:t,add:r,unaryPlus:n});return t(bk,{"...any":function(o){if(o.length===2&&xi(o[0])){var s=o[1];Ut(s)?o[1]=s-1:kt(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw Gn(l)}}})},{isTransformFunction:!0}),xk="variance",Tpe=["typed","add","subtract","multiply","divide","apply","isNaN"],Cy=Q(xk,Tpe,e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e,l=vc({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return t(xk,{"...any":function(c){c=bs(c);try{return l.apply(null,c)}catch(d){throw Gn(d)}}})},{isTransformFunction:!0});const Ope=Object.freeze(Object.defineProperty({__proto__:null,createTyped:Df,createResultSet:Nf,createBigNumberClass:kf,createComplexClass:Pf,createFractionClass:Ff,createRangeClass:$f,createMatrixClass:Bf,createDenseMatrixClass:zf,createClone:Lf,createIsInteger:Gf,createIsNegative:jf,createIsNumeric:Kf,createHasNumericValue:Yf,createIsPositive:Xf,createIsZero:Zf,createIsNaN:Qf,createTypeOf:Jf,createEqualScalar:tp,createSparseMatrixClass:rp,createNumber:np,createString:ip,createBoolean:ap,createBignumber:op,createComplex:sp,createFraction:lp,createMatrix:up,createMatrixFromFunction:cp,createMatrixFromRows:dp,createMatrixFromColumns:fp,createSplitUnit:pp,createUnaryMinus:hp,createUnaryPlus:mp,createAbs:vp,createApply:Ju,createAddScalar:yp,createCbrt:bp,createCeil:xp,createCube:wp,createExp:Cp,createExpm1:Sp,createFix:Dp,createFloor:Ep,createGcd:Np,createLcm:_p,createLog10:Mp,createLog2:Tp,createMod:Rp,createMultiplyScalar:Ip,createMultiply:kp,createNthRoot:Pp,createSign:Fp,createSqrt:$p,createSquare:Bp,createSubtract:zp,createXgcd:Lp,createInvmod:Vp,createDotMultiply:qp,createBitAnd:Up,createBitNot:Wp,createBitOr:Hp,createBitXor:jp,createArg:Kp,createConj:Yp,createIm:Xp,createRe:Zp,createNot:Qp,createOr:Jp,createXor:eh,createConcat:tc,createColumn:rc,createCount:th,createCross:rh,createDiag:nh,createFilter:ih,createFlatten:ah,createForEach:oh,createGetMatrixDataType:sh,createIdentity:lh,createKron:uh,createMap:ch,createDiff:nc,createOnes:dh,createRange:ic,createReshape:fh,createResize:ph,createRotate:hh,createRotationMatrix:mh,createRow:ac,createSize:vh,createSqueeze:gh,createSubset:oc,createTranspose:yh,createCtranspose:bh,createZeros:xh,createFft:wh,createIfft:Ch,createErf:Sh,createMode:Dh,createProd:Eh,createFormat:Nh,createBin:Ah,createOct:_h,createHex:Mh,createPrint:Th,createTo:Oh,createIsPrime:Rh,createNumeric:Ih,createDivideScalar:kh,createPow:Ph,createRound:Fh,createLog:$h,createLog1p:Bh,createNthRoots:zh,createDotPow:Lh,createDotDivide:Vh,createLsolve:qh,createUsolve:Gh,createLsolveAll:Uh,createUsolveAll:Wh,createLeftShift:Hh,createRightArithShift:jh,createRightLogShift:Kh,createAnd:Yh,createCompare:Zh,createCompareNatural:Qh,createCompareText:Jh,createEqual:tm,createEqualText:rm,createSmaller:im,createSmallerEq:om,createLarger:lm,createLargerEq:cm,createDeepEqual:dm,createUnequal:pm,createPartitionSelect:hm,createSort:mm,createMax:lc,createMin:uc,createImmutableDenseMatrixClass:vm,createIndexClass:gm,createFibonacciHeapClass:ym,createSpaClass:bm,createUnitClass:wm,createUnitFunction:Cm,createSparse:Sm,createCreateUnit:Dm,createAcos:Em,createAcosh:Nm,createAcot:Am,createAcoth:_m,createAcsc:Mm,createAcsch:Tm,createAsec:Om,createAsech:Rm,createAsin:Im,createAsinh:km,createAtan:Pm,createAtan2:Fm,createAtanh:$m,createCos:Bm,createCosh:zm,createCot:Lm,createCoth:Vm,createCsc:qm,createCsch:Gm,createSec:Um,createSech:Wm,createSin:Hm,createSinh:jm,createTan:Km,createTanh:Ym,createSetCartesian:Xm,createSetDifference:Zm,createSetDistinct:Qm,createSetIntersect:Jm,createSetIsSubset:ev,createSetMultiplicity:tv,createSetPowerset:rv,createSetSize:nv,createSetSymDifference:iv,createSetUnion:av,createAdd:ov,createHypot:sv,createNorm:lv,createDot:uv,createTrace:cv,createIndex:dv,createNode:fv,createAccessorNode:hv,createArrayNode:vv,createAssignmentNode:bv,createBlockNode:wv,createConditionalNode:Sv,createConstantNode:Ev,createFunctionAssignmentNode:Av,createIndexNode:Mv,createObjectNode:Ov,createOperatorNode:Iv,createParenthesisNode:Pv,createRangeNode:$v,createRelationalNode:zv,createSymbolNode:Lv,createFunctionNode:qv,createParse:Gv,createCompile:Uv,createEvaluate:Wv,createParserClass:Hv,createParser:jv,createLup:Kv,createQr:Yv,createSlu:Xv,createLusolve:Zv,createPolynomialRoot:Qv,createHelpClass:Jv,createChainClass:eg,createHelp:tg,createChain:rg,createDet:ng,createInv:ig,createPinv:ag,createEigs:og,createExpm:sg,createSqrtm:lg,createSylvester:ug,createSchur:cg,createLyap:dg,createDivide:fg,createDistance:pg,createIntersect:hg,createSum:pc,createCumSum:hc,createMean:mc,createMedian:vg,createMad:gg,createVariance:vc,createQuantileSeq:yg,createStd:gc,createCombinations:bg,createCombinationsWithRep:xg,createGamma:wg,createLgamma:Cg,createFactorial:Sg,createKldivergence:Dg,createMultinomial:Eg,createPermutations:Ng,createPickRandom:Ag,createRandom:_g,createRandomInt:Mg,createStirlingS2:Tg,createBellNumbers:Og,createCatalan:Rg,createComposition:Ig,createLeafCount:kg,createSimplify:Fg,createSimplifyConstant:$g,createSimplifyCore:Bg,createResolve:zg,createSymbolicEqual:Lg,createDerivative:Vg,createRationalize:qg,createReviver:Gg,createReplacer:Ug,createE:Qg,createUppercaseE:Rw,createFalse:Hg,createI:o0,createInfinity:Kg,createLN10:t0,createLN2:e0,createLOG10E:n0,createLOG2E:r0,createNaN:Yg,createNull:jg,createPhi:Jg,createPi:Xg,createUppercasePi:Ow,createSQRT1_2:i0,createSQRT2:a0,createTau:Zg,createTrue:Wg,createVersion:s0,createAtomicMass:$0,createAvogadro:B0,createBohrMagneton:g0,createBohrRadius:S0,createBoltzmann:z0,createClassicalElectronRadius:D0,createConductanceQuantum:y0,createCoulomb:m0,createDeuteronMass:T0,createEfimovFactor:F0,createElectricConstant:p0,createElectronMass:E0,createElementaryCharge:v0,createFaraday:L0,createFermiCoupling:N0,createFineStructure:A0,createFirstRadiation:V0,createGasConstant:G0,createGravitationConstant:u0,createGravity:Q0,createHartreeEnergy:_0,createInverseConductanceQuantum:b0,createKlitzing:C0,createLoschmidt:q0,createMagneticConstant:f0,createMagneticFluxQuantum:x0,createMolarMass:X0,createMolarMassC12:Z0,createMolarPlanckConstant:U0,createMolarVolume:W0,createNeutronMass:O0,createNuclearMagneton:w0,createPlanckCharge:ry,createPlanckConstant:c0,createPlanckLength:J0,createPlanckMass:ey,createPlanckTemperature:ny,createPlanckTime:ty,createProtonMass:M0,createQuantumOfCirculation:R0,createReducedPlanckConstant:d0,createRydberg:I0,createSackurTetrode:H0,createSecondRadiation:j0,createSpeedOfLight:l0,createStefanBoltzmann:K0,createThomsonCrossSection:k0,createVacuumImpedance:h0,createWeakMixingAngle:P0,createWienDisplacement:Y0,createApplyTransform:ay,createColumnTransform:oy,createFilterTransform:sy,createForEachTransform:ly,createIndexTransform:uy,createMapTransform:cy,createMaxTransform:dy,createMeanTransform:fy,createMinTransform:py,createRangeTransform:hy,createRowTransform:my,createSubsetTransform:vy,createConcatTransform:gy,createDiffTransform:yy,createStdTransform:by,createSumTransform:xy,createCumSumTransform:wy,createVarianceTransform:Cy},Symbol.toStringTag,{value:"Module"}));var Ge=kf({config:Ie}),Sr=Pf({}),kw=Qg({BigNumber:Ge,config:Ie}),wk=Hg({}),Ck=A0({BigNumber:Ge,config:Ie}),Lo=Ff({}),Pw=o0({Complex:Sr}),Sk=Kg({BigNumber:Ge,config:Ie}),Dk=t0({BigNumber:Ge,config:Ie}),Ek=n0({BigNumber:Ge,config:Ie}),yc=Bf({}),Nk=Yg({BigNumber:Ge,config:Ie}),Ak=jg({}),_k=Jg({BigNumber:Ge,config:Ie}),Mk=$f({}),Fw=Nf({}),Tk=i0({BigNumber:Ge,config:Ie}),Ok=H0({BigNumber:Ge,config:Ie}),$w=Zg({BigNumber:Ge,config:Ie}),Rk=Wg({}),Ik=s0({}),Rt=zf({Matrix:yc}),kk=F0({BigNumber:Ge,config:Ie}),Pk=e0({BigNumber:Ge,config:Ie}),Bw=Xg({BigNumber:Ge,config:Ie}),Fk=Ug({}),$k=a0({BigNumber:Ge,config:Ie}),oe=Df({BigNumber:Ge,Complex:Sr,DenseMatrix:Rt,Fraction:Lo}),Sy=mp({BigNumber:Ge,config:Ie,typed:oe}),Bk=P0({BigNumber:Ge,config:Ie}),Un=vp({typed:oe}),zk=Em({Complex:Sr,config:Ie,typed:oe}),Lk=Am({BigNumber:Ge,typed:oe}),Vk=Mm({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),Yr=yp({typed:oe}),qk=Kp({typed:oe}),Gk=Rm({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),Uk=km({typed:oe}),zw=Pm({typed:oe}),Wk=$m({Complex:Sr,config:Ie,typed:oe}),ji=op({BigNumber:Ge,typed:oe}),Hk=Wp({typed:oe}),jk=ap({typed:oe}),Kk=Lf({typed:oe}),bc=bg({typed:oe}),xc=sp({Complex:Sr,typed:oe}),Vo=Yp({typed:oe}),Yk=zm({typed:oe}),Xk=Vm({BigNumber:Ge,typed:oe}),Zk=qm({BigNumber:Ge,typed:oe}),Qk=wp({typed:oe}),jt=tp({config:Ie,typed:oe}),Jk=Sh({typed:oe}),Lw=Cp({typed:oe}),eP=Sp({Complex:Sr,typed:oe}),tP=ih({typed:oe}),rP=oh({typed:oe}),Fl=Nh({typed:oe}),nP=sh({typed:oe}),iP=Mh({format:Fl,typed:oe}),Dy=Xp({typed:oe}),oi=Gf({typed:oe}),xs=jf({typed:oe}),wc=Xf({typed:oe}),Di=Zf({typed:oe}),aP=r0({BigNumber:Ge,config:Ie}),oP=Cg({Complex:Sr,typed:oe}),sP=Mp({Complex:Sr,config:Ie,typed:oe}),Vw=Tp({Complex:Sr,config:Ie,typed:oe}),ws=ch({typed:oe}),Vr=Ip({typed:oe}),qw=Qp({typed:oe}),to=np({typed:oe}),lP=_h({format:Fl,typed:oe}),uP=Ag({config:Ie,typed:oe}),cP=Th({typed:oe}),dP=_g({config:Ie,typed:oe}),Ey=Zp({typed:oe}),fP=Um({BigNumber:Ge,typed:oe}),Gw=Fp({BigNumber:Ge,Fraction:Lo,complex:xc,typed:oe}),Ny=Hm({typed:oe}),Sa=rp({Matrix:yc,equalScalar:jt,typed:oe}),pP=pp({typed:oe}),hP=Bp({typed:oe}),mP=ip({typed:oe}),vP=Km({typed:oe}),Uw=Jf({typed:oe}),gP=Nm({Complex:Sr,config:Ie,typed:oe}),yP=Tm({BigNumber:Ge,typed:oe}),Ay=Ju({isInteger:oi,typed:oe}),bP=Om({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),xP=Ah({format:Fl,typed:oe}),wP=xg({typed:oe}),_y=Bm({typed:oe}),CP=Gm({BigNumber:Ge,typed:oe}),$l=Qf({typed:oe}),SP=Rh({typed:oe}),DP=Mg({config:Ie,typed:oe}),EP=Wm({BigNumber:Ge,typed:oe}),NP=jm({typed:oe}),AP=Sm({SparseMatrix:Sa,typed:oe}),Ki=$p({Complex:Sr,config:Ie,typed:oe}),_P=Ym({typed:oe}),Yi=hp({typed:oe}),MP=_m({BigNumber:Ge,Complex:Sr,config:Ie,typed:oe}),TP=Lm({BigNumber:Ge,typed:oe}),Cs=lp({Fraction:Lo,typed:oe}),qo=Kf({typed:oe}),We=up({DenseMatrix:Rt,Matrix:yc,SparseMatrix:Sa,typed:oe}),OP=cp({isZero:Di,matrix:We,typed:oe}),RP=Dh({isNaN:$l,isNumeric:qo,typed:oe}),Ei=Ih({bignumber:ji,fraction:Cs,number:to}),Ww=Eh({config:Ie,multiplyScalar:Vr,numeric:Ei,typed:oe}),IP=fh({isInteger:oi,matrix:We,typed:oe}),Sn=vh({matrix:We,config:Ie,typed:oe}),kP=gh({matrix:We,typed:oe}),Zn=oc({matrix:We,typed:oe}),Bl=yh({matrix:We,typed:oe}),Hw=Lp({BigNumber:Ge,config:Ie,matrix:We,typed:oe}),Xi=xh({BigNumber:Ge,config:Ie,matrix:We,typed:oe}),PP=Im({Complex:Sr,config:Ie,typed:oe}),jw=bp({BigNumber:Ge,Complex:Sr,Fraction:Lo,config:Ie,isNegative:xs,matrix:We,typed:oe,unaryMinus:Yi}),nr=tc({isInteger:oi,matrix:We,typed:oe}),FP=th({prod:Ww,size:Sn,typed:oe}),My=bh({conj:Vo,transpose:Bl,typed:oe}),Kw=nh({DenseMatrix:Rt,SparseMatrix:Sa,matrix:We,typed:oe}),Fr=kh({numeric:Ei,typed:oe}),zl=Vh({DenseMatrix:Rt,concat:nr,divideScalar:Fr,equalScalar:jt,matrix:We,typed:oe}),Ni=tm({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),Ll=ah({matrix:We,typed:oe}),$P=Np({BigNumber:Ge,DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),BP=Yf({isNumeric:qo,typed:oe}),ro=lh({BigNumber:Ge,DenseMatrix:Rt,SparseMatrix:Sa,config:Ie,matrix:We,typed:oe}),zP=uh({matrix:We,multiplyScalar:Vr,typed:oe}),Cc=cm({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),LP=Hh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),Ty=fp({flatten:Ll,matrix:We,size:Sn,typed:oe}),Yw=Rp({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),VP=Pp({BigNumber:Ge,concat:nr,equalScalar:jt,matrix:We,typed:oe}),qP=dh({BigNumber:Ge,config:Ie,matrix:We,typed:oe}),GP=ph({config:Ie,matrix:We}),UP=jh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),Sc=Fh({BigNumber:Ge,DenseMatrix:Rt,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),si=im({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),WP=Oh({concat:nr,matrix:We,typed:oe}),HP=pm({DenseMatrix:Rt,concat:nr,config:Ie,equalScalar:jt,matrix:We,typed:oe}),jP=eh({DenseMatrix:Rt,concat:nr,matrix:We,typed:oe}),Dr=ov({DenseMatrix:Rt,SparseMatrix:Sa,addScalar:Yr,concat:nr,equalScalar:jt,matrix:We,typed:oe}),KP=Up({concat:nr,equalScalar:jt,matrix:We,typed:oe}),YP=jp({DenseMatrix:Rt,concat:nr,matrix:We,typed:oe}),XP=Rg({addScalar:Yr,combinations:bc,divideScalar:Fr,isInteger:oi,isNegative:xs,multiplyScalar:Vr,typed:oe}),Ss=Zh({BigNumber:Ge,DenseMatrix:Rt,Fraction:Lo,concat:nr,config:Ie,equalScalar:jt,matrix:We,typed:oe}),Xw=Jh({concat:nr,matrix:We,typed:oe}),ZP=hc({add:Dr,typed:oe,unaryPlus:Sy}),Zw=dm({equal:Ni,typed:oe}),Dc=uv({addScalar:Yr,conj:Vo,multiplyScalar:Vr,size:Sn,typed:oe}),QP=rm({compareText:Xw,isZero:Di,typed:oe}),Qw=Ep({DenseMatrix:Rt,config:Ie,equalScalar:jt,matrix:We,round:Sc,typed:oe,zeros:Xi}),JP=sv({abs:Un,addScalar:Yr,divideScalar:Fr,isPositive:wc,multiplyScalar:Vr,smaller:si,sqrt:Ki,typed:oe}),Jw=vm({DenseMatrix:Rt,smaller:si}),Dn=gm({ImmutableDenseMatrix:Jw}),eF=Vp({BigNumber:Ge,add:Dr,config:Ie,equal:Ni,isInteger:oi,mod:Yw,smaller:si,typed:oe,xgcd:Hw}),li=lm({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),Oy=$h({Complex:Sr,config:Ie,divideScalar:Fr,typed:oe}),tF=dp({flatten:Ll,matrix:We,size:Sn,typed:oe}),rF=uc({config:Ie,numeric:Ei,smaller:si,typed:oe}),Er=kp({addScalar:Yr,dot:Dc,equalScalar:jt,matrix:We,multiplyScalar:Vr,typed:oe}),nF=zh({Complex:Sr,config:Ie,divideScalar:Fr,typed:oe}),iF=Jp({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),Ry=hm({compare:Ss,isNaN:$l,isNumeric:qo,typed:oe}),aF=yg({add:Dr,compare:Ss,multiply:Er,partitionSelect:Ry,typed:oe}),oF=Kh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe,zeros:Xi}),Iy=om({DenseMatrix:Rt,concat:nr,config:Ie,matrix:We,typed:oe}),gr=zp({DenseMatrix:Rt,addScalar:Yr,concat:nr,equalScalar:jt,matrix:We,typed:oe,unaryMinus:Yi}),sF=cv({add:Dr,matrix:We,typed:oe}),ky=Gh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),lF=Yh({concat:nr,equalScalar:jt,matrix:We,not:qw,typed:oe,zeros:Xi}),uF=Hp({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),Py=xp({DenseMatrix:Rt,config:Ie,equalScalar:jt,matrix:We,round:Sc,typed:oe,zeros:Xi}),Zi=Qh({compare:Ss,typed:oe}),cF=Ig({addScalar:Yr,combinations:bc,isInteger:oi,isNegative:xs,isPositive:wc,larger:li,typed:oe}),dF=rh({matrix:We,multiply:Er,subtract:gr,typed:oe}),eC=ng({divideScalar:Fr,isZero:Di,matrix:We,multiply:Er,subtract:gr,typed:oe,unaryMinus:Yi}),fF=nc({matrix:We,number:to,subtract:gr,typed:oe}),pF=pg({abs:Un,addScalar:Yr,divideScalar:Fr,multiplyScalar:Vr,sqrt:Ki,subtract:gr,typed:oe,unaryMinus:Yi}),hF=qp({concat:nr,equalScalar:jt,matrix:We,multiplyScalar:Vr,typed:oe}),tC=ym({larger:li,smaller:si}),rC=Dp({Complex:Sr,DenseMatrix:Rt,ceil:Py,equalScalar:jt,floor:Qw,matrix:We,typed:oe,zeros:Xi}),nC=dv({Index:Dn,typed:oe}),mF=hg({abs:Un,add:Dr,addScalar:Yr,config:Ie,divideScalar:Fr,equalScalar:jt,flatten:Ll,isNumeric:qo,isZero:Di,matrix:We,multiply:Er,multiplyScalar:Vr,smaller:si,subtract:gr,typed:oe}),vF=_p({concat:nr,equalScalar:jt,matrix:We,typed:oe}),gF=Bh({Complex:Sr,config:Ie,divideScalar:Fr,log:Oy,typed:oe}),iC=qh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),aC=lc({config:Ie,larger:li,numeric:Ei,typed:oe}),Fy=Yv({addScalar:Yr,complex:xc,conj:Vo,divideScalar:Fr,equal:Ni,identity:ro,isZero:Di,matrix:We,multiplyScalar:Vr,sign:Gw,sqrt:Ki,subtract:gr,typed:oe,unaryMinus:Yi,zeros:Xi}),Ds=ic({bignumber:ji,matrix:We,config:Ie,larger:li,largerEq:Cc,smaller:si,smallerEq:Iy,typed:oe}),yF=ac({Index:Dn,matrix:We,range:Ds,typed:oe}),bF=Xm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),xF=Qm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),wF=ev({Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),CF=rv({Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),oC=Xv({SparseMatrix:Sa,abs:Un,add:Dr,divideScalar:Fr,larger:li,largerEq:Cc,multiply:Er,subtract:gr,transpose:Bl,typed:oe}),sC=bm({FibonacciHeap:tC,addScalar:Yr,equalScalar:jt}),lC=pc({add:Dr,config:Ie,numeric:Ei,typed:oe}),uC=Wh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),SF=Fm({BigNumber:Ge,DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,typed:oe}),cC=rc({Index:Dn,matrix:We,range:Ds,typed:oe}),DF=Uh({DenseMatrix:Rt,divideScalar:Fr,equalScalar:jt,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe}),dC=Zm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),EF=tv({Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),fC=iv({Index:Dn,concat:nr,setDifference:dC,size:Sn,subset:Zn,typed:oe}),NF=mm({compare:Ss,compareNatural:Zi,matrix:We,typed:oe}),Go=ig({abs:Un,addScalar:Yr,det:eC,divideScalar:Fr,identity:ro,matrix:We,multiply:Er,typed:oe,unaryMinus:Yi}),pC=Kv({DenseMatrix:Rt,Spa:sC,SparseMatrix:Sa,abs:Un,addScalar:Yr,divideScalar:Fr,equalScalar:jt,larger:li,matrix:We,multiplyScalar:Vr,subtract:gr,typed:oe,unaryMinus:Yi}),AF=ag({Complex:Sr,add:Dr,ctranspose:My,deepEqual:Zw,divideScalar:Fr,dot:Dc,dotDivide:zl,equal:Ni,inv:Go,matrix:We,multiply:Er,typed:oe}),Qi=Ph({Complex:Sr,config:Ie,fraction:Cs,identity:ro,inv:Go,matrix:We,multiply:Er,number:to,typed:oe}),hC=Jm({DenseMatrix:Rt,Index:Dn,compareNatural:Zi,size:Sn,subset:Zn,typed:oe}),_F=av({Index:Dn,concat:nr,setIntersect:hC,setSymDifference:fC,size:Sn,subset:Zn,typed:oe}),MF=lg({abs:Un,add:Dr,identity:ro,inv:Go,map:ws,max:aC,multiply:Er,size:Sn,sqrt:Ki,subtract:gr,typed:oe}),yt=wm({BigNumber:Ge,Complex:Sr,Fraction:Lo,abs:Un,addScalar:Yr,config:Ie,divideScalar:Fr,equal:Ni,fix:rC,format:Fl,isNumeric:qo,multiplyScalar:Vr,number:to,pow:Qi,round:Sc,subtract:gr}),TF=h0({BigNumber:Ge,Unit:yt,config:Ie}),OF=Y0({BigNumber:Ge,Unit:yt,config:Ie}),RF=$0({BigNumber:Ge,Unit:yt,config:Ie}),IF=g0({BigNumber:Ge,Unit:yt,config:Ie}),kF=z0({BigNumber:Ge,Unit:yt,config:Ie}),PF=y0({BigNumber:Ge,Unit:yt,config:Ie}),FF=Dm({Unit:yt,typed:oe}),$F=T0({BigNumber:Ge,Unit:yt,config:Ie}),BF=Lh({DenseMatrix:Rt,concat:nr,equalScalar:jt,matrix:We,pow:Qi,typed:oe}),zF=p0({BigNumber:Ge,Unit:yt,config:Ie}),LF=v0({BigNumber:Ge,Unit:yt,config:Ie}),VF=sg({abs:Un,add:Dr,identity:ro,inv:Go,multiply:Er,typed:oe}),qF=L0({BigNumber:Ge,Unit:yt,config:Ie}),mC=wh({addScalar:Yr,ceil:Py,conj:Vo,divideScalar:Fr,dotDivide:zl,exp:Lw,i:Pw,log2:Vw,matrix:We,multiplyScalar:Vr,pow:Qi,tau:$w,typed:oe}),vC=wg({BigNumber:Ge,Complex:Sr,config:Ie,multiplyScalar:Vr,pow:Qi,typed:oe}),GF=u0({BigNumber:Ge,Unit:yt,config:Ie}),UF=_0({BigNumber:Ge,Unit:yt,config:Ie}),WF=Ch({conj:Vo,dotDivide:zl,fft:mC,typed:oe}),HF=C0({BigNumber:Ge,Unit:yt,config:Ie}),jF=q0({BigNumber:Ge,Unit:yt,config:Ie}),KF=f0({BigNumber:Ge,Unit:yt,config:Ie}),YF=X0({BigNumber:Ge,Unit:yt,config:Ie}),XF=U0({BigNumber:Ge,Unit:yt,config:Ie}),ZF=O0({BigNumber:Ge,Unit:yt,config:Ie}),QF=w0({BigNumber:Ge,Unit:yt,config:Ie}),JF=ry({BigNumber:Ge,Unit:yt,config:Ie}),e$=J0({BigNumber:Ge,Unit:yt,config:Ie}),t$=ny({BigNumber:Ge,Unit:yt,config:Ie}),r$=M0({BigNumber:Ge,Unit:yt,config:Ie}),n$=d0({BigNumber:Ge,Unit:yt,config:Ie}),i$=I0({BigNumber:Ge,Unit:yt,config:Ie}),a$=j0({BigNumber:Ge,Unit:yt,config:Ie}),o$=l0({BigNumber:Ge,Unit:yt,config:Ie}),s$=K0({BigNumber:Ge,Unit:yt,config:Ie}),l$=k0({BigNumber:Ge,Unit:yt,config:Ie}),u$=B0({BigNumber:Ge,Unit:yt,config:Ie}),c$=S0({BigNumber:Ge,Unit:yt,config:Ie}),d$=m0({BigNumber:Ge,Unit:yt,config:Ie}),ui=fg({divideScalar:Fr,equalScalar:jt,inv:Go,matrix:We,multiply:Er,typed:oe}),f$=E0({BigNumber:Ge,Unit:yt,config:Ie}),Ec=Sg({gamma:vC,typed:oe}),p$=V0({BigNumber:Ge,Unit:yt,config:Ie}),h$=G0({BigNumber:Ge,Unit:yt,config:Ie}),m$=b0({BigNumber:Ge,Unit:yt,config:Ie}),gC=Zv({DenseMatrix:Rt,lsolve:iC,lup:pC,matrix:We,slu:oC,typed:oe,usolve:ky}),v$=x0({BigNumber:Ge,Unit:yt,config:Ie}),g$=Z0({BigNumber:Ge,Unit:yt,config:Ie}),y$=Eg({add:Dr,divide:ui,factorial:Ec,isInteger:oi,isPositive:wc,multiply:Er,typed:oe}),b$=Ng({factorial:Ec,typed:oe}),x$=ey({BigNumber:Ge,Unit:yt,config:Ie}),w$=Qv({add:Dr,cbrt:jw,divide:ui,equalScalar:jt,im:Dy,isZero:Di,multiply:Er,re:Ey,sqrt:Ki,subtract:gr,typeOf:Uw,typed:oe,unaryMinus:Yi}),C$=nv({compareNatural:Zi,typed:oe}),yC=Tg({bignumber:ji,addScalar:Yr,combinations:bc,divideScalar:Fr,factorial:Ec,isInteger:oi,isNegative:xs,larger:li,multiplyScalar:Vr,number:to,pow:Qi,subtract:gr,typed:oe}),S$=Cm({Unit:yt,typed:oe}),D$=Og({addScalar:Yr,isInteger:oi,isNegative:xs,stirlingS2:yC,typed:oe}),bC=og({abs:Un,add:Dr,addScalar:Yr,atan:zw,bignumber:ji,column:cC,complex:xc,config:Ie,cos:_y,diag:Kw,divideScalar:Fr,dot:Dc,equal:Ni,flatten:Ll,im:Dy,inv:Go,larger:li,matrix:We,matrixFromColumns:Ty,multiply:Er,multiplyScalar:Vr,number:to,qr:Fy,re:Ey,sin:Ny,smaller:si,sqrt:Ki,subtract:gr,typed:oe,usolve:ky,usolveAll:uC}),E$=N0({BigNumber:Ge,Unit:yt,config:Ie}),N$=Q0({BigNumber:Ge,Unit:yt,config:Ie}),A$=Dg({divide:ui,dotDivide:zl,isNumeric:qo,log:Oy,map:ws,matrix:We,multiply:Er,sum:lC,typed:oe}),xC=mc({add:Dr,divide:ui,typed:oe}),_$=W0({BigNumber:Ge,Unit:yt,config:Ie}),M$=c0({BigNumber:Ge,Unit:yt,config:Ie}),T$=R0({BigNumber:Ge,Unit:yt,config:Ie}),$y=vc({add:Dr,apply:Ay,divide:ui,isNaN:$l,multiply:Er,subtract:gr,typed:oe}),O$=D0({BigNumber:Ge,Unit:yt,config:Ie}),wC=vg({add:Dr,compare:Ss,divide:ui,partitionSelect:Ry,typed:oe}),R$=ty({BigNumber:Ge,Unit:yt,config:Ie}),By=gc({map:ws,sqrt:Ki,typed:oe,variance:$y}),I$=gg({abs:Un,map:ws,median:wC,subtract:gr,typed:oe}),zy=lv({abs:Un,add:Dr,conj:Vo,ctranspose:My,eigs:bC,equalScalar:jt,larger:li,matrix:We,multiply:Er,pow:Qi,smaller:si,sqrt:Ki,typed:oe}),CC=mh({BigNumber:Ge,DenseMatrix:Rt,SparseMatrix:Sa,addScalar:Yr,config:Ie,cos:_y,matrix:We,multiplyScalar:Vr,norm:zy,sin:Ny,typed:oe,unaryMinus:Yi}),k$=hh({multiply:Er,rotationMatrix:CC,typed:oe}),SC=cg({identity:ro,matrix:We,multiply:Er,norm:zy,qr:Fy,subtract:gr,typed:oe}),DC=ug({abs:Un,add:Dr,concat:nr,identity:ro,index:nC,lusolve:gC,matrix:We,matrixFromColumns:Ty,multiply:Er,range:Ds,schur:SC,subset:Zn,subtract:gr,transpose:Bl,typed:oe}),P$=dg({matrix:We,multiply:Er,sylvester:DC,transpose:Bl,typed:oe}),Vl={},ql={},F$={},En=fv({mathWithTransform:ql}),Es=Ov({Node:En}),Da=Iv({Node:En}),Uo=Pv({Node:En}),EC=zv({Node:En}),Ns=vv({Node:En}),NC=wv({Node:En,ResultSet:Fw}),AC=Sv({Node:En}),no=Ev({Node:En}),_C=$v({Node:En}),$$=Gg({classes:F$}),Ly=eg({math:Vl,typed:oe}),MC=Av({Node:En,typed:oe}),B$=rg({Chain:Ly,typed:oe}),As=hv({Node:En,subset:Zn}),_s=Mv({Node:En,size:Sn}),TC=bv({matrix:We,Node:En,subset:Zn}),io=Lv({Unit:yt,Node:En,math:Vl}),ao=qv({Node:En,SymbolNode:io,math:Vl}),Ai=Gv({AccessorNode:As,ArrayNode:Ns,AssignmentNode:TC,BlockNode:NC,ConditionalNode:AC,ConstantNode:no,FunctionAssignmentNode:MC,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,RangeNode:_C,RelationalNode:EC,SymbolNode:io,config:Ie,numeric:Ei,typed:oe}),OC=zg({ConstantNode:no,FunctionNode:ao,OperatorNode:Da,ParenthesisNode:Uo,parse:Ai,typed:oe}),Vy=$g({bignumber:ji,fraction:Cs,AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,SymbolNode:io,config:Ie,mathWithTransform:ql,matrix:We,typed:oe}),z$=Uv({parse:Ai,typed:oe}),RC=Wv({parse:Ai,typed:oe}),IC=Jv({parse:Ai}),kC=Hv({evaluate:RC}),qy=Bg({AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,add:Dr,divide:ui,equal:Ni,isZero:Di,multiply:Er,parse:Ai,pow:Qi,subtract:gr,typed:oe}),L$=tg({Help:IC,mathWithTransform:ql,typed:oe}),Nc=Fg({bignumber:ji,fraction:Cs,AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,add:Dr,config:Ie,divide:ui,equal:Ni,isZero:Di,mathWithTransform:ql,matrix:We,multiply:Er,parse:Ai,pow:Qi,resolve:OC,simplifyConstant:Vy,simplifyCore:qy,subtract:gr,typed:oe}),V$=Lg({OperatorNode:Da,parse:Ai,simplify:Nc,typed:oe}),q$=Vg({ConstantNode:no,FunctionNode:ao,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,config:Ie,equal:Ni,isZero:Di,numeric:Ei,parse:Ai,simplify:Nc,typed:oe}),G$=jv({Parser:kC,typed:oe}),U$=kg({parse:Ai,typed:oe}),W$=qg({bignumber:ji,fraction:Cs,AccessorNode:As,ArrayNode:Ns,ConstantNode:no,FunctionNode:ao,IndexNode:_s,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,SymbolNode:io,add:Dr,config:Ie,divide:ui,equal:Ni,isZero:Di,mathWithTransform:ql,matrix:We,multiply:Er,parse:Ai,pow:Qi,simplify:Nc,simplifyConstant:Vy,simplifyCore:qy,subtract:gr,typed:oe});fn(Vl,{e:kw,false:wk,fineStructure:Ck,i:Pw,Infinity:Sk,LN10:Dk,LOG10E:Ek,NaN:Nk,null:Ak,phi:_k,SQRT1_2:Tk,sackurTetrode:Ok,tau:$w,true:Rk,E:kw,version:Ik,efimovFactor:kk,LN2:Pk,pi:Bw,replacer:Fk,reviver:$$,SQRT2:$k,typed:oe,unaryPlus:Sy,PI:Bw,weakMixingAngle:Bk,abs:Un,acos:zk,acot:Lk,acsc:Vk,addScalar:Yr,arg:qk,asech:Gk,asinh:Uk,atan:zw,atanh:Wk,bignumber:ji,bitNot:Hk,boolean:jk,clone:Kk,combinations:bc,complex:xc,conj:Vo,cosh:Yk,coth:Xk,csc:Zk,cube:Qk,equalScalar:jt,erf:Jk,exp:Lw,expm1:eP,filter:tP,forEach:rP,format:Fl,getMatrixDataType:nP,hex:iP,im:Dy,isInteger:oi,isNegative:xs,isPositive:wc,isZero:Di,LOG2E:aP,lgamma:oP,log10:sP,log2:Vw,map:ws,multiplyScalar:Vr,not:qw,number:to,oct:lP,pickRandom:uP,print:cP,random:dP,re:Ey,sec:fP,sign:Gw,sin:Ny,splitUnit:pP,square:hP,string:mP,tan:vP,typeOf:Uw,acosh:gP,acsch:yP,apply:Ay,asec:bP,bin:xP,chain:B$,combinationsWithRep:wP,cos:_y,csch:CP,isNaN:$l,isPrime:SP,randomInt:DP,sech:EP,sinh:NP,sparse:AP,sqrt:Ki,tanh:_P,unaryMinus:Yi,acoth:MP,cot:TP,fraction:Cs,isNumeric:qo,matrix:We,matrixFromFunction:OP,mode:RP,numeric:Ei,prod:Ww,reshape:IP,size:Sn,squeeze:kP,subset:Zn,transpose:Bl,xgcd:Hw,zeros:Xi,asin:PP,cbrt:jw,concat:nr,count:FP,ctranspose:My,diag:Kw,divideScalar:Fr,dotDivide:zl,equal:Ni,flatten:Ll,gcd:$P,hasNumericValue:BP,identity:ro,kron:zP,largerEq:Cc,leftShift:LP,matrixFromColumns:Ty,mod:Yw,nthRoot:VP,ones:qP,resize:GP,rightArithShift:UP,round:Sc,smaller:si,to:WP,unequal:HP,xor:jP,add:Dr,bitAnd:KP,bitXor:YP,catalan:XP,compare:Ss,compareText:Xw,cumsum:ZP,deepEqual:Zw,dot:Dc,equalText:QP,floor:Qw,hypot:JP,invmod:eF,larger:li,log:Oy,matrixFromRows:tF,min:rF,multiply:Er,nthRoots:nF,or:iF,partitionSelect:Ry,quantileSeq:aF,rightLogShift:oF,smallerEq:Iy,subtract:gr,trace:sF,usolve:ky,and:lF,bitOr:uF,ceil:Py,compareNatural:Zi,composition:cF,cross:dF,det:eC,diff:fF,distance:pF,dotMultiply:hF,fix:rC,index:nC,intersect:mF,lcm:vF,log1p:gF,lsolve:iC,max:aC,qr:Fy,range:Ds,row:yF,setCartesian:bF,setDistinct:xF,setIsSubset:wF,setPowerset:CF,slu:oC,sum:lC,usolveAll:uC,atan2:SF,column:cC,lsolveAll:DF,setDifference:dC,setMultiplicity:EF,setSymDifference:fC,sort:NF,inv:Go,lup:pC,pinv:AF,pow:Qi,setIntersect:hC,setUnion:_F,sqrtm:MF,vacuumImpedance:TF,wienDisplacement:OF,atomicMass:RF,bohrMagneton:IF,boltzmann:kF,conductanceQuantum:PF,createUnit:FF,deuteronMass:$F,dotPow:BF,electricConstant:zF,elementaryCharge:LF,expm:VF,faraday:qF,fft:mC,gamma:vC,gravitationConstant:GF,hartreeEnergy:UF,ifft:WF,klitzing:HF,loschmidt:jF,magneticConstant:KF,molarMass:YF,molarPlanckConstant:XF,neutronMass:ZF,nuclearMagneton:QF,planckCharge:JF,planckLength:e$,planckTemperature:t$,protonMass:r$,reducedPlanckConstant:n$,rydberg:i$,secondRadiation:a$,speedOfLight:o$,stefanBoltzmann:s$,thomsonCrossSection:l$,avogadro:u$,bohrRadius:c$,coulomb:d$,divide:ui,electronMass:f$,factorial:Ec,firstRadiation:p$,gasConstant:h$,inverseConductanceQuantum:m$,lusolve:gC,magneticFluxQuantum:v$,molarMassC12:g$,multinomial:y$,permutations:b$,planckMass:x$,polynomialRoot:w$,setSize:C$,stirlingS2:yC,unit:S$,bellNumbers:D$,eigs:bC,fermiCoupling:E$,gravity:N$,kldivergence:A$,mean:xC,molarVolume:_$,planckConstant:M$,quantumOfCirculation:T$,variance:$y,classicalElectronRadius:O$,median:wC,parse:Ai,planckTime:R$,resolve:OC,simplifyConstant:Vy,std:By,compile:z$,evaluate:RC,mad:I$,simplifyCore:qy,help:L$,norm:zy,rotationMatrix:CC,simplify:Nc,symbolicEqual:V$,derivative:q$,parser:G$,rotate:k$,leafCount:U$,rationalize:W$,schur:SC,sylvester:DC,lyap:P$,config:Ie}),fn(ql,Vl,{filter:sy({typed:oe}),forEach:ly({typed:oe}),map:cy({typed:oe}),apply:ay({isInteger:oi,typed:oe}),subset:vy({matrix:We,typed:oe}),concat:gy({isInteger:oi,matrix:We,typed:oe}),max:dy({config:Ie,larger:li,numeric:Ei,typed:oe}),sum:xy({add:Dr,config:Ie,numeric:Ei,typed:oe}),min:py({config:Ie,numeric:Ei,smaller:si,typed:oe}),cumsum:wy({add:Dr,typed:oe,unaryPlus:Sy}),diff:yy({bignumber:ji,matrix:We,number:to,subtract:gr,typed:oe}),index:uy({Index:Dn}),range:hy({bignumber:ji,matrix:We,config:Ie,larger:li,largerEq:Cc,smaller:si,smallerEq:Iy,typed:oe}),row:my({Index:Dn,matrix:We,range:Ds,typed:oe}),column:oy({Index:Dn,matrix:We,range:Ds,typed:oe}),mean:fy({add:Dr,divide:ui,typed:oe}),variance:Cy({add:Dr,apply:Ay,divide:ui,isNaN:$l,multiply:Er,subtract:gr,typed:oe}),std:by({map:ws,sqrt:Ki,typed:oe,variance:$y})}),fn(F$,{BigNumber:Ge,Complex:Sr,Fraction:Lo,Matrix:yc,Node:En,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,Range:Mk,RelationalNode:EC,ResultSet:Fw,ArrayNode:Ns,BlockNode:NC,ConditionalNode:AC,ConstantNode:no,DenseMatrix:Rt,RangeNode:_C,Chain:Ly,FunctionAssignmentNode:MC,SparseMatrix:Sa,AccessorNode:As,IndexNode:_s,AssignmentNode:TC,ImmutableDenseMatrix:Jw,Index:Dn,FibonacciHeap:tC,Spa:sC,Unit:yt,SymbolNode:io,FunctionNode:ao,Help:IC,Parser:kC}),Ly.createProxy(Vl);var Ue={createBigNumberClass:kf},Rr={createComplexClass:Pf},Gy={createMatrixClass:Bf},Ft={MatrixDependencies:Gy,createDenseMatrixClass:zf},Ms={createFractionClass:Ff},se={BigNumberDependencies:Ue,ComplexDependencies:Rr,DenseMatrixDependencies:Ft,FractionDependencies:Ms,createTyped:Df},Qn={typedDependencies:se,createAbs:vp},Pn={createNode:fv},Yt={typedDependencies:se,createEqualScalar:tp},oo={MatrixDependencies:Gy,equalScalarDependencies:Yt,typedDependencies:se,createSparseMatrixClass:rp},je={DenseMatrixDependencies:Ft,MatrixDependencies:Gy,SparseMatrixDependencies:oo,typedDependencies:se,createMatrix:up},ci={matrixDependencies:je,typedDependencies:se,createSubset:oc},Gl={NodeDependencies:Pn,subsetDependencies:ci,createAccessorNode:hv},Rpe={ComplexDependencies:Rr,typedDependencies:se,createAcos:Em},Ipe={ComplexDependencies:Rr,typedDependencies:se,createAcosh:Nm},kpe={BigNumberDependencies:Ue,typedDependencies:se,createAcot:Am},Ppe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAcoth:_m},Fpe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAcsc:Mm},$pe={BigNumberDependencies:Ue,typedDependencies:se,createAcsch:Tm},tn={typedDependencies:se,createAddScalar:yp},_i={typedDependencies:se,createIsInteger:Gf},lr={isIntegerDependencies:_i,matrixDependencies:je,typedDependencies:se,createConcat:tc},Ir={DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,addScalarDependencies:tn,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createAdd:ov},H$={typedDependencies:se,createNot:Qp},Ea={BigNumberDependencies:Ue,matrixDependencies:je,typedDependencies:se,createZeros:xh},Bpe={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,notDependencies:H$,typedDependencies:se,zerosDependencies:Ea,createAnd:Yh},PC={isIntegerDependencies:_i,typedDependencies:se,createApply:Ju},zpe={isIntegerDependencies:_i,typedDependencies:se,createApplyTransform:ay},Lpe={typedDependencies:se,createArg:Kp},Ul={NodeDependencies:Pn,createArrayNode:vv},Vpe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAsec:Om},qpe={BigNumberDependencies:Ue,ComplexDependencies:Rr,typedDependencies:se,createAsech:Rm},Gpe={ComplexDependencies:Rr,typedDependencies:se,createAsin:Im},Upe={typedDependencies:se,createAsinh:km},j$={matrixDependencies:je,NodeDependencies:Pn,subsetDependencies:ci,createAssignmentNode:bv},K$={typedDependencies:se,createAtan:Pm},Wpe={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createAtan2:Fm},Hpe={ComplexDependencies:Rr,typedDependencies:se,createAtanh:$m},Na={BigNumberDependencies:Ue,typedDependencies:se,createBignumber:op},Wl={FractionDependencies:Ms,typedDependencies:se,createFraction:lp},Wo={typedDependencies:se,createNumber:np},Ji={bignumberDependencies:Na,fractionDependencies:Wl,numberDependencies:Wo,createNumeric:Ih},$r={numericDependencies:Ji,typedDependencies:se,createDivideScalar:kh},ea={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createEqual:tm},Uy={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createRound:Fh},FC={DenseMatrixDependencies:Ft,equalScalarDependencies:Yt,matrixDependencies:je,roundDependencies:Uy,typedDependencies:se,zerosDependencies:Ea,createCeil:xp},Y$={DenseMatrixDependencies:Ft,equalScalarDependencies:Yt,matrixDependencies:je,roundDependencies:Uy,typedDependencies:se,zerosDependencies:Ea,createFloor:Ep},X$={ComplexDependencies:Rr,DenseMatrixDependencies:Ft,ceilDependencies:FC,equalScalarDependencies:Yt,floorDependencies:Y$,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createFix:Dp},Ac={typedDependencies:se,createFormat:Nh},Ts={typedDependencies:se,createIsNumeric:Kf},Hr={typedDependencies:se,createMultiplyScalar:Ip},Ho={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,matrixDependencies:je,typedDependencies:se,createIdentity:lh},ta={typedDependencies:se,createIsZero:Zf},Os={typedDependencies:se,createConj:Yp},Fn={matrixDependencies:je,typedDependencies:se,createSize:vh},Wy={addScalarDependencies:tn,conjDependencies:Os,multiplyScalarDependencies:Hr,sizeDependencies:Fn,typedDependencies:se,createDot:uv},kr={addScalarDependencies:tn,dotDependencies:Wy,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,typedDependencies:se,createMultiply:kp},Aa={typedDependencies:se,createUnaryMinus:hp},Nr={DenseMatrixDependencies:Ft,addScalarDependencies:tn,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,unaryMinusDependencies:Aa,createSubtract:zp},Z$={divideScalarDependencies:$r,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,createDet:ng},Rs={absDependencies:Qn,addScalarDependencies:tn,detDependencies:Z$,divideScalarDependencies:$r,identityDependencies:Ho,matrixDependencies:je,multiplyDependencies:kr,typedDependencies:se,unaryMinusDependencies:Aa,createInv:ig},_a={ComplexDependencies:Rr,fractionDependencies:Wl,identityDependencies:Ho,invDependencies:Rs,matrixDependencies:je,multiplyDependencies:kr,numberDependencies:Wo,typedDependencies:se,createPow:Ph},xt={BigNumberDependencies:Ue,ComplexDependencies:Rr,FractionDependencies:Ms,absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,equalDependencies:ea,fixDependencies:X$,formatDependencies:Ac,isNumericDependencies:Ts,multiplyScalarDependencies:Hr,numberDependencies:Wo,powDependencies:_a,roundDependencies:Uy,subtractDependencies:Nr,createUnitClass:wm},jpe={BigNumberDependencies:Ue,UnitDependencies:xt,createAtomicMass:$0},Kpe={BigNumberDependencies:Ue,UnitDependencies:xt,createAvogadro:B0},Hl={typedDependencies:se,createIsNegative:jf},Hy={typedDependencies:se,createCombinations:bg},Q$={BigNumberDependencies:Ue,ComplexDependencies:Rr,multiplyScalarDependencies:Hr,powDependencies:_a,typedDependencies:se,createGamma:wg},jy={gammaDependencies:Q$,typedDependencies:se,createFactorial:Sg},Mi={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createLarger:lm},J$={bignumberDependencies:Na,addScalarDependencies:tn,combinationsDependencies:Hy,divideScalarDependencies:$r,factorialDependencies:jy,isIntegerDependencies:_i,isNegativeDependencies:Hl,largerDependencies:Mi,multiplyScalarDependencies:Hr,numberDependencies:Wo,powDependencies:_a,subtractDependencies:Nr,typedDependencies:se,createStirlingS2:Tg},Ype={addScalarDependencies:tn,isIntegerDependencies:_i,isNegativeDependencies:Hl,stirlingS2Dependencies:J$,typedDependencies:se,createBellNumbers:Og},Xpe={formatDependencies:Ac,typedDependencies:se,createBin:Ah},Zpe={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createBitAnd:Up},Qpe={typedDependencies:se,createBitNot:Wp},Jpe={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createBitOr:Hp},ehe={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createBitXor:jp},eB={createResultSet:Nf},tB={NodeDependencies:Pn,ResultSetDependencies:eB,createBlockNode:wv},the={BigNumberDependencies:Ue,UnitDependencies:xt,createBohrMagneton:g0},rhe={BigNumberDependencies:Ue,UnitDependencies:xt,createBohrRadius:S0},nhe={BigNumberDependencies:Ue,UnitDependencies:xt,createBoltzmann:z0},ihe={typedDependencies:se,createBoolean:ap},ahe={addScalarDependencies:tn,combinationsDependencies:Hy,divideScalarDependencies:$r,isIntegerDependencies:_i,isNegativeDependencies:Hl,multiplyScalarDependencies:Hr,typedDependencies:se,createCatalan:Rg},rB={BigNumberDependencies:Ue,ComplexDependencies:Rr,FractionDependencies:Ms,isNegativeDependencies:Hl,matrixDependencies:je,typedDependencies:se,unaryMinusDependencies:Aa,createCbrt:bp},nB={typedDependencies:se,createChainClass:eg},ohe={ChainDependencies:nB,typedDependencies:se,createChain:rg},she={BigNumberDependencies:Ue,UnitDependencies:xt,createClassicalElectronRadius:D0},lhe={typedDependencies:se,createClone:Lf},Ti={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createSmaller:im},iB={DenseMatrixDependencies:Ft,smallerDependencies:Ti,createImmutableDenseMatrixClass:vm},$n={ImmutableDenseMatrixDependencies:iB,createIndexClass:gm},Ky={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createLargerEq:cm},$C={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createSmallerEq:om},jl={bignumberDependencies:Na,matrixDependencies:je,largerDependencies:Mi,largerEqDependencies:Ky,smallerDependencies:Ti,smallerEqDependencies:$C,typedDependencies:se,createRange:ic},aB={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createColumn:rc},uhe={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createColumnTransform:oy},che={typedDependencies:se,createCombinationsWithRep:xg},Kl={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,FractionDependencies:Ms,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createCompare:Zh},Ma={compareDependencies:Kl,typedDependencies:se,createCompareNatural:Qh},oB={concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createCompareText:Jh},sB={NodeDependencies:Pn,createConditionalNode:Sv},jo={NodeDependencies:Pn,createConstantNode:Ev},lB={NodeDependencies:Pn,typedDependencies:se,createFunctionAssignmentNode:Av},Ko={UnitDependencies:xt,NodeDependencies:Pn,createSymbolNode:Lv},Yo={NodeDependencies:Pn,SymbolNodeDependencies:Ko,createFunctionNode:qv},Yl={NodeDependencies:Pn,sizeDependencies:Fn,createIndexNode:Mv},Xl={NodeDependencies:Pn,createObjectNode:Ov},so={NodeDependencies:Pn,createOperatorNode:Iv},Is={NodeDependencies:Pn,createParenthesisNode:Pv},uB={NodeDependencies:Pn,createRangeNode:$v},cB={NodeDependencies:Pn,createRelationalNode:zv},ra={AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,AssignmentNodeDependencies:j$,BlockNodeDependencies:tB,ConditionalNodeDependencies:sB,ConstantNodeDependencies:jo,FunctionAssignmentNodeDependencies:lB,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,RangeNodeDependencies:uB,RelationalNodeDependencies:cB,SymbolNodeDependencies:Ko,numericDependencies:Ji,typedDependencies:se,createParse:Gv},dhe={parseDependencies:ra,typedDependencies:se,createCompile:Uv},Yy={ComplexDependencies:Rr,typedDependencies:se,createComplex:sp},Xy={typedDependencies:se,createIsPositive:Xf},fhe={addScalarDependencies:tn,combinationsDependencies:Hy,isIntegerDependencies:_i,isNegativeDependencies:Hl,isPositiveDependencies:Xy,largerDependencies:Mi,typedDependencies:se,createComposition:Ig},phe={isIntegerDependencies:_i,matrixDependencies:je,typedDependencies:se,createConcatTransform:gy},hhe={BigNumberDependencies:Ue,UnitDependencies:xt,createConductanceQuantum:y0},BC={typedDependencies:se,createCos:Bm},mhe={typedDependencies:se,createCosh:zm},vhe={BigNumberDependencies:Ue,typedDependencies:se,createCot:Lm},ghe={BigNumberDependencies:Ue,typedDependencies:se,createCoth:Vm},yhe={BigNumberDependencies:Ue,UnitDependencies:xt,createCoulomb:m0},dB={multiplyScalarDependencies:Hr,numericDependencies:Ji,typedDependencies:se,createProd:Eh},bhe={prodDependencies:dB,sizeDependencies:Fn,typedDependencies:se,createCount:th},xhe={UnitDependencies:xt,typedDependencies:se,createCreateUnit:Dm},whe={matrixDependencies:je,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,createCross:rh},Che={BigNumberDependencies:Ue,typedDependencies:se,createCsc:qm},She={BigNumberDependencies:Ue,typedDependencies:se,createCsch:Gm},_c={matrixDependencies:je,typedDependencies:se,createTranspose:yh},zC={conjDependencies:Os,transposeDependencies:_c,typedDependencies:se,createCtranspose:bh},Dhe={typedDependencies:se,createCube:wp},LC={BigNumberDependencies:Ue,typedDependencies:se,createUnaryPlus:mp},Ehe={addDependencies:Ir,typedDependencies:se,unaryPlusDependencies:LC,createCumSum:hc},Nhe={addDependencies:Ir,typedDependencies:se,unaryPlusDependencies:LC,createCumSumTransform:wy},fB={equalDependencies:ea,typedDependencies:se,createDeepEqual:dm},Oi={divideScalarDependencies:$r,equalScalarDependencies:Yt,invDependencies:Rs,matrixDependencies:je,multiplyDependencies:kr,typedDependencies:se,createDivide:fg},pB={ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,parseDependencies:ra,typedDependencies:se,createResolve:zg},VC={bignumberDependencies:Na,fractionDependencies:Wl,AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,SymbolNodeDependencies:Ko,matrixDependencies:je,typedDependencies:se,createSimplifyConstant:$g},qC={AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,addDependencies:Ir,divideDependencies:Oi,equalDependencies:ea,isZeroDependencies:ta,multiplyDependencies:kr,parseDependencies:ra,powDependencies:_a,subtractDependencies:Nr,typedDependencies:se,createSimplifyCore:Bg},Zy={bignumberDependencies:Na,fractionDependencies:Wl,AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,addDependencies:Ir,divideDependencies:Oi,equalDependencies:ea,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,parseDependencies:ra,powDependencies:_a,resolveDependencies:pB,simplifyConstantDependencies:VC,simplifyCoreDependencies:qC,subtractDependencies:Nr,typedDependencies:se,createSimplify:Fg},Ahe={ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,equalDependencies:ea,isZeroDependencies:ta,numericDependencies:Ji,parseDependencies:ra,simplifyDependencies:Zy,typedDependencies:se,createDerivative:Vg},_he={BigNumberDependencies:Ue,UnitDependencies:xt,createDeuteronMass:T0},hB={DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,matrixDependencies:je,typedDependencies:se,createDiag:nh},Mhe={matrixDependencies:je,numberDependencies:Wo,subtractDependencies:Nr,typedDependencies:se,createDiff:nc},The={bignumberDependencies:Na,matrixDependencies:je,numberDependencies:Wo,subtractDependencies:Nr,typedDependencies:se,createDiffTransform:yy},Ta={ComplexDependencies:Rr,typedDependencies:se,createSqrt:$p},Ohe={absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,multiplyScalarDependencies:Hr,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,createDistance:pg},Mc={DenseMatrixDependencies:Ft,concatDependencies:lr,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createDotDivide:Vh},Rhe={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,typedDependencies:se,createDotMultiply:qp},Ihe={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,powDependencies:_a,typedDependencies:se,createDotPow:Lh},mB={BigNumberDependencies:Ue,createE:Qg},khe={BigNumberDependencies:Ue,createEfimovFactor:F0},Tc={matrixDependencies:je,typedDependencies:se,createFlatten:ah},GC={typedDependencies:se,createIm:Xp},UC={flattenDependencies:Tc,matrixDependencies:je,sizeDependencies:Fn,typedDependencies:se,createMatrixFromColumns:fp},vB={BigNumberDependencies:Ue,FractionDependencies:Ms,complexDependencies:Yy,typedDependencies:se,createSign:Fp},WC={addScalarDependencies:tn,complexDependencies:Yy,conjDependencies:Os,divideScalarDependencies:$r,equalDependencies:ea,identityDependencies:Ho,isZeroDependencies:ta,matrixDependencies:je,multiplyScalarDependencies:Hr,signDependencies:vB,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,zerosDependencies:Ea,createQr:Yv},HC={typedDependencies:se,createRe:Zp},jC={typedDependencies:se,createSin:Hm},KC={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createUsolve:Gh},gB={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createUsolveAll:Wh},yB={absDependencies:Qn,addDependencies:Ir,addScalarDependencies:tn,atanDependencies:K$,bignumberDependencies:Na,columnDependencies:aB,complexDependencies:Yy,cosDependencies:BC,diagDependencies:hB,divideScalarDependencies:$r,dotDependencies:Wy,equalDependencies:ea,flattenDependencies:Tc,imDependencies:GC,invDependencies:Rs,largerDependencies:Mi,matrixDependencies:je,matrixFromColumnsDependencies:UC,multiplyDependencies:kr,multiplyScalarDependencies:Hr,numberDependencies:Wo,qrDependencies:WC,reDependencies:HC,sinDependencies:jC,smallerDependencies:Ti,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,usolveDependencies:KC,usolveAllDependencies:gB,createEigs:og},Phe={BigNumberDependencies:Ue,UnitDependencies:xt,createElectricConstant:p0},Fhe={BigNumberDependencies:Ue,UnitDependencies:xt,createElectronMass:E0},$he={BigNumberDependencies:Ue,UnitDependencies:xt,createElementaryCharge:v0},Bhe={compareTextDependencies:oB,isZeroDependencies:ta,typedDependencies:se,createEqualText:rm},zhe={typedDependencies:se,createErf:Sh},bB={parseDependencies:ra,typedDependencies:se,createEvaluate:Wv},xB={typedDependencies:se,createExp:Cp},Lhe={absDependencies:Qn,addDependencies:Ir,identityDependencies:Ho,invDependencies:Rs,multiplyDependencies:kr,typedDependencies:se,createExpm:sg},Vhe={ComplexDependencies:Rr,typedDependencies:se,createExpm1:Sp},qhe={createFalse:Hg},Ghe={BigNumberDependencies:Ue,UnitDependencies:xt,createFaraday:L0},Uhe={BigNumberDependencies:Ue,UnitDependencies:xt,createFermiCoupling:N0},wB={ComplexDependencies:Rr,createI:o0},CB={ComplexDependencies:Rr,typedDependencies:se,createLog2:Tp},SB={BigNumberDependencies:Ue,createTau:Zg},DB={addScalarDependencies:tn,ceilDependencies:FC,conjDependencies:Os,divideScalarDependencies:$r,dotDivideDependencies:Mc,expDependencies:xB,iDependencies:wB,log2Dependencies:CB,matrixDependencies:je,multiplyScalarDependencies:Hr,powDependencies:_a,tauDependencies:SB,typedDependencies:se,createFft:wh},EB={largerDependencies:Mi,smallerDependencies:Ti,createFibonacciHeapClass:ym},Whe={typedDependencies:se,createFilter:ih},Hhe={typedDependencies:se,createFilterTransform:sy},jhe={BigNumberDependencies:Ue,createFineStructure:A0},Khe={BigNumberDependencies:Ue,UnitDependencies:xt,createFirstRadiation:V0},Yhe={typedDependencies:se,createForEach:oh},Xhe={typedDependencies:se,createForEachTransform:ly},Zhe={BigNumberDependencies:Ue,UnitDependencies:xt,createGasConstant:G0},Qhe={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createGcd:Np},Jhe={typedDependencies:se,createGetMatrixDataType:sh},eme={BigNumberDependencies:Ue,UnitDependencies:xt,createGravitationConstant:u0},tme={BigNumberDependencies:Ue,UnitDependencies:xt,createGravity:Q0},rme={BigNumberDependencies:Ue,UnitDependencies:xt,createHartreeEnergy:_0},nme={isNumericDependencies:Ts,typedDependencies:se,createHasNumericValue:Yf},NB={parseDependencies:ra,createHelpClass:Jv},ime={HelpDependencies:NB,typedDependencies:se,createHelp:tg},ame={formatDependencies:Ac,typedDependencies:se,createHex:Mh},ome={absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,isPositiveDependencies:Xy,multiplyScalarDependencies:Hr,smallerDependencies:Ti,sqrtDependencies:Ta,typedDependencies:se,createHypot:sv},sme={conjDependencies:Os,dotDivideDependencies:Mc,fftDependencies:DB,typedDependencies:se,createIfft:Ch},AB={IndexDependencies:$n,typedDependencies:se,createIndex:dv},lme={IndexDependencies:$n,createIndexTransform:uy},ume={BigNumberDependencies:Ue,createInfinity:Kg},cme={absDependencies:Qn,addDependencies:Ir,addScalarDependencies:tn,divideScalarDependencies:$r,equalScalarDependencies:Yt,flattenDependencies:Tc,isNumericDependencies:Ts,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,multiplyScalarDependencies:Hr,smallerDependencies:Ti,subtractDependencies:Nr,typedDependencies:se,createIntersect:hg},dme={BigNumberDependencies:Ue,UnitDependencies:xt,createInverseConductanceQuantum:b0},_B={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createMod:Rp},MB={BigNumberDependencies:Ue,matrixDependencies:je,typedDependencies:se,createXgcd:Lp},fme={BigNumberDependencies:Ue,addDependencies:Ir,equalDependencies:ea,isIntegerDependencies:_i,modDependencies:_B,smallerDependencies:Ti,typedDependencies:se,xgcdDependencies:MB,createInvmod:Vp},Oc={typedDependencies:se,createIsNaN:Qf},pme={typedDependencies:se,createIsPrime:Rh},YC={ComplexDependencies:Rr,divideScalarDependencies:$r,typedDependencies:se,createLog:$h},Zl={typedDependencies:se,createMap:ch},TB={addDependencies:Ir,numericDependencies:Ji,typedDependencies:se,createSum:pc},hme={divideDependencies:Oi,dotDivideDependencies:Mc,isNumericDependencies:Ts,logDependencies:YC,mapDependencies:Zl,matrixDependencies:je,multiplyDependencies:kr,sumDependencies:TB,typedDependencies:se,createKldivergence:Dg},mme={BigNumberDependencies:Ue,UnitDependencies:xt,createKlitzing:C0},vme={matrixDependencies:je,multiplyScalarDependencies:Hr,typedDependencies:se,createKron:uh},gme={BigNumberDependencies:Ue,createLN10:t0},yme={BigNumberDependencies:Ue,createLN2:e0},bme={BigNumberDependencies:Ue,createLOG10E:n0},xme={BigNumberDependencies:Ue,createLOG2E:r0},wme={concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createLcm:_p},Cme={parseDependencies:ra,typedDependencies:se,createLeafCount:kg},Sme={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createLeftShift:Hh},Dme={ComplexDependencies:Rr,typedDependencies:se,createLgamma:Cg},Eme={ComplexDependencies:Rr,typedDependencies:se,createLog10:Mp},Nme={ComplexDependencies:Rr,divideScalarDependencies:$r,logDependencies:YC,typedDependencies:se,createLog1p:Bh},Ame={BigNumberDependencies:Ue,UnitDependencies:xt,createLoschmidt:q0},OB={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createLsolve:qh},_me={DenseMatrixDependencies:Ft,divideScalarDependencies:$r,equalScalarDependencies:Yt,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,createLsolveAll:Uh},RB={FibonacciHeapDependencies:EB,addScalarDependencies:tn,equalScalarDependencies:Yt,createSpaClass:bm},IB={DenseMatrixDependencies:Ft,SpaDependencies:RB,SparseMatrixDependencies:oo,absDependencies:Qn,addScalarDependencies:tn,divideScalarDependencies:$r,equalScalarDependencies:Yt,largerDependencies:Mi,matrixDependencies:je,multiplyScalarDependencies:Hr,subtractDependencies:Nr,typedDependencies:se,unaryMinusDependencies:Aa,createLup:Kv},kB={SparseMatrixDependencies:oo,absDependencies:Qn,addDependencies:Ir,divideScalarDependencies:$r,largerDependencies:Mi,largerEqDependencies:Ky,multiplyDependencies:kr,subtractDependencies:Nr,transposeDependencies:_c,typedDependencies:se,createSlu:Xv},PB={DenseMatrixDependencies:Ft,lsolveDependencies:OB,lupDependencies:IB,matrixDependencies:je,sluDependencies:kB,typedDependencies:se,usolveDependencies:KC,createLusolve:Zv},XC={absDependencies:Qn,addDependencies:Ir,conjDependencies:Os,ctransposeDependencies:zC,eigsDependencies:yB,equalScalarDependencies:Yt,largerDependencies:Mi,matrixDependencies:je,multiplyDependencies:kr,powDependencies:_a,smallerDependencies:Ti,sqrtDependencies:Ta,typedDependencies:se,createNorm:lv},FB={identityDependencies:Ho,matrixDependencies:je,multiplyDependencies:kr,normDependencies:XC,qrDependencies:WC,subtractDependencies:Nr,typedDependencies:se,createSchur:cg},$B={absDependencies:Qn,addDependencies:Ir,concatDependencies:lr,identityDependencies:Ho,indexDependencies:AB,lusolveDependencies:PB,matrixDependencies:je,matrixFromColumnsDependencies:UC,multiplyDependencies:kr,rangeDependencies:jl,schurDependencies:FB,subsetDependencies:ci,subtractDependencies:Nr,transposeDependencies:_c,typedDependencies:se,createSylvester:ug},Mme={matrixDependencies:je,multiplyDependencies:kr,sylvesterDependencies:$B,transposeDependencies:_c,typedDependencies:se,createLyap:dg},ZC={compareDependencies:Kl,isNaNDependencies:Oc,isNumericDependencies:Ts,typedDependencies:se,createPartitionSelect:hm},BB={addDependencies:Ir,compareDependencies:Kl,divideDependencies:Oi,partitionSelectDependencies:ZC,typedDependencies:se,createMedian:vg},Tme={absDependencies:Qn,mapDependencies:Zl,medianDependencies:BB,subtractDependencies:Nr,typedDependencies:se,createMad:gg},Ome={BigNumberDependencies:Ue,UnitDependencies:xt,createMagneticConstant:f0},Rme={BigNumberDependencies:Ue,UnitDependencies:xt,createMagneticFluxQuantum:x0},Ime={typedDependencies:se,createMapTransform:cy},kme={isZeroDependencies:ta,matrixDependencies:je,typedDependencies:se,createMatrixFromFunction:cp},Pme={flattenDependencies:Tc,matrixDependencies:je,sizeDependencies:Fn,typedDependencies:se,createMatrixFromRows:dp},zB={largerDependencies:Mi,numericDependencies:Ji,typedDependencies:se,createMax:lc},Fme={largerDependencies:Mi,numericDependencies:Ji,typedDependencies:se,createMaxTransform:dy},$me={addDependencies:Ir,divideDependencies:Oi,typedDependencies:se,createMean:mc},Bme={addDependencies:Ir,divideDependencies:Oi,typedDependencies:se,createMeanTransform:fy},zme={numericDependencies:Ji,smallerDependencies:Ti,typedDependencies:se,createMin:uc},Lme={numericDependencies:Ji,smallerDependencies:Ti,typedDependencies:se,createMinTransform:py},Vme={isNaNDependencies:Oc,isNumericDependencies:Ts,typedDependencies:se,createMode:Dh},qme={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarMass:X0},Gme={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarMassC12:Z0},Ume={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarPlanckConstant:U0},Wme={BigNumberDependencies:Ue,UnitDependencies:xt,createMolarVolume:W0},Hme={addDependencies:Ir,divideDependencies:Oi,factorialDependencies:jy,isIntegerDependencies:_i,isPositiveDependencies:Xy,multiplyDependencies:kr,typedDependencies:se,createMultinomial:Eg},jme={BigNumberDependencies:Ue,createNaN:Yg},Kme={BigNumberDependencies:Ue,UnitDependencies:xt,createNeutronMass:O0},Yme={BigNumberDependencies:Ue,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createNthRoot:Pp},Xme={ComplexDependencies:Rr,divideScalarDependencies:$r,typedDependencies:se,createNthRoots:zh},Zme={BigNumberDependencies:Ue,UnitDependencies:xt,createNuclearMagneton:w0},Qme={createNull:jg},Jme={formatDependencies:Ac,typedDependencies:se,createOct:_h},eve={BigNumberDependencies:Ue,matrixDependencies:je,typedDependencies:se,createOnes:dh},tve={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createOr:Jp},LB={evaluateDependencies:bB,createParserClass:Hv},rve={ParserDependencies:LB,typedDependencies:se,createParser:jv},nve={factorialDependencies:jy,typedDependencies:se,createPermutations:Ng},ive={BigNumberDependencies:Ue,createPhi:Jg},VB={BigNumberDependencies:Ue,createPi:Xg},ave={typedDependencies:se,createPickRandom:Ag},ove={ComplexDependencies:Rr,addDependencies:Ir,ctransposeDependencies:zC,deepEqualDependencies:fB,divideScalarDependencies:$r,dotDependencies:Wy,dotDivideDependencies:Mc,equalDependencies:ea,invDependencies:Rs,matrixDependencies:je,multiplyDependencies:kr,typedDependencies:se,createPinv:ag},sve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckCharge:ry},lve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckConstant:c0},uve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckLength:J0},cve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckMass:ey},dve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckTemperature:ny},fve={BigNumberDependencies:Ue,UnitDependencies:xt,createPlanckTime:ty},qB={typedDependencies:se,createTypeOf:Jf},pve={addDependencies:Ir,cbrtDependencies:rB,divideDependencies:Oi,equalScalarDependencies:Yt,imDependencies:GC,isZeroDependencies:ta,multiplyDependencies:kr,reDependencies:HC,sqrtDependencies:Ta,subtractDependencies:Nr,typeOfDependencies:qB,typedDependencies:se,unaryMinusDependencies:Aa,createPolynomialRoot:Qv},hve={typedDependencies:se,createPrint:Th},mve={BigNumberDependencies:Ue,UnitDependencies:xt,createProtonMass:M0},vve={addDependencies:Ir,compareDependencies:Kl,multiplyDependencies:kr,partitionSelectDependencies:ZC,typedDependencies:se,createQuantileSeq:yg},gve={BigNumberDependencies:Ue,UnitDependencies:xt,createQuantumOfCirculation:R0},yve={typedDependencies:se,createRandom:_g},bve={typedDependencies:se,createRandomInt:Mg},xve={createRangeClass:$f},wve={bignumberDependencies:Na,matrixDependencies:je,largerDependencies:Mi,largerEqDependencies:Ky,smallerDependencies:Ti,smallerEqDependencies:$C,typedDependencies:se,createRangeTransform:hy},Cve={bignumberDependencies:Na,fractionDependencies:Wl,AccessorNodeDependencies:Gl,ArrayNodeDependencies:Ul,ConstantNodeDependencies:jo,FunctionNodeDependencies:Yo,IndexNodeDependencies:Yl,ObjectNodeDependencies:Xl,OperatorNodeDependencies:so,ParenthesisNodeDependencies:Is,SymbolNodeDependencies:Ko,addDependencies:Ir,divideDependencies:Oi,equalDependencies:ea,isZeroDependencies:ta,matrixDependencies:je,multiplyDependencies:kr,parseDependencies:ra,powDependencies:_a,simplifyDependencies:Zy,simplifyConstantDependencies:VC,simplifyCoreDependencies:qC,subtractDependencies:Nr,typedDependencies:se,createRationalize:qg},Sve={BigNumberDependencies:Ue,UnitDependencies:xt,createReducedPlanckConstant:d0},Dve={createReplacer:Ug},Eve={isIntegerDependencies:_i,matrixDependencies:je,typedDependencies:se,createReshape:fh},Nve={matrixDependencies:je,createResize:ph},Ave={createReviver:Gg},_ve={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createRightArithShift:jh},Mve={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,zerosDependencies:Ea,createRightLogShift:Kh},GB={BigNumberDependencies:Ue,DenseMatrixDependencies:Ft,SparseMatrixDependencies:oo,addScalarDependencies:tn,cosDependencies:BC,matrixDependencies:je,multiplyScalarDependencies:Hr,normDependencies:XC,sinDependencies:jC,typedDependencies:se,unaryMinusDependencies:Aa,createRotationMatrix:mh},Tve={multiplyDependencies:kr,rotationMatrixDependencies:GB,typedDependencies:se,createRotate:hh},Ove={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createRow:ac},Rve={IndexDependencies:$n,matrixDependencies:je,rangeDependencies:jl,typedDependencies:se,createRowTransform:my},Ive={BigNumberDependencies:Ue,UnitDependencies:xt,createRydberg:I0},kve={BigNumberDependencies:Ue,createSQRT1_2:i0},Pve={BigNumberDependencies:Ue,createSQRT2:a0},Fve={BigNumberDependencies:Ue,createSackurTetrode:H0},$ve={BigNumberDependencies:Ue,typedDependencies:se,createSec:Um},Bve={BigNumberDependencies:Ue,typedDependencies:se,createSech:Wm},zve={BigNumberDependencies:Ue,UnitDependencies:xt,createSecondRadiation:j0},Lve={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetCartesian:Xm},UB={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetDifference:Zm},Vve={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetDistinct:Qm},WB={DenseMatrixDependencies:Ft,IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetIntersect:Jm},qve={IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetIsSubset:ev},Gve={IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetMultiplicity:tv},Uve={IndexDependencies:$n,compareNaturalDependencies:Ma,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetPowerset:rv},Wve={compareNaturalDependencies:Ma,typedDependencies:se,createSetSize:nv},HB={IndexDependencies:$n,concatDependencies:lr,setDifferenceDependencies:UB,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetSymDifference:iv},Hve={IndexDependencies:$n,concatDependencies:lr,setIntersectDependencies:WB,setSymDifferenceDependencies:HB,sizeDependencies:Fn,subsetDependencies:ci,typedDependencies:se,createSetUnion:av},jve={typedDependencies:se,createSinh:jm},Kve={compareDependencies:Kl,compareNaturalDependencies:Ma,matrixDependencies:je,typedDependencies:se,createSort:mm},Yve={SparseMatrixDependencies:oo,typedDependencies:se,createSparse:Sm},Xve={BigNumberDependencies:Ue,UnitDependencies:xt,createSpeedOfLight:l0},Zve={typedDependencies:se,createSplitUnit:pp},Qve={absDependencies:Qn,addDependencies:Ir,identityDependencies:Ho,invDependencies:Rs,mapDependencies:Zl,maxDependencies:zB,multiplyDependencies:kr,sizeDependencies:Fn,sqrtDependencies:Ta,subtractDependencies:Nr,typedDependencies:se,createSqrtm:lg},Jve={typedDependencies:se,createSquare:Bp},ege={matrixDependencies:je,typedDependencies:se,createSqueeze:gh},QC={addDependencies:Ir,applyDependencies:PC,divideDependencies:Oi,isNaNDependencies:Oc,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,createVariance:vc},tge={mapDependencies:Zl,sqrtDependencies:Ta,typedDependencies:se,varianceDependencies:QC,createStd:gc},rge={mapDependencies:Zl,sqrtDependencies:Ta,typedDependencies:se,varianceDependencies:QC,createStdTransform:by},nge={BigNumberDependencies:Ue,UnitDependencies:xt,createStefanBoltzmann:K0},ige={typedDependencies:se,createString:ip},age={matrixDependencies:je,typedDependencies:se,createSubsetTransform:vy},oge={addDependencies:Ir,numericDependencies:Ji,typedDependencies:se,createSumTransform:xy},sge={OperatorNodeDependencies:so,parseDependencies:ra,simplifyDependencies:Zy,typedDependencies:se,createSymbolicEqual:Lg},lge={typedDependencies:se,createTan:Km},uge={typedDependencies:se,createTanh:Ym},cge={BigNumberDependencies:Ue,UnitDependencies:xt,createThomsonCrossSection:k0},dge={concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createTo:Oh},fge={addDependencies:Ir,matrixDependencies:je,typedDependencies:se,createTrace:cv},pge={createTrue:Wg},hge={DenseMatrixDependencies:Ft,concatDependencies:lr,equalScalarDependencies:Yt,matrixDependencies:je,typedDependencies:se,createUnequal:pm},mge={UnitDependencies:xt,typedDependencies:se,createUnitFunction:Cm},vge={eDependencies:mB,createUppercaseE:Rw},gge={piDependencies:VB,createUppercasePi:Ow},yge={BigNumberDependencies:Ue,UnitDependencies:xt,createVacuumImpedance:h0},bge={addDependencies:Ir,applyDependencies:PC,divideDependencies:Oi,isNaNDependencies:Oc,multiplyDependencies:kr,subtractDependencies:Nr,typedDependencies:se,createVarianceTransform:Cy},xge={createVersion:s0},wge={BigNumberDependencies:Ue,createWeakMixingAngle:P0},Cge={BigNumberDependencies:Ue,UnitDependencies:xt,createWienDisplacement:Y0},Sge={DenseMatrixDependencies:Ft,concatDependencies:lr,matrixDependencies:je,typedDependencies:se,createXor:eh},Dge=Ope,JC={exports:{}};function eS(){}eS.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;for(n;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var a=0,o=n.length;a<o;a++)n[a].fn!==t&&n[a].fn._!==t&&i.push(n[a]);return i.length?r[e]=i:delete r[e],this}},JC.exports=eS,JC.exports.TinyEmitter=eS;function Ege(e){var t=new JC.exports;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 Nge(e,t,r,n){function i(y,b){var D=arguments.length;if(D!==1&&D!==2)throw new wa("import",D,1,2);b||(b={});function x(E,A,_){if(Array.isArray(A))A.forEach(R=>x(E,R));else if(typeof A=="object")for(var N in A)et(A,N)&&x(E,A[N],N);else if(Yu(A)||_!==void 0){var M=Yu(A)?m(A)?A.fn+".transform":A.fn:_;if(et(E,M)&&E[M]!==A&&!b.silent)throw new Error('Cannot import "'+M+'" twice');E[M]=A}else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}var S={};x(S,y);for(var w in S)if(et(S,w)){var C=S[w];if(Yu(C))u(C,b);else if(c(C))a(w,C,b);else if(!b.silent)throw new TypeError("Factory, Object, or Array expected")}}function a(y,b,D){if(D.wrap&&typeof b=="function"&&(b=l(b)),d(b)&&(b=e(y,{[b.signature]:b})),e.isTypedFunction(r[y])&&e.isTypedFunction(b)){D.override?b=e(y,b.signatures):b=e(r[y],b),r[y]=b,delete n[y],o(y,b),r.emit("import",y,function(){return b});return}if(r[y]===void 0||D.override){r[y]=b,delete n[y],o(y,b),r.emit("import",y,function(){return b});return}if(!D.silent)throw new Error('Cannot import "'+y+'": already exists')}function o(y,b){b&&typeof b.transform=="function"?(r.expression.transform[y]=b.transform,f(y)&&(r.expression.mathWithTransform[y]=b.transform)):(delete r.expression.transform[y],f(y)&&(r.expression.mathWithTransform[y]=b))}function s(y){delete r.expression.transform[y],f(y)?r.expression.mathWithTransform[y]=r[y]:delete r.expression.mathWithTransform[y]}function l(y){var b=function(){for(var x=[],S=0,w=arguments.length;S<w;S++){var C=arguments[S];x[S]=C&&C.valueOf()}return y.apply(r,x)};return y.transform&&(b.transform=y.transform),b}function u(y,b){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.fn;if(FM(D,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(D));var x=m(y)?r.expression.transform:r,S=D in r.expression.transform,w=et(x,D)?x[D]:void 0,C=function(){var A={};y.dependencies.map($M).forEach(N=>{if(FM(N,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(N));N==="math"?A.math=r:N==="mathWithTransform"?A.mathWithTransform=r.expression.mathWithTransform:N==="classes"?A.classes=r:A[N]=r[N]});var _=y(A);if(_&&typeof _.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(w===void 0||b.override)return _;if(e.isTypedFunction(w)&&e.isTypedFunction(_))return e(w,_);if(b.silent)return w;throw new Error('Cannot import "'+D+'": already exists')};!y.meta||y.meta.lazy!==!1?(vf(x,D,C),w&&S?s(D):(m(y)||p(y))&&vf(r.expression.mathWithTransform,D,()=>x[D])):(x[D]=C(),w&&S?s(D):(m(y)||p(y))&&vf(r.expression.mathWithTransform,D,()=>x[D])),n[D]=y,r.emit("import",D,C)}function c(y){return typeof y=="function"||typeof y=="number"||typeof y=="string"||typeof y=="boolean"||y===null||bi(y)||yi(y)||kt(y)||Mo(y)||ft(y)||Array.isArray(y)}function d(y){return typeof y=="function"&&typeof y.signature=="string"}function f(y){return!et(v,y)}function p(y){return y.fn.indexOf(".")===-1&&!et(v,y.fn)&&(!y.meta||!y.meta.isClass)}function m(y){return y!==void 0&&y.meta!==void 0&&y.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return i}function jB(e,t){var r=fn({},pf,t);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=Ege({isNumber:Ut,isComplex:yi,isBigNumber:kt,isFraction:Mo,isUnit:bi,isString:bn,isArray:or,isMatrix:ft,isCollection:xi,isDenseMatrix:hl,isSparseMatrix:ja,isRange:Uu,isIndex:ml,isBoolean:Tx,isResultSet:Ox,isHelp:hf,isFunction:Rx,isDate:Ix,isRegExp:kx,isObject:Wu,isNull:Px,isUndefined:Fx,isAccessorNode:Ka,isArrayNode:Yn,isAssignmentNode:$x,isBlockNode:Bx,isConditionalNode:zx,isConstantNode:Kt,isFunctionAssignmentNode:hs,isFunctionNode:ya,isIndexNode:To,isNode:sr,isObjectNode:vl,isOperatorNode:Wr,isParenthesisNode:zi,isRangeNode:Vx,isRelationalNode:qx,isSymbolNode:en,isChain:mf});n.config=pJ(r,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var i=[],a=[];function o(c){if(Yu(c))return c(n);var d=c[Object.keys(c)[0]];if(Yu(d))return d(n);if(!dJ(c))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",c),new Error("Factory object with properties `type`, `name`, and `factory` expected");var f=i.indexOf(c),p;return f===-1?(c.math===!0?p=c.factory(n.type,r,o,n.typed,n):p=c.factory(n.type,r,o,n.typed),i.push(c),a.push(p)):p=a[f],p}var s={};function l(){for(var c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];return n.typed.apply(n.typed,d)}l.isTypedFunction=Wx.isTypedFunction;var u=Nge(l,o,n,s);return n.import=u,n.on("config",()=>{gM(s).forEach(c=>{c&&c.meta&&c.meta.recreateOnConfigChange&&u(c,{override:!0})})}),n.create=jB.bind(null,e),n.factory=Q,n.import(gM(cJ(e))),n.ArgumentsError=wa,n.DimensionError=Ot,n.IndexError=ii,n}const Age=Object.freeze(Object.defineProperty({__proto__:null,config:Ie,IndexError:ii,DimensionError:Ot,ArgumentsError:wa,create:jB,factory:Q,BigNumber:Ge,Complex:Sr,e:kw,_false:wk,fineStructure:Ck,Fraction:Lo,i:Pw,_Infinity:Sk,LN10:Dk,LOG10E:Ek,Matrix:yc,_NaN:Nk,_null:Ak,phi:_k,Range:Mk,ResultSet:Fw,SQRT1_2:Tk,sackurTetrode:Ok,tau:$w,_true:Rk,version:Ik,DenseMatrix:Rt,efimovFactor:kk,LN2:Pk,pi:Bw,replacer:Fk,SQRT2:$k,typed:oe,unaryPlus:Sy,weakMixingAngle:Bk,abs:Un,acos:zk,acot:Lk,acsc:Vk,addScalar:Yr,arg:qk,asech:Gk,asinh:Uk,atan:zw,atanh:Wk,bignumber:ji,bitNot:Hk,boolean:jk,clone:Kk,combinations:bc,complex:xc,conj:Vo,cosh:Yk,coth:Xk,csc:Zk,cube:Qk,equalScalar:jt,erf:Jk,exp:Lw,expm1:eP,filter:tP,forEach:rP,format:Fl,getMatrixDataType:nP,hex:iP,im:Dy,isInteger:oi,isNegative:xs,isPositive:wc,isZero:Di,LOG2E:aP,lgamma:oP,log10:sP,log2:Vw,map:ws,multiplyScalar:Vr,not:qw,number:to,oct:lP,pickRandom:uP,print:cP,random:dP,re:Ey,sec:fP,sign:Gw,sin:Ny,SparseMatrix:Sa,splitUnit:pP,square:hP,string:mP,tan:vP,typeOf:Uw,acosh:gP,acsch:yP,apply:Ay,asec:bP,bin:xP,combinationsWithRep:wP,cos:_y,csch:CP,isNaN:$l,isPrime:SP,randomInt:DP,sech:EP,sinh:NP,sparse:AP,sqrt:Ki,tanh:_P,unaryMinus:Yi,acoth:MP,cot:TP,fraction:Cs,isNumeric:qo,matrix:We,matrixFromFunction:OP,mode:RP,numeric:Ei,prod:Ww,reshape:IP,size:Sn,squeeze:kP,subset:Zn,transpose:Bl,xgcd:Hw,zeros:Xi,asin:PP,cbrt:jw,concat:nr,count:FP,ctranspose:My,diag:Kw,divideScalar:Fr,dotDivide:zl,equal:Ni,flatten:Ll,gcd:$P,hasNumericValue:BP,identity:ro,kron:zP,largerEq:Cc,leftShift:LP,matrixFromColumns:Ty,mod:Yw,nthRoot:VP,ones:qP,resize:GP,rightArithShift:UP,round:Sc,smaller:si,to:WP,unequal:HP,xor:jP,add:Dr,bitAnd:KP,bitXor:YP,catalan:XP,compare:Ss,compareText:Xw,cumsum:ZP,deepEqual:Zw,dot:Dc,equalText:QP,floor:Qw,hypot:JP,ImmutableDenseMatrix:Jw,Index:Dn,invmod:eF,larger:li,log:Oy,matrixFromRows:tF,min:rF,multiply:Er,nthRoots:nF,or:iF,partitionSelect:Ry,quantileSeq:aF,rightLogShift:oF,smallerEq:Iy,subtract:gr,trace:sF,usolve:ky,and:lF,bitOr:uF,ceil:Py,compareNatural:Zi,composition:cF,cross:dF,det:eC,diff:fF,distance:pF,dotMultiply:hF,FibonacciHeap:tC,fix:rC,index:nC,intersect:mF,lcm:vF,log1p:gF,lsolve:iC,max:aC,qr:Fy,range:Ds,row:yF,setCartesian:bF,setDistinct:xF,setIsSubset:wF,setPowerset:CF,slu:oC,Spa:sC,sum:lC,usolveAll:uC,atan2:SF,column:cC,lsolveAll:DF,setDifference:dC,setMultiplicity:EF,setSymDifference:fC,sort:NF,inv:Go,lup:pC,pinv:AF,pow:Qi,setIntersect:hC,setUnion:_F,sqrtm:MF,Unit:yt,vacuumImpedance:TF,wienDisplacement:OF,atomicMass:RF,bohrMagneton:IF,boltzmann:kF,conductanceQuantum:PF,createUnit:FF,deuteronMass:$F,dotPow:BF,electricConstant:zF,elementaryCharge:LF,expm:VF,faraday:qF,fft:mC,gamma:vC,gravitationConstant:GF,hartreeEnergy:UF,ifft:WF,klitzing:HF,loschmidt:jF,magneticConstant:KF,molarMass:YF,molarPlanckConstant:XF,neutronMass:ZF,nuclearMagneton:QF,planckCharge:JF,planckLength:e$,planckTemperature:t$,protonMass:r$,reducedPlanckConstant:n$,rydberg:i$,secondRadiation:a$,speedOfLight:o$,stefanBoltzmann:s$,thomsonCrossSection:l$,avogadro:u$,bohrRadius:c$,coulomb:d$,divide:ui,electronMass:f$,factorial:Ec,firstRadiation:p$,gasConstant:h$,inverseConductanceQuantum:m$,lusolve:gC,magneticFluxQuantum:v$,molarMassC12:g$,multinomial:y$,permutations:b$,planckMass:x$,polynomialRoot:w$,setSize:C$,stirlingS2:yC,unit:S$,bellNumbers:D$,eigs:bC,fermiCoupling:E$,gravity:N$,kldivergence:A$,mean:xC,molarVolume:_$,planckConstant:M$,quantumOfCirculation:T$,variance:$y,classicalElectronRadius:O$,median:wC,planckTime:R$,std:By,mad:I$,norm:zy,rotationMatrix:CC,rotate:k$,schur:SC,sylvester:DC,lyap:P$,docs:y3,Node:En,ObjectNode:Es,OperatorNode:Da,ParenthesisNode:Uo,RelationalNode:EC,ArrayNode:Ns,BlockNode:NC,ConditionalNode:AC,ConstantNode:no,RangeNode:_C,reviver:$$,Chain:Ly,FunctionAssignmentNode:MC,chain:B$,AccessorNode:As,IndexNode:_s,AssignmentNode:TC,SymbolNode:io,FunctionNode:ao,parse:Ai,resolve:OC,simplifyConstant:Vy,compile:z$,evaluate:RC,Help:IC,Parser:kC,simplifyCore:qy,help:L$,simplify:Nc,symbolicEqual:V$,derivative:q$,parser:G$,leafCount:U$,rationalize:W$,isAccessorNode:Ka,isArray:or,isArrayNode:Yn,isAssignmentNode:$x,isBigNumber:kt,isBlockNode:Bx,isBoolean:Tx,isChain:mf,isCollection:xi,isComplex:yi,isConditionalNode:zx,isConstantNode:Kt,isDate:Ix,isDenseMatrix:hl,isFraction:Mo,isFunction:Rx,isFunctionAssignmentNode:hs,isFunctionNode:ya,isHelp:hf,isIndex:ml,isIndexNode:To,isMatrix:ft,isNode:sr,isNull:Px,isNumber:Ut,isString:bn,isUndefined:Fx,isObject:Wu,isObjectNode:vl,isOperatorNode:Wr,isParenthesisNode:zi,isRange:Uu,isRangeNode:Vx,isRelationalNode:qx,isRegExp:kx,isResultSet:Ox,isSparseMatrix:ja,isSymbolNode:en,isUnit:bi,absDependencies:Qn,AccessorNodeDependencies:Gl,acosDependencies:Rpe,acoshDependencies:Ipe,acotDependencies:kpe,acothDependencies:Ppe,acscDependencies:Fpe,acschDependencies:$pe,addDependencies:Ir,addScalarDependencies:tn,andDependencies:Bpe,applyDependencies:PC,applyTransformDependencies:zpe,argDependencies:Lpe,ArrayNodeDependencies:Ul,asecDependencies:Vpe,asechDependencies:qpe,asinDependencies:Gpe,asinhDependencies:Upe,AssignmentNodeDependencies:j$,atanDependencies:K$,atan2Dependencies:Wpe,atanhDependencies:Hpe,atomicMassDependencies:jpe,avogadroDependencies:Kpe,bellNumbersDependencies:Ype,BigNumberDependencies:Ue,bignumberDependencies:Na,binDependencies:Xpe,bitAndDependencies:Zpe,bitNotDependencies:Qpe,bitOrDependencies:Jpe,bitXorDependencies:ehe,BlockNodeDependencies:tB,bohrMagnetonDependencies:the,bohrRadiusDependencies:rhe,boltzmannDependencies:nhe,booleanDependencies:ihe,catalanDependencies:ahe,cbrtDependencies:rB,ceilDependencies:FC,chainDependencies:ohe,ChainDependencies:nB,classicalElectronRadiusDependencies:she,cloneDependencies:lhe,columnDependencies:aB,columnTransformDependencies:uhe,combinationsDependencies:Hy,combinationsWithRepDependencies:che,compareDependencies:Kl,compareNaturalDependencies:Ma,compareTextDependencies:oB,compileDependencies:dhe,complexDependencies:Yy,ComplexDependencies:Rr,compositionDependencies:fhe,concatDependencies:lr,concatTransformDependencies:phe,ConditionalNodeDependencies:sB,conductanceQuantumDependencies:hhe,conjDependencies:Os,ConstantNodeDependencies:jo,cosDependencies:BC,coshDependencies:mhe,cotDependencies:vhe,cothDependencies:ghe,coulombDependencies:yhe,countDependencies:bhe,createUnitDependencies:xhe,crossDependencies:whe,cscDependencies:Che,cschDependencies:She,ctransposeDependencies:zC,cubeDependencies:Dhe,cumsumDependencies:Ehe,cumsumTransformDependencies:Nhe,deepEqualDependencies:fB,DenseMatrixDependencies:Ft,derivativeDependencies:Ahe,detDependencies:Z$,deuteronMassDependencies:_he,diagDependencies:hB,diffDependencies:Mhe,diffTransformDependencies:The,distanceDependencies:Ohe,divideDependencies:Oi,divideScalarDependencies:$r,dotDependencies:Wy,dotDivideDependencies:Mc,dotMultiplyDependencies:Rhe,dotPowDependencies:Ihe,eDependencies:mB,efimovFactorDependencies:khe,eigsDependencies:yB,electricConstantDependencies:Phe,electronMassDependencies:Fhe,elementaryChargeDependencies:$he,equalDependencies:ea,equalScalarDependencies:Yt,equalTextDependencies:Bhe,erfDependencies:zhe,evaluateDependencies:bB,expDependencies:xB,expmDependencies:Lhe,expm1Dependencies:Vhe,factorialDependencies:jy,falseDependencies:qhe,faradayDependencies:Ghe,fermiCouplingDependencies:Uhe,fftDependencies:DB,FibonacciHeapDependencies:EB,filterDependencies:Whe,filterTransformDependencies:Hhe,fineStructureDependencies:jhe,firstRadiationDependencies:Khe,fixDependencies:X$,flattenDependencies:Tc,floorDependencies:Y$,forEachDependencies:Yhe,forEachTransformDependencies:Xhe,formatDependencies:Ac,fractionDependencies:Wl,FractionDependencies:Ms,FunctionAssignmentNodeDependencies:lB,FunctionNodeDependencies:Yo,gammaDependencies:Q$,gasConstantDependencies:Zhe,gcdDependencies:Qhe,getMatrixDataTypeDependencies:Jhe,gravitationConstantDependencies:eme,gravityDependencies:tme,hartreeEnergyDependencies:rme,hasNumericValueDependencies:nme,helpDependencies:ime,HelpDependencies:NB,hexDependencies:ame,hypotDependencies:ome,iDependencies:wB,identityDependencies:Ho,ifftDependencies:sme,imDependencies:GC,ImmutableDenseMatrixDependencies:iB,indexDependencies:AB,IndexDependencies:$n,IndexNodeDependencies:Yl,indexTransformDependencies:lme,InfinityDependencies:ume,intersectDependencies:cme,invDependencies:Rs,inverseConductanceQuantumDependencies:dme,invmodDependencies:fme,isIntegerDependencies:_i,isNaNDependencies:Oc,isNegativeDependencies:Hl,isNumericDependencies:Ts,isPositiveDependencies:Xy,isPrimeDependencies:pme,isZeroDependencies:ta,kldivergenceDependencies:hme,klitzingDependencies:mme,kronDependencies:vme,LN10Dependencies:gme,LN2Dependencies:yme,LOG10EDependencies:bme,LOG2EDependencies:xme,largerDependencies:Mi,largerEqDependencies:Ky,lcmDependencies:wme,leafCountDependencies:Cme,leftShiftDependencies:Sme,lgammaDependencies:Dme,logDependencies:YC,log10Dependencies:Eme,log1pDependencies:Nme,log2Dependencies:CB,loschmidtDependencies:Ame,lsolveDependencies:OB,lsolveAllDependencies:_me,lupDependencies:IB,lusolveDependencies:PB,lyapDependencies:Mme,madDependencies:Tme,magneticConstantDependencies:Ome,magneticFluxQuantumDependencies:Rme,mapDependencies:Zl,mapTransformDependencies:Ime,matrixDependencies:je,MatrixDependencies:Gy,matrixFromColumnsDependencies:UC,matrixFromFunctionDependencies:kme,matrixFromRowsDependencies:Pme,maxDependencies:zB,maxTransformDependencies:Fme,meanDependencies:$me,meanTransformDependencies:Bme,medianDependencies:BB,minDependencies:zme,minTransformDependencies:Lme,modDependencies:_B,modeDependencies:Vme,molarMassDependencies:qme,molarMassC12Dependencies:Gme,molarPlanckConstantDependencies:Ume,molarVolumeDependencies:Wme,multinomialDependencies:Hme,multiplyDependencies:kr,multiplyScalarDependencies:Hr,NaNDependencies:jme,neutronMassDependencies:Kme,NodeDependencies:Pn,normDependencies:XC,notDependencies:H$,nthRootDependencies:Yme,nthRootsDependencies:Xme,nuclearMagnetonDependencies:Zme,nullDependencies:Qme,numberDependencies:Wo,numericDependencies:Ji,ObjectNodeDependencies:Xl,octDependencies:Jme,onesDependencies:eve,OperatorNodeDependencies:so,orDependencies:tve,ParenthesisNodeDependencies:Is,parseDependencies:ra,parserDependencies:rve,ParserDependencies:LB,partitionSelectDependencies:ZC,permutationsDependencies:nve,phiDependencies:ive,piDependencies:VB,pickRandomDependencies:ave,pinvDependencies:ove,planckChargeDependencies:sve,planckConstantDependencies:lve,planckLengthDependencies:uve,planckMassDependencies:cve,planckTemperatureDependencies:dve,planckTimeDependencies:fve,polynomialRootDependencies:pve,powDependencies:_a,printDependencies:hve,prodDependencies:dB,protonMassDependencies:mve,qrDependencies:WC,quantileSeqDependencies:vve,quantumOfCirculationDependencies:gve,randomDependencies:yve,randomIntDependencies:bve,rangeDependencies:jl,RangeDependencies:xve,RangeNodeDependencies:uB,rangeTransformDependencies:wve,rationalizeDependencies:Cve,reDependencies:HC,reducedPlanckConstantDependencies:Sve,RelationalNodeDependencies:cB,replacerDependencies:Dve,reshapeDependencies:Eve,resizeDependencies:Nve,resolveDependencies:pB,ResultSetDependencies:eB,reviverDependencies:Ave,rightArithShiftDependencies:_ve,rightLogShiftDependencies:Mve,rotateDependencies:Tve,rotationMatrixDependencies:GB,roundDependencies:Uy,rowDependencies:Ove,rowTransformDependencies:Rve,rydbergDependencies:Ive,SQRT1_2Dependencies:kve,SQRT2Dependencies:Pve,sackurTetrodeDependencies:Fve,schurDependencies:FB,secDependencies:$ve,sechDependencies:Bve,secondRadiationDependencies:zve,setCartesianDependencies:Lve,setDifferenceDependencies:UB,setDistinctDependencies:Vve,setIntersectDependencies:WB,setIsSubsetDependencies:qve,setMultiplicityDependencies:Gve,setPowersetDependencies:Uve,setSizeDependencies:Wve,setSymDifferenceDependencies:HB,setUnionDependencies:Hve,signDependencies:vB,simplifyDependencies:Zy,simplifyConstantDependencies:VC,simplifyCoreDependencies:qC,sinDependencies:jC,sinhDependencies:jve,sizeDependencies:Fn,sluDependencies:kB,smallerDependencies:Ti,smallerEqDependencies:$C,sortDependencies:Kve,SpaDependencies:RB,sparseDependencies:Yve,SparseMatrixDependencies:oo,speedOfLightDependencies:Xve,splitUnitDependencies:Zve,sqrtDependencies:Ta,sqrtmDependencies:Qve,squareDependencies:Jve,squeezeDependencies:ege,stdDependencies:tge,stdTransformDependencies:rge,stefanBoltzmannDependencies:nge,stirlingS2Dependencies:J$,stringDependencies:ige,subsetDependencies:ci,subsetTransformDependencies:age,subtractDependencies:Nr,sumDependencies:TB,sumTransformDependencies:oge,sylvesterDependencies:$B,SymbolNodeDependencies:Ko,symbolicEqualDependencies:sge,tanDependencies:lge,tanhDependencies:uge,tauDependencies:SB,thomsonCrossSectionDependencies:cge,toDependencies:dge,traceDependencies:fge,transposeDependencies:_c,trueDependencies:pge,typeOfDependencies:qB,typedDependencies:se,unaryMinusDependencies:Aa,unaryPlusDependencies:LC,unequalDependencies:hge,UnitDependencies:xt,unitDependencies:mge,EDependencies:vge,PIDependencies:gge,usolveDependencies:KC,usolveAllDependencies:gB,vacuumImpedanceDependencies:yge,varianceDependencies:QC,varianceTransformDependencies:bge,versionDependencies:xge,weakMixingAngleDependencies:wge,wienDisplacementDependencies:Cge,xgcdDependencies:MB,xorDependencies:Sge,zerosDependencies:Ea,all:Dge,createTyped:Df,createResultSet:Nf,createBigNumberClass:kf,createComplexClass:Pf,createFractionClass:Ff,createRangeClass:$f,createMatrixClass:Bf,createDenseMatrixClass:zf,createClone:Lf,createIsInteger:Gf,createIsNegative:jf,createIsNumeric:Kf,createHasNumericValue:Yf,createIsPositive:Xf,createIsZero:Zf,createIsNaN:Qf,createTypeOf:Jf,createEqualScalar:tp,createSparseMatrixClass:rp,createNumber:np,createString:ip,createBoolean:ap,createBignumber:op,createComplex:sp,createFraction:lp,createMatrix:up,createMatrixFromFunction:cp,createMatrixFromRows:dp,createMatrixFromColumns:fp,createSplitUnit:pp,createUnaryMinus:hp,createUnaryPlus:mp,createAbs:vp,createApply:Ju,createAddScalar:yp,createCbrt:bp,createCeil:xp,createCube:wp,createExp:Cp,createExpm1:Sp,createFix:Dp,createFloor:Ep,createGcd:Np,createLcm:_p,createLog10:Mp,createLog2:Tp,createMod:Rp,createMultiplyScalar:Ip,createMultiply:kp,createNthRoot:Pp,createSign:Fp,createSqrt:$p,createSquare:Bp,createSubtract:zp,createXgcd:Lp,createInvmod:Vp,createDotMultiply:qp,createBitAnd:Up,createBitNot:Wp,createBitOr:Hp,createBitXor:jp,createArg:Kp,createConj:Yp,createIm:Xp,createRe:Zp,createNot:Qp,createOr:Jp,createXor:eh,createConcat:tc,createColumn:rc,createCount:th,createCross:rh,createDiag:nh,createFilter:ih,createFlatten:ah,createForEach:oh,createGetMatrixDataType:sh,createIdentity:lh,createKron:uh,createMap:ch,createDiff:nc,createOnes:dh,createRange:ic,createReshape:fh,createResize:ph,createRotate:hh,createRotationMatrix:mh,createRow:ac,createSize:vh,createSqueeze:gh,createSubset:oc,createTranspose:yh,createCtranspose:bh,createZeros:xh,createFft:wh,createIfft:Ch,createErf:Sh,createMode:Dh,createProd:Eh,createFormat:Nh,createBin:Ah,createOct:_h,createHex:Mh,createPrint:Th,createTo:Oh,createIsPrime:Rh,createNumeric:Ih,createDivideScalar:kh,createPow:Ph,createRound:Fh,createLog:$h,createLog1p:Bh,createNthRoots:zh,createDotPow:Lh,createDotDivide:Vh,createLsolve:qh,createUsolve:Gh,createLsolveAll:Uh,createUsolveAll:Wh,createLeftShift:Hh,createRightArithShift:jh,createRightLogShift:Kh,createAnd:Yh,createCompare:Zh,createCompareNatural:Qh,createCompareText:Jh,createEqual:tm,createEqualText:rm,createSmaller:im,createSmallerEq:om,createLarger:lm,createLargerEq:cm,createDeepEqual:dm,createUnequal:pm,createPartitionSelect:hm,createSort:mm,createMax:lc,createMin:uc,createImmutableDenseMatrixClass:vm,createIndexClass:gm,createFibonacciHeapClass:ym,createSpaClass:bm,createUnitClass:wm,createUnitFunction:Cm,createSparse:Sm,createCreateUnit:Dm,createAcos:Em,createAcosh:Nm,createAcot:Am,createAcoth:_m,createAcsc:Mm,createAcsch:Tm,createAsec:Om,createAsech:Rm,createAsin:Im,createAsinh:km,createAtan:Pm,createAtan2:Fm,createAtanh:$m,createCos:Bm,createCosh:zm,createCot:Lm,createCoth:Vm,createCsc:qm,createCsch:Gm,createSec:Um,createSech:Wm,createSin:Hm,createSinh:jm,createTan:Km,createTanh:Ym,createSetCartesian:Xm,createSetDifference:Zm,createSetDistinct:Qm,createSetIntersect:Jm,createSetIsSubset:ev,createSetMultiplicity:tv,createSetPowerset:rv,createSetSize:nv,createSetSymDifference:iv,createSetUnion:av,createAdd:ov,createHypot:sv,createNorm:lv,createDot:uv,createTrace:cv,createIndex:dv,createNode:fv,createAccessorNode:hv,createArrayNode:vv,createAssignmentNode:bv,createBlockNode:wv,createConditionalNode:Sv,createConstantNode:Ev,createFunctionAssignmentNode:Av,createIndexNode:Mv,createObjectNode:Ov,createOperatorNode:Iv,createParenthesisNode:Pv,createRangeNode:$v,createRelationalNode:zv,createSymbolNode:Lv,createFunctionNode:qv,createParse:Gv,createCompile:Uv,createEvaluate:Wv,createParserClass:Hv,createParser:jv,createLup:Kv,createQr:Yv,createSlu:Xv,createLusolve:Zv,createPolynomialRoot:Qv,createHelpClass:Jv,createChainClass:eg,createHelp:tg,createChain:rg,createDet:ng,createInv:ig,createPinv:ag,createEigs:og,createExpm:sg,createSqrtm:lg,createSylvester:ug,createSchur:cg,createLyap:dg,createDivide:fg,createDistance:pg,createIntersect:hg,createSum:pc,createCumSum:hc,createMean:mc,createMedian:vg,createMad:gg,createVariance:vc,createQuantileSeq:yg,createStd:gc,createCombinations:bg,createCombinationsWithRep:xg,createGamma:wg,createLgamma:Cg,createFactorial:Sg,createKldivergence:Dg,createMultinomial:Eg,createPermutations:Ng,createPickRandom:Ag,createRandom:_g,createRandomInt:Mg,createStirlingS2:Tg,createBellNumbers:Og,createCatalan:Rg,createComposition:Ig,createLeafCount:kg,createSimplify:Fg,createSimplifyConstant:$g,createSimplifyCore:Bg,createResolve:zg,createSymbolicEqual:Lg,createDerivative:Vg,createRationalize:qg,createReviver:Gg,createReplacer:Ug,createE:Qg,createUppercaseE:Rw,createFalse:Hg,createI:o0,createInfinity:Kg,createLN10:t0,createLN2:e0,createLOG10E:n0,createLOG2E:r0,createNaN:Yg,createNull:jg,createPhi:Jg,createPi:Xg,createUppercasePi:Ow,createSQRT1_2:i0,createSQRT2:a0,createTau:Zg,createTrue:Wg,createVersion:s0,createAtomicMass:$0,createAvogadro:B0,createBohrMagneton:g0,createBohrRadius:S0,createBoltzmann:z0,createClassicalElectronRadius:D0,createConductanceQuantum:y0,createCoulomb:m0,createDeuteronMass:T0,createEfimovFactor:F0,createElectricConstant:p0,createElectronMass:E0,createElementaryCharge:v0,createFaraday:L0,createFermiCoupling:N0,createFineStructure:A0,createFirstRadiation:V0,createGasConstant:G0,createGravitationConstant:u0,createGravity:Q0,createHartreeEnergy:_0,createInverseConductanceQuantum:b0,createKlitzing:C0,createLoschmidt:q0,createMagneticConstant:f0,createMagneticFluxQuantum:x0,createMolarMass:X0,createMolarMassC12:Z0,createMolarPlanckConstant:U0,createMolarVolume:W0,createNeutronMass:O0,createNuclearMagneton:w0,createPlanckCharge:ry,createPlanckConstant:c0,createPlanckLength:J0,createPlanckMass:ey,createPlanckTemperature:ny,createPlanckTime:ty,createProtonMass:M0,createQuantumOfCirculation:R0,createReducedPlanckConstant:d0,createRydberg:I0,createSackurTetrode:H0,createSecondRadiation:j0,createSpeedOfLight:l0,createStefanBoltzmann:K0,createThomsonCrossSection:k0,createVacuumImpedance:h0,createWeakMixingAngle:P0,createWienDisplacement:Y0,createApplyTransform:ay,createColumnTransform:oy,createFilterTransform:sy,createForEachTransform:ly,createIndexTransform:uy,createMapTransform:cy,createMaxTransform:dy,createMeanTransform:fy,createMinTransform:py,createRangeTransform:hy,createRowTransform:my,createSubsetTransform:vy,createConcatTransform:gy,createDiffTransform:yy,createStdTransform:by,createSumTransform:xy,createCumSumTransform:wy,createVarianceTransform:Cy},Symbol.toStringTag,{value:"Module"})),Rc={type:"none",config:{}};function _ge(e){const t=Array.from(e).sort((n,i)=>n-i),r=Math.floor(t.length/2);return t.length%2===0?(t[r-1]+t[r])/2:t[r]}function Mge(e,t){const r=e[t],n=Number(r);return isFinite(n)?n:0}function Ic(e,t,r){var n,i,a;try{const o=e.map(s=>Mge(s,t));switch(r.type){case"sum":return Ne.default.sum(o);case"mean":return Ne.default.mean(o);case"median":return _ge(o);case"max":return(n=Ne.default.max(o))!=null?n:0;case"min":return(i=Ne.default.min(o))!=null?i:0;case"quantile":return(a=gu.quantile(o,r.config.p))!=null?a:0;case"CV":const s=By(...o),l=xC(...o);return l?s/l:"N/A";case"std":return By(...o);default:return o}}catch(o){return console.error(o),null}}var KB=function(){},kc=function(){};process.env.NODE_ENV!=="production"&&(KB=function(e,t){!e&&typeof console<"u"&&console.warn(t)},kc=function(e,t){if(!e)throw new Error(t)});const Tge=(e,t,r)=>Math.min(Math.max(r,e),t),YB=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n},tS=(e,t,r)=>-r*e+r*t+e,XB=(e,t)=>r=>Math.max(Math.min(r,t),e),Pc=e=>e%1?Number(e.toFixed(5)):e,Qy=/(-)?([\d]*\.?[\d])+/g,rS=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,Oge=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function Fc(e){return typeof e=="string"}const Jy={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},ZB=Object.assign(Object.assign({},Jy),{transform:XB(0,1)});Object.assign(Object.assign({},Jy),{default:1});const $c=(e=>({test:t=>Fc(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}))("%");Object.assign(Object.assign({},$c),{parse:e=>$c.parse(e)/100,transform:e=>$c.transform(e*100)});const nS=(e,t)=>r=>Boolean(Fc(r)&&Oge.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),QB=(e,t,r)=>n=>{if(!Fc(n))return n;const[i,a,o,s]=n.match(Qy);return{[e]:parseFloat(i),[t]:parseFloat(a),[r]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},ks={test:nS("hsl","hue"),parse:QB("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+$c.transform(Pc(t))+", "+$c.transform(Pc(r))+", "+Pc(ZB.transform(n))+")"},Rge=XB(0,255),iS=Object.assign(Object.assign({},Jy),{transform:e=>Math.round(Rge(e))}),Xo={test:nS("rgb","red"),parse:QB("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+iS.transform(e)+", "+iS.transform(t)+", "+iS.transform(r)+", "+Pc(ZB.transform(n))+")"};function Ige(e){let t="",r="",n="",i="";return e.length>5?(t=e.substr(1,2),r=e.substr(3,2),n=e.substr(5,2),i=e.substr(7,2)):(t=e.substr(1,1),r=e.substr(2,1),n=e.substr(3,1),i=e.substr(4,1),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const aS={test:nS("#"),parse:Ige,transform:Xo.transform},eb={test:e=>Xo.test(e)||aS.test(e)||ks.test(e),parse:e=>Xo.test(e)?Xo.parse(e):ks.test(e)?ks.parse(e):aS.parse(e),transform:e=>Fc(e)?e:e.hasOwnProperty("red")?Xo.transform(e):ks.transform(e)},JB="${c}",e4="${n}";function kge(e){var t,r,n,i;return isNaN(e)&&Fc(e)&&((r=(t=e.match(Qy))===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0)+((i=(n=e.match(rS))===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0)>0}function t4(e){typeof e=="number"&&(e=`${e}`);const t=[];let r=0;const n=e.match(rS);n&&(r=n.length,e=e.replace(rS,JB),t.push(...n.map(eb.parse)));const i=e.match(Qy);return i&&(e=e.replace(Qy,e4),t.push(...i.map(Jy.parse))),{values:t,numColors:r,tokenised:e}}function r4(e){return t4(e).values}function n4(e){const{values:t,numColors:r,tokenised:n}=t4(e),i=t.length;return a=>{let o=n;for(let s=0;s<i;s++)o=o.replace(s<r?JB:e4,s<r?eb.transform(a[s]):Pc(a[s]));return o}}const Pge=e=>typeof e=="number"?0:e;function Fge(e){const t=r4(e);return n4(e)(t.map(Pge))}const i4={test:kge,parse:r4,createTransformer:n4,getAnimatableNone:Fge};function oS(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function a4({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let i=0,a=0,o=0;if(!t)i=a=o=r;else{const s=r<.5?r*(1+t):r+t-r*t,l=2*r-s;i=oS(l,s,e+1/3),a=oS(l,s,e),o=oS(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:n}}const $ge=(e,t,r)=>{const n=e*e,i=t*t;return Math.sqrt(Math.max(0,r*(i-n)+n))},Bge=[aS,Xo,ks],o4=e=>Bge.find(t=>t.test(e)),s4=e=>`'${e}' is not an animatable color. Use the equivalent color code instead.`,l4=(e,t)=>{let r=o4(e),n=o4(t);kc(!!r,s4(e)),kc(!!n,s4(t));let i=r.parse(e),a=n.parse(t);r===ks&&(i=a4(i),r=Xo),n===ks&&(a=a4(a),n=Xo);const o=Object.assign({},i);return s=>{for(const l in o)l!=="alpha"&&(o[l]=$ge(i[l],a[l],s));return o.alpha=tS(i.alpha,a.alpha,s),r.transform(o)}},zge=e=>typeof e=="number",Lge=(e,t)=>r=>t(e(r)),u4=(...e)=>e.reduce(Lge);function c4(e,t){return zge(e)?r=>tS(e,t,r):eb.test(e)?l4(e,t):p4(e,t)}const d4=(e,t)=>{const r=[...e],n=r.length,i=e.map((a,o)=>c4(a,t[o]));return a=>{for(let o=0;o<n;o++)r[o]=i[o](a);return r}},Vge=(e,t)=>{const r=Object.assign(Object.assign({},e),t),n={};for(const i in r)e[i]!==void 0&&t[i]!==void 0&&(n[i]=c4(e[i],t[i]));return i=>{for(const a in n)r[a]=n[a](i);return r}};function f4(e){const t=i4.parse(e),r=t.length;let n=0,i=0,a=0;for(let o=0;o<r;o++)n||typeof t[o]=="number"?n++:t[o].hue!==void 0?a++:i++;return{parsed:t,numNumbers:n,numRGB:i,numHSL:a}}const p4=(e,t)=>{const r=i4.createTransformer(t),n=f4(e),i=f4(t);return n.numHSL===i.numHSL&&n.numRGB===i.numRGB&&n.numNumbers>=i.numNumbers?u4(d4(n.parsed,i.parsed),r):(KB(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),o=>`${o>0?t:e}`)},qge=(e,t)=>r=>tS(e,t,r);function Gge(e){if(typeof e=="number")return qge;if(typeof e=="string")return eb.test(e)?l4:p4;if(Array.isArray(e))return d4;if(typeof e=="object")return Vge}function Uge(e,t,r){const n=[],i=r||Gge(e[0]),a=e.length-1;for(let o=0;o<a;o++){let s=i(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]:t;s=u4(l,s)}n.push(s)}return n}function Wge([e,t],[r]){return n=>r(YB(e,t,n))}function Hge(e,t){const r=e.length,n=r-1;return i=>{let a=0,o=!1;if(i<=e[0]?o=!0:i>=e[n]&&(a=n-1,o=!0),!o){let l=1;for(;l<r&&!(e[l]>i||l===n);l++);a=l-1}const s=YB(e[a],e[a+1],i);return t[a](s)}}function tb(e,t,{clamp:r=!0,ease:n,mixer:i}={}){const a=e.length;kc(a===t.length,"Both input and output ranges must be the same length"),kc(!n||!Array.isArray(n)||n.length===a-1,"Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values."),e[0]>e[a-1]&&(e=[].concat(e),t=[].concat(t),e.reverse(),t.reverse());const o=Uge(t,n,i),s=a===2?Wge(e,o):Hge(e,o);return r?l=>s(Tge(e[0],e[a-1],l)):s}class jge{constructor({valueRange:t,colorRange:r}){at(this,"mapper");this.mapper=tb(t,r)}getColor(t){return this.mapper(t)}}function Kge(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`Array(${e.length})`:e.toString()}function Bc({data_field:e,aggregation:t},r){return Ic(r,e,t)}function Ps({formatter:e},t){return["string","number"].includes(typeof t)?Tr.default(t).format(e):Kge(t)}function Yge(e,t){if(e.type==="static")return e.staticColor;if(e.type==="continuous")try{if(typeof t!="number")throw new Error(`[getColorByColorConf] Invalid type of aggregated value: ${t}`);return new jge(e).getColor(t)}catch(r){return console.error(r),"black"}return"black"}function h4(e,t){const{color:r,data_field:n,aggregation:i,size:a,weight:o}=e,s=Ic(t,n,i),l=Ps(e,s);return h(g.Text,{sx:{fontSize:a,display:"inline"},color:Yge(r,s),weight:o,children:l})}function Xge(e,t){const r={};return e.forEach(n=>{const i=n.name;r[i]=h4(n,t)}),r}function Zge(e){return e.split(" ").map((t,r)=>$(Pe.default.Fragment,{children:[t,"\xA0"]},r))}function Qge(e){const r=e.replaceAll("<br />","<br/>").replaceAll(`
153
153
  `,"<br/>").split("<br/>");return r.map((i,a)=>{const o=[Zge(i)];return a!==r.length-1&&o.push(h("br",{})),o}).flat().filter(i=>i!==void 0)}function sS(e){return Qge(e)}function zc(e,t,r){const n=Xge(t,r),i=/^\{(.+)\}(.*)$/;return e.split("$").map(a=>{var u;const o=i.exec(a);if(!o)return sS(a);const s=n[o[1]];if(!s)return sS(a);const l=(u=o[2])!=null?u:"";return $(tt,{children:[s,sS(l)]})})}function Jge(e,t){const r={};return e.forEach(n=>{const{name:i,data_field:a,aggregation:o}=n,s=Ic(t,a,o);r[i]=Ps(n,s)}),r}function rb(e,t,r){const n=Jge(t,r),i=/^\{(.+)\}(.*)$/;return e.split("$").map(a=>{var u;const o=i.exec(a);if(!o)return a;const s=n[o[1]];if(!s)return a;const l=(u=o[2])!=null?u:"";return`${s}${l}`}).join("")}function Ql({enabled:e,func_content:t}){return(r,n)=>{if(!e)return r;try{return new Function(`return ${t}`)()(r,n)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),r}}}const lS=["max","q3","median","q1","min"];function e0e({config:e}){return{show:!0,bottom:0,left:"center",type:"scroll",data:[{name:"Box",icon:"roundRect",itemStyle:{color:e.color}},{name:"Outlier",icon:"circle",itemStyle:{color:"#2F8CC0"}}]}}function t0e(e,t){return`
154
154
  <div style="text-align: left; margin-bottom: .5em; padding: 0 1em .5em; font-weight: bold; border-bottom: 1px dashed #ddd;">
155
155
  <div style="${Ao(e.x_axis.axisLabel.overflow.in_tooltip)}">${t[0]}</div>
@@ -543,7 +543,7 @@ In case of a (multi dimensional) array or matrix, the prob order quantile of all
543
543
  parent_value: string;
544
544
  description?: string;
545
545
  }
546
- `,RRe=()=>{const[e,t]=z.useState(!1);return $(tt,{children:[h(g.Button,{variant:"subtle",compact:!0,onClick:()=>t(r=>!r),children:e?"Close":"Click to see expected data structure"}),h(g.Collapse,{in:e,children:h(Us.Prism,{language:"typescript",noCopy:!0,colorScheme:"dark",children:ORe})})]})},IRe=ke.observer(function({config:t}){return $(tt,{children:[h(g.TextInput,{label:"Min-width",value:t.min_width,onChange:r=>t.setMinWidth(r.currentTarget.value),placeholder:"200px"}),h(g.Divider,{label:"Fetch options from database",labelPosition:"center"}),h(g.NumberInput,{value:t.default_selection_count,onChange:t.setDefaultSelectionCount,label:"Select first N options by default"}),h(oE,{value:t.options_query_id,onChange:t.setOptionsQueryID}),h(RRe,{})]})}),kRe=ke.observer(function({filter:t}){const[r,n]=Pe.default.useState(t.plainDefaultValue);return Pe.default.useEffect(()=>{n(t.plainDefaultValue)},[t]),$(g.Box,{sx:{maxWidth:"480px"},children:[h(g.Text,{pb:"md",color:"gray",children:"Preview"}),h(j2,{filter:t,value:r,onChange:n}),h(g.Text,{pt:"lg",pb:"md",color:"gray",children:"Config"}),h(Us.Prism,{language:"json",colorScheme:"dark",noCopy:!0,children:JSON.stringify(t,null,4)})]})}),PRe={select:MRe,"multi-select":_Re,"tree-select":IRe,"text-input":TRe,checkbox:DRe,"date-range":NRe},FRe=[{label:"Select",value:"select"},{label:"Multi Select",value:"multi-select"},{label:"Tree Select",value:"tree-select"},{label:"Text Input",value:"text-input"},{label:"Checkbox",value:"checkbox"},{label:"Date Range",value:"date-range"}],$Re=ke.observer(function({filter:t}){const r=ut(),n=Pe.default.useMemo(()=>PRe[t.type],[t.type]);return $(g.Group,{grow:!0,spacing:20,align:"top",children:[$(g.Box,{sx:{maxWidth:"600px"},children:[h(g.Text,{pb:"md",color:"gray",children:"Edit"}),$(g.Stack,{children:[$(g.Group,{noWrap:!0,children:[h(g.NumberInput,{label:"Placement Order",required:!0,value:t.order,onChange:t.setOrder,hideControls:!0,sx:{flexGrow:"1 !important"}}),t.auto_submit_supported&&h(g.Checkbox,{label:"Submit automatically",checked:t.auto_submit,onChange:i=>t.setAutoSubmit(i.currentTarget.checked),mt:22})]}),h(g.MultiSelect,{label:"Visible in...",data:r.views.options,value:[...t.visibleInViewsIDs],onChange:t.setVisibleInViewsIDs}),h(g.TextInput,{label:"Key",placeholder:"A unique key to refer",required:!0,value:t.key,onChange:i=>{t.setKey(i.currentTarget.value)}}),h(g.TextInput,{label:"Label",placeholder:"Label for this field",required:!0,value:t.label,onChange:i=>{t.setLabel(i.currentTarget.value)}}),h(g.Select,{label:"Widget",data:FRe,required:!0,value:t.type,onChange:t.setType}),h(n,{config:t.config})]})]}),h(kRe,{filter:t})]})}),BRe=ke.observer(({id:e})=>{const t=da.useModals(),r=ut();if(e==="")return null;const n=r.filters.findByID(e);if(!n)return $(g.Text,{size:14,children:["Filter by ID[",e,"] is not found"]});const i=()=>{t.openConfirmModal({title:"Delete this filter?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>r.filters.removeByID(e),zIndex:320})};return $(g.Stack,{sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",pb:30,children:[h(g.Group,{position:"right",pt:10,children:h(g.Button,{size:"xs",color:"red",leftIcon:h(Be.Trash,{size:16}),onClick:i,children:"Delete this filter"})}),h(g.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:h($Re,{filter:n})})]})}),zRe=ke.observer(()=>{const e=ut(),[t,r]=z.useState(()=>JSON.stringify(e.mock_context.current,null,4)),n=()=>{try{e.mock_context.replace(JSON.parse(t))}catch(a){dd.showNotification({title:"Failed",message:a.message,color:"red"})}},i=z.useMemo(()=>{try{return JSON.stringify(JSON.parse(t))!==JSON.stringify(e.mock_context.current)}catch{return!1}},[t,e.mock_context.current]);return $(g.Stack,{sx:{border:"1px solid #eee",borderLeft:"none",borderRight:"none",flexGrow:1,maxWidth:"unset"},children:[h(g.Group,{position:"left",pl:"md",py:"md",sx:{borderBottom:"1px solid #eee",background:"#efefef",flexGrow:0},children:h(g.Text,{weight:500,children:"Mock Context"})}),$(g.Group,{grow:!0,px:"md",pb:"md",pt:0,sx:{flexGrow:1,position:"relative",alignItems:"flex-start"},children:[$(g.Stack,{spacing:10,sx:{maxWidth:"unset !important"},children:[h(g.Text,{children:"A valid json string is required"}),h(g.JsonInput,{validationError:"Invalid json",formatOnBlur:!0,autosize:!0,minRows:30,value:t,onChange:r,sx:{flexGrow:1}})]}),h(g.ActionIcon,{mr:5,variant:"filled",color:"blue",sx:{position:"absolute",right:12,top:0},disabled:!i,onClick:n,children:h(Be.DeviceFloppy,{size:20})})]})]})}),LRe=ke.observer(()=>{const{panel:e}=gn();return h(CS,{label:"Description",value:e.description,onChange:e.setDescription,styles:{root:{flexGrow:1}}})}),VRe=ke.observer(()=>{const{panel:e}=gn(),{style:t}=e;return h(tt,{children:h(g.Switch,{label:"Border",checked:t.border.enabled,onChange:r=>t.border.setEnabled(r.currentTarget.checked)})})}),qRe=ke.observer(()=>{const{panel:e}=gn(),{title:t,setTitle:r}=e,[n,i]=vn.useInputState(t),a=t!==n,o=Pe.default.useCallback(()=>{!a||r(n)},[a,n]);return z.useEffect(()=>{i(t)},[t]),h(g.TextInput,{value:n,onChange:i,label:$(g.Group,{children:[h(g.Text,{children:"Panel Title"}),h(g.ActionIcon,{variant:"subtle",color:"blue",disabled:!a,onClick:o,children:h(Be.DeviceFloppy,{size:20})})]}),styles:{label:{display:"block",paddingBottom:"4px"}}})});function GRe(){return $(g.Stack,{sx:{height:"100%"},children:[h(g.Divider,{label:"Style",labelPosition:"center",variant:"dashed"}),h(VRe,{}),h(g.Divider,{label:"Info",labelPosition:"center",variant:"dashed"}),h(qRe,{}),h(LRe,{})]})}const URe=({queryID:e})=>{const t=ut(),{state:r,error:n}=t.getDataStuffByID(e),i=Pe.default.useMemo(()=>t.queries.findByID(e),[t,e]);return r==="loading"?null:n?h(g.Text,{color:"red",size:"md",align:"center",sx:{fontFamily:"monospace"},children:n}):i!=null&&i.stateMessage?h(g.Text,{color:"gray",align:"center",children:i.stateMessage}):null},WRe={width:"fit-content",minWidth:"100%",tableLayout:"fixed",tr:{width:"fit-content"},th:{position:"relative"},".resizer":{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",cursor:"col-resize",userSelect:"none",touchAction:"none"},".resizer.isResizing":{color:"#228be6",opacity:"1"},"@media (hover: hover)":{".resizer":{opacity:"0"},"*:hover > .resizer":{color:"#228be6",opacity:"1"}}};function b8({data:e}){const t=z.useMemo(()=>{if(!Array.isArray(e)||e.length===0)return[];const n=j4();return Object.keys(e[0]).map(i=>n.accessor(i,{cell:a=>a.getValue()}))},[e]),r=Y4({data:e,columns:t,columnResizeMode:"onChange",getCoreRowModel:K4()});return e.length===0?h(g.Box,{sx:{height:"5em"}}):h(ri,{children:$(g.Table,{sx:WRe,children:[h("thead",{children:r.getHeaderGroups().map(n=>h("tr",{children:n.headers.map(i=>$("th",{style:{width:i.getSize()},children:[i.isPlaceholder?null:pb(i.column.columnDef.header,i.getContext()),h(g.ActionIcon,{onMouseDown:i.getResizeHandler(),onTouchStart:i.getResizeHandler(),className:`resizer ${i.column.getIsResizing()?"isResizing":""}`,children:h(Be.ArrowBarToRight,{})})]},i.id))},n.id))}),h("tbody",{children:r.getRowModel().rows.map(n=>h("tr",{children:n.getVisibleCells().map(i=>h("td",{children:h(ri,{children:pb(i.column.columnDef.cell,i.getContext())})},i.id))},n.id))})]})})}const x8=ke.observer(function({id:t}){const r=ut(),{data:n,state:i}=r.getDataStuffByID(t),a=i==="loading",o=()=>{r.queries.refetchDataByQueryID(t)},s=()=>{r.queries.downloadDataByQueryID(t)},l=z.useMemo(()=>Array.isArray(n)?n.slice(0,10):[],[n]),u=!Array.isArray(n)||n.length===0;return $(g.Stack,{sx:{border:"1px solid #eee"},children:[$(g.Group,{position:"apart",py:"md",pl:"md",sx:{borderBottom:"1px solid #eee",background:"#efefef"},children:[$(g.Group,{position:"left",children:[h(g.Text,{weight:500,children:"Preview Data"}),n.length>10&&$(g.Text,{size:"sm",color:"gray",children:["Showing 10 rows of ",n.length]})]}),$(g.Group,{pr:15,children:[h(g.ActionIcon,{variant:"subtle",color:"blue",disabled:a,onClick:o,children:h(Be.Refresh,{size:15})}),h(g.ActionIcon,{variant:"subtle",color:"blue",disabled:a||u,onClick:s,children:h(Be.Download,{size:15})})]})]}),$(g.Box,{sx:{position:"relative",overflow:"auto"},children:[h(g.LoadingOverlay,{visible:a}),h(URe,{queryID:t}),h(b8,{data:l})]})]})}),HRe=ke.observer(function(){const t=ut(),{panel:{queryID:r,setQueryID:n}}=gn(),i=Pe.default.useMemo(()=>t.queries.current.map(o=>({value:o.id,label:o.name})),[t.queries.current]),a=()=>{t.editor.setPath(["_QUERIES_",r])};return $(g.Stack,{children:[$(g.Group,{position:"left",sx:{maxWidth:"600px",alignItems:"baseline"},children:[h(g.Text,{children:"Use query"}),h(g.Select,{data:i,value:r,onChange:n,allowDeselect:!1,clearable:!1,sx:{flexGrow:"1 !important"},maxDropdownHeight:300,rightSection:r&&h(g.Tooltip,{label:"Open this query",children:h(g.ActionIcon,{variant:"subtle",color:"blue",onClick:a,children:h(z6,{size:16})})})})]}),h(x8,{id:r})]})}),jRe=ke.observer(({height:e})=>{const t=ut(),{data:r,loading:n,error:i,panel:{viz:a,queryID:o}}=gn(),s=t.queries.findByID(o);return h(fz,{viz:a,data:r,loading:n,error:i,query:s,height:e})}),KRe=ke.observer(()=>{const{panel:{title:e,style:{border:t}}}=gn();return h(ri,{children:h(g.Box,{sx:{height:"100%",flexGrow:0,flexShrink:0,width:"600px"},children:$(g.Stack,{mt:24,spacing:5,sx:{width:"600px",height:"450px",background:"transparent",borderRadius:"5px",border:"1px solid #e9ecef",borderWidth:t.enabled?"1px":"0px"},children:[$(g.Group,{position:"apart",noWrap:!0,sx:{flexGrow:0,flexShrink:0},children:[h(g.Group,{children:h(Y2,{})}),h(g.Group,{grow:!0,position:"center",children:h(g.Text,{lineClamp:1,weight:"bold",children:e})}),h(g.Group,{position:"right",spacing:0,sx:{height:"28px"}})]}),h(g.Group,{px:5,pb:5,sx:{flexGrow:1},children:h(jRe,{height:"410px"})})]})})})}),sE={name:"new_var",size:"1rem",weight:"initial",color:{type:"static",staticColor:"Red"},data_field:"",aggregation:{type:"sum",config:{}},formatter:{output:"number",mantissa:0,trimMantissa:!1,average:!1}};class YRe{constructor(t){at(this,"panel");at(this,"selected");this.panel=t,cr.makeAutoObservable(this,{},{deep:!1,autoBind:!0})}get variables(){return this.panel.variables}addNew(){const t=this.panel.variables.filter(r=>r.name.startsWith(sE.name)).length;this.panel.addVariable(Se.cloneDeep({...sE,name:`${sE.name}${t||""}`})),this.selected=Se.last(this.panel.variables)}select(t){this.selected=t}remove(t){this.selected===t&&(this.selected=void 0);const r=this.panel.variables.indexOf(t);if(this.panel.removeVariable(t),!this.selected&&!Se.isEmpty(this.panel.variables)){const n=Math.min(this.panel.variables.length-1,r);this.selected=this.panel.variables[n]}}}function XRe(){const{panel:e}=gn();return Wt.useCreation(()=>new YRe(e),[e])}const ZRe=Pe.default.forwardRef(function({value:t,onChange:r,data:n,withStyle:i=!0},a){const o=(s,l)=>{const u=Ne.default.cloneDeep(t);Ne.default.set(u,s,l),r(u)};return $(g.Box,{px:"sm",py:"md",ref:a,children:[$(g.Group,{grow:!0,noWrap:!0,children:[h(g.TextInput,{label:"Name",required:!0,value:t.name,onChange:s=>o("name",s.currentTarget.value)}),h(It,{label:"Data Field",required:!0,data:n,value:t.data_field,onChange:s=>o("data_field",s)})]}),h(df,{label:"Aggregation",value:t.aggregation,onChange:s=>o("aggregation",s)}),h(g.Divider,{my:"xs",label:"Format",labelPosition:"center"}),h(va,{value:t.formatter,onChange:s=>o("formatter",s)}),i&&h(pM,{value:t,onChange:r})]})}),w8=g.createStyles(e=>({root:{height:"100%",overflow:"hidden",".var-list-container":{"& > *":{height:"100%"},width:250,height:"100%"},".var-list-actions":{height:"fit-content",flexShrink:0,width:"100%"},".var-list":{flex:"1 1 auto",overflow:"auto",minHeight:0,"& > *":{flex:"0 0 auto"}}},config:{height:"100%",overflow:"auto",paddingRight:10}})),QRe=e=>{const{uiModel:t}=e;return h(g.Stack,{className:"var-list",children:t.variables.map(r=>h(g.Button,{variant:t.selected===r?"filled":"subtle",color:"gray",onClick:()=>t.select(r),children:r.name},r.name))})},JRe=ke.observer(QRe),e3e=({variable:e,data:t})=>h(g.Group,{style:{minHeight:0,height:"calc(100% - 68px)"},children:h(g.Paper,{withBorder:!0,p:"md",children:h4(e,t)})}),t3e=ke.observer(e3e),r3e=e=>{const t=Wt.useCreation(()=>UNe(e.variable),[e.variable]),{classes:r}=w8(),{data:n}=gn();return $(g.Group,{style:{height:"100%"},align:"start",children:[$(g.Stack,{"data-testid":"variable-editor",align:"stretch",className:r.config,children:[$(g.Group,{position:"right",children:[h(g.ActionIcon,{variant:"filled",disabled:!t.changed,color:"primary",onClick:t.commit,children:h(Cu,{size:18})}),h(g.ActionIcon,{color:"red",onClick:()=>e.uiModel.remove(e.variable),children:h(Ws,{size:18})})]}),h(ZRe,{value:j.getSnapshot(t.copy),onChange:t.update,data:n})]}),h(t3e,{variable:j.getSnapshot(t.copy),data:n})]})},n3e=ke.observer(r3e),i3e=()=>{const e=XRe(),{classes:t}=w8();return $(g.Group,{className:t.root,noWrap:!0,align:"start",children:[h(g.Paper,{withBorder:!0,p:"md",className:"var-list-container",children:$(g.Stack,{justify:"space-between",children:[h(g.Box,{className:"var-list-actions",children:h(g.Button,{variant:"light",size:"sm",onClick:e.addNew,fullWidth:!0,children:"Add Variable"})}),h(JRe,{uiModel:e})]})}),e.selected?h(tt,{children:h(n3e,{uiModel:e,variable:e.selected})}):h("span",{children:"Select or create a new variable on right side"})]})},a3e=ke.observer(i3e);function o3e(){const{vizManager:e}=z.useContext(Oa);return z.useMemo(()=>{const t=e.availableVizList.map(r=>{var n,i;return{value:r.name,label:(n=r.displayName)!=null?n:r.name,group:(i=r.displayGroup)!=null?i:""}});return Ne.default.orderBy(t,[r=>r.group,r=>r.label],["asc","asc"])},[e])}const s3e=ke.observer(({value:e,submit:t})=>{const[r,n]=vn.useInputState(e);z.useEffect(()=>{n(e)},[e]);const i=o3e(),a=e!==r;return h(g.Select,{label:"Visualization",value:r,searchable:!0,onChange:n,data:i,rightSection:h(g.ActionIcon,{disabled:!a,onClick:()=>t(r),children:h(Be.DeviceFloppy,{size:20})}),maxDropdownHeight:600})}),C8=[];function l3e(e,t){try{return e.resolveComponent(t).createConfig()}catch{return null}}function u3e(){const{data:e,panel:{variables:t,viz:r,title:n,queryID:i,description:a,setDescription:o,setTitle:s,setQueryID:l,id:u}}=gn(),{vizManager:c}=z.useContext(Oa),d={title:n,description:a,viz:r,queryID:i,id:u},f={setDescription:o,setQueryID:l,setTitle:s},p=uz(d);try{return c.resolveComponent(d.viz.type),h(md,{configure:p,children:h(AEe,{variables:t,setVizConf:r.setConf,panel:d,panelInfoEditor:f,vizManager:c,data:e})})}catch(m){return console.info(Se.get(m,"message")),null}}const c3e=ke.observer(()=>{const{data:e,panel:{viz:t}}=gn(),{vizManager:r}=z.useContext(Oa),n=Pe.default.useCallback(u=>{if(u===t.type)return;const c=l3e(r,u);t.setType(u),t.setConf(c||{})},[t.type]),i=u=>{try{t.setConf(JSON.parse(u))}catch(c){console.error(c)}},a=Pe.default.useMemo(()=>{var u;return(u=C8.find(c=>c.value===t.type))==null?void 0:u.Panel},[t.type,C8]),o=u3e(),s=a?z.createElement(a,{data:e,conf:t.conf,setConf:t.setConf}):null,l=o||s;return $(g.Stack,{align:"stretch",sx:{height:"100%",overflow:"hidden"},children:[h(s3e,{submit:n,value:t.type}),h(g.Stack,{pb:50,sx:{flexGrow:1,maxHeight:"calc(100% - 80px)",overflow:"auto"},children:l}),!l&&h(g.JsonInput,{minRows:20,label:"Config",value:JSON.stringify(t.conf,null,2),onChange:i})]})}),d3e=ke.observer(({panel:e,sourceViewID:t})=>{const r=ut(),[n,i]=z.useState(t);z.useEffect(()=>{i(t)},[t]);const[a,{open:o,close:s}]=vn.useDisclosure(!1),l=()=>{e.moveToView(t,n),s()};return $(tt,{children:[h(g.Button,{size:"xs",variant:"subtle",color:"blue",onClick:o,leftIcon:h(wE,{size:14}),children:"Move into Another View"}),h(g.Modal,{opened:a,onClose:s,title:"Move panel into another view",zIndex:320,overflow:"inside",children:$(g.Stack,{sx:{maxHeight:"calc(100vh - 185px)",overflow:"hidden"},children:[h(g.Radio.Group,{value:n,onChange:i,pb:10,sx:{flexGrow:1,maxHeight:"calc(100vh - 185px - 30px)",overflow:"auto"},children:h(g.Stack,{spacing:"xs",children:r.views.options.map(u=>h(g.Radio,{value:u.value,label:u.label},u.value))})}),$(g.Group,{noWrap:!0,position:"apart",sx:{flexGrow:0,flexShrink:0},children:[h(g.Button,{size:"xs",color:"red",leftIcon:h(DE,{size:14}),onClick:s,children:"Cancel"}),h(g.Button,{size:"xs",color:"blue",leftIcon:h(Cu,{size:14}),onClick:l,disabled:n===t,children:"Confirm"})]})]})})]})}),f3e={root:{flexGrow:1,width:"100%",height:"100%"},panel:{width:"100%",height:"100%",padding:10}},S8=({children:e})=>$(g.Group,{noWrap:!0,grow:!0,position:"left",spacing:20,sx:{width:"100%",height:"calc(100% - 36px)"},children:[h(g.Box,{sx:{maxWidth:"calc(100% - 610px - 10px)",height:"100%",overflow:"auto"},children:e}),h(KRe,{})]});function p3e(e){return!["richText","button"].includes(e)}const h3e=ke.observer(({panel:e})=>{const t=da.useModals(),r=ut(),[n,i]=z.useState("Data"),{data:a,state:o,error:s}=r.getDataStuffByID(e.queryID),l=r.queries.findByID(e.queryID),c=p3e(e.viz.type)&&o==="loading",d=c||s||!l||!!l.stateMessage,f=r.editor.path[1];z.useEffect(()=>{i(v=>d&&v==="Visualization"?"Data":v)},[e.id,d]);const p=()=>{r.editor.setPath(["_VIEWS_",f])},m=()=>t.openConfirmModal({title:"Delete this panel?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{r.removePanelByID(e.id,f),p()},confirmProps:{color:"red"},zIndex:320});return $(m1,{value:{panel:e,data:a,loading:c,error:s},children:[$(g.Group,{px:16,position:"apart",sx:{borderBottom:"1px solid #eee"},children:[$(g.Text,{pt:9,pb:8,children:[e.title?e.title:e.viz.type," "]}),$(g.Group,{position:"right",noWrap:!0,children:[h(d3e,{panel:e,sourceViewID:f}),h(g.Button,{size:"xs",variant:"subtle",color:"red",onClick:m,leftIcon:h(Ws,{size:14}),children:"Delete This Panel"})]})]}),$(g.Tabs,{value:n,onTabChange:i,keepMounted:!1,styles:f3e,children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"Data",disabled:c,children:"Data"}),h(g.Tabs.Tab,{value:"Panel",children:"Panel"}),h(g.Tabs.Tab,{value:"Variables",disabled:d,children:h(g.Tooltip,{label:"Requires data",disabled:!d,withinPortal:!0,zIndex:310,children:h(g.Text,{children:"Variables"})})}),h(g.Tabs.Tab,{value:"Visualization",disabled:d,children:h(g.Tooltip,{label:"Requires data",disabled:!d,withinPortal:!0,zIndex:310,children:h(g.Text,{children:"Visualization"})})}),h(g.Tabs.Tab,{value:"Interactions",children:"Interactions"})]}),$(g.Tabs.Panel,{value:"Data",children:[h(g.LoadingOverlay,{visible:c,exitTransitionDuration:0}),h(HRe,{})]}),h(g.Tabs.Panel,{value:"Panel",children:h(S8,{children:h(GRe,{})})}),h(g.Tabs.Panel,{value:"Variables",children:h(a3e,{})}),h(g.Tabs.Panel,{value:"Visualization",children:h(ri,{children:h(S8,{children:h(c3e,{})})})}),h(g.Tabs.Panel,{value:"Interactions",children:h(ri,{children:h(EEe,{})})})]})]})}),m3e=ke.observer(({viewID:e,panelID:t})=>{const r=ut();if(!r.views.findByID(e))return $(g.Text,{size:14,children:["View by ID[",e,"] is not found"]});const i=r.panels.findByID(t);return i?h(h3e,{panel:i}):$(g.Text,{size:14,children:["Panel by ID[",t,"] is not found"]})}),D8=({width:e="calc(100% - 32px)",lastWidth:t="50%",height:r,count:n,spacing:i=16,pl:a=0})=>$(g.Stack,{spacing:i,mt:6,pl:a,children:[Array.from(new Array(n-1),(o,s)=>h(g.Skeleton,{width:e,height:r,radius:"xs"},s)),h(g.Skeleton,{width:t,height:r,radius:"xs"})]}),sd=({value:e})=>e===null||e===""?null:h(g.Tooltip,{label:e,disabled:!e,multiline:!0,children:h(g.ActionIcon,{children:h(o1,{size:14})})}),v3e=({column:e})=>{const{column_key:t,column_key_text:r}=e;return t?h(g.Tooltip,{label:r,disabled:!r,children:h(g.Badge,{children:t})}):null},g3e=ke.observer(({dataSource:e})=>{const{columns:t}=e;return t.loading?h(D8,{height:"24px",width:"100%",lastWidth:"100%",count:20,pl:6}):t.empty?null:$(g.Table,{highlightOnHover:!0,fontSize:14,sx:{width:"auto",minWidth:"1000px",alignSelf:"flex-start",flexGrow:0,tableLayout:"fixed",tbody:{fontFamily:"monospace"}},children:[$("colgroup",{children:[h("col",{style:{width:50}}),h("col",{style:{minWidth:300}}),h("col",{style:{width:30}}),h("col",{style:{width:70}}),h("col",{style:{minWidth:300}}),h("col",{style:{minWidth:80,width:80}}),h("col",{style:{minWidth:120,width:120}})]}),h("thead",{children:$("tr",{children:[h("th",{children:"#"}),h("th",{children:"Column Name"}),h("th",{}),h("th",{}),h("th",{children:"Type"}),h("th",{children:"Nullable"}),h("th",{children:"Default Value"})]})}),h("tbody",{children:t.data.map(r=>$("tr",{children:[h("td",{children:r.ordinal_position}),h("td",{children:r.column_name}),h("td",{children:h(sd,{value:r.column_comment})}),h("td",{children:h(v3e,{column:r})}),h("td",{children:r.column_type}),h("td",{children:r.is_nullable}),h("td",{children:h(sd,{value:r.column_default})})]},r.column_name))})]})}),y3e=ke.observer(({dataSource:e})=>{const{indexes:t}=e,r=t.data;return $(g.Table,{highlightOnHover:!0,fontSize:14,sx:{width:"auto",minWidth:"950px",alignSelf:"flex-start",flexGrow:0,tableLayout:"fixed",tbody:{fontFamily:"monospace"}},children:[$("colgroup",{children:[h("col",{style:{width:100}}),h("col",{style:{minWidth:300}}),h("col",{style:{width:150}}),h("col",{style:{width:150}}),h("col",{style:{width:250}})]}),h("thead",{children:$("tr",{children:[h("th",{children:"Index Length"}),h("th",{children:"Index Name"}),h("th",{children:"Index Algorithm"}),h("th",{children:"Unique"}),h("th",{children:"Column Name"})]})}),h("tbody",{children:r.map(n=>$("tr",{children:[h("td",{children:n.index_length}),h("td",{children:n.index_name}),h("td",{children:n.index_algorithm}),h("td",{children:n.is_unique?"YES":"NO"}),h("td",{children:n.column_name})]},n.index_name))})]})}),b3e=ke.observer(({dataSource:e})=>{const{indexes:t}=e,r=t.data;return $(g.Table,{highlightOnHover:!0,fontSize:14,sx:{width:"auto",minWidth:"850px",alignSelf:"flex-start",flexGrow:0,tableLayout:"fixed",tbody:{fontFamily:"monospace"}},children:[$("colgroup",{children:[h("col",{style:{minWidth:300}}),h("col",{style:{width:150}}),h("col",{style:{width:100}}),h("col",{style:{width:100}}),h("col",{style:{width:100}}),h("col",{style:{width:100}})]}),h("thead",{children:$("tr",{children:[h("th",{children:"Index Name"}),h("th",{children:"Index Algorithm"}),h("th",{children:"Unique"}),h("th",{children:"Definition"}),h("th",{children:"Condition"}),h("th",{children:"Comment"})]})}),h("tbody",{children:r.map(n=>$("tr",{children:[h("td",{children:n.index_name}),h("td",{children:n.index_algorithm}),h("td",{children:n.is_unique?"YES":"NO"}),h("td",{children:h(sd,{value:n.index_definition})}),h("td",{children:h(sd,{value:n.condition})}),h("td",{children:h(sd,{value:n.comment})})]},n.index_name))})]})}),x3e=ke.observer(({dataSource:e})=>{const{indexes:t}=e;return t.loading||t.empty?null:e.type===qr.MySQL?h(y3e,{dataSource:e}):e.type===qr.Postgresql?h(b3e,{dataSource:e}):null}),w3e=ke.observer(({dataSource:e})=>$(g.Stack,{spacing:40,pt:10,sx:{flexGrow:1,overflow:"auto",position:"relative"},children:[h(ri,{children:h(g3e,{dataSource:e})}),h(ri,{children:h(x3e,{dataSource:e})})]}));function C3e({table_type:e}){return e==="VIEW"?h(vV,{size:14}):e==="BASE TABLE"?h(TV,{size:14}):null}const S3e=ke.observer(({dataSource:e})=>{const{tables:t}=e;return t.loading?h(D8,{height:"24px",lastWidth:"50%",count:15}):h(g.Box,{h:"100%",sx:{overflow:"auto",".mantine-NavLink-label":{fontFamily:"monospace"}},children:Object.entries(t.data).map(([r,n])=>h(g.NavLink,{label:r,icon:h(vd,{size:14}),defaultOpened:e.table_schema===r,pl:0,childrenOffset:14,children:n.map(i=>h(g.NavLink,{label:i.table_name,icon:h(C3e,{table_type:i.table_type}),onClick:()=>{e.setKeywords(r,i.table_name)},active:e.table_name===i.table_name},i.table_name))},r))})}),D3e=({visible:e})=>h(g.Box,{py:10,sx:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},children:h(g.LoadingOverlay,{visible:e})}),E3e=[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}],N3e={icon:{width:"50px",textAlign:"center"},input:{"&.mantine-Input-withIcon":{paddingLeft:"50px"}}},A3e=ke.observer(({dataSource:e})=>{const{tableData:t}=e;return $(g.Group,{pt:10,px:10,position:"apart",children:[$(g.Group,{position:"left",children:[t.maxPage>1&&h(g.Pagination,{size:"sm",page:t.page,onChange:t.setPage,total:t.maxPage,withEdges:t.maxPage>7,styles:{item:{height:"30px"}}}),h(g.Select,{icon:h(g.Text,{ta:"center",color:"dimmed",size:14,children:"Limit"}),size:"xs",styles:N3e,data:E3e,value:String(t.limit),onChange:r=>t.setLimit(Number(r))})]}),h(g.Group,{position:"right",children:$(g.Text,{color:"dimmed",my:0,size:14,children:["Total ",t.total," rows"]})})]})}),_3e=ke.observer(({dataSource:e})=>{const t=e.tableData;return t.maxPage===0?h(g.Text,{mt:20,color:"red",size:"md",align:"center",sx:{fontFamily:"monospace"},children:"This table is empty"}):(t.error&&(g.Text,t.error),t.page===1&&t.loading?h(D3e,{visible:!0}):$(ri,{children:[h(A3e,{dataSource:e}),$(g.Box,{py:10,sx:{width:"100%",height:"calc(100% - 42px)",overflow:"auto",position:"relative"},children:[h(g.LoadingOverlay,{visible:t.loading,overlayBlur:2}),h(b8,{data:t.data})]})]}))}),M3e={root:{flexGrow:1,overflow:"auto",borderLeft:"1px solid #efefef"},tabsList:{borderBottom:"1px solid #efefef"},tab:{minWidth:120}},T3e=ke.observer(({dataSource:e})=>(z.useEffect(()=>{e.loadTablesIfEmpty()},[e]),e.tables.error?h(g.Text,{color:"red",size:"md",align:"center",sx:{fontFamily:"monospace"},children:e.tables.error}):$(g.Flex,{sx:{height:"100%"},children:[h(g.Box,{w:300,sx:{flexGrow:0,flexShrink:0,position:"relative"},children:h(ri,{children:h(S3e,{dataSource:e})})}),$(g.Tabs,{defaultValue:"structure",styles:M3e,children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"structure",icon:h(lV,{size:14}),children:"Structure"}),h(g.Tabs.Tab,{value:"data",icon:h(vd,{size:14}),children:"Data"})]}),h(g.Tabs.Panel,{value:"structure",children:h(w3e,{dataSource:e})}),h(g.Tabs.Panel,{value:"data",sx:{width:"100%",height:"calc(100% - 36px)",overflow:"hidden"},children:h(_3e,{dataSource:e})})]})]}))),O3e={modal:{paddingLeft:"0px !important",paddingRight:"0px !important"},header:{marginBottom:0,padding:"0 20px 10px",borderBottom:"1px solid #efefef"},title:{flexGrow:1},body:{padding:"0 0 0 20px"}},E8=ke.observer(({dataSource:e,triggerButtonProps:t={}})=>{const[r,n]=z.useState(!1);return $(tt,{children:[h(g.Modal,{opened:r,onClose:()=>n(!1),title:$(g.Group,{position:"apart",sx:{flexGrow:1},children:[h(g.Text,{fw:500,children:"Explorer Data Source"}),$(g.Group,{spacing:7,children:[h(g.Badge,{variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:e.key}),h(g.Badge,{variant:"gradient",gradient:{from:"orange",to:"red"},children:e.type})]})]}),zIndex:320,size:"96vw",overflow:"inside",styles:O3e,children:h(g.Box,{sx:{height:"calc(100vh - 220px)"},children:h(T3e,{dataSource:e})})}),h(g.Button,{variant:"subtle",onClick:()=>n(!0),px:16,styles:{inner:{justifyContent:"flex-start"}},...t,children:"See Table Structure"})]})}),R3e=z.forwardRef(({label:e,type:t,...r},n)=>$(g.Group,{position:"apart",ref:n,...r,children:[h(g.Text,{children:e}),h(g.Text,{children:t})]})),I3e=ke.observer(({value:e,onChange:t})=>{const r=ut(),{data:n=[],loading:i}=Wt.useRequest(rD,{refreshDeps:[]},[]),a=z.useMemo(()=>n.map(u=>({label:u.key,value:u.key,type:u.type})),[n]),o=z.useMemo(()=>a.reduce((u,c)=>(u[c.value]=c.type,u),{}),[a]),s=u=>{u!==null&&t({key:u,type:o[u]})},l=z.useMemo(()=>r.datasources.find(e),[r,e]);return h(g.Select,{data:a,label:$(g.Group,{position:"apart",children:[h(g.Box,{children:"Data Source"}),l&&h(E8,{dataSource:l,triggerButtonProps:{compact:!0,size:"xs",px:10}})]}),itemComponent:R3e,rightSection:l?h(g.Text,{size:"xs",color:"dimmed",children:l.type}):void 0,rightSectionWidth:85,maxDropdownHeight:280,styles:{root:{flex:1},label:{display:"block"},rightSection:{pointerEvents:"none",".mantine-Text-root":{userSelect:"none"}}},disabled:i,value:e.key,onChange:s})}),k3e=e=>{const{queryModel:t}=e,r=ut(),i=r.findQueryUsage(t.id).length>0,a=da.useModals(),o=()=>{a.openConfirmModal({title:"Delete this query?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{r.queries.removeQuery(t.id),r.editor.setPath(["_QUERIES_",""])},zIndex:320})};return i?h(g.Tooltip,{label:"Can't delete this query for it's being used, check out Usage tab for details",withArrow:!0,events:{hover:!0,focus:!1,touch:!1},withinPortal:!0,children:h(g.Button,{color:"gray",size:"xs",leftIcon:h(Ws,{size:16}),sx:{alignSelf:"flex-end"},children:"Delete this Query"})}):h(g.Button,{color:"red",size:"xs",onClick:o,leftIcon:h(Ws,{size:16}),sx:{alignSelf:"flex-end"},children:"Delete this Query"})},P3e=ke.observer(k3e),F3e=ke.observer(({queryModel:e})=>h(g.Center,{ml:20,mt:20,sx:{maxWidth:"600px"},children:$(g.Stack,{spacing:10,sx:{width:"100%"},children:[h(g.Divider,{mb:-10,variant:"dashed",label:"Basics",labelPosition:"center"}),h(g.TextInput,{placeholder:"A unique name",label:"Name",required:!0,sx:{flex:1},value:e.name,onChange:t=>{e.setName(t.currentTarget.value)}}),h(I3e,{value:{type:e.type,key:e.key},onChange:({type:t,key:r})=>{e.setKey(r),e.setType(t)}}),h(g.Divider,{mt:10,mb:-10,variant:"dashed",label:"Conditions",labelPosition:"center"}),h(g.MultiSelect,{label:"Run query when these are truthy",data:e.conditionOptions,value:[...e.run_by],onChange:e.setRunBy}),h(g.Divider,{mt:20,mb:10,variant:"dashed"}),h(P3e,{queryModel:e})]})}));function $3e(){const[e,{open:t,close:r}]=vn.useDisclosure(!1);return $(tt,{children:[h(g.Modal,{opened:e,onClose:r,title:"About FunctionUtils",zIndex:320,children:h(Dd,{value:vNe,styles:{root:{border:"none"},content:{padding:0}}})}),h(g.Button,{variant:"light",color:"violet",size:"xs",onClick:t,leftIcon:h(o1,{size:16}),children:"About parameter 'utils'"})]})}const B3e=({value:e,onChange:t})=>{const r=n=>{!n||t(n)};return h(g.Box,{sx:{position:"relative",flexGrow:1},children:h(pi.default,{className:"function-editor",height:"100%",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1}}})})},Qb=z.forwardRef(({value:e,onChange:t,label:r,defaultValue:n},i)=>{const[a,o]=z.useState(e),s=()=>{t(a)},l=()=>{o(e)},u=()=>{o(n)};z.useEffect(()=>{o(e)},[e]);const c=a!==e;return $(g.Stack,{spacing:4,sx:{height:"100%"},children:[$(g.Group,{mb:6,position:"apart",sx:{flexShrink:0,flexGrow:0},children:[h(g.Group,{position:"left",children:h($3e,{})}),$(g.Group,{position:"right",children:[h(g.Button,{onClick:u,size:"xs",variant:"default",leftIcon:h(CV,{size:16}),children:"Reset to default"}),h(g.Button,{onClick:l,color:"red",size:"xs",disabled:!c,leftIcon:h(SE,{size:16}),children:"Revert Changes"}),h(g.Button,{size:"xs",onClick:s,disabled:!c,leftIcon:h(Cu,{size:16}),children:"Confirm Changes"})]})]}),h(g.Text,{size:14,children:r}),h(B3e,{value:a,onChange:o})]})}),z3e=`
546
+ `,RRe=()=>{const[e,t]=z.useState(!1);return $(tt,{children:[h(g.Button,{variant:"subtle",compact:!0,onClick:()=>t(r=>!r),children:e?"Close":"Click to see expected data structure"}),h(g.Collapse,{in:e,children:h(Us.Prism,{language:"typescript",noCopy:!0,colorScheme:"dark",children:ORe})})]})},IRe=ke.observer(function({config:t}){return $(tt,{children:[h(g.TextInput,{label:"Min-width",value:t.min_width,onChange:r=>t.setMinWidth(r.currentTarget.value),placeholder:"200px"}),h(g.Divider,{label:"Fetch options from database",labelPosition:"center"}),h(g.NumberInput,{value:t.default_selection_count,onChange:t.setDefaultSelectionCount,label:"Select first N options by default"}),h(oE,{value:t.options_query_id,onChange:t.setOptionsQueryID}),h(RRe,{})]})}),kRe=ke.observer(function({filter:t}){const[r,n]=Pe.default.useState(t.plainDefaultValue);return Pe.default.useEffect(()=>{n(t.plainDefaultValue)},[t]),$(g.Box,{sx:{maxWidth:"480px"},children:[h(g.Text,{pb:"md",color:"gray",children:"Preview"}),h(j2,{filter:t,value:r,onChange:n}),h(g.Text,{pt:"lg",pb:"md",color:"gray",children:"Config"}),h(Us.Prism,{language:"json",colorScheme:"dark",noCopy:!0,children:JSON.stringify(t,null,4)})]})}),PRe={select:MRe,"multi-select":_Re,"tree-select":IRe,"text-input":TRe,checkbox:DRe,"date-range":NRe},FRe=[{label:"Select",value:"select"},{label:"Multi Select",value:"multi-select"},{label:"Tree Select",value:"tree-select"},{label:"Text Input",value:"text-input"},{label:"Checkbox",value:"checkbox"},{label:"Date Range",value:"date-range"}],$Re=ke.observer(function({filter:t}){const r=ut(),n=Pe.default.useMemo(()=>PRe[t.type],[t.type]);return $(g.Group,{grow:!0,spacing:20,align:"top",children:[$(g.Box,{sx:{maxWidth:"600px"},children:[h(g.Text,{pb:"md",color:"gray",children:"Edit"}),$(g.Stack,{children:[$(g.Group,{noWrap:!0,children:[h(g.NumberInput,{label:"Placement Order",required:!0,value:t.order,onChange:t.setOrder,hideControls:!0,sx:{flexGrow:"1 !important"}}),t.auto_submit_supported&&h(g.Checkbox,{label:"Submit automatically",checked:t.auto_submit,onChange:i=>t.setAutoSubmit(i.currentTarget.checked),mt:22})]}),h(g.MultiSelect,{label:"Visible in...",data:r.views.options,value:[...t.visibleInViewsIDs],onChange:t.setVisibleInViewsIDs}),h(g.TextInput,{label:"Key",placeholder:"A unique key to refer",required:!0,value:t.key,onChange:i=>{t.setKey(i.currentTarget.value)}}),h(g.TextInput,{label:"Label",placeholder:"Label for this field",required:!0,value:t.label,onChange:i=>{t.setLabel(i.currentTarget.value)}}),h(g.Select,{label:"Widget",data:FRe,required:!0,value:t.type,onChange:t.setType}),h(n,{config:t.config})]})]}),h(kRe,{filter:t})]})}),BRe=ke.observer(({id:e})=>{const t=da.useModals(),r=ut();if(e==="")return null;const n=r.filters.findByID(e);if(!n)return $(g.Text,{size:14,children:["Filter by ID[",e,"] is not found"]});const i=()=>{t.openConfirmModal({title:"Delete this filter?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>r.filters.removeByID(e),zIndex:320})};return $(g.Stack,{sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",pb:30,children:[h(g.Group,{position:"right",pt:10,children:h(g.Button,{size:"xs",color:"red",leftIcon:h(Be.Trash,{size:16}),onClick:i,children:"Delete this filter"})}),h(g.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:h($Re,{filter:n})})]})}),zRe=ke.observer(()=>{const e=ut(),[t,r]=z.useState(()=>JSON.stringify(e.mock_context.current,null,4)),n=()=>{try{e.mock_context.replace(JSON.parse(t))}catch(a){dd.showNotification({title:"Failed",message:a.message,color:"red"})}},i=z.useMemo(()=>{try{return JSON.stringify(JSON.parse(t))!==JSON.stringify(e.mock_context.current)}catch{return!1}},[t,e.mock_context.current]);return $(g.Stack,{sx:{border:"1px solid #eee",borderLeft:"none",borderRight:"none",flexGrow:1,maxWidth:"unset"},children:[h(g.Group,{position:"left",pl:"md",py:"md",sx:{borderBottom:"1px solid #eee",background:"#efefef",flexGrow:0},children:h(g.Text,{weight:500,children:"Mock Context"})}),$(g.Group,{grow:!0,px:"md",pb:"md",pt:0,sx:{flexGrow:1,position:"relative",alignItems:"flex-start"},children:[$(g.Stack,{spacing:10,sx:{maxWidth:"unset !important"},children:[h(g.Text,{children:"A valid json string is required"}),h(g.JsonInput,{validationError:"Invalid json",formatOnBlur:!0,autosize:!0,minRows:30,value:t,onChange:r,sx:{flexGrow:1}})]}),h(g.ActionIcon,{mr:5,variant:"filled",color:"blue",sx:{position:"absolute",right:12,top:0},disabled:!i,onClick:n,children:h(Be.DeviceFloppy,{size:20})})]})]})}),LRe=ke.observer(()=>{const{panel:e}=gn();return h(CS,{label:"Description",value:e.description,onChange:e.setDescription,styles:{root:{flexGrow:1}}})}),VRe=ke.observer(()=>{const{panel:e}=gn(),{style:t}=e;return h(tt,{children:h(g.Switch,{label:"Border",checked:t.border.enabled,onChange:r=>t.border.setEnabled(r.currentTarget.checked)})})}),qRe=ke.observer(()=>{const{panel:e}=gn(),{title:t,setTitle:r}=e,[n,i]=vn.useInputState(t),a=t!==n,o=Pe.default.useCallback(()=>{!a||r(n)},[a,n]);return z.useEffect(()=>{i(t)},[t]),h(g.TextInput,{value:n,onChange:i,label:$(g.Group,{children:[h(g.Text,{children:"Panel Title"}),h(g.ActionIcon,{variant:"subtle",color:"blue",disabled:!a,onClick:o,children:h(Be.DeviceFloppy,{size:20})})]}),styles:{label:{display:"block",paddingBottom:"4px"}}})});function GRe(){return $(g.Stack,{sx:{height:"100%"},children:[h(g.Divider,{label:"Style",labelPosition:"center",variant:"dashed"}),h(VRe,{}),h(g.Divider,{label:"Info",labelPosition:"center",variant:"dashed"}),h(qRe,{}),h(LRe,{})]})}const URe=({queryID:e})=>{const t=ut(),{state:r,error:n}=t.getDataStuffByID(e),i=Pe.default.useMemo(()=>t.queries.findByID(e),[t,e]);return r==="loading"?null:n?h(g.Text,{color:"red",size:"md",align:"center",sx:{fontFamily:"monospace"},children:n}):i!=null&&i.stateMessage?h(g.Text,{color:"gray",align:"center",children:i.stateMessage}):null},WRe={width:"fit-content",minWidth:"100%",tableLayout:"fixed",tr:{width:"fit-content"},th:{position:"relative"},".resizer":{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",cursor:"col-resize",userSelect:"none",touchAction:"none"},".resizer.isResizing":{color:"#228be6",opacity:"1"},"@media (hover: hover)":{".resizer":{opacity:"0"},"*:hover > .resizer":{color:"#228be6",opacity:"1"}}};function b8({data:e}){const t=z.useMemo(()=>{if(!Array.isArray(e)||e.length===0)return[];const n=j4();return Object.keys(e[0]).map(i=>n.accessor(i,{cell:a=>a.getValue()}))},[e]),r=Y4({data:e,columns:t,columnResizeMode:"onChange",getCoreRowModel:K4()});return e.length===0?h(g.Box,{sx:{height:"5em"}}):h(ri,{children:$(g.Table,{sx:WRe,children:[h("thead",{children:r.getHeaderGroups().map(n=>h("tr",{children:n.headers.map(i=>$("th",{style:{width:i.getSize()},children:[i.isPlaceholder?null:pb(i.column.columnDef.header,i.getContext()),h(g.ActionIcon,{onMouseDown:i.getResizeHandler(),onTouchStart:i.getResizeHandler(),className:`resizer ${i.column.getIsResizing()?"isResizing":""}`,children:h(Be.ArrowBarToRight,{})})]},i.id))},n.id))}),h("tbody",{children:r.getRowModel().rows.map(n=>h("tr",{children:n.getVisibleCells().map(i=>h("td",{children:h(ri,{children:pb(i.column.columnDef.cell,i.getContext())})},i.id))},n.id))})]})})}const x8=ke.observer(function({id:t}){const r=ut(),{data:n,state:i}=r.getDataStuffByID(t),a=i==="loading",o=()=>{r.queries.refetchDataByQueryID(t)},s=()=>{r.queries.downloadDataByQueryID(t)},l=z.useMemo(()=>Array.isArray(n)?n.slice(0,10):[],[n]),u=!Array.isArray(n)||n.length===0;return $(g.Stack,{sx:{border:"1px solid #eee"},children:[$(g.Group,{position:"apart",py:"md",pl:"md",sx:{borderBottom:"1px solid #eee",background:"#efefef"},children:[$(g.Group,{position:"left",children:[h(g.Text,{weight:500,children:"Preview Data"}),n.length>10&&$(g.Text,{size:"sm",color:"gray",children:["Showing 10 rows of ",n.length]})]}),$(g.Group,{pr:15,children:[h(g.ActionIcon,{variant:"subtle",color:"blue",disabled:a,onClick:o,children:h(Be.Refresh,{size:15})}),h(g.ActionIcon,{variant:"subtle",color:"blue",disabled:a||u,onClick:s,children:h(Be.Download,{size:15})})]})]}),$(g.Box,{sx:{position:"relative",overflow:"auto"},children:[h(g.LoadingOverlay,{visible:a}),h(URe,{queryID:t}),h(b8,{data:l})]})]})}),HRe=ke.observer(function(){const t=ut(),{panel:{queryID:r,setQueryID:n}}=gn(),i=Pe.default.useMemo(()=>t.queries.current.map(o=>({value:o.id,label:o.name})),[t.queries.current]),a=()=>{t.editor.setPath(["_QUERIES_",r])};return $(g.Stack,{children:[$(g.Group,{position:"left",sx:{maxWidth:"600px",alignItems:"baseline"},children:[h(g.Text,{children:"Use query"}),h(g.Select,{data:i,value:r,onChange:n,allowDeselect:!1,clearable:!1,sx:{flexGrow:"1 !important"},maxDropdownHeight:300,rightSection:r&&h(g.Tooltip,{label:"Open this query",children:h(g.ActionIcon,{variant:"subtle",color:"blue",onClick:a,children:h(z6,{size:16})})})})]}),h(x8,{id:r})]})}),jRe=ke.observer(({height:e})=>{const t=ut(),{data:r,loading:n,error:i,panel:{viz:a,queryID:o}}=gn(),s=t.queries.findByID(o);return h(fz,{viz:a,data:r,loading:n,error:i,query:s,height:e})}),KRe=ke.observer(()=>{const{panel:{title:e,style:{border:t}}}=gn();return h(ri,{children:h(g.Box,{sx:{height:"100%",flexGrow:0,flexShrink:0,width:"600px"},children:$(g.Stack,{mt:24,spacing:5,sx:{width:"600px",height:"450px",background:"transparent",borderRadius:"5px",border:"1px solid #e9ecef",borderWidth:t.enabled?"1px":"0px"},children:[$(g.Group,{position:"apart",noWrap:!0,sx:{flexGrow:0,flexShrink:0},children:[h(g.Group,{children:h(Y2,{})}),h(g.Group,{grow:!0,position:"center",children:h(g.Text,{lineClamp:1,weight:"bold",children:e})}),h(g.Group,{position:"right",spacing:0,sx:{height:"28px"}})]}),h(g.Group,{px:5,pb:5,sx:{flexGrow:1},children:h(jRe,{height:"410px"})})]})})})}),sE={name:"new_var",size:"1rem",weight:"initial",color:{type:"static",staticColor:"Red"},data_field:"",aggregation:{type:"sum",config:{}},formatter:{output:"number",mantissa:0,trimMantissa:!1,average:!1}};class YRe{constructor(t){at(this,"panel");at(this,"selected");this.panel=t,cr.makeAutoObservable(this,{},{deep:!1,autoBind:!0})}get variables(){return this.panel.variables}addNew(){const t=this.panel.variables.filter(r=>r.name.startsWith(sE.name)).length;this.panel.addVariable(Se.cloneDeep({...sE,name:`${sE.name}${t||""}`})),this.selected=Se.last(this.panel.variables)}select(t){this.selected=t}remove(t){this.selected===t&&(this.selected=void 0);const r=this.panel.variables.indexOf(t);if(this.panel.removeVariable(t),!this.selected&&!Se.isEmpty(this.panel.variables)){const n=Math.min(this.panel.variables.length-1,r);this.selected=this.panel.variables[n]}}}function XRe(){const{panel:e}=gn();return Wt.useCreation(()=>new YRe(e),[e])}const ZRe=Pe.default.forwardRef(function({value:t,onChange:r,data:n,withStyle:i=!0},a){const o=(s,l)=>{const u=Ne.default.cloneDeep(t);Ne.default.set(u,s,l),r(u)};return $(g.Box,{px:"sm",py:"md",ref:a,children:[$(g.Group,{grow:!0,noWrap:!0,children:[h(g.TextInput,{label:"Name",required:!0,value:t.name,onChange:s=>o("name",s.currentTarget.value)}),h(It,{label:"Data Field",required:!0,data:n,value:t.data_field,onChange:s=>o("data_field",s)})]}),h(df,{label:"Aggregation",value:t.aggregation,onChange:s=>o("aggregation",s)}),h(g.Divider,{my:"xs",label:"Format",labelPosition:"center"}),h(va,{value:t.formatter,onChange:s=>o("formatter",s)}),i&&h(pM,{value:t,onChange:r})]})}),w8=g.createStyles(e=>({root:{height:"100%",overflow:"hidden",".var-list-container":{"& > *":{height:"100%"},width:250,height:"100%"},".var-list-actions":{height:"fit-content",flexShrink:0,width:"100%"},".var-list":{flex:"1 1 auto",overflow:"auto",minHeight:0,"& > *":{flex:"0 0 auto"}}},config:{height:"100%",overflow:"auto",paddingRight:10}})),QRe=e=>{const{uiModel:t}=e;return h(g.Stack,{className:"var-list",children:t.variables.map(r=>h(g.Button,{variant:t.selected===r?"filled":"subtle",color:"gray",onClick:()=>t.select(r),children:r.name},r.name))})},JRe=ke.observer(QRe),eIe=({variable:e,data:t})=>h(g.Group,{style:{minHeight:0,height:"calc(100% - 68px)"},children:h(g.Paper,{withBorder:!0,p:"md",children:h4(e,t)})}),tIe=ke.observer(eIe),rIe=e=>{const t=Wt.useCreation(()=>UNe(e.variable),[e.variable]),{classes:r}=w8(),{data:n}=gn();return $(g.Group,{style:{height:"100%"},align:"start",children:[$(g.Stack,{"data-testid":"variable-editor",align:"stretch",className:r.config,children:[$(g.Group,{position:"right",children:[h(g.ActionIcon,{variant:"filled",disabled:!t.changed,color:"primary",onClick:t.commit,children:h(Cu,{size:18})}),h(g.ActionIcon,{color:"red",onClick:()=>e.uiModel.remove(e.variable),children:h(Ws,{size:18})})]}),h(ZRe,{value:j.getSnapshot(t.copy),onChange:t.update,data:n})]}),h(tIe,{variable:j.getSnapshot(t.copy),data:n})]})},nIe=ke.observer(rIe),iIe=()=>{const e=XRe(),{classes:t}=w8();return $(g.Group,{className:t.root,noWrap:!0,align:"start",children:[h(g.Paper,{withBorder:!0,p:"md",className:"var-list-container",children:$(g.Stack,{justify:"space-between",children:[h(g.Box,{className:"var-list-actions",children:h(g.Button,{variant:"light",size:"sm",onClick:e.addNew,fullWidth:!0,children:"Add Variable"})}),h(JRe,{uiModel:e})]})}),e.selected?h(tt,{children:h(nIe,{uiModel:e,variable:e.selected})}):h("span",{children:"Select or create a new variable on right side"})]})},aIe=ke.observer(iIe);function oIe(){const{vizManager:e}=z.useContext(Oa);return z.useMemo(()=>{const t=e.availableVizList.map(r=>{var n,i;return{value:r.name,label:(n=r.displayName)!=null?n:r.name,group:(i=r.displayGroup)!=null?i:""}});return Ne.default.orderBy(t,[r=>r.group,r=>r.label],["asc","asc"])},[e])}const sIe=ke.observer(({value:e,submit:t})=>{const[r,n]=vn.useInputState(e);z.useEffect(()=>{n(e)},[e]);const i=oIe(),a=e!==r;return h(g.Select,{label:"Visualization",value:r,searchable:!0,onChange:n,data:i,rightSection:h(g.ActionIcon,{disabled:!a,onClick:()=>t(r),children:h(Be.DeviceFloppy,{size:20})}),maxDropdownHeight:600})}),C8=[];function lIe(e,t){try{return e.resolveComponent(t).createConfig()}catch{return null}}function uIe(){const{data:e,panel:{variables:t,viz:r,title:n,queryID:i,description:a,setDescription:o,setTitle:s,setQueryID:l,id:u}}=gn(),{vizManager:c}=z.useContext(Oa),d={title:n,description:a,viz:r,queryID:i,id:u},f={setDescription:o,setQueryID:l,setTitle:s},p=uz(d);try{return c.resolveComponent(d.viz.type),h(md,{configure:p,children:h(AEe,{variables:t,setVizConf:r.setConf,panel:d,panelInfoEditor:f,vizManager:c,data:e})})}catch(m){return console.info(Se.get(m,"message")),null}}const cIe=ke.observer(()=>{const{data:e,panel:{viz:t}}=gn(),{vizManager:r}=z.useContext(Oa),n=Pe.default.useCallback(u=>{if(u===t.type)return;const c=lIe(r,u);t.setType(u),t.setConf(c||{})},[t.type]),i=u=>{try{t.setConf(JSON.parse(u))}catch(c){console.error(c)}},a=Pe.default.useMemo(()=>{var u;return(u=C8.find(c=>c.value===t.type))==null?void 0:u.Panel},[t.type,C8]),o=uIe(),s=a?z.createElement(a,{data:e,conf:t.conf,setConf:t.setConf}):null,l=o||s;return $(g.Stack,{align:"stretch",sx:{height:"100%",overflow:"hidden"},children:[h(sIe,{submit:n,value:t.type}),h(g.Stack,{pb:50,sx:{flexGrow:1,maxHeight:"calc(100% - 80px)",overflow:"auto"},children:l}),!l&&h(g.JsonInput,{minRows:20,label:"Config",value:JSON.stringify(t.conf,null,2),onChange:i})]})}),dIe=ke.observer(({panel:e,sourceViewID:t})=>{const r=ut(),[n,i]=z.useState(t);z.useEffect(()=>{i(t)},[t]);const[a,{open:o,close:s}]=vn.useDisclosure(!1),l=()=>{e.moveToView(t,n),s()};return $(tt,{children:[h(g.Button,{size:"xs",variant:"subtle",color:"blue",onClick:o,leftIcon:h(wE,{size:14}),children:"Move into Another View"}),h(g.Modal,{opened:a,onClose:s,title:"Move panel into another view",zIndex:320,overflow:"inside",children:$(g.Stack,{sx:{maxHeight:"calc(100vh - 185px)",overflow:"hidden"},children:[h(g.Radio.Group,{value:n,onChange:i,pb:10,sx:{flexGrow:1,maxHeight:"calc(100vh - 185px - 30px)",overflow:"auto"},children:h(g.Stack,{spacing:"xs",children:r.views.options.map(u=>h(g.Radio,{value:u.value,label:u.label},u.value))})}),$(g.Group,{noWrap:!0,position:"apart",sx:{flexGrow:0,flexShrink:0},children:[h(g.Button,{size:"xs",color:"red",leftIcon:h(DE,{size:14}),onClick:s,children:"Cancel"}),h(g.Button,{size:"xs",color:"blue",leftIcon:h(Cu,{size:14}),onClick:l,disabled:n===t,children:"Confirm"})]})]})})]})}),fIe={root:{flexGrow:1,width:"100%",height:"100%"},panel:{width:"100%",height:"100%",padding:10}},S8=({children:e})=>$(g.Group,{noWrap:!0,grow:!0,position:"left",spacing:20,sx:{width:"100%",height:"calc(100% - 36px)"},children:[h(g.Box,{sx:{maxWidth:"calc(100% - 610px - 10px)",height:"100%",overflow:"auto"},children:e}),h(KRe,{})]});function pIe(e){return!["richText","button"].includes(e)}const hIe=ke.observer(({panel:e})=>{const t=da.useModals(),r=ut(),[n,i]=z.useState("Data"),{data:a,state:o,error:s}=r.getDataStuffByID(e.queryID),l=r.queries.findByID(e.queryID),c=pIe(e.viz.type)&&o==="loading",d=c||s||!l||!!l.stateMessage,f=r.editor.path[1];z.useEffect(()=>{i(v=>d&&v==="Visualization"?"Data":v)},[e.id,d]);const p=()=>{r.editor.setPath(["_VIEWS_",f])},m=()=>t.openConfirmModal({title:"Delete this panel?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{r.removePanelByID(e.id,f),p()},confirmProps:{color:"red"},zIndex:320});return $(m1,{value:{panel:e,data:a,loading:c,error:s},children:[$(g.Group,{px:16,position:"apart",sx:{borderBottom:"1px solid #eee"},children:[$(g.Text,{pt:9,pb:8,children:[e.title?e.title:e.viz.type," "]}),$(g.Group,{position:"right",noWrap:!0,children:[h(dIe,{panel:e,sourceViewID:f}),h(g.Button,{size:"xs",variant:"subtle",color:"red",onClick:m,leftIcon:h(Ws,{size:14}),children:"Delete This Panel"})]})]}),$(g.Tabs,{value:n,onTabChange:i,keepMounted:!1,styles:fIe,children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"Data",disabled:c,children:"Data"}),h(g.Tabs.Tab,{value:"Panel",children:"Panel"}),h(g.Tabs.Tab,{value:"Variables",disabled:d,children:h(g.Tooltip,{label:"Requires data",disabled:!d,withinPortal:!0,zIndex:310,children:h(g.Text,{children:"Variables"})})}),h(g.Tabs.Tab,{value:"Visualization",disabled:d,children:h(g.Tooltip,{label:"Requires data",disabled:!d,withinPortal:!0,zIndex:310,children:h(g.Text,{children:"Visualization"})})}),h(g.Tabs.Tab,{value:"Interactions",children:"Interactions"})]}),$(g.Tabs.Panel,{value:"Data",children:[h(g.LoadingOverlay,{visible:c,exitTransitionDuration:0}),h(HRe,{})]}),h(g.Tabs.Panel,{value:"Panel",children:h(S8,{children:h(GRe,{})})}),h(g.Tabs.Panel,{value:"Variables",children:h(aIe,{})}),h(g.Tabs.Panel,{value:"Visualization",children:h(ri,{children:h(S8,{children:h(cIe,{})})})}),h(g.Tabs.Panel,{value:"Interactions",children:h(ri,{children:h(EEe,{})})})]})]})}),mIe=ke.observer(({viewID:e,panelID:t})=>{const r=ut();if(!r.views.findByID(e))return $(g.Text,{size:14,children:["View by ID[",e,"] is not found"]});const i=r.panels.findByID(t);return i?h(hIe,{panel:i}):$(g.Text,{size:14,children:["Panel by ID[",t,"] is not found"]})}),D8=({width:e="calc(100% - 32px)",lastWidth:t="50%",height:r,count:n,spacing:i=16,pl:a=0})=>$(g.Stack,{spacing:i,mt:6,pl:a,children:[Array.from(new Array(n-1),(o,s)=>h(g.Skeleton,{width:e,height:r,radius:"xs"},s)),h(g.Skeleton,{width:t,height:r,radius:"xs"})]}),sd=({value:e})=>e===null||e===""?null:h(g.Tooltip,{label:e,disabled:!e,multiline:!0,children:h(g.ActionIcon,{children:h(o1,{size:14})})}),vIe=({column:e})=>{const{column_key:t,column_key_text:r}=e;return t?h(g.Tooltip,{label:r,disabled:!r,children:h(g.Badge,{children:t})}):null},gIe=ke.observer(({dataSource:e})=>{const{columns:t}=e;return t.loading?h(D8,{height:"24px",width:"100%",lastWidth:"100%",count:20,pl:6}):t.empty?null:$(g.Table,{highlightOnHover:!0,fontSize:14,sx:{width:"auto",minWidth:"1000px",alignSelf:"flex-start",flexGrow:0,tableLayout:"fixed",tbody:{fontFamily:"monospace"}},children:[$("colgroup",{children:[h("col",{style:{width:50}}),h("col",{style:{minWidth:300}}),h("col",{style:{width:30}}),h("col",{style:{width:70}}),h("col",{style:{minWidth:300}}),h("col",{style:{minWidth:80,width:80}}),h("col",{style:{minWidth:120,width:120}})]}),h("thead",{children:$("tr",{children:[h("th",{children:"#"}),h("th",{children:"Column Name"}),h("th",{}),h("th",{}),h("th",{children:"Type"}),h("th",{children:"Nullable"}),h("th",{children:"Default Value"})]})}),h("tbody",{children:t.data.map(r=>$("tr",{children:[h("td",{children:r.ordinal_position}),h("td",{children:r.column_name}),h("td",{children:h(sd,{value:r.column_comment})}),h("td",{children:h(vIe,{column:r})}),h("td",{children:r.column_type}),h("td",{children:r.is_nullable}),h("td",{children:h(sd,{value:r.column_default})})]},r.column_name))})]})}),yIe=ke.observer(({dataSource:e})=>{const{indexes:t}=e,r=t.data;return $(g.Table,{highlightOnHover:!0,fontSize:14,sx:{width:"auto",minWidth:"950px",alignSelf:"flex-start",flexGrow:0,tableLayout:"fixed",tbody:{fontFamily:"monospace"}},children:[$("colgroup",{children:[h("col",{style:{width:100}}),h("col",{style:{minWidth:300}}),h("col",{style:{width:150}}),h("col",{style:{width:150}}),h("col",{style:{width:250}})]}),h("thead",{children:$("tr",{children:[h("th",{children:"Index Length"}),h("th",{children:"Index Name"}),h("th",{children:"Index Algorithm"}),h("th",{children:"Unique"}),h("th",{children:"Column Name"})]})}),h("tbody",{children:r.map(n=>$("tr",{children:[h("td",{children:n.index_length}),h("td",{children:n.index_name}),h("td",{children:n.index_algorithm}),h("td",{children:n.is_unique?"YES":"NO"}),h("td",{children:n.column_name})]},n.index_name))})]})}),bIe=ke.observer(({dataSource:e})=>{const{indexes:t}=e,r=t.data;return $(g.Table,{highlightOnHover:!0,fontSize:14,sx:{width:"auto",minWidth:"850px",alignSelf:"flex-start",flexGrow:0,tableLayout:"fixed",tbody:{fontFamily:"monospace"}},children:[$("colgroup",{children:[h("col",{style:{minWidth:300}}),h("col",{style:{width:150}}),h("col",{style:{width:100}}),h("col",{style:{width:100}}),h("col",{style:{width:100}}),h("col",{style:{width:100}})]}),h("thead",{children:$("tr",{children:[h("th",{children:"Index Name"}),h("th",{children:"Index Algorithm"}),h("th",{children:"Unique"}),h("th",{children:"Definition"}),h("th",{children:"Condition"}),h("th",{children:"Comment"})]})}),h("tbody",{children:r.map(n=>$("tr",{children:[h("td",{children:n.index_name}),h("td",{children:n.index_algorithm}),h("td",{children:n.is_unique?"YES":"NO"}),h("td",{children:h(sd,{value:n.index_definition})}),h("td",{children:h(sd,{value:n.condition})}),h("td",{children:h(sd,{value:n.comment})})]},n.index_name))})]})}),xIe=ke.observer(({dataSource:e})=>{const{indexes:t}=e;return t.loading||t.empty?null:e.type===qr.MySQL?h(yIe,{dataSource:e}):e.type===qr.Postgresql?h(bIe,{dataSource:e}):null}),wIe=ke.observer(({dataSource:e})=>$(g.Stack,{spacing:40,pt:10,sx:{flexGrow:1,overflow:"auto",position:"relative"},children:[h(ri,{children:h(gIe,{dataSource:e})}),h(ri,{children:h(xIe,{dataSource:e})})]}));function CIe({table_type:e}){return e==="VIEW"?h(vV,{size:14}):e==="BASE TABLE"?h(TV,{size:14}):null}const SIe=ke.observer(({dataSource:e})=>{const{tables:t}=e;return t.loading?h(D8,{height:"24px",lastWidth:"50%",count:15}):h(g.Box,{h:"100%",sx:{overflow:"auto",".mantine-NavLink-label":{fontFamily:"monospace"}},children:Object.entries(t.data).map(([r,n])=>h(g.NavLink,{label:r,icon:h(vd,{size:14}),defaultOpened:e.table_schema===r,pl:0,childrenOffset:14,children:n.map(i=>h(g.NavLink,{label:i.table_name,icon:h(CIe,{table_type:i.table_type}),onClick:()=>{e.setKeywords(r,i.table_name)},active:e.table_name===i.table_name},i.table_name))},r))})}),DIe=({visible:e})=>h(g.Box,{py:10,sx:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},children:h(g.LoadingOverlay,{visible:e})}),EIe=[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}],NIe={icon:{width:"50px",textAlign:"center"},input:{"&.mantine-Input-withIcon":{paddingLeft:"50px"}}},AIe=ke.observer(({dataSource:e})=>{const{tableData:t}=e;return $(g.Group,{pt:10,px:10,position:"apart",children:[$(g.Group,{position:"left",children:[t.maxPage>1&&h(g.Pagination,{size:"sm",page:t.page,onChange:t.setPage,total:t.maxPage,withEdges:t.maxPage>7,styles:{item:{height:"30px"}}}),h(g.Select,{icon:h(g.Text,{ta:"center",color:"dimmed",size:14,children:"Limit"}),size:"xs",styles:NIe,data:EIe,value:String(t.limit),onChange:r=>t.setLimit(Number(r))})]}),h(g.Group,{position:"right",children:$(g.Text,{color:"dimmed",my:0,size:14,children:["Total ",t.total," rows"]})})]})}),_Ie=ke.observer(({dataSource:e})=>{const t=e.tableData;return t.maxPage===0?h(g.Text,{mt:20,color:"red",size:"md",align:"center",sx:{fontFamily:"monospace"},children:"This table is empty"}):(t.error&&(g.Text,t.error),t.page===1&&t.loading?h(DIe,{visible:!0}):$(ri,{children:[h(AIe,{dataSource:e}),$(g.Box,{py:10,sx:{width:"100%",height:"calc(100% - 42px)",overflow:"auto",position:"relative"},children:[h(g.LoadingOverlay,{visible:t.loading,overlayBlur:2}),h(b8,{data:t.data})]})]}))}),MIe={root:{flexGrow:1,overflow:"auto",borderLeft:"1px solid #efefef"},tabsList:{borderBottom:"1px solid #efefef"},tab:{minWidth:120}},TIe=ke.observer(({dataSource:e})=>(z.useEffect(()=>{e.loadTablesIfEmpty()},[e]),e.tables.error?h(g.Text,{color:"red",size:"md",align:"center",sx:{fontFamily:"monospace"},children:e.tables.error}):$(g.Flex,{sx:{height:"100%"},children:[h(g.Box,{w:300,sx:{flexGrow:0,flexShrink:0,position:"relative"},children:h(ri,{children:h(SIe,{dataSource:e})})}),$(g.Tabs,{defaultValue:"structure",styles:MIe,children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"structure",icon:h(lV,{size:14}),children:"Structure"}),h(g.Tabs.Tab,{value:"data",icon:h(vd,{size:14}),children:"Data"})]}),h(g.Tabs.Panel,{value:"structure",children:h(wIe,{dataSource:e})}),h(g.Tabs.Panel,{value:"data",sx:{width:"100%",height:"calc(100% - 36px)",overflow:"hidden"},children:h(_Ie,{dataSource:e})})]})]}))),OIe={modal:{paddingLeft:"0px !important",paddingRight:"0px !important"},header:{marginBottom:0,padding:"0 20px 10px",borderBottom:"1px solid #efefef"},title:{flexGrow:1},body:{padding:"0 0 0 20px"}},E8=ke.observer(({dataSource:e,triggerButtonProps:t={}})=>{const[r,n]=z.useState(!1);return $(tt,{children:[h(g.Modal,{opened:r,onClose:()=>n(!1),title:$(g.Group,{position:"apart",sx:{flexGrow:1},children:[h(g.Text,{fw:500,children:"Explorer Data Source"}),$(g.Group,{spacing:7,children:[h(g.Badge,{variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:e.key}),h(g.Badge,{variant:"gradient",gradient:{from:"orange",to:"red"},children:e.type})]})]}),zIndex:320,size:"96vw",overflow:"inside",styles:OIe,children:h(g.Box,{sx:{height:"calc(100vh - 220px)"},children:h(TIe,{dataSource:e})})}),h(g.Button,{variant:"subtle",onClick:()=>n(!0),px:16,styles:{inner:{justifyContent:"flex-start"}},...t,children:"See Table Structure"})]})}),RIe=z.forwardRef(({label:e,type:t,...r},n)=>$(g.Group,{position:"apart",ref:n,...r,children:[h(g.Text,{children:e}),h(g.Text,{children:t})]})),IIe=ke.observer(({value:e,onChange:t})=>{const r=ut(),{data:n=[],loading:i}=Wt.useRequest(rD,{refreshDeps:[]},[]),a=z.useMemo(()=>n.map(u=>({label:u.key,value:u.key,type:u.type})),[n]),o=z.useMemo(()=>a.reduce((u,c)=>(u[c.value]=c.type,u),{}),[a]),s=u=>{u!==null&&t({key:u,type:o[u]})},l=z.useMemo(()=>r.datasources.find(e),[r,e]);return h(g.Select,{data:a,label:$(g.Group,{position:"apart",children:[h(g.Box,{children:"Data Source"}),l&&h(E8,{dataSource:l,triggerButtonProps:{compact:!0,size:"xs",px:10}})]}),itemComponent:RIe,rightSection:l?h(g.Text,{size:"xs",color:"dimmed",children:l.type}):void 0,rightSectionWidth:85,maxDropdownHeight:280,styles:{root:{flex:1},label:{display:"block"},rightSection:{pointerEvents:"none",".mantine-Text-root":{userSelect:"none"}}},disabled:i,value:e.key,onChange:s})}),kIe=e=>{const{queryModel:t}=e,r=ut(),i=r.findQueryUsage(t.id).length>0,a=da.useModals(),o=()=>{a.openConfirmModal({title:"Delete this query?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{r.queries.removeQuery(t.id),r.editor.setPath(["_QUERIES_",""])},zIndex:320})};return i?h(g.Tooltip,{label:"Can't delete this query for it's being used, check out Usage tab for details",withArrow:!0,events:{hover:!0,focus:!1,touch:!1},withinPortal:!0,children:h(g.Button,{color:"gray",size:"xs",leftIcon:h(Ws,{size:16}),sx:{alignSelf:"flex-end"},children:"Delete this Query"})}):h(g.Button,{color:"red",size:"xs",onClick:o,leftIcon:h(Ws,{size:16}),sx:{alignSelf:"flex-end"},children:"Delete this Query"})},PIe=ke.observer(kIe),FIe=ke.observer(({queryModel:e})=>h(g.Center,{ml:20,mt:20,sx:{maxWidth:"600px"},children:$(g.Stack,{spacing:10,sx:{width:"100%"},children:[h(g.Divider,{mb:-10,variant:"dashed",label:"Basics",labelPosition:"center"}),h(g.TextInput,{placeholder:"A unique name",label:"Name",required:!0,sx:{flex:1},value:e.name,onChange:t=>{e.setName(t.currentTarget.value)}}),h(IIe,{value:{type:e.type,key:e.key},onChange:({type:t,key:r})=>{e.setKey(r),e.setType(t)}}),h(g.Divider,{mt:10,mb:-10,variant:"dashed",label:"Conditions",labelPosition:"center"}),h(g.MultiSelect,{label:"Run query when these are truthy",data:e.conditionOptions,value:[...e.run_by],onChange:e.setRunBy}),h(g.Divider,{mt:20,mb:10,variant:"dashed"}),h(PIe,{queryModel:e})]})}));function $Ie(){const[e,{open:t,close:r}]=vn.useDisclosure(!1);return $(tt,{children:[h(g.Modal,{opened:e,onClose:r,title:"About FunctionUtils",zIndex:320,children:h(Dd,{value:vNe,styles:{root:{border:"none"},content:{padding:0}}})}),h(g.Button,{variant:"light",color:"violet",size:"xs",onClick:t,leftIcon:h(o1,{size:16}),children:"About parameter 'utils'"})]})}const BIe=({value:e,onChange:t})=>{const r=n=>{!n||t(n)};return h(g.Box,{sx:{position:"relative",flexGrow:1},children:h(pi.default,{className:"function-editor",height:"100%",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1}}})})},Qb=z.forwardRef(({value:e,onChange:t,label:r,defaultValue:n},i)=>{const[a,o]=z.useState(e),s=()=>{t(a)},l=()=>{o(e)},u=()=>{o(n)};z.useEffect(()=>{o(e)},[e]);const c=a!==e;return $(g.Stack,{spacing:4,sx:{height:"100%"},children:[$(g.Group,{mb:6,position:"apart",sx:{flexShrink:0,flexGrow:0},children:[h(g.Group,{position:"left",children:h($Ie,{})}),$(g.Group,{position:"right",children:[h(g.Button,{onClick:u,size:"xs",variant:"default",leftIcon:h(CV,{size:16}),children:"Reset to default"}),h(g.Button,{onClick:l,color:"red",size:"xs",disabled:!c,leftIcon:h(SE,{size:16}),children:"Revert Changes"}),h(g.Button,{size:"xs",onClick:s,disabled:!c,leftIcon:h(Cu,{size:16}),children:"Confirm Changes"})]})]}),h(g.Text,{size:14,children:r}),h(BIe,{value:a,onChange:o})]})}),zIe=`
547
547
  -- You may reference global variables in SQL or VizConfig.
548
548
  SELECT *
549
549
  FROM commit
@@ -555,8 +555,8 @@ WHERE
555
555
  -- SQL snippets
556
556
  AND \${sql_snippets.author_email_condition}
557
557
  \${sql_snippets.order_by_clause}
558
- `,N8=ke.observer(function({showSQLSnippets:t=!0,sx:r={}}){const n=ut(),i=n.context.current,a=(()=>{const o={context:{...n.mock_context.current,...i},filters:n.filters.previewValues};return t&&(o.sql_snippets=n.sqlSnippets.record),JSON.stringify(o,null,2)})();return h(g.Stack,{sx:{overflow:"hidden",...r},children:$(g.Stack,{sx:{width:"100%"},children:[h(g.Text,{weight:500,sx:{flexGrow:0},children:"Guide"}),h(Us.Prism,{language:"sql",sx:{width:"100%"},noCopy:!0,colorScheme:"dark",children:z3e}),h(g.Text,{weight:500,sx:{flexGrow:0},children:"Current Values"}),h(Us.Prism,{language:"json",sx:{width:"100%"},noCopy:!0,colorScheme:"dark",children:a})]})})}),lE=ke.observer(()=>{const[e,t]=z.useState(!1);return $(tt,{children:[h(g.Modal,{opened:e,onClose:()=>t(!1),title:"Global Variables",zIndex:320,size:"800px",children:h(N8,{})}),h(g.Button,{variant:"subtle",onClick:()=>t(!0),px:16,styles:{inner:{justifyContent:"flex-start"}},children:"See Global Variables"})]})}),A8={pre:["function build_request({ context, filters }, utils) {"," // build the quest"," return { method, url, params, headers, data }","}"].join(`
558
+ `,N8=ke.observer(function({showSQLSnippets:t=!0,sx:r={}}){const n=ut(),i=n.context.current,a=(()=>{const o={context:{...n.mock_context.current,...i},filters:n.filters.previewValues};return t&&(o.sql_snippets=n.sqlSnippets.record),JSON.stringify(o,null,2)})();return h(g.Stack,{sx:{overflow:"hidden",...r},children:$(g.Stack,{sx:{width:"100%"},children:[h(g.Text,{weight:500,sx:{flexGrow:0},children:"Guide"}),h(Us.Prism,{language:"sql",sx:{width:"100%"},noCopy:!0,colorScheme:"dark",children:zIe}),h(g.Text,{weight:500,sx:{flexGrow:0},children:"Current Values"}),h(Us.Prism,{language:"json",sx:{width:"100%"},noCopy:!0,colorScheme:"dark",children:a})]})})}),lE=ke.observer(()=>{const[e,t]=z.useState(!1);return $(tt,{children:[h(g.Modal,{opened:e,onClose:()=>t(!1),title:"Global Variables",zIndex:320,size:"800px",children:h(N8,{})}),h(g.Button,{variant:"subtle",onClick:()=>t(!0),px:16,styles:{inner:{justifyContent:"flex-start"}},children:"See Global Variables"})]})}),A8={pre:["function build_request({ context, filters }, utils) {"," // build the quest"," return { method, url, params, headers, data }","}"].join(`
559
559
  `),post:["function process_result(res, utils) {"," // your code goes here"," return data","}"].join(`
560
- `)},L3e=ke.observer(({queryModel:e})=>e.typedAsHTTP?$(g.Tabs,{defaultValue:"pre_process",orientation:"vertical",sx:{flexGrow:1},children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"pre_process",children:"Build Request"}),h(g.Tabs.Tab,{value:"post_process",children:"Process Result"}),h(lE,{})]}),h(g.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:h(Qb,{label:"",value:e.pre_process,onChange:e.setPreProcess,defaultValue:A8.pre})}),h(g.Tabs.Panel,{value:"post_process",p:"sm",children:h(Qb,{label:"",value:e.post_process,onChange:e.setPostProcess,defaultValue:A8.post})})]}):null),uE=({value:e,onChange:t,height:r="200px",defaultLanguage:n="sql"})=>{const i=o=>{console.log("changing"),t==null||t(o!=null?o:"")},a=!t;return h(pi.default,{className:"minimal-monaco-editor",height:r,defaultLanguage:n,value:e,onChange:a?void 0:i,theme:"vs-dark",options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:a||!t}})},V3e=({value:e,height:t="200px",defaultLanguage:r="sql"})=>h(pi.default,{className:"preview-sql-in-monaco-editor",height:t,defaultLanguage:r,value:e,onChange:void 0,theme:"vs-light",options:{lineNumbers:"on",folding:!0,lineDecorationsWidth:20,wordWrap:"on",minimap:{enabled:!1},readOnly:!0}}),q3e=ke.observer(({value:e})=>{const t=ut(),r=t.context.current,n=Pe.default.useMemo(()=>Rz(e,r,t.mock_context.current,t.sqlSnippets.current,t.filters.values),[e,r,t.mock_context.current,t.sqlSnippets.current,t.filters.values]);return h(V3e,{height:"100%",value:n})}),_8={pre:["function process_request({ context, filters, sql }, utils) {"," // modify and return sql"," return sql","}"].join(`
560
+ `)},LIe=ke.observer(({queryModel:e})=>e.typedAsHTTP?$(g.Tabs,{defaultValue:"pre_process",orientation:"vertical",sx:{flexGrow:1},children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"pre_process",children:"Build Request"}),h(g.Tabs.Tab,{value:"post_process",children:"Process Result"}),h(lE,{})]}),h(g.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:h(Qb,{label:"",value:e.pre_process,onChange:e.setPreProcess,defaultValue:A8.pre})}),h(g.Tabs.Panel,{value:"post_process",p:"sm",children:h(Qb,{label:"",value:e.post_process,onChange:e.setPostProcess,defaultValue:A8.post})})]}):null),uE=({value:e,onChange:t,height:r="200px",defaultLanguage:n="sql"})=>{const i=o=>{console.log("changing"),t==null||t(o!=null?o:"")},a=!t;return h(pi.default,{className:"minimal-monaco-editor",height:r,defaultLanguage:n,value:e,onChange:a?void 0:i,theme:"vs-dark",options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:a||!t}})},VIe=({value:e,height:t="200px",defaultLanguage:r="sql"})=>h(pi.default,{className:"preview-sql-in-monaco-editor",height:t,defaultLanguage:r,value:e,onChange:void 0,theme:"vs-light",options:{lineNumbers:"on",folding:!0,lineDecorationsWidth:20,wordWrap:"on",minimap:{enabled:!1},readOnly:!0}}),qIe=ke.observer(({value:e})=>{const t=ut(),r=t.context.current,n=Pe.default.useMemo(()=>Rz(e,r,t.mock_context.current,t.sqlSnippets.current,t.filters.values),[e,r,t.mock_context.current,t.sqlSnippets.current,t.filters.values]);return h(VIe,{height:"100%",value:n})}),_8={pre:["function process_request({ context, filters, sql }, utils) {"," // modify and return sql"," return sql","}"].join(`
561
561
  `),post:["function process_result(data, utils) {"," // process data and return the result"," return data","}"].join(`
562
- `)},G3e=ke.observer(({queryModel:e})=>{const[t,r]=Pe.default.useState(e.sql);Pe.default.useEffect(()=>{r(a=>a!==e.sql?e.sql:a)},[e.sql]);const n=t!==e.sql,i=()=>{e.setSQL(t)};return e.typedAsSQL?$(g.Tabs,{defaultValue:"Edit",orientation:"vertical",sx:{flexGrow:1},styles:{tabLabel:{width:"100%",height:"28px",lineHeight:"28px"}},keepMounted:!1,children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"Edit",children:$(g.Group,{spacing:14,position:"apart",children:["Edit SQL",h(g.ActionIcon,{mr:5,variant:"filled",color:"blue",disabled:!n,onClick:i,children:h(Be.DeviceFloppy,{size:20})})]})}),h(g.Tabs.Tab,{value:"Preview",children:"Preview SQL"}),h(g.Tabs.Tab,{value:"pre_process",children:"Process Request"}),h(g.Tabs.Tab,{value:"post_process",children:"Process Result"}),h(lE,{}),e.datasource&&h(E8,{dataSource:e.datasource})]}),h(g.Tabs.Panel,{value:"Edit",sx:{position:"relative"},p:"sm",children:h(uE,{height:"100%",value:t,onChange:r})}),h(g.Tabs.Panel,{value:"Preview",p:0,pl:4,children:h(q3e,{value:e.sql})}),h(g.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:h(Qb,{label:"",value:e.pre_process,onChange:e.setPreProcess,defaultValue:_8.pre})}),h(g.Tabs.Panel,{value:"post_process",p:"sm",children:h(Qb,{label:"",value:e.post_process,onChange:e.setPostProcess,defaultValue:_8.post})})]}):null}),U3e=ke.observer(({queryID:e,usage:t})=>{const r=ut().editor,n=a=>{if(a.type==="filter"){r.setPath(["_FILTERS_",a.id]);return}if(a.type==="panel"){const o=a.views[0].id;r.setPath(["_VIEWS_",o,"_PANELS_",a.id]);return}},i=a=>{r.setPath(["_VIEWS_",a])};return h(g.Stack,{py:"sm",px:"md",children:$(g.Table,{highlightOnHover:!0,sx:{tableLayout:"fixed"},children:[h("thead",{children:$("tr",{children:[h("th",{style:{width:100},children:"Type"}),h("th",{style:{width:"calc(50% - 50px)"},children:"Name"}),h("th",{children:"In View(s)"})]})}),h("tbody",{children:t.map(a=>$("tr",{children:[h("td",{children:Ne.default.capitalize(a.type)}),h("td",{children:h(g.Anchor,{component:"button",type:"button",onClick:()=>n(a),children:a.label})}),h("td",{children:$(g.Stack,{align:"flex-start",justify:"flex-start",spacing:2,children:[a.views.map(o=>h(g.Anchor,{component:"button",type:"button",onClick:()=>i(o.id),children:h(g.Box,{children:o.label})})),a.views.length===0&&h(g.Box,{children:"--"})]})})]},a.id))})]})})}),Jb={height:"calc(100% - 44px)",padding:0},W3e=ke.observer(({queryModel:e})=>{const t=ut(),r=z.useMemo(()=>e.datasource?e.typedAsHTTP?"HTTP":"SQL":"Configurations",[e.datasource,e.typedAsHTTP]),n=t.findQueryUsage(e.id),i=n.length===0;return h(g.Stack,{sx:{flexGrow:1},my:0,p:0,children:$(g.Tabs,{defaultValue:r,orientation:"horizontal",keepMounted:!1,sx:{flexGrow:1},children:[$(g.Tabs.List,{grow:!0,children:[h(g.Tabs.Tab,{value:"Configurations",children:"Configurations"}),e.typedAsSQL&&h(g.Tabs.Tab,{value:"SQL",children:"Request"}),e.typedAsHTTP&&h(g.Tabs.Tab,{value:"HTTP",children:"Request"}),h(g.Tabs.Tab,{value:"Data",disabled:!e.datasource,children:h(g.Tooltip,{label:"Need to pick a Data Source first",disabled:e.datasource,withinPortal:!0,children:h(g.Text,{children:"Data"})})}),h(g.Tabs.Tab,{value:"Usage",disabled:i,children:h(g.Tooltip,{label:"This query is not used for any filter or panel",disabled:!i,withinPortal:!0,children:h(g.Text,{children:"Usage"})})})]}),h(g.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:h(F3e,{queryModel:e})}),e.typedAsSQL&&h(g.Tabs.Panel,{value:"SQL",sx:Jb,children:h(g.Stack,{sx:{height:"100%"},children:h(G3e,{queryModel:e})})}),e.typedAsHTTP&&h(g.Tabs.Panel,{value:"HTTP",sx:Jb,children:h(g.Stack,{sx:{height:"100%"},children:h(L3e,{queryModel:e})})}),h(g.Tabs.Panel,{value:"Data",sx:{...Jb,overflow:"hidden"},children:h(x8,{id:e.id})}),h(g.Tabs.Panel,{value:"Usage",sx:{...Jb,overflow:"hidden"},children:h(U3e,{queryID:e.id,usage:n})})]})})}),H3e=ke.observer(({id:e})=>{const r=ut().queries.findByID(e);return e===""?null:r?h(g.Stack,{sx:{height:"100%"},spacing:"sm",children:h(W3e,{queryModel:r})}):h(g.Text,{size:14,color:"red",children:"Invalid Query ID"})}),j3e=ke.observer(({value:e})=>{const t=ut(),r=t.context.current,n=SNe(e,r,t.mock_context.current,t.filters.values);return h(uE,{height:"100%",value:n})}),K3e=ke.observer(({item:e,remove:t,onKeyChanged:r})=>{const[n,i]=z.useState("SQL"),[a,o]=z.useState(e.key),s=()=>{e.setKey(a),r(a)},l=a!==e.key,u=e.isADuplicatedKey(a),[c,d]=z.useState(e.value),f=()=>{e.setValue(c)};z.useEffect(()=>{o(e.key),d(e.value)},[e]);const p=c!==e.value,m=da.useModals(),v=()=>{m.openConfirmModal({title:"Delete this SQL snippet?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:t,zIndex:320})};return $(g.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[$(g.Group,{sx:{alignItems:"end"},spacing:40,children:[h(g.TextInput,{label:u?"This key is occupied by another snippet":"Key",value:a,onChange:y=>{o(y.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:h(g.ActionIcon,{color:"blue",variant:"subtle",onClick:s,disabled:!l||u,children:h(Be.DeviceFloppy,{size:16})}),error:u}),h(g.Button,{leftIcon:h(Be.Trash,{size:16}),color:"red",variant:"light",onClick:v,children:"Delete this SQL Snippet"})]}),$(g.Tabs,{value:n,onTabChange:i,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[$(g.Tabs.List,{sx:{position:"relative"},children:[h(g.Tabs.Tab,{value:"SQL",children:"SQL"}),h(g.Tabs.Tab,{value:"Preview",children:"Preview"}),h(lE,{}),h(g.ActionIcon,{color:"blue",variant:"filled",onClick:f,disabled:!p,sx:{position:"absolute",top:0,right:10},children:h(Be.DeviceFloppy,{size:18})})]}),h(g.Tabs.Panel,{value:"SQL",pt:"sm",children:h(uE,{height:"100%",value:c,onChange:d})}),h(g.Tabs.Panel,{value:"Preview",pt:"sm",children:h(j3e,{value:c})})]})]})}),Y3e=ke.observer(({id:e})=>{const t=ut(),r=z.useMemo(()=>t.sqlSnippets.findByKey(e),[e]);return r?h(K3e,{item:r,remove:()=>t.sqlSnippets.removeByKey(e),onKeyChanged:a=>{t.editor.setPath(["_SQL_SNIPPETS_",a])}}):$(g.Text,{size:14,children:["SQL Snippet by key[",e,"] is not found"]})}),X3e=ke.observer(({view:e})=>!e||e.type!==Xt.Division?null:$(g.Stack,{children:[h(g.Divider,{mt:8,mb:0,label:"Division settings",labelPosition:"center"}),h(g.Text,{align:"center",size:"xs",color:"dimmed",children:"Under construction"})]})),Z3e=[{value:"default",label:"Default"},{value:"outline",label:"Outline"},{value:"pills",label:"Pills"}],Q3e=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical"}],J3e=ke.observer(({view:e})=>{if(!e||e.type!==Xt.Tabs)return null;const t=e.config;return $(g.Stack,{children:[h(g.Divider,{mt:8,mb:0,label:"Tabs settings",labelPosition:"center"}),h(g.Select,{label:"Variant",value:t.variant,onChange:t.setVariant,data:Z3e}),h(g.Select,{label:"Orientation",value:t.orientation,onChange:t.setOrientation,data:Q3e}),h(g.Switch,{label:"Grow Tabs",checked:t.grow,onChange:r=>t.setGrow(r.currentTarget.checked)})]})}),eIe=({disabled:e,value:t,onChange:r})=>{const n=i=>{!i||r(i)};return $(g.Box,{sx:{position:"relative"},children:[e&&h(g.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),h(pi.default,{height:"500px",defaultLanguage:"javascript",value:t,onChange:n,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})},tIe=({value:e,onChange:t})=>{const[r,{setTrue:n,setFalse:i}]=Wt.useBoolean(),[a,o]=z.useState(e!=null?e:nD),s=f=>{o({...a,enabled:f})},l=()=>{i();const{enabled:f,func_content:p}=a,m={enabled:f,func_content:p};o(m),t(m)},u=()=>{i(),o(e)},c=f=>{o(p=>({...p,func_content:f}))},d=()=>{c(nD.func_content)};return $(tt,{children:[h(g.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:n,sx:{flexGrow:0},children:h(Be.Settings,{size:14})}),h(g.Modal,{size:800,title:"Customize modal title",opened:r,onClose:i,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:r&&$(g.Stack,{children:[h(g.Checkbox,{mt:10,label:"Enabled",checked:a.enabled,onChange:f=>s(f.currentTarget.checked)}),h(eIe,{value:a.func_content,onChange:c,disabled:!a.enabled}),$(g.Group,{position:"apart",children:[h(g.Button,{onClick:d,color:"red",leftIcon:h(Be.Recycle,{size:20}),children:"Rest"}),$(g.Group,{position:"right",children:[h(g.Button,{onClick:u,variant:"subtle",children:"Cancel"}),h(g.Button,{onClick:l,children:"OK"})]})]})]})})]})},rIe=ke.observer(({view:e})=>{if(!e||e.type!==Xt.Modal)return null;const t=e.config,r=t.custom_modal_title.value;return $(g.Stack,{children:[h(g.Divider,{mt:8,label:"Modal settings",labelPosition:"center"}),$(g.Flex,{gap:10,children:[h(g.TextInput,{label:"Modal Title",value:r,onChange:Ne.default.noop,disabled:!0,sx:{flexGrow:1}}),h(tIe,{value:t.custom_modal_title,onChange:t.custom_modal_title.replace})]}),$(g.Group,{grow:!0,children:[h(g.TextInput,{label:"Width",value:t.width,onChange:n=>t.setWidth(n.currentTarget.value),placeholder:"600px / 50vw"}),h(g.TextInput,{label:"Height",value:t.height,onChange:n=>t.setHeight(n.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),nIe=ke.observer(({view:e})=>$(tt,{children:[h(X3e,{view:e}),h(rIe,{view:e}),h(J3e,{view:e})]})),iIe=[{label:"Division",value:Xt.Division},{label:"Modal",value:Xt.Modal},{label:"Tabs",value:Xt.Tabs}],aIe=ke.observer(({view:e})=>e?$(g.Stack,{sx:{position:"relative"},children:[h(g.TextInput,{label:"Name",value:e.name,onChange:t=>{e.setName(t.currentTarget.value)}}),h(g.Select,{label:"Type",withinPortal:!0,value:e.type,onChange:e.setType,data:iIe}),h(nIe,{view:e})]}):null),oIe=ke.observer(({id:e})=>{const t=da.useModals(),r=ut(),n=r.views.findByID(e);if(!n)return $(g.Text,{size:14,children:["View by ID[",e,"] is not found"]});const i=()=>{t.openConfirmModal({title:"Delete this view?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>r.views.removeByID(e),zIndex:320})};return $(g.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[h(g.Group,{position:"right",pt:10,children:h(g.Button,{size:"xs",color:"red",leftIcon:h(Be.Trash,{size:16}),onClick:i,children:"Delete this view"})}),h(g.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:h(aIe,{view:n})})]})});function sIe(e){return e.length===1&&e[0]==="_GLOBAL_VARS_"}function lIe(e){return e.length===1&&e[0]==="_MOCK_CONTEXT_"}function uIe(e){return e.length===2&&e[0]==="_FILTERS_"}function cIe(e){return e.length===2&&e[0]==="_SQL_SNIPPETS_"}function dIe(e){return e.length===2&&e[0]==="_QUERIES_"}function fIe(e){return e.length===2&&e[0]==="_VIEWS_"}function pIe(e){return e.length===4&&e[0]==="_VIEWS_"&&e[2]==="_PANELS_"}const hIe=ke.observer(()=>h(g.Stack,{sx:{height:"100%"},p:"sm",children:h(N8,{})})),mIe=ke.observer(()=>{const e=ut().editor,t=e.path;return sIe(t)?h(hIe,{}):lIe(t)?h(zRe,{}):uIe(t)?h(g.Box,{p:"xs",pl:20,children:h(BRe,{id:t[1]})}):cIe(t)?h(Y3e,{id:t[1]}):dIe(t)?h(H3e,{id:t[1]}):fIe(t)?h(g.Box,{p:"xs",pl:20,children:h(oIe,{id:t[1]})}):pIe(t)?h(m3e,{viewID:t[1],panelID:t[3]}):h(g.Box,{children:e.path})}),vIe=ke.observer(()=>(ut().editor,h(mIe,{}))),gIe=ke.observer(()=>{const e=ut(),t=()=>{const r=new Date().getTime().toString(),n={id:r,key:r,label:r,order:e.filters.current.length+1,type:ZS.TextInput,config:Ez(),visibleInViewsIDs:["Main"],auto_submit:!1};e.filters.append(n)};return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Filter"})}),yIe=ke.observer(({parentID:e})=>{const t=ut();if(!e)return null;const r=t.views.findByID(e);return r?h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>t.addANewPanel(r.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Panel"}):null}),bIe=ke.observer(()=>{const e=ut(),t=()=>{const r=new Date().getTime().toString(),n={id:r,name:r,type:qr.Postgresql,key:"",sql:""};e.queries.append(n)};return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Query"})}),xIe=ke.observer(()=>{const e=ut(),t=()=>{const n={key:new Date().getTime().toString(),value:""};e.sqlSnippets.append(n)};return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a SQL Snippet"})}),wIe=ke.observer(()=>{const e=ut();return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a View"})}),CIe=ke.observer(({action_type:e,parentID:t})=>(ut(),e==="_Add_A_Filter_"?h(gIe,{}):e==="_Add_A_SQL_SNIPPET_"?h(xIe,{}):e==="_Add_A_QUERY_"?h(bIe,{}):e==="_Add_A_VIEW_"?h(wIe,{}):e==="_Add_A_PANEL_"?h(yIe,{parentID:t}):null)),M8=ke.observer(({option:e})=>{var u;const t=ut().editor,r=t.isOptionActive,n=r(t.path,e),i=t.isOptionOpened,a=t.navigate,o=i(e),[s,l]=z.useState(o);return z.useEffect(()=>{l(o)},[o]),h(g.NavLink,{active:n,defaultOpened:o,opened:s,onChange:l,label:e.label,onClick:()=>a(e),icon:e.Icon?h(e.Icon,{size:18}):null,children:(u=e.children)==null?void 0:u.map(c=>c._type==="ACTION"?h(CIe,{action_type:c._action_type,parentID:c.parentID},`_ADD_${c.value}_`):h(M8,{option:c},c.value))},e.label)}),SIe=ke.observer(()=>{const e=ut();return h(g.Box,{sx:{position:"relative"},children:e.editor.navOptions.map(t=>h(M8,{option:t},t.value))})}),DIe=ke.observer(()=>{const e=ut();return $(g.Navbar,{p:0,width:{base:200,xs:200,sm:220,md:240,lg:280,xl:300},sx:{height:"100vh - 60px - 60px"},children:[h(g.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:h(g.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:"Settings"})}),h(g.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:h(SIe,{})}),h(g.Navbar.Section,{children:h(g.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:h(g.Button,{size:"xs",color:"red",leftIcon:h(DE,{size:18}),onClick:()=>e.editor.close(),children:"Close"})})})]})}),EIe={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1,nav:{top:0,height:"100vh"}},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:0,height:"100vh"}},NIe=ke.observer(()=>{const e=ut().editor;return h(g.Modal,{onClose:()=>e.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:e.settings_open,fullScreen:!0,title:null,transitionDuration:0,withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{modal:{padding:"0 !important"}},children:h(g.AppShell,{padding:0,navbar:h(DIe,{}),styles:EIe,children:h(vIe,{})})})}),AIe=e=>e.replace(/([^:])(\/\/+)/g,"$1/");function _Ie(e){z.useEffect(()=>{if(fd.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const r=AIe(e);fd.loader.config({paths:{vs:r}}),fd.loader.init().then(n=>console.log("monaco instance:",n))},[])}const T8={grid:{axis:"#97999D",scope:"rgba(47,140,192,0.1)",boundary:"#789AB4",reference:"#CFCFD8"},graphics:{compared:{blueDark:"#3E7CAB",blue:"#6398C7",blueLight:"#7CB0DF",blue10:"#6398C71a",redDark:"#AF5F6B",red:"#CD7C88",redLight:"#E794A0",red10:"#CD7C881a"},gradient:{distributed:"linear-gradient(90deg, #1babe6 0%, #2fc8c8 28.63%, #98d44b 48.86%, #ffd057 67.53%, #f5ae53 80.6%, #e76441 91.18%, #b90000 100%)",protrude:"linear-gradient(180deg, #ec73734d 0%, #ec737300 100%)"},level:{lv0:"#6398C7",lv1:"#61B5BF",lv2:"#54D4BB",lv3:"#F5D277",lv4:"#E8BB7F",lv5:"#DB9E84",lv6:"#CB8089"},depth:{dp0:"#FFF7F8",dp1:"#FFE1E1",dp2:"#FDBCBC",dp3:"#F39494",dp4:"#FA4242",dp5:"#E21212"},multiple:{c1:"#66B4DB",c2:"#E46464",c3:"#EEBA00",c4:"#33A678",c5:"#9D88CB",c6:"#939943",c7:"#E49792",c8:"#09A2B8",c9:"#AF5F6B",c10:"#6CA157",c11:"#3E7CAB",c12:"#6398C7",c13:"#E692BA",c14:"#97B566",c15:"#8CACE2",c16:"#CA79AC",c17:"#6DBC80",c18:"#B08F4B",c19:"#39BFA2",c20:"#826BAF"}}};function MIe(){wr.registerTheme("merico-light",{color:Object.values(T8.graphics.multiple),visualMap:{color:Object.values(T8.graphics.depth).reverse()}})}function O8(){MIe()}O8();const TIe={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60,height:"100vh"}},OIe=ke.observer(z.forwardRef(function({context:t,dashboard:r,update:n,className:i="dashboard",config:a,onChange:o,headerSlot:s},l){_Ie(a.monacoPath),gz(a);const{data:u=[]}=Wt.useRequest(rD),[c,d]=Pe.default.useState(!1),f=Pe.default.useMemo(()=>aD(r,u,t),[r]);Pe.default.useImperativeHandle(l,()=>f,[f]),mE(f,!0),Pe.default.useEffect(()=>{f.context.replace(t)},[t]),Pe.default.useEffect(()=>{f.datasources.replace(u)},[u]),Pe.default.useEffect(()=>cr.reaction(()=>cr.toJS(f.json),y=>{o==null||o(y)}),[f]);const p=async()=>{await n(f.json)},m=Wt.useCreation(YS,[]),v=oD(m);return h(da.ModalsProvider,{children:h(a1,{value:f,children:h(ss.Provider,{value:{layoutFrozen:c,freezeLayout:d,inEditMode:!0},children:h(Oa.Provider,{value:m,children:$(md,{configure:v,children:[h(g.AppShell,{padding:0,header:h(sAe,{saveDashboardChanges:p,headerSlot:s}),navbar:h(SRe,{}),styles:TIe,children:h(g.Box,{className:`${i} dashboard-root`,sx:{position:"relative"},children:f.views.visibleViews.map(y=>h(vz,{view:y},y.id))})}),h(NIe,{})]})})})})})})),Vke="";O8();const RIe=ke.observer(({context:e,dashboard:t,className:r="dashboard",config:n,fullScreenPanelID:i,setFullScreenPanelID:a})=>{gz(n);const{data:o=[]}=Wt.useRequest(rD),s=Pe.default.useMemo(()=>aD(t,o,e),[t]);mE(s,!1),Pe.default.useEffect(()=>{s.context.replace(e)},[e]),Pe.default.useEffect(()=>{s.datasources.replace(o)},[o]);const l=Wt.useCreation(YS,[]),u=oD(l);return h(da.ModalsProvider,{children:h(a1,{value:s,children:h(v1.Provider,{value:{fullScreenPanelID:i,setFullScreenPanelID:a},children:h(ss.Provider,{value:{layoutFrozen:!0,freezeLayout:Ne.default.noop,inEditMode:!1},children:h(g.Box,{className:`${r} dashboard-root`,children:h(Oa.Provider,{value:l,children:h(md,{configure:u,children:s.views.visibleViews.map(c=>h(gb,{view:c},c.id))})})})})})})})});var R8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=a.format;i.en.ordinal=function(s){var l=["th","st","nd","rd"],u=s%100;return"["+s+(l[(u-20)%10]||l[u]||l[0])+"]"},a.format=function(s){var l=this,u=this.$locale();if(!this.isValid())return o.bind(this)(s);var c=this.$utils(),d=(s||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(f){switch(f){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return c.s(l.week(),f==="w"?1:2,"0");case"W":case"WW":return c.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return c.s(String(l.$H===0?24:l.$H),f==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return f}});return o.bind(this)(d)}}})})(R8);const IIe=R8.exports;var I8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=function(l){var u=l.date,c=l.utc;return Array.isArray(u)?c?u.length?new Date(Date.UTC.apply(null,u)):new Date:u.length===1?i(String(u[0])).toDate():new(Function.prototype.bind.apply(Date,[null].concat(u))):u},s=a.parse;a.parse=function(l){l.date=o.bind(this)(l),s.bind(this)(l)}}})})(I8);const kIe=I8.exports;var k8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype;i.$g=function(f,p,m){return this.$utils().u(f)?this[p]:this.$set(m,f)},i.set=function(f,p){return this.$set(f,p)};var a=i.startOf;i.startOf=function(f,p){return this.$d=a.bind(this)(f,p).toDate(),this.init(),this};var o=i.add;i.add=function(f,p){return this.$d=o.bind(this)(f,p).toDate(),this.init(),this};var s=i.locale;i.locale=function(f,p){return f?(this.$L=s.bind(this)(f,p).$L,this):this.$L};var l=i.daysInMonth;i.daysInMonth=function(){return l.bind(this.clone())()};var u=i.isSame;i.isSame=function(f,p){return u.bind(this.clone())(f,p)};var c=i.isBefore;i.isBefore=function(f,p){return c.bind(this.clone())(f,p)};var d=i.isAfter;i.isAfter=function(f,p){return d.bind(this.clone())(f,p)}}})})(k8);const PIe=k8.exports;var P8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype,a=i.format;i.format=function(o){var s=this,l=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g,function(u,c){var d,f=String(s.$y+543),p=u==="BB"?[f.slice(-2),2]:[f,4];return c||(d=s.$utils()).s.apply(d,p.concat(["0"]))});return a.bind(this)(l)}}})})(P8);const FIe=P8.exports;var F8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a="h:mm A",o={lastDay:"[Yesterday at] "+a,sameDay:"[Today at] "+a,nextDay:"[Tomorrow at] "+a,nextWeek:"dddd [at] "+a,lastWeek:"[Last] dddd [at] "+a,sameElse:"MM/DD/YYYY"};n.prototype.calendar=function(s,l){var u=l||this.$locale().calendar||o,c=i(s||void 0).startOf("d"),d=this.diff(c,"d",!0),f="sameElse",p=d<-6?f:d<-1?"lastWeek":d<0?"lastDay":d<1?"sameDay":d<2?"nextDay":d<7?"nextWeek":f,m=u[p]||o[p];return typeof m=="function"?m.call(this,i()):this.format(m)}}})})(F8);const $Ie=F8.exports;var $8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r={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"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d\d/,a=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},l=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(y){this[v]=+y}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=function(y){if(!y||y==="Z")return 0;var b=y.match(/([+-]|\d\d)/g),D=60*b[1]+(+b[2]||0);return D===0?0:b[0]==="+"?-D:D}(v)}],d=function(v){var y=s[v];return y&&(y.indexOf?y:y.s.concat(y.f))},f=function(v,y){var b,D=s.meridiem;if(D){for(var x=1;x<=24;x+=1)if(v.indexOf(D(x,0,y))>-1){b=x>12;break}}else b=v===(y?"pm":"PM");return b},p={A:[o,function(v){this.afternoon=f(v,!1)}],a:[o,function(v){this.afternoon=f(v,!0)}],S:[/\d/,function(v){this.milliseconds=100*+v}],SS:[i,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,u("seconds")],ss:[a,u("seconds")],m:[a,u("minutes")],mm:[a,u("minutes")],H:[a,u("hours")],h:[a,u("hours")],HH:[a,u("hours")],hh:[a,u("hours")],D:[a,u("day")],DD:[i,u("day")],Do:[o,function(v){var y=s.ordinal,b=v.match(/\d+/);if(this.day=b[0],y)for(var D=1;D<=31;D+=1)y(D).replace(/\[|\]/g,"")===v&&(this.day=D)}],M:[a,u("month")],MM:[i,u("month")],MMM:[o,function(v){var y=d("months"),b=(d("monthsShort")||y.map(function(D){return D.slice(0,3)})).indexOf(v)+1;if(b<1)throw new Error;this.month=b%12||b}],MMMM:[o,function(v){var y=d("months").indexOf(v)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(v){this.year=l(v)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function m(v){var y,b;y=v,b=s&&s.formats;for(var D=(v=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(_,N,M){var R=M&&M.toUpperCase();return N||b[M]||r[M]||b[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(F,k,P){return k||P.slice(1)})})).match(n),x=D.length,S=0;S<x;S+=1){var w=D[S],C=p[w],E=C&&C[0],A=C&&C[1];D[S]=A?{regex:E,parser:A}:w.replace(/^\[|\]$/g,"")}return function(_){for(var N={},M=0,R=0;M<x;M+=1){var F=D[M];if(typeof F=="string")R+=F.length;else{var k=F.regex,P=F.parser,T=_.slice(R),O=k.exec(T)[0];P.call(N,O),_=_.replace(O,"")}}return function(L){var I=L.afternoon;if(I!==void 0){var V=L.hours;I?V<12&&(L.hours+=12):V===12&&(L.hours=0),delete L.afternoon}}(N),N}}return function(v,y,b){b.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(l=v.parseTwoDigitYear);var D=y.prototype,x=D.parse;D.parse=function(S){var w=S.date,C=S.utc,E=S.args;this.$u=C;var A=E[1];if(typeof A=="string"){var _=E[2]===!0,N=E[3]===!0,M=_||N,R=E[2];N&&(R=E[2]),s=this.$locale(),!_&&R&&(s=b.Ls[R]),this.$d=function(T,O,L){try{if(["x","X"].indexOf(O)>-1)return new Date((O==="X"?1e3:1)*T);var I=m(O)(T),V=I.year,H=I.month,Z=I.day,G=I.hours,Y=I.minutes,re=I.seconds,ne=I.milliseconds,pe=I.zone,he=new Date,le=Z||(V||H?1:he.getDate()),fe=V||he.getFullYear(),xe=0;V&&!H||(xe=H>0?H-1:he.getMonth());var ge=G||0,ve=Y||0,Ee=re||0,q=ne||0;return pe?new Date(Date.UTC(fe,xe,le,ge,ve,Ee,q+60*pe.offset*1e3)):L?new Date(Date.UTC(fe,xe,le,ge,ve,Ee,q)):new Date(fe,xe,le,ge,ve,Ee,q)}catch{return new Date("")}}(w,A,C),this.init(),R&&R!==!0&&(this.$L=this.locale(R).$L),M&&w!=this.format(A)&&(this.$d=new Date("")),s={}}else if(A instanceof Array)for(var F=A.length,k=1;k<=F;k+=1){E[1]=A[k-1];var P=b.apply(this,E);if(P.isValid()){this.$d=P.$d,this.$L=P.$L,this.init();break}k===F&&(this.$d=new Date(""))}else x.call(this,S)}}})})($8);const BIe=$8.exports;var B8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.dayOfYear=function(a){var o=Math.round((i(this).startOf("day")-i(this).startOf("year"))/864e5)+1;return a==null?o:this.add(a-o,"day")}}})})(B8);const zIe=B8.exports;var z8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r,n,i=1e3,a=6e4,o=36e5,s=864e5,l=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,c=2592e6,d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,f={years:u,months:c,days:s,hours:o,minutes:a,seconds:i,milliseconds:1,weeks:6048e5},p=function(w){return w instanceof S},m=function(w,C,E){return new S(w,E,C.$l)},v=function(w){return n.p(w)+"s"},y=function(w){return w<0},b=function(w){return y(w)?Math.ceil(w):Math.floor(w)},D=function(w){return Math.abs(w)},x=function(w,C){return w?y(w)?{negative:!0,format:""+D(w)+C}:{negative:!1,format:""+w+C}:{negative:!1,format:""}},S=function(){function w(E,A,_){var N=this;if(this.$d={},this.$l=_,E===void 0&&(this.$ms=0,this.parseFromMilliseconds()),A)return m(E*f[v(A)],this);if(typeof E=="number")return this.$ms=E,this.parseFromMilliseconds(),this;if(typeof E=="object")return Object.keys(E).forEach(function(F){N.$d[v(F)]=E[F]}),this.calMilliseconds(),this;if(typeof E=="string"){var M=E.match(d);if(M){var R=M.slice(2).map(function(F){return F!=null?Number(F):0});return this.$d.years=R[0],this.$d.months=R[1],this.$d.weeks=R[2],this.$d.days=R[3],this.$d.hours=R[4],this.$d.minutes=R[5],this.$d.seconds=R[6],this.calMilliseconds(),this}}return this}var C=w.prototype;return C.calMilliseconds=function(){var E=this;this.$ms=Object.keys(this.$d).reduce(function(A,_){return A+(E.$d[_]||0)*f[_]},0)},C.parseFromMilliseconds=function(){var E=this.$ms;this.$d.years=b(E/u),E%=u,this.$d.months=b(E/c),E%=c,this.$d.days=b(E/s),E%=s,this.$d.hours=b(E/o),E%=o,this.$d.minutes=b(E/a),E%=a,this.$d.seconds=b(E/i),E%=i,this.$d.milliseconds=E},C.toISOString=function(){var E=x(this.$d.years,"Y"),A=x(this.$d.months,"M"),_=+this.$d.days||0;this.$d.weeks&&(_+=7*this.$d.weeks);var N=x(_,"D"),M=x(this.$d.hours,"H"),R=x(this.$d.minutes,"M"),F=this.$d.seconds||0;this.$d.milliseconds&&(F+=this.$d.milliseconds/1e3);var k=x(F,"S"),P=E.negative||A.negative||N.negative||M.negative||R.negative||k.negative,T=M.format||R.format||k.format?"T":"",O=(P?"-":"")+"P"+E.format+A.format+N.format+T+M.format+R.format+k.format;return O==="P"||O==="-P"?"P0D":O},C.toJSON=function(){return this.toISOString()},C.format=function(E){var A=E||"YYYY-MM-DDTHH:mm:ss",_={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return A.replace(l,function(N,M){return M||String(_[N])})},C.as=function(E){return this.$ms/f[v(E)]},C.get=function(E){var A=this.$ms,_=v(E);return _==="milliseconds"?A%=1e3:A=_==="weeks"?b(A/f[_]):this.$d[_],A===0?0:A},C.add=function(E,A,_){var N;return N=A?E*f[v(A)]:p(E)?E.$ms:m(E,this).$ms,m(this.$ms+N*(_?-1:1),this)},C.subtract=function(E,A){return this.add(E,A,!0)},C.locale=function(E){var A=this.clone();return A.$l=E,A},C.clone=function(){return m(this.$ms,this)},C.humanize=function(E){return r().add(this.$ms,"ms").locale(this.$l).fromNow(!E)},C.milliseconds=function(){return this.get("milliseconds")},C.asMilliseconds=function(){return this.as("milliseconds")},C.seconds=function(){return this.get("seconds")},C.asSeconds=function(){return this.as("seconds")},C.minutes=function(){return this.get("minutes")},C.asMinutes=function(){return this.as("minutes")},C.hours=function(){return this.get("hours")},C.asHours=function(){return this.as("hours")},C.days=function(){return this.get("days")},C.asDays=function(){return this.as("days")},C.weeks=function(){return this.get("weeks")},C.asWeeks=function(){return this.as("weeks")},C.months=function(){return this.get("months")},C.asMonths=function(){return this.as("months")},C.years=function(){return this.get("years")},C.asYears=function(){return this.as("years")},w}();return function(w,C,E){r=E,n=E().$utils(),E.duration=function(N,M){var R=E.locale();return m(N,{$l:R},M)},E.isDuration=p;var A=C.prototype.add,_=C.prototype.subtract;C.prototype.add=function(N,M){return p(N)&&(N=N.asMilliseconds()),A.bind(this)(N,M)},C.prototype.subtract=function(N,M){return p(N)&&(N=N.asMilliseconds()),_.bind(this)(N,M)}}})})(z8);const LIe=z8.exports;var L8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isBetween=function(a,o,s,l){var u=i(a),c=i(o),d=(l=l||"()")[0]==="(",f=l[1]===")";return(d?this.isAfter(u,s):!this.isBefore(u,s))&&(f?this.isBefore(c,s):!this.isAfter(c,s))||(d?this.isBefore(u,s):!this.isAfter(u,s))&&(f?this.isAfter(c,s):!this.isBefore(c,s))}}})})(L8);const VIe=L8.exports;var V8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(V8);const qIe=V8.exports;var q8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){i.isMoment=function(a){return i.isDayjs(a)}}})})(q8);const GIe=q8.exports;var G8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="day";return function(n,i,a){var o=function(u){return u.add(4-u.isoWeekday(),r)},s=i.prototype;s.isoWeekYear=function(){return o(this).year()},s.isoWeek=function(u){if(!this.$utils().u(u))return this.add(7*(u-this.isoWeek()),r);var c,d,f,p,m=o(this),v=(c=this.isoWeekYear(),d=this.$u,f=(d?a.utc:a)().year(c).startOf("year"),p=4-f.isoWeekday(),f.isoWeekday()>4&&(p+=7),f.add(p,r));return m.diff(v,"week")+1},s.isoWeekday=function(u){return this.$utils().u(u)?this.day()||7:this.day(this.day()%7?u:u-7)};var l=s.startOf;s.startOf=function(u,c){var d=this.$utils(),f=!!d.u(c)||c;return d.p(u)==="isoweek"?f?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):l.bind(this)(u,c)}}})})(G8);const UIe=G8.exports;var U8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isoWeeksInYear=function(){var i=this.isLeapYear(),a=this.endOf("y").day();return a===4||i&&a===5?53:52}}})})(U8);const WIe=U8.exports;var W8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isSameOrAfter=function(i,a){return this.isSame(i,a)||this.isAfter(i,a)}}})})(W8);const HIe=W8.exports;var H8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isSameOrBefore=function(i,a){return this.isSame(i,a)||this.isBefore(i,a)}}})})(H8);const jIe=H8.exports;var j8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isToday=function(){var a="YYYY-MM-DD",o=i();return this.format(a)===o.format(a)}}})})(j8);const KIe=j8.exports;var K8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isTomorrow=function(){var a="YYYY-MM-DD",o=i().add(1,"day");return this.format(a)===o.format(a)}}})})(K8);const YIe=K8.exports;var Y8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isYesterday=function(){var a="YYYY-MM-DD",o=i().subtract(1,"day");return this.format(a)===o.format(a)}}})})(Y8);const XIe=Y8.exports;var X8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=function(d){return d&&(d.indexOf?d:d.s)},s=function(d,f,p,m,v){var y=d.name?d:d.$locale(),b=o(y[f]),D=o(y[p]),x=b||D.map(function(w){return w.slice(0,m)});if(!v)return x;var S=y.weekStart;return x.map(function(w,C){return x[(C+(S||0))%7]})},l=function(){return i.Ls[i.locale()]},u=function(d,f){return d.formats[f]||function(p){return p.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(m,v,y){return v||y.slice(1)})}(d.formats[f.toUpperCase()])},c=function(){var d=this;return{months:function(f){return f?f.format("MMMM"):s(d,"months")},monthsShort:function(f){return f?f.format("MMM"):s(d,"monthsShort","months",3)},firstDayOfWeek:function(){return d.$locale().weekStart||0},weekdays:function(f){return f?f.format("dddd"):s(d,"weekdays")},weekdaysMin:function(f){return f?f.format("dd"):s(d,"weekdaysMin","weekdays",2)},weekdaysShort:function(f){return f?f.format("ddd"):s(d,"weekdaysShort","weekdays",3)},longDateFormat:function(f){return u(d.$locale(),f)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};a.localeData=function(){return c.bind(this)()},i.localeData=function(){var d=l();return{firstDayOfWeek:function(){return d.weekStart||0},weekdays:function(){return i.weekdays()},weekdaysShort:function(){return i.weekdaysShort()},weekdaysMin:function(){return i.weekdaysMin()},months:function(){return i.months()},monthsShort:function(){return i.monthsShort()},longDateFormat:function(f){return u(d,f)},meridiem:d.meridiem,ordinal:d.ordinal}},i.months=function(){return s(l(),"months")},i.monthsShort=function(){return s(l(),"monthsShort","months",3)},i.weekdays=function(d){return s(l(),"weekdays",null,null,d)},i.weekdaysShort=function(d){return s(l(),"weekdaysShort","weekdays",3,d)},i.weekdaysMin=function(d){return s(l(),"weekdaysMin","weekdays",2,d)}}})})(X8);const ZIe=X8.exports;var Z8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r={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"};return function(n,i,a){var o=i.prototype,s=o.format;a.en.formats=r,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(d,f){return d.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(p,m,v){var y=v&&v.toUpperCase();return m||f[v]||r[v]||f[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(b,D,x){return D||x.slice(1)})})}(l,u===void 0?{}:u);return s.call(this,c)}}})})(Z8);const QIe=Z8.exports;var Q8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=function(o,s){if(!s||!s.length||!s[0]||s.length===1&&!s[0].length)return null;var l;s.length===1&&s[0].length>0&&(s=s[0]),l=s[0];for(var u=1;u<s.length;u+=1)s[u].isValid()&&!s[u][o](l)||(l=s[u]);return l};i.max=function(){var o=[].slice.call(arguments,0);return a("isAfter",o)},i.min=function(){var o=[].slice.call(arguments,0);return a("isBefore",o)}}})})(Q8);const JIe=Q8.exports;var J8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=function(d){var f,p=d.date,m=d.utc,v={};if(!((f=p)instanceof Date)&&!(f instanceof Array)&&f instanceof Object){if(!Object.keys(p).length)return new Date;var y=m?i.utc():i();Object.keys(p).forEach(function(A){var _,N;v[_=A,N=a.$utils().p(_),N==="date"?"day":N]=p[A]});var b=v.day||(v.year||v.month>=0?1:y.date()),D=v.year||y.year(),x=v.month>=0?v.month:v.year||v.day?0:y.month(),S=v.hour||0,w=v.minute||0,C=v.second||0,E=v.millisecond||0;return m?new Date(Date.UTC(D,x,b,S,w,C,E)):new Date(D,x,b,S,w,C,E)}return p},s=a.parse;a.parse=function(d){d.date=o.bind(this)(d),s.bind(this)(d)};var l=a.set,u=a.add,c=function(d,f,p,m){if(m===void 0&&(m=1),f instanceof Object){var v=Object.keys(f),y=this;return v.forEach(function(b){y=d.bind(y)(f[b]*m,b)}),y}return d.bind(this)(f*m,p)};a.set=function(d,f){return f=f===void 0?d:f,c.bind(this)(function(p,m){return l.bind(this)(m,p)},f,d)},a.add=function(d,f){return c.bind(this)(u,d,f)},a.subtract=function(d,f){return c.bind(this)(u,d,f,-1)}}})})(J8);const eke=J8.exports;var e6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype;["milliseconds","seconds","minutes","hours","days","weeks","isoWeeks","months","quarters","years","dates"].forEach(function(a){i[a]=i[a.replace(/s$/,"")]})}})})(e6);const tke=e6.exports;var t6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype.parse;n.prototype.parse=function(s){if(typeof s.date=="string"){var l=this.$locale();s.date=l&&l.preparse?l.preparse(s.date):s.date}return i.bind(this)(s)};var a=n.prototype.format;n.prototype.format=function(){for(var s=arguments.length,l=new Array(s),u=0;u<s;u++)l[u]=arguments[u];var c=a.call.apply(a,[this].concat(l)),d=this.$locale();return d&&d.postformat?d.postformat(c):c};var o=n.prototype.fromToBase;o&&(n.prototype.fromToBase=function(s,l,u,c){var d=this.$locale()||u.$locale();return o.call(this,s,l,u,c,d&&d.postformat)})}})})(t6);const rke=t6.exports;var r6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="month",n="quarter";return function(i,a){var o=a.prototype;o.quarter=function(u){return this.$utils().u(u)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(u-1))};var s=o.add;o.add=function(u,c){return u=Number(u),this.$utils().p(c)===n?this.add(3*u,r):s.bind(this)(u,c)};var l=o.startOf;o.startOf=function(u,c){var d=this.$utils(),f=!!d.u(c)||c;if(d.p(u)===n){var p=this.quarter()-1;return f?this.month(3*p).startOf(r).startOf("day"):this.month(3*p+2).endOf(r).endOf("day")}return l.bind(this)(u,c)}}})})(r6);const nke=r6.exports;var n6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){r=r||{};var a=n.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(u,c,d,f){return a.fromToBase(u,c,d,f)}i.en.relativeTime=o,a.fromToBase=function(u,c,d,f,p){for(var m,v,y,b=d.$locale().relativeTime||o,D=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],x=D.length,S=0;S<x;S+=1){var w=D[S];w.d&&(m=f?i(u).diff(d,w.d,!0):d.diff(u,w.d,!0));var C=(r.rounding||Math.round)(Math.abs(m));if(y=m>0,C<=w.r||!w.r){C<=1&&S>0&&(w=D[S-1]);var E=b[w.l];p&&(C=p(""+C)),v=typeof E=="string"?E.replace("%d",C):E(C,c,w.l,y);break}}if(c)return v;var A=y?b.future:b.past;return typeof A=="function"?A(v):A.replace("%s",v)},a.to=function(u,c){return s(u,c,this,!0)},a.from=function(u,c){return s(u,c,this)};var l=function(u){return u.$u?i.utc():i()};a.toNow=function(u){return this.to(l(this),u)},a.fromNow=function(u){return this.from(l(this),u)}}})})(n6);const ike=n6.exports;var i6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(i,a,o){var s,l=function(f,p,m){m===void 0&&(m={});var v=new Date(f),y=function(b,D){D===void 0&&(D={});var x=D.timeZoneName||"short",S=b+"|"+x,w=n[S];return w||(w=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:x}),n[S]=w),w}(p,m);return y.formatToParts(v)},u=function(f,p){for(var m=l(f,p),v=[],y=0;y<m.length;y+=1){var b=m[y],D=b.type,x=b.value,S=r[D];S>=0&&(v[S]=parseInt(x,10))}var w=v[3],C=w===24?0:w,E=v[0]+"-"+v[1]+"-"+v[2]+" "+C+":"+v[4]+":"+v[5]+":000",A=+f;return(o.utc(E).valueOf()-(A-=A%1e3))/6e4},c=a.prototype;c.tz=function(f,p){f===void 0&&(f=s);var m=this.utcOffset(),v=this.toDate(),y=v.toLocaleString("en-US",{timeZone:f}),b=Math.round((v-new Date(y))/1e3/60),D=o(y).$set("millisecond",this.$ms).utcOffset(15*-Math.round(v.getTimezoneOffset()/15)-b,!0);if(p){var x=D.utcOffset();D=D.add(m-x,"minute")}return D.$x.$timezone=f,D},c.offsetName=function(f){var p=this.$x.$timezone||o.tz.guess(),m=l(this.valueOf(),p,{timeZoneName:f}).find(function(v){return v.type.toLowerCase()==="timezonename"});return m&&m.value};var d=c.startOf;c.startOf=function(f,p){if(!this.$x||!this.$x.$timezone)return d.call(this,f,p);var m=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"));return d.call(m,f,p).tz(this.$x.$timezone,!0)},o.tz=function(f,p,m){var v=m&&p,y=m||p||s,b=u(+o(),y);if(typeof f!="string")return o(f).tz(y);var D=function(C,E,A){var _=C-60*E*1e3,N=u(_,A);if(E===N)return[_,E];var M=u(_-=60*(N-E)*1e3,A);return N===M?[_,N]:[C-60*Math.min(N,M)*1e3,Math.max(N,M)]}(o.utc(f,v).valueOf(),b,y),x=D[0],S=D[1],w=o(x).utcOffset(S);return w.$x.$timezone=y,w},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(f){s=f}}})})(i6);const ake=i6.exports;var a6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]}}})})(a6);const oke=a6.exports;var o6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.toObject=function(){return{years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}}}})})(o6);const ske=o6.exports;var s6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){i.updateLocale=function(a,o){var s=i.Ls[a];if(s)return(o?Object.keys(o):[]).forEach(function(l){s[l]=o[l]}),s}}})})(s6);const lke=s6.exports;var l6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="minute",n=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g;return function(a,o,s){var l=o.prototype;s.utc=function(v){var y={date:v,utc:!0,args:arguments};return new o(y)},l.utc=function(v){var y=s(this.toDate(),{locale:this.$L,utc:!0});return v?y.add(this.utcOffset(),r):y},l.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(v){v.utc&&(this.$u=!0),this.$utils().u(v.$offset)||(this.$offset=v.$offset),u.call(this,v)};var c=l.init;l.init=function(){if(this.$u){var v=this.$d;this.$y=v.getUTCFullYear(),this.$M=v.getUTCMonth(),this.$D=v.getUTCDate(),this.$W=v.getUTCDay(),this.$H=v.getUTCHours(),this.$m=v.getUTCMinutes(),this.$s=v.getUTCSeconds(),this.$ms=v.getUTCMilliseconds()}else c.call(this)};var d=l.utcOffset;l.utcOffset=function(v,y){var b=this.$utils().u;if(b(v))return this.$u?0:b(this.$offset)?d.call(this):this.$offset;if(typeof v=="string"&&(v=function(w){w===void 0&&(w="");var C=w.match(n);if(!C)return null;var E=(""+C[0]).match(i)||["-",0,0],A=E[0],_=60*+E[1]+ +E[2];return _===0?0:A==="+"?_:-_}(v),v===null))return this;var D=Math.abs(v)<=16?60*v:v,x=this;if(y)return x.$offset=D,x.$u=v===0,x;if(v!==0){var S=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(x=this.local().add(D+S,r)).$offset=D,x.$x.$localOffset=S}else x=this.utc();return x};var f=l.format;l.format=function(v){var y=v||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return f.call(this,y)},l.valueOf=function(){var v=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*v},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var p=l.toDate;l.toDate=function(v){return v==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():p.call(this)};var m=l.diff;l.diff=function(v,y,b){if(v&&this.$u===v.$u)return m.call(this,v,y,b);var D=this.local(),x=s(v).local();return m.call(D,x,y,b)}}})})(l6);const uke=l6.exports;var u6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.weekday=function(i){var a=this.$locale().weekStart||0,o=this.$W,s=(o<a?o+7:o)-a;return this.$utils().u(i)?s:this.subtract(s,"day").add(i,"day")}}})})(u6);const cke=u6.exports;var c6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="week",n="year";return function(i,a,o){var s=a.prototype;s.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(n).add(1,n).date(u),d=o(this).endOf(r);if(c.isBefore(d))return 1}var f=o(this).startOf(n).date(u).startOf(r).subtract(1,"millisecond"),p=this.diff(f,r,!0);return p<0?o(this).startOf("week").week():Math.ceil(p)},s.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})})(c6);const dke=c6.exports;var d6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.weekYear=function(){var i=this.month(),a=this.week(),o=this.year();return a===1&&i===11?o+1:i===0&&a>=52?o-1:o}}})})(d6);const fke=d6.exports;Dt.default.extend(IIe),Dt.default.extend(kIe),Dt.default.extend(PIe),Dt.default.extend(FIe),Dt.default.extend($Ie),Dt.default.extend(BIe),Dt.default.extend(zIe),Dt.default.extend(LIe),Dt.default.extend(VIe),Dt.default.extend(qIe),Dt.default.extend(GIe),Dt.default.extend(HIe),Dt.default.extend(jIe),Dt.default.extend(KIe),Dt.default.extend(YIe),Dt.default.extend(XIe),Dt.default.extend(UIe),Dt.default.extend(WIe),Dt.default.extend(ZIe),Dt.default.extend(QIe),Dt.default.extend(JIe),Dt.default.extend(eke),Dt.default.extend(tke),Dt.default.extend(rke),Dt.default.extend(nke),Dt.default.extend(ike),Dt.default.extend(ake),Dt.default.extend(oke),Dt.default.extend(ske),Dt.default.extend(lke),Dt.default.extend(uke),Dt.default.extend(dke),Dt.default.extend(fke),Dt.default.extend(cke),Dt.default.tz.setDefault("UTC");const pke=()=>Promise.resolve().then(()=>GQ).then(({version:e})=>(console.log(`[@devtable/dashboard] version: ${e}`),e));He.ContextModel=$z,He.Dashboard=OIe,He.DashboardFilterType=ZS,He.DashboardMode=hz,He.DashboardModel=wb,He.DashboardViewEditor=vz,He.DashboardViewRender=gb,He.EViewComponentType=Xt,He.FilterModel=JS,He.FiltersModel=_z,He.FullScreenPanelContext=v1,He.LayoutStateContext=ss,He.ModelContextProvider=a1,He.Panel=vb,He.PanelContextProvider=m1,He.PanelModel=Bz,He.PanelsModel=Lz,He.QueriesModel=kz,He.QueryModel=Iz,He.ReadOnlyDashboard=RIe,He.SQLSnippetModel=Pz,He.SQLSnippetsModel=Fz,He.ViewComponentTypeBackground=mz,He.ViewComponentTypeColor=VEe,He.ViewComponentTypeName=LEe,He.ViewModel=Uz,He.ViewsModel=Wz,He.applyPartialDashboard=ZNe,He.createDashboardModel=aD,He.createDashboardViewsModel=iD,He.getInitialFiltersPayload=Mz,He.getNewPanel=zz,He.getVersion=pke,He.useFullScreenPanelContext=sN,He.useModelContext=ut,He.usePanelContext=gn,He.useTopLevelServices=oD,Object.defineProperties(He,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
562
+ `)},GIe=ke.observer(({queryModel:e})=>{const[t,r]=Pe.default.useState(e.sql);Pe.default.useEffect(()=>{r(a=>a!==e.sql?e.sql:a)},[e.sql]);const n=t!==e.sql,i=()=>{e.setSQL(t)};return e.typedAsSQL?$(g.Tabs,{defaultValue:"Edit",orientation:"vertical",sx:{flexGrow:1},styles:{tabLabel:{width:"100%",height:"28px",lineHeight:"28px"}},keepMounted:!1,children:[$(g.Tabs.List,{children:[h(g.Tabs.Tab,{value:"Edit",children:$(g.Group,{spacing:14,position:"apart",children:["Edit SQL",h(g.ActionIcon,{mr:5,variant:"filled",color:"blue",disabled:!n,onClick:i,children:h(Be.DeviceFloppy,{size:20})})]})}),h(g.Tabs.Tab,{value:"Preview",children:"Preview SQL"}),h(g.Tabs.Tab,{value:"pre_process",children:"Process Request"}),h(g.Tabs.Tab,{value:"post_process",children:"Process Result"}),h(lE,{}),e.datasource&&h(E8,{dataSource:e.datasource})]}),h(g.Tabs.Panel,{value:"Edit",sx:{position:"relative"},p:"sm",children:h(uE,{height:"100%",value:t,onChange:r})}),h(g.Tabs.Panel,{value:"Preview",p:0,pl:4,children:h(qIe,{value:e.sql})}),h(g.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:h(Qb,{label:"",value:e.pre_process,onChange:e.setPreProcess,defaultValue:_8.pre})}),h(g.Tabs.Panel,{value:"post_process",p:"sm",children:h(Qb,{label:"",value:e.post_process,onChange:e.setPostProcess,defaultValue:_8.post})})]}):null}),UIe=ke.observer(({queryID:e,usage:t})=>{const r=ut().editor,n=a=>{if(a.type==="filter"){r.setPath(["_FILTERS_",a.id]);return}if(a.type==="panel"){const o=a.views[0].id;r.setPath(["_VIEWS_",o,"_PANELS_",a.id]);return}},i=a=>{r.setPath(["_VIEWS_",a])};return h(g.Stack,{py:"sm",px:"md",children:$(g.Table,{highlightOnHover:!0,sx:{tableLayout:"fixed"},children:[h("thead",{children:$("tr",{children:[h("th",{style:{width:100},children:"Type"}),h("th",{style:{width:"calc(50% - 50px)"},children:"Name"}),h("th",{children:"In View(s)"})]})}),h("tbody",{children:t.map(a=>$("tr",{children:[h("td",{children:Ne.default.capitalize(a.type)}),h("td",{children:h(g.Anchor,{component:"button",type:"button",onClick:()=>n(a),children:a.label})}),h("td",{children:$(g.Stack,{align:"flex-start",justify:"flex-start",spacing:2,children:[a.views.map(o=>h(g.Anchor,{component:"button",type:"button",onClick:()=>i(o.id),children:h(g.Box,{children:o.label})})),a.views.length===0&&h(g.Box,{children:"--"})]})})]},a.id))})]})})}),Jb={height:"calc(100% - 44px)",padding:0},WIe=ke.observer(({queryModel:e})=>{const t=ut(),r=z.useMemo(()=>e.datasource?e.typedAsHTTP?"HTTP":"SQL":"Configurations",[e.datasource,e.typedAsHTTP]),n=t.findQueryUsage(e.id),i=n.length===0;return h(g.Stack,{sx:{flexGrow:1},my:0,p:0,children:$(g.Tabs,{defaultValue:r,orientation:"horizontal",keepMounted:!1,sx:{flexGrow:1},children:[$(g.Tabs.List,{grow:!0,children:[h(g.Tabs.Tab,{value:"Configurations",children:"Configurations"}),e.typedAsSQL&&h(g.Tabs.Tab,{value:"SQL",children:"Request"}),e.typedAsHTTP&&h(g.Tabs.Tab,{value:"HTTP",children:"Request"}),h(g.Tabs.Tab,{value:"Data",disabled:!e.datasource,children:h(g.Tooltip,{label:"Need to pick a Data Source first",disabled:e.datasource,withinPortal:!0,children:h(g.Text,{children:"Data"})})}),h(g.Tabs.Tab,{value:"Usage",disabled:i,children:h(g.Tooltip,{label:"This query is not used for any filter or panel",disabled:!i,withinPortal:!0,children:h(g.Text,{children:"Usage"})})})]}),h(g.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:h(FIe,{queryModel:e})}),e.typedAsSQL&&h(g.Tabs.Panel,{value:"SQL",sx:Jb,children:h(g.Stack,{sx:{height:"100%"},children:h(GIe,{queryModel:e})})}),e.typedAsHTTP&&h(g.Tabs.Panel,{value:"HTTP",sx:Jb,children:h(g.Stack,{sx:{height:"100%"},children:h(LIe,{queryModel:e})})}),h(g.Tabs.Panel,{value:"Data",sx:{...Jb,overflow:"hidden"},children:h(x8,{id:e.id})}),h(g.Tabs.Panel,{value:"Usage",sx:{...Jb,overflow:"hidden"},children:h(UIe,{queryID:e.id,usage:n})})]})})}),HIe=ke.observer(({id:e})=>{const r=ut().queries.findByID(e);return e===""?null:r?h(g.Stack,{sx:{height:"100%"},spacing:"sm",children:h(WIe,{queryModel:r})}):h(g.Text,{size:14,color:"red",children:"Invalid Query ID"})}),jIe=ke.observer(({value:e})=>{const t=ut(),r=t.context.current,n=SNe(e,r,t.mock_context.current,t.filters.values);return h(uE,{height:"100%",value:n})}),KIe=ke.observer(({item:e,remove:t,onKeyChanged:r})=>{const[n,i]=z.useState("SQL"),[a,o]=z.useState(e.key),s=()=>{e.setKey(a),r(a)},l=a!==e.key,u=e.isADuplicatedKey(a),[c,d]=z.useState(e.value),f=()=>{e.setValue(c)};z.useEffect(()=>{o(e.key),d(e.value)},[e]);const p=c!==e.value,m=da.useModals(),v=()=>{m.openConfirmModal({title:"Delete this SQL snippet?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:t,zIndex:320})};return $(g.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[$(g.Group,{sx:{alignItems:"end"},spacing:40,children:[h(g.TextInput,{label:u?"This key is occupied by another snippet":"Key",value:a,onChange:y=>{o(y.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:h(g.ActionIcon,{color:"blue",variant:"subtle",onClick:s,disabled:!l||u,children:h(Be.DeviceFloppy,{size:16})}),error:u}),h(g.Button,{leftIcon:h(Be.Trash,{size:16}),color:"red",variant:"light",onClick:v,children:"Delete this SQL Snippet"})]}),$(g.Tabs,{value:n,onTabChange:i,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[$(g.Tabs.List,{sx:{position:"relative"},children:[h(g.Tabs.Tab,{value:"SQL",children:"SQL"}),h(g.Tabs.Tab,{value:"Preview",children:"Preview"}),h(lE,{}),h(g.ActionIcon,{color:"blue",variant:"filled",onClick:f,disabled:!p,sx:{position:"absolute",top:0,right:10},children:h(Be.DeviceFloppy,{size:18})})]}),h(g.Tabs.Panel,{value:"SQL",pt:"sm",children:h(uE,{height:"100%",value:c,onChange:d})}),h(g.Tabs.Panel,{value:"Preview",pt:"sm",children:h(jIe,{value:c})})]})]})}),YIe=ke.observer(({id:e})=>{const t=ut(),r=z.useMemo(()=>t.sqlSnippets.findByKey(e),[e]);return r?h(KIe,{item:r,remove:()=>t.sqlSnippets.removeByKey(e),onKeyChanged:a=>{t.editor.setPath(["_SQL_SNIPPETS_",a])}}):$(g.Text,{size:14,children:["SQL Snippet by key[",e,"] is not found"]})}),XIe=ke.observer(({view:e})=>!e||e.type!==Xt.Division?null:$(g.Stack,{children:[h(g.Divider,{mt:8,mb:0,label:"Division settings",labelPosition:"center"}),h(g.Text,{align:"center",size:"xs",color:"dimmed",children:"Under construction"})]})),ZIe=[{value:"default",label:"Default"},{value:"outline",label:"Outline"},{value:"pills",label:"Pills"}],QIe=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical"}],JIe=ke.observer(({view:e})=>{if(!e||e.type!==Xt.Tabs)return null;const t=e.config;return $(g.Stack,{children:[h(g.Divider,{mt:8,mb:0,label:"Tabs settings",labelPosition:"center"}),h(g.Select,{label:"Variant",value:t.variant,onChange:t.setVariant,data:ZIe}),h(g.Select,{label:"Orientation",value:t.orientation,onChange:t.setOrientation,data:QIe}),h(g.Switch,{label:"Grow Tabs",checked:t.grow,onChange:r=>t.setGrow(r.currentTarget.checked)})]})}),e3e=({disabled:e,value:t,onChange:r})=>{const n=i=>{!i||r(i)};return $(g.Box,{sx:{position:"relative"},children:[e&&h(g.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),h(pi.default,{height:"500px",defaultLanguage:"javascript",value:t,onChange:n,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})},t3e=({value:e,onChange:t})=>{const[r,{setTrue:n,setFalse:i}]=Wt.useBoolean(),[a,o]=z.useState(e!=null?e:nD),s=f=>{o({...a,enabled:f})},l=()=>{i();const{enabled:f,func_content:p}=a,m={enabled:f,func_content:p};o(m),t(m)},u=()=>{i(),o(e)},c=f=>{o(p=>({...p,func_content:f}))},d=()=>{c(nD.func_content)};return $(tt,{children:[h(g.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:n,sx:{flexGrow:0},children:h(Be.Settings,{size:14})}),h(g.Modal,{size:800,title:"Customize modal title",opened:r,onClose:i,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:r&&$(g.Stack,{children:[h(g.Checkbox,{mt:10,label:"Enabled",checked:a.enabled,onChange:f=>s(f.currentTarget.checked)}),h(e3e,{value:a.func_content,onChange:c,disabled:!a.enabled}),$(g.Group,{position:"apart",children:[h(g.Button,{onClick:d,color:"red",leftIcon:h(Be.Recycle,{size:20}),children:"Rest"}),$(g.Group,{position:"right",children:[h(g.Button,{onClick:u,variant:"subtle",children:"Cancel"}),h(g.Button,{onClick:l,children:"OK"})]})]})]})})]})},r3e=ke.observer(({view:e})=>{if(!e||e.type!==Xt.Modal)return null;const t=e.config,r=t.custom_modal_title.value;return $(g.Stack,{children:[h(g.Divider,{mt:8,label:"Modal settings",labelPosition:"center"}),$(g.Flex,{gap:10,children:[h(g.TextInput,{label:"Modal Title",value:r,onChange:Ne.default.noop,disabled:!0,sx:{flexGrow:1}}),h(t3e,{value:t.custom_modal_title,onChange:t.custom_modal_title.replace})]}),$(g.Group,{grow:!0,children:[h(g.TextInput,{label:"Width",value:t.width,onChange:n=>t.setWidth(n.currentTarget.value),placeholder:"600px / 50vw"}),h(g.TextInput,{label:"Height",value:t.height,onChange:n=>t.setHeight(n.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),n3e=ke.observer(({view:e})=>$(tt,{children:[h(XIe,{view:e}),h(r3e,{view:e}),h(JIe,{view:e})]})),i3e=[{label:"Division",value:Xt.Division},{label:"Modal",value:Xt.Modal},{label:"Tabs",value:Xt.Tabs}],a3e=ke.observer(({view:e})=>e?$(g.Stack,{sx:{position:"relative"},children:[h(g.TextInput,{label:"Name",value:e.name,onChange:t=>{e.setName(t.currentTarget.value)}}),h(g.Select,{label:"Type",withinPortal:!0,value:e.type,onChange:e.setType,data:i3e}),h(n3e,{view:e})]}):null),o3e=ke.observer(({id:e})=>{const t=da.useModals(),r=ut(),n=r.views.findByID(e);if(!n)return $(g.Text,{size:14,children:["View by ID[",e,"] is not found"]});const i=()=>{t.openConfirmModal({title:"Delete this view?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>r.views.removeByID(e),zIndex:320})};return $(g.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[h(g.Group,{position:"right",pt:10,children:h(g.Button,{size:"xs",color:"red",leftIcon:h(Be.Trash,{size:16}),onClick:i,children:"Delete this view"})}),h(g.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:h(a3e,{view:n})})]})});function s3e(e){return e.length===1&&e[0]==="_GLOBAL_VARS_"}function l3e(e){return e.length===1&&e[0]==="_MOCK_CONTEXT_"}function u3e(e){return e.length===2&&e[0]==="_FILTERS_"}function c3e(e){return e.length===2&&e[0]==="_SQL_SNIPPETS_"}function d3e(e){return e.length===2&&e[0]==="_QUERIES_"}function f3e(e){return e.length===2&&e[0]==="_VIEWS_"}function p3e(e){return e.length===4&&e[0]==="_VIEWS_"&&e[2]==="_PANELS_"}const h3e=ke.observer(()=>h(g.Stack,{sx:{height:"100%"},p:"sm",children:h(N8,{})})),m3e=ke.observer(()=>{const e=ut().editor,t=e.path;return s3e(t)?h(h3e,{}):l3e(t)?h(zRe,{}):u3e(t)?h(g.Box,{p:"xs",pl:20,children:h(BRe,{id:t[1]})}):c3e(t)?h(YIe,{id:t[1]}):d3e(t)?h(HIe,{id:t[1]}):f3e(t)?h(g.Box,{p:"xs",pl:20,children:h(o3e,{id:t[1]})}):p3e(t)?h(mIe,{viewID:t[1],panelID:t[3]}):h(g.Box,{children:e.path})}),v3e=ke.observer(()=>(ut().editor,h(m3e,{}))),g3e=ke.observer(()=>{const e=ut(),t=()=>{const r=new Date().getTime().toString(),n={id:r,key:r,label:r,order:e.filters.current.length+1,type:ZS.TextInput,config:Ez(),visibleInViewsIDs:["Main"],auto_submit:!1};e.filters.append(n)};return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Filter"})}),y3e=ke.observer(({parentID:e})=>{const t=ut();if(!e)return null;const r=t.views.findByID(e);return r?h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>t.addANewPanel(r.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Panel"}):null}),b3e=ke.observer(()=>{const e=ut(),t=()=>{const r=new Date().getTime().toString(),n={id:r,name:r,type:qr.Postgresql,key:"",sql:""};e.queries.append(n)};return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Query"})}),x3e=ke.observer(()=>{const e=ut(),t=()=>{const n={key:new Date().getTime().toString(),value:""};e.sqlSnippets.append(n)};return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a SQL Snippet"})}),w3e=ke.observer(()=>{const e=ut();return h(g.Button,{variant:"subtle",leftIcon:h(vo,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a View"})}),C3e=ke.observer(({action_type:e,parentID:t})=>(ut(),e==="_Add_A_Filter_"?h(g3e,{}):e==="_Add_A_SQL_SNIPPET_"?h(x3e,{}):e==="_Add_A_QUERY_"?h(b3e,{}):e==="_Add_A_VIEW_"?h(w3e,{}):e==="_Add_A_PANEL_"?h(y3e,{parentID:t}):null)),M8=ke.observer(({option:e})=>{var u;const t=ut().editor,r=t.isOptionActive,n=r(t.path,e),i=t.isOptionOpened,a=t.navigate,o=i(e),[s,l]=z.useState(o);return z.useEffect(()=>{l(o)},[o]),h(g.NavLink,{active:n,defaultOpened:o,opened:s,onChange:l,label:e.label,onClick:()=>a(e),icon:e.Icon?h(e.Icon,{size:18}):null,children:(u=e.children)==null?void 0:u.map(c=>c._type==="ACTION"?h(C3e,{action_type:c._action_type,parentID:c.parentID},`_ADD_${c.value}_`):h(M8,{option:c},c.value))},e.label)}),S3e=ke.observer(()=>{const e=ut();return h(g.Box,{sx:{position:"relative"},children:e.editor.navOptions.map(t=>h(M8,{option:t},t.value))})}),D3e=ke.observer(()=>{const e=ut();return $(g.Navbar,{p:0,width:{base:200,xs:200,sm:220,md:240,lg:280,xl:300},sx:{height:"100vh - 60px - 60px"},children:[h(g.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:h(g.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:"Settings"})}),h(g.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:h(S3e,{})}),h(g.Navbar.Section,{children:h(g.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:h(g.Button,{size:"xs",color:"red",leftIcon:h(DE,{size:18}),onClick:()=>e.editor.close(),children:"Close"})})})]})}),E3e={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1,nav:{top:0,height:"100vh"}},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:0,height:"100vh"}},N3e=ke.observer(()=>{const e=ut().editor;return h(g.Modal,{onClose:()=>e.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:e.settings_open,fullScreen:!0,title:null,transitionDuration:0,withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{modal:{padding:"0 !important"}},children:h(g.AppShell,{padding:0,navbar:h(D3e,{}),styles:E3e,children:h(v3e,{})})})}),A3e=e=>e.replace(/([^:])(\/\/+)/g,"$1/");function _3e(e){z.useEffect(()=>{if(fd.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const r=A3e(e);fd.loader.config({paths:{vs:r}}),fd.loader.init().then(n=>console.log("monaco instance:",n))},[])}const T8={grid:{axis:"#97999D",scope:"rgba(47,140,192,0.1)",boundary:"#789AB4",reference:"#CFCFD8"},graphics:{compared:{blueDark:"#3E7CAB",blue:"#6398C7",blueLight:"#7CB0DF",blue10:"#6398C71a",redDark:"#AF5F6B",red:"#CD7C88",redLight:"#E794A0",red10:"#CD7C881a"},gradient:{distributed:"linear-gradient(90deg, #1babe6 0%, #2fc8c8 28.63%, #98d44b 48.86%, #ffd057 67.53%, #f5ae53 80.6%, #e76441 91.18%, #b90000 100%)",protrude:"linear-gradient(180deg, #ec73734d 0%, #ec737300 100%)"},level:{lv0:"#6398C7",lv1:"#61B5BF",lv2:"#54D4BB",lv3:"#F5D277",lv4:"#E8BB7F",lv5:"#DB9E84",lv6:"#CB8089"},depth:{dp0:"#FFF7F8",dp1:"#FFE1E1",dp2:"#FDBCBC",dp3:"#F39494",dp4:"#FA4242",dp5:"#E21212"},multiple:{c1:"#66B4DB",c2:"#E46464",c3:"#EEBA00",c4:"#33A678",c5:"#9D88CB",c6:"#939943",c7:"#E49792",c8:"#09A2B8",c9:"#AF5F6B",c10:"#6CA157",c11:"#3E7CAB",c12:"#6398C7",c13:"#E692BA",c14:"#97B566",c15:"#8CACE2",c16:"#CA79AC",c17:"#6DBC80",c18:"#B08F4B",c19:"#39BFA2",c20:"#826BAF"}}};function M3e(){wr.registerTheme("merico-light",{color:Object.values(T8.graphics.multiple),visualMap:{color:Object.values(T8.graphics.depth).reverse()}})}function O8(){M3e()}O8();const T3e={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60,height:"100vh"}},O3e=ke.observer(z.forwardRef(function({context:t,dashboard:r,update:n,className:i="dashboard",config:a,onChange:o,headerSlot:s},l){_3e(a.monacoPath),gz(a);const{data:u=[]}=Wt.useRequest(rD),[c,d]=Pe.default.useState(!1),f=Pe.default.useMemo(()=>aD(r,u,t),[r]);Pe.default.useImperativeHandle(l,()=>f,[f]),mE(f,!0),Pe.default.useEffect(()=>{f.context.replace(t)},[t]),Pe.default.useEffect(()=>{f.datasources.replace(u)},[u]),Pe.default.useEffect(()=>cr.reaction(()=>cr.toJS(f.json),y=>{o==null||o(y)}),[f]);const p=async()=>{await n(f.json)},m=Wt.useCreation(YS,[]),v=oD(m);return h(da.ModalsProvider,{children:h(a1,{value:f,children:h(ss.Provider,{value:{layoutFrozen:c,freezeLayout:d,inEditMode:!0},children:h(Oa.Provider,{value:m,children:$(md,{configure:v,children:[h(g.AppShell,{padding:0,header:h(sAe,{saveDashboardChanges:p,headerSlot:s}),navbar:h(SRe,{}),styles:T3e,children:h(g.Box,{className:`${i} dashboard-root`,sx:{position:"relative"},children:f.views.visibleViews.map(y=>h(vz,{view:y},y.id))})}),h(N3e,{})]})})})})})})),Vke="";O8();const R3e=ke.observer(({context:e,dashboard:t,className:r="dashboard",config:n,fullScreenPanelID:i,setFullScreenPanelID:a})=>{gz(n);const{data:o=[]}=Wt.useRequest(rD),s=Pe.default.useMemo(()=>aD(t,o,e),[t]);mE(s,!1),Pe.default.useEffect(()=>{s.context.replace(e)},[e]),Pe.default.useEffect(()=>{s.datasources.replace(o)},[o]);const l=Wt.useCreation(YS,[]),u=oD(l);return h(da.ModalsProvider,{children:h(a1,{value:s,children:h(v1.Provider,{value:{fullScreenPanelID:i,setFullScreenPanelID:a},children:h(ss.Provider,{value:{layoutFrozen:!0,freezeLayout:Ne.default.noop,inEditMode:!1},children:h(g.Box,{className:`${r} dashboard-root`,children:h(Oa.Provider,{value:l,children:h(md,{configure:u,children:s.views.visibleViews.map(c=>h(gb,{view:c},c.id))})})})})})})})});var R8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=a.format;i.en.ordinal=function(s){var l=["th","st","nd","rd"],u=s%100;return"["+s+(l[(u-20)%10]||l[u]||l[0])+"]"},a.format=function(s){var l=this,u=this.$locale();if(!this.isValid())return o.bind(this)(s);var c=this.$utils(),d=(s||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(f){switch(f){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return c.s(l.week(),f==="w"?1:2,"0");case"W":case"WW":return c.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return c.s(String(l.$H===0?24:l.$H),f==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return f}});return o.bind(this)(d)}}})})(R8);const I3e=R8.exports;var I8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=function(l){var u=l.date,c=l.utc;return Array.isArray(u)?c?u.length?new Date(Date.UTC.apply(null,u)):new Date:u.length===1?i(String(u[0])).toDate():new(Function.prototype.bind.apply(Date,[null].concat(u))):u},s=a.parse;a.parse=function(l){l.date=o.bind(this)(l),s.bind(this)(l)}}})})(I8);const k3e=I8.exports;var k8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype;i.$g=function(f,p,m){return this.$utils().u(f)?this[p]:this.$set(m,f)},i.set=function(f,p){return this.$set(f,p)};var a=i.startOf;i.startOf=function(f,p){return this.$d=a.bind(this)(f,p).toDate(),this.init(),this};var o=i.add;i.add=function(f,p){return this.$d=o.bind(this)(f,p).toDate(),this.init(),this};var s=i.locale;i.locale=function(f,p){return f?(this.$L=s.bind(this)(f,p).$L,this):this.$L};var l=i.daysInMonth;i.daysInMonth=function(){return l.bind(this.clone())()};var u=i.isSame;i.isSame=function(f,p){return u.bind(this.clone())(f,p)};var c=i.isBefore;i.isBefore=function(f,p){return c.bind(this.clone())(f,p)};var d=i.isAfter;i.isAfter=function(f,p){return d.bind(this.clone())(f,p)}}})})(k8);const P3e=k8.exports;var P8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype,a=i.format;i.format=function(o){var s=this,l=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g,function(u,c){var d,f=String(s.$y+543),p=u==="BB"?[f.slice(-2),2]:[f,4];return c||(d=s.$utils()).s.apply(d,p.concat(["0"]))});return a.bind(this)(l)}}})})(P8);const F3e=P8.exports;var F8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a="h:mm A",o={lastDay:"[Yesterday at] "+a,sameDay:"[Today at] "+a,nextDay:"[Tomorrow at] "+a,nextWeek:"dddd [at] "+a,lastWeek:"[Last] dddd [at] "+a,sameElse:"MM/DD/YYYY"};n.prototype.calendar=function(s,l){var u=l||this.$locale().calendar||o,c=i(s||void 0).startOf("d"),d=this.diff(c,"d",!0),f="sameElse",p=d<-6?f:d<-1?"lastWeek":d<0?"lastDay":d<1?"sameDay":d<2?"nextDay":d<7?"nextWeek":f,m=u[p]||o[p];return typeof m=="function"?m.call(this,i()):this.format(m)}}})})(F8);const $3e=F8.exports;var $8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r={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"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d\d/,a=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},l=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(y){this[v]=+y}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=function(y){if(!y||y==="Z")return 0;var b=y.match(/([+-]|\d\d)/g),D=60*b[1]+(+b[2]||0);return D===0?0:b[0]==="+"?-D:D}(v)}],d=function(v){var y=s[v];return y&&(y.indexOf?y:y.s.concat(y.f))},f=function(v,y){var b,D=s.meridiem;if(D){for(var x=1;x<=24;x+=1)if(v.indexOf(D(x,0,y))>-1){b=x>12;break}}else b=v===(y?"pm":"PM");return b},p={A:[o,function(v){this.afternoon=f(v,!1)}],a:[o,function(v){this.afternoon=f(v,!0)}],S:[/\d/,function(v){this.milliseconds=100*+v}],SS:[i,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,u("seconds")],ss:[a,u("seconds")],m:[a,u("minutes")],mm:[a,u("minutes")],H:[a,u("hours")],h:[a,u("hours")],HH:[a,u("hours")],hh:[a,u("hours")],D:[a,u("day")],DD:[i,u("day")],Do:[o,function(v){var y=s.ordinal,b=v.match(/\d+/);if(this.day=b[0],y)for(var D=1;D<=31;D+=1)y(D).replace(/\[|\]/g,"")===v&&(this.day=D)}],M:[a,u("month")],MM:[i,u("month")],MMM:[o,function(v){var y=d("months"),b=(d("monthsShort")||y.map(function(D){return D.slice(0,3)})).indexOf(v)+1;if(b<1)throw new Error;this.month=b%12||b}],MMMM:[o,function(v){var y=d("months").indexOf(v)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(v){this.year=l(v)}],YYYY:[/\d{4}/,u("year")],Z:c,ZZ:c};function m(v){var y,b;y=v,b=s&&s.formats;for(var D=(v=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(_,N,M){var R=M&&M.toUpperCase();return N||b[M]||r[M]||b[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(F,k,P){return k||P.slice(1)})})).match(n),x=D.length,S=0;S<x;S+=1){var w=D[S],C=p[w],E=C&&C[0],A=C&&C[1];D[S]=A?{regex:E,parser:A}:w.replace(/^\[|\]$/g,"")}return function(_){for(var N={},M=0,R=0;M<x;M+=1){var F=D[M];if(typeof F=="string")R+=F.length;else{var k=F.regex,P=F.parser,T=_.slice(R),O=k.exec(T)[0];P.call(N,O),_=_.replace(O,"")}}return function(L){var I=L.afternoon;if(I!==void 0){var V=L.hours;I?V<12&&(L.hours+=12):V===12&&(L.hours=0),delete L.afternoon}}(N),N}}return function(v,y,b){b.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(l=v.parseTwoDigitYear);var D=y.prototype,x=D.parse;D.parse=function(S){var w=S.date,C=S.utc,E=S.args;this.$u=C;var A=E[1];if(typeof A=="string"){var _=E[2]===!0,N=E[3]===!0,M=_||N,R=E[2];N&&(R=E[2]),s=this.$locale(),!_&&R&&(s=b.Ls[R]),this.$d=function(T,O,L){try{if(["x","X"].indexOf(O)>-1)return new Date((O==="X"?1e3:1)*T);var I=m(O)(T),V=I.year,H=I.month,Z=I.day,G=I.hours,Y=I.minutes,re=I.seconds,ne=I.milliseconds,pe=I.zone,he=new Date,le=Z||(V||H?1:he.getDate()),fe=V||he.getFullYear(),xe=0;V&&!H||(xe=H>0?H-1:he.getMonth());var ge=G||0,ve=Y||0,Ee=re||0,q=ne||0;return pe?new Date(Date.UTC(fe,xe,le,ge,ve,Ee,q+60*pe.offset*1e3)):L?new Date(Date.UTC(fe,xe,le,ge,ve,Ee,q)):new Date(fe,xe,le,ge,ve,Ee,q)}catch{return new Date("")}}(w,A,C),this.init(),R&&R!==!0&&(this.$L=this.locale(R).$L),M&&w!=this.format(A)&&(this.$d=new Date("")),s={}}else if(A instanceof Array)for(var F=A.length,k=1;k<=F;k+=1){E[1]=A[k-1];var P=b.apply(this,E);if(P.isValid()){this.$d=P.$d,this.$L=P.$L,this.init();break}k===F&&(this.$d=new Date(""))}else x.call(this,S)}}})})($8);const B3e=$8.exports;var B8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.dayOfYear=function(a){var o=Math.round((i(this).startOf("day")-i(this).startOf("year"))/864e5)+1;return a==null?o:this.add(a-o,"day")}}})})(B8);const z3e=B8.exports;var z8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r,n,i=1e3,a=6e4,o=36e5,s=864e5,l=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,c=2592e6,d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,f={years:u,months:c,days:s,hours:o,minutes:a,seconds:i,milliseconds:1,weeks:6048e5},p=function(w){return w instanceof S},m=function(w,C,E){return new S(w,E,C.$l)},v=function(w){return n.p(w)+"s"},y=function(w){return w<0},b=function(w){return y(w)?Math.ceil(w):Math.floor(w)},D=function(w){return Math.abs(w)},x=function(w,C){return w?y(w)?{negative:!0,format:""+D(w)+C}:{negative:!1,format:""+w+C}:{negative:!1,format:""}},S=function(){function w(E,A,_){var N=this;if(this.$d={},this.$l=_,E===void 0&&(this.$ms=0,this.parseFromMilliseconds()),A)return m(E*f[v(A)],this);if(typeof E=="number")return this.$ms=E,this.parseFromMilliseconds(),this;if(typeof E=="object")return Object.keys(E).forEach(function(F){N.$d[v(F)]=E[F]}),this.calMilliseconds(),this;if(typeof E=="string"){var M=E.match(d);if(M){var R=M.slice(2).map(function(F){return F!=null?Number(F):0});return this.$d.years=R[0],this.$d.months=R[1],this.$d.weeks=R[2],this.$d.days=R[3],this.$d.hours=R[4],this.$d.minutes=R[5],this.$d.seconds=R[6],this.calMilliseconds(),this}}return this}var C=w.prototype;return C.calMilliseconds=function(){var E=this;this.$ms=Object.keys(this.$d).reduce(function(A,_){return A+(E.$d[_]||0)*f[_]},0)},C.parseFromMilliseconds=function(){var E=this.$ms;this.$d.years=b(E/u),E%=u,this.$d.months=b(E/c),E%=c,this.$d.days=b(E/s),E%=s,this.$d.hours=b(E/o),E%=o,this.$d.minutes=b(E/a),E%=a,this.$d.seconds=b(E/i),E%=i,this.$d.milliseconds=E},C.toISOString=function(){var E=x(this.$d.years,"Y"),A=x(this.$d.months,"M"),_=+this.$d.days||0;this.$d.weeks&&(_+=7*this.$d.weeks);var N=x(_,"D"),M=x(this.$d.hours,"H"),R=x(this.$d.minutes,"M"),F=this.$d.seconds||0;this.$d.milliseconds&&(F+=this.$d.milliseconds/1e3);var k=x(F,"S"),P=E.negative||A.negative||N.negative||M.negative||R.negative||k.negative,T=M.format||R.format||k.format?"T":"",O=(P?"-":"")+"P"+E.format+A.format+N.format+T+M.format+R.format+k.format;return O==="P"||O==="-P"?"P0D":O},C.toJSON=function(){return this.toISOString()},C.format=function(E){var A=E||"YYYY-MM-DDTHH:mm:ss",_={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return A.replace(l,function(N,M){return M||String(_[N])})},C.as=function(E){return this.$ms/f[v(E)]},C.get=function(E){var A=this.$ms,_=v(E);return _==="milliseconds"?A%=1e3:A=_==="weeks"?b(A/f[_]):this.$d[_],A===0?0:A},C.add=function(E,A,_){var N;return N=A?E*f[v(A)]:p(E)?E.$ms:m(E,this).$ms,m(this.$ms+N*(_?-1:1),this)},C.subtract=function(E,A){return this.add(E,A,!0)},C.locale=function(E){var A=this.clone();return A.$l=E,A},C.clone=function(){return m(this.$ms,this)},C.humanize=function(E){return r().add(this.$ms,"ms").locale(this.$l).fromNow(!E)},C.milliseconds=function(){return this.get("milliseconds")},C.asMilliseconds=function(){return this.as("milliseconds")},C.seconds=function(){return this.get("seconds")},C.asSeconds=function(){return this.as("seconds")},C.minutes=function(){return this.get("minutes")},C.asMinutes=function(){return this.as("minutes")},C.hours=function(){return this.get("hours")},C.asHours=function(){return this.as("hours")},C.days=function(){return this.get("days")},C.asDays=function(){return this.as("days")},C.weeks=function(){return this.get("weeks")},C.asWeeks=function(){return this.as("weeks")},C.months=function(){return this.get("months")},C.asMonths=function(){return this.as("months")},C.years=function(){return this.get("years")},C.asYears=function(){return this.as("years")},w}();return function(w,C,E){r=E,n=E().$utils(),E.duration=function(N,M){var R=E.locale();return m(N,{$l:R},M)},E.isDuration=p;var A=C.prototype.add,_=C.prototype.subtract;C.prototype.add=function(N,M){return p(N)&&(N=N.asMilliseconds()),A.bind(this)(N,M)},C.prototype.subtract=function(N,M){return p(N)&&(N=N.asMilliseconds()),_.bind(this)(N,M)}}})})(z8);const L3e=z8.exports;var L8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isBetween=function(a,o,s,l){var u=i(a),c=i(o),d=(l=l||"()")[0]==="(",f=l[1]===")";return(d?this.isAfter(u,s):!this.isBefore(u,s))&&(f?this.isBefore(c,s):!this.isAfter(c,s))||(d?this.isBefore(u,s):!this.isAfter(u,s))&&(f?this.isAfter(c,s):!this.isBefore(c,s))}}})})(L8);const V3e=L8.exports;var V8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(V8);const q3e=V8.exports;var q8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){i.isMoment=function(a){return i.isDayjs(a)}}})})(q8);const G3e=q8.exports;var G8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="day";return function(n,i,a){var o=function(u){return u.add(4-u.isoWeekday(),r)},s=i.prototype;s.isoWeekYear=function(){return o(this).year()},s.isoWeek=function(u){if(!this.$utils().u(u))return this.add(7*(u-this.isoWeek()),r);var c,d,f,p,m=o(this),v=(c=this.isoWeekYear(),d=this.$u,f=(d?a.utc:a)().year(c).startOf("year"),p=4-f.isoWeekday(),f.isoWeekday()>4&&(p+=7),f.add(p,r));return m.diff(v,"week")+1},s.isoWeekday=function(u){return this.$utils().u(u)?this.day()||7:this.day(this.day()%7?u:u-7)};var l=s.startOf;s.startOf=function(u,c){var d=this.$utils(),f=!!d.u(c)||c;return d.p(u)==="isoweek"?f?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):l.bind(this)(u,c)}}})})(G8);const U3e=G8.exports;var U8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isoWeeksInYear=function(){var i=this.isLeapYear(),a=this.endOf("y").day();return a===4||i&&a===5?53:52}}})})(U8);const W3e=U8.exports;var W8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isSameOrAfter=function(i,a){return this.isSame(i,a)||this.isAfter(i,a)}}})})(W8);const H3e=W8.exports;var H8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.isSameOrBefore=function(i,a){return this.isSame(i,a)||this.isBefore(i,a)}}})})(H8);const j3e=H8.exports;var j8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isToday=function(){var a="YYYY-MM-DD",o=i();return this.format(a)===o.format(a)}}})})(j8);const K3e=j8.exports;var K8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isTomorrow=function(){var a="YYYY-MM-DD",o=i().add(1,"day");return this.format(a)===o.format(a)}}})})(K8);const Y3e=K8.exports;var Y8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){n.prototype.isYesterday=function(){var a="YYYY-MM-DD",o=i().subtract(1,"day");return this.format(a)===o.format(a)}}})})(Y8);const X3e=Y8.exports;var X8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=function(d){return d&&(d.indexOf?d:d.s)},s=function(d,f,p,m,v){var y=d.name?d:d.$locale(),b=o(y[f]),D=o(y[p]),x=b||D.map(function(w){return w.slice(0,m)});if(!v)return x;var S=y.weekStart;return x.map(function(w,C){return x[(C+(S||0))%7]})},l=function(){return i.Ls[i.locale()]},u=function(d,f){return d.formats[f]||function(p){return p.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(m,v,y){return v||y.slice(1)})}(d.formats[f.toUpperCase()])},c=function(){var d=this;return{months:function(f){return f?f.format("MMMM"):s(d,"months")},monthsShort:function(f){return f?f.format("MMM"):s(d,"monthsShort","months",3)},firstDayOfWeek:function(){return d.$locale().weekStart||0},weekdays:function(f){return f?f.format("dddd"):s(d,"weekdays")},weekdaysMin:function(f){return f?f.format("dd"):s(d,"weekdaysMin","weekdays",2)},weekdaysShort:function(f){return f?f.format("ddd"):s(d,"weekdaysShort","weekdays",3)},longDateFormat:function(f){return u(d.$locale(),f)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};a.localeData=function(){return c.bind(this)()},i.localeData=function(){var d=l();return{firstDayOfWeek:function(){return d.weekStart||0},weekdays:function(){return i.weekdays()},weekdaysShort:function(){return i.weekdaysShort()},weekdaysMin:function(){return i.weekdaysMin()},months:function(){return i.months()},monthsShort:function(){return i.monthsShort()},longDateFormat:function(f){return u(d,f)},meridiem:d.meridiem,ordinal:d.ordinal}},i.months=function(){return s(l(),"months")},i.monthsShort=function(){return s(l(),"monthsShort","months",3)},i.weekdays=function(d){return s(l(),"weekdays",null,null,d)},i.weekdaysShort=function(d){return s(l(),"weekdaysShort","weekdays",3,d)},i.weekdaysMin=function(d){return s(l(),"weekdaysMin","weekdays",2,d)}}})})(X8);const Z3e=X8.exports;var Z8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r={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"};return function(n,i,a){var o=i.prototype,s=o.format;a.en.formats=r,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(d,f){return d.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(p,m,v){var y=v&&v.toUpperCase();return m||f[v]||r[v]||f[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(b,D,x){return D||x.slice(1)})})}(l,u===void 0?{}:u);return s.call(this,c)}}})})(Z8);const Q3e=Z8.exports;var Q8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=function(o,s){if(!s||!s.length||!s[0]||s.length===1&&!s[0].length)return null;var l;s.length===1&&s[0].length>0&&(s=s[0]),l=s[0];for(var u=1;u<s.length;u+=1)s[u].isValid()&&!s[u][o](l)||(l=s[u]);return l};i.max=function(){var o=[].slice.call(arguments,0);return a("isAfter",o)},i.min=function(){var o=[].slice.call(arguments,0);return a("isBefore",o)}}})})(Q8);const J3e=Q8.exports;var J8={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){var a=n.prototype,o=function(d){var f,p=d.date,m=d.utc,v={};if(!((f=p)instanceof Date)&&!(f instanceof Array)&&f instanceof Object){if(!Object.keys(p).length)return new Date;var y=m?i.utc():i();Object.keys(p).forEach(function(A){var _,N;v[_=A,N=a.$utils().p(_),N==="date"?"day":N]=p[A]});var b=v.day||(v.year||v.month>=0?1:y.date()),D=v.year||y.year(),x=v.month>=0?v.month:v.year||v.day?0:y.month(),S=v.hour||0,w=v.minute||0,C=v.second||0,E=v.millisecond||0;return m?new Date(Date.UTC(D,x,b,S,w,C,E)):new Date(D,x,b,S,w,C,E)}return p},s=a.parse;a.parse=function(d){d.date=o.bind(this)(d),s.bind(this)(d)};var l=a.set,u=a.add,c=function(d,f,p,m){if(m===void 0&&(m=1),f instanceof Object){var v=Object.keys(f),y=this;return v.forEach(function(b){y=d.bind(y)(f[b]*m,b)}),y}return d.bind(this)(f*m,p)};a.set=function(d,f){return f=f===void 0?d:f,c.bind(this)(function(p,m){return l.bind(this)(m,p)},f,d)},a.add=function(d,f){return c.bind(this)(u,d,f)},a.subtract=function(d,f){return c.bind(this)(u,d,f,-1)}}})})(J8);const eke=J8.exports;var e6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype;["milliseconds","seconds","minutes","hours","days","weeks","isoWeeks","months","quarters","years","dates"].forEach(function(a){i[a]=i[a.replace(/s$/,"")]})}})})(e6);const tke=e6.exports;var t6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){var i=n.prototype.parse;n.prototype.parse=function(s){if(typeof s.date=="string"){var l=this.$locale();s.date=l&&l.preparse?l.preparse(s.date):s.date}return i.bind(this)(s)};var a=n.prototype.format;n.prototype.format=function(){for(var s=arguments.length,l=new Array(s),u=0;u<s;u++)l[u]=arguments[u];var c=a.call.apply(a,[this].concat(l)),d=this.$locale();return d&&d.postformat?d.postformat(c):c};var o=n.prototype.fromToBase;o&&(n.prototype.fromToBase=function(s,l,u,c){var d=this.$locale()||u.$locale();return o.call(this,s,l,u,c,d&&d.postformat)})}})})(t6);const rke=t6.exports;var r6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="month",n="quarter";return function(i,a){var o=a.prototype;o.quarter=function(u){return this.$utils().u(u)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(u-1))};var s=o.add;o.add=function(u,c){return u=Number(u),this.$utils().p(c)===n?this.add(3*u,r):s.bind(this)(u,c)};var l=o.startOf;o.startOf=function(u,c){var d=this.$utils(),f=!!d.u(c)||c;if(d.p(u)===n){var p=this.quarter()-1;return f?this.month(3*p).startOf(r).startOf("day"):this.month(3*p+2).endOf(r).endOf("day")}return l.bind(this)(u,c)}}})})(r6);const nke=r6.exports;var n6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){r=r||{};var a=n.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(u,c,d,f){return a.fromToBase(u,c,d,f)}i.en.relativeTime=o,a.fromToBase=function(u,c,d,f,p){for(var m,v,y,b=d.$locale().relativeTime||o,D=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],x=D.length,S=0;S<x;S+=1){var w=D[S];w.d&&(m=f?i(u).diff(d,w.d,!0):d.diff(u,w.d,!0));var C=(r.rounding||Math.round)(Math.abs(m));if(y=m>0,C<=w.r||!w.r){C<=1&&S>0&&(w=D[S-1]);var E=b[w.l];p&&(C=p(""+C)),v=typeof E=="string"?E.replace("%d",C):E(C,c,w.l,y);break}}if(c)return v;var A=y?b.future:b.past;return typeof A=="function"?A(v):A.replace("%s",v)},a.to=function(u,c){return s(u,c,this,!0)},a.from=function(u,c){return s(u,c,this)};var l=function(u){return u.$u?i.utc():i()};a.toNow=function(u){return this.to(l(this),u)},a.fromNow=function(u){return this.from(l(this),u)}}})})(n6);const ike=n6.exports;var i6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(i,a,o){var s,l=function(f,p,m){m===void 0&&(m={});var v=new Date(f),y=function(b,D){D===void 0&&(D={});var x=D.timeZoneName||"short",S=b+"|"+x,w=n[S];return w||(w=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:x}),n[S]=w),w}(p,m);return y.formatToParts(v)},u=function(f,p){for(var m=l(f,p),v=[],y=0;y<m.length;y+=1){var b=m[y],D=b.type,x=b.value,S=r[D];S>=0&&(v[S]=parseInt(x,10))}var w=v[3],C=w===24?0:w,E=v[0]+"-"+v[1]+"-"+v[2]+" "+C+":"+v[4]+":"+v[5]+":000",A=+f;return(o.utc(E).valueOf()-(A-=A%1e3))/6e4},c=a.prototype;c.tz=function(f,p){f===void 0&&(f=s);var m=this.utcOffset(),v=this.toDate(),y=v.toLocaleString("en-US",{timeZone:f}),b=Math.round((v-new Date(y))/1e3/60),D=o(y).$set("millisecond",this.$ms).utcOffset(15*-Math.round(v.getTimezoneOffset()/15)-b,!0);if(p){var x=D.utcOffset();D=D.add(m-x,"minute")}return D.$x.$timezone=f,D},c.offsetName=function(f){var p=this.$x.$timezone||o.tz.guess(),m=l(this.valueOf(),p,{timeZoneName:f}).find(function(v){return v.type.toLowerCase()==="timezonename"});return m&&m.value};var d=c.startOf;c.startOf=function(f,p){if(!this.$x||!this.$x.$timezone)return d.call(this,f,p);var m=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"));return d.call(m,f,p).tz(this.$x.$timezone,!0)},o.tz=function(f,p,m){var v=m&&p,y=m||p||s,b=u(+o(),y);if(typeof f!="string")return o(f).tz(y);var D=function(C,E,A){var _=C-60*E*1e3,N=u(_,A);if(E===N)return[_,E];var M=u(_-=60*(N-E)*1e3,A);return N===M?[_,N]:[C-60*Math.min(N,M)*1e3,Math.max(N,M)]}(o.utc(f,v).valueOf(),b,y),x=D[0],S=D[1],w=o(x).utcOffset(S);return w.$x.$timezone=y,w},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(f){s=f}}})})(i6);const ake=i6.exports;var a6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]}}})})(a6);const oke=a6.exports;var o6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.toObject=function(){return{years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}}}})})(o6);const ske=o6.exports;var s6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n,i){i.updateLocale=function(a,o){var s=i.Ls[a];if(s)return(o?Object.keys(o):[]).forEach(function(l){s[l]=o[l]}),s}}})})(s6);const lke=s6.exports;var l6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="minute",n=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g;return function(a,o,s){var l=o.prototype;s.utc=function(v){var y={date:v,utc:!0,args:arguments};return new o(y)},l.utc=function(v){var y=s(this.toDate(),{locale:this.$L,utc:!0});return v?y.add(this.utcOffset(),r):y},l.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(v){v.utc&&(this.$u=!0),this.$utils().u(v.$offset)||(this.$offset=v.$offset),u.call(this,v)};var c=l.init;l.init=function(){if(this.$u){var v=this.$d;this.$y=v.getUTCFullYear(),this.$M=v.getUTCMonth(),this.$D=v.getUTCDate(),this.$W=v.getUTCDay(),this.$H=v.getUTCHours(),this.$m=v.getUTCMinutes(),this.$s=v.getUTCSeconds(),this.$ms=v.getUTCMilliseconds()}else c.call(this)};var d=l.utcOffset;l.utcOffset=function(v,y){var b=this.$utils().u;if(b(v))return this.$u?0:b(this.$offset)?d.call(this):this.$offset;if(typeof v=="string"&&(v=function(w){w===void 0&&(w="");var C=w.match(n);if(!C)return null;var E=(""+C[0]).match(i)||["-",0,0],A=E[0],_=60*+E[1]+ +E[2];return _===0?0:A==="+"?_:-_}(v),v===null))return this;var D=Math.abs(v)<=16?60*v:v,x=this;if(y)return x.$offset=D,x.$u=v===0,x;if(v!==0){var S=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(x=this.local().add(D+S,r)).$offset=D,x.$x.$localOffset=S}else x=this.utc();return x};var f=l.format;l.format=function(v){var y=v||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return f.call(this,y)},l.valueOf=function(){var v=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*v},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var p=l.toDate;l.toDate=function(v){return v==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():p.call(this)};var m=l.diff;l.diff=function(v,y,b){if(v&&this.$u===v.$u)return m.call(this,v,y,b);var D=this.local(),x=s(v).local();return m.call(D,x,y,b)}}})})(l6);const uke=l6.exports;var u6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.weekday=function(i){var a=this.$locale().weekStart||0,o=this.$W,s=(o<a?o+7:o)-a;return this.$utils().u(i)?s:this.subtract(s,"day").add(i,"day")}}})})(u6);const cke=u6.exports;var c6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){var r="week",n="year";return function(i,a,o){var s=a.prototype;s.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(n).add(1,n).date(u),d=o(this).endOf(r);if(c.isBefore(d))return 1}var f=o(this).startOf(n).date(u).startOf(r).subtract(1,"millisecond"),p=this.diff(f,r,!0);return p<0?o(this).startOf("week").week():Math.ceil(p)},s.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})})(c6);const dke=c6.exports;var d6={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(vt,function(){return function(r,n){n.prototype.weekYear=function(){var i=this.month(),a=this.week(),o=this.year();return a===1&&i===11?o+1:i===0&&a>=52?o-1:o}}})})(d6);const fke=d6.exports;Dt.default.extend(I3e),Dt.default.extend(k3e),Dt.default.extend(P3e),Dt.default.extend(F3e),Dt.default.extend($3e),Dt.default.extend(B3e),Dt.default.extend(z3e),Dt.default.extend(L3e),Dt.default.extend(V3e),Dt.default.extend(q3e),Dt.default.extend(G3e),Dt.default.extend(H3e),Dt.default.extend(j3e),Dt.default.extend(K3e),Dt.default.extend(Y3e),Dt.default.extend(X3e),Dt.default.extend(U3e),Dt.default.extend(W3e),Dt.default.extend(Z3e),Dt.default.extend(Q3e),Dt.default.extend(J3e),Dt.default.extend(eke),Dt.default.extend(tke),Dt.default.extend(rke),Dt.default.extend(nke),Dt.default.extend(ike),Dt.default.extend(ake),Dt.default.extend(oke),Dt.default.extend(ske),Dt.default.extend(lke),Dt.default.extend(uke),Dt.default.extend(dke),Dt.default.extend(fke),Dt.default.extend(cke),Dt.default.tz.setDefault("UTC");const pke=()=>Promise.resolve().then(()=>GQ).then(({version:e})=>(console.log(`[@devtable/dashboard] version: ${e}`),e));He.ContextModel=$z,He.Dashboard=O3e,He.DashboardFilterType=ZS,He.DashboardMode=hz,He.DashboardModel=wb,He.DashboardViewEditor=vz,He.DashboardViewRender=gb,He.EViewComponentType=Xt,He.FilterModel=JS,He.FiltersModel=_z,He.FullScreenPanelContext=v1,He.LayoutStateContext=ss,He.ModelContextProvider=a1,He.Panel=vb,He.PanelContextProvider=m1,He.PanelModel=Bz,He.PanelsModel=Lz,He.QueriesModel=kz,He.QueryModel=Iz,He.ReadOnlyDashboard=R3e,He.SQLSnippetModel=Pz,He.SQLSnippetsModel=Fz,He.ViewComponentTypeBackground=mz,He.ViewComponentTypeColor=VEe,He.ViewComponentTypeName=LEe,He.ViewModel=Uz,He.ViewsModel=Wz,He.applyPartialDashboard=ZNe,He.createDashboardModel=aD,He.createDashboardViewsModel=iD,He.getInitialFiltersPayload=Mz,He.getNewPanel=zz,He.getVersion=pke,He.useFullScreenPanelContext=sN,He.useModelContext=ut,He.usePanelContext=gn,He.useTopLevelServices=oD,Object.defineProperties(He,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});