PageSourceSearch

https://audiofunctions-plus.netlify.app/assets/index-D82swNdI.js

js audiofunctions-plus.netlify.app collected 2026-10-03 10:28:20 UTC 2,450,402 bytes, 741 lines download raw bytes

vendor: 4,599 bytes, lines 1-9
1function _mergeNamespaces(v,N){for(var G=0;G<N.length;G++){const z=N[G];if(typeof z!="string"&&!Array.isArray(z)){for(const q in z)if(q!=="default"&&!(q in v)){const Y=Object.getOwnPropertyDescriptor(z,q);Y&&Object.defineProperty(v,q,Y.get?Y:{enumerable:!0,get:()=>z[q]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}(function(){const N=document.createElement("link").relList;if(N&&N.supports&&N.supports("modulepreload"))return;for(const q of document.querySelectorAll('link[rel="modulepreload"]'))z(q);new MutationObserver(q=>{for(const Y of q)if(Y.type==="childList")for(const W of Y.addedNodes)W.tagName==="LINK"&&W.rel==="modulepreload"&&z(W)}).observe(document,{childList:!0,subtree:!0});function G(q){const Y={};return q.integrity&&(Y.integrity=q.integrity),q.referrerPolicy&&(Y.referrerPolicy=q.referrerPolicy),q.crossOrigin==="use-credentials"?Y.credentials="include":q.crossOrigin==="anonymous"?Y.credentials="omit":Y.credentials="same-origin",Y}function z(q){if(q.ep)return;q.ep=!0;const Y=G(q);fetch(q.href,Y)}})();function getDefaultExportFromCjs(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}function getAugmentedNamespace(v){if(Object.prototype.hasOwnProperty.call(v,"__esModule"))return v;var N=v.default;if(typeof N=="function"){var G=function z(){return this instanceof z?Reflect.construct(N,arguments,this.constructor):N.apply(this,arguments)};G.prototype=N.prototype}else G={};return Object.defineProperty(G,"__esModule",{value:!0}),Object.keys(v).forEach(function(z){var q=Object.getOwnPropertyDescriptor(v,z);Object.defineProperty(G,z,q.get?q:{enumerable:!0,get:function(){return v[z]}})}),G}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var hasRequiredReact_production_min;function requireReact_production_min(){if(hasRequiredReact_production_min)return react_production_min;hasRequiredReact_production_min=1;var v=Symbol.for("react.element"),N=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),Y=Symbol.for("react.provider"),W=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),se=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),ce=Symbol.iterator;function pe(dt){return dt===null||typeof dt!="object"?null:(dt=ce&&dt[ce]||dt["@@iterator"],typeof dt=="function"?dt:null)}var ge={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ve=Object.assign,be={};function Ee(dt,xt,ft){this.props=dt,this.context=xt,this.refs=be,this.updater=ft||ge}Ee.prototype.isReactComponent={},Ee.prototype.setState=function(dt,xt){if(typeof dt!="object"&&typeof dt!="function"&&dt!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,dt,xt,"setState")},Ee.prototype.forceUpdate=function(dt){this.updater.enqueueForceUpdate(this,dt,"forceUpdate")};function Pe(){}Pe.prototype=Ee.prototype;function Je(dt,xt,ft){this.props=dt,this.context=xt,this.refs=be,this.updater=ft||ge}var Ce=Je.prototype=new Pe;Ce.constructor=Je,ve(Ce,Ee.prototype),Ce.isPureReactComponent=!0;var Ve=Array.isArray,Re=Object.prototype.hasOwnProperty,qe={current:null},et={key:!0,ref:!0,__self:!0,__source:!0};function Ze(dt,xt,ft){var Et,Ct={},Dt=null,Gt=null;if(xt!=null)for(Et in xt.ref!==void 0&&(Gt=xt.ref),xt.key!==void 0&&(Dt=""+xt.key),xt)Re.call(xt,Et)&&!et.hasOwnProperty(Et)&&(Ct[Et]=xt[Et]);var Ot=arguments.length-2;if(Ot===1)Ct.children=ft;else if(1<Ot){for(var It=Array(Ot),Bt=0;Bt<Ot;Bt++)It[Bt]=arguments[Bt+2];Ct.children=It}if(dt&&dt.defaultProps)for(Et in Ot=dt.defaultProps,Ot)Ct[Et]===void 0&&(Ct[Et]=Ot[Et]);return{$$typeof:v,type:dt,key:Dt,ref:Gt,props:Ct,_owner:qe.current}}function tt(dt,xt){return{$$typeof:v,type:dt.type,key:xt,ref:dt.ref,props:dt.props,_owner:dt._owner}}function Ke(dt){return typeof dt=="object"&&dt!==null&&dt.$$typeof===v}function rt(dt){var xt={"=":"=0",":":"=2"};return"$"+dt.replace(/[=:]/g,function(ft){return xt[ft]})}var it=/\/+/g;function ot(dt,xt){return typeof dt=="object"&&dt!==null&&dt.key!=null?rt(""+dt.key):xt.toString(36)}function ut(dt,xt,ft,Et,Ct){var Dt=typeof dt;
vendor: 9,446 bytes, lines 9-25
9(Dt==="undefined"||Dt==="boolean")&&(dt=null);var Gt=!1;if(dt===null)Gt=!0;else switch(Dt){case"string":case"number":Gt=!0;break;case"object":switch(dt.$$typeof){case v:case N:Gt=!0}}if(Gt)return Gt=dt,Ct=Ct(Gt),dt=Et===""?"."+ot(Gt,0):Et,Ve(Ct)?(ft="",dt!=null&&(ft=dt.replace(it,"$&/")+"/"),ut(Ct,xt,ft,"",function(Bt){return Bt})):Ct!=null&&(Ke(Ct)&&(Ct=tt(Ct,ft+(!Ct.key||Gt&&Gt.key===Ct.key?"":(""+Ct.key).replace(it,"$&/")+"/")+dt)),xt.push(Ct)),1;if(Gt=0,Et=Et===""?".":Et+":",Ve(dt))for(var Ot=0;Ot<dt.length;Ot++){Dt=dt[Ot];var It=Et+ot(Dt,Ot);Gt+=ut(Dt,xt,ft,It,Ct)}else if(It=pe(dt),typeof It=="function")for(dt=It.call(dt),Ot=0;!(Dt=dt.next()).done;)Dt=Dt.value,It=Et+ot(Dt,Ot++),Gt+=ut(Dt,xt,ft,It,Ct);else if(Dt==="object")throw xt=String(dt),Error("Objects are not valid as a React child (found: "+(xt==="[object Object]"?"object with keys {"+Object.keys(dt).join(", ")+"}":xt)+"). If you meant to render a collection of children, use an array instead.");return Gt}function ct(dt,xt,ft){if(dt==null)return dt;var Et=[],Ct=0;return ut(dt,Et,"","",function(Dt){return xt.call(ft,Dt,Ct++)}),Et}function at(dt){if(dt._status===-1){var xt=dt._result;xt=xt(),xt.then(function(ft){(dt._status===0||dt._status===-1)&&(dt._status=1,dt._result=ft)},function(ft){(dt._status===0||dt._status===-1)&&(dt._status=2,dt._result=ft)}),dt._status===-1&&(dt._status=0,dt._result=xt)}if(dt._status===1)return dt._result.default;throw dt._result}var st={current:null},pt={transition:null},lt={ReactCurrentDispatcher:st,ReactCurrentBatchConfig:pt,ReactCurrentOwner:qe};function vt(){throw Error("act(...) is not supported in production builds of React.")}return react_production_min.Children={map:ct,forEach:function(dt,xt,ft){ct(dt,function(){xt.apply(this,arguments)},ft)},count:function(dt){var xt=0;return ct(dt,function(){xt++}),xt},toArray:function(dt){return ct(dt,function(xt){return xt})||[]},only:function(dt){if(!Ke(dt))throw Error("React.Children.only expected to receive a single React element child.");return dt}},react_production_min.Component=Ee,react_production_min.Fragment=G,react_production_min.Profiler=q,react_production_min.PureComponent=Je,react_production_min.StrictMode=z,react_production_min.Suspense=ne,react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lt,react_production_min.act=vt,react_production_min.cloneElement=function(dt,xt,ft){if(dt==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+dt+".");var Et=ve({},dt.props),Ct=dt.key,Dt=dt.ref,Gt=dt._owner;if(xt!=null){if(xt.ref!==void 0&&(Dt=xt.ref,Gt=qe.current),xt.key!==void 0&&(Ct=""+xt.key),dt.type&&dt.type.defaultProps)var Ot=dt.type.defaultProps;for(It in xt)Re.call(xt,It)&&!et.hasOwnProperty(It)&&(Et[It]=xt[It]===void 0&&Ot!==void 0?Ot[It]:xt[It])}var It=arguments.length-2;if(It===1)Et.children=ft;else if(1<It){Ot=Array(It);for(var Bt=0;Bt<It;Bt++)Ot[Bt]=arguments[Bt+2];Et.children=Ot}return{$$typeof:v,type:dt.type,key:Ct,ref:Dt,props:Et,_owner:Gt}},react_production_min.createContext=function(dt){return dt={$$typeof:W,_currentValue:dt,_currentValue2:dt,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},dt.Provider={$$typeof:Y,_context:dt},dt.Consumer=dt},react_production_min.createElement=Ze,react_production_min.createFactory=function(dt){var xt=Ze.bind(null,dt);return xt.type=dt,xt},react_production_min.createRef=function(){return{current:null}},react_production_min.forwardRef=function(dt){return{$$typeof:ie,render:dt}},react_production_min.isValidElement=Ke,react_production_min.lazy=function(dt){return{$$typeof:ae,_payload:{_status:-1,_result:dt},_init:at}},react_production_min.memo=function(dt,xt){return{$$typeof:se,type:dt,compare:xt===void 0?null:xt}},react_production_min.startTransition=function(dt){var xt=pt.transition;pt.transition={};try{dt()}finally{pt.transition=xt}},react_production_min.unstable_act=vt,react_production_min.useCallback=function(dt,xt){return st.current.useCallback(dt,xt)},react_production_min.useContext=function(dt){return st.current.useContext(dt)},react_production_min.useDebugValue=function(){},react_production_min.useDeferredValue=function(dt){return st.current.useDeferredValue(dt)},react_production_min.useEffect=function(dt,xt){return st.current.useEffect(dt,xt)},react_production_min.useId=function(){return st.current.useId()},react_production_min.useImperativeHandle=function(dt,xt,ft){return st.current.useImperativeHandle(dt,xt,ft)},react_production_min.useInsertionEffect=function(dt,xt){return st.current.useInsertionEffect(dt,xt)},react_production_min.useLayoutEffect=function(dt,xt){return st.current.useLayoutEffect(dt,xt)},react_production_min.useMemo=function(dt,xt){return st.current.useMemo(dt,xt)},react_production_min.useReducer=function(dt,xt,ft){return st.current.useReducer(dt,xt,ft)},react_production_min.useRef=function(dt){return st.current.useRef(dt)},react_production_min.useState=function(dt){return st.current.useState(dt)},react_production_min.useSyncExternalStore=function(dt,xt,ft){return st.current.useSyncExternalStore(dt,xt,ft)},react_production_min.useTransition=function(){return st.current.useTransition()},react_production_min.version="18.3.1",react_production_min}var hasRequiredReact;function requireReact(){return hasRequiredReact||(hasRequiredReact=1,react.exports=requireReact_production_min()),react.exports}/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var hasRequiredReactJsxRuntime_production_min;function requireReactJsxRuntime_production_min(){if(hasRequiredReactJsxRuntime_production_min)return reactJsxRuntime_production_min;hasRequiredReactJsxRuntime_production_min=1;var v=requireReact(),N=Symbol.for("react.element"),G=Symbol.for("react.fragment"),z=Object.prototype.hasOwnProperty,q=v.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Y={key:!0,ref:!0,__self:!0,__source:!0};function W(ie,ne,se){var ae,ce={},pe=null,ge=null;se!==void 0&&(pe=""+se),ne.key!==void 0&&(pe=""+ne.key),ne.ref!==void 0&&(ge=ne.ref);for(ae in ne)z.call(ne,ae)&&!Y.hasOwnProperty(ae)&&(ce[ae]=ne[ae]);if(ie&&ie.defaultProps)for(ae in ne=ie.defaultProps,ne)ce[ae]===void 0&&(ce[ae]=ne[ae]);return{$$typeof:N,type:ie,key:pe,ref:ge,props:ce,_owner:q.current}}return reactJsxRuntime_production_min.Fragment=G,reactJsxRuntime_production_min.jsx=W,reactJsxRuntime_production_min.jsxs=W,reactJsxRuntime_production_min}var hasRequiredJsxRuntime;function requireJsxRuntime(){return hasRequiredJsxRuntime||(hasRequiredJsxRuntime=1,jsxRuntime.exports=requireReactJsxRuntime_production_min()),jsxRuntime.exports}var jsxRuntimeExports=requireJsxRuntime(),reactExports=requireReact();const U$3=getDefaultExportFromCjs(reactExports),t$4=_mergeNamespaces({__proto__:null,default:U$3},[reactExports]);var client={},reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */var hasRequiredScheduler_production_min;function requireScheduler_production_min(){return hasRequiredScheduler_production_min||(hasRequiredScheduler_production_min=1,function(v){function N(pt,lt){var vt=pt.length;pt.push(lt);e:for(;0<vt;){var dt=vt-1>>>1,xt=pt[dt];if(0<q(xt,lt))pt[dt]=lt,pt[vt]=xt,vt=dt;else break e}}function G(pt){return pt.length===0?null:pt[0]}function z(pt){if(pt.length===0)return null;var lt=pt[0],vt=pt.pop();if(vt!==lt){pt[0]=vt;e:for(var dt=0,xt=pt.length,ft=xt>>>1;dt<ft;){var Et=2*(dt+1)-1,Ct=pt[Et],Dt=Et+1,Gt=pt[Dt];if(0>q(Ct,vt))Dt<xt&&0>q(Gt,Ct)?(pt[dt]=Gt,pt[Dt]=vt,dt=Dt):(pt[dt]=Ct,pt[Et]=vt,dt=Et);else if(Dt<xt&&0>q(Gt,vt))pt[dt]=Gt,pt[Dt]=vt,dt=Dt;else break e}}return lt}function q(pt,lt){var vt=pt.sortIndex-lt.sortIndex;return vt!==0?vt:pt.id-lt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var Y=performance;v.unstable_now=function(){return Y.now()}}else{var W=Date,ie=W.now();v.unstable_now=function(){return W.now()-ie}}var ne=[],se=[],ae=1,ce=null,pe=3,ge=!1,ve=!1,be=!1,Ee=typeof setTimeout=="function"?setTimeout:null,Pe=typeof clearTimeout=="function"?clearTimeout:null,Je=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Ce(pt){for(var lt=G(se);lt!==null;){if(lt.callback===null)z(se);else if(lt.startTime<=pt)z(se),lt.sortIndex=lt.expirationTime,N(ne,lt);else break;lt=G(se)}}function Ve(pt){if(be=!1,Ce(pt),!ve)if(G(ne)!==null)ve=!0,at(Re);else{var lt=G(se);lt!==null&&st(Ve,lt.startTime-pt)}}function Re(pt,lt){ve=!1,be&&(be=!1,Pe(Ze),Ze=-1),ge=!0;var vt=pe;try{for(Ce(lt),ce=G(ne);ce!==null&&(!(ce.expirationTime>lt)||pt&&!rt());){var dt=ce.callback;if(typeof dt=="function"){ce.callback=null,pe=ce.priorityLevel;var xt=dt(ce.expirationTime<=lt);lt=v.unstable_now(),typeof xt=="function"?ce.callback=xt:ce===G(ne)&&z(ne),Ce(lt)}else z(ne);ce=G(ne)}if(ce!==null)var ft=!0;else{var Et=G(se);Et!==null&&st(Ve,Et.startTime-lt),ft=!1}return ft}finally{ce=null,pe=vt,ge=!1}}
vendor: 4,282 bytes, lines 25-33
25var qe=!1,et=null,Ze=-1,tt=5,Ke=-1;function rt(){return!(v.unstable_now()-Ke<tt)}function it(){if(et!==null){var pt=v.unstable_now();Ke=pt;var lt=!0;try{lt=et(!0,pt)}finally{lt?ot():(qe=!1,et=null)}}else qe=!1}var ot;if(typeof Je=="function")ot=function(){Je(it)};else if(typeof MessageChannel<"u"){var ut=new MessageChannel,ct=ut.port2;ut.port1.onmessage=it,ot=function(){ct.postMessage(null)}}else ot=function(){Ee(it,0)};function at(pt){et=pt,qe||(qe=!0,ot())}function st(pt,lt){Ze=Ee(function(){pt(v.unstable_now())},lt)}v.unstable_IdlePriority=5,v.unstable_ImmediatePriority=1,v.unstable_LowPriority=4,v.unstable_NormalPriority=3,v.unstable_Profiling=null,v.unstable_UserBlockingPriority=2,v.unstable_cancelCallback=function(pt){pt.callback=null},v.unstable_continueExecution=function(){ve||ge||(ve=!0,at(Re))},v.unstable_forceFrameRate=function(pt){0>pt||125<pt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):tt=0<pt?Math.floor(1e3/pt):5},v.unstable_getCurrentPriorityLevel=function(){return pe},v.unstable_getFirstCallbackNode=function(){return G(ne)},v.unstable_next=function(pt){switch(pe){case 1:case 2:case 3:var lt=3;break;default:lt=pe}var vt=pe;pe=lt;try{return pt()}finally{pe=vt}},v.unstable_pauseExecution=function(){},v.unstable_requestPaint=function(){},v.unstable_runWithPriority=function(pt,lt){switch(pt){case 1:case 2:case 3:case 4:case 5:break;default:pt=3}var vt=pe;pe=pt;try{return lt()}finally{pe=vt}},v.unstable_scheduleCallback=function(pt,lt,vt){var dt=v.unstable_now();switch(typeof vt=="object"&&vt!==null?(vt=vt.delay,vt=typeof vt=="number"&&0<vt?dt+vt:dt):vt=dt,pt){case 1:var xt=-1;break;case 2:xt=250;break;case 5:xt=1073741823;break;case 4:xt=1e4;break;default:xt=5e3}return xt=vt+xt,pt={id:ae++,callback:lt,priorityLevel:pt,startTime:vt,expirationTime:xt,sortIndex:-1},vt>dt?(pt.sortIndex=vt,N(se,pt),G(ne)===null&&pt===G(se)&&(be?(Pe(Ze),Ze=-1):be=!0,st(Ve,vt-dt))):(pt.sortIndex=xt,N(ne,pt),ve||ge||(ve=!0,at(Re))),pt},v.unstable_shouldYield=rt,v.unstable_wrapCallback=function(pt){var lt=pe;return function(){var vt=pe;pe=lt;try{return pt.apply(this,arguments)}finally{pe=vt}}}}(scheduler_production_min)),scheduler_production_min}var hasRequiredScheduler;function requireScheduler(){return hasRequiredScheduler||(hasRequiredScheduler=1,scheduler.exports=requireScheduler_production_min()),scheduler.exports}/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var hasRequiredReactDom_production_min;function requireReactDom_production_min(){if(hasRequiredReactDom_production_min)return reactDom_production_min;hasRequiredReactDom_production_min=1;var v=requireReact(),N=requireScheduler();function G(xe){for(var Xe="https://reactjs.org/docs/error-decoder.html?invariant="+xe,Qe=1;Qe<arguments.length;Qe++)Xe+="&args[]="+encodeURIComponent(arguments[Qe]);return"Minified React error #"+xe+"; visit "+Xe+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var z=new Set,q={};function Y(xe,Xe){W(xe,Xe),W(xe+"Capture",Xe)}function W(xe,Xe){for(q[xe]=Xe,xe=0;xe<Xe.length;xe++)z.add(Xe[xe])}var ie=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ne=Object.prototype.hasOwnProperty,se=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ae={},ce={};function pe(xe){return ne.call(ce,xe)?!0:ne.call(ae,xe)?!1:se.test(xe)?ce[xe]=!0:(ae[xe]=!0,!1)}function ge(xe,Xe,Qe,nt){if(Qe!==null&&Qe.type===0)return!1;switch(typeof Xe){case"function":case"symbol":return!0;case"boolean":return nt?!1:Qe!==null?!Qe.acceptsBooleans:(xe=xe.toLowerCase().slice(0,5),xe!=="data-"&&xe!=="aria-");default:return!1}}function ve(xe,Xe,Qe,nt){if(Xe===null||typeof Xe>"u"||ge(xe,Xe,Qe,nt))return!0;
vendor: 9,438 bytes, lines 33-37
33if(nt)return!1;if(Qe!==null)switch(Qe.type){case 3:return!Xe;case 4:return Xe===!1;case 5:return isNaN(Xe);case 6:return isNaN(Xe)||1>Xe}return!1}function be(xe,Xe,Qe,nt,ht,mt,St){this.acceptsBooleans=Xe===2||Xe===3||Xe===4,this.attributeName=nt,this.attributeNamespace=ht,this.mustUseProperty=Qe,this.propertyName=xe,this.type=Xe,this.sanitizeURL=mt,this.removeEmptyString=St}var Ee={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(xe){Ee[xe]=new be(xe,0,!1,xe,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(xe){var Xe=xe[0];Ee[Xe]=new be(Xe,1,!1,xe[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(xe){Ee[xe]=new be(xe,2,!1,xe.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(xe){Ee[xe]=new be(xe,2,!1,xe,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(xe){Ee[xe]=new be(xe,3,!1,xe.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(xe){Ee[xe]=new be(xe,3,!0,xe,null,!1,!1)}),["capture","download"].forEach(function(xe){Ee[xe]=new be(xe,4,!1,xe,null,!1,!1)}),["cols","rows","size","span"].forEach(function(xe){Ee[xe]=new be(xe,6,!1,xe,null,!1,!1)}),["rowSpan","start"].forEach(function(xe){Ee[xe]=new be(xe,5,!1,xe.toLowerCase(),null,!1,!1)});var Pe=/[\-:]([a-z])/g;function Je(xe){return xe[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(xe){var Xe=xe.replace(Pe,Je);Ee[Xe]=new be(Xe,1,!1,xe,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(xe){var Xe=xe.replace(Pe,Je);Ee[Xe]=new be(Xe,1,!1,xe,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(xe){var Xe=xe.replace(Pe,Je);Ee[Xe]=new be(Xe,1,!1,xe,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(xe){Ee[xe]=new be(xe,1,!1,xe.toLowerCase(),null,!1,!1)}),Ee.xlinkHref=new be("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(xe){Ee[xe]=new be(xe,1,!1,xe.toLowerCase(),null,!0,!0)});function Ce(xe,Xe,Qe,nt){var ht=Ee.hasOwnProperty(Xe)?Ee[Xe]:null;(ht!==null?ht.type!==0:nt||!(2<Xe.length)||Xe[0]!=="o"&&Xe[0]!=="O"||Xe[1]!=="n"&&Xe[1]!=="N")&&(ve(Xe,Qe,ht,nt)&&(Qe=null),nt||ht===null?pe(Xe)&&(Qe===null?xe.removeAttribute(Xe):xe.setAttribute(Xe,""+Qe)):ht.mustUseProperty?xe[ht.propertyName]=Qe===null?ht.type===3?!1:"":Qe:(Xe=ht.attributeName,nt=ht.attributeNamespace,Qe===null?xe.removeAttribute(Xe):(ht=ht.type,Qe=ht===3||ht===4&&Qe===!0?"":""+Qe,nt?xe.setAttributeNS(nt,Xe,Qe):xe.setAttribute(Xe,Qe))))}var Ve=v.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Re=Symbol.for("react.element"),qe=Symbol.for("react.portal"),et=Symbol.for("react.fragment"),Ze=Symbol.for("react.strict_mode"),tt=Symbol.for("react.profiler"),Ke=Symbol.for("react.provider"),rt=Symbol.for("react.context"),it=Symbol.for("react.forward_ref"),ot=Symbol.for("react.suspense"),ut=Symbol.for("react.suspense_list"),ct=Symbol.for("react.memo"),at=Symbol.for("react.lazy"),st=Symbol.for("react.offscreen"),pt=Symbol.iterator;function lt(xe){return xe===null||typeof xe!="object"?null:(xe=pt&&xe[pt]||xe["@@iterator"],typeof xe=="function"?xe:null)}var vt=Object.assign,dt;function xt(xe){if(dt===void 0)try{throw Error()}catch(Qe){var Xe=Qe.stack.trim().match(/\n( *(at )?)/);dt=Xe&&Xe[1]||""}return`
34`+dt+xe}var ft=!1;function Et(xe,Xe){if(!xe||ft)return"";ft=!0;var Qe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(Xe)if(Xe=function(){throw Error()},Object.defineProperty(Xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Xe,[])}catch(rr){var nt=rr}Reflect.construct(xe,[],Xe)}else{try{Xe.call()}catch(rr){nt=rr}xe.call(Xe.prototype)}else{try{throw Error()}catch(rr){nt=rr}xe()}}catch(rr){if(rr&&nt&&typeof rr.stack=="string"){for(var ht=rr.stack.split(`
35`),mt=nt.stack.split(`
36`),St=ht.length-1,Jt=mt.length-1;1<=St&&0<=Jt&&ht[St]!==mt[Jt];)Jt--;for(;1<=St&&0<=Jt;St--,Jt--)if(ht[St]!==mt[Jt]){if(St!==1||Jt!==1)do if(St--,Jt--,0>Jt||ht[St]!==mt[Jt]){var Lt=`
37`+ht[St].replace(" at new "," at ");return xe.displayName&&Lt.includes("<anonymous>")&&(Lt=Lt.replace("<anonymous>",xe.displayName)),Lt}while(1<=St&&0<=Jt);break}}}finally{ft=!1,Error.prepareStackTrace=Qe}return(xe=xe?xe.displayName||xe.name:"")?xt(xe):""}function Ct(xe){switch(xe.tag){case 5:return xt(xe.type);case 16:return xt("Lazy");case 13:return xt("Suspense");case 19:return xt("SuspenseList");case 0:case 2:case 15:return xe=Et(xe.type,!1),xe;case 11:return xe=Et(xe.type.render,!1),xe;case 1:return xe=Et(xe.type,!0),xe;default:return""}}function Dt(xe){if(xe==null)return null;if(typeof xe=="function")return xe.displayName||xe.name||null;if(typeof xe=="string")return xe;switch(xe){case et:return"Fragment";case qe:return"Portal";case tt:return"Profiler";case Ze:return"StrictMode";case ot:return"Suspense";case ut:return"SuspenseList"}if(typeof xe=="object")switch(xe.$$typeof){case rt:return(xe.displayName||"Context")+".Consumer";case Ke:return(xe._context.displayName||"Context")+".Provider";case it:var Xe=xe.render;return xe=xe.displayName,xe||(xe=Xe.displayName||Xe.name||"",xe=xe!==""?"ForwardRef("+xe+")":"ForwardRef"),xe;case ct:return Xe=xe.displayName||null,Xe!==null?Xe:Dt(xe.type)||"Memo";case at:Xe=xe._payload,xe=xe._init;try{return Dt(xe(Xe))}catch{}}return null}function Gt(xe){var Xe=xe.type;switch(xe.tag){case 24:return"Cache";case 9:return(Xe.displayName||"Context")+".Consumer";case 10:return(Xe._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return xe=Xe.render,xe=xe.displayName||xe.name||"",Xe.displayName||(xe!==""?"ForwardRef("+xe+")":"ForwardRef");case 7:return"Fragment";case 5:return Xe;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Dt(Xe);case 8:return Xe===Ze?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof Xe=="function")return Xe.displayName||Xe.name||null;if(typeof Xe=="string")return Xe}return null}function Ot(xe){switch(typeof xe){case"boolean":case"number":case"string":case"undefined":return xe;case"object":return xe;default:return""}}function It(xe){var Xe=xe.type;return(xe=xe.nodeName)&&xe.toLowerCase()==="input"&&(Xe==="checkbox"||Xe==="radio")}function Bt(xe){var Xe=It(xe)?"checked":"value",Qe=Object.getOwnPropertyDescriptor(xe.constructor.prototype,Xe),nt=""+xe[Xe];if(!xe.hasOwnProperty(Xe)&&typeof Qe<"u"&&typeof Qe.get=="function"&&typeof Qe.set=="function"){var ht=Qe.get,mt=Qe.set;return Object.defineProperty(xe,Xe,{configurable:!0,get:function(){return ht.call(this)},set:function(St){nt=""+St,mt.call(this,St)}}),Object.defineProperty(xe,Xe,{enumerable:Qe.enumerable}),{getValue:function(){return nt},setValue:function(St){nt=""+St},stopTracking:function(){xe._valueTracker=null,delete xe[Xe]}}}}function Ht(xe){xe._valueTracker||(xe._valueTracker=Bt(xe))}function ir(xe){if(!xe)return!1;var Xe=xe._valueTracker;if(!Xe)return!0;var Qe=Xe.getValue(),nt="";return xe&&(nt=It(xe)?xe.checked?"true":"false":xe.value),xe=nt,xe!==Qe?(Xe.setValue(xe),!0):!1}function zt(xe){if(xe=xe||(typeof document<"u"?document:void 0),typeof xe>"u")return null;try{return xe.activeElement||xe.body}catch{return xe.body}}function tr(xe,Xe){var Qe=Xe.checked;return vt({},Xe,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:Qe??xe._wrapperState.initialChecked})}function bt(xe,Xe){var Qe=Xe.defaultValue==null?"":Xe.defaultValue,nt=Xe.checked!=null?Xe.checked:Xe.defaultChecked;Qe=Ot(Xe.value!=null?Xe.value:Qe),xe._wrapperState={initialChecked:nt,initialValue:Qe,controlled:Xe.type==="checkbox"||Xe.type==="radio"?Xe.checked!=null:Xe.value!=null}}
vendor: 4,959 bytes, line 37
37function _t(xe,Xe){Xe=Xe.checked,Xe!=null&&Ce(xe,"checked",Xe,!1)}function Xt(xe,Xe){_t(xe,Xe);var Qe=Ot(Xe.value),nt=Xe.type;if(Qe!=null)nt==="number"?(Qe===0&&xe.value===""||xe.value!=Qe)&&(xe.value=""+Qe):xe.value!==""+Qe&&(xe.value=""+Qe);else if(nt==="submit"||nt==="reset"){xe.removeAttribute("value");return}Xe.hasOwnProperty("value")?$t(xe,Xe.type,Qe):Xe.hasOwnProperty("defaultValue")&&$t(xe,Xe.type,Ot(Xe.defaultValue)),Xe.checked==null&&Xe.defaultChecked!=null&&(xe.defaultChecked=!!Xe.defaultChecked)}function At(xe,Xe,Qe){if(Xe.hasOwnProperty("value")||Xe.hasOwnProperty("defaultValue")){var nt=Xe.type;if(!(nt!=="submit"&&nt!=="reset"||Xe.value!==void 0&&Xe.value!==null))return;Xe=""+xe._wrapperState.initialValue,Qe||Xe===xe.value||(xe.value=Xe),xe.defaultValue=Xe}Qe=xe.name,Qe!==""&&(xe.name=""),xe.defaultChecked=!!xe._wrapperState.initialChecked,Qe!==""&&(xe.name=Qe)}function $t(xe,Xe,Qe){(Xe!=="number"||zt(xe.ownerDocument)!==xe)&&(Qe==null?xe.defaultValue=""+xe._wrapperState.initialValue:xe.defaultValue!==""+Qe&&(xe.defaultValue=""+Qe))}var Pt=Array.isArray;function kt(xe,Xe,Qe,nt){if(xe=xe.options,Xe){Xe={};for(var ht=0;ht<Qe.length;ht++)Xe["$"+Qe[ht]]=!0;for(Qe=0;Qe<xe.length;Qe++)ht=Xe.hasOwnProperty("$"+xe[Qe].value),xe[Qe].selected!==ht&&(xe[Qe].selected=ht),ht&&nt&&(xe[Qe].defaultSelected=!0)}else{for(Qe=""+Ot(Qe),Xe=null,ht=0;ht<xe.length;ht++){if(xe[ht].value===Qe){xe[ht].selected=!0,nt&&(xe[ht].defaultSelected=!0);return}Xe!==null||xe[ht].disabled||(Xe=xe[ht])}Xe!==null&&(Xe.selected=!0)}}function jt(xe,Xe){if(Xe.dangerouslySetInnerHTML!=null)throw Error(G(91));return vt({},Xe,{value:void 0,defaultValue:void 0,children:""+xe._wrapperState.initialValue})}function wt(xe,Xe){var Qe=Xe.value;if(Qe==null){if(Qe=Xe.children,Xe=Xe.defaultValue,Qe!=null){if(Xe!=null)throw Error(G(92));if(Pt(Qe)){if(1<Qe.length)throw Error(G(93));Qe=Qe[0]}Xe=Qe}Xe==null&&(Xe=""),Qe=Xe}xe._wrapperState={initialValue:Ot(Qe)}}function Mt(xe,Xe){var Qe=Ot(Xe.value),nt=Ot(Xe.defaultValue);Qe!=null&&(Qe=""+Qe,Qe!==xe.value&&(xe.value=Qe),Xe.defaultValue==null&&xe.defaultValue!==Qe&&(xe.defaultValue=Qe)),nt!=null&&(xe.defaultValue=""+nt)}function Tt(xe){var Xe=xe.textContent;Xe===xe._wrapperState.initialValue&&Xe!==""&&Xe!==null&&(xe.value=Xe)}function Rt(xe){switch(xe){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ft(xe,Xe){return xe==null||xe==="http://www.w3.org/1999/xhtml"?Rt(Xe):xe==="http://www.w3.org/2000/svg"&&Xe==="foreignObject"?"http://www.w3.org/1999/xhtml":xe}var Ut,Zt=function(xe){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(Xe,Qe,nt,ht){MSApp.execUnsafeLocalFunction(function(){return xe(Xe,Qe,nt,ht)})}:xe}(function(xe,Xe){if(xe.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in xe)xe.innerHTML=Xe;else{for(Ut=Ut||document.createElement("div"),Ut.innerHTML="<svg>"+Xe.valueOf().toString()+"</svg>",Xe=Ut.firstChild;xe.firstChild;)xe.removeChild(xe.firstChild);for(;Xe.firstChild;)xe.appendChild(Xe.firstChild)}});function Wt(xe,Xe){if(Xe){var Qe=xe.firstChild;if(Qe&&Qe===xe.lastChild&&Qe.nodeType===3){Qe.nodeValue=Xe;return}}xe.textContent=Xe}var qt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Yt=["Webkit","ms","Moz","O"];Object.keys(qt).forEach(function(xe){Yt.forEach(function(Xe){Xe=Xe+xe.charAt(0).toUpperCase()+xe.substring(1),qt[Xe]=qt[xe]})});function or(xe,Xe,Qe){return Xe==null||typeof Xe=="boolean"||Xe===""?"":Qe||typeof Xe!="number"||Xe===0||qt.hasOwnProperty(xe)&&qt[xe]?(""+Xe).trim():Xe+"px"}function hr(xe,Xe){xe=xe.style;for(var Qe in Xe)if(Xe.hasOwnProperty(Qe)){var nt=Qe.indexOf("--")===0,ht=or(Qe,Xe[Qe],nt);Qe==="float"&&(Qe="cssFloat"),nt?xe.setProperty(Qe,ht):xe[Qe]=ht}}var sr=vt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nr(xe,Xe){if(Xe){if(sr[xe]&&(Xe.children!=null||Xe.dangerouslySetInnerHTML!=null))throw Error(G(137,xe));if(Xe.dangerouslySetInnerHTML!=null){if(Xe.children!=null)throw Error(G(60));if(typeof Xe.dangerouslySetInnerHTML!="object"||!("__html"in Xe.dangerouslySetInnerHTML))throw Error(G(61))}if(Xe.style!=null&&typeof Xe.style!="object")throw Error(G(62))}}function gt(xe,Xe){if(xe.indexOf("-")===-1)return typeof Xe.is=="str
37ing";switch(xe){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Nt=null;function Qt(xe){return xe=xe.target||xe.srcElement||window,xe.correspondingUseElement&&(xe=xe.correspondingUseElement),xe.nodeType===3?xe.parentNode:xe}var ar=null,vr=null,xr=null;function Er(xe){if(xe=xs(xe)){if(typeof ar!="function")throw Error(G(280));var Xe=xe.stateNode;Xe&&(Xe=so(Xe),ar(xe.stateNode,xe.type,Xe))}}function ti(xe){vr?xr?xr.push(xe):xr=[xe]:vr=xe}function Ui(){if(vr){var xe=vr,Xe=xr;if(xr=vr=null,Er(xe),Xe)for(xe=0;xe<Xe.length;xe++)Er(Xe[xe])}}function qi(xe,Xe){return xe(Xe)}function Dn(){}var mn=!1;function kr(xe,Xe,Qe){if(mn)return xe(Xe,Qe);mn=!0;try{return qi(xe,Xe,Qe)}finally{mn=!1,(vr!==null||xr!==null)&&(Dn(),Ui())}}function Zr(xe,Xe){var Qe=xe.stateNode;if(Qe===null)return null;var nt=so(Qe);if(nt===null)return null;Qe=nt[Xe];e:switch(Xe){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(nt=!nt.disabled)||(xe=xe.type,nt=!(xe==="button"||xe==="input"||xe==="select"||xe==="textarea")),xe=!nt;break e;default:xe=!1}if(xe)return null;if(Qe&&typeof Qe!="function")throw Error(G(231,Xe,typeof Qe));return Qe}var Fr=!1;if(ie)try{var xi={};Object.defineProperty(xi,"passive",{get:function(){Fr=!0}}),window.addEventListener("test",xi,xi),window.removeEventListener("test",xi,xi)}catch{Fr=!1}function Ai(xe,Xe,Qe,nt,ht,mt,St,Jt,Lt){var rr=Array.prototype.slice.call(arguments,3);try{Xe.apply(Qe,rr)}catch(ur){this.onError(ur)}}var hi=!1,Ur=null,Ri=!1,Mi=null,gn={onError:function(xe){hi=!0,Ur=xe}};function $i(xe,Xe,Qe,nt,ht,mt,St,Jt,Lt){hi=!1,Ur=null,Ai.apply(gn,arguments)}function Vo(xe,Xe,Qe,nt,ht,mt,St,Jt,Lt){if($i.apply(this,arguments),hi){if(hi){var rr=Ur;hi=!1,Ur=null}else throw Error(G(198));Ri||(Ri=!0,Mi=rr)}}function ki(xe){var Xe=xe,Qe=xe;if(xe.alternate)for(;Xe.return;)Xe=Xe.return;else{xe=Xe;do Xe=xe,(Xe.flags&4098)!==0&&(Qe=Xe.return),xe=Xe.return;while(xe)}return Xe.tag===3?Qe:null}function Gs(xe){if(xe.tag===13){var Xe=xe.memoizedState;if(Xe===null&&(xe=xe.alternate,xe!==null&&(Xe=xe.memoizedState)),Xe!==null)return Xe.dehydrated}return null}function Xs(xe){if(ki(xe)!==xe)throw Error(G(188))}function Uo(xe){var Xe=xe.alternate;if(!Xe){if(Xe=ki(xe),Xe===null)throw Error(G(188));return Xe!==xe?null:xe}for(var Qe=xe,nt=Xe;;){var ht=Qe.return;if(ht===null)break;var mt=ht.alternate;if(mt===null){if(nt=ht.return,nt!==null){Qe=nt;continue}break}if(ht.child===mt.child){for(mt=ht.child;mt;){if(mt===Qe)return Xs(ht),xe;if(mt===nt)return Xs(ht),Xe;mt=mt.sibling}throw Error(G(188))}if(Qe.return!==nt.return)Qe=ht,nt=mt;else{for(var St=!1,Jt=ht.child;Jt;){if(Jt===Qe){St=!0,Qe=ht,nt=mt;break}if(Jt===nt){St=!0,nt=ht,Qe=mt;break}Jt=Jt.sibling}if(!St){for(Jt=mt.child;Jt;){if(Jt===Qe){St=!0,Qe=mt,nt=ht;break}if(Jt===nt){St=!0,nt=mt,Qe=ht;break}Jt=Jt.sibling}if(!St)throw Error(G(189))}}if(Qe.alternate!==nt)throw Error(G(190))}if(Qe.tag!==3)throw Error(G(188));return Qe.stateNode.current===Qe?xe:Xe}function Rs(xe){return xe=Uo(xe),xe!==null?ks(xe):null}function ks(xe){if(xe.tag===5||xe.tag===6)return xe;for(xe=xe.child;xe!==null;){var Xe=ks(xe);if(Xe!==null)return Xe;xe=xe.sibling}return null}var Js=N.unstable_scheduleCallback,Is=N.unstable_cancelCallback,qo=N.unstable_shouldYield,vn=N.unstable_requestPaint,_r=N.unstable_now,qr=N.unstable_getCurrentPriorityLevel,es=N.unstable_ImmediatePriority,yn=N.unstable_UserBlockingPriority,Pi=N.unstable_NormalPriority,Yo=N.unstable_LowPriority,Ml=N.unstable_IdlePriority,Fs=null,Di=null;function rh(xe){if(Di&&typeof Di.onCommitFiberRoot=="function")try{Di.onCommitFiberRoot(Fs,xe,void 0,(xe.current.flags&128)===128)}catch{}}var bi=Math.clz32?Math.clz32:sh,ih=Math.log,nh=Math.LN2;function sh(xe){return xe>>>=0,xe===0?32:31-(ih(xe)/nh|0)|0}var Bs=64,Ls=4194304;function ts(xe){switch(xe&-xe){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return xe&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return xe&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return xe}}function js(xe,Xe){var Qe=xe.pendingLanes;if(Qe===0)return 0;var nt=0,ht=xe.suspendedLanes,mt=xe.pingedLanes,St=Qe&268435455;if(St!==0){var Jt=St&~ht;Jt!==0?nt=ts(Jt):(mt&=St,mt!==0&&(nt=ts(mt)))}else St=Qe&~ht,St!==0?nt=ts(St):mt!==0&&(nt=ts(mt));if(nt===0)return 0;if(Xe!==0&&Xe!==nt&&(Xe&ht)===0&&(ht=nt&-nt,mt=Xe&-Xe,ht>=mt||ht===16&&(mt&4194240)!==0))return Xe;if((nt&4)!==0&&(nt|=Qe&16),Xe=xe.entangledLanes,Xe!==0)for(xe=xe.entanglements,Xe&=nt;0<Xe;
vendor: 29,256 bytes, lines 37-38
37)Qe=31-bi(Xe),ht=1<<Qe,nt|=xe[Qe],Xe&=~ht;return nt}function oh(xe,Xe){switch(xe){case 1:case 2:case 4:return Xe+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return Xe+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ah(xe,Xe){for(var Qe=xe.suspendedLanes,nt=xe.pingedLanes,ht=xe.expirationTimes,mt=xe.pendingLanes;0<mt;){var St=31-bi(mt),Jt=1<<St,Lt=ht[St];Lt===-1?((Jt&Qe)===0||(Jt&nt)!==0)&&(ht[St]=oh(Jt,Xe)):Lt<=Xe&&(xe.expiredLanes|=Jt),mt&=~Jt}}function Ho(xe){return xe=xe.pendingLanes&-1073741825,xe!==0?xe:xe&1073741824?1073741824:0}function $l(){var xe=Bs;return Bs<<=1,(Bs&4194240)===0&&(Bs=64),xe}function Wo(xe){for(var Xe=[],Qe=0;31>Qe;Qe++)Xe.push(xe);return Xe}function rs(xe,Xe,Qe){xe.pendingLanes|=Xe,Xe!==536870912&&(xe.suspendedLanes=0,xe.pingedLanes=0),xe=xe.eventTimes,Xe=31-bi(Xe),xe[Xe]=Qe}function lh(xe,Xe){var Qe=xe.pendingLanes&~Xe;xe.pendingLanes=Xe,xe.suspendedLanes=0,xe.pingedLanes=0,xe.expiredLanes&=Xe,xe.mutableReadLanes&=Xe,xe.entangledLanes&=Xe,Xe=xe.entanglements;var nt=xe.eventTimes;for(xe=xe.expirationTimes;0<Qe;){var ht=31-bi(Qe),mt=1<<ht;Xe[ht]=0,nt[ht]=-1,xe[ht]=-1,Qe&=~mt}}function Ko(xe,Xe){var Qe=xe.entangledLanes|=Xe;for(xe=xe.entanglements;Qe;){var nt=31-bi(Qe),ht=1<<nt;ht&Xe|xe[nt]&Xe&&(xe[nt]|=Xe),Qe&=~ht}}var Ar=0;function Pl(xe){return xe&=-xe,1<xe?4<xe?(xe&268435455)!==0?16:536870912:4:1}var Dl,Zo,Ol,Tl,Gl,Qo=!1,zs=[],Yi=null,Hi=null,Wi=null,is=new Map,ns=new Map,Ki=[],uh="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xl(xe,Xe){switch(xe){case"focusin":case"focusout":Yi=null;break;case"dragenter":case"dragleave":Hi=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":is.delete(Xe.pointerId);break;case"gotpointercapture":case"lostpointercapture":ns.delete(Xe.pointerId)}}function ss(xe,Xe,Qe,nt,ht,mt){return xe===null||xe.nativeEvent!==mt?(xe={blockedOn:Xe,domEventName:Qe,eventSystemFlags:nt,nativeEvent:mt,targetContainers:[ht]},Xe!==null&&(Xe=xs(Xe),Xe!==null&&Zo(Xe)),xe):(xe.eventSystemFlags|=nt,Xe=xe.targetContainers,ht!==null&&Xe.indexOf(ht)===-1&&Xe.push(ht),xe)}function ch(xe,Xe,Qe,nt,ht){switch(Xe){case"focusin":return Yi=ss(Yi,xe,Xe,Qe,nt,ht),!0;case"dragenter":return Hi=ss(Hi,xe,Xe,Qe,nt,ht),!0;case"mouseover":return Wi=ss(Wi,xe,Xe,Qe,nt,ht),!0;case"pointerover":var mt=ht.pointerId;return is.set(mt,ss(is.get(mt)||null,xe,Xe,Qe,nt,ht)),!0;case"gotpointercapture":return mt=ht.pointerId,ns.set(mt,ss(ns.get(mt)||null,xe,Xe,Qe,nt,ht)),!0}return!1}function Rl(xe){var Xe=xn(xe.target);if(Xe!==null){var Qe=ki(Xe);if(Qe!==null){if(Xe=Qe.tag,Xe===13){if(Xe=Gs(Qe),Xe!==null){xe.blockedOn=Xe,Gl(xe.priority,function(){Ol(Qe)});return}}else if(Xe===3&&Qe.stateNode.current.memoizedState.isDehydrated){xe.blockedOn=Qe.tag===3?Qe.stateNode.containerInfo:null;return}}}xe.blockedOn=null}function Vs(xe){if(xe.blockedOn!==null)return!1;for(var Xe=xe.targetContainers;0<Xe.length;){var Qe=ta(xe.domEventName,xe.eventSystemFlags,Xe[0],xe.nativeEvent);if(Qe===null){Qe=xe.nativeEvent;var nt=new Qe.constructor(Qe.type,Qe);Nt=nt,Qe.target.dispatchEvent(nt),Nt=null}else return Xe=xs(Qe),Xe!==null&&Zo(Xe),xe.blockedOn=Qe,!1;Xe.shift()}return!0}function kl(xe,Xe,Qe){Vs(xe)&&Qe.delete(Xe)}function hh(){Qo=!1,Yi!==null&&Vs(Yi)&&(Yi=null),Hi!==null&&Vs(Hi)&&(Hi=null),Wi!==null&&Vs(Wi)&&(Wi=null),is.forEach(kl),ns.forEach(kl)}function os(xe,Xe){xe.blockedOn===Xe&&(xe.blockedOn=null,Qo||(Qo=!0,N.unstable_scheduleCallback(N.unstable_NormalPriority,hh)))}function as(xe){function Xe(ht){return os(ht,xe)}if(0<zs.length){os(zs[0],xe);for(var Qe=1;Qe<zs.length;Qe++){var nt=zs[Qe];nt.blockedOn===xe&&(nt.blockedOn=null)}}for(Yi!==null&&os(Yi,xe),Hi!==null&&os(Hi,xe),Wi!==null&&os(Wi,xe),is.forEach(Xe),ns.forEach(Xe),Qe=0;Qe<Ki.length;Qe++)nt=Ki[Qe],nt.blockedOn===xe&&(nt.blockedOn=null);for(;0<Ki.length&&(Qe=Ki[0],Qe.blockedOn===null);)Rl(Qe),Qe.blockedOn===null&&Ki.shift()}var On=Ve.ReactCurrentBatchConfig,Us=!0;function dh(xe,Xe,Qe,nt){var ht=Ar,mt=On.transition;On.transition=null;try{Ar=1,ea(xe,Xe,Qe,nt)}finally{Ar=ht,On.transition=mt}}function fh(xe,Xe,Qe,nt){var ht=Ar,mt=On.transition;On.transition=null;try{Ar=4,ea(xe,Xe,Qe,nt)}finally{Ar=ht,On.transition=mt}}function ea(xe,Xe,Qe,nt){if(Us){var ht=ta(xe,Xe,Qe,nt);if(ht===null)ya(xe,Xe,nt,qs,Qe),Xl(xe,nt);else if(ch(ht,xe,Xe,Qe,nt))nt.stopPropagation();else if(Xl(xe,nt),Xe&4&&-1<uh.indexOf(xe)){for(;ht!==null;){var mt=xs(ht);if(mt!==null&&Dl(mt),mt=ta(xe,Xe,Qe,nt),mt===null&&ya(xe,Xe,nt,qs,Qe),mt===ht)break;ht=mt}ht!==null&&nt.stopPropagation()}else ya(xe,Xe,nt,null,Qe)}}var qs=null;function ta(xe,Xe,Qe,nt){if(qs=null,xe=Qt(nt),xe=xn(xe),xe!==null)if(Xe=ki(xe),Xe===null)xe=null;else if(Qe=Xe.tag,Qe===13){if(xe=Gs(Xe),xe!==null)return xe;xe=null}else if(Qe===3){if(Xe.stateNode.current.memoizedState.isDehydrated)return Xe.tag===3?Xe.stateNode.containerInfo:null;xe=null}else Xe!==xe&&(xe=null);return qs=xe,null}function Jl(xe){switch(xe){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(qr()){case es:return 1;case yn:return 4;case Pi:case Yo:return 16;case Ml:return 536870912;default:return 16}default:return 16}}var Zi=null,ra=null,Ys=null;function Il(){if(Ys)return Ys;var xe,Xe=ra,Qe=Xe.length,nt,ht="value"in Zi?Zi.value:Zi.textContent,mt=ht.length;for(xe=0;xe<Qe&&Xe[xe]===ht[xe];xe++);var St=Qe-xe;for(nt=1;nt<=St&&Xe[Qe-nt]===ht[mt-nt];nt++);return Ys=ht.slice(xe,1<nt?1-nt:void 0)}function Hs(xe){var Xe=xe.keyCode;return"charCode"in xe?(xe=xe.charCode,xe===0&&Xe===13&&(xe=13)):xe=Xe,xe===10&&(xe=13),32<=xe||xe===13?xe:0}function Ws(){return!0}function Fl(){return!1}function ai(xe){function Xe(Qe,nt,ht,mt,St){this._reactName=Qe,this._targetInst=ht,this.type=nt,this.nativeEvent=mt,this.target=St,this.currentTarget=null;for(var Jt in xe)xe.hasOwnProperty(Jt)&&(Qe=xe[Jt],this[Jt]=Qe?Qe(mt):mt[Jt]);return this.isDefaultPrevented=(mt.defaultPrevented!=null?mt.defaultPrevented:mt.returnValue===!1)?Ws:Fl,this.isPropagationStopped=Fl,this}return vt(Xe.prototype,{preventDefault:function(){this.defaultPrevented=!0;var Qe=this.nativeEvent;Qe&&(Qe.preventDefault?Qe.preventDefault():typeof Qe.returnValue!="unknown"&&(Qe.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var Qe=this.nativeEvent;Qe&&(Qe.stopPropagation?Qe.stopPropagation():typeof Qe.cancelBubble!="unknown"&&(Qe.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),Xe}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(xe){return xe.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ia=ai(Tn),ls=vt({},Tn,{view:0,detail:0}),ph=ai(ls),na,sa,us,Ks=vt({},ls,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:aa,button:0,buttons:0,relatedTarget:function(xe){return xe.relatedTarget===void 0?xe.fromElement===xe.srcElement?xe.toElement:xe.fromElement:xe.relatedTarget},movementX:function(xe){return"movementX"in xe?xe.movementX:(xe!==us&&(us&&xe.type==="mousemove"?(na=xe.screenX-us.screenX,sa=xe.screenY-us.screenY):sa=na=0,us=xe),na)},movementY:function(xe){return"movementY"in xe?xe.movementY:sa}}),Bl=ai(Ks),mh=vt({},Ks,{dataTransfer:0}),gh=ai(mh),vh=vt({},ls,{relatedTarget:0}),oa=ai(vh),yh=vt({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0}),xh=ai(yh),bh=vt({},Tn,{clipboardData:function(xe){return"clipboardData"in xe?xe.clipboardData:window.clipboardData}}),Ch=ai(bh),_h=vt({},Tn,{data:0}),Ll=ai(_h),wh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Eh={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Nh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sh(xe){var Xe=this.nativeEvent;return Xe.getModifierState?Xe.getModifierState(xe):(xe=Nh[xe])?!!Xe[xe]:!1}function aa(){return Sh}var Ah=vt({},ls,{key:function(xe){if(xe.key){var Xe=wh[xe.key]||xe.key;if(Xe!=="Unidentified")return Xe}return xe.type==="keypress"?(xe=Hs(xe),xe===13?"Enter":String.fromCharCode(xe)):xe.type==="keydown"||xe.type==="keyup"?Eh[xe.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:aa,charCode:function(xe){return xe.type==="keypress"?Hs(xe):0},keyCode:function(xe){return xe.type==="keydown"||xe.type==="keyup"?xe.keyCode:0},which:function(xe){return xe.type==="keypress"?Hs(xe):xe.type==="keydown"||xe.type==="keyup"?xe.keyCode:0}}),Mh=ai(Ah),$h=vt({},Ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jl=ai($h),Ph=vt({},ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:aa}),Dh=ai(Ph),Oh=vt({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Th=ai(Oh),Gh=vt({},Ks,{deltaX:function(xe){return"deltaX"in xe?xe.deltaX:"wheelDeltaX"in xe?-xe.wheelDeltaX:0},deltaY:function(xe){return"deltaY"in xe?xe.deltaY:"wheelDeltaY"in xe?-xe.wheelDeltaY:"wheelDelta"in xe?-xe.wheelDelta:0},deltaZ:0,deltaMode:0}),Xh=ai(Gh),Rh=[9,13,27,32],la=ie&&"CompositionEvent"in window,cs=null;ie&&"documentMode"in document&&(cs=document.documentMode);var kh=ie&&"TextEvent"in window&&!cs,zl=ie&&(!la||cs&&8<cs&&11>=cs),Vl=" ",Ul=!1;function ql(xe,Xe){switch(xe){case"keyup":return Rh.indexOf(Xe.keyCode)!==-1;case"keydown":return Xe.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yl(xe){return xe=xe.detail,typeof xe=="object"&&"data"in xe?xe.data:null}var Gn=!1;function Jh(xe,Xe){switch(xe){case"compositionend":return Yl(Xe);case"keypress":return Xe.which!==32?null:(Ul=!0,Vl);case"textInput":return xe=Xe.data,xe===Vl&&Ul?null:xe;default:return null}}function Ih(xe,Xe){if(Gn)return xe==="compositionend"||!la&&ql(xe,Xe)?(xe=Il(),Ys=ra=Zi=null,Gn=!1,xe):null;switch(xe){case"paste":return null;case"keypress":if(!(Xe.ctrlKey||Xe.altKey||Xe.metaKey)||Xe.ctrlKey&&Xe.altKey){if(Xe.char&&1<Xe.char.length)return Xe.char;if(Xe.which)return String.fromCharCode(Xe.which)}return null;case"compositionend":return zl&&Xe.locale!=="ko"?null:Xe.data;default:return null}}var Fh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Hl(xe){var Xe=xe&&xe.nodeName&&xe.nodeName.toLowerCase();return Xe==="input"?!!Fh[xe.type]:Xe==="textarea"}function Wl(xe,Xe,Qe,nt){ti(nt),Xe=ro(Xe,"onChange"),0<Xe.length&&(Qe=new ia("onChange","change",null,Qe,nt),xe.push({event:Qe,listeners:Xe}))}var hs=null,ds=null;function Bh(xe){pu(xe,0)}function Zs(xe){var Xe=In(xe);if(ir(Xe))return xe}function Lh(xe,Xe){if(xe==="change")return Xe}var Kl=!1;if(ie){var ua;if(ie){var ca="oninput"in document;if(!ca){var Zl=document.createElement("div");Zl.setAttribute("oninput","return;"),ca=typeof Zl.oninput=="function"}ua=ca}else ua=!1;Kl=ua&&(!document.documentMode||9<document.documentMode)}function Ql(){hs&&(hs.detachEvent("onpropertychange",eu),ds=hs=null)}function eu(xe){if(xe.propertyName==="value"&&Zs(ds)){var Xe=[];Wl(Xe,ds,xe,Qt(xe)),kr(Bh,Xe)}}function jh(xe,Xe,Qe){xe==="focusin"?(Ql(),hs=Xe,ds=Qe,hs.attachEvent("onpropertychange",eu)):xe==="focusout"&&Ql()}function zh(xe){if(xe==="selectionchange"||xe==="keyup"||xe==="keydown")return Zs(ds)}function Vh(xe,Xe){if(xe==="click")return Zs(Xe)}function Uh(xe,Xe){if(xe==="input"||xe==="change")return Zs(Xe)}function qh(xe,Xe){return xe===Xe&&(xe!==0||1/xe===1/Xe)||xe!==xe&&Xe!==Xe}var Ci=typeof Object.is=="function"?Object.is:qh;function fs(xe,Xe){if(Ci(xe,Xe))return!0;if(typeof xe!="object"||xe===null||typeof Xe!="object"||Xe===null)return!1;var Qe=Object.keys(xe),nt=Object.keys(Xe);if(Qe.length!==nt.length)return!1;for(nt=0;nt<Qe.length;nt++){var ht=Qe[nt];if(!ne.call(Xe,ht)||!Ci(xe[ht],Xe[ht]))return!1}return!0}function tu(xe){for(;xe&&xe.firstChild;)xe=xe.firstChild;return xe}function ru(xe,Xe){var Qe=tu(xe);xe=0;for(var nt;Qe;){if(Qe.nodeType===3){if(nt=xe+Qe.textContent.length,xe<=Xe&&nt>=Xe)return{node:Qe,offset:Xe-xe};xe=nt}e:{for(;Qe;){if(Qe.nextSibling){Qe=Qe.nextSibling;break e}Qe=Qe.parentNode}Qe=void 0}Qe=tu(Qe)}}function iu(xe,Xe){return xe&&Xe?xe===Xe?!0:xe&&xe.nodeType===3?!1:Xe&&Xe.nodeType===3?iu(xe,Xe.parentNode):"contains"in xe?xe.contains(Xe):xe.compareDocumentPosition?!!(xe.compareDocumentPosition(Xe)&16):!1:!1}function nu(){for(var xe=window,Xe=zt();Xe instanceof xe.HTMLIFrameElement;){try{var Qe=typeof Xe.contentWindow.location.href=="string"}catch{Qe=!1}if(Qe)xe=Xe.contentWindow;else break;Xe=zt(xe.document)}return Xe}function ha(xe){var Xe=xe&&xe.nodeName&&xe.nodeName.toLowerCase();return Xe&&(Xe==="input"&&(xe.type==="text"||xe.type==="search"||xe.type==="tel"||xe.type==="url"||xe.type==="password")||Xe==="textarea"||xe.contentEditable==="true")}function Yh(xe){var Xe=nu(),Qe=xe.focusedElem,nt=xe.selectionRange;if(Xe!==Qe&&Qe&&Qe.ownerDocument&&iu(Qe.ownerDocument.documentElement,Qe)){if(nt!==null&&ha(Qe)){if(Xe=nt.start,xe=nt.end,xe===void 0&&(xe=Xe),"selectionStart"in Qe)Qe.selectionStart=Xe,Qe.selectionEnd=Math.min(xe,Qe.value.length);else if(xe=(Xe=Qe.ownerDocument||document)&&Xe.defaultView||window,xe.getSelection){xe=xe.getSelection();var ht=Qe.textContent.length,mt=Math.min(nt.start,ht);nt=nt.end===void 0?mt:Math.min(nt.end,ht),!xe.extend&&mt>nt&&(ht=nt,nt=mt,mt=ht),ht=ru(Qe,mt);var St=ru(Qe,nt);ht&&St&&(xe.rangeCount!==1||xe.anchorNode!==ht.node||xe.anchorOffset!==ht.offset||xe.focusNode!==St.node||xe.focusOffset!==St.offset)&&(Xe=Xe.createRange(),Xe.setStart(ht.node,ht.offset),xe.removeAllRanges(),mt>nt?(xe.addRange(Xe),xe.extend(St.node,St.offset)):(Xe.setEnd(St.node,St.offset),xe.addRange(Xe)))}}for(Xe=[],xe=Qe;xe=xe.parentNode;)xe.nodeType===1&&Xe.push({element:xe,left:xe.scrollLeft,top:xe.scrollTop});for(typeof Qe.focus=="function"&&Qe.focus(),Qe=0;Qe<Xe.length;Qe++)xe=Xe[Qe],xe.element.scrollLeft=xe.left,xe.element.scrollTop=xe.top}}var Hh=ie&&"documentMode"in document&&11>=document.documentMode,Xn=null,da=null,ps=null,fa=!1;function su(xe,Xe,Qe){var nt=Qe.window===Qe?Qe.document:Qe.nodeType===9?Qe:Qe.ownerDocument;fa||Xn==null||Xn!==zt(nt)||(nt=Xn,"selectionStart"in nt&&ha(nt)?nt={start:nt.selectionStart,end:nt.selectionEnd}:(nt=(nt.ownerDocument&&nt.ownerDocument.defaultView||window).getSelection(),nt={anchorNode:nt.anchorNode,anchorOffset:nt.anchorOffset,focusNode:nt.focusNode,focusOffset:nt.focusOffset}),ps&&fs(ps,nt)||(ps=nt,nt=ro(da,"onSelect"),0<nt.length&&(Xe=new ia("onSelect","select",null,Xe,Qe),xe.push({event:Xe,listeners:nt}),Xe.target=Xn)))}function Qs(xe,Xe){var Qe={};return Qe[xe.toLowerCase()]=Xe.toLowerCase(),Qe["Webkit"+xe]="webkit"+Xe,Qe["Moz"+xe]="moz"+Xe,Qe}var Rn={animationend:Qs("Animation","AnimationEnd"),animationiteration:Qs("Animation","AnimationIteration"),animationstart:Qs("Animation","AnimationStart"),transitionend:Qs("Transition","TransitionEnd")},pa={},ou={};ie&&(ou=document.createElement("div").style,"AnimationEvent"in window||(delete Rn.animationend.animation,delete Rn.animationiteration.animation,delete Rn.animationstart.animation),"TransitionEvent"in window||delete Rn.transitionend.transition);function eo(xe){if(pa[xe])return pa[xe];if(!Rn[xe])return xe;var Xe=Rn[xe],Qe;for(Qe in Xe)if(Xe.hasOwnProperty(Qe)&&Qe in ou)return pa[xe]=Xe[Qe];return xe}var au=eo("animationend"),lu=eo("animationiteration"),uu=eo("animationstart"),cu=eo("transitionend"),hu=new Map,du="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Qi(xe,Xe){hu.set(xe,Xe),Y(Xe,[xe])}for(var ma=0;ma<du.length;ma++){var ga=du[ma],Wh=ga.toLowerCase(),Kh=ga[0].toUpperCase()+ga.slice(1);Qi(Wh,"on"+Kh)}Qi(au,"onAnimationEnd"),Qi(lu,"onAnimationIteration"),Qi(uu,"onAnimationStart"),Qi("dblclick","onDoubleClick"),Qi("focusin","onFocus"),Qi("focusout","onBlur"),Qi(cu,"onTransitionEnd"),W("onMouseEnter",["mouseout","mouseover"]),W("onMouseLeave",["mouseout","mouseover"]),W("onPointerEnter",["pointerout","pointerover"]),W("onPointerLeave",["pointerout","pointerover"]),Y("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Y("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Y("onBeforeInput",["compositionend","keypress","textInput","paste"]),Y("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Y("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Y("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ms="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Zh=new Set("cancel close invalid load scroll toggle".split(" ").concat(ms));function fu(xe,Xe,Qe){var nt=xe.type||"unknown-event";xe.currentTarget=Qe,Vo(nt,Xe,void 0,xe),xe.currentTarget=null}function pu(xe,Xe){Xe=(Xe&4)!==0;for(var Qe=0;Qe<xe.length;Qe++){var nt=xe[Qe],ht=nt.event;nt=nt.listeners;e:{var mt=void 0;if(Xe)for(var St=nt.length-1;0<=St;St--){var Jt=nt[St],Lt=Jt.instance,rr=Jt.currentTarget;if(Jt=Jt.listener,Lt!==mt&&ht.isPropagationStopped())break e;fu(ht,Jt,rr),mt=Lt}else for(St=0;St<nt.length;St++){if(Jt=nt[St],Lt=Jt.instance,rr=Jt.currentTarget,Jt=Jt.listener,Lt!==mt&&ht.isPropagationStopped())break e;fu(ht,Jt,rr),mt=Lt}}}if(Ri)throw xe=Mi,Ri=!1,Mi=null,xe}function $r(xe,Xe){var Qe=Xe[Ea];Qe===void 0&&(Qe=Xe[Ea]=new Set);var nt=xe+"__bubble";Qe.has(nt)||(mu(Xe,xe,2,!1),Qe.add(nt))}function va(xe,Xe,Qe){var nt=0;Xe&&(nt|=4),mu(Qe,xe,nt,Xe)}var to="_reactListening"+Math.random().toString(36).slice(2);function gs(xe){if(!xe[to]){xe[to]=!0,z.forEach(function(Qe){Qe!=="selectionchange"&&(Zh.has(Qe)||va(Qe,!1,xe),va(Qe,!0,xe))});var Xe=xe.nodeType===9?xe:xe.ownerDocument;Xe===null||Xe[to]||(Xe[to]=!0,va("selectionchange",!1,Xe))}}function mu(xe,Xe,Qe,nt){switch(Jl(Xe)){case 1:var ht=dh;break;case 4:ht=fh;break;default:ht=ea}Qe=ht.bind(null,Xe,Qe,xe),ht=void 0,!Fr||Xe!=="touchstart"&&Xe!=="touchmove"&&Xe!=="wheel"||(ht=!0),nt?ht!==void 0?xe.addEventListener(Xe,Qe,{capture:!0,passive:ht}):xe.addEventListener(Xe,Qe,!0):ht!==void 0?xe.addEventListener(Xe,Qe,{passive:ht}):xe.addEventListener(Xe,Qe,!1)}function ya(xe,Xe,Qe,nt,ht){var mt=nt;if((Xe&1)===0&&(Xe&2)===0&&nt!==null)e:for(;;){if(nt===null)return;var St=nt.tag;if(St===3||St===4){var Jt=nt.stateNode.containerInfo;if(Jt===ht||Jt.nodeType===8&&Jt.parentNode===ht)break;if(St===4)for(St=nt.return;St!==null;){var Lt=St.tag;if((Lt===3||Lt===4)&&(Lt=St.stateNode.containerInfo,Lt===ht||Lt.nodeType===8&&Lt.parentNode===ht))return;St=St.return}for(;Jt!==null;){if(St=xn(Jt),St===null)return;if(Lt=St.tag,Lt===5||Lt===6){nt=mt=St;continue e}Jt=Jt.parentNode}}nt=nt.return}kr(function(){var rr=mt,ur=Qt(Qe),cr=[];e:{var lr=hu.get(xe);if(lr!==void 0){var fr=ia,mr=xe;switch(xe){case"keypress":if(Hs(Qe)===0)break e;case"keydown":case"keyup":fr=Mh;break;case"focusin":mr="focus",fr=oa;break;case"focusout":mr="blur",fr=oa;break;case"beforeblur":case"afterblur":fr=oa;break;case"click":if(Qe.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fr=Bl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fr=gh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fr=Dh;break;case au:case lu:case uu:fr=xh;break;case cu:fr=Th;break;case"scroll":fr=ph;break;case"wheel":fr=Xh;break;case"copy":case"cut":case"paste":fr=Ch;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fr=jl}var gr=(Xe&4)!==0,Xr=!gr&&xe==="scroll",Kt=gr?lr!==null?lr+"Capture":null:lr;gr=[];for(var Vt=rr,er;Vt!==null;){er=Vt;var dr=er.stateNode;if(er.tag===5&&dr!==null&&(er=dr,Kt!==null&&(dr=Zr(Vt,Kt),dr!=null&&gr.push(vs(Vt,dr,er)))),Xr)break;Vt=Vt.return}0<gr.length&&(lr=new fr(lr,mr,null,Qe,ur),cr.push({event:lr,listeners:gr}))}}if((Xe&7)===0){e:{if(lr=xe==="mouseover"||xe==="pointerover",fr=xe==="mouseout"||xe==="pointerout",lr&&Qe!==Nt&&(mr=Qe.relatedTarget||Qe.fromElement)&&(xn(mr)||mr[Ji]))break e;if((fr||lr)&&(lr=ur.window===ur?ur:(lr=ur.ownerDocument)?lr.defaultView||lr.parentWindow:window,fr?(mr=Qe.relatedTarget||Qe.toElement,fr=rr,mr=mr?xn(mr):null,mr!==null&&(Xr=ki(mr),mr!==Xr||mr.tag!==5&&mr.tag!==6)&&(mr=null)):(fr=null,mr=rr),fr!==mr)){if(gr=Bl,dr="onMouseLeave",Kt="onMouseEnter",Vt="mouse",(xe==="pointerout"||xe==="pointerover")&&(gr=jl,dr="onPointerLeave",Kt="onPointerEnter",Vt="pointer"),Xr=fr==null?lr:In(fr),er=mr==null?lr:In(mr),lr=new gr(dr,Vt+"leave",fr,Qe,ur),lr.target=Xr,lr.relatedTarget=er,dr=null,xn(ur)===rr&&(gr=new gr(Kt,Vt+"enter",mr,Qe,ur),gr.target=er,gr.relatedTarget=Xr,dr=gr),Xr=dr,fr&&mr)t:{for(gr=fr,Kt=mr,Vt=0,er=gr;er;er=kn(er))Vt++;for(er=0,dr=Kt;dr;dr=kn(dr))er++;for(;0<Vt-er;)gr=kn(gr),Vt--;for(;0<er-Vt;)Kt=kn(Kt),er--;for(;Vt--;){if(gr===Kt||Kt!==null&&gr===Kt.alternate)break t;gr=kn(gr),Kt=kn(Kt)}gr=null}else gr=null;fr!==null&&gu(cr,lr,fr,gr,!1),mr!==null&&Xr!==null&&gu(cr,Xr,mr,gr,!0)}}e:{if(lr=rr?In(rr):window,fr=lr.nodeName&&lr.nodeName.toLowerCase(),fr==="select"||fr==="input"&&lr.type==="file")var yr=Lh;else if(Hl(lr))if(Kl)yr=Uh;else{yr=zh;var br=jh}else(fr=lr.nodeName)&&fr.toLowerCase()==="input"&&(lr.type==="checkbox"||lr.type==="radio")&&(yr=Vh);if(yr&&(yr=yr(xe,rr))){Wl(cr,yr,Qe,ur);break e}br&&br(xe,lr,rr),xe==="focusout"&&(br=lr._wrapperState)&&br.controlled&&lr.type==="number"&&$t(lr,"number",lr.value)}switch(br=rr?In(rr):window,xe){case"focusin":(Hl(br)||br.contentEditable==="true")&&(Xn=br,da=rr,ps=null);break;case"focusout":ps=da=Xn=null;break;case"mousedown":fa=!0;break;case"contextmenu":case"mouseup":case"dragend":fa=!1,su(cr,Qe,ur);break;case"selectionchange":if(Hh)break;case"keydown":case"keyup":su(cr,Qe,ur)}var Cr;if(la)e:{switch(xe){case"compositionstart":var wr="onCompositionStart";break e;case"compositionend":wr="onCompositionEnd";break e;case"compositionupdate":wr="onCompositionUpdate";break e}wr=void 0}else Gn?ql(xe,Qe)&&(wr="onCompositionEnd"):xe==="keydown"&&Qe.keyCode===229&&(wr="onCompositionStart");wr&&(zl&&Qe.locale!=="ko"&&(Gn||wr!=="onCompositionStart"?wr==="onCompositionEnd"&&Gn&&(Cr=Il()):(Zi=ur,ra="value"in Zi?Zi.value:Zi.textContent,Gn=!0)),br=ro(rr,wr),0<br.length&&(wr=new Ll(wr,xe,null,Qe,ur),cr.push({event:wr,listeners:br}),Cr?wr.data=Cr:(Cr=Yl(Qe),Cr!==null&&(wr.data=Cr)))),(Cr=kh?Jh(xe,Qe):Ih(xe,Qe))&&(rr=ro(rr,"onBeforeInput"),0<rr.length&&(ur=new Ll("onBeforeInput","beforeinput",null,Qe,ur),cr.push({event:ur,listeners:rr}),ur.data=Cr))}pu(cr,Xe)})}function vs(xe,Xe,Qe){return{instance:xe,listener:Xe,currentTarget:Qe}}function ro(xe,Xe){for(var Qe=Xe+"Capture",nt=[];xe!==null;){var ht=xe,mt=ht.stateNode;ht.tag===5&&mt!==null&&(ht=mt,mt=Zr(xe,Qe),mt!=null&&nt.unshift(vs(xe,mt,ht)),mt=Zr(xe,Xe),mt!=null&&nt.push(vs(xe,mt,ht))),xe=xe.return}return nt}function kn(xe){if(xe===null)return null;do xe=xe.return;while(xe&&xe.tag!==5);return xe||null}function gu(xe,Xe,Qe,nt,ht){for(var mt=Xe._reactName,St=[];Qe!==null&&Qe!==nt;){var Jt=Qe,Lt=Jt.alternate,rr=Jt.stateNode;if(Lt!==null&&Lt===nt)break;Jt.tag===5&&rr!==null&&(Jt=rr,ht?(Lt=Zr(Qe,mt),Lt!=null&&St.unshift(vs(Qe,Lt,Jt))):ht||(Lt=Zr(Qe,mt),Lt!=null&&St.push(vs(Qe,Lt,Jt)))),Qe=Qe.return}St.length!==0&&xe.push({event:Xe,listeners:St})}var Qh=/\r\n?/g,ed=/\u0000|\uFFFD/g;function vu(xe){return(typeof xe=="string"?xe:""+xe).replace(Qh,`
38`).replace(ed,"")}function io(xe,Xe,Qe){if(Xe=vu(Xe),vu(xe)!==Xe&&Qe)throw Error(G(425))}function no(){}var xa=null,ba=null;function Ca(xe,Xe){return xe==="textarea"||xe==="noscript"||typeof Xe.children=="string"||typeof Xe.children=="number"||typeof Xe.dangerouslySetInnerHTML=="object"&&Xe.dangerouslySetInnerHTML!==null&&Xe.dangerouslySetInnerHTML.__html!=null}var _a=typeof setTimeout=="function"?setTimeout:void 0,td=typeof clearTimeout=="function"?clearTimeout:void 0,yu=typeof Promise=="function"?Promise:void 0,rd=typeof queueMicrotask=="function"?queueMicrotask:typeof yu<"u"?function(xe){return yu.resolve(null).then(xe).catch(id)}:_a;function id(xe){setTimeout(function(){throw xe})}function wa(xe,Xe){var Qe=Xe,nt=0;do{var ht=Qe.nextSibling;if(xe.removeChild(Qe),ht&&ht.nodeType===8)if(Qe=ht.data,Qe==="/$"){if(nt===0){xe.removeChild(ht),as(Xe);return}nt--}else Qe!=="$"&&Qe!=="$?"&&Qe!=="$!"||nt++;Qe=ht}while(Qe);as(Xe)}function en(xe){for(;xe!=null;xe=xe.nextSibling){var Xe=xe.nodeType;if(Xe===1||Xe===3)break;if(Xe===8){if(Xe=xe.data,Xe==="$"||Xe==="$!"||Xe==="$?")break;if(Xe==="/$")return null}}return xe}function xu(xe){xe=xe.previousSibling;for(var Xe=0;xe;){if(xe.nodeType===8){var Qe=xe.data;if(Qe==="$"||Qe==="$!"||Qe==="$?"){if(Xe===0)return xe;Xe--}else Qe==="/$"&&Xe++}xe=xe.previousSibling}return null}var Jn=Math.random().toString(36).slice(2),Oi="__reactFiber$"+Jn,ys="__reactProps$"+Jn,Ji="__reactContainer$"+Jn,Ea="__reactEvents$"+Jn,nd="__reactListeners$"+Jn,sd="__reactHandles$"+Jn;function xn(xe){var Xe=xe[Oi];if(Xe)return Xe;for(var Qe=xe.parentNode;Qe;){if(Xe=Qe[Ji]||Qe[Oi]){if(Qe=Xe.alternate,Xe.child!==null||Qe!==null&&Qe.child!==null)for(xe=xu(xe);xe!==null;){if(Qe=xe[Oi])return Qe;xe=xu(xe)}return Xe}xe=Qe,Qe=xe.parentNode}return null}function xs(xe){return xe=xe[Oi]||xe[Ji],!xe||xe.tag!==5&&xe.tag!==6&&xe.tag!==13&&xe.tag!==3?null:xe}function In(xe){if(xe.tag===5||xe.tag===6)return xe.stateNode;throw Error(G(33))}function so(xe){return xe[ys]||null}var Na=[],Fn=-1;function tn(xe){return{current:xe}}function Pr(xe){0>Fn||(xe.current=Na[Fn],Na[Fn]=null,Fn--)}function Mr(xe,Xe){Fn++,Na[Fn]=xe.current,xe.current=Xe}var rn={},Yr=tn(rn),ri=tn(!1),bn=rn;function Bn(xe,Xe){var Qe=xe.type.contextTypes;if(!Qe)return rn;var nt=xe.stateNode;if(nt&&nt.__reactInternalMemoizedUnmaskedChildContext===Xe)return nt.__reactInternalMemoizedMaskedChildContext;var ht={},mt;for(mt in Qe)ht[mt]=Xe[mt];return nt&&(xe=xe.stateNode,xe.__reactInternalMemoizedUnmaskedChildContext=Xe,xe.__reactInternalMemoizedMaskedChildContext=ht),ht}function ii(xe){return xe=xe.childContextTypes,xe!=null}function oo(){Pr(ri),Pr(Yr)}function bu(xe,Xe,Qe){if(Yr.current!==rn)throw Error(G(168));Mr(Yr,Xe),Mr(ri,Qe)}function Cu(xe,Xe,Qe){var nt=xe.stateNode;if(Xe=Xe.childContextTypes,typeof nt.getChildContext!="function")return Qe;nt=nt.getChildContext();for(var ht in nt)if(!(ht in Xe))throw Error(G(108,Gt(xe)||"Unknown",ht));return vt({},Qe,nt)}function ao(xe){return xe=(xe=xe.stateNode)&&xe.__reactInternalMemoizedMergedChildContext||r
vendor: 4,274 bytes, line 38
38n,bn=Yr.current,Mr(Yr,xe),Mr(ri,ri.current),!0}function _u(xe,Xe,Qe){var nt=xe.stateNode;if(!nt)throw Error(G(169));Qe?(xe=Cu(xe,Xe,bn),nt.__reactInternalMemoizedMergedChildContext=xe,Pr(ri),Pr(Yr),Mr(Yr,xe)):Pr(ri),Mr(ri,Qe)}var Ii=null,lo=!1,Sa=!1;function wu(xe){Ii===null?Ii=[xe]:Ii.push(xe)}function od(xe){lo=!0,wu(xe)}function nn(){if(!Sa&&Ii!==null){Sa=!0;var xe=0,Xe=Ar;try{var Qe=Ii;for(Ar=1;xe<Qe.length;xe++){var nt=Qe[xe];do nt=nt(!0);while(nt!==null)}Ii=null,lo=!1}catch(ht){throw Ii!==null&&(Ii=Ii.slice(xe+1)),Js(es,nn),ht}finally{Ar=Xe,Sa=!1}}return null}var Ln=[],jn=0,uo=null,co=0,di=[],fi=0,Cn=null,Fi=1,Bi="";function _n(xe,Xe){Ln[jn++]=co,Ln[jn++]=uo,uo=xe,co=Xe}function Eu(xe,Xe,Qe){di[fi++]=Fi,di[fi++]=Bi,di[fi++]=Cn,Cn=xe;var nt=Fi;xe=Bi;var ht=32-bi(nt)-1;nt&=~(1<<ht),Qe+=1;var mt=32-bi(Xe)+ht;if(30<mt){var St=ht-ht%5;mt=(nt&(1<<St)-1).toString(32),nt>>=St,ht-=St,Fi=1<<32-bi(Xe)+ht|Qe<<ht|nt,Bi=mt+xe}else Fi=1<<mt|Qe<<ht|nt,Bi=xe}function Aa(xe){xe.return!==null&&(_n(xe,1),Eu(xe,1,0))}function Ma(xe){for(;xe===uo;)uo=Ln[--jn],Ln[jn]=null,co=Ln[--jn],Ln[jn]=null;for(;xe===Cn;)Cn=di[--fi],di[fi]=null,Bi=di[--fi],di[fi]=null,Fi=di[--fi],di[fi]=null}var li=null,ui=null,Dr=!1,_i=null;function Nu(xe,Xe){var Qe=yi(5,null,null,0);Qe.elementType="DELETED",Qe.stateNode=Xe,Qe.return=xe,Xe=xe.deletions,Xe===null?(xe.deletions=[Qe],xe.flags|=16):Xe.push(Qe)}function Su(xe,Xe){switch(xe.tag){case 5:var Qe=xe.type;return Xe=Xe.nodeType!==1||Qe.toLowerCase()!==Xe.nodeName.toLowerCase()?null:Xe,Xe!==null?(xe.stateNode=Xe,li=xe,ui=en(Xe.firstChild),!0):!1;case 6:return Xe=xe.pendingProps===""||Xe.nodeType!==3?null:Xe,Xe!==null?(xe.stateNode=Xe,li=xe,ui=null,!0):!1;case 13:return Xe=Xe.nodeType!==8?null:Xe,Xe!==null?(Qe=Cn!==null?{id:Fi,overflow:Bi}:null,xe.memoizedState={dehydrated:Xe,treeContext:Qe,retryLane:1073741824},Qe=yi(18,null,null,0),Qe.stateNode=Xe,Qe.return=xe,xe.child=Qe,li=xe,ui=null,!0):!1;default:return!1}}function $a(xe){return(xe.mode&1)!==0&&(xe.flags&128)===0}function Pa(xe){if(Dr){var Xe=ui;if(Xe){var Qe=Xe;if(!Su(xe,Xe)){if($a(xe))throw Error(G(418));Xe=en(Qe.nextSibling);var nt=li;Xe&&Su(xe,Xe)?Nu(nt,Qe):(xe.flags=xe.flags&-4097|2,Dr=!1,li=xe)}}else{if($a(xe))throw Error(G(418));xe.flags=xe.flags&-4097|2,Dr=!1,li=xe}}}function Au(xe){for(xe=xe.return;xe!==null&&xe.tag!==5&&xe.tag!==3&&xe.tag!==13;)xe=xe.return;li=xe}function ho(xe){if(xe!==li)return!1;if(!Dr)return Au(xe),Dr=!0,!1;var Xe;if((Xe=xe.tag!==3)&&!(Xe=xe.tag!==5)&&(Xe=xe.type,Xe=Xe!=="head"&&Xe!=="body"&&!Ca(xe.type,xe.memoizedProps)),Xe&&(Xe=ui)){if($a(xe))throw Mu(),Error(G(418));for(;Xe;)Nu(xe,Xe),Xe=en(Xe.nextSibling)}if(Au(xe),xe.tag===13){if(xe=xe.memoizedState,xe=xe!==null?xe.dehydrated:null,!xe)throw Error(G(317));e:{for(xe=xe.nextSibling,Xe=0;xe;){if(xe.nodeType===8){var Qe=xe.data;if(Qe==="/$"){if(Xe===0){ui=en(xe.nextSibling);break e}Xe--}else Qe!=="$"&&Qe!=="$!"&&Qe!=="$?"||Xe++}xe=xe.nextSibling}ui=null}}else ui=li?en(xe.stateNode.nextSibling):null;return!0}function Mu(){for(var xe=ui;xe;)xe=en(xe.nextSibling)}function zn(){ui=li=null,Dr=!1}function Da(xe){_i===null?_i=[xe]:_i.push(xe)}var ad=Ve.ReactCurrentBatchConfig;function bs(xe,Xe,Qe){if(xe=Qe.ref,xe!==null&&typeof xe!="function"&&typeof xe!="object"){if(Qe._owner){if(Qe=Qe._owner,Qe){if(Qe.tag!==1)throw Error(G(309));var nt=Qe.stateNode}if(!nt)throw Error(G(147,xe));var ht=nt,mt=""+xe;return Xe!==null&&Xe.ref!==null&&typeof Xe.ref=="function"&&Xe.ref._stringRef===mt?Xe.ref:(Xe=function(St){var Jt=ht.refs;St===null?delete Jt[mt]:Jt[mt]=St},Xe._stringRef=mt,Xe)}if(typeof xe!="string")throw Error(G(284));if(!Qe._owner)throw Error(G(290,xe))}return xe}function fo(xe,Xe){throw xe=Object.prototype.toString.call(Xe),Error(G(31,xe==="[object Object]"?"object with keys {"+Object.keys(Xe).join(", ")+"}":xe))}function $u(xe){var Xe=xe._init;return Xe(xe._payload)}function Pu(xe){function Xe(Kt,Vt){if(xe){var er=Kt.deletions;er===null?(Kt.deletions=[Vt],Kt.flags|=16):er.push(Vt)}}function Qe(Kt,Vt){if(!xe)return null;for(;Vt!==null;)Xe(Kt,Vt),Vt=Vt.sibling;return null}function nt(Kt,Vt){for(Kt=new Map;Vt!==null;)Vt.key!==null?Kt.set(Vt.key,Vt):Kt.set(Vt.index,Vt),Vt=Vt.sibling;return Kt}function ht(Kt,Vt){return Kt=fn(Kt,Vt),Kt.index=0,Kt.sibling=null,Kt}
vendor: 5,501 bytes, line 38
38function mt(Kt,Vt,er){return Kt.index=er,xe?(er=Kt.alternate,er!==null?(er=er.index,er<Vt?(Kt.flags|=2,Vt):er):(Kt.flags|=2,Vt)):(Kt.flags|=1048576,Vt)}function St(Kt){return xe&&Kt.alternate===null&&(Kt.flags|=2),Kt}function Jt(Kt,Vt,er,dr){return Vt===null||Vt.tag!==6?(Vt=_l(er,Kt.mode,dr),Vt.return=Kt,Vt):(Vt=ht(Vt,er),Vt.return=Kt,Vt)}function Lt(Kt,Vt,er,dr){var yr=er.type;return yr===et?ur(Kt,Vt,er.props.children,dr,er.key):Vt!==null&&(Vt.elementType===yr||typeof yr=="object"&&yr!==null&&yr.$$typeof===at&&$u(yr)===Vt.type)?(dr=ht(Vt,er.props),dr.ref=bs(Kt,Vt,er),dr.return=Kt,dr):(dr=ko(er.type,er.key,er.props,null,Kt.mode,dr),dr.ref=bs(Kt,Vt,er),dr.return=Kt,dr)}function rr(Kt,Vt,er,dr){return Vt===null||Vt.tag!==4||Vt.stateNode.containerInfo!==er.containerInfo||Vt.stateNode.implementation!==er.implementation?(Vt=wl(er,Kt.mode,dr),Vt.return=Kt,Vt):(Vt=ht(Vt,er.children||[]),Vt.return=Kt,Vt)}function ur(Kt,Vt,er,dr,yr){return Vt===null||Vt.tag!==7?(Vt=Pn(er,Kt.mode,dr,yr),Vt.return=Kt,Vt):(Vt=ht(Vt,er),Vt.return=Kt,Vt)}function cr(Kt,Vt,er){if(typeof Vt=="string"&&Vt!==""||typeof Vt=="number")return Vt=_l(""+Vt,Kt.mode,er),Vt.return=Kt,Vt;if(typeof Vt=="object"&&Vt!==null){switch(Vt.$$typeof){case Re:return er=ko(Vt.type,Vt.key,Vt.props,null,Kt.mode,er),er.ref=bs(Kt,null,Vt),er.return=Kt,er;case qe:return Vt=wl(Vt,Kt.mode,er),Vt.return=Kt,Vt;case at:var dr=Vt._init;return cr(Kt,dr(Vt._payload),er)}if(Pt(Vt)||lt(Vt))return Vt=Pn(Vt,Kt.mode,er,null),Vt.return=Kt,Vt;fo(Kt,Vt)}return null}function lr(Kt,Vt,er,dr){var yr=Vt!==null?Vt.key:null;if(typeof er=="string"&&er!==""||typeof er=="number")return yr!==null?null:Jt(Kt,Vt,""+er,dr);if(typeof er=="object"&&er!==null){switch(er.$$typeof){case Re:return er.key===yr?Lt(Kt,Vt,er,dr):null;case qe:return er.key===yr?rr(Kt,Vt,er,dr):null;case at:return yr=er._init,lr(Kt,Vt,yr(er._payload),dr)}if(Pt(er)||lt(er))return yr!==null?null:ur(Kt,Vt,er,dr,null);fo(Kt,er)}return null}function fr(Kt,Vt,er,dr,yr){if(typeof dr=="string"&&dr!==""||typeof dr=="number")return Kt=Kt.get(er)||null,Jt(Vt,Kt,""+dr,yr);if(typeof dr=="object"&&dr!==null){switch(dr.$$typeof){case Re:return Kt=Kt.get(dr.key===null?er:dr.key)||null,Lt(Vt,Kt,dr,yr);case qe:return Kt=Kt.get(dr.key===null?er:dr.key)||null,rr(Vt,Kt,dr,yr);case at:var br=dr._init;return fr(Kt,Vt,er,br(dr._payload),yr)}if(Pt(dr)||lt(dr))return Kt=Kt.get(er)||null,ur(Vt,Kt,dr,yr,null);fo(Vt,dr)}return null}function mr(Kt,Vt,er,dr){for(var yr=null,br=null,Cr=Vt,wr=Vt=0,jr=null;Cr!==null&&wr<er.length;wr++){Cr.index>wr?(jr=Cr,Cr=null):jr=Cr.sibling;var Sr=lr(Kt,Cr,er[wr],dr);if(Sr===null){Cr===null&&(Cr=jr);break}xe&&Cr&&Sr.alternate===null&&Xe(Kt,Cr),Vt=mt(Sr,Vt,wr),br===null?yr=Sr:br.sibling=Sr,br=Sr,Cr=jr}if(wr===er.length)return Qe(Kt,Cr),Dr&&_n(Kt,wr),yr;if(Cr===null){for(;wr<er.length;wr++)Cr=cr(Kt,er[wr],dr),Cr!==null&&(Vt=mt(Cr,Vt,wr),br===null?yr=Cr:br.sibling=Cr,br=Cr);return Dr&&_n(Kt,wr),yr}for(Cr=nt(Kt,Cr);wr<er.length;wr++)jr=fr(Cr,Kt,wr,er[wr],dr),jr!==null&&(xe&&jr.alternate!==null&&Cr.delete(jr.key===null?wr:jr.key),Vt=mt(jr,Vt,wr),br===null?yr=jr:br.sibling=jr,br=jr);return xe&&Cr.forEach(function(pn){return Xe(Kt,pn)}),Dr&&_n(Kt,wr),yr}function gr(Kt,Vt,er,dr){var yr=lt(er);if(typeof yr!="function")throw Error(G(150));if(er=yr.call(er),er==null)throw Error(G(151));for(var br=yr=null,Cr=Vt,wr=Vt=0,jr=null,Sr=er.next();Cr!==null&&!Sr.done;wr++,Sr=er.next()){Cr.index>wr?(jr=Cr,Cr=null):jr=Cr.sibling;var pn=lr(Kt,Cr,Sr.value,dr);if(pn===null){Cr===null&&(Cr=jr);break}xe&&Cr&&pn.alternate===null&&Xe(Kt,Cr),Vt=mt(pn,Vt,wr),br===null?yr=pn:br.sibling=pn,br=pn,Cr=jr}if(Sr.done)return Qe(Kt,Cr),Dr&&_n(Kt,wr),yr;if(Cr===null){for(;!Sr.done;wr++,Sr=er.next())Sr=cr(Kt,Sr.value,dr),Sr!==null&&(Vt=mt(Sr,Vt,wr),br===null?yr=Sr:br.sibling=Sr,br=Sr);return Dr&&_n(Kt,wr),yr}for(Cr=nt(Kt,Cr);!Sr.done;wr++,Sr=er.next())Sr=fr(Cr,Kt,wr,Sr.value,dr),Sr!==null&&(xe&&Sr.alternate!==null&&Cr.delete(Sr.key===null?wr:Sr.key),Vt=mt(Sr,Vt,wr),br===null?yr=Sr:br.sibling=Sr,br=Sr);return xe&&Cr.forEach(function(Fd){return Xe(Kt,Fd)}),Dr&&_n(Kt,wr),yr}function Xr(Kt,Vt,er,dr){if(typeof er=="object"&&er!==null&&er.type===et&&er.key===null&&(er=er.props.children),typeof er=="object"&&er!==null){switch(er.$$typeof){case Re:e:{for(var yr=er.key,br=Vt;br!==null;){if(br.key===yr){if(yr=er.type,yr===et){if(br.tag===7){Qe(Kt,br.sibling),Vt=ht(br,er.props.children),Vt.return=Kt,Kt=Vt;break e}}else if(br.elementType===yr||typeof yr=="object"&&yr!==null&&yr.$$typeof===at&&$u(yr)===br.type){Qe(Kt,br.sibling),Vt=ht(br,er.props),Vt.ref=bs(Kt,br,er),Vt.return=Kt,Kt=Vt;break e}Qe(Kt,br);break}else Xe(Kt,br);br=br.sibling}er.type===et?(Vt=Pn(er.props.children,Kt.mode,dr,er.key),Vt.return=Kt,Kt=Vt):(dr=ko(er.type,er.key,er.props,null,Kt.mode,dr),dr.ref=bs(Kt,Vt,er),dr.return=Kt,Kt=dr)}return St(Kt);case qe:e:{for(br=er.key;Vt!==null;){if(Vt.key===br)if(Vt.tag===4&&Vt.stateNode.containerInfo===er.containerInfo&&Vt.stateNode.implementation===er.implementation){Qe(Kt,Vt.sibling),Vt=ht(Vt,er.children||[]),Vt.return=Kt,Kt=Vt;break e}else{Qe(Kt,Vt);break}else Xe(Kt,Vt);Vt=Vt.sibling}Vt=wl(er,Kt.mode,dr),Vt.return=Kt,Kt=Vt}return St(Kt);case at:return br=er._init,Xr(Kt,Vt,br(er._payload),dr)}if(Pt(er))return mr(Kt,Vt,er,dr);if(lt(er))return gr(Kt,Vt,er,dr);fo(Kt,er)}return typeof er=="string"&&er!==""||typeof er=="number"?(er=""+er,Vt!==null&&Vt.tag===6?(Qe(Kt,Vt.sibling),Vt=ht(Vt,er),Vt.return=Kt,Kt=Vt):(Qe(Kt,Vt),Vt=_l(er,Kt.mode,dr),Vt.return=Kt,Kt=Vt),St
vendor: 7,007 bytes, line 38
38(Kt)):Qe(Kt,Vt)}return Xr}var Vn=Pu(!0),Du=Pu(!1),po=tn(null),mo=null,Un=null,Oa=null;function Ta(){Oa=Un=mo=null}function Ga(xe){var Xe=po.current;Pr(po),xe._currentValue=Xe}function Xa(xe,Xe,Qe){for(;xe!==null;){var nt=xe.alternate;if((xe.childLanes&Xe)!==Xe?(xe.childLanes|=Xe,nt!==null&&(nt.childLanes|=Xe)):nt!==null&&(nt.childLanes&Xe)!==Xe&&(nt.childLanes|=Xe),xe===Qe)break;xe=xe.return}}function qn(xe,Xe){mo=xe,Oa=Un=null,xe=xe.dependencies,xe!==null&&xe.firstContext!==null&&((xe.lanes&Xe)!==0&&(ni=!0),xe.firstContext=null)}function mi(xe){var Xe=xe._currentValue;if(Oa!==xe)if(xe={context:xe,memoizedValue:Xe,next:null},Un===null){if(mo===null)throw Error(G(308));Un=xe,mo.dependencies={lanes:0,firstContext:xe}}else Un=Un.next=xe;return Xe}var wn=null;function Ra(xe){wn===null?wn=[xe]:wn.push(xe)}function Ou(xe,Xe,Qe,nt){var ht=Xe.interleaved;return ht===null?(Qe.next=Qe,Ra(Xe)):(Qe.next=ht.next,ht.next=Qe),Xe.interleaved=Qe,Li(xe,nt)}function Li(xe,Xe){xe.lanes|=Xe;var Qe=xe.alternate;for(Qe!==null&&(Qe.lanes|=Xe),Qe=xe,xe=xe.return;xe!==null;)xe.childLanes|=Xe,Qe=xe.alternate,Qe!==null&&(Qe.childLanes|=Xe),Qe=xe,xe=xe.return;return Qe.tag===3?Qe.stateNode:null}var sn=!1;function ka(xe){xe.updateQueue={baseState:xe.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tu(xe,Xe){xe=xe.updateQueue,Xe.updateQueue===xe&&(Xe.updateQueue={baseState:xe.baseState,firstBaseUpdate:xe.firstBaseUpdate,lastBaseUpdate:xe.lastBaseUpdate,shared:xe.shared,effects:xe.effects})}function ji(xe,Xe){return{eventTime:xe,lane:Xe,tag:0,payload:null,callback:null,next:null}}function on(xe,Xe,Qe){var nt=xe.updateQueue;if(nt===null)return null;if(nt=nt.shared,(Nr&2)!==0){var ht=nt.pending;return ht===null?Xe.next=Xe:(Xe.next=ht.next,ht.next=Xe),nt.pending=Xe,Li(xe,Qe)}return ht=nt.interleaved,ht===null?(Xe.next=Xe,Ra(nt)):(Xe.next=ht.next,ht.next=Xe),nt.interleaved=Xe,Li(xe,Qe)}function go(xe,Xe,Qe){if(Xe=Xe.updateQueue,Xe!==null&&(Xe=Xe.shared,(Qe&4194240)!==0)){var nt=Xe.lanes;nt&=xe.pendingLanes,Qe|=nt,Xe.lanes=Qe,Ko(xe,Qe)}}function Gu(xe,Xe){var Qe=xe.updateQueue,nt=xe.alternate;if(nt!==null&&(nt=nt.updateQueue,Qe===nt)){var ht=null,mt=null;if(Qe=Qe.firstBaseUpdate,Qe!==null){do{var St={eventTime:Qe.eventTime,lane:Qe.lane,tag:Qe.tag,payload:Qe.payload,callback:Qe.callback,next:null};mt===null?ht=mt=St:mt=mt.next=St,Qe=Qe.next}while(Qe!==null);mt===null?ht=mt=Xe:mt=mt.next=Xe}else ht=mt=Xe;Qe={baseState:nt.baseState,firstBaseUpdate:ht,lastBaseUpdate:mt,shared:nt.shared,effects:nt.effects},xe.updateQueue=Qe;return}xe=Qe.lastBaseUpdate,xe===null?Qe.firstBaseUpdate=Xe:xe.next=Xe,Qe.lastBaseUpdate=Xe}function vo(xe,Xe,Qe,nt){var ht=xe.updateQueue;sn=!1;var mt=ht.firstBaseUpdate,St=ht.lastBaseUpdate,Jt=ht.shared.pending;if(Jt!==null){ht.shared.pending=null;var Lt=Jt,rr=Lt.next;Lt.next=null,St===null?mt=rr:St.next=rr,St=Lt;var ur=xe.alternate;ur!==null&&(ur=ur.updateQueue,Jt=ur.lastBaseUpdate,Jt!==St&&(Jt===null?ur.firstBaseUpdate=rr:Jt.next=rr,ur.lastBaseUpdate=Lt))}if(mt!==null){var cr=ht.baseState;St=0,ur=rr=Lt=null,Jt=mt;do{var lr=Jt.lane,fr=Jt.eventTime;if((nt&lr)===lr){ur!==null&&(ur=ur.next={eventTime:fr,lane:0,tag:Jt.tag,payload:Jt.payload,callback:Jt.callback,next:null});e:{var mr=xe,gr=Jt;switch(lr=Xe,fr=Qe,gr.tag){case 1:if(mr=gr.payload,typeof mr=="function"){cr=mr.call(fr,cr,lr);break e}cr=mr;break e;case 3:mr.flags=mr.flags&-65537|128;case 0:if(mr=gr.payload,lr=typeof mr=="function"?mr.call(fr,cr,lr):mr,lr==null)break e;cr=vt({},cr,lr);break e;case 2:sn=!0}}Jt.callback!==null&&Jt.lane!==0&&(xe.flags|=64,lr=ht.effects,lr===null?ht.effects=[Jt]:lr.push(Jt))}else fr={eventTime:fr,lane:lr,tag:Jt.tag,payload:Jt.payload,callback:Jt.callback,next:null},ur===null?(rr=ur=fr,Lt=cr):ur=ur.next=fr,St|=lr;if(Jt=Jt.next,Jt===null){if(Jt=ht.shared.pending,Jt===null)break;lr=Jt,Jt=lr.next,lr.next=null,ht.lastBaseUpdate=lr,ht.shared.pending=null}}while(!0);if(ur===null&&(Lt=cr),ht.baseState=Lt,ht.firstBaseUpdate=rr,ht.lastBaseUpdate=ur,Xe=ht.shared.interleaved,Xe!==null){ht=Xe;do St|=ht.lane,ht=ht.next;while(ht!==Xe)}else mt===null&&(ht.shared.lanes=0);Sn|=St,xe.lanes=St,xe.memoizedState=cr}}function Xu(xe,Xe,Qe){if(xe=Xe.effects,Xe.effects=null,xe!==null)for(Xe=0;Xe<xe.length;Xe++){var nt=xe[Xe],ht=nt.callback;if(ht!==null){if(nt.callback=null,nt=Qe,typeof ht!="function")throw Error(G(191,ht));ht.call(nt)}}}var Cs={},Ti=tn(Cs),_s=tn(Cs),ws=tn(Cs);function En(xe){if(xe===Cs)throw Error(G(174));return xe}function Ja(xe,Xe){switch(Mr(ws,Xe),Mr(_s,xe),Mr(Ti,Cs),xe=Xe.nodeType,xe){case 9:case 11:Xe=(Xe=Xe.documentElement)?Xe.namespaceURI:Ft(null,"");break;default:xe=xe===8?Xe.parentNode:Xe,Xe=xe.namespaceURI||null,xe=xe.tagName,Xe=Ft(Xe,xe)}Pr(Ti),Mr(Ti,Xe)}function Yn(){Pr(Ti),Pr(_s),Pr(ws)}function Ru(xe){En(ws.current);var Xe=En(Ti.current),Qe=Ft(Xe,xe.type);Xe!==Qe&&(Mr(_s,xe),Mr(Ti,Qe))}function Ia(xe){_s.current===xe&&(Pr(Ti),Pr(_s))}var Or=tn(0);function yo(xe){for(var Xe=xe;Xe!==null;){if(Xe.tag===13){var Qe=Xe.memoizedState;if(Qe!==null&&(Qe=Qe.dehydrated,Qe===null||Qe.data==="$?"||Qe.data==="$!"))return Xe}else if(Xe.tag===19&&Xe.memoizedProps.revealOrder!==void 0){if((Xe.flags&128)!==0)return Xe}else if(Xe.child!==null){Xe.child.return=Xe,Xe=Xe.child;continue}if(Xe===xe)break;for(;Xe.sibling===null;){if(Xe.return===null||Xe.return===xe)return null;Xe=Xe.return}Xe.sibling.return=Xe.return,Xe=Xe.sibling}return null}var Fa=[];function Ba(){for(var xe=0;xe<Fa.length;xe++)Fa[xe]._workInProgressVersionPrimary=null;Fa.length=0}var xo=Ve.ReactCurrentDispatcher,La=Ve.ReactCurrentBatchConfig,Nn=0,Tr=null,Jr=null,Br=null,bo=!1,Es=!1,Ns=0,ld=0;function Hr(){throw Error(G(321))}function ja(xe,Xe){if(Xe===null)return!1;for(var Qe=0;Qe<Xe.length&&Qe<xe.length;Qe++)if(!Ci(xe[Qe],Xe[Qe]))return!1;return!0}function za(xe,Xe,Qe,nt,ht,mt){if(Nn=mt,Tr=Xe,Xe.memoizedState=null,Xe.updateQueue=null,Xe.lanes=0,xo.current=xe===null||xe.memoizedState===null?dd:fd,xe=Qe(nt,ht),Es){mt=0;do{if(Es=!1,Ns=0,25<=mt)throw Error(G(301));mt+=1,Br=Jr=null,Xe.updateQueue=null,xo.current=pd,xe=Qe(nt,ht)}while(Es)}if(xo.current=wo,Xe=Jr!==null&&Jr.next!==null,Nn=0,Br=Jr=Tr=null,bo=!1,Xe)throw Error(G(300));return xe}function Va(){var xe=Ns!==0;return Ns=0,xe}function Gi(){var xe={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Br===null?Tr.memoizedState=Br=xe:Br=Br.next=xe,Br}function gi(){if(Jr===null){var xe=Tr.alternate;xe=xe!==null?xe.memoizedState:null}else xe=Jr.next;var Xe=Br===null?Tr.memoizedState:Br.next;if(Xe!==null)Br=Xe,Jr=xe;else{if(xe===null)throw Error(G(310));Jr=xe,xe={memoizedState:Jr.memoizedState,baseState:Jr.baseState,baseQueue:Jr.baseQueue,queue:Jr.queue,next:null},Br===null?Tr.memoizedState=Br=xe:Br=Br.next=xe}return Br}function Ss(xe,Xe){return typeof Xe=="function"?Xe(xe):Xe}function Ua(xe){var Xe=gi(),Qe=Xe.queue;if(Qe===null)throw Error(G(311));Qe.lastRenderedReducer=xe;var nt=Jr,ht=nt.baseQueue,mt=Qe.pending;
vendor: 5,894 bytes, line 38
38if(mt!==null){if(ht!==null){var St=ht.next;ht.next=mt.next,mt.next=St}nt.baseQueue=ht=mt,Qe.pending=null}if(ht!==null){mt=ht.next,nt=nt.baseState;var Jt=St=null,Lt=null,rr=mt;do{var ur=rr.lane;if((Nn&ur)===ur)Lt!==null&&(Lt=Lt.next={lane:0,action:rr.action,hasEagerState:rr.hasEagerState,eagerState:rr.eagerState,next:null}),nt=rr.hasEagerState?rr.eagerState:xe(nt,rr.action);else{var cr={lane:ur,action:rr.action,hasEagerState:rr.hasEagerState,eagerState:rr.eagerState,next:null};Lt===null?(Jt=Lt=cr,St=nt):Lt=Lt.next=cr,Tr.lanes|=ur,Sn|=ur}rr=rr.next}while(rr!==null&&rr!==mt);Lt===null?St=nt:Lt.next=Jt,Ci(nt,Xe.memoizedState)||(ni=!0),Xe.memoizedState=nt,Xe.baseState=St,Xe.baseQueue=Lt,Qe.lastRenderedState=nt}if(xe=Qe.interleaved,xe!==null){ht=xe;do mt=ht.lane,Tr.lanes|=mt,Sn|=mt,ht=ht.next;while(ht!==xe)}else ht===null&&(Qe.lanes=0);return[Xe.memoizedState,Qe.dispatch]}function qa(xe){var Xe=gi(),Qe=Xe.queue;if(Qe===null)throw Error(G(311));Qe.lastRenderedReducer=xe;var nt=Qe.dispatch,ht=Qe.pending,mt=Xe.memoizedState;if(ht!==null){Qe.pending=null;var St=ht=ht.next;do mt=xe(mt,St.action),St=St.next;while(St!==ht);Ci(mt,Xe.memoizedState)||(ni=!0),Xe.memoizedState=mt,Xe.baseQueue===null&&(Xe.baseState=mt),Qe.lastRenderedState=mt}return[mt,nt]}function ku(){}function Ju(xe,Xe){var Qe=Tr,nt=gi(),ht=Xe(),mt=!Ci(nt.memoizedState,ht);if(mt&&(nt.memoizedState=ht,ni=!0),nt=nt.queue,Ya(Bu.bind(null,Qe,nt,xe),[xe]),nt.getSnapshot!==Xe||mt||Br!==null&&Br.memoizedState.tag&1){if(Qe.flags|=2048,As(9,Fu.bind(null,Qe,nt,ht,Xe),void 0,null),Lr===null)throw Error(G(349));(Nn&30)!==0||Iu(Qe,Xe,ht)}return ht}function Iu(xe,Xe,Qe){xe.flags|=16384,xe={getSnapshot:Xe,value:Qe},Xe=Tr.updateQueue,Xe===null?(Xe={lastEffect:null,stores:null},Tr.updateQueue=Xe,Xe.stores=[xe]):(Qe=Xe.stores,Qe===null?Xe.stores=[xe]:Qe.push(xe))}function Fu(xe,Xe,Qe,nt){Xe.value=Qe,Xe.getSnapshot=nt,Lu(Xe)&&ju(xe)}function Bu(xe,Xe,Qe){return Qe(function(){Lu(Xe)&&ju(xe)})}function Lu(xe){var Xe=xe.getSnapshot;xe=xe.value;try{var Qe=Xe();return!Ci(xe,Qe)}catch{return!0}}function ju(xe){var Xe=Li(xe,1);Xe!==null&&Si(Xe,xe,1,-1)}function zu(xe){var Xe=Gi();return typeof xe=="function"&&(xe=xe()),Xe.memoizedState=Xe.baseState=xe,xe={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:xe},Xe.queue=xe,xe=xe.dispatch=hd.bind(null,Tr,xe),[Xe.memoizedState,xe]}function As(xe,Xe,Qe,nt){return xe={tag:xe,create:Xe,destroy:Qe,deps:nt,next:null},Xe=Tr.updateQueue,Xe===null?(Xe={lastEffect:null,stores:null},Tr.updateQueue=Xe,Xe.lastEffect=xe.next=xe):(Qe=Xe.lastEffect,Qe===null?Xe.lastEffect=xe.next=xe:(nt=Qe.next,Qe.next=xe,xe.next=nt,Xe.lastEffect=xe)),xe}function Vu(){return gi().memoizedState}function Co(xe,Xe,Qe,nt){var ht=Gi();Tr.flags|=xe,ht.memoizedState=As(1|Xe,Qe,void 0,nt===void 0?null:nt)}function _o(xe,Xe,Qe,nt){var ht=gi();nt=nt===void 0?null:nt;var mt=void 0;if(Jr!==null){var St=Jr.memoizedState;if(mt=St.destroy,nt!==null&&ja(nt,St.deps)){ht.memoizedState=As(Xe,Qe,mt,nt);return}}Tr.flags|=xe,ht.memoizedState=As(1|Xe,Qe,mt,nt)}function Uu(xe,Xe){return Co(8390656,8,xe,Xe)}function Ya(xe,Xe){return _o(2048,8,xe,Xe)}function qu(xe,Xe){return _o(4,2,xe,Xe)}function Yu(xe,Xe){return _o(4,4,xe,Xe)}function Hu(xe,Xe){if(typeof Xe=="function")return xe=xe(),Xe(xe),function(){Xe(null)};if(Xe!=null)return xe=xe(),Xe.current=xe,function(){Xe.current=null}}function Wu(xe,Xe,Qe){return Qe=Qe!=null?Qe.concat([xe]):null,_o(4,4,Hu.bind(null,Xe,xe),Qe)}function Ha(){}function Ku(xe,Xe){var Qe=gi();Xe=Xe===void 0?null:Xe;var nt=Qe.memoizedState;return nt!==null&&Xe!==null&&ja(Xe,nt[1])?nt[0]:(Qe.memoizedState=[xe,Xe],xe)}function Zu(xe,Xe){var Qe=gi();Xe=Xe===void 0?null:Xe;var nt=Qe.memoizedState;return nt!==null&&Xe!==null&&ja(Xe,nt[1])?nt[0]:(xe=xe(),Qe.memoizedState=[xe,Xe],xe)}function Qu(xe,Xe,Qe){return(Nn&21)===0?(xe.baseState&&(xe.baseState=!1,ni=!0),xe.memoizedState=Qe):(Ci(Qe,Xe)||(Qe=$l(),Tr.lanes|=Qe,Sn|=Qe,xe.baseState=!0),Xe)}function ud(xe,Xe){var Qe=Ar;Ar=Qe!==0&&4>Qe?Qe:4,xe(!0);var nt=La.transition;La.transition={};try{xe(!1),Xe()}finally{Ar=Qe,La.transition=nt}}function ec(){return gi().memoizedState}function cd(xe,Xe,Qe){var nt=hn(xe);if(Qe={lane:nt,action:Qe,hasEagerState:!1,eagerState:null,next:null},tc(xe))rc(Xe,Qe);else if(Qe=Ou(xe,Xe,Qe,nt),Qe!==null){var ht=ei();Si(Qe,xe,nt,ht),ic(Qe,Xe,nt)}}function hd(xe,Xe,Qe){var nt=hn(xe),ht={lane:nt,action:Qe,hasEagerState:!1,eagerState:null,next:null};if(tc(xe))rc(Xe,ht);else{var mt=xe.alternate;if(xe.lanes===0&&(mt===null||mt.lanes===0)&&(mt=Xe.lastRenderedReducer,mt!==null))try{var St=Xe.lastRenderedState,Jt=mt(St,Qe);if(ht.hasEagerState=!0,ht.eagerState=Jt,Ci(Jt,St)){var Lt=Xe.interleaved;Lt===null?(ht.next=ht,Ra(Xe)):(ht.next=Lt.next,Lt.next=ht),Xe.interleaved=ht;return}}catch{}finally{}Qe=Ou(xe,Xe,ht,nt),Qe!==null&&(ht=ei(),Si(Qe,xe,nt,ht),ic(Qe,Xe,nt))}}function tc(xe){var Xe=xe.alternate;return xe===Tr||Xe!==null&&Xe===Tr}function rc(xe,Xe){Es=bo=!0;var Qe=xe.pending;Qe===null?Xe.next=Xe:(Xe.next=Qe.next,Qe.next=Xe),xe.pending=Xe}function ic(xe,Xe,Qe){if((Qe&4194240)!==0){var nt=Xe.lanes;nt&=xe.pendingLanes,Qe|=nt,Xe.lanes=Qe,Ko(xe,Qe)}}var wo={readContext:mi,useCallback:Hr,useContext:Hr,useEffect:Hr,useImperativeHandle:Hr,useInsertionEffect:Hr,useLayoutEffect:Hr,useMemo:Hr,useReducer:Hr,useRef:Hr,useState:Hr,useDebugValue:Hr,useDeferredValue:Hr,useTransition:Hr,useMutableSource:Hr,useSyncExternalStore:Hr,useId:Hr,unstable_isNewReconciler:!1},dd={readContext:mi,useCallback:function(xe,Xe){return Gi().memoizedState=[xe,Xe===void 0?null:Xe],xe},useContext:mi,useEffect:Uu,useImperativeHandle:function(xe,Xe,Qe){return Qe=Qe!=null?Qe.concat([xe]):null,Co(4194308,4,Hu.bind(null,Xe,xe),Qe)},useLayoutEffect:function(xe,Xe){return Co(4194308,4,xe,Xe)},useInsertionEffect:function(xe,Xe){return Co(4,2,xe,Xe)},useMemo:function(xe,Xe){var Qe=Gi();
vendor: 8,488 bytes, lines 38-40
38return Xe=Xe===void 0?null:Xe,xe=xe(),Qe.memoizedState=[xe,Xe],xe},useReducer:function(xe,Xe,Qe){var nt=Gi();return Xe=Qe!==void 0?Qe(Xe):Xe,nt.memoizedState=nt.baseState=Xe,xe={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:xe,lastRenderedState:Xe},nt.queue=xe,xe=xe.dispatch=cd.bind(null,Tr,xe),[nt.memoizedState,xe]},useRef:function(xe){var Xe=Gi();return xe={current:xe},Xe.memoizedState=xe},useState:zu,useDebugValue:Ha,useDeferredValue:function(xe){return Gi().memoizedState=xe},useTransition:function(){var xe=zu(!1),Xe=xe[0];return xe=ud.bind(null,xe[1]),Gi().memoizedState=xe,[Xe,xe]},useMutableSource:function(){},useSyncExternalStore:function(xe,Xe,Qe){var nt=Tr,ht=Gi();if(Dr){if(Qe===void 0)throw Error(G(407));Qe=Qe()}else{if(Qe=Xe(),Lr===null)throw Error(G(349));(Nn&30)!==0||Iu(nt,Xe,Qe)}ht.memoizedState=Qe;var mt={value:Qe,getSnapshot:Xe};return ht.queue=mt,Uu(Bu.bind(null,nt,mt,xe),[xe]),nt.flags|=2048,As(9,Fu.bind(null,nt,mt,Qe,Xe),void 0,null),Qe},useId:function(){var xe=Gi(),Xe=Lr.identifierPrefix;if(Dr){var Qe=Bi,nt=Fi;Qe=(nt&~(1<<32-bi(nt)-1)).toString(32)+Qe,Xe=":"+Xe+"R"+Qe,Qe=Ns++,0<Qe&&(Xe+="H"+Qe.toString(32)),Xe+=":"}else Qe=ld++,Xe=":"+Xe+"r"+Qe.toString(32)+":";return xe.memoizedState=Xe},unstable_isNewReconciler:!1},fd={readContext:mi,useCallback:Ku,useContext:mi,useEffect:Ya,useImperativeHandle:Wu,useInsertionEffect:qu,useLayoutEffect:Yu,useMemo:Zu,useReducer:Ua,useRef:Vu,useState:function(){return Ua(Ss)},useDebugValue:Ha,useDeferredValue:function(xe){var Xe=gi();return Qu(Xe,Jr.memoizedState,xe)},useTransition:function(){var xe=Ua(Ss)[0],Xe=gi().memoizedState;return[xe,Xe]},useMutableSource:ku,useSyncExternalStore:Ju,useId:ec,unstable_isNewReconciler:!1},pd={readContext:mi,useCallback:Ku,useContext:mi,useEffect:Ya,useImperativeHandle:Wu,useInsertionEffect:qu,useLayoutEffect:Yu,useMemo:Zu,useReducer:qa,useRef:Vu,useState:function(){return qa(Ss)},useDebugValue:Ha,useDeferredValue:function(xe){var Xe=gi();return Jr===null?Xe.memoizedState=xe:Qu(Xe,Jr.memoizedState,xe)},useTransition:function(){var xe=qa(Ss)[0],Xe=gi().memoizedState;return[xe,Xe]},useMutableSource:ku,useSyncExternalStore:Ju,useId:ec,unstable_isNewReconciler:!1};function wi(xe,Xe){if(xe&&xe.defaultProps){Xe=vt({},Xe),xe=xe.defaultProps;for(var Qe in xe)Xe[Qe]===void 0&&(Xe[Qe]=xe[Qe]);return Xe}return Xe}function Wa(xe,Xe,Qe,nt){Xe=xe.memoizedState,Qe=Qe(nt,Xe),Qe=Qe==null?Xe:vt({},Xe,Qe),xe.memoizedState=Qe,xe.lanes===0&&(xe.updateQueue.baseState=Qe)}var Eo={isMounted:function(xe){return(xe=xe._reactInternals)?ki(xe)===xe:!1},enqueueSetState:function(xe,Xe,Qe){xe=xe._reactInternals;var nt=ei(),ht=hn(xe),mt=ji(nt,ht);mt.payload=Xe,Qe!=null&&(mt.callback=Qe),Xe=on(xe,mt,ht),Xe!==null&&(Si(Xe,xe,ht,nt),go(Xe,xe,ht))},enqueueReplaceState:function(xe,Xe,Qe){xe=xe._reactInternals;var nt=ei(),ht=hn(xe),mt=ji(nt,ht);mt.tag=1,mt.payload=Xe,Qe!=null&&(mt.callback=Qe),Xe=on(xe,mt,ht),Xe!==null&&(Si(Xe,xe,ht,nt),go(Xe,xe,ht))},enqueueForceUpdate:function(xe,Xe){xe=xe._reactInternals;var Qe=ei(),nt=hn(xe),ht=ji(Qe,nt);ht.tag=2,Xe!=null&&(ht.callback=Xe),Xe=on(xe,ht,nt),Xe!==null&&(Si(Xe,xe,nt,Qe),go(Xe,xe,nt))}};function nc(xe,Xe,Qe,nt,ht,mt,St){return xe=xe.stateNode,typeof xe.shouldComponentUpdate=="function"?xe.shouldComponentUpdate(nt,mt,St):Xe.prototype&&Xe.prototype.isPureReactComponent?!fs(Qe,nt)||!fs(ht,mt):!0}function sc(xe,Xe,Qe){var nt=!1,ht=rn,mt=Xe.contextType;return typeof mt=="object"&&mt!==null?mt=mi(mt):(ht=ii(Xe)?bn:Yr.current,nt=Xe.contextTypes,mt=(nt=nt!=null)?Bn(xe,ht):rn),Xe=new Xe(Qe,mt),xe.memoizedState=Xe.state!==null&&Xe.state!==void 0?Xe.state:null,Xe.updater=Eo,xe.stateNode=Xe,Xe._reactInternals=xe,nt&&(xe=xe.stateNode,xe.__reactInternalMemoizedUnmaskedChildContext=ht,xe.__reactInternalMemoizedMaskedChildContext=mt),Xe}function oc(xe,Xe,Qe,nt){xe=Xe.state,typeof Xe.componentWillReceiveProps=="function"&&Xe.componentWillReceiveProps(Qe,nt),typeof Xe.UNSAFE_componentWillReceiveProps=="function"&&Xe.UNSAFE_componentWillReceiveProps(Qe,nt),Xe.state!==xe&&Eo.enqueueReplaceState(Xe,Xe.state,null)}function Ka(xe,Xe,Qe,nt){var ht=xe.stateNode;ht.props=Qe,ht.state=xe.memoizedState,ht.refs={},ka(xe);var mt=Xe.contextType;typeof mt=="object"&&mt!==null?ht.context=mi(mt):(mt=ii(Xe)?bn:Yr.current,ht.context=Bn(xe,mt)),ht.state=xe.memoizedState,mt=Xe.getDerivedStateFromProps,typeof mt=="function"&&(Wa(xe,Xe,mt,Qe),ht.state=xe.memoizedState),typeof Xe.getDerivedStateFromProps=="function"||typeof ht.getSnapshotBeforeUpdate=="function"||typeof ht.UNSAFE_componentWillMount!="function"&&typeof ht.componentWillMount!="function"||(Xe=ht.state,typeof ht.componentWillMount=="function"&&ht.componentWillMount(),typeof ht.UNSAFE_componentWillMount=="function"&&ht.UNSAFE_componentWillMount(),Xe!==ht.state&&Eo.enqueueReplaceState(ht,ht.state,null),vo(xe,Qe,ht,nt),ht.state=xe.memoizedState),typeof ht.componentDidMount=="function"&&(xe.flags|=4194308)}function Hn(xe,Xe){try{var Qe="",nt=Xe;do Qe+=Ct(nt),nt=nt.return;while(nt);var ht=Qe}catch(mt){ht=`
39Error generating stack: `+mt.message+`
40`+mt.stack}return{value:xe,source:Xe,stack:ht,digest:null}}function Za(xe,Xe,Qe){return{value:xe,source:null,stack:Qe??null,digest:Xe??null}}function Qa(xe,Xe){try{console.error(Xe.value)}catch(Qe){setTimeout(function(){throw Qe})}}var md=typeof WeakMap=="function"?WeakMap:Map;function ac(xe,Xe,Qe){Qe=ji(-1,Qe),Qe.tag=3,Qe.payload={element:null};var nt=Xe.value;return Qe.callback=function(){Do||(Do=!0,pl=nt),Qa(xe,Xe)},Qe}function lc(xe,Xe,Qe){Qe=ji(-1,Qe),Qe.tag=3;var nt=xe.type.getDerivedStateFromError;if(typeof nt=="function"){var ht=Xe.value;Qe.payload=function(){return nt(ht)},Qe.callback=function(){Qa(xe,Xe)}}var mt=xe.stateNode;return mt!==null&&typeof mt.componentDidCatch=="function"&&(Qe.callback=function(){Qa(xe,Xe),typeof nt!="function"&&(un===null?un=new Set([this]):un.add(this));var St=Xe.stack;this.componentDidCatch(Xe.value,{componentStack:St!==null?St:""})}),Qe}function uc(xe,Xe,Qe){var nt=xe.pingCache;if(nt===null){nt=xe.pingCache=new md;var ht=new Set;nt.set(Xe,ht)}else ht=nt.get(Xe),ht===void 0&&(ht=new Set,nt.set(Xe,ht));ht.has(Qe)||(ht.add(Qe),xe=$d.bind(null,xe,Xe,Qe),Xe.then(xe,xe))}function cc(xe){do{var Xe;if((Xe=xe.tag===13)&&(Xe=xe.memoizedState,Xe=Xe!==null?Xe.dehydrated!==null:!0),Xe)return xe;xe=xe.return}while(xe!==null);return null}function hc(xe,Xe,Qe,nt,ht){return(xe.mode&1)===0?(xe===Xe?xe.flags|=65536:(xe.flags|=128,Qe.flags|=131072,Qe.flags&=-52805,Qe.tag===1&&(Qe.alternate===null?Qe.tag=17:(Xe=ji(-1,1),Xe.tag=2,on(Qe,Xe,1))),Qe.lanes|=1),xe):(xe.flags|=65536,xe.lanes=ht,xe)}var gd=Ve.ReactCurrentOwner,ni=!1;function Qr(xe,Xe,Qe,nt){Xe.child=xe===null?Du(Xe,null,Qe,nt):Vn(Xe,xe.child,Qe,nt)}function dc(xe,Xe,Qe,nt,ht){Qe=Qe.render;var mt=Xe.ref;return qn(Xe,ht),nt=za(xe,Xe,Qe,nt,mt,ht),Qe=Va(),xe!==null&&!ni?(Xe.updateQueue=xe.updateQueue,Xe.flags&=-2053,xe.lanes&=~ht,zi(xe,Xe,ht)):(Dr&&Qe&&Aa(Xe),Xe.flags|=1,Qr(xe,Xe,nt,ht),Xe.child)}function fc(xe,Xe,Qe,nt,ht){if(xe===null){var mt=Qe.type;return typeof mt=="function"&&!Cl(mt)&&mt.defaultProps===void 0&&Qe.compare===null&&Qe.defaultProps===void 0?(Xe.tag=15,Xe.type=mt,pc(xe,Xe,mt,nt,ht)):(xe=ko(Qe.type,null,nt,Xe,Xe.mode,ht),xe.ref=Xe.ref,xe.return=Xe,Xe.child=xe)}if(mt=xe.child,(xe.lanes&ht)===0){var St=mt.memoizedProps;if(Qe=Qe.compare,Qe=Qe!==null?Qe:fs,Qe(St,nt)&&xe.ref===Xe.ref)return zi(xe,Xe,ht)}return Xe.flags|=1,xe=fn(mt,nt),xe.ref=Xe.ref,xe.return=Xe,Xe.child=xe}function pc(xe,Xe,Qe,nt,ht){if(xe!==null){var mt=xe.memoizedProps;if(fs(mt,nt)&&xe.ref===Xe.ref)if(ni=!1,Xe.pendingProps=nt=mt,(xe.lanes&ht)!==0)(xe.flags&131072)!==0&&(ni=!0);else return Xe.lanes=xe.lanes,zi(xe,Xe,ht)}return el(xe,Xe,Qe,nt,ht)}function mc(xe,Xe,Qe){var nt=Xe.pendingProps,ht=nt.children,mt=xe!==null?xe.memoizedState:null;if(nt.mode==="hidden")if((Xe.mode&1)===0)Xe.memoizedState={baseLanes:0,cachePool:null,transitions:null},Mr(Kn,ci),ci|=Qe;else{if((Qe&1073741824)===0)return xe=mt!==null?mt.baseLanes|Qe:Qe,Xe.lanes=Xe.childLanes=1073741824,Xe.memoizedState={baseLanes:xe,cachePool:null,transitions:null},Xe.updateQueue=null,Mr(Kn,ci),ci|=xe,null;Xe.memoizedState={baseLanes:0,cachePool:null,transitions:null},nt=mt!==null?mt.baseLanes:Qe,Mr(Kn,ci),ci|=nt}else mt!==null?(nt=mt.baseLanes|Qe,Xe.memoizedState=null):nt=Qe,Mr(Kn,ci),ci|=nt;return Qr(xe,Xe,ht,Qe),Xe.child}function gc(xe,Xe){var Qe=Xe.ref;(xe===null&&Qe!==null||xe!==null&&xe.ref!==Qe)&&(Xe.flags|=512,Xe.flags|=2097152)}
vendor: 41,959 bytes, line 40
40function el(xe,Xe,Qe,nt,ht){var mt=ii(Qe)?bn:Yr.current;return mt=Bn(Xe,mt),qn(Xe,ht),Qe=za(xe,Xe,Qe,nt,mt,ht),nt=Va(),xe!==null&&!ni?(Xe.updateQueue=xe.updateQueue,Xe.flags&=-2053,xe.lanes&=~ht,zi(xe,Xe,ht)):(Dr&&nt&&Aa(Xe),Xe.flags|=1,Qr(xe,Xe,Qe,ht),Xe.child)}function vc(xe,Xe,Qe,nt,ht){if(ii(Qe)){var mt=!0;ao(Xe)}else mt=!1;if(qn(Xe,ht),Xe.stateNode===null)So(xe,Xe),sc(Xe,Qe,nt),Ka(Xe,Qe,nt,ht),nt=!0;else if(xe===null){var St=Xe.stateNode,Jt=Xe.memoizedProps;St.props=Jt;var Lt=St.context,rr=Qe.contextType;typeof rr=="object"&&rr!==null?rr=mi(rr):(rr=ii(Qe)?bn:Yr.current,rr=Bn(Xe,rr));var ur=Qe.getDerivedStateFromProps,cr=typeof ur=="function"||typeof St.getSnapshotBeforeUpdate=="function";cr||typeof St.UNSAFE_componentWillReceiveProps!="function"&&typeof St.componentWillReceiveProps!="function"||(Jt!==nt||Lt!==rr)&&oc(Xe,St,nt,rr),sn=!1;var lr=Xe.memoizedState;St.state=lr,vo(Xe,nt,St,ht),Lt=Xe.memoizedState,Jt!==nt||lr!==Lt||ri.current||sn?(typeof ur=="function"&&(Wa(Xe,Qe,ur,nt),Lt=Xe.memoizedState),(Jt=sn||nc(Xe,Qe,Jt,nt,lr,Lt,rr))?(cr||typeof St.UNSAFE_componentWillMount!="function"&&typeof St.componentWillMount!="function"||(typeof St.componentWillMount=="function"&&St.componentWillMount(),typeof St.UNSAFE_componentWillMount=="function"&&St.UNSAFE_componentWillMount()),typeof St.componentDidMount=="function"&&(Xe.flags|=4194308)):(typeof St.componentDidMount=="function"&&(Xe.flags|=4194308),Xe.memoizedProps=nt,Xe.memoizedState=Lt),St.props=nt,St.state=Lt,St.context=rr,nt=Jt):(typeof St.componentDidMount=="function"&&(Xe.flags|=4194308),nt=!1)}else{St=Xe.stateNode,Tu(xe,Xe),Jt=Xe.memoizedProps,rr=Xe.type===Xe.elementType?Jt:wi(Xe.type,Jt),St.props=rr,cr=Xe.pendingProps,lr=St.context,Lt=Qe.contextType,typeof Lt=="object"&&Lt!==null?Lt=mi(Lt):(Lt=ii(Qe)?bn:Yr.current,Lt=Bn(Xe,Lt));var fr=Qe.getDerivedStateFromProps;(ur=typeof fr=="function"||typeof St.getSnapshotBeforeUpdate=="function")||typeof St.UNSAFE_componentWillReceiveProps!="function"&&typeof St.componentWillReceiveProps!="function"||(Jt!==cr||lr!==Lt)&&oc(Xe,St,nt,Lt),sn=!1,lr=Xe.memoizedState,St.state=lr,vo(Xe,nt,St,ht);var mr=Xe.memoizedState;Jt!==cr||lr!==mr||ri.current||sn?(typeof fr=="function"&&(Wa(Xe,Qe,fr,nt),mr=Xe.memoizedState),(rr=sn||nc(Xe,Qe,rr,nt,lr,mr,Lt)||!1)?(ur||typeof St.UNSAFE_componentWillUpdate!="function"&&typeof St.componentWillUpdate!="function"||(typeof St.componentWillUpdate=="function"&&St.componentWillUpdate(nt,mr,Lt),typeof St.UNSAFE_componentWillUpdate=="function"&&St.UNSAFE_componentWillUpdate(nt,mr,Lt)),typeof St.componentDidUpdate=="function"&&(Xe.flags|=4),typeof St.getSnapshotBeforeUpdate=="function"&&(Xe.flags|=1024)):(typeof St.componentDidUpdate!="function"||Jt===xe.memoizedProps&&lr===xe.memoizedState||(Xe.flags|=4),typeof St.getSnapshotBeforeUpdate!="function"||Jt===xe.memoizedProps&&lr===xe.memoizedState||(Xe.flags|=1024),Xe.memoizedProps=nt,Xe.memoizedState=mr),St.props=nt,St.state=mr,St.context=Lt,nt=rr):(typeof St.componentDidUpdate!="function"||Jt===xe.memoizedProps&&lr===xe.memoizedState||(Xe.flags|=4),typeof St.getSnapshotBeforeUpdate!="function"||Jt===xe.memoizedProps&&lr===xe.memoizedState||(Xe.flags|=1024),nt=!1)}return tl(xe,Xe,Qe,nt,mt,ht)}function tl(xe,Xe,Qe,nt,ht,mt){gc(xe,Xe);var St=(Xe.flags&128)!==0;if(!nt&&!St)return ht&&_u(Xe,Qe,!1),zi(xe,Xe,mt);nt=Xe.stateNode,gd.current=Xe;var Jt=St&&typeof Qe.getDerivedStateFromError!="function"?null:nt.render();return Xe.flags|=1,xe!==null&&St?(Xe.child=Vn(Xe,xe.child,null,mt),Xe.child=Vn(Xe,null,Jt,mt)):Qr(xe,Xe,Jt,mt),Xe.memoizedState=nt.state,ht&&_u(Xe,Qe,!0),Xe.child}function yc(xe){var Xe=xe.stateNode;Xe.pendingContext?bu(xe,Xe.pendingContext,Xe.pendingContext!==Xe.context):Xe.context&&bu(xe,Xe.context,!1),Ja(xe,Xe.containerInfo)}function xc(xe,Xe,Qe,nt,ht){return zn(),Da(ht),Xe.flags|=256,Qr(xe,Xe,Qe,nt),Xe.child}var rl={dehydrated:null,treeContext:null,retryLane:0};function il(xe){return{baseLanes:xe,cachePool:null,transitions:null}}function bc(xe,Xe,Qe){var nt=Xe.pendingProps,ht=Or.current,mt=!1,St=(Xe.flags&128)!==0,Jt;if((Jt=St)||(Jt=xe!==null&&xe.memoizedState===null?!1:(ht&2)!==0),Jt?(mt=!0,Xe.flags&=-129):(xe===null||xe.memoizedState!==null)&&(ht|=1),Mr(Or,ht&1),xe===null)return Pa(Xe),xe=Xe.memoizedState,xe!==null&&(xe=xe.dehydrated,xe!==null)?((Xe.mode&1)===0?Xe.lanes=1:xe.data==="$!"?Xe.lanes=8:Xe.lanes=1073741824,null):(St=nt.children,xe=nt.fallback,mt?(nt=Xe.mode,mt=Xe.child,St={mode:"hidden",children:St},(nt&1)===0&&mt!==null?(mt.childLanes=0,mt.pendingProps=St):mt=Jo(St,nt,0,null),xe=Pn(xe,nt,Qe,null),mt.return=Xe,xe.return=Xe,mt.sibling=xe,Xe.child=mt,Xe.child.memoizedState=il(Qe),Xe.memoizedState=rl,xe):nl(Xe,St));if(ht=xe.memoizedState,ht!==null&&(Jt=ht.dehydrated,Jt!==null))return vd(xe,Xe,St,nt,Jt,ht,Qe);if(mt){mt=nt.fallback,St=Xe.mode,ht=xe.child,Jt=ht.sibling;var Lt={mode:"hidden",children:nt.children};return(St&1)===0&&Xe.child!==ht?(nt=Xe.child,nt.childLanes=0,nt.pendingProps=Lt,Xe.deletions=null):(nt=fn(ht,Lt),nt.subtreeFlags=ht.subtreeFlags&14680064),Jt!==null?mt=fn(Jt,mt):(mt=Pn(mt,St,Qe,null),mt.flags|=2),mt.return=Xe,nt.return=Xe,nt.sibling=mt,Xe.child=nt,nt=mt,mt=Xe.child,St=xe.child.memoizedState,St=St===null?il(Qe):{baseLanes:St.baseLanes|Qe,cachePool:null,transitions:St.transitions},mt.memoizedState=St,mt.childLanes=xe.childLanes&~Qe,Xe.memoizedState=rl,nt}return mt=xe.child,xe=mt.sibling,nt=fn(mt,{mode:"visible",children:nt.children}),(Xe.mode&1)===0&&(nt.lanes=Qe),nt.return=Xe,nt.sibling=null,xe!==null&&(Qe=Xe.deletions,Qe===null?(Xe.deletions=[xe],Xe.flags|=16):Qe.push(xe)),Xe.child=nt,Xe.memoizedState=null,nt}function nl(xe,Xe){return Xe=Jo({mode:"visible",children:Xe},xe.mode,0,null),Xe.return=xe,xe.child=Xe}function No(xe,Xe,Qe,nt){return nt!==null&&Da(nt),Vn(Xe,xe.child,null,Qe),xe=nl(Xe,Xe.pendingProps.children),xe.flags|=2,Xe.memoizedState=null,xe}function vd(xe,Xe,Qe,nt,ht,mt,St){if(Qe)return Xe.flags&256?(Xe.flags&=-257,nt=Za(Error(G(422))),No(xe,Xe,St,nt)):Xe.memoizedState!==null?(Xe.child=xe.child,Xe.flags|=128,null):(mt=nt.fallback,ht=Xe.mode,nt=Jo({mode:"visible",children:nt.children},ht,0,null),mt=Pn(mt,ht,St,null),mt.flags|=2,nt.return=Xe,mt.return=Xe,nt.sibling=mt,Xe.child=nt,(Xe.mode&1)!==0&&Vn(Xe,xe.child,null,St),Xe.child.memoizedState=il(St),Xe.memoizedState=rl,mt);if((Xe.mode&1)===0)return No(xe,Xe,St,null);if(ht.data==="$!"){if(nt=ht.nextSibling&&ht.nextSibling.dataset,nt)var Jt=nt.dgst;return nt=Jt,mt=Error(G(419)),nt=Za(mt,nt,void 0),No(xe,Xe,St,nt)}if(Jt=(St&xe.childLanes)!==0,ni||Jt){if(nt=Lr,nt!==null){switch(St&-St){case 4:ht=2;break;case 16:ht=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:ht=32;break;case 536870912:ht=268435456;break;default:ht=0}ht=(ht&(nt.suspendedLanes|St))!==0?0:ht,ht!==0&&ht!==mt.retryLane&&(mt.retryLane=ht,Li(xe,ht),Si(nt,xe,ht,-1))}return bl(),nt=Za(Error(G(421))),No(xe,Xe,St,nt)}return ht.data==="$?"?(Xe.flags|=128,Xe.child=xe.child,Xe=Pd.bind(null,xe),ht._reactRetry=Xe,null):(xe=mt.treeContext,ui=en(ht.nextSibling),li=Xe,Dr=!0,_i=null,xe!==null&&(di[fi++]=Fi,di[fi++]=Bi,di[fi++]=Cn,Fi=xe.id,Bi=xe.overflow,Cn=Xe),Xe=nl(Xe,nt.children),Xe.flags|=4096,Xe)}function Cc(xe,Xe,Qe){xe.lanes|=Xe;var nt=xe.alternate;nt!==null&&(nt.lanes|=Xe),Xa(xe.return,Xe,Qe)}function sl(xe,Xe,Qe,nt,ht){var mt=xe.memoizedState;mt===null?xe.memoizedState={isBackwards:Xe,rendering:null,renderingStartTime:0,last:nt,tail:Qe,tailMode:ht}:(mt.isBackwards=Xe,mt.rendering=null,mt.renderingStartTime=0,mt.last=nt,mt.tail=Qe,mt.tailMode=ht)}function _c(xe,Xe,Qe){var nt=Xe.pendingProps,ht=nt.revealOrder,mt=nt.tail;if(Qr(xe,Xe,nt.children,Qe),nt=Or.current,(nt&2)!==0)nt=nt&1|2,Xe.flags|=128;else{if(xe!==null&&(xe.flags&128)!==0)e:for(xe=Xe.child;xe!==null;){if(xe.tag===13)xe.memoizedState!==null&&Cc(xe,Qe,Xe);else if(xe.tag===19)Cc(xe,Qe,Xe);else if(xe.child!==null){xe.child.return=xe,xe=xe.child;continue}if(xe===Xe)break e;for(;xe.sibling===null;){if(xe.return===null||xe.return===Xe)break e;xe=xe.return}xe.sibling.return=xe.return,xe=xe.sibling}nt&=1}if(Mr(Or,nt),(Xe.mode&1)===0)Xe.memoizedState=null;else switch(ht){case"forwards":for(Qe=Xe.child,ht=null;Qe!==null;)xe=Qe.alternate,xe!==null&&yo(xe)===null&&(ht=Qe),Qe=Qe.sibling;Qe=ht,Qe===null?(ht=Xe.child,Xe.child=null):(ht=Qe.sibling,Qe.sibling=null),sl(Xe,!1,ht,Qe,mt);break;case"backwards":for(Qe=null,ht=Xe.child,Xe.child=null;ht!==null;){if(xe=ht.alternate,xe!==null&&yo(xe)===null){Xe.child=ht;break}xe=ht.sibling,ht.sibling=Qe,Qe=ht,ht=xe}sl(Xe,!0,Qe,null,mt);break;case"together":sl(Xe,!1,null,null,void 0);break;default:Xe.memoizedState=null}return Xe.child}function So(xe,Xe){(Xe.mode&1)===0&&xe!==null&&(xe.alternate=null,Xe.alternate=null,Xe.flags|=2)}function zi(xe,Xe,Qe){if(xe!==null&&(Xe.dependencies=xe.dependencies),Sn|=Xe.lanes,(Qe&Xe.childLanes)===0)return null;if(xe!==null&&Xe.child!==xe.child)throw Error(G(153));if(Xe.child!==null){for(xe=Xe.child,Qe=fn(xe,xe.pendingProps),Xe.child=Qe,Qe.return=Xe;xe.sibling!==null;)xe=xe.sibling,Qe=Qe.sibling=fn(xe,xe.pendingProps),Qe.return=Xe;Qe.sibling=null}return Xe.child}function yd(xe,Xe,Qe){switch(Xe.tag){case 3:yc(Xe),zn();break;case 5:Ru(Xe);break;case 1:ii(Xe.type)&&ao(Xe);break;case 4:Ja(Xe,Xe.stateNode.containerInfo);break;case 10:var nt=Xe.type._context,ht=Xe.memoizedProps.value;Mr(po,nt._currentValue),nt._currentValue=ht;break;case 13:if(nt=Xe.memoizedState,nt!==null)return nt.dehydrated!==null?(Mr(Or,Or.current&1),Xe.flags|=128,null):(Qe&Xe.child.childLanes)!==0?bc(xe,Xe,Qe):(Mr(Or,Or.current&1),xe=zi(xe,Xe,Qe),xe!==null?xe.sibling:null);Mr(Or,Or.current&1);break;case 19:if(nt=(Qe&Xe.childLanes)!==0,(xe.flags&128)!==0){if(nt)return _c(xe,Xe,Qe);Xe.flags|=128}if(ht=Xe.memoizedState,ht!==null&&(ht.rendering=null,ht.tail=null,ht.lastEffect=null),Mr(Or,Or.current),nt)break;return null;case 22:case 23:return Xe.lanes=0,mc(xe,Xe,Qe)}return zi(xe,Xe,Qe)}var wc,ol,Ec,Nc;wc=function(xe,Xe){for(var Qe=Xe.child;Qe!==null;){if(Qe.tag===5||Qe.tag===6)xe.appendChild(Qe.stateNode);else if(Qe.tag!==4&&Qe.child!==null){Qe.child.return=Qe,Qe=Qe.child;continue}if(Qe===Xe)break;for(;Qe.sibling===null;){if(Qe.return===null||Qe.return===Xe)return;Qe=Qe.return}Qe.sibling.return=Qe.return,Qe=Qe.sibling}},ol=function(){},Ec=function(xe,Xe,Qe,nt){var ht=xe.memoizedProps;if(ht!==nt){xe=Xe.stateNode,En(Ti.current);var mt=null;switch(Qe){case"input":ht=tr(xe,ht),nt=tr(xe,nt),mt=[];break;case"select":ht=vt({},ht,{value:void 0}),nt=vt({},nt,{value:void 0}),mt=[];break;case"textarea":ht=jt(xe,ht),nt=jt(xe,nt),mt=[];break;default:typeof ht.onClick!="function"&&typeof nt.onClick=="function"&&(xe.onclick=no)}nr(Qe,nt);var St;Qe=null;for(rr in ht)if(!nt.hasOwnProperty(rr)&&ht.hasOwnProperty(rr)&&ht[rr]!=null)if(rr==="style"){var Jt=ht[rr];for(St in Jt)Jt.hasOwnProperty(St)&&(Qe||(Qe={}),Qe[St]="")}else rr!=="dangerouslySetInnerHTML"&&rr!=="children"&&rr!=="suppressContentEditableWarning"&&rr!=="suppressHydrationWarning"&&rr!=="autoFocus"&&(q.hasOwnProperty(rr)?mt||(mt=[]):(mt=mt||[]).push(rr,null));for(rr in nt){var Lt=nt[rr];if(Jt=ht!=null?ht[rr]:void 0,nt.hasOwnProperty(rr)&&Lt!==Jt&&(Lt!=null||Jt!=null))if(rr==="style")if(Jt){for(St in Jt)!Jt.hasOwnProperty(St)||Lt&&Lt.hasOwnProperty(St)||(Qe||(Qe={}),Qe[St]="");for(St in Lt)Lt.hasOwnProperty(St)&&Jt[St]!==Lt[St]&&(Qe||(Qe={}),Qe[St]=Lt[St])}else Qe||(mt||(mt=[]),mt.push(rr,Qe)),Qe=Lt;else rr==="dangerouslySetInnerHTML"?(Lt=Lt?Lt.__html:void 0,Jt=Jt?Jt.__html:void 0,Lt!=null&&Jt!==Lt&&(mt=mt||[]).push(rr,Lt)):rr==="children"?typeof Lt!="string"&&typeof Lt!="number"||(mt=mt||[]).push(rr,""+Lt):rr!=="suppressContentEditableWarning"&&rr!=="suppressHydrationWarning"&&(q.hasOwnProperty(rr)?(Lt!=null&&rr==="onScroll"&&$r("scroll",xe),mt||Jt===Lt||(mt=[])):(mt=mt||[]).push(rr,Lt))}Qe&&(mt=mt||[]).push("style",Qe);var rr=mt;(Xe.updateQueue=rr)&&(Xe.flags|=4)}},Nc=function(xe,Xe,Qe,nt){Qe!==nt&&(Xe.flags|=4)};function Ms(xe,Xe){if(!Dr)switch(xe.tailMode){case"hidden":Xe=xe.tail;for(var Qe=null;Xe!==null;)Xe.alternate!==null&&(Qe=Xe),Xe=Xe.sibling;Qe===null?xe.tail=null:Qe.sibling=null;break;case"collapsed":Qe=xe.tail;for(var nt=null;Qe!==null;)Qe.alternate!==null&&(nt=Qe),Qe=Qe.sibling;nt===null?Xe||xe.tail===null?xe.tail=null:xe.tail.sibling=null:nt.sibling=null}}function Wr(xe){var Xe=xe.alternate!==null&&xe.alternate.child===xe.child,Qe=0,nt=0;if(Xe)for(var ht=xe.child;ht!==null;)Qe|=ht.lanes|ht.childLanes,nt|=ht.subtreeFlags&14680064,nt|=ht.flags&14680064,ht.return=xe,ht=ht.sibling;else for(ht=xe.child;ht!==null;)Qe|=ht.lanes|ht.childLanes,nt|=ht.subtreeFlags,nt|=ht.flags,ht.return=xe,ht=ht.sibling;return xe.subtreeFlags|=nt,xe.childLanes=Qe,Xe}function xd(xe,Xe,Qe){var nt=Xe.pendingProps;switch(Ma(Xe),Xe.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wr(Xe),null;case 1:return ii(Xe.type)&&oo(),Wr(Xe),null;case 3:return nt=Xe.stateNode,Yn(),Pr(ri),Pr(Yr),Ba(),nt.pendingContext&&(nt.context=nt.pendingContext,nt.pendingContext=null),(xe===null||xe.child===null)&&(ho(Xe)?Xe.flags|=4:xe===null||xe.memoizedState.isDehydrated&&(Xe.flags&256)===0||(Xe.flags|=1024,_i!==null&&(vl(_i),_i=null))),ol(xe,Xe),Wr(Xe),null;case 5:Ia(Xe);var ht=En(ws.current);if(Qe=Xe.type,xe!==null&&Xe.stateNode!=null)Ec(xe,Xe,Qe,nt,ht),xe.ref!==Xe.ref&&(Xe.flags|=512,Xe.flags|=2097152);else{if(!nt){if(Xe.stateNode===null)throw Error(G(166));return Wr(Xe),null}if(xe=En(Ti.current),ho(Xe)){nt=Xe.stateNode,Qe=Xe.type;var mt=Xe.memoizedProps;switch(nt[Oi]=Xe,nt[ys]=mt,xe=(Xe.mode&1)!==0,Qe){case"dialog":$r("cancel",nt),$r("close",nt);break;case"iframe":case"object":case"embed":$r("load",nt);break;case"video":case"audio":for(ht=0;ht<ms.length;ht++)$r(ms[ht],nt);break;case"source":$r("error",nt);break;case"img":case"image":case"link":$r("error",nt),$r("load",nt);break;case"details":$r("toggle",nt);break;case"input":bt(nt,mt),$r("invalid",nt);break;case"select":nt._wrapperState={wasMultiple:!!mt.multiple},$r("invalid",nt);break;case"textarea":wt(nt,mt),$r("invalid",nt)}nr(Qe,mt),ht=null;for(var St in mt)if(mt.hasOwnProperty(St)){var Jt=mt[St];St==="children"?typeof Jt=="string"?nt.textContent!==Jt&&(mt.suppressHydrationWarning!==!0&&io(nt.textContent,Jt,xe),ht=["children",Jt]):typeof Jt=="number"&&nt.textContent!==""+Jt&&(mt.suppressHydrationWarning!==!0&&io(nt.textContent,Jt,xe),ht=["children",""+Jt]):q.hasOwnProperty(St)&&Jt!=null&&St==="onScroll"&&$r("scroll",nt)}switch(Qe){case"input":Ht(nt),At(nt,mt,!0);break;case"textarea":Ht(nt),Tt(nt);break;case"select":case"option":break;default:typeof mt.onClick=="function"&&(nt.onclick=no)}nt=ht,Xe.updateQueue=nt,nt!==null&&(Xe.flags|=4)}else{St=ht.nodeType===9?ht:ht.ownerDocument,xe==="http://www.w3.org/1999/xhtml"&&(xe=Rt(Qe)),xe==="http://www.w3.org/1999/xhtml"?Qe==="script"?(xe=St.createElement("div"),xe.innerHTML="<script><\/script>",xe=xe.removeChild(xe.firstChild)):typeof nt.is=="string"?xe=St.createElement(Qe,{is:nt.is}):(xe=St.createElement(Qe),Qe==="select"&&(St=xe,nt.multiple?St.multiple=!0:nt.size&&(St.size=nt.size))):xe=St.createElementNS(xe,Qe),xe[Oi]=Xe,xe[ys]=nt,wc(xe,Xe,!1,!1),Xe.stateNode=xe;e:{switch(St=gt(Qe,nt),Qe){case"dialog":$r("cancel",xe),$r("close",xe),ht=nt;break;case"iframe":case"object":case"embed":$r("load",xe),ht=nt;break;case"video":case"audio":for(ht=0;ht<ms.length;ht++)$r(ms[ht],xe);ht=nt;break;case"source":$r("error",xe),ht=nt;break;case"img":case"image":case"link":$r("error",xe),$r("load",xe),ht=nt;break;case"details":$r("toggle",xe),ht=nt;break;case"input":bt(xe,nt),ht=tr(xe,nt),$r("invalid",xe);break;case"option":ht=nt;break;case"select":xe._wrapperState={wasMultiple:!!nt.multiple},ht=vt({},nt,{value:void 0}),$r("invalid",xe);break;case"textarea":wt(xe,nt),ht=jt(xe,nt),$r("invalid",xe);break;default:ht=nt}nr(Qe,ht),Jt=ht;for(mt in Jt)if(Jt.hasOwnProperty(mt)){var Lt=Jt[mt];mt==="style"?hr(xe,Lt):mt==="dangerouslySetInnerHTML"?(Lt=Lt?Lt.__html:void 0,Lt!=null&&Zt(xe,Lt)):mt==="children"?typeof Lt=="string"?(Qe!=="textarea"||Lt!=="")&&Wt(xe,Lt):typeof Lt=="number"&&Wt(xe,""+Lt):mt!=="suppressContentEditableWarning"&&mt!=="suppressHydrationWarning"&&mt!=="autoFocus"&&(q.hasOwnProperty(mt)?Lt!=null&&mt==="onScroll"&&$r("scroll",xe):Lt!=null&&Ce(xe,mt,Lt,St))}switch(Qe){case"input":Ht(xe),At(xe,nt,!1);break;case"textarea":Ht(xe),Tt(xe);break;case"option":nt.value!=null&&xe.setAttribute("value",""+Ot(nt.value));break;case"select":xe.multiple=!!nt.multiple,mt=nt.value,mt!=null?kt(xe,!!nt.multiple,mt,!1):nt.defaultValue!=null&&kt(xe,!!nt.multiple,nt.defaultValue,!0);break;default:typeof ht.onClick=="function"&&(xe.onclick=no)}switch(Qe){case"button":case"input":case"select":case"textarea":nt=!!nt.autoFocus;break e;case"img":nt=!0;break e;default:nt=!1}}nt&&(Xe.flags|=4)}Xe.ref!==null&&(Xe.flags|=512,Xe.flags|=2097152)}return Wr(Xe),null;case 6:if(xe&&Xe.stateNode!=null)Nc(xe,Xe,xe.memoizedProps,nt);else{if(typeof nt!="string"&&Xe.stateNode===null)throw Error(G(166));if(Qe=En(ws.current),En(Ti.current),ho(Xe)){if(nt=Xe.stateNode,Qe=Xe.memoizedProps,nt[Oi]=Xe,(mt=nt.nodeValue!==Qe)&&(xe=li,xe!==null))switch(xe.tag){case 3:io(nt.nodeValue,Qe,(xe.mode&1)!==0);break;case 5:xe.memoizedProps.suppressHydrationWarning!==!0&&io(nt.nodeValue,Qe,(xe.mode&1)!==0)}mt&&(Xe.flags|=4)}else nt=(Qe.nodeType===9?Qe:Qe.ownerDocument).createTextNode(nt),nt[Oi]=Xe,Xe.stateNode=nt}return Wr(Xe),null;case 13:if(Pr(Or),nt=Xe.memoizedState,xe===null||xe.memoizedState!==null&&xe.memoizedState.dehydrated!==null){if(Dr&&ui!==null&&(Xe.mode&1)!==0&&(Xe.flags&128)===0)Mu(),zn(),Xe.flags|=98560,mt=!1;else if(mt=ho(Xe),nt!==null&&nt.dehydrated!==null){if(xe===null){if(!mt)throw Error(G(318));if(mt=Xe.memoizedState,mt=mt!==null?mt.dehydrated:null,!mt)throw Error(G(317));mt[Oi]=Xe}else zn(),(Xe.flags&128)===0&&(Xe.memoizedState=null),Xe.flags|=4;Wr(Xe),mt=!1}else _i!==null&&(vl(_i),_i=null),mt=!0;if(!mt)return Xe.flags&65536?Xe:null}return(Xe.flags&128)!==0?(Xe.lanes=Qe,Xe):(nt=nt!==null,nt!==(xe!==null&&xe.memoizedState!==null)&&nt&&(Xe.child.flags|=8192,(Xe.mode&1)!==0&&(xe===null||(Or.current&1)!==0?Ir===0&&(Ir=3):bl())),Xe.updateQueue!==null&&(Xe.flags|=4),Wr(Xe),null);case 4:return Yn(),ol(xe,Xe),xe===null&&gs(Xe.stateNode.containerInfo),Wr(Xe),null;case 10:return Ga(Xe.type._context),Wr(Xe),null;case 17:return ii(Xe.type)&&oo(),Wr(Xe),null;case 19:if(Pr(Or),mt=Xe.memoizedState,mt===null)return Wr(Xe),null;if(nt=(Xe.flags&128)!==0,St=mt.rendering,St===null)if(nt)Ms(mt,!1);else{if(Ir!==0||xe!==null&&(xe.flags&128)!==0)for(xe=Xe.child;xe!==null;){if(St=yo(xe),St!==null){for(Xe.flags|=128,Ms(mt,!1),nt=St.updateQueue,nt!==null&&(Xe.updateQueue=nt,Xe.flags|=4),Xe.subtreeFlags=0,nt=Qe,Qe=Xe.child;Qe!==null;)mt=Qe,xe=nt,mt.flags&=14680066,St=mt.alternate,St===null?(mt.childLanes=0,mt.lanes=xe,mt.child=null,mt.subtreeFlags=0,mt.memoizedProps=null,mt.memoizedState=null,mt.updateQueue=null,mt.dependencies=null,mt.stateNode=null):(mt.childLanes=St.childLanes,mt.lanes=St.lanes,mt.child=St.child,mt.subtreeFlags=0,mt.deletions=null,mt.memoizedProps=St.memoizedProps,mt.memoizedState=St.memoizedState,mt.updateQueue=St.updateQueue,mt.type=St.type,xe=St.dependencies,mt.dependencies=xe===null?null:{lanes:xe.lanes,firstContext:xe.firstContext}),Qe=Qe.sibling;return Mr(Or,Or.current&1|2),Xe.child}xe=xe.sibling}mt.tail!==null&&_r()>Zn&&(Xe.flags|=128,nt=!0,Ms(mt,!1),Xe.lanes=4194304)}else{if(!nt)if(xe=yo(St),xe!==null){if(Xe.flags|=128,nt=!0,Qe=xe.updateQueue,Qe!==null&&(Xe.updateQueue=Qe,Xe.flags|=4),Ms(mt,!0),mt.tail===null&&mt.tailMode==="hidden"&&!St.alternate&&!Dr)return Wr(Xe),null}else 2*_r()-mt.renderingStartTime>Zn&&Qe!==1073741824&&(Xe.flags|=128,nt=!0,Ms(mt,!1),Xe.lanes=4194304);mt.isBackwards?(St.sibling=Xe.child,Xe.child=St):(Qe=mt.last,Qe!==null?Qe.sibling=St:Xe.child=St,mt.last=St)}return mt.tail!==null?(Xe=mt.tail,mt.rendering=Xe,mt.tail=Xe.sibling,mt.renderingStartTime=_r(),Xe.sibling=null,Qe=Or.current,Mr(Or,nt?Qe&1|2:Qe&1),Xe):(Wr(Xe),null);case 22:case 23:return xl(),nt=Xe.memoizedState!==null,xe!==null&&xe.memoizedState!==null!==nt&&(Xe.flags|=8192),nt&&(Xe.mode&1)!==0?(ci&1073741824)!==0&&(Wr(Xe),Xe.subtreeFlags&6&&(Xe.flags|=8192)):Wr(Xe),null;case 24:return null;case 25:return null}throw Error(G(156,Xe.tag))}function bd(xe,Xe){switch(Ma(Xe),Xe.tag){case 1:return ii(Xe.type)&&oo(),xe=Xe.flags,xe&65536?(Xe.flags=xe&-65537|128,Xe):null;case 3:return Yn(),Pr(ri),Pr(Yr),Ba(),xe=Xe.flags,(xe&65536)!==0&&(xe&128)===0?(Xe.flags=xe&-65537|128,Xe):null;case 5:return Ia(Xe),null;case 13:if(Pr(Or),xe=Xe.memoizedState,xe!==null&&xe.dehydrated!==null){if(Xe.alternate===null)throw Error(G(340));zn()}return xe=Xe.flags,xe&65536?(Xe.flags=xe&-65537|128,Xe):null;case 19:return Pr(Or),null;case 4:return Yn(),null;case 10:return Ga(Xe.type._context),null;case 22:case 23:return xl(),null;case 24:return null;default:return null}}var Ao=!1,Kr=!1,Cd=typeof WeakSet=="function"?WeakSet:Set,pr=null;function Wn(xe,Xe){var Qe=xe.ref;if(Qe!==null)if(typeof Qe=="function")try{Qe(null)}catch(nt){Gr(xe,Xe,nt)}else Qe.current=null}function al(xe,Xe,Qe){try{Qe()}catch(nt){Gr(xe,Xe,nt)}}var Sc=!1;function _d(xe,Xe){if(xa=Us,xe=nu(),ha(xe)){if("selectionStart"in xe)var Qe={start:xe.selectionStart,end:xe.selectionEnd};else e:{Qe=(Qe=xe.ownerDocument)&&Qe.defaultView||window;var nt=Qe.getSelection&&Qe.getSelection();if(nt&&nt.rangeCount!==0){Qe=nt.anchorNode;var ht=nt.anchorOffset,mt=nt.focusNode;nt=nt.focusOffset;try{Qe.nodeType,mt.nodeType}catch{Qe=null;break e}var St=0,Jt=-1,Lt=-1,rr=0,ur=0,cr=xe,lr=null;t:for(;;){for(var fr;cr!==Qe||ht!==0&&cr.nodeType!==3||(Jt=St+ht),cr!==mt||nt!==0&&cr.nodeType!==3||(Lt=St+nt),cr.nodeType===3&&(St+=cr.nodeValue.length),(fr=cr.firstChild)!==null;)lr=cr,cr=fr;for(;;){if(cr===xe)break t;if(lr===Qe&&++rr===ht&&(Jt=St),lr===mt&&++ur===nt&&(Lt=St),(fr=cr.nextSibling)!==null)break;cr=lr,lr=cr.parentNode}cr=fr}Qe=Jt===-1||Lt===-1?null:{start:Jt,end:Lt}}else Qe=null}Qe=Qe||{start:0,end:0}}else Qe=null;for(ba={focusedElem:xe,selectionRange:Qe},Us=!1,pr=Xe;pr!==null;)if(Xe=pr,xe=Xe.child,(Xe.subtreeFlags&1028)!==0&&xe!==null)xe.return=Xe,pr=xe;else for(;pr!==null;){Xe=pr;try{var mr=Xe.alternate;if((Xe.flags&1024)!==0)switch(Xe.tag){case 0:case 11:case 15:break;case 1:if(mr!==null){var gr=mr.memoizedProps,Xr=mr.memoizedState,Kt=Xe.stateNode,Vt=Kt.getSnapshotBeforeUpdate(Xe.elementType===Xe.type?gr:wi(Xe.type,gr),Xr);Kt.__reactInternalSnapshotBeforeUpdate=Vt}break;case 3:var er=Xe.stateNode.containerInfo;er.nodeType===1?er.textContent="":er.nodeType===9&&er.documentElement&&er.removeChild(er.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(G(163))}}catch(dr){Gr(Xe,Xe.return,dr)}if(xe=Xe.sibling,xe!==null){xe.return=Xe.return,pr=xe;break}pr=Xe.return}return mr=Sc,Sc=!1,mr}function $s(xe,Xe,Qe){var nt=Xe.updateQueue;if(nt=nt!==null?nt.lastEffect:null,nt!==null){var ht=nt=nt.next;do{if((ht.tag&xe)===xe){var mt=ht.destroy;ht.destroy=void 0,mt!==void 0&&al(Xe,Qe,mt)}ht=ht.next}while(ht!==nt)}}function Mo(xe,Xe){if(Xe=Xe.updateQueue,Xe=Xe!==null?Xe.lastEffect:null,Xe!==null){var Qe=Xe=Xe.next;do{if((Qe.tag&xe)===xe){var nt=Qe.create;Qe.destroy=nt()}Qe=Qe.next}while(Qe!==Xe)}}function ll(xe){var Xe=xe.ref;if(Xe!==null){var Qe=xe.stateNode;switch(xe.tag){case 5:xe=Qe;break;default:xe=Qe}typeof Xe=="function"?Xe(xe):Xe.current=xe}}function Ac(xe){var Xe=xe.alternate;Xe!==null&&(xe.alternate=null,Ac(Xe)),xe.child=null,xe.deletions=null,xe.sibling=null,xe.tag===5&&(Xe=xe.stateNode,Xe!==null&&(delete Xe[Oi],delete Xe[ys],delete Xe[Ea],delete Xe[nd],delete Xe[sd])),xe.stateNode=null,xe.return=null,xe.dependencies=null,xe.memoizedProps=null,xe.memoizedState=null,xe.pendingProps=null,xe.stateNode=null,xe.updateQueue=null}function Mc(xe){return xe.tag===5||xe.tag===3||xe.tag===4}function $c(xe){e:for(;;){for(;xe.sibling===null;){if(xe.return===null||Mc(xe.return))return null;xe=xe.return}for(xe.sibling.return=xe.return,xe=xe.sibling;xe.tag!==5&&xe.tag!==6&&xe.tag!==18;){if(xe.flags&2||xe.child===null||xe.tag===4)continue e;xe.child.return=xe,xe=xe.child}if(!(xe.flags&2))return xe.stateNode}}function ul(xe,Xe,Qe){var nt=xe.tag;if(nt===5||nt===6)xe=xe.stateNode,Xe?Qe.nodeType===8?Qe.parentNode.insertBefore(xe,Xe):Qe.insertBefore(xe,Xe):(Qe.nodeType===8?(Xe=Qe.parentNode,Xe.insertBefore(xe,Qe)):(Xe=Qe,Xe.appendChild(xe)),Qe=Qe._reactRootContainer,Qe!=null||Xe.onclick!==null||(Xe.onclick=no));else if(nt!==4&&(xe=xe.child,xe!==null))for(ul(xe,Xe,Qe),xe=xe.sibling;xe!==null;)ul(xe,Xe,Qe),xe=xe.sibling}function cl(xe,Xe,Qe){var nt=xe.tag;if(nt===5||nt===6)xe=xe.stateNode,Xe?Qe.insertBefore(xe,Xe):Qe.appendChild(xe);else if(nt!==4&&(xe=xe.child,xe!==null))for(cl(xe,Xe,Qe),xe=xe.sibling;xe!==null;)cl(xe,Xe,Qe),xe=xe.sibling}var zr=null,Ei=!1;function an(xe,Xe,Qe){for(Qe=Qe.child;Qe!==null;)Pc(xe,Xe,Qe),Qe=Qe.sibling}function Pc(xe,Xe,Qe){if(Di&&typeof Di.onCommitFiberUnmount=="function")try{Di.onCommitFiberUnmount(Fs,Qe)}catch{}switch(Qe.tag){case 5:Kr||Wn(Qe,Xe);case 6:var nt=zr,ht=Ei;zr=null,an(xe,Xe,Qe),zr=nt,Ei=ht,zr!==null&&(Ei?(xe=zr,Qe=Qe.stateNode,xe.nodeType===8?xe.parentNode.removeChild(Qe):xe.removeChild(Qe)):zr.removeChild(Qe.stateNode));break;case 18:zr!==null&&(Ei?(xe=zr,Qe=Qe.stateNode,xe.nodeType===8?wa(xe.parentNode,Qe):xe.nodeType===1&&wa(xe,Qe),as(xe)):wa(zr,Qe.stateNode));break;case 4:nt=zr,ht=Ei,zr=Qe.stateNode.containerInfo,Ei=!0,an(xe,Xe,Qe),zr=nt,Ei=ht;break;case 0:case 11:case 14:case 15:if(!Kr&&(nt=Qe.updateQueue,nt!==null&&(nt=nt.lastEffect,nt!==null))){ht=nt=nt.next;do{var mt=ht,St=mt.destroy;mt=mt.tag,St!==void 0&&((mt&2)!==0||(mt&4)!==0)&&al(Qe,Xe,St),ht=ht.next}while(ht!==nt)}an(xe,Xe,Qe);break;case 1:if(!Kr&&(Wn(Qe,Xe),nt=Qe.stateNode,typeof nt.componentWillUnmount=="function"))try{nt.props=Qe.memoizedProps,nt.state=Qe.memoizedState,nt.componentWillUnmount()}catch(Jt){Gr(Qe,Xe,Jt)}an(xe,Xe,Qe);break;case 21:an(xe,Xe,Qe);break;case 22:Qe.mode&1?(Kr=(nt=Kr)||Qe.memoizedState!==null,an(xe,Xe,Qe),Kr=nt):an(xe,Xe,Qe);break;default:an(xe,Xe,Qe)}}function Dc(xe){var Xe=xe.updateQueue;if(Xe!==null){xe.updateQueue=null;var Qe=xe.stateNode;Qe===null&&(Qe=xe.stateNode=new Cd),Xe.forEach(function(nt){var ht=Dd.bind(null,xe,nt);Qe.has(nt)||(Qe.add(nt),nt.then(ht,ht))})}}function Ni(xe,Xe){var Qe=Xe.deletions;if(Qe!==null)for(var nt=0;nt<Qe.length;nt++){var ht=Qe[nt];try{var mt=xe,St=Xe,Jt=St;e:for(;Jt!==null;){switch(Jt.tag){case 5:zr=Jt.stateNode,Ei=!1;break e;case 3:zr=Jt.stateNode.containerInfo,Ei=!0;break e;case 4:zr=Jt.stateNode.containerInfo,Ei=!0;break e}Jt=Jt.return}if(zr===null)throw Error(G(160));Pc(mt,St,ht),zr=null,Ei=!1;var Lt=ht.alternate;Lt!==null&&(Lt.return=null),ht.return=null}catch(rr){Gr(ht,Xe,rr)}}if(Xe.subtreeFlags&12854)for(Xe=Xe.child;Xe!==null;)Oc(Xe,xe),Xe=Xe.sibling}function Oc(xe,Xe){var Qe=xe.alternate,nt=xe.flags;switch(xe.tag){case 0:case 11:case 14:case 15:if(Ni(Xe,xe),Xi(xe),nt&4){try{$s(3,xe,xe.return),Mo(3,xe)}catch(gr){Gr(xe,xe.return,gr)}try{$s(5,xe,xe.return)}catch(gr){Gr(xe,xe.return,gr)}}break;case 1:Ni(Xe,xe),Xi(xe),nt&512&&Qe!==null&&Wn(Qe,Qe.return);break;case 5:if(Ni(Xe,xe),Xi(xe),nt&512&&Qe!==null&&Wn(Qe,Qe.return),xe.flags&32){var ht=xe.stateNode;try{Wt(ht,"")}catch(gr){Gr(xe,xe.return,gr)}}if(nt&4&&(ht=xe.stateNode,ht!=null)){var mt=xe.memoizedProps,St=Qe!==null?Qe.memoizedProps:mt,Jt=xe.type,Lt=xe.updateQueue;if(xe.updateQueue=null,Lt!==null)try{Jt==="input"&&mt.type==="radio"&&mt.name!=null&&_t(ht,mt),gt(Jt,St);var rr=gt(Jt,mt);for(St=0;St<Lt.length;St+=2){var ur=Lt[St],cr=Lt[St+1];ur==="style"?hr(ht,cr):ur==="dangerouslySetInnerHTML"?Zt(ht,cr):ur==="children"?Wt(ht,cr):Ce(ht,ur,cr,rr)}switch(Jt){case"input":Xt(ht,mt);break;case"textarea":Mt(ht,mt);break;case"select":var lr=ht._wrapperState.wasMultiple;ht._wrapperState.wasMultiple=!!mt.multiple;var fr=mt.value;fr!=null?kt(ht,!!mt.multiple,fr,!1):lr!==!!mt.multiple&&(mt.defaultValue!=null?kt(ht,!!mt.multiple,mt.defaultValue,!0):kt(ht,!!mt.multiple,mt.multiple?[]:"",!1))}ht[ys]=mt}catch(gr){Gr(xe,xe.return,gr)}}break;case 6:if(Ni(Xe,xe),Xi(xe),nt&4){if(xe.stateNode===null)throw Error(G(162));ht=xe.stateNode,mt=xe.memoizedProps;try{ht.nodeValue=mt}catch(gr){Gr(xe,xe.return,gr)}}break;case 3:if(Ni(Xe,xe),Xi(xe),nt&4&&Qe!==null&&Qe.memoizedState.isDehydrated)try{as(Xe.containerInfo)}catch(gr){Gr(xe,xe.return,gr)}break;case 4:Ni(Xe,xe),Xi(xe);break;case 13:Ni(Xe,xe),Xi(xe),ht=xe.child,ht.flags&8192&&(mt=ht.memoizedState!==null,ht.stateNode.isHidden=mt,!mt||ht.alternate!==null&&ht.alternate.memoizedState!==null||(fl=_r())),nt&4&&Dc(xe);break;case 22:if(ur=Qe!==null&&Qe.memoizedState!==null,xe.mode&1?(Kr=(rr=Kr)||ur,Ni(Xe,xe),Kr=rr):Ni(Xe,xe),Xi(xe),nt&8192){if(rr=xe.memoizedState!==null,(xe.stateNode.isHidden=rr)&&!ur&&(xe.mode&1)!==0)for(pr=xe,ur=xe.child;ur!==null;){for(cr=pr=ur;pr!==null;){switch(lr=pr,fr=lr.child,lr.tag){case 0:case 11:case 14:case 15:$s(4,lr,lr.return);break;case 1:Wn(lr,lr.return);var mr=lr.stateNode;if(typeof mr.componentWillUnmount=="function"){nt=lr,Qe=lr.return;try{Xe=nt,mr.props=Xe.memoizedProps,mr.state=Xe.memoizedState,mr.componentWillUnmount()}catch(gr){Gr(nt,Qe,gr)}}break;case 5:Wn(lr,lr.return);break;case 22:if(lr.memoizedState!==null){Xc(cr);continue}}fr!==null?(fr.return=lr,pr=fr):Xc(cr)}ur=ur.sibling}e:for(ur=null,cr=xe;;){if(cr.tag===5){if(ur===null){ur=cr;try{ht=cr.stateNode,rr?(mt=ht.style,typeof mt.setProperty=="function"?mt.setProperty("display","none","important"):mt.display="none"):(Jt=cr.stateNode,Lt=cr.memoizedProps.style,St=Lt!=null&&Lt.hasOwnProperty("display")?Lt.display:null,Jt.style.display=or("display",St))}catch(gr){Gr(xe,xe.return,gr)}}}else if(cr.tag===6){if(ur===null)try{cr.stateNode.nodeValue=rr?"":cr.memoizedProps}catch(gr){Gr(xe,xe.return,gr)}}else if((cr.tag!==22&&cr.tag!==23||cr.memoizedState===null||cr===xe)&&cr.child!==null){cr.child.return=cr,cr=cr.child;continue}if(cr===xe)break e;for(;cr.sibling===null;){if(cr.return===null||cr.return===xe)break e;ur===cr&&(ur=null),cr=cr.return}ur===cr&&(ur=null),cr.sibling.return=cr.return,cr=cr.sibling}}break;case 19:Ni(Xe,xe),Xi(xe),nt&4&&Dc(xe);break;case 21:break;default:Ni(Xe,xe),Xi(xe)}}function Xi(xe){var Xe=xe.flags;if(Xe&2){try{e:{for(var Qe=xe.return;Qe!==null;){if(Mc(Qe)){var nt=Qe;break e}Qe=Qe.return}throw Error(G(160))}switch(nt.tag){case 5:var ht=nt.stateNode;nt.flags&32&&(Wt(ht,""),nt.flags&=-33);var mt=$c(xe);cl(xe,mt,ht);break;case 3:case 4:var St=nt.stateNode.containerInfo,Jt=$c(xe);ul(xe,Jt,St);break;default:throw Error(G(161))}}catch(Lt){Gr(xe,xe.return,Lt)}xe.flags&=-3}Xe&4096&&(xe.flags&=-4097)}function wd(xe,Xe,Qe){pr=xe,Tc(xe)}function Tc(xe,Xe,Qe){for(var nt=(xe.mode&1)!==0;pr!==null;){var ht=pr,mt=ht.child;if(ht.tag===22&&nt){var St=ht.memoizedState!==null||Ao;if(!St){var Jt=ht.alternate,Lt=Jt!==null&&Jt.memoizedState!==null||Kr;Jt=Ao;var rr=Kr;if(Ao=St,(Kr=Lt)&&!rr)for(pr=ht;pr!==null;)St=pr,Lt=St.child,St.tag===22&&St.memoizedState!==null?Rc(ht):Lt!==null?(Lt.return=St,pr=Lt):Rc(ht);for(;mt!==null;)pr=mt,Tc(mt),mt=mt.sibling;pr=ht,Ao=Jt,Kr=rr}Gc(xe)}else(ht.subtreeFlags&8772)!==0&&mt!==null?(mt.return=ht,pr=mt):Gc(xe)}}function Gc(xe){for(;pr!==null;){var Xe=pr;if((Xe.flags&8772)!==0){var Qe=Xe.alternate;try{if((Xe.flags&8772)!==0)switch(Xe.tag){case 0:case 11:case 15:Kr||Mo(5,Xe);break;case 1:var nt=Xe.stateNode;if(Xe.flags&4&&!Kr)if(Qe===null)nt.componentDidMount();else{var ht=Xe.elementType===Xe.type?Qe.memoizedProps:wi(Xe.type,Qe.memoizedProps);nt.componentDidUpdate(ht,Qe.memoizedState,nt.__reactInternalSnapshotBeforeUpdate)}var mt=Xe.updateQueue;mt!==null&&Xu(Xe,mt,nt);break;case 3:var St=Xe.updateQueue;if(St!==null){if(Qe=null,Xe.child!==null)switch(Xe.child.tag){case 5:Qe=Xe.child.stateNode;break;case 1:Qe=Xe.child.stateNode}Xu(Xe,St,Qe)}break;case 5:var Jt=Xe.stateNode;if(Qe===null&&Xe.flags&4){Qe=Jt;var Lt=Xe.memoizedProps;switch(Xe.type){case"button":case"input":case"select":case"textarea":Lt.autoFocus&&Qe.focus();break;case"img":Lt.src&&(Qe.src=Lt.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(Xe.memoizedState===null){var rr=Xe.alternate;if(rr!==null){var ur=rr.memoizedState;if(ur!==null){var cr=ur.dehydrated;cr!==null&&as(cr)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(G(163))}Kr||Xe.flags&512&&ll(Xe)}catch(lr){Gr(Xe,Xe.return,lr)}}if(Xe===xe){pr=null;break}if(Qe=Xe.sibling,Qe!==null){Qe.return=Xe.return,pr=Qe;break}pr=Xe.return}}function Xc(xe){for(;pr!==null;){var Xe=pr;if(Xe===xe){pr=null;break}var Qe=Xe.sibling;if(Qe!==null){Qe.return=Xe.return,pr=Qe;break}pr=Xe.return}}function Rc(xe){for(;pr!==null;){var Xe=pr;try{switch(Xe.tag){case 0:case 11:case 15:var Qe=Xe.return;try{Mo(4,Xe)}catch(Lt){Gr(Xe,Qe,Lt)}break;case 1:var nt=Xe.stateNode;if(typeof nt.componentDidMount=="function"){var ht=Xe.return;try{nt.componentDidMount()}catch(Lt){Gr(Xe,ht,Lt)}}var mt=Xe.return;try{ll(Xe)}catch(Lt){Gr(Xe,mt,Lt)}break;case 5:var St=Xe.return;try{ll(Xe)}catch(Lt){Gr(Xe,St,Lt)}}}catch(Lt){Gr(Xe,Xe.return,Lt)}if(Xe===xe){pr=null;break}var Jt=Xe.sibling;if(Jt!==null){Jt.return=Xe.return,pr=Jt;break}pr=Xe.return}}var Ed=Math.ceil,$o=Ve.ReactCurrentDispatcher,hl=Ve.ReactCurrentOwner,vi=Ve.ReactCurrentBatchConfig,Nr=0,Lr=null,Rr=null,Vr=0,ci=0,Kn=tn(0),Ir=0,Ps=null,Sn=0,Po=0,dl=0,Ds=null,si=null,fl=0,Zn=1/0,Vi=null,Do=!1,pl=null,un=null,Oo=!1,cn=null,To=0,Os=0,ml=null,Go=-1,Xo=0;function ei(){return(Nr&6)!==0?_r():Go!==-1?Go:Go=_r()}function hn(xe){return(xe.mode&1)===0?1:(Nr&2)!==0&&Vr!==0?Vr&-Vr:ad.transition!==null?(Xo===0&&(Xo=$l()),Xo):(xe=Ar,xe!==0||(xe=window.event,xe=xe===void 0?16:Jl(xe.type)),xe)}function Si(xe,Xe,Qe,nt){if(50<Os)throw Os=0,ml=null,Error(G(185));rs(xe,Qe,nt),((Nr&2)===0||xe!==Lr)&&(xe===Lr&&((Nr&2)===0&&(Po|=Qe),Ir===4&&dn(xe,Vr)),oi(xe,nt),Qe===1&&Nr===0&&(Xe.mode&1)===0&&(Zn=_r()+500,lo&&nn()))}function oi(xe,Xe){var Qe=xe.callbackNode;ah(xe,Xe);var nt=js(xe,xe===Lr?Vr:0);if(nt===0)Qe!==null&&Is(Qe),xe.callbackNode=null,xe.callbackPriority=0;else if(Xe=nt&-nt,xe.callbackPriority!==Xe){if(Qe!=null&&Is(Qe),Xe===1)xe.tag===0?od(Jc.bind(null,xe)):wu(Jc.bind(null,xe)),rd(function(){(Nr&6)===0&&nn()}),Qe=null;else{switch(Pl(nt)){case 1:Qe=es;break;case 4:Qe=yn;break;case 16:Qe=Pi;break;case 536870912:Qe=Ml;break;default:Qe=Pi}Qe=qc(Qe,kc.bind(null,xe))}xe.callbackPriority=Xe,xe.callbackNode=Qe}}function kc(xe,Xe){if(Go=-1,Xo=0,(Nr&6)!==0)throw Error(G(327));var Qe=xe.callbackNode;if(Qn()&&xe.callbackNode!==Qe)return null;var nt=js(xe,xe===Lr?Vr:0);if(nt===0)return null;if((nt&30)!==0||(nt&xe.expiredLanes)!==0||Xe)Xe=Ro(xe,nt);else{Xe=nt;var ht=Nr;Nr|=2;var mt=Fc();(Lr!==xe||Vr!==Xe)&&(Vi=null,Zn=_r()+500,Mn(xe,Xe));do try{Ad();break}catch(Jt){Ic(xe,Jt)}while(!0);Ta(),$o.current=mt,Nr=ht,Rr!==null?Xe=0:(Lr=null,Vr=0,Xe=Ir)}if(Xe!==0){if(Xe===2&&(ht=Ho(xe),ht!==0&&(nt=ht,Xe=gl(xe,ht))),Xe===1)throw Qe=Ps,Mn(xe,0),dn(xe,nt),oi(xe,_r()),Qe;if(Xe===6)dn(xe,nt);else{if(ht=xe.current.alternate,(nt&30)===0&&!Nd(ht)&&(Xe=Ro(xe,nt),Xe===2&&(mt=Ho(xe),mt!==0&&(nt=mt,Xe=gl(xe,mt))),Xe===1))throw Qe=Ps,Mn(xe,0),dn(xe,nt),oi(xe,_r()),Qe;switch(xe.finishedWork=ht,xe.finishedLanes=nt,Xe){case 0:case 1:throw Error(G(345));case 2:$n(xe,si,Vi);break;case 3:if(dn(xe,nt),(nt&130023424)===nt&&(Xe=fl+500-_r(),10<Xe)){if(js(xe,0)!==0)break;if(ht=xe.suspendedLanes,(ht&nt)!==nt){ei(),xe.pingedLanes|=xe.suspendedLanes&ht;break}xe.timeoutHandle=_a($n.bind(null,xe,si,Vi),Xe);break}$n(xe,si,Vi);break;case 4:if(dn(xe,nt),(nt&4194240)===nt)break;for(Xe=xe.eventTimes,ht=-1;0<nt;){var St=31-bi(nt);mt=1<<St,St=Xe[St],St>ht&&(ht=St),nt&=~mt}if(nt=ht,nt=_r()-nt,nt=(120>nt?120:480>nt?480:1080>nt?1080:1920>nt?1920:3e3>nt?3e3:4320>nt?4320:1960*Ed(nt/1960))-nt,10<nt){xe.timeoutHandle=_a($n.bind(null,xe,si,Vi),nt);break}$n(xe,si,Vi);break;case 5:$n(xe,si,Vi);break;default:throw Error(G(329))}}}return oi(xe,_r()),xe.callbackNode===Qe?kc.bind(null,xe):null}function gl(xe,Xe){var Qe=Ds;return xe.current.memoizedState.isDehydrated&&(Mn(xe,Xe).flags|=256),xe=Ro(xe,Xe),xe!==2&&(Xe=si,si=Qe,Xe!==null&&vl(Xe)),xe}function vl(xe){si===null?si=xe:si.push.apply(si,xe)}function Nd(xe){for(var Xe=xe;;){if(Xe.flags&16384){var Qe=Xe.updateQueue;if(Qe!==null&&(Qe=Qe.stores,Qe!==null))for(var nt=0;nt<Qe.length;nt++){var ht=Qe[nt],mt=ht.getSnapshot;ht=ht.value;try{if(!Ci(mt(),ht))return!1}catch{return!1}}}if(Qe=Xe.child,Xe.subtreeFlags&16384&&Qe!==null)Qe.return=Xe,Xe=Qe;else{if(Xe===xe)break;for(;Xe.sibling===null;){if(Xe.return===null||Xe.return===xe)return!0;Xe=Xe.return}Xe.sibling.return=Xe.return,Xe=Xe.sibling}}return!0}function dn(xe,Xe){for(Xe&=~dl,Xe&=~Po,xe.suspendedLanes|=Xe,xe.pingedLanes&=~Xe,xe=xe.expirationTimes;0<Xe;){var Qe=31-bi(Xe),nt=1<<Qe;xe[Qe]=-1,Xe&=~nt}}function Jc(xe){if((Nr&6)!==0)throw Error(G(327));Qn();var Xe=js(xe,0);if((Xe&1)===0)return oi(xe,_r()),null;var Qe=Ro(xe,Xe);if(xe.tag!==0&&Qe===2){var nt=Ho(xe);nt!==0&&(Xe=nt,Qe=gl(xe,nt))}if(Qe===1)throw Qe=Ps,Mn(xe,0),dn(xe,Xe),oi(xe,_r()),Qe;if(Qe===6)throw Error(G(345));return xe.finishedWork=xe.current.alternate,xe.finishedLanes=Xe,$n(xe,si,Vi),oi(xe,_r()),null}function yl(xe,Xe){var Qe=Nr;Nr|=1;try{return xe(Xe)}finally{Nr=Qe,Nr===0&&(Zn=_r()+500,lo&&nn())}}function An(xe){cn!==null&&cn.tag===0&&(Nr&6)===0&&Qn();var Xe=Nr;Nr|=1;var Qe=vi.transition,nt=Ar;try{if(vi.transition=null,Ar=1,xe)return xe()}finally{Ar=nt,vi.transition=Qe,Nr=Xe,(Nr&6)===0&&nn()}}function xl(){ci=Kn.current,Pr(Kn)}function Mn(xe,Xe){xe.finishedWork=null,xe.finishedLanes=0;var Qe=xe.timeoutHandle;if(Qe!==-1&&(xe.timeoutHandle=-1,td(Qe)),Rr!==null)for(Qe=Rr.return;Qe!==null;){var nt=Qe;switch(Ma(nt),nt.tag){case 1:nt=nt.type.childContextTypes,nt!=null&&oo();break;case 3:Yn(),Pr(ri),Pr(Yr),Ba();break;case 5:Ia(nt);break;case 4:Yn();break;case 13:Pr(Or);break;case 19:Pr(Or);break;case 10:Ga(nt.type._context);break;case 22:case 23:xl()}Qe=Qe.return}if(Lr=xe,Rr=xe=fn(xe.current,null),Vr=ci=Xe,Ir=0,Ps=null,dl=Po=Sn=0,si=Ds=null,wn!==null){for(Xe=0;Xe<wn.length;Xe++)if(Qe=wn[Xe],nt=Qe.interleaved,nt!==null){Qe.interleaved=null;var ht=nt.next,mt=Qe.pending;if(mt!==null){var St=mt.next;mt.next=ht,nt.next=St}Qe.pending=nt}wn=null}return xe}function Ic(xe,Xe){do{var Qe=Rr;try{if(Ta(),xo.current=wo,bo){for(var nt=Tr.memoizedState;nt!==null;){var ht=nt.queue;ht!==null&&(ht.pending=null),nt=nt.next}bo=!1}if(Nn=0,Br=Jr=Tr=null,Es=!1,Ns=0,hl.current=null,Qe===null||Qe.return===null){Ir=1,Ps=Xe,Rr=null;break}e:{var mt=xe,St=Qe.return,Jt=Qe,Lt=Xe;if(Xe=Vr,Jt.flags|=32768,Lt!==null&&typeof Lt=="object"&&typeof Lt.then=="function"){var rr=Lt,ur=Jt,cr=ur.tag;if((ur.mode&1)===0&&(cr===0||cr===11||cr===15)){var lr=ur.alternate;lr?(ur.updateQueue=lr.updateQueue,ur.memoizedState=lr.memoizedState,ur.lanes=lr.lanes):(ur.updateQueue=null,ur.memoizedState=null)}var fr=cc(St);if(fr!==null){fr.flags&=-257,hc(fr,St,Jt,mt,Xe),fr.mode&1&&uc(mt,rr,Xe),Xe=fr,Lt=rr;var mr=Xe.updateQueue;if(mr===null){var gr=new Set;gr.add(Lt),Xe.updateQueue=gr}else mr.add(Lt);break e}else{if((Xe&1)===0){uc(mt,rr,Xe),bl();break e}Lt=Error(G(426))}}else if(Dr&&Jt.mode&1){var Xr=cc(St);if(Xr!==null){(Xr.flags&65536)===0&&(Xr.flags|=256),hc(Xr,St,Jt,mt,Xe),Da(Hn(Lt,Jt));break e}}mt=Lt=Hn(Lt,Jt),Ir!==4&&(Ir=2),Ds===null?Ds=[mt]:Ds.push(mt),mt=St;do{switch(mt.tag){case 3:mt.flags|=65536,Xe&=-Xe,mt.lanes|=Xe;var Kt=ac(mt,Lt,Xe);Gu(mt,Kt);break e;case 1:Jt=Lt;var Vt=mt.type,er=mt.stateNode;if((mt.flags&128)===0&&(typeof Vt.getDerivedStateFromError=="function"||er!==null&&typeof er.componentDidCatch=="function"&&(un===null||!un.has(er)))){mt.flags|=65536,Xe&=-Xe,mt.lanes|=Xe;var dr=lc(mt,Jt,Xe);Gu(mt,dr);break e}}mt=mt.return}while(mt!==null)}Lc(Qe)}catch(yr){Xe=yr,Rr===Qe&&Qe!==null&&(Rr=Qe=Qe.return);continue}break}while(!0)}function Fc(){var xe=$o.current;return $o.current=wo,xe===null?wo:xe}function bl(){(Ir===0||Ir===3||Ir===2)&&(Ir=4),Lr===null||(Sn&268435455)===0&&(Po&268435455)===0||dn(Lr,Vr)}function Ro(xe,Xe){var Qe=Nr;Nr|=2;var nt=Fc();(Lr!==xe||Vr!==Xe)&&(Vi=null,Mn(xe,Xe));do try{Sd();break}catch(ht){Ic(xe,ht)}while(!0);if(Ta(),Nr=Qe,$o.current=nt,Rr!==null)throw Error(G(261));return Lr=null,Vr=0,Ir}function Sd(){for(;Rr!==null;)Bc(Rr)}function Ad(){for(;Rr!==null&&!qo();)Bc(Rr)}function Bc(xe){var Xe=Uc(xe.alternate,xe,ci);xe.memoizedProps=xe.pendingProps,Xe===null?Lc(xe):Rr=Xe,hl.current=null}function Lc(xe){var Xe=xe;do{var Qe=Xe.alternate;if(xe=Xe.return,(Xe.flags&32768)===0){if(Qe=xd(Qe,Xe,ci),Qe!==null){Rr=Qe;return}}else{if(Qe=bd(Qe,Xe),Qe!==null){Qe.flags&=32767,Rr=Qe;return}if(xe!==null)xe.flags|=32768,xe.subtreeFlags=0,xe.deletions=null;else{Ir=6,Rr=null;return}}if(Xe=Xe.sibling,Xe!==null){Rr=Xe;return}Rr=Xe=xe}while(Xe!==null);Ir===0&&(Ir=5)}function $n(xe,Xe,Qe){var nt=Ar,ht=vi.transition;try{vi.transition=null,Ar=1,Md(xe,Xe,Qe,nt)}finally{vi.transition=ht,Ar=nt}return null}function Md(xe,Xe,Qe,nt){do Qn();while(cn!==null);if((Nr&6)!==0)throw Error(G(327));Qe=xe.finishedWork;var ht=xe.finishedLanes;if(Qe===null)return null;if(xe.finishedWork=null,xe.finishedLanes=0,Qe===xe.current)throw Error(G(177));xe.callbackNode=null,xe.callbackPriority=0;var mt=Qe.lanes|Qe.childLanes;if(lh(xe,mt),xe===Lr&&(Rr=Lr=null,Vr=0),(Qe.subtreeFlags&2064)===0&&(Qe.flags&2064)===0||Oo||(Oo=!0,qc(Pi,function(){return Qn(),null})),mt=(Qe.flags&15990)!==0,(Qe.subtreeFlags&15990)!==0||mt){mt=vi.transition,vi.transition=null;var St=Ar;Ar=1;var Jt=Nr;Nr|=4,hl.current=null,_d(xe,Qe),Oc(Qe,xe),Yh(ba),Us=!!xa,ba=xa=null,xe.current=Qe,wd(Qe),vn(),Nr=Jt,Ar=St,vi.transition=mt}else xe.current=Qe;if(Oo&&(Oo=!1,cn=xe,To=ht),mt=xe.pendingLanes,mt===0&&(un=null),rh(Qe.stateNode),oi(xe,_r()),Xe!==null)for(nt=xe.onRecoverableError,Qe=0;Qe<Xe.length;Qe++)ht=Xe[Qe],nt(ht.value,{componentStack:ht.stack,digest:ht.digest});if(Do)throw Do=!1,xe=pl,pl=null,xe;return(To&1)!==0&&xe.tag!==0&&Qn(),mt=xe.pendingLanes,(mt&1)!==0?xe===ml?Os++:(Os=0,ml=
vendor: 5,506 bytes, line 40
40xe):Os=0,nn(),null}function Qn(){if(cn!==null){var xe=Pl(To),Xe=vi.transition,Qe=Ar;try{if(vi.transition=null,Ar=16>xe?16:xe,cn===null)var nt=!1;else{if(xe=cn,cn=null,To=0,(Nr&6)!==0)throw Error(G(331));var ht=Nr;for(Nr|=4,pr=xe.current;pr!==null;){var mt=pr,St=mt.child;if((pr.flags&16)!==0){var Jt=mt.deletions;if(Jt!==null){for(var Lt=0;Lt<Jt.length;Lt++){var rr=Jt[Lt];for(pr=rr;pr!==null;){var ur=pr;switch(ur.tag){case 0:case 11:case 15:$s(8,ur,mt)}var cr=ur.child;if(cr!==null)cr.return=ur,pr=cr;else for(;pr!==null;){ur=pr;var lr=ur.sibling,fr=ur.return;if(Ac(ur),ur===rr){pr=null;break}if(lr!==null){lr.return=fr,pr=lr;break}pr=fr}}}var mr=mt.alternate;if(mr!==null){var gr=mr.child;if(gr!==null){mr.child=null;do{var Xr=gr.sibling;gr.sibling=null,gr=Xr}while(gr!==null)}}pr=mt}}if((mt.subtreeFlags&2064)!==0&&St!==null)St.return=mt,pr=St;else e:for(;pr!==null;){if(mt=pr,(mt.flags&2048)!==0)switch(mt.tag){case 0:case 11:case 15:$s(9,mt,mt.return)}var Kt=mt.sibling;if(Kt!==null){Kt.return=mt.return,pr=Kt;break e}pr=mt.return}}var Vt=xe.current;for(pr=Vt;pr!==null;){St=pr;var er=St.child;if((St.subtreeFlags&2064)!==0&&er!==null)er.return=St,pr=er;else e:for(St=Vt;pr!==null;){if(Jt=pr,(Jt.flags&2048)!==0)try{switch(Jt.tag){case 0:case 11:case 15:Mo(9,Jt)}}catch(yr){Gr(Jt,Jt.return,yr)}if(Jt===St){pr=null;break e}var dr=Jt.sibling;if(dr!==null){dr.return=Jt.return,pr=dr;break e}pr=Jt.return}}if(Nr=ht,nn(),Di&&typeof Di.onPostCommitFiberRoot=="function")try{Di.onPostCommitFiberRoot(Fs,xe)}catch{}nt=!0}return nt}finally{Ar=Qe,vi.transition=Xe}}return!1}function zc(xe,Xe,Qe){Xe=Hn(Qe,Xe),Xe=ac(xe,Xe,1),xe=on(xe,Xe,1),Xe=ei(),xe!==null&&(rs(xe,1,Xe),oi(xe,Xe))}function Gr(xe,Xe,Qe){if(xe.tag===3)zc(xe,xe,Qe);else for(;Xe!==null;){if(Xe.tag===3){zc(Xe,xe,Qe);break}else if(Xe.tag===1){var nt=Xe.stateNode;if(typeof Xe.type.getDerivedStateFromError=="function"||typeof nt.componentDidCatch=="function"&&(un===null||!un.has(nt))){xe=Hn(Qe,xe),xe=lc(Xe,xe,1),Xe=on(Xe,xe,1),xe=ei(),Xe!==null&&(rs(Xe,1,xe),oi(Xe,xe));break}}Xe=Xe.return}}function $d(xe,Xe,Qe){var nt=xe.pingCache;nt!==null&&nt.delete(Xe),Xe=ei(),xe.pingedLanes|=xe.suspendedLanes&Qe,Lr===xe&&(Vr&Qe)===Qe&&(Ir===4||Ir===3&&(Vr&130023424)===Vr&&500>_r()-fl?Mn(xe,0):dl|=Qe),oi(xe,Xe)}function Vc(xe,Xe){Xe===0&&((xe.mode&1)===0?Xe=1:(Xe=Ls,Ls<<=1,(Ls&130023424)===0&&(Ls=4194304)));var Qe=ei();xe=Li(xe,Xe),xe!==null&&(rs(xe,Xe,Qe),oi(xe,Qe))}function Pd(xe){var Xe=xe.memoizedState,Qe=0;Xe!==null&&(Qe=Xe.retryLane),Vc(xe,Qe)}function Dd(xe,Xe){var Qe=0;switch(xe.tag){case 13:var nt=xe.stateNode,ht=xe.memoizedState;ht!==null&&(Qe=ht.retryLane);break;case 19:nt=xe.stateNode;break;default:throw Error(G(314))}nt!==null&&nt.delete(Xe),Vc(xe,Qe)}var Uc;Uc=function(xe,Xe,Qe){if(xe!==null)if(xe.memoizedProps!==Xe.pendingProps||ri.current)ni=!0;else{if((xe.lanes&Qe)===0&&(Xe.flags&128)===0)return ni=!1,yd(xe,Xe,Qe);ni=(xe.flags&131072)!==0}else ni=!1,Dr&&(Xe.flags&1048576)!==0&&Eu(Xe,co,Xe.index);switch(Xe.lanes=0,Xe.tag){case 2:var nt=Xe.type;So(xe,Xe),xe=Xe.pendingProps;var ht=Bn(Xe,Yr.current);qn(Xe,Qe),ht=za(null,Xe,nt,xe,ht,Qe);var mt=Va();return Xe.flags|=1,typeof ht=="object"&&ht!==null&&typeof ht.render=="function"&&ht.$$typeof===void 0?(Xe.tag=1,Xe.memoizedState=null,Xe.updateQueue=null,ii(nt)?(mt=!0,ao(Xe)):mt=!1,Xe.memoizedState=ht.state!==null&&ht.state!==void 0?ht.state:null,ka(Xe),ht.updater=Eo,Xe.stateNode=ht,ht._reactInternals=Xe,Ka(Xe,nt,xe,Qe),Xe=tl(null,Xe,nt,!0,mt,Qe)):(Xe.tag=0,Dr&&mt&&Aa(Xe),Qr(null,Xe,ht,Qe),Xe=Xe.child),Xe;case 16:nt=Xe.elementType;e:{switch(So(xe,Xe),xe=Xe.pendingProps,ht=nt._init,nt=ht(nt._payload),Xe.type=nt,ht=Xe.tag=Td(nt),xe=wi(nt,xe),ht){case 0:Xe=el(null,Xe,nt,xe,Qe);break e;case 1:Xe=vc(null,Xe,nt,xe,Qe);break e;case 11:Xe=dc(null,Xe,nt,xe,Qe);break e;case 14:Xe=fc(null,Xe,nt,wi(nt.type,xe),Qe);break e}throw Error(G(306,nt,""))}return Xe;case 0:return nt=Xe.type,ht=Xe.pendingProps,ht=Xe.elementType===nt?ht:wi(nt,ht),el(xe,Xe,nt,ht,Qe);case 1:return nt=Xe.type,ht=Xe.pendingProps,ht=Xe.elementType===nt?ht:wi(nt,ht),vc(xe,Xe,nt,ht,Qe);case 3:e:{if(yc(Xe),xe===null)throw Error(G(387));nt=Xe.pendingProps,mt=Xe.memoizedState,ht=mt.element,Tu(xe,Xe),vo(Xe,nt,null,Qe);var St=Xe.memoizedState;if(nt=St.element,mt.isDehydrated)if(mt={element:nt,isDehydrated:!1,cache:St.cache,pendingSuspenseBoundaries:St.pendingSuspenseBoundaries,transitions:St.transitions},Xe.updateQueue.baseState=mt,Xe.memoizedState=mt,Xe.flags&256){ht=Hn(Error(G(423)),Xe),Xe=xc(xe,Xe,nt,Qe,ht);break e}else if(nt!==ht){ht=Hn(Error(G(424)),Xe),Xe=xc(xe,Xe,nt,Qe,ht);break e}else for(ui=en(Xe.stateNode.containerInfo.firstChild),li=Xe,Dr=!0,_i=null,Qe=Du(Xe,null,nt,Qe),Xe.child=Qe;Qe;)Qe.flags=Qe.flags&-3|4096,Qe=Qe.sibling;else{if(zn(),nt===ht){Xe=zi(xe,Xe,Qe);break e}Qr(xe,Xe,nt,Qe)}Xe=Xe.child}return Xe;case 5:return Ru(Xe),xe===null&&Pa(Xe),nt=Xe.type,ht=Xe.pendingProps,mt=xe!==null?xe.memoizedProps:null,St=ht.children,Ca(nt,ht)?St=null:mt!==null&&Ca(nt,mt)&&(Xe.flags|=32),gc(xe,Xe),Qr(xe,Xe,St,Qe),Xe.child;case 6:return xe===null&&Pa(Xe),null;case 13:return bc(xe,Xe,Qe);case 4:return Ja(Xe,Xe.stateNode.containerInfo),nt=Xe.pendingProps,xe===null?Xe.child=Vn(Xe,null,nt,Qe):Qr(xe,Xe,nt,Qe),Xe.child;case 11:return nt=Xe.type,ht=Xe.pendingProps,ht=Xe.elementType===nt?ht:wi(nt,ht),dc(xe,Xe,nt,ht,Qe);case 7:return Qr(xe,Xe,Xe.pendingProps,Qe),Xe.child;case 8:return Qr(xe,Xe,Xe.pendingProps.children,Qe),Xe.child;case 12:return Qr(xe,Xe,Xe.pendingProps.children,Qe),Xe.child;
vendor: 11,295 bytes, line 40
40case 10:e:{if(nt=Xe.type._context,ht=Xe.pendingProps,mt=Xe.memoizedProps,St=ht.value,Mr(po,nt._currentValue),nt._currentValue=St,mt!==null)if(Ci(mt.value,St)){if(mt.children===ht.children&&!ri.current){Xe=zi(xe,Xe,Qe);break e}}else for(mt=Xe.child,mt!==null&&(mt.return=Xe);mt!==null;){var Jt=mt.dependencies;if(Jt!==null){St=mt.child;for(var Lt=Jt.firstContext;Lt!==null;){if(Lt.context===nt){if(mt.tag===1){Lt=ji(-1,Qe&-Qe),Lt.tag=2;var rr=mt.updateQueue;if(rr!==null){rr=rr.shared;var ur=rr.pending;ur===null?Lt.next=Lt:(Lt.next=ur.next,ur.next=Lt),rr.pending=Lt}}mt.lanes|=Qe,Lt=mt.alternate,Lt!==null&&(Lt.lanes|=Qe),Xa(mt.return,Qe,Xe),Jt.lanes|=Qe;break}Lt=Lt.next}}else if(mt.tag===10)St=mt.type===Xe.type?null:mt.child;else if(mt.tag===18){if(St=mt.return,St===null)throw Error(G(341));St.lanes|=Qe,Jt=St.alternate,Jt!==null&&(Jt.lanes|=Qe),Xa(St,Qe,Xe),St=mt.sibling}else St=mt.child;if(St!==null)St.return=mt;else for(St=mt;St!==null;){if(St===Xe){St=null;break}if(mt=St.sibling,mt!==null){mt.return=St.return,St=mt;break}St=St.return}mt=St}Qr(xe,Xe,ht.children,Qe),Xe=Xe.child}return Xe;case 9:return ht=Xe.type,nt=Xe.pendingProps.children,qn(Xe,Qe),ht=mi(ht),nt=nt(ht),Xe.flags|=1,Qr(xe,Xe,nt,Qe),Xe.child;case 14:return nt=Xe.type,ht=wi(nt,Xe.pendingProps),ht=wi(nt.type,ht),fc(xe,Xe,nt,ht,Qe);case 15:return pc(xe,Xe,Xe.type,Xe.pendingProps,Qe);case 17:return nt=Xe.type,ht=Xe.pendingProps,ht=Xe.elementType===nt?ht:wi(nt,ht),So(xe,Xe),Xe.tag=1,ii(nt)?(xe=!0,ao(Xe)):xe=!1,qn(Xe,Qe),sc(Xe,nt,ht),Ka(Xe,nt,ht,Qe),tl(null,Xe,nt,!0,xe,Qe);case 19:return _c(xe,Xe,Qe);case 22:return mc(xe,Xe,Qe)}throw Error(G(156,Xe.tag))};function qc(xe,Xe){return Js(xe,Xe)}function Od(xe,Xe,Qe,nt){this.tag=xe,this.key=Qe,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=Xe,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=nt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(xe,Xe,Qe,nt){return new Od(xe,Xe,Qe,nt)}function Cl(xe){return xe=xe.prototype,!(!xe||!xe.isReactComponent)}function Td(xe){if(typeof xe=="function")return Cl(xe)?1:0;if(xe!=null){if(xe=xe.$$typeof,xe===it)return 11;if(xe===ct)return 14}return 2}function fn(xe,Xe){var Qe=xe.alternate;return Qe===null?(Qe=yi(xe.tag,Xe,xe.key,xe.mode),Qe.elementType=xe.elementType,Qe.type=xe.type,Qe.stateNode=xe.stateNode,Qe.alternate=xe,xe.alternate=Qe):(Qe.pendingProps=Xe,Qe.type=xe.type,Qe.flags=0,Qe.subtreeFlags=0,Qe.deletions=null),Qe.flags=xe.flags&14680064,Qe.childLanes=xe.childLanes,Qe.lanes=xe.lanes,Qe.child=xe.child,Qe.memoizedProps=xe.memoizedProps,Qe.memoizedState=xe.memoizedState,Qe.updateQueue=xe.updateQueue,Xe=xe.dependencies,Qe.dependencies=Xe===null?null:{lanes:Xe.lanes,firstContext:Xe.firstContext},Qe.sibling=xe.sibling,Qe.index=xe.index,Qe.ref=xe.ref,Qe}function ko(xe,Xe,Qe,nt,ht,mt){var St=2;if(nt=xe,typeof xe=="function")Cl(xe)&&(St=1);else if(typeof xe=="string")St=5;else e:switch(xe){case et:return Pn(Qe.children,ht,mt,Xe);case Ze:St=8,ht|=8;break;case tt:return xe=yi(12,Qe,Xe,ht|2),xe.elementType=tt,xe.lanes=mt,xe;case ot:return xe=yi(13,Qe,Xe,ht),xe.elementType=ot,xe.lanes=mt,xe;case ut:return xe=yi(19,Qe,Xe,ht),xe.elementType=ut,xe.lanes=mt,xe;case st:return Jo(Qe,ht,mt,Xe);default:if(typeof xe=="object"&&xe!==null)switch(xe.$$typeof){case Ke:St=10;break e;case rt:St=9;break e;case it:St=11;break e;case ct:St=14;break e;case at:St=16,nt=null;break e}throw Error(G(130,xe==null?xe:typeof xe,""))}return Xe=yi(St,Qe,Xe,ht),Xe.elementType=xe,Xe.type=nt,Xe.lanes=mt,Xe}function Pn(xe,Xe,Qe,nt){return xe=yi(7,xe,nt,Xe),xe.lanes=Qe,xe}function Jo(xe,Xe,Qe,nt){return xe=yi(22,xe,nt,Xe),xe.elementType=st,xe.lanes=Qe,xe.stateNode={isHidden:!1},xe}function _l(xe,Xe,Qe){return xe=yi(6,xe,null,Xe),xe.lanes=Qe,xe}function wl(xe,Xe,Qe){return Xe=yi(4,xe.children!==null?xe.children:[],xe.key,Xe),Xe.lanes=Qe,Xe.stateNode={containerInfo:xe.containerInfo,pendingChildren:null,implementation:xe.implementation},Xe}function Gd(xe,Xe,Qe,nt,ht){this.tag=Xe,this.containerInfo=xe,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wo(0),this.expirationTimes=Wo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wo(0),this.identifierPrefix=nt,this.onRecoverableError=ht,this.mutableSourceEagerHydrationData=null}function El(xe,Xe,Qe,nt,ht,mt,St,Jt,Lt){return xe=new Gd(xe,Xe,Qe,Jt,Lt),Xe===1?(Xe=1,mt===!0&&(Xe|=8)):Xe=0,mt=yi(3,null,null,Xe),xe.current=mt,mt.stateNode=xe,mt.memoizedState={element:nt,isDehydrated:Qe,cache:null,transitions:null,pendingSuspenseBoundaries:null},ka(mt),xe}function Xd(xe,Xe,Qe){var nt=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:qe,key:nt==null?null:""+nt,children:xe,containerInfo:Xe,implementation:Qe}}function Yc(xe){if(!xe)return rn;xe=xe._reactInternals;e:{if(ki(xe)!==xe||xe.tag!==1)throw Error(G(170));var Xe=xe;do{switch(Xe.tag){case 3:Xe=Xe.stateNode.context;break e;case 1:if(ii(Xe.type)){Xe=Xe.stateNode.__reactInternalMemoizedMergedChildContext;break e}}Xe=Xe.return}while(Xe!==null);throw Error(G(171))}if(xe.tag===1){var Qe=xe.type;if(ii(Qe))return Cu(xe,Qe,Xe)}return Xe}function Hc(xe,Xe,Qe,nt,ht,mt,St,Jt,Lt){return xe=El(Qe,nt,!0,xe,ht,mt,St,Jt,Lt),xe.context=Yc(null),Qe=xe.current,nt=ei(),ht=hn(Qe),mt=ji(nt,ht),mt.callback=Xe??null,on(Qe,mt,ht),xe.current.lanes=ht,rs(xe,ht,nt),oi(xe,nt),xe}function Io(xe,Xe,Qe,nt){var ht=Xe.current,mt=ei(),St=hn(ht);return Qe=Yc(Qe),Xe.context===null?Xe.context=Qe:Xe.pendingContext=Qe,Xe=ji(mt,St),Xe.payload={element:xe},nt=nt===void 0?null:nt,nt!==null&&(Xe.callback=nt),xe=on(ht,Xe,St),xe!==null&&(Si(xe,ht,St,mt),go(xe,ht,St)),St}function Fo(xe){if(xe=xe.current,!xe.child)return null;switch(xe.child.tag){case 5:return xe.child.stateNode;default:return xe.child.stateNode}}function Wc(xe,Xe){if(xe=xe.memoizedState,xe!==null&&xe.dehydrated!==null){var Qe=xe.retryLane;xe.retryLane=Qe!==0&&Qe<Xe?Qe:Xe}}function Nl(xe,Xe){Wc(xe,Xe),(xe=xe.alternate)&&Wc(xe,Xe)}function Rd(){return null}var Kc=typeof reportError=="function"?reportError:function(xe){console.error(xe)};function Sl(xe){this._internalRoot=xe}Bo.prototype.render=Sl.prototype.render=function(xe){var Xe=this._internalRoot;if(Xe===null)throw Error(G(409));Io(xe,Xe,null,null)},Bo.prototype.unmount=Sl.prototype.unmount=function(){var xe=this._internalRoot;if(xe!==null){this._internalRoot=null;var Xe=xe.containerInfo;An(function(){Io(null,xe,null,null)}),Xe[Ji]=null}};function Bo(xe){this._internalRoot=xe}Bo.prototype.unstable_scheduleHydration=function(xe){if(xe){var Xe=Tl();xe={blockedOn:null,target:xe,priority:Xe};for(var Qe=0;Qe<Ki.length&&Xe!==0&&Xe<Ki[Qe].priority;Qe++);Ki.splice(Qe,0,xe),Qe===0&&Rl(xe)}};function Al(xe){return!(!xe||xe.nodeType!==1&&xe.nodeType!==9&&xe.nodeType!==11)}function Lo(xe){return!(!xe||xe.nodeType!==1&&xe.nodeType!==9&&xe.nodeType!==11&&(xe.nodeType!==8||xe.nodeValue!==" react-mount-point-unstable "))}function Zc(){}function kd(xe,Xe,Qe,nt,ht){if(ht){if(typeof nt=="function"){var mt=nt;nt=function(){var rr=Fo(St);mt.call(rr)}}var St=Hc(Xe,nt,xe,0,null,!1,!1,"",Zc);return xe._reactRootContainer=St,xe[Ji]=St.current,gs(xe.nodeType===8?xe.parentNode:xe),An(),St}for(;ht=xe.lastChild;)xe.removeChild(ht);if(typeof nt=="function"){var Jt=nt;nt=function(){var rr=Fo(Lt);Jt.call(rr)}}var Lt=El(xe,0,!1,null,null,!1,!1,"",Zc);return xe._reactRootContainer=Lt,xe[Ji]=Lt.current,gs(xe.nodeType===8?xe.parentNode:xe),An(function(){Io(Xe,Lt,Qe,nt)}),Lt}function jo(xe,Xe,Qe,nt,ht){var mt=Qe._reactRootContainer;if(mt){var St=mt;if(typeof ht=="function"){var Jt=ht;ht=function(){var Lt=Fo(St);Jt.call(Lt)}}Io(Xe,St,xe,ht)}else St=kd(Qe,Xe,xe,ht,nt);return Fo(St)}Dl=function(xe){switch(xe.tag){case 3:var Xe=xe.stateNode;if(Xe.current.memoizedState.isDehydrated){var Qe=ts(Xe.pendingLanes);Qe!==0&&(Ko(Xe,Qe|1),oi(Xe,_r()),(Nr&6)===0&&(Zn=_r()+500,nn()))}break;case 13:An(function(){var nt=Li(xe,1);if(nt!==null){var ht=ei();Si(nt,xe,1,ht)}}),Nl(xe,1)}},Zo=function(xe){if(xe.tag===13){var Xe=Li(xe,134217728);if(Xe!==null){var Qe=ei();Si(Xe,xe,134217728,Qe)}Nl(xe,134217728)}},Ol=function(xe){if(xe.tag===13){var Xe=hn(xe),Qe=Li(xe,Xe);if(Qe!==null){var nt=ei();Si(Qe,xe,Xe,nt)}Nl(xe,Xe)}},Tl=function(){return Ar},Gl=function(xe,Xe){var Qe=Ar;try{return Ar=xe,Xe()}finally{Ar=Qe}},ar=function(xe,Xe,Qe){switch(Xe){case"input":if(Xt(xe,Qe),Xe=Qe.name,Qe.type==="radio"&&Xe!=null){for(Qe=xe;Qe.parentNode;)Qe=Qe.parentNode;for(Qe=Qe.querySelectorAll("input[name="+JSON.stringify(""+Xe)+'][type="radio"]'),Xe=0;Xe<Qe.length;Xe++){var nt=Qe[Xe];if(nt!==xe&&nt.form===xe.form){var ht=so(nt);if(!ht)throw Error(G(90));ir(nt),Xt(nt,ht)}}}break;case"textarea":Mt(xe,Qe);break;case"select":Xe=Qe.value,Xe!=null&&kt(xe,!!Qe.multiple,Xe,!1)}},qi=yl,Dn=An;var Jd={usingClientEntryPoint:!1,Events:[xs,In,so,ti,Ui,yl]},Ts={findFiberByHostInstance:xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Id={bundleType:Ts.bundleType,version:Ts.version,rendererPackageName:Ts.rendererPackageName,rendererConfig:Ts.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ve.ReactCurrentDispatcher,findHostInstanceByFiber:function(xe){return xe=Rs(xe),xe===null?null:xe.stateNode},findFiberByHostInstance:Ts.findFiberByHostInstance||Rd,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zo.isDisabled&&zo.supportsFiber)try{Fs=zo.inject(Id),Di=zo}catch{}}return reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Jd,reactDom_production_min.createPortal=function(xe,Xe){var Qe=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Al(Xe))throw Error(G(200));return Xd(xe,Xe,null,Qe)},reactDom_production_min.createRoot=function(xe,Xe){if(!Al(xe))throw Error(G(299));var Qe=!1,nt="",ht=Kc;return Xe!=null&&(Xe.unstable_strictMode===!0&&(Qe=!0),Xe.identifierPrefix!==void 0&&(nt=Xe.identifierPrefix),Xe.onRecoverableError!==void 0&&(ht=Xe.onRecoverableError)),Xe=El(xe,1,!1,null,null,Qe,!1,nt,ht),xe[Ji]=Xe.current,gs(xe.nodeType===8?xe.parentNode:xe),new Sl(Xe)},reactDom_production_min.findDOMNode=function(xe){if(xe==null)return null;if(xe.nodeType===1)return xe;var Xe=xe._reactInternals;if(Xe===void 0)throw typeof xe.render=="function"?Error(G(188)):(xe=Object.keys(xe).join(","),Error(G(268,xe)));return xe=Rs(Xe),xe=xe===null?null:xe.stateNode,xe},reactDom_production_min.flushSync=function(xe){return An(xe)},reactDom_production_min.hydrate=function(xe,Xe,Qe){if(!Lo(Xe))throw Error(G(200));return jo(null,xe,Xe,!0,Qe)},reactDom_production_min.hydrateRoot=function(xe,Xe,Qe){if(!Al(xe))throw Error(G(405)
40);var nt=Qe!=null&&Qe.hydratedSources||null,ht=!1,mt="",St=Kc;if(Qe!=null&&(Qe.unstable_strictMode===!0&&(ht=!0),Qe.identifierPrefix!==void 0&&(mt=Qe.identifierPrefix),Qe.onRecoverableError!==void 0&&(St=Qe.onRecoverableError)),Xe=Hc(Xe,null,xe,1,Qe??null,ht,!1,mt,St),xe[Ji]=Xe.current,gs(xe),nt)for(xe=0;xe<nt.length;xe++)Qe=nt[xe],ht=Qe._getVersion,ht=ht(Qe._source),Xe.mutableSourceEagerHydrationData==null?Xe.mutableSourceEagerHydrationData=[Qe,ht]:Xe.mutableSourceEagerHydrationData.push(Qe,ht);return new Bo(Xe)},reactDom_production_min.render=function(xe,Xe,Qe){if(!Lo(Xe))throw Error(G(200));return jo(null,xe,Xe,!1,Qe)},reactDom_production_min.unmountComponentAtNode=function(xe){if(!Lo(xe))throw Error(G(40));return xe._reactRootContainer?(An(function(){jo(null,null,xe,!1,function(){xe._reactRootContainer=null,xe[Ji]=null})}),!0):!1},reactDom_production_min.unstable_batchedUpdates=yl,reactDom_production_min.unstable_renderSubtreeIntoContainer=function(xe,Xe,Qe,nt){if(!Lo(Qe))throw Error(G(200));if(xe==null||xe._reactInternals===void 0)throw Error(G(38));return jo(xe,Xe,Qe,!1,nt)},reactDom_production_min.version="18.3.1-next-f1338f8080-20240426",reactDom_production_min}var hasRequiredReactDom;function requireReactDom(){if(hasRequiredReactDom)return reactDom.exports;hasRequiredReactDom=1;function v(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(v)}catch(N){console.error(N)}}return v(),reactDom.exports=requireReactDom_production_min(),reactDom.exports}var hasRequiredClient;function requireClient(){if(hasRequiredClient)return client;hasRequiredClient=1;var v=requireReactDom();return client.createRoot=v.createRoot,client.hydrateRoot=v.hydrateRoot,client}var clientExports=requireClient(),lib={},utils={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1;var v=utils&&utils.__assign||function(){return v=Object.assign||function(Je){for(var Ce,Ve=1,Re=arguments.length;Ve<Re;Ve++){Ce=arguments[Ve];for(var qe in Ce)Object.prototype.hasOwnProperty.call(Ce,qe)&&(Je[qe]=Ce[qe])}return Je},v.apply(this,arguments)},N=utils&&utils.__createBinding||(Object.create?function(Je,Ce,Ve,Re){Re===void 0&&(Re=Ve),Object.defineProperty(Je,Re,{enumerable:!0,get:function(){return Ce[Ve]}})}:function(Je,Ce,Ve,Re){Re===void 0&&(Re=Ve),Je[Re]=Ce[Ve]}),G=utils&&utils.__setModuleDefault||(Object.create?function(Je,Ce){Object.defineProperty(Je,"default",{enumerable:!0,value:Ce})}:function(Je,Ce){Je.default=Ce}),z=utils&&utils.__importStar||function(Je){if(Je&&Je.__esModule)return Je;var Ce={};if(Je!=null)for(var Ve in Je)Ve!=="default"&&Object.prototype.hasOwnProperty.call(Je,Ve)&&N(Ce,Je,Ve);return G(Ce,Je),Ce},q=utils&&utils.__spreadArray||function(Je,Ce,Ve){if(Ve||arguments.length===2)for(var Re=0,qe=Ce.length,et;Re<qe;Re++)(et||!(Re in Ce))&&(et||(et=Array.prototype.slice.call(Ce,0,Re)),et[Re]=Ce[Re]);return Je.concat(et||Array.prototype.slice.call(Ce))};Object.defineProperty(utils,"__esModule",{value:!0}),utils.Priority=utils.isModKey=utils.shouldRejectKeystrokes=utils.useThrottledValue=utils.getScrollbarWidth=utils.useIsomorphicLayout=utils.noop=utils.createAction=utils.randomId=utils.usePointerMovedSinceMount=utils.useOuterClick=utils.swallowEvent=void 0;var Y=z(requireReact());function W(Je){Je.stopPropagation(),Je.preventDefault()}utils.swallowEvent=W;function ie(Je,Ce){var Ve=Y.useRef(Ce);Ve.current=Ce,Y.useEffect(function(){function Re(qe){var et,Ze;!((et=Je.current)===null||et===void 0)&&et.contains(qe.target)||qe.target===((Ze=Je.current)===null||Ze===void 0?void 0:Ze.getRootNode().host)||(qe.preventDefault(),qe.stopPropagation(),Ve.current())}return window.addEventListener("pointerdown",Re,!0),function(){return window.removeEventListener("pointerdown",Re,!0)}},[Je])}utils.useOuterClick=ie;function ne(){var Je=Y.useState(!1),Ce=Je[0],Ve=Je[1];return Y.useEffect(function(){function Re(){Ve(!0)}if(!Ce)return window.addEventListener("pointermove",Re),function(){return window.removeEventListener("pointermove",Re)}},[Ce]),Ce}utils.usePointerMovedSinceMount=ne;function se(){return Math.random().toString(36).substring(2,9)}utils.randomId=se;function ae(Je){return v({id:se()},Je)}utils.createAction=ae;function ce(){}utils.noop=ce,utils.useIsomorphicLayout=typeof window>"u"?ce:Y.useLayoutEffect;function pe(){var Je=document.createElement("div");Je.style.visibility="hidden",Je.style.overflow="scroll",document.body.appendChild(Je);var Ce=document.createElement("div");Je.appendChild(Ce);var Ve=Je.offsetWidth-Ce.offsetWidth;return Je.parentNode.removeChild(Je),Ve}utils.getScrollbarWidth=pe;function ge(Je,Ce){Ce===void 0&&(Ce=100);var Ve=Y.useState(Je),Re=Ve[0],qe=Ve[1],et=Y.useRef(Date.now());return Y.useEffect(function(){if(Ce!==0){var Ze=setTimeout(function(){qe(Je),et.current=Date.now()},et.current-(Date.now()-Ce));return function(){clearTimeout(Ze)}}},[Ce,Je]),Ce===0?Je:Re}utils.useThrottledValue=ge;function ve(Je){var Ce,Ve,Re,qe=Je===void 0?{ignoreWhenFocused:[]}:Je,et=qe.ignoreWhenFocused,Ze=q(["input","textarea"],et,!0).map(function(rt){return rt.toLowerCase()}),tt=document.activeElement,Ke=tt&&(Ze.indexOf(tt.tagName.toLowerCase())!==-1||((Ce=tt.attributes.getNamedItem("role"))===null||Ce===void 0?void 0:Ce.value)==="textbox"||((Ve=tt.attributes.getNamedItem("contenteditable"))===null||Ve===void 0?void 0:Ve.value)==="true"||((Re=tt.attributes.getNamedItem("contenteditable"))===null||Re===void 0?void 0:Re.value)==="plaintext-only");return Ke}utils.shouldRejectKeystrokes=ve;var be=typeof window>"u",Ee=!be&&window.navigator.platform==="MacIntel";function Pe(Je){return Ee?Je.metaKey:Je.ctrlKey}return utils.isModKey=Pe,utils.Priority={HIGH:1,NORMAL:0,LOW:-1},utils}var useMatches={},useKBar={},KBarContextProvider={},useStore={},fastEquals$1={exports:{}},fastEquals=fastEquals$1.exports,hasRequiredFastEquals;function requireFastEquals(){return hasRequiredFastEquals||(hasRequiredFastEquals=1,function(v,N){(function(G,z){z(N)})(fastEquals,function(G){var z=typeof WeakSet=="function",q=Object.keys;function Y(Ke,rt){return Ke===rt||Ke!==Ke&&rt!==rt}function W(Ke){return Ke.constructor===Object||Ke.constructor==null}function ie(Ke){return!!Ke&&typeof Ke.then=="function"}function ne(Ke){return!!(Ke&&Ke.$$typeof)}function se(){var Ke=[];return{add:function(rt){Ke.push(rt)},has:function(rt){return Ke.indexOf(rt)!==-1}}}var ae=function(Ke){return Ke?function(){return new WeakSet}:se}(z);function ce(Ke){return function(it){var ot=Ke||it;return function(ct,at,st){st===void 0&&(st=ae());var pt=!!ct&&typeof ct=="object",lt=!!at&&typeof at=="object";if(pt||lt){var vt=pt&&st.has(ct),dt=lt&&st.has(at);if(vt||dt)return vt&&dt;pt&&st.add(ct),lt&&st.add(at)}return ot(ct,at,st)}}}function pe(Ke,rt,it,ot){var ut=Ke.length;if(rt.length!==ut)return!1;for(;ut-- >0;)if(!it(Ke[ut],rt[ut],ot))return!1;return!0}function ge(Ke,rt,it,ot){var ut=Ke.size===rt.size;if(ut&&Ke.size){var ct={};Ke.forEach(function(at,st){if(ut){var pt=!1,lt=0;rt.forEach(function(vt,dt){!pt&&!ct[lt]&&(pt=it(st,dt,ot)&&it(at,vt,ot),pt&&(ct[lt]=!0)),lt++}),ut=pt}})}return ut}var ve="_owner",be=Function.prototype.bind.call(Function.prototype.call,Object.prototype.hasOwnProperty);function Ee(Ke,rt,it,ot){var ut=q(Ke),ct=ut.length;if(q(rt).length!==ct)return!1;if(ct)for(var at=void 0;ct-- >0;){if(at=ut[ct],at===ve){var st=ne(Ke),pt=ne(rt);
40if((st||pt)&&st!==pt)return!1}if(!be(rt,at)||!it(Ke[at],rt[at],ot))return!1}return!0}function Pe(Ke,rt){return Ke.source===rt.source&&Ke.global===rt.global&&Ke.ignoreCase===rt.ignoreCase&&Ke.multiline===rt.multiline&&Ke.unicode===rt.unicode&&Ke.sticky===rt.sticky&&Ke.lastIndex===rt.lastIndex}function Je(Ke,rt,it,ot){var ut=Ke.size===rt.size;if(ut&&Ke.size){var ct={};Ke.forEach(function(at){if(ut){var st=!1,pt=0;rt.forEach(function(lt){!st&&!ct[pt]&&(st=it(at,lt,ot),st&&(ct[pt]=!0)),pt++}),ut=st}})}return ut}var Ce=typeof Map=="function",Ve=typeof Set=="function";function Re(Ke){var rt=typeof Ke=="function"?Ke(it):it;function it(ot,ut,ct){if(ot===ut)return!0;if(ot&&ut&&typeof ot=="object"&&typeof ut=="object"){if(W(ot)&&W(ut))return Ee(ot,ut,rt,ct);var at=Array.isArray(ot),st=Array.isArray(ut);return at||st?at===st&&pe(ot,ut,rt,ct):(at=ot instanceof Date,st=ut instanceof Date,at||st?at===st&&Y(ot.getTime(),ut.getTime()):(at=ot instanceof RegExp,st=ut instanceof RegExp,at||st?at===st&&Pe(ot,ut):ie(ot)||ie(ut)?ot===ut:Ce&&(at=ot instanceof Map,st=ut instanceof Map,at||st)?at===st&&ge(ot,ut,rt,ct):Ve&&(at=ot instanceof Set,st=ut instanceof Set,at||st)?at===st&&Je(ot,ut,rt,ct):Ee(ot,ut,rt,ct)))}return ot!==ot&&ut!==ut}return it}var qe=Re(),et=Re(function(){return Y}),Ze=Re(ce()),tt=Re(ce(Y));G.circularDeepEqual=Ze,G.circularShallowEqual=tt,G.createCustomEqual=Re,G.deepEqual=qe,G.sameValueZeroEqual=Y,G.shallowEqual=et,Object.defineProperty(G,"__esModule",{value:!0})})}(fastEquals$1,fastEquals$1.exports)),fastEquals$1.exports}var tinyInvariant_cjs,hasRequiredTinyInvariant_cjs;function requireTinyInvariant_cjs(){if(hasRequiredTinyInvariant_cjs)return tinyInvariant_cjs;hasRequiredTinyInvariant_cjs=1;var v="Invariant failed";function N(G,z){if(!G)throw new Error(v)}return tinyInvariant_cjs=N,tinyInvariant_cjs}var ActionInterface={},ActionImpl={},Command={},hasRequiredCommand;function requireCommand(){if(hasRequiredCommand)return Command;hasRequiredCommand=1,Object.defineProperty(Command,"__esModule",{value:!0}),Command.Command=void 0;var v=function(){function N(G,z){var q=this;z===void 0&&(z={}),this.perform=function(){var Y=G.perform();if(typeof Y=="function"){var W=z.history;W&&(q.historyItem&&W.remove(q.historyItem),q.historyItem=W.add({perform:G.perform,negate:Y}),q.history={undo:function(){return W.undo(q.historyItem)},redo:function(){return W.redo(q.historyItem)}})}}}return N}();return Command.Command=v,Command}var hasRequiredActionImpl;function requireActionImpl(){if(hasRequiredActionImpl)return ActionImpl;hasRequiredActionImpl=1;var v=ActionImpl&&ActionImpl.__importDefault||function(W){return W&&W.__esModule?W:{default:W}};Object.defineProperty(ActionImpl,"__esModule",{value:!0}),ActionImpl.ActionImpl=void 0;var N=v(requireTinyInvariant_cjs()),G=requireCommand(),z=requireUtils(),q=function(W){var ie=W.keywords,ne=ie===void 0?"":ie,se=W.section,ae=se===void 0?"":se;return(ne+" "+(typeof ae=="string"?ae:ae.name)).trim()},Y=function(){function W(ie,ne){var se=this,ae;this.priority=z.Priority.NORMAL,this.ancestors=[],this.children=[],Object.assign(this,ie),this.id=ie.id,this.name=ie.name,this.keywords=q(ie);var ce=ie.perform;if(this.command=ce&&new G.Command({perform:function(){return ce(se)}},{history:ne.history}),this.perform=(ae=this.command)===null||ae===void 0?void 0:ae.perform,ie.parent){var pe=ne.store[ie.parent];(0,N.default)(pe,"attempted to create an action whos parent: "+ie.parent+" does not exist in the store."),pe.addChild(this)}}return W.prototype.addChild=function(ie){ie.ancestors.unshift(this);for(var ne=this.parentActionImpl;ne;)ie.ancestors.unshift(ne),ne=ne.parentActionImpl;this.children.push(ie)},W.prototype.removeChild=function(ie){var ne=this,se=this.children.indexOf(ie);se!==-1&&this.children.splice(se,1),ie.children&&ie.children.forEach(function(ae){ne.removeChild(ae)})},Object.defineProperty(W.prototype,"parentActionImpl",{get:function(){return this.ancestors[this.ancestors.length-1]},enumerable:!1,configurable:!0}),W.create=function(ie,ne){return new W(ie,ne)},W}();return ActionImpl.ActionImpl=Y,ActionImpl}var hasRequiredActionInterface;function requireActionInterface(){if(hasRequiredActionInterface)return ActionInterface;hasRequiredActionInterface=1;var v=ActionInterface&&ActionInterface.__assign||function(){return v=Object.assign||function(Y){for(var W,ie=1,ne=arguments.length;ie<ne;ie++){W=arguments[ie];for(var se in W)Object.prototype.hasOwnProperty.call(W,se)&&(Y[se]=W[se])}return Y},v.apply(this,arguments)},N=ActionInterface&&ActionInterface.__importDefault||function(Y){return Y&&Y.__esMo
40dule?Y:{default:Y}};Object.defineProperty(ActionInterface,"__esModule",{value:!0}),ActionInterface.ActionInterface=void 0;var G=N(requireTinyInvariant_cjs()),z=requireActionImpl(),q=function(){function Y(W,ie){W===void 0&&(W=[]),ie===void 0&&(ie={}),this.actions={},this.options=ie,this.add(W)}return Y.prototype.add=function(W){for(var ie=0;ie<W.length;ie++){var ne=W[ie];ne.parent&&(0,G.default)(this.actions[ne.parent],'Attempted to create action "'+ne.name+'" without registering its parent "'+ne.parent+'" first.'),this.actions[ne.id]=z.ActionImpl.create(ne,{history:this.options.historyManager,store:this.actions})}return v({},this.actions)},Y.prototype.remove=function(W){var ie=this;return W.forEach(function(ne){var se=ie.actions[ne.id];if(se){for(var ae=se.children;ae.length;){var ce=ae.pop();if(!ce)return;delete ie.actions[ce.id],ce.parentActionImpl&&ce.parentActionImpl.removeChild(ce),ce.children&&ae.push.apply(ae,ce.children)}se.parentActionImpl&&se.parentActionImpl.removeChild(se),delete ie.actions[ne.id]}}),v({},this.actions)},Y}();return ActionInterface.ActionInterface=q,ActionInterface}var HistoryImpl={},hasRequiredHistoryImpl;function requireHistoryImpl(){if(hasRequiredHistoryImpl)return HistoryImpl;hasRequiredHistoryImpl=1,Object.defineProperty(HistoryImpl,"__esModule",{value:!0}),HistoryImpl.history=HistoryImpl.HistoryItemImpl=void 0;var v=requireUtils(),N=function(){function q(Y){this.perform=Y.perform,this.negate=Y.negate}return q.create=function(Y){return new q(Y)},q}();HistoryImpl.HistoryItemImpl=N;var G=function(){function q(){return this.undoStack=[],this.redoStack=[],q.instance||(q.instance=this,this.init()),q.instance}return q.prototype.init=function(){var Y=this;typeof window>"u"||window.addEventListener("keydown",function(W){var ie;if(!(!Y.redoStack.length&&!Y.undoStack.length||(0,v.shouldRejectKeystrokes)())){var ne=(ie=W.key)===null||ie===void 0?void 0:ie.toLowerCase();W.metaKey&&ne==="z"&&W.shiftKey?Y.redo():W.metaKey&&ne==="z"&&Y.undo()}})},q.prototype.add=function(Y){var W=N.create(Y);return this.undoStack.push(W),W},q.prototype.remove=function(Y){var W=this.undoStack.findIndex(function(ne){return ne===Y});if(W!==-1){this.undoStack.splice(W,1);return}var ie=this.redoStack.findIndex(function(ne){return ne===Y});ie!==-1&&this.redoStack.splice(ie,1)},q.prototype.undo=function(Y){if(!Y){var W=this.undoStack.pop();return W?(W==null||W.negate(),this.redoStack.push(W),W):void 0}var ie=this.undoStack.findIndex(function(ne){return ne===Y});if(ie!==-1)return this.undoStack.splice(ie,1),Y.negate(),this.redoStack.push(Y),Y},q.prototype.redo=function(Y){if(!Y){var W=this.redoStack.pop();return W?(W==null||W.perform(),this.undoStack.push(W),W):void 0}var ie=this.redoStack.findIndex(function(ne){return ne===Y});if(ie!==-1)return this.redoStack.splice(ie,1),Y.perform(),this.undoStack.push(Y),Y},q.prototype.reset=function(){this.undoStack.splice(0),this.redoStack.splice(0)},q}(),z=new G;return HistoryImpl.history=z,Object.freeze(z),HistoryImpl}var types={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(v){Object.defineProperty(v,"__esModule",{value:!0}),v.VisualState=void 0,function(N){N.animatingIn="animating-in",N.showing="showing",N.animatingOut="animating-out",N.hidden="hidden"}(v.VisualState||(v.VisualState={}))}(types)),types}var hasRequiredUseStore;function requireUseStore(){if(hasRequiredUseStore)return useStore;hasRequiredUseStore=1;var v=useStore&&useStore.__assign||function(){return v=Object.assign||function(ve){for(var be,Ee=1,Pe=arguments.length;Ee<Pe;Ee++){be=arguments[Ee];for(var Je in be)Object.prototype.hasOwnProperty.call(be,Je)&&(ve[Je]=be[Je])}return ve},v.apply(this,arguments)},N=useStore&&useStore.__createBinding||(Object.create?function(ve,be,Ee,Pe){Pe===void 0&&(Pe=Ee),Object.defineProperty(ve,Pe,{enumerable:!0,get:function(){return be[Ee]}})}:function(ve,be,Ee,Pe){Pe===void 0&&(Pe=Ee),ve[Pe]=be[Ee]}),G=useStore&&useStore.__setModuleDefault||(Object.create?function(ve,be){Object.defineProperty(ve,"default",{enumerable:!0,value:be})}:function(ve,be){ve.default=be}),z=useStore&&useStore.__importStar||function(ve){if(ve&&ve.__esMo
40dule)return ve;var be={};if(ve!=null)for(var Ee in ve)Ee!=="default"&&Object.prototype.hasOwnProperty.call(ve,Ee)&&N(be,ve,Ee);return G(be,ve),be},q=useStore&&useStore.__importDefault||function(ve){return ve&&ve.__esModule?ve:{default:ve}};Object.defineProperty(useStore,"__esModule",{value:!0}),useStore.useStore=void 0;var Y=requireFastEquals(),W=z(requireReact()),ie=q(requireTinyInvariant_cjs()),ne=requireActionInterface(),se=requireHistoryImpl(),ae=requireTypes();function ce(ve){var be=W.useRef(v({animations:{enterMs:200,exitMs:100}},ve.options)),Ee=W.useMemo(function(){return new ne.ActionInterface(ve.actions||[],{historyManager:be.current.enableHistory?se.history:void 0})},[]),Pe=W.useState({searchQuery:"",currentRootActionId:null,visualState:ae.VisualState.hidden,actions:v({},Ee.actions),activeIndex:0,disabled:!1}),Je=Pe[0],Ce=Pe[1],Ve=W.useRef(Je);Ve.current=Je;var Re=W.useCallback(function(){return Ve.current},[]),qe=W.useMemo(function(){return new pe(Re)},[Re]);W.useEffect(function(){Ve.current=Je,qe.notify()},[Je,qe]);var et=W.useCallback(function(tt){return Ce(function(Ke){return v(v({},Ke),{actions:Ee.add(tt)})}),function(){Ce(function(rt){return v(v({},rt),{actions:Ee.remove(tt)})})}},[Ee]),Ze=W.useRef(null);return W.useMemo(function(){var tt={setCurrentRootAction:function(Ke){Ce(function(rt){return v(v({},rt),{currentRootActionId:Ke})})},setVisualState:function(Ke){Ce(function(rt){return v(v({},rt),{visualState:typeof Ke=="function"?Ke(rt.visualState):Ke})})},setSearch:function(Ke){return Ce(function(rt){return v(v({},rt),{searchQuery:Ke})})},registerActions:et,toggle:function(){return Ce(function(Ke){return v(v({},Ke),{visualState:[ae.VisualState.animatingOut,ae.VisualState.hidden].includes(Ke.visualState)?ae.VisualState.animatingIn:ae.VisualState.animatingOut})})},setActiveIndex:function(Ke){return Ce(function(rt){return v(v({},rt),{activeIndex:typeof Ke=="number"?Ke:Ke(rt.activeIndex)})})},inputRefSetter:function(Ke){Ze.current=Ke},getInput:function(){return(0,ie.default)(Ze.current,"Input ref is undefined, make sure you attach `query.inputRefSetter` to your search input."),Ze.current},disable:function(Ke){Ce(function(rt){return v(v({},rt),{disabled:Ke})})}};return{getState:Re,query:tt,options:be.current,subscribe:function(Ke,rt){return qe.subscribe(Ke,rt)}}},[Re,qe,et])}useStore.useStore=ce;var pe=function(){function ve(be){this.subscribers=[],this.getState=be}return ve.prototype.subscribe=function(be,Ee){var Pe=this,Je=new ge(function(){return be(Pe.getState())},Ee);return this.subscribers.push(Je),this.unsubscribe.bind(this,Je)},ve.prototype.unsubscribe=function(be){if(this.subscribers.length){var Ee=this.subscribers.indexOf(be);if(Ee>-1)return this.subscribers.splice(Ee,1)}},ve.prototype.notify=function(){this.subscribers.forEach(function(be){return be.collect()})},ve}(),ge=function(){function ve(be,Ee){this.collector=be,this.onChange=Ee}return ve.prototype.collect=function(){try{var be=this.collector();(0,Y.deepEqual)(be,this.collected)||(this.collected=be,this.onChange&&this.onChange(this.collected))}catch(Ee){console.warn(Ee)}},ve}();return useStore}var InternalEvents={},tinykeys={},hasRequiredTinykeys;function requireTinykeys(){if(hasRequiredTinykeys)return tinykeys;hasRequiredTinykeys=1,Object.defineProperty(tinykeys,"__esModule",{value:!0});var v=["Shift","Meta","Alt","Control"],N=1e3,G="keydown",z=typeof navigator=="object"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"Meta":"Control";function q(ne,se){return typeof ne.getModifierState=="function"?ne.getModifierState(se):!1}function Y(ne){return ne.trim().split(" ").map(function(se){var ae=se.split(/\b\+/),ce=ae.pop();return ae=ae.map(function(pe){return pe==="$mod"?z:pe}),[ae,ce]})}function W(ne,se){return/^[^A-Za-z0-9]$/.test(ne.key)&&se[1]===ne.key?!0:!(se[1].toUpperCase()!==ne.key.toUpperCase()&&se[1]!==ne.code||se[0].find(function(ae){return!q(ne,ae)})||v.find(function(ae){return!se[0].includes(ae)&&se[1]!==ae&&q(ne,ae)}))}function ie(ne,se,ae){var ce,pe;ae===void 0&&(ae={});var ge=(ce=ae.timeout)!==null&&ce!==void 0?ce:N,ve=(pe=ae.event)!==null&&pe!==void 0?pe:G,be=Object.keys(se).map(function(Ce){return[Y(Ce),se[Ce]]}),Ee=new Map,Pe=null,Je=function(Ce){Ce instanceof KeyboardEvent&&(be.forEach(function(Ve){var Re=Ve[0],qe=Ve[1],et=Ee.get(Re),Ze=et||Re,tt=Ze[0],Ke=W(Ce,tt);Ke?Ze.length>1?Ee.set(Re,Ze.slice(1)):(Ee.delete(Re),qe(Ce)):q(Ce,Ce.key)||Ee.delete(Re)}),Pe&&clearTimeout(Pe),Pe=setTimeout(Ee.clear.bind(Ee),ge))};return ne.addEventListener(ve,Je),function(){ne.removeEventListener(ve,Je)}}return tinykeys.default=ie,tinykeys}var hasRequiredInternalEvents;function requireInternalEvents(){if(hasRequiredInternalEvents)return InternalEvents;hasRequiredInternalEvents=1;var v=InternalEvents&&InternalEvents.__createBinding||(Object.create?function(Ee,Pe,Je,Ce){Ce===void 0&&(Ce=Je),Object.defineProperty(Ee,Ce,{enumerable:!0,get:function(){return Pe[Je]}})}:function(Ee,Pe,Je,Ce){Ce===void 0&&(Ce=Je),Ee[Ce]=Pe[Je]}),N=InternalEvents&&InternalEvents.__setModuleDefault||(Object.create?function(Ee,Pe){Object.defineProperty(Ee,"default",{enumerable:!0,value:Pe})}:function(Ee,Pe){Ee.default=Pe}),G=InternalEvents&&InternalEvents.__importStar||function(Ee){if(Ee&&Ee.__esModule)return Ee;var Pe={};
40if(Ee!=null)for(var Je in Ee)Je!=="default"&&Object.prototype.hasOwnProperty.call(Ee,Je)&&v(Pe,Ee,Je);return N(Pe,Ee),Pe},z=InternalEvents&&InternalEvents.__importDefault||function(Ee){return Ee&&Ee.__esModule?Ee:{default:Ee}};Object.defineProperty(InternalEvents,"__esModule",{value:!0}),InternalEvents.InternalEvents=void 0;var q=G(requireReact()),Y=z(requireTinykeys()),W=requireTypes(),ie=requireUseKBar(),ne=requireUtils();function se(){return ae(),ce(),ve(),be(),null}InternalEvents.InternalEvents=se;function ae(){var Ee,Pe,Je=(0,ie.useKBar)(function(Ke){return{visualState:Ke.visualState,showing:Ke.visualState!==W.VisualState.hidden,disabled:Ke.disabled}}),Ce=Je.query,Ve=Je.options,Re=Je.visualState,qe=Je.showing,et=Je.disabled;q.useEffect(function(){var Ke,rt=function(){Ce.setVisualState(function(ut){return ut===W.VisualState.hidden||ut===W.VisualState.animatingOut?ut:W.VisualState.animatingOut})};if(et){rt();return}var it=Ve.toggleShortcut||"$mod+k",ot=(0,Y.default)(window,(Ke={},Ke[it]=function(ut){var ct,at,st,pt;ut.defaultPrevented||(ut.preventDefault(),Ce.toggle(),qe?(at=(ct=Ve.callbacks)===null||ct===void 0?void 0:ct.onClose)===null||at===void 0||at.call(ct):(pt=(st=Ve.callbacks)===null||st===void 0?void 0:st.onOpen)===null||pt===void 0||pt.call(st))},Ke.Escape=function(ut){var ct,at;qe&&(ut.stopPropagation(),ut.preventDefault(),(at=(ct=Ve.callbacks)===null||ct===void 0?void 0:ct.onClose)===null||at===void 0||at.call(ct)),rt()},Ke));return function(){ot()}},[Ve.callbacks,Ve.toggleShortcut,Ce,qe,et]);var Ze=q.useRef(),tt=q.useCallback(function(Ke){var rt,it,ot=0;Ke===W.VisualState.animatingIn&&(ot=((rt=Ve.animations)===null||rt===void 0?void 0:rt.enterMs)||0),Ke===W.VisualState.animatingOut&&(ot=((it=Ve.animations)===null||it===void 0?void 0:it.exitMs)||0),clearTimeout(Ze.current),Ze.current=setTimeout(function(){var ut=!1;Ce.setVisualState(function(){var ct=Ke===W.VisualState.animatingIn?W.VisualState.showing:W.VisualState.hidden;return ct===W.VisualState.hidden&&(ut=!0),ct}),ut&&Ce.setCurrentRootAction(null)},ot)},[(Ee=Ve.animations)===null||Ee===void 0?void 0:Ee.enterMs,(Pe=Ve.animations)===null||Pe===void 0?void 0:Pe.exitMs,Ce]);q.useEffect(function(){switch(Re){case W.VisualState.animatingIn:case W.VisualState.animatingOut:tt(Re);break}},[tt,Re])}function ce(){var Ee=(0,ie.useKBar)(function(Ce){return{visualState:Ce.visualState}}),Pe=Ee.visualState,Je=Ee.options;q.useEffect(function(){if(!Je.disableDocumentLock)if(Pe===W.VisualState.animatingIn){if(document.body.style.overflow="hidden",!Je.disableScrollbarManagement){var Ce=(0,ne.getScrollbarWidth)(),Ve=getComputedStyle(document.body)["margin-right"];Ve&&(Ce+=Number(Ve.replace(/\D/g,""))),document.body.style.marginRight=Ce+"px"}}else Pe===W.VisualState.hidden&&(document.body.style.removeProperty("overflow"),Je.disableScrollbarManagement||document.body.style.removeProperty("margin-right"))},[Je.disableDocumentLock,Je.disableScrollbarManagement,Pe])}var pe=new WeakSet;function ge(Ee){return function(Pe){pe.has(Pe)||(Ee(Pe),pe.add(Pe))}}function ve(){var Ee=(0,ie.useKBar)(function(qe){return{actions:qe.actions,open:qe.visualState===W.VisualState.showing,disabled:qe.disabled}}),Pe=Ee.actions,Je=Ee.query,Ce=Ee.open,Ve=Ee.options,Re=Ee.disabled;q.useEffect(function(){var qe;if(!(Ce||Re)){for(var et=Object.keys(Pe).map(function(st){return Pe[st]}),Ze=[],tt=0,Ke=et;tt<Ke.length;tt++){var rt=Ke[tt];!((qe=rt.shortcut)===null||qe===void 0)&&qe.length&&Ze.push(rt)}Ze=Ze.sort(function(st,pt){return pt.shortcut.join(" ").length-st.shortcut.join(" ").length});for(var it={},ot=function(st){var pt=st.shortcut.join(" ");it[pt]=ge(function(lt){var vt,dt,xt,ft,Et,Ct;(0,ne.shouldRejectKeystrokes)()||(lt.preventDefault(),!((vt=st.children)===null||vt===void 0)&&vt.length?(Je.setCurrentRootAction(st.id),Je.toggle(),(xt=(dt=Ve.callbacks)===null||dt===void 0?void 0:dt.onOpen)===null||xt===void 0||xt.call(dt)):((ft=st.command)===null||ft===void 0||ft.perform(),(Ct=(Et=Ve.callbacks)===null||Et===void 0?void 0:Et.onSelectAction)===null||Ct===void 0||Ct.call(Et,st)))})},ut=0,ct=Ze;ut<ct.length;ut++){var rt=ct[ut];ot(rt)}var at=(0,Y.default)(window,it,{timeout:400});return function(){at()}}},[Pe,Ce,Ve.callbacks,Je,Re])}function be(){var Ee=q.useRef(!0),Pe=(0,ie.useKBar)(function(Re){return{isShowing:Re.visualState===W.VisualState.showing||Re.visualState===W.VisualState.animatingIn}}),Je=Pe.isShowing,Ce=Pe.query,Ve=q.useRef(null);q.useEffect(function(){if(Ee.current){Ee.current=!1;return}if(Je){Ve.current=document.activeElement;return}var Re=document.activeElement;(Re==null?void 0:Re.tagName.toLowerCase())==="input"&&Re.blur();var qe=Ve.current;qe&&qe!==Re&&qe.focus()},[Je]),q.useEffect(function(){function Re(qe){var et=Ce.getInput();qe.target!==et&&et.focus()}if(Je)return window.addEventListener("keydown",Re),function(){window.removeEventListener("keydown",Re)}},[Je,Ce])}return InternalEvents}var hasRequiredKBarContextProvider;function requireKBarContextProvider(){return hasRequiredKBarContextProvider||(hasRequiredKBarContextProvider=1,function(v){var N=KBarContextProvider&&KBarContextProvider.__createBinding||(Object.create?function(ne,se,ae,ce){ce===void 0&&(ce=ae),Object.defineProperty(ne,ce,{enumerable:!0,get:function(){return se[ae]}})}:function(ne,se,ae,ce){ce===void 0&&(ce=ae),ne[ce]=se[ae]}),G=KBarContextProvider&&KBarContextProvider.__setModuleDefault||(Object.create?function(ne,se){Object.defineProperty(ne,"default",{enumerable:!0,value:se})}:function(ne,se){ne.default=se}),z=KBarContextProvider&&KBarContextProvider.__importStar||function(ne){if(ne&&ne.__esModule)return ne;var se={};if(ne!=null)for(var ae in ne)ae!=="default"&&Object.prototype.hasOwnProperty.call(ne,ae)&&N(se,ne,ae);return G(se,ne),se};
40Object.defineProperty(v,"__esModule",{value:!0}),v.KBarProvider=v.KBarContext=void 0;var q=requireUseStore(),Y=z(requireReact()),W=requireInternalEvents();v.KBarContext=Y.createContext({});var ie=function(ne){var se=(0,q.useStore)(ne);return Y.createElement(v.KBarContext.Provider,{value:se},Y.createElement(W.InternalEvents,null),ne.children)};v.KBarProvider=ie}(KBarContextProvider)),KBarContextProvider}var hasRequiredUseKBar;function requireUseKBar(){if(hasRequiredUseKBar)return useKBar;hasRequiredUseKBar=1;var v=useKBar&&useKBar.__assign||function(){return v=Object.assign||function(ie){for(var ne,se=1,ae=arguments.length;se<ae;se++){ne=arguments[se];for(var ce in ne)Object.prototype.hasOwnProperty.call(ne,ce)&&(ie[ce]=ne[ce])}return ie},v.apply(this,arguments)},N=useKBar&&useKBar.__createBinding||(Object.create?function(ie,ne,se,ae){ae===void 0&&(ae=se),Object.defineProperty(ie,ae,{enumerable:!0,get:function(){return ne[se]}})}:function(ie,ne,se,ae){ae===void 0&&(ae=se),ie[ae]=ne[se]}),G=useKBar&&useKBar.__setModuleDefault||(Object.create?function(ie,ne){Object.defineProperty(ie,"default",{enumerable:!0,value:ne})}:function(ie,ne){ie.default=ne}),z=useKBar&&useKBar.__importStar||function(ie){if(ie&&ie.__esModule)return ie;var ne={};if(ie!=null)for(var se in ie)se!=="default"&&Object.prototype.hasOwnProperty.call(ie,se)&&N(ne,ie,se);return G(ne,ie),ne};Object.defineProperty(useKBar,"__esModule",{value:!0}),useKBar.useKBar=void 0;var q=z(requireReact()),Y=requireKBarContextProvider();function W(ie){var ne=q.useContext(Y.KBarContext),se=ne.query,ae=ne.getState,ce=ne.subscribe,pe=ne.options,ge=q.useRef(ie==null?void 0:ie(ae())),ve=q.useRef(ie),be=q.useCallback(function(Ce){return v(v({},Ce),{query:se,options:pe})},[se,pe]),Ee=q.useState(be(ge.current)),Pe=Ee[0],Je=Ee[1];return q.useEffect(function(){var Ce;return ve.current&&(Ce=ce(function(Ve){return ve.current(Ve)},function(Ve){return Je(be(Ve))})),function(){Ce&&Ce()}},[be,ce]),Pe}return useKBar.useKBar=W,useKBar}function isArray$2(v){return Array.isArray?Array.isArray(v):getTag(v)==="[object Array]"}function baseToString(v){if(typeof v=="string")return v;let N=v+"";return N=="0"&&1/v==-1/0?"-0":N}function toString(v){return v==null?"":baseToString(v)}function isString$2(v){return typeof v=="string"}function isNumber$2(v){return typeof v=="number"}function isBoolean$2(v){return v===!0||v===!1||isObjectLike(v)&&getTag(v)=="[object Boolean]"}function isObject$2(v){return typeof v=="object"}function isObjectLike(v){return isObject$2(v)&&v!==null}function isDefined$1(v){return v!=null}function isBlank(v){return!v.trim().length}function getTag(v){return v==null?v===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(v)}const INCORRECT_INDEX_TYPE="Incorrect 'index' type",LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY=v=>`Invalid value for key ${v}`,PATTERN_LENGTH_TOO_LARGE=v=>`Pattern length exceeds max of ${v}.`,MISSING_KEY_PROPERTY=v=>`Missing ${v} property in key`,INVALID_KEY_WEIGHT_VALUE=v=>`Property 'weight' in key '${v}' must be a positive integer`,hasOwn=Object.prototype.hasOwnProperty;class KeyStore{constructor(N){this._keys=[],this._keyMap={};let G=0;N.forEach(z=>{let q=createKey(z);G+=q.weight,this._keys.push(q),this._keyMap[q.id]=q,G+=q.weight}),this._keys.forEach(z=>{z.weight/=G})}get(N){return this._keyMap[N]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function createKey(v){let N=null,G=null,z=null,q=1,Y=null;if(isString$2(v)||isArray$2(v))z=v,N=createKeyPath(v),G=createKeyId(v);else{if(!hasOwn.call(v,"name"))throw new Error(MISSING_KEY_PROPERTY("name"));const W=v.name;if(z=W,hasOwn.call(v,"weight")&&(q=v.weight,q<=0))throw new Error(INVALID_KEY_WEIGHT_VALUE(W));N=createKeyPath(W),G=createKeyId(W),Y=v.getFn}return{path:N,id:G,weight:q,src:z,getFn:Y}}function createKeyPath(v){return isArray$2(v)?v:v.split(".")}function createKeyId(v){return isArray$2(v)?v.join("."):v}function get(v,N){let G=[],z=!1;const q=(Y,W,ie)=>{if(isDefined$1(Y))if(!W[ie])G.push(Y);else{let ne=W[ie];const se=Y[ne];if(!isDefined$1(se))return;if(ie===W.length-1&&(isString$2(se)||isNumber$2(se)||isBoolean$2(se)))G.push(toString(se));else if(isArray$2(se)){z=!0;for(let ae=0,ce=se.length;ae<ce;ae+=1)q(se[ae],W,ie+1)}else W.length&&q(se,W,ie+1)}};return q(v,isString$2(N)?N.split("."):N,0),z?G:G[0]}const MatchOptions={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},BasicOptions={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(v,N)=>v.score===N.score?v.idx<N.idx?-1:1:v.score<N.score?-1:1},FuzzyOptions={location:0,threshold:.6,distance:100},AdvancedOptions={useExtendedSearch:!1,getFn:get,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Config={...BasicOptions,...MatchOptions,...FuzzyOptions,...AdvancedOptions};const SPACE=/[^ ]+/g;function norm(v=1,N=3){const G=new Map,z=Math.pow(10,N);return{get(q){const Y=q.match(SPACE).length;if(G.has(Y))return G.get(Y);const W=1/Math.pow(Y,.5*v),ie=parseFloat(Math.round(W*z)/z);return G.set(Y,ie),ie},clear(){G.clear()}}}class FuseIndex{constructor({getFn:N=Config.getFn,fieldNormWeight:G=Config.fieldNormWeight}={}){this.norm=norm(G,3),this.getFn=N,this.isCreated=!1,this.setIndexRecords()}setSources(N=[]){this.docs=N}setIndexRecords(N=[]){this.records=N}setKeys(N=[]){this.keys=N,this._keysMap={}
vendor: 15,499 bytes, line 40
40,N.forEach((G,z)=>{this._keysMap[G.id]=z})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,isString$2(this.docs[0])?this.docs.forEach((N,G)=>{this._addString(N,G)}):this.docs.forEach((N,G)=>{this._addObject(N,G)}),this.norm.clear())}add(N){const G=this.size();isString$2(N)?this._addString(N,G):this._addObject(N,G)}removeAt(N){this.records.splice(N,1);for(let G=N,z=this.size();G<z;G+=1)this.records[G].i-=1}getValueForItemAtKeyId(N,G){return N[this._keysMap[G]]}size(){return this.records.length}_addString(N,G){if(!isDefined$1(N)||isBlank(N))return;let z={v:N,i:G,n:this.norm.get(N)};this.records.push(z)}_addObject(N,G){let z={i:G,$:{}};this.keys.forEach((q,Y)=>{let W=q.getFn?q.getFn(N):this.getFn(N,q.path);if(isDefined$1(W)){if(isArray$2(W)){let ie=[];const ne=[{nestedArrIndex:-1,value:W}];for(;ne.length;){const{nestedArrIndex:se,value:ae}=ne.pop();if(isDefined$1(ae))if(isString$2(ae)&&!isBlank(ae)){let ce={v:ae,i:se,n:this.norm.get(ae)};ie.push(ce)}else isArray$2(ae)&&ae.forEach((ce,pe)=>{ne.push({nestedArrIndex:pe,value:ce})})}z.$[Y]=ie}else if(isString$2(W)&&!isBlank(W)){let ie={v:W,n:this.norm.get(W)};z.$[Y]=ie}}}),this.records.push(z)}toJSON(){return{keys:this.keys,records:this.records}}}function createIndex$1(v,N,{getFn:G=Config.getFn,fieldNormWeight:z=Config.fieldNormWeight}={}){const q=new FuseIndex({getFn:G,fieldNormWeight:z});return q.setKeys(v.map(createKey)),q.setSources(N),q.create(),q}function parseIndex(v,{getFn:N=Config.getFn,fieldNormWeight:G=Config.fieldNormWeight}={}){const{keys:z,records:q}=v,Y=new FuseIndex({getFn:N,fieldNormWeight:G});return Y.setKeys(z),Y.setIndexRecords(q),Y}function computeScore$1(v,{errors:N=0,currentLocation:G=0,expectedLocation:z=0,distance:q=Config.distance,ignoreLocation:Y=Config.ignoreLocation}={}){const W=N/v.length;if(Y)return W;const ie=Math.abs(z-G);return q?W+ie/q:ie?1:W}function convertMaskToIndices(v=[],N=Config.minMatchCharLength){let G=[],z=-1,q=-1,Y=0;for(let W=v.length;Y<W;Y+=1){let ie=v[Y];ie&&z===-1?z=Y:!ie&&z!==-1&&(q=Y-1,q-z+1>=N&&G.push([z,q]),z=-1)}return v[Y-1]&&Y-z>=N&&G.push([z,Y-1]),G}const MAX_BITS=32;function search(v,N,G,{location:z=Config.location,distance:q=Config.distance,threshold:Y=Config.threshold,findAllMatches:W=Config.findAllMatches,minMatchCharLength:ie=Config.minMatchCharLength,includeMatches:ne=Config.includeMatches,ignoreLocation:se=Config.ignoreLocation}={}){if(N.length>MAX_BITS)throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));const ae=N.length,ce=v.length,pe=Math.max(0,Math.min(z,ce));let ge=Y,ve=pe;const be=ie>1||ne,Ee=be?Array(ce):[];let Pe;for(;(Pe=v.indexOf(N,ve))>-1;){let et=computeScore$1(N,{currentLocation:Pe,expectedLocation:pe,distance:q,ignoreLocation:se});if(ge=Math.min(et,ge),ve=Pe+ae,be){let Ze=0;for(;Ze<ae;)Ee[Pe+Ze]=1,Ze+=1}}ve=-1;let Je=[],Ce=1,Ve=ae+ce;const Re=1<<ae-1;for(let et=0;et<ae;et+=1){let Ze=0,tt=Ve;for(;Ze<tt;)computeScore$1(N,{errors:et,currentLocation:pe+tt,expectedLocation:pe,distance:q,ignoreLocation:se})<=ge?Ze=tt:Ve=tt,tt=Math.floor((Ve-Ze)/2+Ze);Ve=tt;let Ke=Math.max(1,pe-tt+1),rt=W?ce:Math.min(pe+tt,ce)+ae,it=Array(rt+2);it[rt+1]=(1<<et)-1;for(let ut=rt;ut>=Ke;ut-=1){let ct=ut-1,at=G[v.charAt(ct)];if(be&&(Ee[ct]=+!!at),it[ut]=(it[ut+1]<<1|1)&at,et&&(it[ut]|=(Je[ut+1]|Je[ut])<<1|1|Je[ut+1]),it[ut]&Re&&(Ce=computeScore$1(N,{errors:et,currentLocation:ct,expectedLocation:pe,distance:q,ignoreLocation:se}),Ce<=ge)){if(ge=Ce,ve=ct,ve<=pe)break;Ke=Math.max(1,2*pe-ve)}}if(computeScore$1(N,{errors:et+1,currentLocation:pe,expectedLocation:pe,distance:q,ignoreLocation:se})>ge)break;Je=it}const qe={isMatch:ve>=0,score:Math.max(.001,Ce)};if(be){const et=convertMaskToIndices(Ee,ie);et.length?ne&&(qe.indices=et):qe.isMatch=!1}return qe}function createPatternAlphabet(v){let N={};for(let G=0,z=v.length;G<z;G+=1){const q=v.charAt(G);N[q]=(N[q]||0)|1<<z-G-1}return N}class BitapSearch{constructor(N,{location:G=Config.location,threshold:z=Config.threshold,distance:q=Config.distance,includeMatches:Y=Config.includeMatches,findAllMatches:W=Config.findAllMatches,minMatchCharLength:ie=Config.minMatchCharLength,isCaseSensitive:ne=Config.isCaseSensitive,ignoreLocation:se=Config.ignoreLocation}={}){if(this.options={location:G,threshold:z,distance:q,includeMatches:Y,findAllMatches:W,minMatchCharLength:ie,isCaseSensitive:ne,ignoreLocation:se},this.pattern=ne?N:N.toLowerCase(),this.chunks=[],!this.pattern.length)return;const ae=(pe,ge)=>{this.chunks.push({pattern:pe,alphabet:createPatternAlphabet(pe),startIndex:ge})},ce=this.pattern.length;if(ce>MAX_BITS){let pe=0;const ge=ce%MAX_BITS,ve=ce-ge;for(;pe<ve;)ae(this.pattern.substr(pe,MAX_BITS),pe),pe+=MAX_BITS;if(ge){const be=ce-MAX_BITS;ae(this.pattern.substr(be),be)}}else ae(this.pattern,0)}searchIn(N){const{isCaseSensitive:G,includeMatches:z}=this.options;if(G||(N=N.toLowerCase()),this.pattern===N){let ve={isMatch:!0,score:0};return z&&(ve.indices=[[0,N.length-1]]),ve}const{location:q,distance:Y,threshold:W,findAllMatches:ie,minMatchCharLength:ne,ignoreLocation:se}=this.options;let ae=[],ce=0,pe=!1;this.chunks.forEach(({pattern:ve,alphabet:be,startIndex:Ee})=>{const{isMatch:Pe,score:Je,indices:Ce}=search(N,ve,be,{location:q+Ee,distance:Y,threshold:W,findAllMatches:ie,minMatchCharLength:ne,includeMatches:z,ignoreLocation:se});Pe&&(pe=!0),ce+=Je,Pe&&Ce&&(ae=[...ae,...Ce])});let ge={isMatch:pe,score:pe?ce/this.chunks.length:1};return pe&&z&&(ge.indices=ae),ge}}class BaseMatch{constructor(N){this.pattern=N}static isMultiMatch(N){return getMatch(N,this.multiRegex)}static isSingleMatch(N){return getMatch(N,this.singleRegex)}search(){}}function getMatch(v,N){const G=v.match(N);return G?G[1]:null}class ExactMatch extends BaseMatch{constructor(N){super(N)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(N){const G=N===this.pattern;return{isMatch:G,score:G?0:1,indices:[0,this.pattern.length-1]}}}class InverseExactMatch extends BaseMatch{constructor(N){super(N)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(N){const z=N.indexOf(this.pattern)===-1;return{isMatch:z,score:z?0:1,indices:[0,N.length-1]}}}class PrefixExactMatch extends BaseMatch{constructor(N){super(N)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(N){const G=N.startsWith(this.pattern);return{isMatch:G,score:G?0:1,indices:[0,this.pattern.length-1]}}}class InversePrefixExactMatch extends BaseMatch{constructor(N){super(N)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(N){const G=!N.startsWith(this.pattern);return{isMatch:G,score:G?0:1,indices:[0,N.length-1]}}}class SuffixExactMatch extends BaseMatch{constructor(N){super(N)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(N){const G=N.endsWith(this.pattern);return{isMatch:G,score:G?0:1,indices:[N.length-this.pattern.length,N.length-1]}}}class InverseSuffixExactMatch extends BaseMatch{constructor(N){super(N)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(N){const G=!N.endsWith(this.pattern);return{isMatch:G,score:G?0:1,indices:[0,N.length-1]}}}class FuzzyMatch extends BaseMatch{constructor(N,{location:G=Config.location,threshold:z=Config.threshold,distance:q=Config.distance,includeMatches:Y=Config.includeMatches,findAllMatches:W=Config.findAllMatches,minMatchCharLength:ie=Config.minMatchCharLength,isCaseSensitive:ne=Config.isCaseSensitive,ignoreLocation:se=Config.ignoreLocation}={}){super(N),this._bitapSearch=new BitapSearch(N,{location:G,threshold:z,distance:q,includeMatches:Y,findAllMatches:W,minMatchCharLength:ie,isCaseSensitive:ne,ignoreLocation:se})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(N){return this._bitapSearch.searchIn(N)}}class IncludeMatch extends BaseMatch{constructor(N){super(N)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(N){let G=0,z;const q=[],Y=this.pattern.length;for(;(z=N.indexOf(this.pattern,G))>-1;)G=z+Y,q.push([z,G-1]);const W=!!q.length;return{isMatch:W,score:W?0:1,indices:q}}}const searchers=[ExactMatch,IncludeMatch,PrefixExactMatch,InversePrefixExactMatch,InverseSuffixExactMatch,SuffixExactMatch,InverseExactMatch,FuzzyMatch],searchersLen=searchers.length,SPACE_RE=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,OR_TOKEN="|";function parseQuery(v,N={}){return v.split(OR_TOKEN).map(G=>{let z=G.trim().split(SPACE_RE).filter(Y=>Y&&!!Y.trim()),q=[];for(let Y=0,W=z.length;Y<W;Y+=1){const ie=z[Y];let ne=!1,se=-1;for(;!ne&&++se<searchersLen;){const ae=searchers[se];let ce=ae.isMultiMatch(ie);ce&&(q.push(new ae(ce,N)),ne=!0)}if(!ne)for(se=-1;++se<searchersLen;){const ae=searchers[se];let ce=ae.isSingleMatch(ie);if(ce){q.push(new ae(ce,N));break}}}return q})}const MultiMatchSet=new Set([FuzzyMatch.type,IncludeMatch.type]);class ExtendedSearch{constructor(N,{isCaseSensitive:G=Config.isCaseSensitive,includeMatches:z=Config.includeMatches,minMatchCharLength:q=Config.minMatchCharLength,ignoreLocation:Y=Config.ignoreLocation,findAllMatches:W=Config.findAllMatches,location:ie=Config.location,threshold:ne=Config.threshold,distance:se=Config.distance}={}){this.query=null,this.options={isCaseSensitive:G,includeMatches:z,minMatchCharLength:q,findAllMatches:W,ignoreLocation:Y,location:ie,threshold:ne,distance:se},this.pattern=G?N:N.toLowerCase(),this.query=parseQuery(this.pattern,this.options)}static condition(N,G){return G.useExtendedSearch}searchIn(N){const G=this.query;if(!G)return{isMatch:!1,score:1};const{includeMatches:z,isCaseSensitive:q}=this.options;N=q?N:N.toLowerCase();let Y=0,W=[],ie=0;for(let ne=0,se=G.length;ne<se;ne+=1){const ae=G[ne];W.length=0,Y=0;for(let ce=0,pe=ae.length;ce<pe;ce+=1){const ge=ae[ce],{isMatch:ve,indices:be,score:Ee}=ge.search(N);if(ve){if(Y+=1,ie+=Ee,z){const Pe=ge.constructor.type;MultiMatchSet.has(Pe)?W=[...W,...be]:W.push(be)}}else{ie=0,Y=0,W.length=0;break}}if(Y){let ce={isMatch:!0,score:ie/Y};return z&&(ce.indices=W),ce}}return{isMatch:!1,score:1}}}const registeredSearchers=[];function register(...v){registeredSearchers.push(...v)}function createSearcher(v,N){for(let G=0,z=registeredSearchers.length;G<z;G+=1){let q=registeredSearchers[G];if(q.condition(v,N))return new q(v,N)}return new BitapSearch(v,N)}const LogicalOperator={AND:"$and",OR:"$or"},KeyType={PATH:"$path",PATTERN:"$val"},isExpression=v=>!!(v[LogicalOperator.AND]||v[LogicalOperator.OR]),isPath=v=>!!v[KeyType.PATH],isLeaf=v=>!isArray$2(v)&&isObject$2(v)&&!isExpression(v),convertToExplicit=v=>({[LogicalOperator.AND]:Object.keys(v).map(N=>({[N]:v[N]}))});function parse$1(v,N,{auto:G=!0}={}){const z=q=>{let Y=Object.keys(q);const W=isPath(q);if(!W&&Y.length>1&&!isExpression(q))return z(convertToExplicit(q));if(isLeaf(q)){const ne=W?q[KeyType.PATH]:Y[0],se=W?q[KeyType.PATTERN]:q[ne];if(!isString$2(se))throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(ne));const ae={keyId:createKeyId(ne),pattern:se};return G&&(ae.searcher=createSearcher(se,N)),ae}let ie={children:[],operator:Y[0]};return Y.forEach(ne=>{const se=q[ne];isArray$2(se)&&se.forEach(ae=>{ie.children.push(z(ae))})}),ie};return isExpression(v)||(v=convertToExplicit(v)),z(v)}function computeScore(v,{ignoreFieldNorm:N=Config.ignoreFieldNorm}){v.forEach(G=>{let z=1;G.matches.forEach(({key:q,norm:Y,score:W})=>{const ie=q?q.weight:null;z*=Math.pow(W===0&&ie?Number.EPSILON:W,(ie||1)*(N?1:Y))}),G.score=z})}function transformMatches(v,N){const G=v.matches;N.matches=[],isDefined$1(G)&&G.forEach(z=>{if(!isDefined$1(z.indices)||!z.indices.length)return;const{indices:q,value:Y}=z;let W={indices:q,value:Y};z.key&&(W.key=z.key.src),z.idx>-1&&(W.refIndex=z.idx),N.matches.push(W)})}function transformScore(v,N){N.score=v.score}function format$3(v,N,{includeMatches:G=Config.includeMatches,includeScore:z=Config.includeScore}={}){const q=[];return G&&q.push(transformMatches),z&&q.push(transformScore),v.map(Y=>{const{idx:W}=Y,ie={item:N[W],refIndex:W};return q.length&&q.forEach(ne=>{ne(Y,ie)}),ie})}class Fuse{constructor(N,G={},z){this.options={...Config,...G},this.options.useExtendedSearch,this._keyStore=new KeyStore(this.options.keys),this.setCollection(N,z)}setCollection(N,G){if(this._docs=N,G&&!(G instanceof FuseIndex))throw new Error(INCORRECT_INDEX_TYPE);this._myIndex=G||createIndex$1(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(N){isDefined$1(N)&&(this._docs.push(N),this._myIndex.add(N))}remove(N=()=>!1){const G=[];for(let z=0,q=this._docs.length;z<q;z+=1){const Y=this._docs[z];N(Y,z)&&(this.removeAt(z),z-=1,q-=1,G.push(Y))}return G}removeAt(N){this._docs.splice(N,1),this._myIndex.removeAt(N)}getIndex(){return this._myIndex}search(N,{limit:G=-1}={}){const{includeMatches:z,includeScore:q,shouldSort:Y,sortFn:W,ignoreFieldNorm:ie}=this.options;let ne=isString$2(N)?isString$2(this._docs[0])?this._searchStringList(N):this._searchObjectList(N):this._searchLogical(N);return computeScore(ne,{ignoreFieldNorm:ie}),Y&&ne.sort(W),isNumber$2(G)&&G>-1&&(ne=ne.slice(0,G)),format$3(ne,this._docs,{includeMatches:z,includeScore:q})}_searchStringList(N){const G=createSearcher(N,this.options),{records:z}=this._myIndex,q=[];return z.forEach(({v:Y,i:W,n:ie})=>{if(!isDefined$1(Y))return;const{isMatch:ne,score:se,indices:ae}=G.searchIn(Y);ne&&q.push({item:Y,idx:W,matches:[{score:se,value:Y,norm:ie,indices:ae}]})}),q}_searchLogical(N){const G=parse$1(N,this.options),z=(ie,ne,se)=>{if(!ie.children){const{keyId:ce,searcher:pe}=ie,ge=this._findMatches({key:this._keyStore.get(ce),value:this._myIndex.getValueForItemAtKeyId(ne,ce),searcher:pe});return ge&&ge.length?[{idx:se,item:ne,matches:ge}]:[]}const ae=[];for(let ce=0,pe=ie.children.length;ce<pe;ce+=1){const ge=ie.children[ce],ve=z(ge,ne,se);if(ve.length)ae.push(...ve);else if(ie.operator===LogicalOperator.AND)return[]}return ae},q=this._myIndex.records,Y={},W=[];return q.forEach(({$:ie,i:ne})=>{if(isDefined$1(ie)){let se=z(G,ie,ne);se.length&&(Y[ne]||(Y[ne]={idx:ne,item:ie,matches:[]},W.push(Y[ne])),se.forEach(({matches:ae})=>{Y[ne].matches.push(...ae)}))}}),W}_searchObjectList(N){const G=createSearcher(N,this.options),{keys:z,records:q}=this._myIndex,Y=[];return q.forEach(({$:W,i:ie})=>{if(!isDefined$1(W))return;let ne=[];z.forEach((se,ae)=>{ne.push(...this._findMatches({key:se,value:W[ae],searcher:G}))}),ne.length&&Y.push({idx:ie,item:W,matches:ne})}),Y}_findMatches({key:N,value:G,searcher:z}){if(!isDefined$1(G))return[];let q=[];if(isArray$2(G))G.forEach(({v:Y,i:W,n:ie})=>{if(!isDefined$1(Y))return;const{isMatch:ne,score:se,indices:ae}=z.searchIn(Y);ne&&q.push({score:se,key:N,value:Y,idx:W,norm:ie,indices:ae})});else{const{v:Y,n:W}=G,{isMatch:ie,score:ne,indices:se}=z.searchIn(Y);ie&&q.push({score:ne,key:N,value:Y,norm:W,indices:se})}return q}}Fuse.version="6.6.2";Fuse.createIndex=createIndex$1;Fuse.parseIndex=parseIndex;Fuse.config=Config;Fuse.parseQuery=parse$1;register(ExtendedSearch);const fuse_esm=Object.freeze(Object.defineProperty({__proto__:null,default:Fuse},Symbol.toStringTag,{value:"Module"})),require$$3=getAugmentedNamespace(fuse_esm);var hasRequiredUseMatches;
40function requireUseMatches(){return hasRequiredUseMatches||(hasRequiredUseMatches=1,function(v){var N=useMatches&&useMatches.__createBinding||(Object.create?function(ge,ve,be,Ee){Ee===void 0&&(Ee=be),Object.defineProperty(ge,Ee,{enumerable:!0,get:function(){return ve[be]}})}:function(ge,ve,be,Ee){Ee===void 0&&(Ee=be),ge[Ee]=ve[be]}),G=useMatches&&useMatches.__setModuleDefault||(Object.create?function(ge,ve){Object.defineProperty(ge,"default",{enumerable:!0,value:ve})}:function(ge,ve){ge.default=ve}),z=useMatches&&useMatches.__importStar||function(ge){if(ge&&ge.__esModule)return ge;var ve={};if(ge!=null)for(var be in ge)be!=="default"&&Object.prototype.hasOwnProperty.call(ge,be)&&N(ve,ge,be);return G(ve,ge),ve},q=useMatches&&useMatches.__importDefault||function(ge){return ge&&ge.__esModule?ge:{default:ge}};Object.defineProperty(v,"__esModule",{value:!0}),v.useDeepMatches=v.useMatches=v.NO_GROUP=void 0;var Y=z(requireReact()),W=requireUseKBar(),ie=requireUtils(),ne=q(require$$3);v.NO_GROUP={name:"none",priority:ie.Priority.NORMAL};var se={keys:[{name:"name",weight:.5},{name:"keywords",getFn:function(ge){var ve;return((ve=ge.keywords)!==null&&ve!==void 0?ve:"").split(",")},weight:.5},"subtitle"],ignoreLocation:!0,includeScore:!0,includeMatches:!0,threshold:.2,minMatchCharLength:1};function ae(ge,ve){return ve.priority-ge.priority}function ce(){var ge=(0,W.useKBar)(function(tt){return{search:tt.searchQuery,actions:tt.actions,rootActionId:tt.currentRootActionId}}),ve=ge.search,be=ge.actions,Ee=ge.rootActionId,Pe=Y.useMemo(function(){return Object.keys(be).reduce(function(tt,Ke){var rt=be[Ke];if(!rt.parent&&!Ee&&tt.push(rt),rt.id===Ee)for(var it=0;
40it<rt.children.length;it++)tt.push(rt.children[it]);return tt},[]).sort(ae)},[be,Ee]),Je=Y.useCallback(function(tt){for(var Ke=[],rt=0;rt<tt.length;rt++)Ke.push(tt[rt]);return function it(ot,ut){ut===void 0&&(ut=Ke);for(var ct=0;ct<ot.length;ct++)if(ot[ct].children.length>0){for(var at=ot[ct].children,st=0;st<at.length;st++)ut.push(at[st]);it(ot[ct].children,ut)}return ut}(tt)},[]),Ce=!ve,Ve=Y.useMemo(function(){return Ce?Pe:Je(Pe)},[Je,Pe,Ce]),Re=Y.useMemo(function(){return new ne.default(Ve,se)},[Ve]),qe=pe(Ve,ve,Re),et=Y.useMemo(function(){for(var tt,Ke,rt={},it=[],ot=[],ut=0;ut<qe.length;ut++){var ct=qe[ut],at=ct.action,st=ct.score||ie.Priority.NORMAL,pt={name:typeof at.section=="string"?at.section:((tt=at.section)===null||tt===void 0?void 0:tt.name)||v.NO_GROUP.name,priority:typeof at.section=="string"?st:((Ke=at.section)===null||Ke===void 0?void 0:Ke.priority)||0+st};rt[pt.name]||(rt[pt.name]=[],it.push(pt)),rt[pt.name].push({priority:at.priority+st,action:at})}ot=it.sort(ae).map(function(xt){return{name:xt.name,actions:rt[xt.name].sort(ae).map(function(ft){return ft.action})}});for(var lt=[],ut=0;ut<ot.length;ut++){var vt=ot[ut];vt.name!==v.NO_GROUP.name&&lt.push(vt.name);for(var dt=0;dt<vt.actions.length;dt++)lt.push(vt.actions[dt])}return lt},[qe]),Ze=Y.useMemo(function(){return Ee},[et]);return Y.useMemo(function(){return{results:et,rootActionId:Ze}},[Ze,et])}v.useMatches=ce;function pe(ge,ve,be){var Ee=Y.useMemo(function(){return{filtered:ge,search:ve}},[ge,ve]),Pe=(0,ie.useThrottledValue)(Ee),Je=Pe.filtered,Ce=Pe.search;return Y.useMemo(function(){if(Ce.trim()==="")return Je.map(function(qe){return{score:0,action:qe}});var Ve=[],Re=be.search(Ce);return Ve=Re.map(function(qe){var et=qe.item,Ze=qe.score;return{score:1/((Ze??0)+1),action:et}}),Ve},[Je,Ce,be])}v.useDeepMatches=ce}(useMatches)),useMatches}var KBarPortal={},dist$5,hasRequiredDist$5;function requireDist$5(){if(hasRequiredDist$5)return dist$5;hasRequiredDist$5=1;var v=Object.create,N=Object.defineProperty,G=Object.getOwnPropertyDescriptor,z=Object.getOwnPropertyNames,q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,W=(be,Ee)=>{for(var Pe in Ee)N(be,Pe,{get:Ee[Pe],enumerable:!0})},ie=(be,Ee,Pe,Je)=>{if(Ee&&typeof Ee=="object"||typeof Ee=="function")for(let Ce of z(Ee))!Y.call(be,Ce)&&Ce!==Pe&&N(be,Ce,{get:()=>Ee[Ce],enumerable:!(Je=G(Ee,Ce))||Je.enumerable});return be},ne=(be,Ee,Pe)=>(Pe=be!=null?v(q(be)):{},ie(!be||!be.__esModule?N(Pe,"default",{value:be,enumerable:!0}):Pe,be)),se=be=>ie(N({},"__esModule",{value:!0}),be),ae={};W(ae,{composeRefs:()=>ge,useComposedRefs:()=>ve}),dist$5=se(ae);var ce=ne(requireReact());function pe(be,Ee){if(typeof be=="function")return be(Ee);be!=null&&(be.current=Ee)}function ge(...be){return Ee=>{let Pe=!1;const Je=be.map(Ce=>{const Ve=pe(Ce,Ee);return!Pe&&typeof Ve=="function"&&(Pe=!0),Ve});if(Pe)return()=>{for(let Ce=0;Ce<Je.length;Ce++){const Ve=Je[Ce];typeof Ve=="function"?Ve():pe(be[Ce],null)}}}}function ve(...be){return ce.useCallback(ge(...be),be)}return dist$5}var dist$4,hasRequiredDist$4;function requireDist$4(){if(hasRequiredDist$4)return dist$4;hasRequiredDist$4=1;var v=Object.create,N=Object.defineProperty,G=Object.getOwnPropertyDescriptor,z=Object.getOwnPropertyNames,q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,W=(et,Ze)=>{for(var tt in Ze)N(et,tt,{get:Ze[tt],enumerable:!0})},ie=(et,Ze,tt,Ke)=>{if(Ze&&typeof Ze=="object"||typeof Ze=="function")for(let rt of z(Ze))!Y.call(et,rt)&&rt!==tt&&N(et,rt,{get:()=>Ze[rt],enumerable:!(Ke=G(Ze,rt))||Ke.enumerable});return et},ne=(et,Ze,tt)=>(tt=et!=null?v(q(et)):{},ie(!et||!et.__esModule?N(tt,"default",{value:et,enumerable:!0}):tt,et)),se=et=>ie(N({},"__esModule",{value:!0}),et),ae={};W(ae,{Root:()=>be,Slot:()=>be,Slottable:()=>Ce,createSlot:()=>ve,createSlottable:()=>Je}),dist$4=se(ae);var ce=ne(requireReact()),pe=requireDist$5(),ge=requireJsxRuntime();function ve(et){const Ze=Ee(et),tt=ce.forwardRef((Ke,rt)=>{const{children:it,...ot}=Ke,ut=ce.Children.toArray(it),ct=ut.find(Ve);if(ct){const at=ct.props.children,st=ut.map(pt=>pt===ct?ce.Children.count(at)>1?ce.Children.only(null):ce.isValidElement(at)?at.props.children:null:pt);return(0,ge.jsx)(Ze,{...ot,ref:rt,children:ce.isValidElement(at)?ce.cloneElement(at,void 0,st):null})}return(0,ge.jsx)(Ze,{...ot,ref:rt,children:it})});return tt.displayName=`${et}.Slot`,tt}var be=ve("Slot");function Ee(et){const Ze=ce.forwardRef((tt,Ke)=>{const{children:rt,...it}=tt;if(ce.isValidElement(rt)){const ot=qe(rt),ut=Re(it,rt.props);return rt.type!==ce.Fragment&&(ut.ref=Ke?(0,pe.composeRefs)(Ke,ot):ot),ce.cloneElement(rt,ut)}return ce.Children.count(rt)>1?ce.Children.only(null):null});return Ze.displayName=`${et}.SlotClone`,Ze}var Pe=Symbol("radix.slottable");function Je(et){const Ze=({children:tt})=>(0,ge.jsx)(ge.Fragment,{children:tt});return Ze.displayName=`${et}.Slottable`,Ze.__radixId=Pe,Ze}var Ce=Je("Slottable");function Ve(et){return ce.isValidElement(et)&&typeof et.type=="function"&&"__radixId"in et.type&&et.type.__radixId===Pe}function Re(et,Ze){const tt={...Ze};for(const Ke in Ze){const rt=et[Ke],it=Ze[Ke];/^on[A-Z]/.test(Ke)?rt&&it?tt[Ke]=(...ut)=>{it(...ut),rt(...ut)}:rt&&(tt[Ke]=rt):Ke==="style"?tt[Ke]={...rt,...it}
40:Ke==="className"&&(tt[Ke]=[rt,it].filter(Boolean).join(" "))}return{...et,...tt}}function qe(et){var Ke,rt;let Ze=(Ke=Object.getOwnPropertyDescriptor(et.props,"ref"))==null?void 0:Ke.get,tt=Ze&&"isReactWarning"in Ze&&Ze.isReactWarning;return tt?et.ref:(Ze=(rt=Object.getOwnPropertyDescriptor(et,"ref"))==null?void 0:rt.get,tt=Ze&&"isReactWarning"in Ze&&Ze.isReactWarning,tt?et.props.ref:et.props.ref||et.ref)}return dist$4}var dist$3,hasRequiredDist$3;function requireDist$3(){if(hasRequiredDist$3)return dist$3;hasRequiredDist$3=1;var v=Object.create,N=Object.defineProperty,G=Object.getOwnPropertyDescriptor,z=Object.getOwnPropertyNames,q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,W=(Ce,Ve)=>{for(var Re in Ve)N(Ce,Re,{get:Ve[Re],enumerable:!0})},ie=(Ce,Ve,Re,qe)=>{if(Ve&&typeof Ve=="object"||typeof Ve=="function")for(let et of z(Ve))!Y.call(Ce,et)&&et!==Re&&N(Ce,et,{get:()=>Ve[et],enumerable:!(qe=G(Ve,et))||qe.enumerable});return Ce},ne=(Ce,Ve,Re)=>(Re=Ce!=null?v(q(Ce)):{},ie(!Ce||!Ce.__esModule?N(Re,"default",{value:Ce,enumerable:!0}):Re,Ce)),se=Ce=>ie(N({},"__esModule",{value:!0}),Ce),ae={};W(ae,{Primitive:()=>Ee,Root:()=>Je,dispatchDiscreteCustomEvent:()=>Pe}),dist$3=se(ae);var ce=ne(requireReact()),pe=ne(requireReactDom()),ge=requireDist$4(),ve=requireJsxRuntime(),be=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ee=be.reduce((Ce,Ve)=>{const Re=(0,ge.createSlot)(`Primitive.${Ve}`),qe=ce.forwardRef((et,Ze)=>{const{asChild:tt,...Ke}=et,rt=tt?Re:Ve;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,ve.jsx)(rt,{...
40Ke,ref:Ze})});return qe.displayName=`Primitive.${Ve}`,{...Ce,[Ve]:qe}},{});function Pe(Ce,Ve){Ce&&pe.flushSync(()=>Ce.dispatchEvent(Ve))}var Je=Ee;return dist$3}var dist$2,hasRequiredDist$2;function requireDist$2(){if(hasRequiredDist$2)return dist$2;hasRequiredDist$2=1;var v=Object.create,N=Object.defineProperty,G=Object.getOwnPropertyDescriptor,z=Object.getOwnPropertyNames,q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,W=(ge,ve)=>{for(var be in ve)N(ge,be,{get:ve[be],enumerable:!0})},ie=(ge,ve,be,Ee)=>{if(ve&&typeof ve=="object"||typeof ve=="function")for(let Pe of z(ve))!Y.call(ge,Pe)&&Pe!==be&&N(ge,Pe,{get:()=>ve[Pe],enumerable:!(Ee=G(ve,Pe))||Ee.enumerable});return ge},ne=(ge,ve,be)=>(be=ge!=null?v(q(ge)):{},ie(!ge||!ge.__esModule?N(be,"default",{value:ge,enumerable:!0}):be,ge)),se=ge=>ie(N({},"__esModule",{value:!0}),ge),ae={};W(ae,{useLayoutEffect:()=>pe}),dist$2=se(ae);var ce=ne(requireReact()),pe=globalThis!=null&&globalThis.document?ce.useLayoutEffect:()=>{};return dist$2}var dist$1,hasRequiredDist$1;function requireDist$1(){if(hasRequiredDist$1)return dist$1;hasRequiredDist$1=1;var v=Object.create,N=Object.defineProperty,G=Object.getOwnPropertyDescriptor,z=Object.getOwnPropertyNames,q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,W=(Ce,Ve)=>{for(var Re in Ve)N(Ce,Re,{get:Ve[Re],enumerable:!0})},ie=(Ce,Ve,Re,qe)=>{if(Ve&&typeof Ve=="object"||typeof Ve=="function")for(let et of z(Ve))!Y.call(Ce,et)&&et!==Re&&N(Ce,et,{get:()=>Ve[et],enumerable:!(qe=G(Ve,et))||qe.enumerable});return Ce},ne=(Ce,Ve,Re)=>(Re=Ce!=null?v(q(Ce)):{},ie(!Ce||!Ce.__esModule?N(Re,"default",{value:Ce,enumerable:!0}):Re,Ce)),se=Ce=>ie(N({},"__esModule",{value:!0}),Ce),ae={};W(ae,{Portal:()=>Pe,Root:()=>Je}),dist$1=se(ae);var ce=ne(requireReact()),pe=ne(requireReactDom()),ge=requireDist$3(),ve=requireDist$2(),be=requireJsxRuntime(),Ee="Portal",Pe=ce.forwardRef((Ce,Ve)=>{var Ke;const{container:Re,...qe}=Ce,[et,Ze]=ce.useState(!1);(0,ve.useLayoutEffect)(()=>Ze(!0),[]);const tt=Re||et&&((Ke=globalThis==null?void 0:globalThis.document)==null?void 0:Ke.body);return tt?pe.default.createPortal((0,be.jsx)(ge.Primitive.div,{...qe,ref:Ve}),tt):null});Pe.displayName=Ee;var Je=Pe;return dist$1}var hasRequiredKBarPortal;function requireKBarPortal(){if(hasRequiredKBarPortal)return KBarPortal;hasRequiredKBarPortal=1;var v=KBarPortal&&KBarPortal.__createBinding||(Object.create?function(ne,se,ae,ce){ce===void 0&&(ce=ae),Object.defineProperty(ne,ce,{enumerable:!0,get:function(){return se[ae]}})}:function(ne,se,ae,ce){ce===void 0&&(ce=ae),ne[ce]=se[ae]}),N=KBarPortal&&KBarPortal.__setModuleDefault||(Object.create?function(ne,se){Object.defineProperty(ne,"default",{enumerable:!0,value:se})}:function(ne,se){ne.default=se}),G=KBarPortal&&KBarPortal.__importStar||function(ne){if(ne&&ne.__esModule)return ne;var se={};if(ne!=null)for(var ae in ne)ae!=="default"&&Object.prototype.hasOwnProperty.call(ne,ae)&&v(se,ne,ae);return N(se,ne),se};Object.defineProperty(KBarPortal,"__esModule",{value:!0}),KBarPortal.KBarPortal=void 0;var z=requireDist$1(),q=G(requireReact()),Y=requireTypes(),W=requireUseKBar();function ie(ne){var se=ne.children,ae=ne.container,ce=(0,W.useKBar)(function(pe){return{showing:pe.visualState!==Y.VisualState.hidden}}).showing;return ce?q.createElement(z.Portal,{container:ae},se):null}return KBarPortal.KBarPortal=ie,KBarPortal}var KBarPositioner={},hasRequiredKBarPositioner;function requireKBarPositioner(){if(hasRequiredKBarPositioner)return KBarPositioner;hasRequiredKBarPositioner=1;var v=KBarPositioner&&KBarPositioner.__assign||function(){return v=Object.assign||function(ne){for(var se,ae=1,ce=arguments.length;ae<ce;ae++){se=arguments[ae];for(var pe in se)Object.prototype.hasOwnProperty.call(se,pe)&&(ne[pe]=se[pe])}return ne},v.apply(this,arguments)},N=KBarPositioner&&KBarPositioner.__createBinding||(Object.create?function(ne,se,ae,ce){ce===void 0&&(ce=ae),Object.defineProperty(ne,ce,{enumerable:!0,get:function(){return se[ae]}})}:function(ne,se,ae,ce){ce===void 0&&(ce=ae),ne[ce]=se[ae]}),G=KBarPositioner&&KBarPositioner.__setModuleDefault||(Object.create?function(ne,se){Object.defineProperty(ne,"default",{enumerable:!0,value:se})}:function(ne,se){ne.default=se}),z=KBarPositioner&&KBarPositioner.__importStar||function(ne){if(ne&&ne.__esModule)return ne;var se={};if(ne!=null)for(var ae in ne)ae!=="default"&&Object.prototype.hasOwnProperty.call(ne,ae)&&N(se,ne,ae);return G(se,ne),se},q=KBarPositioner&&KBarPositioner.__rest||function(ne,se){var ae={};for(var ce in ne)Object.prototype.hasOwnProperty.call(ne,ce)&&se.indexOf(ce)<0&&(ae[ce]=ne[ce]);if(ne!=null&&typeof Object.getOwnPropertySymbols=="function")for(var pe=0,ce=Object.getOwnPropertySymbols(ne);pe<ce.length;pe++)se.indexOf(ce[pe])<0&&Object.prototype.propertyIsEnumerable.call(ne,ce[pe])&&(ae[ce[pe]]=ne[ce[pe]]);return ae};
40Object.defineProperty(KBarPositioner,"__esModule",{value:!0}),KBarPositioner.KBarPositioner=void 0;var Y=z(requireReact()),W={position:"fixed",display:"flex",alignItems:"flex-start",justifyContent:"center",width:"100%",inset:"0px",padding:"14vh 16px 16px"};function ie(ne){return ne?v(v({},W),ne):W}return KBarPositioner.KBarPositioner=Y.forwardRef(function(ne,se){var ae=ne.style,ce=ne.children,pe=q(ne,["style","children"]);return Y.createElement("div",v({ref:se,style:ie(ae)},pe),ce)}),KBarPositioner}var KBarSearch={},hasRequiredKBarSearch;function requireKBarSearch(){return hasRequiredKBarSearch||(hasRequiredKBarSearch=1,function(v){var N=KBarSearch&&KBarSearch.__assign||function(){return N=Object.assign||function(ce){for(var pe,ge=1,ve=arguments.length;ge<ve;ge++){pe=arguments[ge];for(var be in pe)Object.prototype.hasOwnProperty.call(pe,be)&&(ce[be]=pe[be])}return ce},N.apply(this,arguments)},G=KBarSearch&&KBarSearch.__createBinding||(Object.create?function(ce,pe,ge,ve){ve===void 0&&(ve=ge),Object.defineProperty(ce,ve,{enumerable:!0,get:function(){return pe[ge]}})}:function(ce,pe,ge,ve){ve===void 0&&(ve=ge),ce[ve]=pe[ge]}),z=KBarSearch&&KBarSearch.__setModuleDefault||(Object.create?function(ce,pe){Object.defineProperty(ce,"default",{enumerable:!0,value:pe})}:function(ce,pe){ce.default=pe}),q=KBarSearch&&KBarSearch.__importStar||function(ce){if(ce&&ce.__esModule)return ce;var pe={};if(ce!=null)for(var ge in ce)ge!=="default"&&Object.prototype.hasOwnProperty.call(ce,ge)&&G(pe,ce,ge);return z(pe,ce),pe},Y=KBarSearch&&KBarSearch.__rest||function(ce,pe){var ge={};for(var ve in ce)Object.prototype.hasOwnProperty.call(ce,ve)&&pe.indexOf(ve)<0&&(ge[ve]=ce[ve]);if(ce!=null&&typeof Object.getOwnPropertySymbols=="function")for(var be=0,ve=Object.getOwnPropertySymbols(ce);be<ve.length;be++)pe.indexOf(ve[be])<0&&Object.prototype.propertyIsEnumerable.call(ce,ve[be])&&(ge[ve[be]]=ce[ve[be]]);return ge};Object.defineProperty(v,"__esModule",{value:!0}),v.KBarSearch=v.getListboxItemId=v.KBAR_LISTBOX=void 0;var W=q(requireReact()),ie=requireTypes(),ne=requireUseKBar();v.KBAR_LISTBOX="kbar-listbox";var se=function(ce){return"kbar-listbox-item-"+ce};v.getListboxItemId=se;function ae(ce){var pe=(0,ne.useKBar)(function(Ke){return{search:Ke.searchQuery,currentRootActionId:Ke.currentRootActionId,actions:Ke.actions,activeIndex:Ke.activeIndex,showing:Ke.visualState===ie.VisualState.showing}}),ge=pe.query,ve=pe.search,be=pe.actions,Ee=pe.currentRootActionId,Pe=pe.activeIndex,Je=pe.showing,Ce=pe.options,Ve=W.useState(ve),Re=Ve[0],qe=Ve[1];W.useEffect(function(){ge.setSearch(Re)},[Re,ge]);var et=ce.defaultPlaceholder,Ze=Y(ce,["defaultPlaceholder"]);W.useEffect(function(){return ge.setSearch(""),ge.getInput().focus(),function(){return ge.setSearch("")}},[Ee,ge]);var tt=W.useMemo(function(){var Ke=et??"Type a command or search…";return Ee&&be[Ee]?be[Ee].name:Ke},[be,Ee,et]);return W.createElement("input",N({},Ze,{ref:ge.inputRefSetter,autoFocus:!0,autoComplete:"off",role:"combobox",spellCheck:"false","aria-expanded":Je,"aria-controls":v.KBAR_LISTBOX,"aria-activedescendant":(0,v.getListboxItemId)(Pe),value:Re,placeholder:tt,onChange:function(Ke){var rt,it,ot;(rt=ce.onChange)===null||rt===void 0||rt.call(ce,Ke),qe(Ke.target.value),(ot=(it=Ce==null?void 0:Ce.callbacks)===null||it===void 0?void 0:it.onQueryChange)===null||ot===void 0||ot.call(it,Ke.target.value)},onKeyDown:function(Ke){var rt;if((rt=ce.onKeyDown)===null||rt===void 0||rt.call(ce,Ke),Ee&&!ve&&Ke.key==="Backspace"){var it=be[Ee].parent;ge.setCurrentRootAction(it)}}}))}v.KBarSearch=ae}(KBarSearch)),KBarSearch}var KBarResults={};function _extends$1(){return _extends$1=Object.assign||function(v){for(var N=1;N<arguments.length;N++){var G=arguments[N];for(var z in G)Object.prototype.hasOwnProperty.call(G,z)&&(v[z]=G[z])}return v},_extends$1.apply(this,arguments)}function _objectWithoutPropertiesLoose(v,N){if(v==null)return{};var G={},z=Object.keys(v),q,Y;for(Y=0;Y<z.length;Y++)q=z[Y],!(N.indexOf(q)>=0)&&(G[q]=v[q]);return G}var props=["bottom","height","left","right","top","width"],rectChanged=function(N,G){return N===void 0&&(N={}),G===void 0&&(G={}),props.some(function(z){return N[z]!==G[z]})},observedNodes=new Map,rafId,run=function v(){var N=[];
40observedNodes.forEach(function(G,z){var q=z.getBoundingClientRect();rectChanged(q,G.rect)&&(G.rect=q,N.push(G))}),N.forEach(function(G){G.callbacks.forEach(function(z){return z(G.rect)})}),rafId=window.requestAnimationFrame(v)};function observeRect(v,N){return{observe:function(){var z=observedNodes.size===0;observedNodes.has(v)?observedNodes.get(v).callbacks.push(N):observedNodes.set(v,{rect:void 0,hasRectChanged:!1,callbacks:[N]}),z&&run()},unobserve:function(){var z=observedNodes.get(v);if(z){var q=z.callbacks.indexOf(N);q>=0&&z.callbacks.splice(q,1),z.callbacks.length||observedNodes.delete(v),observedNodes.size||cancelAnimationFrame(rafId)}}}}var useIsomorphicLayoutEffect=typeof window<"u"?U$3.useLayoutEffect:U$3.useEffect;function useRect(v,N){N===void 0&&(N={width:0,height:0});var G=U$3.useState(v.current),z=G[0],q=G[1],Y=U$3.useReducer(rectReducer,N),W=Y[0],ie=Y[1],ne=U$3.useRef(!1);return useIsomorphicLayoutEffect(function(){v.current!==z&&q(v.current)}),useIsomorphicLayoutEffect(function(){if(z&&!ne.current){ne.current=!0;var se=z.getBoundingClientRect();ie({rect:se})}},[z]),U$3.useEffect(function(){if(z){var se=observeRect(z,function(ae){ie({rect:ae})});return se.observe(),function(){se.unobserve()}}},[z]),W}function rectReducer(v,N){var G=N.rect;return v.height!==G.height||v.width!==G.width?G:v}var defaultEstimateSize=function(){return 50},defaultKeyExtractor=function(N){return N},defaultMeasureSize=function(N,G){var z=G?"offsetWidth":"offsetHeight";return N[z]},defaultRangeExtractor=function(N){for(var G=Math.max(N.start-N.overscan,0),z=Math.min(N.end+N.overscan,N.size-1),q=[],Y=G;Y<=z;Y++)q.push(Y);return q};function useVirtual(v){var N,G=v.size,z=G===void 0?0:G,q=v.estimateSize,Y=q===void 0?defaultEstimateSize:q,W=v.overscan,ie=W===void 0?1:W,ne=v.paddingStart,se=ne===void 0?0:ne,ae=v.paddingEnd,ce=ae===void 0?0:ae,pe=v.parentRef,ge=v.horizontal,ve=v.scrollToFn,be=v.useObserver,Ee=v.initialRect,Pe=v.onScrollElement,Je=v.scrollOffsetFn,Ce=v.keyExtractor,Ve=Ce===void 0?defaultKeyExtractor:Ce,Re=v.measureSize,qe=Re===void 0?defaultMeasureSize:Re,et=v.rangeExtractor,Ze=et===void 0?defaultRangeExtractor:et,tt=ge?"width":"height",Ke=ge?"scrollLeft":"scrollTop",rt=U$3.useRef({scrollOffset:0,measurements:[]}),it=U$3.useState(0),ot=it[0],ut=it[1];rt.current.scrollOffset=ot;var ct=be||useRect,at=ct(pe,Ee),st=at[tt];rt.current.outerSize=st;var pt=U$3.useCallback(function($t){pe.current&&(pe.current[Ke]=$t)},[pe,Ke]),lt=ve||pt;ve=U$3.useCallback(function($t){lt($t,pt)},[pt,lt]);var vt=U$3.useState({}),dt=vt[0],xt=vt[1],ft=U$3.useCallback(function(){return xt({})},[]),Et=U$3.useRef([]),Ct=U$3.useMemo(function(){var $t=Et.current.length>0?Math.min.apply(Math,Et.current):0;Et.current=[];for(var Pt=rt.current.measurements.slice(0,$t),kt=$t;kt<z;kt++){var jt=Ve(kt),wt=dt[jt],Mt=Pt[kt-1]?Pt[kt-1].end:se,Tt=typeof wt=="number"?wt:Y(kt),Rt=Mt+Tt;Pt[kt]={index:kt,start:Mt,size:Tt,end:Rt,key:jt}}return Pt},[Y,dt,se,z,Ve]),Dt=(((N=Ct[z-1])==null?void 0:N.end)||se)+ce;rt.current.measurements=Ct,rt.current.totalSize=Dt;var Gt=Pe?Pe.current:pe.current,Ot=U$3.useRef(Je);Ot.current=Je,useIsomorphicLayoutEffect(function(){if(!Gt){ut(0);return}var $t=function(kt){var jt=Ot.current?Ot.current(kt):Gt[Ke];ut(jt)};return $t(),Gt.addEventListener("scroll",$t,{capture:!1,passive:!0}),function(){Gt.removeEventListener("scroll",$t)}},[Gt,Ke]);var It=calculateRange(rt.current),Bt=It.start,Ht=It.end,ir=U$3.useMemo(function(){return Ze({start:Bt,end:Ht,overscan:ie,size:Ct.length})},[Bt,Ht,ie,Ct.length,Ze]),zt=U$3.useRef(qe);zt.current=qe;var tr=U$3.useMemo(function(){for(var $t=[],Pt=function(Mt,Tt){var Rt=ir[Mt],Ft=Ct[Rt],Ut=_extends$1(_extends$1({},Ft),{},{measureRef:function(Wt){if(Wt){var qt=zt.current(Wt,ge);if(qt!==Ut.size){var Yt=rt.current.scrollOffset;Ut.start<Yt&&pt(Yt+(qt-Ut.size)),Et.current.push(Rt),xt(function(or){var hr;return _extends$1(_extends$1({},or),{},(hr={},hr[Ut.key]=qt,hr))})}}}});$t.push(Ut)},kt=0,jt=ir.length;kt<jt;kt++)Pt(kt);return $t},[ir,pt,ge,Ct]),bt=U$3.useRef(!1);useIsomorphicLayoutEffect(function(){bt.current&&xt({}),bt.current=!0},[Y]);var _t=U$3.useCallback(function($t,Pt){var kt=Pt===void 0?{}:Pt,jt=kt.align,wt=jt===void 0?"start":jt,Mt=rt.current,Tt=Mt.scrollOffset,Rt=Mt.outerSize;wt==="auto"&&($t<=Tt?wt="start":$t>=Tt+Rt?wt="end":wt="start"),wt==="start"?ve($t):wt==="end"?ve($t-Rt):wt==="center"&&ve($t-Rt/2)},[ve]),Xt=U$3.useCallback(function($t,Pt){var kt=Pt===void 0?{}:Pt,jt=kt.align,wt=jt===void 0?"auto":jt,Mt=_objectWithoutPropertiesLoose(kt,["align"]),Tt=rt.current,Rt=Tt.measurements,Ft=Tt.scrollOffset,Ut=Tt.outerSize,Zt=Rt[Math.max(0,Math.min($t,z-1))];if(Zt){if(wt==="auto")if(Zt.end>=Ft+Ut)wt="end";else if(Zt.start<=Ft)wt="start";else return;var Wt=wt==="center"?Zt.start+Zt.size/2:wt==="end"?Zt.end:Zt.start;_t(Wt,_extends$1({align:wt},Mt))}},[_t,z]),At=U$3.useCallback(function(){for(var $t=arguments.length,Pt=new Array($t),kt=0;kt<$t;kt++)Pt[kt]=arguments[kt];Xt.apply(void 0,Pt),requestAnimationFrame(function(){Xt.apply(void 0,Pt)})},[Xt]);return{virtualItems:tr,totalSize:Dt,scrollToOffset:_t,scrollToIndex:At,measure:ft}}var findNearestBinarySearch=function(N,G,z,q){for(;N<=G;){var Y=(N+G)/2|0,W=z(Y);if(W<q)N=Y+1;else if(W>q)G=Y-1;else return Y}return N>0?N-1:0};function calculateRange(v){for(var N=v.measurements,G=v.outerSize,z=v.scrollOffset,q=N.length-1,Y=function(se){return N[se].start},W=findNearestBinarySearch(0,q,Y,z),ie=W;ie<q&&N[ie].end<z+G;)ie++;return{start:W,end:ie}}const reactVirtual=Object.freeze(Object.defineProperty({__proto__:null,defaultRangeExtractor,useVirtual},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(reactVirtual);var hasRequiredKBarResults;function requireKBarResults(){if(hasRequiredKBarResults)return KBarResults;hasRequiredKBarResults=1;var v=KBarResults&&KBarResults.__assign||function(){return v=Object.assign||function(ce){for(var pe,ge=1,ve=arguments.length;ge<ve;ge++){pe=arguments[ge];for(var be in pe)Object.prototype.hasOwnProperty.call(pe,be)&&(ce[be]=pe[be])}return ce},v.apply(this,arguments)},N=KBarResults&&KBarResults.__createBinding||(Object.create?function(ce,pe,ge,ve){ve===void 0&&(ve=ge),Object.defineProperty(ce,ve,{enumerable:!0,get:function(){return pe[ge]}})}:function(ce,pe,ge,ve){ve===void 0&&(ve=ge),ce[ve]=pe[ge]}
40),G=KBarResults&&KBarResults.__setModuleDefault||(Object.create?function(ce,pe){Object.defineProperty(ce,"default",{enumerable:!0,value:pe})}:function(ce,pe){ce.default=pe}),z=KBarResults&&KBarResults.__importStar||function(ce){if(ce&&ce.__esModule)return ce;var pe={};if(ce!=null)for(var ge in ce)ge!=="default"&&Object.prototype.hasOwnProperty.call(ce,ge)&&N(pe,ce,ge);return G(pe,ce),pe};Object.defineProperty(KBarResults,"__esModule",{value:!0}),KBarResults.KBarResults=void 0;var q=z(requireReact()),Y=require$$1,W=requireKBarSearch(),ie=requireUseKBar(),ne=requireUtils(),se=0,ae=function(ce){var pe=q.useRef(null),ge=q.useRef(null),ve=q.useRef(ce.items);ve.current=ce.items;var be=(0,Y.useVirtual)({size:ve.current.length,parentRef:ge}),Ee=(0,ie.useKBar)(function(tt){return{search:tt.searchQuery,currentRootActionId:tt.currentRootActionId,activeIndex:tt.activeIndex}}),Pe=Ee.query,Je=Ee.search,Ce=Ee.currentRootActionId,Ve=Ee.activeIndex,Re=Ee.options;q.useEffect(function(){var tt=function(Ke){var rt;Ke.isComposing||(Ke.key==="ArrowUp"||Ke.ctrlKey&&Ke.key==="p"?(Ke.preventDefault(),Ke.stopPropagation(),Pe.setActiveIndex(function(it){var ot=it>se?it-1:it;if(typeof ve.current[ot]=="string"){if(ot===0)return it;ot-=1}return ot})):Ke.key==="ArrowDown"||Ke.ctrlKey&&Ke.key==="n"?(Ke.preventDefault(),Ke.stopPropagation(),Pe.setActiveIndex(function(it){var ot=it<ve.current.length-1?it+1:it;if(typeof ve.current[ot]=="string"){if(ot===ve.current.length-1)return it;ot+=1}return ot})):Ke.key==="Enter"&&(Ke.preventDefault(),Ke.stopPropagation(),(rt=pe.current)===null||rt===void 0||rt.click()))};return window.addEventListener("keydown",tt,{capture:!0}),function(){return window.removeEventListener("keydown",tt,{capture:!0})}},[Pe]);var qe=be.scrollToIndex;q.useEffect(function(){qe(Ve,{align:Ve<=1?"end":"auto"})},[Ve,qe]),q.useEffect(function(){Pe.setActiveIndex(typeof ce.items[se]=="string"?se+1:se)},[Je,Ce,ce.items,Pe]);var et=q.useCallback(function(tt){var Ke,rt;typeof tt!="string"&&(tt.command?(tt.command.perform(tt),Pe.toggle()):(Pe.setSearch(""),Pe.setCurrentRootAction(tt.id)),(rt=(Ke=Re.callbacks)===null||Ke===void 0?void 0:Ke.onSelectAction)===null||rt===void 0||rt.call(Ke,tt))},[Pe,Re]),Ze=(0,ne.usePointerMovedSinceMount)();return q.createElement("div",{ref:ge,style:{maxHeight:ce.maxHeight||400,position:"relative",overflow:"auto"}},q.createElement("div",{role:"listbox",id:W.KBAR_LISTBOX,style:{height:be.totalSize+"px",width:"100%"}},be.virtualItems.map(function(tt){var Ke=ve.current[tt.index],rt=typeof Ke!="string"&&{onPointerMove:function(){return Ze&&Ve!==tt.index&&Pe.setActiveIndex(tt.index)},onPointerDown:function(){return Pe.setActiveIndex(tt.index)},onClick:function(){return et(Ke)}},it=tt.index===Ve;return q.createElement("div",v({ref:it?pe:null,id:(0,W.getListboxItemId)(tt.index),role:"option","aria-selected":it,key:tt.index,style:{position:"absolute",top:0,left:0,width:"100%",transform:"translateY("+tt.start+"px)"}},rt),q.cloneElement(ce.onRender({item:Ke,active:it}),{ref:tt.measureRef}))})))};return KBarResults.KBarResults=ae,KBarResults}var useRegisterActions={},hasRequiredUseRegisterActions;function requireUseRegisterActions(){if(hasRequiredUseRegisterActions)return useRegisterActions;hasRequiredUseRegisterActions=1;var v=useRegisterActions&&useRegisterActions.__createBinding||(Object.create?function(W,ie,ne,se){se===void 0&&(se=ne),Object.defineProperty(W,se,{enumerable:!0,get:function(){return ie[ne]}})}:function(W,ie,ne,se){se===void 0&&(se=ne),W[se]=ie[ne]}),N=useRegisterActions&&useRegisterActions.__setModuleDefault||(Object.create?function(W,ie){Object.defineProperty(W,"default",{enumerable:!0,value:ie})}:function(W,ie){W.default=ie}),G=useRegisterActions&&useRegisterActions.__importStar||function(W){if(W&&W.__esModule)return W;var ie={};if(W!=null)for(var ne in W)ne!=="default"&&Object.prototype.hasOwnProperty.call(W,ne)&&v(ie,W,ne);return N(ie,W),ie};Object.defineProperty(useRegisterActions,"__esModule",{value:!0}),useRegisterActions.useRegisterActions=void 0;var z=G(requireReact()),q=requireUseKBar();function Y(W,ie){ie===void 0&&(ie=[]);var ne=(0,q.useKBar)().query,se=z.useMemo(function(){return W},ie);z.useEffect(function(){if(se.length){var ae=ne.registerActions(se);return function(){ae()}}},[ne,se])}return useRegisterActions.useRegisterActions=Y,useRegisterActions}var KBarAnimator={},hasRequiredKBarAnimator;function requireKBarAnimator(){if(hasRequiredKBarAnimator)return KBarAnimator;hasRequiredKBarAnimator=1;var v=KBarAnimator&&KBarAnimator.__assign||function(){return v=Object.assign||function(ce){for(var pe,ge=1,ve=arguments.length;ge<ve;ge++){pe=arguments[ge];for(var be in pe)Object.prototype.hasOwnProperty.call(pe,be)&&(ce[be]=pe[be])}return ce},v.apply(this,arguments)},N=KBarAnimator&&KBarAnimator.__createBinding||(Object.create?function(ce,pe,ge,ve){ve===void 0&&(ve=ge),Object.defineProperty(ce,ve,{enumerable:!0,get:function(){return pe[ge]}})}:function(ce,pe,ge,ve){ve===void 0&&(ve=ge),ce[ve]=pe[ge]}
40),G=KBarAnimator&&KBarAnimator.__setModuleDefault||(Object.create?function(ce,pe){Object.defineProperty(ce,"default",{enumerable:!0,value:pe})}:function(ce,pe){ce.default=pe}),z=KBarAnimator&&KBarAnimator.__importStar||function(ce){if(ce&&ce.__esModule)return ce;var pe={};if(ce!=null)for(var ge in ce)ge!=="default"&&Object.prototype.hasOwnProperty.call(ce,ge)&&N(pe,ce,ge);return G(pe,ce),pe};Object.defineProperty(KBarAnimator,"__esModule",{value:!0}),KBarAnimator.KBarAnimator=void 0;var q=z(requireReact()),Y=requireTypes(),W=requireUseKBar(),ie=requireUtils(),ne=[{opacity:0,transform:"scale(.99)"},{opacity:1,transform:"scale(1.01)"},{opacity:1,transform:"scale(1)"}],se=[{transform:"scale(1)"},{transform:"scale(.98)"},{transform:"scale(1)"}],ae=function(ce){var pe,ge,ve=ce.children,be=ce.style,Ee=ce.className,Pe=ce.disableCloseOnOuterClick,Je=(0,W.useKBar)(function(ot){return{visualState:ot.visualState,currentRootActionId:ot.currentRootActionId}}),Ce=Je.visualState,Ve=Je.currentRootActionId,Re=Je.query,qe=Je.options,et=q.useRef(null),Ze=q.useRef(null),tt=((pe=qe==null?void 0:qe.animations)===null||pe===void 0?void 0:pe.enterMs)||0,Ke=((ge=qe==null?void 0:qe.animations)===null||ge===void 0?void 0:ge.exitMs)||0;q.useEffect(function(){if(Ce!==Y.VisualState.showing){var ot=Ce===Y.VisualState.animatingIn?tt:Ke,ut=et.current;ut==null||ut.animate(ne,{duration:ot,easing:Ce===Y.VisualState.animatingOut?"ease-in":"ease-out",direction:Ce===Y.VisualState.animatingOut?"reverse":"normal",fill:"forwards"})}},[qe,Ce,tt,Ke]);var rt=q.useRef();q.useEffect(function(){if(Ce===Y.VisualState.showing){var ot=et.current,ut=Ze.current;if(!ot||!ut)return;var ct=new ResizeObserver(function(at){for(var st=0,pt=at;st<pt.length;st++){var lt=pt[st],vt=lt.contentRect;rt.current||(rt.current=vt.height),ot.animate([{height:rt.current+"px"},{height:vt.height+"px"}],{duration:tt/2,easing:"ease-out",fill:"forwards"}),rt.current=vt.height}});return ct.observe(ut),function(){ct.unobserve(ut)}}},[Ce,qe,tt,Ke]);var it=q.useRef(!0);return q.useEffect(function(){if(it.current){it.current=!1;return}var ot=et.current;ot&&ot.animate(se,{duration:tt,easing:"ease-out"})},[Ve,tt]),(0,ie.useOuterClick)(et,function(){var ot,ut;Pe||(Re.setVisualState(Y.VisualState.animatingOut),(ut=(ot=qe.callbacks)===null||ot===void 0?void 0:ot.onClose)===null||ut===void 0||ut.call(ot))}),q.createElement("div",{ref:et,style:v(v(v({},ne[0]),be),{pointerEvents:"auto"}),className:Ee},q.createElement("div",{ref:Ze},ve))};return KBarAnimator.KBarAnimator=ae,KBarAnimator}var action={},hasRequiredAction;function requireAction(){return hasRequiredAction||(hasRequiredAction=1,function(v){var N=action&&action.__createBinding||(Object.create?function(z,q,Y,W){W===void 0&&(W=Y),Object.defineProperty(z,W,{enumerable:!0,get:function(){return q[Y]}})}:function(z,q,Y,W){W===void 0&&(W=Y),z[W]=q[Y]}),G=action&&action.__exportStar||function(z,q){for(var Y in z)Y!=="default"&&!Object.prototype.hasOwnProperty.call(q,Y)&&N(q,z,Y)};Object.defineProperty(v,"__esModule",{value:!0}),G(requireActionInterface(),v),G(requireActionImpl(),v)}(action)),action}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(v){var N=lib&&lib.__createBinding||(Object.create?function(q,Y,W,ie){ie===void 0&&(ie=W),Object.defineProperty(q,ie,{enumerable:!0,get:function(){return Y[W]}})}:function(q,Y,W,ie){ie===void 0&&(ie=W),q[ie]=Y[W]}),G=lib&&lib.__exportStar||function(q,Y){for(var W in q)W!=="default"&&!Object.prototype.hasOwnProperty.call(Y,W)&&N(Y,q,W)};Object.defineProperty(v,"__esModule",{value:!0}),v.Priority=v.createAction=void 0;var z=requireUtils();Object.defineProperty(v,"createAction",{enumerable:!0,get:function(){return z.createAction}}),Object.defineProperty(v,"Priority",{enumerable:!0,get:function(){return z.Priority}}),G(requireUseMatches(),v),G(requireKBarPortal(),v),G(requireKBarPositioner(),v),G(requireKBarSearch(),v),G(requireKBarResults(),v),G(requireUseKBar(),v),G(requireUseRegisterActions(),v),G(requireKBarContextProvider(),v),G(requireKBarAnimator(),v),G(requireTypes(),v),G(requireAction(),v)}(lib)),lib}
40var libExports=requireLib();const CustomDialogAnimator=({children:v,className:N})=>{const G=reactExports.useRef(null),[z,q]=reactExports.useState(!1);return reactExports.useEffect(()=>{if(window.visualViewport){const Y=()=>{const W=window.innerHeight-window.visualViewport.height;q(W>150)};return window.visualViewport.addEventListener("resize",Y),()=>{window.visualViewport.removeEventListener("resize",Y)}}return()=>{}},[]),jsxRuntimeExports.jsx("dialog",{role:"dialog","aria-label":"command palette","aria-modal":"true",ref:G,className:`${N}`,style:{position:"fixed",top:z?"25%":"50%",left:"50%",transform:"translate(-50%, -50%)",maxHeight:z?"70vh":"80vh",overflowY:"auto"},children:v})},CommandBar=()=>jsxRuntimeExports.jsx(libExports.KBarPortal,{children:jsxRuntimeExports.jsx(libExports.KBarPositioner,{className:"bg-overlay backdrop-blur-md",children:jsxRuntimeExports.jsxs(CustomDialogAnimator,{className:"bg-background rounded-xl shadow-xl flex flex-col gap-4 w-[95%] max-w-[35rem] overflow-hidden",children:[jsxRuntimeExports.jsxs(libExports.KBarAnimator,{children:[jsxRuntimeExports.jsx(libExports.KBarSearch,{className:"w-full outline-none px-6 py-4 text-txt","aria-owns":"kbar-listbox"}),jsxRuntimeExports.jsx(SearchResults,{"aria-hi":!0})]}),jsxRuntimeExports.jsx(LiveRegion,{})]})})}),SearchResults=()=>{const{results:v}=libExports.useMatches();return jsxRuntimeExports.jsx(libExports.KBarResults,{items:v,onRender:({item:N,active:G})=>typeof N=="string"?jsxRuntimeExports.jsx("div",{className:"text-xm uppercase px-4 pt-3 pb-1 text-neutral-500 font-bold",role:"separator","aria-hidden":"true",children:N}):jsxRuntimeExports.jsxs("div",{className:`text-btn-text flex items-center px-4 py-3 ${G?"bg-hover-full high-contrast-highlight-border ":"bg-transparent"} select-none cursor-pointer`,tabIndex:0,role:"option","aria-selected":G?"true":"false",children:[N.icon&&jsxRuntimeExports.jsx("span",{className:"mr-2 text-txt",children:N.icon}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[jsxRuntimeExports.jsx("span",{children:N.name}),N.subtitle&&jsxRuntimeExports.jsx("span",{className:"text-sm text-txt",children:N.subtitle})]}),N.shortcut&&jsxRuntimeExports.jsx("span",{className:"ml-auto text-xs text-txt-subtitle","aria-label":`Shortcut: ${N.shortcut.join(", ")}`,children:N.shortcut.join(", ")})]})})},LiveRegion=()=>{const{results:v}=libExports.useMatches(),[N,G]=reactExports.useState(""),{query:z,options:q}=libExports.useKBar(),Y=reactExports.useRef("init"),W=reactExports.useRef(null);return reactExports.useEffect(()=>{const ie=v.find(se=>typeof se!="string"),ne=ie?`${ie.name}`:"No results found";ne===Y.current?(W.current&&clearTimeout(W.current),G(""),W.current=setTimeout(()=>G(ne),500)):v.indexOf(ie)===0?(W.current&&clearTimeout(W.current),G(ne)):(W.current&&clearTimeout(W.current),G("")),Y.current=ne},[v,z.query]),jsxRuntimeExports.jsx("div",{"aria-live":"assertive","aria-atomic":"true",className:"sr-only",children:N})};var jxg={};try{typeof JXG=="object"&&!JXG.extend&&(jxg=JXG)}catch{}jxg.extend=function(v,N,G,z){var q,Y;G=G||!1,z=z||!1;for(q in N)(!G||G&&N.hasOwnProperty(q))&&(z?Y=q.toLowerCase():Y=q,v[Y]=N[q])};jxg.defineConstant=function(v,N,G,z){z=z||!1,!(z&&jxg.exists(v[N]))&&Object.defineProperty(v,N,{value:G,writable:!1,enumerable:!0,configurable:!1})};jxg.extendConstants=function(v,N,G,z){var q,Y;G=G||!1,z=z||!1;for(q in N)(!G||G&&N.hasOwnProperty(q))&&(z?Y=q.toUpperCase():Y=q,this.defineConstant(v,Y,N[q]))};jxg.extend(jxg,{boards:{},readers:{},elements:{},registerElement:function(v,N){v=v.toLowerCase(),this.elements[v]=N},registerReader:function(v,N){var G,z;for(G=0;G<N.length;G++)z=N[G].toLowerCase(),typeof this.readers[z]!="function"&&(this.readers[z]=v)},shortcut:function(v,N){return function(){return v[N].apply(this,arguments)}},getRef:function(v,N){return jxg.deprecated("JXG.getRef()","Board.select()"),v.select(N)},getReference:function(v,N){return jxg.deprecated("JXG.getReference()","Board.select()"),v.select(N)},getBoardByContainerId:function(v){var N;for(N in JXG.boards)if(JXG.boards.hasOwnProperty(N)&&JXG.boards[N].container===v)return JXG.boards[N];return null},deprecated:function(v,N){var G=v+" is deprecated.";N&&(G+=" Please use "+N+" instead."),jxg.warn(G)},warn:function(v){typeof window=="object"&&window.console&&console.warn?console.warn("WARNING:",v):typeof document=="object"&&document.getElementById("warning")&&(document.getElementById("debug").innerHTML+="WARNING: "+v+"<br />")},debugInt:function(v){var N,G;for(N=0;N<arguments.length;N++)G=arguments[N],typeof window=="object"&&window.console&&console.log?console.log(G):typeof document=="object"&&document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=G+"<br/>")},debugWST:function(v){var N=new Error;jxg.debugInt.apply(this,arguments),N&&N.stack&&(jxg.debugInt("stacktrace"),jxg.debugInt(N.stack.split(`
41`).slice(1).join(`
42`)))},debugLine:function(v){var N=new Error;jxg.debugInt.apply(this,arguments),N&&N.stack&&jxg.debugInt("Called from",N.stack.split(`
43`).slice(2,3).join(`
44`))},debug:function(v){jxg.debugInt.apply(this,arguments)},themes:{}});const JXG$1=jxg;var major=1,minor=11,patch=1,version$3=major+"."+minor+"."+patch,constants;constants={version:version$3,licenseText:"JSXGraph v"+version$3+" Copyright (C) see https://jsxgra
44ph.org",COORDS_BY_USER:1,COORDS_BY_SCREEN:2,OBJECT_TYPE_ARC:1,OBJECT_TYPE_ARROW:2,OBJECT_TYPE_AXIS:3,OBJECT_TYPE_AXISPOINT:4,OBJECT_TYPE_TICKS:5,OBJECT_TYPE_CIRCLE:6,OBJECT_TYPE_CONIC:7,OBJECT_TYPE_CURVE:8,OBJECT_TYPE_GLIDER:9,OBJECT_TYPE_IMAGE:10,OBJECT_TYPE_LINE:11,OBJECT_TYPE_POINT:12,OBJECT_TYPE_SLIDER:13,OBJECT_TYPE_CAS:14,OBJECT_TYPE_GXTCAS:15,OBJECT_TYPE_POLYGON:16,OBJECT_TYPE_SECTOR:17,OBJECT_TYPE_TEXT:18,OBJECT_TYPE_ANGLE:19,OBJECT_TYPE_INTERSECTION:20,OBJECT_TYPE_TURTLE:21,OBJECT_TYPE_VECTOR:22,OBJECT_TYPE_OPROJECT:23,OBJECT_TYPE_GRID:24,OBJECT_TYPE_TANGENT:25,OBJECT_TYPE_HTMLSLIDER:26,OBJECT_TYPE_CHECKBOX:27,OBJECT_TYPE_INPUT:28,OBJECT_TYPE_BUTTON:29,OBJECT_TYPE_TRANSFORMATION:30,OBJECT_TYPE_FOREIGNOBJECT:31,OBJECT_TYPE_VIEW3D:32,OBJECT_TYPE_POINT3D:33,OBJECT_TYPE_LINE3D:34,OBJECT_TYPE_PLANE3D:35,OBJECT_TYPE_CURVE3D:36,OBJECT_TYPE_SURFACE3D:37,OBJECT_TYPE_MEASUREMENT:38,OBJECT_TYPE_INTERSECTION_LINE3D:39,OBJECT_TYPE_SPHERE3D:40,OBJECT_TYPE_CIRCLE3D:41,OBJECT_TYPE_INTERSECTION_CIRCLE3D:42,OBJECT_TYPE_TEXT3D:43,OBJECT_TYPE_FACE3D:44,OBJECT_TYPE_POLYHEDRON3D:45,OBJECT_TYPE_POLYGON3D:46,OBJECT_CLASS_POINT:1,OBJECT_CLASS_LINE:2,OBJECT_CLASS_CIRCLE:3,OBJECT_CLASS_CURVE:4,OBJECT_CLASS_AREA:5,OBJECT_CLASS_OTHER:6,OBJECT_CLASS_TEXT:7,OBJECT_CLASS_3D:8};JXG$1.extendConstants(JXG$1,constants);const Const=constants;var undef$1,memoizer=function(v){var N,G;return v.memo||(N={},G=Array.prototype.join,v.memo=function(){var z=G.call(arguments);return N[z]!==undef$1?N[z]:N[z]=v.apply(this,arguments)}),v.memo};JXG$1.Math={eps:1e-6,relDif:function(v,N){var G=Math.abs(v),z=Math.abs(N);return z=Math.max(G,z),z===0?0:Math.abs(v-N)/z},mod:function(v,N){return v-Math.floor(v/N)*N},wrap:function(v,N,G){return N+this.mod(v-N,G-N)},clamp:function(v,N,G){return Math.min(Math.max(v,N),G)},wrapAndClamp:function(v,N,G,z){var q=.5*(N+G),Y=.5*z;return this.clamp(this.wrap(v,q-Y,q+Y),N,G)},vector:function(v,N){var G,z;for(N=N||0,G=[],z=0;z<v;z++)G[z]=N;return G},matrix:function(v,N,G){var z,q,Y;for(G=G||0,N=N||v,z=[],q=0;q<v;q++)for(z[q]=[],Y=0;Y<N;Y++)z[q][Y]=G;return z},identity:function(v,N){var G,z;for(N===undef$1&&typeof N!="number"&&(N=v),G=this.matrix(v,N),z=0;z<Math.min(v,N);z++)G[z][z]=1;return G},frustum:function(v,N,G,z,q,Y){var W=this.matrix(4,4);return W[0][0]=q*2/(N-v),W[0][1]=0,W[0][2]=(N+v)/(N-v),W[0][3]=0,W[1][0]=0,W[1][1]=q*2/(z-G),W[1][2]=(z+G)/(z-G),W[1][3]=0,W[2][0]=0,W[2][1]=0,W[2][2]=-(Y+q)/(Y-q),W[2][3]=-(Y*q*2)/(Y-q),W[3][0]=0,W[3][1]=0,W[3][2]=-1,W[3][3]=0,W},projection:function(v,N,G,z){var q=G*Math.tan(v/2),Y=q*N;return this.frustum(-Y,Y,-q,q,G,z)},matVecMult:function(v,N){var G,z,q,Y=v.length,W=N.length,ie=[];if(W===3)for(G=0;G<Y;G++)ie[G]=v[G][0]*N[0]+v[G][1]*N[1]+v[G][2]*N[2];else for(G=0;G<Y;G++){for(q=0,z=0;z<W;z++)q+=v[G][z]*N[z];ie[G]=q}return ie},vecMatMult:function(v,N){var G,z,q,Y=N.length,W=v.length,ie=[];if(W===3)for(G=0;G<Y;G++)ie[G]=v[0]*N[0][G]+v[1]*N[1][G]+v[2]*N[2][G];else for(G=0;G<W;G++){for(q=0,z=0;z<Y;z++)q+=v[z]*N[z][G];ie[G]=q}return ie},matMatMult:function(v,N){var G,z,q,Y,W=v.length,ie=W>0?N[0].length:0,ne=N.length,se=this.matrix(W,ie);for(G=0;G<W;G++)for(z=0;z<ie;z++){for(q=0,Y=0;Y<ne;Y++)q+=v[G][Y]*N[Y][z];se[G][z]=q}return se},matNumberMult:function(v,N){var G,z,q=v.length,Y=q>0?v[0].length:0,W=this.matrix(q,Y);for(G=0;G<q;G++)for(z=0;z<Y;z++)W[G][z]=v[G][z]*N;return W},matMatAdd:function(v,N){var G,z,q=v.length,Y=q>0?v[0].length:0,W=this.matrix(q,Y);for(G=0;G<q;G++)for(z=0;z<Y;z++)W[G][z]=v[G][z]+N[G][z];return W},transpose:function(v){var N,G,z,q,Y;for(q=v.length,Y=v.length>0?v[0].length:0,N=this.matrix(Y,q),G=0;G<Y;G++)for(z=0;z<q;z++)N[G][z]=v[z][G];return N},inverse:function(v){var N,G,z,q,Y,W=this.eps*this.eps,ie,ne,se=v.length,ae=[],ce=[],pe=[];for(N=0;N<se;N++){for(ae[N]=[],G=0;G<se;G++)ae[N][G]=v[N][G];ce[N]=N}for(G=0;G<se;G++){for(ie=Math.abs(ae[G][G]),q=G,N=G+1;N<se;N++)Math.abs(ae[N][G])>ie&&(ie=Math.abs(ae[N][G]),q=N);if(ie<=W)return JXG$1.warn("JXG.Math.inverse: singular matrix"),[];if(q>G){for(z=0;z<se;z++)ne=ae[G][z],ae[G][z]=ae[q][z],ae[q][z]=ne;ne=ce[G],ce[G]=ce[q],ce[q]=ne}for(Y=1/ae[G][G],N=0;N<se;N++)ae[N][G]*=Y;for(ae[G][G]=Y,z=0;z<se;z++)if(z!==G){for(N=0;N<se;N++)N!==G&&(ae[N][z]-=ae[N][G]*ae[G][z]);ae[G][z]=-Y*ae[G][z]}}for(N=0;N<se;N++){for(z=0;z<se;z++)pe[ce[z]]=ae[N][z];for(z=0;z<se;z++)ae[N][z]=pe[z]}return ae},trace:function(v){var N,G,z,q=0;if(G=v.length,z=v.length>0?v[0].length:0,G!==z)return NaN;for(N=0;N<z;N++)q+=v[N][N];return q},innerProduct:function(v,N,G){var z,q=0;for((G===undef$1||!JXG$1.isNumber(G))&&(G=v.length),z=0;z<G;z++)q+=v[z]*N[z];return q},crossProduct:function(v,N){return[v[1]*N[2]-v[2]*N[1],v[2]*N[0]-v[0]*N[2],v[0]*N[1]-v[1]*N[0]]},norm:function(v,N){var G,z=0;for((N===undef$1||!JXG$1.isNumber(N))&&(N=v.length),G=0;G<N;G++)z+=v[G]*v[G];return Math.sqrt(z)},axpy:function(v,N,G){var z,q=N.length,Y=[];for(z=0;z<q;z++)Y[z]=v*N[z]+G[z];return Y},factorial:memoizer(function(v){return v<0?NaN:(v=Math.floor(v),v===0||v===1?1:v*this.factorial(v-1))}),binomial:memoizer(function(v,N){var G,z;if(N>v||N<0)return NaN;if(N=Math.round(N),v=Math.round(v),N===0||N===v)return 1;for(G=1,z=0;z<N;z++)G*=v-z,G/=z+1;return G}),cosh:Math.cosh||function(v){return(Math.exp(v)+Math.exp(-v))*.5},sinh:Math.sinh||function(v){return(Math.exp(v)-Math.exp(-v))*.5},acosh:Math.acosh||function(v){return Math.log(v+Math.sqrt(v*v-1))},asinh:Math.asinh||function(v){return v===-1/0?v:Math.log(v+Math.sqrt(v*v+1))},cot:function(v){return 1/Math.tan(v)},acot:function(v){return(v>=0?.5:-.5)*Math.PI-Math.atan(v)},nthroot:function(v,N){var G=1/N;return N<=0||Math.floor(N)!==N?NaN:v===0?0:v>0?Math.exp(G*Math.log(v)):N%2===1?-Math.exp(G*Math.log(-v)):NaN},cbrt:Math.cbrt||function(v){return this.nthroot(v,3)},pow:function(v,N){return v===0?N===0?1:0:Math.floor(N)===N?Math.pow(v,N):v>0?Math.exp(N*Math.log(v)):NaN},ratpow:function(v,N,G){var z;return N===0?1:G===0?NaN:(z=this.gcd(N,G),this.nthroot(this.pow(v,N/z),G/z))},log10:function(v){return Math.log(v)/Math.log(10)},log2:function(v){return Math.log(v)/Math.log(2)},log:function(v,N){return N!==void 0&&JXG$1.isNumber(N)?Math.log(v)/Math.log(N):Math.log(v)},sign:Math.sign||function(v){return v=+v,v===0||isNaN(v)?v:v>0?1:-1},squampow:function(v,N){var G;if(Math.floor(N)===N){for(G=1,N<0&&(v=1/v,N*=-1);N!==0;)N&1&&(G*=v),N>>=1,v*=v;return G}return this.pow(v,N)},gcd:function(v,N){var G,z=!0;
44if(v=Math.abs(v),N=Math.abs(N),!(JXG$1.isNumber(v)&&JXG$1.isNumber(N)))return NaN;for(N>v&&(G=v,v=N,N=G);z;){if(v%=N,v===0)return N;if(N%=v,N===0)return v}},lcm:function(v,N){var G;return JXG$1.isNumber(v)&&JXG$1.isNumber(N)?(G=v*N,G!==0?G/this.gcd(v,N):0):NaN},roundToStep:function(v,N,G,z){var q=v,Y,W;if(!JXG$1.exists(N)&&!JXG$1.exists(G)&&!JXG$1.exists(z))return q;if(JXG$1.exists(z)&&(q=Math.min(q,z)),JXG$1.exists(G)&&(q=Math.max(q,G)),W=G||0,JXG$1.exists(N)){if(Y=(q-W)/N,Number.isInteger(Y))return q;Y=Math.round(Y),q=W+Y*N}return JXG$1.exists(z)&&(q=Math.min(q,z)),JXG$1.exists(G)&&(q=Math.max(q,G)),q},erf:function(v){return this.ProbFuncs.erf(v)},erfc:function(v){return this.ProbFuncs.erfc(v)},erfi:function(v){return this.ProbFuncs.erfi(v)},ndtr:function(v){return this.ProbFuncs.ndtr(v)},ndtri:function(v){return this.ProbFuncs.ndtri(v)},hypot:function(){var v,N,G,z;for(N=arguments.length,v=0,z=0;v<N;v++)G=arguments[v],z+=G*G;return Math.sqrt(z)},hstep:function(v){return v>0?1:v<0?0:.5},gamma:function(v){var N,G,z,q,Y,W=7,ie=[1,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23];if(v<.5)G=Math.PI/(Math.sin(Math.PI*v)*this.gamma(1-v));else{for(v-=1,N=ie[0],Y=ie.length,q=1;q<Y;q++)N+=ie[q]/(v+q);z=v+W+.5,G=Math.sqrt(2*Math.PI)*Math.pow(z,v+.5)*Math.exp(-z)*N}return G},lt:function(v,N){return v<N},leq:function(v,N){return v<=N},gt:function(v,N){return v>N},geq:function(v,N){return v>=N},eq:function(v,N){return v===N},neq:function(v,N){return v!==N},and:function(v,N){return v&&N},not:function(v){return!v},or:function(v,N){return v||N},xor:function(v,N){return(v||N)&&!(v&&N)},decToFraction:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce=0,pe=20;for(N=JXG$1.def(N,.001),v=Math.round(v*1e12)*1e-12,z=v<0?-1:1,v=Math.abs(v),G=Math.floor(v),v-=Math.floor(v),q=0,ie=1,Y=W=q,ae=0,ne=se=1;v-Math.floor(v)>N&&ce<pe;)v=1/(v-q),q=Math.floor(v),Y=ie+q*W,ne=ae+q*se,ie=W,ae=se,W=Y,se=ne,ce++;return[z,G,Y,ne]},normalize:function(v){var N,G,z=2*v[3],q=v[4]/z;return v[5]=q,v[6]=-v[1]/z,v[7]=-v[2]/z,isFinite(q)?Math.abs(q)>=1?(v[0]=(v[6]*v[6]+v[7]*v[7]-q*q)/(2*q),v[1]=-v[6]/q,v[2]=-v[7]/q,v[3]=1/(2*q),v[4]=1):(G=q<=0?-1:1,v[0]=G*(v[6]*v[6]+v[7]*v[7]-q*q)*.5,v[1]=-G*v[6],v[2]=-G*v[7],v[3]=G/2,v[4]=G*q):(N=this.hypot(v[1],v[2]),v[0]/=N,v[1]/=N,v[2]/=N,v[3]=0,v[4]=1),v},toGL:function(v){var N,G,z;if(typeof Float32Array=="function"?N=new Float32Array(16):N=new Array(16),v.length!==4&&v[0].length!==4)return N;for(G=0;G<4;G++)for(z=0;z<4;z++)N[G+4*z]=v[G][z];return N},Vieta:function(v){var N=v.length,G=[],z,q,Y;for(G=v.slice(),z=1;z<N;++z){for(Y=G[z],G[z]*=G[z-1],q=z-1;q>=1;--q)G[q]+=G[q-1]*Y;G[0]+=Y}return G}};const Mat=JXG$1.Math;JXG$1.extend(JXG$1,{isBoard:function(v){return v!==null&&typeof v=="object"&&this.isNumber(v.BOARD_MODE_NONE)&&this.isObject(v.objects)&&this.isObject(v.jc)&&this.isFunction(v.update)&&!!v.containerObj&&this.isString(v.id)},isId:function(v,N){return typeof N=="string"&&!!v.objects[N]},isName:function(v,N){return typeof N=="string"&&!!v.elementsByName[N]},isGroup:function(v,N){return typeof N=="string"&&!!v.groups[N]},isString:function(v){return typeof v=="string"},isNumber:function(v,N,G){var z=typeof v=="number"||Object.prototype.toString.call(v)==="[Object Number]";return N=N||!1,G=G===void 0?!0:G,N&&(z=z||""+parseFloat(v)===v),G||(z=z&&!isNaN(v)),z},isFunction:function(v){return typeof v=="function"},isArray:function(v){var N;return Array.isArray?N=Array.isArray(v):N=v!==null&&typeof v=="object"&&typeof v.splice=="function"&&typeof v.join=="function",N},isObject:function(v){return typeof v=="object"&&!this.isArray(v)},isDocumentOrFragment:function(v){return this.isObject(v)&&(v.nodeType===9||v.nodeType===11)},isPoint:function(v){return v!==null&&typeof v=="object"&&this.exists(v.elementClass)?v.elementClass===Const.OBJECT_CLASS_POINT:!1},isPoint3D:function(v){return v!==null&&typeof v=="object"&&this.exists(v.type)?v.type===Const.OBJECT_TYPE_POINT3D:!1},isPointType:function(v,N){var G,z;return this.isArray(N)||this.isFunction(N)&&(G=N(),this.isArray(G)&&G.length>1)?!0:(z=v.select(N),this.isPoint(z))},isPointType3D:function(v,N){var G,z;return this.isArray(N)&&N.length>=3||this.isFunction(N)&&(G=N(),this.isArray(G)&&G.length>=3)?!0:(z=v.select(N),this.isPoint3D(z))},isTransformationOrArray:function(v){if(v!==null){if(this.isArray(v)&&v.length>0)return this.isTransformationOrArray(v[0]);if(typeof v=="object")return v.type===Const.OBJECT_TYPE_TRANSFORMATION}return!1},isEmpty:function(v){return Object.keys(v).length===0},exists:function(v,N){var G=!(v==null||v===null);return N=N||!1,N?G&&v!=="":G},def:function(v,N){return this.exists(v)?v:N},str2Bool:function(v){return this.exists(v)?typeof v=="boolean"?v:this.isString(v)?v.toLowerCase()==="true":!1:!0},cssParse:function(v){var N=v;return this.isString(N)?(N=N.replace(/\s*;\s*$/g,""),N=N.replace(/\s*;\s*/g,'","'),N=N.replace(/\s*:\s*/g,'":"'),N=N.trim(),N='{"'+N+'"}',JSON.parse(N)):{}},cssStringify:function(v){var N="",G,z;if(!this.isObject(v))return"";for(G in v)v.hasOwnProperty(G)&&(z=v[G],!(!this.isString(z)&&!this.isNumber(z))&&(N+=G+":"+z+"; "));return N=N.trim(),N},createEvalFunction:function(v,N,G){var z=[],q,Y,W,ie={};for(Y=0;Y<G;Y++){z[Y]=this.createFunction(N[Y],v);for(W in z[Y].deps)ie[W]=z[Y].deps}return q=function(ne){return z[ne]()},q.deps=ie,q},createFunction:function(v,N,G,z){var q=null;return this.isString(v)?q=N.jc.snippet(v,!0,G,!1):this.isFunction(v)?(q=v,q.deps=this.isObject(v.deps)?v.deps:{}):(this.isNumber(v)||this.isArray(v))&&(q=function(){return v},q.deps={}),q!==null&&(q.origin=v),q},providePoints:function(v,N,G,z,q){var Y,W,ie,ne=0,se=[],ae,ce;for(this.isArray(N)||(N=[N]),ie=N.length,this.exists(q)&&(ne=q.length),ne===0&&(ae=this.copyAttributes(G,v.options,z)),Y=0;Y<ie;++Y)if(ne>0&&(W=Math.min(Y,ne-1),ae=this.copyAttributes(G,v.options,z,q[W].toLowerCase())),this.isArray(N[Y])&&N[Y].length>1?(se.push(v.create("point",N[Y],ae)),se[se.length-1]._is_new=!0):this.isFunction(N[Y])?(ce=N[Y](),this.isArray(ce)&&ce.length>1&&(se.push(v.create("point",[N[Y]],ae)),se[se.length-1]._is_new=!0)):se.push(v.select(N[Y])),!this.isPoint(se[Y]))return!1;return se},providePoints3D:function(v,N,G,z,q){var Y,W,ie,ne=0,se=[],ae,ce;for(this.isArray(N)||(N=[N]),ie=N.length,this.exists(q)&&(ne=q.length),ne===0&&(ae=this.copyAttributes(G,v.board.options,z)),Y=0;Y<ie;++Y){if(ne>0&&(W=Math.min(Y,ne-1),ae=this.copyAttributes(G,v.board.options,z,q[W])),this.isArray(N[Y])&&N[Y].length>0&&N[Y].every(pe=>this.isArray(pe)&&this.isNumber(pe[0])))for(W=0;W<N[Y].length;W++)se.push(v.create("point3d",N[Y][W],ae)),se[se.length-1]._is_new=!0;else this.isArray(N[Y])&&N[Y].every(pe=>this.isNumber(pe)||this.isFunction(pe))?(se.push(v.create("point3d",N[Y],ae)),se[se.length-1]._is_new=!0):this.isPoint3D(N[Y])?se.push(N[Y]):this.isFunction(N[Y])?(ce=N[Y](),this.isArray(ce)&&ce.length>1&&(se.push(v.create("point3d",[N[Y]],ae)),se[se.length-1]._is_new=!0)):se.push(v.select(N[Y]));if(!this.isPoint3D(se[Y]))return!1}return se},bind:function(v,N){return function(){return v.apply(N,arguments)}},evaluate:function(v){return this.isFunction(v)?v():v},indexOf:function(v,N,G){var z,q=this.exists(G);if(Array.indexOf&&!q)return v.indexOf(N);for(z=0;z<v.length;z++)if(q&&v[z][G]===N||!q&&v[z]===N)return z;return-1},eliminateDuplicates:function(v){var N,G=v.length,z=[],q={};for(N=0;N<G;N++)q[v[N]]=0;for(N in q)q.hasOwnProperty(N)&&z.push(N);return z},swap:function(v,N,G){var z;return z=v[N],v[N]=v[G],v[G]=z,v},uniqueArray:function(v){var N,G,z,q=[];
44if(v.length===0)return[];for(N=0;N<v.length;N++){if(z=this.isArray(v[N]),!this.exists(v[N])){v[N]="";continue}for(G=N+1;G<v.length;G++)z&&JXG$1.cmpArrays(v[N],v[G])?v[N]=[]:!z&&v[N]===v[G]&&(v[N]="")}for(G=0,N=0;N<v.length;N++)z=this.isArray(v[N]),!z&&v[N]!==""?(q[G]=v[N],G++):z&&v[N].length!==0&&(q[G]=v[N].slice(0),G++);return v=q,q},isInArray:function(v,N){return JXG$1.indexOf(v,N)>-1},coordsArrayToMatrix:function(v,N){var G,z=[],q=[];for(G=0;G<v.length;G++)N?(z.push(v[G].usrCoords[1]),q.push(v[G].usrCoords[2])):q.push([v[G].usrCoords[1],v[G].usrCoords[2]]);return N&&(q=[z,q]),q},cmpArrays:function(v,N){var G;if(v===N)return!0;if(v.length!==N.length)return!1;for(G=0;G<v.length;G++)if(this.isArray(v[G])&&this.isArray(N[G])){if(!this.cmpArrays(v[G],N[G]))return!1}else if(v[G]!==N[G])return!1;return!0},removeElementFromArray:function(v,N){var G;for(G=0;G<v.length;G++)if(v[G]===N)return v.splice(G,1),v;return v},trunc:function(v,N){return N=JXG$1.def(N,0),this.toFixed(v,N)},_decimalAdjust:function(v,N,G){return G===void 0||+G==0?Math[v](N):(N=+N,G=+G,isNaN(N)||!(typeof G=="number"&&G%1===0)?NaN:(N=N.toString().split("e"),N=Math[v](+(N[0]+"e"+(N[1]?+N[1]-G:-G))),N=N.toString().split("e"),+(N[0]+"e"+(N[1]?+N[1]+G:G))))},_round10:function(v,N){return this._decimalAdjust("round",v,N)},_floor10:function(v,N){return this._decimalAdjust("floor",v,N)},_ceil10:function(v,N){return this._decimalAdjust("ceil",v,N)},toFixed:function(v,N){return this._round10(v,-N).toFixed(N)},autoDigits:function(v){var N=Math.abs(v),G;return N>=.1?G=this.toFixed(v,2):N>=.01?G=this.toFixed(v,4):N>=1e-4?G=this.toFixed(v,6):G=v,G},parseNumber:function(v,N,G){var z;return this.isString(v)&&v.indexOf("%")>-1?(z=v.replace(/\s+%\s+/,""),parseFloat(z)*N*.01):this.isString(v)&&v.indexOf("fr")>-1?(z=v.replace(/\s+fr\s+/,""),parseFloat(z)*N):this.isString(v)&&v.indexOf("px")>-1?(z=v.replace(/\s+px\s+/,""),z=parseFloat(z),this.isFunction(G)?G(z):this.isNumber(G)?z*G:z):parseFloat(v)},parsePosition:function(v){var N,G,z="",q="";if(v=v.trim(),v!=="")for(N=v.split(/[ ,]+/),G=0;G<N.length;G++)N[G]==="left"||N[G]==="right"?z=N[G]:q=N[G];return{side:z,pos:q}},keys:function(v,N){var G=[],z;for(z in v)N?v.hasOwnProperty(z)&&G.push(z):G.push(z);return G},clone:function(v){var N={};return N.prototype=v,N},cloneAndCopy:function(v,N){var G,z=function(){};z.prototype=v;for(G in N)z[G]=N[G];return z},merge:function(v,N){var G,z,q,Y;for(G in N)if(N.hasOwnProperty(G))if(q=N[G],this.isArray(q))for(v[G]||(v[G]=[]),z=0;z<q.length;z++)Y=N[G][z],typeof N[G][z]=="object"?v[G][z]=this.merge(v[G][z],Y):v[G][z]=N[G][z];else typeof q=="object"?(v[G]||(v[G]={}),v[G]=this.merge(v[G],q)):(typeof v=="boolean"&&(v={}),v[G]=q);return v},deepCopy:function(v,N,G){var z,q,Y,W;if(G=G||!1,typeof v!="object"||v===null)return v;if(this.isArray(v))for(z=[],q=0;q<v.length;q++)Y=v[q],Y!==null&&typeof Y=="object"?this.exists(Y.board)?z[q]=Y.id:z[q]=this.deepCopy(Y,{},G):z[q]=Y;else{z={};for(q in v)v.hasOwnProperty(q)&&(W=G?q.toLowerCase():q,Y=v[q],Y!==null&&typeof Y=="object"?this.exists(Y.board)?z[W]=Y.id:z[W]=this.deepCopy(Y,{},G):z[W]=Y);for(q in N)N.hasOwnProperty(q)&&(W=G?q.toLowerCase():q,Y=N[q],Y!==null&&typeof Y=="object"?this.isArray(Y)||!this.exists(z[W])?z[W]=this.deepCopy(Y,{},G):z[W]=this.deepCopy(z[W],Y,G):z[W]=Y)}return z},mergeAttr:function(v,N,G,z){var q,Y,W;G=G||!0,z=z||!1;for(q in N)N.hasOwnProperty(q)&&(Y=G?q.toLowerCase():q,Y!==q&&v.hasOwnProperty(q)&&(v.hasOwnProperty(Y)?this.mergeAttr(v[Y],v[q],G):v[Y]=v[q],delete v[q]),W=N[q],this.isObject(W)&&W!==null&&!this.isDocumentOrFragment(W)&&!this.exists(W.board)&&typeof W.valueOf()!="string"?((v[Y]===void 0||v[Y]===null||!this.isObject(v[Y]))&&(v[Y]={}),this.mergeAttr(v[Y],W,G)):(!z||this.exists(W))&&(v[Y]=W))},keysToLowerCase:function(v){var N,G,z=Object.keys(v),q=z.length,Y={};if(typeof v!="object")return v;for(;q--;)N=z[q],v.hasOwnProperty(N)&&(G=v[N],typeof G=="object"&&G!==null&&!this.isArray(G)&&!this.exists(G.nodeType)&&!this.exists(G.board)?Y[N.toLowerCase()]=this.keysToLowerCase(G):Y[N.toLowerCase()]=G);return Y},copyAttributes:function(v,N,G){var z,q,Y,W,ie,ne,se={circle:1,curve:1,foreignobject:1,image:1,line:1,point:1,polygon:1,text:1,ticks:1,integral:1};for(W=arguments.length,W<3||se[G]?z=JXG$1.deepCopy(N.elements,null,!0):z={},W<4&&this.exists(G)&&this.exists(N.layer[G])&&(z.layer=N.layer[G]),ie=N,ne=!0,Y=2;Y<W;Y++)if(q=arguments[Y],this.exists(ie[q]))ie=ie[q];else{ne=!1;break}for(ne&&(z=JXG$1.deepCopy(z,ie,!0)),ie=typeof v=="object"?this.keysToLowerCase(v):{},ne=!0,Y=3;Y<W;Y++)if(q=arguments[Y].toLowerCase(),this.exists(ie[q]))ie=ie[q];else{ne=!1;break}if(ne&&this.mergeAttr(z,ie,!0),arguments[2]==="board")return z;for(ie=N,ne=!0,Y=2;Y<W;Y++)if(q=arguments[Y],this.exists(ie[q]))ie=ie[q];else{ne=!1;break}return ne&&this.exists(ie.label)&&(z.label=JXG$1.deepCopy(ie.label,z.label,!0)),z.label=JXG$1.deepCopy(N.label,z.label,!0),z},copyPrototypeMethods:function(v,N,G){var z;v.prototype[G]=N.prototype.constructor;for(z in N.prototype)N.prototype.hasOwnProperty(z)&&(v.prototype[z]=N.prototype[z])},getCloneObject:function(v){var N,G,z={};z.id=v.id+"T"+v.numTraces,v.numTraces+=1,z.coords=v.coords,N=this.deepCopy(v.visProp,v.visProp.traceattributes,!0),z.visProp={};for(G in N)N.hasOwnProperty(G)&&G.indexOf("aria")!==0&&G.indexOf("highlight")!==0&&G.indexOf("attractor")!==0&&G!=="label"&&G!=="needsregularupdate"&&G!=="infoboxdigits"&&(z.visProp[G]=v.eval(N[G]));return z.evalVisProp=function(q){return z.visProp[q]},z.eval=function(q){return q},z.visProp.layer=v.board.options.layer.trace,z.visProp.tabindex=null,z.visProp.highlight=!1,z.board=v.board,z.elementClass=v.elementClass,this.clearVisPropOld(z),z.visPropCalc={visible:v.evalVisProp("visible")},z},toJSON:function(v,N){var G,z,q,Y,W;if(N=JXG$1.def(N,!1),JSON!==void 0&&JSON.stringify&&!N)try{return Y=JSON.stringify(v),Y}catch{}switch(typeof v){case"object":if(v){if(G=[],this.isArray(v)){for(q=0;q<v.length;q++)G.push(JXG$1.toJSON(v[q],N));return"["+G.join(",")+"]"}for(z in v)if(v.hasOwnProperty(z)){try{W=JXG$1.toJSON(v[z],N)}catch{W=""}N?G.push(z+":"+W):G.push('"'+z+'":'+W)}
44return"{"+G.join(",")+"} "}return"null";case"string":return"'"+v.replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return v.toString()}return"0"},clearVisPropOld:function(v){return v.visPropOld={cssclass:"",cssdefaultstyle:"",cssstyle:"",fillcolor:"",fillopacity:"",firstarrow:!1,fontsize:-1,lastarrow:!1,left:-1e5,linecap:"",shadow:!1,strokecolor:"",strokeopacity:"",strokewidth:"",tabindex:-1e5,transitionduration:0,top:-1e5,visible:null},v},isInObject:function(v,N){var G;for(G in v)if(v.hasOwnProperty(G)&&v[G]===N)return!0;return!1},escapeHTML:function(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(v){return v.replace(/<\/?[^>]+>/gi,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")},capitalize:function(v){return v.charAt(0).toUpperCase()+v.substring(1).toLowerCase()},trimNumber:function(v){return v=v.replace(/^0+/,""),v=v.replace(/0+$/,""),(v[v.length-1]==="."||v[v.length-1]===",")&&(v=v.slice(0,-1)),(v[0]==="."||v[0]===",")&&(v="0"+v),v},filterElements:function(v,N){var G,z,q,Y,W,ie,ne,se=v.length,ae=[];if(typeof N!="function"&&typeof N!="object")return ae;for(G=0;G<se;G++){if(ne=!0,q=v[G],typeof N=="object"){for(z in N)if(N.hasOwnProperty(z)&&(Y=z.toLowerCase(),typeof q[z]=="function"?W=q[z]():W=q[z],q.visProp&&typeof q.visProp[Y]=="function"?ie=q.visProp[Y]():ie=q.visProp&&q.visProp[Y],typeof N[z]=="function"?ne=N[z](W)||N[z](ie):ne=W===N[z]||ie===N[z],!ne))break}else typeof N=="function"&&(ne=N(q));ne&&ae.push(q)}return ae},trim:function(v){return v.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},toFraction:function(v,N,G){var z=Mat.decToFraction(v,G),q="";return z[1]===0&&z[2]===0?q+="0":(z[0]<0&&(q+="-"),z[2]===0?q+=z[1]:z[2]===1&&z[3]===1||(z[1]!==0&&(q+=z[1]+" "),N===!0?q+="\\frac{"+z[2]+"}{"+z[3]+"}":q+=z[2]+"/"+z[3])),q},concat:function(v,N){var G,z=N.length;for(G=0;G<z;G++)v.push(N[G]);return v},sanitizeHTML:function(v,N){return typeof html_sanitize=="function"&&N?html_sanitize(v,function(){},function(G){return G}):(v&&typeof v=="string"&&(v=v.replace(/</g,"&lt;").replace(/>/g,"&gt;")),v)},evalSlider:function(v){return v&&v.type===Const.OBJECT_TYPE_GLIDER&&typeof v.Value=="function"?v.Value():v},stack2jsxgraph:function(v){var N;return N=v.replace(/%pi/g,"PI").replace(/%e/g,"EULER").replace(/%phi/g,"1.618033988749895").replace(/%gamma/g,"0.5772156649015329").trim(),N[0]==="["&&N[N.length-1]==="]"&&(N=N.slice(1,-1).split(/\s*,\s*/)),N}});JXG$1.extendConstants(JXG$1,{});JXG$1.extend(JXG$1,{isTouchEvent:function(v){return JXG$1.exists(v.touches)},isPointerEvent:function(v){return JXG$1.exists(v.pointerId)},isMouseEvent:function(v){return!JXG$1.isTouchEvent(v)&&!JXG$1.isPointerEvent(v)},getNumberOfTouchPoints:function(v){var N=-1;return JXG$1.isTouchEvent(v)&&(N=v.touches.length),N},isFirstTouch:function(v){var N=JXG$1.getNumberOfTouchPoints(v);return JXG$1.isPointerEvent(v)?v.isPrimary:N===1},isBrowser:typeof window=="object"&&typeof document=="object",supportsES6:function(){try{return new Function("(a = 0) => a"),!0}catch{return!1}},supportsVML:function(){return this.isBrowser&&!!document.namespaces},supportsSVG:function(){var v;return this.isBrowser?(v=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,v):!1},supportsCanvas:function(){var v=!1;return this.isNode()&&(v=!0),v||this.isBrowser&&!!document.createElement("canvas").getContext},isNode:function(){return!this.isBrowser&&typeof process<"u"&&process.release.name.search(/node|io.js/)!==-1},isWebWorker:function(){return!this.isBrowser&&typeof self=="object"&&typeof self.postMessage=="function"},supportsPointerEvents:function(){return!!(this.isBrowser&&window.navigator&&(window.PointerEvent||window.navigator.pointerEnabled||window.navigator.msPointerEnabled))},isTouchDevice:function(){return this.isBrowser&&window.ontouchstart!==void 0},isAndroid:function(){return JXG$1.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.indexOf(" AppleWebKit/")>-1},isApple:function(){return JXG$1.exists(navigator)&&(navigator.userAgent.indexOf("iPad")>-1||navigator.userAgent.indexOf("iPhone")>-1)},isWebkitApple:function(){return this.isApple()&&navigator.userAgent.
44search(/Mobile\/[0-9A-Za-z.]*Safari/)>-1},isMetroApp:function(){return typeof window=="object"&&window.clientInformation&&window.clientInformation.appVersion&&window.clientInformation.appVersion.indexOf("MSAppHost")>-1},isMozilla:function(){return JXG$1.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1&&navigator.userAgent.toLowerCase().indexOf("apple")===-1},isFirefoxOS:function(){return JXG$1.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")===-1&&navigator.userAgent.toLowerCase().indexOf("apple")===-1&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1},isDesktop:function(){return!0},isMobile:function(){return!0},ieVersion:function(){var v,N,G=3;if(typeof document!="object")return 0;v=document.createElement("div"),N=v.getElementsByTagName("i");do v.innerHTML="<!--[if gt IE "+ ++G+"]><i></i><![endif]-->";while(N[0]);return G>4?G:void 0}(),getDimensions:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce=/\d+(\.\d*)?px/;if(!this.isBrowser||v===null)return{width:500,height:500};if(N=N||document,G=JXG$1.isString(v)?N.getElementById(v):v,!JXG$1.exists(G))throw new Error(`
45JSXGraph: HTML container element '`+v+"' not found.");return z=G.style.display,z!=="none"&&z!==null?G.clientWidth>0&&G.clientHeight>0?{width:G.clientWidth,height:G.clientHeight}:(ae=window.getComputedStyle?window.getComputedStyle(G):G.style,{width:ce.test(ae.width)?parseFloat(ae.width):0,height:ce.test(ae.height)?parseFloat(ae.height):0}):(q=G.style,Y=q.visibility,W=q.position,ie=q.display,q.visibility="hidden",q.position="absolute",q.display="block",ne=G.clientWidth,se=G.clientHeight,q.display=ie,q.position=W,q.visibility=Y,{width:ne,height:se})},addEvent:function(v,N,G,z,q){var Y=function(){return G.apply(z,arguments)};Y.origin=G,typeof z=="object"&&JXG$1.exists(z.BOARD_MODE_NONE)&&(z["x_internal"+N]=z["x_internal"+N]||[],z["x_internal"+N].push(Y)),JXG$1.exists(v)&&JXG$1.exists(v.addEventListener)&&(q=q||!1,v.addEventListener(N,Y,q)),JXG$1.exists(v)&&JXG$1.exists(v.attachEvent)&&v.attachEvent("on"+N,Y)},removeEvent:function(v,N,G,z){var q;if(!JXG$1.exists(z)){JXG$1.debug("no such owner");return}if(!JXG$1.exists(z["x_internal"+N])){JXG$1.debug("removeEvent: no such type: "+N);return}if(!JXG$1.isArray(z["x_internal"+N])){JXG$1.debug("owner[x_internal + "+N+"] is not an array");return}if(q=JXG$1.indexOf(z["x_internal"+N],G,"origin"),q===-1){JXG$1.debug("removeEvent: no such event function in internal list: "+G);return}try{JXG$1.exists(v)&&JXG$1.exists(v.removeEventListener)&&v.removeEventListener(N,z["x_internal"+N][q],!1),JXG$1.exists(v)&&JXG$1.exists(v.detachEvent)&&v.detachEvent("on"+N,z["x_internal"+N][q])}catch{JXG$1.debug("removeEvent: event not registered in browser: ("+N+" -- "+G+")")}z["x_internal"+N].splice(q,1)},removeAllEvents:function(v,N,G){var z,q;if(G["x_internal"+N]){for(q=G["x_internal"+N].length,z=q-1;z>=0;z--)JXG$1.removeEvent(v,N,G["x_internal"+N][z].origin,G);G["x_internal"+N].length>0&&JXG$1.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(v,N,G){var z,q,Y,W=0,ie=0;if(v||(v=window.event),Y=v.touches,JXG$1.exists(Y)&&Y.length===0&&(Y=v.changedTouches),JXG$1.exists(N)&&JXG$1.exists(Y))if(N===-1){for(q=Y.length,z=0;z<q;z++)if(Y[z]){v=Y[z];break}}else v=Y[N];return v.clientX&&(W=v.clientX,ie=v.clientY),[W,ie]},getOffset:function(v){var N,G=v,z=v,q=G.offsetLeft-G.scrollLeft,Y=G.offsetTop-G.scrollTop;for(N=this.getCSSTransform([q,Y],G),q=N[0],Y=N[1],G=G.offsetParent;G;){for(q+=G.offsetLeft,Y+=G.offsetTop,G.offsetParent&&(q+=G.clientLeft-G.scrollLeft,Y+=G.clientTop-G.scrollTop),N=this.getCSSTransform([q,Y],G),q=N[0],Y=N[1],z=z.parentNode;z!==G;)q+=z.clientLeft-z.scrollLeft,Y+=z.clientTop-z.scrollTop,N=this.getCSSTransform([q,Y],z),q=N[0],Y=N[1],z=z.parentNode;G=G.offsetParent}return[q,Y]},getStyle:function(v,N){var G,z=v.ownerDocument;return z.defaultView&&z.defaultView.getComputedStyle?G=z.defaultView.getComputedStyle(v,null).getPropertyValue(N):v.currentStyle&&JXG$1.ieVersion>=9?G=v.currentStyle[N]:v.style&&(N=N.replace(/-([a-z]|[0-9])/gi,function(q,Y){return Y.toUpperCase()}),G=v.style[N]),G},getProp:function(v,N){var G=parseInt(this.getStyle(v,N),10);return isNaN(G)?0:G},getCSSTransform:function(v,N){var G,z,q,Y,W,ie,ne,se,ae=["transform","webkitTransform","MozTransform","msTransform","oTransform"];for(ie=ae.length,G=0,q="";G<ie;G++)if(JXG$1.exists(N.style[ae[G]])){q=N.style[ae[G]];break}if(q!==""&&(W=q.indexOf("("),W>0)){for(ie=q.length,Y=q.substring(W+1,ie-1),se=Y.split(","),z=0,ne=se.length;z<ne;z++)se[z]=parseFloat(se[z]);q.indexOf("matrix")===0?(v[0]+=se[4],v[1]+=se[5]):q.indexOf("translateX")===0?v[0]+=se[0]:q.indexOf("translateY")===0?v[1]+=se[0]:q.indexOf("translate")===0&&(v[0]+=se[0],v[1]+=se[1])}return JXG$1.exists(N.style.zoom)&&(q=N.style.zoom,q!==""&&(v[0]*=parseFloat(q),v[1]*=parseFloat(q))),v},getCSSTransformMatrix:function(v){var N,G,z,q,Y,W,ie,ne,se,ae=v.ownerDocument,ce=["transform","webkitTransform","MozTransform","msTransform","oTransform"],pe=[[1,0,0],[0,1,0],[0,0,1]];if(ae.defaultView&&ae.defaultView.getComputedStyle)se=ae.defaultView.getComputedStyle(v,null),z=se.getPropertyValue("-webkit-transform")||se.getPropertyValue("-moz-transform")||se.getPropertyValue("-ms-transform")||se.getPropertyValue("-o-transform")||se.getPropertyValue("transform");else for(ie=ce.length,N=0,z="";N<ie;N++)if(JXG$1.exists(v.style[ce[N]])){z=v.style[ce[N]];break}if(z!==""&&(W=z.indexOf("("),W>0)){for(ie=z.length,q=z.substring(W+1,ie-1),Y=q.split(","),G=0,ne=Y.length;G<ne;G++)Y[G]=parseFloat(Y[G]);z.indexOf("matrix")===0?pe=[[1,0,0],[0,Y[0],Y[1]],[0,Y[2],Y[3]]]:z.indexOf("scaleX")===0?pe[1][1]=Y[0]:z.indexOf("scaleY")===0?pe[2][2]=Y[0]:z.indexOf("scale")===0&&(pe[1][1]=Y[0],pe[2][2]=Y[1])}return JXG$1.exists(v.style.zoom)&&(z=v.style.zoom,z!==""&&(pe[1][1]*=parseFloat(z),pe[2][2]*=parseFloat(z))),pe},timedChunk:function(v,N,G,z){var q=v.slice(),Y=function(){var W=+new Date;do N.call(G,q.shift());while(q.length>0&&+new Date-W<300);q.length>0?window.setTimeout(Y,1):z(v)};window.setTimeout(Y,1)},scaleJSXGraphDiv:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge,ve=z,be,Ee=[":fullscreen",":-webkit-full-screen",":-moz-full-screen",":-ms-fullscreen"],Pe=Ee.length,Je;for(W=G.getElementById(v).getBoundingClientRect(),Y=W.height,q=W.width,ce=G.getElementById(N),se=ce._cssFullscreenStore.w,ae=ce._cssFullscreenStore.h,be=ae/se,se>q*ve&&(se=q*ve,ae=se*be),ae>Y*ve&&(ae=Y*ve,se=ae/be),ie=se,ne=ae,be>1,be<Y/q?pe=q*ve/se:pe=Y*ve/ae,ge=(Y-ne)*.5,Je=0;Je<Pe;Je++)try{ce.style.width=ie+"px !important",ce.style.height=ne+"px !important",ce.style.margin="0 auto",ce.style.transform=ce._cssFullscreenStore.transform+" matrix("+pe+",0,0,"+pe+",0,"+ge+")";break}catch(Ce){JXG$1.debug(`JXG.scaleJSXGraphDiv:
46`+Ce)}Je===Pe&&JXG$1.debug("JXG.scaleJSXGraphDiv: Could not set any CSS property.")}});JXG$1.XML={cleanWhitespace:function(v){for(var N=v.firstChild;JXG$1.exists(N);)N.nodeType===3&&!/\S/.test(N.nodeValue)?v.removeChild(N):N.nodeType===1&&this.cleanWhitespace(N),N=N.nextSibling},parse:function(v){var N,G,z;return typeof DOMParser=="function"||typeof DOMParser=="object"?z=DOMParser:z=function(){this.parseFromString=function(q){var Y;return typeof ActiveXObject=="function"&&(Y=new ActiveXObject("MSXML.DomDocument"),Y.loadXML(q)),Y}},N=new z,G=N.parseFromString(v,"text/xml"),this.cleanWhitespace(G),G}};JXG$1.XML;JXG$1.EventEmitter={eventHandlers:{},suspended:{},trigger:function(v,N){var G,z,q,Y,W,ie;for(W=v.length,z=0;z<W;z++)if(Y=this.eventHandlers[v[z]],!this.suspended[v[z]]){if(this.suspended[v[z]]=!0,Y)for(ie=Y.length,G=0;G<ie;G++)q=Y[G],q.handler.apply(q.context,N);this.suspended[v[z]]=!1}return this},on:function(v,N,G){return JXG$1.isArray(this.eventHandlers[v])||(this.eventHandlers[v]=[]),G=JXG$1.def(G,this),this.eventHandlers[v].push({handler:N,context:G}),this},off:function(v,N){var G;return!v||!JXG$1.isArray(this.eventHandlers[v])?this:(N?(G=JXG$1.indexOf(this.eventHandlers[v],N,"handler"),G>-1&&this.eventHandlers[v].splice(G,1),this.eventHandlers[v].length===0&&delete this.eventHandlers[v]):delete this.eventHandlers[v],this)},eventify:function(v){v.eventHandlers={clicks:0},v.on=this.on,v.off=this.off,v.triggerEventHandlers=this.trigger,v.trigger=this.trigger,v.suspended={}}};const EventEmitter=JXG$1.EventEmitter;JXG$1.Coords=function(v,N,G,z){this.board=G,this.usrCoords=[],this.scrCoords=[],this.emitter=!JXG$1.exists(z)||z,this.emitter&&EventEmitter.eventify(this),this.setCoordinates(v,N,!1,!0)};JXG$1.extend(JXG$1.Coords.prototype,{normalizeUsrCoords:function(){Math.abs(this.usrCoords[0])>Mat.eps&&(this.usrCoords[1]/=this.usrCoords[0],this.usrCoords[2]/=this.usrCoords[0],this.usrCoords[0]=1)},usr2screen:function(v){var N=Math.round,G=this.board,z=this.usrCoords,q=G.origin.scrCoords;v===!0?(this.scrCoords[0]=N(z[0]),this.scrCoords[1]=N(z[0]*q[1]+z[1]*G.unitX),this.scrCoords[2]=N(z[0]*q[2]-z[2]*G.unitY)):(this.scrCoords[0]=z[0],this.scrCoords[1]=z[0]*q[1]+z[1]*G.unitX,this.scrCoords[2]=z[0]*q[2]-z[2]*G.unitY)},screen2usr:function(){var v=this.board.origin.scrCoords,N=this.scrCoords,G=this.board;this.usrCoords[0]=1,this.usrCoords[1]=(N[1]-v[1])/G.unitX,this.usrCoords[2]=(v[2]-N[2])/G.unitY},distance:function(v,N){var G=0,z,q=this.usrCoords,Y=this.scrCoords,W;return v===Const.COORDS_BY_USER?(z=N.usrCoords,W=q[0]-z[0],G=W*W,G>Mat.eps*Mat.eps?Number.POSITIVE_INFINITY:Mat.hypot(q[1]-z[1],q[2]-z[2])):(z=N.scrCoords,Mat.hypot(Y[1]-z[1],Y[2]-z[2]))}
46,setCoordinates:function(v,N,G,z){var q=this.usrCoords,Y=this.scrCoords,W=[q[0],q[1],q[2]],ie=[Y[0],Y[1],Y[2]];return v===Const.COORDS_BY_USER?(N.length===2?(q[0]=1,q[1]=N[0],q[2]=N[1]):(q[0]=N[0],q[1]=N[1],q[2]=N[2],this.normalizeUsrCoords()),this.usr2screen(G)):(N.length===2?(Y[1]=N[0],Y[2]=N[1]):(Y[1]=N[1],Y[2]=N[2]),this.screen2usr()),this.emitter&&!z&&(ie[1]!==Y[1]||ie[2]!==Y[2])&&this.triggerEventHandlers(["update"],[W,ie]),this},copy:function(v,N){return N===void 0&&(N=0),this[v].slice(N)},isReal:function(){return!isNaN(this.usrCoords[1]+this.usrCoords[2])&&Math.abs(this.usrCoords[0])>Mat.eps},__evt__update:function(v,N){},__evt:function(){}});const Coords=JXG$1.Coords;JXG$1.Expect={each:function(v,N,G){var z,q,Y=[];if(JXG$1.exists(v.length))for(q=v.length,z=0;z<q;z++)Y.push(N.call(this,v[z],G));return Y},coords:function(v,N){var G=v;return v&&v.elementClass===Const.OBJECT_CLASS_POINT?G=v.coords:v.usrCoords&&v.scrCoords&&v.usr2screen&&(G=v),N&&(G=new Coords(Const.COORDS_BY_USER,G.usrCoords,G.board)),G},coordsArray:function(v,N){var G;return JXG$1.isArray(v)?G=v:G=this.coords(v).usrCoords,G.length<3&&G.unshift(1),N&&(G=[G[0],G[1],G[2]]),G}};const Expect=JXG$1.Expect;Mat.ProbFuncs={MAXNUM:17014118346046923e22,SQRTH:.7071067811865476,SQRT2:1.4142135623730951,MAXLOG:708.3964185322641,P:[2461969814735305e-25,.5641895648310689,7.463210564422699,48.63719709856814,196.5208329560771,526.4451949954773,934.5285271719576,1027.5518868951572,557.5353353693994],Q:[13.228195115474499,86.70721408859897,354.9377788878199,975.7085017432055,1823.9091668790973,2246.3376081871097,1656.6630919416134,557.5353408177277],R:[.5641895835477551,1.275366707599781,5.019050422511805,6.160210979930536,7.4097426995044895,2.9788666537210022],S:[2.2605286322011726,9.396035249380015,12.048953980809666,17.08144507475659,9.608968090632859,3.369076451000815],T:[9.604973739870516,90.02601972038427,2232.005345946843,7003.325141128051,55592.30130103949],U:[33.56171416475031,521.3579497801527,4594.323829709801,22629.000061389095,49267.39426086359],M:128,MINV:.0078125,expx2:function(v,N){var G,z,q,Y;return v=Math.abs(v),N<0&&(v=-v),q=this.MINV*Math.floor(this.M*v+.5),Y=v-q,G=q*q,z=2*q*Y+Y*Y,N<0&&(G=-G,z=-z),G+z>this.MAXLOG?1/0:(G=Math.exp(G)*Math.exp(z),G)},polevl:function(v,N,G){var z,q;if(JXG$1.exists(N.reduce))return N.reduce(function(Y,W){return Y*v+W},0);for(q=0,z=0;q<=G;q++)z=z*v+N[q];return z},p1evl:function(v,N,G){var z,q;if(JXG$1.exists(N.reduce))return N.reduce(function(Y,W){return Y*v+W},1);for(q=0,z=1;q<G;q++)z=z*v+N[q];return z},ndtr:function(v){var N,G,z;return N=v*this.SQRTH,z=Math.abs(N),z<1?G=.5+.5*this.erf(N):(G=.5*this.erfce(z),z=this.expx2(v,-1),G=G*Math.sqrt(z),N>0&&(G=1-G)),G},_underflow:function(v){return console.log("erfc","UNDERFLOW"),v<0?2:0},erfc:function(v){var N,G,z,q,Y;return v<0?z=-v:z=v,z<1?1-this.erf(v):(Y=-v*v,Y<-this.MAXLOG?this._underflow(v):(Y=this.expx2(v,-1),z<8?(N=this.polevl(z,this.P,8),G=this.p1evl(z,this.Q,8)):(N=this.polevl(z,this.R,5),G=this.p1evl(z,this.S,6)),q=Y*N/G,v<0&&(q=2-q),q===0?this._underflow(v):q))},erfce:function(v){var N,G;return v<8?(N=this.polevl(v,this.P,8),G=this.p1evl(v,this.Q,8)):(N=this.polevl(v,this.R,5),G=this.p1evl(v,this.S,6)),N/G},erf:function(v){var N,G;return Math.abs(v)>1?1-this.erfc(v):(G=v*v,N=v*this.polevl(G,this.T,4)/this.p1evl(G,this.U,5),N)},s2pi:2.5066282746310007,P0:[-59.96335010141079,98.00107541859997,-56.67628574690703,13.931260938727968,-1.2391658386738125],Q0:[1.9544885833814176,4.676279128988815,86.36024213908905,-225.46268785411937,200.26021238006066,-82.03722561683334,15.90562251262
46117,-1.1833162112133],P1:[4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-.1402560791713545,-.03504246268278482,-.0008574567851546854],Q1:[15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-.14218292285478779,-.03808064076915783,-.0009332594808954574],P2:[3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,.20148538954917908,.012371663481782003,.00030158155350823543,26580697468673755e-22,6239745391849833e-24],Q2:[6.02427039364742,3.6798356385616087,1.3770209948908132,.21623699359449663,.013420400608854318,.00032801446468212774,28924786474538068e-22,6790194080099813e-24],ndtri:function(v){var N,G,z,q,Y,W,ie;return v<=0?-1/0:v>=1?1/0:(ie=1,G=v,G>1-.1353352832366127&&(G=1-G,ie=0),G>.1353352832366127?(G=G-.5,q=G*G,N=G+G*(q*this.polevl(q,this.P0,4)/this.p1evl(q,this.Q0,8)),N=N*this.s2pi,N):(N=Math.sqrt(-2*Math.log(G)),Y=N-Math.log(N)/N,z=1/N,N<8?W=z*this.polevl(z,this.P1,8)/this.p1evl(z,this.Q1,8):W=z*this.polevl(z,this.P2,8)/this.p1evl(z,this.Q2,8),N=Y-W,ie!==0&&(N=-N),N))},erfi:function(v){return this.ndtri((v+1)*.5)*this.SQRTH}};Mat.ProbFuncs;JXG$1.Math.DoubleBits=function(){var v=new Float64Array(1),N=new Uint32Array(v.buffer),G,z,q,Y,W,ie,ne,se;Float64Array!==void 0&&(v[0]=1,N[1]===1072693248?(G=function(ae){return v[0]=ae,[N[0],N[1]]},z=function(ae,ce){return N[0]=ae,N[1]=ce,v[0]},q=function(ae){return v[0]=ae,N[0]},Y=function(ae){return v[0]=ae,N[1]},this.doubleBits=G,this.pack=z,this.lo=q,this.hi=Y):N[0]===1072693248&&(W=function(ae){return v[0]=ae,[N[1],N[0]]},ie=function(ae,ce){return N[1]=ae,N[0]=ce,v[0]},ne=function(ae){return v[0]=ae,N[1]},se=function(ae){return v[0]=ae,N[0]},this.doubleBits=W,this.pack=ie,this.lo=ne,this.hi=se))};JXG$1.extend(JXG$1.Math.DoubleBits.prototype,{sign:function(v){return this.hi(v)>>>31},exponent:function(v){var N=this.hi(v);return(N<<1>>>21)-1023},fraction:function(v){var N=this.lo(v),G=this.hi(v),z=G&(1<<20)-1;return G&2146435072&&(z+=1<<20),[N,z]},denormalized:function(v){var N=this.hi(v);return!(N&2146435072)}});var doubleBits=new JXG$1.Math.DoubleBits,MatInterval=function(v,N){if(v!==void 0&&N!==void 0){if(Mat.IntervalArithmetic.isInterval(v)){if(!Mat.IntervalArithmetic.isSingleton(v))throw new TypeError("JXG.Math.IntervalArithmetic: interval `lo` must be a singleton");this.lo=v.lo}else this.lo=v;if(Mat.IntervalArithmetic.isInterval(N)){if(!Mat.IntervalArithmetic.isSingleton(N))throw new TypeError("JXG.Math.IntervalArithmetic: interval `hi` must be a singleton");this.hi=N.hi}else this.hi=N}else{if(v!==void 0)return Array.isArray(v)?new MatInterval(v[0],v[1]):new MatInterval(v,v);this.lo=this.hi=0}};JXG$1.extend(MatInterval.prototype,{print:function(){console.log("[",this.lo,this.hi,"]")},set:function(v,N){return this.lo=v,this.hi=N,this},bounded:function(v,N){return this.set(Mat.IntervalArithmetic.prev(v),Mat.IntervalArithmetic.next(N))},boundedSingleton:function(v){return this.bounded(v,v)},assign:function(v,N){if(typeof v!="number"||typeof N!="number")throw new TypeError("JXG.Math.Interval#assign: arguments must be numbers");return isNaN(v)||isNaN(N)||v>N?this.setEmpty():this.set(v,N)},setEmpty:function(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},setWhole:function(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)},open:function(v,N){return this.assign(Mat.IntervalArithmetic.next(v),Mat.IntervalArithmetic.prev(N))},halfOpenLeft:function(v,N){return this.assign(Mat.IntervalArithmetic.next(v),N)},halfOpenRight:function(v,N){return this.assign(v,Mat.IntervalArithmetic.prev(N))},toArray:function(){return[this.lo,this.hi]},clone:function(){return new MatInterval().set(this.lo,this.hi)}});JXG$1.Math.IntervalArithmetic={Interval:function(v,N){return new MatInterval(v,N)},isInterval:function(v){return v!==null&&typeof v=="object"&&typeof v.lo=="number"&&typeof v.hi=="number"},isSingleton:function(v){return v.lo===v.hi},add:function(v,N){return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),new MatInterval(this.addLo(v.lo,N.lo),this.addHi(v.hi,N.hi))},sub:function(v,N){return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),new MatInterval(this.subLo(v.lo,N.hi),this.subHi(v.hi,N.lo))},mul:function(v,N){var G,z,q,Y,W;return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),this.isEmpty(v)||this.isEmpty(N)?this.EMPTY.clone():(G=v.lo,z=v.hi,q=N.lo,Y=N.hi,W=new MatInterval,G<0?z>0?q<0?Y>0?(W.lo=Math.min(this.mulLo(G,Y),this.mulLo(z,q)),W.hi=Math.max(this.mulHi(G,q),this.mulHi(z,Y))):(W.lo=this.mulLo(z,q),W.hi=this.mulHi(G,q)):Y>0?(W.lo=this.mulLo(G,Y),W.hi=this.mulHi(z,Y)):(W.lo=0,W.hi=0):q<0?Y>0?(W.lo=this.mulLo(G,Y),W.hi=this.mulHi(G,q)):(W.lo=this.mulLo(z,Y),W.hi=this.mulHi(G,q)):Y>0?(W.lo=this.mulLo(G,Y),W.hi=this.mulHi(z,q)):(W.lo=0,W.hi=0):z>0?q<0?Y>0?(W.lo=this.mulLo(z,q),W.hi=this.mulHi(z,Y)):(W.lo=this.mulLo(z,q),W.hi=this.mulHi(G,Y)):Y>0?(W.lo=this.mulLo(G,q),W.hi=this.mulHi(z,Y)):(W.lo=0,W.hi=0):(W.lo=0,W.hi=0),W)},div:function(v,N){return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),this.isEmpty(v)||this.isEmpty(N)?this.EMPTY.clone():this.zeroIn(N)?N.lo!==0?N.hi!==0?this.divZero(v):this.divNegative(v,N.lo):N.hi!==0?this.divPositive(v,N.hi):this.EMPTY.clone():this.divNonZero(v,N)},positive:function(v){return new MatInterval(v.lo,v.hi)},negative:function(v){return JXG$1.isNumber(v)?new MatInterval(-v):new MatInterval(-v.hi,-v.lo)},isEmpty:function(v){return v.lo>v.hi},isWhole:function(v){return v.lo===-1/0&&v.hi===1/0},zeroIn:function(v){return this.hasValue(v,0)},hasValue:function(v,N){return this.isEmpty(v)?!1:v.lo<=N&&N<=v.hi},hasInterval:function(v,N){return this.isEmpty(v)?!0:!this.isEmpty(N)&&N.lo<=v.lo&&v.hi<=N.hi},intervalsOverlap:function(v,N){return this.isEmpty(v)||this.isEmpty(N)?!1:v.lo<=N.lo&&N.lo<=v.hi||N.lo<=v.lo&&v.lo<=N.hi},divNonZero:function(v,N){var G=v.lo,z=v.hi,q=N.lo,Y=N.hi,W=new MatInterval;return z<0?Y<0?(W.lo=this.divLo(z,q),W.hi=this.divHi(G,Y)):(W.lo=this.divLo(G,q),W.hi=this.divHi(z,Y)):G<0?Y<0?(W.lo=this.divLo(z,Y),W.hi=this.divHi(G,Y)):(W.lo=this.divLo(G,q),W.hi=this.divHi(z,q)):Y<0?(W.lo=this.divLo(z,Y),W.hi=this.divHi(G,q)):(W.lo=this.divLo(G,Y),W.hi=this.divHi(z,q)),W},divPositive:function(v,N){return v.lo===0&&v.hi===0?v:this.zeroIn(v)?this.WHOLE:v.hi<0?new MatInterval(Number.NEGATIVE_INFINITY,this.divHi(v.hi,N)
46):new MatInterval(this.divLo(v.lo,N),Number.POSITIVE_INFINITY)},divNegative:function(v,N){return v.lo===0&&v.hi===0?v:this.zeroIn(v)?this.WHOLE:v.hi<0?new MatInterval(this.divLo(v.hi,N),Number.POSITIVE_INFINITY):new MatInterval(Number.NEGATIVE_INFINITY,this.divHi(v.lo,N))},divZero:function(v){return v.lo===0&&v.hi===0?v:this.WHOLE},fmod:function(v,N){var G,z;return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),this.isEmpty(v)||this.isEmpty(N)?this.EMPTY.clone():(G=v.lo<0?N.lo:N.hi,z=v.lo/G,z<0?z=Math.ceil(z):z=Math.floor(z),this.sub(v,this.mul(N,new MatInterval(z))))},multiplicativeInverse:function(v){return JXG$1.isNumber(v)&&(v=this.Interval(v)),this.isEmpty(v)?this.EMPTY.clone():this.zeroIn(v)?v.lo!==0?v.hi!==0?this.WHOLE:new MatInterval(Number.NEGATIVE_INFINITY,this.divHi(1,v.lo)):v.hi!==0?new MatInterval(this.divLo(1,v.hi),Number.POSITIVE_INFINITY):this.EMPTY.clone():new MatInterval(this.divLo(1,v.hi),this.divHi(1,v.lo))},pow:function(v,N){var G,z;if(JXG$1.isNumber(v)&&(v=this.Interval(v)),this.isEmpty(v))return this.EMPTY.clone();if(this.isInterval(N)){if(!this.isSingleton(N))return this.EMPTY.clone();N=N.lo}return N===0?v.lo===0&&v.hi===0?this.EMPTY.clone():this.ONE.clone():N<0?this.pow(this.multiplicativeInverse(v),-N):N%1===0?v.hi<0?(G=this.powLo(-v.hi,N),z=this.powHi(-v.lo,N),(N&1)===1?new MatInterval(-z,-G):new MatInterval(G,z)):v.lo<0?(N&1)===1?new MatInterval(-this.powLo(-v.lo,N),this.powHi(v.hi,N)):new MatInterval(0,this.powHi(Math.max(-v.lo,v.hi),N)):new MatInterval(this.powLo(v.lo,N),this.powHi(v.hi,N)):(console.warn("power is not an integer, you should use nth-root instead, returning an empty interval"),this.EMPTY.clone())},sqrt:function(v){return JXG$1.isNumber(v)&&(v=this.Interval(v)),this.nthRoot(v,2)},nthRoot:function(v,N){var G,z,q,Y,W;if(JXG$1.isNumber(v)&&(v=this.Interval(v)),this.isEmpty(v)||N<0)return this.EMPTY.clone();if(this.isInterval(N)){if(!this.isSingleton(N))return this.EMPTY.clone();N=N.lo}return G=1/N,v.hi<0?N%1===0&&(N&1)===1?(z=this.powHi(-v.lo,G),q=this.powLo(-v.hi,G),new MatInterval(-z,-q)):this.EMPTY.clone():v.lo<0?(Y=this.powHi(v.hi,G),N%1===0&&(N&1)===1?(W=-this.powHi(-v.lo,G),new MatInterval(W,Y)):new MatInterval(0,Y)):new MatInterval(this.powLo(v.lo,G),this.powHi(v.hi,G))},exp:function(v){return JXG$1.isNumber(v)&&(v=this.Interval(v)),this.isEmpty(v)?this.EMPTY.clone():new MatInterval(this.expLo(v.lo),this.expHi(v.hi))},log:function(v){var N;return JXG$1.isNumber(v)&&(v=this.Interval(v)),this.isEmpty(v)?this.EMPTY.clone():(N=v.lo<=0?Number.NEGATIVE_INFINITY:this.logLo(v.lo),new MatInterval(N,this.logHi(v.hi)))},ln:function(v){return this.log(v)},log10:function(v){return this.isEmpty(v)?this.EMPTY.clone():this.div(this.log(v),this.log(new MatInterval(10,10)))},log2:function(v){return this.isEmpty(v)?this.EMPTY.clone():this.div(this.log(v),this.log(new MatInterval(2,2)))},hull:function(v,N){var G=this.isEmpty(v),z=this.isEmpty(N);return G&&z?this.EMPTY.clone():G?N.clone():z?v.clone():new MatInterval(Math.min(v.lo,N.lo),Math.max(v.hi,N.hi))},intersection:function(v,N){var G,z;return this.isEmpty(v)||this.isEmpty(N)?this.EMPTY.clone():(G=Math.max(v.lo,N.lo),z=Math.min(v.hi,N.hi),G<=z?new MatInterval(G,z):this.EMPTY.clone())},union:function(v,N){if(!this.intervalsOverlap(v,N))throw new Error("Interval#unions do not overlap");return new MatInterval(Math.min(v.lo,N.lo),Math.max(v.hi,N.hi))},difference:function(v,N){if(this.isEmpty(v)||this.isWhole(N))return this.EMPTY.clone();if(this.intervalsOverlap(v,N)){if(v.lo<N.lo&&N.hi<v.hi)throw new Error("Interval.difference: difference creates multiple intervals");return N.lo<=v.lo&&N.hi===1/0||N.hi>=v.hi&&N.lo===-1/0?this.EMPTY.clone():N.lo<=v.lo?new MatInterval().halfOpenLeft(N.hi,v.hi):new MatInterval().halfOpenRight(v.lo,N.lo)}return v.clone()},width:function(v){return this.isEmpty(v)?0:this.subHi(v.hi,v.lo)},abs:function(v){return JXG$1.isNumber(v)&&(v=this.Interval(v)),this.isEmpty(v)?this.EMPTY.clone():v.lo>=0?v.clone():v.hi<=0?this.negative(v):new MatInterval(0,Math.max(-v.lo,v.hi))},max:function(v,N){var G=this.isEmpty(v),z=this.isEmpty(N);return G&&z?this.EMPTY.clone():G?N.clone():z?v.clone():new MatInterval(Math.max(v.lo,N.lo),Math.max(v.hi,N.hi))},min:function(v,N){var G=this.isEmpty(v),z=this.isEmpty(N);return G&&z?this.EMPTY.clone():G?N.clone():z?v.clone():new MatInterval(Math.min(v.lo,N.lo),Math.min(v.hi,N.hi))},onlyInfinity:function(v){return!isFinite(v.lo)&&v.lo===v.hi},_handleNegative:function(v){var N;return v.lo<0&&(v.lo===-1/0?(v.lo=0,v.hi=1/0):(N=Math.ceil(-v.lo/this.piTwiceLow),v.lo+=this.piTwiceLow*N,v.hi+=this.piTwiceLow*N)),v},cos:function(v){var N,G,z,q,Y,W,ie,ne;return this.isEmpty(v)||this.onlyInfinity(v)?this.EMPTY.clone():(N=new MatInterval().set(v.lo,v.hi),this._handleNegative(N),G=this.PI_TWICE,z=this.fmod(N,G),this.width(z)>=G.lo?new MatInterval(-1,1):z.lo>=this.piHigh?(q=this.cos(this.sub(z,this.PI)),this.negative(q)):(Y=z.lo,W=z.hi,ie=this.cosLo(W),ne=this.cosHi(Y),W<=this.piLow?new MatInterval(ie,ne):W<=G.lo?new MatInterval(-1,Math.max(ie,ne)):new MatInterval(-1,1)))},sin:function(v){return this.isEmpty(v)||this.onlyInfinity(v)?this.EMPTY.clone():this.cos(this.sub(v,this.PI_HALF))},tan:function(v){var N,G,z;return this.isEmpty(v)||this.onlyInfinity(v)?this.EMPTY.clone():(N=new MatInterval().set(v.lo,v.hi),this._handleNegative(N),z=this.PI,G=this.fmod(N,z),G.lo>=this.piHalfLow&&(G=this.sub(G,z)),G.lo<=-this.piHalfLow||G.hi>=this.piHalfLow?this.WHOLE.clone():new MatInterval(this.tanLo(G.lo),this.tanHi(G.hi)))},asin:function(v){var N,G;return this.isEmpty(v)||v.hi<-1||v.lo>1?this.EMPTY.clone():(N=v.lo<=-1?-this.piHalfHigh:this.asinLo(v.lo),G=v.hi>=1?this.piHalfHigh:this.asinHi(v.hi),new MatInterval(N,G))},acos:function(v){var N,G;return this.isEmpty(v)||v.hi<-1||v.lo>1?this.EMPTY.clone():(N=v.hi>=1?0:this.acosLo(v.hi),G=v.lo<=-1?this.piHigh:this.acosHi(v.lo),new MatInterval(N,G))},acot:function(v){return this.isEmpty(v)?this.EMPTY.clone():new MatInterval(this.acotLo(v.lo),this.acotHi(v.hi))},atan:function(v){return this.isEmpty(v)?this.EMPTY.clone():new MatInterval(this.atanLo(v.lo),this.atanHi(v.hi))},sinh:function(v){return this.isEmpty(v)?this.EMPTY.clone():new MatInterval(this.sinhLo(v.lo),this.sinhHi(v.hi))},cosh:function(v){return this.isEmpty(v)?this.EMPTY.clone():v.hi<0?new MatInterval(this.coshLo(v.hi),this.coshHi(v.lo)):v.lo>=0?new MatInterval(this.coshLo(v.lo),this.coshHi(v.hi)):new MatInterval(1,this.coshHi(-v.lo>v.hi?v.lo:v.hi))},tanh:function(v){return this.isEmpty(v)?this.EMPTY.clone():new MatInterval(this.tanhLo(v.lo),this.tanhHi(v.hi))},equal:function(v,N){return this.isEmpty(v)?this.isEmpty(N):!this.isEmpty(N)&&v.lo===N.lo&&v.hi===N.hi},notEqual:function(v,N){return this.isEmpty(v)?!this.isEmpty(N):this.isEmpty(N)||v.hi<N.lo||v.lo>N.hi},lt:function(v,N){return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),this.isEmpty(v)||this.isEmpty(N)?!1:v.hi<N.lo},gt:function(v,N){return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),this.isEmpty(v)||this.isEmpty(N)?!1:v.lo>N.hi},leq:function(v,N){return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),this.isEmpty(v)||this.isEmpty(N)?!1:v.hi<=N.lo},geq:function(v,N){return JXG$1.isNumber(v)&&(v=this.Interval(v)),JXG$1.isNumber(N)&&(N=this.Interval(N)),this.isEmpty(v)||this.isEmpty(N)?!1:v.lo>=N.hi}
46,piLow:(3373259426+273688/(1<<21))/(1<<30),piHigh:(3373259426+273689/(1<<21))/(1<<30),piHalfLow:(3373259426+273688/(1<<21))/(1<<30)*.5,piHalfHigh:(3373259426+273689/(1<<21))/(1<<30)*.5,piTwiceLow:(3373259426+273688/(1<<21))/(1<<30)*2,piTwiceHigh:(3373259426+273689/(1<<21))/(1<<30)*2,identity:function(v){return v},_prev:function(v){return v===1/0?v:this.nextafter(v,-1/0)},_next:function(v){return v===-1/0?v:this.nextafter(v,1/0)},prev:function(v){return this._prev(v)},next:function(v){return this._next(v)},toInteger:function(v){return v<0?Math.ceil(v):Math.floor(v)},addLo:function(v,N){return this.prev(v+N)},addHi:function(v,N){return this.next(v+N)},subLo:function(v,N){return this.prev(v-N)},subHi:function(v,N){return this.next(v-N)},mulLo:function(v,N){return this.prev(v*N)},mulHi:function(v,N){return this.next(v*N)},divLo:function(v,N){return this.prev(v/N)},divHi:function(v,N){return this.next(v/N)},intLo:function(v){return this.toInteger(this.prev(v))},intHi:function(v){return this.toInteger(this.next(v))},logLo:function(v){return this.prev(Math.log(v))},logHi:function(v){return this.next(Math.log(v))},expLo:function(v){return this.prev(Math.exp(v))},expHi:function(v){return this.next(Math.exp(v))},sinLo:function(v){return this.prev(Math.sin(v))},sinHi:function(v){return this.next(Math.sin(v))},cosLo:function(v){return this.prev(Math.cos(v))},cosHi:function(v){return this.next(Math.cos(v))},tanLo:function(v){return this.prev(Math.tan(v))},tanHi:function(v){return this.next(Math.tan(v))},asinLo:function(v){return this.prev(Math.asin(v))},asinHi:function(v){return this.next(Math.asin(v))},acosLo:function(v){return this.prev(Math.acos(v))},acosHi:function(v){return this.next(Math.acos(v))},acotLo:function(v){return this.prev(Mat.acot(v))},acotHi:function(v){return this.next(Mat.acot(v))},atanLo:function(v){return this.prev(Math.atan(v))},atanHi:function(v){return this.next(Math.atan(v))},sinhLo:function(v){return this.prev(Mat.sinh(v))},sinhHi:function(v){return this.next(Mat.sinh(v))},coshLo:function(v){return this.prev(Mat.cosh(v))},coshHi:function(v){return this.next(Mat.cosh(v))},tanhLo:function(v){return this.prev(Mat.tanh(v))},tanhHi:function(v){return this.next(Mat.tanh(v))},sqrtLo:function(v){return this.prev(Math.sqrt(v))},sqrtHi:function(v){return this.next(Math.sqrt(v))},powLo:function(v,N){var G;if(N%1!==0)return this.prev(Math.pow(v,N));for(G=(N&1)===1?v:1,N>>=1;N>0;)v=this.mulLo(v,v),(N&1)===1&&(G=this.mulLo(v,G)),N>>=1;return G},powHi:function(v,N){var G;if(N%1!==0)return this.next(Math.pow(v,N));for(G=(N&1)===1?v:1,N>>=1;N>0;)v=this.mulHi(v,v),(N&1)===1&&(G=this.mulHi(v,G)),N>>=1;return G},disable:function(){this.next=this.prev=this.identity},enable:function(){this.prev=function(v){return this._prev(v)},this.next=function(v){return this._next(v)}},SMALLEST_DENORM:Math.pow(2,-1074),UINT_MAX:-1>>>0,nextafter:function(v,N){var G,z;return isNaN(v)||isNaN(N)?NaN:v===N?v:v===0?N<0?-this.SMALLEST_DENORM:this.SMALLEST_DENORM:(z=doubleBits.hi(v),G=doubleBits.lo(v),N>v==v>0?G===this.UINT_MAX?(z+=1,G=0):G+=1:G===0?(G=this.UINT_MAX,z-=1):G-=1,doubleBits.pack(G,z))}};JXG$1.Math.IntervalArithmetic.PI=new MatInterval(Mat.IntervalArithmetic.piLow,Mat.IntervalArithmetic.piHigh);JXG$1.Math.IntervalArithmetic.PI_HALF=new MatInterval(Mat.IntervalArithmetic.piHalfLow,Mat.IntervalArithmetic.piHalfHigh);JXG$1.Math.IntervalArithmetic.PI_TWICE=new MatInterval(Mat.IntervalArithmetic.piTwiceLow,Mat.IntervalArithmetic.piTwiceHigh);JXG$1.Math.IntervalArithmetic.ZERO=new MatInterval(0);JXG$1.Math.IntervalArithmetic.ONE=new MatInterval(1);JXG$1.Math.IntervalArithmetic.WHOLE=new MatInterval().setWhole();JXG$1.Math.IntervalArithmetic.EMPTY=new MatInterval().setEmpty();const Interval=JXG$1.Math.IntervalArithmetic;Mat.Extrapolate={upper:15,infty:1e4,wynnEps:function(v,N,G){var z=1e20,q=1e-15,Y=1,W,ie,ne,se,ae,ce;if(G[N]=v,N===0)ce=v;else{for(se=0,ie=N;ie>0;ie--)ne=se,se=G[ie-1],ae=G[ie]-se,Math.abs(ae)<=q?G[ie-1]=z:(W=(N-ie+1)%2===1?Y:1,G[ie-1]=ne*W+1/ae);ce=G[N%2]}return ce},aitken:function(v,N,G){var z,q=1e20,Y=1e-15,W,ie,ne,se,ae;if(G[N]=v,N<2)z=v;else{for(ne=N/2,se=1;se<=ne;se++)ae=N-2*se,W=G[ae+2]-2*G[ae+1]+G[ae],Math.abs(W)<Y?G[ae]=q:(ie=G[ae]-G[ae+1],G[ae]-=ie*ie/W);z=G[N%2]}return z},brezinski:function(v,N,G){var z,q=1e20,Y=1e-15,W,ie,ne,se,ae,ce,pe;if(G[N]=v,N<3)z=v;else{for(ae=N/3,pe=N,ce=1;ce<=ae;ce++)pe-=3,ie=G[pe+1]-G[pe],ne=G[pe+2]-G[pe+1],se=G[pe+3]-G[pe+2],W=se*(ne-ie)-ie*(se-ne),Math.abs(W)<Y?G[pe]=q:G[pe]=G[pe+1]-ie*ne*(se-ne)/W;z=G[N%3]}return z},iteration:function(v,N,G,z,q){var Y,W,ie,ne=NaN,se,ae=.5,ce=[],pe="finite",ge=N;for(q=q||0,Y=1;Y<=this.upper;Y++){if(ge=q===0?N/(Y+1):ge*ae,W=G(v+ge,!0),ie=this[z](W,Y-1,ce),isNaN(ie)){pe="NaN";break}if(W!==0&&ie/W>this.infty){ne=ie,pe="infinite";break}if(se=ie-ne,Math.abs(se)<1e-7)break;ne=ie}return[ne,pe,1-(Y-1)/this.upper]},levin:function(v,N,G,z,q,Y){var W=1e20,ie=1e-15,ne,se,ae,ce,pe;if(ce=1/(z+N),q[N]=v/G,Y[N]=1/G,N>0&&(q[N-1]=q[N]-q[N-1],Y[N-1]=Y[N]-Y[N-1],N>1))for(ae=(z+N-1)*ce,ne=2;ne<=N;ne++)se=(z+N-ne)*Math.pow(ae,ne-2)*ce,q[N-ne]=q[N-ne+1]-se*q[N-ne],Y[N-ne]=Y[N-ne+1]-se*Y[N-ne],ce*=ae;return Math.abs(Y[0])<ie?pe=W:pe=q[0]/Y[0],pe},iteration_levin:function(v,N,G,z){var q,Y,W,ie=NaN,ne,se,ae,ce,pe=1,ge=.5,ve=[],be=[],Ee="finite",Pe=N,Je="u";for(z=z||0,ne=G(v+N,!0),q=1;q<=this.upper;q++){if(Pe=z===0?N/(q+1):Pe*ge,Y=G(v+Pe,!0),se=Y-ne,Math.abs(se)<1?Je="u":Je="t",Je==="u"?ce=(pe+q)*se:ce=se,ne=Y,W=this.levin(Y,q-1,ce,pe,ve,be),ae=W-ie,isNaN(W)){Ee="NaN";break}if(Y!==0&&W/Y>this.infty){ie=W,Ee="infinite";break}if(Math.abs(ae)<1e-7)break;ie=W}return[ie,Ee,1-(q-1)/this.upper]},limit:function(v,N,G){return this.iteration_levin(v,N,G,0)}};const Extrapolate=Mat.Extrapolate;Mat.Statistics={sum:function(v){var N,G=v.length,z=0;for(N=0;N<G;N++)z+=v[N];return z},prod:function(v){var N,G=v.length,z=1;for(N=0;N<G;N++)z*=v[N];return z},mean:function(v){return v.length>0?this.sum(v)/v.length:0},median:function(v){var N,G;return v.length>0?(ArrayBuffer.isView(v)?(N=new Float64Array(v),N.sort()):(N=v.slice(0),N.sort(function(z,q){return z-q})),G=N.length,G&1?N[parseInt(G*.5,10)]:(N[G*.5-1]+N[G*.5])*.5):0},percentile:function(v,N){var G,z,q,Y,W=[],ie;if(v.length>0){for(ArrayBuffer.isView(v)?(G=new Float64Array(v),G.sort()):(G=v.slice(0),G.sort(function(ne,se){return ne-se})),z=G.length,JXG$1.isArray(N)?Y=N:Y=[N],q=0;q<Y.length;q++)ie=z*Y[q]*.01,parseInt(ie,10)===ie?W.push((G[ie-1]+G[ie])*.5):W.push(G[parseInt(ie,10)]);return JXG$1.isArray(N)?W:W[0]}return 0},variance:function(v){var N,G,z,q=v.length;if(q>1){for(N=this.mean(v),G=0,z=0;z<q;z++)G+=(v[z]-N)*(v[z]-N);return G/(v.length-1)}return 0},sd:function(v){return Math.sqrt(this.variance(v))},weightedMean:function(v,N){if(v.length!==N.length)throw new Error("JSXGraph error (Math.Statistics.weightedMean): Array dimension mismatch.");return v.length>0?this.mean(this.multiply(v,N)):0},max:function(v){return Math.max.apply(this,v)},min:function(v){return Math.min.apply(this,v)},range:function(v){return[this.min(v),this.max(v)]},abs:function(v){var N,G,z;if(JXG$1.isArray(v))if(v.map)z=v.map(Math.abs);else for(G=v.length,z=[],N=0;N<G;N++)z[N]=Math.abs(v[N]);else ArrayBuffer.isView(v)?z=v.map(Math.abs):z=Math.abs(v);return z},add:function(v,N){var G,z,q=[];
46if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),JXG$1.isArray(v)&&JXG$1.isNumber(N))for(z=v.length,G=0;G<z;G++)q[G]=v[G]+N;else if(JXG$1.isNumber(v)&&JXG$1.isArray(N))for(z=N.length,G=0;G<z;G++)q[G]=v+N[G];else if(JXG$1.isArray(v)&&JXG$1.isArray(N))for(z=Math.min(v.length,N.length),G=0;G<z;G++)q[G]=v[G]+N[G];else q=v+N;return q},div:function(v,N){var G,z,q=[];if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),JXG$1.isArray(v)&&JXG$1.isNumber(N))for(z=v.length,G=0;G<z;G++)q[G]=v[G]/N;else if(JXG$1.isNumber(v)&&JXG$1.isArray(N))for(z=N.length,G=0;G<z;G++)q[G]=v/N[G];else if(JXG$1.isArray(v)&&JXG$1.isArray(N))for(z=Math.min(v.length,N.length),G=0;G<z;G++)q[G]=v[G]/N[G];else q=v/N;return q},divide:function(){JXG$1.deprecated("Statistics.divide()","Statistics.div()"),Mat.Statistics.div.apply(Mat.Statistics,arguments)},mod:function(v,N,G){var z,q,Y=[],W=function(ie,ne){return ie%ne};if(G=JXG$1.def(G,!1),G&&(W=Mat.mod),v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),JXG$1.isArray(v)&&JXG$1.isNumber(N))for(q=v.length,z=0;z<q;z++)Y[z]=W(v[z],N);else if(JXG$1.isNumber(v)&&JXG$1.isArray(N))for(q=N.length,z=0;z<q;z++)Y[z]=W(v,N[z]);else if(JXG$1.isArray(v)&&JXG$1.isArray(N))for(q=Math.min(v.length,N.length),z=0;z<q;z++)Y[z]=W(v[z],N[z]);else Y=W(v,N);return Y},multiply:function(v,N){var G,z,q=[];if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),JXG$1.isArray(v)&&JXG$1.isNumber(N))for(z=v.length,G=0;G<z;G++)q[G]=v[G]*N;else if(JXG$1.isNumber(v)&&JXG$1.isArray(N))for(z=N.length,G=0;G<z;G++)q[G]=v*N[G];else if(JXG$1.isArray(v)&&JXG$1.isArray(N))for(z=Math.min(v.length,N.length),G=0;G<z;G++)q[G]=v[G]*N[G];else q=v*N;return q},subtract:function(v,N){var G,z,q=[];if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),JXG$1.isArray(v)&&JXG$1.isNumber(N))for(z=v.length,G=0;G<z;G++)q[G]=v[G]-N;else if(JXG$1.isNumber(v)&&JXG$1.isArray(N))for(z=N.length,G=0;G<z;G++)q[G]=v-N[G];else if(JXG$1.isArray(v)&&JXG$1.isArray(N))for(z=Math.min(v.length,N.length),G=0;G<z;G++)q[G]=v[G]-N[G];else q=v-N;return q},TheilSenRegression:function(v){var N,G,z=[],q=[],Y=[];for(N=0;N<v.length;N++){for(q.length=0,G=0;G<v.length;G++)Math.abs(v[G].usrCoords[1]-v[N].usrCoords[1])>Mat.eps&&(q[G]=(v[G].usrCoords[2]-v[N].usrCoords[2])/(v[G].usrCoords[1]-v[N].usrCoords[1]));z[N]=this.median(q),Y.push(v[N].usrCoords[2]-z[N]*v[N].usrCoords[1])}return[this.median(Y),this.median(z),-1]},generateGaussian:function(v,N){var G,z,q;if(this.hasSpare)return this.hasSpare=!1,this.spare*N+v;do G=Math.random()*2-1,z=Math.random()*2-1,q=G*G+z*z;while(q>=1||q===0);return q=Math.sqrt(-2*Math.log(q)/q),this.spare=z*q,this.hasSpare=!0,v+N*G*q},randomNormal:function(v,N){return this.generateGaussian(v,N)},randomUniform:function(v,N){return Math.random()*(N-v)+v},randomExponential:function(v){var N;if(v<=0)return NaN;do N=Math.random();while(N===0);return-Math.log(N)/v},randomGamma:function(v,N,G){var z,q,Y,W,ie,ne;if(v<=0)return NaN;if(N=N||1,G=G||0,v===1)return N*this.randomExponential(1)+G;if(v<1){ie=Math.E/(v+Math.E);do{z=Math.random();do q=Math.random();while(q===0);z<ie?(Y=Math.pow(q,1/v),ne=Math.exp(-Y)):(Y=1-Math.log(q),ne=Math.pow(Y,v-1)),z=Math.random()}while(z>=ne);return N*Y+G}do if(W=Math.tan(Math.PI*Math.random()),Y=Math.sqrt(2*v-1)*W+v-1,Y>0)q=Math.random();else continue;while(Y<=0||q>(1+W*W)*Math.exp((v-1)*Math.log(Y/(v-1))-Math.sqrt(2*v-1)*W));return N*Y+G},randomBeta:function(v,N){var G,z,q;return v<=0||N<=0?NaN:(G=this.randomGamma(v),z=this.randomGamma(N),q=G/(G+z),q)},randomChisquare:function(v){return v<=0?NaN:2*this.randomGamma(v*.5)},randomF:function(v,N){var G,z;return v<=0||N<=0?NaN:(G=this.randomChisquare(v),z=this.randomChisquare(N),G*N/(z*v))},randomT:function(v){var N,G;return v<=0?NaN:(N=this.randomNormal(0,1),G=this.randomChisquare(v),N/Math.sqrt(G/v))},randomBinomial:function(v,N){var G,z,q,Y,W,ie;if(N<0||N>1||v<0)return NaN;if(N===0)return 0;if(N===1)return v;if(v===0)return 0;if(v===1)return Math.random()<N?1:0;if(N>.5)return v-this.randomBinomial(v,1-N);if(v<100){if(G=-1,z=0,q=Math.log(1-N),q===0)return 0;do G+=1,z+=Math.floor(Math.log(Math.random())/q)+1;while(z<v)}else Y=1+Math.floor(v*.5),W=v-Y+1,G=this.randomBeta(Y,W),G>=N?(ie=this.randomBinomial(Y-1,N/G),G=ie):(ie=this.randomBinomial(W-1,(N-G)/(1-G)),G=Y+ie);return G},randomGeometric:function(v){var N;return v<0||v>1?NaN:(N=Math.random(),Math.ceil(Math.log(N)/Math.log(1-v)))},randomPoisson:function(v){var N=Math.exp(-v),G,z=0,q=1,Y,W=7/8;if(v<=0)return NaN;if(v<10){do q*=Math.random(),z+=1;while(q>N);G=z-1}else z=Math.floor(W*v),Y=this.randomGamma(z),Y<v?G=z+this.randomPoisson(v-Y):G=this.randomBinomial(z-1,v/Y);return G},randomPareto:function(v,N){var G=Math.random();return v<=0||N<=0?NaN:N*Math.pow(1-G,-1/v)},randomHypergeometric:function(v,N,G){var z,q,Y=0,W=v+N-G,ie=Math.min(v,N),ne=ie;if(v<1||N<1||G>v+N)return NaN;for(z=G;ne*z>0;)q=Math.random(),ne-=Math.floor(q+ne/(W+z)),z-=1;return Y=ie-ne,v<=N?Y:G-Y},histogram:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce=[],pe=[],ge=0;for(ie=N.bins||10,se=N.range||!1,se===!1?(Y=Math.min.apply(null,v),W=Math.max.apply(null,v)):(Y=se[0],W=se[1]),ie>0?ne=(W-Y)/(ie-1):ne=0,G=0;G<ie;G++)ce.push(0),pe.push(Y+G*ne);for(z=v.length,G=0;G<z;G++)q=Math.floor((v[G]-Y)/ne),q>=0&&q<ie?ce[q]+=1:ge+=1;if(N.density)for(ae=JXG$1.Math.Statistics.sum(ce)+ge,G=0;G<ie;G++)ce[G]/=ae*ne;if(N.cumulative){if(N.density)for(G=0;G<ie;G++)ce[G]*=ne;for(G=1;G<ie;G++)ce[G]+=ce[G-1]}return[ce,pe]}};const Stat=Mat.Statistics;var predefinedButcher={rk4:{s:4,A:[[0,0,0,0],[.5,0,0,0],[0,.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,.5,.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[.5,.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};Mat.Numerics={Gauss:function(v,N){var G,z,q,Y,W,ie=Mat.eps,ne=v.length>0?v[0].length:0;if(ne!==N.length||ne!==v.length)throw new Error("JXG.Math.Numerics.Gauss: Dimensions don't match. A must be a square matrix and b must be of the same length as A.");for(Y=[],W=N.slice(0,ne),G=0;G<ne;G++)Y[G]=v[G].slice(0,ne);for(z=0;z<ne;z++){for(G=ne-1;G>z;G--)if(Math.abs(Y[G][z])>ie)if(Math.abs(Y[z][z])<ie)JXG$1.swap(Y,G,z),JXG$1.swap(W,G,z);else for(Y[G][z]/=Y[z][z],W[G]-=Y[G][z]*W[z],q=z+1;q<ne;q++)Y[G][q]-=Y[G][z]*Y[z][q];if(Math.abs(Y[z][z])<ie)throw new Error("JXG.Math.Numerics.Gauss(): The given matrix seems to be singular.")}return this.backwardSolve(Y,W,!0),W},backwardSolve:function(v,N,G){var z,q,Y,W,ie;for(G?z=N:z=N.slice(0,N.length),q=v.length,Y=v.length>0?v[0].length:0,W=q-1;W>=0;W--){for(ie=Y-1;ie>W;ie--)z[W]-=v[W][ie]*z[ie];z[W]/=v[W][W]}return z},gaussBareiss:function(v){var N,G,z,q,Y,W,ie,ne,se,ae=Mat.eps;if(ie=v.length,ie<=0)return 0;for(v[0].length<ie&&(ie=v[0].length),ne=[],q=0;q<ie;q++)ne[q]=v[q].slice(0,ie);for(G=1,z=1,N=0;N<ie-1;N++){if(W=ne[N][N],Math.abs(W)<ae){for(q=N+1;q<ie&&!(Math.abs(ne[q][N])>=ae);q++);if(q===ie)return 0;for(Y=N;Y<ie;Y++)se=ne[q][Y],ne[q][Y]=ne[N][Y],ne[N][Y]=se;z=-z,W=ne[N][N]}for(q=N+1;q<ie;q++)for(Y=N+1;Y<ie;Y++)se=W*ne[q][Y]-ne[q][N]*ne[N][Y],ne[q][Y]=se/G;G=W}return z*ne[ie-1][ie-1]},det:function(v){var N=v.length;
46return N===2&&v[0].length===2?v[0][0]*v[1][1]-v[1][0]*v[0][1]:this.gaussBareiss(v)},Jacobi:function(v){var N,G,z,q,Y,W,ie,ne,se=Mat.eps*Mat.eps,ae=0,ce=v.length,pe=[[0,0,0],[0,0,0],[0,0,0]],ge=[[0,0,0],[0,0,0],[0,0,0]],ve=0;for(N=0;N<ce;N++){for(G=0;G<ce;G++)pe[N][G]=0,ge[N][G]=v[N][G],ae+=Math.abs(ge[N][G]);pe[N][N]=1}if(ce===1)return[ge,pe];if(ae<=0)return[ge,pe];ae/=ce*ce;do{for(ne=0,G=1;G<ce;G++)for(N=0;N<G;N++)if(q=Math.abs(ge[N][G]),ne+=q,q>=se){for(q=Math.atan2(2*ge[N][G],ge[N][N]-ge[G][G])*.5,Y=Math.sin(q),W=Math.cos(q),z=0;z<ce;z++)ie=ge[z][N],ge[z][N]=W*ie+Y*ge[z][G],ge[z][G]=-Y*ie+W*ge[z][G],ie=pe[z][N],pe[z][N]=W*ie+Y*pe[z][G],pe[z][G]=-Y*ie+W*pe[z][G];for(ge[N][N]=W*ge[N][N]+Y*ge[G][N],ge[G][G]=-Y*ge[N][G]+W*ge[G][G],ge[N][G]=0,z=0;z<ce;z++)ge[N][z]=ge[z][N],ge[G][z]=ge[z][G]}ve+=1}while(Math.abs(ne)/ae>se&&ve<2e3);return[ge,pe]},NewtonCotes:function(v,N,G){var z,q,Y,W=0,ie=G&&JXG$1.isNumber(G.number_of_nodes)?G.number_of_nodes:28,ne={trapez:!0,simpson:!0,milne:!0},se=G&&G.integration_type&&ne.hasOwnProperty(G.integration_type)&&ne[G.integration_type]?G.integration_type:"milne",ae=(v[1]-v[0])/ie;switch(se){case"trapez":for(W=(N(v[0])+N(v[1]))*.5,z=v[0],q=0;q<ie-1;q++)z+=ae,W+=N(z);W*=ae;break;case"simpson":if(ie%2>0)throw new Error("JSXGraph:  INT_SIMPSON requires config.number_of_nodes dividable by 2.");for(Y=ie/2,W=N(v[0])+N(v[1]),z=v[0],q=0;q<Y-1;q++)z+=2*ae,W+=2*N(z);for(z=v[0]-ae,q=0;q<Y;q++)z+=2*ae,W+=4*N(z);W*=ae/3;break;default:if(ie%4>0)throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");for(Y=ie*.25,W=7*(N(v[0])+N(v[1])),z=v[0],q=0;q<Y-1;q++)z+=4*ae,W+=14*N(z);for(z=v[0]-3*ae,q=0;q<Y;q++)z+=4*ae,W+=32*(N(z)+N(z+2*ae));for(z=v[0]-2*ae,q=0;q<Y;q++)z+=4*ae,W+=12*N(z);W*=2*ae/45}return W},Romberg:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce=[],pe=0,ge=1/0,ve=G&&JXG$1.isNumber(G.max_iterations)?G.max_iterations:20,be=G&&JXG$1.isNumber(G.eps)?G.eps:G.eps||1e-7;for(z=v[0],q=v[1],Y=q-z,ie=1,ce[0]=.5*Y*(N(z)+N(q)),ne=0;ne<ve;++ne){for(W=0,Y*=.5,ie*=2,ae=1,se=1;se<ie;se+=2)W+=N(z+se*Y);for(ce[ne+1]=.5*ce[ne]+W*Y,pe=ce[ne+1],se=ne-1;se>=0;--se)ae*=4,ce[se]=ce[se+1]+(ce[se+1]-ce[se])/(ae-1),pe=ce[se];if(Math.abs(pe-ge)<be*Math.abs(pe))break;ge=pe}return pe},GaussLegendre:function(v,N,G){var z,q,Y,W,ie,ne,se=0,ae=[],ce=[],pe,ge,ve=G&&JXG$1.isNumber(G.n)?G.n:12;if(ve>18&&(ve=18),ae[2]=[.5773502691896257],ce[2]=[1],ae[4]=[.33998104358485626,.8611363115940526],ce[4]=[.6521451548625461,.34785484513745385],ae[6]=[.2386191860831969,.6612093864662645,.932469514203152],ce[6]=[.46791393457269104,.3607615730481386,.17132449237917036],ae[8]=[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],ce[8]=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],ae[10]=[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],ce[10]=[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],ae[12]=[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],ce[12]=[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],ae[14]=[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],ce[14]=[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],ae[16]=[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499],ce[16]=[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],ae[18]=[.0847750130417353,.2518862256915055,.41175116146284263,.5597708310739475,.6916870430603532,.8037049589725231,.8926024664975557,.9558239495713977,.9915651684209309],ce[18]=[.1691423829631436,.16427648374583273,.15468467512626524,.14064291467065065,.12255520671147846,.10094204410628717,.07642573025488905,.0497145488949698,.02161601352648331],ae[3]=[0,.7745966692414834],ce[3]=[.8888888888888888,.5555555555555556],ae[5]=[0,.5384693101056831,.906179845938664],ce[5]=[.5688888888888889,.47862867049936647,.23692688505618908],ae[7]=[0,.4058451513773972,.7415311855993945,.9491079123427585],ce[7]=[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],ae[9]=[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],ce[9]=[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],ae[11]=[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],ce[11]=[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],ae[13]=[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],ce[13]=[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.092121499837
4672845,.04048400476531588],ae[15]=[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],ce[15]=[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],ae[17]=[0,.17848418149584785,.3512317634538763,.5126905370864769,.6576711592166907,.7815140038968014,.8802391537269859,.9506755217687678,.9905754753144174],ce[17]=[.17944647035620653,.17656270536699264,.16800410215645004,.15404576107681028,.13513636846852548,.11188384719340397,.08503614831717918,.0554595293739872,.02414830286854793],z=v[0],q=v[1],W=ve+1>>1,pe=ae[ve],ge=ce[ve],ne=.5*(q-z),ie=.5*(q+z),ve&!0)for(se=ge[0]*N(ie),Y=1;Y<W;++Y)se+=ge[Y]*(N(ie+ne*pe[Y])+N(ie-ne*pe[Y]));else for(se=0,Y=0;Y<W;++Y)se+=ge[Y]*(N(ie+ne*pe[Y])+N(ie-ne*pe[Y]));return ne*se},_rescale_error:function(v,N,G){var z,q,Y=22250738585072014e-324,W=2220446049250313e-31;return v=Math.abs(v),G!==0&&v!==0&&(z=Math.pow(200*v/G,1.5),z<1?v=G*z:v=G),N>Y/(50*W)&&(q=50*W*N,q>v&&(v=q)),v},_gaussKronrod:function(v,N,G,z,q,Y,W){var ie=v[0],ne=v[1],se,ae,ce=.5*(ie+ne),pe=.5*(ne-ie),ge=Math.abs(pe),ve=N(ce),be=0,Ee=ve*Y[G-1],Pe=Math.abs(Ee),Je=0,Ce=0,Ve=0,Re,qe,et,Ze,tt,Ke,rt,it=[],ot=[];for(G%2===0&&(be=ve*q[G/2-1]),se=Math.floor((G-1)/2),Re=0;Re<se;Re++)qe=Re*2+1,Ze=pe*z[qe],tt=N(ce-Ze),Ke=N(ce+Ze),rt=tt+Ke,it[qe]=tt,ot[qe]=Ke,be+=q[Re]*rt,Ee+=Y[qe]*rt,Pe+=Y[qe]*(Math.abs(tt)+Math.abs(Ke));for(se=Math.floor(G/2),Re=0;Re<se;Re++)et=Re*2,Ze=pe*z[et],tt=N(ce-Ze),Ke=N(ce+Ze),it[et]=tt,ot[et]=Ke,Ee+=Y[et]*(tt+Ke),Pe+=Y[et]*(Math.abs(tt)+Math.abs(Ke));for(Ce=Ee*.5,Je=Y[G-1]*Math.abs(ve-Ce),Re=0;Re<G-1;Re++)Je+=Y[Re]*(Math.abs(it[Re]-Ce)+Math.abs(ot[Re]-Ce));return Ve=(Ee-be)*pe,Ee*=pe,Pe*=ge,Je*=ge,ae=Ee,W.abserr=this._rescale_error(Ve,Pe,Je),W.resabs=Pe,W.resasc=Je,ae},GaussKronrod15:function(v,N,G){var z=[.9914553711208126,.9491079123427585,.8648644233597691,.7415311855993945,.5860872354676911,.4058451513773972,.20778495500789848,0],q=[.1294849661688697,.27970539148927664,.3818300505051189,.4179591836734694],Y=[.022935322010529224,.06309209262997856,.10479001032225019,.14065325971552592,.1690047266392679,.19035057806478542,.20443294007529889,.20948214108472782];return this._gaussKronrod(v,N,8,z,q,Y,G)},GaussKronrod21:function(v,N,G){var z=[.9956571630258081,.9739065285171717,.9301574913557082,.8650633666889845,.7808177265864169,.6794095682990244,.5627571346686047,.4333953941292472,.2943928627014602,.14887433898163122,0],q=[.06667134430868814,.1494513491505806,.21908636251598204,.26926671930999635,.29552422471475287],Y=[.011694638867371874,.032558162307964725,.054755896574351995,.07503967481091996,.0931254545836976,.10938715880229764,.12349197626206584,.13470921731147334,.14277593857706009,.14773910490133849,.1494455540029169];return this._gaussKronrod(v,N,11,z,q,Y,G)},GaussKronrod31:function(v,N,G){var z=[.9980022986933971,.9879925180204854,.9677390756791391,.937273392400706,.8972645323440819,.8482065834104272,.790418501442466,.7244177313601701,.650996741297417,.5709721726085388,.4850818636402397,.3941513470775634,.29918000715316884,.20119409399743451,.1011420669187175,0],q=[.03075324199611727,.07036604748810812,.10715922046717194,.13957067792615432,.16626920581699392,.1861610000155622,.19843148532711158,.2025782419255613],Y=[.005377479872923349,.015007947329316122,.02546084732671532,.03534636079137585,.04458975132476488,.05348152469092809,.06200956780067064,.06985412131872826,.07684968075772038,.08308050282313302,.08856444305621176,.09312659817082532,.09664272698362368,.09917359872179196,.10076984552387559,.10133000701479154];return this._gaussKronrod(v,N,16,z,q,Y,G)},_workspace:function(v,N){return{limit:N,size:0,nrmax:0,i:0,alist:[v[0]],blist:[v[1]],rlist:[0],elist:[0],order:[0],level:[0],qpsrt:function(){var G=this.size-1,z=this.limit,q,Y,W,ie,ne,se=this.nrmax,ae=this.order[se];if(G<2){this.order[0]=0,this.order[1]=1,this.i=ae;return}for(q=this.elist[ae];se>0&&q>this.elist[this.order[se-1]];)this.order[se]=this.order[se-1],se--;for(G<z/2+2?ne=G:ne=z-G+1,W=se+1;W<ne&&q<this.elist[this.order[W]];)this.order[W-1]=this.order[W],W++;for(this.order[W-1]=ae,Y=this.elist[G],ie=ne-1;ie>W-2&&Y>=this.elist[this.order[ie]];)this.order[ie+1]=this.order[ie],ie--;this.order[ie+1]=G,ae=this.order[se],this.i=ae,this.nrmax=se},set_initial_result:function(G,z){this.size=1,this.rlist[0]=G,this.elist[0]=z},update:function(G,z,q,Y,W,ie,ne,se){var ae=this.i,ce=this.size,pe=this.level[this.i]+1;se>Y?(this.alist[ae]=W,this.rlist[ae]=ne,this.elist[ae]=se,this.level[ae]=pe,this.alist[ce]=G,this.blist[ce]=z,this.rlist[ce]=q,this.elist[ce]=Y,this.level[ce]=pe):(this.blist[ae]=z,this.rlist[ae]=q,this.elist[ae]=Y,this.level[ae]=pe,this.alist[ce]=W,this.blist[ce]=ie,this.rlist[ce]=ne,this.elist[ce]=se,this.level[ce]=pe),this.size++,pe>this.maximum_level&&(this.maximum_level=pe),this.qpsrt()},retrieve:function(){var G=this.i;return{a:this.alist[G],b:this.blist[G],r:this.rlist[G],e:this.elist[G]}},sum_results:function(){var G=this.size,z,q=0;for(z=0;z<G;z++)q+=this.rlist[z];return q},subinterval_too_small:function(G,z,q){var Y=2220446049250313e-31,W=22250738585072014e-324,ie=(1+100*Y)*(Math.abs(z)+1e3*W);return Math.abs(G)<=ie&&Math.abs(q)<=ie}}},Qag:function(v,N,G){var z=2220446049250313e-31,q=this._workspace(v,1e3),Y=G&&JXG$1.isNumber(G.limit)?G.limit:15,W=G&&JXG$1.isNumber(G.epsrel)?G.epsrel:1e-7,ie=G&&JXG$1.isNumber(G.epsabs)?G.epsabs:1e-7,ne=G&&JXG$1.isFunction(G.q)?G.q:this.GaussKronrod15,se={},ae,ce,pe,ge,ve,be,Ee,Pe,Je=0,Ce=0,Ve=0,Re=0,qe,et,Ze,tt,Ke,rt,it,ot,ut,ct=0,at=0,st=0,pt=0,lt=0,vt=0,dt,xt,ft,Et;if(Y>q.limit&&JXG$1.warn("iteration limit exceeds available workspace"),ie<=0&&(W<50*Mat.eps||W<5e-29)&&JXG$1.warn("tolerance cannot be acheived with given epsabs and epsrel"),pe=ne.apply(this,[v,N,se]),ge=se.abserr,ve=se.resabs,be=se.resasc,q.set_initial_result(pe,ge),Pe=Math.max(ie,W*Math.abs(pe)),qe=50*z*ve,ge<=qe&&ge>Pe)return Ee=pe,JXG$1.warn("cannot reach tolerance because of roundoff error on first attempt"),-1/0;if(ge<=Pe&&ge!==be||ge===0)return Ee=pe,Ee;if(Y===1)return Ee=pe,JXG$1.warn("a maximum of one iteration was insufficient"),-1/0;ae=pe,ce=ge,Je=1;do ct=0,at=0,st=0,pt=0,lt=0,vt=0,ft=q.retrieve(),rt=ft.a,it=ft.b,ot=ft.r,ut=ft.e,et=rt,Ze=.5*(rt+it),tt=Ze,Ke=it,ct=ne.apply(this,[[et,Ze],N,se]),pt=se.abserr,dt=se.resasc,at=ne.apply(this,[[tt,Ke],N,se]),lt=se.abserr,xt=se.resasc,st=ct+at,vt=pt+lt,ce+=vt-ut,ae+=st-ot,dt!==pt&&xt!==lt&&(Et=ot-st,Math.abs(Et)<=1e-5*Math.abs(st)&&vt>=.99*ut&&Ce++,Je>=10&&vt>ut&&Ve++),Pe=Math.max(ie,W*Math.abs(ae)),ce>Pe&&((Ce>=6||Ve>=20)&&(Re=2),q.subinterval_too_small(et,tt,Ke)&&(Re=3)),q.update(et,Ze,ct,pt,tt,Ke,at,lt),ft=q.retrieve(),rt=ft.a_i,it=ft.b_i,ot=ft.r_i,ut=ft.e_i,Je++;while(Je<Y&&!Re&&ce>Pe);return Ee=q.sum_results(),Ee},I:function(v,N){return this.Qag(v,N,{q:this.GaussKronrod15,limit:15,epsrel:1e-7,epsabs:1e-7})},Newton:function(v,N,G){var z,q=0,Y=Mat.eps,W=v.apply(G,[N]);for(JXG$1.isArray(N)&&(N=N[0]);q<50&&Math.abs(W)>Y;)z=this.D(v,G)(N),Math.abs(z)>Y?N-=W/z:N+=Math.random()*.2-1,W=v.apply(G,[N]),q+=1;return N},root:function(v,N,G){return this.chandrupatla(v,N,G)},generalizedNewton:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je=0;for(this.generalizedNewton.t1memo?(q=this.generalizedNewton.t1memo,Y=this.generalizedNewton.t2memo):(q=G,Y=z),ae=v.X(q)-N.X(Y),ce=v.Y(q)-N.Y(Y),ge=ae*ae+ce*ce,ve=this.D(v.X,v),be=this.D(N.X,N),Ee=this.D(v.Y,v),Pe=this.D(N.Y,N);ge>Mat.eps&&Je<10;)W=ve(q),ie=-be(Y),ne=Ee(q),se=-Pe(Y),pe=W*se-ie*ne,q-=(se*ae-ie*ce)/pe,Y-=(W*ce-ne*ae)/pe,ae=v.X(q)-N.X(Y),ce=v.Y(q)-N.Y(Y),ge=ae*ae+ce*ce,Je+=1;return this.generalizedNewton.t1memo=q,this.generalizedNewton.t2memo=Y,Math.abs(q)<Math.abs(Y)?[v.X(q),v.Y(q)]:[N.X(Y),N.Y(Y)]},Neville:function(v){var N=[],G=function(Y){return function(W,ie){var ne,se,ae,ce=Mat.binomial,pe=v.length,ge=pe-1,ve=0,be=0;
46if(!ie)for(ae=1,ne=0;ne<pe;ne++)N[ne]=ce(ge,ne)*ae,ae*=-1;for(se=W,ne=0;ne<pe;ne++){if(se===0)return v[ne][Y]();ae=N[ne]/se,se-=1,ve+=v[ne][Y]()*ae,be+=ae}return ve/be}},z=G("X"),q=G("Y");return[z,q,0,function(){return v.length-1}]},splineDef:function(v,N){var G,z,q,Y=Math.min(v.length,N.length),W=[],ie=[],ne=[],se=[],ae=[],ce=[];if(Y===2)return[0,0];for(z=0;z<Y;z++)G={X:v[z],Y:N[z]},ne.push(G);for(ne.sort(function(pe,ge){return pe.X-ge.X}),z=0;z<Y;z++)v[z]=ne[z].X,N[z]=ne[z].Y;for(z=0;z<Y-1;z++)se.push(v[z+1]-v[z]);for(z=0;z<Y-2;z++)ae.push(6*(N[z+2]-N[z+1])/se[z+1]-6*(N[z+1]-N[z])/se[z]);for(W.push(2*(se[0]+se[1])),ie.push(ae[0]),z=0;z<Y-3;z++)q=se[z+1]/W[z],W.push(2*(se[z+1]+se[z+2])-q*se[z+1]),ie.push(ae[z+1]-q*ie[z]);for(ce[Y-3]=ie[Y-3]/W[Y-3],z=Y-4;z>=0;z--)ce[z]=(ie[z]-se[z+1]*ce[z+1])/W[z];for(z=Y-3;z>=0;z--)ce[z+1]=ce[z];return ce[0]=0,ce[Y-1]=0,ce},splineEval:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce=Math.min(N.length,G.length),pe=1,ge=!1,ve=[];for(JXG$1.isArray(v)?(pe=v.length,ge=!0):v=[v],q=0;q<pe;q++){if(v[q]<N[0]||N[q]>N[ce-1])return NaN;for(Y=1;Y<ce&&!(v[q]<=N[Y]);Y++);Y-=1,W=G[Y],ie=(G[Y+1]-G[Y])/(N[Y+1]-N[Y])-(N[Y+1]-N[Y])/6*(z[Y+1]+2*z[Y]),ne=z[Y]/2,se=(z[Y+1]-z[Y])/(6*(N[Y+1]-N[Y])),ae=v[q]-N[Y],ve.push(W+(ie+(ne+se*ae)*ae)*ae)}return ge?ve:ve[0]},generatePolynomialTerm:function(v,N,G,z){var q,Y=[];for(q=N;q>=0;q--)JXG$1.concat(Y,["(",v[q].toPrecision(z),")"]),q>1?JXG$1.concat(Y,["*",G,"<sup>",q,"<","/sup> + "]):q===1&&JXG$1.concat(Y,["*",G," + "]);return Y.join("")},lagrangePolynomial:function(v){var N=[],G=this,z=function(q,Y){var W,ie,ne,se,ae=v.length,ce=0,pe=0;if(!Y)for(W=0;W<ae;W++){for(N[W]=1,ne=v[W].X(),ie=0;ie<ae;ie++)ie!==W&&(N[W]*=ne-v[ie].X());N[W]=1/N[W]}for(W=0;W<ae;W++){if(ne=v[W].X(),q===ne)return v[W].Y();se=N[W]/(q-ne),pe+=se,ce+=se*v[W].Y()}return ce/pe};return z.getTerm=function(q,Y,W){return G.lagrangePolynomialTerm(v,q,Y,W)()},z.getCoefficients=function(){return G.lagrangePolynomialCoefficients(v)()},z},lagrangePolynomialTerm:function(v,N,G,z){var q=this;return function(){var Y=v.length,W=[],ie=!0,ne,se,ae,ce;for(G=G||"x",z===void 0&&(z=" * "),ne=Y-1,W=q.lagrangePolynomialCoefficients(v)(),se="",ae=0;ae<W.length;ae++)ce=W[ae],!(Math.abs(ce)<Mat.eps)&&(JXG$1.exists(N)&&(ce=JXG$1._round10(ce,-N)),ie?(se+=ce>0?ce:"-"+-ce,ie=!1):se+=ce>0?" + "+ce:" - "+-ce,ne-ae>1?se+=z+G+"^"+(ne-ae):ne-ae===1&&(se+=z+G));return se}},lagrangePolynomialCoefficients:function(v){return function(){var N=v.length,G=[],z=[],q=[],Y,W,ie,ne;for(W=0;W<N;W++)q[W]=0;for(Y=0;Y<N;Y++){for(ie=v[Y].Y(),ne=v[Y].X(),G=[],W=0;W<N;W++)W!==Y&&(ie/=ne-v[W].X(),G.push(v[W].X()));for(z=[1].concat(Mat.Vieta(G)),W=0;W<z.length;W++)q[W]+=(W%2===1?-1:1)*z[W]*ie}return q}},_initCubicPoly:function(v,N,G,z){return[v,G,-3*v+3*N-2*G-z,2*v-2*N+G+z]},CardinalSpline:function(v,N,G){var z,q=[],Y,W,ie,ne=this;return JXG$1.isFunction(N)?ie=N:ie=function(){return N},G===void 0&&(G="uniform"),Y=function(se){return function(ae,ce){var pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re;if(v.length<2)return NaN;if(!ce)for(W=ie(),ve={X:function(){return 2*v[0].X()-v[1].X()},Y:function(){return 2*v[0].Y()-v[1].Y()},Dist:function(qe){var et=this.X()-qe.X(),Ze=this.Y()-qe.Y();return Mat.hypot(et,Ze)}},be={X:function(){return 2*v[v.length-1].X()-v[v.length-2].X()},Y:function(){return 2*v[v.length-1].Y()-v[v.length-2].Y()},Dist:function(qe){var et=this.X()-qe.X(),Ze=this.Y()-qe.Y();return Mat.hypot(et,Ze)}},z=[ve].concat(v,[be]),Re=z.length,q[se]=[],pe=0;pe<Re-3;pe++)G==="centripetal"?(Je=z[pe].Dist(z[pe+1]),Ce=z[pe+2].Dist(z[pe+1]),Ve=z[pe+3].Dist(z[pe+2]),Je=Math.sqrt(Je),Ce=Math.sqrt(Ce),Ve=Math.sqrt(Ve),Ce<Mat.eps&&(Ce=1),Je<Mat.eps&&(Je=Ce),Ve<Mat.eps&&(Ve=Ce),Ee=(z[pe+1][se]()-z[pe][se]())/Je-(z[pe+2][se]()-z[pe][se]())/(Ce+Je)+(z[pe+2][se]()-z[pe+1][se]())/Ce,Pe=(z[pe+2][se]()-z[pe+1][se]())/Ce-(z[pe+3][se]()-z[pe+1][se]())/(Ve+Ce)+(z[pe+3][se]()-z[pe+2][se]())/Ve,Ee*=Ce,Pe*=Ce,q[se][pe]=ne._initCubicPoly(z[pe+1][se](),z[pe+2][se](),W*Ee,W*Pe)):q[se][pe]=ne._initCubicPoly(z[pe+1][se](),z[pe+2][se](),W*(z[pe+2][se]()-z[pe][se]()),W*(z[pe+3][se]()-z[pe+1][se]()));return isNaN(ae)?NaN:(Re=v.length,ae<=0?v[0][se]():ae>=Re?v[Re-1][se]():(pe=Math.floor(ae),pe===ae?v[pe][se]():(ae-=pe,ge=q[se][pe],ge===void 0?NaN:((ge[3]*ae+ge[2])*ae+ge[1])*ae+ge[0])))}},[Y("X"),Y("Y"),0,function(){return v.length-1}]},CatmullRomSpline:function(v,N){return this.CardinalSpline(v,.5,N)},regressionPolynomial:function(v,N,G){var z,q,Y,W,ie,ne,se="";if(JXG$1.isPoint(v)&&JXG$1.isFunction(v.Value))q=function(){return v.Value()};else if(JXG$1.isFunction(v))q=v;else if(JXG$1.isNumber(v))q=function(){return v};else throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof v+"'.");if(arguments.length===3&&JXG$1.isArray(N)&&JXG$1.isArray(G))ie=0;else if(arguments.length===2&&JXG$1.isArray(N)&&N.length>0&&JXG$1.isPoint(N[0]))ie=1;else if(arguments.length===2&&JXG$1.isArray(N)&&N.length>0&&N[0].usrCoords&&N[0].scrCoords)ie=2;else throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");return ne=function(ae,ce){var pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re=N.length;if(Ve=Math.floor(q()),!ce){if(ie===1)for(Y=[],W=[],pe=0;pe<Re;pe++)Y[pe]=N[pe].X(),W[pe]=N[pe].Y();if(ie===2)for(Y=[],W=[],pe=0;pe<Re;pe++)Y[pe]=N[pe].usrCoords[1],W[pe]=N[pe].usrCoords[2];if(ie===0)for(Y=[],W=[],pe=0;pe<Re;pe++)JXG$1.isFunction(N[pe])?Y.push(N[pe]()):Y.push(N[pe]),JXG$1.isFunction(G[pe])?W.push(G[pe]()):W.push(G[pe]);for(ve=[],ge=0;ge<Re;ge++)ve.push([1]);for(pe=1;pe<=Ve;pe++)for(ge=0;ge<Re;ge++)ve[ge][pe]=ve[ge][pe-1]*Y[ge];Ee=W,be=Mat.transpose(ve),Pe=Mat.matMatMult(be,ve),Je=Mat.matVecMult(be,Ee),z=Mat.Numerics.Gauss(Pe,Je),se=Mat.Numerics.generatePolynomialTerm(z,Ve,"x",3)}for(Ce=z[Ve],pe=Ve-1;pe>=0;pe--)Ce=Ce*ae+z[pe];return Ce},ne.getTerm=function(){return se},ne},bezier:function(v){var N,G,z=function(q){return function(Y,W){var ie=Math.floor(Y)*3,ne=Y%1,se=1-ne;return W||(G=3*Math.floor((v.length-1)/3),N=Math.floor(G/3)),Y<0?v[0][q]():Y>=N?v[G][q]():isNaN(Y)?NaN:se*se*(se*v[ie][q]()+3*ne*v[ie+1][q]())+(3*se*v[ie+2][q]()+ne*v[ie+3][q]())*ne*ne}};return[z("X"),z("Y"),0,function(){return Math.floor(v.length/3)}]},bspline:function(v,N){var G,z=function(W,ie){var ne,se=[];for(ne=0;ne<W+ie+1;ne++)ne<ie?se[ne]=0:ne<=W?se[ne]=ne-ie+1:se[ne]=W-ie+2;return se},q=function(W,ie,ne,se){var ae,ce,pe,ge,ve,be=[];for(ie[se]<=W&&W<ie[se+1]?be[se]=1:be[se]=0,ae=2;ae<=ne;ae++)for(ce=se-ae+1;ce<=se;ce++)ce<=se-ae+1||ce<0?pe=0:pe=be[ce],ce>=se?ge=0:ge=be[ce+1],ve=ie[ce+ae-1]-ie[ce],ve===0?be[ce]=0:be[ce]=(W-ie[ce])/ve*pe,ve=ie[ce+ae]-ie[ce+1],ve!==0&&(be[ce]+=(ie[ce+ae]-W)/ve*ge);return be},Y=function(W){return function(ie,ne){var se,ae,ce,pe=[],ge=v.length,ve=ge-1,be=N;if(ve<=0)return NaN;if(ve+2<=be&&(be=ve+1),ie<=0)return v[0][W]();if(ie>=ve-be+2)return v[ve][W]();for(ce=Math.floor(ie)+be-1,G=z(ve,be),pe=q(ie,G,be,ce),se=0,ae=ce-be+1;ae<=ce;ae++)ae<ge&&ae>=0&&(se+=v[ae][W]()*pe[ae]);return se}};return[Y("X"),Y("Y"),0,function(){return v.length-1}]},D:function(v,N){return JXG$1.exists(N)?function(G,z){var q=1e-5,Y=q*2;return(v.apply(N,[G+q,z])-v.apply(N,[G-q,z]))/Y}:function(G,z){var q=1e-5,Y=q*2;return(v(G+q,z)-v(G-q,z))/Y}},_riemannValue:function(v,N,G,z){var q,Y,W,ie;if(z<0&&(G!=="trapezoidal"&&(v=v+z),z*=-1,G==="lower"?G="upper":G==="upper"&&(G="lower")),ie=z*.01,G==="right")q=N(v+z);else if(G==="middle")q=N(v+z*.5);else if(G==="left"||G==="trapezoidal")q=N(v);else if(G==="lower"){for(q=N(v),W=v+ie;W<=v+z;W+=ie)Y=N(W),Y<q&&(q=Y);Y=N(v+z),Y<q&&(q=Y)}else if(G==="upper"){for(q=N(v),W=v+ie;W<=v+z;W+=ie)Y=N(W),Y>q&&(q=Y);Y=N(v+z),Y>q&&(q=Y)}else G==="random"?q=N(v+z*Math.random()):G==="simpson"?q=(N(v)+4*N(v+z*.5)+N(v+z))/6:q=N(v);return q},riemann:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee=30,Pe=[],Je=[],Ce=z,Ve=0,Re,qe,et;if(JXG$1.isArray(v)?(et=v[0],qe=v[1]):qe=v,N=Math.floor(N),N<=0)return[Pe,Je,Ve];for(W=(q-z)/N,Y=0;Y<N;Y++){if(G==="simpson"){for(Ve+=this._riemannValue(Ce,qe,G,W)*W,be=W*.5,ce=qe(Ce),pe=qe(Ce+be),ge=qe(Ce+2*be),ne=(ge+ce-2*pe)/(be*be)*.5,se=(ge-ce)/(2*be),ae=pe,ie=0;ie<Ee;ie++)ve=ie*W/Ee-be,Pe.push(Ce+ve+be),Je.push(ne*ve*ve+se*ve+ae);Ce+=W,Re=ge}else Re=this._riemannValue(Ce,qe,G,W),Pe.push(Ce),Je.push(Re),Ce+=W,G==="trapezoidal"?(ge=qe(Ce),Ve+=(Re+ge)*.5*W,Re=ge):Ve+=Re*W,Pe.push(Ce),Je.push(Re);Pe.push(Ce),Je.push(Re)}for(Y=0;Y<N;Y++){if(G==="simpson"&&et){for(Ve-=this._riemannValue(Ce,et,G,-W)*W,be=W*.5,ce=et(Ce),pe=et(Ce-be),ge=et(Ce-2*be),ne=(ge+ce-2*pe)/(be*be)*.5,se=(ge-ce)/(2*be),ae=pe,ie=0;ie<Ee;ie++)ve=ie*W/Ee-be,Pe.push(Ce-ve-be),Je.push(ne*ve*ve+se*ve+ae);Ce-=W,Re=ge}else et?Re=this._riemannValue(Ce,et,G,-W):Re=0,Pe.push(Ce),Je.push(Re),Ce-=W,et&&(G==="trapezoidal"?(ge=et(Ce),Ve-=(Re+ge)*.5*W,Re=ge):Ve-=Re*W);Pe.push(Ce),Je.push(Re),Pe.push(Ce),Je.push(qe(Ce))}return[Pe,Je,Ve]},riemannsum:function(v,N,G,z,q){return JXG$1.deprecated("Numerics.riemannsum()","Numerics.riemann()[2]"),this.riemann(v,N,G,z,q)[2]},rungeKutta:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce=[],pe=[],ge=(G[1]-G[0])/z,ve=G[0],be=N.length,Ee=[],Pe=0;for(JXG$1.isString(v)&&(v=predefinedButcher[v]||predefinedButcher.euler),ae=v.s,ce=N.slice(),W=0;W<=z;W++){for(Ee[Pe]=ce.slice(),Pe++,ne=[],ie=0;ie<ae;ie++){for(Y=0;Y<be;Y++)pe[Y]=0;for(se=0;se<ie;se++)for(Y=0;Y<be;Y++)pe[Y]+=v.A[ie][se]*ge*ne[se][Y];for(Y=0;Y<be;Y++)pe[Y]+=ce[Y];ne.push(q(ve+v.c[ie]*ge,pe))}for(Y=0;Y<be;Y++)pe[Y]=0;for(se=0;se<ae;se++)for(Y=0;Y<be;Y++)pe[Y]+=v.b[se]*ne[se][Y];for(Y=0;Y<be;Y++)ce[Y]=ce[Y]+ge*pe[Y];ve+=ge}return Ee},maxIterationsRoot:80,maxIterationsMinimize:500,findBracket:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe;if(JXG$1.isArray(N))return N;for(z=N,Y=v.call(G,z),q=z===0?1:z,W=[z-.1*q,z+.1*q,z-1,z+1,z-.5*q,z+.5*q,z-.6*q,z+.6*q,z-1*q,z+1*q,z-2*q,z+2*q,z-5*q,z+5*q,z-10*q,z+10*q,z-50*q,z+50*q,z-100*q,z+100*q],pe=W.length,ce=0;ce<pe&&(ie=W[ce],ne=v.call(G,ie),!(Y*ne<=0));ce++);
46return ie<z&&(se=z,z=ie,ie=se,ae=Y,Y=ne,ne=ae),[z,Y,ie,ne]},fzero:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce=Mat.eps,Ve=this.maxIterationsRoot,Re=0;if(JXG$1.isArray(N)){if(N.length<2)throw new Error("JXG.Math.Numerics.fzero: length of array x0 has to be at least two.");ae=this.findDomain(v,N,G),z=ae[0],q=ae[1],W=v.call(G,z),ie=v.call(G,q)}else se=this.findBracket(v,N,G),z=se[0],W=se[1],q=se[2],ie=se[3];if(Math.abs(W)<=Ce)return z;if(Math.abs(ie)<=Ce)return q;if(W*ie>0)return JXG$1.isArray(N)?this.fminbr(v,[z,q],G):this.Newton(v,z,G);for(Y=z,ne=W;Re<Ve;){if(ce=q-z,Math.abs(ne)<Math.abs(ie)&&(z=q,q=Y,Y=z,W=ie,ie=ne,ne=W),be=2*Ce*Math.abs(q)+Ce*.5,Je=(Y-q)*.5,Math.abs(Je)<=be||Math.abs(ie)<=Ce)return q;Math.abs(ce)>=be&&Math.abs(W)>Math.abs(ie)&&(ve=Y-q,z===Y?(pe=ie/W,Ee=ve*pe,Pe=1-pe):(Pe=W/ne,pe=ie/ne,ge=ie/W,Ee=ge*(ve*Pe*(Pe-pe)-(q-z)*(pe-1)),Pe=(Pe-1)*(pe-1)*(ge-1)),Ee>0?Pe=-Pe:Ee=-Ee,Ee<.75*ve*Pe-Math.abs(be*Pe)*.5&&Ee<Math.abs(ce*Pe*.5)&&(Je=Ee/Pe)),Math.abs(Je)<be&&(Je=Je>0?be:-be),z=q,W=ie,q+=Je,ie=v.call(G,q),(ie>0&&ne>0||ie<0&&ne<0)&&(Y=z,ne=W),Re++}return q},chandrupatla:function(v,N,G){var z,q,Y,W,ie,ne=0,se=this.maxIterationsRoot,ae=1+Math.random()*.001,ce=.5*ae,pe=Mat.eps,ge=1e-5,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut,ct,at,st,pt;if(JXG$1.isArray(N)){if(N.length<2)throw new Error("JXG.Math.Numerics.fzero: length of array x0 has to be at least two.");z=N[0],Y=v.call(G,z),q=N[1],W=v.call(G,q)}else ie=this.findBracket(v,N,G),z=ie[0],Y=ie[1],q=ie[2],W=ie[3];
46if(Y*W>0)return JXG$1.isArray(N)?this.fminbr(v,[z,q],G):this.Newton(v,z,G);ve=z,be=q,Je=Y,Ce=W;do{if(Pe=ve+ce*(be-ve),Re=v.call(G,Pe),Math.sign(Re)===Math.sign(Je)?(Ee=ve,ve=Pe,Ve=Je,Je=Re):(Ee=be,be=ve,Ve=Ce,Ce=Je),ve=Pe,Je=Re,qe=ve,et=Je,Math.abs(Ce)<Math.abs(Je)&&(qe=be,et=Ce),Ze=2*pe*Math.abs(qe)+.5*ge,tt=Ze/Math.abs(be-ve),tt>.5||et===0)break;Ke=(ve-be)/(Ee-be),rt=(Je-Ce)/(Ve-Ce),it=1-Math.sqrt(1-Ke),ot=Math.sqrt(Ke),it<rt&&rt<ot?(ut=(Ee-ve)/(be-ve),ct=Je/(Ce-Je),at=Ve/(Ce-Ve),st=Je/(Ve-Je),pt=Ce/(Ve-Ce),ce=ct*at+st*pt*ut):ce=.5*ae,ce<tt&&(ce=tt),ce>1-tt&&(ce=1-tt),ne++}while(ne<=se);return qe},findDomain:function(v,N,G){var z,q,Y,W,ie,ne=.3819660112501453,se=.001,ae,ce=20;if(!JXG$1.isArray(N)||N.length<2)throw new Error("JXG.Math.Numerics.findDomain: length of array x0 has to be at least two.");if(ie=N.slice(),z=ie[0],q=ie[1],W=v.call(G,z),isNaN(W)){for(ae=0;q-z>se&&ae<ce;)Y=(q-z)*ne+z,W=v.call(G,Y),isNaN(W)?z=Y:q=Y,ae++;ie[0]=z}if(z=ie[0],q=ie[1],W=v.call(G,q),isNaN(W)){for(ae=0;q-z>se&&ae<ce;)Y=q-(q-z)*ne,W=v.call(G,Y),isNaN(W)?q=Y:z=Y,ae++;ie[0]=q}return ie},fminbr:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve=(3-Math.sqrt(5))*.5,Re=Mat.eps,qe=Mat.eps,et=this.maxIterationsMinimize,Ze=0;if(!JXG$1.isArray(N)||N.length<2)throw new Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.");for(ce=this.findDomain(v,N,G),z=ce[0],q=ce[1],W=z+Ve*(q-z),se=v.call(G,W),Y=W,ie=W,ne=se,ae=se;Ze<et;){if(pe=q-z,ge=(z+q)*.5,ve=qe*Math.abs(Y)+Re/3,Math.abs(Y-ge)+pe*.5<=2*ve)return Y;be=Ve*(Y<ge?q-Y:z-Y),Math.abs(Y-ie)>=ve&&(Je=(Y-ie)*(ne-se),Pe=(Y-W)*(ne-ae),Ee=(Y-W)*Pe-(Y-ie)*Je,Pe=2*(Pe-Je),Pe>0?Ee=-Ee:Pe=-Pe,Math.abs(Ee)<Math.abs(be*Pe)&&Ee>Pe*(z-Y+2*ve)&&Ee<Pe*(q-Y-2*ve)&&(be=Ee/Pe)),Math.abs(be)<ve&&(be>0?be=ve:be=-ve),Je=Y+be,Ce=v.call(G,Je),Ce<=ne?(Je<Y?q=Y:z=Y,W=ie,ie=Y,Y=Je,se=ae,ae=ne,ne=Ce):(Je<Y?z=Je:q=Je,Ce<=ae||ie===Y?(W=ie,ie=Je,se=ae,ae=Ce):(Ce<=se||W===Y||W===ie)&&(W=Je,se=Ce)),Ze+=1}return Y},glomin:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut=1e7,ct=Mat.eps,at=Mat.eps*Mat.eps,st=Mat.eps*Mat.eps*Mat.eps;if(Ke=N[0],rt=N[1],it=v(Ke)<v(rt)?Ke:rt,G=rt,ot=G,z=Ke,Je=v(rt),qe=Je,Ve=v(Ke),Pe=Ve,Je<Pe?Pe=Je:ot=Ke,rt<=Ke)return Pe;for(ae=.5*(1+16*st)*ut,it<=Ke||rt<=it?Ee=.5*(Ke+rt):Ee=it,Ce=v(Ee),se=3,Y=z-Ee,ne=9/11,Ce<Pe&&(ot=Ee,Pe=Ce);;){if(W=z-G,ie=Ee-G,tt=rt-z,et=Ve-Ce,Ze=Ve-Je,ve=W*W*et-Y*Y*Ze,ce=ve,ge=2*(Y*Ze-W*et),pe=ge,se<1e6||Ve<=Pe)for(;pe*(ve*(qe-Ve)+tt*pe*(Ve-Pe+ct))<tt*ae*ve*(tt*pe-ve)&&(q=z+ve/pe,Re=v(q),Re<Pe&&(ot=q,Pe=Re)),se=1611*se%1048576,pe=1,ve=(rt-Ke)*1e-5*se,!(tt<=ve););else for(se=1611*se%1048576,pe=1,ve=(rt-Ke)*1e-5*se;ve<tt;)pe*(ve*(qe-Ve)+tt*pe*(Ve-Pe+ct))<tt*ae*ve*(tt*pe-ve)&&(q=z+ve/pe,Re=v(q),Re<Pe&&(ot=q,Pe=Re)),se=1611*se%1048576,pe=1,ve=(rt-Ke)*1e-5*se;for(ve=ae*Y*W*ie,be=Math.sqrt((Ve-Pe+ct)/ae),ne=.5*(1+ne),ce=ne*(ce+2*ve*be),pe=pe+.5*ge,ve=-.5*(Y+(et+2.01*at)/(Y*ae)),ve<be||Y<0?ve=z+be:ve=z+ve,0<ce*pe?q=z+ce/pe:q=ve;q=Math.max(q,ve),rt<=q?(q=rt,Re=qe):Re=v(q),Re<Pe&&(ot=q,Pe=Re),Y=q-z,!(q<=ve||(ce=2*(Ve-Re)/(ut*Y),(1+9*st)*Y<=Math.abs(ce))||.5*ae*(Y*Y+ce*ce)<=Ve-Pe+(Re-Pe)+2*ct);)q=.5*(z+q),ne=.9*ne;if(rt<=q)break;G=Ee,Ee=z,z=q,Je=Ce,Ce=Ve,Ve=Re}return[ot,Pe]},polzeros:function(v,N,G,z,q){var Y,W,ie,ne=[],se=[],ae=[],ce=function(Ee,Pe,Je){var Ce,Ve,Re=Ee.length-1;if(Je=Je||!1,Je)for(Ve=JXG$1.C.mult(Re,Ee[Re]),Ce=Re-1;Ce>0;Ce--)Ve.mult(Pe),Ve.add(JXG$1.C.mult(Ee[Ce],Ce));else for(Ve=JXG$1.C.copy(Ee[Re]),Ce=Re-1;Ce>=0;Ce--)Ve.mult(Pe),Ve.add(Ee[Ce]);return Ve},pe=function(Ee,Pe,Je){var Ce,Ve,Re=Ee.length-1;if(Je=Je||!1,Je)for(Ve=JXG$1.C.mult(Re,Ee[0]),Ce=Re-1;Ce>0;Ce--)Ve.mult(Pe),Ve.add(JXG$1.C.mult(Ee[Re-Ce],Ce));else for(Ve=JXG$1.C.copy(Ee[0]),Ce=Re-1;Ce>=0;Ce--)Ve.mult(Pe),Ve.add(Ee[Re-Ce]);return Ve},ge=function(Ee,Pe){var Je,Ce,Ve=Ee.length-1;for(Ce=Ee[Ve],Je=Ve-1;Je>=0;Je--)Ce=Ce*Pe+Ee[Je];return Ce},ve=function(Ee){var Pe,Je,Ce=Ee.length-1,Ve=Math.PI*2/Ce,Re=Math.PI/Ce*.5,qe,et,Ze=[];for(qe=JXG$1.C.mult(-1,Ee[Ce-1]),qe.div(JXG$1.C.mult(Ce,Ee[Ce])),et=JXG$1.C.div(ce(Ee,qe),Ee[Ce]),Je=Math.pow(JXG$1.C.abs(et),1/Ce),Je===0&&(Je=1),Pe=0;Pe<Ce;Pe++)Ee=new JXG$1.Complex(Je*Math.cos(Ve*Pe+Re),Je*Math.sin(Ve*Pe+Re)),Ze[Pe]=JXG$1.C.add(qe,Ee);return Ze},be=function(Ee,Pe,Je,Ce){var Ve,Re,qe,et=[],Ze=[],tt,Ke,rt=0,it,ot,ut,ct,at=Ce.length;for(Re=0;Re<at;Re++)et.push(!1);for(Re=0;Re<Ee.length;Re++)Ze.push(JXG$1.C.abs(Ee[Re])*(4*Re+1));
46for(Ve=0;Ve<Je&&rt<at;Ve++)for(Re=0;Re<at;Re++)if(!et[Re]){if(it=ce(Ee,Ce[Re]),Ke=JXG$1.C.abs(Ce[Re]),JXG$1.C.abs(it)<Pe*ge(Ze,Ke)){if(et[Re]=!0,rt++,rt===at)break;continue}for(Ke>1?(tt=JXG$1.C.div(1,Ce[Re]),ct=pe(Ee,tt,!0),ct.div(pe(Ee,tt)),ct.mult(tt),it=JXG$1.C.sub(at,ct),it=JXG$1.C.div(Ce[Re],it)):it.div(ce(Ee,Ce[Re],!0)),ot=new JXG$1.Complex(0),qe=0;qe<at;qe++)qe!==Re&&(ut=JXG$1.C.sub(Ce[Re],Ce[qe]),ut=JXG$1.C.div(1,ut),ot.add(ut));ot.mult(it),ot=JXG$1.C.sub(1,ot),it.div(ot),Ce[Re].sub(it)}return Ve};for(G=G||Number.EPSILON,z=z||30,W=v.length,JXG$1.isNumber(N)&&N>=0&&N<W-1&&(W=N+1),Y=0;Y<W;Y++)ne.push(new JXG$1.Complex(v[Y]));for(Y=0;Y<W;Y++)if(ne[Y].real!==0||ne[Y].imaginary!==0){ie=Y;break}for(Y=0;Y<ie;Y++)se.push(new JXG$1.Complex(0));for(ne=ne.slice(ie),W=ne.length,Y=W-1;Y>=0&&!(ne[Y].real!==0||ne[Y].imaginary!==0);Y--)ne.pop();if(W=ne.length,W===0)return[];if(q)for(Y=0;Y<W-1;Y++)ae.push(new JXG$1.Complex(q[Y]));else ae=ve(ne);return be(ne,G,z,ae),ae=se.concat(ae),ae.sort(function(Ee,Pe){return Ee.real<Pe.real?-1:Ee.real>Pe.real?1:0}),ae},RamerDouglasPeucker:function(v,N){var G=[],z=[],q,Y,W,ie=!0,ne=function(ae,ce,pe){var ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze=Mat.eps*Mat.eps,tt=1e4,Ke=0,rt=ce;if(pe-ce<2)return[-1,0];if(be=ae[ce].scrCoords,Ee=ae[pe].scrCoords,isNaN(be[1])||isNaN(be[2]))return[NaN,ce];if(isNaN(Ee[1])||isNaN(Ee[2]))return[NaN,pe];for(ve=ce+1;ve<pe;ve++){if(Pe=ae[ve].scrCoords,isNaN(Pe[1])||isNaN(Pe[2]))return[NaN,ve];Je=Pe[1]-be[1],Ce=Pe[2]-be[2],Ve=Ee[1]-be[1],Re=Ee[2]-be[2],Je=Je===1/0?tt:Je,Ce=Ce===1/0?tt:Ce,Ve=Ve===1/0?tt:Ve,Re=Re===1/0?tt:Re,Je=Je===-1/0?-1e4:Je,Ce=Ce===-1/0?-1e4:Ce,Ve=Ve===-1/0?-1e4:Ve,Re=Re===-1/0?-1e4:Re,qe=Ve*Ve+Re*Re,qe>Ze?(et=(Je*Ve+Ce*Re)/qe,et<0?et=0:et>1&&(et=1),Je=Je-et*Ve,Ce=Ce-et*Re,ge=Je*Je+Ce*Ce):(et=0,ge=Je*Je+Ce*Ce),ge>Ke&&(Ke=ge,rt=ve)}return[Math.sqrt(Ke),rt]},se=function(ae,ce,pe,ge,ve){var be=ne(ae,ce,pe),Ee=be[1];if(isNaN(be[0])){se(ae,ce,Ee-1,ge,ve),ve.push(ae[Ee]);do++Ee;while(Ee<=pe&&isNaN(ae[Ee].scrCoords[1]+ae[Ee].scrCoords[2]));Ee<=pe&&ve.push(ae[Ee]),se(ae,Ee+1,pe,ge,ve)}else be[0]>ge?(se(ae,ce,Ee,ge,ve),se(ae,Ee,pe,ge,ve)):ve.push(ae[pe])};for(W=v.length,q=0;ie;){for(;q<W&&isNaN(v[q].scrCoords[1]+v[q].scrCoords[2]);)q+=1;for(Y=q+1;Y<W&&!isNaN(v[Y].scrCoords[1]+v[Y].scrCoords[2]);)Y+=1;if(Y--,q<W&&Y>q&&(z=[],z[0]=v[q],se(v,q,Y,N,z),G=G.concat(z)),q>=W)break;Y<W-1&&G.push(v[Y+1]),q=Y+1}return G},RamerDouglasPeuker:function(v,N){return JXG$1.deprecated("Numerics.RamerDouglasPeuker()","Numerics.RamerDouglasPeucker()"),this.RamerDouglasPeucker(v,N)},Visvalingam:function(v,N){var G,z,q,Y,W=[],ie=[],ne=[],se,ae,ce,pe,ge;if(z=v.length,z<=2)return v;for(W[0]={used:!0,lft:null,node:null},se=0,G=1;G<z-1;G++)q=Math.abs(JXG$1.Math.Numerics.det([v[G-1].usrCoords,v[G].usrCoords,v[G+1].usrCoords])),isNaN(q)||(ge={v:q,idx:G},ie.push(ge),W[G]={used:!0,lft:se,node:ge},W[se].rt=G,se=G);for(W[z-1]={used:!0,rt:null,lft:se,node:null},W[se].rt=z-1,Y=-1/0;ie.length>N;)ie.sort(function(ve,be){return be.v-ve.v}),G=ie.pop().idx,W[G].used=!1,Y=W[G].node.v,se=W[G].lft,ae=W[G].rt,W[se].rt=ae,W[ae].lft=se,ce=W[se].lft,ce!==null&&(q=Math.abs(JXG$1.Math.Numerics.det([v[ce].usrCoords,v[se].usrCoords,v[ae].usrCoords])),W[se].node.v=q>=Y?q:Y),pe=W[ae].rt,pe!==null&&(q=Math.abs(JXG$1.Math.Numerics.det([v[se].usrCoords,v[ae].usrCoords,v[pe].usrCoords])),W[ae].node.v=q>=Y?q:Y);G=0,ne=[v[G]];do G=W[G].rt,ne.push(v[G]);while(W[G].rt!==null);return ne}};const Numerics=Mat.Numerics;Mat.Geometry={};JXG$1.extend(Mat.Geometry,{angle:function(v,N,G){var z,q,Y,W,ie=[],ne=[],se=[];return JXG$1.deprecated("Geometry.angle()","Geometry.rad()"),v.coords?(ie[0]=v.coords.usrCoords[1],ie[1]=v.coords.usrCoords[2]):(ie[0]=v[0],ie[1]=v[1]),N.coords?(ne[0]=N.coords.usrCoords[1],ne[1]=N.coords.usrCoords[2]):(ne[0]=N[0],ne[1]=N[1]),G.coords?(se[0]=G.coords.usrCoords[1],se[1]=G.coords.usrCoords[2]):(se[0]=G[0],se[1]=G[1]),z=ie[0]-ne[0],q=ie[1]-ne[1],Y=se[0]-ne[0],W=se[1]-ne[1],Math.atan2(z*W-q*Y,z*Y+q*W)},trueAngle:function(v,N,G){return this.rad(v,N,G)*57.29577951308232},rad:function(v,N,G){var z,q,Y,W,ie,ne,se;return v.coords?(z=v.coords.usrCoords[1],q=v.coords.usrCoords[2]):(z=v[0],q=v[1]),N.coords?(Y=N.coords.usrCoords[1],W=N.coords.usrCoords[2]):(Y=N[0],W=N[1]),G.coords?(ie=G.coords.usrCoords[1],ne=G.coords.usrCoords[2]):(ie=G[0],ne=G[1]),se=Math.atan2(ne-W,ie-Y)-Math.atan2(q-W,z-Y),se<0&&(se+=6.283185307179586),se},angleBisector:function(v,N,G,z){var q,Y,W,ie=v.coords.usrCoords,ne=N.coords.usrCoords,se=G.coords.usrCoords,ae,ce;return JXG$1.exists(z)||(z=v.board),ne[0]===0?new Coords(Const.COORDS_BY_USER,[1,(ie[1]+se[1])*.5,
46(ie[2]+se[2])*.5],z):(ae=ie[1]-ne[1],ce=ie[2]-ne[2],q=Math.atan2(ce,ae),ae=se[1]-ne[1],ce=se[2]-ne[2],Y=Math.atan2(ce,ae),W=(q+Y)*.5,q>Y&&(W+=Math.PI),ae=Math.cos(W)+ne[1],ce=Math.sin(W)+ne[2],new Coords(Const.COORDS_BY_USER,[1,ae,ce],z))},reflection:function(v,N,G){var z,q,Y,W,ie,ne,se,ae=N.coords.usrCoords,ce=v.point1.coords.usrCoords,pe=v.point2.coords.usrCoords;return JXG$1.exists(G)||(G=N.board),ie=pe[1]-ce[1],ne=pe[2]-ce[2],z=ae[1]-ce[1],q=ae[2]-ce[2],se=(ie*q-ne*z)/(ie*ie+ne*ne),Y=ae[1]+2*se*ne,W=ae[2]-2*se*ie,new Coords(Const.COORDS_BY_USER,[Y,W],G)},rotation:function(v,N,G,z){var q,Y,W,ie,ne,se,ae=N.coords.usrCoords,ce=v.coords.usrCoords;return JXG$1.exists(z)||(z=N.board),q=ae[1]-ce[1],Y=ae[2]-ce[2],W=Math.cos(G),ie=Math.sin(G),ne=q*W-Y*ie+ce[1],se=q*ie+Y*W+ce[2],new Coords(Const.COORDS_BY_USER,[ne,se],z)},perpendicular:function(v,N,G){var z,q,Y,W,ie,ne=v.point1.coords.usrCoords,se=v.point2.coords.usrCoords,ae=N.coords.usrCoords;return JXG$1.exists(G)||(G=N.board),N===v.point1?(z=ne[1]+se[2]-ne[2],q=ne[2]-se[1]+ne[1],ie=ne[0]*se[0],Math.abs(ie)<Mat.eps&&(z=se[2],q=-se[1]),W=[ie,z,q],Y=!0):N===v.point2?(z=se[1]+ne[2]-se[2],q=se[2]-ne[1]+se[1],ie=ne[0]*se[0],Math.abs(ie)<Mat.eps&&(z=ne[2],q=-ne[1]),W=[ie,z,q],Y=!1):Math.abs(Mat.innerProduct(ae,v.stdform,3))<Mat.eps?(z=ae[1]+se[2]-ae[2],q=ae[2]-se[1]+ae[1],ie=se[0],Math.abs(ie)<Mat.eps&&(z=se[2],q=-se[1]),Y=!0,Math.abs(ie)>Mat.eps&&Math.abs(z-ae[1])<Mat.eps&&Math.abs(q-ae[2])<Mat.eps&&(z=ae[1]+ne[2]-ae[2],q=ae[2]-ne[1]+ae[1],Y=!1),W=[ie,z,q]):(W=[0,v.stdform[1],v.stdform[2]],W=Mat.crossProduct(W,ae),W=Mat.crossProduct(W,v.stdform),Y=!0),[new Coords(Const.COORDS_BY_USER,W,G),Y]},circumcenterMidpoint:function(){JXG$1.deprecated("Geometry.circumcenterMidpoint()","Geometry.circumcenter()"),this.circumcenter.apply(this,arguments)},circumcenter:function(v,N,G,z){var q,Y,W,ie,ne=v.coords.usrCoords,se=N.coords.usrCoords,ae=G.coords.usrCoords;return JXG$1.exists(z)||(z=v.board),q=[se[0]-ne[0],-se[2]+ne[2],se[1]-ne[1]],Y=[(ne[0]+se[0])*.5,(ne[1]+se[1])*.5,(ne[2]+se[2])*.5],W=Mat.crossProduct(q,Y),q=[ae[0]-se[0],-ae[2]+se[2],ae[1]-se[1]],Y=[(se[0]+ae[0])*.5,(se[1]+ae[1])*.5,(se[2]+ae[2])*.5],ie=Mat.crossProduct(q,Y),new Coords(Const.COORDS_BY_USER,Mat.crossProduct(W,ie),z)},distance:function(v,N,G){var z,q=0;for(G||(G=Math.min(v.length,N.length)),z=0;z<G;z++)q+=(v[z]-N[z])*(v[z]-N[z]);return Math.sqrt(q)},affineDistance:function(v,N,G){var z;return z=this.distance(v,N,G),z>Mat.eps&&(Math.abs(v[0])<Mat.eps||Math.abs(N[0])<Mat.eps)?1/0:z},affineRatio:function(v,N,G){var z=0,q;return JXG$1.exists(v.usrCoords)&&(v=v.usrCoords),JXG$1.exists(N.usrCoords)&&(N=N.usrCoords),JXG$1.exists(G.usrCoords)&&(G=G.usrCoords),q=N[1]-v[1],Math.abs(q)>Mat.eps?z=(G[1]-v[1])/q:z=(G[2]-v[2])/(N[2]-v[2]),z},sortVertices:function(v){for(var N,G=Expect.each(v,Expect.coordsArray),z=G.length,q=null;G[0][0]===G[z-1][0]&&G[0][1]===G[z-1][1]&&G[0][2]===G[z-1][2];)q=G.pop(),z--;return N=G[0],G.sort(function(Y,W){var ie=Y[2]===N[2]&&Y[1]===N[1]?-1/0:Math.atan2(Y[2]-N[2],Y[1]-N[1]),ne=W[2]===N[2]&&W[1]===N[1]?-1/0:Math.atan2(W[2]-N[2],W[1]-N[1]);return ie-ne}),q!==null&&G.push(q),G},signedTriangle:function(v,N,G){var z=Expect.coordsArray(v),q=Expect.coordsArray(N),Y=Expect.coordsArray(G);return .5*((q[1]-z[1])*(Y[2]-z[2])-(q[2]-z[2])*(Y[1]-z[1]))},signedPolygon:function(v,N){var G,z,q=0,Y=Expect.each(v,Expect.coordsArray);for(N===void 0&&(N=!0),N?Y.unshift(Y[Y.length-1]):Y=this.sortVertices(Y),z=Y.length,G=1;G<z;G++)q+=Y[G-1][1]*Y[G][2]-Y[G][1]*Y[G-1][2];return .5*q},GrahamScan:function(v){var N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et=Mat.eps*Mat.eps,Ze=this,tt=[],Ke=[],rt=Expect.each(v,Expect.coordsArray),it,ot=1024;if(it=rt.length,it===0)return[];if(it>ot)for(Y=rt[0][1],ie=Y,W=rt[0][2],ne=W,ae=rt[0][1]-rt[0][2],pe=ae,se=rt[0][1]+rt[0][2],ce=se,ge=0,ve=0,be=0,Ee=0,Je=0,Ve=0,Pe=0,Ce=0,N=1;N<it;N++)Re=rt[N][1],Re<Y?(Y=Re,ge=N):Re>ie&&(ie=Re,ve=N),Re=rt[N][2],Re<W?(W=Re,be=N):Re>ne&&(ne=Re,Ee=N),Re=rt[N][1]-rt[N][2],Re<ae?(ae=Re,Je=N):Re>pe&&(pe=Re,Ve=N),Re=rt[N][1]+rt[N][2],Re<se?(se=Re,Pe=N):Re>ce&&(ce=Re,Ce=N);for(N=0;N<it;N++)qe=rt[N],(it<=ot||N in[ge,ve,be,Ee,Pe,Je,Ce,Ve]||ge!==Je&&this.signedTriangle(rt[ge],rt[Je],qe)>=-et||Je!==Ee&&this.signedTriangle(rt[Je],rt[Ee],qe)>=-et||Ee!==Ce&&this.signedTriangle(rt[Ee],rt[Ce],qe)>=-et||Ce!==ve&&this.signedTriangle(rt[Ce],rt[ve],qe)>=-et||ve!==Ve&&this.signedTriangle(rt[ve],rt[Ve],qe)>=-et||Ve!==be&&this.signedTriangle(rt[Ve],rt[be],qe)>=-et||be!==Pe&&this.signedTriangle(rt[be],rt[Pe],qe)>=-et||Pe!==ge&&this.signedTriangle(rt[Pe],rt[ge],qe)>=-et)&&tt.push({i:N,c:qe});for(it=tt.length,q=0,Y=tt[0].c[1],W=tt[0].c[2],N=1;N<it;N++)(tt[N].c[2]<W||tt[N].c[2]===W&&tt[N].c[1]<Y)&&(Y=tt[N].c[1],W=tt[N].c[2],q=N);for(tt=JXG$1.swap(tt,q,0),z=tt[0].c,tt.sort(function(ut,ct){var at=ut.c,st=ct.c,pt=Ze.signedTriangle(z,at,st);return pt===0?Mat.hypot(at[1]-z[1],at[2]-z[2])-Mat.hypot(st[1]-z[1],st[2]-z[2]):-pt}),G=0,N=0;N<it;N++){for(;G>1&&this.signedTriangle(Ke[G-2].c,Ke[G-1].c,tt[N].c)<=0;)Ke.pop(),G--;Ke.push(tt[N]),G++}return Ke},convexHull:function(v,N){var G,z,q=[];for(z=this.GrahamScan(v),G=0;G<z.length;G++)N?q.push(z[G].c):q.push(v[z[G].i]);return q},isConvex:function(v){var N,G,z,q=Mat.eps*Mat.eps,Y,W,ie,ne,se,ae,ce,pe,ge=0;if(JXG$1.isArray(v)?N=Expect.each(v,Expect.coordsArray):JXG$1.exists(v.type)&&v.type===Const.OBJECT_TYPE_POLYGON&&(N=Expect.each(v.vertices,Expect.coordsArray)),G=N.length,G===0||G<3)return!0;for(pe=null,Y=N[G-2][1],W=N[G-2][2],ne=N[G-1][1],se=N[G-1][2],ae=Math.atan2(se-W,ne-Y),z=0;z<G;z++)if(Y=ne,W=se,ie=ae,ne=N[z][1],se=N[z][2],!(Y===ne&&W===se)){if(ae=Math.atan2(se-W,ne-Y),ce=ae-ie,ce<=-Math.PI?ce+=2*Math.PI:ce>Math.PI&&(ce-=2*Math.PI),pe===null){if(ce===0)continue;pe=ce>0?1:-1}else if(pe*ce<-q)return!1;ge+=ce}return Math.abs(ge/(2*Math.PI))-1<q},calcStraight:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge;JXG$1.exists(z)||(z=10),se=v.evalVisProp("straightfirst"),ae=v.evalVisProp("straightlast"),Math.abs(N.scrCoords[0])<Mat.eps&&(se=!0),Math.abs(G.scrCoords[0])<Mat.eps&&(ae=!0),!(!se&&!ae)&&(ce=[],ce[0]=v.stdform[0]-v.stdform[1]*v.board.origin.scrCoords[1]/v.board.unitX+v.stdform[2]*v.board.origin.scrCoords[2]/v.board.unitY,ce[1]=v.stdform[1]/v.board.unitX,ce[2]=-v.stdform[2]/v.board.unitY,!isNaN(ce[0]+ce[1]+ce[2])&&(q=!1,Y=!1,q=!se&&Math.abs(N.usrCoords[0])>=Mat.eps&&N.scrCoords[1]>=0&&N.scrCoords[1]<=v.board.canvasWidth&&N.scrCoords[2]>=0&&N.scrCoords[2]<=v.board.canvasHeight,Y=!ae&&Math.abs(G.usrCoords[0])>=Mat.eps&&G.scrCoords[1]>=0&&G.scrCoords[1]<=v.board.canvasWidth&&G.scrCoords[2]>=0&&G.scrCoords[2]<=v.board.canvasHeight,W=this.meetLineBoard(ce,v.board,z),ie=W[0],ne=W[1],!(!q&&!Y&&(!se&&ae&&!this.isSameDirection(N,G,ie)&&!this.isSameDirection(N,G,ne)||se&&!ae&&!this.isSameDirection(G,N,ie)&&!this.isSameDirection(G,N,ne)))&&(q?Y||(this.isSameDir(N,G,ie,ne)?ge=ne:ge=ie):Y?this.isSameDir(N,G,ie,ne)?pe=ie:pe=ne:this.isSameDir(N,G,ie,ne)?(pe=ie,ge=ne):(ge=ie,pe=ne),pe&&N.setCoordinates(Const.COORDS_BY_USER,pe.usrCoords),ge&&G.setCoordinates(Const.COORDS_BY_USER,ge.usrCoords))))},calcLineDelimitingPoints:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge=!1,ve=!1;ne=v.evalVisProp("straightfirst"),se=v.evalVisProp("straightlast"),Math.abs(N.scrCoords[0])<Mat.eps&&(ne=!0),Math.abs(G.scrCoords[0])<Mat.eps&&(se=!0),ae=[],ae[0]=v.stdform[0]-v.stdform[1]*v.board.origin.scrCoords[1]/v.board.unitX+v.stdform[2]*v.board.origin.scrCoords[2]/v.board.unitY,ae[1]=v.stdform[1]/v.board.unitX,ae[2]=-v.stdform[2]/v.board.unitY,!isNaN(ae[0]+ae[1]+ae[2])&&(ge=!ne,ve=!se,q=v.board.getBoundingBox(),Y=v.getSlope(),Y>=0?(W=this.projectPointToLine({coords:{usrCoords:[1,q[2],q[1]]}},v,v.board),ie=this.projectPointToLine({coords:{usrCoords:[1,q[0],q[3]]}},v,v.board)):(W=this.projectPointToLine({coords:{usrCoords:[1,q[0],q[1]]}},v,v.board),ie=this.projectPointToLine({coords:{usrCoords:[1,q[2],q[3]]}},v,v.board)),!(!ge&&!ve&&(!ne&&!se&&(z=N.distance(Const.COORDS_BY_USER,G),Math.abs(N.distance(Const.COORDS_BY_USER,W)+W.distance(Const.COORDS_BY_USER,G)-z)>Mat.eps||Math.abs(N.distance(Const.COORDS_BY_USER,ie)+ie.distance(Const.COORDS_BY_USER,G)-z)>Mat.eps)||!ne&&se&&!this.isSameDirection(N,G,W)&&!this.isSameDirection(N,G,ie)||ne&&!se&&!this.isSameDirection(G,N,W)&&!this.isSameDirection(G,N,ie)))&&(ge?ve||(this.isSameDir(N,G,W,ie)?pe=ie:pe=W):ve?this.isSameDir(N,G,W,ie)?ce=W:ce=ie:this.isSameDir(N,G,W,ie)?(ce=W,pe=ie):(pe=W,ce=ie),ce&&N.setCoordinates(Const.COORDS_BY_USER,ce.usrCoords),pe&&G.setCoordinates(Const.COORDS_BY_USER,pe.usrCoords)))},calcLabelQuadrant:function(v){var N;return v<0&&(v+=2*Math.PI),N=Math.floor((v+Math.PI/8)/(Math.PI/4))%8,["rt","urt","top","ulft","lft","llft","lrt"][N]},isSameDir:function(v,N,G,z){var q=N.usrCoords[1]-v.usrCoords[1],Y=N.usrCoords[2]-v.usrCoords[2],W=z.usrCoords[1]-G.usrCoords[1],ie=z.usrCoords[2]-G.usrCoords[2];return Math.abs(N.usrCoords[0])<Mat.eps&&(q=N.usrCoords[1],Y=N.usrCoords[2]),Math.abs(v.usrCoords[0])<Mat.eps&&(q=-v.usrCoords[1],Y=-v.usrCoords[2]),q*W+Y*ie>=0},isSameDirection:function(v,N,G){var z,q,Y,W,ie=!1;return z=N.usrCoords[1]-v.usrCoords[1],q=N.usrCoords[2]-v.usrCoords[2],Y=G.usrCoords[1]-v.usrCoords[1],W=G.usrCoords[2]-v.usrCoords[2],Math.abs(z)<Mat.eps&&(z=0),Math.abs(q)<Mat.eps&&(q=0),Math.abs(Y)<Mat.eps&&(Y=0),Math.abs(W)<Mat.eps&&(W=0),(z>=0&&Y>=0||z<=0&&Y<=0)&&(ie=q>=0&&W>=0||q<=0&&W<=0),ie},det3p:function(v,N,G){var z,q,Y;return JXG$1.isPoint(v)?z=v.Coords(!0):z=v,JXG$1.isPoint(N)?q=N.Coords(!0):q=N,JXG$1.isPoint(G)?Y=G.Coords(!0):Y=G,(z[1]-Y[1])*(q[2]-Y[2])-(q[1]-Y[1])*(z[2]-Y[2])},windingNumber:function(v,N,G){var z=0,q=N.length,Y=v[1],W=v[2],ie,ne,se,ae,ce,pe,ge=0;if(q===0)return 0;if(G=G||!1,G&&(ge=1),isNaN(Y)||isNaN(W)||(JXG$1.exists(N[0].coords)?(ie=N[0].coords,ne=N[q-1].coords):(ie=N[0],ne=N[q-1]),ie.usrCoords[1]===Y&&ie.usrCoords[2]===W))return 1;for(pe=0;pe<q-ge;pe++)if(JXG$1.exists(N[pe].coords)?(ne=N[pe].coords.usrCoords,se=N[(pe+1)%q].coords.usrCoords):(ne=N[pe].usrCoords,se=N[(pe+1)%q].usrCoords),!(ne[0]===0||se[0]===0||isNaN(ne[1])||isNaN(se[1])||isNaN(ne[2])||isNaN(se[2]))){if(se[2]===W){if(se[1]===Y)return 1;if(ne[2]===W&&se[1]>Y==ne[1]<Y)return 0}if(ne[2]<W!=se[2]<W)if(ce=2*(se[2]>ne[2]?1:0)-1,ne[1]>=Y)if(se[1]>Y)z+=ce;else{if(ae=this.det3p(ne,se,v),ae===0)return 0;ae>0+Mat.eps==se[2]>ne[2]&&(z+=ce)}else se[1]>Y&&(ae=this.det3p(ne,se,v),ae>0+Mat.eps==se[2]>ne[2]&&(z+=ce))}return z},pnpoly:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce,pe,ge=G,ve=!1;for(z===Const.COORDS_BY_USER?(pe=new Coords(Const.COORDS_BY_USER,[v,N],q),ae=pe.scrCoords[1],ce=pe.scrCoords[2]):(ae=v,ce=N),se=G.length,Y=0,W=se-2;Y<se-1;W=Y++)ie=JXG$1.exists(ge[Y].coords)?ge[Y].coords:ge[Y],ne=JXG$1.exists(ge[W].coords)?ge[W].coords:ge[W],ie.scrCoords[2]>ce!=ne.scrCoords[2]>ce&&ae<(ne.scrCoords[1]-ie.scrCoords[1])*(ce-ie.scrCoords[2])/(ne.scrCoords[2]-ie.scrCoords[2])+ie.scrCoords[1]&&(ve=!ve);return ve},intersectionFunction:function(v,N,G,z,q,Y){var W,ie=this,ne=!1,se=!1;return ne=N.elementClass===Const.OBJECT_CLASS_CURVE&&(N.type===Const.OBJECT_TYPE_ARC||N.type===Const.OBJECT_TYPE_SECTOR),se=G.elementClass===Const.OBJECT_CLASS_CURVE&&(G.type===Const.OBJECT_TYPE_ARC||G.type===Const.OBJECT_TYPE_SECTOR),(N.elementClass===Const.OBJECT_CLASS_CURVE||G.elementClass===Const.OBJECT_CLASS_CURVE)&&(N.elementClass===Const.OBJECT_CLASS_CURVE||N.elementClass===Const.OBJECT_CLASS_CIRCLE)&&(G.elementClass===Const.OBJECT_CLASS_CURVE||G.elementClass===Const.OBJECT_CLASS_CIRCLE)?W=function(){return ie.meetCurveCurve(N,G,z,q,N.board)}:N.elementClass===Const.OBJECT_CLASS_CURVE&&!ne&&G.elementClass===Const.OBJECT_CLASS_LINE||G.elementClass===Const.OBJECT_CLASS_CURVE&&!se&&N.elementClass===Const.OBJECT_CLASS_LINE?W=function(){return ie.meetCurveLine(N,G,z,N.board,JXG$1.evaluate(Y))}:N.type===Const.OBJECT_TYPE_POLYGON||G.type===Const.OBJECT_TYPE_POLYGON?N.elementClass===Const.OBJECT_CLASS_LINE?W=function(){var ae=N.evalVisProp("straightfirst"),ce=N.evalVisProp("straightlast"),pe=G.evalVisProp("straightfirst"),ge=G.evalVisProp("straightlast"),ve;return ve=!JXG$1.evaluate(Y)&&(!ae||!ce||!pe||!ge),ie.meetPolygonLine(G,N,z,N.board,ve)}:G.elementClass===Const.OBJECT_CLASS_LINE?W=function(){var ae=N.evalVisProp("straightfirst"),ce=N.evalVisProp("straightlast"),pe=G.evalVisProp("straightfirst"),ge=G.evalVisProp("straightlast"),ve;return ve=!JXG$1.evaluate(Y)&&(!ae||!ce||!pe||!ge),ie.meetPolygonLine(N,G,z,N.board,ve)}:W=function(){return ie.meetPathPath(N,G,z,N.board)}:N.elementClass===Const.OBJECT_CLASS_LINE&&G.elementClass===Const.OBJECT_CLASS_LINE?W=function(){var ae,ce,pe=N.evalVisProp("straightfirst"),ge=N.evalVisProp("straightlast"),ve=G.evalVisProp("straightfirst"),be=G.evalVisProp("straightlast");return!JXG$1.evaluate(Y)&&(!pe||!ge||!ve||!be)?(ae=ie.meetSegmentSegment(N.point1.coords.usrCoords,N.point2.coords.usrCoords,G.point1.coords.usrCoords,G.point2.coords.usrCoords),!pe&&ae[1]<0||!ge&&ae[1]>1||!ve&&ae[2]<0||!be&&ae[2]>1?ce=[0,NaN,NaN]:ce=ae[0],new Coords(Const.COORDS_BY_USER,ce,N.board)):ie.meet(N.stdform,G.stdform,z,N.board)}:W=function(){var ae=ie.meet(N.stdform,G.stdform,z,N.board),ce=!0,pe,ge,ve;return JXG$1.evaluate(Y)?ae:N.elementClass===Const.OBJECT_CLASS_LINE&&(pe=N.evalVisProp("straightfirst"),ge=N.evalVisProp("straightlast"),(!pe||!ge)&&(ve=ie.affineRatio(N.point1.coords,N.point2.coords,ae),!ge&&ve>1+Mat.eps||!pe&&ve<0-Mat.eps))?new Coords(JXG$1.COORDS_BY_USER,[0,NaN,NaN],N.board):G.elementClass===Const.OBJECT_CLASS_LINE&&(pe=G.evalVisProp("straightfirst"),ge=G.evalVisProp("straightlast"),(!pe||!ge)&&(ve=ie.affineRatio(G.point1.coords,G.point2.coords,ae),!ge&&ve>1+Mat.eps||!pe&&ve<0-Mat.eps))?new Coords(JXG$1.COORDS_BY_USER,[0,NaN,NaN],N.board):ne&&(ce=ie.coordsOnArc(N,ae),ce&&se&&(ce=ie.coordsOnArc(G,ae)),!ce)?new Coords(JXG$1.COORDS_BY_USER,[0,NaN,NaN],N.board):ae},W},otherIntersectionFunction:function(v,N,G,z){var q,Y,W,ie,ne=this;return W=v[0],ie=v[1],Y=W.board,q=function(){var se,ae,ce,pe,ge,ve=N.length,be=JXG$1.evaluate(z);for(se=ve;se>=0;se--){for(W.elementClass===Const.OBJECT_CLASS_CIRCLE&&[Const.OBJECT_CLASS_CIRCLE,Const.OBJECT_CLASS_LINE].indexOf(ie.elementClass)>=0?ce=ne.meet(W.stdform,ie.stdform,se,Y):W.elementClass===Const.OBJECT_CLASS_CURVE&&[Const.OBJECT_CLASS_CURVE,Const.OBJECT_CLASS_CIRCLE].indexOf(ie.elementClass)>=0?ce=ne.meetCurveCurve(W,ie,se,0,Y,"segment"):W.elementClass===Const.OBJECT_CLASS_CURVE&&ie.elementClass===Const.OBJECT_CLASS_LINE&&(JXG$1.exists(W.dataX)?ce=JXG$1.Math.Geometry.meetCurveLine(W,ie,se,W.board,JXG$1.evaluate(G)):ce=JXG$1.Math.Geometry.meetCurveLineContinuous(W,ie,se,W.board)),ge=!1,ae=0;!ge&&ae<ve;ae++)pe=ce.distance(JXG$1.COORDS_BY_USER,N[ae].coords),pe<be&&(ge=!0);if(!ge)return ce}return ce},q},coordsOnArc:function(v,N){var G=this.rad(v.radiuspoint,v.center,N.usrCoords.slice(1)),z=0,q=this.rad(v.radiuspoint,v.center,v.anglepoint),Y=v.evalVisProp("selection");return(Y==="minor"&&q>Math.PI||Y==="major"&&q<Math.PI)&&(z=q,q=2*Math.PI),!(G<z||G>q)},meet:function(v,N,G,z){var q,Y=Mat.eps;return Math.abs(v[3])<Y&&Math.abs(N[3])<Y?q=this.meetLineLine(v,N,G,z):Math.abs(v[3])>=Y&&Math.abs(N[3])<Y?q=this.meetLineCircle(N,v,G,z):Math.abs(v[3])<Y&&Math.abs(N[3])>=Y?q=this.meetLineCircle(v,N,G,z):q=this.meetCircleCircle(v,N,G,z),q},meetLineBoard:function(v,N,G){var z=[],q,Y,W,ie;for(JXG$1.exists(G)||(G=0),z[0]=Mat.crossProduct(v,[G,0,1]),z[1]=Mat.crossProduct(v,[G,1,0]),z[2]=Mat.crossProduct(v,[-G-N.canvasHeight,0,1]),z[3]=Mat.crossProduct(v,[-G-N.canvasWidth,1,0]),W=0;W<4;W++)if(Math.abs(z[W][0])>Mat.eps){for(ie=2;ie>0;ie--)z[W][ie]/=z[W][0];z[W][0]=1}return Math.abs(z[1][0])<Mat.eps?(q=z[0],Y=z[2]):Math.abs(z[0][0])<Mat.eps?(q=z[1],Y=z[3]):z[1][2]<0?(q=z[0],z[3][2]>N.canvasHeight?Y=z[2]:Y=z[3]):z[1][2]>N.canvasHeight?(q=z[2],z[3][2]<0?Y=z[0]:Y=z[3]):(q=z[1],z[3][2]<0?Y=z[0]:z[3][2]>N.canvasHeight?Y=z[2]:Y=z[3]),[new Coords(Const.COORDS_BY_SCREEN,q.slice(1),N),new Coords(Const.COORDS_BY_SCREEN,Y.slice(1),N)]},meetLineLine:function(v,N,G,z){var q=isNaN(v[5]+N[5])?[0,0,0]:Mat.crossProduct(v,N);return Math.abs(q[0])<1e-14&&(q[0]=0),new Coords(Const.COORDS_BY_USER,q,z)},meetLineCircle:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge;return N[4]<Mat.eps?Math.abs(Mat.innerProduct([1,N[6],N[7]],v,3))<Mat.eps?new Coords(Const.COORDS_BY_USER,N.slice(6,8),z):new Coords(Const.COORDS_BY_USER,[NaN,NaN],z):(W=N[0],Y=N.slice(1,3),q=N[3],ie=v[0],ne=v.slice(
461,3),se=q,ae=Y[0]*ne[1]-Y[1]*ne[0],ce=q*ie*ie-(Y[0]*ne[0]+Y[1]*ne[1])*ie+W,pe=ae*ae-4*se*ce,pe>-Mat.eps*Mat.eps?(pe=Math.sqrt(Math.abs(pe)),ge=[(-ae+pe)/(2*se),(-ae-pe)/(2*se)],JXG$1.evaluate(G)===0?new Coords(Const.COORDS_BY_USER,[-ge[0]*-ne[1]-ie*ne[0],-ge[0]*ne[0]-ie*ne[1]],z):new Coords(Const.COORDS_BY_USER,[-ge[1]*-ne[1]-ie*ne[0],-ge[1]*ne[0]-ie*ne[1]],z)):new Coords(Const.COORDS_BY_USER,[0,0,0],z))},meetCircleCircle:function(v,N,G,z){var q;return v[4]<Mat.eps?Math.abs(this.distance(v.slice(6,2),N.slice(6,8))-N[4])<Mat.eps?new Coords(Const.COORDS_BY_USER,v.slice(6,8),z):new Coords(Const.COORDS_BY_USER,[0,0,0],z):N[4]<Mat.eps?Math.abs(this.distance(N.slice(6,2),v.slice(6,8))-v[4])<Mat.eps?new Coords(Const.COORDS_BY_USER,N.slice(6,8),z):new Coords(Const.COORDS_BY_USER,[0,0,0],z):(q=[N[3]*v[0]-v[3]*N[0],N[3]*v[1]-v[3]*N[1],N[3]*v[2]-v[3]*N[2],0,1,1/0,1/0,1/0],q=Mat.normalize(q),this.meetLineCircle(q,v,G,z))},meetCurveCurve:function(v,N,G,z,q,Y){var W;return JXG$1.exists(Y)&&Y==="newton"?W=Numerics.generalizedNewton(v,N,JXG$1.evaluate(G),z):v.bezierDegree===3||N.bezierDegree===3?W=this.meetBezierCurveRedBlueSegments(v,N,G):W=this.meetCurveRedBlueSegments(v,N,G),new Coords(Const.COORDS_BY_USER,W,q)},meetCurveLine:function(v,N,G,z,q){var Y=[0,NaN,NaN],W,ie;return JXG$1.exists(z)||(z=v.board),v.elementClass===Const.OBJECT_CLASS_CURVE?(W=v,ie=N):(W=N,ie=v),Y=this.meetCurveLineDiscrete(W,ie,G,z,!q),Y},meetCurveLineContinuous:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce,pe=Mat.eps,ge=Mat.eps,ve,be,Ee,Pe,Je,Ce,Ve;for(ne=this.meetCurveLineDiscrete(v,N,G,z,q),se=ne.usrCoords[1],ae=ne.usrCoords[2],Y=function(Re){var qe,et;return Re>v.maxX()||Re<v.minX()?1/0:(qe=v.X(Re)-se,et=v.Y(Re)-ae,qe*qe+et*et)},W=function(Re){var qe=N.stdform[0]+N.stdform[1]*v.X(Re)+N.stdform[2]*v.Y(Re);return qe*qe},ve=50,be=(v.maxX()-v.minX())/ve,Ee=v.minX(),Je=1e-4,Pe=NaN,Ce=0;Ce<ve&&(ie=Numerics.root(Y,[Math.max(Ee,v.minX()),Math.min(Ee+be,v.maxX())]),Ve=Math.abs(Y(ie)),!(Ve<=Je&&(Je=Ve,Pe=ie,Je<pe)));Ce++)Ee+=be;return ie=Pe,ie=Numerics.root(W,[Math.max(ie-be,v.minX()),Math.min(ie+be,v.maxX())]),Ve=W(ie),isNaN(Ve)||Math.abs(Ve)>ge?ce=0:ce=1,new Coords(Const.COORDS_BY_USER,[ce,v.X(ie),v.Y(ie)],z)},meetCurveLineDiscrete:function(v,N,G,z,q){var Y,W,ie=JXG$1.evaluate(G),ne,se,ae,ce,pe=N.point1.coords.usrCoords,ge=N.point2.coords.usrCoords,ve,be,Ee=0,Pe=v.numberPoints,Je=N.evalVisProp("straightfirst"),Ce=N.evalVisProp("straightlast");for(ce=new Coords(Const.COORDS_BY_USER,[0,NaN,NaN],z),pe[0]===0?pe=[1,ge[1]+N.stdform[2],ge[2]-N.stdform[1]]:ge[0]===0&&(ge=[1,pe[1]+N.stdform[2],pe[2]-N.stdform[1]]),se=v.points[0].usrCoords,Y=1;Y<Pe;Y+=v.bezierDegree)if(ne=se.slice(0),se=v.points[Y].usrCoords,ve=this.distance(ne,se),ve>Mat.eps){for(v.bezierDegree===3?be=this.meetBeziersegmentBeziersegment([v.points[Y-1].usrCoords.slice(1),v.points[Y].usrCoords.slice(1),v.points[Y+1].usrCoords.slice(1),v.points[Y+2].usrCoords.slice(1)],[pe.slice(1),ge.slice(1)],q):be=[this.meetSegmentSegment(ne,se,pe,ge)],W=0;W<be.length;W++)if(ae=be[W],0<=ae[1]&&ae[1]<=1){if(Ee===ie)return q&&(!Je&&ae[2]<0||!Ce&&ae[2]>1)||(ce=new Coords(Const.COORDS_BY_USER,ae[0],z)),ce;Ee+=1}}return ce},meetCurveRedBlueSegments:function(v,N,G){var z,q,Y=JXG$1.evaluate(G),W,ie,ne,se,ae,ce,pe,ge=0,ve=N.numberPoints,be=v.numberPoints;if(ve<=1||be<=1)return[0,NaN,NaN];for(z=1;z<be;z++)for(W=v.points[z-1].usrCoords,ie=v.points[z].usrCoords,ce=Math.min(W[1],ie[1]),pe=Math.max(W[1],ie[1]),se=N.points[0].usrCoords,q=1;q<ve;q++)if(ne=se,se=N.points[q].usrCoords,Math.min(ne[1],se[1])<pe&&Math.max(ne[1],se[1])>ce&&(ae=this.meetSegmentSegment(W,ie,ne,se),ae[1]>=0&&ae[2]>=0&&(ae[1]<1&&ae[2]<1||z===be-1&&ae[1]===1||q===ve-1&&ae[2]===1))){if(ge===Y)return ae[0];ge++}return[0,NaN,NaN]},meetSegmentSegment:function(v,N,G,z){var q,Y,W,ie,ne=Mat.crossProduct(v,N),se=Mat.crossProduct(G,z),ae=Mat.crossProduct(ne,se);return Math.abs(ae[0])<Mat.eps?[ae,1/0,1/0]:(ae[1]/=ae[0],ae[2]/=ae[0],ae[0]/=ae[0],W=Math.abs(N[1]-N[0]*v[1])<Mat.eps?2:1,ie=v[W]/v[0],q=(ae[W]-ie)/(N[0]!==0?N[W]/N[0]-ie:N[W]),W=Math.abs(z[1]-z[0]*G[1])<Mat.eps?2:1,ie=G[W]/G[0],Y=(ae[W]-ie)/(z[0]!==0?z[W]/z[0]-ie:z[W]),[ae,q,Y])},meetPathPath:function(v,N,G,z){var q,Y,W,ie,ne=JXG$1.evaluate(G);return q=JXG$1.Math.Clip._getPath(v,z),W=q.length,W>0&&this.distance(q[0].coords.usrCoords,q[W-1].coords.usrCoords,3)<Mat.eps&&q.pop(),Y=JXG$1.Math.Clip._getPath(N,z),W=Y.length,W>0&&this.distance(Y[0].coords.usrCoords,Y[W-1].coords.usrCoords,3)<Mat.eps*Mat.eps&&Y.pop(),G<0||JXG$1.Math.Clip.isEmptyCase(q,Y,"intersection")?new Coords(Const.COORDS_BY_USER,[0,0,0],z):(JXG$1.Math.Clip.makeDoublyLinkedList(q),JXG$1.Math.Clip.makeDoublyLinkedList(Y),ie=JXG$1.Math.Clip.findIntersections(q,Y,z)[0],ne<ie.length?
46ie[ne].coords:new Coords(Const.COORDS_BY_USER,[0,0,0],z))},meetPolygonLine:function(v,N,G,z,q){var Y,W=JXG$1.evaluate(G),ie,ne,se=[0,0,0],ae=v.borders.length,ce=[];for(Y=0;Y<ae;Y++)ne=v.borders[Y],ie=this.meetSegmentSegment(ne.point1.coords.usrCoords,ne.point2.coords.usrCoords,N.point1.coords.usrCoords,N.point2.coords.usrCoords),(!q||ie[2]>=0&&ie[2]<1)&&ie[1]>=0&&ie[1]<1&&ce.push(ie[0]);return W>=0&&W<ce.length&&(se=ce[W]),new Coords(Const.COORDS_BY_USER,se,z)},_bezierSplit:function(v){var N,G,z,q,Y,W;return N=[(v[0][0]+v[1][0])*.5,(v[0][1]+v[1][1])*.5],G=[(v[1][0]+v[2][0])*.5,(v[1][1]+v[2][1])*.5],z=[(v[2][0]+v[3][0])*.5,(v[2][1]+v[3][1])*.5],q=[(N[0]+G[0])*.5,(N[1]+G[1])*.5],Y=[(G[0]+z[0])*.5,(G[1]+z[1])*.5],W=[(q[0]+Y[0])*.5,(q[1]+Y[1])*.5],[[v[0],N,q,W],[W,Y,z,v[3]]]},_bezierBbox:function(v){var N=[];return v.length===4?(N[0]=Math.min(v[0][0],v[1][0],v[2][0],v[3][0]),N[1]=Math.max(v[0][1],v[1][1],v[2][1],v[3][1]),N[2]=Math.max(v[0][0],v[1][0],v[2][0],v[3][0]),N[3]=Math.min(v[0][1],v[1][1],v[2][1],v[3][1])):(N[0]=Math.min(v[0][0],v[1][0]),N[1]=Math.max(v[0][1],v[1][1]),N[2]=Math.max(v[0][0],v[1][0]),N[3]=Math.min(v[0][1],v[1][1])),N},_bezierOverlap:function(v,N){return v[2]>=N[0]&&v[0]<=N[2]&&v[1]>=N[3]&&v[3]<=N[1]},_bezierListConcat:function(v,N,G,z){var q,Y=JXG$1.exists(z),W=0,ie=N.length,ne=v.length;for(ne>0&&ie>0&&(v[ne-1][1]===1&&N[0][1]===0||Y&&v[ne-1][2]===1&&N[0][2]===0)&&(W=1),q=W;q<ie;q++)Y&&(N[q][2]*=.5,N[q][2]+=z),N[q][1]*=.5,N[q][1]+=G,v.push(N[q])},_bezierMeetSubdivision:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be=[],Ee=5;return q=this._bezierBbox(N),z=this._bezierBbox(v),this._bezierOverlap(q,z)?G<Ee?(Y=this._bezierSplit(v),ne=Y[0],se=Y[1],Y=this._bezierSplit(N),W=Y[0],ie=Y[1],this._bezierListConcat(be,this._bezierMeetSubdivision(ne,W,G+1),0,0),this._bezierListConcat(be,this._bezierMeetSubdivision(ne,ie,G+1),0,.5),this._bezierListConcat(be,this._bezierMeetSubdivision(se,W,G+1),.5,0),this._bezierListConcat(be,this._bezierMeetSubdivision(se,ie,G+1),.5,.5),be):(ge=[1].concat(v[0]),ve=[1].concat(v[3]),ce=[1].concat(N[0]),pe=[1].concat(N[3]),ae=this.meetSegmentSegment(ge,ve,ce,pe),ae[1]>=0&&ae[2]>=0&&ae[1]<=1&&ae[2]<=1?[ae]:[]):[]},_bezierLineMeetSubdivision:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge,ve=[],be=5;return q=this._bezierBbox(N),Y=this._bezierBbox(v),z&&!this._bezierOverlap(Y,q)?[]:G<be?(W=this._bezierSplit(v),ie=W[0],ne=W[1],this._bezierListConcat(ve,this._bezierLineMeetSubdivision(ie,N,G+1),0),this._bezierListConcat(ve,this._bezierLineMeetSubdivision(ne,N,G+1),.5),ve):(pe=[1].concat(v[0]),ge=[1].concat(v[3]),ae=[1].concat(N[0]),ce=[1].concat(N[1]),se=this.meetSegmentSegment(pe,ge,ae,ce),se[1]>=0&&se[1]<=1&&(!z||se[2]>=0&&se[2]<=1)?[se]:[])},meetBeziersegmentBeziersegment:function(v,N,G){var z,q,Y;for(v.length===4&&N.length===4?z=this._bezierMeetSubdivision(v,N,0):z=this._bezierLineMeetSubdivision(v,N,0,G),z.sort(function(W,ie){return(W[1]-ie[1])*1e7+(W[2]-ie[2])}),q=[],Y=0;Y<z.length;Y++)(Y===0||z[Y][1]!==z[Y-1][1]||z[Y][2]!==z[Y-1][2])&&q.push(z[Y]);return q},meetBezierCurveRedBlueSegments:function(v,N,G){var z,q,Y,W,ie=JXG$1.evaluate(G),ne,se,ae,ce,pe,ge,ve,be=0,Ee=0,Pe,Je,Ce=[];if(N.numberPoints<N.bezierDegree+1||v.numberPoints<v.bezierDegree+1)return[0,NaN,NaN];for(v.bezierDegree===1&&N.bezierDegree===3&&(se=v,v=N,N=se),Pe=N.numberPoints-N.bezierDegree,Je=v.numberPoints-v.bezierDegree,v.type===Const.OBJECT_TYPE_SECTOR&&(be=3,Je-=3),N.type===Const.OBJECT_TYPE_SECTOR&&(Ee=3,Pe-=3),q=be;q<Je;q+=v.bezierDegree)for(z=v.points,ae=[z[q].usrCoords.slice(1),z[q+1].usrCoords.slice(1)],v.bezierDegree===3&&(ae[2]=z[q+2].usrCoords.slice(1),ae[3]=z[q+3].usrCoords.slice(1)),pe=this._bezierBbox(ae),Y=Ee;Y<Pe;Y+=N.bezierDegree)if(z=N.points,ce=[z[Y].usrCoords.slice(1),z[Y+1].usrCoords.slice(1)],N.bezierDegree===3&&(ce[2]=z[Y+2].usrCoords.slice(1),ce[3]=z[Y+3].usrCoords.slice(1)),ge=this._bezierBbox(ce),this._bezierOverlap(pe,ge)){if(ve=this.meetBeziersegmentBeziersegment(ae,ce),ve.length===0)continue;for(W=0;W<ve.length;W++)ne=ve[W],!(ne[1]<-Mat.eps||ne[1]>1+Mat.eps||ne[2]<-Mat.eps||ne[2]>1+Mat.eps)&&Ce.push(ne);if(Ce.length>ie)return Ce[ie][0]}return Ce.length>ie?Ce[ie][0]:[0,NaN,NaN]},bezierSegmentEval:function(v,N){var G,z,q,Y=1-v;return z=0,q=0,G=Y*Y*Y,z+=G*N[0][0],q+=G*N[0][1],G=3*v*Y*Y,z+=G*N[1][0],q+=G*N[1][1],G=3*v*v*Y,z+=G*N[2][0],q+=G*N[2][1],G=v*v*v,z+=G*N[3][0],q+=G*N[3][1],[1,z,q]},bezierArc:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce,pe,ge=N[1],ve=N[2],be=N[0],Ee=[],Pe=[],Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt;for(se=this.distance(N,v),ge/=be,ve/=be,ae=this.rad(v.slice(1),N.slice(1),G.slice(1)),q===-1&&(ae=2*Math.PI-ae),pe=ae/4,Y=v,Y[1]/=Y[0],Y[2]/=Y[0],Y[0]/=Y[0],ne=Y.slice(0),z?(Ee=[ge,ge+.333*(Y[1]-ge),ge+.666*(Y[1]-ge),Y[1]],Pe=[ve,ve+.333*(Y[2]-ve),ve+.666*(Y[2]-ve),Y[2]]):(Ee=[Y[1]],Pe=[Y[2]]);ae>Mat.eps;)ae>pe?(ce=pe,ae-=pe):(ce=ae,ae=0),Je=Math.cos(q*ce),Ce=Math.sin(q*ce),rt=[[1,0,0],[ge*(1-Je)+ve*Ce,Je,-Ce],[ve*(1-Je)-ge*Ce,Ce,Je]],tt=Mat.matVecMult(rt,Y),ne=[tt[0]/tt[0],tt[1]/tt[0],tt[2]/tt[0]],Ve=Y[1]-ge,Re=Y[2]-ve,qe=ne[1]-ge,et=ne[2]-ve,Ke=Mat.hypot(Ve+qe,Re+et),Math.abs(et-Re)>Mat.eps?Ze=(Ve+qe)*(se/Ke-.5)/(et-Re)*8/3:Ze=(Re+et)*(se/Ke-.5)/(Ve-qe)*8/3,W=[1,Y[1]-Ze*Re,Y[2]+Ze*Ve],ie=[1,ne[1]+Ze*et,ne[2]-Ze*qe],JXG$1.concat(Ee,[W[1],ie[1],ne[1]]),JXG$1.concat(Pe,[W[2],ie[2],ne[2]]),Y=ne.slice(0);return z&&(JXG$1.concat(Ee,[ne[1]+.333*(ge-ne[1]),ne[1]+.666*(ge-ne[1]),ge]),JXG$1.concat(Pe,[ne[2]+.333*(ve-ne[2]),ne[2]+.666*(ve-ne[2]),ve])),[Ee,Pe]},projectPointToCircle:function(v,N,G){var z,q,Y,W,ie,ne=N.center.coords.usrCoords;return JXG$1.exists(G)||(G=v.board),JXG$1.isPoint(v)?(z=v.coords.distance(Const.COORDS_BY_USER,N.center.coords),q=v.coords.usrCoords):(z=v.distance(Const.COORDS_BY_USER,N.center.coords),q=v.usrCoords),Math.abs(z)<Mat.eps&&(z=Mat.eps),ie=N.Radius()/z,Y=ne[1]+ie*(q[1]-ne[1]),W=ne[2]+ie*(q[2]-ne[2]),new Coords(Const.COORDS_BY_USER,[Y,W],G)},projectPointToLine:function(v,N,G){var z=[0,N.stdform[1],N.stdform[2]],q;return JXG$1.exists(G)||(JXG$1.exists(v.coords)?G=v.board:G=N.board),JXG$1.exists(v.coords)?q=v.co
46ords.usrCoords:q=v.usrCoords,z=Mat.crossProduct(z,q),new Coords(Const.COORDS_BY_USER,Mat.crossProduct(z,N.stdform),G)},projectCoordsToSegment:function(v,N,G){var z,q,Y=[G[1]-N[1],G[2]-N[2]],W=[v[1]-N[1],v[2]-N[2]];return Math.abs(Y[0])<Mat.eps&&Math.abs(Y[1])<Mat.eps?[N,0]:(z=Mat.innerProduct(W,Y),q=Mat.innerProduct(Y,Y),z/=q,[[1,z*Y[0]+N[1],z*Y[1]+N[2]],z])},projectCoordsToBeziersegment:function(v,N,G){var z,q=function(Y){var W=[1,N.X(G+Y),N.Y(G+Y)];return W[1]-=v[1],W[2]-=v[2],W[1]*W[1]+W[2]*W[2]};return z=JXG$1.Math.Numerics.fminbr(q,[0,1]),[[1,N.X(z+G),N.Y(z+G)],z]},projectPointToCurve:function(v,N,G){JXG$1.exists(G)||(G=v.board);var z=v.X(),q=v.Y(),Y=v.position,W;return JXG$1.exists(Y)||(Y=N.evalVisProp("curvetype")==="functiongraph"?z:0),W=this.projectCoordsToCurve(z,q,Y,N,G),W},projectCoordsToCurve:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut,ct=Number.POSITIVE_INFINITY;if(JXG$1.exists(q)||(q=z.board),z.evalVisProp("curvetype")==="plot"){if(G=0,se=ct,z.numberPoints===0?Y=[0,1,1]:Y=[z.Z(0),z.X(0),z.Y(0)],z.numberPoints>1)for(pe=[1,v,N],z.bezierDegree===3?ne=0:be=[z.Z(0),z.X(0),z.Y(0)],ie=0;ie<z.numberPoints-1;ie++)z.bezierDegree===3?Pe=this.projectCoordsToBeziersegment(pe,z,ne):(Ee=[z.Z(ie+1),z.X(ie+1),z.Y(ie+1)],Pe=this.projectCoordsToSegment(pe,be,Ee)),ce=Pe[1],ge=Pe[0],0<=ce&&ce<=1?(ae=this.distance(ge,pe),ve=ie+ce):ce<0?(ge=be,ae=this.distance(be,pe),ve=ie):ce>1&&ie===z.numberPoints-2&&(ge=Ee,ae=this.distance(ge,pe),ve=z.numberPoints-1),ae<se&&(se=ae,G=ve,Y=ge),z.bezierDegree===3?(ne++,ie+=2):be=Ee;W=new Coords(Const.COORDS_BY_USER,Y,q)}else{for(ot=z.minX(),ut=z.maxX(),rt=ot,it=ut,z.evalVisProp("curvetype")==="functiongraph"&&(qe=Math.abs(N-z.Y(v)),isNaN(qe)||(rt=v-qe,it=v+qe)),Je=function(at){var st,pt;return at<ot||at>z.maxX_glob?1/0:(st=v-z.X(at),pt=N-z.Y(at),st*st+pt*pt)},Re=Je(G),Ke=50,et=(it-rt)/Ke,Ce=rt,ie=0;ie<Ke;ie++)Ve=Je(Ce),(Ve<Re||Re===1/0||isNaN(Re))&&(G=Ce,Re=Ve),Ce+=et;for(Ze=et,ie=0;ie<20&&isNaN(Je(G-Ze));ie++,Ze*=.5);for(isNaN(Je(G-Ze))&&(Ze=0),tt=et,ie=0;ie<20&&isNaN(Je(G+tt));ie++,tt*=.5);isNaN(Je(G+tt))&&(tt=0),G=Numerics.fminbr(Je,[Math.max(G-Ze,rt),Math.min(G+tt,it)]),G=G<ot?ot:G,G=G>ut?ut:G,W=new Coords(Const.COORDS_BY_USER,[z.X(G),z.Y(G)],q)}return[z.updateTransform(W),G]},projectCoordsToPolygon:function(v,N){var G,z=N.vertices.length,q=1/0,Y,W,ie,ne;for(G=0;G<z-1;G++)W=JXG$1.Math.Geometry.projectCoordsToSegment(v,N.vertices[G].coords.usrCoords,N.vertices[G+1].coords.usrCoords),0<=W[1]&&W[1]<=1?(Y=JXG$1.Math.Geometry.distance(W[0],v,3),ie=W[0]):W[1]<0?(Y=JXG$1.Math.Geometry.distance(N.vertices[G].coords.usrCoords,v,3),ie=N.vertices[G].coords.usrCoords):(Y=JXG$1.Math.Geometry.distance(N.vertices[G+1].coords.usrCoords,v,3),ie=N.vertices[G+1].coords.usrCoords),Y<q&&(ne=ie.slice(0),q=Y);return ne},projectPointToTurtle:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge=0,ve=0,be=Number.POSITIVE_INFINITY,Ee=N.objects.length;for(JXG$1.exists(G)||(G=v.board),ie=0;ie<Ee;ie++)se=N.objects[ie],se.elementClass===Const.OBJECT_CLASS_CURVE&&(ce=this.projectPointToCurve(v,se),z=ce[0],pe=ce[1],ne=this.distance(z.usrCoords,v.coords.usrCoords),ne<be&&(Y=z.usrCoords[1],W=z.usrCoords[2],q=pe,be=ne,ae=se,ve=ge),ge+=se.numberPoints);return z=new Coords(Const.COORDS_BY_USER,[Y,W],G),[ae.updateTransform(z),q+ve]},projectPointToPoint:function(v,N){return N.coords},projectPointToBoard:function(v,N){var G,z,q,Y=N||v.board,W=[[1,1,0,0,3,0,1],[-1,2,1,0,1,2,1],[-1,1,2,2,1,2,3],[1,2,3,0,3,2,3]],ie=v.coords||v,ne=Y.getBoundingBox();for(G=0;G<4;G++)q=W[G],q[0]*ie.usrCoords[q[1]]<q[0]*ne[q[2]]&&(z=Mat.crossProduct([1,ne[q[3]],ne[q[4]]],[1,ne[q[5]],ne[q[6]]]),z[3]=0,z=Mat.normalize(z),ie=this.projectPointToLine({coords:ie},{stdform:z},Y));return ie},distPointLine:function(v,N){var G=N[1],z=N[2],q=N[0],Y;return Math.abs(G)+Math.abs(z)<Mat.eps?Number.POSITIVE_INFINITY:(Y=G*v[1]+z*v[2]+q,G*=G,z*=z,Math.abs(Y)/Math.sqrt(G+z))},distPointSegment:function(v,N,G){var z,q,Y,W,ie,ne,se=Mat.eps*Mat.eps,ae=1e6;return z=v[1]-N[1],q=v[2]-N[2],z=z===1/0?ae:z===-1/0?-1e6:z,q=q===1/0?ae:q===-1/0?-1e6:q,Y=G[1]-N[1],W=G[2]-N[2],Y=Y===1/0?ae:Y===-1/0?-1e6:Y,W=W===1/0?ae:W===-1/0?-1e6:W,ie=Y*Y+W*W,ie>se&&(ne=(z*Y+q*W)/ie,ne<0?ne=0:ne>1&&(ne=1),z-=ne*Y,q-=ne*W),Mat.hypot(z,q)},intersectionFunction3D:function(v,N,G){var z,q=this;return N.type===Const.OBJECT_TYPE_PLANE3D?G.type===Const.OBJECT_TYPE_PLANE3D?z
46=v.intersectionPlanePlane(N,G):G.type===Const.OBJECT_TYPE_SPHERE3D&&(z=q.meetPlaneSphere(N,G)):N.type===Const.OBJECT_TYPE_SPHERE3D&&(G.type===Const.OBJECT_TYPE_PLANE3D?z=q.meetPlaneSphere(G,N):G.type===Const.OBJECT_TYPE_SPHERE3D&&(z=q.meetSphereSphere(N,G))),z},meet3Planes:function(v,N,G,z,q,Y){var W=[1,0,0,0],ie,ne,se,ae,ce;for(ie=Mat.crossProduct(q.slice(1),v.slice(1)),ne=Mat.crossProduct(v.slice(1),G.slice(1)),se=Mat.crossProduct(G.slice(1),q.slice(1)),ae=Mat.innerProduct(v.slice(1),se,3),ce=0;ce<3;ce++)W[ce+1]=(N*se[ce]+z*ie[ce]+Y*ne[ce])/ae;return W},meetPlanePlane:function(v,N,G,z){var q,Y,W,ie;return W=v.slice(1),ie=N.slice(1),q=Mat.crossProduct(W,ie),W=G.slice(1),ie=z.slice(1),Y=Mat.crossProduct(W,ie),ie=Mat.crossProduct(q,Y),ie.unshift(0),ie},meetPlaneSphere:function(v,N){var G=function(){return Mat.innerProduct(v.normal,N.center.coords,4)-v.d};return[function(){return Mat.axpy(-G(),v.normal,N.center.coords)},v.normal,function(){var z=N.Radius(),q=G();return Math.sqrt(z*z-q*q)}]},meetSphereSphere:function(v,N){var G=function(){var z=v.center.distance(N.center),q=v.Radius(),Y=N.Radius();return(q-Y)*(q+Y)/(z*z)};return[function(){var z=G();return[1,.5*((1-z)*v.center.coords[1]+(1+z)*N.center.coords[1]),.5*((1-z)*v.center.coords[2]+(1+z)*N.center.coords[2]),.5*((1-z)*v.center.coords[3]+(1+z)*N.center.coords[3])]},function(){return Stat.subtract(N.center.coords,v.center.coords)},function(){var z=v.center.distance(N.center),q=v.Radius(),Y=N.Radius(),W=G(),ie=.5*(q*q+Y*Y-.5*z*z*(1+W*W));return Math.sqrt(ie)}]},_paramsOutOfRange:function(v,N,G){return v[0]<N[0]||v[0]>N[1]||v.length>1&&(v[1]<G[0]||v[1]>G[1])},projectCoordsToParametric:function(v,N,G,z){var q,Y,W=0,ie=200,ne,se=Math.random()*.01+.5,ae,ce,pe=2*G;return G===1?(ae=[JXG$1.evaluate(N.range[0]),JXG$1.evaluate(N.range[1])],q=.1*(ae[1]-ae[0])):G===2&&(ae=[JXG$1.evaluate(N.range_u[0]),JXG$1.evaluate(N.range_u[1])],ce=[JXG$1.evaluate(N.range_v[0]),JXG$1.evaluate(N.range_v[1])],q=.1*Math.min(ae[1]-ae[0],ce[1]-ce[0])),Y=q/5e6,ne=function(ge,ve,be,Ee){var Pe=[N.X.apply(N,be),N.Y.apply(N,be),N.Z.apply(N,be)],Je=v[0]-Pe[0],Ce=v[1]-Pe[1],Ve=v[2]-Pe[2];return ve>=2&&(Ee[0]=be[0]-ae[0],Ee[1]=-be[0]+ae[1]),ve>=4&&(Ee[2]=be[1]-ce[0],Ee[3]=-be[1]+ce[1]),Je*Je+Ce*Ce+Ve*Ve},z.length===0&&(z[0]=se*(ae[0]+ae[1]),G===2&&(z[1]=se*(ce[0]+ce[1]))),Mat.Nlp.FindMinimum(ne,G,0,z,q,Y,W,ie),v=[N.X.apply(N,z),N.Y.apply(N,z),N.Z.apply(N,z)],this._paramsOutOfRange(z,ae,ce)&&(z[0]=se*(ae[0]+ae[1]),G===2&&(z[1]=se*(ce[0]+ce[1])),Mat.Nlp.FindMinimum(ne,G,pe,z,q,Y,W,ie)),[1,N.X.apply(N,z),N.Y.apply(N,z),N.Z.apply(N,z)]},project3DTo3DPlane:function(v,N,G){var z=[0,0,0],q,Y,W,ie;return G=G||[0,0,0],q=Mat.norm(N),Y=Mat.innerProduct(v,N,3),W=Mat.innerProduct(G,N,3),ie=(Y-W)/q,z=Mat.axpy(-ie,N,v),z},getPlaneBounds:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce;return v[2]+N[0]!==0?(se=[[v[0],N[0]],[v[1],N[1]]],ae=[z-G[0],z-G[1]],ce=Numerics.Gauss(se,ae),Y=ce[0],W=ce[1],ae=[q-G[0],q-G[1]],ce=Numerics.Gauss(se,ae),ie=ce[0],ne=ce[1],[Y,ie,W,ne]):null},reuleauxPolygon:function(v,N){var G,z=Math.PI*2,q=z/N,Y=(N-1)/2,W=0,ie=function(ne,se){return function(ae,ce){var pe=(ae%z+z)%z,ge=Math.floor(pe/q)%N;return ce||(W=v[0].Dist(v[Y]),G=Mat.Geometry.rad([v[0].X()+1,v[0].Y()],v[0],v[Y%N])),isNaN(ge)?ge:(pe=pe*.5+ge*q*.5+G,v[ge][ne]()+W*Math[se](pe))}};return[ie("X","cos"),ie("Y","sin"),0,z]}});const Geometry=Mat.Geometry;Mat.Quadtree=function(v,N,G){N=N||{capacity:10,pointType:"coords"},this.config={},this.config.capacity=N.capacity||10,this.config.pointType=N.pointType||"coords",this.points=[],this.xlb=v[0],this.xub=v[2],this.ylb=v[3],this.yub=v[1],this.parent=G||null,this.northWest=null,this.northEast=null,this.southEast=null,this.southWest=null};JXG$1.extend(Mat.Quadtree.prototype,{contains:function(v,N){return this.xlb<v&&v<=this.xub&&this.ylb<N&&N<=this.yub},insert:function(v){switch(this.config.pointType){case"coords":if(!this.contains(v.usrCoords[1],v.usrCoords[2]))return!1;break;case"object":if(!this.contains(v.x,v.y))return!1;break}return this.points.length<this.config.capacity&&this.northWest===null?(this.points.push(v),!0):(this.northWest===null&&this.subdivide(),this.northWest.insert(v)||this.northEast.insert(v)||this.southEast.insert(v)?!0:!!this.southWest.insert(v))},subdivide:function(){var v=this.xlb+(this.xub-this.xlb)*.5,N=this.ylb+(this.yub-this.ylb)*.5;this.northWest=new Mat.Quadtree([this.xlb,this.yub,v,N],this.config,this),this.northEast=new Mat.Quadtree([v,this.yub,this.xub,N],this.config,this),this.southEast=new Mat.Quadtree([this.xlb,
46N,v,this.ylb],this.config,this),this.southWest=new Mat.Quadtree([v,N,this.xub,this.ylb],this.config,this)},_query:function(v,N){var G;if(this.contains(v,N)){if(this.northWest===null)return this;if(G=this.northWest._query(v,N),G||(G=this.northEast._query(v,N),G)||(G=this.southEast._query(v,N),G)||(G=this.southWest._query(v,N),G))return G}return!1},query:function(v,N){var G,z;return JXG$1.exists(N)?(G=v,z=N):(G=v.usrCoords[1],z=v.usrCoords[2]),this._query(G,z)},hasPoint:function(v,N,G){var z,q,Y;if(this.contains(v,N)){switch(Y=this.points.length,this.config.pointType){case"coords":for(q=0;q<Y;q++)if(Geometry.distance([v,N],this.points[q].usrCoords.slice(1),2)<G)return!0;break;case"object":for(q=0;q<Y;q++)if(Geometry.distance([v,N],[this.points[q].x,this.points[q].y],2)<G)return!0;break}if(this.northWest===null)return!1;if(z=this.northWest.hasPoint(v,N,G),z||(z=this.northEast.hasPoint(v,N,G),z)||(z=this.southEast.hasPoint(v,N,G),z)||(z=this.southWest.hasPoint(v,N,G),z))return z}return!1},getAllPoints:function(){var v=[];return this.getAllPointsRecursive(v),v},getAllPointsRecursive(v){Array.prototype.push.apply(v,this.points.slice()),this.northWest!==null&&(this.northWest.getAllPointsRecursive(v),this.northEast.getAllPointsRecursive(v),this.southEast.getAllPointsRecursive(v),this.southWest.getAllPointsRecursive(v))}});const QDT=Mat.Quadtree;Mat.BoxQuadtree=function(v,N,G){var z,q,Y,W;v--,this.depth=v,this.capacity=N,this.items=[],this.northWest=null,this.northEast=null,this.southEast=null,this.southWest=null,this.bbox=null,this.cx=null,this.cy=null,G&&(z=G[0],q=G[1],Y=G[2],W=G[3],this.cx=(z+Y)*.5,this.cy=(q+W)*.5,this.bbox=[z,q,Y,W])};JXG$1.extend(Mat.BoxQuadtree.prototype,{insert:function(v){var N,G,z,q,Y,W,ie,ne=[],se=[],ae=[],ce=[],pe,ge,ve,be;if(this.bbox===null){for(G=v.length,z=W=1/0,Y=q=-1/0,N=0;N<v.length;N++)ie=v[N],z=ie.xlb<z?ie.xlb:z,q=ie.yub>q?ie.yub:q,Y=ie.xub>Y?ie.xub:Y,W=ie.ylb<W?ie.ylb:W;this.cx=(z+Y)*.5,this.cy=(q+W)*.5,this.bbox=[z,q,Y,W]}else z=this.bbox[0],q=this.bbox[1],Y=this.bbox[2],W=this.bbox[3];if(this.depth===0||this.items.length+v.length<this.capacity)return this.items=this.items.concat(v),this;for(G=v.length,N=0;N<G;N++)ie=v[N],pe=ie.xlb<=this.cx&&ie.yub>this.cy,ve=ie.xlb<=this.cx&&ie.ylb<=this.cy,ge=ie.xub>this.cx&&ie.yub>this.cy,be=ie.xub>this.cx&&ie.ylb<=this.cy,pe&&ge&&be&&ve?this.items.push(ie):(pe&&ne.push(ie),ve&&ae.push(ie),ge&&se.push(ie),be&&ce.push(ie));return this.subdivide(ne,ae,se,ce,z,q,Y,W),this},insertItem:function(v){var N,G,z,q,Y=[],W=[],ie=[],ne=[],se,ae,ce,pe;return this.bbox===null?(N=q=1/0,z=G=-1/0,N=v.xlb<N?v.xlb:N,G=v.yub>G?v.yub:G,z=v.xub>z?v.xub:z,q=v.ylb<q?v.ylb:q,this.cx=(N+z)*.5,this.cy=(G+q)*.5,this.bbox=[N,G,z,q]):(N=this.bbox[0],G=this.bbox[1],z=this.bbox[2],q=this.bbox[3]),this.depth===0||this.items.length+1<this.capacity?(this.items.push(v),this):(se=v.xlb<=this.cx&&v.yub>this.cy,ce=v.xlb<=this.cx&&v.ylb<=this.cy,ae=v.xub>this.cx&&v.yub>this.cy,pe=v.xub>this.cx&&v.ylb<=this.cy,se&&ae&&pe&&ce?this.items.push(v):(se&&Y.push(v),ce&&ie.push(v),ae&&W.push(v),pe&&ne.push(v)),this.subdivide(Y,ie,W,ne,N,G,z,q),this)},subdivide:function(v,N,G,z,q,Y,W,ie){return v.length>0&&(this.northWest===null&&(this.northWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[q,Y,this.cx,this.cy])),this.northWest.insert(v)),N.length>0&&(this.southWest===null&&(this.southWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[q,this.cy,this.cx,ie])),this.southWest.insert(N)),G.length>0&&(this.northEast===null&&(this.northEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,Y,W,this.cy])),this.northEast.insert(G)),z.length>0&&(this.southEast===null&&(this.southEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,this.cy,W,ie])),this.southEast.insert(z)),this},find:function(v){var N=function(Y){return v[2]>=Y.xlb&&v[0]<=Y.xub&&v[3]<=Y.yub&&v[1]>=Y.ylb},G=[],z,q;for(q=this.items.length,z=0;z<q;z++)N(this.items[z])&&G.push(this.items[z]);return this.northWest!==null&&v[0]<=this.cx&v[1]>=this.cy&&JXG$1.concat(G,this.northWest.find(v)),this.southWest!==null&&v[0]<=this.cx&v[3]<=this.cy&&JXG$1.concat(G,this.southWest.find(v)),this.northEast!==null&&v[2]>=this.cx&v[1]>=this.cy&&JXG$1.concat(G,this.northEast.find(v)),this.southEast!==null&&v[2]>=this.cx&v[3]<=this.cy&&JXG$1.concat(G,this.southEast.find(v)),G},analyzeTree:function(){var v={number_items:this.items.length,depth:1},N;return this.northWest!==null&&(N=this.northWest.analyzeTree(),v.number_items+=N.number_items,v.depth=Math.max(v.depth,1+N.depth)),this.southWest!==null&&(N=this.southWest.analyzeTree(),v.number_items+=N.number_items,v.depth=Math.max(v.depth,1+N.depth)),this.northEast!==null&&(N=this.northEast.analyzeTree(),v.number_items+=N.number_items,v.depth=Math.max(v.depth,1+N.depth)),this.southEast!==null&&(N=this.southEast.analyzeTree(),v.number_items+=N.number_items,v.depth=Math.max(v.depth,1+N.depth)),v},plot:function(){var v=[],N=[],G;return v.push(this.bbox[0]),N.push(this.bbox[3]),v.push(this.bbox[2]),N.push(this.bbox[3]),v.push(this.bbox[2]),N.push(this.bbox[1]),v.push(this.bbox[0]),N.push(this.bbox[1]),v.push(this.bbox[0]),N.push(this.bbox[3]),v.push(NaN),N.push(NaN),this.northWest!==null&&(G=this.northWest.plot(),JXG$1.concat(v,G[0]),JXG$1.concat(N,G[1])),this.northEast!==null&&(G=this.northEast.plot(),JXG$1.concat(v,G[0]),JXG$1.concat(N,G[1])),this.southEast!==null&&(G=this.southEast.plot(),JXG$1.concat(v,G[0]),JXG$1.concat(N,G[1])),this.southWest!==null&&(G=this.southWest.plot(),JXG$1.concat(v,G[0]),JXG$1.concat(N,G[1])),[v,N]}});const Quadtree=Mat.BoxQuadtree;JXG$1.Math.Nlp={arr:function(v){return new Float64Array(v)},arr2:function(v,N){for(var G=0,z=new Array(v);G<v;)z[G]=this.arr(N),G++;return z},arraycopy:function(v,N,G,z,q){for(var Y=0;Y<q;
46)G[Y+z]=v[Y+N],Y++},lastNumberOfEvaluations:0,GetLastNumberOfEvaluations:function(){return this.lastNumberOfEvaluations},Normal:0,MaxIterationsReached:1,DivergingRoundingErrors:2,FindMinimum:function(v,N,G,z,q,Y,W,ie,ne){var se=G+2,ae,ce=this.arr(N+1),pe=this,ge;return this.lastNumberOfEvaluations=0,ne&&console.log("Experimental feature 'testForRoundingErrors' is activated."),ce[0]=0,this.arraycopy(z,0,ce,1,N),ge=function(ve,be,Ee,Pe){var Je=pe.arr(ve),Ce,Ve;return pe.lastNumberOfEvaluations=pe.lastNumberOfEvaluations+1,pe.arraycopy(Ee,1,Je,0,ve),Ce=pe.arr(be),Ve=v(ve,be,Je,Ce),pe.arraycopy(Ce,0,Pe,1,be),Ve},ae=this.cobylb(ge,N,G,se,ce,q,Y,W,ie,ne),this.arraycopy(ce,1,z,0,N),ae},cobylb:function(v,N,G,z,q,Y,W,ie,ne,se){var ae=-1,ce=.25,pe=2.1,ge=.5,ve=1.1,be=0,Ee=0,Pe,Je=N+1,Ce=G+1,Ve=Y,Re=0,qe=!1,et=!1,Ze=0,tt=0,Ke=0,rt=this.arr(1+z),it=this.arr2(1+N,1+Je),ot=this.arr2(1+N,1+N),ut=this.arr2(1+z,1+Je),ct=this.arr2(1+N,1+Ce),at=this.arr(1+N),st=this.arr(1+N),pt=this.arr(1+N),lt=this.arr(1+N),vt=this.arr(1+N),dt,xt,ft,Et,Ct,Dt,Gt,Ot,It,Bt,Ht,ir,zt,tr,bt,_t,Xt,At,$t,Pt,kt,jt,wt,Mt,Tt,Rt,Ft,Ut,Zt,Wt,qt=!0;for(ie>=2&&console.log("The initial value of RHO is "+Ve+" and PARMU is set to zero."),Gt=0,Ct=1/Ve,dt=1;dt<=N;++dt)it[dt][Je]=q[dt],it[dt][dt]=Ve,ot[dt][dt]=Ct;Ot=Je,It=!1;e:do{if(Gt>=ne&&Gt>0){ae=this.MaxIterationsReached;break e}for(++Gt,be=v(N,G,q,rt),Ee=0,ft=1;ft<=G;++ft)Ee=Math.max(Ee,-rt[ft]);if((Gt===ie-1||ie===3)&&this.PrintIterationResult(Gt,be,Ee,q,N,ie),rt[Ce]=be,rt[z]=Ee,Bt=!0,!It){for(Bt=!1,dt=1;dt<=z;++dt)ut[dt][Ot]=rt[dt];if(Gt<=Je){if(Ot<=N)if(ut[Ce][Je]<=be)q[Ot]=it[Ot][Je];else{for(it[Ot][Je]=q[Ot],ft=1;ft<=z;++ft)ut[ft][Ot]=ut[ft][Je],ut[ft][Je]=rt[ft];for(ft=1;ft<=Ot;++ft){for(it[Ot][ft]=-Ve,Ct=0,dt=ft;dt<=Ot;++dt)Ct-=ot[dt][ft];ot[Ot][ft]=Ct}}if(Gt<=N){Ot=Gt,q[Ot]+=Ve;continue e}}It=!0}t:do{r:do{if(!Bt){for(Ht=ut[Ce][Je]+Re*ut[z][Je],ir=Je,xt=1;xt<=N;++xt)Ct=ut[Ce][xt]+Re*ut[z][xt],Ct<Ht?(ir=xt,Ht=Ct):Ct===Ht&&Re===0&&ut[z][xt]<ut[z][ir]&&(ir=xt);if(ir<=N){for(dt=1;dt<=z;++dt)Ct=ut[dt][Je],ut[dt][Je]=ut[dt][ir],ut[dt][ir]=Ct;for(dt=1;dt<=N;++dt){for(Ct=it[dt][ir],it[dt][ir]=0,it[dt][Je]+=Ct,Dt=0,ft=1;ft<=N;++ft)it[dt][ft]-=Ct,Dt-=ot[ft][dt];ot[ir][dt]=Dt}}if(zt=0,se)for(dt=1;dt<=N;++dt)for(xt=1;xt<=N;++xt)Ct=this.DOT_PRODUCT_ROW_COL(ot,dt,it,xt,1,N)-(dt===xt?1:0),zt=Math.max(zt,Math.abs(Ct));if(zt>.1){ae=this.DivergingRoundingErrors;break e}for(ft=1;ft<=Ce;++ft){for(rt[ft]=-ut[ft][Je],xt=1;xt<=N;++xt)vt[xt]=ut[ft][xt]+rt[ft];for(dt=1;dt<=N;++dt)ct[dt][ft]=(ft===Ce?-1:1)*this.DOT_PRODUCT_ROW_COL(vt,-1,ot,dt,1,N)}for(qe=!0,Ze=ce*Ve,tr=pe*Ve,xt=1;xt<=N;++xt){for(bt=0,_t=0,ft=1;ft<=N;++ft)bt+=ot[xt][ft]*ot[xt][ft],_t+=it[ft][xt]*it[ft][xt];at[xt]=1/Math.sqrt(bt),st[xt]=Math.sqrt(_t),(at[xt]<Ze||st[xt]>tr)&&(qe=!1)}if(!It&&!qe){for(Ot=0,Ct=tr,xt=1;xt<=N;++xt)st[xt]>Ct&&(Ot=xt,Ct=st[xt]);if(Ot===0)for(xt=1;xt<=N;++xt)at[xt]<Ct&&(Ot=xt,Ct=at[xt]);for(Ct=ge*Ve*at[Ot],ft=1;ft<=N;++ft)lt[ft]=Ct*ot[Ot][ft];for(Xt=0,At=0,Pe=0,ft=1;ft<=Ce;++ft)Pe=this.DOT_PRODUCT_ROW_COL(lt,-1,ct,ft,1,N),ft<Ce&&(Ct=ut[ft][Je],Xt=Math.max(Xt,-Pe-Ct),At=Math.max(At,Pe-Ct));for($t=Re*(Xt-At)>2*Pe?-1:1,Ct=0,dt=1;dt<=N;++dt)lt[dt]=$t*lt[dt],it[dt][Ot]=lt[dt],Ct+=ot[Ot][dt]*lt[dt];for(ft=1;ft<=N;++ft)ot[Ot][ft]/=Ct;for(xt=1;xt<=N;++xt){if(xt!==Ot)for(Ct=this.DOT_PRODUCT_ROW_COL(ot,xt,lt,-1,1,N),ft=1;ft<=N;++ft)ot[xt][ft]-=Ct*ot[Ot][ft];q[xt]=it[xt][Je]+lt[xt]}continue e}if(et=this.trstlp(N,G,ct,rt,Ve,lt),!et){for(Ct=0,ft=1;ft<=N;++ft)Ct+=lt[ft]*lt[ft];if(Ct<.25*Ve*Ve){It=!0;break r}}for(Pe=0,Pt=0,rt[Ce]=0,ft=1;ft<=Ce;++ft)Pe=rt[ft]-this.DOT_PRODUCT_ROW_COL(lt,-1,ct,ft,1,N),ft<Ce&&(Pt=Math.max(Pt,Pe));if(tt=ut[z][Je]-Pt,kt=tt>0?Pe/tt:0,Re<1.5*kt){for(Re=2*kt,ie>=2&&console.log("Increase in PARMU to "+Re),jt=ut[Ce][Je]+Re*ut[z][Je],xt=1;xt<=N;++xt)if(Ct=ut[Ce][xt]+Re*ut[z][xt],Ct<jt||Ct===jt&&Re===0&&ut[z][xt]<ut[z][Je])continue t}for(Ke=Re*tt-Pe,ft=1;ft<=N;++ft)q[ft]=it[ft][Je]+lt[ft];It=!0;continue e}for(Bt=!1,wt=ut[Ce][Je]+Re*ut[z][Je],Mt=be+Re*Ee,Tt=wt-Mt,Re===0&&be===ut[Ce][Je]&&(Ke=tt,Tt=ut[z][Je]-Ee),Rt=Tt<=0?1:0,Ot=0,xt=1;xt<=N;++xt)Ct=Math.abs(this.DOT_PRODUCT_ROW_COL(ot,xt,lt,-1,1,N)),Ct>Rt&&(Ot=xt,Rt=Ct),pt[xt]=Ct*at[xt];for(Ft=ve*Ve,Et=0,xt=1;xt<=N;++xt)if(pt[xt]>=Ze||pt[xt]>=at[xt]){if(Ct=st[xt],Tt>0){for(Ct=0,ft=1;ft<=N;++ft)Ct+=Math.pow(lt[ft]-it[ft][xt],2);Ct=Math.sqrt(Ct)}Ct>Ft&&(Et=xt,Ft=Ct)}if(Et>0&&(Ot=Et),Ot!==0){for(Ct=0,dt=1;dt<=N;++dt)it[dt][Ot]=lt[dt],Ct+=ot[Ot][dt]*lt[dt];for(ft=1;ft<=N;++ft)ot[Ot][ft]/=Ct;for(xt=1;xt<=N;++xt)if(xt!==Ot)for(Ct=this.DOT_PRODUCT_ROW_COL(ot,xt,lt,-1,1,N),ft=1;ft<=N;++ft)ot[xt][ft]-=Ct*ot[Ot][ft];for(ft=1;ft<=z;++ft)ut[ft][Ot]=rt[ft];if(Tt>0&&Tt>=.1*Ke)continue t}}while(!1);if(!qe){It=!1;continue t}if(Ve<=W){ae=this.Normal;break e}if(Ut=0,Zt=0,Ve*=.5,Ve<=1.5*W&&(Ve=W),Re>0){for(Wt=0,ft=1;ft<=Ce;++ft){for(Ut=ut[ft][Je],Zt=Ut,dt=1;dt<=N;++dt)Ut=Math.min(Ut,ut[ft][dt]),Zt=Math.max(Zt,ut[ft][dt]);ft<=G&&Ut<.5*Zt&&(Ct=Math.max(Zt,0)-Ut,Wt=Wt<=0?Ct:Math.min(Wt,Ct))}Wt===0?Re=0:Zt-Ut<Re*Wt&&(Re=(Zt-Ut)/Wt)}ie>=2&&console.log("Reduction in RHO to "+Ve+"  and PARMU = "+Re),ie===2&&this.PrintIterationResult(Gt,ut[Ce][Je],ut[z][Je],this.COL(it,Je),N,ie)}while(qt)}while(qt);switch(ae){case this.Normal:if(ie>=1&&console.log("%nNormal return from subroutine COBYLA%n"),et)return ie>=1&&this.PrintIterationResult(Gt,be,Ee,q,N,ie),ae;break;case this.MaxIterationsReached:ie>=1&&console.log("%nReturn from subroutine COBYLA because the MAXFUN limit has been reached.%n");break;case this.DivergingRoundingErrors:ie>=1&&console.log("%nReturn from subroutine COBYLA because rounding errors are becoming damaging.%n");break}for(ft=1;ft<=N;++ft)q[ft]=it[ft][Je];return be=ut[Ce][Je],Ee=ut[z][Je],ie>=1&&this.PrintIterationResult(Gt,be,Ee,q,N,ie),ae},trstlp:function(v,N,G,z,q,Y){var W=0,ie=0,ne=0,se=this.arr2(1+v,1+v),ae=this.arr(2+N),ce=this.arr(2+N),pe
46=this.arr(1+v),ge=this.arr(1+v),ve=this.arr(2+N),be=this.arr(2+N),Ee=N,Pe=0,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut,ct,at,st,pt,lt,vt,dt,xt,ft,Et,Ct,Dt,Gt,Ot,It,Bt,Ht,ir,zt,tr,bt,_t=!0;for(Ve=1;Ve<=v;++Ve)se[Ve][Ve]=1,Y[Ve]=0;if(Je=0,Ce=0,N>=1){for(Re=1;Re<=N;++Re)z[Re]>Ce&&(Ce=z[Re],Je=Re);for(Re=1;Re<=N;++Re)be[Re]=Re,ce[Re]=Ce-z[Re]}qe=!0;do e:do{(!qe||qe&&Ce===0)&&(Ee=N+1,Je=Ee,be[Ee]=Ee,ce[Ee]=0),qe=!1,et=0,Ze=0,tt=0,Ke=0;t:do{if(rt=Ee===N?Ce:-this.DOT_PRODUCT_ROW_COL(Y,-1,G,Ee,1,v),Ze===0||rt<et?(et=rt,ie=Pe,Ze=3):Pe>ie?(ie=Pe,Ze=3):--Ze,Ze===0)break e;if(it=0,Je<=Pe){if(Je<Pe){ot=be[Je],ut=ce[Je],Re=Je;do{for(at=Re+1,st=be[at],pt=this.DOT_PRODUCT(this.PART(this.COL(se,Re),1,v),this.PART(this.COL(G,st),1,v)),W=Mat.hypot(pt,ae[at]),lt=ae[at]/W,vt=pt/W,ae[at]=lt*ae[Re],ae[Re]=W,Ve=1;Ve<=v;++Ve)W=lt*se[Ve][at]+vt*se[Ve][Re],se[Ve][at]=lt*se[Ve][Re]-vt*se[Ve][at],se[Ve][Re]=W;be[Re]=st,ce[Re]=ce[at],Re=at}while(Re<Pe);be[Re]=ot,ce[Re]=ut}if(--Pe,Ee>N)for(W=1/ae[Pe],Re=1;Re<=v;++Re)pe[Re]=W*se[Re][Pe];else for(W=this.DOT_PRODUCT_ROW_COL(pe,-1,se,Pe+1,1,v),Re=1;Re<=v;++Re)pe[Re]-=W*se[Re][Pe+1]}else{for(st=be[Je],Re=1;Re<=v;++Re)ge[Re]=G[Re][st];for(dt=0,Re=v;Re>Pe;){for(pt=0,xt=0,Ve=1;Ve<=v;++Ve)W=se[Ve][Re]*ge[Ve],pt+=W,xt+=Math.abs(W);if(ft=xt+.1*Math.abs(pt),Et=xt+.2*Math.abs(pt),(xt>=ft||ft>=Et)&&(pt=0),dt===0)dt=pt;else for(at=Re+1,W=Mat.hypot(pt,dt),lt=pt/W,vt=dt/W,dt=W,Ve=1;Ve<=v;++Ve)W=lt*se[Ve][Re]+vt*se[Ve][at],se[Ve][at]=lt*se[Ve][at]-vt*se[Ve][Re],se[Ve][Re]=W;--Re}if(dt===0){it=-1,Re=Pe;do{for(Ct=0,Dt=0,Ve=1;Ve<=v;++Ve)W=se[Ve][Re]*ge[Ve],Ct+=W,Dt+=Math.abs(W);if(ft=Dt+.1*Math.abs(Ct),Et=Dt+.2*Math.abs(Ct),Dt<ft&&ft<Et){if(W=Ct/ae[Re],W>0&&be[Re]<=N&&(bt=ce[Re]/W,(it<0||bt<it)&&(it=bt)),Re>=2)for(Gt=be[Re],Ve=1;Ve<=v;++Ve)ge[Ve]-=W*G[Ve][Gt];ve[Re]=W}else ve[Re]=0}while(--Re>0);if(it<0)break e;for(Re=1;Re<=Pe;++Re)ce[Re]=Math.max(0,ce[Re]-it*ve[Re]);if(Je<Pe){ot=be[Je],ut=ce[Je],Re=Je;do{for(at=Re+1,Gt=be[at],pt=this.DOT_PRODUCT(this.PART(this.COL(se,Re),1,v),this.PART(this.COL(G,Gt),1,v)),W=Mat.hypot(pt,ae[at]),lt=ae[at]/W,vt=pt/W,ae[at]=lt*ae[Re],ae[Re]=W,Ve=1;Ve<=v;++Ve)W=lt*se[Ve][at]+vt*se[Ve][Re],se[Ve][at]=lt*se[Ve][Re]-vt*se[Ve][at],se[Ve][Re]=W;be[Re]=Gt,ce[Re]=ce[at],Re=at}while(Re<Pe);be[Re]=ot,ce[Re]=ut}if(W=this.DOT_PRODUCT(this.PART(this.COL(se,Pe),1,v),this.PART(this.COL(G,st),1,v)),W===0)break e;ae[Pe]=W,ce[Je]=0,ce[Pe]=it}else++Pe,ae[Pe]=dt,ce[Je]=ce[Pe],ce[Pe]=0;if(be[Je]=be[Pe],be[Pe]=st,Ee>N&&st!==Ee){for(Re=Pe-1,pt=this.DOT_PRODUCT(this.PART(this.COL(se,Re),1,v),this.PART(this.COL(G,st),1,v)),W=Mat.hypot(pt,ae[Pe]),lt=ae[Pe]/W,vt=pt/W,ae[Pe]=lt*ae[Re],ae[Re]=W,Ve=1;Ve<=v;++Ve)W=lt*se[Ve][Pe]+vt*se[Ve][Re],se[Ve][Pe]=lt*se[Ve][Re]-vt*se[Ve][Pe],se[Ve][Re]=W;be[Pe]=be[Re],be[Re]=st,W=ce[Re],ce[Re]=ce[Pe],ce[Pe]=W}if(Ee>N)for(W=1/ae[Pe],Re=1;Re<=v;++Re)pe[Re]=W*se[Re][Pe];else for(st=be[Pe],W=(this.DOT_PRODUCT_ROW_COL(pe,-1,G,st,1,v)-1)/ae[Pe],Re=1;Re<=v;++Re)pe[Re]-=W*se[Re][Pe]}for(Ot=q*q,Bt=0,It=0,Ve=1;Ve<=v;++Ve)Math.abs(Y[Ve])>=1e-6*q&&(Ot-=Y[Ve]*Y[Ve]),Bt+=Y[Ve]*pe[Ve],It+=pe[Ve]*pe[Ve];if(Ot<=0)break e;if(W=Math.sqrt(It*Ot),Math.abs(Bt)>=1e-6*W&&(W=Math.sqrt(It*Ot+Bt*Bt)),Ke=Ot/(W+Bt),tt=Ke,Ee===N){if(ft=tt+.1*Ce,Et=tt+.2*Ce,tt>=ft||ft>=Et)break t;tt=Math.min(tt,Ce)}for(Re=1;Re<=v;++Re)ge[Re]=Y[Re]+tt*pe[Re];if(Ee===N)for(ne=Ce,Ce=0,Re=1;Re<=Pe;++Re)st=be[Re],W=z[st]-this.DOT_PRODUCT_ROW_COL(ge,-1,G,st,1,v),Ce=Math.max(Ce,W);Re=Pe;do{for(Ht=0,ir=0,Ve=1;Ve<=v;++Ve)W=se[Ve][Re]*ge[Ve],Ht+=W,ir+=Math.abs(W);if(ft=ir+.1*Math.abs(Ht),Et=ir+.2*Math.abs(Ht),(ir>=ft||ft>=Et)&&(Ht=0),ve[Re]=Ht/ae[Re],Re>=2)for(st=be[Re],Ve=1;Ve<=v;++Ve)ge[Ve]-=ve[Re]*G[Ve][st]}while(Re-->=2);for(Ee>N&&(ve[Pe]=Math.max(0,ve[Pe])),Re=1;Re<=v;++Re)ge[Re]=Y[Re]+tt*pe[Re];if(Ee>Pe)for(zt=Pe+1,Re=zt;Re<=Ee;++Re){for(st=be[Re],ct=Ce-z[st],tr=Ce+Math.abs(z[st]),Ve=1;Ve<=v;++Ve)W=G[Ve][st]*ge[Ve],ct+=W,tr+=Math.abs(W);ft=tr+.1*Math.abs(ct),Et=tr+.2*Math.abs(ct),(tr>=ft||ft>=Et)&&(ct=0),ve[Re]=ct}for(it=1,Je=0,Re=1;Re<=Ee;++Re)ve[Re]<0&&(W=ce[Re]/(ce[Re]-ve[Re]),W<it&&(it=W,Je=Re));for(W=1-it,Re=1;Re<=v;++Re)Y[Re]=W*Y[Re]+it*ge[Re];for(Re=1;Re<=Ee;++Re)ce[Re]=Math.max(0,W*ce[Re]+it*ve[Re]);Ee===N&&(Ce=ne+it*(Ce-ne))}while(Je>0);if(tt===Ke)return!0}while(_t);while(Ee===N);return!1},PrintIterationResult:function(v,N,G,z,q,Y){Y>1&&console.log("NFVALS = "+v+"  F = "+N+"  MAXCV = "+G),Y>1&&console.log("X = "+this.PART(z,1,q))},ROW:function(v,N){return v[N].slice()},COL:function(v,N){var G,z=v.length,q=[];for(G=0;G<z;++G)q[G]=v[G][N];return q},PART:function(v,N,G){return v.slice(N,G+1)},FORMAT:function(v){return v.join(",")},DOT_PRODUCT:function(v,N){var G,z=0,q=v.length;for(G=0;G<q;++G)z+=v[G]*N[G];return z},DOT_PRODUCT_ROW_COL:function(v,N,G,z,q,Y){var W,ie=0;if(N===-1)for(W=q;W<=Y;++W)ie+=v[W]*G[W][z];else if(z===-1)for(W=q;W<=Y;++W)ie+=v[N][W]*G[W];else for(W=q;W<=Y;++W)ie+=v[N][W]*G[W][z];return ie}};JXG$1.Math.Nlp;Mat.Plot={checkReal:function(v){var N=!1,G,z,q=v.length;for(G=0;G<q;G++)if(z=v[G].usrCoords,!isNaN(z[1])&&!isNaN(z[2])&&Math.abs(z[0])>Mat.eps){N=!0;break}return N},updateParametricCurveNaive:function(v,N,G,z){var q,Y,W=!1,ie=(G-N)/z;
46for(q=0;q<z;q++)Y=N+q*ie,v.points[q].setCoordinates(Const.COORDS_BY_USER,[v.X(Y,W),v.Y(Y,W)],!1),v.points[q]._t=Y,W=!0;return v},isSegmentOutside:function(v,N,G,z,q){return N<0&&z<0||N>q.canvasHeight&&z>q.canvasHeight||v<0&&G<0||v>q.canvasWidth&&G>q.canvasWidth},isDistOK:function(v,N,G,z){return Math.abs(v)<G&&Math.abs(N)<z&&!isNaN(v+N)},isSegmentDefined:function(v,N,G,z){return!(isNaN(v+N)&&isNaN(G+z))},updateParametricCurveOld:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be=!1,Ee=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),Pe=[],Je=[],Ce=[],Ve=[],Re=!1,qe=0,et=function(Ze,tt,Ke){var rt,it=Ke[1]-Ze[1],ot=Ke[2]-Ze[2],ut=tt[0]-Ze[1],ct=tt[1]-Ze[2],at=ut*ut+ct*ct;return at>=Mat.eps&&(rt=(it*ut+ot*ct)/at,rt>0&&(rt<=1?(it-=rt*ut,ot-=rt*ct):(it-=ut,ot-=ct))),Mat.hypot(it,ot)};for(JXG$1.deprecated("Curve.updateParametricCurveOld()"),v.board.updateQuality===v.board.BOARD_QUALITY_LOW?(pe=15,ge=10,ve=10):(pe=21,ge=.7,ve=.7),Ve[0]=G-N,z=1;z<pe;z++)Ve[z]=Ve[z-1]*.5;z=1,Pe[0]=1,Je[0]=0,q=N,Ee.setCoordinates(Const.COORDS_BY_USER,[v.X(q,be),v.Y(q,be)],!1),be=!0,ne=Ee.scrCoords[1],se=Ee.scrCoords[2],q=G,Ee.setCoordinates(Const.COORDS_BY_USER,[v.X(q,be),v.Y(q,be)],!1),W=Ee.scrCoords[1],ie=Ee.scrCoords[2],Ce[0]=[W,ie],ae=1,ce=0,v.points=[],v.points[qe++]=new Coords(Const.COORDS_BY_SCREEN,[ne,se],v.board,!1);do{for(Re=this.isDistOK(W-ne,ie-se,ge,ve)||this.isSegmentOutside(ne,se,W,ie,v.board);ce<pe&&(!Re||ce<6)&&(ce<=7||this.isSegmentDefined(ne,se,W,ie));)Pe[ae]=z,Je[ae]=ce,Ce[ae]=[W,ie],ae+=1,z=2*z-1,ce++,q=N+z*Ve[ce],Ee.setCoordinates(Const.COORDS_BY_USER,[v.X(q,be),v.Y(q,be)],!1,!0),W=Ee.scrCoords[1],ie=Ee.scrCoords[2],Re=this.isDistOK(W-ne,ie-se,ge,ve)||this.isSegmentOutside(ne,se,W,ie,v.board);qe>
461&&(Y=et(v.points[qe-2].scrCoords,[W,ie],v.points[qe-1].scrCoords),Y<.015&&(qe-=1)),v.points[qe]=new Coords(Const.COORDS_BY_SCREEN,[W,ie],v.board,!1),v.points[qe]._t=q,qe+=1,ne=W,se=ie,ae-=1,W=Ce[ae][0],ie=Ce[ae][1],ce=Je[ae]+1,z=Pe[ae]*2}while(ae>0&&qe<5e5);return v.numberPoints=v.points.length,v},_insertPoint_v2:function(v,N,G){var z=!isNaN(this._lastCrds[1]+this._lastCrds[2]),q=!isNaN(N.scrCoords[1]+N.scrCoords[2]),Y=v.board.canvasWidth,W=v.board.canvasHeight,ie=500;q=q&&N.scrCoords[1]>-500&&N.scrCoords[2]>-500&&N.scrCoords[1]<Y+ie&&N.scrCoords[2]<W+ie,(!q&&z||q&&(!z||Math.abs(N.scrCoords[1]-this._lastCrds[1])>.7||Math.abs(N.scrCoords[2]-this._lastCrds[2])>.7))&&(N._t=G,v.points.push(N),this._lastCrds=N.copy("scrCoords"))},neighborhood_isNaN_v2:function(v,N){var G,z=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),q,Y;return q=N+Mat.eps,z.setCoordinates(Const.COORDS_BY_USER,[v.X(q,!0),v.Y(q,!0)],!1),Y=z.usrCoords,G=isNaN(Y[1]+Y[2]),!(!G&&(q=N-Mat.eps,z.setCoordinates(Const.COORDS_BY_USER,[v.X(q,!0),v.Y(q,!0)],!1),Y=z.usrCoords,G=isNaN(Y[1]+Y[2]),!G))},_borderCase:function(v,N,G,z,q,Y,W,ie){var ne,se,ae,ce=null,pe,ge=30,ve=!1,be,Ee;if(ie<=1){if(se=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),isNaN(N[1]+N[2])&&!isNaN(z[1]+z[2])&&!this.neighborhood_isNaN_v2(v,q)||isNaN(G[1]+G[2])&&!isNaN(z[1]+z[2])&&!this.neighborhood_isNaN_v2(v,Y)||isNaN(z[1]+z[2])&&(!isNaN(N[1]+N[2])||!isNaN(G[1]+G[2]))&&!this.neighborhood_isNaN_v2(v,W))return!1;pe=0;do{if(isNaN(N[1]+N[2])&&!isNaN(z[1]+z[2]))be=q,Ee=W;else if(isNaN(G[1]+G[2])&&!isNaN(z[1]+z[2]))be=Y,Ee=W;else if(isNaN(z[1]+z[2])&&!isNaN(G[1]+G[2]))be=W,Ee=Y;else if(isNaN(z[1]+z[2])&&!isNaN(N[1]+N[2]))be=W,Ee=q;else return!1;ne=.5*(be+Ee),se.setCoordinates(Const.COORDS_BY_USER,[v.X(ne,!0),v.Y(ne,!0)],!1),ae=se.usrCoords,ve=isNaN(ae[1]+ae[2]),ve?be=ne:Ee=ne,++pe}while(ve&&pe<ge);if(pe<ge&&(ce=ae.slice(),z=ae.slice(),Ee=ne),ce!==null)return this._insertPoint_v2(v,new Coords(Const.COORDS_BY_USER,ce,v.board,!1)),!0}return!1},_plotRecursive_v2:function(v,N,G,z,q,Y,W){var ie,ne,se,ae=0,ce,pe,ge,ve=.5,be=.99,Ee=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1);if(!(v.numberPoints>65536))return Y<this.nanLevel&&this._isUndefined(v,N,G,z,q)?this:Y<this.nanLevel&&this._isOutside(N,G,z,q,v.board)?this:(ie=(G+q)*.5,Ee.setCoordinates(Const.COORDS_BY_USER,[v.X(ie,!0),v.Y(ie,!0)],!1),ne=Ee.scrCoords,this._borderCase(v,N,z,ne,G,q,ie,Y)?this:(se=this._triangleDists(N,z,ne),ce=Y<this.smoothLevel&&se[3]<W,pe=Y<=this.jumpLevel&&(isNaN(se[0])||isNaN(se[1])||isNaN(se[2]))||Y<this.jumpLevel&&(se[2]>be*se[0]||se[1]>be*se[0]||se[0]===1/0||se[1]===1/0||se[2]===1/0),ge=Y<this.smoothLevel+2&&se[0]<ve*(se[1]+se[2]),ge&&(ae=0,ce=!1),--Y,pe?this._insertPoint_v2(v,new Coords(Const.COORDS_BY_SCREEN,[NaN,NaN],v.board,!1),ie):Y<=ae||ce?this._insertPoint_v2(v,Ee,ie):(this._plotRecursive_v2(v,N,G,ne,ie,Y,W),isNaN(Ee.scrCoords[1]+Ee.scrCoords[2])||this._insertPoint_v2(v,Ee,ie),this._plotRecursive_v2(v,ne,ie,z,q,Y,W)),this))},updateParametricCurve_v2:function(v,N,G){var z,q,Y,W,ie=!1,ne=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),se=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),ae,ce,pe,ge,ve;return v.board.updateQuality===v.board.BOARD_QUALITY_LOW?(ae=v.evalVisProp("recursiondepthlow")||13,ce=2,this.smoothLevel=ae-6,this.jumpLevel=3):(ae=v.evalVisProp("recursiondepthhigh")||17,ce=2,this.smoothLevel=ae-9,this.jumpLevel=2),this.nanLevel=ae-4,v.points=[],this.xterm==="x"?(ge=v.board.getBoundingBox(),pe=(ge[2]-ge[0])*.3,z=Math.max(N,ge[0]-pe),q=Math.min(G,ge[2]+pe)):(z=N,q=G),ne.setCoordinates(Const.COORDS_BY_USER,[v.X(z,ie),v.Y(z,ie)],!1),ie=!0,se.setCoordinates(Const.COORDS_BY_USER,[v.X(q,ie),v.Y(q,ie)],!1),ve=this._findStartPoint(v,ne.scrCoords,z,se.scrCoords,q),ne.setCoordinates(Const.COORDS_BY_SCREEN,ve[0],!1),z=ve[1],ve=this._findStartPoint(v,se.scrCoords,q,ne.scrCoords,z),se.setCoordinates(Const.COORDS_BY_SCREEN,ve[0],!1),q=ve[1],this._visibleArea=[z,q],Y=ne.copy("scrCoords"),W=se.copy("scrCoords"),ne._t=z,v.points.push(ne),this._lastCrds=ne.copy("scrCoords"),this._plotRecursive_v2(v,Y,z,W,q,ae,ce),se._t=q,v.points.push(se),v.numberPoints=v.points.length,v},_insertLimesPoint:function(v,N,G,z,q){var Y,W,ie;Math.abs(this._lastUsrCrds[1])===1/0&&Math.abs(q.left_x)===1/0||Math.abs(this._lastUsrCrds[2])===1/0&&Math.abs(q.left_y)===1/0||(Y=new Coords(Const.COORDS_BY_USER,[q.left_x,q.left_y],v.board),Y._t=G,v.points.push(Y),!isNaN(q.left_x)&&!isNaN(q.left_y)&&!isNaN(q.right_x)&&
46!isNaN(q.right_y)&&(Math.abs(q.left_x-q.right_x)>Mat.eps||Math.abs(q.left_y-q.right_y)>Mat.eps)&&(W=new Coords(Const.COORDS_BY_SCREEN,N,v.board),W._t=G,v.points.push(W)),ie=new Coords(Const.COORDS_BY_USER,[q.right_x,q.right_y],v.board),ie._t=G,v.points.push(ie),this._lastScrCrds=ie.copy("scrCoords"),this._lastUsrCrds=ie.copy("usrCoords"))},_insertPoint:function(v,N,G,z,q){var Y=!isNaN(this._lastScrCrds[1]+this._lastScrCrds[2]),W=!isNaN(N[1]+N[2]),ie=v.board.canvasWidth,ne=v.board.canvasHeight,se,ae=.8,ce=500;if(JXG$1.exists(q)){this._insertLimesPoint(v,N,G,z,q);return}W=W&&N[1]>-500&&N[2]>-500&&N[1]<ie+ce&&N[2]<ne+ce,!(!Y&&!W)&&(W&&Y&&Math.abs(N[1]-this._lastScrCrds[1])<ae&&Math.abs(N[2]-this._lastScrCrds[2])<ae||Math.abs(N[1])===1/0&&Math.abs(this._lastUsrCrds[1])===1/0||Math.abs(N[2])===1/0&&Math.abs(this._lastUsrCrds[2])===1/0||(se=new Coords(Const.COORDS_BY_SCREEN,N,v.board),se._t=G,v.points.push(se),this._lastScrCrds=se.copy("scrCoords"),this._lastUsrCrds=se.copy("usrCoords")))},_triangleDists:function(v,N,G){var z,q,Y,W,ie;return z=[v[0]*N[0],(v[1]+N[1])*.5,(v[2]+N[2])*.5],q=Geometry.distance(v,N,3),Y=Geometry.distance(v,G,3),W=Geometry.distance(G,N,3),ie=Geometry.distance(G,z,3),[q,Y,W,ie]},_isUndefined:function(v,N,G,z,q){var Y,W,ie;if(!isNaN(N[1]+N[2])||!isNaN(z[1]+z[2]))return!1;for(ie=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),W=0;W<20;++W)if(Y=G+Math.random()*(q-G),ie.setCoordinates(Const.COORDS_BY_USER,[v.X(Y,!0),v.Y(Y,!0)],!1),!isNaN(ie.scrCoords[0]+ie.scrCoords[1]+ie.scrCoords[2]))return!1;return!0},_isOutside:function(v,N,G,z,q){var Y=500,W=q.canvasWidth,ie=q.canvasHeight;return v[1]<-500&&G[1]<-500||v[2]<-500&&G[2]<-500||v[1]>W+Y&&G[1]>W+Y||v[2]>ie+Y&&G[2]>ie+Y},_isOutsidePoint:function(v,N){var G=500,z=N.canvasWidth,q=N.canvasHeight;return v[1]<-500||v[2]<-500||v[1]>z+G||v[2]>q+G},_findStartPoint:function(v,N,G,z,q){return[N,G]},_getBorderPos:function(v,N,G,z,q,Y,W){var ie,ne,se,ae,ce=30,pe=!1,ge,ve;if(ne=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),ae=0,isNaN(G[1]+G[2])&&!isNaN(q[1]+q[2]))ve=N,ge=z;else if(isNaN(W[1]+W[2])&&!isNaN(q[1]+q[2]))ve=Y,ge=z;else if(isNaN(q[1]+q[2])&&!isNaN(W[1]+W[2]))ve=z,ge=Y;else if(isNaN(q[1]+q[2])&&!isNaN(G[1]+G[2]))ve=z,ge=N;else return!1;do ie=.5*(ge+ve),ne.setCoordinates(Const.COORDS_BY_USER,[v.X(ie,!0),v.Y(ie,!0)],!1),se=ne.usrCoords,pe=isNaN(se[1]+se[2]),pe?ve=ie:ge=ie,++ae;while(ae<ce&&Math.abs(ge-ve)>Mat.eps);return ie},_getCuspPos:function(v,N,G){var z=[v.X(N,!0),v.Y(N,!0)],q=[v.X(G,!0),v.Y(G,!0)],Y=function(W){var ie=[v.X(W,!0),v.Y(W,!0)];return-(Mat.hypot(z[0]-ie[0],z[1]-ie[1])+Mat.hypot(q[0]-ie[0],q[1]-ie[1]))};return Numerics.fminbr(Y,[N,G],v)},_getJumpPos:function(v,N,G){var z=function(q){var Y=Mat.eps*Mat.eps,W=[v.X(q,!0),v.Y(q,!0)],ie=[v.X(q+Y,!0),v.Y(q+Y,!0)];return-Math.abs((ie[1]-W[1])/(ie[0]-W[0]))};return Numerics.fminbr(z,[N,G],v)},_getLimits:function(v,N){var G,z=2/(v.maxX()-v.minX()),q,Y,W,ie;return G=Extrapolate.limit(N,-z,v.X),q=G[0],G[1]==="infinite"&&(q=Math.sign(q)*(1/0)),G=Extrapolate.limit(N,-z,v.Y),W=G[0],G[1]==="infinite"&&(W=Math.sign(W)*(1/0)),G=Extrapolate.limit(N,z,v.X),Y=G[0],G[1]==="infinite"&&(Y=Math.sign(Y)*(1/0)),G=Extrapolate.limit(N,z,v.Y),ie=G[0],G[1]==="infinite"&&(ie=Math.sign(ie)*(1/0)),{left_x:q,left_y:W,right_x:Y,right_y:ie,t:N}},_getLimes:function(v,N,G,z,q,Y,W,ie,ne){var se;return ie==="border"?se=this._getBorderPos(v,N,G,z,q,Y,W):ie==="cusp"?se=this._getCuspPos(v,N,Y):ie==="jump"&&(se=this._getJumpPos(v,N,Y)),this._getLimits(v,se)},_plotNonRecursive:function(v,N,G,z,q,Y){var W,ie,ne,se=0,ae=null,ce,pe,ge=!1,ve="",be,Ee,Pe,Je,Ce,Ve=[],Re=0,qe;for(Pe=v.board.origin.scrCoords,Ve[Re++]=[N,G,z,q,Y,1/0];Re>0;){if(qe=Ve[--Re],N=qe[0],G=qe[1],z=qe[2],q=qe[3],Je=qe[4],Ce=qe[5],ge=!1,ve="",ae=null,v.points.length>65536)return;Je<this.nanLevel&&(this._isUndefined(v,N,G,z,q)||this._isOutside(N,G,z,q,v.board))||(W=(G+q)*.5,be=v.X(W,!0),Ee=v.Y(W,!0),ie=[1,Pe[1]+be*v.board.unitX,Pe[2]-Ee*v.board.unitY],ne=this._triangleDists(N,z,ie),ce=isNaN(N[1]+N[2]),pe=isNaN(z[1]+z[2]),ce&&!pe||!ce&&pe?ve="border":ne[0]>.66*Ce||ne[0]<this.cusp_threshold*(ne[1]+ne[2])||ne[1]>5*ne[2]||ne[2]>5*ne[1]?ve="cusp":(ne[2]>this.jump_threshold*ne[0]||ne[1]>this.jump_threshold*ne[0]||ne[0]===1/0||ne[1]===1/0||ne[2]===1/0)&&(ve="jump"),ge=ve===""&&Je<this.smoothLevel&&ne[3]<this.smooth_threshold,Je<this.testLevel&&!ge&&(ve===""?ge=!0:ae=this._getLimes(v,G,N,W,ie,q,z,ve,Je)),ae!==null?(ie=[1,NaN,NaN],this._insertPoint(v,ie,W,Je,ae)):Je<=se||ge?this._insertPoint(v,ie,W,Je,null):(Ve[Re++]=[ie,W,z,q,Je-1,ne[0]],Ve[Re++]=[N,G,ie,W,Je-1,ne[0]]))}return this},updateParametricCurve_v3:function(v,N,G){var z,q,Y,W,ie=!1,ne=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),se=new Coords(Const.COORDS_BY_USER,[0,0],v.board,!1),ae,ce,pe,ge;return v.board.updateQuality===v.board.BOARD_QUALITY_LOW?ae=v.evalVisProp("recursiondepthlow")||14:ae=v.evalVisProp("recursiondepthhigh")||17,this.smoothLevel=7,this.nanLevel=ae-4,this.testLevel=4,this.cusp_threshold=.5,this.jump_threshold=.99,this.smooth_threshold=2,v.points=[],v.xterm==="x"?(pe=v.board.getBoundingBox(),ce=(pe[2]-pe[0])*.3,z=Math.max(N,pe[0]-ce),q=Math.min(G,pe[2]+ce)):(z=N,q=G),ne.setCoordinates(Const.COORDS_BY_USER,[v.X(z,ie),v.Y(z,ie)],!1),ie=!0,se.setCoordinates(Const.COORDS_BY_USER,[v.X(q,ie),v.Y(q,ie)],!1),ge=this._findStartPoint(v,ne.scrC
46oords,z,se.scrCoords,q),ne.setCoordinates(Const.COORDS_BY_SCREEN,ge[0],!1),z=ge[1],ge=this._findStartPoint(v,se.scrCoords,q,ne.scrCoords,z),se.setCoordinates(Const.COORDS_BY_SCREEN,ge[0],!1),q=ge[1],this._visibleArea=[z,q],Y=ne.copy("scrCoords"),W=se.copy("scrCoords"),ne._t=z,v.points.push(ne),this._lastScrCrds=ne.copy("scrCoords"),this._lastUsrCrds=ne.copy("usrCoords"),this._plotNonRecursive(v,Y,z,W,q,ae),se._t=q,v.points.push(se),v.numberPoints=v.points.length,v},_criticalInterval:function(v,N,G){var z,q,Y,W,ie,ne,se=!1,ae,ce=-1/0,pe=!1,ge=!1,ve=0,be=[],Ee=[],Pe=[];for(ae=Stat.abs(v),W=Stat.median(ae),W<1e-7?(W=1e-7,pe=!0):W*=this.criticalThreshold,z=0;z<N;z++)ae[z]>W?(Pe.push({i:z,v:v[z],group:ve}),ce=z,se||(se=!0)):se&&z>ce+4&&(Pe.length>0&&be.push(Pe.slice(0)),Pe=[],se=!1,ve++);for(se&&Pe.length>1&&be.push(Pe.slice(0)),pe&&be.length===0&&(ge=!0),q=0;q<be.length;q++)if(Ee[q]="point",Y=be[q].length,!(Y<64)){for(ne=0,ie=Math.sign(be[q][0].v),z=1;z<Y;z++)Math.sign(be[q][z].v)!==ie&&(ne++,ie=Math.sign(be[q][z].v));ne*6>Y&&(Ee[q]="interval")}return{smooth:ge,groups:be,types:Ee}},Component:function(){this.left_isNaN=!1,this.right_isNaN=!1,this.left_t=null,this.right_t=null,this.t_values=[],this.x_values=[],this.y_values=[],this.len=0},findComponents:function(v,N,G,z){var q,Y,W,ie,ne,se=[],ae,ce=0,pe=0,ge=0,ve=!1,be=!1;for(W=(G-N)/z,se[ce]=new this.Component,ae=se[ce],q=0,Y=N;q<=z;q++,Y+=W)ie=v.X(Y,be),ne=v.Y(Y,be),isNaN(ie)||isNaN(ne)?(ge++,ge>1&&ve&&(ae.right_isNaN=!0,ae.right_t=Y-W,ae.len=pe,ve=!1,ce++,se[ce]=new this.Component,ae=se[ce],ge=0)):(ve||(ve=!0,pe=0,ge>0&&(ae.left_t=Y-W,ae.left_isNaN=!0)),ge=0,ae.t_values[pe]=Y,ae.x_values[pe]=ie,ae.y_values[pe]=ne,pe++),q===0&&(be=!0);return ve?ae.len=pe:se.pop(),se},getPointType:function(v,N,G,z,q,Y,W){var ie=q[0],ne=Y[0],se=z.length,ae={idx:N,t:G,x:ie[N],y:ne[N],type:"other"};return N<5?(ae.type="borderleft",ae.idx=0,ae.t=z[0],ae.x=ie[0],ae.y=ne[0],ae):(N>W-6&&(ae.type="borderright",ae.idx=se-1,ae.t=z[se-1],ae.x=ie[se-1],ae.y=ne[se-1]),ae)},newtonApprox:function(v,N,G,z,q){var Y,W=0;for(Y=z;Y>0;Y--)W=(W+q[Y][v])*(N-(Y-1)*G)/Y;return W+q[0][v]},thiele:function(v,N,G,z,q){var Y,W=0;for(Y=q;Y>1;Y--)W=(v-G[z+Y])/(N[Y][z+1]-N[Y-2][z+1]+W);return N[0][z+1]+(v-G[z+1])/(N[1][z+1]+W)},differenceMethodExperiments:function(v,N){var G,z,q,Y,W=v.t_values,ie=v.x_values,ne=v.y_values,se=[],ae=[],ce=[],pe=[],ge=[],ve=[],be=[],Ee=[],Pe,Je,Ce=0,Ve,Re,qe,et,Ze,tt=[];for(Pe=W[1]-W[0],ge.push([]),ve.push([]),be.push([]),Ee.push([]),q=ne.length,G=0;G<q;G++)ge[0][G]=ie[G],ve[0][G]=ne[G],be[0][G]=ie[G],Ee[0][G]=ne[G];for(ge.push([]),ve.push([]),be.push([]),Ee.push([]),Je=Pe,q=ne.length-1,G=0;G<q;G++)se[G]=ie[G+1]-ie[G],ae[G]=ne[G+1]-ne[G],ce[G]=se[G],pe[G]=ae[G],ge[1][G]=se[G],ve[1][G]=ae[G],be[1][G]=Je/se[G],Ee[1][G]=Je/ae[G];for(q--,Y=Math.min(8,ne.length-1),z=1;z<Y;z++){for(ge.push([]),ve.push([]),be.push([]),Ee.push([]),Je*=Pe,G=0;G<q;G++)se[G]=se[G+1]-se[G],ae[G]=ae[G+1]-ae[G],ge[z+1][G]=se[G],ve[z+1][G]=ae[G],be[z+1][G]=Je/(be[z][G+1]-be[z][G])+be[z-1][G+1],Ee[z+1][G]=Je/(Ee[z][G+1]-Ee[z][G])+Ee[z-1][G+1];if(Ze=this._criticalPoints(ae,q,z),Ze===!1){console.log("Polynomial of degree",z),Ze=[];break}if(Ze.length>0&&(Ce++,Ce>1&&z%2===0))break;q--}for(G=0;G<Ze.length;G++){for(Re=-1/0,qe=0;qe<Ze[G].length;qe++)et=Math.abs(Ze[G][qe].v),et>Re&&(Re=et,Ve=qe);Ve=Math.floor(Ze[G][Ve].i+z/2),tt.push(this.getPointType(N,Ve,W,ie,ne,ce,pe,q+1))}return[tt,ge,ve,be,Ee]},getCenterOfCriticalInterval:function(v,N,G){var z,q,Y,W,ie=0,ne=0,se=G[1]-G[0],ae,ce=[];for(z=-1/0,ce=[],q=0;q<v.length;q++)W=Math.abs(v[q].v),W>z?(ce=[q],z=W,Y=q):z===W&&ce.push(q);if(ce.length>0&&(ae=ce.reduce(function(pe,ge){return pe+ge},0)/ce.length,Y=Math.floor(ae),ae+=v[0].i),z<1/0){for(q=0;q<v.length;q++)ie+=Math.abs(v[q].v)*v[q].i,ne+=Math.abs(v[q].v);ae=ie/ne}return ae+=N/2,[v[Y].i+N/2,ae,G[Math.floor(ae)]+se*(ae-Math.floor(ae))]},differenceMethod:function(v,N){var G,z,q,Y,W=v.t_values,ie=v.x_values,ne=v.y_values,se=[],ae=[],ce=0,pe=-1,ge=-1,ve,be,Ee,Pe,Je,Ce=[],Ve,Re=[];for(q=ne.length,se.push(new Float64Array(ie)),ae.push(new Float64Array(ne)),q--,Y=Math.min(12,q),z=0;z<Y&&(se.push(new Float64Array(q)),ae.push(new Float64Array(q)),se[z+1]=se[z].map(function(qe,et,Ze){return Ze[et+1]-qe}),ae[z+1]=ae[z].map(function(qe,et,Ze){return Ze[et+1]-qe}),Pe=this._criticalInterval(ae[z+1],q,z),Pe.smooth===!0&&(ge=z,Ce=[]),Ee=this._criticalInterval(se[z+1],q,z),pe===-1&&Ee.smooth===!0&&(pe=z),!(ge>=0));z++){if(Pe.groups.length>0&&(ce++,ce>2&&(z+1)%2===0)){Ce=Pe.groups,Ve=Pe.types;break}q--}for(G=0;G<Ce.length;G++)Ve[G]!=="interval"&&(be=this.getCenterOfCriticalInterval(Ce[G],z+1,W),ve=Pe[0],ve=Math.floor(be[1]),Je=be[2],Re.push(this.getPointType(N,ve,Je,W,se,ae,q+1)));return[Re,se,ae,pe,ge]},_insertPoint_v4:function(v,N,G,z){var q,Y=null,W,ie,ne=.8;v.points.length>0&&(Y=v.points[v.points.length-1].scrCoords),q=new Coords(Const.COORDS_BY_USER,N,v.board),!(Y!==null&&(W=q.scrCoords[1]-Y[1],ie=q.scrCoords[2]-Y[2],W*W+ie*ie<ne*ne))&&(q._t=G,v.points.push(q))},getInterval:function(v,N,G){var z,q;return Interval.disable(),z=Interval.Interval(N,G),v.board.mathLib=Interval,v.board.mathLibJXG=Interval,q=v.Y(z,!0),v.board.mathLib=Math,v.board.mathLibJXG=JXG$1.Math,q},sign:function(v){return v<0?-1:v>0?1:0},handleBorder:function(v,N,G,z,q){var Y=G.idx,W,ie,ne,se=32,ae,ce,pe,ge,ve,be,Ee,Pe,Je;if(Je=N.t_values[1]-N.t_values[0],G.type==="borderleft"?(W=N.left_isNaN?N.left_t:G.t-Je,ie=W,ne=ie+Je):G.type==="borderright"?(W=N.right_isNaN?N.right_t:G.t+Je,ne=W,ie=ne-Je):console.log("No bordercase!!!"),Ee=this.findComponents(v,ie,ne,se),Ee.length!==0){for(G.type==="borderleft"&&(ie=Ee[0].left_t,ne=Ee[0].t_values[0],Je=Ee[0].t_values[1]-Ee[0].t_values[0],ie=ie===null?ne-Je:ie,W=ie,ae=this.getInterval(v,ie,ne),JXG$1.isObject(ae)&&(ge=ae.lo,ve=ae.hi,ce=v.X(W,!0),pe=q[1][Y]<0?ve:ge,this._insertPoint_v4(v,[1,ce,pe],W))),Pe=Ee[0].t_values.length,be=0;be<Pe;be++)W=Ee[0].t_values[be],ce=Ee[0].x_values[be],pe=Ee[0].y_values[be],this._insertPoint_v4(v,[1,ce,pe],W);G.type==="borderright"&&(ie=Ee[0].t_values[Pe-1],ne=Ee[0].right_t,Je=Ee[0].t_values[1]-Ee[0].t_values[0],ne=ne===null?ie+Je:ne,W=ne,ae=this.getInterval(v,ie,ne),JXG$1.isObject(ae)&&(ge=ae.lo,ve=ae.hi,ce=v.X(W,!0),pe=q[1][Y]>0?ve:ge,this._insertPoint_v4(v,[1,ce,pe],W)))}},_seconditeration_v4:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe;for(W=N.t_values[G.idx-2],ie=N.t_values[G.idx+2],se=this.findComponents(v,W,ie,64),ce=0;ce<se.length;ce++){for(ae=se[ce],ne=this.differenceMethod(ae,v),pe=ne[0],ve=ne[1],be=ne[2],Ee=0,ge=0;ge<=pe.length;ge++){for(ge===pe.length?Pe=ae.len:Pe=pe[ge].idx,Y=Ee;Y<Pe;Y++)!isNaN(ae.x_values[Y])&&!isNaN(ae.y_values[Y])&&this._insertPoint_v4(v,[1,ae.x_values[Y],ae.y_values[Y]],ae.t_values[Y]);ge<pe.length&&(this.handleSingularity(v,ae,pe[ge],ve,be),Ee=pe[ge].idx+1)}Pe=ae.len,ce<se.length-1&&this._insertPoint_v4(v,[1,NaN,NaN],ae.right_t)}return this},_recurse_v4:function(v,N,G,z,q,Y,W,ie){var ne=2,se=(N+G)*.5,ae=v.X(se,!0),ce=v.Y(se,!0),pe,ge;if(ie===0){this._insertPoint_v4(v,[1,NaN,NaN],se);return}pe=(ae-z)*v.board.unitX,ge=(ce-q)*v.board.unitY,Mat.hypot(pe,ge)>ne?this._recurse_v4(v,N,se,z,q,ae,ce,ie-1):this._insertPoint_v4(v,[1,ae,ce],se),pe=(ae-Y)*v.board.unitX,ge=(ce-W)*v.board.unitY,Mat.hypot(pe,ge)>ne?this._recurse_v4(v,se,G,ae,ce,Y,W,ie-1):this._insertPoint_v4(v,[1,ae,ce],se)},handleSingularity:function(v,N,G,z,q){var Y=G.idx,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe=100,Je=5,Ce=3;W=G.t,console.log("HandleSingularity at t =",W),ie=N.t_values[Y-Je],ne=N.t_values[Y+Je],se=this.getInterval(v,ie,ne),JXG$1.isObject(se)?(ge=se.lo,ve=se.hi):q[0][Y-1]<q[0][Y+1]?(ge=q[0][Y-1],ve=q[0][Y+1]):(ge=q[0][Y+1],ve=q[0][Y-1]),pe=v.X(W,!0),be=(q[0][Y-Ce]-q[0][Y-Je])/(N.t_values[Y-Ce]-N.t_values[Y-Je]),Ee=(q[0][Y+Ce]-q[0][Y+Je])/(N.t_values[Y+Ce]-N.t_values[Y+Je]),console.log(":::",be,Ee),be<-100?(this._insertPoint_v4(v,[1,pe,ge],W,!0),Ee<=Pe&&this._insertPoint_v4(v,[1,NaN,NaN],W)):be>Pe?(this._insertPoint_v4(v,[1,pe,ve],W),Ee>=-100&&this._insertPoint_v4(v,[1,NaN,NaN],W)):(ge===-1/0&&(this._insertPoint_v4(v,[1,pe,ge],W,!0),this._insertPoint_v4(v,[1,NaN,NaN],W)),ve===1/0&&(this._insertPoint_v4(v,[1,NaN,NaN],W),this._insertPoint_v4(v,[1,pe,ve],W,!0)),G.t<N.t_values[Y]?(ae=Y-1,ce=Y):(ae=Y,ce=Y+1),ie=N.t_values[ae],ne=N.t_values[ce],this._recurse_v4(v,ie,ne,z[0][ae],q[0][ae],z[0][ce],q[0][ce],10)),Ee<-100?this._insertPoint_v4(v,[1,pe,ve],W):Ee>Pe&&this._insertPoint_v4(v,[1,pe,ge],W)},steps:1021,criticalThreshold:1e3,plot_v4:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce=(G-N)/z,Ve=function(et){return v.Y(et,!0)},Re=function(et){return-v.Y(et,!0)},qe=Ce*.5;for(W=this.findComponents(v,N,G,z),ie=0;ie<W.length;ie++){for(ne=W[ie],pe=this.differenceMethod(ne,v),se=pe[0],ge=pe[1],ve=pe[2],(se.length===0||se[0].type!=="borderleft")&&se.unshift({idx:0,t:ne.t_values[0],x:ne.x_values[0],y:ne.y_values[0],type:"borderleft"}),se[se.length-1].type!=="borderright"&&(Y=ne.t_values.length,se.push({idx:Y-1,t:ne.t_values[Y-1],x:ne.x_values[Y-1],y:ne.y_values[Y-1],type:"borderright"})),ce=0,ae=0;ae<=se.length;ae++){for(ae===se.length?Y=ne.len:Y=se[ae].idx-1,q=ce;q<Y-2;q++)this._insertPoint_v4(v,[1,ne.x_values[q],ne.y_values[q]],ne.t_values[q]),q>=ce+3&&q<Y-3&&ve.length>3&&Math.abs(ve[2][q])>.2*Math.abs(ve[0][q])&&(be=ne.t_values[q],qe=Ce*.25,Je=this.getInterval(v,be,be+Ce),JXG$1.isObject(Je)?ve[2][q]>0?this._insertPoint_v4(v,[1,be+qe,Je.lo],be+qe):this._insertPoint_v4(v,[1,be+Ce-qe,Je.hi],be+Ce-qe):(Ee=Numerics.fminbr(Ve,[be,be+Ce]),Pe=Numerics.fminbr(Re,[be,be+Ce]),Ee<Pe?(this._insertPoint_v4(v,[1,v.X(Ee,!0),v.Y(Ee,!0)],Ee),this._insertPoint_v4(v,[1,v.X(Pe,!0),v.Y(Pe,!0)],Pe)):(this._insertPoint_v4(v,[1,v.X(Pe,!0),v.Y(Pe,!0)],Pe),this._insertPoint_v4(v,[1,v.X(Ee,!0),v.Y(Ee,!0)],Ee))));ae<se.length&&(q=se[ae].idx,se[ae].type==="borderleft"||se[ae].type==="borderright"?this.handleBorder(v,ne,se[ae],ge,ve):this._seconditeration_v4(v,ne,se[ae],ge,ve),ce=se[ae].idx+1+1)}Y=ne.len,ie<W.length-1&&this._insertPoint_v4(v,[1,NaN,NaN],ne.right_t)}},updateParametricCurve_v4:function(v,N,G){var z,q,Y,W;v.xterm==="x"?(W=v.board.getBoundingBox(),Y=(W[2]-W[0])*.3,z=Math.max(N,W[0]-Y),q=Math.min(G,W[2]+Y)):(z=N,q=G),v.points=[],this.plot_v4(v,z,q,this.steps),v.numberPoints=v.points.length},updateParametricCurve:function(v,N,G){return this.updateParametricCurve_v2(v,N,G)}};const Plot=Mat.Plot;Mat.ImplicitPlot=function(v,N,G,z,q){var Y={resolution_out:5,resolution_in:5,max_steps:1024,alpha_0:.05,tol_u0:Mat.eps,tol_newton:1e-7,tol_cusp:.05,tol_progress:1e-4,qdt_box:.2,kappa_0:.2,delta_0:.05,h_initial:.1,h_critical:.001,h_max:1,loop_dist:.09,loop_dir:.99,loop_detection:!0,unitX:10,unitY:10};this.config=JXG$1.merge(Y,N),this.f=G,this.dfx=null,this.dfy=null,J
46XG$1.isFunction(z)?this.dfx=z:this.dfx=function(W,ie){var ne=Mat.eps*Mat.eps;return(this.f(W+ne,ie)-this.f(W-ne,ie))*.5/ne},JXG$1.isFunction(q)?this.dfy=q:this.dfy=function(W,ie){var ne=Mat.eps*Mat.eps;return(this.f(W,ie+ne)-this.f(W,ie-ne))*.5/ne},this.bbox=v,this.qdt=new Quadtree(20,5,v),this.components=[]};JXG$1.extend(Mat.ImplicitPlot.prototype,{plot:function(){var v,N,G,z,q,Y,W=[],ie=[],ne=[],se=0,ae,ce=this,pe=function(Ee){return ce.f(v,Ee)},ge=function(Ee){return-ce.f(v,Ee)},ve=function(Ee){return ce.f(Ee,N)},be=function(Ee){return-ce.f(Ee,N)};for(G=Math.min(this.bbox[0],this.bbox[2])-Mat.eps,z=Math.max(this.bbox[0],this.bbox[2]),q=Math.min(this.bbox[1],this.bbox[3])+Mat.eps,Y=Math.max(this.bbox[1],this.bbox[3]),ae=this.config.resolution_out/this.config.unitX,ae*=1+Mat.eps,v=G;v<z;v+=ae)ne=this.searchLine(pe,ge,v,[q,Y],"vertical",se,W,ie,20),ne!==!1&&(W=ne[0],ie=ne[1],se=ne[2]);for(ae=this.config.resolution_out/this.config.unitY,ae*=1+Mat.eps,N=q;N<Y;N+=ae)ne=this.searchLine(ve,be,N,[G,z],"horizontal",se,W,ie,20),ne!==!1&&(W=ne[0],ie=ne[1],se=ne[2]);return[W,ie,se]},searchLine:function(v,N,G,z,q,Y,W,ie,ne){var se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze=this.config.tol_u0,tt=z[0],Ke=z[1];if(se=Numerics.fminbr(v,[tt,Ke]),ge=v(se),ae=Numerics.fminbr(N,[tt,Ke]),ve=v(ae),ge<Ze&&ve>-Ze){if(be=se,se=Math.min(be,ae),ae=Math.max(be,ae),ce=Numerics.fzero(v,[se,ae]),pe=v(ce),Math.abs(pe)>Math.max((ve-ge)*Mat.eps,.001))return!1;if(q==="vertical"?(Je=[1,G,ce],et=this.config.resolution_in/this.config.unitY):(Je=[1,ce,G],et=this.config.resolution_in/this.config.unitX),et*=1+Mat.eps,Pe=this.curveContainsPoint(Je,W,ie,et*2,this.config.qdt_box),!Pe){if(Re=this.traceComponent(Je,1),Re[0].length>0){for(Y>0&&(W.push(NaN),ie.push(NaN)),qe=W.length,Ve=Re[0].length,Ce=1;Ce<Ve;Ce++)this.qdt.insertItem({xlb:Math.min(Re[0][Ce-1],Re[0][Ce]),xub:Math.max(Re[0][Ce-1],Re[0][Ce]),ylb:Math.min(Re[1][Ce-1],Re[1][Ce]),yub:Math.max(Re[1][Ce-1],Re[1][Ce]),idx1:qe+Ce-1,idx2:qe+Ce,comp:Y});Y++,JXG$1.concat(W,Re[0]),JXG$1.concat(ie,Re[1])}}return Ee=ce-et*.01,Ee-tt>et&&ne>0&&(Re=this.searchLine(v,N,G,[tt,Ee],q,Y,W,ie,ne-1),Re!==!1&&(W=Re[0],ie=Re[1],Y=Re[2])),Ee=ce+et*.01,Ke-Ee>et&&ne>0&&(Re=this.searchLine(v,N,G,[Ee,Ke],q,Y,W,ie,ne-1),Re!==!1&&(W=Re[0],ie=Re[1],Y=Re[2])),[W,ie,Y]}return!1},curveContainsPoint:function(v,N,G,z,q){var Y,W,ie,ne,se=v[1],ae=v[2];for(ie=this.qdt.find([se-q,ae+q,se+q,ae-q]),W=ie.length,Y=0;Y<W;Y++)if(ne=Geometry.distPointSegment(v,[1,N[ie[Y].idx1],G[ie[Y].idx1]],[1,N[ie[Y].idx2],G[ie[Y].idx2]]),ne<z)return!0;return!1},traceComponent:function(v){var N=[],G=[],z=[];return z=this.tracing(v,1),z.length===0||(N=z[0],G=z[1]),z[2]||(z=this.tracing(v,-1),z.length===0||(N=z[0].reverse().concat(N.slice(1)),G=z[1].reverse().concat(G.slice(1)))),N.length>0&&N.length<6&&(N.push(N[N.length-1]),G.push(G[G.length-1])),[N,G]},tracing:function(v,N){var G=[],z=[],q=[],Y,W,ie,ne,se,ae,ce=0,pe=0,ge=!1,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et=!1,Ze=!1,tt=this.config.kappa_0,Ke=this.config.delta_0,rt=this.config.alpha_0,it=this.config.h_initial,ot=this.config.max_steps,ut=N,ct=[],at=[],st=[],pt,lt,vt,dt;if(G=v.slice(1),ct.push(G[0]),at.push(G[1]),Y=this.tangent(G),Y===!1)return[];this.dfx(G[0],G[1]),this.dfy(G[0],G[1]);do{if(Y=this.tangent(G),Y===!1){G=z.slice(),ct.push(G[0]),at.push(G[1]);break}if(ct.length===1)ie=Y.slice();else if(ct.length===2)st.push(ct.length-1);else if(et&&ct.length>2&&!Ze){if(Pe=Geometry.distPointSegment([1,G[0],G[1]],[1,ct[0],at[0]],[1,ct[1],at[1]]),Pe<this.config.loop_dist*it&&Mat.innerProduct(Y,ie,2)>this.config.loop_dir){G=v.slice(1),ct.push(G[0]),at.push(G[1]),ge=!0;break}if(this.config.loop_detection){for(pt=ct.length-1,lt=Math.floor(Mat.log2(pt)),vt=0;vt<=lt&&(Pe=Geometry.distPointSegment([1,G[0],G[1]],[1,ct[st[vt]-1],at[st[vt]-1]],[1,ct[st[vt]],at[st[vt]]]),!(Pe<this.config.loop_dist*it&&(W=this.tangent([ct[st[vt]],at[st[vt]]]),Mat.innerProduct(Y,W,2)>this.config.loop_dir)));vt++);if(vt<=lt){ge=!0;break}for(lt=1,dt=0,vt=0;vt<100&&(pt+1)%lt===0;vt++)lt*=2,dt++;st[dt]=pt}}z[0]=G[0]+it*ut*Y[0],z[1]=G[1]+it*ut*Y[1],pe=0;do ne=[this.dfx(z[0],z[1]),this.dfy(z[0],z[1])],Ee=ne[0]*ne[0]+ne[1]*ne[1],se=this.f(z[0],z[1])/Ee,q[0]=z[0]-ne[0]*se,q[1]=z[1]-ne[1]*se,pe===0?ve=Math.abs(se)*Math.sqrt(Ee):pe===1&&(be=Math.abs(se)*Math.sqrt(Ee)),z[0]=q[0],z[1]=q[1],pe++;while(pe<20&&Math.abs(this.f(z[0],z[1]))>this.config.tol_newton);
46if(Ve=ve,pe>1?Ce=be/ve:Ce=0,W=this.tangent(z),ae=Mat.innerProduct(Y,W,2),ae=Math.max(-1,Math.min(1,ae)),Re=Math.acos(ae),Ze=!1,Je=Geometry.distance(G,z,2),Je<this.config.tol_progress){G=z.slice(),ct.push(G[0]),at.push(G[1]);break}else if(ae<0&&!(it>this.config.h_critical))if(Ze=!0,this.isBifurcation(G,this.config.tol_cusp))ut*=-1,Re=0;else{G=z.slice(),ct.push(G[0]),at.push(G[1]);break}if(!Ze&&(qe=Math.max(Math.sqrt(Ce/tt),Math.sqrt(Ve/Ke),Re/rt),isNaN(qe)&&(qe=1),qe=Math.max(Math.min(qe,2),.5),it/=qe,it=Math.min(this.config.h_max,it),qe>=2)){if(ce++,ce>=3*ot)break;et=!1;continue}G=z.slice(),ct.push(G[0]),at.push(G[1]),et=!0,ce++}while(ce<ot&&G[0]>=this.bbox[0]&&G[1]<=this.bbox[1]&&G[0]<=this.bbox[2]&&G[1]>=this.bbox[3]);return[ct,at,ge]},isBifurcation:function(v,N){var G=Mat.eps*Mat.eps*100,z,q,Y,W,ie,ne,se,ae,ce,pe;return z=v[0],q=v[1],Y=.5*(this.dfx(z+G,q)-this.dfx(z-G,q))/G,W=.5*(this.dfx(z,q+G)-this.dfx(z,q-G))/G,ie=.5*(this.dfy(z+G,q)-this.dfy(z-G,q))/G,ne=.5*(this.dfy(z,q+G)-this.dfy(z,q-G))/G,se=Y+ne,pe=se*se-4*(Y*ne-W*ie),ae=.5*(se+Math.sqrt(pe)),ce=.5*(se-Math.sqrt(pe)),Math.abs(ae)>N&&Math.abs(ce)>N},handleCriticalPoint:function(v,N,G,z){var q=Math.atan2(z*N[1],z*N[0]),Y=function(se){var ae=v[0]+G*Math.cos(se),ce=v[1]+G*Math.sin(se);return this.f(ae,ce)},W,ie,ne;return ne=Numerics.root(Y,q),W=v[0]+G*Math.cos(ne),ie=v[1]+G*Math.sin(ne),[W,ie]},updateA:function(v,N,G){var z=[G[0]-N[0],G[1]-N[1]],q=this.f(G[0],G[1])-this.f(N[0],N[1]),Y,W;return W=z[0]*z[0]+z[1]*z[1],Y=q-(v[0]*z[0]+v[1]*z[1]),Y/=W,v[0]+=Y*z[0],v[1]+=Y*z[1],v},tangent_A:function(v){var N=[-v[1],v[0]],G=Mat.norm(N,2);return G<Mat.eps,[N[0]/G,N[1]/G]},tangent:function(v){var N=[-this.dfy(v[0],v[1]),this.dfx(v[0],v[1])],G=Mat.norm(N,2);return G<Mat.eps*Mat.eps?!1:[N[0]/G,N[1]/G]}});const ImplicitPlot=Mat.ImplicitPlot;Mat.Metapost={MP_ENDPOINT:0,MP_EXPLICIT:1,MP_GIVEN:2,MP_CURL:3,MP_OPEN:4,MP_END_CYCLE:5,UNITY:1,FRACTION_ONE:1,FRACTION_THREE:3,ONE_EIGHTY_DEG:Math.PI,THREE_SIXTY_DEG:2*Math.PI,EPS_SQ:1e-5*1e-5,make_choices:function(v){var N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee=!0;ie=v[0];do{if(!ie)break;W=ie.next,ie.rtype>this.MP_EXPLICIT&&(ie.x-W.x)*(ie.x-W.x)+(ie.y-W.y)*(ie.y-W.y)<this.EPS_SQ&&(ie.rtype=this.MP_EXPLICIT,ie.ltype===this.MP_OPEN&&(ie.ltype=this.MP_CURL,ie.set_left_curl(this.UNITY)),W.ltype=this.MP_EXPLICIT,W.rtype===this.MP_OPEN&&(W.rtype=this.MP_CURL,W.set_right_curl(this.UNITY)),ie.rx=ie.x,W.lx=ie.x,ie.ry=ie.y,W.ly=ie.y),ie=W}while(ie!==v[0]);for(G=v[0];Ee&&!(G.ltype!==this.MP_OPEN||G.rtype!==this.MP_OPEN);)if(G=G.next,G===v[0]){G.ltype=this.MP_END_CYCLE;break}for(ie=G;Ee&&ie;){if(W=ie.next,ie.rtype>=this.MP_GIVEN){for(;W.ltype===this.MP_OPEN&&W.rtype===this.MP_OPEN;)W=W.next;for(z=0,ne=ie,Y=v.length,pe=[],ge=[],ve=[],be=[null];Ee&&(ae=ne.next,pe.push(ae.x-ne.x),ge.push(ae.y-ne.y),ve.push(this.mp_pyth_add(pe[z],ge[z])),z>0&&(ce=ge[z-1]/ve[z-1],se=pe[z-1]/ve[z-1],be.push(Math.atan2(ge[z]*se-pe[z]*ce,pe[z]*se+ge[z]*ce))),z++,ne=ae,ne===W&&(Y=z),!(z>=Y&&ne.ltype!==this.MP_END_CYCLE)););z===Y?be.push(0):be.push(be[1]),W.ltype===this.MP_OPEN&&(q=W.rx-W.x,N=W.ry-W.y,q*q+N*N<this.EPS_SQ?(W.ltype=this.MP_CURL,W.set_left_curl(this.UNITY)):(W.ltype=this.MP_GIVEN,W.set_left_given(Math.atan2(N,q)))),ie.rtype===this.MP_OPEN&&ie.ltype===this.MP_EXPLICIT&&(q=ie.x-ie.lx,N=ie.y-ie.ly,q*q+N*N<this.EPS_SQ?(ie.rtype=this.MP_CURL,ie.set_right_curl(this.UNITY)):(ie.rtype=this.MP_GIVEN,ie.set_right_given(Math.atan2(N,q)))),this.mp_
46solve_choices(ie,W,Y,pe,ge,ve,be)}else ie.rtype===this.MP_ENDPOINT&&(ie.rx=ie.x,ie.ry=ie.y,W.lx=W.x,W.ly=W.y);if(ie=W,ie===G)break}},mp_solve_choices:function(v,N,G,z,q,Y,W){var ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut,ct,at,st=!0;for(ce=Y.length+1,Ee=new Array(ce),be=new Array(ce),se=new Array(ce),Re=new Array(ce),ct=0;ct<ce;ct++)Re[ct]=se[ct]=be[ct]=Ee[ct]=0;for(ge=0,ve=v,Je=0;st;){if(Ce=ve.next,ge===0)if(ve.rtype===this.MP_GIVEN){if(Ce.ltype===this.MP_GIVEN){ie=Math.atan2(q[0],z[0]),tt=this.mp_n_sin_cos(v.right_given()-ie),Ke=tt[0],rt=tt[1],it=this.mp_n_sin_cos(N.left_given()-ie),ot=it[0],ut=it[1],this.mp_set_controls(v,N,z[0],q[0],rt,Ke,-ut,ot);return}se[0]=ve.right_given()-Math.atan2(q[0],z[0]),se[0]=this.reduce_angle(se[0]),Ee[0]=0,be[0]=0}else if(ve.rtype===this.MP_CURL){if(Ce.ltype===this.MP_CURL){v.rtype=this.MP_EXPLICIT,N.ltype=this.MP_EXPLICIT,Pe=Math.abs(N.left_tension()),qe=Math.abs(v.right_tension()),Ve=this.UNITY/(3*qe),v.rx=v.x+z[0]*Ve,v.ry=v.y+q[0]*Ve,Ve=this.UNITY/(3*Pe),N.lx=N.x-z[0]*Ve,N.ly=N.y-q[0]*Ve;return}Ze=ve.right_curl(),Pe=Math.abs(Ce.left_tension()),qe=Math.abs(ve.right_tension()),Ee[0]=this.mp_curl_ratio(Ze,qe,Pe),se[0]=-W[1]*Ee[0],be[0]=0}else ve.rtype===this.MP_OPEN&&(Ee[0]=0,se[0]=0,be[0]=this.FRACTION_ONE);else if(ve.ltype===this.MP_END_CYCLE||ve.ltype===this.MP_OPEN){if(ie=this.UNITY/(3*Math.abs(Je.right_tension())-this.UNITY),et=Y[ge]*(this.FRACTION_THREE-this.UNITY/Math.abs(Je.right_tension())),ae=this.UNITY/(3*Math.abs(Ce.left_tension())-this.UNITY),pe=Y[ge-1]*(this.FRACTION_THREE-this.UNITY/Math.abs(Ce.left_tension())),Ze=this.FRACTION_ONE-Ee[ge-1]*ie,et=et*Ze,Pe=Math.abs(ve.left_tension()),qe=Math.abs(ve.right_tension()),Pe<qe?et*=Math.pow(Pe/qe,2):Pe>qe&&(pe*=Math.pow(qe/Pe,2)),Ve=pe/(pe+et),Ee[ge]=Ve*ae,ne=-W[ge+1]*Ee[ge],Je.rtype===this.MP_CURL?(be[ge]=0,se[ge]=ne-W[1]*(this.FRACTION_ONE-Ve)):(Ve=(this.FRACTION_ONE-Ve)/Ze,ne=ne-W[ge]*Ve,Ve=Ve*ie,se[ge]=ne-se[ge-1]*Ve,be[ge]=-be[ge-1]*Ve),ve.ltype===this.MP_END_CYCLE){for(ie=0,ae=this.FRACTION_ONE;st&&(ge-=1,ge===0&&(ge=G),ie=se[ge]-ie*Ee[ge],ae=be[ge]-ae*Ee[ge],ge!==G););for(ie=ie/(this.FRACTION_ONE-ae),Re[G]=ie,se[0]=ie,at=1;at<G;at++)se[at]=se[at]+ie*be[at];break}}else{if(ve.ltype===this.MP_CURL){Ze=ve.left_curl(),Pe=Math.abs(ve.left_tension()),qe=Math.abs(Je.right_tension()),Ve=this.mp_curl_ratio(Ze,Pe,qe),Re[G]=-(se[G-1]*Ve)/(this.FRACTION_ONE-Ve*Ee[G-1]);break}if(ve.ltype===this.MP_GIVEN){Re[G]=ve.left_given()-Math.atan2(q[G-1],z[G-1]),Re[G]=this.reduce_angle(Re[G]);break}}Je=ve,ve=Ce,ge+=1}for(ge=G-1;ge>-1;ge--)Re[ge]=se[ge]-Re[ge+1]*Ee[ge];for(ve=v,ge=0;st&&(Ce=ve.next,tt=this.mp_n_sin_cos(Re[ge]),Ke=tt[0],rt=tt[1],it=this.mp_n_sin_cos(-W[ge+1]-Re[ge+1]),ot=it[0],ut=it[1],this.mp_set_controls(ve,Ce,z[ge],q[ge],rt,Ke,ut,ot),ge++,ve=Ce,ge!==G););},mp_n_sin_cos:function(v){return[Math.cos(v),Math.sin(v)]},mp_set_controls:function(v,N,G,z,q,Y,W,ie){var ne,se,ae,ce,pe;ae=Math.abs(N.left_tension()),ne=Math.abs(v.right_tension()),pe=this.mp_velocity(q,Y,W,ie,ne),se=this.mp_velocity(W,ie,q,Y,ae),(v.right_tension()<0||N.left_tension()<0)&&(q>=0&&W>=0||q<=0&&W<=0)&&(ce=Math.abs(q)*ie+Math.abs(W)*Y,ce>0&&(ce*=1.00024414062,v.right_tension()<0&&this.mp_ab_vs_cd(Math.abs(W),this.FRACTION_ONE,pe,ce)<0&&(pe=Math.abs(W)/ce),N.left_tension()<0&&this.mp_ab_vs_cd(Math.abs(q),this.FRACTION_ONE,se,ce)<0&&(se=Math.abs(q)/ce))),v.rx=v.x+(G*Y-z*q)*pe,v.ry=v.y+(z*Y+G*q)*pe,N.lx=N.x-(G*ie+z*W)*se,N.ly=N.y-(z*ie-G*W)*se,v.rtype=this.MP_EXPLICIT,N.ltype=this.MP_EXPLICIT},mp_pyth_add:function(v,N){return Mat.hypot(v,N)},mp_curl_ratio:function(v,N,G){var z=1/N,q=1/G;return Math.min(4,((3-z)*z*z*v+q*q*q)/(z*z*z*v+(3-q)*q*q))},mp_ab_vs_cd:function(v,N,G,z){return v*N===G*z?0:v*N>G*z?1:-1},mp_velocity:function(v,N,G,z,q){return Math.min(4,(2+Math.sqrt(2)*(v-G/16)*(G-v/16)*(N-z))/(1.5*q*(2+(Math.sqrt(5)-1)*N+(3-Math.sqrt(5))*z)))},reduce_angle:function(v){return Math.abs(v)>this.ONE_EIGHTY_DEG&&(v>0?v-=this.THREE_SIXTY_DEG:v+=this.THREE_SIXTY_DEG),v},makeknots:function(v,N){var G,z,q=[];for(z=v.length,G=0;G<z;G++)q.push({x:v[G][0],y:v[G][1],ltype:this.MP_OPEN,rtype:this.MP_OPEN,lx:!1,rx:!1,ly:N,ry:N,left_curl:function(){return this.lx||0},right_curl:function(){return this.rx||0},left_tension:function(){return this.ly||1},right_tension:function(){return this.ry||1},set_right_curl:function(Y){this.rx=Y||0},set_left_curl:function(Y){this.lx=Y||0}});for(z=q.length,G=0;G<z;G++)q[G].next=q[G+1]||q[G],q[G].set_right_given=q[G].set_right_curl,q[G].set_left_given=q[G].set_left_curl,q[G].r
46ight_given=q[G].right_curl,q[G].left_given=q[G].left_curl;return q[z-1].next=q[0],q},curve:function(v,N){var G,z,q,Y,W,ie,ne=!1,se=[],ae=[];N=N||{tension:1,direction:{},curl:{},isClosed:!1},W=1,N.hasOwnProperty("tension")&&(W=JXG$1.evaluate(N.tension)),G=this.makeknots(v,W),z=G.length,JXG$1.exists(N.isClosed)&&JXG$1.evaluate(N.isClosed)&&(ne=!0),ne||(G[0].ltype=this.MP_ENDPOINT,G[0].rtype=this.MP_CURL,G[z-1].rtype=this.MP_ENDPOINT,G[z-1].ltype=this.MP_CURL);for(Y in N)if(N.hasOwnProperty(Y)){if(q=parseInt(Y,10),isNaN(q)||q<0||q>=z)continue;if(ie=N[q],JXG$1.exists(ie.type))switch(ie.type){case"curl":W=JXG$1.evaluate(ie.curl),q===0?(G[q].rtype=this.MP_CURL,G[q].set_right_curl(W)):q===z-1?(G[q].ltype=this.MP_CURL,G[q].set_left_curl(W)):(G[q].ltype=this.MP_CURL,G[q].rtype=this.MP_CURL,G[q].lx=W,G[q].rx=W);break}JXG$1.exists(ie.direction)&&(W=JXG$1.evaluate(ie.direction),JXG$1.isArray(W)?(W[0]!==!1&&(G[q].lx=W[0]*Math.PI/180,G[q].ltype=this.MP_GIVEN),W[1]!==!1&&(G[q].rx=W[1]*Math.PI/180,G[q].rtype=this.MP_GIVEN)):(G[q].lx=W*Math.PI/180,G[q].rx=W*Math.PI/180,G[q].ltype=G[q].rtype=this.MP_GIVEN)),JXG$1.exists(ie.tension)&&(W=JXG$1.evaluate(ie.tension),JXG$1.isArray(W)?(W[0]!==!1&&(G[q].ly=JXG$1.evaluate(W[0])),W[1]!==!1&&(G[q].ry=JXG$1.evaluate(W[1]))):(G[q].ly=W,G[q].ry=W))}for(this.make_choices(G),q=0;q<z-1;q++)se.push(G[q].x),se.push(G[q].rx),se.push(G[q+1].lx),ae.push(G[q].y),ae.push(G[q].ry),ae.push(G[q+1].ly);return se.push(G[z-1].x),ae.push(G[z-1].y),ne&&(se.push(G[z-1].rx),ae.push(G[z-1].ry),se.push(G[0].lx),ae.push(G[0].ly),se.push(G[0].x),ae.push(G[0].y)),[se,ae]}};const Metapost=Mat.Metapost;Mat.Clip={_isSeparator:function(v){return isNaN(v.coords.usrCoords[1])&&isNaN(v.coords.usrCoords[2])},makeDoublyLinkedList:function(v){var N,G=null,z=[],q=v.length;if(q>0)for(N=0;N<q;N++){if(this._isSeparator(v[N])){v[N]._next=v[(N+1)%q],v[N]._prev=v[(q+N-1)%q];continue}G===null&&(G=N,z.push(G)),this._isSeparator(v[(N+1)%q])||N===q-1?(v[N]._next=v[G],v[G]._prev=v[N],v[N]._end=!0,G=null):(v[N]._next=v[(N+1)%q],v[G]._prev=v[N]),this._isSeparator(v[(q+N-1)%q])||(v[N]._prev=v[(q+N-1)%q])}return z},Vertex:function(v,N,G,z,q,Y){this.pos=N,this.intersection=!0,this.coords=v,this.elementClass=Const.OBJECT_CLASS_POINT,this.data={alpha:G,path:z,pathname:q,done:!1,type:Y,idx:0},this.neighbour=null,this.entry_exit=!1},_addToList:function(v,N,G){var z=v.length,q=Mat.eps*Mat.eps;z>0&&Math.abs(v[z-1].coords.usrCoords[0]-N.usrCoords[0])<q&&Math.abs(v[z-1].coords.usrCoords[1]-N.usrCoords[1])<q&&Math.abs(v[z-1].coords.usrCoords[2]-N.usrCoords[2])<q||v.push({pos:G,intersection:!1,coords:N,elementClass:Const.OBJECT_CLASS_POINT})},sortIntersections:function(v){var N,G,z,q,Y,W,ie=[],ne=v.length;for(N=0;N<ne;N++)if(v[N].sort(function(se,ae){return se.data.alpha>ae.data.alpha?1:-1}),v[N].length>0){for(Y=v[N].length-1,z=v[N][0],q=z.data.path[z.pos],W=q._next,N===ne-1&&(q._end=!1),z.data.alpha===0&&z.data.type==="T"?(q.intersection=!0,q.data=z.data,q.neighbour=z.neighbour,q.neighbour.neighbour=q,q.entry_exit=!1,v[N][0]=q):(z._prev=q,z._prev._next=z),G=1;G<=Y;G++)z=v[N][G],z._prev=v[N][G-1],z._prev._next=z;z=v[N][Y],z._next=W,z._next._prev=z,N===ne-1&&(z._end=!0),ie=ie.concat(v[N])}return ie},_inbetween:function(v,N,G){var z,q=Mat.eps*Mat.eps,Y=G[1]-N[1],W=G[2]-N[2],ie=v[1]-N[1],ne=v[2]-N[2];return Y===0&&W===0&&ie===0&&ne===0?!0:(Math.abs(ie)<q&&Math.abs(Y)<q?z=ne/W:z=ie/Y,Math.abs(z)<q&&(z=0),z)},_print_array:function(v){var N,G;for(N=0;N<v.length;N++)try{G="",v[N]._end&&(G=" end"),console.log(N,v[N].coords.usrCoords,v[N].data.type,"	","prev",v[N]._prev.coords.usrCoords,"next",v[N]._next.coords.usrCoords+G)}catch{console.log(N,v[N].coords.usrCoords)}},_print_list:function(v){for(var N=0,G;N<100&&(v.data?G=v.data.alpha:G="-",console.log("	",v.coords.usrCoords,`
47		is:`,v.intersection,"end:",v._end,G,`
48		-:`,v._prev.coords.usrCoords,`
49		+:`,v._next.coords.usrCoords,`
50		n:`,v.intersection?v.neighbour.coords.usrCoords:"-"),!v._end);)v=v._next,N++},_noOverlap:function(v,N,G,z){var q,Y=Math.sqrt(Mat.eps),W,ie,ne,se,ae=!1;for(q=0;q<3;q++)if(W=Math.min(v[q],N[q]),ie=Math.max(v[q],N[q]),ne=Math.min(G[q],z[q]),se=Math.max(G[q],z[q]),ie<ne-Y||W>se+Y){ae=!0;break}return ae},findIntersections:function(v,N,G){var z=[],q=Mat.eps*100,Y,W,ie,ne=v.length,se=N.length,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve=[],Re=[],qe=[],et=[],Ze=!1,tt=!1;for(W=0;W<se;W++)et.push([]);for(Y=0;Y<ne;Y++){if(qe.push([]),this._isSeparator(v[Y])||this._isSeparator(v[(Y+1)%ne])){Ze=!0;continue}if(Ze&&Y===ne-1)break;for(ae=v[Y].coords.usrCoords,ce=v[(Y+1)%ne].coords.usrCoords,W=0;W<se;W++){if(this._isSeparator(N[W])||this._isSeparator(N[(W+1)%se])){tt=!0;continue}if(tt&&W===se-1)break;if(pe=N[W].coords.usrCoords,ge=N[(W+1)%se].coords.usrCoords,!this._noOverlap(ae,ce,pe,ge)&&(z=Geometry.meetSegmentSegment(ae,ce,pe,ge),ve=Geometry.distance(ae,ce,3),be=Geometry.distance(pe,ge,3),z[1]*ve>-q&&z[1]<1-q/ve&&z[2]*be>-q&&z[2]<1-q/be||z[1]===1/0&&z[2]===1/0&&Mat.norm(z[0],3)<q)){if(ie=new Coords(Const.COORDS_BY_USER,z[0],G),Pe="X",Math.abs(z[1])*ve<q||Math.abs(z[2])*be<q)Pe="T",Math.abs(z[1])*ve<q&&(z[1]=0),Math.abs(z[2])*be<q&&(z[2]=0),z[1]===0?ie=new Coords(Const.COORDS_BY_USER,ae,G):ie=new Coords(Const.COORDS_BY_USER,pe,G);else if(z[1]===1/0&&z[2]===1/0&&Mat.norm(z[0],3)<q){Ee=this._inbetween(ae,pe,ge),Ee>=0&&Ee<1&&(Pe="T",ie=new Coords(Const.COORDS_BY_USER,ae,G),z[1]=0,z[2]=Ee,Je=new this.Vertex(ie,Y,z[1],v,"S",Pe),Ce=new this.Vertex(ie,W,z[2],N,"C",Pe),Je.neighbour=Ce,Ce.neighbour=Je,qe[Y].push(Je),et[W].push(Ce)),Ee=this._inbetween(pe,ae,ce),Geometry.distance(ae,pe,3)>q&&Ee>=0&&Ee<1&&(Pe="T",ie=new Coords(Const.COORDS_BY_USER,pe,G),z[1]=Ee,z[2]=0,Je=new this.Vertex(ie,Y,z[1],v,"S",Pe),Ce=new this.Vertex(ie,W,z[2],N,"C",Pe),Je.neighbour=Ce,Ce.neighbour=Je,qe[Y].push(Je),et[W].push(Ce));continue}
50Je=new this.Vertex(ie,Y,z[1],v,"S",Pe),Ce=new this.Vertex(ie,W,z[2],N,"C",Pe),Je.neighbour=Ce,Ce.neighbour=Je,qe[Y].push(Je),et[W].push(Ce)}}}for(Ve=this.sortIntersections(qe),Y=0;Y<Ve.length;Y++)Ve[Y].data.idx=Y,Ve[Y].neighbour.data.idx=Y;return Re=this.sortIntersections(et),[Ve,Re]},_getPosition:function(v,N,G,z){var q=Geometry.det3p(v,N,G),Y=Geometry.det3p(v,G,z),W=Geometry.det3p(N,G,z);return W>=0?q>=0&&Y>=0?"left":"right":q>=0||Y>=0?"left":"right"},_classifyDegenerateIntersections:function(v){var N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be=!0;for(se=Geometry.det3p,ie=0,v._tours=0;be;){if(v.intersection&&v.data.type==="T"&&(N=v._next.coords.usrCoords,G=v._prev.coords.usrCoords,Geometry.distance(v.coords.usrCoords,N,3)<Mat.eps&&(N=v._next._next.coords.usrCoords),Geometry.distance(v.coords.usrCoords,G,3)<Mat.eps&&(G=v._prev._prev.coords.usrCoords),Y=v.neighbour,q=Y._prev.coords.usrCoords,z=Y._next.coords.usrCoords,Geometry.distance(Y.coords.usrCoords,z,3)<Mat.eps&&(z=Y._next._next.coords.usrCoords),Geometry.distance(Y.coords.usrCoords,q,3)<Mat.eps&&(q=Y._prev._prev.coords.usrCoords),ce=se(v.coords.usrCoords,G,q),pe=se(v.coords.usrCoords,N,z),ge=se(v.coords.usrCoords,G,z),ve=se(v.coords.usrCoords,N,q),ce===0&&pe===0&&ge===0&&ve===0&&(v.coords.usrCoords[1]*=1+Math.random()*Mat.eps,v.coords.usrCoords[2]*=1+Math.random()*Mat.eps,Y.coords.usrCoords[1]=v.coords.usrCoords[1],Y.coords.usrCoords[2]=v.coords.usrCoords[2],ce=se(v.coords.usrCoords,G,q),pe=se(v.coords.usrCoords,N,z),ge=se(v.coords.usrCoords,G,z),ve=se(v.coords.usrCoords,N,q)),ae=!1,ce===0?Geometry.affineRatio(v.coords.usrCoords,G,q)<0&&(ae=!0):pe===0?Geometry.affineRatio(v.coords.usrCoords,N,z)<0&&(ae=!0):ge===0?Geometry.affineRatio(v.coords.usrCoords,G,z)>0&&(ae=!0):ve===0&&Geometry.affineRatio(v.coords.usrCoords,N,q)>0&&(ae=!0),ae&&(ne=q,q=z,z=ne,ne=ce,ce=ge,ge=ne,ne=pe,pe=ve,ve=ne),JXG$1.exists(v.delayedStatus)||(v.delayedStatus=[]),ce===0&&pe===0?v.delayedStatus=["on","on"]:ce===0?(W=this._getPosition(N,q,Y.coords.usrCoords,z),v.delayedStatus=["on",W]):pe===0?(W=this._getPosition(G,q,Y.coords.usrCoords,z),v.delayedStatus=[W,"on"]):v.delayedStatus.length===0&&(this._getPosition(G,q,Y.coords.usrCoords,z)!==this._getPosition(N,q,Y.coords.usrCoords,z)?v.data.type="X":v.data.type="B")),JXG$1.exists(v._tours)&&v._tours++,v._tours>3||v._end||ie>1e3){ie>1e3&&console.log("Clipping: _classifyDegenerateIntersections exit"),JXG$1.exists(v._tours)&&delete v._tours;break}v.intersection&&ie++,v=v._next}},_handleIntersectionChains:function(v){for(var N=0,G="Null",z,q=!0,Y=!1,W=!1;q&&(v.intersection===!0&&(v.data.type==="T"&&(v.delayedStatus[0]!=="on"&&v.delayedStatus[1]==="on"?(Y=!0,z=v,G=v.delayedStatus[0]):Y&&v.delayedStatus[0]==="on"&&v.delayedStatus[1]==="on"?v.data.type="B":Y&&v.delayedStatus[0]==="on"&&v.delayedStatus[1]!=="on"&&(Y=!1,G===v.delayedStatus[1]?(z.data.type="DB",v.data.type="DB"):(z.data.type="DX",v.data.type="DX"))),N++),v._end&&(W=!0),!(W&&!Y));){if(N>1e3){console.log("Warning: _handleIntersectionChains: intersection chain reached maximum numbers of iterations");break}v=v._next}},_handleFullyDegenerateCase:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je=[v,N];for(Y=0;Y<2;Y++){for(z=Je[Y],ge=z.length,ce=0,Pe=!0;ce<ge;ce++)if(!z[ce].intersection){Pe=!1;break}if(Pe)for(q=Je[(Y+1)%2],ve=q.length,ce=0;ce<ge;ce++){for(ne=z[ce].coords.usrCoords,se=z[ce]._next.coords.usrCoords,W=[(ne[0]+se[0])*.5,(ne[1]+se[1])*.5,(ne[2]+se[2])*.5],pe=0,be=!1;pe<ve;pe++)if(Math.abs(Geometry.det3p(q[pe].coords.usrCoords,q[(pe+1)%ve].coords.usrCoords,W))<Mat.eps){be=!0;break}if(!be){ie=new Coords(Const.COORDS_BY_USER,W,G),ae={pos:ce,intersection:!1,coords:ie,elementClass:Const.OBJECT_CLASS_POINT},Ee=z[ce]._next,z[ce]._next=ae,ae._prev=z[ce],ae._next=Ee,Ee._prev=ae,z[ce]._end&&(z[ce]._end=!1,ae._end=!0);break}}}},_getStatus:function(v,N){for(var G;v.intersection&&!v._end;)v=v._next;return Geometry.windingNumber(v.coords.usrCoords,N)===0?G="entry":G="exit",[v,G]},markEntryExit:function(v,N,G){var z,q,Y,W,ie,ne,se,ae=!0,ce=null,pe=0;for(ne=G.length,ie=0;ie<ne;ie++)for(se=G[ie],this._classifyDegenerateIntersections(v[se]),this._handleIntersectionChains(v[se]),W=this._getStatus(v[se],N),q=W[0],z=W[1],q._starter=!0,Y=0,ce=null,pe=0;ae&&(q.intersection===!0&&(q.data.type==="X"&&pe===1&&(ce.entry_exit=z,z==="exit"&&(ce.data.type="X"),pe=2),(q.data.type==="X"||q.data.type==="DB")&&(q.entry_exit=z,z=z==="entry"?"exit":"entry"),q.data.type==="DX"&&(pe===0?(ce=q,pe=1):pe===1?(q.entry_exit=z,ce.entry_exit=z,z==="exit"?ce.data.type="X":q.data.type="X",z=z==="entry"?"exit":"entry",ce=null,pe=0):pe===2&&(q.entry_exit=z,q.data.type="X",z=z==="entry"?"exit":"entry",ce=null,pe=0))),q=q._next,!(JXG$1.exists(q._starter)||Y>1e4));)Y++},_stayOnPath:function(v,N){var G=!0;return v.intersection&&v.data.type!=="B"&&(G=N===v.entry_exit),G},_addVertex:function(v,N,G){return!isNaN(N.coords.usrCoords[1])&&!isNaN(N.coords.usrCoords[2])&&v.push(N),N.intersection&&N.data.done?(G&&console.log("Add last intersection point",N.coords.usrCoords,"on",N.data.pathname,N.entry_exit,N.data.type),!0):(N.intersection&&(N.data.done=!0,G&&console.log("Add intersection point",N.coords.usrCoords,"on",N.data.pathname,N.entry_exit,N.data.type)),!1)},tracing:function(v,N,G){for(var z,q,Y,W,ie=0,ne=1e4,se=0,ae=[],ce=!1,pe=!1;se<N.length&&ie<ne;){if(Y=N[se],Y.data.done||Y.data.type!=="X"){se++;continue}ae.length>0&&ae.push([NaN,NaN]),W=Y.data.idx,z=v,ce=this._addVertex(ae,Y,pe),q=Y.entry_exit;do{if(ce)break;if(G==="intersection"&&Y.entry_exit==="entry"||G==="union"&&Y.entry_exit==="exit"||G==="difference"&&z===v==(Y.entry_exit==="exit")){do if(Y=Y._next,ce=this._addVertex(ae,Y,pe),ce)break;while(this._stayOnPath(Y,q));ie++}else{do if(Y=Y._prev,ce=this._addVertex(ae,Y,pe),ce)break;while(this._stayOnPath(Y,q));ie++}if(ce)break;if(!Y.neighbour)return console.log("Tracing: emergency break - no neighbour!!!!!!!!!!!!!!!!!",ie),[[0],[0]];if(Y=Y.neighbour,Y.data.done)break;Y.data.done=!0,q=Y.entry_exit,z=Y.data.path}while(Y.data.idx!==W&&ie<ne);ie>=ne&&console.log("Tracing: stopping an infinite loop!",ie),se++}return this._getCoordsArrays(ae,!1)},isEmptyCase:function(v,N,G){return G==="intersection"&&(v.length===0||N.length===0)||G==="union"&&v.length===0&&N.length===0||G==="difference"&&v.length===0},_getCoordsArrays:function(v,N){var G=[],z=[],q,Y=v.length;for(q=0;q<Y;q++)v[q].coords?(G.push(v[q].coords.usrCoords[1]),z.push(v[q].coords.usrCoords[2])):(G.push(v[q][0]),z.push(v[q][1]));return N&&Y>0&&(v[0].coords?(G.push(v[0].coords.usrCoords[1]),z.push(v[0].coords.usrCoords[2])):(G.push(v[0][0]),z.push(v[0][1]))),[G,z]}
50,handleEmptyIntersection:function(v,N,G){var z,q,Y=!1,W=[];if(v.length===0)return G==="union"?W=N:W=[],this._getCoordsArrays(W,!0);if(N.length===0)return G==="intersection"?W=[]:W=v,this._getCoordsArrays(W,!0);if(v.length>0)for(z=v[0];z.intersection&&(z=z._next,!z._end););if(N.length>0)for(q=N[0];q.intersection&&(q=q._next,!q._end););return Geometry.windingNumber(z.coords.usrCoords,N)===0?Geometry.windingNumber(q.coords.usrCoords,v)!==0?(G==="union"?(JXG$1.concat(W,v),W.push(v[0])):G==="difference"&&(JXG$1.concat(W,v),W.push(v[0]),Geometry.signedPolygon(v)*Geometry.signedPolygon(N)>0&&W.reverse(),W.push([NaN,NaN])),(G==="difference"||G==="intersection")&&(JXG$1.concat(W,N),W.push(N[0]),Y=!1)):G==="difference"?(JXG$1.concat(W,v),Y=!0):G==="union"&&(JXG$1.concat(W,v),W.push(v[0]),W.push([NaN,NaN]),JXG$1.concat(W,N),W.push(N[0])):G==="intersection"?(JXG$1.concat(W,v),Y=!0):G==="union"&&(JXG$1.concat(W,N),W.push(N[0])),this._getCoordsArrays(W,Y)},_countCrossingIntersections:function(v){var N,G=v.length,z=0;for(N=0;N<G;N++)v[N].data.type==="X"&&z++;return z},_getPath:function(v,N){var G,z,q,Y,W,ie,ne,se=[];if(v.elementClass===Const.OBJECT_CLASS_CURVE&&(v.type===Const.OBJECT_TYPE_ARC||v.type===Const.OBJECT_TYPE_SECTOR)){for(W=Geometry.rad(v.radiuspoint,v.center,v.anglepoint),ne=Math.floor(W*180/Math.PI),q=v.Radius(),Y=W/ne,ie=Math.atan2(v.radiuspoint.coords.usrCoords[2]-v.center.coords.usrCoords[2],v.radiuspoint.coords.usrCoords[1]-v.center.coords.usrCoords[1]),v.type===Const.OBJECT_TYPE_SECTOR&&this._addToList(se,v.center.coords,0),G=0;G<=ne;G++)this._addToList(se,new Coords(Const.COORDS_BY_USER,[v.center.coords.usrCoords[0],v.center.coords.usrCoords[1]+Math.cos(G*Y+ie)*q,v.center.coords.usrCoords[2]+Math.sin(G*Y+ie)*q],N),G+1);v.type===Const.OBJECT_TYPE_SECTOR&&this._addToList(se,v.center.coords,ne+2)}else if(v.elementClass===Const.OBJECT_CLASS_CURVE&&JXG$1.exists(v.points))for(z=v.numberPoints,G=0;G<z;G++)this._addToList(se,v.points[G],G);else if(v.type===Const.OBJECT_TYPE_POLYGON)for(G=0;G<v.vertices.length;G++)this._addToList(se,v.vertices[G].coords,G);else if(v.elementClass===Const.OBJECT_CLASS_CIRCLE)for(ne=359,q=v.Radius(),Y=2*Math.PI/ne,G=0;G<=ne;G++)this._addToList(se,new Coords(Const.COORDS_BY_USER,[v.center.coords.usrCoords[0],v.center.coords.usrCoords[1]+Math.cos(G*Y)*q,v.center.coords.usrCoords[2]+Math.sin(G*Y)*q],N),G);else if(JXG$1.isArray(v))for(z=v.length,G=0;G<z;G++)JXG$1.exists(v[G].coords)?this._addToList(se,v[G].coords,G):JXG$1.isArray(v[G])?this._addToList(se,new Coords(Const.COORDS_BY_USER,v[G],N),G):JXG$1.exists(v[G].usrCoords)&&this._addToList(se,v[G],G);return se},greinerHormann:function(v,N,G,z){var q,Y=[],W=[],ie=[],ne,se,ae=[];return Y=this._getPath(v,z),q=Y.length,q>0&&Geometry.distance(Y[0].coords.usrCoords,Y[q-1].coords.usrCoords,3)<Mat.eps&&Y.pop(),W=this._getPath(N,z),q=W.length,q>0&&Geometry.distance(W[0].coords.usrCoords,W[q-1].coords.usrCoords,3)<Mat.eps*Mat.eps&&W.pop(),this.isEmptyCase(Y,W,G)?[[],[]]:(ne=this.makeDoublyLinkedList(Y),se=this.makeDoublyLinkedList(W),ae=this.findIntersections(Y,W,z),ie=ae[0],this._handleFullyDegenerateCase(Y,W,z),this.markEntryExit(Y,W,ne),this.markEntryExit(W,Y,se),this._countCrossingIntersections(ie)===0?this.handleEmptyIntersection(Y,W,G):this.tracing(Y,ie,G))},union:function(v,N,G){return this.greinerHormann(v,N,"union",G)},intersection:function(v,N,G){return this.greinerHormann(v,N,"intersection",G)},difference:function(v,N,G){return this.greinerHormann(v,N,"difference",G)}};const Clip=Mat.Clip;Mat.Poly={};Mat.Poly.Ring=function(v){this.vars=v};JXG$1.extend(Mat.Poly.Ring.prototype,{});Mat.Poly.Monomial=function(v,N,G){var z;if(!JXG$1.exists(v))throw new Error("JSXGraph error: In JXG.Math.Poly.monomial missing parameter 'ring'.");for(JXG$1.isArray(G)||(G=[]),G=G.slice(0,v.vars.length),z=G.length;z<v.vars.length;z++)G.push(0);this.ring=v,this.coefficient=N||0,this.exponents=JXG$1.deepCopy(G)};JXG$1.extend(Mat.Poly.Monomial.prototype,{copy:function(){return new Mat.Poly.Monomial(this.ring,this.coefficient,this.exponents)},print:function(){var v=[],N;for(N=0;N<this.ring.vars.length;
50N++)v.push(this.ring.vars[N]+"^"+this.exponents[N]);return this.coefficient+"*"+v.join("*")}});Mat.Poly.Polynomial=function(v,N){var G=function(){},z;if(!JXG$1.exists(v))throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial missing parameter 'ring'.");JXG$1.exists(N)&&JXG$1.isString(N)?z=G():z=[],this.ring=v,this.monomials=z};JXG$1.extend(Mat.Poly.Polynomial.prototype,{findSignature:function(v){var N;for(N=0;N<this.monomials.length;N++)if(JXG$1.cmpArrays(this.monomials[N].exponents,v))return N;return-1},addSubMonomial:function(v,N){var G;G=this.findSignature(v.exponents),G>-1?this.monomials[G].coefficient+=N*v.coefficient:(v.coefficient*=N,this.monomials.push(v))},add:function(v){var N;if(JXG$1.exists(v)&&v.ring===this.ring)if(JXG$1.isArray(v.exponents))this.addSubMonomial(v,1);else for(N=0;N<v.monomials.length;N++)this.addSubMonomial(v.monomials[N],1);else throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.add either summand is undefined or rings don't match.")},sub:function(v){var N;if(JXG$1.exists(v)&&v.ring===this.ring)if(JXG$1.isArray(v.exponents))this.addSubMonomial(v,-1);else for(N=0;N<v.monomials.length;N++)this.addSubMonomial(v.monomials[N],-1);else throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.sub either summand is undefined or rings don't match.")},copy:function(){var v,N;for(N=new Mat.Poly.Polynomial(this.ring),v=0;v<this.monomials.length;v++)N.monomials.push(this.monomials[v].copy());return N},print:function(){var v=[],N;for(N=0;N<this.monomials.length;N++)v.push("("+this.monomials[N].print()+")");return v.join("+")}});Mat.Poly;JXG$1.Complex=function(v,N){this.isComplex=!0,v&&v.isComplex&&(N=v.imaginary,v=v.real),this.real=v||0,this.imaginary=N||0,this.absval=0,this.angle=0};JXG$1.extend(JXG$1.Complex.prototype,{toString:function(){return this.real+" + "+this.imaginary+"i"},add:function(v){return JXG$1.isNumber(v)?this.real+=v:(this.real+=v.real,this.imaginary+=v.imaginary),this},sub:function(v){return JXG$1.isNumber(v)?this.real-=v:(this.real-=v.real,this.imaginary-=v.imaginary),this},mult:function(v){var N,G;return JXG$1.isNumber(v)?(this.real*=v,this.imaginary*=v):(N=this.real,G=this.imaginary,this.real=N*v.real-G*v.imaginary,this.imaginary=N*v.imaginary+G*v.real),this},div:function(v){var N,G,z;if(JXG$1.isNumber(v)){if(Math.abs(v)<Math.eps)return this.real=1/0,this.imaginary=1/0,this;this.real/=v,this.imaginary/=v}else{if(Math.abs(v.real)<Math.eps&&Math.abs(v.imaginary)<Math.eps)return this.real=1/0,this.imaginary=1/0,this;N=v.real*v.real+v.imaginary*v.imaginary,z=this.real,G=this.imaginary,this.real=(z*v.real+G*v.imaginary)/N,this.imaginary=(G*v.real-z*v.imaginary)/N}return this},conj:function(){return this.imaginary*=-1,this}});JXG$1.C={};JXG$1.C.add=function(v,N){var G=new JXG$1.Complex(v);return G.add(N),G};JXG$1.C.sub=function(v,N){var G=new JXG$1.Complex(v);return G.sub(N),G};JXG$1.C.mult=function(v,N){var G=new JXG$1.Complex(v);return G.mult(N),G};JXG$1.C.div=function(v,N){var G=new JXG$1.Complex(v);return G.div(N),G};JXG$1.C.conj=function(v){var N=new JXG$1.Complex(v);return N.conj(),N};JXG$1.C.abs=function(v){var N=new JXG$1.Complex(v);return N.conj(),N.mult(v),Math.sqrt(N.real)};JXG$1.C.copy=function(v){return new JXG$1.Complex(v)};JXG$1.Complex.C=JXG$1.C;const Complex$1=JXG$1.Complex;var simpleColors={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee9
500",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",venetianred:"ae181e",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},colorDefs=[{re:/^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d.]{1,3})\s*\)\s*$/,example:["rgba(123, 234, 45, 0.5)","rgba(255,234,245,1.0)"],process:function(v){return[parseInt(v[1],10),parseInt(v[2],10),parseInt(v[3],10)]}},{re:/^\s*rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)\s*$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(v){return[parseInt(v[1],10),parseInt(v[2],10),parseInt(v[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(v){return[parseInt(v[1],16),parseInt(v[2],16),parseInt(v[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(v){return[parseInt(v[1]+v[1],16),parseInt(v[2]+v[2],16),parseInt(v[3]+v[3],16)]}}];JXG$1.rgbParser=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe=v,ge;if(!JXG$1.exists(v))return[];if(JXG$1.exists(N)&&JXG$1.exists(G)&&(pe=[v,N,G]),z=pe,ge=!1,JXG$1.isArray(z)){for(ne=0;ne<3;ne++)ge=ge||/\./.test(pe[ne].toString());for(ne=0;ne<3;ne++)ge=ge&&pe[ne]>=0&&pe[ne]<=1;return ge?[Math.ceil(pe[0]*255),Math.ceil(pe[1]*255),Math.ceil(pe[2]*255)]:pe}for(typeof pe=="string"&&(z=pe),z.charAt(0)==="#"&&(z=z.slice(1,7)),z=z.replace(/ /g,"").toLowerCase(),z=simpleColors[z]||z,ne=0;ne<colorDefs.length;ne++)Y=colorDefs[ne].re,W=colorDefs[ne].process,ie=Y.exec(z),ie&&(q=W(ie),se=q[0],ae=q[1],ce=q[2]);return isNaN(se)||isNaN(ae)||isNaN(ce)?[]:(se=se<0||isNaN(se)?0:se>255?255:se,ae=ae<0||isNaN(ae)?0:ae>255?255:ae,ce=ce<0||isNaN(ce)?0:ce>255?255:ce,[se,ae,ce])};JXG$1.isColor=function(v){var N=new Option().style;return N.color=v,N.color!==""};JXG$1.rgb2css=function(v,N,G){var z;return z=JXG$1.rgbParser(v,N,G),"rgb("+z[0]+", "+z[1]+", "+z[2]+")"};JXG$1.rgb2hex=function(v,N,G){var z,q,Y;return z=JXG$1.rgbParser(v,N,G),q=z[1],Y=z[2],z=z[0],z=z.toString(16),q=q.toString(16),Y=Y.toString(16),z.length===1&&(z="0"+z),q.length===1&&(q="0"+q),Y.length===1&&(Y="0"+Y),"#"+z+q+Y};JXG$1.hex2rgb=function(v){return JXG$1.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),JXG$1.rgb2css(v)};JXG$1.hsv2rgb=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce;if(v=(v%360+360)%360,N===0)if(isNaN(v)||v<Mat.eps)z=G,q=G,Y=G;else return"#ffffff";else switch(v>=360?ne=0:ne=v,ne=ne/60,ie=Math.floor(ne),W=ne-ie,se=G*(1-N),ae=G*(1-N*W),ce=G*(1-N*(1-W)),ie){case 0:z=G,q=ce,Y=se;break;case 1:z=ae,q=G,Y=se;break;case 2:z=se,q=G,Y=ce;break;case 3:z=se,q=ae,Y=G;break;case 4:z=ce,q=se,Y=G;break;case 5:z=G,q=se,Y=ae;break}return z=Math.round(z*255).toString(16),z=z.length===2?z:z.length===1?"0"+z:"00",q=Math.round(q*255).toString(16),q=q.length===2?q:q.length===1?"0"+q:"00",Y=Math.round(Y*255).toString(16),Y=Y.length===2?Y:Y.length===1?"0"+Y:"00",["#",z,q,Y].join("")};JXG$1.rgb2hsv=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be;return z=JXG$1.rgbParser(v,N,G),q=z[1],Y=z[2],z=z[0],W=z/255,ie=q/255,ne=Y/255,ve=Math.max(z,q,Y),be=Math.min(z,q,Y),se=ve/255,ae=be/255,ge=se,pe=0,ge>
500&&(pe=(ge-ae)/ge),ce=1/(se-ae),pe>0&&(ve===z?ce=(ie-ne)*ce:ve===q?ce=2+(ne-W)*ce:ce=4+(W-ie)*ce),ce*=60,ce<0&&(ce+=360),ve===be&&(ce=0),[ce,pe,ge]};JXG$1.rgb2LMS=function(v,N,G){var z,q,Y,W,ie,ne,se,ae=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return z=JXG$1.rgbParser(v,N,G),q=z[1],Y=z[2],z=z[0],z=Math.pow(z,.476190476),q=Math.pow(q,.476190476),Y=Math.pow(Y,.476190476),W=z*ae[0][0]+q*ae[0][1]+Y*ae[0][2],ie=z*ae[1][0]+q*ae[1][1]+Y*ae[1][2],ne=z*ae[2][0]+q*ae[2][1]+Y*ae[2][2],se=[W,ie,ne],se.l=W,se.m=ie,se.s=ne,se};JXG$1.LMS2rgb=function(v,N,G){var z,q,Y,W,ie=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-.37569,-1.199062,14.273846]],ne=function(se){for(var ae=127,ce=64;ce>0;){if(Math.pow(ae,.476190476)>se)ae-=ce;else{if(Math.pow(ae+1,.476190476)>se)return ae;ae+=ce}ce/=2}return ae===254&&13.994955247<se?255:ae};return z=v*ie[0][0]+N*ie[0][1]+G*ie[0][2],q=v*ie[1][0]+N*ie[1][1]+G*ie[1][2],Y=v*ie[2][0]+N*ie[2][1]+G*ie[2][2],z=ne(z),q=ne(q),Y=ne(Y),W=[z,q,Y],W.r=z,W.g=q,W.b=Y,W};JXG$1.rgba2rgbo=function(v){var N;return v.length===9&&v.charAt(0)==="#"?(N=parseInt(v.slice(7,9).toUpperCase(),16)/255,v=v.slice(0,7)):N=1,[v,N]};JXG$1.rgbo2rgba=function(v,N){var G;return v==="none"||v==="transparent"?v:(G=Math.round(N*255).toString(16),G.length===1&&(G="0"+G),JXG$1.rgb2hex(v)+G)};JXG$1.rgb2bw=function(v){var N,G,z,q="0123456789ABCDEF";return v==="none"||(z=JXG$1.rgbParser(v),N=Math.floor(.3*z[0]+.59*z[1]+.11*z[2]),G=q.charAt(N>>4&15)+q.charAt(N&15),v="#"+G+G+G),v};JXG$1.rgb2cb=function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be="0123456789ABCDEF";if(v==="none")return v;switch(W=JXG$1.rgb2LMS(v),z=W[0],q=W[1],Y=W[2],N=N.toLowerCase(),N){case"protanopia":ne=-.06150039994295001,se=.08277001656812001,ae=-.013200141220000003,ce=.05858939668799999,pe=-.07934519995360001,ge=.013289415272000003,ve=.6903216543277437,ie=Y/q,ie<ve?z=-(se*q+ae*Y)/ne:z=-(pe*q+ge*Y)/ce;break;case"tritanopia":ne=-.00058973116217,se=.007690316482,ae=-.01011703519052,ce=.025495080838999994,pe=-.0422740347,ge=.017005316784,ve=.8349489908460004,ie=q/z,ie<ve?Y=-(ne*z+se*q)/ae:Y=-(ce*z+pe*q)/ge;break;default:ne=-.06150039994295001,se=.08277001656812001,ae=-.013200141220000003,ce=.05858939668799999,pe=-.07934519995360001,ge=.013289415272000003,ve=.5763833686400911,ie=Y/z,ie<ve?q=-(ne*z+ae*Y)/se:q=-(ce*z+ge*Y)/pe;break}return G=JXG$1.LMS2rgb(z,q,Y),ie=be.charAt(G[0]>>4&15)+be.charAt(G[0]&15),v="#"+ie,ie=be.charAt(G[1]>>4&15)+be.charAt(G[1]&15),v+=ie,ie=be.charAt(G[2]>>4&15)+be.charAt(G[2]&15),v+=ie,v};JXG$1.shadeColor=function(v,N){var G=JXG$1.rgbParser(v),z=G[0],q=G[1],Y=G[2];return z=parseInt(z+255*N),q=parseInt(q+255*N),Y=parseInt(Y+255*N),z=z>0?z:0,q=q>0?q:0,Y=Y>0?Y:0,z=z<255?z:255,q=q<255?q:255,Y=Y<255?Y:255,z=Math.round(z),q=Math.round(q),Y=Math.round(Y),JXG$1.rgb2hex([z,q,Y])};JXG$1.lightenColor=function(v,N){return JXG$1.shadeColor(v,N)};JXG$1.darkenColor=function(v,N){return JXG$1.shadeColor(v,-1*N)};JXG$1.autoHighlight=function(v){var N=JXG$1.rgba2rgbo(v),G=N[0],z=N[1];return v.charAt(0)==="#"?(z<.3?z*=1.8:z*=.4,JXG$1.rgbo2rgba(G,z)):v};JXG$1.contrast=function(v,N,G,z){var q,Y="#000000",W,ie,ne,se;return N=N||"#000000",G=G||"#ffffff",z=z||7,q=JXG$1.rgbParser(v),W=JXG$1.rgbParser(Y),ie=.2126*Math.pow(q[0]/255,2.2)+.7152*Math.pow(q[1]/255,2.2)+.0722*Math.pow(q[2]/255,2.2),ne=.2126*Math.pow(W[0]/255,2.2)+.7152*Math.pow(W[1]/255,2.2)+.0722*Math.pow(W[2]/255,2.2),ie>ne?se=Math.floor((ie+.05)/(ne+.05)):se=Math.floor((ne+.05)/(ie+.05)),se=se-1,se>z?N:G};JXG$1.setClassicColors=function(){JXG$1.Options.elements.strokeColor="blue",JXG$1.Options.elements.fillColor="red",JXG$1.Options.hatch.strokeColor="blue",JXG$1.Options.angle.fillColor="#ff7f00",JXG$1.Options.angle.highlightFillColor="#ff7f00",JXG$1.Options.angle.strokeColor="#ff7f00",JXG$1.Options.angle.label.strokeColor="blue",JXG$1.Options.arc.strokeColor="blue",JXG$1.Options.circle.center.fillColor="red",JXG$1.Options.circle.center.strokeColor="blue",JXG$1.Options.circumcircle.strokeColor="blue",JXG$1.Options.circumcircle.center.fillColor="red",JXG$1.Options.circumcircle.center.strokeColor="blue",JXG$1.Options.circumcirclearc.strokeColor="blue",JXG$1.Options.circumcirclesector.strokeColor="blue",JXG$1.Options.circumcirclesector.fillColor="green",JXG$1.Options.circumcirclesector.highlightFillColor="green",JXG$1.Options.conic.strokeColor="blue",JXG$1.Options.curve.strokeColor="blue",JXG$1.Options.incircle.strokeColor="blue",JXG$1.Options.incircle.center.fillColor="red",JXG$1.Options.incircle.center.strokeColor="blue",JXG$1.Options.inequality.fillColor="red",JXG$1.Options.integral.fillColor="red",JXG$1.Options.integral.curveLeft.color="red",JXG$1.Options.integral.curveRight.color="red",JXG$1.Options.line.strokeColor="blue",JXG$1.Options.point.fillColor="red",JXG$1.Options.point.strokeColor="red",JXG$1.Options.polygon.fillColor="green",JXG$1.Options.polygon.highlightFillColor="green",JXG$1.Options.polygon.vertices.strokeColor="red",JXG$1.Options.polygon.vertices.fillColor="red",JXG$1.Options.regularpolygon.fillColor="green",JXG$1.Options.regularpolygon.highlightFillColor="green",JXG$1.Options.regularpolygon.vertices.strokeColor="red",JXG$1.Options.regularpolygon.vertices.fillColor="red",JXG$1.Options.riemannsum.fillColor="yellow",JXG$1.Options.sector.fillColor="green",JXG$1.Options.sector.highlightFillColor="green",JXG$1.Options.semicircle.center.fillColor="red",JXG$1.Options.semicircle.center.strokeColor="blue",JXG$1.Options.slopetriangle.fillColor="red",JXG$1.Options.slopetriangle.highlightFillColor="red",JXG$1.Options.turtle.arrow.strokeColor="blue"};
50JXG$1.extend(JXG$1,{paletteWong:{black:"#000000",orange:"#E69F00",skyblue:"#56B4E9",bluishgreen:"#009E73",yellow:"#F0E442",darkblue:"#0072B2",vermillion:"#D55E00",reddishpurple:"#CC79A7",blue:"#0072B2",red:"#D55E00",green:"#009E73",purple:"#CC79A7",white:"#ffffff"}});JXG$1.palette=JXG$1.paletteWong;JXG$1.Options={jc:{enabled:!0,compile:!0},board:{animationDelay:35,axis:!1,boundingBox:[-5,5,5,-5],browserPan:!1,clickDelay:600,dblClickSuppressClick:!1,defaultAxes:{x:{name:"x",fixed:!0,needsRegularUpdate:!1,ticks:{label:{visible:"inherit",anchorX:"middle",anchorY:"top",fontSize:12,offset:[0,-3]},tickEndings:[0,1],majorTickEndings:[1,1],drawZero:!1,visible:"inherit"}},y:{name:"y",fixed:!0,needsRegularUpdate:!1,ticks:{label:{visible:"inherit",anchorX:"right",anchorY:"middle",fontSize:12,offset:[-6,0]},tickEndings:[1,0],majorTickEndings:[1,1],drawZero:!1,visible:"inherit"}}},document:!1,drag:{enabled:!0},fullscreen:{symbol:'<svg height="1em" width="1em" version="1.1" viewBox="10 10 18 18"><path fill="#666" d="m 10,16 2,0 0,-4 4,0 0,-2 L 10,10 l 0,6 0,0 z"></path><path fill="#666" d="m 20,10 0,2 4,0 0,4 2,0 L 26,10 l -6,0 0,0 z"></path><path fill="#666" d="m 24,24 -4,0 0,2 L 26,26 l 0,-6 -2,0 0,4 0,0 z"></path><path fill="#666" d="M 12,20 10,20 10,26 l 6,0 0,-2 -4,0 0,-4 0,0 z"></path></svg>',scale:.85,id:null},ignoreLabels:!0,intl:{enabled:!1},keepAspectRatio:!1,keyboard:{enabled:!0,dx:10,dy:10,panShift:!0,panCtrl:!1},logging:{enabled:!1},minimizeReflow:"none",maxBoundingBox:[-1/0,1/0,1/0,-1/0],maxFrameRate:40,maxNameLength:1,moveTarget:null,offsetX:0,offsetY:0,pan:{enabled:!0,needShift:!0,needTwoFingers:!1},registerEvents:!0,renderer:"auto",resize:{enabled:!0,throttle:10},screenshot:{scale:1,type:"png",symbol:"⌘",css:"background-color:#eeeeee; opacity:1.0; border:2px solid black; border-radius:10px; text-align:center",cssButton:"padding: 4px 10px; border: solid #356AA0 1px; border-radius: 5px; position: absolute; right: 2ex; top: 2ex; background-color: rgba(255, 255, 255, 0.3);"},selection:{enabled:!1,name:"selectionPolygon",needShift:!1,needCtrl:!0,fillColor:"#ffff00",visible:!1,withLines:!1,vertices:{visible:!1}},showClearTraces:!1,showCopyright:!0,showFullscreen:!1,showInfobox:!0,showNavigation:!0,showReload:!1,showScreenshot:!1,showZoom:!0,takeFirst:!1,takeSizeFromFile:!1,theme:"default",title:"",zoom:{enabled:!0,factorX:1.25,factorY:1.25,wheel:!0,needShift:!0,center:"auto",min:1e-4,max:1e4,pinch:!0,pinchHorizontal:!0,pinchVertical:!0,pinchSensitivity:7},zoomX:1,zoomY:1},navbar:{strokeColor:"#333333",fillColor:"transparent",highlightFillColor:"#aaaaaa",padding:"2px",position:"absolute",fontSize:"14px",cursor:"pointer",zIndex:"100",right:"5px",bottom:"5px"},elements:{aria:{enabled:!1,label:"",live:"assertive"},cssClass:"",highlightCssClass:"",dash:0,dashScale:!1,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1},dragToTopOfLayer:!1,element3D:null,fillColor:JXG$1.palette.red,fillOpacity:1,fixed:!1,frozen:!1,gradient:null,gradientAngle:0,gradientCX:.5,gradientCY:.5,gradientEndOffset:1,gradientFX:.5,gradientFY:.5,gradientFR:0,gradientR:.5,gradientSecondColor:"#ffffff",gradientSecondOpacity:1,gradientStartOffset:0,highlight:!0,highlightFillColor:"none",highlightFillOpacity:1,highlightStrokeColor:"#c3d9ff",highlightStrokeOpacity:1,highlightStrokeWidth:2,isLabel:!1,layer:0,lineCap:"butt",needsRegularUpdate:!0,nonnegativeOnly:!1,precision:"inherit",priv:!1,rotatable:!0,scalable:!0,shadow:{enabled:!1,color:[0,0,0],opacity:1,blur:3,blend:.1,offset:[5,5]},snapToGrid:!1,strokeColor:JXG$1.palette.blue,strokeOpacity:1,strokeWidth:2,tabindex:-1,trace:!1,traceAttributes:{},transitionDuration:100,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width"],visible:!0,withLabel:!1},ticks:{generateLabelText:null,generateLabelValue:null,drawLabels:!1,label:{tabindex:null,layer:7,highlight:!1},beautifulScientificTickLabels:!1,useUnicodeMinus:!0,anchor:"left",drawZero:!1,insertTicks:!1,minTicksDistance:10,minorHeight:4,majorHeight:10,tickEndings:[1,1],majorTickEndings:[1,1],ignoreInfiniteTickEndings:!0,minorTicks:4,ticksPerLabel:!1,scale:1,scaleSymbol:"",labels:[],maxLabelLength:5,precision:3,digits:3,ticksDistance:1,face:"|",strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"none",highlightFillColor:"none",visible:"inherit",includeBoundaries:!1,type:"linear",intl:{enabled:"inherit",options:{}},minorTicksInArrow:!1,majorTicksInArrow:!0,labelInArrow:!0,minorTicksInMargin:!1,majorTicksInMargin:!0,labelInMargin:!0},hatch:{drawLabels:!1,drawZero:!0,majorHeight:20,anchor:"middle",face:"|",strokeWidth:2,strokeColor:JXG$1.palette.blue,ticksDistance:.2},precision:{touch:30,touchMax:100,mouse:4,pen:4,epsilon:1e-4,hasPoint:4},layer:{numlayers:20,unused9:19,unused8:18,unused7:17,unused6:16,unused5:15,unused4:14,unused3:13,unused2:12,unused1:11,unused0:10,text:9,point:9,glider:9,arc:8,line:7,circle:6,curve:5,turtle:5,pol
50ygon:3,sector:3,angle:3,integral:3,axis:2,ticks:2,grid:1,image:0,trace:0},angle:{withLabel:!0,radius:"auto",type:"sector",orthoType:"square",orthoSensitivity:1,fillColor:JXG$1.palette.orange,highlightFillColor:JXG$1.palette.orange,strokeColor:JXG$1.palette.orange,fillOpacity:.3,highlightFillOpacity:.3,radiuspoint:{withLabel:!1,visible:!1,name:""},pointsquare:{withLabel:!1,visible:!1,name:""},dot:{visible:!1,strokeColor:"none",fillColor:"#000000",size:2,face:"o",withLabel:!1,name:""},label:{position:"top",offset:[0,0],strokeColor:JXG$1.palette.blue},arc:{visible:!1,fillColor:"none"}},arc:{selection:"auto",hasInnerPoints:!1,label:{anchorX:"auto",anchorY:"auto"},firstArrow:!1,lastArrow:!1,fillColor:"none",highlightFillColor:"none",strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!1,center:{},radiusPoint:{},anglePoint:{}},arrow:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},arrowparallel:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},axis:{name:"",needsRegularUpdate:!1,strokeWidth:1,lastArrow:{type:1,highlightSize:8,size:8},strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",position:"static",anchor:"",anchorDist:"10%",ticksAutoPos:!1,ticksAutoPosThreshold:"5%",withTicks:!0,straightFirst:!0,straightLast:!0,margin:-4,withLabel:!1,scalable:!1,ticks:{label:{offset:[4,-9],parse:!1,needsRegularUpdate:!1,display:"internal",visible:"inherit",layer:9},visible:"inherit",needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:!0,drawZero:!1,insertTicks:!0,minTicksDistance:5,minorHeight:10,majorHeight:-1,tickEndings:[0,1],majorTickEndings:[1,1],minorTicks:4,ticksDistance:1,strokeOpacity:.25},point1:{needsRegularUpdate:!1,visible:!1},point2:{needsRegularUpdate:!1,visible:!1},tabindex:-1,label:{position:"lft",offset:[10,10]}},bisector:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},bisectorlines:{line1:{strokeColor:"#000000"},line2:{strokeColor:"#000000"}},boxplot:{dir:"vertical",smallWidth:.5,strokeWidth:2,strokeColor:JXG$1.palette.blue,fillColor:JXG$1.palette.blue,fillOpacity:.2,highlightStrokeWidth:2,highlightStrokeColor:JXG$1.palette.blue,highlightFillColor:JXG$1.palette.blue,highlightFillOpacity:.1},button:{disabled:!1,display:"html"},cardinalspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.05,fillOpacity:.05,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:!1,highlightbysize:!1,fillOpacity:.6,withLines:!1,label:{}},checkbox:{disabled:!1,checked:!1,display:"html"},circle:{hasInnerPoints:!1,fillColor:"none",highlightFillColor:"none",strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,name:""},point2:{fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},label:{position:"urt"}},circumcircle:{fillColor:"none",highlightFillColor:"none",strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!0,center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:JXG$1.palette.yellow,highlightFillColor:JXG$1.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},comb:{frequency:.2,width:.4,angle:Math.PI/3,reverse:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},strokeWidth:1,strokeColor:"#0000ff",fillColor:"none"},conic:{fillColor:"none",highlightFillColor:"none",strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",foci:{fixed:!1,visible:!1,withLabel:!1,name:""},center:{visible:!1,withLabel:!1,name:""},point:{withLabel:!1,name:""},line:{visible:!1}},curve:{strokeWidth:1,strokeColor:JXG$1.palette.blue,fillColor:"none",fixed:!0,curveType:null,doAdvancedPlot:!0,doAdvancedPlotOld:!1,firstArrow:!1,handDrawing:!1,label:{position:"lft"},lastArrow:!1,lineCap:"round",numberPointsHigh:1600,numberPointsLow:400,plotVersion:2,recursionDepthHigh:17,recursionDepthLow:15},foreignobject:{fixed:!0,visible:!0,needsRegularUpdate:!1,attractors:[],evaluateOnlyOnce:!1},functiongraph:{},glider:{label:{}},grid:{needsRegularUpdate:!1,hasGrid:!1,highlight:!1,gridX:null,gridY:null,majorStep:"auto",minorElements:0,forceSquare:!1,includeBoundaries:!1,size:void 0,face:void 0,margin:void 0,drawZero:void 0,pol
50ygonVertices:void 0,major:{size:5,face:"line",margin:0,drawZero:!0,polygonVertices:6},minor:{visible:"inherit",size:3,face:"point",margin:0,drawZero:!0,polygonVertices:6},snapToGrid:!1,strokeColor:"#c0c0c0",strokeWidth:1,strokeOpacity:.5,dash:0,theme:0,themes:[{},{forceSquare:"min",major:{face:"line"}},{major:{face:"line"},minor:{size:3,face:"point"},minorElements:"auto"},{major:{face:"line"},minor:{face:"line",strokeOpacity:.25},minorElements:"auto"},{major:{face:"line"},minor:{face:"+",size:"95%"},minorElements:"auto"},{major:{face:"+",size:10,strokeOpacity:1},minor:{face:"point",size:3},minorElements:"auto"},{major:{face:"circle",size:8,fillColor:"#c0c0c0"},minor:{face:"point",size:3},minorElements:"auto"}]},group:{needsRegularUpdate:!0},htmlslider:{widthRange:100,widthOut:34,step:.01,frozen:!0,isLabel:!1,strokeColor:"#000000",display:"html",anchorX:"left",anchorY:"middle",withLabel:!1},image:{imageString:null,fillOpacity:1,highlightFillOpacity:.6,cssClass:"JXGimage",highlightCssClass:"JXGimageHighlight",rotate:0,snapSizeX:1,snapSizeY:1,attractors:[]},implicitcurve:{margin:1,resolution_outer:5,resolution_inner:5,max_steps:1024,alpha_0:.05,tol_u0:Mat.eps,tol_newton:1e-7,tol_cusp:.05,tol_progress:1e-4,qdt_box:.2,kappa_0:.2,delta_0:.05,h_initial:.1,h_critical:.001,h_max:.5,loop_dist:.09,loop_dir:.99,loop_detection:!0},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},inequality:{fillColor:JXG$1.palette.red,fillOpacity:.2,strokeColor:"none",inverse:!1},infobox:{distanceX:-20,distanceY:25,intl:{enabled:"inherit",options:{}},fontSize:12,isLabel:!1,strokeColor:"#bbbbbb",display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGinfobox",rotate:0,visible:!0,parse:!1,transitionDuration:0,needsRegularUpdate:!1,tabindex:null,viewport:[0,0,0,0]},integral:{axis:"x",withLabel:!0,fixed:!0,strokeWidth:0,strokeOpacity:0,fillColor:JXG$1.palette.red,fillOpacity:.3,highlightFillColor:JXG$1.palette.red,highlightFillOpacity:.2,curveLeft:{visible:!0,withLabel:!1,color:JXG$1.palette.red,fillOpacity:.8,layer:9},baseLeft:{visible:!1,fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:JXG$1.palette.red,fillOpacity:.8,layer:9},baseRight:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{fontSize:20,digits:4,intl:{enabled:!1,options:{}}}},input:{disabled:!1,maxlength:524288,display:"html"},intersection:{alwaysIntersect:!0},label:{visible:"inherit",strokeColor:"#000000",strokeOpacity:1,highlightStrokeOpacity:.666666,highlightStrokeColor:"#000000",fixed:!0,tabindex:null,position:"urt",distance:1.5,offset:[10,10],autoPosition:!1,autoPositionMinDistance:12,autoPositionMaxDistance:28,autoPositionWhitelist:[]},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],lineLength:1,strokeOpacity:[1],rowHeight:20,strokeWidth:5,frozen:!1},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:JXG$1.palette.blue,highlightStrokeColor:"#c3d9ff",withTicks:!1,point1:{fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},point2:{fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},ticks:{drawLabels:!0,label:{offset:[4,-9]},drawZero:!1,insertTicks:!1,ticksDistance:1,minTicksDistance:50,minorHeight:4,majorHeight:-1,minorTicks:4,strokeOpacity:.3,visible:"inherit"},label:{position:"llft"},snapToGrid:!1,snapSizeX:1,snapSizeY:1,touchFirstPoint:!1,touchLastPoint:!1},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},measurement:{baseUnit:"",units:{},showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",dim:null,formatCoords:function(v,N,G,z){return parseFloat(z)!==1?"Infinit coords":"("+N+", "+G+")"},formatDirection:function(v,N,G){return"("+N+", "+G+")"}},metapostspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.5,fillOpacity:.5,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},mirrorelement:{fixed:!0,point:{},center:{},type:"Euclidean"},nonreflexangle:{},normal:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},orthogonalprojection:{},otherintersection:{alwaysIntersect:!0,precision:.001},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{position:"llft"}},parallelogram:{parallelpoint:{withLabel:!1,name:""}},parallelpoint:{},perpendicular:{strokeColor:"#000000",straightFirst:!0,straightLast:!0},perpendicularsegment:{strokeColor:"#000000",straightFirst:!1,straightLast:!1,point:{visible:!1,fixed:!0,withLabel:!1,name:""}},point:{withLabel:!0,label:{},style:5,face:"o",size:3,sizeUnit:"screen",strokeWidth:2,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width","width","height","rx","ry"],fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",zoom:!1,showInfobox:"inherit",infoboxDigits:"auto",draft:!1,attractors:[],attractorUnit:"user",attractorDistance:0,snatchDistance:0,snapToGri
50d:!1,attractToGrid:!1,snapSizeX:1,snapSizeY:1,snapToPoints:!1,ignoredSnapToPoints:[]},polygon:{hasInnerPoints:!1,fillColor:JXG$1.palette.yellow,highlightFillColor:JXG$1.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"},visible:"inherit"},highlightByStrokeWidth:!1,vertices:{layer:9,withLabel:!1,name:"",strokeColor:JXG$1.palette.red,fillColor:JXG$1.palette.red,fixed:!1,visible:"inherit"},label:{offset:[0,0]}},polygonalchain:{fillColor:"none",highlightFillColor:"none"},prescribedangle:{anglePoint:{size:2,visible:!1,withLabel:!1}},reflection:{fixed:!0,center:{},type:"Euclidean"},reflexangle:{},regularpolygon:{hasInnerPoints:!1,fillColor:JXG$1.palette.yellow,highlightFillColor:JXG$1.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"}},vertices:{layer:9,withLabel:!0,strokeColor:JXG$1.palette.red,fillColor:JXG$1.palette.red,fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:JXG$1.palette.yellow},sector:{fillColor:JXG$1.palette.yellow,highlightFillColor:JXG$1.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,useDirection:!1,selection:"auto",arc:{visible:!1,fillColor:"none",withLabel:!1,name:"",center:{visible:!1,withLabel:!1,name:""},radiusPoint:{visible:!1,withLabel:!1,name:""},anglePoint:{visible:!1,withLabel:!1,name:""}},radiusPoint:{visible:!1,withLabel:!1},center:{visible:!1,withLabel:!1},anglePoint:{visible:!1,withLabel:!1},label:{offset:[0,0],anchorX:"auto",anchorY:"auto"}},segment:{label:{position:"top"}},semicircle:{center:{visible:!1,withLabel:!1,fixed:!1,fillColor:JXG$1.palette.red,strokeColor:JXG$1.palette.red,highlightFillColor:"#eeeeee",highlightStrokeColor:JXG$1.palette.red,name:""}},slider:{snapWidth:-1,snapValues:[],snapValueDistance:0,precision:2,digits:2,intl:{enabled:"inherit",options:{}},firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,suffixLabel:null,unitLabel:null,postLabel:null,layer:9,showInfobox:!1,name:"",visible:!0,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6,point1:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,name:""},baseline:{needsRegularUpdate:!1,visible:"inherit",fixed:!0,scalable:!1,tabindex:null,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,fixed:!0,drawLabels:!1,digits:2,includeBoundaries:!0,drawZero:!0,label:{offset:[-4,-14],display:"internal"},minTicksDistance:30,insertTicks:!0,ticksDistance:1,minorHeight:4,majorHeight:5,minorTicks:0,strokeOpacity:1,strokeWidth:1,tickEndings:[0,1],majortickEndings:[0,1],strokeColor:"#000000",visible:"inherit"},highline:{strokeWidth:3,visible:"inherit",fixed:!0,tabindex:null,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{visible:"inherit",strokeColor:"#000000"},moveOnUp:!0},slopefield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:JXG$1.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!1,size:5,angle:Math.PI*.125}},slopetriangle:{fillColor:JXG$1.palette.red,fillOpacity:.4,highlightFillColor:JXG$1.palette.red,highlightFillOpacity:.3,borders:{lastArrow:{type:1,size:6}},glider:{fixed:!0,visible:!1,withLabel:!1},baseline:{visible:!1,withLabel:!1,name:""},basepoint:{visible:!1,withLabel:!1,name:""},tangent:{visible:!1,withLabel:!1,name:""},toppoint:{visible:!1,withLabel:!1,name:""},label:{visible:!0,position:"first"}},smartlabelangle:{cssClass:"smart-label-solid smart-label-angle",highlightCssClass:"smart-label-solid smart-label-angle",anchorX:"left",anchorY:"middle",unit:"",prefix:"",suffix:"",measure:"deg",useMathJax:!0},smartlabelcircle:{cssClass:"smart-label-solid smart-label-circle",highlightCssClass:"smart-label-solid smart-label-circle",anchorX:"middle",useMathJax:!0,unit:"",prefix:"",suffix:"",measure:"radius"},smartlabelline:{cssClass:"smart-label-solid smart-label-line",highlightCssClass:"smart-label-solid smart-label-line",anchorX:"middle",useMathJax:!0,unit:"",measure:"length"},smartlabelpoint:{cssClass:"smart-label-solid smart-label-point",highlightCssClass:"smart-label-solid smart-label-point",anchorX:"middle",anchorY:"top",useMathJax:!0,dir:"row",unit:""}
50,smartlabelpolygon:{cssClass:"smart-label-solid smart-label-polygon",highlightCssClass:"smart-label-solid smart-label-polygon",anchorX:"middle",useMathJax:!0,unit:"",measure:"area"},stepfunction:{},tangent:{},tangentto:{polar:{visible:!1,strokeWidth:1,dash:3},point:{visible:!1}},tapemeasure:{strokeColor:"#000000",strokeWidth:2,highlightStrokeColor:"#000000",withTicks:!0,withLabel:!0,rotate:0,precision:2,digits:2,point1:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},point2:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},ticks:{drawLabels:!1,drawZero:!0,insertTicks:!0,ticksDistance:.1,minorHeight:8,majorHeight:16,minorTicks:4,tickEndings:[0,1],majorTickEndings:[0,1],strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",visible:"inherit",label:{anchorY:"top",anchorX:"middle",offset:[0,-10]}},label:{position:"top"}},text:{fontSize:12,fontUnit:"px",formatNumber:!1,digits:2,intl:{enabled:"inherit",options:{minimumFractionDigits:0,maximumFractionDigits:2}},parse:!0,useCaja:!1,isLabel:!1,strokeColor:"#000000",highlightStrokeColor:"#000000",highlightStrokeOpacity:.666666,cssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",highlightCssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",cssStyle:"",highlightCssStyle:"",transitionProperties:["color","opacity"],useASCIIMathML:!1,useMathJax:!1,useKatex:!1,katexMacros:{},toFraction:!1,display:"html",anchor:null,anchorX:"left",anchorY:"middle",cssClass:"JXGtext",highlightCssClass:"JXGtext",dragArea:"all",withLabel:!1,rotate:0,visible:!0,snapSizeX:1,snapSizeY:1,attractors:[]},tracecurve:{strokeColor:"#000000",fillColor:"none",numberPoints:100},turtle:{strokeWidth:1,fillColor:"none",strokeColor:"#000000",arrow:{strokeWidth:2,withLabel:!1,strokeColor:JXG$1.palette.red,lastArrow:!0}},vectorfield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:JXG$1.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!0,size:5,angle:Math.PI*.125}},shortcuts:{color:["strokeColor","fillColor"],opacity:["strokeOpacity","fillOpacity"],highlightColor:["highlightStrokeColor","highlightFillColor"],highlightOpacity:["highlightStrokeOpacity","highlightFillOpacity"],strokeWidth:["strokeWidth","highlightStrokeWidth"]}};JXG$1.Validator=function(){var v,N=function(ve){return/^[0-9]+px$/.test(ve)},G=function(ve){return ve==="html"||ve==="internal"},z=function(ve){return JXG$1.isString(ve)},q=function(ve){return JXG$1.exists(JXG$1.normalizePointFace(ve))},Y=function(ve){return JXG$1.isNumber(ve,!0,!1)},W=function(ve){return Math.abs(ve-Math.round(ve))<Mat.eps},ie=function(ve){return W(ve)&&ve>=0},ne=function(ve){return W(ve)&&ve>0},se=function(ve){return ve==="vml"||ve==="svg"||ve==="canvas"||ve==="no"},ae=function(ve){return ve>0},ce=function(ve){return ve>=0},pe={},ge={attractorDistance:ce,color:z,display:G,doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:q,factor:Y,fillColor:z,fillOpacity:Y,firstArrow:!1,fontSize:W,dash:W,gridX:Y,gridY:Y,hasGrid:!1,highlightFillColor:z,highlightFillOpacity:Y,highlightStrokeColor:z,highlightStrokeOpacity:Y,insertTicks:!1,lastArrow:!1,layer:ie,majorHeight:W,minorHeight:W,minorTicks:ce,minTicksDistance:ne,numberPointsHigh:ne,numberPointsLow:ne,opacity:Y,radius:Y,RDPsmoothing:!1,renderer:se,right:N,showCopyright:!1,showInfobox:!1,showNavigation:!1,size:ce,snapSizeX:ae,snapSizeY:ae,snapWidth:Y,snapToGrid:!1,snatchDistance:ce,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:z,strokeOpacity:Y,strokeWidth:ce,takeFirst:!1,takeSizeFromFile:!1,to10:!1,toOrigin:!1,translateTo10:!1,translateToOrigin:!1,useASCIIMathML:!1,useDirection:!1,useMathJax:!1,withLabel:!1,withTicks:!1,zoom:!1};for(v in ge)ge.hasOwnProperty(v)&&(pe[v.toLowerCase()]=ge[v]);return pe}();JXG$1.normalizePointFace=function(v){var N={cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",divide:"|","|":"|",minus:"-","-":"-",diamond:"<>","<>":"<>",diamond2:"<<>>","<<>>":"<<>>",triangleup:"^",A:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"};return N[v]};JXG$1.useStandardOptions=function(v){var N,G,z,q,Y=JXG$1.Options,W=v.hasGrid;v.options.grid.hasGrid=Y.grid.hasGrid,v.options.grid.gridX=Y.grid.gridX,v.options.grid.gridY=Y.grid.gridY,v.options.grid.gridColor=Y.grid.gridColor,v.options.grid.gridOpacity=Y.grid.gridOpacity,v.options.grid.gridDash=Y.grid.gridDash,v.options.grid.snapToGri
50d=Y.grid.snapToGrid,v.options.grid.snapSizeX=Y.grid.SnapSizeX,v.options.grid.snapSizeY=Y.grid.SnapSizeY,v.takeSizeFromFile=Y.takeSizeFromFile,q=function(ie,ne){ie.visProp.fillcolor=ne.fillColor,ie.visProp.highlightfillcolor=ne.highlightFillColor,ie.visProp.strokecolor=ne.strokeColor,ie.visProp.highlightstrokecolor=ne.highlightStrokeColor};for(N in v.objects)if(v.objects.hasOwnProperty(N))if(z=v.objects[N],z.elementClass===Const.OBJECT_CLASS_POINT)q(z,Y.point);else if(z.elementClass===Const.OBJECT_CLASS_LINE)for(q(z,Y.line),G=0;G<z.ticks.length;G++)z.ticks[G].majorTicks=Y.line.ticks.majorTicks,z.ticks[G].minTicksDistance=Y.line.ticks.minTicksDistance,z.ticks[G].visProp.minorheight=Y.line.ticks.minorHeight,z.ticks[G].visProp.majorheight=Y.line.ticks.majorHeight;else z.elementClass===Const.OBJECT_CLASS_CIRCLE?q(z,Y.circle):z.type===Const.OBJECT_TYPE_ANGLE?q(z,Y.angle):z.type===Const.OBJECT_TYPE_ARC?q(z,Y.arc):z.type===Const.OBJECT_TYPE_POLYGON?q(z,Y.polygon):z.type===Const.OBJECT_TYPE_CONIC?q(z,Y.conic):z.type===Const.OBJECT_TYPE_CURVE?q(z,Y.curve):z.type===Const.OBJECT_TYPE_SECTOR&&(z.arc.visProp.fillcolor=Y.sector.fillColor,z.arc.visProp.highlightfillcolor=Y.sector.highlightFillColor,z.arc.visProp.fillopacity=Y.sector.fillOpacity,z.arc.visProp.highlightfillopacity=Y.sector.highlightFillOpacity);v.fullUpdate(),W&&!v.hasGrid?v.removeGrids(v):!W&&v.hasGrid&&v.create("grid",[])};JXG$1.useBlackWhiteOptions=function(v){var N=JXG$1.Options;N.point.fillColor=JXG$1.rgb2bw(N.point.fillColor),N.point.highlightFillColor=JXG$1.rgb2bw(N.point.highlightFillColor),N.point.strokeColor=JXG$1.rgb2bw(N.point.strokeColor),N.point.highlightStrokeColor=JXG$1.rgb2bw(N.point.highlightStrokeColor),N.line.fillColor=JXG$1.rgb2bw(N.line.fillColor),N.line.highlightFillColor=JXG$1.rgb2bw(N.line.highlightFillColor),N.line.strokeColor=JXG$1.rgb2bw(N.line.strokeColor),N.line.highlightStrokeColor=JXG$1.rgb2bw(N.line.highlightStrokeColor),N.circle.fillColor=JXG$1.rgb2bw(N.circle.fillColor),N.circle.highlightFillColor=JXG$1.rgb2bw(N.circle.highlightFillColor),N.circle.strokeColor=JXG$1.rgb2bw(N.circle.strokeColor),N.circle.highlightStrokeColor=JXG$1.rgb2bw(N.circle.highlightStrokeColor),N.arc.fillColor=JXG$1.rgb2bw(N.arc.fillColor),N.arc.highlightFillColor=JXG$1.rgb2bw(N.arc.highlightFillColor),N.arc.strokeColor=JXG$1.rgb2bw(N.arc.strokeColor),N.arc.highlightStrokeColor=JXG$1.rgb2bw(N.arc.highlightStrokeColor),N.polygon.fillColor=JXG$1.rgb2bw(N.polygon.fillColor),N.polygon.highlightFillColor=JXG$1.rgb2bw(N.polygon.highlightFillColor),N.sector.fillColor=JXG$1.rgb2bw(N.sector.fillColor),N.sector.highlightFillColor=JXG$1.rgb2bw(N.sector.highlightFillColor),N.curve.strokeColor=JXG$1.rgb2bw(N.curve.strokeColor),N.grid.gridColor=JXG$1.rgb2bw(N.grid.gridColor),JXG$1.useStandardOptions(v)};JXG$1.Options.normalizePointFace=JXG$1.normalizePointFace;const Options=JXG$1.Options;JXG$1.AbstractRenderer=function(){this.vOffsetText=0,this.enhancedRendering=!0,this.container=null,this.type="",this.supportsForeignObject=!1,this.dashArray=[[2,2],[5,5],[10,10],[20,20],[20,10,10,10],[20,5,10,5],[0,5]]};JXG$1.extend(JXG$1.AbstractRenderer.prototype,{_updateVisual:function(v,N,G){(G||this.enhancedRendering)&&(N=N||{},this.setObjectTransition(v),v.evalVisProp("draft")?this.setDraft(v):(N.stroke||(v.highlighted?(this.setObjectStrokeColor(v,v.evalVisProp("highlightstrokecolor"),v.evalVisProp("highlightstrokeopacity")),this.setObjectStrokeWidth(v,v.evalVisProp("highlightstrokewidth"))):(this.setObjectStrokeColor(v,v.evalVisProp("strokecolor"),v.evalVisProp("strokeopacity")),this.setObjectStrokeWidth(v,v.evalVisProp("strokewidth")))),N.fill||(v.highlighted?this.setObjectFillColor(v,v.evalVisProp("highlightfillcolor"),v.evalVisProp("highlightfillopacity")):this.setObjectFillColor(v,v.evalVisProp("fillcolor"),v.evalVisProp("fillopacity"))),N.dash||this.setDashStyle(v,v.visProp),N.shadow||this.setShadow(v),N.tabindex||this.setTabindex(v)),v.highlighted?this.setCssClass(v,v.evalVisProp("highlightcssclass")):this.setCssClass(v,v.evalVisProp("cssclass")),v.evalVisProp("aria.enabled")&&this.setARIA(v))},_getHighlighted:function(v){var N=!1,G;return(!JXG$1.exists(v.board)||!JXG$1.exists(v.board.highlightedObjects))&&(N=!0),!N&&JXG$1.exists(v.board.highlightedObjects[v.id])?G="highlight":G="",G},drawPoint:function(v){var N,G=Options.normalizePointFace(v.evalVisProp("face"));G==="o"?N="ellipse":G==="[]"?N="rect":N="path",v.rendNode=this.appendChildPrim(this.createPrim(N,v.id),v.evalVisProp("layer")),this.appendNodesToElement(v,N),this._updateVisual(v,{dash:!0,shadow:!0}
50,!0),this.updatePoint(v)},updatePoint:function(v){var N=v.evalVisProp("size"),G=Options.normalizePointFace(v.evalVisProp("face")),z=v.evalVisProp("sizeunit"),q=v.evalVisProp("zoom"),Y;isNaN(v.coords.scrCoords[2]+v.coords.scrCoords[1])||(z==="user"&&(N*=Math.sqrt(Math.abs(v.board.unitX*v.board.unitY))),N*=!v.board||!q?1:Math.sqrt(v.board.zoomX*v.board.zoomY),Y=N===0?0:N+1,G==="o"?this.updateEllipsePrim(v.rendNode,v.coords.scrCoords[1],v.coords.scrCoords[2],Y,Y):G==="[]"?this.updateRectPrim(v.rendNode,v.coords.scrCoords[1]-N,v.coords.scrCoords[2]-N,N*2,N*2):this.updatePathPrim(v.rendNode,this.updatePathStringPoint(v,N,G),v.board),this._updateVisual(v,{dash:!1,shadow:!1}),this.setShadow(v))},changePointStyle:function(v){var N=this.getElementById(v.id);JXG$1.exists(N)&&this.remove(N),this.drawPoint(v),JXG$1.clearVisPropOld(v),v.visPropCalc.visible||this.display(v,!1),v.evalVisProp("draft")&&this.setDraft(v)},drawLine:function(v){v.rendNode=this.appendChildPrim(this.createPrim("line",v.id),v.evalVisProp("layer")),this.appendNodesToElement(v,"lines"),this.updateLine(v)},updateLine:function(v){this._updateVisual(v),this.updatePathWithArrowHeads(v),this.setLineCap(v)},drawCurve:function(v){v.rendNode=this.appendChildPrim(this.createPrim("path",v.id),v.evalVisProp("layer")),this.appendNodesToElement(v,"path"),this.updateCurve(v)},updateCurve:function(v){this._updateVisual(v),this.updatePathWithArrowHeads(v),this.setLineCap(v)},updatePathWithArrowHeads:function(v,N){var G=N?"highlight":"",z,q;N&&v.evalVisProp("highlightstrokewidth")?z=Math.max(v.evalVisProp("highlightstrokewidth"),v.evalVisProp("strokewidth")):z=v.evalVisProp("strokewidth"),q=this.getArrowHeadData(v,z,G),this.makeArrows(v,q),v.elementClass===Const.OBJECT_CLASS_LINE?this.updateLineWithEndings(v,q):v.elementClass===Const.OBJECT_CLASS_CURVE&&this.updatePath(v),this.setArrowSize(v,q)},getArrowHeadData:function(v,N,G){var z=Mat.eps,q,Y,W=0,ie=0,ne=0,se=0,ae=v.evalVisProp("firstarrow"),ce=v.evalVisProp("lastarrow"),pe,ge;return(ae||ce)&&(JXG$1.exists(ae.type)?q=v.eval(ae.type):v.elementClass===Const.OBJECT_CLASS_LINE?q=1:q=7,JXG$1.exists(ce.type)?Y=v.eval(ce.type):v.elementClass===Const.OBJECT_CLASS_LINE?Y=1:Y=7,ae&&(ge=6,JXG$1.exists(ae.size)&&(ge=v.eval(ae.size)),G!==""&&JXG$1.exists(ae[G+"size"])&&(ge=v.eval(ae[G+"size"])),pe=N*ge,q===2?(pe*=.5,z+=N*ge):q===3?(pe=N*ge/3,z+=N):q===4||q===5||q===6?(pe=N*ge/1.5,z+=N*ge):q===7?(pe=0,ge=10,z+=N):z+=N*ge,W+=pe,ne=ge),ce&&(ge=6,JXG$1.exists(ce.size)&&(ge=v.eval(ce.size)),G!==""&&JXG$1.exists(ce[G+"size"])&&(ge=v.eval(ce[G+"size"])),pe=N*ge,Y===2?(pe*=.5,z+=N*ge):Y===3?(pe=N*ge/3,z+=N):Y===4||Y===5||Y===6?(pe=N*ge/1.5,z+=N*ge):Y===7?(pe=0,ge=10,z+=N):z+=N*ge,ie+=pe,se=ge)),v.visPropCalc.typeFirst=q,v.visPropCalc.typeLast=Y,{evFirst:ae,evLast:ce,typeFirst:q,typeLast:Y,offFirst:W,offLast:ie,sizeFirst:ne,sizeLast:se,showFirst:1,showLast:1,minLen:z,strokeWidth:N}},updateLineWithEndings:function(v,N){var G,z,q=null;return G=new Coords(Const.COORDS_BY_USER,v.point1.coords.usrCoords,v.board),z=new Coords(Const.COORDS_BY_USER,v.point2.coords.usrCoords,v.board),q=v.evalVisProp("margin"),Geometry.calcStraight(v,G,z,q),this.handleTouchpoints(v,G,z,N),this.getPositionArrowHead(v,G,z,N),this.updateLinePrim(v.rendNode,G.scrCoords[1],G.scrCoords[2],z.scrCoords[1],z.scrCoords[2],v.board),this},updatePath:function(v){return v.evalVisProp("handdrawing")?this.updatePathPrim(v.rendNode,this.updatePathStringBezierPrim(v),v.board):this.updatePathPrim(v.rendNode,this.updatePathStringPrim(v),v.board),this},getPositionArrowHead:function(v,N,G,z){var q,Y,W,ie,ne;return(z.evFirst||z.evLast)&&(Y=W=ie=ne=0,q=N.distance(Const.COORDS_BY_SCREEN,G),z.evFirst&&v.board.renderer.type!=="vml"&&(q>=z.minLen?(Y=(G.scrCoords[1]-N.scrCoords[1])*z.offFirst/q,W=(G.scrCoords[2]-N.scrCoords[2])*z.offFirst/q):z.showFirst=0),z.evLast&&v.board.renderer.type!=="vml"&&(q>=z.minLen?(ie=(G.scrCoords[1]-N.scrCoords[1])*z.offLast/q,ne=(G.scrCoords[2]-N.scrCoords[2])*z.offLast/q):z.showLast=0),N.setCoordinates(Const.COORDS_BY_SCREEN,[N.scrCoords[1]+Y,N.scrCoords[2]+W],!1,!0),G.setCoordinates(Const.COORDS_BY_SCREEN,[G.scrCoords[1]-ie,G.scrCoords[2]-ne],!1,!0)),this},handleTouchpoints:function(v,N,G,z){var q,Y,W,ie,ne,se,ae;return(z.evFirst||z.evLast)&&(W=ie=ne=se=ae=0,q=v.point1.evalVisProp("size")+v.point1.evalVisProp("strokewidth"),Y=v.point2.evalVisProp("size")+v.point2.evalVisProp("strokewidth"),z.evFirst&&v.evalVisProp("touchfirstpoint")&&v.point1.evalVisProp("visible")&&(W=N.distance(Const.COORDS_BY_SCREEN,G),ie=(G.scrCoords[1]-N.scrCoords[1])*q/W,ne=(G.scrCoords[2]-N.scrCoords[2])*q/W),z.evLast&&v.evalVisProp("touchlastpoint")&&v.point2.evalVisProp("visible")&&(W=N.distance(Const.COORDS_BY_SCREEN,G),se=(G.scrCoords[1]-N.scrCoords[1])*Y/W,ae=(G.scrCoords[2]-N.scrCoords[2])*Y/W),N.setCoordinates(Const.COORDS_BY_SCREEN,[N.scrCoords[1]+ie,N.scrCoords[2]+ne],!1,!0),G.setCoordinates(Const.COORDS_BY_SCREEN,[G.scrCoords[1]-se,G.scrCoords[2]-ae],!1,!0)),this},setArrowSize:function(v,N){return N.evFirst&&this._setArrowWidth(v.rendNodeTriangleStart,N.showFirst*N.strokeWidth,v.rendNode,N.sizeFirst),N.evLast&&this._setArrowWidth(v.rendNodeTriangleEnd,N.showLast*N.strokeWidth,v.rendNode,N.sizeLast),this},setLineCap:function(v){},drawTicks:function(v){v.rendNode=this.appendChildPrim(this.createPrim("path",v.i
50d),v.evalVisProp("layer")),this.appendNodesToElement(v,"path")},updateTicks:function(v){},drawEllipse:function(v){v.rendNode=this.appendChildPrim(this.createPrim("ellipse",v.id),v.evalVisProp("layer")),this.appendNodesToElement(v,"ellipse"),this.updateEllipse(v)},updateEllipse:function(v){this._updateVisual(v);var N=v.Radius();Math.abs(v.center.coords.usrCoords[0])>Mat.eps&&!isNaN(N+v.center.coords.scrCoords[1]+v.center.coords.scrCoords[2])&&N*v.board.unitX<2e6&&this.updateEllipsePrim(v.rendNode,v.center.coords.scrCoords[1],v.center.coords.scrCoords[2],N*v.board.unitX,N*v.board.unitY),this.setLineCap(v)},drawPolygon:function(v){v.rendNode=this.appendChildPrim(this.createPrim("polygon",v.id),v.evalVisProp("layer")),this.appendNodesToElement(v,"polygon"),this.updatePolygon(v)},updatePolygon:function(v){this._updateVisual(v,{stroke:!0,dash:!0}),this.updatePolygonPrim(v.rendNode,v)},displayCopyright:function(v,N){},drawInternalText:function(v){},updateInternalText:function(v){},drawText:function(v){var N,G,z,q;v.evalVisProp("display")==="html"&&JXG$1.isBrowser&&this.type!=="no"?(N=this.container.ownerDocument.createElement("div"),N.style.position="absolute",N.className=v.evalVisProp("cssclass"),z=v.evalVisProp("layer"),JXG$1.exists(z)||(z=0),this.container.style.zIndex===""?G=0:G=parseInt(this.container.style.zIndex,10),N.style.zIndex=G+z,this.container.appendChild(N),N.setAttribute("id",this.container.id+"_"+v.id)):N=this.drawInternalText(v),v.rendNode=N,v.htmlStr="",v.visProp.islabel&&JXG$1.exists(v.visProp.anchor)?(q=v.visProp.anchor.evalVisProp("visible"),v.prepareUpdate().updateVisibility(q)):v.prepareUpdate().updateVisibility(),this.updateText(v)},updateText:function(v){var N=v.plaintext,G,z,q,Y,W,ie,ne,se,ae,ce,pe;if(v.visPropCalc.visible)if(this.updateTextStyle(v,!1),v.evalVisProp("display")==="html"&&this.type!=="no"){if(isNaN(v.coords.scrCoords[1]+v.coords.scrCoords[2])||(z=v.coords.scrCoords[1],z=Math.abs(z)<1e6?z:1e6,W=v.getAnchorX(),W==="right"?(G=v.board.canvasWidth-z,ce="right"):W==="middle"?(G=z-.5*v.size[0],ce="center"):(G=z,ce="left"),v.visPropOld.left!==W+G&&(W==="right"?(v.rendNode.style.right=G+"px",v.rendNode.style.left="auto"):(v.rendNode.style.left=G+"px",v.rendNode.style.right="auto"),v.visPropOld.left=W+G),z=v.coords.scrCoords[2]+this.vOffsetText,z=Math.abs(z)<1e6?z:1e6,ie=v.getAnchorY(),ie==="bottom"?(G=v.board.canvasHeight-z,pe="bottom"):ie==="middle"?(G=z-.5*v.size[1],pe="center"):(G=z,pe="top"),v.visPropOld.top!==ie+G&&(ie==="bottom"?(v.rendNode.style.top="auto",v.rendNode.style.bottom=G+"px"):(v.rendNode.style.bottom="auto",v.rendNode.style.top=G+"px"),v.visPropOld.top=ie+G)),v.htmlStr!==N){try{v.type===JXG$1.OBJECT_TYPE_BUTTON?v.rendNodeButton.innerHTML=N:v.type===JXG$1.OBJECT_TYPE_CHECKBOX||v.type===JXG$1.OBJECT_TYPE_INPUT?v.rendNodeLabel.innerHTML=N:v.rendNode.innerHTML=N}catch{q=v.rendNode.parentNode,v.rendNode.parentNode.removeChild(v.rendNode),v.rendNode.innerHTML=N,q.appendChild(v.rendNode)}if(v.htmlStr=N,v.evalVisProp("usemathjax"))try{MathJax.typeset?MathJax.typeset([v.rendNode]):MathJax.Hub.Queue(["Typeset",MathJax.Hub,v.rendNode])}catch{JXG$1.debug("MathJax (not yet) loaded")}else if(v.evalVisProp("usekatex"))try{v.rendNode.innerHTML.indexOf("<span")===0&&v.rendNode.innerHTML.indexOf("<label")>0&&(v.rendNode.innerHTML.indexOf("<checkbox")>0||v.rendNode.innerHTML.indexOf("<input")>0)?Y=v.rendNodeLabel:v.rendNode.innerHTML.indexOf("<button")===0?Y=v.rendNodeButton:Y=v.rendNode,Y&&katex.render(N,Y,{macros:v.evalVisProp("katexmacros"),throwOnError:!1})}catch{JXG$1.debug("KaTeX not loaded (yet)")}else if(v.evalVisProp("useasciimathml"))try{AMprocessNode(v.rendNode,!1)}catch{JXG$1.debug("AsciiMathML not loaded (yet)")}}ne=v.evalVisProp("rotate"),ne!==0&&(ne*=Math.PI/180,se=Math.cos(ne),ae=Math.sin(ne),v.rendNode.style.transform="matrix("+[se,-1*ae,ae,se,0,0].join(",")+")",v.rendNode.style["transform-origin"]=ce+" "+pe),this.transformRect(v,v.transformations)}else this.updateInternalText(v)},_css2js:function(v){var N=[],G,z,q,Y,W,ie=JXG$1.trim(v).replace(/;$/,"").split(";");for(z=ie.length,G=0;G<z;++G)JXG$1.trim(ie[G])!==""&&(W=ie[G].split(":"),q=JXG$1.trim(W[0].replace(/-([a-z])/gi,function(ne,se){return se.toUpperCase()})),Y=JXG$1.trim(W[1]),N.push({key:q,val:Y}));return N},updateTextStyle:function(v,N){var G,z,q,Y,W,ie=JXG$1.isBrowser?v.visProp.display:"internal",ne=["rendNode","rendNodeTag","rendNodeLabel"],se=ne.length,ae=v.evalVisProp("fontunit"),ce,pe,ge,ve,be=["cssdefaultstyle","cssstyle"],Ee=be.length;if(N?(q=v.evalVisProp("highlightstrokecolor"),z=v.evalVisProp("highlightstrokeopacity"),Y=v.evalVisProp("highlightcssclass")):(q=v.evalVisProp("strokecolor"),z=v.evalVisProp("strokeopacity"),Y=v.evalVisProp("cssclass")),this.type!=="no"&&(ie==="html"||this.type!=="canvas")){for(ge=0;ge<Ee;ge++)if(ve=v.evalVisProp((N?"highlight":"")+be[ge]),ve!==""&&v.visPropOld[be[ge]]!==ve){for(ce=this._css2js(ve),W=0;W<se;W++)if(JXG$1.exists(v[ne[W]]))for(pe in ce)ce.hasOwnProperty(pe)&&(v[ne[W]].style[ce[pe].key]=ce[pe].val);v.visPropOld[be[ge]]=ve}if(G=v.evalVisProp("fontsize"),v.visPropOld.fontsize!==G){v.needsSizeUpdate=!0;try{for(W=0;W<se;W++)JXG$1.exists(v[ne[W]])&&(v[ne[W]].style.fontSize=G+ae)}catch{for(W=0;W<se;W++)JXG$1.exists(v[ne[W]])&&(v[ne[W]].style.fontSize=G)}v.visPropOld.fontsize=G}}return this.setTabindex(v),this.setObjectTransition(v),ie==="html"&&this.type!=="no"?(v.visPropOld.cssclass!==Y&&(v.rendNode.className=Y,v.visPropOld.cssclass=Y,v.needsSizeUpdate=!0),this.setObjectStrokeColor(v,q,z)):this.updateInternalTextStyle(v,q,z),v.evalVisProp("aria.enabled")&&this.setARIA(v),this},updateInternalTextStyle:function(v,N,G){this.setObjectStrokeColor(v,N,G)},drawImage:function(v){},updateImage:function(v){this.updateRectPrim(v.rendNode,v.coords.scrCoords[1],v.coords.scrCoords[2]-v.size[1],v.size[0],v.size[1]),this.updateImageURL(v),this.transformRect
50(v,v.transformations),this._updateVisual(v,{stroke:!0,dash:!0},!0)},joinTransforms:function(v,N){var G,z=v.board.origin.scrCoords[1],q=v.board.origin.scrCoords[2],Y=v.board.unitX,W=v.board.unitY,ie=N.length,ne=[[1,0,0],[-z/Y,1/Y,0],[q/W,0,-1/W]];for(G=0;G<ie;G++)ne=Mat.matMatMult(N[G].matrix,ne);return ne=Mat.matMatMult([[1,0,0],[z,Y,0],[q,0,-W]],ne),ne},transformRect:function(v,N){},updateImageURL:function(v){},updateImageStyle:function(v,N){v.rendNode.className=v.evalVisProp(N?"highlightcssclass":"cssclass")},drawForeignObject:function(v){},updateForeignObject:function(v){},appendChildPrim:function(v,N){},appendNodesToElement:function(v,N){},createPrim:function(v,N){return null},remove:function(v){},makeArrows:function(v,N){},_setArrowWidth:function(v,N,G){},updateEllipsePrim:function(v,N,G,z,q){},updateLinePrim:function(v,N,G,z,q,Y){},updatePathPrim:function(v,N,G){},updatePathStringPoint:function(v,N,G){},updatePathStringPrim:function(v){},updatePathStringBezierPrim:function(v){},updatePolygonPrim:function(v,N){},updateRectPrim:function(v,N,G,z,q){},display:function(v,N){v&&(v.visPropOld.visible=N)},hide:function(v){},highlight:function(v,N){var G,z,q;if(this.setObjectTransition(v),!v.visProp.draft){if(v.type===Const.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(v,v.evalVisProp("highlightfillcolor"),v.evalVisProp("highlightfillopacity")),z=v.evalVisProp("highlightbystrokewidth"),G=0;G<v.borders.length;G++)this.highlight(v.borders[G],!z);else v.elementClass===Const.OBJECT_CLASS_TEXT?this.updateTextStyle(v,!0):v.type===Const.OBJECT_TYPE_IMAGE?(this.updateImageStyle(v,!0),this.setObjectFillColor(v,v.evalVisProp("highlightfillcolor"),v.evalVisProp("highlightfillopacity"))):(this.setObjectStrokeColor(v,v.evalVisProp("highlightstrokecolor"),v.evalVisProp("highlightstrokeopacity")),this.setObjectFillColor(v,v.evalVisProp("highlightfillcolor"),v.evalVisProp("highlightfillopacity")));!N&&v.evalVisProp("highlightstrokewidth")&&(q=Math.max(v.evalVisProp("highlightstrokewidth"),v.evalVisProp("strokewidth")),this.setObjectStrokeWidth(v,q),(v.elementClass===Const.OBJECT_CLASS_LINE||v.elementClass===Const.OBJECT_CLASS_CURVE)&&this.updatePathWithArrowHeads(v,!0))}return this.setCssClass(v,v.evalVisProp("highlightcssclass")),this},noHighlight:function(v){var N,G;if(this.setObjectTransition(v),!v.evalVisProp("draft")){if(v.type===Const.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(v,v.evalVisProp("fillcolor"),v.evalVisProp("fillopacity")),N=0;N<v.borders.length;N++)this.noHighlight(v.borders[N]);else v.elementClass===Const.OBJECT_CLASS_TEXT?this.updateTextStyle(v,!1):v.type===Const.OBJECT_TYPE_IMAGE?(this.updateImageStyle(v,!1),this.setObjectFillColor(v,v.evalVisProp("fillcolor"),v.evalVisProp("fillopacity"))):(this.setObjectStrokeColor(v,v.evalVisProp("strokecolor"),v.evalVisProp("strokeopacity")),this.setObjectFillColor(v,v.evalVisProp("fillcolor"),v.evalVisProp("fillopacity")));G=v.evalVisProp("strokewidth"),this.setObjectStrokeWidth(v,G),(v.elementClass===Const.OBJECT_CLASS_LINE||v.elementClass===Const.OBJECT_CLASS_CURVE)&&this.updatePathWithArrowHeads(v,!1)}return this.setCssClass(v,v.evalVisProp("cssclass")),this},removeDraft:function(v){this.setObjectTransition(v),v.type===Const.OBJECT_TYPE_POLYGON?this.setObjectFillColor(v,v.evalVisProp("fillcolor"),v.evalVisProp("fillopacity")):(v.type===Const.OBJECT_CLASS_POINT&&this.setObjectFillColor(v,v.evalVisProp("fillcolor"),v.evalVisProp("fillopacity")),this.setObjectStrokeColor(v,v.evalVisProp("strokecolor"),v.evalVisProp("strokeopacity")),this.setObjectStrokeWidth(v,v.evalVisProp("strokewidth")))},setARIA:function(v){},setBuffering:function(v,N){},setCssClass:function(v,N){},setDashStyle:function(v){},setDraft:function(v){if(v.evalVisProp("draft")){var N=v.board.options.elements.draft.color,G=v.board.options.elements.draft.opacity;this.setObjectTransition(v),v.type===Const.OBJECT_TYPE_POLYGON?this.setObjectFillColor(v,N,G):(v.elementClass===Const.OBJECT_CLASS_POINT?this.setObjectFillColor(v,N,G):this.setObjectFillColor(v,"none",0),this.setObjectStrokeColor(v,N,G),this.setObjectStrokeWidth(v,v.board.options.elements.draft.strokeWidth))}},setGradient:function(v){},setLayer:function(v,N){},setObjectFillColor:function(v,N,G){},setObjectStrokeColor:function(v,N,G){},setObjectStrokeWidth:function(v,N){},setObjectTransition:function(v,N){},setPropertyPrim:function(v,N,G){},setShadow:function(v){},setTabindex:function(v){},show:function(v){},updateGradient:function(v){},suspendRedraw:function(){}
50,unsuspendRedraw:function(){},drawNavigationBar:function(v,N){var G,z,q=function(W){W||(W=window.event),W.stopPropagation?W.stopPropagation():W.cancelBubble=!0},Y=function(W,ie,ne,se){var ae;ne=ne||"",ae=G.createElement("span"),ae.innerHTML=W,ae.style.paddingLeft="7px",ae.style.paddingRight="7px",ae.classList!==void 0&&(ae.classList.add("JXG_navigation_button"),ae.classList.add("JXG_navigation_button_"+se)),ae.setAttribute("id",ne+"_navigation_"+se),ae.setAttribute("aria-hidden","true"),z.appendChild(ae),JXG$1.addEvent(ae,"click",function(ce){return JXG$1.bind(ie,v)(),!1},v),JXG$1.addEvent(ae,"pointerup",q,v),JXG$1.addEvent(ae,"pointerdown",q,v),JXG$1.addEvent(ae,"pointerleave",q,v),JXG$1.addEvent(ae,"mouseup",q,v),JXG$1.addEvent(ae,"mousedown",q,v),JXG$1.addEvent(ae,"touchend",q,v),JXG$1.addEvent(ae,"touchstart",q,v)};JXG$1.isBrowser&&this.type!=="no"&&(G=v.containerObj.ownerDocument,z=G.createElement("div"),z.setAttribute("id",v.container+"_navigationbar"),z.style.color=N.strokecolor,z.style.backgroundColor=N.fillcolor,z.style.padding=N.padding,z.style.position=N.position,z.style.fontSize=N.fontsize,z.style.cursor=N.cursor,z.style.zIndex=N.zindex,v.containerObj.appendChild(z),z.style.right=N.right,z.style.bottom=N.bottom,z.classList!==void 0&&z.classList.add("JXG_navigation"),v.attr.showfullscreen&&Y(v.attr.fullscreen.symbol,function(){v.toFullscreen(v.attr.fullscreen.id)},v.container,"fullscreen"),v.attr.showscreenshot&&Y(v.attr.screenshot.symbol,function(){window.setTimeout(function(){v.renderer.screenshot(v,"",!1)},330)},v.container,"screenshot"),v.attr.showreload&&Y("↻",function(){v.reload()},v.container,"reload"),v.attr.showcleartraces&&Y("⊗",function(){v.clearTraces()},v.container,"cleartraces"),v.attr.shownavigation&&(v.attr.showzoom&&(Y("–",v.zoomOut,v.container,"out"),Y("o",v.zoom100,v.container,"100"),Y("+",v.zoomIn,v.container,"in")),Y("←",v.clickLeftArrow,v.container,"left"),Y("↓",v.clickUpArrow,v.container,"down"),Y("↑",v.clickDownArrow,v.container,"up"),Y("→",v.clickRightArrow,v.container,"right")))},getElementById:function(v){var N;return JXG$1.exists(this.container)?(N=this.container.id+"_"+v,JXG$1.exists(CSS)&&JXG$1.exists(CSS.escape)&&(N=CSS.escape(N)),this.container.querySelector("#"+N)):""},removeToInsertLater:function(v){var N=v.parentNode,G=v.nextSibling;if(N!==null)return N.removeChild(v),function(){G?N.insertBefore(v,G):N.appendChild(v)}},resize:function(v,N){},createTouchpoints:function(v){},showTouchpoint:function(v){},hideTouchpoint:function(v){},updateTouchpoint:function(v,N){},dumpToDataURI:function(v){},dumpToCanvas:function(v,N,G,z){},screenshot:function(v){}});const AbstractRenderer=JXG$1.AbstractRenderer;var UTF8_ACCEPT=0,UTF8D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3,11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,0,12,24,36,60,96,84,12,12,12,48,72,12,12,12,12,12,12,12,12,12,12,12,12,12,0,12,12,12,12,12,0,12,0,12,12,12,24,12,12,12,12,12,24,12,24,12,12,12,12,12,12,12,12,12,24,12,12,12,12,12,24,12,12,12,12,12,12,12,24,12,12,12,12,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,12,12,12,12,12];JXG$1.Util=JXG$1.Util||{};JXG$1.Util.UTF8={encode:function(v){var N,G,z="",q=v.length;if(v=v.replace(/\r\n/g,`
51`),typeof unescape=="function"&&typeof encodeURIComponent=="function")return unescape(encodeURIComponent(v));for(N=0;N<q;N++)G=v.charCodeAt(N),G<128?z+=String.fromCharCode(G):G>127&&G<2048?(z+=String.fromCharCode(G>>6|192),z+=String.fromCharCode(G&63|128)):(z+=String.fromCharCode(G>>12|224),z+=String.fromCharCode(G>>6&63|128),z+=String.fromCharCode(G&63|128));return z},decode:function(v){var N,G,z,q=0,Y=0,W=UTF8_ACCEPT,ie=[],ne=v.length,se=[];for(N=0;N<ne;N++)G=v.charCodeAt(N),z=UTF8D[G],W!==UTF8_ACCEPT?Y=G&63|Y<<6:Y=255>>z&G,W=UTF8D[256+W+z],W===UTF8_ACCEPT&&(Y>65535?ie.push(55232+(Y>>10),56320+(Y&1023)):ie.push(Y),q++,q%1e4===0&&(se.push(String.fromCharCode.apply(null,ie)),ie=[]));return se.push(String.fromCharCode.apply(null,ie)),se.join("")},asciiCharCodeAt:function(v,N){var G=v.charCodeAt(N);if(G>255)switch(G){case 8364:G=128;break;case 8218:G=130;break;case 402:G=131;break;case 8222:G=132;break;case 8230:G=133;break;case 8224:G=134;break;case 8225:G=135;break;case 710:G=136;break;case 8240:G=137;break;case 352:G=138;break;case 8249:G=139;break;case 338:G=140;break;case 381:G=142;break;case 8216:G=145;break;case 8217:G=146;break;case 8220:G=147;break;case 8221:G=148;break;case 8226:G=149;break;case 8211:G=150;break;case 8212:G=151;break;case 732:G=152;break;case 8482:G=153;break;case 353:G=154;break;case 8250:G=155;break;case 339:G=156;break;case 382:G=158;break;case 376:G=159;break}return G}};const Encoding=JXG$1.Util.UTF8;var alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
51+/",pad="=";JXG$1.Util=JXG$1.Util||{};JXG$1.Util.Base64={_getByte:function(v,N){return v.charCodeAt(N)&255},_getIndex:function(v,N){return alphabet.indexOf(v.charAt(N))},encode:function(v){var N,G,z,q,Y,W=[];for(Y=Encoding.encode(v),z=Y.length,q=z%3,N=0;N<z-q;N+=3)G=this._getByte(Y,N)<<16|this._getByte(Y,N+1)<<8|this._getByte(Y,N+2),W.push(alphabet.charAt(G>>18),alphabet.charAt(G>>12&63),alphabet.charAt(G>>6&63),alphabet.charAt(G&63));switch(q){case 1:G=this._getByte(Y,z-1),W.push(alphabet.charAt(G>>2),alphabet.charAt(G<<4&63),pad,pad);break;case 2:G=this._getByte(Y,z-2)<<8|this._getByte(Y,z-1),W.push(alphabet.charAt(G>>10),alphabet.charAt(G>>4&63),alphabet.charAt(G<<2&63),pad);break}return W.join("")},decode:function(v,N){var G,z,q,Y,W,ie,ne=[],se=[];if(G=v.replace(/[^A-Za-z0-9+/=]/g,""),q=G.length,q%4!==0)throw new Error("JSXGraph/utils/base64: Can't decode string (invalid input length).");for(G.charAt(q-1)===pad&&(Y=1,G.charAt(q-2)===pad&&(Y=2),q-=4),z=0;z<q;z+=4)W=this._getIndex(G,z)<<18|this._getIndex(G,z+1)<<12|this._getIndex(G,z+2)<<6|this._getIndex(G,z+3),se.push(W>>16,W>>8&255,W&255),z%1e4===0&&(ne.push(String.fromCharCode.apply(null,se)),se=[]);switch(Y){case 1:W=this._getIndex(G,q)<<12|this._getIndex(G,q+1)<<6|this._getIndex(G,q+2),se.push(W>>10,W>>2&255);break;case 2:W=this._getIndex(G,z)<<6|this._getIndex(G,z+1),se.push(W>>4);break}return ne.push(String.fromCharCode.apply(null,se)),ie=ne.join(""),N&&(ie=Encoding.decode(ie)),ie},decodeAsArray:function(v){var N,G=this.decode(v),z=[],q=G.length;for(N=0;N<q;N++)z[N]=G.charCodeAt(N);return z}};const Base64=JXG$1.Util.Base64;JXG$1.FileReader={handleRemoteFile:function(v,N,G,z,q,Y){var W=!1;try{W=new XMLHttpRequest,G.toLowerCase()==="raw"?W.overrideMimeType("text/plain; charset="+q):W.overrideMimeType("text/xml; charset="+q)}catch{try{W=new ActiveXObject("Msxml2.XMLHTTP")}catch{try{W=new ActiveXObject("Microsoft.XMLHTTP")}catch{W=!1}}}if(!W){JXG$1.debug("AJAX not activated!");return}W.open("GET",v,z),G.toLowerCase()==="raw"?this.cbp=function(){var ie=W;ie.readyState===4&&N(ie.responseText)}:this.cbp=function(){var ie=W,ne="";ie.readyState===4&&(JXG$1.exists(ie.responseStream)&&(ie.responseText.slice(0,2)==="PK"||Encoding.asciiCharCodeAt(ie.responseText.slice(0,1),0)===31)?ne=Base64.decode(jxgBinFileReader(ie)):ne=ie.responseText,this.parseString(ne,N,G,Y))},this.cb=JXG$1.bind(this.cbp,this),W.onreadystatechange=this.cb;try{W.send(null)}catch{throw new Error("JSXGraph: A problem occurred while trying to read remote file '"+v+"'.")}},handleLocalFile:function(v,N,G,z,q,Y){JXG$1.exists(z)||(z=!0),G.toLowerCase()==="raw"?this.cbp=function(ie){N(ie.target.result)}:this.cbp=function(ie){var ne=ie.target.result;this.parseString(ne,N,G,Y)},this.cb=JXG$1.bind(this.cbp,this);var W=new FileReader;W.onload=this.cb,G.toLowerCase()==="raw"?W.readAsText(v):W.readAsText(v,q)},parseFileContent:function(v,N,G,z,q,Y){JXG$1.isString(v)||FileReader===void 0?this.handleRemoteFile(v,N,G,z,q,Y):this.handleLocalFile(v,N,G,z,q,Y)},parseString:function(v,N,G,z){var q,Y;if(G=G.toLowerCase(),q=JXG$1.readers[G],JXG$1.exists(q))Y=new q(N,v),Y.read();else if(G!=="jessiecode")throw new Error("JSXGraph: There is no reader available for '"+G+"'.");JXG$1.isFunction(z)&&z(N)}};!JXG$1.isMetroApp()&&JXG$1.isBrowser&&typeof navigator=="object"&&/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)&&document&&document.write&&document.write(`<script type="text/vbscript">
52Function Base64Encode(inData)
53  Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
54  Dim cOut, sOut, I
55  For I = 1 To LenB(inData) Step 3
56    Dim nGroup, pOut, sGroup
57    nGroup = &H10000 * AscB(MidB(inData, I, 1)) + _
58      &H100 * MyASC(MidB(inData, I + 1, 1)) + MyASC(MidB(inData, I + 2, 1))
59    nGroup = Oct(nGroup)
60    nGroup = String(8 - Len(nGroup), "0") & nGroup
61    pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _
62      Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _
63      Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _
64      Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)
65    sOut = sOut + pOut
66  Next
67  Select Case LenB(inData) Mod 3
68    Case 1: '8 bit final
69      sOut = Left(sOut, Len(sOut) - 2) + "=="
70    Case 2: '16 bit final
71      sOut = Left(sOut, Len(sOut) - 1) + "="
72  End Select
73  Base64Encode = sOut
74End Function
75
76Function MyASC(OneChar)
77  If OneChar = "" Then MyASC = 0 Else MyASC = AscB(OneChar)
78End Function
79
80Function jxgBinFileReader(xhr)
81    Dim byteString
82    Dim b64String
83    Dim i
84    byteString = xhr.responseBody
85    ReDim byteArray(LenB(byteString))
86    For i = 1 To LenB(byteString)
87        byteArray(i-1) = AscB(MidB(byteString, i, 1))
88    Next
89    b64String = Base64Encode(byteString)
90    jxgBinFileReader = b64String
91End Function
92<\/script>
93`);const FileReader$1=JXG$1.FileReader;JXG$1.GeonextParser={replacePow:function(v){var N,G,z,q,Y,W,ie,ne,se,ae,ce,pe;for(v=v.replace(/(\s*)\^(\s*)/g,"^"),ae=v.indexOf("^"),q=-1;ae>=0&&ae<v.length-1;){if(q===ae)throw new Error("JSXGraph: Error while parsing expression '"+v+"'");if(q=ae,se=v.slice(0,ae),ce=v.slice(ae+1),se.charAt(se.length-1)===")"){for(N=1,G=se.length-2;G>=0&&N>0;)z=se.charAt(G),z===")"?N++:z==="("&&(N-=1),G-=1;if(N===0){for(Y="",ie=se.substring(0,G+1),ne=G;ne>=0&&ie.slice(ne,ne+1).match(/([\w.]+)/);)Y=RegExp.$1+Y,ne-=1;Y+=se.substring(G+1,se.length),Y=Y.replace(/([()+*%^\-/\][])/g,"\\$1")}else throw new Error("JSXGraph: Missing '(' in expression")}else Y="[\\w\\.]+";if(ce.match(/^([\w.]*\()/)){for(N=1,G=RegExp.$1.length;G<ce.length&&N>0;)z=ce.charAt(G),z===")"?N-=1:z==="("&&(N+=1),G+=1;if(N===0)W=ce.substring(0,G),W=W.replace(/([()+*%^\-/[\]])/g,"\\$1");else throw new Error("JSXGraph: Missing ')' in expression")}else W="[\\w\\.]+";pe=new RegExp("("+Y+")\\^("+W+")"),v=v.replace(pe,"pow($1,$2)"),ae=v.indexOf("^")}return v},replaceIf:function(v){var N,G,z,q,Y,W,ie,ne,se,ae="",ce=null,pe=null,ge=null;if(z=v.indexOf("If("),z<0)return v;for(v=v.replace(/""/g,"0");z>=0;){for(N=v.slice(0,z),G=v.slice(z+3),Y=1,q=0,W=-1,ie=-1;q<G.length&&Y>0;)ne=G.charAt(q),ne===")"?Y-=1:ne==="("?Y+=1:ne===","&&Y===1&&(W<0?W=q:ie=q),q+=1;if(se=G.slice(0,q-1),G=G.slice(q),W<0||ie<0)return"";ce=se.slice(0,W),pe=se.slice(W+1,ie),ge=se.slice(ie+1),ce=this.replaceIf(ce),pe=this.replaceIf(pe),ge=this.replaceIf(ge),ae+=N+"(("+ce+")?("+pe+"):("+ge+"))",v=G,ce=null,pe=null,z=v.indexOf("If(")}return ae+=G,ae},replaceNameById:function(v,N,G){var z,q,Y,W,ie=0,ne=["X","Y","L","V"],se=function(ae){return G?"$('"+ae+"')":ae};for(W=0;W<ne.length;W++)for(ie=v.indexOf(ne[W]+"(");ie>=0;)ie>=0&&(z=v.indexOf(")",ie+2),z>=0&&(q=v.slice(ie+2,z),q=q.replace(/\\(['"])?/g,"$1"),Y=N.elementsByName[q],Y&&(v=v.slice(0,ie+2)+(G?"$('":"")+se(Y.id)+v.slice(z)))),z=v.indexOf(")",ie+2),ie=v.indexOf(ne[W]+"(",z);for(ie=v.indexOf("Dist(");ie>=0;)ie>=0&&(z=v.indexOf(",",ie+5),z>=0&&(q=v.slice(ie+5,z),q=q.replace(/\\(['"])?/g,"$1"),Y=N.elementsByName[q],Y&&(v=v.slice(0,ie+5)+se(Y.id)+v.slice(z)))),z=v.indexOf(",",ie+5),ie=v.indexOf(",",z),z=v.indexOf(")",ie+1),z>=0&&(q=v.slice(ie+1,z),q=q.replace(/\\(['"])?/g,"$1"),Y=N.elementsByName[q],Y&&(v=v.slice(0,ie+1)+se(Y.id)+v.slice(z))),z=v.indexOf(")",ie+1),ie=v.indexOf("Dist(",z);for(ne=["Deg","Rad"],W=0;W<ne.length;W++)for(ie=v.indexOf(ne[W]+"(");ie>=0;)ie>=0&&(z=v.indexOf(",",ie+4),z>=0&&(q=v.slice(ie+4,z),q=q.replace(/\\(['"])?/g,"$1"),Y=N.elementsByName[q],Y&&(v=v.slice(0,ie+4)+se(Y.id)+v.slice(z)))),z=v.indexOf(",",ie+4),ie=v.indexOf(",",z),z=v.indexOf(",",ie+1),z>=0&&(q=v.slice(ie+1,z),q=q.replace(/\\(['"])?/g,"$1"),Y=N.elementsByName[q],Y&&(v=v.slice(0,ie+1)+se(Y.id)+v.slice(z))),z=v.indexOf(",",ie+1),ie=v.indexOf(",",z),z=v.indexOf(")",ie+1),z>=0&&(q=v.slice(ie+1,z),q=q.replace(/\\(['"])?/g,"$1"),Y=N.elementsByName[q],Y&&(v=v.slice(0,ie+1)+se(Y.id)+v.slice(z))),z=v.indexOf(")",ie+1),ie=v.indexOf(ne[W]+"(",z);return v},replaceIdByObj:function(v){var N=/(X|Y|L)\(([\w_]+)\)/g;return v=v.replace(N,"$('$2').$1()"),N=/(V)\(([\w_]+)\)/g,v=v.replace(N,"$('$2').Value()"),N=/(Dist)\(([\w_]+),([\w_]+)\)/g,v=v.replace(N,"dist($('$2'), $('$3'))"),N=/(Deg)\(([\w_]+),([ \w[\w_]+),([\w_]+)\)/g,v=v.replace(N,"deg($('$2'),$('$3'),$('$4'))"),N=/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g,v=v.replace(N,"rad($('$1'),$('$2'),$('$3'))"),N=/N\((.+)\)/g,v=v.replace(N,"($1)"),v},geonext2JS:function(v,N){var G,z,q,Y=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],W=["abs","acos","asin","atan","ceil","cos","exp","factorial","floor","log","max","min","random","round","sin","sqrt","tan","ceil"];for(v=v.replace(/&lt;/g,"<"),v=v.replace(/&gt;/g,">"),v=v.replace(/&amp;/g,"&"),z=v,z=this.replaceNameById(z,N),z=this.replaceIf(z),z=this.replacePow(z),z=this.replaceIdByObj(z),q=0;q<Y.length;q++)G=new RegExp(["(\\W|^)(",Y[q],")"].join(""),"ig"),z=z.replace(G,["$1",W[q]].join(""));
93return z=z.replace(/True/g,"true"),z=z.replace(/False/g,"false"),z=z.replace(/fasle/g,"false"),z=z.replace(/Pi/g,"PI"),z=z.replace(/"/g,"'"),z},findDependencies:function(v,N,G){var z,q,Y,W;JXG$1.exists(G)||(G=v.board),z=G.elementsByName;for(q in z)z.hasOwnProperty(q)&&q!==v.name&&(z[q].elementClass===Const.OBJECT_CLASS_TEXT?z[q].evalVisProp("islabel")||(W=q.replace(/\[/g,"\\["),W=W.replace(/\]/g,"\\]"),Y=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+W+")(,[\\w\\[\\]'_ ]+)*\\)","g"),N.search(Y)>=0&&z[q].addChild(v)):(W=q.replace(/\[/g,"\\["),W=W.replace(/\]/g,"\\]"),Y=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+W+")(,[\\w\\[\\]'_ ]+)*\\)","g"),N.search(Y)>=0&&z[q].addChild(v)))},gxt2jc:function(v,N){var G;return v=v.replace(/&lt;/g,"<"),v=v.replace(/&gt;/g,">"),v=v.replace(/&amp;/g,"&"),G=v,G=this.replaceNameById(G,N,!0),G=G.replace(/True/g,"true"),G=G.replace(/False/g,"false"),G=G.replace(/fasle/g,"false"),G}};const GeonextParser=JXG$1.GeonextParser;JXG$1.GeometryElement=function(v,N,G,z){var q,Y,W;if(this.needsUpdate=!0,this.isDraggable=!1,this.isReal=!0,this.childElements={},this.hasLabel=!1,this.highlighted=!1,this.notExistingParents={},this.traces={},this.numTraces=0,this.transformations=[],this.baseElement=null,this.descendants={},this.ancestors={},this.parents=[],this.symbolic={},this.rendNode=null,this.elType="",this.dump=!0,this.subs={},this.inherits=[],this._pos=-1,this.stdform=[1,0,0,0,1,1,0,0],this.methodMap={setLabel:"setLabel",label:"label",setName:"setName",getName:"getName",Name:"getName",addTransform:"addTransform",setProperty:"setAttribute",setAttribute:"setAttribute",addChild:"addChild",animate:"animate",on:"on",off:"off",trigger:"trigger",addTicks:"addTicks",removeTicks:"removeTicks",removeAllTicks:"removeAllTicks",Bounds:"bounds"},this.quadraticform=[[1,0,0],[0,1,0],[0,0,1]],this.visProp={},this.visPropCalc={visible:!1},EventEmitter.eventify(this),this.mouseover=!1,this.lastDragTime=new Date,this.view=null,arguments.length>0){this.board=v,this.type=G,this._org_type=G,this.elementClass=z||Const.OBJECT_CLASS_OTHER,this.id=N.id,q=N.name,JXG$1.exists(q)||(q=this.board.generateName(this)),q!==""&&(this.board.elementsByName[q]=this),this.name=q,this.needsRegularUpdate=N.needsregularupdate,JXG$1.clearVisPropOld(this),W=this.resolveShortcuts(N);for(Y in W)W.hasOwnProperty(Y)&&this._set(Y,W[Y]);this.visProp.draft=W.draft&&W.draft.draft}};JXG$1.extend(JXG$1.GeometryElement.prototype,{addChild:function(v){var N,G;this.childElements[v.id]=v,this.addDescendants(v),v.ancestors[this.id]=this;for(N in this.descendants)if(this.descendants.hasOwnProperty(N)){this.descendants[N].ancestors[this.id]=this;for(G in this.ancestors)this.ancestors.hasOwnProperty(G)&&(this.descendants[N].ancestors[this.ancestors[G].id]=this.ancestors[G])}for(N in this.ancestors)if(this.ancestors.hasOwnProperty(N))for(G in this.descendants)this.descendants.hasOwnProperty(G)&&(this.ancestors[N].descendants[this.descendants[G].id]=this.descendants[G]);return this},addDescendants:function(v){var N;this.descendants[v.id]=v;for(N in v.childElements)v.childElements.hasOwnProperty(N)&&this.addDescendants(v.childElements[N]);return this},addParents:function(v){var N,G,z;for(JXG$1.isArray(v)?z=v:z=arguments,G=z.length,N=0;N<G;++N)JXG$1.exists(z[N])&&(JXG$1.isId(this.board,z[N])?this.parents.push(z[N]):JXG$1.exists(z[N].id)&&this.parents.push(z[N].id));this.parents=JXG$1.uniqueArray(this.parents)},setParents:function(v){this.parents=[],this.addParents(v)},addParentsFromJCFunctions:function(v){var N,G,z;for(N=0;N<v.length;N++)for(G in v[N].deps)z=v[N].deps[G],this.addParents(z),z.addChild(this);return this},removeChild:function(v){return delete this.childElements[v.id],this.removeDescendants(v),delete v.ancestors[this.id],this},removeDescendants:function(v){var N;delete this.descendants[v.id];for(N in v.childElements)v.childElements.hasOwnProperty(N)&&this.removeDescendants(v.childElements[N]);return this},countChildren:function(){var v,N,G=0;N=this.childElements;for(v in N)N.hasOwnProperty(v)&&v.indexOf("Label")<0&&G++;return G},getName:function(){return this.name},addTransform:function(v){return this},draggable:function(){return this.isDraggable&&!this.evalVisProp("fixed")&&this.type!==Const.OBJECT_TYPE_GLIDER},setPosition:function(v,N){var G=[],z,q,Y,W;if(!JXG$1.exists(this.parents))return this;for(Y=this.parents.length,q=0;q<Y;++q)if(z=this.board.select(this.parents[q]),JXG$1.isPoint(z)){if(!z.draggable())return this;G.push(z)}if(N.length===3&&(N=N.slice(1)),W=this.board.create("transform",N,{type:"translate"}),Y=G.length,Y>0){if(W.applyOnce(G),JXG$1.exists(this.view)&&this.view.elType==="view3d")for(q=0;q<this.parents.length;++q)z=this.view.select(this.parents[q]),JXG$1.exists(z.setPosition2D)&&z.setPosition2D(W)}else this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(W):this.addTransform(W);for(q=0;q<Y;++q)G[q].type===Const.OBJECT_TYPE_GLIDER&&G[q].updateGlider();return this},setPositionDirectly:function(v,N,G){var z=new Coords(v,N,this.board,!1),q=new Coords(v,G,this.board,!1),Y=Stat.subtract(z.usrCoords,q.usrCoords);return this.setPosition(Const.COORDS_BY_USER,Y),this},generatePolynomial:function(){return[]},animate:function(v,N,G){G=G||{};var z,q,Y,W=this.board.attr.animationdelay,ie=Math.ceil(N/W),ne=this,se=function(ce,pe,ge){var ve,be,Ee,Pe,Je;for(ve=JXG$1.rgb2hsv(ce),be=JXG$1.rgb2hsv(pe),Ee=(be[0]-ve[0])/ie,Pe=(be[1]-ve[1])/ie,Je=(be[2]-ve[2])/ie,ne.animationData[ge]=[],Y=0;Y<ie;Y++)ne.animationData[ge][ie-Y-1]=JXG$1.hsv2rgb(ve[0]+(Y+1)*Ee,ve[1]+(Y+1)*Pe,ve[2]+(Y+1)*Je)},ae=function(ce,pe,ge,ve){var be,Ee;if(ce=parseFloat(ce),pe=parseFloat(pe),!(isNaN(ce)||isNaN(pe)))for(Ee=(pe-ce)/ie,ne.animationData[ge]=[],Y=0;Y<ie;Y++)be=ce+(Y+1)*Ee,ne.animationData[ge][ie-Y-1]=ve?Math.floor(be):be};this.animationData={};for(z in v)if(v.hasOwnProperty(z))switch(q=z.toLowerCase(),q){case"strokecolor":case"fill
93color":se(this.visProp[q],v[z],q);break;case"size":if(!JXG$1.isPoint(this))break;ae(this.visProp[q],v[z],q,!0);break;case"strokeopacity":case"strokewidth":case"fillopacity":ae(this.visProp[q],v[z],q,!1);break}return this.animationCallback=G.callback,this.board.addAnimation(this),this},update:function(){return this.evalVisProp("trace")&&this.cloneToBackground(),this},updateRenderer:function(){return this},fullUpdate:function(v){return this.prepareUpdate().update().updateVisibility(v).updateRenderer()},setDisplayRendNode:function(v){var N,G,z,q,Y;if(v===void 0&&(v=this.visPropCalc.visible),v===this.visPropOld.visible)return this;for(this.board.renderer.display(this,v),G=this.inherits.length,z=0;z<G;z++)if(Y=this.inherits[z],JXG$1.isArray(Y))for(q=Y.length,N=0;N<q;N++)JXG$1.exists(Y[N])&&JXG$1.exists(Y[N].rendNode)&&Y[N].evalVisProp("visible")==="inherit"&&Y[N].setDisplayRendNode(v);else JXG$1.exists(Y)&&JXG$1.exists(Y.rendNode)&&Y.evalVisProp("visible")==="inherit"&&Y.setDisplayRendNode(v);return this.hasLabel&&JXG$1.exists(this.label)&&JXG$1.exists(this.label.rendNode)&&this.label.evalVisProp("visible")==="inherit"&&this.label.setDisplayRendNode(v),this},hide:function(){return this.setAttribute({visible:!1}),this},hideElement:function(){return this.hide(),this},show:function(){return this.setAttribute({visible:!0}),this},showElement:function(){return this.show(),this},updateVisibility:function(v){var N,G,z,q,Y,W;if(this.needsUpdate){if(JXG$1.exists(this.view)&&this.view.evalVisProp("visible")===!1)this.visPropCalc.visible=!1;else for(v!==void 0?this.visPropCalc.visible=v:(W=this.evalVisProp("visible"),JXG$1.exists(this.hiddenByParent)&&this.hiddenByParent&&(W=!1),W!=="inherit"&&(this.visPropCalc.visible=W)),G=this.inherits.length,z=0;z<G;z++)if(Y=this.inherits[z],JXG$1.isArray(Y))for(q=Y.length,N=0;N<q;N++)JXG$1.exists(Y[N])&&Y[N].evalVisProp("visible")==="inherit"&&Y[N].prepareUpdate().updateVisibility(this.visPropCalc.visible);else JXG$1.exists(Y)&&Y.evalVisProp("visible")==="inherit"&&Y.prepareUpdate().updateVisibility(this.visPropCalc.visible);JXG$1.exists(this.label)&&JXG$1.exists(this.label.visProp)&&this.label.evalVisProp("visible")&&this.label.prepareUpdate().updateVisibility(this.visPropCalc.visible)}return this},_set:function(v,N){var G;if(v=v.toLocaleLowerCase(),this.visProp.hasOwnProperty(v)&&v.indexOf("color")>=0&&JXG$1.isString(N)&&N.length===9&&N.charAt(0)==="#")N=JXG$1.rgba2rgbo(N),this.visProp[v]=N[0],this.visProp[v.replace("color","opacity")]=N[1];else if(N!==null&&JXG$1.isObject(N)&&!JXG$1.exists(N.id)&&!JXG$1.exists(N.name)){this.visProp[v]={};for(G in N)N.hasOwnProperty(G)&&(this.visProp[v][G.toLocaleLowerCase()]=N[G])}else this.visProp[v]=N},resolveShortcuts:function(v){var N,G,z,q=["traceattributes","traceAttributes"];for(N in Options.shortcuts)if(Options.shortcuts.hasOwnProperty(N)){if(JXG$1.exists(v[N]))for(G=0;G<Options.shortcuts[N].length;G++)JXG$1.exists(v[Options.shortcuts[N][G]])||(v[Options.shortcuts[N][G]]=v[N]);for(z=0;z<q.length;z++)JXG$1.isObject(v[q[z]])&&(v[q[z]]=this.resolveShortcuts(v[q[z]]))}return v},setLabel:function(v){this.hasLabel||this.setAttribute({withlabel:!0}),this.setLabelText(v)},setLabelText:function(v){return JXG$1.exists(this.label)&&(v=v.replace(/</g,"&lt;").replace(/>/g,"&gt;"),this.label.setText(v)),this},setName:function(v){v=v.replace(/</g,"&lt;").replace(/>/g,"&gt;"),this.elType!=="slider"&&this.setLabelText(v),this.setAttribute({name:v})},setProperty:function(){JXG$1.deprecated("setProperty()","setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(v){var N,G,z,q,Y,W,ie,ne,se,ae={};for(N=0;N<arguments.length;N++)W=arguments[N],JXG$1.isString(W)?(ne=W.split(":"),ae[JXG$1.trim(ne[0])]=JXG$1.trim(ne[1])):JXG$1.isArray(W)?ae[W[0]]=W[1]:JXG$1.extend(ae,W);ae=this.resolveShortcuts(ae);for(N in ae)if(ae.hasOwnProperty(N)){if(q=N.replace(/\s+/g,"").toLowerCase(),Y=ae[N],JXG$1.isObject(Y)&&JXG$1.exists(this.visProp[q])){if(!JXG$1.isObject(this.visProp[q])&&Y!==null&&JXG$1.isObject(Y)&&(this.visProp[q]={}),JXG$1.mergeAttr(this.visProp[q],Y),this.type===Const.OBJECT_TYPE_TICKS&&JXG$1.exists(this.labels))for(z=this.labels.length,G=0;G<z;G++)this.labels[G].setAttribute(Y);else if(JXG$1.exists(this[q]))if(JXG$1.isArray(this[q]))for(G=0;G<this[q].length;G++)this[q][G].setAttribute(Y);else this[q].setAttribute(Y);else se=null,this.triggerEventHandlers(["attribute:"+q],[se,Y,this]);continue}switch(se=this.visProp[q],q){case"checked":JXG$1.exists(this.rendNodeTag)&&(this.rendNodeCheckbox.checked=!!Y);break;case"disabled":JXG$1.exists(this.rendNodeTag)&&(this.rendNodeTag.disabled=!!Y);break;case"face":JXG$1.isPoint(this)&&(this.visProp.face=Y,this.board.renderer.changePointStyle(this));break;
93case"generatelabelvalue":this.type===Const.OBJECT_TYPE_TICKS&&JXG$1.isFunction(Y)&&(this.generateLabelValue=Y);break;case"gradient":this.visProp.gradient=Y,this.board.renderer.setGradient(this);break;case"gradientsecondcolor":Y=JXG$1.rgba2rgbo(Y),this.visProp.gradientsecondcolor=Y[0],this.visProp.gradientsecondopacity=Y[1],this.board.renderer.updateGradient(this);break;case"gradientsecondopacity":this.visProp.gradientsecondopacity=Y,this.board.renderer.updateGradient(this);break;case"infoboxtext":JXG$1.isString(Y)?this.infoboxText=Y:this.infoboxText=!1;break;case"labelcolor":Y=JXG$1.rgba2rgbo(Y),ie=Y[1],Y=Y[0],ie===0&&JXG$1.exists(this.label)&&this.hasLabel&&this.label.hideElement(),JXG$1.exists(this.label)&&this.hasLabel&&(this.label.visProp.strokecolor=Y,this.board.renderer.setObjectStrokeColor(this.label,Y,ie)),this.elementClass===Const.OBJECT_CLASS_TEXT&&(this.visProp.strokecolor=Y,this.visProp.strokeopacity=ie,this.board.renderer.setObjectStrokeColor(this,Y,ie));break;case"layer":this.board.renderer.setLayer(this,this.eval(Y)),this._set(q,Y);break;case"maxlength":JXG$1.exists(this.rendNodeTag)&&(this.rendNodeTag.maxlength=!!Y);break;case"name":se=this.name,delete this.board.elementsByName[this.name],this.name=Y,this.board.elementsByName[this.name]=this;break;case"needsregularupdate":this.needsRegularUpdate=!(Y==="false"||Y===!1),this.board.renderer.setBuffering(this,this.needsRegularUpdate?"auto":"static");break;case"onpolygon":this.type===Const.OBJECT_TYPE_GLIDER&&(this.onPolygon=!!Y);break;case"radius":(this.type===Const.OBJECT_TYPE_ANGLE||this.type===Const.OBJECT_TYPE_SECTOR)&&this.setRadius(Y);break;case"rotate":(this.elementClass===Const.OBJECT_CLASS_TEXT&&this.evalVisProp("display")==="internal"||this.type===Const.OBJECT_TYPE_IMAGE)&&this.addRotation(Y);break;case"tabindex":JXG$1.exists(this.rendNode)&&(this.rendNode.setAttribute("tabindex",Y),this._set(q,Y));break;case"trace":Y==="false"||Y===!1?(this.clearTrace(),this.visProp.trace=!1):Y==="pause"?this.visProp.trace=!1:this.visProp.trace=!0;break;case"visible":Y==="false"?this.visProp.visible=!1:Y==="true"?this.visProp.visible=!0:this.visProp.visible=Y,this.setDisplayRendNode(this.evalVisProp("visible")),this.evalVisProp("visible")&&JXG$1.exists(this.updateSize)&&this.updateSize();break;case"withlabel":this.visProp.withlabel=Y,this.evalVisProp("withlabel")?(this.label||this.createLabel(),this.label.setAttribute({visible:"inherit"})):this.label&&this.hasLabel&&this.label.setAttribute({visible:!1}),this.hasLabel=Y;break;case"straightfirst":case"straightlast":this._set(q,Y);for(G in this.childElements)this.childElements.hasOwnProperty(G)&&this.childElements[G].elType==="glider"&&this.childElements[G].fullUpdate();break;default:JXG$1.exists(this.visProp[q])&&(!JXG$1.Validator[q]||JXG$1.Validator[q]&&JXG$1.Validator[q](Y)||JXG$1.Validator[q]&&JXG$1.isFunction(Y)&&JXG$1.Validator[q](Y(this)))?(Y=Y.toLowerCase&&Y.toLowerCase()==="false"?!1:Y,this._set(q,Y)):q in Options.shortcuts||JXG$1.warn("attribute '"+q+"' does not accept type '"+typeof Y+"' of value "+Y+".");break}this.triggerEventHandlers(["attribute:"+q],[se,Y,this])}return this.triggerEventHandlers(["attribute"],[ae,this]),this.evalVisProp("needsregularupdate")?this.board.update(this):this.board.fullUpdate(),this.elementClass===Const.OBJECT_CLASS_TEXT&&this.updateSize(),this},getProperty:function(){JXG$1.deprecated("getProperty()","getAttribute()"),this.getProperty.apply(this,arguments)},getAttribute:function(v){var N;switch(v=v.toLowerCase(),v){case"needsregularupdate":N=this.needsRegularUpdate;break;case"labelcolor":N=this.label.visProp.strokecolor;break;case"infoboxtext":N=this.infoboxText;break;case"withlabel":N=this.hasLabel;break;default:N=this.visProp[v];break}return N},evalVisProp:function(v){var N,G,z,q;if(v=v.toLowerCase(),v.indexOf(".")===-1)N=this.visProp[v];else for(G=v.split("."),q=G.length,N=this.visProp,z=0;z<q;z++)N=N[G[z]];return JXG$1.isFunction(N)?this.visProp.islabel===!0&&JXG$1.exists(this.visProp.anchor)?this.visProp.anchor.visProp.element3d!==null?N(this.visProp.anchor.visProp.element3d):N(this.visProp.anchor):JXG$1.exists(this.visProp.element3d)?N(this.visProp.element3d):N(this):N},eval:function(v){return JXG$1.isFunction(v)?this.visProp.islabel===!0&&JXG$1.exists(this.visProp.anchor)?this.visProp.anchor.visProp.element3d!==null?v(this.visProp.anchor.visProp.element3d):v(this.visProp.anchor):this.visProp.element3d!==null?v(this.visProp.element3d):v(this):v},setDash:function(v){return this.setAttribute({dash:v}),this},prepareUpdate:function(){return this.needsUpdate=!0,this},remove:function(){return this.board.renderer.remove(this.rendNode),this.hasLabel&&this.board.renderer.remove(this.board.renderer.getElementById(this.label.id)),this},getTextAnchor:function(){return new Coords(Const.COORDS_BY_USER,[0,0],this.board)},getLabelAnchor:function(){return new Coords(Const.COORDS_BY_USER,[0,0],this.board)},setArrow:function(v,N){return this.visProp.firstarrow=v,this.visProp.lastarrow=N,N&&(this.t
93ype=Const.OBJECT_TYPE_VECTOR,this.elType="arrow"),this.prepareUpdate().update().updateVisibility().updateRenderer(),this},createGradient:function(){var v=this.evalVisProp("gradient");(v==="linear"||v==="radial")&&this.board.renderer.setGradient(this)},createLabel:function(){var v,N=this;return JXG$1.elements.text?(v=JXG$1.deepCopy(this.visProp.label,null),v.id=this.id+"Label",v.isLabel=!0,v.anchor=this,v.priv=this.visProp.priv,this.visProp.withlabel&&(this.label=JXG$1.elements.text(this.board,[0,0,function(){return JXG$1.isFunction(N.name)?N.name(N):N.name}],v),this.label.needsUpdate=!0,this.label.dump=!1,this.label.fullUpdate(),this.hasLabel=!0)):JXG$1.debug("JSXGraph: Can't create label: text element is not available. Make sure you include base/text"),this},highlight:function(v){return v=JXG$1.def(v,!1),this.evalVisProp("highlight")&&(!this.highlighted||v)&&(this.highlighted=!0,this.board.highlightedObjects[this.id]=this,this.board.renderer.highlight(this)),this},noHighlight:function(){return this.highlighted&&(this.highlighted=!1,delete this.board.highlightedObjects[this.id],this.board.renderer.noHighlight(this)),this},clearTrace:function(){var v;for(v in this.traces)this.traces.hasOwnProperty(v)&&this.board.renderer.remove(this.traces[v]);return this.numTraces=0,this},cloneToBackground:function(){return this},bounds:function(){return[0,0,0,0]},normalize:function(){return this.stdform=Mat.normalize(this.stdform),this},toJSON:function(){var v,N,G=['{"name":',this.name];G.push(', "id":'+this.id),v=[];for(N in this.visProp)this.visProp.hasOwnProperty(N)&&JXG$1.exists(this.visProp[N])&&v.push('"'+N+'":'+this.visProp[N]);return G.push(', "visProp":{'+v.toString()+"}"),G.push("}"),G.join("")},addRotation:function(v){var N,G,z,q,Y,W=this;return(this.elementClass===Const.OBJECT_CLASS_TEXT||this.type===Const.OBJECT_TYPE_IMAGE)&&v!==0&&(N=this.board.create("transform",[function(){return-W.X()},function(){return-W.Y()}],{type:"translate"}),G=this.board.create("transform",[function(){return W.X()},function(){return W.Y()}],{type:"translate"}),z=this.board.create("transform",[function(){return W.board.unitX/W.board.unitY},function(){return 1}],{type:"scale"}),q=this.board.create("transform",[function(){return W.board.unitY/W.board.unitX},function(){return 1}],{type:"scale"}),Y=this.board.create("transform",[function(){return W.eval(v)*Math.PI/180}],{type:"rotate"}),N.bindTo(this),z.bindTo(this),Y.bindTo(this),q.bindTo(this),G.bindTo(this)),this},highlightStrokeColor:function(v){return JXG$1.deprecated("highlightStrokeColor()","setAttribute()"),this.setAttribute({highlightStrokeColor:v}),this},strokeColor:function(v){return JXG$1.deprecated("strokeColor()","setAttribute()"),this.setAttribute({strokeColor:v}),this},strokeWidth:function(v){return JXG$1.deprecated("strokeWidth()","setAttribute()"),this.setAttribute({strokeWidth:v}),this},fillColor:function(v){return JXG$1.deprecated("fillColor()","setAttribute()"),this.setAttribute({fillColor:v}),this},highlightFillColor:function(v){return JXG$1.deprecated("highlightFillColor()","setAttribute()"),this.setAttribute({highlightFillColor:v}),this},labelColor:function(v){return JXG$1.deprecated("labelColor()","setAttribute()"),this.setAttribute({labelColor:v}),this},dash:function(v){return JXG$1.deprecated("dash()","setAttribute()"),this.setAttribute({dash:v}),this},visible:function(v){return JXG$1.deprecated("visible()","setAttribute()"),this.setAttribute({visible:v}),this},shadow:function(v){return JXG$1.deprecated("shadow()","setAttribute()"),this.setAttribute({shadow:v}),this},getType:function(){return this.elType},getParents:function(){return JXG$1.isArray(this.parents)?this.parents:[]},snapToGrid:function(){return this},snapToPoints:function(){return this},getAttributes:function(){var v=JXG$1.deepCopy(this.visProp),N=[],G,z=N.length;for(v.id=this.id,v.name=this.name,G=0;G<z;G++)delete v[N[G]];return v},hasPoint:function(v,N){return!1},addTicks:function(v){return(v.id===""||!JXG$1.exists(v.id))&&(v.id=this.id+"_ticks_"+(this.ticks.length+1)),this.board.renderer.drawTicks(v),this.ticks.push(v),v.id},removeAllTicks:function(){var v;if(JXG$1.exists(this.ticks)){for(v=this.ticks.length-1;v>=0;v--)this.removeTicks(this.ticks[v]);this.ticks=[],this.board.update()}},removeTicks:function(v){var N,G;if(JXG$1.exists(this.defaultTicks)&&this.defaultTicks===v&&(this.defaultTicks=null),JXG$1.exists(this.ticks)){for(N=this.ticks.length-1;N>=0;N--)if(this.ticks[N]===v){if(this.board.removeObject(this.ticks[N]),this.ticks[N].ticks)for(G=0;G<this.ticks[N].ticks.length;G++)JXG$1.exists(this.ticks[N].labels[G])&&this.board.removeObject(this.ticks[N].labels[G]);delete this.ticks[N];break}}},getSnapSizes:function(){var v,N,G;return v=this.evalVisProp("snapsizex"),N=this.evalVisProp("snapsizey"),v<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(G=this.board.defaultAxes.x.defaultTicks,v=G.ticksDelta*(G.evalVisProp("minorticks")+1)),N<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(G=this.board.defaultAxes.y.defaultTicks,N=G.ticksDelta*(G.evalVisProp("minorticks")+1)),[v,N]}
93,handleSnapToGrid:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge=!1,ve=this.evalVisProp("attracttogrid"),be=this.evalVisProp("attractorunit"),Ee=this.evalVisProp("attractordistance");return!JXG$1.exists(this.coords)||this.evalVisProp("fixed")?this:(ge=this.evalVisProp("snaptogrid")||ve||v===!0,ge&&(G=this.coords.usrCoords[1],z=this.coords.usrCoords[2],ae=this.getSnapSizes(),ce=ae[0],pe=ae[1],ce>0&&pe>0&&(se=this.board.getBoundingBox(),q=Math.round(G/ce)*ce,Y=Math.round(z/pe)*pe,W=new JXG$1.Coords(Const.COORDS_BY_USER,[q,Y],this.board),(!ve||W.distance(be==="screen"?Const.COORDS_BY_SCREEN:Const.COORDS_BY_USER,this.coords)<Ee)&&(G=q,z=Y,N||(ie=Math.min(se[0],se[2]),ne=Math.max(se[0],se[2]),G<ie&&G>ie-ce?G+=ce:G>ne&&G<ne+ce&&(G-=ce),ie=Math.min(se[1],se[3]),ne=Math.max(se[1],se[3]),z<ie&&z>ie-pe?z+=pe:z>ne&&z<ne+pe&&(z-=pe)),this.coords.setCoordinates(Const.COORDS_BY_USER,[G,z])))),this)},getBoundingBox:function(){var v,N,G,z,q,Y,W=[1/0,1/0,-1/0,-1/0];if(this.type===Const.OBJECT_TYPE_POLYGON){if(N=this.vertices.length-1,N<=0)return W;for(v=0;v<N;v++)G=this.vertices[v].X(),W[0]=G<W[0]?G:W[0],W[2]=G>W[2]?G:W[2],G=this.vertices[v].Y(),W[1]=G<W[1]?G:W[1],W[3]=G>W[3]?G:W[3]}else if(this.elementClass===Const.OBJECT_CLASS_CIRCLE)z=this.center.X(),q=this.center.Y(),W=[z-this.radius,q+this.radius,z+this.radius,q-this.radius];else if(this.elementClass===Const.OBJECT_CLASS_CURVE){if(N=this.points.length,N===0)return W;for(v=0;v<N;v++)G=this.points[v].usrCoords[1],W[0]=G<W[0]?G:W[0],W[2]=G>W[2]?G:W[2],G=this.points[v].usrCoords[1],W[1]=G<W[1]?G:W[1],W[3]=G>W[3]?G:W[3]}else this.elementClass===Const.OBJECT_CLASS_POINT&&(z=this.X(),q=this.Y(),Y=this.evalVisProp("size"),W=[z-Y/this.board.unitX,q-Y/this.board.unitY,z+Y/this.board.unitX,q+Y/this.board.unitY]);return W},addEvent:JXG$1.shortcut(JXG$1.GeometryElement.prototype,"on"),removeEvent:JXG$1.shortcut(JXG$1.GeometryElement.prototype,"off"),formatNumberLocale:function(v,N){var G,z,q,Y={},W={maximumfractiondigits:"maximumFractionDigits",minimumfractiondigits:"minimumFractionDigits",compactdisplay:"compactDisplay",currencydisplay:"currencyDisplay",currencysign:"currencySign",localematcher:"localeMatcher",numberingsystem:"numberingSystem",signdisplay:"signDisplay",unitdisplay:"unitDisplay",usegrouping:"useGrouping",roundingmode:"roundingMode",roundingpriority:"roundingPriority",roundingincrement:"roundingIncrement",trailingzerodisplay:"trailingZeroDisplay",minimumintegerdigits:"minimumIntegerDigits",minimumsignificantdigits:"minimumSignificantDigits",maximumsignificantdigits:"maximumSignificantDigits"};if(JXG$1.exists(Intl)&&this.useLocale()){G=this.evalVisProp("intl.locale")||this.eval(this.board.attr.intl.locale),z=this.evalVisProp("intl.options")||{};for(q in z)z.hasOwnProperty(q)&&(W.hasOwnProperty(q)?Y[W[q]]=this.eval(z[q]):Y[q]=this.eval(z[q]));return q="maximumfractiondigits",JXG$1.exists(z[q])||(Y[W[q]]=N),Intl.NumberFormat(G,Y).format(v)}return v},useLocale:function(){var v;return!JXG$1.exists(this.visProp.intl)||!JXG$1.exists(this.visProp.intl.enabled)?!1:(v=this.evalVisProp("intl.enabled"),v===!0||v==="inherit"&&this.eval(this.board.attr.intl.enabled)===!0)},__evt__over:function(v){},__evt__mouseover:function(v){},__evt__out:function(v){},__evt__mouseout:function(v){},__evt__move:function(v){},__evt__mousemove:function(v){},__evt__drag:function(v){},__evt__mousedrag:function(v){},__evt__pendrag:function(v){},__evt__touchdrag:function(v){},__evt__keydrag:function(v){},__evt__down:function(v){},__evt__mousedown:function(v){},__evt__pendown:function(v){},__evt__touchdown:function(v){},__evt__click:function(v){},__evt__dblclick:function(v){},__evt__mouseclick:function(v){},__evt__mousedblclick:function(v){},__evt__pointerclick:function(v){},__evt__pointerdblclick:function(v){},__evt__up:function(v){},__evt__mouseup:function(v){},__evt__penup:function(v){},__evt__touchup:function(v){},__evt__attribute:function(v,N){},__evt__attribute_:function(v,N,G){},__evt:function(){}});const GeometryElement=JXG$1.GeometryElement;JXG$1.CoordsElement=function(v,N){var G;for(JXG$1.exists(v)||(v=[1,0,0]),G=0;G<v.length;++G)v[G]=parseFloat(v[G]);this.coords=new Coords(Const.COORDS_BY_USER,v,this.board),this.initialCoords=new Coords(Const.COORDS_BY_USER,v,this.board),this.actualCoords=new Coords(Const.COORDS_BY_USER,v,this.board),this.position=null,this.isConstrained=!1,this.onPolygon=!1,this.slideObject=null,this.slideObjects=[],this.needsUpdateFromParent=!0,this.groups=[],this.Xjc=null,this.Yjc=null,this.methodMap=JXG$1.deepCopy(this.methodMap,{move:"moveTo",moveTo:"moveTo",moveAlong:"moveAlong",visit:"visit",glide:"makeGlider",makeGlider:"makeGlider",intersect:"makeIntersection",makeIntersection:"makeIntersection",X:"X",Y:"Y",Coords:"Coords",free:"free",setPosition:"setGliderPosition",setGliderPosition:"setGliderPosition",addConstraint:"addConstraint",dist:"Dist",Dist:"Dist",onPolygon:"onPolygon",startAnimation:"startAnimation",stopAnimation:"stopAnimation"}),JXG$1.exists(this.element)&&this.addAnchor(v,N),this.isDraggable=!0};JXG$1.extend(JXG$1.CoordsElement.prototype,{updateConstraint:function(){return this},updateCoords:function(v){return this.needsUpdate?(JXG$1.exists(v)||(v=!1),this.evalVisProp("frozen")||this.updateConstraint(),this.type===Const.OBJECT_TYPE_GLIDER&&(this.isConstrained&&(v=!1),v?this.updateGliderFromParent():this.updateGlider()),this.updateTransform(v),this):this},updateGlider:function(){var v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe=2*Math.PI,ge,ve,be,Ee,Pe,Je=!1,Ce,Ve,Re,qe=this.slideObject,et,Ze,tt=[],Ke;if(this.needsUpdateFromParent=!1,qe.elementClass===Const.OBJECT_CLASS_CIRCLE)this.evalVisProp("isgeonext")&&(pe=1),Ee=Geometry.projectPointToCircle(this,qe,this.board),Pe=Geometry.rad([qe.center.X()+1,qe.center.Y()],qe.center,this)/pe;else if(qe.elementClass===Const.OBJECT_CLASS_LINE){if(this.onPolygon){if(z=qe.point1.coords.usrCoords,q=qe.point2.coords.usrCoords,v=1,N=q[v]-z[v],Math.abs(N)<Mat.eps&&(v=2,N=q[v]-z[v]),W=Geometry.projectPointToLine(this,qe,this.board),ie=(W.usrCoords[v]-z[v])/N,Y=qe.parentPolygon,ie<0){for(v=0;v<Y.borders.length;v++)if(qe===Y.borders[v]){qe=Y.borders[(v-1+Y.borders.length)%Y.borders.length];break}}else if(ie>1){for(v=0;v<Y.borders.length;v++)if(qe===Y.borders[v]){qe=Y.borders[(v+1+Y.borders.length)%Y.borders.length];break}}qe.id!==this.slideObject.id&&(this.slideObject=qe)}z=qe.point1.coords,q=qe.point2.coords,N=z.distance(Const.COORDS_BY_USER,q),N<Mat.eps?(Ee=z,Je=!0,Pe=0):(Ee=Geometry.projectPointToLine(this,qe,this.board),z=z.usrCoords.slice(0),q=q.usrCoords.slice(0),Math.abs(q[0])<Mat.eps?(v=1,N=q[v],Math.abs(N)<Mat.eps&&(v=2,N=q[v]),N=(Ee.usrCoords[v]-z[v])/N,se=N>=0?1:-1,N=Math.abs(N),Pe=se*N/(N+1)):Math.abs(z[0])<Mat.eps?(v=1,N=z[v],Math.abs(N)<Mat.eps&&(v=2,N=z[v]),N=(Ee.usrCoords[v]-q[v])/N,N<0?Pe=(1-2*N)/(1-N):Pe=1/(N+1)):(v=1,N=q[v]-z[v],Math.abs(N)<Mat.eps&&(v=2,N=q[v]-z[v]),Pe=(Ee.usrCoords[v]-z[v])/N)),Ve=this.findClosestSnapValue(Pe),Ve!==null?(Re=this.evalVisProp("snapvalues"),Pe=(Re[Ve]-this._smin)/(this._smax-this._smin),this.update(!0)):(Ce=this.evalVisProp("snapwidth"),Ce>0&&Math.abs(this._smax-this._smin)>=Mat.eps&&(Pe=Math.max(Math.min(Pe,1),0),G=Pe*(this._smax-this._smin),G=Math.round(G/Ce)*Ce+this._smin,Pe=(G-this._smin)/(this._smax-this._smin),this.update(!0))),z=qe.point1.coords,!qe.evalVisProp("straightfirst")&&Math.abs(z.usrCoords[0])>Mat.eps&&Pe<0&&(Ee=z,Je=!0,Pe=0),q=qe.point2.coords,!qe.evalVisProp("straightlast")&&Math.abs(q.usrCoords[0])>Mat.eps&&Pe>1&&(Ee=q,Je=!0,Pe=1)}else if(qe.type===Const.OBJECT_TYPE_TURTLE)this.updateConstraint(),et=Geometry.projectPointToTurtle(this,qe,this.board),Ee=et[0],Pe=et[1];else if(qe.elementClass===Const.OBJECT_CLASS_CURVE)if(qe.type===Const.OBJECT_TYPE_ARC||qe.type===Const.OBJECT_TYPE_SECTOR)Ee=Geometry.projectPointToCircle(this,qe,this.board),ne=Geometry.rad(qe.radiuspoint,qe.center,this),ae=0,ce=Geometry.rad(qe.radiuspoint,qe.center,qe.anglepoint),Pe=ne,Ce=qe.evalVisProp("selection"),(Ce==="minor"&&ce>Math.PI||Ce==="major"&&ce<Math.PI)&&(ae=ce,ce=2*Math.PI),(ne<ae||ne>ce)&&(Pe=ce,(ne<ae&&ne>ae*.5||ne>ce&&ne>ce*.5+Math.PI)&&(Pe=ae),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),pe=ce-ae,this.visProp.isgeonext&&(pe=1),Math.abs(pe)>Mat.eps&&(Pe/=pe);else if(this.updateConstraint(),qe.transformations.length>0){for(Ke=!1,et=qe.getTransformationSource(),et[0]&&(Ke=et[0],tt.push(qe),tt.push(et[1]));et[0]&&JXG$1.exists(et[1]._transformationSource);)et=et[1].getTransformationSource(),tt.push(et[1]);if(Ze=this.coords.usrCoords,Ke){for(v=0;v<tt.length;v++)tt[v].updateTransformMatrix(),be=Mat.inverse(tt[v].transformMat),Ze=Mat.matVecMult(be,Ze);for(ge=new Coords(Const.COORDS_BY_USER,Ze,this.board).usrCoords,ve=Geometry.projectCoordsToCurve(ge[1],ge[2],this.position||0,tt[tt.length-1],this.board),Ze=ve[0].usrCoords,v=tt.length-2;v>=0;v--)Ze=Mat.matVecMult(tt[v].transformMat,Ze);ve[0]=new Coords(Const.COORDS_BY_USER,Ze,this.board)}else qe.updateTransformMatrix(),be=Mat.inverse(qe.transformMat),Ze=Mat.matVecMult(be,Ze),ge=new Coords(Const.COORDS_BY_USER,Ze,this.board).usrCoords,ve=Geometry.projectCoordsToCurve(ge[1],ge[2],this.position||0,qe,this.board);Ee=ve[0],Pe=ve[1]}else et=Geometry.projectPointToCurve(this,qe,this.board),Ee=et[0],Pe=et[1];else JXG$1.isPoint(qe)&&(Ee=Geometry.projectPointToPoint(this,qe,this.board),Pe=this.position);this.coords.setCoordinates(Const.COORDS_BY_USER,Ee.usrCoords,Je),this.position=Pe},findClosestSnapValue:function(v){var N,G,z,q,Y=null;if(z=this.evalVisProp("snapvalues"),q=this.evalVisProp("snapvaluedistance"),JXG$1.isArray(z)&&Math.abs(this._smax-this._smin)>=Mat.eps&&q>0)for(N=0;N<z.length;N++)G=Math.abs(v*(this._smax-this._smin)+this._smin-z[N]),G<q&&(q=G,Y=N);return Y},updateGliderFromParent:function(){var v,N,G,z,q,Y=this.slideObject,W=[],ie,ne,se,ae,ce,pe,ge,ve=2*Math.PI;if(!this.needsUpdateFromParent){this.needsUpdateFromParent=!0;return}if(Y.elementClass===Const.OBJECT_CLASS_CIRCLE)G=Y.Radius(),this.evalVisProp("isgeonext")&&(ve=1),q=[Y.center.X()+G*Math.cos(this.position*ve),Y.center.Y()+G*Math.sin(this.position*ve)];else if(Y.elementClass===Const.OBJECT_CLASS_LINE)v=Y.point1.coords.usrCoords,N=Y.point2.coords.usrCoords,v[0]===0&&v[1]===0&&v[2]===0||N[0]===0&&N[1]===0&&N[2]===0?q=[0,0,0]:Math.abs(N[0])<Mat.eps?(z=Math.min(Math.abs(this.position),1-Mat.eps),z/=1-z,this.position<0&&(z=-z),q=[v[0]+z*N[0],v[1]+z*N[1],v[2]+z*N[2]]):Math.abs(v[0])<Mat.eps?(z=Math.max(this.position,Mat.eps),z=Math.min(z,2-Mat.eps),z>1?z=(z-1)/(z-2):z=(1-z)/z,q=[N[0]+z*v[0],N[1]+z*v[1],N[2]+z*v[2]]):(z=this.position,q=[v[0]+z*(N[0]-v[0]),v[1]+z*(N[1]-v[1]),v[2]+z*(N[2]-v[2])]);else if(Y.type===Const.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(Const.COORDS_BY_USER,[Y.Z(this.position),Y.X(this.position),Y.Y(this.position)]),this.updateConstraint(),q=Geometry.projectPointToTurtle(this,Y,this.board)[0].usrCoords;else if(Y.elementClass===Const.OBJECT_CLASS_CURVE){for(se=!1,ie=Y.getTransformationSource(),ie[0]&&(se=ie[0],W.push(Y),W.push(ie[1]));ie[0]&&JXG$1.exists(ie[1]._transformationSource);)ie=ie[1].getTransformationSource(),W.push(ie[1]);if(se?this.coords.setCoordinates(Const.COORDS_BY_USER,[W[W.length-1].Z(this.position),W[W.length-1].X(this.position),W[W.length-1].Y(this.position)]):this.coords.setCoordinates(Const.COORDS_BY_USER,[Y.Z(this.position),Y.X(this.position),Y.Y(this.position)]),Y.type===Const.OBJECT_TYPE_ARC||Y.type===Const.OBJECT_TYPE_SECTOR)ae=Geometry.rad([Y.center.X()+1,Y.center.Y()],Y.center,Y.radiuspoint),ce=0,ge=Geometry.rad(Y.radiu
93spoint,Y.center,Y.anglepoint),(Y.visProp.selection==="minor"&&ge>Math.PI||Y.visProp.selection==="major"&&ge<Math.PI)&&(ce=ge,ge=2*Math.PI),ve=ge-ce,this.evalVisProp("isgeonext")&&(ve=1),pe=this.position*ve,(pe<ce||pe>ge)&&(pe=ge,(pe<ce&&pe>ce*.5||pe>ge&&pe>ge*.5+Math.PI)&&(pe=ce),this.position=pe,Math.abs(ve)>Mat.eps&&(this.position/=ve)),G=Y.Radius(),q=[Y.center.X()+G*Math.cos(this.position*ve+ae),Y.center.Y()+G*Math.sin(this.position*ve+ae)];else if(this.updateConstraint(),se)for(q=Geometry.projectPointToCurve(this,W[W.length-1],this.board)[0].usrCoords,ne=W.length-2;ne>=0;ne--)q=new Coords(Const.COORDS_BY_USER,Mat.matVecMult(W[ne].transformMat,q),this.board).usrCoords;else q=Geometry.projectPointToCurve(this,Y,this.board)[0].usrCoords}else JXG$1.isPoint(Y)&&(q=Geometry.projectPointToPoint(this,Y,this.board).usrCoords);this.coords.setCoordinates(Const.COORDS_BY_USER,q,!1)},updateRendererGeneric:function(v){return!this.needsUpdate||!this.board.renderer?this:(this.visPropCalc.visible&&(this.isReal=!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]),this.isReal=Math.abs(this.coords.usrCoords[0])>Mat.eps?this.isReal:!1,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer[v](this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this)},X:function(){return this.coords.usrCoords[1]},Y:function(){return this.coords.usrCoords[2]},Z:function(){return this.coords.usrCoords[0]},Coords:function(v){return v?this.coords.usrCoords.slice():this.coords.usrCoords.slice(1)},XEval:function(){return this.coords.usrCoords[1]},YEval:function(){return this.coords.usrCoords[2]},ZEval:function(){return this.coords.usrCoords[0]},Dist:function(v){return this.isReal&&v.isReal?this.coords.distance(Const.COORDS_BY_USER,v.coords):NaN},snapToGrid:function(v){return this.handleSnapToGrid(v)},handleSnapToPoints:function(v){var N,G,z,q=0,Y,W=1/0,ie=null,ne,se,ae=this.evalVisProp("ignoredsnaptopoints"),ce,pe,ge=!1;if(Y=this.board.objectsList.length,ae&&(ce=ae.length),this.evalVisProp("snaptopoints")||v){for(ne=this.evalVisProp("attractorunit"),se=this.evalVisProp("attractordistance"),N=0;N<Y;N++){if(G=this.board.objectsList[N],ae){for(ge=!1,pe=0;pe<ce;pe++)if(G===this.board.select(ae[pe])){ge=!0;break}if(ge)continue}JXG$1.isPoint(G)&&G!==this&&G.visPropCalc.visible&&(z=Geometry.projectPointToPoint(this,G,this.board),ne==="screen"?q=z.distance(Const.COORDS_BY_SCREEN,this.coords):q=z.distance(Const.COORDS_BY_USER,this.coords),q<se&&q<W&&(W=q,ie=z))}ie!==null&&this.coords.setCoordinates(Const.COORDS_BY_USER,ie.usrCoords)}return this},snapToPoints:function(v){return this.handleSnapToPoints(v)},handleAttractors:function(){var v,N,G,z=0,q,Y=this.evalVisProp("attractorunit"),W=this.evalVisProp("attractordistance"),ie=this.evalVisProp("snatchdistance"),ne=this.evalVisProp("attractors"),se=ne.length;if(W!==0){for(v=0;v<se;v++)if(N=this.board.select(ne[v]),JXG$1.exists(N)&&N!==this){if(JXG$1.isPoint(N)?G=Geometry.projectPointToPoint(this,N,this.board):N.elementClass===Const.OBJECT_CLASS_LINE?(q=Geometry.projectCoordsToSegment(this.coords.usrCoords,N.point1.coords.usrCoords,N.point2.coords.usrCoords),!N.evalVisProp("straightfirst")&&q[1]<0?G=N.point1.coords:!N.evalVisProp("straightlast")&&q[1]>1?G=N.point2.coords:G=new Coords(Const.COORDS_BY_USER,q[0],this.board)):N.elementClass===Const.OBJECT_CLASS_CIRCLE?G=Geometry.projectPointToCircle(this,N,this.board):N.elementClass===Const.OBJECT_CLASS_CURVE?G=Geometry.projectPointToCurve(this,N,this.board)[0]:N.type===Const.OBJECT_TYPE_TURTLE?G=Geometry.projectPointToTurtle(this,N,this.board)[0]:N.type===Const.OBJECT_TYPE_POLYGON&&(G=new Coords(Const.COORDS_BY_USER,Geometry.projectCoordsToPolygon(this.coords.usrCoords,N),this.board)),Y==="screen"?z=G.distance(Const.COORDS_BY_SCREEN,this.coords):z=G.distance(Const.COORDS_BY_USER,this.coords),z<W){this.type===Const.OBJECT_TYPE_GLIDER&&(N===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===N)||this.makeGlider(N);break}z>=ie&&(N===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===N)&&this.popSlideObject()}return this}},setPositionDirectly:function(v,N){var G,z,q,Y,W=this.coords,ie;if(this.relativeCoords)return z=new Coords(v,N,this.board),this.evalVisProp("islabel")?(q=Stat.subtract(z.scrCoords,W.scrC
93oords),this.relativeCoords.scrCoords[1]+=q[1],this.relativeCoords.scrCoords[2]+=q[2]):(q=Stat.subtract(z.usrCoords,W.usrCoords),this.relativeCoords.usrCoords[1]+=q[1],this.relativeCoords.usrCoords[2]+=q[2]),this;if(this.coords.setCoordinates(v,N),this.handleSnapToGrid(),this.handleSnapToPoints(),this.handleAttractors(),this.actualCoords.setCoordinates(Const.COORDS_BY_USER,this.coords.usrCoords),this.transformations.length>0){for(v===Const.COORDS_BY_SCREEN?ie=new Coords(v,N,this.board).usrCoords:(N.length===2&&(N=[1].concat(N)),ie=N),Y=[[1,0,0],[0,1,0],[0,0,1]],G=0;G<this.transformations.length;G++)Y=Mat.matMatMult(this.transformations[G].matrix,Y);ie=Mat.matVecMult(Mat.inverse(Y),ie),this.initialCoords.setCoordinates(Const.COORDS_BY_USER,ie),this.elementClass!==Const.OBJECT_CLASS_POINT&&this.coords.setCoordinates(Const.COORDS_BY_USER,ie)}return this.prepareUpdate().update(),this.board.isSuspendedUpdate&&this.type===Const.OBJECT_TYPE_GLIDER&&this.updateGlider(),this},setPositionByTransform:function(v,N){var G;return N=new Coords(v,N,this.board),G=this.board.create("transform",N.usrCoords.slice(1),{type:"translate"}),this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(G):this.addTransform(this,G),this.prepareUpdate().update(),this},setPosition:function(v,N){return this.setPositionDirectly(v,N)},setGliderPosition:function(v){return this.type===Const.OBJECT_TYPE_GLIDER&&(this.position=v,this.board.update()),this},makeGlider:function(v){var N=this.board.select(v),G=!1,z,q,Y;if(N.type===Const.OBJECT_TYPE_POLYGON){for(z=Number.MAX_VALUE,q=0;q<N.borders.length;q++)Y=JXG$1.Math.Geometry.distPointLine(this.coords.usrCoords,N.borders[q].stdform),Y<z&&(z=Y,v=N.borders[q]);N=this.board.select(v),G=!0}if(JXG$1.exists(N)){if(N.type===Const.OBJECT_TYPE_TICKS)throw new Error("JSXGraph: gliders on ticks are not possible.")}else throw new Error("JSXGraph: slide object undefined.");return this.slideObject=this.board.select(v),this.slideObjects.push(this.slideObject),this.addParents(v),this.type=Const.OBJECT_TYPE_GLIDER,this.elType="glider",this.visProp.snapwidth=-1,this.slideObject.addChild(this),this.isDraggable=!0,this.onPolygon=G,this.generatePolynomial=function(){return this.slideObject.generatePolynomial(this)},this.updateGlider(),this.needsUpdateFromParent=!0,this.updateGliderFromParent(),this},popSlideObject:function(){this.slideObjects.length>0&&(this.slideObjects.pop(),this.slideObject.removeChild(this),this.slideObjects.length===0?(this.type=this._org_type,this.type===Const.OBJECT_TYPE_POINT?this.elType="point":this.elementClass===Const.OBJECT_CLASS_TEXT?this.elType="text":this.type===Const.OBJECT_TYPE_IMAGE?this.elType="image":this.type===Const.OBJECT_TYPE_FOREIGNOBJECT&&(this.elType="foreignobject"),this.slideObject=null):this.slideObject=this.slideObjects[this.slideObjects.length-1])},free:function(){var v,N;if(this.type!==Const.OBJECT_TYPE_GLIDER)if(this.transformations.length=0,delete this.updateConstraint,this.isConstrained=!1,!this.isDraggable)this.isDraggable=!0,this.elementClass===Const.OBJECT_CLASS_POINT&&(this.type=Const.OBJECT_TYPE_POINT,this.elType="point"),this.XEval=function(){return this.coords.usrCoords[1]},this.YEval=function(){return this.coords.usrCoords[2]},this.ZEval=function(){return this.coords.usrCoords[0]},this.Xjc=null,this.Yjc=null;else return;for(v in this.board.objects)this.board.objects.hasOwnProperty(v)&&(N=this.board.objects[v],N.descendants&&(delete N.descendants[this.id],delete N.childElements[this.id],this.hasLabel&&(delete N.descendants[this.label.id],delete N.childElements[this.label.id])));this.ancestors={},this.parents=[],this.slideObject=null,this.slideObjects=[],this.elementClass===Const.OBJECT_CLASS_POINT?(this.type=Const.OBJECT_TYPE_POINT,this.elType="point"):this.elementClass===Const.OBJECT_CLASS_TEXT?(this.type=this._org_type,this.elType="text"):this.elementClass===Const.OBJECT_CLASS_OTHER&&(this.type=this._org_type,this.elType="image")},addConstraint:function(v){var N,G,z=[],q=["X","Y"],Y=function(ie){return function(){return ie}},W=function(ie){return function(){return ie.Value()}};
93for(this.elementClass===Const.OBJECT_CLASS_POINT&&(this.type=Const.OBJECT_TYPE_CAS),this.isDraggable=!1,N=0;N<v.length;N++)G=v[N],JXG$1.isString(G)?(z[N]=this.board.jc.snippet(G,!0,null,!0),this.addParentsFromJCFunctions([z[N]]),v.length===2&&(this[q[N]+"jc"]=v[N])):JXG$1.isFunction(G)?z[N]=G:JXG$1.isNumber(G)?z[N]=Y(G):JXG$1.isObject(G)&&JXG$1.isFunction(G.Value)&&(z[N]=W(G)),z[N].origin=G;return v.length===1?this.updateConstraint=function(){var ie=z[0]();return JXG$1.isArray(ie)?this.coords.setCoordinates(Const.COORDS_BY_USER,ie):this.coords=ie,this}:v.length===2?(this.XEval=z[0],this.YEval=z[1],this.addParents([z[0].origin,z[1].origin]),this.updateConstraint=function(){return this.coords.setCoordinates(Const.COORDS_BY_USER,[this.XEval(),this.YEval()]),this}):(this.ZEval=z[0],this.XEval=z[1],this.YEval=z[2],this.addParents([z[0].origin,z[1].origin,z[2].origin]),this.updateConstraint=function(){return this.coords.setCoordinates(Const.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()]),this}),this.isConstrained=!0,this.prepareUpdate().update(),this.board.isSuspendedUpdate||(this.updateVisibility().updateRenderer(),this.hasLabel&&this.label.fullUpdate()),this},addAnchor:function(v,N){N?this.relativeCoords=new Coords(Const.COORDS_BY_SCREEN,v.slice(0,2),this.board):this.relativeCoords=new Coords(Const.COORDS_BY_USER,v,this.board),this.element.addChild(this),N&&this.addParents(this.element),this.XEval=function(){var G,z,q,Y;return this.evalVisProp("islabel")?(Y=this.evalVisProp("offset"),G=parseFloat(Y[0]),q=this.element.getLabelAnchor(),z=new Coords(Const.COORDS_BY_SCREEN,[G+this.relativeCoords.scrCoords[1]+q.scrCoords[1],0],this.board),z.usrCoords[1]):(q=this.element.getTextAnchor(),this.relativeCoords.usrCoords[1]+q.usrCoords[1])},this.YEval=function(){var G,z,q,Y;return this.evalVisProp("islabel")?(Y=this.evalVisProp("offset"),G=-parseFloat(Y[1]),q=this.element.getLabelAnchor(),z=new Coords(Const.COORDS_BY_SCREEN,[0,G+this.relativeCoords.scrCoords[2]+q.scrCoords[2]],this.board),z.usrCoords[2]):(q=this.element.getTextAnchor(),this.relativeCoords.usrCoords[2]+q.usrCoords[2])},this.ZEval=JXG$1.createFunction(1,this.board,""),this.updateConstraint=function(){this.coords.setCoordinates(Const.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()])},this.isConstrained=!0,this.updateConstraint()},updateTransform:function(v){var N,G;if(this.transformations.length===0||this.baseElement===null)return this;for(this.transformations[0].update(),this===this.baseElement?N=this.transformations[0].apply(this,"self"):N=this.transformations[0].apply(this.baseElement),G=1;G<this.transformations.length;G++)this.transformations[G].update(),N=Mat.matVecMult(this.transformations[G].matrix,N);return this.actualCoords.setCoordinates(Const.COORDS_BY_USER,N),this},addTransform:function(v,N){var G,z=JXG$1.isArray(N)?N:[N],q=z.length;for(this.transformations.length===0&&(this.baseElement=v),G=0;G<q;G++)this.transformations.push(z[G]);return this},startAnimation:function(v,N,G){var z=JXG$1.evaluate(v),q=JXG$1.evaluate(N),Y=this;return G=JXG$1.evaluate(G)||250,this.type===Const.OBJECT_TYPE_GLIDER&&!JXG$1.exists(this.intervalCode)&&(this.intervalCode=window.setInterval(function(){Y._anim(z,q)},G),JXG$1.exists(this.intervalCount)||(this.intervalCount=0)),this},stopAnimation:function(){return JXG$1.exists(this.intervalCode)&&(window.clearInterval(this.intervalCode),delete this.intervalCode),this},moveAlong:function(v,N,G){G=G||{};var z,q,Y=[],W=[],ie=this.board.attr.animationdelay,ne=N/ie,se,ae,ce,pe=function(ge,ve){return function(){return v[ge][ve]}};if(JXG$1.isArray(v)){for(se=v.length,z=0;z<se;z++)JXG$1.isPoint(v[z])?W[z]=v[z]:W[z]={elementClass:Const.OBJECT_CLASS_POINT,X:pe(z,0),Y:pe(z,1)};if(N=N||0,N===0)return this.setPosition(Const.COORDS_BY_USER,[W[W.length-1].X(),W[W.length-1].Y()]),this.board.update(this);if(!JXG$1.exists(G.interpolate)||G.interpolate)for(q=Numerics.Neville(W),z=0;z<ne;z++)Y[z]=[],Y[z][0]=q[0]((ne-z)/ne*q[3]()),Y[z][1]=q[1]((ne-z)/ne*q[3]());else{for(se=v.length-1,z=0;z<ne;++z)ae=Math.floor(z/ne*se),ce=z/ne*se-ae,Y[z]=[],Y[z][0]=(1-ce)*W[ae].X()+ce*W[ae+1].X(),Y[z][1]=(1-ce)*W[ae].Y()+ce*W[ae+1].Y();Y.push([W[se].X(),W[se].Y()]),Y.reverse()}this.animationPath=Y}else JXG$1.isFunction(v)&&(this.animationPath=v,this.animationStart=new Date().getTime());return this.animationCallback=G.callback,this.board.addAnimation(this),this},moveTo:function(v,N,G){G=G||{},v=new Coords(Const.COORDS_BY_USER,v,this.board);var z,q=this.board.attr.animationdelay,Y=Math.ceil(N/q),W=[],ie=this.coords.usrCoords[1],ne=this.coords.usrCoords[2],se=v.usrCoords[1]-ie,ae=v.usrCoords[2]-ne,ce=function(pe){var ge=pe/Y;if(G.effect){if(G.effect==="<>")return Math.pow(Math.sin(ge*Math.PI/2),2);if(G.effect==="<")return ge*ge*ge;if(G.effect===">")return 1-Math.pow(1-ge,3);if(G.effect==="==")return pe/Y;throw new Error("valid effects are '==', '<>', '>', and '<'.")}return pe/Y};if(!JXG$1.exists(N)||N===0||Math.abs(v.usrCoords[0]-this.coords.usrCoords[0])>Mat.eps)return this.setPosition(Const.COORDS_BY_USER,v.usrCoords),this.board.update(this);if(!JXG$1.exists(G.callback)&&Math.abs(se)<Mat.eps&&Math.abs(ae)<Mat.eps)return this;for(z=Y;z>=0;z--)W[Y-z]=[v.usrCoords[0],ie+se*ce(z),ne+ae*ce(z)];return this.animationPath=W,this.animationCallback=G.callback,this.board.addAnimation(this),this},visit:function(v,N,G){v=new Coords(Const.COORDS_BY_USER,v,this.board);var z,q,Y,W=this.board.attr.animationdelay,ie=[],ne=this.coords.usrCoords[1],se=this.coords.usrCoords[2],ae=v.usrCoords[1]-ne,ce=v.usrCoords[2]-se,pe=function(ge){var ve=ge<Y/2?2*ge/Y:2*(Y-ge)/Y;if(G.effect){if(G.effect==="<>")return Math.pow(Math.sin(ve*Math.PI/2),2);if(G.effect==="<")return ve*ve*ve;if(G.effect===">")return 1-Math.pow(1-ve,3);if(G.effect==="==")return ve;throw new Error("valid effects are '==', '<>', '>', and '<'.")}return ve};for(JXG$1.isNumber(G)?G={repeat:G}:(G=G||{},JXG$1.exists(G.repeat)||(G.repeat=1)),Y=Math.ceil(N/(W*G.repeat)),q=0;q<G.repeat;q++)for(z=Y;z>=0;
93z--)ie[q*(Y+1)+Y-z]=[v.usrCoords[0],ne+ae*pe(z),se+ce*pe(z)];return this.animationPath=ie,this.animationCallback=G.callback,this.board.addAnimation(this),this},moveAlongES6:function(v,N,G){return new Promise((z,q)=>{JXG$1.exists(G)&&JXG$1.exists(G.callback)?G.callback=z:G={callback:z},this.moveAlong(v,N,G)})},moveToES6:function(v,N,G){return new Promise((z,q)=>{JXG$1.exists(G)&&JXG$1.exists(G.callback)?G.callback=z:G={callback:z},this.moveTo(v,N,G)})},visitES6:function(v,N,G){return new Promise((z,q)=>{JXG$1.exists(G)&&JXG$1.exists(G.callback)?G.callback=z:G={callback:z},this.visit(v,N,G)})},_anim:function(v,N){var G,z,q,Y,W,ie,ne,se,ae;return this.intervalCount+=1,this.intervalCount>N&&(this.intervalCount=0),this.slideObject.elementClass===Const.OBJECT_CLASS_LINE?(ne=this.slideObject.point1.coords.scrCoords,se=this.slideObject.point2.coords.scrCoords,G=Math.round((se[1]-ne[1])*this.intervalCount/N),z=Math.round((se[2]-ne[2])*this.intervalCount/N),v>0?Y=this.slideObject.point1:(Y=this.slideObject.point2,G*=-1,z*=-1),this.coords.setCoordinates(Const.COORDS_BY_SCREEN,[Y.coords.scrCoords[1]+G,Y.coords.scrCoords[2]+z])):this.slideObject.elementClass===Const.OBJECT_CLASS_CURVE?(v>0?W=(this.slideObject.maxX()-this.slideObject.minX())*this.intervalCount/N+this.slideObject.minX():W=-(this.slideObject.maxX()-this.slideObject.minX())*this.intervalCount/N+this.slideObject.maxX(),this.coords.setCoordinates(Const.COORDS_BY_USER,[this.slideObject.X(W),this.slideObject.Y(W)]),ae=Geometry.projectPointToCurve(this,this.slideObject,this.board),this.coords=ae[0],this.position=ae[1]):this.slideObject.elementClass===Const.OBJECT_CLASS_CIRCLE&&(q=2*Math.PI,v<0?q*=this.intervalCount/N:q*=(N-this.intervalCount)/N,ie=this.slideObject.Radius(),this.coords.setCoordinates(Const.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+ie*Math.cos(q),this.slideObject.center.coords.usrCoords[2]+ie*Math.sin(q)])),this.board.update(this),this},getTextAnchor:function(){return this.coords},getLabelAnchor:function(){return this.coords},getParents:function(){var v=[this.Z(),this.X(),this.Y()];return this.parents.length!==0&&(v=this.parents),this.type===Const.OBJECT_TYPE_GLIDER&&(v=[this.X(),this.Y(),this.slideObject.id]),v}});JXG$1.CoordsElement.create=function(v,N,G,z,q,Y){var W,ie=!1,ne;for(ne=0;ne<G.length;ne++)(JXG$1.isFunction(G[ne])||JXG$1.isString(G[ne]))&&(ie=!0);if(ie)W=new v(N,[0,0],z,q,Y),W.addConstraint(G);else if(JXG$1.isNumber(G[0])&&JXG$1.isNumber(G[1]))W=new v(N,G,z,q,Y),JXG$1.exists(z.slideobject)?W.makeGlider(z.slideobject):W.baseElement=W,W.isDraggable=!0;else if(JXG$1.isObject(G[0])&&JXG$1.isTransformationOrArray(G[1]))W=new v(N,[0,0],z,q,Y),W.addTransform(G[0],G[1]),W.isDraggable=!1;else return!1;return W.handleSnapToGrid(),W.handleSnapToPoints(),W.handleAttractors(),W.addParents(G),W};const CoordsElement=JXG$1.CoordsElement;var priv$5={HTMLSliderInputEventHandler:function(){this._val=parseFloat(this.rendNodeRange.value),this.rendNodeOut.value=this.rendNodeRange.value,this.board.update()}};JXG$1.Text=function(v,N,G,z){var q;this.constructor(v,G,Const.OBJECT_TYPE_TEXT,Const.OBJECT_CLASS_TEXT),this.element=this.board.select(G.anchor),this.coordsConstructor(N,this.evalVisProp("islabel")),this.content="",this.plaintext="",this.plaintextOld=null,this.orgText="",this.needsSizeUpdate=!1,this.hiddenByParent=!1,this.size=[1,1],this.id=this.board.setId(this,"T"),this.board.renderer.drawText(this),this.board.finalizeAdding(this),q=this.visProp.visible,this.visProp.visible=!0,this.setText(z),this.visProp.visible=q,JXG$1.isString(this.content)&&this.notifyParents(this.content),this.elType="text",this.methodMap=JXG$1.deepCopy(this.methodMap,{setText:"setTextJessieCode",move:"setCoords",Size:"getSize",setAutoPosition:"setAutoPosition"})};JXG$1.Text.prototype=new GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Text,CoordsElement,"coordsConstructor");JXG$1.extend(JXG$1.Text.prototype,{hasPoint:function(v,N){var G,z,q,Y,W,ie,ne,se;return JXG$1.isObject(this.evalVisProp("precision"))?(ne=this.board._inputDevice,se=this.evalVisProp("precision."+ne)):se=this.board.options.precision.hasPoint,this.transformations.length>0&&(G=Mat.matVecMult(Mat.inverse(this.board.renderer.joinTransforms(this,this.transformations)),[1,v,N]),v=G[1],N=G[2]),W=this.getAnchorX(),W==="right"?G=this.coords.scrCoords[1]-this.size[0]:W==="middle"?G=this.coords.scrCoords[1]-.5*this.size[0]:G=this.coords.scrCoords[1],z=G+this.size[0],ie=this.getAnchorY(),ie==="top"?Y=this.coords.scrCoords[2]+this.size[1]:ie==="middle"?Y=this.coords.scrCoords[2]+.5*this.size[1]:Y=this.coords.scrCoords[2],q=Y-this.size[1],this.evalVisProp("dragarea")==="all"?v>=G-se&&v<z+se&&N>=q-se&&N<=Y+se:N>=q-se&&N<=Y+se&&(v>=G-se&&v<=G+2*se||v>=z-2*se&&v<=z+se)},_createFctUpdateText:function(v){var N,G,z,q,Y,W,ie=this.evalVisProp("parse"),ne=this.evalVisProp("usemathjax"),se=this.evalVisProp("usekatex"),ae=!1;if(this.orgText=v,JXG$1.isFunction(v))this.updateText=function(){q=v().toString(),ie&&!ne&&!se?this.plaintext=this.replaceSub(this.replaceSup(this.convertGeonextAndSketchometry2CSS(q,!1))):this.plaintext=q};else if(JXG$1.isNumber(v)&&this.evalVisProp("formatnumber")?this.evalVisProp("tofraction")?ne?this.content="\\("+JXG$1.toFraction(v,!0)+"\\)":this.content=JXG$1.toFraction(v,se):(z=this.evalVisProp("digits"),this.useLocale()?this.content=this.formatNumberLocale(v,z):this.content=JXG$1.toFixed(v,z)):JXG$1.isString(v)&&ie?(this.evalVisProp("useasciimathml")?this.content="'`"+v+"`'":ne||se?(this.content=this.valueTagToJessieCode(v),JXG$1.isArray(this.content)||(this.content=this.content.replace(/\\/g,"\\\\"))):this.content=this.poorMansTeX(this.valueTagToJessieCode(v)),ae=!0):this.content=v,ae){if(JXG$1.isArray(this.content)){for(W=this,Y=0;Y<this.content.length;Y++)if(this.content[Y][0]!=='"'){this.content[Y]=this.board.jc.snippet(this.content[Y],!0,"",!1);for(G in this.content[Y].deps)this.addParents(this.content[Y].deps[G]),this.content[Y].deps[G].addChild(this)}N=function(){var ce,pe,ge=W.evalVisProp("digits"),ve="";for(ce=0;ce<W.content.length;ce++)JXG$1.isFunction(W.content[ce])?(pe=W.content[ce](),W.useLocale()?pe=W.formatNumberLocale(pe,ge):pe=JXG$1.toFixed(pe,ge)):(pe=W.content[ce],pe[0]==='"'&&pe[pe.length-1]==='"'&&(pe=pe.slice(1,-1))),ve+=pe;return ve}}else{N=this.board.jc.snippet(this.content,!0,"",!1);for(G in N.deps)this.addParents(N.deps[G]),N.deps[G].addChild(this)}this.updateText=function(){this.plaintext=this.unescapeTicks(N())}}else this.updateText=function(){this.plaintext=this.content}},_setText:function(v){return this._createFctUpdateText(v),this.updateText(),this.fullUpdate(),(!this.board.infobox||this.id!==this.board.infobox.id)&&this.updateSize(),this},setTextJessieCode:function(v){var N;return this.visProp.castext=v,JXG$1.isFunction(v)?N=function(){return JXG$1.sanitizeHTML(v())}:JXG$1.isNumber(v)?N=v:N=JXG$1.sanitizeHTML(v),this._setText(N)},setText:function(v){return this._setText(v)},updateSize:function(){var v,N,G,z=this.evalVisProp("display");return!JXG$1.isBrowser||this.board.renderer.type==="no"?this:(G=this.rendNode,z==="html"||this.board.renderer.type==="vml"?JXG$1.exists(G.offsetWidth)?(N=this,window.setTimeout(function(){N.size=[G.offsetWidth,G.offsetHeight],N.needsUpdate=!0,N.updateRenderer()},0)):this.size=this.crudeSizeEstimate():z==="internal"&&(this.board.renderer.type==="svg"?(N=this,window.setTimeout(function(){try{v=G.getBBox(),N.size=[v.width,v.height],N.needsUpdate=!0,N.updateRenderer()}catch{}},0)):this.board.renderer.type==="canvas"&&(this.size=this.crudeSizeEstimate())),this)},crudeSizeEstimate:function(){var v=parseFloat(this.evalVisProp("fontsize"));return[v*this.plaintext.length*.45,v*.9]},utf8_decode:function(v){return v.replace(/&#x(\w+);/g,function(N,G){return String.fromCharCode(parseInt(G,16))})},replaceSub:function(v){if(!v.indexOf)return v;for(var N,G=v.indexOf("_{");G>=0;)v=v.slice(0,G)+v.slice(G).replace(/_\{/,"<sub>"),N=v.indexOf("}",G+4),N>=0&&(v=v.slice(0,N)+v.slice(N).replace(/\}/,"</sub>")),G=v.indexOf("_{");for(G=v.indexOf("_");G>=0;)v=v.slice(0,G)+v.slice(G).replace(/_(.?)/,"<sub>$1</sub>"),G=v.indexOf("_");return v},replaceSup:function(v){if(!v.indexOf)return v;for(var N,G=v.indexOf("^{");G>=0;)v=v.slice(0,G)+v.slice(G).replace(/\^\{/,"<sup>"),N=v.indexOf("}",G+4),N>=0&&(v=v.slice(0,N)+v.slice(N).replace(/\}/,"</sup>")),G=v.indexOf("^{");for(G=v.indexOf("^");G>=0;)v=v.slice(0,G)+v.slice(G).replace(/\^(.?)/,"<sup>$1</sup>"),G=v.indexOf("^");return v},getSize:function(){return this.size},setCoords:function(v,N){var G,z,q;return JXG$1.isArray(v)&&v.length>1&&(N=v[1],v=v[0]),this.evalVisProp("islabel")&&JXG$1.exists(this.element)?(G=this.element.getLabelAnchor(),z=(v-G.usrCoords[1])*this.board.unitX,q=-(N-G.usrCoords[2])*this.board.unitY,this.relativeCoords.setCoordinates(Const.COORDS_BY_SCREEN,[z,q])):this.coords.setCoordinates(Const.COORDS_BY_USER,[v,N]),this.fullUpdate(),this},update:function(v){return this.needsUpdate?(this.updateCoords(v),this.updateText(),this.evalVisProp("display")==="internal"&&JXG$1.isString(this.plaintext)&&(this.plaintext=this.utf8_decode(this.plaintext)),this.checkForSizeUpdate(),this.needsSizeUpdate&&this.updateSize(),this):this},checkForSizeUpdate:function(){this.board.infobox&&this.id===this.board.infobox.id?this.needsSizeUpdate=!1:(this.needsSizeUpdate=this.plaintextOld!==this.plaintext,this.needsSizeUpdate&&(this.plaintextOld=this.plaintext))},updateRenderer:function(){return this.evalVisProp("autoposition")&&this.setAutoPosition().updateConstraint(),this.updateRendererGeneric("updateText")},expandShortMath:function(v){var N=/([)0-9.])\s*([(a-zA-Z_])/g;return v.replace(N,"$1*$2")},generateTerm:function(v,N,G){var z,q,Y,W,ie='""';if(v=v||"",v=v.replace(/\r/g,""),v=v.replace(/\n/g,""),v=v.replace(/"/g,"'"),v=v.replace(/'/g,"\\'"),v=v.replace(/&amp;arc;/g,"&ang;"),v=v.replace(/<arc\s*\/>/g,"&ang;"),v=v.replace(/&lt;arc\s*\/&gt;/g,"&ang;"),v=v.replace(/&lt;sqrt\s*\/&gt;/g,"&radic;"),v=v.replace(/&lt;value&gt;/g,"<value>"),v=v.replace(/&lt;\/value&gt;/g,"</value>"),Y=v.indexOf("<value>"),W=v.indexOf("</value>"),Y>=0)for(;Y>=0;)ie+=' + "'+this.replaceSub(this.replaceSup(v.slice(0,Y)))+'"',q=v.slice(Y+7,W),q=q.replace(/\s+/g,""),N===!0&&(q=this.expandShortMath(q)),G?z=q:z=GeonextParser.geonext2JS(q,this.board),z=z.replace(/\\"/g,"'"),z=z.replace(/\\'/g,"'"),z.indexOf("toFixed")<0&&JXG$1.isNumber(JXG$1.bind(this.board.jc.snippet(z,!0,"",!1),this)())?ie+="+("+z+").toFixed("+this.evalVisProp("digits")+")":ie+="+("+z+")",v=v.slice(W+8),Y=v.indexOf("<value>"),W=v.indexOf("</value>");return ie+=' + "'+this.replaceSub(this.replaceSup(v))+'"',ie=this.convertGeonextAndSketchometry2CSS(ie),ie=ie.replace(/&amp;/g,"&"),ie=ie.replace(/"/g,"'"),ie},valueTagToJessieCode:function(v){var N,G,z,q,Y=[],W='"';if(v=v||"",v=v.replace(/\r/g,""),v=v.replace(/\n/g,""),v=v.replace(/&lt;value&gt;/g,"<value>"),v=v.replace(/&lt;\/value&gt;/g,"</value>"),z=v.indexOf("<value>"),q=v.indexOf("</value>"),z>=0)for(;z>=0;)Y.push(W+this.escapeTicks(v.slice(0,z))+W),G=v.slice(z+7,q),G=G.replace(/\s+/g,""),G=this.expandShortMath(G),N=G,N=N.replace(/\\"/g,"'").replace(/\\'/g,"'"),Y.push("("+N+")"),v=v.slice(q+8),z=v.indexOf("<value>"),q=v.indexOf("</value>");for(Y.push(W+this.escapeTicks(v)+W),z=0;z<Y.length;z++)Y[z]=Y[z].replace(/&amp;/g,"&");return Y},poorMansTeX:function(v){var N,G;if(JXG$1.isArray(v)){for(G=[],N=0;N<v.length;N++)G.push(this.poorMansTeX(v[N]));return G}return v=v.replace(/<arc\s*\/*>/g,"&ang;").replace(/&lt;arc\s*\/*&gt;/g,"&ang;").replace(/<sqrt\s*\/*>/g,"&radic;").replace(/&lt;sqrt\s*\/*&gt;/g,"&radic;"),this.convertGeonextAndSketchometry2CSS(this.replaceSub(this.replaceSup(v)),!0)},escapeTicks:function(v){return v.replace(/"/g,"%22").replace(/'/g,"%27")},unescapeTicks:function(v){return v.replace(/%22/g,'"').replace(/%27/g,"'")},convertGeonext2CSS:function(v){return JXG$1.isString(v)&&(v=v.replace(/(<|&lt;)overline(>|&gt;)/g,"<span style=text-decoration:overline;>"),v=v.replace(/(<|&lt;)\/overline(>|&gt;)/g,"</span>"),v=v.replace(/(<|&lt;)arrow(>|&gt;)/g,"<span style=text-decoration:overline;>"),v=v.replace(/(<|&lt;)\/arrow(>|&gt;)/g,"</span>")),v},convertSketchometry2CSS:function(v,N){var G='<span class="sketcho sketcho-inherit sketcho-',z='"></span>';return JXG$1.isString(v)&&(N&&(G=this.escapeTicks(G),z=this.escapeTicks(z)),v=v.replace(/(<|&lt;)sketchofont(>|&gt;)/g,G),v=v.replace(/(<|&lt;)\/sketchofont(>|&gt;)/g,z)),v},convertGeonextAndSketchometry2CSS:function(v,N){return v=this.convertGeonext2CSS(v),v=this.convertSketchometry2CSS(v,N),v},notifyParents:function(v){var N,G=null;v=v.replace(/&lt;value&gt;/g,"<value>"),v=v.replace(/&lt;\/value&gt;/g,"</value>");do N=/<value>([\w\s*/^\-+()[\],<>=!]+)<\/value>/,G=N.exec(v),G!==null&&(GeonextParser.findDependencies(this,G[1],this.board),v=v.slice(G.index),v=v.replace(N,""));while(G!==null);return this},getParents:function(){var v;return this.relativeCoords!==void 0?v=[this.relativeCoords.usrCoords[1],this.relativeCoords.usrCoords[2],this.orgText]:v=[this.Z(),this.X(),this.Y(),this.orgText],this.parents.length!==0&&(v=this.parents),v},bounds:function(){var v=this.coords.usrCoords;return this.evalVisProp("islabel")||this.board.unitY===0||this.board.unitX===0?[0,0,0,0]:[v[1],v[2]+this.size[1]/this.board.unitY,v[1]+this.size[0]/this.board.unitX,v[2]]},getAnchorX:function(){var v=this.evalVisProp("anchorx");if(v==="auto")switch(this.visProp.position){case"top":case"bot":return"middle";case"rt":case"lrt":case"urt":return"left";case"lft":case"llft":case"ulft":default:return"right"}return v},getAnchorY:function(){var v=this.evalVisProp("anchory");if(v==="auto")switch(this.visProp.position){case"top":case"ulft":case"urt":return"bottom";case"bot":case"lrt":case"llft":return"top";case"rt":case"lft":default:return"middle"}return v},getNumberOfConflicts:function(v,N,G,z,q){q=q||[];var Y=0,W,ie,ne,se,ae;for(se=this.board.options.precision.hasPoint,this.board.options.precision.hasPoint=(G+z)*.25,W=0,ne=this.board.objectsList.length;W<ne;W++)ie=this.board.objectsList[W],ae=ie.visProp.hasinnerpoints,ie.visProp.hasinnerpoints=!1,ie.visPropCalc.visible&&ie.elType!=="axis"&&ie.elType!=="ticks"&&ie!==this.board.infobox&&ie!==this&&ie.hasPoint(v,N)&&q.indexOf(ie.id)===-1&&Y++,ie.visProp.hasinnerpoints=ae;return this.board.options.precision.hasPoint=se,Y},setAutoPosition:function(){var v,N,G,z,q,Y=this.size[0],W=this.size[1],ie,ne,se={conflicts:1/0,angle:0,r:0},ae,ce,pe,ge,ve,be=12,Ee=2*Math.PI/be,Pe,Je,Ce,Ve,Re;if(this===this.board.infobox||!this.visPropCalc.visible||!this.evalVisProp("islabel")||!this.element)return this;if(ge=this.evalVisProp("offset"),q=this.element.getLabelAnchor(),G=q.scrCoords[1],z=q.scrCoords[2],Je=ge[0],Ce=ge[1],pe=this.getNumberOfConflicts(G+Je,z-Ce,Y,W,this.evalVisProp("autopositionwhitelist")),pe===0)return this;for(ve=this.evalVisProp("autopositionmindistance"),ae=this.evalVisProp("autopositionmaxdistance"),ce=.2*ve,ie=Math.atan2(Ce,Je),se.conflicts=pe,se.angle=ie,se.r=ve;se.conflicts>0&&ve<=ae;){for(Pe=1,ne=ie+Ee;Pe<be&&se.conflicts>0&&(Ve=Math.cos(ne),Re=Math.sin(ne),v=G+ve*Ve,N=z-ve*Re,pe=this.getNumberOfConflicts(v,
93N,Y,W,this.evalVisProp("autopositionwhitelist")),pe<se.conflicts&&(se.conflicts=pe,se.angle=ne,se.r=ve),se.conflicts!==0);Pe++)ne+=Ee;ve+=ce}return ve=se.r,Ve=Math.cos(se.angle),Re=Math.sin(se.angle),this.visProp.offset=[ve*Ve,ve*Re],Ve<-.2?this.visProp.anchorx="right":Ve>.2?this.visProp.anchorx="left":this.visProp.anchorx="middle",this}});JXG$1.createText=function(v,N,G){var z,q=JXG$1.copyAttributes(G,v.options,"text"),Y=N.slice(0,-1),W=N[N.length-1];if(q.anchor=q.parent||q.anchor,z=CoordsElement.create(JXG$1.Text,v,Y,q,W),!z)throw new Error("JSXGraph: Can't create text with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
94Possible parent types: [x,y], [z,x,y], [element,transformation]`);return q.rotate!==0&&z.addRotation(q.rotate),z};JXG$1.registerElement("text",JXG$1.createText);JXG$1.createHTMLSlider=function(v,N,G){var z,q,Y=JXG$1.copyAttributes(G,v.options,"htmlslider");if(N.length!==2||N[0].length!==2||N[1].length!==3)throw new Error("JSXGraph: Can't create htmlslider with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
95Possible parents are: [[x,y], [min, start, max]]`);Y.anchor=Y.parent||Y.anchor,Y.fixed=Y.fixed||!0,q=[N[0][0],N[0][1],'<form style="display:inline"><input type="range" /><span></span><input type="text" /></form>'],z=JXG$1.createText(v,q,Y),z.type=JXG$1.OBJECT_TYPE_HTMLSLIDER,z.rendNodeForm=z.rendNode.childNodes[0],z.rendNodeRange=z.rendNodeForm.childNodes[0],z.rendNodeRange.min=N[1][0],z.rendNodeRange.max=N[1][2],z.rendNodeRange.step=Y.step,z.rendNodeRange.value=N[1][1],z.rendNodeLabel=z.rendNodeForm.childNodes[1],z.rendNodeLabel.id=z.rendNode.id+"_label",Y.withlabel&&(z.rendNodeLabel.innerHTML=z.name+"="),z.rendNodeOut=z.rendNodeForm.childNodes[2],z.rendNodeOut.value=N[1][1];try{z.rendNodeForm.id=z.rendNode.id+"_form",z.rendNodeRange.id=z.rendNode.id+"_range",z.rendNodeOut.id=z.rendNode.id+"_out"}catch(W){JXG$1.debug(W)}return z.rendNodeRange.style.width=Y.widthrange+"px",z.rendNodeRange.style.verticalAlign="middle",z.rendNodeOut.style.width=Y.widthout+"px",z._val=N[1][1],JXG$1.supportsVML()?JXG$1.addEvent(z.rendNodeForm,"change",priv$5.HTMLSliderInputEventHandler,z):JXG$1.addEvent(z.rendNodeForm,"input",priv$5.HTMLSliderInputEventHandler,z),z.Value=function(){return this._val},z};JXG$1.registerElement("htmlslider",JXG$1.createHTMLSlider);const Text=JXG$1.Text;Object.create||(Object.create=function(v,N){if(typeof v!="object"&&typeof v!="function")throw new TypeError("Object prototype may only be an Object: "+v);if(v===null)throw new Error("This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.");if(typeof N<"u")throw new Error("This browser's implementation of Object.create is a shim and doesn't support a second argument.");function G(){}return G.prototype=v,new G});var priv$4={modules:{math:Mat,"math/geometry":Geometry,"math/statistics":Stat,"math/numerics":Mat.Numerics}};JXG$1.JessieCode=function(v,N){this.scope={id:0,hasChild:!0,args:[],locals:{},context:null,previous:null},this.scopes=[],this.scopes.push(this.scope),this.dpstack=[[]],this.pscope=0,this.propstack=[{}],this.propscope=0,this.lhs=[],this.isLHS=!1,this.warnLog="jcwarn",this.$log=[],this.builtIn=this.defineBuiltIn(),this.operands=this.getPossibleOperands(),this.board=null,this.forceValueCall=!1,this.lineToElement={},this.parCurLine=1,this.parCurColumn=0,this.line=1,this.col=1,JXG$1.CA&&(this.CA=new JXG$1.CA(this.node,this.createNode,this)),this.code="",typeof v=="string"&&this.parse(v,N)};JXG$1.extend(JXG$1.JessieCode.prototype,{node:function(v,N,G){return{type:v,value:N,children:G}},createNode:function(v,N,G){var z=this.node(v,N,[]),q;for(q=2;q<arguments.length;q++)z.children.push(arguments[q]);return z.type==="node_const"&&JXG$1.isNumber(z.value)&&(z.isMath=!0),z.line=this.parCurLine,z.col=this.parCurColumn,z},pushScope:function(v){var N={args:v,locals:{},context:null,previous:this.scope};return this.scope.hasChild=!0,this.scope=N,N.id=this.scopes.push(N)-1,N},popScope:function(){var v=this.scope.previous;return this.scope=v!==null?v:this.scope,this.scope},getElementById:function(v){return this.board.objects[v]},log:function(){this.$log.push(arguments),typeof console=="object"&&console.log&&console.log.apply(console,arguments)},creator:function(){var v={},N;return N=function(G){var z;return typeof v[this.board.id+G]=="function"?z=v[this.board.id+G]:(z=function(q){return function(Y,W){var ie;return JXG$1.exists(W)?ie=W:ie={},ie.name===void 0&&ie.id===void 0&&(ie.name=q.lhs[q.scope.id]!==0?q.lhs[q.scope.id]:""),q.board.create(G,Y,ie)}}(this),z.creator=!0,v[this.board.id+G]=z),z},N.clearCache=function(){v={}},N}(),letvar:function(v,N){this.builtIn[v]&&this._warn('"'+v+'" is a predefined value.'),this.scope.locals[v]=N},isLocalVariable:function(v){for(var N=this.scope;N!==null;){if(JXG$1.exists(N.locals[v]))return N;N=N.previous}return null},isParameter:function(v){for(var N=this.scope;N!==null;){if(JXG$1.indexOf(N.args,v)>-1)return N;N=N.previous}return null},isCreator:function(v){return!!JXG$1.elements[v]},isMathMethod:function(v){return v!=="E"&&!!Math[v]},isBuiltIn:function(v){return!!this.builtIn[v]},getvar:function(v,N,G){var z;if(N=JXG$1.def(N,!1),z=this.isLocalVariable(v),z!==null)return z.locals[v];if(v==="$board"||v==="EULER"||v==="PI")return this.builtIn[v];if(G){if(this.isBuiltIn(v))return this.builtIn[v];if(this.isMathMethod(v))return Math[v];if(this.isCreator(v))return this.creator(v)}if(!N&&(z=this.board.select(v),z!==v))return z},resolve:function(v){for(var N=this.scope;N!==null;){if(JXG$1.exists(N.locals[v]))return N.locals[v];N=N.previous}},getvarJS:function(v,N,G){var z,q="",Y;return N=JXG$1.def(N,!1),G=JXG$1.def(G,!1),z=this.isParameter(v),z!==null?v:(z=this.isLocalVariable(v),z!==null&&!G?"$jc$.resolve('"+v+"')":this.isCreator(v)?"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(G?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+v+"'].concat([a, props])); })":(G&&this._error("Syntax error (attribute values are allowed with element creators only)"),this.isBuiltIn(v)?(q=this.builtIn[v].src||this.builtIn[v],JXG$1.isNumber(q)||q.match(/board\.select/)?q:(v=q.split(".").pop(),JXG$1.exists(this.board.mathLib)&&(Y=new RegExp("^Math."+v),Y.exec(q)!==null)?q.replace(Y,"$jc$.board.mathLib."+v):JXG$1.exists(this.board.mathLibJXG)?(Y=new RegExp("^JXG.Math."),Y.exec(q)!==null?q.replace(Y,"$jc$.board.mathLibJXG."):q):q)):this.isMathMethod(v)?"$jc$.board.mathLib."+v:N?"":(JXG$1.isId(this.board,v)?(q="$jc$.board.objects['"+v+"']",this.board.objects[v].elType==="slider"&&(q+=".Value()")):JXG$1.isName(this.board,v)?(q="$jc$.board.elementsByName['"+v+"']",this.board.elementsByName[v].elType==="slider"&&(q+=".Value()")):JXG$1.isGroup(this.board,v)&&(q="$jc$.board.groups['"+v+"']"),q)))},makeMap:function(v){return v.isMap=!0,v},functionCodeJS:function(v){var N=v.children[0].join(", "),G="",z="";return v.value==="op_map"&&(G="{ return  ",z=" }"),"function ("+N+`) {
96var $oldscope$ = $jc$.scope;
97$jc$.scope = $jc$.scopes[`+this.scope.id+`];
98var r = (function () `+G+this.compile(v.children[1],!0)+z+`)();
99$jc$.scope = $oldscope$;
100return r;
101}`},defineFunction:function(node){var fun,i,that=this,list=node.children[0],scope=this.pushScope(list);if(this.board.options.jc.compile){for(this.isLHS=!1,i=0;i<list.length;i++)scope.locals[list[i]]=list[i];this.replaceNames(node.children[1]),fun=function(jc){var fun,str="var f = function($jc$) { return "+jc.functionCodeJS(node)+"}; f;";try{for(fun=eval(str)(jc),scope.argtypes=[],i=0;i<list.length;i++)scope.argtypes.push(that.resolveType(list[i],node));return fun}catch(v){return jc._warn(`error compiling function
102
103`+str+`
104
105`+v.toString()),function(){}}}(this),this.popScope()}else fun=function(v,N,G){return function(){var z,q;for(q=N.scope,N.scope=N.scopes[G],z=0;z<v.length;z++)N.scope.locals[v[z]]=arguments[z];return z=N.execute(node.children[1]),N.scope=q,z}}(list,this,scope.id);return fun.node=node,fun.scope=scope,fun.toJS=fun.toString,fun.toString=function(v){return function(){return v.compile(v.replaceIDs(JXG$1.deepCopy(node)))}}(this),fun.deps={},this.collectDependencies(node.children[1],node.children[0],fun.deps),fun},mergeAttributes:function(v){var N,G={};for(N=0;N<arguments.length;N++)G=JXG$1.deepCopy(G,arguments[N],!0);return G},setProp:function(v,N,G){var z={},q,Y;v.elementClass===Const.OBJECT_CLASS_POINT&&(N==="X"||N==="Y")?(N=N.toLowerCase(),v.isDraggable&&typeof G=="number"?(q=N==="x"?G:v.X(),Y=N==="y"?G:v.Y(),v.setPosition(Const.COORDS_BY_USER,[q,Y])):v.isDraggable&&(typeof G=="function"||typeof G=="string")?(q=N==="x"?G:v.coords.usrCoords[1],Y=N==="y"?G:v.coords.usrCoords[2],v.addConstraint([q,Y])):v.isDraggable||(q=N==="x"?G:v.XEval.origin,Y=N==="y"?G:v.YEval.origin,v.addConstraint([q,Y])),this.board.update()):v.elementClass===Const.OBJECT_CLASS_TEXT&&(N==="X"||N==="Y")?(typeof G=="number"?v[N]=function(){return G}:typeof G=="function"?(v.isDraggable=!1,v[N]=G):typeof G=="string"&&(v.isDraggable=!1,v[N]=JXG$1.createFunction(G,this.board),v[N+"jc"]=G),v[N].origin=G,this.board.update()):v.type&&v.elementClass&&v.visProp?JXG$1.exists(v[v.methodMap[N]])&&typeof v[v.methodMap[N]]!="function"?v[v.methodMap[N]]=G:(z[N]=G,v.setAttribute(z)):v[N]=G},_genericParse:function(v,N,G,z){var q,Y,W,ie,ne=v.replace(/\r\n/g,`
106`).split(`
107`),se=[];z||(this.code+=v+`
108`),Text&&(Y=Text.prototype.setText,Text.prototype.setText=Text.prototype.setTextJessieCode);try{for(JXG$1.exists(G)||(G=!1),q=0;q<ne.length;q++)G&&(ne[q]=JXG$1.GeonextParser.geonext2JS(ne[q],this.board)),se.push(ne[q]);switch(v=se.join(`
109`),W=parser.parse(v),this.CA&&(W=this.CA.expandDerivatives(W,null,W),W=this.CA.removeTrivialNodes(W)),N){case"parse":ie=this.execute(W);break;case"manipulate":ie=this.compile(W);break;case"getAst":ie=W;break;default:ie=!1}}catch(ae){throw ae}finally{Text&&(Text.prototype.setText=Y)}return ie},parse:function(v,N,G){return this._genericParse(v,"parse",N,G)},manipulate:function(v,N,G){return this._genericParse(v,"manipulate",N,G)},getAST:function(v,N,G){return this._genericParse(v,"getAst",N,G)},snippet:function(v,N,G,z,q){var Y;return N=JXG$1.def(N,!0),G=JXG$1.def(G,""),z=JXG$1.def(z,!1),this.forceValueCall=JXG$1.def(q,!0),Y=(N?" function ("+G+") { return ":"")+v+(N?"; }":"")+";",this.parse(Y,z,!0)},replaceIDs:function(v){var N,G;if(v.replaced&&(G=this.board.objects[v.children[1][0].value],JXG$1.exists(G)&&G.name!==""&&(v.type="node_var",v.value=G.name,v.children.length=0,delete v.replaced)),JXG$1.isArray(v))for(N=0;N<v.length;N++)v[N]=this.replaceIDs(v[N]);if(v.children)for(N=v.children.length;N>0;N--)JXG$1.exists(v.children[N-1])&&(v.children[N-1]=this.replaceIDs(v.children[N-1]));return v},replaceNames:function(v,N){var G,z,q=!1;if(N!==void 0&&(q=N),z=v.value,v.type==="node_op"&&z==="op_lhs"&&v.children.length===1?this.isLHS=!0:v.type==="node_var"&&(this.isLHS?this.letvar(z,!0):!JXG$1.exists(this.getvar(z,!0))&&JXG$1.exists(this.board.elementsByName[z])&&(q&&this.board.elementsByName[z].elType!=="slider"&&(q=!1),v=this.createReplacementNode(v,q))),JXG$1.isArray(v))for(G=0;G<v.length;G++)v[G]=this.replaceNames(v[G],q);if(v.children)for(this.forceValueCall&&(v.value==="op_execfun"&&v.children[0].value!=="V"&&v.children[0].value!=="$"&&(JXG$1.exists(Math[v.children[0].value])||JXG$1.exists(Mat[v.children[0].value]))&&v.children[1][0].type==="node_var"||v.value==="op_return"&&v.children.length===1&&v.children[0].type==="node_var")&&(q=!0),G=v.children.length;G>0;G--)JXG$1.exists(v.children[G-1])&&(v.children[G-1]=this.replaceNames(v.children[G-1],q));return v.type==="node_op"&&v.value==="op_lhs"&&v.children.length===1&&(this.isLHS=!1),v},createReplacementNode:function(v,N){var G=v.value,z=this.board.elementsByName[G];return v=this.createNode("node_op","op_execfun",this.createNode("node_var",N===!0?"$value":"$"),[this.createNode("node_str",z.id)]),v.replaced=!0,v},collectDependencies:function(v,N,G){var z,q,Y,W;if(JXG$1.isArray(v)){for(W=v.length,z=0;z<W;z++)this.collectDependencies(v[z],N,G);return}if(q=v.value,v.type==="node_var"&&N.indexOf(q)<0&&(Y=this.getvar(q),Y&&Y.visProp&&Y.elType&&Y.elementClass&&Y.id&&(G[Y.id]=Y)),v.type==="node_op"&&v.value==="op_execfun"&&v.children.length>1&&(v.children[0].value==="$"||v.children[0].value==="$value")&&v.children[1].length>0&&(Y=v.children[1][0].value,G[Y]=this.board.objects[Y]),v.children)for(z=v.children.length;z>0;z--)JXG$1.exists(v.children[z-1])&&this.collectDependencies(v.children[z-1],N,G)},resolveProperty:function(v,N,G){return G=JXG$1.def(G,!1),v&&v.methodMap&&(JXG$1.exists(v.subs)&&JXG$1.exists(v.subs[N])?v=v.subs:JXG$1.exists(v.methodMap[N])?N=v.methodMap[N]:(v=v.visProp,N=N.toLowerCase())),JXG$1.isFunction(v)&&this._error("Accessing function properties is not allowed."),JXG$1.exists(v)||this._error(v+" is not an object"),JXG$1.exists(v[N])||this._error("unknown property "+N),G&&typeof v[N]=="function"?function(){return v[N].apply(v,arguments)}:v[N]},resolveType:function(v,N){var G,z,q="any";if(JXG$1.isArray(N)){for(G=0;G<N.length;G++)if(z=this.resolveType(v,N[G]),z!=="any")return q=z,q}if(N.type==="node_op"&&N.value==="op_execfun"&&N.children[0].type==="node_var"&&N.children[0].value===v)return"function";if(N.type==="node_op"){for(G=0;G<N.children.length;G++)if(N.children[0].type==="node_var"&&N.children[0].value===v&&(N.value==="op_add"||N.value==="op_sub"||N.value==="op_mul"||N.value==="op_div"||N.value==="op_mod"||N.value==="op_exp"||N.value==="op_neg"))return"any";
109for(G=0;G<N.children.length;G++)if(z=this.resolveType(v,N.children[G]),z!=="any")return q=z,q}return"any"},getLHS:function(v){var N;if(v.type==="node_var")N={o:this.scope.locals,what:v.value};else if(v.type==="node_op"&&v.value==="op_property")N={o:this.execute(v.children[0]),what:v.children[1]};else if(v.type==="node_op"&&v.value==="op_extvalue")N={o:this.execute(v.children[0]),what:this.execute(v.children[1])};else throw new Error("Syntax error: Invalid left-hand side of assignment.");return N},getLHSCompiler:function(v,N){var G;if(v.type==="node_var")G=v.value;else if(v.type==="node_op"&&v.value==="op_property")G=[this.compile(v.children[0],N),"'"+v.children[1]+"'"];else if(v.type==="node_op"&&v.value==="op_extvalue")G=[this.compile(v.children[0],N),v.children[1].type==="node_const"?v.children[1].value:this.compile(v.children[1],N)];else throw new Error("Syntax error: Invalid left-hand side of assignment.");return G},execute:function(v){var N,G,z,q,Y,W,ie,ne,se=[],ae,ce,pe;if(N=0,!v)return N;switch(this.line=v.line,this.col=v.col,v.type){case"node_op":switch(v.value){case"op_none":v.children[0]&&this.execute(v.children[0]),v.children[1]&&(N=this.execute(v.children[1]));break;case"op_assign":G=this.getLHS(v.children[0]),this.lhs[this.scope.id]=G.what,G.o.type&&G.o.elementClass&&G.o.methodMap&&G.what==="label"&&this._error("Left-hand side of assignment is read-only."),N=this.execute(v.children[1]),G.o!==this.scope.locals||JXG$1.isArray(G.o)&&typeof G.what=="number"?this.setProp(G.o,G.what,N):this.letvar(G.what,N),this.lhs[this.scope.id]=0;break;case"op_if":this.execute(v.children[0])&&(N=this.execute(v.children[1]));break;case"op_conditional":case"op_if_else":this.execute(v.children[0])?N=this.execute(v.children[1]):N=this.execute(v.children[2]);break;case"op_while":for(;this.execute(v.children[0]);)this.execute(v.children[1]);break;case"op_do":do this.execute(v.children[0]);while(this.execute(v.children[1]));break;case"op_for":for(this.execute(v.children[0]);this.execute(v.children[1]);this.execute(v.children[2]))this.execute(v.children[3]);break;case"op_proplst":v.children[0]&&this.execute(v.children[0]),v.children[1]&&this.execute(v.children[1]);break;case"op_emptyobject":N={};break;case"op_proplst_val":this.propstack.push({}),this.propscope++,this.execute(v.children[0]),N=this.propstack[this.propscope],this.propstack.pop(),this.propscope--;break;case"op_prop":this.propstack[this.propscope][v.children[0]]=this.execute(v.children[1]);break;case"op_array":for(N=[],Y=v.children[0].length,z=0;z<Y;z++)N.push(this.execute(v.children[0][z]));break;case"op_extvalue":N=this.execute(v.children[0]),z=this.execute(v.children[1]),typeof z=="number"&&Math.abs(Math.round(z)-z)<Mat.eps?N=N[z]:N=W;break;case"op_return":if(this.scope===0)this._error("Unexpected return.");else return this.execute(v.children[0]);break;case"op_map":!v.children[1].isMath&&v.children[1].type!=="node_var"&&this._error("execute: In a map only function calls and mathematical expressions are allowed."),ae=this.defineFunction(v),ae.isMap=!0,N=ae;break;case"op_function":ae=this.defineFunction(v),ae.isMap=!1,N=ae;break;case"op_execfun":if(this.dpstack.push([]),this.pscope++,ie=v.children[1],JXG$1.exists(v.children[2]))if(v.children[3])for(ne=v.children[2],ce={},z=0;z<ne.length;z++)ce=JXG$1.deepCopy(ce,this.execute(ne[z]),!0);else ce=this.execute(v.children[2]);for(v.children[0]._isFunctionName=!0,ae=this.execute(v.children[0]),delete v.children[0]._isFunctionName,JXG$1.exists(ae)&&JXG$1.exists(ae.sc)?pe=ae.sc:pe=this,!ae.creator&&JXG$1.exists(v.children[2])&&this._error("Unexpected value. Only element creators are allowed to have a value after the function call."),z=0;z<ie.length;z++)JXG$1.exists(ae.scope)&&JXG$1.exists(ae.scope.argtypes)&&ae.scope.argtypes[z]==="function"?(ie[z]._isFunctionName=!0,se[z]=this.execute(ie[z]),delete ie[z]._isFunctionName):se[z]=this.execute(ie[z]),this.dpstack[this.pscope].push({line:v.children[1][z].line,col:v.children[1][z].ecol});if(typeof ae=="function"&&!ae.creator)N=ae.apply(pe,se);else if(typeof ae=="function"&&ae.creator){q=this.line;try{for(N=ae(se,ce),N.jcLineStart=q,N.jcLineEnd=v.eline,z=q;z<=v.line;z++)this.lineToElement[z]=N;N.debugParents=this.dpstack[this.pscope]}catch(ge){this._error(ge.toString())}}else this._error("Function '"+ae+"' is undefined.");this.dpstack.pop(),this.pscope--;break;case"op_property":q=this.execute(v.children[0]),G=v.children[1],N=this.resolveProperty(q,G,!1),JXG$1.exists(N)&&["number","string","boolean"].indexOf(typeof N)<0&&(N.sc=q);break;case"op_use":this._warn("Use of the 'use' operator is deprecated."),this.use(v.children[0].toString());break;case"op_delete":this._warn("Use of the 'delete' operator is deprecated. Please use the remove() function."),G=this.getvar(v.children[0]),N=this.del(G);break;case"op_eq":N=this.execute(v.children[0])==this.execute(v.children[1]);break;case"op_neq":N=this.execute(v.children[0])!=this.execute(v.children[1]);break;case"op_approx":N=Math.abs(this.execute(v.children[0])-this.execute(v.children[1]))<Mat.eps;break;case"op_gt":N=this.execute(v.children[0])>this.execute(v.children[1]);break;case"op_lt":N=this.execute(v.children[0])<this.execute(v.children[1]);break;case"op_geq":N=this.execute(v.children[0])>=this.execute(v.children[1]);break;case"op_leq":N=this.execute(v.children[0])<=this.execute(v.children[1]);break;case"op_or":N=this.execute(v.children[0])||this.execute(v.children[1]);break;case"op_and":N=this.execute(v.children[0])&&this.execute(v.children[1]);break;case"op_not":N=!this.execute(v.children[0]);break;case"op_add":N=this.add(this.execute(v.children[0]),this.execute(v.children[1]));break;case"op_sub":N=this.sub(this.execute(v.children[0]),this.execute(v.children[1]));break;case"op_div":N=this.div(this.execute(v.children[0]),this.execute(v.children[1]));break;case"op_mod":N=this.mod(this.execute(v.children[0]),this.execute(v.children[1]),!0);break;case"op_mul":N=this.mul(this.execute(v.children[0]),this.execute(v.children[1]));break;case"op_exp":N=this.pow(this.execute(v.children[0]),this.execute(v.children[1]));break;case"op_neg":N=this.neg(this.execute(v.children[0]));break}break;case"node_var":N=this.getvar(v.value,!1,v._isFunctionName);break;case"node_const":v.value===null?N=null:N=Number(v.value);break;case"node_const_bool":N=v.value;break;case"node_str":N=v.value.replace(/\\(.)/g,"$1");break}return N},compile:function(v,N){var G,z,q,Y="";if(JXG$1.exists(N)||(N=!1),!v)return Y;switch(v.type){case"node_op":switch(v.value){case"op_none":v.children[0]&&(Y=this.compile(v.children[0],N)),v.children[1]&&(Y+=this.compile(v.children[1],N));break;case"op_assign":N?(G=this.getLHSCompiler(v.children[0],N),JXG$1.isArray(G)?Y="$jc$.setProp("+G[0]+", "+G[1]+", "+this.compile(v.children[1],N)+`);
110`:(this.isLocalVariable(G)!==this.scope&&(this.scope.locals[G]=!0),Y="$jc$.scopes["+this.scope.id+"].locals['"+G+"'] = "+this.compile(v.children[1],N)+`;
111`)):(G=this.compile(v.children[0]),Y=G+" = "+this.compile(v.children[1],N)+`;
112`);break;case"op_if":Y=" if ("+this.compile(v.children[0],N)+") "+this.compile(v.children[1],N);break;case"op_if_else":Y=" if ("+this.compile(v.children[0],N)+")"+this.compile(v.children[1],N),Y+=" else "+this.compile(v.children[2],N);break;case"op_conditional":Y="(("+this.compile(v.children[0],N)+")?("+this.compile(v.children[1],N),Y+="):("+this.compile(v.children[2],N)+"))";break;case"op_while":Y=" while ("+this.compile(v.children[0],N)+`) {
113`+this.compile(v.children[1],N)+`}
114`;break;case"op_do":Y=` do {
115`+this.compile(v.children[0],N)+"} while ("+this.compile(v.children[1],N)+`);
116`;break;case"op_for":Y=" for ("+this.compile(v.children[0],N)+this.compile(v.children[1],N)+"; "+this.compile(v.children[2],N).slice(0,-2)+`) {
117`+this.compile(v.children[3],N)+`
118}
119`;break;case"op_proplst":v.children[0]&&(Y=this.compile(v.children[0],N)+", "),Y+=this.compile(v.children[1],N);break;case"op_prop":Y=v.children[0]+": "+this.compile(v.children[1],N);break;case"op_emptyobject":Y=N?"{}":"<< >>";break;case"op_proplst_val":Y=this.compile(v.children[0],N);break;case"op_array":for(q=[],z=0;z<v.children[0].length;z++)q.push(this.compile(v.children[0][z],N));Y="["+q.join(", ")+"]";break;case"op_extvalue":Y=this.compile(v.children[0],N)+"["+this.compile(v.children[1],N)+"]";break;case"op_return":Y=" return "+this.compile(v.children[0],N)+`;
120`;break;case"op_map":!v.children[1].isMath&&v.children[1].type!=="node_var"&&this._error("compile: In a map only function calls and mathematical expressions are allowed."),q=v.children[0],N?Y=" $jc$.makeMap(function ("+q.j
120oin(", ")+") { return "+this.compile(v.children[1],N)+"; })":Y="map ("+q.join(", ")+") -> "+this.compile(v.children[1],N);break;case"op_function":q=v.children[0],this.pushScope(q),N?Y=this.functionCodeJS(v):Y=" function ("+q.join(", ")+") "+this.compile(v.children[1],N),this.popScope();break;case"op_execfunmath":console.log("op_execfunmath: TODO"),Y="-1";break;case"op_execfun":if(v.children[2]){for(q=[],z=0;z<v.children[2].length;z++)q.push(this.compile(v.children[2][z],N));N?G="$jc$.mergeAttributes("+q.join(", ")+")":G=q.join(", ")}for(v.children[0].withProps=!!v.children[2],q=[],z=0;z<v.children[1].length;z++)q.push(this.compile(v.children[1][z],N));Y=this.compile(v.children[0],N)+"("+q.join(", ")+(v.children[2]&&N?", "+G:"")+")"+(v.children[2]&&!N?" "+G:""),N&&(Y+=`
121`),N&&v.children[0].value==="$"&&(Y="$jc$.board.objects["+this.compile(v.children[1][0],N)+"]");break;case"op_property":N&&v.children[1]!=="X"&&v.children[1]!=="Y"?Y="$jc$.resolveProperty("+this.compile(v.children[0],N)+", '"+v.children[1]+"', true)":Y=this.compile(v.children[0],N)+"."+v.children[1];break;case"op_use":this._warn("Use of the 'use' operator is deprecated."),N?Y="$jc$.use('":Y="use('",Y+=v.children[0].toString()+"');";break;case"op_delete":this._warn("Use of the 'delete' operator is deprecated. Please use the remove() function."),N?Y="$jc$.del(":Y="remove(",Y+=this.compile(v.children[0],N)+")";break;case"op_eq":Y="("+this.compile(v.children[0],N)+" === "+this.compile(v.children[1],N)+")";break;case"op_neq":Y="("+this.compile(v.children[0],N)+" !== "+this.compile(v.children[1],N)+")";break;case"op_approx":Y="("+this.compile(v.children[0],N)+" ~= "+this.compile(v.children[1],N)+")";break;case"op_gt":N?Y="$jc$.gt("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" > "+this.compile(v.children[1],N)+")";break;case"op_lt":N?Y="$jc$.lt("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" < "+this.compile(v.children[1],N)+")";break;case"op_geq":N?Y="$jc$.geq("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" >= "+this.compile(v.children[1],N)+")";break;case"op_leq":N?Y="$jc$.leq("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" <= "+this.compile(v.children[1],N)+")";break;case"op_or":Y="("+this.compile(v.children[0],N)+" || "+this.compile(v.children[1],N)+")";break;case"op_and":Y="("+this.compile(v.children[0],N)+" && "+this.compile(v.children[1],N)+")";break;case"op_not":Y="!("+this.compile(v.children[0],N)+")";break;case"op_add":N?Y="$jc$.add("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" + "+this.compile(v.children[1],N)+")";break;case"op_sub":N?Y="$jc$.sub("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" - "+this.compile(v.children[1],N)+")";break;case"op_div":N?Y="$jc$.div("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" / "+this.compile(v.children[1],N)+")";break;case"op_mod":N?Y="$jc$.mod("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+", true)":Y="("+this.compile(v.children[0],N)+" % "+this.compile(v.children[1],N)+")";break;case"op_mul":N?Y="$jc$.mul("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+" * "+this.compile(v.children[1],N)+")";break;case"op_exp":N?Y="$jc$.pow("+this.compile(v.children[0],N)+", "+this.compile(v.children[1],N)+")":Y="("+this.compile(v.children[0],N)+"^"+this.compile(v.children[1],N)+")";break;case"op_neg":N?Y="$jc$.neg("+this.compile(v.children[0],N)+")":Y="(-"+this.compile(v.children[0],N)+")";break}break;case"node_var":N?Y=this.getvarJS(v.value,!1,v.withProps):Y=v.value;break;case"node_const":Y=v.value;break;case"node_const_bool":Y=v.value;break;case"node_str":Y="'"+v.value+"'";break}return v.needsBrackets&&(Y=`{
122`+Y+` }
123`),v.needsAngleBrackets&&(N?Y=`{
124`+Y+` }
125`:Y="<< "+Y+` >>
126`),Y},getName:function(v,N){var G="";return JXG$1.exists(v)&&JXG$1.exists(v.getName)?(G=v.getName(),(!JXG$1.exists(G)||G==="")&&N&&(G=v.id)):N&&(G=v.id),G},X:function(v){return v.X()},Y:function(v){return v.Y()},V:function(v){return v.Value()},L:function(v){return v.L()},area:function(v){return(!JXG$1.exists(v)||!JXG$1.exists(v.Area))&&this._error("Error: Can't 
126calculate area."),v.Area()},perimeter:function(v){return(!JXG$1.exists(v)||!JXG$1.exists(v.Perimeter))&&this._error("Error: Can't calculate perimeter."),v.Perimeter()},dist:function(v,N){return(!JXG$1.exists(v)||!JXG$1.exists(v.Dist))&&this._error("Error: Can't calculate distance."),v.Dist(N)},radius:function(v){return(!JXG$1.exists(v)||!JXG$1.exists(v.Radius))&&this._error("Error: Can't calculate radius."),v.Radius()},slope:function(v){return(!JXG$1.exists(v)||!JXG$1.exists(v.Slope))&&this._error("Error: Can't calculate slope."),v.Slope()},add:function(v,N){var G,z,q;if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),Interval.isInterval(v)||Interval.isInterval(N))q=Interval.add(v,N);else if(JXG$1.isArray(v)&&JXG$1.isArray(N))for(z=Math.min(v.length,N.length),q=[],G=0;G<z;G++)q[G]=v[G]+N[G];else JXG$1.isNumber(v)&&JXG$1.isNumber(N)?q=v+N:JXG$1.isString(v)||JXG$1.isString(N)?q=v.toString()+N.toString():this._error("Operation + not defined on operands "+typeof v+" and "+typeof N);return q},sub:function(v,N){var G,z,q;if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),Interval.isInterval(v)||Interval.isInterval(N))q=Interval.sub(v,N);else if(JXG$1.isArray(v)&&JXG$1.isArray(N))for(z=Math.min(v.length,N.length),q=[],G=0;G<z;G++)q[G]=v[G]-N[G];else JXG$1.isNumber(v)&&JXG$1.isNumber(N)?q=v-N:this._error("Operation - not defined on operands "+typeof v+" and "+typeof N);return q},neg:function(v){var N,G,z;if(v=JXG$1.evalSlider(v),Interval.isInterval(v))z=Interval.negative(v);else if(JXG$1.isArray(v))for(G=v.length,z=[],N=0;N<G;N++)z[N]=-v[N];else JXG$1.isNumber(v)?z=-v:this._error("Unary operation - not defined on operand "+typeof v);return z},mul:function(v,N){var G,z,q;if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),JXG$1.isArray(v)&&JXG$1.isNumber(N)&&(G=v,v=N,N=v),Interval.isInterval(v)||Interval.isInterval(N))q=Interval.mul(v,N);else if(JXG$1.isArray(v)&&JXG$1.isArray(N))z=Math.min(v.length,N.length),q=Mat.innerProduct(v,N,z);else if(JXG$1.isNumber(v)&&JXG$1.isArray(N))for(z=N.length,q=[],G=0;G<z;G++)q[G]=v*N[G];else JXG$1.isNumber(v)&&JXG$1.isNumber(N)?q=v*N:this._error("Operation * not defined on operands "+typeof v+" and "+typeof N);return q},div:function(v,N){var G,z,q;if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),Interval.isInterval(v)||Interval.isInterval(N))q=Interval.div(v,N);else if(JXG$1.isArray(v)&&JXG$1.isNumber(N))for(z=v.length,q=[],G=0;G<z;G++)q[G]=v[G]/N;else JXG$1.isNumber(v)&&JXG$1.isNumber(N)?q=v/N:this._error("Operation * not defined on operands "+typeof v+" and "+typeof N);return q},mod:function(v,N){var G,z,q;if(v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),Interval.isInterval(v)||Interval.isInterval(N))return Interval.fmod(v,N);if(JXG$1.isArray(v)&&JXG$1.isNumber(N))for(z=v.length,q=[],G=0;G<z;G++)q[G]=Mat.mod(v[G],N,!0);else JXG$1.isNumber(v)&&JXG$1.isNumber(N)?q=Mat.mod(v,N,!0):this._error("Operation * not defined on operands "+typeof v+" and "+typeof N);return q},pow:function(v,N){return v=JXG$1.evalSlider(v),N=JXG$1.evalSlider(N),Interval.isInterval(v)||Interval.isInterval(N)?Interval.pow(v,N):Mat.pow(v,N)},lt:function(v,N){return Interval.isInterval(v)||Interval.isInterval(N)?Interval.lt(v,N):v<N},leq:function(v,N){return Interval.isInterval(v)||Interval.isInterval(N)?Interval.leq(v,N):v<=N},gt:function(v,N){return Interval.isInterval(v)||Interval.isInterval(N)?Interval.gt(v,N):v>N},geq:function(v,N){return Interval.isInterval(v)||Interval.isInterval(N)?Interval.geq(v,N):v>=N},randint:function(v,N,G){return JXG$1.exists(G)||(G=1),Math.round(Math.random()*(N-v)/G)*G+v},DDD:function(v){console.log("Dummy derivative function. This should never appear!")},ifthen:function(v,N,G){return v?N:G},del:function(v){typeof v=="object"&&JXG$1.exists(v.type)&&JXG$1.exists(v.elementClass)&&this.board.removeObject(v)},eval:function(v){return JXG$1.evaluate(v)},use:function(v){var N,G,z=!1;if(typeof v=="string"){for(N in JXG$1.boards)if(JXG$1.boards.hasOwnProperty(N)&&JXG$1.boards[N].container===v){G=JXG$1.boards[N],z=!0;break}}else G=v,z=!0;z?(this.board=G,this.builtIn.$board=G,this.builtIn.$board.src="$jc$.board"):this._error("Board '"+v+"' not found!")},findSymbol:function(v,N){var G,z;for(N=JXG$1.def(N,-1),N===-1?z=this.scope:z=this.scopes[N];z!==null;){for(G in z.locals)if(z.locals.hasOwnProperty(G)&&z.locals[G]===v)return[G,z];z=z.previous}return[]},importModule:function(v){return priv$4.modules[v.toLowerCase()]},defineBuiltIn:function(){var v=this,N={PI:Math.PI,EULER:Math.E,D:v.DDD,X:v.X,Y:v.Y,V:v.V,Value:v.V,L:v.L,Length:v.L,acosh:Mat.acosh,acot:Mat.acot,asinh:Mat.asin
126h,binomial:Mat.binomial,cbrt:Mat.cbrt,cosh:Mat.cosh,cot:Mat.cot,deg:Geometry.trueAngle,A:v.area,area:v.area,Area:v.area,perimeter:v.perimeter,Perimeter:v.perimeter,dist:v.dist,Dist:v.dist,R:v.radius,radius:v.radius,Radius:v.radius,erf:Mat.erf,erfc:Mat.erfc,erfi:Mat.erfi,factorial:Mat.factorial,gcd:Mat.gcd,lb:Mat.log2,lcm:Mat.lcm,ld:Mat.log2,lg:Mat.log10,ln:Math.log,log:Mat.log,log10:Mat.log10,log2:Mat.log2,ndtr:Mat.ndtr,ndtri:Mat.ndtri,nthroot:Mat.nthroot,pow:Mat.pow,rad:Geometry.rad,ratpow:Mat.ratpow,trunc:JXG$1.trunc,sinh:Mat.sinh,slope:v.slope,Slope:v.slope,randint:v.randint,IfThen:v.ifthen,import:v.importModule,eval:v.eval,use:v.use,remove:v.del,$:v.getElementById,$value:function(G){return v.getElementById(G).Value()},getName:v.getName,name:v.getName,$board:v.board,$log:v.log};return N.rad.sc=Geometry,N.deg.sc=Geometry,N.factorial.sc=Mat,N.X.src="$jc$.X",N.Y.src="$jc$.Y",N.V.src="$jc$.V",N.Value.src="$jc$.V",N.L.src="$jc$.L",N.Length.src="$jc$.L",N.acosh.src="JXG.Math.acosh",N.acot.src="JXG.Math.acot",N.asinh.src="JXG.Math.asinh",N.binomial.src="JXG.Math.binomial",N.cbrt.src="JXG.Math.cbrt",N.cot.src="JXG.Math.cot",N.cosh.src="JXG.Math.cosh",N.deg.src="JXG.Math.Geometry.trueAngle",N.erf.src="JXG.Math.erf",N.erfc.src="JXG.Math.erfc",N.erfi.src="JXG.Math.erfi",N.A.src="$jc$.area",N.area.src="$jc$.area",N.Area.src="$jc$.area",N.perimeter.src="$jc$.perimeter",N.Perimeter.src="$jc$.perimeter",N.dist.src="$jc$.dist",N.Dist.src="$jc$.dist",N.R.src="$jc$.radius",N.radius.src="$jc$.radius",N.Radius.src="$jc$.radius",N.factorial.src="JXG.Math.factorial",N.gcd.src="JXG.Math.gcd",N.lb.src="JXG.Math.log2",N.lcm.src="JXG.Math.lcm",N.ld.src="JXG.Math.log2",N.lg.src="JXG.Math.log10",N.ln.src="Math.log",N.log.src="JXG.Math.log",N.log10.src="JXG.Math.log10",N.log2.src="JXG.Math.log2",N.ndtr.src="JXG.Math.ndtr",N.ndtri.src="JXG.Math.ndtri",N.nthroot.src="JXG.Math.nthroot",N.pow.src="JXG.Math.pow",N.rad.src="JXG.Math.Geometry.rad",N.ratpow.src="JXG.Math.ratpow",N.trunc.src="JXG.trunc",N.sinh.src="JXG.Math.sinh",N.slope.src="$jc$.slope",N.Slope.src="$jc$.slope",N.randint.src="$jc$.randint",N.import.src="$jc$.importModule",N.eval.src="$jc$.eval",N.use.src="$jc$.use",N.remove.src="$jc$.del",N.IfThen.src="$jc$.ifthen",N.$.src="(function (n) { return $jc$.board.select(n); })",N.$value.src="(function (n) { return $jc$.board.select(n).Value(); })",N.getName.src="$jc$.getName",N.name.src="$jc$.getName",N.$board&&(N.$board.src="$jc$.board"),N.$log.src="$jc$.log",N=JXG$1.merge(N,v._addedBuiltIn),N},_addedBuiltIn:{},addBuiltIn:function(v,N){if(JXG$1.exists(this.builtIn)){if(JXG$1.exists(this.builtIn[v]))return;this.builtIn[v]=N,this.builtIn[v].src="$jc$."+v}JXG$1.exists(this._addedBuiltIn[v])||(this._addedBuiltIn[v]=N,this._addedBuiltIn[v].src="$jc$."+v,JXG$1.JessieCode.prototype[v]=N)},getPossibleOperands:function(){var v=["E"],N=this.builtIn||this.defineBuiltIn(),G=Math,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee;for(be=function(Pe,Je){return Pe.toLowerCase().localeCompare(Je.toLowerCase())},Ee=function(Pe,Je){var Ce=null;if(Je==="jc")Ce=N[Pe];else if(Je==="Math")Ce=G[Pe];else return;if(!(v.indexOf(Pe)>=0)){if(JXG$1.isFunction(Ce))return{name:Pe,type:"function",numParams:Ce.length,origin:Je};if(JXG$1.isNumber(Ce))return{name:Pe,type:"constant",value:Ce,origin:Je};Pe.startsWith("$")||Ce!==void 0&&console.error("undefined type",Ce)}},z=Object.getOwnPropertyNames(N).sort(be),q=Object.getOwnPropertyNames(G).sort(be),Y=[],W=0,ie=0;W<z.length||ie<q.length;)z[W]===q[ie]?(ne=Ee(q[ie],"Math"),JXG$1.exists(ne)&&Y.push(ne),W++,ie++):!JXG$1.exists(q[ie])||z[W].toLowerCase().localeCompare(q[ie].toLowerCase())<0?(ne=Ee(z[W],"jc"),JXG$1.exists(ne)&&Y.push(ne),W++):(ne=Ee(q[ie],"Math"),JXG$1.exists(ne)&&Y.push(ne),ie++);for(ce=[],pe=[],ge=[],ve={},se=Y.length,W=0;W<se;W++){switch(ae=Y[W],ae.type){case"function":ce.push(ae.name),ae.origin==="jc"&&pe.push(ae.name);break;case"constant":ge.push(ae.name);break}ve[ae.name]=ae}return{all:ve,list:Y,functions:ce,functions_jessiecode:pe,constants:ge}},_debug:function(v){typeof console=="object"?console.log(v):JXG$1.isBrowser&&document&&document.getElementById("debug")!==null&&(document.getElementById("debug").innerHTML+=v+"<br />")},_error:function(v){var N=new Error("Error("+this.line+"): "+v);throw N.line=this.line,N},_warn:function(v){typeof console=="object"?console.log("Warning("+this.line+"): "+v):JXG$1.isBrowser&&document&&document.getElementById(this.warnLog)!==null&&(document.getElementById(this.warnLog).innerHTML+="Warning("+this.line+"): "+v+"<br />")},_log:function(v){typeof window!="object"&&typeof self=="object"&&self.postMessage?self.postMessage({type:"log",msg:"Log: "+v.toString()}):console.log("Log: ",arguments)}});var parser=function(){var v=function(Wt,qt,Yt,or){for(Yt=Yt||{},or=Wt.length;or--;Yt[Wt[or]]=qt);return Yt},N=[2,14],G=[1,13],z=[1,37],q=[1,14],Y=[1,15],W=[1,21],ie=[1,16],ne=[1,17],se=[1,33],ae=[1,18],ce=[1,19],pe=[1,12],ge=[1,59],ve=[1,60],be=[1,58],Ee=[1,46],Pe=[1,48],Je=[1,49],Ce=[
1261,50],Ve=[1,51],Re=[1,52],qe=[1,53],et=[1,54],Ze=[1,45],tt=[1,38],Ke=[1,39],rt=[5,7,8,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],it=[5,7,8,12,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],ot=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],ut=[2,48],ct=[1,72],at=[10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,66,83,86],st=[1,78],pt=[8,10,16,32,34,35,37,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],lt=[1,82],vt=[8,10,16,32,34,35,37,39,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],dt=[1,83],xt=[1,84],ft=[1,85],Et=[8,10,16,32,34,35,37,39,41,42,43,50,51,53,54,55,57,64,65,66,83,86],Ct=[1,89],Dt=[1,90],Gt=[1,91],Ot=[1,92],It=[1,97],Bt=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,53,54,55,57,64,65,66,83,86],Ht=[1,103],ir=[1,104],zt=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,57,64,65,66,83,86],tr=[1,105],bt=[1,106],_t=[1,107],Xt=[1,126],At=[1,139],$t=[83,86],Pt=[1,150],kt=[10,66,86],jt=[8,10,16,20,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,82,83,86],wt=[1,167],Mt=[10,86],Tt={trace:function(){},yy:{},symbols_:{error:2,Program:3,StatementList:4,EOF:5,IfStatement:6,IF:7,"(":8,Expression:9,")":10,Statement:11,ELSE:12,LoopStatement:13,WHILE:14,FOR:15,";":16,DO:17,UnaryStatement:18,USE:19,IDENTIFIER:20,DELETE:21,ReturnStatement:22,RETURN:23,EmptyStatement:24,StatementBlock:25,"{":26,"}":27,ExpressionStatement:28,AssignmentExpression:29,ConditionalExpression:30,LeftHandSideExpression:31,"=":32,LogicalORExpression:33,"?":34,":":35,LogicalANDExpression:36,"||":37,EqualityExpression:38,"&&":39,RelationalExpression:40,"==":41,"!=":42,"~=":43,AdditiveExpression:44,"<":45,">":46,"<=":47,">=":48,MultiplicativeExpression:49,"+":50,"-":51,UnaryExpression:52,"*":53,"/":54,"%":55,ExponentExpression:56,"^":57,"!":58,Member
126Expression:59,CallExpression:60,PrimaryExpression:61,FunctionExpression:62,MapExpression:63,".":64,"[":65,"]":66,BasicLiteral:67,ObjectLiteral:68,ArrayLiteral:69,NullLiteral:70,BooleanLiteral:71,StringLiteral:72,NumberLiteral:73,NULL:74,TRUE:75,FALSE:76,STRING:77,NUMBER:78,NAN:79,INFINITY:80,ElementList:81,"<<":82,">>":83,PropertyList:84,Property:85,",":86,PropertyName:87,Arguments:88,AttributeList:89,Attribute:90,FUNCTION:91,ParameterDefinitionList:92,MAP:93,"->":94,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:"IF",8:"(",10:")",12:"ELSE",14:"WHILE",15:"FOR",16:";",17:"DO",19:"USE",20:"IDENTIFIER",21:"DELETE",23:"RETURN",26:"{",27:"}",32:"=",34:"?",35:":",37:"||",39:"&&",41:"==",42:"!=",43:"~=",45:"<",46:">",47:"<=",48:">=",50:"+",51:"-",53:"*",54:"/",55:"%",57:"^",58:"!",64:".",65:"[",66:"]",74:"NULL",75:"TRUE",76:"FALSE",77:"STRING",78:"NUMBER",79:"NAN",80:"INFINITY",82:"<<",83:">>",86:",",91:"FUNCTION",93:"MAP",94:"->"},productions_:[0,[3,2],[6,5],[6,7],[13,5],[13,9],[13,7],[18,2],[18,2],[22,2],[22,3],[24,1],[25,3],[4,2],[4,0],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[28,2],[9,1],[29,1],[29,3],[30,1],[30,5],[33,1],[33,3],[36,1],[36,3],[38,1],[38,3],[38,3],[38,3],[40,1],[40,3],[40,3],[40,3],[40,3],[44,1],[44,3],[44,3],[49,1],[49,3],[49,3],[49,3],[56,1],[56,3],[52,1],[52,2],[52,2],[52,2],[31,1],[31,1],[59,1],[59,1],[59,1],[59,3],[59,4],[61,1],[61,1],[61,1],[61,1],[61,3],[67,1],[67,1],[67,1],[67,1],[70,1],[71,1],[71,1],[72,1],[73,1],[73,1],[73,1],[69,2],[69,3],[68,2],[68,3],[84,1],[84,3],[85,3],[87,1],[87,1],[87,1],[60,2],[60,3],[60,2],[60,4],[60,3],[88,2],[88,3],[89,1],[89,3],[90,1],[90,1],[81,1],[81,3],[62,4],[62,5],[63,5],[63,6],[92,1],[92,3]],performAction:function(qt,Yt,or,hr,sr,nr,gt){var Nt=nr.length-1;switch(sr){case 1:return nr[Nt-1];case 2:this.$=Rt.createNode(Ft(gt[Nt-4]),"node_op","op_if",nr[Nt-2],nr[Nt]);break;case 3:this.$=Rt.createNode(Ft(gt[Nt-6]),"node_op","op_if_else",nr[Nt-4],nr[Nt-2],nr[Nt]);break;case 4:this.$=Rt.createNode(Ft(gt[Nt-4]),"node_op","op_while",nr[Nt-2],nr[Nt]);break;
126case 5:this.$=Rt.createNode(Ft(gt[Nt-8]),"node_op","op_for",nr[Nt-6],nr[Nt-4],nr[Nt-2],nr[Nt]);break;case 6:this.$=Rt.createNode(Ft(gt[Nt-6]),"node_op","op_do",nr[Nt-5],nr[Nt-2]);break;case 7:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_use",nr[Nt]);break;case 8:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_delete",nr[Nt]);break;case 9:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_return",void 0);break;case 10:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_return",nr[Nt-1]);break;case 11:case 14:this.$=Rt.createNode(Ft(gt[Nt]),"node_op","op_none");break;case 12:this.$=nr[Nt-1],this.$.needsBrackets=!0;break;case 13:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_none",nr[Nt-1],nr[Nt]);break;case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 23:case 24:case 26:case 28:case 30:case 32:case 36:case 41:case 44:case 48:case 50:case 52:case 54:case 55:case 56:case 58:case 62:case 81:case 84:case 85:case 86:this.$=nr[Nt];break;case 22:case 65:case 93:this.$=nr[Nt-1];break;case 25:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_assign",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 27:this.$=Rt.createNode(Ft(gt[Nt-4]),"node_op","op_conditional",nr[Nt-4],nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 29:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_or",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 31:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_and",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 33:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_eq",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 34:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_neq",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 35:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_approx",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 37:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_lt",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 38:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_gt",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 39:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_leq",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 40:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_geq",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 42:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_add",nr[Nt-2],nr[Nt]),this.$.isMath=!0;break;case 43:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_sub",nr[Nt-2],nr[Nt]),this.$.isMath=!0;break;case 45:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_mul",nr[Nt-2],nr[Nt]),this.$.isMath=!0;break;case 46:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_div",nr[Nt-2],nr[Nt]),this.$.isMath=!0;break;case 47:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_mod",nr[Nt-2],nr[Nt]),this.$.isMath=!0;break;case 49:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_exp",nr[Nt-2],nr[Nt]),this.$.isMath=!0;break;case 51:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_not",nr[Nt]),this.$.isMath=!1;break;case 53:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_neg",nr[Nt]),this.$.isMath=!0;break;
126case 57:case 63:case 64:case 66:case 67:case 68:case 97:this.$=nr[Nt],this.$.isMath=!1;break;case 59:case 91:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_property",nr[Nt-2],nr[Nt]),this.$.isMath=!0;break;case 60:case 90:this.$=Rt.createNode(Ft(gt[Nt-3]),"node_op","op_extvalue",nr[Nt-3],nr[Nt-1]),this.$.isMath=!0;break;case 61:this.$=Rt.createNode(Ft(gt[Nt]),"node_var",nr[Nt]);break;case 69:this.$=nr[Nt],this.$.isMath=!0;break;case 70:this.$=Rt.createNode(Ft(gt[Nt]),"node_const",null);break;case 71:this.$=Rt.createNode(Ft(gt[Nt]),"node_const_bool",!0);break;case 72:this.$=Rt.createNode(Ft(gt[Nt]),"node_const_bool",!1);break;case 73:this.$=Rt.createNode(Ft(gt[Nt]),"node_str",nr[Nt].substring(1,nr[Nt].length-1));break;case 74:this.$=Rt.createNode(Ft(gt[Nt]),"node_const",parseFloat(nr[Nt]));break;case 75:this.$=Rt.createNode(Ft(gt[Nt]),"node_const",NaN);break;case 76:this.$=Rt.createNode(Ft(gt[Nt]),"node_const",1/0);break;case 77:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_array",[]);break;case 78:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_array",nr[Nt-1]);break;case 79:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_emptyobject",{}),this.$.needsAngleBrackets=!0;break;case 80:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_proplst_val",nr[Nt-1]),this.$.needsAngleBrackets=!0;break;case 82:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_proplst",nr[Nt-2],nr[Nt]);break;case 83:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_prop",nr[Nt-2],nr[Nt]);break;case 87:case 89:this.$=Rt.createNode(Ft(gt[Nt-1]),"node_op","op_execfun",nr[Nt-1],nr[Nt]),this.$.isMath=!0;break;case 88:this.$=Rt.createNode(Ft(gt[Nt-2]),"node_op","op_execfun",nr[Nt-2],nr[Nt-1],nr[Nt],!0),this.$.isMath=!1;break;case 92:this.$=[];break;case 94:case 98:case 104:this.$=[nr[Nt]];break;case 95:case 99:case 105:this.$=nr[Nt-2].concat(nr[Nt]);break;case 96:this.$=Rt.createNode(Ft(gt[Nt]),"node_var",nr[Nt]),this.$.isMath=!0;break;case 100:this.$=Rt.createNode(Ft(gt[Nt-3]),"node_op","op_function",[],nr[Nt]),this.$.isMath=!1;break;case 101:this.$=Rt.createNode(Ft(gt[Nt-4]),"node_op","op_function",nr[Nt-2],nr[Nt]),this.$.isMath=!1;break;case 102:this.$=Rt.createNode(Ft(gt[Nt-4]),"node_op","op_map",[],nr[Nt]);break;case 103:this.$=Rt.createNode(Ft(gt[Nt-5]),"node_op","op_map",nr[Nt-3],nr[Nt]);break}},table:[v([5,7,8,14,15,16,17,19,20,21,23,26,50,51,58,65,74,75,76,77,78,79,80,82,91,93],N,{3:1,4:2}),{1:[3]},{5:[1,3],6:6,7:G,8:z,9:20,11:4,13:7,14:q,15:Y,16:W,17:ie,18:8,19:ne,20:se,21:ae,22:9,23:ce,24:11,25:5,26:pe,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{1:[2,1]},v(rt,[2,13]),v(it,[2,15]),v(it,[2,16]),v(it,[2,17]),v(it,[2,18]),v(it,[2,19]),v(it,[2,20]),v(it,[2,21]),v([7,8,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],N,{4:61}),{8:[1,62]},{8:[1,63]},{8:[1,64]},{6:6,7:G,8:z,9:20,11:65,13:7,14:q,15:Y,16:W,17:ie,18:8,19:ne,20:se,21:ae,22:9,23:ce,24:11,25:5,26:pe,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{20:[1,66]},{20:[1,67]},{8:z,9:69,16:[1,68],20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{16:[1,70]},v(it,[2,11]),v(ot,[2,23]),v(ot,[2,24]),v([8,10,16,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],ut,{32:[1,71],57:ct}),v([8,10,16,32,35,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],[2,26],{34:[1,73],37:[1,74]}),v(at,[2,54],{88:77,8:st,64:[1,75],65:[1,76]}),v(at,[2,55],{88:79,8:st,64:[1,81],65:[1,80]}),v(pt,[2,28],{39:lt}),v(ot,[2,56]),v(ot,[2,57]),v(ot,[2,58]),v(vt,[2,30],{41:dt,42:xt,43:ft}),v(ot,[2,61]),v(ot,[2,62]),v(ot,[2,63]),v(ot,[2,64]),{8:z,9:86,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:[1,87]},{8:[1,88]},v(Et,[2,32],{45:Ct,46:Dt,47:Gt,48:Ot}),v(ot,[2,66]),v(ot,[2,67]),v(ot,[2,68]),v(ot,[2,69]),{20:It,72:98,73:99,77:Ve,78:Re,79:qe,80:et,83:[1,93],84:94,85:95,87:96},{8:z,20:se,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,81:101,82:Ze,91:tt,93:Ke},v(Bt,[2,36],{50:Ht,51:ir}),v(ot,[2,70]),v(ot,[2,71]),v(ot,[2,72]),v(ot,[2,73]),v(ot,[2,74]),v(ot,[2,75]),v(ot,[2,76]),v(zt,[2,41],{53:tr,54:bt,55:_t}),v(ot,[2,44]),v(ot,[2,50]),{8:z,20:se,31:109,50:ge,51:ve,52:108,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,50:ge,51:ve,52:110,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,50:ge,51:ve,52:111,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{6:6,7:G,8:z,9:20,11:4,13:7,14:q,15:Y,16:W,17:ie,18:8,19:ne,20:se,21:ae,22:9,23:ce,24:11,25:5,26:pe,27:[1,112],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,9:113,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,9:114,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,9:115,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{14:[1,116]},v(it,[2,7]),v(it,[2,8]),v(it,[2,9]),{16:[1,117]},v(it,[2,22]),{8:z,20:se,29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,50:ge,51:ve,52:119,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,29:120,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,36:121,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{20:[1,122]},{8:z,9:123,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},v(ot,[2,87],{89:124,90:125,68:127,20:Xt,82:Ze}),{8:z,10:[1,128],20:se,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,81:129,82:Ze,91:tt,93:Ke},v(ot,[2,89]),{8:z,9:130,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{20:[1,131]},{8:z,20:se,31:109,38:132,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,40:133,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,40:134,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,40:135,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{10:[1,136]},{10:[1,137],20:At,92:138},{10:[1,140],20:At,92:141},{8:z,20:se,31:109,44:142,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,44:143,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,44:144,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,44:145,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},v(ot,[2,79]),{83:[1,146],86:[1,147]},v($t,[2,81]),{35:[1,148]},{35:[2,84]},{35:[2,85]},{35:[2,86]},v(ot,[2,77]),{66:[1,149],86:Pt},v(kt,[2,98]),{8:z,20:se,31:109,49:151,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,49:152,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,50:ge,51:ve,52:153,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,50:ge,51:ve,52:154,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,31:109,50:ge,51:ve,52:155,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},v(ot,[2,51]),v([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],ut,{57:ct}),v(ot,[2,52]),v(ot,[2,53]),v([5,7,8,10,12,14,15,16,17,19,20,21,23,26,27,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,58,64,65,66,74,75,76,77,78,79,80,82,83,86,91,93],[2,12]),{10:[1,156]},{10:[1,157]},{16:[1,158]},{8:[1,159]},v(it,[2,10]),v(ot,[2,25]),v(ot,[2,49]),{35:[1,160]},v(pt,[2,29],{39:lt}),v(ot,[2,59]),{66:[1,161]},v([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83],[2,88],{86:[1,162]}),v(ot,[2,94]),v(ot,[2,96]),v(ot,[2,97]),v(jt,[2,92]),{10:[1,163],86:Pt},{66:[1,164]},v(ot,[2,91]),v(vt,[2,31],{41:dt,42:xt,43:ft}),v(Et,[2,33],{45:Ct,46:Dt,47:Gt,48:Ot}),v(Et,[2,34],{45:Ct,46:Dt,47:Gt,48:Ot}),v(Et,[2,35],{45:Ct,46:Dt,47:Gt,48:Ot}),v(ot,[2,65]),{25:165,26:pe},{10:[1,166],86:wt},v(Mt,[2,104]),{94:[1,168]},{10:[1,169],86:wt},v(Bt,[2,37],{50:Ht,51:ir}),v(Bt,[2,38],{50:Ht,51:ir}),v(Bt,[2,39],{50:Ht,51:ir}),v(Bt,[2,40],{50:Ht,51:ir}),v(ot,[2,80]),{20:It,72:98,73:99,77:Ve,78:Re,79:qe,80:et,85:170,87:96},{8:z,20:se,29:171,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},v(ot,[2,78]),{8:z,20:se,29:172,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},v(zt,[2,42],{53:tr,54:bt,55:_t}),v(zt,[2,43],{53:tr,54:bt,55:_t}),v(ot,[2,45]),v(ot,[2,46]),v(ot,[2,47]),{6:6,7:G,8:z,9:20,11:173,13:7,14:q,15:Y,16:W,17:ie,18:8,19:ne,20:se,21:ae,22:9,23:ce,24:11,25:5,26:pe,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{6:6,7:G,8:z,9:20,11:174,13:7,14:q,15:Y,16:W,17:ie,18:8,19:ne,20:se,21:ae,22:9,23:ce,24:11,25:5,26:pe,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,9:175,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,9:176,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,20:se,29:177,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},v(ot,[2,60]),{20:Xt,68:127,82:Ze,90:178},v(jt,[2,93]),v(ot,[2,90]),v(ot,[2,100]),{25:179,26:pe},{20:[1,180]},{8:z,9:181,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{94:[1,182]},v($t,[2,82]),v($t,[2,83]),v(kt,[2,99]),v(rt,[2,2],{12:[1,183]}),v(it,[2,4]),{16:[1,184]},{10:[1,185]},v(ot,[2,27]),v(ot,[2,95]),v(ot,[2,101]),v(Mt,[2,105]),v(ot,[2,102]),{8:z,9:186,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{6:6,7:G,8:z,9:20,11:187,13:7,14:q,15:Y,16:W,17:ie,18:8,19:ne,20:se,21:ae,22:9,23:ce,24:11,25:5,26:pe,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{8:z,9:188,20:se,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},{16:[1,189]},v(ot,[2,103]),v(it,[2,3]),{10:[1,190]},v(it,[2,6]),{6:6,7:G,8:z,9:20,11:191,13:7,14:q,15:Y,16:W,17:ie,18:8,19:ne,20:se,21:ae,22:9,23:ce,24:11,25:5,26:pe,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:ge,51:ve,52:56,56:57,58:be,59:26,60:27,61:29,62:30,63:31,65:Ee,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:Pe,75:Je,76:Ce,77:Ve,78:Re,79:qe,80:et,82:Ze,91:tt,93:Ke},v(it,[2,5])],defaultActions:{3:[2,1],97:[2,84],98:[2,85],99:[2,86]},parseError:function(qt,Yt){if(Yt.recoverable)this.trace(qt);else{var or=new Error(qt);throw or.hash=Yt,or}},parse:function(qt){var Yt=this,or=[0],hr=[null],sr=[],nr=this.table,gt="",Nt=0,Qt=0,ar=2,vr=1,xr=sr.slice.call(arguments,1
126),Er=Object.create(this.lexer),ti={yy:{}};for(var Ui in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ui)&&(ti.yy[Ui]=this.yy[Ui]);Er.setInput(qt,ti.yy),ti.yy.lexer=Er,ti.yy.parser=this,typeof Er.yylloc>"u"&&(Er.yylloc={});var qi=Er.yylloc;sr.push(qi);var Dn=Er.options&&Er.options.ranges;typeof ti.yy.parseError=="function"?this.parseError=ti.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var mn=function(){var $i;return $i=Er.lex()||vr,typeof $i!="number"&&($i=Yt.symbols_[$i]||$i),$i},kr,Zr,Fr,xi,Ai={},hi,Ur,Ri,Mi;;){if(Zr=or[or.length-1],this.defaultActions[Zr]?Fr=this.defaultActions[Zr]:((kr===null||typeof kr>"u")&&(kr=mn()),Fr=nr[Zr]&&nr[Zr][kr]),typeof Fr>"u"||!Fr.length||!Fr[0]){var gn="";Mi=[];for(hi in nr[Zr])this.terminals_[hi]&&hi>ar&&Mi.push("'"+this.terminals_[hi]+"'");Er.showPosition?gn="Parse error on line "+(Nt+1)+`:
127`+Er.showPosition()+`
128Expecting `+Mi.join(", ")+", got '"+(this.terminals_[kr]||kr)+"'":gn="Parse error on line "+(Nt+1)+": Unexpected "+(kr==vr?"end of input":"'"+(this.terminals_[kr]||kr)+"'"),this.parseError(gn,{text:Er.match,token:this.terminals_[kr]||kr,line:Er.yylineno,loc:qi,expected:Mi})}if(Fr[0]instanceof Array&&Fr.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Zr+", token: "+kr);switch(Fr[0]){case 1:or.push(kr),hr.push(Er.yytext),sr.push(Er.yylloc),or.push(Fr[1]),kr=null,Qt=Er.yyleng,gt=Er.yytext,Nt=Er.yylineno,qi=Er.yylloc;break;case 2:if(Ur=this.productions_[Fr[1]][1],Ai.$=hr[hr.length-Ur],Ai._$={first_line:sr[sr.length-(Ur||1)].first_line,last_line:sr[sr.length-1].last_line,first_column:sr[sr.length-(Ur||1)].first_column,last_column:sr[sr.length-1].last_column},Dn&&(Ai._$.range=[sr[sr.length-(Ur||1)].range[0],sr[sr.length-1].range[1]]),xi=this.performAction.apply(Ai,[gt,Qt,Nt,ti.yy,Fr[1],hr,sr].concat(xr)),typeof xi<"u")return xi;Ur&&(or=or.slice(0,-1*Ur*2),hr=hr.slice(0,-1*Ur),sr=sr.slice(0,-1*Ur)),or.push(this.productions_[Fr[1]][0]),hr.push(Ai.$),sr.push(Ai._$),Ri=nr[or[or.length-2]][or[or.length-1]],or.push(Ri);break;case 3:return!0}}return!0}},Rt={node:function(Wt,qt,Yt){return{type:Wt,value:qt,children:Yt}},createNode:function(Wt,qt,Yt,or){var hr,sr=this.node(qt,Yt,[]);for(hr=3;hr<arguments.length;hr++)sr.children.push(arguments[hr]);return sr.line=Wt[0],sr.col=Wt[1],sr.eline=Wt[2],sr.ecol=Wt[3],sr}},Ft=function(Wt){return[Wt.first_line,Wt.first_column,Wt.last_line,Wt.last_column]},Ut=function(){var Wt={EOF:1,parseError:function(Yt,or){if(this.yy.parser)this.yy.parser.parseError(Yt,or);else throw new Error(Yt)},setInput:function(qt,Yt){return this.yy=Yt||this.yy||{},this._input=qt,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var qt=this._input[0];this.yytext+=qt,this.yyleng++,this.offset++,this.match+=qt,this.matched+=qt;var Yt=qt.match(/(?:\r\n?|\n).*/g);return Yt?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),qt},unput:function(qt){var Yt=qt.length,or=qt.split(/(?:\r\n?|\n)/g);this._input=qt+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Yt),this.offset-=Yt;var hr=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),or.length-1&&(this.yylineno-=or.length-1);var sr=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:or?(or.length===hr.length?this.yylloc.first_column:0)+hr[hr.length-or.length].length-or[0].length:this.yylloc.first_column-Yt},this.options.ranges&&(this.yylloc.range=[sr[0],sr[0]+this.yyleng-Yt]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
129`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(qt){this.unput(this.match.slice(qt))},pastInput:function(){var qt=this.matched.substr(0,this.matched.length-this.match.length);return(qt.length>20?"...":"")+qt.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var qt=this.match;return qt.length<20&&(qt+=this._input.substr(0,20-qt.length)),(qt.substr(0,20)+(qt.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var qt=this.pastInput(),Yt=new Array(qt.length+1).join("-");return qt+this.upcomingInput()+`
130`+Yt+"^"},test_match:function(qt,Yt){var or,hr,sr;if(this.options.backtrack_lexer&&(sr={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(sr.yylloc.range=this.yylloc.range.slice(0))),hr=qt[0].match(/(?:\r\n?|\n).*/g),hr&&(this.yylineno+=hr.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:hr?hr[hr.length-1].length-hr[hr.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+qt[0].length},this.yytext+=qt[0],this.match+=qt[0],this.matches=qt,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(qt[0].length),this.matched+=qt[0],or=this.performAction.call(this,this.yy,this,Yt,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),or)return or;if(this._backtrack){for(var nr in sr)this[nr]=sr[nr];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var qt,Yt,or,hr;this._more||(this.yytext="",this.match="");for(var sr=this._currentRules(),nr=0;nr<sr.length;nr++)if(or=this._input.match(this.rules[sr[nr]]),or&&(!Yt||or[0].length>Yt[0].length)){if(Yt=or,hr=nr,this.options.backtrack_lexer){if(qt=this.test_match(or,sr[nr]),qt!==!1)return qt;if(this._backtrack){Yt=!1;continue}else return!1}else if(!this.options.flex)break}return Yt?(qt=this.test_match(Yt,sr[hr]),qt!==!1?qt:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
131`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var Yt=this.next();return Yt||this.lex()},begin:function(Yt){this.conditionStack.push(Yt)},popState:function(){var Yt=this.conditionStack.length-1;return Yt>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(Yt){return Yt=this.conditionStack.length-1-Math.abs(Yt||0),Yt>=0?this.conditionStack[Yt]:"INITIAL"},pushState:function(Yt){this.begin(Yt)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(Yt,or,hr,sr){switch(hr){case 0:break;case 1:return 78;case 2:return 78;case 3:return 78;case 4:return 77;case 5:return 77;case 6:break;case 7:break;case 8:return 7;case 9:return 12;case 10:return 14;case 11:return 17;case 12:return 15;case 13:return 91;case 14:return 93;case 15:return 19;case 16:return 23;case 17:return 21;case 18:return 75;case 19:return 76;case 20:return 74;case 21:return 80;case 22:return 94;case 23:return 94;case 24:return 82;case 25:return 83;case 26:return 26;case 27:return 27;case 28:return 16;case 29:return"#";case 30:return 34;case 31:return 35;case 32:return 79;case 33:return 64;case 34:return 65;case 35:return 66;case 36:return 8;case 37:return 10;case 38:return 58;case 39:return 57;case 40:return 57;case 41:return 53;case 42:return 54;case 43:return 55;case 44:return 50;case 45:return 51;case 46:return 47;case 47:return 45;case 48:return 48;case 49:return 46;case 50:return 41;case 51:return 43;case 52:return 42;case 53:return 39;case 54:return 37;case 55:return 32;case 56:return 86;case 57:return 5;case 58:return 20;case 59:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]*\.?[0-9]+([eE][-+]?[0-9]+))/,/^(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+\b)/,/^(?:[0-9]+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:\/\/.*)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:if\b)/,/^(?:else\b)/,/^(?:while\b)/,/^(?:do\b)/,/^(?:for\b)/,/^(?:function\b)/,/^(?:map\b)/,/^(?:use\b)/,/^(?:return\b)/,/^(?:delete\b)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:Infinity\b)/,/^(?:->)/,/^(?:=>)/,/^(?:<<)/,/^(?:>>)/,/^(?:\{)/,/^(?:\})/,/^(?:;)/,/^(?:#)/,/^(?:\?)/,/^(?::)/,/^(?:NaN\b)/,/^(?:\.)/,/^(?:\[)/,/^(?:\])/,/^(?:\()/,/^(?:\))/,/^(?:!)/,/^(?:\^)/,/^(?:\*\*)/,/^(?:\*)/,/^(?:\/)/,/^(?:%)/,/^(?:\+)/,/^(?:-)/,/^(?:<=)/,/^(?:<)/,/^(?:>=)/,/^(?:>)/,/^(?:==)/,/^(?:~=)/,/^(?:!=)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:=)/,/^(?:,)/,/^(?:$)/,/^(?:[A-Za-z_\$][A-Za-z0-9_]*)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],inclusive:!0}}};return Wt}();Tt.lexer=Ut;function Zt(){this.yy={}}return Zt.prototype=Tt,Tt.Parser=Zt,new Zt}();parser.yy.parseError=parser.parseError;const JessieCode=JXG$1.JessieCode;JXG$1.Composition=function(v){var N,G=this,z=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],q=function(Y){return function(){var W;for(W in G.elements)G.elements.hasOwnProperty(W)&&JXG$1.exists(G.elements[W][Y])&&G.elements[W][Y].apply(G.elements[W],arguments);return G}};for(N=0;N<z.length;N++)this[z[N]]=q(z[N]);this.elements={},this.objects=this.elements,this.elementsByName={},this.objectsList=[],this.groups={},this.methodMap={setAttribute:"setAttribute",setProperty:"setAttribute",setParents:"setParents",add:"add",remove:"remove",select:"select"};for(N in v)v.hasOwnProperty(N)&&this.add(N,v[N]);this.dump=!0,this.subs={}};JXG$1.extend(JXG$1.Composition.prototype,{add:function(v,N){return!JXG$1.exists(this[v])&&JXG$1.exists(N)?(JXG$1.exists(N.id)?this.elements[N.id]=N:this.elements[v]=N,JXG$1.exists(N.name)&&(this.elementsByName[N.name]=N),N.on("attribute:name",this.nameListener,this),this.objectsList.push(N),this[v]=N,this.methodMap[v]=N,!0):!1},remove:function(v){var N=!1,G;for(G in this.elements)if(this.elements.hasOwnProperty(G)&&this.elements[G].id===this[v].id){N=!0;break}return N&&(delete this.elements[this[v].id],delete this[v]),N},nameListener:function(v,N,G){delete this.elementsByName[v],this.elementsByName[N]=G},select:function(v){return JXG$1.exists(JXG$1.Board)?JXG$1.Board.prototype.select.call(this,v):new JXG$1.Composition},getParents:function(){return this.parents},getType:function(){return this.elType},getAttributes:function(){var v;
131for(v in this.subs)this.subs.hasOwnProperty(v)&&this.subs[v].visProp;return this.attr}});const Composition=JXG$1.Composition;JXG$1.Board=function(v,N,G,z,q,Y,W,ie,ne,se,ae){if(this.BOARD_MODE_NONE=0,this.BOARD_MODE_DRAG=1,this.BOARD_MODE_MOVE_ORIGIN=2,this.BOARD_MODE_ZOOM=17,this.BOARD_QUALITY_LOW=1,this.BOARD_QUALITY_HIGH=2,JXG$1.exists(ae.document)&&ae.document!==!1?this.document=ae.document:JXG$1.isBrowser&&(this.document=document),this.container="",this.id="",this.containerObj=null,JXG$1.isString(v)?(this.container=v,this.containerObj=JXG$1.isBrowser?this.document.getElementById(this.container):null):JXG$1.isBrowser&&(this.containerObj=v,this.container=this.containerObj.getAttribute("id"),this.container===null&&(this.container="null"+parseInt(Math.random()*16777216).toString())),JXG$1.isBrowser&&N.type!=="no"&&this.containerObj===null)throw new Error(`
132JSXGraph: HTML container element "`+v+'" not found.');JXG$1.exists(G)&&G!==""&&JXG$1.isBrowser&&!JXG$1.exists(this.document.getElementById(G))?this.id=G:this.id=this.generateId(),this.renderer=N,this.grids=[],this.options=JXG$1.deepCopy(Options),this.attr=ae,this.attr.theme!=="default"&&JXG$1.exists(JXG$1.themes[this.attr.theme])&&JXG$1.mergeAttr(this.options,JXG$1.themes[this.attr.theme],!0),this.dimension=2,this.jc=new JessieCode,this.jc.use(this),this.origin={},this.origin.usrCoords=[1,0,0],this.origin.scrCoords=[1,z[0],z[1]],this.zoomX=q,this.zoomY=Y,this.unitX=W*this.zoomX,this.unitY=ie*this.zoomY,this.keepaspectratio=!1,this.canvasWidth=ne,this.canvasHeight=se,EventEmitter.eventify(this),this.hooks=[],this.dependentBoards=[],this.inUpdate=!1,this.objects={},this.objectsList=[],this.groups={},this.animationObjects={},this.highlightedObjects={},this.numObjects=0,this.elementsByName={},this.mode=this.BOARD_MODE_NONE,this.updateQuality=this.BOARD_QUALITY_HIGH,this.isSuspendedRedraw=!1,this.calculateSnapSizes(),this.drag_dx=0,this.drag_dy=0,this.drag_position=[0,0],this.mouse={},this.touches=[],this.xmlString="",this.cPos=[],this.touchMoveLast=0,this.touchMoveLastId=1/0,this.positionAccessLast=0,this.downObjects=[],this.clickObjects={},this.focusObjects=[],this.attr.showcopyright&&this.renderer.displayCopyright(Const.licenseText,parseInt(this.options.text.fontSize,10)),this.needsFullUpdate=!1,this.reducedUpdate=!1,this.currentCBDef="none",this.geonextCompatibilityMode=!1,this.options.text.useASCIIMathML&&translateASCIIMath?init():this.options.text.useASCIIMathML=!1,this.hasMouseHandlers=!1,this.hasTouchHandlers=!1,this.hasPointerHandlers=!1,this.hasWheelHandlers=!1,this.hasMouseUp=!1,this.hasTouchEnd=!1,this.hasPointerUp=!1,this.resizeHandlers=[],this._drag_offset=[0,0],this._inputDevice="mouse",this._board_touches=[],this.selectingMode=!1,this.isSelecting=!1,this._isScrolling=!1,this._isResizing=!1,this._change3DView=!1,this.selectingBox=[[0,0],[0,0]],this.userLog=[],this.mathLib=Math,this.mathLibJXG=JXG$1.Math,this.attr.registerevents===!0?this.attr.registerevents={fullscreen:!0,keyboard:!0,pointer:!0,resize:!0,wheel:!0}:typeof this.attr.registerevents=="object"&&(JXG$1.exists(this.attr.registerevents.fullscreen)||(this.attr.registerevents.fullscreen=!0),JXG$1.exists(this.attr.registerevents.keyboard)||(this.attr.registerevents.keyboard=!0),JXG$1.exists(this.attr.registerevents.pointer)||(this.attr.registerevents.pointer=!0),JXG$1.exists(this.attr.registerevents.resize)||(this.attr.registerevents.resize=!0),JXG$1.exists(this.attr.registerevents.wheel)||(this.attr.registerevents.wheel=!0)),this.attr.registerevents!==!1&&(this.attr.registerevents.fullscreen&&this.addFullscreenEventHandlers(),this.attr.registerevents.keyboard&&this.addKeyboardEventHandlers(),this.attr.registerevents.pointer&&this.addEventHandlers(),this.attr.registerevents.resize&&this.addResizeEventHandlers(),this.attr.registerevents.wheel&&this.addWheelEventHandlers()),this.methodMap={update:"update",fullUpdate:"fullUpdate",on:"on",off:"off",trigger:"trigger",setAttribute:"setAttribute",setBoundingBox:"setBoundingBox",setView:"setBoundingBox",getBoundingBox:"getBoundingBox",BoundingBox:"getBoundingBox",getView:"getBoundingBox",View:"getBoundingBox",migratePoint:"migratePoint",colorblind:"emulateColorblindness",suspendUpdate:"suspendUpdate",unsuspendUpdate:"unsuspendUpdate",clearTraces:"clearTraces",left:"clickLeftArrow",right:"clickRightArrow",up:"clickUpArrow",down:"clickDownArrow",zoomIn:"zoomIn",zoomOut:"zoomOut",zoom100:"zoom100",zoomElements:"zoomElements",remove:"removeObject",removeObject:"removeObject"}};JXG$1.extend(JXG$1.Board.prototype,{generateName:function(v){var N,G,z=this.attr.maxnamelength,q="",Y="",W=[],ie="";if(v.type===Const.OBJECT_TYPE_TICKS)return"";for(JXG$1.isPoint(v)||JXG$1.isPoint3D(v)?N=["","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]:v.type===Const.OBJECT_TYPE_ANGLE?N=["","&alpha;","&beta;","&gamma;","&delta;","&epsilon;","&zeta;","&eta;","&theta;","&iota;","&kappa;","&lambda;","&mu;","&nu;","&xi;","&omicron;","&pi;","&rho;","&sigma;","&tau;","&upsilon;","&phi;","&chi;","&psi;","&omega;"]:N=["","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],!JXG$1.isPoint(v)&&!JXG$1.isPoint3D(v)&&v.elementClass!==Const.OBJECT_CLASS_LINE&&v.type!==Const.OBJECT_TYPE_ANGLE&&(v.type===Const.OBJECT_TYPE_POLYGON?q="P_{":v.elementClass===Const.OBJECT_CLASS_CIRCLE?q="k_{":v.elementClass===Const.OBJECT_CLASS_TEXT?q="t_{":q="s_{",Y="}"),G=0;G<z;G++)W[G]=0;for(;W[z-1]<N.length;){for(W[0]=1;W[0]<N.length;W[0]++){for(ie=q,G=z;G>0;G--)ie+=N[W[G-1]];if(!JXG$1.exists(this.elementsByName[ie+Y]))return ie+Y}for(W[0]=N.length,G=1;G<z;G++)W[G-1]===N.length&&(W[G-1]=1,W[G]+=1)}return""},generateId:function(){for(var v=1;JXG$1.exists(JXG$1.boards["jxgBoard"+v]);
132)v=Math.round(Math.random()*16777216);return"jxgBoard"+v},setId:function(v,N){var G,z=this.numObjects,q=v.id;if(this.numObjects+=1,q===""||!JXG$1.exists(q))for(q=this.id+N+z;JXG$1.exists(this.objects[q]);)G=Math.round(Math.random()*65535),q=this.id+N+z+"-"+G;return v.id=q,this.objects[q]=v,v._pos=this.objectsList.length,this.objectsList[this.objectsList.length]=v,q},finalizeAdding:function(v){v.evalVisProp("visible")===!1&&this.renderer.display(v,!1)},finalizeLabel:function(v){v.hasLabel&&!v.label.evalVisProp("islabel")&&v.label.evalVisProp("visible")===!1&&this.renderer.display(v.label,!1)},checkFrameRate:function(v){var N=!1,G=new Date().getTime();return JXG$1.exists(v.pointerId)&&this.touchMoveLastId!==v.pointerId&&(N=!0,this.touchMoveLastId=v.pointerId),!N&&(G-this.touchMoveLast)*this.attr.maxframerate>=1e3&&(N=!0),N&&(this.touchMoveLast=G),N},getCoordsTopLeftCorner:function(){var v,N,G,z=this.document.ownerDocument||this.document,q=z.documentElement||this.document.body.parentNode,Y=z.body,W=this.containerObj,ie,ne;if(this.cPos.length>0&&(this.mode===this.BOARD_MODE_DRAG||this.mode===this.BOARD_MODE_MOVE_ORIGIN||new Date().getTime()-this.positionAccessLast<1e3))return this.cPos;if(this.positionAccessLast=new Date().getTime(),W.getBoundingClientRect){for(G=W.getBoundingClientRect(),ie=1,ne=W;ne&&JXG$1.exists(ne.parentNode);)JXG$1.exists(ne.style)&&JXG$1.exists(ne.style.zoom)&&ne.style.zoom!==""&&(ie*=parseFloat(ne.style.zoom)),ne=ne.parentNode;return v=[G.left*ie,G.top*ie],v[0]+=JXG$1.getProp(W,"border-left-width"),v[1]+=JXG$1.getProp(W,"border-top-width"),this.renderer.type!=="vml"&&(v[0]+=JXG$1.getProp(W,"padding-left"),v[1]+=JXG$1.getProp(W,"padding-top")),this.cPos=v.slice(),this.cPos}return v=JXG$1.getOffset(W),N=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&N.defaultView&&(v[0]+=JXG$1.getProp(q,"margin-left"),v[1]+=JXG$1.getProp(q,"margin-top"),v[0]+=JXG$1.getProp(q,"border-left-width"),v[1]+=JXG$1.getProp(q,"border-top-width"),v[0]+=JXG$1.getProp(q,"padding-left"),v[1]+=JXG$1.getProp(q,"padding-top")),Y&&(v[0]+=JXG$1.getProp(Y,"left"),v[1]+=JXG$1.getProp(Y,"top")),typeof google=="object"&&google.translate&&(v[0]+=10,v[1]+=25),v[0]+=JXG$1.getProp(W,"border-left-width"),v[1]+=JXG$1.getProp(W,"border-top-width"),this.renderer.type!=="vml"&&(v[0]+=JXG$1.getProp(W,"padding-left"),v[1]+=JXG$1.getProp(W,"padding-top")),v[0]+=this.attr.offsetx,v[1]+=this.attr.offsety,this.cPos=v.slice(),this.cPos},getPointLoc:function(v,N){var G,z,q,Y;return G=this.getBoundingBox(),z=v,z.length===2&&z.unshift(void 0),q=[0,0],Y=N||0,JXG$1.isNumber(Y)&&(Y=[Y,Y,Y,Y]),z[1]>G[2]-Y[1]&&(q[0]=1),z[1]<G[0]+Y[3]&&(q[0]=-1),z[2]>G[1]-Y[0]&&(q[1]=1),z[2]<G[3]+Y[2]&&(q[1]=-1),q},getLocationOrigin:function(v){return this.getPointLoc([0,0],v)},getMousePosition:function(v,N){var G=this.getCoordsTopLeftCorner(),z,q;return z=JXG$1.getPosition(v,N,this.document),this.updateCSSTransforms(),q=[1,z[0]-G[0],z[1]-G[1]],q=Mat.matVecMult(this.cssTransMat,q),q[1]/=q[0],q[2]/=q[0],[q[1],q[2]]},initMoveOrigin:function(v,N){this.drag_dx=v-this.origin.scrCoords[1],this.drag_dy=N-this.origin.scrCoords[2],this.mode=this.BOARD_MODE_MOVE_ORIGIN,this.updateQuality=this.BOARD_QUALITY_LOW},initMoveObject:function(v,N,G,z){var q,Y,W=[],ie=[],ne,se=this.objectsList.length,ae={visProp:{layer:-1e4}};for(this._shiftKey=G.shiftKey,this._ctrlKey=G.ctrlKey,Y=0;Y<se;Y++)q=this.objectsList[Y],ne=q.hasPoint&&q.hasPoint(v,N),q.visPropCalc.visible&&ne&&(q.triggerEventHandlers([z+"down","down"],[G]),this.downObjects.push(q)),ne&&q.isDraggable&&q.visPropCalc.visible&&(this.geonextCompatibilityMode&&(JXG$1.isPoint(q)||q.elementClass===Const.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!q.evalVisProp("fixed")&&(q.visProp.layer>ae.visProp.layer||q.visProp.layer===ae.visProp.layer&&q.lastDragTime.getTime()>=ae.lastDragTime.getTime())&&(!this.attr.ignorelabels||!JXG$1.exists(ae.label)||q!==ae.label)&&(ae=q,W.push(ae),JXG$1.exists(ae.coords)?ae.elementClass===Const.OBJECT_CLASS_POINT||ae.relativeCoords?ie.push(Stat.subtract(ae.coords.scrCoords.slice(1),[v,N])):ie.push(Stat.subtract(ae.actualCoords.scrCoords.slice(1),[v,N])):ie.push([0,0]));return this.attr.drag.enabled&&W.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(W.length=1,this._drag_offset=ie[0]):(W=W.slice(-1),this._drag_offset=ie[ie.length-1]),this._drag_offset||(this._drag_offset=[0,0]),this.renderer.type==="svg"&&JXG$1.exists(W[0])&&W[0].evalVisProp("dragtotopoflayer")&&W.length===1&&JXG$1.exists(W[0].rendNode)&&W[0].rendNode.parentNode.appendChild(W[0].rendNode),W.length>=1&&(W[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[G,W[0]])),W},moveObject:function(v,N,G,z,q){var Y=new Coords(Const.COORDS_BY_SCREEN,this.get
132ScrCoordsOfMouse(v,N),this),W,ie,ne;G&&G.obj&&(W=G.obj,W.coords&&(ie=W.coords.scrCoords.slice()),this.addLogEntry("drag",W,Y.usrCoords.slice(1)),this.drag_position=[Y.scrCoords[1],Y.scrCoords[2]],this.drag_position=Stat.add(this.drag_position,this._drag_offset),this._shiftKey=z.shiftKey,this._ctrlKey=z.ctrlKey,JXG$1.exists(W.coords)?W.setPositionDirectly(Const.COORDS_BY_SCREEN,this.drag_position,[v,N]):(this.displayInfobox(!1),isNaN(G.targets[0].Xprev+G.targets[0].Yprev)||W.setPositionDirectly(Const.COORDS_BY_SCREEN,[Y.scrCoords[1],Y.scrCoords[2]],[G.targets[0].Xprev,G.targets[0].Yprev]),G.targets[0].Xprev=Y.scrCoords[1],G.targets[0].Yprev=Y.scrCoords[2]),JXG$1.exists(W.coords)&&(W.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(W),W.prepareUpdate().update(!0).updateRenderer()),W.coords&&(ne=W.coords.scrCoords),(!W.coords||ie[1]!==ne[1]||ie[2]!==ne[2])&&(W.triggerEventHandlers([q+"drag","drag"],[z]),this.update(W)),W.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[z,W]),W.lastDragTime=new Date)},twoFingerMove:function(v,N,G){var z;if(JXG$1.exists(v)&&JXG$1.exists(v.obj))z=v.obj;else return;z.elementClass===Const.OBJECT_CLASS_LINE||z.type===Const.OBJECT_TYPE_POLYGON?this.twoFingerTouchObject(v.targets,z,N):z.elementClass===Const.OBJECT_CLASS_CIRCLE&&this.twoFingerTouchCircle(v.targets,z,N),G&&z.triggerEventHandlers(["touchdrag","drag"],[G])},getTwoFingerTransform(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe;return q=new Coords(Const.COORDS_BY_SCREEN,[v.Xprev,v.Yprev],this).usrCoords,Y=q[1],W=q[2],q=new Coords(Const.COORDS_BY_SCREEN,[N.Xprev,N.Yprev],this).usrCoords,ie=q[1],ne=q[2],q=new Coords(Const.COORDS_BY_SCREEN,[v.X,v.Y],this).usrCoords,ce=q[1],pe=q[2],q=new Coords(Const.COORDS_BY_SCREEN,[N.X,N.Y],this).usrCoords,ge=q[1],ve=q[2],se=ie-Y,ae=ne-W,be=ge-ce,Ee=ve-pe,Ce=se*se+ae*ae,Pe=(be*se+Ee*ae)/Ce,Je=(Ee*se-be*ae)/Ce,G||(qe=Mat.hypot(Pe,Je),Pe/=qe,Je/=qe),z||(Je=0),Ve=.5*(ce+ge-Pe*(Y+ie)+Je*(W+ne)),Re=.5*(pe+ve-Je*(Y+ie)-Pe*(W+ne)),[1,0,0,Ve,Pe,-Je,Re,Je,Pe]},twoFingerTouchObject:function(v,N,G){var z,q,Y,W,ie,ne=!1;if(JXG$1.exists(v[0])&&JXG$1.exists(v[1])&&!isNaN(v[0].Xprev+v[0].Yprev+v[1].Xprev+v[1].Yprev)){if(q=this.getTwoFingerTransform(v[0],v[1],N.evalVisProp("scalable"),N.evalVisProp("rotatable")),z=this.create("transform",q,{type:"generic"}),z.update(),N.elementClass===Const.OBJECT_CLASS_LINE)Y=[],N.point1.draggable()&&Y.push(N.point1),N.point2.draggable()&&Y.push(N.point2),z.applyOnce(Y);else if(N.type===Const.OBJECT_TYPE_POLYGON){for(ie=N.vertices.length-1,ne=N.evalVisProp("snaptogrid")||N.evalVisProp("snaptopoints"),W=0;W<ie&&!ne;++W)ne=ne||N.vertices[W].evalVisProp("snaptogrid")||N.vertices[W].evalVisProp("snaptopoints"),ne=ne||!N.vertices[W].draggable();if(!ne){for(Y=[],W=0;W<ie;++W)N.vertices[W].draggable()&&Y.push(N.vertices[W]);z.applyOnce(Y)}}this.update(),N.highlight(!0)}},twoFingerTouchCircle:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge;N.method==="pointCircle"||N.method==="pointLine"||JXG$1.exists(v[0])&&JXG$1.exists(v[1])&&!isNaN(v[0].Xprev+v[0].Yprev+v[1].Xprev+v[1].Yprev)&&(G===v[0].num?(z=v[1],q=v[0]):(z=v[0],q=v[1]),ie=new Coords(Const.COORDS_BY_SCREEN,[z.Xprev,z.Yprev],this).usrCoords,W=new Coords(Const.COORDS_BY_SCREEN,[q.Xprev,q.Yprev],this).usrCoords,Y=new Coords(Const.COORDS_BY_SCREEN,[q.X,q.Y],this).usrCoords,se=Geometry.rad(W.slice(1),ie.slice(1),Y.slice(1)),ae=this.create("transform",[-ie[1],-ie[2]],{type:"translate"}),ce=this.create("transform",[se],{type:"rotate"}),ae.melt(ce),N.evalVisProp("scalable")&&(ne=Geometry.distance(ie,Y)/Geometry.distance(ie,W),pe=this.create("transform",[ne,ne],{type:"scale"}),ae.melt(pe)),ge=this.create("transform",[ie[1],ie[2]],{type:"translate"}),ae.melt(ge),N.center.draggable()&&ae.applyOnce([N.center]),N.method==="twoPoints"?N.point2.draggable()&&ae.applyOnce([N.point2]):N.method==="pointRadius"&&JXG$1.isNumber(N.updateRadius.origin)&&N.setRadius(N.radius*ne),this.update(N.center),N.highlight(!0))},highlightElements:function(v,N,G,z){var q,Y,W,ie={},ne=this.objectsList.length;for(q=0;q<ne;q++)Y=this.objectsList[q],W=Y.id,JXG$1.exists(Y.hasPoint)&&Y.visPropCalc.visible&&Y.hasPoint(v,N)&&(this.updateInfobox(Y),JXG$1.exists(this.highlightedObjects[W])||(ie[W]=Y,Y.highlight(),this.triggerEventHandlers(["mousehit","hit"],[G,Y,z])),Y.mouseover?Y.triggerEventHandlers(["mousemove","move"],[G]):(Y.triggerEventHandlers(["mouseover","over"],[G]),Y.mouseover=!0));for(q=0;q<ne;q++)Y=this.objectsList[q],W=Y.id,Y.mouseover&&(ie[W]||(Y.triggerEventHandlers(["mouseout","out"],[G]),Y.mouseover=!1))},saveStartPos:function(v,N){var G=[],z,q;if(v.type===Const.OBJECT_TYPE_TICKS)G.push([1,NaN,NaN]);else if(v.elementClass===Const.OBJECT_CLASS_LINE)G.push(v.point1.coords.usrCoords),G.push(v.point2.coords.usrCoords);else if(v.elementClass===Const.OBJECT_CLASS_CIRCLE)G.push(v.center.coords.usrCoords),v.method==="twoPoints"&&G.push(v.point2.coords.usrCoords);else if(v.type===Const.OBJECT_TYPE_POLYGON)for(q=v.vertices.length-1,z=0;z<q;z++)G.push(v.vertices[z].coords.usrCoords);else if(v.type===Const.OBJECT_TYPE_SECTOR)G.push(v.point1.coords.usrCoords),G.push(v.point2.coords.usrCoords),G.push(v.point3.coords.usrCoords);else if(JXG$1.isPoint(v)||v.type===Const.OBJECT_TYPE_GLIDER)G.push(v.coords.usrCoords);else if(v.elementClass===Const.OBJECT_CLASS_CURVE)v.points.length>0&&G.push(v.points[0].usrCoords);else try{G.push(v.coords.usrCoords)}catch(Y){JXG$1.debug("JSXGraph+ saveStartPos: obj.coords.usrCoords not available: "+Y)}for(q=G.length,z=0;z<q;z++)N.Zstart.push(G[z][0]),N.Xstart.push(G[z][1]),N.Ystart.push(G[z][2])},mouseOriginMoveStart:function(v){var N,G;return N=this._isRequiredKeyPressed(v,"pan"),N&&(G=this.getMousePosition(v),this.initMoveOrigin(G[0],G[1])),N},mouseOriginMove:function(v){var N=this.mode===this.BOARD_MODE_MOVE_ORIGIN,G;return N&&(G=this.getMousePosition(v),this.moveOrigin(G[0],G[1],!0)),N},touchStartMoveOriginOneFinger:function(v){var N=v.touches,G,z;return G=this.attr.pan.enabled&&!this.attr.pan.needtwofingers&&N.length===1,G&&(z=this.getMousePosition(v,0),this.initMoveOrigin(z[0],z[1])),G},touchOriginMove:function(v){var N=this.mode===this.BOARD_MODE_MOVE_ORIGIN,G;return N&&(G=this.getMousePosition(v,0),this.moveOrigin(G[0],G[1],!0)),N},originMoveEnd:function(){this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE},suppressDefault:function(v){return JXG$1.exists(v)&&v.preventDefault(),!1},addEventHandlers:function(){JXG$1.supportsPointerEvents()?this.addPointerEventHandlers():(this.addMouseEventHandlers(),this.addTouchEventHandlers()),this.containerObj!==null&&JXG$1.addEvent(this.containerObj,"contextmenu",this.suppressDefault,this)},removeEventHandlers:function(){(this.hasPointerHandlers||this.hasMouseHandlers||this.hasTouchHandlers)&&this.containerObj!==null&&JXG$1.removeEvent(this.containerObj,"contextmenu",this.suppressDefault,this),this.removeMouseEventHandlers(),this.removeTouchEventHandlers(),this.removePointerEventHandlers(),this.removeFullscreenEventHandlers(),this.removeKeyboardEventHandlers(),this.removeResizeEventHandlers()},addResizeEventHandlers:function(){if(this.resizeHandlers=[],JXG$1.isBrowser){try{this.startResizeObserver(),this.resizeHandlers.push("resizeobserver")}catch{JXG$1.addEvent(window,"resize",this.resizeListener,this),this.startIntersectionObserver(),this.resizeHandlers.push("resize")}JXG$1.addEvent(window,"scroll",this.scrollListener,this),this.resizeHandlers.push("scroll");try{window.matchMedia("print").addEventListener("change",this.printListenerMatch.bind(this)),window.matchMedia("screen").addEventListener("change",this.printListenerMatch.bind(this)),this.resizeHandlers.push("print")}catch(v){JXG$1.debug("Error adding printListener",v)}}},removeResizeEventHandlers:function(){var v,N;if(this.resizeHandlers.length>0&&JXG$1.isBrowser){for(v=0;v<this.resizeHandlers.length;v++)switch(N=this.resizeHandlers[v],N){case"resizeobserver":JXG$1.exists(this.resizeObserver)&&this.stopResizeObserver();break;case"resize":JXG$1.removeEvent(window,"resize",this.resizeListener,this),JXG$1.exists(this.intersectionObserver)&&this.stopIntersectionObserver();break;case"scroll":JXG$1.removeEvent(window,"scroll",this.scrollListener,this);break;case"print":window.matchMedia("print").removeEventListener("change",this.printListenerMatch.bind(this),!1),window.matchMedia("screen").removeEventListener("change",this.printListenerMatch.bind(this),!1);break}this.resizeHandlers=[]}},addPointerEventHandlers:function(){if(!this.hasPointerHandlers&&JXG$1.isBrowser){var v=this.attr.movetarget||this.containerObj;window.navigator.msPointerEnabled?(JXG$1.addEvent(this.containerObj,"MSPointerDown",this.pointerDownListener,this),JXG$1.addEvent(v,"MSPointerMove",this.pointerMoveListener,this)):(JXG$1.addEvent(this.containerObj,"pointerdown",this.pointerDownListener,this),JXG$1.addEvent(v,"pointermove",this.pointerMoveListener,this),JXG$1.addEvent(v,"pointerleave",this.pointerLeaveListener,this),JXG$1.addEvent(v,"click",this.pointerClickListener,this),JXG$1.addEvent(v,"dblclick",this.pointerDblClickListener,this)),this.containerObj!==null&&(this.containerObj.style.touchAction="none"),this.hasPointerHandlers=!0}},addMouseEventHandlers:function(){if(!this.hasMouseHandlers&&JXG$1.isBrowser){var v=this.attr.movetarget||this.containerObj;JXG$1.addEvent(this.containerObj,"mousedown",this.mouseDownListener,this),JXG$1.addEvent(v,"mousemove",this.mouseMoveListener,this),JXG$1.addEvent(v,"click",this.mouseClickListener,this),JXG$1.addEvent(v,"dblclick",this.mouseDblClickListener,this),this.hasMouseHandlers=!0}},addTouchEventHandlers:function(v){if(!this.hasTouchHandlers&&JXG$1.isBrowser){var N=this.attr.movetarget||this.containerObj;JXG$1.addEvent(this.containerObj,"touchstart",this.touchStartListener,this),JXG$1.addEvent(N,"touchmove",this.touchMoveListener,this),this.hasTouchHandlers=!0}},addWheelEventHandlers:function(){!this.hasWheelHandlers&&JXG$1.isBrowser&&(JXG$1.addEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),JXG$1.addEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this),this.hasWheelHandlers=!0)},addFullscreenEventHandlers:function(){var v,N=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],G=N.length;if(!this.hasFullscreenEventHandlers&&JXG$1.isBrowser){for(v=0;v<G;v++)JXG$1.addEvent(this.document,N[v],this.fullscreenListener,this);this.hasFullscreenEventHandlers=!0}},addKeyboardEventHandlers:function(){this.attr.keyboard.enabled&&!this.hasKeyboardHandlers&&JXG$1.isBrowser&&(JXG$1.addEvent(this.containerObj,"keydown",this.keyDownListener,this),JXG$1.addEvent(this.containerObj,"focusin",this.keyFocusInListener,this),JXG$1.addEvent(this.containerObj,"focusout",this.keyFocusOutListener,this),this.hasKeyboardHandlers=!0)},removeKeyboardEventHandlers:function(){this.hasKeyboardHandlers&&JXG$1.isBrowser&&(JXG$1.removeEvent(this.containerObj,"keydown",this.keyDownListener,this),JXG$1.removeEvent(this.containerObj,"focusin",this.keyFocusInListener,this),JXG$1.removeEvent(this.containerObj,"focusout",this.keyFocusOutListener,this),this.hasKeyboardHandlers=!1)},removeFullscreenEventHandlers:function(){var v,N=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],G=N.length;if(this.hasFullscreenEventHandlers&&JXG$1.isBrowser){for(v=0;v<G;v++)JXG$1.removeEvent(this.document,N[v],this.fullscreenListener,this);this.hasFullscreenEventHandlers=!1}},removePointerEventHandlers:function(){if(this.hasPointerHandlers&&JXG$1.isBrowser){var v=this.attr.movetarget||this.containerObj;window.navigator.msPointerEnabled?(JXG$1.removeEvent(this.containerObj,"MSPointerDown",this.pointerDownListener,this),JXG$1.removeEvent(v,"MSPointerMove",this.pointerMoveListener,this)):(JXG$1.removeEvent(this.containerObj,"pointerdown",this.pointerDownListener,this),JXG$1.removeEvent(v,"pointermove",this.pointerMoveListener,this),JXG$1.removeEvent(v,"pointerleave",this.pointerLeaveListener,this),JXG$1.removeEvent(v,"click",this.pointerClickListener,this),JXG$1.removeEvent(v,"dblclick",this.pointerDblClickListener,this)),this.hasWheelHandlers&&(JXG$1.removeEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),JXG$1.removeEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this)),this.hasPointerUp&&(window.navigator.msPointerEnabled?JXG$1.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(JXG$1.removeEvent(this.document,"pointerup",this.pointerUpListener,this),JXG$1.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this.hasPointerHandlers=!1}},removeMouseEventHandlers:function(){if(this.hasMouseHandlers&&JXG$1.isBrowser){var v=this.attr.movetarget||this.containerObj;JXG$1.removeEvent(this.containerObj,"mousedown",this.mouseDownListener,this),JXG$1.removeEvent(v,"mousemove",this.mouseMoveListener,this),JXG$1.removeEvent(v,"click",this.mouseClickListener,this),JXG$1.removeEvent(v,"dblclick",this.mouseDblClickListener,this),this.hasMouseUp&&(JXG$1.removeEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!1),this.hasWheelHandlers&&(JXG$1.removeEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),JXG$1.removeEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this)),this.hasMouseHandlers=!1}},removeTouchEventHandlers:function(){if(this.hasTouchHandlers&&JXG$1.isBrowser){var v=this.attr.movetarget||this.containerObj;JXG$1.removeEvent(this.containerObj,"touchstart",this.touchStartListener,this),JXG$1.removeEvent(v,"touchmove",this.touchMoveListener,this),this.hasTouchEnd&&(JXG$1.removeEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!1),this.hasTouchHandlers=!1}},clickLeftArrow:function(){return this.moveOrigin(this.origin.scrCoords[1]+this.canvasWidth*.1,this.origin.scrCoords[2]),this},clickRightArrow:function(){return this.moveOrigin(this.origin.scrCoords[1]-this.canvasWidth*.1,this.origin.scrCoords[2]),this},clickUpArrow:function(){return this.moveOrigin(this.origin.scrCoords[1],this.origin.scrCoords[2]-this.canvasHeight*.1),this},clickDownArrow:function(){return this.moveOrigin(this.origin.scrCoords[1],this.origin.scrCoords[2]+this.canvasHeight*.1),this},gestureChangeListener:function(v){var N,G=[],z=[],q,Y=10,W=!1,ie=this.attr.zoom.factorx,ne=this.attr.zoom.factory,se,ae,ce,pe,ge,ve=!1,be,Ee,Pe,Je;return this.mode!==this.BOARD_MODE_ZOOM?!0:(v.preventDefault(),ae=Geometry.distance([v.touches[0].clientX,v.touches[0].clientY],[v.touches[1].clientX,v.touches[1].clientY],2),v.scale===void 0&&(v.scale=ae/this.prevDist),!JXG$1.exists(this.prevCoords)||(G=[v.touches[0].clientX-this.prevCoords[0][0],v.touches[0].clientY-this.prevCoords[0][1]],z=[v.touches[1].clientX-this.prevCoords[1][0],v.touches[1].clientY-this.prevCoords[1][1]],G[0]*G[0]+G[1]*G[1]<Y*Y&&z[0]*z[0]+z[1]*z[1]<Y*Y)||(q=Geometry.rad(G,[0,0],z),this.isPreviousGesture!=="pan"&&Math.abs(q)>Math.PI*.2&&Math.abs(q)<Math.PI*1.8&&(W=!0),this.isPreviousGesture!=="pan"&&!W&&(Math.abs(v.scale)<.77||Math.abs(v.scale)>1.3)&&(W=!0),se=v.scale/this.prevScale,this.prevScale=v.scale,this.prevCoords=[[v.touches[0].clientX,v.touches[0].clientY],[v.touches[1].clientX,v.touches[1].clientY]],N=new Coords(Const.COORDS_BY_SCREEN,this.getMousePosition(v,0),this),this.attr.pan.enabled&&this.attr.pan.needtwofingers&&!W?(this.isPreviousGesture="pan",this.moveOrigin(N.scrCoords[1],N.scrCoords[2],!0)):this.attr.zoom.enabled&&Math.abs(se-1)<.5&&(ve=!1,ge=this.attr.zoom.center,(this.attr.zoom.pinchhorizontal||this.attr.zoom.pinchvertical)&&(be=Math.abs(v.touches[0].clientX-v.touches[1].clientX),Ee=Math.abs(v.touches[0].clientY-v.touches[1].clientY),ce=Math.abs(Math.atan2(Ee,be)),pe=Math.PI*this.attr.zoom.pinchsensitivity/90),!this.keepaspectratio&&this.attr.zoom.pinchhorizontal&&ce<pe?(this.attr.zoom.factorx=se,this.attr.zoom.factory=1,Pe=0,Je=0,ve=!0):!this.keepaspectratio&&this.attr.zoom.pinchvertical&&Math.abs(ce-Math.PI*.5)<pe?(this.attr.zoom.factorx=1,this.attr.zoom.factory=se,Pe=0,Je=0,ve=!0):this.attr.zoom.pinch&&(this.attr.zoom.factorx=se,this.attr.zoom.factory=se,Pe=N.usrCoords[1],Je=N.usrCoords[2],ve=!0),ve&&(ge==="board"?this.zoomIn():this.zoomIn(Pe,Je),this.attr.zoom.factorx=ie,this.attr.zoom.factory=ne))),!1)},gestureStartListener:function(v){var N;return v.preventDefault(),this.pre
132vScale=1,this.prevDist=Geometry.distance([v.touches[0].clientX,v.touches[0].clientY],[v.touches[1].clientX,v.touches[1].clientY],2),this.prevCoords=[[v.touches[0].clientX,v.touches[0].clientY],[v.touches[1].clientX,v.touches[1].clientY]],this.isPreviousGesture="none",N=this.getMousePosition(v,0),this.initMoveOrigin(N[0],N[1]),this.mode=this.BOARD_MODE_ZOOM,!1},_isRequiredKeyPressed:function(v,N){var G=this.attr[N];return G.enabled?!!((G.needshift&&v.shiftKey||!G.needshift&&!v.shiftKey)&&(G.needctrl&&v.ctrlKey||!G.needctrl&&!v.ctrlKey)):!1},_isPointerRegistered:function(v){var N,G=this._board_touches.length;for(N=0;N<G;N++)if(this._board_touches[N].pointerId===v.pointerId)return!0;return!1},_pointerStorePosition:function(v){var N,G;for(N=0,G=!1;N<this._board_touches.length;N++)if(this._board_touches[N].pointerId===v.pointerId){this._board_touches[N].clientX=v.clientX,this._board_touches[N].clientY=v.clientY,G=!0;break}return!G&&this._board_touches.length<2&&this._board_touches.push({pointerId:v.pointerId,clientX:v.clientX,clientY:v.clientY}),this},_pointerRemoveTouches:function(v){var N;for(N=0;N<this._board_touches.length;N++)if(this._board_touches[N].pointerId===v.pointerId){this._board_touches.splice(N,1);break}return this},_pointerClearTouches:function(v){this._board_touches.length>0&&this.dehighlightAll(),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE,this._board_touches=[],this.touches=[]},_getPointerInputDevice:function(v){if(JXG$1.isBrowser){if(v.pointerType==="touch"||window.navigator.msMaxTouchPoints&&window.navigator.msMaxTouchPoints>1)return"touch";if(v.pointerType==="mouse")return"mouse";if(v.pointerType==="pen")return"pen"}return"mouse"},pointerDownListener:function(v,N,G){var z,q,Y,W,ie,ne,se,ae="mouse",ce,pe,ge;if(!N&&this._isPointerRegistered(v))return!1;if(JXG$1.evaluate(this.attr.movetarget)===null&&JXG$1.exists(v.target)&&JXG$1.exists(v.target.releasePointerCapture)&&v.target.releasePointerCapture(v.pointerId),!N&&v.isPrimary,this.hasPointerUp||(window.navigator.msPointerEnabled?JXG$1.addEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(JXG$1.addEvent(this.document,"pointerup",this.pointerUpListener,this),JXG$1.addEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!0),this.hasMouseHandlers&&this.removeMouseEventHandlers(),this.hasTouchHandlers&&this.removeTouchEventHandlers(),this.document.selection&&JXG$1.isFunction(this.document.selection.empty))this.document.selection.empty();else if(window.getSelection&&(ne=window.getSelection(),ne.removeAllRanges))try{ne.removeAllRanges()}catch{}if(this._inputDevice=this._getPointerInputDevice(v),ae=this._inputDevice,this.options.precision.hasPoint=this.options.precision[ae],W=this.getMousePosition(v),this._testForSelection(v),this.selectingMode){this._startSelecting(W),this.triggerEventHandlers(["touchstartselecting","pointerstartselecting","startselecting"],[v]);return}if(this.attr.drag.enabled&&N?(ie=[N],this.mode=this.BOARD_MODE_DRAG):ie=this.initMoveObject(W[0],W[1],v,ae),se={num:v.pointerId,X:W[0],Y:W[1],Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},ie.length>0){for(pe=ie[ie.length-1],ce=!1,z=0;z<this.touches.length;z++)if(this.touches[z].obj===pe){q=z,Y=this.touches[z].targets.push(se)-1,ce=!0;break}ce||(Y=0,q=this.touches.push({obj:pe,targets:[se]})-1),this.dehighlightAll(),pe.highlight(!0),this.saveStartPos(pe,this.touches[q].targets[Y]),v&&v.preventDefault&&!G&&v.preventDefault()}return this.touches.length>0&&!G&&(v.preventDefault(),v.stopPropagation()),JXG$1.isBrowser?(this._getPointerInputDevice(v)!=="touch"?this.mode===this.BOARD_MODE_NONE&&this.mouseOriginMoveStart(v):(this._pointerStorePosition(v),v.touches=this._board_touches,v.touches.length===1&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(v)||v.touches.length===2&&(this.mode===this.BOARD_MODE_NONE||this.mode===this.BOARD_MODE_MOVE_ORIGIN)&&(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(v))),ge="none",this.mode===this.BOARD_MODE_NONE&&(JXG$1.evaluate(this.attr.browserpan)===!0||JXG$1.evaluate(this.attr.browserpan.enabled)===!0)&&(JXG$1.evaluate(this.attr.pan.enabled)===!1||JXG$1.evaluate(this.attr.pan.needtwofingers)===!0)&&(ge="auto"),this.containerObj.style.touchAction=ge,this.triggerEventHandlers(["touchstart","down","pointerdown","MSPointerDown"],[v]),!0):!1},_handleClicks:function(v,N){var G=this,z,q,Y;if(this.selectingMode){v.stopPropagation();return}if(q=JXG$1.evaluate(this.attr.clickdelay),Y=JXG$1.evaluate(this.attr.dblclicksuppressclick),Y)this._preventSingleClick=!1,this._singleClickTimer=setTimeout(function(){if(!G._preventSingleClick){G.triggerEventHandlers(N,[v]);for(z in G.clickObjects)G.clickObjects.hasOwnProperty(z)&&(G.clickObjects[z].triggerEventHandlers(N,[v]),delete G.clickObjects[z])}},q);else{G.triggerEventHandlers(N,[v]);for(z in G.clickObjects)G.clickObjects.hasOwnProperty(z)&&G.clickObjects[z].triggerEventHandlers(N,[v]);setTimeout(function(){for(z in G.clickObjects)G.clickObjects.hasOwnProperty(z)&&delete G.clickObjects[z]},q)}v.stopPropagation()},_handleDblClicks:function(v,N){var G;if(this.selectingMode){v.stopPropagation();return}this._preventSingleClick=!0,clearTimeout(this._singleClickTimer),this.triggerEventHandlers(N,[v]);for(G in this.clickObjects)this.clickObjects.hasOwnProperty(G)&&(this.clickObjects[G].triggerEventHandlers(N,[v]),delete this.clickObjects[G]);v.stopPropagation()},pointerClickListener:function(v){this._handleClicks(v,["click","pointerclick"])},pointerDblClickListener:function(v){this._handleDblClicks(v,["dblclick","pointerdblclick"])},mouseClickListener:function(v){this._handleClicks(v,["click","mouseclick"])},mouseDblClickListener:function(v){this._handleDblClicks(v,["dblclick","mousedblclick"])},pointerMoveListener:function(v){var N,G,z,q,Y,W="mouse";if(this._getPointerInputDevice(v)==="touch"&&!this._isPointerRegistered(v))return this.BOARD_MODE_NONE;if(!this.checkFrameRate(v))return!1;if(this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this.mode!==this.BOARD_MODE_NONE&&(v.preventDefault(),v.stopPropagation()),this.updateQuality=this.BOARD_QUALITY_LOW,this._inputDevice=this._getPointerInputDevice(v),W=this._inputDevice,this.options.precision.hasPoint=this.options.precision[W],q=this.options.precision.hasPoint*.3333,z=this.getMousePosition(v),JXG$1.evaluate(this.attr.movetarget)===null&&z[0]<=q||z[1]<=q||z[0]>=this.canvasWidth-q||z[1]>=this.canvasHeight-q)return this.mode===this.BOARD_MODE_NONE;if(this.selectingMode)this._moveSelecting(z),this.triggerEventHandlers(["touchmoveselecting","moveselecting","pointermoveselecting"],[v,this.mode]);else if(!this.mouseOriginMove(v))if(this.mode===this.BOARD_MODE_DRAG){for(N=0;N<this.touches.length;N++)for(Y=this.touches[N].targets,G=0;G<Y.length;G++)if(Y[G].num===v.pointerId){Y[G].X=z[0],Y[G].Y=z[1],Y.length===1?this.moveObject(z[0],z[1],this.touches[N],v,W):Y.length===2&&(this.twoFingerMove(this.touches[N],v.pointerId,v),Y[G].Xprev=z[0],Y[G].Yprev=z[1]);break}}else this._getPointerInputDevice(v)==="touch"&&(this._pointerStorePosition(v),this._board_touches.length===2&&(v.touches=this._board_touches,this.gestureChangeListener(v))),this.highlightElements(z[0],z[1],v,-1);return this.triggerEventHandlers(["pointermove","MSPointerMove","move"],[v,this.mode]),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},pointerUpListener:function(v){var N,G,z,q,Y,W=!1;if(this.triggerEventHandlers(["touchend","up","pointerup","MSPointerUp"],[v]),this.displayInfobox(!1),v){for(N=0;N<this.touches.length;N++)for(Y=this.touches[N].targets,G=0;G<Y.length;G++)if(Y[G].num===v.pointerId){Y.splice(G,1),Y.length===0&&this.touches.splice(N,1);break}}if(this.originMoveEnd(),this.update(),this.selectingMode)this._stopSelecting(v),this.triggerEventHandlers(["touchstopselecting","pointerstopselecting","stopselecting"],[v]),this.stopSelectionMode();else for(N=this.downObjects.length-1;N>-1;N--){for(z=!1,G=0;G<this.touches.length;G++)this.touches[G].obj.id===this.downObjects[N].id&&(z=!0);z||(this.downObjects[N].triggerEventHandlers(["touchend","up","pointerup","MSPointerUp"],[v]),JXG$1.exists(this.downObjects[N].coords)||(this.downObjects[N].snapToGri
132d(),this.downObjects[N].snapToPoints(),W=!0),q=this.downObjects[N].eventHandlers,(JXG$1.exists(q.click)&&q.click.length>0||JXG$1.exists(q.pointerclick)&&q.pointerclick.length>0||JXG$1.exists(q.dblclick)&&q.dblclick.length>0||JXG$1.exists(q.pointerdblclick)&&q.pointerdblclick.length>0)&&(this.clickObjects[this.downObjects[N].id]=this.downObjects[N]),this.downObjects.splice(N,1))}return this.hasPointerUp&&(window.navigator.msPointerEnabled?JXG$1.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(JXG$1.removeEvent(this.document,"pointerup",this.pointerUpListener,this),JXG$1.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this._pointerClearTouches(v.pointerId),this._getPointerInputDevice(v)!=="touch"&&this.dehighlightAll(),W&&this.update(),!0},pointerLeaveListener:function(v){return this.displayInfobox(!1),this.dehighlightAll(),!0},touchStartListener:function(v){var N,G,z,q,Y,W,ie=this.options.precision.touch,ne=v.touches,se,ae,ce,pe;for(this.hasTouchEnd||(JXG$1.addEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!0),this.document.selection&&JXG$1.isFunction(this.document.selection.empty)?this.document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,N=0;N<ne.length;N++)ne[N].jxg_isused=!1;for(N=0;N<this.touches.length;N++)for(pe=this.touches[N].targets,G=0;G<pe.length;G++){pe[G].num=-1,ie=this.options.precision.touch;do{for(z=0;z<ne.length;z++)if(Math.abs(Math.pow(ne[z].screenX-pe[G].X,2)+Math.pow(ne[z].screenY-pe[G].Y,2))<ie*ie){pe[G].num=z,pe[G].X=ne[z].screenX,pe[G].Y=ne[z].screenY,ne[z].jxg_isused=!0;break}ie*=2}while(pe[G].num===-1&&ie<this.options.precision.touchMax);pe[G].num===-1&&(JXG$1.debug("i couldn't find a targettouches for target no "+G+" on "+this.touches[N].obj.name+" ("+this.touches[N].obj.id+"). Removed the target."),JXG$1.debug("eps = "+ie+", touchMax = "+Options.precision.touchMax),pe.splice(N,1))}for(N=0;N<ne.length;N++)if(!ne[N].jxg_isused){if(q=this.getMousePosition(v,N),this.selectingMode)return this._startSelecting(q),this.triggerEventHandlers(["touchstartselecting","startselecting"],[v]),v.preventDefault(),v.stopPropagation(),this.options.precision.hasPoint=this.options.precision.mouse,this.touches.length>0;if(Y=this.initMoveObject(q[0],q[1],v,"touch"),Y.length!==0){if(W=Y[Y.length-1],ce={num:N,X:ne[N].screenX,Y:ne[N].screenY,Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},JXG$1.isPoint(W)||W.elementClass===Const.OBJECT_CLASS_TEXT||W.type===Const.OBJECT_TYPE_TICKS||W.type===Const.OBJECT_TYPE_IMAGE)ae=[ce],this.saveStartPos(W,ae[0]),this.touches.push({obj:W,targets:ae}),W.highlight(!0);else if(W.elementClass===Const.OBJECT_CLASS_LINE||W.elementClass===Const.OBJECT_CLASS_CIRCLE||W.elementClass===Const.OBJECT_CLASS_CURVE||W.type===Const.OBJECT_TYPE_POLYGON){for(se=!1,G=0;G<this.touches.length;G++)W.id===this.touches[G].obj.id&&(se=!0,this.touches[G].targets.length===1&&(this.saveStartPos(W,ce),this.touches[G].targets.push(ce)),ne[N].jxg_isused=!0);se||(ae=[ce],this.saveStartPos(W,ae[0]),this.touches.push({obj:W,targets:ae}),W.highlight(!0))}}ne[N].jxg_isused=!0}return this.touches.length>0&&(v.preventDefault(),v.stopPropagation()),ne.length===1&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(v)||ne.length===2&&(this.mode===this.BOARD_MODE_NONE||this.mode===this.BOARD_MODE_MOVE_ORIGIN)&&(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(v)),this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchstart","down"],[v]),!1},touchMoveListener:function(v){var N,G,z,q,Y=v.touches;if(!this.checkFrameRate(v))return!1;if(this.mode!==this.BOARD_MODE_NONE&&(v.preventDefault(),v.stopPropagation()),this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,this.updateQuality=this.BOARD_QUALITY_LOW,this.selectingMode){for(N=0;N<Y.length;N++)if(!Y[N].jxg_isused){G=this.getMousePosition(v,N),this._moveSelecting(G),this.triggerEventHandlers(["touchmoves","moveselecting"],[v,this.mode]);break}}else if(!this.touchOriginMove(v))if(this.mode===this.BOARD_MODE_DRAG){for(N=0;N<this.touches.length;N++)if(q=this.touches[N].targets,q.length===1){if(Y[q[0].num]){if(G=this.getMousePosition(v,q[0].num),G[0]<0||G[0]>this.canvasWidth||G[1]<0||G[1]>this.canvasHeight)return;q[0].X=G[0],q[0].Y=G[1],this.moveObject(G[0],G[1],this.touches[N],v,"touch")}}else if(q.length===2&&q[0].num>-1&&q[1].num>-1&&Y[q[0].num]&&Y[q[1].num]){if(G=this.getMousePosition(v,q[0].num),z=this.getMousePosition(v,q[1].num),G[0]<0||G[0]>this.canvasWidth||G[1]<0||G[1]>this.canvasHeight||z[0]<0||z[0]>this.canvasWidth||z[1]<0||z[1]>this.canvasHeight)return;q[0].X=G[0],q[0].Y=G[1],q[1].X=z[0],q[1].Y=z[1],this.twoFingerMove(this.touches[N],q[0].num,v),q[0].Xprev=G[0],q[0].Yprev=G[1],q[1].Xprev=z[0],q[1].Yprev=z[1]}}else Y.length===2&&this.gestureChangeListener(v),G=this.getMousePosition(v,0),this.highlightElements(G[0],G[1],v,-1);return this.mode!==this.BOARD_MODE_DRAG&&this.displayInfobox(!1),this.triggerEventHandlers(["touchmove","move"],[v,this.mode]),this.options.precision.hasPoint=this.options.precision.mouse,this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},touchEndListener:function(v){var N,G,z,q=this.options.precision.touch,Y=[],W,ie,ne=v&&v.touches,se,ae=!1;if(this.triggerEventHandlers(["touchend","up"],[v]),this.displayInfobox(!1),this.selectingMode)this._stopSelecting(v),this.triggerEventHandlers(["touchstopselecting","stopselecting"],[v]),this.stopSelectionMode();else if(ne&&ne.length>0){for(N=0;N<this.touches.length;N++)Y[N]=this.touches[N];for(this.touches.length=0,N=0;N<ne.length;N++)ne[N].jxg_isused=!1;for(N=0;N<Y.length;N++){for(W=!1,ie=0,se=Y[N].targets,G=0;G<se.length;G++)for(se[G].found=!1,z=0;z<ne.length;z++)if(Math.abs(Math.pow(ne[z].screenX-se[G].X,2)+Math.pow(ne[z].screenY-se[G].Y,2))<q*q){se[G].found=!0,se[G].num=z,se[G].X=ne[z].screenX,se[G].Y=ne[z].screenY,ie+=1;break}if(JXG$1.isPoint(Y[N].obj)?W=se[0]&&se[0].found:Y[N].obj.elementClass===Const.OBJECT_CLASS_LINE?W=se[0]&&se[0].found||se[1]&&se[1].found:Y[N].obj.elementClass===Const.OBJECT_CLASS_CIRCLE&&(W=ie===1||ie===3),W)for(this.touches.push({obj:Y[N].obj,targets:[]}),G=0;G<se.length;G++)se[G].found&&this.touches[this.touches.length-1].targets.push({num:se[G].num,X:se[G].screenX,Y:se[G].screenY,Xprev:NaN,Yprev:NaN,Xstart:se[G].Xstart,Ystart:se[G].Ystart,Zstart:se[G].Zstart});else Y[N].obj.noHighlight()}}else this.touches.length=0;for(N=this.downObjects.length-1;N>-1;N--){for(W=!1,G=0;G<this.touches.length;G++)this.touches[G].obj.id===this.downObjects[N].id&&(W=!0);W||(this.downObjects[N].triggerEventHandlers(["touchup","up"],[v]),JXG$1.exists(this.downObjects[N].coords)||(this.downObjects[N].snapToGri
132d(),this.downObjects[N].snapToPoints(),ae=!0),this.downObjects.splice(N,1))}return(!ne||ne.length===0)&&(this.hasTouchEnd&&(JXG$1.removeEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!1),this.dehighlightAll(),this.updateQuality=this.BOARD_QUALITY_HIGH,this.originMoveEnd(),ae&&this.update()),!0},mouseDownListener:function(v){var N,G,z;if(this.document.selection&&JXG$1.isFunction(this.document.selection.empty)?this.document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),!this.hasMouseUp)JXG$1.addEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!0;else return;if(this._inputDevice="mouse",this.options.precision.hasPoint=this.options.precision.mouse,N=this.getMousePosition(v),this._testForSelection(v),this.selectingMode){this._startSelecting(N),this.triggerEventHandlers(["mousestartselecting","startselecting"],[v]);return}return G=this.initMoveObject(N[0],N[1],v,"mouse"),G.length===0?(this.mode=this.BOARD_MODE_NONE,z=!0):(this.mouse={obj:null,targets:[{X:N[0],Y:N[1],Xprev:NaN,Yprev:NaN}]},this.mouse.obj=G[G.length-1],this.dehighlightAll(),this.mouse.obj.highlight(!0),this.mouse.targets[0].Xstart=[],this.mouse.targets[0].Ystart=[],this.mouse.targets[0].Zstart=[],this.saveStartPos(this.mouse.obj,this.mouse.targets[0]),v&&v.preventDefault?v.preventDefault():window.event&&(window.event.returnValue=!1)),this.mode===this.BOARD_MODE_NONE&&(z=this.mouseOriginMoveStart(v)),this.triggerEventHandlers(["mousedown","down"],[v]),z},mouseMoveListener:function(v){var N;if(!this.checkFrameRate(v))return!1;N=this.getMousePosition(v),this.updateQuality=this.BOARD_QUALITY_LOW,this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this.selectingMode?(this._moveSelecting(N),this.triggerEventHandlers(["mousemoveselecting","moveselecting"],[v,this.mode])):this.mouseOriginMove(v)||(this.mode===this.BOARD_MODE_DRAG?this.moveObject(N[0],N[1],this.mouse,v,"mouse"):this.highlightElements(N[0],N[1],v,-1),this.triggerEventHandlers(["mousemove","move"],[v,this.mode])),this.updateQuality=this.BOARD_QUALITY_HIGH},mouseUpListener:function(v){var N;if(this.selectingMode===!1&&this.triggerEventHandlers(["mouseup","up"],[v]),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mouse&&this.mouse.obj&&(JXG$1.exists(this.mouse.obj.coords)||(this.mouse.obj.snapToGrid(this.mouse.targets[0]),this.mouse.obj.snapToPoints())),this.originMoveEnd(),this.dehighlightAll(),this.update(),this.selectingMode)this._stopSelecting(v),this.triggerEventHandlers(["mousestopselecting","stopselecting"],[v]),this.stopSelectionMode();else for(N=0;N<this.downObjects.length;N++)this.downObjects[N].triggerEventHandlers(["mouseup","up"],[v]);this.downObjects.length=0,this.hasMouseUp&&(JXG$1.removeEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!1),this.mouse=null},mouseWheelListener:function(v){var N,G,z;return!this.attr.zoom.enabled||!this.attr.zoom.wheel||!this._isRequiredKeyPressed(v,"zoom")?!0:(v=v||window.event,N=v.detail?-v.detail:v.wheelDelta/40,G=this.attr.zoom.center,G==="board"?z=[]:z=new Coords(Const.COORDS_BY_SCREEN,this.getMousePosition(v),this).usrCoords,N>0?this.zoomIn(z[1],z[2]):this.zoomOut(z[1],z[2]),this.triggerEventHandlers(["mousewheel"],[v]),v.preventDefault(),!1)},keyDownListener:function(v){var N=v.target.id,G,z,q,Y,W=0,ie=0,ne=JXG$1.evaluate(this.attr.keyboard.dx)/this.unitX,se=JXG$1.evaluate(this.attr.keyboard.dy)/this.unitY,ae=!1,ce=!0,pe,ge;return!this.attr.keyboard.enabled||N===""||(Y=this.containerObj.shadowRoot||document,Y.activeElement&&(z=Y.activeElement,z.tagName==="INPUT"||z.tagName==="textarea"))?!1:(G=N.replace(this.containerObj.id+"_",""),z=this.select(G),JXG$1.exists(z.coords)&&(ge=z.coords.usrCoords.slice(1)),JXG$1.evaluate(this.attr.keyboard.panshift)&&v.shiftKey||JXG$1.evaluate(this.attr.keyboard.panctrl)&&v.ctrlKey?(JXG$1.evaluate(this.attr.zoom.enabled)===!0&&(ae=!0),v.keyCode===38?this.clickUpArrow():v.keyCode===40?this.clickDownArrow():v.keyCode===37?this.clickLeftArrow():v.keyCode===39?this.clickRightArrow():ae&&v.keyCode===171?this.zoomIn():ae&&v.keyCode===173?this.zoomOut():ae&&v.keyCode===79?this.zoom100():ce=!1):!v.shiftKey&&!v.ctrlKey&&(JXG$1.exists(z.visProp)&&(JXG$1.exists(z.visProp.snaptogrid)&&z.visProp.snaptogrid&&z.evalVisProp("snapsizex")&&z.evalVisProp("snapsizey")?(q=z.getSnapSizes(),W=q[0],ie=q[1],ne=W,se=ie):JXG$1.exists(z.visProp.attracttogrid)&&z.visProp.attracttogrid&&z.evalVisProp("attractordistance")&&z.evalVisProp("attractorunit")&&(W=1.1*z.evalVisProp("attractordistance"),ie=W,z.evalVisProp("attractorunit")==="screen"&&(W/=this.unitX,ie/=this.unitX),ne=Math.max(W,ne),se=Math.max(ie,se))),v.keyCode===38?pe=[0,se]:v.keyCode===40?pe=[0,-se]:v.keyCode===37?pe=[-ne,0]:v.keyCode===39?pe=[ne,0]:ce=!1,pe&&z.isDraggable&&z.visPropCalc.visible&&(this.geonextCompatibilityMode&&(JXG$1.isPoint(z)||z.elementClass===Const.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!z.evalVisProp("fixed")&&(this.mode=this.BOARD_MODE_DRAG,JXG$1.exists(z.coords)&&(pe[0]+=ge[0],pe[1]+=ge[1]),JXG$1.exists(z.coords)?(z.setPosition(JXG$1.COORDS_BY_USER,pe),this.updateInfobox(z)):(this.displayInfobox(!1),z.setPositionDirectly(Const.COORDS_BY_USER,pe,[0,0])),this.triggerEventHandlers(["keymove","move"],[v,this.mode]),z.triggerEventHandlers(["keydrag","drag"],[v]),this.mode=this.BOARD_MODE_NONE)),this.update(),ce&&JXG$1.exists(v.preventDefault)&&v.preventDefault(),ce)},keyFocusInListener:function(v){var N=v.target.id,G,z;if(!this.attr.keyboard.enabled||N==="")return!1;G=N.replace(this.containerObj.id+"_",""),z=this.select(G),JXG$1.exists(z.highlight)&&(z.highlight(!0),this.focusObjects=[G],z.triggerEventHandlers(["hit"],[v])),JXG$1.exists(z.coords)&&this.updateInfobox(z)},keyFocusOutListener:function(v){if(!this.attr.keyboard.enabled)return!1;this.focusObjects=[],this.dehighlightAll(),this.displayInfobox(!1)},updateContainerDims:function(v,N){var G=v,z=N,q,Y,W;return v===void 0&&(G=this.containerObj.offsetWidth,z=this.containerObj.offsetHeight),v===void 0&&window&&window.getComputedStyle&&(q=window.getComputedStyle(this.containerObj,null),Y=parseFloat(q.getPropertyValue("border-left-width"))+parseFloat(q.getPropertyValue("border-right-width")),isNaN(Y)||(G-=Y),W=parseFloat(q.getPropertyValue("border-top-width"))+parseFloat(q.getPropertyValue("border-bottom-width")),isNaN(W)||(z-=W)),G<=0||z<=0||isNaN(G)||isNaN(z)?this:(isNaN(this.getBoundingBox()[0])&&this.setBoundingBox(this.attr.boundingbox,this.keepaspectratio,"keep"),JXG$1.exists(this._prevDim)&&this._prevDim.w===G&&this._prevDim.h===z?this:(this.resizeContainer(G,z,!0),this._prevDim={w:G,h:z},this))},startResizeObserver:function(){var v=this;!JXG$1.isBrowser||!this.attr.resize||!this.attr.resize.enabled||(this.resizeObserver=new ResizeObserver(function(N){var G;v._isResizing||(v._isResizing=!0,G=N[0].contentRect,window.setTimeout(function(){try{v.updateContainerDims(G.width,G.height)}catch(z){JXG$1.debug(z),v.stopResizeObserver()}finally{v._isResizing=!1}},v.attr.resize.throttle))}),this.resizeObserver.observe(this.containerObj))},stopResizeObserver:function(){!JXG$1.isBrowser||!this.attr.resize||!this.attr.resize.enabled||JXG$1.exists(this.resizeObserver)&&this.resizeObserver.unobserve(this.containerObj)},resizeListener:function(){var v=this;!JXG$1.isBrowser||!this.attr.resize||!this.attr.resize.enabled||!this._isScrolling&&!this._isResizing&&(this._isResizing=!0,window.setTimeout(function(){v.updateContainerDims(),v._isResizing=!1},this.attr.resize.throttle))},scrollListener:function(v){var N=this;JXG$1.isBrowser&&(this._isScrolling||(this._isScrolling=!0,window.setTimeout(function(){N._isScrolling=!1},66)))},startIntersectionObserver:function(){var v=this,N={root:null,rootMargin:"0px",threshold:.8};try{this.intersectionObserver=new IntersectionObserver(function(G){isNaN(v.getBoundingBox()[0])&&v.updateContainerDims()},N),this.intersectionObserver.observe(v.containerObj)}catch{JXG$1.debug("JSXGraph: IntersectionObserver not available in this browser.")}},stopIntersectionObserver:function(){JXG$1.exists(this.intersectionObserver)&&this.intersectionObserver.unobserve(this.containerObj)},printListener:function(v){this.updateContainerDims()},printListenerMatch:function(v){v.matches&&this.printListener()},initInfobox:function(v){var N=JXG$1.copyAttributes(v,this.options,"infobox");return N.id=this.id+"_infobox",this.infobox=this.create("text",[0,0,"0,0"],N),this.infobox.dump=!1,this.displayInfobox(!1),this},updateInfobox:function(v){var N,G,z,q,Y,W,ie,ne=v.evalVisProp("showinfobox");return!JXG$1.evaluate(this.attr.showinfobox)&&ne==="inherit"||!ne?this:(JXG$1.isPoint(v)&&(z=v.coords.usrCoords[1],q=v.coords.usrCoords[2],W=this.infobox.evalVisProp("distancex"),ie=this.infobox.evalVisProp("distancey"),this.infobox.setCoords(z+W/this.unitX,q+ie/this.unitY),Y=v.evalVisProp("infoboxdigits"),typeof v.infoboxText!="string"?(Y==="auto"?this.infobox.useLocale()?(N=this.infobox.formatNumberLocale(z),G=this.infobox.formatNumberLocale(q)):(N=JXG$1.autoDigits(z),G=JXG$1.autoDigits(q)):JXG$1.isNumber(Y)?this.infobox.useLocale()?(N=this.infobox.formatNumberLocale(z,Y),G=this.infobox.formatNumberLocale(q,Y)):(N=JXG$1.toFixed(z,Y),G=JXG$1.toFixed(q,Y)):(N=z,G=q),this.highlightInfobox(N,G,v)):this.highlightCustomInfobox(v.infoboxText,v),this.displayInfobox(!0)),this)},displayInfobox:function(v){return!v&&this.focusObjects.length>0&&this.select(this.focusObjects[0]).elementClass===Const.OBJECT_CLASS_POINT?this:(this.infobox.hiddenByParent===v&&(this.infobox.hiddenByParent=!v,this.infobox.prepareUpdate().updateVisibility(v).updateRenderer()),this)},showInfobox:function(v){return this.displayInfobox(v)},highlightInfobox:function(v,N,G){return this.highlightCustomInfobox("("+v+", "+N+")",G),this},highlightCustomInfobox:function(v,N){return this.infobox.setText(v),this},dehighlightAll:function(){var v,N,G={},z=!1;for(v in this.highlightedObjects)this.highlightedObjects.hasOwnProperty(v)&&(N=this.highlightedObjects[v],this.focusObjects.indexOf(v)<0?((this.hasMouseHandlers||this.hasPointerHandlers)&&N.noHighlight(),z=!0):G[v]=N);return this.highlightedObjects=G,this.renderer.type==="canvas"&&z&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspend
132Redraw()),this},getScrCoordsOfMouse:function(v,N){return[v,N]},getUsrCoordsOfMouse:function(v){var N=this.getCoordsTopLeftCorner(),G=JXG$1.getPosition(v,null,this.document),z=G[0]-N[0],q=G[1]-N[1],Y=new Coords(Const.COORDS_BY_SCREEN,[z,q],this);return Y.usrCoords.slice(1)},getAllUnderMouse:function(v){var N=this.getAllObjectsUnderMouse(v);return N.push(this.getUsrCoordsOfMouse(v)),N},getAllObjectsUnderMouse:function(v){var N=this.getCoordsTopLeftCorner(),G=JXG$1.getPosition(v,null,this.document),z=G[0]-N[0],q=G[1]-N[1],Y=[],W,ie,ne=this.objectsList.length;for(W=0;W<ne;W++)ie=this.objectsList[W],ie.visPropCalc.visible&&ie.hasPoint&&ie.hasPoint(z,q)&&(Y[Y.length]=ie);return Y},updateCoords:function(){var v,N,G=this.objectsList.length;for(N=0;N<G;N++)v=this.objectsList[N],JXG$1.exists(v.coords)&&(v.evalVisProp("frozen")?v.is3D?v.element2D.coords.screen2usr():v.coords.screen2usr():v.is3D?v.element2D.coords.usr2screen():(v.coords.usr2screen(),JXG$1.exists(v.actualCoords)&&v.actualCoords.usr2screen()));return this},moveOrigin:function(v,N,G){var z,q,Y,W;return JXG$1.exists(v)&&JXG$1.exists(N)&&(z=this.origin.scrCoords[1],q=this.origin.scrCoords[2],this.origin.scrCoords[1]=v,this.origin.scrCoords[2]=N,G&&(this.origin.scrCoords[1]-=this.drag_dx,this.origin.scrCoords[2]-=this.drag_dy),Y=new Coords(Const.COORDS_BY_SCREEN,[0,0],this).usrCoords,W=new Coords(Const.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords,(Y[1]<this.maxboundingbox[0]-Mat.eps||Y[2]>this.maxboundingbox[1]+Mat.eps||W[1]>this.maxboundingbox[2]+Mat.eps||W[2]<this.maxboundingbox[3]-Mat.eps)&&(this.origin.scrCoords[1]=z,this.origin.scrCoords[2]=q)),this.updateCoords().clearTraces().fullUpdate(),this.triggerEventHandlers(["boundingbox"]),this},addConditions:function(v){var N,G,z,q,Y,W,ie,ne=[],se=v.indexOf("<data>"),ae=v.indexOf("</data>"),ce=function(Ee,Pe,Je,Ce){return function(){var Ve,Re;Ve=Ee.select(Pe.id),Re=Ve.coords.usrCoords[Ce],Ce===2?Ve.setPositionDirectly(Const.COORDS_BY_USER,[Je(),Re]):Ve.setPositionDirectly(Const.COORDS_BY_USER,[Re,Je()]),Ve.prepareUpdate().update()}},pe=function(Ee,Pe,Je){return function(){var Ce,Ve;Ce=Ee.select(Pe.id),Ve=Je(),Ce.setAttribute({visible:Ve})}},ge=function(Ee,Pe,Je,Ce){return function(){var Ve,Re;Ve=Ee.select(Pe.id),Re=Je(),Ce==="strokewidth"?Ve.visProp.strokewidth=Re:(Re=JXG$1.rgba2rgbo(Re),Ve.visProp[Ce+"color"]=Re[0],Ve.visProp[Ce+"opacity"]=Re[1])}},ve=function(Ee,Pe,Je){return function(){var Ce=Ee.select(Pe.id);Ce.position=Je()}},be=function(Ee,Pe,Je){return function(){var Ce=Ee.select(Pe.id);Ce.setStyle(Je())}};if(!(se<0)){for(;se>=0;){if(N=v.slice(se+6,ae),G=N.indexOf("="),z=N.slice(0,G),q=N.slice(G+1),G=z.indexOf("."),Y=z.slice(0,G),W=this.elementsByName[JXG$1.unescapeHTML(Y)],ie=z.slice(G+1).replace(/\s+/g,"").toLowerCase(),q=JXG$1.createFunction(q,this,"",!0),!JXG$1.exists(this.elementsByName[Y]))JXG$1.debug("debug conditions: |"+Y+"| undefined");else switch(ie){case"x":ne.push(ce(this,W,q,2));break;case"y":ne.push(ce(this,W,q,1));break;case"visible":ne.push(pe(this,W,q));break;case"position":ne.push(ve(this,W,q));break;case"stroke":ne.push(ge(this,W,q,"stroke"));break;case"style":ne.push(be(this,W,q));break;case"strokewidth":ne.push(ge(this,W,q,"strokewidth"));break;case"fill":ne.push(ge(this,W,q,"fill"));break;case"label":break;default:JXG$1.debug('property "'+ie+'" in conditions not yet implemented:'+q);break}v=v.slice(ae+7),se=v.indexOf("<data>"),ae=v.indexOf("</data>")}this.updateConditions=function(){var Ee;for(Ee=0;Ee<ne.length;Ee++)ne[Ee]();return this.prepareUpdate().updateElements(),!0},this.updateConditions()}},updateConditions:function(){return!1},calculateSnapSizes:function(){var v,N,G=this.getBoundingBox(),z=JXG$1.evaluate(this.options.grid.majorStep),q=JXG$1.evaluate(this.options.grid.gridX),Y=JXG$1.evaluate(this.options.grid.gridY),W,ie;for(JXG$1.isArray(z)||(z=[z,z]),z.length<2&&(z=[z[0],z[0]]),JXG$1.exists(q)&&(z[0]=q),JXG$1.exists(Y)&&(z[1]=Y),z[0]==="auto"?z[0]=1:z[0]=JXG$1.parseNumber(z[0],Math.abs(G[1]-G[3]),1/this.unitX),z[1]==="auto"?z[1]=1:z[1]=JXG$1.parseNumber(z[1],Math.abs(G[0]-G[2]),1/this.unitY),v=new Coords(Const.COORDS_BY_USER,[0,0],this),N=new Coords(Const.COORDS_BY_USER,[z[0],z[1]],this),W=v.scrC
132oords[1]-N.scrCoords[1],ie=v.scrCoords[2]-N.scrCoords[2],this.options.grid.snapSizeX=z[0];Math.abs(W)>25;)this.options.grid.snapSizeX*=2,W/=2;for(this.options.grid.snapSizeY=z[1];Math.abs(ie)>25;)this.options.grid.snapSizeY*=2,ie/=2;return this},applyZoom:function(){return this.updateCoords().calculateSnapSizes().clearTraces().fullUpdate(),this},zoomIn:function(v,N){var G=this.getBoundingBox(),z=JXG$1.evaluate(this.attr.zoom.factorx),q=JXG$1.evaluate(this.attr.zoom.factory),Y=(G[2]-G[0])*(1-1/z),W=(G[1]-G[3])*(1-1/q),ie=.5,ne=.5,se=JXG$1.evaluate(this.attr.zoom.max),ae=JXG$1.evaluate(this.attr.zoom.eps)||JXG$1.evaluate(this.attr.zoom.min)||.001;return this.zoomX>se&&z>1||this.zoomY>se&&q>1||this.zoomX<ae&&z<1||this.zoomY<ae&&q<1?this:(JXG$1.isNumber(v)&&JXG$1.isNumber(N)&&(ie=(v-G[0])/(G[2]-G[0]),ne=(G[1]-N)/(G[1]-G[3])),this.setBoundingBox([G[0]+Y*ie,G[1]-W*ne,G[2]-Y*(1-ie),G[3]+W*(1-ne)],this.keepaspectratio,"update"),this.applyZoom())},zoomOut:function(v,N){var G=this.getBoundingBox(),z=JXG$1.evaluate(this.attr.zoom.factorx),q=JXG$1.evaluate(this.attr.zoom.factory),Y=(G[2]-G[0])*(1-z),W=(G[1]-G[3])*(1-q),ie=.5,ne=.5,se=JXG$1.evaluate(this.attr.zoom.eps)||JXG$1.evaluate(this.attr.zoom.min)||.001;return this.zoomX<se||this.zoomY<se?this:(JXG$1.isNumber(v)&&JXG$1.isNumber(N)&&(ie=(v-G[0])/(G[2]-G[0]),ne=(G[1]-N)/(G[1]-G[3])),this.setBoundingBox([G[0]+Y*ie,G[1]-W*ne,G[2]-Y*(1-ie),G[3]+W*(1-ne)],this.keepaspectratio,"update"),this.applyZoom())},zoom100:function(){var v,N,G;return JXG$1.exists(this.attr.boundingbox)?this.setBoundingBox(this.attr.boundingbox,this.keepaspectratio,"reset"):(v=this.getBoundingBox(),N=(v[2]-v[0])*(1-this.zoomX)*.5,G=(v[1]-v[3])*(1-this.zoomY)*.5,this.setBoundingBox([v[0]+N,v[1]-G,v[2]-N,v[3]+G],this.keepaspectratio,"reset")),this.applyZoom()},zoomAllPoints:function(){var v,N,G,z,q,Y=0,W=0,ie=0,ne=0,se=this.objectsList.length;for(v=0;v<se;v++)q=this.objectsList[v],JXG$1.isPoint(q)&&q.visPropCalc.visible&&(q.coords.usrCoords[1]<Y?Y=q.coords.usrCoords[1]:q.coords.usrCoords[1]>W&&(W=q.coords.usrCoords[1]),q.coords.usrCoords[2]>ne?ne=q.coords.usrCoords[2]:q.coords.usrCoords[2]<ie&&(ie=q.coords.usrCoords[2]));return N=50,G=N/this.unitX,z=N/this.unitY,this.setBoundingBox([Y-G,ne+z,W+G,ie-z],this.keepaspectratio,"update"),this.applyZoom()},zoomElements:function(v){var N,G,z,q=[1/0,-1/0,-1/0,1/0],Y,W,ie,ne,se;if(!JXG$1.isArray(v)||v.length===0)return this;for(N=0;N<v.length;N++)G=this.select(v[N]),z=G.bounds(),JXG$1.isArray(z)&&(z[0]<q[0]&&(q[0]=z[0]),z[1]>q[1]&&(q[1]=z[1]),z[2]>q[2]&&(q[2]=z[2]),z[3]<q[3]&&(q[3]=z[3]));return JXG$1.isArray(q)&&(Y=.5*(q[0]+q[2]),W=.5*(q[1]+q[3]),ie=1.5*(q[2]-q[0])*.5,ne=1.5*(q[1]-q[3])*.5,se=Math.max(ie,ne),this.setBoundingBox([Y-se,W+se,Y+se,W-se],this.keepaspectratio,"update")),this},setZoom:function(v,N){var G=this.attr.zoom.factorx,z=this.attr.zoom.factory;return this.attr.zoom.factorx=v/this.zoomX,this.attr.zoom.factory=N/this.zoomY,this.zoomIn(),this.attr.zoom.factorx=G,this.attr.zoom.factory=z,this},_removeObj:function(v,N){var G,z;if(JXG$1.isArray(v)){for(z=0;z<v.length;z++)this._removeObj(v[z],N);return this}if(v=this.select(v),!JXG$1.exists(v)||JXG$1.isString(v))return this;try{for(G in v.childElements)v.childElements.hasOwnProperty(G)&&v.childElements[G].board._removeObj(v.childElements[G]);for(G in v.objects)v.objects.hasOwnProperty(G)&&v.objects[G].board._removeObj(v.objects[G]);if(N)for(G in this.objects)this.objects.hasOwnProperty(G)&&JXG$1.exists(this.objects[G].childElements)&&JXG$1.exists(this.objects[G].childElements.hasOwnProperty(v.id))&&(delete this.objects[G].childElements[v.id],delete this.objects[G].descendants[v.id]);else if(JXG$1.exists(v.ancestors))for(G in v.ancestors)v.ancestors.hasOwnProperty(G)&&JXG$1.exists(v.ancestors[G].childElements)&&JXG$1.exists(v.ancestors[G].childElements.hasOwnProperty(v.id))&&(delete v.ancestors[G].childElements[v.id],delete v.ancestors[G].descendants[v.id]);if(v._pos>-1)for(this.objectsList.splice(v._pos,1),z=v._pos;z<this.objectsList.length;z++)this.objectsList[z]._pos--;else v.type!==Const.OBJECT_TYPE_TURTLE&&JXG$1.debug("Board.removeObject: object "+v.id+" not found in list.");delete this.objects[v.id],delete this.elementsByName[v.name],v.visProp&&v.evalVisProp("trace")&&v.clearTrace(),JXG$1.exists(v.remove)&&v.remove()}catch(q){JXG$1.debug(v.id+": Could not be removed: "+q)}return this},removeObject:function(v,N){var G;if(this.renderer.suspendRedraw(this),JXG$1.isArray(v))for(G=0;G<v.length;G++)this._removeObj(v[G],N);else this._removeObj(v,N);
132return this.renderer.unsuspendRedraw(),this.update(),this},removeAncestors:function(v){var N;for(N in v.ancestors)v.ancestors.hasOwnProperty(N)&&this.removeAncestors(v.ancestors[N]);return this.removeObject(v),this},initGeonextBoard:function(){var v,N,G;return v=this.create("point",[0,0],{id:this.id+"g00e0",name:"Ursprung",withLabel:!1,visible:!1,fixed:!0}),N=this.create("point",[1,0],{id:this.id+"gX0e0",name:"Punkt_1_0",withLabel:!1,visible:!1,fixed:!0}),G=this.create("point",[0,1],{id:this.id+"gY0e0",name:"Punkt_0_1",withLabel:!1,visible:!1,fixed:!0}),this.create("line",[v,N],{id:this.id+"gXLe0",name:"X-Achse",withLabel:!1,visible:!1}),this.create("line",[v,G],{id:this.id+"gYLe0",name:"Y-Achse",withLabel:!1,visible:!1}),this},resizeContainer:function(v,N,G,z){var q,Y,W,ie,ne;return Y=this.canvasWidth,W=this.canvasHeight,z||(q=this.getBoundingBox()),this.canvasWidth=parseFloat(v),this.canvasHeight=parseFloat(N),G||(this.containerObj.style.width=this.canvasWidth+"px",this.containerObj.style.height=this.canvasHeight+"px"),this.renderer.resize(this.canvasWidth,this.canvasHeight),z?(ie=(this.canvasWidth-Y)*.5,ne=(this.canvasHeight-W)*.5,this.moveOrigin(this.origin.scrCoords[1]+ie,this.origin.scrCoords[2]+ne)):this.setBoundingBox(q,this.keepaspectratio,"keep"),this},showDependencies:function(){var v,N,G,z,q;N=`<p>
133`;for(v in this.objects)if(this.objects.hasOwnProperty(v)){q=0;for(G in this.objects[v].childElements)this.objects[v].childElements.hasOwnProperty(G)&&(q+=1);q>=0&&(N+="<strong>"+this.objects[v].id+":</strong> ");for(G in this.objects[v].childElements)this.objects[v].childElements.hasOwnProperty(G)&&(N+=this.objects[v].childElements[G].id+"("+this.objects[v].childElements[G].name+"), ");N+=`<p>
134`}return N+=`</p>
135`,z=window.open(),z.document.open(),z.document.write(N),z.document.close(),this},showXML:function(){var v=window.open("");return v.document.open(),v.document.write("<pre>"+JXG$1.escapeHTML(this.xmlString)+"</pre>"),v.document.close(),this},prepareUpdate:function(v){var N,G,z,q=this.objectsList.length;for(N=0;N<q;N++)if(z=this.objectsList[N],this._change3DView||JXG$1.exists(v)&&v.elType==="view3d_slider"){if(z.needsUpdate=z.visProp.element3d||z.elType==="view3d"||z.elType==="view3d_slider"||this.needsFullUpdate,z.visProp.element3d&&z.visProp.element3d.type===Const.OBJECT_TYPE_SPHERE3D)for(G=0;G<z.parents.length;G++)this.objects[z.parents[G]].needsUpdate=!0}else z.needsUpdate=z.needsRegularUpdate||this.needsFullUpdate;for(N in this.groups)this.groups.hasOwnProperty(N)&&(z=this.groups[N],z.needsUpdate=z.needsRegularUpdate||this.needsFullUpdate);return this},updateElements:function(v){var N,G;for(v=this.select(v),N=0;N<this.objectsList.length;N++)G=this.objectsList[N],this.needsFullUpdate&&G.elementClass===Const.OBJECT_CLASS_TEXT&&G.updateSize(),G.update(!JXG$1.exists(v)||G.id!==v.id).updateVisibility();for(N in this.groups)this.groups.hasOwnProperty(N)&&this.groups[N].update(v);return this},updateRenderer:function(){var v,N=this.objectsList.length;if(this.renderer){if(this.renderer.type==="canvas")this.updateRendererCanvas();else for(v=0;v<N;v++)this.objectsList[v].updateRenderer();return this}},updateRendererCanvas:function(){var v,N,G=this.objectsList.length,z=[],q,Y=function(W,ie){return W.visProp.layer!==ie.visProp.layer?W.visProp.layer-ie.visProp.layer:z.indexOf(W.visProp.layer)===-1||!W.visProp.element3d&&!ie.visProp.element3d?W._pos-ie._pos:W.visProp.element3d&&!ie.visProp.element3d?-1:ie.visProp.element3d&&!W.visProp.element3d?1:W.visProp.element3d.zIndex-ie.visProp.element3d.zIndex};for(v=0;v<G;v++)if(N=this.objectsList[v],N.elType==="view3d"&&N.evalVisProp("depthorder.enabled")){z=N.evalVisProp("depthorder.layers"),N.updateRenderer();break}for(q=this.objectsList.toSorted(Y),G=q.length,v=0;v<G;v++)q[v].prepareUpdate().updateRenderer();return this},addHook:function(v,N,G){return JXG$1.deprecated("Board.addHook()","Board.on()"),N=JXG$1.def(N,"update"),G=JXG$1.def(G,this),this.hooks.push([N,v]),this.on(N,v,G),this.hooks.length-1},addEvent:JXG$1.shortcut(JXG$1.Board.prototype,"on"),removeHook:function(v){return JXG$1.deprecated("Board.removeHook()","Board.off()"),this.hooks[v]&&(this.off(this.hooks[v][0],this.hooks[v][1]),this.hooks[v]=null),this},removeEvent:JXG$1.shortcut(JXG$1.Board.prototype,"off"),updateHooks:function(v){var N=Array.prototype.slice.call(arguments,0);return JXG$1.deprecated("Board.updateHooks()","Board.triggerEventHandlers()"),N[0]=JXG$1.def(N[0],"update"),this.triggerEventHandlers([N[0]],arguments),this},addChild:function(v){return JXG$1.exists(v)&&JXG$1.exists(v.containerObj)&&(this.dependentBoards.push(v),this.update()),this},removeChild:function(v){var N;for(N=this.dependentBoards.length-1;N>=0;N--)this.dependentBoards[N]===v&&this.dependentBoards.splice(N,1);return this},update:function(v){var N,G,z,q,Y;if(this.inUpdate||this.isSuspendedUpdate)return this;for(this.inUpdate=!0,this.attr.minimizereflow==="all"&&this.containerObj&&this.renderer.type!=="vml"&&(Y=this.document.activeElement,q=this.renderer.removeToInsertLater(this.containerObj)),this.attr.minimizereflow==="svg"&&this.renderer.type==="svg"&&(Y=this.document.activeElement,q=this.renderer.removeToInsertLater(this.renderer.svgRoot)),this.prepareUpdate(v).updateElements(v).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspend
135Redraw(),this.triggerEventHandlers(["update"],[]),q&&(q(),Y.focus()),G=this.dependentBoards.length,N=0;N<G;N++)z=this.dependentBoards[N],JXG$1.exists(z)&&z!==this&&(z.updateQuality=this.updateQuality,z.prepareUpdate().updateElements().updateConditions(),z.renderer.suspendRedraw(this),z.updateRenderer(),z.renderer.unsuspendRedraw(),z.triggerEventHandlers(["update"],[]));return this.inUpdate=!1,this},fullUpdate:function(){return this.needsFullUpdate=!0,this.update(),this.needsFullUpdate=!1,this},addGrid:function(){return this.create("grid",[]),this},removeGrids:function(){var v;for(v=0;v<this.grids.length;v++)this.removeObject(this.grids[v]);return this.grids.length=0,this.update(),this},create:function(v,N,G){var z,q;for(v=v.toLowerCase(),JXG$1.exists(N)||(N=[]),JXG$1.exists(G)||(G={}),q=0;q<N.length;q++)JXG$1.isString(N[q])&&!(v==="text"&&q===2)&&!(v==="solidofrevolution3d"&&q===2)&&!(v==="text3d"&&(q===2||q===4))&&!((v==="input"||v==="checkbox"||v==="button")&&(q===2||q===3))&&v!=="curve"&&v!=="functiongraph"&&v!=="implicitcurve"&&(q>0&&N[0].elType==="view3d"?N[q]=N[0].select(N[q]):N[q]=this.select(N[q]));if(JXG$1.isFunction(JXG$1.elements[v]))z=JXG$1.elements[v](this,N,G);else throw new Error("JSXGraph: create: Unknown element type given: "+v);return JXG$1.exists(z)?(z.prepareUpdate&&z.update&&z.updateRenderer&&z.fullUpdate(),z):(JXG$1.debug("JSXGraph: create: failure creating "+v),z)},createElement:function(){return JXG$1.deprecated("Board.createElement()","Board.create()"),this.create.apply(this,arguments)},clearTraces:function(){var v;for(v=0;v<this.objectsList.length;v++)this.objectsList[v].clearTrace();return this.numTraces=0,this},suspendUpdate:function(){return this.inUpdate||(this.isSuspendedUpdate=!0),this},unsuspendUpdate:function(){return this.isSuspendedUpdate&&(this.isSuspendedUpdate=!1,this.fullUpdate()),this},setBoundingBox:function(v,N,G){var z,q,Y,W,ie=0,ne=0,se=1,ae,ce,pe,ge,ve,be=JXG$1.getDimensions(this.containerObj,this.document);return JXG$1.isArray(v)?v[0]<this.maxboundingbox[0]-Mat.eps||v[1]>this.maxboundingbox[1]+Mat.eps||v[2]>this.maxboundingbox[2]+Mat.eps||v[3]<this.maxboundingbox[3]-Mat.eps?this:(JXG$1.exists(G)||(G="reset"),Y=this.unitX,W=this.unitY,this.canvasWidth=parseFloat(be.width),this.canvasHeight=parseFloat(be.height),q=this.canvasWidth,z=this.canvasHeight,N?(this.keepaspectratio?(ae=Y/W,isNaN(ae)&&(ae=1)):ae=1,G==="keep"&&(se=this.zoomX/this.zoomY),ce=v[2]-v[0],pe=v[1]-v[3],ge=Y*ce,ve=W*pe,q>=z?ge>=ve?(this.unitY=z/pe,this.unitX=this.unitY*ae):(this.unitY=z/Math.abs(ce)*Mat.sign(pe)/se,this.unitX=this.unitY*ae):ve>ge?(this.unitX=q/ce,this.unitY=this.unitX/ae):(this.unitX=q/Math.abs(pe)*Mat.sign(ce)*se,this.unitY=this.unitX/ae),ie=(q/this.unitX-ce)*.5,ne=(z/this.unitY-pe)*.5,this.keepaspectratio=!0):(this.unitX=q/(v[2]-v[0]),this.unitY=z/(v[1]-v[3]),this.keepaspectratio=!1),this.moveOrigin(-this.unitX*(v[0]-ie),this.unitY*(v[1]+ne)),G==="update"?(this.zoomX*=this.unitX/Y,this.zoomY*=this.unitY/W):G==="reset"&&(this.zoomX=JXG$1.exists(this.attr.zoomx)?this.attr.zoomx:1,this.zoomY=JXG$1.exists(this.attr.zoomy)?this.attr.zoomy:1),this):this},getBoundingBox:function(){var v=new Coords(Const.COORDS_BY_SCREEN,[0,0],this).usrCoords,N=new Coords(Const.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords;return[v[1],v[2],N[1],N[2]]},_set:function(v,N){v=v.toLocaleLowerCase(),N!==null&&JXG$1.isObject(N)&&!JXG$1.exists(N.id)&&!JXG$1.exists(N.name)?JXG$1.mergeAttr(this.attr[v],N):this.attr[v]=N},setAttribute:function(v){var N,G,z,q,Y,W,ie,ne={};for(N=0;N<arguments.length;N++)G=arguments[N],JXG$1.isString(G)?(z=G.split(":"),ne[JXG$1.trim(z[0])]=JXG$1.trim(z[1])):JXG$1.isArray(G)?ne[G[0]]=G[1]:JXG$1.extend(ne,G);for(N in ne)if(ne.hasOwnProperty(N)&&(q=N.replace(/\s+/g,"").toLowerCase(),Y=ne[N]),Y=Y.toLowerCase&&Y.toLowerCase()==="false"?!1:Y,W=this.attr[q],W!==Y)switch(q){case"axis":Y===!1&&JXG$1.exists(this.defaultAxes)&&(this.defaultAxes.x.setAttribute({visible:!1}),this.defaultAxes.y.setAttribute({visible:!1}));break;case"boundingbox":this.setBoundingBox(Y,this.keepaspectratio),this._set(q,Y);break;case"defaultaxes":JXG$1.exists(this.defaultAxes.x)&&JXG$1.exists(Y.x)&&this.defaultAxes.x.setAttribute(Y.x),JXG$1.exists(this.defaultAxes.y)&&JXG$1.exists(Y.y)&&this.defaultAxes.y.setAttribute(Y.y);break;case"title":this.document.getElementById(this.container+"_ARIAlabel").innerHTML=Y,this._set(q,Y);break;case"keepaspectratio":this._set(q,Y),this.setBoundingBox(this.getBoundingBox(),Y,"keep");break;case"document":case"maxboundingbox":this[q]=Y,this._set(q,Y);break;case"zoomx":case"zoomy":this[q]=Y,this._set(q,Y),this.setZoom(this.attr.zoomx,this.attr.zoomy);break;case"registerevents":case"renderer":break;case"fullscreen":case"screenshot":ie=this.containerObj.ownerDocument.getElementById(this.container+"_navigation_"+q),ie&&JXG$1.exists(Y.symbol)&&(ie.innerHTML=JXG$1.evaluate(Y.symbol)),this._set(q,Y);break;case"selection":Y.visible=!1,Y.withLines=!1,Y.vertices={visible:!1},this._set(q,Y);break;case"showcopyright":this.renderer.type==="svg"&&(ie=this.containerObj.ownerDocument.getElementById(this.renderer.uniqName("licenseText")),ie?ie.style.display=JXG$1.evaluate(Y)?"inline":"none":JXG$1.evaluate(Y)&&this.renderer.displayCopyright(Const.licenseText,parseInt(this.options.text.fontSize,10)));default:JXG$1.exists(this.attr[q])&&this._set(q,Y);break}return this.containerObj.ownerDocument.getElementById(this.container+"_navigationbar").remove(),this.renderer.drawNavigationBar(this,this.attr.navbar),this.triggerEventHandlers(["attribute"],[ne,this]),this.fullUpdate(),this},addAnimation:function(v){var N=this;return this.animationObjects[v.id]=v,this.animationIntervalCode||(this.animationIntervalCode=window.setInterval(function(){N.animate()},v.board.attr.animationdelay)),this},stopAllAnimation:function(){var v;
135for(v in this.animationObjects)this.animationObjects.hasOwnProperty(v)&&JXG$1.exists(this.animationObjects[v])&&(this.animationObjects[v]=null,delete this.animationObjects[v]);return window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode,this},animate:function(){var v,N,G,z,q,Y,W,ie,ne=0,se=null;for(N in this.animationObjects)if(this.animationObjects.hasOwnProperty(N)&&JXG$1.exists(this.animationObjects[N])){if(ne+=1,G=this.animationObjects[N],G.animationPath&&(JXG$1.isFunction(G.animationPath)?z=G.animationPath(new Date().getTime()-G.animationStart):z=G.animationPath.pop(),!JXG$1.exists(z)||!JXG$1.isArray(z)&&isNaN(z)?delete G.animationPath:(G.setPositionDirectly(Const.COORDS_BY_USER,z),G.fullUpdate(),se=G)),G.animationData){W=0;for(q in G.animationData)G.animationData.hasOwnProperty(q)&&(Y=G.animationData[q].pop(),JXG$1.exists(Y)?(W+=1,v={},v[q]=Y,G.setAttribute(v)):delete G.animationData[Y]);W===0&&delete G.animationData}!JXG$1.exists(G.animationData)&&!JXG$1.exists(G.animationPath)&&(this.animationObjects[N]=null,delete this.animationObjects[N],JXG$1.exists(G.animationCallback)&&(ie=G.animationCallback,G.animationCallback=null,ie()))}return ne===0?(window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode):this.update(se),this},migratePoint:function(v,N,G){var z,q,Y,W,ie,ne,se=!1;v=this.select(v),N=this.select(N),JXG$1.exists(v.label)&&(ne=v.label.id,se=!0,this.removeObject(v.label));for(q in v.childElements)if(v.childElements.hasOwnProperty(q)){z=v.childElements[q],W=!1;for(Y in z)z.hasOwnProperty(Y)&&z[Y]===v&&(z[Y]=N,W=!0);for(W&&delete v.childElements[q],ie=0;ie<z.parents.length;ie++)z.parents[ie]===v.id&&(z.parents[ie]=N.id);N.addChild(z)}return G&&(se&&(delete N.childElements[ne],delete N.descendants[ne]),N.label&&this.removeObject(N.label),delete this.elementsByName[N.name],N.name=v.name,se&&N.createLabel()),this.removeObject(v),JXG$1.exists(N.name)&&N.name!==""&&(this.elementsByName[N.name]=N),this.fullUpdate(),this},emulateColorblindness:function(v){var N,G;if(JXG$1.exists(v)||(v="none"),this.currentCBDef===v)return this;for(N in this.objects)this.objects.hasOwnProperty(N)&&(G=this.objects[N],v!=="none"?(this.currentCBDef==="none"&&(G.visPropOriginal={strokecolor:G.visProp.strokecolor,fillcolor:G.visProp.fillcolor,highlightstrokecolor:G.visProp.highlightstrokecolor,highlightfillcolor:G.visProp.highlightfillcolor}),G.setAttribute({strokecolor:JXG$1.rgb2cb(G.eval(G.visPropOriginal.strokecolor),v),fillcolor:JXG$1.rgb2cb(G.eval(G.visPropOriginal.fillcolor),v),highlightstrokecolor:JXG$1.rgb2cb(G.eval(G.visPropOriginal.highlightstrokecolor),v),highlightfillcolor:JXG$1.rgb2cb(G.eval(G.visPropOriginal.highlightfillcolor),v)})):JXG$1.exists(G.visPropOriginal)&&JXG$1.extend(G.visProp,G.visPropOriginal));return this.currentCBDef=v,this.update(),this},select:function(v,N){var G,z,q,Y,W=v;if(W===null)return W;if(JXG$1.isString(W)&&W!=="")JXG$1.exists(this.objects[W])?W=this.objects[W]:JXG$1.exists(this.elementsByName[W])?W=this.elementsByName[W]:JXG$1.exists(this.groups[W])&&(W=this.groups[W]);else if(!N&&(JXG$1.isFunction(W)||JXG$1.isObject(W)&&!JXG$1.isFunction(W.setAttribute))){for(G=JXG$1.filterElements(this.objectsList,W),z={},Y=G.length,q=0;q<Y;q++)z[G[q].id]=G[q];W=new Composition(z)}else JXG$1.isObject(W)&&JXG$1.exists(W.id)&&!JXG$1.exists(this.objects[W.id])&&(W=null);return W},hasPoint:function(v,N){var G=v,z=N,q=this.getBoundingBox();return JXG$1.exists(v)&&JXG$1.isArray(v.usrCoords)&&(G=v.usrCoords[1],z=v.usrCoords[2]),!!(JXG$1.isNumber(G)&&JXG$1.isNumber(z)&&q[0]<G&&G<q[2]&&q[1]>z&&z>q[3])},updateCSSTransforms:function(){var v=this.containerObj,N=v,G=v;if(this.cssTransMat=JXG$1.getCSSTransformMatrix(N),JXG$1.exists(N.getRootNode)){for(N=N.parentNode===N.getRootNode()?N.parentNode.host:N.parentNode;N;)this.cssTransMat=Mat.matMatMult(JXG$1.getCSSTransformMatrix(N),this.cssTransMat),N=N.parentNode===N.getRootNode()?N.parentNode.host:N.parentNode;this.cssTransMat=Mat.inverse(this.cssTransMat)}else{for(N=N.offsetParent;N;){for(this.cssTransMat=Mat.matMatMult(JXG$1.getCSSTransformMatrix(N),this.cssTransMat),G=G.parentNode;G!==N;)this.cssTransMat=Mat.matMatMult(JXG$1.getCSSTransformMatrix(N),this.cssTransMat),G=G.parentNode;N=N.offsetParent}this.cssTransMat=Mat.inverse(this.cssTransMat)}return this},startSelectionMode:function(){this.selectingMode=!0,this.selectionPolygon.setAttribute({visible:!0}),this.selectingBox=[[0,0],[0,0]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate()},stopSelectionMode:function(){return this.selectingMode=!1,this.selectionPolygon.setAttribute({visible:!1}),[this.selectionPolygon.vertices[0].coords,this.selectionPolygon.vertices[2].coords]},_startSelecting:function(v){this.isSelecting=!0,this.selectingBox=[[v[0],v[1]],[v[0],v[1]]],this._setSelectionPolygonFromBox()},_moveSelecting:function(v){this.isSelecting&&(this.selectingBox[1]=[v[0],v[1]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate())},_stopSelecting:function(v){var N=this.getMousePosition(v);this.isSelecting=!1,this.selectingBox[1]=[N[0],N[1]],this._setSelectionPolygonFromBox()},_setSelectionPolygonFromBox:function(){var v=this.selectingBox[0],N=this.selectingBox[1];this.selectionPolygon.vertices[0].setPositionDirectly(JXG$1.COORDS_BY_SCREEN,[v[0],v[1]]),this.selectionPolygon.vertices[1].setPositionDirectly(JXG$1.COORDS_BY_SCREEN,[v[0],N[1]]),this.selectionPolygon.vertices[2].setPositionDirectly(JXG$1.COORDS_BY_SCREEN,[N[0],N[1]]),this.selectionPolygon.vertices[3].setPositionDirectly(JXG$1.COORDS_BY_SCREEN,[N[0],v[1]])},_testForSelection:function(v){this._isRequiredKeyPressed(v,"selection")&&(JXG$1.exists(this.selectionPolygon)||this._createSelectionPolygon(this.attr),this.startSelectionMode())},_createSelectionPolygon:function(v){var N;return JXG$1.exists(this.selectionPolygon)||(N=JXG$1.copyAttributes(v,Options,"board","selection"),N.enabled===!0&&(this.selectionPolygon=this.create("polygon",[[0,0],[0,0],[0,0],[0,0]],N))),this},__evt__attribute:function(v){},__evt__down:function(v){},__evt__mousedown:function(v){},__evt__pendown:function(v){},__evt__pointerdown:function(v){},__evt__touchstart:function(v){},__evt__up:function(v){},__evt__mouseup:function(v){},__evt__pointerup:function(v){},__evt__touchend:function(v){},__evt__click:function(v){},__evt__dblclick:function(v){},__evt__mouseclick:function(v){},__evt__mousedblclick:function(v){},__evt__pointerclick:function(v){},__evt__pointerdblclick:function(v){},__evt__move:function(v,N){},__evt__mousemove:function(v,N){},__evt__penmove:function(v,N){},__evt__pointermove:function(v,N){},__evt__touchmove:function(v,N){},__evt__keymove:function(v,N){},__evt__hit:function(v,N,G){},__evt__mousehit:function(v,N,G){},__evt__update:function(){},__evt__boundingbox:function(){},__evt__startselecting:function(){},__evt__mousestartselecting:function(){},__evt__pointerstartselecting:function(){},__evt__touchstartselecting:function(){},__evt__stopselecting:function(){},__evt__mousestopselecting:function(){},__evt__pointerstopselecting:function(){},__evt__touchstopselecting:function(){},__evt__moveselecting:function(){},__evt__mousemoveselecting:function(){},__evt__pointermoveselecting:function(){},__evt__touchmoveselecting:function(){},__evt:function(){},toFullscreen:function(v){var N,G,z,q,Y=this.document,W;return v=v||this.container,this._fullscreen_inner_id=v,z=Y.getElementById(v),N="fullscreenwrap_"+v,JXG$1.exists(z._cssFullscreenStore)||(q=this.containerObj.getBoundingClientRect(),z._cssFullscreenStore={w:q.width,h:q.height}),Y.getElementById(N)?G=Y.getElementById(N):(G=document.createElement("div"),G.classList.add("JXG_wrap_private"),G.setAttribute("id",N),z.parentNode.insertBefore(G,z),G.appendChild(z)),G.requestFullscreen=G.requestFullscreen||G.webkitRequestFullscreen||G.mozRequestFullScreen||G.msRequestFullscreen,Y.fullscreenElement!==void 0?W=Y.fullscreenElement:Y.webkitFullscreenElement!==void 0?W=Y.webkitFullscreenElement:W=Y.msFullscreenElement,W===null?G.requestFullscreen&&(G.requestFullscreen(),this.startFullscreenResizeObserver(G)):(this.stopFullscreenResizeObserver(G),JXG$1.exists(document.exitFullscreen)?document.exitFullscreen():JXG$1.exists(document.webkitExitFullscreen)&&document.webkitExitFullscreen()),this},fullscreenListener:function(v){var N,G,z,q=this.document;N=this._fullscreen_inner_id,JXG$1.exists(N)&&(q.fullscreenElement!==void 0?z=q.fullscreenElement:q.webkitFullscreenElement!==void 0?z=q.webkitFullscreenElement:z=q.msFullscreenElement,G=q.getElementById(N),z?(G._cssFullscreenStore.id=z.id,G._cssFullscreenStore.isFullscreen=!0,G._cssFullscreenStore.margin=G.style.margin,G._cssFullscreenStore.width=G.style.width,G._cssFullscreenStore.height=G.style.height,G._cssFullscreenStore.transform=G.style.transform,G.style.width=G._cssFullscreenStore.w+"px",G.style.height=G._cssFullscreenStore.h+"px",G.style.margin="",JXG$1.scaleJSXGraphDiv(z.id,N,q,JXG$1.evaluate(this.attr.fullscreen.scale)),z=null):JXG$1.exists(G._cssFullscreenStore)&&(G._cssFullscreenStore.isFullscreen=!1,G.style.margin=G._cssFullscreenStore.margin,G.style.width=G._cssFullscreenStore.width,G.style.height=G._cssFullscreenStore.height,G.style.transform=G._cssFullscreenStore.transform,G._cssFullscreenStore=null,G.parentElement.replaceWith(G)),this.updateCSSTransforms())},startFullscreenResizeObserver:function(v){var N=this;return!JXG$1.isBrowser||!this.attr.resize||!this.attr.resize.enabled?this:(this.resizeObserver=new ResizeObserver(function(G){var z,q,Y=N.document;N._isResizing||(N._isResizing=!0,window.setTimeout(function(){try{z=N._fullscreen_inner_id,Y.fullscreenElement!==void 0?q=Y.fullscreenElement:Y.webkitFullscreenElement!==void 0?q=Y.webkitFullscreenElement:q=Y.msFullscreenElement,q!==null&&JXG$1.scaleJSXGraphDiv(q.id,z,Y,JXG$1.evaluate(N.attr.fullscreen.scale))}catch{N.stopFullscreenResizeObserver(v)}finally{N._isResizing=!1}},N.attr.resize.throttle))}),this.resizeObserver.observe(v),this)},stopFullscreenResizeObserver:function(v){return!JXG$1.isBrowser||!this.attr.resize||!this.attr.resize.enabled?this:(JXG$1.exists(this.resizeObserver)&&this.resizeObserver.unobserve(v),this)},addLogEntry:function(v,N,G){var z,q,Y=this.userLog.length-1;return JXG$1.exists(N.elementClass)&&(q=N.id),JXG$1.evaluate(this.attr.logging.enabled)&&(z=new Date().getTime(),Y>=0&&this.userLog[Y].type===v&&this.userLog[Y].id===q&&z-this.userLog[Y].end<500?(this.userLog[Y].end=z,this.userLog[Y].endpos=G):this.userLog.push({type:v,id:q,start:z,startpos:G,end:z,endpos:G,bbox:this.getBoundingBox(),canvas:[this.canvasWidth,this.canvasHeight],zoom:[this.zoomX,this.zoomY]})),this},createRoulette:function(v,N,G,z,q,Y,W){var ie=this,ne=function(){var se=0,ae=0,ce=0,pe=G,ge=Numerics.root(function(tt){var Ke=v.X(pe),rt=v.Y(pe),it=N.X(tt),ot=N.Y(tt);return(Ke-it)*(Ke-it)+(rt-ot)*(rt-ot)},[0,Math.PI*2]),ve=0,be=0,Ee,Pe=ie.create("transform",[function(){return se}],{type:"rotate"}),Je=ie.create("transform",[function(){return se},function(){return v.X(pe)},function(){return v.Y(pe)}],{type:"rotate"}),Ce=ie.create("transform",[function(){return ae},function(){return ce}],{type:"translate"}),Ve=function(tt,Ke,rt){var it=Numerics.D(tt.X)(Ke),ot=Numerics.D(tt.Y)(Ke),ut=Numerics.D(tt.X)(rt),ct=Numerics.D(tt.Y)(rt),at=Numerics.D(tt.X)((Ke+rt)*.5),st=Numerics.D(tt.Y)((Ke+rt)*.5),pt=Mat.hypot(it,ot),lt=Mat.hypot(ut,ct),vt=Mat.hypot(at,st);return(pt+4*vt+lt)*(rt-Ke)/6},Re=function(tt){return Ee-Ve(N,ge,tt)},qe=Math.PI/18,et=qe*9,Ze=null;return this.rolling=function(){var tt,Ke,rt,it,ot;ve=pe+q*z,Ee=Ve(v,pe,ve),be=Numerics.root(Re,ge),tt=new Complex$1(v.X(ve),v.Y(ve)),Ke=new Complex$1(N.X(be),N.Y(be)),rt=new Complex$1(Numerics.D(v.X)(ve),Numerics.D(v.Y)(ve)),it=new Complex$1(Numerics.D(N.X)(be),Numerics.D(N.Y)(be)),ot=Complex$1.C.div(rt,it),se=Math.atan2(ot.imaginary,ot.real),ot.div(Complex$1.C.abs(ot)),ot.mult(Ke),ae=tt.real-ot.real,ce=tt.imaginary-ot.imaginary,se<-qe&&se>-et?(se=-qe,Je.applyOnce(W)):se>qe&&se<et?(se=qe,Je.applyOnce(W)):(Pe.applyOnce(W),Ce.applyOnce(W),pe=ve,ge=be),ie.update(
135)},this.start=function(){return Y>0&&(Ze=window.setInterval(this.rolling,Y)),this},this.stop=function(){return window.clearInterval(Ze),this},this};return new ne}});const Board=JXG$1.Board;JXG$1.SVGRenderer=function(v,N){var G;for(this.type="svg",this.isIE=navigator.appVersion.indexOf("MSIE")!==-1||navigator.userAgent.match(/Trident\//),this.svgRoot=null,this.svgNamespace="http://www.w3.org/2000/svg",this.xlinkNamespace="http://www.w3.org/1999/xlink",this.container=v,this.container.style.MozUserSelect="none",this.container.style.userSelect="none",this.container.style.overflow="hidden",this.container.style.position===""&&(this.container.style.position="relative"),this.svgRoot=this.container.ownerDocument.createElementNS(this.svgNamespace,"svg"),this.svgRoot.style.overflow="hidden",this.svgRoot.style.display="block",this.resize(N.width,N.height),this.container.appendChild(this.svgRoot),this.defs=this.container.ownerDocument.createElementNS(this.svgNamespace,"defs"),this.svgRoot.appendChild(this.defs),this.createShadowFilter=function(z,q,Y,W,ie,ne){var se=this.container.ownerDocument.createElementNS(this.svgNamespace,"filter"),ae,ce,pe,ge,ve;return se.setAttributeNS(null,"id",z),se.setAttributeNS(null,"width","300%"),se.setAttributeNS(null,"height","300%"),se.setAttributeNS(null,"filterUnits","userSpaceOnUse"),ae=this.container.ownerDocument.createElementNS(this.svgNamespace,"feOffset"),ae.setAttributeNS(null,"in","SourceGraphic"),ae.setAttributeNS(null,"result","offOut"),ae.setAttributeNS(null,"dx",ne[0]),ae.setAttributeNS(null,"dy",ne[1]),se.appendChild(ae),ce=this.container.ownerDocument.createElementNS(this.svgNamespace,"feColorMatrix"),ce.setAttributeNS(null,"in","offOut"),ce.setAttributeNS(null,"result","colorOut"),ce.setAttributeNS(null,"type","matrix"),q==="none"||!JXG$1.isArray(q)||q.length<3?ce.setAttributeNS(null,"values","0.1 0 0 0 0  0 0.1 0 0 0  0 0 0.1 0 0  0 0 0 "+Y+" 0"):(q[0]/=255,q[1]/=255,q[2]/=255,ve=W+" 0 0 0 "+q[0]+"  0 "+W+" 0 0 "+q[1]+"  0 0 "+W+" 0 "+q[2]+"  0 0 0 "+Y+" 0",ce.setAttributeNS(null,"values",ve)),se.appendChild(ce),pe=this.container.ownerDocument.createElementNS(this.svgNamespace,"feGaussianBlur"),pe.setAttributeNS(null,"in","colorOut"),pe.setAttributeNS(null,"result","blurOut"),pe.setAttributeNS(null,"stdDeviation",ie),se.appendChild(pe),ge=this.container.ownerDocument.createElementNS(this.svgNamespace,"feBlend"),ge.setAttributeNS(null,"in","SourceGraphic"),ge.setAttributeNS(null,"in2","blurOut"),ge.setAttributeNS(null,"mode","normal"),se.appendChild(ge),se},this.uniqName=function(){return this.container.id+"_"+Array.prototype.slice.call(arguments).join("_")},this.toStr=function(){var z=Array.prototype.slice.call(arguments).join("");return JXG$1.exists(CSS)&&JXG$1.exists(CSS.escape)&&(z=CSS.escape(z)),z},this.toURL=function(){return"url(#"+this.toStr.apply(this,arguments)+")"},this.defs.appendChild(this.createShadowFilter(this.uniqName("f1"),"none",1,.1,3,[5,5])),this.layer=[],G=0;G<Options.layer.numlayers;G++)this.layer[G]=this.container.ownerDocument.createElementNS(this.svgNamespace,"g"),this.svgRoot.appendChild(this.layer[G]);try{this.foreignObjLayer=this.container.ownerDocument.createElementNS(this.svgNamespace,"foreignObject"),this.foreignObjLayer.setAttribute("display","none"),this.foreignObjLayer.setAttribute("x",0),this.foreignObjLayer.setAttribute("y",0),this.foreignObjLayer.setAttribute("width","100%"),this.foreignObjLayer.setAttribute("height","100%"),this.foreignObjLayer.setAttribute("id",this.uniqName("foreignObj")),this.svgRoot.appendChild(this.foreignObjLayer),this.supportsForeignObject=!0}catch{this.supportsForeignObject=!1}};JXG$1.SVGRenderer.prototype=new AbstractRenderer;JXG$1.extend(JXG$1.SVGRenderer.prototype,{_createArrowHead:function(v,N,G){var z,q,Y=v.id+"Triangle",W,ie;return JXG$1.exists(N)&&(Y+=N),JXG$1.exists(G)&&(Y+=G),z=this.createPrim("marker",Y),z.setAttributeNS(null,"stroke",v.evalVisProp("strokecolor")),z.setAttributeNS(null,"stroke-opacity",v.evalVisProp("strokeopacity")),z.setAttributeNS(null,"fill",v.evalVisProp("strokecolor")),z.setAttributeNS(null,"fill-opacity",v.evalVisProp("strokeopacity")),z.setAttributeNS(null,"
135stroke-width",0),z.setAttributeNS(null,"orient","auto"),z.setAttributeNS(null,"markerUnits","strokeWidth"),q=this.container.ownerDocument.createElementNS(this.svgNamespace,"path"),ie=5,N==="Start"?(W=0,G===2?q.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 L 5,5 z"):G===3?q.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z"):G===4?(ie=3.31,q.setAttributeNS(null,"d","M 0.00,3.31 C 3.53,3.84 7.13,4.50 10.00,6.63 C 9.33,5.52 8.67,4.42 8.00,3.31 C 8.67,2.21 9.33,1.10 10.00,0.00 C 7.13,2.13 3.53,2.79 0.00,3.31")):G===5?(ie=3.28,q.setAttributeNS(null,"d","M 0.00,3.28 C 3.39,4.19 6.81,5.07 10.00,6.55 C 9.38,5.56 9.00,4.44 9.00,3.28 C 9.00,2.11 9.38,0.99 10.00,0.00 C 6.81,1.49 3.39,2.37 0.00,3.28")):G===6?(ie=2.84,q.setAttributeNS(null,"d","M 0.00,2.84 C 3.39,3.59 6.79,4.35 10.00,5.68 C 9.67,4.73 9.33,3.78 9.00,2.84 C 9.33,1.89 9.67,0.95 10.00,0.00 C 6.79,1.33 3.39,2.09 0.00,2.84")):G===7?(ie=5.2,q.setAttributeNS(null,"d","M 0.00,5.20 C 4.04,5.20 7.99,6.92 10.00,10.39 M 10.00,0.00 C 7.99,3.47 4.04,5.20 0.00,5.20")):q.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 z"),v.elementClass===Const.OBJECT_CLASS_LINE&&(G===2?W=4.9:G===3?W=3.3:G===4||G===5||G===6?W=6.66:G===7?W=0:W=10)):(W=10,G===2?q.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 L 5,5 z"):G===3?(W=3.3,q.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z")):G===4?(ie=3.31,q.setAttributeNS(null,"d","M 10.00,3.31 C 6.47,3.84 2.87,4.50 0.00,6.63 C 0.67,5.52 1.33,4.42 2.00,3.31 C 1.33,2.21 0.67,1.10 0.00,0.00 C 2.87,2.13 6.47,2.79 10.00,3.31")):G===5?(ie=3.28,q.setAttributeNS(null,"d","M 10.00,3.28 C 6.61,4.19 3.19,5.07 0.00,6.55 C 0.62,5.56 1.00,4.44 1.00,3.28 C 1.00,2.11 0.62,0.99 0.00,0.00 C 3.19,1.49 6.61,2.37 10.00,3.28")):G===6?(ie=2.84,q.setAttributeNS(null,"d","M 10.00,2.84 C 6.61,3.59 3.21,4.35 0.00,5.68 C 0.33,4.73 0.67,3.78 1.00,2.84 C 0.67,1.89 0.33,0.95 0.00,0.00 C 3.21,1.33 6.61,2.09 10.00,2.84")):G===7?(ie=5.2,q.setAttributeNS(null,"d","M 10.00,5.20 C 5.96,5.20 2.01,6.92 0.00,10.39 M 0.00,0.00 C 2.01,3.47 5.96,5.20 10.00,5.20")):q.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 z"),v.elementClass===Const.OBJECT_CLASS_LINE&&(G===2?W=5.1:G===3?W=.02:G===4||G===5||G===6?W=3.33:G===7?W=10:W=.05)),G===7&&(z.setAttributeNS(null,"fill","none"),z.setAttributeNS(null,"stroke-width",1)),z.setAttributeNS(null,"refY",ie),z.setAttributeNS(null,"refX",W),z.appendChild(q),z},_setArrowColor:function(v,N,G,z,q){v&&(JXG$1.isString(N)&&(q!==7?this._setAttribute(function(){v.setAttributeNS(null,"stroke",N),v.setAttributeNS(null,"fill",N),v.setAttributeNS(null,"stroke-opacity",G),v.setAttributeNS(null,"fill-opacity",G)},z.visPropOld.fillcolor):this._setAttribute(function(){v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"stroke",N),v.setAttributeNS(null,"stroke-opacity",G)},z.visPropOld.fillcolor)),z.rendNode.parentNode.insertBefore(z.rendNode,z.rendNode))},_setArrowWidth:function(v,N,G,z){var q,Y;v&&(q=N,Y=q*z,v.setAttributeNS(null,"viewBox","0 0 "+q*10+" "+q*10),v.setAttributeNS(null,"markerHeight",Y),v.setAttributeNS(null,"markerWidth",Y),v.setAttributeNS(null,"display","inherit"),G.parentNode.insertBefore(G,G))},updateTicks:function(v){var N,G,z,q,Y,W,ie="",ne=v.ticks.length,se,ae,ce=!0;for(N=0;N<ne;N++){for(z=v.ticks[N],Y=z[0],W=z[1],se=Y.length,ae=" M "+Y[0]+" "+W[0],JXG$1.isNumber(Y[0])||(ce=!1),G=1;ce&&G<se;++G)JXG$1.isNumber(Y[G])?ae+=" L "+Y[G]+" "+W[G]:ce=!1;ce&&(ie+=ae)}q=v.rendNode,JXG$1.exists(q)||(q=this.createPrim("path",v.id),this.appendChildPrim(q,v.evalVisProp("layer")),v.rendNode=q),q.setAttributeNS(null,"stroke",v.evalVisProp("strokecolor")),q.setAttributeNS(null,"fill","none"),q.setAttributeNS(null,"stroke-opacity",v.evalVisProp("strokeopacity")),q.setAttributeNS(null,"stroke-width",v.evalVisProp("strokewidth")),this.updatePathPrim(q,ie,v.board)},displayCopyright:function(v,N){var G=this.createPrim("text","licenseText"),z;G.setAttributeNS(null,"x","20px"),G.setAttributeNS(null,"y",2+N+"px"),G.setAttributeNS(null,"style","font-family:Arial,Helvetica,sans-serif; font-size:"+N+"px; fill:#356AA0;  opacity:0.3;"),z=this.container.ownerDocument.createTextNode(v),G.setAttributeNS(null,"aria-hidden","true"),G.appendChild(z),this.appendChildPrim(G,0)},drawInternalText:function(v){var N=this.createPrim("text",v.id);return N.style.whiteSpace="nowrap",v.rendNodeText=this.container.ownerDocument.createTextNode(""),N.appendChild(v.rendNodeText),this.appendChildPrim(N,v.evalVisProp("layer")),N},updateInternalText:function(v){var N=v.plaintext,G,z,q=v.getAnchorX(),Y=v.getAnchorY();z=v.evalVisProp("cssclass"),v.rendNode.getAttributeNS(null,"class")!==z&&(v.rendNode.setAttributeNS(null,"class",z),v.needsSizeUpdate=!0),isNaN(v.coords.scrCoords[1]+v.coords.scrCoords[2])||(G=v.coords.scrCoords[1],v.visPropOld.left!==q+G&&(v.rendNode.setAttributeNS(null,"x",G+"px"),q==="left"?v.rendNode.setAttributeNS(null,"text-anchor","start"):q==="right"?v.rendNode.setAttributeNS(null,"text-anchor","end"):q==="middle"&&v.rendNode.setAttributeNS(null,"text-anchor","middle"),v.visPropOld.left=q+G),G=v.coords.scrCoords[2],v.visPropOld.top!==Y+G&&(v.rendNode.setAttributeNS(null,"y",G+this.vOffsetText*.5+"px"),Y==="bottom"?(v.rendNode.setAttributeNS(null,"dy","0"),v.rendNode.setAttributeNS(null,"dominant-baseline","auto")):Y==="top"?(v.rendNode.setAttributeNS(null,"dy","1.6ex"),v.rendNode.setAttributeNS(null,"dominant-baseline","auto")):Y==="middle"&&(v.rendNode.setAttributeNS(null,"dy","0.6ex"),v.rendNode.setAttributeNS(null,"dominant-baseline","auto")),v.visPropOld.top=Y+G)),v.htmlStr!==N&&(v.rendNodeText.data=N,v.htmlStr=N),this.transformRect
135(v,v.transformations)},updateInternalTextStyle:function(v,N,G,z){this.setObjectFillColor(v,N,G)},drawImage:function(v){var N=this.createPrim("image",v.id);N.setAttributeNS(null,"preserveAspectRatio","none"),this.appendChildPrim(N,v.evalVisProp("layer")),v.rendNode=N,this.updateImage(v)},transformRect:function(v,N){var G,z,q,Y="",W,ie,ne=N.length;if(ne>0&&(q=v.rendNode,z=this.joinTransforms(v,N),G=[z[1][1],z[2][1],z[1][2],z[2][2],z[1][0],z[2][0]].join(","),G.indexOf("NaN")===-1))if(Y+=" matrix("+G+") ",v.elementClass===Const.OBJECT_CLASS_TEXT&&v.visProp.display==="html"){switch(q.style.transform=Y,W=-v.coords.scrCoords[1],ie=-v.coords.scrCoords[2],v.evalVisProp("anchorx")){case"right":W+=v.size[0];break;case"middle":W+=v.size[0]*.5;break}switch(v.evalVisProp("anchory")){case"bottom":ie+=v.size[1];break;case"middle":ie+=v.size[1]*.5;break}q.style["transform-origin"]=W+"px "+ie+"px"}else q.setAttributeNS(null,"transform",Y)},updateImageURL:function(v){var N=v.eval(v.url);return v._src!==N?(v.imgIsLoaded=!1,v.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",N),v._src=N,!0):!1},updateImageStyle:function(v,N){var G=v.evalVisProp(N?"highlightcssclass":"cssclass");v.rendNode.setAttributeNS(null,"class",G)},drawForeignObject:function(v){v.rendNode=this.appendChildPrim(this.createPrim("foreignObject",v.id),v.evalVisProp("layer")),this.appendNodesToElement(v,"foreignObject"),this.updateForeignObject(v)},updateForeignObject:function(v){v._useUserSize?v.rendNode.style.overflow="hidden":v.rendNode.style.overflow="visible",this.updateRectPrim(v.rendNode,v.coords.scrCoords[1],v.coords.scrCoords[2]-v.size[1],v.size[0],v.size[1]),(v.evalVisProp("evaluateOnlyOnce")!==!0||!v.renderedOnce)&&(v.rendNode.innerHTML=v.content,v.renderedOnce=!0),this._updateVisual(v,{stroke:!0,dash:!0},!0)},appendChildPrim:function(v,N){return JXG$1.exists(N)?N>=Options.layer.numlayers&&(N=Options.layer.numlayers-1):N=0,this.layer[N].appendChild(v),v},createPrim:function(v,N){var G=this.container.ownerDocument.createElementNS(this.svgNamespace,v);return G.setAttributeNS(null,"id",this.uniqName(N)),G.style.position="absolute",v==="path"&&(G.setAttributeNS(null,"stroke-linecap","round"),G.setAttributeNS(null,"stroke-linejoin","round"),G.setAttributeNS(null,"fill-rule","evenodd")),G},remove:function(v){JXG$1.exists(v)&&JXG$1.exists(v.parentNode)&&v.parentNode.removeChild(v)},setLayer:function(v,N){JXG$1.exists(N)?N>=Options.layer.numlayers&&(N=Options.layer.numlayers-1):N=0,this.layer[N].appendChild(v.rendNode)},makeArrows:function(v,N){var G,z,q=N.evFirst,Y=N.evLast;if(this.isIE&&v.visPropCalc.visible&&(q||Y)){v.rendNode.parentNode.insertBefore(v.rendNode,v.rendNode);return}G=v.rendNodeTriangleStart,q?(z=this.toStr(this.container.id,"_",v.id,"TriangleStart",N.typeFirst),(!JXG$1.exists(G)||G.id!==z)&&(G=this.container.ownerDocument.getElementById(z),G===null&&(G=this._createArrowHead(v,"Start",N.typeFirst),this.defs.appendChild(G)),v.rendNodeTriangleStart=G,v.rendNode.setAttributeNS(null,"marker-start",this.toURL(z)))):(JXG$1.exists(G)&&(this.remove(G),v.rendNodeTriangleStart=null),v.rendNode.setAttributeNS(null,"marker-start",null)),G=v.rendNodeTriangleEnd,Y?(z=this.toStr(this.container.id,"_",v.id,"TriangleEnd",N.typeLast),(!JXG$1.exists(G)||G.id!==z)&&(G=this.container.ownerDocument.getElementById(z),G===null&&(G=this._createArrowHead(v,"End",N.typeLast),this.defs.appendChild(G)),v.rendNodeTriangleEnd=G,v.rendNode.setAttributeNS(null,"marker-end",this.toURL(z)))):(JXG$1.exists(G)&&(this.remove(G),v.rendNodeTriangleEnd=null),v.rendNode.setAttributeNS(null,"marker-end",null))},updateEllipsePrim:function(v,N,G,z,q){var Y=1e6;Y=2e5,N=Math.abs(N)<Y?N:Y*N/Math.abs(N),G=Math.abs(G)<Y?G:Y*G/Math.abs(G),z=Math.abs(z)<Y?z:Y*z/Math.abs(z),q=Math.abs(q)<Y?q:Y*q/Math.abs(q),v.setAttributeNS(null,"cx",N),v.setAttributeNS(null,"cy",G),v.setAttributeNS(null,"rx",Math.abs(z)),v.setAttributeNS(null,"ry",Math.abs(q))},updateLinePrim:function(v,N,G,z,q){var Y=1e6;Y=2e5,isNaN(N+G+z+q)||(N=Math.abs(N)<Y?N:Y*N/Math.abs(N),G=Math.abs(G)<Y?G:Y*G/Math.abs(G),z=Math.abs(z)<Y?z:Y*z/Math.abs(z),q=Math.abs(q)<Y?q:Y*q/Math.abs(q),v.setAttributeNS(null,"x1",N),v.setAttributeNS(null,"y1",G),v.setAttributeNS(null,"x2",z),v.setAttributeNS(null,"y2",q))},updatePathPrim:function(v,N){N===""&&(N="M 0 0"),v.setAttributeNS(null,"d",N)}
135,updatePathStringPoint:function(v,N,G){var z="",q=v.coords.scrCoords,Y=N*Math.sqrt(3)*.5,W=N*.5;return G==="x"?z=" M "+(q[1]-N)+" "+(q[2]-N)+" L "+(q[1]+N)+" "+(q[2]+N)+" M "+(q[1]+N)+" "+(q[2]-N)+" L "+(q[1]-N)+" "+(q[2]+N):G==="+"?z=" M "+(q[1]-N)+" "+q[2]+" L "+(q[1]+N)+" "+q[2]+" M "+q[1]+" "+(q[2]-N)+" L "+q[1]+" "+(q[2]+N):G==="|"?z=" M "+q[1]+" "+(q[2]-N)+" L "+q[1]+" "+(q[2]+N):G==="-"?z=" M "+(q[1]-N)+" "+q[2]+" L "+(q[1]+N)+" "+q[2]:G==="<>"||G==="<<>>"?(G==="<<>>"&&(N*=1.41),z=" M "+(q[1]-N)+" "+q[2]+" L "+q[1]+" "+(q[2]+N)+" L "+(q[1]+N)+" "+q[2]+" L "+q[1]+" "+(q[2]-N)+" Z "):G==="^"?z=" M "+q[1]+" "+(q[2]-N)+" L "+(q[1]-Y)+" "+(q[2]+W)+" L "+(q[1]+Y)+" "+(q[2]+W)+" Z ":G==="v"?z=" M "+q[1]+" "+(q[2]+N)+" L "+(q[1]-Y)+" "+(q[2]-W)+" L "+(q[1]+Y)+" "+(q[2]-W)+" Z ":G===">"?z=" M "+(q[1]+N)+" "+q[2]+" L "+(q[1]-W)+" "+(q[2]-Y)+" L "+(q[1]-W)+" "+(q[2]+Y)+" Z ":G==="<"&&(z=" M "+(q[1]-N)+" "+q[2]+" L "+(q[1]+W)+" "+(q[2]-Y)+" L "+(q[1]+W)+" "+(q[2]+Y)+" Z "),z},updatePathStringPrim:function(v){var N,G,z,q=" M ",Y=" L ",W=" C ",ie=q,ne=5e3,se="";if(v.numberPoints<=0)return"";if(z=Math.min(v.points.length,v.numberPoints),v.bezierDegree===1)for(N=0;N<z;N++)G=v.points[N].scrCoords,isNaN(G[1])||isNaN(G[2])?ie=q:(G[1]=Math.max(Math.min(G[1],ne),-5e3),G[2]=Math.max(Math.min(G[2],ne),-5e3),se+=ie+G[1]+" "+G[2],ie=Y);else if(v.bezierDegree===3)for(N=0;N<z;)G=v.points[N].scrCoords,isNaN(G[1])||isNaN(G[2])?ie=q:(se+=ie+G[1]+" "+G[2],ie===W&&(N+=1,G=v.points[N].scrCoords,se+=" "+G[1]+" "+G[2],N+=1,G=v.points[N].scrCoords,se+=" "+G[1]+" "+G[2]),ie=W),N+=1;return se},updatePathStringBezierPrim:function(v){var N,G,z,q,Y,W,ie,ne=" M ",se=" C ",ae=ne,ce=5e3,pe="",ge=v.evalVisProp("strokewidth"),ve=v.evalVisProp("curvetype")!=="plot";if(v.numberPoints<=0)return"";for(ve&&v.board.options.curve.RDPsmoothing&&(v.points=Numerics.RamerDouglasPeucker(v.points,.5)),ie=Math.min(v.points.length,v.numberPoints),G=1;G<3;G++)for(ae=ne,N=0;N<ie;N++)q=v.points[N].scrCoords,isNaN(q[1])||isNaN(q[2])?ae=ne:(q[1]=Math.max(Math.min(q[1],ce),-5e3),q[2]=Math.max(Math.min(q[2],ce),-5e3),ae===ne?pe+=ae+q[1]+" "+q[2]:(z=2*G,pe+=[ae,Y+(q[1]-Y)*.333+ge*(z*Math.random()-G)," ",W+(q[2]-W)*.333+ge*(z*Math.random()-G)," ",Y+(q[1]-Y)*.666+ge*(z*Math.random()-G)," ",W+(q[2]-W)*.666+ge*(z*Math.random()-G)," ",q[1]," ",q[2]].join("")),ae=se,Y=q[1],W=q[2]);return pe},updatePolygonPrim:function(v,N){var G,z="",q,Y=N.vertices.length;for(v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"fill-rule","evenodd"),N.elType==="polygonalchain"&&Y++,G=0;G<Y-1;G++){if(N.vertices[G].isReal)q=N.vertices[G].coords.scrCoords,z=z+q[1]+","+q[2];else{v.setAttributeNS(null,"points","");return}G<Y-2&&(z+=" ")}z.indexOf("NaN")===-1&&v.setAttributeNS(null,"points",z)},updateRectPrim:function(v,N,G,z,q){v.setAttributeNS(null,"x",N),v.setAttributeNS(null,"y",G),v.setAttributeNS(null,"width",z),v.setAttributeNS(null,"height",q)},_setAttribute:function(v,N){N===""?v():window.setTimeout(v,1)},display:function(v,N){var G;v&&v.rendNode&&(v.visPropOld.visible=N,G=v.rendNode,N?(G.setAttributeNS(null,"display","inline"),G.style.visibility="inherit"):(G.setAttributeNS(null,"display","none"),G.style.visibility="hidden"))},hide:function(v){JXG$1.deprecated("Board.renderer.hide()","Board.renderer.display()"),this.display(v,!1)},setARIA:function(v){var N,G,z;for(N in v.visProp.aria)v.visProp.aria.hasOwnProperty(N)&&N!=="enabled"&&(G="aria."+N,z=v.evalVisProp("aria."+N),v.visPropOld[G]!==z&&(this.setPropertyPrim(v.rendNode,"aria-"+N,z),v.visPropOld[G]=z))},setBuffering:function(v,N){v.rendNode.setAttribute("buffered-rendering",N)},setCssClass(v,N){v.visPropOld.cssclass!==N&&(this.setPropertyPrim(v.rendNode,"class",N),v.visPropOld.cssclass=N)},setDashStyle:function(v){var N=v.evalVisProp("dash"),G=v.evalVisProp("dashscale"),z=G?.5*v.evalVisProp("strokewidth"):1,q=v.rendNode;N>0?q.setAttributeNS(null,"stroke-dasharray",this.dashArray[N-1].map(function(Y){return Y*z}).join(",")):q.hasAttributeNS(null,"stroke-dasharray")&&q.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(v){var N=v.rendNode,G,z,q,Y=v.evalVisProp("gradient");Y==="linear"||Y==="radial"?(G=this.createPrim(Y+"Gradient",v.id+"_gradient"),z=this.createPrim("stop",v.id+"_gradient1"),q=this.createPrim("stop",v.id+"_gradient2"),G.appendChild(z),G.appendChild(q),this.defs.appendChild(G),N.setAttributeNS(null,"
135style","fill:"+this.toURL(this.container.id+"_"+v.id+"_gradient")),v.gradNode1=z,v.gradNode2=q,v.gradNode=G):N.removeAttributeNS(null,"style")},setLineCap:function(v){var N=v.evalVisProp("linecap");N===void 0||N===""||v.visPropOld.linecap===N||!JXG$1.exists(v.rendNode)||(this.setPropertyPrim(v.rendNode,"stroke-linecap",N),v.visPropOld.linecap=N)},setObjectFillColor:function(v,N,G,z){var q,Y,W,ie,ne=N,se=G,ae=v.evalVisProp("gradient");se=se>0?se:0,!(v.visPropOld.fillcolor===ne&&v.visPropOld.fillopacity===se&&ae===null)&&(JXG$1.exists(ne)&&ne!==!1&&(ne.length!==9?(Y=ne,ie=se):(W=JXG$1.rgba2rgbo(ne),Y=W[0],ie=se*W[1]),z===void 0?q=v.rendNode:q=z,Y!=="none"&&this._setAttribute(function(){q.setAttributeNS(null,"fill",Y)},v.visPropOld.fillcolor),v.type===JXG$1.OBJECT_TYPE_IMAGE?this._setAttribute(function(){q.setAttributeNS(null,"opacity",ie)},v.visPropOld.fillopacity):(Y==="none"?(ie=0,q.setAttributeNS(null,"pointer-events","visibleStroke")):q.setAttributeNS(null,"pointer-events","visiblePainted"),this._setAttribute(function(){q.setAttributeNS(null,"fill-opacity",ie)},v.visPropOld.fillopacity)),(ae==="linear"||ae==="radial")&&this.updateGradient(v)),v.visPropOld.fillcolor=ne,v.visPropOld.fillopacity=se)},setObjectStrokeColor:function(v,N,G){var z=N,q,Y,W=G,ie,ne;W=W>0?W:0,!(v.visPropOld.strokecolor===z&&v.visPropOld.strokeopacity===W)&&(JXG$1.exists(z)&&z!==!1&&(z.length!==9?(q=z,ie=W):(Y=JXG$1.rgba2rgbo(z),q=Y[0],ie=W*Y[1]),ne=v.rendNode,v.elementClass===Const.OBJECT_CLASS_TEXT?v.evalVisProp("display")==="html"?this._setAttribute(function(){ne.style.color=q,ne.style.opacity=ie},v.visPropOld.strokecolor):this._setAttribute(function(){ne.setAttributeNS(null,"style","fill:"+q),ne.setAttributeNS(null,"style","fill-opacity:"+ie)},v.visPropOld.strokecolor):this._setAttribute(function(){ne.setAttributeNS(null,"stroke",q),ne.setAttributeNS(null,"stroke-opacity",ie)},v.visPropOld.strokecolor),(v.elementClass===Const.OBJECT_CLASS_CURVE||v.elementClass===Const.OBJECT_CLASS_LINE)&&(v.evalVisProp("firstarrow")&&this._setArrowColor(v.rendNodeTriangleStart,q,ie,v,v.visPropCalc.typeFirst),v.evalVisProp("lastarrow")&&this._setArrowColor(v.rendNodeTriangleEnd,q,ie,v,v.visPropCalc.typeLast))),v.visPropOld.strokecolor=z,v.visPropOld.strokeopacity=W)},setObjectStrokeWidth:function(v,N){var G,z=N;isNaN(z)||v.visPropOld.strokewidth===z||(G=v.rendNode,this.setPropertyPrim(G,"stroked","true"),JXG$1.exists(z)&&this.setPropertyPrim(G,"stroke-width",z+"px"),v.visPropOld.strokewidth=z)},setObjectTransition:function(v,N){var G,z,q=[],Y,W,ie=0,ne=["rendNode","rendNodeTriangleStart","rendNodeTriangleEnd"];if(N===void 0&&(N=v.evalVisProp("transitionduration")),z=v.evalVisProp("transitionproperties"),!(N===v.visPropOld.transitionduration&&z===v.visPropOld.transitionproperties)){for(JXG$1.exists(z)&&(ie=z.length),W=0;W<ie;W++)q.push(z[W]+" "+N+"ms");for(Y=q.join(", "),ie=ne.length,W=0;W<ie;++W)v[ne[W]]&&(G=v[ne[W]],G.style.transition=Y);v.visPropOld.transitionduration=N,v.visPropOld.transitionproperties=z}},setShadow:function(v){var N=v.evalVisProp("shadow"),G,z,q,Y,W,ie,ne,se,ae=!0,ce=!1;G=JSON.stringify(N),G!==v.visPropOld.shadow&&(typeof N=="boolean"?(ae=!0,ce=N,z="none",q=3,Y=.1,W=[5,5],ie=1):v.evalVisProp("shadow.enabled")?(ae=!1,ce=!0,z=JXG$1.rgbParser(v.evalVisProp("shadow.color")),q=v.evalVisProp("shadow.blur"),Y=v.evalVisProp("shadow.blend"),W=v.evalVisProp("shadow.offset"),ie=v.evalVisProp("shadow.opacity")):ce=!1,JXG$1.exists(v.rendNode)&&(ce?ae?v.rendNode.setAttributeNS(null,"filter",this.toURL(this.container.id+"_f1")):(se=this.container.ownerDocument.getElementById(ne),se&&this.defs.removeChild(se),ne=v.rendNode.id+"_f1",this.defs.appendChild(this.createShadowFilter(ne,z,ie,Y,q,W)),v.rendNode.setAttributeNS(null,"filter",this.toURL(ne))):v.rendNode.removeAttributeNS(null,"filter")),v.visPropOld.shadow=G)},setTabindex:function(v){var N;v.board.attr.keyboard.enabled&&JXG$1.exists(v.rendNode)&&(N=v.evalVisProp("tabindex"),v.visPropCalc.visible||(N=null),N!==v.visPropOld.tabindex&&(v.rendNode.setAttribute("tabindex",N),v.visPropOld.tabindex=N))},setPropertyPrim:function(v,N,G){N!=="stroked"&&v.setAttributeNS(null,N,G)},show:function(v){JXG$1.deprecated("Board.renderer.show()","Board.renderer.display()"),this.display(v,!0)},updateGradient:function(v){var N,G,z=v.gradNode1,q=v.gradNode2,Y=v.evalVisProp("gradient");!JXG$1.exists(z)||!JXG$1.exists(q)||(G=v.evalVisProp("fillopacity"),G=G>
1350?G:0,N=v.evalVisProp("fillcolor"),z.setAttributeNS(null,"style","stop-color:"+N+";stop-opacity:"+G),q.setAttributeNS(null,"style","stop-color:"+v.evalVisProp("gradientsecondcolor")+";stop-opacity:"+v.evalVisProp("gradientsecondopacity")),z.setAttributeNS(null,"offset",v.evalVisProp("gradientstartoffset")*100+"%"),q.setAttributeNS(null,"offset",v.evalVisProp("gradientendoffset")*100+"%"),Y==="linear"?this.updateGradientAngle(v.gradNode,v.evalVisProp("gradientangle")):Y==="radial"&&this.updateGradientCircle(v.gradNode,v.evalVisProp("gradientcx"),v.evalVisProp("gradientcy"),v.evalVisProp("gradientr"),v.evalVisProp("gradientfx"),v.evalVisProp("gradientfy"),v.evalVisProp("gradientfr")))},updateGradientAngle:function(v,N){var G=1,z=Math.cos(N),q=Math.sin(N);Math.abs(z)>Math.abs(q)?G/=Math.abs(z):G/=Math.abs(q),z>=0?(v.setAttributeNS(null,"x1",0),v.setAttributeNS(null,"x2",z*G)):(v.setAttributeNS(null,"x1",-z*G),v.setAttributeNS(null,"x2",0)),q>=0?(v.setAttributeNS(null,"y1",0),v.setAttributeNS(null,"y2",q*G)):(v.setAttributeNS(null,"y1",-q*G),v.setAttributeNS(null,"y2",0))},updateGradientCircle:function(v,N,G,z,q,Y,W){v.setAttributeNS(null,"cx",N*100+"%"),v.setAttributeNS(null,"cy",G*100+"%"),v.setAttributeNS(null,"r",z*100+"%"),v.setAttributeNS(null,"fx",q*100+"%"),v.setAttributeNS(null,"fy",Y*100+"%"),v.setAttributeNS(null,"fr",W*100+"%")},suspendRedraw:function(){this.suspendHandle=this.svgRoot.suspendRedraw(1e4)}
135,unsuspendRedraw:function(){this.svgRoot.unsuspendRedraw(this.suspendHandle)},resize:function(v,N){this.svgRoot.setAttribute("width",parseFloat(v)),this.svgRoot.setAttribute("height",parseFloat(N))},createTouchpoints:function(v){var N,G,z,q;for(this.touchpoints=[],N=0;N<v;N++)G="touchpoint1_"+N,q=this.createPrim("path",G),this.appendChildPrim(q,19),q.setAttributeNS(null,"d","M 0 0"),this.touchpoints.push(q),this.setPropertyPrim(q,"stroked","true"),this.setPropertyPrim(q,"stroke-width","1px"),q.setAttributeNS(null,"stroke","#000000"),q.setAttributeNS(null,"stroke-opacity",1),q.setAttributeNS(null,"display","none"),z="touchpoint2_"+N,q=this.createPrim("ellipse",z),this.appendChildPrim(q,19),this.updateEllipsePrim(q,0,0,0,0),this.touchpoints.push(q),this.setPropertyPrim(q,"stroked","true"),this.setPropertyPrim(q,"stroke-width","1px"),q.setAttributeNS(null,"stroke","#000000"),q.setAttributeNS(null,"stroke-opacity",1),q.setAttributeNS(null,"fill","#ffffff"),q.setAttributeNS(null,"fill-opacity",0),q.setAttributeNS(null,"display","none")},showTouchpoint:function(v){this.touchpoints&&v>=0&&2*v<this.touchpoints.length&&(this.touchpoints[2*v].setAttributeNS(null,"display","inline"),this.touchpoints[2*v+1].setAttributeNS(null,"display","inline"))},hideTouchpoint:function(v){this.touchpoints&&v>=0&&2*v<this.touchpoints.length&&(this.touchpoints[2*v].setAttributeNS(null,"display","none"),this.touchpoints[2*v+1].setAttributeNS(null,"display","none"))},updateTouchpoint:function(v,N){var G,z,q=37;this.touchpoints&&v>=0&&2*v<this.touchpoints.length&&(G=N[0],z=N[1],this.touchpoints[2*v].setAttributeNS(null,"d","M "+(G-q)+" "+z+" L "+(G+q)+" "+z+" M "+G+" "+(z-q)+" L "+G+" "+(z+q)),this.updateEllipsePrim(this.touchpoints[2*v+1],N[0],N[1],25,25))},_getValuesOfDOMElements:function(v){var N=[];if(v.nodeType===1)for(v=v.firstChild;v;)v.id!==void 0&&v.value!==void 0&&N.push([v.id,v.value]),JXG$1.concat(N,this._getValuesOfDOMElements(v)),v=v.nextSibling;return N},_getImgDataURL:function(v){var N,G,z,q,Y,W;if(N=v.getElementsByTagName("image"),G=N.length,G>0)for(z=document.createElement("canvas"),W=0;W<G;W++){N[W].setAttribute("crossorigin","anonymous"),q=z.getContext("2d"),z.width=N[W].getAttribute("width"),z.height=N[W].getAttribute("height");try{q.drawImage(N[W],0,0,z.width,z.height),Y=z.toDataURL(),N[W].setAttribute("xlink:href",Y)}catch(ie){console.log("CORS problem! Image can not be used",ie)}}return!0},dumpToDataURI:function(v){var N=this.svgRoot,G=window.btoa||Base64.encode,z,q,Y,W=[];if(this.container.hasChildNodes()&&JXG$1.exists(this.foreignObjLayer))for(v||this.foreignObjLayer.setAttribute("display","inline");N.nextSibling;)JXG$1.concat(W,this._getValuesOfDOMElements(N.nextSibling)),this.foreignObjLayer.appendChild(N.nextSibling);if(this._getImgDataURL(N),N.setAttribute("xmlns","http://www.w3.org/2000/svg"),z=new XMLSerializer().serializeToString(N),v!==!0)for(Y=W.length,q=0;q<Y;q++)z=z.replace('id="'+W[q][0]+'"','id="'+W[q][0]+'" value="'+W[q][1]+'"');if(this.isIE&&(z.match(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g)||[]).length>1&&(z=z.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g,"")),z=z.replace(/&nbsp;/g," "),JXG$1.exists(this.foreignObjLayer)&&this.foreignObjLayer.hasChildNodes()){for(;this.foreignObjLayer.firstChild;)this.container.appendChild(this.foreignObjLayer.firstChild);this.foreignObjLayer.setAttribute("display","none")}return"data:image/svg+xml;base64,"+G(unescape(encodeURIComponent(z)))},dumpToCanvas:function(v,N,G,z){var q,Y,W,ie,ne=this.container.ownerDocument;return W=ne.getElementById(v),W.width=W.width,ie=W.getContext("2d"),N!==void 0&&G!==void 0&&(W.style.width=parseFloat(N)+"px",W.style.height=parseFloat(G)+"px",W.setAttribute("width",parseFloat(N)),W.setAttribute("height",parseFloat(G))),Y=new Image,q=this.dumpToDataURI(z),Y.src=q,"Promise"in window?new Promise(function(se,ae){try{Y.onload=function(){ie.drawImage(Y,0,0,N,G),se()}}catch(ce){ae(ce)}}):(Y.onload=function(){window.setTimeout(function(){try{ie.drawImage(Y,0,0,N,G)}catch{console.log("screenshots not longer supported on IE")}},200)},this)},screenshot:function(v,N,G){var z,q=this.container.ownerDocument,Y=this.container.parentNode,W,ie,ne,se,ae,ce,pe,ge=v.attr.screenshot,ve,be,Ee,Pe=!1,Je;return this.type==="no"?this:(ce=ge.scale*this.container.getBoundingClientRect().width,pe=ge.scale*this.container.getBoundingClientRect().height,N===void 0||N===""?(Pe=!0,ne=new Image,ne.style.width=ce+"px",ne.style.height=pe+"px"):(Pe=!1,ne=q.getElementById(N)),Pe&&(z=q.createElement("div"),z.style.cssText=ge.css,z.style.width=ce+"px",z.style.height=pe+"px",z.style.zIndex=this.container.style.zIndex+120,z.style.position="absolute",z.style.top=this.container.offsetTop+"px",z.style.left=this.container.offsetLeft+"px"),W=q.createElement("canvas"),ie=Math.random().toString(36).slice(2,7),W.setAttribute("id",ie),W.setAttribute("width",ce),W.setAttribute("height",pe),W.style.width=ce+"px",W.style.height=ce+"px",W.style.display="none",Y.appendChild(W),Pe&&(se=q.createElement("span"),ae=q.createTextNode("âœ
135–"),se.style.cssText=ge.cssButton,se.appendChild(ae),se.onclick=function(){z.parentNode.removeChild(z)},z.appendChild(ne),z.appendChild(se),Y.insertBefore(z,this.container.nextSibling)),ve=q.getElementById(this.uniqName("navigationbar")),JXG$1.exists(ve)&&(be=ve.style.display,ve.style.display="none",Ee=this.removeToInsertLater(ve)),Je=function(){ne.src=W.toDataURL("image/png"),Y.removeChild(W)},"Promise"in window?this.dumpToCanvas(ie,ce,pe,G).then(Je):(this.dumpToCanvas(ie,ce,pe,G),window.setTimeout(Je,200)),JXG$1.exists(ve)&&(ve.style.display=be,Ee()),this)}});const SVGRenderer=JXG$1.SVGRenderer;JXG$1.VMLRenderer=function(v){this.type="vml",this.container=v,this.container.style.overflow="hidden",this.container.style.position===""&&(this.container.style.position="relative"),this.container.onselectstart=function(){return!1},this.resolution=10,JXG$1.exists(JXG$1.vmlStylesheet)||(v.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),JXG$1.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),JXG$1.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{v.ownerDocument.namespaces.jxgvml||v.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(N){return v.ownerDocument.createElement("<jxgvml:"+N+' class="jxgvml">')}}catch{this.createNode=function(G){return v.ownerDocument.createElement("<"+G+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]};JXG$1.VMLRenderer.prototype=new AbstractRenderer;JXG$1.extend(JXG$1.VMLRenderer.prototype,{_setAttr:function(v,N,G,z){try{this.container.ownerDocument.documentMode===8?v[N]=G:v.setAttribute(N,G,z)}catch{JXG$1.debug("_setAttr: "+N+" "+G+`<br>
136`)}},updateTicks:function(v){var N,G,z,q,Y,W=this.resolution,ie=[];for(G=v.ticks.length,N=0;N<G;N++)z=v.ticks[N],q=z[0],Y=z[1],JXG$1.isNumber(q[0])&&JXG$1.isNumber(q[1])&&ie.push(" m "+Math.round(W*q[0])+", "+Math.round(W*Y[0])+" l "+Math.round(W*q[1])+", "+Math.round(W*Y[1])+" ");JXG$1.exists(v.rendNode)||(v.rendNode=this.createPrim("path",v.id),this.appendChildPrim(v.rendNode,v.evalVisProp("layer"))),this._setAttr(v.rendNode,"stroked","true"),this._setAttr(v.rendNode,"strokecolor",v.evalVisProp("strokecolor"),1),this._setAttr(v.rendNode,"strokeweight",v.evalVisProp("strokewidth")),this._setAttr(v.rendNodeStroke,"opacity",v.evalVisProp("strokeopacity")*100+"%"),this.updatePathPrim(v.rendNode,ie,v.board)},displayCopyright:function(v,N){var G,z;G=this.createNode("textbox"),G.style.position="absolute",this._setAttr(G,"id",this.container.id+"_licenseText"),G.style.left=20,G.style.top=2,G.style.fontSize=N,G.style.color="#356AA0",G.style.fontFamily="Arial,Helvetica,sans-serif",this._setAttr(G,"opacity","30%"),G.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand', enabled = false) progid:DXImageTransform.Microsoft.Alpha(opacity = 30, enabled = true)",z=this.container.ownerDocument.createTextNode(v),G.appendChild(z),this.appendChildPrim(G,0)},drawInternalText:function(v){var N;return N=this.createNode("textbox"),N.style.position="absolute",v.rendNodeText=this.container.ownerDocument.createTextNode(""),N.appendChild(v.rendNodeText),this.appendChildPrim(N,9),N.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand', enabled = false) progid:DXImageTransform.Microsoft.Alpha(opacity = 100, enabled = false)",N},updateInternalText:function(v){var N,G=v.plaintext,z=this.joinTransforms(v,v.transformations),q=[0,0],Y,W,ie,ne,se,ae=v.rendNode,ce=[],pe=v.getAnchorX(),ge=v.getAnchorY();if(!isNaN(v.coords.scrCoords[1]+v.coords.scrCoords[2])){for(pe==="right"?q[0]=1:pe==="middle"&&(q[0]=.5),ge==="bottom"?q[1]=1:ge==="middle"&&(q[1]=.5),ce[0]=Mat.matVecMult(z,[1,v.coords.scrCoords[1]-q[0]*v.size[0],v.coords.scrCoords[2]+(1-q[1])*v.size[1]+this.vOffsetText]),ce[0][1]/=ce[0][0],ce[0][2]/=ce[0][0],ce[1]=Mat.matVecMult(z,[1,v.coords.scrCoords[1]+(1-q[0])*v.size[0],v.coords.scrCoords[2]+(1-q[1])*v.size[1]+this.vOffsetText]),ce[1][1]/=ce[1][0],ce[1][2]/=ce[1][0],ce[2]=Mat.matVecMult(z,[1,v.coords.scrCoords[1]+(1-q[0])*v.size[0],v.coords.scrCoords[2]-q[1]*v.size[1]+this.vOffsetText]),ce[2][1]/=ce[2][0],ce[2][2]/=ce[2][0],ce[3]=Mat.matVecMult(z,[1,v.coords.scrCoords[1]-q[0]*v.size[0],v.coords.scrCoords[2]-q[1]*v.size[1]+this.vOffsetText]),ce[3][1]/=ce[3][0],ce[3][2]/=ce[3][0],Y=ce[0][1],ie=ce[0][1],W=ce[0][2],ne=ce[0][2],se=1;se<4;se++)Y=Math.max(Y,ce[se][1]),ie=Math.min(ie,ce[se][1]),W=Math.max(W,ce[se][2]),ne=Math.min(ne,ce[se][2]);N=q[0]===1?Math.floor(v.board.canvasWidth-Y):Math.floor(ie),v.visPropOld.left!==pe+N&&(q[0]===1?(v.rendNode.style.right=N+"px",v.rendNode.style.left="auto"):(v.rendNode.style.left=N+"px",v.rendNode.style.right="auto"),v.visPropOld.left=pe+N),N=q[1]===1?Math.floor(v.board.canvasHeight-W):Math.floor(ne),v.visPropOld.top!==ge+N&&(q[1]===1?(v.rendNode.style.bottom=N+"px",v.rendNode.style.top="auto"):(v.rendNode.style.top=N+"px",v.rendNode.style.bottom="auto"),v.visPropOld.top=ge+N)}v.htmlStr!==G&&(v.rendNodeText.data=G,v.htmlStr=G),ae.filters.item(0).M11=z[1][1],ae.filters.item(0).M12=z[1][2],ae.filters.item(0).M21=z[2][1],ae.filters.item(0).M22=z[2][2],ae.filters.item(0).enabled=!0},drawImage:function(v){var N;N=this.container.ownerDocument.createElement("img"),N.style.position="absolute",this._setAttr(N,"id",this.container.id+"_"+v.id),this.container.appendChild(N),this.appendChildPrim(N,v.evalVisProp("layer")),N.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand') progid:DXImageTransform.Microsoft.Alpha(opacity = 100, enabled = false)",v.rendNode=N,this.updateImage(v)},transformRect:function(v,N){var G,z,q,Y,W,ie,ne=v.rendNode,se=[],ae=N.length;if(ae>0){for(G=this.joinTransforms(v,N),se[0]=Mat.matVecMult(G,v.coords.scrCoords),se[0][1]/=se[0][0],se[0][2]/=se[0][0],se[1]=Mat.matVecMult(G,[1,v.coords.scrCoords[1]+v.size[0],v.coords.scrCoords[2]]),se[1][1]/=se[1][0],se[1][2]/=se[1][0],se[2]=Mat.matVecMult(G,[1,v.coords.scrCoords[1]+v.size[0],v.coords.scrCoords[2]-v.size[1]]),se[2][1]/=se[2][0],se[2][2]/=se[2][0],se[3]=Mat.matVecMult(G,[1,v.coords.scrCoords[1],v.coords.scrCoords[2]-v.size[1]]),se[3][1]/=se[3][0],se[3][2]/=se[3][0],z=se[0][1],Y=se[0][1],q=se[0][2],W=se[0][2],ie=1;ie<4;ie++)z=Math.max(z,se[ie][1]),Y=Math.min(Y,se[ie][1]),q=Math.max(q,se[ie][2]),W=Math.min(W,se[ie][2]);ne.style.left=Math.floor(Y)+"px",ne.style.top=Math.floor(W)+"px",ne.filters.item(0).M11=G[1][1],ne.filters.item(0).M12=G[1][2],ne.filters.item(0).M21=G[2][1],ne.filters.item(0).M22=G[2][2],ne.filters.item(0).enabled=!0}},updateImageURL:function(v){var N=v.eval(v.url);this._setAttr(v.rendNode,"src",N)},appendChildPrim:function(v,N){return JXG$1.exists(N)||(N=0),v.style.zIndex=N,this.container.appendChild(v),v},appendNodesToElement:function(v,N){(N==="shape"||N==="path"||N==="polygon")&&(v.rendNodePath=this.getElementById(v.id+"_path")),v.rendNodeFill=this.getElementById(v.id+"_fill"),v.rendNodeStroke=this.getElementById(v.id+"_stroke"),v.rendNodeShadow=this.getElementById(v.id+"_shadow"),v.rendNode=this.getElementById(v.id)},createPrim:function(v,N){var G,z,q=this.createNode("fill"),Y=this.createNode("stroke"),W=this.createNode("shadow");return this._setAttr(q,"id",this.container.id+"_"+N+"_fill"),this._setAttr(Y,"id",this.container.id+"_"+N+"_stroke"),this._setAttr(W,"id",this.container.id+"_"+N+"_shadow"),v==="circle"||v==="ellipse"?(G=this.createNode("oval"),G.appendChild(q),G.appendChild(Y),G.appendChild(W)):v==="polygon"||v==="path"||v==="shape"||v==="line"?(G=this.createNode("shape"),G.appendChild(q),G.appendChild(Y),G.appendChild(W),z=this.createNode("path"),this._setAttr(z,"id",this.container.id+"_"+N+"_path"),G.appendChild(z)):(G=this.createNode(v),G.appendChild(q),G.appendChild(Y),G.appendChild(W)),G.style.position="absolute",G.style.left="0px",G.style.top="0px",this._setAttr(G,"id",this.container.id+"_"+N),G},remove:function(v){JXG$1.exists(v)&&v.removeNode(!0)},makeArrows:function(v){var N,G=v.evalVisProp("firstarrow"),z=v.evalVisProp("lastarrow");v.visPropOld.firstarrow===G&&v.visPropOld.lastarrow===z||(G?(N=v.rendNodeStroke,this._setAttr(N,"startarrow","block"),this._setAttr(N,"startarrowlength","long")):(N=v.rendNodeStroke,JXG$1.exists(N)&&this._setAttr(N,"startarrow","none")),z?(N=v.rendNodeStroke,this._setAttr(N,"id",this.container.id+"_"+v.id+"stroke"),this._setAttr(N,"endarrow","block"),this._setAttr(N,"endarrowlength","long")):(N=v.rendNodeStroke,JXG$1.exists(N)&&this._setAttr(N,"endarrow","none")),v.visPropOld.firstarrow=G,v.visPropOld.lastarrow=z)},updateEllipsePrim:function(v,N,G,z,q){v.style.left=Math.floor(N-z)+"px",v.
136style.top=Math.floor(G-q)+"px",v.style.width=Math.floor(Math.abs(z)*2)+"px",v.style.height=Math.floor(Math.abs(q)*2)+"px"},updateLinePrim:function(v,N,G,z,q,Y){var W,ie=this.resolution;isNaN(N+G+z+q)||(W=["m ",Math.floor(ie*N),", ",Math.floor(ie*G)," l ",Math.floor(ie*z),", ",Math.floor(ie*q)],this.updatePathPrim(v,W,Y))},updatePathPrim:function(v,N,G){var z=G.canvasWidth,q=G.canvasHeight;N.length<=0&&(N=["m 0,0"]),v.style.width=z,v.style.height=q,this._setAttr(v,"coordsize",[Math.floor(this.resolution*z),Math.floor(this.resolution*q)].join(",")),this._setAttr(v,"path",N.join(""))},updatePathStringPoint:function(v,N,G){var z=[],q=Math.round,Y=v.coords.scrCoords,W=N*Math.sqrt(3)*.5,ie=N*.5,ne=this.resolution;return G==="x"?z.push([" m ",q(ne*(Y[1]-N)),", ",q(ne*(Y[2]-N))," l ",q(ne*(Y[1]+N)),", ",q(ne*(Y[2]+N))," m ",q(ne*(Y[1]+N)),", ",q(ne*(Y[2]-N))," l ",q(ne*(Y[1]-N)),", ",q(ne*(Y[2]+N))].join("")):G==="+"?z.push([" m ",q(ne*(Y[1]-N)),", ",q(ne*Y[2])," l ",q(ne*(Y[1]+N)),", ",q(ne*Y[2])," m ",q(ne*Y[1]),", ",q(ne*(Y[2]-N))," l ",q(ne*Y[1]),", ",q(ne*(Y[2]+N))].join("")):G==="<>"||G==="<<>>"?(G==="<<>>"&&(N*=1.41),z.push([" m ",q(ne*(Y[1]-N)),", ",q(ne*Y[2])," l ",q(ne*Y[1]),", ",q(ne*(Y[2]+N))," l ",q(ne*(Y[1]+N)),", ",q(ne*Y[2])," l ",q(ne*Y[1]),", ",q(ne*(Y[2]-N))," x e "].join(""))):G==="^"?z.push([" m ",q(ne*Y[1]),", ",q(ne*(Y[2]-N))," l ",q(ne*(Y[1]-W)),", ",q(ne*(Y[2]+ie))," l ",q(ne*(Y[1]+W)),", ",q(ne*(Y[2]+ie))," x e "].join("")):G==="v"?z.push([" m ",q(ne*Y[1]),", ",q(ne*(Y[2]+N))," l ",q(ne*(Y[1]-W)),", ",q(ne*(Y[2]-ie))," l ",q(ne*(Y[1]+W)),", ",q(ne*(Y[2]-ie))," x e "].join("")):G===">"?z.push([" m ",q(ne*(Y[1]+N)),", ",q(ne*Y[2])," l ",q(ne*(Y[1]-ie)),", ",q(ne*(Y[2]-W))," l ",q(ne*(Y[1]-ie)),", ",q(ne*(Y[2]+W))," l ",q(ne*(Y[1]+N)),", ",q(ne*Y[2])].join("")):G==="<"&&z.push([" m ",q(ne*(Y[1]-N)),", ",q(ne*Y[2])," l ",q(ne*(Y[1]+ie)),", ",q(ne*(Y[2]-W))," l ",q(ne*(Y[1]+ie)),", ",q(ne*(Y[2]+W))," x e "].join("")),z},updatePathStringPrim:function(v){var N,G,z=[],q=this.resolution,Y=Math.round,W=" m ",ie=" l ",ne=" c ",se=W,ae=Math.min(v.numberPoints,8192);if(v.numberPoints<=0)return"";if(ae=Math.min(ae,v.points.length),v.bezierDegree===1)for(N=0;N<ae;N++)G=v.points[N].scrCoords,isNaN(G[1])||isNaN(G[2])?se=W:(G[1]>2e4?G[1]=2e4:G[1]<-2e4&&(G[1]=-2e4),G[2]>2e4?G[2]=2e4:G[2]<-2e4&&(G[2]=-2e4),z.push([se,Y(q*G[1]),", ",Y(q*G[2])].join("")),se=ie);else if(v.bezierDegree===3)for(N=0;N<ae;)G=v.points[N].scrCoords,isNaN(G[1])||isNaN(G[2])?se=W:(z.push([se,Y(q*G[1]),", ",Y(q*G[2])].join("")),se===ne&&(N+=1,G=v.points[N].scrCoords,z.push([" ",Y(q*G[1]),", ",Y(q*G[2])].join("")),N+=1,G=v.points[N].scrCoords,z.push([" ",Y(q*G[1]),", ",Y(q*G[2])].join(""))),se=ne),N+=1;return z.push(" e"),z},updatePathStringBezierPrim:function(v){var N,G,z,q,Y,W,ie=[],ne=v.evalVisProp("strokewidth"),se=this.resolution,ae=Math.round,ce=" m ",pe=" c ",ge=ce,ve=v.evalVisProp("curvetype")!=="plot",be=Math.min(v.numberPoints,8192);if(v.numberPoints<=0)return"";for(ve&&v.board.options.curve.RDPsmoothing&&(v.points=Numerics.RamerDouglasPeucker(v.points,1)),be=Math.min(be,v.points.length),G=1;G<3;G++)for(ge=ce,N=0;N<be;N++)q=v.points[N].scrCoords,isNaN(q[1])||isNaN(q[2])?ge=ce:(q[1]>2e4?q[1]=2e4:q[1]<-2e4&&(q[1]=-2e4),q[2]>2e4?q[2]=2e4:q[2]<-2e4&&(q[2]=-2e4),ge===ce?ie.push([ge,ae(se*q[1])," ",ae(se*q[2])].join("")):(z=2*G,ie.push([ge,ae(se*(Y+(q[1]-Y)*.333+ne*(z*Math.random()-G)))," ",ae(se*(W+(q[2]-W)*.333+ne*(z*Math.random()-G)))," ",ae(se*(Y+(q[1]-Y)*.666+ne*(z*Math.random()-G)))," ",ae(se*(W+(q[2]-W)*.666+ne*(z*Math.random()-G)))," ",ae(se*q[1])," ",ae(se*q[2])].join(""))),ge=pe,Y=q[1],W=q[2]);return ie.push(" e"),ie},updatePolygonPrim:function(v,N){var G,z=N.vertices.length,q=this.resolution,Y,W=[];if(this._setAttr(v,"stroked","false"),Y=N.vertices[0].coords.scrCoords,!isNaN(Y[1]+Y[2])){for(W.push(["m ",Math.floor(q*Y[1]),",",Math.floor(q*Y[2])," l "].join("")),G=1;G<z-1;G++){if(N.vertices[G].isReal){if(Y=N.vertices[G].coords.scrCoords,isNaN(Y[1]+Y[2]))return;W.push(Math.floor(q*Y[1])+","+Math.floor(q*Y[2]))}else{this.updatePathPrim(v,"",N.board);return}G<z-2&&W.push(", ")}W.push(" x e"),this.updatePathPrim(v,W,N.board)}},updateRectPrim:function(v,N,G,z,q){v.style.left=Math.floor(N)+"px",v.
136style.top=Math.floor(G)+"px",z>=0&&(v.style.width=z+"px"),q>=0&&(v.style.height=q+"px")},setPropertyPrim:function(v,N,G){var z="",q;switch(N){case"stroke":z="strokecolor";break;case"stroke-width":z="strokeweight";break;case"stroke-dasharray":z="dashstyle";break}z!==""&&(q=G,this._setAttr(v,z,q))},display:function(v,N){v&&v.rendNode&&(v.visPropOld.visible=N,N?v.rendNode.style.visibility="inherit":v.rendNode.style.visibility="hidden")},show:function(v){JXG$1.deprecated("Board.renderer.show()","Board.renderer.display()"),v&&v.rendNode&&(v.rendNode.style.visibility="inherit")},hide:function(v){JXG$1.deprecated("Board.renderer.hide()","Board.renderer.display()"),v&&v.rendNode&&(v.rendNode.style.visibility="hidden")},setDashStyle:function(v,N){var G;N.dash>=0&&(G=v.rendNodeStroke,this._setAttr(G,"dashstyle",this.dashArray[N.dash]))},setGradient:function(v){var N=v.rendNodeFill,G=v.evalVisProp("gradient");G==="linear"?(this._setAttr(N,"type","gradient"),this._setAttr(N,"color2",v.evalVisProp("gradientsecondcolor")),this._setAttr(N,"opacity2",v.evalVisProp("gradientsecondopacity")),this._setAttr(N,"angle",v.evalVisProp("gradientangle"))):G==="radial"?(this._setAttr(N,"type","gradientradial"),this._setAttr(N,"color2",v.evalVisProp("gradientsecondcolor")),this._setAttr(N,"opacity2",v.evalVisProp("gradientsecondopacity")),this._setAttr(N,"focusposition",v.evalVisProp("gradientpositionx")*100+"%,"+v.evalVisProp("gradientpositiony")*100+"%"),this._setAttr(N,"focussize","0,0")):this._setAttr(N,"type","solid")},setObjectFillColor:function(v,N,G){var z=N,q,Y,W=G,ie,ne=v.rendNode;W=W>0?W:0,!(v.visPropOld.fillcolor===z&&v.visPropOld.fillopacity===W)&&(JXG$1.exists(z)&&z!==!1&&(z.length!==9?(q=z,ie=W):(Y=JXG$1.rgba2rgbo(z),q=Y[0],ie=W*Y[1]),q==="none"||q===!1?this._setAttr(v.rendNode,"filled","false"):(this._setAttr(v.rendNode,"filled","true"),this._setAttr(v.rendNode,"fillcolor",q),JXG$1.exists(ie)&&v.rendNodeFill&&this._setAttr(v.rendNodeFill,"opacity",ie*100+"%")),v.type===Const.OBJECT_TYPE_IMAGE&&ne.filters.length>1&&(ne.filters.item(1).opacity=Math.round(ie*100),ne.filters.item(1).enabled=!0)),v.visPropOld.fillcolor=z,v.visPropOld.fillopacity=W)},setObjectStrokeColor:function(v,N,G){var z=N,q,Y,W=G,ie,ne=v.rendNode,se;W=W>0?W:0,!(v.visPropOld.strokecolor===z&&v.visPropOld.strokeopacity===W)&&(JXG$1.exists(z)&&z!==!1&&(z.length!==9?(q=z,ie=W):(Y=N.rgba2rgbo(z),q=Y[0],ie=W*Y[1]),v.elementClass===Const.OBJECT_CLASS_TEXT?(ne.filters.length>1&&(ne.filters.item(1).opacity=Math.round(ie*100),ne.filters.item(1).enabled=!0),ne.style.color=q):(q!==!1&&(this._setAttr(ne,"stroked","true"),this._setAttr(ne,"strokecolor",q)),se=v.rendNodeStroke,JXG$1.exists(ie)&&v.type!==Const.OBJECT_TYPE_IMAGE&&this._setAttr(se,"opacity",ie*100+"%"))),v.visPropOld.strokecolor=z,v.visPropOld.strokeopacity=W)},setObjectStrokeWidth:function(v,N){var G=JXG$1.evaluate(N),z;isNaN(G)||v.visPropOld.strokewidth===G||(z=v.rendNode,this.setPropertyPrim(z,"stroked","true"),JXG$1.exists(G)&&(this.setPropertyPrim(z,"stroke-width",G),G===0&&JXG$1.exists(v.rendNodeStroke)&&this._setAttr(z,"stroked","false")),v.visPropOld.strokewidth=G)},setShadow:function(v){var N=v.rendNodeShadow,G=v.evalVisProp("shadow");!N||v.visPropOld.shadow===G||(G?(this._setAttr(N,"On","True"),this._setAttr(N,"Offset","3pt,3pt"),this._setAttr(N,"Opacity","60%"),this._setAttr(N,"Color","#aaaaaa")):this._setAttr(N,"On","False"),v.visPropOld.shadow=G)},suspendRedraw:function(){this.container.style.display="none"},unsuspendRedraw:function(){this.container.style.display=""}});const VMLRenderer=JXG$1.VMLRenderer;var uuidCharsStr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",uuidChars=uuidCharsStr.split("");JXG$1.Util=JXG$1.Util||{};JXG$1.Util.genUUID=function(v){var N,G,z=[],q=0;for(v=v||"",v!==""&&v.slice(v.length-1)!=="-"&&(v=v+"-"),G=0;G<36;G++)G===8||G===13||G===18||G===23?z[G]="-":G===14?z[G]="4":(q<=2&&(q=33554432+Math.random()*16777216|0),N=q&15,q=q>>4,z[G]=uuidChars[G===19?N&3|8:N]);return v+z.join("")};const UUID=JXG$1.Util;JXG$1.CanvasRenderer=function(v,N){if(this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=UUID.genUUID(),this.canvasNamespace=null,JXG$1.isBrowser)this.container=v,this.container.style.MozUserSelect="none",this.container.style.userSelect="none",this.container.style.overflow="hidden",this.container.style.position===""&&(this.container.style.position="relative"),this.container.innerHTML=['<canvas i
136d="',this.canvasId,'" width="',N.width,'px" height="',N.height,'px"></canvas>'].join(""),this.canvasRoot=this.container.ownerDocument.getElementById(this.canvasId),this.canvasRoot.style.display="block",this.context=this.canvasRoot.getContext("2d");else if(JXG$1.isNode())try{this.canvasRoot=JXG$1.createCanvas(500,500),this.context=this.canvasRoot.getContext("2d")}catch{throw new Error(`JXG.createCanvas not available.
137Install the npm package \`canvas\`
138and call:
139    import { createCanvas } from "canvas.js";
140    JXG.createCanvas = createCanvas;
141`)}};JXG$1.CanvasRenderer.prototype=new AbstractRenderer;JXG$1.extend(JXG$1.CanvasRenderer.prototype,{_drawPolygon:function(v,N,G){var z,q=v.length,Y=this.context;if(q>0){if(G&&(Y.lineWidth=0),Y.beginPath(),Y.moveTo(v[0][0],v[0][1]),N===1)for(z=1;z<q;z++)Y.lineTo(v[z][0],v[z][1]);else for(z=1;z<q;z+=3)Y.bezierCurveTo(v[z][0],v[z][1],v[z+1][0],v[z+1][1],v[z+2][0],v[z+2][1]);G?(Y.lineTo(v[0][0],v[0][1]),Y.closePath(),Y.fill("evenodd")):Y.stroke()}},_fill:function(v){var N=this.context;N.save(),this._setColor(v,"fill")&&N.fill("evenodd"),N.restore()},_rotatePoint:function(v,N,G){return[N*Math.cos(v)-G*Math.sin(v),N*Math.sin(v)+G*Math.cos(v)]},_rotateShape:function(v,N){var G,z=[],q=v.length;if(q<=0)return v;for(G=0;G<q;G++)z.push(this._rotatePoint(N,v[G][0],v[G][1]));return z},updateGradientAngle:function(v,N){var G=1,z=Math.cos(-N),q=Math.sin(-N),Y=v.getBoundingBox(),W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe;return Math.abs(z)>Math.abs(q)?G/=Math.abs(z):G/=Math.abs(q),z>=0?(ne=0,se=z*G):(ne=-z*G,se=0),q>=0?(ae=0,ce=q*G):(ae=-q*G,ce=0),W=new Coords(Const.COORDS_BY_USER,[Y[0],Y[1]],v.board),ie=new Coords(Const.COORDS_BY_USER,[Y[2],Y[3]],v.board),Ee=ie.scrCoords[1]-W.scrCoords[1],Pe=ie.scrCoords[2]-W.scrCoords[2],pe=W.scrCoords[1]+Ee*ne,ve=W.scrCoords[2]+Pe*ae,ge=W.scrCoords[1]+Ee*se,be=W.scrCoords[2]+Pe*ce,this.context.createLinearGradient(pe,ve,ge,be)},updateGradientCircle:function(v,N,G,z,q,Y,W){var ie=v.getBoundingBox(),ne,se,ae,ce,pe,ge,ve,be,Ee,Pe;return ne=new Coords(Const.COORDS_BY_USER,[ie[0],ie[1]],v.board),se=new Coords(Const.COORDS_BY_USER,[ie[2],ie[3]],v.board),Ee=se.scrCoords[1]-ne.scrCoords[1],Pe=ne.scrCoords[2]-se.scrCoords[2],ae=ne.scrCoords[1]+Ee*N,ce=se.scrCoords[2]+Pe*G,ge=ne.scrCoords[1]+Ee*q,ve=se.scrCoords[2]+Pe*Y,pe=z*(Ee+Pe)*.5,be=W*(Ee+Pe)*.5,this.context.createRadialGradient(ge,ve,be,ae,ce,pe)},updateGradient:function(v){var N,G=v.evalVisProp("gradient"),z;return N=v.evalVisProp("fillcolor"),G==="linear"?z=this.updateGradientAngle(v,v.evalVisProp("gradientangle")):G==="radial"&&(z=this.updateGradientCircle(v,v.evalVisProp("gradientcx"),v.evalVisProp("gradientcy"),v.evalVisProp("gradientr"),v.evalVisProp("gradientfx"),v.evalVisProp("gradientfy"),v.evalVisProp("gradientfr"))),z.addColorStop(v.evalVisProp("gradientstartoffset"),N),z.addColorStop(v.evalVisProp("gradientendoffset"),v.evalVisProp("gradientsecondcolor")),z},_setColor:function(v,N,G){var z=!0,q,Y,W,ie,ne,se,ae,ce,pe;return N=N||"stroke",G=G||N,Y=this._getHighlighted(v),ie=v.evalVisProp(Y+N+"color"),ie!=="none"&&ie!==!1?(ae=v.evalVisProp(Y+N+"opacity"),ae=ae>0?ae:0,ie.length!==9?(se=ie,ce=ae):(ne=JXG$1.rgba2rgbo(ie),se=ne[0],ce=ae*ne[1]),this.context.globalAlpha=ce,this.context[G+"Style"]=se):z=!1,pe=v.evalVisProp("gradient"),pe==="linear"||pe==="radial"?(this.context.globalAlpha=ce,this.context[G+"Style"]=this.updateGradient(v),z):(W=parseFloat(v.evalVisProp(Y+"strokewidth")),N==="stroke"&&!isNaN(W)&&(W===0?this.context.globalAlpha=0:this.context.lineWidth=W),q=v.evalVisProp("linecap"),N==="stroke"&&q!==void 0&&q!==""&&(this.context.lineCap=q),z)},_stroke:function(v){var N=this.context,G=v.evalVisProp("dash"),z=v.evalVisProp("dashscale"),q=z?.5*v.evalVisProp("strokewidth"):1;N.save(),G>0?N.setLineDash&&N.setLineDash(this.dashArray[G-1].map(function(Y){return Y*q})):this.context.lineDashArray=[],this._setColor(v,"stroke")&&N.stroke(),N.restore()},_translateShape:function(v,N,G){var z,q=[],Y=v.length;if(Y<=0)return v;for(z=0;z<Y;z++)q.push([v[z][0]+N,v[z][1]+G]);return q},drawPoint:function(v){var N=v.evalVisProp("face"),G=v.evalVisProp("size"),z=v.coords.scrCoords,q=G*Math.sqrt(3)*.5,Y=G*.5,W=parseFloat(v.evalVisProp("strokewidth"))/2,ie=this.context;if(v.visPropCalc.visible)switch(N){case"cross":case"x":ie.beginPath(),ie.moveTo(z[1]-G,z[2]-G),ie.lineTo(z[1]+G,z[2]+G),ie.moveTo(z[1]+G,z[2]-G),ie.lineTo(z[1]-G,z[2]+G),ie.lineCap="round",ie.lineJoin="round",ie.closePath(),this._stroke(v);break;case"circle":case"o":ie.beginPath(),ie.arc(z[1],z[2],G+1+W,0,2*Math.PI,!1),ie.closePath(),this._fill(v),this._stroke(v);break;case"square":case"[]":if(G<=0)break;ie.save(),this._setColor(v,"stroke","fill")&&ie.fillRect(z[1]-G-W,z[2]-G-W,G*2+3*W,G*2+3*W),ie.restore(
141),ie.save(),this._setColor(v,"fill"),ie.fillRect(z[1]-G+W,z[2]-G+W,G*2-W,G*2-W),ie.restore();break;case"plus":case"+":ie.beginPath(),ie.moveTo(z[1]-G,z[2]),ie.lineTo(z[1]+G,z[2]),ie.moveTo(z[1],z[2]-G),ie.lineTo(z[1],z[2]+G),ie.lineCap="round",ie.lineJoin="round",ie.closePath(),this._stroke(v);break;case"divide":case"|":ie.beginPath(),ie.moveTo(z[1],z[2]-G),ie.lineTo(z[1],z[2]+G),ie.lineCap="round",ie.lineJoin="round",ie.closePath(),this._stroke(v);break;case"minus":case"-":ie.beginPath(),ie.moveTo(z[1]-G,z[2]),ie.lineTo(z[1]+G,z[2]),ie.lineCap="round",ie.lineJoin="round",ie.closePath(),this._stroke(v);break;case"diamond2":case"<<>>":G*=1.41;case"diamond":case"<>":ie.beginPath(),ie.moveTo(z[1]-G,z[2]),ie.lineTo(z[1],z[2]+G),ie.lineTo(z[1]+G,z[2]),ie.lineTo(z[1],z[2]-G),ie.closePath(),this._fill(v),this._stroke(v);break;case"triangleup":case"A":case"a":case"^":ie.beginPath(),ie.moveTo(z[1],z[2]-G),ie.lineTo(z[1]-q,z[2]+Y),ie.lineTo(z[1]+q,z[2]+Y),ie.closePath(),this._fill(v),this._stroke(v);break;case"triangledown":case"v":ie.beginPath(),ie.moveTo(z[1],z[2]+G),ie.lineTo(z[1]-q,z[2]-Y),ie.lineTo(z[1]+q,z[2]-Y),ie.closePath(),this._fill(v),this._stroke(v);break;case"triangleleft":case"<":ie.beginPath(),ie.moveTo(z[1]-G,z[2]),ie.lineTo(z[1]+Y,z[2]-q),ie.lineTo(z[1]+Y,z[2]+q),ie.closePath(),this._fill(v),this._stroke(v);break;case"triangleright":case">":ie.beginPath(),ie.moveTo(z[1]+G,z[2]),ie.lineTo(z[1]-Y,z[2]-q),ie.lineTo(z[1]-Y,z[2]+q),ie.closePath(),this._fill(v),this._stroke(v);break}},updatePoint:function(v){this.drawPoint(v)},drawArrows:function(v,N,G,z,q){var Y,W,ie,ne,se,ae,ce,pe,ge=this.context,ve=6,be=1,Ee,Pe,Je=1,Ce=1,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut=q.evFirst,ct=q.evLast;if(v.evalVisProp("strokecolor")!=="none"&&(ut||ct)){if(v.elementClass===Const.OBJECT_CLASS_LINE)Y=N.scrCoords[1],W=N.scrCoords[2],ie=G.scrCoords[1],ne=G.scrCoords[2],it=ot=Math.atan2(ne-W,ie-Y);else{if(Y=v.points[0].scrCoords[1],W=v.points[0].scrCoords[2],rt=v.points.length-1,rt<1)return;ie=v.points[v.points.length-1].scrCoords[1],ne=v.points[v.points.length-1].scrCoords[2],et=v.points[1].scrCoords[1]-v.points[0].scrCoords[1],Ze=v.points[1].scrCoords[2]-v.points[0].scrCoords[2],tt=v.points[rt].scrCoords[1]-v.points[rt-1].scrCoords[1],Ke=v.points[rt].scrCoords[2]-v.points[rt-1].scrCoords[2],ut&&(it=Math.atan2(Ze,et)),ct&&(ot=Math.atan2(Ke,tt))}if(ae=v.evalVisProp(z+"strokewidth"),ut)if(ve=q.sizeFirst,se=ae*ve,be=q.typeFirst,Ee=be,be===2)pe=[[se,-se*.5],[0,0],[se,se*.5],[se*.5,0]];else if(be===3)pe=[[se/3,-se*.5],[0,-se*.5],[0,se*.5],[se/3,se*.5]];else if(be===4)for(se/=10,Je=3,pe=[[10,3.31],[6.47,3.84],[2.87,4.5],[0,6.63],[.67,5.52],[1.33,4.42],[2,3.31],[1.33,2.21],[.67,1.1],[0,0],[2.87,2.13],[6.47,2.79],[10,3.31]],qe=pe.length,Re=0;Re<qe;Re++)pe[Re][0]*=-se,pe[Re][1]*=se,pe[Re][0]+=10*se,pe[Re][1]-=3.31*se;else if(be===5)for(se/=10,Je=3,pe=[[10,3.28],[6.61,4.19],[3.19,5.07],[0,6.55],[.62,5.56],[1,4.44],[1,3.28],[1,2.11],[.62,.99],[0,0],[3.19,1.49],[6.61,2.37],[10,3.28]],qe=pe.length,Re=0;Re<qe;Re++)pe[Re][0]*=-se,pe[Re][1]*=se,pe[Re][0]+=10*se,pe[Re][1]-=3.28*se;else if(be===6)for(se/=10,Je=3,pe=[[10,2.84],[6.61,3.59],[3.21,4.35],[0,5.68],[.33,4.73],[.67,3.78],[1,2.84],[.67,1.89],[.33,.95],[0,0],[3.21,1.33],[6.61,2.09],[10,2.84]],qe=pe.length,Re=0;Re<qe;Re++)pe[Re][0]*=-se,pe[Re][1]*=se,pe[Re][0]+=10*se,pe[Re][1]-=2.84*se;else if(be===7)for(se=ae,Je=3,pe=[[0,10.39],[2.01,6.92],[5.96,5.2],[10,5.2],[5.96,5.2],[2.01,3.47],[0,0]],qe=pe.length,Re=0;Re<qe;Re++)pe[Re][0]*=-se,pe[Re][1]*=se,pe[Re][0]+=10*se,pe[Re][1]-=5.2*se;else pe=[[se,-se*.5],[0,0],[se,se*.5]];if(ct)if(ve=q.sizeLast,se=ae*ve,be=q.typeLast,Pe=be,be===2)ce=[[-se,-se*.5],[0,0],[-se,se*.5],[-se*.5,0]];else if(be===3)ce=[[-se/3,-se*.5],[0,-se*.5],[0,se*.5],[-se/3,se*.5]];else if(be===4)for(se/=10,Ce=3,ce=[[10,3.31],[6.47,3.84],[2.87,4.5],[0,6.63],[.67,5.52],[1.33,4.42],[2,3.31],[1.33,2.21],[.67,1.1],[0,0],[2.87,2.13],[6.47,2.79],[10,3.31]],qe=ce.length,Re=0;Re<qe;Re++)ce[Re][0]*=se,ce[Re][1]*=se,ce[Re][0]-=10*se,ce[Re][1]-=3.31*se;else if(be===5)for(se/=10,Ce=3,ce=[[10,3.28],[6.61,4.19],[3.19,5.07],[0,6.55],[.62,5.56],[1,4.44],[1,3.28],[1,2.11],[.62,.99],[0,0],[3.19,1.49],[6.61,2.37],[10,3.28]],qe=ce.length,Re=0;Re<qe;Re++)ce[Re][0]*=se,ce[Re][1]*=se,ce[Re][0]-=10*se,ce[Re][1]-=3.28*se;else if(be===6)for(se/=10,Ce=3,ce=[[10,2.84],[6.61,3.59],[3.21,4.35],[0,5.68],[.33,4.73],[.67,3.78],[1,2.84],[.67,1.89],[.33,.95],[0,0],[3.21,1.33],[6.61,2.09],[10,2.84]],qe=ce.length,Re=0;Re<qe;Re++)ce[Re][0]*=se,ce[Re][1]*=se,ce[Re][0]-=10*se,ce[Re][1]-=2.84*se;else if(be===7)for(se=ae,Ce=3,ce=[[0,10.39],[2.01,6.92],[5.96,5.2],[10,5.2],[5.96,5.2],[2.01,3.47],[0,0]],qe=ce.length,Re=0;Re<qe;Re++)ce[Re][0]*=se,ce[Re][1]*=se,ce[Re][0]-=10*se,ce[Re][1]-=5.2*se;else ce=[[-se,-se*.5],[0,0],[-se,se*.5]];
141ge.save(),this._setColor(v,"stroke","fill")&&(this._setColor(v,"stroke"),ut&&(Ee===7?Ve=!1:Ve=!0,this._drawPolygon(this._translateShape(this._rotateShape(pe,it),Y,W),Je,Ve)),ct&&(Pe===7?Ve=!1:Ve=!0,this._drawPolygon(this._translateShape(this._rotateShape(ce,ot),ie,ne),Ce,Ve))),ge.restore()}},drawLine:function(v){var N,G,z=new Coords(Const.COORDS_BY_USER,v.point1.coords.usrCoords,v.board),q=new Coords(Const.COORDS_BY_USER,v.point2.coords.usrCoords,v.board),Y=null,W,ie,ne;v.visPropCalc.visible&&(W=this._getHighlighted(v),ie=v.evalVisProp(W+"strokewidth"),ne=this.getArrowHeadData(v,ie,W),(ne.evFirst||ne.evLast)&&(Y=-4),Geometry.calcStraight(v,z,q,Y),this.handleTouchpoints(v,z,q,ne),N=new Coords(Const.COORDS_BY_USER,z.usrCoords,v.board),G=new Coords(Const.COORDS_BY_USER,q.usrCoords,v.board),this.getPositionArrowHead(v,z,q,ne),this.context.beginPath(),this.context.moveTo(z.scrCoords[1],z.scrCoords[2]),this.context.lineTo(q.scrCoords[1],q.scrCoords[2]),this._stroke(v),(ne.evFirst||ne.evLast)&&this.drawArrows(v,N,G,W,ne))},updateLine:function(v){this.drawLine(v)},drawTicks:function(){},updateTicks:function(v){var N,G,z,q,Y=v.ticks.length,W,ie,ne=this.context;for(ne.beginPath(),N=0;N<Y;N++)for(G=v.ticks[N],z=G[0],q=G[1],W=z.length,ne.moveTo(z[0],q[0]),ie=1;ie<W;++ie)ne.lineTo(z[ie],q[ie]);ne.lineCap="round",this._stroke(v)},drawCurve:function(v){var N,G,z;v.evalVisProp("handdrawing")?this.updatePathStringBezierPrim(v):this.updatePathStringPrim(v),v.numberPoints>1&&(N=this._getHighlighted(v),G=v.evalVisProp(N+"strokewidth"),z=this.getArrowHeadData(v,G,N),(z.evFirst||z.evLast)&&this.drawArrows(v,null,null,N,z))},updateCurve:function(v){this.drawCurve(v)},drawEllipse:function(v){var N=v.center.coords.scrCoords[1],G=v.center.coords.scrCoords[2],z=v.board.unitX,q=v.board.unitY,Y=2*v.Radius(),W=2*v.Radius(),ie=Y*z,ne=W*q,se=N-ie/2,ae=G-ne/2,ce=ie/2*.5522848,pe=ne/2*.5522848,ge=se+ie,ve=ae+ne,be=se+ie/2,Ee=ae+ne/2,Pe=this.context;Y>0&&W>0&&!isNaN(N+G)&&(Pe.beginPath(),Pe.moveTo(se,Ee),Pe.bezierCurveTo(se,Ee-pe,be-ce,ae,be,ae),Pe.bezierCurveTo(be+ce,ae,ge,Ee-pe,ge,Ee),Pe.bezierCurveTo(ge,Ee+pe,be+ce,ve,be,ve),Pe.bezierCurveTo(be-ce,ve,se,Ee+pe,se,Ee),Pe.closePath(),this._fill(v),this._stroke(v))},updateEllipse:function(v){return this.drawEllipse(v)},displayCopyright:function(v,N){var G=this.context;G.save(),G.font=N+"px Arial",G.fillStyle="#aaa",G.lineWidth=.5,G.fillText(v,10,2+N),G.restore()},drawInternalText:function(v){var N=v.evalVisProp("fontsize"),G=v.evalVisProp("fontunit"),z=v.getAnchorX(),q=v.getAnchorY(),Y=this.context;return Y.save(),this._setColor(v,"stroke","fill")&&!isNaN(v.coords.scrCoords[1]+v.coords.scrCoords[2])&&(Y.font=(N>0?N:0)+G+" Arial",this.transformRect(v,v.transformations),z==="left"?Y.textAlign="left":z==="right"?Y.textAlign="right":z==="middle"&&(Y.textAlign="center"),q==="bottom"?Y.textBaseline="bottom":q==="top"?Y.textBaseline="top":q==="middle"&&(Y.textBaseline="middle"),Y.fillText(v.plaintext,v.coords.scrCoords[1],v.coords.scrCoords[2])),Y.restore(),null},updateInternalText:function(v){this.drawInternalText(v)},setObjectStrokeColor:function(v,N,G){var z=N,q,Y,W=G,ie,ne;W=W>0?W:0,!(v.visPropOld.strokecolor===z&&v.visPropOld.strokeopacity===W)&&(JXG$1.exists(z)&&z!==!1&&(z.length!==9?(q=z,ie=W):(Y=JXG$1.rgba2rgbo(z),q=Y[0],ie=W*Y[1]),ne=v.rendNode,v.elementClass===Const.OBJECT_CLASS_TEXT&&v.evalVisProp("display")==="html"&&(ne.style.color=q,ne.style.opacity=ie)),v.visPropOld.strokecolor=z,v.visPropOld.strokeopacity=W)},drawImage:function(v){v.rendNode=new Image,v._src="",this.updateImage(v)},updateImage:function(v){var N=this.context,G=v.evalVisProp("fillopacity"),z=JXG$1.bind(function(){v.imgIsLoaded=!0,!(v.size[0]<=0||v.size[1]<=0)&&(N.save(),N.globalAlpha=G,this.transformRect(v,v.transformations),N.drawImage(v.rendNode,v.coords.scrCoords[1],v.coords.scrCoords[2]-v.size[1],v.size[0],v.size[1]),N.restore())},this);this.updateImageURL(v)?v.rendNode.onload=z:v.imgIsLoaded&&z()},transformRect:function(v,N){var G,z,q,Y,W,ie=N.length,ne=this.context;if(ie>0)if(G=this.joinTransforms(v,N),v.elementClass===Const.OBJECT_CLASS_TEXT&&v.visProp.display==="html"){if(z=" matrix("+[G[1][1],G[2][1],G[1][2],G[2][2],G[1][0],G[2][0]].join(",")+") ",z.indexOf("NaN")===-1){switch(W=v.rendNode,W.style.transform=z,q=-v.coords.scrCoords[1],Y=-v.coords.scrCoords[2],v.evalVisProp("anchorx")){case"right":q+=v.size[0];break;case"middle":q+=v.size[0]*.5;break}switch(v.evalVisProp("anchory")){case"bottom":Y+=v.size[1];break;case"middle":Y+=v.size[1]*.5;break}W.style["transform-origin"]=q+"px "+Y+"px"}}else Math.abs(Numerics.det(G))>=Mat.eps&&ne.transform(G[1][1],G[2][1],G[1][2],G[2][2],G[1][0],G[2][0])},updateImageURL:function(v){var N;return N=v.eval(v.url),v._src!==N?(v.imgIsLoaded=!1,v.rendNode.src=N,v._src=N,!0):!1},remove:function(v){JXG$1.exists(v)&&JXG$1.exists(v.parentNode)&&v.parentNode.removeChild(v)},updatePathStringPrim:function(v){var N,G,z,q,Y,W="M",ie="L",ne="C",se=W,ae=5e3,ce=this.context;if(!(v.numberPoints<=0)){if(Y=Math.min(v.points.length,v.numberPoints),ce.beginPath(),v.bezierDegree===1)for(N=0;N<Y;N++)G=v.points[N].scrCoords,isNaN(G[1])||isNaN(G[2])?se=W:(G[1]>ae?G[1]=ae:G[1]<-5e3&&(G[1]=-5e3),G[2]>ae?G[2]=ae:G[2]<-5e3&&(G[2]=-5e3),se===W?ce.moveTo(G[1],G[2]):ce.lineTo(G[1],G[2]),se=ie);else if(v.bezierDegree===3)for(N=0;N<Y;)G=v.points[N].scrCoords,isNaN(G[1])||isNaN(G[2])?se=W:(se===W?ce.moveTo(G[1],G[2]):(N+=1,z=v.points[N].scrCoords,N+=1,q=v.points[N].scrCoords,ce.bezierCurveTo(G[1],G[2],z[1],z[2],q[1],q[2])),se=ne),N+=1;ce.lineCap="round",ce.lineJoin="round",this._fill(v),this._stroke(v)}},updatePathStringBezierPrim:function(v){var N,G,z,q,Y,W,ie,ne="M",se="C",ae=ne,ce=5e3,pe=v.evalVisProp("strokewidth"),ge=v.evalVisProp("curvetype")!=="plot",ve=this.context;if(!(v.numberPoints<=0)){for(ge&&v.board.options.curve.RDPsmoothing&&(v.points=Numerics.RamerDouglasPeucker(v.points,.5)),ie=Math.min(v.points.length,v.numberPoints),ve.beginPath(),G=1;G<3;G++)for(ae=ne,N=0;N<ie;N++)q=v.points[N].scrCoords,isNaN(q[1])||isNaN(q[2])?ae=ne:(q[1]>ce?q[1]=ce:q[1]<-5e3&&(q[1]=-5e3),q[2]>ce?q[2]=ce:q[2]<-5e3&&(q[2]=-5e3),ae===ne?ve.moveTo(q[1],q[2]):(z=2*G,ve.bezierCurveTo(Y+(q[1]-Y)*.333+pe*(z*Math.random()-G),W+(q[2]-W)*.333+pe*(z*Math.random()-G),Y+(q[1]-Y)*.666+pe*(z*Math.random()-G),W+(q[2]-W)*.666+pe*(z*Math.random()-G),q[1],q[2])),ae=se,Y=q[1],W=q[2]);ve.lineCap="round",ve.lineJoin="round",this._fill(v),this._stroke(v)}},updatePolygonPrim:function(v,N){var G,z,q,Y=N.vertices.length,W=this.context,ie=!0;if(!(Y<=0||!N.visPropCalc.visible)){for(N.elType==="polygonalchain"&&Y++,W.beginPath(),z=0;!N.vertices[z].isReal&&z<Y-1;)z++,ie=!1;for(G=N.vertices[z].coords.scrCoords,W.moveTo(G[1],G[2]),q=z;q<Y-1;q++)N.vertices[q].isReal||(ie=!1),G=N.vertices[q].coords.scrCoords,W.lineTo(G[1],G[2]);W.closePath(),ie&&this._fill(N)}},display:function(v,N){v&&v.rendNode&&(v.visPropOld.visible=N,N?v.rendNode.style.visibility="inherit":v.rendNode.style.visibility="hidden")},show:function(v){JXG$1.deprecated("Board.renderer.show()","Board.renderer.display()"),JXG$1.exists(v.rendNode)&&(v.rendNode.style.visibility="inherit")},hide:function(v){JXG$1.deprecated("Board.renderer.hide()","Board.renderer.display()"),JXG$1.exists(v.rendNode)&&(v.rendNode.style.visibility="hidden")},setGradient:function(v){},setShadow:function(v){v.visPropOld.shadow!==v.visProp.shadow&&(v.visPropOld.shadow=v.visProp.shadow)},highlight:function(v){return v.elementClass===Const.OBJECT_CLASS_TEXT&&v.evalVisProp("display")==="html"?this.updateTextStyle(v,!0):(v.board.prepareUpdate(),v.board.renderer.suspendRedraw(v.board),v.board.updateRenderer(),v.board.renderer.unsuspend
141Redraw()),this},noHighlight:function(v){return v.elementClass===Const.OBJECT_CLASS_TEXT&&v.evalVisProp("display")==="html"?this.updateTextStyle(v,!1):(v.board.prepareUpdate(),v.board.renderer.suspendRedraw(v.board),v.board.updateRenderer(),v.board.renderer.unsuspendRedraw()),this},suspendRedraw:function(v){this.context.save(),this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height),v&&v.attr.showcopyright&&this.displayCopyright(JXG$1.licenseText,12)},unsuspendRedraw:function(){this.context.restore()},resize:function(v,N){this.container?(this.canvasRoot.style.width=parseFloat(v)+"px",this.canvasRoot.style.height=parseFloat(N)+"px",this.canvasRoot.setAttribute("width",2*parseFloat(v)+"px"),this.canvasRoot.setAttribute("height",2*parseFloat(N)+"px")):(this.canvasRoot.width=2*parseFloat(v),this.canvasRoot.height=2*parseFloat(N)),this.context=this.canvasRoot.getContext("2d"),this.context.scale(2,2)},removeToInsertLater:function(){return function(){}}});const CanvasRenderer=JXG$1.CanvasRenderer;JXG$1.NoRenderer=function(){this.enhancedRendering=!1,this.type="no"};JXG$1.extend(JXG$1.NoRenderer.prototype,{drawPoint:function(v){},updatePoint:function(v){},changePointStyle:function(v){},drawLine:function(v){},updateLine:function(v){},drawTicks:function(v){},updateTicks:function(v){},drawCurve:function(v){},updateCurve:function(v){},drawEllipse:function(v){},updateEllipse:function(v){},drawPolygon:function(v){},updatePolygon:function(v){},displayCopyright:function(v,N){},drawInternalText:function(v){},updateInternalText:function(v){},drawText:function(v){},updateText:function(v){},updateTextStyle:function(v,N){},updateInternalTextStyle:function(v,N,G){},drawImage:function(v){},updateImage:function(v){},updateImageURL:function(v){},appendChildPrim:function(v,N){},appendNodesToElement:function(v,N){},remove:function(v){},makeArrows:function(v){},updateEllipsePrim:function(v,N,G,z,q){},updateLinePrim:function(v,N,G,z,q,Y){},updatePathPrim:function(v,N,G){},updatePathStringPoint:function(v,N,G){},updatePathStringPrim:function(v){},updatePathStringBezierPrim:function(v){},updatePolygonPrim:function(v,N){},updateRectPrim:function(v,N,G,z,q){},setPropertyPrim:function(v,N,G){},show:function(v){},hide:function(v){},setBuffering:function(v,N){},setDashStyle:function(v){},setDraft:function(v){},removeDraft:function(v){},setGradient:function(v){},updateGradient:function(v){},setObjectTransition:function(v,N){},setObjectFillColor:function(v,N,G){},setObjectStrokeColor:function(v,N,G){},setObjectStrokeWidth:function(v,N){},setShadow:function(v){},highlight:function(v){},noHighlight:function(v){},suspendRedraw:function(){},unsuspendRedraw:function(){},drawNavigationBar:function(v){},getElementById:function(v){return null},resize:function(v,N){},removeToInsertLater:function(){return function(){}}});JXG$1.NoRenderer.prototype=new AbstractRenderer;const NoRenderer=JXG$1.NoRenderer;JXG$1.JSXGraph={rendererType:function(){return Options.board.renderer="no",JXG$1.supportsVML()&&(Options.board.renderer="vml",document.onmousemove=function(){var v;return document.body&&(v=document.body.scrollLeft,v+=document.body.scrollTop),v}),JXG$1.supportsCanvas()&&(Options.board.renderer="canvas"),JXG$1.supportsSVG()&&(Options.board.renderer="svg"),JXG$1.isNode()&&JXG$1.supportsCanvas()&&(Options.board.renderer="canvas"),(JXG$1.isNode()||Options.renderer==="no")&&(Options.text.display="internal",Options.infobox.display="internal"),Options.board.renderer}(),initRenderer:function(v,N,G,z){var q,Y;if((!JXG$1.exists(G)||G===!1)&&typeof document=="object"&&(G=document),typeof G=="object"&&v!==null)for(q=JXG$1.isString(v)?G.getElementById(v):v;q.firstChild;)q.removeChild(q.firstChild);else q=v;return(z===void 0||z==="auto")&&(z=this.rendererType),z==="svg"?Y=new SVGRenderer(q,N):z==="vml"?Y=new VMLRenderer(q):z==="canvas"?Y=new CanvasRenderer(q,N):Y=new NoRenderer,Y},_setAttributes:function(v,N){var G=JXG$1.copyAttributes(v,N,"board"),z=["drag","fullscreen","intl","keyboard","logging","pan","resize","screenshot","selection","zoom"],q=z.length,Y,W;for(Y=0;Y<q;Y++)W=z[Y],G[W]=JXG$1.copyAttributes(G,N,"board",W);return G.navbar=JXG$1.copyAttributes(G.navbar,N,"navbar"),G.movetarget=v.moveTarget||v.movetarget||N.board.moveTarget,G},_fillBoard:function(v,N,G){v.initInfobox(N.infobox),v.maxboundingbox=N.maxboundingbox,v.resizeContainer(G.width,G.height,!0,!0),v._createSelectionPolygon(N),v.renderer.drawNavigationBar(v,N.navbar),JXG$1.boards[v.id]=v},_setARIA:function(v,N){var G=N.document,z;if(typeof G!="object"){if(!JXG$1.isBrowser)return;G=document}z=JXG$1.isString(v)?G.getElementById(v):v,z.setAttribute("role","regi
141on"),z.setAttribute("aria-label",N.title)},_removeARIANodes:function(v){var N,G,z;z=v.document||document,typeof z=="object"&&(G=v.containerObj.getAttribute("aria-labelledby"),N=z.getElementById(G),N&&N.parentNode&&N.parentNode.removeChild(N),G=v.containerObj.getAttribute("aria-describedby"),N=z.getElementById(G),N&&N.parentNode&&N.parentNode.removeChild(N))},initBoard:function(v,N){var G,z,q,Y,W,ie,ne=0,se=0,ae,ce,pe,ge,ve,be,Ee,Pe,Je={},Ce;return N=N||{},N.theme!=="default"&&JXG$1.exists(JXG$1.themes[N.theme])&&(Je=JXG$1.themes[N.theme]),Pe=JXG$1.deepCopy(Options,Je,!0),ge=this._setAttributes(N,Pe),ce=JXG$1.getDimensions(v,ge.document),ge.unitx||ge.unity?(G=JXG$1.def(ge.originx,150),z=JXG$1.def(ge.originy,150),q=JXG$1.def(ge.unitx,50),Y=JXG$1.def(ge.unity,50)):(pe=ge.boundingbox,pe[0]<ge.maxboundingbox[0]&&(pe[0]=ge.maxboundingbox[0]),pe[1]>ge.maxboundingbox[1]&&(pe[1]=ge.maxboundingbox[1]),pe[2]>ge.maxboundingbox[2]&&(pe[2]=ge.maxboundingbox[2]),pe[3]<ge.maxboundingbox[3]&&(pe[3]=ge.maxboundingbox[3]),W=parseInt(ce.width,10),ie=parseInt(ce.height,10),JXG$1.exists(pe)&&ge.keepaspectratio?(q=W/(pe[2]-pe[0]),Y=ie/(pe[1]-pe[3]),Math.abs(q)<Math.abs(Y)?(Y=Math.abs(q)*Y/Math.abs(Y),se=(ie/Y-(pe[1]-pe[3]))*.5):(q=Math.abs(Y)*q/Math.abs(q),ne=(W/q-(pe[2]-pe[0]))*.5)):(q=W/(pe[2]-pe[0]),Y=ie/(pe[1]-pe[3])),G=-q*(pe[0]-ne),z=Y*(pe[1]+se)),ae=this.initRenderer(v,ce,ge.document,ge.renderer),this._setARIA(v,ge),Ce=new Board(v,ae,ge.id,[G,z],ge.zoomx,ge.zoomy,q,Y,ce.width,ce.height,ge),Ce.keepaspectratio=ge.keepaspectratio,this._fillBoard(Ce,ge,ce),Ce.suspendUpdate(),ge=Ce.attr,ge.axis&&(ve=typeof ge.axis=="object"?ge.axis:{},be=JXG$1.deepCopy(Pe.board.defaultaxes.x,ve),Ee=JXG$1.deepCopy(Pe.board.defaultaxes.y,ve),ge.defaultaxes.x&&(be=JXG$1.deepCopy(be,ge.defaultaxes.x)),ge.defaultaxes.y&&(Ee=JXG$1.deepCopy(Ee,ge.defaultaxes.y)),Ce.defaultAxes={},Ce.defaultAxes.x=Ce.create("axis",[[0,0],[1,0]],be),Ce.defaultAxes.y=Ce.create("axis",[[0,0],[0,1]],Ee)),ge.grid&&Ce.create("grid",[],typeof ge.grid=="object"?ge.grid:{}),Ce.unsuspendUpdate(),Ce},loadBoardFromFile:function(v,N,G,z,q){var Y,W,ie,ne,se;return z=z||{},Y=this._setAttributes(z),ne=JXG$1.getDimensions(v,Y.document),W=this.initRenderer(v,ne,Y.document,Y.renderer),this._setARIA(v,Y),ie=new Board(v,W,"",[150,150],1,1,50,50,ne.width,ne.height,Y),this._fillBoard(ie,Y,ne),se=Y.encoding||"iso-8859-1",FileReader$1.parseFileContent(N,ie,G,!0,se,q),ie},loadBoardFromString:function(v,N,G,z,q){var Y,W,ie,ne;return z=z||{},Y=this._setAttributes(z),ne=JXG$1.getDimensions(v,Y.document),W=this.initRenderer(v,ne,Y.document,Y.renderer),this._setARIA(v,Y),ie=new Board(v,W,"",[150,150],1,1,50,50,ne.width,ne.height,Y),this._fillBoard(ie,Y,ne),FileReader$1.parseString(N,ie,G,!0,q),ie},freeBoard:function(v){var N;
141typeof v=="string"&&(v=JXG$1.boards[v]),this._removeARIANodes(v),v.removeEventHandlers(),v.suspendUpdate();for(N in v.objects)v.objects.hasOwnProperty(N)&&v.objects[N].remove();for(;v.containerObj.firstChild;)v.containerObj.removeChild(v.containerObj.firstChild);for(N in v.objects)v.objects.hasOwnProperty(N)&&delete v.objects[N];delete v.renderer,v.jc.creator.clearCache(),delete v.jc,delete JXG$1.boards[v.id]},registerElement:function(v,N){JXG$1.deprecated("JXG.JSXGraph.registerElement()","JXG.registerElement()"),JXG$1.registerElement(v,N)}};JXG$1.isBrowser&&typeof window=="object"&&typeof document=="object"&&JXG$1.addEvent(window,"load",function(){var v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je=!1,Ce=document.getElementsByTagName("script"),Ve=function(qe,et,Ze){var tt=JXG$1.JSXGraph.initBoard(q,{boundingbox:Ze,keepaspectratio:!0,grid:ve,axis:ge,showReload:!0});if(et.toLowerCase().indexOf("script")>-1)tt.construct(qe);else try{tt.jc.parse(qe)}catch(Ke){JXG$1.debug(Ke)}return tt},Re=function(qe,et,Ze,tt){return function(){var Ke;JXG$1.JSXGraph.freeBoard(qe),Ke=Ve(et,Ze,tt),Ke.reload=Re(Ke,et,Ze,tt)}};for(N=0;N<Ce.length;N++)if(v=Ce[N].getAttribute("type",!1),JXG$1.exists(v)&&(v.toLowerCase()==="text/jessiescript"||v.toLowerCase()==="jessiescript"||v.toLowerCase()==="text/jessiecode"||v.toLowerCase()==="jessiecode")){if(ce=Ce[N].getAttribute("class",!1)||"",ie=Ce[N].getAttribute("width",!1)||"",ne=Ce[N].getAttribute("height",!1)||"",se=Ce[N].getAttribute("maxwidth",!1)||"100%",ae=Ce[N].getAttribute("aspectratio",!1)||"1/1",pe=Ce[N].getAttribute("boundingbox",!1)||"-5, 5, 5, -5",q=Ce[N].getAttribute("container",!1),Ee=Ce[N].getAttribute("src",!1),pe=pe.split(","),pe.length!==4)pe=[-5,5,5,-5];else for(G=0;G<pe.length;G++)pe[G]=parseFloat(pe[G]);if(ge=JXG$1.str2Bool(Ce[N].getAttribute("axis",!1)||"false"),ve=JXG$1.str2Bool(Ce[N].getAttribute("grid",!1)||"false"),JXG$1.exists(q))z=document.getElementById(q);else{q="jessiescript_autgen_jxg_"+N,z=document.createElement("div"),z.setAttribute("id",q),W=ie!==""?"width:"+ie+";":"",W+=ne!==""?"height:"+ne+";":"",W+=se!==""?"max-width:"+se+";":"",W+=ae!==""?"aspect-ratio:"+ae+";":"",z.setAttribute("style",W),z.setAttribute("class","jxgbox "+ce);try{document.body.insertBefore(z,Ce[N])}catch{typeof jQuery=="object"&&jQuery(z).insertBefore(Ce[N])}}be="",JXG$1.exists(Ee)?(Je=!0,Pe=new XMLHttpRequest,Pe.open("GET",Ee),Pe.overrideMimeType("text/plain; charset=x-user-defined"),Pe.addEventListener("load",function(){if(this.status<400)be=this.responseText+`
142`+be,Y=Ve(be,v,pe),Y.reload=Re(Y,be,v,pe);else throw new Error(`
143JSXGraph: failed to load file`,Ee,":",this.responseText)}),Pe.addEventListener("error",function(qe){throw new Error(`
144JSXGraph: failed to load file`,Ee,":",qe)}),Pe.send()):Je=!1,document.getElementById(q)?(be=Ce[N].innerHTML,be=be.replace(/<!\[CDATA\[/g,"").replace(/\]\]>/g,""),Ce[N].innerHTML=be,Je||(Y=Ve(be,v,pe),Y.reload=Re(Y,be,v,pe))):JXG$1.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}},window);JXG$1.JSXGraph;JXG$1.Point=function(v,N,G){this.constructor(v,G,Const.OBJECT_TYPE_POINT,Const.OBJECT_CLASS_POINT),this.element=this.board.select(G.anchor),this.coordsConstructor(N),this.elType="point",this.id=this.board.setId(this,"P"),this.board.renderer.drawPoint(this),this.board.finalizeAdding(this),this.createGradient(),this.createLabel()};JXG$1.Point.prototype=new GeometryElement;
144JXG$1.copyPrototypeMethods(JXG$1.Point,CoordsElement,"coordsConstructor");JXG$1.extend(JXG$1.Point.prototype,{hasPoint:function(v,N){var G=this.coords.scrCoords,z,q,Y,W=this.evalVisProp("sizeunit");return JXG$1.isObject(this.evalVisProp("precision"))?(Y=this.board._inputDevice,q=this.evalVisProp("precision."+Y)):q=this.board.options.precision.hasPoint,z=parseFloat(this.evalVisProp("size")),W==="user"&&(z*=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY))),z+=parseFloat(this.evalVisProp("strokewidth"))*.5,z<q&&(z=q),Math.abs(G[1]-v)<z+2&&Math.abs(G[2]-N)<z+2},update:function(v){return this.needsUpdate?(this.updateCoords(v),this.evalVisProp("trace")&&this.cloneToBackground(!0),this):this},updateTransform:function(v){var N,G;if(this.transformations.length===0||this.baseElement===null)return this;for(this.transformations[0].update(),this===this.baseElement?N=this.transformations[0].apply(this,"self"):N=this.transformations[0].apply(this.baseElement),G=1;G<this.transformations.length;G++)this.transformations[G].update(),N=Mat.matVecMult(this.transformations[G].matrix,N);return this.coords.setCoordinates(Const.COORDS_BY_USER,N),this},updateRenderer:function(){return this.updateRendererGeneric("updatePoint"),this},bounds:function(){return this.coords.usrCoords.slice(1).concat(this.coords.usrCoords.slice(1))},makeIntersection:function(v,N,G,z){var q;v=this.board.select(v),N=this.board.select(N),q=Geometry.intersectionFunction(this.board,v,N,G,z,this.visProp.alwaysintersect),this.addConstraint([q]);try{v.addChild(this),N.addChild(this)}catch{throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof v+"' and '"+typeof N+"'.")}this.type=Const.OBJECT_TYPE_INTERSECTION,this.elType="intersection",this.parents=[v.id,N.id,G,z],this.generatePolynomial=function(){var Y=v.generatePolynomial(this),W=N.generatePolynomial(this);return Y.length===0||W.length===0?[]:[Y[0],W[0]]},this.prepareUpdate().update()},setStyle:function(v){var N=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"],G=[2,3,4,1,2,3,4,2,3,4,2,3,4];return this.visProp.face=N[v],this.visProp.size=G[v],this.board.renderer.changePointStyle(this),this},normalizeFace:function(v){return JXG$1.deprecated("Point.normalizeFace()","JXG.normalizePointFace()"),Options.normalizePointFace(v)},face:function(v){JXG$1.deprecated("Point.face()","Point.setAttribute()"),this.setAttribute({face:v})},size:function(v){JXG$1.deprecated("Point.size()","Point.setAttribute()"),this.setAttribute({size:v})},isOn:function(v,N){var G,z;return N=N||Mat.eps,JXG$1.isPoint(v)?this.Dist(v)<N:v.elementClass===Const.OBJECT_CLASS_LINE?v.elType==="segment"&&!this.evalVisProp("alwaysintersect")?(G=JXG$1.Math.Geometry.projectCoordsToSegment(this.coords.usrCoords,v.point1.coords.usrCoords,v.point2.coords.usrCoords),G[1]>=0&&G[1]<=1&&Geometry.distPointLine(this.coords.usrCoords,v.stdform)<N):Geometry.distPointLine(this.coords.usrCoords,v.stdform)<N:v.elementClass===Const.OBJECT_CLASS_CIRCLE?v.evalVisProp("hasinnerpoints")?this.Dist(v.center)<v.Radius()+N:Math.abs(this.Dist(v.center)-v.Radius())<N:v.elementClass===Const.OBJECT_CLASS_CURVE?(z=Geometry.projectPointToCurve(this,v,this.board)[0],Geometry.distance(this.coords.usrCoords,z.usrCoords,3)<N):v.type===Const.OBJECT_TYPE_POLYGON?v.evalVisProp("hasinnerpoints")&&v.pnpoly(this.coords.usrCoords[1],this.coords.usrCoords[2],JXG$1.COORDS_BY_USER)?!0:(G=Geometry.projectCoordsToPolygon(this.coords.usrCoords,v),Geometry.distance(this.coords.usrCoords,G,3)<N):v.type===Const.OBJECT_TYPE_TURTLE?(z=Geometry.projectPointToTurtle(this,v,this.board),Geometry.distance(this.coords.usrCoords,z.usrCoords,3)<N):!1},cloneToBackground:function(){var v=JXG$1.getCloneObject(this);return this.board.renderer.drawPoint(v),this.traces[v.id]=v.rendNode,this}});JXG$1.createPoint=function(v,N,G){var z,q;if(q=JXG$1.copyAttributes(G,v.options,"point"),z=CoordsElement.create(JXG$1.Point,v,N,q),!z)throw new Error("JSXGraph: Can't create point with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
145Possible parent types: [x,y], [z,x,y], [element,transformation]`);return z};JXG$1.createGlider=function(v,N,G){var z,q,Y=JXG$1.copyAttributes(G,v.options,"glider");return N.length===1?q=[0,0]:q=N.slice(0,2),z=v.create("point",q,Y),z.makeGlider(N[N.length-1]),z};JXG$1.createIntersectionPoint=function(v,N,G){var z,q,Y,W,ie,ne,se=JXG$1.copyAttributes(G,v.options,"intersection");N.push(0,0),q=v.select(N[0]),Y=v.select(N[1]),ie=N[2]||0,ne=N[3]||0,z=v.create("point",[0,0,0],se),W=Geometry.intersectionFunction(v,q,Y,ie,ne,z.visProp.alwaysintersect),z.addConstraint([W]);try{q.addChild(z),Y.addChild(z)}catch{throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"'.")}return z.type=Const.OBJECT_TYPE_INTERSECTION,z.elType="intersection",z.setParents([q.id,Y.id]),z.intersectionNumbers=[ie,ne],z.getParents=function(){return this.parents.concat(this.intersectionNumbers)},z.generatePolynomial=function(){var ae=q.generatePolynomial(z),ce=Y.generatePolynomial(z);return ae.length===0||ce.length===0?[]:[ae[0],ce[0]]},z};JXG$1.createOtherIntersectionPoint=function(v,N,G){var z,q,Y,W,ie,ne,se,ae=!0,ce=JXG$1.copyAttributes(G,v.options,"otherintersection");if(N.length!==3)ae=!1;
145else{for(q=v.select(N[0]),Y=v.select(N[1]),JXG$1.isArray(N[2])?ie=N[2]:ie=[N[2]],W=0;W<ie.length;W++)if(ie[W]=v.select(ie[W]),!JXG$1.isPoint(ie[W])){ae=!1;break}ae&&(se=[q,Y],se.sort(function(pe,ge){return ge.elementClass-pe.elementClass}),([Const.OBJECT_CLASS_CIRCLE,Const.OBJECT_CLASS_CURVE].indexOf(se[0].elementClass)<0||[Const.OBJECT_CLASS_CIRCLE,Const.OBJECT_CLASS_CURVE,Const.OBJECT_CLASS_LINE].indexOf(se[1].elementClass)<0)&&(ae=!1))}if(!ae)throw new Error("JSXGraph: Can't create 'other intersection point' with parent types '"+typeof N[0]+"',  '"+typeof N[1]+"'and  '"+typeof N[2]+`'.
146Possible parent types: [circle|curve|line,circle|curve|line, point], not two lines`);return z=v.create("point",[0,0,0],ce),ne=Geometry.otherIntersectionFunction(se,ie,z.visProp.alwaysintersect,z.visProp.precision),z.addConstraint([ne]),z.type=Const.OBJECT_TYPE_INTERSECTION,z.elType="otherintersection",z.setParents([q.id,Y.id]),z.addParents(ie),q.addChild(z),Y.addChild(z),q.elementClass===Const.OBJECT_CLASS_CIRCLE&&(z.generatePolynomial=function(){var pe=q.generatePolynomial(z),ge=Y.generatePolynomial(z);return pe.length===0||ge.length===0?[]:[pe[0],ge[0]]}),z};JXG$1.createPolePoint=function(v,N,G){var z,q,Y,W,ie,ne,se;if(N.length>1&&(W=N[0].type===Const.OBJECT_TYPE_CONIC||N[0].elementClass===Const.OBJECT_CLASS_CIRCLE,ie=N[1].type===Const.OBJECT_TYPE_CONIC||N[1].elementClass===Const.OBJECT_CLASS_CIRCLE,ne=N[0].elementClass===Const.OBJECT_CLASS_LINE,se=N[1].elementClass===Const.OBJECT_CLASS_LINE),N.length!==2||!(W&&se||ne&&ie))throw new Error("JSXGraph: Can't create 'pole point' with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
147Possible parent type: [conic|circle,line], [line,conic|circle]`);return se?(q=v.select(N[0]),Y=v.select(N[1])):(q=v.select(N[1]),Y=v.select(N[0])),z=v.create("point",[function(){var ae=q.quadraticform,ce=Y.stdform.slice(0,3);return[JXG$1.Math.Numerics.det([ce,ae[1],ae[2]]),JXG$1.Math.Numerics.det([ae[0],ce,ae[2]]),JXG$1.Math.Numerics.det([ae[0],ae[1],ce])]}],G),z.elType="polepoint",z.setParents([q.id,Y.id]),q.addChild(z),Y.addChild(z),z};JXG$1.registerElement("point",JXG$1.createPoint);JXG$1.registerElement("glider",JXG$1.createGlider);JXG$1.registerElement("intersection",JXG$1.createIntersectionPoint);JXG$1.registerElement("otherintersection",JXG$1.createOtherIntersectionPoint);JXG$1.registerElement("polepoint",JXG$1.createPolePoint);const Point=JXG$1.Point;JXG$1.Line=function(v,N,G,z){this.constructor(v,z,Const.OBJECT_TYPE_LINE,Const.OBJECT_CLASS_LINE),this.point1=this.board.select(N),this.point2=this.board.select(G),this.ticks=[],this.defaultTicks=null,this.parentPolygon=null,this.id=this.board.setId(this,"L"),this.board.renderer.drawLine(this),this.board.finalizeAdding(this),this.elType="line",this.point1._is_new?(this.addChild(this.point1),delete this.point1._is_new):this.point1.addChild(this),this.point2._is_new?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this),this.inherits.push(this.point1,this.point2),this.updateStdform(),this.createLabel(),this.methodMap=JXG$1.deepCopy(this.methodMap,{point1:"point1",point2:"point2",getSlope:"Slope",Slope:"Slope",Direction:"Direction",getRise:"getRise",Rise:"getRise",getYIntersect:"getRise",YIntersect:"getRise",getAngle:"getAngle",Angle:"getAngle",L:"L",length:"L",setFixedLe
147ngth:"setFixedLength",setStraight:"setStraight"})};JXG$1.Line.prototype=new GeometryElement;JXG$1.extend(JXG$1.Line.prototype,{hasPoint:function(v,N){var G=[],z=[1,v,N],q,Y,W,ie,ne,se,ae,ce,pe,ge=this.evalVisProp("strokewidth");return JXG$1.isObject(this.evalVisProp("precision"))?(pe=this.board._inputDevice,ce=this.evalVisProp("precision."+pe)):ce=this.board.options.precision.hasPoint,ce+=ge*.5,G[0]=this.stdform[0]-this.stdform[1]*this.board.origin.scrCoords[1]/this.board.unitX+this.stdform[2]*this.board.origin.scrCoords[2]/this.board.unitY,G[1]=this.stdform[1]/this.board.unitX,G[2]=this.stdform[2]/-this.board.unitY,q=Geometry.distPointLine(z,G),isNaN(q)||q>ce?!1:this.evalVisProp("straightfirst")&&this.evalVisProp("straightlast")?!0:(W=this.point1.coords,ie=this.point2.coords,Y=[0,G[1],G[2]],Y=Mat.crossProduct(Y,z),Y=Mat.crossProduct(Y,G),Y[1]/=Y[0],Y[2]/=Y[0],Y[0]=1,Y=new Coords(Const.COORDS_BY_SCREEN,Y.slice(1),this.board).usrCoords,ne=W.distance(Const.COORDS_BY_USER,ie),W=W.usrCoords.slice(0),ie=ie.usrCoords.slice(0),ne<Mat.eps?se=0:(ne===Number.POSITIVE_INFINITY&&(ne=1/Mat.eps,Math.abs(ie[0])<Mat.eps?(ne/=Geometry.distance([0,0,0],ie),ie=[1,W[1]+ie[1]*ne,W[2]+ie[2]*ne]):(ne/=Geometry.distance([0,0,0],W),W=[1,ie[1]+W[1]*ne,ie[2]+W[2]*ne])),ae=1,ne=ie[ae]-W[ae],Math.abs(ne)<Mat.eps&&(ae=2,ne=ie[ae]-W[ae]),se=(Y[ae]-W[ae])/ne),!this.evalVisProp("straightfirst")&&se<0?!1:!(!this.evalVisProp("straightlast")&&se>1))},update:function(){var v;return this.needsUpdate?(this.constrained&&(JXG$1.isFunction(this.funps)?(v=this.funps(),v&&v.length&&v.length===2&&(this.point1=v[0],this.point2=v[1])):(JXG$1.isFunction(this.funp1)&&(v=this.funp1(),JXG$1.isPoint(v)?this.point1=v:v&&v.length&&v.length===2&&this.point1.setPositionDirectly(Const.COORDS_BY_USER,v)),JXG$1.isFunction(this.funp2)&&(v=this.funp2(),JXG$1.isPoint(v)?this.point2=v:v&&v.length&&v.length===2&&this.point2.setPositionDirectly(Const.COORDS_BY_USER,v)))),this.updateSegmentFixedLength(),this.updateStdform(),this.evalVisProp("trace")&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var v,N,G,z,q,Y,W,ie;return this.hasFixedLength?(v=this.point1.Dist(this.point2),N=this.evalVisProp("nonnegativeonly")?Math.max(0,this.fixedLength()):Math.abs(this.fixedLength()),G=this.fixedLengthOldCoords[0].distance(Const.COORDS_BY_USER,this.point1.coords),z=this.fixedLengthOldCoords[1].distance(Const.COORDS_BY_USER,this.point2.coords),(G>Mat.eps||z>Mat.eps||v!==N)&&(q=this.point1.isDraggable&&this.point1.type!==Const.OBJECT_TYPE_GLIDER&&!this.point1.evalVisProp("fixed"),Y=this.point2.isDraggable&&this.point2.type!==Const.OBJECT_TYPE_GLIDER&&!this.point2.evalVisProp("fixed"),v>Mat.eps?G>z&&Y||G<=z&&Y&&!q?(this.point2.setPositionDirectly(Const.COORDS_BY_USER,[this.point1.X()+(this.point2.X()-this.point1.X())*N/v,this.point1.Y()+(this.point2.Y()-this.point1.Y())*N/v]),this.point2.fullUpdate()):(G<=z&&q||G>z&&q&&!Y)&&(this.point1.setPositionDirectly(Const.COORDS_BY_USER,[this.point2.X()+(this.point1.X()-this.point2.X())*N/v,this.point2.Y()+(this.point1.Y()-this.point2.Y())*N/v]),this.point1.fullUpdate()):(W=Math.random()-.5,ie=Math.random()-.5,v=Mat.hypot(W,ie),Y?(this.point2.setPositionDirectly(Const.COORDS_BY_USER,[this.point1.X()+W*N/v,this.point1.Y()+ie*N/v]),this.point2.fullUpdate()):q&&(this.point1.setPositionDirectly(Const.COORDS_BY_USER,[this.point2.X()+W*N/v,this.point2.Y()+ie*N/v]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(Const.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(Const.COORDS_BY_USER,this.point2.coords.usrCoords)),this):this},updateStdform:function(){var v=Mat.crossProduct(this.point1.coords.usrCoords,this.point2.coords.usrCoords);this.stdform[0]=v[0],this.stdform[1]=v[1],this.stdform[2]=v[2],this.stdform[3]=0,this.normalize()},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.point1.coords.usrCoords[1]+this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[1]+this.point2.coords.usrCoords[2])&&Mat.innerProduct(this.stdform,this.stdform,3)>=Mat.eps*Mat.eps,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateLine(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(
147),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},generatePolynomial:function(v){var N=this.point1.symbolic.x,G=this.point1.symbolic.y,z=this.point2.symbolic.x,q=this.point2.symbolic.y,Y=v.symbolic.x,W=v.symbolic.y;return[["(",G,")*(",Y,")-(",G,")*(",z,")+(",W,")*(",z,")-(",N,")*(",W,")+(",N,")*(",q,")-(",Y,")*(",q,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=Mat.eps?-this.stdform[0]/this.stdform[2]:1/0},Slope:function(){return Math.abs(this.stdform[2])>=Mat.eps?-this.stdform[1]/this.stdform[2]:1/0},getSlope:function(){return this.Slope()},getAngle:function(){return Math.atan2(-this.stdform[1],this.stdform[2])},Direction:function(){var v=this.point1.coords.usrCoords,N=this.point2.coords.usrCoords;return N[0]===0&&v[0]!==0?N.slice(1):v[0]===0&&N[0]!==0?[-v[1],-v[2]]:[N[1]-v[1],N[2]-v[2]]},isVertical:function(){var v=this.Direction();return v[0]===0&&v[1]!==0},isHorizontal:function(){var v=this.Direction();return v[1]===0&&v[0]!==0},setStraight:function(v,N){return this.visProp.straightfirst=v,this.visProp.straightlast=N,this.board.renderer.updateLine(this),this},getTextAnchor:function(){return new Coords(Const.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(v){JXG$1.exists(this.label)&&(this.label.relativeCoords=new Coords(Const.COORDS_BY_SCREEN,[v[0],-v[1]],this.board))},getLabelAnchor:function(){var v,N,G,z,q,Y,W,ie,ne=1.5,se=0,ae=new Coords(Const.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),ce=new Coords(Const.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),pe=this.evalVisProp("straightfirst"),ge=this.evalVisProp("straightlast");if((pe||ge)&&Geometry.calcStraight(this,ae,ce,0),ae=ae.scrCoords,ce=ce.scrCoords,!JXG$1.exists(this.label))return new Coords(Const.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(G=this.label.evalVisProp("position"),!JXG$1.isString(G))return new Coords(Const.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(G.indexOf("right")<0&&G.indexOf("left")<0)switch(G){case"last":v=ce[1],N=ce[2];break;case"first":v=ae[1],N=ae[2];break;case"lft":case"llft":case"ulft":ae[1]<ce[1]+Mat.eps?(v=ae[1],N=ae[2]):(v=ce[1],N=ce[2]);break;case"rt":case"lrt":case"urt":ae[1]>ce[1]+Mat.eps?(v=ae[1],N=ae[2]):(v=ce[1],N=ce[2]);break;default:v=.5*(ae[1]+ce[1]),N=.5*(ae[2]+ce[2])}else z=JXG$1.parsePosition(G),q=JXG$1.parseNumber(z.pos,1,1),Y=ce[1]-ae[1],W=ce[2]-ae[2],ie=Mat.hypot(Y,W),z.pos.indexOf("px")>=0||z.pos.indexOf("fr")>=0||z.pos.indexOf("%")>=0?(z.pos.indexOf("px")>=0&&(q/=ie),v=ae[1]+q*Y,N=ae[2]+q*W):(v=ae[1]+q*this.board.unitX*Y/ie,N=ae[2]+q*this.board.unitY*W/ie),z.side==="left"?Y*=-1:W*=-1,JXG$1.exists(this.label)&&(ne=.5*this.label.evalVisProp("distance")/ie),v+=W*this.label.size[0]*ne,N+=Y*this.label.size[1]*ne;return(pe||ge)&&(JXG$1.exists(this.label)&&(se=this.label.evalVisProp("fontsize")),Math.abs(v)<Mat.eps?v=se:this.board.canvasWidth+Mat.eps>v&&v>this.board.canvasWidth-se-Mat.eps&&(v=this.board.canvasWidth-se),Mat.eps+se>N&&N>-Mat.eps?N=se:this.board.canvasHeight+Mat.eps>N&&N>this.board.canvasHeight-se-Mat.eps&&(N=this.board.canvasHeight-se)),new Coords(Const.COORDS_BY_SCREEN,[v,N],this.board)},cloneToBackground:function(){var v=JXG$1.getCloneObject(this),N,G,z;return v.point1=this.point1,v.point2=this.point2,v.stdform=this.stdform,G=this.getSlope(),N=this.getRise(),v.getSlope=function(){return G},v.getRise=function(){return N},z=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawLine(v),this.board.renderer.enhancedRendering=z,this.traces[v.id]=v.rendNode,this},addTransform:function(v){var N,G=JXG$1.isArray(v)?v:[v],z=G.length;for(N=0;N<z;N++)this.point1.transformations.push(G[N]),this.point2.transformations.push(G[N]);return this},snapToGrid:function(v){var N,G,z,q,Y,W,ie,ne,se;return this.evalVisProp("snaptogrid")?this.parents.length<3?(this.point1.handleSnapToGrid(!0,!0),this.point2.handleSnapToGrid(!0,!0)):JXG$1.exists(v)&&(ne=this.evalVisProp("snapsizex"),se=this.evalVisProp("snapsizey"),N=new Coords(Const.COORDS_BY_SCREEN,[v.Xprev,v.Yprev],this.board),W=N.usrCoords[1],ie=N.usrCoords[2],ne<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(Y=this.board.defaultAxes.x.defaultTicks,ne=Y.ticksDelta*(Y.evalVisProp("minorticks")+1)),se<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(Y=this.board.defaultAxes.y.defaultTicks,se=Y.ticksDelta*(Y.evalVisProp("minorticks")+1)),ne>0&&se>0&&(G=Geometry.projectPointToLine({coords:N},this,this.board),z=Stat.subtract([1,Math.round(W/ne)*ne,Math.round(ie/se)*se],G.usrCoords),q=this.board.create("transform",z.slice(1),{type:"translate"}),q.applyOnce([this.point1,this.point2]))):(this.point1.handleSnapToGri
147d(!1,!0),this.point2.handleSnapToGrid(!1,!0)),this},snapToPoints:function(){var v=this.evalVisProp("snaptopoints");return this.parents.length<3&&(this.point1.handleSnapToPoints(v),this.point2.handleSnapToPoints(v)),this},X:function(v){var N,G=this.stdform[2];return N=Math.abs(this.point1.coords.usrCoords[0])>Mat.eps?this.point1.coords.usrCoords[1]:this.point2.coords.usrCoords[1],v=(v-.5)*2,(1-Math.abs(v))*N-v*G},Y:function(v){var N,G=this.stdform[1];return N=Math.abs(this.point1.coords.usrCoords[0])>Mat.eps?this.point1.coords.usrCoords[2]:this.point2.coords.usrCoords[2],v=(v-.5)*2,(1-Math.abs(v))*N+v*G},Z:function(v){var N=Math.abs(this.point1.coords.usrCoords[0])>Mat.eps?this.point1.coords.usrCoords[0]:this.point2.coords.usrCoords[0];return v=(v-.5)*2,(1-Math.abs(v))*N},L:function(){return this.point1.Dist(this.point2)},setFixedLength:function(v){return this.hasFixedLength?(this.fixedLength=JXG$1.createFunction(v,this.board),this.hasFixedLength=!0,this.addParentsFromJCFunctions([this.fixedLength]),this.board.update(),this):this},minX:function(){return 0},maxX:function(){return 1},bounds:function(){var v=this.point1.coords.usrCoords,N=this.point2.coords.usrCoords;return[Math.min(v[1],N[1]),Math.max(v[2],N[2]),Math.max(v[1],N[1]),Math.min(v[2],N[2])]},remove:function(){this.removeAllTicks(),GeometryElement.prototype.remove.call(this)}});JXG$1.createLine=function(v,N,G){var z,q,Y,W,ie,ne,se=[],ae=!1,ce=!1,pe;if(N.length===2){if(ne=JXG$1.copyAttributes(G,v.options,"line","point1"),JXG$1.isArray(N[0])&&N[0].length>1)Y=v.create("point",N[0],ne);else if(JXG$1.isString(N[0])||JXG$1.isPoint(N[0]))Y=v.select(N[0]);else if(JXG$1.isFunction(N[0])&&JXG$1.isPoint(N[0]()))Y=N[0](),ce=!0;else if(JXG$1.isFunction(N[0])&&N[0]().length&&N[0]().length>=2)Y=JXG$1.createPoint(v,N[0](),ne),ce=!0;else if(JXG$1.isObject(N[0])&&JXG$1.isTransformationOrArray(N[1]))ae=!0,Y=v.create("point",[N[0].point1,N[1]],ne);else throw new Error("JSXGraph: Can't create line with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
148Possible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]`);if(ne=JXG$1.copyAttributes(G,v.options,"line","point2"),ae)W=v.create("point",[N[0].point2,N[1]],ne);else if(JXG$1.isArray(N[1])&&N[1].length>1)W=v.create("point",N[1],ne);else if(JXG$1.isString(N[1])||JXG$1.isPoint(N[1]))W=v.select(N[1]);else if(JXG$1.isFunction(N[1])&&JXG$1.isPoint(N[1]()))W=N[1](),ce=!0;else if(JXG$1.isFunction(N[1])&&N[1]().length&&N[1]().length>=2)W=JXG$1.createPoint(v,N[1](),ne),ce=!0;else throw new Error("JSXGraph: Can't create line with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
149Possible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]`);ne=JXG$1.copyAttributes(G,v.options,"line"),q=new JXG$1.Line(v,Y,W,ne),ce?(q.constrained=!0,q.funp1=N[0],q.funp2=N[1]):ae||(q.isDraggable=!0),q.setParents([Y.id,W.id])}else if(N.length===3){for(pe=!0,ie=0;ie<3;ie++)if(JXG$1.isNumber(N[ie]))se[ie]=JXG$1.createFunction(N[ie]);else if(JXG$1.isFunction(N[ie]))se[ie]=N[ie],pe=!1;else throw new Error("JSXGraph: Can't create line with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+`'.
150Possible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]`);ne=JXG$1.copyAttributes(G,v.options,"line","point1"),pe?Y=v.create("point",[se[2]()*se[2]()+se[1]()*se[1](),se[2]()-se[1]()*se[0]()+se[2](),-se[1]()-se[2]()*se[0]()-se[1]()],ne):Y=v.create("point",[function(){return(se[2]()*se[2]()+se[1]()*se[1]())*.5},function(){return(se[2]()-se[1]()*se[0]()+se[2]())*.5},function(){return(-se[1]()-se[2]()*se[0]()-se[1]())*.5}],ne),ne=JXG$1.copyAttributes(G,v.options,"line","point2"),pe?W=v.create("point",[se[2]()*se[2]()+se[1]()*se[1](),-se[1]()*se[0]()+se[2](),-se[2]()*se[0]()-se[1]()],ne):W=v.create("point",[function(){return se[2]()*se[2]()+se[1]()*se[1]()},function(){return-se[1]()*se[0]()+se[2]()},function(){return-se[2]()*se[0]()-se[1]()}],ne),Y.prepareUpdate().update(),W.prepareUpdate().update(),ne=JXG$1.copyAttributes(G,v.options,"line"),q=new JXG$1.Line(v,Y,W,ne),q.isDraggable=pe,q.setParents([Y,W])}else if(N.length===1&&JXG$1.isFunction(N[0])&&N[0]().length===2&&JXG$1.isPoint(N[0]()[0])&&JXG$1.isPoint(N[0]()[1]))z=N[0](),ne=JXG$1.copyAttributes(G,v.options,"line"),q=new JXG$1.Line(v,z[0],z[1],ne),q.constrained=!0,q.funps=N[0],q.setParents(z);else if(N.length===1&&JXG$1.isFunction(N[0])&&N[0]().length===3&&JXG$1.isNumber(N[0]()[0])&&JXG$1.isNumber(N[0]()[1])&&JXG$1.isNumber(N[0]()[2]))z=N[0],ne=JXG$1.copyAttributes(G,v.options,"line","point1"),Y=v.create("point",[function(){var ge=z();
150return[(ge[2]*ge[2]+ge[1]*ge[1])*.5,(ge[2]-ge[1]*ge[0]+ge[2])*.5,(-ge[1]-ge[2]*ge[0]-ge[1])*.5]}],ne),ne=JXG$1.copyAttributes(G,v.options,"line","point2"),W=v.create("point",[function(){var ge=z();return[ge[2]*ge[2]+ge[1]*ge[1],-ge[1]*ge[0]+ge[2],-ge[2]*ge[0]-ge[1]]}],ne),ne=JXG$1.copyAttributes(G,v.options,"line"),q=new JXG$1.Line(v,Y,W,ne),q.constrained=!0,q.funps=N[0],q.setParents([Y,W]);else throw new Error("JSXGraph: Can't create line with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
151Possible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]`);return q};JXG$1.registerElement("line",JXG$1.createLine);JXG$1.createSegment=function(v,N,G){var z,q;if(G.straightFirst=!1,G.straightLast=!1,q=JXG$1.copyAttributes(G,v.options,"segment"),z=v.create("line",N.slice(0,2),q),N.length===3){try{z.hasFixedLength=!0,z.fixedLengthOldCoords=[],z.fixedLengthOldCoords[0]=new Coords(Const.COORDS_BY_USER,z.point1.coords.usrCoords.slice(1,3),v),z.fixedLengthOldCoords[1]=new Coords(Const.COORDS_BY_USER,z.point2.coords.usrCoords.slice(1,3),v),z.setFixedLength(N[2])}catch{throw new Error("JSXGraph: Can't create segment with third parent type '"+typeof N[2]+`'.
152Possible third parent types: number or function`)}z.getParents=function(){return this.parents.concat(this.fixedLength())}}return z.elType="segment",z};JXG$1.registerElement("segment",JXG$1.createSegment);JXG$1.createArrow=function(v,N,G){var z,q;return G.straightFirst=!1,G.straightLast=!1,q=JXG$1.copyAttributes(G,v.options,"arrow"),z=v.create("line",N,q),z.type=Const.OBJECT_TYPE_VECTOR,z.elType="arrow",z};JXG$1.registerElement("arrow",JXG$1.createArrow);JXG$1.createAxis=function(v,N,G){var z,q,Y,W;q=JXG$1.copyAttributes(G,v.options,"axis");try{z=v.create("line",N,q)}catch{throw new Error("JSXGraph: Can't create axis with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
153Possible parent types: [point,point], [[x1,y1],[x2,y2]]`)}z.type=Const.OBJECT_TYPE_AXIS,z.isDraggable=!1,z.point1.isDraggable=!1,z.point2.isDraggable=!1,z._point1UsrCoordsOrg=z.point1.coords.usrCoords.slice(),z._point2UsrCoordsOrg=z.point2.coords.usrCoords.slice();for(Y in z.ancestors)z.ancestors.hasOwnProperty(Y)&&(z.ancestors[Y].type=Const.OBJECT_TYPE_AXISPOINT);return JXG$1.exists(q.ticks.ticksdistance)?W=q.ticks.ticksdistance:JXG$1.isArray(q.ticks.ticks)?W=q.ticks.ticks:W=1,z.defaultTicks=v.create("ticks",[z,W],q.ticks),z.defaultTicks.dump=!1,z.elType="axis",z.subs={ticks:z.defaultTicks},z.inherits.push(z.defaultTicks),z.update=function(){var ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt;if(!this.needsUpdate)return this;if(ie=this.board.getBoundingBox(),ne=this.evalVisProp("position"),ae=this.Direction(),ce=this.isHorizontal(),pe=this.isVertical(),ge=this.evalVisProp("ticksautopos"),ve=this.evalVisProp("ticksautoposthreshold"),ce?ve=JXG$1.parseNumber(ve,Math.abs(ie[1]-ie[3]),1/this.board.unitX)*this.board.unitX:pe?ve=JXG$1.parseNumber(ve,Math.abs(ie[1]-ie[3]),1/this.board.unitY)*this.board.unitY:ve=JXG$1.parseNumber(ve,1,1),Ee=this.evalVisProp("anchor"),Pe=Ee.indexOf("left")>-1,Je=Ee.indexOf("right")>-1,Ce=this.evalVisProp("anchordist"),ce?Ce=JXG$1.parseNumber(Ce,Math.abs(ie[1]-ie[3]),1/this.board.unitX):pe?Ce=JXG$1.parseNumber(Ce,Math.abs(ie[0]-ie[2]),1/this.board.unitY):Ce=0,qe=this.board.getPointLoc(this._point1UsrCoordsOrg,Ce),Ve=this.point1.coords.usrCoords.slice(),Re=this.point2.coords.usrCoords.slice(),ne==="static"||!pe&&!ce||(ne==="fixed"?(ce&&(ae[0]>0&&Je||ae[0]<0&&Pe?(Ve[2]=ie[3]+Ce,Re[2]=ie[3]+Ce):ae[0]>0&&Pe||ae[0]<0&&Je?(Ve[2]=ie[1]-Ce,Re[2]=ie[1]-Ce):(Ve=this._point1UsrCoordsOrg.slice(),Re=this._point2UsrCoordsOrg.slice())),pe&&(ae[1]>0&&Pe||ae[1]<0&&Je?(Ve[1]=ie[0]+Ce,Re[1]=ie[0]+Ce):ae[1]>0&&Je||ae[1]<0&&Pe?(Ve[1]=ie[2]-Ce,Re[1]=ie[2]-Ce):(Ve=this._point1UsrCoordsOrg.slice(),Re=this._point2UsrCoordsOrg.slice()))):ne==="sticky"&&(ce&&(qe[1]<0&&(ae[0]>0&&Je||ae[0]<0&&Pe)?(Ve[2]=ie[3]+Ce,Re[2]=ie[3]+Ce):qe[1]>0&&(ae[0]>0&&Pe||ae[0]<0&&Je)?(Ve[2]=ie[1]-Ce,Re[2]=ie[1]-Ce):(Ve=this._point1UsrCoordsOrg.slice(),Re=this._point2UsrCoordsOrg.slice())),pe&&(qe[0]<0&&(ae[1]>0&&Pe||ae[1]<0&&Je)?(Ve[1]=ie[0]+Ce,Re[1]=ie[0]+Ce):qe[0]>0&&(ae[1]>0&&Je||ae[1]<0&&Pe)?(Ve[1]=ie[2]-Ce,Re[1]=ie[2]-Ce):(Ve=this._point1UsrCoordsOrg.slice(),Re=this._point2UsrCoordsOrg.slice())))),this.point1.setPositionDirectly(JXG$1.COORDS_BY_USER,Ve),this.point2.setPositionDirectly(JXG$1.COORDS_BY_USER,Re),JXG$1.exists(this.defaultTicks)){if(et=this.defaultTicks.visProp.label,ge&&(ce||pe)){if(JXG$1.exists(et._anchorx_org)||(et._anchorx_org=JXG$1.def(et.anchorx,this.board.options.text.anchorX)),JXG$1.exists(et._anchory_org)||(et._anchory_org=JXG$1.def(et.anchory,this.board.options.text.anchorY)),JXG$1.exists(et._offset_org)||(et._offset_org=et.offset.slice()),tt=et.offset,ce){for(be=z.point1.coords.scrCoords[2]-this.board.canvasHeight*.5,Ze=et.anchory,be<0&&Math.abs(be)>ve?et._side==="bottom"&&(et.anchory==="top"&&(Ze="bottom"),tt[1]*=-1,et._side="top"):be>0&&Math.abs(be)>ve?et._side==="top"&&(et.anchory==="bottom"&&(Ze="top"),tt[1]*=-1,et._side="bottom"):(Ze=et._anchory_org,tt=et._offset_org.slice(),Ze==="top"?et._side="bottom":Ze==="bottom"?et._side="top":tt[1]<0?et._side="bottom":et._side="top"),se=0;se<z.defaultTicks.labels.length;se++)this.defaultTicks.labels[se].visProp.anchory=Ze;et.anchory=Ze}else if(pe){for(be=z.point1.coords.scrCoords[1]-this.board.canvasWidth*.5,be<0&&Math.abs(be)>ve?et._side==="right"&&(et.anchorx==="left"&&(Ze="right"),tt[0]*=-1,et._side="left"):be>0&&Math.abs(be)>ve?et._side==="left"&&(et.anchorx==="right"&&(Ze="left"),tt[0]*=-1,et._side="right"):(Ze=et._anchorx_org,tt=et._offset_org.slice(),Ze==="left"?et._side="right":Ze==="right"||tt[0]<0?et._side="left":et._side="right"),se=0;se<z.defaultTicks.labels.length;se++)this.defaultTicks.labels[se].visProp.anchorx=Ze;et.anchorx=Ze}et.offset=tt}else delete et._anchorx_org,delete et._anchory_org,delete et._offset_org;this.defaultTicks.needsUpdate=!0}return JXG$1.Line.prototype.update.call(this),this},z};JXG$1.registerElement("axis",JXG$1.createAxis);JXG$1.createTangent=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe=[];if(N.length===1)z=N[0],q=z.slideObject;else if(N.length===2)if(JXG$1.isPoint(N[0]))z=N[0],q=N[1];else if(JXG$1.isPoint(N[1]))q=N[0],z=N[1];else throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
154Possible parent types: [glider|point], [point,line|curve|circle|conic]`);else throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
155Possible parent types: [glider|point], [point,line|curve|circle|conic]`);
155if(ne=JXG$1.copyAttributes(G,v.options,"tangent"),q.elementClass===Const.OBJECT_CLASS_LINE)ie=v.create("line",[q.point1,q.point2],ne),ie.glider=z;else if(q.elementClass===Const.OBJECT_CLASS_CURVE&&q.type!==Const.OBJECT_TYPE_CONIC){if(ae=q.getTransformationSource(),ce=ae[0],ce)for(pe.push(q);ae[0]&&JXG$1.exists(ae[1]._transformationSource);)pe.push(ae[1]),ae=ae[1].getTransformationSource();q.evalVisProp("curvetype")!=="plot"||ce?(ie=v.create("line",[function(){var ge=q.X,ve=q.Y,be,Ee,Pe,Je,Ce,Ve,Re,qe;if(z.type===Const.OBJECT_TYPE_GLIDER?qe=z.position:q.evalVisProp("curvetype")==="functiongraph"?qe=z.X():qe=Geometry.projectPointToCurve(z,q,v)[1],Re=z.Coords(!0),ce){for(Ce=pe[pe.length-1]._transformationSource,ge=Ce.X,ve=Ce.Y,Je=0;Je<pe.length;Je++)pe[Je].updateTransformMatrix(),Ve=Mat.inverse(pe[Je].transformMat),Re=Mat.matVecMult(Ve,Re);z.type!==Const.OBJECT_TYPE_GLIDER&&(Re[1]/=Re[0],Re[2]/=Re[0],Re[0]/=Re[0],qe=Geometry.projectCoordsToCurve(Re[1],Re[2],0,Ce,v)[1])}if(be=Numerics.D(ve)(qe),Ee=Numerics.D(ge)(qe),Pe=[-Re[1]*be+Re[2]*Ee,Re[0]*be,-Re[0]*Ee],ce)for(Je=pe.length-1;Je>=0;Je--)Ve=Mat.transpose(Mat.inverse(pe[Je].transformMat)),Pe=Mat.matVecMult(Ve,Pe);return Pe}],ne),z.addChild(ie),ie.glider=z):(se=function(ge,ve,be){var Ee=Math.floor(ge),Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it;if(ve.bezierDegree===1)Ee===ve.numberPoints-1&&Ee--;else if(ve.bezierDegree===3)ve.elType==="sector"?(rt=ve.points.slice(3,ve.numberPoints-3),it=rt.length):(rt=ve.points,it=rt.length),Ee=Math.floor(ge*(it-1)/3)*3,Ce=(ge*(it-1)-Ee)/3,Ee>=it-1&&(Ee=it-4,Ce=1);else return 0;if(Ee<0)return 1;switch(ve.bezierDegree===1?(Pe=ve.points[Ee].usrCoords,Je=ve.points[Ee+1].usrCoords):(Ve=rt[Ee].usrCoords,Re=rt[Ee+1].usrCoords,qe=rt[Ee+2].usrCoords,et=rt[Ee+3].usrCoords,Ze=(1-Ce)*(1-Ce)*(Re[1]-Ve[1])+2*(1-Ce)*Ce*(qe[1]-Re[1])+Ce*Ce*(et[1]-qe[1]),tt=(1-Ce)*(1-Ce)*(Re[2]-Ve[2])+2*(1-Ce)*Ce*(qe[2]-Re[2])+Ce*Ce*(et[2]-qe[2]),Ke=Mat.hypot(Ze,tt),Ze/=Ke,tt/=Ke,Pe=z.coords.usrCoords,Je=[1,Pe[1]+Ze,Pe[2]+tt]),be){case 0:return Pe[2]*Je[1]-Pe[1]*Je[2];case 1:return Je[2]-Pe[2];case 2:return Pe[1]-Je[1];default:return[Pe[2]*Je[1]-Pe[1]*Je[2],Je[2]-Pe[2],Pe[1]-Je[1]]}},ie=v.create("line",[function(){var ge;return z.type===Const.OBJECT_TYPE_GLIDER?ge=z.position:ge=Geometry.projectPointToCurve(z,q,v)[1],se(ge,q)}],ne),z.addChild(ie),ie.glider=z)}else q.type===Const.OBJECT_TYPE_TURTLE?(ie=v.create("line",[function(){var ge,ve;for(z.type===Const.OBJECT_TYPE_GLIDER?ve=z.position:ve=Geometry.projectPointToTurtle(z,q,v)[1],ge=Math.floor(ve),Y=0;Y<q.objects.length;Y++)if(W=q.objects[Y],W.type===Const.OBJECT_TYPE_CURVE){if(ge<W.numberPoints)break;ge-=W.numberPoints}return ge===W.numberPoints-1&&ge--,ge<0?[1,0,0]:[W.Y(ge)*W.X(ge+1)-W.X(ge)*W.Y(ge+1),W.Y(ge+1)-W.Y(ge),W.X(ge)-W.X(ge+1)]}],ne),z.addChild(ie),ie.glider=z):(q.elementClass===Const.OBJECT_CLASS_CIRCLE||q.type===Const.OBJECT_TYPE_CONIC)&&(ie=v.create("line",[function(){return Mat.matVecMult(q.quadraticform,z.coords.usrCoords)}],ne),z.addChild(ie),ie.glider=z);if(!JXG$1.exists(ie))throw new Error("JSXGraph: Couldn't create tangent with the given parents.");return ie.elType="tangent",ie.type=Const.OBJECT_TYPE_TANGENT,ie.setParents(N),ie};JXG$1.createNormal=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge=[];for(W=0;W<N.length;++W)N[W]=v.select(N[W]);if(N.length===1)z=N[0],q=z.slideObject;else if(N.length===2)if(JXG$1.isPointType(v,N[0]))z=JXG$1.providePoints(v,[N[0]],G,"point")[0],q=N[1];else if(JXG$1.isPointType(v,N[1]))q=N[0],z=JXG$1.providePoints(v,[N[1]],G,"point")[0];else throw new Error("JSXGraph: Can't create normal with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
156Possible parent types: [point,line], [point,circle], [glider]`);else throw new Error("JSXGraph: Can't create normal with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
157Possible parent types: [point,line], [point,circle], [glider]`);if(ie=JXG$1.copyAttributes(G,v.options,"normal"),q.elementClass===Const.OBJECT_CLASS_LINE)se=JXG$1.copyAttributes(G,v.options,"normal","point"),ne=v.create("point",[function(){var ve=Mat.crossProduct([1,0,0],q.stdform);return[ve[0],-ve[2],ve[1]]}],se),ne.isDraggable=!0,Y=v.create("line",[z,ne],ie),Y.point=ne,Y.subs={point:ne},Y.inherits.push(ne);else if(q.elementClass===Const.OBJECT_CLASS_CIRCLE)Y=v.create("line",[q.midpoint,z],ie);
157else if(q.elementClass===Const.OBJECT_CLASS_CURVE){if(ce=q.getTransformationSource(),pe=ce[0],pe)for(ge.push(q);ce[0]&&JXG$1.exists(ce[1]._transformationSource);)ge.push(ce[1]),ce=ce[1].getTransformationSource();q.evalVisProp("curvetype")!=="plot"||pe?Y=v.create("line",[function(){var ve=q.X,be=q.Y,Ee,Pe,Je,Ce,Ve,Re,qe,et;if(z.type===Const.OBJECT_TYPE_GLIDER?et=z.position:q.evalVisProp("curvetype")==="functiongraph"?et=z.X():et=Geometry.projectPointToCurve(z,q,v)[1],qe=z.Coords(!0),pe){for(Ve=ge[ge.length-1]._transformationSource,ve=Ve.X,be=Ve.Y,Ce=0;Ce<ge.length;Ce++)ge[Ce].updateTransformMatrix(),Re=Mat.inverse(ge[Ce].transformMat),qe=Mat.matVecMult(Re,qe);z.type!==Const.OBJECT_TYPE_GLIDER&&(qe[1]/=qe[0],qe[2]/=qe[0],qe[0]/=qe[0],et=Geometry.projectCoordsToCurve(qe[1],qe[2],0,Ve,v)[1])}if(Ee=Numerics.D(be)(et),Pe=Numerics.D(ve)(et),Je=[-qe[1]*Pe-qe[2]*Ee,qe[0]*Pe,qe[0]*Ee],pe)for(Ce=ge.length-1;Ce>=0;Ce--)Re=Mat.transpose(Mat.inverse(ge[Ce].transformMat)),Je=Mat.matVecMult(Re,Je);return Je}],ie):(ae=function(ve,be,Ee){var Pe=Math.floor(ve),Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut,ct,at,st;if(be.bezierDegree===1)Pe===be.numberPoints-1&&Pe--,Re=ve;else if(be.bezierDegree===3)be.elType==="sector"?(at=be.points.slice(3,be.numberPoints-3),st=at.length):(at=be.points,st=at.length),Pe=Math.floor(ve*(st-1)/3)*3,Re=(ve*(st-1)-Pe)/3,Pe>=st-1&&(Pe=st-4,Re=1);else return 0;if(Pe<0)return 1;switch(Je=Re-Pe,be.bezierDegree===1?(Ce=be.points[Pe].usrCoords,Ve=be.points[Pe+1].usrCoords,ut=[Ce[0]+Je*(Ve[0]-Ce[0]),Ce[1]+Je*(Ve[1]-Ce[1]),Ce[2]+Je*(Ve[2]-Ce[2])],ot=Mat.crossProduct(Ce,Ve),ct=Mat.crossProduct([1,0,0],ot),ct=[ct[0],-ct[2],ct[1]],ot=Mat.crossProduct(ut,ct)):(qe=at[Pe].usrCoords,et=at[Pe+1].usrCoords,Ze=at[Pe+2].usrCoords,tt=at[Pe+3].usrCoords,Ke=(1-Re)*(1-Re)*(et[1]-qe[1])+2*(1-Re)*Re*(Ze[1]-et[1])+Re*Re*(tt[1]-Ze[1]),rt=(1-Re)*(1-Re)*(et[2]-qe[2])+2*(1-Re)*Re*(Ze[2]-et[2])+Re*Re*(tt[2]-Ze[2]),it=Mat.hypot(Ke,rt),Ke/=it,rt/=it,Ce=z.coords.usrCoords,Ve=[1,Ce[1]-rt,Ce[2]+Ke],ot=[Ce[2]*Ve[1]-Ce[1]*Ve[2],Ve[2]-Ce[2],Ce[1]-Ve[1]]),Ee){case 0:return ot[0];case 1:return ot[1];case 2:return ot[2];default:return ot}},Y=v.create("line",[function(){var ve;return z.type===Const.OBJECT_TYPE_GLIDER?ve=z.position:ve=Geometry.projectPointToCurve(z,q,v)[1],ae(ve,q)}],ie),z.addChild(Y),Y.glider=z)}else if(q.type===Const.OBJECT_TYPE_TURTLE)Y=v.create("line",[function(){var ve,be,Ee=Math.floor(z.position),Pe=z.position-Ee;for(be=0;be<q.objects.length;be++)if(ve=q.objects[be],ve.type===Const.OBJECT_TYPE_CURVE){if(Ee<ve.numberPoints)break;Ee-=ve.numberPoints}return Ee===ve.numberPoints-1&&(Ee-=1,Pe=1),Ee<0?1:(ve.Y(Ee)+Pe*(ve.Y(Ee+1)-ve.Y(Ee)))*(ve.Y(Ee)-ve.Y(Ee+1))-(ve.X(Ee)+Pe*(ve.X(Ee+1)-ve.X(Ee)))*(ve.X(Ee+1)-ve.X(Ee))},function(){var ve,be,Ee=Math.floor(z.position);for(be=0;be<q.objects.length;be++)if(ve=q.objects[be],ve.type===Const.OBJECT_TYPE_CURVE){if(Ee<ve.numberPoints)break;Ee-=ve.numberPoints}return Ee===ve.numberPoints-1&&(Ee-=1),Ee<0?0:ve.X(Ee+1)-ve.X(Ee)},function(){var ve,be,Ee=Math.floor(z.position);for(be=0;be<q.objects.length;be++)if(ve=q.objects[be],ve.type===Const.OBJECT_TYPE_CURVE){if(Ee<ve.numberPoints)break;Ee-=ve.numberPoints}return Ee===ve.numberPoints-1&&(Ee-=1),Ee<0?0:ve.Y(Ee+1)-ve.Y(Ee)}],ie);else throw new Error("JSXGraph: Can't create normal with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
158Possible parent types: [point,line], [point,circle], [glider]`);return Y.elType="normal",Y.setParents(N),JXG$1.exists(z._is_new)?(Y.addChild(z),delete z._is_new):z.addChild(Y),q.addChild(Y),Y};JXG$1.createRadicalAxis=function(v,N,G){var z,q,Y;if(N.length!==2||N[0].elementClass!==Const.OBJECT_CLASS_CIRCLE||N[1].elementClass!==Const.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create 'radical axis' with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
159Possible parent type: [circle,circle]`);return q=v.select(N[0]),Y=v.select(N[1]),z=v.create("line",[function(){var W=q.stdform,ie=Y.stdform;return Mat.matVecMult(Mat.transpose([W.slice(0,3),ie.slice(0,3)]),[ie[3],-W[3]])}],G),z.elType="radicalaxis",z.setParents([q.id,Y.id]),q.addChild(z),Y.addChild(z),z};JXG$1.createPolarLine=function(v,N,G){var z,q,Y,W,ie,ne,se;if(N.length>1&&(W=N[0].type===Const.OBJECT_TYPE_CONIC||N[0].elementClass===Const.OBJECT_CLASS_CIRCLE,ie=N[1].type===Const.OBJECT_TYPE_CONIC||N[1].elementClass===Const.OBJECT_CLASS_CIRCLE,ne=JXG$1.isPoint(N[0]),se=JXG$1.isPoint(N[1])),N.length!==2||!(W&&se||ne&&ie))throw new Error("JSXGraph: Can't create 'polar line' with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
160Possible parent type: [conic|circle,point], [point,conic|circle]`);return se?(q=v.select(N[0]),Y=v.select(N[1])):(q=v.select(N[1]),Y=v.select(N[0])),z=v.create("tangent",[q,Y],G),z.elType="polarline",z};JXG$1.createTangentTo=function(v,N,G){var z,q,Y,W,ie,ne,se;if(Y=v.select(N[0]),W=JXG$1.providePoints(v,N[1],G,"point")[0],ie=JXG$1.def(N[2],0),Y.type!==Const.OBJECT_TYPE_CIRCLE&&Y.type!==Const.OBJECT_TYPE_CONIC||W.elementClass!==Const.OBJECT_CLASS_POINT)throw new Error("JSXGraph: Can't create tangentto with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+`'.
161Possible parent types: [circle|conic,point,number]`);return q=JXG$1.copyAttributes(G,v.options,"tangentto"),se=v.create("polar",[Y,W],q.polar),ne=v.create("intersection",[se,Y,ie],q.point),z=v.create("tangent",[Y,ne],q),z.point=ne,z.polar=se,z.elType="tangentto",z};JXG$1.registerElement("tangent",JXG$1.createTangent);JXG$1.registerElement("normal",JXG$1.createNormal);JXG$1.registerElement("tangentto",JXG$1.createTangentTo);JXG$1.registerElement("polar",JXG$1.createTangent);JXG$1.registerElement("radicalaxis",JXG$1.createRadicalAxis);JXG$1.registerElement("polarline",JXG$1.createPolarLine);JXG$1.Line;JXG$1.Group=function(v,N,G,z,q){var Y,W,ie,ne;for(this.board=v,this.objects={},Y=this.board.numObjects,this.board.numObjects+=1,N===""||!JXG$1.exists(N)?this.id=this.board.id+"Group"+Y:this.id=N,this.board.groups[this.id]=this,this.type=Const.OBJECT_TYPE_POINT,this.elementClass=Const.OBJECT_CLASS_POINT,G===""||!JXG$1.exists(G)?this.name="group_"+this.board.generateName(this):this.name=G,delete this.type,this.coords={},this.needsRegularUpdate=q.needsregularupdate,this.rotationCenter="centroid",this.scaleCenter=null,this.rotationPoints=[],this.translationPoints=[],this.scalePoints=[],this.scaleDirections={},this.parents=[],JXG$1.isArray(z)?W=z:W=Array.prototype.slice.call(arguments,3),ie=0;ie<W.length;ie++)ne=this.board.select(W[ie]),!ne.evalVisProp("fixed")&&JXG$1.exists(ne.coords)&&this.addPoint(ne);this.methodMap={ungroup:"ungroup",add:"addPoint",addPoint:"addPoint",addPoints:"addPoints",addGroup:"addGroup",remove:"removePoint",removePoint:"removePoint",setAttribute:"setAttribute",setProperty:"setAttribute"}};JXG$1.extend(JXG$1.Group.prototype,{ungroup:function(){var v,N,G;for(v in this.objects)this.objects.hasOwnProperty(v)&&(N=this.objects[v].point,JXG$1.isArray(N.groups)&&(G=JXG$1.indexOf(N.groups,this.id),G>=0&&delete N.groups[G]));return this.objects={},this},addParents:function(v){var N,G,z;for(JXG$1.isArray(v)?z=v:z=arguments,G=z.length,N=0;N<G;++N)JXG$1.isId(this.board,z[N])?this.parents.push(z[N]):JXG$1.exists(z[N].id)&&this.parents.push(z[N].id);this.parents=JXG$1.uniqueArray(this.parents)},setParents:function(v){return this.parents=[],this.addParents(v),this},getParents:function(){return JXG$1.isArray(this.parents)?this.parents:[]},_updateCoordsCache:function(v){var N;v!==""&&JXG$1.exists(this.objects[v])&&(N=this.objects[v].point,this.coords[N.id]={usrCoords:N.coords.usrCoords.slice(0)})},update:function(){var v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe=null;if(!this.needsUpdate)return this;if(N=this._update_find_drag_type(),N.action==="nothing")return this._updateCoordsCache(N.id),this;if(pe=this.objects[N.id].point,N.action==="translation"){if(se=[pe.coords.usrCoords[1]-this.coords[N.id].usrCoords[1],pe.coords.usrCoords[2]-this.coords[N.id].usrCoords[2]],pe.elementClass!==Const.OBJECT_CLASS_POINT){for(se.unshift(0),v=0;v<pe.transformations.length;v++)se=Mat.matVecMult(pe.transformations[v].matrix,se);se.shift()}ae=this.board.create("transform",se,{type:"translate"}),ae.update()}else if(N.action==="rotation"||N.action==="scaling"){if(N.action==="rotation"?z="rotationCenter":z="scaleCenter",JXG$1.exists(this[z].coords))ce
161=this[z].coords.usrCoords.slice(1);else if(this[z]==="centroid")ce=this._update_centroid_center();else if(JXG$1.isArray(this[z]))ce=this[z];else if(JXG$1.isFunction(this[z]))ce=this[z]();else return JXG$1.debug("Group.update: No valid center for this transformation, get out of here."),this;if(N.action==="rotation")ne=Geometry.rad(this.coords[N.id].usrCoords.slice(1),ce,this.objects[N.id].point),se=this.board.create("transform",[ne,ce[0],ce[1]],{type:"rotate"}),se.update();else if(N.action==="scaling"){if(Y=Geometry.distance(this.coords[N.id].usrCoords.slice(1),ce),Math.abs(Y)<Mat.eps)return this;Y=Geometry.distance(pe.coords.usrCoords.slice(1),ce)/Y,W=this.scaleDirections[N.id].indexOf("x")>=0?Y:1,ie=this.scaleDirections[N.id].indexOf("y")>=0?Y:1,se=this.board.create("transform",[1,0,0,ce[0]*(1-W),W,0,ce[1]*(1-ie),0,ie],{type:"generic"}),se.update()}else return this}for(G in this.objects)pe=this.objects[G].point,pe.elementClass!==Const.OBJECT_CLASS_POINT&&(JXG$1.exists(se.board)?se.meltTo(pe):N.id!==pe.id&&ae.meltTo(pe));this._update_apply_transformation(N,se),this.needsUpdate=!1;for(G in this.objects)if(this.objects.hasOwnProperty(G))for(q in this.objects[G].descendants)this.objects[G].descendants.hasOwnProperty(q)&&(this.objects[G].descendants.needsUpdate=this.objects[G].descendants.needsRegularUpdate||this.board.needsFullUpdate);this.board.updateElements(N);for(G in this.objects)this.objects.hasOwnProperty(G)&&this._updateCoordsCache(G);return this},_update_find_drag_type:function(){var v,N,G="nothing",z=[],q;for(v in this.objects)this.objects.hasOwnProperty(v)&&(N=this.objects[v].point,N.coords.distance(Const.COORDS_BY_USER,this.coords[v])>Mat.eps&&z.push(N.id));return z.length===0?{action:G,id:"",changed:z}:(q=z[0],N=this.objects[q].point,z.length>1?G="translation":JXG$1.isInArray(this.rotationPoints,N)&&JXG$1.exists(this.rotationCenter)?G="rotation":JXG$1.isInArray(this.scalePoints,N)&&JXG$1.exists(this.scaleCenter)?G="scaling":JXG$1.isInArray(this.translationPoints,N)&&(G="translation"),{action:G,id:q,changed:z})},_update_centroid_center:function(){var v,N,G;v=[0,0],N=0;for(G in this.coords)this.coords.hasOwnProperty(G)&&(v[0]+=this.coords[G].usrCoords[1],v[1]+=this.coords[G].usrCoords[2],++N);return N>0&&(v[0]/=N,v[1]/=N),v},_update_apply_transformation:function(v,N){var G,z;for(G in this.objects)this.objects.hasOwnProperty(G)&&(JXG$1.exists(this.board.objects[G])?(z=this.objects[G].point,z.id!==v.id?v.action==="translation"?JXG$1.isInArray(v.changed,z.id)||z.elementClass===Const.OBJECT_CLASS_POINT&&z.coords.setCoordinates(Const.COORDS_BY_USER,[this.coords[G].usrCoords[1]+N[0],this.coords[G].usrCoords[2]+N[1]]):(v.action==="rotation"||v.action==="scaling")&&z.elementClass===Const.OBJECT_CLASS_POINT&&N.applyOnce([z]):(v.action==="rotation"||v.action==="scaling")&&z.coords.setCoordinates(Const.COORDS_BY_USER,Mat.matVecMult(N.matrix,this.coords[z.id].usrCoords))):delete this.objects[G])},addPoint:function(v){return this.objects[v.id]={point:this.board.select(v)},this._updateCoordsCache(v.id),this.translationPoints.push(v),v.groups.push(this.id),v.groups=JXG$1.uniqueArray(v.groups),this},addPoints:function(v){var N;for(N=0;N<v.length;N++)this.addPoint(v[N]);return this},addGroup:function(v){var N;for(N in v.objects)v.objects.hasOwnProperty(N)&&this.addPoint(v.objects[N].point);return this},removePoint:function(v){return delete this.objects[v.id],this},setRotationCenter:function(v){return this.rotationCenter=v,this},setRotationPoints:function(v){return this._setActionPoints("rotation",v)},addRotationPoint:function(v){return this._addActionPoint("rotation",v)},removeRotationPoint:function(v){return this._removeActionPoint("rotation",v)},setTranslationPoints:function(v){return this._setActionPoints("translation",v)},addTranslationPoint:function(v){return this._addActionPoint("translation",v)},removeTranslationPoint:function(v){return this._removeActionPoint("translation",v)},setScaleCenter:function(v){return this.scaleCenter=v,this},setScalePoints:function(v,N){var G,z,q;for(JXG$1.isArray(v)?G=v:G=arguments,q=G.length,z=0;z<q;++z)this.scaleDirections[this.board.select(G[z]).id]=N||"xy";return this._setActionPoints("scale",v)},addScalePoint:function(v,N){return this._addActionPoint("scale",v),this.scaleDirections[this.board.select(v).id]=N||"xy",this},removeScalePoint:function(v){return this._removeActionPoint("scale",v)},_setActionPoints:function(v,N){var G,z,q;for(JXG$1.isArray(N)?G=N:G=arguments,q=G.length,this[v+"Points"]=[],z=0;z<q;++z)this._addActionPoint(v,G[z]);return this},_addActionPoint:function(v,N){return this[v+"Points"].push(this.board.select(N)),this},_removeActionPoint:function(v,N){var G=this[v+"Points"].indexOf(this.board.select(N));return G>-1&&this[v+"Points"].splice(G,1),this},setProperty:function(){JXG$1.deprecated("Group.setProperty","Group.setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(){var v;
161for(v in this.objects)this.objects.hasOwnProperty(v)&&this.objects[v].point.setAttribute.apply(this.objects[v].point,arguments);return this}});JXG$1.createGroup=function(v,N,G){var z=JXG$1.copyAttributes(G,v.options,"group"),q=new JXG$1.Group(v,z.id,z.name,N,z);return q.elType="group",q.setParents(N),q};JXG$1.registerElement("group",JXG$1.createGroup);JXG$1.Group;JXG$1.Circle=function(v,N,G,z,q){this.constructor(v,q,Const.OBJECT_TYPE_CIRCLE,Const.OBJECT_CLASS_CIRCLE),this.method=N,this.midpoint=this.board.select(G),this.center=this.board.select(G),this.point2=null,this.radius=0,this.line=null,this.circle=null,this.points=[],N==="twoPoints"?(this.point2=v.select(z),this.radius=this.Radius()):N==="pointRadius"?(this.gxtterm=z,this.updateRadius=JXG$1.createFunction(z,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])):N==="pointLine"?(this.line=v.select(z),this.radius=this.line.point1.coords.distance(Const.COORDS_BY_USER,this.line.point2.coords)):N==="pointCircle"&&(this.circle=v.select(z),this.radius=this.circle.Radius()),this.id=this.board.setId(this,"C"),this.board.renderer.drawEllipse(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="circle",this.createLabel(),JXG$1.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),N==="pointRadius"?this.notifyParents(z):N==="pointLine"?this.line.addChild(this):N==="pointCircle"?this.circle.addChild(this):N==="twoPoints"&&(JXG$1.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this)),this.methodMap=JXG$1.deepCopy(this.methodMap,{setRadius:"setRadius",getRadius:"getRadius",Area:"Area",area:"Area",Perimeter:"Perimeter",Circumference:"Perimeter",radius:"Radius",Radius:"Radius",Diameter:"Diameter",center:"center",line:"line",point2:"point2"})};JXG$1.Circle.prototype=new GeometryElement;JXG$1.extend(JXG$1.Circle.prototype,{hasPoint:function(v,N){var G,z,q=this.center.coords.usrCoords,Y=new Coords(Const.COORDS_BY_SCREEN,[v,N],this.board),W=this.Radius(),ie,ne,se;return JXG$1.isObject(this.evalVisProp("precision"))?(z=this.board._inputDevice,G=this.evalVisProp("precision."+z)):G=this.board.options.precision.hasPoint,ie=q[1]-Y.usrCoords[1],ne=q[2]-Y.usrCoords[2],se=Mat.hypot(ie,ne),G+=this.evalVisProp("strokewidth")*.5,G/=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY)),this.evalVisProp("hasinnerpoints")?se<W+G:Math.abs(se-W)<G},generatePolynomial:function(v){var N=this.center.symbolic.x,G=this.center.symbolic.y,z=v.symbolic.x,q=v.symbolic.y,Y=this.generateRadiusSquared();return Y===""?[]:["(("+z+")-("+N+"))^2 + (("+q+")-("+G+"))^2 - ("+Y+")"]},generateRadiusSquared:function(){var v,N,G,z,q,Y,W="";return this.method==="twoPoints"?(v=this.center.symbolic.x,N=this.center.symbolic.y,G=this.point2.symbolic.x,z=this.point2.symbolic.y,W="(("+G+")-("+v+"))^2 + (("+z+")-("+N+"))^2"):this.method==="pointRadius"?JXG$1.isNumber(this.radius)&&(W=(this.radius*this.radius).toString()):this.method==="pointLine"?(G=this.line.point1.symbolic.x,z=this.line.point1.symbolic.y,q=this.line.point2.symbolic.x,Y=this.line.point2.symbolic.y,W="(("+G+")-("+q+"))^2 + (("+z+")-("+Y+"))^2"):this.method==="pointCircle"&&(W=this.circle.Radius()),W},update:function(){var v,N,G,z,q,Y;if(this.needsUpdate)for(this.evalVisProp("trace")&&this.cloneToBackground(!0),this.method==="pointLine"?this.radius=this.line.point1.coords.distance(Const.COORDS_BY_USER,this.line.point2.coords):this.method==="pointCircle"?this.radius=this.circle.Radius():this.method==="pointRadius"&&(this.radius=this.updateRadius()),this.radius=Math.abs(this.radius),this.updateStdform(),this.updateQuadraticform(),G=this.center.coords.usrCoords[0],v=this.center.coords.usrCoords[1]/G,N=this.center.coords.usrCoords[2]/G,G/=G,z=this.Radius(),q=.551915024494,this.numberPoints=13,this.dataX=[v+z,v+z,v+z*q,v,v-z*q,v-z,v-z,v-z,v-z*q,v,v+z*q,v+z,v+z],this.dataY=[N,N+z*q,N+z,N+z,N+z,N+z*q,N,N-z*q,N-z,N-z,N-z,N-z*q,N],this.bezierDegree=3,Y=0;Y<this.numberPoints;Y++)this.points[Y]=new Coords(Const.COORDS_BY_USER,[this.dataX[Y],this.dataY[Y]],this.board);return this},updateQuadraticform:function(){var v=this.center,N=v.X(),G=v.Y(),z=this.Radius();this.quadraticform=[[N*N+G*G-z*z,-N,-G],[-N,1,0],[-G,0,1]]},updateStdform:function(){this.stdform[3]=.5,this.stdform[4]=this.Radius(),this.stdform[1]=-this.center.coords.usrCoords[1],this.stdform[2]=-this.center.coords.usrCoords[2],isFinite(this.stdform[4])||(this.stdform[0]=JXG$1.exists(this.point2)?-(this.stdform[1]*this.point2.coords.usrCoords[1]+this.stdform[2]*this.point2.coords.usrCoords[2]):0),this.normalize()},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.center.coords.usrCoords[1]+this.center.coords.usrCoords[2]+this.Radius())&&this.center.isReal,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateEllipse(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(
161),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},notifyParents:function(v){JXG$1.isString(v)&&GeonextParser.findDependencies(this,v,this.board)},setRadius:function(v){return this.updateRadius=JXG$1.createFunction(v,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(v){return JXG$1.exists(v)?(this.setRadius(v),this.Radius()):this.method==="twoPoints"?JXG$1.cmpArrays(this.point2.coords.usrCoords,[0,0,0])||JXG$1.cmpArrays(this.center.coords.usrCoords,[0,0,0])?NaN:this.center.Dist(this.point2):this.method==="pointLine"||this.method==="pointCircle"?this.radius:this.method==="pointRadius"?this.evalVisProp("nonnegativeonly")?Math.max(0,this.updateRadius()):Math.abs(this.updateRadius()):NaN},Diameter:function(){return 2*this.Radius()},getRadius:function(){return JXG$1.deprecated("Circle.getRadius()","Circle.Radius()"),this.Radius()},getTextAnchor:function(){return this.center.coords},getLabelAnchor:function(){var v,N,G,z,q,Y,W=1.5,ie=this.Radius(),ne=this.center.coords.usrCoords,se=.7071067811865;if(!JXG$1.exists(this.label))return new Coords(Const.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(G=this.label.evalVisProp("position"),!JXG$1.isString(G))return new Coords(Const.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(G.indexOf("right")<0&&G.indexOf("left")<0)switch(this.evalVisProp("label.position")){case"lft":v=ne[1]-ie,N=ne[2];break;case"llft":v=ne[1]-se*ie,N=ne[2]-se*ie;break;case"rt":v=ne[1]+ie,N=ne[2];break;case"lrt":v=ne[1]+se*ie,N=ne[2]-se*ie;break;case"urt":v=ne[1]+se*ie,N=ne[2]+se*ie;break;case"top":v=ne[1],N=ne[2]+ie;break;case"bot":v=ne[1],N=ne[2]-ie;break;default:v=ne[1]-se*ie,N=ne[2]+se*ie;break}else return ne=this.center.coords.scrCoords,z=JXG$1.parsePosition(G),q=JXG$1.parseNumber(z.pos,2*Math.PI,1),z.pos.indexOf("fr")<0&&z.pos.indexOf("%")<0&&(z.pos.indexOf("px")>=0?q=0:q*=Math.PI/180),Y=1,z.side==="left"&&(Y=-1),JXG$1.exists(this.label)&&(W=Y*.5*this.label.evalVisProp("distance")),v=ne[1]+(ie*this.board.unitX+this.label.size[0]*W)*Math.cos(q),N=ne[2]-(ie*this.board.unitY+this.label.size[1]*W)*Math.sin(q),new Coords(Const.COORDS_BY_SCREEN,[v,N],this.board);return new Coords(Const.COORDS_BY_USER,[v,N],this.board)},cloneToBackground:function(){var v,N=this.Radius(),G=JXG$1.getCloneObject(this);return G.center={coords:this.center.coords},G.Radius=function(){return N},G.getRadius=function(){return N},v=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawEllipse(G),this.board.renderer.enhancedRendering=v,this.traces[G.id]=G.rendNode,this},addTransform:function(v){var N,G=JXG$1.isArray(v)?v:[v],z=G.length;for(N=0;N<z;N++)this.center.transformations.push(G[N]),this.method==="twoPoints"&&this.point2.transformations.push(G[N]);return this},snapToGrid:function(){var v=this.evalVisProp("snaptogrid");return this.center.handleSnapToGrid(v,!0),this.method==="twoPoints"&&this.point2.handleSnapToGrid(v,!0),this},snapToPoints:function(){var v=this.evalVisProp("snaptopoints");return this.center.handleSnapToPoints(v),this.method==="twoPoints"&&this.point2.handleSnapToPoints(v),this},X:function(v){return this.Radius()*Math.cos(v*2*Math.PI)+this.center.coords.usrCoords[1]},Y:function(v){return this.Radius()*Math.sin(v*2*Math.PI)+this.center.coords.usrCoords[2]},Z:function(v){return 1},minX:function(){return 0},maxX:function(){return 1},Area:function(){var v=this.Radius();return v*v*Math.PI},Perimeter:function(){return 2*this.Radius()*Math.PI},bounds:function(){var v=this.center.coords.usrCoords,N=this.Radius();return[v[1]-N,v[2]+N,v[1]+N,v[2]-N]},getParents:function(){return this.parents.length===1?this.parents.concat(this.radius):this.parents}});JXG$1.createCircle=function(v,N,G){var z,q,Y,W,ie,ne=!0,se=["center","point2"];if(q=[],ie=v.select(N[0]),JXG$1.isObject(ie)&&ie.elementClass===Const.OBJECT_CLASS_CIRCLE&&JXG$1.isTransformationOrArray(N[1]))return W=JXG$1.copyAttributes(G,v.options,"circle"),z=JXG$1.createEllipse(v,[ie.center,ie.center,function(){return 2*ie.Radius()}],W),z.addTransform(N[1]),z;for(Y=0;Y<N.length;Y++)if(JXG$1.isPointType(v,N[Y])){if(N.length<3?q.push(JXG$1.providePoints(v,[N[Y]],G,"circle",[se[Y]])[0]):q.push(JXG$1.providePoints(v,[N[Y]],G,"point")[0]),q[q.length-1]===!1)throw new Error("JSXGraph: Can't create circle from this type. Please provide a point type.")}else q.push(N[Y]);
161if(W=JXG$1.copyAttributes(G,v.options,"circle"),q.length===2&&JXG$1.isPoint(q[0])&&JXG$1.isPoint(q[1]))z=new JXG$1.Circle(v,"twoPoints",q[0],q[1],W);else if((JXG$1.isNumber(q[0])||JXG$1.isFunction(q[0])||JXG$1.isString(q[0]))&&JXG$1.isPoint(q[1]))z=new JXG$1.Circle(v,"pointRadius",q[1],q[0],W);else if((JXG$1.isNumber(q[1])||JXG$1.isFunction(q[1])||JXG$1.isString(q[1]))&&JXG$1.isPoint(q[0]))z=new JXG$1.Circle(v,"pointRadius",q[0],q[1],W);else if(q[0].elementClass===Const.OBJECT_CLASS_CIRCLE&&JXG$1.isPoint(q[1]))z=new JXG$1.Circle(v,"pointCircle",q[1],q[0],W);else if(q[1].elementClass===Const.OBJECT_CLASS_CIRCLE&&JXG$1.isPoint(q[0]))z=new JXG$1.Circle(v,"pointCircle",q[0],q[1],W);else if(q[0].elementClass===Const.OBJECT_CLASS_LINE&&JXG$1.isPoint(q[1]))z=new JXG$1.Circle(v,"pointLine",q[1],q[0],W);else if(q[1].elementClass===Const.OBJECT_CLASS_LINE&&JXG$1.isPoint(q[0]))z=new JXG$1.Circle(v,"pointLine",q[0],q[1],W);else if(N.length===3&&JXG$1.isPoint(q[0])&&JXG$1.isPoint(q[1])&&JXG$1.isPoint(q[2]))if(JXG$1.elements.circumcircle)z=JXG$1.elements.circumcircle(v,q,W);else throw new Error("JSXGraph: Can't create circle with three points. Please include the circumcircle element (element/composition).");else throw new Error("JSXGraph: Can't create circle with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
162Possible parent types: [point,point], [point,number], [point,function], [point,circle], [point,point,point], [circle,transformation]`);for(z.isDraggable=ne,z.setParents(q),z.elType="circle",Y=0;Y<q.length;Y++)JXG$1.isPoint(q[Y])&&z.inherits.push(q[Y]);return z};JXG$1.registerElement("circle",JXG$1.createCircle);const Circle=JXG$1.Circle;JXG$1.createEllipse=function(v,N,G){var z,q,Y,W,ie,ne,se,ae=[],ce=JXG$1.copyAttributes(G,v.options,"conic","foci"),pe=JXG$1.copyAttributes(G,v.options,"conic","center"),ge=JXG$1.copyAttributes(G,v.options,"conic");for(ne=0;ne<2;ne++)if(N[ne].length>1)ae[ne]=v.create("point",N[ne],ce);else if(JXG$1.isPoint(N[ne]))ae[ne]=v.select(N[ne]);else if(JXG$1.isFunction(N[ne])&&JXG$1.isPoint(N[ne]()))ae[ne]=N[ne]();else if(JXG$1.isString(N[ne]))ae[ne]=v.select(N[ne]);else throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
163Possible parent types: [point,point,point], [point,point,number|function]`);if(JXG$1.isNumber(N[2]))ie=JXG$1.createFunction(N[2],v);else if(JXG$1.isFunction(N[2])&&JXG$1.isNumber(N[2]()))ie=N[2];else{if(JXG$1.isPoint(N[2]))W=v.select(N[2]);else if(N[2].length>1)W=v.create("point",N[2],ce);else if(JXG$1.isFunction(N[2])&&JXG$1.isPoint(N[2]()))W=N[2]();else if(JXG$1.isString(N[2]))W=v.select(N[2]);else throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+`'.
164Possible parent types: [point,point,point], [point,point,number|function]`);ie=function(){return W.Dist(ae[0])+W.Dist(ae[1])}}for(JXG$1.exists(N[4])||(N[4]=2*Math.PI),JXG$1.exists(N[3])||(N[3]=0),Y=v.create("point",[function(){return(ae[0].X()+ae[1].X())*.5},function(){return(ae[0].Y()+ae[1].Y())*.5}],pe),q=v.create("curve",[function(ve){return 0},function(ve){return 0},N[3],N[4]],ge),q.majorAxis=ie,se=q.hasPoint,z=function(ve,be){var Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze;be||(Ee=ie(),Pe=Ee*Ee,Je=ae[0].X(),Ce=ae[0].Y(),Ve=ae[1].X(),Re=ae[1].Y(),qe=Je-Ve,et=Ce-Re,Ze=(Pe-Je*Je-Ce*Ce+Ve*Ve+Re*Re)/(2*Ee),q.quadraticform=[[Ze*Ze-Ve*Ve-Re*Re,Ze*qe/Ee+Ve,Ze*et/Ee+Re],[Ze*qe/Ee+Ve,qe*qe/Pe-1,qe*et/Pe],[Ze*et/Ee+Re,qe*et/Pe,et*et/Pe-1]])},q.X=function(ve,be){var Ee=ie(),Pe=ae[1].Dist(ae[0]),Je=.5*(Pe*Pe-Ee*Ee)/(Pe*Math.cos(ve)-Ee),Ce=Math.atan2(ae[1].Y()-ae[0].Y(),ae[1].X()-ae[0].X());return be||z(ve,be),ae[0].X()+Math.cos(Ce+ve)*Je},q.Y=function(ve,be){var Ee=ie(),Pe=ae[1].Dist(ae[0]),Je=.5*(Pe*Pe-Ee*Ee)/(Pe*Math.cos(ve)-Ee),Ce=Math.atan2(ae[1].Y()-ae[0].Y(),ae[1].X()-ae[0].X());return ae[0].Y()+Math.sin(Ce+ve)*Je},q.midpoint=q.center=Y,q.type=Const.OBJECT_TYPE_CONIC,q.subs={center:q.center},q.inherits.push(q.center,ae[0],ae[1]),JXG$1.isPoint(W)&&q.inherits.push(W),q.hasPoint=function(ve,be){var Ee,Pe,Je,Ce,Ve;return this.evalVisProp("hasinnerpoints")?(Ee=ae[0].coords,Pe=ae[1].coords,Je=this.majorAxis(),Ce=new Coords(Const.COORDS_BY_SCREEN,[ve,be],this.board),Ve=Ce.distance(Const.COORDS_BY_USER,Ee)+Ce.distance(Const.COORDS_BY_USER,Pe),Ve<=Je):se.apply(this,arguments)},Y.addChild(q),ne=0;ne<2;ne++)JXG$1.isPoint(ae[ne])&&ae[ne].addChild(q);return JXG$1.isPoint(W)&&W.addChild(q),q.setParents(N),q};
164JXG$1.createHyperbola=function(v,N,G){var z,q,Y,W,ie,ne,se=[],ae=JXG$1.copyAttributes(G,v.options,"conic","foci"),ce=JXG$1.copyAttributes(G,v.options,"conic","center"),pe=JXG$1.copyAttributes(G,v.options,"conic");for(ne=0;ne<2;ne++)if(N[ne].length>1)se[ne]=v.create("point",N[ne],ae);else if(JXG$1.isPoint(N[ne]))se[ne]=v.select(N[ne]);else if(JXG$1.isFunction(N[ne])&&JXG$1.isPoint(N[ne]()))se[ne]=N[ne]();else if(JXG$1.isString(N[ne]))se[ne]=v.select(N[ne]);else throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
165Possible parent types: [point,point,point], [point,point,number|function]`);if(JXG$1.isNumber(N[2]))ie=JXG$1.createFunction(N[2],v);else if(JXG$1.isFunction(N[2])&&JXG$1.isNumber(N[2]()))ie=N[2];else{if(JXG$1.isPoint(N[2]))W=v.select(N[2]);else if(N[2].length>1)W=v.create("point",N[2],ae);else if(JXG$1.isFunction(N[2])&&JXG$1.isPoint(N[2]()))W=N[2]();else if(JXG$1.isString(N[2]))W=v.select(N[2]);else throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+`'.
166Possible parent types: [point,point,point], [point,point,number|function]`);ie=function(){return W.Dist(se[0])-W.Dist(se[1])}}for(JXG$1.exists(N[4])||(N[4]=1.0001*Math.PI),JXG$1.exists(N[3])||(N[3]=-1.0001*Math.PI),Y=v.create("point",[function(){return(se[0].X()+se[1].X())*.5},function(){return(se[0].Y()+se[1].Y())*.5}],ce),q=v.create("curve",[function(ge){return 0},function(ge){return 0},N[3],N[4]],pe),q.majorAxis=ie,z=function(ge,ve){var be,Ee,Pe,Je,Ce,Ve,Re,qe,et;ve||(be=ie(),Ee=be*be,Pe=se[0].X(),Je=se[0].Y(),Ce=se[1].X(),Ve=se[1].Y(),Re=Pe-Ce,qe=Je-Ve,et=(Ee-Pe*Pe-Je*Je+Ce*Ce+Ve*Ve)/(2*be),q.quadraticform=[[et*et-Ce*Ce-Ve*Ve,et*Re/be+Ce,et*qe/be+Ve],[et*Re/be+Ce,Re*Re/Ee-1,Re*qe/Ee],[et*qe/be+Ve,Re*qe/Ee,qe*qe/Ee-1]])},q.X=function(ge,ve){var be=ie(),Ee=se[1].Dist(se[0]),Pe=.5*(Ee*Ee-be*be)/(Ee*Math.cos(ge)+be),Je=Math.atan2(se[1].Y()-se[0].Y(),se[1].X()-se[0].X());return ve||z(ge,ve),se[0].X()+Math.cos(Je+ge)*Pe},q.Y=function(ge,ve){var be=ie(),Ee=se[1].Dist(se[0]),Pe=.5*(Ee*Ee-be*be)/(Ee*Math.cos(ge)+be),Je=Math.atan2(se[1].Y()-se[0].Y(),se[1].X()-se[0].X());return se[0].Y()+Math.sin(Je+ge)*Pe},q.midpoint=q.center=Y,q.subs={center:q.center},q.inherits.push(q.center,se[0],se[1]),JXG$1.isPoint(W)&&q.inherits.push(W),q.type=Const.OBJECT_TYPE_CONIC,Y.addChild(q),ne=0;ne<2;ne++)JXG$1.isPoint(se[ne])&&se[ne].addChild(q);return JXG$1.isPoint(W)&&W.addChild(q),q.setParents(N),q};JXG$1.createParabola=function(v,N,G){var z,q,Y,W=N[0],ie=N[1],ne=JXG$1.copyAttributes(G,v.options,"conic","foci"),se=JXG$1.copyAttributes(G,v.options,"conic","center"),ae=JXG$1.copyAttributes(G,v.options,"conic"),ce;if(N[0].length>1)W=v.create("point",N[0],ne);else if(JXG$1.isPoint(N[0]))W=v.select(N[0]);else if(JXG$1.isFunction(N[0])&&JXG$1.isPoint(N[0]()))W=N[0]();else if(JXG$1.isString(N[0]))W=v.select(N[0]);else throw new Error("JSXGraph: Can't create Parabola with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
167Possible parent types: [point,line]`);return JXG$1.isArray(ie)&&ie.length===2&&(ce=JXG$1.copyAttributes(G,v.options,"conic","line"),ie=v.create("line",ie,ce)),JXG$1.exists(N[3])||(N[3]=2*Math.PI),JXG$1.exists(N[2])||(N[2]=0),Y=v.create("point",[function(){return Geometry.projectPointToLine(W,ie,v).usrCoords}],se),q=v.create("curve",[function(pe){return 0},function(pe){return 0},N[2],N[3]],ae),q.midpoint=q.center=Y,q.subs={center:q.center},q.inherits.push(q.center),z=function(pe,ge){var ve,be,Ee,Pe,Je,Ce;ge||(ve=ie.stdform[1],be=ie.stdform[2],Ee=ie.stdform[0],Pe=ve*ve+be*be,Je=W.X(),Ce=W.Y(),q.quadraticform=[[Ee*Ee-Pe*(Je*Je+Ce*Ce),Ee*ve+Pe*Je,Ee*be+Pe*Ce],[Ee*ve+Pe*Je,-be*be,ve*be],[Ee*be+Pe*Ce,ve*be,-ve*ve]])},q.X=function(pe,ge){var ve,be,Ee=ie.getAngle(),Pe=Geometry.distPointLine(W.coords.usrCoords,ie.stdform),Je=ie.point1.coords.usrCoords,Ce=ie.point2.coords.usrCoords,Ve=W.coords.usrCoords;return Je[0]===0?Je=[1,Ce[1]+ie.stdform[2],Ce[2]-ie.stdform[1]]:Ce[0]===0&&(Ce=[1,Je[1]+ie.stdform[2],Je[2]-ie.stdform[1]]),be=(Ce[1]-Je[1])*(Ve[2]-Je[2])-(Ce[2]-Je[2])*(Ve[1]-Je[1])>=0?1:-1,ve=be*Pe/(1-Math.sin(pe)),ge||z(pe,ge),W.X()+Math.cos(pe+Ee)*ve},q.Y=function(pe,ge){var ve,be,Ee=ie.getAngle(),Pe=Geometry.distPointLine(W.coords.usrCoords,ie.stdform),Je=ie.point1.coords.usrCoords,Ce=ie.point2.coords.usrCoords,Ve=W.coords.usrCoords;
167return Je[0]===0?Je=[1,Ce[1]+ie.stdform[2],Ce[2]-ie.stdform[1]]:Ce[0]===0&&(Ce=[1,Je[1]+ie.stdform[2],Je[2]-ie.stdform[1]]),be=(Ce[1]-Je[1])*(Ve[2]-Je[2])-(Ce[2]-Je[2])*(Ve[1]-Je[1])>=0?1:-1,ve=be*Pe/(1-Math.sin(pe)),W.Y()+Math.sin(pe+Ee)*ve},q.type=Const.OBJECT_TYPE_CONIC,Y.addChild(q),JXG$1.isPoint(W)&&(W.addChild(q),q.inherits.push(W)),ie.addChild(q),q.setParents(N),q};JXG$1.createConic=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe=[[1,0,0],[0,1,0],[0,0,1]],Je=[[1,0,0],[0,1,0],[0,0,1]],Ce=[],Ve=[],Re=JXG$1.copyAttributes(G,v.options,"conic","point"),qe=JXG$1.copyAttributes(G,v.options,"conic","center"),et=JXG$1.copyAttributes(G,v.options,"conic");if(N.length===5)Ee=!0;else if(N.length===6)Ee=!1;else throw new Error("JSXGraph: Can't create generic Conic with "+N.length+" parameters.");if(Ee)for(ve=0;ve<5;ve++)if(N[ve].length>1)Ce[ve]=v.create("point",N[ve],Re);else if(JXG$1.isPoint(N[ve]))Ce[ve]=v.select(N[ve]);else if(JXG$1.isFunction(N[ve])&&JXG$1.isPoint(N[ve]()))Ce[ve]=N[ve]();else if(JXG$1.isString(N[ve]))Ce[ve]=v.select(N[ve]);else throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof N[ve]+`'.
168Possible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]`);else be=[[0,0,0],[0,0,0],[0,0,0]],be[0][0]=JXG$1.isFunction(N[2])?function(){return N[2]()}:function(){return N[2]},be[0][1]=JXG$1.isFunction(N[4])?function(){return N[4]()}:function(){return N[4]},be[0][2]=JXG$1.isFunction(N[5])?function(){return N[5]()}:function(){return N[5]},be[1][1]=JXG$1.isFunction(N[0])?function(){return N[0]()}:function(){return N[0]},be[1][2]=JXG$1.isFunction(N[3])?function(){return N[3]()}:function(){return N[3]},be[2][2]=JXG$1.isFunction(N[1])?function(){return N[1]()}:function(){return N[1]};if(ie=function(Ze){var tt,Ke;for(tt=0;tt<3;tt++)for(Ke=tt;Ke<3;Ke++)Ze[tt][Ke]+=Ze[Ke][tt];for(tt=0;tt<3;tt++)for(Ke=0;Ke<tt;Ke++)Ze[tt][Ke]=Ze[Ke][tt];return Ze},W=function(Ze,tt){var Ke,rt,it=[[0,0,0],[0,0,0],[0,0,0]];for(Ke=0;Ke<3;Ke++)for(rt=0;rt<3;rt++)it[Ke][rt]=Ze[Ke]*tt[rt];return ie(it)},Y=function(Ze,tt,Ke){var rt,it,ot,ut,ct,at=[[0,0,0],[0,0,0],[0,0,0]];for(ct=Mat.matVecMult(tt,Ke),ot=Mat.innerProduct(Ke,ct),ct=Mat.matVecMult(Ze,Ke),ut=Mat.innerProduct(Ke,ct),rt=0;rt<3;rt++)for(it=0;it<3;it++)at[rt][it]=ot*Ze[rt][it]-ut*tt[rt][it];return at},q=v.create("curve",[function(Ze){return 0},function(Ze){return 0},0,2*Math.PI],et),z=function(Ze,tt){var Ke,rt,it;if(!tt){if(Ee){for(Ke=0;Ke<5;Ke++)Ve[Ke]=Ce[Ke].coords.usrCoords;pe=W(Mat.crossProduct(Ve[0],Ve[1]),Mat.crossProduct(Ve[2],Ve[3])),ge=W(Mat.crossProduct(Ve[0],Ve[2]),Mat.crossProduct(Ve[1],Ve[3])),Je=Y(pe,ge,Ve[4])}else for(Ke=0;Ke<3;Ke++)for(rt=Ke;rt<3;rt++)Je[Ke][rt]=be[Ke][rt](),rt>Ke&&(Je[rt][Ke]=Je[Ke][rt]);q.quadraticform=Je,ne=Numerics.Jacobi(Je),ne[0][0][0]<0&&(ne[0][0][0]*=-1,ne[0][1][1]*=-1,ne[0][2][2]*=-1),Pe=ne[1],ce=Math.sqrt(Math.abs(ne[0][0][0])),se=Math.sqrt(Math.abs(ne[0][1][1])),ae=Math.sqrt(Math.abs(ne[0][2][2]))}return ne[0][1][1]<=0&&ne[0][2][2]<=0?it=Mat.matVecMult(Pe,[1/ce,Math.cos(Ze)/se,Math.sin(Ze)/ae]):ne[0][1][1]<=0&&ne[0][2][2]>0?it=Mat.matVecMult(Pe,[Math.cos(Ze)/ce,1/se,Math.sin(Ze)/ae]):ne[0][2][2]<0&&(it=Mat.matVecMult(Pe,[Math.sin(Ze)/ce,Math.cos(Ze)/se,1/ae])),JXG$1.exists(it)?(it[1]/=it[0],it[2]/=it[0],it[0]=1):it=[1,NaN,NaN],it},q.X=function(Ze,tt){return z(Ze,tt)[1]},q.Y=function(Ze,tt){return z(Ze,tt)[2]},q.midpoint=v.create("point",[function(){var Ze=q.quadraticform;return[Ze[1][1]*Ze[2][2]-Ze[1][2]*Ze[1][2],Ze[1][2]*Ze[0][2]-Ze[2][2]*Ze[0][1],Ze[0][1]*Ze[1][2]-Ze[1][1]*Ze[0][2]]}],qe),q.type=Const.OBJECT_TYPE_CONIC,q.center=q.midpoint,q.subs={center:q.center},q.inherits.push(q.center),q.inherits=q.inherits.concat(Ce),Ee){for(ve=0;ve<5;ve++)JXG$1.isPoint(Ce[ve])&&Ce[ve].addChild(q);q.setParents(N)}return q.addChild(q.center),q};JXG$1.registerElement("ellipse",JXG$1.createEllipse);JXG$1.registerElement("hyperbola",JXG$1.createHyperbola);JXG$1.registerElement("parabola",JXG$1.createParabola);JXG$1.registerElement("conic",JXG$1.createConic);JXG$1.Polygon=function(v,N,G){this.constructor(v,G,Const.OBJECT_TYPE_POLYGON,Const.OBJECT_CLASS_AREA);var z,q,Y,W,ie,ne=JXG$1.copyAttributes(G,v.options,"polygon","borders");for(this.withLines=G.withlines,this.attr_line=ne,this.vertices=[],z=0;z<N.length;z++)this.vertices[z]=this.board.select(N[z]),this.vertices[z]._is_new&&(delete this.vertices[z]._is_new,this.vertices[z]._is_new_pol=!0);if(this.vertices.length>0&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.borders=[],this.withLines)for(Y=this.vertices.length-1,W=0;W<Y;
168W++)z=(W+1)%Y,ne.id=ne.ids&&ne.ids[z],ne.name=ne.names&&ne.names[z],ne.strokecolor=JXG$1.isArray(ne.colors)&&ne.colors[z%ne.colors.length]||ne.strokecolor,ne.visible=JXG$1.exists(G.borders.visible)?G.borders.visible:G.visible,ne.strokecolor===!1&&(ne.strokecolor="none"),q=v.create("segment",[this.vertices[z],this.vertices[z+1]],ne),q.dump=!1,this.borders[z]=q,q.parentPolygon=this,this.addChild(q);for(this.inherits.push(this.vertices,this.borders),this.id=this.board.setId(this,"Py"),z=0;z<this.vertices.length-1;z++)ie=this.board.select(this.vertices[z]),JXG$1.exists(ie._is_new_pol)?(this.addChild(ie),delete ie._is_new_pol):ie.addChild(this);this.board.renderer.drawPolygon(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="polygon",this.createLabel(),this.methodMap=JXG$1.deepCopy(this.methodMap,{borders:"borders",vertices:"vertices",A:"Area",Area:"Area",Perimeter:"Perimeter",L:"Perimeter",boundingBox:"bounds",BoundingBox:"bounds",addPoints:"addPoints",insertPoints:"insertPoints",removePoints:"removePoints",Intersect:"intersect"})};JXG$1.Polygon.prototype=new GeometryElement;JXG$1.extend(JXG$1.Polygon.prototype,{pnpoly:function(v,N,G){return Geometry.pnpoly(v,N,this.vertices,G,this.board)},hasPoint:function(v,N){var G,z;if(this.evalVisProp("hasinnerpoints")&&this.pnpoly(v,N))return!0;for(z=this.borders.length,G=0;G<z;G++)if(this.borders[G].hasPoint(v,N))return!0;return!1},updateRenderer:function(){var v,N;if(!this.needsUpdate)return this;if(this.visPropCalc.visible){for(N=this.vertices.length-(this.elType==="polygonalchain"?0:1),this.isReal=!0,v=0;v<N;++v)if(!this.vertices[v].isReal){this.isReal=!1;break}if(!this.isReal){this.updateVisibility(!1);for(v in this.childElements)this.childElements.hasOwnProperty(v)&&this.childElements[v].setDisplayRendNode(!1)}}return this.visPropCalc.visible&&this.board.renderer.updatePolygon(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this},getTextAnchor:function(){var v,N,G,z,q;if(this.vertices.length===0)return new Coords(Const.COORDS_BY_USER,[1,0,0],this.board);for(v=this.vertices[0].X(),N=this.vertices[0].Y(),G=v,z=N,q=0;q<this.vertices.length;q++)this.vertices[q].X()<v&&(v=this.vertices[q].X()),this.vertices[q].X()>G&&(G=this.vertices[q].X()),this.vertices[q].Y()>N&&(N=this.vertices[q].Y()),this.vertices[q].Y()<z&&(z=this.vertices[q].Y());return new Coords(Const.COORDS_BY_USER,[(v+G)*.5,(N+z)*.5],this.board)},getLabelAnchor:JXG$1.shortcut(JXG$1.Polygon.prototype,"getTextAnchor"),cloneToBackground:function(){var v,N=JXG$1.getCloneObject(this);return N.vertices=this.vertices,v=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawPolygon(N),this.board.renderer.enhancedRendering=v,this.traces[N.id]=N.rendNode,this},hideElement:function(v){var N;if(JXG$1.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),!v)for(N=0;N<this.borders.length;N++)this.borders[N].hideElement();this.hasLabel&&JXG$1.exists(this.label)&&(this.label.hiddenByParent=!0,this.label.visPropCalc.visible&&this.label.hideElement())},showElement:function(v){var N;if(JXG$1.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!0),!v)for(N=0;N<this.borders.length;N++)this.borders[N].showElement().updateRenderer();return JXG$1.exists(this.label)&&this.hasLabel&&this.label.hiddenByParent&&(this.label.hiddenByParent=!1,this.label.visPropCalc.visible||this.label.showElement().updateRenderer()),this},Area:function(){return Math.abs(Geometry.signedPolygon(this.vertices,!0))},Perimeter:function(){var v,N=this.vertices.length,G=0;for(v=1;v<N;++v)G+=this.vertices[v].Dist(this.vertices[v-1]);return G},L:function(){return this.Perimeter()},boundingBox:function(){var v=[0,0,0,0],N,G,z=this.vertices.length-1;if(z===0)return v;for(v[0]=this.vertices[0].X(),v[2]=v[0],v[1]=this.vertices[0].Y(),v[3]=v[1],N=1;N<z;
168++N)G=this.vertices[N].X(),G<v[0]?v[0]=G:G>v[2]&&(v[2]=G),G=this.vertices[N].Y(),G>v[1]?v[1]=G:G<v[3]&&(v[3]=G);return v},bounds:function(){return this.boundingBox()},remove:function(){var v;for(v=0;v<this.borders.length;v++)this.board.removeObject(this.borders[v]);GeometryElement.prototype.remove.call(this)},findPoint:function(v){var N;if(!JXG$1.isPoint(v))return-1;for(N=0;N<this.vertices.length;N++)if(this.vertices[N].id===v.id)return N;return-1},addPoints:function(v){var N,G=Array.prototype.slice.call(arguments);return this.elType==="polygonalchain"?N=this.vertices.length-1:N=this.vertices.length-2,this.insertPoints.apply(this,[N].concat(G))},insertPoints:function(v,N){var G,z,q,Y,W;if(arguments.length===0)return this;if(q=this.vertices.length-1,this.elType==="polygon"&&q--,v<-1||v>q)return this;for(z=arguments.length-1,G=1;G<z+1;G++)W=JXG$1.providePoints(this.board,[arguments[G]],{},"polygon",["vertices"])[0],W._is_new&&(this.addChild(W),delete W._is_new),this.vertices.splice(v+G,0,W);if(this.withLines)for(Y=v+1,this.elType==="polygon"?v<0?(this.vertices[this.vertices.length-1]=this.vertices[0],this.borders[this.borders.length-1].point2=this.vertices[this.vertices.length-1]):this.borders[v].point2=this.vertices[Y]:v>=0&&(v<this.borders.length?this.borders[v].point2=this.vertices[Y]:Y=v),G=Y;G<Y+z;G++)this.borders.splice(G,0,this.board.create("segment",[this.vertices[G],this.vertices[G+1]],this.attr_line));return this.inherits=[],this.inherits.push(this.vertices,this.borders),this.board.update(),this},removePoints:function(v){var N,G,z,q,Y=[],W=[],ie=[],ne=[];for(this.elType==="polygon"&&(q=this.vertices.pop()),N=0;N<arguments.length;N++)z=arguments[N],JXG$1.isPoint(z)&&(z=this.findPoint(z)),JXG$1.isNumber(z)&&z>-1&&z<this.vertices.length&&JXG$1.indexOf(ie,z)===-1&&ie.push(z);if(ie.length===0)return this.elType==="polygon"&&this.vertices.push(q),this;for(N=0;N<ie.length;N++)this.vertices[ie[N]].removeChild(this);for(ie=ie.sort(),Y=this.vertices.slice(),W=this.borders.slice(),this.withLines&&ne.push([ie[ie.length-1]]),N=ie.length-1;N>-1;N--)Y[ie[N]]=-1,this.withLines&&ie.length>1&&ie[N]-1>ie[N-1]&&(ne[ne.length-1][1]=ie[N],ne.push([ie[N-1]]));for(this.withLines&&(ne[ne.length-1][1]=ie[0]),this.vertices=[],N=0;N<Y.length;N++)JXG$1.isPoint(Y[N])&&this.vertices.push(Y[N]);if(this.elType==="polygon"&&this.vertices.length>1&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.withLines){for(N=0;N<ne.length;N++){for(G=ne[N][1]-1;G<ne[N][0]+1;G++)G<0?this.elType==="polygon"&&(this.board.removeObject(this.borders[W.length-1]),W[W.length-1]=-1):G<W.length&&(this.board.removeObject(this.borders[G]),W[G]=-1);ne[N][1]!==0&&ne[N][0]!==Y.length-1&&(W[ne[N][0]-1]=this.board.create("segment",[Y[ne[N][1]-1],Y[ne[N][0]+1]],this.attr_line))}for(this.borders=[],N=0;N<W.length;N++)W[N]!==-1&&this.borders.push(W[N]);this.elType==="polygon"&&this.vertices.length>2&&(ne[0][1]===this.vertices.length-1||ne[ne.length-1][1]===0)&&this.borders.push(this.board.create("segment",[this.vertices[this.vertices.length-2],this.vertices[0]],this.attr_line))}return this.inherits=[],this.inherits.push(this.vertices,this.borders),this.board.update(),this},getParents:function(){return this.setParents(this.vertices),this.parents},getAttributes:function(){var v=GeometryElement.prototype.getAttributes.call(this),N;if(this.withLines)for(v.lines=v.lines||{},v.lines.ids=[],v.lines.colors=[],N=0;N<this.borders.length;N++)v.lines.ids.push(this.borders[N].id),v.lines.colors.push(this.borders[N].visProp.strokecolor);return v}
168,snapToGrid:function(){var v,N;for(this.evalVisProp("snaptogrid")?N=!0:N=!1,v=0;v<this.vertices.length;v++)this.vertices[v].handleSnapToGrid(N,!0)},setPositionDirectly:function(v,N,G){var z,q,Y,W,ie=new Coords(v,N,this.board),ne=new Coords(v,G,this.board);for(W=this.vertices.length-1,Y=0;Y<W;Y++)if(!this.vertices[Y].draggable())return this;return z=Stat.subtract(ie.usrCoords,ne.usrCoords),q=this.board.create("transform",z.slice(1),{type:"translate"}),q.applyOnce(this.vertices.slice(0,-1)),this},sutherlandHodgman:function(v){var N=JXG$1.Math.Geometry.sortVertices(this.vertices),G=JXG$1.Math.Geometry.sortVertices(v.vertices),z=N.length-1,q=G.length-1,Y,W=[],ie,ne,se,ae,ce,pe,ge=function(ve,be,Ee){return(be[1]-ve[1])*(Ee[2]-ve[2])-(be[2]-ve[2])*(Ee[1]-ve[1])>=0};for(ne=0;ne<q;ne++)W.push(G[ne]);for(ne=0;ne<z;ne++)for(ie=W.slice(0),Y=ie.length,W=[],ae=ie[Y-1],se=0;se<Y;se++)ce=ie[se],ge(N[ne],N[ne+1],ce)?(ge(N[ne],N[ne+1],ae)||(pe=JXG$1.Math.Geometry.meetSegmentSegment(ae,ce,N[ne],N[ne+1]),pe[0][1]/=pe[0][0],pe[0][2]/=pe[0][0],pe[0][0]=1,W.push(pe[0])),W.pu
168sh(ce)):ge(N[ne],N[ne+1],ae)&&(pe=JXG$1.Math.Geometry.meetSegmentSegment(ae,ce,N[ne],N[ne+1]),pe[0][1]/=pe[0][0],pe[0][2]/=pe[0][0],pe[0][0]=1,W.push(pe[0])),ae=ce;return W},intersect:function(v){return this.sutherlandHodgman(v)}});JXG$1.createPolygon=function(v,N,G){var z,q,Y,W,ie=[],ne,se,ae=!1;if(ne=JXG$1.copyAttributes(G,v.options,"polygon"),W=v.select(N[0]),W===null&&(W=N[0]),JXG$1.isObject(W)&&W.type===Const.OBJECT_TYPE_POLYGON&&JXG$1.isTransformationOrArray(N[1]))for(ae=!0,Y=W.vertices.length-1,se=JXG$1.copyAttributes(G,v.options,"polygon","vertices"),q=0;q<Y;q++)se.withlabel&&(se.name=W.vertices[q].name===""?"":W.vertices[q].name+"'"),ie.push(v.create("point",[W.vertices[q],N[1]],se));else if(ie=JXG$1.providePoints(v,N,G,"polygon",["vertices"]),ie===!1)throw new Error("JSXGraph: Can't create polygon / polygonalchain with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates. Alternatively, a polygon and a transformation can be supplied");if(ne=JXG$1.copyAttributes(G,v.options,"polygon"),z=new JXG$1.Polygon(v,ie,ne),z.isDraggable=!0,ae)for(z.prepareUpdate().update().updateVisibility().updateRenderer(),Y=W.vertices.length-1,q=0;q<Y;q++)ie[q].prepareUpdate().update().updateVisibility().updateRenderer();return z};JXG$1.createRegularPolygon=function(v,N,G){var z,q,Y,W=[],ie,ne,se,ae;if(ne=N.length,Y=N[ne-1],JXG$1.isNumber(Y)&&(N.length!==3||Y<3))throw new Error("JSXGraph: A regular polygon needs two point types and a number > 2 as input.");if(JXG$1.isNumber(v.select(Y))?(ne--,se=!1):(Y=ne,se=!0),W=JXG$1.providePoints(v,N.slice(0,ne),G,"regularpolygon",["vertices"]),W===!1)throw new Error("JSXGraph: Can't create regular polygon with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates");for(ae=JXG$1.copyAttributes(G,v.options,"regularpolygon","vertices"),q=2;q<Y;
168q++)ie=v.create("transform",[Math.PI*(2-(Y-2)/Y),W[q-1]],{type:"rotate"}),se?(W[q].addTransform(W[q-2],ie),W[q].fullUpdate()):(JXG$1.isArray(ae.ids)&&ae.ids.length>=Y-2&&(ae.id=ae.ids[q-2]),W[q]=v.create("point",[W[q-2],ie],ae),W[q].type=Const.OBJECT_TYPE_CAS,W[q].isDraggable=!0,W[q].visProp.fixed=!1);return ae=JXG$1.copyAttributes(G,v.options,"regularpolygon"),z=v.create("polygon",W,ae),z.elType="regularpolygon",z};JXG$1.createPolygonalChain=function(v,N,G){var z,q;return z=JXG$1.copyAttributes(G,v.options,"polygonalchain"),q=v.create("polygon",N,z),q.elType="polygonalchain",q.vertices.pop(),v.removeObject(q.borders[q.borders.length-1]),q.borders.pop(),q};JXG$1.createParallelogram=function(v,N,G){var z,q,Y=[],W,ie;if(Y=JXG$1.providePoints(v,N,G,"polygon",["vertices"]),Y===!1||Y.length<3)throw new Error("JSXGraph: Can't create parallelogram with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates.");return ie=JXG$1.copyAttributes(G,v.options,"parallelogram","parallelpoint"),q=v.create("parallelpoint",Y,ie),W=JXG$1.copyAttributes(G,v.options,"parallelogram"),z=v.create("polygon",[Y[0],Y[1],q,Y[2]],W),z.elType="parallelogram",z.parallelPoint=q,z.isDraggable=!0,q.isDraggable=!0,q.visProp.fixed=!1,z};JXG$1.registerElement("polygon",JXG$1.createPolygon);JXG$1.registerElement("regularpolygon",JXG$1.createRegularPolygon);JXG$1.registerElement("polygonalchain",JXG$1.createPolygonalChain);JXG$1.registerElement("parallelogram",JXG$1.createParallelogram);const Polygon=JXG$1.Polygon;JXG$1.Curve=function(v,N,G){this.constructor(v,G,Const.OBJECT_TYPE_CURVE,Const.OBJECT_CLASS_CURVE),this.points=[],this.numberPoints=this.evalVisProp("numberpointshigh"),this.bezierDegree=1,this.dataX=null,this.dataY=null,this.ticks=[],this.qdt=null,JXG$1.exists(N[0])?this.varname=N[0]:this.varname="x",this.xterm=N[1],this.yterm=N[2],this.generateTerm(this.varname,this.xterm,this.yterm,N[3],N[4]),this.updateCurve(),this.id=this.board.setId(this,"G"),this.board.renderer.drawCurve(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="curve",this.createLabel(),JXG$1.isString(this.xterm)&&this.notifyParents(this.xterm),JXG$1.isString(this.yterm)&&this.notifyParents(this.yterm),this.methodMap=JXG$1.deepCopy(this.methodMap,{generateTerm:"generateTerm",setTerm:"generateTerm",move:"moveTo",moveTo:"moveTo",MinX:"minX",MaxX:"maxX"})};JXG$1.Curve.prototype=new GeometryElement;JXG$1.extend(JXG$1.Curve.prototype,{minX:function(){var v;return this.evalVisProp("curvetype")==="polar"?0:(v=new Coords(Const.COORDS_BY_SCREEN,[-this.board.canvasWidth*.1,0],this.board,!1),v.usrCoords[1])},maxX:function(){var v;return this.evalVisProp("curvetype")==="polar"?2*Math.PI:(v=new Coords(Const.COORDS_BY_SCREEN,[this.board.canvasWidth*1.1,0],this.board,!1),v.usrCoords[1])},X:function(v){return NaN},Y:function(v){return NaN},Z:function(v){return 1},hasPoint:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe=[],ge,ve,be=this.evalVisProp("numberpointslow"),Ee=(this.maxX()-this.minX())/be,Pe,Je,Ce=1/0,Ve,Re,qe,et,Ze,tt=!0;if(JXG$1.isObject(this.evalVisProp("precision"))?(Je=this.board._inputDevice,Pe=this.evalVisProp("precision."+Je)):Pe=this.board.options.precision.hasPoint,ne=new Coords(Const.COORDS_BY_SCREEN,[v,N],this.board,!1),v=ne.usrCoords[1],N=ne.usrCoords[2],this.bezierDegree===1&&this.evalVisProp("hasinnerpoints")&&(ce=Geometry.windingNumber([1,v,N],this.points,!0),ce!==0))return!0;if(Pe+=this.evalVisProp("strokewidth")*.5,Pe*=Pe,Ve=this.board.unitX*this.board.unitX,Re=this.board.unitY*this.board.unitY,et=this.minX(),Ze=this.maxX(),JXG$1.exists(this._visibleArea)&&(et=this._visibleArea[0],Ze=this._visibleArea[1],Ee=(Ze-et)/be),qe=this.evalVisProp("curvetype"),qe==="parameter"||qe==="polar")for(this.transformations.length>0&&(this.updateTransformMatrix(),ae=Mat.inverse(this.transformMat),q=Mat.matVecMult(ae,[1,v,N]),v=q[1],N=q[2]),Y=0,z=et;Y<be;Y++){if(W=this.X(z,tt),ie=this.Y(z,tt),Ce=(v-W)*(v-W)*Ve+(N-ie)*(N-ie)*Re,Ce<=Pe)return!0;z+=Ee}else if(qe==="plot"||qe==="functiongraph"){for((!JXG$1.exists(G)||G<0)&&(G=0),JXG$1.exists(this.qdt)&&this.evalVisProp("useqdt")&&this.bezierDegree!==3?(ve=this.qdt.query(new Coords(Const.COORDS_BY_USER,[v,N],this.board)),ge=ve.points,se=ge.length):(ge=this.points,se=this.numberPoints-1),Y=G;Y<se;Y++)if(this.bezierDegree===3?pe=Geometry.projectCoordsToBeziersegment([1,v,N],this,Y):ve?(ge[Y].prev&&(pe=Geometry.projectCoordsToSegment([1,v,N],ge[Y].prev.usrCoords,ge[Y].usrCoords)),ge[Y].next&&ge[Y+1]!==ge[Y].next&&(pe=Geometry.projectCoordsToSegment([1,v,N],ge[Y].usrCoords,ge[Y].next.usrCoords))):pe=Geometry.projectCoordsToSegment([1,v,N],ge[Y].usrCoords,ge[Y+1].usrCoords),pe[1]>=0&&pe[1]<=1&&(v-pe[0][1])*(v-pe[0][1])*Ve+(N-pe[0][2])*(N-pe[0][2])*Re<=Pe)return!0;return!1}return Ce<Pe},allocatePoints:function(){var v,N;if(N=this.numberPoints,this.points.length<this.numberPoints)for(v=this.points.length;v<N;v++)this.points[v]=new Coords(Const.COORDS_BY_USER,[0,0],this.board,!1)},update:function(){return this.needsUpdate&&(this.evalVisProp("trace")&&this.cloneToBackgroun
168d(!0),this.updateCurve()),this},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=Plot.checkReal(this.points),this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateCurve(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},updateDataArray:function(){},updateCurve:function(){var v,N,G,z,q,Y,W=this.visProp.plotversion,ie=!1;if(this.updateTransformMatrix(),this.updateDataArray(),G=this.minX(),z=this.maxX(),JXG$1.exists(this.dataX))for(this.numberPoints=this.dataX.length,N=this.numberPoints,this.allocatePoints(),v=0;v<N;v++)q=v,JXG$1.exists(this.dataY)?(Y=v,this.points[v].setCoordinates(Const.COORDS_BY_USER,[this.dataX[v],this.dataY[v]],!1)):(Y=this.X(q),this.points[v].setCoordinates(Const.COORDS_BY_USER,[this.dataX[v],this.Y(Y,ie)],!1)),this.points[v]._t=v,ie=!0;else if(this.evalVisProp("doadvancedplot")?W===1||this.evalVisProp("doadvancedplotold")?Plot.updateParametricCurveOld(this,G,z):W===2?Plot.updateParametricCurve_v2(this,G,z):W===3?Plot.updateParametricCurve_v3(this,G,z):W===4?Plot.updateParametricCurve_v4(this,G,z):Plot.updateParametricCurve_v2(this,G,z):(this.board.updateQuality===this.board.BOARD_QUALITY_HIGH?this.numberPoints=this.evalVisProp("numberpointshigh"):this.numberPoints=this.evalVisProp("numberpointslow"),this.allocatePoints(),Plot.updateParametricCurveNaive(this,G,z,this.numberPoints)),N=this.numberPoints,this.evalVisProp("useqdt")&&this.board.updateQuality===this.board.BOARD_QUALITY_HIGH)for(this.qdt=new QDT(this.board.getBoundingBox()),v=0;v<this.points.length;v++)this.qdt.insert(this.points[v]),v>0&&(this.points[v].prev=this.points[v-1]),v<N-1&&(this.points[v].next=this.points[v+1]);for(this.evalVisProp("curvetype")!=="plot"&&this.evalVisProp("rdpsmoothing")&&(this.points=Numerics.RamerDouglasPeucker(this.points,.2),this.numberPoints=this.points.length),N=this.numberPoints,v=0;v<N;v++)this.updateTransform(this.points[v]);return this},updateTransformMatrix:function(){var v,N,G=this.transformations.length;for(this.transformMat=[[1,0,0],[0,1,0],[0,0,1]],N=0;N<G;N++)v=this.transformations[N],v.update(),this.transformMat=Mat.matMatMult(v.matrix,this.transformMat);return this},updateTransform:function(v){var N,G=this.transformations.length;return G>0&&(N=Mat.matVecMult(this.transformMat,v.usrCoords),v.setCoordinates(Const.COORDS_BY_USER,N,!1,!0)),v},addTransform:function(v){var N,G=JXG$1.isArray(v)?v:[v],z=G.length;for(N=0;N<z;N++)this.transformations.push(G[N]);return this},interpolationFunctionFromArray:function(v){var N="data"+v,G=this;return function(z,q){var Y,W,ie,ne,se=G[N],ae=se.length,ce,pe=[];if(isNaN(z))return NaN;if(z<0)return JXG$1.isFunction(se[0])?se[0]():se[0];if(G.bezierDegree===3){if(ce=(ae-1)/3,z>=ce)return JXG$1.isFunction(se[se.length-1])?se[se.length-1]():se[se.length-1];for(Y=Math.floor(z)*3,ie=z%1,ne=1-ie,W=0;W<4;W++)JXG$1.isFunction(se[Y+W])?pe[W]=se[Y+W]():pe[W]=se[Y+W];return ne*ne*(ne*pe[0]+3*ie*pe[1])+(3*ne*pe[2]+ie*pe[3])*ie*ie}if(z>ae-2?Y=ae-2:Y=parseInt(Math.floor(z),10),Y===z)return JXG$1.isFunction(se[Y])?se[Y]():se[Y];for(W=0;W<2;W++)JXG$1.isFunction(se[Y+W])?pe[W]=se[Y+W]():pe[W]=se[Y+W];return pe[0]+(pe[1]-pe[0])*(z-Y)}},generateTerm:function(v,N,G,z,q){var Y,W,ie;JXG$1.isArray(N)?(this.dataX=N,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray.apply(this,["X"]),this.visProp.curvetype="plot",this.isDraggable=!0):(this.X=JXG$1.createFunction(N,this.board,v),JXG$1.isString(N)?this.visProp.curvetype="functiongraph":(JXG$1.isFunction(N)||JXG$1.isNumber(N))&&(this.visProp.curvetype="parameter"),this.isDraggable=!0),JXG$1.isArray(G)?(this.dataY=G,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])):JXG$1.exists(G)?this.Y=JXG$1.createFunction(G,this.board,v):(ie=Mat.transpose(N),this.dataX=ie[0],this.dataY=ie[1],this.numberPoints=this.dataX.length,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])),JXG$1.isFunction(N)&&JXG$1.isArray(G)&&(Y=JXG$1.createFunction(G[0],this.board,""),W=JXG$1.createFunction(G[1],this.board,""),this.X=function(ne){return N(ne)*Math.cos(ne)+Y()},this.X.deps=Y.deps,this.Y=function(ne){return N(ne)*Math.sin(ne)+W()},this.Y.deps=W.deps,this.visProp.curvetype="polar"),JXG$1.exists(z)?this.minX=JXG$1.createFunction(z,this.board,""):delete this.minX,JXG$1.exists(q)?this.maxX=JXG$1.createFunction(q,this.board,""):delete this.maxX,this.addParentsFromJCFunctions([this.X,this.Y,this.minX,this.maxX])},notifyParents:function(v){var N,G,z=!1,q;q={xterm:1,yterm:1};for(N in q)if(q.hasOwnProperty(N)&&this.hasOwnProperty(N)&&this[N].origin){z=!0;for(G in this[N].origin.deps)this[N].origin.deps.hasOwnProperty(G)&&this[N].origin.deps[G].addChild(this)}z||GeonextParser.findDependencies(this,v,this.board)},getLabelPosition:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce,pe=1.5;return q=JXG$1.parsePosition(v),ne=JXG$1.parseNumber(q.pos,this.maxX()-this.minX(),1),q.pos.indexOf("fr")<0&&q.pos.indexOf("%")<0&&(ne=0),se=this.minX()+ne,G=this.X(se),z=this.Y(se),Y=new Coords(Const.COORDS_BY_USER,[G,z],this.board).scrCoords,ie=Mat.eps,se<this.minX()+ie?(ae=(this.X(se+ie)-this.X(se))/ie,ce=(this.Y(se+ie)-this.Y(se))/ie):se>this.maxX()-ie?(ae=(this.X(se)-this.X(se-ie))/ie,ce=(this.Y(se)-this.Y(se-ie))/ie):(ae=.5*(this.X(se+ie)-this.X(se-ie))/ie,ce=.5*(this.Y(se+ie)-this.Y(se-ie))/ie),W=Mat.hypot(ae,ce),q.side==="left"?ce*=-1:ae*=-1,JXG$1.exists(this.label)&&(pe=.5*N/W),G=Y[1]+ce*this.label.size[0]*pe,z=Y[2]-ae*this.label.size[1]*pe,new Coords(Const.COORDS_BY_SCREEN,[G,z],this.board)},getLabelAnchor:function(){var v,N,G,z,q=.05*this.board.canvasWidth,Y=.05*this.board.canvasHeight,W=.95*this.board.canvasWidth,ie=.95*this.board.canvasHeight;if(!JXG$1.exists(this.label))return new Coords(Const.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(G=this.label.evalVisProp("position"),!JXG$1.isString(G))return new Coords(Const.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(G.indexOf("right")<0&&G.indexOf("left")<0)switch(this.evalVisProp("label.position")){case"ulft":v=q,N=Y;break;case"llft":v=q,N=ie;break;case"rt":v=W,N=.5*ie;break;case"lrt":v=W,N=ie;break;case"urt":v=W,N=Y;break;case"top":v=.5*W,N=Y;break;case"bot":v=.5*W,N=ie;break;
168default:v=q,N=.5*ie}else return this.getLabelPosition(G,this.label.evalVisProp("distance"));return z=new Coords(Const.COORDS_BY_SCREEN,[v,N],this.board,!1),Geometry.projectCoordsToCurve(z.usrCoords[1],z.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var v,N=JXG$1.getCloneObject(this);return N.points=this.points.slice(0),N.bezierDegree=this.bezierDegree,N.numberPoints=this.numberPoints,v=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawCurve(N),this.board.renderer.enhancedRendering=v,this.traces[N.id]=N.rendNode,this},bounds:function(){var v=1/0,N=-1/0,G=1/0,z=-1/0,q=this.points.length,Y,W,ie;if(this.bezierDegree===3){for(Y=0;Y<q;Y++)this.points[Y].X=JXG$1.bind(function(){return this.usrCoords[1]},this.points[Y]),this.points[Y].Y=JXG$1.bind(function(){return this.usrCoords[2]},this.points[Y]);return W=Numerics.bezier(this.points),ie=W[3](),v=Numerics.fminbr(function(ne){return W[0](ne)},[0,ie]),N=Numerics.fminbr(function(ne){return-W[0](ne)},[0,ie]),G=Numerics.fminbr(function(ne){return W[1](ne)},[0,ie]),z=Numerics.fminbr(function(ne){return-W[1](ne)},[0,ie]),v=W[0](v),N=W[0](N),G=W[1](G),z=W[1](z),[v,z,N,G]}for(Y=0;Y<q;Y++)v>this.points[Y].usrCoords[1]&&(v=this.points[Y].usrCoords[1]),N<this.points[Y].usrCoords[1]&&(N=this.points[Y].usrCoords[1]),G>this.points[Y].usrCoords[2]&&(G=this.points[Y].usrCoords[2]),z<this.points[Y].usrCoords[2]&&(z=this.points[Y].usrCoords[2]);return[v,z,N,G]},getParents:function(){var v=[this.xterm,this.yterm,this.minX(),this.maxX()];return this.parents.length!==0&&(v=this.parents),v},moveTo:function(v){var N=[],G;return this.points.length>0&&!this.evalVisProp("fixed")?(G=this.points[0],v.length===3?N=[v[0]-G.usrCoords[0],v[1]-G.usrCoords[1],v[2]-G.usrCoords[2]]:N=[v[0]-G.usrCoords[1],v[1]-G.usrCoords[2]],this.setPosition(Const.COORDS_BY_USER,N),this.board.update(this)):this},getTransformationSource:function(){var v,N;return JXG$1.exists(this._transformationSource)&&(N=this._transformationSource,N.elementClass===Const.OBJECT_CLASS_CURVE&&(v=!0)),[v,N]}});JXG$1.createCurve=function(v,N,G){var z,q,Y=JXG$1.copyAttributes(G,v.options,"curve");return z=v.select(N[0],!0),JXG$1.isTransformationOrArray(N[1])&&JXG$1.isObject(z)&&(z.type===Const.OBJECT_TYPE_CURVE||z.type===Const.OBJECT_TYPE_ANGLE||z.type===Const.OBJECT_TYPE_ARC||z.type===Const.OBJECT_TYPE_CONIC||z.type===Const.OBJECT_TYPE_SECTOR)?(z.type===Const.OBJECT_TYPE_SECTOR?Y=JXG$1.copyAttributes(G,v.options,"sector"):z.type===Const.OBJECT_TYPE_ARC?Y=JXG$1.copyAttributes(G,v.options,"arc"):z.type===Const.OBJECT_TYPE_ANGLE?(JXG$1.exists(G.withLabel)||(G.withLabel=!1),Y=JXG$1.copyAttributes(G,v.options,"angle")):Y=JXG$1.copyAttributes(G,v.options,"curve"),Y=JXG$1.copyAttributes(Y,v.options,"curve"),q=new JXG$1.Curve(v,["x",[],[]],Y),q.updateDataArray=function(){var W,ie=z.numberPoints;for(this.bezierDegree=z.bezierDegree,this.dataX=[],this.dataY=[],W=0;W<ie;W++)this.dataX.push(z.points[W].usrCoords[1]),this.dataY.push(z.points[W].usrCoords[2]);return this},q.addTransform(N[1]),z.addChild(q),q.setParents([z]),q._transformationSource=z,q):(Y=JXG$1.copyAttributes(G,v.options,"curve"),new JXG$1.Curve(v,["x"].concat(N),Y))};JXG$1.registerElement("curve",JXG$1.createCurve);JXG$1.createFunctiongraph=function(v,N,G){var z,q=["x","x"].concat(N);return z=JXG$1.copyAttributes(G,v.options,"functiongraph"),z=JXG$1.copyAttributes(z,v.options,"curve"),z.curvetype="functiongraph",new JXG$1.Curve(v,q,z)};JXG$1.registerElement("functiongraph",JXG$1.createFunctiongraph);JXG$1.registerElement("plot",JXG$1.createFunctiongraph);JXG$1.createSpline=function(v,N,G){var z,q,Y;return q=function(){var W,ie=[],ne=[];return[function(se,ae){var ce,pe,ge;if(!ae){if(ie=[],ne=[],N.length===2&&JXG$1.isArray(N[0])&&JXG$1.isArray(N[1])&&N[0].length===N[1].length)for(ce=0;ce<N[0].length;ce++)JXG$1.isFunction(N[0][ce])?ie.push(N[0][ce]()):ie.push(N[0][ce]),JXG$1.isFunction(N[1][ce])?ne.push(N[1][ce]()):ne.push(N[1][ce]);else for(ce=0;ce<N.length;ce++)if(JXG$1.isPoint(N[ce]))ie.push(N[ce].X()),ne.push(N[ce].Y());else if(JXG$1.isArray(N[ce])&&N[ce].length===2)for(pe=0;pe<N.length;pe++)JXG$1.isFunction(N[pe][0])?ie.push(N[pe][0]()):ie.push(N[pe][0]),JXG$1.isFunction(N[pe][1])?ne.push(N[pe][1]()):ne.push(N[pe][1]);else JXG$1.isFunction(N[ce])&&N[ce]().length===2&&(ge=N[ce](),ie.push(ge[0]),ne.push(ge[1]));W=Numerics.splineDef(ie,ne)}return Numerics.splineEval(se,ie,ne,W)},function(){return ie[0]},function(){return ie[ie.length-1]}]},G=JXG$1.copyAttributes(G,v.options,"curve"),G.curvetype="functiongraph",Y=q(),z=new JXG$1.Curve(v,["x","x",Y[0],Y[1],Y[2]],G),z.setParents(N),z.elType="spline",z};JXG$1.registerElement("spline",JXG$1.createSpline);JXG$1.createCardinalSpline=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge=`
169Possible parent types: [points:array, tau:number|function, type:string]`;if(!JXG$1.exists(N[0])||!JXG$1.isArray(N[0]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 1 'points' has to be array of points or coordinate pairs"+ge);if(!JXG$1.exists(N[1])||!JXG$1.isNumber(N[1])&&!JXG$1.isFunction(N[1]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 2 'tau' has to be number between [0,1] or function'"+ge);if(!JXG$1.exists(N[2])||!JXG$1.isString(N[2])?ie="uniform":ie=N[2],G=JXG$1.copyAttributes(G,v.options,"curve"),G=JXG$1.copyAttributes(G,v.options,"cardinalspline"),G.curvetype="parameter",ne=N[0],se=[],!G.isarrayofcoordinates&&ne.length===2&&JXG$1.isArray(ne[0])&&JXG$1.isArray(ne[1])&&ne[0].length===ne[1].length)for(ae=0;ae<ne[0].length;ae++)se[ae]=[],JXG$1.isFunction(ne[0][ae])?se[ae].push(ne[0][ae]()):se[ae].push(ne[0][ae]),JXG$1.isFunction(ne[1][ae])?se[ae].push(ne[1][ae]()):se[ae].push(ne[1][ae]);else for(ae=0;ae<ne.length;ae++)JXG$1.isString(ne[ae])?se.push(v.select(ne[ae])):JXG$1.isPoint(ne[ae])?se.push(ne[ae]):JXG$1.isArray(ne[ae])&&ne[ae].length===2?(se[ae]=[],JXG$1.isFunction(ne[ae][0])?se[ae].push(ne[ae][0]()):se[ae].push(ne[ae][0]),JXG$1.isFunction(ne[ae][1])?se[ae].push(ne[ae][1]()):se[ae].push(ne[ae][1])):JXG$1.isFunction(ne[ae])&&ne[ae]().length===2&&se.push(N[ae]());if(G.createpoints===!0)Y=JXG$1.providePoints(v,se,G,"cardinalspline",["points"]);else for(Y=[],q=function(ve){return{X:function(){return se[ve][0]},Y:function(){return se[ve][1]},Dist:function(be){var Ee=this.X()-be.X(),Pe=this.Y()-be.Y();return Mat.hypot(Ee,Pe)}}},ae=0;ae<se.length;
169ae++)JXG$1.isPoint(se[ae])?Y.push(se[ae]):Y.push(q(ae));for(W=N[1],pe=["x"].concat(Numerics.CardinalSpline(Y,W,ie)),z=new JXG$1.Curve(v,pe,G),ce=Y.length,z.setParents(Y),ae=0;ae<ce;ae++)ne=Y[ae],JXG$1.isPoint(ne)&&(JXG$1.exists(ne._is_new)?(z.addChild(ne),delete ne._is_new):ne.addChild(z));return z.elType="cardinalspline",z};JXG$1.registerElement("cardinalspline",JXG$1.createCardinalSpline);JXG$1.createMetapostSpline=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce=`
170Possible parent types: [points:array, controls:object`;if(!JXG$1.exists(N[0])||!JXG$1.isArray(N[0]))throw new Error("JSXGraph: JXG.createMetapostSpline: argument 1 'points' has to be array of points or coordinate pairs"+ce);if(!JXG$1.exists(N[1])||!JXG$1.isObject(N[1]))throw new Error("JSXGraph: JXG.createMetapostSpline: argument 2 'controls' has to be a JavaScript object'"+ce);if(G=JXG$1.copyAttributes(G,v.options,"curve"),G=JXG$1.copyAttributes(G,v.options,"metapostspline"),G.curvetype="parameter",ie=N[0],ne=[],!G.isarrayofcoordinates&&ie.length===2&&JXG$1.isArray(ie[0])&&JXG$1.isArray(ie[1])&&ie[0].length===ie[1].length)for(se=0;se<ie[0].length;se++)ne[se]=[],JXG$1.isFunction(ie[0][se])?ne[se].push(ie[0][se]()):ne[se].push(ie[0][se]),JXG$1.isFunction(ie[1][se])?ne[se].push(ie[1][se]()):ne[se].push(ie[1][se]);else for(se=0;se<ie.length;se++)JXG$1.isString(ie[se])?ne.push(v.select(ie[se])):JXG$1.isPoint(ie[se])?ne.push(ie[se]):JXG$1.isArray(ie[se])&&ie[se].length===2?(ne[se]=[],JXG$1.isFunction(ie[se][0])?ne[se].push(ie[se][0]()):ne[se].push(ie[se][0]),JXG$1.isFunction(ie[se][1])?ne[se].push(ie[se][1]()):ne[se].push(ie[se][1])):JXG$1.isFunction(ie[se])&&ie[se]().length===2&&ne.push(N[se]());if(G.createpoints===!0)Y=JXG$1.providePoints(v,ne,G,"metapostspline",["points"]);else for(Y=[],q=function(pe){return{X:function(){return ne[pe][0]},Y:function(){return ne[pe][1]}}},se=0;se<ne.length;se++)JXG$1.isPoint(ne[se])?Y.push(ne[se]):Y.push(q);for(W=N[1],z=new JXG$1.Curve(v,["t",[],[],0,ie.length-1],G),z.updateDataArray=function(){var pe,ge,ve=Y.length,be=[];for(ge=0;ge<ve;ge++)be.push([Y[ge].X(),Y[ge].Y()]);pe=Metapost.curve(be,W),this.dataX=pe[0],this.dataY=pe[1]},z.bezierDegree=3,ae=Y.length,z.setParents(Y),se=0;se<ae;se++)JXG$1.isPoint(Y[se])&&Y[se].addChild(z);return z.elType="metapostspline",z};JXG$1.registerElement("metapostspline",JXG$1.createMetapostSpline);JXG$1.createRiemannsum=function(v,N,G){var z,q,Y,W,ie,ne;if(ne=JXG$1.copyAttributes(G,v.options,"riemannsum"),ne.curvetype="plot",Y=N[0],z=JXG$1.createFunction(N[1],v,""),!JXG$1.exists(z))throw new Error(`JSXGraph: JXG.createRiemannsum: argument '2' n has to be number or function.
171Possible parent types: [function,n:number|function,type,start:number|function,end:number|function]`);if(typeof N[2]=="string"&&(N[2]="'"+N[2]+"'"),q=JXG$1.createFunction(N[2],v,""),!JXG$1.exists(q))throw new Error(`JSXGraph: JXG.createRiemannsum: argument 3 'type' has to be string or function.
172Possible parent types: [function,n:number|function,type,start:number|function,end:number|function]`);return W=[[0],[0]].concat(N.slice(3)),ie=v.create("curve",W,ne),ie.sum=0,ie.Value=function(){return this.sum},ie.updateDataArray=function(){var se=Numerics.riemann(Y,z(),q(),this.minX(),this.maxX());this.dataX=se[0],this.dataY=se[1],this.sum=se[2]},ie.addParentsFromJCFunctions([z,q]),ie};JXG$1.registerElement("riemannsum",JXG$1.createRiemannsum);JXG$1.createTracecurve=function(v,N,G){var z,q,Y,W;if(N.length!==2)throw new Error(`JSXGraph: Can't create trace curve with given parent'
173Possible parent types: [glider, point]`);if(q=v.select(N[0]),Y=v.select(N[1]),q.type!==Const.OBJECT_TYPE_GLIDER||!JXG$1.isPoint(Y))throw new Error("JSXGraph: Can't create trace curve with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
174Possible parent types: [glider, point]`);return W=JXG$1.copyAttributes(G,v.options,"tracecurve"),W.curvetype="plot",z=v.create("curve",[[0],[0]],W),z.updateDataArray=function(){var ie,ne,se,ae,ce,pe,ge,ve,be,Ee=this.visProp.numberpoints,Pe=q.position,Je=q.slideObject,Ce=Je.minX(),Ve=Je.maxX();for(ne=(Ve-Ce)/Ee,this.dataX=[],this.dataY=[],Je.elementClass!==Const.OBJECT_CLASS_CURVE&&Ee++,ie=0;ie<Ee;ie++){se=Ce+ie*ne,pe=Je.X(se)/Je.Z(se),ge=Je.Y(se)/Je.Z(se),q.setPositionDirectly(Const.COORDS_BY_USER,[pe,ge]),ve=!1;for(ae in this.board.objects)if(this.board.objects.hasOwnProperty(ae)&&(ce=this.board.objects[ae],ce===q&&(ve=!0),ve&&ce.needsRegularUpdate&&(be=ce.visProp.trace,ce.visProp.trace=!1,ce.needsUpdate=!0,ce.update(!0),ce.visProp.trace=be,ce===Y)))break;this.dataX[ie]=Y.X(),this.dataY[ie]=Y.Y()}q.position=Pe,ve=!1;for(ae in this.board.objects)if(this.board.objects.hasOwnProperty(ae)&&(ce=this.board.objects[ae],ce===q&&(ve=!0),ve&&ce.needsRegularUpdate&&(be=ce.visProp.trace,ce.visProp.trace=!1,ce.needsUpdate=!0,ce.update(!0),ce.visProp.trace=be,ce===Y)))break},z};JXG$1.registerElement("tracecurve",JXG$1.createTracecurve);JXG$1.createStepfunction=function(v,N,G){var z,q;if(N.length!==2)throw new Error(`JSXGraph: Can't create step function with given parent'
175Possible parent types: [array, array|function]`);return q=JXG$1.copyAttributes(G,v.options,"stepfunction"),z=v.create("curve",N,q),z.updateDataArray=function(){var Y,W=0,ie=this.xterm.length;if(this.dataX=[],this.dataY=[],ie!==0)for(this.dataX[W]=this.xterm[0],this.dataY[W]=this.yterm[0],++W,Y=1;Y<ie;++Y)this.dataX[W]=this.xterm[Y],this.dataY[W]=this.dataY[W-1],++W,this.dataX[W]=this.xterm[Y],this.dataY[W]=this.yterm[Y],++W},z};JXG$1.registerElement("stepfunction",JXG$1.createStepfunction);JXG$1.createDerivative=function(v,N,G){var z,q,Y,W,ie;if(N.length!==1&&N[0].class!==Const.OBJECT_CLASS_CURVE)throw new Error(`JSXGraph: Can't create derivative curve with given parent'
176Possible parent types: [curve]`);return ie=JXG$1.copyAttributes(G,v.options,"curve"),q=N[0],Y=Numerics.D(q.X),W=Numerics.D(q.Y),z=v.create("curve",[function(ne){return q.X(ne)},function(ne){return W(ne)/Y(ne)},q.minX(),q.maxX()],ie),z.setParents(q),z};JXG$1.registerElement("derivative",JXG$1.createDerivative);JXG$1.createCurveIntersection=function(v,N,G){var z;if(N.length!==2)throw new Error(`JSXGraph: Can't create curve intersection with given parent'
177Possible parent types: [array, array|function]`);return z=v.create("curve",[[],[]],G),z.updateDataArray=function(){var q=Clip.intersection(N[0],N[1],this.board);this.dataX=q[0],this.dataY=q[1]},z};JXG$1.createCurveUnion=function(v,N,G){var z;if(N.length!==2)throw new Error(`JSXGraph: Can't create curve union with given parent'
178Possible parent types: [array, array|function]`);return z=v.create("curve",[[],[]],G),z.updateDataArray=function(){var q=Clip.union(N[0],N[1],this.board);this.dataX=q[0],this.dataY=q[1]},z};JXG$1.createCurveDifference=function(v,N,G){var z;if(N.length!==2)throw new Error(`JSXGraph: Can't create curve difference with given parent'
179Possible parent types: [array, array|function]`);return z=v.create("curve",[[],[]],G),z.updateDataArray=function(){var q=Clip.difference(N[0],N[1],this.board);this.dataX=q[0],this.dataY=q[1]},z};JXG$1.registerElement("curvedifference",JXG$1.createCurveDifference);JXG$1.registerElement("curveintersection",JXG$1.createCurveIntersection);JXG$1.registerElement("curveunion",JXG$1.createCurveUnion);JXG$1.createBoxPlot=function(v,N,G){var z,q,Y,W=JXG$1.copyAttributes(G,v.options,"boxplot");if(N.length!==3)throw new Error(`JSXGraph: Can't create box plot with given parent'
180Possible parent types: [array, number|function, number|function] containing quantiles, axis, width`);if(N[0].length<5)throw new Error(`JSXGraph: Can't create box plot with given parent[0]'
181parent[0] has to contain at least 5 quantiles.`);for(z=v.create("curve",[[],[]],W),Y=N[0].length,z.Q=[],q=0;q<Y;q++)z.Q[q]=JXG$1.createFunction(N[0][q],v);return z.x=JXG$1.createFunction(N[1],v),z.w=JXG$1.createFunction(N[2],v),z.updateDataArray=function(){var ie,ne,se,ae,ce,pe,ge,ve,be;ge=this.evalVisProp("smallwidth"),ve=this.evalVisProp("dir"),be=this.x(),se=be-this.w()*.5,ae=be-this.w()*.5*ge,ce=be+this.w()*.5,pe=be+this.w()*.5*ge,ie=[be,ae,pe,be,be,se,se,ce,ce,be,NaN,se,ce,NaN,be,be,ae,pe,be],ne=[this.Q[0](),this.Q[0](),this.Q[0](),this.Q[0](),this.Q[1](),this.Q[1](),this.Q[3](),this.Q[3](),this.Q[1](),this.Q[1](),NaN,this.Q[2](),this.Q[2](),NaN,this.Q[3](),this.Q[4](),this.Q[4](),this.Q[4](),this.Q[4]()],ve==="vertical"?(this.dataX=ie,this.dataY=ne):(this.dataX=ne,this.dataY=ie)},z.addParentsFromJCFunctions([z.Q,z.x,z.w]),z};JXG$1.registerElement("boxplot",JXG$1.createBoxPlot);JXG$1.createImplicitCurve=function(v,N,G){var z,q;if([1,3,5].indexOf(N.length)<0)throw new Error(`JSXGraph: Can't create curve implicitCurve with given parent'
182Possible parent types: [f], [f, rangex, rangey], [f, dfx, dfy] or [f, dfx, dfy, rangex, rangey]
183with functions f, dfx, dfy and arrays of length 2 rangex, rangey.`);return q=JXG$1.copyAttributes(G,v.options,"implicitcurve"),z=v.create("curve",[[],[]],q),z.f=JXG$1.createFunction(N[0],v,"x, y"),N.length===5||JXG$1.isString(N[1])||JXG$1.isFunction(N[1])?z.dfx=JXG$1.createFunction(N[1],v,"x, y"):z.dfx=null,N.length===5||JXG$1.isString(N[2])||JXG$1.isFunction(N[2])?z.dfy=JXG$1.createFunction(N[2],v,"x, y"):z.dfy=null,z.domain=null,N.length===5?z.domain=[N[3],N[4]]:N.length===3&&(z.domain=[N[1],N[2]]),z.updateDataArray=function(){var Y,W,ie,ne,se,ae=[],ce;this.domain===null?(ce=this.evalVisProp("margin"),Y=this.board.getBoundingBox(),Y[0]-=ce,Y[1]+=ce,Y[2]+=ce,Y[3]-=ce):(W=JXG$1.evaluate(this.domain[0]),ie=JXG$1.evaluate(this.domain[1]),Y=[W[0],ie[1],W[1],ie[0]]),se={resolution_out:Math.max(.01,this.evalVisProp("resolution_outer")),resolution_in:Math.max(.01,this.evalVisProp("resolution_inner")),max_steps:this.evalVisProp("max_steps"),alpha_0:this.evalVisProp("alpha_0"),tol_u0:this.evalVisProp("tol_u0"),tol_newton:this.evalVisProp("tol_newton"),tol_cusp:this.evalVisProp("tol_cusp"),tol_progress:this.evalVisProp("tol_progress"),qdt_box:this.evalVisProp("qdt_box"),kappa_0:this.evalVisProp("kappa_0"),delta_0:this.evalVisProp("delta_0"),h_initial:this.evalVisProp("h_initial"),h_critical:this.evalVisProp("h_critical"),h_max:this.evalVisProp("h_max"),loop_dist:this.evalVisProp("loop_dist"),loop_dir:this.evalVisProp("loop_dir"),loop_detection:this.evalVisProp("loop_detection"),unitX:this.board.unitX,unitY:this.board.unitY},this.dataX=[],this.dataY=[],ne=new ImplicitPlot(Y,se,this.f,this.dfx,this.dfy),this.qdt=ne.qdt,ae=ne.plot(),this.dataX=ae[0],this.dataY=ae[1]},z.elType="implicitcurve",z};JXG$1.registerElement("implicitcurve",JXG$1.createImplicitCurve);JXG$1.Curve;JXG$1.createArc=function(v,N,G){var z,q,Y;if(Y=JXG$1.providePoints(v,N,G,"arc",["center","radiuspoint","anglepoint"]),Y===!1||Y.length<3)throw new Error("JSXGraph: Can't create Arc with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+`'.
184Possible parent types: [point,point,point], [arc, transformation]`);return q=JXG$1.copyAttributes(G,v.options,"arc"),z=v.create("curve",[[0],[0],0,4],q),z.elType="arc",z.setParents(Y),z.type=Const.OBJECT_TYPE_ARC,z.center=Y[0],z.radiu
184spoint=Y[1],z.point2=z.radiuspoint,z.anglepoint=Y[2],z.point3=z.anglepoint,JXG$1.exists(z.center._is_new)?(z.addChild(z.center),delete z.center._is_new):z.center.addChild(z),JXG$1.exists(z.radiuspoint._is_new)?(z.addChild(z.radiuspoint),delete z.radiuspoint._is_new):z.radiuspoint.addChild(z),JXG$1.exists(z.anglepoint._is_new)?(z.addChild(z.anglepoint),delete z.anglepoint._is_new):z.anglepoint.addChild(z),z.useDirection=q.usedirection,z.updateDataArray=function(){var W,ie,ne,se,ae,ce,pe=1,ge=this.radiuspoint,ve=this.center,be=this.anglepoint,Ee=this.evalVisProp("selection");ie=Geometry.rad(ge,ve,be),(Ee==="minor"&&ie>Math.PI||Ee==="major"&&ie<Math.PI)&&(pe=-1),this.useDirection&&(se=Y[1].coords.usrCoords,ae=Y[3].coords.usrCoords,ce=Y[2].coords.usrCoords,ne=(se[1]-ce[1])*(se[2]-ae[2])-(se[2]-ce[2])*(se[1]-ae[1]),ne<0?(this.radiuspoint=Y[1],this.anglepoint=Y[2]):(this.radiuspoint=Y[2],this.anglepoint=Y[1])),ge=ge.coords.usrCoords,ve=ve.coords.usrCoords,be=be.coords.usrCoords,W=Geometry.bezierArc(ge,ve,be,!1,pe),this.dataX=W[0],this.dataY=W[1],this.bezierDegree=3,this.updateStdform(),this.updateQuadraticform()},z.Radius=function(){return this.radiuspoint.Dist(this.center)},z.getRadius=function(){return JXG$1.deprecated("Arc.getRadius()","Arc.Radius()"),this.Radius()},z.Value=function(W,ie){var ne;return ie=ie||Geometry.rad(this.radiuspoint,this.center,this.anglepoint),W=W||"length",W=W.toLocaleLowerCase(),W===""||W.indexOf("len")===0?ne=ie*this.Radius():W.indexOf("rad")===0?ne=ie:W.indexOf("deg")===0?ne=ie*180/Math.PI:W.indexOf("sem")===0?ne=ie/Math.PI:W.indexOf("cir")===0&&(ne=ie*.5/Math.PI),ne},z.L=function(){return this.Value("length")},z.hasPoint=function(W,ie){var ne,se,ae,ce,pe,ge,ve,be=this.Radius();return this.evalVisProp("hasinnerpoints")?this.hasPointSector(W,ie):(JXG$1.isObject(this.evalVisProp("precision"))?(ve=this.board._inputDevice,ge=this.evalVisProp("precision."+ve)):ge=this.board.options.precision.hasPoint,ge/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),se=new Coords(Const.COORDS_BY_SCREEN,[W,ie],this.board),this.transformations.length>0&&(this.updateTransformMatrix(),ce=Mat.inverse(this.transformMat),pe=Mat.matVecMult(ce,se.usrCoords),se=new Coords(Const.COORDS_BY_USER,pe,this.board)),ne=this.center.coords.distance(Const.COORDS_BY_USER,se),ae=Math.abs(ne-be)<ge,ae&&(ae=Geometry.coordsOnArc(this,se)),ae)},z.hasPointSector=function(W,ie){var ne=new Coords(Const.COORDS_BY_SCREEN,[W,ie],this.board),se=this.Radius(),ae=this.center.coords.distance(Const.COORDS_BY_USER,ne),ce=ae<se;return ce&&(ce=Geometry.coordsOnArc(this,ne)),ce},z.getTextAnchor=function(){return this.center.coords},z.getLabelAnchor=function(){var W,ie,ne,se,ae,ce=this.label.evalVisProp("position"),pe=Geometry.rad(this.radiuspoint,this.center,this.anglepoint),ge=10/this.board.unitX,ve=10/this.board.unitY,be=this.point2.coords.usrCoords,Ee=this.center.coords.usrCoords,Pe=be[1]-Ee[1],Je=be[2]-Ee[2],Ce=this.evalVisProp("selection"),Ve=this.label?this.label.visProp:this.visProp.label;return!JXG$1.isString(ce)||ce.indexOf("right")<0&&ce.indexOf("left")<0?((Ce==="minor"&&pe>Math.PI||Ce==="major"&&pe<Math.PI)&&(pe=-(2*Math.PI-pe)),W=new Coords(Const.COORDS_BY_USER,[Ee[1]+Math.cos(pe*.5)*Pe-Math.sin(pe*.5)*Je,Ee[2]+Math.sin(pe*.5)*Pe+Math.cos(pe*.5)*Je],this.board),ne=W.usrCoords[1]-Ee[1],se=W.usrCoords[2]-Ee[2],ae=Mat.hypot(ne,se),ne=ne*(ae+ge)/ae,se=se*(ae+ve)/ae,ie=[Ee[1]+ne,Ee[2]+se],Ve.position=Geometry.calcLabelQuadrant(Geometry.rad([1,0],[0,0],ie)),new Coords(Const.COORDS_BY_USER,ie,this.board)):this.getLabelPosition(ce,this.label.evalVisProp("distance"))},z.updateQuadraticform=Circle.prototype.updateQuadraticform,z.updateStdform=Circle.prototype.updateStdform,z.methodMap=JXG$1.deepCopy(z.methodMap,{getRadius:"getRadius",radius:"Radius",Radius:"Radius",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint",Value:"Value",L:"L"}),z.prepareUpdate().update(),z};JXG$1.registerElement("arc",JXG$1.createArc);JXG$1.createSemicircle=function(v,N,G){var z,q,Y,W;if(W=JXG$1.providePoints(v,N,G,"point"),W===!1||W.length!==2)throw new Error("JSXGraph: Can't create Semicircle with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
185Possible parent types: [point,point]`);return Y=JXG$1.copyAttributes(G,v.options,"semicircle","center"),q=v.create("midpoint",W,Y),q.dump=!1,Y=JXG$1.copyAttributes(G,v.options,"semicircle"),z=v.create("arc",[q,W[1],W[0]],Y),z.elType="semicircle",z.setParents([W[0].id,W[1].id]),z.subs={midpoint:q},z.inherits.push(q),z.midpoint=z.center=q,z};JXG$1.registerElement("semicircle",JXG$1.createSemicircle);JXG$1.createCircumcircleArc=function(v,N,G){var z,q,Y,W;if(W=JXG$1.providePoints(v,N,G,"point"),W===!1||W.length!==3)throw new Error("JSXGraph: create Circumcircle Arc with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+`'.
186Possible parent types: [point,point,point]`);
186return Y=JXG$1.copyAttributes(G,v.options,"circumcirclearc","center"),q=v.create("circumcenter",W,Y),q.dump=!1,Y=JXG$1.copyAttributes(G,v.options,"circumcirclearc"),Y.usedirection=!0,z=v.create("arc",[q,W[0],W[2],W[1]],Y),z.elType="circumcirclearc",z.setParents([W[0].id,W[1].id,W[2].id]),z.subs={center:q},z.inherits.push(q),z.center=q,z};JXG$1.registerElement("circumcirclearc",JXG$1.createCircumcircleArc);JXG$1.createMinorArc=function(v,N,G){return G.selection="minor",JXG$1.createArc(v,N,G)};JXG$1.registerElement("minorarc",JXG$1.createMinorArc);JXG$1.createMajorArc=function(v,N,G){return G.selection="major",JXG$1.createArc(v,N,G)};JXG$1.registerElement("majorarc",JXG$1.createMajorArc);JXG$1.createSector=function(v,N,G){var z,q,Y,W=1e-14,ie="invalid",ne,se,ae=["center","radiusPoint","anglePoint"],ce;if(N[0].elementClass===Const.OBJECT_CLASS_LINE&&N[1].elementClass===Const.OBJECT_CLASS_LINE&&(JXG$1.isArray(N[2])||JXG$1.isNumber(N[2]))&&(JXG$1.isArray(N[3])||JXG$1.isNumber(N[3]))&&(JXG$1.isNumber(N[4])||JXG$1.isFunction(N[4])||JXG$1.isString(N[4])))ie="2lines";else{if(ce=JXG$1.providePoints(v,N,G,"sector",ae),ce===!1)throw new Error("JSXGraph: Can't create Sector with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+"'.");ie="3points"}if(q=JXG$1.copyAttributes(G,v.options,"sector"),z=v.create("curve",[[0],[0],0,6],q),z.type=Const.OBJECT_TYPE_SECTOR,z.elType="sector",z.autoRadius=function(){var pe=20/z.board.unitX,ge=1/0,ve=50/z.board.unitX;return JXG$1.isPoint(z.center)&&(ge=z.center.Dist(z.point2)*.3333),Math.max(pe,Math.min(ge,ve))},ie==="2lines")z.Radius=function(){var pe=JXG$1.evaluate(N[4]);return pe==="auto"?this.autoRadius():pe},z.line1=v.select(N[0]),z.line2=v.select(N[1]),z.line1.addChild(z),z.line2.addChild(z),z.setParents(N),z.point1={visProp:{}},z.point2={visProp:{}},z.point3={visProp:{}},ne=Geometry.meetLineLine(z.line1.stdform,z.line2.stdform,0,v),Geometry.distance(ne.usrCoords,[0,0,0],3)<W&&(z.line1.point1.Dist(z.line2.point1)<W||z.line1.point1.Dist(z.line2.point2)<W?ne=z.line1.point1.coords:z.line1.point2.Dist(z.line2.point1)<W||z.line1.point2.Dist(z.line2.point1)<W?ne=z.line1.point2.coords:console.log("JSXGraph warning: Can't create Sector from parallel lines with no common defining point.")),JXG$1.isArray(N[2])?(N[2].length===2&&(N[2]=[1].concat(N[2])),se=Geometry.projectPointToLine({coords:{usrCoords:N[2]}},z.line1,v),se=Stat.subtract(se.usrCoords,ne.usrCoords),z.direction1=Mat.innerProduct(se,[0,z.line1.stdform[2],-z.line1.stdform[1]],3)>=0?1:-1):z.direction1=N[2]>=0?1:-1,JXG$1.isArray(N[3])?(N[3].length===2&&(N[3]=[1].concat(N[3])),se=Geometry.projectPointToLine({coords:{usrCoords:N[3]}},z.line2,v),se=Stat.subtract(se.usrCoords,ne.usrCoords),z.direction2=Mat.innerProduct(se,[0,z.line2.stdform[2],-z.line2.stdform[1]],3)>=0?1:-1):z.direction2=N[3]>=0?1:-1,z.methodMap=JXG$1.deepCopy(z.methodMap,{arc:"arc",center:"center",line1:"line1",line2:"line2"}),z.updateDataArray=function(){var pe,ge,ve,be=1e-14,Ee=[0,0,0],Pe=[0,0,0],Je=[0,0,0],Ce;if(ge=this.line1,ve=this.line2,Pe=Mat.crossProduct(ge.stdform,ve.stdform),Geometry.distance(Pe,[0,0,0],3)<be&&(ge.point1.Dist(ve.point1)<be||ge.point1.Dist(ve.point2)<be?Pe=ge.point1.coords.usrCoords:(ge.point2.Dist(ve.point1)<be||ge.point2.Dist(ve.point1)<be)&&(Pe=ge.point2.coords.usrCoords)),Math.abs(Pe[0])>be&&(Pe[1]/=Pe[0],Pe[2]/=Pe[0],Pe[0]/=Pe[0]),pe=this.direction1*this.Radius(),Ee=Stat.add(Pe,[0,pe*ge.stdform[2],-pe*ge.stdform[1]]),pe=this.direction2*this.Radius(),Je=Stat.add(Pe,[0,pe*ve.stdform[2],-pe*ve.stdform[1]]),this.point2.coords=new Coords(Const.COORDS_BY_USER,Ee,z.board),this.point1.coords=new Coords(Const.COORDS_BY_USER,Pe,z.board),this.point3.coords=new Coords(Const.COORDS_BY_USER,Je,z.board),Math.abs(Ee[0])<Mat.eps||Math.abs(Pe[0])<Mat.eps||Math.abs(Je[0])<Mat.eps){this.dataX=[NaN],this.dataY=[NaN];return}Ce=Geometry.bezierArc(Ee,Pe,Je,!0,1),this.dataX=Ce[0],this.dataY=Ce[1],this.bezierDegree=3};else if(ie==="3points"){for(z.point1=ce[0],z.point2=ce[1],z.point3=ce[2],Y=0;Y<3;Y++)JXG$1.exists(ce[Y]._is_new)?(z.addChild(ce[Y]),delete ce[Y]._is_new):ce[Y].addChild(z);z.useDirection=G.usedirection,z.setParents(ce),JXG$1.exists(ce[3])&&(z.point4=ce[3],z.point4.addChild(z)),z.methodMap=JXG$1.deepCopy(z.methodMap,{arc:"arc",center:"center",radiu
186spoint:"radiuspoint",anglepoint:"anglepoint"}),z.updateDataArray=function(){var pe,ge,ve,be,Ee,Pe=this.point2,Je=this.point1,Ce=this.point3,Ve,Re=1,qe=this.evalVisProp("selection");if(!Pe.isReal||!Je.isReal||!Ce.isReal){this.dataX=[NaN],this.dataY=[NaN];return}Ve=Geometry.rad(Pe,Je,Ce),(qe==="minor"&&Ve>Math.PI||qe==="major"&&Ve<Math.PI)&&(Re=-1),this.useDirection&&JXG$1.exists(this.point4)&&(ve=this.point2.coords.usrCoords,be=this.point4.coords.usrCoords,Ee=this.point3.coords.usrCoords,ge=(ve[1]-Ee[1])*(ve[2]-be[2])-(ve[2]-Ee[2])*(ve[1]-be[1]),ge>=0&&(Ce=this.point2,Pe=this.point3)),Pe=Pe.coords.usrCoords,Je=Je.coords.usrCoords,Ce=Ce.coords.usrCoords,pe=Geometry.bezierArc(Pe,Je,Ce,!0,Re),this.dataX=pe[0],this.dataY=pe[1],this.bezierDegree=3},z.Radius=function(){return this.point2.Dist(this.point1)}}return z.center=z.point1,z.radiuspoint=z.point2,z.anglepoint=z.point3,q=JXG$1.copyAttributes(G,v.options,"arc"),q=JXG$1.copyAttributes(q,v.options,"sector","arc"),q.withlabel=!1,q.selection=z.visProp.selection,q.name+="_arc",ie==="2lines"?(z.updateDataArray(),z.arc=v.create("arc",[function(){return z.point1.coords.usrCoords},function(){var pe=z.point2.coords.distance(Const.COORDS_BY_USER,z.point1.coords);return pe===0?[z.point1.coords.usrCoords[1],z.point1.coords.usrCoords[2]]:[z.point1.coords.usrCoords[1]+z.Radius()*(z.point2.coords.usrCoords[1]-z.point1.coords.usrCoords[1])/pe,z.point1.coords.usrCoords[2]+z.Radius()*(z.point2.coords.usrCoords[2]-z.point1.coords.usrCoords[2])/pe]},function(){return z.point3.coords.usrCoords}],q)):z.arc=v.create("arc",[z.point1,function(){var pe=z.point2.Dist(z.point1);return pe===0?[z.point1.X(),z.point1.Y()]:[z.point1.X()+z.Radius()*(z.point2.X()-z.point1.X())/pe,z.point1.Y()+z.Radius()*(z.point2.Y()-z.point1.Y())/pe]},z.point3],q),z.addChild(z.arc),z.hasPointCurve=function(pe,ge){var ve,be,Ee,Pe,Je,Ce=new Coords(Const.COORDS_BY_SCREEN,[pe,ge],this.board),Ve=this.Radius(),Re=this.center.coords.distance(Const.COORDS_BY_USER,Ce),qe,et=this.evalVisProp("selection");return JXG$1.isObject(this.evalVisProp("precision"))?(Je=this.board._inputDevice,Pe=this.evalVisProp("precision."+Je)):Pe=this.board.options.precision.hasPoint,Pe/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),qe=Math.abs(Re-Ve)<Pe,qe&&(ve=Geometry.rad(this.point2,this.center,Ce.usrCoords.slice(1)),be=0,Ee=Geometry.rad(this.point2,this.center,this.point3),(et==="minor"&&Ee>Math.PI||et==="major"&&Ee<Math.PI)&&(be=Ee,Ee=2*Math.PI),(ve<be||ve>Ee)&&(qe=!1)),qe},z.hasPointSector=function(pe,ge){var ve,be=new Coords(Const.COORDS_BY_SCREEN,[pe,ge],this.board),Ee=this.Radius(),Pe=this.point1.coords.distance(Const.COORDS_BY_USER,be),Je,Ce,Ve=Pe<Ee,Re=this.evalVisProp("selection");return Ve&&(ve=Geometry.rad(this.radiuspoint,this.center,be.usrCoords.slice(1)),Je=0,Ce=Geometry.rad(this.radiuspoint,this.center,this.anglepoint),(Re==="minor"&&Ce>Math.PI||Re==="major"&&Ce<Math.PI)&&(Je=Ce,Ce=2*Math.PI),(ve<Je||ve>Ce)&&(Ve=!1)),Ve},z.hasPoint=function(pe,ge){return this.evalVisProp("highlightonsector")||this.evalVisProp("hasinnerpoints")?this.hasPointSector(pe,ge):this.hasPointCurve(pe,ge)},z.getTextAnchor=function(){return this.point1.coords},z.getLabelAnchor=function(){var pe,ge,ve,be,Ee,Pe=this.label.evalVisProp("position"),Je=Geometry.rad(this.point2,this.point1,this.point3),Ce=13/this.board.unitX,Ve=13/this.board.unitY,Re=this.point2.coords.usrCoords,qe=this.point1.coords.usrCoords,et=Re[1]-qe[1],Ze=Re[2]-qe[2],tt=this.evalVisProp("selection"),Ke=this.label?this.label.visProp:this.visProp.label;return!JXG$1.isString(Pe)||Pe.indexOf("right")<0&&Pe.indexOf("left")<0?((tt==="minor"&&Je>Math.PI||tt==="major"&&Je<Math.PI)&&(Je=-(2*Math.PI-Je)),pe=new Coords(Const.COORDS_BY_USER,[qe[1]+Math.cos(Je*.5)*et-Math.sin(Je*.5)*Ze,qe[2]+Math.sin(Je*.5)*et+Math.cos(Je*.5)*Ze],this.board),ve=pe.usrCoords[1]-qe[1],be=pe.usrCoords[2]-qe[2],Ee=Mat.hypot(ve,be),ve=ve*(Ee+Ce)/Ee,be=be*(Ee+Ve)/Ee,ge=[qe[1]+ve,qe[2]+be],Ke.position=Geometry.calcLabelQuadrant(Geometry.rad([1,0],[0,0],ge)),new Coords(Const.COORDS_BY_USER,ge,this.board)):this.getLabelPosition(Pe,this.label.evalVisProp("distance"))},z.setRadius=function(pe){var ge,ve=JXG$1.evaluate(pe);pe==="auto"||ve==="auto"?ge="auto":JXG$1.isNumber(pe)?ge="number":JXG$1.isFunction(pe)&&!JXG$1.isString(ve)?ge="function":ge="undefined",ge!=="undefined"&&(this.visProp.radius=pe),z.Radius=function(){var be=JXG$1.evaluate(pe);return be==="auto"?this.autoRadius():be}},z.getRadius=function(){return JXG$1.deprecated("Sector.getRadius()","Sector.Radius()"),this.Radius()},z.Value=function(pe){return this.arc.Value(pe)},z.L=function(){return this.arc.L()},z.Area=function(){var pe=this.Radius();return .5*pe*pe*this.Value("radians")},z.Perimeter=function(){return this.L()+2*this.Radius()},ie==="3points"&&(z.setPositionDirectly=function(pe,ge,ve){var be,Ee,Pe=new Coords(pe,ge,this.board),Je=new Coords(pe,ve,this.board);return!z.point1.draggable()||!z.point2.draggable()||!z.point3.draggable()?this:(be=Stat.subtract(Pe.usrCoords,Je.usrCoords),Ee=this.board.create("transform",be.slice(1),{type:"translate"}),Ee.applyOnce([z.point1,z.point2,z.point3]),this)}),z.methodMap=JXG$1.deepCopy(z.methodMap,{radius:"Radius",Radius:"Radius",getRadius:"Radius",setRadius:"setRadius",Value:"Value",L:"L",Area:"Area",Perimeter:"Perimeter"}),z};JXG$1.registerElement("sector",JXG$1.createSector);JXG$1.createCircumcircleSector=function(v,N,G){var z,q,Y,W;if(W=JXG$1.providePoints(v,N,G,"point"),W===!1)throw new Error("JSXGraph: Can't create circumcircle sector with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+"'.");return q=v.create("circumcenter",W.slice(0,3),Y),q.dump=!1,Y=JXG$1.copyAttributes(G,v.options,"cir
186cumcirclesector"),z=v.create("sector",[q,W[0],W[2],W[1]],Y),z.elType="circumcirclesector",z.setParents(W),z.center=q,z.subs={center:q},z};JXG$1.registerElement("circumcirclesector",JXG$1.createCircumcircleSector);JXG$1.createMinorSector=function(v,N,G){return G.selection="minor",JXG$1.createSector(v,N,G)};JXG$1.registerElement("minorsector",JXG$1.createMinorSector);JXG$1.createMajorSector=function(v,N,G){return G.selection="major",JXG$1.createSector(v,N,G)};JXG$1.registerElement("majorsector",JXG$1.createMajorSector);JXG$1.createAngle=function(v,N,G){var z,q,Y,W,ie,ne,se="invalid";if(N[0].elementClass===Const.OBJECT_CLASS_LINE&&N[1].elementClass===Const.OBJECT_CLASS_LINE&&(JXG$1.isArray(N[2])||JXG$1.isNumber(N[2]))&&(JXG$1.isArray(N[3])||JXG$1.isNumber(N[3])))se="2lines";else{if(Y={name:""},ne=JXG$1.providePoints(v,N,Y,"point"),ne===!1)throw new Error("JSXGraph: Can't create angle with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"' and '"+typeof N[2]+"'.");se="3points"}if(Y=JXG$1.copyAttributes(G,v.options,"angle"),JXG$1.exists(Y.name)||(Y.name=v.generateName({type:Const.OBJECT_TYPE_ANGLE})),JXG$1.exists(Y.radius)?q=Y.radius:q=0,v.suspendUpdate(),se==="2lines"?(N.push(q),z=v.create("sector",N,Y),z.updateDataArraySector=z.updateDataArray,z.setAngle=function(ae){},z.free=function(ae){}):(z=v.create("sector",[ne[1],ne[0],ne[2]],Y),z.arc.visProp.priv=!0,z.point=z.point2=z.radiuspoint=ne[0],z.pointsquare=z.point3=z.anglepoint=ne[2],z.Radius=function(){var ae=JXG$1.evaluate(q);return ae==="auto"?z.autoRadius():ae},z.updateDataArraySector=function(){var ae=this.point2,ce=this.point1,pe=this.point3,ge=this.Radius(),ve=ce.Dist(ae),be,Ee,Pe=1,Je=this.evalVisProp("selection");Ee=Geometry.rad(ae,ce,pe),(Je==="minor"&&Ee>Math.PI||Je==="major"&&Ee<Math.PI)&&(Pe=-1),ae=ae.coords.usrCoords,ce=ce.coords.usrCoords,pe=pe.coords.usrCoords,ae=[1,ce[1]+(ae[1]-ce[1])*ge/ve,ce[2]+(ae[2]-ce[2])
186*ge/ve],pe=[1,ce[1]+(pe[1]-ce[1])*ge/ve,ce[2]+(pe[2]-ce[2])*ge/ve],be=Geometry.bezierArc(ae,ce,pe,!0,Pe),this.dataX=be[0],this.dataY=be[1],this.bezierDegree=3},z.setAngle=function(ae){var ce,pe,ge,ve=this.anglepoint,be=this.radiuspoint;return ve.draggable()&&(ce=this.board.create("transform",[ae,this.center],{type:"rotate"}),ve.addTransform(be,ce),ce.update(),ve.moveTo(Mat.matVecMult(ce.matrix,be.coords.usrCoords)),JXG$1.isFunction(ae)?ge=function(){return Math.PI*2-ae()}:ge=function(){return Math.PI*2-ae},pe=this.board.create("transform",[ge,this.center],{type:"rotate"}),ve.coords.on("update",function(){pe.update(),be.setPositionDirectly(Const.COORDS_BY_USER,Mat.matVecMult(pe.matrix,ve.coords.usrCoords))}),ve.setParents(be),this.hasFixedAngle=!0),this},z.free=function(){var ae=this.anglepoint;return ae.transformations.length>0&&(ae.transformations.pop(),ae.isDraggable=!0,ae.parents=[],ae.coords.off("update")),this.hasFixedAngle=!1,this},z.setParents(ne)),JXG$1.exists(z.visProp.text)&&z.label.setText(z.evalVisProp("text")),z.elType="angle",z.type=Const.OBJECT_TYPE_ANGLE,z.subs={},z.updateDataArraySquare=function(){var ae,ce,pe,ge,ve,be,Ee,Pe,Je=this.Radius();se==="2lines"&&this.updateDataArraySector(),ae=this.point2,ce=this.point1,pe=this.point3,ae=ae.coords.usrCoords,ce=ce.coords.usrCoords,pe=pe.coords.usrCoords,ge=Geometry.distance(ae,ce,3),ve=Geometry.distance(pe,ce,3),ae=[1,ce[1]+(ae[1]-ce[1])*Je/ge,ce[2]+(ae[2]-ce[2])
186*Je/ge],pe=[1,ce[1]+(pe[1]-ce[1])*Je/ve,ce[2]+(pe[2]-ce[2])*Je/ve],be=Mat.crossProduct(pe,ce),Ee=[-ae[1]*be[1]-ae[2]*be[2],ae[0]*be[1],ae[0]*be[2]],be=Mat.crossProduct(ae,ce),Pe=[-pe[1]*be[1]-pe[2]*be[2],pe[0]*be[1],pe[0]*be[2]],be=Mat.crossProduct(Ee,Pe),be[1]/=be[0],be[2]/=be[0],this.dataX=[ce[1],ae[1],be[1],pe[1],ce[1]],this.dataY=[ce[2],ae[2],be[2],pe[2],ce[2]],this.bezierDegree=1},z.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},z.updateDataArray=function(){var ae=this.evalVisProp("type"),ce=Geometry.trueAngle(this.point2,this.point1,this.point3),pe=this.evalVisProp("selection");(pe==="minor"&&ce>180||pe==="major"&&ce<180)&&(ce=360-ce),Math.abs(ce-90)<this.evalVisProp("orthosensitivity")+Mat.eps&&(ae=this.evalVisProp("orthotype")),ae==="none"?(this.updateDataArrayNone(),this.maxX=function(){return 0}):ae==="square"?(this.updateDataArraySquare(),this.maxX=function(){return 4}):ae==="sector"?(this.updateDataArraySector(),this.maxX=function(){return 6}):ae==="sectordot"&&(this.updateDataArraySector(),this.maxX=function(){return 6},this.dot.visProp.visible||this.dot.setAttribute({visible:!0})),(!this.visProp.visible||ae!=="sectordot"&&this.dot.visProp.visible)&&this.dot.setAttribute({visible:!1})},W=JXG$1.copyAttributes(G,v.options,"angle","dot"),z.dot=v.create("point",[function(){var ae,ce,pe,ge,ve,be,Ee,Pe,Je;return JXG$1.exists(z.dot)&&!z.dot.visProp.visible?[0,0]:(ae=z.point2.coords.usrCoords,ce=z.point1.coords.usrCoords,pe=z.Radius(),ge=Geometry.distance(ae,ce,3),ve=Geometry.rad(z.point2,z.point1,z.point3),Je=z.evalVisProp("selection"),(Je==="minor"&&ve>Math.PI||Je==="major"&&ve<Math.PI)&&(ve=-(2*Math.PI-ve)),ve*=.5,be=Math.cos(ve),Ee=Math.sin(ve),ae=[1,ce[1]+(ae[1]-ce[1])*pe/ge,ce[2]+(ae[2]-ce[2])
186*pe/ge],Pe=[[1,0,0],[ce[1]-.5*ce[1]*be+.5*ce[2]*Ee,be*.5,-Ee*.5],[ce[2]-.5*ce[1]*Ee-.5*ce[2]*be,Ee*.5,be*.5]],Mat.matVecMult(Pe,ae))}],W),z.dot.dump=!1,z.subs.dot=z.dot,se==="2lines")for(ie=0;ie<2;ie++)v.select(N[ie]).addChild(z.dot);else for(ie=0;ie<3;ie++)v.select(ne[ie]).addChild(z.dot);return v.unsuspendUpdate(),z.Value=function(ae){return ae=ae||"radians",ae===""&&(ae="radians"),z.arc.Value(ae)},z.getLabelAnchor=function(){var ae,ce=12,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve=z.evalVisProp("selection"),Re=this.label.evalVisProp("position"),qe=this.label?this.label.visProp:this.visProp.label;return!JXG$1.isString(Re)||Re.indexOf("right")<0&&Re.indexOf("left")<0?(JXG$1.exists(this.label)&&JXG$1.exists(this.label.visProp.fontsize)&&(ce=this.label.evalVisProp("fontsize")),ce/=this.board.unitX,pe=z.point2.coords.usrCoords,ge=z.point1.coords.usrCoords,ve=z.Radius(),be=Geometry.distance(pe,ge,3),Ee=Geometry.rad(z.point2,z.point1,z.point3),(Ve==="minor"&&Ee>Math.PI||Ve==="major"&&Ee<Math.PI)&&(Ee=-(2*Math.PI-Ee)),Ee*=.5,Pe=Math.cos(Ee),Je=Math.sin(Ee),pe=[1,ge[1]+(pe[1]-ge[1])*ve/be,ge[2]+(pe[2]-ge[2])*ve/be],Ce=[[1,0,0],[ge[1]-.5*ge[1]*Pe+.5*ge[2]*Je,Pe*.5,-Je*.5],[ge[2]-.5*ge[1]*Je-.5*ge[2]*Pe,Je*.5,Pe*.5]],ae=Mat.matVecMult(Ce,pe),ae[1]/=ae[0],ae[2]/=ae[0],ae[0]/=ae[0],be=Geometry.distance(ae,ge,3),ae=[ae[0],ge[1]+(ae[1]-ge[1])*(ve+ce)/be,ge[2]+(ae[2]-ge[2])*(ve+ce)/be],qe.position=Geometry.calcLabelQuadrant(Geometry.rad([1,0],[0,0],ae)),new Coords(Const.COORDS_BY_USER,ae,this.board)):this.getLabelPosition(Re,this.label.evalVisProp("distance"))},z.methodMap=JXG$1.deepCopy(z.methodMap,{setAngle:"setAngle",Value:"Value",free:"free"}),z};JXG$1.registerElement("angle",JXG$1.createAngle);JXG$1.createNonreflexAngle=function(v,N,G){var z;return G.selection="minor",G=JXG$1.copyAttributes(G,v.options,"nonreflexangle"),z=JXG$1.createAngle(v,N,G),z.Value=function(q){var Y=Geometry.rad(this.point2,this.point1,this.point3);return q=q||"radians",q===""&&(q="radians"),Y=Y<Math.PI?Y:2*Math.PI-Y,this.arc.Value(q,Y)},z};JXG$1.registerElement("nonreflexangle",JXG$1.createNonreflexAngle);JXG$1.createReflexAngle=function(v,N,G){var z;return G.selection="major",G=JXG$1.copyAttributes(G,v.options,"reflexangle"),z=JXG$1.createAngle(v,N,G),z.Value=function(q){var Y=Geometry.rad(this.point2,this.point1,this.point3);return q=q||"radians",q===""&&(q="radians"),Y=Y>=Math.PI?Y:2*Math.PI-Y,this.arc.Value(q,Y)},z};JXG$1.registerElement("reflexangle",JXG$1.createReflexAngle);JXG$1.createOrthogonalProjection=function(v,N,G){var z,q,Y,W;if(N[0]=v.select(N[0]),N[1]=v.select(N[1]),JXG$1.isPointType(v,N[0])&&N[1].elementClass===Const.OBJECT_CLASS_LINE)q=JXG$1.providePoints(v,[N[0]],G,"point")[0],z=N[1];else if(JXG$1.isPointType(v,N[1])&&N[0].elementClass===Const.OBJECT_CLASS_LINE)q=JXG$1.providePoints(v,[N[1]],G,"point")[0],z=N[0];else throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
187Possible parent types: [point,line]`);return W=JXG$1.copyAttributes(G,v.options,"orthogonalprojection"),Y=v.create("point",[function(){return Geometry.projectPointToLine(q,z,v)}],W),JXG$1.exists(q._is_new)?(Y.addChild(q),delete q._is_new):q.addChild(Y),z.addChild(Y),Y.elType="orthogonalprojection",Y.setParents([q.id,Y.id]),Y.update(),Y.generatePolynomial=function(){var ie=z.point1.symbolic.x,ne=z.point1.symbolic.y,se=z.point2.symbolic.x,ae=z.point2.symbolic.y,ce=q.symbolic.x,pe=q.symbolic.y,ge=Y.symbolic.x,ve=Y.symbolic.y,be="("+ne+")*("+ge+")-("+ne+")*("+se+")+("+ve+")*("+se+")-("+ie+")*("+ve+")+("+ie+")*("+ae+")-("+ge+")*("+ae+")",Ee="("+pe+")*("+ne+")-("+pe+")*("+ae+")-("+ve+")*("+ne+")+("+ve+")*("+ae+")+("+ce+")*("+ie+")-("+ce+")*("+se+")-("+ge+")*("+ie+")+("+ge+")*("+se+")";return[be,Ee]},Y};JXG$1.createPerpendicular=function(v,N,G){var z,q,Y,W;if(N[0]=v.select(N[0]),N[1]=v.select(N[1]),JXG$1.isPointType(v,N[0])&&N[1].elementClass===Const.OBJECT_CLASS_LINE)q=N[1],z=JXG$1.providePoints(v,[N[0]],G,"point")[0];else if(JXG$1.isPointType(v,N[1])&&N[0].elementClass===Const.OBJECT_CLASS_LINE)q=N[0],z=JXG$1.providePoints(v,[N[1]],G,"point")[0];else throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
188Possible parent types: [line,point]`);return W=JXG$1.copyAttributes(G,v.options,"perpendicular"),Y=JXG$1.createLine(v,[function(){return q.stdform[2]*z.X()-q.stdform[1]*z.Y()},function(){return-q.stdform[2]*z.Z()},function(){return q.stdform[1]*z.Z()}],W),Y.elType="perpendicular",Y.setParents([q.id,z.id]),JXG$1.exists(z._is_new)?(Y.addChild(z),delete z._is_new):z.addChild(Y),q.addChild(Y),Y};JXG$1.createPerpendicularPoint=function(v,N,G){var z,q,Y;if(N[0]=v.select(N[0]),N[1]=v.select(N[1]),JXG$1.isPointType(v,N[0])&&N[1].elementClass===Const.OBJECT_CLASS_LINE)q=JXG$1.providePoints(v,[N[0]],G,"point")[0],z=N[1];else if(JXG$1.isPointType(v,N[1])&&N[0].elementClass===Const.OBJECT_CLASS_LINE)q=JXG$1.providePoints(v,[N[1]],G,"point")[0],z=N[0];else throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
189Possible parent types: [point,line]`);return Y=v.create("point",[function(){return Geometry.perpendicular(z,q,v)[0]}],G),JXG$1.exists(q._is_new)?(Y.addChild(q),delete q._is_new):q.addChild(Y),z.addChild(Y),Y.elType="perpendicularpoint",Y.setParents([q.id,z.id]),Y.update(
189),Y.generatePolynomial=function(){var W=z.point1.symbolic.x,ie=z.point1.symbolic.y,ne=z.point2.symbolic.x,se=z.point2.symbolic.y,ae=q.symbolic.x,ce=q.symbolic.y,pe=Y.symbolic.x,ge=Y.symbolic.y,ve="("+ie+")*("+pe+")-("+ie+")*("+ne+")+("+ge+")*("+ne+")-("+W+")*("+ge+")+("+W+")*("+se+")-("+pe+")*("+se+")",be="("+ce+")*("+ie+")-("+ce+")*("+se+")-("+ge+")*("+ie+")+("+ge+")*("+se+")+("+ae+")*("+W+")-("+ae+")*("+ne+")-("+pe+")*("+W+")+("+pe+")*("+ne+")";return[ve,be]},Y};JXG$1.createPerpendicularSegment=function(v,N,G){var z,q,Y,W,ie;if(N[0]=v.select(N[0]),N[1]=v.select(N[1]),JXG$1.isPointType(v,N[0])&&N[1].elementClass===Const.OBJECT_CLASS_LINE)q=N[1],z=JXG$1.providePoints(v,[N[0]],G,"point")[0];else if(JXG$1.isPointType(v,N[1])&&N[0].elementClass===Const.OBJECT_CLASS_LINE)q=N[0],z=JXG$1.providePoints(v,[N[1]],G,"point")[0];else throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
190Possible parent types: [line,point]`);return ie=JXG$1.copyAttributes(G,v.options,"perpendicularsegment","point"),W=JXG$1.createPerpendicularPoint(v,[q,z],ie),W.dump=!1,JXG$1.exists(G.layer)||(G.layer=v.options.layer.line),ie=JXG$1.copyAttributes(G,v.options,"perpendicularsegment"),Y=JXG$1.createLine(v,[function(){return Geometry.perpendicular(q,z,v)[1]?[W,z]:[z,W]}],ie),Y.point=W,JXG$1.exists(z._is_new)?(Y.addChild(z),delete z._is_new):z.addChild(Y),q.addChild(Y),Y.elType="perpendicularsegment",Y.setParents([z.id,q.id]),Y.subs={point:W},Y.inherits.push(W),Y};JXG$1.createMidpoint=function(v,N,G){var z,q,Y,W,ie;for(W=0;W<N.length;++W)N[W]=v.select(N[W]);if(N.length===2&&JXG$1.isPointType(v,N[0])&&JXG$1.isPointType(v,N[1]))N=JXG$1.providePoints(v,N,G,"point"),z=N[0],q=N[1];else if(N.length===1&&N[0].elementClass===Const.OBJECT_CLASS_LINE)z=N[0].point1,q=N[0].point2;else throw new Error(`JSXGraph: Can't create midpoint.
191Possible parent types: [point,point], [line]`);return ie=JXG$1.copyAttributes(G,v.options,"midpoint"),Y=v.create("point",[function(){var ne=z.coords.usrCoords[1]+q.coords.usrCoords[1];return isNaN(ne)||Math.abs(z.coords.usrCoords[0])<Mat.eps||Math.abs(q.coords.usrCoords[0])<Mat.eps?NaN:ne*.5},function(){var ne=z.coords.usrCoords[2]+q.coords.usrCoords[2];return isNaN(ne)||Math.abs(z.coords.usrCoords[0])<Mat.eps||Math.abs(q.coords.usrCoords[0])<Mat.eps?NaN:ne*.5}],ie),JXG$1.exists(z._is_new)?(Y.addChild(z),delete z._is_new):z.addChild(Y),JXG$1.exists(q._is_new)?(Y.addChild(q),delete q._is_new):q.addChild(Y),Y.elType="midpoint",Y.setParents([z.id,q.id]),Y.prepareUpdate().update(),Y.generatePolynomial=function(){var ne=z.symbolic.x,se=z.symbolic.y,ae=q.symbolic.x,ce=q.symbolic.y,pe=Y.symbolic.x,ge=Y.symbolic.y,ve="("+se+")*("+pe+")-("+se+")*("+ae+")+("+ge+")*("+ae+")-("+ne+")*("+ge+")+("+ne+")*("+ce+")-("+pe+")*("+ce+")",be="("+ne+")^2 - 2*("+ne+")*("+pe+")+("+se+")^2-2*("+se+")*("+ge+")-("+ae+")^2+2*("+ae+")*("+pe+")-("+ce+")^2+2*("+ce+")*("+ge+")";return[ve,be]},Y};JXG$1.createParallelPoint=function(v,N,G){var z,q,Y,W,ie,ne;for(ie=0;ie<N.length;++ie)N[ie]=v.select(N[ie]);if(N.length===3&&JXG$1.isPointType(v,N[0])&&JXG$1.isPointType(v,N[1])&&JXG$1.isPointType(v,N[2]))N=JXG$1.providePoints(v,N,G,"point"),z=N[0],q=N[1],Y=N[2];else if(JXG$1.isPointType(v,N[0])&&N[1].elementClass===Const.OBJECT_CLASS_LINE)Y=JXG$1.providePoints(v,[N[0]],G,"point")[0],z=N[1].point1,q=N[1].point2;else if(JXG$1.isPointType(v,N[1])&&N[0].elementClass===Const.OBJECT_CLASS_LINE)Y=JXG$1.providePoints(v,[N[1]],G,"point")[0],z=N[0].point1,q=N[0].point2;else throw new Error("JSXGraph: Can't create parallel point with parent types '"+typeof N[0]+"', '"+typeof N[1]+"' and '"+typeof N[2]+`'.
192Possible parent types: [line,point], [point,point,point]`);return ne=JXG$1.copyAttributes(G,v.options,"parallelpoint"),W=v.create("point",[function(){return Y.coords.usrCoords[1]+q.coords.usrCoords[1]-z.coords.usrCoords[1]},function(){return Y.coords.usrCoords[2]+q.coords.usrCoords[2]-z.coords.usrCoords[2]}],ne),JXG$1.exists(z._is_new)?(W.addChild(z),delete z._is_new):z.addChild(W),JXG$1.exists(q._is_new)?(W.addChild(q),delete q._is_new):q.addChild(W),JXG$1.exists(Y._is_new)?(W.addChild(Y),delete Y._is_new):Y.addChild(W),W.elType="parallelpoint",W.setParents([z.id,q.id,Y.id]),W.prepareUpdate().update(),W.generatePolynomial=function(){var se=z.symbolic.x,ae=z.symbolic.y,ce=q.symbolic.x,pe=q.symbolic.y,ge=Y.symbolic.x,ve=Y.symbolic.y,be=W.symbolic.x,Ee=W.symbolic.y,Pe="("+pe+")*("+be+")-("+pe+")*("+ge+")-("+ae+")*("+be+")+("+ae+")*("+ge+")-("+Ee+")*("+ce+")+("+Ee+")*("+se+")+("+ve+")*("+ce+")-("+ve+")*("+se+")",Je="("+Ee+")*("+se+")-("+Ee+")*("+ge+")-("+pe+")*("+se+")+("+pe+")*("+ge+")-("+be+")*("+ae+")+("+be+")*("+ve+")+("+ce+")*("+ae+")-("+ce+")*("+ve+")";return[Pe,Je]},W};JXG$1.createParallel=function(v,N,G){var z,q,Y,W,ie,ne,se=1;for(ie=0;ie<N.length;++ie)N[ie]=v.select(N[ie]);return z=null,N.length===3?(N=JXG$1.providePoints(v,N,G,"point"),z=N[2],se=0):JXG$1.isPointType(v,N[0])?(z=JXG$1.providePoints(v,[N[0]],G,"point")[0],W=function(){return N[1].stdform}):JXG$1.isPointType(v,N[1])&&(z=JXG$1.providePoints(v,[N[1]],G,"point")[0],W=function(){return N[0].stdform}),JXG$1.exists(G.layer)||(G.layer=v.options.layer.line),ne=JXG$1.copyAttributes(G,v.options,"parallel","point"),se===1?q=v.create("point",[function(){return Mat.crossProduct([1,0,0],W())}],ne):q=v.create("parallelpoint",N,ne),q.isDraggable=!0,ne=JXG$1.copyAttributes(G,v.options,"parallel"),Y=v.create("line",[z,q],ne),Y.elType="parallel",Y.subs={point:q},Y.inherits.push(q),Y.setParents([N[0].id,N[1].id]),N.length===3&&Y.addParents(N[2].id),Y.point=q,Y};JXG$1.createArrowParallel=function(v,N,G){var z,q;try{return q=JXG$1.copyAttributes(G,v.options,"arrowparallel"),q.lastArrow===!1&&(q.lastArrow=!0),z=JXG$1.createParallel(v,N,q).setAttribute({straightFirst:!1,straightLast:!1}),z.type=Const.OBJECT_TYPE_VECTOR,z.elType="arrowparallel",z}catch{throw new Error("JSXGraph: Can't create arrowparallel with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
193Possible parent types: [line,point], [point,point,point]`)}};JXG$1.createBisector=function(v,N,G){var z,q,Y,W;if(N=JXG$1.providePoints(v,N,G,"point"),JXG$1.isPoint(N[0])&&JXG$1.isPoint(N[1])&&JXG$1.isPoint(N[2])){for(W=JXG$1.copyAttributes(G,v.options,"bisector","point"),W.snapToGri
193d=!1,z=v.create("point",[function(){return Geometry.angleBisector(N[0],N[1],N[2],v)}],W),z.dump=!1,Y=0;Y<3;Y++)JXG$1.exists(N[Y]._is_new)?(z.addChild(N[Y]),delete N[Y]._is_new):N[Y].addChild(z);return JXG$1.exists(G.layer)||(G.layer=v.options.layer.line),W=JXG$1.copyAttributes(G,v.options,"bisector"),q=JXG$1.createLine(v,[N[1],z],W),q.point=z,q.elType="bisector",q.setParents(N),q.subs={point:z},q.inherits.push(z),q}throw new Error("JSXGraph: Can't create angle bisector with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
194Possible parent types: [point,point,point]`)};JXG$1.createAngularBisectorsOfTwoLines=function(v,N,G){var z,q,Y,W,ie=v.select(N[0]),ne=v.select(N[1]);if(ie.elementClass!==Const.OBJECT_CLASS_LINE||ne.elementClass!==Const.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create angle bisectors of two lines with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
195Possible parent types: [line,line]`);return JXG$1.exists(G.layer)||(G.layer=v.options.layer.line),Y=JXG$1.copyAttributes(G,v.options,"bisectorlines","line1"),z=v.create("line",[function(){var se=Mat.hypot(ie.stdform[1],ie.stdform[2]),ae=Mat.hypot(ne.stdform[1],ne.stdform[2]);return ie.stdform[0]/se-ne.stdform[0]/ae},function(){var se=Mat.hypot(ie.stdform[1],ie.stdform[2]),ae=Mat.hypot(ne.stdform[1],ne.stdform[2]);return ie.stdform[1]/se-ne.stdform[1]/ae},function(){var se=Mat.hypot(ie.stdform[1],ie.stdform[2]),ae=Mat.hypot(ne.stdform[1],ne.stdform[2]);return ie.stdform[2]/se-ne.stdform[2]/ae}],Y),JXG$1.exists(G.layer)||(G.layer=v.options.layer.line),Y=JXG$1.copyAttributes(G,v.options,"bisectorlines","line2"),q=v.create("line",[function(){var se=Mat.hypot(ie.stdform[1],ie.stdform[2]),ae=Mat.hypot(ne.stdform[1],ne.stdform[2]);return ie.stdform[0]/se+ne.stdform[0]/ae},function(){var se=Mat.hypot(ie.stdform[1],ie.stdform[2]),ae=Mat.hypot(ne.stdform[1],ne.stdform[2]);return ie.stdform[1]/se+ne.stdform[1]/ae},function(){var se=Mat.hypot(ie.stdform[1],ie.stdform[2]),ae=Mat.hypot(ne.stdform[1],ne.stdform[2]);return ie.stdform[2]/se+ne.stdform[2]/ae}],Y),W=new Composition({line1:z,line2:q}),z.dump=!1,q.dump=!1,W.elType="bisectorlines",W.setParents([ie.id,ne.id]),W.subs={line1:z,line2:q},W};JXG$1.createCircumcenter=function(v,N,G){var z,q,Y,W,ie;if(N=JXG$1.providePoints(v,N,G,"point"),JXG$1.isPoint(N[0])&&JXG$1.isPoint(N[1])&&JXG$1.isPoint(N[2])){for(Y=N[0],W=N[1],ie=N[2],z=JXG$1.createPoint(v,[function(){return Geometry.circumcenter(Y,W,ie,v)}],G),q=0;q<3;q++)JXG$1.exists(N[q]._is_new)?(z.addChild(N[q]),delete N[q]._is_new):N[q].addChild(z);return z.elType="circumcenter",z.setParents(N),z.generatePolynomial=function(){var ne=Y.symbolic.x,se=Y.symbolic.y,ae=W.symbolic.x,ce=W.symbolic.y,pe=ie.symbolic.x,ge=ie.symbolic.y,ve=z.symbolic.x,be=z.symbolic.y,Ee=["((",ve,")-(",ne,"))^2+((",be,")-(",se,"))^2-((",ve,")-(",ae,"))^2-((",be,")-(",ce,"))^2"].join(""),Pe=["((",ve,")-(",ne,"))^2+((",be,")-(",se,"))^2-((",ve,")-(",pe,"))^2-((",be,")-(",ge,"))^2"].join("");return[Ee,Pe]},z}throw new Error("JSXGraph: Can't create circumcircle midpoint with parent types '"+typeof N[0]+"', '"+typeof N[1]+"' and '"+typeof N[2]+`'.
196Possible parent types: [point,point,point]`)};JXG$1.createIncenter=function(v,N,G){var z,q,Y,W,ie;if(N=JXG$1.providePoints(v,N,G,"point"),N.length>=3&&JXG$1.isPoint(N[0])&&JXG$1.isPoint(N[1])&&JXG$1.isPoint(N[2])){for(q=N[0],Y=N[1],W=N[2],z=v.create("point",[function(){var ne,se,ae;return ne=Mat.hypot(Y.X()-W.X(),Y.Y()-W.Y()),se=Mat.hypot(q.X()-W.X(),q.Y()-W.Y()),ae=Mat.hypot(Y.X()-q.X(),Y.Y()-q.Y()),new Coords(Const.COORDS_BY_USER,[(ne*q.X()+se*Y.X()+ae*W.X())/(ne+se+ae),(ne*q.Y()+se*Y.Y()+ae*W.Y())/(ne+se+ae)],v)}],G),ie=0;ie<3;ie++)JXG$1.exists(N[ie]._is_new)?(z.addChild(N[ie]),delete N[ie]._is_new):N[ie].addChild(z);z.elType="incenter",z.setParents(N)}else throw new Error("JSXGraph: Can't create incenter with parent types '"+typeof N[0]+"', '"+typeof N[1]+"' and '"+typeof N[2]+`'.
197Possible parent types: [point,point,point]`);return z};JXG$1.createCircumcircle=function(v,N,G){var z,q,Y,W;if(N=JXG$1.providePoints(v,N,G,"point"),N===!1)throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof N[0]+"', '"+typeof N[1]+"' and '"+typeof N[2]+`'.
198Possible parent types: [point,point,point]`);
198try{for(Y=JXG$1.copyAttributes(G,v.options,"circumcircle","center"),z=JXG$1.createCircumcenter(v,N,Y),z.dump=!1,JXG$1.exists(G.layer)||(G.layer=v.options.layer.circle),Y=JXG$1.copyAttributes(G,v.options,"circumcircle"),q=JXG$1.createCircle(v,[z,N[0]],Y),q.elType="circumcircle",q.setParents(N),q.subs={center:z},q.inherits.push(q),W=0;W<3;W++)JXG$1.exists(N[W]._is_new)?(q.addChild(N[W]),delete N[W]._is_new):N[W].addChild(q)}catch{throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof N[0]+"', '"+typeof N[1]+"' and '"+typeof N[2]+`'.
199Possible parent types: [point,point,point]`)}return q};JXG$1.createIncircle=function(v,N,G){var z,q,Y,W;if(N=JXG$1.providePoints(v,N,G,"point"),N===!1)throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof N[0]+"', '"+typeof N[1]+"' and '"+typeof N[2]+`'.
200Possible parent types: [point,point,point]`);try{for(W=JXG$1.copyAttributes(G,v.options,"incircle","center"),q=JXG$1.createIncenter(v,N,W),q.dump=!1,JXG$1.exists(G.layer)||(G.layer=v.options.layer.circle),W=JXG$1.copyAttributes(G,v.options,"incircle"),Y=JXG$1.createCircle(v,[q,function(){var ie=Mat.hypot(N[1].X()-N[2].X(),N[1].Y()-N[2].Y()),ne=Mat.hypot(N[0].X()-N[2].X(),N[0].Y()-N[2].Y()),se=Mat.hypot(N[1].X()-N[0].X(),N[1].Y()-N[0].Y()),ae=(ie+ne+se)/2;return Math.sqrt((ae-ie)*(ae-ne)*(ae-se)/ae)}],W),Y.elType="incircle",Y.setParents(N),z=0;z<3;z++)JXG$1.exists(N[z]._is_new)?(Y.addChild(N[z]),delete N[z]._is_new):N[z].addChild(Y);Y.center=q,Y.subs={center:Y.center},Y.inherits.push(q)}catch{throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof N[0]+"', '"+typeof N[1]+"' and '"+typeof N[2]+`'.
201Possible parent types: [point,point,point]`)}return Y};JXG$1.createReflection=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce=`
202Possible parent types: [point|line|curve|polygon|circle|arc|sector, line]`;for(ne=0;ne<N.length;++ne)N[ne]=v.select(N[ne]);if(se=JXG$1.copyAttributes(G,v.options,"reflection"),JXG$1.isPoint(N[0]))q=JXG$1.providePoints(v,[N[0]],ae)[0];else if(N[0].elementClass===Const.OBJECT_CLASS_CURVE||N[0].elementClass===Const.OBJECT_CLASS_LINE||N[0].type===Const.OBJECT_TYPE_POLYGON||N[0].elementClass===Const.OBJECT_CLASS_CIRCLE)q=N[0];else throw new Error("JSXGraph: Can't create reflection element with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"'."+ce);if(N[1].elementClass===Const.OBJECT_CLASS_LINE)z=N[1];else throw new Error("JSXGraph: Can't create reflected element with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"'."+ce);if(ie=JXG$1.createTransform(v,[z],{type:"reflect"}),JXG$1.isPoint(q))Y=JXG$1.createPoint(v,[q,ie],se);else if(q.elementClass===Const.OBJECT_CLASS_CURVE)Y=JXG$1.createCurve(v,[q,ie],se);else if(q.elementClass===Const.OBJECT_CLASS_LINE)Y=JXG$1.createLine(v,[q,ie],se);else if(q.type===Const.OBJECT_TYPE_POLYGON)Y=JXG$1.createPolygon(v,[q,ie],se);else if(q.elementClass===Const.OBJECT_CLASS_CIRCLE)se.type.toLowerCase()==="euclidean"?(ae=JXG$1.copyAttributes(G,v.options,"reflection","center"),W=JXG$1.createPoint(v,[q.center,ie],ae),W.prepareUpdate().update().updateVisibility(W.evalVisProp("visible")).updateRenderer(),Y=JXG$1.createCircle(v,[W,function(){return q.Radius()}],se)):Y=JXG$1.createCircle(v,[q,ie],se);else throw new Error("JSXGraph: Can't create reflected element with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"'."+ce);return JXG$1.exists(q._is_new)&&(Y.addChild(q),delete q._is_new),z.addChild(Y),Y.elType="reflection",Y.addParents(z),Y.prepareUpdate().update(),JXG$1.isPoint(Y)&&(Y.generatePolynomial=function(){var pe=z.point1.symbolic.x,ge=z.point1.symbolic.y,ve=z.point2.symbolic.x,be=z.point2.symbolic.y,Ee=q.symbolic.x,Pe=q.symbolic.y,Je=Y.symbolic.x,Ce=Y.symbolic.y,Ve=["((",Ce,")-(",Pe,"))*((",ge,")-(",be,"))+((",pe,")-(",ve,"))*((",Je,")-(",Ee,"))"].join(""),Re=["((",Je,")-(",pe,"))^2+((",Ce,")-(",ge,"))^2-((",Ee,")-(",pe,"))^2-((",Pe,")-(",ge,"))^2"].join("");return[Ve,Re]}),Y};JXG$1.createMirrorElement=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce=`
203Possible parent types: [point|line|curve|polygon|circle|arc|sector, point]`;for(q=0;q<N.length;++q)N[q]=v.select(N[q]);if(se=JXG$1.copyAttributes(G,v.options,"mirrorelement"),JXG$1.isPoint(N[0]))z=JXG$1.providePoints(v,[N[0]],se)[0];else if(N[0].elementClass===Const.OBJECT_CLASS_CURVE||N[0].elementClass===Const.OBJECT_CLASS_LINE||N[0].type===Const.OBJECT_TYPE_POLYGON||N[0].elementClass===Const.OBJECT_CLASS_CIRCLE)z=N[0];else throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"'."+ce);if(JXG$1.isPoint(N[1]))ae=JXG$1.copyAttributes(G,v.options,"mirrorelement","point"),Y=JXG$1.providePoints(v,[N[1]],ae)[0];else throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"'."+ce);if(ne=JXG$1.createTransform(v,[Math.PI,Y],{type:"rotate"}),JXG$1.isPoint(z))W=JXG$1.createPoint(v,[z,ne],se);else if(z.elementClass===Const.OBJECT_CLASS_CURVE)W=JXG$1.createCurve(v,[z,ne],se);else if(z.elementClass===Const.OBJECT_CLASS_LINE)W=JXG$1.createLine(v,[z,ne],se);else if(z.type===Const.OBJECT_TYPE_POLYGON)W=JXG$1.createPolygon(v,[z,ne],se);else if(z.elementClass===Const.OBJECT_CLASS_CIRCLE)se.type.toLowerCase()==="euclidean"?(ae=JXG$1.copyAttributes(G,v.options,"mirrorelement","center"),ie=JXG$1.createPoint(v,[z.center,ne],ae),ie.prepareUpdate().update().updateVisibility(ie.evalVisProp("visible")).updateRenderer(),W=JXG$1.createCircle(v,[ie,function(){return z.Radius()}],se)):W=JXG$1.createCircle(v,[z,ne],se);else throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof N[0]+"' and '"+typeof N[1]+"'."+ce);return JXG$1.exists(z._is_new)&&(W.addChild(z),delete z._is_new),Y.addChild(W),W.elType="mirrorelement",W.addParents(Y),W.prepareUpdate().update(),W};JXG$1.createMirrorPoint=function(v,N,G){var z=JXG$1.createMirrorElement(v,N,G);return z.elType="mirrorpoint",z};JXG$1.createIntegral=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe=null,Je;if(JXG$1.isArray(N[0])&&N[1].elementClass===Const.OBJECT_CLASS_CURVE)z=N[0],q=N[1];else if(JXG$1.isArray(N[1])&&N[0].elementClass===Const.OBJECT_CLASS_CURVE)z=N[1],q=N[0];else throw new Error("JSXGraph: Can't create integral with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
204Possible parent types: [[number|function,number|function],curve]`);return Y=JXG$1.copyAttributes(G,v.options,"integral"),Y.withlabel=!1,Je=v.create("curve",[[0],[0]],Y),v.objectsList.pop(),W=z[0],ie=z[1],JXG$1.isFunction(W)?(ne=W,se=function(){return q.Y(ne())},W=ne()):(ne=W,se=q.Y(W)),JXG$1.isFunction(ie)?(ae=ie,ce=function(){return q.Y(ae())},ie=ae()):(ae=ie,ce=q.Y(ie)),Y=JXG$1.copyAttributes(G,v.options,"integral","curveleft"),pe=v.create("glider",[ne,se,q],Y),JXG$1.isFunction(ne)&&pe.hideElement(),Y=JXG$1.copyAttributes(G,v.options,"integral","baseleft"),ge=v.create("point",[function(){return Je.evalVisProp("axis")==="y"?0:pe.X()},function(){return Je.evalVisProp("axis")==="y"?pe.Y():0}],Y),Y=JXG$1.copyAttributes(G,v.options,"integral","curveright"),ve=v.create("glider",[ae,ce,q],Y),JXG$1.isFunction(ae)&&ve.hideElement(),Y=JXG$1.copyAttributes(G,v.options,"integral","baseright"),be=v.create("point",[function(){return Je.evalVisProp("axis")==="y"?0:ve.X()},function(){return Je.evalVisProp("axis")==="y"?ve.Y():0}],Y),Je._pos=v.objectsList.length,v.objectsList.push(Je),Y=JXG$1.copyAttributes(G,v.options,"integral"),Y.withlabel!==!1&&Y.axis!=="y"&&(Y=JXG$1.copyAttributes(G,v.options,"integral","label"),Y=JXG$1.copyAttributes(Y,v.options,"label"),Pe=v.create("text",[function(){var Ce=new Coords(Const.COORDS_BY_SCREEN,[this.evalVisProp("offset.0")+this.board.origin.scrCoords[1],0],this.board,!1),Ve=this.board.getBoundingBox(),Re=(Ve[2]-Ve[0])*.1,qe=ve.X();return qe<Ve[0]?qe=Ve[0]+Re:qe>Ve[2]&&(qe=Ve[2]-Re),qe+Ce.usrCoords[1]},function(){var Ce=new Coords(Const.COORDS_BY_SCREEN,[0,this.evalVisProp("offset.1")+this.board.origin.scrCoords[2]],this.board,!1),Ve=this.board.getBoundingBox(),Re=(Ve[1]-Ve[3])*.1,qe=ve.Y();return qe>Ve[1]?qe=Ve[1]-Re:qe<Ve[3]&&(qe=Ve[3]+Re),qe+Ce.usrCoords[2]},""],Y),Ee=function(){var Ce="&int;",Ve=Numerics.NewtonCotes([ge.X(),be.X()],q.Y),Re=Pe.evalVisProp("digits"),qe;return Pe.useLocale()?qe=Pe.formatNumberLocale(Ve,Re):qe=JXG$1.toFixed(Ve,Re),(Pe.evalVisProp("usemathjax")||Pe.evalVisProp("usekatex"))&&(Ce="\\int"),Ce+" = "+qe},Pe.setText(Ee),Pe.dump=!1,pe.addChild(Pe),ve.addChild(Pe)),pe.dump=!1,ge.dump=!1,ve.dump=!1,be.dump=!1,Je.elType="integral",Je.setParents([q.id,z]),Je.subs={curveLeft:pe,base
204Left:ge,curveRight:ve,baseRight:be},Je.inherits.push(pe,ge,ve,be),Y.withlabel&&(Je.subs.label=Pe,Je.inherits.push(Pe)),Je.Value=function(){return Numerics.I([ge.X(),be.X()],q.Y)},Je.updateDataArray=function(){var Ce,Ve,Re,qe,et,Ze,tt,Ke,rt;if(this.evalVisProp("axis")==="y"){for(pe.Y()<ve.Y()?(Ze=pe.X(),Ke=pe.Y(),tt=ve.X(),rt=ve.Y()):(Ze=ve.X(),Ke=ve.Y(),tt=pe.X(),rt=pe.Y()),qe=Math.min(Ze,tt),et=Math.max(Ze,tt),Ce=[0,Ze],Ve=[Ke,Ke],Re=0;Re<q.numberPoints;Re++)Ke<=q.points[Re].usrCoords[2]&&qe<=q.points[Re].usrCoords[1]&&q.points[Re].usrCoords[2]<=rt&&q.points[Re].usrCoords[1]<=et&&(Ce.push(q.points[Re].usrCoords[1]),Ve.push(q.points[Re].usrCoords[2]));Ce.push(tt),Ve.push(rt),Ce.push(0),Ve.push(rt),Ce.push(0),Ve.push(Ke)}else{for(ge.X()<be.X()?(qe=ge.X(),et=be.X()):(qe=be.X(),et=ge.X()),Ce=[qe,qe],Ve=[0,q.Y(qe)],Re=0;Re<q.numberPoints;Re++)qe<=q.points[Re].usrCoords[1]&&q.points[Re].usrCoords[1]<=et&&(Ce.push(q.points[Re].usrCoords[1]),Ve.push(q.points[Re].usrCoords[2]));Ce.push(et),Ve.push(q.Y(et)),Ce.push(et),Ve.push(0),Ce.push(qe),Ve.push(0)}this.dataX=Ce,this.dataY=Ve},pe.addChild(Je),ve.addChild(Je),ge.addChild(Je),be.addChild(Je),Je.baseLeft=ge,Je.baseRight=be,Je.curveLeft=pe,Je.curveRight=ve,Je.methodMap=JXG$1.deepCopy(Je.methodMap,{curveLeft:"curveLeft",baseLeft:"baseLeft",curveRight:"curveRight",baseRight:"baseRight",Value:"Value"}),Je.label=Pe,Je};JXG$1.createInequality=function(v,N,G){var z,q,Y;if(Y=JXG$1.copyAttributes(G,v.options,"inequality"),N[0].elementClass===Const.OBJECT_CLASS_LINE)q=v.create("curve",[[],[]],Y),q.hasPoint=function(){return!1},q.updateDataArray=function(){var W,ie,ne,se=v.getBoundingBox(),ae=this.evalVisProp("inverse"),ce=ae?-1:1,pe=1.5,ge=pe*Math.max(se[2]-se[0],se[1]-se[3]),ve={coords:{usrCoords:[1,(se[0]+se[2])*.5,ae?se[1]:se[3]]}},be=N[0].stdform.slice(1),Ee=be;ne=pe*Math.max(Geometry.perpendicular(N[0],ve,v)[0].distance(Const.COORDS_BY_USER,ve.coords),ge),ne*=ce,ve={coords:{usrCoords:[1,(se[0]+se[2])*.5,(se[1]+se[3])*.5]}},Math.abs(Mat.innerProduct(ve.coords.usrCoords,N[0].stdform,3))>=Mat.eps?ve=Geometry.perpendicular(N[0],ve,v)[0].usrCoords:ve=ve.coords.usrCoords,W=[1,ve[1]+be[1]*ge,ve[2]-be[0]*ge],ie=[1,ve[1]-Ee[1]*ge,ve[2]+Ee[0]*ge],this.dataX=[W[1],W[1]+be[0]*ne,ie[1]+Ee[0]*ne,ie[1],W[1]],this.dataY=[W[2],W[2]+be[1]*ne,ie[2]+Ee[1]*ne,ie[2],W[2]]};else if(N[0].elementClass===Const.OBJECT_CLASS_CURVE&&N[0].visProp.curvetype==="functiongraph")q=v.create("curve",[[],[]],Y),q.updateDataArray=function(){var W=this.board.getBoundingBox(),ie=[],ne,se,ae,ce,pe,ge=N[0].minX(),ve=N[0].maxX(),be,Ee,Pe,Je,Ce=(W[1]-W[3])*.3,Ve=this.evalVisProp("inverse");if(ne=Ve?1:3,this.dataX=[],this.dataY=[],ce=N[0].points.length,ce!==0)for(W[1]+=Ce,W[3]-=Ce,ae=-1;ae<ce-1;){for(pe=ae+1,se=ce;pe<ce;pe++)if(N[0].points[pe].isReal()){se=pe;break}if(se>=ce)break;for(pe=se,ae=ce-1;pe<ce-1;pe++)if(!N[0].points[pe+1].isReal()){ae=pe;break}for(Pe=N[0].points[se].usrCoords[1],Je=N[0].points[ae].usrCoords[1],be=W[0]<ge?ge:W[0],Ee=W[2]>ve?ve:W[2],be=se===0?be:Math.max(be,Pe),Ee=ae===ce-1?Ee:Math.min(Ee,Je),be=se===0?ge:Pe,Ee=ae===ce-1?ve:Je,ie=[],ie.push([1,be,W[ne]]),ie.push([1,be,N[0].points[se].usrCoords[2]]),pe=se;pe<=ae;pe++)ie.push(N[0].points[pe].usrCoords);for(ie.push([1,Ee,N[0].points[ae].usrCoords[2]]),ie.push([1,Ee,W[ne]]),ie.push(ie[0]),pe=0;pe<ie.length;pe++)this.dataX.push(ie[pe][1]),this.dataY.push(ie[pe][2]);ae<ce-1&&(this.dataX.push(NaN),this.dataY.push(NaN))}},q.hasPoint=function(){return!1};else if(z=JXG$1.createFunction(N[0]),q.addParentsFromJCFunctions([z]),!JXG$1.exists(z))throw new Error(`JSXGraph: Can't create area with the given parents.
205Possible parent types: [line], [function]`);return q.addParents(N[0]),q};JXG$1.registerElement("arrowparallel",JXG$1.createArrowParallel);JXG$1.registerElement("bisector",JXG$1.createBisector);JXG$1.registerElement("bisectorlines",JXG$1.createAngularBisectorsOfTwoLines);JXG$1.registerElement("msector",JXG$1.createMsector);JXG$1.registerElement("circumcircle",JXG$1.createCircumcircle);JXG$1.registerElement("circumcirclemidpoint",JXG$1.createCircumcenter);JXG$1.registerElement("circumcenter",JXG$1.createCircumcenter);
205JXG$1.registerElement("incenter",JXG$1.createIncenter);JXG$1.registerElement("incircle",JXG$1.createIncircle);JXG$1.registerElement("integral",JXG$1.createIntegral);JXG$1.registerElement("midpoint",JXG$1.createMidpoint);JXG$1.registerElement("mirrorelement",JXG$1.createMirrorElement);JXG$1.registerElement("mirrorpoint",JXG$1.createMirrorPoint);JXG$1.registerElement("orthogonalprojection",JXG$1.createOrthogonalProjection);JXG$1.registerElement("parallel",JXG$1.createParallel);JXG$1.registerElement("parallelpoint",JXG$1.createParallelPoint);JXG$1.registerElement("perpendicular",JXG$1.createPerpendicular);JXG$1.registerElement("perpendicularpoint",JXG$1.createPerpendicularPoint);JXG$1.registerElement("perpendicularsegment",JXG$1.createPerpendicularSegment);JXG$1.registerElement("reflection",JXG$1.createReflection);JXG$1.registerElement("inequality",JXG$1.createInequality);JXG$1.createGrid=function(v,N,G){var z=Mat.eps,q=5e3,Y,W,ie,ne,se,ae,ce,pe=[],ge=[],ve;if(ie=N,ie.length>2||ie.length>=1&&ie[0].elType!=="axis"||ie.length>=2&&ie[1].elType!=="axis")throw new Error("JSXGraph: Can't create 'grid' with parent type '"+N[0].elType+"'. Possible parent types: [axis,axis]");return!JXG$1.exists(ie[0])&&JXG$1.exists(v.defaultAxes)&&(ie[0]=v.defaultAxes.x),!JXG$1.exists(ie[1])&&JXG$1.exists(v.defaultAxes)&&(ie[1]=v.defaultAxes.y),ve=function(be,Ee,Pe,Je,Ce,Ve,Re){var qe,et,Ze,tt,Ke,rt,it;switch(be.toLowerCase()){case".":case"point":return Ee.visProp.linecap="round",Ee.visProp.strokewidth=Ce*Ee.board.unitX+Ve*Ee.board.unitY,[[Pe,Pe,NaN],[Je,Je,NaN]];case"o":case"circle":return Ee.visProp.linecap="square",Ee.bezierDegree=3,et=4*Math.tan(Math.PI/8)/3,[[Pe+Ce,Pe+Ce,Pe+et*Ce,Pe,Pe-et*Ce,Pe-Ce,Pe-Ce,Pe-Ce,Pe-et*Ce,Pe,Pe+et*Ce,Pe+Ce,Pe+Ce,NaN],[Je,Je+et*Ve,Je+Ve,Je+Ve,Je+Ve,Je+et*Ve,Je,Je-et*Ve,Je-Ve,Je-Ve,Je-Ve,Je-et*Ve,Je,NaN]];case"regpol":case"regularpolygon":for(Ee.visProp.linecap="round",tt=Ee.evalVisProp("polygonvertices"),Ke=[[],[]],qe=0;qe<=2*Math.PI;qe+=2*Math.PI/tt)Ke[0].push(Pe-Ce*Math.sin(qe)),Ke[1].push(Je-Ve*Math.cos(qe));return Ke[0].push(NaN),Ke[1].push(NaN),Ke;case"[]":case"square":return Ee.visProp.linecap="square",[[Pe-Ce,Pe+Ce,Pe+Ce,Pe-Ce,Pe-Ce,NaN],[Je+Ve,Je+Ve,Je-Ve,Je-Ve,Je+Ve,NaN]];case"<>":case"diamond":return Ee.visProp.linecap="square",[[Pe,Pe+Ce,Pe,Pe-Ce,Pe,NaN],[Je+Ve,Je,Je-Ve,Je,Je+Ve,NaN]];case"<<>>":case"diamond2":return Ee.visProp.linecap="square",rt=Ce*Math.sqrt(2),it=Ve*Math.sqrt(2),[[Pe,Pe+rt,Pe,Pe-rt,Pe,NaN],[Je+it,Je,Je-it,Je,Je+it,NaN]];case"x":case"cross":return[[Pe-Ce,Pe+Ce,NaN,Pe-Ce,Pe+Ce,NaN],[Je+Ve,Je-Ve,NaN,Je-Ve,Je+Ve,NaN]];case"+":case"plus":return[[Pe-Ce,Pe+Ce,NaN,Pe,Pe,NaN],[Je,Je,NaN,Je-Ve,Je+Ve,NaN]];case"-":case"minus":return[[Pe-Ce,Pe+Ce,NaN],[Je,Je,NaN]];case"|":case"divide":return[[Pe,Pe,NaN],[Je-Ve,Je+Ve,NaN]];case"^":case"a":case"A":case"triangleup":return[[Pe-Ce,Pe,Pe+Ce,NaN],[Je-Ve,Je,Je-Ve,NaN]];case"v":case"triangledown":return[[Pe-Ce,Pe,Pe+Ce,NaN],[Je+Ve,Je,Je+Ve,NaN]];case"<":case"triangleleft":return[[Pe+Ce,Pe,Pe+Ce,NaN],[Je+Ve,Je,Je-Ve,NaN]];case">":case"triangleright":return[[Pe-Ce,Pe,Pe-Ce,NaN],[Je+Ve,Je,Je-Ve,NaN]];case"line":return Ze=Ee.evalVisProp("margin"),[[Pe,Pe,NaN,Re[0]-Ze/Ee.board.unitX,Re[2]+Ze/Ee.board.unitX,NaN],[Re[1]+Ze/Ee.board.unitY,Re[3]-Ze/Ee.board.unitY,NaN,Je,Je,NaN]];default:return[[],[]]}},ne=JXG$1.copyAttributes(G,v.options,"grid"),JXG$1.mergeAttr(ne,ne.themes[ne.theme],!1),se={},JXG$1.mergeAttr(se,ne,!0,!0),JXG$1.mergeAttr(se,ne.major,!0,!0),Y=v.create("curve",[[null],[null]],se),Y.elType="grid",Y.type=Const.OBJECT_TYPE_GRID,ae={},JXG$1.mergeAttr(ae,ne,!0,!0),JXG$1.mergeAttr(ae,ne.minor,!0,!0),ae.id===se.id&&(ae.id=Y.id+"_minor"),ae.name===se.name&&(ae.name=Y.name+"_minor"),W=v.create("curve",[[null],[null]],ae),W.elType="grid",W.type=Const.OBJECT_TYPE_GRID,Y.minorGrid=W,W.majorGrid=Y,Y.hasPoint=function(){return!1},W.hasPoint=function(){return!1},Y.inherits.push(W),Y.updateDataArray=function(){var be=this.board.getBoundingBox(),Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze=this.evalVisProp("gridx"),tt=this.evalVisProp("gridy"),Ke=this.evalVisProp("face"),rt=this.evalVisProp("drawzero"),it=rt===!0||JXG$1.isObject(rt)&&this.eval(rt.origin)===!0,ot=rt===!0||JXG$1.isObject(rt)&&this.eval(rt.x)===!0,ut=rt===!0||JXG$1.isObject(rt)&&this.eval(rt.y)===!0,ct=this.evalVisProp("includeboundaries"),at=this.evalVisProp("forcesquare");if(this.dataX=[],this.dataY=[],ce=this.evalVisProp("majorstep"),JXG$1.isArray(ce)||(ce=[ce,ce]),ce.length<2&&(ce
205=[ce[0],ce[0]]),JXG$1.exists(Ze)&&(JXG$1.deprecated("gridX","majorStep"),ce[0]=Ze),JXG$1.exists(tt)&&(JXG$1.deprecated("gridY","majorStep"),ce[1]=tt),ce[0]==="auto"?(et=Math.pow(10,Math.floor(Math.log(50/this.board.unitX)/Math.LN10)),ce[0]=et,JXG$1.exists(ie[0])&&(ce[0]=ie[0].ticks[0].getDistanceMajorTicks())):ce[0]=JXG$1.parseNumber(ce[0],Math.abs(be[1]-be[3]),1/this.board.unitX),ce[1]==="auto"?(et=Math.pow(10,Math.floor(Math.log(50/this.board.unitY)/Math.LN10)),ce[1]=et,JXG$1.exists(ie[1])&&(ce[1]=ie[1].ticks[0].getDistanceMajorTicks())):ce[1]=JXG$1.parseNumber(ce[1],Math.abs(be[0]-be[2]),1/this.board.unitY),at==="min"||at===!0?ce[0]*this.board.unitX<=ce[1]*this.board.unitY?ce[1]=ce[0]/this.board.unitY*this.board.unitX:ce[0]=ce[1]/this.board.unitX*this.board.unitY:at==="max"&&(ce[0]*this.board.unitX<=ce[1]*this.board.unitY?ce[0]=ce[1]/this.board.unitX*this.board.unitY:ce[1]=ce[0]/this.board.unitY*this.board.unitX),pe=this.evalVisProp("size"),JXG$1.isArray(pe)||(pe=[pe,pe]),pe.length<2&&(pe=[pe[0],pe[0]]),JXG$1.isNumber(pe[0],!0)&&(pe[0]=pe[0]+"px"),JXG$1.isNumber(pe[1],!0)&&(pe[1]=pe[1]+"px"),pe[0]=JXG$1.parseNumber(pe[0],ce[0],1/this.board.unitX),pe[1]=JXG$1.parseNumber(pe[1],ce[1],1/this.board.unitY),ge[0]=pe[0]/2,ge[1]=pe[1]/2,Ee=Mat.roundToStep(be[0],ce[0]),Pe=Mat.roundToStep(be[1],ce[1]),qe=isFinite(Ee)&&isFinite(Pe)&&isFinite(be[2])&&isFinite(be[3])&&Math.abs(be[2])<Math.abs(ce[0]*q)&&Math.abs(be[3])<Math.abs(ce[1]*q),Ke.toLowerCase()==="line"){for(Ve=Y.evalVisProp("margin"),Ce=Pe;qe&&Ce>=be[3];Ce-=ce[1])!it&&Math.abs(Ce)<z||!ut&&Math.abs(Ce)<z||!ct&&(Ce<=be[3]+ge[1]||Ce>=be[1]-ge[1])||(Re=[[be[0]-Ve/Y.board.unitX,be[2]+Ve/Y.board.unitX,NaN],[Ce,Ce,NaN]],JXG$1.concat(this.dataX,Re[0]),JXG$1.concat(this.dataY,Re[1]));for(Je=Ee;qe&&Je<=be[2];Je+=ce[0])!it&&Math.abs(Je)<z||!ot&&Math.abs(Je)<z||!ct&&(Je<=be[0]+ge[0]||Je>=be[2]-ge[0])||(Re=[[Je,Je,NaN],[be[1]+Ve/Y.board.unitY,be[3]-Ve/Y.board.unitY,NaN]],JXG$1.concat(this.dataX,Re[0]),JXG$1.concat(this.dataY,Re[1]))}else for(Ce=Pe;qe&&Ce>=be[3];Ce-=ce[1])for(Je=Ee;qe&&Je<=be[2];Je+=ce[0])!it&&Math.abs(Ce)<z&&Math.abs(Je)<z||!ot&&Math.abs(Ce)<z&&Math.abs(Je)>=z||!ut&&Math.abs(Je)<z&&Math.abs(Ce)>=z||!ct&&(Je<=be[0]+ge[0]||Je>=be[2]-ge[0]||Ce<=be[3]+ge[1]||Ce>=be[1]-ge[1])||(Re=ve(Ke,Y,Je,Ce,ge[0],ge[1],be),JXG$1.concat(this.dataX,Re[0]),JXG$1.concat(this.dataY,Re[1]))},W.updateDataArray=function(){var be=this.board.getBoundingBox(),Ee,Pe,Je,Ce,Ve,Re,qe,et=[],Ze=[],tt,Ke,rt,it,ot,ut,ct,at,st,pt,lt,vt,dt=this.evalVisProp("minorelements"),xt=this.evalVisProp("size"),ft=this.evalVisProp("face"),Et=this.evalVisProp("drawzero"),Ct=Et===!0||JXG$1.isObject(Et)&&this.eval(Et.x)===!0,Dt=Et===!0||JXG$1.isObject(Et)&&this.eval(Et.y)===!0,Gt=this.majorGrid.evalVisProp("face"),Ot=this.majorGrid.evalVisProp("drawzero"),It=Ot===!0||JXG$1.isObject(Ot)&&this.eval(Ot.origin)===!0,Bt=Ot===!0||JXG$1.isObject(Ot)&&this.eval(Ot.x)===!0,Ht=Ot===!0||JXG$1.isObject(Ot)&&this.eval(Ot.y)===!0,ir=this.evalVisProp("includeboundaries");if(this.dataX=[],this.dataY=[],JXG$1.isArray(dt)||(dt=[dt,dt]),dt.length<2&&(dt=[dt[0],dt[0]]),JXG$1.isNumber(dt[0],!0)?dt[0]=parseFloat(dt[0]):(dt[0]=3,JXG$1.exists(ie[0])&&(dt[0]=ie[0].eval(ie[0].getAttribute("ticks").minorticks))),et[0]=ce[0]/(dt[0]+1),JXG$1.isNumber(dt[1],!0)?dt[1]=parseFloat(dt[1]):(dt[1]=3,JXG$1.exists(ie[1])&&(dt[1]=ie[1].eval(ie[1].getAttribute("ticks").minorticks))),et[1]=ce[1]/(dt[1]+1),JXG$1.isArray(xt)||(xt=[xt,xt]),xt.length<2&&(xt=[xt[0],xt[0]]),JXG$1.isNumber(xt[0],!0)&&(xt[0]=xt[0]+"px"),JXG$1.isNumber(xt[1],!0)&&(xt[1]=xt[1]+"px"),xt[0]=JXG$1.parseNumber(xt[0],et[0],1/this.board.unitX),xt[1]=JXG$1.parseNumber(xt[1],et[1],1/this.board.unitY),Ze[0]=xt[0]*.5,Ze[1]=xt[1]*.5,Ee=Mat.roundToStep(be[0],et[0]),Pe=Mat.roundToStep(be[1],et[1]),qe=isFinite(Ee)&&isFinite(Pe)&&isFinite(be[2])&&isFinite(be[3])&&Math.abs(be[2])<=Math.abs(et[0]*q)&&Math.abs(be[3])<Math.abs(et[1]*q),ft.toLowerCase()!=="line")for(Ce=Pe;qe&&Ce>=be[3];Ce-=et[1])for(Je=Ee;qe&&Je<=be[2];Je+=et[0]){if(tt=Mat.roundToStep(Math.abs(Je),ce[0]),tt=Math.abs(tt-Math.abs(Je)),Ke=ce[0]-tt,rt=Mat.roundToStep(Math.abs(Ce),ce[1]),rt=Math.abs(rt-Math.abs(Ce)),it=ce[1]-rt,Gt==="line"){if(tt-Ze[0]-ge[0]<z||Ke-Ze[0]-ge[0]<z||rt-Ze[1]-ge[1]<z||it-Ze[1]-ge[1]<z)continue}else if((tt-Ze[0]-ge[0]<z||Ke-Ze[0]-ge[0]<z)&&(rt-Ze[1]-ge[1]<z||it-Ze[1]-ge[1]<z)&&(It||ge[1]-Math.abs(Ce)+Ze[1]<z||ge[0]-Math.abs(Je)+Ze[0]<z)&&(Bt||ge[1]-Math.abs(Ce)+Ze[1]<z||ge[0]+Math.abs(Je)-Ze[0]<z)&&(Ht||ge[0]-Math.abs(Je)+Ze[0]<z||ge[1]+Math.abs(Ce)-Ze[1]<z))continue;!Dt&&Math.abs(Je)<z||!Ct&&Math.abs(Ce)<z||(ot=Math.abs(be[0]%ce[0]),ut=Math.abs(be[1]%ce[1]),ct=Math.abs(be[2]%ce[0]),at=Math.abs(be[3]%ce[1]),st=ce[0]-ot,pt=ce[1]-ut,lt=ce[0]-ct,vt=ce[1]-at,!(!ir&&(Je-Ze[0]-be[0]-ge[0]+st<z&&st-ge[0]<z||Je-Ze[0]-be[0]-ge[0]-ot<z&&ot-ge[0]<z||-Je-Ze[0]+be[2]-ge[0]+lt<z&&lt-ge[0]<z||-Je-Ze[0]+be[2]-ge[0]-ct<z&&ct-ge[0]<z||-Ce-Ze[1]+be[1]-ge[1]+pt<z&&pt-ge[1]<z||-Ce-Ze[1]+be[1]-ge[1]-ut<z&&ut-ge[1]<z||
205Ce-Ze[1]-be[3]-ge[1]+vt<z&&vt-ge[1]<z||Ce-Ze[1]-be[3]-ge[1]-at<z&&at-ge[1]<z||-Ce-Ze[1]+be[1]<z||Je-Ze[0]-be[0]<z||Ce-Ze[1]-be[3]<z||-Je-Ze[0]+be[2]<z))&&(Re=ve(ft,W,Je,Ce,Ze[0],Ze[1],be),JXG$1.concat(this.dataX,Re[0]),JXG$1.concat(this.dataY,Re[1])))}else{for(Ve=W.evalVisProp("margin"),Ce=Pe;qe&&Ce>=be[3];Ce-=et[1]){if(rt=Mat.roundToStep(Math.abs(Ce),ce[1]),rt=Math.abs(rt-Math.abs(Ce)),it=ce[1]-rt,Gt==="line"){if(rt-Ze[1]-ge[1]<z||it-Ze[1]-ge[1]<z)continue}else if((rt-Ze[1]-ge[1]<z||it-Ze[1]-ge[1]<z)&&(It||ge[1]-Math.abs(Ce)+Ze[1]<z)&&(Bt||ge[1]-Math.abs(Ce)+Ze[1]<z)&&(Ht||ge[1]+Math.abs(Ce)-Ze[1]<z))continue;!Ct&&Math.abs(Ce)<z||(ot=Math.abs(be[0]%ce[0]),ut=Math.abs(be[1]%ce[1]),ct=Math.abs(be[2]%ce[0]),at=Math.abs(be[3]%ce[1]),st=ce[0]-ot,pt=ce[1]-ut,lt=ce[0]-ct,vt=ce[1]-at,!(!ir&&(-Ce-Ze[1]+be[1]-ge[1]+pt<z&&pt-ge[1]<z||-Ce-Ze[1]+be[1]-ge[1]-ut<z&&ut-ge[1]<z||Ce-Ze[1]-be[3]-ge[1]+vt<z&&vt-ge[1]<z||Ce-Ze[1]-be[3]-ge[1]-at<z&&at-ge[1]<z||-Ce-Ze[1]+be[1]<z||Ce-Ze[1]-be[3]<z))&&(Re=[[be[0]-Ve/W.board.unitX,be[2]+Ve/W.board.unitX,NaN],[Ce,Ce,NaN]],JXG$1.concat(this.dataX,Re[0]),JXG$1.concat(this.dataY,Re[1])))}for(Je=Ee;qe&&Je<=be[2];Je+=et[0]){if(tt=Mat.roundToStep(Math.abs(Je),ce[0]),tt=Math.abs(tt-Math.abs(Je)),Ke=ce[0]-tt,Gt==="line"){if(tt-Ze[0]-ge[0]<z||Ke-Ze[0]-ge[0]<z)continue}else if((tt-Ze[0]-ge[0]<z||Ke-Ze[0]-ge[0]<z)&&(It||ge[0]-Math.abs(Je)+Ze[0]<z)&&(Bt||ge[0]+Math.abs(Je)-Ze[0]<z)&&(Ht||ge[0]-Math.abs(Je)+Ze[0]<z))continue;!Dt&&Math.abs(Je)<z||(ot=Math.abs(be[0]%ce[0]),ut=Math.abs(be[1]%ce[1]),ct=Math.abs(be[2]%ce[0]),at=Math.abs(be[3]%ce[1]),st=ce[0]-ot,pt=ce[1]-ut,lt=ce[0]-ct,vt=ce[1]-at,!(!ir&&(Je-Ze[0]-be[0]-ge[0]+st<z&&st-ge[0]<z||Je-Ze[0]-be[0]-ge[0]-ot<z&&ot-ge[0]<z||-Je-Ze[0]+be[2]-ge[0]+lt<z&&lt-ge[0]<z||-Je-Ze[0]+be[2]-ge[0]-ct<z&&ct-ge[0]<z||Je-Ze[0]-be[0]<z||-Je-Ze[0]+be[2]<z))&&(Re=[[Je,Je,NaN],[be[1]+Ve/W.board.unitY,be[3]-Ve/W.board.unitY,NaN]],JXG$1.concat(this.dataX,Re[0]),JXG$1.concat(this.dataY,Re[1])))}}},v.grids.push(Y),v.grids.push(W),W.dump=!1,Y.getParents=W.getParents=function(){return ie.slice()},Y};JXG$1.registerElement("grid",JXG$1.createGrid);JXG$1.Image=function(v,N,G,z,q){this.constructor(v,G,Const.OBJECT_TYPE_IMAGE,Const.OBJECT_CLASS_OTHER),this.element=this.board.select(G.anchor),this.coordsConstructor(N),this.W=JXG$1.createFunction(q[0],this.board,""),this.H=JXG$1.createFunction(q[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*v.unitX),Math.abs(this.usrSize[1]*v.unitY)],this.url=z,this.elType="image",this.span=[this.coords.usrCoords.slice(0),[this.coords.usrCoords[0],this.W(),0],[this.coords.usrCoords[0],0,this.H()]],this.id=this.board.setId(this,"Im"),this.board.renderer.drawImage(this),this.board.finalizeAdding(this),this.methodMap=JXG$1.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H",setSize:"setSize"})};JXG$1.Image.prototype=new GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Image,CoordsElement,"coordsConstructor");JXG$1.extend(JXG$1.Image.prototype,{hasPoint:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce=this.transformations.length;return JXG$1.isObject(this.evalVisProp("precision"))?(Y=this.board._inputDevice,W=this.evalVisProp("precision."+Y)):W=this.board.options.precision.hasPoint,ce===0?(G=v-this.coords.scrCoords[1],z=this.coords.scrCoords[2]-N,q=W,G>=-q&&G-this.size[0]<=q&&z>=-q&&z-this.size[1]<=q):(ie=new Coords(Const.COORDS_BY_SCREEN,[v,N],this.board),ie=ie.usrCoords,ne=[ie[0]-this.span[0][0],ie[1]-this.span[0][1],ie[2]-this.span[0][2]],ae=Mat.innerProduct,se=ae(ne,this.span[1]),0<=se&&se<=ae(this.span[1],this.span[1])&&(se=ae(ne,this.span[2]),0<=se&&se<=ae(this.span[2],this.span[2])))},update:function(v){return this.needsUpdate?(this.updateCoords(v),this.updateSize(),this.updateSpan(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateImage")},updateSize:function(){return this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)],this},updateSpan:function(){var v,N,G=this.transformations.length,z=[];if(G===0)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(z[0]=[this.Z(),this.X(),this.Y()],z[1]=[this.Z(),this.X()+this.W(),this.Y()],z[2]=[this.Z(),this.X(),this.Y()+this.H()],v=0;v<G;v++)for(N=0;N<3;N++)z[N]=Mat.matVecMult(this.transformations[v].matrix,z[N]);for(N=0;N<3;N++)z[N][1]/=z[N][0],z[N][2]/=z[N][0],z[N][0]/=z[N][0];for(N=1;N<3;N++)z[N][0]-=z[0][0],z[N][1]-=z[0][1],z[N][2]-=z[0][2];this.span=z}return this},addTransform:function(v){var N;if(JXG$1.isArray(v))for(N=0;N<v.length;N++)this.transformations.push(v[N]);else this.transformations.push(v);return this},getParents:function(){var v=[this.url,[this.Z(),this.X(),this.Y()],this.usrSize];return this.parents.length!==0&&(v=this.parents),v},setSize:function(v,N){return this.W=JXG$1.createFunction(v,this.board,""),this.H=JXG$1.createFunction(N,this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}});JXG$1.createImage=function(v,N,G){var z,q,Y=N[0],W=N[1],ie=N[2];if(z=JXG$1.copyAttributes(G,v.options,"image"),q=CoordsElement.create(JXG$1.Image,v,W,z,Y,ie),!q)throw new Error("JSXGraph: Can't create image with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
206Possible parent types: [x,y], [z,x,y], [element,transformation]`);return z.rotate!==0&&q.addRotation(z.rotate),q};JXG$1.registerElement("image",JXG$1.createImage);JXG$1.Image;JXG$1.createSlider=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke;return Ke=JXG$1.copyAttributes(G,v.options,"slider"),Ve=Ke.withticks,Ce=Ke.withlabel,et=Ke.snapwidth,Re=Ke.snapvalues,qe=Ke.snapvaluedistance,se=v.create("point",N[0],Ke.point1),ae=v.create("point",N[1],Ke.point2),pe=v.create("segment",[se,ae],Ke.baseline),pe.updateStdform(),z=se.coords.usrCoords.slice(1),q=ae.coords.usrCoords.slice(1),Y=N[2][0],W=N[2][1],ie=N[2][2],ne=ie-Y,Ze=JXG$1.evaluate(et),tt=Ze===-1?W:Math.round((W-Y)/Ze)*Ze+Y,Pe=z[0]+(q[0]-z[0])*(tt-Y)/(ie-Y),Je=z[1]+(q[1]-z[1])*(tt-Y)/(ie-Y),Ke.withlabel=!1,
206ce=v.create("glider",[Pe,Je,pe],Ke),ce.setAttribute({snapwidth:et,snapvalues:Re,snapvaluedistance:qe}),ge=v.create("segment",[se,ce],Ke.highline),ce.Value=function(){var rt=this._smax-this._smin,it=this.evalVisProp("snapwidth");return it===-1?this.position*rt+this._smin:Math.round(this.position*rt/it)*it+this._smin},ce.methodMap=JXG$1.deepCopy(ce.methodMap,{Value:"Value",setValue:"setValue",smax:"_smax",smin:"_smin",setMax:"setMax",setMin:"setMin",point1:"point1",point2:"point2",baseline:"baseline",highline:"highline",ticks:"ticks",label:"label"}),ce._smax=ie,ce._smin=Y,ce.setMax=function(rt){return this._smax=rt,this},ce.setValue=function(rt){var it=this._smax-this._smin;return Math.abs(it)>Mat.eps?this.position=(rt-this._smin)/it:this.position=0,this.position=Math.max(0,Math.min(1,this.position)),this},ce.setMin=function(rt){return this._smin=rt,this},Ce&&(Ee=v.create("text",[function(){return(ae.X()-se.X())*.05+ae.X()},function(){return(ae.Y()-se.Y())*.05+ae.Y()},function(){var rt,it=ce.evalVisProp("digits"),ot=ce.evalVisProp("suffixlabel"),ut=ce.evalVisProp("unitlabel"),ct=ce.evalVisProp("postlabel");return it===2&&ce.evalVisProp("precision")!==2&&(it=ce.evalVisProp("precision")),ot!==null?rt=ot:ce.name&&ce.name!==""?rt=ce.name+" = ":rt="",ce.useLocale()?rt+=ce.formatNumberLocale(ce.Value(),it):rt+=JXG$1.toFixed(ce.Value(),it),ut!==null&&(rt+=ut),ct!==null&&(rt+=ct),rt}],Ke.label),ce.label=Ee,ce.visProp.withlabel=!0,ce.hasLabel=!0),ce.point1=se,ce.point2=ae,ce.baseline=pe,ce.highline=ge,Ve&&(JXG$1.exists(Ke.generatelabeltext)||(Ke.ticks.generateLabelText=function(rt,it,ot){var ut,ct=ce.point1.Dist(ce.point2),at=ce._smin,st=ce._smax,pt=this.getDistanceFromZero(it,rt)*(st-at)/ct+at;return ct<Mat.eps||Math.abs(pt)<Mat.eps?ut="0":ut=this.formatLabelText(pt),ut}),ve=2,be=v.create("ticks",[ce.baseline,ce.point1.Dist(se)/ve,function(rt){var it=ce.point1.Dist(ce.point2),ot=ce.point1.coords.distance(Const.COORDS_BY_USER,rt);return it<Mat.eps?0:ot/it*ne+Y}],Ke.ticks),ce.ticks=be),ce.remove=function(){Ce&&v.removeObject(Ee),v.removeObject(ge),v.removeObject(pe),v.removeObject(ae),v.removeObject(se),Point.prototype.remove.call(ce)},se.dump=!1,ae.dump=!1,pe.dump=!1,ge.dump=!1,Ce&&(Ee.dump=!1),ce.elType="slider",ce.parents=N,ce.subs={point1:se,point2:ae,baseLine:pe,highLine:ge},ce.inherits.push(se,ae,pe,ge),pe.inherits=[],ge.inherits=[],Ve&&(be.dump=!1,ce.subs.ticks=be,ce.inherits.push(be)),ce.getParents=function(){return[this.point1.coords.usrCoords.slice(1),this.point2.coords.usrCoords.slice(1),[this._smin,this.position*(this._smax-this._smin)+this._smin,this._smax]]},ce.baseline.on("up",function(rt){var it,ot;ce.evalVisProp("moveonup")&&!ce.evalVisProp("fixed")&&(it=pe.board.getMousePosition(rt,0),ot=new Coords(Const.COORDS_BY_SCREEN,it,this.board),ce.moveTo([ot.usrCoords[1],ot.usrCoords[2]]),ce.triggerEventHandlers(["drag"],[rt]))}),ce.prepareUpdate().update(),v.isSuspendedUpdate||(ce.updateVisibility().updateRenderer(),ce.baseline.updateVisibility().updateRenderer(),ce.highline.updateVisibility().updateRenderer(),Ve&&ce.ticks.updateVisibility().updateRenderer()),ce};JXG$1.registerElement("slider",JXG$1.createSlider);JXG$1.PrefixParser={parse:function(v,N){var G,z,q,Y,W,ie;if(JXG$1.isNumber(v)||JXG$1.isString(v))return v;if(!JXG$1.isArray(v)||v.length<2)throw new Error("prefixParser.parse: term is not an array, number or string");if(G=v[0],q=v.length,N==="execute")if(JXG$1.isInArray(["+","-","*","/"],G))for(Y=this.parse(v[1],N),z=2;z<q;z++)switch(ie=this.parse(v[z],N),G){case"+":Y+=ie;break;case"-":Y-=ie;break;case"*":Y*=ie;break;case"/":Y/=ie;break}else if(G==="exec"){for(W=v[1],ie=[],z=2;z<q;z++)ie.push(this.parse(v[z],N));if(JXG$1.exists(Math[W]))Y=Math[W].apply(this,ie);else if(JXG$1.exists(Mat[W]))Y=Mat[W].apply(this,ie);else throw new Error("PrefixParser.parse: "+W+" is not allowed")}else{if(W=v[0],W==="V"&&(W="Value"),W==="Coords"&&(v[2]="true"),!JXG$1.exists(v[1][W]))throw new Error("PrefixParser.parse: "+W+" is not a method of "+v[1]);for(ie=[],z=2;z<q;z++)ie.push(this.parse(v[z],N));Y=v[1][W].apply(v[1],ie)}return Y},dimension:function(v){var N,G,z,q,Y,W,ie,ne;if(JXG$1.isNumber(v))return 0;if(!JXG$1.isArray(v)||v.length<2)throw new Error("PrefixParser.dimension: term is not an array");if(N=v[0],z=v.length,JXG$1.isInArray(["+","-","*","/"],N))for(q=this.dimension(v[1]),G=2;G<z;G++)switch(ie=this.dimension(v[G]),N){case"+":ie!==q&&(q=NaN);break;case"-":ie!==q&&(q=NaN);break;case"*":q+=ie;break;case"/":q-=ie;break}else if(N==="exec")v[2].type===JXG$1.OBJECT_TYPE_MEASUREMENT?(q=v[2].Dimension(),JXG$1.exists(v[2].visProp.dim)&&(W=v[2].evalVisProp("dim"),W!==null&&(q=W))):q=0;else switch(Y=v[0],Y){case"L":case"Length":case"Perimeter":case"Radius":case"R":q=1;break;case"Area":case"A":q=2;break;default:v[1].type===JXG$1.OBJECT_TYPE_MEASUREMENT?(q=v[1].Dimension(),JXG$1.exists(v[1].visProp.dim)&&(W=v[1].evalVisProp("dim"),W!==null&&(q=W))):(q=0,(Y==="Value"||Y==="V")&&[Const.OBJECT_TYPE_ARC,Const.OBJECT_TYPE_SECTOR,Const.OBJECT_TYPE_ANGLE].indexOf(v[1].type)>=0&&(ne="",v.length===3&&JXG$1.isString(v[2])&&(ne=v[2].toLowerCase()),ne===""?v[1].type===Const.OBJECT_TYPE_ANGLE?q=0:q=1:ne.indexOf("len")===0?q=1:q=0))}return q},toPrefix:function(v){var N,G,z,q;if(JXG$1.isNumber(v))return v;if(!JXG$1.isArray(v)||v.length<2)throw new Error("PrefixParser.toPrefix: term is not an array");for(N=v[0],z=v.length,q=[N],G=1;G<z;G++)JXG$1.isInArray(["+","-","*","/"],N)?q.push(this.toPrefix(v[G])):N==="V"&&v[G].type===JXG$1.OBJECT_TYPE_MEASUREMENT?q=v[G].toPrefix():N==="exec"?G===1?q.push(v[G]):q.push(this.toPrefix(v[G])):q=[N,v[G].id];return q},getParents:function(v){var N,G,z,q;if(JXG$1.isNumber(v))return[];if(!JXG$1.isArray(v)||v.length<2)throw new Error("PrefixParser.getParents: term is not an array");for(N=v[0],z=v.length,q=[],G=1;G<z;G++)JXG$1.isInArray(["+","-","*","/"],N)?JXG$1.concat(q,this.getParents(v[G])):N==="V"&&v[G].type===JXG$1.OBJECT_TYPE_MEASUREMENT?JXG$1.concat(q,v[G].getParents()):N==="exec"?G>1&&JXG$1.concat(q,this.getParents(v[G])):q.push(v[G]);return q}};const Prefix=JXG$1.PrefixParser;JXG$1.createTapemeasure=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge;return z=N[0],q=N[1],Y=JXG$1.copyAttributes(G,v.options,"tapemeasure","point1"),ae=v.create("point",z,Y),Y=JXG$1.copyAttributes(G,v.options,"tapemeasure","point2"),ce=v.create("point",q,Y),ae.setAttribute({ignoredSnapToPoints:[ce.id]}),ce.setAttribute({ignoredSnapToPoints:[ae.id]}),Y=JXG$1.copyAttributes(G,v.options,"tapemeasure"),W=Y.withticks,ie=Y.withlabel,ne=Y.digits,ne===2&&Y.precision!==2&&(ne=Y.precision),ie&&(Y.withlabel=!0),se=v.create("segment",[ae,ce],Y),ie&&(G.name&&G.name!==""?pe=G.name+" = ":pe="",se.label.setText(function(){var ve=se.label.evalVisProp("digits");return se.label.useLocale()?pe+se.label.formatNumberLocale(ae.Dist(ce),ve):pe+JXG$1.toFixed(ae.Dist(ce),ve)})),W&&(Y=JXG$1.copyAttributes(G,v.options,"tapemeasure","ticks"),ge=v.create("ticks",[se,.1],Y),se.inherits.push(ge)),se.remove=function(){W&&se.removeTicks(ge),v.removeObject(ce),v.removeObject(ae),GeometryElement.prototype.remove.call(this)},se.Value=function(){return ae.Dist(ce)},ae.dump=!1,ce.dump=!1,se.elType="tapemeasure",se.getParents=function(){return[[ae.X(),ae.Y()],[ce.X(),ce.Y()]]},se.subs={point1:ae,point2:ce},W&&(ge.dump=!1),se.methodMap=JXG$1.deepCopy(se.methodMap,{Value:"Value"}
206),se.prepareUpdate().update(),v.isSuspendedUpdate||(se.updateVisibility().updateRenderer(),se.point1.updateVisibility().updateRenderer(),se.point2.updateVisibility().updateRenderer()),se};JXG$1.registerElement("tapemeasure",JXG$1.createTapemeasure);JXG$1.createMeasurement=function(v,N,G){var z,q,Y,W,ie,ne;for(q=JXG$1.copyAttributes(G,v.options,"measurement"),Y=N[0],W=N[1],ie=N[2],z=v.create("text",[Y,W,""],q),z.type=JXG$1.OBJECT_TYPE_MEASUREMENT,z.elType="measurement",z.Value=function(){return Prefix.parse(ie,"execute")},z.Dimension=function(){var se=z.evalVisProp("dim");return se!==null?se:Prefix.dimension(ie)},z.Unit=function(se){var ae="",ce=z.evalVisProp("units"),pe=se,ge={},ve;if(JXG$1.exists(pe)||(pe=z.Dimension()),JXG$1.isArray(se)){for(ve=0;ve<se.length;ve++)ge["dim"+se[ve]]=z.Unit(se[ve]);return ge}return JXG$1.isObject(ce)&&JXG$1.exists(ce[pe])&&ce[pe]!==!1?ae=z.eval(ce[pe]):JXG$1.isObject(ce)&&JXG$1.exists(ce["dim"+pe])&&ce["dim"+pe]!==!1?ae=z.eval(ce["dim"+pe]):(ae=z.evalVisProp("baseunit"),pe===0?ae="":pe>1&&ae!==""&&(ae=ae+"^{"+pe+"}")),ae},z.getTerm=function(){return ie},z.getMethod=function(){var se=ie[0];return se==="V"&&(se="Value"),se},z.toPrefix=function(){return Prefix.toPrefix(ie)},z.getParents=function(){return Prefix.getParents(ie)},z.addParents(z.getParents()),ne=0;ne<z.parents.length;ne++)v.select(z.parents[ne]).addChild(z);return z.setText(function(){var se="",ae="",ce=z.Dimension(),pe=z.evalVisProp("digits"),ge=z.Unit(),ve=z.Value(),be;if(z.evalVisProp("showprefix")&&(se=z.evalVisProp("prefix")),z.evalVisProp("showsuffix")&&(ae=z.evalVisProp("suffix")),JXG$1.isNumber(ve))pe==="none"||(pe==="auto"?z.useLocale()?ve=z.formatNumberLocale(ve):ve=JXG$1.autoDigits(ve):z.useLocale()?ve=z.formatNumberLocale(ve,pe):ve=JXG$1.toFixed(ve,pe));else if(JXG$1.isArray(ve))for(be=0;be<ve.length;be++)JXG$1.isNumber(ve[be])&&(pe==="none"||(pe==="auto"?z.useLocale()?ve[be]=z.formatNumberLocale(ve[be]):ve[be]=JXG$1.autoDigits(ve[be]):z.useLocale()?ve[be]=z.formatNumberLocale(ve[be],pe):ve[be]=JXG$1.toFixed(ve[be],pe)));return ce==="coords"&&JXG$1.isArray(ve)&&(ve.length===2&&ve.unshift(void 0),ve=z.visProp.formatcoords(z,ve[1],ve[2],ve[0])),ce==="direction"&&JXG$1.isArray(ve)&&(ve=z.visProp.formatdirection(z,ve[0],ve[1])),JXG$1.isString(ce)?se+ve+ae:isNaN(ce)?se+"NaN"+ae:se+ve+ge+ae}),z.methodMap=JXG$1.deepCopy(z.methodMap,{Value:"Value",Dimension:"Dimension",Unit:"Unit",getTerm:"getTerm",Term:"getTerm",getMethod:"getMethod",Method:"getMethod",getParents:"getParents",Parents:"getParents"}),z};JXG$1.registerElement("measurement",JXG$1.createMeasurement);JXG$1.DataSource=function(){return this.data=[],this.columnHeaders=[],this.rowHeaders=[],this};JXG$1.extend(JXG$1.DataSource.prototype,{loadFromArray:function(v,N,G){var z,q,Y;if(JXG$1.isArray(N)&&(this.columnHeaders=N,N=!1),JXG$1.isArray(G)&&(this.rowHeaders=G,G=!1),this.data=[],N&&(this.columnHeaders=[]),G&&(this.rowHeaders=[]),JXG$1.exists(v)){for(this.data=[],z=0;z<v.length;z++)for(this.data[z]=[],q=0;q<v[z].length;q++)Y=v[z][q],parseFloat(Y).toString()===Y?this.data[z][q]=parseFloat(Y):Y!=="-"?this.data[z][q]=Y:this.data[z][q]=NaN;if(N&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),G)for(this.rowHeaders=[],z=0;z<this.data.length;z++)this.rowHeaders.push(this.data[z][0]),this.data[z]=this.data[z].slice(1)}return this},loadFromTable:function(v,N,G){var z,q,Y,W,ie;if(JXG$1.isArray(N)&&(this.columnHeaders=N,N=!1),JXG$1.isArray(G)&&(this.rowHeaders=G,G=!1),this.data=[],N&&(this.columnHeaders=[]),G&&(this.rowHeaders=[]),v=document.getElementById(v),JXG$1.exists(v)){for(z=v.getElementsByTagName("tr"),this.data=[],q=0;q<z.length;q++)for(W=z[q].getElementsByTagName("td"),this.data[q]=[],Y=0;Y<W.length;Y++)ie=W[Y].innerHTML,parseFloat(ie).toString()===ie?this.data[q][Y]=parseFloat(ie):ie!=="-"?this.data[q][Y]=ie:this.data[q][Y]=NaN;if(N&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),G)for(this.rowHeaders=[],q=0;q<this.data.length;q++)this.rowHeaders.push(this.data[q][0]),this.data[q]=this.data[q].slice(1)}return this},addColumn:function(v,N,G){throw new Error("not implemented")},addRow:function(v,N,G){throw new Error("not implemented")},getColumn:function(v){var N,G=[];if(JXG$1.isString(v)){for(N=0;N<this.columnHeaders.length;N++)if(v===this.columnHeaders[N]){v=N;break}}for(N=0;N<this.data.length;N++)this.data[N].length>v&&(G[N]=parseFloat(this.data[N][v]));return G},getRow:function(v){var N,G;if(JXG$1.isString(v)){for(G=0;G<this.rowHeaders.length;G++)if(v===this.rowHeaders[G]){v=G;break}}for(N=[],G=0;G<this.data[v].length;G++)N[G]=this.data[v][G];return N}});const DataSource=JXG$1.DataSource;JXG$1.Chart=function(v,N,G){this.constructor(v,G);var z,q,Y,W,ie,ne;if(!JXG$1.isArray(N)||N.length===0)throw new Error("JSXGraph: Can't create a chart without data");if(this.elements=[],JXG$1.isNumber(N[0]))for(q=N,z=[],Y=0;Y<q.length;Y++)z[Y]=Y+1;else if(N.length===1&&JXG$1.isArray(N[0]))for(q=N[0],z=[],ne=JXG$1.evaluate(q).length,Y=0;Y<ne;Y++)z[Y]=Y+1;else N.length===2&&(ne=Math.min(N[0].length,N[1].length),z=N[0].slice(0,ne),q=N[1].slice(0,ne));if(JXG$1.isArray(q)&&q.length===0)throw new Error("JSXGraph: Can't create charts without data.");for(ie=G.chartstyle.replace(/ /g,"").split(","),Y=0;Y<ie.length;Y++){switch(ie[Y]){case"bar":W=this.drawBar(v,z,q,G);break;case"line":W=this.drawLine(v,z,q,G);break;case"fit":W=this.drawFit(v,z,q,G);break;case"spline":W=this.drawSpline(v,z,q,G);break;case"pie":W=this.drawPie(v,q,G);break;case"point":W=this.drawPoints(v,z,q,G);break;case"radar":W=this.drawRadar(v,N,G);break}this.elements.push(W)}return this.id=this.board.setId(this,"Chart"),this.elements};JXG$1.Chart.prototype=new GeometryElement;
206JXG$1.extend(JXG$1.Chart.prototype,{drawLine:function(v,N,G,z){return z.fillcolor="none",z.highlightfillcolor="none",v.create("curve",[N,G],z)},drawSpline:function(v,N,G,z){return z.fillColor="none",z.highlightfillcolor="none",v.create("spline",[N,G],z)},drawFit:function(v,N,G,z){var q=z.degree;return q=Math.max(parseInt(q,10),1)||1,z.fillcolor="none",z.highlightfillcolor="none",v.create("functiongraph",[Numerics.regressionPolynomial(q,N,G)],z)},drawBar:function(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe=[],ge=[],ve,be,Ee=function(Je,Ce){return function(){return N[Je]()-Ce*W}},Pe={fixed:!0,withLabel:!1,visible:!1,name:""};if(ve=JXG$1.copyAttributes(z,v.options,"chart"),ve&&ve.width)W=ve.width;else{if(N.length<=1)W=1;else for(W=N[1]-N[0],q=1;q<N.length-1;q++)W=N[q+1]-N[q]<W?N[q+1]-N[q]:W;W*=.8}for(be=JXG$1.copyAttributes(z,v.options,"chart","label"),q=0;q<N.length;q++)JXG$1.isFunction(N[q])?(ie=Ee(q,-.5),ne=Ee(q,0),se=Ee(q,.5)):(ie=N[q]-W*.5,ne=N[q],se=N[q]+W*.5),JXG$1.isFunction(G[q])?ae=G[q]():ae=G[q],ae=G[q],ve.dir==="horizontal"?(ge[0]=v.create("point",[0,ie],Pe),ge[1]=v.create("point",[ae,ie],Pe),ge[2]=v.create("point",[ae,se],Pe),ge[3]=v.create("point",[0,se],Pe),JXG$1.exists(ve.labels)&&JXG$1.exists(ve.labels[q])&&(be.anchorX=function(Je){return Je.X()>=0?"left":"right"},be.anchorY="middle",Y=v.create("text",[ae,ne,ve.labels[q]],be))):(ge[0]=v.create("point",[ie,0],Pe),ge[1]=v.create("point",[ie,ae],Pe),ge[2]=v.create("point",[se,ae],Pe),ge[3]=v.create("point",[se,0],Pe),JXG$1.exists(ve.labels)&&JXG$1.exists(ve.labels[q])&&(be.anchorX="middle",be.anchorY=function(Je){return Je.Y()>=0?"bottom":"top"},Y=v.create("text",[ne,ae,ve.labels[q]],be))),JXG$1.isArray(ve.colors)&&(ce=ve.colors,ve.fillcolor=ce[q%ce.length]),pe[q]=v.create("polygon",ge,ve),JXG$1.exists(ve.labels)&&JXG$1.exists(ve.labels[q])&&(pe[q].text=Y,pe[q].addChild(Y));return pe},drawPoints:function(v,N,G,z){var q,Y=[],W=z.infoboxarray;for(z.fixed=!0,z.name="",q=0;q<N.length;q++)z.infoboxtext=W?W[q%W.length]:!1,Y[q]=v.create("point",[N[q],G[q]],z);return Y},drawPie:function(v,N,G){var z,q,Y=[],W=[],ie=G.colors,ne=G.highlightcolors,se=G.labels,ae=G.radius||4,ce=ae,pe=G.center||[0,0],ge=pe[0],ve=pe[1],be=function(Ve,Re,qe){return function(){var et,Ze,tt,Ke=0;for(Ze=0;Ze<=Ve;Ze++)Ke+=parseFloat(JXG$1.evaluate(N[Ze]));for(et=Ke,Ze=Ve+1;Ze<N.length;Ze++)et+=parseFloat(JXG$1.evaluate(N[Ze]));return tt=et!==0?2*Math.PI*Ke/et:0,ce()*Math[Re](tt)+qe}},Ee=function(Ve,Re){var qe=-this.point1.coords.usrCoords[1]+this.point2.coords.usrCoords[1],et=-this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[2];JXG$1.exists(this.label)&&(this.label.rendNode.style.fontSize=Re*this.label.evalVisProp("fontsize")+"px",this.label.fullUpdate()),this.point2.coords=new Coords(Const.COORDS_BY_USER,[this.point1.coords.usrCoords[1]+qe*Ve,this.point1.coords.usrCoords[2]+et*Ve],this.board),this.fullUpdate()},Pe=function(){this.highlighted||(this.highlighted=!0,this.board.highlightedObjects[this.id]=this,this.board.renderer.highlight(this),Ee.call(this,1.1,2))},Je=function(){this.highlighted&&(this.highlighted=!1,this.board.renderer.noHighlight(this),Ee.call(this,.9090909,1))},Ce={fixed:!0,withLabel:!1,visible:!1,name:""};if(!JXG$1.isArray(se))for(se=[],z=0;z<N.length;z++)se[z]="";for(JXG$1.isFunction(ae)||(ce=function(){return ae}),G.highlightonsector=G.highlightonsector||!1,G.straightfirst=!1,G.straightlast=!1,q=v.create("point",[ge,ve],Ce),Y[0]=v.create("point",[function(){return ce()+ge},function(){return ve}],Ce),z=0;z<N.length;z++)Y[z+1]=v.create("point",[be(z,"cos",ge),be(z,"sin",ve)],Ce),G.name=se[z],G.withlabel=G.name!=="",G.fillcolor=ie&&ie[z%ie.length],G.labelcolor=ie&&ie[z%ie.length],G.highlightfillcolor=ne&&ne[z%ne.length],W[z]=v.create("sector",[q,Y[z],Y[z+1]],G),G.highlightonsector&&(W[z].hasPoint=W[z].hasPointSector),G.highlightbysize&&(W[z].highlight=Pe,W[z].noHighlight=Je);return{sectors:W,points:Y,midpoint:q}},drawRadar:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot,ut,ct,at,st,pt,lt,vt,dt,xt,ft,Et,Ct,Dt,Gt,Ot,It,Bt,Ht=N.length,ir=function(){var tr,bt,_t,Xt,At=this.evalVisProp("label.offset).slice(0");return tr=this.point1.X(),bt=this.point2.X(),_t=this.point1.Y(),Xt=this.point2.Y(),bt<tr&&(At[0]=-At[0]),Xt<_t&&(At[1]=-At[1]),this.setLabelRelativeCoords(At),new Coords(Const.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)},zt=function(tr,bt){var _t,Xt,At;return _t=v.create("transform",[-(Pe[bt]-be[bt]),0],{type:"translate"}),Xt=v.create("transform",[Re/(Je[bt]+Ee[bt]-(Pe[bt]-be[bt])),1],{type:"scale"}),_t.melt(Xt),At=v.create("transform",[tr],{type:"rotate"}),_t.melt(At),_t};if(Ht<=0)throw new Error("JSXGraph radar chart: no data");if(Y=G.paramarray,!JXG$1.exists(Y))throw new Error("JSXGraph radar chart: need paramArray attribute");if(W=Y.length,W<=1)throw new Error("JSXGraph radar chart: need more than one param in paramArray");for(z=0;z<Ht;z++)if(W!==N[z].length)throw new Error("JSXGraph radar chart: use data length equal to number of params ("+N[z].length+" != "+W+")");for(ie=[],ne=[],q=0;q<W;q++)ie[q]=N[0][q],ne[q]=ie[q];for(z=1;z<Ht;z++)for(q=0;q<W;q++)N[z][q]>ie[q]&&(ie[q]=N[z][q]),N[z][q]<ne[q]&&(ne[q]=N[z][q]);for(se=[],ae=[],z=0;z<Ht;z++)se[z]="",ae[z]=[];
206for(ce=[],pe=[],ge=G.startshiftratio||0,ve=G.endshiftratio||0,z=0;z<W;z++)ce[z]=(ie[z]-ne[z])*ge,pe[z]=(ie[z]-ne[z])*ve;if(be=G.startshiftarray||ce,Ee=G.endshiftarray||pe,Pe=G.startarray||ne,JXG$1.exists(G.start))for(z=0;z<W;z++)Pe[z]=G.start;if(Je=G.endarray||ie,JXG$1.exists(G.end))for(z=0;z<W;z++)Je[z]=G.end;if(be.length!==W)throw new Error("JSXGraph radar chart: start shifts length is not equal to number of parameters");if(Ee.length!==W)throw new Error("JSXGraph radar chart: end shifts length is not equal to number of parameters");if(Pe.length!==W)throw new Error("JSXGraph radar chart: starts length is not equal to number of parameters");if(Je.length!==W)throw new Error("JSXGraph radar chart: snds length is not equal to number of parameters");for(Ce=G.labelarray||se,Ve=G.colors,Re=G.radius||10,It=G.strokewidth||1,JXG$1.exists(G.highlightonsector)||(G.highlightonsector=!1),qe={name:G.name,id:G.id,strokewidth:It,polystrokewidth:G.polystrokewidth||It,strokecolor:G.strokecolor||"black",straightfirst:!1,straightlast:!1,fillcolor:G.fillColor||"#FFFF88",fillopacity:G.fillOpacity||.4,highlightfillcolor:G.highlightFillColor||"#FF7400",highlightstrokecolor:G.highlightStrokeColor||"black",gradient:G.gradient||"none"},et=G.center||[0,0],Ze=et[0],tt=et[1],Ke=v.create("point",[Ze,tt],{name:"",fixed:!0,withlabel:!1,visible:!1}),rt=Math.PI/2-Math.PI/W,rt=G.startangle||0,it=rt,ot=[],ut=[],z=0;z<W;z++)for(it+=2*Math.PI/W,at=Re*Math.cos(it)+Ze,st=Re*Math.sin(it)+tt,ot[z]=v.create("point",[at,st],{name:"",fixed:!0,withlabel:!1,visible:!1}),ut[z]=v.create("line",[Ke,ot[z]],{name:Y[z],strokeColor:qe.strokecolor,strokeWidth:qe.strokewidth,strokeOpacity:1,straightFirst:!1,straightLast:!1,withLabel:!0,highlightStrokeColor:qe.highlightstrokecolor}),ut[z].getLabelAnchor=ir,ct=zt(it,z),q=0;q<N.length;q++)Bt=N[q][z],ae[q][z]=v.create("point",[Bt,0],{name:"",fixed:!0,withlabel:!1,visible:!1}),ae[q][z].addTransform(ae[q][z],ct);for(pt=[],z=0;z<Ht;z++)for(qe.labelcolor=Ve&&Ve[z%Ve.length],qe.strokecolor=Ve&&Ve[z%Ve.length],qe.fillcolor=Ve&&Ve[z%Ve.length],pt[z]=v.create("polygon",ae[z],{withLines:!0,withLabel:!1,fillColor:qe.fillcolor,fillOpacity:qe.fillopacity,highlightFillColor:qe.highlightfillcolor}),q=0;q<W;q++)pt[z].borders[q].setAttribute("strokecolor:"+Ve[z%Ve.length]),pt[z].borders[q].setAttribute("strokewidth:"+qe.polystrokewidth);switch(lt=G.legendposition||"none",lt){case"right":dt=G.legendleftoffset||2,xt=G.legendtopoffset||1,this.legend=v.create("legend",[Ze+Re+dt,tt+Re-xt],{labels:Ce,colors:Ve});break;case"none":break;default:JXG$1.debug("Unknown legend position")}if(vt=[],G.showcircles){for(ft=[],z=0;z<6;z++)ft[z]=20*z;if(ft[0]="0",Et=G.circlelabelarray||ft,Ct=Et.length,Ct<2)throw new Error("JSXGraph radar chart: too less circles in circleLabelArray");for(Dt=[],Gt=rt+Math.PI/W,ct=zt(Gt,0),qe.fillcolor="none",qe.highlightfillcolor="none",qe.strokecolor=G.strokecolor||"black",qe.strokewidth=G.circlestrokewidth||.5,qe.layer=0,Ot=(Je[0]-Pe[0])/(Ct-1),z=0;z<Ct;z++)Dt[z]=v.create("point",[Pe[0]+z*Ot,0],{name:Et[z],size:0,fixed:!0,withLabel:!0,visible:!0}),Dt[z].addTransform(Dt[z],ct),vt[z]=v.create("circle",[Ke,Dt[z]],qe)}return this.rendNode=pt[0].rendNode,{circles:vt,lines:ut,points:ae,midpoint:Ke,polygons:pt}},updateRenderer:function(){return this},update:function(){return this.needsUpdate&&this.updateDataArray(),this},updateDataArray:function(){return this}});JXG$1.createChart=function(v,N,G){var z,q,Y,W,ie,ne=[],se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve=JXG$1.isBrowser?v.document.getElementById(N[0]):null;if(N.length===1&&JXG$1.isString(N[0])){if(JXG$1.exists(Ve)){if(pe=JXG$1.copyAttributes(G,v.options,"chart"),Ve=new DataSource().loadFromTable(N[0],pe.withheaders,pe.withheaders),z=Ve.data,ie=Ve.columnHeaders,q=Ve.rowHeaders,ge=pe.width,ve=pe.name,be=pe.strokecolor,Ee=pe.fillcolor,Pe=pe.highlightstrokecolor,Je=pe.highlightfillcolor,v.suspendUpdate(),Ce=z.length,ce=[],pe.rows&&JXG$1.isArray(pe.rows)){for(Y=0;Y<Ce;Y++)for(W=0;W<pe.rows.length;W++)if(pe.rows[W]===Y||pe.withheaders&&pe.rows[W]===q[Y]){ce.push(z[Y]);break}}else ce=z;for(Ce=ce.length,Y=0;Y<Ce;Y++){if(ae=[],pe.chartstyle&&pe.chartstyle.indexOf("bar")!==-1){for(ge?se=ge:se=.8,ae.push(1-se/2+(Y+.5)*se/Ce),W=1;W<ce[Y].length;W++)ae.push(ae[W-1]+1);pe.width=se/Ce}ve&&ve.length===Ce?pe.name=ve[Y]:pe.withheaders&&(pe.name=ie[Y]),be&&be.length===Ce?pe.strokecolor=be[Y]:pe.strokecolor=JXG$1.hsv2rgb((Y+1)/Ce*360,.9,.6),Ee&&Ee.length===Ce?pe.fillcolor=Ee[Y]:
206pe.fillcolor=JXG$1.hsv2rgb((Y+1)/Ce*360,.9,1),Pe&&Pe.length===Ce?pe.highlightstrokecolor=Pe[Y]:pe.highlightstrokecolor=JXG$1.hsv2rgb((Y+1)/Ce*360,.9,1),Je&&Je.length===Ce?pe.highlightfillcolor=Je[Y]:pe.highlightfillcolor=JXG$1.hsv2rgb((Y+1)/Ce*360,.9,.6),pe.chartstyle&&pe.chartstyle.indexOf("bar")!==-1?ne.push(new JXG$1.Chart(v,[ae,ce[Y]],pe)):ne.push(new JXG$1.Chart(v,[ce[Y]],pe))}v.unsuspendUpdate()}return ne}return pe=JXG$1.copyAttributes(G,v.options,"chart"),new JXG$1.Chart(v,N,pe)};JXG$1.registerElement("chart",JXG$1.createChart);JXG$1.Legend=function(v,N,G){var z;if(this.constructor(),z=JXG$1.copyAttributes(G,v.options,"legend"),this.board=v,this.coords=new Coords(Const.COORDS_BY_USER,N,this.board),this.myAtts={},this.label_array=z.labelarray||z.labels,this.color_array=z.colorarray||z.colors,this.opacy_array=z.strokeopacity||[1],this.lines=[],this.myAtts.strokewidth=z.strokewidth||5,this.myAtts.straightfirst=!1,this.myAtts.straightlast=!1,this.myAtts.withlabel=!0,this.myAtts.fixed=!0,this.myAtts.frozen=z.frozen||!1,this.style=z.legendstyle||z.style,this.style==="vertical")this.drawVerticalLegend(v,z);else throw new Error("JSXGraph: Unknown legend style: "+this.style);this.id=this.board.setId(this,"Leg")};JXG$1.Legend.prototype=new GeometryElement;JXG$1.Legend.prototype.drawVerticalLegend=function(v,N){var G,z=N.linelength||1,q=(N.rowheight||20)/this.board.unitY,Y=function(){return this.setLabelRelativeCoords(this.visProp.label.offset),new Coords(Const.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)};for(G=0;G<this.label_array.length;G++)this.myAtts.name=this.label_array[G],this.myAtts.strokecolor=this.color_array[G%this.color_array.length],this.myAtts.highlightstrokecolor=this.color_array[G%this.color_array.length],this.myAtts.strokeopacity=this.opacy_array[G%this.opacy_array.length],this.myAtts.highlightstrokeopacity=this.opacy_array[G%this.opacy_array.length],this.myAtts.label={offset:[10,0],strokeColor:this.color_array[G%this.color_array.length],strokeWidth:this.myAtts.strokewidth},this.lines[G]=v.create("line",[[this.coords.usrCoords[1],this.coords.usrCoords[2]-G*q],[this.coords.usrCoords[1]+z,this.coords.usrCoords[2]-G*q]],this.myAtts),this.myAtts.frozen&&this.lines[G].setAttribute({point1:{frozen:!0},point2:{frozen:!0}}),this.lines[G].getLabelAnchor=Y,this.lines[G].prepareUpdate().update().updateVisibility(this.lines[G].evalVisProp("visible")).updateRenderer(),this.addChild(this.lines[G])};JXG$1.createLegend=function(v,N,G){var z=[0,0];if(JXG$1.exists(N)&&N.length===2)z=N;else throw new Error("JSXGraph: Legend element needs two numbers as parameters");return new JXG$1.Legend(v,z,G)};JXG$1.registerElement("legend",JXG$1.createLegend);JXG$1.Chart,JXG$1.Legend;JXG$1.Transformation=function(v,N,G,z){this.elementClass=Const.OBJECT_CLASS_OTHER,this.type=Const.OBJECT_TYPE_TRANSFORMATION,z?(this.is3D=!0,this.matrix=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]):(this.is3D=!1,this.matrix=[[1,0,0],[0,1,0],[0,0,1]]),this.board=v,this.isNumericMatrix=!1,this.is3D?this.setMatrix3D(G[0],N,G.slice(1)):this.setMatrix(v,N,G),this.methodMap={apply:"apply",applyOnce:"applyOnce",bindTo:"bindTo",bind:"bindTo",melt:"melt",meltTo:"meltTo"}};JXG$1.Transformation.prototype={};JXG$1.extend(JXG$1.Transformation.prototype,{update:function(){return this},setMatrix:function(v,N,G){var z;for(this.isNumericMatrix=!0,z=0;z<G.length;z++)if(typeof G[z]!="number"){this.isNumericMatrix=!1;break}if(N==="translate"){if(G.length!==2)throw new Error("JSXGraph: translate transformation needs 2 parameters.");this.evalParam=JXG$1.createEvalFunction(v,G,2),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1)}}else if(N==="scale"){if(G.length!==2)throw new Error("JSXGraph: scale transformation needs 2 parameters.");this.evalParam=JXG$1.createEvalFunction(v,G,2),this.update=function(){this.matrix[1][1]=this.evalParam(0),this.matrix[2][2]=this.evalParam(1)}}else if(N==="reflect")G.length<4&&(G[0]=v.select(G[0])),G.length===2&&(G[1]=v.select(G[1])),G.length===4&&(this.evalParam=JXG$1.createEvalFunction(v,G,4)),this.update=function(){var q,Y,W,ie,ne,se,ae,ce;G.length===1?ae=G[0].stdform:G.length===2?ae=Mat.crossProduct(G[1].coords.usrCoords,G[0].coords.usrCoords):G.length===4&&(ae=Mat.crossProduct([1,this.evalParam(2),this.evalParam(3)],[1,this.evalParam(0),this.evalParam(1)])),q=ae[1],Y=ae[2],W=ae[0],ce=[-W*q,-W*Y,q*q+Y*Y],se=ce[2],ie=ce[0]/ce[2],ne=ce[1]/ce[2],q=-ae[2],Y=ae[1],this.matrix[
2061][1]=(q*q-Y*Y)/se,this.matrix[1][2]=2*q*Y/se,this.matrix[2][1]=this.matrix[1][2],this.matrix[2][2]=-this.matrix[1][1],this.matrix[1][0]=ie*(1-this.matrix[1][1])-ne*this.matrix[1][2],this.matrix[2][0]=ne*(1-this.matrix[2][2])-ie*this.matrix[2][1]};else if(N==="rotate")G.length===3?this.evalParam=JXG$1.createEvalFunction(v,G,3):G.length>0&&G.length<=2&&(this.evalParam=JXG$1.createEvalFunction(v,G,1),G.length===2&&!JXG$1.isArray(G[1])&&(G[1]=v.select(G[1]))),this.update=function(){var q,Y,W=this.evalParam(0),ie=Math.cos(W),ne=Math.sin(W);this.matrix[1][1]=ie,this.matrix[1][2]=-ne,this.matrix[2][1]=ne,this.matrix[2][2]=ie,G.length>1&&(G.length===3?(q=this.evalParam(1),Y=this.evalParam(2)):JXG$1.isArray(G[1])?(q=G[1][0],Y=G[1][1]):(q=G[1].X(),Y=G[1].Y()),this.matrix[1][0]=q*(1-ie)+Y*ne,this.matrix[2][0]=Y*(1-ie)-q*ne)};else if(N==="shear"){if(G.length!==2)throw new Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=JXG$1.createEvalFunction(v,G,2),this.update=function(){this.matrix[1][2]=this.evalParam(0),this.matrix[2][1]=this.evalParam(1)}}else if(N==="generic"){if(G.length!==9)throw new Error("JSXGraph: generic transformation needs 9 parameters.");this.evalParam=JXG$1.createEvalFunction(v,G,9),this.update=function(){this.matrix[0][0]=this.evalParam(0),this.matrix[0][1]=this.evalParam(1),this.matrix[0][2]=this.evalParam(2),this.matrix[1][0]=this.evalParam(3),this.matrix[1][1]=this.evalParam(4),this.matrix[1][2]=this.evalParam(5),this.matrix[2][0]=this.evalParam(6),this.matrix[2][1]=this.evalParam(7),this.matrix[2][2]=this.evalParam(8)}}else if(N==="matrix"){if(G.length!==1)throw new Error("JSXGraph: transformation of type 'matrix' needs 1 parameter.");this.evalParam=G[0].slice(),this.update=function(){var q,Y;for(q=0;q<3;q++)for(Y=0;Y<3;Y++)this.matrix[q][Y]=JXG$1.evaluate(this.evalParam[q][Y])}}},setMatrix3D:function(v,N,G){var z,q=v.board;for(this.isNumericMatrix=!0,z=0;z<G.length;z++)if(typeof G[z]!="number"){this.isNumericMatrix=!1;break}if(N==="translate"){if(G.length!==3)throw new Error("JSXGraph: 3D translate transformation needs 3 parameters.");this.evalParam=JXG$1.createEvalFunction(q,G,3),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1),this.matrix[3][0]=this.evalParam(2)}}else if(N==="scale"){if(G.length!==3&&G.length!==4)throw new Error("JSXGraph: 3D scale transformation needs either 3 or 4 parameters.");this.evalParam=JXG$1.createEvalFunction(q,G,3),this.update=function(){var Y=this.evalParam(0),W=this.evalParam(1),ie=this.evalParam(2);this.matrix[1][1]=Y,this.matrix[2][2]=W,this.matrix[3][3]=ie}}else N==="rotateX"?(G.length>0&&G.length<=2&&(this.evalParam=JXG$1.createEvalFunction(q,G,1)),this.update=function(){var Y=this.evalParam(0),W=Math.cos(Y),ie=Math.sin(Y);this.matrix[2][2]=W,this.matrix[2][3]=-ie,this.matrix[3][2]=ie,this.matrix[3][3]=W}):N==="rotateY"?(G.length>0&&G.length<=2&&(this.evalParam=JXG$1.createEvalFunction(q,G,1)),this.update=function(){var Y=this.evalParam(0),W=Math.cos(Y),ie=Math.sin(Y);this.matrix[1][1]=W,this.matrix[1][3]=ie,this.matrix[3][1]=-ie,this.matrix[3][3]=W}):N==="rotateZ"?(G.length>0&&G.length<=2&&(this.evalParam=JXG$1.createEvalFunction(q,G,1)),this.update=function(){var Y=this.evalParam(0),W=Math.cos(Y),ie=Math.sin(Y);this.matrix[1][1]=W,this.matrix[1][2]=-ie,this.matrix[2][1]=ie,this.matrix[2][2]=W}):N==="rotate"&&(G.length===2&&(this.evalParam=JXG$1.createEvalFunction(q,G,2)),this.update=function(){var Y=this.evalParam(0),W=this.evalParam(1),ie=Math.cos(Y),ne=Math.sin(Y),se,ae,ce,pe=Mat.norm(W);W.length===3?(se=W[0]/pe,ae=W[1]/pe,ce=W[2]/pe):(se=W[1]/pe,ae=W[2]/pe,ce=W[3]/pe),this.matrix=[[1,0,0,0],[0,se*se*(1-ie)+ie,se*ae*(1-ie)-ce*ne,se*ce*(1-ie)+ae*ne],[0,ae*se*(1-ie)+ce*ne,ae*ae*(1-ie)+ie,ae*ce*(1-ie)-se*ne],[0,ce*se*(1-ie)-ae*ne,ce*ae*(1-ie)+se*ne,ce*ce*(1-ie)+ie]]})},apply:function(v,N){var G;return this.update(),this.is3D?G=v.coords:JXG$1.exists(N)?G=v.initialCoords.usrCoords:G=v.coords.usrCoords,Mat.matVecMult(this.matrix,G)},applyOnce:function(v){var N,G,z;for(JXG$1.isArray(v)||(v=[v]),G=v.length,z=0;z<G;z++)this.update(),this.is3D?v[z].coords=Mat.matVecMult(this.matrix,v[z].coords):(N=Mat.matVecMult(this.matrix,v[z].coords.usrCoords),v[z].coords.setCoordinates(Const.COORDS_BY_USER,N))},bindTo:function(v){var N,G;if(JXG$1.isArray(v))for(G=v.length,N=0;N<G;N++)v[N].transformations.push(this);else v.transformations.push(this)},meltTo:function(v){var N,G,z;if(JXG$1.isArray(v))for(N=0;N<v.length;N++)this.meltTo(v[N]);else G=v.transformations,G.length>0&&G[G.length-1].isNumericMatrix&&this.isNumericMatrix?G[G.length-1].melt(this):(z=this.clone(),G.push(z))},clone:function(){var v=null;return this.isNumericMatrix&&(v=new JXG$1.Transformation(this.board,"none",[]),v.matrix=this.matrix.slice()),v},setProperty:function(v){JXG$1.deprecated("Transformation.setProperty()","Transformation.setAttribute()")},setAttribute:function(v){},melt:function(v){var N=[];
206return this.update(),v.update(),N=Mat.matMatMult(v.matrix,this.matrix),this.update=function(){this.matrix=N},this},getParents:function(){var v=[[].concat.apply([],this.matrix)];return this.parents.length!==0&&(v=this.parents),v}});JXG$1.createTransform=function(v,N,G){return new JXG$1.Transformation(v,G.type,N)};JXG$1.registerElement("transform",JXG$1.createTransform);JXG$1.createTransform3D=function(v,N,G){return new JXG$1.Transformation(v,G.type,N,!0)};JXG$1.registerElement("transform3d",JXG$1.createTransform3D);JXG$1.Transformation;JXG$1.Turtle=function(v,N,G){var z,q,Y;return this.constructor(v,G,Const.OBJECT_TYPE_TURTLE,Const.OBJECT_CLASS_OTHER),this.turtleIsHidden=!1,this.board=v,this.visProp.curveType="plot",this._attributes=JXG$1.copyAttributes(this.visProp,v.options,"turtle"),delete this._attributes.id,z=0,q=0,Y=90,N.length!==0&&(N.length===3?(z=N[0],q=N[1],Y=N[2]):N.length===2?JXG$1.isArray(N[0])?(z=N[0][0],q=N[0][1],Y=N[1]):(z=N[0],q=N[1]):(z=N[0][0],q=N[0][1])),this.init(z,q,Y),this.methodMap=JXG$1.deepCopy(this.methodMap,{forward:"forward",fd:"forward",back:"back",bk:"back",right:"right",rt:"right",left:"left",lt:"left",penUp:"penUp",pu:"penUp",up:"penUp",penDown:"penDown",pd:"penDown",down:"penDown",clearScreen:"clearScreen",cs:"clearScreen",clean:"clean",setPos:"setPos",home:"home",hideTurtle:"hideTurtle",ht:"hideTurtle",hide:"hideTurtle",showTurtle:"showTurtle",st:"showTurtle",show:"showTurtle",penSize:"setPenSize",setPenSize:"setPenSize",penColor:"setPenColor",setPenColor:"setPenColor",highlightPenColor:"setHighlightPenColor",setHighlightPenColor:"setHighlightPenColor",getPenColor:"getPenColor",Color:"getPenColor",getHighlightPenColor:"getHighlightPenColor",HighlightColor:"getHighlightPenColor",getPenSize:"getPenSize",Size:"getPenSize",pushTurtle:"pushTurtle",push:"pushTurtle",popTurtle:"popTurtle",pop:"popTurtle",lookTo:"lookTo",pos:"pos",Pos:"pos",moveTo:"moveTo",X:"X",Y:"Y"}),this};JXG$1.Turtle.prototype=new GeometryElement;JXG$1.extend(JXG$1.Turtle.prototype,{init:function(v,N,G){var z={fixed:!0,name:"",visible:!1,withLabel:!1};this.arrowLen=20/Mat.hypot(this.board.unitX,this.board.unitY),this.pos=[v,N],this.isPenDown=!0,this.dir=90,this.stack=[],this.objects=[],this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.turtle=this.board.create("point",this.pos,z),this.objects.push(this.turtle),this.turtle2=this.board.create("point",[this.pos[0],this.pos[1]+this.arrowLen],z),this.objects.push(this.turtle2),this.visProp.arrow.lastArrow=!0,this.visProp.arrow.straightFirst=!1,this.visProp.arrow.straightLast=!1,this.arrow=this.board.create("line",[this.turtle,this.turtle2],this.visProp.arrow),this.objects.push(this.arrow),this.subs={arrow:this.arrow},this.inherits.push(this.arrow),this.right(90-G),this.board.update()},forward:function(v){if(v===0)return this;var N,G=v*Math.cos(this.dir*Math.PI/180),z=v*Math.sin(this.dir*Math.PI/180);return this.turtleIsHidden||(N=this.board.create("transform",[G,z],{type:"translate"}),N.applyOnce(this.turtle),N.applyOnce(this.turtle2)),this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]+=G,this.pos[1]+=z,this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update(),this},back:function(v){return this.forward(-v)},right:function(v){if(this.dir-=v,this.dir%=360,!this.turtleIsHidden){var N=this.board.create("transform",[-v*Math.PI/180,this.turtle],{type:"rotate"});N.applyOnce(this.turtle2)}return this.board.update(),this},left:function(v){return this.right(-v)},penUp:function(){return this.isPenDown=!1,this},penDown:function(){return this.isPenDown=!0,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this},clean:function(){var v,N;for(v=0;v<this.objects.length;v++)N=this.objects[v],N.type===Const.OBJECT_TYPE_CURVE&&(this.board.removeObject(N),this.objects.splice(v,1));return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.board.update(),this},clearScreen:function(){var v,N,G=this.objects.length;for(v=0;v<G;v++)N=this.objects[v],this.board.removeObject(N);return this.init(0,0,90),this},setPos:function(v,N){var G;return JXG$1.isArray(v)?this.pos=v:this.pos=[v,N],this.turtleIsHidden||(this.turtle.setPositionDirectly(Const.COORDS_BY_USER,[v,N]),this.turtle2.setPositionDirectly(Const.COORDS_BY_USER,[v,N+this.arrowLen]),G=this.board.create("transform",[-(this.dir-90)*Math.PI/180,this.turtle],{type:"rotate"}),G.applyOnce(this.turtle2)),this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.board.update(),this},setPenSize:function(v){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("strokeWidth",v)),this.objects.push(this.curve),this},setPenColor:function(v){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("strokeColor",v)),this.objects.push(this.curve),this},getPenAttribute:function(v){var N,G=this.objects.length;return G===4?N=0:N=G-1,this.objects[N].evalVisProp(v)},getPenSize:function(){return this.getPenAttribute("strokewidth")},getPenColor:function(){return this.getPenAttribute("strokecolor")},getHighlightPenColor:function(){return this.getPenAttribute("highlightstrokecolor")},setHighlightPenColor:function(v){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("highlightStrokeColor",v)),this.objects.push(this.curve),this},setAttribute:function(v){var N,G,z,q=this.objects.length;for(N=0;N<q;N++)G=this.objects[N],G.type===Const.OBJECT_TYPE_CURVE&&G.setAttribute(v);return z=this.visProp.id,this.visProp=JXG$1.deepCopy(this.curve.visProp),this.visProp.id=z,this._attributes=JXG$1.deepCopy(this.visProp),delete this._attributes.id,this},copyAttr:function(v,N){return this._attributes[v.toLowerCase()]=N,this._attributes},showTurtle:function(){return this.turtleIsHidden=!1,this.arrow.setAttribute({visible:!0}),this.visProp.arrow.visible=!1,this.setPos(this.pos[0],this.pos[1]),this.board.update(),this},hideTurtle:function(){return this.turtleIsHidden=!0,this.arrow.setAttribute({visible:!1}),this.visProp.arrow.visible=!1,this.board.update(),this},home:function(){return this.pos=[0,0],this.setPos(this.pos[0],this.pos[1]),this},pushTurtle:function(){return this.stack.push([this.pos[0],this.pos[1],this.dir]),this},popTurtle:function(){var v=this.stack.pop();return this.pos[0]=v[0],this.pos[1]=v[1],this.dir=v[2],this.setPos(this.pos[0],this.pos[1]),this},lookTo:function(v){var N,G,z,q,Y;return JXG$1.isArray(v)?(N=this.pos[0],G=this.pos[1],z=v[0],q=v[1],Y=Math.atan2(q-G,z-N),this.right(this.dir-Y*180/Math.PI)):JXG$1.isNumber(v)&&this.right(this.dir-v),this},moveTo:function(v){var N,G,z;return JXG$1.isArray(v)&&(N=v[0]-this.pos[0],G=v[1]-this.pos[1],this.turtleIsHidden||(z=this.board.create("transform",[N,G],{type:"translate"}),z.applyOnce(this.turtle),z.applyOnce(this.turtle2)),this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]=v[0],this.pos[1]=v[1],this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update()),this},fd:function(v){return this.forward(v)},bk:function(v){return this.back(v)},lt:function(v){return this.left(v)},rt:function(v){return this.right(v)},pu:function(){return this.penUp()},pd:function(){return this.penDown()},ht:function(){return this.hideTurtle()},st:function(){return this.showTurtle()},cs:function(){return this.clearScreen()},push:function(){return this.pushTurtle()},pop:function(){return this.popTurtle()},evalAt:function(v,N){var G,z,q,Y,W=this.objects.length;for(G=0,z=0;G<W;G++)if(q=this.objects[G],q.elementClass===Const.OBJECT_CLASS_CURVE){
206if(z<=v&&v<z+q.numberPoints)return Y=v-z,q[N](Y);z+=q.numberPoints}return this[N]()},X:function(v){return JXG$1.exists(v)?this.evalAt(v,"X"):this.pos[0]},Y:function(v){return JXG$1.exists(v)?this.evalAt(v,"Y"):this.pos[1]},Z:function(v){return 1},minX:function(){return 0},maxX:function(){var v,N,G=this.objects.length,z=0;for(v=0;v<G;v++)N=this.objects[v],N.elementClass===Const.OBJECT_CLASS_CURVE&&(z+=this.objects[v].numberPoints);return z},hasPoint:function(v,N){var G,z;for(G=0;G<this.objects.length;G++)if(z=this.objects[G],z.type===Const.OBJECT_TYPE_CURVE&&z.hasPoint(v,N))return!0;return!1}});JXG$1.createTurtle=function(v,N,G){var z;return N=N||[],z=JXG$1.copyAttributes(G,v.options,"turtle"),new JXG$1.Turtle(v,N,z)};JXG$1.registerElement("turtle",JXG$1.createTurtle);JXG$1.Turtle;JXG$1.Ticks=function(v,N,G){if(this.constructor(v.board,G,Const.OBJECT_TYPE_TICKS,Const.OBJECT_CLASS_OTHER),this.line=v,this.board=this.line.board,this.fixedTicks=null,this.equidistant=!1,this.labelsData=[],JXG$1.isFunction(N))throw this.ticksFunction=N,new Error("Function arguments are no longer supported.");JXG$1.isArray(N)?this.fixedTicks=N:this.equidistant=!0,this.ticks=[],this.labels=[],this.labelCounter=0,this.id=this.line.addTicks(this),this.elType="ticks",this.inherits.push(this.labels),this.board.setId(this,"Ti")};JXG$1.Ticks.prototype=new GeometryElement;JXG$1.extend(JXG$1.Ticks.prototype,{hasPoint:function(v,N){var G,z,q,Y,W=this.ticks&&this.ticks.length||0;if(!this.line.evalVisProp("scalable")||this.line.elementClass===Const.OBJECT_CLASS_CURVE||(JXG$1.isObject(this.evalVisProp("precision"))?(Y=this.board._inputDevice,q=this.evalVisProp("precision."+Y)):q=this.board.options.precision.hasPoint,q+=this.evalVisProp("strokewidth")*.5,this.line.stdform[1]!==0&&this.line.stdform[2]!==0&&this.line.type!==Const.OBJECT_TYPE_AXIS))return!1;for(G=0;G<W;G++)if(z=this.ticks[G],z[2]&&!(this.line.stdform[1]===0&&Math.abs(z[0][0]-this.line.point1.coords.scrCoords[1])<Mat.eps||this.line.stdform[2]===0&&Math.abs(z[1][0]-this.line.point1.coords.scrCoords[2])<Mat.eps)&&(Math.abs(z[0][0]-z[0][1])>=1||Math.abs(z[1][0]-z[1][1])>=1)){if(this.line.stdform[1]===0){if(Math.abs(N-this.line.point1.coords.scrCoords[2])<2*q&&z[0][0]-q<v&&v<z[0][1]+q)return!0}else if(this.line.stdform[2]===0&&Math.abs(v-this.line.point1.coords.scrCoords[1])<2*q&&z[1][0]-q<N&&N<z[1][1]+q)return!0}return!1},setPositionDirectly:function(v,N,G){var z,q,Y=new Coords(v,N,this.board),W=new Coords(v,G,this.board),ie=this.board.getBoundingBox();return this.line.type!==Const.OBJECT_TYPE_AXIS||!this.line.evalVisProp("scalable")?this:(Math.abs(this.line.stdform[1])<Mat.eps&&Math.abs(Y.usrCoords[1]*W.usrCoords[1])>Mat.eps?(z=W.usrCoords[1]/Y.usrCoords[1],ie[0]*=z,ie[2]*=z,this.board.setBoundingBox(ie,this.board.keepaspectratio,"update")):Math.abs(this.line.stdform[2])<Mat.eps&&Math.abs(Y.usrCoords[2]*W.usrCoords[2])>Mat.eps&&(q=W.usrCoords[2]/Y.usrCoords[2],ie[3]*=q,ie[1]*=q,this.board.setBoundingBox(ie,this.board.keepaspectratio,"update")),this)},calculateTicksCoordinates:function(){var v,N,G,z;if(!(this.line.elementClass===Const.OBJECT_CLASS_LINE&&(this.setTicksSizeVariables(),Math.abs(this.dx)<Mat.eps&&Math.abs(this.dy)<Mat.eps)))return v=this.getZeroCoordinates(),this.line.elementClass===Const.OBJECT_CLASS_LINE?N=this.getLowerAndUpperBounds(v,"ticksdistance"):N={lower:this.line.minX(),upper:this.line.maxX(),a1:0,a2:0,m1:0,m2:0},this.evalVisProp("type")==="polar"&&(z=this.board.getBoundingBox(),G=Math.max(Mat.hypot(z[0],z[1]),Mat.hypot(z[2],z[3])),N.upper=G),this.ticks=[],this.labelsData=[],this.equidistant?this.generateEquidistantTicks(v,N):this.generateFixedTicks(v,N),this},setTicksSizeVariables:function(v){var N,G,z,q,Y=this.evalVisProp("majorheight")*.5,W=this.evalVisProp("minorheight")*.5;JXG$1.exists(v)?(G=this.line.minX(),z=this.line.maxX(),q=this.line.points.length,q<2?(this.dxMaj=0,this.dyMaj=0):Mat.relDif(v,G)<Mat.eps?(this.dxMaj=this.line.points[0].usrCoords[2]-this.line.points[1].usrCoords[2],this.dyMaj=this.line.points[1].usrCoords[1]-this.line.points[0].usrCoords[1]):Mat.relDif(v,z)<Mat.eps?(this.dxMaj=this.line.points[q-2].usrCoords[2]-this.line.points[q-1].usrCoords[2],this.dyMaj=this.line.points[q-1].usrCoords[1]-this.line.points[q-2].usrCoords[1]):(this.dxMaj=-Numerics.D(this.line.Y)(v),this.dyMaj=Numerics.D(this.line.X)(v))):(this.dxMaj=this.line.stdform[1],this.dyMaj=this.line.stdform[2]),this.dxMin=this.dxMaj,this.dyMin=this.dyMaj,this.dx=this.dxMaj,this.dy=this.dyMaj,N=Mat.hypot(this.dxMaj*this.board.unitX,this.dyMaj*this.board.unitY),this.dxMaj*=Y/N*this.board.unitX,this.dyMaj*=Y/N*this.board.unitY,this.dxMin*=W/N*this.board.unitX,this.dyMin*=W/N*this.board.unitY,this.minStyle=this.evalVisProp("minorheight")<0?"infinite":"finite",this.majStyle=this.evalVisProp("majorheight")<0?"infinite":"finite"},getZeroCoordinates:function(){var v,N,G,z,q,Y,W,ie,ne,se=this.evalVisProp("anchor");return this.line.elementClass===Const.OBJECT_CLASS_LINE?this.line.type===Const.OBJECT_TYPE_AXIS?Geometry.projectPointToLine({coords:{usrCoords:[1,0,0]}},this.line,this.board):(G=this.line.point1.coords.usrCoords[0],v=this.line.point1.coords.usrCoords[1],N=this.line.point1.coords.usrCoords[2],Y=this.line.point2.coords.usrCoords[0],z=this.line.point2.coords.usrCoords[1],q=this.line.point2.coords.usrCoords[2],se==="right"?this.line.point2.coords:se==="middle"?new Coords(Const.COORDS_BY_USER,[(G+Y)*.5,(v+z)*.5,(N+q)*.5],this.board):JXG$1.isNumber(se)?new Coords(Const.COORDS_BY_USER,[G+(Y-G)*se,v+(z-v)*se,N+(q-N)*se],this.board):this.line.point1.coords):(ie=this.line.minX(),ne=this.line.maxX(),se==="right"?W=ne:se==="middle"?W=(ie+ne)*.5:JXG$1.isNumber(se)?W=ie*(1-se)+ne*se:W=ie,W)},getLowerAndUpperBounds:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe=Mat.eps*10,Je=this.line.evalVisProp("straightfirst"),Ce=this.line.evalVisProp("straightlast"),Ve=this.evalVisProp("includeboundaries");return this.line.elementClass===Const.OBJECT_CLASS_CURVE?{lower:this.line.minX(),upper:this.line.maxX()}:(W=new Coords(Const.COORDS_BY_USER,this.line.point1.coords.usrCoords,this.board),ie=new Coords(Const.COORDS_BY_USER,this.line.point2.coords.usrCoords,this.board),ne=Math.abs(W.usrCoords[0])>
206=Mat.eps&&W.scrCoords[1]>=0&&W.scrCoords[1]<=this.board.canvasWidth&&W.scrCoords[2]>=0&&W.scrCoords[2]<=this.board.canvasHeight,se=Math.abs(ie.usrCoords[0])>=Mat.eps&&ie.scrCoords[1]>=0&&ie.scrCoords[1]<=this.board.canvasWidth&&ie.scrCoords[2]>=0&&ie.scrCoords[2]<=this.board.canvasHeight,JXG$1.exists(N)&&N==="ticksdistance"?(Geometry.calcStraight(this.line,W,ie,0),be=this.getDistanceFromZero(v,W),Ee=this.getDistanceFromZero(v,ie),Geometry.calcStraight(this.line,W,ie,this.line.evalVisProp("margin")),be=this.getDistanceFromZero(v,W)-be,Ee=this.getDistanceFromZero(v,ie).m2):Geometry.calcLineDelimitingPoints(this.line,W,ie),q=this.line.evalVisProp("firstarrow"),Y=this.line.evalVisProp("lastarrow"),ge=this.getDistanceFromZero(v,W),ve=this.getDistanceFromZero(v,ie),(q||Y)&&(pe=this.board.renderer.getArrowHeadData(this.line,this.line.evalVisProp("strokewidth"),""),this.board.renderer.getPositionArrowHead(this.line,W,ie,pe)),ae=this.getDistanceFromZero(v,W),ce=this.getDistanceFromZero(v,ie),ge=ae-ge,ve=ae-ve,ae<ce?(G=ae,z=ce,!Je&&ne&&!Ve&&(G+=Pe),!Ce&&se&&!Ve&&(z-=Pe)):ce<ae?(G=ce,z=ae,!Ce&&se&&!Ve&&(G+=Pe),!Je&&ne&&!Ve&&(z-=Pe)):(G=0,z=0),{lower:G,upper:z,a1:ge,a2:ve,m1:be,m2:Ee})},getDistanceFromZero:function(v,N){var G,z,q,Y,W;return G=this.line.point1.coords,z=this.line.point2.coords,W=v.distance(Const.COORDS_BY_USER,N),q=[z.usrCoords[0]-G.usrCoords[0],z.usrCoords[1]-G.usrCoords[1],z.usrCoords[2]-G.usrCoords[2]],Y=[N.usrCoords[0]-v.usrCoords[0],N.usrCoords[1]-v.usrCoords[1],N.usrCoords[2]-v.usrCoords[2]],Mat.innerProduct(q,Y,3)<0&&(W*=-1),W},generateEquidistantTicks:function(v,N){var G,z=Mat.eps,q,Y,W=this.evalVisProp("minorticks");if(Y=this.getDistanceMajorTicks(),this.line.elementClass===Const.OBJECT_CLASS_LINE&&(q=this.getXandYdeltas()),Y*=this.evalVisProp("scale"),Y/=W+1,this.ticksDelta=Y,!(Y<Mat.eps)){if(Math.abs(N.upper-N.lower)>Y*2048){JXG$1.warn("JSXGraph ticks: too many ticks (>2048). Please increase ticksDistance.");return}for(G=0,this.evalVisProp("drawzero")||(G=Y),G<N.lower&&(G=Math.floor((N.lower-z)/Y)*Y);G<=N.upper+z&&(G>=N.lower-z&&this.processTickPosition(v,G,Y,q),G+=Y,!(N.upper-G>Y*1e4)););for(G=-Y,G>N.upper&&(G=Math.ceil((N.upper+z)/-Y)*-Y);G>=N.lower-z&&(G<=N.upper+z&&this.processTickPosition(v,G,Y,q),G-=Y,!(G-N.lower>Y*1e4)););}},getDistanceMajorTicks:function(){var v,N,G,z,q,Y,W=5,ie,ne,se;return this.evalVisProp("insertticks")?(G=this.getLowerAndUpperBounds(this.getZeroCoordinates(),""),q=G.upper-G.lower,Y=this.evalVisProp("scale"),ie=q/(W+1)/Y,ne=this.evalVisProp("minticksdistance")/Y,se=this.evalVisProp("minorticks"),z=this.getXandYdeltas(),z.x*=this.board.unitX,z.y*=this.board.unitY,ne/=Mat.hypot(z.x,z.y),ne*=se+1,v=Math.pow(10,Math.floor(Math.log(ne)/Math.LN10)),2*v>=ne?v*=2:5*v>=ne&&(v*=5),N=Math.pow(10,Math.floor(Math.log(ie)/Math.LN10)),5*N<ie?N*=5:2*N<ie&&(N*=2),v=Math.max(v,N),v):this.evalVisProp("ticksdistance")},processTickPosition:function(v,N,G,z){var q,Y,W,ie,ne,se=this.evalVisProp("ticksperlabel"),ae=null;this.line.elementClass===Const.OBJECT_CLASS_LINE?(q=v.usrCoords[1]+N*z.x,Y=v.usrCoords[2]+N*z.y):(q=this.line.X(v+N),Y=this.line.Y(v+N)),W=new Coords(Const.COORDS_BY_USER,[q,Y],this.board),this.line.elementClass===Const.OBJECT_CLASS_CURVE&&(ae=v+N,this.setTicksSizeVariables(ae)),W.major=Math.round(N/G)%(this.evalVisProp("minorticks")+1)===0,se||(se=this.evalVisProp("minorticks")+1),ne=Math.round(N/G)%se===0,ie=this.createTickPath(W,W.major),ie.length===3&&(this.ticks.push(ie),ne&&this.evalVisProp("drawlabels")?this.labelsData.push(this.generateLabelData(this.generateLabelText(W,v,ae),W,this.ticks.length)):this.labelsData.push(null))},generateFixedTicks:function(v,N){var G,z,q,Y,W,ie,ne=Mat.eps,se,ae=JXG$1.isArray(this.visProp.labels),ce,pe=this.evalVisProp("drawlabels");for(this.line.elementClass===Const.OBJECT_CLASS_LINE&&(ce=this.getXandYdeltas()),q=0;q<this.fixedTicks.length;q++)this.line.elementClass===Const.OBJECT_CLASS_LINE?(se=this.fixedTicks[q],W=v.usrCoords[1]+se*ce.x,ie=v.usrCoords[2]+se*ce.y):(se=v+this.fixedTicks[q],W=this.line.X(se),ie=this.line.Y(se)),G=new Coords(Const.COORDS_BY_USER,[W,ie],this.board),this.line.elementClass===Const.OBJECT_CLASS_CURVE&&this.setTicksSizeVariables(se),Y=this.createTickPath(G,!0),Y.length===3&&se>
206=N.lower-ne&&se<=N.upper+ne&&(this.ticks.push(Y),pe&&(ae||JXG$1.exists(this.visProp.labels[q]))?(z=ae?this.evalVisProp("labels."+q):se,this.labelsData.push(this.generateLabelData(this.generateLabelText(G,v,z),G,q))):this.labelsData.push(null))},getXandYdeltas:function(){var v,N,G=this.line.point1.Dist(this.line.point2);return v=this.line.point1.coords.usrCoords,N=this.line.point2.coords.usrCoords,{x:(N[1]-v[1])/G,y:(N[2]-v[2])/G}},_isInsideCanvas:function(v,N,G){var z=this.board.canvasWidth,q=this.board.canvasHeight;return G===void 0&&(G=0),v[0]>=G&&v[0]<=z-G&&N[0]>=G&&N[0]<=q-G||v[1]>=G&&v[1]<=z-G&&N[1]>=G&&N[1]<=q-G},createTickPath:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce=[-2e6,-2e6],pe=[-2e6,-2e6],ge,ve,be,Ee,Pe,Je,Ce,Ve,Re;if(G=v.scrCoords,N?(Y=this.dxMaj,W=this.dyMaj,ae=this.majStyle,Ce=this.evalVisProp("majortickendings.0")>0,Ve=this.evalVisProp("majortickendings.1")>0):(Y=this.dxMin,W=this.dyMin,ae=this.minStyle,Ce=this.evalVisProp("tickendings.0")>0,Ve=this.evalVisProp("tickendings.1")>0),z=[-W*G[1]-Y*G[2],W,Y],N&&this.evalVisProp("type")==="polar"){if(Ee=this.board.getBoundingBox(),Pe=2*Math.PI,Je=Pe/180,G=v.usrCoords,ve=Mat.hypot(G[1],G[2]),be=Math.max(Mat.hypot(Ee[0],Ee[1]),Mat.hypot(Ee[2],Ee[3])),ve<be){for(ce=[],pe=[],ge=0;ge<=Pe;ge+=Je)ce.push(this.board.origin.scrCoords[1]+ve*Math.cos(ge)*this.board.unitX),pe.push(this.board.origin.scrCoords[2]+ve*Math.sin(ge)*this.board.unitY);return[ce,pe,N]}}else{if(ae==="infinite"){if(this.evalVisProp("ignoreinfinitetickendings")&&(Ce=Ve=!0),q=Geometry.meetLineBoard(z,this.board),Ce&&Ve)ce[0]=q[0].scrCoords[1],ce[1]=q[1].scrCoords[1],pe[0]=q[0].scrCoords[2],pe[1]=q[1].scrCoords[2];else if(Re=[Mat.innerProduct(q[0].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0],Mat.innerProduct(q[1].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0]],Re[0]<Re[1]&&(q.reverse(),Re.reverse()),Ce){if(Re[0]<0)return[];Re[1]<0?(ce[0]=q[0].scrCoords[1],pe[0]=q[0].scrCoords[2],ce[1]=G[1],pe[1]=G[2]):(ce[0]=q[0].scrCoords[1],pe[0]=q[0].scrCoords[2],ce[1]=q[1].scrCoords[1],pe[1]=q[1].scrCoords[2])}else if(Ve){if(Re[1]>0)return[];Re[0]>0?(ce[0]=G[1],pe[0]=G[2],ce[1]=q[1].scrCoords[1],pe[1]=q[1].scrCoords[2]):(ce[0]=q[0].scrCoords[1],pe[0]=q[0].scrCoords[2],ce[1]=q[1].scrCoords[1],pe[1]=q[1].scrCoords[2])}}else this.evalVisProp("face")===">"?se=Math.PI/4:this.evalVisProp("face")==="<"?se=-Math.PI/4:se=0,ie=Math.cos(se)*Y-Math.sin(se)*W,ne=Math.sin(se)*Y+Math.cos(se)*W,ce[0]=G[1]+ie*Ce,pe[0]=G[2]-ne*Ce,ce[1]=G[1],pe[1]=G[2],se=-se,ie=Math.cos(se)*Y-Math.sin(se)*W,ne=Math.sin(se)*Y+Math.cos(se)*W,ce[2]=G[1]-ie*Ve,pe[2]=G[2]+ne*Ve;if(this._isInsideCanvas(ce,pe))return[ce,pe,N]}return[]},formatLabelText:function(v){var N,G,z=this.evalVisProp("label.usemathjax"),q=this.evalVisProp("label.usekatex"),Y=this.evalVisProp("scalesymbol");return JXG$1.isNumber(v)?(this.evalVisProp("label.tofraction")?z?N="\\("+JXG$1.toFraction(v,!0)+"\\)":N=JXG$1.toFraction(v,q):(G=this.evalVisProp("digits"),this.useLocale()?N=this.formatNumberLocale(v,G):(N=(Math.round(v*1e11)/1e11).toString(),(N.length>this.evalVisProp("maxlabellength")||N.indexOf("e")!==-1)&&(this.evalVisProp("precision")!==3&&G===3&&(G=this.evalVisProp("precision")),N=v.toExponential(G).toString()))),this.evalVisProp("beautifulscientificticklabels")&&(N=this.beautifyScientificNotationLabel(N)),N.indexOf(".")>-1&&N.indexOf("e")===-1&&(N=N.replace(/0+$/,""),N=N.replace(/\.$/,""))):N=v.toString(),Y.length>0&&(N==="1"?N=Y:N==="-1"?N="-"+Y:N!=="0"&&(N=N+Y)),this.evalVisProp("useunicodeminus")&&(N=N.replace(/-/g,"−")),N},beautifyScientificNotationLabel:function(v){var N;return v.indexOf("e")===-1?v:(N=parseFloat(v.substring(0,v.indexOf("e")))+v.substring(v.indexOf("e")),N=N.replace(/e(.*)$/g,function(G,z){var q="•10";return q+=z.replace(/-/g,"⁻").replace(/\+/g,"").replace(/0/g,"⁰").replace(/1/g,"¹").replace(/2/g,"²").replace(/3/g,"³").replace(/4/g,"⁴").replace(/5/g,"⁵").replace(/6/g,"⁶").replace(/7/g,"⁷").replace(/8/g,"⁸").replace(/9/g,"⁹"),q}),N)},generateLabelText:function(v,N,G){var z,q;if(!JXG$1.exists(G)){if(q=this.getDistanceFromZero(N,v),Math.abs(q)<Mat.eps)return"0";G=q/this.evalVisProp("scale")}return z=this.formatLabelText(G),z},generateLabelData:function(v,N,G){var z,q,Y,W;return W=this.evalVisProp("label.fontsize"),z=[N.scrCoords[1],N.scrCoords[1]],q=[N.scrCoords[2],N.scrCoords[2]],Y=W===void 0?12:W,Y*=.5,this._isInsideCanvas(z,q,Y)?(z=this.evalVisProp("label.offset")[0],q=this.evalVisProp("label.offset")[1],{x:N.usrCoords[1]+z/this.board.unitX,y:N.usrCoords[2]+q/this.board.unitY,t:v,i:G}):null},update:function(){return this.needsUpdate&&this.board.canvasWidth!==0&&this.board.canvasHeight!==0&&this.calculateTicksCoordinates(),this},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&this.board.renderer.updateTicks(this),this.updateRendererLabels(),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},updateRendererLabels:function(){var v,N,G,z,q,Y,W,ie;for(G=this.labelsData.length,z=this.labels.length,v=0,N=0;v<G;v++)this.labelsData[v]!==null&&(W=this.labelsData[v],N<z?(Y=this.labels[N],Y.setText(W.t),Y.setCoords(W.x,W.y),N++):(this.labelCounter+=1,q=JXG$1.deepCopy(this.visProp.label),q.isLabel=!0,q.priv=this.visProp.priv,q.id=this.id+W.i+"Label"+this.labelCounter,Y=JXG$1.createText(this.board,[W.x,W.y,W.t],q),this.addChild(Y),Y.setParents(this),Y.isDraggable=!1,Y.dump=!1,this.labels.push(Y)),ie=this.evalVisProp("label.visible"),ie==="inherit"&&(ie=this.visPropCalc.visible),Y.prepareUpdate().updateVisibility(ie).updateRenderer(),Y.distanceX=this.evalVisProp("label.offset")[0],Y.distanceY=this.evalVisProp("label.offset")[1]);for(G=N,N=G;N<z;N++)this.board.renderer.display(this.labels[N],!1),this.labels[N].visProp.visible=this.labels[N].visPropCalc.visible=!1;return this},hideElement:function(){var v;
206for(JXG$1.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),v=0;v<this.labels.length;v++)JXG$1.exists(this.labels[v])&&this.labels[v].hideElement();return this},showElement:function(){var v;for(JXG$1.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!1),v=0;v<this.labels.length;v++)JXG$1.exists(this.labels[v])&&this.labels[v].showElement();return this}});JXG$1.createTicks=function(v,N,G){var z,q,Y=JXG$1.copyAttributes(G,v.options,"ticks");if(N.length<2?q=Y.ticksdistance:q=N[1],N[0].elementClass===Const.OBJECT_CLASS_LINE||N[0].elementClass===Const.OBJECT_CLASS_CURVE)z=new JXG$1.Ticks(N[0],q,Y);else throw new Error("JSXGraph: Can't create Ticks with parent types '"+typeof N[0]+"'.");return JXG$1.isFunction(Y.generatelabelvalue)&&(z.generateLabelText=Y.generatelabelvalue),JXG$1.isFunction(Y.generatelabeltext)&&(z.generateLabelText=Y.generatelabeltext),z.setParents(N[0]),z.isDraggable=!0,z.fullUpdate(N[0].visPropCalc.visible),z};JXG$1.createHatchmark=function(v,N,G){var z,q,Y,W,ie,ne,se=[],ae=JXG$1.copyAttributes(G,v.options,"hatch");if(N[0].elementClass!==Const.OBJECT_CLASS_LINE&&N[0].elementClass!==Const.OBJECT_CLASS_CURVE||typeof N[1]!="number")throw new Error("JSXGraph: Can't create Hatch mark with parent types '"+typeof N[0]+"' and '"+typeof N[1]+" and ''"+typeof N[2]+"'.");for(z=N[1],W=ae.ticksdistance,ie=(z-1)*W,Y=-ie*.5,q=0;q<z;q++)se[q]=Y+q*W;return ne=v.create("ticks",[N[0],se],ae),ne.elType="hatch",N[0].inherits.push(ne),ne};JXG$1.registerElement("ticks",JXG$1.createTicks);JXG$1.registerElement("hash",JXG$1.createHatchmark);JXG$1.registerElement("hatch",JXG$1.createHatchmark);JXG$1.Ticks;var bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],NAMEMAX=256;JXG$1.Util=JXG$1.Util||{};JXG$1.Util.Unzip=function(v){var N,G,z,q,Y=[],W=0,ie=[],ne=new Array(32768),se=0,ae=!1,ce=v.length,pe=0,ge=1,ve=new Array(288),be=new Array(32),Ee=0,Pe=null,Je=0,Ce=new Array(17),Ve=[];Ce[0]=0;function Re(){return pe<ce?v[pe++]:-1}function qe(){ge=1}function et(){var lt;try{lt=ge&1,ge>>=1,ge===0&&(ge=Re(),lt=ge&1,ge=ge>>1|128)}catch(vt){throw console.log("Probably problems on iOS7 with >>"),vt}return lt}function Ze(lt){var vt=0,dt=lt;try{for(;dt--;)vt=vt<<1|et();lt&&(vt=bitReverse[vt]>>8-lt)}catch(xt){throw console.log("Probably problems on iOS7 with >>"),xt}return vt}function tt(){se=0}function Ke(lt){ne[se++]=lt,Y.push(String.fromCharCode(lt)),se===32768&&(se=0)}function rt(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function it(){for(var lt=!0;lt;){if(Ce[Je]>=q)return-1;if(z[Ce[Je]]===Je)return Ce[Je]++;Ce[Je]++}}function ot(){var lt=Pe[Ee],vt;if(Je===17)return-1;if(Ee++,Je++,vt=it(),vt>=0)lt.b0=vt;else if(lt.b0=32768,ot())return-1;if(vt=it(),vt>=0)lt.b1=vt,lt.jump=null;else if(lt.b1=32768,lt.jump=Pe[Ee],lt.jumppos=Ee,ot())return-1;return Je--,0}function ut(lt,vt,dt,xt){var ft;for(Pe=lt,Ee=0,z=dt,q=vt,ft=0;ft<17;ft++)Ce[ft]=0;return Je=0,ot()?-1:0}function ct(lt){for(var vt,dt,xt,ft=!0,Et=0,Ct=lt[Et];ft;)if(xt=et(),xt){if(!(Ct.b1&32768))return Ct.b1;for(Ct=Ct.jump,vt=lt.length,dt=0;dt<vt;dt++)if(lt[dt]===Ct){Et=dt;break}}else{if(!(Ct.b0&32768))return Ct.b0;Et++,Ct=lt[Et]}}function at(){var lt,vt,dt,xt,ft,Et,Ct,Dt,Gt,Ot,It,Bt,Ht,ir,zt,tr,bt=!0;do if(lt=et(),dt=Ze(2),dt===0)for(qe(),Ot=Re(),Ot|=Re()<<8,Bt=Re(),Bt|=Re()<<8,(Ot^~Bt)&65535&&JXG$1.debug(`BlockLen checksum mismatch
207`);Ot--;)vt=Re(),Ke(vt);else if(dt===1)for(;bt;)if(ft=bitReverse[Ze(7)]>>1,ft>23?(ft=ft<<1|et(),ft>199?(ft-=128,ft=ft<<1|et()):(ft-=48,ft>143&&(ft=ft+136))):ft+=256,ft<256)Ke(ft);else{if(ft===256)break;for(ft-=257,Gt=Ze(cplext[ft])+cplens[ft],ft=bitReverse[Ze(5)]>>3,cpdext[ft]>8?(It=Ze(8),It|=Ze(cpdext[ft]-8)<<8):It=Ze(cpdext[ft]),It+=cpdist[ft],ft=0;ft<Gt;ft++)vt=ne[se-It&32767],Ke(vt)}else if(dt===2){for(Ct=new Array(320),ir=257+Ze(5),zt=1+Ze(5),tr=4+Ze(4),ft=0;ft<19;ft++)Ct[ft]=0;for(ft=0;ft<tr;ft++)Ct[border[ft]]=Ze(3);for(Gt=be.length,xt=0;xt<Gt;xt++)be[xt]=new rt;if(ut(be,19,Ct))return tt(),1;for(Ht=ir+zt,xt=0;xt<Ht;)if(ft=ct(be),ft<16)Ct[xt++]=ft;else if(ft===16){if(ft=3+Ze(2),xt+ft>Ht)return tt(),1;
207for(Et=xt?Ct[xt-1]:0;ft--;)Ct[xt++]=Et}else{if(ft===17?ft=3+Ze(3):ft=11+Ze(7),xt+ft>Ht)return tt(),1;for(;ft--;)Ct[xt++]=0}for(Gt=ve.length,xt=0;xt<Gt;xt++)ve[xt]=new rt;if(ut(ve,ir,Ct))return tt(),1;for(Gt=ve.length,xt=0;xt<Gt;xt++)be[xt]=new rt;for(Dt=[],xt=ir;xt<Ct.length;xt++)Dt[xt-ir]=Ct[xt];if(ut(be,zt,Dt))return tt(),1;for(;bt;)if(ft=ct(ve),ft>=256){if(ft-=256,ft===0)break;for(ft-=1,Gt=Ze(cplext[ft])+cplens[ft],ft=ct(be),cpdext[ft]>8?(It=Ze(8),It|=Ze(cpdext[ft]-8)<<8):It=Ze(cpdext[ft]),It+=cpdist[ft];Gt--;)vt=ne[se-It&32767],Ke(vt)}else Ke(ft)}while(!lt);return tt(),qe(),0}function st(){var lt,vt,dt,xt,ft,Et,Ct,Dt,Gt=[];try{if(Y=[],ae=!1,Gt[0]=Re(),Gt[1]=Re(),Gt[0]===120&&Gt[1]===218&&(at(),ie[W]=[Y.join(""),"geonext.gxt"],W++),Gt[0]===31&&Gt[1]===139&&(pt(),ie[W]=[Y.join(""),"file"],W++),Gt[0]===80&&Gt[1]===75){if(ae=!0,Gt[2]=Re(),Gt[3]=Re(),Gt[2]===3&&Gt[3]===4){for(Gt[0]=Re(),Gt[1]=Re(),N=Re(),N|=Re()<<8,Dt=Re(),Dt|=Re()<<8,Re(),Re(),Re(),Re(),Ct=Re(),Ct|=Re()<<8,Ct|=Re()<<16,Ct|=Re()<<24,Et=Re(),Et|=Re()<<8,Et|=Re()<<16,Et|=Re()<<24,ft=Re(),ft|=Re()<<8,ft|=Re()<<16,ft|=Re()<<24,xt=Re(),xt|=Re()<<8,dt=Re(),dt|=Re()<<8,lt=0,Ve=[];xt--;)vt=Re(),vt==="/"|vt===":"?lt=0:lt<NAMEMAX-1&&(Ve[lt++]=String.fromCharCode(vt));for(G||(G=Ve),lt=0;lt<dt;)vt=Re(),lt++;if(Dt===8&&(at(),ie[W]=new Array(2),ie[W][0]=Y.join(""),ie[W][1]=Ve.join(""),W++),pt())return!1}return!0}}catch(Ot){throw console.log("Probably problems on iOS7 with >>"),Ot}return!1}function pt(){var lt,vt,dt,xt,ft,Et=[];if(N&8&&(Et[0]=Re(),Et[1]=Re(),Et[2]=Re(),Et[3]=Re(),Et[0]===80&&Et[1]===75&&Et[2]===7&&Et[3]===8?(lt=Re(),lt|=Re()<<8,lt|=Re()<<16,lt|=Re()<<24):lt=Et[0]|Et[1]<<8|Et[2]<<16|Et[3]<<24,vt=Re(),vt|=Re()<<8,vt|=Re()<<16,vt|=Re()<<24,dt=Re(),dt|=Re()<<8,dt|=Re()<<16,dt|=Re()<<24),ae&&st())return!1;if(Et[0]=Re(),Et[0]!==8)return!0;if(N=Re(),Re(),Re(),Re(),Re(),Re(),Re(),N&4)for(Et[0]=Re(),Et[2]=Re(),Je=Et[0]+256*Et[1],xt=0;xt<Je;xt++)Re();if(N&8)for(xt=0,Ve=[],ft=Re();ft;)(ft==="7"||ft===":")&&(xt=0),xt<NAMEMAX-1&&(Ve[xt++]=ft),ft=Re();if(N&16)for(ft=Re();ft;)ft=Re();return N&2&&(Re(),Re()),at(),lt=Re(),lt|=Re()<<8,lt|=Re()<<16,lt|=Re()<<24,dt=Re(),dt|=Re()<<8,dt|=Re()<<16,dt|=Re()<<24,ae&&st(),!1}JXG$1.Util.Unzip.prototype.unzipFile=function(lt){var vt;for(this.unzip(),vt=0;vt<ie.length;vt++)if(ie[vt][1]===lt)return ie[vt][0];return""},JXG$1.Util.Unzip.prototype.unzip=function(){return st(),ie}};JXG$1.Util;JXG$1.CA=function(v,N,G){this.node=v,this.createNode=N,this.parser=G};JXG$1.extend(JXG$1.CA.prototype,{findMapNode:function(v,N){var G,z,q;if(N.value==="op_assign"&&N.children[0].value===v)return N.children[1];if(N.children){for(z=N.children.length,G=0;G<z;++G)if(q=this.findMapNode(v,N.children[G]),q!==null)return q}return null},setMath:function(v){var N,G;if((v.type=="node_op"&&(v.value=="op_add"||v.value=="op_sub"||v.value=="op_mul"||v.value=="op_div"||v.value=="op_neg"||v.value=="op_execfun"||v.value=="op_exp")||v.type=="node_var"||v.type=="node_const")&&(v.isMath=!0),v.children)for(G=v.children.length,N=0;N<G;++N)this.setMath(v.children[N])},deriveElementary:function(v,N){var G=v.children[0].value,z=v.children[1],q;switch(G){case"abs":q=this.createNode("node_op","op_div",z[0],this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0]))]));break;case"sqrt":q=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_mul",this.createNode("node_const",2),this.createNode(v.type,v.value,JXG$1.deepCopy(v.children[0]),JXG$1.deepCopy(v.children[1]))));break;case"sin":q=this.createNode("node_op","op_execfun",this.createNode("node_var","cos"),JXG$1.deepCopy(z));break;case"cos":q=this.createNode("node_op","op_neg",this.createNode("node_op","op_execfun",this.createNode("node_var","sin"),JXG$1.deepCopy(z)));break;case"tan":q=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","cos"),JXG$1.deepCopy(z)),this.createNode("node_const",2)));break;case"cot":q=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","sin"),JXG$1.deepCopy(z)),this.createNode("node_const",2))));break;case"exp":q=this.createNode(v.type,v.value,JXG$1.deepCopy(v.children[0]),JXG$1.deepCopy(v.children[1]));break;case"pow":q=this.createNode("node_op","op_mul",this.createNode("node_op","op_execfun",JXG$1.deepCopy(v.children[0]),JXG$1.deepCopy(v.children[1])),this.createNode("node_op","op_add",this.createNode("node_op","op_mul",this.derivative(v.children[1][0],N),this.createNode("node_op","op_div",JXG$1.deepCopy(v.children[1][1]),JXG$1.deepCopy(v.children[1][0]))),this.createNode("node_op","op_mul",this.derivative(v.children[1][1],N),this.createNode("node_op","op_execfun",this.createNode("node_var","log"),[JXG$1.deepCopy(v.children[1][0])]))));break;case"log":case"ln":q=this.createNode("node_op","op_div",this.createNode("node_const",1),JXG$1.deepCopy(z[0]));break;case"log2":case"lb":case"ld":q=this.createNode("node_op","op_mul",this.createNode("node_op","op_div",this.createNode("node_const",1),JXG$1.deepCopy(z[0])),this.createNode("node_const",1.4426950408889634));break;case"log10":case"lg":q=this.createNode("node_op","op_mul",this.createNode("node_op","op_div",this.createNode("node_const",1),JXG$1.deepCopy(z[0])),this.createNode("node_const",.43429448190325176));break;case"asin":q=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0])))]));break;case"acos":q=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0])))])));break;case"atan":q=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_add",this.createNode("node_const",1),this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0]))));break;case"acot":q=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_add",this.createNode("node_const",1),this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0])))));break;case"sinh":q=this.createNode("node_op","op_execfun",this.createNode("node_var","cosh"),[JXG$1.deepCopy(z[0])]);break;case"cosh":q=this.createNode("node_op","op_execfun",this.createNode("node_var","sinh"),[JXG$1.deepCopy(z[0])]);break;case"tanh":q=this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","tanh"),[JXG$1.deepCopy(z[0])]),this.createNode("node_const",2)));break;
207case"asinh":q=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_add",this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0])),this.createNode("node_const",1))]));break;case"acosh":q=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0])),this.createNode("node_const",1))]));break;case"atanh":q=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",JXG$1.deepCopy(z[0]),JXG$1.deepCopy(z[0]))));break;default:throw q=this.createNode("node_const",0),console.log('Derivative of "'+G+'" not yet implemented'),new Error("Error("+this.line+"): ")}return q},derivative:function(v,N){var G;switch(v.type){case"node_op":switch(v.value){case"op_execfun":v.children[0].value=="pow"?G=this.deriveElementary(v,N):v.children[1].length===0?G=this.createNode("node_const",0):G=this.createNode("node_op","op_mul",this.deriveElementary(v,N),this.derivative(v.children[1][0],N));break;case"op_div":G=this.createNode("node_op","op_div",this.createNode("node_op","op_sub",this.createNode("node_op","op_mul",this.derivative(v.children[0],N),JXG$1.deepCopy(v.children[1])),this.createNode("node_op","op_mul",JXG$1.deepCopy(v.children[0]),this.derivative(v.children[1],N))),this.createNode("node_op","op_mul",JXG$1.deepCopy(v.children[1]),JXG$1.deepCopy(v.children[1])));break;case"op_mul":G=this.createNode("node_op","op_add",this.createNode("node_op","op_mul",JXG$1.deepCopy(v.children[0]),this.derivative(v.children[1],N)),this.createNode("node_op","op_mul",this.derivative(v.children[0],N),JXG$1.deepCopy(v.children[1])));break;case"op_neg":G=this.createNode("node_op","op_neg",this.derivative(v.children[0],N));break;case"op_add":case"op_sub":G=this.createNode("node_op",v.value,this.derivative(v.children[0],N),this.derivative(v.children[1],N));break;case"op_exp":G=this.createNode("node_op","op_mul",JXG$1.deepCopy(v),this.createNode("node_op","op_add",this.createNode("node_op","op_mul",this.derivative(v.children[0],N),this.createNode("node_op","op_div",JXG$1.deepCopy(v.children[1]),JXG$1.deepCopy(v.children[0]))),this.createNode("node_op","op_mul",this.derivative(v.children[1],N),this.createNode("node_op","op_execfun",this.createNode("node_var","log"),[JXG$1.deepCopy(v.children[0])]))));break}break;case"node_var":v.value===N?G=this.createNode("node_const",1):G=this.createNode("node_const",0);break;case"node_const":G=this.createNode("node_const",0);break}return G},expandDerivatives:function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be;if(ne=0,!v)return ne;for(this.line=v.line,this.col=v.col,z=v.children.length,q=0;q<z;++q)if(v.children[q]&&v.children[q].type)v.children[q]=this.expandDerivatives(v.children[q],v,G);else if(JXG$1.isArray(v.children[q]))for(Y=0;Y<v.children[q].length;++Y)v.children[q][Y]&&v.children[q][Y].type&&(v.children[q][Y]=this.expandDerivatives(v.children[q][Y],v,G));switch(v.type){case"node_op":switch(v.value){case"op_execfun":if(v.children[0]&&v.children[0].value==="D"){if(be=!1,v.children[1][0].type=="node_var"&&(ce=v.children[1][0].value,W=this.findMapNode(ce,G),W!==null&&(be=!0)),be?(ge=W.children[0],v.children[1].length>=2?pe=v.children[1][1].value:pe=W.children[0][0],ie=W.children[1]):(ie=v.children[1][0],ge=["x"],v.children[1].length>=2?pe=v.children[1][1].value:pe="x"),v.children[1].length>=3?ve=v.children[1][2].value:ve=1,ae=ie,ve>=1)for(;ve>=1;)ae=this.derivative(ae,pe),ae=this.removeTrivialNodes(ae),ve--;N.type=="node_op"&&N.value=="op_assign"?se=this.createNode("node_op","op_map",ge,ae):se=ae,this.setMath(se),v.type=se.type,v.value=se.value,se.children.length>0&&(v.children[0]=se.children[0]),se.children.length>1&&(v.children[1]=se.children[1])}}break}return v},removeTrivialNodes:function(v){var N,G,z,q,Y;if(JXG$1.isArray(v))for(G=v.length,N=0;N<G;
207++N)v[N]=this.removeTrivialNodes(v[N]);if(v.type!="node_op"||!v.children)return v;for(G=v.children.length,N=0;N<G;++N){this.mayNotBeSimplified=!1;do v.children[N]=this.removeTrivialNodes(v.children[N]);while(this.mayNotBeSimplified)}switch(v.value){case"op_map":if(z=v.children[0],q=v.children[1],q.type=="node_var"){for(N=0;N<z.length;++N)if(z[N]==q.value){q.isMath=!0;break}}break;case"op_add":if(z=v.children[0],q=v.children[1],z.type=="node_const"&&z.value===0)return q;if(q.type=="node_const"&&q.value===0)return z;if(z.type=="node_const"&&q.type=="node_const")return z.value+=q.value,z;break;case"op_mul":if(z=v.children[0],q=v.children[1],z.type=="node_const"&&z.value==1)return q;if(q.type=="node_const"&&q.value==1||z.type=="node_const"&&z.value===0)return z;if(q.type=="node_const"&&q.value===0||q.type=="node_const"&&q.value===0)return q;if(z.type=="node_op"&&z.value=="op_neg"&&q.type=="node_op"&&q.value=="op_neg")return v.children=[z.children[0],q.children[0]],this.mayNotBeSimplified=!0,v;if(z.value=="op_neg"&&q.value!="op_neg")return v.type="node_op",v.value="op_neg",v.children=[this.createNode("node_op","op_mul",z.children[0],q)],this.mayNotBeSimplified=!0,v;if(z.value!="op_neg"&&q.value=="op_neg")return v.type="node_op",v.value="op_neg",v.children=[this.createNode("node_op","op_mul",z,q.children[0])],this.mayNotBeSimplified=!0,v;if(z.value=="op_div"&&z.children[0].type=="node_const"&&z.children[0].value==1)return v.type="node_op",v.value="op_div",v.children=[q,z.children[1]],this.mayNotBeSimplified=!0,v;if(q.value=="op_div"&&q.children[0].type=="node_const"&&q.children[0].value==1)return v.type="node_op",v.value="op_div",v.children=[z,q.children[1]],this.mayNotBeSimplified=!0,v;if(z.type!="node_const"&&q.type=="node_const")return v.children=[q,z],this.mayNotBeSimplified=!0,v;if(z.type!="node_const"&&q.type=="node_op"&&q.value=="op_neg"&&q.children[0].type=="node_const")return v.children=[q,z],this.mayNotBeSimplified=!0,v;if(z.type=="node_op"&&z.value!="op_execfun"&&(q.type=="node_var"||q.type=="node_op"&&q.value=="op_execfun"))return v.children=[q,z],this.mayNotBeSimplified=!0,v;if(z.type!="node_op"&&q.type=="node_op"&&q.value=="op_neg"&&q.children[0].type=="node_var")return v.children=[q,z],this.mayNotBeSimplified=!0,v;if(z.type!="node_const"&&q.type=="node_op"&&(q.value=="op_mul"||q.value=="op_div")&&q.children[0].type=="node_const")return Y=q.children[0],q.children[0]=z,v.children=[Y,q],this.mayNotBeSimplified=!0,v;if(q.type!="node_const"&&z.type=="node_op"&&z.value=="op_mul"&&z.children[0].type=="node_const")return v.children=[z.children[0],this.createNode("node_op","op_mul",z.children[1],q)],this.mayNotBeSimplified=!0,v;if(z.type=="node_const"&&q.type=="node_const")return z.value*=q.value,z;if(z.type=="node_const"&&q.type=="node_op"&&(q.value=="op_mul"||q.value=="op_div")&&q.children[0].type=="node_const")return q.children[0].value*=z.value,q;if(z.hash=this.parser.compile(z),q.hash=this.parser.compile(q),z.hash===q.hash)return v.value="op_exp",v.children[1]=this.createNode("node_const",2),v;if(z.type=="node_const"&&q.type=="node_op"&&(q.value=="op_mul"||q.value=="op_div")&&q.children[0].type=="node_const")return q.children[0].value*=z.value,q;if(q.type=="node_op"&&q.value=="op_exp"&&(z.hash||(z.hash=this.parser.compile(z)),q.children[0].hash||(q.children[0].hash=this.parser.compile(q.children[0])),z.hash===q.children[0].hash))return q.children[1]=this.createNode("node_op","op_add",q.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,q;if(z.type=="node_op"&&z.value=="op_exp"&&q.type=="node_op"&&q.value=="op_exp"&&(z.children[0].hash=this.parser.compile(z.children[0]),q.children[0].hash=this.parser.compile(q.children[0]),z.children[0].hash===q.children[0].hash))return z.children[1]=this.createNode("node_op","op_add",z.children[1],q.children[1]),this.mayNotBeSimplified=!0,z;break;case"op_sub":if(z=v.children[0],q=v.children[1],z.type=="node_const"&&z.value===0)return v.value="op_neg",v.children[0]=q,v;if(q.type=="node_const"&&q.value===0)return z;if(z.type=="node_const"&&q.type=="node_const"&&z.value==q.value)return this.createNode("node_const",0);if(z.type=="node_var"&&q.type=="node_var"&&z.value==q.value)return this.createNode("node_const",0);if(z.type=="node_const"&&q.type=="node_const")return z.value-=q.value,z;if(z.type=="node_op"&&z.value=="op_mul"&&q.type=="node_op"&&q.value=="op_mul"&&(z.children[1].hash=this.parser.compile(z.children[1]),q.children[1].hash=this.parser.compile(q.children[1]),z.children[1].hash===q.children[1].hash))return v.value="op_mul",v.children=[this.createNode("node_op","op_sub",z.children[0],q.children[0]),z.children[1]],this.mayNotBeSimplified=!0,v;if(z.type=="node_op"&&z.value=="op_mul"&&(z.children[1].hash=this.parser.compile(z.children[1]),q.hash=this.parser.compile(q),z.children[1].hash===q.hash))return v.value="op_mul",v.children=[this.createNode("node_op","op_sub",z.children[0],this.createNode("node_const",1)),q],this.mayNotBeSimplified=!0,v;if(q.type=="node_op"&&q.value=="op_mul"&&(q.children[1].hash=this.parser.compile(q.children[1]),z.hash=this.parser.compile(z),q.children[1].hash===z.hash))return v.value="op_mul",v.children=[this.createNode("node_op","op_sub",this.createNode("node_const",1),q.children[0]),z],this.mayNotBeSimplified=!0,v;break;case"op_neg":if(z=v.children[0],z.type=="node_const"&&z.value===0)return z;if(z.type=="node_op"&&z.value=="op_neg")return z.children[0];break;case"op_div":if(z=v.children[0],q=v.children[1],z.type=="node_const"&&q.type=="node_const"&&z.value==q.value&&z.value!==0)return z.value=1,z;if(z.type=="node_const"&&z.value===0&&q.type=="node_const"&&q.value!==0)return z.value=0,z;if(z.type=="node_const"&&z.value===0&&(q.type=="node_op"||q.type=="node_var"))return v.type="node_const",v.value=0,v;if(z.type=="node_var"&&q.type=="node_var"&&z.value==q.value)return this.createNode("node_const",1);if(z.type=="node_const"&&z.value!==0&&q.type=="node_const"&&q.value===0)return z.value>0?z.value=1/0:z.value=-1/0,z;if(z.type=="node_op"&&z.value=="op_neg"&&q.type=="node_op"&&q.value=="op_neg")return v.children=[z.children[0],q.children[0]],this.mayNotBeSimplified=!0,v;if(z.value=="op_neg"&&q.value!="op_neg")return v.type="node_op",v.value="op_neg",v.children=[this.createNode("node_op","op_div",z.children[0],q)],this.mayNotBeSimplified=!0,v;if(z.value!="op_neg"&&q.value=="op_neg")return v.type="node_op",v.value="op_neg",v.children=[this.createNode("node_op","op_div",z,q.children[0])],this.mayNotBeSimplified=!0,v;if(z.type=="node_op"&&z.value=="op_exp"&&(q.hash||(q.hash=this.parser.compile(q)),z.children[0].hash||(z.children[0].hash=this.parser.compile(z.children[0])),q.hash===z.children[0].hash))return z.children[1]=this.createNode("node_op","op_sub",z.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,z;if(q.type!="node_const"&&z.type=="node_op"&&z.value=="op_mul"&&z.children[0].type=="node_const")return v.value="op_mul",v.children=[z.children[0],this.createNode("node_op","op_div",z.children[1],q)],this.mayNotBeSimplified=!0,v;if(z.type=="node_op"&&z.value=="op_exp"&&q.type=="node_op"&&q.value=="op_exp"&&(z.children[0].hash=this.parser.compile(z.children[0]),q.children[0].hash=this.parser.compile(q.children[0]),z.children[0].hash===q.children[0].hash))return z.children[1]=this.createNode("node_op","op_sub",z.children[1],q.children[1]),this.mayNotBeSimplified=!0,z;break;case"op_exp":if(z=v.children[0],q=v.children[1],q.type=="node_const"&&q.value===0)return q.value=1,q;if(q.type=="node_const"&&q.value==1||z.type=="node_const"&&z.value==1||z.type=="node_const"&&z.value===0&&q.type=="node_const"&&q.value!==0)return z;if(z.type=="node_op"&&z.value=="op_exp")return v.children=[z.children[0],this.createNode("node_op","op_mul",z.children[1],q)],v;break}switch(v.value){case"op_add":if(z=v.children[0],q=v.children[1],z.type=="node_const"&&q.type=="node_const"&&z.value==q.value)return z.value+=q.value,z;if(z.type=="node_var"&&q.type=="node_var"&&z.value==q.value)return v.children[0]=this.createNode("node_const",2),v.value="op_mul",v;if(z.type=="node_op"&&z.value=="op_neg")return v.value="op_sub",v.children[0]=q,v.children[1]=z.children[0],this.mayNotBeSimplified=!0,v;if(q.type=="node_op"&&q.value=="op_neg")return v.value="op_sub",v.children[1]=q.children[0],this.mayNotBeSimplified=!0,v;if(z.type=="node_op"&&z.value=="op_mul"&&q.type=="node_op"&&q.value=="op_mul"&&(z.children[1].hash=this.parser.compile(z.children[1]),q.children[1].hash=this.parser.compile(q.children[1]),z.children[1].hash===q.children[1].hash))return v.value="op_mul",v.children=[this.createNode("node_op","op_add",z.children[0],q.children[0]),z.children[1]],this.mayNotBeSimplified=!0,v;if(z.type=="node_op"&&z.value=="op_mul"&&(z.children[1].hash=this.parser.compile(z.children[1]),q.hash=this.parser.compile(q),z.children[1].hash===q.hash))return v.value="op_mul",v.children=[this.createNode("node_op","op_add",z.children[0],this.createNode("node_const",1)),q],this.mayNotBeSimplified=!0,v;if(q.type=="node_op"&&q.value=="op_mul"&&(q.children[1].hash=this.parser.compile(q.children[1]),z.hash=this.parser.compile(z),q.children[1].hash===z.hash))return v.value="op_mul",v.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),q.children[0]),z],this.mayNotBeSimplified=!0,v;break;case"op_sub":if(z=v.children[0],q=v.children[1],q.type=="node_op"&&q.value=="op_neg")return v.value="op_add",v.children[1]=q.children[0],this.mayNotBeSimplified=!0,v;break;case"op_execfun":return this.simplifyElementary(v)}return v},simplifyElementary:function(v){var N=v.children[0].value,G=v.children[1];if(G.length==0)return v;switch(N){case"sin":case"tan":if(G[0].type=="node_const"&&G[0].value===0||G[0].type=="node_var"&&G[0].value=="PI"||G[0].type=="node_op"&&G[0].value=="op_mul"&&G[0].children[0].type=="node_const"&&G[0].children[0].value%1===0&&G[0].children[1].type=="node_var"&&G[0].children[1].value=="PI")return v.type="node_const",v.value=0,v;break;case"cos":if(G[0].type=="node_const"&&G[0].value===0)return v.type="node_const",v.value=1,v;if(G[0].type=="node_var"&&G[0].value=="PI")return v.type="node_op",v.value="op_neg",v.children=[this.createNode("node_const",1)],v;break;case"exp":if(G[0].type=="node_const"&&G[0].value===0)return v.type="node_const",v.value=1,v;break;case"pow":if(G[1].type=="node_const"&&G[1].value===0)return v.type="node_const",v.value=1,v;break}return v}});JXG$1.CA;JXG$1.Dump={addMarkers:function(v,N,G){var z,q,Y;JXG$1.isArray(N)||(N=[N]),JXG$1.isArray(G)||(G=[G]),q=Math.min(N.length,G.length),N.length=q,G.length=q;for(z in v.objects)if(v.objects.hasOwnProperty(z))for(Y=0;Y<q;Y++)v.objects[z][N[Y]]=G[Y]},deleteMarkers:function(v,N){var G,z,q;JXG$1.isArray(N)||(N=[N]),z=N.length,N.length=z;
207for(G in v.objects)if(v.objects.hasOwnProperty(G))for(q=0;q<z;q++)delete v.objects[G][N[q]]},str:function(v){return typeof v=="string"&&v.slice(0,7)!=="function"&&(v='"'+v+'"'),v},minimizeObject:function(v,N){var G,z,q,Y={},W=JXG$1.deepCopy(v),ie=[];for(q=1;q<arguments.length;q++)ie.push(arguments[q]);for(Y=JXG$1.deepCopy(Y,JXG$1.Options.elements,!0),q=ie.length;q>0;q--)Y=JXG$1.deepCopy(Y,ie[q-1],!0);for(G in Y)Y.hasOwnProperty(G)&&(z=G.toLowerCase(),typeof Y[G]!="object"&&Y[G]===W[z]&&delete W[z]);return W},prepareAttributes:function(v,N){var G,z;G=this.minimizeObject(N.getAttributes(),JXG$1.Options[N.elType]);for(z in N.subs)N.subs.hasOwnProperty(z)&&(G[z]=this.minimizeObject(N.subs[z].getAttributes(),JXG$1.Options[N.elType][z],JXG$1.Options[N.subs[z].elType]),G[z].id=N.subs[z].id,G[z].name=N.subs[z].name);return G.id=N.id,G.name=N.name,G},setBoundingBox:function(v,N,G){return v.push({obj:G,method:"setBoundingBox",params:[N.getBoundingBox(),N.keepaspectratio]}),v},dump:function(v){var N,G,z,q,Y=[],W=[],ie=[],ne=v.objectsList.length;for(this.addMarkers(v,"dumped",!1),N=0;N<ne;N++)if(G=v.objectsList[N],z={},!G.dumped&&G.dump){for(z.type=G.getType(),z.parents=G.getParents().slice(),z.type==="point"&&z.parents[0]===1&&(z.parents=z.parents.slice(1)),q=0;q<z.parents.length;q++)JXG$1.isString(z.parents[q])&&z.parents[q][0]!=="'"&&z.parents[q][0]!=='"'?z.parents[q]='"'+z.parents[q]+'"':JXG$1.isArray(z.parents[q])&&(z.parents[q]="["+z.parents[q].toString()+"]");z.attributes=this.prepareAttributes(v,G),z.type==="glider"&&G.onPolygon&&Y.push({obj:G.id,prop:"onPolygon",val:!0}),ie.push(z)}return this.deleteMarkers(v,"dumped"),{elements:ie,props:Y,methods:W}},arrayToParamStr:function(v,N){var G,z=[];for(G=0;G<v.length;G++)z.push(N.call(this,v[G]));return z.join(", ")},toJCAN:function(v){var N,G,z;switch(typeof v){case"object":if(v){if(G=[],JXG$1.isArray(v)){for(N=0;N<v.length;N++)G.push(this.toJCAN(v[N]));return"["+G.join(",")+"]"}for(z in v)v.hasOwnProperty(z)&&G.push(z+": "+this.toJCAN(v[z]));return"<<"+G.join(", ")+">> "}return"null";case"string":return"'"+v.replace(/\\/g,"\\\\").replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return v.toString();case"null":return"null"}},toJessie:function(v){var N,G,z,q=this.dump(v),Y=[];for(q.methods=this.setBoundingBox(q.methods,v,"$board"),G=q.elements,N=0;N<G.length;N++)G[N].attributes.name.length>0&&Y.push("// "+G[N].attributes.name),Y.push("s"+N+" = "+G[N].type+"("+G[N].parents.join(", ")+") "+this.toJCAN(G[N].attributes).replace(/\n/,"\\n")+";"),G[N].type==="axis"&&(z=G[N].attributes.id,v.objects[z].defaultTicks===null&&Y.push("s"+N+".removeAllTicks();")),Y.push("");for(N=0;N<q.methods.length;N++)Y.push(q.methods[N].obj+"."+q.methods[N].method+"("+this.arrayToParamStr(q.methods[N].params,this.toJCAN)+");"),Y.push("");for(N=0;N<q.props.length;N++)Y.push(q.props[N].obj+"."+q.props[N].prop+" = "+this.toJCAN(q.props[N].val)+";"),Y.push("");return Y.join(`
208`)},toJavaScript:function(v){var N,G,z,q=this.dump(v),Y=[];for(q.methods=this.setBoundingBox(q.methods,v,"board"),G=q.elements,N=0;N<G.length;N++)Y.push('board.create("'+G[N].type+'", ['+G[N].parents.join(", ")+"], "+JXG$1.toJSON(G[N].attributes)+");"),G[N].type==="axis"&&(z=G[N].attributes.id,v.objects[z].defaultTicks===null&&Y.push('board.objects["'+z+'"].removeTicks(board.objects["'+z+'"].defaultTicks);'));for(N=0;N<q.methods.length;N++)Y.push(q.methods[N].obj+"."+q.methods[N].method+"("+this.arrayToParamStr(q.methods[N].params,JXG$1.toJSON)+");"),Y.push("");for(N=0;N<q.props.length;N++)Y.push(q.props[N].obj+"."+q.props[N].prop+" = "+JXG$1.toJSON(q.props[N].val)+";"),Y.push("");return Y.join(`
209`)}};JXG$1.Dump;JXG$1.createComb=function(v,N,G){var z,q,Y,W,ie;if(N.length===2){if(JXG$1.isArray(N[0])&&N[0].length>1)W=JXG$1.copyAttributes(G,v.options,"comb","point1"),z=v.create("point",N[0],W);else if(JXG$1.isString(N[0])||JXG$1.isPoint(N[0]))z=v.select(N[0]);else if(JXG$1.isFunction(N[0])&&JXG$1.isPoint(N[0]()))z=N[0]();else if(JXG$1.isFunction(N[0])&&N[0]().length&&N[0]().length>=2)W=JXG$1.copyAttributes(G,v.options,"comb","point1"),z=JXG$1.createPoint(v,N[
2090](),W);else throw new Error("JSXGraph: Can't create comb with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
210Possible parent types: [point,point], [[x1,y1],[x2,y2]]`);if(JXG$1.isArray(N[1])&&N[1].length>1)W=JXG$1.copyAttributes(G,v.options,"comb","point2"),q=v.create("point",N[1],W);else if(JXG$1.isString(N[1])||JXG$1.isPoint(N[1]))q=v.select(N[1]);else if(JXG$1.isFunction(N[1])&&JXG$1.isPoint(N[1]()))q=N[1]();else if(JXG$1.isFunction(N[1])&&N[1]().length&&N[1]().length>=2)W=JXG$1.copyAttributes(G,v.options,"comb","point2"),q=JXG$1.createPoint(v,N[1](),W);else throw new Error("JSXGraph: Can't create comb with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
211Possible parent types: [point,point], [[x1,y1],[x2,y2]]`)}else throw ie=N.map(function(ne){return"'"+typeof ne+"'"}),new Error("JSXGraph: Can't create comb with parent types "+ie.join(", ")+`.
212Possible parent types: [point,point], [[x1,y1],[x2,y2]]`);return W=JXG$1.copyAttributes(G,v.options,"comb"),Y=v.create("curve",[[0],[0]],W),Y.updateDataArray=function(){var ne=0,se=z.Dist(q),ae,ce,pe,ge,ve,be,Ee,Pe=z,Je=q,Ce,Ve,Re;for(Ce=Y.evalVisProp("frequency"),Ve=-Y.evalVisProp("angle"),Re=Y.evalVisProp("width"),Y.evalVisProp("reverse")&&(Pe=q,Je=z,Ve=-Ve),ae=Math.cos(Ve),ce=Math.sin(Ve),pe=(Je.X()-Pe.X())/se,ge=(Je.Y()-Pe.Y())/se,ae*=Re/Math.abs(ce),ce*=Re/Math.abs(ce),this.dataX=[],this.dataY=[];ne<se;)ve=Pe.X()+pe*ne,be=Pe.Y()+ge*ne,Ee=Math.min(ae,se-ne)/Math.abs(ae),ce*=Ee,ae*=Ee,this.dataX.push(ve),this.dataY.push(be),this.dataX.push(ve+pe*ae+ge*ce),this.dataY.push(be-pe*ce+ge*ae),this.dataX.push(NaN),this.dataY.push(NaN),ne+=Ce},Y};JXG$1.registerElement("comb",JXG$1.createComb);var priv$3={removeSlopeTriangle:function(){Polygon.prototype.remove.call(this),this.board.removeObject(this.toppoint),this.board.removeObject(this.glider),this.board.removeObject(this.baseline),this.board.removeObject(this.basepoint),this.board.removeObject(this.label),this._isPrivateTangent&&this.board.removeObject(this.tangent)},Value:function(){return this.tangent.getSlope()},Direction:function(){return this.tangent.Direction()}};JXG$1.createSlopeTriangle=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe=!1;if(N.length===1&&N[0].type===Const.OBJECT_TYPE_TANGENT)q=N[0],Y=q.glider;else if(N.length===1&&N[0].type===Const.OBJECT_TYPE_GLIDER)Y=N[0],ce=JXG$1.copyAttributes(G,v.options,"slopetriangle","tangent"),q=v.create("tangent",[Y],ce),pe=!0;else if(N.length===2&&N[0].elementClass===Const.OBJECT_CLASS_LINE&&JXG$1.isPoint(N[1]))q=N[0],Y=N[1];else throw new Error("JSXGraph: Can't create slope triangle with parent types '"+typeof N[0]+"'.");return ce=JXG$1.copyAttributes(G,v.options,"slopetriangle","basepoint"),se=v.create("point",[function(){return[Y.X()+1,Y.Y()]}],ce),ce=JXG$1.copyAttributes(G,v.options,"slopetriangle","baseline"),ne=v.create("line",[Y,se],ce),ce=JXG$1.copyAttributes(G,v.options,"slopetriangle","glider"),W=v.create("glider",[Y.X()+1,Y.Y(),ne],ce),ce=JXG$1.copyAttributes(G,v.options,"slopetriangle","toppoint"),ie=v.create("point",[function(){return[W.X(),W.Y()+(W.X()-Y.X())*q.getSlope()]}],ce),ce=JXG$1.copyAttributes(G,v.options,"slopetriangle"),z=v.create("polygon",[Y,W,ie],ce),z.Value=priv$3.Value,z.Direction=priv$3.Direction,z.tangent=q,z._isPrivateTangent=pe,z.borders[2].setArrow(!1,!1),ce=JXG$1.copyAttributes(G,v.options,"slopetriangle","label"),ce=JXG$1.copyAttributes(ce,v.options,"label"),ce.isLabel=!0,ce.anchor=z.borders[1],ce.priv=z.borders[1].visProp.priv,ce.id=z.borders[1].id+"Label",ae=v.create("text",[0,0,function(){return""}],ce),ae.needsUpdate=!0,ae.dump=!1,z.borders[1].label=ae,z.borders[1].hasLabel=!0,z.borders[1].visProp.withlabel=!0,ae._setText(function(){var ge=ae.evalVisProp("digits");return ae.useLocale()?ae.formatNumberLocale(z.Value(),ge):JXG$1.toFixed(z.Value(),ge)}),ae.fullUpdate(),z.glider=W,z.basepoint=se,z.baseline=ne,z.toppoint=ie,z.label=ae,z.subs={glider:W,basePoint:se,baseLine:ne,topPoint:ie,label:ae},z.inherits.push(W,se,ne,ie,ae),z.methodMap=JXG$1.deepCopy(z.methodMap,{tangent:"tangent",glider:"glider",basepoint:"basepoint",baseline:"baseline",toppoint:"toppoint",label:"label",Value:"Value",V:"Value",Direction:"Direction"}),z.remove=priv$3.removeSlopeTriangle,z};JXG$1.registerElement("slopetriangle",JXG$1.createSlopeTriangle);var priv$2={CheckboxChangeEventHandler:function(){this._value=this.rendNodeCheckbox.checked,this.board.update()}};JXG$1.createCheckbox=function(v,N,G){var z,q,Y=JXG$1.copyAttributes(G,v.options,"checkbox");return q=[N[0],N[1],'<span style="display:inline"><input type="checkbox" /><label for=""></label></span>'],z=v.create("text",q,Y),z.type=JXG$1.OBJECT_TYPE_CHECKBOX,z.rendNodeCheckbox=z.rendNode.childNodes[0].childNodes[0],z.rendNodeLabel=z.rendNode.childNodes[0].childNodes[1],z.rendNodeTag=z.rendNodeCheckbox,z.rendNodeTag.disabled=!!Y.disabled,z.rendNodeCheckbox.id=z.rendNode.id+"_checkbox",z.rendNodeLabel.id=z.rendNode.id+"_label",z.rendNodeLabel.setAttribute("for",z.rendNodeCheckbox.id),z.setText(N[2]),z.visPropOld.fontsize="0px",v.renderer.updateTextStyle(z,!1),z.rendNodeCheckbox.checked=Y.checked,z._value=Y.checked,z.Value=function(){return this._value},z.update=function(){return this.needsUpdate&&(JXG$1.Text.prototype.update.call(this),this._value=this.rendNodeCheckbox.checked),this},JXG$1.addEvent(z.rendNodeCheckbox,"change",priv$2.CheckboxChangeEventHandler,z),z};JXG$1.registerElement("checkbox",JXG$1.createCheckbox);var priv$1={InputInputEventHandler:function(v){this._value=this.rendNodeInput.value,this.board.update()}};JXG$1.createInput=function(v,N,G){var z,q,Y=JXG$1.copyAttributes(G,v.options,"input");return q=[N[0],N[1],'<span style="display:inline; white-space:nowrap; padding:0px;"><label></label><input type="text" maxlength="'+Y.maxlength+'" style="width:100%"/></span>'],z=v.create("text",q,Y),z.type=JXG$1.OBJECT_TYPE_INPUT,z.rendNodeLabel=z.rendNode.childNodes[0].childNodes[0],z.rendNodeInput=z.rendNode.childNodes[0].childNodes[1],z.rendNodeInput.value=N[2],z.rendNodeTag=z.rendNodeInput,z.rendNodeTag.disabled=!!Y.disabled,z.rendNodeLabel.id=z.rendNode.id+"_label",z.rendNodeInput.id=z.rendNode.id+"_input",z.rendNodeInput.setAttribute("aria-labelledby",z.rendNodeLabel.id),z.setText(N[3]),z._value=N[2],z.update=function(){return this.needsUpdate&&(JXG$1.Text.prototype.update.call(this),this._value=this.rendNodeInput.value),this},z.Value=function(){return this._value},z.set=function(W){return this._value=W,this.rendNodeInput.value=W,this},JXG$1.addEvent(z.rendNodeInput,"input",priv$1.InputInputEventHandler,z),JXG$1.addEvent(z.rendNodeInput,"mousedown",function(W){JXG$1.exists(W.stopPropagation)&&W.stopPropagation()},z),JXG$1.addEvent(z.rendNodeInput,"touchstart",function(W){JXG$1.exists(W.stopPropagation)&&W.stopPropagation()},z),JXG$1.addEvent(z.rendNodeInput,"pointerdown",function(W){JXG$1.exists(W.stopPropagation)&&W.stopPropagation()},z),z.visPropOld.fontsize="0px",v.renderer.updateTextStyle(z,!1),z};JXG$1.registerElement("input",JXG$1.createInput);var priv={ButtonClickEventHandler:function(){this._handler&&this._handler(),this.board.update()}};JXG$1.createButton=function(v,N,G){var z,q,Y=JXG$1.copyAttributes(G,v.options,"button");return q=[N[0],N[1],'<button type="button" style="width:100%;" tabindex="0"></button>'],z=v.create("text",q,Y),z.type=JXG$1.OBJECT_TYPE_BUTTON,z.rendNodeButton=z.rendNode.childNodes[0],z.rendNodeButton.id=z.rendNode.id+"_button",z.rendNodeTag=z.rendNodeButton,z.rendNodeTag.disabled=!!Y.disabled,z.setText(N[2]),z.visPropOld.fontsize="0px",v.renderer.updateTextStyle(z,!1),N[3]&&(JXG$1.isString(N[3])?(z._jc=new JXG$1.JessieCode,z._jc.use(v),z._handler=function(){z._jc.parse(N[3])}):z._handler=N[3]),JXG$1.addEvent(z.rendNodeButton,"click",priv.ButtonClickEventHandler,z),JXG$1.addEvent(z.rendNodeButton,"mousedown",function(W){JXG$1.exists(W.stopPropagation)&&W.stopPropagation()},z),JXG$1.addEvent(z.rendNodeButton,"touchstart",function(W){JXG$1.exists(W.stopPropagation)&&W.stopPropagation()},z),JXG$1.addEvent(z.rendNodeButton,"pointerdown",function(W){JXG$1.exists(W.stopPropagation)&&W.stopPropagation()},z),z};JXG$1.registerElement("button",JXG$1.createButton);JXG$1.createVectorField=function(v,N,G){var z,q;if(!(N.length>=3&&(JXG$1.isArray(N[0])||JXG$1.isFunction(N[0])||JXG$1.isString(N[0]))&&JXG$1.isArray(N[1])&&N[1].length===3&&JXG$1.isArray(N[2])&&N[2].length===3))throw new Error("JSXGraph: Can't create vector field with parent types '"+typeof N[0]+"', '"+typeof N[1]+"', '"+typeof N[2]+"'.");return q=JXG$1.copyAttributes(G,v.options,"vectorfield"),z=v.create("curve",[[],[]],q),z.elType="vectorfield",z.setF=function(Y,W){var ie,ne;return JXG$1.isArray(Y)?(ie=JXG$1.createFunction(Y[0],this.board,W),ne=JXG$1.createFunction(Y[1],this.board,W),this.F=function(se,ae){return[ie(se,ae),ne(se,ae)]}):this.F=JXG$1.createFunction(Y,z.board,W),this},z.setF(N[0],"x, y"),z.xData=N[1],z.yData=N[2],z.updateDataArray=function(){var Y,W,ie,ne,se=this.evalVisProp("scale"),ae=JXG$1.evaluate(this.xData[0]),ce=JXG$1.evaluate(this.xData[1]),pe=JXG$1.evaluate(this.xData[2]),ge=(pe-ae)/ce,ve=JXG$1.evaluate(this.yData[0]),be=JXG$1.evaluate(this.yData[1]),Ee=JXG$1.evaluate(this.yData[2]),Pe=(Ee-ve)/be,Je,Ce,Ve,Re,qe=this.evalVisProp("arrowhead.enabled"),et,Ze,tt,Ke;for(qe&&(et=this.evalVisProp("arrowhead.size"),Ze=et/v.unitX,tt=et/v.unitY,Ke=this.evalVisProp("arrowhead.angle")),this.dataX=[],this.dataY=[],ie=0,Y=ae;ie<=ce;Y+=ge,ie++)for(ne=0,W=ve;ne<=be;W+=Pe,ne++)Je=this.F(Y,W),Je[0]*=se,Je[1]*=se,JXG$1.concat(this.dataX,[Y,Y+Je[0],NaN]),JXG$1.concat(this.dataY,[W,W+Je[1],NaN]),qe&&Math.abs(Je[0])+Math.abs(Je[1])>0&&(Ce=Math.atan2(Je[1],Je[0]),Ve=Ce+Ke,Re=Ce-Ke,JXG$1.concat(this.dataX,[Y+Je[0]-Math.cos(Ve)*Ze,Y+Je[0],Y+Je[0]-Math.cos(Re)*Ze,NaN]),JXG$1.concat(this.dataY,[W+Je[1]-Math.sin(Ve)*tt,W+Je[1],W+Je[1]-Math.sin(Re)*tt,NaN]))},z.methodMap=JXG$1.deepCopy(z.methodMap,{setF:"setF"}),z};JXG$1.registerElement("vectorfield",JXG$1.createVectorField);JXG$1.createSlopeField=function(v,N,G){var z,q,Y;if(!(N.length>=3&&(JXG$1.isFunction(N[0])||JXG$1.isString(N[0]))&&JXG$1.isArray(N[1])&&N[1].length===3&&JXG$1.isArray(N[2])&&N[2].length===3))throw new Error("JSXGraph: Can't create slope field with parent types '"+typeof N[0]+"', '"+typeof N[1]+"', '"+typeof N[2]+"'.");return q=JXG$1.createFunction(N[0],v,"x, y"),N[0]=function(W,ie){var ne=q(W,ie),se=Math.sqrt(1+ne*ne);return[1/se,ne/se]},Y=JXG$1.copyAttributes(G,v.options,"slopefield"),z=v.create("vectorfield",N,Y),z.elType="slopefield",z.setF=function(W,ie){var ne=JXG$1.createFunction(W,z.board,ie);this.F=function(se,ae){var ce=ne(se,ae),pe=Math.sqrt(1+ce*ce);return[1/pe,ce/pe]}},z.methodMap=JXG$1.deepCopy(z.methodMap,{setF:"setF"}),z};JXG$1.registerElement("slopefield",JXG$1.createSlopeField);JXG$1.createSmartLabel=function(v,N,G){var z,q,Y,W,ie,ne;if(N.length===0||[Const.OBJECT_CLASS_POINT,Const.OBJECT_CLASS_LINE,Const.OBJECT_CLASS_CIRCLE].indexOf(N[0].elementClass)<0&&[Const.OBJECT_TYPE_POLYGON,Const.OBJECT_TYPE_ANGLE].indexOf(N[0].type)<0)throw new Error("JSXGraph: Can't create smartlabel with parent types '"+typeof N[0]+"', '"+typeof N[1]+"'.");return Y=N[0],W=N[1]||"",Y.elementClass===Const.OBJECT_CLASS_POINT?q=JXG$1.copyAttributes(G,v.options,"smartlabelpoint"):Y.elementClass===Const.OBJECT_CLASS_LINE?(q=JXG$1.copyAttributes(G,v.options,"smartlabelline"),q.rotate=function(){return Math.atan(Y.getSlope())*180/Math.PI},q.visible=function(){return!(Y.L()<1.5)}):Y.elementClass===Const.OBJECT_CLASS_CIRCLE?(q=JXG$1.copyAttributes(G,v.options,"smartlabelcircle"),q.visible=function(){return!(Y.Radius()<1.5)}):Y.type===Const.OBJECT_TYPE_POLYGON?q=JXG$1.copyAttributes(G,v.options,"smartlabelpol
212ygon"):Y.type===Const.OBJECT_TYPE_ANGLE&&(q=JXG$1.copyAttributes(G,v.options,"smartlabelangle"),q.rotate=function(){var se=Y.center.coords.usrCoords,ae=Y.getLabelAnchor().usrCoords,ce=Math.atan2(ae[2]-se[2],ae[1]-se[1])*180/Math.PI;return ce>90&&ce<270?ce+180:ce},q.anchorX=function(){var se=Y.center.coords.usrCoords,ae=Y.getLabelAnchor().usrCoords,ce=Math.atan2(ae[2]-se[2],ae[1]-se[1])*180/Math.PI;return ce>90&&ce<270?"right":"left"}),ie=function(se,ae,ce,pe){var ge;switch(pe){case"length":ge=function(){return ae.L()};break;case"slope":ge=function(){return ae.Slope()};break;case"area":ge=function(){return ae.Area()};break;case"radius":ge=function(){return ae.Radius()};break;case"perimeter":ge=function(){return ae.Perimeter()};break;case"rad":ge=function(){return ae.Value()};break;case"deg":ge=function(){return ae.Value()*180/Math.PI};break;default:ge=function(){return 0}}return function(){var ve="",be,Ee=JXG$1.evaluate(W),Pe=se.evalVisProp("digits"),Je=se.evalVisProp("unit"),Ce=se.evalVisProp("prefix"),Ve=se.evalVisProp("suffix"),Re=se.evalVisProp("usemathjax")||se.evalVisProp("usekatex");return Ee===""?(se.useLocale()?be=se.formatNumberLocale(ge(),Pe):be=JXG$1.toFixed(ge(),Pe),Re?ve=["\\(",Ce,be,"\\,",Je,Ve,"\\)"].join(""):ve=[Ce,be,Je,Ve].join("")):ve=Ee,ve}},Y.elementClass===Const.OBJECT_CLASS_POINT?(z=v.create("text",[function(){return Y.X()},function(){return Y.Y()},""],q),ne=function(){var se="",ae=JXG$1.evaluate(W),ce=z.evalVisProp("digits"),pe=z.evalVisProp("unit"),ge=z.evalVisProp("prefix"),ve=z.evalVisProp("suffix"),be=z.evalVisProp("dir"),Ee=z.evalVisProp("usemathjax")||z.evalVisProp("usekatex"),Pe,Je;return z.useLocale()?(Pe=z.formatNumberLocale(Y.X(),ce),Je=z.formatNumberLocale(Y.Y(),ce)):(Pe=JXG$1.toFixed(Y.X(),ce),Je=JXG$1.toFixed(Y.Y(),ce)),ae===""?be==="row"?Ee?se=["\\(",ge,Pe,"\\,",pe," / ",Je,"\\,",pe,ve,"\\)"].join(""):se=[ge,Pe," ",pe," / ",Je," ",pe,ve].join(""):be.indexOf("col")===0&&(Ee?se=["\\(",ge,"\\left(\\array{",Pe,"\\,",pe,"\\\\ ",Je,"\\,",pe,"}\\right)",ve,"\\)"].join(""):se=[ge,Pe," ",pe,"<br/>",Je," ",pe,ve].join("")):se=ae,se}):Y.elementClass===Const.OBJECT_CLASS_LINE?q.measure==="length"?(z=v.create("text",[function(){return(Y.point1.X()+Y.point2.X())*.5},function(){return(Y.point1.Y()+Y.point2.Y())*.5},""],q),ne=ie(z,Y,"line","length")):q.measure==="slope"&&(z=v.create("text",[function(){return Y.point1.X()*.25+Y.point2.X()*.75},function(){return Y.point1.Y()*.25+Y.point2.Y()*.75},""],q),ne=ie(z,Y,"line","slope")):Y.elementClass===Const.OBJECT_CLASS_CIRCLE?q.measure==="radius"?(z=v.create("text",[function(){return Y.center.X()+Y.Radius()*.5},function(){return Y.center.Y()},""],q),ne=ie(z,Y,"circle","radius")):q.measure==="area"?(z=v.create("text",[function(){return Y.center.X()},function(){return Y.center.Y()+Y.Radius()*.5},""],q),ne=ie(z,Y,"circle","area")):(q.measure==="circumference"||q.measure==="perimeter")&&(z=v.create("text",[function(){return Y.getLabelAnchor()},""],q),ne=ie(z,Y,"circle","perimeter")):Y.type===Const.OBJECT_TYPE_POLYGON?q.measure==="area"?(z=v.create("text",[function(){return Y.getTextAnchor()},""],q),ne=ie(z,Y,"polygon","area")):q.measure==="perimeter"&&(z=v.create("text",[function(){var se=Y.borders.length-1;return se>=0?[(Y.borders[se].point1.X()+Y.borders[se].point2.X())*.5,(Y.borders[se].point1.Y()+Y.borders[se].point2.Y())*.5]:Y.getTextAnchor()},""],q),ne=ie(z,Y,"polygon","perimeter")):Y.type===Const.OBJECT_TYPE_ANGLE&&(z=v.create("text",[function(){return Y.getLabelAnchor()},""],q),ne=ie(z,Y,"angle",q.measure)),JXG$1.exists(z)&&(z.setText(ne),Y.addChild(z),z.setParents([Y])),z};JXG$1.registerElement("smartlabel",JXG$1.createSmartLabel);JXG$1.ForeignObject=function(v,N,G,z,q){this.constructor(v,G,Const.OBJECT_TYPE_FOREIGNOBJECT,Const.OBJECT_CLASS_OTHER),this.element=this.board.select(G.anchor),this.coordsConstructor(N),this._useUserSize=!1,this.size=[1,1],JXG$1.exists(q)&&q.length>0&&(this._useUserSize=!0,this.W=JXG$1.createFunction(q[0],this.board,""),this.H=JXG$1.createFunction(q[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()]),this.content=z,this.elType="foreignobject",this.id=this.board.setId(this,"Im"),this.board.renderer.drawForeignObject(this),this.board.finalizeAdding(this),this.methodMap=JXG$1.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H"})};JXG$1.ForeignObject.prototype=new GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.ForeignObject,CoordsElement,"coordsConstructor");JXG$1.extend(JXG$1.ForeignObject.prototype,{hasPoint:function(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce=this.transformations.length;return JXG$1.isObject(this.evalVisProp("precision"))?(Y=this.board._inputDevice,W=this.evalVisProp("precision."+Y)):W=this.board.options.precision.hasPoint,ce===0?(G=v-this.coords.scrCoords[1],z=this.coords.scrCoords[2]-N,q=W,G>=-q&&G-this.size[0]<=q&&z>=-q&&z-this.size[1]<=q):(ie=new Coords(Const.COORDS_BY_SCREEN,[v,N],this.board),ie=ie.usrCoords,ne=[ie[0]-this.span[0][0],ie[1]-this.span[0][1],ie[2]-this.span[0][2]],ae=Mat.innerProduct,se=ae(ne,this.span[1]),0<=se&&se<=ae(this.span[1],this.span[1])&&(se=ae(ne,this.span[2]),0<=se&&se<=ae(this.span[2],this.span[2])))},update:function(v){return this.needsUpdate?(this.updateCoords(v),this.updateSize(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateForeignObject")},updateSize:function(){var v=[0,0];return this._useUserSize?(this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)]):this.rendNode.hasChildNodes()&&(v=this.rendNode.childNodes[0].getBoundingClientRect(),this.size=[v.width,v.height]),this},updateSpan:function(){var v,N,G=this.transformations.length,z=[];if(G===0)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(z[0]=[this.Z(),this.X(),this.Y()],z[1]=[this.Z(),this.X()+this.W(),this.Y()],z[2]=[this.Z(),this.X(),this.Y()+this.H()],v=0;v<G;v++)for(N=0;N<3;N++)z[N]=Mat.matVecMult(this.transformations[v].matrix,z[N]);for(N=0;N<3;N++)z[N][1]/=z[N][0],z[N][2]/=z[N][0],z[N][0]/=z[N][0];for(N=1;N<3;N++)z[N][0]-=z[0][0],z[N][1]-=z[0][1],z[N][2]-=z[0][2];this.span=z}return this},addTransform:function(v){var N;if(JXG$1.isArray(v))for(N=0;N<v.length;N++)this.transformations.push(v[N]);else this.transformations.push(v);return this},getParents:function(){var v=[this.url,[this.Z(),this.X(),this.Y()],this.usrSize];return this.parents.length!==0&&(v=this.parents),v},setSize:function(v,N){return this.W=JXG$1.createFunction(v,this.board,""),this.H=JXG$1.createFunction(N,this.board,""),this._useUserSize=!0,this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}});JXG$1.createForeignObject=function(v,N,G){var z,q,Y=N[0],W=N[1],ie=[];if(N.length>=2&&(ie=N[2]),z=JXG$1.copyAttributes(G,v.options,"foreignobject"),q=CoordsElement.create(JXG$1.ForeignObject,v,W,z,Y,ie),!q)throw new Error("JSXGraph: Can't create foreignObject with parent types '"+typeof N[0]+"' and '"+typeof N[1]+`'.
213Possible parent types: [string, [x, y], [w, h]], [string, [x, y]], [element,transformation]`);return q};JXG$1.registerElement("foreignobject",JXG$1.createForeignObject);JXG$1.registerElement("fo",JXG$1.createForeignObject);JXG$1.ForeignObject;JXG$1.extend(Options,{axes3d:{axesPosition:"center",xAxis:{visible:!0,point2:{name:"x"},strokeColor:JXG$1.palette.red},yAxis:{visible:!0,point2:{name:"y"},strokeColor:JXG$1.palette.green},zAxis:{visible:!0,point2:{name:"z"},strokeColor:JXG$1.palette.blue},xAxisBorder:{name:"x",visible:"ìnherit",withLabel:!1,label:{position:"50% left",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},yAxisBorder:{name:"y",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[0,-30],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle"}}},zAxisBorder:{name:"z",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},xPlaneRear:{visible:!0,layer:0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",mesh3d:{layer:1}},yPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},zPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},xPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},yPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},zPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},xPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneFrontYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneFrontZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneFrontXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneFrontZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneFrontXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneFrontYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1}},axis3d:{highlight:!1,fixed:!0,strokeColor:"black",strokeWidth:1,tabindex:null,point1:{visible:!1,name:"",withLabel:!1},point2:{visible:!1,name:"",withLabel:!1,label:{visible:!0}}},circle3d:{layer:12,point:{visible:!1,name:""},needsRegularUpdate:!0},curve3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,numberPointsHigh:200,needsRegularUpdate:!0},face3d:{transitionProperties:[],layer:12,highlight:!1,tabindex:null,strokeWidth:1,fillColor:JXG$1.palette.yellow,fillOpacity:.4,needsRegularUpdate:!0,shader:{enabled:!1,type:"angle",hue:60,saturation:90,minLightness:30,maxLightness:90}},intersectionline3d:{point1:{visible:!1,name:""},point2:{visible:!1,name:""}},line3d:{layer:12,strokeWidth:1,strokeColor:"black",fixed:!0,tabindex:null,gradient:"linear",gradientSecondColor:"#ffffff",needsRegularUpdate:!0,point:{visible:!1,name:""},point1:{visible:!1,name:""},point2:{visible:!1,name:""},straightFirst:!1,straightLast:!1},mesh3d:{layer:12,strokeWidth:1,strokeColor:"#9a9a9a",strokeOpacity:.6,highlight:!1,tabindex:null,needsRegularUpdate:!0,stepWidthU:1,stepWidthV:1},plane3d:{layer:12,strokeWidth:0,strokeColor:"black",strokeOpacity:1,highlight:!1,tabindex:null,needsRegularUpdate:!0,visible:!0,gradient:"linear",gradientSecondColor:"#ffffff",gradientAngle:Math.PI,fillColor:"#a7a7a7",fillOpacity:.6,mesh3d:{visible:"inherit"},threePoints:!1,point:{visible:!1,name:"",fixed:!0},point1:{visible:!1,name:""},point2:{visible:!1,name:""},point3:{visible:!1,name:""}},point3d:{layer:13,infoboxDigits:"auto",strokeWidth:0,gradient:"radial",gradientSecondColor:"#555555",fillColor:"yellow",highlightStrokeColor:"#555555",gradientFX:.7,gradientFY:.3,needsRegularUpdate:!0},polygon3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,fillColor:"none",needsRegularUpdate:!0},polyhedron3d:{fillColorArray:["white","black"],needsRegularUpdate:!0},sphere3d:{layer:12,highlight:!1,strokeWidth:1,strokeColor:"#00ff80",fillColor:"white",gradient:"radial",gradientSecondColor:"#00ff80",gradientFX:.7,gradientFY:.3,fillOpacity:.4,needsRegularUpdate:!0},surface3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,stepsU:30,stepsV:30,needsRegularUpdate:!0},text3d:{withLabel:!1,needsRegularUpdate:!0},ticks3d:{visible:!0,ticksDistance:1,majorHeight:10,minorTicks:0,tickEndings:[0,1],drawLabels:!0,needsRegularUpdate:!0,label:{visible:!0,withLabel:!1}},vectorfield3d:{scale:1,arrowhead:{enabled:!0,size:5,angle:Math.PI*.125},needsRegularUpdate:!0},view3d:{needsRegularUpdate:!0,depthOrder:{enabled:!1,layers:[12,13]},projection:"parallel",verticalDrag:{enabled:!0,key:"shift"},az:{pointer:{enabled:!0,speed:1,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{pos:"auto",frozen:!1},point2:{pos:"auto",frozen:!1},min:0,max:2*Math.PI,start:1}},el:{pointer:{enabled:!0,speed:1,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{frozen:!1,pos:"auto"},point2:{frozen:!1,pos:"auto"},min:0,max:2*Math.PI,start:.3}},bank:{pointer:{enabled:!0,speed:.08,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{frozen:!1,pos:"auto"},point2:{frozen:!1,pos:"auto"},min:-Math.PI,max:Math.PI,start:0}},trackball:{enabled:!1,outside:!0,button:-1,key:"none"},r:"auto",fov:1/5*2*Math.PI,values:[[0,1.57],[.78,.62],[0,0],[5.49,.62],[4.71,0],[3.93,.62],[3.14,0],[2.36,.62],[1.57,1.57]],infobox:{strokeColor:"#000000",fontSize:16,useKatex:!1,useMathjax:!1,intl:{enabled:!0,options:{minimumFractionDigits:2,maximumFractionDigits:3}}},_currentView:-1}});JXG$1.Options;JXG$1.View3D=function(v,N,G){this.constructor(v,G,Const.OBJECT_TYPE_VIEW3D,Const.OBJECT_CLASS_3D),this.objects={},this.depthOrdered={},this.elementsByName={},this.defaultAxes=null,this.angles={az:null,el:null,bank:null},this.matrix3DRot=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.matrix3DRotShift=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.matrix3D=[[1,0,0,0],[0,1,0,0],[0,0,1,0]],this.boxToCam=[],this.llftCorner=N[0],this.size=N[1],this.bbox3D=N[2],this.r=-1,this.focalDist=-1,this.projectionType="parallel",this.trackballEnabled=!1,this.timeoutAzimuth=null,this.zIndexMin=1/0,this.zIndexMax=-1/0,this.id=this.board.setId(this,"V"),this.board.finalizeAdding(this),this.elType="view3d",this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.View3D.prototype=new GeometryElement;JXG$1.extend(JXG$1.View3D.prototype,{create:function(v,N,G){var z=[],q;return v.indexOf("3d")>0&&z.push(this),q=this.board.create(v,z.concat(N),G),q},select:function(v,N){var G,z,q,Y,W=v;if(W===null)return W;if(JXG$1.isString(W)&&W!=="")JXG$1.exists(this.objects[W])?W=this.objects[W]:JXG$1.exists(this.elementsByName[W])&&(W=this.elementsByName[W]);else if(!N&&(JXG$1.isFunction(W)||JXG$1.isObject(W)&&!JXG$1.isFunction(W.setAttribute))){for(G=JXG$1.filterElements(this.objectsList,W),z={},Y=G.length,q=0;q<Y;q++)z[G[q].id]=G[q];W=new Composition(z)}else JXG$1.isObject(W)&&JXG$1.exists(W.id)&&!JXG$1.exists(this.objects[W.id])&&(W=null);return W},setAnglesFromRotation:function(){var v=this.matrix3DRot,N,G,z,q,Y,W,ie;N=Math.sqrt(v[1][3]*v[1][3]+v[2][3]*v[2][3]),N>Mat.eps?(G=v[2][3]/N,z=v[1][3]/N):(G=Math.cos(this.angles.bank),z=Math.sin(this.angles.bank)),v=Mat.matMatMult([[1,0,0,0],[0,G,-z,0],[0,z,G,0],[0,0,0,1]],v),this.angles.bank=Math.atan2(z,G),q=v[2][3],Y=v[3][3],v=Mat.matMatMult([[1,0,0,0],[0,1,0,0],[0,0,q,Y],[0,0,-Y,q]],v),this.angles.el=Math.atan2(Y,q),W=-v[1][1],ie=v[3][1],this.angles.az=Math.atan2(ie,W),this.angles.az<0&&(this.angles.az+=2*Math.PI),this.setSlidersFromAngles()},anglesHaveMoved:function(){return this._hasMoveAz||this._hasMoveEl||Math.abs(this.angles.az-this.az_slide.Value())>Mat.eps||Math.abs(this.angles.el-this.el_slide.Value())>Mat.eps||Math.abs(this.angles.bank-this.bank_slide.Value())>Mat.eps},getAnglesFromSliders:function(){this.angles.az=this.az_slide.Value(),this.angles.el=this.el_slide.Value(),this.angles.bank=this.bank_slide.Value()},setSlidersFromAngles:function(){this.az_slide.setValue(this.angles.az),this.el_slide.setValue(this.angles.el),this.bank_slide.setValue(this.angles.bank)},getRotationFromAngles:function(){var v,N,G,z,q,Y,W=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return v=this.angles.az,N=this.angles.el,G=this.angles.bank,z=-Math.sin(N),W[1][1]=-Math.cos(v),W[1][2]=Math.sin(v),W[1][3]=0,W[2][1]=z*Math.sin(v),W[2][2]=z*Math.cos(v),W[2][3]=Math.cos(N),W[3][1]=Math.cos(N)*Math.sin(v),W[3][2]=Math.cos(N)*Math.cos(v),W[3][3]=Math.sin(N),q=Math.cos(G),Y=Math.sin(G),W=Mat.matMatMult([[1,0,0,0],[0,q,Y,0],[0,-Y,q,0],[0,0,0,1]],W),W},_projectToSphere:function(
213v,N,G){var z=Mat.hypot(N,G),q,Y;return z<v*.7071067811865475?Y=Math.sqrt(v*v-z*z):(q=v/1.414213562373095,Y=q*q/z),Y},updateProjectionTrackball:function(v){var N=100,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return JXG$1.exists(this._trackball)?(G=this._trackball.dx,z=this._trackball.dy,q=G*G+z*z,q>Mat.eps&&(N=(this.size[0]*this.board.unitX+this.size[1]*this.board.unitY)*.25,ie=this._trackball.x,ne=this._trackball.y,W=[ie,ne,this._projectToSphere(N,ie,ne)],ie-=G,ne-=z,Y=[ie,ne,this._projectToSphere(N,ie,ne)],ve=Mat.crossProduct(Y,W),ce=Mat.hypot(ve[0],ve[1],ve[2]),ve[0]/=ce,ve[1]/=ce,ve[2]/=ce,ae=Geometry.distance(W,Y,3)/(2*N),ae=ae>1?1:ae,ae=ae<-1?-1:ae,se=2*Math.asin(ae),pe=Math.cos(se),ae=1-pe,ge=Math.sin(se),be[1][1]=pe+ve[0]*ve[0]*ae,be[2][1]=ve[1]*ve[0]*ae+ve[2]*ge,be[3][1]=ve[2]*ve[0]*ae-ve[1]*ge,be[1][2]=ve[0]*ve[1]*ae-ve[2]*ge,be[2][2]=pe+ve[1]*ve[1]*ae,be[3][2]=ve[2]*ve[1]*ae+ve[0]*ge,be[1][3]=ve[0]*ve[2]*ae+ve[1]*ge,be[2][3]=ve[1]*ve[2]*ae-ve[0]*ge,be[3][3]=pe+ve[2]*ve[2]*ae),be=Mat.matMatMult(be,this.matrix3DRot),be):this.matrix3DRot},updateAngleSliderBounds:function(){var v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe;this.trackballEnabled=this.evalVisProp("trackball.enabled"),this.trackballEnabled?(this.az_slide.setMin(0),this.az_slide.setMax(2*Math.PI),this.el_slide.setMin(-.5*Math.PI),this.el_slide.setMax(.5*Math.PI),this.bank_slide.setMin(-Math.PI),this.bank_slide.setMax(Math.PI)):(this.az_slide.setMin(this.visProp.az.slider.min),this.az_slide.setMax(this.visProp.az.slider.max),this.el_slide.setMin(this.visProp.el.slider.min),this.el_slide.setMax(this.visProp.el.slider.max),this.bank_slide.setMin(this.visProp.bank.slider.min),this.bank_slide.setMax(this.visProp.bank.slider.max)),v=this.az_slide._smax,N=this.az_slide._smin,G=this.el_slide._smax,z=this.el_slide._smin,ce=this.bank_slide._smax,pe=this.bank_slide._smin,this.trackballEnabled?(q=Mat.mod(this.angles.el,2*Math.PI),.5*Math.PI<q&&q<1.5*Math.PI&&(this.angles.el=Math.PI-q,this.angles.az=Mat.wrap(this.angles.az+Math.PI,N,v),this.angles.bank=Mat.wrap(this.angles.bank+Math.PI,pe,ce)),this.angles.az=Mat.wrap(this.angles.az,N,v),this.angles.el=Mat.wrap(this.angles.el,z,G),this.angles.bank=Mat.wrap(this.angles.bank,pe,ce)):(ae=function(ge){return ge<z?z-ge:G<ge?ge-G:0},Y=.5*(z+G),W=Mat.wrap(this.angles.el,Y-Math.PI,Y+Math.PI),ie=Mat.wrap(Math.PI-this.angles.el,Y-Math.PI,Y+Math.PI),ne=ae(W),se=ae(ie),ne<=se?this.angles.el=Mat.clamp(W,z,G):(this.angles.el=Mat.clamp(ie,z,G),this.angles.az=Mat.wrap(this.angles.az+Math.PI,N,v),this.angles.bank=Mat.wrap(this.angles.bank+Math.PI,pe,ce)),this.angles.az=Mat.wrapAndClamp(this.angles.az,N,v,2*Math.PI),this.angles.bank=Mat.wrapAndClamp(this.angles.bank,pe,ce,2*Math.PI),this.matrix3DRot=this.getRotationFromAngles()),this.setSlidersFromAngles()},_updateCentralProjection:function(){var v=20,N=8,G,z;return G=this.evalVisProp("r"),G==="auto"&&(G=Mat.hypot(this.bbox3D[0][0]-this.bbox3D[0][1],this.bbox3D[1][0]-this.bbox3D[1][1],this.bbox3D[2][0]-this.bbox3D[2][1])*1.01),this.boxToCam=this.matrix3DRot.map(function(q){return q.slice()}),this.boxToCam[3][0]=-G,this.focalDist=1/Math.tan(.5*this.evalVisProp("fov")),z=[[0,0,0,-1],[0,this.focalDist,0,0],[0,0,this.focalDist,0],[2*v*N/(N-v),0,0,(v+N)/(N-v)]],Mat.matMatMult(z,this.boxToCam)},update:function(){var v=this.r,N=[[1,0,0,0],[0,-v,0,0],[0,0,-v,0],[0,0,0,1]],G,z,q,Y,W;if(!JXG$1.exists(this.el_slide)||!JXG$1.exists(this.az_slide)||!JXG$1.exists(this.bank_slide)||!this.needsUpdate)return this.needsUpdate=!1,this;switch(G=[[1,0,0],[0,1,0],[0,0,1]],this.projectionType=this.evalVisProp("projection").toLowerCase(),this.trackballEnabled!==this.evalVisProp("trackball.enabled")&&this.updateAngleSliderBounds(),this._hasMoveTrackball?(this.matrix3DRot=this.updateProjectionTrackball(),this.setAnglesFromRotation()):this.anglesHaveMoved()&&(this.getAnglesFromSliders(),this.matrix3DRot=this.getRotationFromAngles()),this.shift=[[1,0,0,0],[-.5*(this.bbox3D[0][0]+this.bbox3D[0][1]),1,0,0],[-.5*(this.bbox3D[1][0]+this.bbox3D[1][1]),0,1,0],[-.5*(this.bbox3D[2][0]+this.bbox3D[2][1]),0,0,1]],this.projectionType){case"central"
213:q=2*.4,G[1][1]=this.size[0]/q,G[2][2]=this.size[1]/q,G[1][0]=this.llftCorner[0]+G[1][1]*.5*q,G[2][0]=this.llftCorner[1]+G[2][2]*.5*q,this.viewPortTransform=G,z=this._updateCentralProjection(),this.matrix3D=Mat.matMatMult(z,this.shift);break;case"parallel":default:Y=this.bbox3D[0][1]-this.bbox3D[0][0],W=this.bbox3D[1][1]-this.bbox3D[1][0],G[1][1]=this.size[0]/Y,G[2][2]=this.size[1]/W,G[1][0]=this.llftCorner[0]+G[1][1]*.5*Y,G[2][0]=this.llftCorner[1]+G[2][2]*.5*W,this.matrix3D=Mat.matMatMult(G,Mat.matMatMult(Mat.matMatMult(this.matrix3DRot,N),this.shift).slice(0,3))}return this.matrix3DRotShift=Mat.matMatMult(this.matrix3DRot,this.shift),this},compareDepth:function(v,N){return v.zIndex-N.zIndex},updateZIndices:function(){var v,N;for(v in this.objects)this.objects.hasOwnProperty(v)&&(N=this.objects[v],(N.type===Const.OBJECT_TYPE_LINE3D||N.type===Const.OBJECT_TYPE_POLYGON3D)&&JXG$1.exists(N.element2D)&&N.element2D.evalVisProp("visible")&&N.updateZIndex())},updateShaders:function(){var v,N,G;for(v in this.objects)this.objects.hasOwnProperty(v)&&(N=this.objects[v],JXG$1.exists(N.shader)&&(G=N.shader(),G<this.zIndexMin?this.zIndexMin=G:G>this.zIndexMax&&(this.zIndexMax=G)))},updateDepthOrdering:function(){var v,N,G,z,q;for(z=this.evalVisProp("depthorder.layers"),G=0;G<z.length;G++)this.depthOrdered[z[G]]=[];for(v in this.objects)this.objects.hasOwnProperty(v)&&(N=this.objects[v],(N.type===Const.OBJECT_TYPE_FACE3D||N.type===Const.OBJECT_TYPE_LINE3D||N.type===Const.OBJECT_TYPE_POINT3D||N.type===Const.OBJECT_TYPE_POLYGON3D)&&JXG$1.exists(N.element2D)&&N.element2D.evalVisProp("visible")&&(q=N.element2D.evalVisProp("layer"),z.indexOf(q)>=0&&this.depthOrdered[q].push(N)));if(this.board.renderer&&this.board.renderer.type==="svg")for(G=0;G<z.length;G++)q=z[G],this.depthOrdered[q].sort(this.compareDepth.bind(this)),this.depthOrdered[q].forEach(Y=>this.board.renderer.setLayer(Y.element2D,q));return this},updateRenderer:function(){return this.needsUpdate?(this.depthOrdered={},this.shift!==void 0&&this.evalVisProp("depthorder.enabled")&&(this.updateZIndices(),this.updateShaders(),this.board.renderer&&this.board.renderer.type==="svg"&&this.updateDepthOrdering()),this.needsUpdate=!1,this):this},removeObject:function(v,N){var G,z;if(JXG$1.isArray(v)){for(G=0;G<v.length;G++)this.removeObject(v[G]);return this}if(v=this.select(v),!JXG$1.exists(v)||JXG$1.isString(v))return this;try{for(z in v.childElements)v.childElements.hasOwnProperty(z)&&this.removeObject(v.childElements[z]);delete this.objects[v.id]}catch(q){JXG$1.debug("View3D "+v.id+": Could not be removed: "+q)}return this.board.removeObject(v,N),this},worldToFocal:function(v,N=!0){var G,z=Mat.matVecMult(this.boxToCam,Mat.matVecMult(this.shift,v));if(z[3]-=z[0]*this.focalDist,N)return z;for(G=1;G<4;G++)z[G]/=z[0];return z.slice(1,4)},project3DTo2D:function(v,N,G){var z,q;switch(arguments.length===3?z=[1,v,N,G]:v.length===3?(z=v.slice(),z.unshift(1)):z=v,q=Mat.matVecMult(this.matrix3D,z),this.projectionType){case"central":return q[1]/=q[0],q[2]/=q[0],q[3]/=q[0],q[0]/=q[0],Mat.matVecMult(this.viewPortTransform,q.slice(0,3));case"parallel":default:return q}},_getW0:function(v,N,G){var z=Mat.inverse(v),q=z[0][0]+N[1]*z[0][1]+N[2]*z[0][2],Y=z[3][0]+N[1]*z[3][1]+N[2]*z[3][2],W,ie,ne;return ne=G*z[0][3]-z[3][3],W=(Y*z[0][3]-q*z[3][3])/ne,ie=(Y-q*G)/ne,[1/W,ie]},project2DTo3DPlane:function(v,N,G){var z,q,Y,W,ie,ne=G.slice(1)||[0,0,0],se=N.slice(1),ae,ce,pe;if(W=Mat.norm(se,3),Y=Mat.innerProduct(ne,se,3)/W,this.projectionType==="parallel"){z=this.matrix3D.slice(0,3),z.push([0,se[0],se[1],se[2]]),q=v.coords.usrCoords.slice(),q.push(Y);try{z[2][3]===1&&(z[2][1]=z[2][2]=Mat.eps*.001),ie=Mat.Numerics.Gauss(z,q)}catch{ie=[0,NaN,NaN,NaN]}}else{z=this.matrix3D,q=v.coords.usrCoords.slice(),ae=Mat.Numerics.Gauss(this.viewPortTransform,q),pe=this._getW0(z,ae,Y),ce=pe[0],q=[ae[0]*ce,ae[1]*ce,ae[2]*ce,pe[1]*ce];try{z[2][3]===1&&(z[2][1]=z[2][2]=Mat.eps*.001),ie=Mat.Numerics.Gauss(z,q),ie[1]/=ie[0],ie[2]/=ie[0],ie[3]/=ie[0],ie[0]/=ie[0]}catch{ie=[0,NaN,NaN,NaN]}}return ie},projectScreenToSegment:function(v,N,G){var z=this.project3DTo2D(N).slice(1,3),q=this.project3DTo2D(G).slice(1,3),Y=[q[0]-z[0],q[1]-z[1]],W=Mat.innerProduct(Y,Y),ie=[v[0]-z[0],v[1]-z[1]],ne=Mat.innerProduct(ie,Y)/W,se,ae,ce,pe,ge,ve,be;return this.projectionType==="central"?(se=[.5*(N[0]+G[0]),.5*(N[1]+G[1]),.5*(N[2]+G[2])],ae=this.project3DTo2D(se).slice(1,3),ce=[ae[0]-z[0],ae[1]-z[1]],pe=Mat.innerProduct(ce,Y)/W,ge=(1-pe)*ne/((1-2*pe)*ne+pe)):ge=ne,ve=Math.min(Math.max(ge,0),1),be=1-ve,[1,be*N[0]+ve*G[0],be*N[1]+ve*G[1],be*N[2]+ve*G[2]]},project2DTo3DVertical:function(v,N){var G=v.coords.usrCoords.slice(1,3),z=[N[1],N[2],this.bbox3D[2][0]],q=[N[1],N[2],this.bbox3D[2][1]];return this.projectScreenToSegment(G,z,q)},project3DToCube:function(v){var N=this.bbox3D,G=!1;return v[1]<N[0][0]&&(v[1]=N[0][0],G=!0),v[1]>N[0][1]&&(v[1]=N[0][1],G=!0),v[2]<N[1][0]&&(v[2]=N[1][0],G=!0),v[2]>N[1][1]&&(v[2]=N[1][1],G=!0),v[3]<=N[2][0]&&(v[3]=N[2][0],G=!0),v[3]>=N[2][1]&&(v[3]=N[2][1],G=!0),[v,G]},intersectionLineCube:function(v,N,G){var z,q,Y,W,ie;for(ie=N.length===3?N:N.slice(1),z=G,q=0;q<3;q++)ie[q]!==0&&(Y=(this.bbox3D[q][0]-v[q+1])/ie[q],W=(this.bbox3D[q][1]-v[q+1])/ie[q],G<0?z=Math.max(z,Math.min(Y,W)):z=Math.min(z,Math.max(Y,W)));return z},isInCube:function(v,N){var G;if(v.length===4){if(v[0]===0)return!1;G=v.slice(1)}return G[0]>this.bbox3D[0][0]-Mat.eps&&G[0]<this.bbox3D[0][1]+Mat.eps&&G[1]>this.bbox3D[1][0]-Mat.eps&&G[1]<this.bbox3D[1][1]+Mat.eps&&G[2]>this.bbox3D[2][0]-Mat.eps&&G[2]<this.bbox3D[2][1]+Mat.eps},intersectionPlanePlane:function(v,N,G){var z=[!1,!1],q,Y,W,ie,ne;return G=G||N.d,ie=Mat.crossProduct(v.normal.slice(1),N.normal.slice(1)),ie.unshift(0),q=Mat.Geometry.meet3Planes(v.normal,v.d,N.normal,G,ie,0),ne=Mat.Geometry.meetPlanePlane(v.vec1,v.vec2,N.vec1,N.vec2),W=this.intersectionLineCube(q,ne,1/0),Y=Mat.axpy(W,ne,q),this.isInCube
213(Y)&&(z[0]=Y),W=this.intersectionLineCube(q,ne,-1/0),Y=Mat.axpy(W,ne,q),this.isInCube(Y)&&(z[1]=Y),z},intersectionPlaneFace:function(v,N){var G=[],z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce=[],Ve=[],Re;for(Je=Mat.crossProduct(v.normal.slice(1),N.normal.slice(1)),Je.unshift(0),Y=Geometry.meet3Planes(v.normal,v.d,N.normal,N.d,Je,0),Ee=Geometry.meetPlanePlane(v.vec1,v.vec2,N.vec1,N.vec2),ae=N.polyhedron.faces[N.faceNumber],W=N.polyhedron.coords,ce=ae.length,z=1;z<=ce;z++)ie=W[ae[z-1]],ne=W[ae[z%ce]],Pe=[0,ne[1]-ie[1],ne[2]-ie[2],ne[3]-ie[3]],pe=Math.random(),ge=Math.random(),ve=Math.random(),be=Math.random(),Ce=[[pe*Ee[1]+ge*Ee[3],pe*-Pe[1]+ge*-Pe[3]],[ve*Ee[2]+be*Ee[3],ve*-Pe[2]+be*-Pe[3]]],Ve=[pe*(ie[1]-Y[1])+ge*(ie[3]-Y[3]),ve*(ie[2]-Y[2])+be*(ie[3]-Y[3])],Re=Numerics.Gauss(Ce,Ve),q=Re[1],q>-Mat.eps&&q<1+Mat.eps&&(se=[1,ie[1]+q*Pe[1],ie[2]+q*Pe[2],ie[3]+q*Pe[3]],G.push(se));return G},intersectionPlanePolyhedron:function(v,N){var G,z,q,Y,W,ie,ne,se=1e-12,ae=[],ce=[],pe=[],ge=[];for(G=0;G<N.numberFaces;G++)if(!(N.def.faces[G].length<3)&&(q=this.intersectionPlaneFace(v,N.faces[G]),!(q.length<2)&&q[0].length===4&&q[1].length===4)){for(z=0;z<ae.length&&!(Geometry.distance(q[0],ae[z][0],4)<se&&Geometry.distance(q[1],ae[z][1],4)<se||Geometry.distance(q[0],ae[z][1],4)<se&&Geometry.distance(q[1],ae[z][0],4)<se);z++);z===ae.length&&ae.push(q.slice())}if(ae.length===0)return{X:ce,Y:pe,Z:ge};W=0,ie=W,G=0;do{for(Y=ae[ie][G],Y.length===4&&(ce.push(Y[1]),pe.push(Y[2]),ge.push(Y[3])),G=(G+1)%2,Y=ae[ie][G],ne=ie,z=0;z<ae.length;z++){if(z!==ie&&Geometry.distance(Y,ae[z][0])<se){ie=z,G=0;break}if(z!==ie&&Geometry.distance(Y,ae[z][1])<se){ie=z,G=1;break}}if(ie===ne){console.log("Error face3d intersection update: did not find next",ie,G);break}}while(ie!==W);return ce.push(ce[0]),pe.push(pe[0]),ge.push(ge[0]),{X:ce,Y:pe,Z:ge}},getMesh:function(v,N,G){var z,q,Y,W,ie,ne,se,ae=[0,0,0],ce=JXG$1.evaluate(N[2]),pe=JXG$1.evaluate(G[2]),ge=[],ve=[];for(ne=(JXG$1.evaluate(N[1])-JXG$1.evaluate(N[0]))/ce,se=(JXG$1.evaluate(G[1])-JXG$1.evaluate(G[0]))/pe,z=0;z<=ce;z++){for(Y=N[0]+ne*z,q=0;q<=pe;q++)W=G[0]+se*q,JXG$1.isFunction(v)?ae=v(Y,W):ae=[v[0](Y,W),v[1](Y,W),v[2](Y,W)],ie=this.project3DTo2D(ae),ge.push(ie[1]),ve.push(ie[2]);ge.push(NaN),ve.push(NaN)}for(q=0;q<=pe;q++){for(W=G[0]+se*q,z=0;z<=ce;z++)Y=N[0]+ne*z,JXG$1.isFunction(v)?ae=v(Y,W):ae=[v[0](Y,W),v[1](Y,W),v[2](Y,W)],ie=this.project3DTo2D(ae),ge.push(ie[1]),ve.push(ie[2]);ge.push(NaN),ve.push(NaN)}return[ge,ve]},animateAzimuth:function(){var v=this.az_slide._smin,N=this.az_slide._smax,G=N-v,z=this.az_slide.Value()+.1;this.az_slide.position=(z-v)/G,this.az_slide.position>1&&(this.az_slide.position=0),this.board._change3DView=!0,this.board.update(),this.board._change3DView=!1,this.timeoutAzimuth=setTimeout((function(){this.animateAzimuth()}).bind(this),200)},stopAzimuth:function(){clearTimeout(this.timeoutAzimuth),this.timeoutAzimuth=null},isVerticalDrag:function(){var v=this.board,N;return this.evalVisProp("verticaldrag.enabled")?(N="_"+this.evalVisProp("verticaldrag.key")+"Key",v[N]):!1},setView:function(v,N,G){return G=G||this.r,this.az_slide.setValue(v),this.el_slide.setValue(N),this.r=G,this.board.update(),this},nextView:function(){var v=this.evalVisProp("values"),N=this.visProp._currentview;return N=(N+1)%v.length,this.setCurrentView(N),this},previousView:function(){var v=this.evalVisProp("values"),N=this.visProp._currentview;return N=(N+v.length-1)%v.length,this.setCurrentView(N),this},setCurrentView:function(v){var N=this.evalVisProp("values");return(v<0||v>=N.length)&&(v=(v%N.length+N.length)%N.length),this.setView(N[v][0],N[v][1],N[v][2]),this.visProp._currentview=v,this},_azEventHandler:function(v){var N=this.az_slide._smax,G=this.az_slide._smin,z=(N-G)/this.board.canvasWidth*this.evalVisProp("az.pointer.speed"),q=v.movementX,Y=this.az_slide.Value(),W=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG?this:(this.evalVisProp("az.keyboard.enabled")&&(v.key==="ArrowRight"?Y=Y+this.evalVisProp("az.keyboard.step")*Math.PI/180:v.key==="ArrowLeft"&&(Y=Y-this.evalVisProp("az.keyboard.step")*Math.PI/180)
213),this.evalVisProp("az.pointer.enabled")&&q!==0&&v.key==null&&(Y+=q*z),this.evalVisProp("az.continuous")?Y=Mat.wrap(Y,G,N):Y>0?Y=Math.min(N,Y):Y<0&&(Y=Math.max(G,Y)),this.setView(Y,W),this)},_elEventHandler:function(v){var N=this.el_slide._smax,G=this.el_slide._smin,z=(N-G)/this.board.canvasHeight*this.evalVisProp("el.pointer.speed"),q=v.movementY,Y=this.az_slide.Value(),W=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG?this:(this.evalVisProp("el.keyboard.enabled")&&(v.key==="ArrowUp"?W=W-this.evalVisProp("el.keyboard.step")*Math.PI/180:v.key==="ArrowDown"&&(W=W+this.evalVisProp("el.keyboard.step")*Math.PI/180)),this.evalVisProp("el.pointer.enabled")&&q!==0&&v.key==null&&(W+=q*z),this.evalVisProp("el.continuous")&&!this.trackballEnabled?W=Mat.wrap(W,G,N):W>0?W=Math.min(N,W):W<0&&(W=Math.max(G,W)),this.setView(Y,W),this)},_bankEventHandler:function(v){var N=this.bank_slide._smax,G=this.bank_slide._smin,z,q,Y=v.deltaY,W=this.bank_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG?this:(this.evalVisProp("bank.keyboard.enabled")&&(z=this.evalVisProp("bank.keyboard.step")*Math.PI/180,v.key==="."||v.key==="<"?W-=z:(v.key===","||v.key===">")&&(W+=z)),this.evalVisProp("bank.pointer.enabled")&&Y!==0&&v.key==null&&(q=(N-G)/this.board.canvasHeight*this.evalVisProp("bank.pointer.speed"),W+=Y*q,v.preventDefault()),this.evalVisProp("bank.continuous")?W=Mat.wrap(W,G,N):W=Mat.clamp(W,G,N),this.bank_slide.setValue(W),this.board.update(),this)},_trackballHandler:function(v){var N=this.board.getMousePosition(v),G,z,q;return q=new Coords(Const.COORDS_BY_USER,[this.llftCorner[0]+this.size[0]*.5,this.llftCorner[1]+this.size[1]*.5],this.board),G=N[0]-q.scrCoords[1],z=N[1]-q.scrCoords[2],this._trackball={dx:v.movementX,dy:-v.movementY,x:G,y:-z},this.board.update(),this},pointerDownHandler:function(v){var N,G,z;this._hasMoveAz=!1,this._hasMoveEl=!1,this._hasMoveBank=!1,this._hasMoveTrackball=!1,this.board.mode===this.board.BOARD_MODE_NONE&&(this.board._change3DView=!0,this.evalVisProp("trackball.enabled")?(N=this.evalVisProp("trackball.button"),G=this.evalVisProp("trackball.key"),(N===-1||N===v.button)&&(G==="none"||G.indexOf("shift")>-1&&v.shiftKey||G.indexOf("ctrl")>-1&&v.ctrlKey)&&(z=this.evalVisProp("trackball.outside")?document:this.board.containerObj,JXG$1.addEvent(z,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!0)):(this.evalVisProp("az.pointer.enabled")&&(N=this.evalVisProp("az.pointer.button"),G=this.evalVisProp("az.pointer.key"),(N===-1||N===v.button)&&(G==="none"||G.indexOf("shift")>-1&&v.shiftKey||G.indexOf("ctrl")>-1&&v.ctrlKey)&&(z=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,JXG$1.addEvent(z,"pointermove",this._azEventHandler,this),this._hasMoveAz=!0)),this.evalVisProp("el.pointer.enabled")&&(N=this.evalVisProp("el.pointer.button"),G=this.evalVisProp("el.pointer.key"),(N===-1||N===v.button)&&(G==="none"||G.indexOf("shift")>-1&&v.shiftKey||G.indexOf("ctrl")>-1&&v.ctrlKey)&&(z=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,JXG$1.addEvent(z,"pointermove",this._elEventHandler,this),this._hasMoveEl=!0)),this.evalVisProp("bank.pointer.enabled")&&(N=this.evalVisProp("bank.pointer.button"),G=this.evalVisProp("bank.pointer.key"),(N===-1||N===v.button)&&(G==="none"||G.indexOf("shift")>-1&&v.shiftKey||G.indexOf("ctrl")>-1&&v.ctrlKey)&&(z=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,JXG$1.addEvent(z,"wheel",this._bankEventHandler,this,{passive:!1}),this._hasMoveBank=!0))),JXG$1.addEvent(document,"pointerup",this.pointerUpHandler,this))},pointerUpHandler:function(v){var N;this._hasMoveAz&&(N=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,JXG$1.removeEvent(N,"pointermove",this._azEventHandler,this),this._hasMoveAz=!1),this._hasMoveEl&&(N=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,JXG$1.removeEvent(N,"pointermove",this._elEventHandler,this),this._hasMoveEl=!1),this._hasMoveBank&&(N=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,JXG$1.removeEvent(N,"wheel",this._bankEventHandler,this),this._hasMoveBank=!1),this._hasMoveTrackball&&(N=this.evalVisProp("trackball.outside")?document:this.board.containerObj,JXG$1.removeEvent(N,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!1),JXG$1.removeEvent(document,"pointerup",this.pointerUpHandler,this),this.board._change3DView=!1}});JXG$1.createView3D=function(v,N,G){var z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be=N[0],Ee=N[1];return q=JXG$1.copyAttributes(G,v.options,"view3d"),z=new JXG$1.View3D(v,N,q),z.defaultAxes=z.create("axes3d",[],q),ne=be[0],se=be[1],ae=Ee[0],ce=Ee[1],Y=JXG$1.copyAttributes(q,v.options,"view3d","az","slider"),Y.name="az",W=JXG$1.copyAttributes(q,v.options,"view3d","el","slider"),W.name="el",ie=JXG$1.copyAttributes(q,v.options,"view3d","bank","
213slider"),ie.name="bank",ve=JXG$1.evaluate(Y.point1.pos),JXG$1.isArray(ve)?pe=ve:pe=[ne-1,se-2],ve=JXG$1.evaluate(Y.point2.pos),JXG$1.isArray(ve)?ge=ve:ge=[ne+ae+1,se-2],z.az_slide=v.create("slider",[pe,ge,[JXG$1.evaluate(Y.min),JXG$1.evaluate(Y.start),JXG$1.evaluate(Y.max)]],Y),z.inherits.push(z.az_slide),z.az_slide.elType="view3d_slider",ve=JXG$1.evaluate(W.point1.pos),JXG$1.isArray(ve)?pe=ve:pe=[ne-1,se],ve=JXG$1.evaluate(W.point2.pos),JXG$1.isArray(ve)?ge=ve:ge=[ne-1,se+ce],z.el_slide=v.create("slider",[pe,ge,[JXG$1.evaluate(W.min),JXG$1.evaluate(W.start),JXG$1.evaluate(W.max)]],W),z.inherits.push(z.el_slide),z.el_slide.elType="view3d_slider",ve=JXG$1.evaluate(ie.point1.pos),JXG$1.isArray(ve)?pe=ve:pe=[ne-1,se+ce+2],ve=JXG$1.evaluate(ie.point2.pos),JXG$1.isArray(ve)?ge=ve:ge=[ne+ae+1,se+ce+2],z.bank_slide=v.create("slider",[pe,ge,[JXG$1.evaluate(ie.min),JXG$1.evaluate(ie.start),JXG$1.evaluate(ie.max)]],ie),z.inherits.push(z.bank_slide),z.bank_slide.elType="view3d_slider",z.board.infobox.visProp=JXG$1.merge(z.board.infobox.visProp,q.infobox),z.board.highlightInfobox=function(Pe,Je,Ce){var Ve,Re,qe,et,Ze="",tt=Ce.board,Ke,rt,it=null;for(this.mode===this.BOARD_MODE_DRAG&&(z.isVerticalDrag()?Ze='<span style="color:black; font-size:200%">⇅ &nbsp;</span>':Ze='<span style="color:black; font-size:200%">⇄ &nbsp;</span>'),Re=0;Re<Ce.parents.length&&(it=tt.objects[Ce.parents[Re]],!it.is3D);Re++);if(it&&JXG$1.exists(it.element2D)){if(et=[1,0,0,it.coords[3]],z._w0=Mat.innerProduct(z.matrix3D[0],et,4),qe=z.project2DTo3DPlane(it.element2D,[1,0,0,1],et),!z.isInCube(qe)){z.board.highlightCustomInfobox("",it);return}Ve=it.evalVisProp("infoboxdigits"),rt=z.board.infobox,Ve==="auto"?rt.useLocale()?Ke=[Ze,"(",rt.formatNumberLocale(it.X())," | ",rt.formatNumberLocale(it.Y())," | ",rt.formatNumberLocale(it.Z()),")"]:Ke=[Ze,"(",JXG$1.autoDigits(it.X())," | ",JXG$1.autoDigits(it.Y())," | ",JXG$1.autoDigits(it.Z()),")"]:rt.useLocale()?Ke=[Ze,"(",rt.formatNumberLocale(it.X(),Ve)," | ",rt.formatNumberLocale(it.Y(),Ve)," | ",rt.formatNumberLocale(it.Z(),Ve),")"]:Ke=[Ze,"(",JXG$1.toFixed(it.X(),Ve)," | ",JXG$1.toFixed(it.Y(),Ve)," | ",JXG$1.toFixed(it.Z(),Ve),")"],z.board.highlightCustomInfobox(Ke.join(""),it)}else z.board.highlightCustomInfobox("("+Pe+", "+Je+")",Ce)},z.BOARD_MODE_NONE=0,JXG$1.addEvent(v.containerObj,"keydown",function(Pe){var Je,Ce=!1;z.evalVisProp("el.keyboard.enabled")&&(Pe.key==="ArrowUp"||Pe.key==="ArrowDown")&&(Je=z.evalVisProp("el.keyboard.key"),(Je==="none"||Je.indexOf("shift")>-1&&Pe.shiftKey||Je.indexOf("ctrl")>-1&&Pe.ctrlKey)&&(z._elEventHandler(Pe),Ce=!0)),z.evalVisProp("az.keyboard.enabled")&&(Pe.key==="ArrowLeft"||Pe.key==="ArrowRight")&&(Je=z.evalVisProp("az.keyboard.key"),(Je==="none"||Je.indexOf("shift")>-1&&Pe.shiftKey||Je.indexOf("ctrl")>-1&&Pe.ctrlKey)&&(z._azEventHandler(Pe),Ce=!0)),z.evalVisProp("bank.keyboard.enabled")&&(Pe.key===","||Pe.key==="<"||Pe.key==="."||Pe.key===">")&&(Je=z.evalVisProp("bank.keyboard.key"),(Je==="none"||Je.indexOf("shift")>-1&&Pe.shiftKey||Je.indexOf("ctrl")>-1&&Pe.ctrlKey)&&(z._bankEventHandler(Pe),Ce=!0)),Pe.key==="PageUp"?(z.nextView(),Ce=!0):Pe.key==="PageDown"&&(z.previousView(),Ce=!0),Ce&&Pe.preventDefault(),this.board._change3DView=!1},z),JXG$1.addEvent(v.containerObj,"pointerdown",z.pointerDownHandler,z),z.getAnglesFromSliders(),z.matrix3DRot=z.getRotationFromAngles(),z.updateAngleSliderBounds(),z.board.update(),z};JXG$1.registerElement("view3d",JXG$1.createView3D);JXG$1.View3D;JXG$1.GeometryElement3D=function(v,N){this.elType=N,this.view=v,this.id=this.view.board.setId(this,N),this.element2D=null,this.is3D=!0,this.zIndex=0,this.view.objects[this.id]=this,this.name!==""&&(this.view.elementsByName[this.name]=this)};JXG$1.extend(JXG$1.GeometryElement3D.prototype,{setAttr2D:function(v){var N=v;return N.name=this.name,N.element3d=this,N.id=null,N},setAttribute:function(v){var N,G,z,q,Y,W={};for(N=0;N<arguments.length;N++)q=arguments[N],JXG$1.isString(q)?(Y=q.split(":"),W[JXG$1.trim(Y[0])]=JXG$1.trim(Y[1])):JXG$1.isArray(q)?W[q[0]]=q[1]:JXG$1.extend(W,q);for(N in W)if(W.hasOwnProperty(N))switch(G=N.replace(/\s+/g,"").toLowerCase(),z=W[N],G){case"numberpointshigh":case"stepsu":case"stepsv":JXG$1.exists(this.visProp[G])&&(!JXG$1.Validator[G]||JXG$1.Validator[G]&&JXG$1.Validator[G](z)||JXG$1.Validator[G]&&JXG$1.isFunction(z)&&JXG$1.Validator[G](z()))&&(z=z.toLowerCase&&z.toLowerCase()==="false"?!1:z,this._set(G,z));break;default:JXG$1.exists(this.element2D)&&this.element2D.setAttribute(W)}},getAttribute:function(v){var N;switch(v=v.toLowerCase(),v){case"numberpointshigh":case"stepsu":case"stepsv":N=this.visProp[v];break;default:JXG$1.exists(this.element2D)&&(N=this.element2D.getAttribute(v));break}return N},getAttributes:function(){var v={},N,G,z=["numberpointshigh","stepsu","stepsv"],q=z.length;for(JXG$1.exists(this.element2D)&&(v=JXG$1.merge(this.element2D.getAttributes())),N=0;N<q;N++)G=z[N],JXG$1.exists(this.visProp[G])&&(v[G]=this.visProp[G]);return v},addTransformGeneric:function(v,N){var G,z=JXG$1.isArray(N)?N:[N],q=z.length;for(this.transformations.length===0&&(this.baseElement=v),G=0;G<q;G++)this.transformations.push(z[G]);return this},setPosition2D:function(v){},projectCoords:function(v,N){},remove:function(){}});JXG$1.GeometryElement3D;JXG$1.createAxes3D=function(v,N,G){var z=N[0],q=["x","y","z"],Y="Axis",W
213=["Rear","Front"],ie=[0,0,0],ne=[0,0,0],se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it={};if(JXG$1.exists(z.bbox3D))for(se=0;se<q.length;se++)ie[se]=z.bbox3D[se][0],ne[se]=z.bbox3D[se][1];else for(se=0;se<q.length;se++)ie[se]=N[1][se],ne[se]=N[2][1];for(ve=JXG$1.copyAttributes(G,v.options,"axes3d"),be=ve.axesposition,se=0;se<q.length;se++)Ee=q[se],tt=Ee+Y,be==="center"?(Ce=[0,0,0],Ve=[0,0,0],Ve[se]=ne[se],it[tt]=z.create("axis3d",[Ce,Ve],ve[tt.toLowerCase()]),it[tt].view=z):be==="border"&&(tt+="Border",Ce=ie.slice(),Ve=ne.slice(),Ee==="z"?(Ce[1]=ne[1],Ve[0]=ie[0]):Ee==="x"?(Ce=[ie[0],ne[1],ie[2]],Ve=[ne[0],ne[1],ie[2]]):(Ce=[ne[0],ie[1],ie[2]],Ve=[ne[0],ne[1],ie[2]]),Ve[se]=ne[se],it[tt]=z.create("axis3d",[Ce,Ve],ve[tt.toLowerCase()]),it[tt].view=z,rt=ve[tt.toLowerCase()].ticks3d,rt.element3d=!0,Je=ne[se]-ie[se],Ee==="x"?it[tt+"Ticks"]=z.create("ticks3d",[Ce,[1,0,0],Je,[0,1,0]],rt):Ee==="y"?it[tt+"Ticks"]=z.create("ticks3d",[Ce,[0,1,0],Je,[1,0,0]],rt):it[tt+"Ticks"]=z.create("ticks3d",[Ce,[0,0,1],Je,[0,1,0]],rt),it[tt+"Ticks"].view=z);for(be==="center"?(it.O=z.create("intersection",[it[q[0]+Y],it[q[1]+Y]],{name:"",visible:!1,withLabel:!1}),it.O.view=z):it.O=null,se=0;se<q.length;se++)for(pe=(se+1)%3,ge=(se+2)%3,Ee=q[se],ae=0;ae<W.length;ae++)tt=Ee+"Plane"+W[ae],Ce=[0,0,0],Ce[se]=ae===0?ie[se]:ne[se],Re=[0,0,0],qe=[0,0,0],Re[pe]=1,qe[ge]=1,et=[ie[pe],ne[pe]],Ze=[ie[ge],ne[ge]],ve=JXG$1.copyAttributes(G,v.options,"axes3d",tt),it[tt]=z.create("plane3d",[Ce,Re,qe,et,Ze],ve),it[tt].elType="axisplane3d";for(se=0;se<q.length;se++)for(Ee=q[se],ae=0;ae<W.length;ae++)for(ce=1;ce<=2;
213ce++)pe=(se+ce)%3,Pe=q[pe],tt=Ee+"Plane"+W[ae]+Pe.toUpperCase()+"Axis",Ke=Ee+"Plane"+W[ae],Ce=[0,0,0],Ve=[0,0,0],Ce[se]=Ve[se]=ae===0?ie[se]:ne[se],Ce[pe]=ie[pe],Ve[pe]=ne[pe],ve=JXG$1.copyAttributes(G,v.options,"axes3d",tt),it[tt]=z.create("axis3d",[Ce,Ve],ve),it[tt].view=z,it[Ke].addChild(it[tt]),it[Ke].element2D.inherits.push(it[tt]);return it};JXG$1.registerElement("axes3d",JXG$1.createAxes3D);JXG$1.createAxis3D=function(v,N,G){var z=N[0],q,Y=N[1],W=N[2],ie,ne,se;return q=JXG$1.copyAttributes(G.point1,v.options,"axis3d","point1"),q.element3d=!0,ie=z.create("point",[function(ae,ce,pe){return function(){return z.project3DTo2D(ae,ce,pe)[1]}}(Y[0],Y[1],Y[2]),function(ae,ce,pe){return function(){return z.project3DTo2D(ae,ce,pe)[2]}}(Y[0],Y[1],Y[2])],q),q=JXG$1.copyAttributes(G.point2,v.options,"axis3d","point2"),q.element3d=!0,ne=z.create("point",[function(ae,ce,pe){return function(){return z.project3DTo2D(ae,ce,pe)[1]}}(W[0],W[1],W[2]),function(ae,ce,pe){return function(){return z.project3DTo2D(ae,ce,pe)[2]}}(W[0],W[1],W[2])],q),q=JXG$1.copyAttributes(G,v.options,"axis3d"),q.element3d=!0,se=z.create("arrow",[ie,ne],q),se};JXG$1.registerElement("axis3d",JXG$1.createAxis3D);JXG$1.createMesh3D=function(v,N,G){var z=N[0],q,Y;return q=JXG$1.copyAttributes(G,v.options,"mesh3d"),q.element3d=!0,Y=z.create("curve",[[],[]],q),Y.point=N[1],Y.direction1=N[2],Y.direction2=N[3],Y.range1=N[4],Y.range2=N[5],Y.updateDataArray=function(){var W=JXG$1.evaluate(this.range1),ie=JXG$1.evaluate(this.range2),ne=W[0],se=W[1],ae=ie[0],ce=ie[1],pe,ge,ve,be,Ee=[0,0,0],Pe=[0,0,0],Je=this.evalVisProp("stepwidthu"),Ce=this.evalVisProp("stepwidthv"),Ve=[0,0,0];if(this.dataX=[],this.dataY=[],JXG$1.isFunction(this.point))Ve=this.point();else if(JXG$1.isPoint3D(this.point))Ve=this.point.coords;else for(be=0;be<this.point.length;be++)Ve[be]=JXG$1.evaluate(this.point[be]);if(JXG$1.isFunction(this.direction1))Ee=JXG$1.evaluate(this.direction1);else for(be=0;be<this.direction1.length;be++)Ee[be]=JXG$1.evaluate(this.direction1[be]);if(JXG$1.isFunction(this.direction2))Pe=JXG$1.evaluate(this.direction2);else for(be=0;be<this.direction2.length;be++)Pe[be]=JXG$1.evaluate(this.direction2[be]);for(Ve.length===4&&(Ve=Ve.slice(1)),Ee.length===4&&(Ee=Ee.slice(1)),Pe.length===4&&(Pe=Pe.slice(1)),pe=JXG$1.Math.norm(Ee,3),ge=JXG$1.Math.norm(Pe,3),be=0;be<3;be++)Ee[be]/=pe,Pe[be]/=ge;ve=z.getMesh([function(Re,qe){return Ve[0]+Re*Ee[0]+qe*Pe[0]},function(Re,qe){return Ve[1]+Re*Ee[1]+qe*Pe[1]},function(Re,qe){return Ve[2]+Re*Ee[2]+qe*Pe[2]}],[Math.ceil(ne),Math.floor(se),(Math.ceil(se)-Math.floor(ne))/Je],[Math.ceil(ae),Math.floor(ce),(Math.ceil(ce)-Math.floor(ae))/Ce]),this.dataX=ve[0],this.dataY=ve[1]},Y};JXG$1.registerElement("mesh3d",JXG$1.createMesh3D);JXG$1.Circle3D=function(v,N,G,z,q){var Y,W;this.constructor(v.board,q,Const.OBJECT_TYPE_CIRCLE3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"circle3d"),this.center=this.board.select(N),this.normalFunc=G,this.normal=[0,0,0,0],this.curve,this.frame1,this.frame2,JXG$1.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),this.updateRadius=JXG$1.createFunction(z,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.updateNormal(),this.frame1=Mat.crossProduct(this.normal.slice(1),[1,0,0]),this.frame1.unshift(0),Y=Mat.crossProduct(this.normal.slice(1),[-.5,.8660254037844386,0]),Y.unshift(0),Mat.norm(Y)>Mat.norm(this.frame1)&&(this.frame1=Y),this.frame2=Mat.crossProduct(this.normal.slice(1),this.frame1.slice(1)),this.frame2.unshift(0),this.normalizeFrame(),W=this,this.curve=v.create("curve3d",[function(ie){var ne=W.Radius(),se=Math.sin(ie),ae=Math.cos(ie);return[W.center.coords[1]+ne*(ae*W.frame1[1]+se*W.frame2[1]),W.center.coords[2]+ne*(ae*W.frame1[2]+se*W.frame2[2]),W.center.coords[3]+ne*(ae*W.frame1[3]+se*W.frame2[3])]},[0,2*Math.PI]],q)};JXG$1.Circle3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Circle3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Circle3D.prototype,{update:function(){return this.needsUpdate&&(this.updateNormal().updateFrame(),this.curve.visProp.visible=!isNaN(this.Radius())),this},updateRenderer:function(){return this.needsUpdate=!1,this},setRadius:function(v){return this.updateRadius=JXG$1.createFunction(v,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(v){return JXG$1.exists(v)?(this.setRadius(v),this.Radius()):Math.abs(this.updateRadius())},normalizeFrame:function(){var v=Mat.norm(this.frame1),N=Mat.norm(this.frame2),G;for(G=0;G<4;G++)this.frame1[G]/=v,this.frame2[G]/=N;return this},updateNormal:function(){var v,N,G=1e-12;if(this.normal=JXG$1.evaluate(this.normalFunc),N=Mat.norm(this.normal),Math.abs(N)>G)for(v=0;v<4;v++)this.normal[v]/=N;return this},updateFrame:function(){return this.frame1=Mat.crossProduct(this.frame2.slice(1),this.normal.slice(1)),this.frame1.unshift(0),this.frame2=Mat.crossProduct(this.normal.slice(1),this.frame1.slice(1)),this.frame2.unshift(0),this.normalizeFrame(),this},projectCoords:function(v,N){return this.curve.projectCoords(v,N)}});JXG$1.createCircle3D=function(v,N,G){var z=N[0],q=JXG$1.copyAttributes(G,v.options,"cir
213cle3d"),Y=JXG$1.providePoints3D(z,[N[1]],G,"circle3d",["point"])[0],W=N[2],ie=N[3],ne;return ne=new JXG$1.Circle3D(z,Y,W,ie,q),ne.curve.addParents([ne]),ne.addChild(ne.curve),ne.update(),ne};JXG$1.registerElement("circle3d",JXG$1.createCircle3D);JXG$1.createIntersectionCircle3D=function(v,N,G){var z=N[0],q=N[1],Y=N[2],W,ie,ne,se=JXG$1.copyAttributes(G,v.options,"intersectioncircle3d");ne=Geometry.intersectionFunction3D(z,q,Y),ie=z.create("point3d",ne[0],{visible:!1}),W=z.create("circle3d",[ie,ne[1],ne[2]],se);try{q.addChild(W),Y.addChild(W)}catch{throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof N[1]+"' and '"+typeof N[2]+"'.")}return W.type=Const.OBJECT_TYPE_INTERSECTION_CIRCLE3D,W.elType="intersectioncircle3d",W.setParents([q.id,Y.id]),W};JXG$1.registerElement("intersectioncircle3d",JXG$1.createIntersectionCircle3D);JXG$1.Point3D=function(v,N,G,z){this.constructor(v.board,z,Const.OBJECT_TYPE_POINT3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"point3d"),this.board.finalizeAdding(this),this.coords=[0,0,0,0],this.initialCoords=[0,0,0,0],this.F=N,this.slide=G,this.position=[],this._c2d=null,this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.Point3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Point3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Point3D.prototype,{X:function(){return this.coords[1]},Y:function(){return this.coords[2]},Z:function(){return this.coords[3]},W:function(){return this.coords[0]},updateCoords:function(){var v,N=0;if(JXG$1.isFunction(this.F))this.coords=JXG$1.evaluate(this.F),this.coords.length===3&&this.coords.unshift(1);else for(this.F.length===3&&(this.coords[0]=1,N=1),v=0;v<this.F.length;v++)JXG$1.isFunction(this.F[v])&&(this.coords[N+v]=JXG$1.evaluate(this.F[v]));return this},initCoords:function(){var v,N=0;if(JXG$1.isFunction(this.F))this.coords=JXG$1.evaluate(this.F),this.coords.length===3&&this.coords.unshift(1);else for(this.F.length===3&&(this.coords[0]=1,N=1),v=0;v<this.F.length;v++)this.coords[N+v]=JXG$1.evaluate(this.F[v]);return this.initialCoords=this.coords.slice(),this},normalizeCoords:function(){return Math.abs(this.coords[0])>1e-14&&(this.coords[1]/=this.coords[0],this.coords[2]/=this.coords[0],this.coords[3]/=this.coords[0],this.coords[0]=1),this},setPosition:function(v,N){var G=this.coords;return v.length===3?(G[0]=1,G[1]=v[0],G[2]=v[1],G[3]=v[2]):(G[0]=v[0],G[1]=v[1],G[2]=v[2],G[3]=v[2],this.normalizeCoords()),this},addTransform:function(v,N){return this.addTransformGeneric(v,N),this},updateTransform:function(){var v,N;if(this.transformations.length===0||this.baseElement===null)return this;for(this===this.baseElement?v=this.initialCoords:v=this.baseElement.coords,N=0;N<this.transformations.length;N++)this.transformations[N].update(),v=Mat.matVecMult(this.transformations[N].matrix,v);return this.coords=v,this},update:function(v){var N,G,z;return this.element2D.draggable()&&Geometry.distance(this._c2d,this.element2D.coords.usrCoords)!==0?(this.view.isVerticalDrag()?N=this.view.project2DTo3DVertical(this.element2D,this.coords):(G=[1,0,0,this.coords[3]],N=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],G)),N[0]!==0&&(z=this.view.project3DToCube(N),this.coords=z[0],z[1]&&this.element2D.coords.setCoordinates(Const.COORDS_BY_USER,this.view.project3DTo2D(this.coords)),this.slide&&(this.coords=this.slide.projectCoords([1,this.X(),this.Y(),this.Z()],this.position),this.element2D.coords.setCoordinates(Const.COORDS_BY_USER,this.view.project3DTo2D(this.coords))))):(this.updateCoords().updateTransform(),this.slide&&(this.coords=this.slide.projectCoords([1,this.X(),this.Y(),this.Z()],this.position)),N=this.coords,this.element2D.coords.setCoordinates(Const.COORDS_BY_USER,this.view.project3DTo2D(N)),this.zIndex=Mat.matVecMult(this.view.matrix3DRotShift,N)[3]),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},testIfFinite:function(){return Math.abs(this.coords[0])>1e-12},distance:function(v){var N=1e-12,G=this.coords,z=v.coords;return G[0]*G[0]>N&&z[0]*z[0]>N?Mat.hypot(z[1]-G[1],z[2]-G[2],z[3]-G[3]):Number.POSITIVE_INFINITY},__evt__update3D:function(v){}});JXG$1.createPoint3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se=null,ae=null;if(N.length>2&&JXG$1.exists(N[N.length-1].is3D)&&!JXG$1.isTransformationOrArray(N[N.length-1])?W=N.pop():W=null,N.length===2)Y=N[1];else if(N.length===3&&JXG$1.isPoint3D(N[1])&&JXG$1.isTransformationOrArray(N[2]))Y=[0,0,0],se=N[1],ae=N[2];else if(N.length===4)Y=N.slice(1);else if(N.length===5)Y=N.slice(1);else throw new Error("JSXGraph: Can't create point3d with parent types '"+typeof N[1]+"' and '"+typeof N[2]+`'.
214Possible parent types: [[x,y,z]], [x,y,z], or [[x,y,z], slide], () => [x, y, z], or [point, transformation(s)]`);return q=JXG$1.copyAttributes(G,v.options,"point3d"),ne=new JXG$1.Point3D(z,Y,W,q),ne.initCoords(),se!==null&&ae!==null&&ne.addTransform(se,ae),ie=z.project3DTo2D(ne.coords),q=ne.setAttr2D(q),ne.element2D=z.create("point",ie,q),ne.element2D.view=z,ne.addChild(ne.element2D),ne.inherits.push(ne.element2D),ne.element2D.setParents(ne),ne.slide&&(ne.slide.addChild(ne),ne.setParents(ne.slide)),se&&ne.setParents(se),ne._c2d=ne.element2D.coords.usrCoords.slice(),ne};JXG$1.registerElement("point3d",JXG$1.createPoint3D);JXG$1.Curve3D=function(v,N,G,z,q,Y,W){this.constructor(v.board,W,Const.OBJECT_TYPE_CURVE3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"curve3d"),this.board.finalizeAdding(this),this._F=N,this._X=G,this._Y=z,this._Z=q,this.points=[],this.numberPoints=0,this.dataX=null,this.dataY=null,this.dataZ=null,this._F!==null?(this._X=function(ie){return this._F(ie)[0]},this._Y=function(ie){return this._F(ie)[1]},this._Z=function(ie){return this._F(ie)[2]}):JXG$1.isFunction(this._X)?this._F=function(ie){return[this._X(ie),this._Y(ie),this._Z(ie)]}:this._F=null,this.range=Y,this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.Curve3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Curve3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Curve3D.prototype,{updateCoords:function(){var v=this.evalVisProp("numberpointshigh"),N,G,z,q,Y,W,ie=[
2141,0,0,0];if(this.points=[],JXG$1.exists(this.dataX))for(v=this.dataX.length,Y=0;Y<v;Y++)this.points.push([1,this.dataX[Y],this.dataY[Y],this.dataZ[Y]]);else if(JXG$1.isArray(this._X))for(v=this._X.length,Y=0;Y<v;Y++)this.points.push([1,this._X[Y],this._Y[Y],this._Z[Y]]);else for(N=JXG$1.evaluate(this.range),G=JXG$1.evaluate(N[0]),z=JXG$1.evaluate(N[1]),q=(z-G)/(v-1),W=0,Y=G;W<v&&Y<=z;W++,Y+=q)ie=this.F(Y),ie.unshift(1),this.points.push(ie);return this.numberPoints=this.points.length,this},evalF:function(v){var N,G,z=[0,0,0,0];if(this.transformations.length===0||!JXG$1.exists(this.baseElement))return JXG$1.exists(this._F)?z=this._F(v):z=[this._X[v],this._Y[v],this._Z[v]],z;for(N=this.transformations,G=0;G<N.length;G++)N[G].update();for(z.length===3&&z.unshift(1),this===this.baseElement?JXG$1.exists(this._F)?z=this._F(v):z=[this._X[v],this._Y[v],this._Z[v]]:z=this.baseElement.evalF(v),z.unshift(1),z=Mat.matVecMult(N[0].matrix,z),G=1;G<N.length;G++)z=Mat.matVecMult(N[G].matrix,z);return z.slice(1)},F:function(v){return this.evalF(v)},X:function(v){return this.evalF(v)[0]},Y:function(v){return this.evalF(v)[1]},Z:function(v){return this.evalF(v)[2]},updateDataArray2D:function(){var v,N,G=[],z=[],q=this.points.length;for(v=0;v<q;v++)N=this.view.project3DTo2D(this.points[v]),G.push(N[1]),z.push(N[2]);return{X:G,Y:z}},addTransform:function(v,N){return this.addTransformGeneric(v,N),this},updateTransform:function(){var v,N,G,z,q;if(this.transformations.length===0||this.baseElement===null||JXG$1.exists(this._F))return this;for(v=this.transformations,G=0;G<v.length;G++)v[G].update();for(q=this.baseElement.numberPoints,G=0;G<q;G++){for(this===this.baseElement?N=this.points[G]:N=this.baseElement.points[G],z=0;z<v.length;z++)N=Mat.matVecMult(v[z].matrix,N);this.points[G]=N}return this.numberPoints=q,this},updateDataArray:function(){},update:function(){return this.needsUpdate&&(this.updateDataArray(),this.updateCoords().updateTransform()),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(v,N){return Geometry.projectCoordsToParametric(v,this,1,N)}});JXG$1.createCurve3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se,ae,ce,pe=null,ge=null;return N.length===3?JXG$1.isTransformationOrArray(N[2])&&N[1].type===Const.OBJECT_TYPE_CURVE3D?(pe=N[1],ge=N[2],q=null,Y=[],W=[],ie=[]):(q=N[1],ne=N[2],Y=null,W=null,ie=null):N.length===2&&JXG$1.isArray(N[1])?(ce=Mat.transpose(N[1]),Y=ce[0],W=ce[1],ie=ce[2],q=null):(Y=N[1],W=N[2],ie=N[3],ne=N[4],q=null),se=JXG$1.copyAttributes(G,v.options,"curve3d"),ae=new JXG$1.Curve3D(z,q,Y,W,ie,ne,se),se=ae.setAttr2D(se),ae.element2D=z.create("curve",[[],[]],se),ae.element2D.view=z,pe!==null&&(ae.addTransform(pe,ge),ae.addParents(pe)),ae.element2D.updateDataArray=function(){var ve=ae.updateDataArray2D();this.dataX=ve.X,this.dataY=ve.Y},ae.addChild(ae.element2D),ae.inherits.push(ae.element2D),ae.element2D.setParents(ae),ae.element2D.prepareUpdate().update(),v.isSuspendedUpdate||ae.element2D.updateVisibility().updateRenderer(),ae};JXG$1.registerElement("curve3d",JXG$1.createCurve3D);JXG$1.createVectorfield3D=function(v,N,G){var z=N[0],q,Y;if(!(N.length>=5&&(JXG$1.isArray(N[1])||JXG$1.isFunction(N[1])||JXG$1.isString(N[1]))&&JXG$1.isArray(N[2])&&N[1].length===3&&JXG$1.isArray(N[3])&&N[2].length===3&&JXG$1.isArray(N[4])&&N[3].length===3))throw new Error("JSXGraph: Can't create vector field 3D with parent types '"+typeof N[1]+"', '"+typeof N[2]+"', '"+typeof N[3]+"'.'"+typeof N[4]+"', ");return Y=JXG$1.copyAttributes(G,v.options,"vectorfield3d"),q=z.create("curve3d",[[],[],[]],Y),q.setF=function(W,ie){var ne,se,ae;return JXG$1.isArray(W)?(ne=JXG$1.createFunction(W[0],this.board,ie),se=JXG$1.createFunction(W[1],this.board,ie),ae=JXG$1.createFunction(W[2],this.board,ie),this.F=function(ce,pe,ge){return[ne(ce,pe,ge),se(ce,pe,ge),ae(ce,pe,ge)]}):this.F=JXG$1.createFunction(W,q.board,ie),this},q.setF(N[1],"x, y, z"),q.xData=N[2],q.yData=N[3],q.zData=N[4],q.updateDataArray=function(){var W,ie,ne,se,ae,ce,pe,ge,ve=this.evalVisProp("scale"),be=[JXG$1.evaluate(this.xData[0]),JXG$1.evaluate(this.yData[0]),JXG$1.evaluate(this.zData[0])],Ee=[JXG$1.evaluate(this.xData[1]),JXG$1.evaluate(this.yData[1]),JXG$1.evaluate(this.zData[1])],Pe=[JXG$1.evaluate(this.xData[2]),JXG$1.evaluate(this.yData[2]),JXG$1.evaluate(this.zData[2])],Je=[(Pe[0]-be[0])/Ee[0],(Pe[1]-be[1])/Ee[1],(Pe[2]-be[2])/Ee[2]],Ce,Ve,Re,qe,et=this.evalVisProp("arrowhead.enabled"),Ze,tt,Ke,rt,it;for(et&&(Ze=this.evalVisProp("arrowhead.size"),it=this.evalVisProp("arrowhead.angle"),tt=Ze/v.unitX,Ke=Ze/v.unitY,rt=Ze/Math.sqrt(v.unitX*v.unitY)),this.dataX=[],this.dataY=[],this.dataZ=[],ie=0,ce=be[0];ie<=Ee[0];ce+=Je[0],ie++)for(ne=0,pe=be[1];ne<=Ee[1];pe+=Je[1],ne++)for(W=0,ge=be[2];W<=Ee[2];ge+=Je[2],W++)se=this.F(ce,pe,ge),ae=Mat.norm(se),!(ae<Number.EPSILON)&&(se[0]*=ve,se[1]*=ve,se[2]*=ve,JXG$1.concat(this.dataX,[ce,ce+se[0],NaN]),JXG$1.concat(this.dataY,[pe,pe+se[1],NaN]),JXG$1.concat(this.dataZ,[ge,ge+se[2],NaN]),et&&(ae*=ve,Ce=Math.atan2(se[1],se[0]),qe=Math.asin(se[2]/ae),Ve=qe-it,Re=qe+it,JXG$1.concat(this.dataX,[ce+se[0]-tt*Math.cos(Ce)*Math.cos(Ve),ce+se[0],ce+se[0]-tt*Math.cos(Ce)*Math.cos(Re),NaN]
214),JXG$1.concat(this.dataY,[pe+se[1]-Ke*Math.sin(Ce)*Math.cos(Ve),pe+se[1],pe+se[1]-Ke*Math.sin(Ce)*Math.cos(Re),NaN]),JXG$1.concat(this.dataZ,[ge+se[2]-rt*Math.sin(Re),ge+se[2],ge+se[2]-rt*Math.sin(Ve),NaN])))},q.methodMap=JXG$1.deepCopy(q.methodMap,{setF:"setF"}),q};JXG$1.registerElement("vectorfield3D",JXG$1.createVectorfield3D);JXG$1.Line3D=function(v,N,G,z,q){this.constructor(v.board,q,Const.OBJECT_TYPE_LINE3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"line3d"),this.point=N,this.direction=G,this.vec=[0,0,0,0],this.range=z||[-1/0,1/0],this.point1=null,this.point2=null,this.board.finalizeAdding(this),this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.Line3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Line3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Line3D.prototype,{updateCoords:function(){var v,N=0;if(JXG$1.exists(this.direction.view)&&this.direction.type===Const.OBJECT_TYPE_LINE3D)this.vec=this.direction.vec.slice();else if(JXG$1.isFunction(this.direction))this.vec=JXG$1.evaluate(this.direction),this.vec.length===3&&this.vec.unshift(0);else for(this.direction.length===3&&(this.vec[0]=0,N=1),v=0;v<this.direction.length;v++)this.vec[N+v]=JXG$1.evaluate(this.direction[v]);return this},getPointCoords:function(v){var N=[],G=[],z;return N=this.point.coords,G=this.vec,z=JXG$1.evaluate(v),v=this.view.intersectionLineCube(N,G,z),[N[0]+G[0]*v,N[1]+G[1]*v,N[2]+G[2]*v,N[3]+G[3]*v]},addTransform:function(v,N){return this.point.addTransform(v.point,N),this.addTransformGeneric(v,N),this},updateTransform:function(){var v,N;if(this.transformations.length===0||this.baseElement===null)return this;for(this===this.baseElement?v=this.vec:v=this.baseElement.vec,N=0;N<this.transformations.length;N++)this.transformations[N].update(),v=Mat.matVecMult(this.transformations[N].matrix,v);return this.vec=v,this},update:function(){return this.needsUpdate&&this.updateCoords().updateTransform(),this},setPosition2D:function(v){var N,G;for(N=0;N<this.parents.length;N++)G=this.view.select(this.parents[N]),G.elType==="point3d"&&G.element2D.draggable()&&v.applyOnce(G.element2D);this.endpoints[0].update(),this.endpoints[1].update()},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(v,N){var G=this.getPointCoords(0),z=this.getPointCoords(1),q=[z[0]-G[0],z[1]-G[1],z[2]-G[2]],Y=[v[0]-G[0],v[1]-G[1],v[2]-G[2]],W=Mat.innerProduct(Y,q)/Mat.innerProduct(q,q),ie=Math.min(Math.max(W,JXG$1.evaluate(this.range[0])),JXG$1.evaluate(this.range[1])),ne;return ne=this.getPointCoords(ie).slice(),N[0]=ie,ne},updateZIndex:function(){var v=this.endpoints[0],N=this.endpoints[1],G=[1,v.X()+N.X(),v.Y()+N.Y(),v.Z()+N.Z()];return G[1]*=.5,G[2]*=.5,G[3]*=.5,this.zIndex=Mat.matVecMult(this.view.matrix3DRotShift,G)[3],this}});JXG$1.createLine3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se,ae,ce,pe,ge=null,ve=null;if(q=JXG$1.copyAttributes(G,v.options,"line3d"),N[1].type===Const.OBJECT_TYPE_LINE3D&&JXG$1.isTransformationOrArray(N[2])&&(ge=N[1],ve=N[2],Y=JXG$1.providePoints3D(z,[[0,0,0,0],[0,0,0,0]],G,"line3d",["point1","point2"])),ge===null&&(JXG$1.isPoint3D(N[2])||N.length===3&&(JXG$1.isArray(N[2])||JXG$1.isFunction(N[2]))))se=JXG$1.providePoints3D(z,[N[1]],G,"line3d",["point1"])[0],ae=JXG$1.providePoints3D(z,[N[2]],G,"line3d",["point2"])[0],ie=function(){return[0,ae.X()-se.X(),ae.Y()-se.Y(),ae.Z()-se.Z()]},ne=[0,1],pe=new JXG$1.Line3D(z,se,ie,ne,q),pe.prepareUpdate().update(),ce=JXG$1.providePoints3D(z,[[1,0,0,0],[1,0,0,0]],{visible:!0},"line3d",["point1","point2"]),ce[0].F=function(){var be=0;return pe.evalVisProp("straightfirst")&&(be=-1/0),pe.getPointCoords(be)},ce[1].F=function(){var be=1;return pe.evalVisProp("straightlast")&&(be=1/0),pe.getPointCoords(be)},ce[0].prepareUpdate().update(),ce[1].prepareUpdate().update(),q=pe.setAttr2D(q),q.straightfirst=!1,q.straightlast=!1,pe.element2D=z.create("segment",[ce[0].element2D,ce[1].element2D],q),pe.element2D.view=z,pe.endpoints=ce,pe.addChild(ce[0]),pe.addChild(ce[1]),pe.addParents([se,ae]);else{if(ge!==null)W=JXG$1.providePoints3D(z,[[0,0,0]],G,"line3d",["point"])[0],ie=[0,0,0,1e-4],ne=N[3]||[-1/0,1/0];else if(JXG$1.exists(N[2].view)&&N[2].type===Const.OBJECT_TYPE_LINE3D||JXG$1.isFunction(N[2])||N[2].length===3||N[2].length===4)W=JXG$1.providePoints3D(z,[N[1]],G,"line3d",["point"])[0],ie=N[2],ne=N[3];else throw new Error("JSXGraph: Can't create line3d with parents of type '"+typeof N[1]+", "+typeof N[2]+", "+typeof N[3]+"'.");Y=JXG$1.providePoints3D(z,[[1,0,0,0],[1,0,0,0]],G,"line3d",["point1","point2"]),pe=new JXG$1.Line3D(z,W,ie,ne,q),pe.prepareUpdate().update(),Y[0].F=function(){return pe.getPointCoords(JXG$1.evaluate(pe.range[0]))},Y[0].prepareUpdate().update(),se=Y[0],Y[1].F=function(){return pe.getPointCoords(JXG$1.evaluate(pe.range[1]))},Y[1].prepareUpdate().update(),ae=Y[1],q=pe.setAttr2D(q),q.straightfirst=!1,q.straightlast=!1,pe.element2D=z.create("segment",[se.element2D,ae.element2D],q),pe.element2D.view=z,pe.endpoints=Y,pe.addParents(W),ge!==null&&ve!==null&&(pe.addTransform(ge,ve),pe.addParents(ge))}return pe.addChild(pe.element2D),pe.inherits.push(pe.element2D),pe.element2D.addParents(pe),pe.point1=se,pe.point2=ae,pe.point1._is_new?(pe.addChild(pe.point1),delete pe.point1._is_new):pe.point1.addChild(pe),pe.point2._is_new?(pe.addChild(pe.point2),delete pe.point2._is_new):pe.point2.addChild(pe),JXG$1.exists(W)&&(W._is_new?(pe.addChild(W),delete W._is_new):W.addChild(pe)),pe.update(
214),pe.element2D.prepareUpdate().update().updateRenderer(),pe};JXG$1.registerElement("line3d",JXG$1.createLine3D);JXG$1.Plane3D=function(v,N,G,z,q,Y,W){this.constructor(v.board,W,Const.OBJECT_TYPE_PLANE3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"plane3d"),this.board.finalizeAdding(this),this.point=N,this.direction1=G,this.direction2=q,this.range_u=z||[-1/0,1/0],this.range_v=Y||[-1/0,1/0],this.vec1=[0,0,0,0],this.vec2=[0,0,0,0],this.mesh3d=null,this.normal=[0,0,0,0],this.d=0,this.updateCoords(),this.updateNormal(),this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.Plane3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Plane3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Plane3D.prototype,{F:function(v,N){var G,z,q,Y,W;for(z=this.vec1.slice(),q=this.vec2.slice(),Y=Mat.norm(z,3),W=Mat.norm(q,3),G=0;G<3;G++)z[G]/=Y,q[G]/=W;return[this.point.X()+v*z[0]+N*q[0],this.point.Y()+v*z[1]+N*q[1],this.point.Z()+v*z[2]+N*q[2]]},X:function(v,N){return this.F(v,N)[0]},Y:function(v,N){return this.F(v,N)[1]},Z:function(v,N){return this.F(v,N)[2]},updateCoords:function(){var v,N;if(JXG$1.exists(this.direction1.view)&&this.direction1.type===Const.OBJECT_TYPE_LINE3D)this.vec1=this.direction1.vec.slice();else if(JXG$1.isFunction(this.direction1))this.vec1=JXG$1.evaluate(this.direction1),this.vec1.length===3&&this.vec1.unshift(0);else for(N=0,this.direction1.length===3&&(this.vec1[0]=0,N=1),v=0;v<this.direction1.length;v++)this.vec1[N+v]=JXG$1.evaluate(this.direction1[v]);if(JXG$1.exists(this.direction2.view)&&this.direction2.type===Const.OBJECT_TYPE_LINE3D)this.vec2=this.direction2.vec.slice();else if(JXG$1.isFunction(this.direction2))this.vec2=JXG$1.evaluate(this.direction2),this.vec2.length===3&&this.vec2.unshift(0);else for(N=0,this.direction2.length===3&&(this.vec2[0]=0,N=1),v=0;v<this.direction2.length;v++)this.vec2[N+v]=JXG$1.evaluate(this.direction2[v]);return this},updateNormal:function(){var v,N;if(this.needsUpdate,this.normal=Mat.crossProduct(this.vec1.slice(1),this.vec2.slice(1)),N=Mat.norm(this.normal),Math.abs(N)>Mat.eps*Mat.eps)for(v=0;v<3;v++)this.normal[v]/=N;return this.normal.unshift(0),this.d=Mat.innerProduct(this.point.coords,this.normal,4),this},updateDataArray:function(){var v,N,G,z,q,Y,W,ie=["xPlaneRear","yPlaneRear","zPlaneRear"],ne=[],se=[0,0,0],ae=[0,0,0],ce=[0,0,0],pe=[0,0,0],ge=1e-12,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe=this.view;if(this.dataX=[],this.dataY=[],this.updateNormal(),this.elType!=="axisplane3d"&&qe.defaultAxes&&JXG$1.evaluate(this.range_u[0])===-1/0&&JXG$1.evaluate(this.range_u[1])===1/0&&JXG$1.evaluate(this.range_v[0])===-1/0&&JXG$1.evaluate(this.range_v[1])===1/0){for(Ee=0;Ee<ie.length;Ee++){if(pe=qe.intersectionPlanePlane(this,qe.defaultAxes[ie[Ee]]),pe[0]!==!1&&pe[1]!==!1){for(be=0;be<ne.length&&!(Geometry.distance(pe[0],ne[be][0],4)<ge&&Geometry.distance(pe[1],ne[be][1],4)<ge||Geometry.distance(pe[0],ne[be][1],4)<ge&&Geometry.distance(pe[1],ne[be][0],4)<ge);be++);be===ne.length&&ne.push(pe.slice())}if(pe=[1,0,0,0],pe[Ee+1]=qe.bbox3D[Ee][1],ve=Mat.innerProduct(pe,qe.defaultAxes[ie[Ee]].normal,4),pe=qe.intersectionPlanePlane(this,qe.defaultAxes[ie[Ee]],ve),pe[0]!==!1&&pe[1]!==!1){for(be=0;be<ne.length&&!(Geometry.distance(pe[0],ne[be][0],4)<ge&&Geometry.distance(pe[1],ne[be][1],4)<ge||Geometry.distance(pe[0],ne[be][1],4)<ge&&Geometry.distance(pe[1],ne[be][0],4)<ge);be++);be===ne.length&&ne.push(pe.slice())}}if(ne.length===0)return{X:this.dataX,Y:this.dataY};Ce=0,Ve=Ce,be=0;do{for(pe=ne[Ve][be],pe.length===4&&(q=qe.project3DTo2D(pe),this.dataX.push(q[1]),this.dataY.push(q[2])),be=(be
214+1)%2,pe=ne[Ve][be],Re=Ve,Ee=0;Ee<ne.length;Ee++){if(Ee!==Ve&&Geometry.distance(pe,ne[Ee][0])<ge){Ve=Ee,be=0;break}if(Ee!==Ve&&Geometry.distance(pe,ne[Ee][1])<ge){Ve=Ee,be=1;break}}if(Ve===Re){console.log("Error plane3d update: did not find next",Ve);break}}while(Ve!==Ce);q=qe.project3DTo2D(ne[Ce][0]),this.dataX.push(q[1]),this.dataY.push(q[2])}else{for(v=JXG$1.evaluate(this.range_u[0]),N=JXG$1.evaluate(this.range_u[1]),G=JXG$1.evaluate(this.range_v[0]),z=JXG$1.evaluate(this.range_v[1]),ce=this.point.coords,se=this.vec1.slice(),ae=this.vec2.slice(),Y=Mat.norm(se,4),W=Mat.norm(ae,4),be=1;be<4;be++)se[be]/=Y,ae[be]/=W;for(Ee=0;Ee<4;Ee++){switch(Ee){case 0:Pe=v,Je=G;break;case 1:Pe=N,Je=G;break;case 2:Pe=N,Je=z;break;case 3:Pe=v,Je=z}for(be=0;be<4;be++)pe[be]=ce[be]+Pe*se[be]+Je*ae[be];q=qe.project3DTo2D(pe),this.dataX.push(q[1]),this.dataY.push(q[2])}this.dataX.push(this.dataX[0]),this.dataY.push(this.dataY[0])}return{X:this.dataX,Y:this.dataY}},addTransform:function(v,N){return this.addTransformGeneric(v,N),this.point.addTransform(v.point,N),this},updateTransform:function(){var v,N,G;if(this.transformations.length===0||this.baseElement===null)return this;for(this===this.baseElement?(v=this.vec1,N=this.vec2):(v=this.baseElement.vec1,N=this.baseElement.vec2),G=0;G<this.transformations.length;G++)this.transformations[G].update(),v=Mat.matVecMult(this.transformations[G].matrix,v),N=Mat.matVecMult(this.transformations[G].matrix,N);return this.vec1=v,this.vec2=N,this},update:function(){return this.needsUpdate&&this.updateCoords().updateTransform(),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(v,N){return Geometry.projectCoordsToParametric(v,this,2,N)}});JXG$1.createPlane3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se,ae,ce,pe,ge,ve=null,be=null;if(q=JXG$1.copyAttributes(G,v.options,"plane3d"),q.threepoints||JXG$1.isPoint3D(N[2])||JXG$1.isPoint3D(N[3]))Y=JXG$1.providePoints3D(z,[N[1]],G,"plane3d",["point1"])[0],W=JXG$1.providePoints3D(z,[N[2]],G,"plane3d",["point2"])[0],ie=JXG$1.providePoints3D(z,[N[3]],G,"plane3d",["point3"])[0],ne=function(){return[W.X()-Y.X(),W.Y()-Y.Y(),W.Z()-Y.Z()]},se=function(){return[ie.X()-Y.X(),ie.Y()-Y.Y(),ie.Z()-Y.Z()]},ae=N[4]||[-1/0,1/0],ce=N[5]||[-1/0,1/0];else{if(N[1].type===Const.OBJECT_TYPE_PLANE3D&&JXG$1.isTransformationOrArray(N[2])?(ve=N[1],be=N[2],Y=JXG$1.providePoints3D(z,[[0,0,0,0]],G,"plane3d",["point"])[0],ne=[0,1e-4,0,0],se=[0,0,1e-4,0],ae=N[3]||[-1/0,1/0],ce=N[4]||[-1/0,1/0]):(Y=JXG$1.providePoints3D(z,[N[1]],G,"plane3d",["point"])[0],ne=N[2],se=N[3],ae=N[4]||[-1/0,1/0],ce=N[5]||[-1/0,1/0]),Y===!1)throw new Error("JSXGraph: Can't create plane3d with first parent of type '"+typeof N[1]+`'.
215Possible first parent types are: point3d, array of length 3, function returning an array of length 3.`);if(ve!==null&&N<3||ve===null&&N.length<4)throw new Error("JSXGraph: Can't create plane3d with parents of type '"+typeof N[1]+", "+typeof N[2]+", "+typeof N[3]+", "+typeof N[4]+", "+typeof N[5]+"'.")}return pe=new JXG$1.Plane3D(z,Y,ne,ae,se,ce,q),Y.addChild(pe),q=pe.setAttr2D(q),pe.element2D=z.create("curve",[[],[]],q),pe.element2D.view=z,ve!==null&&be!==null&&(pe.addTransform(ve,be),pe.addParents(ve)),pe.element2D.updateDataArray=function(){var Ee=pe.updateDataArray();this.dataX=Ee.X,this.dataY=Ee.Y},pe.addChild(pe.element2D),pe.inherits.push(pe.element2D),pe.element2D.setParents(pe),Math.abs(pe.range_u[0])!==1/0&&Math.abs(pe.range_u[1])!==1/0&&Math.abs(pe.range_v[0])!==1/0&&Math.abs(pe.range_v[1])!==1/0&&(q=JXG$1.copyAttributes(q.mesh3d,v.options,"mesh3d"),ge=z.create("mesh3d",[function(){return Y.coords},function(){return pe.vec1},function(){return pe.vec2},pe.range_u,pe.range_v],q),pe.mesh3d=ge,pe.addChild(ge),pe.inherits.push(ge),pe.element2D.inherits.push(ge),ge.setParents(pe),pe.mesh3d.view=z),pe.element2D.prepareUpdate().update(),v.isSuspendedUpdate||pe.element2D.updateVisibility().updateRenderer(),pe};
215JXG$1.registerElement("plane3d",JXG$1.createPlane3D);JXG$1.createIntersectionLine3D=function(v,N,G){var z=N[0],q=N[1],Y=N[2],W,ie,ne,se=JXG$1.copyAttributes(G,v.options,"intersectionline3d"),ae=[];for(ne=Geometry.intersectionFunction3D(z,q,Y),ie=0;ie<2;ie++)ae[ie]=z.create("point3d",ne[ie],se["point"+(ie+1)]);W=z.create("line3d",ae,se);try{q.addChild(W),Y.addChild(W)}catch{throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof N[1]+"' and '"+typeof N[2]+"'.")}return W.type=Const.OBJECT_TYPE_INTERSECTION_LINE3D,W.elType="intersectionline3d",W.setParents([q.id,Y.id]),W};JXG$1.registerElement("intersectionline3d",JXG$1.createIntersectionLine3D);JXG$1.Text3D=function(v,N,G,z,q){this.constructor(v.board,q,Const.OBJECT_TYPE_TEXT3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"text3d"),this.board.finalizeAdding(this),this.coords=[0,0,0,0],this.F=N,this.slide=z,this.X=function(){return this.coords[1]},this.Y=function(){return this.coords[2]},this.Z=function(){return this.coords[3]},this.position=[],this._c2d=null,this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.Text3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Text3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Text3D.prototype,{updateCoords:function(){var v;if(JXG$1.isFunction(this.F))this.coords=JXG$1.evaluate(this.F),this.coords.unshift(1);else for(this.coords[0]=1,v=0;v<3;v++)JXG$1.isFunction(this.F[v])&&(this.coords[v+1]=JXG$1.evaluate(this.F[v]));return this},initCoords:function(){var v;if(JXG$1.isFunction(this.F))this.coords=JXG$1.evaluate(this.F),this.coords.unshift(1);else for(this.coords[0]=1,v=0;v<3;v++)this.coords[v+1]=JXG$1.evaluate(this.F[v]);return this},normalizeCoords:function(){return Math.abs(this.coords[0])>Mat.eps&&(this.coords[1]/=this.coords[0],this.coords[2]/=this.coords[0],this.coords[3]/=this.coords[0],this.coords[0]=1),this},setPosition:function(v,N){var G=this.coords;return v.length===3?(G[0]=1,G[1]=v[0],G[2]=v[1],G[3]=v[2]):(G[0]=v[0],G[1]=v[1],G[2]=v[2],G[3]=v[2],this.normalizeCoords()),this},update:function(v){var N,G,z;return this.element2D.draggable()&&Geometry.distance(this._c2d,this.element2D.coords.usrCoords)!==0?(this.view.isVerticalDrag()?N=this.view.project2DTo3DVertical(this.element2D,this.coords):(G=[1,0,0,this.coords[3]],N=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],G)),N[0]!==0&&(z=this.view.project3DToCube(N),this.coords=z[0],z[1]&&this.element2D.coords.setCoordinates(Const.COORDS_BY_USER,this.view.project3DTo2D(this.coords)),this.slide&&(this.coords=this.slide.projectCoords([this.X(),this.Y(),this.Z()],this.position),this.element2D.coords.setCoordinates(Const.COORDS_BY_USER,this.view.project3DTo2D(this.coords))))):(this.updateCoords(),this.slide&&(this.coords=this.slide.projectCoords([this.X(),this.Y(),this.Z()],this.position)),N=this.coords,this.element2D.coords.setCoordinates(Const.COORDS_BY_USER,this.view.project3DTo2D(N)),this.zIndex=Mat.matVecMult(this.view.matrix3DRotShift,N)[3],this.element2D.prepareUpdate().update()),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},testIfFinite:function(){return Math.abs(this.coords[0])>Mat.eps},__evt__update3D:function(v){}});JXG$1.createText3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se;if(N.length>2&&JXG$1.exists(N[N.length-1].is3D)?W=N.pop():W=null,N.length===3)Y=N[1],ie=N[2];else if(N.length===5)Y=N.slice(1,4),ie=N[4];else throw new Error("JSXGraph: Can't create text3d with parent types '"+typeof N[1]+"' and '"+typeof N[2]+`'.
216Possible parent types: [[x,y,z], text], [x,y,z, text]`);return q=JXG$1.copyAttributes(G,v.options,"text3d"),se=new JXG$1.Text3D(z,Y,ie,W,q),se.initCoords(),ne=z.project3DTo2D(se.coords),q=se.setAttr2D(q),se.element2D=z.create("text",[ne[1],ne[2],ie],q),se.element2D.view=z,se.addChild(se.element2D),se.inherits.push(se.element2D),se.element2D.setParents(se),se.slide&&(se.slide.addChild(se),se.setParents(se.slide)),se._c2d=se.element2D.coords.usrCoords.slice(),se};JXG$1.registerElement("text3d",JXG$1.createText3D);JXG$1.createTicks3D=function(v,N,G){var z=N[0],q=N[1],Y=N[2],W=N[3],ie=N[4],ne,se;return se=JXG$1.copyAttributes(G,v.options,"ticks3d"),ne=z.create("curve",[[],[]],se),ne.point=q,ne.direction1=Y,ne.len=W,ne.direction2=ie,ne.drawLabels=function(ae){var ce=0,pe=this.len,ge=this.evalVisProp("ticksdistance"),ve=this.evalVisProp("ticken
216dings"),be=this.evalVisProp("majorheight"),Ee,Pe,Je,Ce,Ve,Re,qe,et=[0,0,0],Ze=[0,0,0],tt=[0,0,0],Ke=[];if(be/=Math.sqrt(v.unitX*v.unitY),Ee=be*ve[1]*2,this.dataX=[],this.dataY=[],JXG$1.isFunction(this.point))tt=this.point().slice(1);else for(Ce=0;Ce<3;Ce++)tt[Ce]=JXG$1.evaluate(this.point[Ce]);for(Ce=0;Ce<3;Ce++)et[Ce]=JXG$1.evaluate(this.direction1[Ce]),Ze[Ce]=JXG$1.evaluate(this.direction2[Ce]);for(Pe=JXG$1.Math.norm(et,3),Je=JXG$1.Math.norm(Ze,3),Ce=0;Ce<3;Ce++)et[Ce]/=Pe,Ze[Ce]/=Je;if(!(Math.abs(ge)<Mat.eps)){for(Ve=ce;Ve<=pe;Ve+=ge){for(qe=[tt[0]+Ve*et[0]+Ee*Ze[0],tt[1]+Ve*et[1]+Ee*Ze[1],tt[2]+Ve*et[2]+Ee*Ze[2]],Ce=0;Ce<3;Ce++)et[Ce]!==0&&(Re=tt[Ce]+Ve*et[Ce]);Ke.push(z.create("text3d",[qe,Re],ae))}return Ke}},ne.evalVisProp("drawlabels")&&(ne.labels=ne.drawLabels(se.label)),ne.updateDataArray=function(){var ae=0,ce=this.len,pe=this.evalVisProp("ticksdistance"),ge=this.evalVisProp("tickendings"),ve=this.evalVisProp("majorheight"),be,Ee,Pe,Je,Ce,Ve,Re,qe,et=[0,0,0],Ze=[0,0,0],tt=[0,0,0];if(ve/=Math.sqrt(v.unitX*v.unitY),be=ve*-ge[0],Ee=ve*ge[1],this.dataX=[],this.dataY=[],JXG$1.isFunction(this.point))tt=this.point().slice(1);else for(Ce=0;Ce<3;Ce++)tt[Ce]=JXG$1.evaluate(this.point[Ce]);for(Ce=0;Ce<3;Ce++)et[Ce]=JXG$1.evaluate(this.direction1[Ce]),Ze[Ce]=JXG$1.evaluate(this.direction2[Ce]);for(Pe=JXG$1.Math.norm(et,3),Je=JXG$1.Math.norm(Ze,3),Ce=0;Ce<3;Ce++)et[Ce]/=Pe,Ze[Ce]/=Je;if(!(Math.abs(pe)<Mat.eps))for(Ve=ae;Ve<=ce;Ve+=pe)qe=[tt[0]+Ve*et[0]+be*Ze[0],tt[1]+Ve*et[1]+be*Ze[1],tt[2]+Ve*et[2]+be*Ze[2]],Re=z.project3DTo2D(qe),this.dataX.push(Re[1]),this.dataY.push(Re[2]),qe=[tt[0]+Ve*et[0]+Ee*Ze[0],tt[1]+Ve*et[1]+Ee*Ze[1],tt[2]+Ve*et[2]+Ee*Ze[2]],Re=z.project3DTo2D(qe),this.dataX.push(Re[1]),this.dataY.push(Re[2]),this.dataX.push(NaN),this.dataY.push(NaN)},ne};JXG$1.registerElement("ticks3d",JXG$1.createTicks3D);JXG$1.Polygon3D=function(v,N,G){var z;for(this.constructor(v.board,G,Const.OBJECT_TYPE_POLYGON3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"polygon3d"),this.board.finalizeAdding(this),this.vertices=[],z=0;z<N.length;z++)this.vertices[z]=this.board.select(N[z]),this.vertices[z]._is_new&&(delete this.vertices[z]._is_new,this.vertices[z]._is_new_pol=!0)};JXG$1.Polygon3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Polygon3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Polygon3D.prototype,{update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this},updateZIndex:function(){var v,N=this.vertices.length,G=[1,0,0,0];if(N<=0)return[NaN,NaN,NaN,NaN];for(v=0;v<N;v++)G[1]+=this.vertices[v].coords[1],G[2]+=this.vertices[v].coords[2],G[3]+=this.vertices[v].coords[3];return G[1]/=N,G[2]/=N,G[3]/=N,this.zIndex=Mat.matVecMult(this.view.matrix3DRotShift,G)[3],this}});JXG$1.createPolygon3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne=[],se=[],ae,ce,pe=!1;if(ae=JXG$1.copyAttributes(G,v.options,"polygon3d"),ie=v.select(N[1]),ie===null&&(ie=N[1]),JXG$1.isObject(ie)&&ie.type===Const.OBJECT_TYPE_POLYGON3D&&JXG$1.isTransformationOrArray(N[2]))for(pe=!0,W=ie.vertices.length-1,ce=JXG$1.copyAttributes(G,v.options,"polygon3d","vertices"),Y=0;Y<W;Y++)ce.withlabel&&(ce.name=ie.vertices[Y].name===""?"":ie.vertices[Y].name+"'"),ne.push(v.create("point3d",[ie.vertices[Y],N[2]],ce));else if(JXG$1.isArray(N[1])&&N[1].every(ge=>JXG$1.isPoint3D(ge)))ne=N[1];else if(ne=JXG$1.providePoints3D(z,N.slice(1),G,"polygon3d",["vertices"]),ne===!1)throw new Error("JSXGraph: Can't create polygon3d with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates. Alternatively, a polygon3d and a transformation can be supplied");for(q=new JXG$1.Polygon3D(z,ne,ae),q.isDraggable=!0,ae=q.setAttr2D(ae),Y=0;Y<ne.length;Y++)se.push(ne[Y].element2D);if(q.element2D=v.create("polygon",se,ae),q.element2D.view=z,q.addChild(q.element2D),q.inherits.push(q.element2D),q.element2D.setParents(q),pe)for(q.prepareUpdate().update().updateVisibility().updateRenderer(),W=ie.vertices.length-1,Y=0;Y<W;Y++)ne[Y].prepareUpdate().update().updateVisibility().updateRenderer();return q};JXG$1.registerElement("polygon3d",JXG$1.createPolygon3D);JXG$1.Face3D=function(v,N,G,z){this.constructor(v.board,z,Const.OBJECT_TYPE_FACE3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"face3d"),this.board.finalizeAdding(this),this.polyhedron=N,this.faceNumber=G,this.normal=[0,0,0,0],this.d=0,this.vec1=[0,0,0,0],this.vec2=[0,0,0,0],this.faceNumber===0&&this.updateCoords(),this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.Face3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Face3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Face3D.prototype,{updateCoords:function(){var v,N,G,z,q=this.polyhedron;for(v in q.vertices){if(z=q.vertices[v],JXG$1.isFunction(z))q.coords[v]=JXG$1.evaluate(z);else if(JXG$1.isArray(z))for(q.coords[v]=[],G=z.length,N=0;N<G;N++)q.coords[v][N]=JXG$1.evaluate(z[N]);else if(z=q.view.select(z),JXG$1.isPoint3D(z))q.coords[v]=z.coords;else throw new Error("Polyhedron3D.updateCoords: unknown vertices type!");q.coords[v].length===3&&q.coords[v].unshift(1)}return this},updateDataArray2D:function(){var v,N,G,z,q=[],Y=[],W=this.polyhedron,ie=W.faces[this.faceNumber];if(this.faceNumber===0)for(v in W.vertices)W.coords2D[v]=[];for(N=ie.length,this.zIndex=0,v=0;v<N;v++)z=W.coords2D[ie[v]],z.length===0&&(G=W.coords[ie[v]],z=this.view.project3DTo2D(G),W.coords2D[ie[v]]=z,W.zIndex[ie[v]]=Mat.matVecMult(this.view.matrix3DRotShift,G)[3]),q.push(z[1]),Y.push(z[2]),this.zIndex+=W.zIndex[ie[v]];return N>0&&(this.zIndex/=N),N!==2&&(q.push(q[0]),Y.push(Y[0])),{X:q,Y}},addTransform:function(v,N){return this.faceNumber===0&&this.addTransformGeneric(v,N),this},updateTransform:function(){var v,N,G,z,q;if(this.faceNumber!==0)return this;if(this.transformations.length===0||this.baseElement===null)return this;for(v=this.transformations,G=0;G<v.length;G++)v[G].update();this===this.baseElement?q=this.polyhedron:q=this.baseElement.polyhedron;for(G in q.coords)if(q.coords.hasOwnProperty(G)){for(N=q.coords[G],z=0;z<v.length;z++)N=Mat.matVecMult(v[z].matrix,N);this.polyhedron.coords[G]=N}return this},update:function(){var v,N,G,z,q,Y,W;if(this.needsUpdate&&!this.view.board._change3DView){if(G=this.polyhedron,this.faceNumber===0&&this.updateCoords().updateTransform(),W=G.faces[this.faceNumber],N=W.length,N<3)return this;
216if(q=G.coords[W[0]],Y=G.coords[W[1]],this.vec1=[Y[0]-q[0],Y[1]-q[1],Y[2]-q[2],Y[3]-q[3]],Y=G.coords[W[2]],this.vec2=[Y[0]-q[0],Y[1]-q[1],Y[2]-q[2],Y[3]-q[3]],this.normal=Mat.crossProduct(this.vec1.slice(1),this.vec2.slice(1)),z=Mat.norm(this.normal),this.normal.unshift(0),Math.abs(z)>1e-12)for(v=1;v<4;v++)this.normal[v]/=z;this.d=Mat.innerProduct(q,this.normal,4)}return this},updateRenderer:function(){return this.needsUpdate&&(this.needsUpdate=!1,this.shader()),this},shader:function(){var v,N,G,z,q,Y,W,ie,ne;if(this.evalVisProp("shader.enabled"))return v=this.evalVisProp("shader.hue"),N=this.evalVisProp("shader.saturation"),ie=this.evalVisProp("shader.minlightness"),ne=this.evalVisProp("shader.maxlightness"),this.evalVisProp("shader.type").toLowerCase()==="angle"?(z=Mat.innerProduct(this.view.matrix3DRotShift[3],this.normal),z=Math.abs(z),G=ie+(ne-ie)*z):(W=this.view.zIndexMax,Y=this.view.zIndexMin,G=ie+(ne-ie)*((this.zIndex-Y)/(W-Y))),q="hsl("+v+","+N+"%,"+G+"%)",this.element2D.visProp.fillcolor=q,this.zIndex}});JXG$1.createFace3D=function(v,N,G){var z=N[0],q=N[1],Y=N[2],W,ie;return W=JXG$1.copyAttributes(G,v.options,"face3d"),ie=new JXG$1.Face3D(z,q,Y,W),W=ie.setAttr2D(W),ie.element2D=z.create("curve",[[],[]],W),ie.element2D.view=z,ie.element2D.updateDataArray=function(){var ne=ie.updateDataArray2D();this.dataX=ne.X,this.dataY=ne.Y},ie.addChild(ie.element2D),ie.inherits.push(ie.element2D),ie.element2D.setParents(ie),ie.element2D.prepareUpdate().update(),v.isSuspendedUpdate||ie.element2D.updateVisibility().updateRenderer(),ie};JXG$1.registerElement("face3d",JXG$1.createFace3D);JXG$1.Polyhedron3D=function(v,N,G,z){var q,Y,W,ie=this;for(this.constructor(v.board,z,Const.OBJECT_TYPE_POLYHEDRON3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"polyhedron3d"),this.board.finalizeAdding(this),this.elType="polyhedron3d",this.faces=G,this.numberFaces=G.length,this.def=N,Y=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],W=function(ne){return function(){var se;for(se in ie.faces)ie.faces.hasOwnProperty(se)&&JXG$1.exists(ie.faces[se][ne])&&ie.faces[se][ne].apply(ie.faces[se],arguments);return ie}},q=0;q<Y.length;q++)this[Y[q]]=W(Y[q]);this.methodMap=JXG$1.deepCopy(this.methodMap,{setAttribute:"setAttribute",setParents:"setParents"})};JXG$1.Polyhedron3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Polyhedron3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Polyhedron3D.prototype,{addTransform:function(v,N){if(this.faces.length>0&&v.faces.length>0)this.faces[0].addTransform(v.faces[0],N);else throw new Error("Adding transformation failed. At least one of the two polyhedra has no faces.");return this}});JXG$1.createPolyhedron3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se,ae,ce=[],pe=null,ge=null,ve={view:z,vertices:{},coords:{},coords2D:{},zIndex:{},faces:[]};if(JXG$1.exists(N[1].type)&&N[1].type===Const.OBJECT_TYPE_POLYHEDRON3D)pe=N[1],ge=N[2],ve.vertices=pe.def.vertices,ve.faces=pe.def.faces;else{if(JXG$1.isArray(N[1]))for(Y=N[1].length,q=0;q<Y;q++)ve.vertices[q]=N[1][q];else if(JXG$1.isObject(N[1]))for(q in N[1])N[1].hasOwnProperty(q)&&(ve.vertices[q]=N[1][q]);ve.faces=N[2]}for(ae=JXG$1.copyAttributes(G,v.options,"polyhedron3d"),console.time("polyhedron"),z.board.suspendUpdate(),Y=ve.faces.length,q=0;q<Y;q++)se=JXG$1.copyAttributes(G,v.options,"face3d"),ae.fillcolorarray.length>0&&(se.fillcolor=ae.fillcolorarray[q%ae.fillcolorarray.length]),ie=ve.faces[q],JXG$1.isArray(ie)&&ie.length===2&&JXG$1.isObject(ie[1])&&JXG$1.isArray(ie[0])&&(JXG$1.mergeAttr(se,ie[1]),ve.faces[q]=ie[0]),W=z.create("face3d",[ve,q],se),ce.push(W);for(ne=new JXG$1.Polyhedron3D(z,ve,ce,ae),ne.setParents(ne),q=0;q<Y;q++)ne.inherits.push(ne.faces[q]),ne.addChild(ne.faces[q]);return pe!==null&&(ne.addTransform(pe,ge),ne.addParents(pe)),z.board.unsuspendUpdate(),console.timeEnd("polyhedron"),ne};JXG$1.registerElement("polyhedron3d",JXG$1.createPolyhedron3D);JXG$1.Sphere3D=function(v,N,G,z,q){this.constructor(v.board,q,Const.OBJECT_TYPE_SPHERE3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"sphere3d"),this.board.finalizeAdding(this),this.method=N,this.center=this.board.select(G),this.point2=null,this.points=[],this.element2D=null,this.aux2D=[],this.projectionType=v.projectionType,N==="twoPoints"?(this.point2=this.board.select(z),this.radius=this.Radius()):N==="pointRadius"&&(this.updateRadius=JXG$1.createFunction(z,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])),JXG$1.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),N==="twoPoints"&&(JXG$1.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this)),this.methodMap=JXG$1.deepCopy(this.methodMap,{center:"center",point2:"point2",Radius:"Radius"})};JXG$1.Sphere3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Sphere3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Sphere3D.prototype,{X:function(v,N){var G=this.Radius();return G*Math.sin(v)*Math.cos(N)},Y:function(v,N){var G=this.Radius();return G*Math.sin(v)*Math.sin(N)},Z:function(v,N){var G=this.Radius();return G*Math.cos(v)},range_u:[0,2*Math.PI],range_v:[0,Math.PI],update:function(){return this.projectionType!==this.view.projectionType&&this.rebuildProjection(),this},updateRenderer:function(){return this.needsUpdate=!1,this},setRadius:function(v){return this.updateRadius=JXG$1.createFunction(v,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(v){return JXG$1.exists(v)?(this.setRadius(v),this.Radius()):this.method==="twoPoints"?!this.center.testIfFinite()||!this.point2.testIfFinite()?NaN:this.center.distance(this.point2):this.method==="pointRadius"?Math.abs(this.updateRadius()):NaN},focusFn:function(v){var N=this;return function(){var G=N.view.boxToCam[3],z=N.Radius();return N.view.project3DTo2D([N.center.X()+v*z*G[1],N.center.Y()+v*z*G[2],N.center.Z()+v*z*G[3]]).slice(1,3)}},innerVertexFn:function(){var v=this;return function(){var N=v.view,G=N.worldToFocal(v.center.coords,!1),z=Mat.hypot(G[0],G[1]),q=N.boxToCam,Y=v.Radius(),W=Math.atan(-z/G[2]),ie=Math.acos(Y/Mat.norm(G)),ne=W+ie,se=Math.cos(ne),ae=Math.sin(ne),ce;return z>1e-8?ce=[-(G[0]*q[1][1]+G[1]*q[2][1])/z,-(G[0]*q[1][2]+G[1]*q[2][2])/z,-(G[0]*q[1][3]+G[1]*q[2][3])/z]:ce=[q[1][1],q[1][2],q[1][3]],N.project3DTo2D([v.center.X()+Y*(ae*ce[0]+se*q[3][1]),v.center.Y()+Y*(ae*ce[1]+se*q[3][2]),v.center.Z()+Y*(ae*ce[2]+se*q[3][3])])}},buildCentralProjection:function(v){var N=this.view,G={visible:!1,withLabel:!1},z=N.create("point",this.focusFn(-1),G),q=N.create("point",this.focusFn(1),G),Y=N.create("point",this.innerVertexFn(N),G);this.aux2D=[z,q,Y],this.element2D=N.create("ellipse",this.aux2D,v===void 0?this.visProp:v)},buildParallelProjection:function(v){var N=this,G=function(){var z=N.view.bbox3D[0][1]-N.view.bbox3D[0][0];return N.Radius()*N.view.size[0]/z};this.aux2D=[],this.element2D=this.view.create("circle",[N.center.element2D,G],v===void 0?this.visProp:v)},rebuildProjection:function(v){var N;if(this.element2D){this.view.board.removeObject(this.element2D);for(N in this.aux2D)this.aux2D.hasOwnProperty(N)&&this.view.board.removeObject(this.aux2D[N])}this.projectionType=this.view.projectionType,this.projectionType==="central"?this.buildCentralProjection(v):this.buildParallelProjection(v),this.addChild(this.element2D),this.inherits.push(this.element2D),this.element2D.view=this.view},projectCoords:function(v,N){var G=this.Radius(),z=[1].concat(v),q=this.center.coords,Y=Geometry.distance(q,z,4),W=Stat.subtract(z,q);return Y===0?(N[0]=0,N[1]=0,[1,G,0,0]):G===0?(N[0]=0,N[1]=0,this.center.coords):(Y=G/Y,W[0]=1,W[1]*=Y,W[2]*=Y,W[3]*=Y,N[1]=Math.atan2(W[2],W[1]),N[1]+=N[1]<0?Math.PI:0,N[1]!==0?N[0]=Math.atan2(W[2],W[3]*Math.sin(N[1])):N[0]=Math.atan2(W[1],W[3]*Math.cos(N[1])),N[0]+=N[0]<0?2*Math.PI:0,W)}});JXG$1.createSphere3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se;for(q=JXG$1.copyAttributes(G,v.options,"sphere3d"),Y=[],se=1;se<N.length;se++)if(JXG$1.isPointType3D(v,N[se])){if(Y.length===0?W="center"
216:W="point",ie=JXG$1.providePoints3D(z,[N[se]],G,"sphere3d",[W])[0],ie===!1)throw new Error("JSXGraph: Can't create sphere3d from this type. Please provide a point type.");Y.push(ie)}else Y.push(N[se]);if(JXG$1.isPoint3D(Y[0])&&JXG$1.isPoint3D(Y[1]))ne=new JXG$1.Sphere3D(z,"twoPoints",Y[0],Y[1],q);else if(JXG$1.isPoint3D(Y[0])&&(JXG$1.isNumber(Y[1])||JXG$1.isFunction(Y[1])||JXG$1.isString(Y[1])))ne=new JXG$1.Sphere3D(z,"pointRadius",Y[0],Y[1],q);else throw new Error("JSXGraph: Can't create sphere3d with parent types '"+typeof N[1]+"' and '"+typeof N[2]+`'.
217Possible parent types: [point,point], [point,number], [point,function]`);return q=ne.setAttr2D(q),ne.rebuildProjection(q),ne.element2D.prepareUpdate().update(),v.isSuspendedUpdate||ne.element2D.updateVisibility().updateRenderer(),ne};JXG$1.registerElement("sphere3d",JXG$1.createSphere3D);JXG$1.Surface3D=function(v,N,G,z,q,Y,W,ie){this.constructor(v.board,ie,Const.OBJECT_TYPE_SURFACE3D,Const.OBJECT_CLASS_3D),this.constructor3D(v,"surface3d"),this.board.finalizeAdding(this),this._F=N,this._X=G,this._Y=z,this._Z=q,this._F!==null?(this._X=function(ne,se){return this._F(ne,se)[0]},this._Y=function(ne,se){return this._F(ne,se)[1]},this._Z=function(ne,se){return this._F(ne,se)[2]}):this._X!==null&&(this._F=function(ne,se){return[this._X(ne,se),this._Y(ne,se),this._Z(ne,se)]}),this.range_u=Y,this.range_v=W,this.dataX=null,this.dataY=null,this.dataZ=null,this.points=[],this.methodMap=JXG$1.deepCopy(this.methodMap,{})};JXG$1.Surface3D.prototype=new JXG$1.GeometryElement;JXG$1.copyPrototypeMethods(JXG$1.Surface3D,JXG$1.GeometryElement3D,"constructor3D");JXG$1.extend(JXG$1.Surface3D.prototype,{updateWireframe:function(){var v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve=[1,0,0,0];for(this.points=[],v=this.evalVisProp("stepsu"),N=this.evalVisProp("stepsv"),q=JXG$1.evaluate(this.range_u),Y=JXG$1.evaluate(this.range_v),W=JXG$1.evaluate(q[0]),ie=JXG$1.evaluate(Y[0]),ne=JXG$1.evaluate(q[1]),se=JXG$1.evaluate(Y[1]),ae=(ne-W)/v,ce=(se-ie)/N,G=0,pe=W;G<=v;G++,pe+=ae)for(this.points.push([]),z=0,ge=ie;z<=N;z++,ge+=ce)ve=this.F(pe,ge),ve.unshift(1),this.points[G].push(ve);return this},updateCoords:function(){return this._F!==null?this.updateWireframe():this.updateTransform(),this},evalF:function(v,N){var G,z,q=[0,0,0,0];if(this.transformations.length===0||!JXG$1.exists(this.baseElement))return q=this._F(v,N),q;for(G=this.transformations,z=0;z<G.length;z++)G[z].update();for(this===this.baseElement?q=this._F(v,N):q=this.baseElement.evalF(v,N),q.unshift(1),q=Mat.matVecMult(G[0].matrix,q),z=1;z<G.length;z++)q=Mat.matVecMult(G[z].matrix,q);return q.slice(1)},F:function(v,N){return this.evalF(v,N)},X:function(v,N){return this.evalF(v,N)[0]},Y:function(v,N){return this.evalF(v,N)[1]},Z:function(v,N){return this.evalF(v,N)[2]},updateDataArray2D:function(){var v,N,G,z,q=[],Y=[],W;if(G=this.points.length,G!==0){for(z=this.points[0].length,v=0;v<G;v++){for(N=0;N<z;N++)W=this.view.project3DTo2D(this.points[v][N]),q.push(W[1]),Y.push(W[2]);q.push(NaN),Y.push(NaN)}for(N=0;N<z;N++){for(v=0;v<G;v++)W=this.view.project3DTo2D(this.points[v][N]),q.push(W[1]),Y.push(W[2]);q.push(NaN),Y.push(NaN)}}return{X:q,Y}},addTransform:function(v,N){return this.addTransformGeneric(v,N),this},updateTransform:function(){var v,N,G,z,q,Y,W;if(this.transformations.length===0||this.baseElement===null||JXG$1.exists(this._F))return this;for(v=this.transformations,G=0;G<v.length;G++)v[G].update();if(this!==this.baseElement&&(this.points=[]),Y=this.baseElement.points.length,Y>0)for(W=this.baseElement.points[0].length,G=0;G<Y;G++)for(this!==this.baseElement&&this.points.push([]),z=0;z<W;z++){for(this===this.baseElement?N=this.points[G][z]:N=this.baseElement.points[G][z],q=0;q<v.length;q++)N=Mat.matVecMult(v[q].matrix,N);this===this.baseElement?this.points[G][z]=N:this.points[G].push(N)}return this},updateDataArray:function(){},update:function(){return this.needsUpdate&&(this.updateDataArray(),this.updateCoords()),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(v,N){return Geometry.projectCoordsToParametric(v,this,2,N)}});JXG$1.createParametricSurface3D=function(v,N,G){var z=N[0],q,Y,W,ie,ne,se,ae,ce=null,pe=null,ge;return N.length===3?(ce=N[1],pe=N[2],q=null,Y=null,W=null,ie=null):N.length===4?(q=N[1],ne=N[2],se=N[3],Y=null,W=null,ie=null):(Y=N[1],W=N[2],ie=N[3],ne=N[4],se=N[5],q=null),ae=JXG$1.copyAttributes(G,v.options,"surface3d"),ge=new JXG$1.Surface3D(z,q,Y,W,ie,ne,se,ae),ae=ge.setAttr2D(ae),ge.element2D=z.create("curve",[[],[]],ae),ge.element2D.view=z,ce!==null&&(ge.addTransform(ce,pe),ge.addParents(ce)),ge.element2D.updateDataArray=function(){var ve=ge.updateDataArray2D();this.dataX=ve.X,this.dataY=ve.Y},ge.addChild(ge.element2D),ge.inherits.push(ge.element2D),ge.element2D.setParents(ge),ge.element2D.prepareUpdate().update(),v.
217isSuspendedUpdate||ge.element2D.updateVisibility().updateRenderer(),ge};JXG$1.registerElement("parametricsurface3d",JXG$1.createParametricSurface3D);JXG$1.createFunctiongraph3D=function(v,N,G){var z=N[0],q=function(ae,ce){return ae},Y=function(ae,ce){return ce},W=JXG$1.createFunction(N[1],v,"x, y"),ie=N[2],ne=N[3],se;return se=z.create("parametricsurface3d",[q,Y,W,ie,ne],G),se.elType="functiongraph3d",se};JXG$1.registerElement("functiongraph3d",JXG$1.createFunctiongraph3D);let size=.75,color="#000";JXG$1.themes.mono_thin={board:{showInfobox:!1,showCopyright:!0,defaultAxes:{x:{ticks:{minorTicks:0,majorHeight:10,majorTickEndings:[1,0]}},y:{ticks:{minorTicks:0,majorHeight:10,majorTickEndings:[0,1]}}}},navbar:{strokeColor:"#bbb",fillColor:"none"},elements:{strokeColor:color,highlightStrokeColor:color,fillColor:"none",highlightFillColor:"none",strokeOpacity:.6,highlightStrokeOpacity:1},angle:{strokeColor:color,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3,label:{strokeColor:color}},arc:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size},axis:{},boxplot:{strokeWidth:size,strokeColor:color,fillColor:color,fillOpacity:.2,highlightStrokeWidth:size,highlightStrokeColor:color,highlightFillColor:color,highlightFillOpacity:.1},circle:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightFillColor:"none",highlightStrokeColor:color,center:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},point2:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},circumcircle:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightFillColor:"none",highlightStrokeColor:color,center:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},circumcirclearc:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size},circumcirclesector:{strokeColor:color,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},comb:{strokeColor:color,strokeWidth:size},conic:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightStrokeColor:color,fillColor:"none",highlightFillColor:"none"},curve:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size},grid:{strokeWidth:size},hatch:{strokeColor:color,strokeWidth:size},incircle:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightFillColor:"none",highlightStrokeColor:color,center:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},inequality:{fillColor:"#aaaaaa55",fillOpacity:.2},integral:{fillColor:"#aaaaaa55",highlightFillColor:"#aaaaa33",fillOpacity:.3,highlightFillOpacity:.3,curveLeft:{color},baseLeft:{color},curveRight:{color},baseRight:{color}},label:{strokeColor:color},line:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size,point1:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},point2:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},normal:{strokeColor:color},parallel:{strokeColor:color},perpendicular:{strokeColor:color},perpendicularsegment:{strokeColor:color},point:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},polygon:{fillColor:"#aaaaaa55",highlightFillColor:"#aaaaaa33",fillOpacity:.3,highlightFillOpacity:.3,vertices:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},borders:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size}},sector:{strokeColor:color,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},semicircle:{center:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},slider:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color,baseline:{strokeWidth:size,strokeColor:color,highlightStrokeColor:color},label:{strokeColor:color},highline:{strokeWidth:3*size,name:"",strokeColor:color,highlightStrokeColor:color},ticks:{strokeColor:color}},slopefield:{strokeWidth:.75*size,highlightStrokeWidth:size,highlightStrokeColor:color,highlightStrokeOpacity:.8},tapemeasure:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size,point1:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},point2:{size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},ticks:{strokeWidth:size}},text:{strokeColor:color},tracecurve:{strokeColor:color},turtle:{strokeWidth:size,strokeColor:color,arrow:{strokeWidth:2*size,strokeColor:"#aaaaaa55"}},vectorfield:{strokeWidth:.75*size,highlightStrokeWidth:size,highlightStrokeColor:color,highlightStrokeOpacity:.8}};JXG$1.COORDS_BY_SCREEN;JXG$1.COORDS_BY_USER;JXG$1.Dump;JXG$1.Expect;JXG$1.JSXGraph;JXG$1.Math;JXG$1.Options;JXG$1.boards;JXG$1.elements;JXG$1.palette;JXG$1.paletteWong;JXG$1.Board;JXG$1.Chart;JXG$1.Circle;JXG$1.Complex;JXG$1.Composition;JXG$1.Coords;JXG$1.CoordsElement;JXG$1.Curve;JXG$1.GeometryElement;JXG$1.Group;JXG$1.Image;JXG$1.JessieCode;JXG$1.PrefixParser;JXG$1.Line;JXG$1.Point;JXG$1.Polygon;JXG$1.Text;JXG$1.Ticks;JXG$1.Transformation;JXG$1.Turtle;JXG$1.View3D;JXG$1.LMS2rgb;JXG$1.addEvent;JXG$1.autoDigits;JXG$1.autoHighlight;JXG$1.bind;JXG$1.capitalize;JXG$1.clearVisPropOld;JXG$1.clone;JXG$1.cloneAndCopy;JXG$1.cmpArrays;JXG$1.coordsArrayToMatrix;JXG$1.copyAttributes;JXG$1.createEvalFunction;JXG$1.createFunction;JXG$1.createHTMLSlider;JXG$1.darkenColor;JXG$1.debug;JXG$1.debugInt;JXG$1.debugLine;JXG$1.debugWST;JXG$1.deepCopy;JXG$1.def;JXG$1.deprecated;JXG$1.eliminateDuplicates;JXG$1.escapeHTML;JXG$1.evalSlider;JXG$1.evaluate;JXG$1.filterElements;JXG$1.getBoardByContainerId;JXG$1.getCSSTransformMatrix;JXG$1.getCSSTransform;JXG$1.getDimensions;JXG$1.getOffset;JXG$1.getPosition;JXG$1.getProp;JXG$1.hex2rgb;JXG$1.hsv2rgb;JXG$1.isAndroid;JXG$1.isApple;JXG$1.isArray;JXG$1.isDesktop;JXG$1.isInArray;JXG$1.isInObject;JXG$1.isMetroApp;JXG$1.isMobile;JXG$1.isMozilla;JXG$1.isBoard;JXG$1.isName;JXG$1.isNode;JXG$1.isNumber;JXG$1.isObject;JXG$1.isPoint;JXG$1.isPoint3D;JXG$1.isPointType;JXG$1.isPointType3D;JXG$1.isString;JXG$1.isTouchDevice;JXG$1.isTransformationOrArray;JXG$1.isWebWorker;JXG$1.isWebkitAndroid;JXG$1.isWebkitApple;JXG$1.keys;JXG$1.lightenColor;JXG$1.merge;JXG$1.normalizePointFace;JXG$1.providePoints;JXG$1.registerElement;JXG$1.registerReader;JXG$1.removeAllEvents;JXG$1.removeElementFromArray;JXG$1.removeEvent;JXG$1.rgb2LMS;JXG$1.rgb2bw;JXG$1.rgb2cb;JXG$1.rgb2css;JXG$1.rgb2hex;JXG$1.rgb2hsv;JXG$1.rgbParser;JXG$1.rgba2rgbo;JXG$1.rgbo2rgba;
217JXG$1.sanitizeHTML;JXG$1.shortcut;JXG$1.str2Bool;JXG$1.supportsCanvas;JXG$1.supportsPointerEvents;JXG$1.supportsSVG;JXG$1.supportsVML;JXG$1.swap;JXG$1.timedChunk;JXG$1.toFixed;JXG$1.toFullscreen;JXG$1.toJSON;JXG$1.trim;JXG$1.trimNumber;JXG$1.truncate;JXG$1.unescapeHTML;JXG$1.uniqueArray;JXG$1.useBlackWhiteOptions;JXG$1.useStandardOptions;JXG$1.warn;JXG$1.isBrowser?window.JXG=JXG$1:JXG$1.isWebWorker()&&(self.JXG=JXG$1);function decodeFromImportLink(v){if(!v)return null;try{let N=v.replace(/-/g,"+").replace(/_/g,"/");for(;N.length%4;)N+="=";const G=typeof atob<"u"?atob(N):Buffer.from(N,"base64").toString("utf-8"),z=JSON.parse(G);if(!z||typeof z!="object"||!Array.isArray(z.functions)||!z.graphSettings||typeof z.graphSettings!="object")return null;if(z.graphSettings.defaultView){(!Array.isArray(z.graphSettings.defaultView)||z.graphSettings.defaultView.length!==4)&&(console.warn("Invalid defaultView format, using defaults"),z.graphSettings.defaultView=[-10,10,10,-10]);const[q,Y,W,ie]=z.graphSettings.defaultView;(!isFinite(q)||!isFinite(Y)||!isFinite(ie)||!isFinite(W))&&(console.warn("Invalid defaultView values, using defaults"),z.graphSettings.defaultView=[-10,10,10,-10])}return z}catch(N){return console.error("Error decoding import link:",N),null}}function getHashParameter(v){const N=window.location.hash.substring(1);return new URLSearchParams(N).get(v)}function encodeToImportLink(v){try{if(!v||typeof v!="object")throw new Error("Data must be an object");const N=JSON.stringify(v);return(typeof btoa<"u"?btoa(N):Buffer.from(N,"utf-8").toString("base64")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}catch(N){return console.error("Error encoding data to import link:",N),null}}const version$2="15.0.4",createExtendedExponentialRampToValueAutomationEvent=(v,N,G)=>({endTime:N,insertTime:G,type:"exponentialRampToValue",value:v}),createExtendedLinearRampToValueAutomationEvent=(v,N,G)=>({endTime:N,insertTime:G,type:"linearRampToValue",value:v}),createSetValueAutomationEvent=(v,N)=>({startTime:N,type:"setValue",value:v}),createSetValueCurveAutomationEvent=(v,N,G)=>({duration:G,startTime:N,type:"setValueCurve",values:v}),getTargetValueAtTime=(v,N,{startTime:G,target:z,timeConstant:q})=>z+(N-z)*Math.exp((G-v)/q),isExponentialRampToValueAutomationEvent=v=>v.type==="exponentialRampToValue",isLinearRampToValueAutomationEvent=v=>v.type==="linearRampToValue",isAnyRampToValueAutomationEvent=v=>isExponentialRampToValueAutomationEvent(v)||isLinearRampToValueAutomationEvent(v),isSetValueAutomationEvent=v=>v.type==="setValue",isSetValueCurveAutomationEvent=v=>v.type==="setValueCurve",getValueOfAutomationEventAtIndexAtTime=(v,N,G,z)=>{const q=v[N];return q===void 0?z:isAnyRampToValueAutomationEvent(q)||isSetValueAutomationEvent(q)?q.value:isSetValueCurveAutomationEvent(q)?q.values[q.values.length-1]:getTargetValueAtTime(G,getValueOfAutomationEventAtIndexAtTime(v,N-1,q.startTime,z),q)},getEndTimeAndValueOfPreviousAutomationEvent=(v,N,G,z,q)=>G===void 0?[z.insertTime,q]:isAnyRampToValueAutomationEvent(G)?[G.endTime,G.value]:isSetValueAutomationEvent(G)?[G.startTime,G.value]:isSetValueCurveAutomationEvent(G)?[G.startTime+G.duration,G.values[G.values.length-1]]:[G.startTime,getValueOfAutomationEventAtIndexAtTime(v,N-1,G.startTime,q)],isCancelAndHoldAutomationEvent=v=>v.type==="cancelAndHold",isCancelScheduledValuesAutomationEvent=v=>v.type==="cancelScheduledValues",getEventTime=v=>isCancelAndHoldAutomationEvent(v)||isCancelScheduledValuesAutomationEvent(v)?v.cancelTime:isExponentialRampToValueAutomationEvent(v)||isLinearRampToValueAutomationEvent(v)?v.endTime:v.startTime,getExponentialRampValueAtTime=(v,N,G,{endTime:z,value:q})=>G===q?q:0<G&&0<q||G<0&&q<0?G*(q/G)**((v-N)/(z-N)):0,getLinearRampValueAtTime=(v,N,G,{endTime:z,value:q})=>G+(v-N)/(z-N)*(q-G),interpolateValue=(v,N)=>{const G=Math.floor(N),z=Math.ceil(N);return G===z?v[G]:(1-(N-G))*v[G]+(1-(z-N))*v[z]},getValueCurveValueAtTime=(v,{duration:N,startTime:G,values:z})=>{const q=(v-G)/N*(z.length-1);return interpolateValue(z,q)},isSetTargetAutomationEvent=v=>v.type==="setTarget";class AutomationEventList{constructor(N){this._automationEvents=[],this._currenTime=0,this._defaultValue=N}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}
vendor: 42,880 bytes, lines 217-219
217add(N){const G=getEventTime(N);if(isCancelAndHoldAutomationEvent(N)||isCancelScheduledValuesAutomationEvent(N)){const z=this._automationEvents.findIndex(Y=>isCancelScheduledValuesAutomationEvent(N)&&isSetValueCurveAutomationEvent(Y)?Y.startTime+Y.duration>=G:getEventTime(Y)>=G),q=this._automationEvents[z];if(z!==-1&&(this._automationEvents=this._automationEvents.slice(0,z)),isCancelAndHoldAutomationEvent(N)){const Y=this._automationEvents[this._automationEvents.length-1];if(q!==void 0&&isAnyRampToValueAutomationEvent(q)){if(Y!==void 0&&isSetTargetAutomationEvent(Y))throw new Error("The internal list is malformed.");const W=Y===void 0?q.insertTime:isSetValueCurveAutomationEvent(Y)?Y.startTime+Y.duration:getEventTime(Y),ie=Y===void 0?this._defaultValue:isSetValueCurveAutomationEvent(Y)?Y.values[Y.values.length-1]:Y.value,ne=isExponentialRampToValueAutomationEvent(q)?getExponentialRampValueAtTime(G,W,ie,q):getLinearRampValueAtTime(G,W,ie,q),se=isExponentialRampToValueAutomationEvent(q)?createExtendedExponentialRampToValueAutomationEvent(ne,G,this._currenTime):createExtendedLinearRampToValueAutomationEvent(ne,G,this._currenTime);this._automationEvents.push(se)}if(Y!==void 0&&isSetTargetAutomationEvent(Y)&&this._automationEvents.push(createSetValueAutomationEvent(this.getValue(G),G)),Y!==void 0&&isSetValueCurveAutomationEvent(Y)&&Y.startTime+Y.duration>G){const W=G-Y.startTime,ie=(Y.values.length-1)/Y.duration,ne=Math.max(2,1+Math.ceil(W*ie)),se=W/(ne-1)*ie,ae=Y.values.slice(0,ne);if(se<1)for(let ce=1;ce<ne;ce+=1){const pe=se*ce%1;ae[ce]=Y.values[ce-1]*(1-pe)+Y.values[ce]*pe}this._automationEvents[this._automationEvents.length-1]=createSetValueCurveAutomationEvent(ae,Y.startTime,W)}}}else{const z=this._automationEvents.findIndex(W=>getEventTime(W)>G),q=z===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[z-1];if(q!==void 0&&isSetValueCurveAutomationEvent(q)&&getEventTime(q)+q.duration>G)return!1;const Y=isExponentialRampToValueAutomationEvent(N)?createExtendedExponentialRampToValueAutomationEvent(N.value,N.endTime,this._currenTime):isLinearRampToValueAutomationEvent(N)?createExtendedLinearRampToValueAutomationEvent(N.value,G,this._currenTime):N;if(z===-1)this._automationEvents.push(Y);else{if(isSetValueCurveAutomationEvent(N)&&G+N.duration>getEventTime(this._automationEvents[z]))return!1;this._automationEvents.splice(z,0,Y)}}return!0}flush(N){const G=this._automationEvents.findIndex(z=>getEventTime(z)>N);if(G>1){const z=this._automationEvents.slice(G-1),q=z[0];isSetTargetAutomationEvent(q)&&z.unshift(createSetValueAutomationEvent(getValueOfAutomationEventAtIndexAtTime(this._automationEvents,G-2,q.startTime,this._defaultValue),q.startTime)),this._automationEvents=z}}getValue(N){if(this._automationEvents.length===0)return this._defaultValue;const G=this._automationEvents.findIndex(W=>getEventTime(W)>N),z=this._automationEvents[G],q=(G===-1?this._automationEvents.length:G)-1,Y=this._automationEvents[q];if(Y!==void 0&&isSetTargetAutomationEvent(Y)&&(z===void 0||!isAnyRampToValueAutomationEvent(z)||z.insertTime>N))return getTargetValueAtTime(N,getValueOfAutomationEventAtIndexAtTime(this._automationEvents,q-1,Y.startTime,this._defaultValue),Y);if(Y!==void 0&&isSetValueAutomationEvent(Y)&&(z===void 0||!isAnyRampToValueAutomationEvent(z)))return Y.value;if(Y!==void 0&&isSetValueCurveAutomationEvent(Y)&&(z===void 0||!isAnyRampToValueAutomationEvent(z)||Y.startTime+Y.duration>N))return N<Y.startTime+Y.duration?getValueCurveValueAtTime(N,Y):Y.values[Y.values.length-1];if(Y!==void 0&&isAnyRampToValueAutomationEvent(Y)&&(z===void 0||!isAnyRampToValueAutomationEvent(z)))return Y.value;if(z!==void 0&&isExponentialRampToValueAutomationEvent(z)){const[W,ie]=getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents,q,Y,z,this._defaultValue);return getExponentialRampValueAtTime(N,W,ie,z)}if(z!==void 0&&isLinearRampToValueAutomationEvent(z)){const[W,ie]=getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents,q,Y,z,this._defaultValue);return getLinearRampValueAtTime(N,W,ie,z)}return this._defaultValue}}const createCancelAndHoldAutomationEvent=v=>({cancelTime:v,type:"cancelAndHold"}),createCancelScheduledValuesAutomationEvent=v=>({cancelTime:v,type:"cancelScheduledValues"}),createExponentialRampToValueAutomationEvent=(v,N)=>({endTime:N,type:"exponentialRampToValue",value:v}),createLinearRampToValueAutomationEvent=(v,N)=>({endTime:N,type:"linearRampToValue",value:v}),createSetTargetAutomationEvent=(v,N,G)=>({startTime:N,target:v,timeConstant:G,type:"setTarget"}),createAbortError=()=>new DOMException("","AbortError"),createAddActiveInputConnectionToAudioNode=v=>(N,G,[z,q,Y],W)=>{v(N[q],[G,z,Y],ie=>ie[0]===G&&ie[1]===z,W)},createAddAudioNodeConnections=v=>(N,G,z)=>{const q=[];for(let Y=0;Y<z.numberOfInputs;Y+=1)q.push(new Set);v.set(N,{activeInputs:q,outputs:new Set,passiveInputs:new WeakMap,renderer:G})},createAddAudioParamConnections=v=>(N,G)=>{v.set(N,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:G})},ACTIVE_AUDIO_NODE_STORE=new WeakSet,AUDIO_NODE_CONNECTIONS_STORE=new WeakMap,AUDIO_NODE_STORE=new WeakMap,AUDIO_PARAM_CONNECTIONS_STORE=new WeakMap,AUDIO_PARAM_STORE=new WeakMap,CONTEXT_STORE=new WeakMap,EVENT_LISTENERS=new WeakMap,CYCLE_COUNTERS=new WeakMap,NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS=new WeakMap,NODE_TO_PROCESSOR_MAPS=new WeakMap,handler={construct(){return handler}},isConstructible=v=>{try{const N=new Proxy(v,handler);new N}catch{return!1}return!0},IMPORT_STATEMENT_REGEX=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,splitImportStatements=(v,N)=>{const G=[];let z=v.replace(/^[\s]+/,""),q=z.match(IMPORT_STATEMENT_REGEX);for(;q!==null;){const Y=q[1].slice(1,-1),W=q[0].replace(/([\s]+)?;?$/,"").replace(Y,new URL(Y,N).toString());G.push(W),z=z.slice(q[0].length).replace(/^[\s]+/,""),q=z.match(IMPORT_STATEMENT_REGEX)}return[G.join(";"),z]},verifyParameterDescriptors=v=>{if(v!==void 0&&!Array.isArray(v))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},verifyProcessorCtor=v=>{if(!isConstructible(v))throw new TypeError("The given value for processorCtor should be a constructor.");if(v.prototype===null||typeof v.prototype!="object")throw new TypeError("The given value for processorCtor should have a prototype.")},createAddAudioWorkletModule=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe)=>{let ge=0;return(ve,be,Ee={credentials:"omit"})=>{const Pe=ae.get(ve);if(Pe!==void 0&&Pe.has(be))return Promise.resolve();const Je=se.get(ve);if(Je!==void 0){const Re=Je.get(be);if(Re!==void 0)return Re}const Ce=Y(ve),Ve=Ce.audioWorklet===void 0?q(be).then(([Re,qe])=>{const[et,Ze]=splitImportStatements(Re,qe),tt=`${et};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${Ze}
218})})(window,'_AWGS')`;return G(tt)}).then(()=>{const Re=pe._AWGS.pop();if(Re===void 0)throw new SyntaxError;z(Ce.currentTime,Ce.sampleRate,()=>Re(class{},void 0,(qe,et)=>{if(qe.trim()==="")throw N();const Ze=NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.get(Ce);if(Ze!==void 0){if(Ze.has(qe))throw N();verifyProcessorCtor(et),verifyParameterDescriptors(et.parameterDescriptors),Ze.set(qe,et)}else verifyProcessorCtor(et),verifyParameterDescriptors(et.parameterDescriptors),NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.set(Ce,new Map([[qe,et]]))},Ce.sampleRate,void 0,void 0))}):Promise.all([q(be),Promise.resolve(v(ce,ce))]).then(([[Re,qe],et])=>{const Ze=ge+1;ge=Ze;const[tt,Ke]=splitImportStatements(Re,qe),ut=`${tt};((AudioWorkletProcessor,registerProcessor)=>{${Ke}
219})(${et?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${et?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${et?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${Ze}',class extends AudioWorkletProcessor{process(){return !1}})`,ct=new Blob([ut],{type:"application/javascript; charset=utf-8"}),at=URL.createObjectURL(ct);return Ce.audioWorklet.addModule(at,Ee).then(()=>{if(ie(Ce))return Ce;const st=W(Ce);return st.audioWorklet.addModule(at,Ee).then(()=>st)}).then(st=>{if(ne===null)throw new SyntaxError;try{new ne(st,`__sac${Ze}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(at))});return Je===void 0?se.set(ve,new Map([[be,Ve]])):Je.set(be,Ve),Ve.then(()=>{const Re=ae.get(ve);Re===void 0?ae.set(ve,new Set([be])):Re.add(be)}).finally(()=>{const Re=se.get(ve);Re!==void 0&&Re.delete(be)}),Ve}},getValueForKey=(v,N)=>{const G=v.get(N);if(G===void 0)throw new Error("A value with the given key could not be found.");return G},pickElementFromSet=(v,N)=>{const G=Array.from(v).filter(N);if(G.length>1)throw Error("More than one element was found.");if(G.length===0)throw Error("No element was found.");const[z]=G;return v.delete(z),z},deletePassiveInputConnectionToAudioNode=(v,N,G,z)=>{const q=getValueForKey(v,N),Y=pickElementFromSet(q,W=>W[0]===G&&W[1]===z);return q.size===0&&v.delete(N),Y},getEventListenersOfAudioNode=v=>getValueForKey(EVENT_LISTENERS,v),setInternalStateToActive=v=>{if(ACTIVE_AUDIO_NODE_STORE.has(v))throw new Error("The AudioNode is already stored.");ACTIVE_AUDIO_NODE_STORE.add(v),getEventListenersOfAudioNode(v).forEach(N=>N(!0))},isAudioWorkletNode=v=>"port"in v,setInternalStateToPassive=v=>{if(!ACTIVE_AUDIO_NODE_STORE.has(v))throw new Error("The AudioNode is not stored.");ACTIVE_AUDIO_NODE_STORE.delete(v),getEventListenersOfAudioNode(v).forEach(N=>N(!1))},setInternalStateToPassiveWhenNecessary=(v,N)=>{!isAudioWorkletNode(v)&&N.every(G=>G.size===0)&&setInternalStateToPassive(v)},createAddConnectionToAudioNode=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe)=>{const ge=new WeakMap;return(ve,be,Ee,Pe,Je)=>{const{activeInputs:Ce,passiveInputs:Ve}=Y(be),{outputs:Re}=Y(ve),qe=ie(ve),et=Ze=>{const tt=ne(be),Ke=ne(ve);if(Ze){const rt=deletePassiveInputConnectionToAudioNode(Ve,ve,Ee,Pe);v(Ce,ve,rt,!1),!Je&&!ce(ve)&&G(Ke,tt,Ee,Pe),pe(be)&&setInternalStateToActive(be)}else{const rt=z(Ce,ve,Ee,Pe);N(Ve,Pe,rt,!1),!Je&&!ce(ve)&&q(Ke,tt,Ee,Pe);const it=W(be);if(it===0)ae(be)&&setInternalStateToPassiveWhenNecessary(be,Ce);else{const ot=ge.get(be);ot!==void 0&&clearTimeout(ot),ge.set(be,setTimeout(()=>{ae(be)&&setInternalStateToPassiveWhenNecessary(be,Ce)},it*1e3))}}};return se(Re,[be,Ee,Pe],Ze=>Ze[0]===be&&Ze[1]===Ee&&Ze[2]===Pe,!0)?(qe.add(et),ae(ve)?v(Ce,ve,[Ee,Pe,et],!0):N(Ve,Pe,[ve,Ee,et],!0),!0):!1}},createAddPassiveInputConnectionToAudioNode=v=>(N,G,[z,q,Y],W)=>{const ie=N.get(z);ie===void 0?N.set(z,new Set([[q,G,Y]])):v(ie,[q,G,Y],ne=>ne[0]===q&&ne[1]===G,W)},createAddSilentConnection=v=>(N,G)=>{const z=v(N,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});G.connect(z).connect(N.destination);const q=()=>{G.removeEventListener("ended",q),G.disconnect(z),z.disconnect()};G.addEventListener("ended",q)},createAddUnrenderedAudioWorkletNode=v=>(N,G)=>{v(N).add(G)},DEFAULT_OPTIONS$j={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},createAnalyserNodeConstructor=(v,N,G,z,q,Y)=>class extends v{constructor(ie,ne){const se=q(ie),ae={...DEFAULT_OPTIONS$j,...ne},ce=z(se,ae),pe=Y(se)?N():null;super(ie,!1,ce,pe),this._nativeAnalyserNode=ce}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(ie){this._nativeAnalyserNode.fftSize=ie}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(ie){const ne=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=ie,!(ie>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=ne,G()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(ie){const ne=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=ie,!(this._nativeAnalyserNode.maxDecibels>ie))throw this._nativeAnalyserNode.minDecibels=ne,G()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(ie){this._nativeAnalyserNode.smoothingTimeConstant=ie}getByteFrequencyData(ie){this._nativeAnalyserNode.getByteFrequencyData(ie)}getByteTimeDomainData(ie){this._nativeAnalyserNode.getByteTimeDomainData(ie)}getFloatFrequencyData(ie){this._nativeAnalyserNode.getFloatFrequencyData(ie)}getFloatTimeDomainData(ie){this._nativeAnalyserNode.getFloatTimeDomainData(ie)}},isOwnedByContext=(v,N)=>v.context===N,createAnalyserNodeRendererFactory=(v,N,G)=>()=>{const z=new WeakMap,q=async(Y,W)=>{let ie=N(Y);if(!isOwnedByContext(ie,W)){const se={channelCount:ie.channelCount,channelCountMode:ie.channelCountMode,channelInterpretation:ie.channelInterpretation,fftSize:ie.fftSize,maxDecibels:ie.maxDecibels,minDecibels:ie.minDecibels,smoothingTimeConstant:ie.smoothingTimeConstant};ie=v(W,se)}return z.set(W,ie),await G(Y,W,ie),ie};return{render(Y,W){const ie=z.get(W);return ie!==void 0?Promise.resolve(ie):q(Y,W)}}},testAudioBufferCopyChannelMethodsOutOfBoundsSupport=v=>{try{v.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},createIndexSizeError=()=>new DOMException("","IndexSizeError"),wrapAudioBufferGetChannelDataMethod=v=>{v.getChannelData=(N=>G=>{try{return N.call(v,G)}catch(z){throw z.code===12?createIndexSizeError():z}})(v.getChannelData)},DEFAULT_OPTIONS$i={numberOfChannels:1},createAudioBufferConstructor=(v,N,G,z,q,Y,W,ie)=>{let ne=null;return class Qc{constructor(ae){if(q===null)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:ce,numberOfChannels:pe,sampleRate:ge}={...DEFAULT_OPTIONS$i,...ae};ne===null&&(ne=new q(1,1,44100));const ve=z!==null&&N(Y,Y)?new z({length:ce,numberOfChannels:pe,sampleRate:ge}):ne.createBuffer(pe,ce,ge);if(ve.numberOfChannels===0)throw G();return typeof ve.copyFromChannel!="function"?(W(ve),wrapAudioBufferGetChannelDataMethod(ve)):N(testAudioBufferCopyChannelMethodsOutOfBoundsSupport,()=>testAudioBufferCopyChannelMethodsOutOfBoundsSupport(ve))||ie(ve),v.add(ve),ve}static[Symbol.hasInstance](ae){return ae!==null&&typeof ae=="object"&&Object.getPrototypeOf(ae)===Qc.prototype||v.has(ae)}}},MOST_NEGATIVE_SINGLE_FLOAT=-34028234663852886e22,MOST_POSITIVE_SINGLE_FLOAT=34028234663852886e22,isActiveAudioNode=v=>ACTIVE_AUDIO_NODE_STORE.has(v),DEFAULT_OPTIONS$h={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},createAudioBufferSourceNodeConstructor=(v,N,G,z,q,Y,W,ie)=>class extends v{constructor(se,ae){const ce=Y(se),pe={...DEFAULT_OPTIONS$h,...ae},ge=q(ce,pe),ve=W(ce),be=ve?N():null;super(se,!1,ge,be),this._audioBufferSourceNodeRenderer=be,this._isBufferNullified=!1,this._isBufferSet=pe.buffer!==null,this._nativeAudioBufferSourceNode=ge,this._onended=null,this._playbackRate=G(this,ve,ge.playbackRate,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(se){if(this._nativeAudioBufferSourceNode.buffer=se,se!==null){if(this._isBufferSet)throw z();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(se){this._nativeAudioBufferSourceNode.loop=se}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(se){this._nativeAudioBufferSourceNode.loopEnd=se}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(se){this._nativeAudioBufferSourceNode.loopStart=se}get onended(){return this._onended}set onended(se){const ae=typeof se=="function"?ie(this,se):null;this._nativeAudioBufferSourceNode.onended=ae;const ce=this._nativeAudioBufferSourceNode.onended;this._onended=ce!==null&&ce===ae?se:ce}get playbackRate(){return this._playbackRate}start(se=0,ae=0,ce){if(this._nativeAudioBufferSourceNode.start(se,ae,ce),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=ce===void 0?[se,ae]:[se,ae,ce]),this.context.state!=="closed"){setInternalStateToActive(this);const pe=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",pe),isActiveAudioNode(this)&&setInternalStateToPassive(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",pe)}}stop(se=0){this._nativeAudioBufferSourceNode.stop(se),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=se)}},createAudioBufferSourceNodeRendererFactory=(v,N,G,z,q)=>()=>{const Y=new WeakMap;let W=null,ie=null;const ne=async(se,ae)=>{let ce=G(se);const pe=isOwnedByContext(ce,ae);if(!pe){const ge={buffer:ce.buffer,channelCount:ce.channelCount,channelCountMode:ce.channelCountMode,channelInterpretation:ce.channelInterpretation,loop:ce.loop,loopEnd:ce.loopEnd,loopStart:ce.loopStart,playbackRate:ce.playbackRate.value};ce=N(ae,ge),W!==null&&ce.start(...W),ie!==null&&ce.stop(ie)}return Y.set(ae,ce),pe?await v(ae,se.playbackRate,ce.playbackRate):await z(ae,se.playbackRate,ce.playbackRate),await q(se,ae,ce),ce};return{set start(se){W=se},set stop(se){ie=se},render(se,ae){const ce=Y.get(ae);return ce!==void 0?Promise.resolve(ce):ne(se,ae)}}},isAudioBufferSourceNode=v=>"playbackRate"in v,isBiquadFilterNode=v=>"frequency"in v&&"gain"in v,isConstantSourceNode=v=>"offset"in v,isGainNode=v=>!("frequency"in v)&&"gain"in v,isOscillatorNode=v=>"detune"in v&&"frequency"in v&&!("gain"in v),isStereoPannerNode=v=>"pan"in v,getAudioNodeConnections=v=>getValueForKey(AUDIO_NODE_CONNECTIONS_STORE,v),getAudioParamConnections=v=>getValueForKey(AUDIO_PARAM_CONNECTIONS_STORE,v),deactivateActiveAudioNodeInputConnections=(v,N)=>{const{activeInputs:G}=getAudioNodeConnections(v);G.forEach(q=>q.forEach(([Y])=>{N.includes(v)||deactivateActiveAudioNodeInputConnections(Y,[...N,v])}));const z=isAudioBufferSourceNode(v)?[v.playbackRate]:isAudioWorkletNode(v)?Array.from(v.parameters.values()):isBiquadFilterNode(v)?[v.Q,v.detune,v.frequency,v.gain]:isConstantSourceNode(v)?[v.offset]:isGainNode(v)?[v.gain]:isOscillatorNode(v)?[v.detune,v.frequency]:isStereoPannerNode(v)?[v.pan]:[];for(const q of z){const Y=getAudioParamConnections(q);Y!==void 0&&Y.activeInputs.forEach(([W])=>deactivateActiveAudioNodeInputConnections(W,N))}isActiveAudioNode(v)&&setInternalStateToPassive(v)},deactivateAudioGraph=v=>{deactivateActiveAudioNodeInputConnections(v.destination,[])},isValidLatencyHint=v=>v===void 0||typeof v=="number"||typeof v=="string"&&(v==="balanced"||v==="interactive"||v==="playback"),createAudioContextConstructor=(v,N,G,z,q,Y,W,ie,ne)=>class extends v{constructor(ae={}){if(ne===null)throw new Error("Missing the native AudioContext constructor.");let ce;try{ce=new ne(ae)}catch(ve){throw ve.code===12&&ve.message==="sampleRate is not in range"?G():ve}if(ce===null)throw z();if(!isValidLatencyHint(ae.latencyHint))throw new TypeError(`The provided value '${ae.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(ae.sampleRate!==void 0&&ce.sampleRate!==ae.sampleRate)throw G();super(ce,2);const{latencyHint:pe}=ae,{sampleRate:ge}=ce;if(this._baseLatency=typeof ce.baseLatency=="number"?ce.baseLatency:pe==="balanced"?512/ge:pe==="interactive"||pe===void 0?256/ge:pe==="playback"?1024/ge:Math.max(2,Math.min(128,Math.round(pe*ge/128)))*128/ge,this._nativeAudioContext=ce,ne.name==="webkitAudioContext"?(this._nativeGainNode=ce.createGain(),this._nativeOscillatorNode=ce.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(ce.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,ce.state==="running"){this._state="suspended";const ve=()=>{this._state==="suspended"&&(this._state=null),ce.removeEventListener("statechange",ve)};ce.addEventListener("statechange",ve)}}get baseLatency(){return this._baseLatency}get state(){return this._state!==null?this._state:this._nativeAudioContext.state}close(){return this.state==="closed"?this._nativeAudioContext.close().then(()=>{throw N()}):(this._state==="suspended"&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),deactivateAudioGraph(this)}))}createMediaElementSource(ae){return new q(this,{mediaElement:ae})}createMediaStreamDestination(){return new Y(this)}createMediaStreamSource(ae){return new W(this,{mediaStream:ae})}createMediaStreamTrackSource(ae){return new ie(this,{mediaStreamTrack:ae})}resume(){return this._state==="suspended"?new Promise((ae,ce)=>{const pe=()=>{this._nativeAudioContext.removeEventListener("statechange",pe),this._nativeAudioContext.state==="running"?ae():this.resume().then(ae,ce)};this._nativeAudioContext.addEventListener("statechange",pe)}):this._nativeAudioContext.resume().catch(ae=>{throw ae===void 0||ae.code===15?N():ae})}suspend(){return this._nativeAudioContext.suspend().catch(ae=>{throw ae===void 0?N():ae})}},createAudioDestinationNodeConstructor=(v,N,G,z,q,Y,W,ie)=>class extends v{constructor(se,ae){const ce=Y(se),pe=W(ce),ge=q(ce,ae,pe),ve=pe?N(ie):null;super(se,!1,ge,ve),this._isNodeOfNativeOfflineAudioContext=pe,this._nativeAudioDestinationNode=ge}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(se){if(this._isNodeOfNativeOfflineAudioContext)throw z();if(se>this._nativeAudioDestinationNode.maxChannelCount)throw G();this._nativeAudioDestinationNode.channelCount=se}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(se){if(this._isNodeOfNativeOfflineAudioContext)throw z();this._nativeAudioDestinationNode.channelCountMode=se}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}},createAudioDestinationNodeRenderer=v=>{const N=new WeakMap,G=async(z,q)=>{const Y=q.destination;return N.set(q,Y),await v(z,q,Y),Y};return{render(z,q){const Y=N.get(q);return Y!==void 0?Promise.resolve(Y):G(z,q)}}},createAudioListenerFactory=(v,N,G,z,q,Y,W,ie)=>(ne,se)=>{const ae=se.listener,ce=()=>{const Re=new Float32Array(1),qe=N(se,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),et=W(se);let Ze=!1,tt=[0,0,-1,0,1,0],Ke=[0,0,0];const rt=()=>{if(Ze)return;Ze=!0;const ct=z(se,256,9,0);ct.onaudioprocess=({inputBuffer:at})=>{const st=[Y(at,Re,0),Y(at,Re,1),Y(at,Re,2),Y(at,Re,3),Y(at,Re,4),Y(at,Re,5)];st.some((lt,vt)=>lt!==tt[vt])&&(ae.setOrientation(...st),tt=st);const pt=[Y(at,Re,6),Y(at,Re,7),Y(at,Re,8)];pt.some((lt,vt)=>lt!==Ke[vt])&&(ae.setPosition(...pt),Ke=pt)},qe.connect(ct)},it=ct=>at=>{at!==tt[ct]&&(tt[ct]=at,ae.setOrientation(...tt))},ot=ct=>at=>{at!==Ke[ct]&&(Ke[ct]=at,ae.setPosition(...Ke))},ut=(ct,at,st)=>{const pt=G(se,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:at});pt.connect(qe,0,ct),pt.start(),Object.defineProperty(pt.offset,"defaultValue",{get(){return at}});const lt=v({context:ne},et,pt.offset,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT);return ie(lt,"value",vt=>()=>vt.call(lt),vt=>dt=>{try{vt.call(lt,dt)}catch(xt){if(xt.code!==9)throw xt}rt(),et&&st(dt)}),lt.cancelAndHoldAtTime=(vt=>et?()=>{throw q()}:(...dt)=>{const xt=vt.apply(lt,dt);return rt(),xt})(lt.cancelAndHoldAtTime),lt.cancelScheduledValues=(vt=>et?()=>{throw q()}:(...dt)=>{const xt=vt.apply(lt,dt);return rt(),xt})(lt.cancelScheduledValues),lt.exponentialRampToValueAtTime=(vt=>et?()=>{throw q()}:(...dt)=>{const xt=vt.apply(lt,dt);return rt(),xt})(lt.exponentialRampToValueAtTime),lt.linearRampToValueAtTime=(vt=>et?()=>{throw q()}:(...dt)=>{const xt=vt.apply(lt,dt);return rt(),xt})(lt.linearRampToValueAtTime),lt.setTargetAtTime=(vt=>et?()=>{throw q()}:(...dt)=>{const xt=vt.apply(lt,dt);return rt(),xt})(lt.setTargetAtTime),lt.setValueAtTime=(vt=>et?()=>{throw q()}:(...dt)=>{const xt=vt.apply(lt,dt);return rt(),xt})(lt.setValueAtTime),lt.setValueCurveAtTime=(vt=>et?()=>{throw q()}:(...dt)=>{const xt=vt.apply(lt,dt);return rt(),xt})(lt.setValueCurveAtTime),lt};return{forwardX:ut(0,0,it(0)),forwardY:ut(1,0,it(1)),forwardZ:ut(2,-1,it(2)),positionX:ut(6,0,ot(0)),positionY:ut(7,0,ot(1)),positionZ:ut(8,0,ot(2)),upX:ut(3,0,it(3)),upY:ut(4,1,it(4)),upZ:ut(5,0,it(5))}},{forwardX:pe,forwardY:ge,forwardZ:ve,positionX:be,positionY:Ee,positionZ:Pe,upX:Je,upY:Ce,upZ:Ve}=ae.forwardX===void 0?ce():ae;return{get forwardX(){return pe},get forwardY(){return ge},get forwardZ(){return ve},get positionX(){return be},get positionY(){return Ee},get positionZ(){return Pe},get upX(){return Je},get upY(){return Ce},get upZ(){return Ve}}},isAudioNode$1=v=>"context"in v,isAudioNodeOutputConnection=v=>isAudioNode$1(v[0]),insertElementInSet=(v,N,G,z)=>{for(const q of v)if(G(q)){if(z)return!1;throw Error("The set contains at least one similar element.")}return v.add(N),!0},addActiveInputConnectionToAudioParam=(v,N,[G,z],q)=>{insertElementInSet(v,[N,G,z],Y=>Y[0]===N&&Y[1]===G,q)},addPassiveInputConnectionToAudioParam=(v,[N,G,z],q)=>{const Y=v.get(N);Y===void 0?v.set(N,new Set([[G,z]])):insertElementInSet(Y,[G,z],W=>W[0]===G,q)},isNativeAudioNodeFaker=v=>"inputs"in v,connectNativeAudioNodeToNativeAudioNode=(v,N,G,z)=>{if(isNativeAudioNodeFaker(N)){const q=N.inputs[z];return v.connect(q,G,0),[q,G,0]}return v.connect(N,G,z),[N,G,z]},deleteActiveInputConnection=(v,N,G)=>{for(const z of v)if(z[0]===N&&z[1]===G)return v.delete(z),z;return null},deleteActiveInputConnectionToAudioParam=(v,N,G)=>pickElementFromSet(v,z=>z[0]===N&&z[1]===G),deleteEventListenerOfAudioNode=(v,N)=>{if(!getEventListenersOfAudioNode(v).delete(N))throw new Error("Missing the expected event listener.")},deletePassiveInputConnectionToAudioParam=(v,N,G)=>{const z=getValueForKey(v,N),q=pickElementFromSet(z,Y=>Y[0]===G);return z.size===0&&v.delete(N),q},disconnectNativeAudioNodeFromNativeAudioNode=(v,N,G,z)=>{isNativeAudioNodeFaker(N)?v.disconnect(N.inputs[z],G,0):v.disconnect(N,G,z)},getNativeAudioNode=v=>getValueForKey(AUDIO_NODE_STORE,v),getNativeAudioParam=v=>getValueForKey(AUDIO_PARAM_STORE,v),isPartOfACycle=v=>CYCLE_COUNTERS.has(v),isPassiveAudioNode=v=>!ACTIVE_AUDIO_NODE_STORE.has(v),testAudioNodeDisconnectMethodSupport=(v,N)=>new Promise(G=>{if(N!==null)G(!0);else{const z=v.createScriptProcessor(256,1,1),q=v.createGain(),Y=v.createBuffer(1,2,44100),W=Y.getChannelData(0);W[0]=1,W[1]=1;const ie=v.createBufferSource();ie.buffer=Y,ie.loop=!0,ie.connect(z).connect(v.destination),ie.connect(q),ie.disconnect(q),z.onaudioprocess=ne=>{const se=ne.inputBuffer.getChannelData(0);Array.prototype.some.call(se,ae=>ae===1)?G(!0):G(!1),ie.stop(),z.onaudioprocess=null,ie.disconnect(z),z.disconnect(v.destination)},ie.start()}}),visitEachAudioNodeOnce=(v,N)=>{const G=new Map;for(const z of v)for(const q of z){const Y=G.get(q);G.set(q,Y===void 0?1:Y+1)}G.forEach((z,q)=>N(q,z))},isNativeAudioNode$1=v=>"context"in v,wrapAudioNodeDisconnectMethod=v=>{const N=new Map;v.connect=(G=>(z,q=0,Y=0)=>{const W=isNativeAudioNode$1(z)?G(z,q,Y):G(z,q),ie=N.get(z);return ie===void 0?N.set(z,[{input:Y,output:q}]):ie.every(ne=>ne.input!==Y||ne.output!==q)&&ie.push({input:Y,output:q}),W})(v.connect.bind(v)),v.disconnect=(G=>(z,q,Y)=>{if(G.apply(v),z===void 0)N.clear();else if(typeof z=="number")for(const[W,ie]of N){const ne=ie.filter(se=>se.output!==z);ne.length===0?N.delete(W):N.set(W,ne)}else if(N.has(z))if(q===void 0)N.delete(z);else{const W=N.get(z);if(W!==void 0){const ie=W.filter(ne=>ne.output!==q&&(ne.input!==Y||Y===void 0));ie.length===0?N.delete(z):N.set(z,ie)}}for(const[W,ie]of N)ie.forEach(ne=>{isNativeAudioNode$1(W)?v.connect(W,ne.output,ne.input):v.connect(W,ne.output)})})(v.disconnect)},addConnectionToAudioParamOfAudioContext=(v,N,G,z)=>{const{activeInputs:q,passiveInputs:Y}=getAudioParamConnections(N),{outputs:W}=getAudioNodeConnections(v),ie=getEventListenersOfAudioNode(v),ne=se=>{const ae=getNativeAudioNode(v),ce=getNativeAudioParam(N);if(se){const pe=deletePassiveInputConnectionToAudioParam(Y,v,G);addActiveInputConnectionToAudioParam(q,v,pe,!1),!z&&!isPartOfACycle(v)&&ae.connect(ce,G)}else{const pe=deleteActiveInputConnectionToAudioParam(q,v,G);addPassiveInputConnectionToAudioParam(Y,pe,!1),!z&&!isPartOfACycle(v)&&ae.disconnect(ce,G)}};return insertElementInSet(W,[N,G],se=>se[0]===N&&se[1]===G,!0)?(ie.add(ne),isActiveAudioNode(v)?addActiveInputConnectionToAudioParam(q,v,[G,ne],!0):addPassiveInputConnectionToAudioParam(Y,[v,G,ne],!0),!0):!1},deleteInputConnectionOfAudioNode=(v,N,G,z)=>{const{activeInputs:q,passiveInputs:Y}=getAudioNodeConnections(N),W=deleteActiveInputConnection(q[z],v,G);return W===null?[deletePassiveInputConnectionToAudioNode(Y,v,G,z)[2],!1]:[W[2],!0]},deleteInputConnectionOfAudioParam=(v,N,G)=>{const{activeInputs:z,passiveInputs:q}=getAudioParamConnections(N),Y=deleteActiveInputConnection(z,v,G);return Y===null?[deletePassiveInputConnectionToAudioParam(q,v,G)[1],!1]:[Y[2],!0]},deleteInputsOfAudioNode=(v,N,G,z,q)=>{const[Y,W]=deleteInputConnectionOfAudioNode(v,G,z,q);if(Y!==null&&(deleteEventListenerOfAudioNode(v,Y),W&&!N&&!isPartOfACycle(v)&&disconnectNativeAudioNodeFromNativeAudioNode(getNativeAudioNode(v),getNativeAudioNode(G),z,q)),isActiveAudioNode(G)){const{activeInputs:ie}=getAudioNodeConnections(G);setInternalStateToPassiveWhenNecessary(G,ie)}},deleteInputsOfAudioParam=(v,N,G,z)=>{const[q,Y]=deleteInputConnectionOfAudioParam(v,G,z);q!==null&&(deleteEventListenerOfAudioNode(v,q),Y&&!N&&!isPartOfACycle(v)&&getNativeAudioNode(v).disconnect(getNativeAudioParam(G),z))},deleteAnyConnection=(v,N)=>{const G=getAudioNodeConnections(v),z=[];for(const q of G.outputs)isAudioNodeOutputConnection(q)?deleteInputsOfAudioNode(v,N,...q):deleteInputsOfAudioParam(v,N,...q),z.push(q[0]);return G.outputs.clear(),z},deleteConnectionAtOutput=(v,N,G)=>{const z=getAudioNodeConnections(v),q=[];for(const Y of z.outputs)Y[1]===G&&(isAudioNodeOutputConnection(Y)?deleteInputsOfAudioNode(v,N,...Y):deleteInputsOfAudioParam(v,N,...Y),q.push(Y[0]),z.outputs.delete(Y));return q},deleteConnectionToDestination=(v,N,G,z,q)=>{const Y=getAudioNodeConnections(v);return Array.from(Y.outputs).filter(W=>W[0]===G&&(z===void 0||W[1]===z)&&(q===void 0||W[2]===q)).map(W=>(isAudioNodeOutputConnection(W)?deleteInputsOfAudioNode(v,N,...W):deleteInputsOfAudioParam(v,N,...W),Y.outputs.delete(W),W[0]))},createAudioNodeConstructor=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be)=>class extends se{constructor(Pe,Je,Ce,Ve){super(Ce),this._context=Pe,this._nativeAudioNode=Ce;const Re=ae(Pe);ce(Re)&&G(testAudioNodeDisconnectMethodSupport,()=>testAudioNodeDisconnectMethodSupport(Re,be))!==!0&&wrapAudioNodeDisconnectMethod(Ce),AUDIO_NODE_STORE.set(this,Ce),EVENT_LISTENERS.set(this,new Set),Pe.state!=="closed"&&Je&&setInternalStateToActive(this),v(this,Ve,Ce)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(Pe){this._nativeAudioNode.channelCount=Pe}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(Pe){this._nativeAudioNode.channelCountMode=Pe}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(Pe){this._nativeAudioNode.channelInterpretation=Pe}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(Pe,Je=0,Ce=0){if(Je<0||Je>=this._nativeAudioNode.numberOfOutputs)throw q();const Ve=ae(this._context),Re=ve(Ve);if(pe(Pe)||ge(Pe))throw Y();if(isAudioNode$1(Pe)){const Ze=getNativeAudioNode(Pe);try{const Ke=connectNativeAudioNodeToNativeAudioNode(this._nativeAudioNode,Ze,Je,Ce),rt=isPassiveAudioNode(this);(Re||rt)&&this._nativeAudioNode.disconnect(...Ke),this.context.state!=="closed"&&!rt&&isPassiveAudioNode(Pe)&&setInternalStateToActive(Pe)}catch(Ke){throw Ke.code===12?Y():Ke}if(N(this,Pe,Je,Ce,Re)){const Ke=ne([this],Pe);visitEachAudioNodeOnce(Ke,z(Re))}return Pe}const qe=getNativeAudioParam(Pe);if(qe.name==="playbackRate"&&qe.maxValue===1024)throw W();try{this._nativeAudioNode.connect(qe,Je),(Re||isPassiveAudioNode(this))&&this._nativeAudioNode.disconnect(qe,Je)}catch(Ze){throw Ze.code===12?Y():Ze}if(addConnectionToAudioParamOfAudioContext(this,Pe,Je,Re)){const Ze=ne([this],Pe);visitEachAudioNodeOnce(Ze,z(Re))}}disconnect(Pe,Je,Ce){let Ve;const Re=ae(this._context),qe=ve(Re);if(Pe===void 0)Ve=deleteAnyConnection(this,qe);else if(typeof Pe=="number"){if(Pe<0||Pe>=this.numberOfOutputs)throw q();Ve=deleteConnectionAtOutput(this,qe,Pe)}else{if(Je!==void 0&&(Je<0||Je>=this.numberOfOutputs)||isAudioNode$1(Pe)&&Ce!==void 0&&(Ce<0||Ce>=Pe.numberOfInputs))throw q();if(Ve=deleteConnectionToDestination(this,qe,Pe,Je,Ce),Ve.length===0)throw Y()}for(const et of Ve){const Ze=ne([this],et);visitEachAudioNodeOnce(Ze,ie)}}},createAudioParamFactory=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe)=>(ge,ve,be,Ee=null,Pe=null)=>{const Je=be.value,Ce=new AutomationEventList(Je),Ve=ve?z(Ce):null,Re={get defaultValue(){return Je},get maxValue(){return Ee===null?be.maxValue:Ee},get minValue(){return Pe===null?be.minValue:Pe},get value(){return be.value},set value(qe){be.value=qe,Re.setValueAtTime(qe,ge.context.currentTime)},cancelAndHoldAtTime(qe){if(typeof be.cancelAndHoldAtTime=="function")Ve===null&&Ce.flush(ge.context.currentTime),Ce.add(q(qe)),be.cancelAndHoldAtTime(qe);else{const et=Array.from(Ce).pop();Ve===null&&Ce.flush(ge.context.currentTime),Ce.add(q(qe));const Ze=Array.from(Ce).pop();be.cancelScheduledValues(qe),et!==Ze&&Ze!==void 0&&(Ze.type==="exponentialRampToValue"?be.exponentialRampToValueAtTime(Ze.value,Ze.endTime):Ze.type==="linearRampToValue"?be.linearRampToValueAtTime(Ze.value,Ze.endTime):Ze.type==="setValue"?be.setValueAtTime(Ze.value,Ze.startTime):Ze.type==="setValueCurve"&&be.setValueCurveAtTime(Ze.values,Ze.startTime,Ze.duration))}return Re},cancelScheduledValues(qe){return Ve===null&&Ce.flush(ge.context.currentTime),Ce.add(Y(qe)),be.cancelScheduledValues(qe),Re},exponentialRampToValueAtTime(qe,et){if(qe===0)throw new RangeError;if(!Number.isFinite(et)||et<0)throw new RangeError;const Ze=ge.context.currentTime;return Ve===null&&Ce.flush(Ze),Array.from(Ce).length===0&&(Ce.add(se(Je,Ze)),be.setValueAtTime(Je,Ze)),Ce.add(W(qe,et)),be.exponentialRampToValueAtTime(qe,et),Re},linearRampToValueAtTime(qe,et){const Ze=ge.context.currentTime;return Ve===null&&Ce.flush(Ze),Array.from(Ce).length===0&&(Ce.add(se(Je,Ze)),be.setValueAtTime(Je,Ze)),Ce.add(ie(qe,et)),be.linearRampToValueAtTime(qe,et),Re},setTargetAtTime(qe,et,Ze){return Ve===null&&Ce.flush(ge.context.currentTime),Ce.add(ne(qe,et,Ze)),be.setTargetAtTime(qe,et,Ze),Re},setValueAtTime(qe,et){return Ve===null&&Ce.flush(ge.context.currentTime),Ce.add(se(qe,et)),be.setValueAtTime(qe,et),Re},setValueCurveAtTime(qe,et,Ze){const tt=qe instanceof Float32Array?qe:new Float32Array(qe);if(ce!==null&&ce.name==="webkitAudioContext"){const Ke=et+Ze,rt=ge.context.sampleRate,it=Math.ceil(et*rt),ot=Math.floor(Ke*rt),ut=ot-it,ct=new Float32Array(ut);for(let st=0;st<ut;st+=1){const pt=(tt.length-1)/Ze*((it+st)/rt-et),lt=Math.floor(pt),vt=Math.ceil(pt);ct[st]=lt===vt?tt[lt]:(1-(pt-lt))*tt[lt]+(1-(vt-pt))*tt[vt]}Ve===null&&Ce.flush(ge.context.currentTime),Ce.add(ae(ct,et,Ze)),be.setValueCurveAtTime(ct,et,Ze);const at=ot/rt;at<Ke&&pe(Re,ct[ct.length-1],at),pe(Re,tt[tt.length-1],Ke)}else Ve===null&&Ce.flush(ge.context.currentTime),Ce.add(ae(tt,et,Ze)),be.setValueCurveAtTime(tt,et,Ze);return Re}};return G.set(Re,be),N.set(Re,ge),v(Re,Ve),Re},createAudioParamRenderer=v=>({replay(N){for(const G of v)if(G.type==="exponentialRampToValue"){const{endTime:z,value:q}=G;N.exponentialRampToValueAtTime(q,z)}else if(G.type==="linearRampToValue"){const{endTime:z,value:q}=G;N.linearRampToValueAtTime(q,z)}else if(G.type==="setTarget"){const{startTime:z,target:q,timeConstant:Y}=G;N.setTargetAtTime(q,z,Y)}else if(G.type==="setValue"){const{startTime:z,value:q}=G;N.setValueAtTime(q,z)}else if(G.type==="setValueCurve"){const{duration:z,startTime:q,values:Y}=G;N.setValueCurveAtTime(Y,q,z)}else throw new Error("Can't apply an unknown automation.")}});class ReadOnlyMap{constructor(N){this._map=new Map(N)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(N,G=null){return this._map.forEach((z,q)=>N.call(G,z,q,this))}get(N){return this._map.get(N)}has(N){return this._map.has(N)}keys(){return this._map.keys()}values(){return this._map.values()}}const DEFAULT_OPTIONS$g={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},createAudioWorkletNodeConstructor=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge)=>class extends N{constructor(be,Ee,Pe){var Je;const Ce=ie(be),Ve=ne(Ce),Re=ae({...DEFAULT_OPTIONS$g,...Pe});pe(Re);const qe=NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.get(Ce),et=qe==null?void 0:qe.get(Ee),Ze=Ve||Ce.state!=="closed"?Ce:(Je=W(Ce))!==null&&Je!==void 0?Je:Ce,tt=q(Ze,Ve?null:be.baseLatency,se,Ee,et,Re),Ke=Ve?z(Ee,Re,et):null;super(be,!0,tt,Ke);const rt=[];tt.parameters.forEach((ot,ut)=>{const ct=G(this,Ve,ot);rt.push([ut,ct])}),this._nativeAudioWorkletNode=tt,this._onprocessorerror=null,this._parameters=new ReadOnlyMap(rt),Ve&&v(Ce,this);const{activeInputs:it}=Y(this);ce(tt,it)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(be){const Ee=typeof be=="function"?ge(this,be):null;this._nativeAudioWorkletNode.onprocessorerror=Ee;const Pe=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=Pe!==null&&Pe===Ee?be:Pe}get parameters(){return this._parameters===null?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}};function copyFromChannel(v,N,G,z,q){if(typeof v.copyFromChannel=="function")N[G].byteLength===0&&(N[G]=new Float32Array(128)),v.copyFromChannel(N[G],z,q);else{const Y=v.getChannelData(z);if(N[G].byteLength===0)N[G]=Y.slice(q,q+128);else{const W=new Float32Array(Y.buffer,q*Float32Array.BYTES_PER_ELEMENT,128);N[G].set(W)}}}const copyToChannel=(v,N,G,z,q)=>{typeof v.copyToChannel=="function"?N[G].byteLength!==0&&v.copyToChannel(N[G],z,q):N[G].byteLength!==0&&v.getChannelData(z).set(N[G],q)},createNestedArrays=(v,N)=>{const G=[];for(let z=0;z<v;z+=1){const q=[],Y=typeof N=="number"?N:N[z];for(let W=0;W<Y;W+=1)q.push(new Float32Array(128));G.push(q)}return G},getAudioWorkletProcessor=(v,N)=>{const G=getValueForKey(NODE_TO_PROCESSOR_MAPS,v),z=getNativeAudioNode(N);return getValueForKey(G,z)},processBuffer=async(v,N,G,z,q,Y,W)=>{const ie=N===null?Math.ceil(v.context.length/128)*128:N.length,ne=z.channelCount*z.numberOfInputs,se=q.reduce((Ee,Pe)=>Ee+Pe,0),ae=se===0?null:G.createBuffer(se,ie,G.sampleRate);if(Y===void 0)throw new Error("Missing the processor constructor.");const ce=getAudioNodeConnections(v),pe=await getAudioWorkletProcessor(G,v),ge=createNestedArrays(z.numberOfInputs,z.channelCount),ve=createNestedArrays(z.numberOfOutputs,q),be=Array.from(v.parameters.keys()).reduce((Ee,Pe)=>({...Ee,[Pe]:new Float32Array(128)}),{});for(let Ee=0;Ee<ie;Ee+=128){if(z.numberOfInputs>0&&N!==null)for(let Pe=0;Pe<z.numberOfInputs;Pe+=1)for(let Je=0;Je<z.channelCount;Je+=1)copyFromChannel(N,ge[Pe],Je,Je,Ee);Y.parameterDescriptors!==void 0&&N!==null&&Y.parameterDescriptors.forEach(({name:Pe},Je)=>{copyFromChannel(N,be,Pe,ne+Je,Ee)});for(let Pe=0;Pe<z.numberOfInputs;Pe+=1)for(let Je=0;Je<q[Pe];Je+=1)ve[Pe][Je].byteLength===0&&(ve[Pe][Je]=new Float32Array(128));try{const Pe=ge.map((Ce,Ve)=>ce.activeInputs[Ve].size===0?[]:Ce),Je=W(Ee/G.sampleRate,G.sampleRate,()=>pe.process(Pe,ve,be));if(ae!==null)for(let Ce=0,Ve=0;Ce<z.numberOfOutputs;Ce+=1){for(let Re=0;Re<q[Ce];Re+=1)copyToChannel(ae,ve[Ce],Re,Ve+Re,Ee);Ve+=q[Ce]}if(!Je)break}catch(Pe){v.dispatchEvent(new ErrorEvent("processorerror",{colno:Pe.colno,filename:Pe.filename,lineno:Pe.lineno,message:Pe.message}));break}}return ae},createAudioWorkletNodeRendererFactory=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be)=>(Ee,Pe,Je)=>{const Ce=new WeakMap;let Ve=null;const Re=async(qe,et)=>{let Ze=ae(qe),tt=null;const Ke=isOwnedByContext(Ze,et),rt=Array.isArray(Pe.outputChannelCount)?Pe.outputChannelCount:Array.from(Pe.outputChannelCount);if(ce===null){const it=rt.reduce((at,st)=>at+st,0),ot=q(et,{channelCount:Math.max(1,it),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,it)}),ut=[];for(let at=0;at<qe.numberOfOutputs;at+=1)ut.push(z(et,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:rt[at]}));const ct=W(et,{channelCount:Pe.channelCount,channelCountMode:Pe.channelCountMode,channelInterpretation:Pe.channelInterpretation,gain:1});ct.connect=N.bind(null,ut),ct.disconnect=ne.bind(null,ut),tt=[ot,ut,ct]}else Ke||(Ze=new ce(et,Ee));if(Ce.set(et,tt===null?Ze:tt[2]),tt!==null){if(Ve===null){if(Je===void 0)throw new Error("Missing the processor constructor.");if(pe===null)throw new Error("Missing the native OfflineAudioContext constructor.");const st=qe.channelCount*qe.numberOfInputs,pt=Je.parameterDescriptors===void 0?0:Je.parameterDescriptors.length,lt=st+pt;Ve=processBuffer(qe,lt===0?null:await(async()=>{const dt=new pe(lt,Math.ceil(qe.context.length/128)*128,et.sampleRate),xt=[],ft=[];for(let Dt=0;Dt<Pe.numberOfInputs;Dt+=1)xt.push(W(dt,{channelCount:Pe.channelCount,channelCountMode:Pe.channelCountMode,channelInterpretation:Pe.channelInterpretation,gain:1})),ft.push(q(dt,{channelCount:Pe.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Pe.channelCount}));const Et=await Promise.all(Array.from(qe.parameters.values()).map(async Dt=>{const Gt=Y(dt,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:Dt.value});return await ge(dt,Dt,Gt.offset),Gt})),Ct=z(dt,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,st+pt)});for(let Dt=0;Dt<Pe.numberOfInputs;Dt+=1){xt[Dt].connect(ft[Dt]);for(let Gt=0;Gt<Pe.channelCount;Gt+=1)ft[Dt].connect(Ct,Gt,Dt*Pe.channelCount+Gt)}for(const[Dt,Gt]of Et.entries())Gt.connect(Ct,0,st+Dt),Gt.start(0);return Ct.connect(dt.destination),await Promise.all(xt.map(Dt=>ve(qe,dt,Dt))),be(dt)})(),et,Pe,rt,Je,se)}const it=await Ve,ot=G(et,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[ut,ct,at]=tt;
219it!==null&&(ot.buffer=it,ot.start(0)),ot.connect(ut);for(let st=0,pt=0;st<qe.numberOfOutputs;st+=1){const lt=ct[st];for(let vt=0;vt<rt[st];vt+=1)ut.connect(lt,pt+vt,vt);pt+=rt[st]}return at}if(Ke)for(const[it,ot]of qe.parameters.entries())await v(et,ot,Ze.parameters.get(it));else for(const[it,ot]of qe.parameters.entries())await ge(et,ot,Ze.parameters.get(it));return await ve(qe,et,Ze),Ze};return{render(qe,et){ie(et,qe);const Ze=Ce.get(et);return Ze!==void 0?Promise.resolve(Ze):Re(qe,et)}}},createBaseAudioContextConstructor=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce)=>class extends ve{constructor(Re,qe){super(Re,qe),this._nativeContext=Re,this._audioWorklet=v===void 0?void 0:{addModule:(et,Ze)=>v(this,et,Ze)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new N(this)}createBiquadFilter(){return new q(this)}createBuffer(Re,qe,et){return new G({length:qe,numberOfChannels:Re,sampleRate:et})}createBufferSource(){return new z(this)}createChannelMerger(Re=6){return new Y(this,{numberOfInputs:Re})}createChannelSplitter(Re=6){return new W(this,{numberOfOutputs:Re})}createConstantSource(){return new ie(this)}createConvolver(){return new ne(this)}createDelay(Re=1){return new ae(this,{maxDelayTime:Re})}createDynamicsCompressor(){return new ce(this)}createGain(){return new pe(this)}createIIRFilter(Re,qe){return new ge(this,{feedback:qe,feedforward:Re})}createOscillator(){return new be(this)}createPanner(){return new Ee(this)}createPeriodicWave(Re,qe,et={disableNormalization:!1}){return new Pe(this,{...et,imag:qe,real:Re})}createStereoPanner(){return new Je(this)}createWaveShaper(){return new Ce(this)}decodeAudioData(Re,qe,et){return se(this._nativeContext,Re).then(Ze=>(typeof qe=="function"&&qe(Ze),Ze),Ze=>{throw typeof et=="function"&&et(Ze),Ze})}},DEFAULT_OPTIONS$f={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},createBiquadFilterNodeConstructor=(v,N,G,z,q,Y,W,ie)=>class extends v{constructor(se,ae){const ce=Y(se),pe={...DEFAULT_OPTIONS$f,...ae},ge=q(ce,pe),ve=W(ce),be=ve?G():null;super(se,!1,ge,be),this._Q=N(this,ve,ge.Q,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),this._detune=N(this,ve,ge.detune,1200*Math.log2(MOST_POSITIVE_SINGLE_FLOAT),-1200*Math.log2(MOST_POSITIVE_SINGLE_FLOAT)),this._frequency=N(this,ve,ge.frequency,se.sampleRate/2,0),this._gain=N(this,ve,ge.gain,40*Math.log10(MOST_POSITIVE_SINGLE_FLOAT),MOST_NEGATIVE_SINGLE_FLOAT),this._nativeBiquadFilterNode=ge,ie(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(se){this._nativeBiquadFilterNode.type=se}getFrequencyResponse(se,ae,ce){try{this._nativeBiquadFilterNode.getFrequencyResponse(se,ae,ce)}catch(pe){throw pe.code===11?z():pe}if(se.length!==ae.length||ae.length!==ce.length)throw z()}},createBiquadFilterNodeRendererFactory=(v,N,G,z,q)=>()=>{const Y=new WeakMap,W=async(ie,ne)=>{let se=G(ie);const ae=isOwnedByContext(se,ne);if(!ae){const ce={Q:se.Q.value,channelCount:se.channelCount,channelCountMode:se.channelCountMode,channelInterpretation:se.channelInterpretation,detune:se.detune.value,frequency:se.frequency.value,gain:se.gain.value,type:se.type};se=N(ne,ce)}return Y.set(ne,se),ae?(await v(ne,ie.Q,se.Q),await v(ne,ie.detune,se.detune),await v(ne,ie.frequency,se.frequency),await v(ne,ie.gain,se.gain)):(await z(ne,ie.Q,se.Q),await z(ne,ie.detune,se.detune),await z(ne,ie.frequency,se.frequency),await z(ne,ie.gain,se.gain)),await q(ie,ne,se),se};return{render(ie,ne){const se=Y.get(ne);return se!==void 0?Promise.resolve(se):W(ie,ne)}}},createCacheTestResult=(v,N)=>(G,z)=>{const q=N.get(G);if(q!==void 0)return q;const Y=v.get(G);if(Y!==void 0)return Y;try{const W=z();return W instanceof Promise?(v.set(G,W),W.catch(()=>!1).then(ie=>(v.delete(G),N.set(G,ie),ie))):(N.set(G,W),W)}catch{return N.set(G,!1),!1}},DEFAULT_OPTIONS$e={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},createChannelMergerNodeConstructor=(v,N,G,z,q)=>class extends v{constructor(W,ie){const ne=z(W),se={...DEFAULT_OPTIONS$e,...ie},ae=G(ne,se),ce=q(ne)?N():null;super(W,!1,ae,ce)}},createChannelMergerNodeRendererFactory=(v,N,G)=>()=>{const z=new WeakMap,q=async(Y,W)=>{let ie=N(Y);if(!isOwnedByContext(ie,W)){const se={channelCount:ie.channelCount,channelCountMode:ie.channelCountMode,channelInterpretation:ie.channelInterpretation,numberOfInputs:ie.numberOfInputs};ie=v(W,se)}return z.set(W,ie),await G(Y,W,ie),ie};return{render(Y,W){const ie=z.get(W);return ie!==void 0?Promise.resolve(ie):q(Y,W)}}},DEFAULT_OPTIONS$d={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},createChannelSplitterNodeConstructor=(v,N,G,z,q,Y)=>class extends v{constructor(ie,ne){const se=z(ie),ae=Y({...DEFAULT_OPTIONS$d,...ne}),ce=G(se,ae),pe=q(se)?N():null;super(ie,!1,ce,pe)}},createChannelSplitterNodeRendererFactory=(v,N,G)=>()=>{const z=new WeakMap,q=async(Y,W)=>{let ie=N(Y);if(!isOwnedByContext(ie,W)){const se={channelCount:ie.channelCount,channelCountMode:ie.channelCountMode,channelInterpretation:ie.channelInterpretation,numberOfOutputs:ie.numberOfOutputs};ie=v(W,se)}return z.set(W,ie),await G(Y,W,ie),ie};return{render(Y,W){const ie=z.get(W);return ie!==void 0?Promise.resolve(ie):q(Y,W)}}},createConnectAudioParam=v=>(N,G,z)=>v(G,N,z),createConnectMultipleOutputs=v=>(N,G,z=0,q=0)=>{const Y=N[z];if(Y===void 0)throw v();return isNativeAudioNode$1(G)?Y.connect(G,0,q):Y.connect(G,0)},createConnectedNativeAudioBufferSourceNodeFactory=v=>(N,G)=>{const z=v(N,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),q=N.createBuffer(1,2,44100);return z.buffer=q,z.loop=!0,z.connect(G),z.start(),()=>{z.stop(),z.disconnect(G)}},DEFAULT_OPTIONS$c={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},createConstantSourceNodeConstructor=(v,N,G,z,q,Y,W)=>class extends v{constructor(ne,se){const ae=q(ne),ce={...DEFAULT_OPTIONS$c,...se},pe=z(ae,ce),ge=Y(ae),ve=ge?G():null;super(ne,!1,pe,ve),this._constantSourceNodeRenderer=ve,this._nativeConstantSourceNode=pe,this._offset=N(this,ge,pe.offset,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(ne){const se=typeof ne=="function"?W(this,ne):null;this._nativeConstantSourceNode.onended=se;const ae=this._nativeConstantSourceNode.onended;this._onended=ae!==null&&ae===se?ne:ae}start(ne=0){if(this._nativeConstantSourceNode.start(ne),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.start=ne),this.context.state!=="closed"){setInternalStateToActive(this);const se=()=>{this._nativeConstantSourceNode.removeEventListener("ended",se),isActiveAudioNode(this)&&setInternalStateToPassive(this)};this._nativeConstantSourceNode.addEventListener("ended",se)}}stop(ne=0){this._nativeConstantSourceNode.stop(ne),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.stop=ne)}},createConstantSourceNodeRendererFactory=(v,N,G,z,q)=>()=>{const Y=new WeakMap;let W=null,ie=null;const ne=async(se,ae)=>
219{let ce=G(se);const pe=isOwnedByContext(ce,ae);if(!pe){const ge={channelCount:ce.channelCount,channelCountMode:ce.channelCountMode,channelInterpretation:ce.channelInterpretation,offset:ce.offset.value};ce=N(ae,ge),W!==null&&ce.start(W),ie!==null&&ce.stop(ie)}return Y.set(ae,ce),pe?await v(ae,se.offset,ce.offset):await z(ae,se.offset,ce.offset),await q(se,ae,ce),ce};return{set start(se){W=se},set stop(se){ie=se},render(se,ae){const ce=Y.get(ae);return ce!==void 0?Promise.resolve(ce):ne(se,ae)}}},createConvertNumberToUnsignedLong=v=>N=>(v[0]=N,v[0]),DEFAULT_OPTIONS$b={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},createConvolverNodeConstructor=(v,N,G,z,q,Y)=>class extends v{constructor(ie,ne){const se=z(ie),ae={...DEFAULT_OPTIONS$b,...ne},ce=G(se,ae),ge=q(se)?N():null;super(ie,!1,ce,ge),this._isBufferNullified=!1,this._nativeConvolverNode=ce,ae.buffer!==null&&Y(this,ae.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(ie){if(this._nativeConvolverNode.buffer=ie,ie===null&&this._nativeConvolverNode.buffer!==null){const ne=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=ne.createBuffer(1,1,ne.sampleRate),this._isBufferNullified=!0,Y(this,0)}else this._isBufferNullified=!1,Y(this,this._nativeConvolverNode.buffer===null?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(ie){this._nativeConvolverNode.normalize=ie}},createConvolverNodeRendererFactory=(v,N,G)=>()=>{const z=new WeakMap,q=async(Y,W)=>{let ie=N(Y);if(!isOwnedByContext(ie,W)){const se={buffer:ie.buffer,channelCount:ie.channelCount,channelCountMode:ie.channelCountMode,channelInterpretation:ie.channelInterpretation,disableNormalization:!ie.normalize};ie=v(W,se)}return z.set(W,ie),isNativeAudioNodeFaker(ie)?await G(Y,W,ie.inputs[0]):await G(Y,W,ie),ie};return{render(Y,W){const ie=z.get(W);return ie!==void 0?Promise.resolve(ie):q(Y,W)}}},createCreateNativeOfflineAudioContext=(v,N)=>(G,z,q)=>{if(N===null)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new N(G,z,q)}catch(Y){throw Y.name==="SyntaxError"?v():Y}},createDataCloneError=()=>new DOMException("","DataCloneError"),detachArrayBuffer=v=>{const{port1:N,port2:G}=new MessageChannel;return new Promise(z=>{const q=()=>{G.onmessage=null,N.close(),G.close(),z()};G.onmessage=()=>q();try{N.postMessage(v,[v])}catch{}finally{q()}})},createDecodeAudioData=(v,N,G,z,q,Y,W,ie,ne,se,ae)=>(ce,pe)=>{const ge=W(ce)?ce:Y(ce);if(q.has(pe)){const ve=G();return Promise.reject(ve)}try{q.add(pe)}catch{}return N(ne,()=>ne(ge))?ge.decodeAudioData(pe).then(ve=>(detachArrayBuffer(pe).catch(()=>{}),N(ie,()=>ie(ve))||ae(ve),v.add(ve),ve)):new Promise((ve,be)=>{const Ee=async()=>{try{await detachArrayBuffer(pe)}catch{}},Pe=Je=>{be(Je),Ee()};try{ge.decodeAudioData(pe,Je=>{typeof Je.copyFromChannel!="function"&&(se(Je),wrapAudioBufferGetChannelDataMethod(Je)),v.add(Je),Ee().then(()=>ve(Je))},Je=>{Pe(Je===null?z():Je)})}catch(Je){Pe(Je)}})},createDecrementCycleCounter=(v,N,G,z,q,Y,W,ie)=>(ne,se)=>{const ae=N.get(ne);if(ae===void 0)throw new Error("Missing the expected cycle count.");const ce=Y(ne.context),pe=ie(ce);if(ae===se){if(N.delete(ne),!pe&&W(ne)){const ge=z(ne),{outputs:ve}=G(ne);for(const be of ve)if(isAudioNodeOutputConnection(be)){const Ee=z(be[0]);v(ge,Ee,be[1],be[2])}else{const Ee=q(be[0]);ge.connect(Ee,be[1])}}}else N.set(ne,ae-se)},DEFAULT_OPTIONS$a={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},createDelayNodeConstructor=(v,N,G,z,q,Y,W)=>class extends v{constructor(ne,se){const ae=q(ne),ce={...DEFAULT_OPTIONS$a,...se},pe=z(ae,ce),ge=Y(ae),ve=ge?G(ce.maxDelayTime):null;super(ne,!1,pe,ve),this._delayTime=N(this,ge,pe.delayTime),W(this,ce.maxDelayTime)}get delayTime(){return this._delayTime}},createDelayNodeRendererFactory=(v,N,G,z,q)=>Y=>{const W=new WeakMap,ie=async(ne,se)=>{let ae=G(ne);const ce=isOwnedByContext(ae,se);if(!ce){const pe={channelCount:ae.channelCount,channelCountMode:ae.channelCountMode,channelInterpretation:ae.channelInterpretation,delayTime:ae.delayTime.value,maxDelayTime:Y};ae=N(se,pe)}return W.set(se,ae),ce?await v(se,ne.delayTime,ae.delayTime):await z(se,ne.delayTime,ae.delayTime),await q(ne,se,ae),ae};return{render(ne,se){const ae=W.get(se);return ae!==void 0?Promise.resolve(ae):ie(ne,se)}}},createDeleteActiveInputConnectionToAudioNode=v=>(N,G,z,q)=>v(N[q],Y=>Y[0]===G&&Y[1]===z),createDeleteUnrenderedAudioWorkletNode=v=>(N,G)=>{v(N).delete(G)},isDelayNode=v=>"delayTime"in v,createDetectCycles=(v,N,G)=>function z(q,Y){const W=isAudioNode$1(Y)?Y:G(v,Y);if(isDelayNode(W))return[];if(q[0]===W)return[q];
vendor: 6,991 bytes, line 219
219if(q.includes(W))return[];const{outputs:ie}=N(W);return Array.from(ie).map(ne=>z([...q,W],ne[0])).reduce((ne,se)=>ne.concat(se),[])},getOutputAudioNodeAtIndex=(v,N,G)=>{const z=N[G];if(z===void 0)throw v();return z},createDisconnectMultipleOutputs=v=>(N,G=void 0,z=void 0,q=0)=>G===void 0?N.forEach(Y=>Y.disconnect()):typeof G=="number"?getOutputAudioNodeAtIndex(v,N,G).disconnect():isNativeAudioNode$1(G)?z===void 0?N.forEach(Y=>Y.disconnect(G)):q===void 0?getOutputAudioNodeAtIndex(v,N,z).disconnect(G,0):getOutputAudioNodeAtIndex(v,N,z).disconnect(G,0,q):z===void 0?N.forEach(Y=>Y.disconnect(G)):getOutputAudioNodeAtIndex(v,N,z).disconnect(G,0),DEFAULT_OPTIONS$9={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},createDynamicsCompressorNodeConstructor=(v,N,G,z,q,Y,W,ie)=>class extends v{constructor(se,ae){const ce=Y(se),pe={...DEFAULT_OPTIONS$9,...ae},ge=z(ce,pe),ve=W(ce),be=ve?G():null;super(se,!1,ge,be),this._attack=N(this,ve,ge.attack),this._knee=N(this,ve,ge.knee),this._nativeDynamicsCompressorNode=ge,this._ratio=N(this,ve,ge.ratio),this._release=N(this,ve,ge.release),this._threshold=N(this,ve,ge.threshold),ie(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(se){const ae=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=se,se>2)throw this._nativeDynamicsCompressorNode.channelCount=ae,q()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(se){const ae=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=se,se==="max")throw this._nativeDynamicsCompressorNode.channelCountMode=ae,q()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return typeof this._nativeDynamicsCompressorNode.reduction.value=="number"?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}},createDynamicsCompressorNodeRendererFactory=(v,N,G,z,q)=>()=>{const Y=new WeakMap,W=async(ie,ne)=>{let se=G(ie);const ae=isOwnedByContext(se,ne);if(!ae){const ce={attack:se.attack.value,channelCount:se.channelCount,channelCountMode:se.channelCountMode,channelInterpretation:se.channelInterpretation,knee:se.knee.value,ratio:se.ratio.value,release:se.release.value,threshold:se.threshold.value};se=N(ne,ce)}return Y.set(ne,se),ae?(await v(ne,ie.attack,se.attack),await v(ne,ie.knee,se.knee),await v(ne,ie.ratio,se.ratio),await v(ne,ie.release,se.release),await v(ne,ie.threshold,se.threshold)):(await z(ne,ie.attack,se.attack),await z(ne,ie.knee,se.knee),await z(ne,ie.ratio,se.ratio),await z(ne,ie.release,se.release),await z(ne,ie.threshold,se.threshold)),await q(ie,ne,se),se};return{render(ie,ne){const se=Y.get(ne);return se!==void 0?Promise.resolve(se):W(ie,ne)}}},createEncodingError=()=>new DOMException("","EncodingError"),createEvaluateSource=v=>N=>new Promise((G,z)=>{if(v===null){z(new SyntaxError);return}const q=v.document.head;if(q===null)z(new SyntaxError);else{const Y=v.document.createElement("script"),W=new Blob([N],{type:"application/javascript"}),ie=URL.createObjectURL(W),ne=v.onerror,se=()=>{v.onerror=ne,URL.revokeObjectURL(ie)};v.onerror=(ae,ce,pe,ge,ve)=>{if(ce===ie||ce===v.location.href&&pe===1&&ge===1)return se(),z(ve),!1;if(ne!==null)return ne(ae,ce,pe,ge,ve)},Y.onerror=()=>{se(),z(new SyntaxError)},Y.onload=()=>{se(),G()},Y.src=ie,Y.type="module",q.appendChild(Y)}}),createEventTargetConstructor=v=>class{constructor(G){this._nativeEventTarget=G,this._listeners=new WeakMap}addEventListener(G,z,q){if(z!==null){let Y=this._listeners.get(z);Y===void 0&&(Y=v(this,z),typeof z=="function"&&this._listeners.set(z,Y)),this._nativeEventTarget.addEventListener(G,Y,q)}}dispatchEvent(G){return this._nativeEventTarget.dispatchEvent(G)}removeEventListener(G,z,q){const Y=z===null?void 0:this._listeners.get(z);this._nativeEventTarget.removeEventListener(G,Y===void 0?null:Y,q)}},createExposeCurrentFrameAndCurrentTime=v=>(N,G,z)=>{Object.defineProperties(v,{currentFrame:{configurable:!0,get(){return Math.round(N*G)}},currentTime:{configurable:!0,get(){return N}}});try{return z()}finally{v!==null&&(delete v.currentFrame,delete v.currentTime)}},createFetchSource=v=>async N=>{try{const G=await fetch(N);if(G.ok)return[await G.text(),G.url]}catch{}throw v()},DEFAULT_OPTIONS$8={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},createGainNodeConstructor=(v,N,G,z,q,Y)=>class extends v{constructor(ie,ne){const se=q(ie),ae={...DEFAULT_OPTIONS$8,...ne},ce=z(se,ae),pe=Y(se),ge=pe?G():null;super(ie,!1,ce,ge),this._gain=N(this,pe,ce.gain,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT)}get gain(){return this._gain}},createGainNodeRendererFactory=(v,N,G,z,q)=>()=>{const Y=new WeakMap,W=async(ie,ne)=>{let se=G(ie);const ae=isOwnedByContext(se,ne);if(!ae){const ce={channelCount:se.channelCount,channelCountMode:se.channelCountMode,channelInterpretation:se.channelInterpretation,gain:se.gain.value};se=N(ne,ce)}return Y.set(ne,se),ae?await v(ne,ie.gain,se.gain):await z(ne,ie.gain,se.gain),await q(ie,ne,se),se};return{render(ie,ne){const se=Y.get(ne);return se!==void 0?Promise.resolve(se):W(ie,ne)}}},createGetActiveAudioWorkletNodeInputs=(v,N)=>G=>N(v,G),createGetAudioNodeRenderer=v=>N=>{const G=v(N);if(G.renderer===null)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return G.renderer},createGetAudioNodeTailTime=v=>N=>{var G;return(G=v.get(N))!==null&&G!==void 0?G:0},createGetAudioParamRenderer=v=>N=>{const G=v(N);if(G.renderer===null)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return G.renderer},createGetBackupOfflineAudioContext=v=>N=>v.get(N),createInvalidStateError=()=>new DOMException("","InvalidStateError"),createGetNativeContext=v=>N=>{const G=v.get(N);if(G===void 0)throw createInvalidStateError();return G},createGetOrCreateBackupOfflineAudioContext=(v,N)=>G=>{let z=v.get(G);if(z!==void 0)return z;if(N===null)throw new Error("Missing the native OfflineAudioContext constructor.");return z=new N(1,1,44100),v.set(G,z),z},createGetUnrenderedAudioWorkletNodes=v=>N=>{const G=v.get(N);if(G===void 0)throw new Error("The context has no set of AudioWorkletNodes.");return G},createInvalidAccessError=()=>new DOMException("","InvalidAccessError"),wrapIIRFilterNodeGetFrequencyResponseMethod=v=>{v.getFrequencyResponse=(N=>(G,z,q)=>{if(G.length!==z.length||z.length!==q.length)throw createInvalidAccessError();return N.call(v,G,z,q)})(v.getFrequencyResponse)},DEFAULT_OPTIONS$7={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},createIIRFilterNodeConstructor=(v,N,G,z,q,Y)=>class extends v{constructor(ie,ne){const se=z(ie),ae=q(se),ce={...DEFAULT_OPTIONS$7,...ne}
219,pe=N(se,ae?null:ie.baseLatency,ce),ge=ae?G(ce.feedback,ce.feedforward):null;super(ie,!1,pe,ge),wrapIIRFilterNodeGetFrequencyResponseMethod(pe),this._nativeIIRFilterNode=pe,Y(this,1)}getFrequencyResponse(ie,ne,se){return this._nativeIIRFilterNode.getFrequencyResponse(ie,ne,se)}},filterBuffer=(v,N,G,z,q,Y,W,ie,ne,se,ae)=>{const ce=se.length;let pe=ie;for(let ge=0;ge<ce;ge+=1){let ve=G[0]*se[ge];for(let be=1;be<q;be+=1){const Ee=pe-be&ne-1;ve+=G[be]*Y[Ee],ve-=v[be]*W[Ee]}for(let be=q;be<z;be+=1)ve+=G[be]*Y[pe-be&ne-1];for(let be=q;be<N;be+=1)ve-=v[be]*W[pe-be&ne-1];Y[pe]=se[ge],W[pe]=ve,pe=pe+1&ne-1,ae[ge]=ve}return pe},filterFullBuffer=(v,N,G,z)=>{const q=G instanceof Float64Array?G:new Float64Array(G),Y=z instanceof Float64Array?z:new Float64Array(z),W=q.length,ie=Y.length,ne=Math.min(W,ie);if(q[0]!==1){for(let ve=0;ve<W;ve+=1)Y[ve]/=q[0];for(let ve=1;ve<ie;ve+=1)q[ve]/=q[0]}const se=32,ae=new Float32Array(se),ce=new Float32Array(se),pe=N.createBuffer(v.numberOfChannels,v.length,v.sampleRate),ge=v.numberOfChannels;for(let ve=0;ve<ge;ve+=1){const be=v.getChannelData(ve),Ee=pe.getChannelData(ve);ae.fill(0),ce.fill(0),filterBuffer(q,W,Y,ie,ne,ae,ce,0,se,be,Ee)}return pe},createIIRFilterNodeRendererFactory=(v,N,G,z,q)=>(Y,W)=>{const ie=new WeakMap;let ne=null;const se=async(ae,ce)=>{let pe=null,ge=N(ae);const ve=isOwnedByContext(ge,ce);if(ce.createIIRFilter===void 0?pe=v(ce,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):ve||(ge=ce.createIIRFilter(W,Y)),ie.set(ce,pe===null?ge:pe),pe!==null){if(ne===null){if(G===null)throw new Error("Missing the native OfflineAudioContext constructor.");const Ee=new G(ae.context.destination.channelCount,ae.context.length,ce.sampleRate);ne=(async()=>{await z(ae,Ee,Ee.destination);const Pe=await q(Ee);return filterFullBuffer(Pe,ce,Y,W)})()}const be=await ne;return pe.buffer=be,pe.start(0),pe}return await z(ae,ce,ge),ge};return{render(ae,ce){const pe=ie.get(ce);return pe!==void 0?Promise.resolve(pe):se(ae,ce)}}},createIncrementCycleCounterFactory=(v,N,G,z,q,Y)=>W=>(ie,ne)=>{const se=v.get(ie);if(se===void 0){if(!W&&Y(ie)){const ae=z(ie),{outputs:ce}=G(ie);for(const pe of ce)if(isAudioNodeOutputConnection(pe)){const ge=z(pe[0]);N(ae,ge,pe[1],pe[2])}else{const ge=q(pe[0]);ae.disconnect(ge,pe[1])}}v.set(ie,ne)}else v.set(ie,se+ne)},createIsAnyAudioContext=(v,N)=>G=>{const z=v.get(G);return N(z)||N(G)},createIsAnyAudioNode=(v,N)=>G=>v.has(G)||N(G),createIsAnyAudioParam=(v,N)=>G=>v.has(G)||N(G),createIsAnyOfflineAudioContext=(v,N)=>G=>{const z=v.get(G);return N(z)||N(G)},createIsNativeAudioContext=v=>N=>v!==null&&N instanceof v,createIsNativeAudioNode=v=>N=>v!==null&&typeof v.AudioNode=="function"&&N instanceof v.AudioNode,createIsNativeAudioParam=v=>N=>v!==null&&typeof v.AudioParam=="function"&&N instanceof v.AudioParam,createIsNativeContext=(v,N)=>G=>v(G)||N(G),createIsNativeOfflineAudioContext=v=>N=>v!==null&&N instanceof v,createIsSecureContext=v=>v!==null&&v.isSecureContext,createMediaElementAudioSourceNodeConstructor=(v,N,G,z)=>class extends v{constructor(Y,W){const ie=G(Y),ne=N(ie,W);if(z(ie))throw TypeError();super(Y,!0,ne,null),this._nativeMediaElementAudioSourceNode=ne}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}},DEFAULT_OPTIONS$6={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},createMediaStreamAudioDestinationNodeConstructor=(v,N,G,z)=>class extends v{constructor(Y,W){const ie=G(Y);if(z(ie))throw new TypeError;const ne={...DEFAULT_OPTIONS$6,...W},se=N(ie,ne);super(Y,!1,se,null),this._nativeMediaStreamAudioDestinationNode=se}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}},createMediaStreamAudioSourceNodeConstructor=(v,N,G,z)=>class extends v{constructor(Y,W){const ie=G(Y),ne=N(ie,W);if(z(ie))throw new TypeError;super(Y,!0,ne,null),this._nativeMediaStreamAudioSourceNode=ne}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}},createMediaStreamTrackAudioSourceNodeConstructor=(v,N,G)=>class extends v{constructor(q,Y){const W=G(q),ie=N(W,Y);super(q,!0,ie,null)}},createMinimalBaseAudioContextConstructor=(v,N,G,z,q,Y)=>class extends G{constructor(ie,ne){super(ie),this._nativeContext=ie,CONTEXT_STORE.set(this,ie),z(ie)&&q.set(ie,new Set),this._destination=new v(this,ne),this._listener=N(this,ie),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(ie){const ne=typeof ie=="function"?Y(this,ie):null;this._nativeContext.onstatechange=ne;const se=this._nativeContext.onstatechange;this._onstatechange=se!==null&&se===ne?ie:se}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}},testPromiseSupport=v=>{const N=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const G=v.decodeAudioData(N.buffer,()=>{});return G===void 0?!1:(G.catch(()=>{}),!0)}catch{}return!1},createMonitorConnections=(v,N)=>(G,z,q)=>{const Y=new Set;return G.connect=(W=>(ie,ne=0,se=0)=>{const ae=Y.size===0;if(N(ie))return W.call(G,ie,ne,se),v(Y,[ie,ne,se],ce=>ce[0]===ie&&ce[1]===ne&&ce[2]===se,!0),ae&&z(),ie;W.call(G,ie,ne),v(Y,[ie,ne],ce=>ce[0]===ie&&ce[1]===ne,!0),ae&&z()})(G.connect),G.disconnect=(W=>(ie,ne,se)=>{const ae=Y.size>0;if(ie===void 0)W.apply(G),Y.clear();else if(typeof ie=="number"){W.call(G,ie);for(const pe of Y)pe[1]===ie&&Y.delete(pe)}else{N(ie)?W.call(G,ie,ne,se):W.call(G,ie,ne);for(const pe of Y)pe[0]===ie&&(ne===void 0||pe[1]===ne)&&(se===void 0||pe[2]===se)&&Y.delete(pe)}const ce=Y.size===0;ae&&ce&&q()})(G.disconnect),G},assignNativeAudioNodeOption=(v,N,G)=>{const z=N[G];z!==void 0&&z!==v[G]&&(v[G]=z)},assignNativeAudioNodeOptions=(v,N)=>{assignNativeAudioNodeOption(v,N,"channelCount"),assignNativeAudioNodeOption(v,N,"channelCountMode"),assignNativeAudioNodeOption(v,N,"channelInterpretation")},testAnalyserNodeGetFloatTimeDomainDataMethodSupport=v=>typeof v.getFloatTimeDomainData=="function",wrapAnalyserNodeGetFloatTimeDomainDataMethod=v=>{v.getFloatTimeDomainData=N=>{const G=new Uint8Array(N.length);v.getByteTimeDomainData(G);const z=Math.max(G.length,v.fftSize);for(let q=0;q<z;
vendor: 14,509 bytes, line 219
219q+=1)N[q]=(G[q]-128)*.0078125;return N}},createNativeAnalyserNodeFactory=(v,N)=>(G,z)=>{const q=G.createAnalyser();if(assignNativeAudioNodeOptions(q,z),!(z.maxDecibels>z.minDecibels))throw N();return assignNativeAudioNodeOption(q,z,"fftSize"),assignNativeAudioNodeOption(q,z,"maxDecibels"),assignNativeAudioNodeOption(q,z,"minDecibels"),assignNativeAudioNodeOption(q,z,"smoothingTimeConstant"),v(testAnalyserNodeGetFloatTimeDomainDataMethodSupport,()=>testAnalyserNodeGetFloatTimeDomainDataMethodSupport(q))||wrapAnalyserNodeGetFloatTimeDomainDataMethod(q),q},createNativeAudioBufferConstructor=v=>v===null?null:v.hasOwnProperty("AudioBuffer")?v.AudioBuffer:null,assignNativeAudioNodeAudioParamValue=(v,N,G)=>{const z=N[G];z!==void 0&&z!==v[G].value&&(v[G].value=z)},wrapAudioBufferSourceNodeStartMethodConsecutiveCalls=v=>{v.start=(N=>{let G=!1;return(z=0,q=0,Y)=>{if(G)throw createInvalidStateError();N.call(v,z,q,Y),G=!0}})(v.start)},wrapAudioScheduledSourceNodeStartMethodNegativeParameters=v=>{v.start=(N=>(G=0,z=0,q)=>{if(typeof q=="number"&&q<0||z<0||G<0)throw new RangeError("The parameters can't be negative.");N.call(v,G,z,q)})(v.start)},wrapAudioScheduledSourceNodeStopMethodNegativeParameters=v=>{v.stop=(N=>(G=0)=>{if(G<0)throw new RangeError("The parameter can't be negative.");N.call(v,G)})(v.stop)},createNativeAudioBufferSourceNodeFactory=(v,N,G,z,q,Y,W,ie,ne,se,ae)=>(ce,pe)=>{const ge=ce.createBufferSource();return assignNativeAudioNodeOptions(ge,pe),assignNativeAudioNodeAudioParamValue(ge,pe,"playbackRate"),assignNativeAudioNodeOption(ge,pe,"buffer"),assignNativeAudioNodeOption(ge,pe,"loop"),assignNativeAudioNodeOption(ge,pe,"loopEnd"),assignNativeAudioNodeOption(ge,pe,"loopStart"),N(G,()=>G(ce))||wrapAudioBufferSourceNodeStartMethodConsecutiveCalls(ge),N(z,()=>z(ce))||ne(ge),N(q,()=>q(ce))||se(ge,ce),N(Y,()=>Y(ce))||wrapAudioScheduledSourceNodeStartMethodNegativeParameters(ge),N(W,()=>W(ce))||ae(ge,ce),N(ie,()=>ie(ce))||wrapAudioScheduledSourceNodeStopMethodNegativeParameters(ge),v(ce,ge),ge},createNativeAudioContextConstructor=v=>v===null?null:v.hasOwnProperty("AudioContext")?v.AudioContext:v.hasOwnProperty("webkitAudioContext")?v.webkitAudioContext:null,createNativeAudioDestinationNodeFactory=(v,N)=>(G,z,q)=>{const Y=G.destination;if(Y.channelCount!==z)try{Y.channelCount=z}catch{}q&&Y.channelCountMode!=="explicit"&&(Y.channelCountMode="explicit"),Y.maxChannelCount===0&&Object.defineProperty(Y,"maxChannelCount",{value:z});const W=v(G,{channelCount:z,channelCountMode:Y.channelCountMode,channelInterpretation:Y.channelInterpretation,gain:1});return N(W,"channelCount",ie=>()=>ie.call(W),ie=>ne=>{ie.call(W,ne);try{Y.channelCount=ne}catch(se){if(ne>Y.maxChannelCount)throw se}}),N(W,"channelCountMode",ie=>()=>ie.call(W),ie=>ne=>{ie.call(W,ne),Y.channelCountMode=ne}),N(W,"channelInterpretation",ie=>()=>ie.call(W),ie=>ne=>{ie.call(W,ne),Y.channelInterpretation=ne}),Object.defineProperty(W,"maxChannelCount",{get:()=>Y.maxChannelCount}),W.connect(Y),W},createNativeAudioWorkletNodeConstructor=v=>v===null?null:v.hasOwnProperty("AudioWorkletNode")?v.AudioWorkletNode:null,testClonabilityOfAudioWorkletNodeOptions=v=>{const{port1:N}=new MessageChannel;try{N.postMessage(v)}finally{N.close()}},createNativeAudioWorkletNodeFactory=(v,N,G,z,q)=>(Y,W,ie,ne,se,ae)=>{if(ie!==null)try{const ce=new ie(Y,ne,ae),pe=new Map;let ge=null;if(Object.defineProperties(ce,{channelCount:{get:()=>ae.channelCount,set:()=>{throw v()}},channelCountMode:{get:()=>"explicit",set:()=>{throw v()}},onprocessorerror:{get:()=>ge,set:ve=>{typeof ge=="function"&&ce.removeEventListener("processorerror",ge),ge=typeof ve=="function"?ve:null,typeof ge=="function"&&ce.addEventListener("processorerror",ge)}}}),ce.addEventListener=(ve=>(...be)=>{if(be[0]==="processorerror"){const Ee=typeof be[1]=="function"?be[1]:typeof be[1]=="object"&&be[1]!==null&&typeof be[1].handleEvent=="function"?be[1].handleEvent:null;if(Ee!==null){const Pe=pe.get(be[1]);Pe!==void 0?be[1]=Pe:(be[1]=Je=>{Je.type==="error"?(Object.defineProperties(Je,{type:{value:"processorerror"}}),Ee(Je)):Ee(new ErrorEvent(be[0],{...Je}))},pe.set(Ee,be[1]))}}return ve.call(ce,"error",be[1],be[2]),ve.call(ce,...be)})(ce.addEventListener),ce.removeEventListener=(ve=>(...be)=>{if(be[0]==="processorerror"){const Ee=pe.get(be[1]);Ee!==void 0&&(pe.delete(be[1]),be[1]=Ee)}return ve.call(ce,"error",be[1],be[2]),ve.call(ce,be[0],be[1],be[2])})(ce.removeEventListener),ae.numberOfOutputs!==0){const ve=G(Y,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return ce.connect(ve).connect(Y.destination),q(ce,()=>ve.disconnect(),()=>ve.connect(Y.destination))}return ce}catch(ce){throw ce.code===11?z():ce}if(se===void 0)throw z();return testClonabilityOfAudioWorkletNodeOptions(ae),N(Y,W,se,ae)},computeBufferSize=(v,N)=>v===null?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(v*N))))),cloneAudioWorkletNodeOptions=v=>new Promise((N,G)=>{const{port1:z,port2:q}=new MessageChannel;z.onmessage=({data:Y})=>{z.close(),q.close(),N(Y)},z.onmessageerror=({data:Y})=>{z.close(),q.close(),G(Y)},q.postMessage(v)}),createAudioWorkletProcessorPromise=async(v,N)=>{const G=await cloneAudioWorkletNodeOptions(N);return new v(G)},createAudioWorkletProcessor=(v,N,G,z)=>{let q=NODE_TO_PROCESSOR_MAPS.get(v);q===void 0&&(q=new WeakMap,NODE_TO_PROCESSOR_MAPS.set(v,q));const Y=createAudioWorkletProcessorPromise(G,z);return q.set(N,Y),Y},createNativeAudioWorkletNodeFakerFactory=(v,N,G,z,q,Y,W,ie,ne,se,ae,ce,pe)=>(ge,ve,be,Ee)=>{if(Ee.numberOfInputs===0&&Ee.numberOfOutputs===0)throw ne();const Pe=Array.isArray(Ee.outputChannelCount)?Ee.outputChannelCount:Array.from(Ee.outputChannelCount);if(Pe.some(bt=>bt<1))throw ne();if(Pe.length!==Ee.numberOfOutputs)throw N();if(Ee.channelCountMode!=="explicit")throw ne();const Je=Ee.channelCount*Ee.numberOfInputs,Ce=Pe.reduce((bt,_t)=>bt+_t,0),Ve=be.parameterDescriptors===void 0?0:be.parameterDescriptors.length;if(Je+Ve>6||Ce>6)throw ne();const Re=new MessageChannel,qe=[],et=[];for(let bt=0;bt<Ee.numberOfInputs;bt+=1)qe.push(W(ge,{channelCount:Ee.channelCount,channelCountMode:Ee.channelCountMode,channelInterpretation:Ee.channelInterpretation,gain:1})),et.push(q(ge,{channelCount:Ee.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Ee.channelCount}));const Ze=[];if(be.parameterDescriptors!==void 0)for(const{defaultValue:bt,maxValue:_t,minValue:Xt,name:At}of be.parameterDescriptors){const $t=Y(ge,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:Ee.parameterData[At]!==void 0?Ee.parameterData[At]:bt===void 0?0:bt});Object.defineProperties($t.offset,{defaultValue:{get:()=>bt===void 0?0:bt},maxValue:{get:()=>_t===void 0?MOST_POSITIVE_SINGLE_FLOAT:_t},minValue:{get:()=>Xt===void 0?MOST_NEGATIVE_SINGLE_FLOAT:Xt}}),Ze.push($t)}const tt=z(ge,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,Je+Ve)}),Ke=computeBufferSize(ve,ge.sampleRate),rt=ie(ge,Ke,Je+Ve,Math.max(1,Ce)),it=q(ge,{channelCount:Math.max(1,Ce),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,Ce)}),ot=[];for(let bt=0;bt<Ee.numberOfOutputs;bt+=1)ot.push(z(ge,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Pe[bt]}));for(let bt=0;bt<Ee.numberOfInputs;bt+=1){qe[bt].connect(et[bt]);for(let _t=0;_t<Ee.channelCount;_t+=1)et[bt].connect(tt,_t,bt*Ee.channelCount+_t)}const ut=new ReadOnlyMap(be.parameterDescriptors===void 0?[]:be.parameterDescriptors.map(({name:bt},_t)=>{const Xt=Ze[_t];return Xt.connect(tt,0,Je+_t),Xt.start(0),[bt,Xt.offset]}));tt.connect(rt);let ct=Ee.channelInterpretation,at=null;const st=Ee.numberOfOutputs===0?[rt]:ot,pt={get bufferSize(){return Ke},get channelCount(){return Ee.channelCount},set channelCount(bt){throw G()},get channelCountMode(){return Ee.channelCountMode},set channelCountMode(bt){throw G()},get channelInterpretation(){return ct},set channelInterpretation(bt){for(const _t of qe)_t.channelInterpretation=bt;ct=bt},get context(){return rt.context},get inputs(){return qe},get numberOfInputs(){return Ee.numberOfInputs},get numberOfOutputs(){return Ee.numberOfOutputs},get onprocessorerror(){return at},set onprocessorerror(bt){typeof at=="function"&&pt.removeEventListener("processorerror",at),at=typeof bt=="function"?bt:null,typeof at=="function"&&pt.addEventListener("processorerror",at)},get parameters(){return ut},get port(){return Re.port2},addEventListener(...bt){return rt.addEventListener(bt[0],bt[1],bt[2])},connect:v.bind(null,st),disconnect:se.bind(null,st),dispatchEvent(...bt){return rt.dispatchEvent(bt[0])},removeEventListener(...bt){return rt.removeEventListener(bt[0],bt[1],bt[2])}},lt=new Map;Re.port1.addEventListener=(bt=>(..._t)=>{if(_t[0]==="message"){const Xt=typeof _t[1]=="function"?_t[1]:typeof _t[1]=="object"&&_t[1]!==null&&typeof _t[1].handleEvent=="function"?_t[1].handleEvent:null;if(Xt!==null){const At=lt.get(_t[1]);At!==void 0?_t[1]=At:(_t[1]=$t=>{ae(ge.currentTime,ge.sampleRate,()=>Xt($t))},lt.set(Xt,_t[1]))}}return bt.call(Re.port1,_t[0],_t[1],_t[2])})(Re.port1.addEventListener),Re.port1.removeEventListener=(bt=>(..._t)=>{if(_t[0]==="message"){const Xt=lt.get(_t[1]);Xt!==void 0&&(lt.delete(_t[1]),_t[1]=Xt)}return bt.call(Re.port1,_t[0],_t[1],_t[2])})(Re.port1.removeEventListener);let vt=null;Object.defineProperty(Re.port1,"onmessage",{get:()=>vt,set:bt=>{typeof vt=="function"&&Re.port1.removeEventListener("message",vt),vt=typeof bt=="function"?bt:null,typeof vt=="function"&&(Re.port1.addEventListener("message",vt),Re.port1.start())}}),be.prototype.port=Re.port1;let dt=null;createAudioWorkletProcessor(ge,pt,be,Ee).then(bt=>dt=bt);const ft=createNestedArrays(Ee.numberOfInputs,Ee.channelCount),Et=createNestedArrays(Ee.numberOfOutputs,Pe),Ct=be.parameterDescriptors===void 0?[]:be.parameterDescriptors.reduce((bt,{name:_t})=>({...bt,[_t]:new Float32Array(128)}),{});let Dt=!0;const Gt=()=>{Ee.numberOfOutputs>0&&rt.disconnect(it);for(let bt=0,_t=0;bt<Ee.numberOfOutputs;bt+=1){const Xt=ot[bt];for(let At=0;At<Pe[bt];At+=1)it.disconnect(Xt,_t+At,At);_t+=Pe[bt]}},Ot=new Map;rt.onaudioprocess=({inputBuffer:bt,outputBuffer:_t})=>{if(dt!==null){const Xt=ce(pt);for(let At=0;At<Ke;At+=128){for(let $t=0;$t<Ee.numberOfInputs;$t+=1)for(let Pt=0;Pt<Ee.channelCount;Pt+=1)copyFromChannel(bt,ft[$t],Pt,Pt,At);be.parameterDescriptors!==void 0&&be.parameterDescriptors.forEach(({name:$t},Pt)=>{copyFromChannel(bt,Ct,$t,Je+Pt,At)});for(let $t=0;$t<Ee.numberOfInputs;$t+=1)for(let Pt=0;Pt<Pe[$t];Pt+=1)Et[$t][Pt].byteLength===0&&(Et[$t][Pt]=new Float32Array(128));try{const $t=ft.map((kt,jt)=>{if(Xt[jt].size>0)return Ot.set(jt,Ke/128),kt;const Mt=Ot.get(jt);return Mt===void 0?[]:(kt.every(Tt=>Tt.every(Rt=>Rt===0))&&(Mt===1?Ot.delete(jt):Ot.set(jt,Mt-1)),kt)});Dt=ae(ge.currentTime+At/ge.sampleRate,ge.sampleRate,()=>dt.process($t,Et,Ct));for(let kt=0,jt=0;kt<Ee.numberOfOutputs;kt+=1){for(let wt=0;wt<Pe[kt];wt+=1)copyToChannel(_t,Et[kt],wt,jt+wt,At);jt+=Pe[kt]}}catch($t){Dt=!1,pt.dispatchEvent(new ErrorEvent("processorerror",{colno:$t.colno,filename:$t.filename,lineno:$t.lineno,message:$t.message}))}if(!Dt){for(let $t=0;$t<Ee.numberOfInputs;$t+=1){qe[$t].disconnect(et[$t]);for(let Pt=0;Pt<Ee.channelCount;Pt+=1)et[At].disconnect(tt,Pt,$t*Ee.channelCount+Pt)}if(be.parameterDescriptors!==void 0){const $t=be.parameterDescriptors.length;for(let Pt=0;Pt<$t;Pt+=1){const kt=Ze[Pt];kt.disconnect(tt,0,Je+Pt),kt.stop()}}tt.disconnect(rt),rt.onaudioprocess=null,It?Gt():ir();break}}}};let It=!1;const Bt=W(ge,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),Ht=()=>rt.connect(Bt).connect(ge.destination),ir=()=>{rt.disconnect(Bt),Bt.disconnect()},zt=()=>{if(Dt){ir(),Ee.numberOfOutputs>0&&rt.connect(it);for(let bt=0,_t=0;bt<Ee.numberOfOutputs;bt+=1){const Xt=ot[bt];for(let At=0;At<Pe[bt];At+=1)it.connect(Xt,_t+At,At);_t+=Pe[bt]}}It=!0},tr=()=>{Dt&&(Ht(),Gt()),It=!1};return Ht(),pe(pt,zt,tr)},createNativeBiquadFilterNode=(v,N)=>{const G=v.createBiquadFilter();return assignNativeAudioNodeOptions(G,N),assignNativeAudioNodeAudioParamValue(G,N,"Q"),assignNativeAudioNodeAudioParamValue(G,N,"detune"),assignNativeAudioNodeAudioParamValue(G,N,"frequency"),assignNativeAudioNodeAudioParamValue(G,N,"gain"),assignNativeAudioNodeOption(G,N,"type"),G},createNativeChannelMergerNodeFactory=(v,N)=>(G,z)=>{const q=G.createChannelMerger(z.numberOfInputs);return v!==null&&v.name==="webkitAudioContext"&&N(G,q),assignNativeAudioNodeOptions(q,z),q},wrapChannelSplitterNode=v=>{const N=v.numberOfOutputs;Object.defineProperty(v,"channelCount",{get:()=>N,set:G=>{if(G!==N)throw createInvalidStateError()}}),Object.defineProperty(v,"channelCountMode",{get:()=>"explicit",set:G=>{if(G!=="explicit")throw createInvalidStateError()}}),Object.defineProperty(v,"channelInterpretation",{get:()=>"discrete",set:G=>{if(G!=="discrete")throw createInvalidStateError()}})},createNativeChannelSplitterNode=(v,N)=>{const G=v.createChannelSplitter(N.numberOfOutputs);return assignNativeAudioNodeOptions(G,N),wrapChannelSplitterNode(G),G},createNativeConstantSourceNodeFactory=(v,N,G,z,q)=>(Y,W)=>{if(Y.createConstantSource===void 0)return G(Y,W);const ie=Y.createConstantSource();return assignNativeAudioNodeOptions(ie,W),assignNativeAudioNodeAudioParamValue(ie,W,"offset"),N(z,()=>z(Y))||wrapAudioScheduledSourceNodeStartMethodNegativeParameters(ie),N(q,()=>q(Y))||wrapAudioScheduledSourceNodeStopMethodNegativeParameters(ie),v(Y,ie),ie},interceptConnections=(v,N)=>(v.connect=N.connect.bind(N),v.disconnect=N.disconnect.bind(N),v),createNativeConstantSourceNodeFakerFactory=(v,N,G,z)=>(q,{offset:Y,...W})=>{const ie=q.createBuffer(1,2,44100),ne=N(q,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),se=G(q,{...W,gain:Y}),ae=ie.getChannelData(0);ae[0]=1,ae[1]=1,ne.buffer=ie,ne.loop=!0;const ce={get bufferSize(){},get channelCount(){return se.channelCount},set channelCount(ve){se.channelCount=ve},get channelCountMode(){return se.channelCountMode},set channelCountMode(ve){se.channelCountMode=ve},get channelInterpretation(){return se.channelInterpretation},set channelInterpretation(ve){se.channelInterpretation=ve},get context(){return se.context},get inputs(){return[]},get numberOfInputs(){return ne.numberOfInputs},get numberOfOutputs(){return se.numberOfOutputs},get offset(){return se.gain}
219,get onended(){return ne.onended},set onended(ve){ne.onended=ve},addEventListener(...ve){return ne.addEventListener(ve[0],ve[1],ve[2])},dispatchEvent(...ve){return ne.dispatchEvent(ve[0])},removeEventListener(...ve){return ne.removeEventListener(ve[0],ve[1],ve[2])},start(ve=0){ne.start.call(ne,ve)},stop(ve=0){ne.stop.call(ne,ve)}},pe=()=>ne.connect(se),ge=()=>ne.disconnect(se);return v(q,ne),z(interceptConnections(ce,se),pe,ge)},createNativeConvolverNodeFactory=(v,N)=>(G,z)=>{const q=G.createConvolver();if(assignNativeAudioNodeOptions(q,z),z.disableNormalization===q.normalize&&(q.normalize=!z.disableNormalization),assignNativeAudioNodeOption(q,z,"buffer"),z.channelCount>2||(N(q,"channelCount",Y=>()=>Y.call(q),Y=>W=>{if(W>2)throw v();return Y.call(q,W)}),z.channelCountMode==="max"))throw v();return N(q,"channelCountMode",Y=>()=>Y.call(q),Y=>W=>{if(W==="max")throw v();return Y.call(q,W)}),q},createNativeDelayNode=(v,N)=>{const G=v.createDelay(N.maxDelayTime);return assignNativeAudioNodeOptions(G,N),assignNativeAudioNodeAudioParamValue(G,N,"delayTime"),G},createNativeDynamicsCompressorNodeFactory=v=>(N,G)=>{const z=N.createDynamicsCompressor();if(assignNativeAudioNodeOptions(z,G),G.channelCount>2||G.channelCountMode==="max")throw v();return assignNativeAudioNodeAudioParamValue(z,G,"attack"),assignNativeAudioNodeAudioParamValue(z,G,"knee"),assignNativeAudioNodeAudioParamValue(z,G,"ratio"),assignNativeAudioNodeAudioParamValue(z,G,"release"),assignNativeAudioNodeAudioParamValue(z,G,"threshold"),z},createNativeGainNode=(v,N)=>{const G=v.createGain();return assignNativeAudioNodeOptions(G,N),assignNativeAudioNodeAudioParamValue(G,N,"gain"),G},createNativeIIRFilterNodeFactory=v=>(N,G,z)=>{if(N.createIIRFilter===void 0)return v(N,G,z);const q=N.createIIRFilter(z.feedforward,z.feedback);return assignNativeAudioNodeOptions(q,z),q};function divide$1(v,N){const G=N[0]*N[0]+N[1]*N[1];return[(v[0]*N[0]+v[1]*N[1])/G,(v[1]*N[0]-v[0]*N[1])/G]}function multiply(v,N){return[v[0]*N[0]-v[1]*N[1],v[0]*N[1]+v[1]*N[0]]}function evaluatePolynomial(v,N){let G=[0,0];for(let z=v.length-1;z>=0;z-=1)G=multiply(G,N),G[0]+=v[z];return G}const createNativeIIRFilterNodeFakerFactory=(v,N,G,z)=>(q,Y,{channelCount:W,channelCountMode:ie,channelInterpretation:ne,feedback:se,feedforward:ae})=>{const ce=computeBufferSize(Y,q.sampleRate),pe=se instanceof Float64Array?se:new Float64Array(se),ge=ae instanceof Float64Array?ae:new Float64Array(ae),ve=pe.length,be=ge.length,Ee=Math.min(ve,be);if(ve===0||ve>20)throw z();if(pe[0]===0)throw N();if(be===0||be>20)throw z();if(ge[0]===0)throw N();if(pe[0]!==1){for(let Ze=0;Ze<be;Ze+=1)ge[Ze]/=pe[0];for(let Ze=1;Ze<ve;Ze+=1)pe[Ze]/=pe[0]}const Pe=G(q,ce,W,W);Pe.channelCount=W,Pe.channelCountMode=ie,Pe.channelInterpretation=ne;const Je=32,Ce=[],Ve=[],Re=[];for(let Ze=0;Ze<W;Ze+=1){Ce.push(0);const tt=new Float32Array(Je),Ke=new Float32Array(Je);tt.fill(0),Ke.fill(0),Ve.push(tt),Re.push(Ke)}Pe.onaudioprocess=Ze=>
219{const tt=Ze.inputBuffer,Ke=Ze.outputBuffer,rt=tt.numberOfChannels;for(let it=0;it<rt;it+=1){const ot=tt.getChannelData(it),ut=Ke.getChannelData(it);Ce[it]=filterBuffer(pe,ve,ge,be,Ee,Ve[it],Re[it],Ce[it],Je,ot,ut)}};const qe=q.sampleRate/2;return interceptConnections({get bufferSize(){return ce},get channelCount(){return Pe.channelCount},set channelCount(Ze){Pe.channelCount=Ze},get channelCountMode(){return Pe.channelCountMode},set channelCountMode(Ze){Pe.channelCountMode=Ze},get channelInterpretation(){return Pe.channelInterpretation},set channelInterpretation(Ze){Pe.channelInterpretation=Ze},get context(){return Pe.context},get inputs(){return[Pe]},get numberOfInputs(){return Pe.numberOfInputs},get numberOfOutputs(){return Pe.numberOfOutputs},addEventListener(...Ze){return Pe.addEventListener(Ze[0],Ze[1],Ze[2])},dispatchEvent(...Ze){return Pe.dispatchEvent(Ze[0])},getFrequencyResponse(Ze,tt,Ke){if(Ze.length!==tt.length||tt.length!==Ke.length)throw v();const rt=Ze.length;for(let it=0;it<rt;it+=1){const ot=-Math.PI*(Ze[it]/qe),ut=[Math.cos(ot),Math.sin(ot)],ct=evaluatePolynomial(ge,ut),at=evaluatePolynomial(pe,ut),st=divide$1(ct,at);tt[it]=Math.sqrt(st[0]*st[0]+st[1]*st[1]),Ke[it]=Math.atan2(st[1],st[0])}},removeEventListener(...Ze){return Pe.removeEventListener(Ze[0],Ze[1],Ze[2])}},Pe)},createNativeMediaElementAudioSourceNode=(v,N)=>v.createMediaElementSource(N.mediaElement),createNativeMediaStreamAudioDestinationNode=(v,N)=>{const G=v.createMediaStreamDestination();return assignNativeAudioNodeOptions(G,N),G.numberOfOutputs===1&&Object.defineProperty(G,"numberOfOutputs",{get:()=>0}),G},createNativeMediaStreamAudioSourceNode=(v,{mediaStream:N})=>{const G=N.getAudioTracks();G.sort((Y,W)=>Y.id<W.id?-1:Y.id>W.id?1:0);const z=G.slice(0,1),q=v.createMediaStreamSource(new MediaStream(z));return Object.defineProperty(q,"mediaStream",{value:N}),q},createNativeMediaStreamTrackAudioSourceNodeFactory=(v,N)=>(G,{mediaStreamTrack:z})=>{if(typeof G.createMediaStreamTrackSource=="function")return G.createMediaStreamTrackSource(z);const q=new MediaStream([z]),Y=G.createMediaStreamSource(q);if(z.kind!=="audio")throw v();if(N(G))throw new TypeError;return Y},createNativeOfflineAudioContextConstructor=v=>v===null?null:v.hasOwnProperty("OfflineAudioContext")?v.OfflineAudioContext:v.hasOwnProperty("webkitOfflineAudioContext")?v.webkitOfflineAudioContext:null,createNativeOscillatorNodeFactory=(v,N,G,z,q,Y)=>(W,ie)=>{const ne=W.createOscillator();return assignNativeAudioNodeOptions(ne,ie),assignNativeAudioNodeAudioParamValue(ne,ie,"detune"),assignNativeAudioNodeAudioParamValue(ne,ie,"frequency"),ie.periodicWave!==void 0?ne.setPeriodicWave(ie.periodicWave):assignNativeAudioNodeOption(ne,ie,"type"),N(G,()=>G(W))||wrapAudioScheduledSourceNodeStartMethodNegativeParameters(ne),N(z,()=>z(W))||Y(ne,W),N(q,()=>q(W))||wrapAudioScheduledSourceNodeStopMethodNegativeParameters(ne),v(W,ne),ne},createNativePannerNodeFactory=v=>(N,G)=>{const z=N.createPanner();return z.orientationX===void 0?v(N,G):(assignNativeAudioNodeOptions(z,G),assignNativeAudioNodeAudioParamValue(z,G,"orientationX"),assignNativeAudioNodeAudioParamValue(z,G,"orientationY"),assignNativeAudioNodeAudioParamValue(z,G,"orientationZ"),assignNativeAudioNodeAudioParamValue(z,G,"positionX"),assignNativeAudioNodeAudioParamValue(z,G,"positionY"),assignNativeAudioNodeAudioParamValue(z,G,"positionZ"),assignNativeAudioNodeOption(z,G,"coneInnerAngle"),assignNativeAudioNodeOption(z,G,"coneOuterAngle"),assignNativeAudioNodeOption(z,G,"coneOuterGain"),assignNativeAudioNodeOption(z,G,"distanceModel"),assignNativeAudioNodeOption(z,G,"maxDistance"),assignNativeAudioNodeOption(z,G,"panningModel"),assignNativeAudioNodeOption(z,G,"refDistance"),assignNativeAudioNodeOption(z,G,"rolloffFactor"),z)},createNativePannerNodeFakerFactory=(v,N,G,z,q,Y,W,ie,ne,se)=>(ae,{coneInnerAngle:ce,coneOuterAngle:pe,coneOuterGain:ge,distanceModel:ve,maxDistance:be,orientationX:Ee,orientationY:Pe,orientationZ:Je,panningModel:Ce,positionX:Ve,positionY:Re,positionZ:qe,refDistance:et,rolloffFactor:Ze,...tt})=>{const Ke=ae.createPanner();if(tt.channelCount>2||tt.channelCountMode==="max")throw W();assignNativeAudioNodeOptions(Ke,tt);const rt={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},it=G(ae,{...rt,channelInterpretation:"speakers",numberOfInputs:6}),ot=z(ae,{...tt,gain:1}),ut=z(ae,{...rt,gain:1}),ct=z(ae,{...rt,gain:0}),at=z(ae,{...rt,gain:0}),st=z(ae,{...rt,gain:0}),pt=z(ae,{...rt,gain:0}),lt=z(ae,{...rt,gain:0}),vt=q(ae,256,6,1),dt=Y(ae,{...rt,curve:new Float32Array([1,1]),oversample:"none"});let xt=[Ee,Pe,Je],ft=[Ve,Re,qe];const Et=new Float32Array(1);vt.onaudioprocess=({inputBuffer:Ot})=>{const It=[ne(Ot,Et,0),ne(Ot,Et,1),ne(Ot,Et,2)];It.some((Ht,ir)=>Ht!==xt[ir])&&(Ke.setOrientation(...It),xt=It);const Bt=[ne(Ot,Et,3),ne(Ot,Et,4),ne(Ot,Et,5)];Bt.some((Ht,ir)=>Ht!==ft[ir])&&(Ke.setPosition(...Bt),ft=Bt)},Object.defineProperty(ct.gain,"defaultValue",{get:()=>0}),Object.defineProperty(at.gain,"defaultValue",{get:()=>0}),Object.defineProperty(st.gain,"defaultValue",{get:()=>0}),Object.defineProperty(pt.gain,"defaultValue",{get:()=>0}),Object.defineProperty(lt.gain,"defaultValue",{get:()=>0});const Ct={get bufferSize(){},get channelCount(){return Ke.channelCount},set channelCount(Ot){if(Ot>2)throw W();ot.channelCount=Ot,Ke.channelCount=Ot},get channelCountMode(){return Ke.channelCountMode},set channelCountMode(Ot){if(Ot==="max")throw W();ot.channelCountMode=Ot,Ke.channelCountMode=Ot},get channelInterpretation(){return Ke.channelInterpretation},set channelInterpretation(Ot){ot.channelInterpretation=Ot,Ke.channelInterpretation=Ot},get coneInnerAngle(){return Ke.coneInnerAngle},set coneInnerAngle(Ot){Ke.coneInnerAngle=Ot},get coneOuterAngle(){return Ke.coneOuterAngle},set coneOuterAngle(Ot){Ke.coneOuterAngle=Ot},get coneOuterGain(){return Ke.coneOuterGain},set coneOuterGain(Ot){if(Ot<0||Ot>1)throw N();Ke.coneOuterGain=Ot},get context(){return Ke.context},get distanceModel(){return Ke.distanceModel},set distanceModel(Ot){Ke.distanceModel=Ot},get inputs(){return[ot]},get maxDistance(){return Ke.maxDistance},set maxDistance(Ot){if(Ot<0)throw new RangeError;Ke.maxDistance=Ot},get numberOfInputs(){return Ke.numberOfInputs},get numberOfOutputs(){return Ke.numberOfOutputs},get orientationX(){return ut.gain},get orientationY(){return ct.gain},get orientationZ(){return at.gain},get panningModel(){return Ke.panningModel},set panningModel(Ot){Ke.panningModel=Ot},get positionX(){return st.gain},get positionY(){return pt.gain},get positionZ(){return lt.gain},get refDistance(){return Ke.refDistance},set refDistance(Ot){if(Ot<0)throw new RangeError;Ke.refDistance=Ot},get rolloffFactor(){return Ke.rolloffFactor},set rolloffFactor(Ot){if(Ot<0)throw new RangeError;Ke.rolloffFactor=Ot},addEventListener(...Ot){return ot.addEventListener(Ot[0],Ot[1],Ot[2])},dispatchEvent(...Ot){return ot.dispatchEvent(Ot[0])},removeEventListener(...Ot){return ot.removeEventListener(Ot[0],Ot[1],Ot[2])}};ce!==Ct.coneInnerAngle&&(Ct.coneInnerAngle=ce),pe!==Ct.coneOuterAngle&&(Ct.coneOuterAngle=pe),ge!==Ct.coneOuterGain&&(Ct.coneOuterGain=ge),ve!==Ct.distanceModel&&(Ct.distanceModel=ve),be!==Ct.maxDistance&&(Ct.maxDistance=be),Ee!==Ct.orientationX.value&&(Ct.orientationX.value=Ee),Pe!==Ct.orientationY.value&&(Ct.orientationY.value=Pe),Je!==Ct.orientationZ.value&&(Ct.orientationZ.value=Je),Ce!==Ct.panningModel&&(Ct.panningModel=Ce),Ve!==Ct.positionX.value&&(Ct.positionX.value=Ve),Re!==Ct.positionY.value&&(Ct.positionY.value=Re),qe!==Ct.positionZ.value&&(Ct.positionZ.value=qe),et!==Ct.refDistance&&(Ct.refDistance=et),Ze!==Ct.rolloffFactor&&(Ct.rolloffFactor=Ze),
219(xt[0]!==1||xt[1]!==0||xt[2]!==0)&&Ke.setOrientation(...xt),(ft[0]!==0||ft[1]!==0||ft[2]!==0)&&Ke.setPosition(...ft);const Dt=()=>{ot.connect(Ke),v(ot,dt,0,0),dt.connect(ut).connect(it,0,0),dt.connect(ct).connect(it,0,1),dt.connect(at).connect(it,0,2),dt.connect(st).connect(it,0,3),dt.connect(pt).connect(it,0,4),dt.connect(lt).connect(it,0,5),it.connect(vt).connect(ae.destination)},Gt=()=>{ot.disconnect(Ke),ie(ot,dt,0,0),dt.disconnect(ut),ut.disconnect(it),dt.disconnect(ct),ct.disconnect(it),dt.disconnect(at),at.disconnect(it),dt.disconnect(st),st.disconnect(it),dt.disconnect(pt),pt.disconnect(it),dt.disconnect(lt),lt.disconnect(it),it.disconnect(vt),vt.disconnect(ae.destination)};return se(interceptConnections(Ct,Ke),Dt,Gt)},createNativePeriodicWaveFactory=v=>(N,{disableNormalization:G,imag:z,real:q})=>{const Y=z instanceof Float32Array?z:new Float32Array(z),W=q instanceof Float32Array?q:new Float32Array(q),ie=N.createPeriodicWave(W,Y,{disableNormalization:G});if(Array.from(z).length<2)throw v();return ie},createNativeScriptProcessorNode=(v,N,G,z)=>v.createScriptProcessor(N,G,z),createNativeStereoPannerNodeFactory=(v,N)=>(G,z)=>{const q=z.channelCountMode;if(q==="clamped-max")throw N();if(G.createStereoPanner===void 0)return v(G,z);const Y=G.createStereoPanner();return assignNativeAudioNodeOptions(Y,z),assignNativeAudioNodeAudioParamValue(Y,z,"pan"),Object.defineProperty(Y,"channelCountMode",{get:()=>q,set:W=>{if(W!==q)throw N()}}),Y},createNativeStereoPannerNodeFakerFactory=(v,N,G,z,q,Y)=>{const ie=new Float32Array([1,1]),ne=Math.PI/2,se={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},ae={...se,oversample:"none"},ce=(ve,be,Ee,Pe)=>{const Je=new Float32Array(16385),Ce=new Float32Array(16385);for(let tt=0;tt<16385;tt+=1){const Ke=tt/16384*ne;Je[tt]=Math.cos(Ke),Ce[tt]=Math.sin(Ke)}const Ve=G(ve,{...se,gain:0}),Re=z(ve,{...ae,curve:Je}),qe=z(ve,{...ae,curve:ie}),et=G(ve,{...se,gain:0}),Ze=z(ve,{...ae,curve:Ce});return{connectGraph(){be.connect(Ve),be.connect(qe.inputs===void 0?qe:qe.inputs[0]),be.connect(et),qe.connect(Ee),Ee.connect(Re.inputs===void 0?Re:Re.inputs[0]),Ee.connect(Ze.inputs===void 0?Ze:Ze.inputs[0]),Re.connect(Ve.gain),Ze.connect(et.gain),Ve.connect(Pe,0,0),et.connect(Pe,0,1)},disconnectGraph(){be.disconnect(Ve),be.disconnect(qe.inputs===void 0?qe:qe.inputs[0]),be.disconnect(et),qe.disconnect(Ee),Ee.disconnect(Re.inputs===void 0?Re:Re.inputs[0]),Ee.disconnect(Ze.inputs===void 0?Ze:Ze.inputs[0]),Re.disconnect(Ve.gain),Ze.disconnect(et.gain),Ve.disconnect(Pe,0,0),et.disconnect(Pe,0,1)}}},pe=(ve,be,Ee,Pe)=>{const Je=new Float32Array(16385),Ce=new Float32Array(16385),Ve=new Float32Array(16385),Re=new Float32Array(16385),qe=Math.floor(16385/2);for(let st=0;st<16385;st+=1)if(st>qe){const pt=(st-qe)/(16384-qe)*ne;Je[st]=Math.cos(pt),Ce[st]=Math.sin(pt),Ve[st]=0,Re[st]=1}else{const pt=st/(16384-qe)*ne;Je[st]=1,Ce[st]=0,Ve[st]=Math.cos(pt),Re[st]=Math.sin(pt)}const et=N(ve,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),Ze=G(ve,{...se,gain:0}),tt=z(ve,{...ae,curve:Je}),Ke=G(ve,{...se,gain:0}),rt=z(ve,{...ae,curve:Ce}),it=z(ve,{...ae,curve:ie}),ot=G(ve,{...se,gain:0}),ut=z(ve,{...ae,curve:Ve}),ct=G(ve,{...se,gain:0}),at=z(ve,{...ae,curve:Re});return{connectGraph(){be.connect(et),be.connect(it.inputs===void 0?it:it.inputs[0]),et.connect(Ze,0),et.connect(Ke,0),et.connect(ot,1),et.connect(ct,1),it.connect(Ee),Ee.connect(tt.inputs===void 0?tt:tt.input
219s[0]),Ee.connect(rt.inputs===void 0?rt:rt.inputs[0]),Ee.connect(ut.inputs===void 0?ut:ut.inputs[0]),Ee.connect(at.inputs===void 0?at:at.inputs[0]),tt.connect(Ze.gain),rt.connect(Ke.gain),ut.connect(ot.gain),at.connect(ct.gain),Ze.connect(Pe,0,0),ot.connect(Pe,0,0),Ke.connect(Pe,0,1),ct.connect(Pe,0,1)},disconnectGraph(){be.disconnect(et),be.disconnect(it.inputs===void 0?it:it.inputs[0]),et.disconnect(Ze,0),et.disconnect(Ke,0),et.disconnect(ot,1),et.disconnect(ct,1),it.disconnect(Ee),Ee.disconnect(tt.inputs===void 0?tt:tt.inputs[0]),Ee.disconnect(rt.inputs===void 0?rt:rt.inputs[0]),Ee.disconnect(ut.inputs===void 0?ut:ut.inputs[0]),Ee.disconnect(at.inputs===void 0?at:at.inputs[0]),tt.disconnect(Ze.gain),rt.disconnect(Ke.gain),ut.disconnect(ot.gain),at.disconnect(ct.gain),Ze.disconnect(Pe,0,0),ot.disconnect(Pe,0,0),Ke.disconnect(Pe,0,1),ct.disconnect(Pe,0,1)}}},ge=(ve,be,Ee,Pe,Je)=>{if(be===1)return ce(ve,Ee,Pe,Je);if(be===2)return pe(ve,Ee,Pe,Je);throw q()};return(ve,{channelCount:be,channelCountMode:Ee,pan:Pe,...Je})=>{if(Ee==="max")throw q();const Ce=v(ve,{...Je,channelCount:1,channelCountMode:Ee,numberOfInputs:2}),Ve=G(ve,{...Je,channelCount:be,channelCountMode:Ee,gain:1}),Re=G(ve,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:Pe});let{connectGraph:qe,disconnectGraph:et}=ge(ve,be,Ve,Re,Ce);Object.defineProperty(Re.gain,"defaultValue",{get:()=>0}),Object.defineProperty(Re.gain,"maxValue",{get:()=>1}),Object.defineProperty(Re.gain,"minValue",{get:()=>-1});const Ze={get bufferSize(){},get channelCount(){return Ve.channelCount},set channelCount(it){Ve.channelCount!==it&&(tt&&et(),{connectGraph:qe,disconnectGraph:et}=ge(ve,it,Ve,Re,Ce),tt&&qe()),Ve.channelCount=it},get channelCountMode(){return Ve.channelCountMode},set channelCountMode(it){if(it==="clamped-max"||it==="max")throw q();Ve.channelCountMode=it},get channelInterpretation(){return Ve.channelInterpretation},set channelInterpretation(it){Ve.channelInterpretation=it},get context(){return Ve.context},get inputs(){return[Ve]},get numberOfInputs(){return Ve.numberOfInputs},get numberOfOutputs(){return Ve.numberOfOutputs},get pan(){return Re.gain},addEventListener(...it){return Ve.addEventListener(it[0],it[1],it[2])},dispatchEvent(...it){return Ve.dispatchEvent(it[0])},removeEventListener(...it){return Ve.removeEventListener(it[0],it[1],it[2])}};let tt=!1;const Ke=()=>{qe(),tt=!0},rt=()=>{et(),tt=!1};return Y(interceptConnections(Ze,Ce),Ke,rt)}},createNativeWaveShaperNodeFactory=(v,N,G,z,q,Y,W)=>(ie,ne)=>{const se=ie.createWaveShaper();if(Y!==null&&Y.name==="webkitAudioContext"&&ie.createGain().gain.automationRate===void 0)return G(ie,ne);assignNativeAudioNodeOptions(se,ne);const ae=ne.curve===null||ne.curve instanceof Float32Array?ne.curve:new Float32Array(ne.curve);if(ae!==null&&ae.length<2)throw N();assignNativeAudioNodeOption(se,{curve:ae},"curve"),assignNativeAudioNodeOption(se,ne,"oversample");let ce=null,pe=!1;return W(se,"curve",be=>()=>be.call(se),be=>Ee=>(be.call(se,Ee),pe&&(z(Ee)&&ce===null?ce=v(ie,se):!z(Ee)&&ce!==null&&(ce(),ce=null)),Ee)),q(se,()=>{pe=!0,z(se.curve)&&(ce=v(ie,se))},()=>{pe=!1,ce!==null&&(ce(),ce=null)})},createNativeWaveShaperNodeFakerFactory=(v,N,G,z,q)=>(Y,{curve:W,oversample:ie,...ne})=>{const se=Y.createWaveShaper(),ae=Y.createWaveShaper();assignNativeAudioNodeOptions(se,ne),assignNativeAudioNodeOptions(ae,ne);const ce=G(Y,{...ne,gain:1}),pe=G(Y,{...ne,gain:-1}),ge=G(Y,{...ne,gain:1}),ve=G(Y,{...ne,gain:-1});let be=null,Ee=!1,Pe=null;const Je={get bufferSize(){},get channelCount(){return se.channelCount},set channelCount(Re){ce.channelCount=Re,pe.channelCount=Re,se.channelCount=Re,ge.channelCount=Re,ae.channelCount=Re,ve.channelCount=Re},get channelCountMode(){return se.channelCountMode},set channelCountMode(Re){ce.channelCountMode=Re,pe.channelCountMode=Re,se.channelCountMode=Re,ge.channelCountMode=Re,ae.channelCountMode=Re,ve.channelCountMode=Re},get channelInterpretation(){return se.channelInterpretation},set channelInterpretation(Re){ce.channelInterpretation=Re,pe.channelInterpretation=Re,se.channelInterpretation=Re,ge.channelInterpretation=Re,ae.channelInterpretation=Re,ve.channelInterpretation=Re},get context(){return se.context},get curve(){return Pe},set curve(Re){if(Re!==null&&Re.length<2)throw N();if(Re===null)se.curve=Re,ae.curve=Re;else{const qe=Re.length,et=new Float32Array(qe+2-qe%2),Ze=new Float32Array(qe+2-qe%2);et[0]=Re[0],Ze[0]=-Re[qe-1];const tt=Math.ceil((qe+1)/2),Ke=(qe+1)/2-1;for(let rt=1;rt<tt;rt+=1){const it=rt/tt*Ke,ot=Math.floor(it),ut=Math.ceil(it);et[rt]=ot===ut?Re[ot]:(1-(it-ot))*Re[ot]+(1-(ut-it))*Re[ut],Ze[rt]=ot===ut?-Re[qe-1-ot]:-((1-(it-ot))*Re[qe-1-ot])-(1-(ut-it))*Re[qe-1-ut]}et[tt]=qe%2===1?Re[tt-1]:(Re[tt-2]+Re[tt-1])/2,se.curve=et,ae.curve=Ze}Pe=Re,Ee&&(z(Pe)&&be===null?be=v(Y,ce):be!==null&&(be(),be=null))},get inputs(){return[ce]},get numberOfInputs(){return se.numberOfInputs},get numberOfOutputs(){return se.numberOfOutputs},get oversample(){return se.oversample},set oversample(Re){se.oversample=Re,ae.oversample=Re},addEventListener(...Re){return ce.addEventListener(Re[0],Re[1],Re[2])},dispatchEvent(...Re){return ce.dispatchEvent(Re[0])},removeEventListener(...Re){return ce.removeEventListener(Re[0],Re[1],Re[2])}};W!==null&&(Je.curve=W instanceof Float32Array?W:new Float32Array(W)),ie!==Je.oversample&&(Je.oversample=ie);const Ce=()=>{ce.connect(se).connect(ge),ce.connect(pe).connect(ae).connect(ve).connect(ge),Ee=!0,z(Pe)&&(be=v(Y,ce))},Ve=()=>{ce.disconnect(se),se.disconnect(ge),ce.disconnect(pe),pe.disconnect(ae),ae.disconnect(ve),ve.disconnect(ge),Ee=!1,be!==null&&(be(),be=null)};return q(interceptConnections(Je,ge),Ce,Ve)},createNotSupportedError=()=>new DOMException("","NotSupportedError"),DEFAULT_OPTIONS$5={numberOfChannels:1},createOfflineAudioContextConstructor=(v,N,G,z,q)=>class extends v{constructor(W,ie,ne){let se;if(typeof W=="number"&&ie!==void 0&&ne!==void 0)se={length:ie,numberOfChannels:W,sampleRate:ne};else if(typeof W=="object")se=W;else throw new Error("The given parameters are not valid.");const{length:ae,numberOfChannels:ce,sampleRate:pe}={...DEFAULT_OPTIONS$5,...se},ge=z(ce,ae,pe);N(testPromiseSupport,()=>testPromiseSupport(ge))||ge.addEventListener("statechange",(()=>{let ve=0;const be=Ee=>{this._state==="running"&&(ve>0?(ge.removeEventListener("statechange",be),Ee.stopImmediatePropagation(),this._waitForThePromiseToSettle(Ee)):ve+=1)};return be})()),super(ge,ce),this._length=ae,this._nativeOfflineAudioContext=ge,this._state=null}get length(){return this._nativeOfflineAudioContext.length===void 0?this._length:this._nativeOfflineAudioContext.length}get state(){return this._state===null?this._nativeOfflineAudioContext.state:this._state}startRendering(){return this._state==="running"?Promise.reject(G()):(this._state="running",q(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,deactivateAudioGraph(this)}))}_waitForThePromiseToSettle(W){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(W):setTimeout(()=>this._waitForThePromiseToSettle(W))}},DEFAULT_OPTIONS$4={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},createOscillatorNodeConstructor=(v,N,G,z,q,Y,W)=>class extends v{constructor(ne,se){const ae=q(ne),ce={...DEFAULT_OPTIONS$4,...se},pe=G(ae,ce),ge=Y(ae),ve=ge?z():null,be=ne.sampleRate/2;super(ne,!1,pe,ve),this._detune=N(this,ge,pe.detune,153600,-153600),this._frequency=N(this,ge,pe.frequency,be,-be),this._nativeOscillatorNode=pe,this._onended=null,this._oscillatorNodeRenderer=ve,this._oscillatorNodeRenderer!==null&&ce.periodicWave!==void 0&&(this._oscillatorNodeRenderer.periodicWave=ce.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(ne){const se=typeof ne=="function"?W(this,ne):null;this._nativeOscillatorNode.onended=se;const ae=this._nativeOscillatorNode.onended;this._onended=ae!==null&&ae===se?ne:ae}get type(){return this._nativeOscillatorNode.type}set type(ne){this._nativeOscillatorNode.type=ne,this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(ne){this._nativeOscillatorNode.setPeriodicWave(ne),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=ne)}start(ne=0){if(this._nativeOscillatorNode.start(ne),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.start=ne),this.context.state!=="closed"){setInternalStateToActive(this);const se=()=>{this._nativeOscillatorNode.removeEventListener("ended",se),isActiveAudioNode(this)&&setInternalStateToPassive(this)};this._nativeOscillatorNode.addEventListener("ended",se)}}stop(ne=0){this._nativeOscillatorNode.stop(ne),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.stop=ne)}},createOscillatorNodeRendererFactory=(v,N,G,z,q)=>()=>{const Y=new WeakMap;let W=null,ie=null,ne=null;const se=async(ae,ce)=>{let pe=G(ae);const ge=isOwnedByContext(pe,ce);if(!ge){const ve={channelCount:pe.channelCount,channelCountMode:pe.channelCountMode,channelInterpretation:pe.channelInterpretation,detune:pe.detune.value,frequency:pe.frequency.value,periodicWave:W===null?void 0:W,type:pe.type};pe=N(ce,ve),ie!==null&&pe.start(ie),ne!==null&&pe.stop(ne)}return Y.set(ce,pe),ge?(await v(ce,ae.detune,pe.detune),await v(ce,ae.frequency,pe.frequency)):(await z(ce,ae.detune,pe.detune),await z(ce,ae.frequency,pe.frequency)),await q(ae,ce,pe),pe};return{set periodicWave(ae){W=ae},set start(ae){ie=ae},set stop(ae){ne=ae},render(ae,ce){const pe=Y.get(ce);return pe!==void 0?Promise.resolve(pe):se(ae,ce)}}},DEFAULT_OPTIONS$3={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},createPannerNodeConstructor=(v,N,G,z,q,Y,W)=>class extends v{constructor(ne,se){const ae=q(ne),ce={...DEFAULT_OPTIONS$3,...se},pe=G(ae,ce),ge=Y(ae),ve=ge?z():null;super(ne,!1,pe,ve),this._nativePannerNode=pe,this._orientationX=N(this,ge,pe.orientationX,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),this._orientationY=N(this,ge,pe.orientationY,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),this._orientationZ=N(this,ge,pe.orientationZ,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),this._positionX=N(this,ge,pe.positionX,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),this._positionY=N(this,ge,pe.positionY,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),this._positionZ=N(this,ge,pe.positionZ,MOST_POSITIVE_SINGLE_FLOAT,MOST_NEGATIVE_SINGLE_FLOAT),W(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(ne){this._nativePannerNode.coneInnerAngle=ne}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(ne){this._nativePannerNode.coneOuterAngle=ne}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(ne){this._nativePannerNode.coneOuterGain=ne}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(ne){this._nativePannerNode.distanceModel=ne}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(ne){this._nativePannerNode.maxDistance=ne}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(ne){this._nativePannerNode.panningModel=ne}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(ne){this._nativePannerNode.refDistance=ne}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(ne){this._nativePannerNode.rolloffFactor=ne}},createPannerNodeRendererFactory=(v,N,G,z,q,Y,W,ie,ne,se)=>()=>{const ae=new WeakMap;let ce=null;const pe=async(ge,ve)=>{let be=null,Ee=Y(ge);const Pe={channelCount:Ee.channelCount,channelCountMode:Ee.channelCountMode,channelInterpretation:Ee.channelInterpretation},Je={...Pe,coneInnerAngle:Ee.coneInnerAngle,coneOuterAngle:Ee.coneOuterAngle,coneOuterGain:Ee.coneOuterGain,distanceModel:Ee.distanceModel,maxDistance:Ee.maxDistance,panningModel:Ee.panningModel,refDistance:Ee.refDistance,rolloffFactor:Ee.rolloffFactor},Ce=isOwnedByContext(Ee,ve);if("bufferSize"in Ee)be=z(ve,{...Pe,gain:1});else if(!Ce){const Ve={...Je,orientationX:Ee.orientationX.value,orientationY:Ee.orientationY.value,orientationZ:Ee.orientationZ.value,positionX:Ee.positionX.value,positionY:Ee.positionY.value,positionZ:Ee.positionZ.value};Ee=q(ve,Ve)}if(ae.set(ve,be===null?Ee:be),be!==null){if(ce===null){if(W===null)throw new Error("Missing the native OfflineAudioContext constructor.");const rt=new W(6,ge.context.length,ve.sampleRate),it=N(rt,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});it.connect(rt.destination),ce=(async()=>{const ot=await Promise.all([ge.orientationX,ge.orientationY,ge.orientationZ,ge.positionX,ge.positionY,ge.positionZ].map(async(ut,ct)=>{const at=G(rt,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:ct===0?1:0});return await ie(rt,ut,at.offset),at}));for(let ut=0;ut<6;ut+=1)ot[ut].connect(it,0,ut),ot[ut].start(0);return se(rt)})()}const Ve=await ce,Re=z(ve,{...Pe,gain:1});await ne(ge,ve,Re);const qe=[];for(let rt=0;rt<Ve.numberOfChannels;rt+=1)qe.push(Ve.getChannelData(rt));let et=[qe[0][0],qe[1][0],qe[2][0]],Ze=[qe[3][0],qe[4][0],qe[5][0]],tt=z(ve,{...Pe,gain:1}),Ke=q(ve,{...Je,orientationX:et[0],orientationY:et[1],orientationZ:et[2],positionX:Ze[0],positionY:Ze[1],positionZ:Ze[2]});Re.connect(tt).connect(Ke.inputs[0]),Ke.connect(be);for(let rt=128;rt<Ve.length;rt+=128){const it=[qe[0][rt],qe[1][rt],qe[2][rt]],ot=[qe[3][rt],qe[4][rt],qe[5][rt]];if(it.some((ut,ct)=>ut!==et[ct])||ot.some((ut,ct)=>ut!==Ze[ct])){et=it,Ze=ot;const ut=rt/ve.sampleRate;tt.gain.setValueAtTime(0,ut),tt=z(ve,{...Pe,gain:0}),Ke=q(ve,{...Je,orientationX:et[0],orientationY:et[1],orientationZ:et[2],positionX:Ze[0],positionY:Ze[1],positionZ:Ze[2]}),tt.gain.setValueAtTime(1,ut),Re.connect(tt).connect(Ke.inputs[0]),Ke.connect(be)}}return be}return Ce?(await v(ve,ge.orientationX,Ee.orientationX),await v(ve,ge.orientationY,Ee.orientationY),await v(ve,ge.orientationZ,Ee.orientationZ),await v(ve,ge.positionX,Ee.positionX),await v(ve,ge.positionY,Ee.positionY),await v(ve,ge.positionZ,Ee.positionZ
219)):(await ie(ve,ge.orientationX,Ee.orientationX),await ie(ve,ge.orientationY,Ee.orientationY),await ie(ve,ge.orientationZ,Ee.orientationZ),await ie(ve,ge.positionX,Ee.positionX),await ie(ve,ge.positionY,Ee.positionY),await ie(ve,ge.positionZ,Ee.positionZ)),isNativeAudioNodeFaker(Ee)?await ne(ge,ve,Ee.inputs[0]):await ne(ge,ve,Ee),Ee};return{render(ge,ve){const be=ae.get(ve);return be!==void 0?Promise.resolve(be):pe(ge,ve)}}},DEFAULT_OPTIONS$2={disableNormalization:!1},createPeriodicWaveConstructor=(v,N,G,z)=>class eh{constructor(Y,W){const ie=N(Y),ne=z({...DEFAULT_OPTIONS$2,...W}),se=v(ie,ne);return G.add(se),se}static[Symbol.hasInstance](Y){return Y!==null&&typeof Y=="object"&&Object.getPrototypeOf(Y)===eh.prototype||G.has(Y)}},createRenderAutomation=(v,N)=>(G,z,q)=>(v(z).replay(q),N(z,G,q)),createRenderInputsOfAudioNode=(v,N,G)=>async(z,q,Y)=>{const W=v(z);await Promise.all(W.activeInputs.map((ie,ne)=>Array.from(ie).map(async([se,ae])=>{const pe=await N(se).render(se,q),ge=z.context.destination;!G(se)&&(z!==ge||!G(z))&&pe.connect(Y,ae,ne)})).reduce((ie,ne)=>[...ie,...ne],[]))},createRenderInputsOfAudioParam=(v,N,G)=>async(z,q,Y)=>{const W=N(z);await Promise.all(Array.from(W.activeInputs).map(async([ie,ne])=>{const ae=await v(ie).render(ie,q);G(ie)||ae.connect(Y,ne)}))},createRenderNativeOfflineAudioContext=(v,N,G,z)=>q=>v(testPromiseSupport,()=>testPromiseSupport(q))?Promise.resolve(v(z,z)).then(Y=>{if(!Y){const W=G(q,512,0,1);q.oncomplete=()=>{W.onaudioprocess=null,W.disconnect()},W.onaudioprocess=()=>q.currentTime,W.connect(q.destination)}return q.startRendering()}):new Promise(Y=>{const W=N(q,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});q.oncomplete=ie=>{W.disconnect(),Y(ie.renderedBuffer)},W.connect(q.destination),q.startRendering()}),createSetActiveAudioWorkletNodeInputs=v=>(N,G)=>{v.set(N,G)},createSetAudioNodeTailTime=v=>(N,G)=>v.set(N,G),createStartRendering=(v,N,G,z,q,Y,W,ie)=>(ne,se)=>G(ne).render(ne,se).then(()=>Promise.all(Array.from(z(se)).map(ae=>G(ae).render(ae,se)))).then(()=>q(se)).then(ae=>(typeof ae.copyFromChannel!="function"?(W(ae),wrapAudioBufferGetChannelDataMethod(ae)):N(Y,()=>Y(ae))||ie(ae),v.add(ae),ae)),DEFAULT_OPTIONS$1={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},createStereoPannerNodeConstructor=(v,N,G,z,q,Y)=>class extends v{constructor(ie,ne){const se=q(ie),ae={...DEFAULT_OPTIONS$1,...ne},ce=G(se,ae),pe=Y(se),ge=pe?z():null;super(ie,!1,ce,ge),this._pan=N(this,pe,ce.pan)}get pan(){return this._pan}},createStereoPannerNodeRendererFactory=(v,N,G,z,q)=>()=>{const Y=new WeakMap,W=async(ie,ne)=>{let se=G(ie);const ae=isOwnedByContext(se,ne);if(!ae){const ce={channelCount:se.channelCount,channelCountMode:se.channelCountMode,channelInterpretation:se.channelInterpretation,pan:se.pan.value};se=N(ne,ce)}return Y.set(ne,se),ae?await v(ne,ie.pan,se.pan):await z(ne,ie.pan,se.pan),isNativeAudioNodeFaker(se)?await q(ie,ne,se.inputs[0]):await q(ie,ne,se),se};return{render(ie,ne){const se=Y.get(ne);return se!==void 0?Promise.resolve(se):W(ie,ne)}}},createTestAudioBufferConstructorSupport=v=>()=>{if(v===null)return!1;try{new v({length:1,sampleRate:44100})}catch{return!1}return!0},createTestAudioWorkletProcessorPostMessageSupport=(v,N)=>async()=>{if(v===null)return!0;if(N===null)return!1;const G=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),z=new N(1,128,44100),q=URL.createObjectURL(G);let Y=!1,W=!1;try{await z.audioWorklet.addModule(q);const ie=new v(z,"a",{numberOfOutputs:0}),ne=z.createOscillator();ie.port.onmessage=()=>Y=!0,ie.onprocessorerror=()=>W=!0,ne.connect(ie),ne.start(0),await z.startRendering(),await new Promise(se=>setTimeout(se))}catch{}finally{URL.revokeObjectURL(q)}return Y&&!W},createTestOfflineAudioContextCurrentTimeSupport=(v,N)=>()=>{if(N===null)return Promise.resolve(!1);const G=new N(1,1,44100),z=v(G,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(q=>{G.oncomplete=()=>{z.disconnect(),q(G.currentTime!==0)},G.startRendering()})},createUnknownError=()=>new DOMException("","UnknownError"),DEFAULT_OPTIONS={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},createWaveShaperNodeConstructor=(v,N,G,z,q,Y,W)=>class extends v{constructor(ne,se){const ae=q(ne),ce={...DEFAULT_OPTIONS,...se},pe=G(ae,ce),ve=Y(ae)?z():null;super(ne,!0,pe,ve),this._isCurveNullified=!1,this._nativeWaveShaperNode=pe,W(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(ne){if(ne===null)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(ne.length<2)throw N();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=ne}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(ne){this._nativeWaveShaperNode.oversample=ne}},createWaveShaperNodeRendererFactory=(v,N,G)=>()=>{const z=new WeakMap,q=async(Y,W)=>{let ie=N(Y);if(!isOwnedByContext(ie,W)){const se={channelCount:ie.channelCount,channelCountMode:ie.channelCountMode,channelInterpretation:ie.channelInterpretation,curve:ie.curve,oversample:ie.oversample};ie=v(W,se)}return z.set(W,ie),isNativeAudioNodeFaker(ie)?await G(Y,W,ie.input
vendor: 4,829 bytes, line 219
219s[0]):await G(Y,W,ie),ie};return{render(Y,W){const ie=z.get(W);return ie!==void 0?Promise.resolve(ie):q(Y,W)}}},createWindow=()=>typeof window>"u"?null:window,createWrapAudioBufferCopyChannelMethods=(v,N)=>G=>{G.copyFromChannel=(z,q,Y=0)=>{const W=v(Y),ie=v(q);if(ie>=G.numberOfChannels)throw N();const ne=G.length,se=G.getChannelData(ie),ae=z.length;for(let ce=W<0?-W:0;ce+W<ne&&ce<ae;ce+=1)z[ce]=se[ce+W]},G.copyToChannel=(z,q,Y=0)=>{const W=v(Y),ie=v(q);if(ie>=G.numberOfChannels)throw N();const ne=G.length,se=G.getChannelData(ie),ae=z.length;for(let ce=W<0?-W:0;ce+W<ne&&ce<ae;ce+=1)se[ce+W]=z[ce]}},createWrapAudioBufferCopyChannelMethodsOutOfBounds=v=>N=>{N.copyFromChannel=(G=>(z,q,Y=0)=>{const W=v(Y),ie=v(q);if(W<N.length)return G.call(N,z,ie,W)})(N.copyFromChannel),N.copyToChannel=(G=>(z,q,Y=0)=>{const W=v(Y),ie=v(q);if(W<N.length)return G.call(N,z,ie,W)})(N.copyToChannel)},createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer=v=>(N,G)=>{const z=G.createBuffer(1,1,44100);N.buffer===null&&(N.buffer=z),v(N,"buffer",q=>()=>{const Y=q.call(N);return Y===z?null:Y},q=>Y=>q.call(N,Y===null?z:Y))},createWrapChannelMergerNode=(v,N)=>(G,z)=>{z.channelCount=1,z.channelCountMode="explicit",Object.defineProperty(z,"channelCount",{get:()=>1,set:()=>{throw v()}}),Object.defineProperty(z,"channelCountMode",{get:()=>"explicit",set:()=>{throw v()}});const q=G.createBufferSource();N(z,()=>{const ie=z.numberOfInputs;for(let ne=0;ne<ie;ne+=1)q.connect(z,0,ne)},()=>q.disconnect(z))},getFirstSample=(v,N,G)=>v.copyFromChannel===void 0?v.getChannelData(G)[0]:(v.copyFromChannel(N,G),N[0]),isDCCurve=v=>{if(v===null)return!1;const N=v.length;return N%2!==0?v[Math.floor(N/2)]!==0:v[N/2-1]+v[N/2]!==0},overwriteAccessors=(v,N,G,z)=>{let q=v;for(;!q.hasOwnProperty(N);)q=Object.getPrototypeOf(q);const{get:Y,set:W}=Object.getOwnPropertyDescriptor(q,N);Object.defineProperty(v,N,{get:G(Y),set:z(W)})},sanitizeAudioWorkletNodeOptions=v=>({...v,outputChannelCount:v.outputChannelCount!==void 0?v.outputChannelCount:v.numberOfInputs===1&&v.numberOfOutputs===1?[v.channelCount]:Array.from({length:v.numberOfOutputs},()=>1)}),sanitizeChannelSplitterOptions=v=>({...v,channelCount:v.numberOfOutputs}),sanitizePeriodicWaveOptions=v=>{const{imag:N,real:G}=v;return N===void 0?G===void 0?{...v,imag:[0,0],real:[0,0]}:{...v,imag:Array.from(G,()=>0),real:G}:G===void 0?{...v,imag:N,real:Array.from(N,()=>0)}:{...v,imag:N,real:G}},setValueAtTimeUntilPossible=(v,N,G)=>{try{v.setValueAtTime(N,G)}catch(z){if(z.code!==9)throw z;setValueAtTimeUntilPossible(v,N,G+1e-7)}},testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport=v=>{const N=v.createBufferSource();N.start();try{N.start()}catch{return!0}return!1},testAudioBufferSourceNodeStartMethodOffsetClampingSupport=v=>{const N=v.createBufferSource(),G=v.createBuffer(1,1,44100);N.buffer=G;try{N.start(0,1)}catch{return!1}return!0},testAudioBufferSourceNodeStopMethodNullifiedBufferSupport=v=>{const N=v.createBufferSource();N.start();try{N.stop()}catch{return!1}return!0},testAudioScheduledSourceNodeStartMethodNegativeParametersSupport=v=>{const N=v.createOscillator();try{N.start(-1)}catch(G){return G instanceof RangeError}return!1},testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport=v=>{const N=v.createBuffer(1,1,44100),G=v.createBufferSource();G.buffer=N,G.start(),G.stop();try{return G.stop(),!0}catch{return!1}},testAudioScheduledSourceNodeStopMethodNegativeParametersSupport=v=>{const N=v.createOscillator();try{N.stop(-1)}catch(G){return G instanceof RangeError}return!1},testAudioWorkletNodeOptionsClonability=v=>{const{port1:N,port2:G}=new MessageChannel;try{N.postMessage(v)}finally{N.close(),G.close()}},wrapAudioBufferSourceNodeStartMethodOffsetClamping=v=>{v.start=(N=>(G=0,z=0,q)=>{const Y=v.buffer,W=Y===null?z:Math.min(Y.duration,z);Y!==null&&W>Y.duration-.5/v.context.sampleRate?N.call(v,G,0,0):N.call(v,G,W,q)})(v.start)},wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls=(v,N)=>{const G=N.createGain();v.connect(G);const z=(q=>()=>{q.call(v,G),v.removeEventListener("ended",z)})(v.disconnect);v.addEventListener("ended",z),interceptConnections(v,G),v.stop=(q=>{let Y=!1;return(W=0)=>{if(Y)try{q.call(v,W)}catch{G.gain.setValueAtTime(0,W)}else q.call(v,W),Y=!0}})(v.stop)},wrapEventListener=(v,N)=>G=>{const z={value:v};return Object.defineProperties(G,{currentTarget:z,target:z}),typeof N=="function"?N.call(v,G):N.handleEvent.call(v,G)},addActiveInputConnectionToAudioNode=createAddActiveInputConnectionToAudioNode(insertElementInSet),addPassiveInputConnectionToAudioNode=createAddPassiveInputConnectionToAudioNode(insertElementInSet),deleteActiveInputConnectionToAudioNode=createDeleteActiveInputConnectionToAudioNode(pickElementFromSet),audioNodeTailTimeStore=new WeakMap,getAudioNodeTailTime=createGetAudioNodeTailTime(audioNodeTailTimeStore),
219cacheTestResult=createCacheTestResult(new Map,new WeakMap),window$1=createWindow(),createNativeAnalyserNode=createNativeAnalyserNodeFactory(cacheTestResult,createIndexSizeError),getAudioNodeRenderer=createGetAudioNodeRenderer(getAudioNodeConnections),renderInputsOfAudioNode=createRenderInputsOfAudioNode(getAudioNodeConnections,getAudioNodeRenderer,isPartOfACycle),createAnalyserNodeRenderer=createAnalyserNodeRendererFactory(createNativeAnalyserNode,getNativeAudioNode,renderInputsOfAudioNode),getNativeContext=createGetNativeContext(CONTEXT_STORE),nativeOfflineAudioContextConstructor=createNativeOfflineAudioContextConstructor(window$1),isNativeOfflineAudioContext=createIsNativeOfflineAudioContext(nativeOfflineAudioContextConstructor),audioParamAudioNodeStore=new WeakMap,eventTargetConstructor=createEventTargetConstructor(wrapEventListener),nativeAudioContextConstructor=createNativeAudioContextConstructor(window$1),isNativeAudioContext=createIsNativeAudioContext(nativeAudioContextConstructor),isNativeAudioNode=createIsNativeAudioNode(window$1),isNativeAudioParam=createIsNativeAudioParam(window$1),nativeAudioWorkletNodeConstructor=createNativeAudioWorkletNodeConstructor(window$1),audioNodeConstructor=createAudioNodeConstructor(createAddAudioNodeConnections(AUDIO_NODE_CONNECTIONS_STORE),createAddConnectionToAudioNode(addActiveInputConnectionToAudioNode,addPassiveInputConnectionToAudioNode,connectNativeAudioNodeToNativeAudioNode,deleteActiveInputConnectionToAudioNode,disconnectNativeAudioNodeFromNativeAudioNode,getAudioNodeConnections,getAudioNodeTailTime,getEventListenersOfAudioNode,getNativeAudioNode,insertElementInSet,isActiveAudioNode,isPartOfACycle,isPassiveAudioNode),cacheTestResult,createIncrementCycleCounterFactory(CYCLE_COUNTERS,disconnectNativeAudioNodeFromNativeAudioNode,getAudioNodeConnections,getNativeAudioNode,getNativeAudioParam,isActiveAudioNode),createIndexSizeError,createInvalidAccessError,createNotSupportedError,createDecrementCycleCounter(connectNativeAudioNodeToNativeAudioNode,CYCLE_COUNTERS,getAudioNodeConnections,getNativeAudioNode,getNativeAudioParam,getNativeContext,isActiveAudioNode,isNativeOfflineAudioContext),createDetectCycles(audioParamAudioNodeStore,getAudioNodeConnections,getValueForKey),eventTargetConstructor,getNativeContext,isNativeAudioContext,isNativeAudioNode,isNativeAudioParam,isNativeOfflineAudioContext,nativeAudioWorkletNodeConstructor),analyserNodeConstructor=createAnalyserNodeConstructor(audioNodeConstructor,createAnalyserNodeRenderer,createIndexSizeError,createNativeAnalyserNode,getNativeContext,isNativeOfflineAudioContext),audioBufferStore=new WeakSet,nativeAudioBufferConstructor=createNativeAudioBufferConstructor(window$1),convertNumberToUnsignedLong=createConvertNumberToUnsignedLong(new Uint32Array(1)),wrapAudioBufferCopyChannelMethods=createWrapAudioBufferCopyChannelMethods(convertNumberToUnsignedLong,createIndexSizeError),wrapAudioBufferCopyChannelMethodsOutOfBounds=createWrapAudioBufferCopyChannelMethodsOutOfBounds(convertNumberToUnsignedLong),audioBufferConstructor=createAudioBufferConstructor(audioBufferStore,cacheTestResult,createNotSupportedError,nativeAudioBufferConstructor,nativeOfflineAudioContextConstructor,createTestAudioBufferConstructorSupport(nativeAudioBufferConstructor),wrapAudioBufferCopyChannelMethods,wrapAudioBufferCopyChannelMethodsOutOfBounds),addSilentConnection=createAddSilentConnection(createNativeGainNode),renderInputsOfAudioParam=createRenderInputsOfAudioParam(getAudioNodeRenderer,getAudioParamConnections,isPartOfACycle),connectAudioParam=createConnectAudioParam(renderInputsOfAudioParam),createNativeAudioBufferSourceNode=createNativeAudioBufferSourceNodeFactory(addSilentConnection,cacheTestResult,testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport,testAudioBufferSourceNodeStartMethodOffsetClampingSupport,testAudioBufferSourceNodeStopMethodNullifiedBufferSupport,testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport,testAudioScheduledSourceNodeStopMethodNegativeParametersSupport,wrapAudioBufferSourceNodeStartMethodOffsetClamping,createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer(overwriteAccessors),wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls),renderAutomation=createRenderAutomation(createGetAudioParamRenderer(getAudioParamConnections),renderInputsOfAudioParam),createAudioBufferSourceNodeRenderer=createAudioBufferSourceNodeRendererFactory(connectAudioParam,createNativeAudioBufferSourceNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),createAudioParam=createAudioParamFactory(createAddAudioParamConnections(AUDIO_PARAM_CONNECTIONS_STORE),audioParamAudioNodeStore,AUDIO_PARAM_STORE,createAudioParamRenderer,createCancelAndHoldAutomationEvent,createCancelScheduledValuesAutomationEvent,createExponentialRampToValueAutomationEvent,createLinearRampToValueAutomationEvent,createSetTargetAutomationEvent,createSetValueAutomationEvent,createSetValueCurveAutomationEvent,nativeAudioContextConstructor,setValueAtTimeUntilPossible),audioBufferSourceNodeConstructor=createAudioBufferSourceNodeConstructor(audioNodeConstructor,createAudioBufferSourceNodeRenderer,createAudioParam,createInvalidStateError,createNativeAudioBufferSourceNode,getNativeContext,isNativeOfflineAudioContext,wrapEventListener),audioDestinationNodeConstructor=createAudioDestinationNodeConstructor(audioNodeConstructor,createAudioDestinationNodeRenderer,createIndexSizeError,createInvalidStateError,createNativeAudioDestinationNodeFactory(createNativeGainNode,overwriteAccessors),getNativeContext,isNativeOfflineAudioContext,renderInputsOfAudioNode),createBiquadFilterNodeRenderer=createBiquadFilterNodeRendererFactory(connectAudioParam,createNativeBiquadFilterNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),setAudioNodeTailTime=createSetAudioNodeTailTime(audioNodeTailTimeStore),biquadFilterNodeConstructor=createBiquadFilterNodeConstructor(audioNodeConstructor,createAudioParam,createBiquadFilterNodeRenderer,createInvalidAccessError,createNativeBiquadFilterNode,getNativeContext,isNativeOfflineAudioContext,setAudioNodeTailTime),monitorConnections=createMonitorConnections(insertElementInSet,isNativeAudioNode),wrapChannelMergerNode=createWrapChannelMergerNode(createInvalidStateError,monitorConnections),createNativeChannelMergerNode=createNativeChannelMergerNodeFactory(nativeAudioContextConstructor,wrapChannelMergerNode),createChannelMergerNodeRenderer=createChannelMergerNodeRendererFactory(createNativeChannelMergerNode,getNativeAudioNode,renderInputsOfAudioNode),channelMergerNodeConstructor=createChannelMergerNodeConstructor(audioNodeConstructor,createChannelMergerNodeRenderer,createNativeChannelMergerNode,getNativeContext,isNativeOfflineAudioContext),createChannelSplitterNodeRenderer=createChannelSplitterNodeRendererFactory(createNativeChannelSplitterNode,getNativeAudioNode,renderInputsOfAudioNode),channelSplitterNodeConstructor=createChannelSplitterNodeConstructor(audioNodeConstructor,createChannelSplitterNodeRenderer,createNativeChannelSplitterNode,getNativeContext,isNativeOfflineAudioContext,sanitizeChannelSplitterOptions),createNativeConstantSourceNodeFaker=createNativeConstantSourceNodeFakerFactory(addSilentConnection,createNativeAudioBufferSourceNode,createNativeGainNode,monitorConnections),createNativeConstantSourceNode=createNativeConstantSourceNodeFactory(addSilentConnection,cacheTestResult,createNativeConstantSourceNodeFaker,testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,testAudioScheduledSourceNodeStopMethodNegativeParametersSupport),createConstantSourceNodeRenderer=createConstantSourceNodeRendererFactory(connectAudioParam,createNativeConstantSourceNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),constantSourceNodeConstructor=createConstantSourceNodeConstructor(audioNodeConstructor,createAudioParam,createConstantSourceNodeRenderer,createNativeConstantSourceNode,getNativeContext,isNativeOfflineAudioContext,wrapEventListener),createNativeConvolverNode=createNativeConvolverNodeFactory(createNotSupportedError,overwriteAccessors),createConvolverNodeRenderer=createConvolverNodeRendererFactory(createNativeConvolverNode,getNativeAudioNode,renderInputsOfAudioNode),convolverNodeConstructor=createConvolverNodeConstructor(audioNodeConstructor,createConvolverNodeRenderer,createNativeConvolverNode,getNativeContext,isNativeOfflineAudioContext,setAudioNodeTailTime),createDelayNodeRenderer=createDelayNodeRendererFactory(connectAudioParam,createNativeDelayNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),delayNodeConstructor=createDelayNodeConstructor(audioNodeConstructor,createAudioParam,createDelayNodeRenderer,createNativeDelayNode,getNativeContext,isNativeOfflineAudioContext,setAudioNodeTailTime),createNativeDynamicsCompressorNode=createNativeDynamicsCompressorNodeFactory(createNotSupportedError),createDynamicsCompressorNodeRenderer=createDynamicsCompressorNodeRendererFactory(connectAudioParam,createNativeDynamicsCompressorNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),dynamicsCompressorNodeConstructor=createDynamicsCompressorNodeConstructor(audioNodeConstructor,createAudioParam,createDynamicsCompressorNodeRenderer,createNativeDynamicsCompressorNode,createNotSupportedError,getNativeContext,isNativeOfflineAudioContext,setAudioNodeTailTime),createGainNodeRenderer=createGainNodeRendererFactory(connectAudioParam,createNativeGainNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),gainNodeConstructor=createGainNodeConstructor(audioNodeConstructor,createAudioParam,createGainNodeRenderer,createNativeGainNode,getNativeContext,isNativeOfflineAudioContext),createNativeIIRFilterNodeFaker=createNativeIIRFilterNodeFakerFactory(createInvalidAccessError,createInvalidStateError,createNativeScriptProcessorNode,createNotSupportedError),renderNativeOfflineAudioContext=createRenderNativeOfflineAudioContext(cacheTestResult,createNativeGainNode,createNativeScriptProcessorNode,createTestOfflineAudioContextCurrentTimeSupport(createNativeGainNode,nativeOfflineAudioContextConstructor)),createIIRFilterNodeRenderer=createIIRFilterNodeRendererFactory(createNativeAudioBufferSourceNode,getNativeAudioNode,nativeOfflineAudioContextConstructor,renderInputsOfAudioNode,renderNativeOfflineAudioContext),createNativeIIRFilterNode=createNativeIIRFilterNodeFactory(createNativeIIRFilterNodeFaker),iIRFilterNodeConstructor=createIIRFilterNodeConstructor(audioNodeConstructor,createNativeIIRFilterNode,createIIRFilterNodeRenderer,getNativeContext,isNativeOfflineAudioContext,setAudioNodeTailTime),createAudioListener=createAudioListenerFactory(createAudioParam,createNativeChannelMergerNode,createNativeConstantSourceNode,createNativeScriptProcessorNode,createNotSupportedError,getFirstSample,isNativeOfflineAudioContext,overwriteAccessors),unrenderedAudioWorkletNodeStore=new WeakMap,minimalBaseAudioContextConstructor=createMinimalBaseAudioContextConstructor(audioDestinationNodeConstructor,createAudioListener,eventTargetConstructor,isNativeOfflineAudioContext,unrenderedAudioWorkletNodeStore,wrapEventListener),createNativeOscillatorNode=createNativeOscillatorNodeFactory(addSilentConnection,cacheTestResult,testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport,testAudioScheduledSourceNodeStopMethodNegativeParametersSupport,wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls),createOscillatorNodeRenderer=createOscillatorNodeRendererFactory(connectAudioParam,createNativeOscillatorNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),oscillatorNodeConstructor=createOscillatorNodeConstructor(audioNodeConstructor,createAudioParam,createNativeOscillatorNode,createOscillatorNodeRenderer,getNativeContext,isNativeOfflineAudioContext,wrapEventListener),createConnectedNativeAudioBufferSourceNode=createConnectedNativeAudioBufferSourceNodeFactory(createNativeAudioBufferSourceNode),createNativeWaveShaperNodeFaker=createNativeWaveShaperNodeFakerFactory(createConnectedNativeAudioBufferSourceNode,createInvalidStateError,createNativeGainNode,isDCCurve,monitorConnections),createNativeWaveShaperNode=createNativeWaveShaperNodeFactory(createConnectedNativeAudioBufferSourceNode,createInvalidStateError,createNativeWaveShaperNodeFaker,isDCCurve,monitorConnections,nativeAudioContextConstructor,overwriteAccessors),createNativePannerNodeFaker=createNativePannerNodeFakerFactory(connectNativeAudioNodeToNativeAudioNode,createInvalidStateError,createNativeChannelMergerNode,createNativeGainNode,createNativeScriptProcessorNode,createNativeWaveShaperNode,createNotSupportedError,disconnectNativeAudioNodeFromNativeAudioNode,getFirstSample,monitorConnections),createNativePannerNode=createNativePannerNodeFactory(createNativePannerNodeFaker),createPannerNodeRenderer=createPannerNodeRendererFactory(connectAudioParam,createNativeChannelMergerNode,createNativeConstantSourceNode,createNativeGainNode,createNativePannerNode,getNativeAudioNode,nativeOfflineAudioContextConstructor,renderAutomation,renderInputsOfAudioNode,renderNativeOfflineAudioContext),pannerNodeConstructor=createPannerNodeConstructor(audioNodeConstructor,createAudioParam,createNativePannerNode,createPannerNodeRenderer,getNativeContext,isNativeOfflineAudioContext,setAudioNodeTailTime),createNativePeriodicWave=createNativePeriodicWaveFactory(createIndexSizeError),periodicWaveC
219onstructor=createPeriodicWaveConstructor(createNativePeriodicWave,getNativeContext,new WeakSet,sanitizePeriodicWaveOptions),nativeStereoPannerNodeFakerFactory=createNativeStereoPannerNodeFakerFactory(createNativeChannelMergerNode,createNativeChannelSplitterNode,createNativeGainNode,createNativeWaveShaperNode,createNotSupportedError,monitorConnections),createNativeStereoPannerNode=createNativeStereoPannerNodeFactory(nativeStereoPannerNodeFakerFactory,createNotSupportedError),createStereoPannerNodeRenderer=createStereoPannerNodeRendererFactory(connectAudioParam,createNativeStereoPannerNode,getNativeAudioNode,renderAutomation,renderInputsOfAudioNode),stereoPannerNodeConstructor=createStereoPannerNodeConstructor(audioNodeConstructor,createAudioParam,createNativeStereoPannerNode,createStereoPannerNodeRenderer,getNativeContext,isNativeOfflineAudioContext),createWaveShaperNodeRenderer=createWaveShaperNodeRendererFactory(createNativeWaveShaperNode,getNativeAudioNode,renderInputsOfAudioNode),waveShaperNodeConstructor=createWaveShaperNodeConstructor(audioNodeConstructor,createInvalidStateError,createNativeWaveShaperNode,createWaveShaperNodeRenderer,getNativeContext,isNativeOfflineAudioContext,setAudioNodeTailTime),isSecureContext=createIsSecureContext(window$1),exposeCurrentFrameAndCurrentTime=createExposeCurrentFrameAndCurrentTime(window$1),backupOfflineAudioContextStore=new WeakMap,getOrCreateBackupOfflineAudioContext=createGetOrCreateBackupOfflineAudioContext(backupOfflineAudioContextStore,nativeOfflineAudioContextConstructor),addAudioWorkletModule=isSecureContext?createAddAudioWorkletModule(cacheTestResult,createNotSupportedError,createEvaluateSource(window$1),exposeCurrentFrameAndCurrentTime,createFetchSource(createAbortError),getNativeContext,getOrCreateBackupOfflineAudioContext,isNativeOfflineAudioContext,nativeAudioWorkletNodeConstructor,new WeakMap,new WeakMap,createTestAudioWorkletProcessorPostMessageSupport(nativeAudioWorkletNodeConstructor,nativeOfflineAudioContextConstructor),window$1):void 0,isNativeContext=createIsNativeContext(isNativeAudioContext,isNativeOfflineAudioContext),decodeAudioData=createDecodeAudioData(audioBufferStore,cacheTestResult,createDataCloneError,createEncodingError,new WeakSet,getNativeContext,isNativeContext,testAudioBufferCopyChannelMethodsOutOfBoundsSupport,testPromiseSupport,wrapAudioBufferCopyChannelMethods,wrapAudioBufferCopyChannelMethodsOutOfBounds),baseAudioContextConstructor=createBaseAudioContextConstructor(addAudioWorkletModule,analyserNodeConstructor,audioBufferConstructor,audioBufferSourceNodeConstructor,biquadFilterNodeConstructor,channelMergerNodeConstructor,channelSplitterNodeConstructor,constantSourceNodeConstructor,convolverNodeConstructor,decodeAudioData,delayNodeConstructor,dynamicsCompressorNodeConstructor,gainNodeConstructor,iIRFilterNodeConstructor,minimalBaseAudioContextConstructor,oscillatorNodeConstructor,pannerNodeConstructor,periodicWaveConstructor,stereoPannerNodeConstructor,waveShaperNodeConstructor),mediaElementAudioSourceNodeConstructor=createMediaElementAudioSourceNodeConstructor(audioNodeConstructor,createNativeMediaElementAudioSourceNode,getNativeContext,isNativeOfflineAudioContext),mediaStreamAudioDestinationNodeConstructor=createMediaStreamAudioDestinationNodeConstructor(audioNodeConstructor,createNativeMediaStreamAudioDestinationNode,getNativeContext,isNativeOfflineAudioContext),mediaStreamAudioSourceNodeConstructor=createMediaStreamAudioSourceNodeConstructor(audioNodeConstructor,createNativeMediaStreamAudioSourceNode,getNativeContext,isNativeOfflineAudioContext),createNativeMediaStreamTrackAudioSourceNode=createNativeMediaStreamTrackAudioSourceNodeFactory(createInvalidStateError,isNativeOfflineAudioContext),mediaStreamTrackAudioSourceNodeConstructor=createMediaStreamTrackAudioSourceNodeConstructor(audioNodeConstructor,createNativeMediaStreamTrackAudioSourceNode,getNativeContext),audioContextConstructor=createAudioContextConstructor(baseAudioContextConstructor,createInvalidStateError,createNotSupportedError,createUnknownError,mediaElementAudioSourceNodeConstructor,mediaStreamAudioDestinationNodeConstructor,mediaStreamAudioSourceNodeConstructor,mediaStreamTrackAudioSourceNodeConstructor,nativeAudioContextConstructor),getUnrenderedAudioWorkletNodes=createGetUnrenderedAudioWorkletNodes(unrenderedAudioWorkletNodeStore),addUnrenderedAudioWorkletNode=createAddUnrenderedAudioWorkletNode(getUnrenderedAudioWorkletNodes),connectMultipleOutputs=createConnectMultipleOutputs(createIndexSizeError),deleteUnrenderedAudioWorkletNode=createDeleteUnrenderedAudioWorkletNode(getUnrenderedAudioWorkletNodes),disconnectMultipleOutputs=createDisconnectMultipleOutputs(createIndexSizeError),activeAudioWorkletNodeInputsStore=new WeakMap,getActiveAudioWorkletNodeInputs=createGetActiveAudioWorkletNodeInputs(activeAudioWorkletNodeInputsStore,getValueForKey),createNativeAudioWorkletNodeFaker=createNativeAudioWorkletNodeFakerFactory(connectMultipleOutputs,createIndexSizeError,createInvalidStateError,createNativeChannelMergerNode,createNativeChannelSplitterNode,createNativeConstantSourceNode,createNativeGainNode,createNativeScriptProcessorNode,createNotSupportedError,disconnectMultipleOutputs,exposeCurrentFrameAndCurrentTime,getActiveAudioWorkletNodeInputs,monitorConnections),createNativeAudioWorkletNode=createNativeAudioWorkletNodeFactory(createInvalidStateError,createNativeAudioWorkletNodeFaker,createNativeGainNode,createNotSupportedError,monitorConnections),createAudioWorkletNodeRenderer=createAudioWorkletNodeRendererFactory(connectAudioParam,connectMultipleOutputs,createNativeAudioBufferSourceNode,createNativeChannelMergerNode,createNativeChannelSplitterNode,createNativeConstantSourceNode,createNativeGainNode,deleteUnrenderedAudioWorkletNode,disconnectMultipleOutputs,exposeCurrentFrameAndCurrentTime,getNativeAudioNode,nativeAudioWorkletNodeConstructor,nativeOfflineAudioContextConstructor,renderAutomation,renderInputsOfAudioNode,renderNativeOfflineAudioContext),getBackupOfflineAudioContext=createGetBackupOfflineAudioContext(backupOfflineAudioContextStore),setActiveAudioWorkletNodeInputs=createSetActiveAudioWorkletNodeInputs(activeAudioWorkletNodeInputsStore),audioWorkletNodeConstructor=isSecureContext?createAudioWorkletNodeConstructor(addUnrenderedAudioWorkletNode,audioNodeConstructor,createAudioParam,createAudioWorkletNodeRenderer,createNativeAudioWorkletNode,getAudioNodeConnections,getBackupOfflineAudioContext,getNativeContext,isNativeOfflineAudioContext,nativeAudioWorkletNodeConstructor,sanitizeAudioWorkletNodeOptions,setActiveAudioWorkletNodeInputs,testAudioWorkletNodeOptionsClonability,wrapEventListener):void 0,createNativeOfflineAudioContext=createCreateNativeOfflineAudioContext(createNotSupportedError,nativeOfflineAudioContextConstructor),startRendering=createStartRendering(audioBufferStore,cacheTestResult,getAudioNodeRenderer,getUnrenderedAudioWorkletNodes,renderNativeOfflineAudioContext,testAudioBufferCopyChannelMethodsOutOfBoundsSupport,wrapAudioBufferCopyChannelMethods,wrapAudioBufferCopyChannelMethodsOutOfBounds),offlineAudioContextConstructor=createOfflineAudioContextConstructor(baseAudioContextConstructor,cacheTestResult,createInvalidStateError,createNativeOfflineAudioContext,startRendering),isAnyAudioContext=createIsAnyAudioContext(CONTEXT_STORE,isNativeAudioContext),isAnyAudioNode=createIsAnyAudioNode(AUDIO_NODE_STORE,isNativeAudioNode),isAnyAudioParam=createIsAnyAudioParam(AUDIO_PARAM_STORE,isNativeAudioParam),isAnyOfflineAudioContext=createIsAnyOfflineAudioContext(CONTEXT_STORE,isNativeOfflineAudioContext);function isUndef(v){return v===void 0}function isDefined(v){return v!==void 0}function isFunction$1(v){return typeof v=="function"}function isNumber$1(v){return typeof v=="number"}function isObject$1(v){return Object.prototype.toString.call(v)==="[object Object]"&&v.constructor===Object}function isBoolean$1(v){return typeof v=="boolean"}function isArray$1(v){return Array.isArray(v)}function isString$1(v){return typeof v=="string"}function isNote(v){return isString$1(v)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(v)}function assert(v,N){if(!v)throw new Error(N)}function assertRange(v,N,G=1/0){if(!(N<=v&&v<=G))throw new RangeError(`Value must be within [${N}, ${G}], got: ${v}`)}function assertContextRunning(v){!v.isOffline&&v.state!=="running"&&warn('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let isInsideScheduledCallback=!1,printedScheduledWarning=!1;function enterScheduledCallback(v){isInsideScheduledCallback=v}function assertUsedScheduleTime(v){isUndef(v)&&isInsideScheduledCallback&&!printedScheduledWarning&&(printedScheduledWarning=!0,warn("Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing"))}let defaultLogger=console;function log$1(...v){defaultLogger.log(...v)}
219function warn(...v){defaultLogger.warn(...v)}function createAudioContext(v){return new audioContextConstructor(v)}function createOfflineAudioContext(v,N,G){return new offlineAudioContextConstructor(v,N,G)}const theWindow=typeof self=="object"?self:null,hasAudioContext=theWindow&&(theWindow.hasOwnProperty("AudioContext")||theWindow.hasOwnProperty("webkitAudioContext"));function createAudioWorkletNode(v,N,G){return assert(isDefined(audioWorkletNodeConstructor),"AudioWorkletNode only works in a secure context (https or localhost)"),new(v instanceof(theWindow==null?void 0:theWindow.BaseAudioContext)?theWindow==null?void 0:theWindow.AudioWorkletNode:audioWorkletNodeConstructor)(v,N,G)}function __decorate(v,N,G,z){var q=arguments.length,Y=q<3?N:z===null?z=Object.getOwnPropertyDescriptor(N,G):z,W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(v,N,G,z);else for(var ie=v.length-1;ie>=0;ie--)(W=v[ie])&&(Y=(q<3?W(Y):q>3?W(N,G,Y):W(N,G))||Y);return q>3&&Y&&Object.defineProperty(N,G,Y),Y}function __awaiter(v,N,G,z){function q(Y){return Y instanceof G?Y:new G(function(W){W(Y)})}return new(G||(G=Promise))(function(Y,W){function ie(ae){try{se(z.next(ae))}catch(ce){W(ce)}}function ne(ae){try{se(z.throw(ae))}catch(ce){W(ce)}}function se(ae){ae.done?Y(ae.value):q(ae.value).then(ie,ne)}se((z=z.apply(v,N||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class Ticker{constructor(N,G,z,q){this._callback=N,this._type=G,this._minimumUpdateInterval=Math.max(128/(q||44100),.001),this.updateInterval=z,this._createClock()}_createWorker(){const N=new Blob([`
220			// the initial timeout time
221			let timeoutTime =  ${(this._updateInterval*1e3).toFixed(1)};
222			// onmessage callback
223			self.onmessage = function(msg){
224				timeoutTime = parseInt(msg.data);
225			};
226			// the tick function which posts a message
227			// and schedules a new tick
228			function tick(){
229				setTimeout(tick, timeoutTime);
230				self.postMessage('tick');
231			}
232			// call tick initially
233			tick();
234			`],{type:"text/javascript"}),G=URL.createObjectURL(N),z=new Worker(G);z.onmessage=this._callback.bind(this),this._worker=z}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},this._updateInterval*1e3)}_createClock(){if(this._type==="worker")try{this._createWorker()}catch{this._type="timeout",this._createClock()}else this._type==="timeout"&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(N){var G;this._updateInterval=Math.max(N,this._minimumUpdateInterval),this._type==="worker"&&((G=this._worker)===null||G===void 0||G.postMessage(this._updateInterval*1e3))}get type(){return this._type}set type(N){this._disposeClock(),this._type=N,this._createClock()}dispose(){this._disposeClock()}}function isAudioParam(v){return isAnyAudioParam(v)}function isAudioNode(v){return isAnyAudioNode(v)}function isOfflineAudioContext(v){return isAnyOfflineAudioContext(v)}function isAudioContext(v){return isAnyAudioContext(v)}function isAudioBuffer(v){return v instanceof audioBufferConstructor}function noCopy(v,N){return v==="value"||isAudioParam(N)||isAudioNode(N)||isAudioBuffer(N)}function deepMerge(v,...N){if(!N.length)return v;const G=N.shift();if(isObject$1(v)&&isObject$1(G))for(const z in G)noCopy(z,G[z])?v[z]=G[z]:isObject$1(G[z])?(v[z]||Object.assign(v,{[z]:{}}),deepMerge(v[z],G[z])):Object.assign(v,{[z]:G[z]});return deepMerge(v,...N)}function deepEquals(v,N){return v.length===N.length&&v.every((G,z)=>N[z]===G)}function optionsFromArguments(v,N,G=[],z){const q={},Y=Array.from(N);if(isObject$1(Y[0])&&z&&!Reflect.has(Y[0],z)&&(Object.keys(Y[0]).some(ie=>Reflect.has(v,ie))||(deepMerge(q,{[z]:Y[0]}),G.splice(G.indexOf(z),1),Y.shift())),Y.length===1&&isObject$1(Y[0]))deepMerge(q,Y[0]);else for(let W=0;W<G.length;W++)isDefined(Y[W])&&(q[G[W]]=Y[W]);return deepMerge(v,q)}function getDefaultsFromInstance(v){return v.constructor.getDefaults()}function defaultArg(v,N){return isUndef(v)?N:v}
vendor: 3,126 bytes, lines 234-239
234function omitFromObject(v,N){return N.forEach(G=>{Reflect.has(v,G)&&delete v[G]}),v}/**
235 * Tone.js
236 * @author Yotam Mann
237 * @license http://opensource.org/licenses/MIT MIT License
238 * @copyright 2014-2024 Yotam Mann
239 */class Tone{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...N){(this.debug||theWindow&&this.toString()===theWindow.TONE_DEBUG_CLASS)&&log$1(this,...N)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}Tone.version=version$2;const EPSILON=1e-6;function GT(v,N){return v>N+EPSILON}function GTE(v,N){return GT(v,N)||EQ(v,N)}function LT(v,N){return v+EPSILON<N}function EQ(v,N){return Math.abs(v-N)<EPSILON}function clamp$1(v,N,G){return Math.max(Math.min(v,G),N)}class Timeline extends Tone{constructor(){super(),this.name="Timeline",this._timeline=[];const N=optionsFromArguments(Timeline.getDefaults(),arguments,["memory"]);this.memory=N.memory,this.increasing=N.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(N){if(assert(Reflect.has(N,"time"),"Timeline: events must have a time attribute"),N.time=N.time.valueOf(),this.increasing&&this.length){const G=this._timeline[this.length-1];assert(GTE(N.time,G.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(N)}else{const G=this._search(N.time);this._timeline.splice(G+1,0,N)}if(this.length>this.memory){const G=this.length-this.memory;this._timeline.splice(0,G)}return this}remove(N){const G=this._timeline.indexOf(N);return G!==-1&&this._timeline.splice(G,1),this}get(N,G="time"){const z=this._search(N,G);return z!==-1?this._timeline[z]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(N,G="time"){const z=this._search(N,G);return z+1<this._timeline.length?this._timeline[z+1]:null}getBefore(N){const G=this._timeline.length;if(G>0&&this._timeline[G-1].time<N)return this._timeline[G-1];const z=this._search(N);return z-1>=0?this._timeline[z-1]:null}cancel(N){if(this._timeline.length>1){let G=this._search(N);if(G>=0)if(EQ(this._timeline[G].time,N)){for(let z=G;z>=0&&EQ(this._timeline[z].time,N);z--)G=z;this._timeline=this._timeline.slice(0,G)}else this._timeline=this._timeline.slice(0,G+1);else this._timeline=[]}else this._timeline.length===1&&GTE(this._timeline[0].time,N)&&(this._timeline=[]);return this}cancelBefore(N){const G=this._search(N);return G>=0&&(this._timeline=this._timeline.slice(G+1)),this}previousEvent(N){const G=this._timeline.indexOf(N);return G>0?this._timeline[G-1]:null}_search(N,G="time"){if(this._timeline.length===0)return-1;let z=0;const q=this._timeline.length;let Y=q;if(q>0&&this._timeline[q-1][G]<=N)return q-1;for(;z<Y;){let W=Math.floor(z+(Y-z)/2);const ie=this._timeline[W],ne=this._timeline[W+1];if(EQ(ie[G],N)){for(let se=W;se<this._timeline.length;se++){const ae=this._timeline[se];if(EQ(ae[G],N))W=se;else break}return W}else{if(LT(ie[G],N)&&GT(ne[G],N))return W;GT(ie[G],N)?Y=W:z=W+1}}return-1}_iterate(N,G=0,z=this._timeline.length-1){this._timeline.slice(G,z+1).forEac
239h(N)}forEach(N){return this._iterate(N),this}forEachBefore(N,G){const z=this._search(N);return z!==-1&&this._iterate(G,0,z),this}forEachAfter(N,G){const z=this._search(N);return this._iterate(G,z+1),this}forEachBetween(N,G,z){let q=this._search(N),Y=this._search(G);return q!==-1&&Y!==-1?(this._timeline[q].time!==N&&(q+=1),this._timeline[Y].time===G&&(Y-=1),this._iterate(z,q,Y)):q===-1&&this._iterate(z,0,Y),this}forEachFrom(N,G){let z=this._search(N);for(;z>=0&&this._timeline[z].time>=N;)z--;return this._iterate(G,z+1),this}forEachAtTime(N,G){const z=this._search(N);if(z!==-1&&EQ(this._timeline[z].time,N)){let q=z;for(let Y=z;Y>=0&&EQ(this._timeline[Y].time,N);Y--)q=Y;this._iterate(Y=>{G(Y)},q,z)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const notifyNewContext=[];function onContextInit(v){notifyNewContext.push(v)}function initializeContext(v){notifyNewContext.forEach(N=>N(v))}const notifyCloseContext=[];function onContextClose(v){notifyCloseContext.push(v)}function closeContext(v){notifyCloseContext.forEach(N=>N(v))}let Emitter$1=class th extends Tone{constructor(){super(...arguments),this.name="Emitter"}on(N,G){return N.split(/\W+/).forEach(q=>{isUndef(this._events)&&(this._events={}),this._events.hasOwnProperty(q)||(this._events[q]=[]),this._events[q].push(G)}),this}once(N,G){const z=(...q)=>{G(...q),this.off(N,z)};return this.on(N,z),this}off(N,G){return N.split(/\W+/).forEach(q=>{if(isUndef(this._events)&&(this._events={}),this._events.hasOwnProperty(q))if(isUndef(G))this._events[q]=[];else{const Y=this._events[q];for(let W=Y.length-1;W>=0;W--)Y[W]===G&&Y.splice(W,1)}}),this}emit(N,...G){if(this._events&&this._events.hasOwnProperty(N)){const z=this._events[N].slice(0);for(let q=0,Y=z.length;q<Y;q++)z[q].apply(this,G)}return this}static mixin(N){["on","once","off","emit"].forEach(G=>{const z=Object.getOwnPropertyDescriptor(th.prototype,G);Object.defineProperty(N.prototype,G,z)})}dispose(){return super.dispose(),this._events=void 0,this}};class BaseContext extends Emitter$1{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Context extends BaseContext{constructor(){var N,G;super(),this.name="Context",this._constants=new Map,this._timeouts=new Timeline,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const z=optionsFromArguments(Context.getDefaults(),arguments,["context"]);z.context?(this._context=z.context,this._latencyHint=((N=arguments[0])===null||N===void 0?void 0:N.latencyHint)||""):(this._context=createAudioContext({latencyHint:z.latencyHint}),this._latencyHint=z.latencyHint),this._ticker=new Ticker(this.emit.bind(this,"tick"),z.clockSource,z.updateInterval,this._context.sampleRate),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this[!((G=arguments[0])===null||G===void 0)&&G.hasOwnProperty("updateInterval")?"_lookAhead":"lookAhead"]=z.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){return this._initialized||(initializeContext(this),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(N,G,z){return this._context.createBuffer(N,G,z)}createChannelMerger(N){return this._context.createChannelMerger(N)}createChannelSplitter(N){return this._context.createChannelSplitter(N)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(N){return this._context.createDelay(N)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(N,G){return this._context.createIIRFilter(N,G)}createPanner(){return this._context.createPanner()}createPeriodicWave(N,G,z){return this._context.createPeriodicWave(N,G,z)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(N){return assert(isAudioContext(this._context),"
239Not available if OfflineAudioContext"),this._context.createMediaStreamSource(N)}createMediaElementSource(N){return assert(isAudioContext(this._context),"Not available if OfflineAudioContext"),this._context.createMediaElementSource(N)}createMediaStreamDestination(){return assert(isAudioContext(this._context),"Not available if OfflineAudioContext"),this._context.createMediaStreamDestination()}decodeAudioData(N){return this._context.decodeAudioData(N)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(N){assert(!this._initialized,"The listener cannot be set after initialization."),this._listener=N}get transport(){return this.initialize(),this._transport}set transport(N){assert(!this._initialized,"The transport cannot be set after initialization."),this._transport=N}get draw(){return this.initialize(),this._draw}set draw(N){assert(!this._initialized,"Draw cannot be set after initialization."),this._draw=N}get destination(){return this.initialize(),this._destination}set destination(N){assert(!this._initialized,"The destination cannot be set after initialization."),this._destination=N}createAudioWorkletNode(N,G){return createAudioWorkletNode(this.rawContext,N,G)}addAudioWorkletModule(N){return __awaiter(this,void 0,void 0,function*(){assert(isDefined(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletPromise||(this._workletPromise=this.rawContext.audioWorklet.addModule(N)),yield this._workletPromise})}workletsAreReady(){return __awaiter(this,void 0,void 0,function*(){(yield this._workletPromise)?this._workletPromise:Promise.resolve()})}get updateInterval(){return this._ticker.updateInterval}set updateInterval(N){this._ticker.updateInterval=N}get clockSource(){return this._ticker.type}set clockSource(N){this._ticker.type=N}get lookAhead(){return this._lookAhead}set lookAhead(N){this._lookAhead=N,this.updateInterval=N?N/2:.01}get latencyHint(){return this._latencyHint}get rawContext(){return this._context}now(){return this._context.currentTime+this._lookAhead}immediate(){return this._context.currentTime}resume(){return isAudioContext(this._context)?this._context.resume():Promise.resolve()}close(){return __awaiter(this,void 0,void 0,function*(){isAudioContext(this._context)&&this.state!=="closed"&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&closeContext(this)})}getConstant(N){if(this._constants.has(N))return this._constants.get(N);{const G=this._context.createBuffer(1,128,this._context.sampleRate),z=G.getChannelData(0);for(let Y=0;Y<z.length;Y++)z[Y]=N;const q=this._context.createBufferSource();return q.channelCount=1,q.channelCountMode="explicit",q.buffer=G,q.loop=!0,q.start(0),this._constants.set(N,q),q}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(N=>this._constants[N].disconnect()),this.close(),this}_timeoutLoop(){const N=this.now();let G=this._timeouts.peek();for(;this._timeouts.length&&G&&G.time<=N;)G.callback(),this._timeouts.shift(),G=this._timeouts.peek()}setTimeout(N,G){this._timeoutIds++;const z=this.now();return this._timeouts.add({callback:N,id:this._timeoutIds,time:z+G}),this._timeoutIds}clearTimeout(N){return this._timeouts.forEach(G=>{G.id===N&&this._timeouts.remove(G)}),this}clearInterval(N){return this.clearTimeout(N)}setInterval(N,G){const z=++this._timeoutIds,q=()=>{const Y=this.now();this._timeouts.add({callback:()=>{N(),q()},id:z,time:Y+G})};return q(),z}}class DummyContext extends BaseContext{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(N,G,z){return{}}createChannelMerger(N){return{}}createChannelSplitter(N){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(N){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(N,G){return{}}createPanner(){return{}}
vendor: 4,509 bytes, line 239
239createPeriodicWave(N,G,z){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(N){return{}}createMediaElementSource(N){return{}}createMediaStreamDestination(){return{}}decodeAudioData(N){return Promise.resolve({})}createAudioWorkletNode(N,G){return{}}get rawContext(){return{}}addAudioWorkletModule(N){return __awaiter(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(N,G){return 0}clearTimeout(N){return this}setInterval(N,G){return 0}clearInterval(N){return this}getConstant(N){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(N){}get destination(){return{}}set destination(N){}now(){return 0}immediate(){return 0}}function readOnly(v,N){isArray$1(N)?N.forEach(G=>readOnly(v,G)):Object.defineProperty(v,N,{enumerable:!0,writable:!1})}function writable(v,N){isArray$1(N)?N.forEach(G=>writable(v,G)):Object.defineProperty(v,N,{writable:!0})}const noOp=()=>{};class ToneAudioBuffer extends Tone{constructor(){super(),this.name="ToneAudioBuffer",this.onload=noOp;const N=optionsFromArguments(ToneAudioBuffer.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=N.reverse,this.onload=N.onload,isString$1(N.url)?this.load(N.url).catch(N.onerror):N.url&&this.set(N.url)}static getDefaults(){return{onerror:noOp,onload:noOp,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:getContext().sampleRate}set(N){return N instanceof ToneAudioBuffer?N.loaded?this._buffer=N.get():N.onload=()=>{this.set(N),this.onload(this)}:this._buffer=N,this._reversed&&this._reverse(),this}get(){return this._buffer}load(N){return __awaiter(this,void 0,void 0,function*(){const G=ToneAudioBuffer.load(N).then(z=>{this.set(z),this.onload(this)});ToneAudioBuffer.downloads.push(G);try{yield G}finally{const z=ToneAudioBuffer.downloads.indexOf(G);ToneAudioBuffer.downloads.splice(z,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(N){const G=isArray$1(N)&&N[0].length>0,z=G?N.length:1,q=G?N[0].length:N.length,Y=getContext(),W=Y.createBuffer(z,q,Y.sampleRate),ie=!G&&z===1?[N]:N;for(let ne=0;ne<z;ne++)W.copyToChannel(ie[ne],ne);return this._buffer=W,this}toMono(N){if(isNumber$1(N))this.fromArray(this.toArray(N));else{let G=new Float32Array(this.length);const z=this.numberOfChannels;for(let q=0;q<z;q++){const Y=this.toArray(q);for(let W=0;W<Y.length;W++)G[W]+=Y[W]}G=G.map(q=>q/z),this.fromArray(G)}return this}toArray(N){if(isNumber$1(N))return this.getChannelData(N);if(this.numberOfChannels===1)return this.toArray(0);{const G=[];for(let z=0;z<this.numberOfChannels;z++)G[z]=this.getChannelData(z);return G}}getChannelData(N){return this._buffer?this._buffer.getChannelData(N):new Float32Array(0)}slice(N,G=this.duration){assert(this.loaded,"Buffer is not loaded");const z=Math.floor(N*this.sampleRate),q=Math.floor(G*this.sampleRate);assert(z<q,"The start time must be less than the end time");const Y=q-z,W=getContext().createBuffer(this.numberOfChannels,Y,this.sampleRate);for(let ie=0;ie<this.numberOfChannels;ie++)W.copyToChannel(this.getChannelData(ie).subarray(z,q),ie);return new ToneAudioBuffer(W)}_reverse(){if(this.loaded)for(let N=0;N<this.numberOfChannels;N++)this.getChannelData(N).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(N){this._reversed!==N&&(this._reversed=N,this._reverse())}static fromArray(N){return new ToneAudioBuffer().fromArray(N)}static fromUrl(N){return __awaiter(this,void 0,void 0,function*(){return yield new ToneAudioBuffer().load(N)})}static load(N){return __awaiter(this,void 0,void 0,function*(){const G=N.match(/\[([^\]\[]+\|.+)\]$/);if(G){const ne=G[1].split("|");let se=ne[0];for(const ae of ne)if(ToneAudioBuffer.supportsType(ae)){se=ae;break}N=N.replace(G[0],se)}const z=ToneAudioBuffer.baseUrl===""||ToneAudioBuffer.baseUrl.endsWith("/")?ToneAudioBuffer.baseUrl:ToneAudioBuffer.baseUrl+"/",q=document.createElement("a");q.href=z+N,q.pathname=(q.pathname+q.hash).split("/").map(encodeURIComponent).join("/");const Y=yield fetch(q.href);if(!Y.ok)throw new Error(`could not load url: ${N}`);const W=yield Y.arrayBuffer();return yield getContext().decodeAudioData(W)})}
239static supportsType(N){const G=N.split("."),z=G[G.length-1];return document.createElement("audio").canPlayType("audio/"+z)!==""}static loaded(){return __awaiter(this,void 0,void 0,function*(){for(yield Promise.resolve();ToneAudioBuffer.downloads.length;)yield ToneAudioBuffer.downloads[0]})}}ToneAudioBuffer.baseUrl="";ToneAudioBuffer.downloads=[];class OfflineContext extends Context{constructor(){super({clockSource:"offline",context:isOfflineAudioContext(arguments[0])?arguments[0]:createOfflineAudioContext(arguments[0],arguments[1]*arguments[2],arguments[2]),lookAhead:0,updateInterval:isOfflineAudioContext(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=isOfflineAudioContext(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(N){return __awaiter(this,void 0,void 0,function*(){let G=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,G++;const z=Math.floor(this.sampleRate/128);N&&G%z===0&&(yield new Promise(q=>setTimeout(q,1)))}})}render(){return __awaiter(this,arguments,void 0,function*(N=!0){yield this.workletsAreReady(),yield this._renderClock(N);const G=yield this._context.startRendering();return new ToneAudioBuffer(G)})}close(){return Promise.resolve()}}const dummyContext=new DummyContext;let globalContext=dummyContext;function getContext(){return globalContext===dummyContext&&hasAudioContext&&setContext(new Context),globalContext}function setContext(v,N=!1){N&&globalContext.dispose(),isAudioContext(v)?globalContext=new Context(v):isOfflineAudioContext(v)?globalContext=new OfflineContext(v):globalContext=v}function start(){return globalContext.resume()}if(theWindow&&!theWindow.TONE_SILENCE_LOGGING){const N=` * Tone.js v${version$2} * `;console.log(`%c${N}`,"background: #000; color: #fff")}function dbToGain(v){return Math.pow(10,v/20)}function gainToDb(v){return 20*(Math.log(v)/Math.LN10)}function intervalToFrequencyRatio(v){return Math.pow(2,v/12)}let A4=440;function getA4(){return A4}function setA4(v){A4=v}function ftom(v){return Math.round(ftomf(v))}function ftomf(v){return 69+12*Math.log2(v/A4)}function mtof(v){return A4*Math.pow(2,(v-69)/12)}class TimeBaseClass extends Tone{constructor(N,G,z){super(),this.defaultUnits="s",this._val=G,this._units=z,this.context=N,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:N=>this._frequencyToUnits(parseFloat(N)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:N=>this._ticksToUnits(parseInt(N,10)),regexp:/^(\d+)i$/i},m:{method:N=>this._beatsToUnits(parseInt(N,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(N,G)=>{const z=parseInt(N,10),q=G==="."?1.5:1;return z===1?this._beatsToUnits(this._getTimeSignature())*q:this._beatsToUnits(4/z)*q},regexp:/^(\d+)n(\.?)$/i},number:{method:N=>this._expressions[this.defaultUnits].method.call(this,N),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:N=>this._secondsToUnits(parseFloat(N)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:N=>parseInt(N,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:N=>{const G=parseInt(N,10);return this._beatsToUnits(8/(Math.floor(G)*3))},regexp:/^(\d+)t$/i},tr:{method:(N,G,z)=>{let q=0;return N&&N!=="0"&&(q+=this._beatsToUnits(this._getTimeSignature()*parseFloat(N))),G&&G!=="0"&&(q+=this._beatsToUnits(parseFloat(G))),z&&z!=="0"&&(q+=this._beatsToUnits(parseFloat(z)/4)),q},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof TimeBaseClass&&this.fromType(this._val),isUndef(this._val))return this._noArg();if(isString$1(this._val)&&isUndef(this._units)){for(const N in this._expressions)if(this._expressions[N].regexp.test(this._val.trim())){this._units=N;break}}else if(isObject$1(this._val)){let N=0;for(const G in this._val)if(isDefined(this._val[G])){const z=this._val[G],q=new this.constructor(this.context,G).valueOf()*z;N+=q}return N}if(isDefined(this._units)){const N=this._expressions[this._units],G=this._val.toString().trim().match(N.regexp);return G?N.method.apply(this,G.slice(1)):N.method.call(this,this._val)}else return isString$1(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(N){return 1/N}_beatsToUnits(N){return 60/this._getBpm()*N}_secondsToUnits(N){return N}_ticksToUnits(N){return N*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(N){switch(this._units=void 0,this.defaultUnits){case"s":this._val=N.toSeconds();break;case"i":this._val=N.toTicks();break;case"hz":this._val=N.toFrequency();break;case"midi":this._val=N.toMidi();break}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return this.toSeconds()*1e3}}class TimeClass extends TimeBaseClass{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:N=>this._now()+new this.constructor(this.context,N).valueOf(),regexp:/^\+(.+)/},quantize:{method:N=>{const G=new TimeClass(this.context,N).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(G))},regexp:/^@(.+)/}})}quantize(N,G=1){const z=new this.constructor(this.context,N).valueOf(),q=this.valueOf(),ie=Math.round(q/z)*z-q;return q+ie*G}toNotation(){const N=this.toSeconds(),G=["1m"];for(let Y=1;Y<9;Y++){const W=Math.pow(2,Y);
239G.push(W+"n."),G.push(W+"n"),G.push(W+"t")}G.push("0");let z=G[0],q=new TimeClass(this.context,G[0]).toSeconds();return G.forEach(Y=>{const W=new TimeClass(this.context,Y).toSeconds();Math.abs(W-N)<Math.abs(q-N)&&(z=Y,q=W)}),z}toBarsBeatsSixteenths(){const N=this._beatsToUnits(1);let G=this.valueOf()/N;G=parseFloat(G.toFixed(4));const z=Math.floor(G/this._getTimeSignature());let q=G%1*4;G=Math.floor(G)%this._getTimeSignature();const Y=q.toString();return Y.length>3&&(q=parseFloat(parseFloat(Y).toFixed(3))),[z,G,q].join(":")}toTicks(){const N=this._beatsToUnits(1);return this.valueOf()/N*this._getPPQ()}toSeconds(){return this.valueOf()}toMidi(){return ftom(this.toFrequency())}_now(){return this.context.now()}}class FrequencyClass extends TimeClass{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return getA4()}static set A4(N){setA4(N)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(N){return this.defaultUnits==="midi"?N:FrequencyClass.mtof(N)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(N,G){const q=noteToScaleIndex[N.toLowerCase()]+(parseInt(G,10)+1)*12;return this.defaultUnits==="midi"?q:FrequencyClass.mtof(q)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(N,G,z){let q=1;return N&&N!=="0"&&(q*=this._beatsToUnits(this._getTimeSignature()*parseFloat(N))),G&&G!=="0"&&(q*=this._beatsToUnits(parseFloat(G))),z&&z!=="0"&&(q*=this._beatsToUnits(parseFloat(z)/4)),q}}})}transpose(N){return new FrequencyClass(this.context,this.valueOf()*intervalToFrequencyRatio(N))}harmonize(N){return N.map(G=>this.transpose(G))}toMidi(){return ftom(this.valueOf())}toNote(){const N=this.toFrequency(),G=Math.log2(N/FrequencyClass.A4);let z=Math.round(12*G)+57;const q=Math.floor(z/12);return q<0&&(z+=-12*q),scaleIndexToNote[z%12]+q.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const N=this._beatsToUnits(1),G=this.valueOf()/N;return Math.floor(G*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(N){return N}_ticksToUnits(N){return 1/(N*60/(this._getBpm()*this._getPPQ()))}_beatsToUnits(N){return 1/super._beatsToUnits(N)}_secondsToUnits(N){return 1/N}static mtof(N){return mtof(N)}static ftom(N){return ftom(N)}}const noteToScaleIndex={cbbb:-3,cbb:-2,cb:-1,c:0,"c#":1,cx:2,"c##":2,"c###":3,"cx#":3,"c#x":3,dbbb:-1,dbb:0,db:1,d:2,"d#":3,dx:4,"d##":4,"d###":5,"dx#":5,"d#x":5,ebbb:1,ebb:2,eb:3,e:4,"e#":5,ex:6,"e##":6,"e###":7,"ex#":7,"e#x":7,fbbb:2,fbb:3,fb:4,f:5,"f#":6,fx:7,"f##":7,"f###":8,"fx#":8,"f#x":8,gbbb:4,gbb:5,gb:6,g:7,"g#":8,gx:9,"g##":9,"g###":10,"gx#":10,"g#x":10,abbb:6,abb:7,ab:8,a:9,"a#":10,ax:11,"a##":11,"a###":12,"ax#":12,"a#x":12,bbbb:8,bbb:9,bb:10,b:11,"b#":12,bx:13,"b##":13,"b###":14,"bx#":14,"b#x":14},scaleIndexToNote=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function Frequency(v,N){return new FrequencyClass(getContext(),v,N)}class TransportTimeClass extends TimeClass{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class ToneWithContext extends Tone{constructor(){super();const N=optionsFromArguments(ToneWithContext.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=N.context}static getDefaults(){return{context:getContext()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(N){return assertUsedScheduleTime(N),new TimeClass(this.context,N).toSeconds()}toFrequency(N){return new FrequencyClass(this.context,N).toFrequency()}toTicks(N){return new TransportTimeClass(this.context,N).toTicks()}_getPartialProperties(N){const G=this.get();return Object.keys(G).forEach(z=>{isUndef(N[z])&&delete G[z]}),G}get(){const N=getDefaultsFromInstance(this);return Object.keys(N).forEach(G=>{if(Reflect.has(this,G)){const z=this[G];isDefined(z)&&isDefined(z.value)&&isDefined(z.setValueAtTime)?N[G]=z.value:z instanceof ToneWithContext?N[G]=z._getPartialProperties(N[G]):isArray$1(z)||isNumber$1(z)||isString$1(z)||isBoolean$1(z)?N[G]=z:delete N[G]}}),N}
239set(N){return Object.keys(N).forEach(G=>{Reflect.has(this,G)&&isDefined(this[G])&&(this[G]&&isDefined(this[G].value)&&isDefined(this[G].setValueAtTime)?this[G].value!==N[G]&&(this[G].value=N[G]):this[G]instanceof ToneWithContext?this[G].set(N[G]):this[G]=N[G])}),this}}class StateTimeline extends Timeline{constructor(N="stopped"){super(),this.name="StateTimeline",this._initial=N,this.setStateAtTime(this._initial,0)}getValueAtTime(N){const G=this.get(N);return G!==null?G.state:this._initial}setStateAtTime(N,G,z){return assertRange(G,0),this.add(Object.assign({},z,{state:N,time:G})),this}getLastState(N,G){const z=this._search(G);for(let q=z;q>=0;q--){const Y=this._timeline[q];if(Y.state===N)return Y}}getNextState(N,G){const z=this._search(G);if(z!==-1)for(let q=z;q<this._timeline.length;q++){const Y=this._timeline[q];if(Y.state===N)return Y}}}class Param extends ToneWithContext{constructor(){const N=optionsFromArguments(Param.getDefaults(),arguments,["param","units","convert"]);for(super(N),this.name="Param",this.overridden=!1,this._minOutput=1e-7,assert(isDefined(N.param)&&(isAudioParam(N.param)||N.param instanceof Param),"param must be an AudioParam");!isAudioParam(N.param);)N.param=N.param._param;this._swappable=isDefined(N.swappable)?N.swappable:!1,this._swappable?(this.input=this.context.createGain(),this._param=N.param,this.input.connect(this._param)):this._param=this.input=N.param,this._events=new Timeline(1e3),this._initialValue=this._param.defaultValue,this.units=N.units,this.convert=N.convert,this._minValue=N.minValue,this._maxValue=N.maxValue,isDefined(N.value)&&N.value!==this._toType(this._initialValue)&&this.setValueAtTime(N.value,0)}static getDefaults(){return Object.assign(ToneWithContext.getDefaults(),{convert:!0,units:"number"})}get value(){const N=this.now();return this.getValueAtTime(N)}set value(N){this.cancelScheduledValues(this.now()),this.setValueAtTime(N,this.now())}get minValue(){return isDefined(this._minValue)?this._minValue:this.units==="time"||this.units==="frequency"||this.units==="normalRange"||this.units==="positive"||this.units==="transportTime"||this.units==="ticks"||this.units==="bpm"||this.units==="hertz"||this.units==="samples"?0:this.units==="audioRange"?-1:this.units==="decibels"?-1/0:this._param.minValue}get maxValue(){return isDefined(this._maxValue)?this._maxValue:this.units==="normalRange"||this.units==="audioRange"?1:this._param.maxValue}_is(N,G){return this.units===G}_assertRange(N){return isDefined(this.maxValue)&&isDefined(this.minValue)&&assertRange(N,this._fromType(this.minValue),this._fromType(this.maxValue)),N}_fromType(N){return this.convert&&!this.overridden?this._is(N,"time")?this.toSeconds(N):this._is(N,"decibels")?dbToGain(N):this._is(N,"frequency")?this.toFrequency(N):N:this.overridden?0:N}_toType(N){return this.convert&&this.units==="decibels"?gainToDb(N):N}setValueAtTime(N,G){const z=this.toSeconds(G),q=this._fromType(N);return assert(isFinite(q)&&isFinite(z),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(N)}, ${JSON.stringify(G)}`),this._assertRange(q),this.log(this.units,"setValueAtTime",N,z),this._events.add({time:z,type:"setValueAtTime",value:q}),this._param.setValueAtTime(q,z),this}getValueAtTime(N){const G=Math.max(this.toSeconds(N),0),z=this._events.getAfter(G),q=this._events.get(G);let Y=this._initialValue;if(q===null)Y=this._initialValue;else if(q.type==="setTargetAtTime"&&(z===null||z.type==="setValueAtTime")){const W=this._events.getBefore(q.time);let ie;W===null?ie=this._initialValue:ie=W.value,q.type==="setTargetAtTime"&&(Y=this._exponentialApproach(q.time,ie,q.value,q.constant,G))}else if(z===null)Y=q.value;else if(z.type==="linearRampToValueAtTime"||z.type==="exponentialRampToValueAtTime"){let W=q.value;if(q.type==="setTargetAtTime"){const ie=this._events.getBefore(q.time);ie===null?W=this._initialValue:W=ie.value}z.type==="linearRampToValueAtTime"?Y=this._linearInterpolate(q.time,W,z.time,z.value,G):Y=this._exponentialInterpolate(q.time,W,z.time,z.value,G)}else Y=q.value;return this._toType(Y)}setRampPoint(N){N=this.toSeconds(N);let G=this.getValueAtTime(N);return this.cancelAndHoldAtTime(N),this._fromType(G)===0&&(G=this._toType(this._minOutput)),this.setValueAtTime(G,N),this}linearRampToValueAtTime(N,G){const z=this._fromType(N),q=this.toSeconds(G);return assert(isFinite(z)&&isFinite(q),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(N)}, ${JSON.stringify(G)}`),this._assertRange(z),this._events.add({time:q,type:"linearRampToValueAtTime",value:z}),this.log(this.units,"linearRampToValueAtTime",N,q),this._param.linearRampToValueAtTime(z,q),this}exponentialRampToValueAtTime(N,G){let z=this._fromType(N);z=EQ(z,0)?this._minOutput:z,this._assertRange(z);const q=this.toSeconds(G);return assert(isFinite(z)&&isFinite(q),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(N)}, ${JSON.stringify(G)}`),this._events.add({time:q,type:"exponentialRampToValueAtTime",value:z}),this.log(this.units,"exponentialRampToValueAtTime",N,q),this._param.exponentialRampToValueAtTime(z,q),this}exponentialRampTo(N,G,z){return z=this.toSeconds(z),this.setRampPoint(z),this.exponentialRampToValueAtTime(N,z+this.toSeconds(G)),this}linearRampTo(N,G,z){return z=this.toSeconds(z),this.setRampPoint(z),this.linearRampToValueAtTime(N,z+this.toSeconds(G)),this}targetRampTo(N,G,z){return z=this.toSeconds(z),this.setRampPoint(z),this.exponentialApproachValueAtTime(N,z,G),this}exponentialApproachValueAtTime(N,G,z){G=this.toSeconds(G),z=this.toSeconds(z);const q=Math.log(z+1)/Math.log(200);return this.setTargetAtTime(N,G,q),this.cancelAndHoldAtTime(G+z*.9),this.linearRampToValueAtTime(N,G+z),this}setTargetAtTime(N,G,z){const q=this._fromType(N);assert(isFinite(z)&&z>0,"timeConstant must be a number greater than 0");const Y=this.toSeconds(G);return this._assertRange(q),assert(isFinite(q)&&isFinite(Y),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(N)}, ${JSON.stringify(G)}`),this._events.add({constant:z,time:Y,type:"setTargetAtTime",value:q}),this.log(this.units,"setTargetAtTime",N,Y,z),this._param.setTargetAtTime(q,Y,z),this}setValueCurveAtTime(N,G,z,q=1){z=this.toSeconds(z),G=this.toSeconds(G);const Y=this._fromType(N[0])*q;this.setValueAtTime(this._toType(Y),G);const W=z/(N.length-1);for(let ie=1;ie<N.length;ie++){const ne=this._fromType(N[ie])*q;this.linearRampToValueAtTime(this._toType(ne),G+ie*W)}return this}cancelScheduledValues(N){const G=this.toSeconds(N);return assert(isFinite(G),`Invalid argument to cancelScheduledValues: ${JSON.stringify(N)}`),this._events.cancel(G),this._param.cancelScheduledValues(G),this.log(this.units,"cancelScheduledValues",G),this}cancelAndHoldAtTime(N){const G=this.toSeconds(N),z=this._fromType(this.getValueAtTime(G));assert(isFinite(G),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(N)}`),this.log(this.units,"cancelAndHoldAtTime",G,"value="+z);const q=this._events.get(G),Y=this._events.getAfter(G);return q&&EQ(q.time,G)?Y?(this._param.cancelScheduledValues(Y.time),this._events.cancel(Y.time)):(this._param.cancelAndHoldAtTime(G),this._events.cancel(G+this.sampleTime)):Y&&(this._param.cancelScheduledValues(Y.time),this._events.cancel(Y.time),Y.type==="linearRampToValueAtTime"?this.linearRampToValueAtTime(this._toType(z),G):Y.type==="exponentialRampToValueAtTime"&&this.exponentialRampToValueAtTime(this._toType(z),G)),this._events.add({time:G,type:"setValueAtTime",value:z}),this._param.setValueAtTime(z,G),this}rampTo(N,G=.1,z){return this.units==="frequency"||this.units==="bpm"||this.units==="decibels"?this.exponentialRampTo(N,G,z):this.linearRampTo(N,G,z),this}apply(N){const G=this.context.currentTime;N.setValueAtTime(this.getValueAtTime(G),G);const z=this._events.get(G);if(z&&z.type==="setTargetAtTime"){const q=this._events.getAfter(z.time),Y=q?q.time:G+2,W=(Y-G)/10;for(let ie=G;ie<Y;ie+=W)N.linearRampToValueAtTime(this.getValueAtTime(ie),ie)}
vendor: 4,805 bytes, line 239
239return this._events.forEachAfter(this.context.currentTime,q=>{q.type==="cancelScheduledValues"?N.cancelScheduledValues(q.time):q.type==="setTargetAtTime"?N.setTargetAtTime(q.value,q.time,q.constant):N[q.type](q.value,q.time)}),this}setParam(N){assert(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const G=this.input;return G.disconnect(this._param),this.apply(N),this._param=N,G.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(N,G,z,q,Y){return z+(G-z)*Math.exp(-(Y-N)/q)}_linearInterpolate(N,G,z,q,Y){return G+(q-G)*((Y-N)/(z-N))}_exponentialInterpolate(N,G,z,q,Y){return G*Math.pow(q/G,(Y-N)/(z-N))}}class ToneAudioNode extends ToneWithContext{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return isDefined(this.input)?isAudioParam(this.input)||this.input instanceof Param?1:this.input.numberOfInputs:0}get numberOfOutputs(){return isDefined(this.output)?this.output.numberOfOutputs:0}_isAudioNode(N){return isDefined(N)&&(N instanceof ToneAudioNode||isAudioNode(N))}_getInternalNodes(){const N=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&N.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&N.push(this.output),N}_setChannelProperties(N){this._getInternalNodes().forEach(z=>{z.channelCount=N.channelCount,z.channelCountMode=N.channelCountMode,z.channelInterpretation=N.channelInterpretation})}_getChannelProperties(){const N=this._getInternalNodes();assert(N.length>0,"ToneAudioNode does not have any internal nodes");const G=N[0];return{channelCount:G.channelCount,channelCountMode:G.channelCountMode,channelInterpretation:G.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(N){const G=this._getChannelProperties();this._setChannelProperties(Object.assign(G,{channelCount:N}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(N){const G=this._getChannelProperties();this._setChannelProperties(Object.assign(G,{channelCountMode:N}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(N){const G=this._getChannelProperties();this._setChannelProperties(Object.assign(G,{channelInterpretation:N}))}connect(N,G=0,z=0){return connect(this,N,G,z),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return warn("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(N,G=0,z=0){return disconnect(this,N,G,z),this}chain(...N){return connectSeries(this,...N),this}fan(...N){return N.forEach(G=>this.connect(G)),this}dispose(){return super.dispose(),isDefined(this.input)&&(this.input instanceof ToneAudioNode?this.input.dispose():isAudioNode(this.input)&&this.input.disconnect()),isDefined(this.output)&&(this.output instanceof ToneAudioNode?this.output.dispose():isAudioNode(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function connectSeries(...v){const N=v.shift();v.reduce((G,z)=>(G instanceof ToneAudioNode?G.connect(z):isAudioNode(G)&&connect(G,z),z),N)}function connect(v,N,G=0,z=0){for(assert(isDefined(v),"Cannot connect from undefined node"),assert(isDefined(N),"Cannot connect to undefined node"),(N instanceof ToneAudioNode||isAudioNode(N))&&assert(N.numberOfInputs>0,"Cannot connect to node with no inputs"),assert(v.numberOfOutputs>0,"Cannot connect from node with no outputs");N instanceof ToneAudioNode||N instanceof Param;)isDefined(N.input)&&(N=N.input);for(;v instanceof ToneAudioNode;)isDefined(v.output)&&(v=v.output);isAudioParam(N)?v.connect(N,G):v.connect(N,G,z)}function disconnect(v,N,G=0,z=0){if(isDefined(N))for(;N instanceof ToneAudioNode;)N=N.input;for(;!isAudioNode(v);)isDefined(v.output)&&(v=v.output);isAudioParam(N)?v.disconnect(N,G):isAudioNode(N)?v.disconnect(N,G,z):v.disconnect()}class Gain extends ToneAudioNode{constructor(){const N=optionsFromArguments(Gain.getDefaults(),arguments,["gain","units"]);super(N),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode,this.gain=new Param({context:this.context,convert:N.convert,param:this._gainNode.gain,units:N.units,value:N.gain,minValue:N.minValue,maxValue:N.maxValue}),readOnly(this,"gain")}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class OneShotSource extends ToneAudioNode{constructor(N){super(N),this.onended=noOp,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new Gain({context:this.context,gain:0}
239),this._gainNode=this.output,this.getStateAtTime=function(G){const z=this.toSeconds(G);return this._startTime!==-1&&z>=this._startTime&&(this._stopTime===-1||z<=this._stopTime)?"started":"stopped"},this._fadeIn=N.fadeIn,this._fadeOut=N.fadeOut,this._curve=N.curve,this.onended=N.onended}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:noOp})}_startGain(N,G=1){assert(this._startTime===-1,"Source cannot be started more than once");const z=this.toSeconds(this._fadeIn);return this._startTime=N+z,this._startTime=Math.max(this._startTime,this.context.currentTime),z>0?(this._gainNode.gain.setValueAtTime(0,N),this._curve==="linear"?this._gainNode.gain.linearRampToValueAtTime(G,N+z):this._gainNode.gain.exponentialApproachValueAtTime(G,N,z)):this._gainNode.gain.setValueAtTime(G,N),this}stop(N){return this.log("stop",N),this._stopGain(this.toSeconds(N)),this}_stopGain(N){assert(this._startTime!==-1,"'start' must be called before 'stop'"),this.cancelStop();const G=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(N)+G,this._stopTime=Math.max(this._stopTime,this.now()),G>0?this._curve==="linear"?this._gainNode.gain.linearRampTo(0,G,N):this._gainNode.gain.targetRampTo(0,G,N):(this._gainNode.gain.cancelAndHoldAtTime(N),this._gainNode.gain.setValueAtTime(0,N)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{const z=this._curve==="exponential"?G*2:0;this._stopSource(this.now()+z),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==noOp&&(this.onended(this),this.onended=noOp,!this.context.isOffline)){const N=()=>this.dispose();typeof window.requestIdleCallback<"u"?window.requestIdleCallback(N):setTimeout(N,1e3)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),assert(this._startTime!==-1,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}
vendor: 7,771 bytes, line 239
239dispose(){return super.dispose(),this._gainNode.dispose(),this.onended=noOp,this}}class ToneConstantSource extends OneShotSource{constructor(){const N=optionsFromArguments(ToneConstantSource.getDefaults(),arguments,["offset"]);super(N),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),connect(this._source,this._gainNode),this.offset=new Param({context:this.context,convert:N.convert,param:this._source.offset,units:N.units,value:N.offset,minValue:N.minValue,maxValue:N.maxValue})}static getDefaults(){return Object.assign(OneShotSource.getDefaults(),{convert:!0,offset:1,units:"number"})}start(N){const G=this.toSeconds(N);return this.log("start",G),this._startGain(G),this._source.start(G),this}_stopSource(N){this._source.stop(N)}dispose(){return super.dispose(),this.state==="started"&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class Signal extends ToneAudioNode{constructor(){const N=optionsFromArguments(Signal.getDefaults(),arguments,["value","units"]);super(N),this.name="Signal",this.override=!0,this.output=this._constantSource=new ToneConstantSource({context:this.context,convert:N.convert,offset:N.value,units:N.units,minValue:N.minValue,maxValue:N.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{convert:!0,units:"number",value:0})}connect(N,G=0,z=0){return connectSignal(this,N,G,z),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(N,G){return this._param.setValueAtTime(N,G),this}getValueAtTime(N){return this._param.getValueAtTime(N)}setRampPoint(N){return this._param.setRampPoint(N),this}linearRampToValueAtTime(N,G){return this._param.linearRampToValueAtTime(N,G),this}exponentialRampToValueAtTime(N,G){return this._param.exponentialRampToValueAtTime(N,G),this}exponentialRampTo(N,G,z){return this._param.exponentialRampTo(N,G,z),this}linearRampTo(N,G,z){return this._param.linearRampTo(N,G,z),this}targetRampTo(N,G,z){return this._param.targetRampTo(N,G,z),this}exponentialApproachValueAtTime(N,G,z){return this._param.exponentialApproachValueAtTime(N,G,z),this}setTargetAtTime(N,G,z){return this._param.setTargetAtTime(N,G,z),this}setValueCurveAtTime(N,G,z,q){return this._param.setValueCurveAtTime(N,G,z,q),this}cancelScheduledValues(N){return this._param.cancelScheduledValues(N),this}cancelAndHoldAtTime(N){return this._param.cancelAndHoldAtTime(N),this}rampTo(N,G,z){return this._param.rampTo(N,G,z),this}get value(){return this._param.value}set value(N){this._param.value=N}get convert(){return this._param.convert}set convert(N){this._param.convert=N}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(N){this._param.overridden=N}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(N){return this._param.apply(N),this}}function connectSignal(v,N,G,z){(N instanceof Param||isAudioParam(N)||N instanceof Signal&&N.override)&&(N.cancelScheduledValues(0),N.setValueAtTime(0,0),N instanceof Signal&&(N.overridden=!0)),connect(v,N,G,z)}class TickParam extends Param{constructor(){const N=optionsFromArguments(TickParam.getDefaults(),arguments,["value"]);super(N),this.name="TickParam",this._events=new Timeline(1/0),this._multiplier=1,this._multiplier=N.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(N.value)}),this.setValueAtTime(N.value,0)}static getDefaults(){return Object.assign(Param.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(N,G,z){G=this.toSeconds(G),this.setRampPoint(G);const q=this._fromType(N),Y=this._events.get(G),W=Math.round(Math.max(1/z,1));for(let ie=0;ie<=W;ie++){const ne=z*ie+G,se=this._exponentialApproach(Y.time,Y.value,q,z,ne);this.linearRampToValueAtTime(this._toType(se),ne)}return this}setValueAtTime(N,G){const z=this.toSeconds(G);super.setValueAtTime(N,G);const q=this._events.get(z),Y=this._events.previousEvent(q),W=this._getTicksUntilEvent(Y,z);return q.ticks=Math.max(W,0),this}linearRampToValueAtTime(N,G){const z=this.toSeconds(G);super.linearRampToValueAtTime(N,G);const q=this._events.get(z),Y=this._events.previousEvent(q),W=this._getTicksUntilEvent(Y,z);return q.ticks=Math.max(W,0),this}exponentialRampToValueAtTime(N,G){G=this.toSeconds(G);const z=this._fromType(N),q=this._events.get(G),Y=Math.round(Math.max((G-q.time)*10,1)),W=(G-q.time)/Y;for(let ie=0;ie<=Y;ie++){const ne=W*ie+q.time,se=this._exponentialInterpolate(q.time,q.value,G,z,ne);this.linearRampToValueAtTime(this._toType(se),ne)}return this}_getTicksUntilEvent(N,G){if(N===null)N={ticks:0,time:0,type:"setValueAtTime",value:0};else if(isUndef(N.ticks)){const W=this._events.previousEvent(N);N.ticks=this._getTicksUntilEvent(W,N.time)}const z=this._fromType(this.getValueAtTime(N.time));let q=this._fromType(this.getValueAtTime(G));const Y=this._events.get(G);return Y&&Y.time===G&&Y.type==="setValueAtTime"&&(q=this._fromType(this.getValueAtTime(G-this.sampleTime))),.5*(G-N.time)*(z+q)+N.ticks}getTicksAtTime(N){const G=this.toSeconds(N),z=this._events.get(G);return Math.max(this._getTicksUntilEvent(z,G),0)}getDurationOfTicks(N,G){const z=this.toSeconds(G),q=this.getTicksAtTime(G);return this.getTimeOfTick(q+N)-z}getTimeOfTick(N){const G=this._events.get(N,"ticks"),z=this._events.getAfter(N,"ticks");if(G&&G.ticks===N)return G.time;if(G&&z&&z.type==="linearRampToValueAtTime"&&G.value!==z.value){const q=this._fromType(this.getValueAtTime(G.time)),W=(this._fromType(this.getValueAtTime(z.time))-q)/(z.time-G.time),ie=Math.sqrt(Math.pow(q,2)-2*W*(G.ticks-N)),ne=(-q+ie)/W,se=(-q-ie)/W;return(ne>0?ne:se)+G.time}else return G?G.value===0?1/0:G.time+(N-G.ticks)/G.value:N/this._initialValue}ticksToTime(N,G){return this.getDurationOfTicks(N,G)}timeToTicks(N,G){const z=this.toSeconds(G),q=this.toSeconds(N),Y=this.getTicksAtTime(z);return this.getTicksAtTime(z+q)-Y}_fromType(N){return this.units==="bpm"&&this.multiplier?1/(60/N/this.multiplier):super._fromType(N)}_toType(N){return this.units==="bpm"&&this.multiplier?N/this.multiplier*60:super._toType(N)}get multiplier(){return this._multiplier}set multiplier(N){const G=this.value;this._multiplier=N,this.cancelScheduledValues(0),this.setValueAtTime(G,0)}}class TickSignal extends Signal{constructor(){const N=optionsFromArguments(TickSignal.getDefaults(),arguments,["value"]);super(N),this.name="TickSignal",this.input=this._param=new TickParam({context:this.context,convert:N.convert,multiplier:N.multiplier,param:this._constantSource.offset,units:N.units,value:N.value})}static getDefaults(){return Object.assign(Signal.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(N,G){return this._param.ticksToTime(N,G)}timeToTicks(N,G){return this._param.timeToTicks(N,G)}getTimeOfTick(N){return this._param.getTimeOfTick(N)}getDurationOfTicks(N,G){return this._param.getDurationOfTicks(N,G)}getTicksAtTime(N){return this._param.getTicksAtTime(N)}get multiplier(){return this._param.multiplier}set multiplier(N){this._param.multiplier=N}dispose(){return super.dispose(),this._param.dispose(),this}}class TickSource extends ToneWithContext{constructor(){const N=optionsFromArguments(TickSource.getDefaults(),arguments,["frequency"]);super(N),this.name="TickSource",this._state=new StateTimeline,this._tickOffset=new Timeline,this._ticksAtTime=new Timeline,this._secondsAtTime=new Timeline,this.frequency=new TickSignal({context:this.context,units:N.units,value:N.frequency}),readOnly(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},ToneWithContext.getDefaults())}
239get state(){return this.getStateAtTime(this.now())}start(N,G){const z=this.toSeconds(N);return this._state.getValueAtTime(z)!=="started"&&(this._state.setStateAtTime("started",z),isDefined(G)&&this.setTicksAtTime(G,z),this._ticksAtTime.cancel(z),this._secondsAtTime.cancel(z)),this}stop(N){const G=this.toSeconds(N);if(this._state.getValueAtTime(G)==="stopped"){const z=this._state.get(G);z&&z.time>0&&(this._tickOffset.cancel(z.time),this._state.cancel(z.time))}return this._state.cancel(G),this._state.setStateAtTime("stopped",G),this.setTicksAtTime(0,G),this._ticksAtTime.cancel(G),this._secondsAtTime.cancel(G),this}pause(N){const G=this.toSeconds(N);return this._state.getValueAtTime(G)==="started"&&(this._state.setStateAtTime("paused",G),this._ticksAtTime.cancel(G),this._secondsAtTime.cancel(G)),this}cancel(N){return N=this.toSeconds(N),this._state.cancel(N),this._tickOffset.cancel(N),this._ticksAtTime.cancel(N),this._secondsAtTime.cancel(N),this}getTicksAtTime(N){const G=this.toSeconds(N),z=this._state.getLastState("stopped",G),q=this._ticksAtTime.get(G),Y={state:"paused",time:G};this._state.add(Y);let W=q||z,ie=q?q.ticks:0,ne=null;return this._state.forEachBetween(W.time,G+this.sampleTime,se=>{let ae=W.time;const ce=this._tickOffset.get(se.time);ce&&ce.time>=W.time&&(ie=ce.ticks,ae=ce.time),W.state==="started"&&se.state!=="started"&&(ie+=this.frequency.getTicksAtTime(se.time)-this.frequency.getTicksAtTime(ae),se.time!==Y.time&&(ne={state:se.state,time:se.time,ticks:ie})),W=se}),this._state.remove(Y),ne&&this._ticksAtTime.add(ne),ie}get ticks(){return this.getTicksAtTime(this.now())}set ticks(N){this.setTicksAtTime(N,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(N){const G=this.now(),z=this.frequency.timeToTicks(N,G);this.setTicksAtTime(z,G)}getSecondsAtTime(N){N=this.toSeconds(N);const G=this._state.getLastState("stopped",N),z={state:"paused",time:N};this._state.add(z);const q=this._secondsAtTime.get(N);let Y=q||G,W=q?q.seconds:0,ie=null;return this._state.forEachBetween(Y.time,N+this.sampleTime,ne=>{let se=Y.time;const ae=this._tickOffset.get(ne.time);ae&&ae.time>=Y.time&&(W=ae.seconds,se=ae.time),Y.state==="started"&&ne.state!=="started"&&(W+=ne.time-se,ne.time!==z.time&&(ie={state:ne.state,time:ne.time,seconds:W})),Y=ne}),this._state.remove(z),ie&&this._secondsAtTime.add(ie),W}setTicksAtTime(N,G){return G=this.toSeconds(G),this._tickOffset.cancel(G),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(N,G),ticks:N,time:G}),this._ticksAtTime.cancel(G),this._secondsAtTime.cancel(G),this}getStateAtTime(N){return N=this.toSeconds(N),this._state.getValueAtTime(N)}getTimeOfTick(N,G=this.now()){const z=this._tickOffset.get(G),q=this._state.get(G),Y=Math.max(z.time,q.time),W=this.frequency.getTicksAtTime(Y)+N-z.ticks;return this.frequency.getTimeOfTick(W)}forEachTickBetween(N,G,z){let q=this._state.get(N);this._state.forEachBetween(N,G,W=>{q&&q.state==="started"&&W.state!=="started"&&this.forEachTickBetween(Math.max(q.time,N),W.time-this.sampleTime,z),q=W});let Y=null;if(q&&q.state==="started"){const W=Math.max(q.time,N),ie=this.frequency.getTicksAtTime(W),ne=this.frequency.getTicksAtTime(q.time),se=ie-ne;let ae=Math.ceil(se)-se;ae=EQ(ae,1)?0:ae;let ce=this.frequency.getTimeOfTick(ie+ae);for(;ce<G;){try{z(ce,Math.round(this.getTicksAtTime(ce)))}catch(pe){Y=pe;break}ce+=this.frequency.getDurationOfTicks(1,ce)}}if(Y)throw Y;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this._ticksAtTime.dispose(),this._secondsAtTime.dispose(),this.frequency.dispose(),this}}class Clock extends ToneWithContext{constructor(){const N=optionsFromArguments(Clock.getDefaults(),arguments,["callback","frequency"]);super(N),this.name="Clock",this.callback=noOp,this._lastUpdate=0,this._state=new StateTimeline("stopped"),this._boundLoop=this._loop.bind(this),this.callback=N.callback,this._tickSource=new TickSource({context:this.context,frequency:N.frequency,units:N.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,readOnly(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(ToneWithContext.getDefaults(),{callback:noOp,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(N,G){assertContextRunning(this.context);const z=this.toSeconds(N);return this.log("start",z),this._state.getValueAtTime(z)!=="started"&&(this._state.setStateAtTime("started",z),this._tickSource.start(z,G),z<this._lastUpdate&&this.emit
vendor: 5,324 bytes, line 239
239("start",z,G)),this}stop(N){const G=this.toSeconds(N);return this.log("stop",G),this._state.cancel(G),this._state.setStateAtTime("stopped",G),this._tickSource.stop(G),G<this._lastUpdate&&this.emit("stop",G),this}pause(N){const G=this.toSeconds(N);return this._state.getValueAtTime(G)==="started"&&(this._state.setStateAtTime("paused",G),this._tickSource.pause(G),G<this._lastUpdate&&this.emit("pause",G)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(N){this._tickSource.ticks=N}get seconds(){return this._tickSource.seconds}set seconds(N){this._tickSource.seconds=N}getSecondsAtTime(N){return this._tickSource.getSecondsAtTime(N)}setTicksAtTime(N,G){return this._tickSource.setTicksAtTime(N,G),this}getTimeOfTick(N,G=this.now()){return this._tickSource.getTimeOfTick(N,G)}getTicksAtTime(N){return this._tickSource.getTicksAtTime(N)}nextTickTime(N,G){const z=this.toSeconds(G),q=this.getTicksAtTime(z);return this._tickSource.getTimeOfTick(q+N,z)}_loop(){const N=this._lastUpdate,G=this.now();this._lastUpdate=G,this.log("loop",N,G),N!==G&&(this._state.forEachBetween(N,G,z=>{switch(z.state){case"started":const q=this._tickSource.getTicksAtTime(z.time);this.emit("start",z.time,q);break;case"stopped":z.time!==0&&this.emit("stop",z.time);break;case"paused":this.emit("pause",z.time);break}}),this._tickSource.forEachTickBetween(N,G,(z,q)=>{this.callback(z,q)}))}getStateAtTime(N){const G=this.toSeconds(N);return this._state.getValueAtTime(G)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Emitter$1.mixin(Clock);class Delay extends ToneAudioNode{constructor(){const N=optionsFromArguments(Delay.getDefaults(),arguments,["delayTime","maxDelay"]);super(N),this.name="Delay";const G=this.toSeconds(N.maxDelay);this._maxDelay=Math.max(G,this.toSeconds(N.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(G),this.delayTime=new Param({context:this.context,param:this._delayNode.delayTime,units:"time",value:N.delayTime,minValue:0,maxValue:this.maxDelay}),readOnly(this,"delayTime")}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}}class Volume extends ToneAudioNode{constructor(){const N=optionsFromArguments(Volume.getDefaults(),arguments,["volume"]);super(N),this.name="Volume",this.input=this.output=new Gain({context:this.context,gain:N.volume,units:"decibels"}),this.volume=this.output.gain,readOnly(this,"volume"),this._unmutedVolume=N.volume,this.mute=N.mute}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(N){!this.mute&&N?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!N&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}}class DestinationClass extends ToneAudioNode{constructor(){const N=optionsFromArguments(DestinationClass.getDefaults(),arguments);super(N),this.name="Destination",this.input=new Volume({context:this.context}),this.output=new Gain({context:this.context}),this.volume=this.input.volume,connectSeries(this.input,this.output,this.context.rawContext.destination),this.mute=N.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(N){this.input.mute=N}chain(...N){return this.input.disconnect(),N.unshift(this.input),N.push(this.output),connectSeries(...N),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}onContextInit(v=>{v.destination=new DestinationClass({context:v})});onContextClose(v=>{v.destination.dispose()});class ListenerClass extends ToneAudioNode{constructor(){super(...arguments),this.name="Listener",this.positionX=new Param({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new Param({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new Param({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new Param({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new Param({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new Param({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new Param({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new Param({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new Param({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dis
239pose(),this.upZ.dispose(),this}}onContextInit(v=>{v.listener=new ListenerClass({context:v})});onContextClose(v=>{v.listener.dispose()});class ToneAudioBuffers extends Tone{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const N=optionsFromArguments(ToneAudioBuffers.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=N.baseUrl,Object.keys(N.urls).forEach(G=>{this._loadingCount++;const z=N.urls[G];this.add(G,z,this._bufferLoaded.bind(this,N.onload),N.onerror)})}static getDefaults(){return{baseUrl:"",onerror:noOp,onload:noOp,urls:{}}}has(N){return this._buffers.has(N.toString())}get(N){return assert(this.has(N),`ToneAudioBuffers has no buffer named: ${N}`),this._buffers.get(N.toString())}_bufferLoaded(N){this._loadingCount--,this._loadingCount===0&&N&&N()}get loaded(){return Array.from(this._buffers).every(([N,G])=>G.loaded)}add(N,G,z=noOp,q=noOp){return isString$1(G)?(this.baseUrl&&G.trim().substring(0,11).toLowerCase()==="data:audio/"&&(this.baseUrl=""),this._buffers.set(N.toString(),new ToneAudioBuffer(this.baseUrl+G,z,q))):this._buffers.set(N.toString(),new ToneAudioBuffer(G,z,q)),this}dispose(){return super.dispose(),this._buffers.forEach(N=>N.dispose()),this._buffers.clear(),this}}class TicksClass extends TransportTimeClass{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(N){return this._getPPQ()*N}_secondsToUnits(N){return Math.floor(N/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(N){return N}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class DrawClass extends ToneWithContext{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Timeline,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(N,G){return this._events.add({callback:N,time:this.toSeconds(G)}),this._events.length===1&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(N){return this._events.cancel(this.toSeconds(N)),this}_drawLoop(){const N=this.context.currentTime;for(;this._events.length&&this._events.peek().time-this.anticipation<=N;){const G=this._events.shift();G&&N-G.time<=this.expiration&&G.callback()}this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}onContextInit(v=>{v.draw=new DrawClass({context:v})});onContextClose(v=>{v.draw.dispose()});class IntervalTimeline extends Tone{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(N){assert(isDefined(N.time),"Events must have a time property"),assert(isDefined(N.duration),"Events must have a duration parameter"),N.time=N.time.valueOf();let G=new IntervalNode(N.time,N.time+N.duration,N);for(this._root===null?this._root=G:this._root.insert(G),this._length++;G!==null;)G.updateHeight(),G.updateMax(),this._rebalance(G),G=G.parent;return this}remove(N){if(this._root!==null){const G=[];this._root.search(N.time,G);for(const z of G)if(z.event===N){this._removeNode(z),this._length--;break}}return this}get length(){return this._length}cancel(N){return this.forEachFrom(N,G=>this.remove(G)),this}_setRoot(N){this._root=N,this._root!==null&&(this._root.parent=null)}_replaceNodeInParent(N,G){N.parent!==null?(N.isLeftChild()?N.parent.left=G:N.parent.right=G,this._rebalance(N.parent)):this._setRoot(G)}_removeNode(N){if(N.left===null&&N.right===null)this._replaceNodeInParent(N,null);else if(N.right===null)this._replaceNodeInParent(N,N.left);else if(N.left===null)this._replaceNodeInParent(N,N.right);else{const G=N.getBalance();let z,q=null;if(G>0)if(N.left.right===null)z=N.left,z.right=N.right,q=z;else{for(z=N.left.right;z.right!==null;)z=z.right;z.parent&&(z.parent.right=z.left,q=z.parent,z.left=N.left,z.right=N.right)}else if(N.right.left===null)z=N.right,z.left=N.left,q=z;else{for(z=N.right.left;z.left!==null;)z=z.left;z.parent&&(z.parent.left=z.right,q=z.parent,z.left=N.left,z.right=N.right)}N.parent!==null?N.isLeftChild()?N.parent.left=z:N.parent.right=z:this._setRoot(z),q&&this._rebalance(q)}N.dispose()}_rotateLeft(N){const G=N.parent,z=N.isLeftChild(),q=N.right;q&&(N.right=q.left,q.left=N),G!==null?z?G.left=q:G.right=q:this._setRoot(q)}_rotateRight(N){const G=N.parent,z=N.isLeftChild(),q=N.left;q&&(N.left=q.right,q.right=N),G!==null?z?G.left=q:G.right=q:this._setRoot(q)}_rebalance(N){const G=N.getBalance();G>1&&N.left?N.left.getBalance()<0?this._rotateLeft(N.left):this._rotateRight(N):G<-1&&N.right&&(N.right.getBalance()>0?this._rotateRight(N.right):this._rotateLeft(N))}get(N){if(this._root!==null){const G=[];if(this._root.search(N,G),G.length>0){let z=G[0];for(let q=1;q<G.length;q++)G[q].low>z.low&&(z=G[q]);return z.event}}return null}forEach(N){if(this._root!==null){const G=[];this._root.traverse(z=>G.push(z)),G.forEach(z=>{z.event&&N(z.event)})}return this}forEachAtTime(N,G){if(this._root!==null){const z=[];this._root.search(N,z),z.forEach(q=>{q.event&&G(q.event)})}return this}forEachFrom(N,G){if(this._root!==null){const z=[];this._root.searchAfter(N,z),z.forEach(q=>{q.event&&G(q.event)})}return this}dispose(){return super.dispose(),this._root!==null&&this._root.traverse(N=>N.dispose()),this._root=null,this}}class IntervalNode{constructor(N,G,z){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=z,this.low=N,this.high=G,this.max=this.high}insert(N){N.low<=this.low?this.left===null?this.left=N:this.left.insert(N):this.right===null?this.right=N:this.right.insert(N)}search(N,G){N>this.max||(this.left!==null&&this.left.search(N,G),this.low<=N&&this.high>N&&G.push(this),!(this.low>N)&&this.right!==null&&this.right.search(N,G))}searchAfter(N,G){this.low>=N&&(G.push(this),this.left!==null&&this.left.searchAfter(N,G)),this.right!==null&&this.right.searchAfter(N,G)}traverse(N){N(this),this.left!==null&&this.left.traverse(N),this.right!==null&&this.right.traverse(N)}updateHeight(){this.left!==null&&this.right!==null?this.height=Math.max(this.left.height,this.right.height)+1:this.right!==null?this.height=this.right.height+1:this.left!==null?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,this.left!==null&&(this.max=Math.max(this.max,this.left.max)),this.right!==null&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let N=0;return this.left!==null&&this.right!==null?N=this.left.height-this.right.height:this.left!==null?N=this.left.height+1:this.right!==null&&(N=-(this.right.height+1)),N}isLeftChild(){return this.parent!==null&&this.parent.left===this}get left(){return this._left}set left(N){this._left=N,N!==null&&(N.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(N){this._right=N,N!==null&&(N.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}class TimelineValue extends Tone{constructor(N){super(),this.name="TimelineValue",this._timeline=new Timeline({memory:10}),this._initialValue=N}set(N,G){return this._timeline.add({value:N,time:G}),this}get(N){const G=this._timeline.get(N);return G?G.value:this._initialValue}}class SignalOperator extends ToneAudioNode{constructor(){super(optionsFromArguments(SignalOperator.getDefaults(),arguments,["context"]))}connect(N,G=0,z=0){return connectSignal(this,N,G,z),this}}class WaveShaper extends SignalOperator{constructor(){const N=optionsFromArguments(WaveShaper.getDefaults(),arguments,["mapping","length"]);super(N),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,isArray$1(N.mapping)||N.mapping instanceof Float32Array?this.curve=Float32Array.from(N.mapping):isFunction$1(N.mapping)&&this.setMap(N.mapping,N.length)}static getDefaults(){return Object.assign(Signal.getDefaults(),{length:1024})}setMap(N,G=1024){const z=new Float32Array(G);for(let q=0,Y=G;q<Y;q++){const W=q/(Y-1)*2-1;z[q]=N(W,q)}return this.curve=z,this}get curve(){return this._shaper.curve}set curve(N){this._shaper.curve=N}get oversample(){return this._shaper.oversample}set oversample(N){const G=["none","2x","4x"].some(z=>z.includes(N));assert(G,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=N}
vendor: 3,383 bytes, line 239
239dispose(){return super.dispose(),this._shaper.disconnect(),this}}class Pow extends SignalOperator{constructor(){const N=optionsFromArguments(Pow.getDefaults(),arguments,["value"]);super(N),this.name="Pow",this._exponentScaler=this.input=this.output=new WaveShaper({context:this.context,mapping:this._expFunc(N.value),length:8192}),this._exponent=N.value}static getDefaults(){return Object.assign(SignalOperator.getDefaults(),{value:1})}_expFunc(N){return G=>Math.pow(Math.abs(G),N)}get value(){return this._exponent}set value(N){this._exponent=N,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}class TransportEvent{constructor(N,G){this.id=TransportEvent._eventId++,this._remainderTime=0;const z=Object.assign(TransportEvent.getDefaults(),G);this.transport=N,this.callback=z.callback,this._once=z.once,this.time=Math.floor(z.time),this._remainderTime=z.time-this.time}static getDefaults(){return{callback:noOp,once:!1,time:0}}get floatTime(){return this.time+this._remainderTime}invoke(N){if(this.callback){const G=this.transport.bpm.getDurationOfTicks(1,N);this.callback(N+this._remainderTime*G),this._once&&this.transport.clear(this.id)}}dispose(){return this.callback=void 0,this}}TransportEvent._eventId=0;class TransportRepeatEvent extends TransportEvent{constructor(N,G){super(N,G),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const z=Object.assign(TransportRepeatEvent.getDefaults(),G);this.duration=z.duration,this._interval=z.interval,this._nextTick=z.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.transport.on("ticks",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},TransportEvent.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(N){this._createEvents(N),super.invoke(N)}_createEvent(){return LT(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new TicksClass(this.context,this._nextTick).toSeconds()):-1}_createEvents(N){LT(this._nextTick+this._interval,this.floatTime+this.duration)&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new TicksClass(this.context,this._nextTick).toSeconds()))}_restart(N){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.floatTime;const G=this.transport.getTicksAtTime(N);GT(G,this.time)&&(this._nextTick=this.floatTime+Math.ceil((G-this.floatTime)/this._interval)*this._interval),this._currentId=this._createEvent(),this._nextTick+=this._interval,this._nextId=this._createEvent()}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this.transport.off("ticks",this._boundRestart),this}}class TransportClass extends ToneWithContext{constructor(){const N=optionsFromArguments(TransportClass.getDefaults(),arguments);super(N),this.name="Transport",this._loop=new TimelineValue(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Timeline,this._repeatedEvents=new IntervalTimeline,this._syncedSignals=[],this._swingAmou
239nt=0,this._ppq=N.ppq,this._clock=new Clock({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=N.ppq,this.bpm.setValueAtTime(N.bpm,0),readOnly(this,"bpm"),this._timeSignature=N.timeSignature,this._swingTicks=N.ppq/2}static getDefaults(){return Object.assign(ToneWithContext.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(N,G){if(this._loop.get(N)&&G>=this._loopEnd&&(this.emit("loopEnd",N),this._clock.setTicksAtTime(this._loopStart,N),G=this._loopStart,this.emit("loopStart",N,this._clock.getSecondsAtTime(N)),this.emit("loop",N)),this._swingAmount>0&&G%this._ppq!==0&&G%(this._swingTicks*2)!==0){const z=G%(this._swingTicks*2)/(this._swingTicks*2),q=Math.sin(z*Math.PI)*this._swingAmount;N+=new TicksClass(this.context,this._swingTicks*2/3).toSeconds()*q}enterScheduledCallback(!0),this._timeline.forEachAtTime(G,z=>z.invoke(N)),enterScheduledCallback(!1)}schedule(N,G){const z=new TransportEvent(this,{callback:N,time:new TransportTimeClass(this.context,G).toTicks()});return this._addEvent(z,this._timeline)}scheduleRepeat(N,G,z,q=1/0){const Y=new TransportRepeatEvent(this,{callback:N,duration:new TimeClass(this.context,q).toTicks(),interval:new TimeClass(this.context,G).toTicks(),time:new TransportTimeClass(this.context,z).toTicks()});return this._addEvent(Y,this._repeatedEvents)}scheduleOnce(N,G){const z=new TransportEvent(this,{callback:N,once:!0,time:new TransportTimeClass(this.context,G).toTicks()});return this._addEvent(z,this._timeline)}clear(N){if(this._scheduledEvents.hasOwnProperty(N)){const G=this._scheduledEvents[N.toString()];G.timeline.remove(G.event),G.event.dispose(),delete this._scheduledEvents[N.toString()]}return this}_addEvent(N,G){return this._scheduledEvents[N.id.toString()]={event:N,timeline:G},G.add(N),N.id}cancel(N=0){const G=this.toTicks(N);return this._timeline.forEachFrom(G,z=>this.clear(z.id)),this._repeatedEvents.forEachFrom(G,z=>this.clear(z.id)),this}_bindClockEvents(){this._clock.on("start",(N,G)=>{G=new TicksClass(this.context,G).toSeconds(),this.emit("start",N,G)}),this._clock.on("stop",N=>{this.emit("stop",N)}),this._clock.on("pause",N=>{this.emit("pause",N)})}get state(){return this._clock.getStateAtTime(this.now())}start(N,G){this.context.resume();let z;return isDefined(G)&&(z=this.toTicks(G)),this._clock.start(N,z),this}stop(N){return this._clock.stop(N),this}pause(N){return this._clock.pause(N),this}toggle(N){return N=this.toSeconds(N),this._clock.getStateAtTime(N)!=="started"?this.start(N):this.stop(N),this}get timeSignature(){return this._timeSignature}set timeSignature(N){isArray$1(N)&&(N=N[0]/N[1]*4),this._timeSignature=N}get loopStart(){return new TimeClass(this.context,this._loopStart,"i").toSeconds()}set loopStart(N){this._loopStart=this.toTicks(N)}get loopEnd(){return new TimeClass(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(N){this._loopEnd=this.toTicks(N)}get loop(){return this._loop.get(this.now())}set loop(N){this._loop.set(N,this.now())}setLoopPoints(N,G){return this.loopStart=N,this.loopEnd=G,this}
239get swing(){return this._swingAmount}set swing(N){this._swingAmount=N}get swingSubdivision(){return new TicksClass(this.context,this._swingTicks).toNotation()}set swingSubdivision(N){this._swingTicks=this.toTicks(N)}get position(){const N=this.now(),G=this._clock.getTicksAtTime(N);return new TicksClass(this.context,G).toBarsBeatsSixteenths()}set position(N){const G=this.toTicks(N);this.ticks=G}get seconds(){return this._clock.seconds}set seconds(N){const G=this.now(),z=this._clock.frequency.timeToTicks(N,G);this.ticks=z}get progress(){if(this.loop){const N=this.now();return(this._clock.getTicksAtTime(N)-this._loopStart)/(this._loopEnd-this._loopStart)}else return 0}get ticks(){return this._clock.ticks}set ticks(N){if(this._clock.ticks!==N){const G=this.now();if(this.state==="started"){const z=this._clock.getTicksAtTime(G),q=this._clock.frequency.getDurationOfTicks(Math.ceil(z)-z,G),Y=G+q;this.emit("stop",Y),this._clock.setTicksAtTime(N,Y),this.emit("start",Y,this._clock.getSecondsAtTime(Y))}else this.emit("ticks",G),this._clock.setTicksAtTime(N,G)}}getTicksAtTime(N){return this._clock.getTicksAtTime(N)}getSecondsAtTime(N){return this._clock.getSecondsAtTime(N)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(N){this._clock.frequency.multiplier=N}nextSubdivision(N){if(N=this.toTicks(N),this.state!=="started")return 0;{const G=this.now(),z=this.getTicksAtTime(G),q=N-z%N;return this._clock.nextTickTime(q,G)}}syncSignal(N,G){const z=this.now();let q=this.bpm,Y=1/(60/q.getValueAtTime(z)/this.PPQ),W=[];if(N.units==="time"){const ne=.015625/Y,se=new Gain(ne),ae=new Pow(-1),ce=new Gain(ne);q.chain(se,ae,ce),q=ce,Y=1/Y,W=[se,ae,ce]}G||(N.getValueAtTime(z)!==0?G=N.getValueAtTime(z)/Y:G=0);const ie=new Gain(G);return q.connect(ie),ie.connect(N._param),W.push(ie),this._syncedSignals.push({initial:N.value,nodes:W,signal:N}),N.value=0,this}unsyncSignal(N){for(let G=this._syncedSignals.length-1;G>=0;G--){const z=this._syncedSignals[G];z.signal===N&&(z.nodes.forEach(q=>q.dispose()),z.signal.value=z.initial,this._syncedSignals.splice(G,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),writable(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Emitter$1.mixin(TransportClass);onContextInit(v=>{v.transport=new TransportClass({context:v})});onContextClose(v=>
vendor: 7,426 bytes, line 239
239{v.transport.dispose()});class Source extends ToneAudioNode{constructor(N){super(N),this.input=void 0,this._state=new StateTimeline("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=noOp,this._syncedStop=noOp,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new Volume({context:this.context,mute:N.mute,volume:N.volume}),this.volume=this._volume.volume,readOnly(this,"volume"),this.onstop=N.onstop}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{mute:!1,onstop:noOp,volume:0})}get state(){return this._synced?this.context.transport.state==="started"?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(N){this._volume.mute=N}_clampToCurrentTime(N){return this._synced?N:Math.max(N,this.context.currentTime)}start(N,G,z){let q=isUndef(N)&&this._synced?this.context.transport.seconds:this.toSeconds(N);if(q=this._clampToCurrentTime(q),!this._synced&&this._state.getValueAtTime(q)==="started")assert(GT(q,this._state.get(q).time),"Start time must be strictly greater than previous start time"),this._state.cancel(q),this._state.setStateAtTime("started",q),this.log("restart",q),this.restart(q,G,z);else if(this.log("start",q),this._state.setStateAtTime("started",q),this._synced){const Y=this._state.get(q);Y&&(Y.offset=this.toSeconds(defaultArg(G,0)),Y.duration=z?this.toSeconds(z):void 0);const W=this.context.transport.schedule(ie=>{this._start(ie,G,z)},q);this._scheduled.push(W),this.context.transport.state==="started"&&this.context.transport.getSecondsAtTime(this.immediate())>q&&this._syncedStart(this.now(),this.context.transport.seconds)}else assertContextRunning(this.context),this._start(q,G,z);return this}stop(N){let G=isUndef(N)&&this._synced?this.context.transport.seconds:this.toSeconds(N);if(G=this._clampToCurrentTime(G),this._state.getValueAtTime(G)==="started"||isDefined(this._state.getNextState("started",G))){if(this.log("stop",G),!this._synced)this._stop(G);else{const z=this.context.transport.schedule(this._stop.bind(this),G);this._scheduled.push(z)}this._state.cancel(G),this._state.setStateAtTime("stopped",G)}return this}restart(N,G,z){return N=this.toSeconds(N),this._state.getValueAtTime(N)==="started"&&(this._state.cancel(N),this._restart(N,G,z)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(N,G)=>{if(GT(G,0)){const z=this._state.get(G);if(z&&z.state==="started"&&z.time!==G){const q=G-this.toSeconds(z.time);let Y;z.duration&&(Y=this.toSeconds(z.duration)-q),this._start(N,this.toSeconds(z.offset)+q,Y)}}},this._syncedStop=N=>{const G=this.context.transport.getSecondsAtTime(Math.max(N-this.sampleTime,0));this._state.getValueAtTime(G)==="started"&&this._stop(N)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach(N=>this.context.transport.clear(N)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=noOp,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class ToneBufferSource extends OneShotSource{constructor(){const N=optionsFromArguments(ToneBufferSource.getDefaults(),arguments,["url","onload"]);super(N),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,connect(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Param({context:this.context,param:this._source.playbackRate,units:"positive",value:N.playbackRate}),this.loop=N.loop,this.loopStart=N.loopStart,this.loopEnd=N.loopEnd,this._buffer=new ToneAudioBuffer(N.url,N.onload,N.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(OneShotSource.getDefaults(),{url:new ToneAudioBuffer,loop:!1,loopEnd:0,loopStart:0,onload:noOp,onerror:noOp,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(N){this._fadeIn=N}get fadeOut(){return this._fadeOut}set fadeOut(N){this._fadeOut=N}get curve(){return this._curve}set curve(N){this._curve=N}start(N,G,z,q=1){assert(this.buffer.loaded,"buffer is either not set or not loaded");const Y=this.toSeconds(N);this._startGain(Y,q),this.loop?G=defaultArg(G,this.loopStart):G=defaultArg(G,0);let W=Math.max(this.toSeconds(G),0);if(this.loop){const ie=this.toSeconds(this.loopEnd)||this.buffer.duration,ne=this.toSeconds(this.loopStart),se=ie-ne;GTE(W,ie)&&(W=(W-ne)%se+ne),EQ(W,this.buffer.duration)&&(W=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,LT(W,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(Y,W)),isDefined(z)){let ie=this.toSeconds(z);ie=Math.max(ie,0),this.stop(Y+ie)}return this}_stopSource(N){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(N)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(N){this._source.loopStart=this.toSeconds(N)}get loopEnd(){return this._source.loopEnd}set loopEnd(N){this._source.loopEnd=this.toSeconds(N)}get buffer(){return this._buffer}set buffer(N){this._buffer.set(N)}get loop(){return this._source.loop}set loop(N){this._source.loop=N,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class Noise extends Source{constructor(){const N=optionsFromArguments(Noise.getDefaults(),arguments,["type"]);super(N),this.name="Noise",this._source=null,this._playbackRate=N.playbackRate,this.type=N.type,this._fadeIn=N.fadeIn,this._fadeOut=N.fadeOut}static getDefaults(){return Object.assign(Source.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(N){if(assert(N in _noiseBuffers,"Noise: invalid type: "+N),this._type!==N&&(this._type=N,this.state==="started")){const G=this.now();this._stop(G),this._start(G)}}get playbackRate(){return this._playbackRate}set playbackRate(N){this._playbackRate=N,this._source&&(this._source.playbackRate.value=N)}_start(N){const G=_noiseBuffers[this._type];this._source=new ToneBufferSource({url:G,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(N),Math.random()*(G.duration-.001))}_stop(N){this._source&&(this._source.stop(this.toSeconds(N)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(N){this._fadeIn=N,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(N){this._fadeOut=N,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(N){this._stop(N),this._start(N)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}
239const BUFFER_LENGTH=44100*5,NUM_CHANNELS=2,_noiseCache={brown:null,pink:null,white:null},_noiseBuffers={get brown(){if(!_noiseCache.brown){const v=[];for(let N=0;N<NUM_CHANNELS;N++){const G=new Float32Array(BUFFER_LENGTH);v[N]=G;let z=0;for(let q=0;q<BUFFER_LENGTH;q++){const Y=Math.random()*2-1;G[q]=(z+.02*Y)/1.02,z=G[q],G[q]*=3.5}}_noiseCache.brown=new ToneAudioBuffer().fromArray(v)}return _noiseCache.brown},get pink(){if(!_noiseCache.pink){const v=[];for(let N=0;N<NUM_CHANNELS;N++){const G=new Float32Array(BUFFER_LENGTH);v[N]=G;let z,q,Y,W,ie,ne,se;z=q=Y=W=ie=ne=se=0;for(let ae=0;ae<BUFFER_LENGTH;ae++){const ce=Math.random()*2-1;z=.99886*z+ce*.0555179,q=.99332*q+ce*.0750759,Y=.969*Y+ce*.153852,W=.8665*W+ce*.3104856,ie=.55*ie+ce*.5329522,ne=-.7616*ne-ce*.016898,G[ae]=z+q+Y+W+ie+ne+se+ce*.5362,G[ae]*=.11,se=ce*.115926}}_noiseCache.pink=new ToneAudioBuffer().fromArray(v)}return _noiseCache.pink},get white(){if(!_noiseCache.white){const v=[];for(let N=0;N<NUM_CHANNELS;N++){const G=new Float32Array(BUFFER_LENGTH);v[N]=G;for(let z=0;z<BUFFER_LENGTH;z++)G[z]=Math.random()*2-1}_noiseCache.white=new ToneAudioBuffer().fromArray(v)}return _noiseCache.white}};function generateWaveform(v,N){return __awaiter(this,void 0,void 0,function*(){const G=N/v.context.sampleRate,z=new OfflineContext(1,G,v.context.sampleRate);return new v.constructor(Object.assign(v.get(),{frequency:2/G,detune:0,context:z})).toDestination().start(0),(yield z.render()).getChannelData(0)})}class ToneOscillatorNode extends OneShotSource{constructor(){const N=optionsFromArguments(ToneOscillatorNode.getDefaults(),arguments,["frequency","type"]);super(N),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],connect(this._oscillator,this._gainNode),this.type=N.type,this.frequency=new Param({context:this.context,param:this._oscillator.frequency,units:"frequency",value:N.frequency}),this.detune=new Param({context:this.context,param:this._oscillator.detune,units:"cents",value:N.detune}),readOnly(this,["frequency","detune"])}static getDefaults(){return Object.assign(OneShotSource.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(N){const G=this.toSeconds(N);return this.log("start",G),this._startGain(G),this._oscillator.start(G),this}_stopSource(N){this._oscillator.stop(N)}setPeriodicWave(N){return this._oscillator.setPeriodicWave(N),this}get type(){return this._oscillator.type}set type(N){this._oscillator.type=N}dispose(){return super.dispose(),this.state==="started"&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}class Oscillator extends Source{constructor(){const N=optionsFromArguments(Oscillator.getDefaults(),arguments,["frequency","type"]);super(N),this.name="Oscillator",this._oscillator=null,this.frequency=new Signal({context:this.context,units:"frequency",value:N.frequency}),readOnly(this,"frequency"),this.detune=new Signal({context:this.context,units:"cents",value:N.detune}),readOnly(this,"detune"),this._partials=N.partials,this._partialCount=N.partialCount,this._type=N.type,N.partialCount&&N.type!=="custom"&&(this._type=this.baseType+N.partialCount.toString()),this.phase=N.phase}static getDefaults(){return Object.assign(Source.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(N){const G=this.toSeconds(N),z=new ToneOscillatorNode({context:this.context,onended:()=>this.onstop(this)});this._oscillator=z,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(G)}_stop(N){const G=this.toSeconds(N);this._oscillator&&this._oscillator.stop(G)}_restart(N){const G=this.toSeconds(N);return this.log("restart",G),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(G),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if(this._type==="custom")return Oscillator._periodicWaveCache.find(G=>G.phase===this._phase&&deepEquals(G.partials,this._partials));{const N=Oscillator._periodicWaveCache.find(G=>G.type===this._type&&G.phase===this._phase);return this._partialCount=N?N.partialCount:this._partialCount,N}}get type(){return this._type}set type(N){this._type=N;const G=["sine","square","sawtooth","triangle"].indexOf(N)!==-1;if(this._phase===0&&G)this._wave=void 0,this._partialCount=0,this._oscillator!==null&&(this._oscillator.type=N);else{const z=this._getCachedPeriodicWave();if(isDefined(z)){const{partials:q,wave:Y}=z;this._wave=Y,this._partials=q,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave)}else{const[q,Y]=this._getRealImaginary(N,this._phase),W=this.context.createPerio
239dicWave(q,Y);this._wave=W,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave),Oscillator._periodicWaveCache.push({imag:Y,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:q,type:this._type,wave:this._wave}),Oscillator._periodicWaveCache.length>100&&Oscillator._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(N){this.partialCount&&this._type!=="custom"&&N!=="custom"?this.type=N+this.partialCount:this.type=N}get partialCount(){return this._partialCount}set partialCount(N){assertRange(N,0);let G=this._type;const z=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(z&&(G=z[1]),this._type!=="custom")N===0?this.type=G:this.type=G+N.toString();else{const q=new Float32Array(N);this._partials.forEach((Y,W)=>q[W]=Y),this._partials=Array.from(q),this.type=this._type}}_getRealImaginary(N,G){let q=2048;const Y=new Float32Array(q),W=new Float32Array(q);let ie=1;if(N==="custom"){if(ie=this._partials.length+1,this._partialCount=this._partials.length,q=ie,this._partials.length===0)return[Y,W]}else{const ne=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(N);ne?(ie=parseInt(ne[2],10)+1,this._partialCount=parseInt(ne[2],10),N=ne[1],ie=Math.max(ie,2),q=ie):this._partialCount=0,this._partials=[]}for(let ne=1;ne<q;++ne){const se=2/(ne*Math.PI);let ae;switch(N){case"sine":ae=ne<=ie?1:0,this._partials[ne-1]=ae;break;case"square":ae=ne&1?2*se:0,this._partials[ne-1]=ae;break;case"sawtooth":ae=se*(ne&1?1:-1),this._partials[ne-1]=ae;break;case"triangle":ne&1?ae=2*(se*se)*(ne-1>
vendor: 6,307 bytes, line 239
239>1&1?-1:1):ae=0,this._partials[ne-1]=ae;break;case"custom":ae=this._partials[ne-1];break;default:throw new TypeError("Oscillator: invalid type: "+N)}ae!==0?(Y[ne]=-ae*Math.sin(G*ne),W[ne]=ae*Math.cos(G*ne)):(Y[ne]=0,W[ne]=0)}return[Y,W]}_inverseFFT(N,G,z){let q=0;const Y=N.length;for(let W=0;W<Y;W++)q+=N[W]*Math.cos(W*z)+G[W]*Math.sin(W*z);return q}getInitialValue(){const[N,G]=this._getRealImaginary(this._type,0);let z=0;const q=Math.PI*2,Y=32;for(let W=0;W<Y;W++)z=Math.max(this._inverseFFT(N,G,W/Y*q),z);return clamp$1(-this._inverseFFT(N,G,this._phase)/z,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(N){this._partials=N,this._partialCount=this._partials.length,N.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(N){this._phase=N*Math.PI/180,this.type=this._type}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){return generateWaveform(this,N)})}dispose(){return super.dispose(),this._oscillator!==null&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}Oscillator._periodicWaveCache=[];class AudioToGain extends SignalOperator{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new WaveShaper({context:this.context,mapping:N=>(N+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Multiply extends Signal{constructor(){const N=optionsFromArguments(Multiply.getDefaults(),arguments,["value"]);super(N),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new Gain({context:this.context,minValue:N.minValue,maxValue:N.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(N.value,0)}static getDefaults(){return Object.assign(Signal.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class AMOscillator extends Source{constructor(){const N=optionsFromArguments(AMOscillator.getDefaults(),arguments,["frequency","type","modulationType"]);super(N),this.name="AMOscillator",this._modulationScale=new AudioToGain({context:this.context}),this._modulationNode=new Gain({context:this.context}),this._carrier=new Oscillator({context:this.context,detune:N.detune,frequency:N.frequency,onstop:()=>this.onstop(this),phase:N.phase,type:N.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new Oscillator({context:this.context,phase:N.phase,type:N.modulationType}),this.harmonicity=new Multiply({context:this.context,units:"positive",value:N.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),readOnly(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Oscillator.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(N){this._modulator.start(N),this._carrier.start(N)}_stop(N){this._modulator.stop(N),this._carrier.stop(N)}_restart(N){this._modulator.restart(N),this._carrier.restart(N)}get type(){return this._carrier.type}set type(N){this._carrier.type=N}get baseType(){return this._carrier.baseType}set baseType(N){this._carrier.baseType=N}get partialCount(){return this._carrier.partialCount}set partialCount(N){this._carrier.partialCount=N}get modulationType(){return this._modulator.type}set modulationType(N){this._modulator.type=N}get phase(){return this._carrier.phase}set phase(N){this._carrier.phase=N,this._modulator.phase=N}get partials(){return this._carrier.partials}set partials(N){this._carrier.partials=N}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){return generateWaveform(this,N)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class FMOscillator extends Source{constructor(){const N=optionsFromArguments(FMOscillator.getDefaults(),arguments,["frequency","type","modulationType"]);super(N),this.name="FMOscillator",this._modulationNode=new Gain({context:this.context,gain:0}),this._carrier=new Oscillator({context:this.context,detune:N.detune,frequency:0,onstop:()=>this.onstop(this),phase:N.phase,type:N.type}),this.detune=this._carrier.detune,this.frequency=new Signal({context:this.context,units:"frequency",value:N.frequency}),this._modulator=new Oscillator({context:this.context,phase:N.phase,type:N.modulationType}),this.harmonicity=new Multiply({context:this.context,units:"positive",value:N.harmonicity}),this.modulationIndex=new Multiply({context:this.context,units:"positive",value:N.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),readOnly(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Oscillator.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(N){this._modulator.start(N),this._carrier.start(N)}_stop(N){this._modulator.stop(N),this._carrier.stop(N)}_restart(N){return this._modulator.restart(N),this._carrier.restart(N),this}get type(){return this._carrier.type}set type(N){this._carrier.type=N}get baseType(){return this._carrier.baseType}set baseType(N){this._carrier.baseType=N}get partialCount(){return this._carrier.partialCount}set partialCount(N){this._carrier.partialCount=N}get modulationType(){return this._modulator.type}set modulationType(N){this._modulator.type=N}get phase(){return this._carrier.phase}set phase(N){this._carrier.phase=N,this._modulator.phase=N}get partials(){return this._carrier.partials}set partials(N){this._carrier.partials=N}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){return generateWaveform(this,N)})}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dis
239pose(),this.modulationIndex.dispose(),this}}class PulseOscillator extends Source{constructor(){const N=optionsFromArguments(PulseOscillator.getDefaults(),arguments,["frequency","width"]);super(N),this.name="PulseOscillator",this._widthGate=new Gain({context:this.context,gain:0}),this._thresh=new WaveShaper({context:this.context,mapping:G=>G<=0?-1:1}),this.width=new Signal({context:this.context,units:"audioRange",value:N.width}),this._triangle=new Oscillator({context:this.context,detune:N.detune,frequency:N.frequency,onstop:()=>this.onstop(this),phase:N.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),readOnly(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Source.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(N){N=this.toSeconds(N),this._triangle.start(N),this._widthGate.gain.setValueAtTime(1,N)}_stop(N){N=this.toSeconds(N),this._triangle.stop(N),this._widthGate.gain.cancelScheduledValues(N),this._widthGate.gain.setValueAtTime(0,N)}_restart(N){this._triangle.restart(N),this._widthGate.gain.cancelScheduledValues(N),this._widthGate.gain.setValueAtTime(1,N)}get phase(){return this._triangle.phase}set phase(N){this._triangle.phase=N}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(N){this._triangle.type=N}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){return generateWaveform(this,N)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class FatOscillator extends Source{constructor(){const N=optionsFromArguments(FatOscillator.getDefaults(),arguments,["frequency","type","spread"]);super(N),this.name="FatOscillator",this._oscillators=[],this.frequency=new Signal({context:this.context,units:"frequency",value:N.frequency}),this.detune=new Signal({context:this.context,units:"cents",value:N.detune}),this._spread=N.spread,this._type=N.type,this._phase=N.phase,this._partials=N.partials,this._partialCount=N.partialCount,this.count=N.count,readOnly(this,["frequency","detune"])}static getDefaults(){return Object.assign(Oscillator.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(N){N=this.toSeconds(N),this._forEach(G=>G.start(N))}_stop(N){N=this.toSeconds(N),this._forEach(G=>G.stop(N))}_restart(N){this._forEach(G=>G.restart(N))}_forEach(N){for(let G=0;G<this._oscillators.length;G++)N(this._oscillators[G],G)}get type(){return this._type}set type(N){this._type=N,this._forEach(G=>G.type=N)}get spread(){return this._spread}set spread(N){if(this._spread=N,this._oscillators.length>1){const G=-N/2,z=N/(this._oscillators.length-1);this._forEach((q,Y)=>q.detune.value=G+z*Y)}}get count(){return this._oscillators.length}set count(N){if(assertRange(N,1),this._oscillators.length!==N){this._forEach(G=>G.dispose()),this._oscillators=[];for(let G=0;G<N;G++){const z=new Oscillator({context:this.context,volume:-6-N*1.1,type:this._type,phase:this._phase+G/N*360,partialCount:this._partialCount,onstop:G===0?()=>this.onstop(this):noOp});this.type==="custom"&&(z.partials=this._partials),this.frequency.connect(z.frequency),this.detune.connect(z.detune),z.detune.overridden=!1,z.connect(this.output),this._oscillators[G]=z}this.spread=this._spread,this.state==="started"&&this._forEach(G=>G.start())}}get phase(){return this._phase}set phase(N){this._phase=N,this._forEach((G,z)=>G.phase=this._phase+z/this.count*360)}get baseType(){return this._oscillators[0].baseType}set baseType(N){this._forEach(G=>G.baseType=N),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(N){this._partials=N,this._partialCount=this._partials.length,N.length&&(this._type="custom",this._forEach(G=>G.partials=N))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(N){this._partialCount=N,this._forEach(G=>G.partialCount=N),this._type=this._oscillators[0].type}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){return generateWaveform(this,N)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEac
239h(N=>N.dispose()),this}}class PWMOscillator extends Source{constructor(){const N=optionsFromArguments(PWMOscillator.getDefaults(),arguments,["frequency","modulationFrequency"]);super(N),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new Multiply({context:this.context,value:2}),this._pulse=new PulseOscillator({context:this.context,frequency:N.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Oscillator({context:this.context,detune:N.detune,frequency:N.frequency,onstop:()=>this.onstop(this),phase:N.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),readOnly(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Source.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(N){N=this.toSeconds(N),this._modulator.start(N),this._pulse.start(N)}_stop(N){N=this.toSeconds(N),this._modulator.stop(N),this._pulse.stop(N)}_restart(N){this._modulator.restart(N),this._pulse.restart(N)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(N){this._modulator.phase=N}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){return generateWaveform(this,N)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const OmniOscillatorSourceMap={am:AMOscillator,fat:FatOscillator,fm:FMOscillator,oscillator:Oscillator,pulse:PulseOscillator,pwm:PWMOscillator};class OmniOscillator extends Source{constructor(){const N=optionsFromArguments(OmniOscillator.getDefaults(),arguments,["frequency","type"]);super(N),this.name="OmniOscillator",this.frequency=new Signal({context:this.context,units:"frequency",value:N.frequency}),this.detune=new Signal({context:this.context,units:"cents",value:N.detune}),readOnly(this,["frequency","detune"]),this.set(N)}static getDefaults(){return Object.assign(Oscillator.getDefaults(),FMOscillator.getDefaults(),AMOscillator.getDefaults(),FatOscillator.getDefaults(),PulseOscillator.getDefaults(),PWMOscillator.getDefaults())}_start(N){this._oscillator.start(N)}_stop(N){this._oscillator.stop(N)}_restart(N){return this._oscillator.restart(N),this}get type(){let N="";return["am","fm","fat"].some(G=>this._sourceType===G)&&(N=this._sourceType),N+this._oscillator.type}set type(N){N.substr(0,2)==="fm"?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=N.substr(2)):N.substr(0,2)==="am"?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=N.substr(2)):N.substr(0,3)==="fat"?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=N.substr(3)):N==="pwm"?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):N==="pulse"?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=N)}get partials(){return this._oscillator.partials}set partials(N){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&(this._oscillator.partials=N)}get partialCount(){return this._oscillator.partialCount}set partialCount(N){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&(this._oscillator.partialCount=N)}set(N){return Reflect.has(N,"type")&&N.type&&(this.type=N.type),super.set(N),this}_createNewOscillator(N){if(N!==this._sourceType){this._sourceType=N;const G=OmniOscillatorSourceMap[N],z=this.now();if(this._oscillator){const q=this._oscillator;q.stop(z),this.context.setTimeout(()=>q.dispose(),this.blockTime)}this._oscillator=new G({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),this.state==="started"&&this._oscillator.start(z)}}get phase(){return this._oscillator.phase}set phase(N){this._oscillator.phase=N}get sourceType(){return this._sourceType}set sourceType(N){let G="sine";this._oscillator.type!=="pwm"&&this._oscillator.type!=="pulse"&&(G=this._oscillator.type),N==="fm"?this.type="fm"+G:N==="am"?this.type="am"+G:N==="fat"?this.type="fat"+G:N==="oscillator"?this.type=G:N==="pulse"?this.type="pulse":N==="pwm"&&(this.t
vendor: 5,720 bytes, line 239
239ype="pwm")}_getOscType(N,G){return N instanceof OmniOscillatorSourceMap[G]}get baseType(){return this._oscillator.baseType}set baseType(N){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&N!=="pulse"&&N!=="pwm"&&(this._oscillator.baseType=N)}get width(){if(this._getOscType(this._oscillator,"pulse"))return this._oscillator.width}get count(){if(this._getOscType(this._oscillator,"fat"))return this._oscillator.count}set count(N){this._getOscType(this._oscillator,"fat")&&isNumber$1(N)&&(this._oscillator.count=N)}get spread(){if(this._getOscType(this._oscillator,"fat"))return this._oscillator.spread}set spread(N){this._getOscType(this._oscillator,"fat")&&isNumber$1(N)&&(this._oscillator.spread=N)}get modulationType(){if(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))return this._oscillator.modulationType}set modulationType(N){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&isString$1(N)&&(this._oscillator.modulationType=N)}get modulationIndex(){if(this._getOscType(this._oscillator,"fm"))return this._oscillator.modulationIndex}get harmonicity(){if(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))return this._oscillator.harmonicity}get modulationFrequency(){if(this._getOscType(this._oscillator,"pwm"))return this._oscillator.modulationFrequency}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){return generateWaveform(this,N)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class Add extends Signal{constructor(){super(optionsFromArguments(Add.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new Gain({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,connectSeries(this._constantSource,this._sum)}static getDefaults(){return Object.assign(Signal.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Scale extends SignalOperator{constructor(){const N=optionsFromArguments(Scale.getDefaults(),arguments,["min","max"]);super(N),this.name="Scale",this._mult=this.input=new Multiply({context:this.context,value:N.max-N.min}),this._add=this.output=new Add({context:this.context,value:N.min}),this._min=N.min,this._max=N.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(SignalOperator.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(N){this._min=N,this._setRange()}get max(){return this._max}set max(N){this._max=N,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}class Zero extends SignalOperator{constructor(){super(optionsFromArguments(Zero.getDefaults(),arguments)),this.name="Zero",this._gain=new Gain({context:this.context}),this.output=this._gain,this.input=void 0,connect(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),disconnect(this.context.getConstant(0),this._gain),this}}class LFO extends ToneAudioNode{constructor(){const N=optionsFromArguments(LFO.getDefaults(),arguments,["frequency","min","max"]);super(N),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=Param.prototype._fromType,this._toType=Param.prototype._toType,this._is=Param.prototype._is,this._clampValue=Param.prototype._clampValue,this._oscillator=new Oscillator(N),this.frequency=this._oscillator.frequency,this._amplitudeGain=new Gain({context:this.context,gain:N.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new Signal({context:this.context,units:"audioRange",value:0}),this._zeros=new Zero({context:this.context}),this._a2g=new AudioToGain({context:this.context}),this._scaler=this.output=new Scale({context:this.context,max:N.max,min:N.min}),this.units=N.units,this.min=N.min,this.max=N.max,this._oscillator.chain(this._amplitudeGain,this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),readOnly(this,["amplitude","frequency"]),this.phase=N.phase}static getDefaults(){return Object.assign(Oscillator.getDefaults(),{amplitude:1,frequency:"4n",max:1,min:0,type:"sine",units:"number"})}start(N){return N=this.toSeconds(N),this._stoppedSignal.setValueAtTime(0,N),this._oscillator.start(N),this}stop(N){return N=this.toSeconds(N),this._stoppedSignal.setValueAtTime(this._stoppedValue,N),this._oscillator.stop(N),this}sync(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this}unsync(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this}_setStoppedValue(){this._stoppedValue=this._oscillator.getInitialValue(),this._stoppedSignal.value=this._stoppedValue}get min(){return this._toType(this._scaler.min)}set min(N){N=this._fromType(N),this._scaler.min=N}get max(){return this._toType(this._scaler.max)}set max(N){N=this._fromType(N),this._scaler.max=N}get type(){return this._oscillator.type}set type(N){this._oscillator.type=N,this._setStoppedValue()}get partials(){return this._oscillator.partials}set partials(N){this._oscillator.partials=N,this._setStoppedValue()}get phase(){return this._oscillator.phase}set phase(N){this._oscillator.phase=N,this._setStoppedValue()}get units(){return this._units}set units(N){const G=this.min,z=this.max;this._units=N,this.min=G,this.max=z}get state(){return this._oscillator.state}connect(N,G,z){return(N instanceof Param||N instanceof Signal)&&(this.convert=N.convert,this.units=N.units),connectSignal(this,N,G,z),this}dispose(){return super.dispose(),this._oscillator.dispose(),this._stoppedSignal.dis
239pose(),this._zeros.dispose(),this._scaler.dispose(),this._a2g.dispose(),this._amplitudeGain.dispose(),this.amplitude.dispose(),this}}function range(v,N=1/0){const G=new WeakMap;return function(z,q){Reflect.defineProperty(z,q,{configurable:!0,enumerable:!0,get:function(){return G.get(this)},set:function(Y){assertRange(Y,v,N),G.set(this,Y)}})}}function timeRange(v,N=1/0){const G=new WeakMap;return function(z,q){Reflect.defineProperty(z,q,{configurable:!0,enumerable:!0,get:function(){return G.get(this)},set:function(Y){assertRange(this.toSeconds(Y),v,N),G.set(this,Y)}})}}class Player extends Source{constructor(){const N=optionsFromArguments(Player.getDefaults(),arguments,["url","onload"]);super(N),this.name="Player",this._activeSources=new Set,this._buffer=new ToneAudioBuffer({onload:this._onload.bind(this,N.onload),onerror:N.onerror,reverse:N.reverse,url:N.url}),this.autostart=N.autostart,this._loop=N.loop,this._loopStart=N.loopStart,this._loopEnd=N.loopEnd,this._playbackRate=N.playbackRate,this.fadeIn=N.fadeIn,this.fadeOut=N.fadeOut}static getDefaults(){return Object.assign(Source.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:noOp,onerror:noOp,playbackRate:1,reverse:!1})}load(N){return __awaiter(this,void 0,void 0,function*(){return yield this._buffer.load(N),this._onload(),this})}_onload(N=noOp){N(),this.autostart&&this.start()}_onSourceEnd(N){this.onstop(this),this._activeSources.delete(N),this._activeSources.size===0&&!this._synced&&this._state.getValueAtTime(this.now())==="started"&&(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(N,G,z){return super.start(N,G,z),this}_start(N,G,z){this._loop?G=defaultArg(G,this._loopStart):G=defaultArg(G,0);const q=this.toSeconds(G),Y=z;z=defaultArg(z,Math.max(this._buffer.duration-q,0));let W=this.toSeconds(z);W=W/this._playbackRate,N=this.toSeconds(N);const ie=new ToneBufferSource({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);!this._loop&&!this._synced&&(this._state.cancel(N+W),this._state.setStateAtTime("stopped",N+W,{implicitEnd:!0})),this._activeSources.add(ie),this._loop&&isUndef(Y)?ie.start(N,q):ie.start(N,q,W-this.toSeconds(this.fadeOut))}_stop(N){const G=this.toSeconds(N);this._activeSources.forEach(z=>z.stop(G))}restart(N,G,z){return super.restart(N,G,z),this}_restart(N,G,z){var q;(q=[...this._activeSources].pop())===null||q===void 0||q.stop(N),this._start(N,G,z)}seek(N,G){const z=this.toSeconds(G);if(this._state.getValueAtTime(z)==="started"){const q=this.toSeconds(N);this._stop(z),this._start(z,q)}return this}setLoopPoints(N,G){return this.loopStart=N,this.loopEnd=G,this}get loopStart(){return this._loopStart}set loopStart(N){this._loopStart=N,this.buffer.loaded&&assertRange(this.toSeconds(N),0,this.buffer.duration),this._activeSources.forEach(G=>{G.loopStart=N})}get loopEnd(){return this._loopEnd}set loopEnd(N){this._loopEnd=N,this.buffer.loaded&&assertRange(this.toSeconds(N),0,this.buffer.duration),this._activeSources.forEach(G=>{G.loopEnd=N})}get buffer(){return this._buffer}set buffer(N){this._buffer.set(N)}get loop(){return this._loop}set loop(N){if(this._loop!==N&&(this._loop=N,this._activeSources.forEach(G=>{G.loop=N}),N)){const G=this._state.getNextState("stopped",this.now());G&&this._state.cancel(G.time)}}get playbackRate(){return this._playbackRate}set playbackRate(N){this._playbackRate=N;const G=this.now(),z=this._state.getNextState("stopped",G);z&&z.implicitEnd&&(this._state.cancel(z.time),this._activeSources.forEach(q=>q.cancelStop())),this._activeSources.forEach(q=>{q.playbackRate.setValueAtTime(N,G)})}get reverse(){return this._buffer.reverse}set reverse(N){this._buffer.reverse=N}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach(N=>N.dispose()),this._activeSources.clear(),this._buffer.dispose(),this}}__decorate([timeRange(0)],Player.prototype,"fadeIn",void 0);__decorate([timeRange(0)],Player.prototype,"fadeOut",void 0);class GainToAudio extends SignalOperator{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new WaveShaper({context:this.context,mapping:N=>Math.abs(N)*2-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Envelope extends ToneAudioNode{constructor(){const N=optionsFromArguments(Envelope.getDefaults(),arguments,["attack","decay","sustain","release"]);super(N),this.name="Envelope",this._sig=new Signal({context:this.context,value:0}),this.output=this._sig,this.input=void 0,this.attack=N.attack,this.decay=N.decay,this.sustain=N.sustain,this.release=N.release,this.attackCurve=N.attackCurve,this.releaseCurve=N.releaseCurve,this.decayCurve=N.decayCurve}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(N,G){if(isString$1(N))return N;{let z;for(z in EnvelopeCurves)if(EnvelopeCurves[z][G]===N)return z;return N}}_setCurve(N,G,z){if(isString$1(z)&&Reflect.has(EnvelopeCurves,z)){const q=EnvelopeCurves[z];isObject$1(q)?N!=="_decayCurve"&&(this[N]=q[G]):this[N]=q}else if(isArray$1(z)&&N!=="_decayCurve")this[N]=z;else throw new Error("Envelope: invalid curve: "+z)}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(N){this._setCurve("_attackCurve","In",N)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(N){this._setCurve("_releaseCurve","Out",N)}get decayCurve(){return this._getCurve(this._decayCurve,"Out")}set decayCurve(N){this._setCurve("_decayCurve","Out",N)}triggerAttack(N,G=1){this.log("triggerAttack",N,G),N=this.toSeconds(N);let q=this.toSeconds(this.attack);const Y=this.toSeconds(this.decay),W=this.getValueAtTime(N);if(W>0){const ie=1/q;q=(1-W)/ie}if(q<this.sampleTime)this._sig.cancelScheduledValues(N),this._sig.setValueAtTime(G,N);else if(this._attackCurve==="linear")this._sig.linearRampTo(G,q,N);else if(this._attackCurve==="exponential")this._sig.targetRampTo(G,q,N);else{this._sig.cancelAndHoldAtTime(N);let ie=this._attackCurve;for(let ne=1;ne<ie.length;ne++)if(ie[ne-1]<=W&&W<=ie[ne]){ie=this._attackCurve.slice(ne),ie[0]=W;break}this._sig.setValueCurveAtTime(ie,N,q,G)}if(Y&&this.sustain<1){const ie=G*this.sustain,ne=N+q;
239this.log("decay",ne),this._decayCurve==="linear"?this._sig.linearRampToValueAtTime(ie,Y+ne):this._sig.exponentialApproachValueAtTime(ie,ne,Y)}return this}triggerRelease(N){this.log("triggerRelease",N),N=this.toSeconds(N);const G=this.getValueAtTime(N);if(G>0){const z=this.toSeconds(this.release);z<this.sampleTime?this._sig.setValueAtTime(0,N):this._releaseCurve==="linear"?this._sig.linearRampTo(0,z,N):this._releaseCurve==="exponential"?this._sig.targetRampTo(0,z,N):(assert(isArray$1(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(N),this._sig.setValueCurveAtTime(this._releaseCurve,N,z,G))}return this}getValueAtTime(N){return this._sig.getValueAtTime(N)}triggerAttackRelease(N,G,z=1){return G=this.toSeconds(G),this.triggerAttack(G,z),this.triggerRelease(G+this.toSeconds(N)),this}cancel(N){return this._sig.cancelScheduledValues(this.toSeconds(N)),this}connect(N,G=0,z=0){return connectSignal(this,N,G,z),this}asArray(){return __awaiter(this,arguments,void 0,function*(N=1024){const G=N/this.context.sampleRate,z=new OfflineContext(1,G,this.context.sampleRate),q=this.toSeconds(this.attack)+this.toSeconds(this.decay),Y=q+this.toSeconds(this.release),W=Y*.1,ie=Y+W,ne=new this.constructor(Object.assign(this.get(),{attack:G*this.toSeconds(this.attack)/ie,decay:G*this.toSeconds(this.decay)/ie,release:G*this.toSeconds(this.release)/ie,context:z}));return ne._sig.toDestination(),ne.triggerAttackRelease(G*(q+W)/ie,0),(yield z.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}}__decorate([timeRange(0)],Envelope.prototype,"attack",void 0);__decorate([timeRange(0)],Envelope.prototype,"decay",void 0);__decorate([range(0,1)],Envelope.prototype,"sustain",void 0);__decorate([timeRange(0)],Envelope.prototype,"release",void 0);const EnvelopeCurves=(()=>{let N,G;const z=[];for(N=0;N<128;N++)z[N]=Math.sin(N/127*(Math.PI/2));const q=[],Y=6.4;for(N=0;N<127;N++){G=N/127;const pe=Math.sin(G*(Math.PI*2)*Y-Math.PI/2)+1;q[N]=pe/10+G*.83}q[127]=1;const W=[],ie=5;for(N=0;N<128;N++)W[N]=Math.ceil(N/127*ie)/ie;const ne=[];for(N=0;N<128;N++)G=N/127,ne[N]=.5*(1-Math.cos(Math.PI*G));const se=[];for(N=0;N<128;N++){G=N/127;const pe=Math.pow(G,3)*4+.2,ge=Math.cos(pe*Math.PI*2*G);se[N]=Math.abs(ge*(1-G))}function ae(pe){const ge=new Array(pe.length);for(let ve=0;ve<pe.length;ve++)ge[ve]=1-pe[ve];return ge}function ce(pe){return pe.slice(0).reverse()}return{bounce:{In:ae(se),Out:se},cosine:{In:z,Out:ce(z)},exponential:"exponential",linear:"linear",ripple:{In:q,Out:ae(q)},sine:{In:ne,Out:ae(ne)},step:{In:W,Out:ae(W)}}})();class Instrument extends ToneAudioNode{constructor(){const N=optionsFromArguments(Instrument.getDefaults(),arguments);super(N),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease,this._syncedRelease=G=>this._original_triggerRelease(G),this._volume=this.output=new Volume({context:this.context,volume:N.volume}),this.volume=this._volume.volume,readOnly(this,"volume")}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}_syncState(){let N=!1;return this._synced||(this._synced=!0,N=!0),N}_syncMethod(N,G){const z=this["_original_"+N]=this[N];this[N]=(...q)=>{const Y=q[G],W=this.context.transport.schedule(ie=>{q[G]=ie,z.apply(this,q)},Y);this._scheduledEvents.push(W)}}unsync(){return this._scheduledEvents.forEach(N=>this.context.transport.clear(N)),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease,this.context.transport.off("stop",this._syncedRelease),this.context.transport.off("pause",this._syncedRelease),this.context.transport.off("loopEnd",this._syncedRelease)),this}triggerAttackRelease(N,G,z,q){const Y=this.toSeconds(z),W=this.toSeconds(G);return this.triggerAttack(N,Y,q),this.triggerRelease(Y+W),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class Monophonic extends Instrument{constructor(){const N=optionsFromArguments(Monophonic.getDefaults(),arguments);super(N),this.portamento=N.portamento,this.onsilence=N.onsilence}static getDefaults(){return Object.assign(Instrument.getDefaults(),{detune:0,onsilence:noOp,portamento:0})}triggerAttack(N,G,z=1){this.log("triggerAttack",N,G,z);const q=this.toSeconds(G);return this._triggerEnvelopeAttack(q,z),this.setNote(N,q),this}triggerRelease(N){this.log("triggerRelease",N);const G=this.toSeconds(N);return this._triggerEnvelopeRelease(G),this}setNote(N,G){const z=this.toSeconds(G),q=N instanceof FrequencyClass?N.toFrequency():N;if(this.portamento>0&&this.getLevelAtTime(z)>.05){const Y=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(q,Y,z)}else this.frequency.setValueAtTime(q,z);return this}}__decorate([timeRange(0)],Monophonic.prototype,"portamento",void 0);
vendor: 5,273 bytes, line 239
239class AmplitudeEnvelope extends Envelope{constructor(){super(optionsFromArguments(AmplitudeEnvelope.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new Gain({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class Synth extends Monophonic{constructor(){const N=optionsFromArguments(Synth.getDefaults(),arguments);super(N),this.name="Synth",this.oscillator=new OmniOscillator(Object.assign({context:this.context,detune:N.detune,onstop:()=>this.onsilence(this)},N.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new AmplitudeEnvelope(Object.assign({context:this.context},N.envelope)),this.oscillator.chain(this.envelope,this.output),readOnly(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(Monophonic.getDefaults(),{envelope:Object.assign(omitFromObject(Envelope.getDefaults(),Object.keys(ToneAudioNode.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(omitFromObject(OmniOscillator.getDefaults(),[...Object.keys(Source.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(N,G){if(this.envelope.triggerAttack(N,G),this.oscillator.start(N),this.envelope.sustain===0){const z=this.toSeconds(this.envelope.attack),q=this.toSeconds(this.envelope.decay);this.oscillator.stop(N+z+q)}}_triggerEnvelopeRelease(N){this.envelope.triggerRelease(N),this.oscillator.stop(N+this.toSeconds(this.envelope.release))}getLevelAtTime(N){return N=this.toSeconds(N),this.envelope.getValueAtTime(N)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class ModulationSynth extends Monophonic{constructor(){const N=optionsFromArguments(ModulationSynth.getDefaults(),arguments);super(N),this.name="ModulationSynth",this._carrier=new Synth({context:this.context,oscillator:N.oscillator,envelope:N.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new Synth({context:this.context,oscillator:N.modulation,envelope:N.modulationEnvelope,volume:-10}),this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope,this.modulation=this._modulator.oscillator,this.modulationEnvelope=this._modulator.envelope,this.frequency=new Signal({context:this.context,units:"frequency"}),this.detune=new Signal({context:this.context,value:N.detune,units:"cents"}),this.harmonicity=new Multiply({context:this.context,value:N.harmonicity,minValue:0}),this._modulationNode=new Gain({context:this.context,gain:0}),readOnly(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(Monophonic.getDefaults(),{harmonicity:3,oscillator:Object.assign(omitFromObject(OmniOscillator.getDefaults(),[...Object.keys(Source.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(omitFromObject(Envelope.getDefaults(),Object.keys(ToneAudioNode.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(omitFromObject(OmniOscillator.getDefaults(),[...Object.keys(Source.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(omitFromObject(Envelope.getDefaults(),Object.keys(ToneAudioNode.getDefaults())),{attack:.5,decay:0,sustain:1,release:.5})})}_triggerEnvelopeAttack(N,G){this._carrier._triggerEnvelopeAttack(N,G),this._modulator._triggerEnvelopeAttack(N,G)}_triggerEnvelopeRelease(N){return this._carrier._triggerEnvelopeRelease(N),this._modulator._triggerEnvelopeRelease(N),this}getLevelAtTime(N){return N=this.toSeconds(N),this.envelope.getValueAtTime(N)}dispose(){return super.dispose(),this._carrier.dispose(),this._modulator.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._modulationNode.dispose(),this}}class BiquadFilter extends ToneAudioNode{constructor(){const N=optionsFromArguments(BiquadFilter.getDefaults(),arguments,["frequency","type"]);super(N),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new Param({context:this.context,units:"number",value:N.Q,param:this._filter.Q}),this.frequency=new Param({context:this.context,units:"frequency",value:N.frequency,param:this._filter.frequency}),this.detune=new Param({context:this.context,units:"cents",value:N.detune,param:this._filter.detune}),this.gain=new Param({context:this.context,units:"decibels",convert:!1,value:N.gain,param:this._filter.gain}),this.type=N.type}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(N){assert(["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(N)!==-1,`Invalid filter type: ${N}`),this._filter.type=N}getFrequencyResponse(N=128){const G=new Float32Array(N);for(let W=0;W<N;W++){const ne=Math.pow(W/N,2)*19980+20;G[W]=ne}const z=new Float32Array(N),q=new Float32Array(N),Y=this.context.createBiquadFilter();
239return Y.type=this.type,Y.Q.value=this.Q.value,Y.frequency.value=this.frequency.value,Y.gain.value=this.gain.value,Y.getFrequencyResponse(G,z,q),z}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}class Filter extends ToneAudioNode{constructor(){const N=optionsFromArguments(Filter.getDefaults(),arguments,["frequency","type","rolloff"]);super(N),this.name="Filter",this.input=new Gain({context:this.context}),this.output=new Gain({context:this.context}),this._filters=[],this._filters=[],this.Q=new Signal({context:this.context,units:"positive",value:N.Q}),this.frequency=new Signal({context:this.context,units:"frequency",value:N.frequency}),this.detune=new Signal({context:this.context,units:"cents",value:N.detune}),this.gain=new Signal({context:this.context,units:"decibels",convert:!1,value:N.gain}),this._type=N.type,this.rolloff=N.rolloff,readOnly(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(N){assert(["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(N)!==-1,`Invalid filter type: ${N}`),this._type=N,this._filters.forEach(z=>z.type=N)}get rolloff(){return this._rolloff}set rolloff(N){const G=isNumber$1(N)?N:parseInt(N,10),z=[-12,-24,-48,-96];let q=z.indexOf(G);assert(q!==-1,`rolloff can only be ${z.join(", ")}`),q+=1,this._rolloff=G,this.input.disconnect(),this._filters.forEach(Y=>Y.disconnect()),this._filters=new Array(q);for(let Y=0;Y<q;Y++){const W=new BiquadFilter({context:this.context});W.type=this._type,this.frequency.connect(W.frequency),this.detune.connect(W.detune),this.Q.connect(W.Q),this.gain.connect(W.gain),this._filters[Y]=W}this._internalChannels=this._filters,connectSeries(this.input,...this._internalChannels,this.output)}getFrequencyResponse(N=128){const G=new BiquadFilter({frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),z=new Float32Array(N).map(()=>1);return this._filters.forEach(()=>{G.getFrequencyResponse(N).forEach((Y,W)=>z[W]*=Y)}),G.dispose(),z}dispose(){return super.dispose(),this._filters.forEach(N=>{N.dispose()}),writable(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}}class FMSynth extends ModulationSynth{constructor(){const N=optionsFromArguments(FMSynth.getDefaults(),arguments);super(N),this.name="FMSynth",this.modulationIndex=new Multiply({context:this.context,value:N.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output)}static getDefaults(){return Object.assign(ModulationSynth.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}}class MembraneSynth extends Synth{constructor(){const N=optionsFromArguments(MembraneSynth.getDefaults(),arguments);super(N),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=N.pitchDecay,this.octaves=N.octaves,readOnly(this,["oscillator","envelope"])}static getDefaults(){return deepMerge(Monophonic.getDefaults(),Synth.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(N,G){const z=this.toSeconds(G),q=this.toFrequency(N instanceof FrequencyClass?N.toFrequency():N),Y=q*this.octaves;return this.oscillator.frequency.setValueAtTime(Y,z),this.oscillator.frequency.exponentialRampToValueAtTime(q,z+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}__decorate([range(0)],MembraneSynth.prototype,"octaves",void 0);__decorate([timeRange(0)],MembraneSynth.prototype,"pitchDecay",void 0);const workletContext=new Set;function addToWorklet(v){workletContext.add(v)}function registerProcessor(v,N){const G=`registerProcessor("${v}", ${N})`;workletContext.add(G)}function getWorkletGlobalScope(){return Array.from(workletContext).join(`
240`)}class ToneAudioWorklet extends ToneAudioNode{constructor(N){super(N),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=noOp;const G=URL.createObjectURL(new Blob([getWorkletGlobalScope()],{type:"text/javascript"})),z=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(G).then(()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(z,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))})}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}const toneAudioWorkletProcessor=`
241	/**
242	 * The base AudioWorkletProcessor for use in Tone.js. Works with the {@link ToneAudioWorklet}. 
243	 */
244	class ToneAudioWorkletProcessor extends AudioWorkletProcessor {
245
246		constructor(options) {
247			
248			super(options);
249			/**
250			 * If the processor was disposed or not. Keep alive until it's disposed.
251			 */
252			this.disposed = false;
253		   	/** 
254			 * The number of samples in the processing block
255			 */
256			this.blockSize = 128;
257			/**
258			 * the sample rate
259			 */
260			this.sampleRate = sampleRate;
261
262			this.port.onmessage = (event) => {
263				// when it receives a dispose 
264				if (event.data === "dispose") {
265					this.disposed = true;
266				}
267			};
268		}
269	}
270`;addToWorklet(toneAudioWorkletProcessor);const singleIOProcess=`
271	/**
272	 * Abstract class for a single input/output processor. 
273	 * has a 'generate' function which processes one sample at a time
274	 */
275	class SingleIOProcessor extends ToneAudioWorkletProcessor {
276
277		constructor(options) {
278			super(Object.assign(options, {
279				numberOfInputs: 1,
280				numberOfOutputs: 1
281			}));
282			/**
283			 * Holds the name of the parameter and a single value of that
284			 * parameter at the current sample
285			 * @type { [name: string]: number }
286			 */
287			this.params = {}
288		}
289
290		/**
291		 * Generate an output sample from the input sample and parameters
292		 * @abstract
293		 * @param input number
294		 * @param channel number
295		 * @param parameters { [name: string]: number }
296		 * @returns number
297		 */
298		generate(){}
299
300		/**
301		 * Update the private params object with the 
302		 * values of the parameters at the given index
303		 * @param parameters { [name: string]: Float32Array },
304		 * @param index number
305		 */
306		updateParams(parameters, index) {
307			for (const paramName in parameters) {
308				const param = parameters[paramName];
309				if (param.length > 1) {
310					this.params[paramName] = parameters[paramName][index];
311				} else {
312					this.params[paramName] = parameters[paramName][0];
313				}
314			}
315		}
316
317		/**
318		 * Process a single frame of the audio
319		 * @param inputs Float32Array[][]
320		 * @param outputs Float32Array[][]
321		 */
322		process(inputs, outputs, parameters) {
323			const input = inputs[0];
324			const output = outputs[0];
325			// get the parameter values
326			const channelCount = Math.max(input && input.length || 0, output.length);
327			for (let sample = 0; sample < this.blockSize; sample++) {
328				this.updateParams(parameters, sample);
329				for (let channel = 0; channel < channelCount; channel++) {
330					const inputSample = input && input.length ? input[channel][sample] : 0;
331					output[channel][sample] = this.generate(inputSample, channel, this.params);
332				}
333			}
334			return !this.disposed;
335		}
336	};
337`;addToWorklet(singleIOProcess);const delayLine=`
338	/**
339	 * A multichannel buffer for use within an AudioWorkletProcessor as a delay line
340	 */
341	class DelayLine {
342		
343		constructor(size, channels) {
344			this.buffer = [];
345			this.writeHead = []
346			this.size = size;
347
348			// create the empty channels
349			for (let i = 0; i < channels; i++) {
350				this.buffer[i] = new Float32Array(this.size);
351				this.writeHead[i] = 0;
352			}
353		}
354
355		/**
356		 * Push a value onto the end
357		 * @param channel number
358		 * @param value number
359		 */
360		push(channel, value) {
361			this.writeHead[channel] += 1;
362			if (this.writeHead[channel] > this.size) {
363				this.writeHead[channel] = 0;
364			}
365			this.buffer[channel][this.writeHead[channel]] = value;
366		}
367
368		/**
369		 * Get the recorded value of the channel given the delay
370		 * @param channel number
371		 * @param delay number delay samples
372		 */
373		get(channel, delay) {
374			let readHead = this.writeHead[channel] - Math.floor(delay);
375			if (readHead < 0) {
376				readHead += this.size;
377			}
378			return this.buffer[channel][readHead];
379		}
380	}
381`;addToWorklet(delayLine);const workletName$1="feedback-comb-filter",feedbackCombFilter=`
382	class FeedbackCombFilterWorklet extends SingleIOProcessor {
383
384		constructor(options) {
385			super(options);
386			this.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);
387		}
388
389		static get parameterDescriptors() {
390			return [{
391				name: "delayTime",
392				defaultValue: 0.1,
393				minValue: 0,
394				maxValue: 1,
395				automationRate: "k-rate"
396			}, {
397				name: "feedback",
398				defaultValue: 0.5,
399				minValue: 0,
400				maxValue: 0.9999,
401				automationRate: "k-rate"
402			}];
403		}
404
405		generate(input, channel, parameters) {
406			const delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);
407			this.delayLine.push(channel, input + delayedSample * parameters.feedback);
408			return delayedSample;
409		}
410	}
411`;registerProcessor(workletName$1,feedbackCombFilter);class FeedbackCombFilter extends ToneAudioWorklet{constructor(){const N=optionsFromArguments(FeedbackCombFilter.getDefaults(),arguments,["delayTime","resonance"]);super(N),this.name="FeedbackCombFilter",this.input=new Gain({context:this.context}),this.output=new Gain({context:this.context}),this.delayTime=new Param({context:this.context,value:N.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new Param({context:this.context,value:N.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),readOnly(this,["resonance","delayTime"])}_audioWorkletName(){return workletName$1}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{delayTime:.1,resonance:.5})}onReady(N){connectSeries(this.input,N,this.output);const G=N.parameters.get("delayTime");this.delayTime.setParam(G);const z=N.parameters.get("feedback");this.resonance.setParam(z)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.delayTime.dispose(),this.resonance.dispose(),this}}class OnePoleFilter extends ToneAudioNode{constructor(){const N=optionsFromArguments(OnePoleFilter.getDefaults(),arguments,["frequency","type"]);super(N),this.name="OnePoleFilter",this._frequency=N.frequency,this._type=N.type,this.input=new Gain({context:this.context}),this.output=new Gain({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{frequency:880,type:"lowpass"})}_createFilter(){const N=this._filter,G=this.toFrequency(this._frequency),z=1/(2*Math.PI*G);if(this._type==="lowpass"){const q=1/(z*this.context.sampleRate),Y=q-1;this._filter=this.context.createIIRFilter([q,0],[1,Y])}else{const q=1/(z*this.context.sampleRate)-1;this._filter=this.context.createIIRFilter([1,-1],[1,q])}this.input.chain(this._filter,this.output),N&&this.context.setTimeout(()=>{this.disposed||(this.input.disconnect(N),N.disconnect())},this.blockTime)}get frequency(){return this._frequency}set frequency(N){this._frequency=N,this._createFilter()}get type(){return this._type}set type(N){this._type=N,this._createFilter()}getFrequencyResponse(N=128){const G=new Float32Array(N);for(let Y=0;Y<N;Y++){const ie=Math.pow(Y/N,2)*19980+20;G[Y]=ie}const z=new Float32Array(N),q=new Float32Array(N);return this._filter.getFrequencyResponse(G,z,q),z}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this._filter.disconnect(),this}}class LowpassCombFilter extends ToneAudioNode{constructor(){const N=optionsFromArguments(LowpassCombFilter.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(N),this.name="LowpassCombFilter",this._combFilter=this.output=new FeedbackCombFilter({context:this.context,delayTime:N.delayTime,resonance:N.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new OnePoleFilter({context:this.context,frequency:N.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{dampening:3e3,delayTime:.1,resonance:.5})}get dampening(){return this._lowpass.frequency}set dampening(N){this._lowpass.frequency=N}dispose(){return super.dispose(),this._combFilter.dispose(),this._lowpass.dispose(),this}}class PluckSynth extends Instrument{constructor(){const N=optionsFromArguments(PluckSynth.getDefaults(),arguments);super(N),this.name="PluckSynth",this._noise=new Noise({context:this.context,type:"pink"}),this.attackNoise=N.attackNoise,this._lfcf=new LowpassCombFilter({context:this.context,dampening:N.dampening,resonance:N.resonance}),this.resonance=N.resonance,this.release=N.release,this._noise.connect(this._lfcf),this._lfcf.connect(this.output)}static getDefaults(){return deepMerge(Instrument.getDefaults(),{attackNoise:1,dampening:4e3,resonance:.7,release:1})}get dampening(){return this._lfcf.dampening}set dampening(N){this._lfcf.dampening=N}triggerAttack(N,G){const z=this.toFrequency(N);
vendor: 4,562 bytes, line 411
411G=this.toSeconds(G);const q=1/z;return this._lfcf.delayTime.setValueAtTime(q,G),this._noise.start(G),this._noise.stop(G+q*this.attackNoise),this._lfcf.resonance.cancelScheduledValues(G),this._lfcf.resonance.setValueAtTime(this.resonance,G),this}triggerRelease(N){return this._lfcf.resonance.linearRampTo(0,this.release,N),this}dispose(){return super.dispose(),this._noise.dispose(),this._lfcf.dispose(),this}}class Sampler extends Instrument{constructor(){const N=optionsFromArguments(Sampler.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");super(N),this.name="Sampler",this._activeSources=new Map;const G={};Object.keys(N.urls).forEach(z=>{const q=parseInt(z,10);if(assert(isNote(z)||isNumber$1(q)&&isFinite(q),`url key is neither a note or midi pitch: ${z}`),isNote(z)){const Y=new FrequencyClass(this.context,z).toMidi();G[Y]=N.urls[z]}else isNumber$1(q)&&isFinite(q)&&(G[q]=N.urls[q])}),this._buffers=new ToneAudioBuffers({urls:G,onload:N.onload,baseUrl:N.baseUrl,onerror:N.onerror}),this.attack=N.attack,this.release=N.release,this.curve=N.curve,this._buffers.loaded&&Promise.resolve().then(N.onload)}static getDefaults(){return Object.assign(Instrument.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:noOp,onerror:noOp,release:.1,urls:{}})}_findClosest(N){let z=0;for(;z<96;){if(this._buffers.has(N+z))return-z;if(this._buffers.has(N-z))return z;z++}throw new Error(`No available buffers for note: ${N}`)}triggerAttack(N,G,z=1){return this.log("triggerAttack",N,G,z),Array.isArray(N)||(N=[N]),N.forEach(q=>{const Y=ftomf(new FrequencyClass(this.context,q).toFrequency()),W=Math.round(Y),ie=Y-W,ne=this._findClosest(W),se=W-ne,ae=this._buffers.get(se),ce=intervalToFrequencyRatio(ne+ie),pe=new ToneBufferSource({url:ae,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:ce}).connect(this.output);pe.start(G,0,ae.duration/ce,z),isArray$1(this._activeSources.get(W))||this._activeSources.set(W,[]),this._activeSources.get(W).push(pe),pe.onended=()=>{if(this._activeSources&&this._activeSources.has(W)){const ge=this._activeSources.get(W),ve=ge.indexOf(pe);ve!==-1&&ge.splice(ve,1)}}}),this}triggerRelease(N,G){return this.log("triggerRelease",N,G),Array.isArray(N)||(N=[N]),N.forEach(z=>{const q=new FrequencyClass(this.context,z).toMidi();if(this._activeSources.has(q)&&this._activeSources.get(q).length){const Y=this._activeSources.get(q);G=this.toSeconds(G),Y.forEach(W=>{W.stop(G)}),this._activeSources.set(q,[])}}),this}releaseAll(N){const G=this.toSeconds(N);return this._activeSources.forEach(z=>{for(;z.length;)z.shift().stop(G)}),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(N,G,z,q=1){const Y=this.toSeconds(z);return this.triggerAttack(N,Y,q),isArray$1(G)?(assert(isArray$1(N),"notes must be an array when duration is array"),N.forEach((W,ie)=>{const ne=G[Math.min(ie,G.length-1)];this.triggerRelease(W,Y+this.toSeconds(ne))})):this.triggerRelease(N,Y+this.toSeconds(G)),this}add(N,G,z){if(assert(isNote(N)||isFinite(N),`note must be a pitch or midi: ${N}`),isNote(N)){const q=new FrequencyClass(this.context,N).toMidi();this._buffers.add(q,G,z)}else this._buffers.add(N,G,z);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach(N=>{N.forEach(G=>G.dispose())}),this._activeSources.clear(),this}}__decorate([timeRange(0)],Sampler.prototype,"attack",void 0);__decorate([timeRange(0)],Sampler.prototype,"release",void 0);class CrossFade extends ToneAudioNode{constructor(){const N=optionsFromArguments(CrossFade.getDefaults(),arguments,["fade"]);super(N),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new GainToAudio({context:this.context}),this.a=new Gain({context:this.context,gain:0}),this.b=new Gain({context:this.context,gain:0}),this.output=new Gain({context:this.context}),this._internalChannels=[this.a,this.b],this.fade=new Signal({context:this.context,units:"normalRange",value:N.fade}),readOnly(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",connect(this._split,this.a.gain,0),connect(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{fade:.5})}
vendor: 10,100 bytes, lines 411-430
411dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}class Effect extends ToneAudioNode{constructor(N){super(N),this.name="Effect",this._dryWet=new CrossFade({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new Gain({context:this.context}),this.effectReturn=new Gain({context:this.context}),this.input=new Gain({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(N.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],readOnly(this,"wet")}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{wet:1})}connectEffect(N){return this._internalChannels.push(N),this.effectSend.chain(N,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}}class Panner extends ToneAudioNode{constructor(){const N=optionsFromArguments(Panner.getDefaults(),arguments,["pan"]);super(N),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner,this.pan=new Param({context:this.context,param:this._panner.pan,value:N.pan,minValue:-1,maxValue:1}),this._panner.channelCount=N.channelCount,this._panner.channelCountMode="explicit",readOnly(this,"pan")}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const workletName="bit-crusher",bitCrusherWorklet=`
412	class BitCrusherWorklet extends SingleIOProcessor {
413
414		static get parameterDescriptors() {
415			return [{
416				name: "bits",
417				defaultValue: 12,
418				minValue: 1,
419				maxValue: 16,
420				automationRate: 'k-rate'
421			}];
422		}
423
424		generate(input, _channel, parameters) {
425			const step = Math.pow(0.5, parameters.bits - 1);
426			const val = step * Math.floor(input / step + 0.5);
427			return val;
428		}
429	}
430`;registerProcessor(workletName,bitCrusherWorklet);class Split extends ToneAudioNode{constructor(){const N=optionsFromArguments(Split.getDefaults(),arguments,["channels"]);super(N),this.name="Split",this._splitter=this.input=this.output=this.context.createChannelSplitter(N.channels),this._internalChannels=[this._splitter]}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._splitter.disconnect(),this}}class Merge extends ToneAudioNode{constructor(){const N=optionsFromArguments(Merge.getDefaults(),arguments,["channels"]);super(N),this.name="Merge",this._merger=this.output=this.input=this.context.createChannelMerger(N.channels)}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}class StereoEffect extends ToneAudioNode{constructor(N){super(N),this.name="StereoEffect",this.input=new Gain({context:this.context}),this.input.channelCount=2,this.input.channelCountMode="explicit",this._dryWet=this.output=new CrossFade({context:this.context,fade:N.wet}),this.wet=this._dryWet.fade,this._split=new Split({context:this.context,channels:2}),this._merge=new Merge({context:this.context,channels:2}),this.input.connect(this._split),this.input.connect(this._dryWet.a),this._merge.connect(this._dryWet.b),readOnly(this,["wet"])}connectEffectLeft(...N){this._split.connect(N[0],0,0),connectSeries(...N),connect(N[N.length-1],this._merge,0,0)}connectEffectRight(...N){this._split.connect(N[0],1,0),connectSeries(...N),connect(N[N.length-1],this._merge,0,1)}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{wet:1})}dispose(){return super.dispose(),this._dryWet.dispose(),this._split.dispose(),this._merge.dispose(),this}}class StereoFeedbackEffect extends StereoEffect{constructor(N){super(N),this.feedback=new Signal({context:this.context,value:N.feedback,units:"normalRange"}),this._feedbackL=new Gain({context:this.context}),this._feedbackR=new Gain({context:this.context}),this._feedbackSplit=new Split({context:this.context,channels:2}),this._feedbackMerge=new Merge({context:this.context,channels:2}),this._merge.connect(this._feedbackSplit),this._feedbackMerge.connect(this._split),this._feedbackSplit.connect(this._feedbackL,0,0),this._feedbackL.connect(this._feedbackMerge,0,0),this._feedbackSplit.connect(this._feedbackR,1,0),this._feedbackR.connect(this._feedbackMerge,0,1),this.feedback.fan(this._feedbackL.gain,this._feedbackR.gain),readOnly(this,["feedback"])}static getDefaults(){return Object.assign(StereoEffect.getDefaults(),{feedback:.5})}dispose(){return super.dispose(),this.feedback.dispose(),this._feedbackL.dispose(),this._feedbackR.dispose(),this._feedbackSplit.dispose(),this._feedbackMerge.dispose(),this}}class Chorus extends StereoFeedbackEffect{constructor(){const N=optionsFromArguments(Chorus.getDefaults(),arguments,["frequency","delayTime","depth"]);super(N),this.name="Chorus",this._depth=N.depth,this._delayTime=N.delayTime/1e3,this._lfoL=new LFO({context:this.context,frequency:N.frequency,min:0,max:1}),this._lfoR=new LFO({context:this.context,frequency:N.frequency,min:0,max:1,phase:180}),this._delayNodeL=new Delay({context:this.context}),this._delayNodeR=new Delay({context:this.context}),this.frequency=this._lfoL.frequency,readOnly(this,["frequency"]),this._lfoL.frequency.connect(this._lfoR.frequency),this.connectEffectLeft(this._delayNodeL),this.connectEffectRight(this._delayNodeR),this._lfoL.connect(this._delayNodeL.delayTime),this._lfoR.connect(this._delayNodeR.delayTime),this.depth=this._depth,this.type=N.type,this.spread=N.spread}static getDefaults(){return Object.assign(StereoFeedbackEffect.getDefaults(),{frequency:1.5,delayTime:3.5,depth:.7,type:"sine",spread:180,feedback:0,wet:.5})}get depth(){return this._depth}set depth(N){this._depth=N;const G=this._delayTime*N;this._lfoL.min=Math.max(this._delayTime-G,0),this._lfoL.max=this._delayTime+G,this._lfoR.min=Math.max(this._delayTime-G,0),this._lfoR.max=this._delayTime+G}get delayTime(){return this._delayTime*1e3}set delayTime(N){this._delayTime=N/1e3,this.depth=this._depth}get type(){return this._lfoL.type}set type(N){this._lfoL.type=N,this._lfoR.type=N}get spread(){return this._lfoR.phase-this._lfoL.phase}set spread(N){this._lfoL.phase=90-N/2,this._lfoR.phase=N/2+90}start(N){return this._lfoL.start(N),this._lfoR.start(N),this}stop(N){return this._lfoL.stop(N),this._lfoR.stop(N),this}sync(){return this._lfoL.sync(),this._lfoR.sync(),this}unsync(){return this._lfoL.unsync(),this._lfoR.unsync(),this}dispose(){return super.dispose(),this._lfoL.dispose(),this._lfoR.dispose(),this._delayNodeL.dispose(),this._delayNodeR.dispose(),this.frequency.dispose(),this}}class Reverb extends Effect{constructor(){const N=optionsFromArguments(Reverb.getDefaults(),arguments,["decay"]);super(N),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve(),this._decay=N.decay,this._preDelay=N.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(Effect.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(N){N=this.toSeconds(N),assertRange(N,.001),this._decay=N,this.generate()}get preDelay(){return this._preDelay}set preDelay(N){N=this.toSeconds(N),assertRange(N,0),this._preDelay=N,this.generate()}generate(){return __awaiter(this,void 0,void 0,function*(){const N=this.ready,G=new OfflineContext(2,this._decay+this._preDelay,this.context.sampleRate),z=new Noise({context:G}),q=new Noise({context:G}),Y=new Merge({context:G});z.connect(Y,0,0),q.connect(Y,0,1);const W=new Gain({context:G}).toDestination();Y.connect(W),z.start(0),q.start(0),W.gain.setValueAtTime(0,0),W.gain.setValueAtTime(1,this._preDelay),W.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const ie=G.render();return this.ready=ie.then(noOp),yield N,this._convolver.buffer=(yield ie).get(),this})}dispose(){return super.dispose(),this._convolver.disconnect(),this}}class Solo extends ToneAudioNode{constructor(){const N=optionsFromArguments(Solo.getDefaults(),arguments,["solo"]);super(N),this.name="Solo",this.input=this.output=new Gain({context:this.context}),Solo._allSolos.has(this.context)||Solo._allSolos.set(this.context,new Set),Solo._allSolos.get(this.context).add(this),this.solo=N.solo}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(N){N?this._addSolo():this._removeSolo(),Solo._allSolos.get(this.context).forEach(G=>G._updateSolo())}get muted(){return this.input.gain.value===0}_addSolo(){Solo._soloed.has(this.context)||Solo._soloed.set(this.context,new Set),Solo._soloed.get(this.context).add(this)}_removeSolo(){Solo._soloed.has(this.context)&&Solo._soloed.get(this.context).delete(this)}_isSoloed(){return Solo._soloed.has(this.context)&&Solo._soloed.get(this.context).has(this)}_noSolos(){return!Solo._soloed.has(this.context)||Solo._soloed.has(this.context)&&Solo._soloed.get(this.context).size===0}_updateSolo(){this._isSoloed()?this.input.gain.value=1:this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Solo._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Solo._allSolos=new Map;Solo._soloed=new Map;class PanVol extends ToneAudioNode{constructor(){const N=optionsFromArguments(PanVol.getDefaults(),arguments,["pan","volume"]);super(N),this.name="PanVol",this._panner=this.input=new Panner({context:this.context,pan:N.pan,channelCount:N.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new Volume({context:this.context,volume:N.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=N.mute,readOnly(this,["pan","volume"])}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(N){this._volume.mute=N}
430dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class Channel extends ToneAudioNode{constructor(){const N=optionsFromArguments(Channel.getDefaults(),arguments,["volume","pan"]);super(N),this.name="Channel",this._solo=this.input=new Solo({solo:N.solo,context:this.context}),this._panVol=this.output=new PanVol({context:this.context,pan:N.pan,volume:N.volume,mute:N.mute,channelCount:N.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),readOnly(this,["pan","volume"])}static getDefaults(){return Object.assign(ToneAudioNode.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(N){this._solo.solo=N}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(N){this._panVol.mute=N}_getBus(N){return Channel.buses.has(N)||Channel.buses.set(N,new Gain({context:this.context})),Channel.buses.get(N)}send(N,G=0){const z=this._getBus(N),q=new Gain({context:this.context,units:"decibels",gain:G});return this.connect(q),q.connect(z),q}receive(N){return this._getBus(N).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}Channel.buses=new Map;function now(){return getContext().now()}getContext().transport;getContext().destination;getContext().destination;getContext().listener;getContext().draw;getContext();class AudioSampleManager{constructor(){this.samples=new Map,this.samplePlayers=new Map,this.isInitialized=!1}async initialize(){if(!this.isInitialized)try{await start(),this.isInitialized=!0}catch(N){console.error("Failed to initialize AudioSampleManager:",N)}}async loadSample(N,G){if(this.samples.has(N)){console.warn(`Sample ${N} already loaded`);return}try{this.isInitialized||await this.initialize();const z=`/audio-samples/${G}`,q=new Player().toDestination();this.samples.set(N,{player:q,filename:G,path:z,loaded:!1}),await q.load(z),await new Promise(Y=>setTimeout(Y,50)),this.samples.get(N).loaded=!0}catch(z){console.error(`Failed to load audio sample ${N}:`,z),this.samples.delete(N)}}async loadSamples(N){const G=N.map(z=>this.loadSample(z.name,z.filename));try{await Promise.all(G)}catch(z){console.error("Some audio samples failed to load:",z)}}async playSample(N,G={}){let z=this.samples.get(N);if(!z)try{await this.loadSample(N,this.getFilenameForSample(N)),z=this.samples.get(N)}catch(q){console.error(`Failed to load audio sample ${N} on-demand:`,q);return}if(!z||!z.loaded){console.warn(`Audio sample ${N} not loaded`);return}try{const q=z.player;if(!q.loaded){console.warn(`Audio sample ${N} player not ready`);return}G.volume!==void 0&&(q.volume.value=G.volume),G.playbackRate!==void 0&&(q.playbackRate=G.playbackRate);try{q.stop()}catch{}q.start()}catch(q){console.error(`Failed to play audio sample ${N}:`,q)}}getFilenameForSample(N){return{chart_border:"chart_border.mp3",chart_border_start:"chart_border_start.mp3",no_y:"no_y.mp3",y_axis_intersection:"y-axis-intersection.wav",deny:"deny.wav",notification:"notification.mp3",landmark_square:"landmark_square.mp3",landmark_triangle:"landmark_triangle.mp3",landmark_diamond:"landmark_diamond.mp3"}[N]}stopSample(N){const G=this.samples.get(N);if(G&&G.loaded)try{G.player.stop()}catch(z){console.error(`Failed to stop audio sample ${N}:`,z)}}stopAllSamples(){this.samples.forEach((N,G)=>{if(N.loaded)try{N.player.stop()}catch(z){console.error(`Failed to stop audio sample ${G}:`,z)}})}getLoadedSamples(){const N=[];return this.samples.forEach((G,z)=>{G.loaded&&N.push({name:z,filename:G.filename,path:G.path})}),N}isSampleLoaded(N){const G=this.samples.get(N);return G&&G.loaded}dispose(){this.samples.forEach((N,G)=>{if(N.loaded)try{N.player.dispose()}catch(z){console.error(`Failed to dispose audio sample ${G}:`,z)}}),this.samples.clear(),this.isInitialized=!1}}const audioSampleManager=new AudioSampleManager,GraphContext=reactExports.createContext(),GraphContextProvider=({children:v})=>{const[N,G]=reactExports.useState(initGraphObject.functions),[z,q]=reactExports.useState(initGraphObject.graphSettings),[Y,W]=reactExports.useState(!0),[ie,ne]=reactExports.useState("[[x+5,x < -4],[1/2*x^2,-4<=x < 1],[x-2,1<=x < 3],[5,x==3],[x-2,3 < x < 5],[3,5<= x]]"),[se,ae]=reactExports.useState([]),[ce,pe]=reactExports.useState(null),[ge,ve]=reactExports.useState(!1),[be,Ee]=reactExports.useState({xMin:-10,xMax:10,yMin:-10,yMax:10}),[Pe,Je]=reactExports.useState({active:!1,x:0,speed:10,interval:10,source:null,direction:1}),Ce=reactExports.useRef(!1),Ve=reactExports.useRef(null),Re=reactExports.useRef(null),[qe,et]=reactExports.useState(null),[Ze,tt]=reactExports.useState(.25),[Ke,rt]=reactExports.useState("none"),[it,ot]=reactExports.useState(!1),[ut,ct]=reactExports.useState(null),at={function:reactExports.useRef(null),speed:reactExports.useRef(null)},[st,pt]=reactExports.useState({});if(reactExports.useEffect(()=>{(async()=>{try{const xt=getHashParameter("import");
430if(xt){const ft=decodeFromImportLink(xt);if(ft){if(G(ft.functions),q(ft.graphSettings),ft.graphSettings.defaultView){const[Et,Ct,Dt,Gt]=ft.graphSettings.defaultView;Ee({xMin:Et,xMax:Ct,yMin:Gt,yMax:Dt})}}else console.warn("Invalid import link data")}}catch(xt){console.error("Error loading import link:",xt)}finally{W(!1)}})()},[]),Y)return jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center h-screen",children:jsxRuntimeExports.jsx("div",{className:"text-lg",children:"Loading..."})});const lt=dt=>{const xt=(z==null?void 0:z.minBoundDifference)||.1,ft=(z==null?void 0:z.maxBoundDifference)||100,Et=typeof dt=="function"?dt(be):dt;let Ct=Et.xMax-Et.xMin,Dt=Et.yMax-Et.yMin,Gt=!1;if(Ct<xt){const Ot=(Et.xMin+Et.xMax)/2;Et.xMin=Ot-xt/2,Et.xMax=Ot+xt/2,Ct=xt,Gt=!0}if(Dt<xt){const Ot=(Et.yMin+Et.yMax)/2;Et.yMin=Ot-xt/2,Et.yMax=Ot+xt/2,Dt=xt,Gt=!0}if(Ct>ft){const Ot=(Et.xMin+Et.xMax)/2;Et.xMin=Ot-ft/2,Et.xMax=Ot+ft/2,Gt=!0}if(Dt>ft){const Ot=(Et.yMin+Et.yMax)/2;Et.yMin=Ot-ft/2,Et.yMax=Ot+ft/2,Gt=!0}if(Gt&&ge)try{audioSampleManager.playSample("deny",{volume:-15})}catch(Ot){console.warn("Could not play deny earcon:",Ot)}Ee(Et)},vt=()=>{const dt=document.getElementById("chart");dt&&dt.focus()};return jsxRuntimeExports.jsx(GraphContext.Provider,{value:{functionInput:ie,setFunctionInput:ne,functionDefinitions:N,setFunctionDefinitions:G,graphSettings:z,setGraphSettings:q,cursorCoords:se,setCursorCoords:ae,inputErrorMes:ce,setInputErrorMes:pe,inputErrors:st,setInputErrors:pt,isAudioEnabled:ge,setIsAudioEnabled:ve,graphBounds:be,setGraphBounds:lt,PlayFunction:Pe,setPlayFunction:Je,playActiveRef:Ce,timerRef:Ve,mouseTimeoutRef:Re,inputRefs:at,updateCursor:qe,setUpdateCursor:et,stepSize:Ze,setStepSize:tt,explorationMode:Ke,setExplorationMode:rt,isShiftPressed:it,setIsShiftPressed:ot,discreteBatchValidStartX:ut,setDiscreteBatchValidStartX:ct,focusChart:vt}
430,children:v})},useGraphContext=()=>reactExports.useContext(GraphContext),initGraphObject={functions:[{id:"f1",functionName:"Function 1",type:"function",functionDef:"sin(x)",isActive:!0,instrument:"clarinet",pointOfInterests:[],landmarks:[]},{id:"f2",functionName:"Function 2",type:"piecewise_function",functionDef:[["x^2","x <= 0"],["x + 1"," 0 < x"]],isActive:!1,instrument:"clarinet",pointOfInterests:[],landmarks:[]}],graphSettings:{defaultView:[-10,10,10,-10],minBoundDifference:.1,maxBoundDifference:100,showGrid:!0,showAxes:!0,gridColor:"#CCCCCC",restrictionMode:"none"}};function _extends(){return _extends=Object.assign?Object.assign.bind():function(v){for(var N=1;N<arguments.length;N++){var G=arguments[N];for(var z in G)({}).hasOwnProperty.call(G,z)&&(v[z]=G[z])}return v},_extends.apply(null,arguments)}var DEFAULT_CONFIG={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function isNumber(v){return typeof v=="number"}function isBigNumber(v){return!v||typeof v!="object"||typeof v.constructor!="function"?!1:v.isBigNumber===!0&&typeof v.constructor.prototype=="object"&&v.constructor.prototype.isBigNumber===!0||typeof v.constructor.isDecimal=="function"&&v.constructor.isDecimal(v)===!0}function isComplex(v){return v&&typeof v=="object"&&Object.getPrototypeOf(v).isComplex===!0||!1}function isFraction(v){return v&&typeof v=="object"&&Object.getPrototypeOf(v).isFraction===!0||!1}function isUnit(v){return v&&v.constructor.prototype.isUnit===!0||!1}function isString(v){return typeof v=="string"}var isArray=Array.isArray;function isMatrix(v){return v&&v.constructor.prototype.isMatrix===!0||!1}function isCollection(v){return Array.isArray(v)||isMatrix(v)}function isDenseMatrix(v){return v&&v.isDenseMatrix&&v.constructor.prototype.isMatrix===!0||!1}function isSparseMatrix(v){return v&&v.isSparseMatrix&&v.constructor.prototype.isMatrix===!0||!1}function isRange(v){return v&&v.constructor.prototype.isRange===!0||!1}function isIndex(v){return v&&v.constructor.prototype.isIndex===!0||!1}function isBoolean(v){return typeof v=="boolean"}function isResultSet(v){return v&&v.constructor.prototype.isResultSet===!0||!1}function isHelp(v){return v&&v.constructor.prototype.isHelp===!0||!1}function isFunction(v){return typeof v=="function"}function isDate(v){return v instanceof Date}function isRegExp(v){return v instanceof RegExp}function isObject(v){return!!(v&&typeof v=="object"&&v.constructor===Object&&!isComplex(v)&&!isFraction(v))}function isNull(v){return v===null}function isUndefined(v){return v===void 0}function isAccessorNode(v){return v&&v.isAccessorNode===!0&&v.constructor.prototype.isNode===!0||!1}function isArrayNode(v){return v&&v.isArrayNode===!0&&v.constructor.prototype.isNode===!0||!1}function isAssignmentNode(v){return v&&v.isAssignmentNode===!0&&v.constructor.prototype.isNode===!0||!1}function isBlockNode(v){return v&&v.isBlockNode===!0&&v.constructor.prototype.isNode===!0||!1}function isConditionalNode(v){return v&&v.isConditionalNode===!0&&v.constructor.prototype.isNode===!0||!1}function isConstantNode(v){return v&&v.isConstantNode===!0&&v.constructor.prototype.isNode===!0||!1}function rule2Node(v){return isConstantNode(v)||isOperatorNode(v)&&v.args.length===1&&isConstantNode(v.args[0])&&"-+~".includes(v.op)}function isFunctionAssignmentNode(v){return v&&v.isFunctionAssignmentNode===!0&&v.constructor.prototype.isNode===!0||!1}function isFunctionNode(v){return v&&v.isFunctionNode===!0&&v.constructor.prototype.isNode===!0||!1}function isIndexNode(v){return v&&v.isIndexNode===!0&&v.constructor.prototype.isNode===!0||!1}function isNode(v){return v&&v.isNode===!0&&v.constructor.prototype.isNode===!0||!1}function isObjectNode(v){return v&&v.isObjectNode===!0&&v.constructor.prototype.isNode===!0||!1}function isOperatorNode(v){return v&&v.isOperatorNode===!0&&v.constructor.prototype.isNode===!0||!1}function isParenthesisNode(v){return v&&v.isParenthesisNode===!0&&v.constructor.prototype.isNode===!0||!1}function isRangeNode(v){return v&&v.isRangeNode===!0&&v.constructor.prototype.isNode===!0||!1}function isRelationalNode(v){return v&&v.isRelationalNode===!0&&v.constructor.prototype.isNode===!0||!1}function isSymbolNode(v){return v&&v.isSymbolNode===!0&&v.constructor.prototype.isNode===!0||!1}function isChain(v){return v&&v.constructor.prototype.isChain===!0||!1}function typeOf(v){var N=typeof v;return N==="object"?v===null?"null":isBigNumber(v)?"BigNumber":v.constructor&&v.constructor.name?v.constructor.name:"Object":N}function clone$2(v){var N=typeof v;
430if(N==="number"||N==="string"||N==="boolean"||v===null||v===void 0)return v;if(typeof v.clone=="function")return v.clone();if(Array.isArray(v))return v.map(function(G){return clone$2(G)});if(v instanceof Date)return new Date(v.valueOf());if(isBigNumber(v))return v;if(isObject(v))return mapObject(v,clone$2);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(v,")"))}function mapObject(v,N){var G={};for(var z in v)hasOwnProperty(v,z)&&(G[z]=N(v[z]));return G}function extend(v,N){for(var G in N)hasOwnProperty(N,G)&&(v[G]=N[G]);return v}function deepExtend(v,N){if(Array.isArray(N))throw new TypeError("Arrays are not supported by deepExtend");for(var G in N)if(hasOwnProperty(N,G)&&!(G in Object.prototype)&&!(G in Function.prototype))if(N[G]&&N[G].constructor===Object)v[G]===void 0&&(v[G]={}),v[G]&&v[G].constructor===Object?deepExtend(v[G],N[G]):v[G]=N[G];else{if(Array.isArray(N[G]))throw new TypeError("Arrays are not supported by deepExtend");v[G]=N[G]}return v}function deepStrictEqual(v,N){var G,z,q;if(Array.isArray(v)){if(!Array.isArray(N)||v.length!==N.length)return!1;for(z=0,q=v.length;z<q;z++)if(!deepStrictEqual(v[z],N[z]))return!1;return!0}else{if(typeof v=="function")return v===N;if(v instanceof Object){if(Array.isArray(N)||!(N instanceof Object))return!1;for(G in v)if(!(G in N)||!deepStrictEqual(v[G],N[G]))return!1;for(G in N)if(!(G in v))return!1;return!0}else return v===N}}function deepFlatten(v){var N={};return _deepFlatten(v,N),N}function _deepFlatten(v,N){for(var G in v)if(hasOwnProperty(v,G)){var z=v[G];typeof z=="object"&&z!==null?_deepFlatten(z,N):N[G]=z}}function lazy(v,N,G){var z=!0,q;Object.defineProperty(v,N,{get:function(){return z&&(q=G(),z=!1),q},set:function(W){q=W,z=!1},configurable:!0,enumerable:!0})}function hasOwnProperty(v,N){return v&&Object.hasOwnProperty.call(v,N)}function isLegacyFactory(v){return v&&typeof v.factory=="function"}function pickShallow(v,N){for(var G={},z=0;z<N.length;z++){var q=N[z],Y=v[q];Y!==void 0&&(G[q]=Y)}return G}function values(v){return Object.keys(v).map(N=>v[N])}var MATRIX_OPTIONS=["Matrix","Array"],NUMBER_OPTIONS=["number","BigNumber","Fraction"];function configFactory(v,N){function G(z){if(z){var q=mapObject(v,clone$2);validateOption(z,"matrix",MATRIX_OPTIONS),validateOption(z,"number",NUMBER_OPTIONS),deepExtend(v,z);var Y=mapObject(v,clone$2),W=mapObject(z,clone$2);return N("config",Y,q,W),Y}else return mapObject(v,clone$2)}return G.MATRIX_OPTIONS=MATRIX_OPTIONS,G.NUMBER_OPTIONS=NUMBER_OPTIONS,Object.keys(DEFAULT_CONFIG).forEach(z=>{Object.defineProperty(G,z,{get:()=>v[z],enumerable:!0,configurable:!0})}),G}function contains$1(v,N){return v.indexOf(N)!==-1}function validateOption(v,N,G){v[N]!==void 0&&!contains$1(G,v[N])&&console.warn('Warning: Unknown value "'+v[N]+'" for configuration option "'+N+'". Available options: '+G.map(z=>JSON.stringify(z)).join(", ")+".")}function ok(){return!0}function notOk(){return!1}function undef(){}const NOT_TYPED_FUNCTION="Argument is not a typed-function.";function create$1(){function v(wt){return typeof wt=="object"&&wt!==null&&wt.constructor===Object}const N=[{name:"number",test:function(wt){return typeof wt=="number"}},{name:"string",test:function(wt){return typeof wt=="string"}},{name:"boolean",test:function(wt){return typeof wt=="boolean"}},{name:"Function",test:function(wt){return typeof wt=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(wt){return wt instanceof Date}},{name:"RegExp",test:function(wt){return wt instanceof RegExp}},{name:"Object",test:v},{name:"null",test:function(wt){return wt===null}},{name:"undefined",test:function(wt){return wt===void 0}}],G={name:"any",test:ok,isAny:!0};let z,q,Y=0,W={createCount:0};function ie(wt){const Mt=z.get(wt);if(Mt)return Mt;let Tt='Unknown type "'+wt+'"';const Rt=wt.toLowerCase();let Ft;for(Ft of q)if(Ft.toLowerCase()===Rt){Tt+='. Did you mean "'+Ft+'" ?';break}throw new TypeError(Tt)}function ne(wt){let Mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const Tt=Mt?ie(Mt).index:q.length,Rt=[];for(let Ut=0;Ut<wt.length;++Ut){if(!wt[Ut]||typeof wt[Ut].name!="string"||typeof wt[Ut].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const Zt=wt[Ut].name;if(z.has(Zt))throw new TypeError('Duplicate type name "'+Zt+'"');Rt.push(Zt),z.set(Zt,{name:Zt,test:wt[Ut].test,isAny:wt[Ut].isAny,index:Tt+Ut,conversionsTo:[]})}const Ft=q.slice(Tt);q=q.slice(0,Tt).concat(Rt).concat(Ft);for(let Ut=Tt+Rt.length;Ut<q.length;++Ut)z.get(q[Ut]).index=Ut}function se(){z=new Map,q=[],Y=0,ne([G],!1)}se(),ne(N);function ae(){let wt;for(wt of q)z.get(wt).conversionsTo=[];Y=0}function ce(wt){const Mt=q.filter(Tt=>{const Rt=z.get(Tt);return!Rt.isAny&&Rt.test(wt)});return Mt.length?Mt:["any"]}function pe(wt){return wt&&typeof wt=="function"&&"_typedFunctionData"in wt}function ge(wt,Mt,Tt){if(!pe(wt))throw new TypeError(NOT_TYPED_FUNCTION);const Rt=Tt&&Tt.exact,Ft=Array.isArray(Mt)?Mt.join(","):Mt,Ut=Ve(Ft),Zt=Ee(Ut);if(!Rt||Zt in wt.signatures){const or=wt._typedFunctionData.signatureMap.get(Zt);if(or)return or}const Wt=Ut.length;let qt;if(Rt){qt=[];let or;for(or in wt.signatures)qt.push(wt._typedFunctionData.signatureMap.get(or))}else qt=wt._typedFunctionData.signatures;for(let or=0;or<Wt;++or){const hr=Ut[or],sr=[];let nr;for(nr of qt){const gt=Ze(nr.params,or);if(!(!gt||hr.restParam&&!gt.restParam)){if(!gt.hasAny){const Nt=Ce(gt);if(hr.types.some(Qt=>!Nt.has(Qt.name)))continue}sr.push(nr)}}if(qt=sr,qt.length===0)break}let Yt;for(Yt of qt)if(Yt.params.length<=Wt)return Yt;throw new TypeError("Signature not found (signature: "+(wt.name||"unnamed")+"("+Ee(Ut,", ")+"))")}function ve(wt,Mt,Tt){return ge(wt,Mt,Tt).implementation}function be(wt,Mt){const Tt=ie(Mt);if(Tt.test(wt))return wt;const Rt=Tt.conversionsTo;if(Rt.length===0)throw new Error("There are no conversions to "+Mt+" defined.");for(let Ft=0;Ft<Rt.length;
vendor: 5,188 bytes, line 430
430Ft++)if(ie(Rt[Ft].from).test(wt))return Rt[Ft].convert(wt);throw new Error("Cannot convert "+wt+" to "+Mt)}function Ee(wt){let Mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return wt.map(Tt=>Tt.name).join(Mt)}function Pe(wt){const Mt=wt.indexOf("...")===0,Rt=(Mt?wt.length>3?wt.slice(3):"any":wt).split("|").map(Wt=>ie(Wt.trim()));let Ft=!1,Ut=Mt?"...":"";return{types:Rt.map(function(Wt){return Ft=Wt.isAny||Ft,Ut+=Wt.name+"|",{name:Wt.name,typeIndex:Wt.index,test:Wt.test,isAny:Wt.isAny,conversion:null,conversionIndex:-1}}),name:Ut.slice(0,-1),hasAny:Ft,hasConversion:!1,restParam:Mt}}function Je(wt){const Mt=wt.types.map(Zt=>Zt.name),Tt=st(Mt);let Rt=wt.hasAny,Ft=wt.name;const Ut=Tt.map(function(Zt){const Wt=ie(Zt.from);return Rt=Wt.isAny||Rt,Ft+="|"+Zt.from,{name:Zt.from,typeIndex:Wt.index,test:Wt.test,isAny:Wt.isAny,conversion:Zt,conversionIndex:Zt.index}});return{types:wt.types.concat(Ut),name:Ft,hasAny:Rt,hasConversion:Ut.length>0,restParam:wt.restParam}}function Ce(wt){return wt.typeSet||(wt.typeSet=new Set,wt.types.forEach(Mt=>wt.typeSet.add(Mt.name))),wt.typeSet}function Ve(wt){const Mt=[];if(typeof wt!="string")throw new TypeError("Signatures must be strings");const Tt=wt.trim();if(Tt==="")return Mt;const Rt=Tt.split(",");for(let Ft=0;Ft<Rt.length;++Ft){const Ut=Pe(Rt[Ft].trim());if(Ut.restParam&&Ft!==Rt.length-1)throw new SyntaxError('Unexpected rest parameter "'+Rt[Ft]+'": only allowed for the last parameter');if(Ut.types.length===0)return null;Mt.push(Ut)}return Mt}function Re(wt){const Mt=It(wt);return Mt?Mt.restParam:!1}function qe(wt){if(!wt||wt.types.length===0)return ok;if(wt.types.length===1)return ie(wt.types[0].name).test;if(wt.types.length===2){const Mt=ie(wt.types[0].name).test,Tt=ie(wt.types[1].name).test;return function(Ft){return Mt(Ft)||Tt(Ft)}}else{const Mt=wt.types.map(function(Tt){return ie(Tt.name).test});return function(Rt){for(let Ft=0;Ft<Mt.length;Ft++)if(Mt[Ft](Rt))return!0;return!1}}}function et(wt){let Mt,Tt,Rt;if(Re(wt)){Mt=Ot(wt).map(qe);const Ft=Mt.length,Ut=qe(It(wt)),Zt=function(Wt){for(let qt=Ft;qt<Wt.length;qt++)if(!Ut(Wt[qt]))return!1;return!0};return function(qt){for(let Yt=0;Yt<Mt.length;Yt++)if(!Mt[Yt](qt[Yt]))return!1;return Zt(qt)&&qt.length>=Ft+1}}else return wt.length===0?function(Ut){return Ut.length===0}:wt.length===1?(Tt=qe(wt[0]),function(Ut){return Tt(Ut[0])&&Ut.length===1}):wt.length===2?(Tt=qe(wt[0]),Rt=qe(wt[1]),function(Ut){return Tt(Ut[0])&&Rt(Ut[1])&&Ut.length===2}):(Mt=wt.map(qe),function(Ut){for(let Zt=0;Zt<Mt.length;Zt++)if(!Mt[Zt](Ut[Zt]))return!1;return Ut.length===Mt.length})}function Ze(wt,Mt){return Mt<wt.length?wt[Mt]:Re(wt)?It(wt):null}function tt(wt,Mt){const Tt=Ze(wt,Mt);return Tt?Ce(Tt):new Set}function Ke(wt){return wt.conversion===null||wt.conversion===void 0}function rt(wt,Mt){const Tt=new Set;return wt.forEach(Rt=>{const Ft=tt(Rt.params,Mt);let Ut;for(Ut of Ft)Tt.add(Ut)}),Tt.has("any")?["any"]:Array.from(Tt)}function it(wt,Mt,Tt){let Rt,Ft;const Ut=wt||"unnamed";let Zt=Tt,Wt;for(Wt=0;Wt<Mt.length;Wt++){const hr=[];if(Zt.forEach(sr=>{const nr=Ze(sr.params,Wt),gt=qe(nr);(Wt<sr.params.length||Re(sr.params))&&gt(Mt[Wt])&&hr.push(sr)}),hr.length===0){if(Ft=rt(Zt,Wt),Ft.length>0){const sr=ce(Mt[Wt]);return Rt=new TypeError("Unexpected type of argument in function "+Ut+" (expected: "+Ft.join(" or ")+", actual: "+sr.join(" | ")+", index: "+Wt+")"),Rt.data={category:"wrongType",fn:Ut,index:Wt,actual:sr,expected:Ft},Rt}}else Zt=hr}const qt=Zt.map(function(hr){return Re(hr.params)?1/0:hr.params.length});if(Mt.length<Math.min.apply(null,qt))return Ft=rt(Zt,Wt),Rt=new TypeError("Too few arguments in function "+Ut+" (expected: "+Ft.join(" or ")+", index: "+Mt.length+")"),Rt.data={category:"tooFewArgs",fn:Ut,index:Mt.length,expected:Ft},Rt;const Yt=Math.max.apply(null,qt);if(Mt.length>Yt)return Rt=new TypeError("Too many arguments in function "+Ut+" (expected: "+Yt+", actual: "+Mt.length+")"),Rt.data={category:"tooManyArgs",fn:Ut,index:Mt.length,expectedLength:Yt},Rt;const or=[];for(let hr=0;hr<Mt.length;++hr)or.push(ce(Mt[hr]).join("|"));return Rt=new TypeError('Arguments of type "'+or.join(", ")+'" do not match any of the defined signatures of function '+Ut+"."),Rt.data={category:"mismatch",actual:or},Rt}function ot(wt){let Mt=q.length+1;for(let Tt=0;Tt<wt.types.length;Tt++)Ke(wt.types[Tt])&&(Mt=Math.min(Mt,wt.types[Tt].typeIndex));return Mt}function ut(wt){let Mt=Y+1;for(let Tt=0;Tt<wt.types.length;Tt++)Ke(wt.types[Tt])||(Mt=Math.min(Mt,wt.types[Tt].conversionIndex));return Mt}function ct(wt,Mt){if(wt.hasAny){if(!Mt.hasAny)return 1}else if(Mt.hasAny)return-1;if(wt.restParam){if(!Mt.restParam)return 1}else if(Mt.restParam)return-1;if(wt.hasConversion){if(!Mt.hasConversion)return 1}else if(Mt.hasConversion)return-1;const Tt=ot(wt)-ot(Mt);if(Tt<0)return-1;if(Tt>0)return 1;const Rt=ut(wt)-ut(Mt);return Rt<0?-1:Rt>0?1:0}function at(wt,Mt){const Tt=wt.params,Rt=Mt.params,Ft=It(Tt),Ut=It(Rt),Zt=Re(Tt),Wt=Re(Rt);if(Zt&&Ft.hasAny){if(!Wt||!Ut.hasAny)return 1}else if(Wt&&Ut.hasAny)return-1;let qt=0,Yt=0,or;for(or of Tt)or.hasAny&&++qt,or.hasConversion&&++Yt;let hr=0,sr=0;for(or of Rt)or.hasAny&&++hr,or.hasConversion&&++sr;
430if(qt!==hr)return qt-hr;if(Zt&&Ft.hasConversion){if(!Wt||!Ut.hasConversion)return 1}else if(Wt&&Ut.hasConversion)return-1;if(Yt!==sr)return Yt-sr;if(Zt){if(!Wt)return 1}else if(Wt)return-1;const nr=(Tt.length-Rt.length)*(Zt?-1:1);if(nr!==0)return nr;const gt=[];let Nt=0;for(let ar=0;ar<Tt.length;++ar){const vr=ct(Tt[ar],Rt[ar]);gt.push(vr),Nt+=vr}if(Nt!==0)return Nt;let Qt;for(Qt of gt)if(Qt!==0)return Qt;return 0}function st(wt){if(wt.length===0)return[];const Mt=wt.map(ie);wt.length>1&&Mt.sort((Ft,Ut)=>Ft.index-Ut.index);let Tt=Mt[0].conversionsTo;if(wt.length===1)return Tt;Tt=Tt.concat([]);const Rt=new Set(wt);for(let Ft=1;Ft<Mt.length;++Ft){let Ut;for(Ut of Mt[Ft].conversionsTo)Rt.has(Ut.from)||(Tt.push(Ut),Rt.add(Ut.from))}return Tt}function pt(wt,Mt){let Tt=Mt;if(wt.some(Ft=>Ft.hasConversion)){const Ft=Re(wt),Ut=wt.map(lt);Tt=function(){const Wt=[],qt=Ft?arguments.length-1:arguments.length;for(let Yt=0;Yt<qt;Yt++)Wt[Yt]=Ut[Yt](arguments[Yt]);return Ft&&(Wt[qt]=arguments[qt].map(Ut[qt])),Mt.apply(this,Wt)}}let Rt=Tt;if(Re(wt)){const Ft=wt.length-1;Rt=function(){return Tt.apply(this,Bt(arguments,0,Ft).concat([Bt(arguments,Ft)]))}}return Rt}function lt(wt){let Mt,Tt,Rt,Ft;const Ut=[],Zt=[];switch(wt.types.forEach(function(Wt){Wt.conversion&&(Ut.push(ie(Wt.conversion.from).test),Zt.push(Wt.conversion.convert))}),Zt.length){case 0:return function(qt){return qt};case 1:return Mt=Ut[0],Rt=Zt[0],function(qt){return Mt(qt)?Rt(qt):qt};case 2:return Mt=Ut[0],Tt=Ut[1],Rt=Zt[0],Ft=Zt[1],function(qt){return Mt(qt)?Rt(qt):Tt(qt)?Ft(qt):qt};default:return function(qt){for(let Yt=0;Yt<Zt.length;Yt++)if(Ut[Yt](qt))return Zt[Yt](qt);return qt}}}function vt(wt){function Mt(Tt,Rt,Ft){if(Rt<Tt.length){const Ut=Tt[Rt];let Zt=[];if(Ut.restParam){const Wt=Ut.types.filter(Ke);Wt.length<Ut.types.length&&Zt.push({types:Wt,name:"..."+Wt.map(qt=>qt.name).join("|"),hasAny:Wt.some(qt=>qt.isAny),hasConversion:!1,restParam:!0}),Zt.push(Ut)}else Zt=Ut.types.map(function(Wt){return{types:[Wt],name:Wt.name,hasAny:Wt.isAny,hasConversion:Wt.conversion,restParam:!1}});return ir(Zt,function(Wt){return Mt(Tt,Rt+1,Ft.concat([Wt]))})}else return[Ft]}return Mt(wt,0,[])}function dt(wt,Mt){const Tt=Math.max(wt.length,Mt.length);for(let Wt=0;Wt<Tt;Wt++){const qt=tt(wt,Wt),Yt=tt(Mt,Wt);let or=!1,hr;for(hr of Yt)if(qt.has(hr)){or=!0;break}if(!or)return!1}const Rt=wt.length,Ft=Mt.length,Ut=Re(wt),Zt=Re(Mt);return Ut?Zt?Rt===Ft:Ft>=Rt:Zt?Rt>=Ft:Rt===Ft}function xt(wt){return wt.map(Mt=>Xt(Mt)?bt(Mt.referToSelf.callback):_t(Mt)?tr(Mt.referTo.references,Mt.referTo.callback):Mt)}function ft(wt,Mt,Tt){const Rt=[];let Ft;for(Ft of wt){let Ut=Tt[Ft];if(typeof Ut!="number")throw new TypeError('No definition for referenced signature "'+Ft+'"');if(Ut=Mt[Ut],typeof Ut!="function")return!1;Rt.push(Ut)}return Rt}function Et(wt,Mt,Tt){const Rt=xt(wt),Ft=new Array(Rt.length).fill(!1);let Ut=!0;for(;Ut;){Ut=!1;let Zt=!0;for(let Wt=0;Wt<Rt.length;++Wt){if(Ft[Wt])continue;const qt=Rt[Wt];if(Xt(qt))Rt[Wt]=qt.referToSelf.callback(Tt),Rt[Wt].referToSelf=qt.referToSelf,Ft[Wt]=!0,Zt=!1;else if(_t(qt)){const Yt=ft(qt.referTo.references,Rt,Mt);Yt?(Rt[Wt]=qt.referTo.callback.apply(this,Yt),Rt[Wt].referTo=qt.referTo,Ft[Wt]=!0,Zt=!1):Ut=!0}}if(Zt&&Ut)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return Rt}function Ct(wt){const Mt=/\bthis(\(|\.signatures\b)/;Object.keys(wt).forEach(Tt=>{const Rt=wt[Tt];if(Mt.test(Rt.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Dt(wt,Mt){if(W.createCount++,Object.keys(Mt).length===0)throw new SyntaxError("No signatures provided");W.warnAgainstDeprecatedThis&&Ct(Mt);const Tt=[],Rt=[],Ft={},Ut=[];let Zt;for(Zt in Mt){if(!Object.prototype.hasOwnProperty.call(Mt,Zt))continue;const _r=Ve(Zt);if(!_r)continue;Tt.forEach(function(Pi){if(dt(Pi,_r))throw new TypeError('Conflicting signatures "'+Ee(Pi)+'" and "'+Ee(_r)+'".')}),Tt.push(_r);const qr=Rt.length;Rt.push(Mt[Zt]);const es=_r.map(Je);let yn;for(yn of vt(es)){const Pi=Ee(yn);Ut.push({params:yn,name:Pi,fn:qr}),yn.every(Yo=>!Yo.hasConversion)&&(Ft[Pi]=qr)}}Ut.sort(at);const Wt=Et(Rt,Ft,vn);let qt;for(qt in Ft)Object.prototype.hasOwnProperty.call(Ft,qt)&&(Ft[qt]=Wt[Ft[qt]]);const Yt=[],or=new Map;for(qt of Ut)or.has(qt.name)||(qt.fn=Wt[qt.fn],Yt.push(qt),or.set(qt.name,qt));const hr=Yt[0]&&Yt[0].params.length<=2&&!Re(Yt[0].params),sr=Yt[1]&&Yt[1].params.length<=2&&!Re(Yt[1].params),nr=Yt[2]&&Yt[2].params.length<=2&&!Re(Yt[2].params),gt=Yt[3]&&Yt[3].params.length<=2&&!Re(Yt[3].params),Nt=Yt[4]&&Yt[4].params.length<=2&&!Re(Yt[4].params),Qt=Yt[5]&&Yt[5].params.length<=2&&!Re(Yt[5].params),ar=hr&&sr&&nr&&gt&&Nt&&Qt;for(let _r=0;_r<Yt.length;++_r)Yt[_r].test=et(Yt[_r].params);const vr=hr?qe(Yt[0].params[0]):notOk,xr=sr?qe(Yt[1].params[0]):notOk,Er=nr?qe(Yt[2].params[0]):notOk,ti=gt?qe(Yt[3].params[0]):notOk,Ui=Nt?qe(Yt[4].params[0]):notOk,qi=Qt?qe(Yt[5].params[0]):notOk,Dn=hr?qe(Yt[0].params[1]):notOk,mn=sr?qe(Yt[1].params[1]):notOk,kr=nr?qe(Yt[2].params[1]):notOk,Zr=gt?qe(Yt[3].params[1]):notOk,Fr=Nt?qe(Yt[4].params[1]):notOk,xi=Qt?qe(Yt[5].params[1]):notOk;for(let _r=0;_r<Yt.length;++_r)Yt[_r].implementation=pt(Yt[_r].params,Yt[_r].fn);const Ai=hr?Yt[0].implementation:undef,hi=sr?Yt[1].implementation:undef,Ur=nr?Yt[2].implementation:undef,Ri=gt?Yt[3].implementation:undef,Mi=Nt?Yt[4].implementation:undef,gn=Qt?Yt[5].implementation:undef,$i=hr?Yt[0].params.length:-1,Vo=sr?Yt[1].params.length:-1,ki=nr?Yt[2].params.length:-1,Gs=gt?Yt[3].params.length:-1,Xs=Nt?Yt[4].params.length:-1,Uo=
vendor: 20,929 bytes, line 430
430Qt?Yt[5].params.length:-1,Rs=ar?6:0,ks=Yt.length,Js=Yt.map(_r=>_r.test),Is=Yt.map(_r=>_r.implementation),qo=function(){for(let qr=Rs;qr<ks;qr++)if(Js[qr](arguments))return Is[qr].apply(this,arguments);return W.onMismatch(wt,arguments,Yt)};function vn(_r,qr){return arguments.length===$i&&vr(_r)&&Dn(qr)?Ai.apply(this,arguments):arguments.length===Vo&&xr(_r)&&mn(qr)?hi.apply(this,arguments):arguments.length===ki&&Er(_r)&&kr(qr)?Ur.apply(this,arguments):arguments.length===Gs&&ti(_r)&&Zr(qr)?Ri.apply(this,arguments):arguments.length===Xs&&Ui(_r)&&Fr(qr)?Mi.apply(this,arguments):arguments.length===Uo&&qi(_r)&&xi(qr)?gn.apply(this,arguments):qo.apply(this,arguments)}try{Object.defineProperty(vn,"name",{value:wt})}catch{}return vn.signatures=Ft,vn._typedFunctionData={signatures:Yt,signatureMap:or},vn}function Gt(wt,Mt,Tt){throw it(wt,Mt,Tt)}function Ot(wt){return Bt(wt,0,wt.length-1)}function It(wt){return wt[wt.length-1]}function Bt(wt,Mt,Tt){return Array.prototype.slice.call(wt,Mt,Tt)}function Ht(wt,Mt){for(let Tt=0;Tt<wt.length;Tt++)if(Mt(wt[Tt]))return wt[Tt]}function ir(wt,Mt){return Array.prototype.concat.apply([],wt.map(Mt))}function zt(){const wt=Ot(arguments).map(Tt=>Ee(Ve(Tt))),Mt=It(arguments);if(typeof Mt!="function")throw new TypeError("Callback function expected as last argument");return tr(wt,Mt)}function tr(wt,Mt){return{referTo:{references:wt,callback:Mt}}}function bt(wt){if(typeof wt!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:wt}}}function _t(wt){return wt&&typeof wt.referTo=="object"&&Array.isArray(wt.referTo.references)&&typeof wt.referTo.callback=="function"}function Xt(wt){return wt&&typeof wt.referToSelf=="object"&&typeof wt.referToSelf.callback=="function"}function At(wt,Mt){if(!wt)return Mt;if(Mt&&Mt!==wt){const Tt=new Error("Function names do not match (expected: "+wt+", actual: "+Mt+")");throw Tt.data={actual:Mt,expected:wt},Tt}return wt}function $t(wt){let Mt;for(const Tt in wt)Object.prototype.hasOwnProperty.call(wt,Tt)&&(pe(wt[Tt])||typeof wt[Tt].signature=="string")&&(Mt=At(Mt,wt[Tt].name));return Mt}function Pt(wt,Mt){let Tt;for(Tt in Mt)if(Object.prototype.hasOwnProperty.call(Mt,Tt)){if(Tt in wt&&Mt[Tt]!==wt[Tt]){const Rt=new Error('Signature "'+Tt+'" is defined twice');throw Rt.data={signature:Tt,sourceFunction:Mt[Tt],destFunction:wt[Tt]},Rt}wt[Tt]=Mt[Tt]}}const kt=W;W=function(wt){const Mt=typeof wt=="string",Tt=Mt?1:0;let Rt=Mt?wt:"";const Ft={};for(let Ut=Tt;Ut<arguments.length;++Ut){const Zt=arguments[Ut];let Wt={},qt;if(typeof Zt=="function"?(qt=Zt.name,typeof Zt.signature=="string"?Wt[Zt.signature]=Zt:pe(Zt)&&(Wt=Zt.signatures)):v(Zt)&&(Wt=Zt,Mt||(qt=$t(Zt))),Object.keys(Wt).length===0){const Yt=new TypeError("Argument to 'typed' at index "+Ut+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw Yt.data={index:Ut,argument:Zt},Yt}Mt||(Rt=At(Rt,qt)),Pt(Ft,Wt)}return Dt(Rt||"",Ft)},W.create=create$1,W.createCount=kt.createCount,W.onMismatch=Gt,W.throwMismatchError=Gt,W.createError=it,W.clear=se,W.clearConversions=ae,W.addTypes=ne,W._findType=ie,W.referTo=zt,W.referToSelf=bt,W.convert=be,W.findSignature=ge,W.find=ve,W.isTypedFunction=pe,W.warnAgainstDeprecatedThis=!0,W.addType=function(wt,Mt){let Tt="any";Mt!==!1&&z.has("Object")&&(Tt="Object"),W.addTypes([wt],Tt)};function jt(wt){if(!wt||typeof wt.from!="string"||typeof wt.to!="string"||typeof wt.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(wt.to===wt.from)throw new SyntaxError('Illegal to define conversion from "'+wt.from+'" to itself.')}return W.addConversion=function(wt){let Mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};jt(wt);const Tt=ie(wt.to),Rt=Tt.conversionsTo.find(Ft=>Ft.from===wt.from);if(Rt)if(Mt&&Mt.override)W.removeConversion({from:Rt.from,to:wt.to,convert:Rt.convert});else throw new Error('There is already a conversion from "'+wt.from+'" to "'+Tt.name+'"');Tt.conversionsTo.push({from:wt.from,convert:wt.convert,index:Y++})},W.addConversions=function(wt,Mt){wt.forEach(Tt=>W.addConversion(Tt,Mt))},W.removeConversion=function(wt){jt(wt);const Mt=ie(wt.to),Tt=Ht(Mt.conversionsTo,Ft=>Ft.from===wt.from);if(!Tt)throw new Error("Attempt to remove nonexistent conversion from "+wt.from+" to "+wt.to);if(Tt.convert!==wt.convert)throw new Error("Conversion to remove does not match existing conversion");const Rt=Mt.conversionsTo.indexOf(Tt);Mt.conversionsTo.splice(Rt,1)},W.resolve=function(wt,Mt){if(!pe(wt))throw new TypeError(NOT_TYPED_FUNCTION);const Tt=wt._typedFunctionData.signatures;for(let Rt=0;Rt<Tt.length;++Rt)if(Tt[Rt].test(Mt))return Tt[Rt];return null},W}const typedFunction=create$1();function isInteger(v){return typeof v=="boolean"?!0:isFinite(v)?v===Math.round(v):!1}var sign$1=Math.sign||function(v){return v>0?1:v<0?-1:0},log2$1=Math.log2||function v(N){return Math.log(N)/Math.LN2},log10$1=Math.log10||function v(N){return Math.log(N)/Math.LN10},log1p=Math.log1p||function(v){return Math.log(v+1)},cbrt$1=Math.cbrt||function v(N){if(N===0)return N;var G=N<0,z;return G&&(N=-N),isFinite(N)?(z=Math.exp(Math.log(N)/3),z=(N/(z*z)+2*z)/3):z=N,G?-z:z},expm1=Math.expm1||function v(N){return N>=2e-4||N<=-2e-4?Math.exp(N)-1:N+N*N/2+N*N*N/6};function formatNumberToBase(v,N,G){var z={2:"0b",8:"0o",16:"0x"},q=z[N],Y="";if(G){if(G<1)throw new Error("size must be in greater than 0");if(!isInteger(G))throw new Error("size must be an integer");if(v>2**(G-1)-1||v<-(2**(G-1)))throw new Error("Value must be in range [-2^".concat(G-1,", 2^").concat(G-1,"-1]"));if(!isInteger(v))throw new Error("Value must be an integer");v<0&&(v=v+2**G),Y="i".concat(G)}var W="";return v<0&&(v=-v,W="-"),"".concat(W).concat(q).concat(v.toString(N)).concat(Y)}function format$2(v,N){if(typeof N=="function")return N(v);if(v===1/0)return"Infinity";if(v===-1/0)return"-Infinity";if(isNaN(v))return"NaN";var G="auto",z,q;if(N&&(N.notation&&(G=N.notation),isNumber(N)?z=N:isNumber(N.precision)&&(z=N.precision),N.wordSize&&(q=N.wordSize,typeof q!="number")))throw new Error('Option "wordSize" must be a number');switch(G){case"fixed":return toFixed$1(v,z);case"exponential":return toExponential$1(v,z);case"engineering":return toEngineering$1(v,z);case"bin":return formatNumberToBase(v,2,q);case"oct":return formatNumberToBase(v,8,q);case"hex":return formatNumberToBase(v,16,q);case"auto":return toPrecision(v,z,N&&N).replace(/((\.\d*?)(0+))($|e)/,function(){var Y=arguments[2],W=arguments[4];return Y!=="."?Y+W:W});default:throw new Error('Unknown notation "'+G+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function splitNumber(v){var N=String(v).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!N)throw new SyntaxError("Invalid number "+v);var G=N[1],z=N[2],q=parseFloat(N[4]||"0"),Y=z.indexOf(".");q+=Y!==-1?Y-1:z.length-1;var W=z.replace(".","").replace(/^0*/,function(ie){return q-=ie.length,""}).replace(/0*$/,"").split("").map(function(ie){return parseInt(ie)});return W.length===0&&(W.push(0),q++),{sign:G,coefficients:W,exponent:q}}function toEngineering$1(v,N){if(isNaN(v)||!isFinite(v))return String(v);var G=splitNumber(v),z=roundDigits(G,N),q=z.exponent,Y=z.coefficients,W=q%3===0?q:q<0?q-3-q%3:q-q%3;if(isNumber(N))for(;N>Y.length||q-W+1>Y.length;)Y.push(0);else for(var ie=Math.abs(q-W)-(Y.length-1),ne=0;ne<ie;ne++)Y.push(0);for(var se=Math.abs(q-W),ae=1;se>0;)ae++,se--;var ce=Y.slice(ae).join(""),pe=isNumber(N)&&ce.length||ce.match(/[1-9]/)?"."+ce:"",ge=Y.slice(0,ae).join("")+pe+"e"+(q>=0?"+":"")+W.toString();return z.sign+ge}function toFixed$1(v,N){if(isNaN(v)||!isFinite(v))return String(v);var G=splitNumber(v),z=typeof N=="number"?roundDigits(G,G.exponent+1+N):G,q=z.coefficients,Y=z.exponent+1,W=Y+(N||0);return q.length<W&&(q=q.concat(zeros(W-q.length))),Y<0&&(q=zeros(-Y+1).concat(q),Y=1),Y<q.length&&q.splice(Y,0,Y===0?"0.":"."),z.sign+q.join("")}function toExponential$1(v,N){if(isNaN(v)||!isFinite(v))return String(v);var G=splitNumber(v),z=N?roundDigits(G,N):G,q=z.coefficients,Y=z.exponent;q.length<N&&(q=q.concat(zeros(N-q.length)));var W=q.shift();return z.sign+W+(q.length>0?"."+q.join(""):"")+"e"+(Y>=0?"+":"")+Y}function toPrecision(v,N,G){if(isNaN(v)||!isFinite(v))return String(v);var z=G&&G.lowerExp!==void 0?G.lowerExp:-3,q=G&&G.upperExp!==void 0?G.upperExp:5,Y=splitNumber(v),W=N?roundDigits(Y,N):Y;if(W.exponent<z||W.exponent>=q)return toExponential$1(v,N);var ie=W.coefficients,ne=W.exponent;ie.length<N&&(ie=ie.concat(zeros(N-ie.length))),ie=ie.concat(zeros(ne-ie.length+1+(ie.length<N?N-ie.length:0))),ie=zeros(-ne).concat(ie);var se=ne>0?ne:0;return se<ie.length-1&&ie.splice(se+1,0,"."),W.sign+ie.join("")}function roundDigits(v,N){for(var G={sign:v.sign,coefficients:v.coefficients,exponent:v.exponent},z=G.coefficients;N<=0;)z.unshift(0),G.exponent++,N++;if(z.length>N){var q=z.splice(N,z.length-N);if(q[0]>=5){var Y=N-1;for(z[Y]++;z[Y]===10;)z.pop(),Y===0&&(z.unshift(0),G.exponent++,Y++),Y--,z[Y]++}}return G}function zeros(v){for(var N=[],G=0;G<v;G++)N.push(0);return N}function digits(v){return v.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var DBL_EPSILON=Number.EPSILON||2220446049250313e-31;function nearlyEqual$1(v,N,G){if(G==null)return v===N;if(v===N)return!0;if(isNaN(v)||isNaN(N))return!1;if(isFinite(v)&&isFinite(N)){var z=Math.abs(v-N);return z<DBL_EPSILON?!0:z<=Math.max(Math.abs(v),Math.abs(N))*G}return!1}var acosh$1=Math.acosh||function(v){return Math.log(Math.sqrt(v*v-1)+v)},asinh$1=Math.asinh||function(v){return Math.log(Math.sqrt(v*v+1)+v)},atanh$1=Math.atanh||function(v){return Math.log((1+v)/(1-v))/2},cosh$2=Math.cosh||function(v){return(Math.exp(v)+Math.exp(-v))/2},sinh$2=Math.sinh||function(v){return(Math.exp(v)-Math.exp(-v))/2},tanh$1=Math.tanh||function(v){var N=Math.exp(2*v);return(N-1)/(N+1)};function copysign(v,N){var G=!0,z=N>0?!0:N<0?!1:1/N===1/0;return G^z?-6.283185307179586:v}function formatBigNumberToBase(v,N,G){var z=v.constructor,q=new z(2),Y="";if(G){if(G<1)throw new Error("size must be in greater than 0");if(!isInteger(G))throw new Error("size must be an integer");if(v.greaterThan(q.pow(G-1).sub(1))||v.lessThan(q.pow(G-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(G-1,", 2^").concat(G-1,"-1]"));if(!v.isInteger())throw new Error("Value must be an integer");v.lessThan(0)&&(v=v.add(q.pow(G))),Y="i".concat(G)}switch(N){case 2:return"".concat(v.toBinary()).concat(Y);case 8:return"".concat(v.toOctal()).concat(Y);case 16:return"".concat(v.toHexadecimal()).concat(Y);default:throw new Error("Base ".concat(N," not supported "))}}function format$1(v,N){if(typeof N=="function")return N(v);if(!v.isFinite())return v.isNaN()?"NaN":v.gt(0)?"Infinity":"-Infinity";var G="auto",z,q;if(N!==void 0&&(N.notation&&(G=N.notation),typeof N=="number"?z=N:N.precision!==void 0&&(z=N.precision),N.wordSize&&(q=N.wordSize,typeof q!="number")))throw new Error('Option "wordSize" must be a number');switch(G){case"fixed":return toFixed(v,z);case"exponential":return toExponential(v,z);case"engineering":return toEngineering(v,z);case"bin":return formatBigNumberToBase(v,2,q);case"oct":return formatBigNumberToBase(v,8,q);case"hex":return formatBigNumberToBase(v,16,q);case"auto":{var Y=N&&N.lowerExp!==void 0?N.lowerExp:-3,W=N&&N.upperExp!==void 0?N.upperExp:5;if(v.isZero())return"0";var ie,ne=v.toSignificantDigits(z),se=ne.e;return se>=Y&&se<W?ie=ne.toFixed():ie=toExponential(v,z),ie.replace(/((\.\d*?)(0+))($|e)/,function(){var ae=arguments[2],ce=arguments[4];return ae!=="."?ae+ce:ce})}default:throw new Error('Unknown notation "'+G+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function toEngineering(v,N){var G=v.e,z=G%3===0?G:G<0?G-3-G%3:G-G%3,q=v.mul(Math.pow(10,-z)),Y=q.toPrecision(N);if(Y.indexOf("e")!==-1){var W=v.constructor;Y=new W(Y).toFixed()}return Y+"e"+(G>=0?"+":"")+z.toString()}function toExponential(v,N){return N!==void 0?v.toExponential(N-1):v.toExponential()}function toFixed(v,N){return v.toFixed(N)}function endsWith(v,N){var G=v.length-N.length,z=v.length;return v.substring(G,z)===N}function format(v,N){var G=_format(v,N);return N&&typeof N=="object"&&"truncate"in N&&G.length>N.truncate?G.substring(0,N.truncate-3)+"...":G}function _format(v,N){if(typeof v=="number")return format$2(v,N);if(isBigNumber(v))return format$1(v,N);if(looksLikeFraction(v))return!N||N.fraction!=="decimal"?v.s*v.n+"/"+v.d:v.toString();if(Array.isArray(v))return formatArray(v,N);if(isString(v))return stringify(v);if(typeof v=="function")return v.syntax?String(v.syntax):"function";if(v&&typeof v=="object"){if(typeof v.format=="function")return v.format(N);if(v&&v.toString(N)!=={}.toString())return v.toString(N);var G=Object.keys(v).map(z=>stringify(z)+": "+format(v[z],N));return"{"+G.join(", ")+"}"}return String(v)}function stringify(v){for(var N=String(v),G="",z=0;z<N.length;){var q=N.charAt(z);G+=q in controlCharacters?controlCharacters[q]:q,z++}return'"'+G+'"'}var controlCharacters={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t"};function escape(v){var N=String(v);return N=N.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),N}function formatArray(v,N){if(Array.isArray(v)){for(var G="[",z=v.length,q=0;q<z;q++)q!==0&&(G+=", "),G+=formatArray(v[q],N);return G+="]",G}else return format(v,N)}function looksLikeFraction(v){return v&&typeof v=="object"&&typeof v.s=="number"&&typeof v.n=="number"&&typeof v.d=="number"||!1}function compareText(v,N){if(!isString(v))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+typeOf(v)+", index: 0)");if(!isString(N))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+typeOf(N)+", index: 1)");return v===N?0:v>N?1:-1}function DimensionError(v,N,G){if(!(this instanceof DimensionError))throw new SyntaxError("Constructor must be called with the new operator");this.actual=v,this.expected=N,this.relation=G,this.message="Dimension mismatch ("+(Array.isArray(v)?"["+v.join(", ")+"]":v)+" "+(this.relation||"!=")+" "+(Array.isArray(N)?"["+N.join(", ")+"]":N)+")",this.stack=new Error().stack}DimensionError.prototype=new RangeError;DimensionError.prototype.constructor=RangeError;DimensionError.prototype.name="DimensionError";DimensionError.prototype.isDimensionError=!0;function IndexError(v,N,G){if(!(this instanceof IndexError))throw new SyntaxError("Constructor must be called with the new operator");this.index=v,arguments.length<3?(this.min=0,this.max=N):(this.min=N,this.max=G),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}IndexError.prototype=new RangeError;IndexError.prototype.constructor=RangeError;IndexError.prototype.name="IndexError";IndexError.prototype.isIndexError=!0;function arraySize(v){for(var N=[];Array.isArray(v);)N.push(v.length),v=v[0];return N}function _validate(v,N,G){var z,q=v.length;if(q!==N[G])throw new DimensionError(q,N[G]);if(G<N.length-1){var Y=G+1;for(z=0;z<q;z++){var W=v[z];if(!Array.isArray(W))throw new DimensionError(N.length-1,N.length,"<");_validate(v[z],N,Y)}}else for(z=0;z<q;z++)if(Array.isArray(v[z]))throw new DimensionError(N.length+1,N.length,">")}function validate(v,N){var G=N.length===0;if(G){if(Array.isArray(v))throw new DimensionError(v.length,0)}else _validate(v,N,0)}function validateIndexSourceSize(v,N){var G=v.isMatrix?v._size:arraySize(v),z=N._sourceSize;z.forEach((q,Y)=>{if(q!==null&&q!==G[Y])throw new DimensionError(q,G[Y])})}function validateIndex(v,N){if(v!==void 0){if(!isNumber(v)||!isInteger(v))throw new TypeError("Index must be an integer (value: "+v+")");if(v<0||typeof N=="number"&&v>=N)throw new IndexError(v,N)}}function isEmptyIndex(v){for(var N=0;N<v._dimensions.length;++N){var G=v._dimensions[N];if(G._data&&isArray(G._data)){if(G._size[0]===0)return!0}else if(G.isRange){if(G.start===G.end)return!0}else if(isString(G)&&G.length===0)return!0}return!1}function resize(v,N,G){if(!Array.isArray(N))throw new TypeError("Array expected");if(N.length===0)throw new Error("Resizing to scalar is not supported");N.forEach(function(q){if(!isNumber(q)||!isInteger(q)||q<0)throw new TypeError("Invalid size, must contain positive integers (size: "+format(N)+")")}),(isNumber(v)||isBigNumber(v))&&(v=[v]);var z=G!==void 0?G:0;return _resize(v,N,0,z),v}function _resize(v,N,G,z){var q,Y,W=v.length,ie=N[G],ne=Math.min(W,ie);if(v.length=ie,G<N.length-1){var se=G+1;for(q=0;q<ne;q++)Y=v[q],Array.isArray(Y)||(Y=[Y],v[q]=Y),_resize(Y,N,se,z);for(q=ne;q<ie;q++)Y=[],v[q]=Y,_resize(Y,N,se,z)}else{for(q=0;q<ne;q++)for(;Array.isArray(v[q]);)v[q]=v[q][0];for(q=ne;q<ie;q++)v[q]=z}}function reshape(v,N){var G=flatten(v),z=G.length;if(!Array.isArray(v)||!Array.isArray(N))throw new TypeError("Array expected");if(N.length===0)throw new DimensionError(0,z,"!=");N=processSizesWildcard(N,z);var q=product$1(N);if(z!==q)throw new DimensionError(q,z,"!=");try{return _reshape(G,N)}catch(Y){throw Y instanceof DimensionError?new DimensionError(q,z,"!="):Y}}function processSizesWildcard(v,N){var G=product$1(v),z=v.slice(),q=-1,Y=v.indexOf(q),W=v.indexOf(q,Y+1)>=0;if(W)throw new Error("More than one wildcard in sizes");var ie=Y>=0,ne=N%G===0;if(ie)if(ne)z[Y]=-N/G;else throw new Error("Could not replace wildcard, since "+N+" is no multiple of "+-G);return z}function product$1(v){return v.reduce((N,G)=>N*G,1)}function _reshape(v,N){for(var G=v,z,q=N.length-1;q>0;q--){var Y=N[q];z=[];for(var W=G.length/Y,ie=0;ie<W;ie++)z.push(G.slice(ie*Y,(ie+1)*Y));G=z}return G}function squeeze(v,N){for(var G=arraySize(v);Array.isArray(v)&&v.length===1;)v=v[0],G.shift();for(var z=G.length;G[z-1]===1;)z--;return z<G.length&&(v=_squeeze(v,z,0),G.length=z),v}function _squeeze(v,N,G){var z,q;if(G<N){var Y=G+1;for(z=0,q=v.length;z<q;z++)v[z]=_squeeze(v[z],N,Y)}else for(;Array.isArray(v);)v=v[0];return v}function unsqueeze(v,N,G,z){var q=z||arraySize(v);if(G)for(var Y=0;Y<G;Y++)v=[v],q.unshift(1);for(v=_unsqueeze(v,N,0);q.length<N;)q.push(1);return v}function _unsqueeze(v,N,G){var z,q;if(Array.isArray(v)){var Y=G+1;for(z=0,q=v.length;z<q;z++)v[z]=_unsqueeze(v[z],N,Y)}else for(var W=G;W<N;W++)v=[v];return v}function flatten(v){if(!Array.isArray(v))return v;var N=[];return v.forEach(function G(z){Array.isArray(z)?z.forEach(G):N.push(z)}),N}function map(v,N){return Array.prototype.map.call(v,N)}function forEach(v,N){Array.prototype.forEach.call(v,N)}function filter(v,N){if(arraySize(v).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(v,N)}function filterRegExp(v,N){if(arraySize(v).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(v,G=>N.test(G))}function join(v,N){return Array.prototype.join.call(v,N)}function identify(v){if(!Array.isArray(v))throw new TypeError("Array input expected");if(v.length===0)return v;var N=[],G=0;N[0]={value:v[0],identifier:0};for(var z=1;z<v.length;z++)v[z]===v[z-1]?G++:G=0,N.push({value:v[z],identifier:G});return N}function generalize(v){if(!Array.isArray(v))throw new TypeError("Array input expected");if(v.length===0)return v;for(var N=[],G=0;G<v.length;G++)N.push(v[G].value);return N}function getArrayDataType(v,N){for(var G,z=0,q=0;q<v.length;q++){var Y=v[q],W=Array.isArray(Y);if(q===0&&W&&(z=Y.length),W&&Y.length!==z)return;var ie=W?getArrayDataType(Y,N):N(Y);if(G===void 0)G=ie;else if(G!==ie)return"mixed"}return G}function contains(v,N){return v.indexOf(N)!==-1}function concatRecursive(v,N,G,z){if(z<G){if(v.length!==N.length)throw new DimensionError(v.length,N.length);for(var q=[],Y=0;Y<v.length;Y++)q[Y]=concatRecursive(v[Y],N[Y],G,z+1);return q}else return v.concat(N)}function concat(){var v=Array.prototype.slice.call(arguments,0,-1),N=Array.prototype.slice.call(arguments,-1);if(v.length===1)return v[0];if(v.length>1)return v.slice(1).reduce(function(G,z){return concatRecursive(G,z,N,0)},v[0]);throw new Error("Wrong number of arguments in function concat")}function broadcastSizes(){for(var v=arguments.length,N=new Array(v),G=0;G<v;G++)N[G]=arguments[G];for(var z=N.map(pe=>pe.length),q=Math.max(...z),Y=new Array(q).fill(null),W=0;W<N.length;W++)for(var ie=N[W],ne=z[W],se=0;se<ne;se++){var ae=q-ne+se;ie[se]>Y[ae]&&(Y[ae]=ie[se])}for(var ce=0;ce<N.length;ce++)checkBroadcastingRules(N[ce],Y);return Y}function checkBroadcastingRules(v,N){for(var G=N.length,z=v.length,q=0;q<z;q++){var Y=G-z+q;if(v[q]<N[Y]&&v[q]>1||v[q]>N[Y])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(v,") 
430not possible to broadcast dimension ").concat(z," with size ").concat(v[q]," to size ").concat(N[Y]))}}function broadcastTo(v,N){var G=arraySize(v);if(deepStrictEqual(G,N))return v;checkBroadcastingRules(G,N);var z=broadcastSizes(G,N),q=z.length,Y=[...Array(q-G.length).fill(1),...G],W=clone$1(v);G.length<q&&(W=reshape(W,Y),G=arraySize(W));for(var ie=0;ie<q;ie++)G[ie]<z[ie]&&(W=stretch(W,z[ie],ie),G=arraySize(W));return W}function stretch(v,N,G){return concat(...Array(N).fill(v),G)}function clone$1(v){return _extends([],v)}function factory(v,N,G,z){function q(Y){var W=pickShallow(Y,N.map(stripOptionalNotation));return assertDependencies(v,N,Y),G(W)}return q.isFactory=!0,q.fn=v,q.dependencies=N.slice().sort(),z&&(q.meta=z),q}function isFactory(v){return typeof v=="function"&&typeof v.fn=="string"&&Array.isArray(v.dependencies)}function assertDependencies(v,N,G){var z=N.filter(Y=>!isOptionalDependency(Y)).every(Y=>G[Y]!==void 0);if(!z){var q=N.filter(Y=>G[Y]===void 0);throw new Error('Cannot create function "'.concat(v,'", ')+"some dependencies are missing: ".concat(q.map(Y=>'"'.concat(Y,'"')).join(", "),"."))}}function isOptionalDependency(v){return v&&v[0]==="?"}function stripOptionalNotation(v){return v&&v[0]==="?"?v.slice(1):v}function getSafeProperty(v,N){if(isPlainObject(v)&&isSafeProperty(v,N))return v[N];throw typeof v[N]=="function"&&isSafeMethod(v,N)?new Error('Cannot access method "'+N+'" as a property'):new Error('No access to property "'+N+'"')}function setSafeProperty(v,N,G){if(isPlainObject(v)&&isSafeProperty(v,N))return v[N]=G,G;throw new Error('No access to property "'+N+'"')}function hasSafeProperty(v,N){return N in v}function isSafeProperty(v,N){return!v||typeof v!="object"?!1:hasOwnProperty(safeNativeProperties,N)?!0:!(N in Object.prototype||N in Function.prototype)}function getSafeMethod(v,N){if(!isSafeMethod(v,N))throw new Error('No access to method "'+N+'"');return v[N]}function isSafeMethod(v,N){return v==null||typeof v[N]!="function"||hasOwnProperty(v,N)&&Object.getPrototypeOf&&N in Object.getPrototypeOf(v)?!1:hasOwnProperty(safeNativeMethods,N)?!0:!(N in Object.prototype||N in Function.prototype)}function isPlainObject(v){return typeof v=="object"&&v&&v.constructor===Object}var safeNativeProperties={length:!0,name:!0},safeNativeMethods={toString:!0,valueOf:!0,toLocaleString:!0};class ObjectWrappingMap{constructor(N){this.wrappedObject=N}keys(){return Object.keys(this.wrappedObject)}get(N){return getSafeProperty(this.wrappedObject,N)}set(N,G){return setSafeProperty(this.wrappedObject,N,G),this}has(N){return hasSafeProperty(this.wrappedObject,N)}}function createEmptyMap(){return new Map}function createMap$1(v){if(!v)return createEmptyMap();if(isMap(v))return v;if(isObject(v))return new ObjectWrappingMap(v);throw new Error("createMap can create maps from objects or Maps")}function toObject(v){if(v instanceof ObjectWrappingMap)return v.wrappedObject;var N={};for(var G of v.keys()){var z=v.get(G);setSafeProperty(N,G,z)}return N}function isMap(v){return v?v instanceof Map||v instanceof ObjectWrappingMap||typeof v.set=="function"&&typeof v.get=="function"&&typeof v.keys=="function"&&typeof v.has=="function":!1}function assign(v){for(var N=arguments.length,G=new Array(N>1?N-1:0),z=1;z<N;z++)G[z-1]=arguments[z];for(var q of G)if(q){if(isMap(q))for(var Y of q.keys())v.set(Y,q.get(Y));else if(isObject(q))for(var W of Object.keys(q))v.set(W,q[W])}return v}var _createTyped2=function v(){return _createTyped2=typedFunction.create,typedFunction},dependencies$4Q=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],createTyped=factory("typed",dependencies$4Q,function v(N){var{BigNumber:G,Complex:z,DenseMatrix:q,Fraction:Y}=N,W=_createTyped2();return W.clear(),W.addTypes([{name:"number",test:isNumber},{name:"Complex",test:isComplex},{name:"BigNumber",test:isBigNumber},{name:"Fraction",test:isFraction},{name:"Unit",test:isUnit},{name:"identifier",test:ie=>isString
vendor: 16,030 bytes, line 430
430&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(
430ie)},{name:"string",test:isString},{name:"Chain",test:isChain},{name:"Array",test:isArray},{name:"Matrix",test:isMatrix},{name:"DenseMatrix",test:isDenseMatrix},{name:"SparseMatrix",test:isSparseMatrix},{name:"Range",test:isRange},{name:"Index",test:isIndex},{name:"boolean",test:isBoolean},{name:"ResultSet",test:isResultSet},{name:"Help",test:isHelp},{name:"function",test:isFunction},{name:"Date",test:isDate},{name:"RegExp",test:isRegExp},{name:"null",test:isNull},{name:"undefined",test:isUndefined}
vendor: 9,340 bytes, lines 430-436
430,{name:"AccessorNode",test:isAccessorNode},{name:"ArrayNode",test:isArrayNode},{name:"AssignmentNode",test:isAssignmentNode},{name:"BlockNode",test:isBlockNode},{name:"ConditionalNode",test:isConditionalNode},{name:"ConstantNode",test:isConstantNode},{name:"FunctionNode",test:isFunctionNode},{name:"FunctionAssignmentNode",test:isFunctionAssignmentNode},{name:"IndexNode",test:isIndexNode},{name:"Node",test:isNode},{name:"ObjectNode",test:isObjectNode},{name:"OperatorNode",test:isOperatorNode},{name:"ParenthesisNode",test:isParenthesisNode},{name:"RangeNode",test:isRangeNode},{name:"RelationalNode",test:isRelationalNode},{name:"SymbolNode",test:isSymbolNode},{name:"Map",test:isMap},{name:"Object",test:isObject}]),W.addConversions([{from:"number",to:"BigNumber",convert:function(ne){if(G||throwNoBignumber(ne),digits(ne)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+ne+"). Use function bignumber(x) to convert to BigNumber.");return new G(ne)}},{from:"number",to:"Complex",convert:function(ne){return z||throwNoComplex(ne),new z(ne,0)}},{from:"BigNumber",to:"Complex",convert:function(ne){return z||throwNoComplex(ne),new z(ne.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(ne){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(ne){return z||throwNoComplex(ne),new z(ne.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(ne){Y||throwNoFraction(ne);var se=new Y(ne);if(se.valueOf()!==ne)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+ne+"). Use function fraction(x) to convert to Fraction.");return se}},{from:"string",to:"number",convert:function(ne){var se=Number(ne);if(isNaN(se))throw new Error('Cannot convert "'+ne+'" to a number');return se}},{from:"string",to:"BigNumber",convert:function(ne){G||throwNoBignumber(ne);try{return new G(ne)}catch{throw new Error('Cannot convert "'+ne+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(ne){Y||throwNoFraction(ne);try{return new Y(ne)}catch{throw new Error('Cannot convert "'+ne+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(ne){z||throwNoComplex(ne);try{return new z(ne)}catch{throw new Error('Cannot convert "'+ne+'" to Complex')}}},{from:"boolean",to:"number",convert:function(ne){return+ne}},{from:"boolean",to:"BigNumber",convert:function(ne){return G||throwNoBignumber(ne),new G(+ne)}},{from:"boolean",to:"Fraction",convert:function(ne){return Y||throwNoFraction(ne),new Y(+ne)}},{from:"boolean",to:"string",convert:function(ne){return String(ne)}},{from:"Array",to:"Matrix",convert:function(ne){return q||throwNoMatrix(),new q(ne)}},{from:"Matrix",to:"Array",convert:function(ne){return ne.valueOf()}}]),W.onMismatch=(ie,ne,se)=>{var ae=W.createError(ie,ne,se);if(["wrongType","mismatch"].includes(ae.data.category)&&ne.length===1&&isCollection(ne[0])&&se.some(pe=>!pe.params.includes(","))){var ce=new TypeError("Function '".concat(ie,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(ie,")'."));throw ce.data=ae.data,ce}throw ae},W.onMismatch=(ie,ne,se)=>{var ae=W.createError(ie,ne,se);if(["wrongType","mismatch"].includes(ae.data.category)&&ne.length===1&&isCollection(ne[0])&&se.some(pe=>!pe.params.includes(","))){var ce=new TypeError("Function '".concat(ie,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(ie,")'."));throw ce.data=ae.data,ce}throw ae},W});function throwNoBignumber(v){throw new Error("Cannot convert value ".concat(v," into a BigNumber: no class 'BigNumber' provided"))}function throwNoComplex(v){throw new Error("Cannot convert value ".concat(v," into a Complex number: no class 'Complex' provided"))}function throwNoMatrix(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function throwNoFraction(v){throw new Error("Cannot convert value ".concat(v," into a Fraction, no class 'Fraction' provided."))}var name$4Q="ResultSet",dependencies$4P=[],createResultSet=factory(name$4Q,dependencies$4P,()=>{function v(N){if(!(this instanceof v))throw new SyntaxError("Constructor must be called with the new operator");this.entries=N||[]}return v.prototype.type="ResultSet",v.prototype.isResultSet=!0,v.prototype.valueOf=function(){return this.entries},v.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},v.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},v.fromJSON=function(N){return new v(N.entries)},v},{isClass:!0});/*!
431 *  decimal.js v10.5.0
432 *  An arbitrary-precision Decimal type for JavaScript.
433 *  https://github.com/MikeMcl/decimal.js
434 *  Copyright (c) 2025 Michael Mclaughlin <[email protected]>
435 *  MIT Licence
436 */var EXP_LIMIT=9e15,MAX_DIGITS=1e9,NUMERALS="0123456789abcdef",LN10="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",PI="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",DEFAULTS={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:EXP_LIMIT,crypto:!1},inexact,quadrant,external=!0,decimalError="[DecimalError] ",invalidArgument=decimalError+"Invalid argument: ",precisionLimitExceeded=decimalError+"Precision limit exceeded",cryptoUnavailable=decimalError+"crypto unavailable",tag="[object Decimal]",mathfloor=Math.floor,mathpow=Math.pow,isBinary=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,isHex=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,isOctal=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,isDecimal=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,BASE=1e7,LOG_BASE=7,MAX_SAFE_INTEGER=9007199254740991,LN10_PRECISION=LN10.length-1,PI_PRECISION=PI.length-1,P$4={toStringTag:tag};P$4.absoluteValue=P$4.abs=function(){var v=new this.constructor(this);return v.s<0&&(v.s=1),finalise(v)};P$4.ceil=function(){return finalise(new this.constructor(this),this.e+1,2)};P$4.clampedTo=P$4.clamp=function(v,N){var G,z=this,q=z.constructor;if(v=new q(v),N=new q(N),!v.s||!N.s)return new q(NaN);if(v.gt(N))throw Error(invalidArgument+N);return G=z.cmp(v),G<0?v:z.cmp(N)>0?N:new q(z)};P$4.comparedTo=P$4.cmp=function(v){var N,G,z,q,Y=this,W=Y.d,ie=(v=new Y.constructor(v)).d,ne=Y.s,se=v.s;if(!W||!ie)return!ne||!se?NaN:ne!==se?ne:W===ie?0:!W^ne<0?1:-1;if(!W[0]||!ie[0])return W[0]?ne:ie[0]?-se:0;if(ne!==se)return ne;if(Y.e!==v.e)return Y.e>v.e^ne<0?1:-1;for(z=W.length,q=ie.length,N=0,G=z<q?z:q;N<G;++N)if(W[N]!==ie[N])return W[N]>ie[N]^ne<0?1:-1;return z===q?0:z>q^ne<0?1:-1};P$4.cosine=P$4.cos=function(){var v,N,G=this,z=G.constructor;return G.d?G.d[0]?(v=z.precision,N=z.rounding,z.precision=v+Math.max(G.e,G.sd())+LOG_BASE,z.rounding=1,G=cosine(z,toLessThanHalfPi(z,G)),z.precision=v,z.rounding=N,finalise(quadrant==2||quadrant==3?G.neg():G,v,N,!0)):new z(1):new z(NaN)};P$4.cubeRoot=P$4.cbrt=function(){var v,N,G,z,q,Y,W,ie,ne,se,ae=this,ce=ae.constructor;if(!ae.isFinite()||ae.isZero())return new ce(ae);for(external=!1,Y=ae.s*mathpow(ae.s*ae,1/3),!Y||Math.abs(Y)==1/0?(G=digitsToString(ae.d),v=ae.e,(Y=(v-G.length+1)%3)&&(G+=Y==1||Y==-2?"0":"00"),Y=mathpow(G,1/3),v=mathfloor((v+1)/3)-(v%3==(v<0?-1:2)),Y==1/0?G="5e"+v:(G=Y.toExponential(),G=G.slice(0,G.indexOf("e")+1)+v),z=new ce(G),z.s=ae.s
vendor: 31,318 bytes, line 436
436):z=new ce(Y.toString()),W=(v=ce.precision)+3;;)if(ie=z,ne=ie.times(ie).times(ie),se=ne.plus(ae),z=divide(se.plus(ae).times(ie),se.plus(ne),W+2,1),digitsToString(ie.d).slice(0,W)===(G=digitsToString(z.d)).slice(0,W))if(G=G.slice(W-3,W+1),G=="9999"||!q&&G=="4999"){if(!q&&(finalise(ie,v+1,0),ie.times(ie).times(ie).eq(ae))){z=ie;break}W+=4,q=1}else{(!+G||!+G.slice(1)&&G.charAt(0)=="5")&&(finalise(z,v+1,1),N=!z.times(z).times(z).eq(ae));break}return external=!0,finalise(z,v,ce.rounding,N)};P$4.decimalPlaces=P$4.dp=function(){var v,N=this.d,G=NaN;if(N){if(v=N.length-1,G=(v-mathfloor(this.e/LOG_BASE))*LOG_BASE,v=N[v],v)for(;v%10==0;v/=10)G--;G<0&&(G=0)}return G};P$4.dividedBy=P$4.div=function(v){return divide(this,new this.constructor(v))};P$4.dividedToIntegerBy=P$4.divToInt=function(v){var N=this,G=N.constructor;return finalise(divide(N,new G(v),0,1,1),G.precision,G.rounding)};P$4.equals=P$4.eq=function(v){return this.cmp(v)===0};P$4.floor=function(){return finalise(new this.constructor(this),this.e+1,3)};P$4.greaterThan=P$4.gt=function(v){return this.cmp(v)>0};P$4.greaterThanOrEqualTo=P$4.gte=function(v){var N=this.cmp(v);return N==1||N===0};P$4.hyperbolicCosine=P$4.cosh=function(){var v,N,G,z,q,Y=this,W=Y.constructor,ie=new W(1);if(!Y.isFinite())return new W(Y.s?1/0:NaN);if(Y.isZero())return ie;G=W.precision,z=W.rounding,W.precision=G+Math.max(Y.e,Y.sd())+4,W.rounding=1,q=Y.d.length,q<32?(v=Math.ceil(q/3),N=(1/tinyPow(4,v)).toString()):(v=16,N="2.3283064365386962890625e-10"),Y=taylorSeries(W,1,Y.times(N),new W(1),!0);for(var ne,se=v,ae=new W(8);se--;)ne=Y.times(Y),Y=ie.minus(ne.times(ae.minus(ne.times(ae))));return finalise(Y,W.precision=G,W.rounding=z,!0)};P$4.hyperbolicSine=P$4.sinh=function(){var v,N,G,z,q=this,Y=q.constructor;if(!q.isFinite()||q.isZero())return new Y(q);if(N=Y.precision,G=Y.rounding,Y.precision=N+Math.max(q.e,q.sd())+4,Y.rounding=1,z=q.d.length,z<3)q=taylorSeries(Y,2,q,q,!0);else{v=1.4*Math.sqrt(z),v=v>16?16:v|0,q=q.times(1/tinyPow(5,v)),q=taylorSeries(Y,2,q,q,!0);for(var W,ie=new Y(5),ne=new Y(16),se=new Y(20);v--;)W=q.times(q),q=q.times(ie.plus(W.times(ne.times(W).plus(se))))}return Y.precision=N,Y.rounding=G,finalise(q,N,G,!0)};P$4.hyperbolicTangent=P$4.tanh=function(){var v,N,G=this,z=G.constructor;return G.isFinite()?G.isZero()?new z(G):(v=z.precision,N=z.rounding,z.precision=v+7,z.rounding=1,divide(G.sinh(),G.cosh(),z.precision=v,z.rounding=N)):new z(G.s)};P$4.inverseCosine=P$4.acos=function(){var v=this,N=v.constructor,G=v.abs().cmp(1),z=N.precision,q=N.rounding;return G!==-1?G===0?v.isNeg()?getPi(N,z,q):new N(0):new N(NaN):v.isZero()?getPi(N,z+4,q).times(.5):(N.precision=z+6,N.rounding=1,v=new N(1).minus(v).div(v.plus(1)).sqrt().atan(),N.precision=z,N.rounding=q,v.times(2))};P$4.inverseHyperbolicCosine=P$4.acosh=function(){var v,N,G=this,z=G.constructor;return G.lte(1)?new z(G.eq(1)?0:NaN):G.isFinite()?(v=z.precision,N=z.rounding,z.precision=v+Math.max(Math.abs(G.e),G.sd())+4,z.rounding=1,external=!1,G=G.times(G).minus(1).sqrt().plus(G),external=!0,z.precision=v,z.rounding=N,G.ln()):new z(G)};P$4.inverseHyperbolicSine=P$4.asinh=function(){var v,N,G=this,z=G.constructor;return!G.isFinite()||G.isZero()?new z(G):(v=z.precision,N=z.rounding,z.precision=v+2*Math.max(Math.abs(G.e),G.sd())+6,z.rounding=1,external=!1,G=G.times(G).plus(1).sqrt().plus(G),external=!0,z.precision=v,z.rounding=N,G.ln())};P$4.inverseHyperbolicTangent=P$4.atanh=function(){var v,N,G,z,q=this,Y=q.constructor;return q.isFinite()?q.e>=0?new Y(q.abs().eq(1)?q.s/0:q.isZero()?q:NaN):(v=Y.precision,N=Y.rounding,z=q.sd(),Math.max(z,v)<2*-q.e-1?finalise(new Y(q),v,N,!0):(Y.precision=G=z-q.e,q=divide(q.plus(1),new Y(1).minus(q),G+v,1),Y.precision=v+4,Y.rounding=1,q=q.ln(),Y.precision=v,Y.rounding=N,q.times(.5))):new Y(NaN)};P$4.inverseSine=P$4.asin=function(){var v,N,G,z,q=this,Y=q.constructor;return q.isZero()?new Y(q):(N=q.abs().cmp(1),G=Y.precision,z=Y.rounding,N!==-1?N===0?(v=getPi(Y,G+4,z).times(.5),v.s=q.s,v):new Y(NaN):(Y.precision=G+6,Y.rounding=1,q=q.div(new Y(1).minus(q.times(q)).sqrt().plus(1)).atan(),Y.precision=G,Y.rounding=z,q.times(2)))};P$4.inverseTangent=P$4.atan=function(){var v,N,G,z,q,Y,W,ie,ne,se=this,ae=se.constructor,ce=ae.precision,pe=ae.rounding;if(se.isFinite()){if(se.isZero())return new ae(se);if(se.abs().eq(1)&&ce+4<=PI_PRECISION)return W=getPi(ae,ce+4,pe).times(.25),W.s=se.s,W}else{if(!se.s)return new ae(NaN);if(ce+4<=PI_PRECISION)return W=getPi(ae,ce+4,pe).times(.5),W.s=se.s,W}for(ae.precision=ie=ce+10,ae.rounding=1,G=Math.min(28,ie/LOG_BASE+2|0),v=G;v;--v)se=se.div(se.times(se).plus(1).sqrt().plus(1));for(external=!1,N=Math.ceil(ie/LOG_BASE),z=1,ne=se.times(se),W=new ae(se),q=se;v!==-1;)if(q=q.times(ne),Y=W.minus(q.div(z+=2)),q=q.times(ne),W=Y.plus(q.div(z+=2)),W.d[N]!==void 0)for(v=N;W.d[v]===Y.d[v]&&v--;);return G&&(W=W.times(2<<G-1)),external=!0,finalise(W,ae.precision=ce,ae.rounding=pe,!0)};P$4.isFinite=function(){return!!this.d};P$4.isInteger=P$4.isInt=function(){return!!this.d&&mathfloor(this.e/LOG_BASE)>this.d.length-2};P$4.isNaN=function(){return!this.s};P$4.isNegative=P$4.isNeg=function(){return this.s<0};P$4.isPositive=P$4.isPos=function(){return this.s>0};P$4.isZero=function(){return!!this.d&&this.d[0]===0};P$4.lessThan=P$4.lt=function(v){return this.cmp(v)<0};P$4.lessThanOrEqualTo=P$4.lte=function(v){return this.cmp(v)<1};P$4.logarithm=P$4.log=function(v){var N,G,z,q,Y,W,ie,ne,se=this,ae=se.constructor,ce=ae.precision,pe=ae.rounding,ge=5;if(v==null)v=new ae(10),N=!0;else{if(v=new ae(v),G=v.d,v.s<0||!G||!G[0]||v.eq(1))return new ae(NaN);N=v.eq(10)}if(G=se.d,se.s<0||!G||!G[0]||se.eq(1))return new ae(G&&!G[0]?-1/0:se.s!=1?NaN:G?0:1/0);if(N)if(G.length>1)Y=!0;else{for(q=G[0];q%10===0;)q/=10;Y=q!==1}if(external=!1,ie=ce+ge,W=naturalLogarithm(se,ie),z=N?getLn10(ae,ie+10):naturalLogarithm(v,ie),ne=divide(W,z,ie,1),checkRoundingDigits(ne.d,q=ce,pe))do if(ie+=10,W=naturalLogarithm(se,ie),z=N?getLn10(ae,ie+10):naturalLogarithm(v,ie),ne=divide(W,z,ie,1),!Y){+digitsToString(ne.d).slice(q+1,q+15)+1==1e14&&(ne=finalise(ne,ce+1,0));break}while(checkRoundingDigits(ne.d,q+=10,pe));return external=!0,finalise(ne,ce,pe)};P$4.minus=P$4.sub=function(v){var N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge=this,ve=ge.constructor;if(v=new ve(v),!ge.d||!v.d)return!ge.s||!v.s?v=new ve(NaN):ge.d?v.s=-v.s:v=new ve(v.d||ge.s!==v.s?ge:NaN),v;if(ge.s!=v.s)return v.s=-v.s,ge.plus(v);if(se=ge.d,pe=v.d,ie=ve.precision,ne=ve.rounding,!se[0]||!pe[0]){if(pe[0])v.s=-v.s;else if(se[0])v=new ve(ge);else return new ve(ne===3?-0:0);return external?finalise(v,ie,ne):v}if(G=mathfloor(v.e/LOG_BASE),ae=mathfloor(ge.e/LOG_BASE),se=se.slice(),Y=ae-G,Y){for(ce=Y<0,ce?(N=se,Y=-Y,W=pe.length):(N=pe,G=ae,W=se.length),z=Math.max(Math.ceil(ie/LOG_BASE),W)+2,Y>z&&(Y=z,N.length=1),N.reverse(),z=Y;z--;)N.push(0);N.reverse()}else{for(z=se.length,W=pe.length,ce=z<W,ce&&(W=z),z=0;z<W;z++)if(se[z]!=pe[z]){ce=se[z]<pe[z];break}Y=0}for(ce&&(N=se,se=pe,pe=N,v.s=-v.s),W=se.length,z=pe.length-W;z>0;--z)se[W++]=0;for(z=pe.length;z>Y;){if(se[--z]<pe[z]){for(q=z;q&&se[--q]===0;)se[q]=BASE-1;--se[q],se[z]+=BASE}se[z]-=pe[z]}for(;se[--W]===0;)se.pop();for(;se[0]===0;se.shift())--G;return se[0]?(v.d=se,v.e=getBase10Exponent(se,G),external?finalise(v,ie,ne):v):new ve(ne===3?-0:0)};P$4.modulo=P$4.mod=function(v){var N,G=this,z=G.constructor;return v=new z(v),!G.d||!v.s||v.d&&!v.d[0]?new z(NaN):!v.d||G.d&&!G.d[0]?finalise(new z(G),z.precision,z.rounding):(external=!1,z.modulo==9?(N=divide(G,v.abs(),0,3,1),N.s*=v.s):N=divide(G,v,0,z.modulo,1),N=N.times(v),external=!0,G.minus(N))};P$4.naturalExponential=P$4.exp=function(){return naturalExponential(this)};P$4.naturalLogarithm=P$4.ln=function(){return naturalLogarithm(this)};P$4.negated=P$4.neg=function(){var v=new this.constructor(this);return v.s=-v.s,finalise(v)};P$4.plus=P$4.add=function(v){var N,G,z,q,Y,W,ie,ne,se,ae,ce=this,pe=ce.constructor;if(v=new pe(v),!ce.d||!v.d)return!ce.s||!v.s?v=new pe(NaN):ce.d||(v=new pe(v.d||ce.s===v.s?ce:NaN)),v;if(ce.s!=v.s)return v.s=-v.s,ce.minus(v);if(se=ce.d,ae=v.d,ie=pe.precision,ne=pe.rounding,!se[0]||!ae[0])return ae[0]||(v=new pe(ce)),external?finalise(v,ie,ne):v;if(Y=mathfloor(ce.e/LOG_BASE),z=mathfloor(v.e/LOG_BASE),se=se.slice(),q=Y-z,q){for(q<0?(G=se,q=-q,W=ae.length):(G=ae,z=Y,W=se.length),Y=Math.ceil(ie/LOG_BASE),W=Y>W?Y+1:W+1,q>W&&(q=W,G.length=1),G.reverse();q--;)G.push(0);G.reverse()}for(W=se.length,q=ae.length,W-q<0&&(q=W,G=ae,ae=se,se=G),N=0;q;)N=(se[--q]=se[q]+ae[q]+N)/BASE|0,se[q]%=BASE;for(N&&(se.unshift(N),++z),W=se.length;se[--W]==0;)se.pop();return v.d=se,v.e=getBase10Exponent(se,z),external?finalise(v,ie,ne):v};P$4.precision=P$4.sd=function(v){var N,G=this;if(v!==void 0&&v!==!!v&&v!==1&&v!==0)throw Error(invalidArgument+v);return G.d?(N=getPrecision(G.d),v&&G.e+1>N&&(N=G.e+1)):N=NaN,N};P$4.round=function(){var v=this,N=v.constructor;return finalise(new N(v),v.e+1,N.rounding)};P$4.sine=P$4.sin=function(){var v,N,G=this,z=G.constructor;return G.isFinite()?G.isZero()?new z(G):(v=z.precision,N=z.rounding,z.precision=v+Math.max(G.e,G.sd())+LOG_BASE,z.rounding=1,G=sine(z,toLessThanHalfPi(z,G)),z.precision=v,z.rounding=N,finalise(quadrant>2?G.neg():G,v,N,!0)):new z(NaN)};P$4.squareRoot=P$4.sqrt=function(){var v,N,G,z,q,Y,W=this,ie=W.d,ne=W.e,se=W.s,ae=W.constructor;if(se!==1||!ie||!ie[0])return new ae(!se||se<0&&(!ie||ie[0])?NaN:ie?W:1/0);for(external=!1,se=Math.sqrt(+W),se==0||se==1/0?(N=digitsToString(ie),(N.length+ne)%2==0&&(N+="0"),se=Math.sqrt(N),ne=mathfloor((ne+1)/2)-(ne<0||ne%2),se==1/0?N="5e"+ne:(N=se.toExponential(),N=N.slice(0,N.indexOf("e")+1)+ne),z=new ae(N)):z=new ae(se.toString()),G=(ne=ae.precision)+3;;)if(Y=z,z=Y.plus(divide(W,Y,G+2,1)).times(.5),digitsToString(Y.d).slice(0,G)===(N=digitsToString(z.d)).slice(0,G))if(N=N.slice(G-3,G+1),N=="9999"||!q&&N=="4999"){if(!q&&(finalise(Y,ne+1,0),Y.times(Y).eq(W))){z=Y;break}G+=4,q=1}else{(!+N||!+N.slice(1)&&N.charAt(0)=="5")&&(finalise(z,ne+1,1),v=!z.times(z).eq(W));break}return external=!0,finalise(z,ne,ae.rounding,v)};P$4.tangent=P$4.tan=function(){var v,N,G=this,z=G.constructor;return G.isFinite()?G.isZero()?new z(G):(v=z.precision,N=z.rounding,z.precision=v+10,z.rounding=1,G=G.sin(),G.s=1,G=divide(G,new z(1).minus(G.times(G)).sqrt(),v+10,0),z.precision=v,z.rounding=N,finalise(quadrant==2||quadrant==4?G.neg():G,v,N,!0)):new z(NaN)};P$4.times=P$4.mul=function(v){var N,G,z,q,Y,W,ie,ne,se,ae=this,ce=ae.constructor,pe=ae.d,ge=(v=new ce(v)).d;if(v.s*=ae.s,!pe||!pe[0]||!ge||!ge[0])return new ce(!v.s||pe&&!pe[0]&&!ge||ge&&!ge[0]&&!pe?NaN:!pe||!ge?v.s/0:v.s*0);for(G=mathfloor(ae.e/LOG_BASE)+mathfloor(v.e/LOG_BASE),ne=pe.length,se=ge.length,ne<se&&(Y=pe,pe=ge,ge=Y,W=ne,ne=se,se=W),Y=[],W=ne+se,z=W;z--;)Y.push(0);for(z=se;--z>=0;){for(N=0,q=ne+z;q>z;)ie=Y[q]+ge[z]*pe[q-z-1]+N,Y[q--]=ie%BASE|0,N=ie/BASE|0;Y[q]=(Y[q]+N)%BASE|0}for(;!Y[--W];)Y.pop();return N?++G:Y.shift(),v.d=Y,v.e=getBase10Exponent(Y,G),external?finalise(v,ce.precision,ce.rounding):v};P$4.toBinary=function(v,N){return toStringBinary(this,2,v,N)};P$4.toDecimalPlaces=P$4.toDP=function(v,N){var G=this,z=G.constructor;return G=new z(G),v===void 0?G:(checkInt32(v,0,MAX_DIGITS),N===void 0?N=z.rounding:checkInt32(N,0,8),finalise(G,v+G.e+1,N))};P$4.toExponential=function(v,N){var G,z=this,q=z.constructor;return v===void 0?G=finiteToString(z,!0):(checkInt32(v,0,MAX_DIGITS),N===void 0?N=q.rounding:checkInt32(N,0,8),z=finalise(new q(z),v+1,N),G=finiteToString(z,!0,v+1)),z.isNeg()&&!z.isZero()?"-"+G:G};P$4.toFixed=function(v,N){var G,z,q=this,Y=q.constructor;return v===void 0?G=finiteToString(q):(checkInt32(v,0,MAX_DIGITS),N===void 0?N=Y.rounding:checkInt32(N,0,8),z=finalise(new Y(q),v+q.e+1,N),G=finiteToString(z,!1,v+z.e+1)),q.isNeg()&&!q.isZero()?"-"+G:G};P$4.toFraction=function(v){var N,G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge=this,ve=ge.d,be=ge.constructor;if(!ve)return new be(ge);if(se=G=new be(1),z=ne=new be(0),N=new be(z),Y=N.e=getPrecision(ve)-ge.e-1,W=Y%LOG_BASE,N.d[0]=mathpow(10,W<0?LOG_BASE+W:W),v==null)v=Y>0?N:se;else{if(ie=new be(v),!ie.isInt()||ie.lt(se))throw Error(invalidArgument+ie);v=ie.gt(N)?Y>0?N:se:ie}for(external=!1,ie=new be(digitsToString(ve)),ae=be.precision,be.precision=Y=ve.length*LOG_BASE*2;ce=divide(ie,N,0,1,1),q=G.plus(ce.times(z)),q.cmp(v)!=1;)G=z,z=q,q=se,se=ne.plus(ce.times(q)),ne=q,q=N,N=ie.minus(ce.times(q)),ie=q;return q=divide(v.minus(G),z,0,1,1),ne=ne.plus(q.times(se)),G=G.plus(q.times(z)),ne.s=se.s=ge.s,pe=divide(se,z,Y,1).minus(ge).abs().cmp(divide(ne,G,Y,1).minus(ge).abs())<1?[se,z]:[ne,G],be.precision=ae,external=!0,pe};P$4.toHexadecimal=P$4.toHex=function(v,N){return toStringBinary(this,16,v,N)};P$4.toNearest=function(v,N){var G=this,z=G.constructor;if(G=new z(G),v==null){if(!G.d)return G;v=new z(1),N=z.rounding}else{if(v=new z(v),N===void 0?N=z.rounding:checkInt32(N,0,8),!G.d)return v.s?G:v;if(!v.d)return v.s&&(v.s=G.s),v}return v.d[0]?(external=!1,G=divide(G,v,0,N,1).times(v),external=!0,finalise(G)):(v.s=G.s,G=v),G};P$4.toNumber=function(){return+this};P$4.toOctal=function(v,N){return toStringBinary(this,8,v,N)};P$4.toPower=P$4.pow=function(v){var N,G,z,q,Y,W,ie=this,ne=ie.constructor,se=+(v=new ne(v));if(!ie.d||!v.d||!ie.d[0]||!v.d[0])return new ne(mathpow(+ie,se));if(ie=new ne(ie),ie.eq(1))return ie;if(z=ne.precision,Y=ne.rounding,v.eq(1))return finalise(ie,z,Y);if(N=mathfloor(v.e/LOG_BASE),N>=v.d.length-1&&(G=se<0?-se:se)<=MAX_SAFE_INTEGER)return q=intPow(ne,ie,G,z),v.s<0?new ne(1).div(q):finalise(q,z,Y);if(W=ie.s,W<0){if(N<v.d.length-1)return new ne(NaN);if((v.d[N]&1)==0&&(W=1),ie.e==0&&ie.d[0]==1&&ie.d.length==1)return ie.s=W,ie}return G=mathpow(+ie,se),N=G==0||!isFinite(G)?mathfloor(se*(Math.log("0."+digitsToString(ie.d))/Math.LN10+ie.e+1)):new ne(G+"").e,N>ne.maxE+1||N<ne.minE-1?new ne(N>0?W/0:0):(external=!1,ne.rounding=ie.s=1,G=Math.min(12,(N+"").length),q=naturalExponential(v.times(naturalLogarithm(ie,z+G)),z),q.d&&(q=finalise(q,z+5,1),checkRoundingDigits(q.d,z,Y)&&(N=z+10,q=finalise(naturalExponential(v.times(naturalLogarithm(ie,N+G)),N),N+5,1),+digitsToString(q.d).slice(z+1,z+15)+1==1e14&&(q=finalise(q,z+1,0)))),q.s=W,external=!0,ne.rounding=Y,finalise(q,z,Y))};P$4.toPrecision=function(v,N){var G,z=this,q=z.constructor;return v===void 0?G=finiteToString(z,z.e<=q.toExpNeg||z.e>=q.toExpPos):(checkInt32(v,1,MAX_DIGITS),N===void 0?N=q.rounding:checkInt32(N,0,8),z=finalise(new q(z),v,N),G=finiteToString(z,v<=z.e||z.e<=q.toExpNeg,v)),z.isNeg()&&!z.isZero()?"-"+G:G};P$4.toSignificantDigits=P$4.toSD=function(v,N){var G=this,z=G.constructor;return v===void 0?(v=z.precision,N=z.rounding):(checkInt32(v,1,MAX_DIGITS),N===void 0?N=z.rounding:checkInt32(N,0,8)),finalise(new z(G),v,N)};P$4.toString=function(){var v=this,N=v.constructor,G=finiteToString(v,v.e<=N.toExpNeg||v.e>=N.toExpPos);return v.isNeg()&&!v.isZero()?"-"+G:G};P$4.truncated=P$4.trunc=function(){return finalise(new this.constructor(this),this.e+1,1)};P$4.valueOf=P$4.toJSON=function(){var v=this,N=v.constructor,G=finiteToString(v,v.e<=N.toExpNeg||v.e>=N.toExpPos);return v.isNeg()?"-"+G:G};function digitsToString(v){var N,G,z,q=v.length-1,Y="",W=v[0];if(q>0){for(Y+=W,N=1;N<q;N++)z=v[N]+"",G=LOG_BASE-z.length,G&&(Y+=getZeroString(G)),Y+=z;W=v[N],z=W+"",G=LOG_BASE-z.length,G&&(Y+=getZeroString(G))}else if(W===0)return"0";for(;W%10===0;)W/=10;return Y+W}function checkInt32(v,N,G){if(v!==~~v||v<N||v>G)throw Error(invalidArgument+v)}function checkRoundingDigits(v,N,G,z){var q,Y,W,ie;for(Y=v[0];Y>=10;Y/=10)--N;return--N<0?(N+=LOG_BASE,q=0):(q=Math.ceil((N+1)/LOG_BASE),N%=LOG_BASE),Y=mathpow(10,LOG_BASE-N),ie=v[q]%Y|0,z==null?N<3?(N==0?ie=ie/100|0:N==1&&(ie=ie/10|0),W=G<4&&ie==99999||G>3&&ie==49999||ie==5e4||ie==0):W=(G<4&&ie+1==Y||G>3&&ie+1==Y/2)&&(v[q+1]/Y/100|0)==mathpow(10,N-2)-1||(ie==Y/2||ie==0)&&(v[q+1]/Y/100|0)==0:N<4?(N==0?ie=ie/1e3|0:N==1?ie=ie/100|0:N==2&&(ie=ie/10|0),W=(z||G<4)&&ie==9999||!z&&G>3&&ie==4999):W=((z||G<4)&&ie+1==Y||!z&&G>3&&ie+1==Y/2)&&(v[q+1]/Y/1e3|0)==mathpow(10,N-3)-1,W}function convertBase(v,N,G){for(var z,q=[0],Y,W=0,ie=v.length;W<ie;){for(Y=q.length;Y--;)q[Y]*=N;for(q[0]+=NUMERALS.indexOf(v.charAt(W++)),z=0;z<q.length;z++)q[z]>G-1&&(q[z+1]===void 0&&(q[z+1]=0),q[z+1]+=q[z]/G|0,q[z]%=G)}return q.reverse()}function cosine(v,N){var G,z,q;if(N.isZero())return N;z=N.d.length,z<32?(G=Math.ceil(z/3),q=(1/tinyPow(4,G)).toString()):(G=16,q="2.3283064365386962890625e-10"),v.precision+=G,N=taylorSeries(v,1,N.times(q),new v(1));for(var Y=G;Y--;){var W=N.times(N);N=W.times(W).minus(W).times(8).plus(1)}return v.precision-=G,N}var divide=function(){function v(z,q,Y){var W,ie=0,ne=z.length;for(z=z.slice();ne--;)W=z[ne]*q+ie,z[ne]=W%Y|0,ie=W/Y|0;return ie&&z.unshift(ie),z}function N(z,q,Y,W){var ie,ne;if(Y!=W)ne=Y>W?1:-1;else for(ie=ne=0;ie<Y;ie++)if(z[ie]!=q[ie]){ne=z[ie]>q[ie]?1:-1;break}return ne}function G(z,q,Y,W){for(var ie=0;Y--;)z[Y]-=ie,ie=z[Y]<q[Y]?1:0,z[Y]=ie*W+z[Y]-q[Y];for(;!z[0]&&z.length>1;)z.shift()}return function(z,q,Y,W,ie,ne){var se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve,Re,qe,et,Ze,tt,Ke,rt,it,ot=z.constructor,ut=z.s==q.s?1:-1,ct=z.d,at=q.d;if(!ct||!ct[0]||!at||!at[0])return new ot(!z.s||!q.s||(ct?at&&ct[0]==at[0]:!at)?NaN:ct&&ct[0]==0||!at?ut*0:ut/0);for(ne?(ge=1,ae=z.e-q.e):(ne=BASE,ge=LOG_BASE,ae=mathfloor(z.e/ge)-mathfloor(q.e/ge)),rt=at.length,tt=ct.length,Pe=new ot(ut),Je=Pe.d=[],ce=0;at[ce]==(ct[ce]||0);ce++);if(at[ce]>(ct[ce]||0)&&ae--,Y==null?(qe=Y=ot.precision,W=ot.rounding):ie?qe=Y+(z.e-q.e)+1:qe=Y,qe<0)Je.push(1),ve=!0;else{if(qe=qe/ge+2|0,ce=0,rt==1){for(pe=0,at=at[0],qe++;(ce<tt||pe)&&qe--;ce++)et=pe*ne+(ct[ce]||0),Je[ce]=et/at|0,pe=et%at|0;ve=pe||ce<tt}else{for(pe=ne/(at[0]+1)|0,pe>1&&(at=v(at,pe,ne),ct=v(ct,pe,ne),rt=at.length,tt=ct.length),Ze=rt,Ce=ct.slice(0,rt),Ve=Ce.length;Ve<rt;)Ce[Ve++]=0;it=at.slice(),it.unshift(0),Ke=at[0],at[1]>=ne/2&&++Ke;do pe=0,se=N(at,Ce,rt,Ve),se<0?(Re=Ce[0],rt!=Ve&&(Re=Re*ne+(Ce[1]||0)),pe=Re/Ke|0,pe>1?(pe>=ne&&(pe=ne-1),be=v(at,pe,ne),Ee=be.length,Ve=Ce.length,se=N(be,Ce,Ee,Ve),se==1&&(pe--,G(be,rt<Ee?it:at,Ee,ne))):(pe==0&&(se=pe=1),be=at.slice()),Ee=be.length,Ee<Ve&&be.unshift(0),G(Ce,be,Ve,ne),se==-1&&(Ve=Ce.length,se=N(at,Ce,rt,Ve),se<1&&(pe++,G(Ce,rt<Ve?it:at,Ve,ne))),Ve=Ce.length):se===0&&(pe++,Ce=[0]),Je[ce++]=pe,se&&Ce[0]?Ce[Ve++]=ct[Ze]||0:(Ce=[ct[Ze]],Ve=1);while((Ze++<tt||Ce[0]!==void 0)&&qe--);ve=Ce[0]!==void 0}Je[0]||Je.shift()}if(ge==1)Pe.e=ae,inexact=ve;else{for(ce=1,pe=Je[0];pe>=10;pe/=10)ce++;Pe.e=ce+ae*ge-1,finalise(Pe,ie?Y+Pe.e+1:Y,W,ve)}return Pe}}();function finalise(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge=v.constructor;e:if(N!=null){if(ce=v.d,!ce)return v;for(q=1,ie=ce[0];ie>=10;ie/=10)q++;if(Y=N-q,Y<0)Y+=LOG_BASE,W=N,ae=ce[pe=0],ne=ae/mathpow(10,q-W-1)%10|0;else if(pe=Math.ceil((Y+1)/LOG_BASE),ie=ce.length,pe>=ie)if(z){for(;ie++<=pe;)ce.push(0);ae=ne=0,q=1,Y%=LOG_BASE,W=Y-LOG_BASE+1}else break e;else{for(ae=ie=ce[pe],q=1;ie>=10;ie/=10)q++;Y%=LOG_BASE,W=Y-LOG_BASE+q,ne=W<0?0:ae/mathpow(10,q-W-1)%10|0}if(z=z||N<0||ce[pe+1]!==void 0||(W<0?ae:ae%mathpow(10,q-W-1)),se=G<4?(ne||z)&&(G==0||G==(v.s<0?3:2)):ne>5||ne==5&&(G==4||z||G==6&&(Y>0?W>0?ae/mathpow(10,q-W):0:ce[pe-1])%10&1||G==(v.s<0?8:7)),N<1||!ce[0])return ce.length=0,se?(N-=v.e+1,ce[0]=mathpow(10,(LOG_BASE-N%LOG_BASE)%LOG_BASE),v.e=-N||0):ce[0]=v.e=0,v;if(Y==0?(ce.length=pe,ie=1,pe--):(ce.length=pe+1,ie=mathpow(10,LOG_BASE-Y),ce[pe]=W>0?(ae/mathpow(10,q-W)%mathpow(10,W)|0)*ie:0),se)for(;;)if(pe==0){for(Y=1,W=ce[0];W>=10;W/=10)Y++;for(W=ce[0]+=ie,ie=1;W>=10;W/=10)ie++;Y!=ie&&(v.e++,ce[0]==BASE&&(ce[0]=1));break}else{if(ce[pe]+=ie,ce[pe]!=BASE)break;ce[pe--]=0,ie=1}for(Y=ce.length;ce[--Y]===0;)ce.pop()}return external&&(v.e>ge.maxE?(v.d=null,v.e=NaN):v.e<ge.minE&&(v.e=0,v.d=[0])),v}function finiteToString(v,N,G){if(!v.isFinite())return nonFiniteToString(v);var z,q=v.e,Y=digitsToString(v.d),W=Y.length;return N?(G&&(z=G-W)>0?Y=Y.charAt(0)+"."+Y.slice(1)+getZeroString(z):W>1&&(Y=Y.charAt(0)+"."+Y.slice(1)),Y=Y+(v.e<0?"e":"e+")+v.e):q<0?(Y="0."+getZeroString(-q-1)+Y,G&&(z=G-W)>0&&(Y+=getZeroString(z))):q>=W?(Y+=getZeroString(q+1-W),G&&(z=G-q-1)>0&&(Y=Y+"."+getZeroString(z))):((z=q+1)<W&&(Y=Y.slice(0,z)+"."+Y.slice(z)),G&&(z=G-W)>0&&(q+1===W&&(Y+="."),Y+=getZeroString(z))),Y}function getBase10Exponent(v,N){var G=v[0];for(N*=LOG_BASE;G>=10;G/=10)N++;return N}function getLn10(v,N,G){if(N>LN10_PRECISION)throw external=!0,G&&(v.precision=G),Error(precisionLimitExceeded);return finalise(new v(LN10),N,1,!0)}function getPi(v,N,G){if(N>PI_PRECISION)throw Error(precisionLimitExceeded);return finalise(new v(PI),N,G,!0)}function getPrecision(v){var N=v.length-1,G=N*LOG_BASE+1;if(N=v[N],N){for(;N%10==0;N/=10)G--;for(N=v[0];N>=10;N/=10)G++}return G}function getZeroString(v){for(var N="";v--;)N+="0";return N}function intPow(v,N,G,z){var q,Y=new v(1),W=Math.ceil(z/LOG_BASE+4);for(external=!1;;){if(G%2&&(Y=Y.times(N),truncate(Y.d,W)&&(q=!0)),G=mathfloor(G/2),G===0){G=Y.d.length-1,q&&Y.d[G]===0&&++Y.d[G];break}N=N.times(N),truncate(N.d,W)}return external=!0,Y}function isOdd(v){return v.d[v.d.length-1]&1}function maxOrMin(v,N,G){for(var z,q,Y=new v(N[0]),W=0;++W<N.length;){if(q=new v(N[W]),!q.s){Y=q;break}z=Y.cmp(q),(z===G||z===0&&Y.s===G)&&(Y=q)}return Y}function naturalExponential(v,N){var G,z,q,Y,W,ie,ne,se=0,ae=0,ce=0,pe=v.constructor,ge=pe.rounding,ve=pe.precision;if(!v.d||!v.d[0]||v.e>17)return new pe(v.d?v.d[0]?v.s<0?0:1/0:1:v.s?v.s<0?0:v:NaN);for(N==null?(external=!1,ne=ve):ne=N,ie=new pe(.03125);v.e>-2;)v=v.times(ie),ce+=5;for(z=Math.log(mathpow(2,ce))/Math.LN10*2+5|0,ne+=z,G=Y=W=new pe(1),pe.precision=ne;;){if(Y=finalise(Y.times(v),ne,1),G=G.times(++ae),ie=W.plus(divide(Y,G,ne,1)),digitsToString(ie.d).slice(0,ne)===digitsToString(W.d).slice(0,ne)){for(q=ce;q--;)W=finalise(W.times(W),ne,1);if(N==null)if(se<3&&checkRoundingDigits(W.d,ne-z,ge,se))pe.precision=ne+=10,G=Y=ie=new pe(1),ae=0,se++;else return finalise(W,pe.precision=ve,ge,external=!0);else return pe.precision=ve,W}W=ie}}function naturalLogarithm(v,N){var G,z,q,Y,W,ie,ne,se,ae,ce,pe,ge=1,ve=10,be=v,Ee=be.d,Pe=be.constructor,Je=Pe.rounding,Ce=Pe.precision;if(be.s<0||!Ee||!Ee[0]||!be.e&&Ee[0]==1&&Ee.length==1)return new Pe(Ee&&!Ee[0]?-1/0:be.s!=1?NaN:Ee?0:be);if(N==null?(external=!1,ae=Ce):ae=N,Pe.precision=ae+=ve,G=digitsToString(Ee),z=G.charAt(0),Math.abs(Y=be.e)<15e14){for(;z<7&&z!=1||z==1&&G.charAt(1)>3;)be=be.times(v),G=digitsToString(be.d),z=G.charAt(0),ge++;Y=be.e,z>1?(be=new Pe("0."+G),Y++):be=new Pe(z+"."+G.slice(1))}else return se=getLn10(Pe,ae+2,Ce).times(Y+""),be=naturalLogarithm(new Pe(z+"."+G.slice(1)),ae-ve).plus(se),Pe.precision=Ce,N==null?finalise(be,Ce,Je,external=!0):be;for(ce=be,ne=W=be=divide(be.minus(1),be.plus(1),ae,1),pe=finalise(be.times(be),ae,1),q=3;;){if(W=finalise(W.times(pe),ae,1),se=ne.plus(divide(W,new Pe(q),ae,1)),digitsToString(se.d).slice(0,ae)===digitsToString(ne.d).slice(0,ae))if(ne=ne.times(2),Y!==0&&(ne=ne.plus(getLn10(Pe,ae+2,Ce).times(Y+""))),ne=divide(ne,new Pe(ge),ae,1),N==null)if(checkRoundingDigits(ne.d,ae-ve,Je,ie))Pe.precision=ae+=ve,se=W=be=divide(ce.minus(1),ce.plus(1),ae,1),pe=finalise(be.times(be),ae,1),q=ie=1;else return finalise(ne,Pe.precision=Ce,Je,external=!0);else return Pe.precision=Ce,ne;ne=se,q+=2}}function nonFiniteToString(v){return String(v.s*v.s/0)}function parseDecimal(v,N){var G,z,q;for((G=N.indexOf("."))>-1&&(N=N.replace(".","")),(z=N.search(/e/i))>0?(G<0&&(G=z),G+=+N.slice(z+1),N=N.substring(0,z)):G<0&&(G=N.length),z=0;N.charCodeAt(z)===48;z++);for(q=N.length;N.charCodeAt(q-1)===48;--q);if(N=N.slice(z,q),N){if(q-=z,v.e=G=G-z-1,v.d=[],z=(G+1)%LOG_BASE,G<0&&(z+=LOG_BASE),z<q){for(z&&v.d.push(+N.slice(0,z)),q-=LOG_BASE;z<q;)v.d.push(+N.slice(z,z+=LOG_BASE));N=N.slice(z),z=LOG_BASE-N.length}else z-=q;for(;z--;)N+="0";v.d.push(+N),external&&(v.e>v.constructor.maxE?(v.d=null,v.e=NaN):v.e<v.constructor.minE&&(v.e=0,v.d=[0]))}else v.e=0,v.d=[0];return v}function parseOther(v,N){var G,z,q,Y,W,ie,ne,se,ae;if(N.indexOf("_")>-1){if(N=N.replace(/(\d)_(?=\d)/g,"$1"),isDecimal.test(N))return parseDecimal(v,N)}else if(N==="Infinity"||N==="NaN")return+N||(v.s=NaN),v.e=NaN,v.d=null,v;if(isHex.test(N))G=16,N=N.toLowerCase();else if(isBinary.test(N))G=2;else if(isOctal.test(N))G=8;else throw Error(invalidArgument+N);for(Y=N.search(/p/i),Y>0?(ne=+N.slice(Y+1),N=N.substring(2,Y)):N=N.slice(2),Y=N.indexOf("."),W=Y>=0,z=v.constructor,W&&(N=N.replace(".",""),ie=N.length,Y=ie-Y,q=intPow(z,new z(G),Y,Y*2)),se=convertBase(N,G,BASE),ae=se.length-1,Y=ae;se[Y]===0;--Y)se.pop();return Y<0?new z(v.s*0):(v.e=getBase10Exponent(se,ae),v.d=se,external=!1,W&&(v=divide(v,q,ie*4)),ne&&(v=v.times(Math.abs(ne)<54?mathpow(2,ne):Decimal.pow(2,ne))),external=!0,v)}function sine(v,N){var G,z=N.d.length;if(z<3)return N.isZero()?N:taylorSeries(v,2,N,N);G=1.4*Math.sqrt(z),G=G>16?16:G|0,N=N.times(1/tinyPow(5,G)),N=taylorSeries(v,2,N,N);for(var q,Y=new v(5),W=new v(16),ie=new v(20);G--;)q=N.times(N),N=N.times(Y.plus(q.times(W.times(q).minus(ie))));return N}function taylorSeries(v,N,G,z,q){var Y,W,ie,ne,se=v.precision,ae=Math.ceil(se/LOG_BASE);for(external=!1,ne=G.times(G),ie=new v(z);;){if(W=divide(ie.times(ne),new v(N++*N++),se,1),ie=q?z.plus(W):z.minus(W),z=divide(W.times(ne),new v(N++*N++),se,1),W=ie.plus(z),W.d[ae]!==void 0){for(Y=ae;W.d[Y]===ie.d[Y]&&Y--;);if(Y==-1)break}Y=ie,ie=z,z=W,W=Y}return external=!0,W.d.length=ae+1,W}function tinyPow(v,N){for(var G=v;--N;)G*=v;return G}function toLessThanHalfPi(v,N){var G,z=N.s<0,q=getPi(v,v.precision,1),Y=q.times(.5);if(N=N.abs(),N.lte(Y))return quadrant=z?4:1,N;if(G=N.divToInt(q),G.isZero())quadrant=z?3:2;else{if(N=N.minus(G.times(q)),N.lte(Y))return quadrant=isOdd(G)?z?2:3:z?4:1,N;quadrant=isOdd(G)?z?1:4:z?3:2}return N.minus(q).abs()}function toStringBinary(v,N,G,z){var q,Y,W,ie,ne,se,ae,ce,pe,ge=v.constructor,ve=G!==void 0;if(ve?(checkInt32(G,1,MAX_DIGITS),z===void 0?z=ge.rounding:checkInt32(z,0,8)):(G=ge.precision,z=ge.rounding),!v.isFinite())ae=nonFiniteToString(v);else{for(ae=finiteToString(v),W=ae.indexOf("."),ve?(q=2,N==16?G=G*4-3:N==8&&(G=G*3-2)):q=N,W>=0&&(ae=ae.replace(".",""),pe=new ge(1),pe.e=ae.length-W,pe.d=convertBase(finiteToString(pe),10,q),pe.e=pe.d.length),ce=convertBase(ae,10,q),Y=ne=ce.length;ce[--ne]==0;)ce.pop();if(!ce[0])ae=ve?"0p+0":"0";else{if(W<0?Y--:(v=new ge(v),v.d=ce,v.e=Y,v=divide(v,pe,G,z,0,q),ce=v.d,Y=v.e,se=inexact),W=ce[G],ie=q/2,se=se||ce[G+1]!==void 0,se=z<4?(W!==void 0||se)&&(z===0||z===(v.s<0?3:2)):W>ie||W===ie&&(z===4||se||z===6&&ce[G-1]&1||z===(v.s<0?8:7)),ce.length=G,se)for(;++ce[--G]>q-1;)ce[G]=0,G||(++Y,ce.unshift(1));for(ne=ce.length;!ce[ne-1];--ne);for(W=0,ae="";W<ne;W++)ae+=NUMERALS.charAt(ce[W]);if(ve){if(ne>1)if(N==16||N==8){for(W=N==16?4:3,--ne;ne%W;ne++)ae+="0";for(ce=convertBase(ae,q,N),ne=ce.length;!ce[ne-1];--ne);for(W=1,ae="1.";W<ne;W++)ae+=NUMERALS.charAt(ce[W])}else ae=ae.charAt(0)+"."+ae.slice(1);ae=ae+(Y<0?"p":"p+")+Y}else if(Y<0){for(;++Y;)ae="0"+ae;ae="0."+ae}else if(++Y>ne)for(Y-=ne;Y--;)ae+="0";else Y<ne&&(ae=ae.slice(0,Y)+"."+ae.slice(Y))}ae=(N==16?"0x":N==2?"0b":N==8?"0o":"")+ae}return v.s<0?"-"+ae:ae}function truncate(v,N){if(v.length>N)return v.length=N,!0}function abs(v){return new this(v).abs()}function acos(v){return new this(v).acos()}function acosh(v){return new this(v).acosh()}function add(v,N){return new this(v).plus(N)}function asin(v){return new this(v).asin()}function asinh(v){return new this(v).asinh()}function atan(v){return new this(v).atan()}function atanh(v){return new this(v).atanh()}function atan2(v,N){v=new this(v),N=new this(N);var G,z=this.precision,q=this.rounding,Y=z+4;return!v.s||!N.s?G=new this(NaN):!v.d&&!N.d?(G=getPi(this,Y,1).times(N.s>0?.25:.75),G.s=v.s):!N.d||v.isZero()?(G=N.s<0?getPi(this,z,q):new this(0),G.s=v.s):!v.d||N.isZero()?(G=getPi(this,Y,1).times(.5),G.s=v.s):N.s<0?(this.precision=Y,this.rounding=1,G=this.atan(divide(v,N,Y,1)),N=getPi(this,Y,1),this.precision=z,this.rounding=q,G=v.s<0?G.minus(N):G.plus(N)):G=this.atan(divide(v,N,Y,1)),G}function cbrt(v){return new this(v).cbrt()}function ceil(v){return finalise(v=new this(v),v.e+1,2)}function clamp(v,N,G){return new this(v).clamp(N,G)}function config$3(v){if(!v||typeof v!="object")throw Error(decimalError+"Object expected");var N,G,z,q=v.defaults===!0,Y=["precision",1,MAX_DIGITS,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,EXP_LIMIT,"maxE",0,EXP_LIMIT,"minE",-9e15,0,"modulo",0,9];for(N=0;N<Y.length;N+=3)if(G=Y[N],q&&(this[G]=DEFAULTS[G]),(z=v[G])!==void 0)if(mathfloor(z)===z&&z>=Y[N+1]&&z<=Y[N+2])this[G]=z;else throw Error(invalidArgument+G+": "+z);if(G="crypto",q&&(this[G]=DEFAULTS[G]),(z=v[G])!==void 0)if(z===!0||z===!1||z===0||z===1)if(z)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[G]=!0;else throw Error(cryptoUnavailable);else this[G]=!1;else throw Error(invalidArgument+G+": "+z);return this}function cos(v){return new this(v).cos()}function cosh$1(v){return new this(v).cosh()}function clone(v){var N,G,z;function q(Y){var W,ie,ne,se=this;if(!(se instanceof q))return new q(Y);if(se.constructor=q,isDecimalInstance(Y)){se.s=Y.s,external?!Y.d||Y.e>q.maxE?(se.e=NaN,se.d=null):Y.e<q.minE?(se.e=0,se.d=[0]):(se.e=Y.e,se.d=Y.d.slice()):(se.e=Y.e,se.d=Y.d?Y.d.slice():Y.d);return}if(ne=typeof Y,ne==="number"){if(Y===0){se.s=1/Y<0?-1:1,se.e=0,se.d=[0];return}if(Y<0?(Y=-Y,se.s=-1):se.s=1,Y===~~Y&&Y<1e7){for(W=0,ie=Y;ie>=10;ie/=10)W++;external?W>q.maxE?(se.e=NaN,se.d=null):W<q.minE?(se.e=0,se.d=[0]):(se.e=W,se.d=[Y]):(se.e=W,se.d=[Y]);return}if(Y*0!==0){Y||(se.s=NaN),se.e=NaN,se.d=null;return}return parseDecimal(se,Y.toString())}if(ne==="string")return(ie=Y.charCodeAt(0))===45?(Y=Y.slice(1),se.s=-1):(ie===43&&(Y=Y.slice(1)),se.s=1),isDecimal.test(Y)?parseDecimal(se,Y):parseOther(se,Y);if(ne==="bigint")return Y<0?(Y=-Y,se.s=-1):se.s=1,parseDecimal(se,Y.toString());throw Error(invalidArgument+Y)}if(q.prototype=P$4,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.EUCLID=9,q.config=q.set=config$3,q.clone=clone,q.isDecimal=isDecimalInstance,q.abs=abs,q.acos=acos,q.acosh=acosh,q.add=add,q.asin=asin,q.asinh=asinh,q.atan=atan,q.atanh=atanh,q.atan2=atan2,q.cbrt=cbrt,q.ceil=ceil,q.clamp=clamp,q.cos=cos,q.cosh=cosh$1,q.div=div,q.exp=exp,q.floor=floor,q.hypot=hypot$1,q.ln=ln,q.log=log,q.log10=log10,q.log2=log2,q.max=max,q.min=min,q.mod=mod,q.mul=mul,q.pow=pow,q.random=random,q.round=round,q.sign=sign,q.sin=sin,q.sinh=sinh$1,q.sqrt=sqrt,q.sub=sub,q.sum=sum,q.tan=tan,q.tanh=tanh,q.trunc=trunc,v===void 0&&(v={}),v&&v.defaults!==!0)for(z=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],N=0;N<z.length;)v.hasOwnProperty(G=z[N++])||(v[G]=this[G]);return q.config(v),q}function div(v,N){return new this(v).div(N)}function exp(v){return new this(v).exp()}function floor(v){return finalise(v=new this(v),v.e+1,3)}function hypot$1(){var v,N,G=new this(0);for(external=!1,v=0;v<arguments.length;)if(N=new this(arguments[v++]),N.d)G.d&&(G=G.plus(N.times(N)));else{if(N.s)return external=!0,new this(1/0);G=N}return external=!0,G.sqrt()}function isDecimalInstance(v){return v instanceof Decimal||v&&v.toStringTag===tag||!1}function ln(v){return new this(v).ln()}function log(v,N){return new this(v).log(N)}function log2(v){return new this(v).log(2)}function log10(v){return new this(v).log(10)}function max(){return maxOrMin(this,arguments,-1)}
vendor: 3,701 bytes, line 436
436function min(){return maxOrMin(this,arguments,1)}function mod(v,N){return new this(v).mod(N)}function mul(v,N){return new this(v).mul(N)}function pow(v,N){return new this(v).pow(N)}function random(v){var N,G,z,q,Y=0,W=new this(1),ie=[];if(v===void 0?v=this.precision:checkInt32(v,1,MAX_DIGITS),z=Math.ceil(v/LOG_BASE),this.crypto)if(crypto.getRandomValues)for(N=crypto.getRandomValues(new Uint32Array(z));Y<z;)q=N[Y],q>=429e7?N[Y]=crypto.getRandomValues(new Uint32Array(1))[0]:ie[Y++]=q%1e7;else if(crypto.randomBytes){for(N=crypto.randomBytes(z*=4);Y<z;)q=N[Y]+(N[Y+1]<<8)+(N[Y+2]<<16)+((N[Y+3]&127)<<24),q>=214e7?crypto.randomBytes(4).copy(N,Y):(ie.push(q%1e7),Y+=4);Y=z/4}else throw Error(cryptoUnavailable);else for(;Y<z;)ie[Y++]=Math.random()*1e7|0;for(z=ie[--Y],v%=LOG_BASE,z&&v&&(q=mathpow(10,LOG_BASE-v),ie[Y]=(z/q|0)*q);ie[Y]===0;Y--)ie.pop();if(Y<0)G=0,ie=[0];else{for(G=-1;ie[0]===0;G-=LOG_BASE)ie.shift();for(z=1,q=ie[0];q>=10;q/=10)z++;z<LOG_BASE&&(G-=LOG_BASE-z)}return W.e=G,W.d=ie,W}function round(v){return finalise(v=new this(v),v.e+1,this.rounding)}function sign(v){return v=new this(v),v.d?v.d[0]?v.s:0*v.s:v.s||NaN}function sin(v){return new this(v).sin()}function sinh$1(v){return new this(v).sinh()}function sqrt(v){return new this(v).sqrt()}function sub(v,N){return new this(v).sub(N)}function sum(){var v=0,N=arguments,G=new this(N[v]);for(external=!1;G.s&&++v<N.length;)G=G.plus(N[v]);return external=!0,finalise(G,this.precision,this.rounding)}function tan(v){return new this(v).tan()}function tanh(v){return new this(v).tanh()}function trunc(v){return finalise(v=new this(v),v.e+1,1)}P$4[Symbol.for("nodejs.util.inspect.custom")]=P$4.toString;P$4[Symbol.toStringTag]="Decimal";var Decimal=P$4.constructor=clone(DEFAULTS);LN10=new Decimal(LN10);PI=new Decimal(PI);var name$4P="BigNumber",dependencies$4O=["?on","config"],createBigNumberClass=factory(name$4P,dependencies$4O,v=>{var{on:N,config:G}=v,z=Decimal.clone({precision:G.precision,modulo:Decimal.EUCLID});return z.prototype=Object.create(z.prototype),z.prototype.type="BigNumber",z.prototype.isBigNumber=!0,z.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},z.fromJSON=function(q){return new z(q.value)},N&&N("config",function(q,Y){q.precision!==Y.precision&&z.config({precision:q.precision})}),z},{isClass:!0});const cosh=Math.cosh||function(v){return Math.abs(v)<1e-9?1-v:(Math.exp(v)+Math.exp(-v))*.5},sinh=Math.sinh||function(v){return Math.abs(v)<1e-9?v:(Math.exp(v)-Math.exp(-v))*.5},cosm1=function(v){const N=Math.PI/4;if(-N>v||v>N)return Math.cos(v)-1;const G=v*v;return G*(G*(G*(G*(G*(G*(G*(G/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},hypot=function(v,N){return v=Math.abs(v),N=Math.abs(N),v<N&&([v,N]=[N,v]),v<1e8?Math.sqrt(v*v+N*N):(N/=v,v*Math.sqrt(1+N*N))},parser_exit=function(){throw SyntaxError("Invalid Param")};function logHypot(v,N){const G=Math.abs(v),z=Math.abs(N);return v===0?Math.log(z):N===0?Math.log(G):G<3e3&&z<3e3?Math.log(v*v+N*N)*.5:(v=v*.5,N=N*.5,.5*Math.log(v*v+N*N)+Math.LN2)}const P$3={re:0,im:0},parse=function(v,N){const G=P$3;if(v==null)G.re=G.im=0;else if(N!==void 0)G.re=v,G.im=N;else switch(typeof v){case"object":if("im"in v&&"re"in v)G.re=v.re,G.im=v.im;else if("abs"in v&&"arg"in v){if(!isFinite(v.abs)&&isFinite(v.arg))return Complex.INFINITY;G.re=v.abs*Math.cos(v.arg),G.im=v.abs*Math.sin(v.arg)}else if("r"in v&&"phi"in v){if(!isFinite(v.r)&&isFinite(v.phi))return Complex.INFINITY;G.re=v.r*Math.cos(v.phi),G.im=v.r*Math.sin(v.phi)}else v.length===2?(G.re=v[0],G.im=v[1]):parser_exit();break;case"string":G.im=G.re=0;const z=v.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let q=1,Y=0;
436z===null&&parser_exit();for(let W=0;W<z.length;W++){const ie=z[W];ie===" "||ie==="	"||ie===`
437`||(ie==="+"?q++:ie==="-"?Y++:ie==="i"||ie==="I"?(q+Y===0&&parser_exit(),z[W+1]!==" "&&!isNaN(z[W+1])?(G.im+=parseFloat((Y%2?"-":"")+z[W+1]),W++):G.im+=parseFloat((Y%2?"-":"")+"1"),q=Y=0):((q+Y===0||isNaN(ie))&&parser_exit(),z[W+1]==="i"||z[W+1]==="I"?(G.im+=parseFloat((Y%2?"-":"")+ie),W++):G.re+=parseFloat((Y%2?"-":"")+ie),q=Y=0))}q+Y>0&&parser_exit();break;case"number":G.im=0,G.re=v;break;default:parser_exit()}return isNaN(G.re)||isNaN(G.im),G};function Complex(v,N){if(!(this instanceof Complex))return new Complex(v,N);const G=parse(v,N);this.re=G.re,this.im=G.im}Complex.prototype={re:0,im:0,sign:function(){const v=hypot(this.re,this.im);return new Complex(this.re/v,this.im/v)},add:function(v,N){const G=parse(v,N),z=this.isInfinite(),q=!(isFinite(G.re)&&isFinite(G.im));return z||q?z&&q?Complex.NAN:Complex.INFINITY:new Complex(this.re+G.re,this.im+G.im)},sub:function(v,N){const G=parse(v,N),z=this.isInfinite(),q=!(isFinite(G.re)&&isFinite(G.im));return z||q?z&&q?Complex.NAN:Complex.INFINITY:new Complex(this.re-G.re,this.im-G.im)},mul:function(v,N){const G=parse(v,N),z=this.isInfinite(),q=!(isFinite(G.re)&&isFinite(G.im)),Y=this.re===0&&this.im===0,W=G.re===0&&G.im===0;return z&&W||q&&Y?Complex.NAN:z||q?Complex.INFINITY:G.im===0&&this.im===0?new Complex(this.re*G.re,0):new Complex(this.re*G.re-this.im*G.im,this.re*G.im+this.im*G.re)},div:function(v,N){const G=parse(v,N),z=this.isInfinite(),q=!(isFinite(G.re)&&isFinite(G.im)),Y=this.re===0&&this.im===0,W=G.re===0&&G.im===0;if(Y&&W||z&&q)return Complex.NAN;if(W||z)return Complex.INFINITY;if(Y||q)return Complex.ZERO;if(G.im===0)return new Complex(this.re/G.re,this.im/G.re);if(Math.abs(G.re)<Math.abs(G.im)){const ie=G.re/G.im,ne=G.re*ie+G.im;return new Complex((this.re*ie+this.im)/ne,(this.im*ie-this.re)/ne)}else{const ie=G.im/G.re,ne=G.im*ie+G.re;return new Complex((this.re+this.im*ie)/ne,(this.im-this.re*ie)/ne)}},pow:function(v,N){const G=parse(v,N),z=this.re===0&&this.im===0;if(G.re===0&&G.im===0)return Complex.ONE;if(G.im===0){if(this.im===0&&this.re>0)return new Complex(Math.pow(this.re,G.re),0);if(this.re===0)switch((G.re%4+4)%4){case 0:return new Complex(Math.pow(this.im,G.re),0);case 1:return new Complex(0,Math.pow(this.im,G.re));case 2:return new Complex(-Math.pow(this.im,G.re),0);case 3:return new Complex(0,-Math.pow(this.im,G.re))}}if(z&&G.re>0)return Complex.ZERO;const Y=Math.atan2(this.im,this.re),W=logHypot(this.re,this.im);let ie=Math.exp(G.re*W-G.im*Y),ne=G.im*W+G.re*Y;return new Complex(ie*Math.cos(ne),ie*Math.sin(ne))},sqrt:function(){const v=this.re,N=this.im;if(N===0)return v>=0?new Complex(Math.sqrt(v),0):new Complex(0,Math.sqrt(-v));const G=hypot(v,N);let z=Math.sqrt(.5*(G+Math.abs(v))),q=Math.abs(N)/(2*z);return v>=0?new Complex(z,N<0?-q:q):new Complex(q,N<0?-z:z)},exp:function(){const v=Math.exp(this.re);return this.im===0?new Complex(v,0):new Complex(v*Math.cos(this.im),v*Math.sin(this.im))},expm1:function(){const v=this.re,N=this.im;return new Complex(Math.expm1(v)*Math.cos(N)+cosm1(N),Math.exp(v)*Math.sin(N))},log:function(){const v=this.re,N=this.im;return N===0&&v>0?new Complex(Math.log(v),0):new Complex(logHypot(v,N),Math.atan2(N,v))},abs:function(){return hypot(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){const v=this.re,N=this.im;return new Complex(Math.sin(v)*cosh(N),Math.cos(v)*sinh(N))},cos:function(){const v=this.re,N=this.im;return new Complex(Math.cos(v)*cosh(N),-Math.sin(v)*sinh(N))},tan:function(){const v=2*this.re,N=2*this.im,G=Math.cos(v)+cosh(N);return new Complex(Math.sin(v)/G,sinh(N)/G)},cot:function(){const v=2*this.re,N=2*this.im,G=Math.cos(v)-cosh(N);return new Complex(-Math.sin(v)/G,sinh(N)/G)},sec:function(){const v=this.re,N=this.im,G=.5*cosh(2*N)+.5*Math.cos(2*v);return new Complex(Math.cos(v)*cosh(N)/G,Math.sin(v)*sinh(N)/G)},csc:function(){const v=this.re,N=this.im,G=.5*cosh(2*N)-.5*Math.cos(2*v);return new Complex(Math.sin(v)*cosh(N)/G,-Math.cos(v)*sinh(N)/G)},asin:function(){const v=this.re,N=this.im,G=new Complex(N*N-v*v+1,-2*v*N).sqrt(),z=new Complex(G.re-N,G.im+v).log();return new Complex(z.im,-z.re)},acos:function(){const v=this.re,N=this.im,G=new Complex(N*N-v*v+1,-2*v*N).sqrt(),z=new Complex(G.re-N,G.im+v).log();return new Complex(Math.PI/2-z.im,z.re)},atan:function(){const v=this.re,N=this.im;if(v===0){if(N===1)return new Complex(0,1/0);if(N===-1)return new Complex(0,-1/0)}const G=v*v+(1-N)*(1-N),z=new Complex((1-N*N-v*v)/G,-2*v/G).log();return new Complex(-.5*z.im,.5*z.re)},acot:function(){const v=this.re,N=this.im;if(N===0)return new Complex(Math.atan2(1,v),0);const G=v*v+N*N;return G!==0?new Complex(v/G,-N/G).atan():new Complex(v!==0?v/0:0,N!==0?-N/0:0).atan()},asec:function(){const v=this.re,N=this.im;if(v===0&&N===0)return new Complex(0,1/0);const G=v*v+N*N;return G!==0?new Complex(v/G,-N/G).acos():new Complex(v!==0?v/0:0,N!==0?-N/0:0).acos()},acsc:function(){const v=this.re,N=this.im;if(v===0&&N===0)return new Complex(Math.PI/2,1/0);const G=v*v+N*N;return G!==0?new Complex(v/G,-N/G).asin():new Complex(v!==0?v/0:0,N!==0?-N/0:0).asin()},sinh:function(){const v=this.re,N=this.im;return new Complex(sinh(v)*Math.cos(N),cosh(v)*Math.sin(N))},cosh:function(){const v=this.re,N=this.im;return new Complex(cosh(v)*Math.cos(N),sinh(v)*Math.sin(N))},tanh:function(){const v=2*this.re,N=2*this.im,G=cosh(v)+Math.cos(N);return new Complex(sinh(v)/G,Math.sin(N)/G)},coth:function(){const v=2*this.re,N=2*this.im,G=cosh(v)-Math.cos(N);return new Complex(sinh(v)/G,-Math.sin(N)/G)},csch:function(){const v=this.re,N=this.im,G=Math.cos(2*N)-cosh(2*v);return new Complex(-2*sinh(v)*Math.cos(N)/G,2*cosh(v)*Math.sin(N)/G)},sech:function(){const v=this.re,N=this.im,G=Math.cos(2*N)+cosh(2*v);return new Complex(2*cosh(v)*Math.cos(N)/G,-2*sinh(v)*Math.sin(N)/G)},asinh:function(){let v=this.im;this.im=-this.re,this.re=v;const N=this.asin();return this.re=-this.im,this.im=v,v=N.re,N.re=-N.im,N.im=v,N},acosh:function(){const v=this.acos();if(v.im<=0){const N=v.re;v.re=-v.im,v.im=N}else{const N=v.im;v.im=-v.re,v.re=N}return v},atanh:function(){const v=this.re,N=this.im,G=v>1&&N===0,z=1-v,q=1+v,Y=z*z+N*N,W=Y!==0?new Complex((q*z-N*N)/Y,(N*z+q*N)/Y):new Complex(v!==-1?v/0:0,N!==0?N/0:0),ie=W.re;return W.re=logHypot(W.re,W.im)/2,W.im=Math.atan2(W.im,ie)/2,G&&(W.im=-W.im),W},acoth:function(){const v=this.re,N=this.im;if(v===0&&N===0)return new Complex(0,Math.PI/2);const G=v*v+N*N;return G!==0?new Complex(v/G,-N/G).atanh():new Complex(v!==0?v/0:0,N!==0?-N/0:0).atanh()},acsch:function(){const v=this.re,N=this.im;if(N===0)return new Complex(v!==0?Math.log(v+Math.sqrt(v*v+1)):1/0,0);const G=v*v+N*N;return G!==0?new Complex(v/G,-N/G).asinh():new Complex(v!==0?v/0:0,N!==0?-N/0:0).asinh()},asech:function(){const v=this.re,N=this.im;if(this.isZero())return Complex.INFINITY;const G=v*v+N*N;return G!==0?new Complex(v/G,-N/G).acosh():new Complex(v!==0?v/0:0,N!==0?-N/0:0).acosh()},inverse:function(){if(this.isZero())return Complex.INFINITY;if(this.isInfinite())return Complex.ZERO;const v=this.re,N=this.im,G=v*v+N*N;return new Complex(v/G,-N/G)},conjugate:function(){return new Complex(this.re,-this.im)},neg:function(){return new Complex(-this.re,-this.im)},ceil:function(v){return v=Math.pow(10,v||0),new Complex(Math.ceil(this.re*v)/v,Math.
vendor: 33,144 bytes, lines 437-443
437ceil(this.im*v)/v)},floor:function(v){return v=Math.pow(10,v||0),new Complex(Math.floor(this.re*v)/v,Math.floor(this.im*v)/v)},round:function(v){return v=Math.pow(10,v||0),new Complex(Math.round(this.re*v)/v,Math.round(this.im*v)/v)},equals:function(v,N){const G=parse(v,N);return Math.abs(G.re-this.re)<=Complex.EPSILON&&Math.abs(G.im-this.im)<=Complex.EPSILON},clone:function(){return new Complex(this.re,this.im)},toString:function(){let v=this.re,N=this.im,G="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(v)<Complex.EPSILON&&(v=0),Math.abs(N)<Complex.EPSILON&&(N=0),N===0?G+v:(v!==0?(G+=v,G+=" ",N<0?(N=-N,G+="-"):G+="+",G+=" "):N<0&&(N=-N,G+="-"),N!==1&&(G+=N),G+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}};Complex.ZERO=new Complex(0,0);Complex.ONE=new Complex(1,0);Complex.I=new Complex(0,1);Complex.PI=new Complex(Math.PI,0);Complex.E=new Complex(Math.E,0);Complex.INFINITY=new Complex(1/0,1/0);Complex.NAN=new Complex(NaN,NaN);Complex.EPSILON=1e-15;var name$4O="Complex",dependencies$4N=[],createComplexClass=factory(name$4O,dependencies$4N,()=>(Object.defineProperty(Complex,"name",{value:"Complex"}),Complex.prototype.constructor=Complex,Complex.prototype.type="Complex",Complex.prototype.isComplex=!0,Complex.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Complex.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Complex.prototype.format=function(v){var N="",G=this.im,z=this.re,q=format$2(this.re,v),Y=format$2(this.im,v),W=isNumber(v)?v:v?v.precision:null;if(W!==null){var ie=Math.pow(10,-W);Math.abs(z/G)<ie&&(z=0),Math.abs(G/z)<ie&&(G=0)}return G===0?N=q:z===0?G===1?N="i":G===-1?N="-i":N=Y+"i":G<0?G===-1?N=q+" - i":N=q+" - "+Y.substring(1)+"i":G===1?N=q+" + i":N=q+" + "+Y+"i",N},Complex.fromPolar=function(v){switch(arguments.length){case 1:{var N=arguments[0];if(typeof N=="object")return Complex(N);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var G=arguments[0],z=arguments[1];if(isNumber(G)){if(isUnit(z)&&z.hasBase("ANGLE")&&(z=z.toNumber("rad")),isNumber(z))return new Complex({r:G,phi:z});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Complex.prototype.valueOf=Complex.prototype.toString,Complex.fromJSON=function(v){return new Complex(v)},Complex.compare=function(v,N){return v.re>N.re?1:v.re<N.re?-1:v.im>N.im?1:v.im<N.im?-1:0},Complex),{isClass:!0}),fraction={exports:{}};/**
438 * @license Fraction.js v4.3.0 20/08/2023
439 * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
440 *
441 * Copyright (c) 2023, Robert Eisele ([email protected])
442 * Dual licensed under the MIT or GPL Version 2 licenses.
443 **/var hasRequiredFraction;function requireFraction(){return hasRequiredFraction||(hasRequiredFraction=1,function(v,N){(function(G){var z=2e3,q={s:1,n:0,d:1};function Y(Pe,Je){if(isNaN(Pe=parseInt(Pe,10)))throw be();return Pe*Je}function W(Pe,Je){if(Je===0)throw ve();var Ce=Object.create(ge.prototype);Ce.s=Pe<0?-1:1,Pe=Pe<0?-Pe:Pe;var Ve=pe(Pe,Je);return Ce.n=Pe/Ve,Ce.d=Je/Ve,Ce}function ie(Pe){for(var Je={},Ce=Pe,Ve=2,Re=4;Re<=Ce;){for(;Ce%Ve===0;)Ce/=Ve,Je[Ve]=(Je[Ve]||0)+1;Re+=1+2*Ve++}return Ce!==Pe?Ce>1&&(Je[Ce]=(Je[Ce]||0)+1):Je[Pe]=(Je[Pe]||0)+1,Je}var ne=function(Pe,Je){var Ce=0,Ve=1,Re=1,qe=0,et=0,Ze=0,tt=1,Ke=1,rt=0,it=1,ot=1,ut=1,ct=1e7,at;if(Pe!=null)if(Je!==void 0){if(Ce=Pe,Ve=Je,Re=Ce*Ve,Ce%1!==0||Ve%1!==0)throw Ee()}else switch(typeof Pe){case"object":{if("d"in Pe&&"n"in Pe)Ce=Pe.n,Ve=Pe.d,"s"in Pe&&(Ce*=Pe.s);else if(0 in Pe)Ce=Pe[0],1 in Pe&&(Ve=Pe[1]);else throw be();Re=Ce*Ve;break}case"number":{if(Pe<0&&(Re=Pe,Pe=-Pe),Pe%1===0)Ce=Pe;else if(Pe>0){for(Pe>=1&&(Ke=Math.pow(10,Math.floor(1+Math.log(Pe)/Math.LN10)),Pe/=Ke);it<=ct&&ut<=ct;)if(at=(rt+ot)/(it+ut),Pe===at){it+ut<=ct?(Ce=rt+ot,Ve=it+ut):ut>it?(Ce=ot,Ve=ut):(Ce=rt,Ve=it);break}else Pe>at?(rt+=ot,it+=ut):(ot+=rt,ut+=it),it>ct?(Ce=ot,Ve=ut):(Ce=rt,Ve=it);Ce*=Ke}else(isNaN(Pe)||isNaN(Je))&&(Ve=Ce=NaN);break}case"string":{if(it=Pe.match(/\d+|./g),it===null)throw be();if(it[rt]==="-"?(Re=-1,rt++):it[rt]==="+"&&rt++,it.length===rt+1?et=Y(it[rt++],Re):it[rt+1]==="."||it[rt]==="."?(it[rt]!=="."&&(qe=Y(it[rt++],Re)),rt++,(rt+1===it.length||it[rt+1]==="("&&it[rt+3]===")"||it[rt+1]==="'"&&it[rt+3]==="'")&&(et=Y(it[rt],Re),tt=Math.pow(10,it[rt].length),rt++),(it[rt]==="("&&it[rt+2]===")"||it[rt]==="'"&&it[rt+2]==="'")&&(Ze=Y(it[rt+1],Re),Ke=Math.pow(10,it[rt+1].length)-1,rt+=3)):it[rt+1]==="/"||it[rt+1]===":"?(et=Y(it[rt],Re),tt=Y(it[rt+2],1),rt+=3):it[rt+3]==="/"&&it[rt+1]===" "&&(qe=Y(it[rt],Re),et=Y(it[rt+2],Re),tt=Y(it[rt+4],1),rt+=5),it.length<=rt){Ve=tt*Ke,Re=Ce=Ze+Ve*qe+Ke*et;break}}default:throw be()}if(Ve===0)throw ve();q.s=Re<0?-1:1,q.n=Math.abs(Ce),q.d=Math.abs(Ve)};function se(Pe,Je,Ce){for(var Ve=1;Je>0;Pe=Pe*Pe%Ce,Je>>=1)Je&1&&(Ve=Ve*Pe%Ce);return Ve}function ae(Pe,Je){for(;Je%2===0;Je/=2);for(;Je%5===0;Je/=5);if(Je===1)return 0;for(var Ce=10%Je,Ve=1;Ce!==1;Ve++)if(Ce=Ce*10%Je,Ve>z)return 0;return Ve}function ce(Pe,Je,Ce){for(var Ve=1,Re=se(10,Ce,Je),qe=0;qe<300;qe++){if(Ve===Re)return qe;Ve=Ve*10%Je,Re=Re*10%Je}return 0}function pe(Pe,Je){if(!Pe)return Je;if(!Je)return Pe;for(;;){if(Pe%=Je,!Pe)return Je;if(Je%=Pe,!Je)return Pe}}function ge(Pe,Je){if(ne(Pe,Je),this instanceof ge)Pe=pe(q.d,q.n),this.s=q.s,this.n=q.n/Pe,this.d=q.d/Pe;else return W(q.s*q.n,q.d)}var ve=function(){return new Error("Division by Zero")},be=function(){return new Error("Invalid argument")},Ee=function(){return new Error("Parameters must be integer")};ge.prototype={s:1,n:0,d:1,abs:function(){return W(this.n,this.d)},neg:function(){return W(-this.s*this.n,this.d)},add:function(Pe,Je){return ne(Pe,Je),W(this.s*this.n*q.d+q.s*this.d*q.n,this.d*q.d)},sub:function(Pe,Je){return ne(Pe,Je),W(this.s*this.n*q.d-q.s*this.d*q.n,this.d*q.d)},mul:function(Pe,Je){return ne(Pe,Je),W(this.s*q.s*this.n*q.n,this.d*q.d)},div:function(Pe,Je){return ne(Pe,Je),W(this.s*q.s*this.n*q.d,this.d*q.n)},clone:function(){return W(this.s*this.n,this.d)},mod:function(Pe,Je){if(isNaN(this.n)||isNaN(this.d))return new ge(NaN);if(Pe===void 0)return W(this.s*this.n%this.d,1);if(ne(Pe,Je),q.n===0&&this.d===0)throw ve();return W(this.s*(q.d*this.n)%(q.n*this.d),q.d*this.d)},gcd:function(Pe,Je){return ne(Pe,Je),W(pe(q.n,this.n)*pe(q.d,this.d),q.d*this.d)},lcm:function(Pe,Je){return ne(Pe,Je),q.n===0&&this.n===0?W(0,1):W(q.n*this.n,pe(q.n,this.n)*pe(q.d,this.d))},ceil:function(Pe){return Pe=Math.pow(10,Pe||0),isNaN(this.n)||isNaN(this.d)?new ge(NaN):W(Math.ceil(Pe*this.s*this.n/this.d),Pe)},floor:function(Pe){return Pe=Math.pow(10,Pe||0),isNaN(this.n)||isNaN(this.d)?new ge(NaN):W(Math.floor(Pe*this.s*this.n/this.d),Pe)},round:function(Pe){return Pe=Math.pow(10,Pe||0),isNaN(this.n)||isNaN(this.d)?new ge(NaN):W(Math.round(Pe*this.s*this.n/this.d),Pe)},inverse:function(){return W(this.s*this.d,this.n)},pow:function(Pe,Je){if(ne(Pe,Je),q.d===1)return q.s<0?W(Math.pow(this.s*this.d,q.n),Math.pow(this.n,q.n)):W(Math.pow(this.s*this.n,q.n),Math.pow(this.d,q.n));if(this.s<0)return null;var Ce=ie(this.n),Ve=ie(this.d),Re=1,qe=1;for(var et in Ce)if(et!=="1"){if(et==="0"){Re=0;break}if(Ce[et]*=q.n,Ce[et]%q.d===0)Ce[et]/=q.d;else return null;Re*=Math.pow(et,Ce[et])}for(var et in Ve)if(et!=="1"){if(Ve[et]*=q.n,Ve[et]%q.d===0)Ve[et]/=q.d;else return null;qe*=Math.pow(et,Ve[et])}return q.s<0?W(qe,Re):W(Re,qe)},equals:function(Pe,Je){return ne(Pe,Je),this.s*this.n*q.d===q.s*q.n*this.d},compare:function(Pe,Je){ne(Pe,Je);var Ce=this.s*this.n*q.d-q.s*q.n*this.d;return(0<Ce)-(Ce<0)},simplify:function(Pe){if(isNaN(this.n)||isNaN(this.d))return this;Pe=Pe||.001;for(var Je=this.abs(),Ce=Je.toContinued(),Ve=1;Ve<Ce.length;Ve++){for(var Re=W(Ce[Ve-1],1),qe=Ve-2;qe>=0;qe--)Re=Re.inverse().add(Ce[qe]);if(Math.abs(Re.sub(Je).valueOf())<Pe)return Re.mul(this.s)}return this},divisible:function(Pe,Je){return ne(Pe,Je),!(!(q.n*this.d)||this.n*q.d%(q.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(Pe){var Je,Ce="",Ve=this.n,Re=this.d;return this.s<0&&(Ce+="-"),Re===1?Ce+=Ve:(Pe&&(Je=Math.floor(Ve/Re))>0&&(Ce+=Je,Ce+=" ",Ve%=Re),Ce+=Ve,Ce+="/",Ce+=Re),Ce},toLatex:function(Pe){var Je,Ce="",Ve=this.n,Re=this.d;return this.s<0&&(Ce+="-"),Re===1?Ce+=Ve:(Pe&&(Je=Math.floor(Ve/Re))>0&&(Ce+=Je,Ve%=Re),Ce+="\\frac{",Ce+=Ve,Ce+="}{",Ce+=Re,Ce+="}"),Ce},toContinued:function(){var Pe,Je=this.n,Ce=this.d,Ve=[];if(isNaN(Je)||isNaN(Ce))return Ve;do Ve.push(Math.floor(Je/Ce)),Pe=Je%Ce,Je=Ce,Ce=Pe;while(Je!==1);return Ve},toString:function(Pe){var Je=this.n,Ce=this.d;if(isNaN(Je)||isNaN(Ce))return"NaN";Pe=Pe||15;var Ve=ae(Je,Ce),Re=ce(Je,Ce,Ve),qe=this.s<0?"-":"";if(qe+=Je/Ce|0,Je%=Ce,Je*=10,Je&&(qe+="."),Ve){for(var et=Re;et--;)qe+=Je/Ce|0,Je%=Ce,Je*=10;qe+="(";for(var et=Ve;et--;)qe+=Je/Ce|0,Je%=Ce,Je*=10;qe+=")"}else for(var et=Pe;Je&&et--;)qe+=Je/Ce|0,Je%=Ce,Je*=10;return qe}},Object.defineProperty(ge,"__esModule",{value:!0}),ge.default=ge,ge.Fraction=ge,v.exports=ge})()}(fraction)),fraction.exports}var fractionExports=requireFraction();const Fraction=getDefaultExportFromCjs(fractionExports);var name$4N="Fraction",dependencies$4M=[],createFractionClass=factory(name$4N,dependencies$4M,()=>(Object.defineProperty(Fraction,"name",{value:"Fraction"}),Fraction.prototype.constructor=Fraction,Fraction.prototype.type="Fraction",Fraction.prototype.isFraction=!0,Fraction.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Fraction.fromJSON=function(v){return new Fraction(v)},Fraction),{isClass:!0}),name$4M="Range",dependencies$4L=[],createRangeClass=factory(name$4M,dependencies$4L,()=>{function v(N,G,z){if(!(this instanceof v))throw new SyntaxError("Constructor must be called with the new operator");var q=N!=null,Y=G!=null,W=z!=null;if(q){if(isBigNumber(N))N=N.toNumber();else if(typeof N!="number")throw new TypeError("Parameter start must be a number")}if(Y){if(isBigNumber(G))G=G.toNumber();else if(typeof G!="number")throw new TypeError("Parameter end must be a number")}if(W){if(isBigNumber(z))z=z.toNumber();else if(typeof z!="number")throw new TypeError("Parameter step must be a number")}this.start=q?parseFloat(N):0,this.end=Y?parseFloat(G):0,this.step=W?parseFloat(z):1}return v.prototype.type="Range",v.prototype.isRange=!0,v.parse=function(N){if(typeof N!="string")return null;var G=N.split(":"),z=G.map(function(Y){return parseFloat(Y)}),q=z.some(function(Y){return isNaN(Y)});if(q)return null;switch(z.length){case 2:return new v(z[0],z[1]);case 3:return new v(z[0],z[2],z[1]);default:return null}},v.prototype.clone=function(){return new v(this.start,this.end,this.step)},v.prototype.size=function(){var N=0,G=this.start,z=this.step,q=this.end,Y=q-G;return sign$1(z)===sign$1(Y)?N=Math.ceil(Y/z):Y===0&&(N=0),isNaN(N)&&(N=0),[N]},v.prototype.min=function(){var N=this.size()[0];if(N>0)return this.step>0?this.start:this.start+(N-1)*this.step},v.prototype.max=function(){var N=this.size()[0];if(N>0)return this.step>0?this.start+(N-1)*this.step:this.start},v.prototype.forEach=function(N){var G=this.start,z=this.step,q=this.end,Y=0;if(z>0)for(;G<q;)N(G,[Y],this),G+=z,Y++;else if(z<0)for(;G>q;)N(G,[Y],this),G+=z,Y++},v.prototype.map=function(N){var G=[];return this.forEach(function(z,q,Y){G[q[0]]=N(z,q,Y)}),G},v.prototype.toArray=function(){var N=[];return this.forEach(function(G,z){N[z[0]]=G}),N},v.prototype.valueOf=function(){return this.toArray()},v.prototype.format=function(N){var G=format$2(this.start,N);return this.step!==1&&(G+=":"+format$2(this.step,N)),G+=":"+format$2(this.end,N),G},v.prototype.toString=function(){return this.format()},v.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},v.fromJSON=function(N){return new v(N.start,N.end,N.step)},v},{isClass:!0}),name$4L="Matrix",dependencies$4K=[],createMatrixClass=factory(name$4L,dependencies$4K,()=>{function v(){if(!(this instanceof v))throw new SyntaxError("Constructor must be called with the new operator")}return v.prototype.type="Matrix",v.prototype.isMatrix=!0,v.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},v.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},v.prototype.create=function(N,G){throw new Error("Cannot invoke create on a Matrix interface")},v.prototype.subset=function(N,G,z){throw new Error("Cannot invoke subset on a Matrix interface")},v.prototype.get=function(N){throw new Error("Cannot invoke get on a Matrix interface")},v.prototype.set=function(N,G,z){throw new Error("Cannot invoke set on a Matrix interface")},v.prototype.resize=function(N,G){throw new Error("Cannot invoke resize on a Matrix interface")},v.prototype.reshape=function(N,G){throw new Error("Cannot invoke reshape on a Matrix interface")},v.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},v.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},v.prototype.map=function(N,G){throw new Error("Cannot invoke map on a Matrix interface")},v.prototype.forEach=function(N){throw new Error("Cannot invoke forEach on a Matrix interface")},v.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},v.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},v.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},v.prototype.format=function(N){throw new Error("Cannot invoke format on a Matrix interface")},v.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},v},{isClass:!0});function lruQueue(v){var N=0,G=1,z=Object.create(null),q=Object.create(null),Y=0,W=function(ne){var se=q[ne];if(se&&(delete z[se],delete q[ne],--N,G===se)){if(!N){Y=0,G=1;return}for(;!Object.prototype.hasOwnProperty.call(z,++G););}};return v=Math.abs(v),{hit:function(ne){var se=q[ne],ae=++Y;if(z[ae]=ne,q[ne]=ae,!se)return++N,N<=v?void 0:(ne=z[G],W(ne),ne);if(delete z[se],G===se)for(;!Object.prototype.hasOwnProperty.call(z,++G););},delete:W,clear:function(){N=Y=0,G=1,z=Object.create(null),q=Object.create(null)}}}function memoize(v){var{hasher:N,limit:G}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return G=G??Number.POSITIVE_INFINITY,N=N??JSON.stringify,function z(){typeof z.cache!="object"&&(z.cache={values:new Map,lru:lruQueue(G||Number.POSITIVE_INFINITY)});for(var q=[],Y=0;Y<arguments.length;Y++)q[Y]=arguments[Y];var W=N(q);if(z.cache.values.has(W))return z.cache.lru.hit(W),z.cache.values.get(W);var ie=v.apply(v,q);return z.cache.values.set(W,ie),z.cache.values.delete(z.cache.lru.hit(W)),ie}}function maxArgumentCount(v){return Object.keys(v.signatures||{}).reduce(function(N,G){var z=(G.match(/,/g)||[]).length+1;return Math.max(N,z)},-1)}var name$4K="DenseMatrix",dependencies$4J=["Matrix"],createDenseMatrixClass=factory(name$4K,dependencies$4J,v=>{var{Matrix:N}=v;function G(ae,ce){if(!(this instanceof G))throw new SyntaxError("Constructor must be called with the new operator");if(ce&&!isString(ce))throw new Error("Invalid datatype: "+ce);if(isMatrix(ae))ae.type==="DenseMatrix"?(this._data=clone$2(ae._data),this._size=clone$2(ae._size),this._datatype=ce||ae._datatype):(this._data=ae.toArray(),this._size=ae.size(),this._datatype=ce||ae._datatype);else if(ae&&isArray(ae.data)&&isArray(ae.size))this._data=ae.data,this._size=ae.size,validate(this._data,this._size),this._datatype=ce||ae.datatype;else if(isArray(ae))this._data=se(ae),this._size=arraySize(this._data),validate(this._data,this._size),this._datatype=ce;else{if(ae)throw new TypeError("Unsupported type of data ("+typeOf(ae)+")");this._data=[],this._size=[0],this._datatype=ce}}G.prototype=new N,G.prototype.createDenseMatrix=function(ae,ce){return new G(ae,ce)},Object.defineProperty(G,"name",{value:"DenseMatrix"}),G.prototype.constructor=G,G.prototype.type="DenseMatrix",G.prototype.isDenseMatrix=!0,G.prototype.getDataType=function(){return getArrayDataType(this._data,typeOf)},G.prototype.storage=function(){return"dense"},G.prototype.datatype=function(){return this._datatype},G.prototype.create=function(ae,ce){return new G(ae,ce)},G.prototype.subset=function(ae,ce,pe){switch(arguments.length){case 1:return z(this,ae);case 2:case 3:return Y(this,ae,ce,pe);default:throw new SyntaxError("Wrong number of arguments")}},G.prototype.get=function(ae){if(!isArray(ae))throw new TypeError("Array expected");if(ae.length!==this._size.length)throw new DimensionError(ae.length,this._size.length);for(var ce=0;ce<ae.length;ce++)validateIndex(ae[ce],this._size[ce]);for(var pe=this._data,ge=0,ve=ae.length;ge<ve;ge++){var be=ae[ge];validateIndex(be,pe.length),pe=pe[be]}return pe},G.prototype.set=function(ae,ce,pe){if(!isArray(ae))throw new TypeError("Array expected");if(ae.length<this._size.length)throw new DimensionError(ae.length,this._size.length,"<");var ge,ve,be,Ee=ae.map(function(Je){return Je+1});ne(this,Ee,pe);var Pe=this._data;for(ge=0,ve=ae.length-1;ge<ve;ge++)be=ae[ge],validateIndex(be,Pe.length),Pe=Pe[be];return be=ae[ae.length-1],validateIndex(be,Pe.length),Pe[be]=ce,this};function z(ae,ce){if(!isIndex(ce))throw new TypeError("Invalid index");var pe=ce.isScalar();if(pe)return ae.get(ce.min());var ge=ce.size();if(ge.length!==ae._size.length)throw new DimensionError(ge.length,ae._size.length);for(var ve=ce.min(),be=ce.max(),Ee=0,Pe=ae._size.length;Ee<Pe;Ee++)validateIndex(ve[Ee],ae._size[Ee]),validateIndex(be[Ee],ae._size[Ee]);return new G(q(ae._data,ce,ge.length,0),ae._datatype)}function q(ae,ce,pe,ge){var ve=ge===pe-1,be=ce.dimension(ge);return ve?be.map(function(Ee){return validateIndex(Ee,ae.length),ae[Ee]}).valueOf():be.map(function(Ee){validateIndex(Ee,ae.length);var Pe=ae[Ee];return q(Pe,ce,pe,ge+1)}).valueOf()}function Y(ae,ce,pe,ge){if(!ce||ce.isIndex!==!0)throw new TypeError("Invalid index");var ve=ce.size(),be=ce.isScalar(),Ee;if(isMatrix(pe)?(Ee=pe.size(),pe=pe.valueOf()):Ee=arraySize(pe),be){if(Ee.length!==0)throw new TypeError("Scalar expected");ae.set(ce.min(),pe,ge)}else{if(!deepStrictEqual(Ee,ve))try{Ee.length===0?pe=broadcastTo([pe],ve):pe=broadcastTo(pe,ve),Ee=arraySize(pe)}catch{}if(ve.length<ae._size.length)throw new DimensionError(ve.length,ae._size.length,"<");if(Ee.length<ve.length){for(var Pe=0,Je=0;ve[Pe]===1&&Ee[Pe]===1;)Pe++;for(;ve[Pe]===1;)Je++,Pe++;pe=unsqueeze(pe,ve.length,Je,Ee)}if(!deepStrictEqual(ve,Ee))throw new DimensionError(ve,Ee,">");var Ce=ce.max().map(function(qe){return qe+1});ne(ae,Ce,ge);var Ve=ve.length,Re=0;W(ae._data,ce,pe,Ve,Re)}return ae}function W(ae,ce,pe,ge,ve){var be=ve===ge-1,Ee=ce.dimension(ve);be?Ee.forEach(function(Pe,Je){validateIndex(Pe),ae[Pe]=pe[Je[0]]}):Ee.forEach(function(Pe,Je){validateIndex(Pe),W(ae[Pe],ce,pe[Je[0]],ge,ve+1)})}G.prototype.resize=function(ae,ce,pe){if(!isCollection(ae))throw new TypeError("Array or Matrix expected");var ge=ae.valueOf().map(be=>Array.isArray(be)&&be.length===1?be[0]:be),ve=pe?this.clone():this;return ie(ve,ge,ce)};function ie(ae,ce,pe){if(ce.length===0){for(var ge=ae._data;isArray(ge);)ge=ge[0];return ge}return ae._size=ce.slice(0),ae._data=resize(ae._data,ae._size,pe),ae}G.prototype.reshape=function(ae,ce){var pe=ce?this.clone():this;pe._data=reshape(pe._data,ae);var ge=pe._size.reduce((ve,be)=>ve*be);return pe._size=processSizesWildcard(ae,ge),pe};function ne(ae,ce,pe){for(var ge=ae._size.slice(0),ve=!1;ge.length<ce.length;)ge.push(0),ve=!0;for(var be=0,Ee=ce.length;be<Ee;be++)ce[be]>ge[be]&&(ge[be]=ce[be],ve=!0);ve&&ie(ae,ge,pe)}G.prototype.clone=function(){var ae=new G({data:clone$2(this._data),size:clone$2(this._size),datatype:this._datatype});return ae},G.prototype.size=function(){return this._size.slice(0)},G.prototype.map=function(ae){var ce=this,pe=maxArgumentCount(ae),ge=function Ee(Pe,Je){return isArray(Pe)?Pe.map(function(Ce,Ve){return Ee(Ce,Je.concat(Ve))}):pe===1?ae(Pe):pe===2?ae(Pe,Je):ae(Pe,Je,ce)},ve=ge(this._data,[]),be=this._datatype!==void 0?getArrayDataType(ve,typeOf):void 0;return new G(ve,be)},G.prototype.forEach=function(ae){var ce=this,pe=function ge(ve,be){isArray(ve)?ve.forEach(function(Ee,Pe){ge(Ee,be.concat(Pe))}):ae(ve,be,ce)};pe(this._data,[])},G.prototype[Symbol.iterator]=function*(){var ae=function*ce(pe,ge){if(isArray(pe))for(var ve=0;ve<pe.length;ve++)yield*ce(pe[ve],ge.concat(ve));else yield{value:pe,index:ge}};yield*ae(this._data,[])},G.prototype.rows=function(){var ae=[],ce=this.size();if(ce.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var pe=this._data;for(var ge of pe)ae.push(new G([ge],this._datatype));return ae},G.prototype.columns=function(){var ae=this,ce=[],pe=this.size();if(pe.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var ge=this._data,ve=function(Pe){var Je=ge.map(Ce=>[Ce[Pe]]);ce.push(new G(Je,ae._datatype))},be=0;be<pe[1];be++)ve(be);return ce},G.prototype.toArray=function(){return clone$2(this._data)},G.prototype.valueOf=function(){return this._data},G.prototype.format=function(ae){return format(this._data,ae)},G.prototype.toString=function(){return format(this._data)},G.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},G.prototype.diagonal=function(ae){if(ae){if(isBigNumber(ae)&&(ae=ae.toNumber()),!isNumber(ae)||!isInteger(ae))throw new TypeError("The parameter k must be an integer number")}else ae=0;for(var ce=ae>0?ae:0,pe=ae<0?-ae:0,ge=this._size[0],ve=this._size[1],be=Math.min(ge-pe,ve-ce),Ee=[],Pe=0;Pe<be;Pe++)Ee[Pe]=this._data[Pe+pe][Pe+ce];return new G({data:Ee,size:[be],datatype:this._datatype})},G.diagonal=function(ae,ce,pe,ge){if(!isArray(ae))throw new TypeError("Array expected, size parameter");if(ae.length!==2)throw new Error("Only two dimensions matrix are supported");if(ae=ae.map(function(et){if(isBigNumber(et)&&(et=et.toNumber()),!isNumber(et)||!isInteger(et)||et<1)throw new Error("Size values must be positive integers");return et}),pe){if(isBigNumber(pe)&&(pe=pe.toNumber()),!isNumber(pe)||!isInteger(pe))throw new TypeError("The parameter k must be an integer number")}else pe=0;var ve=pe>0?pe:0,be=pe<0?-pe:0,Ee=ae[0],Pe=ae[1],Je=Math.min(Ee-be,Pe-ve),Ce;if(isArray(ce)){if(ce.length!==Je)throw new Error("Invalid value array length");Ce=function(Ze){return ce[Ze]}}else if(isMatrix(ce)){var Ve=ce.size();if(Ve.length!==1||Ve[0]!==Je)throw new Error("Invalid matrix length");Ce=function(Ze){return ce.get([Ze])}}else Ce=function(){return ce};ge||(ge=isBigNumber(Ce(0))?Ce(0).mul(0):0);var Re=[];if(ae.length>0){Re=resize(Re,ae,ge);for(var qe=0;qe<Je;qe++)Re[qe+be][qe+ve]=Ce(qe)}return new G({data:Re,size:[Ee,Pe]})},G.fromJSON=function(ae){return new G(ae)},G.prototype.swapRows=function(ae,ce){if(!isNumber(ae)||!isInteger(ae)||!isNumber(ce)||!isInteger(ce))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return validateIndex(ae,this._size[0]),validateIndex(ce,this._size[0]),G._swapRows(ae,ce,this._data),this},G._swapRows=function(ae,ce,pe){var ge=pe[ae];pe[ae]=pe[ce],pe[ce]=ge};function se(ae){return isMatrix(ae)?se(ae.valueOf()):isArray(ae)?ae.map(se):ae}return G},{isClass:!0}),name$4J="clone",dependencies$4I=["typed"],createClone=factory(name$4J,dependencies$4I,v=>{var{typed:N}=v;return N(name$4J,{any:clone$2})});function _switch$1(v){var N=v.length,G=v[0].length,z,q,Y=[];for(q=0;q<G;q++){var W=[];for(z=0;z<N;z++)W.push(v[z][q]);Y.push(W)}return Y}function containsCollections(v){for(var N=0;N<v.length;N++)if(isCollection(v[N]))return!0;return!1}function deepForEach(v,N){isMatrix(v)&&(v=v.valueOf());for(var G=0,z=v.length;G<z;G++){var q=v[G];Array.isArray(q)?deepForEach(q,N):N(q)}}function deepMap(v,N,G){return v&&typeof v.map=="function"?v.map(function(z){return deepMap(z,N)}):N(v)}function reduce(v,N,G){var z=Array.isArray(v)?arraySize(v):v.size();if(N<0||N>=z.length)throw new IndexError(N,z.length);return isMatrix(v)?v.create(_reduce(v.valueOf(),N,G)):_reduce(v,N,G)}function _reduce(v,N,G){var z,q,Y,W;if(N<=0)if(Array.isArray(v[0])){for(W=_switch$1(v),q=[],z=0;z<W.length;z++)q[z]=_reduce(W[z],N-1,G);return q}else{for(Y=v[0],z=1;z<v.length;z++)Y=G(Y,v[z]);return Y}else{for(q=[],z=0;z<v.length;z++)q[z]=_reduce(v[z],N-1,G);return q}}function scatter(v,N,G,z,q,Y,W,ie,ne,se,ae){var ce=v._values,pe=v._index,ge=v._ptr,ve,be,Ee,Pe;if(z)for(be=ge[N],Ee=ge[N+1],ve=be;ve<Ee;ve++)Pe=pe[ve],G[Pe]!==Y?(G[Pe]=Y,W.push(Pe),z[Pe]=ce[ve]):(z[Pe]=ie(z[Pe],ce[ve]),q[Pe]=Y);else for(be=ge[N],Ee=ge[N+1],ve=be;ve<Ee;ve++)Pe=pe[ve],G[Pe]!==Y?(G[Pe]=Y,W.push(Pe)):q[Pe]=Y}var name$4I="isInteger",dependencies$4H=["typed"],createIsInteger=factory(name$4I,dependencies$4H,v=>{var{typed:N}=v;return N(name$4I,{number:isInteger,BigNumber:function(z){return z.isInt()},Fraction:function(z){return z.d===1&&isFinite(z.n)},"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),n1$4="number",n2$2="number, number";function absNumber(v){return Math.abs(v)}absNumber.signature=n1$4;function addNumber(v,N){return v+N}addNumber.signature=n2$2;function subtractNumber(v,N){return v-N}subtractNumber.signature=n2$2;function multiplyNumber(v,N){return v*N}multiplyNumber.signature=n2$2;function unaryMinusNumber(v){return-v}unaryMinusNumber.signature=n1$4;function unaryPlusNumber(v){return v}unaryPlusNumber.signature=n1$4;function cbrtNumber(v){return cbrt$1(v)}cbrtNumber.signature=n1$4;function cubeNumber(v){return v*v*v}cubeNumber.signature=n1$4;function expNumber(v){return Math.exp(v)}expNumber.signature=n1$4;function expm1Number(v){return expm1(v)}expm1Number.signature=n1$4;function lcmNumber(v,N){if(!isInteger(v)||!isInteger(N))throw new Error("Parameters in function lcm must be integer numbers");if(v===0||N===0)return 0;for(var G,z=v*N;N!==0;)G=N,N=v%G,v=G;return Math.abs(z/v)}lcmNumber.signature=n2$2;function logNumber(v,N){return Math.log(v)}function log10Number(v){return log10$1(v)}log10Number.signature=n1$4;function log2Number(v){return log2$1(v)}log2Number.signature=n1$4;function nthRootNumber(v){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,G=N<0;if(G&&(N=-N),N===0)throw new Error("Root must be non-zero");if(v<0&&Math.abs(N)%2!==1)throw new Error("Root must be odd when a is negative.");if(v===0)return G?1/0:0;if(!isFinite(v))return G?0:v;var z=Math.pow(Math.abs(v),1/N);return z=v<0?-z:z,G?1/z:z}function signNumber(v){return sign$1(v)}signNumber.signature=n1$4;function squareNumber(v){return v*v}squareNumber.signature=n1$4;function xgcdNumber(v,N){var G,z,q,Y=0,W=1,ie=1,ne=0;if(!isInteger(v)||!isInteger(N))throw new Error("Parameters in function xgcd must be integer numbers");for(;N;)z=Math.floor(v/N),q=v-z*N,G=Y,Y=W-z*Y,W=G,G=ie,ie=ne-z*ie,ne=G,v=N,N=q;var se;return v<0?se=[-v,-W,-ne]:se=[v,v?W:0,ne],se}xgcdNumber.signature=n2$2;function powNumber(v,N){return v*v<1&&N===1/0||v*v>1&&N===-1/0?0:Math.pow(v,N)}powNumber.signature=n2$2;function roundNumber(v){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!isInteger(N)||N<0||N>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(toFixed$1(v,N))}var n1$3="number",n2$1="number, number";function bitAndNumber(v,N){if(!isInteger(v)||!isInteger(N))throw new Error("Integers expected in function bitAnd");return v&N}bitAndNumber.signature=n2$1;function bitNotNumber(v){if(!isInteger(v))throw new Error("Integer expected in function bitNot");return~v}bitNotNumber.signature=n1$3;function bitOrNumber(v,N){if(!isInteger(v)||!isInteger(N))throw new Error("Integers expected in function bitOr");return v|N}bitOrNumber.signature=n2$1;function bitXorNumber(v,N){if(!isInteger(v)||!isInteger(N))throw new Error("Integers expected in function bitXor");return v^N}bitXorNumber.signature=n2$1;function leftShiftNumber(v,N){if(!isInteger(v)||!isInteger(N))throw new Error("Integers expected in function leftShift");return v<<N}leftShiftNumber.signature=n2$1;function rightArithShiftNumber(v,N){if(!isInteger(v)||!isInteger(N))throw new Error("Integers expected in function rightArithShift");return v>>N}rightArithShiftNumber.signature=n2$1;function rightLogShiftNumber(v,N){if(!isInteger(v)||!isInteger(N))throw new Error("Integers expected in function rightLogShift");return v>>>N}rightLogShiftNumber.signature=n2$1;function product(v,N){if(N<v)return 1;if(N===v)return N;var G=N+v>>1;return product(v,G)*product(G+1,N)}function combinationsNumber(v,N){if(!isInteger(v)||v<0)throw new TypeError("Positive integer value expected in function combinations");if(!isInteger(N)||N<0)throw new TypeError("Positive integer value expected in function combinations");if(N>v)throw new TypeError("k must be less than or equal to n");for(var G=v-N,z=1,q=N<G?G+1:N+1,Y=2,W=N<G?N:G,ie=q;ie<=v;++ie)for(z*=ie;Y<=W&&z%Y===0;)z/=Y,++Y;return Y<=W&&(z/=product(Y,W)),z}combinationsNumber.signature="number, number";var pi=Math.PI,tau=2*Math.PI,e$3=Math.E,phi=1.618033988749895,n1$2="number",n2="number, number";function notNumber(v){return!v}notNumber.signature=n1$2;function orNumber(v,N){return!!(v||N)}orNumber.signature=n2;function xorNumber(v,N){return!!v!=!!N}xorNumber.signature=n2;function andNumber(v,N){return!!(v&&N)}andNumber.signature=n2;function gammaNumber(v){var N;if(isInteger(v))return v<=0?isFinite(v)?1/0:NaN:v>171?1/0:product(1,v-1);if(v<.5)return Math.PI/(Math.sin(Math.PI*v)*gammaNumber(1-v));if(v>=171.35)return 1/0;if(v>85){var G=v*v,z=G*v,q=z*v,Y=q*v;return Math.sqrt(2*Math.PI/v)*Math.pow(v/Math.E,v)*(1+1/(12*v)+1/(288*G)-139/(51840*z)-571/(2488320*q)+163879/(209018880*Y)+5246819/(75246796800*Y*v))}--v,N=gammaP[0];for(var W=1;W<gammaP.length;++W)N+=gammaP[W]/(v+W);var ie=v+gammaG+.5;return Math.sqrt(2*Math.PI)*Math.pow(ie,v+.5)*Math.exp(-ie)*N}gammaNumber.signature="number";var gammaG=4.7421875,gammaP=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],lnSqrt2PI=.9189385332046728,lgammaG=5,lgammaN=7,lgammaSeries=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function lgammaNumber(v){if(v<0)return NaN;if(v===0)return 1/0;if(!isFinite(v))return v;if(v<.5)return Math.log(Math.PI/Math.sin(Math.PI*v))-lgammaNumber(1-v);v=v-1;for(var N=v+lgammaG+.5,G=lgammaSeries[0],z=lgammaN-1;z>=1;z--)G+=lgammaSeries[z]/(v+z);return lnSqrt2PI+(v+.5)*Math.log(N)-N+Math.log(G)}lgammaNumber.signature="number";var n1$1="number";function acoshNumber(v){return acosh$1(v)}acoshNumber.signature=n1$1;function acotNumber(v){return Math.atan(1/v)}acotNumber.signature=n1$1;function acothNumber(v){return isFinite(v)?(Math.log((v+1)/v)+Math.log(v/(v-1)))/2:0}acothNumber.signature=n1$1;function acscNumber(v){return Math.asin(1/v)}acscNumber.signature=n1$1;function acschNumber(v){var N=1/v;return Math.log(N+Math.sqrt(N*N+1))}acschNumber.signature=n1$1;function asecNumber(v){return Math.acos(1/v)}asecNumber.signature=n1$1;function asechNumber(v){var N=1/v,G=Math.sqrt(N*N-1);return Math.log(G+N)}asechNumber.signature=n1$1;function asinhNumber(v){return asinh$1(v)}asinhNumber.signature=n1$1;function atanhNumber(v){return atanh$1(v)}atanhNumber.signature=n1$1;function cotNumber(v){return 1/Math.tan(v)}cotNumber.signature=n1$1;function cothNumber(v){var N=Math.exp(2*v);return(N+1)/(N-1)}cothNumber.signature=n1$1;function cscNumber(v){return 1/Math.sin(v)}cscNumber.signature=n1$1;function cschNumber(v){return v===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(v)-Math.exp(-v)))*sign$1(v)}cschNumber.signature=n1$1;function secNumber(v){return 1/Math.cos(v)}secNumber.signature=n1$1;function sechNumber(v){return 2/(Math.exp(v)+Math.exp(-v))}sechNumber.signature=n1$1;function sinhNumber(v){return sinh$2(v)}sinhNumber.signature=n1$1;var n1="number";function isNegativeNumber(v){return v<0}isNegativeNumber.signature=n1;function isPositiveNumber(v){return v>0}isPositiveNumber.signature=n1;function isZeroNumber(v){return v===0}isZeroNumber.signature=n1;function isNaNNumber(v){return Number.isNaN(v)}isNaNNumber.signature=n1;var name$4H="isNegative",dependencies$4G=["typed"],createIsNegative=factory(name$4H,dependencies$4G,v=>{var{typed:N}=v;return N(name$4H,{number:isNegativeNumber,BigNumber:function(z){return z.isNeg()&&!z.isZero()&&!z.isNaN()},Fraction:function(z){return z.s<0},Unit:N.referToSelf(G=>z=>N.find(G,z.valueType())(z.value)),"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$4G="isNumeric",dependencies$4F=["typed"],createIsNumeric=factory(name$4G,depen
443dencies$4F,v=>{var{typed:N}=v;return N(name$4G,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$4F="hasNumericValue",dependencies$4E=["typed","isNumeric"],createHasNumericValue=factory(name$4F,dependencies$4E,v=>{var{typed:N,isNumeric:G}=v;return N(name$4F,{boolean:()=>!0,string:function(q){return q.trim().length>0&&!isNaN(Number(q))},any:function(q){return G(q)}})}),name$4E="isPositive",dependencies$4D=["typed"],createIsPositive=factory(name$4E,dependencies$4D,v=>{var{typed:N}=v;return N(name$4E,{number:isPositiveNumber,BigNumber:function(z){return!z.isNeg()&&!z.isZero()&&!z.isNaN()},Fraction:function(z){return z.s>0&&z.n>0},Unit:N.referToSelf(G=>z=>N.find(G,z.valueType())(z.value)),"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$4D="isZero",dependencies$4C=["typed"],createIsZero=factory(name$4D,dependencies$4C,v=>{var{typed:N}=v;return N(name$4D,{number:isZeroNumber,BigNumber:function(z){return z.isZero()},Complex:function(z){return z.re===0&&z.im===0},Fraction:function(z){return z.d===1&&z.n===0},Unit:N.referToSelf(G=>z=>N.find(G,z.valueType())(z.value)),"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$4C="isNaN",dependencies$4B=["typed"],createIsNaN=factory(name$4C,dependencies$4B,v=>{var{typed:N}=v;return N(name$4C,{number:isNaNNumber,BigNumber:function(z){return z.isNaN()},Fraction:function(z){return!1},Complex:function(z){return z.isNaN()},Unit:function(z){return Number.isNaN(z.value)},"Array | Matrix":function(z){return deepMap(z,Number.isNaN)}})}
vendor: 44,181 bytes, lines 443-445
443),name$4B="typeOf",dependencies$4A=["typed"],createTypeOf=factory(name$4B,dependencies$4A,v=>{var{typed:N}=v;return N(name$4B,{any:typeOf})});function nearlyEqual(v,N,G){if(G==null)return v.eq(N);if(v.eq(N))return!0;if(v.isNaN()||N.isNaN())return!1;if(v.isFinite()&&N.isFinite()){var z=v.minus(N).abs();if(z.isZero())return!0;var q=v.constructor.max(v.abs(),N.abs());return z.lte(q.times(G))}return!1}function complexEquals(v,N,G){return nearlyEqual$1(v.re,N.re,G)&&nearlyEqual$1(v.im,N.im,G)}var createCompareUnits=factory("compareUnits",["typed"],v=>{var{typed:N}=v;return{"Unit, Unit":N.referToSelf(G=>(z,q)=>{if(!z.equalBase(q))throw new Error("Cannot compare units with different base");return N.find(G,[z.valueType(),q.valueType()])(z.value,q.value)})}}),name$4A="equalScalar",dependencies$4z=["typed","config"],createEqualScalar=factory(name$4A,dependencies$4z,v=>{var{typed:N,config:G}=v,z=createCompareUnits({typed:N});return N(name$4A,{"boolean, boolean":function(Y,W){return Y===W},"number, number":function(Y,W){return nearlyEqual$1(Y,W,G.epsilon)},"BigNumber, BigNumber":function(Y,W){return Y.eq(W)||nearlyEqual(Y,W,G.epsilon)},"Fraction, Fraction":function(Y,W){return Y.equals(W)},"Complex, Complex":function(Y,W){return complexEquals(Y,W,G.epsilon)}},z)});factory(name$4A,["typed","config"],v=>{var{typed:N,config:G}=v;return N(name$4A,{"number, number":function(q,Y){return nearlyEqual$1(q,Y,G.epsilon)}})});var name$4z="SparseMatrix",dependencies$4y=["typed","equalScalar","Matrix"],createSparseMatrixClass=factory(name$4z,dependencies$4y,v=>{var{typed:N,equalScalar:G,Matrix:z}=v;function q(be,Ee){if(!(this instanceof q))throw new SyntaxError("Constructor must be called with the new operator");if(Ee&&!isString(Ee))throw new Error("Invalid datatype: "+Ee);if(isMatrix(be))Y(this,be,Ee);else if(be&&isArray(be.index)&&isArray(be.ptr)&&isArray(be.size))this._values=be.values,this._index=be.index,this._ptr=be.ptr,this._size=be.size,this._datatype=Ee||be.datatype;else if(isArray(be))W(this,be,Ee);else{if(be)throw new TypeError("Unsupported type of data ("+typeOf(be)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=Ee}}function Y(be,Ee,Pe){Ee.type==="SparseMatrix"?(be._values=Ee._values?clone$2(Ee._values):void 0,be._index=clone$2(Ee._index),be._ptr=clone$2(Ee._ptr),be._size=clone$2(Ee._size),be._datatype=Pe||Ee._datatype):W(be,Ee.valueOf(),Pe||Ee._datatype)}function W(be,Ee,Pe){be._values=[],be._index=[],be._ptr=[],be._datatype=Pe;var Je=Ee.length,Ce=0,Ve=G,Re=0;if(isString(Pe)&&(Ve=N.find(G,[Pe,Pe])||G,Re=N.convert(0,Pe)),Je>0){var qe=0;do{be._ptr.push(be._index.length);for(var et=0;et<Je;et++){var Ze=Ee[et];if(isArray(Ze)){if(qe===0&&Ce<Ze.length&&(Ce=Ze.length),qe<Ze.length){var tt=Ze[qe];Ve(tt,Re)||(be._values.push(tt),be._index.push(et))}}else qe===0&&Ce<1&&(Ce=1),Ve(Ze,Re)||(be._values.push(Ze),be._index.push(et))}qe++}while(qe<Ce)}be._ptr.push(be._index.length),be._size=[Je,Ce]}q.prototype=new z,q.prototype.createSparseMatrix=function(be,Ee){return new q(be,Ee)},Object.defineProperty(q,"name",{value:"SparseMatrix"}),q.prototype.constructor=q,q.prototype.type="SparseMatrix",q.prototype.isSparseMatrix=!0,q.prototype.getDataType=function(){return getArrayDataType(this._values,typeOf)},q.prototype.storage=function(){return"sparse"},q.prototype.datatype=function(){return this._datatype},q.prototype.create=function(be,Ee){return new q(be,Ee)},q.prototype.density=function(){var be=this._size[0],Ee=this._size[1];return be!==0&&Ee!==0?this._index.length/(be*Ee):0},q.prototype.subset=function(be,Ee,Pe){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return ie(this,be);case 2:case 3:return ne(this,be,Ee,Pe);default:throw new SyntaxError("Wrong number of arguments")}};function ie(be,Ee){if(!isIndex(Ee))throw new TypeError("Invalid index");var Pe=Ee.isScalar();if(Pe)return be.get(Ee.min());var Je=Ee.size();if(Je.length!==be._size.length)throw new DimensionError(Je.length,be._size.length);var Ce,Ve,Re,qe,et=Ee.min(),Ze=Ee.max();for(Ce=0,Ve=be._size.length;Ce<Ve;Ce++)validateIndex(et[Ce],be._size[Ce]),validateIndex(Ze[Ce],be._size[Ce]);var tt=be._values,Ke=be._index,rt=be._ptr,it=Ee.dimension(0),ot=Ee.dimension(1),ut=[],ct=[];it.forEach(function(lt,vt){ct[lt]=vt[0],ut[lt]=!0});var at=tt?[]:void 0,st=[],pt=[];return ot.forEach(function(lt){for(pt.push(st.length),Re=rt[lt],qe=rt[lt+1];Re<qe;Re++)Ce=Ke[Re],ut[Ce]===!0&&(st.push(ct[Ce]),at&&at.push(tt[Re]))}),pt.push(st.length),new q({values:at,index:st,ptr:pt,size:Je,datatype:be._datatype})}function ne(be,Ee,Pe,Je){if(!Ee||Ee.isIndex!==!0)throw new TypeError("Invalid index");var Ce=Ee.size(),Ve=Ee.isScalar(),Re;if(isMatrix(Pe)?(Re=Pe.size(),Pe=Pe.toArray()):Re=arraySize(Pe),Ve){if(Re.length!==0)throw new TypeError("Scalar expected");be.set(Ee.min(),Pe,Je)}else{if(Ce.length!==1&&Ce.length!==2)throw new DimensionError(Ce.length,be._size.length,"<");if(Re.length<Ce.length){for(var qe=0,et=0;Ce[qe]===1&&Re[qe]===1;)qe++;for(;Ce[qe]===1;)et++,qe++;Pe=unsqueeze(Pe,Ce.length,et,Re)}if(!deepStrictEqual(Ce,Re))throw new DimensionError(Ce,Re,">");if(Ce.length===1){var Ze=Ee.dimension(0);Ze.forEach(function(rt,it){validateIndex(rt),be.set([rt,0],Pe[it[0]],Je)})}else{var tt=Ee.dimension(0),Ke=Ee.dimension(1);tt.forEach(function(rt,it){validateIndex(rt),Ke.forEach(function(ot,ut){validateIndex(ot),be.set([rt,ot],Pe[it[0]][ut[0]],Je)})})}}return be}q.prototype.get=function(be){if(!isArray(be))throw new TypeError("Array expected");if(be.length!==this._size.length)throw new DimensionError(be.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var Ee=be[0],Pe=be[1];validateIndex(Ee,this._size[0]),validateIndex(Pe,this._size[1]);var Je=se(Ee,this._ptr[Pe],this._ptr[Pe+1],this._index);return Je<this._ptr[Pe+1]&&this._index[Je]===Ee?this._values[Je]:0},q.prototype.set=function(be,Ee,Pe){if(!isArray(be))throw new TypeError("Array expected");if(be.length!==this._size.length)throw new DimensionError(be.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var Je=be[0],Ce=be[1],Ve=this._size[0],Re=this._size[1],qe=G,et=0;isString(this._datatype)&&(qe=N.find(G,[this._datatype,this._datatype])||G,et=N.convert(0,this._datatype)),(Je>Ve-1||Ce>Re-1)&&(pe(this,Math.max(Je+1,Ve),Math.max(Ce+1,Re),Pe),Ve=this._size[0],Re=this._size[1]),validateIndex(Je,Ve),validateIndex(Ce,Re);var Ze=se(Je,this._ptr[Ce],this._ptr[Ce+1],this._index);return Ze<this._ptr[Ce+1]&&this._index[Ze]===Je?qe(Ee,et)?ae(Ze,Ce,this._values,this._index,this._ptr):this._values[Ze]=Ee:qe(Ee,et)||ce(Ze,Je,Ce,Ee,this._values,this._index,this._ptr),this};function se(be,Ee,Pe,Je){if(Pe-Ee===0)return Pe;for(var Ce=Ee;Ce<Pe;Ce++)if(Je[Ce]===be)return Ce;return Ee}function ae(be,Ee,Pe,Je,Ce){Pe.splice(be,1),Je.splice(be,1);for(var Ve=Ee+1;Ve<Ce.length;Ve++)Ce[Ve]--}function ce(be,Ee,Pe,Je,Ce,Ve,Re){Ce.splice(be,0,Je),Ve.splice(be,0,Ee);for(var qe=Pe+1;qe<Re.length;qe++)Re[qe]++}q.prototype.resize=function(be,Ee,Pe){if(!isCollection(be))throw new TypeError("Array or Matrix expected");var Je=be.valueOf().map(Ve=>Array.isArray(Ve)&&Ve.length===1?Ve[0]:Ve);if(Je.length!==2)throw new Error("Only two dimensions matrix are supported");Je.forEach(function(Ve){if(!isNumber(Ve)||!isInteger(Ve)||Ve<0)throw new TypeError("Invalid size, must contain positive integers (size: "+format(Je)+")")});var Ce=Pe?this.clone():this;return pe(Ce,Je[0],Je[1],Ee)};function pe(be,Ee,Pe,Je){var Ce=Je||0,Ve=G,Re=0;isString(be._datatype)&&(Ve=N.find(G,[be._datatype,be._datatype])||G,Re=N.convert(0,be._datatype),Ce=N.convert(Ce,be._datatype));var qe=!Ve(Ce,Re),et=be._size[0],Ze=be._size[1],tt,Ke,rt;if(Pe>Ze){for(Ke=Ze;Ke<Pe;Ke++)if(be._ptr[Ke]=be._values.length,qe)for(tt=0;tt<et;tt++)be._values.push(Ce),be._index.push(tt);be._ptr[Pe]=be._values.length}else Pe<Ze&&(be._ptr.splice(Pe+1,Ze-Pe),be._values.splice(be._ptr[Pe],be._values.length),be._index.splice(be._ptr[Pe],be._index.length));if(Ze=Pe,Ee>et){if(qe){var it=0;for(Ke=0;Ke<Ze;Ke++){be._ptr[Ke]=be._ptr[Ke]+it,rt=be._ptr[Ke+1]+it;var ot=0;for(tt=et;tt<Ee;tt++,ot++)be._values.splice(rt+ot,0,Ce),be._index.splice(rt+ot,0,tt),it++}be._ptr[Ze]=be._values.length}}else if(Ee<et){var ut=0;for(Ke=0;Ke<Ze;Ke++){be._ptr[Ke]=be._ptr[Ke]-ut;var ct=be._ptr[Ke],at=be._ptr[Ke+1]-ut;for(rt=ct;rt<at;rt++)tt=be._index[rt],tt>Ee-1&&(be._values.splice(rt,1),be._index.splice(rt,1),ut++)}be._ptr[Ke]=be._values.length}return be._size[0]=Ee,be._size[1]=Pe,be}q.prototype.reshape=function(be,Ee){if(!isArray(be))throw new TypeError("Array expected");if(be.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");be.forEach(function(lt){if(!isNumber(lt)||!isInteger(lt)||lt<=-2||lt===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+format(be)+")")});var Pe=this._size[0]*this._size[1];be=processSizesWildcard(be,Pe);var Je=be[0]*be[1];if(Pe!==Je)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var Ce=Ee?this.clone():this;if(this._size[0]===be[0]&&this._size[1]===be[1])return Ce;for(var Ve=[],Re=0;Re<Ce._ptr.length;Re++)for(var qe=0;qe<Ce._ptr[Re+1]-Ce._ptr[Re];qe++)Ve.push(Re);for(var et=Ce._values.slice(),Ze=Ce._index.slice(),tt=0;tt<Ce._index.length;tt++){var Ke=Ze[tt],rt=Ve[tt],it=Ke*Ce._size[1]+rt;Ve[tt]=it%be[1],Ze[tt]=Math.floor(it/be[1])}Ce._values.length=0,Ce._index.length=0,Ce._ptr.length=be[1]+1,Ce._size=be.slice();for(var ot=0;ot<Ce._ptr.length;ot++)Ce._ptr[ot]=0;for(var ut=0;ut<et.length;ut++){var ct=Ze[ut],at=Ve[ut],st=et[ut],pt=se(ct,Ce._ptr[at],Ce._ptr[at+1],Ce._index);ce(pt,ct,at,st,Ce._values,Ce._index,Ce._ptr)}return Ce},q.prototype.clone=function(){var be=new q({values:this._values?clone$2(this._values):void 0,index:clone$2(this._index),ptr:clone$2(this._ptr),size:clone$2(this._size),datatype:this._datatype});return be},q.prototype.size=function(){return this._size.slice(0)},q.prototype.map=function(be,Ee){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var Pe=this,Je=this._size[0],Ce=this._size[1],Ve=maxArgumentCount(be),Re=function(et,Ze,tt){return Ve===1?be(et):Ve===2?be(et,[Ze,tt]):be(et,[Ze,tt],Pe)};return ge(this,0,Je-1,0,Ce-1,Re,Ee)};function ge(be,Ee,Pe,Je,Ce,Ve,Re){var qe=[],et=[],Ze=[],tt=G,Ke=0;isString(be._datatype)&&(tt=N.find(G,[be._datatype,be._datatype])||G,Ke=N.convert(0,be._datatype));for(var rt=function(ft,Et,Ct){ft=Ve(ft,Et,Ct),tt(ft,Ke)||(qe.push(ft),et.push(Et))},it=Je;it<=Ce;it++){Ze.push(qe.length);var ot=be._ptr[it],ut=be._ptr[it+1];if(Re)for(var ct=ot;ct<ut;ct++){var at=be._index[ct];at>=Ee&&at<=Pe&&rt(be._values[ct],at-Ee,it-Je)}else{for(var st={},pt=ot;pt<ut;pt++){var lt=be._index[pt];st[lt]=be._values[pt]}for(var vt=Ee;vt<=Pe;vt++){var dt=vt in st?st[vt]:0;rt(dt,vt-Ee,it-Je)}}}return Ze.push(qe.length),new q({values:qe,index:et,ptr:Ze,size:[Pe-Ee+1,Ce-Je+1]})}q.prototype.forEach=function(be,Ee){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var Pe=this,Je=this._size[0],Ce=this._size[1],Ve=0;Ve<Ce;Ve++){var Re=this._ptr[Ve],qe=this._ptr[Ve+1];if(Ee)for(var et=Re;et<qe;et++){var Ze=this._index[et];be(this._values[et],[Ze,Ve],Pe)}else{for(var tt={},Ke=Re;Ke<qe;Ke++){var rt=this._index[Ke];tt[rt]=this._values[Ke]}for(var it=0;it<Je;it++){var ot=it in tt?tt[it]:0;be(ot,[it,Ve],Pe)}}}},q.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var be=this._size[1],Ee=0;Ee<be;Ee++)for(var Pe=this._ptr[Ee],Je=this._ptr[Ee+1],Ce=Pe;Ce<Je;Ce++){var Ve=this._index[Ce];yield{value:this._values[Ce],index:[Ve,Ee]}}},q.prototype.toArray=function(){return ve(this._values,this._index,this._ptr,this._size,!0)},q.prototype.valueOf=function(){return ve(this._values,this._index,this._ptr,this._size,!1)};function ve(be,Ee,Pe,Je,Ce){var Ve=Je[0],Re=Je[1],qe=[],et,Ze;for(et=0;et<Ve;et++)for(qe[et]=[],Ze=0;Ze<Re;Ze++)qe[et][Ze]=0;for(Ze=0;Ze<Re;Ze++)for(var tt=Pe[Ze],Ke=Pe[Ze+1],rt=tt;rt<Ke;rt++)et=Ee[rt],qe[et][Ze]=be?Ce?clone$2(be[rt]):be[rt]:1;return qe}return q.prototype.format=function(be){for(var Ee=this._size[0],Pe=this._size[1],Je=this.density(),Ce="Sparse Matrix ["+format(Ee,be)+" x "+format(Pe,be)+"] density: "+format(Je,be)+`
444`,Ve=0;Ve<Pe;Ve++)for(var Re=this._ptr[Ve],qe=this._ptr[Ve+1],et=Re;et<qe;et++){var Ze=this._index[et];Ce+=`
445    (`+format(Ze,be)+", "+format(Ve,be)+") ==> "+(this._values?format(this._values[et],be):"X")}return Ce},q.prototype.toString=function(){return format(this.toArray())},q.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},q.prototype.diagonal=function(be){if(be){if(isBigNumber(be)&&(be=be.toNumber()),!isNumber(be)||!isInteger(be))throw new TypeError("The parameter k must be an integer number")}else be=0;var Ee=be>0?be:0,Pe=be<0?-be:0,Je=this._size[0],Ce=this._size[1],Ve=Math.min(Je-Pe,Ce-Ee),Re=[],qe=[],et=[];et[0]=0;for(var Ze=Ee;Ze<Ce&&Re.length<Ve;Ze++)for(var tt=this._ptr[Ze],Ke=this._ptr[Ze+1],rt=tt;rt<Ke;rt++){var it=this._index[rt];if(it===Ze-Ee+Pe){Re.push(this._values[rt]),qe[Re.length-1]=it-Pe;break}}return et.push(Re.length),new q({values:Re,index:qe,ptr:et,size:[Ve,1]})},q.fromJSON=function(be){return new q(be)},q.diagonal=function(be,Ee,Pe,Je,Ce){if(!isArray(be))throw new TypeError("Array expected, size parameter");if(be.length!==2)throw new Error("Only two dimensions matrix are supported");if(be=be.map(function(lt){if(isBigNumber(lt)&&(lt=lt.toNumber()),!isNumber(lt)||!isInteger(lt)||lt<1)throw new Error("Size values must be positive integers");return lt}),Pe){if(isBigNumber(Pe)&&(Pe=Pe.toNumber()),!isNumber(Pe)||!isInteger(Pe))throw new TypeError("The parameter k must be an integer number")}else Pe=0;var Ve=G,Re=0;isString(Ce)&&(Ve=N.find(G,[Ce,Ce])||G,Re=N.convert(0,Ce));var qe=Pe>0?Pe:0,et=Pe<0?-Pe:0,Ze=be[0],tt=be[1],Ke=Math.min(Ze-et,tt-qe),rt;if(isArray(Ee)){if(Ee.length!==Ke)throw new Error("Invalid value array length");rt=function(vt){return Ee[vt]}}else if(isMatrix(Ee)){var it=Ee.size();if(it.length!==1||it[0]!==Ke)throw new Error("Invalid matrix length");rt=function(vt){return Ee.get([vt])}}else rt=function(){return Ee};for(var ot=[],ut=[],ct=[],at=0;at<tt;at++){ct.push(ot.length);var st=at-qe;if(st>=0&&st<Ke){var pt=rt(st);Ve(pt,Re)||(ut.push(st+et),ot.push(pt))}}return ct.push(ot.length),new q({values:ot,index:ut,ptr:ct,size:[Ze,tt]})},q.prototype.swapRows=function(be,Ee){if(!isNumber(be)||!isInteger(be)||!isNumber(Ee)||!isInteger(Ee))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return validateIndex(be,this._size[0]),validateIndex(Ee,this._size[0]),q._swapRows(be,Ee,this._size[1],this._values,this._index,this._ptr),this},q._forEachRow=function(be,Ee,Pe,Je,Ce){for(var Ve=Je[be],Re=Je[be+1],qe=Ve;qe<Re;qe++)Ce(Pe[qe],Ee[qe])},q._swapRows=function(be,Ee,Pe,Je,Ce,Ve){for(var Re=0;Re<Pe;Re++){var qe=Ve[Re],et=Ve[Re+1],Ze=se(be,qe,et,Ce),tt=se(Ee,qe,et,Ce);if(Ze<et&&tt<et&&Ce[Ze]===be&&Ce[tt]===Ee){if(Je){var Ke=Je[Ze];Je[Ze]=Je[tt],Je[tt]=Ke}continue}if(Ze<et&&Ce[Ze]===be&&(tt>=et||Ce[tt]!==Ee)){var rt=Je?Je[Ze]:void 0;Ce.splice(tt,0,Ee),Je&&Je.splice(tt,0,rt),Ce.splice(tt<=Ze?Ze+1:Ze,1),Je&&Je.splice(tt<=Ze?Ze+1:Ze,1);continue}if(tt<et&&Ce[tt]===Ee&&(Ze>=et||Ce[Ze]!==be)){var it=Je?Je[tt]:void 0;Ce.splice(Ze,0,be),Je&&Je.splice(Ze,0,it),Ce.splice(Ze<=tt?tt+1:tt,1),Je&&Je.splice(Ze<=tt?tt+1:tt,1)}}},q},{isClass:!0}),name$4y="number",dependencies$4x=["typed"];function getNonDecimalNumberParts(v){var N=v.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(N){var G={"0b":2,"0o":8,"0x":16}[N[1]],z=N[2],q=N[3];return{input:v,radix:G,integerPart:z,fractionalPart:q}}else return null}function makeNumberFromNonDecimalParts(v){for(var N=parseInt(v.integerPart,v.radix),G=0,z=0;z<v.fractionalPart.length;z++){var q=parseInt(v.fractionalPart[z],v.radix);G+=q/Math.pow(v.radix,z+1)}var Y=N+G;if(isNaN(Y))throw new SyntaxError('String "'+v.input+'" is no valid number');return Y}var createNumber=factory(name$4y,dependencies$4x,v=>{var{typed:N}=v,G=N("number",{"":function(){return 0},number:function(q){return q},string:function(q){if(q==="NaN")return NaN;var Y=getNonDecimalNumberParts(q);if(Y)return makeNumberFromNonDecimalParts(Y);var W=0,ie=q.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);ie&&(W=Number(ie[2]),q=ie[1]);var ne=Number(q);if(isNaN(ne))throw new SyntaxError('String "'+q+'" is no valid number');if(ie){if(ne>2**W-1)throw new SyntaxError('String "'.concat(q,'" is out of range'));ne>=2**(W-1)&&(ne=ne-2**W)}return ne},BigNumber:function(q){return q.toNumber()},Fraction:function(q){return q.valueOf()},Unit:N.referToSelf(z=>q=>{var Y=q.clone();return Y.value=z(q.value),Y}),null:function(q){return 0},"Unit, string | Unit":function(q,Y){return q.toNumber(Y)},"Array | Matrix":N.referToSelf(z=>q=>deepMap(q,z))});return G.fromJSON=function(z){return parseFloat(z.value)},G}),name$4x="string",dependencies$4w=["typed"],createString=factory(name$4x,dependencies$4w,v=>{var{typed:N}=v;return N(name$4x,{"":function(){return""},number:format$2,null:function(z){return"null"},boolean:function(z){return z+""},string:function(z){return z},"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G)),any:function(z){return String(z)}})}),name$4w="boolean",dependencies$4v=["typed"],createBoolean=factory(name$4w,dependencies$4v,v=>{var{typed:N}=v;return N(name$4w,{"":function(){return!1},boolean:function(z){return z},number:function(z){return!!z},null:function(z){return!1},BigNumber:function(z){return!z.isZero()},string:function(z){var q=z.toLowerCase();if(q==="true")return!0;if(q==="false")return!1;var Y=Number(z);if(z!==""&&!isNaN(Y))return!!Y;throw new Error('Cannot convert "'+z+'" to a boolean')},"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$4v="bignumber",dependencies$4u=["typed","BigNumber"],createBignumber=factory(name$4v,dependencies$4u,v=>{var{typed:N,BigNumber:G}=v;return N("bignumber",{"":function(){return new G(0)},number:function(q){return new G(q+"")},string:function(q){var Y=q.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(Y){var W=Y[2],ie=G(Y[1]),ne=new G(2).pow(Number(W));if(ie.gt(ne.sub(1)))throw new SyntaxError('String "'.concat(q,'" is out of range'));var se=new G(2).pow(Number(W)-1);return ie.gte(se)?ie.sub(ne):ie}return new G(q)},BigNumber:function(q){return q},Unit:N.referToSelf(z=>q=>{var Y=q.clone();return Y.value=z(q.value),Y}),Fraction:function(q){return new G(q.n).div(q.d).times(q.s)},null:function(q){return new G(0)},"Array | Matrix":N.referToSelf(z=>q=>deepMap(q,z))})}),name$4u="complex",dependencies$4t=["typed","Complex"],createComplex=factory(name$4u,dependencies$4t,v=>{var{typed:N,Complex:G}=v;return N("complex",{"":function(){return G.ZERO},number:function(q){return new G(q,0)},"number, number":function(q,Y){return new G(q,Y)},"BigNumber, BigNumber":function(q,Y){return new G(q.toNumber(),Y.toNumber())},Fraction:function(q){return new G(q.valueOf(),0)},Complex:function(q){return q.clone()},string:function(q){return G(q)},null:function(q){return G(0)},Object:function(q){if("re"in q&&"im"in q)return new G(q.re,q.im);if("r"in q&&"phi"in q||"abs"in q&&"arg"in q)return new G(q);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":N.referToSelf(z=>q=>deepMap(q,z))})}),name$4t="fraction",dependencies$4s=["typed","Fraction"],createFraction=factory(name$4t,dependencies$4s,v=>{var{typed:N,Fraction:G}=v;return N("fraction",{number:function(q){if(!isFinite(q)||isNaN(q))throw new Error(q+" cannot be represented as a fraction");return new G(q)},string:function(q){return new G(q)},"number, number":function(q,Y){return new G(q,Y)},null:function(q){return new G(0)},BigNumber:function(q){return new G(q.toString())},Fraction:function(q){return q},Unit:N.referToSelf(z=>q=>{var Y=q.clone();return Y.value=z(q.value),Y}),Object:function(q){return new G(q)},"Array | Matrix":N.referToSelf(z=>q=>deepMap(q,z))})}),name$4s="matrix",dependencies$4r=["typed","Matrix","DenseMatrix","SparseMatrix"],createMatrix=factory(name$4s,dependencies$4r,v=>{var{typed:N,Matrix:G,DenseMatrix:z,SparseMatrix:q}=v;return N(name$4s,{"":function(){return Y([])},string:function(ie){return Y([],ie)},"string, string":function(ie,ne){return Y([],ie,ne)},Array:function(ie){return Y(ie)},Matrix:function(ie){return Y(ie,ie.storage())},"Array | Matrix, string":Y,"Array | Matrix, string, string":Y});function Y(W,ie,ne){if(ie==="dense"||ie==="default"||ie===void 0)return new z(W,ne);if(ie==="sparse")return new q(W,ne);throw new TypeError("Unknown matrix type "+JSON.stringify(ie)+".")}}),name$4r="matrixFromFunction",dependencies$4q=["typed","matrix","isZero"],createMatrixFromFunction=factory(name$4r,dependencies$4q,v=>{var{typed:N,matrix:G,isZero:z}=v;return N(name$4r,{"Array | Matrix, function, string, string":function(W,ie,ne,se){return q(W,ie,ne,se)},"Array | Matrix, function, string":function(W,ie,ne){return q(W,ie,ne)},"Matrix, function":function(W,ie){return q(W,ie,"dense")},"Array, function":function(W,ie){return q(W,ie,"dense").toArray()},"Array | Matrix, string, function":function(W,ie,ne){return q(W,ne,ie)},"Array | Matrix, string, string, function":function(W,ie,ne,se){return q(W,se,ie,ne)}});function q(Y,W,ie,ne){var se;return ne!==void 0?se=G(ie,ne):se=G(ie),se.resize(Y),se.forEach(function(ae,ce){var pe=W(ce);z(pe)||se.set(ce,pe)}),se}}),name$4q="matrixFromRows",dependencies$4p=["typed","matrix","flatten","size"],createMatrixFromRows=factory(name$4q,dependencies$4p,v=>{var{typed:N,matrix:G,flatten:z,size:q}=v;return N(name$4q,{"...Array":function(ne){return Y(ne)},"...Matrix":function(ne){return G(Y(ne.map(se=>se.toArray())))}});function Y(ie){if(ie.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var ne=W(ie[0]),se=[];for(var ae of ie){var ce=W(ae);if(ce!==ne)throw new TypeError("The vectors had different length: "+(ne|0)+" ≠ "+(ce|0));se.push(z(ae))}return se}function W(ie){var ne=q(ie);if(ne.length===1)return ne[0];if(ne.length===2){if(ne[0]===1)return ne[1];if(ne[1]===1)return ne[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.")}}),name$4p="matrixFromColumns",dependencies$4o=["typed","matrix","flatten","size"],createMatrixFromColumns=factory(name$4p,dependencies$4o,v=>{var{typed:N,matrix:G,flatten:z,size:q}=v;return N(name$4p,{"...Array":function(ne){return Y(ne)},"...Matrix":function(ne){return G(Y(ne.map(se=>se.toArray())))}});function Y(ie){if(ie.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var ne=W(ie[0]),se=[],ae=0;ae<ne;ae++)se[ae]=[];for(var ce of ie){var pe=W(ce);if(pe!==ne)throw new TypeError("The vectors had different length: "+(ne|0)+" ≠ "+(pe|0));for(var ge=z(ce),ve=0;ve<ne;ve++)se[ve].push(ge[ve])}return se}function W(ie){var ne=q(ie);if(ne.length===1)return ne[0];if(ne.length===2){if(ne[0]===1)return ne[1];if(ne[1]===1)return ne[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.")}}),name$4o="splitUnit",dependencies$4n=["typed"],createSplitUnit=factory(name$4o,dependencies$4n,v=>{var{typed:N}=v;return N(name$4o,{"Unit, Array":function(z,q){return z.splitUnit(q)}})}),name$4n="unaryMinus",dependencies$4m=["typed"],createUnaryMinus=factory(name$4n,dependencies$4m,v=>{var{typed:N}=v;return N(name$4n,{number:unaryMinusNumber,"Complex | BigNumber | Fraction":G=>G.neg(),Unit:N.referToSelf(G=>z=>{var q=z.clone();return q.value=N.find(G,q.valueType())(z.value),q}),"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$4m="unaryPlus",dependencies$4l=["typed","config","BigNumber"],createUnaryPlus=factory(name$4m,dependencies$4l,v=>{var{typed:N,config:G,BigNumber:z}=v;return N(name$4m,{number:unaryPlusNumber,Complex:function(Y){return Y},BigNumber:function(Y){return Y},Fraction:function(Y){return Y},Unit:function(Y){return Y.clone()},"Array | Matrix":N.referToSelf(q=>Y=>deepMap(Y,q)),"boolean | string":function(Y){return G.number==="BigNumber"?new z(+Y):+Y}})}),name$4l="abs",dependencies$4k=["typed"],createAbs=factory(name$4l,dependencies$4k,v=>{var{typed:N}=v;return N(name$4l,{number:absNumber,"Complex | BigNumber | Fraction | Unit":G=>G.abs(),"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$4k="apply",dependencies$4j=["typed","isInteger"],createApply=factory(name$4k,dependencies$4j,v=>{var{typed:N,isInteger:G}=v;return N(name$4k,{"Array | Matrix, number | BigNumber, function":function(q,Y,W){if(!G(Y))throw new TypeError("Integer number expected for dimension");var ie=Array.isArray(q)?arraySize(q):q.size();if(Y<0||Y>=ie.length)throw new IndexError(Y,ie.length);return isMatrix(q)?q.create(_apply(q.valueOf(),Y,W)):_apply(q,Y,W)}})});function _apply(v,N,G){var z,q,Y;if(N<=0)if(Array.isArray(v[0])){for(Y=_switch(v),q=[],z=0;z<Y.length;z++)q[z]=_apply(Y[z],N-1,G);return q}else return G(v);else{for(q=[],z=0;z<v.length;z++)q[z]=_apply(v[z],N-1,G);return q}}function _switch(v){var N=v.length,G=v[0].length,z,q,Y=[];for(q=0;q<G;q++){var W=[];for(z=0;z<N;z++)W.push(v[z][q]);Y.push(W)}return Y}var name$4j="addScalar",dependencies$4i=["typed"],createAddScalar=factory(name$4j,dependencies$4i,v=>{var{typed:N}=v;return N(name$4j,{"number, number":addNumber,"Complex, Complex":function(z,q){return z.add(q)},"BigNumber, BigNumber":function(z,q){return z.plus(q)},"Fraction, Fraction":function(z,q){return z.add(q)},"Unit, Unit":N.referToSelf(G=>(z,q)=>{if(z.value===null||z.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(q.value===null||q.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!z.equalBase(q))throw new Error("Units do not match");var Y=z.clone();return Y.value=N.find(G,[Y.valueType(),q.valueType()])(Y.value,q.value),Y.fixPrefix=!1,Y})})}),name$4i="subtractScalar",dependencies$4h=["typed"],createSubtractScalar=factory(name$4i,dependencies$4h,v=>{var{typed:N}=v;return N(name$4i,{"number, number":subtractNumber,"Complex, Complex":function(z,q){return z.sub(q)},"BigNumber, BigNumber":function(z,q){return z.minus(q)},"Fraction, Fraction":function(z,q){return z.sub(q)},"Unit, Unit":N.referToSelf(G=>(z,q)=>{if(z.value===null||z.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(q.value===null||q.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!z.equalBase(q))throw new Error("Units do not match");var Y=z.clone();return Y.value=N.find(G,[Y.valueType(),q.valueType()])(Y.value,q.value),Y.fixPrefix=!1,Y})})}),name$4h="cbrt",dependencies$4g=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],createCbrt=factory(name$4h,dependencies$4g,v=>{var{config:N,typed:G,isNegative:z,unaryMinus:q,matrix:Y,Complex:W,BigNumber:ie,Fraction:ne}=v;return G(name$4h,{number:cbrtNumber,Complex:se,"Complex, boolean":se,BigNumber:function(pe){return pe.cbrt()},Unit:ae});function se(ce,pe){var ge=ce.arg()/3,ve=ce.abs(),be=new W(cbrtNumber(ve),0).mul(new W(0,ge).exp());if(pe){var Ee=[be,new W(cbrtNumber(ve),0).mul(new W(0,ge+Math.PI*2/3).exp()),new W(cbrtNumber(ve),0).mul(new W(0,ge-Math.PI*2/3).exp())];return N.matrix==="Array"?Ee:Y(Ee)}else return be}function ae(ce){if(ce.value&&isComplex(ce.value)){var pe=ce.clone();return pe.value=1,pe=pe.pow(1/3),pe.value=se(ce.value),pe}else{var ge=z(ce.value);ge&&(ce.value=q(ce.value));var ve;isBigNumber(ce.value)?ve=new ie(1).div(3):isFraction(ce.value)?ve=new ne(1,3):ve=1/3;var be=ce.pow(ve);return ge&&(be.value=q(be.value)),be}}}),name$4g="matAlgo11xS0s",dependencies$4f=["typed","equalScalar"],createMatAlgo11xS0s=factory(name$4g,dependencies$4f,v=>{var{typed:N,equalScalar:G}=v;return function(q,Y,W,ie){var ne=q._values,se=q._index,ae=q._ptr,ce=q._size,pe=q._datatype;if(!ne)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var ge=ce[0],ve=ce[1],be,Ee=G,Pe=0,Je=W;typeof pe=="string"&&(be=pe,Ee=N.find(G,[be,be]),Pe=N.convert(0,be),Y=N.convert(Y,be),Je=N.find(W,[be,be]));for(var Ce=[],Ve=[],Re=[],qe=0;qe<ve;qe++){Re[qe]=Ve.length;for(var et=ae[qe],Ze=ae[qe+1],tt=et;tt<Ze;tt++){var Ke=se[tt],rt=ie?Je(Y,ne[tt]):Je(ne[tt],Y);Ee(rt,Pe)||(Ve.push(Ke),Ce.push(rt))}}return Re[ve]=Ve.length,q.createSparseMatrix({values:Ce,index:Ve,ptr:Re,size:[ge,ve],datatype:be})}}),name$4f="matAlgo12xSfs",dependencies$4e=["typed","DenseMatrix"],createMatAlgo12xSfs=factory(name$4f,dependencies$4e,v=>{var{typed:N,DenseMatrix:G}=v;return function(q,Y,W,ie){var ne=q._values,se=q._index,ae=q._ptr,ce=q._size,pe=q._datatype;if(!ne)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var ge=ce[0],ve=ce[1],be,Ee=W;typeof pe=="string"&&(be=pe,Y=N.convert(Y,be),Ee=N.find(W,[be,be]));for(var Pe=[],Je=[],Ce=[],Ve=0;Ve<ve;Ve++){for(var Re=Ve+1,qe=ae[Ve],et=ae[Ve+1],Ze=qe;Ze<et;Ze++){var tt=se[Ze];Je[tt]=ne[Ze],Ce[tt]=Re}for(var Ke=0;Ke<ge;Ke++)Ve===0&&(Pe[Ke]=[]),Ce[Ke]===Re?Pe[Ke][Ve]=ie?Ee(Y,Je[Ke]):Ee(Je[Ke],Y):Pe[Ke][Ve]=ie?Ee(Y,0):Ee(0,Y)}return new G({data:Pe,size:[ge,ve],datatype:be})}}),name$4e="matAlgo14xDs",dependencies$4d=["typed"],createMatAlgo14xDs=factory(name$4e,dependencies$4d,v=>{var{typed:N}=v;return function(q,Y,W,ie){var ne=q._data,se=q._size,ae=q._datatype,ce,pe=W;typeof ae=="string"&&(ce=ae,Y=N.convert(Y,ce),pe=N.find(W,[ce,ce]));var ge=se.length>0?G(pe,0,se,se[0],ne,Y,ie):[];return q.createDenseMatrix({data:ge,size:clone$2(se),datatype:ce})};function G(z,q,Y,W,ie,ne,se){var ae=[];if(q===Y.length-1)for(var ce=0;ce<W;ce++)ae[ce]=se?z(ne,ie[ce]):z(ie[ce],ne);else for(var pe=0;pe<W;pe++)ae[pe]=G(z,q+1,Y,Y[q+1],ie[pe],ne,se);return ae}}),name$4d="ceil",dependencies$4c=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],createCeilNumber=factory(name$4d,["typed","config","round"],v=>{var{typed:N,config:G,round:z}=v;return N(name$4d,{number:function(Y){return nearlyEqual$1(Y,z(Y),G.epsilon)?z(Y):Math.ceil(Y)},"number, number":function(Y,W){if(nearlyEqual$1(Y,z(Y,W),G.epsilon))return z(Y,W);var[ie,ne]="".concat(Y,"e").split("e"),se=Math.ceil(Number("".concat(ie,"e").concat(Number(ne)+W)));return[ie,ne]="".concat(se,"e").split("e"),Number("".concat(ie,"e").concat(Number(ne)-W))}})}),createCeil=factory(name$4d,dependencies$4c,v=>{var{typed:N,config:G,round:z,matrix:q,equalScalar:Y,zeros:W,DenseMatrix:ie}=v,ne=createMatAlgo11xS0s({typed:N,equalScalar:Y}),se=createMatAlgo12xSfs({typed:N,DenseMatrix:ie}),ae=createMatAlgo14xDs({typed:N}),ce=createCeilNumber({typed:N,config:G,round:z});return N("ceil",{number:ce.signatures.number,"number,number":ce.signatures["number,number"],Complex:function(ge){return ge.ceil()},"Complex, number":function(ge,ve){return ge.ceil(ve)},"Complex, BigNumber":function(ge,ve){return ge.ceil(ve.toNumber())},BigNumber:function(ge){return nearlyEqual(ge,z(ge),G.epsilon)?z(ge):ge.ceil()},"BigNumber, BigNumber":function(ge,ve){return nearlyEqual(ge,z(ge,ve),G.epsilon)?z(ge,ve):ge.toDecimalPlaces(ve.toNumber(),Decimal.ROUND_CEIL)},Fraction:function(ge){return ge.ceil()},"Fraction, number":function(ge,ve){return ge.ceil(ve)},"Fraction, BigNumber":function(ge,ve){return ge.ceil(ve.toNumber())},"Array | Matrix":N.referToSelf(pe=>ge=>deepMap(ge,pe)),"Array, number | BigNumber":N.referToSelf(pe=>(ge,ve)=>deepMap(ge,be=>pe(be,ve))),"SparseMatrix, number | BigNumber":N.referToSelf(pe=>(ge,ve)=>ne(ge,ve,pe,!1)),"DenseMatrix, number | BigNumber":N.referToSelf(pe=>(ge,ve)=>ae(ge,ve,pe,!1)),"number | Complex | Fraction | BigNumber, Array":N.referToSelf(pe=>(ge,ve)=>ae(q(ve),ge,pe,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":N.referToSelf(pe=>(ge,ve)=>Y(ge,0)?W(ve.size(),ve.storage()):ve.storage()==="dense"?ae(ve,ge,pe,!0):se(ve,ge,pe,!0))})}),name$4c="cube",dependencies$4b=["typed"],createCube=factory(name$4c,dependencies$4b,v=>{var{typed:N}=v;return N(name$4c,{number:cubeNumber,Complex:function(z){return z.mul(z).mul(z)},BigNumber:function(z){return z.times(z).times(z)},Fraction:function(z){return z.pow(3)},Unit:function(z){return z.pow(3)}})}),name$4b="exp",dependencies$4a=["typed"],createExp=factory(name$4b,dependencies$4a,v=>{var{typed:N}=v;return N(name$4b,{number:expNumber,Complex:function(z){return z.exp()},BigNumber:function(z){return z.exp()}})}),name$4a="expm1",dependencies$49=["typed","Complex"],createExpm1=factory(name$4a,dependencies$49,v=>{var{typed:N,Complex:G}=v;return N(name$4a,{number:expm1Number,Complex:function(q){var Y=Math.exp(q.re);return new G(Y*Math.cos(q.im)-1,Y*Math.sin(q.im))},BigNumber:function(q){return q.exp().minus(1)}})}),name$49="fix",dependencies$48=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],createFixNumber=factory(name$49,["typed","ceil","floor"],v=>{var{typed:N,ceil:G,floor:z}=v;return N(name$49,{number:function(Y){return Y>0?z(Y):G(Y)},"number, number":function(Y,W){return Y>0?z(Y,W):G(Y,W)}})}),createFix=factory(name$49,dependencies$48,v=>{var{typed:N,Complex:G,matrix:z,ceil:q,floor:Y,equalScalar:W,zeros:ie,DenseMatrix:ne}=v,se=createMatAlgo12xSfs({typed:N,DenseMatrix:ne}),ae=createMatAlgo14xDs({typed:N}),ce=createFixNumber({typed:N,ceil:q,floor:Y});return N("fix",{number:ce.signatures.number,"number, number | BigNumber":ce.signatures["number,number"],Complex:function(ge){return new G(ge.re>0?Math.floor(ge.re):Math.ceil(ge.re),ge.im>0?Math.floor(ge.im):Math.ceil(ge.im))},"Complex, number":function(ge,ve){return new G(ge.re>0?Y(ge.re,ve):q(ge.re,ve),ge.im>0?Y(ge.im,ve):q(ge.im,ve))},"Complex, BigNumber":function(ge,ve){var be=ve.toNumber();return new G(ge.re>0?Y(ge.re,be):q(ge.re,be),ge.im>0?Y(ge.im,be):q(ge.im,be))},BigNumber:function(ge){return ge.isNegative()?q(ge):Y(ge)},"BigNumber, number | BigNumber":function(ge,ve){return ge.isNegative()?q(ge,ve):Y(ge,ve)},Fraction:function(ge){return ge.s<0?ge.ceil():ge.floor()},"Fraction, number | BigNumber":function(ge,ve){return ge.s<0?q(ge,ve):Y(ge,ve)},"Array | Matrix":N.referToSelf(pe=>ge=>deepMap(ge,pe)),"Array | Matrix, number | BigNumber":N.referToSelf(pe=>(ge,ve)=>deepMap(ge,be=>pe(be,ve))),"number | Complex | Fraction | BigNumber, Array":N.referToSelf(pe=>(ge,ve)=>ae(z(ve),ge,pe,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":N.referToSelf(pe=>(ge,ve)=>W(ge,0)?ie(ve.size(),ve.storage()):ve.storage()==="dense"?ae(ve,ge,pe,!0):se(ve,ge,pe,!0))})}),name$48="floor",dependencies$47=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],createFloorNumber=factory(name$48,["typed","config","round"],v=>{var{typed:N,config:G,round:z}=v;return N(name$48,{number:function(Y){return nearlyEqual$1(Y,z(Y),G.epsilon)?z(Y):Math.floor(Y)},"number, number":function(Y,W){if(nearlyEqual$1(Y,z(Y,W),G.epsilon))return z(Y,W);var[ie,ne]="".concat(Y,"e").split("e"),se=Math.floor(Number("".concat(ie,"e").concat(Number(ne)+W)));return[ie,ne]="".concat(se,"e").split("e"),Number("".concat(ie,"e").concat(Number(ne)-W))}})}),createFloor=factory(name$48,dependencies$47,v=>{var{typed:N,config:G,round:z,matrix:q,equalScalar:Y,zeros:W,DenseMatrix:ie}=v,ne=createMatAlgo11xS0s({typed:N,equalScalar:Y}),se=createMatAlgo12xSfs({typed:N,DenseMatrix:ie}),ae=createMatAlgo14xDs({typed:N}),ce=createFloorNumber({typed:N,config:G,round:z});return N("floor",{number:ce.signatures.number,"number,number":ce.signatures["number,number"],Complex:function(ge){return ge.floor()},"Complex, number":function(ge,ve){return ge.floor(ve)},"Complex, BigNumber":function(ge,ve){return ge.floor(ve.toNumber())},BigNumber:function(ge){return nearlyEqual(ge,z(ge),G.epsilon)?z(ge):ge.floor()},"BigNumber, BigNumber":function(ge,ve){return nearlyEqual(ge,z(ge,ve),G.epsilon)?z(ge,ve):ge.toDecimalPlaces(ve.toNumber(),Decimal.ROUND_FLOOR)},Fraction:function(ge){return ge.floor()},"Fraction, number":function(ge,ve){return ge.floor(ve)},"Fraction, BigNumber":function(ge,ve){return ge.floor(ve.toNumber())},"Array | Matrix":N.referToSelf(pe=>ge=>deepMap(ge,pe)),"Array, number | BigNumber":N.referToSelf(pe=>(ge,ve)=>deepMap(ge,be=>pe(be,ve))),"SparseMatrix, number | BigNumber":N.referToSelf(pe=>(ge,ve)=>ne(ge,ve,pe,!1)),"DenseMatrix, number | BigNumber":N.referToSelf(pe=>(ge,ve)=>ae(ge,ve,pe,!1)),"number | Complex | Fraction | BigNumber, Array":N.referToSelf(pe=>(ge,ve)=>ae(q(ve),ge,pe,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":N.referToSelf(pe=>(ge,ve)=>Y(ge,0)?W(ve.size(),ve.storage()):ve.storage()==="dense"?ae(ve,ge,pe,!0):se(ve,ge,pe,!0))})}),name$47="matAlgo02xDS0",dependencies$46=["typed","equalScalar"],createMatAlgo02xDS0=factory(name$47,dependencies$46,v=>{var{typed:N,equalScalar:G}=v;return function(q,Y,W,ie){var ne=q._data,se=q._size,ae=q._datatype,ce=Y._values,pe=Y._index,ge=Y._ptr,ve=Y._size,be=Y._datatype;if(se.length!==ve.length)throw new DimensionError(se.length,ve.length);if(se[0]!==ve[0]||se[1]!==ve[1])throw new RangeError("Dimension mismatch. Matrix A ("+se+") must match Matrix B ("+ve+")");if(!ce)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var Ee=se[0],Pe=se[1],Je,Ce=G,Ve=0,Re=W;typeof ae=="string"&&ae===be&&(Je=ae,Ce=N.find(G,[Je,Je]),Ve=N.convert(0,Je),Re=N.find(W,[Je,Je]));for(var qe=[],et=[],Ze=[],tt=0;tt<Pe;tt++){Ze[tt]=et.length;for(var Ke=ge[tt],rt=ge[tt+1],it=Ke;it<rt;it++){var ot=pe[it],ut=ie?Re(ce[it],ne[ot][tt]):Re(ne[ot][tt],ce[it]);Ce(ut,Ve)||(et.push(ot),qe.push(ut))}}return Ze[Pe]=et.length,Y.createSparseMatrix({values:qe,index:et,ptr:Ze,size:[Ee,Pe],datatype:Je})}}),name$46="matAlgo03xDSf",dependencies$45=["typed"],createMatAlgo03xDSf=factory(name$46,dependencies$45,v=>{var{typed:N}=v;return function(z,q,Y,W){var ie=z._data,ne=z._size,se=z._datatype,ae=q._values,ce=q._index,pe=q._ptr,ge=q._size,ve=q._datatype;if(ne.length!==ge.length)throw new DimensionError(ne.length,ge.length);if(ne[0]!==ge[0]||ne[1]!==ge[1])throw new RangeError("Dimension mismatch. Matrix A ("+ne+") must match Matrix B ("+ge+")");if(!ae)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var be=ne[0],Ee=ne[1],Pe,Je=0,Ce=Y;typeof se=="string"&&se===ve&&(Pe=se,Je=N.convert(0,Pe),Ce=N.find(Y,[Pe,Pe]));for(var Ve=[],Re=0;Re<be;Re++)Ve[Re]=[];for(var qe=[],et=[],Ze=0;Ze<Ee;Ze++){for(var tt=Ze+1,Ke=pe[Ze],rt=pe[Ze+1],it=Ke;it<rt;it++){var ot=ce[it];qe[ot]=W?Ce(ae[it],ie[ot][Ze]):Ce(ie[ot][Ze],ae[it]),et[ot]=tt}for(var ut=0;ut<be;ut++)et[ut]===tt?Ve[ut][Ze]=qe[ut]:Ve[ut][Ze]=W?Ce(Je,ie[ut][Ze]):Ce(ie[ut][Ze],Je)}return z.createDenseMatrix({data:Ve,size:[be,Ee],datatype:Pe})}}),name$45="matAlgo05xSfSf",dependencies$44=["typed","equalScalar"],createMatAlgo05xSfSf=factory(name$45,dependencies$44,v=>{var{typed:N,equalScalar:G}=v;return function(q,Y,W){var ie=q._values,ne=q._index,se=q._ptr,ae=q._size,ce=q._datatype,pe=Y._values,ge=Y._index,ve=Y._ptr,be=Y._size,Ee=Y._datatype;if(ae.length!==be.length)throw new DimensionError(ae.length,be.length);if(ae[0]!==be[0]||ae[1]!==be[1])throw new RangeError("Dimension mismatch. Matrix A ("+ae+") must match Matrix B ("+be+")");var Pe=ae[0],Je=ae[1],Ce,Ve=G,Re=0,qe=W;typeof ce=="string"&&ce===Ee&&(Ce=ce,Ve=N.find(G,[Ce,Ce]),Re=N.convert(0,Ce),qe=N.find(W,[Ce,Ce]));var et=ie&&pe?[]:void 0,Ze=[],tt=[],Ke=et?[]:void 0,rt=et?[]:void 0,it=[],ot=[],ut,ct,at,st;for(ct=0;ct<Je;ct++){tt[ct]=Ze.length;var pt=ct+1;for(at=se[ct],st=se[ct+1];at<st;at++)ut=ne[at],Ze.push(ut),it[ut]=pt,Ke&&(Ke[ut]=ie[at]);for(at=ve[ct],st=ve[ct+1];at<st;at++)ut=ge[at],it[ut]!==pt&&Ze.push(ut),ot[ut]=pt,rt&&(rt[ut]=pe[at]);if(et)for(at=tt[ct];at<Ze.length;){ut=Ze[at];var lt=it[ut],vt=ot[ut];if(lt===pt||vt===pt){var dt=lt===pt?Ke[ut]:Re,xt=vt===pt?rt[ut]:Re,ft=qe(dt,xt);Ve(ft,Re)?Ze.splice(at,1):(et.push(ft),at++)}}}return tt[Je]=Ze.length,q.createSparseMatrix({values:et,index:Ze,ptr:tt,size:[Pe,Je],datatype:Ce})}}),name$44="matAlgo13xDD",dependencies$43=["typed"],createMatAlgo13xDD=factory(name$44,dependencies$43,v=>{var{typed:N}=v;return function(q,Y,W){var ie=q._data,ne=q._size,se=q._datatype,ae=Y._data,ce=Y._size,pe=Y._datatype,ge=[];if(ne.length!==ce.length)throw new DimensionError(ne.length,ce.length);for(var ve=0;ve<ne.length;ve++){if(ne[ve]!==ce[ve])throw new RangeError("Dimension mismatch. Matrix A ("+ne+") must match Matrix B ("+ce+")");ge[ve]=ne[ve]}var be,Ee=W;typeof se=="string"&&se===pe&&(be=se,Ee=N.find(W,[be,be]));var Pe=ge.length>0?G(Ee,0,ge,ge[0],ie,ae):[];return q.createDenseMatrix({data:Pe,size:ge,datatype:be})};function G(z,q,Y,W,ie,ne){var se=[];if(q===Y.length-1)for(var ae=0;ae<W;ae++)se[ae]=z(ie[ae],ne[ae]);else for(var ce=0;ce<W;ce++)se[ce]=G(z,q+1,Y,Y[q+1],ie[ce],ne[ce]);return se}}),name$43="broadcast",dependancies=["concat"],createBroadcast=factory(name$43,dependancies,v=>{var{concat:N}=v;return function(q,Y){var W=Math.max(q._size.length,Y._size.length);if(q._size.length===Y._size.length&&q._size.every((ve,be)=>ve===Y._size[be]))return[q,Y];for(var ie=G(q._size,W,0),ne=G(Y._size,W,0),se=[],ae=0;ae<W;ae++)se[ae]=Math.max(ie[ae],ne[ae]);checkBroadcastingRules(ie,se),checkBroadcastingRules(ne,se);var ce=q.clone(),pe=Y.clone();ce._size.length<W?ce.reshape(G(ce._size,W,1)):pe._size.length<W&&pe.reshape(G(pe._size,W,1));for(var ge=0;ge<W;ge++)ce._size[ge]<se[ge]&&(ce=z(ce,se[ge],ge)),pe._size[ge]<se[ge]&&(pe=z(pe,se[ge],ge));return[ce,pe]};function G(q,Y,W){return[...Array(Y-q.length).fill(W),...q]}function z(q,Y,W){return N(...Array(Y).fill(q),W)}}),name$42="matrixAlgorithmSuite",dependencies$42=["typed","matrix","concat"],createMatrixAlgorithmSuite=factory(name$42,dependencies$42,v=>{var{typed:N,matrix:G,concat:z}=v,q=createMatAlgo13xDD({typed:N}),Y=createMatAlgo14xDs({typed:N}),W=createBroadcast({concat:z});return function(ne){var se=ne.elop,ae=ne.SD||ne.DS,ce;se?(ce={"DenseMatrix, DenseMatrix":(be,Ee)=>q(...W(be,Ee),se),"Array, Array":(be,Ee)=>q(...W(G(be),G(Ee)),se).valueOf(),"Array, DenseMatrix":(be,Ee)=>q(...W(G(be),Ee),se),"DenseMatrix, Array":(be,Ee)=>q(...W(be,G(Ee)),se)},ne.SS&&(ce["SparseMatrix, SparseMatrix"]=(be,Ee)=>ne.SS(...W(be,Ee),se,!1)),ne.DS&&(ce["DenseMatrix, SparseMatrix"]=(be,Ee)=>ne.DS(...W(be,Ee),se,!1),ce["Array, SparseMatrix"]=(be,Ee)=>ne.DS(...W(G(be),Ee),se,!1)),ae&&(ce["SparseMatrix, DenseMatrix"]=(be,Ee)=>ae(...W(Ee,be),se,!0),ce["SparseMatrix, Array"]=(be,Ee)=>ae(...W(G(Ee),be),se,!0))):(ce={"DenseMatrix, DenseMatrix":N.referToSelf(be=>(Ee,Pe)=>q(...W(Ee,Pe),be)),"Array, Array":N.referToSelf(be=>(Ee,Pe)=>q(...W(G(Ee),G(Pe)),be).valueOf()),"Array, DenseMatrix":N.referToSelf(be=>(Ee,Pe)=>q(...W(G(Ee),Pe),be)),"DenseMatrix, Array":N.referToSelf(be=>(Ee,Pe)=>q(...W(Ee,G(Pe)),be))},ne.SS&&(ce["SparseMatrix, SparseMatrix"]=N.referToSelf(be=>(Ee,Pe)=>ne.SS(...W(Ee,Pe),be,!1))),ne.DS&&(ce["DenseMatrix, SparseMatrix"]=N.referToSelf(be=>(Ee,Pe)=>ne.DS(...W(Ee,Pe),be,!1)),ce["Array, SparseMatrix"]=N.referToSelf(be=>(Ee,Pe)=>ne.DS(...W(G(Ee),Pe),be,!1))),ae&&(ce["SparseMatrix, DenseMatrix"]=N.referToSelf(be=>(Ee,Pe)=>ae(...W(Pe,Ee),be,!0)),ce["SparseMatrix, Array"]=N.referToSelf(be=>(Ee,Pe)=>ae(...W(G(Pe),Ee),be,!0))));var pe=ne.scalar||"any",ge=ne.Ds||ne.Ss;ge&&(se?(ce["DenseMatrix,"+pe]=(be,Ee)=>Y(be,Ee,se,!1),ce[pe+", DenseMatrix"]=(be,Ee)=>Y(Ee,be,se,!0),ce["Array,"+pe]=(be,Ee)=>Y(G(be),Ee,se,!1).valueOf(),ce[pe+", Array"]=(be,Ee)=>Y(G(Ee),be,se,!0).valueOf()):(ce["DenseMatrix,"+pe]=N.referToSelf(be=>(Ee,Pe)=>Y(Ee,Pe,be,!1)),ce[pe+", DenseMatrix"]=N.referToSelf(be=>(Ee,Pe)=>Y(Pe,Ee,be,!0)),ce["Array,"+pe]=N.referToSelf(be=>(Ee,Pe)=>Y(G(Ee),Pe,be,!1).valueOf()),ce[pe+", Array"]=N.referToSelf(be=>(Ee,Pe)=>Y(G(Pe),Ee,be,!0).valueOf())));var ve=ne.sS!==void 0?ne.sS:ne.Ss;return se?(ne.Ss&&(ce["SparseMatrix,"+pe]=(be,Ee)=>ne.Ss(be,Ee,se,!1)),ve&&(ce[pe+", SparseMatrix"]=(be,Ee)=>ve(Ee,be,se,!0))):(ne.Ss&&(ce["SparseMatrix,"+pe]=N.referToSelf(be=>(Ee,Pe)=>ne.Ss(Ee,Pe,be,!1))),ve&&(ce[pe+", SparseMatrix"]=N.referToSelf(be=>(Ee,Pe)=>ve(Pe,Ee,be,!0)))),se&&se.signatures&&extend(ce,se.signatures),ce}}
445),name$41="mod",dependencies$41=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],createMod=factory(name$41,dependencies$41,v=>{var{typed:N,config:G,round:z,matrix:q,equalScalar:Y,zeros:W,DenseMatrix:ie,concat:ne}=v,se=createFloor({typed:N,config:G,round:z,matrix:q,equalScalar:Y,zeros:W,DenseMatrix:ie}),ae=createMatAlgo02xDS0({typed:N,equalScalar:Y}),ce=createMatAlgo03xDSf({typed:N}),pe=createMatAlgo05xSfSf({typed:N,equalScalar:Y}),ge=createMatAlgo11xS0s({typed:N,equalScalar:Y}),ve=createMatAlgo12xSfs({typed:N,DenseMatrix:ie}),be=createMatrixAlgorithmSuite({typed:N,matrix:q,concat:ne});return N(name$41,{"number, number":Ee,"BigNumber, BigNumber":function(Je,Ce){if(Ce.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return Ce.isZero()?Je:Je.mod(Ce)},"Fraction, Fraction":function(Je,Ce){if(Ce.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return Je.compare(0)>=0?Je.mod(Ce):Je.mod(Ce).add(Ce).mod(Ce)}},be({SS:pe,DS:ce,SD:ae,Ss:ge,sS:ve}));function Ee(Pe,Je){return Je===0?Pe:Pe-Je*se(Pe/Je)}}),name$40="matAlgo01xDSid",dependencies$40=["typed"],createMatAlgo01xDSid=factory(name$40,dependencies$40,v=>{var{typed:N}=v;return function(z,q,Y,W){var ie=z._data,ne=z._size,se=z._datatype,ae=q._values,ce=q._index,pe=q._ptr,ge=q._size,ve=q._datatype;if(ne.length!==ge.length)throw new DimensionError(ne.length,ge.length);if(ne[0]!==ge[0]||ne[1]!==ge[1])throw new RangeError("Dimension mismatch. Matrix A ("+ne+") must match Matrix B ("+ge+")");if(!ae)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var be=ne[0],Ee=ne[1],Pe=typeof se=="string"&&se===ve?se:void 0,Je=Pe?N.find(Y,[Pe,Pe]):Y,Ce,Ve,Re=[];for(Ce=0;Ce<be;Ce++)Re[Ce]=[];var qe=[],et=[];for(Ve=0;Ve<Ee;Ve++){for(var Ze=Ve+1,tt=pe[Ve],Ke=pe[Ve+1],rt=tt;rt<Ke;rt++)Ce=ce[rt],qe[Ce]=W?Je(ae[rt],ie[Ce][Ve]):Je(ie[Ce][Ve],ae[rt]),et[Ce]=Ze;for(Ce=0;Ce<be;Ce++)et[Ce]===Ze?Re[Ce][Ve]=qe[Ce]:Re[Ce][Ve]=ie[Ce][Ve]}return z.createDenseMatrix({data:Re,size:[be,Ee],datatype:Pe})}}),name$3$="matAlgo04xSidSid",dependencies$3$=["typed","equalScalar"],
vendor: 68,313 bytes, line 445
445createMatAlgo04xSidSid=factory(name$3$,dependencies$3$,v=>{var{typed:N,equalScalar:G}=v;return function(q,Y,W){var ie=q._values,ne=q._index,se=q._ptr,ae=q._size,ce=q._datatype,pe=Y._values,ge=Y._index,ve=Y._ptr,be=Y._size,Ee=Y._datatype;if(ae.length!==be.length)throw new DimensionError(ae.length,be.length);if(ae[0]!==be[0]||ae[1]!==be[1])throw new RangeError("Dimension mismatch. Matrix A ("+ae+") must match Matrix B ("+be+")");var Pe=ae[0],Je=ae[1],Ce,Ve=G,Re=0,qe=W;typeof ce=="string"&&ce===Ee&&(Ce=ce,Ve=N.find(G,[Ce,Ce]),Re=N.convert(0,Ce),qe=N.find(W,[Ce,Ce]));var et=ie&&pe?[]:void 0,Ze=[],tt=[],Ke=ie&&pe?[]:void 0,rt=ie&&pe?[]:void 0,it=[],ot=[],ut,ct,at,st,pt;for(ct=0;ct<Je;ct++){tt[ct]=Ze.length;var lt=ct+1;for(st=se[ct],pt=se[ct+1],at=st;at<pt;at++)ut=ne[at],Ze.push(ut),it[ut]=lt,Ke&&(Ke[ut]=ie[at]);for(st=ve[ct],pt=ve[ct+1],at=st;at<pt;at++)if(ut=ge[at],it[ut]===lt){if(Ke){var vt=qe(Ke[ut],pe[at]);Ve(vt,Re)?it[ut]=null:Ke[ut]=vt}}else Ze.push(ut),ot[ut]=lt,rt&&(rt[ut]=pe[at]);if(Ke&&rt)for(at=tt[ct];at<Ze.length;)ut=Ze[at],it[ut]===lt?(et[at]=Ke[ut],at++):ot[ut]===lt?(et[at]=rt[ut],at++):Ze.splice(at,1)}return tt[Je]=Ze.length,q.createSparseMatrix({values:et,index:Ze,ptr:tt,size:[Pe,Je],datatype:Ce})}}),name$3_="matAlgo10xSids",dependencies$3_=["typed","DenseMatrix"],createMatAlgo10xSids=factory(name$3_,dependencies$3_,v=>{var{typed:N,DenseMatrix:G}=v;return function(q,Y,W,ie){var ne=q._values,se=q._index,ae=q._ptr,ce=q._size,pe=q._datatype;if(!ne)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var ge=ce[0],ve=ce[1],be,Ee=W;typeof pe=="string"&&(be=pe,Y=N.convert(Y,be),Ee=N.find(W,[be,be]));for(var Pe=[],Je=[],Ce=[],Ve=0;Ve<ve;Ve++){for(var Re=Ve+1,qe=ae[Ve],et=ae[Ve+1],Ze=qe;Ze<et;Ze++){var tt=se[Ze];Je[tt]=ne[Ze],Ce[tt]=Re}for(var Ke=0;Ke<ge;Ke++)Ve===0&&(Pe[Ke]=[]),Ce[Ke]===Re?Pe[Ke][Ve]=ie?Ee(Y,Je[Ke]):Ee(Je[Ke],Y):Pe[Ke][Ve]=Y}return new G({data:Pe,size:[ge,ve],datatype:be})}});function ArgumentsError(v,N,G,z){if(!(this instanceof ArgumentsError))throw new SyntaxError("Constructor must be called with the new operator");this.fn=v,this.count=N,this.min=G,this.max=z,this.message="Wrong number of arguments in function "+v+" ("+N+" provided, "+G+(z!=null?"-"+z:"")+" expected)",this.stack=new Error().stack}ArgumentsError.prototype=new Error;ArgumentsError.prototype.constructor=Error;ArgumentsError.prototype.name="ArgumentsError";ArgumentsError.prototype.isArgumentsError=!0;var name$3Z="gcd",dependencies$3Z=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],gcdTypes="number | BigNumber | Fraction | Matrix | Array",gcdManyTypesSignature="".concat(gcdTypes,", ").concat(gcdTypes,", ...").concat(gcdTypes);function is1d(v){return!v.some(N=>Array.isArray(N))}var createGcd=factory(name$3Z,dependencies$3Z,v=>{var{typed:N,matrix:G,config:z,round:q,equalScalar:Y,zeros:W,BigNumber:ie,DenseMatrix:ne,concat:se}=v,ae=createMod({typed:N,config:z,round:q,matrix:G,equalScalar:Y,zeros:W,DenseMatrix:ne,concat:se}),ce=createMatAlgo01xDSid({typed:N}),pe=createMatAlgo04xSidSid({typed:N,equalScalar:Y}),ge=createMatAlgo10xSids({typed:N,DenseMatrix:ne}),ve=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:se});return N(name$3Z,{"number, number":be,"BigNumber, BigNumber":Ee,"Fraction, Fraction":(Pe,Je)=>Pe.gcd(Je)},ve({SS:pe,DS:ce,Ss:ge}),{[gcdManyTypesSignature]:N.referToSelf(Pe=>(Je,Ce,Ve)=>{for(var Re=Pe(Je,Ce),qe=0;qe<Ve.length;qe++)Re=Pe(Re,Ve[qe]);return Re}),Array:N.referToSelf(Pe=>Je=>{if(Je.length===1&&Array.isArray(Je[0])&&is1d(Je[0]))return Pe(...Je[0]);if(is1d(Je))return Pe(...Je);throw new ArgumentsError("gcd() supports only 1d matrices!")}),Matrix:N.referToSelf(Pe=>Je=>Pe(Je.toArray()))});function be(Pe,Je){if(!isInteger(Pe)||!isInteger(Je))throw new Error("Parameters in function gcd must be integer numbers");for(var Ce;Je!==0;)Ce=ae(Pe,Je),Pe=Je,Je=Ce;return Pe<0?-Pe:Pe}function Ee(Pe,Je){if(!Pe.isInt()||!Je.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var Ce=new ie(0);!Je.isZero();){var Ve=ae(Pe,Je);Pe=Je,Je=Ve}return Pe.lt(Ce)?Pe.neg():Pe}}),name$3Y="matAlgo06xS0S0",dependencies$3Y=["typed","equalScalar"],createMatAlgo06xS0S0=factory(name$3Y,dependencies$3Y,v=>{var{typed:N,equalScalar:G}=v;return function(q,Y,W){var ie=q._values,ne=q._size,se=q._datatype,ae=Y._values,ce=Y._size,pe=Y._datatype;if(ne.length!==ce.length)throw new DimensionError(ne.length,ce.length);if(ne[0]!==ce[0]||ne[1]!==ce[1])throw new RangeError("Dimension mismatch. Matrix A ("+ne+") must match Matrix B ("+ce+")");var ge=ne[0],ve=ne[1],be,Ee=G,Pe=0,Je=W;typeof se=="string"&&se===pe&&(be=se,Ee=N.find(G,[be,be]),Pe=N.convert(0,be),Je=N.find(W,[be,be]));for(var Ce=ie&&ae?[]:void 0,Ve=[],Re=[],qe=Ce?[]:void 0,et=[],Ze=[],tt=0;tt<ve;tt++){Re[tt]=Ve.length;var Ke=tt+1;if(scatter(q,tt,et,qe,Ze,Ke,Ve,Je),scatter(Y,tt,et,qe,Ze,Ke,Ve,Je),qe)for(var rt=Re[tt];rt<Ve.length;){var it=Ve[rt];if(Ze[it]===Ke){var ot=qe[it];Ee(ot,Pe)?Ve.splice(rt,1):(Ce.push(ot),rt++)}else Ve.splice(rt,1)}else for(var ut=Re[tt];ut<Ve.length;){var ct=Ve[ut];Ze[ct]!==Ke?Ve.splice(ut,1):ut++}}return Re[ve]=Ve.length,q.createSparseMatrix({values:Ce,index:Ve,ptr:Re,size:[ge,ve],datatype:be})}}),name$3X="lcm",dependencies$3X=["typed","matrix","equalScalar","concat"],createLcm=factory(name$3X,dependencies$3X,v=>{var{typed:N,matrix:G,equalScalar:z,concat:q}=v,Y=createMatAlgo02xDS0({typed:N,equalScalar:z}),W=createMatAlgo06xS0S0({typed:N,equalScalar:z}),ie=createMatAlgo11xS0s({typed:N,equalScalar:z}),ne=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:q}),se="number | BigNumber | Fraction | Matrix | Array",ae={};return ae["".concat(se,", ").concat(se,", ...").concat(se)]=N.referToSelf(pe=>(ge,ve,be)=>{for(var Ee=pe(ge,ve),Pe=0;Pe<be.length;Pe++)Ee=pe(Ee,be[Pe]);return Ee}),N(name$3X,{"number, number":lcmNumber,"BigNumber, BigNumber":ce,"Fraction, Fraction":(pe,ge)=>pe.lcm(ge)},ne({SS:W,DS:Y,Ss:ie}),ae);function ce(pe,ge){if(!pe.isInt()||!ge.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(pe.isZero())return pe;if(ge.isZero())return ge;for(var ve=pe.times(ge);!ge.isZero();){var be=ge;ge=pe.mod(be),pe=be}return ve.div(pe).abs()}}),name$3W="log10",dependencies$3W=["typed","config","Complex"],createLog10=factory(name$3W,dependencies$3W,v=>{var{typed:N,config:G,Complex:z}=v;return N(name$3W,{number:function(Y){return Y>=0||G.predictable?log10Number(Y):new z(Y,0).log().div(Math.LN10)},Complex:function(Y){return new z(Y).log().div(Math.LN10)},BigNumber:function(Y){return!Y.isNegative()||G.predictable?Y.log():new z(Y.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":N.referToSelf(q=>Y=>deepMap(Y,q))})}),name$3V="log2",dependencies$3V=["typed","config","Complex"],createLog2=factory(name$3V,dependencies$3V,v=>{var{typed:N,config:G,Complex:z}=v;return N(name$3V,{number:function(W){return W>=0||G.predictable?log2Number(W):q(new z(W,0))},Complex:q,BigNumber:function(W){return!W.isNegative()||G.predictable?W.log(2):q(new z(W.toNumber(),0))},"Array | Matrix":N.referToSelf(Y=>W=>deepMap(W,Y))});function q(Y){var W=Math.sqrt(Y.re*Y.re+Y.im*Y.im);return new z(Math.log2?Math.log2(W):Math.log(W)/Math.LN2,Math.atan2(Y.im,Y.re)/Math.LN2)}}),name$3U="multiplyScalar",dependencies$3U=["typed"],createMultiplyScalar=factory(name$3U,dependencies$3U,v=>{var{typed:N}=v;return N("multiplyScalar",{"number, number":multiplyNumber,"Complex, Complex":function(z,q){return z.mul(q)},"BigNumber, BigNumber":function(z,q){return z.times(q)},"Fraction, Fraction":function(z,q){return z.mul(q)},"number | Fraction | BigNumber | Complex, Unit":(G,z)=>z.multiply(G),"Unit, number | Fraction | BigNumber | Complex | Unit":(G,z)=>G.multiply(z)})}),name$3T="multiply",dependencies$3T=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],createMultiply=factory(name$3T,dependencies$3T,v=>{var{typed:N,matrix:G,addScalar:z,multiplyScalar:q,equalScalar:Y,dot:W}=v,ie=createMatAlgo11xS0s({typed:N,equalScalar:Y}),ne=createMatAlgo14xDs({typed:N});function se(Re,qe){switch(Re.length){case 1:switch(qe.length){case 1:if(Re[0]!==qe[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(Re[0]!==qe[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+Re[0]+") must match Matrix rows ("+qe[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+qe.length+" dimensions)")}break;case 2:switch(qe.length){case 1:if(Re[1]!==qe[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+Re[1]+") must match Vector length ("+qe[0]+")");break;case 2:if(Re[1]!==qe[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+Re[1]+") must match Matrix B rows ("+qe[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+qe.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+Re.length+" dimensions)")}}function ae(Re,qe,et){if(et===0)throw new Error("Cannot multiply two empty vectors");return W(Re,qe)}function ce(Re,qe){if(qe.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return pe(Re,qe)}function pe(Re,qe){var et=Re._data,Ze=Re._size,tt=Re._datatype,Ke=qe._data,rt=qe._size,it=qe._datatype,ot=Ze[0],ut=rt[1],ct,at=z,st=q;tt&&it&&tt===it&&typeof tt=="string"&&(ct=tt,at=N.find(z,[ct,ct]),st=N.find(q,[ct,ct]));for(var pt=[],lt=0;lt<ut;lt++){for(var vt=st(et[0],Ke[0][lt]),dt=1;dt<ot;dt++)vt=at(vt,st(et[dt],Ke[dt][lt]));pt[lt]=vt}return Re.createDenseMatrix({data:pt,size:[ut],datatype:ct})}var ge=N("_multiplyMatrixVector",{"DenseMatrix, any":be,"SparseMatrix, any":Je}),ve=N("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":Ee,"DenseMatrix, SparseMatrix":Pe,"SparseMatrix, DenseMatrix":Ce,"SparseMatrix, SparseMatrix":Ve});function be(Re,qe){var et=Re._data,Ze=Re._size,tt=Re._datatype,Ke=qe._data,rt=qe._datatype,it=Ze[0],ot=Ze[1],ut,ct=z,at=q;tt&&rt&&tt===rt&&typeof tt=="string"&&(ut=tt,ct=N.find(z,[ut,ut]),at=N.find(q,[ut,ut]));for(var st=[],pt=0;pt<it;pt++){for(var lt=et[pt],vt=at(lt[0],Ke[0]),dt=1;dt<ot;dt++)vt=ct(vt,at(lt[dt],Ke[dt]));st[pt]=vt}return Re.createDenseMatrix({data:st,size:[it],datatype:ut})}function Ee(Re,qe){var et=Re._data,Ze=Re._size,tt=Re._datatype,Ke=qe._data,rt=qe._size,it=qe._datatype,ot=Ze[0],ut=Ze[1],ct=rt[1],at,st=z,pt=q;tt&&it&&tt===it&&typeof tt=="string"&&(at=tt,st=N.find(z,[at,at]),pt=N.find(q,[at,at]));for(var lt=[],vt=0;vt<ot;vt++){var dt=et[vt];lt[vt]=[];for(var xt=0;xt<ct;xt++){for(var ft=pt(dt[0],Ke[0][xt]),Et=1;Et<ut;Et++)ft=st(ft,pt(dt[Et],Ke[Et][xt]));lt[vt][xt]=ft}}return Re.createDenseMatrix({data:lt,size:[ot,ct],datatype:at})}function Pe(Re,qe){var et=Re._data,Ze=Re._size,tt=Re._datatype,Ke=qe._values,rt=qe._index,it=qe._ptr,ot=qe._size,ut=qe._datatype;if(!Ke)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var ct=Ze[0],at=ot[1],st,pt=z,lt=q,vt=Y,dt=0;tt&&ut&&tt===ut&&typeof tt=="string"&&(st=tt,pt=N.find(z,[st,st]),lt=N.find(q,[st,st]),vt=N.find(Y,[st,st]),dt=N.convert(0,st));for(var xt=[],ft=[],Et=[],Ct=qe.createSparseMatrix({values:xt,index:ft,ptr:Et,size:[ct,at],datatype:st}),Dt=0;Dt<at;Dt++){Et[Dt]=ft.length;var Gt=it[Dt],Ot=it[Dt+1];if(Ot>Gt)for(var It=0,Bt=0;Bt<ct;Bt++){for(var Ht=Bt+1,ir=void 0,zt=Gt;zt<Ot;zt++){var tr=rt[zt];It!==Ht?(ir=lt(et[Bt][tr],Ke[zt]),It=Ht):ir=pt(ir,lt(et[Bt][tr],Ke[zt]))}It===Ht&&!vt(ir,dt)&&(ft.push(Bt),xt.push(ir))}}return Et[at]=ft.length,Ct}function Je(Re,qe){var et=Re._values,Ze=Re._index,tt=Re._ptr,Ke=Re._datatype;if(!et)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var rt=qe._data,it=qe._datatype,ot=Re._size[0],ut=qe._size[0],ct=[],at=[],st=[],pt,lt=z,vt=q,dt=Y,xt=0;Ke&&it&&Ke===it&&typeof Ke=="string"&&(pt=Ke,lt=N.find(z,[pt,pt]),vt=N.find(q,[pt,pt]),dt=N.find(Y,[pt,pt]),xt=N.convert(0,pt));var ft=[],Et=[];st[0]=0;for(var Ct=0;Ct<ut;Ct++){var Dt=rt[Ct];if(!dt(Dt,xt))for(var Gt=tt[Ct],Ot=tt[Ct+1],It=Gt;It<Ot;It++){var Bt=Ze[It];Et[Bt]?ft[Bt]=lt(ft[Bt],vt(Dt,et[It])):(Et[Bt]=!0,at.push(Bt),ft[Bt]=vt(Dt,et[It]))}}for(var Ht=at.length,ir=0;ir<Ht;ir++){var zt=at[ir];ct[ir]=ft[zt]}return st[1]=at.length,Re.createSparseMatrix({values:ct,index:at,ptr:st,size:[ot,1],datatype:pt})}function Ce(Re,qe){var et=Re._values,Ze=Re._index,tt=Re._ptr,Ke=Re._datatype;if(!et)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var rt=qe._data,it=qe._datatype,ot=Re._size[0],ut=qe._size[0],ct=qe._size[1],at,st=z,pt=q,lt=Y,vt=0;Ke&&it&&Ke===it&&typeof Ke=="string"&&(at=Ke,st=N.find(z,[at,at]),pt=N.find(q,[at,at]),lt=N.find(Y,[at,at]),vt=N.convert(0,at));for(var dt=[],xt=[],ft=[],Et=Re.createSparseMatrix({values:dt,index:xt,ptr:ft,size:[ot,ct],datatype:at}),Ct=[],Dt=[],Gt=0;Gt<ct;Gt++){ft[Gt]=xt.length;for(var Ot=Gt+1,It=0;It<ut;It++){var Bt=rt[It][Gt];if(!lt(Bt,vt))for(var Ht=tt[It],ir=tt[It+1],zt=Ht;zt<ir;zt++){var tr=Ze[zt];Dt[tr]!==Ot?(Dt[tr]=Ot,xt.push(tr),Ct[tr]=pt(Bt,et[zt])):Ct[tr]=st(Ct[tr],pt(Bt,et[zt]))}}for(var bt=ft[Gt],_t=xt.length,Xt=bt;Xt<_t;Xt++){var At=xt[Xt];dt[Xt]=Ct[At]}}return ft[ct]=xt.length,Et}function Ve(Re,qe){var et=Re._values,Ze=Re._index,tt=Re._ptr,Ke=Re._datatype,rt=qe._values,it=qe._index,ot=qe._ptr,ut=qe._datatype,ct=Re._size[0],at=qe._size[1],st=et&&rt,pt,lt=z,vt=q;Ke&&ut&&Ke===ut&&typeof Ke=="string"&&(pt=Ke,lt=N.find(z,[pt,pt]),vt=N.find(q,[pt,pt]));for(var dt=st?[]:void 0,xt=[],ft=[],Et=Re.createSparseMatrix({values:dt,index:xt,ptr:ft,size:[ct,at],datatype:pt}),Ct=st?[]:void 0,Dt=[],Gt,Ot,It,Bt,Ht,ir,zt,tr,bt=0;bt<at;bt++){ft[bt]=xt.length;var _t=bt+1;for(Ht=ot[bt],ir=ot[bt+1],Bt=Ht;Bt<ir;Bt++)if(tr=it[Bt],st)for(Ot=tt[tr],It=tt[tr+1],Gt=Ot;Gt<It;Gt++)zt=Ze[Gt],Dt[zt]!==_t?(Dt[zt]=_t,xt.push(zt),Ct[zt]=vt(rt[Bt],et[Gt])):Ct[zt]=lt(Ct[zt],vt(rt[Bt],et[Gt]));else for(Ot=tt[tr],It=tt[tr+1],Gt=Ot;Gt<It;Gt++)zt=Ze[Gt],Dt[zt]!==_t&&(Dt[zt]=_t,xt.push(zt));if(st)for(var Xt=ft[bt],At=xt.length,$t=Xt;$t<At;$t++){var Pt=xt[$t];dt[$t]=Ct[Pt]}}return ft[at]=xt.length,Et}return N(name$3T,q,{"Array, Array":N.referTo("Matrix, Matrix",Re=>(qe,et)=>{se(arraySize(qe),arraySize(et));var Ze=Re(G(qe),G(et));return isMatrix(Ze)?Ze.valueOf():Ze}),"Matrix, Matrix":function(qe,et){var Ze=qe.size(),tt=et.size();return se(Ze,tt),Ze.length===1?tt.length===1?ae(qe,et,Ze[0]):ce(qe,et):tt.length===1?ge(qe,et):ve(qe,et)},"Matrix, Array":N.referTo("Matrix,Matrix",Re=>(qe,et)=>Re(qe,G(et))),"Array, Matrix":N.referToSelf(Re=>(qe,et)=>Re(G(qe,et.storage()),et)),"SparseMatrix, any":function(qe,et){return ie(qe,et,q,!1)},"DenseMatrix, any":function(qe,et){return ne(qe,et,q,!1)},"any, SparseMatrix":function(qe,et){return ie(et,qe,q,!0)},"any, DenseMatrix":function(qe,et){return ne(et,qe,q,!0)},"Array, any":function(qe,et){return ne(G(qe),et,q,!1).valueOf()},"any, Array":function(qe,et){return ne(G(et),qe,q,!0).valueOf()},"any, any":q,"any, any, ...any":N.referToSelf(Re=>(qe,et,Ze)=>{for(var tt=Re(qe,et),Ke=0;Ke<Ze.length;Ke++)tt=Re(tt,Ze[Ke]);return tt})})}),name$3S="nthRoot",dependencies$3S=["typed","matrix","equalScalar","BigNumber","concat"],createNthRoot=factory(name$3S,dependencies$3S,v=>{var{typed:N,matrix:G,equalScalar:z,BigNumber:q,concat:Y}=v,W=createMatAlgo01xDSid({typed:N}),ie=createMatAlgo02xDS0({typed:N,equalScalar:z}),ne=createMatAlgo06xS0S0({typed:N,equalScalar:z}),se=createMatAlgo11xS0s({typed:N,equalScalar:z}),ae=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:Y});function ce(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return N(name$3S,{number:nthRootNumber,"number, number":nthRootNumber,BigNumber:ge=>pe(ge,new q(2)),"BigNumber, BigNumber":pe,Complex:ce,"Complex, number":ce,Array:N.referTo("DenseMatrix,number",ge=>ve=>ge(G(ve),2).valueOf()),DenseMatrix:N.referTo("DenseMatrix,number",ge=>ve=>ge(ve,2)),SparseMatrix:N.referTo("SparseMatrix,number",ge=>ve=>ge(ve,2)),"SparseMatrix, SparseMatrix":N.referToSelf(ge=>(ve,be)=>{if(be.density()===1)return ne(ve,be,ge);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":N.referToSelf(ge=>(ve,be)=>{if(be.density()===1)return W(ve,be,ge,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":N.referTo("DenseMatrix,SparseMatrix",ge=>(ve,be)=>ge(G(ve),be)),"number | BigNumber, SparseMatrix":N.referToSelf(ge=>(ve,be)=>{if(be.density()===1)return se(be,ve,ge,!0);throw new Error("Root must be non-zero")})},ae({scalar:"number | BigNumber",SD:ie,Ss:se,sS:!1}));function pe(ge,ve){var be=q.precision,Ee=q.clone({precision:be+2}),Pe=new q(0),Je=new Ee(1),Ce=ve.isNegative();if(Ce&&(ve=ve.neg()),ve.isZero())throw new Error("Root must be non-zero");if(ge.isNegative()&&!ve.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(ge.isZero())return Ce?new Ee(1/0):0;if(!ge.isFinite())return Ce?Pe:ge;var Ve=ge.abs().pow(Je.div(ve));return Ve=ge.isNeg()?Ve.neg():Ve,new q((Ce?Je.div(Ve):Ve).toPrecision(be))}}),name$3R="sign",dependencies$3R=["typed","BigNumber","Fraction","complex"],createSign=factory(name$3R,dependencies$3R,v=>{var{typed:N,BigNumber:G,complex:z,Fraction:q}=v;return N(name$3R,{number:signNumber,Complex:function(W){return W.im===0?z(signNumber(W.re)):W.sign()},BigNumber:function(W){return new G(W.cmp(0))},Fraction:function(W){return new q(W.s,1)},"Array | Matrix":N.referToSelf(Y=>W=>deepMap(W,Y)),Unit:N.referToSelf(Y=>W=>{if(!W._isDerived()&&W.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return N.find(Y,W.valueType())(W.value)})})}),name$3Q="sqrt",dependencies$3Q=["config","typed","Complex"],createSqrt=factory(name$3Q,dependencies$3Q,v=>{var{config:N,typed:G,Complex:z}=v;return G("sqrt",{number:q,Complex:function(W){return W.sqrt()},BigNumber:function(W){return!W.isNegative()||N.predictable?W.sqrt():q(W.toNumber())},Unit:function(W){return W.pow(.5)}});function q(Y){return isNaN(Y)?NaN:Y>=0||N.predictable?Math.sqrt(Y):new z(Y,0).sqrt()}}),name$3P="square",dependencies$3P=["typed"],createSquare=factory(name$3P,dependencies$3P,v=>{var{typed:N}=v;return N(name$3P,{number:squareNumber,Complex:function(z){return z.mul(z)},BigNumber:function(z){return z.times(z)},Fraction:function(z){return z.mul(z)},Unit:function(z){return z.pow(2)}})}),name$3O="subtract",dependencies$3O=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],createSubtract=factory(name$3O,dependencies$3O,v=>{var{typed:N,matrix:G,equalScalar:z,subtractScalar:q,unaryMinus:Y,DenseMatrix:W,concat:ie}=v,ne=createMatAlgo01xDSid({typed:N}),se=createMatAlgo03xDSf({typed:N}),ae=createMatAlgo05xSfSf({typed:N,equalScalar:z}),ce=createMatAlgo10xSids({typed:N,DenseMatrix:W}),pe=createMatAlgo12xSfs({typed:N,DenseMatrix:W}),ge=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:ie});return N(name$3O,{"any, any":q},ge({elop:q,SS:ae,DS:ne,SD:se,Ss:pe,sS:ce}))}),name$3N="xgcd",dependencies$3N=["typed","config","matrix","BigNumber"],createXgcd=factory(name$3N,dependencies$3N,v=>{var{typed:N,config:G,matrix:z,BigNumber:q}=v;return N(name$3N,{"number, number":function(ie,ne){var se=xgcdNumber(ie,ne);return G.matrix==="Array"?se:z(se)},"BigNumber, BigNumber":Y});function Y(W,ie){var ne,se,ae,ce=new q(0),pe=new q(1),ge=ce,ve=pe,be=pe,Ee=ce;if(!W.isInt()||!ie.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!ie.isZero();)se=W.div(ie).floor(),ae=W.mod(ie),ne=ge,ge=ve.minus(se.times(ge)),ve=ne,ne=be,be=Ee.minus(se.times(be)),Ee=ne,W=ie,ie=ae;var Pe;return W.lt(ce)?Pe=[W.neg(),ve.neg(),Ee.neg()]:Pe=[W,W.isZero()?0:ve,Ee],G.matrix==="Array"?Pe:z(Pe)}}),name$3M="invmod",dependencies$3M=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],createInvmod=factory(name$3M,dependencies$3M,v=>{var{typed:N,config:G,BigNumber:z,xgcd:q,equal:Y,smaller:W,mod:ie,add:ne,isInteger:se}=v;return N(name$3M,{"number, number":ae,"BigNumber, BigNumber":ae});function ae(ce,pe){if(!se(ce)||!se(pe))throw new Error("Parameters in function invmod must be integer numbers");if(ce=ie(ce,pe),Y(pe,0))throw new Error("Divisor must be non zero");var ge=q(ce,pe);ge=ge.valueOf();var[ve,be]=ge;return Y(ve,z(1))?(be=ie(be,pe),W(be,z(0))&&(be=ne(be,pe)),be):NaN}}),name$3L="matAlgo09xS0Sf",dependencies$3L=["typed","equalScalar"],createMatAlgo09xS0Sf=factory(name$3L,dependencies$3L,v=>{var{typed:N,equalScalar:G}=v;return function(q,Y,W){var ie=q._values,ne=q._index,se=q._ptr,ae=q._size,ce=q._datatype,pe=Y._values,ge=Y._index,ve=Y._ptr,be=Y._size,Ee=Y._datatype;if(ae.length!==be.length)throw new DimensionError(ae.length,be.length);if(ae[0]!==be[0]||ae[1]!==be[1])throw new RangeError("Dimension mismatch. Matrix A ("+ae+") must match Matrix B ("+be+")");var Pe=ae[0],Je=ae[1],Ce,Ve=G,Re=0,qe=W;typeof ce=="string"&&ce===Ee&&(Ce=ce,Ve=N.find(G,[Ce,Ce]),Re=N.convert(0,Ce),qe=N.find(W,[Ce,Ce]));var et=ie&&pe?[]:void 0,Ze=[],tt=[],Ke=et?[]:void 0,rt=[],it,ot,ut,ct,at;for(ot=0;ot<Je;ot++){tt[ot]=Ze.length;var st=ot+1;if(Ke)for(ct=ve[ot],at=ve[ot+1],ut=ct;ut<at;ut++)it=ge[ut],rt[it]=st,Ke[it]=pe[ut];for(ct=se[ot],at=se[ot+1],ut=ct;ut<at;ut++)if(it=ne[ut],Ke){var pt=rt[it]===st?Ke[it]:Re,lt=qe(ie[ut],pt);Ve(lt,Re)||(Ze.push(it),et.push(lt))}else Ze.push(it)}return tt[Je]=Ze.length,q.createSparseMatrix({values:et,index:Ze,ptr:tt,size:[Pe,Je],datatype:Ce})}}),name$3K="dotMultiply",dependencies$3K=["typed","matrix","equalScalar","multiplyScalar","concat"],createDotMultiply=factory(name$3K,dependencies$3K,v=>{var{typed:N,matrix:G,equalScalar:z,multiplyScalar:q,concat:Y}=v,W=createMatAlgo02xDS0({typed:N,equalScalar:z}),ie=createMatAlgo09xS0Sf({typed:N,equalScalar:z}),ne=createMatAlgo11xS0s({typed:N,equalScalar:z}),se=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:Y});return N(name$3K,se({elop:q,SS:ie,DS:W,Ss:ne}))});function bitAndBigNumber(v,N){if(v.isFinite()&&!v.isInteger()||N.isFinite()&&!N.isInteger())throw new Error("Integers expected in function bitAnd");var G=v.constructor;if(v.isNaN()||N.isNaN())return new G(NaN);if(v.isZero()||N.eq(-1)||v.eq(N))return v;if(N.isZero()||v.eq(-1))return N;if(!v.isFinite()||!N.isFinite()){if(!v.isFinite()&&!N.isFinite())return v.isNegative()===N.isNegative()?v:new G(0);if(!v.isFinite())return N.isNegative()?v:v.isNegative()?new G(0):N;if(!N.isFinite())return v.isNegative()?N:N.isNegative()?new G(0):v}return bitwise(v,N,function(z,q){return z&q})}function bitNotBigNumber(v){if(v.isFinite()&&!v.isInteger())throw new Error("Integer expected in function bitNot");var N=v.constructor,G=N.precision;N.config({precision:1e9});var z=v.plus(new N(1));return z.s=-z.s||null,N.config({precision:G}),z}function bitOrBigNumber(v,N){if(v.isFinite()&&!v.isInteger()||N.isFinite()&&!N.isInteger())throw new Error("Integers expected in function bitOr");var G=v.constructor;if(v.isNaN()||N.isNaN())return new G(NaN);var z=new G(-1);return v.isZero()||N.eq(z)||v.eq(N)?N:N.isZero()||v.eq(z)?v:!v.isFinite()||!N.isFinite()?!v.isFinite()&&!v.isNegative()&&N.isNegative()||v.isNegative()&&!N.isNegative()&&!N.isFinite()?z:v.isNegative()&&N.isNegative()?v.isFinite()?v:N:v.isFinite()?N:v:bitwise(v,N,function(q,Y){return q|Y})}function bitwise(v,N,G){var z=v.constructor,q,Y,W=+(v.s<0),ie=+(N.s<0);if(W){q=decCoefficientToBinaryString(bitNotBigNumber(v));for(var ne=0;ne<q.length;++ne)q[ne]^=1}else q=decCoefficientToBinaryString(v);if(ie){Y=decCoefficientToBinaryString(bitNotBigNumber(N));for(var se=0;se<Y.length;++se)Y[se]^=1}else Y=decCoefficientToBinaryString(N);var ae,ce,pe;q.length<=Y.length?(ae=q,ce=Y,pe=W):(ae=Y,ce=q,pe=ie);var ge=ae.length,ve=ce.length,be=G(W,ie)^1,Ee=new z(be^1),Pe=new z(1),Je=new z(2),Ce=z.precision;for(z.config({precision:1e9});ge>0;)G(ae[--ge],ce[--ve])===be&&(Ee=Ee.plus(Pe)),Pe=Pe.times(Je);for(;ve>0;)G(pe,ce[--ve])===be&&(Ee=Ee.plus(Pe)),Pe=Pe.times(Je);return z.config({precision:Ce}),be===0&&(Ee.s=-Ee.s),Ee}function decCoefficientToBinaryString(v){for(var N=v.d,G=N[0]+"",z=1;z<N.length;++z){for(var q=N[z]+"",Y=7-q.length;Y--;)q="0"+q;G+=q}for(var W=G.length;G.charAt(W)==="0";)W--;var ie=v.e,ne=G.slice(0,W+1||1),se=ne.length;if(ie>0)if(++ie>se)for(ie-=se;ie--;)ne+="0";else ie<se&&(ne=ne.slice(0,ie)+"."+ne.slice(ie));for(var ae=[0],ce=0;ce<ne.length;){for(var pe=ae.length;pe--;)ae[pe]*=10;ae[0]+=parseInt(ne.charAt(ce++));for(var ge=0;ge<ae.length;++ge)ae[ge]>1&&((ae[ge+1]===null||ae[ge+1]===void 0)&&(ae[ge+1]=0),ae[ge+1]+=ae[ge]>>1,ae[ge]&=1)}return ae.reverse()}function bitXor(v,N){if(v.isFinite()&&!v.isInteger()||N.isFinite()&&!N.isInteger())throw new Error("Integers expected in function bitXor");var G=v.constructor;if(v.isNaN()||N.isNaN())return new G(NaN);if(v.isZero())return N;if(N.isZero())return v;if(v.eq(N))return new G(0);var z=new G(-1);return v.eq(z)?bitNotBigNumber(N):N.eq(z)?bitNotBigNumber(v):!v.isFinite()||!N.isFinite()?!v.isFinite()&&!N.isFinite()?z:new G(v.isNegative()===N.isNegative()?1/0:-1/0):bitwise(v,N,function(q,Y){return q^Y})}function leftShiftBigNumber(v,N){if(v.isFinite()&&!v.isInteger()||N.isFinite()&&!N.isInteger())throw new Error("Integers expected in function leftShift");var G=v.constructor;return v.isNaN()||N.isNaN()||N.isNegative()&&!N.isZero()?new G(NaN):v.isZero()||N.isZero()?v:!v.isFinite()&&!N.isFinite()?new G(NaN):N.lt(55)?v.times(Math.pow(2,N.toNumber())+""):v.times(new G(2).pow(N))}function rightArithShiftBigNumber(v,N){if(v.isFinite()&&!v.isInteger()||N.isFinite()&&!N.isInteger())throw new Error("Integers expected in function rightArithShift");var G=v.constructor;return v.isNaN()||N.isNaN()||N.isNegative()&&!N.isZero()?new G(NaN):v.isZero()||N.isZero()?v:N.isFinite()?N.lt(55)?v.div(Math.pow(2,N.toNumber())+"").floor():v.div(new G(2).pow(N)).floor():v.isNegative()?new G(-1):v.isFinite()?new G(0):new G(NaN)}var name$3J="bitAnd",dependencies$3J=["typed","matrix","equalScalar","concat"],createBitAnd=factory(name$3J,dependencies$3J,v=>{var{typed:N,matrix:G,equalScalar:z,concat:q}=v,Y=createMatAlgo02xDS0({typed:N,equalScalar:z}),W=createMatAlgo06xS0S0({typed:N,equalScalar:z}),ie=createMatAlgo11xS0s({typed:N,equalScalar:z}),ne=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:q});return N(name$3J,{"number, number":bitAndNumber,"BigNumber, BigNumber":bitAndBigNumber},ne({SS:W,DS:Y,Ss:ie}))}),name$3I="bitNot",dependencies$3I=["typed"],createBitNot=factory(name$3I,dependencies$3I,v=>{var{typed:N}=v;return N(name$3I,{number:bitNotNumber,BigNumber:bitNotBigNumber,"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$3H="bitOr",dependencies$3H=["typed","matrix","equalScalar","DenseMatrix","concat"],createBitOr=factory(name$3H,dependencies$3H,v=>{var{typed:N,matrix:G,equalScalar:z,DenseMatrix:q,concat:Y}=v,W=createMatAlgo01xDSid({typed:N}),ie=createMatAlgo04xSidSid({typed:N,equalScalar:z}),ne=createMatAlgo10xSids({typed:N,DenseMatrix:q}),se=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:Y});return N(name$3H,{"number, number":bitOrNumber,"BigNumber, BigNumber":bitOrBigNumber},se({SS:ie,DS:W,Ss:ne}))}),name$3G="matAlgo07xSSf",dependencies$3G=["typed","DenseMatrix"],createMatAlgo07xSSf=factory(name$3G,dependencies$3G,v=>{var{typed:N,DenseMatrix:G}=v;return function(Y,W,ie){var ne=Y._size,se=Y._datatype,ae=W._size,ce=W._datatype;if(ne.length!==ae.length)throw new DimensionError(ne.length,ae.length);if(ne[0]!==ae[0]||ne[1]!==ae[1])throw new RangeError("Dimension mismatch. Matrix A ("+ne+") must match Matrix B ("+ae+")");var pe=ne[0],ge=ne[1],ve,be=0,Ee=ie;typeof se=="string"&&se===ce&&(ve=se,be=N.convert(0,ve),Ee=N.find(ie,[ve,ve]));var Pe,Je,Ce=[];for(Pe=0;Pe<pe;Pe++)Ce[Pe]=[];var Ve=[],Re=[],qe=[],et=[];for(Je=0;Je<ge;Je++){var Ze=Je+1;for(z(Y,Je,qe,Ve,Ze),z(W,Je,et,Re,Ze),Pe=0;Pe<pe;Pe++){var tt=qe[Pe]===Ze?Ve[Pe]:be,Ke=et[Pe]===Ze?Re[Pe]:be;Ce[Pe][Je]=Ee(tt,Ke)}}return new G({data:Ce,size:[pe,ge],datatype:ve})};function z(q,Y,W,ie,ne){for(var se=q._values,ae=q._index,ce=q._ptr,pe=ce[Y],ge=ce[Y+1];pe<ge;pe++){var ve=ae[pe];W[ve]=ne,ie[ve]=se[pe]}}}),name$3F="bitXor",dependencies$3F=["typed","matrix","DenseMatrix","concat"],createBitXor=factory(name$3F,dependencies$3F,v=>{var{typed:N,matrix:G,DenseMatrix:z,concat:q}=v,Y=createMatAlgo03xDSf({typed:N}),W=createMatAlgo07xSSf({typed:N,DenseMatrix:z}),ie=createMatAlgo12xSfs({typed:N,DenseMatrix:z}),ne=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:q});return N(name$3F,{"number, number":bitXorNumber,"BigNumber, BigNumber":bitXor},ne({SS:W,DS:Y,Ss:ie}))}),name$3E="arg",dependencies$3E=["typed"],createArg=factory(name$3E,dependencies$3E,v=>{var{typed:N}=v;return N(name$3E,{number:function(z){return Math.atan2(0,z)},BigNumber:function(z){return z.constructor.atan2(0,z)},Complex:function(z){return z.arg()},"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$3D="conj",dependencies$3D=["typed"],createConj=factory(name$3D,dependencies$3D,v=>{var{typed:N}=v;return N(name$3D,{"number | BigNumber | Fraction":G=>G,Complex:G=>G.conjugate(),"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$3C="im",dependencies$3C=["typed"],createIm=factory(name$3C,dependencies$3C,v=>{var{typed:N}=v;return N(name$3C,{number:()=>0,"BigNumber | Fraction":G=>G.mul(0),Complex:G=>G.im,"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$3B="re",dependencies$3B=["typed"],createRe=factory(name$3B,dependencies$3B,v=>{var{typed:N}=v;return N(name$3B,{"number | BigNumber | Fraction":G=>G,Complex:G=>G.re,"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$3A="not",dependencies$3A=["typed"],createNot=factory(name$3A,dependencies$3A,v=>{var{typed:N}=v;return N(name$3A,{"null | undefined":()=>!0,number:notNumber,Complex:function(z){return z.re===0&&z.im===0},BigNumber:function(z){return z.isZero()||z.isNaN()},Unit:N.referToSelf(G=>z=>N.find(G,z.valueType())(z.value)),"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$3z="or",dependencies$3z=["typed","matrix","equalScalar","DenseMatrix","concat"],createOr=factory(name$3z,dependencies$3z,v=>{var{typed:N,matrix:G,equalScalar:z,DenseMatrix:q,concat:Y}=v,W=createMatAlgo03xDSf({typed:N}),ie=createMatAlgo05xSfSf({typed:N,equalScalar:z}),ne=createMatAlgo12xSfs({typed:N,DenseMatrix:q}),se=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:Y});return N(name$3z,{"number, number":orNumber,"Complex, Complex":function(ce,pe){return ce.re!==0||ce.im!==0||pe.re!==0||pe.im!==0},"BigNumber, BigNumber":function(ce,pe){return!ce.isZero()&&!ce.isNaN()||!pe.isZero()&&!pe.isNaN()},"Unit, Unit":N.referToSelf(ae=>(ce,pe)=>ae(ce.value||0,pe.value||0))},se({SS:ie,DS:W,Ss:ne}))}),name$3y="xor",dependencies$3y=["typed","matrix","DenseMatrix","concat"],createXor=factory(name$3y,dependencies$3y,v=>{var{typed:N,matrix:G,DenseMatrix:z,concat:q}=v,Y=createMatAlgo03xDSf({typed:N}),W=createMatAlgo07xSSf({typed:N,DenseMatrix:z}),ie=createMatAlgo12xSfs({typed:N,DenseMatrix:z}),ne=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:q});return N(name$3y,{"number, number":xorNumber,"Complex, Complex":function(ae,ce){return(ae.re!==0||ae.im!==0)!=(ce.re!==0||ce.im!==0)},"BigNumber, BigNumber":function(ae,ce){return(!ae.isZero()&&!ae.isNaN())!=(!ce.isZero()&&!ce.isNaN())},"Unit, Unit":N.referToSelf(se=>(ae,ce)=>se(ae.value||0,ce.value||0))},ne({SS:W,DS:Y,Ss:ie}))}),name$3x="concat",dependencies$3x=["typed","matrix","isInteger"],createConcat=factory(name$3x,dependencies$3x,v=>{var{typed:N,matrix:G,isInteger:z}=v;return N(name$3x,{"...Array | Matrix | number | BigNumber":function(Y){var W,ie=Y.length,ne=-1,se,ae=!1,ce=[];for(W=0;W<ie;W++){var pe=Y[W];if(isMatrix(pe)&&(ae=!0),isNumber(pe)||isBigNumber(pe)){if(W!==ie-1)throw new Error("Dimension must be specified as last argument");if(se=ne,ne=pe.valueOf(),!z(ne))throw new TypeError("Integer number expected for dimension");if(ne<0||W>0&&ne>se)throw new IndexError(ne,se+1)}else{var ge=clone$2(pe).valueOf(),ve=arraySize(ge);if(ce[W]=ge,se=ne,ne=ve.length-1,W>0&&ne!==se)throw new DimensionError(se+1,ne+1)}}if(ce.length===0)throw new SyntaxError("At least one matrix expected");for(var be=ce.shift();ce.length;)be=concat(be,ce.shift(),ne);return ae?G(be):be},"...string":function(Y){return Y.join("")}})}),name$3w="column",dependencies$3w=["typed","Index","matrix","range"],createColumn=factory(name$3w,dependencies$3w,v=>{var{typed:N,Index:G,matrix:z,range:q}=v;return N(name$3w,{"Matrix, number":Y,"Array, number":function(ie,ne){return Y(z(clone$2(ie)),ne).valueOf()}});function Y(W,ie){if(W.size().length!==2)throw new Error("Only two dimensional matrix is supported");validateIndex(ie,W.size()[1]);var ne=q(0,W.size()[0]),se=new G(ne,ie),ae=W.subset(se);return isMatrix(ae)?ae:z([[ae]])}}),name$3v="count",dependencies$3v=["typed","size","prod"],createCount=factory(name$3v,dependencies$3v,v=>{var{typed:N,size:G,prod:z}=v;return N(name$3v,{string:function(Y){return Y.length},"Matrix | Array":function(Y){return z(G(Y))}})}),name$3u="cross",dependencies$3u=["typed","matrix","subtract","multiply"],createCross=factory(name$3u,dependencies$3u,v=>{var{typed:N,matrix:G,subtract:z,multiply:q}=v;return N(name$3u,{"Matrix, Matrix":function(ie,ne){return G(Y(ie.toArray(),ne.toArray()))},"Matrix, Array":function(ie,ne){return G(Y(ie.toArray(),ne))},"Array, Matrix":function(ie,ne){return G(Y(ie,ne.toArray()))},"Array, Array":Y});function Y(W,ie){var ne=Math.max(arraySize(W).length,arraySize(ie).length);W=squeeze(W),ie=squeeze(ie);var se=arraySize(W),ae=arraySize(ie);if(se.length!==1||ae.length!==1||se[0]!==3||ae[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+se.join(", ")+"], B = ["+ae.join(", ")+"])");var ce=[z(q(W[1],ie[2]),q(W[2],ie[1])),z(q(W[2],ie[0]),q(W[0],ie[2])),z(q(W[0],ie[1]),q(W[1],ie[0]))];return ne>1?[ce]:ce}}),name$3t="diag",dependencies$3t=["typed","matrix","DenseMatrix","SparseMatrix"],createDiag=factory(name$3t,dependencies$3t,v=>{var{typed:N,matrix:G,DenseMatrix:z,SparseMatrix:q}=v;return N(name$3t,{Array:function(se){return Y(se,0,arraySize(se),null)},"Array, number":function(se,ae){return Y(se,ae,arraySize(se),null)},"Array, BigNumber":function(se,ae){return Y(se,ae.toNumber(),arraySize(se),null)},"Array, string":function(se,ae){return Y(se,0,arraySize(se),ae)},"Array, number, string":function(se,ae,ce){return Y(se,ae,arraySize(se),ce)},"Array, BigNumber, string":function(se,ae,ce){return Y(se,ae.toNumber(),arraySize(se),ce)},Matrix:function(se){return Y(se,0,se.size(),se.storage())},"Matrix, number":function(se,ae){return Y(se,ae,se.size(),se.storage())},"Matrix, BigNumber":function(se,ae){return Y(se,ae.toNumber(),se.size(),se.storage())},"Matrix, string":function(se,ae){return Y(se,0,se.size(),ae)},"Matrix, number, string":function(se,ae,ce){return Y(se,ae,se.size(),ce)},"Matrix, BigNumber, string":function(se,ae,ce){return Y(se,ae.toNumber(),se.size(),ce)}});function Y(ne,se,ae,ce){if(!isInteger(se))throw new TypeError("Second parameter in function diag must be an integer");var pe=se>0?se:0,ge=se<0?-se:0;switch(ae.length){case 1:return W(ne,se,ce,ae[0],ge,pe);case 2:return ie(ne,se,ce,ae,ge,pe)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function W(ne,se,ae,ce,pe,ge){var ve=[ce+pe,ce+ge];if(ae&&ae!=="sparse"&&ae!=="dense")throw new TypeError("Unknown matrix type ".concat(ae,'"'));var be=ae==="sparse"?q.diagonal(ve,ne,se):z.diagonal(ve,ne,se);return ae!==null?be:be.valueOf()}function ie(ne,se,ae,ce,pe,ge){if(isMatrix(ne)){var ve=ne.diagonal(se);return ae!==null?ae!==ve.storage()?G(ve,ae):ve:ve.valueOf()}for(var be=Math.min(ce[0]-pe,ce[1]-ge),Ee=[],Pe=0;Pe<be;Pe++)Ee[Pe]=ne[Pe+pe][Pe+ge];return ae!==null?G(Ee):Ee}});function applyCallback(v,N,G,z,q){if(typedFunction.isTypedFunction(v)){var Y=[N,G,z],W=typedFunction.resolve(v,Y);if(W)return ce(W.implementation,Y);var ie=[N,G],ne=typedFunction.resolve(v,ie);if(ne)return ce(ne.implementation,ie);var se=[N],ae=typedFunction.resolve(v,se);return ae?ce(ae.implementation,se):ce(v,Y)}else return v(N,G,z);function ce(pe,ge){try{return pe.apply(pe,ge)}catch(Ee){var ve;if(Ee instanceof TypeError&&((ve=Ee.data)===null||ve===void 0?void 0:ve.category)==="wrongType"){var be=[];throw be.push("value: ".concat(typeOf(N))),ge.length>=2&&be.push("index: ".concat(typeOf(G))),ge.length>=3&&be.push("array: ".concat(typeOf(z))),new TypeError("Function ".concat(q," cannot apply callback arguments ")+"".concat(v.name,"(").concat(be.join(", "),") at index ").concat(JSON.stringify(G)))}else throw new TypeError("Function ".concat(q," cannot apply callback arguments ")+"to function ".concat(v.name,": ").concat(Ee.message))}}}var name$3s="filter",dependencies$3s=["typed"],createFilter=factory(name$3s,dependencies$3s,v=>{var{typed:N}=v;return N("filter",{"Array, function":_filterCallback,"Matrix, function":function(z,q){return z.create(_filterCallback(z.toArray(),q))},"Array, RegExp":filterRegExp,"Matrix, RegExp":function(z,q){return z.create(filterRegExp(z.toArray(),q))}})});function _filterCallback(v,N){return filter(v,function(G,z,q){return applyCallback(N,G,[z],q,"filter")})}var name$3r="flatten",dependencies$3r=["typed","matrix"],createFlatten=factory(name$3r,dependencies$3r,v=>{var{typed:N,matrix:G}=v;return N(name$3r,{Array:function(q){return flatten(q)},Matrix:function(q){var Y=flatten(q.toArray());return G(Y)}})}),name$3q="forEach",dependencies$3q=["typed"],createForEach=factory(name$3q,dependencies$3q,v=>{var{typed:N}=v;return N(name$3q,{"Array, function":_forEach,"Matrix, function":function(z,q){z.forEach(q)}})});function _forEach(v,N){var G=function z(q,Y){if(Array.isArray(q))forEach(q,function(W,ie){z(W,Y.concat(ie))});else return applyCallback(N,q,Y,v,"forEach")};G(v,[])}var name$3p="getMatrixDataType",dependencies$3p=["typed"],createGetMatrixDataType=factory(name$3p,dependencies$3p,v=>{var{typed:N}=v;return N(name$3p,{Array:function(z){return getArrayDataType(z,typeOf)},Matrix:function(z){return z.getDataType()}})}),name$3o="identity",dependencies$3o=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],createIdentity=factory(name$3o,dependencies$3o,v=>{var{typed:N,config:G,matrix:z,BigNumber:q,DenseMatrix:Y,SparseMatrix:W}=v;return N(name$3o,{"":function(){return G.matrix==="Matrix"?z([]):[]},string:function(ae){return z(ae)},"number | BigNumber":function(ae){return ne(ae,ae,G.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(ae,ce){return ne(ae,ae,ce)},"number | BigNumber, number | BigNumber":function(ae,ce){return ne(ae,ce,G.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(ae,ce,pe){return ne(ae,ce,pe)},Array:function(ae){return ie(ae)},"Array, string":function(ae,ce){return ie(ae,ce)},Matrix:function(ae){return ie(ae.valueOf(),ae.storage())},"Matrix, string":function(ae,ce){return ie(ae.valueOf(),ce)}});function ie(se,ae){switch(se.length){case 0:return ae?z(ae):[];case 1:return ne(se[0],se[0],ae);case 2:return ne(se[0],se[1],ae);default:throw new Error("Vector containing two values expected")}}function ne(se,ae,ce){var pe=isBigNumber(se)||isBigNumber(ae)?q:null;if(isBigNumber(se)&&(se=se.toNumber()),isBigNumber(ae)&&(ae=ae.toNumber()),!isInteger(se)||se<1)throw new Error("Parameters in function identity must be positive integers");if(!isInteger(ae)||ae<1)throw new Error("Parameters in function identity must be positive integers");var ge=pe?new q(1):1,ve=pe?new pe(0):0,be=[se,ae];if(ce){if(ce==="sparse")return W.diagonal(be,ge,0,ve);if(ce==="dense")return Y.diagonal(be,ge,0,ve);throw new TypeError('Unknown matrix type "'.concat(ce,'"'))}for(var Ee=resize([],be,ve),Pe=se<ae?se:ae,Je=0;Je<Pe;Je++)Ee[Je][Je]=ge;return Ee}}),name$3n="kron",dependencies$3n=["typed","matrix","multiplyScalar"],createKron=factory(name$3n,dependencies$3n,v=>{var{typed:N,matrix:G,multiplyScalar:z}=v;return N(name$3n,{"Matrix, Matrix":function(W,ie){return G(q(W.toArray(),ie.toArray()))},"Matrix, Array":function(W,ie){return G(q(W.toArray(),ie))},"Array, Matrix":function(W,ie){return G(q(W,ie.toArray()))},"Array, Array":q});function q(Y,W){if(arraySize(Y).length===1&&(Y=[Y]),arraySize(W).length===1&&(W=[W]),arraySize(Y).length>2||arraySize(W).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(Y.length)+", y = "+JSON.stringify(W.length)+")");var ie=[],ne=[];return Y.map(function(se){return W.map(function(ae){return ne=[],ie.push(ne),se.map(function(ce){return ae.map(function(pe){return ne.push(z(ce,pe))})})})})&&ie}}),name$3m="map",dependencies$3m=["typed"],createMap=factory(name$3m,dependencies$3m,v=>{var{typed:N}=v;return N(name$3m,{"Array, function":_map$1,"Matrix, function":function(z,q){return z.map(q)}})});function _map$1(v,N){var G=function z(q,Y){return Array.isArray(q)?q.map(function(W,ie){return z(W,Y.concat(ie))}):applyCallback(N,q,Y,v,"map")};return G(v,[])}var name$3l="diff",dependencies$3l=["typed","matrix","subtract","number"],createDiff=factory(name$3l,dependencies$3l,v=>{var{typed:N,matrix:G,subtract:z,number:q}=v;return N(name$3l,{"Array | Matrix":function(ae){return isMatrix(ae)?G(W(ae.toArray())):W(ae)},"Array | Matrix, number":function(ae,ce){if(!isInteger(ce))throw new RangeError("Dimension must be a whole number");return isMatrix(ae)?G(Y(ae.toArray(),ce)):Y(ae,ce)},"Array, BigNumber":N.referTo("Array,number",se=>(ae,ce)=>se(ae,q(ce))),"Matrix, BigNumber":N.referTo("Matrix,number",se=>(ae,ce)=>se(ae,q(ce)))});function Y(se,ae){if(isMatrix(se)&&(se=se.toArray()),!Array.isArray(se))throw RangeError("Array/Matrix does not have that many dimensions");if(ae>0){var ce=[];return se.forEach(pe=>{ce.push(Y(pe,ae-1))}),ce}else{if(ae===0)return W(se);throw RangeError("Cannot have negative dimension")}}function W(se){for(var ae=[],ce=se.length,pe=1;pe<ce;pe++)ae.push(ie(se[pe-1],se[pe]));return ae}function ie(se,ae){isMatrix(se)&&(se=se.toArray()),isMatrix(ae)&&(ae=ae.toArray());var ce=Array.isArray(se),pe=Array.isArray(ae);if(ce&&pe)return ne(se,ae);if(!ce&&!pe)return z(ae,se);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function ne(se,ae){if(se.length!==ae.length)throw RangeError("Not all sub-arrays have the same length");for(var ce=[],pe=se.length,ge=0;ge<pe;ge++)ce.push(ie(se[ge],ae[ge]));return ce}}),name$3k="ones",dependencies$3k=["typed","config","matrix","BigNumber"],createOnes=factory(name$3k,dependencies$3k,v=>{var{typed:N,config:G,matrix:z,BigNumber:q}=v;return N("ones",{"":function(){return G.matrix==="Array"?Y([]):Y([],"default")},"...number | BigNumber | string":function(se){var ae=se[se.length-1];if(typeof ae=="string"){var ce=se.pop();return Y(se,ce)}else return G.matrix==="Array"?Y(se):Y(se,"default")},Array:Y,Matrix:function(se){var ae=se.storage();return Y(se.valueOf(),ae)},"Array | Matrix, string":function(se,ae){return Y(se.valueOf(),ae)}});function Y(ne,se){var ae=W(ne),ce=ae?new q(1):1;if(ie(ne),se){var pe=z(se);return ne.length>0?pe.resize(ne,ce):pe}else{var ge=[];return ne.length>0?resize(ge,ne,ce):ge}}function W(ne){var se=!1;return ne.forEach(function(ae,ce,pe){isBigNumber(ae)&&(se=!0,pe[ce]=ae.toNumber())}),se}function ie(ne){ne.forEach(function(se){if(typeof se!="number"||!isInteger(se)||se<0)throw new Error("Parameters in function ones must be positive integers")})}});function noBignumber(){throw new Error('No "bignumber" implementation available')}function noFraction(){throw new Error('No "fraction" implementation available')}function noMatrix(){throw new Error('No "matrix" implementation available')}var name$3j="range",dependencies$3j=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],createRange=factory(name$3j,dependencies$3j,v=>{var{typed:N,config:G,matrix:z,bignumber:q,smaller:Y,smallerEq:W,larger:ie,largerEq:ne,add:se,isPositive:ae}=v;return N(name$3j,{string:pe,"string, boolean":pe,"number, number":function(Ee,Pe){return ce(ge(Ee,Pe,1,!1))},"number, number, number":function(Ee,Pe,Je){return ce(ge(Ee,Pe,Je,!1))},"number, number, boolean":function(Ee,Pe,Je){return ce(ge(Ee,Pe,1,Je))},"number, number, number, boolean":function(Ee,Pe,Je,Ce){return ce(ge(Ee,Pe,Je,Ce))},"BigNumber, BigNumber":function(Ee,Pe){var Je=Ee.constructor;return ce(ge(Ee,Pe,new Je(1),!1))},"BigNumber, BigNumber, BigNumber":function(Ee,Pe,Je){return ce(ge(Ee,Pe,Je,!1))},"BigNumber, BigNumber, boolean":function(Ee,Pe,Je){var Ce=Ee.constructor;return ce(ge(Ee,Pe,new Ce(1),Je))},"BigNumber, BigNumber, BigNumber, boolean":function(Ee,Pe,Je,Ce){return ce(ge(Ee,Pe,Je,Ce))},"Unit, Unit, Unit":function(Ee,Pe,Je){return ce(ge(Ee,Pe,Je,!1))},"Unit, Unit, Unit, boolean":function(Ee,Pe,Je,Ce){return ce(ge(Ee,Pe,Je,Ce))}});function ce(be){return G.matrix==="Matrix"?z?z(be):noMatrix():be}function pe(be,Ee){var Pe=ve(be);if(!Pe)throw new SyntaxError('String "'+be+'" is no valid range');return G.number==="BigNumber"?(q===void 0&&noBignumber(),ce(ge(q(Pe.start),q(Pe.end),q(Pe.step)))):ce(ge(Pe.start,Pe.end,Pe.step,Ee))}function ge(be,Ee,Pe,Je){for(var Ce=[],Ve=ae(Pe)?Je?W:Y:Je?ne:ie,Re=be;Ve(Re,Ee);)Ce.push(Re),Re=se(Re,Pe);return Ce}function ve(be){var Ee=be.split(":"),Pe=Ee.map(function(Ce){return Number(Ce)}),Je=Pe.some(function(Ce){return isNaN(Ce)});if(Je)return null;switch(Pe.length){case 2:return{start:Pe[0],end:Pe[1],step:1};case 3:return{start:Pe[0],end:Pe[2],step:Pe[1]};default:return null}}}),name$3i="reshape",dependencies$3i=["typed","isInteger","matrix"],createReshape=factory(name$3i,dependencies$3i,v=>{var{typed:N,isInteger:G}=v;return N(name$3i,{"Matrix, Array":function(q,Y){return q.reshape(Y,!0)},"Array, Array":function(q,Y){return Y.forEach(function(W){if(!G(W))throw new TypeError("Invalid size for dimension: "+W)}),reshape(q,Y)}})}),name$3h="resize",dependencies$3h=["config","matrix"],createResize=factory(name$3h,dependencies$3h,v=>{var{config:N,matrix:G}=v;return function(Y,W,ie){if(arguments.length!==2&&arguments.length!==3)throw new ArgumentsError("resize",arguments.length,2,3);if(isMatrix(W)&&(W=W.valueOf()),isBigNumber(W[0])&&(W=W.map(function(ae){return isBigNumber(ae)?ae.toNumber():ae})),isMatrix(Y))return Y.resize(W,ie,!0);if(typeof Y=="string")return z(Y,W,ie);var ne=Array.isArray(Y)?!1:N.matrix!=="Array";if(W.length===0){for(;Array.isArray(Y);)Y=Y[0];return clone$2(Y)}else{Array.isArray(Y)||(Y=[Y]),Y=clone$2(Y);var se=resize(Y,W,ie);return ne?G(se):se}};function z(q,Y,W){if(W!==void 0){if(typeof W!="string"||W.length!==1)throw new TypeError("Single character expected as defaultValue")}else W=" ";if(Y.length!==1)throw new DimensionError(Y.length,1);var ie=Y[0];if(typeof ie!="number"||!isInteger(ie))throw new TypeError("Invalid size, must contain positive integers (size: "+format(Y)+")");if(q.length>ie)return q.substring(0,ie);if(q.length<ie){for(var ne=q,se=0,ae=ie-q.length;se<ae;se++)ne+=W;return ne}else return q}}),name$3g="rotate",dependencies$3g=["typed","multiply","rotationMatrix"],createRotate=factory(name$3g,dependencies$3g,v=>{var{typed:N,multiply:G,rotationMatrix:z}=v;return N(name$3g,{"Array , number | BigNumber | Complex | Unit":function(W,ie){q(W,2);var ne=G(z(ie),W);return ne.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(W,ie){return q(W,2),G(z(ie),W)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(W,ie,ne){q(W,3);var se=G(z(ie,ne),W);return se},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(W,ie,ne){return q(W,3),G(z(ie,ne),W)}});function q(Y,W){var ie=Array.isArray(Y)?arraySize(Y):Y.size();if(ie.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(W));if(ie.length===2&&ie[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(W));if(ie[0]!==W)throw new RangeError("Vector must be of dimensions 1x".concat(W))}}),name$3f="rotationMatrix",dependencies$3f=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],createRotationMatrix=factory(name$3f,dependencies$3f,v=>{var{typed:N,config:G,multiplyScalar:z,addScalar:q,unaryMinus:Y,norm:W,BigNumber:ie,matrix:ne,DenseMatrix:se,SparseMatrix:ae,cos:ce,sin:pe}=v;return N(name$3f,{"":function(){return G.matrix==="Matrix"?ne([]):[]},string:function(Ce){return ne(Ce)},"number | BigNumber | Complex | Unit":function(Ce){return ge(Ce,G.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(Ce,Ve){return ge(Ce,Ve)},"number | BigNumber | Complex | Unit, Array":function(Ce,Ve){var Re=ne(Ve);return ve(Re),Pe(Ce,Re,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(Ce,Ve){ve(Ve);var Re=Ve.storage()||(G.matrix==="Matrix"?"dense":void 0);return Pe(Ce,Ve,Re)},"number | BigNumber | Complex | Unit, Array, string":function(Ce,Ve,Re){var qe=ne(Ve);return ve(qe),Pe(Ce,qe,Re)},"number | BigNumber | Complex | Unit, Matrix, string":function(Ce,Ve,Re){return ve(Ve),Pe(Ce,Ve,Re)}});function ge(Je,Ce){var Ve=isBigNumber(Je),Re=Ve?new ie(-1):-1,qe=ce(Je),et=pe(Je),Ze=[[qe,z(Re,et)],[et,qe]];return Ee(Ze,Ce)}function ve(Je){var Ce=Je.size();if(Ce.length<1||Ce[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function be(Je){return Je.reduce((Ce,Ve)=>z(Ce,Ve))}function Ee(Je,Ce){if(Ce){if(Ce==="sparse")return new ae(Je);if(Ce==="dense")return new se(Je);throw new TypeError('Unknown matrix type "'.concat(Ce,'"'))}return Je}function Pe(Je,Ce,Ve){var Re=W(Ce);if(Re===0)throw new RangeError("Rotation around zero vector");var qe=isBigNumber(Je)?ie:null,et=qe?new qe(1):1,Ze=qe?new qe(-1):-1,tt=qe?new qe(Ce.get([0])/Re):Ce.get([0])/Re,Ke=qe?new qe(Ce.get([1])/Re):Ce.get([1])/Re,rt=qe?new qe(Ce.get([2])/Re):Ce.get([2])/Re,it=ce(Je),ot=q(et,Y(it)),ut=pe(Je),ct=q(it,be([tt,tt,ot])),at=q(be([tt,Ke,ot]),be([Ze,rt,ut])),st=q(be([tt,rt,ot]),be([Ke,ut])),pt=q(be([tt,Ke,ot]),be([rt,ut])),lt=q(it,be([Ke,Ke,ot])),vt=q(be([Ke,rt,ot]),be([Ze,tt,ut])),dt=q(be([tt,rt,ot]),be([Ze,Ke,ut])),xt=q(be([Ke,rt,ot]),be([tt,ut])),ft=q(it,be([rt,rt,ot])),Et=[[ct,at,st],[pt,lt,vt],[dt,xt,ft]];return Ee(Et,Ve)}}),name$3e="row",dependencies$3e=["typed","Index","matrix","range"],createRow=factory(name$3e,dependencies$3e,v=>{var{typed:N,Index:G,matrix:z,range:q}=v;return N(name$3e,{"Matrix, number":Y,"Array, number":function(ie,ne){return Y(z(clone$2(ie)),ne).valueOf()}});function Y(W,ie){if(W.size().length!==2)throw new Error("Only two dimensional matrix is supported");validateIndex(ie,W.size()[0]);var ne=q(0,W.size()[1]),se=new G(ie,ne),ae=W.subset(se);return isMatrix(ae)?ae:z([[ae]])}}),name$3d="size",dependencies$3d=["typed","config","?matrix"],createSize=factory(name$3d,dependencies$3d,v=>{var{typed:N,config:G,matrix:z}=v;return N(name$3d,{Matrix:function(Y){return Y.create(Y.size())},Array:arraySize,string:function(Y){return G.matrix==="Array"?[Y.length]:z([Y.length])},"number | Complex | BigNumber | Unit | boolean | null":function(Y){return G.matrix==="Array"?[]:z?z([]):noMatrix()}})}),name$3c="squeeze",dependencies$3c=["typed","matrix"],createSqueeze=factory(name$3c,dependencies$3c,v=>{var{typed:N,matrix:G}=v;return N(name$3c,{Array:function(q){return squeeze(clone$2(q))},Matrix:function(q){var Y=squeeze(q.toArray());return Array.isArray(Y)?G(Y):Y},any:function(q){return clone$2(q)}})}),name$3b="subset",dependencies$3b=["typed","matrix","zeros","add"],createSubset=factory(name$3b,dependencies$3b,v=>{var{typed:N,matrix:G,zeros:z,add:q}=v;return N(name$3b,{"Matrix, Index":function(ie,ne){return isEmptyIndex(ne)?G():(validateIndexSourceSize(ie,ne),ie.subset(ne))},"Array, Index":N.referTo("Matrix, Index",function(W){return function(ie,ne){var se=W(G(ie),ne);return ne.isScalar()?se:se.valueOf()}}),"Object, Index":_getObjectProperty,"string, Index":_getSubstring,"Matrix, Index, any, any":function(ie,ne,se,ae){return isEmptyIndex(ne)?ie:(validateIndexSourceSize(ie,ne),ie.clone().subset(ne,Y(se,ne),ae))},"Array, Index, any, any":N.referTo("Matrix, Index, any, any",function(W){return function(ie,ne,se,ae){var ce=W(G(ie),ne,se,ae);return ce.isMatrix?ce.valueOf():ce}}),"Array, Index, any":N.referTo("Matrix, Index, any, any",function(W){return function(ie,ne,se){return W(G(ie),ne,se,void 0).valueOf()}}),"Matrix, Index, any":N.referTo("Matrix, Index, any, any",function(W){return function(ie,ne,se){return W(ie,ne,se,void 0)}}),"string, Index, string":_setSubstring,"string, Index, string, string":_setSubstring,"Object, Index, any":_setObjectProperty});function Y(W,ie){if(typeof W=="string")throw new Error("can't boradcast a string");if(ie._isScalar)return W;var ne=ie.size();if(ne.every(se=>se>0))try{return q(W,z(ne))}catch{return W}else return W}});function _getSubstring(v,N){if(!isIndex(N))throw new TypeError("Index expected");if(isEmptyIndex(N))return"";if(validateIndexSourceSize(Array.from(v),N),N.size().length!==1)throw new DimensionError(N.size().length,1);var G=v.length;validateIndex(N.min()[0],G),validateIndex(N.max()[0],G);var z=N.dimension(0),q="";return z.forEach(function(Y){q+=v.charAt(Y)}),q}function _setSubstring(v,N,G,z){if(!N||N.isIndex!==!0)throw new TypeError("Index expected");if(isEmptyIndex(N))return v;if(validateIndexSourceSize(Array.from(v),N),N.size().length!==1)throw new DimensionError(N.size().length,1);if(z!==void 0){if(typeof z!="string"||z.length!==1)throw new TypeError("Single character expected as defaultValue")}else z=" ";var q=N.dimension(0),Y=q.size()[0];if(Y!==G.length)throw new DimensionError(q.size()[0],G.length);var W=v.length;validateIndex(N.min()[0]),validateIndex(N.max()[0]);for(var ie=[],ne=0;ne<W;ne++)ie[ne]=v.charAt(ne);if(q.forEach(function(ce,pe){ie[ce]=G.charAt(pe[0])}),ie.length>W)for(var se=W-1,ae=ie.length;se<ae;se++)ie[se]||(ie[se]=z);return ie.join("")}function _getObjectProperty(v,N){if(!isEmptyIndex(N)){if(N.size().length!==1)throw new DimensionError(N.size(),1);var G=N.dimension(0);if(typeof G!="string")throw new TypeError("String expected as index to retrieve an object property");return getSafeProperty(v,G)}}function _setObjectProperty(v,N,G){if(isEmptyIndex(N))return v;if(N.size().length!==1)throw new DimensionError(N.size(),1);var z=N.dimension(0);if(typeof z!="string")throw new TypeError("String expected as index to retrieve an object property");var q=clone$2(v);return setSafeProperty(q,z,G),q}var name$3a="transpose",dependencies$3a=["typed","matrix"],createTranspose=factory(name$3a,dependencies$3a,v=>{var{typed:N,matrix:G}=v;return N(name$3a,{Array:W=>z(G(W)).valueOf(),Matrix:z,any:clone$2});function z(W){var ie=W.size(),ne;switch(ie.length){case 1:ne=W.clone();break;case 2:{var se=ie[0],ae=ie[1];if(ae===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+format(ie)+")");switch(W.storage()){case"dense":ne=q(W,se,ae);break;case"sparse":ne=Y(W,se,ae);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+format(ie)+")")}return ne}function q(W,ie,ne){for(var se=W._data,ae=[],ce,pe=0;pe<ne;pe++){ce=ae[pe]=[];for(var ge=0;ge<ie;ge++)ce[ge]=clone$2(se[ge][pe])}return W.createDenseMatrix({data:ae,size:[ne,ie],datatype:W._datatype})}function Y(W,ie,ne){for(var se=W._values,ae=W._index,ce=W._ptr,pe=se?[]:void 0,ge=[],ve=[],be=[],Ee=0;Ee<ie;Ee++)be[Ee]=0;var Pe,Je,Ce;for(Pe=0,Je=ae.length;Pe<Je;Pe++)be[ae[Pe]]++;for(var Ve=0,Re=0;Re<ie;Re++)ve.push(Ve),Ve+=be[Re],be[Re]=ve[Re];for(ve.push(Ve),Ce=0;Ce<ne;Ce++)for(var qe=ce[Ce],et=ce[Ce+1],Ze=qe;Ze<et;Ze++){var tt=be[ae[Ze]]++;ge[tt]=Ce,se&&(pe[tt]=clone$2(se[Ze]))}return W.createSparseMatrix({values:pe,index:ge,ptr:ve,size:[ne,ie],datatype:W._datatype})}}),name$39="ctranspose",dependencies$39=["typed","transpose","conj"],createCtranspose=factory(name$39,dependencies$39,v=>{var{typed:N,transpose:G,conj:z}=v;return N(name$39,{any:function(Y){return z(G(Y))}})}),name$38="zeros",dependencies$38=["typed","config","matrix","BigNumber"],createZeros=factory(name$38,dependencies$38,v=>{var{typed:N,config:G,matrix:z,BigNumber:q}=v;return N(name$38,{"":function(){return G.matrix==="Array"?Y([]):Y([],"default")},"...number | BigNumber | string":function(se){var ae=se[se.length-1];if(typeof ae=="string"){var ce=se.pop();return Y(se,ce)}else return G.matrix==="Array"?Y(se):Y(se,"default")},Array:Y,Matrix:function(se){var ae=se.storage();return Y(se.valueOf(),ae)},"Array | Matrix, string":function(se,ae){return Y(se.valueOf(),ae)}});function Y(ne,se){var ae=W(ne),ce=ae?new q(0):0;if(ie(ne),se){var pe=z(se);return ne.length>0?pe.resize(ne,ce):pe}else{var ge=[];return ne.length>0?resize(ge,ne,ce):ge}}function W(ne){var se=!1;return ne.forEach(function(ae,ce,pe){isBigNumber(ae)&&(se=!0,pe[ce]=ae.toNumber())}),se}function ie(ne){ne.forEach(function(se){if(typeof se!="number"||!isInteger(se)||se<0)throw new Error("Parameters in function zeros must be positive integers")})}}),name$37="fft",dependencies$37=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],createFft=factory(name$37,dependencies$37,v=>{var{typed:N,matrix:G,addScalar:z,multiplyScalar:q,divideScalar:Y,exp:W,tau:ie,i:ne,dotDivide:se,conj:ae,pow:ce,ceil:pe,log2:ge}=v;return N(name$37,{Array:ve,Matrix:function(Ce){return Ce.create(ve(Ce.toArray()))}});function ve(Je){var Ce=arraySize(Je);return Ce.length===1?Pe(Je,Ce[0]):be(Je.map(Ve=>ve(Ve,Ce.slice(1))),0)}function be(Je,Ce){var Ve=arraySize(Je);if(Ce!==0)return new Array(Ve[0]).fill(0).map((qe,et)=>be(Je[et],Ce-1));if(Ve.length===1)return Pe(Je);function Re(qe){var et=arraySize(qe);return new Array(et[1]).fill(0).map((Ze,tt)=>new Array(et[0]).fill(0).map((Ke,rt)=>qe[rt][tt]))}return Re(be(Re(Je),1))}function Ee(Je){for(var Ce=Je.length,Ve=W(Y(q(-1,q(ne,ie)),Ce)),Re=[],qe=1-Ce;qe<Ce;qe++)Re.push(ce(Ve,Y(ce(qe,2),2)));for(var et=ce(2,pe(ge(Ce+Ce-1))),Ze=[...new Array(Ce).fill(0).map((at,st)=>q(Je[st],Re[Ce-1+st])),...new Array(et-Ce).fill(0)],tt=[...new Array(Ce+Ce-1).fill(0).map((at,st)=>Y(1,Re[st])),...new Array(et-(Ce+Ce-1)).fill(0)],Ke=Pe(Ze),rt=Pe(tt),it=new Array(et).fill(0).map((at,st)=>q(Ke[st],rt[st])),ot=se(ae(ve(ae(it))),et),ut=[],ct=Ce-1;ct<Ce+Ce-1;ct++)ut.push(q(ot[ct],Re[ct]));return ut}function Pe(Je){var Ce=Je.length;if(Ce===1)return[Je[0]];if(Ce%2===0){for(var Ve=[...Pe(Je.filter((Ze,tt)=>tt%2===0)),...Pe(Je.filter((Ze,tt)=>tt%2===1))],Re=0;Re<Ce/2;Re++){var qe=Ve[Re],et=q(Ve[Re+Ce/2],W(q(q(ie,ne),Y(-Re,Ce))));Ve[Re]=z(qe,et),Ve[Re+Ce/2]=z(qe,q(-1,et))}return Ve}else return Ee(Je)}}),name$36="ifft",dependencies$36=["typed","fft","dotDivide","conj"],createIfft=factory(name$36,dependencies$36,v=>{var{typed:N,fft:G,dotDivide:z,conj:q}=v;return N(name$36,{"Array | Matrix":function(W){var ie=isMatrix(W)?W.size():arraySize(W);return z(q(G(q(W))),ie.reduce((ne,se)=>ne*se,1))}})});function _typeof(v){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(N){return typeof N}:function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},_typeof(v)}function toPrimitive(v,N){if(_typeof(v)!="object"||!v)return v;var G=v[Symbol.toPrimitive];if(G!==void 0){var z=G.call(v,N);if(_typeof(z)!="object")return z;throw new TypeError("@@toPrimitive must return a primitive value.")}return(N==="string"?String:Number)(v)}function toPropertyKey(v){var N=toPrimitive(v,"string");return _typeof(N)=="symbol"?N:N+""}function _defineProperty(v,N,G){return(N=toPropertyKey(N))in v?Object.defineProperty(v,N,{value:G,enumerable:!0,configurable:!0,writable:!0}):v[N]=G,v}function ownKeys$2(v,N){var G=Object.keys(v);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(v);N&&(z=z.filter(function(q){return Object.getOwnPropertyDescriptor(v,q).enumerable})),G.push.apply(G,z)}return G}function _objectSpread$2(v){for(var N=1;N<arguments.length;N++){var G=arguments[N]!=null?arguments[N]:{};N%2?ownKeys$2(Object(G),!0).forEach(function(z){_defineProperty(v,z,G[z])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(G)):ownKeys$2(Object(G)).forEach(function(z){Object.defineProperty(v,z,Object.getOwnPropertyDescriptor(G,z))})}return v}var name$35="solveODE",dependencies$35=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],createSolveODE=factory(name$35,dependencies$35,v=>{var{typed:N,add:G,subtract:z,multiply:q,divide:Y,max:W,map:ie,abs:ne,isPositive:se,isNegative:ae,larger:ce,smaller:pe,matrix:ge,bignumber:ve,unaryMinus:be}=v;function Ee(Ze){return function(tt,Ke,rt,it){var ot=!(Ke.length===2&&(Ke.every(qe)||Ke.every(isUnit)));if(ot)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var ut=Ke[0],ct=Ke[1],at=ce(ct,ut),st=it.firstStep;if(st!==void 0&&!se(st))throw new Error('"firstStep" must be positive');var pt=it.maxStep;if(pt!==void 0&&!se(pt))throw new Error('"maxStep" must be positive');var lt=it.minStep;if(lt&&ae(lt))throw new Error('"minStep" must be positive or zero');var vt=[ut,ct,st,lt,pt].filter(wt=>wt!==void 0);if(!(vt.every(qe)||vt.every(isUnit)))throw new Error('Inconsistent type of "t" dependant variables');for(var dt=1,xt=it.tol?it.tol:1e-4,ft=it.minDelta?it.minDelta:.2,Et=it.maxDelta?it.maxDelta:5,Ct=it.maxIter?it.maxIter:1e4,Dt=[ut,ct,...rt,pt,lt].some(isBigNumber),[Gt,Ot,It,Bt]=Dt?[ve(Ze.a),ve(Ze.c),ve(Ze.b),ve(Ze.bp)]:[Ze.a,Ze.c,Ze.b,Ze.bp],Ht=st?at?st:be(st):Y(z(ct,ut),dt),ir=[ut],zt=[rt],tr=z(It,Bt),bt=0,_t=0,Xt=Ve(at),At=Re(at);Xt(ir[bt],ct);){var $t=[];Ht=At(ir[bt],ct,Ht),$t.push(tt(ir[bt],zt[bt]));for(var Pt=1;Pt<Ot.length;++Pt)$t.push(tt(G(ir[bt],q(Ot[Pt],Ht)),G(zt[bt],q(Ht,Gt[Pt],$t))));var kt=W(ne(ie(q(tr,$t),wt=>isUnit(wt)?wt.value:wt)));kt<xt&&xt/kt>1/4&&(ir.push(G(ir[bt],Ht)),zt.push(G(zt[bt],q(Ht,It,$t))),bt++);var jt=.84*(xt/kt)**(1/5);if(pe(jt,ft)?jt=ft:ce(jt,Et)&&(jt=Et),jt=Dt?ve(jt):jt,Ht=q(Ht,jt),pt&&ce(ne(Ht),pt)?Ht=at?pt:be(pt):lt&&pe(ne(Ht),lt)&&(Ht=at?lt:be(lt)),_t++,_t>Ct)throw new Error("Maximum number of iterations reached, try changing options")}return{t:ir,y:zt}}}function Pe(Ze,tt,Ke,rt){var it=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],ot=[null,1/2,3/4,1],ut=[2/9,1/3,4/9,0],ct=[7/24,1/4,1/3,1/8],at={a:it,c:ot,b:ut,bp:ct};return Ee(at)(Ze,tt,Ke,rt)}function Je(Ze,tt,Ke,rt){var it=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],ot=[null,1/5,3/10,4/5,8/9,1,1],ut=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],ct=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],at={a:it,c:ot,b:ut,bp:ct};return Ee(at)(Ze,tt,Ke,rt)}function Ce(Ze,tt,Ke,rt){var it=rt.method?rt.method:"RK45",ot={RK23:Pe,RK45:Je};if(it.toUpperCase()in ot){var ut=_objectSpread$2({},rt);return delete ut.method,ot[it.toUpperCase()](Ze,tt,Ke,ut)}else{var ct=Object.keys(ot).map(st=>'"'.concat(st,'"')),at="".concat(ct.slice(0,-1).join(", ")," and ").concat(ct.slice(-1));throw new Error('Unavailable method "'.concat(it,'". Available methods are ').concat(at))}}function Ve(Ze){return Ze?pe:ce}function Re(Ze){var tt=Ze?ce:pe;return function(Ke,rt,it){var ot=G(Ke,it);return tt(ot,rt)?z(rt,Ke):it}}function qe(Ze){return isBigNumber(Ze)||isNumber(Ze)}function et(Ze,tt,Ke,rt){var it=Ce(Ze,tt.toArray(),Ke.toArray(),rt);return{t:ge(it.t),y:ge(it.y)}}return N("solveODE",{"function, Array, Array, Object":Ce,"function, Matrix, Matrix, Object":et,"function, Array, Array":(Ze,tt,Ke)=>Ce(Ze,tt,Ke,{}),"function, Matrix, Matrix":(Ze,tt,Ke)=>et(Ze,tt,Ke,{}),"function, Array, number | BigNumber | Unit":(Ze,tt,Ke)=>{var rt=Ce(Ze,tt,[Ke],{});return{t:rt.t,y:rt.y.map(it=>it[0])}},"function, Matrix, number | BigNumber | Unit":(Ze,tt,Ke)=>{var rt=Ce(Ze,tt.toArray(),[Ke],{});return{t:ge(rt.t),y:ge(rt.y.map(it=>it[0]))}},"function, Array, number | BigNumber | Unit, Object":(Ze,tt,Ke,rt)=>{var it=Ce(Ze,tt,[Ke],rt);return{t:it.t,y:it.y.map(ot=>ot[0])}},"function, Matrix, number | BigNumber | Unit, Object":(Ze,tt,Ke,rt)=>{var it=Ce(Ze,tt.toArray(),[Ke],rt);return{t:ge(it.t),y:ge(it.y.map(ot=>ot[0]))}}})}),name$34="erf",dependencies$34=["typed"],createErf=factory(name$34,dependencies$34,v=>{var{typed:N}=v;return N("name",{number:function(W){var ie=Math.abs(W);return ie>=MAX_NUM?sign$1(W):ie<=THRESH?sign$1(W)*G(ie):ie<=4?sign$1(W)*(1-z(ie)):sign$1(W)*(1-q(ie))},"Array | Matrix":N.referToSelf(Y=>W=>deepMap(W,Y))});function G(Y){var W=Y*Y,ie=P$2[0][4]*W,ne=W,se;for(se=0;se<3;se+=1)ie=(ie+P$2[0][se])*W,ne=(ne+Q[0][se])*W;return Y*(ie+P$2[0][3])/(ne+Q[0][3])}function z(Y){var W=P$2[1][8]*Y,ie=Y,ne;for(ne=0;ne<7;ne+=1)W=(W+P$2[1][ne])*Y,ie=(ie+Q[1][ne])*Y;var se=(W+P$2[1][7])/(ie+Q[1][7]),ae=parseInt(Y*16)/16,ce=(Y-ae)*(Y+ae);return Math.exp(-ae*ae)*Math.exp(-ce)*se}function q(Y){var W=1/(Y*Y),ie=P$2[2][5]*W,ne=W,se;for(se=0;se<4;se+=1)ie=(ie+P$2[2][se])*W,ne=(ne+Q[2][se])*W;var ae=W*(ie+P$2[2][4])/(ne+Q[2][4]);ae=(SQRPI-ae)/Y,W=parseInt(Y*16)/16;var ce=(Y-W)*(Y+W);return Math.exp(-W*W)*Math.exp(-ce)*ae}}),THRESH=.46875,SQRPI=.5641895835477563,P$2=[[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]],Q=[[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]],MAX_NUM=Math.pow(2,53),name$33="zeta",dependencies$33=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],createZeta=factory(name$33,dependencies$33,v=>{var{typed:N,config:G,multiply:z,pow:q,divide:Y,factorial:W,equal:ie,smallerEq:ne,isNegative:se,gamma:ae,sin:ce,subtract:pe,add:ge,Complex:ve,BigNumber:be,pi:Ee}=v;return N(name$33,{number:qe=>Pe(qe,et=>et,()=>20),BigNumber:qe=>Pe(qe,et=>new be(et),()=>Math.abs(Math.log10(G.epsilon))),Complex:Je});function Pe(qe,et,Ze){return ie(qe,0)?et(-.5):ie(qe,1)?et(NaN):isFinite(qe)?Ce(qe,et,Ze,tt=>tt):se(qe)?et(NaN):et(1)}function Je(qe){return qe.re===0&&qe.im===0?new ve(-.5):qe.re===1?new ve(NaN,NaN):qe.re===1/0&&qe.im===0?new ve(1):qe.im===1/0||qe.re===-1/0?new ve(NaN,NaN):Ce(qe,et=>et,et=>Math.round(1.3*15+.9*Math.abs(et.im)),et=>et.re)}function Ce(qe,et,Ze,tt){var Ke=Ze(qe);if(tt(qe)>-(Ke-1)/2)return Re(qe,et(Ke),et);var rt=z(q(2,qe),q(et(Ee),pe(qe,1)));return rt=z(rt,ce(z(Y(et(Ee),2),qe))),rt=z(rt,ae(pe(1,qe))),z(rt,Ce(pe(1,qe),et,Ze,tt))}function Ve(qe,et){for(var Ze=qe,tt=qe;ne(tt,et);tt=ge(tt,1)){var Ke=Y(z(W(ge(et,pe(tt,1))),q(4,tt)),z(W(pe(et,tt)),W(z(2,tt))));Ze=ge(Ze,Ke)}return z(et,Ze)}function Re(qe,et,Ze){for(var tt=Y(1,z(Ve(Ze(0),et),pe(1,q(2,pe(1,qe))))),Ke=Ze(0),rt=Ze(1);ne(rt,et);rt=ge(rt,1))Ke=ge(Ke,Y(z((-1)**(rt-1),Ve(rt,et)),q(rt,qe)));return z(tt,Ke)}}),name$32="mode",dependencies$32=["typed","isNaN","isNumeric"],createMode=factory(name$32,dependencies$32,v=>{var{typed:N,isNaN:G,isNumeric:z}=v;return N(name$32,{"Array | Matrix":q,"...":function(W){return q(W)}});function q(Y){Y=flatten(Y.valueOf());var W=Y.length;if(W===0)throw new Error("Cannot calculate mode of an empty array");for(var ie={},ne=[],se=0,ae=0;ae<Y.length;ae++){var ce=Y[ae];if(z(ce)&&G(ce))throw new Error("Cannot calculate mode of an array containing NaN values");ce in ie||(ie[ce]=0),ie[ce]++,ie[ce]===se?ne.push(ce):ie[ce]>se&&(se=ie[ce],ne=[ce])}return ne}});function improveErrorMessage(v,N,G){var z;return String(v).indexOf("Unexpected type")!==-1?(z=arguments.length>2?" (type: "+typeOf(G)+", value: "+JSON.stringify(G)+")":" (type: "+v.data.actual+")",new TypeError("Cannot calculate "+N+", unexpected type of argument"+z)):String(v).indexOf("complex numbers")!==-1?(z=arguments.length>2?" (type: "+typeOf(G)+", value: "+JSON.stringify(G)+")":"",new TypeError("Cannot calculate "+N+", no ordering relation is defined for c
445omplex numbers"+z)):v}var name$31="prod",dependencies$31=["typed","config","multiplyScalar","numeric"],createProd=factory(name$31,dependencies$31,v=>{var{typed:N,config:G,multiplyScalar:z,numeric:q}=v;return N(name$31,{"Array | Matrix":Y,"Array | Matrix, number | BigNumber":function(ie,ne){throw new Error("prod(A, dim) is not yet supported")},"...":function(ie){return Y(ie)}});function Y(W){var ie;if(deepForEach(W,function(ne){try{ie=ie===void 0?ne:z(ie,ne)}catch(se){throw improveErrorMessage(se,"prod",ne)}}),typeof ie=="string"&&(ie=q(ie,G.number)),ie===void 0)throw new Error("Cannot calculate prod of an empty array");return ie}}),name$30="format",dependencies$30=["typed"],createFormat=factory(name$30,dependencies$30,v=>{var{typed:N}=v;return N(name$30,{any:format,"any, Object | function | number":format})}),name$2$="bin",dependencies$2$=["typed","format"],createBin=factory(name$2$,dependencies$2$,v=>{var{typed:N,format:G}=v;return N(name$2$,{"number | BigNumber":function(q){return G(q,{notation:"bin"})},"number | BigNumber, number":function(q,Y){return G(q,{notation:"bin",wordSize:Y})}})}),name$2_="oct",dependencies$2_=["typed","format"],createOct=factory(name$2_,dependencies$2_,v=>{var{typed:N,format:G}=v;return N(name$2_,{"number | BigNumber":function(q){return G(q,{notation:"oct"})},"number | BigNumber, number":function(q,Y){return G(q,{notation:"oct",wordSize:Y})}})}),name$2Z="hex",dependencies$2Z=["typed","format"],createHex=factory(name$2Z,dependencies$2Z,v=>{var{typed:N,format:G}=v;return N(name$2Z,{"number | BigNumber":function(q){return G(q,{notation:"hex"})},"number | BigNumber, number":function(q,Y){return G(q,{notation:"hex",wordSize:Y})}})}),printTemplate=/\$([\w.]+)/g,name$2Y="print",dependencies$2Y=["typed"],createPrint=factory(name$2Y,dependencies$2Y,v=>{var{typed:N}=v;return N(name$2Y,{"string, Object | Array":_print,"string, Object | Array, number | Object":_print})});function _print(v,N,G){return v.replace(printTemplate,function(z,q){var Y=q.split("."),W=N[Y.shift()];for(W!==void 0&&W.isMatrix&&(W=W.toArray());Y.length&&W!==void 0;){var ie=Y.shift();W=ie?W[ie]:W+"."}return W!==void 0?isString(W)?W:format(W,G):z})}var name$2X="to",dependencies$2X=["typed","matrix","concat"],createTo=factory(name$2X,dependencies$2X,v=>{var{typed:N,matrix:G,concat:z}=v,q=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:z});return N(name$2X,{"Unit, Unit | string":(Y,W)=>Y.to(W)},q({Ds:!0}))}),name$2W="isPrime",dependencies$2W=["typed"],createIsPrime=factory(name$2W,dependencies$2W,v=>{var{typed:N}=v;return N(name$2W,{number:function(z){if(z*0!==0)return!1;if(z<=3)return z>1;if(z%2===0||z%3===0)return!1;for(var q=5;q*q<=z;q+=6)if(z%q===0||z%(q+2)===0)return!1;return!0},BigNumber:function(z){if(z.toNumber()*0!==0)return!1;if(z.lte(3))return z.gt(1);if(z.mod(2).eq(0)||z.mod(3).eq(0))return!1;if(z.lt(Math.pow(2,32))){for(var q=z.toNumber(),Y=5;Y*Y<=q;Y+=6)if(q%Y===0||q%(Y+2)===0)return!1;return!0}function W(Je,Ce,Ve){for(var Re=1;!Ce.eq(0);)Ce.mod(2).eq(0)?(Ce=Ce.div(2),Je=Je.mul(Je).mod(Ve)):(Ce=Ce.sub(1),Re=Je.mul(Re).mod(Ve));return Re}var ie=z.constructor.clone({precision:z.toFixed(0).length*2});z=new ie(z);for(var ne=0,se=z.sub(1);se.mod(2).eq(0);)se=se.div(2),ne+=1;var ae=null;if(z.lt("3317044064679887385961981"))ae=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(Je=>Je<z);else{var ce=Math.min(z.toNumber()-2,Math.floor(2*Math.pow(z.toFixed(0).length*Math.log(10),2)));ae=[];for(var pe=2;pe<=ce;pe+=1)ae.push(ce)}for(var ge=0;ge<ae.length;ge+=1){var ve=ae[ge],be=W(z.sub(z).add(ve),se,z);if(!be.eq(1)){for(var Ee=0,Pe=be;!Pe.eq(z.sub(1));Ee+=1,Pe=Pe.mul(Pe).mod(z))if(Ee===ne-1)return!1}}return!0},"Array | Matrix":N.referToSelf(G=>z=>deepMap(z,G))})}),name$2V="numeric",dependencies$2V=["number","?bignumber","?fraction"],createNumeric=factory(name$2V,dependencies$2V,v=>{var{number:N,bignumber:G,fraction:z}=v,q={string:!0,number:!0,BigNumber:!0,Fraction:!0},Y={number:W=>N(W),BigNumber:G?W=>G(W):noBignumber,Fraction:z?W=>z(W):noFraction};return function(ie){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",se=arguments.length>2?arguments[2]:void 0;
vendor: 29,082 bytes, line 445
445if(se!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var ae=typeOf(ie);if(!(ae in q))throw new TypeError("Cannot convert "+ie+' of type "'+ae+'"; valid input types are '+Object.keys(q).join(", "));if(!(ne in Y))throw new TypeError("Cannot convert "+ie+' to type "'+ne+'"; valid output types are '+Object.keys(Y).join(", "));return ne===ae?ie:Y[ne](ie)}}),name$2U="divideScalar",dependencies$2U=["typed","numeric"],createDivideScalar=factory(name$2U,dependencies$2U,v=>{var{typed:N,numeric:G}=v;return N(name$2U,{"number, number":function(q,Y){return q/Y},"Complex, Complex":function(q,Y){return q.div(Y)},"BigNumber, BigNumber":function(q,Y){return q.div(Y)},"Fraction, Fraction":function(q,Y){return q.div(Y)},"Unit, number | Complex | Fraction | BigNumber | Unit":(z,q)=>z.divide(q),"number | Fraction | Complex | BigNumber, Unit":(z,q)=>q.divideInto(z)})}),name$2T="pow",dependencies$2T=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],createPow=factory(name$2T,dependencies$2T,v=>{var{typed:N,config:G,identity:z,multiply:q,matrix:Y,inv:W,number:ie,fraction:ne,Complex:se}=v;return N(name$2T,{"number, number":ae,"Complex, Complex":function(ve,be){return ve.pow(be)},"BigNumber, BigNumber":function(ve,be){return be.isInteger()||ve>=0||G.predictable?ve.pow(be):new se(ve.toNumber(),0).pow(be.toNumber(),0)},"Fraction, Fraction":function(ve,be){var Ee=ve.pow(be);if(Ee!=null)return Ee;if(G.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return ae(ve.valueOf(),be.valueOf())},"Array, number":ce,"Array, BigNumber":function(ve,be){return ce(ve,be.toNumber())},"Matrix, number":pe,"Matrix, BigNumber":function(ve,be){return pe(ve,be.toNumber())},"Unit, number | BigNumber":function(ve,be){return ve.pow(be)}});function ae(ge,ve){if(G.predictable&&!isInteger(ve)&&ge<0)try{var be=ne(ve),Ee=ie(be);if((ve===Ee||Math.abs((ve-Ee)/ve)<1e-14)&&be.d%2===1)return(be.n%2===0?1:-1)*Math.pow(-ge,ve)}catch{}return G.predictable&&(ge<-1&&ve===1/0||ge>-1&&ge<0&&ve===-1/0)?NaN:isInteger(ve)||ge>=0||G.predictable?powNumber(ge,ve):ge*ge<1&&ve===1/0||ge*ge>1&&ve===-1/0?0:new se(ge,0).pow(ve,0)}function ce(ge,ve){if(!isInteger(ve))throw new TypeError("For A^b, b must be an integer (value is "+ve+")");var be=arraySize(ge);if(be.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+be.length+" dimensions)");if(be[0]!==be[1])throw new Error("For A^b, A must be square (size is "+be[0]+"x"+be[1]+")");if(ve<0)try{return ce(W(ge),-ve)}catch(Je){throw Je.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 "+ve+")"):Je}for(var Ee=z(be[0]).valueOf(),Pe=ge;ve>=1;)(ve&1)===1&&(Ee=q(Pe,Ee)),ve>>=1,Pe=q(Pe,Pe);return Ee}function pe(ge,ve){return Y(ce(ge.valueOf(),ve))}}),NO_INT="Number of decimals in function round must be an integer",name$2S="round",dependencies$2S=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],createRound=factory(name$2S,dependencies$2S,v=>{var{typed:N,matrix:G,equalScalar:z,zeros:q,BigNumber:Y,DenseMatrix:W}=v,ie=createMatAlgo11xS0s({typed:N,equalScalar:z}),ne=createMatAlgo12xSfs({typed:N,DenseMatrix:W}),se=createMatAlgo14xDs({typed:N});return N(name$2S,{number:roundNumber,"number, number":roundNumber,"number, BigNumber":function(ce,pe){if(!pe.isInteger())throw new TypeError(NO_INT);return new Y(ce).toDecimalPlaces(pe.toNumber())},Complex:function(ce){return ce.round()},"Complex, number":function(ce,pe){if(pe%1)throw new TypeError(NO_INT);return ce.round(pe)},"Complex, BigNumber":function(ce,pe){if(!pe.isInteger())throw new TypeError(NO_INT);var ge=pe.toNumber();return ce.round(ge)},BigNumber:function(ce){return ce.toDecimalPlaces(0)},"BigNumber, BigNumber":function(ce,pe){if(!pe.isInteger())throw new TypeError(NO_INT);return ce.toDecimalPlaces(pe.toNumber())},Fraction:function(ce){return ce.round()},"Fraction, number":function(ce,pe){if(pe%1)throw new TypeError(NO_INT);return ce.round(pe)},"Fraction, BigNumber":function(ce,pe){if(!pe.isInteger())throw new TypeError(NO_INT);return ce.round(pe.toNumber())},"Array | Matrix":N.referToSelf(ae=>ce=>deepMap(ce,ae)),"SparseMatrix, number | BigNumber":N.referToSelf(ae=>(ce,pe)=>ie(ce,pe,ae,!1)),"DenseMatrix, number | BigNumber":N.referToSelf(ae=>(ce,pe)=>se(ce,pe,ae,!1)),"Array, number | BigNumber":N.referToSelf(ae=>(ce,pe)=>se(G(ce),pe,ae,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":N.referToSelf(ae=>(ce,pe)=>z(ce,0)?q(pe.size(),pe.storage()):ne(pe,ce,ae,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":N.referToSelf(ae=>(ce,pe)=>z(ce,0)?q(pe.size(),pe.storage()):se(pe,ce,ae,!0)),"number | Complex | BigNumber | Fraction, Array":N.referToSelf(ae=>(ce,pe)=>se(G(pe),ce,ae,!0).valueOf())})}),name$2R="log",dependencies$2R=["config","typed","divideScalar","Complex"],createLog=factory(name$2R,dependencies$2R,v=>{var{typed:N,config:G,divideScalar:z,Complex:q}=v;return N(name$2R,{number:function(W){return W>=0||G.predictable?logNumber(W):new q(W,0).log()},Complex:function(W){return W.log()},BigNumber:function(W){return!W.isNegative()||G.predictable?W.ln():new q(W.toNumber(),0).log()},"any, any":N.referToSelf(Y=>(W,ie)=>z(Y(W),Y(ie)))})}),name$2Q="log1p",dependencies$2Q=["typed","config","divideScalar","log","Complex"],createLog1p=factory(name$2Q,dependencies$2Q,v=>{var{typed:N,config:G,divideScalar:z,log:q,Complex:Y}=v;return N(name$2Q,{number:function(ne){return ne>=-1||G.predictable?log1p(ne):W(new Y(ne,0))},Complex:W,BigNumber:function(ne){var se=ne.plus(1);return!se.isNegative()||G.predictable?se.ln():W(new Y(ne.toNumber(),0))},"Array | Matrix":N.referToSelf(ie=>ne=>deepMap(ne,ie)),"any, any":N.referToSelf(ie=>(ne,se)=>z(ie(ne),q(se)))});function W(ie){var ne=ie.re+1;return new Y(Math.log(Math.sqrt(ne*ne+ie.im*ie.im)),Math.atan2(ie.im,ne))}}),name$2P="nthRoots",dependencies$2P=["config","typed","divideScalar","Complex"],createNthRoots=factory(name$2P,dependencies$2P,v=>{var{typed:N,config:G,divideScalar:z,Complex:q}=v,Y=[function(ne){return new q(ne,0)},function(ne){return new q(0,ne)},function(ne){return new q(-ne,0)},function(ne){return new q(0,-ne)}];function W(ie,ne){if(ne<0)throw new Error("Root must be greater than zero");if(ne===0)throw new Error("Root must be non-zero");if(ne%1!==0)throw new Error("Root must be an integer");if(ie===0||ie.abs()===0)return[new q(0,0)];var se=typeof ie=="number",ae;(se||ie.re===0||ie.im===0)&&(se?ae=2*+(ie<0):ie.im===0?ae=2*+(ie.re<0):ae=2*+(ie.im<0)+1);for(var ce=ie.arg(),pe=ie.abs(),ge=[],ve=Math.pow(pe,1/ne),be=0;be<ne;be++){var Ee=(ae+4*be)/ne;if(Ee===Math.round(Ee)){ge.push(Y[Ee%4](ve));continue}ge.push(new q({r:ve,phi:(ce+2*Math.PI*be)/ne}))}return ge}return N(name$2P,{Complex:function(ne){return W(ne,2)},"Complex, number":W})}),name$2O="dotPow",dependencies$2O=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],createDotPow=factory(name$2O,dependencies$2O,v=>{var{typed:N,equalScalar:G,matrix:z,pow:q,DenseMatrix:Y,concat:W}=v,ie=createMatAlgo03xDSf({typed:N}),ne=createMatAlgo07xSSf({typed:N,DenseMatrix:Y}),se=createMatAlgo11xS0s({typed:N,equalScalar:G}),ae=createMatAlgo12xSfs({typed:N,DenseMatrix:Y}),ce=createMatrixAlgorithmSuite({typed:N,matrix:z,concat:W}),pe={};for(var ge in q.signatures)Object.prototype.hasOwnProperty.call(q.signatures,ge)&&!ge.includes("Matrix")&&!ge.includes("Array")&&(pe[ge]=q.signatures[ge]);var ve=N(pe);return N(name$2O,ce({elop:ve,SS:ne,DS:ie,Ss:se,sS:ae}))}),name$2N="dotDivide",dependencies$2N=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],createDotDivide=factory(name$2N,dependencies$2N,v=>{var{typed:N,matrix:G,equalScalar:z,divideScalar:q,DenseMatrix:Y,concat:W}=v,ie=createMatAlgo02xDS0({typed:N,equalScalar:z}),ne=createMatAlgo03xDSf({typed:N}),se=createMatAlgo07xSSf({typed:N,DenseMatrix:Y}),ae=createMatAlgo11xS0s({typed:N,equalScalar:z}),ce=createMatAlgo12xSfs({typed:N,DenseMatrix:Y}),pe=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:W});return N(name$2N,pe({elop:q,SS:se,DS:ne,SD:ie,Ss:ae,sS:ce}))});function createSolveValidation(v){var{DenseMatrix:N}=v;return function(z,q,Y){var W=z.size();if(W.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+format(W)+")");var ie=W[0],ne=W[1];if(ie!==ne)throw new RangeError("Matrix must be square (size: "+format(W)+")");var se=[];if(isMatrix(q)){var ae=q.size(),ce=q._data;if(ae.length===1){if(ae[0]!==ie)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var pe=0;pe<ie;pe++)se[pe]=[ce[pe]];return new N({data:se,size:[ie,1],datatype:q._datatype})}if(ae.length===2){if(ae[0]!==ie||ae[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(isDenseMatrix(q)){if(Y){se=[];for(var ge=0;ge<ie;ge++)se[ge]=[ce[ge][0]];return new N({data:se,size:[ie,1],datatype:q._datatype})}return q}if(isSparseMatrix(q)){for(var ve=0;ve<ie;ve++)se[ve]=[0];for(var be=q._values,Ee=q._index,Pe=q._ptr,Je=Pe[1],Ce=Pe[0];Ce<Je;Ce++){var Ve=Ee[Ce];se[Ve][0]=be[Ce]}return new N({data:se,size:[ie,1],datatype:q._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(isArray(q)){var Re=arraySize(q);if(Re.length===1){if(Re[0]!==ie)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var qe=0;qe<ie;qe++)se[qe]=[q[qe]];return new N({data:se,size:[ie,1]})}if(Re.length===2){if(Re[0]!==ie||Re[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var et=0;et<ie;et++)se[et]=[q[et][0]];return new N({data:se,size:[ie,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var name$2M="lsolve",dependencies$2M=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],createLsolve=factory(name$2M,dependencies$2M,v=>{var{typed:N,matrix:G,divideScalar:z,multiplyScalar:q,subtractScalar:Y,equalScalar:W,DenseMatrix:ie}=v,ne=createSolveValidation({DenseMatrix:ie});return N(name$2M,{"SparseMatrix, Array | Matrix":function(pe,ge){return ae(pe,ge)},"DenseMatrix, Array | Matrix":function(pe,ge){return se(pe,ge)},"Array, Array | Matrix":function(pe,ge){var ve=G(pe),be=se(ve,ge);return be.valueOf()}});function se(ce,pe){pe=ne(ce,pe,!0);for(var ge=pe._data,ve=ce._size[0],be=ce._size[1],Ee=[],Pe=ce._data,Je=0;Je<be;Je++){var Ce=ge[Je][0]||0,Ve=void 0;if(W(Ce,0))Ve=0;else{var Re=Pe[Je][Je];if(W(Re,0))throw new Error("Linear system cannot be solved since matrix is singular");Ve=z(Ce,Re);for(var qe=Je+1;qe<ve;qe++)ge[qe]=[Y(ge[qe][0]||0,q(Ve,Pe[qe][Je]))]}Ee[Je]=[Ve]}return new ie({data:Ee,size:[ve,1]})}function ae(ce,pe){pe=ne(ce,pe,!0);for(var ge=pe._data,ve=ce._size[0],be=ce._size[1],Ee=ce._values,Pe=ce._index,Je=ce._ptr,Ce=[],Ve=0;Ve<be;Ve++){var Re=ge[Ve][0]||0;if(W(Re,0))Ce[Ve]=[0];else{for(var qe=0,et=[],Ze=[],tt=Je[Ve],Ke=Je[Ve+1],rt=tt;rt<Ke;rt++){var it=Pe[rt];it===Ve?qe=Ee[rt]:it>Ve&&(et.push(Ee[rt]),Ze.push(it))}if(W(qe,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var ot=z(Re,qe),ut=0,ct=Ze.length;ut<ct;ut++){var at=Ze[ut];ge[at]=[Y(ge[at][0]||0,q(ot,et[ut]))]}Ce[Ve]=[ot]}}return new ie({data:Ce,size:[ve,1]})}}),name$2L="usolve",dependencies$2L=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],createUsolve=factory(name$2L,dependencies$2L,v=>{var{typed:N,matrix:G,divideScalar:z,multiplyScalar:q,subtractScalar:Y,equalScalar:W,DenseMatrix:ie}=v,ne=createSolveValidation({DenseMatrix:ie});return N(name$2L,{"SparseMatrix, Array | Matrix":function(pe,ge){return ae(pe,ge)},"DenseMatrix, Array | Matrix":function(pe,ge){return se(pe,ge)},"Array, Array | Matrix":function(pe,ge){var ve=G(pe),be=se(ve,ge);return be.valueOf()}});function se(ce,pe){pe=ne(ce,pe,!0);for(var ge=pe._data,ve=ce._size[0],be=ce._size[1],Ee=[],Pe=ce._data,Je=be-1;Je>=0;Je--){var Ce=ge[Je][0]||0,Ve=void 0;if(W(Ce,0))Ve=0;else{var Re=Pe[Je][Je];if(W(Re,0))throw new Error("Linear system cannot be solved since matrix is singular");Ve=z(Ce,Re);for(var qe=Je-1;qe>=0;qe--)ge[qe]=[Y(ge[qe][0]||0,q(Ve,Pe[qe][Je]))]}Ee[Je]=[Ve]}return new ie({data:Ee,size:[ve,1]})}function ae(ce,pe){pe=ne(ce,pe,!0);for(var ge=pe._data,ve=ce._size[0],be=ce._size[1],Ee=ce._values,Pe=ce._index,Je=ce._ptr,Ce=[],Ve=be-1;Ve>=0;Ve--){var Re=ge[Ve][0]||0;if(W(Re,0))Ce[Ve]=[0];else{for(var qe=0,et=[],Ze=[],tt=Je[Ve],Ke=Je[Ve+1],rt=Ke-1;rt>=tt;rt--){var it=Pe[rt];it===Ve?qe=Ee[rt]:it<Ve&&(et.push(Ee[rt]),Ze.push(it))}if(W(qe,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var ot=z(Re,qe),ut=0,ct=Ze.length;ut<ct;ut++){var at=Ze[ut];ge[at]=[Y(ge[at][0],q(ot,et[ut]))]}Ce[Ve]=[ot]}}return new ie({data:Ce,size:[ve,1]})}}),name$2K="lsolveAll",dependencies$2K=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],createLsolveAll=factory(name$2K,dependencies$2K,v=>{var{typed:N,matrix:G,divideScalar:z,multiplyScalar:q,subtractScalar:Y,equalScalar:W,DenseMatrix:ie}=v,ne=createSolveValidation({DenseMatrix:ie});return N(name$2K,{"SparseMatrix, Array | Matrix":function(pe,ge){return ae(pe,ge)},"DenseMatrix, Array | Matrix":function(pe,ge){return se(pe,ge)},"Array, Array | Matrix":function(pe,ge){var ve=G(pe),be=se(ve,ge);return be.map(Ee=>Ee.valueOf())}});function se(ce,pe){for(var ge=[ne(ce,pe,!0)._data.map(Ze=>Ze[0])],ve=ce._data,be=ce._size[0],Ee=ce._size[1],Pe=0;Pe<Ee;Pe++)for(var Je=ge.length,Ce=0;Ce<Je;Ce++){var Ve=ge[Ce];if(W(ve[Pe][Pe],0))if(W(Ve[Pe],0)){if(Ce===0){var qe=[...Ve];qe[Pe]=1;for(var et=Pe+1;et<Ee;et++)qe[et]=Y(qe[et],ve[et][Pe]);ge.push(qe)}}else{if(Ce===0)return[];ge.splice(Ce,1),Ce-=1,Je-=1}else{Ve[Pe]=z(Ve[Pe],ve[Pe][Pe]);for(var Re=Pe+1;Re<Ee;Re++)Ve[Re]=Y(Ve[Re],q(Ve[Pe],ve[Re][Pe]))}}return ge.map(Ze=>new ie({data:Ze.map(tt=>[tt]),size:[be,1]}))}function ae(ce,pe){for(var ge=[ne(ce,pe,!0)._data.map(dt=>dt[0])],ve=ce._size[0],be=ce._size[1],Ee=ce._values,Pe=ce._index,Je=ce._ptr,Ce=0;Ce<be;Ce++)for(var Ve=ge.length,Re=0;Re<Ve;Re++){for(var qe=ge[Re],et=[],Ze=[],tt=Je[Ce],Ke=Je[Ce+1],rt=0,it=tt;it<Ke;it++){var ot=Pe[it];ot===Ce?rt=Ee[it]:ot>Ce&&(et.push(Ee[it]),Ze.push(ot))}if(W(rt,0))if(W(qe[Ce],0)){if(Re===0){var st=[...qe];st[Ce]=1;for(var pt=0,lt=Ze.length;pt<lt;pt++){var vt=Ze[pt];st[vt]=Y(st[vt],et[pt])}ge.push(st)}}else{if(Re===0)return[];ge.splice(Re,1),Re-=1,Ve-=1}else{qe[Ce]=z(qe[Ce],rt);for(var ut=0,ct=Ze.length;ut<ct;ut++){var at=Ze[ut];qe[at]=Y(qe[at],q(qe[Ce],et[ut]))}}}return ge.map(dt=>new ie({data:dt.map(xt=>[xt]),size:[ve,1]}))}}),name$2J="usolveAll",dependencies$2J=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],createUsolveAll=factory(name$2J,dependencies$2J,v=>{var{typed:N,matrix:G,divideScalar:z,multiplyScalar:q,subtractScalar:Y,equalScalar:W,DenseMatrix:ie}=v,ne=createSolveValidation({DenseMatrix:ie});return N(name$2J,{"SparseMatrix, Array | Matrix":function(pe,ge){return ae(pe,ge)},"DenseMatrix, Array | Matrix":function(pe,ge){return se(pe,ge)},"Array, Array | Matrix":function(pe,ge){var ve=G(pe),be=se(ve,ge);return be.map(Ee=>Ee.valueOf())}});function se(ce,pe){for(var ge=[ne(ce,pe,!0)._data.map(Ze=>Ze[0])],ve=ce._data,be=ce._size[0],Ee=ce._size[1],Pe=Ee-1;Pe>=0;Pe--)for(var Je=ge.length,Ce=0;Ce<Je;Ce++){var Ve=ge[Ce];if(W(ve[Pe][Pe],0))if(W(Ve[Pe],0)){if(Ce===0){var qe=[...Ve];qe[Pe]=1;for(var et=Pe-1;et>=0;et--)qe[et]=Y(qe[et],ve[et][Pe]);ge.push(qe)}}else{if(Ce===0)return[];ge.splice(Ce,1),Ce-=1,Je-=1}else{Ve[Pe]=z(Ve[Pe],ve[Pe][Pe]);for(var Re=Pe-1;Re>=0;Re--)Ve[Re]=Y(Ve[Re],q(Ve[Pe],ve[Re][Pe]))}}return ge.map(Ze=>new ie({data:Ze.map(tt=>[tt]),size:[be,1]}))}function ae(ce,pe){for(var ge=[ne(ce,pe,!0)._data.map(dt=>dt[0])],ve=ce._size[0],be=ce._size[1],Ee=ce._values,Pe=ce._index,Je=ce._ptr,Ce=be-1;Ce>=0;Ce--)for(var Ve=ge.length,Re=0;Re<Ve;Re++){for(var qe=ge[Re],et=[],Ze=[],tt=Je[Ce],Ke=Je[Ce+1],rt=0,it=Ke-1;it>=tt;it--){var ot=Pe[it];ot===Ce?rt=Ee[it]:ot<Ce&&(et.push(Ee[it]),Ze.push(ot))}if(W(rt,0))if(W(qe[Ce],0)){if(Re===0){var st=[...qe];st[Ce]=1;for(var pt=0,lt=Ze.length;pt<lt;pt++){var vt=Ze[pt];st[vt]=Y(st[vt],et[pt])}ge.push(st)}}else{if(Re===0)return[];ge.splice(Re,1),Re-=1,Ve-=1}else{qe[Ce]=z(qe[Ce],rt);for(var ut=0,ct=Ze.length;ut<ct;ut++){var at=Ze[ut];qe[at]=Y(qe[at],q(qe[Ce],et[ut]))}}}return ge.map(dt=>new ie({data:dt.map(xt=>[xt]),size:[ve,1]}))}}),name$2I="matAlgo08xS0Sid",dependencies$2I=["typed","equalScalar"],createMatAlgo08xS0Sid=factory(name$2I,dependencies$2I,v=>{var{typed:N,equalScalar:G}=v;return function(q,Y,W){var ie=q._values,ne=q._index,se=q._ptr,ae=q._size,ce=q._datatype,pe=Y._values,ge=Y._index,ve=Y._ptr,be=Y._size,Ee=Y._datatype;if(ae.length!==be.length)throw new DimensionError(ae.length,be.length);if(ae[0]!==be[0]||ae[1]!==be[1])throw new RangeError("Dimension mismatch. Matrix A ("+ae+") must match Matrix B ("+be+")");if(!ie||!pe)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var Pe=ae[0],Je=ae[1],Ce,Ve=G,Re=0,qe=W;typeof ce=="string"&&ce===Ee&&(Ce=ce,Ve=N.find(G,[Ce,Ce]),Re=N.convert(0,Ce),qe=N.find(W,[Ce,Ce]));for(var et=[],Ze=[],tt=[],Ke=[],rt=[],it,ot,ut,ct,at=0;at<Je;at++){tt[at]=Ze.length;var st=at+1;for(ot=se[at],ut=se[at+1],it=ot;it<ut;it++)ct=ne[it],rt[ct]=st,Ke[ct]=ie[it],Ze.push(ct);for(ot=ve[at],ut=ve[at+1],it=ot;it<ut;it++)ct=ge[it],rt[ct]===st&&(Ke[ct]=qe(Ke[ct],pe[it]));for(it=tt[at];it<Ze.length;){ct=Ze[it];var pt=Ke[ct];Ve(pt,Re)?Ze.splice(it,1):(et.push(pt),it++)}}return tt[Je]=Ze.length,q.createSparseMatrix({values:et,index:Ze,ptr:tt,size:[Pe,Je],datatype:Ce})}}),createUseMatrixForArrayScalar=factory("useMatrixForArrayScalar",["typed","matrix"],v=>{var{typed:N,matrix:G}=v;return{"Array, number":N.referTo("DenseMatrix, number",z=>(q,Y)=>z(G(q),Y).valueOf()),"Array, BigNumber":N.referTo("DenseMatrix, BigNumber",z=>(q,Y)=>z(G(q),Y).valueOf()),"number, Array":N.referTo("number, DenseMatrix",z=>(q,Y)=>z(q,G(Y)).valueOf()),"BigNumber, Array":N.referTo("BigNumber, DenseMatrix",z=>(q,Y)=>z(q,G(Y)).valueOf())}}),name$2H="leftShift",dependencies$2H=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],createLeftShift=factory(name$2H,dependencies$2H,v=>{var{typed:N,matrix:G,equalScalar:z,zeros:q,DenseMatrix:Y,concat:W}=v,ie=createMatAlgo01xDSid({typed:N}),ne=createMatAlgo02xDS0({typed:N,equalScalar:z}),se=createMatAlgo08xS0Sid({typed:N,equalScalar:z}),ae=createMatAlgo10xSids({typed:N,DenseMatrix:Y}),ce=createMatAlgo11xS0s({typed:N,equalScalar:z}),pe=createMatAlgo14xDs({typed:N}),ge=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:W}),ve=createUseMatrixForArrayScalar({typed:N,matrix:G});return N(name$2H,{"number, number":leftShiftNumber,"BigNumber, BigNumber":leftShiftBigNumber,"SparseMatrix, number | BigNumber":N.referToSelf(be=>(Ee,Pe)=>z(Pe,0)?Ee.clone():ce(Ee,Pe,be,!1)),"DenseMatrix, number | BigNumber":N.referToSelf(be=>(Ee,Pe)=>z(Pe,0)?Ee.clone():pe(Ee,Pe,be,!1)),"number | BigNumber, SparseMatrix":N.referToSelf(be=>(Ee,Pe)=>z(Ee,0)?q(Pe.size(),Pe.storage()):ae(Pe,Ee,be,!0)),"number | BigNumber, DenseMatrix":N.referToSelf(be=>(Ee,Pe)=>z(Ee,0)?q(Pe.size(),Pe.storage()):pe(Pe,Ee,be,!0))},ve,ge({SS:se,DS:ie,SD:ne}))}),name$2G="rightArithShift",dependencies$2G=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],createRightArithShift=factory(name$2G,dependencies$2G,v=>{var{typed:N,matrix:G,equalScalar:z,zeros:q,DenseMatrix:Y,concat:W}=v,ie=createMatAlgo01xDSid({typed:N}),ne=createMatAlgo02xDS0({typed:N,equalScalar:z}),se=createMatAlgo08xS0Sid({typed:N,equalScalar:z}),ae=createMatAlgo10xSids({typed:N,DenseMatrix:Y}),ce=createMatAlgo11xS0s({typed:N,equalScalar:z}),pe=createMatAlgo14xDs({typed:N}),ge=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:W}),ve=createUseMatrixForArrayScalar({typed:N,matrix:G});return N(name$2G,{"number, number":rightArithShiftNumber,"BigNumber, BigNumber":rightArithShiftBigNumber,"SparseMatrix, number | BigNumber":N.referToSelf(be=>(Ee,Pe)=>z(Pe,0)?Ee.clone():ce(Ee,Pe,be,!1)),"DenseMatrix, number | BigNumber":N.referToSelf(be=>(Ee,Pe)=>z(Pe,0)?Ee.clone():pe(Ee,Pe,be,!1)),"number | BigNumber, SparseMatrix":N.referToSelf(be=>(Ee,Pe)=>z(Ee,0)?q(Pe.size(),Pe.storage()):ae(Pe,Ee,be,!0)),"number | BigNumber, DenseMatrix":N.referToSelf(be=>(Ee,Pe)=>z(Ee,0)?q(Pe.size(),Pe.storage()):pe(Pe,Ee,be,!0))},ve,ge({SS:se,DS:ie,SD:ne}))}),name$2F="rightLogShift",dependencies$2F=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],createRightLogShift=factory(name$2F,dependencies$2F,v=>{var{typed:N,matrix:G,equalScalar:z,zeros:q,DenseMatrix:Y,concat:W}=v,ie=createMatAlgo01xDSid({typed:N}),ne=createMatAlgo02xDS0({typed:N,equalScalar:z}),se=createMatAlgo08xS0Sid({typed:N,equalScalar:z}),ae=createMatAlgo10xSids({typed:N,DenseMatrix:Y}),ce=createMatAlgo11xS0s({typed:N,equalScalar:z}),pe=createMatAlgo14xDs({typed:N}),ge=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:W}),ve=createUseMatrixForArrayScalar({typed:N,matrix:G});return N(name$2F,{"number, number":rightLogShiftNumber,"SparseMatrix, number | BigNumber":N.referToSelf(be=>(Ee,Pe)=>z(Pe,0)?Ee.clone():ce(Ee,Pe,be,!1)),"DenseMatrix, number | BigNumber":N.referToSelf(be=>(Ee,Pe)=>z(Pe,0)?Ee.clone():pe(Ee,Pe,be,!1)),"number | BigNumber, SparseMatrix":N.referToSelf(be=>(Ee,Pe)=>z(Ee,0)?q(Pe.size(),Pe.storage()):ae(Pe,Ee,be,!0)),"number | BigNumber, DenseMatrix":N.referToSelf(be=>(Ee,Pe)=>z(Ee,0)?q(Pe.size(),Pe.storage()):pe(Pe,Ee,be,!0))},ve,ge({SS:se,DS:ie,SD:ne}))}),name$2E="and",dependencies$2E=["typed","matrix","equalScalar","zeros","not","concat"],createAnd=factory(name$2E,dependencies$2E,v=>{var{typed:N,matrix:G,equalScalar:z,zeros:q,not:Y,concat:W}=v,ie=createMatAlgo02xDS0({typed:N,equalScalar:z}),ne=createMatAlgo06xS0S0({typed:N,equalScalar:z}),se=createMatAlgo11xS0s({typed:N,equalScalar:z}),ae=createMatAlgo14xDs({typed:N}),ce=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:W});return N(name$2E,{"number, number":andNumber,"Complex, Complex":function(ge,ve){return(ge.re!==0||ge.im!==0)&&(ve.re!==0||ve.im!==0)},"BigNumber, BigNumber":function(ge,ve){return!ge.isZero()&&!ve.isZero()&&!ge.isNaN()&&!ve.isNaN()},"Unit, Unit":N.referToSelf(pe=>(ge,ve)=>pe(ge.value||0,ve.value||0)),"SparseMatrix, any":N.referToSelf(pe=>(ge,ve)=>Y(ve)?q(ge.size(),ge.storage()):se(ge,ve,pe,!1)),"DenseMatrix, any":N.referToSelf(pe=>(ge,ve)=>Y(ve)?q(ge.size(),ge.storage()):ae(ge,ve,pe,!1)),"any, SparseMatrix":N.referToSelf(pe=>(ge,ve)=>Y(ge)?q(ge.size(),ge.storage()):se(ve,ge,pe,!0)),"any, DenseMatrix":N.referToSelf(pe=>(ge,ve)=>Y(ge)?q(ge.size(),ge.storage()):ae(ve,ge,pe,!0)),"Array, any":N.referToSelf(pe=>(ge,ve)=>pe(G(ge),ve).valueOf()),"any, Array":N.referToSelf(pe=>(ge,ve)=>pe(ge,G(ve)).valueOf())},ce({SS:ne,DS:ie}))}),name$2D="compare",dependencies$2D=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],createCompare=factory(name$2D,dependencies$2D,v=>{var{typed:N,config:G,equalScalar:z,matrix:q,BigNumber:Y,Fraction:W,DenseMatrix:ie,concat:ne}=v,se=createMatAlgo03xDSf({typed:N}),ae=createMatAlgo05xSfSf({typed:N,equalScalar:z}),ce=createMatAlgo12xSfs({typed:N,DenseMatrix:ie}),pe=createMatrixAlgorithmSuite({typed:N,matrix:q,concat:ne}),ge=createCompareUnits({typed:N});return N(name$2D,createCompareNumber({typed:N,config:G}),{"boolean, boolean":function(be,Ee){return be===Ee?0:be>Ee?1:-1},"BigNumber, BigNumber":function(be,Ee){return nearlyEqual(be,Ee,G.epsilon)?new Y(0):new Y(be.cmp(Ee))},"Fraction, Fraction":function(be,Ee){return new W(be.compare(Ee))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},ge,pe({SS:ae,DS:se,Ss:ce}))}),createCompareNumber=factory(name$2D,["typed","config"],v=>{var{typed:N,config:G}=v;return N(name$2D,{"number, number":function(q,Y){return nearlyEqual$1(q,Y,G.epsilon)?0:q>Y?1:-1}})}),naturalSort$1,hasRequiredNaturalSort;function requireNaturalSort(){return hasRequiredNaturalSort||(hasRequiredNaturalSort=1,naturalSort$1=function v(N,G){var z=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,q=/(^[ ]*|[ ]*$)/g,Y=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,W=/^0x[0-9a-f]+$/i,ie=/^0/,ne=function(Ce){return v.insensitive&&(""+Ce).toLowerCase()||""+Ce},se=ne(N).replace(q,"")||"",ae=ne(G).replace(q,"")||"",ce=se.replace(z,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),pe=ae.replace(z,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),ge=parseInt(se.match(W),16)||ce.length!==1&&se.match(Y)&&Date.parse(se),ve=parseInt(ae.match(W),16)||ge&&ae.match(Y)&&Date.parse(ae)||null,be,Ee;if(ve){if(ge<ve)return-1;if(ge>ve)return 1}for(var Pe=0,Je=Math.max(ce.length,pe.length);Pe<Je;Pe++){if(be=!(ce[Pe]||"").match(ie)&&parseFloat(ce[Pe])||ce[Pe]||0,Ee=!(pe[Pe]||"").match(ie)&&parseFloat(pe[Pe])||pe[Pe]||0,isNaN(be)!==isNaN(Ee))return isNaN(be)?1:-1;if(typeof be!=typeof Ee&&(be+="",Ee+=""),be<Ee)return-1;if(be>Ee)return 1}return 0}),naturalSort$1}var naturalSortExports=requireNaturalSort();const naturalSort=getDefaultExportFromCjs(naturalSortExports);var name$2C="compareNatural",dependencies$2C=["typed","compare"],createCompareNatural=factory(name$2C,dependencies$2C,v=>{var{typed:N,compare:G}=v,z=G.signatures["boolean,boolean"];return N(name$2C,{"any, any":q});function q(ne,se){var ae=typeOf(ne),ce=typeOf(se),pe;if((ae==="number"||ae==="BigNumber"||ae==="Fraction")&&(ce==="number"||ce==="BigNumber"||ce==="Fraction"))return pe=G(ne,se),pe.toString()!=="0"?pe>0?1:-1:naturalSort(ae,ce);var ge=["Array","DenseMatrix","SparseMatrix"];if(ge.includes(ae)||ge.includes(ce))return pe=Y(q,ne,se),pe!==0?pe:naturalSort(ae,ce);if(ae!==ce)return naturalSort(ae,ce);if(ae==="Complex")return compareComplexNumbers(ne,se);if(ae==="Unit")return ne.equalBase(se)?q(ne.value,se.value):W(q,ne.formatUnits(),se.formatUnits());if(ae==="boolean")return z(ne,se);if(ae==="string")return naturalSort(ne,se);if(ae==="Object")return ie(q,ne,se);if(ae==="null"||ae==="undefined")return 0;throw new TypeError('Unsupported type of value "'+ae+'"')}function Y(ne,se,ae){return isSparseMatrix(se)&&isSparseMatrix(ae)?W(ne,se.toJSON().values,ae.toJSON().values):isSparseMatrix(se)?Y(ne,se.toArray(),ae):isSparseMatrix(ae)?Y(ne,se,ae.toArray()):isDenseMatrix(se)?Y(ne,se.toJSON().data,ae):isDenseMatrix(ae)?Y(ne,se,ae.toJSON().data):Array.isArray(se)?Array.isArray(ae)?W(ne,se,ae):Y(ne,se,[ae]):Y(ne,[se],ae)}function W(ne,se,ae){for(var ce=0,pe=Math.min(se.length,ae.length);ce<pe;ce++){var ge=ne(se[ce],ae[ce]);if(ge!==0)return ge}return se.length>ae.length?1:se.length<ae.length?-1:0}function ie(ne,se,ae){var ce=Object.keys(se),pe=Object.keys(ae);ce.sort(naturalSort),pe.sort(naturalSort);var ge=W(ne,ce,pe);if(ge!==0)return ge;for(var ve=0;ve<ce.length;ve++){var be=ne(se[ce[ve]],ae[pe[ve]]);if(be!==0)return be}return 0}});function compareComplexNumbers(v,N){return v.re>N.re?1:v.re<N.re?-1:v.im>N.im?1:v.im<N.im?-1:0}var name$2B="compareText",dependencies$2B=["typed","matrix","concat"];compareText.signature="any, any";var createCompareText=factory(name$2B,dependencies$2B,v=>{var{typed:N,matrix:G,concat:z}=v,q=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:z});return N(name$2B,compareText,q({elop:compareText,Ds:!0}))}),name$2A="equal",dependencies$2A=["typed","matrix","equalScalar","DenseMatrix","concat"],createEqual=factory(name$2A,dependencies$2A,v=>{var{typed:N,matrix:G,equalScalar:z,DenseMatrix:q,concat:Y}=v,W=createMatAlgo03xDSf({typed:N}),ie=createMatAlgo07xSSf({typed:N,DenseMatrix:q}),ne=createMatAlgo12xSfs({typed:N,DenseMatrix:q}),se=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:Y});return N(name$2A,createEqualNumber({typed:N,equalScalar:z}),se({elop:z,SS:ie,DS:W,Ss:ne}))}),createEqualNumber=factory(name$2A,["typed","equalScalar"],v=>{var{typed:N,equalScalar:G}=v;return N(name$2A,{"any, any":function(q,Y){return q===null?Y===null:Y===null?q===null:q===void 0?Y===void 0:Y===void 0?q===void 0:G(q,Y)}})}),name$2z="equalText",dependencies$2z=["typed","compareText","isZero"],createEqualText=factory(name$2z,dependencies$2z,v=>{var{typed:N,compareText:G,isZero:z}=v;return N(name$2z,{"any, any":function(Y,W){return z(G(Y,W))}})}),name$2y="smaller",dependencies$2y=["typed","config","matrix","DenseMatrix","concat"],createSmaller=factory(name$2y,dependencies$2y,v=>{var{typed:N,config:G,matrix:z,DenseMatrix:q,concat:Y}=v,W=createMatAlgo03xDSf({typed:N}),ie=createMatAlgo07xSSf({typed:N,DenseMatrix:q}),ne=createMatAlgo12xSfs({typed:N,DenseMatrix:q}),se=createMatrixAlgorithmSuite({typed:N,matrix:z,concat:Y}),ae=createCompareUnits({typed:N});return N(name$2y,createSmallerNumber({typed:N,config:G}),{"boolean, boolean":(ce,pe)=>ce<pe,"BigNumber, BigNumber":function(pe,ge){return pe.lt(ge)&&!nearlyEqual(pe,ge,G.epsilon)},"Fraction, Fraction":(ce,pe)=>ce.compare(pe)===-1,"Complex, Complex":function(pe,ge){throw new TypeError("No ordering relation is defined for c
445omplex numbers")}},ae,se({SS:ie,DS:W,Ss:ne}))}),createSmallerNumber=factory(name$2y,["typed","config"],v=>{var{typed:N,config:G}=v;return N(name$2y,{"number, number":function(q,Y){return q<Y&&!nearlyEqual$1(q,Y,G.epsilon)}})}),name$2x="smallerEq",dependencies$2x=["typed","config","matrix","DenseMatrix","concat"],createSmallerEq=factory(name$2x,dependencies$2x,v=>{var{typed:N,config:G,matrix:z,DenseMatrix:q,concat:Y}=v,W=createMatAlgo03xDSf({typed:N}),ie=createMatAlgo07xSSf({typed:N,DenseMatrix:q}),ne=createMatAlgo12xSfs({typed:N,DenseMatrix:q}),se=createMatrixAlgorithmSuite({typed:N,matrix:z,concat:Y}),ae=createCompareUnits({typed:N});return N(name$2x,createSmallerEqNumber({typed:N,config:G}),{"boolean, boolean":(ce,pe)=>ce<=pe,"BigNumber, BigNumber":function(pe,ge){return pe.lte(ge)||nearlyEqual(pe,ge,G.epsilon)},"Fraction, Fraction":(ce,pe)=>ce.compare(pe)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},ae,se({SS:ie,DS:W,Ss:ne}))}),createSmallerEqNumber=factory(name$2x,["typed","config"],v=>{var{typed:N,config:G}=v;return N(name$2x,{"number, number":function(q,Y){return q<=Y||nearlyEqual$1(q,Y,G.epsilon)}})}),name$2w="larger",dependencies$2w=["typed","config","matrix","DenseMatrix","concat"],createLarger=factory(name$2w,dependencies$2w,v=>{var{typed:N,config:G,matrix:z,DenseMatrix:q,concat:Y}=v,W=createMatAlgo03xDSf({typed:N}),ie=createMatAlgo07xSSf({typed:N,DenseMatrix:q}),ne=createMatAlgo12xSfs({typed:N,DenseMatrix:q}),se=createMatrixAlgorithmSuite({typed:N,matrix:z,concat:Y}),ae=createCompareUnits({typed:N});return N(name$2w,createLargerNumber({typed:N,config:G}),{"boolean, boolean":(ce,pe)=>ce>pe,"BigNumber, BigNumber":function(pe,ge){return pe.gt(ge)&&!nearlyEqual(pe,ge,G.epsilon)},"Fraction, Fraction":(ce,pe)=>ce.compare(pe)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},ae,se({SS:ie,DS:W,Ss:ne}))}),createLargerNumber=factory(name$2w,["typed","config"],v=>{var{typed:N,config:G}=v;return N(name$2w,{"number, number":function(q,Y){return q>Y&&!nearlyEqual$1(q,Y,G.epsilon)}})}),name$2v="largerEq",dependencies$2v=["typed","config","matrix","DenseMatrix","concat"],createLargerEq=factory(name$2v,dependencies$2v,v=>{var{typed:N,config:G,matrix:z,DenseMatrix:q,concat:Y}=v,W=createMatAlgo03xDSf({typed:N}),ie=createMatAlgo07xSSf({typed:N,DenseMatrix:q}),ne=createMatAlgo12xSfs({typed:N,DenseMatrix:q}),se=createMatrixAlgorithmSuite({typed:N,matrix:z,concat:Y}),ae=createCompareUnits({typed:N});return N(name$2v,createLargerEqNumber({typed:N,config:G}),{"boolean, boolean":(ce,pe)=>ce>=pe,"BigNumber, BigNumber":function(pe,ge){return pe.gte(ge)||nearlyEqual(pe,ge,G.epsilon)},"Fraction, Fraction":(ce,pe)=>ce.compare(pe)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},ae,se({SS:ie,DS:W,Ss:ne}))}),createLargerEqNumber=factory(name$2v,["typed","config"],v=>{var{typed:N,config:G}=v;return N(name$2v,{"number, number":function(q,Y){return q>=Y||nearlyEqual$1(q,Y,G.epsilon)}})}),name$2u="deepEqual",dependencies$2u=["typed","equal"],createDeepEqual=factory(name$2u,dependencies$2u,v=>{var{typed:N,equal:G}=v;return N(name$2u,{"any, any":function(Y,W){return z(Y.valueOf(),W.valueOf())}});function z(q,Y){if(Array.isArray(q))if(Array.isArray(Y)){var W=q.length;if(W!==Y.length)return!1;for(var ie=0;ie<W;ie++)if(!z(q[ie],Y[ie]))return!1;return!0}else return!1;else return Array.isArray(Y)?!1:G(q,Y)}}
vendor: 18,525 bytes, line 445
445),name$2t="unequal",dependencies$2t=["typed","config","equalScalar","matrix","DenseMatrix","concat"],createUnequal=factory(name$2t,dependencies$2t,v=>{var{typed:N,config:G,equalScalar:z,matrix:q,DenseMatrix:Y,concat:W}=v,ie=createMatAlgo03xDSf({typed:N}),ne=createMatAlgo07xSSf({typed:N,DenseMatrix:Y}),se=createMatAlgo12xSfs({typed:N,DenseMatrix:Y}),ae=createMatrixAlgorithmSuite({typed:N,matrix:q,concat:W});return N(name$2t,createUnequalNumber({typed:N,equalScalar:z}),ae({elop:ce,SS:ne,DS:ie,Ss:se}));function ce(pe,ge){return!z(pe,ge)}}),createUnequalNumber=factory(name$2t,["typed","equalScalar"],v=>{var{typed:N,equalScalar:G}=v;return N(name$2t,{"any, any":function(q,Y){return q===null?Y!==null:Y===null?q!==null:q===void 0?Y!==void 0:Y===void 0?q!==void 0:!G(q,Y)}})}),name$2s="partitionSelect",dependencies$2s=["typed","isNumeric","isNaN","compare"],createPartitionSelect=factory(name$2s,dependencies$2s,v=>{var{typed:N,isNumeric:G,isNaN:z,compare:q}=v,Y=q,W=(se,ae)=>-q(se,ae);return N(name$2s,{"Array | Matrix, number":function(ae,ce){return ie(ae,ce,Y)},"Array | Matrix, number, string":function(ae,ce,pe){if(pe==="asc")return ie(ae,ce,Y);if(pe==="desc")return ie(ae,ce,W);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":ie});function ie(se,ae,ce){if(!isInteger(ae)||ae<0)throw new Error("k must be a non-negative integer");if(isMatrix(se)){var pe=se.size();if(pe.length>1)throw new Error("Only one dimensional matrices supported");return ne(se.valueOf(),ae,ce)}if(Array.isArray(se))return ne(se,ae,ce)}function ne(se,ae,ce){if(ae>=se.length)throw new Error("k out of bounds");for(var pe=0;pe<se.length;pe++)if(G(se[pe])&&z(se[pe]))return se[pe];for(var ge=0,ve=se.length-1;ge<ve;){for(var be=ge,Ee=ve,Pe=se[Math.floor(Math.random()*(ve-ge+1))+ge];be<Ee;)if(ce(se[be],Pe)>=0){var Je=se[Ee];se[Ee]=se[be],se[be]=Je,--Ee}else++be;ce(se[be],Pe)>0&&--be,ae<=be?ve=be:ge=be+1}return se[ae]}}),name$2r="sort",dependencies$2r=["typed","matrix","compare","compareNatural"],createSort=factory(name$2r,dependencies$2r,v=>{var{typed:N,matrix:G,compare:z,compareNatural:q}=v,Y=z,W=(ae,ce)=>-z(ae,ce);return N(name$2r,{Array:function(ce){return ne(ce),ce.sort(Y)},Matrix:function(ce){return se(ce),G(ce.toArray().sort(Y),ce.storage())},"Array, function":function(ce,pe){return ne(ce),ce.sort(pe)},"Matrix, function":function(ce,pe){return se(ce),G(ce.toArray().sort(pe),ce.storage())},"Array, string":function(ce,pe){return ne(ce),ce.sort(ie(pe))},"Matrix, string":function(ce,pe){return se(ce),G(ce.toArray().sort(ie(pe)),ce.storage())}});function ie(ae){if(ae==="asc")return Y;if(ae==="desc")return W;if(ae==="natural")return q;throw new Error('String "asc", "desc", or "natural" expected')}function ne(ae){if(arraySize(ae).length!==1)throw new Error("One dimensional array expected")}function se(ae){if(ae.size().length!==1)throw new Error("One dimensional matrix expected")}}),name$2q="max",dependencies$2q=["typed","config","numeric","larger"],createMax=factory(name$2q,dependencies$2q,v=>{var{typed:N,config:G,numeric:z,larger:q}=v;return N(name$2q,{"Array | Matrix":W,"Array | Matrix, number | BigNumber":function(ne,se){return reduce(ne,se.valueOf(),Y)},"...":function(ne){if(containsCollections(ne))throw new TypeError("Scalar values expected in function max");return W(ne)}});function Y(ie,ne){try{return q(ie,ne)?ie:ne}catch(se){throw improveErrorMessage(se,"max",ne)}}function W(ie){var ne;if(deepForEach(ie,function(se){try{isNaN(se)&&typeof se=="number"?ne=NaN:(ne===void 0||q(se,ne))&&(ne=se)}catch(ae){throw improveErrorMessage(ae,"max",se)}}),ne===void 0)throw new Error("Cannot calculate max of an empty array");return typeof ne=="string"&&(ne=z(ne,G.number)),ne}}),name$2p="min",dependencies$2p=["typed","config","numeric","smaller"],createMin=factory(name$2p,dependencies$2p,v=>{var{typed:N,config:G,numeric:z,smaller:q}=v;return N(name$2p,{"Array | Matrix":W,"Array | Matrix, number | BigNumber":function(ne,se){return reduce(ne,se.valueOf(),Y)},"...":function(ne){if(containsCollections(ne))throw new TypeError("Scalar values expected in function min");return W(ne)}});function Y(ie,ne){try{return q(ie,ne)?ie:ne}catch(se){throw improveErrorMessage(se,"min",ne)}}function W(ie){var ne;if(deepForEach(ie,function(se){try{isNaN(se)&&typeof se=="number"?ne=NaN:(ne===void 0||q(se,ne))&&(ne=se)}catch(ae){throw improveErrorMessage(ae,"min",se)}}),ne===void 0)throw new Error("Cannot calculate min of an empty array");return typeof ne=="string"&&(ne=z(ne,G.number)),ne}}),name$2o="ImmutableDenseMatrix",dependencies$2o=["smaller","DenseMatrix"],createImmutableDenseMatrixClass=factory(name$2o,dependencies$2o,v=>{var{smaller:N,DenseMatrix:G}=v;function z(q,Y){if(!(this instanceof z))throw new SyntaxError("Constructor must be called with the new operator");if(Y&&!isString(Y))throw new Error("Invalid datatype: "+Y);if(isMatrix(q)||isArray(q)){var W=new G(q,Y);this._data=W._data,this._size=W._size,this._datatype=W._datatype,this._min=null,this._max=null}else if(q&&isArray(q.data)&&isArray(q.size))this._data=q.data,this._size=q.size,this._datatype=q.datatype,this._min=typeof q.min<"u"?q.min:null,this._max=typeof q.max<"u"?q.max:null;else{if(q)throw new TypeError("Unsupported type of data ("+typeOf(q)+")");this._data=[],this._size=[0],this._datatype=Y,this._min=null,this._max=null}}return z.prototype=new G,z.prototype.type="ImmutableDenseMatrix",z.prototype.isImmutableDenseMatrix=!0,z.prototype.subset=function(q){switch(arguments.length){case 1:{var Y=G.prototype.subset.call(this,q);return isMatrix(Y)?new z({data:Y._data,size:Y._size,datatype:Y._datatype}):Y}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},z.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},z.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},z.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},z.prototype.clone=function(){return new z({data:clone$2(this._data),size:clone$2(this._size),datatype:this._datatype})},z.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},z.fromJSON=function(q){return new z(q)},z.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},z.prototype.min=function(){if(this._min===null){var q=null;this.forEach(function(Y){(q===null||N(Y,q))&&(q=Y)}),this._min=q!==null?q:void 0}return this._min},z.prototype.max=function(){if(this._max===null){var q=null;this.forEach(function(Y){(q===null||N(q,Y))&&(q=Y)}),this._max=q!==null?q:void 0}return this._max},z},{isClass:!0}),name$2n="Index",dependencies$2n=["ImmutableDenseMatrix","getMatrixDataType"],createIndexClass=factory(name$2n,dependencies$2n,v=>{var{ImmutableDenseMatrix:N,getMatrixDataType:G}=v;function z(Y){if(!(this instanceof z))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var W=0,ie=arguments.length;W<ie;W++){var ne=arguments[W],se=isArray(ne),ae=isMatrix(ne),ce=null;if(isRange(ne))this._dimensions.push(ne),this._isScalar=!1;else if(se||ae){var pe=void 0;G(ne)==="boolean"?(se&&(pe=q(_booleansArrayToNumbersForIndex(ne).valueOf())),ae&&(pe=q(_booleansArrayToNumbersForIndex(ne._data).valueOf())),ce=ne.valueOf().length):pe=q(ne.valueOf()),this._dimensions.push(pe);var ge=pe.size();(ge.length!==1||ge[0]!==1||ce!==null)&&(this._isScalar=!1)}else if(typeof ne=="number")this._dimensions.push(q([ne]));else if(typeof ne=="string")this._dimensions.push(ne);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(ce)}}z.prototype.type="Index",z.prototype.isIndex=!0;function q(Y){for(var W=0,ie=Y.length;W<ie;W++)if(typeof Y[W]!="number"||!isInteger(Y[W]))throw new TypeError("Index parameters must be positive integer numbers");return new N(Y)}return z.prototype.clone=function(){var Y=new z;return Y._dimensions=clone$2(this._dimensions),Y._isScalar=this._isScalar,Y._sourceSize=this._sourceSize,Y},z.create=function(Y){var W=new z;return z.apply(W,Y),W},z.prototype.size=function(){for(var Y=[],W=0,ie=this._dimensions.length;W<ie;W++){var ne=this._dimensions[W];Y[W]=typeof ne=="string"?1:ne.size()[0]}return Y},z.prototype.max=function(){for(var Y=[],W=0,ie=this._dimensions.length;W<ie;W++){var ne=this._dimensions[W];Y[W]=typeof ne=="string"?ne:ne.max()}return Y},z.prototype.min=function(){for(var Y=[],W=0,ie=this._dimensions.length;W<ie;W++){var ne=this._dimensions[W];Y[W]=typeof ne=="string"?ne:ne.min()}return Y},z.prototype.forEach=function(Y){for(var W=0,ie=this._dimensions.length;W<ie;W++)Y(this._dimensions[W],W,this)},z.prototype.dimension=function(Y){return this._dimensions[Y]||null},z.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},z.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},z.prototype.isScalar=function(){return this._isScalar},z.prototype.toArray=function(){for(var Y=[],W=0,ie=this._dimensions.length;W<ie;W++){var ne=this._dimensions[W];Y.push(typeof ne=="string"?ne:ne.toArray())}return Y},z.prototype.valueOf=z.prototype.toArray,z.prototype.toString=function(){for(var Y=[],W=0,ie=this._dimensions.length;W<ie;W++){var ne=this._dimensions[W];typeof ne=="string"?Y.push(JSON.stringify(ne)):Y.push(ne.toString())}return"["+Y.join(", ")+"]"},z.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},z.fromJSON=function(Y){return z.create(Y.dimensions)},z},{isClass:!0});function _booleansArrayToNumbersForIndex(v){var N=[];return v.forEach((G,z)=>{G&&N.push(z)}),N}var name$2m="FibonacciHeap",dependencies$2m=["smaller","larger"],createFibonacciHeapClass=factory(name$2m,dependencies$2m,v=>{var{smaller:N,larger:G}=v,z=1/Math.log((1+Math.sqrt(5))/2);function q(){if(!(this instanceof q))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}q.prototype.type="FibonacciHeap",q.prototype.isFibonacciHeap=!0,q.prototype.insert=function(ae,ce){var pe={key:ae,value:ce,degree:0};if(this._minimum){var ge=this._minimum;pe.left=ge,pe.right=ge.right,ge.right=pe,pe.right.left=pe,N(ae,ge.key)&&(this._minimum=pe)}else pe.left=pe,pe.right=pe,this._minimum=pe;return this._size++,pe},q.prototype.size=function(){return this._size},q.prototype.clear=function(){this._minimum=null,this._size=0},q.prototype.isEmpty=function(){return this._size===0},q.prototype.extractMinimum=function(){var ae=this._minimum;if(ae===null)return ae;for(var ce=this._minimum,pe=ae.degree,ge=ae.child;pe>0;){var ve=ge.right;ge.left.right=ge.right,ge.right.left=ge.left,ge.left=ce,ge.right=ce.right,ce.right=ge,ge.right.left=ge,ge.parent=null,ge=ve,pe--}return ae.left.right=ae.right,ae.right.left=ae.left,ae===ae.right?ce=null:(ce=ae.right,ce=se(ce,this._size)),this._size--,this._minimum=ce,ae},q.prototype.remove=function(ae){this._minimum=Y(this._minimum,ae,-1),this.extractMinimum()};function Y(ae,ce,pe){ce.key=pe;var ge=ce.parent;return ge&&N(ce.key,ge.key)&&(W(ae,ce,ge),ie(ae,ge)),N(ce.key,ae.key)&&(ae=ce),ae}function W(ae,ce,pe){ce.left.right=ce.right,ce.right.left=ce.left,pe.degree--,pe.child===ce&&(pe.child=ce.right),pe.degree===0&&(pe.child=null),ce.left=ae,ce.right=ae.right,ae.right=ce,ce.right.left=ce,ce.parent=null,ce.mark=!1}function ie(ae,ce){var pe=ce.parent;pe&&(ce.mark?(W(ae,ce,pe),ie(pe)):ce.mark=!0)}var ne=function(ce,pe){ce.left.right=ce.right,ce.right.left=ce.left,ce.parent=pe,pe.child?(ce.left=pe.child,ce.right=pe.child.right,pe.child.right=ce,ce.right.left=ce):(pe.child=ce,ce.right=ce,ce.left=ce),pe.degree++,ce.mark=!1};function se(ae,ce){var pe=Math.floor(Math.log(ce)*z)+1,ge=new Array(pe),ve=0,be=ae;if(be)for(ve++,be=be.right;be!==ae;)ve++,be=be.right;for(var Ee;ve>0;){for(var Pe=be.degree,Je=be.right;Ee=ge[Pe],!!Ee;){if(G(be.key,Ee.key)){var Ce=Ee;Ee=be,be=Ce}ne(Ee,be),ge[Pe]=null,Pe++}ge[Pe]=be,be=Je,ve--}ae=null;for(var Ve=0;Ve<pe;Ve++)Ee=ge[Ve],Ee&&(ae?(Ee.left.right=Ee.right,Ee.right.left=Ee.left,Ee.left=ae,Ee.right=ae.right,ae.right=Ee,Ee.right.left=Ee,N(Ee.key,ae.key)&&(ae=Ee)):ae=Ee);return ae}return q},{isClass:!0}),name$2l="Spa",dependencies$2l=["addScalar","equalScalar","FibonacciHeap"],createSpaClass=factory(name$2l,dependencies$2l,v=>{var{addScalar:N,equalScalar:G,FibonacciHeap:z}=v;function q(){if(!(this instanceof q))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new z}return q.prototype.type="Spa",q.prototype.isSpa=!0,q.prototype.set=function(Y,W){if(this._values[Y])this._values[Y].value=W;else{var ie=this._heap.insert(Y,W);this._values[Y]=ie}},q.prototype.get=function(Y){var W=this._values[Y];return W?W.value:0},q.prototype.accumulate=function(Y,W){var ie=this._values[Y];ie?ie.value=N(ie.value,W):(ie=this._heap.insert(Y,W),this._values[Y]=ie)},q.prototype.forEach=function(Y,W,ie){var ne=this._heap,se=this._values,ae=[],ce=ne.extractMinimum();for(ce&&ae.push(ce);ce&&ce.key<=W;)ce.key>=Y&&(G(ce.value,0)||ie(ce.key,ce.value,this)),ce=ne.extractMinimum(),ce&&ae.push(ce);for(var pe=0;pe<ae.length;pe++){var ge=ae[pe];ce=ne.insert(ge.key,ge.value),se[ce.key]=ce}},q.prototype.swap=function(Y,W){var ie=this._values[Y],ne=this._values[W];if(!ie&&ne)ie=this._heap.insert(Y,ne.value),this._heap.remove(ne),this._values[Y]=ie,this._values[W]=void 0;else if(ie&&!ne)ne=this._heap.insert(W,ie.value),this._heap.remove(ie),this._values[W]=ne,this._values[Y]=void 0;else if(ie&&ne){var se=ie.value;ie.value=ne.value,ne.value=se}},q},{isClass:!0}),createBigNumberE=memoize(function(v){return new v(1).exp()},{hasher}),createBigNumberPhi=memoize(function(v){return new v(1).plus(new v(5).sqrt()).div(2)},{hasher}),createBigNumberPi=memoize(function(v){return v.acos(-1)},{hasher}),createBigNumberTau=memoize(function(v){return createBigNumberPi(v).times(2)},{hasher});function hasher(v){return v[0].precision}function ownKeys$1(v,N){var G=Object.keys(v);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(v);N&&(z=z.filter(function(q){return Object.getOwnPropertyDescriptor(v,q).enumerable})),G.push.apply(G,z)}return G}function _objectSpread$1(v){for(var N=1;N<arguments.length;N++){var G=arguments[N]!=null?arguments[N]:{};N%2?ownKeys$1(Object(G),!0).forEach(function(z){_defineProperty(v,z,G[z])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(G)):ownKeys$1(Object(G)).forEach(function(z){Object.defineProperty(v,z,Object.getOwnPropertyDescriptor(G,z))})}return v}var name$2k="Unit",dependencies$2k=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],createUnitClass=factory(name$2k,dependencies$2k,v=>{var{on:N,config:G,addScalar:z,subtractScalar:q,multiplyScalar:Y,divideScalar:W,pow:ie,abs:ne,fix:se,round:ae,equal:ce,isNumeric:pe,format:ge,number:ve,Complex:be,BigNumber:Ee,Fraction:Pe}=v,Je=ve;function Ce(bt,_t){if(!(this instanceof Ce))throw new Error("Constructor must be called with the new operator");if(!(bt==null||pe(bt)||isComplex(bt)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,_t===void 0)this.units=[],this.dimensions=pt.map(At=>0);else if(typeof _t=="string"){var Xt=Ce.parse(_t);this.units=Xt.units,this.dimensions=Xt.dimensions}else if(isUnit(_t)&&_t.value===null)this.fixPrefix=_t.fixPrefix,this.skipAutomaticSimplification=_t.skipAutomaticSimplification,this.dimensions=_t.dimensions.slice(0),this.units=_t.units.map(At=>_extends({},At));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(bt)}Object.defineProperty(Ce,"name",{value:"Unit"}),Ce.prototype.constructor=Ce,Ce.prototype.type="Unit",Ce.prototype.isUnit=!0;var Ve,Re,qe;function et(){for(;qe===" "||qe==="	";)Ke()}function Ze(bt){return bt>="0"&&bt<="9"||bt==="."}function tt(bt){return bt>="0"&&bt<="9"}function Ke(){Re++,qe=Ve.charAt(Re)}function rt(bt){Re=bt,qe=Ve.charAt(Re)}function it(){var bt="",_t=Re;if(qe==="+"?Ke():qe==="-"&&(bt+=qe,Ke()),!Ze(qe))return rt(_t),null;if(qe==="."){if(bt+=qe,Ke(),!tt(qe))return rt(_t),null}else{for(;tt(qe);)bt+=qe,Ke();qe==="."&&(bt+=qe,Ke())}for(;tt(qe);)bt+=qe,Ke();if(qe==="E"||qe==="e"){var Xt="",At=Re;if(Xt+=qe,Ke(),(qe==="+"||qe==="-")&&(Xt+=qe,Ke()),!tt(qe))return rt(At),bt;for(bt=bt+Xt;tt(qe);)bt+=qe,Ke()}return bt}function ot(){for(var bt="";tt(qe)||Ce.isValidAlpha(qe);)bt+=qe,Ke();var _t=bt.charAt(0);return Ce.isValidAlpha(_t)?bt:null}function ut(bt){return qe===bt?(Ke(),bt):null}Ce.parse=function(bt,_t){if(_t=_t||{},Ve=bt,Re=-1,qe="",typeof Ve!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var Xt=new Ce;Xt.units=[];var At=1,$t=!1;Ke(),et();var Pt=it(),kt=null;if(Pt){if(G.number==="BigNumber")kt=new Ee(Pt);else if(G.number==="Fraction")try{kt=new Pe(Pt)}catch{kt=parseFloat(Pt)}else kt=parseFloat(Pt);et(),ut("*")?(At=1,$t=!0):ut("/")&&(At=-1,$t=!0)}for(var jt=[],wt=1;;){for(et();qe==="(";)jt.push(At),wt*=At,At=1,Ke(),et();var Mt=void 0;if(qe){var Tt=qe;if(Mt=ot(),Mt===null)throw new SyntaxError('Unexpected "'+Tt+'" in "'+Ve+'" at index '+Re.toString())}else break;var Rt=ct(Mt);if(Rt===null)throw new SyntaxError('Unit "'+Mt+'" not found.');var Ft=At*wt;if(et(),ut("^")){et();var Ut=it();if(Ut===null)throw new SyntaxError('In "'+bt+'", "^" must be followed by a floating-point number');Ft*=Ut}Xt.units.push({unit:Rt.unit,prefix:Rt.prefix,power:Ft});for(var Zt=0;Zt<pt.length;Zt++)Xt.dimensions[Zt]+=(Rt.unit.dimensions[Zt]||0)*Ft;for(et();qe===")";){if(jt.length===0)throw new SyntaxError('Unmatched ")" in "'+Ve+'" at index '+Re.toString());wt/=jt.pop(),Ke(),et()}if($t=!1,ut("*")?(At=1,$t=!0):ut("/")?(At=-1,$t=!0):At=1,Rt.unit.base){var Wt=Rt.unit.base.key;Dt.auto[Wt]={unit:Rt.unit,prefix:Rt.prefix}}}if(et(),qe)throw new SyntaxError('Could not parse: "'+bt+'"');if($t)throw new SyntaxError('Trailing characters: "'+bt+'"');if(jt.length!==0)throw new SyntaxError('Unmatched "(" in "'+Ve+'"');if(Xt.units.length===0&&!_t.allowNoUnits)throw new SyntaxError('"'+bt+'" contains 
445no units');return Xt.value=kt!==void 0?Xt._normalize(kt):null,Xt},Ce.prototype.clone=function(){var bt=new Ce;bt.fixPrefix=this.fixPrefix,bt.skipAutomaticSimplification=this.skipAutomaticSimplification,bt.value=clone$2(this.value),bt.dimensions=this.dimensions.slice(0),bt.units=[];for(var _t=0;_t<this.units.length;_t++){bt.units[_t]={};for(var Xt in this.units[_t])hasOwnProperty(this.units[_t],Xt)&&(bt.units[_t][Xt]=this.units[_t][Xt])}return bt},Ce.prototype.valueType=function(){return typeOf(this.value)},Ce.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},Ce.prototype._normalize=function(bt){if(bt==null||this.units.length===0)return bt;for(var _t=bt,Xt=Ce._getNumberConverter(typeOf(bt)),At=0;At<this.units.length;At++){var $t=Xt(this.units[At].unit.value),Pt=Xt(this.units[At].prefix.value),kt=Xt(this.units[At].power);_t=Y(_t,ie(Y($t,Pt),kt))}return _t},Ce.prototype._denormalize=function(bt,_t){if(bt==null||this.units.length===0)return bt;for(var Xt=bt,At=Ce._getNumberConverter(typeOf(bt)),$t=0;$t<this.units.length;$t++){var Pt=At(this.units[$t].unit.value),kt=At(this.units[$t].prefix.value),jt=At(this.units[$t].power);Xt=W(Xt,ie(Y(Pt,kt),jt))}return Xt};var ct=memoize(bt=>{if(hasOwnProperty(ft,bt)){var _t=ft[bt],Xt=_t.prefixes[""];return{unit:_t,prefix:Xt}}for(var At in ft)if(hasOwnProperty(ft,At)&&endsWith(bt,At)){var $t=ft[At],Pt=bt.length-At.length,kt=bt.substring(0,Pt),jt=hasOwnProperty($t.prefixes,kt)?$t.prefixes[kt]:void 0;if(jt!==void 0)return{unit:$t,prefix:jt}}return null},{hasher:bt=>bt[0],limit:100});Ce.isValuelessUnit=function(bt){return ct(bt)!==null},Ce.prototype.hasBase=function(bt){if(typeof bt=="string"&&(bt=lt[bt]),!bt)return!1;for(var _t=0;_t<pt.length;_t++)if(Math.abs((this.dimensions[_t]||0)-(bt.dimensions[_t]||0))>1e-12)return!1;return!0},Ce.prototype.equalBase=function(bt){for(var _t=0;_t<pt.length;_t++)if(Math.abs((this.dimensions[_t]||0)-(bt.dimensions[_t]||0))>1e-12)return!1;return!0},Ce.prototype.equals=function(bt){return this.equalBase(bt)&&ce(this.value,bt.value)},Ce.prototype.multiply=function(bt){for(var _t=this.clone(),Xt=isUnit(bt)?bt:new Ce(bt),At=0;At<pt.length;At++)_t.dimensions[At]=(this.dimensions[At]||0)+(Xt.dimensions[At]||0);for(var $t=0;$t<Xt.units.length;$t++){var Pt=_objectSpread$1({},Xt.units[$t]);_t.units.push(Pt)}if(this.value!==null||Xt.value!==null){var kt=this.value===null?this._normalize(1):this.value,jt=Xt.value===null?Xt._normalize(1):Xt.value;_t.value=Y(kt,jt)}else _t.value=null;return isUnit(bt)&&(_t.skipAutomaticSimplification=!1),at(_t)},Ce.prototype.divideInto=function(bt){return new Ce(bt).divide(this)},Ce.prototype.divide=function(bt){for(var _t=this.clone(),Xt=isUnit(bt)?bt:new Ce(bt),At=0;At<pt.length;At++)_t.dimensions[At]=(this.dimensions[At]||0)-(Xt.dimensions[At]||0);for(var $t=0;$t<Xt.units.length;$t++){var Pt=_objectSpread$1(_objectSpread$1({},Xt.units[$t]),{},{power:-Xt.units[$t].power});_t.units.push(Pt)}if(this.value!==null||Xt.value!==null){var kt=this.value===null?this._normalize(1):this.value,jt=Xt.value===null?Xt._normalize(1):Xt.value;_t.value=W(kt,jt)}else _t.value=null;return isUnit(bt)&&(_t.skipAutomaticSimplification=!1),at(_t)},Ce.prototype.pow=function(bt){for(var _t=this.clone(),Xt=0;Xt<pt.length;Xt++)_t.dimensions[Xt]=(this.dimensions[Xt]||0)*bt;for(var At=0;At<_t.units.length;At++)_t.units[At].power*=bt;return _t.value!==null?_t.value=ie(_t.value,bt):_t.value=null,_t.skipAutomaticSimplification=!1,at(_t)};function at(bt){return bt.equalBase(lt.NONE)&&bt.value!==null&&!G.predictable?bt.value:bt}Ce.prototype.abs=function(){var bt=this.clone();if(bt.value!==null)if(bt._isDerived()||bt.units[0].unit.offset===0)bt.value=ne(bt.value);else{var _t=bt._numberConverter(),Xt=_t(bt.units[0].unit.value),At=_t(bt.units[0].unit.offset),$t=Y(Xt,At);bt.value=q(ne(z(bt.value,$t)),$t)}for(var Pt in bt.units)(bt.units[Pt].unit.name==="VA"||bt.units[Pt].unit.name==="VAR")&&(bt.units[Pt].unit=ft.W);return bt},Ce.prototype.to=function(bt){var _t=this.value===null?this._normalize(1):this.value,Xt;if(typeof bt=="string")Xt=Ce.parse(bt);else if(isUnit(bt))Xt=bt.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(Xt))throw new Error("Units do not match ('".concat(Xt.toString(),"' != '").concat(this.toString(),"')"));if(Xt.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units[0].unit.offset===Xt.units[0].unit.offset)Xt.value=clone$2(_t);else{var At=Ce._getNumberConverter(typeOf(_t)),$t=this.units[0].unit.value,Pt=this.units[0].unit.offset,kt=Y($t,Pt),jt=Xt.units[0].unit.value,wt=Xt.units[0].unit.offset,Mt=Y(jt,wt);Xt.value=z(_t,At(q(kt,Mt)))}return Xt.fixPrefix=!0,Xt.skipAutomaticSimplification=!0,Xt},Ce.prototype.toNumber=function(bt){return Je(this.toNumeric(bt))},Ce.prototype.toNumeric=function(bt){var _t;return bt?_t=this.to(bt):_t=this.clone(),_t._isDerived()||_t.units.length===0?_t._denormalize(_t.value):_t._denormalize(_t.value,_t.units[0].prefix.value)},Ce.prototype.toString=function(){return this.format()},Ce.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},Ce.fromJSON=function(bt){var _t=new Ce(bt.value,bt.unit);return _t.fixPrefix=bt.fixPrefix||!1,_t},Ce.prototype.valueOf=Ce.prototype.toString,Ce.prototype.simplify=function(){var bt=this.clone(),_t=[],Xt;for(var At in Gt)if(hasOwnProperty(Gt,At)&&bt.hasBase(lt[At])){Xt=At;break}if(Xt==="NONE")bt.units=[];else{var $t;if(Xt&&hasOwnProperty(Gt,Xt)&&($t=Gt[Xt]),$t)bt.units=[{unit:$t.unit,prefix:$t.prefix,power:1}];else{for(var Pt=!1,kt=0;kt<pt.length;kt++){var jt=pt[kt];Math.abs(bt.dimensions[kt]||0)>1e-12&&(hasOwnProperty(Gt,jt)?_t.push({unit:Gt[jt].unit,prefix:Gt[jt].prefix,power:bt.dimensions[kt]||0}):Pt=!0)}_t.length<bt.units.length&&!Pt&&(bt.units=_t)}}return bt},Ce.prototype.toSI=function(){for(var bt=this.clone(),_t=[],Xt=0;Xt<pt.length;Xt++){var At=pt[Xt];
vendor: 10,232 bytes, line 445
445if(Math.abs(bt.dimensions[Xt]||0)>1e-12)if(hasOwnProperty(Dt.si,At))_t.push({unit:Dt.si[At].unit,prefix:Dt.si[At].prefix,power:bt.dimensions[Xt]||0});else throw new Error("Cannot express custom unit "+At+" in SI units")}return bt.units=_t,bt.fixPrefix=!0,bt.skipAutomaticSimplification=!0,bt},Ce.prototype.formatUnits=function(){for(var bt="",_t="",Xt=0,At=0,$t=0;$t<this.units.length;$t++)this.units[$t].power>0?(Xt++,bt+=" "+this.units[$t].prefix.name+this.units[$t].unit.name,Math.abs(this.units[$t].power-1)>1e-15&&(bt+="^"+this.units[$t].power)):this.units[$t].power<0&&At++;if(At>0)for(var Pt=0;Pt<this.units.length;Pt++)this.units[Pt].power<0&&(Xt>0?(_t+=" "+this.units[Pt].prefix.name+this.units[Pt].unit.name,Math.abs(this.units[Pt].power+1)>1e-15&&(_t+="^"+-this.units[Pt].power)):(_t+=" "+this.units[Pt].prefix.name+this.units[Pt].unit.name,_t+="^"+this.units[Pt].power));bt=bt.substr(1),_t=_t.substr(1),Xt>1&&At>0&&(bt="("+bt+")"),At>1&&Xt>0&&(_t="("+_t+")");var kt=bt;return Xt>0&&At>0&&(kt+=" / "),kt+=_t,kt},Ce.prototype.format=function(bt){var _t=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),Xt=!1;typeof _t.value<"u"&&_t.value!==null&&isComplex(_t.value)&&(Xt=Math.abs(_t.value.re)<1e-14);for(var At in _t.units)hasOwnProperty(_t.units,At)&&_t.units[At].unit&&(_t.units[At].unit.name==="VA"&&Xt?_t.units[At].unit=ft.VAR:_t.units[At].unit.name==="VAR"&&!Xt&&(_t.units[At].unit=ft.VA));_t.units.length===1&&!_t.fixPrefix&&Math.abs(_t.units[0].power-Math.round(_t.units[0].power))<1e-14&&(_t.units[0].prefix=_t._bestPrefix());var $t=_t._denormalize(_t.value),Pt=_t.value!==null?ge($t,bt||{}):"",kt=_t.formatUnits();return _t.value&&isComplex(_t.value)&&(Pt="("+Pt+")"),kt.length>0&&Pt.length>0&&(Pt+=" "),Pt+=kt,Pt},Ce.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 bt=this.value!==null?ne(this.value):0,_t=ne(this.units[0].unit.value),Xt=this.units[0].prefix;if(bt===0)return Xt;var At=this.units[0].power,$t=Math.log(bt/Math.pow(Xt.value*_t,At))/Math.LN10-1.2;if($t>-2.200001&&$t<1.800001)return Xt;$t=Math.abs($t);var Pt=this.units[0].unit.prefixes;for(var kt in Pt)if(hasOwnProperty(Pt,kt)){var jt=Pt[kt];if(jt.scientific){var wt=Math.abs(Math.log(bt/Math.pow(jt.value*_t,At))/Math.LN10-1.2);(wt<$t||wt===$t&&jt.name.length<Xt.name.length)&&(Xt=jt,$t=wt)}}return Xt},Ce.prototype.splitUnit=function(bt){for(var _t=this.clone(),Xt=[],At=0;At<bt.length&&(_t=_t.to(bt[At]),At!==bt.length-1);At++){var $t=_t.toNumeric(),Pt=ae($t),kt=void 0,jt=ce(Pt,$t);jt?kt=Pt:kt=se(_t.toNumeric());var wt=new Ce(kt,bt[At].toString());Xt.push(wt),_t=q(_t,wt)}for(var Mt=0,Tt=0;Tt<Xt.length;Tt++)Mt=z(Mt,Xt[Tt].value);return ce(Mt,this.value)&&(_t.value=0),Xt.push(_t),Xt};var st={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}}};st.SHORTLONG=_extends({},st.SHORT,st.LONG),st.BINARY_SHORT=_extends({},st.BINARY_SHORT_SI,st.BINARY_SHORT_IEC),st.BINARY_LONG=_extends({},st.BINARY_LONG_SI,st.BINARY_LONG_IEC);var pt=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],lt={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 vt in lt)hasOwnProperty(lt,vt)&&(lt[vt].key=vt);var dt={},xt={name:"",base:dt,value:1,offset:0,dimensions:pt.map(bt=>0)},ft={meter:{name:"meter",base:lt.LENGTH,prefixes:st.LONG,value:1,offset:0},inch:{name:"inch",base:lt.LENGTH,prefixes:st.NONE,value:.0254,offset:0},foot:{name:"foot",base:lt.LENGTH,prefixes:st.NONE,value:.3048,offset:0},yard:{name:"yard",base:lt.LENGTH,prefixes:st.NONE,value:.9144,offset:0},mile:{name:"mile",base:lt.LENGTH,prefixes:st.NONE,value:1609.344,offset:0},link:{name:"link",base:lt.LENGTH,prefixes:st.NONE,value:.201168,offset:0}
445,rod:{name:"rod",base:lt.LENGTH,prefixes:st.NONE,value:5.0292,offset:0},chain:{name:"chain",base:lt.LENGTH,prefixes:st.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:lt.LENGTH,prefixes:st.NONE,value:1e-10,offset:0},m:{name:"m",base:lt.LENGTH,prefixes:st.SHORT,value:1,offset:0},in:{name:"in",base:lt.LENGTH,prefixes:st.NONE,value:.0254,offset:0},ft:{name:"ft",base:lt.LENGTH,prefixes:st.NONE,value:.3048,offset:0},yd:{name:"yd",base:lt.LENGTH,prefixes:st.NONE,value:.9144,offset:0},mi:{name:"mi",base:lt.LENGTH,prefixes:st.NONE,value:1609.344,offset:0},li:{name:"li",base:lt.LENGTH,prefixes:st.NONE,value:.201168,offset:0},rd:{name:"rd",base:lt.LENGTH,prefixes:st.NONE,value:5.02921,offset:0},ch:{name:"ch",base:lt.LENGTH,prefixes:st.NONE,value:20.1168,offset:0},mil:{name:"mil",base:lt.LENGTH,prefixes:st.NONE,value:254e-7,offset:0},m2:{name:"m2",base:lt.SURFACE,prefixes:st.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:lt.SURFACE,prefixes:st.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:lt.SURFACE,prefixes:st.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:lt.SURFACE,prefixes:st.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:lt.SURFACE,prefixes:st.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:lt.SURFACE,prefixes:st.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:lt.SURFACE,prefixes:st.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:lt.SURFACE,prefixes:st.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:lt.SURFACE,prefixes:st.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:lt.SURFACE,prefixes:st.NONE,value:1e4,offset:0},m3:{name:"m3",base:lt.VOLUME,prefixes:st.CUBIC,value:1,offset:0},L:{name:"L",base:lt.VOLUME,prefixes:st.SHORT,value:.001,offset:0},l:{name:"l",base:lt.VOLUME,prefixes:st.SHORT,value:.001,offset:0},litre:{name:"litre",base:lt.VOLUME,prefixes:st.LONG,value:.001,offset:0},cuin:{name:"cuin",base:lt.VOLUME,prefixes:st.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:lt.VOLUME,prefixes:st.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:lt.VOLUME,prefixes:st.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:lt.VOLUME,prefixes:st.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:lt.VOLUME,prefixes:st.NONE,value:15e-6,offset:0},drop:{name:"drop",base:lt.VOLUME,prefixes:st.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:lt.VOLUME,prefixes:st.NONE,value:5e-8,offset:0},minim:{name:"minim",base:lt.VOLUME,prefixes:st.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:lt.VOLUME,prefixes:st.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:lt.VOLUME,prefixes:st.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:lt.VOLUME,prefixes:st.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:lt.VOLUME,prefixes:st.NONE,value:1e-6,offset:0},cup:{name:"cup",base:lt.VOLUME,prefixes:st.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:lt.VOLUME,prefixes:st.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:lt.VOLUME,prefixes:st.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:lt.VOLUME,prefixes:st.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:lt.VOLUME,prefixes:st.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:lt.VOLUME,prefixes:st.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:lt.VOLUME,prefixes:st.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:lt.VOLUME,prefixes:st.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:lt.VOLUME,prefixes:st.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:lt.VOLUME,prefixes:st.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:lt.VOLUME,prefixes:st.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:lt.VOLUME,prefixes:st.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:lt.VOLUME,prefixes:st.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:lt.VOLUME,prefixes:st.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:lt.VOLUME,prefixes:st.NONE,value:.1173478,offset:0},obl:{name:"obl",base:lt.VOLUME,prefixes:st.NONE,value:.1589873,offset:0},g:{name:"g",base:lt.MASS,prefixes:st.SHORT,value:.001,offset:0},gram:{name:"gram",base:lt.MASS,prefixes:st.LONG,value:.001,offset:0},ton:{name:"ton",base:lt.MASS,prefixes:st.SHORT,value:907.18474,offset:0},t:{name:"t",base:lt.MASS,prefixes:st.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:lt.MASS,prefixes:st.LONG,value:1e3,offset:0},grain:{name:"grain",base:lt.MASS,prefixes:st.NONE,value:6479891e-11,offset:0}
445,dram:{name:"dram",base:lt.MASS,prefixes:st.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:lt.MASS,prefixes:st.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:lt.MASS,prefixes:st.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:lt.MASS,prefixes:st.NONE,value:45.359237,offset:0},stick:{name:"stick",base:lt.MASS,prefixes:st.NONE,value:.115,offset:0},stone:{name:"stone",base:lt.MASS,prefixes:st.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:lt.MASS,prefixes:st.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:lt.MASS,prefixes:st.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:lt.MASS,prefixes:st.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:lt.MASS,prefixes:st.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:lt.MASS,prefixes:st.NONE,value:45.359237,offset:0},s:{name:"s",base:lt.TIME,prefixes:st.SHORT,value:1,offset:0},min:{name:"min",base:lt.TIME,prefixes:st.NONE,value:60,offset:0},h:{name:"h",base:lt.TIME,prefixes:st.NONE,value:3600,offset:0},second:{name:"second",base:lt.TIME,prefixes:st.LONG,value:1,offset:0},sec:{name:"sec",base:lt.TIME,prefixes:st.LONG,value:1,offset:0},minute:{name:"minute",base:lt.TIME,prefixes:st.NONE,value:60,offset:0},hour:{name:"hour",base:lt.TIME,prefixes:st.NONE,value:3600,offset:0},day:{name:"day",base:lt.TIME,prefixes:st.NONE,value:86400,offset:0},week:{name:"week",base:lt.TIME,prefixes:st.NONE,value:7*86400,offset:0},month:{name:"month",base:lt.TIME,prefixes:st.NONE,value:2629800,offset:0},year:{name:"year",base:lt.TIME,prefixes:st.NONE,value:31557600,offset:0},decade:{name:"decade",base:lt.TIME,prefixes:st.NONE,value:315576e3,offset:0},century:{name:"century",base:lt.TIME,prefixes:st.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:lt.TIME,prefixes:st.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:lt.FREQUENCY,prefixes:st.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:lt.FREQUENCY,prefixes:st.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:lt.ANGLE,prefixes:st.SHORT,value:1,offset:0},radian:{name:"radian",base:lt.ANGLE,prefixes:st.LONG,value:1,offset:0},deg:{name:"deg",base:lt.ANGLE,prefixes:st.SHORT,value:null,offset:0},degree:{name:"degree",base:lt.ANGLE,prefixes:st.LONG,value:null,offset:0},grad:{name:"grad",base:lt.ANGLE,prefixes:st.SHORT,value:null,offset:0},gradian:{name:"gradian",base:lt.ANGLE,prefixes:st.LONG,value:null,offset:0},cycle:{name:"cycle",base:lt.ANGLE,prefixes:st.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:lt.ANGLE,prefixes:st.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:lt.ANGLE,prefixes:st.NONE,value:null,offset:0},A:{name:"A",base:lt.CURRENT,prefixes:st.SHORT,value:1,offset:0},ampere:{name:"ampere",base:lt.CURRENT,prefixes:st.LONG,value:1,offset:0}
445,K:{name:"K",base:lt.TEMPERATURE,prefixes:st.SHORT,value:1,offset:0},degC:{name:"degC",base:lt.TEMPERATURE,prefixes:st.SHORT,value:1,offset:273.15},degF:{name:"degF",base:lt.TEMPERATURE,prefixes:st.SHORT,value:new Pe(5,9),offset:459.67},degR:{name:"degR",base:lt.TEMPERATURE,prefixes:st.SHORT,value:new Pe(5,9),offset:0},kelvin:{name:"kelvin",base:lt.TEMPERATURE,prefixes:st.LONG,value:1,offset:0},celsius:{name:"celsius",base:lt.TEMPERATURE,prefixes:st.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:lt.TEMPERATURE,prefixes:st.LONG,value:new Pe(5,9),offset:459.67},rankine:{name:"rankine",base:lt.TEMPERATURE,prefixes:st.LONG,value:new Pe(5,9),offset:0},mol:{name:"mol",base:lt.AMOUNT_OF_SUBSTANCE,prefixes:st.SHORT,value:1,offset:0},mole:{name:"mole",base:lt.AMOUNT_OF_SUBSTANCE,prefixes:st.LONG,value:1,offset:0},cd:{name:"cd",base:lt.LUMINOUS_INTENSITY,prefixes:st.SHORT,value:1,offset:0},candela:{name:"candela",base:lt.LUMINOUS_INTENSITY,prefixes:st.LONG,value:1,offset:0},N:{name:"N",base:lt.FORCE,prefixes:st.SHORT,value:1,offset:0},newton:{name:"newton",base:lt.FORCE,prefixes:st.LONG,value:1,offset:0},dyn:{name:"dyn",base:lt.FORCE,prefixes:st.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:lt.FORCE,prefixes:st.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:lt.FORCE,prefixes:st.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:lt.FORCE,prefixes:st.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:lt.FORCE,prefixes:st.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:lt.FORCE,prefixes:st.NONE,value:9.80665,offset:0},J:{name:"J",base:lt.ENERGY,prefixes:st.SHORT,value:1,offset:0},joule:{name:"joule",base:lt.ENERGY,prefixes:st.LONG,value:1,offset:0},erg:{name:"erg",base:lt.ENERGY,prefixes:st.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:lt.ENERGY,prefixes:st.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:lt.ENERGY,prefixes:st.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:lt.ENERGY,prefixes:st.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:lt.ENERGY,prefixes:st.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:lt.POWER,prefixes:st.SHORT,value:1,offset:0},watt:{name:"watt",base:lt.POWER,prefixes:st.LONG,value:1,offset:0},hp:{name:"hp",base:lt.POWER,prefixes:st.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:lt.POWER,prefixes:st.SHORT,value:be.I,offset:0},VA:{name:"VA",base:lt.POWER,prefixes:st.SHORT,value:1,offset:0},Pa:{name:"Pa",base:lt.PRESSURE,prefixes:st.SHORT,value:1,offset:0},psi:{name:"psi",base:lt.PRESSURE,prefixes:st.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:lt.PRESSURE,prefixes:st.NONE,value:101325,offset:0},bar:{name:"bar",base:lt.PRESSURE,prefixes:st.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:lt.PRESSURE,prefixes:st.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:lt.PRESSURE,prefixes:st.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:lt.PRESSURE,prefixes:st.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:lt.PRESSURE,prefixes:st.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:lt.ELECTRIC_CHARGE,prefixes:st.LONG,value:1,offset:0},C:{name:"C",base:lt.ELECTRIC_CHARGE,prefixes:st.SHORT,value:1,offset:0},farad:{name:"farad",base:lt.ELECTRIC_CAPACITANCE,prefixes:st.LONG,value:1,offset:0},F:{name:"F",base:lt.ELECTRIC_CAPACITANCE,prefixes:st.SHORT,value:1,offset:0},volt:{name:"volt",base:lt.ELECTRIC_POTENTIAL,prefixes:st.LONG,value:1,offset:0},V:{name:"V",base:lt.ELECTRIC_POTENTIAL,prefixes:st.SHORT,value:1,offset:0},ohm:{name:"ohm",base:lt.ELECTRIC_RESISTANCE,prefixes:st.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:lt.ELECTRIC_INDUCTANCE,prefixes:st.LONG,value:1,offset:0},H:{name:"H",base:lt.ELECTRIC_INDUCTANCE,prefixes:st.SHORT,value:1,offset:0},siemens:{name:"siemens",base:lt.ELECTRIC_CONDUCTANCE,prefixes:st.LONG,value:1,offset:0},S:{name:"S",base:lt.ELECTRIC_CONDUCTANCE,prefixes:st.SHORT,value:1,offset:0},weber:{name:"weber",base:lt.MAGNETIC_FLUX,prefixes:st.LONG,value:1,offset:0},Wb:{name:"Wb",base:lt.MAGNETIC_FLUX,prefixes:st.SHORT,value:1,offset:0},tesla:{name:"tesla",base:lt.MAGNETIC_FLUX_DENSITY,prefixes:st.LONG,value:1,offset:0},T:{name:"T",base:lt.MAGNETIC_FLUX_DENSITY,prefixes:st.SHORT,value:1,offset:0},b:{name:"b",base:lt.BIT,prefixes:st.BINARY_SHORT,value:1,offset:0}
vendor: 54,981 bytes, lines 445-447
445,bits:{name:"bits",base:lt.BIT,prefixes:st.BINARY_LONG,value:1,offset:0},B:{name:"B",base:lt.BIT,prefixes:st.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:lt.BIT,prefixes:st.BINARY_LONG,value:8,offset:0}},Et={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function Ct(bt){if(bt.number==="BigNumber"){var _t=createBigNumberPi(Ee);ft.rad.value=new Ee(1),ft.deg.value=_t.div(180),ft.grad.value=_t.div(200),ft.cycle.value=_t.times(2),ft.arcsec.value=_t.div(648e3),ft.arcmin.value=_t.div(10800)}else ft.rad.value=1,ft.deg.value=Math.PI/180,ft.grad.value=Math.PI/200,ft.cycle.value=Math.PI*2,ft.arcsec.value=Math.PI/648e3,ft.arcmin.value=Math.PI/10800;ft.radian.value=ft.rad.value,ft.degree.value=ft.deg.value,ft.gradian.value=ft.grad.value}Ct(G),N&&N("config",function(bt,_t){bt.number!==_t.number&&Ct(bt)});var Dt={si:{NONE:{unit:xt,prefix:st.NONE[""]},LENGTH:{unit:ft.m,prefix:st.SHORT[""]},MASS:{unit:ft.g,prefix:st.SHORT.k},TIME:{unit:ft.s,prefix:st.SHORT[""]},CURRENT:{unit:ft.A,prefix:st.SHORT[""]},TEMPERATURE:{unit:ft.K,prefix:st.SHORT[""]},LUMINOUS_INTENSITY:{unit:ft.cd,prefix:st.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:ft.mol,prefix:st.SHORT[""]},ANGLE:{unit:ft.rad,prefix:st.SHORT[""]},BIT:{unit:ft.bits,prefix:st.SHORT[""]},FORCE:{unit:ft.N,prefix:st.SHORT[""]},ENERGY:{unit:ft.J,prefix:st.SHORT[""]},POWER:{unit:ft.W,prefix:st.SHORT[""]},PRESSURE:{unit:ft.Pa,prefix:st.SHORT[""]},ELECTRIC_CHARGE:{unit:ft.C,prefix:st.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:ft.F,prefix:st.SHORT[""]},ELECTRIC_POTENTIAL:{unit:ft.V,prefix:st.SHORT[""]},ELECTRIC_RESISTANCE:{unit:ft.ohm,prefix:st.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:ft.H,prefix:st.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:ft.S,prefix:st.SHORT[""]},MAGNETIC_FLUX:{unit:ft.Wb,prefix:st.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:ft.T,prefix:st.SHORT[""]},FREQUENCY:{unit:ft.Hz,prefix:st.SHORT[""]}}};Dt.cgs=JSON.parse(JSON.stringify(Dt.si)),Dt.cgs.LENGTH={unit:ft.m,prefix:st.SHORT.c},Dt.cgs.MASS={unit:ft.g,prefix:st.SHORT[""]},Dt.cgs.FORCE={unit:ft.dyn,prefix:st.SHORT[""]},Dt.cgs.ENERGY={unit:ft.erg,prefix:st.NONE[""]},Dt.us=JSON.parse(JSON.stringify(Dt.si)),Dt.us.LENGTH={unit:ft.ft,prefix:st.NONE[""]},Dt.us.MASS={unit:ft.lbm,prefix:st.NONE[""]},Dt.us.TEMPERATURE={unit:ft.degF,prefix:st.NONE[""]},Dt.us.FORCE={unit:ft.lbf,prefix:st.NONE[""]},Dt.us.ENERGY={unit:ft.BTU,prefix:st.BTU[""]},Dt.us.POWER={unit:ft.hp,prefix:st.NONE[""]},Dt.us.PRESSURE={unit:ft.psi,prefix:st.NONE[""]},Dt.auto=JSON.parse(JSON.stringify(Dt.si));var Gt=Dt.auto;Ce.setUnitSystem=function(bt){if(hasOwnProperty(Dt,bt))Gt=Dt[bt];else throw new Error("Unit system "+bt+" does not exist. Choices are: "+Object.keys(Dt).join(", "))},Ce.getUnitSystem=function(){for(var bt in Dt)if(hasOwnProperty(Dt,bt)&&Dt[bt]===Gt)return bt},Ce.typeConverters={BigNumber:function(_t){return _t!=null&&_t.isFraction?new Ee(_t.n).div(_t.d).times(_t.s):new Ee(_t+"")},Fraction:function(_t){return new Pe(_t)},Complex:function(_t){return _t},number:function(_t){return _t!=null&&_t.isFraction?ve(_t):_t}},Ce.prototype._numberConverter=function(){var bt=Ce.typeConverters[this.valueType()];if(bt)return bt;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},Ce._getNumberConverter=function(bt){if(!Ce.typeConverters[bt])throw new TypeError('Unsupported type "'+bt+'"');return Ce.typeConverters[bt]};for(var Ot in ft)if(hasOwnProperty(ft,Ot)){var It=ft[Ot];It.dimensions=It.base.dimensions}for(var Bt in Et)if(hasOwnProperty(Et,Bt)){var Ht=ft[Et[Bt]],ir={};for(var zt in Ht)hasOwnProperty(Ht,zt)&&(ir[zt]=Ht[zt]);ir.name=Bt,ft[Bt]=ir}Ce.isValidAlpha=function(_t){return/^[a-zA-Z]$/.test(_t)};function tr(bt){for(var _t=0;_t<bt.length;_t++){if(qe=bt.charAt(_t),_t===0&&!Ce.isValidAlpha(qe))throw new Error('Invalid unit name (must begin with alpha character): "'+bt+'"');if(_t>0&&!(Ce.isValidAlpha(qe)||tt(qe)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+bt+'"')}}return Ce.createUnit=function(bt,_t){if(typeof bt!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(_t&&_t.override){for(var Xt in bt)if(hasOwnProperty(bt,Xt)&&Ce.deleteUnit(Xt),bt[Xt].aliases)for(var At=0;At<bt[Xt].aliases.length;At++)Ce.deleteUnit(bt[Xt].aliases[At])}var $t;for(var Pt in bt)hasOwnProperty(bt,Pt)&&($t=Ce.createUnitSingle(Pt,bt[Pt]));return $t},Ce.createUnitSingle=function(bt,_t){if((typeof _t>"u"||_t===null)&&(_t={}),typeof bt!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(hasOwnProperty(ft,bt))throw new Error('Cannot create unit "'+bt+'": a unit with that name already exists');tr(bt);var Xt=null,At=[],$t=0,Pt,kt,jt;if(_t&&_t.type==="Unit")Xt=_t.clone();else if(typeof _t=="string")_t!==""&&(Pt=_t);else if(typeof _t=="object")Pt=_t.definition,kt=_t.prefixes,$t=_t.offset,jt=_t.baseName,_t.aliases&&(At=_t.aliases.valueOf());else throw new TypeError('Cannot create unit "'+bt+'" from "'+_t.toString()+'": expecting "string" or "Unit" or "Object"');if(At){for(var wt=0;wt<At.length;wt++)if(hasOwnProperty(ft,At[wt]))throw new Error('Cannot create alias "'+At[wt]+'": a unit with that name already exists')}if(Pt&&typeof Pt=="string"&&!Xt)try{Xt=Ce.parse(Pt,{allowNoUnits:!0})}catch(gt){throw gt.message='Could not create unit "'+bt+'" from "'+Pt+'": '+gt.message,gt}else Pt&&Pt.type==="Unit"&&(Xt=Pt.clone());At=At||[],$t=$t||0,kt&&kt.toUpperCase?kt=st[kt.toUpperCase()]||st.NONE:kt=st.NONE;var Mt={};if(Xt){Mt={name:bt,value:Xt.value,dimensions:Xt.dimensions.slice(0),prefixes:kt,offset:$t};var Ut=!1;for(var Zt in lt)if(hasOwnProperty(lt,Zt)){for(var Wt=!0,qt=0;qt<pt.length;qt++)if(Math.abs((Mt.dimensions[qt]||0)-(lt[Zt].dimensions[qt]||0))>1e-12){Wt=!1;break}if(Wt){Ut=!0,Mt.base=lt[Zt];break}}if(!Ut){jt=jt||bt+"_STUFF";var Yt={dimensions:Xt.dimensions.slice(0)};Yt.key=jt,lt[jt]=Yt,Gt[jt]={unit:Mt,prefix:st.NONE[""]},Mt.base=lt[jt]}}else{if(jt=jt||bt+"_STUFF",pt.indexOf(jt)>=0)throw new Error('Cannot create new base unit "'+bt+'": a base unit with that name already exists (and cannot be overridden)');pt.push(jt);for(var Tt in lt)hasOwnProperty(lt,Tt)&&(lt[Tt].dimensions[pt.length-1]=0);for(var Rt={dimensions:[]},Ft=0;Ft<pt.length;Ft++)Rt.dimensions[Ft]=0;Rt.dimensions[pt.length-1]=1,Rt.key=jt,lt[jt]=Rt,Mt={name:bt,value:1,dimensions:lt[jt].dimensions.slice(0),prefixes:kt,offset:$t,base:lt[jt]},Gt[jt]={unit:Mt,prefix:st.NONE[""]}}Ce.UNITS[bt]=Mt;for(var or=0;or<At.length;or++){var hr=At[or],sr={};for(var nr in Mt)hasOwnProperty(Mt,nr)&&(sr[nr]=Mt[nr]);sr.name=hr,Ce.UNITS[hr]=sr}return delete ct.cache,new Ce(null,bt)},Ce.deleteUnit=function(bt){delete Ce.UNITS[bt]},Ce.PREFIXES=st,Ce.BASE_DIMENSIONS=pt,Ce.BASE_UNITS=lt,Ce.UNIT_SYSTEMS=Dt,Ce.UNITS=ft,Ce},{isClass:!0}),name$2j="unit",dependencies$2j=["typed","Unit"],createUnitFunction=factory(name$2j,dependencies$2j,v=>{var{typed:N,Unit:G}=v;return N(name$2j,{Unit:function(q){return q.clone()},string:function(q){return G.isValuelessUnit(q)?new G(null,q):G.parse(q,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(q,Y){return new G(q,Y)},"number | BigNumber | Fraction":function(q){return new G(q)},"Array | Matrix":N.referToSelf(z=>q=>deepMap(q,z))})}),name$2i="sparse",dependencies$2i=["typed","SparseMatrix"],createSparse=factory(name$2i,dependencies$2i,v=>{var{typed:N,SparseMatrix:G}=v;return N(name$2i,{"":function(){return new G([])},string:function(q){return new G([],q)},"Array | Matrix":function(q){return new G(q)},"Array | Matrix, string":function(q,Y){return new G(q,Y)}})}),name$2h="createUnit",dependencies$2h=["typed","Unit"],createCreateUnit=factory(name$2h,dependencies$2h,v=>{var{typed:N,Unit:G}=v;return N(name$2h,{"Object, Object":function(q,Y){return G.createUnit(q,Y)},Object:function(q){return G.createUnit(q,{})},"string, Unit | string | Object, Object":function(q,Y,W){var ie={};return ie[q]=Y,G.createUnit(ie,W)},"string, Unit | string | Object":function(q,Y){var W={};return W[q]=Y,G.createUnit(W,{})},string:function(q){var Y={};return Y[q]={},G.createUnit(Y,{})}})}),name$2g="acos",dependencies$2g=["typed","config","Complex"],createAcos=factory(name$2g,dependencies$2g,v=>{var{typed:N,config:G,Complex:z}=v;return N(name$2g,{number:function(Y){return Y>=-1&&Y<=1||G.predictable?Math.acos(Y):new z(Y,0).acos()},Complex:function(Y){return Y.acos()},BigNumber:function(Y){return Y.acos()}})}),name$2f="acosh",dependencies$2f=["typed","config","Complex"],createAcosh=factory(name$2f,dependencies$2f,v=>{var{typed:N,config:G,Complex:z}=v;return N(name$2f,{number:function(Y){return Y>=1||G.predictable?acoshNumber(Y):Y<=-1?new z(Math.log(Math.sqrt(Y*Y-1)-Y),Math.PI):new z(Y,0).acosh()},Complex:function(Y){return Y.acosh()},BigNumber:function(Y){return Y.acosh()}})}),name$2e="acot",dependencies$2e=["typed","BigNumber"],createAcot=factory(name$2e,dependencies$2e,v=>{var{typed:N,BigNumber:G}=v;return N(name$2e,{number:acotNumber,Complex:function(q){return q.acot()},BigNumber:function(q){return new G(1).div(q).atan()}})}),name$2d="acoth",dependencies$2d=["typed","config","Complex","BigNumber"],createAcoth=factory(name$2d,dependencies$2d,v=>{var{typed:N,config:G,Complex:z,BigNumber:q}=v;return N(name$2d,{number:function(W){return W>=1||W<=-1||G.predictable?acothNumber(W):new z(W,0).acoth()},Complex:function(W){return W.acoth()},BigNumber:function(W){return new q(1).div(W).atanh()}})}),name$2c="acsc",dependencies$2c=["typed","config","Complex","BigNumber"],createAcsc=factory(name$2c,dependencies$2c,v=>{var{typed:N,config:G,Complex:z,BigNumber:q}=v;return N(name$2c,{number:function(W){return W<=-1||W>=1||G.predictable?acscNumber(W):new z(W,0).acsc()},Complex:function(W){return W.acsc()},BigNumber:function(W){return new q(1).div(W).asin()}})}),name$2b="acsch",dependencies$2b=["typed","BigNumber"],createAcsch=factory(name$2b,dependencies$2b,v=>{var{typed:N,BigNumber:G}=v;return N(name$2b,{number:acschNumber,Complex:function(q){return q.acsch()},BigNumber:function(q){return new G(1).div(q).asinh()}})}),name$2a="asec",dependencies$2a=["typed","config","Complex","BigNumber"],createAsec=factory(name$2a,dependencies$2a,v=>{var{typed:N,config:G,Complex:z,BigNumber:q}=v;return N(name$2a,{number:function(W){return W<=-1||W>=1||G.predictable?asecNumber(W):new z(W,0).asec()},Complex:function(W){return W.asec()},BigNumber:function(W){return new q(1).div(W).acos()}})}),name$29="asech",dependencies$29=["typed","config","Complex","BigNumber"],createAsech=factory(name$29,dependencies$29,v=>{var{typed:N,config:G,Complex:z,BigNumber:q}=v;return N(name$29,{number:function(W){if(W<=1&&W>=-1||G.predictable){var ie=1/W;if(ie>0||G.predictable)return asechNumber(W);var ne=Math.sqrt(ie*ie-1);return new z(Math.log(ne-ie),Math.PI)}return new z(W,0).asech()},Complex:function(W){return W.asech()},BigNumber:function(W){return new q(1).div(W).acosh()}})}),name$28="asin",dependencies$28=["typed","config","Complex"],createAsin=factory(name$28,dependencies$28,v=>{var{typed:N,config:G,Complex:z}=v;return N(name$28,{number:function(Y){return Y>=-1&&Y<=1||G.predictable?Math.asin(Y):new z(Y,0).asin()},Complex:function(Y){return Y.asin()},BigNumber:function(Y){return Y.asin()}})}),name$27="asinh",dependencies$27=["typed"],createAsinh=factory(name$27,dependencies$27,v=>{var{typed:N}=v;return N("asinh",{number:asinhNumber,Complex:function(z){return z.asinh()},BigNumber:function(z){return z.asinh()}})}),name$26="atan",dependencies$26=["typed"],createAtan=factory(name$26,dependencies$26,v=>{var{typed:N}=v;return N("atan",{number:function(z){return Math.atan(z)},Complex:function(z){return z.atan()},BigNumber:function(z){return z.atan()}})}),name$25="atan2",dependencies$25=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],createAtan2=factory(name$25,dependencies$25,v=>{var{typed:N,matrix:G,equalScalar:z,BigNumber:q,DenseMatrix:Y,concat:W}=v,ie=createMatAlgo02xDS0({typed:N,equalScalar:z}),ne=createMatAlgo03xDSf({typed:N}),se=createMatAlgo09xS0Sf({typed:N,equalScalar:z}),ae=createMatAlgo11xS0s({typed:N,equalScalar:z}),ce=createMatAlgo12xSfs({typed:N,DenseMatrix:Y}),pe=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:W});return N(name$25,{"number, number":Math.atan2,"BigNumber, BigNumber":(ge,ve)=>q.atan2(ge,ve)},pe({scalar:"number | BigNumber",SS:se,DS:ne,SD:ie,Ss:ae,sS:ce}))}),name$24="atanh",dependencies$24=["typed","config","Complex"],createAtanh=factory(name$24,dependencies$24,v=>{var{typed:N,config:G,Complex:z}=v;return N(name$24,{number:function(Y){return Y<=1&&Y>=-1||G.predictable?atanhNumber(Y):new z(Y,0).atanh()},Complex:function(Y){return Y.atanh()},BigNumber:function(Y){return Y.atanh()}})}),createTrigUnit=factory("trigUnit",["typed"],v=>{var{typed:N}=v;return{Unit:N.referToSelf(G=>z=>{if(!z.hasBase(z.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return N.find(G,z.valueType())(z.value)})}}),name$23="cos",dependencies$23=["typed"],createCos=factory(name$23,dependencies$23,v=>{var{typed:N}=v,G=createTrigUnit({typed:N});return N(name$23,{number:Math.cos,"Complex | BigNumber":z=>z.cos()},G)}),name$22="cosh",dependencies$22=["typed"],createCosh=factory(name$22,dependencies$22,v=>{var{typed:N}=v;return N(name$22,{number:cosh$2,"Complex | BigNumber":G=>G.cosh()})}),name$21="cot",dependencies$21=["typed","BigNumber"],createCot=factory(name$21,dependencies$21,v=>{var{typed:N,BigNumber:G}=v,z=createTrigUnit({typed:N});return N(name$21,{number:cotNumber,Complex:q=>q.cot(),BigNumber:q=>new G(1).div(q.tan())},z)}),name$20="coth",dependencies$20=["typed","BigNumber"],createCoth=factory(name$20,dependencies$20,v=>{var{typed:N,BigNumber:G}=v;return N(name$20,{number:cothNumber,Complex:z=>z.coth(),BigNumber:z=>new G(1).div(z.tanh())})}),name$1$="csc",dependencies$1$=["typed","BigNumber"],createCsc=factory(name$1$,dependencies$1$,v=>{var{typed:N,BigNumber:G}=v,z=createTrigUnit({typed:N});return N(name$1$,{number:cscNumber,Complex:q=>q.csc(),BigNumber:q=>new G(1).div(q.sin())},z)}),name$1_="csch",dependencies$1_=["typed","BigNumber"],createCsch=factory(name$1_,dependencies$1_,v=>{var{typed:N,BigNumber:G}=v;return N(name$1_,{number:cschNumber,Complex:z=>z.csch(),BigNumber:z=>new G(1).div(z.sinh())})}),name$1Z="sec",dependencies$1Z=["typed","BigNumber"],createSec=factory(name$1Z,dependencies$1Z,v=>{var{typed:N,BigNumber:G}=v,z=createTrigUnit({typed:N});return N(name$1Z,{number:secNumber,Complex:q=>q.sec(),BigNumber:q=>new G(1).div(q.cos())},z)}),name$1Y="sech",dependencies$1Y=["typed","BigNumber"],createSech=factory(name$1Y,dependencies$1Y,v=>{var{typed:N,BigNumber:G}=v;return N(name$1Y,{number:sechNumber,Complex:z=>z.sech(),BigNumber:z=>new G(1).div(z.cosh())})}),name$1X="sin",dependencies$1X=["typed"],createSin=factory(name$1X,dependencies$1X,v=>{var{typed:N}=v,G=createTrigUnit({typed:N});return N(name$1X,{number:Math.sin,"Complex | BigNumber":z=>z.sin()},G)}),name$1W="sinh",dependencies$1W=["typed"],createSinh=factory(name$1W,dependencies$1W,v=>{var{typed:N}=v;return N(name$1W,{number:sinhNumber,"Complex | BigNumber":G=>G.sinh()})}),name$1V="tan",dependencies$1V=["typed"],createTan=factory(name$1V,dependencies$1V,v=>{var{typed:N}=v,G=createTrigUnit({typed:N});return N(name$1V,{number:Math.tan,"Complex | BigNumber":z=>z.tan()},G)}),name$1U="tanh",dependencies$1U=["typed"],createTanh=factory(name$1U,dependencies$1U,v=>{var{typed:N}=v;return N("tanh",{number:tanh$1,"Complex | BigNumber":G=>G.tanh()})}),name$1T="setCartesian",dependencies$1T=["typed","size","subset","compareNatural","Index","DenseMatrix"],createSetCartesian=factory(name$1T,dependencies$1T,v=>{var{typed:N,size:G,subset:z,compareNatural:q,Index:Y,DenseMatrix:W}=v;return N(name$1T,{"Array | Matrix, Array | Matrix":function(ne,se){var ae=[];if(z(G(ne),new Y(0))!==0&&z(G(se),new Y(0))!==0){var ce=flatten(Array.isArray(ne)?ne:ne.toArray()).sort(q),pe=flatten(Array.isArray(se)?se:se.toArray()).sort(q);ae=[];for(var ge=0;ge<ce.length;ge++)for(var ve=0;ve<pe.length;ve++)ae.push([ce[ge],pe[ve]])}return Array.isArray(ne)&&Array.isArray(se)?ae:new W(ae)}})}),name$1S="setDifference",dependencies$1S=["typed","size","subset","compareNatural","Index","DenseMatrix"],createSetDifference=factory(name$1S,dependencies$1S,v=>{var{typed:N,size:G,subset:z,compareNatural:q,Index:Y,DenseMatrix:W}=v;return N(name$1S,{"Array | Matrix, Array | Matrix":function(ne,se){var ae;if(z(G(ne),new Y(0))===0)ae=[];else{if(z(G(se),new Y(0))===0)return flatten(ne.toArray());var ce=identify(flatten(Array.isArray(ne)?ne:ne.toArray()).sort(q)),pe=identify(flatten(Array.isArray(se)?se:se.toArray()).sort(q));ae=[];for(var ge,ve=0;ve<ce.length;ve++){ge=!1;for(var be=0;be<pe.length;be++)if(q(ce[ve].value,pe[be].value)===0&&ce[ve].identifier===pe[be].identifier){ge=!0;break}ge||ae.push(ce[ve])}}return Array.isArray(ne)&&Array.isArray(se)?generalize(ae):new W(generalize(ae))}})}),name$1R="setDistinct",dependencies$1R=["typed","size","subset","compareNatural","Index","DenseMatrix"],createSetDistinct=factory(name$1R,dependencies$1R,v=>{var{typed:N,size:G,subset:z,compareNatural:q,Index:Y,DenseMatrix:W}=v;return N(name$1R,{"Array | Matrix":function(ne){var se;if(z(G(ne),new Y(0))===0)se=[];else{var ae=flatten(Array.isArray(ne)?ne:ne.toArray()).sort(q);se=[],se.push(ae[0]);for(var ce=1;ce<ae.length;ce++)q(ae[ce],ae[ce-1])!==0&&se.push(ae[ce])}return Array.isArray(ne)?se:new W(se)}})}),name$1Q="setIntersect",dependencies$1Q=["typed","size","subset","compareNatural","Index","DenseMatrix"],createSetIntersect=factory(name$1Q,dependencies$1Q,v=>{var{typed:N,size:G,subset:z,compareNatural:q,Index:Y,DenseMatrix:W}=v;return N(name$1Q,{"Array | Matrix, Array | Matrix":function(ne,se){var ae;if(z(G(ne),new Y(0))===0||z(G(se),new Y(0))===0)ae=[];else{var ce=identify(flatten(Array.isArray(ne)?ne:ne.toArray()).sort(q)),pe=identify(flatten(Array.isArray(se)?se:se.toArray()).sort(q));ae=[];for(var ge=0;ge<ce.length;ge++)for(var ve=0;ve<pe.length;ve++)if(q(ce[ge].value,pe[ve].value)===0&&ce[ge].identifier===pe[ve].identifier){ae.push(ce[ge]);break}}return Array.isArray(ne)&&Array.isArray(se)?generalize(ae):new W(generalize(ae))}})}),name$1P="setIsSubset",dependencies$1P=["typed","size","subset","compareNatural","Index"],createSetIsSubset=factory(name$1P,dependencies$1P,v=>{var{typed:N,size:G,subset:z,compareNatural:q,Index:Y}=v;return N(name$1P,{"Array | Matrix, Array | Matrix":function(ie,ne){if(z(G(ie),new Y(0))===0)return!0;if(z(G(ne),new Y(0))===0)return!1;for(var se=identify(flatten(Array.isArray(ie)?ie:ie.toArray()).sort(q)),ae=identify(flatten(Array.isArray(ne)?ne:ne.toArray()).sort(q)),ce,pe=0;pe<se.length;pe++){ce=!1;for(var ge=0;ge<ae.length;ge++)if(q(se[pe].value,ae[ge].value)===0&&se[pe].identifier===ae[ge].identifier){ce=!0;break}if(ce===!1)return!1}return!0}})}),name$1O="setMultiplicity",dependencies$1O=["typed","size","subset","compareNatural","Index"],createSetMultiplicity=factory(name$1O,dependencies$1O,v=>{var{typed:N,size:G,subset:z,compareNatural:q,Index:Y}=v;return N(name$1O,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(ie,ne){if(z(G(ne),new Y(0))===0)return 0;for(var se=flatten(Array.isArray(ne)?ne:ne.toArray()),ae=0,ce=0;ce<se.length;ce++)q(se[ce],ie)===0&&ae++;return ae}})}),name$1N="setPowerset",dependencies$1N=["typed","size","subset","compareNatural","Index"],createSetPowerset=factory(name$1N,dependencies$1N,v=>{var{typed:N,size:G,subset:z,compareNatural:q,Index:Y}=v;return N(name$1N,{"Array | Matrix":function(se){if(z(G(se),new Y(0))===0)return[];for(var ae=flatten(Array.isArray(se)?se:se.toArray()).sort(q),ce=[],pe=0;pe.toString(2).length<=ae.length;)ce.push(W(ae,pe.toString(2).split("").reverse())),pe++;return ie(ce)}});function W(ne,se){for(var ae=[],ce=0;ce<se.length;ce++)se[ce]==="1"&&ae.push(ne[ce]);return ae}function ie(ne){for(var se=[],ae=ne.length-1;ae>0;ae--)for(var ce=0;ce<ae;ce++)ne[ce].length>ne[ce+1].length&&(se=ne[ce],ne[ce]=ne[ce+1],ne[ce+1]=se);return ne}}),name$1M="setSize",dependencies$1M=["typed","compareNatural"],createSetSize=factory(name$1M,dependencies$1M,v=>{var{typed:N,compareNatural:G}=v;return N(name$1M,{"Array | Matrix":function(q){return Array.isArray(q)?flatten(q).length:flatten(q.toArray()).length},"Array | Matrix, boolean":function(q,Y){if(Y===!1||q.length===0)return Array.isArray(q)?flatten(q).length:flatten(q.toArray()).length;for(var W=flatten(Array.isArray(q)?q:q.toArray()).sort(G),ie=1,ne=1;ne<W.length;ne++)G(W[ne],W[ne-1])!==0&&ie++;return ie}})}),name$1L="setSymDifference",dependencies$1L=["typed","size","concat","subset","setDifference","Index"],createSetSymDifference=factory(name$1L,dependencies$1L,v=>{var{typed:N,size:G,concat:z,subset:q,setDifference:Y,Index:W}=v;return N(name$1L,{"Array | Matrix, Array | Matrix":function(ne,se){if(q(G(ne),new W(0))===0)return flatten(se);if(q(G(se),new W(0))===0)return flatten(ne);var ae=flatten(ne),ce=flatten(se);return z(Y(ae,ce),Y(ce,ae))}})}),name$1K="setUnion",dependencies$1K=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],createSetUnion=factory(name$1K,dependencies$1K,v=>{var{typed:N,size:G,concat:z,subset:q,setIntersect:Y,setSymDifference:W,Index:ie}=v;return N(name$1K,{"Array | Matrix, Array | Matrix":function(se,ae){if(q(G(se),new ie(0))===0)return flatten(ae);if(q(G(ae),new ie(0))===0)return flatten(se);var ce=flatten(se),pe=flatten(ae);return z(W(ce,pe),Y(ce,pe))}})}),name$1J="add",dependencies$1J=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],createAdd=factory(name$1J,dependencies$1J,v=>{var{typed:N,matrix:G,addScalar:z,equalScalar:q,DenseMatrix:Y,SparseMatrix:W,concat:ie}=v,ne=createMatAlgo01xDSid({typed:N}),se=createMatAlgo04xSidSid({typed:N,equalScalar:q}),ae=createMatAlgo10xSids({typed:N,DenseMatrix:Y}),ce=createMatrixAlgorithmSuite({typed:N,matrix:G,concat:ie});return N(name$1J,{"any, any":z,"any, any, ...any":N.referToSelf(pe=>(ge,ve,be)=>{for(var Ee=pe(ge,ve),Pe=0;Pe<be.length;Pe++)Ee=pe(Ee,be[Pe]);return Ee})},ce({elop:z,DS:ne,SS:se,Ss:ae}))}),name$1I="hypot",dependencies$1I=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],createHypot=factory(name$1I,dependencies$1I,v=>{var{typed:N,abs:G,addScalar:z,divideScalar:q,multiplyScalar:Y,sqrt:W,smaller:ie,isPositive:ne}=v;return N(name$1I,{"... number | BigNumber":se,Array:se,Matrix:ae=>se(flatten(ae.toArray()))});function se(ae){for(var ce=0,pe=0,ge=0;ge<ae.length;ge++){if(isComplex(ae[ge]))throw new TypeError("Unexpected type of argument to hypot");var ve=G(ae[ge]);ie(pe,ve)?(ce=Y(ce,Y(q(pe,ve),q(pe,ve))),ce=z(ce,1),pe=ve):ce=z(ce,ne(ve)?Y(q(ve,pe),q(ve,pe)):ve)}return Y(pe,W(ce))}}),name$1H="norm",dependencies$1H=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],createNorm=factory(name$1H,dependencies$1H,v=>{var{typed:N,abs:G,add:z,pow:q,conj:Y,sqrt:W,multiply:ie,equalScalar:ne,larger:se,smaller:ae,matrix:ce,ctranspose:pe,eigs:ge}=v;return N(name$1H,{number:Math.abs,Complex:function(Ze){return Ze.abs()},BigNumber:function(Ze){return Ze.abs()},boolean:function(Ze){return Math.abs(Ze)},Array:function(Ze){return qe(ce(Ze),2)},Matrix:function(Ze){return qe(Ze,2)},"Array, number | BigNumber | string":function(Ze,tt){return qe(ce(Ze),tt)},"Matrix, number | BigNumber | string":function(Ze,tt){return qe(Ze,tt)}});function ve(et){var Ze=0;return et.forEach(function(tt){var Ke=G(tt);se(Ke,Ze)&&(Ze=Ke)},!0),Ze}function be(et){var Ze;return et.forEach(function(tt){var Ke=G(tt);(!Ze||ae(Ke,Ze))&&(Ze=Ke)},!0),Ze||0}function Ee(et,Ze){if(Ze===Number.POSITIVE_INFINITY||Ze==="inf")return ve(et);if(Ze===Number.NEGATIVE_INFINITY||Ze==="-inf")return be(et);if(Ze==="fro")return qe(et,2);if(typeof Ze=="number"&&!isNaN(Ze)){if(!ne(Ze,0)){var tt=0;return et.forEach(function(Ke){tt=z(q(G(Ke),Ze),tt)},!0),q(tt,1/Ze)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function Pe(et){var Ze=0;return et.forEach(function(tt,Ke){Ze=z(Ze,ie(tt,Y(tt)))}),G(W(Ze))}function Je(et){var Ze=[],tt=0;return et.forEach(function(Ke,rt){var it=rt[1],ot=z(Ze[it]||0,G(Ke));se(ot,tt)&&(tt=ot),Ze[it]=ot},!0),tt}function Ce(et){var Ze=et.size();if(Ze[0]!==Ze[1])throw new RangeError("Invalid matrix dimensions");var tt=pe(et),Ke=ie(tt,et),rt=ge(Ke).values.toArray(),it=rt[rt.length-1];return G(W(it))}function Ve(et){var Ze=[],tt=0;return et.forEach(function(Ke,rt){var it=rt[0],ot=z(Ze[it]||0,G(Ke));se(ot,tt)&&(tt=ot),Ze[it]=ot},!0),tt}function Re(et,Ze){if(Ze===1)return Je(et);if(Ze===Number.POSITIVE_INFINITY||Ze==="inf")return Ve(et);if(Ze==="fro")return Pe(et);if(Ze===2)return Ce(et);throw new Error("Unsupported parameter value "+Ze)}function qe(et,Ze){var tt=et.size();if(tt.length===1)return Ee(et,Ze);if(tt.length===2){if(tt[0]&&tt[1])return Re(et,Ze);throw new RangeError("Invalid matrix dimensions")}}}),name$1G="dot",dependencies$1G=["typed","addScalar","multiplyScalar","conj","size"],createDot=factory(name$1G,dependencies$1G,v=>{var{typed:N,addScalar:G,multiplyScalar:z,conj:q,size:Y}=v;return N(name$1G,{"Array | DenseMatrix, Array | DenseMatrix":ie,"SparseMatrix, SparseMatrix":ne});function W(ae,ce){var pe=se(ae),ge=se(ce),ve,be;if(pe.length===1)ve=pe[0];else if(pe.length===2&&pe[1]===1)ve=pe[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+pe.join(", ")+")");if(ge.length===1)be=ge[0];else if(ge.length===2&&ge[1]===1)be=ge[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+ge.join(", ")+")");if(ve!==be)throw new RangeError("Vectors must have equal length ("+ve+" != "+be+")");if(ve===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return ve}function ie(ae,ce){var pe=W(ae,ce),ge=isMatrix(ae)?ae._data:ae,ve=isMatrix(ae)?ae._datatype:void 0,be=isMatrix(ce)?ce._data:ce,Ee=isMatrix(ce)?ce._datatype:void 0,Pe=se(ae).length===2,Je=se(ce).length===2,Ce=G,Ve=z;if(ve&&Ee&&ve===Ee&&typeof ve=="string"){var Re=ve;Ce=N.find(G,[Re,Re]),Ve=N.find(z,[Re,Re])}if(!Pe&&!Je){for(var qe=Ve(q(ge[0]),be[0]),et=1;et<pe;et++)qe=Ce(qe,Ve(q(ge[et]),be[et]));return qe}if(!Pe&&Je){for(var Ze=Ve(q(ge[0]),be[0][0]),tt=1;tt<pe;tt++)Ze=Ce(Ze,Ve(q(ge[tt]),be[tt][0]));return Ze}if(Pe&&!Je){for(var Ke=Ve(q(ge[0][0]),be[0]),rt=1;rt<pe;rt++)Ke=Ce(Ke,Ve(q(ge[rt][0]),be[rt]));return Ke}if(Pe&&Je){for(var it=Ve(q(ge[0][0]),be[0][0]),ot=1;ot<pe;ot++)it=Ce(it,Ve(q(ge[ot][0]),be[ot][0]));return it}}function ne(ae,ce){W(ae,ce);for(var pe=ae._index,ge=ae._values,ve=ce._index,be=ce._values,Ee=0,Pe=G,Je=z,Ce=0,Ve=0;Ce<pe.length&&Ve<ve.length;){var Re=pe[Ce],qe=ve[Ve];if(Re<qe){Ce++;continue}if(Re>qe){Ve++;continue}Re===qe&&(Ee=Pe(Ee,Je(ge[Ce],be[Ve])),Ce++,Ve++)}return Ee}function se(ae){return isMatrix(ae)?ae.size():Y(ae)}}),name$1F="trace",dependencies$1F=["typed","matrix","add"],createTrace=factory(name$1F,dependencies$1F,v=>{var{typed:N,matrix:G,add:z}=v;return N("trace",{Array:function(ie){return q(G(ie))},SparseMatrix:Y,DenseMatrix:q,any:clone$2});function q(W){var ie=W._size,ne=W._data;switch(ie.length){case 1:if(ie[0]===1)return clone$2(ne[0]);throw new RangeError("Matrix must be square (size: "+format(ie)+")");case 2:{var se=ie[0],ae=ie[1];if(se===ae){for(var ce=0,pe=0;pe<se;pe++)ce=z(ce,ne[pe][pe]);return ce}else throw new RangeError("Matrix must be square (size: "+format(ie)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+format(ie)+")")}}function Y(W){var ie=W._values,ne=W._index,se=W._ptr,ae=W._size,ce=ae[0],pe=ae[1];if(ce===pe){var ge=0;if(ie.length>0)for(var ve=0;ve<pe;ve++)for(var be=se[ve],Ee=se[ve+1],Pe=be;Pe<Ee;Pe++){var Je=ne[Pe];if(Je===ve){ge=z(ge,ie[Pe]);break}if(Je>ve)break}return ge}throw new RangeError("Matrix must be square (size: "+format(ae)+")")}}),name$1E="index",dependencies$1E=["typed","Index"],createIndex=factory(name$1E,dependencies$1E,v=>{var{typed:N,Index:G}=v;return N(name$1E,{"...number | string | BigNumber | Range | Array | Matrix":function(q){var Y=q.map(function(ie){return isBigNumber(ie)?ie.toNumber():isArray(ie)||isMatrix(ie)?ie.map(function(ne){return isBigNumber(ne)?ne.toNumber():ne}):ie}),W=new G;return G.apply(W,Y),W}})}),keywords=new Set(["end"]),name$1D="Node",dependencies$1D=["mathWithTransform"],createNode=factory(name$1D,dependencies$1D,v=>{var{mathWithTransform:N}=v;function G(q){for(var Y of[...keywords])if(q.has(Y))throw new Error('Scope contains an illegal symbol, "'+Y+'" is a reserved keyword')}class z{get type(){return"Node"}get isNode(){return!0}evaluate(Y){return this.compile().evaluate(Y)}compile(){var Y=this._compile(N,{}),W={},ie=null;function ne(se){var ae=createMap$1(se);return G(ae),Y(ae,W,ie)}return{evaluate:ne}}_compile(Y,W){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(Y){throw new Error("Cannot run forEach on a Node interface")}map(Y){throw new Error("Cannot run map on a Node interface")}_ifNode(Y){if(!isNode(Y))throw new TypeError("Callback function must return a Node");return Y}traverse(Y){Y(this,null,null);function W(ie,ne){ie.forEach(function(se,ae,ce){ne(se,ae,ce),W(se,ne)})}W(this,Y)}transform(Y){function W(ie,ne,se){var ae=Y(ie,ne,se);return ae!==ie?ae:ie.map(W)}return W(this,null,null)}filter(Y){var W=[];return this.traverse(function(ie,ne,se){Y(ie,ne,se)&&W.push(ie)}),W}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(Y){return Y.cloneDeep()})}equals(Y){return Y?this.type===Y.type&&deepStrictEqual(this,Y):!1}toString(Y){var W=this._getCustomString(Y);return typeof W<"u"?W:this._toString(Y)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(Y){var W=this._getCustomString(Y);return typeof W<"u"?W:this.toHTML(Y)}_toString(){throw new Error("_toString not implemented for "+this.type)}toTex(Y){var W=this._getCustomString(Y);return typeof W<"u"?W:this._toTex(Y)}_toTex(Y){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(Y){if(Y&&typeof Y=="object")switch(typeof Y.handler){case"object":case"undefined":return;case"function":return Y.handler(this,Y);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return z},{isClass:!0,isNode:!0});function errorTransform(v){return v&&v.isIndexError?new IndexError(v.index+1,v.min+1,v.max!==void 0?v.max+1:void 0):v}function accessFactory(v){var{subset:N}=v;return function(z,q){try{if(Array.isArray(z))return N(z,q);if(z&&typeof z.subset=="function")return z.subset(q);if(typeof z=="string")return N(z,q);if(typeof z=="object"){if(!q.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return getSafeProperty(z,q.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(Y){throw errorTransform(Y)}}}var name$1C="AccessorNode",dependencies$1C=["subset","Node"],createAccessorNode=factory(name$1C,dependencies$1C,v=>{var{subset:N,Node:G}=v,z=accessFactory({subset:N});function q(W){return!(isAccessorNode(W)||isArrayNode(W)||isConstantNode(W)||isFunctionNode(W)||isObjectNode(W)||isParenthesisNode(W)||isSymbolNode(W))}class Y extends G{constructor(ie,ne){if(super(),!isNode(ie))throw new TypeError('Node expected for parameter "object"');if(!isIndexNode(ne))throw new TypeError('IndexNode expected for parameter "index"');this.object=ie,this.index=ne}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return name$1C}get isAccessorNode(){return!0}_compile(ie,ne){var se=this.object._compile(ie,ne),ae=this.index._compile(ie,ne);if(this.index.isObjectProperty()){var ce=this.index.getObjectProperty();return function(ge,ve,be){return getSafeProperty(se(ge,ve,be),ce)}}else return function(ge,ve,be){var Ee=se(ge,ve,be),Pe=ae(ge,ve,Ee);return z(Ee,Pe)}}forEach(ie){ie(this.object,"object",this),ie(this.index,"index",this)}map(ie){return new Y(this._ifNode(ie(this.object,"object",this)),this._ifNode(ie(this.index,"index",this)))}clone(){return new Y(this.object,this.index)}_toString(ie){var ne=this.object.toString(ie);return q(this.object)&&(ne="("+ne+")"),ne+this.index.toString(ie)}toHTML(ie){var ne=this.object.toHTML(ie);return q(this.object)&&(ne='<span class="math-parenthesis math-round-parenthesis">(</span>'+ne+'<span class="math-parenthesis math-round-parenthesis">)</span>'),ne+this.index.toHTML(ie)}_toTex(ie){var ne=this.object.toTex(ie);return q(this.object)&&(ne="\\left(' + object + '\\right)"),ne+this.index.toTex(ie)}toJSON(){return{mathjs:name$1C,object:this.object,index:this.index}}static fromJSON(ie){return new Y(ie.object,ie.index)}}return _defineProperty(Y,"name",name$1C),Y},{isClass:!0,isNode:!0}),name$1B="ArrayNode",dependencies$1B=["Node"],createArrayNode=factory(name$1B,dependencies$1B,v=>{var{Node:N}=v;class G extends N{constructor(q){if(super(),this.items=q||[],!Array.isArray(this.items)||!this.items.every(isNode))throw new TypeError("Array containing Nodes expected")}get type(){return name$1B}get isArrayNode(){return!0}_compile(q,Y){var W=map(this.items,function(se){return se._compile(q,Y)}),ie=q.config.matrix!=="Array";if(ie){var ne=q.matrix;return function(ae,ce,pe){return ne(map(W,function(ge){return ge(ae,ce,pe)}))}}else return function(ae,ce,pe){return map(W,function(ge){return ge(ae,ce,pe)})}}forEach(q){for(var Y=0;Y<this.items.length;Y++){var W=this.items[Y];q(W,"items["+Y+"]",this)}}map(q){for(var Y=[],W=0;W<this.items.length;W++)Y[W]=this._ifNode(q(this.items[W],"items["+W+"]",this));return new G(Y)}clone(){return new G(this.items.slice(0))}_toString(q){var Y=this.items.map(function(W){return W.toString(q)});return"["+Y.join(", ")+"]"}toJSON(){return{mathjs:name$1B,items:this.items}}static fromJSON(q){return new G(q.items)}toHTML(q){var Y=this.items.map(function(W){return W.toHTML(q)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+Y.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(q){function Y(W,ie){var ne=W.some(isArrayNode)&&!W.every(isArrayNode),se=ie||ne,ae=se?"&":"\\\\",ce=W.map(function(pe){return pe.items?Y(pe.items,!ie):pe.toTex(q)}).join(ae);return ne||!se||se&&!ie?"\\begin{bmatrix}"+ce+"\\end{bmatrix}":ce}return Y(this.items,!1)}}return _defineProperty(G,"name",name$1B),G},{isClass:!0,isNode:!0});function assignFactory(v){var{subset:N,matrix:G}=v;return function(q,Y,W){try{if(Array.isArray(q)){var ie=G(q).subset(Y,W).valueOf();return ie.forEach((ne,se)=>{q[se]=ne}),q}else{if(q&&typeof q.subset=="function")return q.subset(Y,W);if(typeof q=="string")return N(q,Y,W);if(typeof q=="object"){if(!Y.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return setSafeProperty(q,Y.getObjectProperty(),W),q}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(ne){throw errorTransform(ne)}}}var properties=[{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 unwrapParen(v,N){if(!N||N!=="auto")return v;for(var G=v;isParenthesisNode(G);)G=G.content;return G}function getPrecedence(v,N,G,z){var q=v;N!=="keep"&&(q=v.getContent());for(var Y=q.getIdentifier(),W=null,ie=0;ie<properties.length;ie++)if(Y in properties[ie]){W=ie;break}if(Y==="OperatorNode:multiply"&&q.implicit&&G!=="show"){var ne=unwrapParen(q.args[0],N);!(isConstantNode(ne)&&z&&z.getIdentifier()==="OperatorNode:divide"&&rule2Node(unwrapParen(z.args[0],N)))&&!(ne.getIdentifier()==="OperatorNode:divide"&&rule2Node(unwrapParen(ne.args[0],N))&&isConstantNode(unwrapParen(ne.args[1])))&&(W+=1)}return W}function getAssociativity(v,N){var G=v;N!=="keep"&&(G=v.getContent());var z=G.getIdentifier(),q=getPrecedence(G,N);if(q===null)return null;var Y=properties[q][z];if(hasOwnProperty(Y,"associativity")){if(Y.associativity==="left")return"left";if(Y.associativity==="right")return"right";throw Error("'"+z+"' has the invalid associativity '"+Y.associativity+"'.")}return null}function isAssociativeWith(v,N,G){var z=G!=="keep"?v.getContent():v,q=G!=="keep"?v.getContent():N,Y=z.getIdentifier(),W=q.getIdentifier(),ie=getPrecedence(z,G);if(ie===null)return null;var ne=properties[ie][Y];if(hasOwnProperty(ne,"associativeWith")&&ne.associativeWith instanceof Array){for(var se=0;se<ne.associativeWith.length;se++)if(ne.associativeWith[se]===W)return!0;return!1}return null}function getOperator(v){var N="OperatorNode:"+v;for(var G of properties)if(N in G)return G[N].op;return null}var name$1A="AssignmentNode",dependencies$1A=["subset","?matrix","Node"],createAssignmentNode=factory(name$1A,dependencies$1A,v=>{var{subset:N,matrix:G,Node:z}=v,q=accessFactory({subset:N}),Y=assignFactory({subset:N,matrix:G});function W(ne,se,ae){se||(se="keep");var ce=getPrecedence(ne,se,ae),pe=getPrecedence(ne.value,se,ae);return se==="all"||pe!==null&&pe<=ce}class ie extends z{constructor(se,ae,ce){if(super(),this.object=se,this.index=ce?ae:null,this.value=ce||ae,!isSymbolNode(se)&&!isAccessorNode(se))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(isSymbolNode(se)&&se.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!isIndexNode(this.index))throw new TypeError('IndexNode expected as "index"');if(!isNode(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 name$1A}get isAssignmentNode(){return!0}_compile(se,ae){var ce=this.object._compile(se,ae),pe=this.index?this.index._compile(se,ae):null,ge=this.value._compile(se,ae),ve=this.object.name;if(this.index)if(this.index.isObjectProperty()){var be=this.index.getObjectProperty();return function(Ve,Re,qe){var et=ce(Ve,Re,qe),Ze=ge(Ve,Re,qe);return setSafeProperty(et,be,Ze),Ze}}else{if(isSymbolNode(this.object))return function(Ve,Re,qe){var et=ce(Ve,Re,qe),Ze=ge(Ve,Re,qe),tt=pe(Ve,Re,et);return Ve.set(ve,Y(et,tt,Ze)),Ze};var Ee=this.object.object._compile(se,ae);if(this.object.index.isObjectProperty()){var Pe=this.object.index.getObjectProperty();return function(Ve,Re,qe){var et=Ee(Ve,Re,qe),Ze=getSafeProperty(et,Pe),tt=pe(Ve,Re,Ze),Ke=ge(Ve,Re,qe);return setSafeProperty(et,Pe,Y(Ze,tt,Ke)),Ke}}else{var Je=this.object.index._compile(se,ae);return function(Ve,Re,qe){var et=Ee(Ve,Re,qe),Ze=Je(Ve,Re,et),tt=q(et,Ze),Ke=pe(Ve,Re,tt),rt=ge(Ve,Re,qe);return Y(et,Ze,Y(tt,Ke,rt)),rt}}}else{if(!isSymbolNode(this.object))throw new TypeError("SymbolNode expected as object");return function(Ve,Re,qe){var et=ge(Ve,Re,qe);return Ve.set(ve,et),et}}}forEach(se){se(this.object,"object",this),this.index&&se(this.index,"index",this),se(this.value,"value",this)}map(se){var ae=this._ifNode(se(this.object,"object",this)),ce=this.index?this._ifNode(se(this.index,"index",this)):null,pe=this._ifNode(se(this.value,"value",this));return new ie(ae,ce,pe)}clone(){return new ie(this.object,this.index,this.value)}_toString(se){var ae=this.object.toString(se),ce=this.index?this.index.toString(se):"",pe=this.value.toString(se);return W(this,se&&se.parenthesis,se&&se.implicit)&&(pe="("+pe+")"),ae+ce+" = "+pe}toJSON(){return{mathjs:name$1A,object:this.object,index:this.index,value:this.value}}static fromJSON(se){return new ie(se.object,se.index,se.value)}toHTML(se){var ae=this.object.toHTML(se),ce=this.index?this.index.toHTML(se):"",pe=this.value.toHTML(se);return W(this,se&&se.parenthesis,se&&se.implicit)&&(pe='<span class="math-paranthesis math-round-parenthesis">(</span>'+pe+'<span class="math-paranthesis math-round-parenthesis">)</span>'),ae+ce+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+pe}_toTex(se){var ae=this.object.toTex(se),ce=this.index?this.index.toTex(se):"",pe=this.value.toTex(se);return W(this,se&&se.parenthesis,se&&se.implicit)&&(pe="\\left(".concat(pe,"\\right)")),ae+ce+":="+pe}}return _defineProperty(ie,"name",name$1A),ie},{isClass:!0,isNode:!0}),name$1z="BlockNode",dependencies$1z=["ResultSet","Node"],createBlockNode=factory(name$1z,dependencies$1z,v=>{var{ResultSet:N,Node:G}=v;class z extends G{constructor(Y){if(super(),!Array.isArray(Y))throw new Error("Array expected");this.blocks=Y.map(function(W){var ie=W&&W.node,ne=W&&W.visible!==void 0?W.visible:!0;if(!isNode(ie))throw new TypeError('Property "node" must be a Node');if(typeof ne!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:ie,visible:ne}})}get type(){return name$1z}get isBlockNode(){return!0}_compile(Y,W){var ie=map(this.blocks,function(ne){return{evaluate:ne.node._compile(Y,W),visible:ne.visible}});return function(se,ae,ce){var pe=[];return forEach(ie,function(ve){var be=ve.evaluate(se,ae,ce);ve.visible&&pe.push(be)}),new N(pe)}}forEach(Y){for(var W=0;W<this.blocks.length;W++)Y(this.blocks[W].node,"blocks["+W+"].node",this)}map(Y){for(var W=[],ie=0;ie<this.blocks.length;ie++){var ne=this.blocks[ie],se=this._ifNode(Y(ne.node,"blocks["+ie+"].node",this));W[ie]={node:se,visible:ne.visible}}return new z(W)}clone(){var Y=this.blocks.map(function(W){return{node:W.node,visible:W.visible}});return new z(Y)}_toString(Y){return this.blocks.map(function(W){return W.node.toString(Y)+(W.visible?"":";")}).join(`
446`)}toJSON(){return{mathjs:name$1z,blocks:this.blocks}}static fromJSON(Y){return new z(Y.blocks)}toHTML(Y){return this.blocks.map(function(W){return W.node.toHTML(Y)+(W.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(Y){return this.blocks.map(function(W){return W.node.toTex(Y)+(W.visible?"":";")}).join(`\\;\\;
447`)}}return _defineProperty(z,"name",name$1z),z},{isClass:!0,isNode:!0}),name$1y="ConditionalNode",dependencies$1y=["Node"],createConditionalNode=factory(name$1y,dependencies$1y,v=>{var{Node:N}=v;function G(q){if(typeof q=="number"||typeof q=="boolean"||typeof q=="string")return!!q;if(q){if(isBigNumber(q))return!q.isZero();if(isComplex(q))return!!(q.re||q.im);if(isUnit(q))return!!q.value}if(q==null)return!1;throw new TypeError('Unsupported type of condition "'+typeOf(q)+'"')}class z extends N{constructor(Y,W,ie){if(super(),!isNode(Y))throw new TypeError("Parameter condition must be a Node");if(!isNode(W))throw new TypeError("Parameter trueExpr must be a Node");if(!isNode(ie))throw new TypeError("Parameter falseExpr must be a Node");this.condition=Y,this.trueExpr=W,this.falseExpr=ie}get type(){return name$1y}get isConditionalNode(){return!0}_compile(Y,W){var ie=this.condition._compile(Y,W),ne=this.trueExpr._compile(Y,W),se=this.falseExpr._compile(Y,W);return function(ce,pe,ge){return G(ie(ce,pe,ge))?ne(ce,pe,ge):se(ce,pe,ge)}}forEach(Y){Y(this.condition,"condition",this),Y(this.trueExpr,"trueExpr",this),Y(this.falseExpr,"falseExpr",this)}map(Y){return new z(this._ifNode(Y(this.condition,"condition",this)),this._ifNode(Y(this.trueExpr,"trueExpr",this)),this._ifNode(Y(this.falseExpr,"falseExpr",this)))}clone(){return new z(this.condition,this.trueExpr,this.falseExpr)}_toString(Y){var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=getPrecedence(this,W,Y&&Y.implicit),ne=this.condition.toString(Y),se=getPrecedence(this.condition,W,Y&&Y.implicit);(W==="all"||this.condition.type==="OperatorNode"||se!==null&&se<=ie)&&(ne="("+ne+")");var ae=this.trueExpr.toString(Y),ce=getPrecedence(this.trueExpr,W,Y&&Y.implicit);(W==="all"||this.trueExpr.type==="OperatorNode"||ce!==null&&ce<=ie)&&(ae="("+ae+")");var pe=this.falseExpr.toString(Y),ge=getPrecedence(this.falseExpr,W,Y&&Y.implicit);return(W==="all"||this.falseExpr.type==="OperatorNode"||ge!==null&&ge<=ie)&&(pe="("+pe+")"),ne+" ? "+ae+" : "+pe}toJSON(){return{mathjs:name$1y,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(Y){return new z(Y.condition,Y.trueExpr,Y.falseExpr)}toHTML(Y){var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=getPrecedence(this,W,Y&&Y.implicit),ne=this.condition.toHTML(Y),se=getPrecedence(this.condition,W,Y&&Y.implicit);(W==="all"||this.condition.type==="OperatorNode"||se!==null&&se<=ie)&&(ne='<span class="math-parenthesis math-round-parenthesis">(</span>'+ne+'<span class="math-parenthesis math-round-parenthesis">)</span>');var ae=this.trueExpr.toHTML(Y),ce=getPrecedence(this.trueExpr,W,Y&&Y.implicit);(W==="all"||this.trueExpr.type==="OperatorNode"||ce!==null&&ce<=ie)&&(ae='<span class="math-parenthesis math-round-parenthesis">(</span>'+ae+'<span class="math-parenthesis math-round-parenthesis">)</span>');var pe=this.falseExpr.toHTML(Y),ge=getPrecedence(this.falseExpr,W,Y&&Y.implicit);return(W==="all"||this.falseExpr.type==="OperatorNode"||ge!==null&&ge<=ie)&&(pe='<span class="math-parenthesis math-round-parenthesis">(</span>'+pe+'<span class="math-parenthesis math-round-parenthesis">)</span>'),ne+'<span class="math-operator math-conditional-operator">?</span>'+ae+'<span class="math-operator math-conditional-operator">:</span>'+pe}_toTex(Y){return"\\begin{cases} {"+this.trueExpr.toTex(Y)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(Y)+"}\\\\{"+this.falseExpr.toTex(Y)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return _defineProperty(z,"name",name$1y),z},{isClass:!0,isNode:!0}),dist,hasRequiredDist;function requireDist(){if(hasRequiredDist)return dist;hasRequiredDist=1;var v=Object.assign||function(q){for(var Y=1;Y<arguments.length;Y++){var W=arguments[Y];for(var ie in W)Object.prototype.hasOwnProperty.call(W,ie)&&(q[ie]=W[ie])}return q},N={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},G={"–":"\\--","—":"\\---"," ":"~","	":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},z=function(Y,W){return v({},Y,W)};return dist=function(q){for(var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=Y.preserveFormatting,ie=W===void 0?!1:W,ne=Y.escapeMapFn,se=ne===void 0?z:ne,ae=String(q),ce="",pe=se(v({},N),ie?v({},G):{}),ge=Object.keys(pe),ve=function(){var Ee=!1;ge.forEach(function(Pe,Je){Ee||ae.length>=Pe.length&&ae.slice(0,Pe.length)===Pe&&(ce+=pe[ge[Je]],ae=ae.slice(Pe.length,ae.length),Ee=!0)}),Ee||(ce+=ae.slice(0,1),ae=ae.slice(1,ae.length))};ae;)ve();return ce},dist}var distExports=requireDist();const escapeLatexLib=getDefaultExportFromCjs(distExports);var latexSymbols={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{?}"},latexOperators={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"},latexFunctions={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(latexOperators.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(latexOperators.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(latexOperators.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(latexOperators.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(latexOperators.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(latexOperators.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(latexOperators.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(latexOperators.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(latexOperators.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(latexOperators.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(latexOperators.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(latexOperators.bitAnd,"${args[1]}\\right)")},bitNot:{1:latexOperators.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(latexOperators.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(latexOperators.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(latexOperators.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(latexOperators.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(latexOperators.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(latexOperators.and,"${args[1]}\\right)")},not:{1:latexOperators.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(latexOperators.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(latexOperators.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}
447\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(latexOperators.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(latexOperators.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(latexOperators.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(latexOperators.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(latexOperators.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(latexOperators.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(latexOperators.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(latexOperators.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(latexOperators.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(latexOperators.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(latexOperators.to,"${args[1]}\\right)")},numeric:function v(N,G){return N.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(latexSymbols.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)"}},defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)",latexUnits={deg:"^\\circ"};function escapeLatex(v){return escapeLatexLib(v,{preserveFormatting:!0})}function toSymbol(v,N){return N=typeof N>"u"?!1:N,N?hasOwnProperty(latexUnits,v)?latexUnits[v]:"\\mathrm{"+escapeLatex(v)+"}":hasOwnProperty(latexSymbols,v)?latexSymbols[v]:escapeLatex(v)}var name$1x="ConstantNode",dependencies$1x=["Node"],createConstantNode=factory(name$1x,dependencies$1x,v=>{var{Node:N}=v;class G extends N{constructor(q){super(),this.value=q}get type(){return name$1x}get isConstantNode(){return!0}_compile(q,Y){var W=this.value;return function(){return W}}forEach(q){}map(q){return this.clone()}clone(){return new G(this.value)}_toString(q){return format(this.value,q)}toHTML(q){var Y=this._toString(q);switch(typeOf(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+Y+"</span>";case"string":return'<span class="math-string">
447'+Y+"</span>";case"boolean":return'<span class="math-boolean">'+Y+"</span>";case"null":return'<span class="math-null-symbol">'+Y+"</span>";case"undefined":return'<span class="math-undefined">'+Y+"</span>";default:return'<span class="math-symbol">'+Y+"</span>"}}toJSON(){return{mathjs:name$1x,value:this.value}}static fromJSON(q){return new G(q.value)}_toTex(q){var Y=this._toString(q);switch(typeOf(this.value)){case"string":return"\\mathtt{"+escapeLatex(Y)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var W=Y.toLowerCase().indexOf("e");if(W!==-1)return Y.substring(0,W)+"\\cdot10^{"+Y.substring(W+1)+"}"}return Y;case"Fraction":return this.value.toLatex();default:return Y}}}return _defineProperty(G,"name",name$1x),G},{isClass:!0,isNode:!0}),name$1w="FunctionAssignmentNode",dependencies$1w=["typed","Node"],createFunctionAssignmentNode=factory(name$1w,dependencies$1w,v=>{var{typed:N,Node:G}=v;function z(Y,W,ie){var ne=getPrecedence(Y,W,ie),se=getPrecedence(Y.expr,W,ie);return W==="all"||se!==null&&se<=ne}class q extends G{constructor(W,ie,ne){if(super(),typeof W!="string")throw new TypeError('String expected for parameter "name"');
vendor: 29,499 bytes, lines 447-450
447if(!Array.isArray(ie))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!isNode(ne))throw new TypeError('Node expected for parameter "expr"');if(keywords.has(W))throw new Error('Illegal function name, "'+W+'" is a reserved keyword');var se=new Set;for(var ae of ie){var ce=typeof ae=="string"?ae:ae.name;if(se.has(ce))throw new Error('Duplicate parameter name "'.concat(ce,'"'));se.add(ce)}this.name=W,this.params=ie.map(function(pe){return pe&&pe.name||pe}),this.types=ie.map(function(pe){return pe&&pe.type||"any"}),this.expr=ne}get type(){return name$1w}get isFunctionAssignmentNode(){return!0}_compile(W,ie){var ne=Object.create(ie);forEach(this.params,function(ve){ne[ve]=!0});var se=this.expr._compile(W,ne),ae=this.name,ce=this.params,pe=join(this.types,","),ge=ae+"("+join(this.params,", ")+")";return function(be,Ee,Pe){var Je={};Je[pe]=function(){for(var Ve=Object.create(Ee),Re=0;Re<ce.length;Re++)Ve[ce[Re]]=arguments[Re];return se(be,Ve,Pe)};var Ce=N(ae,Je);return Ce.syntax=ge,be.set(ae,Ce),Ce}}forEach(W){W(this.expr,"expr",this)}map(W){var ie=this._ifNode(W(this.expr,"expr",this));return new q(this.name,this.params.slice(0),ie)}clone(){return new q(this.name,this.params.slice(0),this.expr)}_toString(W){var ie=W&&W.parenthesis?W.parenthesis:"keep",ne=this.expr.toString(W);return z(this,ie,W&&W.implicit)&&(ne="("+ne+")"),this.name+"("+this.params.join(", ")+") = "+ne}toJSON(){var W=this.types;return{mathjs:name$1w,name:this.name,params:this.params.map(function(ie,ne){return{name:ie,type:W[ne]}}),expr:this.expr}}static fromJSON(W){return new q(W.name,W.params,W.expr)}toHTML(W){for(var ie=W&&W.parenthesis?W.parenthesis:"keep",ne=[],se=0;se<this.params.length;se++)ne.push('<span class="math-symbol math-parameter">'+escape(this.params[se])+"</span>");var ae=this.expr.toHTML(W);return z(this,ie,W&&W.implicit)&&(ae='<span class="math-parenthesis math-round-parenthesis">(</span>'+ae+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+escape(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+ne.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>'+ae}_toTex(W){var ie=W&&W.parenthesis?W.parenthesis:"keep",ne=this.expr.toTex(W);return z(this,ie,W&&W.implicit)&&(ne="\\left(".concat(ne,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(toSymbol).join(",")+"\\right):="+ne}}return _defineProperty(q,"name",name$1w),q},{isClass:!0,isNode:!0}),name$1v="IndexNode",dependencies$1v=["Node","size"],createIndexNode=factory(name$1v,dependencies$1v,v=>{var{Node:N,size:G}=v;class z extends N{constructor(Y,W){if(super(),this.dimensions=Y,this.dotNotation=W||!1,!Array.isArray(Y)||!Y.every(isNode))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 name$1v}get isIndexNode(){return!0}_compile(Y,W){var ie=map(this.dimensions,function(se,ae){var ce=se.filter(ve=>ve.isSymbolNode&&ve.name==="end").length>0;if(ce){var pe=Object.create(W);pe.end=!0;var ge=se._compile(Y,pe);return function(be,Ee,Pe){if(!isMatrix(Pe)&&!isArray(Pe)&&!isString(Pe))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+typeOf(Pe));var Je=G(Pe).valueOf(),Ce=Object.create(Ee);return Ce.end=Je[ae],ge(be,Ce,Pe)}}else return se._compile(Y,W)}),ne=getSafeProperty(Y,"index");return function(ae,ce,pe){var ge=map(ie,function(ve){return ve(ae,ce,pe)});return ne(...ge)}}forEach(Y){for(var W=0;W<this.dimensions.length;W++)Y(this.dimensions[W],"dimensions["+W+"]",this)}map(Y){for(var W=[],ie=0;ie<this.dimensions.length;ie++)W[ie]=this._ifNode(Y(this.dimensions[ie],"dimensions["+ie+"]",this));return new z(W,this.dotNotation)}clone(){return new z(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&isConstantNode(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(Y){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:name$1v,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(Y){return new z(Y.dimensions,Y.dotNotation)}toHTML(Y){for(var W=[],ie=0;ie<this.dimensions.length;ie++)W[ie]=this.dimensions[ie].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+escape(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+W.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(Y){var W=this.dimensions.map(function(ie){return ie.toTex(Y)});return this.dotNotation?"."+this.getObjectProperty():"_{"+W.join(",")+"}"}}return _defineProperty(z,"name",name$1v),z},{isClass:!0,isNode:!0}),name$1u="ObjectNode",dependencies$1u=["Node"],createObjectNode=factory(name$1u,dependencies$1u,v=>{var{Node:N}=v;class G extends N{constructor(q){if(super(),this.properties=q||{},q&&(typeof q!="object"||!Object.keys(q).every(function(Y){return isNode(q[Y])})))throw new TypeError("Object containing Nodes expected")}get type(){return name$1u}get isObjectNode(){return!0}_compile(q,Y){var W={};for(var ie in this.properties)if(hasOwnProperty(this.properties,ie)){var ne=stringify(ie),se=JSON.parse(ne),ae=getSafeProperty(this.properties,ie);W[se]=ae._compile(q,Y)}return function(pe,ge,ve){var be={};for(var Ee in W)hasOwnProperty(W,Ee)&&(be[Ee]=W[Ee](pe,ge,ve));return be}}forEach(q){for(var Y in this.properties)hasOwnProperty(this.properties,Y)&&q(this.properties[Y],"properties["+stringify(Y)+"]",this)}map(q){var Y={};for(var W in this.properties)hasOwnProperty(this.properties,W)&&(Y[W]=this._ifNode(q(this.properties[W],"properties["+stringify(W)+"]",this)));return new G(Y)}clone(){var q={};for(var Y in this.properties)hasOwnProperty(this.properties,Y)&&(q[Y]=this.properties[Y]);return new G(q)}_toString(q){var Y=[];for(var W in this.properties)hasOwnProperty(this.properties,W)&&Y.push(stringify(W)+": "+this.properties[W].toString(q));return"{"+Y.join(", ")+"}"}toJSON(){return{mathjs:name$1u,properties:this.properties}}static fromJSON(q){return new G(q.properties)}toHTML(q){var Y=[];for(var W in this.properties)hasOwnProperty(this.properties,W)&&Y.push('<span class="math-symbol math-property">'+escape(W)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[W].toHTML(q));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+Y.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(q){var Y=[];for(var W in this.properties)hasOwnProperty(this.properties,W)&&Y.push("\\mathbf{"+W+":} & "+this.properties[W].toTex(q)+"\\\\");var ie="\\left\\{\\begin{array}{ll}"+Y.join(`
448`)+"\\end{array}\\right\\}";return ie}}return _defineProperty(G,"name",name$1u),G},{isClass:!0,isNode:!0}),name$1t="OperatorNode",dependencies$1t=["Node"],createOperatorNode=factory(name$1t,dependencies$1t,v=>{var{Node:N}=v;function G(Y,W){var ie=Y;if(W==="auto")for(;isParenthesisNode(ie);)ie=ie.content;return isConstantNode(ie)?!0:isOperatorNode(ie)?G(ie.args[0],W):!1}function z(Y,W,ie,ne,se){var ae=getPrecedence(Y,W,ie),ce=getAssociativity(Y,W);if(W==="all"||ne.length>2&&Y.getIdentifier()!=="OperatorNode:add"&&Y.getIdentifier()!=="OperatorNode:multiply")return ne.map(function(Ke){switch(Ke.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var pe;switch(ne.length){case 0:pe=[];break;case 1:{var ge=getPrecedence(ne[0],W,ie,Y);if(se&&ge!==null){var ve,be;if(W==="keep"?(ve=ne[0].getIdentifier(),be=Y.getIdentifier()):(ve=ne[0].getContent().getIdentifier(),be=Y.getContent().getIdentifier()),properties[ae][be].latexLeftParens===!1){pe=[!1];break}if(properties[ge][ve].latexParens===!1){pe=[!1];break}}if(ge===null){pe=[!1];break}if(ge<=ae){pe=[!0];break}pe=[!1]}break;case 2:{var Ee,Pe=getPrecedence(ne[0],W,ie,Y),Je=isAssociativeWith(Y,ne[0],W);Pe===null?Ee=!1:Pe===ae&&ce==="right"&&!Je||Pe<ae?Ee=!0:Ee=!1;var Ce,Ve=getPrecedence(ne[1],W,ie,Y),Re=isAssociativeWith(Y,ne[1],W);if(Ve===null?Ce=!1:Ve===ae&&ce==="left"&&!Re||Ve<ae?Ce=!0:Ce=!1,se){var qe,et,Ze;W==="keep"?(qe=Y.getIdentifier(),et=Y.args[0].getIdentifier(),Ze=Y.args[1].getIdentifier()):(qe=Y.getContent().getIdentifier(),et=Y.args[0].getContent().getIdentifier(),Ze=Y.args[1].getContent().getIdentifier()),Pe!==null&&(properties[ae][qe].latexLeftParens===!1&&(Ee=!1),properties[Pe][et].latexParens===!1&&(Ee=!1)),Ve!==null&&(properties[ae][qe].latexRightParens===!1&&(Ce=!1),properties[Ve][Ze].latexParens===!1&&(Ce=!1))}pe=[Ee,Ce]}break;default:(Y.getIdentifier()==="OperatorNode:add"||Y.getIdentifier()==="OperatorNode:multiply")&&(pe=ne.map(function(Ke){var rt=getPrecedence(Ke,W,ie,Y),it=isAssociativeWith(Y,Ke,W),ot=getAssociativity(Ke,W);return rt===null?!1:ae===rt&&ce===ot&&!it?!0:rt<ae}));break}if(ne.length>=2&&Y.getIdentifier()==="OperatorNode:multiply"&&Y.implicit&&W!=="all"&&ie==="hide")for(var tt=1;tt<pe.length;++tt)G(ne[tt],W)&&!pe[tt-1]&&(W!=="keep"||!isParenthesisNode(ne[tt-1]))&&(pe[tt]=!0);return pe}class q extends N{constructor(W,ie,ne,se,ae){if(super(),typeof W!="string")throw new TypeError('string expected for parameter "op"');if(typeof ie!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(ne)||!ne.every(isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=se===!0,this.isPercentage=ae===!0,this.op=W,this.fn=ie,this.args=ne||[]}get type(){return name$1t}get isOperatorNode(){return!0}_compile(W,ie){if(typeof this.fn!="string"||!isSafeMethod(W,this.fn))throw W[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var ne=getSafeProperty(W,this.fn),se=map(this.args,function(ge){return ge._compile(W,ie)});if(se.length===1){var ae=se[0];return function(ve,be,Ee){return ne(ae(ve,be,Ee))}}else if(se.length===2){var ce=se[0],pe=se[1];return function(ve,be,Ee){return ne(ce(ve,be,Ee),pe(ve,be,Ee))}}else return function(ve,be,Ee){return ne.apply(null,map(se,function(Pe){return Pe(ve,be,Ee)}))}}forEach(W){for(var ie=0;ie<this.args.length;ie++)W(this.args[ie],"args["+ie+"]",this)}map(W){for(var ie=[],ne=0;ne<this.args.length;ne++)ie[ne]=this._ifNode(W(this.args[ne],"args["+ne+"]",this));return new q(this.op,this.fn,ie,this.implicit,this.isPercentage)}clone(){return new q(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(W){var ie=W&&W.parenthesis?W.parenthesis:"keep",ne=W&&W.implicit?W.implicit:"hide",se=this.args,ae=z(this,ie,ne,se,!1);if(se.length===1){var ce=getAssociativity(this,ie),pe=se[0].toString(W);ae[0]&&(pe="("+pe+")");var ge=/[a-zA-Z]+/.test(this.op);return ce==="right"?this.op+(ge?" ":"")+pe:ce==="left"?pe+(ge?" ":"")+this.op:pe+this.op}else if(se.length===2){var ve=se[0].toString(W),be=se[1].toString(W);return ae[0]&&(ve="("+ve+")"),ae[1]&&(be="("+be+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&ne==="hide"?ve+" "+be:ve+" "+this.op+" "+be}else if(se.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var Ee=se.map(function(Pe,Je){return Pe=Pe.toString(W),ae[Je]&&(Pe="("+Pe+")"),Pe});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&ne==="hide"?Ee.join(" "):Ee.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:name$1t,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(W){return new q(W.op,W.fn,W.args,W.implicit,W.isPercentage)}toHTML(W){var ie=W&&W.parenthesis?W.parenthesis:"keep",ne=W&&W.implicit?W.implicit:"hide",se=this.args,ae=z(this,ie,ne,se,!1);if(se.length===1){var ce=getAssociativity(this,ie),pe=se[0].toHTML(W);return ae[0]&&(pe='<span class="math-parenthesis math-round-parenthesis">(</span>'+pe+'<span class="math-parenthesis math-round-parenthesis">)</span>'),ce==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+escape(this.op)+"</span>"+pe:pe+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+escape(this.op)+"</span>"}else if(se.length===2){var ge=se[0].toHTML(W),ve=se[1].toHTML(W);return ae[0]&&(ge='<span class="math-parenthesis math-round-parenthesis">(</span>'+ge+'<span class="math-parenthesis math-round-parenthesis">)</span>'),ae[1]&&(ve='<span class="math-parenthesis math-round-parenthesis">(</span>'+ve+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&ne==="hide"?ge+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+ve:ge+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+escape(this.op)+"</span>"+ve}else{var be=se.map(function(Ee,Pe){return Ee=Ee.toHTML(W),ae[Pe]&&(Ee='<span class="math-parenthesis math-round-parenthesis">(</span>'+Ee+'<span class="math-parenthesis math-round-parenthesis">)</span>'),Ee});return se.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&ne==="hide"?be.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):be.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+escape(this.op)+"</span>"):'<span class="math-function">'+escape(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+be.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(W){var ie=W&&W.parenthesis?W.parenthesis:"keep",ne=W&&W.implicit?W.implicit:"hide",se=this.args,ae=z(this,ie,ne,se,!0),ce=latexOperators[this.fn];if(ce=typeof ce>"u"?this.op:ce,se.length===1){var pe=getAssociativity(this,ie),ge=se[0].toTex(W);return ae[0]&&(ge="\\left(".concat(ge,"\\right)")),pe==="right"?ce+ge:ge+ce}else if(se.length===2){var ve=se[0],be=ve.toTex(W);ae[0]&&(be="\\left(".concat(be,"\\right)"));var Ee=se[1],Pe=Ee.toTex(W);ae[1]&&(Pe="\\left(".concat(Pe,"\\right)"));var Je;switch(ie==="keep"?Je=ve.getIdentifier():Je=ve.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return ce+"{"+be+"}{"+Pe+"}";case"OperatorNode:pow":switch(be="{"+be+"}",Pe="{"+Pe+"}",Je){case"ConditionalNode":case"OperatorNode:divide":be="\\left(".concat(be,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&ne==="hide")return be+"~"+Pe}return be+ce+Pe}else if(se.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var Ce=se.map(function(Ve,Re){return Ve=Ve.toTex(W),ae[Re]&&(Ve="\\left(".concat(Ve,"\\right)")),Ve});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&ne==="hide"?Ce.join("~"):Ce.join(ce)}else return"\\mathrm{"+this.fn+"}\\left("+se.map(function(Ve){return Ve.toTex(W)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return _defineProperty(q,"name",name$1t),q},{isClass:!0,isNode:!0}),name$1s="ParenthesisNode",dependencies$1s=["Node"],createParenthesisNode=factory(name$1s,dependencies$1s,v=>{var{Node:N}=v;class G extends N{constructor(q){if(super(),!isNode(q))throw new TypeError('Node expected for parameter "content"');this.content=q}get type(){return name$1s}get isParenthesisNode(){return!0}_compile(q,Y){return this.content._compile(q,Y)}getContent(){return this.content.getContent()}forEach(q){q(this.content,"content",this)}map(q){var Y=q(this.content,"content",this);return new G(Y)}clone(){return new G(this.content)}_toString(q){return!q||q&&!q.parenthesis||q&&q.parenthesis==="keep"?"("+this.content.toString(q)+")":this.content.toString(q)}toJSON(){return{mathjs:name$1s,content:this.content}}static fromJSON(q){return new G(q.content)}toHTML(q){return!q||q&&!q.parenthesis||q&&q.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(q)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(q)}_toTex(q){return!q||q&&!q.parenthesis||q&&q.parenthesis==="keep"?"\\left(".concat(this.content.toTex(q),"\\right)"):this.content.toTex(q)}}return _defineProperty(G,"name",name$1s),G},{isClass:!0,isNode:!0}),name$1r="RangeNode",dependencies$1r=["Node"],createRangeNode=factory(name$1r,dependencies$1r,v=>{var{Node:N}=v;function G(q,Y,W){var ie=getPrecedence(q,Y,W),ne={},se=getPrecedence(q.start,Y,W);if(ne.start=se!==null&&se<=ie||Y==="all",q.step){var ae=getPrecedence(q.step,Y,W);ne.step=ae!==null&&ae<=ie||Y==="all"}var ce=getPrecedence(q.end,Y,W);return ne.end=ce!==null&&ce<=ie||Y==="all",ne}class z extends N{constructor(Y,W,ie){if(super(),!isNode(Y))throw new TypeError("Node expected");if(!isNode(W))throw new TypeError("Node expected");if(ie&&!isNode(ie))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=Y,this.end=W,this.step=ie||null}get type(){return name$1r}get isRangeNode(){return!0}needsEnd(){var Y=this.filter(function(W){return isSymbolNode(W)&&W.name==="end"});return Y.length>0}_compile(Y,W){var ie=Y.range,ne=this.start._compile(Y,W),se=this.end._compile(Y,W);if(this.step){var ae=this.step._compile(Y,W);return function(pe,ge,ve){return ie(ne(pe,ge,ve),se(pe,ge,ve),ae(pe,ge,ve))}}else return function(pe,ge,ve){return ie(ne(pe,ge,ve),se(pe,ge,ve))}}forEach(Y){Y(this.start,"start",this),Y(this.end,"end",this),this.step&&Y(this.step,"step",this)}map(Y){return new z(this._ifNode(Y(this.start,"start",this)),this._ifNode(Y(this.end,"end",this)),this.step&&this._ifNode(Y(this.step,"step",this)))}clone(){return new z(this.start,this.end,this.step&&this.step)}_toString(Y){var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=G(this,W,Y&&Y.implicit),ne,se=this.start.toString(Y);if(ie.start&&(se="("+se+")"),ne=se,this.step){var ae=this.step.toString(Y);ie.step&&(ae="("+ae+")"),ne+=":"+ae}var ce=this.end.toString(Y);return ie.end&&(ce="("+ce+")"),ne+=":"+ce,ne}toJSON(){return{mathjs:name$1r,start:this.start,end:this.end,step:this.step}}static fromJSON(Y){return new z(Y.start,Y.end,Y.step)}toHTML(Y){var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=G(this,W,Y&&Y.implicit),ne,se=this.start.toHTML(Y);if(ie.start&&(se='<span class="math-parenthesis math-round-parenthesis">(</span>'+se+'<span class="math-parenthesis math-round-parenthesis">)</span>'),ne=se,this.step){var ae=this.step.toHTML(Y);ie.step&&(ae='<span class="math-parenthesis math-round-parenthesis">(</span>'+ae+'<span class="math-parenthesis math-round-parenthesis">)</span>'),ne+='<span class="math-operator math-range-operator">:</span>'+ae}var ce=this.end.toHTML(Y);return ie.end&&(ce='<span class="math-parenthesis math-round-parenthesis">(</span>'+ce+'<span class="math-parenthesis math-round-parenthesis">)</span>'),ne+='<span class="math-operator math-range-operator">:</span>'+ce,ne}_toTex(Y){var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=G(this,W,Y&&Y.implicit),ne=this.start.toTex(Y);if(ie.start&&(ne="\\left(".concat(ne,"\\right)")),this.step){var se=this.step.toTex(Y);ie.step&&(se="\\left(".concat(se,"\\right)")),ne+=":"+se}var ae=this.end.toTex(Y);return ie.end&&(ae="\\left(".concat(ae,"\\right)")),ne+=":"+ae,ne}}return _defineProperty(z,"name",name$1r),z},{isClass:!0,isNode:!0}),name$1q="RelationalNode",dependencies$1q=["Node"],createRelationalNode=factory(name$1q,dependencies$1q,v=>{var{Node:N}=v,G={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class z extends N{constructor(Y,W){if(super(),!Array.isArray(Y))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(W))throw new TypeError("Parameter params must be an array");if(Y.length!==W.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=Y,this.params=W}get type(){return name$1q}get isRelationalNode(){return!0}_compile(Y,W){var ie=this,ne=this.params.map(se=>se._compile(Y,W));return function(ae,ce,pe){for(var ge,ve=ne[0](ae,ce,pe),be=0;be<ie.conditionals.length;be++){ge=ve,ve=ne[be+1](ae,ce,pe);var Ee=getSafeProperty(Y,ie.conditionals[be]);if(!Ee(ge,ve))return!1}return!0}}forEach(Y){this.params.forEach((W,ie)=>Y(W,"params["+ie+"]",this),this)}map(Y){return new z(this.conditionals.slice(),this.params.map((W,ie)=>this._ifNode(Y(W,"params["+ie+"]",this)),this))}clone(){return new z(this.conditionals,this.params)}_toString(Y){for(var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=getPrecedence(this,W,Y&&Y.implicit),ne=this.params.map(function(ce,pe){var ge=getPrecedence(ce,W,Y&&Y.implicit);return W==="all"||ge!==null&&ge<=ie?"("+ce.toString(Y)+")":ce.toString(Y)}),se=ne[0],ae=0;ae<this.conditionals.length;ae++)se+=" "+G[this.conditionals[ae]],se+=" "+ne[ae+1];return se}toJSON(){return{mathjs:name$1q,conditionals:this.conditionals,params:this.params}}static fromJSON(Y){return new z(Y.conditionals,Y.params)}toHTML(Y){for(var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=getPrecedence(this,W,Y&&Y.implicit),ne=this.params.map(function(ce,pe){var ge=getPrecedence(ce,W,Y&&Y.implicit);return W==="all"||ge!==null&&ge<=ie?'<span class="math-parenthesis math-round-parenthesis">(</span>'+ce.toHTML(Y)+'<span class="math-parenthesis math-round-parenthesis">)</span>':ce.toHTML(Y)}),se=ne[0],ae=0;ae<this.conditionals.length;ae++)se+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+escape(G[this.conditionals[ae]])+"</span>"+ne[ae+1];return se}_toTex(Y){for(var W=Y&&Y.parenthesis?Y.parenthesis:"keep",ie=getPrecedence(this,W,Y&&Y.implicit),ne=this.params.map(function(ce,pe){var ge=getPrecedence(ce,W,Y&&Y.implicit);return W==="all"||ge!==null&&ge<=ie?"\\left("+ce.toTex(Y)+"\right)":ce.toTex(Y)}),se=ne[0],ae=0;ae<this.conditionals.length;ae++)se+=latexOperators[this.conditionals[ae]]+ne[ae+1];return se}}return _defineProperty(z,"name",name$1q),z},{isClass:!0,isNode:!0}),name$1p="SymbolNode",dependencies$1p=["math","?Unit","Node"],createSymbolNode=factory(name$1p,dependencies$1p,v=>{var{math:N,Unit:G,Node:z}=v;function q(W){return G?G.isValuelessUnit(W):!1}class Y extends z{constructor(ie){if(super(),typeof ie!="string")throw new TypeError('String expected for parameter "name"');this.name=ie}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(ie,ne){var se=this.name;if(ne[se]===!0)return function(ce,pe,ge){return getSafeProperty(pe,se)};if(se in ie)return function(ce,pe,ge){return ce.has(se)?ce.get(se):getSafeProperty(ie,se)};var ae=q(se);return function(ce,pe,ge){return ce.has(se)?ce.get(se):ae?new G(null,se):Y.onUndefinedSymbol(se)}}forEach(ie){}map(ie){return this.clone()}static onUndefinedSymbol(ie){throw new Error("Undefined symbol "+ie)}clone(){return new Y(this.name)}_toString(ie){return this.name}toHTML(ie){var ne=escape(this.name);return ne==="true"||ne==="false"?'<span class="math-symbol math-boolean">'+ne+"</span>":ne==="i"?'<span class="math-symbol math-imaginary-symbol">'+ne+"</span>":ne==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+ne+"</span>":ne==="NaN"?'<span class="math-symbol math-nan-symbol">'+ne+"</span>":ne==="null"?'<span class="math-symbol math-null-symbol">'+ne+"</span>":ne==="undefined"?'<span class="math-symbol math-undefined-symbol">'+ne+"</span>":'<span class="math-symbol">'+ne+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(ie){return new Y(ie.name)}_toTex(ie){var ne=!1;typeof N[this.name]>"u"&&q(this.name)&&(ne=!0);var se=toSymbol(this.name,ne);return se[0]==="\\"?se:" "+se}}return Y},{isClass:!0,isNode:!0});function createSubScope(v){for(var N=arguments.length,G=new Array(N>1?N-1:0),z=1;z<N;z++)G[z-1]=arguments[z];return typeof v.createSubScope=="function"?assign(v.createSubScope(),...G):assign(createEmptyMap(),v,...G)}var name$1o="FunctionNode",dependencies$1o=["math","Node","SymbolNode"],createFunctionNode=factory(name$1o,dependencies$1o,v=>{var N,{math:G,Node:z,SymbolNode:q}=v,Y=ne=>format(ne,{truncate:78});function W(ne,se,ae){for(var ce="",pe=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,ge=0,ve;(ve=pe.exec(ne))!==null;)if(ce+=ne.substring(ge,ve.index),ge=ve.index,ve[0]==="$$")ce+="$",ge++;else{ge+=ve[0].length;var be=se[ve[1]];if(!be)throw new ReferenceError("Template: Property "+ve[1]+" does not exist.");if(ve[2]===void 0)switch(typeof be){case"string":ce+=be;break;case"object":if(isNode(be))ce+=be.toTex(ae);else if(Array.isArray(be))ce+=be.map(function(Ee,Pe){if(isNode(Ee))return Ee.toTex(ae);throw new TypeError("Template: "+ve[1]+"["+Pe+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+ve[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+ve[1]+" has to be a Node, String or array of Nodes")}else if(isNode(be[ve[2]]&&be[ve[2]]))ce+=be[ve[2]].toTex(ae);else throw new TypeError("Template: "+ve[1]+"["+ve[2]+"] is not a Node.")}return ce+=ne.slice(ge),ce}class ie extends z{constructor(se,ae){if(super(),typeof se=="string"&&(se=new q(se)),!isNode(se))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(ae)||!ae.every(isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=se,this.args=ae||[]}get name(){return this.fn.name||""}get type(){return name$1o}get isFunctionNode(){return!0}_compile(se,ae){var ce=this.args.map(Ze=>Ze._compile(se,ae));if(isSymbolNode(this.fn)){var pe=this.fn.name;if(ae[pe]){var Pe=this.args;return function(tt,Ke,rt){var it=getSafeProperty(Ke,pe);if(typeof it!="function")throw new TypeError("Argument '".concat(pe,"' was not a function; received: ").concat(Y(it)));if(it.rawArgs)return it(Pe,se,createSubScope(tt,Ke),tt);var ot=ce.map(ut=>ut(tt,Ke,rt));return it.apply(it,ot)}}else{var ge=pe in se?getSafeProperty(se,pe):void 0,ve=typeof ge=="function"&&ge.rawArgs===!0,be=Ze=>{var tt;if(Ze.has(pe))tt=Ze.get(pe);else if(pe in se)tt=getSafeProperty(se,pe);else return ie.onUndefinedFunction(pe);if(typeof tt=="function")return tt;throw new TypeError("'".concat(pe,`' is not a function; its value is:
449  `).concat(Y(tt)))};if(ve){var Ee=this.args;return function(tt,Ke,rt){var it=be(tt);return it(Ee,se,createSubScope(tt,Ke),tt)}}else switch(ce.length){case 0:return function(tt,Ke,rt){var it=be(tt);return it()};case 1:return function(tt,Ke,rt){var it=be(tt),ot=ce[0];return it(ot(tt,Ke,rt))};case 2:return function(tt,Ke,rt){var it=be(tt),ot=ce[0],ut=ce[1];return it(ot(tt,Ke,rt),ut(tt,Ke,rt))};default:return function(tt,Ke,rt){var it=be(tt),ot=ce.map(ut=>ut(tt,Ke,rt));return it(...ot)}}}}else if(isAccessorNode(this.fn)&&isIndexNode(this.fn.index)&&this.fn.index.isObjectProperty()){var Je=this.fn.object._compile(se,ae),Ce=this.fn.index.getObjectProperty(),Ve=this.args;return function(tt,Ke,rt){var it=Je(tt,Ke,rt),ot=getSafeMethod(it,Ce);if(ot!=null&&ot.rawArgs)return ot(Ve,se,createSubScope(tt,Ke),tt);var ut=ce.map(ct=>ct(tt,Ke,rt));return ot.apply(it,ut)}}else{var Re=this.fn.toString(),qe=this.fn._compile(se,ae),et=this.args;return function(tt,Ke,rt){var it=qe(tt,Ke,rt);if(typeof it!="function")throw new TypeError("Expression '".concat(Re,"' did not evaluate to a function; value is:")+`
450  `.concat(Y(it)));if(it.rawArgs)return it(et,se,createSubScope(tt,Ke),tt);var ot=ce.map(ut=>ut(tt,Ke,rt));return it.apply(it,ot)}}}forEach(se){se(this.fn,"fn",this);for(var ae=0;ae<this.args.length;ae++)se(this.args[ae],"args["+ae+"]",this)}map(se){for(var ae=this._ifNode(se(this.fn,"fn",this)),ce=[],pe=0;pe<this.args.length;pe++)ce[pe]=this._ifNode(se(this.args[pe],"args["+pe+"]",this));return new ie(ae,ce)}clone(){return new ie(this.fn,this.args.slice(0))}toString(se){var ae,ce=this.fn.toString(se);return se&&typeof se.handler=="object"&&hasOwnProperty(se.handler,ce)&&(ae=se.handler[ce](this,se)),typeof ae<"u"?ae:super.toString(se)}_toString(se){var ae=this.args.map(function(pe){return pe.toString(se)}),ce=isFunctionAssignmentNode(this.fn)?"("+this.fn.toString(se)+")":this.fn.toString(se);return ce+"("+ae.join(", ")+")"}toJSON(){return{mathjs:name$1o,fn:this.fn,args:this.args}}toHTML(se){var ae=this.args.map(function(ce){return ce.toHTML(se)});return'<span class="math-function">'+escape(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+ae.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(se){var ae;return se&&typeof se.handler=="object"&&hasOwnProperty(se.handler,this.name)&&(ae=se.handler[this.name](this,se)),typeof ae<"u"?ae:super.toTex(se)}_toTex(se){var ae=this.args.map(function(ge){return ge.toTex(se)}),ce;latexFunctions[this.name]&&(ce=latexFunctions[this.name]),G[this.name]&&(typeof G[this.name].toTex=="function"||typeof G[this.name].toTex=="object"||typeof G[this.name].toTex=="str
450ing")&&(ce=G[this.name].toTex);var pe;switch(typeof ce){case"function":pe=ce(this,se);break;case"string":pe=W(ce,this,se);break;case"object":switch(typeof ce[ae.length]){case"function":pe=ce[ae.length](this,se);break;case"string":pe=W(ce[ae.length],this,se);break}}return typeof pe<"u"?pe:W(defaultTemplate,this,se)}getIdentifier(){return this.type+":"+this.name}}return N=ie,_defineProperty(ie,"name",name$1o),_defineProperty(ie,"onUndefinedFunction",function(ne){throw new Error("Undefined function "+ne)}),_defineProperty(ie,"fromJSON",function(ne){return new N(ne.fn,ne.args)}),ie},{isClass:!0,isNode:!0}),name$1n="parse",dependencies$1n=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],createParse=factory(name$1n,dependencies$1n,v=>{var{typed:N,numeric:G,config:z,AccessorNode:q,ArrayNode:Y,AssignmentNode:W,BlockNode:ie,ConditionalNode:ne,ConstantNode:se,FunctionAssignmentNode:ae,FunctionNode:ce,IndexNode:pe,ObjectNode:ge,OperatorNode:ve,ParenthesisNode:be,RangeNode:Ee,RelationalNode:Pe,SymbolNode:Je}=v,Ce=N(name$1n,{string:function(Nt){return dt(Nt,{})},"Array | Matrix":function(Nt){return Ve(Nt,{})},"string, Object":function(Nt,Qt){var ar=Qt.nodes!==void 0?Qt.nodes:{};return dt(Nt,ar)},"Array | Matrix, Object":Ve});function Ve(gt){var Nt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Qt=Nt.nodes!==void 0?Nt.nodes:{};return deepMap(gt,function(ar){if(typeof ar!="string")throw new TypeError("String expected");return dt(ar,Qt)})}var Re={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},qe={",":!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},et={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},Ze={true:!0,false:!1,null:null,undefined:void 0},tt=["NaN","Infinity"],Ke={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
451`,r:"\r",t:"	"};function rt(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:Re.NULL,nestingLevel:0,conditionalLevel:null}}function it(gt,Nt){return gt.expression.substr(gt.index,Nt)}function ot(gt){return it(gt,1)}function ut(gt){gt.index++}function ct(gt){return gt.expression.charAt(gt.index-1)}function at(gt){return gt.expression.charAt(gt.index+1)}function st(gt){for(gt.tokenType=Re.NULL,gt.token="",gt.comment="";;){if(ot(gt)==="#")for(;ot(gt)!==`
452`&&ot(gt)!=="";)gt.comment+=ot(gt),ut(gt);if(Ce.isWhitespace(ot(gt),gt.nestingLevel))ut(gt);else break}if(ot(gt)===""){gt.tokenType=Re.DELIMITER;return}if(ot(gt)===`
453`&&!gt.nestingLevel){gt.tokenType=Re.DELIMITER,gt.token=ot(gt),ut(gt);return}var Nt=ot(gt),Qt=it(gt,2),ar=it(gt,3);if(ar.length===3&&qe[ar]){gt.tokenType=Re.DELIMITER,gt.token=ar,ut(gt),ut(gt),ut(gt);return}if(Qt.length===2&&qe[Qt]){gt.tokenType=Re.DELIMITER,gt.token=Qt,ut(gt),ut(gt);return}if(qe[Nt]){gt.tokenType=Re.DELIMITER,gt.token=Nt,ut(gt);return}if(Ce.isDigitDot(Nt)){gt.tokenType=Re.NUMBER;var vr=it(gt,2);if(vr==="0b"||vr==="0o"||vr==="0x"){for(gt.token+=ot(gt),ut(gt),gt.token+=ot(gt),ut(gt);Ce.isHexDigit(ot(gt));)gt.token+=ot(gt),ut(gt);if(ot(gt)===".")for(gt.token+=".",ut(gt);Ce.isHexDigit(ot(gt));)gt.token+=ot(gt),ut(gt);else if(ot(gt)==="i")for(gt.token+="i",ut(gt);Ce.isDigit(ot(gt));)gt.token+=ot(gt),ut(gt);return}if(ot(gt)==="."){if(gt.token+=ot(gt),ut(gt),!Ce.isDigit(ot(gt))){gt.tokenType=Re.DELIMITER;return}}else{for(;Ce.isDigit(ot(gt));)gt.token+=ot(gt),ut(gt);Ce.isDecimalMark(ot(gt),at(gt))&&(gt.token+=ot(gt),ut(gt))}for(;Ce.isDigit(ot(gt));)gt.token+=ot(gt),ut(gt);if(ot(gt)==="E"||ot(gt)==="e"){if(Ce.isDigit(at(gt))||at(gt)==="-"||at(gt)==="+"){if(gt.token+=ot(gt),ut(gt),(ot(gt)==="+"||ot(gt)==="-")&&(gt.token+=ot(gt),ut(gt)),!Ce.isDigit(ot(gt)))throw sr(gt,'Digit expected, got "'+ot(gt)+'"');for(;Ce.isDigit(ot(gt));)gt.token+=ot(gt),ut(gt);if(Ce.isDecimalMark(ot(gt),at(gt)))throw sr(gt,'Digit expected, got "'+ot(gt)+'"')}else if(at(gt)===".")throw ut(gt),sr(gt,'Digit expected, got "'+ot(gt)+'"')}return}if(Ce.isAlpha(ot(gt),ct(gt),at(gt))){for(;Ce.isAlpha(ot(gt),ct(gt),at(gt))||Ce.isDigit(ot(gt));)gt.token+=ot(gt),ut(gt);hasOwnProperty(et,gt.token)?gt.tokenType=Re.DELIMITER:gt.tokenType=Re.SYMBOL;return}for(gt.tokenType=Re.UNKNOWN;ot(gt)!=="";)gt.token+=ot(gt),ut(gt);throw sr(gt,'Syntax error in part "'+gt.token+'"')}function pt(gt){do st(gt);while(gt.token===`
454`)}function lt(gt){gt.nestingLevel++}function vt(gt){gt.nestingLevel--}Ce.isAlpha=function(Nt,Qt,ar){return Ce.isValidLatinOrGreek(Nt)||Ce.isValidMathSymbol(Nt,ar)||Ce.isValidMathSymbol(Qt,Nt)},Ce.isValidLatinOrGreek=function(Nt){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Nt)}
vendor: 35,473 bytes, lines 454-486
454,Ce.isValidMathSymbol=function(Nt,Qt){return/^[\uD835]$/.test(Nt)&&/^[\uDC00-\uDFFF]$/.test(Qt)&&/^[^\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(Qt)},Ce.isWhitespace=function(Nt,Qt){return Nt===" "||Nt==="	"||Nt===`
455`&&Qt>0},Ce.isDecimalMark=function(Nt,Qt){return Nt==="."&&Qt!=="/"&&Qt!=="*"&&Qt!=="^"},Ce.isDigitDot=function(Nt){return Nt>="0"&&Nt<="9"||Nt==="."},Ce.isDigit=function(Nt){return Nt>="0"&&Nt<="9"},Ce.isHexDigit=function(Nt){return Nt>="0"&&Nt<="9"||Nt>="a"&&Nt<="f"||Nt>="A"&&Nt<="F"};function dt(gt,Nt){var Qt=rt();_extends(Qt,{expression:gt,extraNodes:Nt}),st(Qt);var ar=xt(Qt);if(Qt.token!=="")throw Qt.tokenType===Re.DELIMITER?nr(Qt,"Unexpected operator "+Qt.token):sr(Qt,'Unexpected part "'+Qt.token+'"');return ar}function xt(gt){var Nt,Qt=[],ar;for(gt.token!==""&&gt.token!==`
456`&&gt.token!==";"&&(Nt=ft(gt),gt.comment&&(Nt.comment=gt.comment));gt.token===`
457`||gt.token===";";)Qt.length===0&&Nt&&(ar=gt.token!==";",Qt.push({node:Nt,visible:ar})),st(gt),gt.token!==`
458`&&gt.token!==";"&&gt.token!==""&&(Nt=ft(gt),gt.comment&&(Nt.comment=gt.comment),ar=gt.token!==";",Qt.push({node:Nt,visible:ar}));return Qt.length>0?new ie(Qt):(Nt||(Nt=new se(void 0),gt.comment&&(Nt.comment=gt.comment)),Nt)}function ft(gt){var Nt,Qt,ar,vr,xr=Et(gt);if(gt.token==="="){if(isSymbolNode(xr))return Nt=xr.name,pt(gt),ar=ft(gt),new W(new Je(Nt),ar);if(isAccessorNode(xr))return pt(gt),ar=ft(gt),new W(xr.object,xr.index,ar);if(isFunctionNode(xr)&&isSymbolNode(xr.fn)&&(vr=!0,Qt=[],Nt=xr.name,xr.args.forEach(function(Er,ti){isSymbolNode(Er)?Qt[ti]=Er.name:vr=!1}),vr))return pt(gt),ar=ft(gt),new ae(Nt,Qt,ar);throw sr(gt,"Invalid left hand side of assignment operator =")}return xr}function Et(gt){for(var Nt=Ct(gt);gt.token==="?";){var Qt=gt.conditionalLevel;gt.conditionalLevel=gt.nestingLevel,pt(gt);var ar=Nt,vr=ft(gt);if(gt.token!==":")throw sr(gt,"False part of conditional expression expected");gt.conditionalLevel=null,pt(gt);var xr=ft(gt);Nt=new ne(ar,vr,xr),gt.conditionalLevel=Qt}return Nt}function Ct(gt){for(var Nt=Dt(gt);gt.token==="or";)pt(gt),Nt=new ve("or","or",[Nt,Dt(gt)]);return Nt}function Dt(gt){for(var Nt=Gt(gt);gt.token==="xor";)pt(gt),Nt=new ve("xor","xor",[Nt,Gt(gt)]);return Nt}function Gt(gt){for(var Nt=Ot(gt);gt.token==="and";)pt(gt),Nt=new ve("and","and",[Nt,Ot(gt)]);return Nt}function Ot(gt){for(var Nt=It(gt);gt.token==="|";)pt(gt),Nt=new ve("|","bitOr",[Nt,It(gt)]);return Nt}function It(gt){for(var Nt=Bt(gt);gt.token==="^|";)pt(gt),Nt=new ve("^|","bitXor",[Nt,Bt(gt)]);return Nt}function Bt(gt){for(var Nt=Ht(gt);gt.token==="&";)pt(gt),Nt=new ve("&","bitAnd",[Nt,Ht(gt)]);return Nt}function Ht(gt){for(var Nt=[ir(gt)],Qt=[],ar={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};hasOwnProperty(ar,gt.token);){var vr={name:gt.token,fn:ar[gt.token]};Qt.push(vr),pt(gt),Nt.push(ir(gt))}return Nt.length===1?Nt[0]:Nt.length===2?new ve(Qt[0].name,Qt[0].fn,Nt):new Pe(Qt.map(xr=>xr.fn),Nt)}function ir(gt){var Nt,Qt,ar,vr;Nt=zt(gt);for(var xr={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};hasOwnProperty(xr,gt.token);)Qt=gt.token,ar=xr[Qt],pt(gt),vr=[Nt,zt(gt)],Nt=new ve(Qt,ar,vr);return Nt}function zt(gt){var Nt,Qt,ar,vr;Nt=tr(gt);for(var xr={to:"to",in:"to"};hasOwnProperty(xr,gt.token);)Qt=gt.token,ar=xr[Qt],pt(gt),Qt==="in"&&gt.token===""?Nt=new ve("*","multiply",[Nt,new Je("in")],!0):(vr=[Nt,tr(gt)],Nt=new ve(Qt,ar,vr));return Nt}function tr(gt){var Nt,Qt=[];if(gt.token===":"?Nt=new se(1):Nt=bt(gt),gt.token===":"&&gt.conditionalLevel!==gt.nestingLevel){for(Qt.push(Nt);gt.token===":"&&Qt.length<3;)pt(gt),gt.token===")"||gt.token==="]"||gt.token===","||gt.token===""?Qt.push(new Je("end")):Qt.push(bt(gt));Qt.length===3?Nt=new Ee(Qt[0],Qt[2],Qt[1]):Nt=new Ee(Qt[0],Qt[1])}return Nt}function bt(gt){var Nt,Qt,ar,vr;Nt=_t(gt);for(var xr={"+":"add","-":"subtract"};hasOwnProperty(xr,gt.token);){Qt=gt.token,ar=xr[Qt],pt(gt);var Er=_t(gt);Er.isPercentage?vr=[Nt,new ve("*","multiply",[Nt,Er])]:vr=[Nt,Er],Nt=new ve(Qt,ar,vr)}return Nt}function _t(gt){var Nt,Qt,ar,vr;Nt=Xt(gt),Qt=Nt;for(var xr={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};hasOwnProperty(xr,gt.token);)ar=gt.token,vr=xr[ar],pt(gt),Qt=Xt(gt),Nt=new ve(ar,vr,[Nt,Qt]);return Nt}function Xt(gt){var Nt,Qt;for(Nt=At(gt),Qt=Nt;gt.tokenType===Re.SYMBOL||gt.token==="in"&&isConstantNode(Nt)||gt.tokenType===Re.NUMBER&&!isConstantNode(Qt)&&(!isOperatorNode(Qt)||Qt.op==="!")||gt.token==="(";)Qt=At(gt),Nt=new ve("*","multiply",[Nt,Qt],!0);return Nt}function At(gt){for(var Nt=$t(gt),Qt=Nt,ar=[];gt.token==="/"&&rule2Node(Qt);)if(ar.push(_extends({},gt)),pt(gt),gt.tokenType===Re.NUMBER)if(ar.push(_extends({},gt)),pt(gt),gt.tokenType===Re.SYMBOL||gt.token==="(")_extends(gt,ar.pop()),ar.pop(),Qt=$t(gt),Nt=new ve("/","divide",[Nt,Qt]);else{ar.pop(),_extends(gt,ar.pop());break}else{_extends(gt,ar.pop());break}return Nt}function $t(gt){var Nt,Qt,ar,vr;Nt=Pt(gt);for(var xr={"%":"mod",mod:"mod"};hasOwnProperty(xr,gt.token);)Qt=gt.token,ar=xr[Qt],pt(gt),Qt==="%"&&gt.tokenType===Re.DELIMITER&&gt.token!=="("?Nt=new ve("/","divide",[Nt,new se(100)],!1,!0):(vr=[Nt,Pt(gt)],Nt=new ve(Qt,ar,vr));return Nt}function Pt(gt){var Nt,Qt,ar,vr={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return hasOwnProperty(vr,gt.token)?(ar=vr[gt.token],Nt=gt.token,pt(gt),Qt=[Pt(gt)],new ve(Nt,ar,Qt)):kt(gt)}function kt(gt){var Nt,Qt,ar,vr;return Nt=jt(gt),(gt.token==="^"||gt.token===".^")&&(Qt=gt.token,ar=Qt==="^"?"pow":"dotPow",pt(gt),vr=[Nt,Pt(gt)],Nt=new ve(Qt,ar,vr)),Nt}function jt(gt){var Nt,Qt,ar,vr;Nt=wt(gt);for(var xr={"!":"factorial","'":"ctranspose"};hasOwnProperty(xr,gt.token);)Qt=gt.token,ar=xr[Qt],st(gt),vr=[Nt],Nt=new ve(Qt,ar,vr),Nt=Tt(gt,Nt);return Nt}function wt(gt){var Nt=[];if(gt.tokenType===Re.SYMBOL&&hasOwnProperty(gt.extraNodes,gt.token)){var Qt=gt.extraNodes[gt.token];if(st(gt),gt.token==="("){if(Nt=[],lt(gt),st(gt),gt.token!==")")for(Nt.push(ft(gt));gt.token===",";)st(gt),Nt.push(ft(gt));if(gt.token!==")")throw sr(gt,"Parenthesis ) expected");vt(gt),st(gt)}return new Qt(Nt)}return Mt(gt)}function Mt(gt){var Nt,Qt;return gt.tokenType===Re.SYMBOL||gt.tokenType===Re.DELIMITER&&gt.token in et?(Qt=gt.token,st(gt),hasOwnProperty(Ze,Qt)?Nt=new se(Ze[Qt]):tt.indexOf(Qt)!==-1?Nt=new se(G(Qt,"number")):Nt=new Je(Qt),Nt=Tt(gt,Nt),Nt):Rt(gt)}function Tt(gt,Nt,Qt){for(var ar;gt.token==="("||gt.token==="["||gt.token===".";)if(ar=[],gt.token==="(")if(isSymbolNode(Nt)||isAccessorNode(Nt)){if(lt(gt),st(gt),gt.token!==")")for(ar.push(ft(gt));gt.token===",";)st(gt),ar.push(ft(gt));if(gt.token!==")")throw sr(gt,"Parenthesis ) expected");vt(gt),st(gt),Nt=new ce(Nt,ar)}else return Nt;else if(gt.token==="["){if(lt(gt),st(gt),gt.token!=="]")for(ar.push(ft(gt));gt.token===",";)st(gt),ar.push(ft(gt));if(gt.token!=="]")throw sr(gt,"Parenthesis ] expected");vt(gt),st(gt),Nt=new q(Nt,new pe(ar))}else{st(gt);var vr=gt.tokenType===Re.SYMBOL||gt.tokenType===Re.DELIMITER&&gt.token in et;if(!vr)throw sr(gt,"Property name expected after dot");ar.push(new se(gt.token)),st(gt);var xr=!0;Nt=new q(Nt,new pe(ar,xr))}return Nt}function Rt(gt){var Nt,Qt;return gt.token==='"'||gt.token==="'"?(Qt=Ft(gt,gt.token),Nt=new se(Qt),Nt=Tt(gt,Nt),Nt):Ut(gt)}function Ft(gt,Nt){for(var Qt="";ot(gt)!==""&&ot(gt)!==Nt;)if(ot(gt)==="\\"){ut(gt);var ar=ot(gt),vr=Ke[ar];if(vr!==void 0)Qt+=vr,gt.index+=1;else if(ar==="u"){var xr=gt.expression.slice(gt.index+1,gt.index+5);if(/^[0-9A-Fa-f]{4}$/.test(xr))Qt+=String.fromCharCode(parseInt(xr,16)),gt.index+=5;else throw sr(gt,"Invalid unicode character \\u".concat(xr))}else throw sr(gt,"Bad escape character \\".concat(ar))}else Qt+=ot(gt),ut(gt);if(st(gt),gt.token!==Nt)throw sr(gt,"End of string ".concat(Nt," expected"));return st(gt),Qt}function Ut(gt){var Nt,Qt,ar,vr;if(gt.token==="["){if(lt(gt),st(gt),gt.token!=="]"){var xr=Zt(gt);if(gt.token===";"){for(ar=1,Qt=[xr];gt.token===";";)st(gt),Qt[ar]=Zt(gt),ar++;if(gt.token!=="]")throw sr(gt,"End of matrix ] expected");vt(gt),st(gt),vr=Qt[0].items.length;for(var Er=1;Er<ar;Er++)if(Qt[Er].items.length!==vr)throw nr(gt,"Column dimensions mismatch ("+Qt[Er].items.length+" !== "+vr+")");Nt=new Y(Qt)}else{if(gt.token!=="]")throw sr(gt,"End of matrix ] expected");vt(gt),st(gt),Nt=xr}}else vt(gt),st(gt),Nt=new Y([]);return Tt(gt,Nt)}return Wt(gt)}function Zt(gt){for(var Nt=[ft(gt)],Qt=1;gt.token===",";)st(gt),Nt[Qt]=ft(gt),Qt++;return new Y(Nt)}function Wt(gt){if(gt.token==="{"){lt(gt);var Nt,Qt={};do if(st(gt),gt.token!=="}"){if(gt.token==='"'||gt.token==="'")Nt=Ft(gt,gt.token);else if(gt.tokenType===Re.SYMBOL||gt.tokenType===Re.DELIMITER&&gt.token in et)Nt=gt.token,st(gt);else throw sr(gt,"Symbol or string expected as object key");if(gt.token!==":")throw sr(gt,"Colon : expected after object key");st(gt),Qt[Nt]=ft(gt)}while(gt.token===",");if(gt.token!=="}")throw sr(gt,"Comma , or bracket } expected after object value");vt(gt),st(gt);var ar=new ge(Qt);return ar=Tt(gt,ar),ar}return qt(gt)}function qt(gt){var Nt;return gt.tokenType===Re.NUMBER?(Nt=gt.token,st(gt),new se(G(Nt,z.number))):Yt(gt)}function Yt(gt){var Nt;if(gt.token==="("){if(lt(gt),st(gt),Nt=ft(gt),gt.token!==")")throw sr(gt,"Parenthesis ) expected");return vt(gt),st(gt),Nt=new be(Nt),Nt=Tt(gt,Nt),Nt}return or(gt)}function or(gt){throw gt.token===""?sr(gt,"Unexpected end of expression"):sr(gt,"Value expected")}function hr(gt){return gt.index-gt.token.length+1}function sr(gt,Nt){var Qt=hr(gt),ar=new SyntaxError(Nt+" (char "+Qt+")");return ar.char=Qt,ar}function nr(gt,Nt){var Qt=hr(gt),ar=new SyntaxError(Nt+" (char "+Qt+")");return ar.char=Qt,ar}return N.addConversion({from:"string",to:"Node",convert:Ce}),Ce}),name$1m="compile",dependencies$1m=["typed","parse"],createCompile=factory(name$1m,dependencies$1m,v=>{var{typed:N,parse:G}=v;return N(name$1m,{string:function(q){return G(q).compile()},"Array | Matrix":function(q){return deepMap(q,function(Y){return G(Y).compile()})}})}),name$1l="evaluate",dependencies$1l=["typed","parse"],createEvaluate=factory(name$1l,dependencies$1l,v=>{var{typed:N,parse:G}=v;return N(name$1l,{string:function(q){var Y=createEmptyMap();return G(q).compile().evaluate(Y)},"string, Map | Object":function(q,Y){return G(q).compile().evaluate(Y)},"Array | Matrix":function(q){var Y=createEmptyMap();return deepMap(q,function(W){return G(W).compile().evaluate(Y)})},"Array | Matrix, Map | Object":function(q,Y){return deepMap(q,function(W){return G(W).compile().evaluate(Y)})}})}),name$1k="Parser",dependencies$1k=["evaluate"],createParserClass=factory(name$1k,dependencies$1k,v=>{var{evaluate:N}=v;function G(){if(!(this instanceof G))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:createEmptyMap(),writable:!1})}return G.prototype.type="Parser",G.prototype.isParser=!0,G.prototype.evaluate=function(z){return N(z,this.scope)},G.prototype.get=function(z){if(this.scope.has(z))return this.scope.get(z)},G.prototype.getAll=function(){return toObject(this.scope)},G.prototype.getAllAsMap=function(){return this.scope},G.prototype.set=function(z,q){return this.scope.set(z,q),q},G.prototype.remove=function(z){this.scope.delete(z)},G.prototype.clear=function(){this.scope.clear()},G},{isClass:!0}),name$1j="parser",dependencies$1j=["typed","Parser"],createParser=factory(name$1j,dependencies$1j,v=>{var{typed:N,Parser:G}=v;return N(name$1j,{"":function(){return new G}})}),name$1i="lup",dependencies$1i=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],createLup=factory(name$1i,dependencies$1i,v=>{var{typed:N,matrix:G,abs:z,addScalar:q,divideScalar:Y,multiplyScalar:W,subtractScalar:ie,larger:ne,equalScalar:se,unaryMinus:ae,DenseMatrix:ce,SparseMatrix:pe,Spa:ge}=v;return N(name$1i,{DenseMatrix:function(Pe){return ve(Pe)},SparseMatrix:function(Pe){return be(Pe)},Array:function(Pe){var Je=G(Pe),Ce=ve(Je);return{L:Ce.L.valueOf(),U:Ce.U.valueOf(),p:Ce.p}}});function ve(Ee){var Pe=Ee._size[0],Je=Ee._size[1],Ce=Math.min(Pe,Je),Ve=clone$2(Ee._data),Re=[],qe=[Pe,Ce],et=[],Ze=[Ce,Je],tt,Ke,rt,it=[];for(tt=0;tt<Pe;tt++)it[tt]=tt;for(Ke=0;Ke<Je;Ke++){if(Ke>0)for(tt=0;tt<Pe;tt++){var ot=Math.min(tt,Ke),ut=0;for(rt=0;rt<ot;rt++)ut=q(ut,W(Ve[tt][rt],Ve[rt][Ke]));Ve[tt][Ke]=ie(Ve[tt][Ke],ut)}var ct=Ke,at=0,st=0;for(tt=Ke;tt<Pe;tt++){var pt=Ve[tt][Ke],lt=z(pt);ne(lt,at)&&(ct=tt,at=lt,st=pt)}if(Ke!==ct&&(it[Ke]=[it[ct],it[ct]=it[Ke]][0],ce._swapRows(Ke,ct,Ve)),Ke<Pe)for(tt=Ke+1;tt<Pe;tt++){var vt=Ve[tt][Ke];se(vt,0)||(Ve[tt][Ke]=Y(Ve[tt][Ke],st))}}for(Ke=0;Ke<Je;Ke++)for(tt=0;tt<Pe;tt++){if(Ke===0&&(tt<Je&&(et[tt]=[]),Re[tt]=[]),tt<Ke){tt<Je&&(et[tt][Ke]=Ve[tt][Ke]),Ke<Pe&&(Re[tt][Ke]=0);continue}if(tt===Ke){tt<Je&&(et[tt][Ke]=Ve[tt][Ke]),Ke<Pe&&(Re[tt][Ke]=1);continue}tt<Je&&(et[tt][Ke]=0),Ke<Pe&&(Re[tt][Ke]=Ve[tt][Ke])}var dt=new ce({data:Re,size:qe}),xt=new ce({data:et,size:Ze}),ft=[];for(tt=0,Ce=it.length;tt<Ce;tt++)ft[it[tt]]=tt;return{L:dt,U:xt,p:ft,toString:function(){return"L: "+this.L.toString()+`
459U: `+this.U.toString()+`
460P: `+this.p}}}function be(Ee){var Pe=Ee._size[0],Je=Ee._size[1],Ce=Math.min(Pe,Je),Ve=Ee._values,Re=Ee._index,qe=Ee._ptr,et=[],Ze=[],tt=[],Ke=[Pe,Ce],rt=[],it=[],ot=[],ut=[Ce,Je],ct,at,st,pt=[],lt=[];for(ct=0;ct<Pe;ct++)pt[ct]=ct,lt[ct]=ct;var vt=function(ft,Et){var Ct=lt[ft],Dt=lt[Et];pt[Ct]=Et,pt[Dt]=ft,lt[ft]=Dt,lt[Et]=Ct},dt=function(){var ft=new ge;at<Pe&&(tt.push(et.length),et.push(1),Ze.push(at)),ot.push(rt.length);var Et=qe[at],Ct=qe[at+1];for(st=Et;st<Ct;st++)ct=Re[st],ft.set(pt[ct],Ve[st]);at>0&&ft.forEach(0,at-1,function(It,Bt){pe._forEachRow(It,et,Ze,tt,function(Ht,ir){Ht>It&&ft.accumulate(Ht,ae(W(ir,Bt)))})});var Dt=at,Gt=ft.get(at),Ot=z(Gt);ft.forEach(at+1,Pe-1,function(It,Bt){var Ht=z(Bt);ne(Ht,Ot)&&(Dt=It,Ot=Ht,Gt=Bt)}),at!==Dt&&(pe._swapRows(at,Dt,Ke[1],et,Ze,tt),pe._swapRows(at,Dt,ut[1],rt,it,ot),ft.swap(at,Dt),vt(at,Dt)),ft.forEach(0,Pe-1,function(It,Bt){It<=at?(rt.push(Bt),it.push(It)):(Bt=Y(Bt,Gt),se(Bt,0)||(et.push(Bt),Ze.push(It)))})};for(at=0;at<Je;at++)dt();return ot.push(rt.length),tt.push(et.length),{L:new pe({values:et,index:Ze,ptr:tt,size:Ke}),U:new pe({values:rt,index:it,ptr:ot,size:ut}),p:pt,toString:function(){return"L: "+this.L.toString()+`
461U: `+this.U.toString()+`
462P: `+this.p}}}}),name$1h="qr",dependencies$1h=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],createQr=factory(name$1h,dependencies$1h,v=>{var{typed:N,matrix:G,zeros:z,identity:q,isZero:Y,equal:W,sign:ie,sqrt:ne,conj:se,unaryMinus:ae,addScalar:ce,divideScalar:pe,multiplyScalar:ge,subtractScalar:ve,complex:be}=v;return _extends(N(name$1h,{DenseMatrix:function(Ve){return Pe(Ve)},SparseMatrix:function(Ve){return Je()},Array:function(Ve){var Re=G(Ve),qe=Pe(Re);return{Q:qe.Q.valueOf(),R:qe.R.valueOf()}}}),{_denseQRimpl:Ee});function Ee(Ce){var Ve=Ce._size[0],Re=Ce._size[1],qe=q([Ve],"dense"),et=qe._data,Ze=Ce.clone(),tt=Ze._data,Ke,rt,it,ot=z([Ve],"");for(it=0;it<Math.min(Re,Ve);++it){var ut=tt[it][it],ct=ae(W(ut,0)?1:ie(ut)),at=se(ct),st=0;for(Ke=it;Ke<Ve;Ke++)st=ce(st,ge(tt[Ke][it],se(tt[Ke][it])));var pt=ge(ct,ne(st));if(!Y(pt)){var lt=ve(ut,pt);for(ot[it]=1,Ke=it+1;Ke<Ve;Ke++)ot[Ke]=pe(tt[Ke][it],lt);var vt=ae(se(pe(lt,pt))),dt=void 0;for(rt=it;rt<Re;rt++){for(dt=0,Ke=it;Ke<Ve;Ke++)dt=ce(dt,ge(se(ot[Ke]),tt[Ke][rt]));for(dt=ge(dt,vt),Ke=it;Ke<Ve;Ke++)tt[Ke][rt]=ge(ve(tt[Ke][rt],ge(ot[Ke],dt)),at)}for(Ke=0;Ke<Ve;Ke++){for(dt=0,rt=it;rt<Ve;rt++)dt=ce(dt,ge(et[Ke][rt],ot[rt]));for(dt=ge(dt,vt),rt=it;rt<Ve;++rt)et[Ke][rt]=pe(ve(et[Ke][rt],ge(dt,se(ot[rt]))),at)}}}return{Q:qe,R:Ze,toString:function(){return"Q: "+this.Q.toString()+`
463R: `+this.R.toString()}}}function Pe(Ce){var Ve=Ee(Ce),Re=Ve.R._data;if(Ce._data.length>0)for(var qe=Re[0][0].type==="Complex"?be(0):0,et=0;et<Re.length;++et)for(var Ze=0;Ze<et&&Ze<(Re[0]||[]).length;++Ze)Re[et][Ze]=qe;return Ve}function Je(Ce){throw new Error("qr not implemented for sparse matrices yet")}});function csPermute(v,N,G,z){v._values;for(var q=v._index,Y=v._ptr,W=v._size,ie=v._datatype,ne=W[0],se=W[1],ae=null,ce=[],pe=[],ge=0,ve=0;ve<se;ve++){pe[ve]=ge;for(var be=G?G[ve]:ve,Ee=Y[be],Pe=Y[be+1],Je=Ee;Je<Pe;Je++){var Ce=q[Je];ce[ge]=Ce,ge++}}return pe[se]=ge,v.createSparseMatrix({values:ae,index:ce,ptr:pe,size:[ne,se],datatype:ie})}function csTdfs(v,N,G,z,q,Y,W){var ie=0;for(G[W]=v;ie>=0;){var ne=G[W+ie],se=G[z+ne];se===-1?(ie--,Y[N++]=ne):(G[z+ne]=G[q+se],++ie,G[W+ie]=se)}return N}function csPost(v,N){if(!v)return null;var G=0,z,q=[],Y=[],W=0,ie=N,ne=2*N;for(z=0;z<N;z++)Y[W+z]=-1;for(z=N-1;z>=0;z--)v[z]!==-1&&(Y[ie+z]=Y[W+v[z]],Y[W+v[z]]=z);for(z=0;z<N;z++)v[z]===-1&&(G=csTdfs(z,G,Y,W,ie,q,ne));return q}function csEtree(v,N){if(!v)return null;var G=v._index,z=v._ptr,q=v._size,Y=q[0],W=q[1],ie=[],ne=[],se=0,ae=W,ce,pe;for(ce=0;ce<Y;ce++)ne[ae+ce]=-1;for(var ge=0;ge<W;ge++){ie[ge]=-1,ne[se+ge]=-1;for(var ve=z[ge],be=z[ge+1],Ee=ve;Ee<be;Ee++){var Pe=G[Ee];for(ce=ne[ae+Pe];ce!==-1&&ce<ge;ce=pe)pe=ne[se+ce],ne[se+ce]=ge,pe===-1&&(ie[ce]=ge);ne[ae+Pe]=ge}}return ie}function csFkeep(v,N,G){for(var z=v._values,q=v._index,Y=v._ptr,W=v._size,ie=W[1],ne=0,se=0;se<ie;se++){var ae=Y[se];for(Y[se]=ne;ae<Y[se+1];ae++)N(q[ae],se,z?z[ae]:1,G)&&(q[ne]=q[ae],z&&(z[ne]=z[ae]),ne++)}return Y[ie]=ne,q.splice(ne,q.length-ne),z&&z.splice(ne,z.length-ne),ne}function csFlip(v){return-v-2}var name$1g="csAmd",dependencies$1g=["add","multiply","transpose"],createCsAmd=factory(name$1g,dependencies$1g,v=>{var{add:N,multiply:G,transpose:z}=v;return function(ae,ce){if(!ce||ae<=0||ae>3)return null;var pe=ce._size,ge=pe[0],ve=pe[1],be=0,Ee=Math.max(16,10*Math.sqrt(ve));Ee=Math.min(ve-2,Ee);var Pe=q(ae,ce,ge,ve,Ee);csFkeep(Pe,ne,null);for(var Je=Pe._index,Ce=Pe._ptr,Ve=Ce[ve],Re=[],qe=[],et=0,Ze=ve+1,tt=2*(ve+1),Ke=3*(ve+1),rt=4*(ve+1),it=5*(ve+1),ot=6*(ve+1),ut=7*(ve+1),ct=Re,at=Y(ve,Ce,qe,et,Ke,ct,tt,ut,Ze,ot,rt,it),st=W(ve,Ce,qe,it,rt,ot,Ee,Ze,Ke,ct,tt),pt=0,lt,vt,dt,xt,ft,Et,Ct,Dt,Gt,Ot,It,Bt,Ht,ir,zt,tr;st<ve;){for(dt=-1;pt<ve&&(dt=qe[Ke+pt])===-1;pt++);qe[tt+dt]!==-1&&(ct[qe[tt+dt]]=-1),qe[Ke+pt]=qe[tt+dt];var bt=qe[rt+dt],_t=qe[Ze+dt];st+=_t;var Xt=0;qe[Ze+dt]=-_t;var At=Ce[dt],$t=bt===0?At:Ve,Pt=$t;for(xt=1;xt<=bt+1;xt++){for(xt>bt?(Et=dt,Ct=At,Dt=qe[et+dt]-bt):(Et=Je[At++],Ct=Ce[Et],Dt=qe[et+Et]),ft=1;ft<=Dt;ft++)lt=Je[Ct++],!((Gt=qe[Ze+lt])<=0)&&(Xt+=Gt,qe[Ze+lt]=-Gt,Je[Pt++]=lt,qe[tt+lt]!==-1&&(ct[qe[tt+lt]]=ct[lt]),ct[lt]!==-1?qe[tt+ct[lt]]=qe[tt+lt]:qe[Ke+qe[it+lt]]=qe[tt+lt]);Et!==dt&&(Ce[Et]=csFlip(dt),qe[ot+Et]=0)}for(bt!==0&&(Ve=Pt),qe[it+dt]=Xt,Ce[dt]=$t,qe[et+dt]=Pt-$t,qe[rt+dt]=-2,at=ie(at,be,qe,ot,ve),Ot=$t;Ot<Pt;Ot++)if(lt=Je[Ot],!((It=qe[rt+lt])<=0)){Gt=-qe[Ze+lt];var kt=at-Gt;for(At=Ce[lt],Bt=Ce[lt]+It-1;At<=Bt;At++)Et=Je[At],qe[ot+Et]>=at?qe[ot+Et]-=Gt:qe[ot+Et]!==0&&(qe[ot+Et]=qe[it+Et]+kt)}for(Ot=$t;Ot<Pt;Ot++){for(lt=Je[Ot],Bt=Ce[lt],Ht=Bt+qe[rt+lt]-1,ir=Bt,zt=0,tr=0,At=Bt;At<=Ht;At++)if(Et=Je[At],qe[ot+Et]!==0){var jt=qe[ot+Et]-at;jt>0?(tr+=jt,Je[ir++]=Et,zt+=Et):(Ce[Et]=csFlip(dt),qe[ot+Et]=0)}qe[rt+lt]=ir-Bt+1;var wt=ir,Mt=Bt+qe[et+lt];for(At=Ht+1;At<Mt;At++){vt=Je[At];var Tt=qe[Ze+vt];Tt<=0||(tr+=Tt,Je[ir++]=vt,zt+=vt)}tr===0?(Ce[lt]=csFlip(dt),Gt=-qe[Ze+lt],Xt-=Gt,_t+=Gt,st+=Gt,qe[Ze+lt]=0,qe[rt+lt]=-1):(qe[it+lt]=Math.min(qe[it+lt],tr),Je[ir]=Je[wt],Je[wt]=Je[Bt],Je[Bt]=dt,qe[et+lt]=ir-Bt+1,zt=(zt<0?-zt:zt)%ve,qe[tt+lt]=qe[ut+zt],qe[ut+zt]=lt,ct[lt]=zt)}for(qe[it+dt]=Xt,be=Math.max(be,Xt),at=ie(at+be,be,qe,ot,ve),Ot=$t;Ot<Pt;Ot++)if(lt=Je[Ot],!(qe[Ze+lt]>=0))for(zt=ct[lt],lt=qe[ut+zt],qe[ut+zt]=-1;lt!==-1&&qe[tt+lt]!==-1;lt=qe[tt+lt],at++){for(Dt=qe[et+lt],It=qe[rt+lt],At=Ce[lt]+1;At<=Ce[lt]+Dt-1;At++)qe[ot+Je[At]]=at;var Rt=lt;for(vt=qe[tt+lt];vt!==-1;){var Ft=qe[et+vt]===Dt&&qe[rt+vt]===It;for(At=Ce[vt]+1;Ft&&At<=Ce[vt]+Dt-1;At++)qe[ot+Je[At]]!==at&&(Ft=0);Ft?(Ce[vt]=csFlip(lt),qe[Ze+lt]+=qe[Ze+vt],qe[Ze+vt]=0,qe[rt+vt]=-1,vt=qe[tt+vt],qe[tt+Rt]=vt):(Rt=vt,vt=qe[tt+vt])}}for(At=$t,Ot=$t;Ot<Pt;Ot++)lt=Je[Ot],!((Gt=-qe[Ze+lt])<=0)&&(qe[Ze+lt]=Gt,tr=qe[it+lt]+Xt-Gt,tr=Math.min(tr,ve-st-Gt),qe[Ke+tr]!==-1&&(ct[qe[Ke+tr]]=lt),qe[tt+lt]=qe[Ke+tr],ct[lt]=-1,qe[Ke+tr]=lt,pt=Math.min(pt,tr),qe[it+lt]=tr,Je[At++]=lt);qe[Ze+dt]=_t,(qe[et+dt]=At-$t)===0&&(Ce[dt]=-1,qe[ot+dt]=0),bt!==0&&(Ve=At)}for(lt=0;lt<ve;lt++)Ce[lt]=csFlip(Ce[lt]);for(vt=0;vt<=ve;vt++)qe[Ke+vt]=-1;for(vt=ve;vt>=0;vt--)qe[Ze+vt]>0||(qe[tt+vt]=qe[Ke+Ce[vt]],qe[Ke+Ce[vt]]=vt);for(Et=ve;Et>=0;Et--)qe[Ze+Et]<=0||Ce[Et]!==-1&&(qe[tt+Et]=qe[Ke+Ce[Et]],qe[Ke+Ce[Et]]=Et);for(dt=0,lt=0;lt<=ve;lt++)Ce[lt]===-1&&(dt=csTdfs(lt,dt,qe,Ke,tt,Re,ot));return Re.splice(Re.length-1,1),Re};function q(se,ae,ce,pe,ge){var ve=z(ae);if(se===1&&pe===ce)return N(ae,ve);if(se===2){for(var be=ve._index,Ee=ve._ptr,Pe=0,Je=0;Je<ce;Je++){var Ce=Ee[Je];if(Ee[Je]=Pe,!(Ee[Je+1]-Ce>ge))for(var Ve=Ee[Je+1];Ce<Ve;Ce++)be[Pe++]=be[Ce]}return Ee[ce]=Pe,ae=z(ve),G(ve,ae)}return G(ve,ae)}function Y(se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce,Ve){for(var Re=0;Re<se;Re++)ce[pe+Re]=ae[Re+1]-ae[Re];ce[pe+se]=0;for(var qe=0;qe<=se;qe++)ce[ge+qe]=-1,ve[qe]=-1,ce[be+qe]=-1,ce[Ee+qe]=-1,ce[Pe+qe]=1,ce[Je+qe]=1,ce[Ce+qe]=0,ce[Ve+qe]=ce[pe+qe];var et=ie(0,0,ce,Je,se);return ce[Ce+se]=-2,ae[se]=-1,ce[Je+se]=0,et}function W(se,ae,ce,pe,ge,ve,be,Ee,Pe,Je,Ce){for(var Ve=0,Re=0;Re<se;Re++){var qe=ce[pe+Re];if(qe===0)ce[ge+Re]=-2,Ve++,ae[Re]=-1,ce[ve+Re]=0;else if(qe>be)ce[Ee+Re]=0,ce[ge+Re]=-1,Ve++,ae[Re]=csFlip(se),ce[Ee+se]++;else{var et=ce[Pe+qe];et!==-1&&(Je[et]=Re),ce[Ce+Re]=ce[Pe+qe],ce[Pe+qe]=Re}}return Ve}function ie(se,ae,ce,pe,ge){if(se<2||se+ae<0){for(var ve=0;ve<ge;ve++)ce[pe+ve]!==0&&(ce[pe+ve]=1);se=2}return se}function ne(se,ae){return se!==ae}});function csLeaf(v,N,G,z,q,Y,W){var ie,ne,se=0,ae;if(v<=N||G[z+N]<=G[q+v])return-1;G[q+v]=G[z+N];var ce=G[Y+v];if(G[Y+v]=N,ce===-1)se=1,ae=v;else{for(se=2,ae=ce;ae!==G[W+ae];ae=G[W+ae]);for(ie=ce;ie!==ae;ie=ne)ne=G[W+ie],G[W+ie]=ae}return{jleaf:se,q:ae}}var name$1f="csCounts",dependencies$1f=["transpose"],createCsCounts=factory(name$1f,dependencies$1f,v=>{var{transpose:N}=v;return function(G,z,q,Y){if(!G||!z||!q)return null;var W=G._size,ie=W[0],ne=W[1],se,ae,ce,pe,ge,ve,be,Ee=4*ne+(Y?ne+ie+1:0),Pe=[],Je=0,Ce=ne,Ve=2*ne,Re=3*ne,qe=4*ne,et=5*ne+1;for(ce=0;ce<Ee;ce++)Pe[ce]=-1;var Ze=[],tt=N(G),Ke=tt._index,rt=tt._ptr;for(ce=0;ce<ne;ce++)for(ae=q[ce],Ze[ae]=Pe[Re+ae]===-1?1:0;ae!==-1&&Pe[Re+ae]===-1;ae=z[ae])Pe[Re+ae]=ce;if(Y){for(ce=0;ce<ne;ce++)Pe[q[ce]]=ce;for(se=0;se<ie;se++){for(ce=ne,ve=rt[se],be=rt[se+1],ge=ve;ge<be;ge++)ce=Math.min(ce,Pe[Ke[ge]]);Pe[et+se]=Pe[qe+ce],Pe[qe+ce]=se}}for(se=0;se<ne;se++)Pe[Je+se]=se;for(ce=0;ce<ne;ce++){for(ae=q[ce],z[ae]!==-1&&Ze[z[ae]]--,pe=Y?Pe[qe+ce]:ae;pe!==-1;pe=Y?Pe[et+pe]:-1)for(ge=rt[pe];ge<rt[pe+1];ge++){se=Ke[ge];var it=csLeaf(se,ae,Pe,Re,Ce,Ve,Je);it.jleaf>=1&&Ze[ae]++,it.jleaf===2&&Ze[it.q]--}z[ae]!==-1&&(Pe[Je+ae]=z[ae])}for(ae=0;ae<ne;ae++)z[ae]!==-1&&(Ze[z[ae]]+=Ze[ae]);return Ze}}),name$1e="csSqr",dependencies$1e=["add","multiply","transpose"],createCsSqr=factory(name$1e,dependencies$1e,v=>{var{add:N,multiply:G,transpose:z}=v,q=createCsAmd({add:N,multiply:G,transpose:z}),Y=createCsCounts({transpose:z});return function(ne,se,ae){var ce=se._ptr,pe=se._size,ge=pe[1],ve,be={};if(be.q=q(ne,se),ne&&!be.q)return null;if(ae){var Ee=ne?csPermute(se,null,be.q):se;be.parent=csEtree(Ee);var Pe=csPost(be.parent,ge);if(be.cp=Y(Ee,be.parent,Pe,1),Ee&&be.parent&&be.cp&&W(Ee,be))for(be.unz=0,ve=0;ve<ge;ve++)be.unz+=be.cp[ve]}else be.unz=4*ce[ge]+ge,be.lnz=be.unz;return be};function W(ie,ne){var se=ie._ptr,ae=ie._index,ce=ie._size,pe=ce[0],ge=ce[1];ne.pinv=[],ne.leftmost=[];var ve=ne.parent,be=ne.pinv,Ee=ne.leftmost,Pe=[],Je=0,Ce=pe,Ve=pe+ge,Re=pe+2*ge,qe,et,Ze,tt,Ke;for(et=0;et<ge;et++)Pe[Ce+et]=-1,Pe[Ve+et]=-1,Pe[Re+et]=0;for(qe=0;qe<pe;qe++)Ee[qe]=-1;for(et=ge-1;et>=0;et--)for(tt=se[et],Ke=se[et+1],Ze=tt;Ze<Ke;Ze++)Ee[ae[Ze]]=et;for(qe=pe-1;qe>=0;qe--)be[qe]=-1,et=Ee[qe],et!==-1&&(Pe[Re+et]++===0&&(Pe[Ve+et]=qe),Pe[Je+qe]=Pe[Ce+et],Pe[Ce+et]=qe);for(ne.lnz=0,ne.m2=pe,et=0;et<ge;et++)if(qe=Pe[Ce+et],ne.lnz++,qe<0&&(qe=ne.m2++),be[qe]=et,!(--Re[et]<=0)){ne.lnz+=Pe[Re+et];var rt=ve[et];rt!==-1&&(Pe[Re+rt]===0&&(Pe[Ve+rt]=Pe[Ve+et]),Pe[Je+Pe[Ve+et]]=Pe[Ce+rt],Pe[Ce+rt]=Pe[Je+qe],Pe[Re+rt]+=Pe[Re+et])}for(qe=0;qe<pe;qe++)be[qe]<0&&(be[qe]=et++);return!0}});function csMarked(v,N){return v[N]<0}function csMark(v,N){v[N]=csFlip(v[N])}function csUnflip(v){return v<0?csFlip(v):v}function csDfs(v,N,G,z,q){var Y=N._index,W=N._ptr,ie=N._size,ne=ie[1],se,ae,ce,pe=0;for(z[0]=v;pe>=0;){v=z[pe];var ge=q?q[v]:v;csMarked(W,v)||(csMark(W,v),z[ne+pe]=ge<0?0:csUnflip(W[ge]));var ve=1;for(ae=z[ne+pe],ce=ge<0?0:csUnflip(W[ge+1]);ae<ce;ae++)if(se=Y[ae],!csMarked(W,se)){z[ne+pe]=ae,z[++pe]=se,ve=0;break}ve&&(pe--,z[--G]=v)}return G}function csReach(v,N,G,z,q){var Y=v._ptr,W=v._size,ie=N._index,ne=N._ptr,se=W[1],ae,ce,pe,ge=se;for(ce=ne[G],pe=ne[G+1],ae=ce;ae<pe;ae++){var ve=ie[ae];csMarked(Y,ve)||(ge=csDfs(ve,v,ge,z,q))}for(ae=ge;ae<se;ae++)csMark(Y,z[ae]);return ge}var name$1d="csSpsolve",dependencies$1d=["divideScalar","multiply","subtract"],createCsSpsolve=factory(name$1d,dependencies$1d,v=>{var{divideScalar:N,multiply:G,subtract:z}=v;return function(Y,W,ie,ne,se,ae,ce){var pe=Y._values,ge=Y._index,ve=Y._ptr,be=Y._size,Ee=be[1],Pe=W._values,Je=W._index,Ce=W._ptr,Ve,Re,qe,et,Ze=csReach(Y,W,ie,ne,ae);for(Ve=Ze;Ve<Ee;Ve++)se[ne[Ve]]=0;for(Re=Ce[ie],qe=Ce[ie+1],Ve=Re;Ve<qe;Ve++)se[Je[Ve]]=Pe[Ve];for(var tt=Ze;tt<Ee;tt++){var Ke=ne[tt],rt=ae?ae[Ke]:Ke;if(!(rt<0))for(Re=ve[rt],qe=ve[rt+1],se[Ke]=N(se[Ke],pe[ce?Re:qe-1]),Ve=ce?Re+1:Re,et=ce?qe:qe-1;Ve<et;Ve++){var it=ge[Ve];se[it]=z(se[it],G(pe[Ve],se[Ke]))}}return Ze}}),name$1c="csLu",dependencies$1c=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],createCsLu=factory(name$1c,dependencies$1c,v=>{var{abs:N,divideScalar:G,multiply:z,subtract:q,larger:Y,largerEq:W,SparseMatrix:ie}=v,ne=createCsSpsolve({divideScalar:G,multiply:z,subtract:q});return function(ae,ce,pe){if(!ae)return null;var ge=ae._size,ve=ge[1],be,Ee=100,Pe=100;ce&&(be=ce.q,Ee=ce.lnz||Ee,Pe=ce.unz||Pe);var Je=[],Ce=[],Ve=[],Re=new ie({values:Je,index:Ce,ptr:Ve,size:[ve,ve]}),qe=[],et=[],Ze=[],tt=new ie({values:qe,index:et,ptr:Ze,size:[ve,ve]}),Ke=[],rt,it,ot=[],ut=[];for(rt=0;rt<ve;rt++)ot[rt]=0,Ke[rt]=-1,Ve[rt+1]=0;Ee=0,Pe=0;for(var ct=0;ct<ve;ct++){Ve[ct]=Ee,Ze[ct]=Pe;var at=be?be[ct]:ct,st=ne(Re,ae,at,ut,ot,Ke,1),pt=-1,lt=-1;for(it=st;it<ve;it++)if(rt=ut[it],Ke[rt]<0){var vt=N(ot[rt]);Y(vt,lt)&&(lt=vt,pt=rt)}else et[Pe]=Ke[rt],qe[Pe++]=ot[rt];if(pt===-1||lt<=0)return null;Ke[at]<0&&W(N(ot[at]),z(lt,pe))&&(pt=at);var dt=ot[pt];for(et[Pe]=ct,qe[Pe++]=dt,Ke[pt]=ct,Ce[Ee]=pt,Je[Ee++]=1,it=st;it<ve;it++)rt=ut[it],Ke[rt]<0&&(Ce[Ee]=rt,Je[Ee++]=G(ot[rt],dt)),ot[rt]=0}for(Ve[ve]=Ee,Ze[ve]=Pe,it=0;it<Ee;it++)Ce[it]=Ke[Ce[it]];return Je.splice(Ee,Je.length-Ee),Ce.splice(Ee,Ce.length-Ee),qe.splice(Pe,qe.length-Pe),et.splice(Pe,et.length-Pe),{L:Re,U:tt,pinv:Ke}}}),name$1b="slu",dependencies$1b=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],createSlu=factory(name$1b,dependencies$1b,v=>{var{typed:N,abs:G,add:z,multiply:q,transpose:Y,divideScalar:W,subtract:ie,larger:ne,largerEq:se,SparseMatrix:ae}=v,ce=createCsSqr({add:z,multiply:q,transpose:Y}),pe=createCsLu({abs:G,divideScalar:W,multiply:q,subtract:ie,larger:ne,largerEq:se,SparseMatrix:ae});return N(name$1b,{"SparseMatrix, number, number":function(ve,be,Ee){if(!isInteger(be)||be<0||be>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(Ee<0||Ee>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var Pe=ce(be,ve,!1),Je=pe(ve,Pe,Ee);return{L:Je.L,U:Je.U,p:Je.pinv,q:Pe.q,toString:function(){return"L: "+this.L.toString()+`
464U: `+this.U.toString()+`
465p: `+this.p.toString()+(this.q?`
466q: `+this.q.toString():"")+`
467`}}}})});function csIpvec(v,N){var G,z=N.length,q=[];if(v)for(G=0;G<z;G++)q[v[G]]=N[G];else for(G=0;G<z;G++)q[G]=N[G];return q}var name$1a="lusolve",dependencies$1a=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],createLusolve=factory(name$1a,dependencies$1a,v=>{var{typed:N,matrix:G,lup:z,slu:q,usolve:Y,lsolve:W,DenseMatrix:ie}=v,ne=createSolveValidation({DenseMatrix:ie});return N(name$1a,{"Array, Array | Matrix":function(pe,ge){pe=G(pe);var ve=z(pe),be=ae(ve.L,ve.U,ve.p,null,ge);return be.valueOf()},"DenseMatrix, Array | Matrix":function(pe,ge){var ve=z(pe);return ae(ve.L,ve.U,ve.p,null,ge)},"SparseMatrix, Array | Matrix":function(pe,ge){var ve=z(pe);return ae(ve.L,ve.U,ve.p,null,ge)},"SparseMatrix, Array | Matrix, number, number":function(pe,ge,ve,be){var Ee=q(pe,ve,be);return ae(Ee.L,Ee.U,Ee.p,Ee.q,ge)},"Object, Array | Matrix":function(pe,ge){return ae(pe.L,pe.U,pe.p,pe.q,ge)}});function se(ce){if(isMatrix(ce))return ce;if(isArray(ce))return G(ce);throw new TypeError("Invalid Matrix LU decomposition")}function ae(ce,pe,ge,ve,be){ce=se(ce),pe=se(pe),ge&&(be=ne(ce,be,!0),be._data=csIpvec(ge,be._data));var Ee=W(ce,be),Pe=Y(pe,Ee);return ve&&(Pe._data=csIpvec(ve,Pe._data)),Pe}}),name$19="polynomialRoot",dependencies$19=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],createPolynomialRoot=factory(name$19,dependencies$19,v=>{var{typed:N,isZero:G,equalScalar:z,add:q,subtract:Y,multiply:W,divide:ie,sqrt:ne,unaryMinus:se,cbrt:ae,typeOf:ce,im:pe,re:ge}=v;return N(name$19,{"number|Complex, ...number|Complex":(ve,be)=>{for(var Ee=[ve,...be];Ee.length>0&&G(Ee[Ee.length-1]);)Ee.pop();if(Ee.length<2)throw new RangeError("Polynomial [".concat(ve,", ").concat(be,"] must have a non-zero non-constant coefficient"));switch(Ee.length){case 2:return[se(ie(Ee[0],Ee[1]))];case 3:{var[Pe,Je,Ce]=Ee,Ve=W(2,Ce),Re=W(Je,Je),qe=W(4,Ce,Pe);if(z(Re,qe))return[ie(se(Je),Ve)];var et=ne(Y(Re,qe));return[ie(Y(et,Je),Ve),ie(Y(se(et),Je),Ve)]}case 4:{var[Ze,tt,Ke,rt]=Ee,it=se(W(3,rt)),ot=W(Ke,Ke),ut=W(3,rt,tt),ct=q(W(2,Ke,Ke,Ke),W(27,rt,rt,Ze)),at=W(9,rt,Ke,tt);if(z(ot,ut)&&z(ct,at))return[ie(Ke,it)];var st=Y(ot,ut),pt=Y(ct,at),lt=q(W(18,rt,Ke,tt,Ze),W(Ke,Ke,tt,tt)),vt=q(W(4,Ke,Ke,Ke,Ze),W(4,rt,tt,tt,tt),W(27,rt,rt,Ze,Ze));if(z(lt,vt))return[ie(Y(W(4,rt,Ke,tt),q(W(9,rt,rt,Ze),W(Ke,Ke,Ke))),W(rt,st)),ie(Y(W(9,rt,Ze),W(Ke,tt)),W(2,st))];var dt;z(ot,ut)?dt=pt:dt=ie(q(pt,ne(Y(W(pt,pt),W(4,st,st,st)))),2);var xt=!0,ft=ae(dt,xt).toArray().map(Et=>ie(q(Ke,Et,ie(st,Et)),it));return ft.map(Et=>ce(Et)==="Complex"&&z(ge(Et),ge(Et)+pe(Et))?ge(Et):Et)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(Ee))}}})}),name$18="Help",dependencies$18=["parse"],createHelpClass=factory(name$18,dependencies$18,v=>{var{parse:N}=v;function G(z){if(!(this instanceof G))throw new SyntaxError("Constructor must be called with the new operator");if(!z)throw new Error('Argument "doc" missing');this.doc=z}return G.prototype.type="Help",G.prototype.isHelp=!0,G.prototype.toString=function(){var z=this.doc||{},q=`
468`;if(z.name&&(q+="Name: "+z.name+`
469
470`),z.category&&(q+="Category: "+z.category+`
471
472`),z.description&&(q+=`Description:
473    `+z.description+`
474
475`),z.syntax&&(q+=`Syntax:
476    `+z.syntax.join(`
477    `)+`
478
479`),z.examples){q+=`Examples:
480`;for(var Y={},W=0;W<z.examples.length;W++){var ie=z.examples[W];q+="    "+ie+`
481`;var ne=void 0;try{ne=N(ie).compile().evaluate(Y)}catch(se){ne=se}ne!==void 0&&!isHelp(ne)&&(q+="        "+format(ne,{precision:14})+`
482`)}q+=`
483`}return z.mayThrow&&z.mayThrow.length&&(q+="Throws: "+z.mayThrow.join(", ")+`
484
485`),z.seealso&&z.seealso.length&&(q+="See also: "+z.seealso.join(", ")+`
486`),q},G.prototype.toJSON=function(){var z=clone$2(this.doc);return z.mathjs="Help",z},G.fromJSON=function(z){var q={};return Object.keys(z).filter(Y=>Y!=="mathjs").forEach(Y=>{q[Y]=z[Y]}),new G(q)},G.prototype.valueOf=G.prototype.toString,G},{isClass:!0}),name$17="Chain",dependencies$17=["?on","math","typed"],createChainClass=factory(name$17,dependencies$17,v=>{var{on:N,math:G,typed:z}=v;function q(se){if(!(this instanceof q))throw new SyntaxError("Constructor must be called with the new operator");isChain(se)?this.value=se.value:this.value=se}q.prototype.type="Chain",q.prototype.isChain=!0,q.prototype.done=function(){return this.value},q.prototype.valueOf=function(){return this.value},q.prototype.toString=function(){return format(this.value)},q.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},q.fromJSON=function(se){return new q(se.value)};function Y(se,ae){typeof ae=="function"&&(q.prototype[se]=ie(ae))}function W(se,ae){lazy(q.prototype,se,function(){var pe=ae();if(typeof pe=="function")return ie(pe)})}function ie(se){return function(){if(arguments.length===0)return new q(se(this.value));for(var ae=[this.value],ce=0;ce<arguments.length;ce++)ae[ce+1]=arguments[ce];if(z.isTypedFunction(se)){var pe=z.resolve(se,ae);if(pe.params.length===1)throw new Error("chain function "+se.name+" cannot match rest parameter between chain value and additional arguments.");return new q(pe.implementation.apply(se,ae))}return new q(se.apply(se,ae))}}q.createProxy=function(se,ae){if(typeof se=="string")Y(se,ae);else{var ce=function(ve){hasOwnProperty(se,ve)&&ne[ve]===void 0&&W(ve,()=>se[ve])};for(var pe in se)ce(pe)}};var ne={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return q.createProxy(G),N&&N("import",function(se,ae,ce){ce||W(se,ae)}),q},{isClass:!0}),eDocs={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"]},falseDocs={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},iDocs={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:[]},InfinityDocs={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:[]},LN10Docs={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LN2Docs={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LOG10EDocs={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:[]},LOG2EDocs={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:[]},NaNDocs={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},nullDocs={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]}
486,phiDocs={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:[]},piDocs={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"]},SQRT12Docs={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:[]},SQRT2Docs={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tauDocs={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"]},trueDocs={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},versionDocs={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},bignumberDocs={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"]},booleanDocs={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"]},complexDocs={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"]},createUnitDocs={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"]},fractionDocs={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"]},indexDocs={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},matrixDocs={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"]},numberDocs={name:"number",category:"Construction",syntax:["x","
486number(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"]},sparseDocs={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"]},splitUnitDocs={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"]},stringDocs={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"]},unitDocs={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"]},configDocs={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:[]},importDocs={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:[]},typedDocs={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]},derivativeDocs={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"]},leafCountDocs={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"]},lsolveDocs={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"]},lsolveAllDocs={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"]},lupDocs={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"]},lusolveDocs={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"]},polynomialRootDocs={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"]},qrDocs={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"]},rationalizeDocs={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 pol
486ynomial 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"]},resolveDocs={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"]},simplifyDocs={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"]},simplifyConstantDocs={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCoreDocs={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"]},sluDocs={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"]},symbolicEqualDocs={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"]},usolveDocs={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"]},usolveAllDocs={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"]},absDocs={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},addDocs={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"]},cbrtDocs={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"]},ceilDocs={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"]},cubeDocs={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"]},divideDocs={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"]},dotDivideDocs={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"]}
486,dotMultiplyDocs={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"]},dotPowDocs={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"]},expDocs={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"]},expmDocs={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"]},expm1Docs={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"]},fixDocs={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"]},floorDocs={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"]},gcdDocs={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"]},hypotDocs={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"]},invmodDocs={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]},lcmDocs={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"]},logDocs={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"]},log10Docs={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"]},log1pDocs={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"]},log2Docs={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"]},modDocs={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:["divi
486de"]},multiplyDocs={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"]},normDocs={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")']},nthRootDocs={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"]},nthRootsDocs={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"]},powDocs={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"]},roundDocs={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"]},signDocs={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"]},sqrtDocs={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"]}
486,sqrtmDocs={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"]},sylvesterDocs={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},schurDocs={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},lyapDocs={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},squareDocs={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"]},subtractDocs={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"]},unaryMinusDocs={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"]},unaryPlusDocs={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},xgcdDocs={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"]},bitAndDocs={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"]},bitNotDocs={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"]},bitOrDocs={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"]},bitXorDocs={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"]},leftShiftDocs={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 
486<< 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},rightArithShiftDocs={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"]},rightLogShiftDocs={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"]},bellNumbersDocs={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"]},catalanDocs={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"]},compositionDocs={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"]},stirlingS2Docs={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"]},argDocs={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"]},conjDocs={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"]},imDocs={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"]},reDocs={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"]},evaluateDocs={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]},helpDocs={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},distanceDocs={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:[]},intersectDocs={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:[]},andDocs={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"]},notDocs={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"]},orDocs={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"]},xorDocs={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"]},columnDocs={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"]},concatDocs={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","
486identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},countDocs={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"]},crossDocs={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"]},ctransposeDocs={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"]},detDocs={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;
486 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diagDocs={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"]},diffDocs={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:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dotDocs={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"]},eigsDocs={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"]},filterDocs={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"]},flattenDocs={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"]}
486,forEachDocs={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"]},getMatrixDataTypeDocs={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"]},identityDocs={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"]},invDocs={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"]},pinvDocs={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore–Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},kronDocs={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"]},mapDocs={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"]},matrixFromColumnsDocs={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"]},matrixFromFunctionDocs={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
486)"],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"]},matrixFromRowsDocs={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"]},onesDocs={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"]},partitionSelectDocs={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"]},rangeDocs={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","one
486s","size","squeeze","subset","trace","transpose","zeros"]},reshapeDocs={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"]},resizeDocs={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"]},rotateDocs={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"]},rotationMatrixDocs={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"]},rowDocs={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"]},sizeDocs={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","one
486s","range","squeeze","subset","trace","transpose","zeros"]},sortDocs={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"]},squeezeDocs={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"]},subsetDocs={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","one
486s","range","size","squeeze","trace","transpose","zeros"]},traceDocs={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"]},transposeDocs={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"]},zerosDocs={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"]},fftDocs={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifftDocs={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},combinationsDocs={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"]},combinationsWithRepDocs={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"]},factorialDocs={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"]},gammaDocs={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"]},lgammaDocs={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"]},kldivergenceDocs={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:[]},multinomialDocs={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"]},permutationsDocs={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"]},pickRandomDocs={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"]},randomDocs={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"]},randomIntDocs={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"]},compareDocs={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"]},compareNaturalDocs={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"]},compareTextDocs={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"]},deepEqualDocs={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"]},equalDocs={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"]},equalTextDocs={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"]},largerDocs={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"]}
486,largerEqDocs={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"]},smallerDocs={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"]},smallerEqDocs={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"]},unequalDocs={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"]},setCartesianDocs={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"]},setDifferenceDocs={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"]},setDistinctDocs={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"]},setIntersectDocs={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"]},setIsSubsetDocs={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"]},setMultiplicityDocs={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"]},setPowersetDocs={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"]},setSizeDocs={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"]},setSymDifferenceDocs={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"]},setUnionDocs={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"]},zpk2tfDocs={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},freqzDocs={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},erfDocs={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:[]},zetaDocs={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},madDocs={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"]},maxDocs={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"]},meanDocs={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"]},medianDocs={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"]},minDocs={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"]},modeDocs={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"]},prodDocs={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"]},quantileSeqDocs={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. 
487
488In 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"]},stdDocs={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"]},cumSumDocs={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"]},sumDocs={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"]},varianceDocs={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"]},corrDocs={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acosDocs={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"]},acoshDocs={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","asin
488h","atanh"]},acotDocs={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"]},acothDocs={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"]},acscDocs={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"]},acschDocs={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"]},asecDocs={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"]},asechDocs={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asinDocs={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"]},asinhDocs={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"]},atanDocs={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"]},atan2Docs={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"]},atanhDocs={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"]},cosDocs={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"]},coshDocs={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cotDocs={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"]},cothDocs={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"]},cscDocs={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"]},cschDocs={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"]},secDocs={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"]},sechDocs={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"]},sinDocs={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"]}
488,sinhDocs={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tanDocs={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"]},tanhDocs={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"]},toDocs={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:[]},binDocs={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},cloneDocs={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:[]},formatDocs={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"]},hasNumericValueDocs={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"]},hexDocs={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isIntegerDocs={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"]},isNaNDocs={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"]},isNegativeDocs={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"]},isNumericDocs={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"]},isPositiveDocs={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"]},isPrimeDocs={name:"isPrime",category:"Utils",syntax:["isPrime(x
488)"],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"]},isZeroDocs={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"]},numericDocs={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"]},octDocs={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},printDocs={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOfDocs={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"]},solveODEDocs={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},embeddedDocs={bignumber:bignumberDocs,boolean:booleanDocs,complex:complexDocs,createUnit:createUnitDocs,fraction:fractionDocs,index:indexDocs,matrix:matrixDocs,number:numberDocs,sparse:sparseDocs,splitUnit:splitUnitDocs,string:stringDocs,unit:unitDocs,e:eDocs,E:eDocs,false:falseDocs,i:iDocs,Infinity:InfinityDocs,LN2:LN2Docs,LN10:LN10Docs,LOG2E:LOG2EDocs,LOG10E:LOG10EDocs,NaN:NaNDocs,null:nullDocs,pi:piDocs,PI:piDocs,phi:phiDocs,SQRT1_2:SQRT12Docs,SQRT2:SQRT2Docs,tau:tauDocs,true:trueDocs,version:versionDocs,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"]}
488,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:derivativeDocs,lsolve:lsolveDocs,lsolveAll:lsolveAllDocs,lup:lupDocs,lusolve:lusolveDocs,leafCount:leafCountDocs,polynomialRoot:polynomialRootDocs,resolve:resolveDocs,simplify:simplifyDocs,simplifyConstant:simplifyConstantDocs,simplifyCore:simplifyCoreDocs,symbolicEqual:symbolicEqualDocs,rationalize:rationalizeDocs,slu:sluDocs,usolve:usolveDocs,usolveAll:usolveAllDocs,qr:qrDocs,abs:absDocs,add:addDocs,cbrt:cbrtDocs,ceil:ceilDocs,cube:cubeDocs,divide:divideDocs,dotDivide:dotDivideDocs,dotMultiply:dotMultiplyDocs,dotPow:dotPowDocs,exp:expDocs,expm:expmDocs,expm1:expm1Docs,fix:fixDocs,floor:floorDocs,gcd:gcdDocs,hypot:hypotDocs,lcm:lcmDocs,log:logDocs,log2:log2Docs,log1p:log1pDocs,log10:log10Docs,mod:modDocs,multiply:multiplyDocs,norm:normDocs,nthRoot:nthRootDocs,nthRoots:nthRootsDocs,pow:powDocs,round:roundDocs,sign:signDocs,sqrt:sqrtDocs,sqrtm:sqrtmDocs,square:squareDocs,subtract:subtractDocs,unaryMinus:unaryMinusDocs,unaryPlus:unaryPlusDocs,xgcd:xgcdDocs,invmod:invmodDocs,bitAnd:bitAndDocs,bitNot:bitNotDocs,bitOr:bitOrDocs,bitXor:bitXorDocs,leftShift:leftShiftDocs,rightArithShift:rightArithShiftDocs,rightLogShift:rightLogShiftDocs,bellNumbers:bellNumbersDocs,catalan:catalanDocs,composition:compositionDocs,stirlingS2:stirlingS2Docs,config:configDocs,import:importDocs,typed:typedDocs,arg:argDocs,conj:conjDocs,re:reDocs,im:imDocs,evaluate:evaluateDocs,help:helpDocs,distance:distanceDocs,intersect:intersectDocs,and:andDocs,not:notDocs,or:orDocs,xor:xorDocs,concat:concatDocs,count:countDocs,cross:crossDocs,column:columnDocs,ctranspose:ctransposeDocs,det:detDocs,diag:diagDocs,diff:diffDocs,dot:dotDocs,getMatrixDataType:getMatrixDataTypeDocs,identity:identityDocs,filter:filterDocs,flatten:flattenDocs,forEach:forEachDocs,inv:invDocs,pinv:pinvDocs,eigs:eigsDocs,kron:kronDocs,matrixFromFunction:matrixFromFunctionDocs,matrixFromRows:matrixFromRowsDocs,matrixFromColumns:matrixFromColumnsDocs,map:mapDocs,ones:onesDocs,partitionSelect:partitionSelectDocs,range:rangeDocs,resize:resizeDocs,reshape:reshapeDocs,rotate:rotateDocs,rotationMatrix:rotationMatrixDocs,row:rowDocs,size:sizeDocs,sort:sortDocs,squeeze:squeezeDocs,subset:subsetDocs,trace:traceDocs,transpose:transposeDocs,zeros:zerosDocs,fft:fftDocs,ifft:ifftDocs,sylvester:sylvesterDocs,schur:schurDocs,lyap:lyapDocs,solveODE:solveODEDocs,combinations:combinationsDocs,combinationsWithRep:combinationsWithRepDocs,factorial:factorialDocs,gamma:gammaDocs,kldivergence:kldivergenceDocs,lgamma:lgammaDocs,multinomial:multinomialDocs,permutations:permutationsDocs,pickRandom:pickRandomDocs,random:randomDocs,randomInt:randomIntDocs,compare:compareDocs,compareNatural:compareNaturalDocs,compareText:compareTextDocs,deepEqual:deepEqualDocs,equal:equalDocs,equalText:equalTextDocs,larger:largerDocs,largerEq:largerEqDocs,smaller:smallerDocs,smallerEq:smallerEqDocs,unequal:unequalDocs,setCartesian:setCartesianDocs,setDifference:setDifferenceDocs,setDistinct:setDistinctDocs,setIntersect:setIntersectDocs,setIsSubset:setIsSubsetDocs,setMultiplicity:setMultiplicity
vendor: 129,068 bytes, line 488
488Docs,setPowerset:setPowersetDocs,setSize:setSizeDocs,setSymDifference:setSymDifferenceDocs,setUnion:setUnionDocs,zpk2tf:zpk2tfDocs,freqz:freqzDocs,erf:erfDocs,zeta:zetaDocs,cumsum:cumSumDocs,mad:madDocs,max:maxDocs,mean:meanDocs,median:medianDocs,min:minDocs,mode:modeDocs,prod:prodDocs,quantileSeq:quantileSeqDocs,std:stdDocs,sum:sumDocs,variance:varianceDocs,corr:corrDocs,acos:acosDocs,acosh:acoshDocs,acot:acotDocs,acoth:acothDocs,acsc:acscDocs,acsch:acschDocs,asec:asecDocs,asech:asechDocs,asin:asinDocs,asinh:asinhDocs,atan:atanDocs,atanh:atanhDocs,atan2:atan2Docs,cos:cosDocs,cosh:coshDocs,cot:cotDocs,coth:cothDocs,csc:cscDocs,csch:cschDocs,sec:secDocs,sech:sechDocs,sin:sinDocs,sinh:sinhDocs,tan:tanDocs,tanh:tanhDocs,to:toDocs,clone:cloneDocs,format:formatDocs,bin:binDocs,oct:octDocs,hex:hexDocs,isNaN:isNaNDocs,isInteger:isIntegerDocs,isNegative:isNegativeDocs,isNumeric:isNumericDocs,hasNumericValue:hasNumericValueDocs,isPositive:isPositiveDocs,isPrime:isPrimeDocs,isZero:isZeroDocs,print:printDocs,typeOf:typeOfDocs,numeric:numericDocs},name$16="help",dependencies$16=["typed","mathWithTransform","Help"],createHelp=factory(name$16,dependencies$16,v=>{var{typed:N,mathWithTransform:G,Help:z}=v;return N(name$16,{any:function(Y){var W,ie=Y;if(typeof Y!="string"){for(W in G)if(hasOwnProperty(G,W)&&Y===G[W]){ie=W;break}}var ne=getSafeProperty(embeddedDocs,ie);if(!ne){var se=typeof ie=="function"?ie.name:ie;throw new Error('No documentation found on "'+se+'"')}return new z(ne)}})}),name$15="chain",dependencies$15=["typed","Chain"],createChain=factory(name$15,dependencies$15,v=>{var{typed:N,Chain:G}=v;return N(name$15,{"":function(){return new G},any:function(q){return new G(q)}})}),name$14="det",dependencies$14=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],createDet=factory(name$14,dependencies$14,v=>{var{typed:N,matrix:G,subtractScalar:z,multiply:q,divideScalar:Y,isZero:W,unaryMinus:ie}=v;return N(name$14,{any:function(ae){return clone$2(ae)},"Array | Matrix":function(ae){var ce;switch(isMatrix(ae)?ce=ae.size():Array.isArray(ae)?(ae=G(ae),ce=ae.size()):ce=[],ce.length){case 0:return clone$2(ae);case 1:if(ce[0]===1)return clone$2(ae.valueOf()[0]);if(ce[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+format(ce)+")");case 2:{var pe=ce[0],ge=ce[1];if(pe===ge)return ne(ae.clone().valueOf(),pe);if(ge===0)return 1;throw new RangeError("Matrix must be square (size: "+format(ce)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+format(ce)+")")}}});function ne(se,ae,ce){if(ae===1)return clone$2(se[0][0]);if(ae===2)return z(q(se[0][0],se[1][1]),q(se[1][0],se[0][1]));for(var pe=!1,ge=new Array(ae).fill(0).map((et,Ze)=>Ze),ve=0;ve<ae;ve++){var be=ge[ve];if(W(se[be][ve])){var Ee=void 0;for(Ee=ve+1;Ee<ae;Ee++)if(!W(se[ge[Ee]][ve])){be=ge[Ee],ge[Ee]=ge[ve],ge[ve]=be,pe=!pe;break}if(Ee===ae)return se[be][ve]}for(var Pe=se[be][ve],Je=ve===0?1:se[ge[ve-1]][ve-1],Ce=ve+1;Ce<ae;Ce++)for(var Ve=ge[Ce],Re=ve+1;Re<ae;Re++)se[Ve][Re]=Y(z(q(se[Ve][Re],Pe),q(se[Ve][ve],se[be][Re])),Je)}var qe=se[ge[ae-1]][ae-1];return pe?ie(qe):qe}}),name$13="inv",dependencies$13=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],createInv=factory(name$13,dependencies$13,v=>{var{typed:N,matrix:G,divideScalar:z,addScalar:q,multiply:Y,unaryMinus:W,det:ie,identity:ne,abs:se}=v;return N(name$13,{"Array | Matrix":function(pe){var ge=isMatrix(pe)?pe.size():arraySize(pe);switch(ge.length){case 1:if(ge[0]===1)return isMatrix(pe)?G([z(1,pe.valueOf()[0])]):[z(1,pe[0])];throw new RangeError("Matrix must be square (size: "+format(ge)+")");case 2:{var ve=ge[0],be=ge[1];if(ve===be)return isMatrix(pe)?G(ae(pe.valueOf(),ve,be),pe.storage()):ae(pe,ve,be);throw new RangeError("Matrix must be square (size: "+format(ge)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+format(ge)+")")}},any:function(pe){return z(1,pe)}});function ae(ce,pe,ge){var ve,be,Ee,Pe,Je;if(pe===1){if(Pe=ce[0][0],Pe===0)throw Error("Cannot calculate inverse, determinant is zero");return[[z(1,Pe)]]}else if(pe===2){var Ce=ie(ce);if(Ce===0)throw Error("Cannot calculate inverse, determinant is zero");return[[z(ce[1][1],Ce),z(W(ce[0][1]),Ce)],[z(W(ce[1][0]),Ce),z(ce[0][0],Ce)]]}else{var Ve=ce.concat();for(ve=0;ve<pe;ve++)Ve[ve]=Ve[ve].concat();for(var Re=ne(pe).valueOf(),qe=0;qe<ge;qe++){var et=se(Ve[qe][qe]),Ze=qe;for(ve=qe+1;ve<pe;)se(Ve[ve][qe])>et&&(et=se(Ve[ve][qe]),Ze=ve),ve++;if(et===0)throw Error("Cannot calculate inverse, determinant is zero");ve=Ze,ve!==qe&&(Je=Ve[qe],Ve[qe]=Ve[ve],Ve[ve]=Je,Je=Re[qe],Re[qe]=Re[ve],Re[ve]=Je);var tt=Ve[qe],Ke=Re[qe];for(ve=0;ve<pe;ve++){var rt=Ve[ve],it=Re[ve];if(ve!==qe){if(rt[qe]!==0){for(Ee=z(W(rt[qe]),tt[qe]),be=qe;be<ge;be++)rt[be]=q(rt[be],Y(Ee,tt[be]));for(be=0;be<ge;be++)it[be]=q(it[be],Y(Ee,Ke[be]))}}else{for(Ee=tt[qe],be=qe;be<ge;be++)rt[be]=z(rt[be],Ee);for(be=0;be<ge;be++)it[be]=z(it[be],Ee)}}}return Re}}}),name$12="pinv",dependencies$12=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],createPinv=factory(name$12,dependencies$12,v=>{var{typed:N,matrix:G,inv:z,deepEqual:q,equal:Y,dotDivide:W,dot:ie,ctranspose:ne,divideScalar:se,multiply:ae,add:ce,Complex:pe}=v;return N(name$12,{"Array | Matrix":function(Ce){var Ve=isMatrix(Ce)?Ce.size():arraySize(Ce);switch(Ve.length){case 1:return Pe(Ce)?ne(Ce):Ve[0]===1?z(Ce):W(ne(Ce),ie(Ce,Ce));case 2:{if(Pe(Ce))return ne(Ce);var Re=Ve[0],qe=Ve[1];if(Re===qe)try{return z(Ce)}catch(et){if(!(et instanceof Error&&et.message.match(/Cannot calculate inverse, determinant is zero/)))throw et}return isMatrix(Ce)?G(ge(Ce.valueOf(),Re,qe),Ce.storage()):ge(Ce,Re,qe)}default:throw new RangeError("Matrix must be two dimensional (size: "+format(Ve)+")")}},any:function(Ce){return Y(Ce,0)?clone$2(Ce):se(1,Ce)}});function ge(Je,Ce,Ve){var{C:Re,F:qe}=be(Je,Ce,Ve),et=ae(z(ae(ne(Re),Re)),ne(Re)),Ze=ae(ne(qe),z(ae(qe,ne(qe))));return ae(Ze,et)}function ve(Je,Ce,Ve){for(var Re=clone$2(Je),qe=0,et=0;et<Ce;et++){if(Ve<=qe)return Re;for(var Ze=et;Ee(Re[Ze][qe]);)if(Ze++,Ce===Ze&&(Ze=et,qe++,Ve===qe))return Re;[Re[Ze],Re[et]]=[Re[et],Re[Ze]];for(var tt=Re[et][qe],Ke=0;Ke<Ve;Ke++)Re[et][Ke]=W(Re[et][Ke],tt);for(var rt=0;rt<Ce;rt++)if(rt!==et){tt=Re[rt][qe];for(var it=0;it<Ve;it++)Re[rt][it]=ce(Re[rt][it],ae(-1,ae(tt,Re[et][it])))}qe++}return Re}function be(Je,Ce,Ve){var Re=ve(Je,Ce,Ve),qe=Je.map((Ze,tt)=>Ze.filter((Ke,rt)=>rt<Ce&&!Ee(ie(Re[rt],Re[rt])))),et=Re.filter((Ze,tt)=>!Ee(ie(Re[tt],Re[tt])));return{C:qe,F:et}}function Ee(Je){return Y(ce(Je,pe(1,1)),ce(0,pe(1,1)))}function Pe(Je){return q(ce(Je,pe(1,1)),ce(ae(Je,0),pe(1,1)))}});function createComplexEigs(v){var{addScalar:N,subtract:G,flatten:z,multiply:q,multiplyScalar:Y,divideScalar:W,sqrt:ie,abs:ne,bignumber:se,diag:ae,inv:ce,qr:pe,usolve:ge,usolveAll:ve,equal:be,complex:Ee,larger:Pe,smaller:Je,matrixFromColumns:Ce,dot:Ve}=v;function Re(vt,dt,xt,ft,Et){Et===void 0&&(Et=!0);var Ct=qe(vt,dt,xt,ft,Et);et(vt,dt,xt,ft,Et,Ct);var{values:Dt,C:Gt}=Ze(vt,dt,xt,ft,Et),Ot;return Et&&(Ot=tt(vt,dt,Gt,Ct,Dt,xt,ft),Ot=Ce(...Ot)),{values:Dt,vectors:Ot}}function qe(vt,dt,xt,ft,Et){var Ct=ft==="BigNumber",Dt=ft==="Complex",Gt=Ct?se(0):0,Ot=Ct?se(1):Dt?Ee(1):1,It=Ct?se(1):1,Bt=Ct?se(10):2,Ht=Y(Bt,Bt),ir;Et&&(ir=Array(dt).fill(Ot));for(var zt=!1;!zt;){zt=!0;for(var tr=0;tr<dt;tr++){for(var bt=Gt,_t=Gt,Xt=0;Xt<dt;Xt++)if(tr!==Xt){var At=ne(vt[tr][Xt]);bt=N(bt,At),_t=N(_t,At)}if(!be(bt,0)&&!be(_t,0)){for(var $t=It,Pt=bt,kt=W(_t,Bt),jt=Y(_t,Bt);Je(Pt,kt);)Pt=Y(Pt,Ht),$t=Y($t,Bt);for(;Pe(Pt,jt);)Pt=W(Pt,Ht),$t=W($t,Bt);var wt=Je(W(N(Pt,_t),$t),Y(N(bt,_t),.95));if(wt){zt=!1;for(var Mt=W(1,$t),Tt=0;Tt<dt;Tt++)tr!==Tt&&(vt[tr][Tt]=Y(vt[tr][Tt],$t),vt[Tt][tr]=Y(vt[Tt][tr],Mt));Et&&(ir[tr]=Y(ir[tr],$t))}}}}return ae(ir)}function et(vt,dt,xt,ft,Et,Ct){var Dt=ft==="BigNumber",Gt=ft==="Complex",Ot=Dt?se(0):Gt?Ee(0):0;Dt&&(xt=se(xt));for(var It=0;It<dt-2;It++){for(var Bt=0,Ht=Ot,ir=It+1;ir<dt;ir++){var zt=vt[ir][It];Je(ne(Ht),ne(zt))&&(Ht=zt,Bt=ir)}if(!Je(ne(Ht),xt)){if(Bt!==It+1){var tr=vt[Bt];vt[Bt]=vt[It+1],vt[It+1]=tr;for(var bt=0;bt<dt;bt++){var _t=vt[bt][Bt];vt[bt][Bt]=vt[bt][It+1],vt[bt][It+1]=_t}if(Et){var Xt=Ct[Bt];Ct[Bt]=Ct[It+1],Ct[It+1]=Xt}}for(var At=It+2;At<dt;At++){var $t=W(vt[At][It],Ht);if($t!==0){for(var Pt=0;Pt<dt;Pt++)vt[At][Pt]=G(vt[At][Pt],Y($t,vt[It+1][Pt]));for(var kt=0;kt<dt;kt++)vt[kt][It+1]=N(vt[kt][It+1],Y($t,vt[kt][At]));if(Et)for(var jt=0;jt<dt;jt++)Ct[At][jt]=G(Ct[At][jt],Y($t,Ct[It+1][jt]))}}}}return Ct}function Ze(vt,dt,xt,ft,Et){var Ct=ft==="BigNumber",Dt=ft==="Complex",Gt=Ct?se(1):Dt?Ee(1):1;Ct&&(xt=se(xt));for(var Ot=clone$2(vt),It=[],Bt=dt,Ht=[],ir=Et?ae(Array(dt).fill(Gt)):void 0,zt=Et?ae(Array(Bt).fill(Gt)):void 0,tr=0;tr<=100;){tr+=1;for(var bt=0,_t=0;_t<Bt;_t++)Ot[_t][_t]=G(Ot[_t][_t],bt);var{Q:Xt,R:At}=pe(Ot);Ot=q(At,Xt);for(var $t=0;$t<Bt;$t++)Ot[$t][$t]=N(Ot[$t][$t],bt);if(Et&&(zt=q(zt,Xt)),Bt===1||Je(ne(Ot[Bt-1][Bt-2]),xt)){tr=0,It.push(Ot[Bt-1][Bt-1]),Et&&(Ht.unshift([[1]]),it(zt,dt),ir=q(ir,zt),Bt>1&&(zt=ae(Array(Bt-1).fill(Gt)))),Bt-=1,Ot.pop();for(var Pt=0;Pt<Bt;Pt++)Ot[Pt].pop()}else if(Bt===2||Je(ne(Ot[Bt-2][Bt-3]),xt)){tr=0;var kt=Ke(Ot[Bt-2][Bt-2],Ot[Bt-2][Bt-1],Ot[Bt-1][Bt-2],Ot[Bt-1][Bt-1]);It.push(...kt),Et&&(Ht.unshift(rt(Ot[Bt-2][Bt-2],Ot[Bt-2][Bt-1],Ot[Bt-1][Bt-2],Ot[Bt-1][Bt-1],kt[0],kt[1],xt,ft)),it(zt,dt),ir=q(ir,zt),Bt>2&&(zt=ae(Array(Bt-2).fill(Gt)))),Bt-=2,Ot.pop(),Ot.pop();for(var jt=0;jt<Bt;jt++)Ot[jt].pop(),Ot[jt].pop()}if(Bt===0)break}if(It.sort((Tt,Rt)=>+G(ne(Tt),ne(Rt))),tr>100){var wt=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+It.join(", "));throw wt.values=It,wt.vectors=[],wt}var Mt=Et?q(ir,ot(Ht,dt)):void 0;return{values:It,C:Mt}}function tt(vt,dt,xt,ft,Et,Ct,Dt){var Gt=ce(xt),Ot=q(Gt,vt,xt),It=Dt==="BigNumber",Bt=Dt==="Complex",Ht=It?se(0):Bt?Ee(0):0,ir=It?se(1):Bt?Ee(1):1,zt=[],tr=[];for(var bt of Et){var _t=ut(zt,bt,be);_t===-1?(zt.push(bt),tr.push(1)):tr[_t]+=1}for(var Xt=[],At=zt.length,$t=Array(dt).fill(Ht),Pt=ae(Array(dt).fill(ir)),kt=[],jt=function(){var Rt=zt[wt],Ft=G(Ot,q(Rt,Pt)),Ut=ve(Ft,$t);for(Ut.shift();Ut.length<tr[wt];){var Zt=ct(Ft,dt,Ut,Ct,Dt);if(Zt==null){kt.push(Rt);break}Ut.push(Zt)}var Wt=q(ce(ft),xt);Ut=Ut.map(qt=>q(Wt,qt)),Xt.push(...Ut.map(qt=>z(qt)))},wt=0;wt<At;wt++)jt();if(kt.length!==0){var Mt=new Error("Failed to find eigenvectors for the following eigenvalues: "+kt.join(", "));throw Mt.values=Et,Mt.vectors=Xt,Mt}return Xt}function Ke(vt,dt,xt,ft){var Et=N(vt,ft),Ct=G(Y(vt,ft),Y(dt,xt)),Dt=Y(Et,.5),Gt=Y(ie(G(Y(Et,Et),Y(4,Ct))),.5);return[N(Dt,Gt),G(Dt,Gt)]}function rt(vt,dt,xt,ft,Et,Ct,Dt,Gt){var Ot=Gt==="BigNumber",It=Gt==="Complex",Bt=Ot?se(0):It?Ee(0):0,Ht=Ot?se(1):It?Ee(1):1;if(Je(ne(xt),Dt))return[[Ht,Bt],[Bt,Ht]];if(Pe(ne(G(Et,Ct)),Dt))return[[G(Et,ft),G(Ct,ft)],[xt,xt]];var ir=G(vt,Et),zt=G(dt,Et),tr=G(xt,Et),bt=G(ft,Et);return Je(ne(zt),Dt)?[[ir,Ht],[tr,Bt]]:[[zt,Bt],[bt,Ht]]}function it(vt,dt){for(var xt=0;xt<vt.length;xt++)vt[xt].push(...Array(dt-vt[xt].length).fill(0));for(var ft=vt.length;ft<dt;ft++)vt.push(Array(dt).fill(0)),vt[ft][ft]=1;return vt}function ot(vt,dt){for(var xt=[],ft=0;ft<dt;ft++)xt[ft]=Array(dt).fill(0);var Et=0;for(var Ct of vt){for(var Dt=Ct.length,Gt=0;Gt<Dt;Gt++)for(var Ot=0;Ot<Dt;Ot++)xt[Et+Gt][Et+Ot]=Ct[Gt][Ot];Et+=Dt}return xt}function ut(vt,dt,xt){for(var ft=0;ft<vt.length;ft++)if(xt(vt[ft],dt))return ft;return-1}function ct(vt,dt,xt,ft,Et){for(var Ct=Et==="BigNumber"?se(1e3):1e3,Dt,Gt=0;Dt=at(dt,xt,Et),Dt=ge(vt,Dt),!Pe(pt(Dt),Ct);)if(++Gt>=5)return null;for(Gt=0;;){var Ot=ge(vt,Dt);if(Je(pt(st(Dt,[Ot])),ft))break;if(++Gt>=10)return null;Dt=lt(Ot)}return Dt}function at(vt,dt,xt){var ft=xt==="BigNumber",Et=xt==="Complex",Ct=Array(vt).fill(0).map(Dt=>2*Math.random()-1);return ft&&(Ct=Ct.map(Dt=>se(Dt))),Et&&(Ct=Ct.map(Dt=>Ee(Dt))),Ct=st(Ct,dt),lt(Ct,xt)}function st(vt,dt){for(var xt of dt)vt=G(vt,q(W(Ve(xt,vt),Ve(xt,xt)),xt));return vt}function pt(vt){return ne(ie(Ve(vt,vt)))}function lt(vt,dt){var xt=dt==="BigNumber",ft=dt==="Complex",Et=xt?se(1):ft?Ee(1):1;return q(W(Et,pt(vt)),vt)}return Re}function createRealSymmetric(v){var{config:N,addScalar:G,subtract:z,abs:q,atan:Y,cos:W,sin:ie,multiplyScalar:ne,inv:se,bignumber:ae,multiply:ce,add:pe}=v;function ge(Ke,rt){var it=arguments.length>2&&arguments[2]!==void 0?arguments[2]:N.epsilon,ot=arguments.length>3?arguments[3]:void 0;if(ot==="number")return ve(Ke,it);if(ot==="BigNumber")return be(Ke,it);throw TypeError("Unsupported data type: "+ot)}function ve(Ke,rt){for(var it=Ke.length,ot=Math.abs(rt/it),ut,ct=new Array(it),at=0;at<it;at++)ct[at]=tt(it,0),ct[at][at]=1;for(var st=qe(Ke);Math.abs(st[1])>=Math.abs(ot);){var pt=st[0][0],lt=st[0][1];ut=Ee(Ke[pt][pt],Ke[lt][lt],Ke[pt][lt]),Ke=Re(Ke,ut,pt,lt),ct=Je(ct,ut,pt,lt),st=qe(Ke)}for(var vt=tt(it,0),dt=0;dt<it;dt++)vt[dt]=Ke[dt][dt];return Ze(clone$2(vt),clone$2(ct))}function be(Ke,rt){for(var it=Ke.length,ot=q(rt/it),ut,ct=new Array(it),at=0;at<it;at++)ct[at]=tt(it,0),ct[at][at]=1;for(var st=et(Ke);q(st[1])>=q(ot);){var pt=st[0][0],lt=st[0][1];ut=Pe(Ke[pt][pt],Ke[lt][lt],Ke[pt][lt]),Ke=Ve(Ke,ut,pt,lt),ct=Ce(ct,ut,pt,lt),st=et(Ke)}for(var vt=tt(it,0),dt=0;dt<it;dt++)vt[dt]=Ke[dt][dt];return Ze(clone$2(vt),clone$2(ct))}function Ee(Ke,rt,it){var ot=rt-Ke;return Math.abs(ot)<=N.epsilon?Math.PI/4:.5*Math.atan(2*it/(rt-Ke))}function Pe(Ke,rt,it){var ot=z(rt,Ke);return q(ot)<=N.epsilon?ae(-1).acos().div(4):ne(.5,Y(ce(2,it,se(ot))))}function Je(Ke,rt,it,ot){for(var ut=Ke.length,ct=Math.cos(rt),at=Math.sin(rt),st=tt(ut,0),pt=tt(ut,0),lt=0;lt<ut;lt++)st[lt]=ct*Ke[lt][it]-at*Ke[lt][ot],pt[lt]=at*Ke[lt][it]+ct*Ke[lt][ot];for(var vt=0;vt<ut;vt++)Ke[vt][it]=st[vt],Ke[vt][ot]=pt[vt];return Ke}function Ce(Ke,rt,it,ot){for(var ut=Ke.length,ct=W(rt),at=ie(rt),st=tt(ut,ae(0)),pt=tt(ut,ae(0)),lt=0;lt<ut;lt++)st[lt]=z(ne(ct,Ke[lt][it]),ne(at,Ke[lt][ot])),pt[lt]=G(ne(at,Ke[lt][it]),ne(ct,Ke[lt][ot]));for(var vt=0;vt<ut;vt++)Ke[vt][it]=st[vt],Ke[vt][ot]=pt[vt];return Ke}function Ve(Ke,rt,it,ot){for(var ut=Ke.length,ct=ae(W(rt)),at=ae(ie(rt)),st=ne(ct,ct),pt=ne(at,at),lt=tt(ut,ae(0)),vt=tt(ut,ae(0)),dt=ce(ae(2),ct,at,Ke[it][ot]),xt=G(z(ne(st,Ke[it][it]),dt),ne(pt,Ke[ot][ot])),ft=pe(ne(pt,Ke[it][it]),dt,ne(st,Ke[ot][ot])),Et=0;Et<ut;Et++)lt[Et]=z(ne(ct,Ke[it][Et]),ne(at,Ke[ot][Et])),vt[Et]=G(ne(at,Ke[it][Et]),ne(ct,Ke[ot][Et]));Ke[it][it]=xt,Ke[ot][ot]=ft,Ke[it][ot]=ae(0),Ke[ot][it]=ae(0);for(var Ct=0;Ct<ut;Ct++)Ct!==it&&Ct!==ot&&(Ke[it][Ct]=lt[Ct],Ke[Ct][it]=lt[Ct],Ke[ot][Ct]=vt[Ct],Ke[Ct][ot]=vt[Ct]);return Ke}function Re(Ke,rt,it,ot){for(var ut=Ke.length,ct=Math.cos(rt),at=Math.sin(rt),st=ct*ct,pt=at*at,lt=tt(ut,0),vt=tt(ut,0),dt=st*Ke[it][it]-2*ct*at*Ke[it][ot]+pt*Ke[ot][ot],xt=pt*Ke[it][it]+2*ct*at*Ke[it][ot]+st*Ke[ot][ot],ft=0;ft<ut;ft++)lt[ft]=ct*Ke[it][ft]-at*Ke[ot][ft],vt[ft]=at*Ke[it][ft]+ct*Ke[ot][ft];Ke[it][it]=dt,Ke[ot][ot]=xt,Ke[it][ot]=0,Ke[ot][it]=0;for(var Et=0;Et<ut;Et++)Et!==it&&Et!==ot&&(Ke[it][Et]=lt[Et],Ke[Et][it]=lt[Et],Ke[ot][Et]=vt[Et],Ke[Et][ot]=vt[Et]);return Ke}function qe(Ke){for(var rt=Ke.length,it=0,ot=[0,1],ut=0;ut<rt;ut++)for(var ct=ut+1;ct<rt;ct++)Math.abs(it)<Math.abs(Ke[ut][ct])&&(it=Math.abs(Ke[ut][ct]),ot=[ut,ct]);return[ot,it]}function et(Ke){for(var rt=Ke.length,it=0,ot=[0,1],ut=0;ut<rt;ut++)for(var ct=ut+1;ct<rt;ct++)q(it)<q(Ke[ut][ct])&&(it=q(Ke[ut][ct]),ot=[ut,ct]);return[ot,it]}function Ze(Ke,rt){for(var it=Ke.length,ot=Array(it),ut=Array(it),ct=0;ct<it;ct++)ut[ct]=Array(it);for(var at=0;at<it;at++){for(var st=0,pt=Ke[0],lt=0;lt<Ke.length;lt++)q(Ke[lt])<q(pt)&&(st=lt,pt=Ke[st]);ot[at]=Ke.splice(st,1)[0];for(var vt=0;vt<it;vt++)ut[vt][at]=rt[vt][st],rt[vt].splice(st,1)}return{values:ot,vectors:ut}}function tt(Ke,rt){for(var it=new Array(Ke),ot=0;ot<Ke;ot++)it[ot]=rt;return it}return ge}var name$11="eigs",dependencies$11=["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"],createEigs=factory(name$11,dependencies$11,v=>{var{config:N,typed:G,matrix:z,addScalar:q,subtract:Y,equal:W,abs:ie,atan:ne,cos:se,sin:ae,multiplyScalar:ce,divideScalar:pe,inv:ge,bignumber:ve,multiply:be,add:Ee,larger:Pe,column:Je,flatten:Ce,number:Ve,complex:Re,sqrt:qe,diag:et,qr:Ze,usolve:tt,usolveAll:Ke,im:rt,re:it,smaller:ot,matrixFromColumns:ut,dot:ct}=v,at=createRealSymmetric({config:N,addScalar:q,subtract:Y,abs:ie,atan:ne,cos:se,sin:ae,multiplyScalar:ce,inv:ge,bignumber:ve,multiply:be,add:Ee}),st=createComplexEigs({addScalar:q,subtract:Y,multiply:be,multiplyScalar:ce,flatten:Ce,divideScalar:pe,sqrt:qe,abs:ie,bignumber:ve,diag:et,qr:Ze,inv:ge,usolve:tt,usolveAll:Ke,equal:W,complex:Re,larger:Pe,smaller:ot,matrixFromColumns:ut,dot:ct});return G("eigs",{Array:function(Et){var Ct=z(Et);return pt(Ct)},"Array, number|BigNumber":function(Et,Ct){var Dt=z(Et);return pt(Dt,Ct)},Matrix:function(Et){var{values:Ct,vectors:Dt}=pt(Et);return{values:z(Ct),vectors:z(Dt)}},"Matrix, number|BigNumber":function(Et,Ct){var{values:Dt,vectors:Gt}=pt(Et,Ct);return{values:z(Dt),vectors:z(Gt)}}});function pt(ft,Et){Et===void 0&&(Et=N.epsilon);var Ct=ft.size();if(Ct.length!==2||Ct[0]!==Ct[1])throw new RangeError("Matrix must be square (size: "+format(Ct)+")");var Dt=ft.toArray(),Gt=Ct[0];if(vt(Dt,Gt,Et)&&(dt(Dt,Gt),lt(Dt,Gt,Et))){var Ot=xt(ft,Dt,Gt);return at(Dt,Gt,Et,Ot)}var It=xt(ft,Dt,Gt);return st(Dt,Gt,Et,It)}function lt(ft,Et,Ct){for(var Dt=0;Dt<Et;Dt++)for(var Gt=Dt;Gt<Et;Gt++)if(Pe(ve(ie(Y(ft[Dt][Gt],ft[Gt][Dt]))),Ct))return!1;return!0}function vt(ft,Et,Ct){for(var Dt=0;Dt<Et;Dt++)for(var Gt=0;Gt<Et;Gt++)if(Pe(ve(ie(rt(ft[Dt][Gt]))),Ct))return!1;return!0}function dt(ft,Et){for(var Ct=0;Ct<Et;Ct++)for(var Dt=0;Dt<Et;Dt++)ft[Ct][Dt]=it(ft[Ct][Dt])}function xt(ft,Et,Ct){var Dt=ft.datatype();if(Dt==="number"||Dt==="BigNumber"||Dt==="Complex")return Dt;for(var Gt=!1,Ot=!1,It=!1,Bt=0;Bt<Ct;Bt++)for(var Ht=0;Ht<Ct;Ht++){var ir=Et[Bt][Ht];if(isNumber(ir)||isFraction(ir))Gt=!0;else if(isBigNumber(ir))Ot=!0;else if(isComplex(ir))It=!0;else throw TypeError("Unsupported type in Matrix: "+typeOf(ir))}if(Ot&&It&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),It){for(var zt=0;zt<Ct;zt++)for(var tr=0;tr<Ct;tr++)Et[zt][tr]=Re(Et[zt][tr]);return"Complex"}if(Ot){for(var bt=0;bt<Ct;bt++)for(var _t=0;_t<Ct;_t++)Et[bt][_t]=ve(Et[bt][_t]);return"BigNumber"}if(Gt){for(var Xt=0;Xt<Ct;Xt++)for(var At=0;At<Ct;At++)Et[Xt][At]=Ve(Et[Xt][At]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),name$10="expm",dependencies$10=["typed","abs","add","identity","inv","multiply"],createExpm=factory(name$10,dependencies$10,v=>{var{typed:N,abs:G,add:z,identity:q,inv:Y,multiply:W}=v;return N(name$10,{Matrix:function(ce){var pe=ce.size();if(pe.length!==2||pe[0]!==pe[1])throw new RangeError("Matrix must be square (size: "+format(pe)+")");for(var ge=pe[0],ve=1e-15,be=ie(ce),Ee=ne(be,ve),Pe=Ee.q,Je=Ee.j,Ce=W(ce,Math.pow(2,-Je)),Ve=q(ge),Re=q(ge),qe=1,et=Ce,Ze=-1,tt=1;tt<=Pe;tt++)tt>1&&(et=W(et,Ce),Ze=-Ze),qe=qe*(Pe-tt+1)/((2*Pe-tt+1)*tt),Ve=z(Ve,W(qe,et)),Re=z(Re,W(qe*Ze,et));for(var Ke=W(Y(Re),Ve),rt=0;rt<Je;rt++)Ke=W(Ke,Ke);return isSparseMatrix(ce)?ce.createSparseMatrix(Ke):Ke}});function ie(ae){for(var ce=ae.size()[0],pe=0,ge=0;ge<ce;ge++){for(var ve=0,be=0;be<ce;be++)ve+=G(ae.get([ge,be]));pe=Math.max(ve,pe)}return pe}function ne(ae,ce){for(var pe=30,ge=0;ge<pe;ge++)for(var ve=0;ve<=ge;ve++){var be=ge-ve;if(se(ae,ve,be)<ce)return{q:ve,j:be}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function se(ae,ce,pe){for(var ge=1,ve=2;ve<=ce;ve++)ge*=ve;for(var be=ge,Ee=ce+1;Ee<=2*ce;Ee++)be*=Ee;var Pe=be*(2*ce+1);return 8*Math.pow(ae/Math.pow(2,pe),2*ce)*ge*ge/(be*Pe)}}),name$$="sqrtm",dependencies$$=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],createSqrtm=factory(name$$,dependencies$$,v=>{var{typed:N,abs:G,add:z,multiply:q,map:Y,sqrt:W,subtract:ie,inv:ne,size:se,max:ae,identity:ce}=v,pe=1e3,ge=1e-6;function ve(be){var Ee,Pe=0,Je=be,Ce=ce(se(be));do{var Ve=Je;if(Je=q(.5,z(Ve,ne(Ce))),Ce=q(.5,z(Ce,ne(Ve))),Ee=ae(G(ie(Je,Ve))),Ee>ge&&++Pe>pe)throw new Error("computing square root of matrix: iterative method could not converge")}while(Ee>ge);return Je}return N(name$$,{"Array | Matrix":function(Ee){var Pe=isMatrix(Ee)?Ee.size():arraySize(Ee);switch(Pe.length){case 1:if(Pe[0]===1)return Y(Ee,W);throw new RangeError("Matrix must be square (size: "+format(Pe)+")");case 2:{var Je=Pe[0],Ce=Pe[1];if(Je===Ce)return ve(Ee);throw new RangeError("Matrix must be square (size: "+format(Pe)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+format(Pe)+")")}}})}),name$_="sylvester",dependencies$_=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],createSylvester=factory(name$_,dependencies$_,v=>{var{typed:N,schur:G,matrixFromColumns:z,matrix:q,multiply:Y,range:W,concat:ie,transpose:ne,index:se,subset:ae,add:ce,subtract:pe,identity:ge,lusolve:ve,abs:be}=v;return N(name$_,{"Matrix, Matrix, Matrix":Ee,"Array, Matrix, Matrix":function(Je,Ce,Ve){return Ee(q(Je),Ce,Ve)},"Array, Array, Matrix":function(Je,Ce,Ve){return Ee(q(Je),q(Ce),Ve)},"Array, Matrix, Array":function(Je,Ce,Ve){return Ee(q(Je),Ce,q(Ve))},"Matrix, Array, Matrix":function(Je,Ce,Ve){return Ee(Je,q(Ce),Ve)},"Matrix, Array, Array":function(Je,Ce,Ve){return Ee(Je,q(Ce),q(Ve))},"Matrix, Matrix, Array":function(Je,Ce,Ve){return Ee(Je,Ce,q(Ve))},"Array, Array, Array":function(Je,Ce,Ve){return Ee(q(Je),q(Ce),q(Ve)).toArray()}});function Ee(Pe,Je,Ce){for(var Ve=Je.size()[0],Re=Pe.size()[0],qe=G(Pe),et=qe.T,Ze=qe.U,tt=G(Y(-1,Je)),Ke=tt.T,rt=tt.U,it=Y(Y(ne(Ze),Ce),rt),ot=W(0,Re),ut=[],ct=(ir,zt)=>ie(ir,zt,1),at=(ir,zt)=>ie(ir,zt,0),st=0;st<Ve;st++)if(st<Ve-1&&be(ae(Ke,se(st+1,st)))>1e-5){for(var pt=at(ae(it,se(ot,st)),ae(it,se(ot,st+1))),lt=0;lt<st;lt++)pt=ce(pt,at(Y(ut[lt],ae(Ke,se(lt,st))),Y(ut[lt],ae(Ke,se(lt,st+1)))));var vt=Y(ge(Re),Y(-1,ae(Ke,se(st,st)))),dt=Y(ge(Re),Y(-1,ae(Ke,se(st+1,st)))),xt=Y(ge(Re),Y(-1,ae(Ke,se(st,st+1)))),ft=Y(ge(Re),Y(-1,ae(Ke,se(st+1,st+1)))),Et=at(ct(ce(et,vt),dt),ct(xt,ce(et,ft))),Ct=ve(Et,pt);ut[st]=Ct.subset(se(W(0,Re),0)),ut[st+1]=Ct.subset(se(W(Re,2*Re),0)),st++}else{for(var Dt=ae(it,se(ot,st)),Gt=0;Gt<st;Gt++)Dt=ce(Dt,Y(ut[Gt],ae(Ke,se(Gt,st))));var Ot=ae(Ke,se(st,st)),It=pe(et,Y(Ot,ge(Re)));ut[st]=ve(It,Dt)}var Bt=q(z(...ut)),Ht=Y(Ze,Y(Bt,ne(rt)));return Ht}}),name$Z="schur",dependencies$Z=["typed","matrix","identity","multiply","qr","norm","subtract"],createSchur=factory(name$Z,dependencies$Z,v=>{var{typed:N,matrix:G,identity:z,multiply:q,qr:Y,norm:W,subtract:ie}=v;return N(name$Z,{Array:function(ae){var ce=ne(G(ae));return{U:ce.U.valueOf(),T:ce.T.valueOf()}},Matrix:function(ae){return ne(ae)}});function ne(se){var ae=se.size()[0],ce=se,pe=z(ae),ge=0,ve;do{ve=ce;var be=Y(ce),Ee=be.Q,Pe=be.R;if(ce=q(Pe,Ee),pe=q(pe,Ee),ge++>100)break}while(W(ie(ce,ve))>1e-4);return{U:pe,T:ce}}}),name$Y="lyap",dependencies$Y=["typed","matrix","sylvester","multiply","transpose"],createLyap=factory(name$Y,dependencies$Y,v=>{var{typed:N,matrix:G,sylvester:z,multiply:q,transpose:Y}=v;return N(name$Y,{"Matrix, Matrix":function(ie,ne){return z(ie,Y(ie),q(-1,ne))},"Array, Matrix":function(ie,ne){return z(G(ie),Y(G(ie)),q(-1,ne))},"Matrix, Array":function(ie,ne){return z(ie,Y(G(ie)),G(q(-1,ne)))},"Array, Array":function(ie,ne){return z(G(ie),Y(G(ie)),G(q(-1,ne))).toArray()}})}),name$X="divide",dependencies$X=["typed","matrix","multiply","equalScalar","divideScalar","inv"],createDivide=factory(name$X,dependencies$X,v=>{var{typed:N,matrix:G,multiply:z,equalScalar:q,divideScalar:Y,inv:W}=v,ie=createMatAlgo11xS0s({typed:N,equalScalar:q}),ne=createMatAlgo14xDs({typed:N});return N("divide",extend({"Array | Matrix, Array | Matrix":function(ae,ce){return z(ae,W(ce))},"DenseMatrix, any":function(ae,ce){return ne(ae,ce,Y,!1)},"SparseMatrix, any":function(ae,ce){return ie(ae,ce,Y,!1)},"Array, any":function(ae,ce){return ne(G(ae),ce,Y,!1).valueOf()},"any, Array | Matrix":function(ae,ce){return z(ae,W(ce))}},Y.signatures))}),name$W="distance",dependencies$W=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],createDistance=factory(name$W,dependencies$W,v=>{var{typed:N,addScalar:G,subtractScalar:z,multiplyScalar:q,divideScalar:Y,deepEqual:W,sqrt:ie,abs:ne}=v;return N(name$W,{"Array, Array, Array":function(Re,qe,et){if(Re.length===2&&qe.length===2&&et.length===2){if(!ae(Re))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!ae(qe))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!ae(et))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(W(qe,et))throw new TypeError("LinePoint1 should not be same with LinePoint2");var Ze=z(et[1],qe[1]),tt=z(qe[0],et[0]),Ke=z(q(et[0],qe[1]),q(qe[0],et[1]));return Ee(Re[0],Re[1],Ze,tt,Ke)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(Re,qe,et){if(Object.keys(Re).length===2&&Object.keys(qe).length===2&&Object.keys(et).length===2){if(!ae(Re))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!ae(qe))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!ae(et))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(W(ve(qe),ve(et)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in Re&&"pointY"in Re&&"lineOnePtX"in qe&&"lineOnePtY"in qe&&"lineTwoPtX"in et&&"lineTwoPtY"in et){var Ze=z(et.lineTwoPtY,qe.lineOnePtY),tt=z(qe.lineOnePtX,et.lineTwoPtX),Ke=z(q(et.lineTwoPtX,qe.lineOnePtY),q(qe.lineOnePtX,et.lineTwoPtY));return Ee(Re.pointX,Re.pointY,Ze,tt,Ke)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(Re,qe){if(Re.length===2&&qe.length===3){if(!ae(Re))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!ce(qe))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return Ee(Re[0],Re[1],qe[0],qe[1],qe[2])}else if(Re.length===3&&qe.length===6){if(!ce(Re))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!ge(qe))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return Pe(Re[0],Re[1],Re[2],qe[0],qe[1],qe[2],qe[3],qe[4],qe[5])}else if(Re.length===qe.length&&Re.length>0){if(!pe(Re))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!pe(qe))throw new TypeError("All values of an array should be numbers or BigNumbers");return Je(Re,qe)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(Re,qe){if(Object.keys(Re).length===2&&Object.keys(qe).length===3){if(!ae(Re))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!ce(qe))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in Re&&"pointY"in Re&&"xCoeffLine"in qe&&"yCoeffLine"in qe&&"constant"in qe)return Ee(Re.pointX,Re.pointY,qe.xCoeffLine,qe.yCoeffLine,qe.constant);throw new TypeError("Key names do not match")}else if(Object.keys(Re).length===3&&Object.keys(qe).length===6){if(!ce(Re))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!ge(qe))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in Re&&"pointY"in Re&&"x0"in qe&&"y0"in qe&&"z0"in qe&&"a"in qe&&"b"in qe&&"c"in qe)return Pe(Re.pointX,Re.pointY,Re.pointZ,qe.x0,qe.y0,qe.z0,qe.a,qe.b,qe.c);throw new TypeError("Key names do not match")}else if(Object.keys(Re).length===2&&Object.keys(qe).length===2){if(!ae(Re))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!ae(qe))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in Re&&"pointOneY"in Re&&"pointTwoX"in qe&&"pointTwoY"in qe)return Je([Re.pointOneX,Re.pointOneY],[qe.pointTwoX,qe.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(Re).length===3&&Object.keys(qe).length===3){if(!ce(Re))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!ce(qe))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in Re&&"pointOneY"in Re&&"pointOneZ"in Re&&"pointTwoX"in qe&&"pointTwoY"in qe&&"pointTwoZ"in qe)return Je([Re.pointOneX,Re.pointOneY,Re.pointOneZ],[qe.pointTwoX,qe.pointTwoY,qe.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(Re){if(!be(Re))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return Ce(Re)}});function se(Ve){return typeof Ve=="number"||isBigNumber(Ve)}function ae(Ve){return Ve.constructor!==Array&&(Ve=ve(Ve)),se(Ve[0])&&se(Ve[1])}function ce(Ve){return Ve.constructor!==Array&&(Ve=ve(Ve)),se(Ve[0])&&se(Ve[1])&&se(Ve[2])}function pe(Ve){return Array.isArray(Ve)||(Ve=ve(Ve)),Ve.every(se)}function ge(Ve){return Ve.constructor!==Array&&(Ve=ve(Ve)),se(Ve[0])&&se(Ve[1])&&se(Ve[2])&&se(Ve[3])&&se(Ve[4])&&se(Ve[5])}function ve(Ve){for(var Re=Object.keys(Ve),qe=[],et=0;et<Re.length;et++)qe.push(Ve[Re[et]]);return qe}function be(Ve){if(Ve[0].length===2&&se(Ve[0][0])&&se(Ve[0][1])){if(Ve.some(Re=>Re.length!==2||!se(Re[0])||!se(Re[1])))return!1}else if(Ve[0].length===3&&se(Ve[0][0])&&se(Ve[0][1])&&se(Ve[0][2])){if(Ve.some(Re=>Re.length!==3||!se(Re[0])||!se(Re[1])||!se(Re[2])))return!1}else return!1;return!0}function Ee(Ve,Re,qe,et,Ze){var tt=ne(G(G(q(qe,Ve),q(et,Re)),Ze)),Ke=ie(G(q(qe,qe),q(et,et)));return Y(tt,Ke)}function Pe(Ve,Re,qe,et,Ze,tt,Ke,rt,it){var ot=[z(q(z(Ze,Re),it),q(z(tt,qe),rt)),z(q(z(tt,qe),Ke),q(z(et,Ve),it)),z(q(z(et,Ve),rt),q(z(Ze,Re),Ke))];ot=ie(G(G(q(ot[0],ot[0]),q(ot[1],ot[1])),q(ot[2],ot[2])));var ut=ie(G(G(q(Ke,Ke),q(rt,rt)),q(it,it)));return Y(ot,ut)}function Je(Ve,Re){for(var qe=Ve.length,et=0,Ze=0,tt=0;tt<qe;tt++)Ze=z(Ve[tt],Re[tt]),et=G(q(Ze,Ze),et);return ie(et)}function Ce(Ve){for(var Re=[],qe=[],et=[],Ze=0;Ze<Ve.length-1;Ze++)for(var tt=Ze+1;tt<Ve.length;tt++)Ve[0].length===2?(qe=[Ve[Ze][0],Ve[Ze][1]],et=[Ve[tt][0],Ve[tt][1]]):Ve[0].length===3&&(qe=[Ve[Ze][0],Ve[Ze][1],Ve[Ze][2]],et=[Ve[tt][0],Ve[tt][1],Ve[tt][2]]),Re.push(Je(qe,et));return Re}}),name$V="intersect",dependencies$V=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],createIntersect=factory(name$V,dependencies$V,v=>{var{typed:N,config:G,abs:z,add:q,addScalar:Y,matrix:W,multiply:ie,multiplyScalar:ne,divideScalar:se,subtract:ae,smaller:ce,equalScalar:pe,flatten:ge,isZero:ve,isNumeric:be}=v;return N("intersect",{"Array, Array, Array":Ee,"Array, Array, Array, Array":Pe,"Matrix, Matrix, Matrix":function(rt,it,ot){var ut=Ee(rt.valueOf(),it.valueOf(),ot.valueOf());return ut===null?null:W(ut)},"Matrix, Matrix, Matrix, Matrix":function(rt,it,ot,ut){var ct=Pe(rt.valueOf(),it.valueOf(),ot.valueOf(),ut.valueOf());return ct===null?null:W(ct)}});function Ee(Ke,rt,it){if(Ke=Je(Ke),rt=Je(rt),it=Je(it),!Ve(Ke))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!Ve(rt))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!Re(it))throw new TypeError("Array with 4 numbers expected as third argument");return tt(Ke[0],Ke[1],Ke[2],rt[0],rt[1],rt[2],it[0],it[1],it[2],it[3])}function Pe(Ke,rt,it,ot){if(Ke=Je(Ke),rt=Je(rt),it=Je(it),ot=Je(ot),Ke.length===2){if(!Ce(Ke))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!Ce(rt))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!Ce(it))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!Ce(ot))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return qe(Ke,rt,it,ot)}else if(Ke.length===3){if(!Ve(Ke))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!Ve(rt))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!Ve(it))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!Ve(ot))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return Ze(Ke[0],Ke[1],Ke[2],rt[0],rt[1],rt[2],it[0],it[1],it[2],ot[0],ot[1],ot[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function Je(Ke){return Ke.length===1?Ke[0]:Ke.length>1&&Array.isArray(Ke[0])&&Ke.every(rt=>Array.isArray(rt)&&rt.length===1)?ge(Ke):Ke}function Ce(Ke){return Ke.length===2&&be(Ke[0])&&be(Ke[1])}function Ve(Ke){return Ke.length===3&&be(Ke[0])&&be(Ke[1])&&be(Ke[2])}function Re(Ke){return Ke.length===4&&be(Ke[0])&&be(Ke[1])&&be(Ke[2])&&be(Ke[3])}function qe(Ke,rt,it,ot){var ut=Ke,ct=it,at=ae(ut,rt),st=ae(ct,ot),pt=ae(ne(at[0],st[1]),ne(st[0],at[1]));if(ve(pt)||ce(z(pt),G.epsilon))return null;var lt=ne(st[0],ut[1]),vt=ne(st[1],ut[0]),dt=ne(st[0],ct[1]),xt=ne(st[1],ct[0]),ft=se(Y(ae(ae(lt,vt),dt),xt),pt);return q(ie(at,ft),ut)}function et(Ke,rt,it,ot,ut,ct,at,st,pt,lt,vt,dt){var xt=ne(ae(Ke,rt),ae(it,ot)),ft=ne(ae(ut,ct),ae(at,st)),Et=ne(ae(pt,lt),ae(vt,dt));return Y(Y(xt,ft),Et)}function Ze(Ke,rt,it,ot,ut,ct,at,st,pt,lt,vt,dt){var xt=et(Ke,at,lt,at,rt,st,vt,st,it,pt,dt,pt),ft=et(lt,at,ot,Ke,vt,st,ut,rt,dt,pt,ct,it),Et=et(Ke,at,ot,Ke,rt,st,ut,rt,it,pt,ct,it),Ct=et(lt,at,lt,at,vt,st,vt,st,dt,pt,dt,pt),Dt=et(ot,Ke,ot,Ke,ut,rt,ut,rt,ct,it,ct,it),Gt=ae(ne(xt,ft),ne(Et,Ct)),Ot=ae(ne(Dt,Ct),ne(ft,ft));if(ve(Ot))return null;var It=se(Gt,Ot),Bt=se(Y(xt,ne(It,ft)),Ct),Ht=Y(Ke,ne(It,ae(ot,Ke))),ir=Y(rt,ne(It,ae(ut,rt))),zt=Y(it,ne(It,ae(ct,it))),tr=Y(at,ne(Bt,ae(lt,at))),bt=Y(st,ne(Bt,ae(vt,st))),_t=Y(pt,ne(Bt,ae(dt,pt)));return pe(Ht,tr)&&pe(ir,bt)&&pe(zt,_t)?[Ht,ir,zt]:null}function tt(Ke,rt,it,ot,ut,ct,at,st,pt,lt){var vt=ne(Ke,at),dt=ne(ot,at),xt=ne(rt,st),ft=ne(ut,st),Et=ne(it,pt),Ct=ne(ct,pt),Dt=ae(ae(ae(lt,vt),xt),Et),Gt=ae(ae(ae(Y(Y(dt,ft),Ct),vt),xt),Et),Ot=se(Dt,Gt),It=Y(Ke,ne(Ot,ae(ot,Ke))),Bt=Y(rt,ne(Ot,ae(ut,rt))),Ht=Y(it,ne(Ot,ae(ct,it)));return[It,Bt,Ht]}}),name$U="sum",dependencies$U=["typed","config","add","numeric"],createSum=factory(name$U,dependencies$U,v=>{var{typed:N,config:G,add:z,numeric:q}=v;return N(name$U,{"Array | Matrix":Y,"Array | Matrix, number | BigNumber":W,"...":function(ne){if(containsCollections(ne))throw new TypeError("Scalar values expected in function sum");return Y(ne)}});function Y(ie){var ne;return deepForEach(ie,function(se){try{ne=ne===void 0?se:z(ne,se)}catch(ae){throw improveErrorMessage(ae,"sum",se)}}),ne===void 0&&(ne=q(0,G.number)),typeof ne=="string"&&(ne=q(ne,G.number)),ne}function W(ie,ne){try{var se=reduce(ie,ne,z);return se}catch(ae){throw improveErrorMessage(ae,"sum")}}}),name$T="cumsum",dependencies$T=["typed","add","unaryPlus"],createCumSum=factory(name$T,dependencies$T,v=>{var{typed:N,add:G,unaryPlus:z}=v;return N(name$T,{Array:q,Matrix:function(se){return se.create(q(se.valueOf()))},"Array, number | BigNumber":W,"Matrix, number | BigNumber":function(se,ae){return se.create(W(se.valueOf(),ae))},"...":function(se){if(containsCollections(se))throw new TypeError("All values expected to be scalar in function cumsum");return q(se)}});function q(ne){try{return Y(ne)}catch(se){throw improveErrorMessage(se,name$T)}}function Y(ne){if(ne.length===0)return[];for(var se=[z(ne[0])],ae=1;ae<ne.length;++ae)se.push(G(se[ae-1],ne[ae]));return se}function W(ne,se){var ae=arraySize(ne);if(se<0||se>=ae.length)throw new IndexError(se,ae.length);try{return ie(ne,se)}catch(ce){throw improveErrorMessage(ce,name$T)}}function ie(ne,se){var ae,ce,pe;if(se<=0){var ge=ne[0][0];if(Array.isArray(ge)){for(pe=_switch$1(ne),ce=[],ae=0;ae<pe.length;ae++)ce[ae]=ie(pe[ae],se-1);return ce}else return Y(ne)}else{for(ce=[],ae=0;ae<ne.length;ae++)ce[ae]=ie(ne[ae],se-1);return ce}}}),name$S="mean",dependencies$S=["typed","add","divide"],createMean=factory(name$S,dependencies$S,v=>{var{typed:N,add:G,divide:z}=v;return N(name$S,{"Array | Matrix":Y,"Array | Matrix, number | BigNumber":q,"...":function(ie){if(containsCollections(ie))throw new TypeError("Scalar values expected in function mean");return Y(ie)}});function q(W,ie){try{var ne=reduce(W,ie,G),se=Array.isArray(W)?arraySize(W):W.size();return z(ne,se[ie])}catch(ae){throw improveErrorMessage(ae,"mean")}}function Y(W){var ie,ne=0;if(deepForEach(W,function(se){try{ie=ie===void 0?se:G(ie,se),ne++}catch(ae){throw improveErrorMessage(ae,"mean",se)}}),ne===0)throw new Error("Cannot calculate the mean of an empty array");return z(ie,ne)}}),name$R="median",dependencies$R=["typed","add","divide","compare","partitionSelect"],createMedian=factory(name$R,dependencies$R,v=>{var{typed:N,add:G,divide:z,compare:q,partitionSelect:Y}=v;function W(se){try{se=flatten(se.valueOf());var ae=se.length;if(ae===0)throw new Error("Cannot calculate median of an empty array");if(ae%2===0){for(var ce=ae/2-1,pe=Y(se,ce+1),ge=se[ce],ve=0;ve<ce;++ve)q(se[ve],ge)>0&&(ge=se[ve]);return ne(ge,pe)}else{var be=Y(se,(ae-1)/2);return ie(be)}}catch(Ee){throw improveErrorMessage(Ee,"median")}}var ie=N({"number | BigNumber | Complex | Unit":function(ae){return ae}}),ne=N({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(ae,ce){return z(G(ae,ce),2)}});return N(name$R,{"Array | Matrix":W,"Array | Matrix, number | BigNumber":function(ae,ce){throw new Error("median(A, dim) is not yet supported")},"...":function(ae){if(containsCollections(ae))throw new TypeError("Scalar values expected in function median");return W(ae)}})}),name$Q="mad",dependencies$Q=["typed","abs","map","median","subtract"],createMad=factory(name$Q,dependencies$Q,v=>{var{typed:N,abs:G,map:z,median:q,subtract:Y}=v;return N(name$Q,{"Array | Matrix":W,"...":function(ne){return W(ne)}});function W(ie){if(ie=flatten(ie.valueOf()),ie.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var ne=q(ie);return q(z(ie,function(se){return G(Y(se,ne))}))}catch(se){throw se instanceof TypeError&&se.message.indexOf("median")!==-1?new TypeError(se.message.replace("median","mad")):improveErrorMessage(se,"mad")}}}),DEFAULT_NORMALIZATION="unbiased",name$P="variance",dependencies$P=["typed","add","subtract","multiply","divide","apply","isNaN"],createVariance=factory(name$P,dependencies$P,v=>{var{typed:N,add:G,subtract:z,multiply:q,divide:Y,apply:W,isNaN:ie}=v;return N(name$P,{"Array | Matrix":function(ce){return ne(ce,DEFAULT_NORMALIZATION)},"Array | Matrix, string":ne,"Array | Matrix, number | BigNumber":function(ce,pe){return se(ce,pe,DEFAULT_NORMALIZATION)},"Array | Matrix, number | BigNumber, string":se,"...":function(ce){return ne(ce,DEFAULT_NORMALIZATION)}});function ne(ae,ce){var pe,ge=0;if(ae.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(deepForEach(ae,function(Ee){try{pe=pe===void 0?Ee:G(pe,Ee),ge++}catch(Pe){throw improveErrorMessage(Pe,"variance",Ee)}}),ge===0)throw new Error("Cannot calculate variance of an empty array");var ve=Y(pe,ge);if(pe=void 0,deepForEach(ae,function(Ee){var Pe=z(Ee,ve);pe=pe===void 0?q(Pe,Pe):G(pe,q(Pe,Pe))}),ie(pe))return pe;switch(ce){case"uncorrected":return Y(pe,ge);case"biased":return Y(pe,ge+1);case"unbiased":{var be=isBigNumber(pe)?pe.mul(0):0;return ge===1?be:Y(pe,ge-1)}default:throw new Error('Unknown normalization "'+ce+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function se(ae,ce,pe){try{if(ae.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return W(ae,ce,ge=>ne(ge,pe))}catch(ge){throw improveErrorMessage(ge,"variance")}}}),name$O="quantileSeq",dependencies$O=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],createQuantileSeq=factory(name$O,dependencies$O,v=>{var{typed:N,bignumber:G,add:z,subtract:q,divide:Y,multiply:W,partitionSelect:ie,compare:ne,isInteger:se,smaller:ae,smallerEq:ce,larger:pe}=v,ge=createApply({typed:N,isInteger:se});return N(name$O,{"Array | Matrix, number | BigNumber":(Je,Ce)=>be(Je,Ce,!1),"Array | Matrix, number | BigNumber, number":(Je,Ce,Ve)=>ve(Je,Ce,!1,Ve,be),"Array | Matrix, number | BigNumber, boolean":be,"Array | Matrix, number | BigNumber, boolean, number":(Je,Ce,Ve,Re)=>ve(Je,Ce,Ve,Re,be),"Array | Matrix, Array | Matrix":(Je,Ce)=>Ee(Je,Ce,!1),"Array | Matrix, Array | Matrix, number":(Je,Ce,Ve)=>ve(Je,Ce,!1,Ve,Ee),"Array | Matrix, Array | Matrix, boolean":Ee,"Array | Matrix, Array | Matrix, boolean, number":(Je,Ce,Ve,Re)=>ve(Je,Ce,Ve,Re,Ee)});function ve(Je,Ce,Ve,Re,qe){return ge(Je,Re,et=>qe(et,Ce,Ve))}function be(Je,Ce,Ve){var Re,qe=Je.valueOf();if(ae(Ce,0))throw new Error("N/prob must be non-negative");if(ce(Ce,1))return isNumber(Ce)?Pe(qe,Ce,Ve):G(Pe(qe,Ce,Ve));if(pe(Ce,1)){if(!se(Ce))throw new Error("N must be a positive integer");if(pe(Ce,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 et=z(Ce,1);Re=[];for(var Ze=0;ae(Ze,Ce);Ze++){var tt=Y(Ze+1,et);Re.push(Pe(qe,tt,Ve))}return isNumber(Ce)?Re:G(Re)}}function Ee(Je,Ce,Ve){for(var Re=Je.valueOf(),qe=Ce.valueOf(),et=[],Ze=0;Ze<qe.length;++Ze)et.push(Pe(Re,qe[Ze],Ve));return et}function Pe(Je,Ce,Ve){var Re=flatten(Je),qe=Re.length;if(qe===0)throw new Error("Cannot calculate quantile of an empty sequence");var et=isNumber(Ce)?Ce*(qe-1):Ce.times(qe-1),Ze=isNumber(Ce)?Math.floor(et):et.floor().toNumber(),tt=isNumber(Ce)?et%1:et.minus(Ze);if(se(et))return Ve?Re[et]:ie(Re,isNumber(Ce)?et:et.valueOf());var Ke,rt;if(Ve)Ke=Re[Ze],rt=Re[Ze+1];else{rt=ie(Re,Ze+1),Ke=Re[Ze];for(var it=0;it<Ze;++it)ne(Re[it],Ke)>0&&(Ke=Re[it])}return z(W(Ke,q(1,tt)),W(rt,tt))}}),name$N="std",dependencies$N=["typed","map","sqrt","variance"],createStd=factory(name$N,dependencies$N,v=>{var{typed:N,map:G,sqrt:z,variance:q}=v;return N(name$N,{"Array | Matrix":Y,"Array | Matrix, string":Y,"Array | Matrix, number | BigNumber":Y,"Array | Matrix, number | BigNumber, string":Y,"...":function(ie){return Y(ie)}});function Y(W,ie){if(W.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var ne=q.apply(null,arguments);return isCollection(ne)?G(ne,z):z(ne)}catch(se){throw se instanceof TypeError&&se.message.indexOf(" variance")!==-1?new TypeError(se.message.replace(" variance"," std")):se}}}),name$M="corr",dependencies$M=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],createCorr=factory(name$M,dependencies$M,v=>{var{typed:N,matrix:G,sqrt:z,sum:q,add:Y,subtract:W,multiply:ie,pow:ne,divide:se}=v;return N(name$M,{"Array, Array":function(ge,ve){return ae(ge,ve)},"Matrix, Matrix":function(ge,ve){var be=ae(ge.toArray(),ve.toArray());return Array.isArray(be)?G(be):be}});function ae(pe,ge){var ve=[];if(Array.isArray(pe[0])&&Array.isArray(ge[0])){if(pe.length!==ge.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var be=0;be<pe.length;be++){if(pe[be].length!==ge[be].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");ve.push(ce(pe[be],ge[be]))}return ve}else{if(pe.length!==ge.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return ce(pe,ge)}}function ce(pe,ge){var ve=pe.length,be=q(pe),Ee=q(ge),Pe=pe.reduce((qe,et,Ze)=>Y(qe,ie(et,ge[Ze])),0),Je=q(pe.map(qe=>ne(qe,2))),Ce=q(ge.map(qe=>ne(qe,2))),Ve=W(ie(ve,Pe),ie(be,Ee)),Re=z(ie(W(ie(ve,Je),ne(be,2)),W(ie(ve,Ce),ne(Ee,2))));return se(Ve,Re)}}),name$L="combinations",dependencies$L=["typed"],createCombinations=factory(name$L,dependencies$L,v=>{var{typed:N}=v;return N(name$L,{"number, number":combinationsNumber,"BigNumber, BigNumber":function(z,q){var Y=z.constructor,W,ie,ne=z.minus(q),se=new Y(1);if(!isPositiveInteger$2(z)||!isPositiveInteger$2(q))throw new TypeError("Positive integer value expected in function combinations");if(q.gt(z))throw new TypeError("k must be less than n in function combinations");if(W=se,q.lt(ne))for(ie=se;ie.lte(ne);ie=ie.plus(se))W=W.times(q.plus(ie)).dividedBy(ie);else for(ie=se;ie.lte(q);ie=ie.plus(se))W=W.times(ne.plus(ie)).dividedBy(ie);return W}})});function isPositiveInteger$2(v){return v.isInteger()&&v.gte(0)}var name$K="combinationsWithRep",dependencies$K=["typed"],createCombinationsWithRep=factory(name$K,dependencies$K,v=>{var{typed:N}=v;return N(name$K,{"number, number":function(z,q){if(!isInteger(z)||z<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!isInteger(q)||q<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(z<1)throw new TypeError("k must be less than or equal to n + k - 1");if(q<z-1){var Y=product(z,z+q-1);return Y/product(1,q)}var W=product(q+1,z+q-1);return W/product(1,z-1)},"BigNumber, BigNumber":function(z,q){var Y=z.constructor,W,ie,ne=new Y(1),se=z.minus(ne);if(!isPositiveInteger$1(z)||!isPositiveInteger$1(q))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(z.lt(ne))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(W=ne,q.lt(se))for(ie=ne;ie.lte(se);ie=ie.plus(ne))W=W.times(q.plus(ie)).dividedBy(ie);else for(ie=ne;ie.lte(q);ie=ie.plus(ne))W=W.times(se.plus(ie)).dividedBy(ie);return W}})});function isPositiveInteger$1(v){return v.isInteger()&&v.gte(0)}var name$J="gamma",dependencies$J=["typed","config","multiplyScalar","pow","BigNumber","Complex"],createGamma=factory(name$J,dependencies$J,v=>{var{typed:N,config:G,multiplyScalar:z,pow:q,BigNumber:Y,Complex:W}=v;function ie(se){if(se.im===0)return gammaNumber(se.re);if(se.re<.5){var ae=new W(1-se.re,-se.im),ce=new W(Math.PI*se.re,Math.PI*se.im);return new W(Math.PI).div(ce.sin()).div(ie(ae))}se=new W(se.re-1,se.im);for(var pe=new W(gammaP[0],0),ge=1;ge<gammaP.length;++ge){var ve=new W(gammaP[ge],0);pe=pe.add(ve.div(se.add(ge)))}var be=new W(se.re+gammaG+.5,se.im),Ee=Math.sqrt(2*Math.PI),Pe=be.pow(se.add(.5)),Je=be.neg().exp();return pe.mul(Ee).mul(Pe).mul(Je)}return N(name$J,{number:gammaNumber,Complex:ie,BigNumber:function(ae){if(ae.isInteger())return ae.isNegative()||ae.isZero()?new Y(1/0):ne(ae.minus(1));if(!ae.isFinite())return new Y(ae.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function ne(se){if(se<8)return new Y([1,1,2,6,24,120,720,5040][se]);var ae=G.precision+(Math.log(se.toNumber())|0),ce=Y.clone({precision:ae});if(se%2===1)return se.times(ne(new Y(se-1)));for(var pe=se,ge=new ce(se),ve=se.toNumber();pe>2;)pe-=2,ve+=pe,ge=ge.times(ve);return new Y(ge.toPrecision(Y.precision))}}),name$I="lgamma",dependencies$I=["Complex","typed"],createLgamma=factory(name$I,dependencies$I,v=>{var{Complex:N,typed:G}=v,z=7,q=7,Y=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return G(name$I,{number:lgammaNumber,Complex:W,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function W(se){var ae=6.283185307179586,ce=1.1447298858494002,pe=.1;if(se.isNaN())return new N(NaN,NaN);if(se.im===0)return new N(lgammaNumber(se.re),0);if(se.re>=z||Math.abs(se.im)>=q)return ie(se);if(se.re<=pe){var ge=copysign(ae,se.im)*Math.floor(.5*se.re+.25),ve=se.mul(Math.PI).sin().log(),be=W(new N(1-se.re,-se.im));return new N(ce,ge).sub(ve).sub(be)}else return se.im>=0?ne(se):ne(se.conjugate()).conjugate()}function ie(se){for(var ae=se.sub(.5).mul(se.log()).sub(se).add(lnSqrt2PI),ce=new N(1,0).div(se),pe=ce.div(se),ge=Y[0],ve=Y[1],be=2*pe.re,Ee=pe.re*pe.re+pe.im*pe.im,Pe=2;Pe<8;Pe++){var Je=ve;ve=-Ee*ge+Y[Pe],ge=be*ge+Je}var Ce=ce.mul(pe.mul(ge).add(ve));return ae.add(Ce)}function ne(se){var ae=0,ce=0,pe=se;for(se=se.add(1);se.re<=z;){pe=pe.mul(se);var ge=pe.im<0?1:0;ge!==0&&ce===0&&ae++,ce=ge,se=se.add(1)}return ie(se).sub(pe.log()).sub(new N(0,ae*2*Math.PI*1))}}),name$H="factorial",dependencies$H=["typed","gamma"],createFactorial=factory(name$H,dependencies$H,v=>{var{typed:N,gamma:G}=v;return N(name$H,{number:function(q){if(q<0)throw new Error("Value must be non-negative");return G(q+1)},BigNumber:function(q){if(q.isNegative())throw new Error("Value must be non-negative");return G(q.plus(1))},"Array | Matrix":N.referToSelf(z=>q=>deepMap(q,z))})}),name$G="kldivergence",dependencies$G=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],createKldivergence=factory(name$G,dependencies$G,v=>{var{typed:N,matrix:G,divide:z,sum:q,multiply:Y,map:W,dotDivide:ie,log:ne,isNumeric:se}=v;return N(name$G,{"Array, Array":function(pe,ge){return ae(G(pe),G(ge))},"Matrix, Array":function(pe,ge){return ae(pe,G(ge))},"Array, Matrix":function(pe,ge){return ae(G(pe),ge)},"Matrix, Matrix":function(pe,ge){return ae(pe,ge)}});function ae(ce,pe){var ge=pe.size().length,ve=ce.size().length;if(ge>1)throw new Error("first object must be one dimensional");if(ve>1)throw new Error("second object must be one dimensional");if(ge!==ve)throw new Error("Length of two vectors must be equal");var be=q(ce);if(be===0)throw new Error("Sum of elements in first object must be non zero");var Ee=q(pe);if(Ee===0)throw new Error("Sum of elements in second object must be non zero");var Pe=z(ce,q(ce)),Je=z(pe,q(pe)),Ce=q(Y(Pe,W(ie(Pe,Je),Ve=>ne(Ve))));return se(Ce)?Ce:Number.NaN}}),name$F="multinomial",dependencies$F=["typed","add","divide","multiply","factorial","isInteger","isPositive"],createMultinomial=factory(name$F,dependencies$F,v=>{var{typed:N,add:G,divide:z,multiply:q,factorial:Y,isInteger:W,isPositive:ie}=v;return N(name$F,{"Array | Matrix":function(se){var ae=0,ce=1;return deepForEach(se,function(pe){if(!W(pe)||!ie(pe))throw new TypeError("Positive integer value expected in function multinomial");ae=G(ae,pe),ce=q(ce,Y(pe))}),z(Y(ae),ce)}})}),name$E="permutations",dependencies$E=["typed","factorial"],createPermutations=factory(name$E,dependencies$E,v=>{var{typed:N,factorial:G}=v;return N(name$E,{"number | BigNumber":G,"number, number":function(q,Y){if(!isInteger(q)||q<0)throw new TypeError("Positive integer value expected in function permutations");if(!isInteger(Y)||Y<0)throw new TypeError("Positive integer value expected in function permutations");if(Y>q)throw new TypeError("second argument k must be less than or equal to first argument n");return product(q-Y+1,q)},"BigNumber, BigNumber":function(q,Y){var W,ie;if(!isPositiveInteger(q)||!isPositiveInteger(Y))throw new TypeError("Positive integer value expected in function permutations");if(Y.gt(q))throw new TypeError("second argument k must be less than or equal to first argument n");var ne=q.mul(0).add(1);for(W=ne,ie=q.minus(Y).plus(1);ie.lte(q);ie=ie.plus(1))W=W.times(ie);return W}})});function isPositiveInteger(v){return v.isInteger()&&v.gte(0)}var alea$1={exports:{}},alea=alea$1.exports,hasRequiredAlea;function requireAlea(){return hasRequiredAlea||(hasRequiredAlea=1,function(v){(function(N,G,z){function q(ne){var se=this,ae=ie();se.next=function(){var ce=2091639*se.s0+se.c*23283064365386963e-26;return se.s0=se.s1,se.s1=se.s2,se.s2=ce-(se.c=ce|0)},se.c=1,se.s0=ae(" "),se.s1=ae(" "),se.s2=ae(" "),se.s0-=ae(ne),se.s0<0&&(se.s0+=1),se.s1-=ae(ne),se.s1<0&&(se.s1+=1),se.s2-=ae(ne),se.s2<0&&(se.s2+=1),ae=null}function Y(ne,se){return se.c=ne.c,se.s0=ne.s0,se.s1=ne.s1,se.s2=ne.s2,se}function W(ne,se){var ae=new q(ne),ce=se&&se.state,pe=ae.next;return pe.int32=function(){return ae.next()*4294967296|0},pe.double=function(){return pe()+(pe()*2097152|0)*11102230246251565e-32},pe.quick=pe,ce&&(typeof ce=="object"&&Y(ce,ae),pe.state=function(){return Y(ae,{})}),pe}function ie(){var ne=4022871197,se=function(ae){ae=String(ae);for(var ce=0;ce<ae.length;ce++){ne+=ae.charCodeAt(ce);var pe=.02519603282416938*ne;ne=pe>>>0,pe-=ne,pe*=ne,ne=pe>>>0,pe-=ne,ne+=pe*4294967296}return(ne>>>0)*23283064365386963e-26};return se}G&&G.exports?G.exports=W:this.alea=W})(alea,v)}(alea$1)),alea$1.exports}var xor128$1={exports:{}},xor128=xor128$1.exports,hasRequiredXor128;function requireXor128(){return hasRequiredXor128||(hasRequiredXor128=1,function(v){(function(N,G,z){function q(ie){var ne=this,se="";ne.x=0,ne.y=0,ne.z=0,ne.w=0,ne.next=function(){var ce=ne.x^ne.x<<11;return ne.x=ne.y,ne.y=ne.z,ne.z=ne.w,ne.w^=ne.w>>>19^ce^ce>>>8},ie===(ie|0)?ne.x=ie:se+=ie;for(var ae=0;ae<se.length+64;ae++)ne.x^=se.charCodeAt(ae)|0,ne.next()}function Y(ie,ne){return ne.x=ie.x,ne.y=ie.y,ne.z=ie.z,ne.w=ie.w,ne}function W(ie,ne){var se=new q(ie),ae=ne&&ne.state,ce=function(){return(se.next()>>>0)/4294967296};return ce.double=function(){do var pe=se.next()>>>11,ge=(se.next()>>>0)/4294967296,ve=(pe+ge)/(1<<21);while(ve===0);return ve},ce.int32=se.next,ce.quick=ce,ae&&(typeof ae=="object"&&Y(ae,se),ce.state=function(){return Y(se,{})}),ce}G&&G.exports?G.exports=W:this.xor128=W})(xor128,v)}(xor128$1)),xor128$1.exports}var xorwow$1={exports:{}},xorwow=xorwow$1.exports,hasRequiredXorwow;function requireXorwow(){return hasRequiredXorwow||(hasRequiredXorwow=1,function(v){(function(N,G,z){function q(ie){var ne=this,se="";ne.next=function(){var ce=ne.x^ne.x>>>2;return ne.x=ne.y,ne.y=ne.z,ne.z=ne.w,ne.w=ne.v,(ne.d=ne.d+362437|0)+(ne.v=ne.v^ne.v<<4^(ce^ce<<1))|0},ne.x=0,ne.y=0,ne.z=0,ne.w=0,ne.v=0,ie===(ie|0)?ne.x=ie:se+=ie;for(var ae=0;ae<se.length+64;ae++)ne.x^=se.charCodeAt(ae)|0,ae==se.length&&(ne.d=ne.x<<10^ne.x>>>4),ne.next()}function Y(ie,ne){return ne.x=ie.x,ne.y=ie.y,ne.z=ie.z,ne.w=ie.w,ne.v=ie.v,ne.d=ie.d,ne}function W(ie,ne){var se=new q(ie),ae=ne&&ne.state,ce=function(){return(se.next()>>>0)/4294967296};return ce.double=function(){do var pe=se.next()>>>11,ge=(se.next()>>>0)/4294967296,ve=(pe+ge)/(1<<21);while(ve===0);return ve},ce.int32=se.next,ce.quick=ce,ae&&(typeof ae=="object"&&Y(ae,se),ce.state=function(){return Y(se,{})}),ce}G&&G.exports?G.exports=W:this.xorwow=W})(xorwow,v)}(xorwow$1)),xorwow$1.exports}var xorshift7$1={exports:{}},xorshift7=xorshift7$1.exports,hasRequiredXorshift7;function requireXorshift7(){return hasRequiredXorshift7||(hasRequiredXorshift7=1,function(v){(function(N,G,z){function q(ie){var ne=this;ne.next=function(){var ae=ne.x,ce=ne.i,pe,ge;return pe=ae[ce],pe^=pe>>>7,ge=pe^pe<<24,pe=ae[ce+1&7],ge^=pe^pe>>>10,pe=ae[ce+3&7],ge^=pe^pe>>>3,pe=ae[ce+4&7],ge^=pe^pe<<7,pe=ae[ce+7&7],pe=pe^pe<<13,ge^=pe^pe<<9,ae[ce]=ge,ne.i=ce+1&7,ge};function se(ae,ce){var pe,ge=[];if(ce===(ce|0))ge[0]=ce;else for(ce=""+ce,pe=0;pe<ce.length;++pe)ge[pe&7]=ge[pe&7]<<15^ce.charCodeAt(pe)+ge[pe+1&7]<<13;for(;ge.length<8;)ge.push(0);for(pe=0;pe<8&&ge[pe]===0;++pe);for(pe==8?ge[7]=-1:ge[pe],ae.x=ge,ae.i=0,pe=256;pe>0;--pe)ae.next()}se(ne,ie)}function Y(ie,ne){return ne.x=ie.x.slice(),ne.i=ie.i,ne}function W(ie,ne){ie==null&&(ie=+new Date);var se=new q(ie),ae=ne&&ne.state,ce=function(){return(se.next()>>>0)/4294967296};return ce.double=function(){do var pe=se.next()>>>11,ge=(se.next()>>>0)/4294967296,ve=(pe+ge)/(1<<21);while(ve===0);return ve},ce.int32=se.next,ce.quick=ce,ae&&(ae.x&&Y(ae,se),ce.state=function(){return Y(se,{})}),ce}G&&G.exports?G.exports=W:this.xorshift7=W})(xorshift7,v)}(xorshift7$1)),xorshift7$1.exports}var xor4096$1={exports:{}},xor4096=xor4096$1.exports,hasRequiredXor4096;function requireXor4096(){return hasRequiredXor4096||(hasRequiredXor4096=1,function(v){(function(N,G,z){function q(ie){var ne=this;ne.next=function(){var ae=ne.w,ce=ne.X,pe=ne.i,ge,ve;return ne.w=ae=ae+1640531527|0,ve=ce[pe+34&127],ge=ce[pe=pe+1&127],ve^=ve<<13,ge^=ge<<17,ve^=ve>>>15,ge^=ge>>>12,ve=ce[pe]=ve^ge,ne.i=pe,ve+(ae^ae>>>16)|0};function se(ae,ce){var pe,ge,ve,be,Ee,Pe=[],Je=128;for(ce===(ce|0)?(ge=ce,ce=null):(ce=ce+"\0",ge=0,Je=Math.max(Je,ce.length)),ve=0,be=-32;be<Je;++be)ce&&(ge^=ce.charCodeAt((be+32)%ce.length)),be===0&&(Ee=ge),ge^=ge<<10,ge^=ge>>>15,ge^=ge<<4,ge^=ge>>>13,be>=0&&(Ee=Ee+1640531527|0,pe=Pe[be&127]^=ge+Ee,ve=pe==0?ve+1:0);for(ve>=128&&(Pe[(ce&&ce.length||0)&127]=-1),ve=127,be=4*128;be>0;--be)ge=Pe[ve+34&127],pe=Pe[ve=ve+1&127],ge^=ge<<13,pe^=pe<<17,ge^=ge>>>15,pe^=pe>>>12,Pe[ve]=ge^pe;ae.w=Ee,ae.X=Pe,ae.i=ve}se(ne,ie)}function Y(ie,ne){return ne.i=ie.i,ne.w=ie.w,ne.X=ie.X.slice(),ne}function W(ie,ne){ie==null&&(ie=+new Date);var se=new q(ie),ae=ne&&ne.state,ce=function(){return(se.next()>>>0)/4294967296};return ce.double=function(){do var pe=se.next()>>>11,ge=(se.next()>>>0)/4294967296,ve=(pe+ge)/(1<<21);while(ve===0);return ve},ce.int32=se.next,ce.quick=ce,ae&&(ae.X&&Y(ae,se),ce.state=function(){return Y(se,{})}),ce}G&&G.exports?G.exports=W:this.xor4096=W})(xor4096,v)}(xor4096$1)),xor4096$1.exports}var tychei$1={exports:{}},tychei=tychei$1.exports,hasRequiredTychei;function requireTychei(){return hasRequiredTychei||(hasRequiredTychei=1,function(v){(function(N,G,z){function q(ie){var ne=this,se="";ne.next=function(){var ce=ne.b,pe=ne.c,ge=ne.d,ve=ne.a;return ce=ce<<25^ce>>>7^pe,pe=pe-ge|0,ge=ge<<24^ge>>>8^ve,ve=ve-ce|0,ne.b=ce=ce<<20^ce>>>12^pe,ne.c=pe=pe-ge|0,ne.d=ge<<16^pe>>>16^ve,ne.a=ve-ce|0},ne.a=0,ne.b=0,ne.c=-1640531527,ne.d=1367130551,ie===Math.floor(ie)?(ne.a=ie/4294967296|0,ne.b=ie|0):se+=ie;for(var ae=0;ae<se.length+20;ae++)ne.b^=se.charCodeAt(ae)|0,ne.next()}function Y(ie,ne){return ne.a=ie.a,ne.b=ie.b,ne.c=ie.c,ne.d=ie.d,ne}function W(ie,ne){var se=new q(ie),ae=ne&&ne.state,ce=function(){return(se.next()>>>0)/4294967296};return ce.double=function(){do var pe=se.next()>>>11,ge=(se.next()>>>0)/4294967296,ve=(pe+ge)/(1<<21);while(ve===0);return ve},ce.int32=se.next,ce.quick=ce,ae&&(typeof ae=="object"&&Y(ae,se),ce.state=function(){return Y(se,{})}),ce}G&&G.exports?G.exports=W:this.tychei=W})(tychei,v)}(tychei$1)),tychei$1.exports}var seedrandom$3={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(__viteBrowserExternal$1);var seedrandom$2=seedrandom$3.exports,hasRequiredSeedrandom$1;function requireSeedrandom$1(){return hasRequiredSeedrandom$1||(hasRequiredSeedrandom$1=1,function(v){(function(N,G,z){var q=256,Y=6,W=52,ie="random",ne=z.pow(q,Y),se=z.pow(2,W),ae=se*2,ce=q-1,pe;function ge(Ve,Re,qe){var et=[];Re=Re==!0?{entropy:!0}:Re||{};var Ze=Pe(Ee(Re.entropy?[Ve,Ce(G)]:Ve??Je(),3),et),tt=new ve(et),Ke=function(){for(var rt=tt.g(Y),it=ne,ot=0;rt<se;)rt=(rt+ot)*q,it*=q,ot=tt.g(1);for(;rt>=ae;)rt/=2,it/=2,ot>>>=1;return(rt+ot)/it};return Ke.int32=function(){return tt.g(4)|0},Ke.quick=function(){return tt.g(4)/4294967296},Ke.double=Ke,Pe(Ce(tt.S),G),(Re.pass||qe||function(rt,it,ot,ut){return ut&&(ut.S&&be(ut,tt),rt.state=function(){return be(tt,{})}),ot?(z[ie]=rt,it):rt})(Ke,Ze,"global"in Re?Re.global:this==z,Re.state)}function ve(Ve){var Re,qe=Ve.length,et=this,Ze=0,tt=et.i=et.j=0,Ke=et.S=[];for(qe||(Ve=[qe++]);Ze<q;)Ke[Ze]=Ze++;for(Ze=0;Ze<q;Ze++)Ke[Ze]=Ke[tt=ce&tt+Ve[Ze%qe]+(Re=Ke[Ze])],Ke[tt]=Re;(et.g=function(rt){for(var it,ot=0,ut=et.i,ct=et.j,at=et.S;rt--;)it=at[ut=ce&ut+1],ot=ot*q+at[ce&(at[ut]=at[ct=ce&ct+it])+(at[ct]=it)];return et.i=ut,et.j=ct,ot})(q)}function be(Ve,Re){return Re.i=Ve.i,Re.j=Ve.j,Re.S=Ve.S.slice(),Re}function Ee(Ve,Re){var qe=[],et=typeof Ve,Ze;if(Re&&et=="object")for(Ze in Ve)try{qe.push(Ee(Ve[Ze],Re-1))}catch{}return qe.length?qe:et=="string"?Ve:Ve+"\0"}function Pe(Ve,Re){for(var qe=Ve+"",et,Ze=0;Ze<qe.length;)Re[ce&Ze]=ce&(et^=Re[ce&Ze]*19)+qe.charCodeAt(Ze++);return Ce(Re)}function Je(){try{var Ve;return pe&&(Ve=pe.randomBytes)?Ve=Ve(q):(Ve=new Uint8Array(q),(N.crypto||N.msCrypto).getRandomValues(Ve)),Ce(Ve)}catch{var Re=N.navigator,qe=Re&&Re.plugins;return[+new Date,N,qe,N.screen,Ce(G)]}}function Ce(Ve){return String.fromCharCode.apply(0,Ve)}if(Pe(z.random(),G),v.exports){v.exports=ge;try{pe=require$$0}catch{}}else z["seed"+ie]=ge})(typeof self<"u"?self:seedrandom$2,[],Math)}(seedrandom$3)),seedrandom$3.exports}var seedrandom$1,hasRequiredSeedrandom;function requireSeedrandom(){if(hasRequiredSeedrandom)return seedrandom$1;hasRequiredSeedrandom=1;var v=requireAlea(),N=requireXor128(),G=requireXorwow(),z=requireXorshift7(),q=requireXor4096(),Y=requireTychei(),W=requireSeedrandom$1();return W.alea=v,W.xor128=N,W.xorwow=G,W.xorshift7=z,W.xor4096=q,W.tychei=Y,seedrandom$1=W,seedrandom$1}var seedrandomExports=requireSeedrandom();const seedrandom=getDefaultExportFromCjs(seedrandomExports);var singletonRandom=seedrandom(Date.now());function createRng(v){var N;function G(q){N=q===null?singletonRandom:seedrandom(String(q))}G(v);function z(){return N()}return z}var name$D="pickRandom",dependencies$D=["typed","config","?on"],createPickRandom=factory(name$D,dependencies$D,v=>{var{typed:N,config:G,on:z}=v,q=createRng(G.randomSeed);return z&&z("config",function(W,ie){W.randomSeed!==ie.randomSeed&&(q=createRng(W.randomSeed))}),N(name$D,{"Array | Matrix":function(ie){return Y(ie,{})},"Array | Matrix, Object":function(ie,ne){return Y(ie,ne)},"Array | Matrix, number":function(ie,ne){return Y(ie,{number:ne})},"Array | Matrix, Array | Matrix":function(ie,ne){return Y(ie,{weights:ne})},"Array | Matrix, Array | Matrix, number":function(ie,ne,se){return Y(ie,{number:se,weights:ne})},"Array | Matrix, number, Array | Matrix":function(ie,ne,se){return Y(ie,{number:ne,weights:se})}});function Y(W,ie){var{number:ne,weights:se,elementWise:ae=!0}=ie,ce=typeof ne>"u";ce&&(ne=1);var pe=isMatrix(W)?W.create:isMatrix(se)?se.create:null;W=W.valueOf(),se&&(se=se.valueOf()),ae===!0&&(W=flatten(W),se=flatten(se));var ge=0;if(typeof se<"u"){if(se.length!==W.length)throw new Error("Weights must have the same length as possibles");for(var ve=0,be=se.length;ve<be;ve++){if(!isNumber(se[ve])||se[ve]<0)throw new Error("Weights must be an array of positive numbers");ge+=se[ve]}}for(var Ee=W.length,Pe=[],Je;Pe.length<ne;){if(typeof se>"u")Je=W[Math.floor(q()*Ee)];else for(var Ce=q()*ge,Ve=0,Re=W.length;Ve<Re;Ve++)if(Ce-=se[Ve],Ce<0){Je=W[Ve];break}Pe.push(Je)}return ce?Pe[0]:pe?pe(Pe):Pe}});function randomMatrix(v,N){var G=[];if(v=v.slice(0),v.length>1)for(var z=0,q=v.shift();z<q;z++)G.push(randomMatrix(v,N));else for(var Y=0,W=v.shift();Y<W;Y++)G.push(N());return G}var name$C="random",dependencies$C=["typed","config","?on"],createRandom=factory(name$C,dependencies$C,v=>{var{typed:N,config:G,on:z}=v,q=createRng(G.randomSeed);return z&&z("config",function(ie,ne){ie.randomSeed!==ne.randomSeed&&(q=createRng(ie.randomSeed))}),N(name$C,{"":()=>W(0,1),number:ie=>W(0,ie),"number, number":(ie,ne)=>W(ie,ne),"Array | Matrix":ie=>Y(ie,0,1),"Array | Matrix, number":(ie,ne)=>Y(ie,0,ne),"Array | Matrix, number, number":(ie,ne,se)=>Y(ie,ne,se)});function Y(ie,ne,se){var ae=randomMatrix(ie.valueOf(),()=>W(ne,se));return isMatrix(ie)?ie.create(ae):ae}function W(ie,ne){return ie+q()*(ne-ie)}}),name$B="randomInt",dependencies$B=["typed","config","?on"],createRandomInt=factory(name$B,dependencies$B,v=>{var{typed:N,config:G,on:z}=v,q=createRng(G.randomSeed);return z&&z("config",function(ie,ne){ie.randomSeed!==ne.randomSeed&&(q=createRng(ie.randomSeed))}),N(name$B,{"":()=>W(0,1),number:ie=>W(0,ie),"number, number":(ie,ne)=>W(ie,ne),"Array | Matrix":ie=>Y(ie,0,1),"Array | Matrix, number":(ie,ne)=>Y(ie,0,ne),"Array | Matrix, number, number":(ie,ne,se)=>Y(ie,ne,se)});function Y(ie,ne,se){var ae=randomMatrix(ie.valueOf(),()=>W(ne,se));return isMatrix(ie)?ie.create(ae):ae}function W(ie,ne){return Math.floor(ie+q()*(ne-ie))}}),name$A="stirlingS2",dependencies$A=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],createStirlingS2=factory(name$A,dependencies$A,v=>{var{typed:N,addScalar:G,subtractScalar:z,multiplyScalar:q,divideScalar:Y,pow:W,factorial:ie,combinations:ne,isNegative:se,isInteger:ae,number:ce,bignumber:pe,larger:ge}=v,ve=[],be=[];return N(name$A,{"number | BigNumber, number | BigNumber":function(Pe,Je){if(!ae(Pe)||se(Pe)||!ae(Je)||se(Je))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(ge(Je,Pe))throw new TypeError("k must be less than or equal to n in function stirlingS2");var Ce=!(isNumber(Pe)&&isNumber(Je)),Ve=Ce?be:ve,Re=Ce?pe:ce,qe=ce(Pe),et=ce(Je);if(Ve[qe]&&Ve[qe].length>et)return Ve[qe][et];for(var Ze=0;Ze<=qe;++Ze)if(Ve[Ze]||(Ve[Ze]=[Re(Ze===0?1:0)]),Ze!==0)for(var tt=Ve[Ze],Ke=Ve[Ze-1],rt=tt.length;rt<=Ze&&rt<=et;++rt)rt===Ze?tt[rt]=1:tt[rt]=G(q(Re(rt),Ke[rt]),Ke[rt-1]);return Ve[qe][et]}})}),name$z="bellNumbers",dependencies$z=["typed","addScalar","isNegative","isInteger","stirlingS2"],createBellNumbers=factory(name$z,dependencies$z,v=>{var{typed:N,addScalar:G,isNegative:z,isInteger:q,stirlingS2:Y}=v;return N(name$z,{"number | BigNumber":function(ie){if(!q(ie)||z(ie))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var ne=0,se=0;se<=ie;se++)ne=G(ne,Y(ie,se));return ne}})}),name$y="catalan",dependencies$y=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],createCatalan=factory(name$y,dependencies$y,v=>{var{typed:N,addScalar:G,divideScalar:z,multiplyScalar:q,combinations:Y,isNegative:W,isInteger:ie}=v;return N(name$y,{"number | BigNumber":function(se){if(!ie(se)||W(se))throw new TypeError("Non-negative integer value expected in function catalan");return z(Y(q(se,2),se),G(se,1))}})}),name$x="composition",dependencies$x=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],createComposition=factory(name$x,dependencies$x,v=>{var{typed:N,addScalar:G,combinations:z,isPositive:q,isNegative:Y,isInteger:W,larger:ie}=v;return N(name$x,{"number | BigNumber, number | BigNumber":function(se,ae){if(!W(se)||!q(se)||!W(ae)||!q(ae))throw new TypeError("Positive integer value expected in function composition");if(ie(ae,se))throw new TypeError("k must be less than or equal to n in function composition");return z(G(se,-1),G(ae,-1))}})}),name$w="leafCount",dependencies$w=["parse","typed"],createLeafCount=factory(name$w,dependencies$w,v=>{var{parse:N,typed:G}=v;function z(q){var Y=0;return q.forEach(W=>{Y+=z(W)}),Y||1}return G(name$w,{Node:function(Y){return z(Y)}})});function isNumericNode(v){return isConstantNode(v)||isOperatorNode(v)&&v.isUnary()&&isConstantNode(v.args[0])}function isConstantExpression(v){return!!(isConstantNode(v)||(isFunctionNode(v)||isOperatorNode(v))&&v.args.every(isConstantExpression)||isParenthesisNode(v)&&isConstantExpression(v.content))}function ownKeys(v,N){var G=Object.keys(v);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(v);N&&(z=z.filter(function(q){return Object.getOwnPropertyDescriptor(v,q).enumerable})),G.push.apply(G,z)}return G}function _objectSpread(v){for(var N=1;N<arguments.length;N++){var G=arguments[N]!=null?arguments[N]:{};N%2?ownKeys(Object(G),!0).forEach(function(z){_defineProperty(v,z,G[z])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(G)):ownKeys(Object(G)).forEach(function(z){Object.defineProperty(v,z,Object.getOwnPropertyDescriptor(G,z))})}return v}var name$v="simplifyUtil",dependencies$v=["FunctionNode","OperatorNode","SymbolNode"],createUtil=factory(name$v,dependencies$v,v=>{var{FunctionNode:N,OperatorNode:G,SymbolNode:z}=v,q=!0,Y=!1,W="defaultF",ie={add:{trivial:q,total:q,commutative:q,associative:q},unaryPlus:{trivial:q,total:q,commutative:q,associative:q},subtract:{trivial:Y,total:q,commutative:Y,associative:Y},multiply:{trivial:q,total:q,commutative:q,associative:q},divide:{trivial:Y,total:q,commutative:Y,associative:Y},paren:{trivial:q,total:q,commutative:q,associative:Y},defaultF:{trivial:Y,total:q,commutative:Y,associative:Y}},ne={divide:{total:Y},log:{total:Y}},se={subtract:{total:Y},abs:{trivial:q},log:{total:q}};function ae(Ce,Ve){var Re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ie,qe=W;if(typeof Ce=="string"?qe=Ce:isOperatorNode(Ce)?qe=Ce.fn.toString():isFunctionNode(Ce)?qe=Ce.name:isParenthesisNode(Ce)&&(qe="paren"),hasOwnProperty(Re,qe)){var et=Re[qe];if(hasOwnProperty(et,Ve))return et[Ve];if(hasOwnProperty(ie,qe))return ie[qe][Ve]}if(hasOwnProperty(Re,W)){var Ze=Re[W];return hasOwnProperty(Ze,Ve)?Ze[Ve]:ie[W][Ve]}if(hasOwnProperty(ie,qe)){var tt=ie[qe];if(hasOwnProperty(tt,Ve))return tt[Ve]}return ie[W][Ve]}function ce(Ce){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ie;return ae(Ce,"commutative",Ve)}function pe(Ce){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ie;return ae(Ce,"associative",Ve)}function ge(Ce,Ve){var Re=_objectSpread({},Ce);for(var qe in Ve)hasOwnProperty(Ce,qe)?Re[qe]=_objectSpread(_objectSpread({},Ve[qe]),Ce[qe]):Re[qe]=Ve[qe];return Re}function ve(Ce,Ve){if(!Ce.args||Ce.args.length===0)return Ce;Ce.args=be(Ce,Ve);for(var Re=0;Re<Ce.args.length;Re++)ve(Ce.args[Re],Ve)}function be(Ce,Ve){var Re,qe=[],et=function Ze(tt){for(var Ke=0;Ke<tt.args.length;Ke++){var rt=tt.args[Ke];isOperatorNode(rt)&&Re===rt.op?Ze(rt):qe.push(rt)}};return pe(Ce,Ve)?(Re=Ce.op,et(Ce),qe):Ce.args}function Ee(Ce,Ve){if(!(!Ce.args||Ce.args.length===0)){for(var Re=Je(Ce),qe=Ce.args.length,et=0;et<qe;et++)Ee(Ce.args[et],Ve);if(qe>2&&pe(Ce,Ve)){for(var Ze=Ce.args.pop();Ce.args.length>0;)Ze=Re([Ce.args.pop(),Ze]);Ce.args=Ze.args}}}function Pe(Ce,Ve){if(!(!Ce.args||Ce.args.length===0)){for(var Re=Je(Ce),qe=Ce.args.length,et=0;et<qe;et++)Pe(Ce.args[et],Ve);if(qe>2&&pe(Ce,Ve)){for(var Ze=Ce.args.shift();Ce.args.length>0;)Ze=Re([Ze,Ce.args.shift()]);Ce.args=Ze.args}}}function Je(Ce){return isOperatorNode(Ce)?function(Ve){try{return new G(Ce.op,Ce.fn,Ve,Ce.implicit)}catch(Re){return console.error(Re),[]}}:function(Ve){return new N(new z(Ce.name),Ve)}}return{createMakeNodeFunction:Je,hasProperty:ae,isCommutative:ce,isAssociative:pe,mergeContext:ge,flatten:ve,allChildren:be,unflattenr:Ee,unflattenl:Pe,defaultContext:ie,realContext:ne,positiveContext:se}}),name$u="simplify",dependencies$u=["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"],createSimplify=factory(name$u,dependencies$u,v=>{var{config:N,typed:G,parse:z,add:q,subtract:Y,multiply:W,divide:ie,pow:ne,isZero:se,equal:ae,resolve:ce,simplifyConstant:pe,simplifyCore:ge,fraction:ve,bignumber:be,mathWithTransform:Ee,matrix:Pe,AccessorNode:Je,ArrayNode:Ce,ConstantNode:Ve,FunctionNode:Re,IndexNode:qe,ObjectNode:et,OperatorNode:Ze,ParenthesisNode:tt,SymbolNode:Ke}=v,{hasProperty:rt,isCommutative:it,isAssociative:ot,mergeContext:ut,flatten:ct,unflattenr:at,unflattenl:st,createMakeNodeFunction:pt,defaultContext:lt,realContext:vt,positiveContext:dt}=createUtil({FunctionNode:Re,OperatorNode:Ze,SymbolNode:Ke});G.addConversion({from:"Object",to:"Map",convert:createMap$1});var xt=G("simplify",{Node:It,"Node, Map":(At,$t)=>It(At,!1,$t),"Node, Map, Object":(At,$t,Pt)=>It(At,!1,$t,Pt),"Node, Array":It,"Node, Array, Map":It,"Node, Array, Map, Object":It});G.removeConversion({from:"Object",to:"Map",convert:createMap$1}),xt.defaultContext=lt,xt.realContext=vt,xt.positiveContext=dt;function ft(At){return At.transform(function($t,Pt,kt){return isParenthesisNode($t)?ft($t.content):$t})}var Et={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};xt.rules=[ge,{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}}},pe,{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}}},pe,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ct(At,$t){var Pt={};if(At.s){var kt=At.s.split("->");if(kt.length===2)Pt.l=kt[0],Pt.r=kt[1];else throw SyntaxError("Could not parse rule: "+At.s)}else Pt.l=At.l,Pt.r=At.r;Pt.l=ft(z(Pt.l)),Pt.r=ft(z(Pt.r));for(var jt of["imposeContext","repeat","assuming"])jt in At&&(Pt[jt]=At[jt]);if(At.evaluate&&(Pt.evaluate=z(At.evaluate)),ot(Pt.l,$t)){var wt=!it(Pt.l,$t),Mt;wt&&(Mt=Ot());var Tt=pt(Pt.l),Rt=Ot();Pt.expanded={},Pt.expanded.l=Tt([Pt.l,Rt]),ct(Pt.expanded.l,$t),at(Pt.expanded.l,$t),Pt.expanded.r=Tt([Pt.r,Rt]),wt&&(Pt.expandedNC1={},Pt.expandedNC1.l=Tt([Mt,Pt.l]),Pt.expandedNC1.r=Tt([Mt,Pt.r]),Pt.expandedNC2={},Pt.expandedNC2.l=Tt([Mt,Pt.expanded.l]),Pt.expandedNC2.r=Tt([Mt,Pt.expanded.r]))}return Pt}function Dt(At,$t){for(var Pt=[],kt=0;kt<At.length;kt++){var jt=At[kt],wt=void 0,Mt=typeof jt;switch(Mt){case"string":jt={s:jt};case"object":wt=Ct(jt,$t);break;case"function":wt=jt;break;default:throw TypeError("Unsupported type of rule: "+Mt)}Pt.push(wt)}return Pt}var Gt=0;function Ot(){return new Ke("_p"+Gt++)}function It(At,$t){var Pt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:createEmptyMap(),kt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},jt=kt.consoleDebug;$t=Dt($t||xt.rules,kt.context);var wt=ce(At,Pt);wt=ft(wt);for(var Mt={},Tt=wt.toString({parenthesis:"all"});!Mt[Tt];){Mt[Tt]=!0,Gt=0;var Rt=Tt;jt&&console.log("Working on: ",Tt);for(var Ft=0;Ft<$t.length;Ft++){var Ut="";if(typeof $t[Ft]=="function"?(wt=$t[Ft](wt,kt),jt&&(Ut=$t[Ft].name)):(ct(wt,kt.context),wt=Ht(wt,$t[Ft],kt.context),jt&&(Ut="".concat($t[Ft].l.toString()," -> ").concat($t[Ft].r.toString()))),jt){var Zt=wt.toString({parenthesis:"all"});Zt!==Rt&&(console.log("Applying",Ut,"produced",Zt),Rt=Zt)}st(wt,kt.context)}Tt=wt.toString({parenthesis:"all"})}return wt}function Bt(At,$t,Pt){var kt=At;if(At)for(var jt=0;jt<At.length;++jt){var wt=Ht(At[jt],$t,Pt);wt!==At[jt]&&(kt===At&&(kt=At.slice()),kt[jt]=wt)}return kt}function Ht(At,$t,Pt){if($t.assuming){for(var kt in $t.assuming)for(var jt in $t.assuming[kt])if(rt(kt,jt,Pt)!==$t.assuming[kt][jt])return At}var wt=ut($t.imposeContext,Pt),Mt=At;if(Mt instanceof Ze||Mt instanceof Re){var Tt=Bt(Mt.args,$t,Pt);Tt!==Mt.args&&(Mt=Mt.clone(),Mt.args=Tt)}else if(Mt instanceof tt){if(Mt.content){var Rt=Ht(Mt.content,$t,Pt);Rt!==Mt.content&&(Mt=new tt(Rt))}}else if(Mt instanceof Ce){var Ft=Bt(Mt.items,$t,Pt);Ft!==Mt.items&&(Mt=new Ce(Ft))}else if(Mt instanceof Je){var Ut=Mt.object;Mt.object&&(Ut=Ht(Mt.object,$t,Pt));var Zt=Mt.index;Mt.index&&(Zt=Ht(Mt.index,$t,Pt)),(Ut!==Mt.object||Zt!==Mt.index)&&(Mt=new Je(Ut,Zt))}else if(Mt instanceof qe){var Wt=Bt(Mt.dimensions,$t,Pt);Wt!==Mt.dimensions&&(Mt=new qe(Wt))}else if(Mt instanceof et){var qt=!1,Yt={};for(var or in Mt.properties)Yt[or]=Ht(Mt.properties[or],$t,Pt),Yt[or]!==Mt.properties[or]&&(qt=!0);qt&&(Mt=new et(Yt))}var hr=$t.r,sr=_t($t.l,Mt,wt)[0];if(!sr&&$t.expanded&&(hr=$t.expanded.r,sr=_t($t.expanded.l,Mt,wt)[0]),!sr&&$t.expandedNC1&&(hr=$t.expandedNC1.r,sr=_t($t.expandedNC1.l,Mt,wt)[0],sr||(hr=$t.expandedNC2.r,sr=_t($t.expandedNC2.l,Mt,wt)[0])),sr){var nr=Mt.implicit;Mt=hr.clone(),nr&&"implicit"in hr&&(Mt.implicit=!0),Mt=Mt.transform(function(gt){return gt.isSymbolNode&&hasOwnProperty(sr.placeholders,gt.name)?sr.placeholders[gt.name].clone():gt})}return $t.repeat&&Mt!==At&&(Mt=Ht(Mt,$t,Pt)),Mt}function ir(At,$t){var Pt=[],kt,jt,wt=pt(At);if(it(At,$t))for(var Mt=0;Mt<At.args.length;Mt++)jt=At.args.slice(0),jt.splice(Mt,1),kt=jt.length===1?jt[0]:wt(jt),Pt.push(wt([At.args[Mt],kt]));else for(var Tt=1;Tt<At.args.length;Tt++){var Rt=At.args[0];Tt>1&&(Rt=wt(At.args.slice(0,Tt))),jt=At.args.slice(Tt),kt=jt.length===1?jt[0]:wt(jt),Pt.push(wt([Rt,kt]))}return Pt}function zt(At,$t){var Pt={placeholders:{}};if(!At.placeholders&&!$t.placeholders)return Pt;if(At.placeholders){if(!$t.placeholders)return At}else return $t;for(var kt in At.placeholders)if(hasOwnProperty(At.placeholders,kt)&&(Pt.placeholders[kt]=At.placeholders[kt],hasOwnProperty($t.placeholders,kt)&&!Xt(At.placeholders[kt],$t.placeholders[kt])))return null;for(var jt in $t.placeholders)hasOwnProperty($t.placeholders,jt)&&(Pt.placeholders[jt]=$t.placeholders[jt]);return Pt}function tr(At,$t){var Pt=[];if(At.length===0||$t.length===0)return Pt;for(var kt,jt=0;jt<At.length;jt++)for(var wt=0;wt<$t.length;wt++)kt=zt(At[jt],$t[wt]),kt&&Pt.push(kt);return Pt}function bt(At){if(At.length===0)return At;for(var $t=At.reduce(tr),Pt=[],kt={},jt=0;jt<$t.length;jt++){var wt=JSON.stringify($t[jt]);kt[wt]||(kt[wt]=!0,Pt.push($t[jt]))}return Pt}function _t(At,$t,Pt,kt){var jt=[{placeholders:{}}];if(At instanceof Ze&&$t instanceof Ze||At instanceof Re&&$t instanceof Re){if(At instanceof Ze){if(At.op!==$t.op||At.fn!==$t.fn)return[]}else if(At instanceof Re&&At.name!==$t.name)return[];if($t.args.length===1&&At.args.length===1||!ot($t,Pt)&&$t.args.length===At.args.length||kt){for(var wt=[],Mt=0;Mt<At.args.length;Mt++){var Tt=_t(At.args[Mt],$t.args[Mt],Pt);if(Tt.length===0)break;wt.push(Tt)}if(wt.length!==At.args.length){if(!it($t,Pt)||At.args.length===1)return[];if(At.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Rt=_t(At.args[0],$t.args[1],Pt);if(Rt.length===0)return[];var Ft=_t(At.args[1],$t.args[0],Pt);if(Ft.length===0)return[];wt=[Rt,Ft]}jt=bt(wt)}else if($t.args.length>=2&&At.args.length===2){for(var Ut=ir($t,Pt),Zt=[],Wt=0;Wt<Ut.length;Wt++){var qt=_t(At,Ut[Wt],Pt,!0);Zt=Zt.concat(qt)}return Zt}else{if(At.args.length>2)throw Error("Unexpected non-binary associative function: "+At.toString());return[]}}else if(At instanceof Ke){if(At.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(Et[At.name]){if(At.name!==$t.name)return[]}else switch(At.name[1]>="a"&&At.name[1]<="z"?At.name.substring(0,2):At.name[0]){case"n":case"_p":jt[0].placeholders[At.name]=$t;break;case"c":case"cl":if(isConstantNode($t))jt[0].placeholders[At.name]=$t;else return[];break;case"v":if(!isConstantNode($t))jt[0].placeholders[At.name]=$t;else return[];break;case"vl":if(isSymbolNode($t))jt[0].placeholders[At.name]=$t;else return[];break;case"cd":if(isNumericNode($t))jt[0].placeholders[At.name]=$t;else return[];break;case"vd":if(!isNumericNode($t))jt[0].placeholders[At.name]=$t;else return[];break;case"ce":if(isConstantExpression($t))jt[0].placeholders[At.name]=$t;else return[];break;case"ve":if(!isConstantExpression($t))jt[0].placeholders[At.name]=$t;else return[];break;default:throw new Error("Invalid symbol in rule: "+At.name)}}else if(At instanceof Ve){if(!ae(At.value,$t.value))return[]}else return[];return jt}function Xt(At,$t){if(At instanceof Ve&&$t instanceof Ve){if(!ae(At.value,$t.value))return!1}else if(At instanceof Ke&&$t instanceof Ke){if(At.name!==$t.name)return!1}else if(At instanceof Ze&&$t instanceof Ze||At instanceof Re&&$t instanceof Re){if(At instanceof Ze){if(At.op!==$t.op||At.fn!==$t.fn)return!1}else if(At instanceof Re&&At.name!==$t.name)return!1;if(At.args.length!==$t.args.length)return!1;for(var Pt=0;Pt<At.args.length;Pt++)if(!Xt(At.args[Pt],$t.args[Pt]))return!1}else return!1;return!0}return xt}),name$t="simplifyConstant",dependencies$t=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],createSimplifyConstant=factory(name$t,dependencies$t,v=>{var{typed:N,config:G,mathWithTransform:z,matrix:q,fraction:Y,bignumber:W,AccessorNode:ie,ArrayNode:ne,ConstantNode:se,FunctionNode:ae,IndexNode:ce,ObjectNode:pe,OperatorNode:ge,SymbolNode:ve}=v,{isCommutative:be,isAssociative:Ee,allChildren:Pe,createMakeNodeFunction:Je}=createUtil({FunctionNode:ae,OperatorNode:ge,SymbolNode:ve}),Ce=N("simplifyConstant",{Node:ct=>et(ut(ct,{})),"Node, Object":function(at,st){return et(ut(at,st))}});function Ve(ct){return isFraction(ct)?ct.valueOf():ct instanceof Array?ct.map(Ve):isMatrix(ct)?q(Ve(ct.valueOf())):ct}function Re(ct,at,st){try{return z[ct].apply(null,at)}catch{return at=at.map(Ve),tt(z[ct].apply(null,at),st)}}var qe=N({Fraction:rt,number:function(at){return at<0?Ke(new se(-at)):new se(at)},BigNumber:function(at){return at<0?Ke(new se(-at)):new se(at)},Complex:function(at){throw new Error("Cannot convert Complex number to Node")},string:function(at){return new se(at)},Matrix:function(at){return new ne(at.valueOf().map(st=>qe(st)))}});function et(ct){return isNode(ct)?ct:qe(ct)}function Ze(ct,at){var st=at&&at.exactFractions!==!1;if(st&&isFinite(ct)&&Y){var pt=Y(ct),lt=at&&typeof at.fractionsLimit=="number"?at.fractionsLimit:1/0;if(pt.valueOf()===ct&&pt.n<lt&&pt.d<lt)return pt}return ct}var tt=N({"string, Object":function(at,st){if(G.number==="BigNumber")return W===void 0&&noBignumber(),W(at);if(G.number==="Fraction")return Y===void 0&&noFraction(),Y(at);var pt=parseFloat(at);return Ze(pt,st)},"Fraction, Object":function(at,st){return at},"BigNumber, Object":function(at,st){return at},"number, Object":function(at,st){return Ze(at,st)},"Complex, Object":function(at,st){return at.im!==0?at:Ze(at.re,st)},"Matrix, Object":function(at,st){return q(Ze(at.valueOf()))},"Array, Object":function(at,st){return at.map(Ze)}});function Ke(ct){return new ge("-","unaryMinus",[ct])}function rt(ct){var at,st=ct.s*ct.n;return st<0?at=new ge("-","unaryMinus",[new se(-st)]):at=new se(st),ct.d===1?at:new ge("/","divide",[at,new se(ct.d)])}function it(ct,at,st){if(!isIndexNode(at))return new ie(et(ct),et(at));if(isArrayNode(ct)||isMatrix(ct)){for(var pt=Array.from(at.dimensions);pt.length>0;)if(isConstantNode(pt[0])&&typeof pt[0].value!="string"){var lt=tt(pt.shift().value,st);isArrayNode(ct)?ct=ct.items[lt-1]:(ct=ct.valueOf()[lt-1],ct instanceof Array&&(ct=q(ct)))}else if(pt.length>1&&isConstantNode(pt[1])&&typeof pt[1].value!="string"){var vt=tt(pt[1].value,st),dt=[],xt=isArrayNode(ct)?ct.items:ct.valueOf();for(var ft of xt)if(isArrayNode(ft))dt.push(ft.items[vt-1]);else if(isMatrix(ct))dt.push(ft[vt-1]);else break;if(dt.length===xt.length)isArrayNode(ct)?ct=new ne(dt):ct=q(dt),pt.splice(1,1);else break}else break;return pt.length===at.dimensions.length?new ie(et(ct),at):pt.length>0?(at=new ce(pt),new ie(et(ct),at)):ct}if(isObjectNode(ct)&&at.dimensions.length===1&&isConstantNode(at.dimensions[0])){var Et=at.dimensions[0].value;return Et in ct.properties?ct.properties[Et]:new se}return new ie(et(ct),at)}function ot(ct,at,st,pt){var lt=at.shift(),vt=at.reduce((dt,xt)=>{if(!isNode(xt)){var ft=dt.pop();if(isNode(ft))return[ft,xt];try{return dt.push(Re(ct,[ft,xt],pt)),dt}catch{dt.push(ft)}}dt.push(et(dt.pop()));var Et=dt.length===1?dt[0]:st(dt);return[st([Et,et(xt)])]},[lt]);return vt.length===1?vt[0]:st([vt[0],qe(vt[1])])}function ut(ct,at){switch(ct.type){case"SymbolNode":return ct;case"ConstantNode":switch(typeof ct.value){case"number":return tt(ct.value,at);case"string":return ct.value;default:if(!isNaN(ct.value))return tt(ct.value,at)}return ct;case"FunctionNode":if(z[ct.name]&&z[ct.name].rawArgs)return ct;{var st=["add","multiply"];if(st.indexOf(ct.name)===-1){var pt=ct.args.map(Ht=>ut(Ht,at));if(!pt.some(isNode))try{return Re(ct.name,pt,at)}catch{}if(ct.name==="size"&&pt.length===1&&isArrayNode(pt[0])){for(var lt=[],vt=pt[0];isArrayNode(vt);)lt.push(vt.items.length),vt=vt.items[0];return q(lt)}return new ae(ct.name,pt.map(et))}}case"OperatorNode":{var dt=ct.fn.toString(),xt,ft,Et=Je(ct);if(isOperatorNode(ct)&&ct.isUnary())xt=[ut(ct.args[0],at)],isNode(xt[0])?ft=Et(xt):ft=Re(dt,xt,at);else if(Ee(ct,at.context))if(xt=Pe(ct,at.context),xt=xt.map(Ht=>ut(Ht,at)),be(dt,at.context)){for(var Ct=[],Dt=[],Gt=0;Gt<xt.length;Gt++)isNode(xt[Gt])?Dt.push(xt[Gt]):Ct.push(xt[Gt]);Ct.length>1?(ft=ot(dt,Ct,Et,at),Dt.unshift(ft),ft=ot(dt,Dt,Et,at)):ft=ot(dt,xt,Et,at)}else ft=ot(dt,xt,Et,at);else xt=ct.args.map(Ht=>ut(Ht,at)),ft=ot(dt,xt,Et,at);return ft}case"ParenthesisNode":return ut(ct.content,at);case"AccessorNode":return it(ut(ct.object,at),ut(ct.index,at),at);case"ArrayNode":{var Ot=ct.items.map(Ht=>ut(Ht,at));return Ot.some(isNode)?new ne(Ot.map(et)):q(Ot)}case"IndexNode":return new ce(ct.dimensions.map(Ht=>Ce(Ht,at)));case"ObjectNode":{var It={};for(var Bt in ct.properties)It[Bt]=Ce(ct.properties[Bt],at);return new pe(It)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(ct.type))}}return Ce}),name$s="simplifyCore",dependencies$s=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],createSimplifyCore=factory(name$s,dependencies$s,v=>{var{typed:N,parse:G,equal:z,isZero:q,add:Y,subtract:W,multiply:ie,divide:ne,pow:se,AccessorNode:ae,ArrayNode:ce,ConstantNode:pe,FunctionNode:ge,IndexNode:ve,ObjectNode:be,OperatorNode:Ee,ParenthesisNode:Pe,SymbolNode:Je}=v,Ce=new pe(0),Ve=new pe(1),Re=new pe(!0),qe=new pe(!1);function et(rt){return isOperatorNode(rt)&&["and","not","or"].includes(rt.op)}var{hasProperty:Ze,isCommutative:tt}=createUtil({FunctionNode:ge,OperatorNode:Ee,SymbolNode:Je});function Ke(rt){var it=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ot=it?it.context:void 0;if(Ze(rt,"trivial",ot)){if(isFunctionNode(rt)&&rt.args.length===1)return Ke(rt.args[0],it);var ut=!1,ct=0;if(rt.forEach(Dt=>{++ct,ct===1&&(ut=Ke(Dt,it))}),ct===1)return ut}var at=rt;if(isFunctionNode(at)){var st=getOperator(at.name);if(st){if(at.args.length>2&&Ze(at,"associative",ot))for(;at.args.length>2;){var pt=at.args.pop(),lt=at.args.pop();at.args.push(new Ee(st,at.name,[pt,lt]))}at=new Ee(st,at.name,at.args)}else return new ge(Ke(at.fn),at.args.map(Dt=>Ke(Dt,it)))}if(isOperatorNode(at)&&at.isUnary()){var vt=Ke(at.args[0],it);if(at.op==="~"&&isOperatorNode(vt)&&vt.isUnary()&&vt.op==="~"||at.op==="not"&&isOperatorNode(vt)&&vt.isUnary()&&vt.op==="not"&&et(vt.args[0]))return vt.args[0];var dt=!0;if(at.op==="-"&&isOperatorNode(vt)&&(vt.isBinary()&&vt.fn==="subtract"&&(at=new Ee("-","subtract",[vt.args[1],vt.args[0]]),dt=!1),vt.isUnary()&&vt.op==="-"))return vt.args[0];if(dt)return new Ee(at.op,at.fn,[vt])}if(isOperatorNode(at)&&at.isBinary()){var xt=Ke(at.args[0],it),ft=Ke(at.args[1],it);if(at.op==="+"){if(isConstantNode(xt)&&q(xt.value))return ft;if(isConstantNode(ft)&&q(ft.value))return xt;isOperatorNode(ft)&&ft.isUnary()&&ft.op==="-"&&(ft=ft.args[0],at=new Ee("-","subtract",[xt,ft]))}if(at.op==="-")return isOperatorNode(ft)&&ft.isUnary()&&ft.op==="-"?Ke(new Ee("+","add",[xt,ft.args[0]]),it):isConstantNode(xt)&&q(xt.value)?Ke(new Ee("-","unaryMinus",[ft])):isConstantNode(ft)&&q(ft.value)?xt:new Ee(at.op,at.fn,[xt,ft]);if(at.op==="*"){if(isConstantNode(xt)){if(q(xt.value))return Ce;if(z(xt.value,1))return ft}if(isConstantNode(ft)){if(q(ft.value))return Ce;if(z(ft.value,1))return xt;if(tt(at,ot))return new Ee(at.op,at.fn,[ft,xt],at.implicit)}return new Ee(at.op,at.fn,[xt,ft],at.implicit)}if(at.op==="/")return isConstantNode(xt)&&q(xt.value)?Ce:isConstantNode(ft)&&z(ft.value,1)?xt:new Ee(at.op,at.fn,[xt,ft]);if(at.op==="^"&&isConstantNode(ft)){if(q(ft.value))return Ve;if(z(ft.value,1))return xt}if(at.op==="and"){if(isConstantNode(xt))if(xt.value){if(et(ft))return ft}else return qe;if(isConstantNode(ft))if(ft.value){if(et(xt))return xt}else return qe}if(at.op==="or"){if(isConstantNode(xt)){if(xt.value)return Re;if(et(ft))return ft}if(isConstantNode(ft)){if(ft.value)return Re;if(et(xt))return xt}}return new Ee(at.op,at.fn,[xt,ft])}if(isOperatorNode(at))return new Ee(at.op,at.fn,at.args.map(Dt=>Ke(Dt,it)));if(isArrayNode(at))return new ce(at.items.map(Dt=>Ke(Dt,it)));if(isAccessorNode(at))return new ae(Ke(at.object,it),Ke(at.index,it));if(isIndexNode(at))return new ve(at.dimensions.map(Dt=>Ke(Dt,it)));if(isObjectNode(at)){var Et={};for(var Ct in at.properties)Et[Ct]=Ke(at.properties[Ct],it);return new be(Et)}return at}return N(name$s,{Node:Ke,"Node,Object":Ke})}),name$r="resolve",dependencies$r=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],createResolve=factory(name$r,dependencies$r,v=>{var{typed:N,parse:G,ConstantNode:z,FunctionNode:q,OperatorNode:Y,ParenthesisNode:W}=v;function ie(ne,se){var ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!se)return ne;if(isSymbolNode(ne)){if(ae.has(ne.name)){var ce=Array.from(ae).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(ce,"}"))}var pe=se.get(ne.name);if(isNode(pe)){var ge=new Set(ae);return ge.add(ne.name),ie(pe,se,ge)}else return typeof pe=="number"?G(String(pe)):pe!==void 0?new z(pe):ne}else if(isOperatorNode(ne)){var ve=ne.args.map(function(Ee){return ie(Ee,se,ae)});return new Y(ne.op,ne.fn,ve,ne.implicit)}else{if(isParenthesisNode(ne))return new W(ie(ne.content,se,ae));if(isFunctionNode(ne)){var be=ne.args.map(function(Ee){return ie(Ee,se,ae)});return new q(ne.name,be)}}return ne.map(Ee=>ie(Ee,se,ae))}return N("resolve",{Node:ie,"Node, Map | null | undefined":ie,"Node, Object":(ne,se)=>ie(ne,createMap$1(se)),"Array | Matrix":N.referToSelf(ne=>se=>se.map(ae=>ne(ae))),"Array | Matrix, null | undefined":N.referToSelf(ne=>se=>se.map(ae=>ne(ae))),"Array, Object":N.referTo("Array,Map",ne=>(se,ae)=>ne(se,createMap$1(ae))),"Matrix, Object":N.referTo("Matrix,Map",ne=>(se,ae)=>ne(se,createMap$1(ae))),"Array | Matrix, Map":N.referToSelf(ne=>(se,ae)=>se.map(ce=>ne(ce,ae)))})}),name$q="symbolicEqual",dependencies$q=["parse","simplify","typed","OperatorNode"],createSymbolicEqual=factory(name$q,dependencies$q,v=>{var{parse:N,simplify:G,typed:z,OperatorNode:q}=v;function Y(W,ie){var ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},se=new q("-","subtract",[W,ie]),ae=G(se,{},ne);return isConstantNode(ae)&&!ae.value}return z(name$q,{"Node, Node":Y,"Node, Node, Object":Y})}),name$p="derivative",dependencies$p=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],createDerivative=factory(name$p,dependencies$p,v=>{var{typed:N,config:G,parse:z,simplify:q,equal:Y,isZero:W,numeric:ie,ConstantNode:ne,FunctionNode:se,OperatorNode:ae,ParenthesisNode:ce,SymbolNode:pe}=v;function ge(Ve,Re){var qe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},et={};Ee(et,Ve,Re.name);var Ze=Pe(Ve,et);return qe.simplify?q(Ze):Ze}N.addConversion({from:"identifier",to:"SymbolNode",convert:z});var ve=N(name$p,{"Node, SymbolNode":ge,"Node, SymbolNode, Object":ge});N.removeConversion({from:"identifier",to:"SymbolNode",convert:z}),ve._simplify=!0,ve.toTex=function(Ve){return be.apply(null,Ve.args)};var be=N("_derivTex",{"Node, SymbolNode":function(Re,qe){return isConstantNode(Re)&&typeOf(Re.value)==="string"?be(z(Re.value).toString(),qe.toString(),1):be(Re.toTex(),qe.toString(),1)},"Node, ConstantNode":function(Re,qe){if(typeOf(qe.value)==="string")return be(Re,z(qe.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(Re,qe,et){return be(Re.toString(),qe.name,et.value)},"string, string, number":function(Re,qe,et){var Ze;return et===1?Ze="{d\\over d"+qe+"}":Ze="{d^{"+et+"}\\over d"+qe+"^{"+et+"}}",Ze+"\\left[".concat(Re,"\\right]")}}),Ee=N("constTag",{"Object, ConstantNode, string":function(Re,qe){return Re[qe]=!0,!0},"Object, SymbolNode, string":function(Re,qe,et){return qe.name!==et?(Re[qe]=!0,!0):!1},"Object, ParenthesisNode, string":function(Re,qe,et){return Ee(Re,qe.content,et)},"Object, FunctionAssignmentNode, string":function(Re,qe,et){return qe.params.indexOf(et)===-1?(Re[qe]=!0,!0):Ee(Re,qe.expr,et)},"Object, FunctionNode | OperatorNode, string":function(Re,qe,et){if(qe.args.length>0){for(var Ze=Ee(Re,qe.args[0],et),tt=1;tt<qe.args.length;++tt)Ze=Ee(Re,qe.args[tt],et)&&Ze;if(Ze)return Re[qe]=!0,!0}return!1}}),Pe=N("_derivative",{"ConstantNode, Object":function(Re){return Ce(0)},"SymbolNode, Object":function(Re,qe){return qe[Re]!==void 0?Ce(0):Ce(1)},"ParenthesisNode, Object":function(Re,qe){return new ce(Pe(Re.content,qe))},"FunctionAssignmentNode, Object":function(Re,qe){return qe[Re]!==void 0?Ce(0):Pe(Re.expr,qe)},"FunctionNode, Object":function(Re,qe){if(Re.args.length!==1&&Je(Re),qe[Re]!==void 0)return Ce(0);var et=Re.args[0],Ze,tt=!1,Ke=!1,rt;switch(Re.name){case"cbrt":tt=!0,rt=new ae("*","multiply",[Ce(3),new ae("^","pow",[et,new ae("/","divide",[Ce(2),Ce(3)])])]);break;case"sqrt":case"nthRoot":if(Re.args.length===1)tt=!0,rt=new ae("*","multiply",[Ce(2),new se("sqrt",[et])]);else if(Re.args.length===2)return Ze=new ae("/","divide",[Ce(1),Re.args[1]]),qe[Ze]=qe[Re.args[1]],Pe(new ae("^","pow",[et,Ze]),qe);break;case"log10":Ze=Ce(10);case"log":if(!Ze&&Re.args.length===1)rt=et.clone(),tt=!0;else if(Re.args.length===1&&Ze||Re.args.length===2&&qe[Re.args[1]]!==void 0)rt=new ae("*","multiply",[et.clone(),new se("log",[Ze||Re.args[1]])]),tt=!0;else if(Re.args.length===2)return Pe(new ae("/","divide",[new se("log",[et]),new se("log",[Re.args[1]])]),qe);break;case"pow":return qe[Ze]=qe[Re.args[1]],Pe(new ae("^","pow",[et,Re.args[1]]),qe);case"exp":rt=new se("exp",[et.clone()]);break;case"sin":rt=new se("cos",[et.clone()]);break;case"cos":rt=new ae("-","unaryMinus",[new se("sin",[et.clone()])]);break;case"tan":rt=new ae("^","pow",[new se("sec",[et.clone()]),Ce(2)]);break;case"sec":rt=new ae("*","multiply",[Re,new se("tan",[et.clone()])]);break;case"csc":Ke=!0,rt=new ae("*","multiply",[Re,new se("cot",[et.clone()])]);break;case"cot":Ke=!0,rt=new ae("^","pow",[new se("csc",[et.clone()]),Ce(2)]);break;case"asin":tt=!0,rt=new se("sqrt",[new ae("-","subtract",[Ce(1),new ae("^","pow",[et.clone(),Ce(2)])])]);break;case"acos":tt=!0,Ke=!0,rt=new se("sqrt",[new ae("-","subtract",[Ce(1),new ae("^","pow",[et.clone(),Ce(2)])])]);break;case"atan":tt=!0,rt=new ae("+","add",[new ae("^","pow",[et.clone(),Ce(2)]),Ce(1)]);break;case"asec":tt=!0,rt=new ae("*","multiply",[new se("abs",[et.clone()]),new se("sqrt",[new ae("-","subtract",[new ae("^","pow",[et.clone(),Ce(2)]),Ce(1)])])]);break;case"acsc":tt=!0,Ke=!0,rt=new ae("*","multiply",[new se("abs",[et.clone()]),new se("sqrt",[new ae("-","subtract",[new ae("^","pow",[et.clone(),Ce(2)]),Ce(1)])])]);break;case"acot":tt=!0,Ke=!0,rt=new ae("+","add",[new ae("^","pow",[et.clone(),Ce(2)]),Ce(1)]);break;case"sinh":rt=new se("cosh",[et.clone()]);break;case"cosh":rt=new se("sinh",[et.clone()]);break;case"tanh":rt=new ae("^","pow",[new se("sech",[et.clone()]),Ce(2)]);break;case"sech":Ke=!0,rt=new ae("*","multiply",[Re,new se("tanh",[et.clone()])]);break;case"csch":Ke=!0,rt=new ae("*","multiply",[Re,new se("coth",[et.clone()])]);break;case"coth":Ke=!0,rt=new ae("^","pow",[new se("csch",[et.clone()]),Ce(2)]);break;case"asinh":tt=!0,rt=new se("sqrt",[new ae("+","add",[new ae("^","pow",[et.clone(),Ce(2)]),Ce(1)])]);break;case"acosh":tt=!0,rt=new se("sqrt",[new ae("-","subtract",[new ae("^","pow",[et.clone(),Ce(2)]),Ce(1)])]);break;case"atanh":tt=!0,rt=new ae("-","subtract",[Ce(1),new ae("^","pow",[et.clone(),Ce(2)])]);break;case"asech":tt=!0,Ke=!0,rt=new ae("*","multiply",[et.clone(),new se("sqrt",[new ae("-","subtract",[Ce(1),new ae("^","pow",[et.clone(),Ce(2)])])])]);break;case"acsch":tt=!0,Ke=!0,rt=new ae("*","multiply",[new se("abs",[et.clone()]),new se("sqrt",[new ae("+","add",[new ae("^","pow",[et.clone(),Ce(2)]),Ce(1)])])]);break;case"acoth":tt=!0,Ke=!0,rt=new ae("-","subtract",[Ce(1),new ae("^","pow",[et.clone(),Ce(2)])]);break;case"abs":rt=new ae("/","divide",[new se(new pe("abs"),[et.clone()]),et.clone()]);break;case"gamma":default:throw new Error('Function "'+Re.name+'" is not supported by derivative, or a wrong number of arguments is passed')}var it,ot;tt?(it="/",ot="divide"):(it="*",ot="multiply");var ut=Pe(et,qe);return Ke&&(ut=new ae("-","unaryMinus",[ut])),new ae(it,ot,[ut,rt])},"OperatorNode, Object":function(Re,qe){if(qe[Re]!==void 0)return Ce(0);if(Re.op==="+")return new ae(Re.op,Re.fn,Re.args.map(function(at){return Pe(at,qe)}));if(Re.op==="-"){if(Re.isUnary())return new ae(Re.op,Re.fn,[Pe(Re.args[0],qe)]);if(Re.isBinary())return new ae(Re.op,Re.fn,[Pe(Re.args[0],qe),Pe(Re.args[1],qe)])}if(Re.op==="*"){var et=Re.args.filter(function(at){return qe[at]!==void 0});if(et.length>0){var Ze=Re.args.filter(function(at){return qe[at]===void 0}),tt=Ze.length===1?Ze[0]:new ae("*","multiply",Ze),Ke=et.concat(Pe(tt,qe));return new ae("*","multiply",Ke)}return new ae("+","add",Re.args.map(function(at){return new ae("*","multiply",Re.args.map(function(st){return st===at?Pe(st,qe):st.clone()}))}))}if(Re.op==="/"&&Re.isBinary()){var rt=Re.args[0],it=Re.args[1];return qe[it]!==void 0?new ae("/","divide",[Pe(rt,qe),it]):qe[rt]!==void 0?new ae("*","multiply",[new ae("-","unaryMinus",[rt]),new ae("/","divide",[Pe(it,qe),new ae("^","pow",[it.clone(),Ce(2)])])]):new ae("/","divide",[new ae("-","subtract",[new ae("*","multiply",[Pe(rt,qe),it.clone()]),new ae("*","multiply",[rt.clone(),Pe(it,qe)])]),new ae("^","pow",[it.clone(),Ce(2)])])}if(Re.op==="^"&&Re.isBinary()){var ot=Re.args[0],ut=Re.args[1];if(qe[ot]!==void 0)return isConstantNode(ot)&&(W(ot.value)||Y(ot.value,1))?Ce(0):new ae("*","multiply",[Re,new ae("*","multiply",[new se("log",[ot.clone()]),Pe(ut.clone(),qe)])]);if(qe[ut]!==void 0){if(isConstantNode(ut)){if(W(ut.value))return Ce(0);if(Y(ut.value,1))return Pe(ot,qe)}var ct=new ae("^","pow",[ot.clone(),new ae("-","subtract",[ut,Ce(1)])]);return new ae("*","multiply",[ut.clone(),new ae("*","multiply",[Pe(ot,qe),ct])])}return new ae("*","multiply",[new ae("^","pow",[ot.clone(),ut.clone()]),new ae("+","add",[new ae("*","multiply",[Pe(ot,qe),new ae("/","divide",[ut.clone(),ot.clone()])]),new ae("*","multiply",[Pe(ut,qe),new se("log",[ot.clone()])])])])}throw new Error('Operator "'+Re.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function Je(Ve){if(!((Ve.name==="log"||Ve.name==="nthRoot"||Ve.name==="pow")&&Ve.args.length===2)){for(var Re=0;Re<Ve.args.length;++Re)Ve.args[Re]=Ce(0);throw Ve.compile().evaluate(),new Error('Function "'+Ve.name+'" is not supported by derivative, or a wrong number of arguments is passed')}}function Ce(Ve,Re){return new ne(ie(Ve,G.number))}return ve}),name$o="rationalize",dependencies$o=["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"],createRationalize=factory(name$o,dependencies$o,v=>{var{config:N,typed:G,equal:z,isZero:q,add:Y,subtract:W,multiply:ie,divide:ne,pow:se,parse:ae,simplifyConstant:ce,simplifyCore:pe,simplify:ge,fraction:ve,bignumber:be,mathWithTransform:Ee,matrix:Pe,AccessorNode:Je,ArrayNode:Ce,ConstantNode:Ve,FunctionNode:Re,IndexNode:qe,ObjectNode:et,OperatorNode:Ze,SymbolNode:tt,ParenthesisNode:Ke}=v;function rt(at){var st=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,lt=ot(),vt=it(at,st,!0,lt.firstRules),dt=vt.variables.length,xt={exactFractions:!1},ft={exactFractions:!0};if(at=vt.expression,dt>=1){at=ut(at);var Et,Ct,Dt=!0,Gt=!1;at=ge(at,lt.firstRules,{},xt);for(var Ot;Ct=Dt?lt.distrDivRules:lt.sucDivRules,at=ge(at,Ct,{},ft),Dt=!Dt,Ot=at.toString(),Ot!==Et;)Gt=!0,Et=Ot;Gt&&(at=ge(at,lt.firstRulesAgain,{},xt)),at=ge(at,lt.finalRules,{},xt)}var It=[],Bt={};return at.type==="OperatorNode"&&at.isBinary()&&at.op==="/"?(dt===1&&(at.args[0]=ct(at.args[0],It),at.args[1]=ct(at.args[1])),pt&&(Bt.numerator=at.args[0],Bt.denominator=at.args[1])):(dt===1&&(at=ct(at,It)),pt&&(Bt.numerator=at,Bt.denominator=null)),pt?(Bt.coefficients=It,Bt.variables=vt.variables,Bt.expression=at,Bt):at}return G(name$o,{Node:rt,"Node, boolean":(at,st)=>rt(at,{},st),"Node, Object":rt,"Node, Object, boolean":rt});function it(at,st,pt,lt){var vt=[],dt=ge(at,lt,st,{exactFractions:!1});pt=!!pt;var xt="+-*"+(pt?"/":"");Et(dt);var ft={};return ft.expression=dt,ft.variables=vt,ft;function Et(Ct){var Dt=Ct.type;if(Dt==="FunctionNode")throw new Error("There is an unsolved function call");if(Dt==="OperatorNode")if(Ct.op==="^"){if(Ct.args[1].type!=="ConstantNode"||!isInteger(parseFloat(Ct.args[1].value)))throw new Error("There is a non-integer exponent");Et(Ct.args[0])}else{if(xt.indexOf(Ct.op)===-1)throw new Error("Operator "+Ct.op+" invalid in polynomial expression");for(var Gt=0;Gt<Ct.args.length;Gt++)Et(Ct.args[Gt])}else if(Dt==="SymbolNode"){var Ot=Ct.name,It=vt.indexOf(Ot);It===-1&&vt.push(Ot)}else if(Dt==="ParenthesisNode")Et(Ct.content);else if(Dt!=="ConstantNode")throw new Error("type "+Dt+" is not allowed in polynomial expression")}}function ot(){var at=[pe,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},ce,{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"}],st=[{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)"}],pt=[{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)"}],lt=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],vt={};return vt.firstRules=at.concat(st,lt),vt.distrDivRules=pt,vt.sucDivRules=lt,vt.firstRulesAgain=at.concat(st),vt.finalRules=[pe,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},ce,{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))"}],vt}function ut(at,st,pt){var lt=at.type,vt=arguments.length>1;if(lt==="OperatorNode"&&at.isBinary()){var dt=!1,xt;if(at.op==="^"&&(at.args[0].type==="ParenthesisNode"||at.args[0].type==="OperatorNode")&&at.args[1].type==="ConstantNode"&&(xt=parseFloat(at.args[1].value),dt=xt>=2&&isInteger(xt)),dt){if(xt>2){var ft=at.args[0],Et=new Ze("^","pow",[at.args[0].cloneDeep(),new Ve(xt-1)]);at=new Ze("*","multiply",[ft,Et])}else at=new Ze("*","multiply",[at.args[0],at.args[0].cloneDeep()]);vt&&(pt==="content"?st.content=at:st.args[pt]=at)}}if(lt==="ParenthesisNode")ut(at.content,at,"content");else if(lt!=="ConstantNode"&&lt!=="SymbolNode")for(var Ct=0;Ct<at.args.length;Ct++)ut(at.args[Ct],at,Ct);if(!vt)return at}function ct(at,st){st===void 0&&(st=[]),st[0]=0;var pt={};pt.cte=1,pt.oper="+",pt.fire="";var lt=0,vt="";Ot(at,null,pt),lt=st.length-1;for(var dt=!0,xt,ft=lt;ft>=0;ft--)if(st[ft]!==0){var Et=new Ve(dt?st[ft]:Math.abs(st[ft])),Ct=st[ft]<0?"-":"+";if(ft>0){var Dt=new tt(vt);if(ft>1){var Gt=new Ve(ft);Dt=new Ze("^","pow",[Dt,Gt])}st[ft]===-1&&dt?Et=new Ze("-","unaryMinus",[Dt]):Math.abs(st[ft])===1?Et=Dt:Et=new Ze("*","multiply",[Et,Dt])}dt?xt=Et:Ct==="+"?xt=new Ze("+","add",[xt,Et]):xt=new Ze("-","subtract",[xt,Et]),dt=!1}if(dt)return new Ve(0);return xt;function Ot(It,Bt,Ht){var ir=It.type;if(ir==="FunctionNode")throw new Error("There is an unsolved function call");if(ir==="OperatorNode"){if("+-*^".indexOf(It.op)===-1)throw new Error("Operator "+It.op+" invalid");if(Bt!==null){if((It.fn==="unaryMinus"||It.fn==="pow")&&Bt.fn!=="add"&&Bt.fn!=="subtract"&&Bt.fn!=="multiply")throw new Error("Invalid "+It.op+" placing");if((It.fn==="subtract"||It.fn==="add"||It.fn==="multiply")&&Bt.fn!=="add"&&Bt.fn!=="subtract")throw new Error("Invalid "+It.op+" placing");if((It.fn==="subtract"||It.fn==="add"||It.fn==="unaryMinus")&&Ht.noFil!==0)throw new Error("Invalid "+It.op+" placing")}(It.op==="^"||It.op==="*")&&(Ht.fire=It.op);for(var zt=0;zt<It.args.length;zt++)It.fn==="unaryMinus"&&(Ht.oper="-"),(It.op==="+"||It.fn==="subtract")&&(Ht.fire="",Ht.cte=1,Ht.oper=zt===0?"+":It.op),Ht.noFil=zt,Ot(It.args[zt],It,Ht)}else if(ir==="SymbolNode"){if(It.name!==vt&&vt!=="")throw new Error("There is more than one variable");if(vt=It.name,Bt===null){st[1]=1;return}if(Bt.op==="^"&&Ht.noFil!==0)throw new Error("In power the variable should be the first parameter");if(Bt.op==="*"&&Ht.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(Ht.fire===""||Ht.fire==="*")&&(lt<1&&(st[1]=0),st[1]+=Ht.cte*(Ht.oper==="+"?1:-1),lt=Math.max(1,lt))}else if(ir==="ConstantNode"){var tr=parseFloat(It.value);if(Bt===null){st[0]=tr;return}if(Bt.op==="^"){if(Ht.noFil!==1)throw new Error("Constant cannot be powered");if(!isInteger(tr)||tr<=0)throw new Error("Non-integer exponent is not allowed");for(var bt=lt+1;bt<tr;bt++)st[bt]=0;tr>lt&&(st[tr]=0),st[tr]+=Ht.cte*(Ht.oper==="+"?1:-1),lt=Math.max(tr,lt);return}Ht.cte=tr,Ht.fire===""&&(st[0]+=Ht.cte*(Ht.oper==="+"?1:-1))}else throw new Error("Type "+ir+" is not allowed")}}}),name$n="zpk2tf",dependencies$n=["typed","add","multiply","Complex","number"],createZpk2tf=factory(name$n,dependencies$n,v=>{var{typed:N,add:G,multiply:z,Complex:q,number:Y}=v;return N(name$n,{"Array,Array,number":function(se,ae,ce){return W(se,ae,ce)},"Array,Array":function(se,ae){return W(se,ae,1)},"Matrix,Matrix,number":function(se,ae,ce){return W(se.valueOf(),ae.valueOf(),ce)},"Matrix,Matrix":function(se,ae){return W(se.valueOf(),ae.valueOf(),1)}});function W(ne,se,ae){ne.some(Je=>Je.type==="BigNumber")&&(ne=ne.map(Je=>Y(Je))),se.some(Je=>Je.type==="BigNumber")&&(se=se.map(Je=>Y(Je)));for(var ce=[q(1,0)],pe=[q(1,0)],ge=0;ge<ne.length;ge++){var ve=ne[ge];typeof ve=="number"&&(ve=q(ve,0)),ce=ie(ce,[q(1,0),q(-ve.re,-ve.im)])}for(var be=0;be<se.length;be++){var Ee=se[be];typeof Ee=="number"&&(Ee=q(Ee,0)),pe=ie(pe,[q(1,0),q(-Ee.re,-Ee.im)])}for(var Pe=0;Pe<ce.length;Pe++)ce[Pe]=z(ce[Pe],ae);return[ce,pe]}function ie(ne,se){for(var ae=[],ce=0;ce<ne.length+se.length-1;ce++){ae[ce]=q(0,0);for(var pe=0;pe<ne.length;pe++)ce-pe>=0&&ce-pe<se.length&&(ae[ce]=G(ae[ce],z(ne[pe],se[ce-pe])))}return ae}}),name$m="freqz",dependencies$m=["typed","add","multiply","Complex","divide","matrix"],createFreqz=factory(name$m,dependencies$m,v=>{var{typed:N,add:G,multiply:z,Complex:q,divide:Y,matrix:W}=v;return N(name$m,{"Array, Array":function(ae,ce){var pe=ne(512);return ie(ae,ce,pe)},"Array, Array, Array":function(ae,ce,pe){return ie(ae,ce,pe)},"Array, Array, number":function(ae,ce,pe){if(pe<0)throw new Error("w must be a positive number");var ge=ne(pe);return ie(ae,ce,ge)},"Matrix, Matrix":function(ae,ce){var pe=ne(512),{w:ge,h:ve}=ie(ae.valueOf(),ce.valueOf(),pe);return{w:W(ge),h:W(ve)}},"Matrix, Matrix, Matrix":function(ae,ce,pe){var{h:ge}=ie(ae.valueOf(),ce.valueOf(),pe.valueOf());return{h:W(ge),w:W(pe)}},"Matrix, Matrix, number":function(ae,ce,pe){if(pe<0)throw new Error("w must be a positive number");var ge=ne(pe),{h:ve}=ie(ae.valueOf(),ce.valueOf(),ge);return{h:W(ve),w:W(ge)}}});function ie(se,ae,ce){for(var pe=[],ge=[],ve=0;ve<ce.length;ve++){for(var be=q(0,0),Ee=q(0,0),Pe=0;Pe<se.length;Pe++)be=G(be,z(se[Pe],q(Math.cos(-Pe*ce[ve]),Math.sin(-Pe*ce[ve]))));for(var Je=0;Je<ae.length;Je++)Ee=G(Ee,z(ae[Je],q(Math.cos(-Je*ce[ve]),Math.sin(-Je*ce[ve]))));pe.push(be),ge.push(Ee)}for(var Ce=[],Ve=0;Ve<pe.length;Ve++)Ce.push(Y(pe[Ve],ge[Ve]));return{h:Ce,w:ce}}function ne(se){for(var ae=[],ce=0;ce<se;ce++)ae.push(ce/se*Math.PI);return ae}}),name$l="reviver",dependencies$l=["classes"],createReviver=factory(name$l,dependencies$l,v=>{var{classes:N}=v;return function(z,q){var Y=N[q&&q.mathjs];return Y&&typeof Y.fromJSON=="function"?Y.fromJSON(q):q}}),name$k="replacer",dependencies$k=[],createReplacer=factory(name$k,dependencies$k,()=>function(N,G){return typeof G=="number"&&(!isFinite(G)||isNaN(G))?{mathjs:"number",value:String(G)}:G}),version$1="11.12.0",createTrue=factory("true",[],()=>!0),createFalse=factory("false",[],()=>!1),createNull=factory("null",[],()=>null),createInfinity=recreateFactory("Infinity",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G(1/0):1/0}),createNaN=recreateFactory("NaN",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G(NaN):NaN}),createPi=recreateFactory("pi",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?createBigNumberPi(G):pi}),createTau=recreateFactory("tau",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?createBigNumberTau(G):tau}),createE=recreateFactory("e",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?createBigNumberE(G):e$3}),createPhi=recreateFactory("phi",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?createBigNumberPhi(G):phi}),createLN2=recreateFactory("LN2",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G(2).ln():Math.LN2}),createLN10=recreateFactory("LN10",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G(10).ln():Math.LN10}),createLOG2E=recreateFactory("LOG2E",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G(1).div(new G(2).ln()):Math.LOG2E}),createLOG10E=recreateFactory("LOG10E",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G(1).div(new G(10).ln()):Math.LOG10E}),createSQRT1_2=recreateFactory("SQRT1_2",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G("0.5").sqrt():Math.SQRT1_2}),createSQRT2=recreateFactory("SQRT2",["config","?BigNumber"],v=>{var{config:N,BigNumber:G}=v;return N.number==="BigNumber"?new G(2).sqrt():Math.SQRT2}),createI=recreateFactory("i",["Complex"],v=>{var{Complex:N}=v;return N.I}),createUppercasePi=factory("PI",["pi"],v=>{var{pi:N}=v;return N}),createUppercaseE=factory("E",["e"],v=>{var{e:N}=v;return N}),createVersion=factory("version",[],()=>version$1);function recreateFactory(v,N,G){return factory(v,N,G,{recreateOnConfigChange:!0})}var createSpeedOfLight=unitFactory("speedOfLight","299792458","m s^-1"),createGravitationConstant=unitFactory("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),createPlanckConstant=unitFactory("planckConstant","6.62607015e-34","J s"),createReducedPlanckConstant=unitFactory("reducedPlanckConstant","1.0545718176461565e-34","J s"),createMagneticConstant=unitFactory("magneticConstant","1.25663706212e-6","N A^-2"),createElectricConstant=unitFactory("electricConstant","8.8541878128e-12","F m^-1"),createVacuumImpedance=unitFactory("vacuumImpedance","376.730313667","ohm"),createCoulomb=unitFactory("coulomb","8.987551792261171e9","N m^2 C^-2"),createElementaryCharge=unitFactory("elementaryCharge","1.602176634e-19","C"),createBohrMagneton=unitFactory("bohrMagneton","9.2740100783e-24","J T^-1"),createConductanceQuantum=unitFactory("conductanceQuantum","7.748091729863649e-5","S"),createInverseConductanceQuantum=unitFactory("inverseConductanceQuantum","12906.403729652257","ohm"),createMagneticFluxQuantum=unitFactory("magneticFluxQuantum","2.0678338484619295e-15","Wb"),createNuclearMagneton=unitFactory("nuclearMagneton","5.0507837461e-27","J T^-1"),createKlitzing=unitFactory("klitzing","25812.807459304513","ohm"),createBohrRadius=unitFactory("bohrRadius","5.29177210903e-11","m"),createClassicalElectronRadius=unitFactory("classicalElectronRadius","2.8179403262e-15","m"),createElectronMass=unitFactory("electronMass","9.1093837015e-31","kg"),createFermiCoupling=unitFactory("fermiCoupling","1.1663787e-5","GeV^-2"),createFineStructure=numberFactory("fineStructure",.0072973525693),createHartreeEnergy=unitFactory("hartreeEnergy","4.3597447222071e-18","J"),createProtonMass=unitFactory("protonMass","1.67262192369e-27","kg"),createDeuteronMass=unitFactory("deuteronMass","3.3435830926e-27","kg"),createNeutronMass=unitFactory("neutronMass","1.6749271613e-27","kg"),createQuantumOfCirculation=unitFactory("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),createRydberg=unitFactory("rydberg","10973731.568160","m^-1"),createThomsonCrossSection=unitFactory("thomsonCrossSection","6.6524587321e-29","m^2"),createWeakMixingAngle=numberFactory("weakMixingAngle",.2229),createEfimovFactor=numberFactory("efimovFactor",22.7),createAtomicMass=unitFactory("atomicMass","1.66053906660e-27","kg"),createAvogadro=unitFactory("avogadro","6.02214076e23","mol^-1"),createBoltzmann=unitFactory("boltzmann","1.380649e-23","J K^-1"),createFaraday=unitFactory("faraday","96485.33212331001","C mol^-1"),createFirstRadiation=unitFactory("firstRadiation","3.7417718521927573e-16","W m^2"),createLoschmidt=unitFactory("loschmidt","2.686780111798444e25","m^-3"),createGasConstant=unitFactory("gasConstant","8.31446261815324","J K^-1 mol^-1"),createMolarPlanckConstant=unitFactory("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),createMolarVolume=unitFactory("molarVolume","0.022413969545014137","m^3 mol^-1"),createSackurTetrode=numberFactory("sackurTetrode",-1.16487052358),createSecondRadiation=unitFactory("secondRadiation","0.014387768775039337","m K"),createStefanBoltzmann=unitFactory("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),createWienDisplacement=unitFactory("wienDisplacement","2.897771955e-3","m K"),createMolarMass=unitFactory("molarMass","0.99999999965e-3","kg mol^-1"),createMolarMassC12=unitFactory("molarMassC12","11.9999999958e-3","kg mol^-1"),createGravity=unitFactory("gravity","9.80665","m s^-2"),createPlanckLength=unitFactory("planckLength","1.616255e-35","m"),createPlanckMass=unitFactory("planckMass","2.176435e-8","kg"),createPlanckTime=unitFactory("planckTime","5.391245e-44","s"),createPlanckCharge=unitFactory("planckCharge","1.87554603778e-18","C"),createPlanckTemperature=unitFactory("planckTemperature","1.416785e+32","K");function unitFactory(v,N,G){var z=["config","Unit","BigNumber"];return factory(v,z,q=>{var{config:Y,Unit:W,BigNumber:ie}=q,ne=Y.number==="BigNumber"?new ie(N):parseFloat(N),se=new W(ne,G);return se.fixPrefix=!0,se})}function numberFactory(v,N){var G=["config","BigNumber"];return factory(v,G,z=>{var{config:q,BigNumber:Y}=z;return q.number==="BigNumber"?new Y(N):N})}var name$j="apply",dependencies$j=["typed","isInteger"],createApplyTransform=factory(name$j,dependencies$j,v=>{var{typed:N,isInteger:G}=v,z=createApply({typed:N,isInteger:G});return N("apply",{"...any":function(Y){var W=Y[1];isNumber(W)?Y[1]=W-1:isBigNumber(W)&&(Y[1]=W.minus(1));try{return z.apply(null,Y)}catch(ie){throw errorTransform(ie)}}})},{isTransformFunction:!0}),name$i="column",dependencies$i=["typed","Index","matrix","range"],createColumnTransform=factory(name$i,dependencies$i,v=>{var{typed:N,Index:G,matrix:z,range:q}=v,Y=createColumn({typed:N,Index:G,matrix:z,range:q});return N("column",{"...any":function(ie){var ne=ie.length-1,se=ie[ne];isNumber(se)&&(ie[ne]=se-1);try{return Y.apply(null,ie)}catch(ae){throw errorTransform(ae)}}})},{isTransformFunction:!0});function compileInlineExpression(v,N,G){var z=v.filter(function(ie){return isSymbolNode(ie)&&!(ie.name in N)&&!G.has(ie.name)})[0];if(!z)throw new Error('No undefined variable found in inline expression "'+v+'"');var q=z.name,Y=createSubScope(G),W=v.compile();return function(ne){return Y.set(q,ne),W.evaluate(Y)}}var name$h="filter",dependencies$h=["typed"],createFilterTransform=factory(name$h,dependencies$h,v=>{var{typed:N}=v;function G(q,Y,W){var ie,ne;return q[0]&&(ie=q[0].compile().evaluate(W)),q[1]&&(isSymbolNode(q[1])||isFunctionAssignmentNode(q[1])?ne=q[1].compile().evaluate(W):ne=compileInlineExpression(q[1],Y,W)),z(ie,ne)}G.rawArgs=!0;var z=N("filter",{"Array, function":_filter,"Matrix, function":function(Y,W){return Y.create(_filter(Y.toArray(),W))},"Array, RegExp":filterRegExp,"Matrix, RegExp":function(Y,W){return Y.create(filterRegExp(Y.toArray(),W))}});return G},{isTransformFunction:!0});function _filter(v,N){return filter(v,function(G,z,q){return applyCallback(N,G,[z+1],q,"filter")})}var name$g="forEach",dependencies$g=["typed"],createForEachTransform=factory(name$g,dependencies$g,v=>{var{typed:N}=v;function G(q,Y,W){var ie,ne;return q[0]&&(ie=q[0].compile().evaluate(W)),q[1]&&(isSymbolNode(q[1])||isFunctionAssignmentNode(q[1])?ne=q[1].compile().evaluate(W):ne=compileInlineExpression(q[1],Y,W)),z(ie,ne)}G.rawArgs=!0;var z=N("forEach",{"Array | Matrix, function":function(Y,W){var ie=function ne(se,ae){if(Array.isArray(se))forEach(se,function(ce,pe){ne(ce,ae.concat(pe+1))});else return applyCallback(W,se,ae,Y,"forEach")};ie(Y.valueOf(),[])}});return G},{isTransformFunction:!0}),name$f="index",dependencies$f=["Index","getMatrixDataType"],createIndexTransform=factory(name$f,dependencies$f,v=>{var{Index:N,getMatrixDataType:G}=v;return function(){for(var q=[],Y=0,W=arguments.length;Y<W;Y++){var ie=arguments[Y];if(isRange(ie))ie.start--,ie.end-=ie.step>0?0:2;else if(ie&&ie.isSet===!0)ie=ie.map(function(se){return se-1});else if(isArray(ie)||isMatrix(ie))G(ie)!=="boolean"&&(ie=ie.map(function(se){return se-1}));else if(isNumber(ie))ie--;else if(isBigNumber(ie))ie=ie.toNumber()-1;else if(typeof ie!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");q[Y]=ie}var ne=new N;return N.apply(ne,q),ne}},{isTransformFunction:!0}),name$e="map",dependencies$e=["typed"],createMapTransform=factory(name$e,dependencies$e,v=>{var{typed:N}=v;function G(q,Y,W){var ie,ne;return q[0]&&(ie=q[0].compile().evaluate(W)),q[1]&&(isSymbolNode(q[1])||isFunctionAssignmentNode(q[1])?ne=q[1].compile().evaluate(W):ne=compileInlineExpression(q[1],Y,W)),z(ie,ne)}G.rawArgs=!0;var z=N("map",{"Array, function":function(Y,W){return _map(Y,W,Y)},"Matrix, function":function(Y,W){return Y.create(_map(Y.valueOf(),W,Y))}});return G},{isTransformFunction:!0});function _map(v,N,G){function z(q,Y){return Array.isArray(q)?map(q,function(W,ie){return z(W,Y.concat(ie+1))}):applyCallback(N,q,Y,G,"map")}return z(v,[])}function lastDimToZeroBase(v){if(v.length===2&&isCollection(v[0])){v=v.slice();var N=v[1];isNumber(N)?v[1]=N-1:isBigNumber(N)&&(v[1]=N.minus(1))}return v}var name$d="max",dependencies$d=["typed","config","numeric","larger"],createMaxTransform=factory(name$d,dependencies$d,v=>{var{typed:N,config:G,numeric:z,larger:q}=v,Y=createMax({typed:N,config:G,numeric:z,larger:q});return N("max",{"...any":function(ie){ie=lastDimToZeroBase(ie);try{return Y.apply(null,ie)}catch(ne){throw errorTransform(ne)}}})},{isTransformFunction:!0}),name$c="mean",dependencies$c=["typed","add","divide"],createMeanTransform=factory(name$c,dependencies$c,v=>{var{typed:N,add:G,divide:z}=v,q=createMean({typed:N,add:G,divide:z});return N("mean",{"...any":function(W){W=lastDimToZeroBase(W);try{return q.apply(null,W)}catch(ie){throw errorTransform(ie)}}})},{isTransformFunction:!0}),name$b="min",dependencies$b=["typed","config","numeric","smaller"],createMinTransform=factory(name$b,dependencies$b,v=>{var{typed:N,config:G,numeric:z,smaller:q}=v,Y=createMin({typed:N,config:G,numeric:z,smaller:q});return N("min",{"...any":function(ie){ie=lastDimToZeroBase(ie);try{return Y.apply(null,ie)}catch(ne){throw errorTransform(ne)}}})},{isTransformFunction:!0}),name$a="range",dependencies$a=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],createRangeTransform=factory(name$a,dependencies$a,v=>{var{typed:N,config:G,matrix:z,bignumber:q,smaller:Y,smallerEq:W,larger:ie,largerEq:ne,add:se,isPositive:ae}=v,ce=createRange({typed:N,config:G,matrix:z,bignumber:q,smaller:Y,smallerEq:W,larger:ie,largerEq:ne,add:se,isPositive:ae});return N("range",{"...any":function(ge){var ve=ge.length-1,be=ge[ve];return typeof be!="boolean"&&ge.push(!0),ce.apply(null,ge)}})},{isTransformFunction:!0}),name$9="row",dependencies$9=["typed","Index","matrix","range"],createRowTransform=factory(name$9,dependencies$9,v=>{var{typed:N,Index:G,matrix:z,range:q}=v,Y=createRow({typed:N,Index:G,matrix:z,range:q});return N("row",{"...any":function(ie){var ne=ie.length-1,se=ie[ne];isNumber(se)&&(ie[ne]=se-1);try{return Y.apply(null,ie)}catch(ae){throw errorTransform(ae)}}})},{isTransformFunction:!0}),name$8="subset",dependencies$8=["typed","matrix","zeros","add"],createSubsetTransform=factory(name$8,dependencies$8,v=>{var{typed:N,matrix:G,zeros:z,add:q}=v,Y=createSubset({typed:N,matrix:G,zeros:z,add:q});return N("subset",{"...any":function(ie){try{return Y.apply(null,ie)}catch(ne){throw errorTransform(ne)}}})},{isTransformFunction:!0}),name$7="concat",dependencies$7=["typed","matrix","isInteger"],createConcatTransform=factory(name$7,dependencies$7,v=>{var{typed:N,matrix:G,isInteger:z}=v,q=createConcat({typed:N,matrix:G,isInteger:z});return N("concat",{"...any":function(W){var ie=W.length-1,ne=W[ie];isNumber(ne)?W[ie]=ne-1:isBigNumber(ne)&&(W[ie]=ne.minus(1));try{return q.apply(null,W)}catch(se){throw errorTransform(se)}}})},{isTransformFunction:!0}),name$6="diff",dependencies$6=["typed","matrix","subtract","number","bignumber"],createDiffTransform=factory(name$6,dependencies$6,v=>{var{typed:N,matrix:G,subtract:z,number:q,bignumber:Y}=v,W=createDiff({typed:N,matrix:G,subtract:z,number:q,bignumber:Y});return N(name$6,{"...any":function(ne){ne=lastDimToZeroBase(ne);try{return W.apply(null,ne)}catch(se){throw errorTransform(se)}}})},{isTransformFunction:!0}),name$5="std",dependencies$5=["typed","map","sqrt","variance"],createStdTransform=factory(name$5,dependencies$5,v=>{var{typed:N,map:G,sqrt:z,variance:q}=v,Y=createStd({typed:N,map:G,sqrt:z,variance:q});return N("std",{"...any":function(ie){ie=lastDimToZeroBase(ie);try{return Y.apply(null,ie)}catch(ne){throw errorTransform(ne)}}})},{isTransformFunction:!0}),name$4="sum",dependencies$4=["typed","config","add","numeric"],createSumTransform=factory(name$4,dependencies$4,v=>{var{typed:N,config:G,add:z,numeric:q}=v,Y=createSum({typed:N,config:G,add:z,numeric:q});return N(name$4,{"...any":function(ie){ie=lastDimToZeroBase(ie);try{return Y.apply(null,ie)}catch(ne){throw errorTransform(ne)}}})},{isTransformFunction:!0}),name$3="quantileSeq",dependencies$3=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],createQuantileSeqTransform=factory(name$3,dependencies$3,v=>{var{typed:N,bignumber:G,add:z,subtract:q,divide:Y,multiply:W,partitionSelect:ie,compare:ne,isInteger:se,smaller:ae,smallerEq:ce,larger:pe}=v,ge=createQuantileSeq({typed:N,bignumber:G,add:z,subtract:q,divide:Y,multiply:W,partitionSelect:ie,compare:ne,isInteger:se,smaller:ae,smallerEq:ce,larger:pe});return N("quantileSeq",{"Array | Matrix, number | BigNumber":ge,"Array | Matrix, number | BigNumber, number":(be,Ee,Pe)=>ge(be,Ee,ve(Pe)),"Array | Matrix, number | BigNumber, boolean":ge,"Array | Matrix, number | BigNumber, boolean, number":(be,Ee,Pe,Je)=>ge(be,Ee,Pe,ve(Je)),"Array | Matrix, Array | Matrix":ge,"Array | Matrix, Array | Matrix, number":(be,Ee,Pe)=>ge(be,Ee,ve(Pe)),"Array | Matrix, Array | Matrix, boolean":ge,"Array | Matrix, Array | Matrix, boolean, number":(be,Ee,Pe,Je)=>ge(be,Ee,Pe,ve(Je))});function ve(be){return lastDimToZeroBase([[],be])[1]}},{isTransformFunction:!0}),name$2="cumsum",dependencies$2=["typed","add","unaryPlus"],createCumSumTransform=factory(name$2,dependencies$2,v=>{var{typed:N,add:G,unaryPlus:z}=v,q=createCumSum({typed:N,add:G,unaryPlus:z});return N(name$2,{"...any":function(W){if(W.length===2&&isCollection(W[0])){var ie=W[1];isNumber(ie)?W[1]=ie-1:isBigNumber(ie)&&(W[1]=ie.minus(1))}try{return q.apply(null,W)}catch(ne){throw errorTransform(ne)}}})},{isTransformFunction:!0}),name$1="variance",dependencies$1=["typed","add","subtract","multiply","divide","apply","isNaN"],createVarianceTransform=factory(name$1,dependencies$1,v=>{var{typed:N,add:G,subtract:z,multiply:q,divide:Y,apply:W,isNaN:ie}=v,ne=createVariance({typed:N,add:G,subtract:z,multiply:q,divide:Y,apply:W,isNaN:ie});return N(name$1,{"...any":function(ae){ae=lastDimToZeroBase(ae);try{return ne.apply(null,ae)}catch(ce){throw errorTransform(ce)}}})},{isTransformFunction:!0}),name="print",dependencies=["typed","matrix","zeros","add"],createPrintTransform=factory(name,dependencies,v=>{var{typed:N,matrix:G,zeros:z,add:q}=v,Y=createPrint({typed:N,matrix:G,zeros:z,add:q});return N(name,{"string, Object | Array":function(ne,se){return Y(W(ne),se)},"string, Object | Array, number | Object":function(ne,se,ae){return Y(W(ne),se,ae)}});function W(ie){return ie.replace(printTemplate,ne=>{var se=ne.slice(1).split("."),ae=se.map(function(ce){return!isNaN(ce)&&ce.length>0?parseInt(ce)-1:ce});return"$"+ae.join(".")})}},{isTransformFunction:!0});const allFactories=Object.freeze(Object.defineProperty({__proto__:null,createAbs,createAccessorNode,createAcos,createAcosh,createAcot,createAcoth,createAcsc,createAcsch,createAdd,createAddScalar,createAnd,createApply,createApplyTransform,createArg,createArrayNode,createAsec,createAsech,createAsin,createAsinh,createAssignmentNode,createAtan,createAtan2,createAtanh,createAtomicMass,createAvogadro,createBellNumbers,createBigNumberClass,createBignumber,createBin,createBitAnd,createBitNot,createBitOr,createBitX
488or,createBlockNode,createBohrMagneton,createBohrRadius,createBoltzmann,createBoolean,createCatalan,createCbrt,createCeil,createChain,createChainClass,createClassicalElectronRadius,createClone,createColumn,createColumnTransform,createCombinations,createCombinationsWithRep,createCompare,createCompareNatural,createCompareText,createCompile,createComplex,createComplexClass,createComposition,createConcat,createConcatTransform,createConditionalNode,createConductanceQuantum,createConj,createConstantNode,createCorr,createCos,createCosh,createCot,createCoth,createCoulomb,createCount,createCreateUnit,createCross,createCsc,createCsch,createCtranspose,createCube,createCumSum,createCumSumTransform,createDeepEqual,createDenseMatrixClass,createDerivative,createDet,createDeuteronMass,createDiag,createDiff,createDiffTransform,createDistance,createDivide,createDivideScalar,createDot,createDotDivide,createDotMultiply,createDotPow,createE,createEfimovFactor,createEigs,createElectricConstant,createElectronMass,createElementaryCharge,createEqual,createEqualScalar,createEqualText,createErf,createEvaluate,createExp,createExpm,createExpm1,createFactorial,createFalse,createFaraday,createFermiCoupling,createFft,createFibonacciHeapClass,createFilter,createFilterTransform,createFineStructure,createFirstRadiation,createFix,createFlatten,createFloor,createForEach,createForEachTransform,createFormat,createFraction,createFractionClass,createFreqz,createFunctionAssignmentNode,createFunctionNode,createGamma,createGasConstant,createGcd,createGetMatrixDataType,createGravitationConstant,createGravity,createHartreeEnergy,createHasNumericValue,createHelp,createHelpClass,createHex,createHypot,createI,createIdentity,createIfft,createIm,createImmutableDenseMatrixClass,createIndex,createIndexClass,createIndexNode,createIndexTransform,createInfinity,createIntersect,createInv,createInverseConductanceQuantum,createInvmod,createIsInteger,createIsNaN,createIsNegative,createIsNumeric,createIsPositive,createIsPrime,createIsZero,createKldivergence,createKlitzing,createKron,createLN10,createLN2,createLOG10E,createLOG2E,createLarger,createLargerEq,createLcm,createLeafCount,createLeftShift,createLgamma,createLog,createLog10,createLog1p,createLog2,createLoschmidt,createLsolve,createLsolveAll,createLup,createLusolve,createLyap,createMad,createMagneticConstant,createMagneticFluxQuantum,createMap,createMapTransform,createMatrix,createMatrixClass,createMatrixFromColumns,createMatrixFromFunction,createMatrixFromRows,createMax,createMaxTransform,createMean,createMeanTransform,createMedian,createMin,createMinTransform,createMod,createMode,createMolarMass,createMolarMassC12,createMolarPlanckConstant,createMolarVolume,createMultinomial,createMultiply,createMultiplyScalar,createNaN,createNeutronMass,createNode,createNorm,createNot,createNthRoot,createNthRoots,createNuclearMagneton,createNull,createNumber,createNumeric,createObjectNode,createOct,createOnes,createOperatorNode,createOr,createParenthesisNode,createParse,createParser,createParserClass,createPartitionSelect,createPermutations,createPhi,createPi,createPickRandom,createPinv,createPlanckCharge,createPlanckConstant,createPlanckLength,createPlanckMass,createPlanckTemperature,createPlanckTime,createPolynomialRoot,createPow,createPrint,createPrintTransform,createProd,createProtonMass,createQr,createQuantileSeq,createQuantileSeqTransform,createQuantumOfCirculation,createRandom,createRandomInt,createRange,createRangeClass,createRangeNode,createRangeTransform,createRationalize,createRe,createReducedPlanckConstant,createRelationalNode,createReplacer,createReshape,createResize,createResolve,createResultSet,createReviver,createRightArithShift,createRightLogShift,createRotate,createRotationMatrix,createRound,createRow,createRowTransform,createRydberg,createSQRT1_2,createSQRT2,createSackurTetrode,createSchur,createSec,createSech,createSecondRadiation,createSetCartesian,createSetDifference,createSetDistinct,createSetIntersect,createSetIsSubset,createSetMultiplicity,createSetPowerset,createSetSize,createSetSymDifference,createSetUnion,createSign,createSimplify,createSimplifyConstant,createSimplifyCore,createSin,createSinh,createSize,createSlu,createSmaller,createSmallerEq,createSolveODE,createSort,createSpaClass,createSparse,createSparseMatrixClass,createSpeedOfLight,createSplitUnit,createSqrt,createSqrtm,createSquare,createSqueeze,createStd,createStdTransform,createStefanBoltzmann,createStirlingS2,createString,createSubset,createSubsetTransform,createSubtract,createSubtractScalar,createSum,createSumTransform,createSylvester,createSymbolNode,createSymbolicEqual,createTan,createTanh,createTau,createThomsonCrossSection,createTo,createTrace,createTranspose,createTrue,createTypeOf,createTyped,createUnaryMinus,createUnaryPlus,createUnequal,createUnitClass,createUnitFunction,createUppercaseE,createUppercasePi,createUsolve,createUsolveAll,createVacuumImpedance,createVariance,createVarianceTransform,createVersion,createWeakMixingAngle,createWienDisplacement,createXgcd,createXor,createZeros,createZeta,createZpk2tf},Symbol.toStringTag,{value:"Module"}));var all=allFactories,tinyEmitter={exports:{}}
488,hasRequiredTinyEmitter;function requireTinyEmitter(){if(hasRequiredTinyEmitter)return tinyEmitter.exports;hasRequiredTinyEmitter=1;function v(){}return v.prototype={on:function(N,G,z){var q=this.e||(this.e={});return(q[N]||(q[N]=[])).push({fn:G,ctx:z}),this},once:function(N,G,z){var q=this;function Y(){q.off(N,Y),G.apply(z,arguments)}return Y._=G,this.on(N,Y,z)},emit:function(N){var G=[].slice.call(arguments,1),z=((this.e||(this.e={}))[N]||[]).slice(),q=0,Y=z.length;for(q;q<Y;q++)z[q].fn.apply(z[q].ctx,G);return this},off:function(N,G){var z=this.e||(this.e={}),q=z[N],Y=[];if(q&&G)for(var W=0,ie=q.length;W<ie;W++)q[W].fn!==G&&q[W].fn._!==G&&Y.push(q[W]);return Y.length?z[N]=Y:delete z[N],this}},tinyEmitter.exports=v,tinyEmitter.exports.TinyEmitter=v,tinyEmitter.exports}var tinyEmitterExports=requireTinyEmitter();const Emitter=getDefaultExportFromCjs(tinyEmitterExports);function mixin(v){var N=new Emitter;return v.on=N.on.bind(N),v.off=N.off.bind(N),v.once=N.once.bind(N),v.emit=N.emit.bind(N),v}function importFactory(v,N,G,z){function q(Ee,Pe){var Je=arguments.length;if(Je!==1&&Je!==2)throw new ArgumentsError("import",Je,1,2);Pe||(Pe={});function Ce(et,Ze,tt){if(Array.isArray(Ze))Ze.forEach(it=>Ce(et,it));else if(typeof Ze=="object")for(var Ke in Ze)hasOwnProperty(Ze,Ke)&&Ce(et,Ze[Ke],Ke);else if(isFactory(Ze)||tt!==void 0){var rt=isFactory(Ze)?ve(Ze)?Ze.fn+".transform":Ze.fn:tt;if(hasOwnProperty(et,rt)&&et[rt]!==Ze&&!Pe.silent)throw new Error('Cannot import "'+rt+'" twice');et[rt]=Ze}else if(!Pe.silent)throw new TypeError("Factory, Object, or Array expected")}var Ve={};Ce(Ve,Ee);for(var Re in Ve)if(hasOwnProperty(Ve,Re)){var qe=Ve[Re];if(isFactory(qe))se(qe,Pe);else if(ae(qe))Y(Re,qe,Pe);else if(!Pe.silent)throw new TypeError("Factory, Object, or Array expected")}}function Y(Ee,Pe,Je){if(Je.wrap&&typeof Pe=="function"&&(Pe=ne(Pe)),ce(Pe)&&(Pe=v(Ee,{[Pe.signature]:Pe})),v.isTypedFunction(G[Ee])&&v.isTypedFunction(Pe)){Je.override?Pe=v(Ee,Pe.signatures):Pe=v(G[Ee],Pe),G[Ee]=Pe,delete z[Ee],W(Ee,Pe),G.emit("import",Ee,function(){return Pe});return}if(G[Ee]===void 0||Je.override){G[Ee]=Pe,delete z[Ee],W(Ee,Pe),G.emit("import",Ee,function(){return Pe});return}if(!Je.silent)throw new Error('Cannot import "'+Ee+'": already exists')}function W(Ee,Pe){Pe&&typeof Pe.transform=="function"?(G.expression.transform[Ee]=Pe.transform,pe(Ee)&&(G.expression.mathWithTransform[Ee]=Pe.transform)):(delete G.expression.transform[Ee],pe(Ee)&&(G.expression.mathWithTransform[Ee]=Pe))}function ie(Ee){delete G.expression.transform[Ee],pe(Ee)?G.expression.mathWithTransform[Ee]=G[Ee]:delete G.expression.mathWithTransform[Ee]}function ne(Ee){var Pe=function(){for(var Ce=[],Ve=0,Re=arguments.length;Ve<Re;Ve++){var qe=arguments[Ve];Ce[Ve]=qe&&qe.valueOf()}return Ee.apply(G,Ce)};return Ee.transform&&(Pe.transform=Ee.transform),Pe}function se(Ee,Pe){var Je=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ee.fn;if(contains(Je,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(Je));var Ce=ve(Ee)?G.expression.transform:G,Ve=Je in G.expression.transform,Re=hasOwnProperty(Ce,Je)?Ce[Je]:void 0,qe=function(){var Ze={};Ee.dependencies.map(stripOptionalNotation).forEach(Ke=>{if(contains(Ke,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(Ke));Ke==="math"?Ze.math=G:Ke==="mathWithTransform"?Ze.mathWithTransform=G.expression.mathWithTransform:Ke==="classes"?Ze.classes=G:Ze[Ke]=G[Ke]});var tt=Ee(Ze);if(tt&&typeof tt.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(Re===void 0||Pe.override)return tt;if(v.isTypedFunction(Re)&&v.isTypedFunction(tt))return v(Re,tt);if(Pe.silent)return Re;throw new Error('Cannot import "'+Je+'": already exists')};!Ee.meta||Ee.meta.lazy!==!1?(lazy(Ce,Je,qe),Re&&Ve?ie(Je):(ve(Ee)||ge(Ee))&&lazy(G.expression.mathWithTransform,Je,()=>Ce[Je])):(Ce[Je]=qe(),Re&&Ve?ie(Je):(ve(Ee)||ge(Ee))&&lazy(G.expression.mathWithTransform,Je,()=>Ce[Je])),z[Je]=Ee,G.emit("import",Je,qe)}function ae(Ee){return typeof Ee=="function"||typeof Ee=="number"||typeof Ee=="string"||typeof Ee=="boolean"||Ee===null||isUnit(Ee)||isComplex(Ee)||isBigNumber(Ee)||isFraction(Ee)||isMatrix(Ee)||Array.isArray(Ee)}function ce(Ee){return typeof Ee=="function"&&typeof Ee.signature=="string"}function pe(Ee){return!hasOwnProperty(be,Ee)}function ge(Ee){return Ee.fn.indexOf(".")===-1&&!hasOwnProperty(be,Ee.fn)&&(!Ee.meta||!Ee.meta.isClass)}function ve(Ee){return Ee!==void 0&&Ee.meta!==void 0&&Ee.meta.isTransformFunction===!0||!1}var be={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return q}function create(v,N){var G=_extends({},DEFAULT_CONFIG,N);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 z=mixin({isNumber,isComplex,isBigNumber,isFraction,isUnit,isString,isArray,isMatrix,isCollection,isDenseMatrix,isS
488parseMatrix,isRange,isIndex,isBoolean,isResultSet,isHelp,isFunction,isDate,isRegExp,isObject,isNull,isUndefined,isAccessorNode,isArrayNode,isAssignmentNode,isBlockNode,isConditionalNode,isConstantNode,isFunctionAssignmentNode,isFunctionNode,isIndexNode,isNode,isObjectNode,isOperatorNode,isParenthesisNode,isRangeNode,isRelationalNode,isSymbolNode,isChain});z.config=configFactory(G,z.emit),z.expression={transform:{},mathWithTransform:{config:z.config}};var q=[],Y=[];function W(ae){if(isFactory(ae))return ae(z);var ce=ae[Object.keys(ae)[0]];if(isFactory(ce))return ce(z);if(!isLegacyFactory(ae))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",ae),new Error("Factory object with properties `type`, `name`, and `factory` expected");var pe=q.indexOf(ae),ge;return pe===-1?(ae.math===!0?ge=ae.factory(z.type,G,W,z.typed,z):ge=ae.factory(z.type,G,W,z.typed),q.push(ae),Y.push(ge)):ge=Y[pe],ge}var ie={};function ne(){for(var ae=arguments.length,ce=new Array(ae),pe=0;pe<ae;pe++)ce[pe]=arguments[pe];return z.typed.apply(z.typed,ce)}ne.isTypedFunction=typedFunction.isTypedFunction;var se=importFactory(ne,W,z,ie);return z.import=se,z.on("config",()=>{values(ie).forEach(ae=>{ae&&ae.meta&&ae.meta.recreateOnConfigChange&&se(ae,{override:!0})})}),z.create=create.bind(null,v),z.factory=factory,z.import(values(deepFlatten(v))),z.ArgumentsError=ArgumentsError,z.DimensionError=DimensionError,z.IndexError=IndexError,z}const config$2={},math$2=create(all,config$2);let errorMessage=null,errorPosition=null;function updateErrorMessage(v){errorMessage=errorMessage!=null?errorMessage+", "+v:v}function isMathConstant(v){try{return math$2.compile(v).evaluate(),math$2.isNumeric(math$2.compile(v).evaluate())}catch{return!1}}function isOneVariableFunction(v){const N=["sin","ceil","floor","cos","tan","exp","log","sqrt","abs","exp","ln","log10","log2","asin","acos","atan","sinh","cosh","tanh","cot","acot","nthroot"],G=["log","nthroot"],z=["PI","pi","e","E"],q=["+","-","*","/","^"];function Y(W,ie){for(var ne=0;ne<W.length;)W[ne]===ie?W.splice(ne,1):++ne;return W}if(v.length==0)return updateErrorMessage("Empty expression"),!1;try{const W=math$2.parse(v);if("items"in W)return updateErrorMessage("Not a valid function (array)"),!1;if("blocks"in W)return updateErrorMessage("Multiple expressions not allowed (;)"),!1;let ie=[...new Set(W.filter(ae=>ae.isSymbolNode))];const ne=[...new Set(W.filter(ae=>ae.isFunctionNode))],se=[...new Set(W.filter(ae=>ae.isOperatorNode))];for(let ae=0;ae<ne.length;ae++){if(!N.includes(ne[ae].name))return updateErrorMessage("Invalid function name: "+ne[ae].name),errorPosition=0,!1;if(ne[ae].args.length!=1&&!G.includes(ne[ae].name))return updateErrorMessage("Invalid function, wrong number of arguments: "+ne[ae].name),errorPosition=0,!1;if(G.includes(ne[ae].name)&&ne[ae].args.length>2)return updateErrorMessage("Function "+ne[ae].name+" should have at most two arguments"),errorPosition=0,!1}return se.every(ae=>q.includes(ae.op))?(W.traverse(function(ae,ce,pe){ae.isSymbolNode&&(pe==null?void 0:pe.name)==ae.name&&N.includes(ae.name)&&Y(ie,ae)}),ie.every(ae=>z.includes(ae.name)||ae.name=="x")?!0:(updateErrorMessage("Invalid expression for a function of one variable"),errorPosition=0,!1)):(updateErrorMessage("Invalid operator"),errorPosition=0,!1)}catch{return updateErrorMessage("Invalid or incomplete expression"),errorPosition=0,!1}}function isValidMathParse(v){try{const N=math$2.parse(v);return!0}catch{return updateErrorMessage("Invalid math expression "),errorPosition=0,!1}}function transformAssingnments(v){return v.transform(function(N,G,z){return N.type=="AssignmentNode"?new math$2.OperatorNode("==","equal",[N.object,N.value]):N})}function transformMathConstants(v){return v.transform(function(N,G,z){if(N.type=="SymbolNode")switch(N.name){case"pi":return new math$2.ConstantNode(math$2.pi);case"PI":return new math$2.ConstantNode(math$2.pi);case"e":return new math$2.ConstantNode(math$2.e);case"E":return new math$2.ConstantNode(math$2.e);default:return N}else return N})}function isInequality(v){if(!isValidMathParse(v))return!1;const N=math$2.parse(v),G=transformAssingnments(N);if("op"in G){if(G.op!="<"&&G.op!=">"&&G.op!="<="&&G.op!=">="&&G.op!="=="&&G.op!="!=")return updateErrorMessage("Invalid inequality (wrong relations): "+G.toString()),!1;if(G.args.length!=2)return updateErrorMessage("Invalid valid inequality (wrong number of arguments): "+G.toString()),!1;if(!new Set(G.args.map(q=>q.type)).has("SymbolNode"))return updateErrorMessage("Invalid inequality (variable needed): "+G.toString()),!1;if(G.args[0].type=="SymbolNode"){if(G.args[0].name!="x")return updateErrorMessage("Invalid inequality (variable must be x): "+G.toString()),!1;if(!isMathConstant(G.args[1].toString()))return updateErrorMessage("Invalid inequality (constant needed): "+G.toString()),!1}else{if(G.args[1].name!="x")return updateErrorMessage("Invalid inequality (variable must be x): "+G.toString()),!1;if(!isMathConstant(G.args[0].toString()))return updateErrorMessage("Invalid inequality (constant needed): "+G.toString()),!1}}else{if(G.type!="RelationalNode")return updateErrorMessage("Invalid inequality"),!1;if(G.conditionals.length!=2)return updateErrorMessage("Invalid chain of inequalities (more than two)"),!1;if(!G.conditionals.every(z=>z=="smaller"||z=="smallerEq"))return updateErrorMessage("Invalid chain of inequalities (only < and <= are allowed)"),!1;if(!(isMathConstant(G.params[0].toString())&&G.params[1].type=="SymbolNode"&&isMathConstant(G.params[2].toString())))return updateErrorMessage("Invalid chain of inequalities (two constant params and a symbol in the middle) "),!1;if(G.params[1].name!="x")return updateErrorMessage("Invalid chain of inequalities (variable must be x)"),!1}return!0}function isListOfCompatibleInequalities(v){let N=[],G=[];for(let q=0;q<v.length;q++){let Y=math$2.parse(v[q]);const W=transformAssingnments(Y);
488if(!isInequality(W.toString()))return errorPosition=[[q,1]],!1;if("op"in W){if(W.op!="<"&&W.op!=">"&&W.op!="<="&&W.op!=">="&&W.op!="=="&&W.op!="!=")return updateErrorMessage("Invalid piecewise format, not a valid inequality (wrong relations): "+W.toString()),errorPosition=[[q,1]],!1;if(W.args.length!=2)return updateErrorMessage("Invalid piecewise format, not a valid inequality (wrong number of arguments): "+W.toString()),errorPosition=[[q,1]],!1;if(!new Set(W.args.map(ne=>ne.type)).has("SymbolNode"))return updateErrorMessage("Invalid piecewise format, not a valid inequality (variable needed): "+W.toString()),errorPosition=[[q,1]],!1;if(W.args[0].type=="SymbolNode"){if(!isMathConstant(W.args[1].toString()))return updateErrorMessage("Invalid piecewise format, not a valid inequality (constant needed): "+W.toString()),errorPosition=[[q,1]],!1;switch(W.op){case"<":N.push([-1/0,W.args[1].evaluate(),0,0]),G.push(q);break;case"<=":N.push([-1/0,W.args[1].evaluate(),0,1]),G.push(1);break;case">":N.push([W.args[1].evaluate(),1/0,0,0]),G.push(q);break;case">=":N.push([W.args[1].evaluate(),1/0,1,0]),G.push(q);break;case"==":N.push([W.args[1].evaluate(),W.args[1].evaluate(),1,1]),G.push(q);break;case"!=":N.push([W.args[1].evaluate(),1/0,0,0]),G.push(q),N.push([-1/0,W.args[1].evaluate(),0,0]),G.push(q);break}}else{if(!isMathConstant(W.args[0].toString()))return updateErrorMessage("Invalid piecewise format, not a valid inequality (constant needed): "+W.toString()),errorPosition=[[q,1]],!1;switch(W.op){case"<":N.push([W.args[0].evaluate(),1/0,0,0]),G.push(q);break;case"<=":N.push([W.args[0].evaluate(),1/0,1,0]),G.push(q);break;case">":N.push([-1/0,W.args[0].evaluate(),0,0]),G.push(q);break;case">=":N.push([-1/0,W.args[0].evaluate(),0,1]),G.push(q);break;case"==":N.push([W.args[0].evaluate(),W.args[0].evaluate(),1,1]),G.push(q);break;case"!=":N.push([W.args[0].evaluate(),1/0,0,0]),N.push([-1/0,W.args[0].evaluate(),0,0]),G.push(q),G.push(q);break}}}else{if(W.type!="RelationalNode")return updateErrorMessage("Invalid piecewise format, not a valid inequality: "+W.toString()),errorPosition=[[q,1]],!1;if(W.conditionals.length!=2)return updateErrorMessage("Invalid piecewise format, not a valid chain of inequalities (more than two): "+W.toString()),errorPosition=[[q,1]],!1;if(!W.conditionals.every(ie=>ie=="smaller"||ie=="smallerEq"))return updateErrorMessage("Invalid piecewise format, not a valid chain of inequalities (only < and <= are allowed): "+W.toString()),errorPosition=[[q,1]],!1;if(!(isMathConstant(W.params[0].toString())&&W.params[1].type=="SymbolNode")&&isMathConstant(W.params[2].toString()))return updateErrorMessage("Invalid piecewise format, not a valid inequality (two constant params and a symbol): "+W.toString()),errorPosition=[[q,1]],!1;W.conditionals[0]=="smallerEq"&&W.conditionals[1]=="smallerEq"&&(N.push([W.params[0].evaluate(),W.params[2].evaluate(),1,1]),G.push(q)),W.conditionals[0]=="smaller"&&W.conditionals[1]=="smallerEq"&&(N.push([W.params[0].evaluate(),W.params[2].evaluate(),0,1]),G.push(q)),W.conditionals[0]=="smallerEq"&&W.conditionals[1]=="smaller"&&(N.push([W.params[0].evaluate(),W.params[2].evaluate(),1,0]),G.push(q)),W.conditionals[0]=="smaller"&&W.conditionals[1]=="smaller"&&(N.push([W.params[0].evaluate(),W.params[2].evaluate(),0,0]),G.push(q))}}let z=N.toSorted((q,Y)=>q[0]-Y[0]==0?q[1]-Y[1]:q[0]-Y[0]);for(let q=0;q<N.length-1;q++){const Y=z[q],W=z[q+1];if(Y[1]>W[0]){const ie=N.findIndex(ce=>ce[0]===Y[0]&&ce[1]===Y[1]&&ce[2]===Y[2]&&ce[3]===Y[3]),ne=N.findIndex((ce,pe)=>pe!==ie&&ce[0]===W[0]&&ce[1]===W[1]&&ce[2]===W[2]&&ce[3]===W[3]),se=ie>=0&&ie<G.length?G[ie]:ie,ae=ne>=0&&ne<G.length?G[ne]:ne;return updateErrorMessage(`Overlap detected between Part ${se+1} and Part ${ae+1}. Please adjust the conditions to avoid overlap`),errorPosition=[[se,1],[ae,1]],!1}if(Y[1]==W[0]&&Y[3]*W[2]==1){const ie=N.findIndex(ce=>ce[0]===Y[0]&&ce[1]===Y[1]&&ce[2]===Y[2]&&ce[3]===Y[3]),ne=N.findIndex((ce,pe)=>pe!==ie&&ce[0]===W[0]&&ce[1]===W[1]&&ce[2]===W[2]&&ce[3]===W[3]),se=ie>=0&&ie<G.length?G[ie]:ie,ae=ne>=0&&ne<G.length?G[ne]:ne;return updateErrorMessage(`Boundary conflict between Part ${se+1} and Part ${ae+1}. Both parts include the same point. Please use < or > instead of <= or >=`),errorPosition=[[se,1],[ae,1]],!1}}return!0}function parsePiecewise(v){function N(z){return math$2.simplifyConstant(z.toString()).toString({implicit:"show"})}function G(z){if(z.length==0)return"NaN";const q=z[0],Y=N(q.items[0]),W=transformAssingnments(q.items[1]);let ie;return"op"in W?W.op=="!="?ie="!("+N(W.args[0])+"=="+N(W.args[1])+")":ie=W.toString():(ie=N(W.params[0]),ie+=W.conditionals[0]=="smallerEq"?"<=":"<",ie+=W.params[1].toString()+" && "+N(W.params[1]),ie+=W.conditionals[1]=="smallerEq"?"<=":"<",ie+=N(W.params[2])),ie+" ? ("+Y.toString()+") : ("+G(z.slice(1))+")"}return G(math$2.parse(v).items)}function functionDefPiecewiseToString(v){let N="[";for(let G=0;G<v.length;G++)N+="["+v[G][0]+","+v[G][1]+"]",G<v.length-1&&(N+=",");return N+="]",N}function checkMathSpell(v){let N=[];if(v.type==="function"){const G=v.functionDef.replace(/\*\*/g,"^");return errorMessage=null,errorPosition=0,isOneVariableFunction(G)?[transformMathConstants(math$2.parse(G)).toString({implicit:"show"}),[]]:["0",[[errorMessage,0]]]}if(v.type==="piecewise_function"){const G=v.functionDef.map(Y=>[Y[0].replace(/\*\*/g,"^"),Y[1].replace(/\*\*/g,"^")]);let z=!1;for(let Y=0;Y<G.length;Y++){errorMessage=null,errorPosition=[Y,0];const W=G[Y][0],ie=G[Y][1];isOneVariableFunction(W)||(errorPosition=[Y,0],N.push([errorMessage,errorPosition])),isInequality(ie)||(errorPosition=[Y,1],N.push([errorMessage,errorPosition]),z=!0)}let q=!1;if(z||(q=isListOfCompatibleInequalities(G.map(Y=>Y[1]))),N.length>0)return!z&&!q&&errorPosition.forEach(Y=>N.push([errorMessage,Y])),["0",N];if(q){const Y=functionDefPiecewiseToString(G),W=transformMathConstants(math$2.parse(Y)).toString();return[parsePiecewise(W),N]}return errorPosition===0?(N.push([errorMessage,[0,0]]),["0",N]):(errorPosition.forEach(Y=>N.push([errorMessage,Y])),["0",N])}return["0",N]}function getFunctionDefN(v,N){var G;return((G=v==null?void 0:v[N])==null?void 0:G.functionDef)??null}
488function getFunctionNameN(v,N){var G;return((G=v==null?void 0:v[N])==null?void 0:G.functionName)??null}function getFunctionTypeN(v,N){var G;return((G=v==null?void 0:v[N])==null?void 0:G.type)??null}function getFunctionInstrumentN(v,N){var G;return((G=v==null?void 0:v[N])==null?void 0:G.instrument)??null}function isFunctionActiveN(v,N){var G;return((G=v==null?void 0:v[N])==null?void 0:G.isActive)??!1}function getActiveFunctions(v){return(v==null?void 0:v.filter(N=>N.isActive))??[]}function getFunctionById(v,N){return(v==null?void 0:v.find(G=>G.id===N))??null}function getFunctionCount(v){return(v==null?void 0:v.length)??0}function getLandmarksN(v,N){var G;return((G=v==null?void 0:v[N])==null?void 0:G.landmarks)??[]}function getFunctionIndexById(v,N){return(v==null?void 0:v.findIndex(G=>G.id===N))??-1}function addFunction(v,N){return v?[...v,N]:[N]}function removeFunctionN(v,N){return!v||N<0||N>=v.length?v??[]:v.filter((G,z)=>z!==N)}function updateFunctionN(v,N,G){return!v||N<0||N>=v.length?v??[]:v.map((z,q)=>q===N?{...z,...G}:z)}function setFunctionInstrumentN(v,N,G){return updateFunctionN(v,N,{instrument:G})}function removeLandmarkN(v,N,G){if(!v||N<0||N>=v.length)return v??[];const z=v[N];if(!z.landmarks)return v;const q=z.landmarks.filter((Y,W)=>W!==G);return updateFunctionN(v,N,{landmarks:q})}function updateLandmarkN(v,N,G,z){if(!v||N<0||N>=v.length)return v??[];const q=v[N];if(!q.landmarks||G<0||G>=q.landmarks.length)return v;const Y=q.landmarks.map((W,ie)=>ie===G?{...W,...z}:W);return updateFunctionN(v,N,{landmarks:Y})}function removeLandmarkWithValidation(v,N,G){if(!v||N<0||N>=v.length)return{success:!1,message:"Invalid function index"};const z=v[N];if(!z.landmarks||G<0||G>=z.landmarks.length)return{success:!1,message:"Invalid landmark index"};const q=z.landmarks[G],Y=removeLandmarkN(v,N,G);return{success:!0,message:`Landmark "${q.label||"Unnamed"}" removed`,definitions:Y}}function updateLandmarkWithValidation(v,N,G,z){if(!v||N<0||N>=v.length)return{success:!1,message:"Invalid function index"};const q=v[N];if(!q.landmarks||G<0||G>=q.landmarks.length)return{success:!1,message:"Invalid landmark index"};if(z.x!==void 0||z.y!==void 0){const W=q.landmarks[G],ie=z.x!==void 0?z.x:W.x,ne=z.y!==void 0?z.y:W.y,se=.01;if(q.landmarks.find((ce,pe)=>pe!==G&&Math.abs(ce.x-ie)<se&&Math.abs(ce.y-ne)<se))return{success:!1,message:`Another landmark already exists at position x=${ie.toFixed(2)}, y=${ne.toFixed(2)}`}}return z.shortcut!==void 0&&q.landmarks.find((ie,ne)=>ne!==G&&ie.shortcut===z.shortcut)?{success:!1,message:`Shortcut "${z.shortcut}" is already in use`}:{success:!0,message:"Landmark updated",definitions:updateLandmarkN(v,N,G,z)}}function findLandmarkByShortcut(v,N,G){return getLandmarksN(v,N).find(q=>q.shortcut===G)||null}function validateLandmarkCoordinates(v,N){if(typeof v!="number")return{valid:!1,message:"Coordinates must be numbers"};if(!isFinite(v)||!isFinite(N))return{valid:!1,message:"Coordinates must be finite numbers"};const G=1e6,z=-1e6;return v>G||v<z||N>G||N<z?{valid:!1,message:`Coordinates must be between ${z} and ${G}`}:{valid:!0,message:""}}const AnnouncementContext=reactExports.createContext(),useAnnouncement=()=>{const v=reactExports.useContext(AnnouncementContext);if(!v)throw new Error("useAnnouncement must be used within an AnnouncementProvider");return v},AnnouncementProvider=({children:v})=>{const[N,G]=reactExports.useState(""),z=q=>{G(q),setTimeout(()=>G(""),100)};return jsxRuntimeExports.jsxs(AnnouncementContext.Provider,{value:{announce:z},children:[v,jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",style:{position:"absolute",left:"-10000px",width:"1px",height:"1px",overflow:"hidden"},children:N})]})},InstrumentFrequencyType={continuous:"continuous",discretePitchClassBased:"discretePitchClassBased"},GLOBAL_FREQUENCY_RANGE={min:100,max:1e3},createOrganInstrument=()=>{const v=new FMSynth({volume:-18,detune:-5,portamento:.1,harmonicity:4.5,modulationIndex:1.5,oscillator:{type:"square",phase:90},envelope:{attack:.05,decay:.3,sustain:.7,release:.8},modulation:{type:"sawtooth",phase:45},modulationEnvelope:{attack:.1,decay:.4,sustain:.6,release:.3}}),N=new Chorus({frequency:1.5,delayTime:3.5,depth:.6,wet:.8}),G=new Reverb({decay:2,preDelay:.1,wet:.6}),z=new Filter({type:"lowpass",frequency:1e3,rolloff:-12});v.connect(z).connect(N).connect(G);let q=!1;return{voices:[v],voiceIndex:0,fmSynth:v,chorus:N,reverb:G,filter:z,start:()=>{if(!q)try{N.start(),q=!0}catch{}},stop:()=>{v.triggerRelease()},dispose:()=>
488{v.dispose(),N.dispose(),G.dispose(),z.dispose()},triggerAttack:Y=>{try{q||(N.start(),q=!0),v.triggerAttack(Y)}catch{}},triggerRelease:()=>{v.triggerRelease()},connect:Y=>{G.connect(Y)},disconnect:()=>{v.disconnect(),N.disconnect(),G.disconnect(),z.disconnect()}}},generatePitchClasses=()=>{const v=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],N=[1,2,3,4,5,6,7,8,9],G=[];for(let z of N)for(let q of v)G.push(`${q}${z}`);return G},allPitchClasses=generatePitchClasses(),getPitchClasses=(v,N)=>{const G=allPitchClasses.indexOf(v),z=allPitchClasses.indexOf(N);return allPitchClasses.slice(G,z+1)},createInstruments=()=>[{name:"clarinet",createInstrument:()=>new FMSynth({volume:-8,detune:3,portamento:0,harmonicity:2,oscillator:{partialCount:0,partials:[],phase:0,type:"sine"},envelope:{attack:.21000000000000005,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:.05,releaseCurve:"exponential",sustain:1},modulation:{partialCount:0,partials:[],phase:0,type:"triangle"},modulationEnvelope:{attack:.20000000000000004,attackCurve:"linear",decay:.01,decayCurve:"exponential",release:.5,releaseCurve:"exponential",sustain:1},modulationIndex:1}),instrumentType:InstrumentFrequencyType.continuous},{name:"flute",createInstrument:()=>new FMSynth({volume:-6,harmonicity:1,modulationIndex:.5,oscillator:{type:"sine"},envelope:{attack:.2,decay:.1,sustain:.9,release:.5},modulation:{type:"triangle"},modulationEnvelope:{attack:.3,decay:.2,sustain:.5,release:.2}}),instrumentType:InstrumentFrequencyType.continuous},{name:"organ",createInstrument:()=>createOrganInstrument(),instrumentType:InstrumentFrequencyType.continuous},{name:"guitar",createInstrument:()=>new PluckSynth({volume:-2,attackNoise:1,dampening:500,resonance:.99}),instrumentType:InstrumentFrequencyType.discretePitchClassBased,availablePitchClasses:getPitchClasses("C3","C5")}],InstrumentsContext=reactExports.createContext(),useInstruments=()=>{const v=reactExports.useContext(InstrumentsContext);if(!v)throw new Error("useInstruments must be used within an InstrumentsProvider");return v},InstrumentsProvider=({children:v})=>{const[N,G]=reactExports.useState([]);reactExports.useEffect(()=>{const q=createInstruments();G(q)},[]);const z=q=>N.find(Y=>Y.name===q);return jsxRuntimeExports.jsx(InstrumentsContext.Provider,{value:{availableInstruments:N,getInstrumentByName:z},children:v})},config$1={},math$1=create(all,config$1);function createEndPoints(v,N){if(v.type==="function")return[[],[]];if(v.type!="piecewise_function")return console.error("createEndPoints: function type not recognized"),[];const z=functionDefPiecewiseToString(v.functionDef).replaceAll("**","^").replaceAll("nthroot","nthRoot").replaceAll("ln","log"),q=transformMathConstants(math$1.parse(z)),Y=["isolated","unequal"],W=v.pointOfInterests.filter(be=>!Y.includes(be.type));if(v.pointOfInterests=W,!("items"in q))return[[],[]];const ie=q.items;let ne,se,ae,ce,pe,ge;const ve=[];for(ge=0;ge<ie.length;ge++)if(ne=transformAssingnments(ie[ge].items[1]),"op"in ne){if((ne.op=="<="||ne.op==">="||ne.op=="==")&&("name"in ne.args[1]&&ne.args[1].name=="x"?(se=ne.args[0].evaluate(),pe=N.create("point",[se,ie[ge].items[0].evaluate({x:se})],{cssClass:"endpoint-closed",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe),ne.op=="=="&&v.pointOfInterests.push({x:se,y:ie[ge].items[0].evaluate({x:se}),type:"isolated"})):(se=ne.args[1].evaluate(),pe=N.create("point",[se,ie[ge].items[0].evaluate({x:se})],{cssClass:"isolated-point",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe),ne.op=="=="&&v.pointOfInterests.push({x:se,y:ie[ge].items[0].evaluate({x:se}),type:"isolated"}))),ne.op=="<"||ne.op==">"||ne.op=="!=")if("name"in ne.args[1]&&ne.args[1].name=="x"){se=ne.args[0].evaluate();let be=ie[ge].items[0].evaluate({x:se});ne.op=="!="&&(isNaN(be)&&(be=ie[ge].items[0].evaluate({x:se-1e-7})+ie[ge].items[0].evaluate({x:se+1e-7})/2),v.pointOfInterests.push({x:se,y:NaN,type:"unequal"})),pe=N.create("point",[se,be],{cssClass:"endpoint-open",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe)}else{se=ne.args[1].evaluate();let be=ie[ge].items[0].evaluate({x:se});ne.op=="!="&&(isNaN(be)&&(be=ie[ge].items[0].evaluate({x:se-1e-7})+ie[ge].items[0].evaluate({x:se+1e-7})/2),v.pointOfInterests.push({x:se,y:NaN,type:"unequal"})),pe=N.create("point",[se,be],{cssClass:"endpoint-open",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe)}}else ae=ne.params[0].evaluate(),ce=ne.params[2].evaluate(),ne.conditionals[0]=="smaller"?
488(pe=N.create("point",[ae,ie[ge].items[0].evaluate({x:ae})],{cssClass:"endpoint-open",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe)):(pe=N.create("point",[ae,ie[ge].items[0].evaluate({x:ae})],{cssClass:"endpoint-closed",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe)),ne.conditionals[1]=="smaller"?(pe=N.create("point",[ce,ie[ge].items[0].evaluate({x:ce})],{cssClass:"endpoint-open",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe)):(pe=N.create("point",[ce,ie[ge].items[0].evaluate({x:ce})],{cssClass:"endpoint-closed",fixed:!0,highlight:!1,withLabel:!1,size:4}),ve.push(pe));return ve}const GraphView=()=>{const v=reactExports.useRef(null),N=reactExports.useRef(null),G=reactExports.useRef(null),{functionDefinitions:z,cursorCoords:q,setCursorCoords:Y,setInputErrors:W,graphBounds:ie,PlayFunction:ne,playActiveRef:se,updateCursor:ae,setUpdateCursor:ce,setPlayFunction:pe,timerRef:ge,stepSize:ve,isAudioEnabled:be,setExplorationMode:Ee,explorationMode:Pe,setDiscreteBatchValidStartX:Je}=useGraphContext(),{announce:Ce}=useAnnouncement(),{getInstrumentByName:Ve}=useInstruments();let Re=[],qe;const et=reactExports.useRef(new Map),Ze=reactExports.useRef(new Map),tt=reactExports.useRef(new Map),Ke=reactExports.useRef(new Map),rt=reactExports.useRef(null),it=reactExports.useRef(null),ot=reactExports.useRef(null),ut=reactExports.useRef(new Map),ct=reactExports.useRef(null);reactExports.useRef(null);const at=reactExports.useRef([]),st=reactExports.useRef(null),pt=reactExports.useRef(null),lt=reactExports.useRef({}),vt=(Ct,Dt)=>{if(Ct==null||typeof Ct!="number"||!isFinite(Ct)||!Dt||!Dt.availablePitchClasses||Dt.availablePitchClasses.length===0)return null;const Gt=(Ct-ie.yMin)/(ie.yMax-ie.yMin),Ot=Math.max(0,Math.min(1,Gt)),It=Math.floor(Ot*Dt.availablePitchClasses.length);return Math.max(0,Math.min(It,Dt.availablePitchClasses.length-1))},dt=Ct=>{tt.current.forEach((Gt,Ot)=>{Gt.forEach(It=>{It&&Ct.objects[It.id]&&Ct.removeObject(It)})}),tt.current.clear(),getActiveFunctions(z).forEach((Gt,Ot)=>{const It=z.findIndex(ir=>ir.id===Gt.id),Bt=getLandmarksN(z,It),Ht=[];Bt.forEach((ir,zt)=>{const{x:tr,y:bt,shape:_t,label:Xt}=ir,At=_t||"diamond";try{let $t;const Pt={fixed:!0,highlight:!1,withLabel:!1,showInfobox:!1,name:`landmark_${Gt.id}_${zt}`,cssClass:`landmark-${At}`};switch(At){case"diamond":$t=Ct.create("point",[tr,bt],{...Pt,face:"<>",size:8});break;case"triangle":$t=Ct.create("point",[tr,bt],{...Pt,face:"^",size:9});break;case"square":$t=Ct.create("point",[tr,bt],{...Pt,face:"[]",size:6});break;default:$t=Ct.create("point",[tr,bt],{...Pt,face:"x"})}$t&&Ht.push($t)}catch($t){console.warn(`Error creating landmark symbol for ${At}:`,$t);const Pt=Ct.create("point",[tr,bt],{...baseOptions,face:"x"});Ht.push(Pt)}}),Ht.length>0&&tt.current.set(Gt.id,Ht)})};reactExports.useEffect(()=>{const Ct=JXG$1.JSXGraph.initBoard("jxgbox",{boundingbox:[ie.xMin,ie.yMax,ie.xMax,ie.yMin],grid:{cssClass:"grid",majorStep:ve},axis:{cssClass:"axis",needsRegularUpdate:!0,highlight:!1,ticks:{insertTicks:!0,majorHeight:5,minorHeight:3,ticksDistance:ve}},zoom:{enabled:!1,needShift:!1},pan:{enabled:!1,needShift:!1,needTwoFingers:!0},showCopyright:!1,showNavigation:!1});Ct.removeEventHandlers(),Ct.addPointerEventHandlers();const Dt=document.getElementById("jxgbox"),Gt=zt=>(zt.preventDefault(),zt.stopPropagation(),!1);Dt.addEventListener("click",Gt,!0),Dt.addEventListener("mousedown",Gt,!0),Dt.addEventListener("mouseup",Gt,!0),lt.current={preventClickHandler:Gt},G.current=Ct,qe=3/Ct.unitX;const Ot=getActiveFunctions(z);q&&Array.isArray(q)&&q.forEach(zt=>{ut.current.set(zt.functionId,{x:parseFloat(zt.x),y:parseFloat(zt.y)})}),et.current.clear(),Ze.current.clear(),tt.current.clear(),Ke.current.clear(),Ot.forEach(zt=>{let tr,bt,[_t,Xt]=checkMathSpell(zt);if(bt=_t,W(Mt=>{const Tt={...Mt};return Object.keys(Tt).forEach(Rt=>{(Rt===zt.id||Rt.startsWith(`${zt.id}_part_`))&&delete Tt[Rt]}),Tt}),Xt.length>0){let Mt=[],Tt=[],Rt=null;Xt.forEach(([Ft,Ut])=>{if(zt.type==="piecewise_function")if(Array.isArray(Ut)&&Ut.length>0&&Array.isArray(Ut[0]))Ut.forEach(([Zt,Wt])=>{Wt===0?(Mt[Zt]||(Mt[Zt]=[]),Mt[Zt].push(Ft)):(Tt[Zt]||(Tt[Zt]=[]),Tt[Zt].push(Ft))});else if(Array.isArray(Ut)&&Ut.length===2&&typeof Ut[0]=="number"){const[Zt,Wt]=Ut;Wt===0?(Mt[Zt]||(Mt[Zt]=[]),Mt[Zt].push(Ft)):(Tt[Zt]||(Tt[Zt]=[]),Tt[Zt].push(Ft))}else Rt=Ft;else Rt=Ft}),zt.type==="piecewise_function"?W(Ft=>({...Ft,[zt.id]:{functionErrors:Mt,conditionErrors:Tt,generalError:Rt}})):W(Ft=>({...Ft,[zt.id]:{generalError:Rt}})),bt="0",tr=0}else{W(Mt=>{const Tt={...Mt};return delete Tt[zt.id],Tt});try{tr=Ct.jc.snippet(bt,!0,"x",!0)}catch(Mt){console.error(`Error parsing expression for function ${zt.id}: `,Mt),W(Tt=>({...Tt,[zt.id]:{generalError:"Invalid function. Please check your input."}})),bt="0",tr=0}}Ke.current.set(zt.id,bt);const At=Ct.create("functiongraph",[tr],{cssClass:"curve",fixed:!0,highlight:!1,strokeColor:zt.color||"#0000FF"});if(bt!=="0")try{const Mt=createEndPoints(zt,Ct);Re=[...Re,...Mt]}catch(Mt){console.error(`Error creating endpoints for ${zt.functionName}:`,Mt),W(Tt=>({...Tt,[zt.id]:{message:"Error creating piecewise endpoints. Please check your input.",isGeneral:!0}}))}dt(Ct);let $t=ut.current.get(zt.id),Pt=q&&Array.isArray(q)?q.find(Mt=>Mt.functionId===zt.id):void 0,kt=0,jt=0;$t?(kt=$t.x,jt=$t.y):Pt&&(kt=parseFloat(Pt.x),jt=parseFloat(Pt.y));const wt=Ct.create("point",[kt,jt],{cssClass:"functionCursor",name:"",size:5,fixed:!0,highlight:!1,showInfobox:!1,fillColor:zt.color||"#0000FF",strokeColor:zt.color||"#0000FF"});et.current.set(zt.id,At),Ze.current.set(zt.id,wt)});const It=[],Bt=Math.ceil(ie.xMin/ve)*ve;for(let zt=Bt;zt<=ie.xMax;zt+=ve)It.push(zt);at.current=It,ct.current=null;const Ht=(zt,tr=null)=>{if(!Ct||!Ct.jc){console.warn("Board or board.jc not available for cursor update");return}let bt=[];Ot.forEach(Pt=>
488{Pt.pointOfInterests.forEach(kt=>{bt.push(kt.x)})});const _t=bt.filter(Pt=>Math.abs(Pt-zt)<qe);let Xt=_t.length>0?_t[0]:zt;const At=.02;Xt<=ie.xMin+At?Xt=ie.xMin+At:Xt>=ie.xMax-At&&(Xt=ie.xMax-At),rt.current={x:Xt};const $t=[];if(Ot.forEach(Pt=>{const kt=Ze.current.get(Pt.id),jt=et.current.get(Pt.id),wt=Ke.current.get(Pt.id);if(kt&&jt&&wt)try{const Mt=Ct.jc.snippet(wt,!0,"x",!0)(Xt);typeof Mt=="number"&&!isNaN(Mt)&&isFinite(Mt)?(kt.show(),kt.setPositionDirectly(JXG$1.COORDS_BY_USER,[Xt,Mt]),$t.push({functionId:Pt.id,x:Xt.toFixed(2),y:Mt.toFixed(2),mouseY:tr!==null?tr.toFixed(2):null})):(console.warn(`Invalid y value for function ${Pt.id} at x=${Xt}: ${Mt}`),kt.hide(),kt.setPositionDirectly(JXG$1.COORDS_BY_USER,[Xt,ie.yMax+10]),$t.push({functionId:Pt.id,x:Xt.toFixed(2),y:Mt.toString(),mouseY:tr!==null?tr.toFixed(2):null}))}catch(Mt){console.error(`Error updating cursor for function ${Pt.id}:`,Mt),kt.hide(),kt.setPositionDirectly(JXG$1.COORDS_BY_USER,[Xt,ie.yMax+10])}}),Y($t),$t.length===0&&rt.current&&rt.current.x!==Xt&&(rt.current={x:Xt}),it.current&&clearTimeout(it.current),it.current=null,Ct.update(),ve&&ve>0&&typeof zt=="number"&&!isNaN(zt)&&be){let Pt=Math.floor(zt/ve);Pt!==st.current&&(st.current=Pt)}};if(ce(()=>Ht),rt.current&&rt.current.x!==void 0&&Ht(rt.current.x),ut.current.clear(),ne.active){ne.source==="play"?Ee("batch"):ne.source==="keyboard"&&Ee("keyboard_smooth");let zt;if(ne.source==="play"?zt=ne.speed>0?ie.xMin:ie.xMax:ne.source==="keyboard"?(q&&q.length>0&&q[0].x!==void 0?zt=parseFloat(q[0].x):rt.current&&rt.current.x!==void 0?zt=rt.current.x:zt=ne.speed>0?ie.xMin:ie.xMax,zt>ie.xMax&&(zt=ie.xMax),zt<ie.xMin&&(zt=ie.xMin)):zt=ne.speed>0?ie.xMin:ie.xMax,ne.source==="play"&&ve&&ve>0){const tr=getActiveFunctions(z);if(tr.length>0){const bt=tr[0],_t=z.findIndex($t=>$t.id===bt.id),Xt=getFunctionInstrumentN(z,_t),At=Ve(Xt);if(At&&At.instrumentType===InstrumentFrequencyType.discretePitchClassBased){const $t=ne.speed>=0?1:-1,Pt=.02,kt=ve,jt=ve/10,wt=tr.map(Mt=>{const Tt=Ke.current.get(Mt.id);if(!Tt)return null;try{const Rt=Ct.jc.snippet(Tt,!0,"x",!0);return{func:Mt,expr:Tt,evaluator:Rt}}catch{return null}}).filter(Mt=>Mt!==null);if(wt.length>0){const Mt=new Map;wt.forEach(({func:Yt,evaluator:or})=>{try{const hr=or(zt);if(typeof hr=="number"&&isFinite(hr)){const sr=vt(hr,At);sr!==null&&Mt.set(Yt.id,sr)}}catch{}});let Tt=zt,Rt=0,Ft=!1,Ut=zt;const Zt=new Map;wt.forEach(({func:Yt})=>{Zt.set(Yt.id,!1)});const Wt=2e3;let qt=0;for(;qt<Wt&&(qt+=1,Tt+=$t*jt,Rt+=jt,!(Tt<=ie.xMin+Pt||Tt>=ie.xMax-Pt));){let Yt=!1;if(wt.forEach(({func:or,evaluator:hr})=>{const sr=Mt.get(or.id);if(sr!==void 0)try{const nr=hr(Tt);if(typeof nr!="number"||!isFinite(nr))return;const gt=vt(nr,At);if(gt===null)return;gt!==sr&&(Yt=!0,Zt.set(or.id,!0))}catch{}}),!Ft&&Rt>=kt&&Yt){Ft=!0,Ut=Tt;break}}if(!Ft&&wt.every(({func:or})=>Mt.get(or.id)===void 0?!0:Zt.get(or.id)===!1)){let or=zt+$t*kt;or<=ie.xMin+Pt?or=ie.xMin+Pt:or>=ie.xMax-Pt&&(or=ie.xMax-Pt),Ut=or}Je(Ut)}else Je(null)}else Je(null)}else Je(null)}else Je(null);ne.x=zt,ot.current=setInterval(()=>{if(!Ct||!Ct.jc){console.warn("Board not available for play function, stopping timer"),clearInterval(ot.current),ot.current=null,pe(_t=>({..._t,active:!1}));return}let tr;ne.source==="keyboard"?tr=Math.abs(ne.speed)*ne.direction:(ne.source,tr=ne.speed),ne.x+=(ie.xMax-ie.xMin)/(1e3/ne.interval)*(tr/100);const bt=.02;ne.x<=ie.xMin+bt?ne.x=ie.xMin+bt:ne.x>=ie.xMax-bt&&(ne.x=ie.xMax-bt),Ht(ne.x),ne.source==="play"?(ne.speed>0&&ne.x>=ie.xMax-bt||ne.speed<0&&ne.x<=ie.xMin+bt)&&(clearInterval(ot.current),ot.current=null,pe(Xt=>({...Xt,active:!1})),Ee("none")):(ne.x>=ie.xMax-bt||ne.x<=ie.xMin+bt)&&(clearInterval(ot.current),ot.current=null,pe(_t=>({..._t,active:!1})),Ee("none"))},ne.interval)}else ot.current!==null&&(clearInterval(ot.current),ot.current=null),Ct&&Ct.jc&&(rt.current&&rt.current.x!==void 0?Ht(rt.current.x):ne.x!==void 0&&Ht(ne.x));const ir=zt=>{if(Ct&&Ct.jc&&!se.current){Ee("mouse");const tr=Ct.getUsrCoordsOfMouse(zt),bt=tr[0],_t=tr[1];Ht(bt,_t),clearTimeout(pt.current),pt.current=setTimeout(()=>{Ee("none")},100)}};return Ct.on("move",ir,{passive:!0}),()=>{ot.current!==null&&(clearInterval(ot.current),ot.current=null),pt.current!==null&&(clearTimeout(pt.current),pt.current=null);
488const zt=document.getElementById("jxgbox");zt&&(zt.removeEventListener("click",lt.current.preventClickHandler,!0),zt.removeEventListener("mousedown",lt.current.preventClickHandler,!0),zt.removeEventListener("mouseup",lt.current.preventClickHandler,!0)),Ct.off("move",ir),Ct.unsuspendUpdate(),JXG$1.JSXGraph.freeBoard(Ct)}},[z,ie,ne.active,ne.source,ve]),reactExports.useEffect(()=>{se.current=ne.active},[ne.active]),reactExports.useEffect(()=>{G.current&&(G.current.setBoundingBox([ie.xMin,ie.yMax,ie.xMax,ie.yMin]),G.current.update())},[ie]),reactExports.useEffect(()=>{v.current&&v.current.focus()},[]),reactExports.useEffect(()=>{if(navigator.userAgent.toLowerCase().indexOf("firefox")>-1)return;let Dt;const Gt=()=>{clearTimeout(Dt),Dt=setTimeout(()=>{if(G.current&&N.current)try{const Ot=N.current,It=Ot.clientWidth,Bt=Ot.clientHeight;It>0&&Bt>0&&!isNaN(It)&&!isNaN(Bt)&&(G.current.resizeContainer(),G.current.update())}catch{}},200)};return window.addEventListener("resize",Gt),()=>{clearTimeout(Dt),window.removeEventListener("resize",Gt)}},[]);const xt=getActiveFunctions(z),ft=xt.length>0?xt[0]:null,Et=ft?ft.functionName:"No function";return jsxRuntimeExports.jsx("div",{ref:v,id:"chart",role:"application",tabIndex:0,"aria-label":`Interactive graph. Currently active: ${Et}`,style:{outline:"none",width:"100%",height:"100%",border:"2px solid transparent",borderRadius:"4px",transition:"border-color 0.2s ease"},onFocus:Ct=>{Ct.target.style.borderColor="var(--color-primary)",Ct.target.style.boxShadow="0 0 0 2px var(--color-primary)"},onBlur:Ct=>{Ct.target.style.borderColor="transparent",Ct.target.style.boxShadow="none"},children:jsxRuntimeExports.jsx("div",{ref:N,"aria-hidden":"true",role:"presentation",id:"jxgbox",style:{width:"100%",height:"100%",outline:"none"}})})};var reactDomExports=requireReactDom(),i$3=Object.defineProperty,d$2=(v,N,G)=>N in v?i$3(v,N,{enumerable:!0,configurable:!0,writable:!0,value:G}):v[N]=G,r$2=(v,N,G)=>(d$2(v,typeof N!="symbol"?N+"":N,G),G);let o$5=class{constructor(){r$2(this,"current",this.detect()),r$2(this,"handoffState","pending"),r$2(this,"currentId",0)}set(N){this.current!==N&&(this.handoffState="pending",this.currentId=0,this.current=N)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},s$5=new o$5;function o$4(v){var N,G;return s$5.isServer?null:v?"ownerDocument"in v?v.ownerDocument:"current"in v?(G=(N=v.current)==null?void 0:N.ownerDocument)!=null?G:document:null:document}function t$3(v){typeof queueMicrotask=="function"?queueMicrotask(v):Promise.resolve().then(v).catch(N=>setTimeout(()=>{throw N}))}function o$3(){let v=[],N={addEventListener(G,z,q,Y){return G.addEventListener(z,q,Y),N.add(()=>G.removeEventListener(z,q,Y))},requestAnimationFrame(...G){let z=requestAnimationFrame(...G);return N.add(()=>cancelAnimationFrame(z))},nextFrame(...G){return N.requestAnimationFrame(()=>N.requestAnimationFrame(...G))},setTimeout(...G){let z=setTimeout(...G);return N.add(()=>clearTimeout(z))},microTask(...G){let z={current:!0};return t$3(()=>{z.current&&G[0]()}),N.add(()=>{z.current=!1})},style(G,z,q){let Y=G.style.getPropertyValue(z);return Object.assign(G.style,{[z]:q}),this.add(()=>{Object.assign(G.style,{[z]:Y})})},group(G){let z=o$3();return G(z),this.add(()=>z.dispose())},add(G){return v.includes(G)||v.push(G),()=>{let z=v.indexOf(G);if(z>=0)for(let q of v.splice(z,1))q()}},dispose(){for(let G of v.splice(0))G()}};return N}function p$2(){let[v]=reactExports.useState(o$3);return reactExports.useEffect(()=>()=>v.dispose(),[v]),v}let n$3=(v,N)=>{s$5.isServer?reactExports.useEffect(v,N):reactExports.useLayoutEffect(v,N)};function s$4(v){let N=reactExports.useRef(v);return n$3(()=>{N.current=v},[v]),N}let o$2=function(v){let N=s$4(v);return U$3.useCallback((...G)=>N.current(...G),[N])},e$2=reactExports.createContext(void 0);function a$a(){return reactExports.useContext(e$2)}function t$2(...v){return Array.from(new Set(v.flatMap(N=>
vendor: 17,118 bytes, lines 488-491
488typeof N=="string"?N.split(" "):[]))).filter(Boolean).join(" ")}function u$4(v,N,...G){if(v in N){let q=N[v];return typeof q=="function"?q(...G):q}let z=new Error(`Tried to handle "${v}" but there is no handler defined. Only defined handlers are: ${Object.keys(N).map(q=>`"${q}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(z,u$4),z}var O$3=(v=>(v[v.None=0]="None",v[v.RenderStrategy=1]="RenderStrategy",v[v.Static=2]="Static",v))(O$3||{}),A$1=(v=>(v[v.Unmount=0]="Unmount",v[v.Hidden=1]="Hidden",v))(A$1||{});function L$1(){let v=U$2();return reactExports.useCallback(N=>C$3({mergeRefs:v,...N}),[v])}function C$3({ourProps:v,theirProps:N,slot:G,defaultTag:z,features:q,visible:Y=!0,name:W,mergeRefs:ie}){ie=ie??$$1;let ne=P$1(N,v);if(Y)return F$1(ne,G,z,W,ie);let se=q??0;if(se&2){let{static:ae=!1,...ce}=ne;if(ae)return F$1(ce,G,z,W,ie)}if(se&1){let{unmount:ae=!0,...ce}=ne;return u$4(ae?0:1,{0(){return null},1(){return F$1({...ce,hidden:!0,style:{display:"none"}},G,z,W,ie)}})}return F$1(ne,G,z,W,ie)}function F$1(v,N={},G,z,q){let{as:Y=G,children:W,refName:ie="ref",...ne}=h$2(v,["unmount","static"]),se=v.ref!==void 0?{[ie]:v.ref}:{},ae=typeof W=="function"?W(N):W;"className"in ne&&ne.className&&typeof ne.className=="function"&&(ne.className=ne.className(N)),ne["aria-labelledby"]&&ne["aria-labelledby"]===ne.id&&(ne["aria-labelledby"]=void 0);let ce={};if(N){let pe=!1,ge=[];for(let[ve,be]of Object.entries(N))typeof be=="boolean"&&(pe=!0),be===!0&&ge.push(ve.replace(/([A-Z])/g,Ee=>`-${Ee.toLowerCase()}`));if(pe){ce["data-headlessui-state"]=ge.join(" ");for(let ve of ge)ce[`data-${ve}`]=""}}if(Y===reactExports.Fragment&&(Object.keys(m$4(ne)).length>0||Object.keys(m$4(ce)).length>0))if(!reactExports.isValidElement(ae)||Array.isArray(ae)&&ae.length>1){if(Object.keys(m$4(ne)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${z} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(m$4(ne)).concat(Object.keys(m$4(ce))).map(pe=>`  - ${pe}`).join(`
489`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(pe=>`  - ${pe}`).join(`
490`)].join(`
491`))}else{let pe=ae.props,ge=pe==null?void 0:pe.className,ve=typeof ge=="function"?(...Pe)=>t$2(ge(...Pe),ne.className):t$2(ge,ne.className),be=ve?{className:ve}:{},Ee=P$1(ae.props,m$4(h$2(ne,["ref"])));for(let Pe in ce)Pe in Ee&&delete ce[Pe];return reactExports.cloneElement(ae,Object.assign({},Ee,ce,se,{ref:q(H$3(ae),se.ref)},be))}return reactExports.createElement(Y,Object.assign({},h$2(ne,["ref"]),Y!==reactExports.Fragment&&se,Y!==reactExports.Fragment&&ce),ae)}function U$2(){let v=reactExports.useRef([]),N=reactExports.useCallback(G=>{for(let z of v.current)z!=null&&(typeof z=="function"?z(G):z.current=G)},[]);return(...G)=>{if(!G.every(z=>z==null))return v.current=G,N}}function $$1(...v){return v.every(N=>N==null)?void 0:N=>{for(let G of v)G!=null&&(typeof G=="function"?G(N):G.current=N)}}function P$1(...v){if(v.length===0)return{};if(v.length===1)return v[0];let N={},G={};for(let z of v)for(let q in z)q.startsWith("on")&&typeof z[q]=="function"?(G[q]!=null||(G[q]=[]),G[q].push(z[q])):N[q]=z[q];if(N.disabled||N["aria-disabled"])for(let z in G)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(z)&&(G[z]=[q=>{var Y;return(Y=q==null?void 0:q.preventDefault)==null?void 0:Y.call(q)}]);for(let z in G)Object.assign(N,{[z](q,...Y){let W=G[z];for(let ie of W){if((q instanceof Event||(q==null?void 0:q.nativeEvent)instanceof Event)&&q.defaultPrevented)return;ie(q,...Y)}}});return N}function K(v){var N;return Object.assign(reactExports.forwardRef(v),{displayName:(N=v.displayName)!=null?N:v.name})}function m$4(v){let N=Object.assign({},v);for(let G in N)N[G]===void 0&&delete N[G];return N}function h$2(v,N=[]){let G=Object.assign({},v);for(let z of N)z in G&&delete G[z];return G}function H$3(v){return U$3.version.split(".")[0]>="19"?v.props.ref:v.ref}let a$9="span";var s$3=(v=>(v[v.None=1]="None",v[v.Focusable=2]="Focusable",v[v.Hidden=4]="Hidden",v))(s$3||{});function l$2(v,N){var G;let{features:z=1,...q}=v,Y={ref:N,"aria-hidden":(z&2)===2?!0:(G=q["aria-hidden"])!=null?G:void 0,hidden:(z&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(z&4)===4&&(z&2)!==2&&{display:"none"}}};return L$1()({ourProps:Y,theirProps:q,slot:{},defaultTag:a$9,name:"Hidden"})}let f$6=K(l$2),u$3=Symbol();function T$2(v,N=!0){return Object.assign(v,{[u$3]:N})}function y$2(...v){let N=reactExports.useRef(v);reactExports.useEffect(()=>{N.current=v},[v]);let G=o$2(z=>{for(let q of N.current)q!=null&&(typeof q=="function"?q(z):q.current=z)});return v.every(z=>z==null||(z==null?void 0:z[u$3]))?void 0:G}let a$8=reactExports.createContext(null);a$8.displayName="DescriptionContext";function f$5(){let v=reactExports.useContext(a$8);if(v===null){let N=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(N,f$5),N}return v}function w$3(){let[v,N]=reactExports.useState([]);return[v.length>0?v.join(" "):void 0,reactExports.useMemo(()=>function(G){let z=o$2(Y=>(N(W=>[...W,Y]),()=>N(W=>{let ie=W.slice(),ne=ie.indexOf(Y);return ne!==-1&&ie.splice(ne,1),ie}))),q=reactExports.useMemo(()=>({register:z,slot:G.slot,name:G.name,props:G.props,value:G.value}),[z,G.slot,G.name,G.props,G.value]);return U$3.createElement(a$8.Provider,{value:q},G.children)},[N])]}let S$1="p";function C$2(v,N){let G=reactExports.useId(),z=a$a(),{id:q=`headlessui-description-${G}`,...Y}=v,W=f$5(),ie=y$2(N);n$3(()=>W.register(q),[q,W.register]);let ne=z||!1,se=reactExports.useMemo(()=>({...W.slot,disabled:ne}),[W.slot,ne]),ae={ref:ie,...W.props,id:q};return L$1()({ourProps:ae,theirProps:Y,slot:se,defaultTag:S$1,name:W.name||"Description"})}let _$1=K(C$2),H$2=Object.assign(_$1,{});var o$1=(v=>(v.Space=" ",v.Enter="Enter",v.Escape="Escape",v.Backspace="Backspace",v.Delete="Delete",v.ArrowLeft="ArrowLeft",v.ArrowUp="ArrowUp",v.ArrowRight="ArrowRight",v.ArrowDown="ArrowDown",v.Home="Home",v.End="End",v.PageUp="PageUp",v.PageDown="PageDown",v.Tab="Tab",v))(o$1||{});let e$1=reactExports.createContext(()=>{});function C$1({value:v,children:N}){return U$3.createElement(e$1.Provider,{value:v},N)}let a$7=class extends Map{constructor(N){super(),this.factory=N}get(N){let G=super.get(N);return G===void 0&&(G=this.factory(N),this.set(N,G)),G}};function a$6(v,N){let G=v(),z=new Set;return{getSnapshot(){return G},subscribe(q){return z.add(q),()=>z.delete(q)},dispatch(q,...Y){let W=N[q].call(G,...Y);W&&(G=W,z.forEach(ie=>ie()))}}}function o(v){return reactExports.useSyncExternalStore(v.subscribe,v.getSnapshot,v.getSnapshot)}let p$1=new a$7(()=>a$6(()=>[],{ADD(v){return this.includes(v)?this:[...this,v]},REMOVE(v){let N=this.indexOf(v);if(N===-1)return this;let G=this.slice();return G.splice(N,1),G}}));function x$2(v,N){let G=p$1.get(N),z=reactExports.useId(),q=o(G);if(n$3(()=>{if(v)return G.dispatch("ADD",z),()=>G.dispatch("REMOVE",z)},[G,v]),!v)return!1;let Y=q.indexOf(z),W=q.length;return Y===-1&&(Y=W,W+=1),Y===W-1}let f$4=new Map,u$2=new Map;function h$1(v){var N;let G=(N=u$2.get(v))!=null?N:0;return u$2.set(v,G+1),G!==0?()=>m$3(v):(f$4.set(v,{"aria-hidden":v.getAttribute("aria-hidden"),inert:v.inert}),v.setAttribute("aria-hidden","true"),v.inert=!0,()=>m$3(v))}function m$3(v){var N;let G=(N=u$2.get(v))!=null?N:1;if(G===1?u$2.delete(v):u$2.set(v,G-1),G!==1)return;let z=f$4.get(v);z&&(z["aria-hidden"]===null?v.removeAttribute("aria-hidden"):v.setAttribute("aria-hidden",z["aria-hidden"]),v.inert=z.inert,f$4.delete(v))}function y$1(v,{allowed:N,disallowed:G}={}){let z=x$2(v,"inert-others");n$3(()=>{var q,Y;if(!z)return;let W=o$3();for(let ne of(q=G==null?void 0:G())!=null?q:[])ne&&W.add(h$1(ne));let ie=(Y=N==null?void 0:N())!=null?Y:[];for(let ne of ie){if(!ne)continue;let se=o$4(ne);if(!se)continue;let ae=ne.parentElement;for(;ae&&ae!==se.body;){for(let ce of ae.children)ie.some(pe=>ce.contains(pe))||W.add(h$1(ce));ae=ae.parentElement}}return W.dispose},[z,N,G])}function m$2(v,N,G){let z=s$4(q=>{let Y=q.getBoundingClientRect();Y.x===0&&Y.y===0&&Y.width===0&&Y.height===0&&G()});reactExports.useEffect(()=>{if(!v)return;let q=N===null?null:N instanceof HTMLElement?N:N.current;if(!q)return;let Y=o$3();if(typeof ResizeObserver<"u"){let W=new ResizeObserver(()=>z.current(q));W.observe(q),Y.add(()=>W.disconnect())}if(typeof IntersectionObserver<"u"){let W=new IntersectionObserver(()=>z.current(q));W.observe(q),Y.add(()=>W.disconnect())}return()=>Y.dispose()},[N,z,v])}let f$3=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(v=>`${v}:not([tabindex='-1'])`).join(","),p=["[data-autofocus]"].map(v=>`${v}:not([tabindex='-1'])`).join(",");var F=(v=>(v[v.First=1]="First",v[v.Previous=2]="Previous",v[v.Next=4]="Next",v[v.Last=8]="Last",v[v.WrapAround=16]="WrapAround",v[v.NoScroll=32]="NoScroll",v[v.AutoFocus=64]="AutoFocus",v))(F||{}),T$1=(v=>(v[v.Error=0]="Error",v[v.Overflow=1]="Overflow",v[v.Success=2]="Success",v[v.Underflow=3]="Underflow",v))(T$1||{}),y=(v=>(v[v.Previous=-1]="Previous",v[v.Next=1]="Next",v))(y||{});function b$2(v=document.body){return v==null?[]:Array.from(v.querySelectorAll(f$3)).sort((N,G)=>Math.sign((N.tabIndex||Number.MAX_SAFE_INTEGER)-(G.tabIndex||Number.MAX_SAFE_INTEGER)))}function S(v=document.body){return v==null?[]:Array.from(v.querySelectorAll(p)).sort((N,G)=>Math.sign((N.tabIndex||Number.MAX_SAFE_INTEGER)-(G.tabIndex||Number.MAX_SAFE_INTEGER)))}var h=(v=>(v[v.Strict=0]="Strict",v[v.Loose=1]="Loose",v))(h||{});function A(v,N=0){var G;return v===((G=o$4(v))==null?void 0:G.body)?!1:u$4(N,{0(){return v.matches(f$3)},1(){let z=v;for(;z!==null;){if(z.matches(f$3))return!0;z=z.parentElement}return!1}})}var H$1=(v=>(v[v.Keyboard=0]="Keyboard",v[v.Mouse=1]="Mouse",v))(H$1||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",v=>{v.metaKey||v.altKey||v.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",v=>{v.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:v.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function I$2(v){v==null||v.focus({preventScroll:!0})}let w$2=["textarea","input"].join(",");function O$2(v){var N,G;return(G=(N=v==null?void 0:v.matches)==null?void 0:N.call(v,w$2))!=null?G:!1}function _(v,N=G=>G){return v.slice().sort((G,z)=>{let q=N(G),Y=N(z);if(q===null||Y===null)return 0;let W=q.compareDocumentPosition(Y);return W&Node.DOCUMENT_POSITION_FOLLOWING?-1:W&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function P(v,N,{sorted:G=!0,relativeTo:z=null,skipElements:q=[]}={}){let Y=Array.isArray(v)?v.length>0?v[0].ownerDocument:document:v.ownerDocument,W=Array.isArray(v)?G?_(v):v:N&64?S(v):b$2(v);q.length>0&&W.length>1&&(W=W.filter(ge=>!q.some(ve=>ve!=null&&"current"in ve?(ve==null?void 0:ve.current)===ge:ve===ge))),z=z??Y.activeElement;let ie=(()=>{if(N&5)return 1;if(N&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),ne=(()=>{if(N&1)return 0;if(N&2)return Math.max(0,W.indexOf(z))-1;if(N&4)return Math.max(0,W.indexOf(z))+1;if(N&8)return W.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),se=N&32?{preventScroll:!0}:{},ae=0,ce=W.length,pe;do{if(ae>=ce||ae+ce<=0)return 0;let ge=ne+ae;if(N&16)ge=(ge+ce)%ce;else{if(ge<0)return 3;if(ge>=ce)return 1}pe=W[ge],pe==null||pe.focus(se),ae+=ie}while(pe!==Y.activeElement);return N&6&&O$2(pe)&&pe.select(),2}function t$1(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function i$2(){return/Android/gi.test(window.navigator.userAgent)}function n$2(){return t$1()||i$2()}function i$1(v,N,G,z){let q=s$4(G);reactExports.useEffect(()=>{if(!v)return;function Y(W){q.current(W)}return document.addEventListener(N,Y,z),()=>document.removeEventListener(N,Y,z)},[v,N,z])}function s$2(v,N,G,z){let q=s$4(G);reactExports.useEffect(()=>{if(!v)return;function Y(W){q.current(W)}return window.addEventListener(N,Y,z),()=>window.removeEventListener(N,Y,z)},[v,N,z])}const E$1=30;function R$2(v,N,G){let z=x$2(v,"outside-click"),q=s$4(G),Y=reactExports.useCallback(function(ne,se){if(ne.defaultPrevented)return;let ae=se(ne);if(ae===null||!ae.getRootNode().contains(ae)||!ae.isConnected)return;let ce=function pe(ge){return typeof ge=="function"?pe(ge()):Array.isArray(ge)||ge instanceof Set?ge:[ge]}(N);for(let pe of ce)if(pe!==null&&(pe.contains(ae)||ne.composed&&ne.composedPath().includes(pe)))return;return!A(ae,h.Loose)&&ae.tabIndex!==-1&&ne.preventDefault(),q.current(ne,ae)},[q,N]),W=reactExports.useRef(null);i$1(z,"pointerdown",ne=>{var se,ae;W.current=((ae=(se=ne.composedPath)==null?void 0:se.call(ne))==null?void 0:ae[0])||ne.target},!0),i$1(z,"mousedown",ne=>{var se,ae;W.current=((ae=(se=ne.composedPath)==null?void 0:se.call(ne))==null?void 0:ae[0])||ne.target},!0),i$1(z,"click",ne=>{n$2()||W.current&&(Y(ne,()=>W.current),W.current=null)},!0);let ie=reactExports.useRef({x:0,y:0});i$1(z,"touchstart",ne=>{ie.current.x=ne.touches[0].clientX,ie.current.y=ne.touches[0].clientY},!0),i$1(z,"touchend",ne=>{let se={x:ne.changedTouches[0].clientX,y:ne.changedTouches[0].clientY};if(!(Math.abs(se.x-ie.current.x)>=E$1||Math.abs(se.y-ie.current.y)>=E$1))return Y(ne,()=>ne.target instanceof HTMLElement?ne.target:null)},!0),s$2(z,"blur",ne=>Y(ne,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function n$1(...v){return reactExports.useMemo(()=>o$4(...v),[...v])}function E(v,N,G,z){let q=s$4(G);reactExports.useEffect(()=>{v=v??window;function Y(W){q.current(W)}return v.addEventListener(N,Y,z),()=>v.removeEventListener(N,Y,z)},[v,N,z])}function d$1(){let v;return{before({doc:N}){var G;let z=N.documentElement,q=(G=N.defaultView)!=null?G:window;v=Math.max(0,q.innerWidth-z.clientWidth)},after({doc:N,d:G}){let z=N.documentElement,q=Math.max(0,z.clientWidth-z.offsetWidth),Y=Math.max(0,v-q);G.style(z,"paddingRight",`${Y}px`)}}}function d(){return t$1()?{before({doc:v,d:N,meta:G}){function z(q){return G.containers.flatMap(Y=>Y()).some(Y=>Y.contains(q))}N.microTask(()=>{var q;if(window.getComputedStyle(v.documentElement).scrollBehavior!=="auto"){let ie=o$3();ie.style(v.documentElement,"scrollBehavior","auto"),N.add(()=>N.microTask(()=>ie.dispose()))}let Y=(q=window.scrollY)!=null?q:window.pageYOffset,W=null;N.addEventListener(v,"click",ie=>{if(ie.target instanceof HTMLElement)try{let ne=ie.target.closest("a");if(!ne)return;let{hash:se}=new URL(ne.href),ae=v.querySelector(se);ae&&!z(ae)&&(W=ae)}catch{}},!0),N.addEventListener(v,"touchstart",ie=>{if(ie.target instanceof HTMLElement)if(z(ie.target)){let ne=ie.target;for(;ne.parentElement&&z(ne.parentElement);)ne=ne.parentElement;N.style(ne,"overscrollBehavior","contain")}else N.style(ie.target,"touchAction","none")}),N.addEventListener(v,"touchmove",ie=>{if(ie.target instanceof HTMLElement){if(ie.target.tagName==="INPUT")return;if(z(ie.target)){let ne=ie.target;for(;ne.parentElement&&ne.dataset.headlessuiPortal!==""&&!(ne.scrollHeight>ne.clientHeight||ne.scrollWidth>ne.clientWidth);)ne=ne.parentElement;ne.dataset.headlessuiPortal===""&&ie.preventDefault()}else ie.preventDefault()}},{passive:!1}),N.add(()=>{var ie;let ne=(ie=window.scrollY)!=null?ie:window.pageYOffset;Y!==ne&&window.scrollTo(0,Y),W&&W.isConnected&&(W.scrollIntoView({block:"nearest"}),W=null)})})}}:{}}function r$1(){return{before({doc:v,d:N}){N.style(v.documentElement,"overflow","hidden")}}}function m$1(v){let N={};for(let G of v)Object.assign(N,G(N));return N}let a$5=a$6(()=>new Map,{PUSH(v,N){var G;let z=(G=this.get(v))!=null?G:{doc:v,count:0,d:o$3(),meta:new Set};return z.count++,z.meta.add(N),this.set(v,z),this},POP(v,N){let G=this.get(v);return G&&(G.count--,G.meta.delete(N)),this},SCROLL_PREVENT({doc:v,d:N,meta:G}){let z={doc:v,d:N,meta:m$1(G)},q=[d(),d$1(),r$1()];q.forEach(({before:Y})=>Y==null?void 0:Y(z)),q.forEach(({after:Y})=>Y==null?void 0:Y(z))},SCROLL_ALLOW({d:v}){v.dispose()},TEARDOWN({doc:v}){this.delete(v)}});a$5.subscribe(()=>{let v=a$5.getSnapshot(),N=new Map;for(let[G]of v)N.set(G,G.documentElement.style.overflow);for(let G of v.values()){let z=N.get(G.doc)==="hidden",q=G.count!==0;(q&&!z||!q&&z)&&a$5.dispatch(G.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",G),G.count===0&&a$5.dispatch("TEARDOWN",G)}});function a$4(v,N,G=()=>({containers:[]})){let z=o(a$5),q=N?z.get(N):void 0,Y=q?q.count>0:!1;return n$3(()=>{if(!(!N||!v))return a$5.dispatch("PUSH",N,G),()=>a$5.dispatch("POP",N,G)},[v,N]),Y}function f$2(v,N,G=()=>[document.body]){let z=x$2(v,"scroll-lock");a$4(z,N,q=>{var Y;
491return{containers:[...(Y=q.containers)!=null?Y:[],G]}})}function c$2(v=0){let[N,G]=reactExports.useState(v),z=reactExports.useCallback(ne=>G(ne),[N]),q=reactExports.useCallback(ne=>G(se=>se|ne),[N]),Y=reactExports.useCallback(ne=>(N&ne)===ne,[N]),W=reactExports.useCallback(ne=>G(se=>se&~ne),[G]),ie=reactExports.useCallback(ne=>G(se=>se^ne),[G]);return{flags:N,setFlag:z,addFlag:q,hasFlag:Y,removeFlag:W,toggleFlag:ie}}var define_process_env_default={},T,b$1;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((T=process==null?void 0:define_process_env_default)==null?void 0:T.NODE_ENV)==="test"&&typeof((b$1=Element==null?void 0:Element.prototype)==null?void 0:b$1.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
492`)),[]});var L=(v=>(v[v.None=0]="None",v[v.Closed=1]="Closed",v[v.Enter=2]="Enter",v[v.Leave=4]="Leave",v))(L||{});function R$1(v){let N={};for(let G in v)v[G]===!0&&(N[`data-${G}`]="");return N}function x$1(v,N,G,z){let[q,Y]=reactExports.useState(G),{hasFlag:W,addFlag:ie,removeFlag:ne}=c$2(v&&q?3:0),se=reactExports.useRef(!1),ae=reactExports.useRef(!1),ce=p$2();return n$3(()=>{var pe;if(v){if(G&&Y(!0),!N){G&&ie(3);return}return(pe=z==null?void 0:z.start)==null||pe.call(z,G),C(N,{inFlight:se,prepare(){ae.current?ae.current=!1:ae.current=se.current,se.current=!0,!ae.current&&(G?(ie(3),ne(4)):(ie(4),ne(2)))},run(){ae.current?G?(ne(3),ie(4)):(ne(4),ie(3)):G?ne(1):ie(1)},done(){var ge;ae.current&&typeof N.getAnimations=="function"&&N.getAnimations().length>0||(se.current=!1,ne(7),G||Y(!1),(ge=z==null?void 0:z.end)==null||ge.call(z,G))}})}},[v,G,N,ce]),v?[q,{closed:W(1),enter:W(2),leave:W(4),transition:W(2)||W(4)}]:[G,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function C(v,{prepare:N,run:G,done:z,inFlight:q}){let Y=o$3();return j$1(v,{prepare:N,inFlight:q}),Y.nextFrame(()=>{G(),Y.requestAnimationFrame(()=>{Y.add(M$2(v,z))})}),Y.dispose}function M$2(v,N){var G,z;let q=o$3();if(!v)return q.dispose;let Y=!1;q.add(()=>{Y=!0});let W=(z=(G=v.getAnimations)==null?void 0:G.call(v).filter(ie=>ie instanceof CSSTransition))!=null?z:[];return W.length===0?(N(),q.dispose):(Promise.allSettled(W.map(ie=>ie.finished)).then(()=>{Y||N()}),q.dispose)}function j$1(v,{inFlight:N,prepare:G}){if(N!=null&&N.current){G();return}let z=v.style.transition;v.style.transition="none",G(),v.offsetHeight,v.style.transition=z}function m(v,N){let G=reactExports.useRef([]),z=o$2(v);reactExports.useEffect(()=>{let q=[...G.current];for(let[Y,W]of N.entries())if(G.current[Y]!==W){let ie=z(N,q);return G.current=N,ie}},[z,...N])}let n=reactExports.createContext(null);n.displayName="OpenClosedContext";var i=(v=>(v[v.Open=1]="Open",v[v.Closed=2]="Closed",v[v.Closing=4]="Closing",v[v.Opening=8]="Opening",v))(i||{});function u$1(){return reactExports.useContext(n)}function c$1({value:v,children:N}){return U$3.createElement(n.Provider,{value:v},N)}function s$1({children:v}){return U$3.createElement(n.Provider,{value:null},v)}function t(v){function N(){document.readyState!=="loading"&&(v(),document.removeEventListener("DOMContentLoaded",N))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",N),N())}let r=[];t(()=>{function v(N){if(!(N.target instanceof HTMLElement)||N.target===document.body||r[0]===N.target)return;let G=N.target;G=G.closest(f$3),r.unshift(G??N.target),r=r.filter(z=>z!=null&&z.isConnected),r.splice(10)}window.addEventListener("click",v,{capture:!0}),window.addEventListener("mousedown",v,{capture:!0}),window.addEventListener("focus",v,{capture:!0}),document.body.addEventListener("click",v,{capture:!0}),document.body.addEventListener("mousedown",v,{capture:!0}),document.body.addEventListener("focus",v,{capture:!0})});function c(v){let N=o$2(v),G=reactExports.useRef(!1);reactExports.useEffect(()=>(G.current=!1,()=>{G.current=!0,t$3(()=>{G.current&&N()})}),[N])}function s(){let v=typeof document>"u";return"useSyncExternalStore"in t$4?(N=>N.useSyncExternalStore)(t$4)(()=>()=>{},()=>!1,()=>!v):!1}function l$1(){let v=s(),[N,G]=reactExports.useState(s$5.isHandoffComplete);return N&&s$5.isHandoffComplete===!1&&G(!1),reactExports.useEffect(()=>{N!==!0&&G(!0)},[N]),reactExports.useEffect(()=>s$5.handoff(),[]),v?!1:N}let e=reactExports.createContext(!1);function a$3(){return reactExports.useContext(e)}function l(v){return U$3.createElement(e.Provider,{value:v.force},v.children)}function j(v){let N=a$3(),G=reactExports.useContext(H),[z,q]=reactExports.useState(()=>{var Y;if(!N&&G!==null)return(Y=G.current)!=null?Y:null;if(s$5.isServer)return null;let W=v==null?void 0:v.getElementById("headlessui-portal-root");
vendor: 9,273 bytes, line 492
492if(W)return W;if(v===null)return null;let ie=v.createElement("div");return ie.setAttribute("id","headlessui-portal-root"),v.body.appendChild(ie)});return reactExports.useEffect(()=>{z!==null&&(v!=null&&v.body.contains(z)||v==null||v.body.appendChild(z))},[z,v]),reactExports.useEffect(()=>{N||G!==null&&q(G.current)},[G,q,N]),z}let M$1=reactExports.Fragment,I$1=K(function(v,N){let{ownerDocument:G=null,...z}=v,q=reactExports.useRef(null),Y=y$2(T$2(ge=>{q.current=ge}),N),W=n$1(q),ie=G??W,ne=j(ie),[se]=reactExports.useState(()=>{var ge;return s$5.isServer?null:(ge=ie==null?void 0:ie.createElement("div"))!=null?ge:null}),ae=reactExports.useContext(g),ce=l$1();n$3(()=>{!ne||!se||ne.contains(se)||(se.setAttribute("data-headlessui-portal",""),ne.appendChild(se))},[ne,se]),n$3(()=>{if(se&&ae)return ae.register(se)},[ae,se]),c(()=>{var ge;!ne||!se||(se instanceof Node&&ne.contains(se)&&ne.removeChild(se),ne.childNodes.length<=0&&((ge=ne.parentElement)==null||ge.removeChild(ne)))});let pe=L$1();return ce?!ne||!se?null:reactDomExports.createPortal(pe({ourProps:{ref:Y},theirProps:z,slot:{},defaultTag:M$1,name:"Portal"}),se):null});function J(v,N){let G=y$2(N),{enabled:z=!0,ownerDocument:q,...Y}=v,W=L$1();return z?U$3.createElement(I$1,{...Y,ownerDocument:q,ref:G}):W({ourProps:{ref:G},theirProps:Y,slot:{},defaultTag:M$1,name:"Portal"})}let X$2=reactExports.Fragment,H=reactExports.createContext(null);function k$1(v,N){let{target:G,...z}=v,q={ref:y$2(N)},Y=L$1();return U$3.createElement(H.Provider,{value:G},Y({ourProps:q,theirProps:z,defaultTag:X$2,name:"Popover.Group"}))}let g=reactExports.createContext(null);function le(){let v=reactExports.useContext(g),N=reactExports.useRef([]),G=o$2(Y=>(N.current.push(Y),v&&v.register(Y),()=>z(Y))),z=o$2(Y=>{let W=N.current.indexOf(Y);W!==-1&&N.current.splice(W,1),v&&v.unregister(Y)}),q=reactExports.useMemo(()=>({register:G,unregister:z,portals:N}),[G,z,N]);return[N,reactExports.useMemo(()=>function({children:Y}){return U$3.createElement(g.Provider,{value:q},Y)},[q])]}let B=K(J),D$1=K(k$1),oe=Object.assign(B,{Group:D$1});function a$2(v,N=typeof document<"u"?document.defaultView:null,G){let z=x$2(v,"escape");E(N,"keydown",q=>{z&&(q.defaultPrevented||q.key===o$1.Escape&&G(q))})}function f$1(){var v;let[N]=reactExports.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[G,z]=reactExports.useState((v=N==null?void 0:N.matches)!=null?v:!1);return n$3(()=>{if(!N)return;function q(Y){z(Y.matches)}return N.addEventListener("change",q),()=>N.removeEventListener("change",q)},[N]),G}function R({defaultContainers:v=[],portals:N,mainTreeNode:G}={}){let z=n$1(G),q=o$2(()=>{var Y,W;let ie=[];for(let ne of v)ne!==null&&(ne instanceof HTMLElement?ie.push(ne):"current"in ne&&ne.current instanceof HTMLElement&&ie.push(ne.current));if(N!=null&&N.current)for(let ne of N.current)ie.push(ne);for(let ne of(Y=z==null?void 0:z.querySelectorAll("html > *, body > *"))!=null?Y:[])ne!==document.body&&ne!==document.head&&ne instanceof HTMLElement&&ne.id!=="headlessui-portal-root"&&(G&&(ne.contains(G)||ne.contains((W=G==null?void 0:G.getRootNode())==null?void 0:W.host))||ie.some(se=>ne.contains(se))||ie.push(ne));return ie});return{resolveContainers:q,contains:o$2(Y=>q().some(W=>W.contains(Y)))}}let a$1=reactExports.createContext(null);function O$1({children:v,node:N}){let[G,z]=reactExports.useState(null),q=b(N??G);return U$3.createElement(a$1.Provider,{value:q},v,q===null&&U$3.createElement(f$6,{features:s$3.Hidden,ref:Y=>{var W,ie;if(Y){for(let ne of(ie=(W=o$4(Y))==null?void 0:W.querySelectorAll("html > *, body > *"))!=null?ie:[])if(ne!==document.body&&ne!==document.head&&ne instanceof HTMLElement&&ne!=null&&ne.contains(Y)){z(ne);break}}}}))}function b(v=null){var N;return(N=reactExports.useContext(a$1))!=null?N:v}function f(){let v=reactExports.useRef(!1);return n$3(()=>(v.current=!0,()=>{v.current=!1}),[]),v}var a=(v=>(v[v.Forwards=0]="Forwards",v[v.Backwards=1]="Backwards",v))(a||{});function u(){let v=reactExports.useRef(0);return s$2(!0,"keydown",N=>{N.key==="Tab"&&(v.current=N.shiftKey?1:0)},!0),v}function U$1(v){if(!v)return new Set;if(typeof v=="function")return new Set(v());let N=new Set;for(let G of v.current)G.current instanceof HTMLElement&&N.add(G.current);return N}let Z="div";var x=(v=>(v[v.None=0]="None",v[v.InitialFocus=1]="InitialFocus",v[v.TabLock=2]="TabLock",v[v.FocusLock=4]="FocusLock",v[v.RestoreFocus=8]="RestoreFocus",v[v.AutoFocus=16]="AutoFocus",v))(x||{});function $(v,N){let G=reactExports.useRef(null),z=y$2(G,N),{initialFocus:q,initialFocusFallback:Y,containers:W,features:ie=15,...ne}=v;l$1()||(ie=0);let se=n$1(G);ee(ie,{ownerDocument:se});let ae=te(ie,{ownerDocument:se,container:G,initialFocus:q,initialFocusFallback:Y});re(ie,{ownerDocument:se,container:G,containers:W,previousActiveElement:ae});let ce=u(),pe=o$2(Je=>{let Ce=G.current;Ce&&(Ve=>Ve())(()=>{u$4(ce.current,{[a.Forwards]:()=>{P(Ce,F.First,{skipElements:[Je.relatedTarget,Y]})},[a.Backwards]:()=>{P(Ce,F.Last,{skipElements:[Je.relatedTarget,Y]})}})})}),ge=x$2(!!(ie&2),"focus-trap#tab-lock"),ve=p$2(),be=reactExports.useRef(!1),Ee={ref:z,onKeyDown(Je){Je.key=="Tab"&&(be.current=!0,ve.requestAnimationFrame(()=>{be.current=!1}))},onBlur(Je){if(!(ie&4))return;let Ce=U$1(W);G.current instanceof HTMLElement&&Ce.add(G.current);let Ve=Je.relatedTarget;Ve instanceof HTMLElement&&Ve.dataset.headlessuiFocusGuard!=="true"&&(I(Ce,Ve)||(be.current?P(G.current,u$4(ce.current,{[a.Forwards]:()=>F.Next,[a.Backwards]:()=>F.Previous})|F.WrapAround,{relativeTo:Je.target}):Je.target instanceof HTMLElement&&I$2(Je.target)))}},Pe=L$1();return U$3.createElement(U$3.Fragment,null,ge&&U$3.createElement(f$6,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:pe,features:s$3.Focusable}),Pe({ourProps:Ee,theirProps:ne,defaultTag:Z,name:"FocusTrap"}),ge&&U$3.createElement(f$6,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:pe,features:s$3.Focusable}))}let D=K($),ye=Object.assign(D,{features:x});function w$1(v=!0){let N=reactExports.useRef(r.slice());return m(([G],[z])=>{z===!0&&G===!1&&t$3(()=>{N.current.splice(0)}),z===!1&&G===!0&&(N.current=r.slice())},[v,r,N]),o$2(()=>{var G;return(G=N.current.find(z=>z!=null&&z.isConnected))!=null?G:null})}function ee(v,{ownerDocument:N}){let G=!!(v&8),z=w$1(G);m(()=>{G||(N==null?void 0:N.activeElement)===(N==null?void 0:N.body)&&I$2(z())},[G]),c(()=>{G&&I$2(z())})}function te(v,{ownerDocument:N,container:G,initialFocus:z,initialFocusFallback:q}){let Y=reactExports.useRef(null),W=x$2(!!(v&1),"focus-trap#initial-focus"),ie=f();return m(()=>{if(v===0)return;if(!W){q!=null&&q.current&&I$2(q.current);return}let ne=G.current;ne&&t$3(()=>{if(!ie.current)return;let se=N==null?void 0:N.activeElement;if(z!=null&&z.current){if((z==null?void 0:z.current)===se){Y.current=se;return}}else if(ne.contains(se)){Y.current=se;return}if(z!=null&&z.current)I$2(z.current);else{if(v&16){if(P(ne,F.First|F.AutoFocus)!==T$1.Error)return}else if(P(ne,F.First)!==T$1.Error)return;if(q!=null&&q.current&&(I$2(q.current),(N==null?void 0:N.activeElement)===q.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}Y.current=N==null?void 0:N.activeElement})},[q,W,v]),Y}function re(v,{ownerDocument:N,container:G,containers:z,previousActiveElement:q}){let Y=f(),W=!!(v&4);E(N==null?void 0:N.defaultView,"focus",ie=>{if(!W||!Y.current)return;let ne=U$1(z);G.current instanceof HTMLElement&&ne.add(G.current);let se=q.current;if(!se)return;let ae=ie.target;ae&&ae instanceof HTMLElement?I(ne,ae)?(q.current=ae,I$2(ae)):(ie.preventDefault(),ie.stopPropagation(),I$2(se)):I$2(q.current)},!0)}function I(v,N){for(let G of v)if(G.contains(N))return!0;return!1}function ue(v){var N;return!!(v.enter||v.enterFrom||v.enterTo||v.leave||v.leaveFrom||v.leaveTo)||((N=v.as)!=null?N:de)!==reactExports.Fragment||U$3.Children.count(v.children)===1}let w=reactExports.createContext(null);w.displayName="TransitionContext";var _e=(v=>(v.Visible="visible",v.Hidden="hidden",v))(_e||{});function De(){let v=reactExports.useContext(w);if(v===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return v}function He$1(){let v=reactExports.useContext(M);if(v===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return v}let M=reactExports.createContext(null);M.displayName="NestingContext";function U(v){return"children"in v?U(v.children):v.current.filter(({el:N})=>N.current!==null).filter(({state:N})=>N==="visible").length>0}function Te(v,N){let G=s$4(v),z=reactExports.useRef([]),q=f(),Y=p$2(),W=o$2((ge,ve=A$1.Hidden)=>{let be=z.current.findIndex(({el:Ee})=>Ee===ge);be!==-1&&(u$4(ve,{[A$1.Unmount](){z.current.splice(be,1)},[A$1.Hidden](){z.current[be].state="hidden"}}),Y.microTask(()=>{var Ee;!U(z)&&q.current&&((Ee=G.current)==null||Ee.call(G))}))}),ie=o$2(ge=>{let ve=z.current.find(({el:be})=>be===ge);return ve?ve.state!=="visible"&&(ve.state="visible"):z.current.push({el:ge,state:"visible"}),()=>W(ge,A$1.Unmount)}),ne=reactExports.useRef([]),se=reactExports.useRef(Promise.resolve()),ae=reactExports.useRef({enter:[],leave:[]}
vendor: 4,284 bytes, line 492
492),ce=o$2((ge,ve,be)=>{ne.current.splice(0),N&&(N.chains.current[ve]=N.chains.current[ve].filter(([Ee])=>Ee!==ge)),N==null||N.chains.current[ve].push([ge,new Promise(Ee=>{ne.current.push(Ee)})]),N==null||N.chains.current[ve].push([ge,new Promise(Ee=>{Promise.all(ae.current[ve].map(([Pe,Je])=>Je)).then(()=>Ee())})]),ve==="enter"?se.current=se.current.then(()=>N==null?void 0:N.wait.current).then(()=>be(ve)):be(ve)}),pe=o$2((ge,ve,be)=>{Promise.all(ae.current[ve].splice(0).map(([Ee,Pe])=>Pe)).then(()=>{var Ee;(Ee=ne.current.shift())==null||Ee()}).then(()=>be(ve))});return reactExports.useMemo(()=>({children:z,register:ie,unregister:W,onStart:ce,onStop:pe,wait:se,chains:ae}),[ie,W,z,ce,pe,ae,se])}let de=reactExports.Fragment,fe=O$3.RenderStrategy;function Ae(v,N){var G,z;let{transition:q=!0,beforeEnter:Y,afterEnter:W,beforeLeave:ie,afterLeave:ne,enter:se,enterFrom:ae,enterTo:ce,entered:pe,leave:ge,leaveFrom:ve,leaveTo:be,...Ee}=v,[Pe,Je]=reactExports.useState(null),Ce=reactExports.useRef(null),Ve=ue(v),Re=y$2(...Ve?[Ce,N,Je]:N===null?[]:[N]),qe=(G=Ee.unmount)==null||G?A$1.Unmount:A$1.Hidden,{show:et,appear:Ze,initial:tt}=De(),[Ke,rt]=reactExports.useState(et?"visible":"hidden"),it=He$1(),{register:ot,unregister:ut}=it;n$3(()=>ot(Ce),[ot,Ce]),n$3(()=>{if(qe===A$1.Hidden&&Ce.current){if(et&&Ke!=="visible"){rt("visible");return}return u$4(Ke,{hidden:()=>ut(Ce),visible:()=>ot(Ce)})}},[Ke,Ce,ot,ut,et,qe]);let ct=l$1();n$3(()=>{if(Ve&&ct&&Ke==="visible"&&Ce.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[Ce,Ke,ct,Ve]);let at=tt&&!Ze,st=Ze&&et&&tt,pt=reactExports.useRef(!1),lt=Te(()=>{pt.current||(rt("hidden"),ut(Ce))},it),vt=o$2(Gt=>{pt.current=!0;let Ot=Gt?"enter":"leave";lt.onStart(Ce,Ot,It=>{It==="enter"?Y==null||Y():It==="leave"&&(ie==null||ie())})}),dt=o$2(Gt=>{let Ot=Gt?"enter":"leave";pt.current=!1,lt.onStop(Ce,Ot,It=>{It==="enter"?W==null||W():It==="leave"&&(ne==null||ne())}),Ot==="leave"&&!U(lt)&&(rt("hidden"),ut(Ce))});reactExports.useEffect(()=>{Ve&&q||(vt(et),dt(et))},[et,Ve,q]);let xt=!(!q||!Ve||!ct||at),[,ft]=x$1(xt,Pe,et,{start:vt,end:dt}),Et=m$4({ref:Re,className:((z=t$2(Ee.className,st&&se,st&&ae,ft.enter&&se,ft.enter&&ft.closed&&ae,ft.enter&&!ft.closed&&ce,ft.leave&&ge,ft.leave&&!ft.closed&&ve,ft.leave&&ft.closed&&be,!ft.transition&&et&&pe))==null?void 0:z.trim())||void 0,...R$1(ft)}),Ct=0;Ke==="visible"&&(Ct|=i.Open),Ke==="hidden"&&(Ct|=i.Closed),et&&Ke==="hidden"&&(Ct|=i.Opening),!et&&Ke==="visible"&&(Ct|=i.Closing);let Dt=L$1();return U$3.createElement(M.Provider,{value:lt},U$3.createElement(c$1,{value:Ct},Dt({ourProps:Et,theirProps:Ee,defaultTag:de,features:fe,visible:Ke==="visible",name:"Transition.Child"})))}function Ie$1(v,N){let{show:G,appear:z=!1,unmount:q=!0,...Y}=v,W=reactExports.useRef(null),ie=ue(v),ne=y$2(...ie?[W,N]:N===null?[]:[N]);l$1();let se=u$1();if(G===void 0&&se!==null&&(G=(se&i.Open)===i.Open),G===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[ae,ce]=reactExports.useState(G?"visible":"hidden"),pe=Te(()=>{G||ce("hidden")}),[ge,ve]=reactExports.useState(!0),be=reactExports.useRef([G]);n$3(()=>{ge!==!1&&be.current[be.current.length-1]!==G&&(be.current.push(G),ve(!1))},[be,G]);let Ee=reactExports.useMemo(()=>({show:G,appear:z,initial:ge}),[G,z,ge]);n$3(()=>{G?ce("visible"):!U(pe)&&W.current!==null&&ce("hidden")},[G,pe]);let Pe={unmount:q},Je=o$2(()=>{var Re;ge&&ve(!1),(Re=v.beforeEnter)==null||Re.call(v)}),Ce=o$2(()=>{var Re;ge&&ve(!1),(Re=v.beforeLeave)==null||Re.call(v)}),Ve=L$1();return U$3.createElement(M.Provider,{value:pe},U$3.createElement(w.Provider,{value:Ee},Ve({ourProps:{...Pe,as:reactExports.Fragment,children:U$3.createElement(me,{ref:ne,...Pe,...Y,beforeEnter:Je,beforeLeave:Ce})},theirProps:{},defaultTag:reactExports.Fragment,features:fe,visible:ae==="visible",name:"Transition"})))}function Le(v,N){let G=reactExports.useContext(w)!==null,z=u$1()!==null;return U$3.createElement(U$3.Fragment,null,!G&&z?U$3.createElement(X$1,{ref:N,...v}):U$3.createElement(me,{ref:N,...v}))}let X$1=K(Ie$1),me=K(Ae),Fe=K(Le),ze=Object.assign(X$1,{Child:Fe,Root:X$1});var Oe=(v=>(v[v.Open=0]="Open",v[v.Closed=1]="Closed",v))(Oe||{}),he=(v=>(v[v.SetTitleId=0]="SetTitleId",v))(he||{});
vendor: 11,160 bytes, lines 492-567
492let Se={0(v,N){return v.titleId===N.id?v:{...v,titleId:N.id}}},k=reactExports.createContext(null);k.displayName="DialogContext";function O(v){let N=reactExports.useContext(k);if(N===null){let G=new Error(`<${v} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(G,O),G}return N}function Ie(v,N){return u$4(N.type,Se,v,N)}let V=K(function(v,N){let G=reactExports.useId(),{id:z=`headlessui-dialog-${G}`,open:q,onClose:Y,initialFocus:W,role:ie="dialog",autoFocus:ne=!0,__demoMode:se=!1,unmount:ae=!1,...ce}=v,pe=reactExports.useRef(!1);ie=function(){return ie==="dialog"||ie==="alertdialog"?ie:(pe.current||(pe.current=!0,console.warn(`Invalid role [${ie}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let ge=u$1();q===void 0&&ge!==null&&(q=(ge&i.Open)===i.Open);let ve=reactExports.useRef(null),be=y$2(ve,N),Ee=n$1(ve),Pe=q?0:1,[Je,Ce]=reactExports.useReducer(Ie,{titleId:null,descriptionId:null,panelRef:reactExports.createRef()}),Ve=o$2(()=>Y(!1)),Re=o$2(dt=>Ce({type:0,id:dt})),qe=l$1()?Pe===0:!1,[et,Ze]=le(),tt={get current(){var dt;return(dt=Je.panelRef.current)!=null?dt:ve.current}},Ke=b(),{resolveContainers:rt}=R({mainTreeNode:Ke,portals:et,defaultContainers:[tt]}),it=ge!==null?(ge&i.Closing)===i.Closing:!1;y$1(se||it?!1:qe,{allowed:o$2(()=>{var dt,xt;return[(xt=(dt=ve.current)==null?void 0:dt.closest("[data-headlessui-portal]"))!=null?xt:null]}),disallowed:o$2(()=>{var dt;return[(dt=Ke==null?void 0:Ke.closest("body > *:not(#headlessui-portal-root)"))!=null?dt:null]})}),R$2(qe,rt,dt=>{dt.preventDefault(),Ve()}),a$2(qe,Ee==null?void 0:Ee.defaultView,dt=>{dt.preventDefault(),dt.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),Ve()}),f$2(se||it?!1:qe,Ee,rt),m$2(qe,ve,Ve);let[ot,ut]=w$3(),ct=reactExports.useMemo(()=>[{dialogState:Pe,close:Ve,setTitleId:Re,unmount:ae},Je],[Pe,Je,Ve,Re,ae]),at=reactExports.useMemo(()=>({open:Pe===0}),[Pe]),st={ref:be,id:z,role:ie,tabIndex:-1,"aria-modal":se?void 0:Pe===0?!0:void 0,"aria-labelledby":Je.titleId,"aria-describedby":ot,unmount:ae},pt=!f$1(),lt=x.None;qe&&!se&&(lt|=x.RestoreFocus,lt|=x.TabLock,ne&&(lt|=x.AutoFocus),pt&&(lt|=x.InitialFocus));let vt=L$1();return U$3.createElement(s$1,null,U$3.createElement(l,{force:!0},U$3.createElement(oe,null,U$3.createElement(k.Provider,{value:ct},U$3.createElement(D$1,{target:ve},U$3.createElement(l,{force:!1},U$3.createElement(ut,{slot:at},U$3.createElement(Ze,null,U$3.createElement(ye,{initialFocus:W,initialFocusFallback:ve,containers:rt,features:lt},U$3.createElement(C$1,{value:Ve},vt({ourProps:st,theirProps:ce,slot:at,defaultTag:Me,features:Ge,visible:Pe===0,name:"Dialog"})))))))))))}),Me="div",Ge=O$3.RenderStrategy|O$3.Static;function ke(v,N){let{transition:G=!1,open:z,...q}=v,Y=u$1(),W=v.hasOwnProperty("open")||Y!==null,ie=v.hasOwnProperty("onClose");if(!W&&!ie)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!W)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!ie)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!Y&&typeof v.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${v.open}`);if(typeof v.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${v.onClose}`);return(z!==void 0||G)&&!q.static?U$3.createElement(O$1,null,U$3.createElement(ze,{show:z,transition:G,unmount:q.unmount},U$3.createElement(V,{ref:N,...q}))):U$3.createElement(O$1,null,U$3.createElement(V,{ref:N,open:z,...q}))}let we="div";function Be(v,N){let G=reactExports.useId(),{id:z=`headlessui-dialog-panel-${G}`,transition:q=!1,...Y}=v,[{dialogState:W,unmount:ie},ne]=O("Dialog.Panel"),se=y$2(N,ne.panelRef),ae=reactExports.useMemo(()=>({open:W===0}),[W]),ce=o$2(Ee=>{Ee.stopPropagation()}),pe={ref:se,id:z,onClick:ce},ge=q?Fe:reactExports.Fragment,ve=q?{unmount:ie}:{},be=L$1();return U$3.createElement(ge,{...ve},be({ourProps:pe,theirProps:Y,slot:ae,defaultTag:we,name:"Dialog.Panel"}))}let Ue="div";function He(v,N){let{transition:G=!1,...z}=v,[{dialogState:q,unmount:Y}]=O("Dialog.Backdrop"),W=reactExports.useMemo(()=>({open:q===0}),[q]),ie={ref:N,"aria-hidden":!0},ne=G?Fe:reactExports.Fragment,se=G?{unmount:Y}:{},ae=L$1();return U$3.createElement(ne,{...se},ae({ourProps:ie,theirProps:z,slot:W,defaultTag:Ue,name:"Dialog.Backdrop"}))}let Ne="h2";function We(v,N){let G=reactExports.useId(),{id:z=`headlessui-dialog-title-${G}`,...q}=v,[{dialogState:Y,setTitleId:W}]=O("Dialog.Title"),ie=y$2(N);reactExports.useEffect(()=>(W(z),()=>W(null)),[z,W]);let ne=reactExports.useMemo(()=>({open:Y===0}),[Y]),se={ref:ie,id:z};return L$1()({ourProps:se,theirProps:q,slot:ne,defaultTag:Ne,name:"Dialog.Title"})}let $e=K(ke),je=K(Be);K(He);let Ye=K(We),yt=Object.assign($e,{Panel:je,Title:Ye,Description:H$2});/**
493 * @license lucide-react v0.488.0 - ISC
494 *
495 * This source code is licensed under the ISC license.
496 * See the LICENSE file in the root directory of this source tree.
497 */const toKebabCase=v=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),toCamelCase=v=>v.replace(/^([A-Z])|[\s-_]+(\w)/g,(N,G,z)=>z?z.toUpperCase():G.toLowerCase()),toPascalCase=v=>{const N=toCamelCase(v);return N.charAt(0).toUpperCase()+N.slice(1)},mergeClasses=(...v)=>v.filter((N,G,z)=>!!N&&N.trim()!==""&&z.indexOf(N)===G).join(" ").trim();/**
498 * @license lucide-react v0.488.0 - ISC
499 *
500 * This source code is licensed under the ISC license.
501 * See the LICENSE file in the root directory of this source tree.
502 */var defaultAttributes={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
503 * @license lucide-react v0.488.0 - ISC
504 *
505 * This source code is licensed under the ISC license.
506 * See the LICENSE file in the root directory of this source tree.
507 */const Icon=reactExports.forwardRef(({color:v="currentColor",size:N=24,strokeWidth:G=2,absoluteStrokeWidth:z,className:q="",children:Y,iconNode:W,...ie},ne)=>reactExports.createElement("svg",{ref:ne,...defaultAttributes,width:N,height:N,stroke:v,strokeWidth:z?Number(G)*24/Number(N):G,className:mergeClasses("lucide",q),...ie},[...W.map(([se,ae])=>reactExports.createElement(se,ae)),...Array.isArray(Y)?Y:[Y]]));/**
508 * @license lucide-react v0.488.0 - ISC
509 *
510 * This source code is licensed under the ISC license.
511 * See the LICENSE file in the root directory of this source tree.
512 */const createLucideIcon=(v,N)=>{const G=reactExports.forwardRef(({className:z,...q},Y)=>reactExports.createElement(Icon,{ref:Y,iconNode:N,className:mergeClasses(`lucide-${toKebabCase(toPascalCase(v))}`,`lucide-${v}`,z),...q}));return G.displayName=toPascalCase(v),G};/**
513 * @license lucide-react v0.488.0 - ISC
514 *
515 * This source code is licensed under the ISC license.
516 * See the LICENSE file in the root directory of this source tree.
517 */const __iconNode$H=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],BookOpen=createLucideIcon("book-open",__iconNode$H);/**
518 * @license lucide-react v0.488.0 - ISC
519 *
520 * This source code is licensed under the ISC license.
521 * See the LICENSE file in the root directory of this source tree.
522 */const __iconNode$G=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]],ChartArea=createLucideIcon("chart-area",__iconNode$G);/**
523 * @license lucide-react v0.488.0 - ISC
524 *
525 * This source code is licensed under the ISC license.
526 * See the LICENSE file in the root directory of this source tree.
527 */const __iconNode$F=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]],ChartSpline=createLucideIcon("chart-spline",__iconNode$F);/**
528 * @license lucide-react v0.488.0 - ISC
529 *
530 * This source code is licensed under the ISC license.
531 * See the LICENSE file in the root directory of this source tree.
532 */const __iconNode$E=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Check=createLucideIcon("check",__iconNode$E);/**
533 * @license lucide-react v0.488.0 - ISC
534 *
535 * This source code is licensed under the ISC license.
536 * See the LICENSE file in the root directory of this source tree.
537 */const __iconNode$D=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ChevronLeft=createLucideIcon("chevron-left",__iconNode$D);/**
538 * @license lucide-react v0.488.0 - ISC
539 *
540 * This source code is licensed under the ISC license.
541 * See the LICENSE file in the root directory of this source tree.
542 */const __iconNode$C=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight=createLucideIcon("chevron-right",__iconNode$C);/**
543 * @license lucide-react v0.488.0 - ISC
544 *
545 * This source code is licensed under the ISC license.
546 * See the LICENSE file in the root directory of this source tree.
547 */const __iconNode$B=[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]],CircleGauge=createLucideIcon("circle-gauge",__iconNode$B);/**
548 * @license lucide-react v0.488.0 - ISC
549 *
550 * This source code is licensed under the ISC license.
551 * See the LICENSE file in the root directory of this source tree.
552 */const __iconNode$A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],CircleHelp=createLucideIcon("circle-help",__iconNode$A);/**
553 * @license lucide-react v0.488.0 - ISC
554 *
555 * This source code is licensed under the ISC license.
556 * See the LICENSE file in the root directory of this source tree.
557 */const __iconNode$z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],Contrast=createLucideIcon("contrast",__iconNode$z);/**
558 * @license lucide-react v0.488.0 - ISC
559 *
560 * This source code is licensed under the ISC license.
561 * See the LICENSE file in the root directory of this source tree.
562 */const __iconNode$y=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Copy=createLucideIcon("copy",__iconNode$y);/**
563 * @license lucide-react v0.488.0 - ISC
564 *
565 * This source code is licensed under the ISC license.
566 * See the LICENSE file in the root directory of this source tree.
567 */const __iconNode$x=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}
567]],Delete=createLucideIcon("delete",__iconNode$x);/**
568 * @license lucide-react v0.488.0 - ISC
569 *
570 * This source code is licensed under the ISC license.
571 * See the LICENSE file in the root directory of this source tree.
572 */const __iconNode$w=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ExternalLink=createLucideIcon("external-link",__iconNode$w);/**
573 * @license lucide-react v0.488.0 - ISC
574 *
575 * This source code is licensed under the ISC license.
576 * See the LICENSE file in the root directory of this source tree.
577 */const __iconNode$v=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Eye=createLucideIcon("eye",__iconNode$v);/**
578 * @license lucide-react v0.488.0 - ISC
579 *
580 * This source code is licensed under the ISC license.
581 * See the LICENSE file in the root directory of this source tree.
582 */const __iconNode$u=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m16 13-3.5 3.5-2-2L8 17",key:"zz7yod"}]],FileChartLine=createLucideIcon("file-chart-line",__iconNode$u);/**
583 * @license lucide-react v0.488.0 - ISC
584 *
585 * This source code is licensed under the ISC license.
586 * See the LICENSE file in the root directory of this source tree.
587 */const __iconNode$t=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],FileDown=createLucideIcon("file-down",__iconNode$t);/**
588 * @license lucide-react v0.488.0 - ISC
589 *
590 * This source code is licensed under the ISC license.
591 * See the LICENSE file in the root directory of this source tree.
592 */const __iconNode$s=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],FileJson=createLucideIcon("file-json",__iconNode$s);/**
593 * @license lucide-react v0.488.0 - ISC
594 *
595 * This source code is licensed under the ISC license.
596 * See the LICENSE file in the root directory of this source tree.
597 */const __iconNode$r=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],FileUp=createLucideIcon("file-up",__iconNode$r);/**
598 * @license lucide-react v0.488.0 - ISC
599 *
600 * This source code is licensed under the ISC license.
601 * See the LICENSE file in the root directory of this source tree.
602 */const __iconNode$q=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Github=createLucideIcon("github",__iconNode$q);/**
603 * @license lucide-react v0.488.0 - ISC
604 *
605 * This source code is licensed under the ISC license.
606 * See the LICENSE file in the root directory of this source tree.
607 */const __iconNode$p=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Globe=createLucideIcon("globe",__iconNode$p);/**
608 * @license lucide-react v0.488.0 - ISC
609 *
610 * This source code is licensed under the ISC license.
611 * See the LICENSE file in the root directory of this source tree.
612 */const __iconNode$o=[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-.8 2.3-1.9 2.8l-.9.4A2 2 0 0 0 12 18a4 4 0 0 1-4 4c-3.3 0-6-2.7-6-6a4 4 0 0 1 4-4 2 2 0 0 0 1.8-1.2z",key:"1u8q3z"}],["circle",{cx:"11.5",cy:"12.5",r:".5",fill:"currentColor",key:"16onso"}]],Guitar=createLucideIcon("guitar",__iconNode$o);/**
613 * @license lucide-react v0.488.0 - ISC
614 *
615 * This source code is licensed under the ISC license.
616 * See the LICENSE file in the root directory of this source tree.
617 */const __iconNode$n=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]],Import=createLucideIcon("import",__iconNode$n);/**
618 * @license lucide-react v0.488.0 - ISC
619 *
620 * This source code is licensed under the ISC license.
621 * See the LICENSE file in the root directory of this source tree.
622 */const __iconNode$m=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Info=createLucideIcon("info",__iconNode$m);/**
623 * @license lucide-react v0.488.0 - ISC
624 *
625 * This source code is licensed under the ISC license.
626 * See the LICENSE file in the root directory of this source tree.
627 */const __iconNode$l=[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]],ListRestart=createLucideIcon("list-restart",__iconNode$l);/**
628 * @license lucide-react v0.488.0 - ISC
629 *
630 * This source code is licensed under the ISC license.
631 * See the LICENSE file in the root directory of this source tree.
632 */const __iconNode$k=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],List=createLucideIcon("list",__iconNode$k);/**
633 * @license lucide-react v0.488.0 - ISC
634 *
635 * This source code is licensed under the ISC license.
636 * See the LICENSE file in the root directory of this source tree.
637 */const __iconNode$j=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],MapPin=createLucideIcon("map-pin",__iconNode$j);/**
638 * @license lucide-react v0.488.0 - ISC
639 *
640 * This source code is licensed under the ISC license.
641 * See the LICENSE file in the root directory of this source tree.
642 */const __iconNode$i=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Moon=createLucideIcon("moon",__iconNode$i);/**
643 * @license lucide-react v0.488.0 - ISC
644 *
645 * This source code is licensed under the ISC license.
646 * See the LICENSE file in the root directory of this source tree.
647 */const __iconNode$h=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Music=createLucideIcon("music",__iconNode$h);/**
648 * @license lucide-react v0.488.0 - ISC
649 *
650 * This source code is licensed under the ISC license.
651 * See the LICENSE file in the root directory of this source tree.
652 */const __iconNode$g=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Play=createLucideIcon("play",__iconNode$g);/**
653 * @license lucide-react v0.488.0 - ISC
654 *
655 * This source code is licensed under the ISC license.
656 * See the LICENSE file in the root directory of this source tree.
657 */const __iconNode$f=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],RotateCcw=createLucideIcon("rotate-ccw",__iconNode$f);/**
658 * @license lucide-react v0.488.0 - ISC
659 *
660 * This source code is licensed under the ISC license.
661 * See the LICENSE file in the root directory of this source tree.
662 */const __iconNode$e=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],Ruler=createLucideIcon("ruler",__iconNode$e);/**
663 * @license lucide-react v0.488.0 - ISC
664 *
665 * This source code is licensed under the ISC license.
666 * See the LICENSE file in the root directory of this source tree.
667 */const __iconNode$d=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Share2=createLucideIcon("share-2",__iconNode$d);/**
668 * @license lucide-react v0.488.0 - ISC
669 *
670 * This source code is licensed under the ISC license.
671 * See the LICENSE file in the root directory of this source tree.
672 */const __iconNode$c=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]],SquareActivity=createLucideIcon("square-activity",__iconNode$c);/**
673 * @license lucide-react v0.488.0 - ISC
674 *
675 * This source code is licensed under the ISC license.
676 * See the LICENSE file in the root directory of this source tree.
677 */const __iconNode$b=[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]],SunMoon=createLucideIcon("sun-moon",__iconNode$b);/**
678 * @license lucide-react v0.488.0 - ISC
679 *
680 * This source code is licensed under the ISC license.
681 * See the LICENSE file in the root directory of this source tree.
682 */const __iconNode$a=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Sun=createLucideIcon("sun",__iconNode$a);/**
683 * @license lucide-react v0.488.0 - ISC
684 *
685 * This source code is licensed under the ISC license.
686 * See the LICENSE file in the root directory of this source tree.
687 */const __iconNode$9=[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h.01",key:"1euzgo"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]],SwatchBook=createLucideIcon("swatch-book",__iconNode$9);/**
688 * @license lucide-react v0.488.0 - ISC
689 *
690 * This source code is licensed under the ISC license.
691 * See the LICENSE file in the root directory of this source tree.
692 */const __iconNode$8=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],Upload=createLucideIcon("upload",__iconNode$8);/**
693 * @license lucide-react v0.488.0 - ISC
694 *
695 * This source code is licensed under the ISC license.
696 * See the LICENSE file in the root directory of this source tree.
697 */const __iconNode$7=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Volume2=createLucideIcon("volume-2",__iconNode$7);/**
698 * @license lucide-react v0.488.0 - ISC
699 *
700 * This source code is licensed under the ISC license.
701 * See the LICENSE file in the root directory of this source tree.
702 */const __iconNode$6=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],VolumeX=createLucideIcon("volume-x",__iconNode$6);/**
703 * @license lucide-react v0.488.0 - ISC
704 *
705 * This source code is licensed under the ISC license.
706 * See the LICENSE file in the root directory of this source tree.
707 */const __iconNode$5=[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}
707],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]],Wand=createLucideIcon("wand",__iconNode$5);/**
708 * @license lucide-react v0.488.0 - ISC
709 *
710 * This source code is licensed under the ISC license.
711 * See the LICENSE file in the root directory of this source tree.
712 */const __iconNode$4=[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]],Wind=createLucideIcon("wind",__iconNode$4);/**
713 * @license lucide-react v0.488.0 - ISC
714 *
715 * This source code is licensed under the ISC license.
716 * See the LICENSE file in the root directory of this source tree.
717 */const __iconNode$3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X=createLucideIcon("x",__iconNode$3);/**
718 * @license lucide-react v0.488.0 - ISC
719 *
720 * This source code is licensed under the ISC license.
721 * See the LICENSE file in the root directory of this source tree.
722 */const __iconNode$2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Zap=createLucideIcon("zap",__iconNode$2);/**
723 * @license lucide-react v0.488.0 - ISC
724 *
725 * This source code is licensed under the ISC license.
726 * See the LICENSE file in the root directory of this source tree.
727 */const __iconNode$1=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ZoomIn=createLucideIcon("zoom-in",__iconNode$1);/**
728 * @license lucide-react v0.488.0 - ISC
729 *
730 * This source code is licensed under the ISC license.
731 * See the LICENSE file in the root directory of this source tree.
732 */const __iconNode=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ZoomOut=createLucideIcon("zoom-out",__iconNode),InfoToast=({message:v,isVisible:N,onClose:G,timeout:z=1e4,position:q="fixed",cursorPosition:Y={x:0,y:0}})=>{const[W,ie]=reactExports.useState(!1),[ne,se]=reactExports.useState({}),ae=reactExports.useRef(null);if(reactExports.useEffect(()=>{if(N&&v){ie(!0);const ge=setTimeout(()=>{G&&G()},z);return()=>clearTimeout(ge)}else{const ge=setTimeout(()=>{ie(!1)},300);return()=>clearTimeout(ge)}},[N,v,G,z]),reactExports.useEffect(()=>{if(q==="cursor"){const{x:ge,y:ve}=Y;se({left:`${ge+15}px`,top:`${ve+-45}px`,position:"fixed",zIndex:1e3,pointerEvents:"none"})}else se({})},[q,Y]),reactExports.useEffect(()=>{if(N&&q==="cursor"&&ae.current&&W){const ge=ae.current,{x:ve,y:be}=Y,Ee=15,Pe=-45,Je=window.innerWidth,Ce=ge.getBoundingClientRect();let Ve=ve+Ee,Re=be+Pe;Ve+Ce.width>Je-10&&(Ve=ve-Ce.width-Ee),Re<10&&(Re=be+Math.abs(Pe)+10),se({left:`${Ve}px`,top:`${Re}px`,position:"fixed",zIndex:1e3,pointerEvents:"none"})}},[N,q,Y,W]),!W)return null;const ce=q==="cursor"?"fixed z-[1000]":"fixed top-24 right-4 z-40",pe=q==="cursor"?ne:{};return jsxRuntimeExports.jsx("div",{ref:ae,className:`${ce} max-w-sm transition-all duration-300 ease-in-out ${N?"opacity-100 translate-y-0":"opacity-0 -translate-y-2"}`,style:pe,"aria-hidden":"true",role:"presentation",children:jsxRuntimeExports.jsx("div",{className:"bg-background border border-border rounded-lg shadow-lg p-4",children:jsxRuntimeExports.jsx("div",{className:"text-sm text-txt whitespace-pre-line",children:v})})})},InfoToastContext=reactExports.createContext(),useInfoToast=()=>{const v=reactExports.useContext(InfoToastContext);if(!v)throw new Error("useInfoToast must be used within an InfoToastProvider");return v},InfoToastProvider=({children:v})=>{const[N,G]=reactExports.useState(""),[z,q]=reactExports.useState(!1),[Y,W]=reactExports.useState(1e4),[ie,ne]=reactExports.useState("fixed"),[se,ae]=reactExports.useState({x:0,y:0}),ce=(ve,be=1e4,Ee={})=>{G(ve),W(be),ne(Ee.position||"fixed"),Ee.cursorPosition&&ae(Ee.cursorPosition),q(!0)}
732,pe=(ve,be,Ee=2e3)=>{ce(ve,Ee,{position:"cursor",cursorPosition:be})},ge=()=>{q(!1)};return jsxRuntimeExports.jsxs(InfoToastContext.Provider,{value:{showInfoToast:ce,showLandmarkToast:pe,hideInfoToast:ge},children:[v,jsxRuntimeExports.jsx(InfoToast,{message:N,isVisible:z,onClose:ge,timeout:Y,position:ie,cursorPosition:se})]})},EditFunctionDialog=({isOpen:v,onClose:N})=>{const{functionDefinitions:G,setFunctionDefinitions:z,graphSettings:q,focusChart:Y,inputErrors:W,setInputErrors:ie}=useGraphContext(),{showInfoToast:ne}=useInfoToast(),se=reactExports.useRef(null),[ae,ce]=reactExports.useState(""),[pe,ge]=reactExports.useState(null),ve=(q==null?void 0:q.restrictionMode)==="read-only",be=Object.keys(W).length>0,Ee=()=>{const tt=(G||[]).map(rt=>rt.id);let Ke=1;for(;tt.includes(`f${Ke}`);)Ke++;return`f${Ke}`},Pe=tt=>{ce(tt),setTimeout(()=>ce(""),3e3)},Je=()=>{if(ve)return;const tt={id:Ee(),functionName:`Function ${getFunctionCount(G)+1}`,type:"function",functionDef:"",isActive:!0,instrument:"clarinet",pointOfInterests:[],landmarks:[]},Ke=(G||[]).map(rt=>({...rt,isActive:!1}));z(addFunction(Ke,tt)),Pe(`New function added. Total functions: ${getFunctionCount(G)+1}`),ge(`function-${getFunctionCount(G)}`)},Ce=()=>{if(ve)return;const tt={id:Ee(),functionName:`Function ${getFunctionCount(G)+1}`,type:"piecewise_function",functionDef:[["",""]],isActive:!0,instrument:"clarinet",pointOfInterests:[],landmarks:[]},Ke=(G||[]).map(rt=>({...rt,isActive:!1}));z(addFunction(Ke,tt)),Pe(`New piecewise function added. Total functions: ${getFunctionCount(G)+1}`),ge(`piecewise-function-${getFunctionCount(G)}-part-0-function`)},Ve=tt=>{if(ve)return;const Ke=getFunctionTypeN(G,tt)==="piecewise_function"?"piecewise function":"function",rt=isFunctionActiveN(G,tt);let it=removeFunctionN(G,tt);if(rt&&it.length>0){const ot=tt>0?tt-1:0,ut=Math.min(ot,it.length-1);it=it.map((ct,at)=>({...ct,isActive:at===ut}))}z(it),Pe(`${Ke} ${tt+1} deleted. Remaining functions: ${it.length}`)},Re=(tt,Ke)=>{ve||z(updateFunctionN(G,tt,{functionDef:Ke}))};reactExports.useEffect(()=>{if(pe){const tt=document.getElementById(pe);tt&&tt.focus(),ge(null)}},[pe,G]),reactExports.useEffect(()=>{const tt=Ke=>{Ke.key==="Escape"&&(Ke.preventDefault(),qe())};if(v)return document.addEventListener("keydown",tt),()=>document.removeEventListener("keydown",tt)},[v]),reactExports.useEffect(()=>{v&&(se.current=G,Pe(ve?`Edit functions dialog opened in read-only mode. ${getFunctionCount(G)} functions available for viewing.`:`Edit functions dialog opened. ${getFunctionCount(G)} functions available.`))},[v,ve]);const qe=()=>{se.current!==null&&z(se.current),ie({}),N(),ne("Changes discarded",1500),setTimeout(()=>Y(),100)},et=()=>{if(be){Pe("Cannot save: Please fix all errors before saving.");return}if(se.current){const tt=G.map((Ke,rt)=>{const it=se.current.find(ot=>ot.id===Ke.id);if(it){const ot=at=>typeof at=="string"?at.replace(/\s/g,""):Array.isArray(at)?at.map(([st,pt])=>[(st||"").replace(/\s/g,""),(pt||"").replace(/\s/g,"")]):at,ut=JSON.stringify(ot(Ke.functionDef)),ct=JSON.stringify(ot(it.functionDef));if(ut!==ct)return{...Ke,landmarks:[]}}return Ke});z(tt)}N(),setTimeout(()=>Y(),100)},Ze=()=>{if(be){Pe("Function definitions have errors. Changes discarded."),qe();return}N(),setTimeout(()=>Y(),100)};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:Ze,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-lg max-h-[90vh] bg-background rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:ve?"View functions":"Edit functions"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:ve?"View active and inactive functions in read-only mode.":"Edit active and inactive functions. Press Enter to save and close."})]}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:ae}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-y-auto px-6",role:"main","aria-label":"Function list",children:[(G||[]).length===0&&jsxRuntimeExports.jsx("div",{className:"text-center py-8 text-descriptions",children:ve?"No functions defined.":'No functions defined. 
732Click "Add function" or "Add piecewise function" to create your first function.'}),"            ",(G||[]).map((tt,Ke)=>getFunctionTypeN(G,Ke)==="piecewise_function"?jsxRuntimeExports.jsx(PiecewiseFunctionContainer,{index:Ke,value:getFunctionDefN(G,Ke),instrument:getFunctionInstrumentN(G,Ke),onChange:rt=>Re(Ke,rt),onDelete:()=>Ve(Ke),onAccept:et,isReadOnly:ve},tt.id):jsxRuntimeExports.jsx(FunctionContainer,{index:Ke,value:getFunctionDefN(G,Ke),instrument:getFunctionInstrumentN(G,Ke),onChange:rt=>Re(Ke,rt),onDelete:()=>Ve(Ke),onAccept:et,isReadOnly:ve},tt.id))]}),jsxRuntimeExports.jsxs("div",{className:"px-6 py-4",role:"group","aria-label":"Dialog actions",children:[!ve&&jsxRuntimeExports.jsxs("div",{className:"flex gap-2 mb-4",role:"group","aria-label":"Add new functions",children:[jsxRuntimeExports.jsx("button",{onClick:Je,className:"btn-neutral flex-1","aria-label":"Add regular function",children:"Add regular function"}),jsxRuntimeExports.jsx("button",{onClick:Ce,className:"btn-neutral flex-1","aria-label":"Add piecewise function",children:"Add piecewise function"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center gap-2",role:"group","aria-label":"Dialog controls",children:[jsxRuntimeExports.jsx("button",{onClick:qe,className:"btn-secondary sm:w-auto",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:et,className:"btn-primary sm:w-auto",disabled:be,"aria-disabled":be,title:be?"Please fix all errors before saving":"Save changes and close",children:"Accept"})]})]})]})})]})},getPartErrors=(v,N)=>{const G=v[N];return G?{functionErrors:G.functionErrors||[],conditionErrors:G.conditionErrors||[]}:{functionErrors:[],conditionErrors:[]}},getGeneralError=(v,N)=>{const G=v[N];return(G==null?void 0:G.generalError)||null},FunctionContainer=({index:v,value:N,instrument:G,onChange:z,onDelete:q,onAccept:Y,isReadOnly:W})=>{var Pe;const{functionDefinitions:ie,setFunctionDefinitions:ne,inputErrors:se}=useGraphContext(),{availableInstruments:ae}=useInstruments(),ce=(Pe=ie[v])==null?void 0:Pe.id,pe=getGeneralError(se,ce),ge=ce&&pe,ve=pe,be=Je=>{Je.key==="Enter"&&(Je.preventDefault(),Je.stopPropagation(),Y&&Y())},Ee=()=>{if(W)return;const Je=ie.map((Ce,Ve)=>({...Ce,isActive:Ve===v}));ne(Je)};return jsxRuntimeExports.jsxs("div",{className:`mb-4 ${W?"opacity-60":""}`,role:"group","aria-labelledby":`function-${v}-label`,children:[jsxRuntimeExports.jsxs("label",{id:`function-${v}-label`,htmlFor:`function-${v}`,className:"block text-sm font-medium text-descriptions",children:["Function ",v+1]}),jsxRuntimeExports.jsx("div",{className:"mt-2",children:jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntimeExports.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntimeExports.jsxs("div",{className:`text-input-outer ${ge?"error-border error-input":""}`,"aria-errormessage":ge?`function-${v}-error`:void 0,children:[jsxRuntimeExports.jsx("div",{className:"text-input-label ","aria-hidden":"true",children:"f(x)="}),jsxRuntimeExports.jsx("input",{id:`function-${v}`,type:"text",placeholder:"e.g., x^2 + 2*x - 1",value:N,onChange:Je=>z(Je.target.value),onKeyDown:be,onFocus:Ee,className:"text-input-inner flex-1","aria-description":W?"Mathematical expression. Read-only mode active.":"Mathematical expression.",readOnly:W,tabIndex:0,"aria-invalid":ge?"true":"false","aria-errormessage":ge?`function-${v}-error`:void 0})]}),ge&&jsxRuntimeExports.jsxs("div",{id:`function-${v}-error`,className:"error-message mt-1",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),ve]})]}),!W&&jsxRuntimeExports.jsx("div",{className:"flex gap-2 flex-shrink-0",role:"group","aria-label":`Function ${v+1} actions`,children:jsxRuntimeExports.jsx("button",{type:"button",className:"btn-neutral","aria-label":`Delete function ${v+1}`,onClick:q,children:jsxRuntimeExports.jsx(Delete,{className:"w-4 h-4 text-icon","aria-hidden":"true"})})})]})})]})},PiecewiseFunctionContainer=({index:v,value:N,instrument:G,onChange:z,onDelete:q,onAccept:Y,isReadOnly:W})=>{var Ze;const{functionDefinitions:ie,setFunctionDefinitions:ne,inputErrors:se}=useGraphContext(),{availableInstruments:ae}=useInstruments(),ce=reactExports.useRef(!1),pe=(Ze=ie[v])==null?void 0:Ze.id,{functionErrors:ge,conditionErrors:ve}=getPartErrors(se,pe),be=getGeneralError(se,pe),[Ee,Pe]=reactExports.useState(()=>N&&Array.isArray(N)?N.map(([tt,Ke])=>({function:tt||"",condition:Ke||""})):[{function:"",condition:""}]);reactExports.useEffect(()=>{if(N&&Array.isArray(N)){const tt=N.map(([Ke,rt])=>({function:Ke||"",condition:rt||""}));Pe(tt)}},[N]),reactExports.useEffect(()=>{if(ce.current){const tt=Ee.map(Ke=>[Ke.function,Ke.condition]);z(tt),ce.current=!1}},[Ee,z]);const Je=tt=>{tt.key==="Enter"&&(tt.preventDefault(),tt.stopPropagation(),Y&&Y
732())},Ce=()=>{if(W)return;const tt=ie.map((Ke,rt)=>({...Ke,isActive:rt===v}));ne(tt)},Ve=(tt,Ke,rt)=>{W||Pe(it=>{const ot=[...it];return ot[tt]={...ot[tt],[Ke]:rt},ce.current=!0,ot})},Re=()=>{W||Pe(tt=>{const Ke=[...tt,{function:"",condition:""}];return ce.current=!0,Ke})},qe=tt=>{W||Ee.length<=1||Pe(Ke=>{const rt=Ke.filter((it,ot)=>ot!==tt);return ce.current=!0,rt})},et=(tt,Ke)=>{const rt=ge[Ke]&&ge[Ke].length>0,it=ve[Ke]&&ve[Ke].length>0;return jsxRuntimeExports.jsxs("div",{className:"mb-4 last:mb-0",role:"group","aria-label":`Part ${Ke+1} of ${Ee.length}`,children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[jsxRuntimeExports.jsxs("div",{className:`text-input-outer flex-1 min-w-0 ${rt?"error-border error-input":""}`,"aria-errormessage":rt?`piecewise-${v}-part-${Ke}-function-error`:void 0,children:[jsxRuntimeExports.jsx("div",{className:"text-input-label","aria-hidden":"true",children:"f(x)="}),jsxRuntimeExports.jsx("input",{id:`piecewise-function-${v}-part-${Ke}-function`,type:"text",value:tt.function,onChange:ot=>Ve(Ke,"function",ot.target.value),onKeyDown:Je,className:"text-input-inner w-full grow",placeholder:"e.g., x^2 + 1",onFocus:Ce,"aria-label":`Function expression for part ${Ke+1}`,"aria-invalid":rt?"true":"false","aria-describedby":W?"Function expression. Read-only mode active.":"Function expression.","aria-errormessage":rt?`piecewise-${v}-part-${Ke}-function-error`:void 0,readOnly:W,tabIndex:0})]}),jsxRuntimeExports.jsxs("div",{className:`text-input-outer flex-1 min-w-0 ${it?"error-border error-input":""}`,"aria-errormessage":it?`piecewise-${v}-part-${Ke}-condition-error`:void 0,children:[jsxRuntimeExports.jsx("div",{className:"text-input-label","aria-hidden":"true",children:"if"}),jsxRuntimeExports.jsx("input",{id:`piecewise-function-${v}-part-${Ke}-condition`,type:"text",value:tt.condition,onChange:ot=>Ve(Ke,"condition",ot.target.value),onKeyDown:Je,className:"text-input-inner w-full grow",placeholder:"e.g., x < 0 or x >= 1",onFocus:Ce,"aria-label":`Condition for part ${Ke+1}${W?" (read-only)":""}`,"aria-description":W?"Condition when this part applies. Read-only mode active.":"Condition when this part applies.",readOnly:W,tabIndex:0,"aria-invalid":it?"true":"false","aria-errormessage":it?`piecewise-${v}-part-${Ke}-condition-error`:void 0})]}),!W&&Ee.length>1&&jsxRuntimeExports.jsx("button",{type:"button",className:"btn-neutral","aria-label":`Remove part ${Ke+1} of piecewise function ${v+1}`,onClick:()=>qe(Ke),children:jsxRuntimeExports.jsx(Delete,{className:"w-4 h-4 text-icon","aria-hidden":"true"})})]}),rt&&jsxRuntimeExports.jsxs("div",{id:`piecewise-${v}-part-${Ke}-function-error`,className:"error-message mt-1",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),jsxRuntimeExports.jsx("strong",{children:"Function:"})," ",ge[Ke].join(". ")]}),it&&jsxRuntimeExports.jsxs("div",{id:`piecewise-${v}-part-${Ke}-condition-error`,className:"error-message mt-1",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),jsxRuntimeExports.jsx("strong",{children:"Condition:"})," ",ve[Ke].join(". ")]})]},Ke)};return jsxRuntimeExports.jsxs("div",{className:`mb-4 ${W?"opacity-60":""}`,role:"group","aria-labelledby":`piecewise-function-${v}-label`,"aria-description":"Piecewise function with multiple parts.",children:[jsxRuntimeExports.jsxs("label",{id:`piecewise-function-${v}-label`,htmlFor:`piecewise-function-${v}-part-0-function`,className:"block text-sm font-medium text-descriptions",children:["Function ",v+1," (piecewise)"]}),jsxRuntimeExports.jsxs("div",{className:`mt-2 border rounded-lg p-4 bg-background ${be||ge.some(tt=>tt&&tt.length>0)||ve.some(tt=>tt&&tt.length>0)?"border-red-500":"border-gray-mddk"}`,role:"group","aria-label":`Piecewise function ${v+1} parts`,children:[Ee.map((tt,Ke)=>et(tt,Ke)),!W&&jsxRuntimeExports.jsxs("div",{className:"flex gap-2 mt-2 pt-3 items-center",role:"group","aria-label":`Piecewise function ${v+1} controls`,children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:Re,className:"btn-neutral flex-1","aria-description":"Add new part",children:"Add part"}),jsxRuntimeExports.jsx("button",{type:"button",className:"btn-neutral","aria-label":`Delete piecewise function ${v+1}`,onClick:q,children:jsxRuntimeExports.jsx(Delete,{className:"w-4 text-icon","aria-hidden":"true"})})]})]}),be&&jsxRuntimeExports.jsxs("div",{className:"error-message mt-2",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),jsxRuntimeExports.jsx("strong",{children:"General Error:"})," ",be]})]})},ChangeGraphBoundDialog=({isOpen:v,onClose:N})=>{const{graphBounds:G,setGraphBounds:z,focusChart:q,graphSettings:Y}=useGraphContext(),{showInfoToast:W}=useInfoToast(),ie=reactExports.useRef(null),[ne,se]=reactExports.useState({}),[ae,ce]=reactExports.useState(""),pe=Object.keys(ne).length>0;reactExports.useEffect(()=>{v&&(ie.current=G,se({}),ge("Graph bounds dialog opened. Use Tab to navigate between fields."))},[v]);const ge=et=>{ce(et),setTimeout(()=>ce(""),3e3)},ve=(et,Ze)=>{const tt=[];if(et===""||et==="-")return tt.push("Value cannot be empty"),tt;const Ke=parseFloat(et);
732return isNaN(Ke)?(tt.push("Must be a valid number"),tt):(isFinite(Ke)||tt.push("Value cannot be infinite"),tt)},be=et=>{const Ze={},tt=(Y==null?void 0:Y.minBoundDifference)||.1,Ke=(Y==null?void 0:Y.maxBoundDifference)||100;if(["xMin","xMax","yMin","yMax"].forEach(rt=>{const it=ve(et[rt]);it.length>0&&(Ze[rt]=it)}),Object.keys(Ze).length===0){const rt=parseFloat(et.xMin),it=parseFloat(et.xMax),ot=parseFloat(et.yMin),ut=parseFloat(et.yMax),ct=rt<it,at=ot<ut;if(ct||(Ze.xMin=Ze.xMin||[],Ze.xMax=Ze.xMax||[],Ze.xMin.push("xMin must be less than xMax"),Ze.xMax.push("xMax must be greater than xMin")),at||(Ze.yMin=Ze.yMin||[],Ze.yMax=Ze.yMax||[],Ze.yMin.push("yMin must be less than yMax"),Ze.yMax.push("yMax must be greater than yMin")),ct){const st=it-rt;st<tt&&(Ze.xMin=Ze.xMin||[],Ze.xMax=Ze.xMax||[],Ze.xMin.push(`X range is too small (minimum ${tt})`),Ze.xMax.push(`X range is too small (minimum ${tt})`)),st>Ke&&(Ze.xMin=Ze.xMin||[],Ze.xMax=Ze.xMax||[],Ze.xMin.push(`X range is too large (maximum ${Ke})`),Ze.xMax.push(`X range is too large (maximum ${Ke})`))}if(at){const st=ut-ot;st<tt&&(Ze.yMin=Ze.yMin||[],Ze.yMax=Ze.yMax||[],Ze.yMin.push(`Y range is too small (minimum ${tt})`),Ze.yMax.push(`Y range is too small (minimum ${tt})`)),st>Ke&&(Ze.yMin=Ze.yMin||[],Ze.yMax=Ze.yMax||[],Ze.yMin.push(`Y range is too large (maximum ${Ke})`),Ze.yMax.push(`Y range is too large (maximum ${Ke})`))}}return Ze},Ee=()=>{ie.current!==null&&z(ie.current),se({}),N(),W("Changes discarded",1500),setTimeout(()=>q(),100)},Pe=()=>{if(pe){ge("Cannot save: Please fix all errors before saving.");return}N(),W("Graph bounds updated",1500),setTimeout(()=>q(),100)},Je=()=>{if(pe){ge("Graph bounds have errors. Changes discarded."),Ee();return}N(),setTimeout(()=>q(),100)},Ce=(et,Ze)=>{if(Ze===""||Ze==="-"||!isNaN(parseFloat(Ze))){const tt={...G,[et]:Ze===""||Ze==="-"?Ze:parseFloat(Ze)};z(tt);const Ke=be(tt);se(Ke)}},Ve=(et,Ze)=>{let tt=Ze;if(Ze===""||Ze==="-"){tt=0;const it={...G,[et]:0};z(it)}const Ke={...G,[et]:tt},rt=be(Ke);se(rt),rt[et]&&ge(`Error in ${et}: ${rt[et].join(". ")}`)},Re=et=>{et.key==="Enter"&&(et.preventDefault(),Pe()),et.key==="Escape"&&(et.preventDefault(),Ee())};reactExports.useEffect(()=>{if(v)return document.addEventListener("keydown",Re),()=>document.removeEventListener("keydown",Re)},[v,pe]);const qe=(et,Ze,tt)=>{const Ke=ne[et]&&ne[et].length>0,rt=Ke?ne[et].join(". "):null;return jsxRuntimeExports.jsxs("div",{className:"w-32",children:[" ",jsxRuntimeExports.jsxs("div",{className:`text-input-outer ${Ke?"error-border error-input":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"text-input-label",children:[Ze,":"]}),jsxRuntimeExports.jsx("input",{id:tt,type:"number",step:"any",value:G[et],onChange:it=>Ce(et,it.target.value),onBlur:it=>Ve(et,it.target.value),onKeyDown:Re,"aria-label":Ze,"aria-invalid":Ke?"true":"false","aria-errormessage":Ke?`${tt}-error`:void 0,className:"text-input-inner"})]}),Ke&&jsxRuntimeExports.jsxs("div",{id:`${tt}-error`,className:"error-message mt-1 text-sm break-words w-40 -ml-4",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),rt]})]})};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:Je,"aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-lg bg-background rounded-lg p-6 shadow-lg",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"Change Graph-Bound"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Here you can edit the displayed graph bounds. Press Enter to save, Escape to cancel."}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:ae}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 gap-4 items-center",role:"group","aria-label":"Graph bounds inputs",children:[jsxRuntimeExports.jsx("div",{className:"col-span-3 flex justify-center",children:qe("yMax","Ymax","maxY")}),jsxRuntimeExports.jsxs("div",{className:"col-span-3 flex justify-center gap-16",children:[qe("xMin","Xmin","minX"),qe("xMax","Xmax","maxX")]}),jsxRuntimeExports.jsx("div",{className:"col-span-3 flex justify-center",children:qe("yMin","Ymin","minY")})]}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center mt-4 gap-2",role:"group","aria-label":"Dialog controls",children:[jsxRuntimeExports.jsx("button",{onClick:Ee,className:"btn-secondary",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:Pe,className:"btn-primary",disabled:pe,"aria-disabled":pe,title:pe?"Please fix all errors before saving":"Save changes and close",children:"Accept"})]})]})})]})},ShowHideFunctionsDialog=({isOpen:v,onClose:N})=>{const{functionDefinitions:G,setFunctionDefinitions:z}=useGraphContext(),q=reactExports.useRef(null),[Y,W]=reactExports.useState(""),ie=ce=>{W(ce),setTimeout(()=>W(""),3e3)};reactExports.useEffect(()=>{v&&(q.current=G,ie(`Toggle functions dialog opened. ${getFunctionCount(G)} functions available.`))},[v]),reactExports.useEffect(()=>{const ce=pe=>{pe.key==="Escape"&&(pe.preventDefault(),ae())};if(v)return document.addEventListener("keydown",ce),()=>document.removeEventListener("keydown",ce)},[v]);const ne=ce=>{const pe=!isFunctionActiveN(G,ce),ge=updateFunctionN(G,ce,{isActive:pe});z(ge);const ve=getFunctionNameN(G,ce)||`Function ${ce+1}`;ie(`${ve} ${pe?"activated":"deactivated"}`)},se=()=>{const ce=G.filter((pe,ge)=>isFunctionActiveN(G,ge)).length;ie(`Changes saved. ${ce} functions are now active.`),N()},ae=()=>{q.current!==null&&z(q.current),ie("Changes cancelled."),N()};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:N,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-lg max-h-[90vh] bg-background rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"Toggle Functions"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Activate or deactivate functions. Click on a function or press Enter to toggle its state. Use the instrument button to cycle through available instruments."})]}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:Y}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-y-auto px-6",role:"main","aria-label":"Function list",children:[(G||[]).length===0&&jsxRuntimeExports.jsx("div",{className:"text-center py-8 text-descriptions",children:"No functions defined. Please add functions first."}),(G||[]).map((ce,pe)=>jsxRuntimeExports.jsx(FunctionToggleItem,{index:pe,name:getFunctionNameN(G,pe),isActive:isFunctionActiveN(G,pe),onToggle:()=>ne(pe),announceStatus:ie},ce.id))]}),jsxRuntimeExports.jsx("div",{className:"px-6 py-4",role:"group","aria-label":"Dialog actions",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center gap-2",role:"group","aria-label":"Dialog controls",children:[jsxRuntimeExports.jsx("button",{onClick:ae,className:"btn-secondary sm:w-auto",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:se,className:"btn-primary sm:w-auto",children:"Save"})]})})]})})]})},FunctionToggleItem=({index:v,name:N,isActive:G,onToggle:z,announceStatus:q})=>{const{functionDefinitions:Y,setFunctionDefinitions:W}=useGraphContext(),{availableInstruments:ie}=useInstruments(),ne=ve=>{(ve.key==="Enter"||ve.key===" ")&&(ve.preventDefault(),z())},se=ve=>{ve.stopPropagation();const be=getFunctionInstrumentN(Y,v)||"clarinet",Ee=ie.map(qe=>qe.name);let Pe=Ee.indexOf(be);Pe===-1&&(Pe=0);const Je=(Pe+1)%Ee.length,Ce=Ee[Je],Ve=setFunctionInstrumentN(Y,v,Ce);W(Ve);const Re=N||`Function ${v+1}`;q(`${Re} instrument changed to ${Ce}`)},ae=ve=>{(ve.key==="Enter"||ve.key===" ")&&(ve.preventDefault(),ve.stopPropagation(),se(ve))},ce=N||`Function ${v+1}`,pe=getFunctionInstrumentN(Y,v)||"clarinet",ge=ve=>{switch(ve){case"clarinet":return jsxRuntimeExports.jsx(Music,{className:"w-4 h-4 text-icon","aria-hidden":"true"});case"flute":return jsxRuntimeExports.jsx(Wind,{className:"w-4 h-4 text-icon","aria-hidden":"true"});case"organ":return jsxRuntimeExports.jsx(Zap,{className:"w-4 h-4 text-icon","aria-hidden":"true"});case"guitar":return jsxRuntimeExports.jsx(Guitar,{className:"w-4 h-4 text-icon","aria-hidden":"true"});default:return jsxRuntimeExports.jsx(Music,{className:"w-4 h-4 text-icon","aria-hidden":"true"})}};return jsxRuntimeExports.jsx("div",{className:"mb-2",role:"group","aria-labelledby":`function-toggle-${v}-label`,children:jsxRuntimeExports.jsx("div",{className:`p-4 border rounded-lg cursor-pointer transition-colors select-none ${G?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-gray-mddk bg-background hover:border-gray-md"}`,children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3 cursor-pointer flex-1",onClick:z,onKeyDown:ne,tabIndex:0,role:"button","aria-pressed":G,"aria-label":`Toggle ${ce}. Currently ${G?"active":"inactive"}`,children:[jsxRuntimeExports.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${G?"bg-green-500":"bg-gray-mddk"}`,"aria-hidden":"true",children:G?jsxRuntimeExports.jsx(Check,{className:"w-4 h-4 text-white"}):jsxRuntimeExports.jsx(X,{className:"w-4 h-4 text-white"})}),jsxRuntimeExports.jsx("span",{id:`function-toggle-${v}-label`,className:"text-sm font-medium text-descriptions",children:ce})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"btn-neutral ml-2",onClick:se,onKeyDown:ae,"aria-label":`Change instrument for ${ce}. Current instrument: ${pe}. Press Enter to cycle to next instrument.`,children:ge(pe)})]})})})},MovementAdjustmentsDialog=({isOpen:v,onClose:N})=>{const{PlayFunction:G,setPlayFunction:z,stepSize:q,setStepSize:Y,focu
732sChart:W}=useGraphContext(),ie=reactExports.useRef(null),ne=reactExports.useRef(null);reactExports.useEffect(()=>{v&&(ie.current=G.speed,ne.current=q)},[v]);const se=()=>{ie.current!==null&&z(Ce=>({...Ce,speed:ie.current})),ne.current!==null&&Y(ne.current),N(),setTimeout(()=>W(),100)},ae=()=>{N(),setTimeout(()=>W(),100)},ce=()=>{N(),setTimeout(()=>W(),100)},pe=Ce=>{Ce.key==="Enter"&&(Ce.preventDefault(),Ce.stopPropagation(),N&&ae()),Ce.key==="Escape"&&(Ce.preventDefault(),Ce.stopPropagation(),se())},ge=Ce=>{(Ce===""||!isNaN(parseFloat(Ce))&&parseFloat(Ce)>=0)&&z(Ve=>({...Ve,speed:Ce===""?Ce:parseFloat(Ce)}))},ve=Ce=>{(Ce===""||!isNaN(parseFloat(Ce))&&parseFloat(Ce)>=0)&&Y(Ce===""?Ce:parseFloat(Ce))},be=Ce=>{(Ce===""||Ce==="-")&&z(Ve=>({...Ve,speed:0}))},Ee=Ce=>{(Ce===""||Ce==="-")&&Y(.1),Ce==="0"&&Y(.01)},Pe=Ce=>{const Ve=parseFloat(Ce)||0;return Ve<=1?.1:Ve<=10?.5:1},Je=Ce=>(parseFloat(Ce)||0)<=1?.1:1;return jsxRuntimeExports.jsxs(yt,{open:v,onClose:ce,"aria-modal":"true",role:"dialog",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-lg bg-background rounded-lg p-6 shadow-lg",children:[jsxRuntimeExports.jsx(Ye,{className:"text-lg font-bold text-titles",children:"Movement Adjustments"}),jsxRuntimeExports.jsx(H$2,{className:"text-descriptions",children:"Adjust movement and navigation settings for the graph."}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"text-input-outer",children:[jsxRuntimeExports.jsx("div",{className:"text-input-label",children:"Speed:"}),jsxRuntimeExports.jsx("input",{id:"speed-input",type:"number",step:Pe(G.speed),min:"0",value:G.speed,onChange:Ce=>ge(Ce.target.value),onBlur:Ce=>be(Ce.target.value),onKeyDown:pe,className:"text-input-inner","aria-label":"Movement speed"})]}),jsxRuntimeExports.jsxs("div",{className:"text-input-outer",children:[jsxRuntimeExports.jsx("div",{className:"text-input-label",children:"Step Size:"}),jsxRuntimeExports.jsx("input",{id:"stepsize-input",type:"number",step:Je(q),min:"0",value:q,onChange:Ce=>ve(Ce.target.value),onBlur:Ce=>Ee(Ce.target.value),onKeyDown:pe,className:"text-input-inner","aria-label":"Navigation step size"})]})]}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center mt-4 gap-2",children:[jsxRuntimeExports.jsx("button",{onClick:se,className:"btn-secondary",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:ae,className:"btn-primary",children:"Accept"})]})]})})]})},SpeedAdjustmentDialog=({isOpen:v,onClose:N})=>{const{PlayFunction:G,setPlayFunction:z}=useGraphContext(),q=reactExports.useRef(null);reactExports.useEffect(()=>{v&&(q.current=G.speed)},[v,G.speed]);const Y=()=>{q.current!==null&&z(ie=>({...ie,speed:q.current})),N()},W=ie=>{ie.key==="Enter"&&(ie.preventDefault(),ie.stopPropagation(),N&&N())};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:N,"aria-modal":"true",role:"dialog",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-lg bg-background rounded-lg p-6 shadow-lg",children:[jsxRuntimeExports.jsx(Ye,{className:"text-lg font-bold text-titles",children:"Speed Adjustment"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("div",{className:"space-y-4",children:jsxRuntimeExports.jsxs("div",{className:"text-input-outer",children:[jsxRuntimeExports.jsx("div",{className:"text-input-label",children:"Speed:"}),jsxRuntimeExports.jsx("input",{id:"speed-input",type:"number",value:G.speed,onChange:ie=>z(ne=>({...ne,speed:parseFloat(ie.target.value)})),onKeyDown:W,className:"text-input-inner","aria-label":"Audio playback speed"})]})}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center mt-4 gap-2",children:[jsxRuntimeExports.jsx("button",{onClick:Y,className:"btn-secondary",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:N,className:"btn-primary",children:"Accept"})]})]})})]})},ShareLinkDialog=({isOpen:v,onClose:N,shareLink:G})=>{const[z,q]=reactExports.useState(""),[Y,W]=reactExports.useState(!1),ie=reactExports.useRef(null);reactExports.useEffect(()=>{v&&ie.current&&(ie.current.select(),ne("Share link generated and ready to copy."))},[v]);const ne=ae=>{q(ae),setTimeout(()=>q(""),3e3)};reactExports.useEffect(()=>{const ae=ce=>{ce.key==="Escape"&&(ce.preventDefault(),N()),(ce.ctrlKey||ce.metaKey)&&ce.key==="c"&&(ce.preventDefault(),se())};if(v)return document.addEventListener("keydown",ae),()=>document.removeEventListener("keydown",ae)},[v]);const se=async()=>{var ae;try{await navigator.clipboard.writeText(G),W(!0),ne("Link copied to clipboard."),setTimeout(()=>W(!1),2e3)}catch{(ae=ie.current)==null||ae.select(),document.execCommand("copy"),W(!0),ne("Link copied to clipboard."),setTimeout(()=>W(!1),2e3)}};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:N,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-2xl bg-background rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"Share Link"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Copy this link to share your functions and graph settings."})]}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:z}),jsxRuntimeExports.jsx("div",{className:"px-6 pb-6",role:"main","aria-label":"Share link content",children:jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3  ",children:[jsxRuntimeExports.jsxs("div",{className:"text-input-outer grow",children:[jsxRuntimeExports.jsx("div",{className:"text-input-label",children:"Share Link:"}),jsxRuntimeExports.jsx("input",{ref:ie,type:"text",value:G,readOnly:!0,className:"text-input-inner flex-1","aria-label":"Generated share link"})]}),jsxRuntimeExports.jsx("button",{onClick:se,className:"btn-neutral h-10","aria-label":"Copy link to clipboard",title:"Copy to clipboard",children:Y?jsxRuntimeExports.jsx(Check,{className:"h-4 w-4"}):jsxRuntimeExports.jsx(Copy,{className:"h-4 w-4"})})]})}),jsxRuntimeExports.jsx("div",{className:"px-6 py-4",role:"group","aria-label":"Dialog actions",children:jsxRuntimeExports.jsx("div",{className:"flex justify-end items-center gap-2",role:"group","aria-label":"Dialog controls",children:jsxRuntimeExports.jsx("button",{onClick:N,className:"btn-primary sm:w-auto",children:"Done"})})})]})})]})},ShareDialog=({isOpen:v,onClose:N})=>{const{graphBounds:G,graphSettings:z,setGraphSettings:q,functionDefinitions:Y}=useGraphContext(),[W,ie]=reactExports.useState(""),[ne,se]=reactExports.useState(!1),[ae,ce]=reactExports.useState(""),[pe,ge]=reactExports.useState(!1),[ve,be]=reactExports.useState({}),[Ee,Pe]=reactExports.useState({minBoundDifference:.1,maxBoundDifference:100,restrictionMode:"none"}),Je=Object.keys(ve).length>0;reactExports.useEffect(()=>{v&&(Pe({minBoundDifference:z.minBoundDifference||.1,maxBoundDifference:z.maxBoundDifference||100,restrictionMode:z.restrictionMode||"none"}),ge(!1),be({}),Ce("Share dialog opened."))},[v,z]);const Ce=ut=>{ie(ut),setTimeout(()=>ie(""),3e3)},Ve=(ut,ct)=>{const at=[];
732if(ut===""||ut==="-")return at.push("Value cannot be empty"),at;const st=parseFloat(ut);return isNaN(st)?(at.push("Must be a valid number"),at):isFinite(st)?(st<=0&&at.push("Value must be greater than 0"),at):(at.push("Value cannot be infinite"),at)},Re=ut=>{const ct={};if(["minBoundDifference","maxBoundDifference"].forEach(at=>{const st=Ve(ut[at]);st.length>0&&(ct[at]=st)}),Object.keys(ct).length===0){const at=parseFloat(ut.minBoundDifference),st=parseFloat(ut.maxBoundDifference);if(at>=st&&(ct.minBoundDifference=ct.minBoundDifference||[],ct.maxBoundDifference=ct.maxBoundDifference||[],ct.minBoundDifference.push("Min difference must be less than max difference"),ct.maxBoundDifference.push("Max difference must be greater than min difference")),G){const pt=Math.abs(G.xMax-G.xMin),lt=Math.abs(G.yMax-G.yMin);(pt<at||lt<at)&&(ct.minBoundDifference=ct.minBoundDifference||[],ct.minBoundDifference.push(`Current view (X: ${pt.toFixed(2)}, Y: ${lt.toFixed(2)}) is smaller than minimum difference`)),(pt>st||lt>st)&&(ct.maxBoundDifference=ct.maxBoundDifference||[],ct.maxBoundDifference.push(`Current view (X: ${pt.toFixed(2)}, Y: ${lt.toFixed(2)}) is larger than maximum difference`))}}return ct};reactExports.useEffect(()=>{const ut=ct=>{ct.key==="Escape"&&(ct.preventDefault(),qe())};if(v)return document.addEventListener("keydown",ut),()=>document.removeEventListener("keydown",ut)},[v]);const qe=()=>{N()},et=()=>{if(Je){Ce("Cannot share: Please fix all errors before sharing.");return}q(pt=>({...pt,defaultView:[G.xMin,G.xMax,G.yMax,G.yMin],minBoundDifference:Ee.minBoundDifference,maxBoundDifference:Ee.maxBoundDifference}));const ut={functions:Y,graphSettings:{...z,defaultView:[G.xMin,G.xMax,G.yMax,G.yMin],minBoundDifference:Ee.minBoundDifference,maxBoundDifference:Ee.maxBoundDifference,restrictionMode:Ee.restrictionMode}};JSON.stringify(ut);const ct=encodeToImportLink(ut),st=`${window.location.origin+window.location.pathname}#import=${ct}`;ce(st),se(!0),N(),Ce("Settings saved and share link generated.")},Ze=()=>{se(!1)},tt=(ut,ct)=>{Pe(at=>({...at,[ut]:ct}))},Ke=(ut,ct)=>{if(ct===""||ct==="-"||!isNaN(parseFloat(ct))){const at=ct===""||ct==="-"?ct:parseFloat(ct),st={...Ee,[ut]:at};Pe(st);const pt=Re(st);be(pt)}},rt=(ut,ct)=>{let at=ct;if(ct===""||ct==="-"){at=ut==="minBoundDifference"?.1:100;const lt={...Ee,[ut]:at};Pe(lt)}const st={...Ee,[ut]:at},pt=Re(st);be(pt),pt[ut]&&Ce(`Error in ${ut}: ${pt[ut].join(". ")}`)},it=()=>{if(Je){Ce("Cannot save: Please fix all errors before saving.");return}q(ct=>({...ct,defaultView:[G.xMin,G.xMax,G.yMax,G.yMin],minBoundDifference:Ee.minBoundDifference,maxBoundDifference:Ee.maxBoundDifference}));const ut={functions:Y,graphSettings:{...z,defaultView:[G.xMin,G.xMax,G.yMax,G.yMin],minBoundDifference:Ee.minBoundDifference,maxBoundDifference:Ee.maxBoundDifference,restrictionMode:Ee.restrictionMode}};try{const ct=JSON.stringify(ut,null,2),at=new Blob([ct],{type:"application/json"}),st=URL.createObjectURL(at),pt=document.createElement("a");pt.href=st,pt.download="audiofunctions-export.json",document.body.appendChild(pt),pt.click(),document.body.removeChild(pt),URL.revokeObjectURL(st),Ce("JSON file downloaded successfully."),N()}catch(ct){Ce("Error downloading JSON file."),console.error("Download error:",ct)}},ot=(ut,ct,at)=>{const st=ve[ut]&&ve[ut].length>0,pt=st?ve[ut].join(". "):null;return jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntimeExports.jsxs("div",{className:`text-input-outer ${st?"error-border error-background":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"text-input-label","aria-hidden":"true",children:[ct,":"]}),jsxRuntimeExports.jsx("input",{id:at,type:"number",step:"0.1",value:Ee[ut],onChange:lt=>Ke(ut,lt.target.value),onBlur:lt=>rt(ut,lt.target.value),"aria-label":ct,"aria-invalid":st?"true":"false","aria-errormessage":st?`${at}-error`:void 0,className:`text-input-inner ${st?"error-input":""}`})]}),st&&jsxRuntimeExports.jsxs("div",{id:`${at}-error`,className:"error-message mt-1 text-sm",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),pt]})]})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(yt,{open:v,onClose:N,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-2xl max-h-[90vh] bg-background rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"Share"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Share the current state including all defined functions with their sonifications, speed and step-size values, the current view, and the active function. Configure additional sharing settings below."})]}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:W}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-y-auto px-6 space-y-6",role:"main","aria-label":"Share content",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-md font-semibold text-titles mb-1",children:"Restriction Mode"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-descriptions",children:"Control how users can interact with shared graphs"})]}),jsxRuntimeExports.jsx("div",{className:"text-input-outer pr-1.5 min-w-40",children:jsxRuntimeExports.jsxs("select",{id:"restriction-mode",value:Ee.restrictionMode,onChange:ut=>tt("restrictionMode",ut.target.value),className:"grow text-input-inner","aria-label":"Restriction mode",children:[jsxRuntimeExports.jsx("option",{value:"none",className:"bg-background text-txt",children:"None"}),jsxRuntimeExports.jsx("option",{value:"read-only",className:"bg-background text-txt",children:"Read Only"}),jsxRuntimeExports.jsx("option",{value:"full-restriction",className:"bg-background text-txt",children:"Full Restriction"})]})})]})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{onClick:()=>ge(!pe),className:"flex items-center space-x-2 text-md font-semibold text-titles curs
732or-pointer select-none","aria-expanded":pe,"aria-controls":"advanced-options",role:"button",tabIndex:0,onKeyDown:ut=>{(ut.key==="Enter"||ut.key===" ")&&(ut.preventDefault(),ge(!pe))},children:[jsxRuntimeExports.jsx("svg",{className:`w-4 h-4 transition-transform ${pe?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),jsxRuntimeExports.jsx("span",{children:"Advanced options"})]}),pe&&jsxRuntimeExports.jsxs("div",{id:"advanced-options",className:"mt-4 animate-in slide-in-from-top-2 duration-300",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold text-titles mb-3",children:"Zoom limits"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[ot("minBoundDifference","Min Axis Interval","min-bound-diff"),ot("maxBoundDifference","Max Axis Interval","max-bound-diff")]})]}),jsxRuntimeExports.jsx("br",{})]})]})]}),jsxRuntimeExports.jsx("div",{className:"px-6 py-4",role:"group","aria-label":"Dialog actions",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center gap-2",role:"group","aria-label":"Dialog controls",children:[jsxRuntimeExports.jsx("button",{onClick:qe,className:"btn-secondary sm:w-auto",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:it,className:"btn-secondary sm:w-auto",disabled:Je,"aria-disabled":Je,title:Je?"Please fix all errors before saving":"Save as file",children:"Save as file"}),jsxRuntimeExports.jsx("button",{onClick:et,className:"btn-primary sm:w-auto",disabled:Je,"aria-disabled":Je,title:Je?"Please fix all errors before sharing":"Share via link",children:"Share via link"})]})})]})})]}),jsxRuntimeExports.jsx(ShareLinkDialog,{isOpen:ne,onClose:Ze,shareLink:ae})]})},ExportJsonDialog=({isOpen:v,onClose:N})=>{const{graphBounds:G,graphSettings:z,setGraphSettings:q,functionDefinitions:Y}=useGraphContext(),[W,ie]=reactExports.useState(""),[ne,se]=reactExports.useState(!1),[ae,ce]=reactExports.useState(!1),[pe,ge]=reactExports.useState({}),[ve,be]=reactExports.useState({minBoundDifference:.1,maxBoundDifference:100,restrictionMode:"none"}),Ee=Object.keys(pe).length>0;reactExports.useEffect(()=>{v&&(be({minBoundDifference:z.minBoundDifference||.1,maxBoundDifference:z.maxBoundDifference||100,restrictionMode:z.restrictionMode||"none"}),ce(!1),ge({}),Pe("Export dialog opened."))},[v,z]);const Pe=Ke=>{ie(Ke),setTimeout(()=>ie(""),3e3)},Je=(Ke,rt)=>{const it=[];if(Ke===""||Ke==="-")return it.push("Value cannot be empty"),it;const ot=parseFloat(Ke);return isNaN(ot)?(it.push("Must be a valid number"),it):isFinite(ot)?(ot<=0&&it.push("Value must be greater than 0"),it):(it.push("Value cannot be infinite"),it)},Ce=Ke=>{const rt={};if(["minBoundDifference","maxBoundDifference"].forEach(it=>{const ot=Je(Ke[it]);ot.length>0&&(rt[it]=ot)}),Object.keys(rt).length===0){const it=parseFloat(Ke.minBoundDifference),ot=parseFloat(Ke.maxBoundDifference);if(it>=ot&&(rt.minBoundDifference=rt.minBoundDifference||[],rt.maxBoundDifference=rt.maxBoundDifference||[],rt.minBoundDifference.push("Min difference must be less than max difference"),rt.maxBoundDifference.push("Max difference must be greater than min difference")),G){const ut=Math.abs(G.xMax-G.xMin),ct=Math.abs(G.yMax-G.yMin);(ut<it||ct<it)&&(rt.minBoundDifference=rt.minBoundDifference||[],rt.minBoundDifference.push(`Current view (X: ${ut.toFixed(2)}, Y: ${ct.toFixed(2)}) is smaller than minimum difference`)),(ut>ot||ct>ot)&&(rt.maxBoundDifference=rt.maxBoundDifference||[],rt.maxBoundDifference.push(`Current view (X: ${ut.toFixed(2)}, Y: ${ct.toFixed(2)}) is larger than maximum difference`))}}return rt};reactExports.useEffect(()=>{const Ke=rt=>{rt.key==="Escape"&&(rt.preventDefault(),Ve()),(rt.ctrlKey||rt.metaKey)&&rt.key==="s"&&(rt.preventDefault(),Re())};if(v)return document.addEventListener("keydown",Ke),()=>document.removeEventListener("keydown",Ke)},[v]);const Ve=()=>{N()},Re=()=>{if(Ee){Pe("Cannot export: Please fix all errors before exporting.");return}q(rt=>({...rt,defaultView:[G.xMin,G.xMax,G.yMax,G.yMin],minBoundDifference:ve.minBoundDifference,maxBoundDifference:ve.maxBoundDifference}));const Ke={functions:Y,graphSettings:{...z,defaultView:[G.xMin,G.xMax,G.yMax,G.yMin],minBoundDifference:ve.minBoundDifference,maxBoundDifference:ve.maxBoundDifference,restrictionMode:ve.restrictionMode}};
732try{const rt=JSON.stringify(Ke,null,2),it=new Blob([rt],{type:"application/json"}),ot=URL.createObjectURL(it),ut=document.createElement("a");ut.href=ot,ut.download="audiofunctions-export.json",document.body.appendChild(ut),ut.click(),document.body.removeChild(ut),URL.revokeObjectURL(ot),se(!0),Pe("JSON file downloaded successfully."),N()}catch(rt){Pe("Error downloading JSON file."),console.error("Download error:",rt)}},qe=(Ke,rt)=>{be(it=>({...it,[Ke]:rt}))},et=(Ke,rt)=>{if(rt===""||rt==="-"||!isNaN(parseFloat(rt))){const it=rt===""||rt==="-"?rt:parseFloat(rt),ot={...ve,[Ke]:it};be(ot);const ut=Ce(ot);ge(ut)}},Ze=(Ke,rt)=>{let it=rt;if(rt===""||rt==="-"){it=Ke==="minBoundDifference"?.1:100;const ct={...ve,[Ke]:it};be(ct)}const ot={...ve,[Ke]:it},ut=Ce(ot);ge(ut),ut[Ke]&&Pe(`Error in ${Ke}: ${ut[Ke].join(". ")}`)},tt=(Ke,rt,it)=>{const ot=pe[Ke]&&pe[Ke].length>0,ut=ot?pe[Ke].join(". "):null;return jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntimeExports.jsxs("div",{className:`text-input-outer ${ot?"error-border error-background":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"text-input-label",children:[rt,":"]}),jsxRuntimeExports.jsx("input",{id:it,type:"number",step:"0.1",value:ve[Ke],onChange:ct=>et(Ke,ct.target.value),onBlur:ct=>Ze(Ke,ct.target.value),"aria-label":rt,"aria-invalid":ot?"true":"false","aria-errormessage":ot?`${it}-error`:void 0,className:`text-input-inner ${ot?"error-input":""}`})]}),ot&&jsxRuntimeExports.jsxs("div",{id:`${it}-error`,className:"error-message mt-1 text-sm",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),ut]})]})};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:N,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-2xl max-h-[90vh] bg-background rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"Export JSON"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Export the current state including all defined functions with their sonifications, movement adjustment values, the current view, and the active function. Configure additional export settings below."})]}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:W}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-y-auto px-6 space-y-6",role:"main","aria-label":"Export content",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-md font-semibold text-titles mb-1",children:"Restriction Mode"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-descriptions",children:"Control how users can interact with exported graphs"})]}),jsxRuntimeExports.jsx("div",{className:"text-input-outer pr-1.5 min-w-40",children:jsxRuntimeExports.jsxs("select",{id:"restriction-mode",value:ve.restrictionMode,onChange:Ke=>qe("restrictionMode",Ke.target.value),className:"grow text-input-inner","aria-label":"Restriction mode",children:[jsxRuntimeExports.jsx("option",{value:"none",className:"bg-background text-txt",children:"None"}),jsxRuntimeExports.jsx("option",{value:"read-only",className:"bg-background text-txt",children:"Read Only"}),jsxRuntimeExports.jsx("option",{value:"full-restriction",className:"bg-background text-txt",children:"Full Restriction"})]})})]})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{onClick:()=>ce(!ae),className:"flex items-center space-x-2 text-md font-semibold text-titles curs
732or-pointer select-none","aria-expanded":ae,"aria-controls":"advanced-options",role:"button",tabIndex:0,onKeyDown:Ke=>{(Ke.key==="Enter"||Ke.key===" ")&&(Ke.preventDefault(),ce(!ae))},children:[jsxRuntimeExports.jsx("svg",{className:`w-4 h-4 transition-transform ${ae?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),jsxRuntimeExports.jsx("span",{children:"Advanced options"})]}),ae&&jsxRuntimeExports.jsxs("div",{id:"advanced-options",className:"mt-4 animate-in slide-in-from-top-2 duration-300",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold text-titles mb-3",children:"Zoom limits"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[tt("minBoundDifference","Min Axis Interval","min-bound-diff"),tt("maxBoundDifference","Max Axis Interval","max-bound-diff")]})]}),jsxRuntimeExports.jsx("br",{})]})]})]}),jsxRuntimeExports.jsx("div",{className:"px-6 py-4",role:"group","aria-label":"Dialog actions",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center gap-2",role:"group","aria-label":"Dialog controls",children:[jsxRuntimeExports.jsx("button",{onClick:Ve,className:"btn-secondary sm:w-auto",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:Re,className:"btn-primary sm:w-auto",disabled:Ee,"aria-disabled":Ee,title:Ee?"Please fix all errors before exporting":"Export as JSON file","aria-label":"Export as JSON file",children:"Export"})]})})]})})]})};function validateFunction(v,N=0){if(!v||typeof v!="object")return[!1,"Function must be an object"];if(!v.hasOwnProperty("id"))return[!1,'Function must have an "id" field'];if(!v.hasOwnProperty("functionName"))return[!1,'Function must have a "functionName" field'];if(!v.hasOwnProperty("type"))return[!1,'Function must have a "type" field'];if(!v.hasOwnProperty("functionDef"))return[!1,'Function must have a "functionDef" field'];if(!v.hasOwnProperty("isActive"))return[!1,'Function must have an "isActive" field'];if(!v.hasOwnProperty("instrument"))return[!1,'Function must have an "instrument" field'];if(!v.hasOwnProperty("pointOfInterests"))return[!1,'Function must have a "pointOfInterests" field'];if(!v.hasOwnProperty("landmarks"))return[!1,'Function must have a "landmarks" field'];const[G,z]=validateFunctionId(v.id);if(!G)return[!1,z];const[q,Y]=validateFunctionName(v.functionName);if(!q)return[!1,Y];const[W,ie]=validateFunctionType(v.type);if(!W)return[!1,ie];const[ne,se]=validateFunctionDef(v.functionDef,v.type);if(!ne)return[!1,se];const[ae,ce]=validateFunctionActive(v.isActive);if(!ae)return[!1,ce];const[pe,ge]=validateFunctionInstrument(v.instrument);if(!pe)return[!1,ge];if(v.color!==void 0){const[Je,Ce]=validateFunctionColor(v.color);if(!Je)return[!1,Ce]}const[ve,be]=validatePointsOfInterest(v.pointOfInterests);if(!ve)return[!1,be];const[Ee,Pe]=validateLandmarks(v.landmarks);return Ee?[!0,""]:[!1,Pe]}function validateJsonData(v){try{if(!v||typeof v!="object")return[!1,"Data must be an object"];if(!v.functions&&!v.graphSettings)return[!1,'Data must contain either "functions" or "graphSettings"'];if(v.functions&&!v.hasOwnProperty("functions"))return[!1,'Data must have a "functions" field'];if(v.graphSettings&&!v.hasOwnProperty("graphSettings"))return[!1,'Data must have a "graphSettings" field'];if(!isValidObjectDepth(v,10))return[!1,"Object structure is too deeply nested"];if(v.functions){const[q,Y]=validateFunctions(v.functions);if(!q)return[!1,Y]}if(v.graphSettings){const[q,Y]=validateGraphSettings(v.graphSettings);if(!q)return[!1,Y]}const G=["functions","graphSettings"],z=Object.keys(v).filter(q=>!G.includes(q));return z.length>0&&console.warn(`Unexpected properties in JSON: ${z.join(", ")}`),[!0,""]}catch(N){return[!1,`Validation error: ${N.message}`]}}function isValidObjectDepth(v,N,G=0){if(G>N)return!1;if(typeof v=="object"&&v!==null){for(const z of Object.values(v))if(!isValidObjectDepth(z,N,G+1))return!1}return!0}function validateFunctions(v){if(!Array.isArray(v))return[!1,"Functions must be an array"];const N=50;if(v.length>N)return[!1,`Too many functions (maximum ${N} allowed)`];for(let q=0;q<v.length;q++){const[Y,W]=validateFunction(v[q],q);if(!Y)return[!1,`Function ${q+1}: ${W}`]}const G=v.map(q=>q.id).filter(q=>q),z=new Set(G);return G.length!==z.size?[!1,"Duplicate function IDs found"]:[!0,""]}function validateSafeString(v,N,G={}){const{maxLength:z=1e3,minLength:q=0,allowEmpty:Y=!1,pattern:W=null}=G;if(typeof v!="string")return[!1,`${N} must be a string`];if(!Y&&v.trim().length===0)return[!1,`${N} cannot be empty`];
732if(v.length>z)return[!1,`${N} is too long (maximum ${z} characters)`];if(v.length<q)return[!1,`${N} is too short (minimum ${q} characters)`];if(W&&!W.test(v))return[!1,`${N} contains invalid characters`];const ie=[/<script/i,/javascript:/i,/on\w+\s*=/i,/eval\s*\(/i];for(const ne of ie)if(ne.test(v))return[!1,`${N} contains potentially unsafe content`];return[!0,""]}function validateCoordinate(v,N){if(typeof v!="number")return[!1,`${N} must be a number`];if(!isFinite(v))return[!1,`${N} must be a finite number`];const G=1e6,z=-1e6;return v>G||v<z?[!1,`${N} must be between ${z} and ${G}`]:[!0,""]}function validateFunctionId(v){return validateSafeString(v,"Function ID",{maxLength:50,minLength:1,pattern:/^[a-zA-Z0-9_-]+$/})}function validateFunctionName(v){return validateSafeString(v,"Function name",{maxLength:100,minLength:1,pattern:/^[a-zA-Z0-9\s\-_()[\]]+$/})}function validateFunctionType(v){const N=["function","piecewise_function"];return typeof v!="string"?[!1,"Function type must be a string"]:N.includes(v)?[!0,""]:[!1,`Function type must be one of: ${N.join(", ")}`]}function validateFunctionDef(v,N){if(N==="function")return typeof v!="string"?[!1,"Function definition must be a string for regular functions"]:v.trim()===""?[!1,"Function definition cannot be empty"]:v.length>1e3?[!1,"Function definition is too long (maximum 1000 characters)"]:[!0,""];if(N==="piecewise_function"){if(!Array.isArray(v))return[!1,"Function definition must be an array for piecewise functions"];if(v.length===0)return[!1,"Piecewise function must have at least one piece"];if(v.length>20)return[!1,"Too many piecewise function pieces (maximum 20 allowed)"];for(let G=0;G<v.length;G++){const z=v[G];if(!Array.isArray(z)||z.length!==2)return[!1,`Piecewise function piece ${G+1} must be an array with exactly 2 elements`];if(typeof z[0]!="string"||typeof z[1]!="string")return[!1,`Piecewise function piece ${G+1} must contain two strings`];if(z[0].trim()===""||z[1].trim()==="")return[!1,`Piecewise function piece ${G+1} cannot have empty expressions`];if(z[0].length>500||z[1].length>500)return[!1,`Piecewise function piece ${G+1} expressions are too long (maximum 500 characters each)`]}return[!0,""]}return[!1,"Invalid function type for validation"]}function validateFunctionActive(v){return typeof v!="boolean"?[!1,"Function isActive must be a boolean"]:[!0,""]}function validateFunctionInstrument(v){return validateSafeString(v,"Function instrument",{maxLength:50,minLength:1})}function validateFunctionColor(v){return typeof v!="string"?[!1,"Function color must be a string"]:/^#[0-9A-Fa-f]{6}$/.test(v)?[!0,""]:[!1,"Function color must be a valid hex color (e.g., #FF0000)"]}function validatePointsOfInterest(v){if(!Array.isArray(v))return[!1,"Points of interest must be an array"];const N=100;if(v.length>N)return[!1,`Too many points of interest (maximum ${N} allowed)`];for(let G=0;G<v.length;G++){const[z,q]=validatePointOfInterest(v[G],G);if(!z)return[!1,`Point of interest ${G+1}: ${q}`]}return[!0,""]}function validatePointOfInterest(v,N=0){if(!v||typeof v!="object")return[!1,"Point of interest must be an object"];if(!v.hasOwnProperty("x"))return[!1,'Point of interest must have an "x" field'];if(!v.hasOwnProperty("y"))return[!1,'Point of interest must have a "y" field'];if(!v.hasOwnProperty("type"))return[!1,'Point of interest must have a "type" field'];const[G,z]=validateCoordinate(v.x,"Point x coordinate");if(!G)return[!1,z];if(v.y!==void 0&&!isNaN(v.y)){const[Y,W]=validateCoordinate(v.y,"Point y coordinate");if(!Y)return[!1,W]}const q=["isolated","unequal","maximum","minimum","discontinuity"];if(typeof v.type!="string"||!q.includes(v.type))return[!1,`Point type must be one of: ${q.join(", ")}`];if(v.label!==void 0){const[Y,W]=validateSafeString(v.label,"Point label",{maxLength:100,allowEmpty:!0});if(!Y)return[!1,W]}if(v.color!==void 0){const[Y,W]=validateFunctionColor(v.color);if(!Y)return[!1,W]}if(v.earcon!==void 0){const[Y,W]=validateSafeString(v.earcon,"Point earcon",{maxLength:100,allowEmpty:!0});if(!Y)return[!1,W]}return[!0,""]}function validateLandmarks(v){if(!Array.isArray(v))return[!1,"Landmarks must be an array"];const N=50;if(v.length>N)return[!1,`Too many landmarks (maximum ${N} allowed)`];for(let G=0;G<v.length;G++){const[z,q]=validateLandmark(v[G],G);if(!z)return[!1,`Landmark ${G+1}: ${q}`]}return[!0,""]}function validateLandmark(v,N=0){if(!v||typeof v!="object")return[!1,"Landmark must be an object"];if(!v.hasOwnProperty("x"))return[!1,'Landmark must have an "x" field'];if(!v.hasOwnProperty("y"))return[!1,'Landmark must have a "y" field'];if(!v.hasOwnProperty("earcon"))return[!1,'Landmark must have an "earcon" field'];if(!v.hasOwnProperty("shortcut"))return[!1,'Landmark must have a "shortcut" field'];const[G,z]=validateCoordinate(v.x,"Landmark x coordinate");if(!G)return[!1,z];const[q,Y]=validateCoordinate(v.y,"Landmark y coordinate");if(!q)return[!1,Y];const[W,ie]=validateSafeString(v.earcon,"Landmark earcon",{maxLength:100,allowEmpty:!0});if(!W)return[!1,ie];const[ne,se]=validateSafeString(v.shortcut,"Landmark shortcut",{maxLength:20,allowEmpty:!0});if(!ne)return[!1,se];if(v.label!==void 0){const[ae,ce]=validateSafeString(v.label,"Landmark label",{maxLength:100,allowEmpty:!0});if(!ae)return[!1,ce]}if(v.color!==void 0){const[ae,ce]=validateFunctionColor(v.color);if(!ae)return[!1,ce]}if(v.message!==void 0){const[ae,ce]=validateSafeString(v.message,"Landmark message",{maxLength:500,allowEmpty:!0});if(!ae)return[!1,ce]}return[!0,""]}function validateGraphSettings(v){if(!v||typeof v!="object")return[!1,"Graph settings must be an object"];if(v.defaultView!==void 0){const[N,G]=validateDefaultView(v.defaultView);if(!N)return[!1,G]}if(v.minBoundDifference!==void 0){const[N,G]=validateMinBoundDifference(v.minBoundDifference);if(!N)return[!1,G]}if(v.maxBoundDifference!==void 0){const[N,G]=validateMaxBoundDifference(v.maxBoundDifference);if(!N)return[!1,G]}if(v.showGrid!==void 0){const[N,G]=validateShowGrid(v.showGrid);if(!N)return[!1,G]}if(v.showAxes!==void 0){const[N,G]=validateShowAxes(v.showAxes);if(!N)return[!1,G]}if(v.gridColor!==void 0){const[N,G]=validateGridColor(v.gridColor);if(!N)return[!1,G]}if(v.restrictionMode!==void 0){const[N,G]=validateRestrictionMode(v.restrictionMode);
732if(!N)return[!1,G]}return[!0,""]}function validateDefaultView(v){if(!Array.isArray(v))return[!1,"Default view must be an array"];if(v.length!==4)return[!1,"Default view must contain exactly 4 elements [xMin, xMax, yMax, yMin]"];for(let Y=0;Y<4;Y++)if(typeof v[Y]!="number"||!isFinite(v[Y]))return[!1,`Default view element ${Y} must be a finite number`];const[N,G,z,q]=v;return N>=G?[!1,"Default view: xMin must be less than xMax"]:q>=z?[!1,"Default view: yMin must be less than yMax"]:[!0,""]}function validateMinBoundDifference(v){return typeof v!="number"||!isFinite(v)?[!1,"Minimum bound difference must be a finite number"]:v<=0?[!1,"Minimum bound difference must be positive"]:[!0,""]}function validateMaxBoundDifference(v){return typeof v!="number"||!isFinite(v)?[!1,"Maximum bound difference must be a finite number"]:v<=0?[!1,"Maximum bound difference must be positive"]:[!0,""]}function validateShowGrid(v){return typeof v!="boolean"?[!1,"Show grid setting must be a boolean"]:[!0,""]}function validateShowAxes(v){return typeof v!="boolean"?[!1,"Show axes setting must be a boolean"]:[!0,""]}function validateGridColor(v){return typeof v!="string"?[!1,"Grid color must be a string"]:/^#[0-9A-Fa-f]{6}$/.test(v)?[!0,""]:[!1,"Grid color must be a valid hex color (e.g., #CCCCCC)"]}function validateRestrictionMode(v){const N=["none","read-only","full-restriction"];return typeof v!="string"?[!1,"Restriction mode must be a string"]:N.includes(v)?[!0,""]:[!1,`Restriction mode must be one of: ${N.join(", ")}`]}const ImportJsonDialog=({isOpen:v,onClose:N})=>{const{setFunctionDefinitions:G,setGraphSettings:z,setGraphBounds:q}=useGraphContext(),[Y,W]=reactExports.useState(""),[ie,ne]=reactExports.useState(!1),[se,ae]=reactExports.useState(null),[ce,pe]=reactExports.useState(""),[ge,ve]=reactExports.useState(""),be=reactExports.useRef(null);reactExports.useEffect(()=>{v&&(ae(null),pe(""),ve(""),Ee("Import dialog opened. Drop a JSON file or click to select."))},[v]);const Ee=Ze=>{W(Ze),setTimeout(()=>W(""),3e3)};reactExports.useEffect(()=>{const Ze=tt=>{tt.key==="Escape"&&(tt.preventDefault(),N()),(tt.ctrlKey||tt.metaKey)&&tt.key==="o"&&(tt.preventDefault(),Pe())};if(v)return document.addEventListener("keydown",Ze),()=>document.removeEventListener("keydown",Ze)},[v]);const Pe=()=>{var Ze;(Ze=be.current)==null||Ze.click()},Je=Ze=>{if(!Ze.name.toLowerCase().endsWith(".json")){ve("Please select a JSON file."),Ee("Invalid file type. Please select a JSON file.");return}ae(Ze),ve("");const tt=new FileReader;tt.onload=Ke=>{try{const rt=Ke.target.result,it=JSON.parse(rt),[ot,ut]=validateJsonData(it);if(!ot){ve(ut),Ee(`Validation failed: ${ut}`);return}pe(rt),Ee("JSON file loaded and validated successfully.")}catch{ve("Invalid JSON format. Please check your file."),Ee("Invalid JSON format. Please check your file.")}},tt.onerror=()=>{ve("Error reading file. Please try again."),Ee("Error reading file. Please try again.")},tt.readAsText(Ze)},Ce=Ze=>{const tt=Ze.target.files[0];tt&&Je(tt)},Ve=Ze=>{Ze.preventDefault(),ne(!0)},Re=Ze=>{Ze.preventDefault(),ne(!1)},qe=Ze=>{Ze.preventDefault(),ne(!1);const tt=Ze.dataTransfer.files;tt.length>0&&Je(tt[0])},et=()=>{if(!ce||ge){Ee("Please select a valid JSON file first.");return}try{const Ze=JSON.parse(ce);if(Ze.functions&&G(Ze.functions),Ze.graphSettings&&(z(Ze.graphSettings),Ze.graphSettings.defaultView)){const[tt,Ke,rt,it]=Ze.graphSettings.defaultView;q({xMin:tt,xMax:Ke,yMin:it,yMax:rt})}Ee("Data imported successfully."),N()}catch{ve("Error importing data. Please try again."),Ee("Error importing data. Please try again.")}};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:N,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-2xl bg-background rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"Import JSON"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Import functions and graph settings from a JSON file. Drop a file or click to select."})]}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:Y}),jsxRuntimeExports.jsxs("div",{className:"px-6 pb-6",role:"main","aria-label":"Import JSON content",children:[jsxRuntimeExports.jsx("div",{className:`relative border-2 border-dashed rounded-lg p-8 text-center transition-colors cursor-pointer ${ie?"border-primary bg-primary/10":ge?"border-red-500 bg-red-500/5":se?"border-primary bg-primary/10":"border-border hover:opacity-80"}`,onDragOver:Ve,onDragLeave:Re,onDrop:qe,onClick:Pe,role:"button",tabIndex:0,"aria-label":"Drop zone for JSON file import",onKeyDown:Ze=>
732{(Ze.key==="Enter"||Ze.key===" ")&&(Ze.preventDefault(),Pe())},children:se?jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(FileJson,{className:"mx-auto h-12 w-12 text-primary"}),jsxRuntimeExports.jsx("div",{className:"flex items-center justify-center space-x-2",children:jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-titles",children:se.name})}),jsxRuntimeExports.jsxs("p",{className:"text-xs text-descriptions",children:["File size: ",(se.size/1024).toFixed(1)," KB"]})]}):jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Upload,{className:"mx-auto h-12 w-12 text-txt-subtitle"}),jsxRuntimeExports.jsx("div",{className:"text-sm font-medium text-titles",children:"Drop your JSON file here"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-descriptions",children:"or click to select from your device"})]})}),ge&&jsxRuntimeExports.jsx("div",{className:"mt-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md",children:jsxRuntimeExports.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:ge})}),jsxRuntimeExports.jsx("input",{ref:be,type:"file",accept:".json",onChange:Ce,className:"hidden","aria-label":"Select JSON file"})]}),jsxRuntimeExports.jsx("div",{className:"px-6 py-4",role:"group","aria-label":"Dialog actions",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-end items-center gap-2",role:"group","aria-label":"Dialog controls",children:[jsxRuntimeExports.jsx("button",{onClick:N,className:"btn-secondary sm:w-auto",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:et,disabled:!ce||!!ge,className:"btn-primary sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Import JSON data",title:"Import JSON data",children:"Import"})]})})]})})]})},WelcomeDialog=({isOpen:v,onClose:N,isAutoOpened:G=!1})=>{const[z,q]=reactExports.useState(0),[Y,W]=reactExports.useState(""),ie=reactExports.useRef(null),ne=reactExports.useRef(!1),se=reactExports.useRef(null),ae=[{title:"Welcome to AudioFunctions+",content:jsxRuntimeExports.jsxs("div",{className:"space-y-4",tabIndex:-1,children:[jsxRuntimeExports.jsx("p",{className:"text-descriptions",children:"Welcome to AudioFunctions+, an innovative tool for exploring mathematical functions through interactive sonification."}),jsxRuntimeExports.jsx("p",{className:"text-descriptions",children:"This tutorial will guide you through the main features and help you get started with creating and exploring mathematical functions."}),jsxRuntimeExports.jsx("div",{className:"info-box",role:"note","aria-label":"Helpful tip",children:jsxRuntimeExports.jsxs("p",{className:"text-descriptions",children:[jsxRuntimeExports.jsx("strong",{children:"Tip:"})," You can always access this tutorial again through the Help section in the command palette (",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Ctrl+K"})," or ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Cmd+K"}),") or by pressing ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"F1"})]})}),jsxRuntimeExports.jsxs("div",{className:"shortcut-reference-box",children:[jsxRuntimeExports.jsx("h2",{className:"text-titles font-semibold mb-3",children:"Complete Documentation"}),jsxRuntimeExports.jsx("p",{className:"text-descriptions text-sm mb-4",children:"This tutorial provides a quick overview of the main features. For comprehensive documentation including all shortcuts, and advanced features, visit our detailed user guide."}),jsxRuntimeExports.jsxs("button",{onClick:()=>{window.open("https://m2rash.github.io/audiofunctions-plus/","_blank")},className:"btn-primary flex items-center gap-2 justify-center","aria-label":"Open complete user guide in new tab",children:[jsxRuntimeExports.jsx(BookOpen,{className:"w-4 h-4"}),"View Complete Guide"]})]})]})},{title:"Navigation and Sonification",content:jsxRuntimeExports.jsxs("div",{className:"space-y-4",tabIndex:-1,children:[jsxRuntimeExports.jsx("p",{className:"text-descriptions",children:"AudioFunctions+ offers multiple ways to explore your functions with both visual and audio feedback."}),jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"text-titles font-semibold",children:"Keyboard Navigation:"}),jsxRuntimeExports.jsxs("ul",{className:"list-disc list-inside space-y-1 text-descriptions text-sm",role:"list",children:[jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"←"})," / ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"→"})," or ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"J"})," / ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"L"})," - Move cursor step by step"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Shift"})," + (",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"←"})," / ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"→"})," or ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"J"})," / ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"L"}),") - Smooth continuous movement"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"W/A/S/D"})," - Pan the view"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Z"})," - Zoom in"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Shift"})," + ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Z"})," - Zoom out"]})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"text-titles font-semibold",children:"Audio Features:"}),jsxRuntimeExports.jsxs("p",{className:"text-descriptions",children:["As you navigate, you'll hear the function values as musical tones, making it easier to understand the mathematical relationships. You can switch between two different sonification modes by pressing ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"I"}),". Additionally, there are various earcons (audio cues) that provide helpful feedback."]}),jsxRuntimeExports.jsx("div",{className:"mt-3",children:jsxRuntimeExports.jsxs("button",{onClick:()=>{window.open("https://m2rash.github.io/audiofunctions-plus/earcons.html","_blank")},className:"btn-secondary flex items-center gap-2","aria-label":"Learn more about earcons and audio cues in new tab",children:[jsxRuntimeExports.jsx(BookOpen,{className:"w-4 h-4"}),"Learn About Earcons"]})})]})]})]})},{title:"Other Actions",content:jsxRuntimeExports.jsxs("div",{className:"space-y-4",tabIndex:-1,
732children:[jsxRuntimeExports.jsxs("p",{className:"text-descriptions",children:["Beyond navigating functions, AudioFunctions+ offers many additional features through the ",jsxRuntimeExports.jsx("strong",{children:"Command Palette"}),"."]}),jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"text-titles font-semibold",children:"Opening the Command Palette:"}),jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Ctrl+K"})," / ",jsxRuntimeExports.jsx("kbd",{className:"kbd",children:"Cmd+K"})," - Opens the Command Palette",jsxRuntimeExports.jsx("p",{className:"text-descriptions text-sm mt-2",children:'The Command Palette is your central hub for all actions like "show current coordinates" or "switch sonification instrument". Many actions also have direct keyboard shortcuts (hotkeys).'})]}),jsxRuntimeExports.jsx("div",{className:"info-box",role:"note","aria-label":"Command Palette tip",children:jsxRuntimeExports.jsxs("p",{className:"text-descriptions",children:[jsxRuntimeExports.jsx("strong",{children:"Tip:"}),` In the Command Palette, you can simply type part of a action name (e.g. "instrument", "coordinates") - you don't need to know the exact name!`]})})]}),jsxRuntimeExports.jsxs("div",{className:"shortcut-reference-box",children:[jsxRuntimeExports.jsx("h2",{className:"text-titles font-semibold mb-3",children:"Additional Resources"}),jsxRuntimeExports.jsx("p",{className:"text-descriptions text-sm mb-4",children:"For comprehensive documentation, visit our detailed program guide which includes a complete list of all keyboard shortcuts and advanced features."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[jsxRuntimeExports.jsxs("button",{onClick:()=>{window.open("https://m2rash.github.io/audiofunctions-plus/","_blank")},className:"btn-primary flex items-center gap-2 justify-center","aria-label":"Open detailed program guide in new tab",children:[jsxRuntimeExports.jsx(BookOpen,{className:"w-4 h-4"}),"Program Guide"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{window.open("https://m2rash.github.io/audiofunctions-plus/shortcuts.html","_blank")},className:"btn-secondary flex items-center gap-2 justify-center","aria-label":"Open keyboard shortcuts reference in new tab",children:[jsxRuntimeExports.jsx(BookOpen,{className:"w-4 h-4"}),"Shortcuts Reference"]})]})]})]})}],ce=z===ae.length-1,pe=z===0,ge=Je=>{se.current&&clearTimeout(se.current),W(Je),se.current=setTimeout(()=>{W(""),se.current=null},3e3)};reactExports.useEffect(()=>{v&&!ne.current?(ne.current=!0,q(0),setTimeout(()=>{ge("Welcome tutorial opened. Use arrow keys or buttons to navigate.")},600)):v||(ne.current=!1)},[v]),reactExports.useEffect(()=>{if(v&&ne.current){const Je=document.getElementById("dialog-description");Je&&(Je.textContent=`Page ${z+1} of ${ae.length}`)}},[z,v,ae.length]),reactExports.useEffect(()=>{v&&ie.current&&setTimeout(()=>{var Je;(Je=ie.current)==null||Je.focus()},100)},[z,v]),reactExports.useEffect(()=>()=>{se.current&&clearTimeout(se.current)},[]);const ve=()=>{z<ae.length-1&&q(Je=>Je+1)},be=()=>{z>0&&q(Je=>Je-1)};reactExports.useEffect(()=>{v&&ie.current&&setTimeout(()=>{var Je;(Je=ie.current)==null||Je.focus()},100)},[z,v]);const Ee=()=>{try{localStorage.setItem("audiofunctions-welcome-seen","true")}catch(Je){console.warn("Unable to save welcome dialog state to localStorage:",Je)}N()},Pe=ae[z];return jsxRuntimeExports.jsxs(yt,{open:v,onClose:G?()=>{}:Ee,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-2xl max-h-[90vh] bg-background border border-border rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles","aria-live":"off",children:Pe.t
732itle}),jsxRuntimeExports.jsxs(H$2,{id:"dialog-description",className:"text-descriptions","aria-live":"polite",children:["Page ",z+1," of ",ae.length]})]}),Y&&jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:Y}),jsxRuntimeExports.jsx("div",{ref:ie,className:"pb-4 flex-1 overflow-y-auto px-6 focus:outline-none",role:"main","aria-label":`Tutorial content: ${Pe.title}`,tabIndex:-1,children:Pe.content}),jsxRuntimeExports.jsxs("div",{className:"px-6 py-4 border-t border-border",role:"group","aria-label":"Tutorial navigation",children:[jsxRuntimeExports.jsx("div",{className:"flex justify-center mb-4",role:"tablist","aria-label":"Tutorial pages",children:ae.map((Je,Ce)=>jsxRuntimeExports.jsx("div",{className:`w-2 h-2 rounded-full mx-1 transition-colors duration-200 page-indicator ${Ce===z?"page-indicator-active":"page-indicator-inactive"}`,role:"tab","aria-hidden":!0},Ce))}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center",role:"group","aria-label":"Navigation controls",children:[jsxRuntimeExports.jsxs("button",{onClick:be,disabled:pe,className:"btn-secondary flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Go to previous page",children:[jsxRuntimeExports.jsx(ChevronLeft,{className:"w-4 h-4"}),"Previous"]}),!G&&jsxRuntimeExports.jsx("button",{onClick:Ee,className:"btn-secondary","aria-label":"Skip tutorial and close",children:"Skip"}),jsxRuntimeExports.jsx("button",{onClick:ce?Ee:ve,className:"btn-primary flex items-center gap-2","aria-label":ce?"Finish tutorial":"Go to next page",children:ce?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Check,{className:"w-4 h-4"}),"Finish"]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:["Next",jsxRuntimeExports.jsx(ChevronRight,{className:"w-4 h-4"})]})})]})]})]})})]})},version="0.9.5",packageJson={version},AboutDialog=({isOpen:v,onClose:N})=>{const[G,z]=reactExports.useState(""),q=reactExports.useRef(null),Y=reactExports.useRef(null),[W,ie]=reactExports.useState(!1),[ne,se]=reactExports.useState(!1),ae=pe=>{Y.current&&clearTimeout(Y.current),z(pe),Y.current=setTimeout(()=>{z(""),Y.current=null},3e3)},ce=(pe,ge)=>{window.open(pe,"_blank","noopener,noreferrer"),ae(`Opening ${ge} in new tab`)};return jsxRuntimeExports.jsxs(yt,{open:v,onClose:N,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-2xl max-h-[90vh] bg-background border border-border rounded-lg shadow-lg flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"About AudioFunctions+"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Information about the project, developers, and licensing"})]}),G&&jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:G}),jsxRuntimeExports.jsxs("div",{ref:q,className:"flex-1 overflow-y-auto px-6 space-y-6",role:"main","aria-label":"About information",children:[jsxRuntimeExports.jsx("div",{className:"border rounded-lg p-4",style:{backgroundColor:"color-mix(in srgb, var(--color-primary), transparent 95%)",borderColor:"color-mix(in srgb, var(--color-primary), transparent 85%)"},children:jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntimeExports.jsxs("div",{className:"w-12 h-12 flex-shrink-0 mt-0.5",children:[jsxRuntimeExports.jsx("img",{src:"/logo.svg",alt:"SONAIRGRAPH Project Logo",className:"w-full h-full object-contain",onError:pe=>{pe.target.style.display="none",pe.target.nextElementSibling.style.display="block"}}),jsxRuntimeExports.jsx(Globe,{className:"w-12 h-12 hidden",style:{color:"var(--color-primary)"},"aria-hidden":"true"})]}),jsxRuntimeExports.jsxs("div",{className:"flex-1",children:[jsxRuntimeExports.jsx("h2",{className:"text-md font-semibold text-titles mb-2",children:"SONAIRGRAPH"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-descriptions mb-3",children:"Audiofunctions+ is part of the SONAIRGRAPH project, which is co-funded by the European Union."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-wrap gap-3",children:[jsxRuntimeExports.jsxs("button",{onClick:()=>ce("https://www.sonairgraph.unito.it/","project information site"),className:"inline-flex items-center gap-2 text-sm text-primary hover:opacity-80 underline transition-opacity","aria-label":"Visit project information website",children:[jsxRuntimeExports.jsx(ExternalLink,{className:"w-3 h-3","aria-hidden":"true"}),"Project Information"]}),jsxRuntimeExports.jsxs("button",{onClick:()=>ce("https://github.com/m2rash/audiofunctions-plus","GitHub repository"),className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-white bg-gray-900 hover:bg-gray-800 dark:bg-gray-800 dark:hover:bg-gray-700 rounded-md transition-colors","aria-label":"View source code on GitHub",children:[jsxRuntimeExports.jsx(Github,{className:"w-4 h-4","aria-hidden":"true"}),"View on GitHub"]})]})]})]})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"font-semibold text-titles mb-3",children:"Participating Universities in Development"}),jsxRuntimeExports.jsxs("div",{className:"space-y-2 text-descriptions text-sm",children:[jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2 ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Lead of Development and Testing:"})," Karlsruhe Institute of Technology (KIT)"]})}),jsxRuntimeExports.jsx("div",{className:"ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Partner:"})," University of Torino (UniTo)"]})}),jsxRuntimeExports.jsx("div",{className:"ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Partner:"})," University of Granada (UGR)"]})}),jsxRuntimeExports.jsx("div",{className:"ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Partner:"})," Masaryk University"]})})]}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("h3",{className:"font-semibold text-titles mb-3",children:"Developers"}),jsxRuntimeExports.jsxs("div",{className:"space-y-2 text-descriptions text-sm",children:[jsxRuntimeExports.jsx("div",{className:"ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Lukas Schölch"})," (KIT)"]})}),jsxRuntimeExports.jsx("div",{className:"ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Mattia Ducci"})," (UniTo)"]})}),jsxRuntimeExports.jsx("div",{className:"ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Pedro A García Sánchez"})," (UGR)"]})}),jsxRuntimeExports.jsx("div",{className:"ml-2",children:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("strong",{children:"Ondřej Nečas"})," (Masaryk University)"]})})]}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsxs("p",{children:[jsxRuntimeExports.jsx("span",{className:"font-semibold",children:"Copyright:"})," © 2025 AudioFunctions+ Development Team"]})]}),jsxRuntimeExports.jsxs("div",{className:"border-t border-border pt-4",children:[jsxRuntimeExports.jsxs("div",{onClick:()=>ie(!W),className:"flex items-center space-x-2 text-md font-semibold text-titles curs
732or-pointer select-none","aria-expanded":W,"aria-controls":"license-details",role:"button",tabIndex:0,onKeyDown:pe=>{(pe.key==="Enter"||pe.key===" ")&&(pe.preventDefault(),ie(!W))},children:[jsxRuntimeExports.jsx("svg",{className:`w-4 h-4 transition-transform ${W?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),jsxRuntimeExports.jsx("span",{children:"License"})]}),jsxRuntimeExports.jsx("div",{className:"mt-2 text-descriptions text-sm"}),W&&jsxRuntimeExports.jsx("div",{id:"license-details",className:"mt-4 animate-in slide-in-from-top-2 duration-300",children:jsxRuntimeExports.jsxs("div",{className:"space-y-2 text-descriptions text-sm",children:[jsxRuntimeExports.jsx("p",{children:jsxRuntimeExports.jsx("strong",{children:"AGPL-3.0 license"})}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3 mt-3",children:[jsxRuntimeExports.jsx("p",{className:"text-xs text-descriptions mb-2",children:jsxRuntimeExports.jsx("strong",{children:"Key provisions:"})}),jsxRuntimeExports.jsxs("ul",{className:"text-xs text-descriptions list-disc list-inside space-y-1 mb-3",children:[jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("strong",{children:"Freedom to use"})," — You can run the program for any purpose"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("strong",{children:"Freedom to study and modify"})," — You can study how the program works and change it"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("strong",{children:"Freedom to redistribute"})," — You can redistribute copies of the original program"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("strong",{children:"Freedom to distribute modifications"})," — You can distribute copies of your modified versions"]}),jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("strong",{children:"Network copyleft"})," — If you run a modified version on a server, you must provide source code to users"]})]}),jsxRuntimeExports.jsx("p",{className:"text-xs text-descriptions mb-2",children:jsxRuntimeExports.jsx("strong",{children:"Requirements when redistributing or modifying:"})}),jsxRuntimeExports.jsxs("ul",{className:"text-xs text-descriptions list-disc list-inside space-y-1 mb-3",children:[jsxRuntimeExports.jsx("li",{children:"Preserve copyright notices and license information"}),jsxRuntimeExports.jsx("li",{children:"Provide source code (including any modifications)"}),jsxRuntimeExports.jsx("li",{children:"Use the same AGPL v3 license for derivative works"}),jsxRuntimeExports.jsx("li",{children:"Provide source code to users of network services based on this software"})]}),jsxRuntimeExports.jsxs("div",{className:"mt-4 p-3 bg-background border border-border rounded",children:[jsxRuntimeExports.jsx("p",{className:"text-xs text-descriptions font-semibold mb-2",children:"License Compliance:"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-descriptions mb-2",children:"When using, modifying, or redistributing this software, you must:"}),jsxRuntimeExports.jsxs("ul",{className:"text-xs text-descriptions list-disc list-inside space-y-1 mb-3",children:[jsxRuntimeExports.jsx("li",{children:"Include the original copyright notice and license text"}),jsxRuntimeExports.jsx("li",{children:"Make source code available under AGPL v3"}),jsxRuntimeExports.jsx("li",{children:"Indicate any changes made to the original"}),jsxRuntimeExports.jsx("li",{children:"Provide source code to network service users"})]}),jsxRuntimeExports.jsx("div",{className:"bg-elem-background border border-border rounded p-2 font-mono text-xs text-descriptions",children:'"AudioFunctions+ - Copyright © 2025 AudioFunctions+ Development Team. Licensed under AGPL-3.0."'}),jsxRuntimeExports.jsxs("p",{className:"text-xs text-descriptions mt-2",children:[jsxRuntimeExports.jsx("strong",{children:"Important:"})," The AGPL v3 ensures that all derivative works and network services remain free and open source."]})]}),jsxRuntimeExports.jsx("div",{className:"mt-3 pt-2 border-t border-border",children:jsxRuntimeExports.jsxs("button",{onClick:()=>ce("https://www.gnu.org/licenses/agpl-3.0.html","AGPL-3.0 license details"),className:"inline-flex items-center gap-1 text-xs text-primary hover:opacity-80 underline transition-opacity","aria-label":"View full license terms",children:[jsxRuntimeExports.jsx(ExternalLink,{className:"w-3 h-3","aria-hidden":"true"}),"View Full License"]})})]})]})})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{onClick:()=>se(!ne),className:"flex items-center space-x-2 text-md font-semibold text-titles curs
732or-pointer select-none","aria-expanded":ne,"aria-controls":"library-details",role:"button",tabIndex:0,onKeyDown:pe=>{(pe.key==="Enter"||pe.key===" ")&&(pe.preventDefault(),se(!ne))},children:[jsxRuntimeExports.jsx("svg",{className:`w-4 h-4 transition-transform ${ne?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),jsxRuntimeExports.jsx("span",{children:"Third-party Libraries"})]}),jsxRuntimeExports.jsx("div",{className:"mt-2 text-sm text-descriptions",children:" "}),ne&&jsxRuntimeExports.jsx("div",{id:"library-details",className:"mt-4 animate-in slide-in-from-top-2 duration-300",children:jsxRuntimeExports.jsx("div",{className:"space-y-3",children:jsxRuntimeExports.jsxs("div",{className:"text-sm text-descriptions",children:[jsxRuntimeExports.jsx("p",{className:"mb-2",children:"AudioFunctions+ is built with the following open-source libraries:"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"React"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"User Interface Framework"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://reactjs.org","React website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"reactjs.org"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"Tone.js"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Web Audio Synthesis"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://tonejs.github.io","Tone.js website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"tonejs.github.io"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"JSXGraph"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Interactive Geometry & Graphing"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://jsxgraph.uni-bayreuth.de","JSXGraph website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"jsxgraph.uni-bayreuth.de"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"Math.js"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Mathematical Expression Parser"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://mathjs.org","Math.js website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"mathjs.org"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"kbar"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Command Palette"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://kbar.vercel.app","kbar website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"kbar.vercel.app"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"Headless UI"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Accessible UI Components"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://headlessui.com","Headless UI website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"headlessui.com"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"Lucide React"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Icon Library"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://lucide.dev","Lucide website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"lucide.dev"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"Tailwind CSS"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Utility-First CSS Framework"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://tailwindcss.com","Tailwind CSS website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"tailwindcss.com"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-elem-background border border-border rounded p-3",children:[jsxRuntimeExports.jsx("strong",{className:"text-titles",children:"Vite"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-descriptions",children:"Build Tool & Dev Server"}),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("button",{onClick:()=>ce("https://vitejs.dev","Vite website"),className:"text-xs text-primary hover:opacity-80 underline transition-opacity",children:"vitejs.dev"})]})]})]})})})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"font-semibold text-titles mb-3",children:"Version Information"}),jsxRuntimeExports.jsxs("div",{className:"text-sm pb-4 text-descriptions space-y-1",children:[jsxRuntimeExports.jsxs("p",{children:[jsxRuntimeExports.jsx("strong",{children:"Version:"})," ",packageJson.version]}),jsxRuntimeExports.jsxs("p",{children:[jsxRuntimeExports.jsx("strong",{children:"Build Date:"})," ",new Date().toLocaleDateString()]})]})]})]}),jsxRuntimeExports.jsx("div",{className:"px-6 py-4 border-t border-border",children:jsxRuntimeExports.jsx("div",{className:"flex justify-end",children:jsxRuntimeExports.jsx("button",{onClick:N,className:"btn-primary","aria-label":"Close about dialog",children:"Close"})})})]})})]})};class LandmarkEarconManager{constructor(){this.synths=new Map,this.channels=new Map,this.isInitialized=!1}async initialize(){if(!this.isInitialized)try{await start(),this.isInitialized=!0}catch(N){console.error("Failed to initialize LandmarkEarconManager:",N)}}playEarcon(N,G={}){if(!this.isInitialized){console.warn("LandmarkEarconManager not initialized");return}let z=null;switch(N){case"square":z="landmark_square";break;case"triangle":z="landmark_triangle";break;case"diamond":z="landmark_diamond";break;case"triangle":default:z="landmark_triangle";break}try{audioSampleManager.playSample(z,{volume:G.volume!==void 0?G.volume:-12})}catch(q){console.error(`Error playing landmark sample for shape ${N}:`,q)}}playLandmarkEarcon(N,G={}){if(!N)return;const z=N.shape||N.appearance||"triangle";this.playEarcon(z,G)}stopAllEarcons(){try{audioSampleManager&&audioSampleManager.stopAllSamples&&audioSampleManager.stopAllSamples()}catch(N){console.error("Error stopping landmark samples:",N)}}setVolume(N){}testAllEarcons(){if(!this.isInitialized){console.warn("LandmarkEarconManager not initialized");return}setTimeout(()=>this.playEarcon("diamond"),0),setTimeout(()=>this.playEarcon("triangle"),1e3),setTimeout(()=>this.playEarcon("square"),2e3)}dispose(){this.synths.clear(),this.channels.clear(),this.isInitialized=!1}}const landmarkEarconManager=new LandmarkEarconManager,config={},math=create(all,config),EditLandmarkDialog=({isOpen:v,onClose:N,landmarkData:G=null})=>{const{functionDefinitions:z,setFunctionDefinitions:q}=useGraphContext(),{announce:Y}=useAnnouncement(),[W,ie]=reactExports.useState(""),[ne,se]=reactExports.useState({}),ae=reactExports.useRef(null),ce=reactExports.useRef(null),pe=reactExports.useRef(!1),ge=reactExports.useRef(!1),[ve,be]=reactExports.useState({label:"",x:0,y:0,appearance:"triangle"}),Ee=Object.keys(ne).some(st=>ne[st]&&ne[st].length>0),Pe=st=>{if(!G||!z)return 0;const{functionIndex:pt}=G,lt=z[pt];if(!lt)return 0;try{if(lt.type==="function"){const vt=lt.functionDef.replace(/\*\*/g,"^"),dt=transformMathConstants(math.parse(vt));return math.compile(dt.toString()).evaluate({x:st})}else if(lt.type==="piecewise_function"){const vt=lt.functionDef;
732for(const[dt,xt]of vt)try{const ft=xt.replace(/\*\*/g,"^"),Et=transformMathConstants(math.parse(ft));if(math.compile(Et.toString()).evaluate({x:st})){const Gt=dt.replace(/\*\*/g,"^"),Ot=transformMathConstants(math.parse(Gt));return math.compile(Ot.toString()).evaluate({x:st})}}catch(ft){console.warn("Error evaluating piecewise condition:",ft);continue}throw new Error("No matching condition in piecewise function")}else throw new Error("Unknown function type")}catch(vt){return console.warn("Could not evaluate function at x =",st,vt),0}};reactExports.useEffect(()=>{v&&(async()=>{try{await landmarkEarconManager.initialize()}catch(pt){console.warn("Failed to initialize landmark earcon manager:",pt)}})()},[v]),reactExports.useEffect(()=>{if(v&&G){const{functionIndex:st,landmarkIndex:pt,landmark:lt}=G;ae.current={functionIndex:st,landmarkIndex:pt,landmark:{...lt}},ce.current=JSON.parse(JSON.stringify(z)),be({label:lt.label||"",x:lt.x,y:lt.y,appearance:lt.shape||"triangle"}),se({}),Je(`Edit landmark dialog opened. Current position: x=${lt.x.toFixed(2)}, y=${lt.y.toFixed(2)}.`)}},[v,G,z]);const Je=st=>{ie(st),setTimeout(()=>ie(""),3e3)},Ce=st=>{const pt=[];if(st===""||st==="-")return pt;const lt=parseFloat(st);if(isNaN(lt))return pt.push("X coordinate must be a valid number"),pt;const vt=validateLandmarkCoordinates(lt,0);return vt.valid||pt.push(vt.message),pt},Ve=st=>{const pt=[];return st&&st.length>100&&pt.push("Label cannot be longer than 100 characters"),pt},Re=st=>{be(lt=>{let vt=st,dt=lt.y;return st!==""&&st!=="-"&&!isNaN(parseFloat(st))&&(vt=parseFloat(st),dt=Pe(vt)),{...lt,x:vt,y:dt}});const pt=Ce(st);se(lt=>({...lt,x:pt.length>0?pt:void 0}))},qe=st=>{let pt=st;(st===""||st==="-"||isNaN(parseFloat(st)))&&(pt="0");const lt=parseFloat(pt),vt=Pe(lt);be(xt=>({...xt,x:lt,y:vt}));const dt=Ce(pt);se(xt=>({...xt,x:dt.length>0?dt:void 0}))},et=st=>{be(lt=>({...lt,label:st}));const pt=Ve(st);se(lt=>({...lt,label:pt.length>0?pt:void 0}))},Ze=st=>{be(pt=>({...pt,appearance:st})),pe.current=!0;try{landmarkEarconManager.playEarcon(st)}catch(pt){console.warn("Failed to play landmark earcon preview:",pt)}},tt=()=>{try{landmarkEarconManager.playEarcon(ve.appearance)}catch(st){console.warn("Failed to play landmark earcon preview on focus:",st)}},Ke=()=>{ge.current=!0},rt=st=>{(st.key===" "||st.key==="Enter"||st.key==="ArrowDown"||st.key==="ArrowUp")&&(ge.current=!0)},it=()=>{if(ge.current&&!pe.current)try{landmarkEarconManager.playEarcon(ve.appearance)}catch(st){console.warn("Failed to play landmark earcon preview on blur:",st)}pe.current=!1,ge.current=!1},ot=()=>{if(Ee||!G)return;const{functionIndex:st,landmarkIndex:pt}=G,lt={label:ve.label,x:ve.x,y:ve.y,shape:ve.appearance,earcon:`landmark_${ve.appearance}`},vt=updateLandmarkWithValidation(z,st,pt,lt);if(!vt.success){Je(`Error: ${vt.message}`),se({general:[vt.message]});return}q(vt.definitions),Je("Landmark updated successfully."),ae.current=null,ce.current=null,N()},ut=()=>{if(!G)return;const{functionIndex:st,landmarkIndex:pt,landmark:lt}=G,vt=lt.label||`Landmark at x=${lt.x.toFixed(2)}`;if(!window.confirm(`Are you sure you want to delete "${vt}"? This action cannot be undone.`)){Je("Delete cancelled.");return}const xt=removeLandmarkWithValidation(z,st,pt);if(!xt.success){Je(`Error: ${xt.message}`),se({general:[xt.message]});return}q(xt.definitions),Je(`Landmark "${vt}" deleted successfully.`),ae.current=null,ce.current=null,N()},ct=()=>{ce.current!==null?(q(ce.current),Je("Changes cancelled and reverted.")):Je("Changes cancelled."),ae.current=null,ce.current=null,se({}),N()},at=()=>{if(Ee){Je("Cannot close: Please fix all errors or cancel to discard changes.");return}ct()};return reactExports.useEffect(()=>{const st=pt=>{if(pt.key==="Escape")pt.preventDefault(),pt.stopPropagation(),ct();else if(pt.key==="Delete")pt.preventDefault(),pt.stopPropagation(),ut();else if(pt.key==="Enter"&&!Ee){const lt=document.activeElement;if(lt&&lt.textContent==="Delete"){pt.preventDefault(),pt.stopPropagation(),ut();return}if(lt&&lt.textContent==="Cancel"){pt.preventDefault(),pt.stopPropagation(),ct();return}if(lt&&lt.textContent==="Accept"){pt.preventDefault(),pt.stopPropagation(),ot();return}pt.preventDefault(),pt.stopPropagation(),ot()}};if(v)return document.addEventListener("keydown",st),()=>document.removeEventListener("keydown",st)},[v,Ee,ve,G]),G?jsxRuntimeExports.jsxs(yt,{open:v,onClose:at,className:"relative","aria-modal":"true",role:"dialog","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-overlay","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:jsxRuntimeExports.jsxs(je,{className:"w-full max-w-lg bg-background rounded-lg shadow-lg flex flex-col max-h-[90vh]",children:[jsxRuntimeExports.jsxs("div",{className:"p-6 pb-4 flex-shrink-0",children:[jsxRuntimeExports.jsx(Ye,{id:"dialog-title",className:"text-lg font-bold text-titles",children:"Edit Landmark"}),jsxRuntimeExports.jsx(H$2,{id:"dialog-description",className:"text-descriptions",children:"Edit landmark properties. The Y coordinate is automatically calculated based on the X coordinate and function."})]}),jsxRuntimeExports.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",role:"status",children:W}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-y-auto px-6 space-y-4 min-h-0",role:"main","aria-label":"Landmark properties",children:[ne.general&&jsxRuntimeExports.jsxs("div",{className:"error-message",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),ne.general[0]]}),jsxRuntimeExports.jsxs("div",{className:"pt-2",children:[jsxRuntimeExports.jsxs("div",{className:`text-input-outer ${ne.label?"error-border error-input"
732:""}`,"aria-errormessage":ne.label?"label-error":void 0,children:[jsxRuntimeExports.jsx("div",{className:"text-input-label",children:"Label:"}),jsxRuntimeExports.jsx("input",{id:"landmark-label",type:"text",value:ve.label,onChange:st=>et(st.target.value),className:"text-input-inner grow",placeholder:"Optional landmark label","aria-label":"Landmark label","aria-invalid":ne.label?"true":"false","aria-errormessage":ne.label?"label-error":void 0,"aria-description":"Optional label for the landmark"})]}),ne.label&&jsxRuntimeExports.jsxs("div",{id:"label-error",className:"error-message mt-1",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),ne.label[0]]})]}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:`text-input-outer ${ne.x?"error-border error-input":""}`,"aria-errormessage":ne.x?"x-coordinate-error":void 0,children:[jsxRuntimeExports.jsx("div",{className:"text-input-label",children:"X:"}),jsxRuntimeExports.jsx("input",{id:"landmark-x",type:"number",step:"any",value:ve.x,onChange:st=>Re(st.target.value),onBlur:st=>qe(st.target.value),className:"text-input-inner","aria-label":"X coordinate","aria-invalid":ne.x?"true":"false","aria-errormessage":ne.x?"x-coordinate-error":void 0,"aria-description":"X coordinate on the function"})]}),ne.x&&jsxRuntimeExports.jsxs("div",{id:"x-coordinate-error",className:"error-message mt-1",role:"alert","aria-live":"assertive","aria-atomic":"true",children:[jsxRuntimeExports.jsx("span",{className:"error-icon","aria-hidden":"true",children:"⚠️"}),ne.x[0]]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"text-input-outer opacity-60",children:[jsxRuntimeExports.jsx("div",{className:"text-input-label",children:"Y:"}),jsxRuntimeExports.jsx("input",{id:"landmark-y",type:"text",value:typeof ve.y=="number"?ve.y.toFixed(6):ve.y,className:"grow text-input-inner","aria-label":"Y coordinate (automatically calculated)",readOnly:!0,tabIndex:-1,"aria-description":"Y coordinate, automatically calculated from X coordinate and function value"})]}),jsxRuntimeExports.jsx("div",{className:"text-xs text-descriptions mt-1",children:"Auto-calculated"})]})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-sm font-semibold text-titles mb-1",children:"Appearance"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-descriptions",children:"Choose how the landmark appears on the graph. Try different appearances to have a preview of how they sound."})]}),jsxRuntimeExports.jsx("div",{className:"text-input-outer pr-1.5 min-w-32",children:jsxRuntimeExports.jsxs("select",{id:"landmark-appearance",value:ve.appearance,onChange:st=>Ze(st.target.value),onFocus:tt,onMouseDown:Ke,onKeyDown:rt,onBlur:it,className:"grow text-input-inner","aria-label":"Landmark appearance","aria-description":"Visual and auditive appearance of the landmark",children:[jsxRuntimeExports.jsx("option",{value:"triangle",className:"bg-background text-txt",children:"Triangle"}),jsxRuntimeExports.jsx("option",{value:"square",className:"bg-background text-txt",children:"Square"}),jsxRuntimeExports.jsx("option",{value:"diamond",className:"bg-background text-txt",children:"Diamond"})]})})]})})]}),jsxRuntimeExports.jsx("div",{className:"px-6 py-4 flex-shrink-0",role:"group","aria-label":"Dialog actions",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center",role:"group","aria-label":"Dialog controls",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("button",{onClick:ut,className:"btn-danger",title:"Delete this landmark permanently","aria-description":"Delete this landmark. This action cannot be undone.",children:"Delete"})}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("button",{onClick:ct,className:"btn-secondary",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:ot,className:"btn-primary",disabled:Ee,"aria-disabled":Ee,title:Ee?"Please fix all errors before saving":"Save changes and close",children:"Accept"})]})]})})]})})]}):null},DialogContext=reactExports.createContext(),useDialog=()=>reactExports.useContext(DialogContext);function DialogProvider({children:v}){var ie,ne;const[N,G]=reactExports.useState({type:null,props:{}}),z=(se,ae={})=>G({type:se,props:ae}),q=()=>G({type:null,props:{}}),Y=N.type==="edit-function",W=N.type==="edit-landmark";return jsxRuntimeExports.jsxs(DialogContext.Provider,{value:{openDialog:z,closeDialog:q,isEditFunctionDialogOpen:Y,isEditLandmarkDialogOpen:W},children:[v,jsxRuntimeExports.jsx(EditFunctionDialog,{isOpen:N.type==="edit-function",onClose:q,...N.props}),jsxRuntimeExports.jsx(ChangeGraphBoundDialog,{isOpen:N.type==="change-graph-bou
732nd",onClose:q,...N.props}),jsxRuntimeExports.jsx(ShowHideFunctionsDialog,{isOpen:N.type==="showHide-functions",onClose:q,...N.props}),jsxRuntimeExports.jsx(MovementAdjustmentsDialog,{isOpen:N.type==="movement-adjustments",onClose:q,...N.props}),jsxRuntimeExports.jsx(SpeedAdjustmentDialog,{isOpen:N.type==="speed-adjustment",onClose:q,...N.props}),jsxRuntimeExports.jsx(ShareDialog,{isOpen:N.type==="share",onClose:q,...N.props}),jsxRuntimeExports.jsx(ImportJsonDialog,{isOpen:N.type==="import-json",onClose:q,...N.props}),jsxRuntimeExports.jsx(ExportJsonDialog,{isOpen:N.type==="export-json",onClose:q,...N.props}),jsxRuntimeExports.jsx(WelcomeDialog,{isOpen:N.type==="welcome",onClose:q,isAutoOpened:((ie=N.props)==null?void 0:ie.isAutoOpened)||!1,...N.props}),jsxRuntimeExports.jsx(AboutDialog,{isOpen:N.type==="about",onClose:q,...N.props}),jsxRuntimeExports.jsx(EditLandmarkDialog,{isOpen:N.type==="edit-landmark",onClose:q,landmarkData:((ne=N.props)==null?void 0:ne.landmarkData)||null})]})}const GraphSonification=()=>{const{cursorCoords:v,isAudioEnabled:N,graphBounds:G,functionDefinitions:z,stepSize:q,PlayFunction:Y,explorationMode:W,isShiftPressed:ie,discreteBatchValidStartX:ne}=useGraphContext(),se=reactExports.useRef(new Map),ae=reactExports.useRef(new Map),ce=reactExports.useRef(new Map),pe=reactExports.useRef(new Map),ge=reactExports.useRef(new Map),ve=reactExports.useRef(new Map),be=reactExports.useRef(null),Ee=reactExports.useRef(null),Pe=reactExports.useRef(null),Je=reactExports.useRef(!1),Ce=reactExports.useRef(null),Ve=reactExports.useRef(0),Re=reactExports.useRef({left:!1,right:!1,bottom:!1,top:!1}),qe=reactExports.useRef(null),{getInstrumentByName:et}=useInstruments(),{isEditFunctionDialogOpen:Ze,isEditLandmarkDialogOpen:tt}=useDialog(),Ke=reactExports.useRef(new Map),rt=reactExports.useRef(new Map),it=reactExports.useRef(new Map),ot=reactExports.useRef(null),[ut,ct]=reactExports.useState(!1),at=reactExports.useRef(0),st=reactExports.useRef(!1),pt=reactExports.useRef(new Set),lt=reactExports.useRef(!1),vt=reactExports.useRef(!1);reactExports.useEffect(()=>(Ee.current||(Ee.current=new MembraneSynth({pitchDecay:.001,octaves:1,envelope:{attack:0,decay:.05,sustain:0,release:0},volume:-18}),Pe.current=new Channel({pan:0,volume:0}),Ce.current?Pe.current.connect(Ce.current):Pe.current.toDestination(),Ee.current.connect(Pe.current)),()=>{Ee.current&&(Ee.current.dispose(),Ee.current=null),Pe.current&&(Pe.current.disconnect(),Pe.current.dispose(),Pe.current=null)}),[]),reactExports.useEffect(()=>(ot.current||(ot.current=new Noise("pink").toDestination(),ot.current.volume.value=-36),()=>{ot.current&&(ot.current.dispose(),ot.current=null)}),[]),reactExports.useEffect(()=>(Ce.current||(Ce.current=new Gain(1).toDestination(),rt.current.forEach(bt=>{bt.disconnect(),bt.connect(Ce.current)}),Pe.current&&(Pe.current.disconnect(),Pe.current.connect(Ce.current))),()=>{Ce.current&&(Ce.current.dispose(),Ce.current=null)}),[]),reactExports.useEffect(()=>((async()=>{try{await new Promise(_t=>setTimeout(_t,500)),await audioSampleManager.initialize(),await landmarkEarconManager.initialize()}catch(_t){console.error("Failed to initialize audio systems:",_t)}})(),()=>{audioSampleManager.dispose(),landmarkEarconManager.dispose()}),[]),reactExports.useEffect(()=>(ut&&(rt.current.forEach(bt=>{bt.dispose()}),rt.current.clear()),z.forEach((bt,_t)=>{const Xt=bt.id;if(rt.current.has(Xt)){const At=rt.current.get(Xt);At&&(At.mute=!isFunctionActiveN(z,_t))}else{const At=new Channel({pan:0,mute:!isFunctionActiveN(z,_t),volume:0});Ce.current?At.connect(Ce.current):At.toDestination(),rt.current.set(Xt,At)}}),Array.from(rt.current.keys()).forEach(bt=>{if(!getFunctionById(z,bt)){const _t=rt.current.get(bt);_t&&(_t.disconnect(),_t.dispose()),rt.current.delete(bt)}}),()=>{rt.current.forEach(bt=>{bt.disconnect(),bt.dispose()}),rt.current.clear()}),[z,ut]),reactExports.useEffect(()=>{ut&&(Ke.current.forEach(_t=>{_t.dispose&&_t.dispose()}),Ke.current.clear(),it.current.clear(),at.current=0,st.current=!1,ct(!1));const bt=getActiveFunctions(z);
732return Array.from(Ke.current.keys()).forEach(_t=>{getFunctionById(z,_t)||(Ke.current.get(_t)&&Ke.current.get(_t).dispose(),Ke.current.delete(_t))}),bt.forEach(_t=>{if(!Ke.current.has(_t.id)){const Xt=getFunctionIndexById(z,_t.id),At=et(getFunctionInstrumentN(z,Xt));if(At&&At.createInstrument){const $t=At.createInstrument();Ke.current.set(_t.id,$t);const Pt=rt.current.get(_t.id);Pt&&($t.connect(Pt),getFunctionInstrumentN(z,Xt)==="organ"&&$t.start())}}}),start(),()=>{Ke.current.forEach(_t=>{_t.dispose&&_t.dispose()}),Ke.current.clear()}},[z,et,ut]),reactExports.useEffect(()=>{let bt=null;return!Ze&&!tt&&N&&(Gt(),It(),bt=setTimeout(()=>{ct(!0)},50)),()=>{bt&&clearTimeout(bt)}},[Ze,tt,N]),reactExports.useEffect(()=>{if(!N||Ze)return;const bt=new Set(z.filter(Xt=>Xt.isActive).map(Xt=>Xt.id));Array.from(bt).filter(Xt=>!pt.current.has(Xt)).forEach(Xt=>{it.current.delete(Xt)}),pt.current=new Set(bt)},[z,N,Ze]),reactExports.useEffect(()=>{const bt=new Set(z.map(_t=>_t.id));Array.from(se.current.keys()).forEach(_t=>{bt.has(_t)||se.current.delete(_t)}),Array.from(ae.current.keys()).forEach(_t=>{bt.has(_t)||ae.current.delete(_t)}),Array.from(ce.current.keys()).forEach(_t=>{const Xt=_t.split("_")[0];bt.has(Xt)||ce.current.delete(_t)}),Array.from(ge.current.keys()).forEach(_t=>{bt.has(_t)||ge.current.delete(_t)}),Array.from(pe.current.keys()).forEach(_t=>{bt.has(_t)||pe.current.delete(_t)}),Array.from(pt.current).forEach(_t=>{bt.has(_t)||pt.current.delete(_t)})},[z]);const dt=bt=>{if(bt==null)return null;const _t=(bt-G.yMin)/(G.yMax-G.yMin);return GLOBAL_FREQUENCY_RANGE.min+_t*(GLOBAL_FREQUENCY_RANGE.max-GLOBAL_FREQUENCY_RANGE.min)},xt=bt=>{if(bt==null)return 0;const _t=-1+2*(bt-G.xMin)/(G.xMax-G.xMin);return _t>1?1:_t<-1?-1:_t},ft=(bt,_t,Xt)=>{if(_t==null)return 0;const At=Math.abs(bt-_t),$t=Xt.yMax-Xt.yMin;return(1-Math.min(At/$t,1)-1)*30},Et=(bt,_t,Xt,At,$t)=>{try{if(!At.availablePitchClasses||At.availablePitchClasses.length===0)return;const Pt=(_t-G.yMin)/(G.yMax-G.yMin),kt=Math.floor(Pt*At.availablePitchClasses.length),jt=Math.max(0,Math.min(kt,At.availablePitchClasses.length-1)),wt=At.availablePitchClasses[jt],Mt=it.current.get(bt);if(wt!==Mt){const Tt=Frequency(wt).toFrequency();Dt(bt),Ct(bt,Tt,Xt,$t,_t),it.current.set(bt,wt)}}catch(Pt){console.warn(`Error in discrete sonification for function ${bt}:`,Pt),Dt(bt)}},Ct=(bt,_t,Xt,At=null,$t=null)=>{const Pt=Ke.current.get(bt),kt=rt.current.get(bt);if(Pt&&kt)try{const jt=now(),wt=parseInt(bt.slice(-1),10)*.01,Mt=Math.max(jt+wt,jt+.001);if(Pt.triggerAttack(_t,Mt),kt.pan.value=Xt,At!=null){const Tt=$t!==null?$t:(_t-GLOBAL_FREQUENCY_RANGE.min)/(GLOBAL_FREQUENCY_RANGE.max-GLOBAL_FREQUENCY_RANGE.min)*(G.yMax-G.yMin)+G.yMin,Rt=ft(Tt,parseFloat(At),G);kt.volume.value=Rt}else kt.volume.value=0}catch(jt){console.warn(`Error starting tone for function ${bt}:`,jt);try{if(Pt.triggerAttack(_t),kt.pan.value=Xt,At!=null){const wt=$t!==null?$t:(_t-GLOBAL_FREQUENCY_RANGE.min)/(GLOBAL_FREQUENCY_RANGE.max-GLOBAL_FREQUENCY_RANGE.min)*(G.yMax-G.yMin)+G.yMin,Mt=ft(wt,parseFloat(At),G);kt.volume.value=Mt}else kt.volume.value=0}catch(wt){console.error(`Fallback error starting tone for function ${bt}:`,wt)}}},Dt=bt=>{const _t=Ke.current.get(bt);_t&&_t.triggerRelease()},Gt=()=>{Ke.current.forEach((bt,_t)=>{Dt(_t)})},Ot=()=>{ot.current&&ot.current.state==="stopped"&&ot.current.start()},It=()=>{ot.current&&ot.current.state==="started"&&ot.current.stop()};reactExports.useEffect(()=>{if(!N||Ze||tt||!v){Gt(),It();return}if(W==="batch"&&Y.active&&Y.source==="play"?st.current||(it.current.clear(),ae.current.clear(),pe.current.clear(),at.current=0,st.current=!0,lt.current=!1,vt.current=!1):(st.current=!1,at.current=0,lt.current=!1,vt.current=!1),Ce.current)if(ne!==null&&v&&v.length>0&&W==="batch"&&Y.active&&Y.source==="play"){const Pt=parseFloat(v[0].x);if(typeof Pt=="number"&&!isNaN(Pt)&&isFinite(Pt)){const kt=Y.speed>=0?1:-1;let jt=1;kt>0?jt=Pt>=ne?1:0:jt=Pt<=ne?1:0,Ce.current.gain.value=jt}else Ce.current.gain.value=1}else Ce.current.gain.value=1;const bt=v.some(Pt=>{const kt=parseFloat(Pt.y);return!isNaN(kt)&&isFinite(kt)&&kt<0});let _t=!1,Xt=!1;for(const Pt of v){const kt=parseFloat(Pt.x),jt=parseFloat(Pt.y),wt=G.xMax-G.xMin,Mt=G.yMax-G.yMin,Tt=Math.max(.02,Math.min(wt,Mt)*.001),Rt=Math.abs(kt-(G.xMin+Tt))<Tt*.1,Ft=Math.abs(kt-(G.xMax-Tt))<Tt*.1,Ut=Math.abs(jt-(G.yMin+Tt))<Tt*.1,Zt=Math.abs(jt-(G.yMax-Tt))<Tt*.1;if(Rt&&(Xt=!0),Rt||Ft||Ut||Zt){_t=!0;break}}W==="batch"&&Y.active&&Y.source==="play"&&v&&v.length>0&&(vt.current&&!Xt&&!lt.current&&Y.speed>0&&(tr("chart_border_start",{volume:-15}),lt.current=!0),vt.current=Xt),zt(v),bt&&!_t?Ot():It();const At=v.some(Pt=>{const kt=parseFloat(Pt.y);return!isNaN(kt)&&isFinite(kt)&&kt>=G.yMin&&kt<=G.yMax}),$t=v.some(Pt=>{const kt=parseFloat(Pt.y);return isNaN(kt)||kt===void 0||kt===null||!isFinite(kt)||kt<G.yMin||kt>G.yMax});if(!At&&v.length>0){const Pt=ce.current.get("no_visible_functions"),kt=Date.now();(!Pt||kt-Pt>200)&&(Gt(),tr("no_y",{volume:-25}),ce.current.set("no_visible_functions",kt))}else if(At)if(ce.current.delete("no_visible_functions"),$t){const Pt=ce.current.get("some_out_of_bounds"),kt=Date.now();(!Pt||kt-Pt>200)&&(tr("no_y",{volume:-25}),ce.current.set("some_out_of_bounds",kt))}else ce.current.delete("some_out_of_bounds");if(W==="mouse"&&v.length>0){const Pt=parseFloat(v[0].x);let kt=0;isNaN(Pt)||(qe.current!==null&&!isNaN(qe.current)&&(kt=Pt-qe.current),qe.current=Pt);const jt=G.xMax-G.xMin,wt=G.yMax-G.yMin,Mt=jt*.01,Tt=wt*.01;let Rt=!1,Ft=!1,Ut=!1,Zt=!1;v.forEach(sr=>{const nr=parseFloat(sr.x),gt=parseFloat(sr.y);isNaN(nr)||isNaN(gt)||(nr<=G.xMin+Mt&&(Rt=!0),nr>=G.xMax-Mt&&(Ft=!0),gt<=G.yMin+Tt&&(Ut=!0),gt>=G.yMax-Tt&&(Zt=!0))});const Wt=Re.current,qt=Date.now(),Yt=Ve.current,or=Yt&&qt-Yt<=200;let hr=!1;or||(Rt&&!Wt.left&&kt<0||Ft&&!Wt.right&&kt>0||Ut&&!Wt.bottom||Zt&&!Wt.top)&&(hr=!0),hr&&(tr("chart_border",{volume:-20}),Ve.current=qt),Re.current={left:Rt,right:Ft,bottom:Ut,top:Zt}}else qe.current=null,Re.current={left:!1,right:!1,bottom:!1,top:!1};v.forEach(async Pt=>{var qt;const kt=Pt.functionId,jt=parseFloat(Pt.x),wt=parseFloat(Pt.y),Mt=Pt.mouseY?parseFloat(Pt.mouseY):null,Tt=xt(jt);
732if(q&&q>0&&typeof jt=="number"&&!isNaN(jt)&&N&&ie&&(W==="keyboard_smooth"||W==="mouse"||W==="batch")){let Yt=Math.floor(jt/q);Yt!==be.current&&(Pe.current&&(Pe.current.pan.value=Tt),(qt=Ee.current)==null||qt.triggerAttackRelease("C6","16n"),be.current=Yt,W==="batch"&&at.current++)}const Rt=W==="batch"&&at.current<=5;if(await Ht(kt,Pt),Rt?Je.current=!1:(await Bt(kt,Pt),await ir(kt,Pt)),Je.current){Dt(kt);return}const Ft=getFunctionIndexById(z,kt),Ut=et(getFunctionInstrumentN(z,Ft));if(!Ut)return;if(typeof wt=="number"&&!isNaN(wt)&&isFinite(wt)&&wt>=G.yMin&&wt<=G.yMax)if(Ut.instrumentType===InstrumentFrequencyType.discretePitchClassBased)Et(kt,wt,Tt,Ut,Mt);else{const Yt=dt(wt);Yt!==null?Ct(kt,Yt,Tt,Mt,wt):Dt(kt)}else Dt(kt)})},[v,N,Ze,tt,z,G,q,W]);const Bt=async(bt,_t)=>{const Xt=parseFloat(_t.x),At=parseFloat(_t.y),$t=Date.now(),Pt=Ve.current,kt=Pt&&$t-Pt<=200,jt=G.xMax-G.xMin,wt=G.yMax-G.yMin,Mt=Math.max(.02,Math.min(jt,wt)*.001);let Tt=!1,Rt=!1,Ft=!1,Ut=!1;if(W==="mouse"){const qt=jt*.01,Yt=wt*.01;Tt=Xt<=G.xMin+qt,Rt=Xt>=G.xMax-qt,Ft=At<=G.yMin+Yt,Ut=At>=G.yMax-Yt}else Tt=Math.abs(Xt-(G.xMin+Mt))<Mt*.1,Rt=Math.abs(Xt-(G.xMax-Mt))<Mt*.1,Ft=Math.abs(At-(G.yMin+Mt))<Mt*.1,Ut=Math.abs(At-(G.yMax-Mt))<Mt*.1;const Zt=ge.current.get(bt)||{left:!1,right:!1,bottom:!1,top:!1};let Wt=null;if(Tt?(Wt=`${bt}_left`,Zt.left):Rt?(Wt=`${bt}_right`,Zt.right):Ft?(Wt=`${bt}_bottom`,Zt.bottom):Ut&&(Wt=`${bt}_top`,Zt.top),Wt){if(Je.current=!0,W!=="mouse"){const qt=ce.current.get(Wt);(!qt||$t-qt>200)&&!kt&&(await tr("chart_border",{volume:-20}),ce.current.set(Wt,$t),Ve.current=$t)}}else Je.current=!1;ge.current.set(bt,{left:Tt,right:Rt,bottom:Ft,top:Ut})},Ht=async(bt,_t)=>{const Xt=parseFloat(_t.x),At=ae.current.get(bt),$t=Math.sign(Xt);let Pt=!1;if(($t===0||At!=null&&At!==$t&&At!==0||W==="batch"&&At===null&&Math.abs(Xt)<.1)&&(Pt=!0),Pt){const kt=pe.current.get(bt),jt=Date.now();(!kt||jt-kt>300)&&(await tr("y_axis_intersection",{volume:-12}),pe.current.set(bt,jt))}ae.current.set(bt,$t)},ir=async(bt,_t)=>{let Xt;typeof _t.y=="string"&&(_t.y==="NaN"||_t.y==="undefined"||_t.y==="null"||_t.y==="Infinity"||_t.y==="-Infinity")?Xt=NaN:Xt=parseFloat(_t.y);const At=isNaN(Xt)||Xt===void 0||Xt===null||!isFinite(Xt),$t=typeof Xt=="number"&&(Xt<G.yMin||Xt>G.yMax);if(At||$t){const Pt=ce.current.get(`${bt}_discontinuity`),kt=Date.now();(!Pt||kt-Pt>200)&&(Dt(bt),await tr("no_y",{volume:-35}),ce.current.set(`${bt}_discontinuity`,kt))}else ce.current.delete(`${bt}_discontinuity`)},zt=bt=>{if(tt||!bt||bt.length===0)return;getActiveFunctions(z).forEach(Xt=>{const At=Xt.id,$t=z.findIndex(Tt=>Tt.id===At);if($t===-1)return;const Pt=getLandmarksN(z,$t);if(!Pt||Pt.length===0)return;const kt=bt.find(Tt=>Tt.functionId===At);if(!kt)return;const jt=parseFloat(kt.x),wt=parseFloat(kt.y),Mt=ve.current.get(At);Pt.forEach((Tt,Rt)=>{const Ft=parseFloat(Tt.x),Ut=parseFloat(Tt.y),Zt=`${At}_landmark_${Rt}`;let Wt=!1;if(Mt){const qt=Mt.x,Yt=Mt.y,or=Math.sqrt(Math.pow(qt-Ft,2)+Math.pow(Yt-Ut,2)),hr=Math.sqrt(Math.pow(jt-Ft,2)+Math.pow(wt-Ut,2)),sr=.05;hr<=sr&&or>sr&&(Wt=!0)}else Math.sqrt(Math.pow(jt-Ft,2)+Math.pow(wt-Ut,2))<=.05&&(Wt=!0);if(Wt){if(tt)return;const qt=ce.current.get(Zt),Yt=Date.now();(!qt||Yt-qt>300)&&(Tt.shape||Tt.appearance,landmarkEarconManager.playLandmarkEarcon(Tt,{pan:(jt-G.xMin)/(G.xMax-G.xMin)*2-1}),ce.current.set(Zt,Yt))}}),ve.current.set(At,{x:jt,y:wt})})},tr=async(bt,_t={})=>{if(N)try{await audioSampleManager.playSample(bt,_t)}catch(Xt){console.warn(`Failed to play audio sample ${bt}:`,Xt)}};return null},Header=()=>{const{query:v}=libExports.useKBar(),{isAudioEnabled:N,setIsAudioEnabled:G,focusChart:z}=useGraphContext(),q=()=>{G(ie=>!ie)},W=navigator.platform.toUpperCase().indexOf("MAC")>=0?"⌘+K":"Ctrl+K";return jsxRuntimeExports.jsxs("header",{className:"w-full py-2 px-4 flex justify-between border-b border-border shadow bg-background",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntimeExports.jsx("img",{src:"/logo.svg",alt:"AudioFunctions+ logo",className:"size-17"}),jsxRuntimeExports.jsx("h1",{className:"font-bold hidden sm:block",children:"AudioFunctions+"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntimeExports.jsx("button",{onClick:q,className:"p-2  hover:text-foreground border-transparent bg-transparent","aria-label":`${N?"Disable Audio":"Enable Audio"}
732, keyboard shortcut: P`,title:`${N?"Disable Audio":"Enable Audio"} (P)`,children:N?jsxRuntimeExports.jsx(Volume2,{className:"size-7 text-primary"}):jsxRuntimeExports.jsx(VolumeX,{className:"size-7 text-red-500"})}),jsxRuntimeExports.jsxs("button",{onClick:v.toggle,className:"btn-primary flex items-center gap-2","aria-label":`Open Command Palette, keyboard shortcut: ${W}`,title:`Open Command Palette (${W})`,children:[jsxRuntimeExports.jsx(Wand,{className:"size-5"}),jsxRuntimeExports.jsx("span",{className:"hidden sm:inline",children:"Actions"}),jsxRuntimeExports.jsxs("span",{className:"text-xs opacity-70 hidden md:inline","aria-hidden":"true",children:["(",W,")"]})]})]})]})};function getScreenPosition(v,N,G){const z=document.getElementById("jxgbox");if(!z)return console.warn("Chart element not found, using fallback position"),{x:150,y:150};const q=z.getBoundingClientRect(),Y=G.xMax-G.xMin,W=G.yMax-G.yMin;if(Y===0||W===0)return console.warn("Invalid graph bounds range"),{x:150,y:150};const ie=(v-G.xMin)/Y,ne=(G.yMax-N)/W,se=q.left+ie*q.width,ae=q.top+ne*q.height;return{x:se,y:ae}}function jumpToLandmarkWithToast(v,N,G,z,q){N(v.x)}const useZoomBoard=()=>{const{setGraphBounds:v}=useGraphContext();return(N,G=!1,z=!1)=>{const q={x:.9,y:.9};N&&(q.x=1.1,q.y=1.1),G&&(q.y=1),z&&(q.x=1),v(Y=>{const W=(Y.xMin+Y.xMax)/2,ie=(Y.yMin+Y.yMax)/2,ne=(Y.xMax-Y.xMin)/2*q.x,se=(Y.yMax-Y.yMin)/2*q.y;return{xMin:W-ne,xMax:W+ne,yMin:ie-se,yMax:ie+se}})}},useCenterAtCursor=()=>{const{setGraphBounds:v,cursorCoords:N,graphBounds:G}=useGraphContext(),{announce:z}=useAnnouncement(),{showInfoToast:q}=useInfoToast();return()=>{if(!N||N.length===0){z("No cursor position available");return}const Y=N[0],W=Number(Y.x),ie=Number(Y.y),{xMin:ne,xMax:se,yMin:ae,yMax:ce}=G,pe=(ne+se)/2,ge=(ae+ce)/2,ve=W-pe,be=ie-ge,Ee=ne+ve,Pe=se+ve,Je=ae+be,Ce=ce+be;v({xMin:Ee,xMax:Pe,yMin:Je,yMax:Ce});const Ve=Number(W).toFixed(2),Re=Number(ie).toFixed(2);z(`View centered at cursor position: x = ${Ve}, y = ${Re}`),q(`Centered at (${Ve}, ${Re})`,1500)}};function KeyboardHandler(){const{setPlayFunction:v,setIsAudioEnabled:N,setGraphBounds:G,inputRefs:z,graphSettings:q,setGraphSettings:Y,cursorCoords:W,updateCursor:ie,stepSize:ne,functionDefinitions:se,setFunctionDefinitions:ae,setExplorationMode:ce,PlayFunction:pe,mouseTimeoutRef:ge,isAudioEnabled:ve,setIsShiftPressed:be,graphBounds:Ee}=useGraphContext(),{announce:Pe}=useAnnouncement(),{showInfoToast:Je,showLandmarkToast:Ce}=useInfoToast(),{openDialog:Ve}=useDialog(),Re=reactExports.useRef(new Set),qe=reactExports.useRef(null),et=1e3,Ze=15,tt=reactExports.useRef(!1),Ke=useZoomBoard();useCenterAtCursor();const rt=()=>{const ct=getActiveFunctions(se);if(ct.length===0)return[];const at=ct[0],st=se.findIndex(Et=>Et.id===at.id),pt=getLandmarksN(se,st),{xMin:lt,xMax:vt}=Ee,dt=pt.filter(Et=>Et.x>=lt&&Et.x<=vt),xt=[{type:"boundary",x:lt,label:"Left boundary"}],ft=[...dt].sort((Et,Ct)=>Et.x-Ct.x).map(Et=>({type:"landmark",x:Et.x,label:Et.label||"Landmark",landmark:Et}));return xt.push(...ft),xt.push({type:"boundary",x:vt,label:"Right boundary"}),xt},it=ct=>{if(!W||W.length===0)return;const at=parseFloat(W[0].x),st=rt();if(st.length===0)return;let pt=null;if(ct===1)pt=st.find(lt=>lt.x>at),pt||(tt.current&&(tt.current=!1),pt=st[0]);else{const lt=st.filter(vt=>vt.x<at);pt=lt[lt.length-1],pt||(tt.current&&(tt.current=!1),pt=st[st.length-1])}if(pt)if(ie(pt.x),pt.type==="landmark")getScreenPosition(pt.x,pt.landmark.y,Ee);else{const lt=getActiveFunctions(se);let vt=0;if(lt.length>0&&W.length>0){const dt=W.find(xt=>xt.functionId===lt[0].id);if(dt){const xt=parseFloat(dt.y);!isNaN(xt)&&isFinite(xt)&&(vt=xt)}}getScreenPosition(pt.x,vt,Ee)}},ot=ct=>{if(!se||ct<0||ct>=se.length)return;const at=se.map((pt,lt)=>({...pt,isActive:lt===ct}));ae(at);const st=getFunctionNameN(se,ct)||`Function ${ct+1}`;Pe(`Switched to ${st}`),Je(`${st}`,1500)},ut=ct=>{const at=getActiveFunctions(se);if(at.length===0)return;const st=at[0],pt=se.findIndex(vt=>vt.id===st.id),lt=findLandmarkByShortcut(se,pt,ct);lt&&jumpToLandmarkWithToast(lt,ie)};return reactExports.useEffect(()=>{const ct=async st=>{const pt=document.activeElement;
732if(!pt||pt.getAttribute("role")!=="application")return;Re.current.add(st.key.toLowerCase()),st.key==="Shift"&&be(!0);const lt=getActiveFunctions(se),vt=st.shiftKey?5:1;if(st.ctrlKey&&!st.altKey&&!st.shiftKey){const Et=["1","2","3","4","5","6","7","8","9","0"],Ct={"+":"1",ě:"2",š:"3",č:"4",ř:"5",ž:"6",ý:"7",á:"8",í:"9",é:"0"};if(Et.includes(st.key)){st.preventDefault(),st.stopPropagation(),ut(st.key);return}const Dt=Ct[st.key];if(Dt){st.preventDefault(),st.stopPropagation(),ut(Dt);return}}const dt={"+":0,ě:1,š:2,č:3,ř:4,ž:5,ý:6,á:7,í:8},xt={1:0,2:1,3:2,4:3,5:4,6:5,7:6,8:7,9:8};let ft;if(st.shiftKey&&!st.ctrlKey&&!st.metaKey&&!st.altKey?ft=xt[st.key]:!st.ctrlKey&&!st.metaKey&&!st.altKey&&!st.shiftKey&&(ft=dt[st.key]),ft!==void 0){st.preventDefault(),st.stopPropagation(),ot(ft);return}switch(st.key){case"a":case"A":G(Ct=>({...Ct,xMin:Ct.xMin-vt,xMax:Ct.xMax-vt}));break;case"d":case"D":G(Ct=>({...Ct,xMin:Ct.xMin+vt,xMax:Ct.xMax+vt}));break;case"w":case"W":G(Ct=>({...Ct,yMin:Ct.yMin+vt,yMax:Ct.yMax+vt}));break;case"s":case"S":G(Ct=>({...Ct,yMin:Ct.yMin-vt,yMax:Ct.yMax-vt}));break;case"z":case"Z":Ke(st.shiftKey,Re.current.has("x"),Re.current.has("y"));break;case"ArrowLeft":case"ArrowRight":case"j":case"J":case"l":case"L":if(pe.active&&pe.source==="play"){v(Ct=>({...Ct,active:!1})),ce("none");break}if(st.ctrlKey||st.metaKey){st.preventDefault(),st.stopPropagation(),st.key==="ArrowLeft"||st.key==="j"||st.key==="J"?it(-1):it(1);break}tt.current=!0;let Et=1;if((st.key==="ArrowLeft"||st.key==="j"||st.key==="J")&&(Et=-1),pe.active&&pe.source==="keyboard"&&v(Ct=>({...Ct,active:!1})),ge.current&&(clearTimeout(ge.current),ge.current=null),st.shiftKey)ce("keyboard_smooth"),v(Ct=>({...Ct,source:"keyboard",active:!0,direction:Et}));else{ce("keyboard_stepwise");let Ct=parseFloat(W[0].x),Dt;const Gt=1e-10,Ot=Math.round(Ct/ne)*ne;let It=Math.abs(Ct-Ot)<Gt;Et===1?Dt=It?Ct+ne:Math.ceil(Ct/ne)*ne:Dt=It?Ct-ne:Math.floor(Ct/ne)*ne;let Bt=[];lt.forEach(zt=>{zt.pointOfInterests.forEach(tr=>{Bt.push(tr.x)})});let Ht;const ir=Date.now();if(!qe.current||ir-qe.current>=et){if(Et===1?Ht=Bt.filter(zt=>Ct<zt&&zt<Dt):Ht=Bt.filter(zt=>Dt<zt&&zt<Ct),Ht.length>0&&ve)try{await audioSampleManager.playSample("notification",{volume:-15})}catch(zt){console.warn("Failed to play notification sound:",zt)}ie(Dt),qe.current=ir}}break;case"Home":st.preventDefault(),st.stopPropagation(),ie(Ee.xMin);break;case"End":st.preventDefault(),st.stopPropagation(),ie(Ee.xMax);break;case" ":v(Ct=>({...Ct,source:"play",active:!Ct.active})),st.preventDefault(),st.stopPropagation();break}},at=st=>{const pt=document.activeElement;!pt||pt.getAttribute("role")!=="application"||(Re.current.delete(st.key.toLowerCase()),st.key==="Shift"&&be(!1),["ArrowLeft","ArrowRight","j","J","l","L"].includes(st.key)&&(v(dt=>dt.source==="keyboard"?{...dt,active:!1}:dt),ce("none"),Date.now()-(qe.current||0)>Ze&&(qe.current=null)))};return document.addEventListener("keydown",ct),document.addEventListener("keyup",at),()=>{document.removeEventListener("keydown",ct),document.removeEventListener("keyup",at)}},[v,N,G,Y,z,W,ie,ne,se,ae,ce,pe,ge,ve,be,Ke,Ve,Ee,q]),null}function initializeTheme(){let v=null;try{v=localStorage.getItem("theme")}catch(G){console.warn("localStorage not available for theme, using system preference:",G)}v==="dark"?document.documentElement.setAttribute("data-theme","dark"):v==="high-contrast"?document.documentElement.setAttribute("data-theme","high-contrast"):v==="deuteranopia-protanopia-friendly"?document.documentElement.setAttribute("data-theme","deuteranopia-protanopia-friendly"):v==="light"?document.documentElement.removeAttribute("data-theme"):applySystemTheme(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",handleSystemThemeChange)}function applySystemTheme(){window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.setAttribute("data-theme","dark"):document.documentElement.setAttribute("data-theme","light")}function handleSystemThemeChange(v){let N=!1;try{N=!!localStorage.getItem("theme")}catch(G){console.warn("localStorage not available for theme check:",G)}N||(v.matches?document.documentElement.setAttribute("data-theme","dark"):document.documentElement.setAttribute("data-theme","light"))}function setTheme(v){if(v==="dark"){document.documentElement.setAttribute("data-theme","dark");try{localStorage.setItem("theme","dark")}catch(N){console.warn("Unable to save theme to localStorage:",N)}}else if(v==="high-contrast"){document.documentElement.setAttribute("data-theme","high-contrast");try{localStorage.setItem("theme","high-contrast")}catch(N){console.warn("Unable to save theme to localStorage:",N)}}else if(v==="deuteranopia-protanopia-friendly"){document.documentElement.setAttribute("data-theme","deuteranopia-protanopia-friendly");try{localStorage.setItem("theme","deuteranopia-protanopia-friendly")}catch(N){console.warn("Unable to save theme to localStorage:",N)}}else if(v==="light"){document.documentElement.removeAttribute("data-theme");try{localStorage.setItem("theme","light")}catch(N){console.warn("Unable to save theme to localStorage:",N)}}else if(v==="system"){try{localStorage.removeItem("theme")}catch(N){console.warn("Unable to remove theme from localStorage:",N)}applySystemTheme()}else console.warn("Unknown theme:",v)}const useDynamicKBarActions=()=>{const{isAudioEnabled:v,setIsAudioEnabled:N,cursorCoords:G,functionDefinitions:z,setFunctionDefinitions:q,setPlayFunction:Y,graphSettings:W,graphBounds:ie,setGraphBounds:ne,updateCursor:se,focusChart:ae}=useGraphContext(),{openDialog:ce}=useDialog(),{announce:pe}=useAnnouncement(),{showInfoToast:ge,showLandmarkToast:ve}=useInfoToast(),be=(W==null?void 0:W.restrictionMode)==="read-only",Ee=(W==null?void 0:W.restrictionMode)==="full-restriction",Pe=useZoomBoard();useCenterAtCursor();const Je=()=>{if(!G||G.length===0){pe("No cursor position available");return}const ut=G.map(ct=>{const at=z.findIndex(Et=>Et.id===ct.functionId),st=getFunctionNameN(z,at)||`Function ${at+1}`,pt=Number(ct.x).toFixed(2),lt=Number(ct.y).toFixed(2),vt=getLandmarksN(z,at),dt=.01,xt=vt.find(Et=>Math.abs(Et.x-ct.x)<dt&&Math.abs(Et.y-ct.y)<dt);let ft=`${st}: `;return xt&&(ft+=`"${xt.label}" at 
733`),ft+=`x = ${pt}, y = ${lt}`,ft}).join(`
734`);pe(`Current Coordinates:
735
736${ut}`),ge(`Current Coordinates:
737
738${ut}`)},Ce=()=>{const{xMin:ot,xMax:ut,yMin:ct,yMax:at}=ie,st=Number(ot).toFixed(2),pt=Number(ut).toFixed(2),lt=Number(ct).toFixed(2),vt=Number(at).toFixed(2),dt=`Current View Bounds:
739
740X: [${st}, ${pt}]
741Y: [${lt}, ${vt}]`;pe(dt),ge(dt)},Ve=()=>{if(!z||z.length===0)return;const ot=z.findIndex(st=>st.isActive);if(ot===-1){if(z.length>0){const st=z.map((pt,lt)=>({...pt,isActive:lt===0}));q(st)}return}const ut=(ot+1)%z.length,ct=z.map((st,pt)=>({...st,isActive:pt===ut}));q(ct);const at=getFunctionNameN(z,ut)||`Function ${ut+1}`;pe(`Switched to ${at}`),ge(`${at}`,1500)},Re=ot=>{if(!z||ot<0||ot>=z.length)return;const ut=z.map((at,st)=>({...at,isActive:st===ot}));q(ut);const ct=getFunctionNameN(z,ot)||`Function ${ot+1}`;pe(`Switched to ${ct}`),ge(`${ct}`,1500)},qe=()=>{if(!z||z.length===0)return;const ot=z.findIndex(pt=>pt.isActive);if(ot===-1)return;const ct=getFunctionInstrumentN(z,ot)==="guitar"?"clarinet":"guitar",at=ct==="guitar"?"discrete":"continuous",st=z.map((pt,lt)=>setFunctionInstrumentN([pt],0,ct)[0]);q(st),pe(`Sonification type changed to ${at}`),ge(`Sonification type: ${at}`,1500)},Ze=(()=>
741{if(!z||z.length===0)return"continuous";const ot=z.findIndex(ct=>ct.isActive);return ot===-1?"continuous":getFunctionInstrumentN(z,ot)==="guitar"?"discrete":"continuous"})(),tt=getActiveFunctions(z),Ke=tt.length>0?tt[0]:null,rt=Ke?z.findIndex(ot=>ot.id===Ke.id):-1,it=Ke?getLandmarksN(z,rt):[];return libExports.useRegisterActions([{id:"quick-options",name:"Quick Options",shortcut:["q"],keywords:"quick, quickoptions",icon:jsxRuntimeExports.jsx(List,{className:"size-5 shrink-0 opacity-70"})},{id:"toggle-audio",name:v?"Stop Audio":"Start Audio",shortcut:["p"],keywords:"audio, sound, enable, disable, start, stop, toggle, sonify, sonification, music, tone, mute, unmute, volume, hearing",parent:"quick-options",perform:()=>{N(ot=>!ot),setTimeout(()=>ae(),100)},icon:v?jsxRuntimeExports.jsx(VolumeX,{className:"size-5 shrink-0 opacity-70"}):jsxRuntimeExports.jsx(Volume2,{className:"size-5 shrink-0 opacity-70"})},{id:"show-coordinates",name:"Show Current Coordinates",shortcut:["c"],keywords:"coordinates, position, location, cursor, point, x, y, current, where, place",parent:"quick-options",perform:()=>{Je(),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(MapPin,{className:"size-5 shrink-0 opacity-70"})},{id:"show-view-bounds",name:"Show current view bounds",shortcut:["v"],keywords:"bound, view, range, axis, limits, window, viewport, boundaries, min, max, xmin, xmax, ymin, ymax, scale, zoom",parent:"quick-options",perform:()=>{Ce(),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(Ruler,{className:"size-5 shrink-0 opacity-70"})},{id:"zoom-in",name:"Zoom In",shortcut:["z (may hold)"],keywords:"zoom, in, closer, magnify, enlarge, scale, view, detail",parent:"quick-options",perform:()=>{Pe(!1),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(ZoomIn,{className:"size-5 shrink-0 opacity-70"})},{id:"zoom-out",name:"Zoom Out",shortcut:["shift+z (may hold)"],keywords:"zoom, out, farther, shrink, reduce, scale, view, overview",parent:"quick-options",perform:()=>{Pe(!0),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(ZoomOut,{className:"size-5 shrink-0 opacity-70"})},{id:"next-function",name:"Next Function",shortcut:["n"],keywords:"switch, function, next, rotate, cycle, change, active, select, navigate, iterate, loop",parent:"quick-options",perform:()=>{Ve(),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(ListRestart,{className:"size-5 shrink-0 opacity-70"})},{id:"play-function",name:"Play Function",shortcut:["b"],keywords:"play, run, complete, automatic, auto, autoplay, batch, sonify, listen, hear, full, entire, whole",parent:"quick-options",perform:()=>{Y(ot=>({...ot,source:"play",active:!ot.active})),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(Play,{className:"size-5 shrink-0 opacity-70"})},{id:"toggle-sonification-type",name:`Change Sonification-Instrument to ${Ze==="discrete"?"Continuous":"Discrete"}`,shortcut:["i"],keywords:"sonification, instrument, discrete, continuous, guitar, clarinet, toggle, sound, type, mode, timbre",parent:"quick-options",perform:()=>{qe(),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(Music,{className:"size-5 shrink-0 opacity-70"})},{id:"reset-view",name:"Reset View",shortcut:["r"],keywords:"reset, restore, standard, default, original, initial, revert, back",parent:"quick-options",perform:()=>{const ot=W==null?void 0:W.defaultView;if(ot&&Array.isArray(ot)&&ot.length===4){const[ut,ct,at,st]=ot;ne({xMin:ut,xMax:ct,yMin:st,yMax:at})}else ne({xMin:-10,xMax:10,yMin:-10,yMax:10});se(0),pe("View reset to default values"),ge("Default view",1500),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(RotateCcw,{className:"size-5 shrink-0 opacity-70"})},{id:"function-options",name:"Functions",keywords:"function, options, settings, configure, manage, edit, change",icon:jsxRuntimeExports.jsx(SquareActivity,{className:"size-5 shrink-0 opacity-70"})},...(z||[]).map((ot,ut)=>{const ct=getFunctionNameN(z,ut)||`Function ${ut+1}`;return{id:`show-function-${ot.id}`,name:`Show ${ct}`,shortcut:ut<9?[(ut+1).toString()]:void 0,keywords:`function, show, display, activate, select, switch, ${ct}, graph, plot, f${ut+1}`,parent:"function-options",priority:libExports.Priority.HIGH,perform:()=>{Re(ut),setTimeout(()=>ae(),100)},icon:jsxRuntimeExports.jsx(Eye,{className:"size-5 shrink-0 opacity-70"})}}),...Ee?[]:[{id:"change-function",name:be?"View Functions":"Edit Functions",shortcut:["f"],parent:"function-options",priority:libExports.Priority.HIGH,keywords:be?"function, view, read, inspect, examine, look, display, show, formula, equation, math":"function, change, edit, modify, create, add, insert, remove, delete, formula, equation, math, input, type, write",perform:()=>{ce("edit-function")},icon:jsxRuntimeExports.jsx(ChartSpline,{className:"size-5 shrink-0 opacity-70"})}],{id:"diagram-options",name:"Diagram Options",keywords:"diagram, graph, chart, plot, options, settings, configuration, view, display, visual",icon:jsxRuntimeExports.jsx(FileChartLine,{className:"size-5 shrink-0 opacity-70"})},{id:"set-view",name:"Set View",keywords:"view, bounds, range, limits, window, axis, xmin, xmax, ymin, ymax, zoom, scale, viewport, boundaries, change, set, configure",parent:"diagram-options",perform:()=>
741ce("change-graph-bound"),icon:jsxRuntimeExports.jsx(ChartArea,{className:"size-5 shrink-0 opacity-70"})},{id:"movement-adjustments",name:"Movement Adjustments",shortcut:["m"],keywords:"movement, speed, step, navigation, adjustments, cursor, motion, velocity, increment, stepsize, keyboard, arrow, smooth, stepwise",parent:"diagram-options",perform:()=>ce("movement-adjustments"),icon:jsxRuntimeExports.jsx(CircleGauge,{className:"size-5 shrink-0 opacity-70"})},...!be&&!Ee?[{id:"import-export",name:"Import/Export",keywords:"import, export, json, file, save, load, share, backup, restore, transfer, exchange",icon:jsxRuntimeExports.jsx(Import,{className:"size-5 shrink-0 opacity-70"}),priority:libExports.Priority.LOW},{id:"share",name:"Share",keywords:"share, export, link, url, collaborate, send, distribute, publish, online",parent:"import-export",perform:()=>ce("share"),icon:jsxRuntimeExports.jsx(Share2,{className:"size-5 shrink-0 opacity-70"})},{id:"import-json",name:"Import from file",keywords:"import, json, upload, file, load, open, restore, read, backup",parent:"import-export",perform:()=>ce("import-json"),icon:jsxRuntimeExports.jsx(FileUp,{className:"size-5 shrink-0 opacity-70"})},{id:"export-json",name:"Export as file",keywords:"export, json, download, save, file, backup, store, preserve",parent:"import-export",perform:()=>ce("export-json"),icon:jsxRuntimeExports.jsx(FileDown,{className:"size-5 shrink-0 opacity-70"})}]:[],...be||Ee?[{id:"import-json",name:"Import from file",keywords:"import, json, upload, file, load, open, restore, read, backup",perform:()=>ce("import-json"),icon:jsxRuntimeExports.jsx(FileUp,{className:"size-5 shrink-0 opacity-70"}),priority:libExports.Priority.LOW}]:[],{id:"change-theme",name:"Change Theme",keywords:"theme, appearance, color, style, visual, dark, light, contrast, accessibility, colorblind",icon:jsxRuntimeExports.jsx(SwatchBook,{className:"size-5 shrink-0 opacity-70"})},{id:"system-theme",name:"Use System Theme",keywords:"theme, system, automatic, os, operating, preference, default, follow",parent:"change-theme",perform:()=>{setTheme("system"),pe("Theme set to system preference")},icon:jsxRuntimeExports.jsx(SunMoon,{className:"size-5 shrink-0 opacity-70"})},{id:"light-theme",name:"Light Theme",keywords:"theme, light, bright, white, day, normal, standard",parent:"change-theme",perform:()=>{setTheme("light"),pe("Theme set to light mode")},icon:jsxRuntimeExports.jsx(Sun,{className:"size-5 shrink-0 opacity-70"})},{id:"dark-theme",name:"Dark Theme",keywords:"theme, dark, night, black, low, light, eyes",parent:"change-theme",perform:()=>{setTheme("dark"),pe("Theme set to dark mode")},icon:jsxRuntimeExports.jsx(Moon,{className:"size-5 shrink-0 opacity-70"})},{id:"high-contrast-theme",name:"High Contrast Theme",keywords:"theme, contrast, high, accessibility, vision, impaired, clear, sharp, bold",parent:"change-theme",perform:()=>{setTheme("high-contrast"),pe("Theme set to high contrast mode")},icon:jsxRuntimeExports.jsx(Contrast,{className:"size-5 shrink-0 opacity-70"})},{id:"deuteranopia-protanopia-friendly-theme",name:"Deuteranopia/Protanopia Friendly Theme",keywords:"theme, deuteranopia, protanopia, colorblind, accessibility, vision, friendly, color, blind, impaired, green, red",parent:"change-theme",perform:()=>{setTheme("deuteranopia-protanopia-friendly"),pe("Theme set to deuteranopia/protanopia friendly mode")},icon:jsxRuntimeExports.jsx(Eye,{className:"size-5 shrink-0 opacity-70"})},{id:"help",name:"Help",keywords:"help, tutorial, guide, welcome, introduction, getting, started, how, to, use, learn, documentation, manual, instructions",shortcut:["F1"],perform:()=>ce("welcome"),icon:jsxRuntimeExports.jsx(CircleHelp,{className:"size-5 shrink-0 opacity-70"}),priority:libExports.Priority.LOW},{id:"about",name:"About AudioFunctions+",keywords:"about, info, information, copyright, license, developers, version, team, credits, acknowledgments, universities, funding, eu, project",perform:()=>ce("about"),icon:jsxRuntimeExports.jsx(Info,{className:"size-5 shrink-0 opacity-70"}),priority:libExports.Priority.LOW}],[v,G,z,be,ae,it,Ke,rt]),null},PaletteActions=()=>(useDynamicKBarActions(),null);function App(){return jsxRuntimeExports.jsx(InstrumentsProvider,{children:jsxRuntimeExports.jsx(GraphContextProvider,{children:jsxRuntimeExports.jsx(AnnouncementProvider,{children:jsxRuntimeExports.jsx(InfoToastProvider,{children:jsxRuntimeExports.jsxs(DialogProvider,{children:[jsxRuntimeExports.jsx(KeyboardHandler,{}),jsxRuntimeExports.jsx(AppContent,{})]})})})})})}const AppContent=()=>{const{openDialog:v}=useDialog();return reactExports.useRef(!1),jsxRuntimeExports.jsx(KBarWrapper,{})},KBarWrapper=()=>
741{const{setIsAudioEnabled:v,focusChart:N}=useGraphContext(),G=z=>{z&&z.preventDefault(),v(q=>q||!0),setTimeout(()=>{window.location.hash!=="#chart"&&(window.location.hash="chart"),N()},0)};return jsxRuntimeExports.jsxs(libExports.KBarProvider,{children:[jsxRuntimeExports.jsx("a",{href:"#chart",className:"skip-link",style:{position:"absolute",top:"-40px",left:"6px",background:"var(--color-primary)",color:"var(--color-txt-title)",padding:"8px 16px",textDecoration:"none",borderRadius:"4px",zIndex:1e3,transition:"top 0.3s ease"},onFocus:z=>{z.target.style.top="6px"},onBlur:z=>{z.target.style.top="-40px"},onClick:G,onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&G(z)},children:"Skip to chart. Enable audio chart keyboard interaction."}),jsxRuntimeExports.jsx(PaletteActions,{}),jsxRuntimeExports.jsx(CommandBar,{}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",width:"100vw"},children:[jsxRuntimeExports.jsx(Header,{}),jsxRuntimeExports.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntimeExports.jsx(GraphView,{}),jsxRuntimeExports.jsx(GraphSonification,{})]})]})]})};initializeTheme();clientExports.createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(App,{})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.