@perses-dev/timeseries-chart-plugin 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/__mf/js/TimeSeriesChart.d3742b3b.js +5 -0
  2. package/__mf/js/async/109.bf4f02fe.js +73 -0
  3. package/__mf/js/async/133.c48c8cc8.js +110 -0
  4. package/__mf/js/async/{879.24def15a.js.LICENSE.txt → 133.c48c8cc8.js.LICENSE.txt} +28 -0
  5. package/__mf/js/async/173.58a1dc61.js +2 -0
  6. package/__mf/js/async/214.37696543.js +1 -0
  7. package/__mf/js/async/224.2d3ce51f.js +1 -0
  8. package/__mf/js/async/238.767e5398.js +1 -0
  9. package/__mf/js/async/292.9efc6a73.js +1 -0
  10. package/__mf/js/async/409.97dde548.js +1 -0
  11. package/__mf/js/async/476.23a59a72.js +1 -0
  12. package/__mf/js/async/488.031fc875.js +1 -0
  13. package/__mf/js/async/53.8edfe937.js +2 -0
  14. package/__mf/js/async/547.bb4f1e58.js +7 -0
  15. package/__mf/js/async/580.5f4b0dbd.js +38 -0
  16. package/__mf/js/async/613.20f15bb7.js +1 -0
  17. package/__mf/js/async/62.f24fce0a.js +1 -0
  18. package/__mf/js/async/651.e0c9e225.js +1 -0
  19. package/__mf/js/async/686.0cd9a75c.js +1 -0
  20. package/__mf/js/async/694.ebf24a00.js +1 -0
  21. package/__mf/js/async/738.c37f7bca.js +1 -0
  22. package/__mf/js/async/740.f0e8d499.js +1 -0
  23. package/__mf/js/async/75.26ec5bee.js +1 -0
  24. package/__mf/js/async/770.e129dd07.js +1 -0
  25. package/__mf/js/async/797.72ff552e.js +2 -0
  26. package/__mf/js/async/863.f147d2ba.js +2 -0
  27. package/__mf/js/async/960.cd399075.js +2 -0
  28. package/__mf/js/async/964.719c530c.js +2 -0
  29. package/__mf/js/async/981.e360e7df.js +2 -0
  30. package/__mf/js/async/__federation_expose_TimeSeriesChart.f20a0aca.js +3 -0
  31. package/__mf/js/async/lib-router.25a1f509.js +2 -0
  32. package/__mf/js/main.2c598209.js +5 -0
  33. package/lib/CSVExportUtils.d.ts +39 -0
  34. package/lib/CSVExportUtils.d.ts.map +1 -0
  35. package/lib/CSVExportUtils.js +212 -0
  36. package/lib/CSVExportUtils.js.map +1 -0
  37. package/lib/TimeSeriesChart.d.ts +0 -3
  38. package/lib/TimeSeriesChart.d.ts.map +1 -1
  39. package/lib/TimeSeriesChart.js +9 -4
  40. package/lib/TimeSeriesChart.js.map +1 -1
  41. package/lib/TimeSeriesChartBase.d.ts.map +1 -1
  42. package/lib/TimeSeriesChartBase.js +2 -2
  43. package/lib/TimeSeriesChartBase.js.map +1 -1
  44. package/lib/TimeSeriesChartOptionsEditorSettings.js +1 -0
  45. package/lib/TimeSeriesChartOptionsEditorSettings.js.map +1 -1
  46. package/lib/TimeSeriesChartPanel.d.ts.map +1 -1
  47. package/lib/TimeSeriesChartPanel.js.map +1 -1
  48. package/lib/TimeSeriesExportAction.d.ts +4 -0
  49. package/lib/TimeSeriesExportAction.d.ts.map +1 -0
  50. package/lib/TimeSeriesExportAction.js +69 -0
  51. package/lib/TimeSeriesExportAction.js.map +1 -0
  52. package/lib/cjs/CSVExportUtils.js +246 -0
  53. package/lib/cjs/TimeSeriesChart.js +8 -1
  54. package/lib/cjs/TimeSeriesChartBase.js +2 -2
  55. package/lib/cjs/TimeSeriesChartOptionsEditorSettings.js +1 -0
  56. package/lib/cjs/TimeSeriesExportAction.js +123 -0
  57. package/lib/cjs/index.js +1 -0
  58. package/lib/index.d.ts +1 -0
  59. package/lib/index.d.ts.map +1 -1
  60. package/lib/index.js +1 -0
  61. package/lib/index.js.map +1 -1
  62. package/mf-manifest.json +41 -90
  63. package/mf-stats.json +41 -90
  64. package/package.json +12 -4
  65. package/__mf/js/983.b0368f8f.js +0 -5
  66. package/__mf/js/TimeSeriesChart.33363c77.js +0 -5
  67. package/__mf/js/async/171.598de6a9.js +0 -7
  68. package/__mf/js/async/173.f6f7e45b.js +0 -2
  69. package/__mf/js/async/214.2d4431c6.js +0 -1
  70. package/__mf/js/async/223.def4d0a9.js +0 -1
  71. package/__mf/js/async/224.ce414ffb.js +0 -1
  72. package/__mf/js/async/238.625b8a48.js +0 -1
  73. package/__mf/js/async/281.a2a87c37.js +0 -2
  74. package/__mf/js/async/292.311e6eb0.js +0 -1
  75. package/__mf/js/async/359.18a264e7.js +0 -2
  76. package/__mf/js/async/409.b4cabab7.js +0 -1
  77. package/__mf/js/async/476.45fca8d3.js +0 -1
  78. package/__mf/js/async/488.0d0b1a91.js +0 -1
  79. package/__mf/js/async/620.d6f96402.js +0 -2
  80. package/__mf/js/async/651.80087530.js +0 -1
  81. package/__mf/js/async/656.d43503a5.js +0 -1
  82. package/__mf/js/async/694.27c70ab1.js +0 -1
  83. package/__mf/js/async/738.0a12bb44.js +0 -1
  84. package/__mf/js/async/740.67107c3c.js +0 -1
  85. package/__mf/js/async/75.5952779d.js +0 -1
  86. package/__mf/js/async/755.f76e3538.js +0 -38
  87. package/__mf/js/async/770.78a741ab.js +0 -1
  88. package/__mf/js/async/780.3fa36115.js +0 -110
  89. package/__mf/js/async/780.3fa36115.js.LICENSE.txt +0 -27
  90. package/__mf/js/async/845.6d99c354.js +0 -73
  91. package/__mf/js/async/879.24def15a.js +0 -2
  92. package/__mf/js/async/960.3047096d.js +0 -2
  93. package/__mf/js/async/964.6dfbf211.js +0 -2
  94. package/__mf/js/async/981.77f901c0.js +0 -2
  95. package/__mf/js/async/__federation_expose_TimeSeriesChart.1e16af77.js +0 -1
  96. package/__mf/js/async/lib-router.098fc614.js +0 -2
  97. package/__mf/js/main.beef92ec.js +0 -1
  98. /package/__mf/js/async/{845.6d99c354.js.LICENSE.txt → 109.bf4f02fe.js.LICENSE.txt} +0 -0
  99. /package/__mf/js/async/{173.f6f7e45b.js.LICENSE.txt → 173.58a1dc61.js.LICENSE.txt} +0 -0
  100. /package/__mf/js/async/{359.18a264e7.js.LICENSE.txt → 53.8edfe937.js.LICENSE.txt} +0 -0
  101. /package/__mf/js/async/{171.598de6a9.js.LICENSE.txt → 547.bb4f1e58.js.LICENSE.txt} +0 -0
  102. /package/__mf/js/async/{281.a2a87c37.js.LICENSE.txt → 797.72ff552e.js.LICENSE.txt} +0 -0
  103. /package/__mf/js/async/{620.d6f96402.js.LICENSE.txt → 863.f147d2ba.js.LICENSE.txt} +0 -0
  104. /package/__mf/js/async/{960.3047096d.js.LICENSE.txt → 960.cd399075.js.LICENSE.txt} +0 -0
  105. /package/__mf/js/async/{964.6dfbf211.js.LICENSE.txt → 964.719c530c.js.LICENSE.txt} +0 -0
  106. /package/__mf/js/async/{981.77f901c0.js.LICENSE.txt → 981.e360e7df.js.LICENSE.txt} +0 -0
  107. /package/__mf/js/async/{lib-router.098fc614.js.LICENSE.txt → lib-router.25a1f509.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkTimeSeriesChart=self.webpackChunkTimeSeriesChart||[]).push([["292"],{36679:function(e,t,r){r.r(t),r.d(t,{Controller:()=>R,Form:()=>P,FormProvider:()=>k,appendErrors:()=>$,get:()=>g,set:()=>A,useController:()=>N,useFieldArray:()=>eh,useForm:()=>eR,useFormContext:()=>w,useFormState:()=>B,useWatch:()=>M});var a=r(54538),s=e=>"checkbox"===e.type,i=e=>e instanceof Date,l=e=>null==e;let u=e=>"object"==typeof e;var n=e=>!l(e)&&!Array.isArray(e)&&u(e)&&!i(e),o=e=>n(e)&&e.target?s(e.target)?e.target.checked:e.target.value:e,d=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,f=(e,t)=>e.has(d(t)),c=e=>{let t=e.constructor&&e.constructor.prototype;return n(t)&&t.hasOwnProperty("isPrototypeOf")},m="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function y(e){let t;let r=Array.isArray(e),a="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(m&&(e instanceof Blob||a))&&(r||n(e))))return e;else if(t=r?[]:{},r||c(e))for(let r in e)e.hasOwnProperty(r)&&(t[r]=y(e[r]));else t=e;return t}var _=e=>Array.isArray(e)?e.filter(Boolean):[],p=e=>void 0===e,g=(e,t,r)=>{if(!t||!n(e))return r;let a=_(t.split(/[,[\].]+?/)).reduce((e,t)=>l(e)?e:e[t],e);return p(a)||a===e?p(e[t])?r:e[t]:a},h=e=>"boolean"==typeof e,v=e=>/^\w*$/.test(e),b=e=>_(e.replace(/["|']|\]/g,"").split(/\.|\[/)),A=(e,t,r)=>{let a=-1,s=v(t)?[t]:b(t),i=s.length,l=i-1;for(;++a<i;){let t=s[a],i=r;if(a!==l){let r=e[t];i=n(r)||Array.isArray(r)?r:isNaN(+s[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}return e};let F={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},x={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},V={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},S=a.createContext(null),w=()=>a.useContext(S),k=e=>{let{children:t,...r}=e;return a.createElement(S.Provider,{value:r},t)};var D=(e,t,r,a=!0)=>{let s={defaultValues:t._defaultValues};for(let i in e)Object.defineProperty(s,i,{get:()=>(t._proxyFormState[i]!==x.all&&(t._proxyFormState[i]=!a||x.all),r&&(r[i]=!0),e[i])});return s},C=e=>n(e)&&!Object.keys(e).length,E=(e,t,r,a)=>{r(e);let{name:s,...i}=e;return C(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(e=>t[e]===(!a||x.all))},O=e=>Array.isArray(e)?e:[e],j=(e,t,r)=>!e||!t||e===t||O(e).some(e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e)));function T(e){let t=a.useRef(e);t.current=e,a.useEffect(()=>{let r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function B(e){let t=w(),{control:r=t.control,disabled:s,name:i,exact:l}=e||{},[u,n]=a.useState(r._formState),o=a.useRef(!0),d=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),f=a.useRef(i);return f.current=i,T({disabled:s,next:e=>o.current&&j(f.current,e.name,l)&&E(e,d.current,r._updateFormState)&&n({...r._formState,...e}),subject:r._subjects.state}),a.useEffect(()=>(o.current=!0,d.current.isValid&&r._updateValid(!0),()=>{o.current=!1}),[r]),a.useMemo(()=>D(u,r,d.current,!1),[u,r])}var U=e=>"string"==typeof e,L=(e,t,r,a,s)=>U(e)?(a&&t.watch.add(e),g(r,e,s)):Array.isArray(e)?e.map(e=>(a&&t.watch.add(e),g(r,e))):(a&&(t.watchAll=!0),r);function M(e){let t=w(),{control:r=t.control,name:s,defaultValue:i,disabled:l,exact:u}=e||{},n=a.useRef(s);n.current=s,T({disabled:l,subject:r._subjects.values,next:e=>{j(n.current,e.name,u)&&d(y(L(n.current,r._names,e.values||r._formValues,!1,i)))}});let[o,d]=a.useState(r._getWatch(s,i));return a.useEffect(()=>r._removeUnmounted()),o}function N(e){let t=w(),{name:r,disabled:s,control:i=t.control,shouldUnregister:l}=e,u=f(i._names.array,r),n=M({control:i,name:r,defaultValue:g(i._formValues,r,g(i._defaultValues,r,e.defaultValue)),exact:!0}),d=B({control:i,name:r,exact:!0}),c=a.useRef(i.register(r,{...e.rules,value:n,...h(e.disabled)?{disabled:e.disabled}:{}})),m=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!g(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!g(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!g(d.validatingFields,r)},error:{enumerable:!0,get:()=>g(d.errors,r)}}),[d,r]),_=a.useMemo(()=>({name:r,value:n,...h(s)||d.disabled?{disabled:d.disabled||s}:{},onChange:e=>c.current.onChange({target:{value:o(e),name:r},type:F.CHANGE}),onBlur:()=>c.current.onBlur({target:{value:g(i._formValues,r),name:r},type:F.BLUR}),ref:e=>{let t=g(i._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}}),[r,i._formValues,s,d.disabled,n,i._fields]);return a.useEffect(()=>{let e=i._options.shouldUnregister||l,t=(e,t)=>{let r=g(i._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){let e=y(g(i._options.defaultValues,r));A(i._defaultValues,r,e),p(g(i._formValues,r))&&A(i._formValues,r,e)}return u||i.register(r),()=>{(u?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}},[r,i,u,l]),a.useEffect(()=>{i._updateDisabledField({disabled:s,fields:i._fields,name:r})},[s,r,i]),a.useMemo(()=>({field:_,formState:d,fieldState:m}),[_,d,m])}let R=e=>e.render(N(e)),q=e=>{let t={};for(let r of Object.keys(e))if(u(e[r])&&null!==e[r]){let a=q(e[r]);for(let e of Object.keys(a))t[`${r}.${e}`]=a[e]}else t[r]=e[r];return t};function P(e){let t=w(),[r,s]=a.useState(!1),{control:i=t.control,onSubmit:l,children:u,action:n,method:o="post",headers:d,encType:f,onError:c,render:m,onSuccess:y,validateStatus:_,...p}=e,g=async t=>{let r=!1,a="";await i.handleSubmit(async e=>{let s=new FormData,u="";try{u=JSON.stringify(e)}catch(e){}let m=q(i._formValues);for(let e in m)s.append(e,m[e]);if(l&&await l({data:e,event:t,method:o,formData:s,formDataJson:u}),n)try{let e=[d&&d["Content-Type"],f].some(e=>e&&e.includes("json")),t=await fetch(String(n),{method:o,headers:{...d,...f?{"Content-Type":f}:{}},body:e?u:s});t&&(_?!_(t.status):t.status<200||t.status>=300)?(r=!0,c&&c({response:t}),a=String(t.status)):y&&y({response:t})}catch(e){r=!0,c&&c({error:e})}})(t),r&&e.control&&(e.control._subjects.state.next({isSubmitSuccessful:!1}),e.control.setError("root.server",{type:a}))};return a.useEffect(()=>{s(!0)},[]),m?a.createElement(a.Fragment,null,m({submit:g})):a.createElement("form",{noValidate:r,action:n,method:o,encType:f,onSubmit:g,...p},u)}var $=(e,t,r,a,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[a]:s||!0}}:{},I=()=>{let e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)})},W=(e,t,r={})=>r.shouldFocus||p(r.shouldFocus)?r.focusName||`${e}.${p(r.focusIndex)?t:r.focusIndex}.`:"",H=e=>({isOnSubmit:!e||e===x.onSubmit,isOnBlur:e===x.onBlur,isOnChange:e===x.onChange,isOnAll:e===x.all,isOnTouch:e===x.onTouched}),G=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let z=(e,t,r,a)=>{for(let s of r||Object.keys(e)){let r=g(e,s);if(r){let{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],s)&&!a)return!0;if(e.ref&&t(e.ref,e.name)&&!a)return!0;if(z(i,t))break}else if(n(i)&&z(i,t))break}}};var J=(e,t,r)=>{let a=O(g(e,r));return A(a,"root",t[r]),A(e,r,a),e},K=e=>"file"===e.type,Q=e=>"function"==typeof e,X=e=>{if(!m)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Y=e=>U(e),Z=e=>"radio"===e.type,ee=e=>e instanceof RegExp;let et={value:!1,isValid:!1},er={value:!0,isValid:!0};var ea=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!p(e[0].attributes.value)?p(e[0].value)||""===e[0].value?er:{value:e[0].value,isValid:!0}:er:et}return et};let es={isValid:!1,value:null};var ei=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,es):es;function el(e,t,r="validate"){if(Y(e)||Array.isArray(e)&&e.every(Y)||h(e)&&!e)return{type:r,message:Y(e)?e:"",ref:t}}var eu=e=>n(e)&&!ee(e)?e:{value:e,message:""},en=async(e,t,r,a,i,u)=>{let{ref:o,refs:d,required:f,maxLength:c,minLength:m,min:y,max:_,pattern:v,validate:b,name:A,valueAsNumber:F,mount:x}=e._f,S=g(r,A);if(!x||t.has(A))return{};let w=d?d[0]:o,k=e=>{i&&w.reportValidity&&(w.setCustomValidity(h(e)?"":e||""),w.reportValidity())},D={},E=Z(o),O=s(o),j=(F||K(o))&&p(o.value)&&p(S)||X(o)&&""===o.value||""===S||Array.isArray(S)&&!S.length,T=$.bind(null,A,a,D),B=(e,t,r,a=V.maxLength,s=V.minLength)=>{let i=e?t:r;D[A]={type:e?a:s,message:i,ref:o,...T(e?a:s,i)}};if(u?!Array.isArray(S)||!S.length:f&&(!(E||O)&&(j||l(S))||h(S)&&!S||O&&!ea(d).isValid||E&&!ei(d).isValid)){let{value:e,message:t}=Y(f)?{value:!!f,message:f}:eu(f);if(e&&(D[A]={type:V.required,message:t,ref:w,...T(V.required,t)},!a))return k(t),D}if(!j&&(!l(y)||!l(_))){let e,t;let r=eu(_),s=eu(y);if(l(S)||isNaN(S)){let a=o.valueAsDate||new Date(S),i=e=>new Date(new Date().toDateString()+" "+e),l="time"==o.type,u="week"==o.type;U(r.value)&&S&&(e=l?i(S)>i(r.value):u?S>r.value:a>new Date(r.value)),U(s.value)&&S&&(t=l?i(S)<i(s.value):u?S<s.value:a<new Date(s.value))}else{let a=o.valueAsNumber||(S?+S:S);l(r.value)||(e=a>r.value),l(s.value)||(t=a<s.value)}if((e||t)&&(B(!!e,r.message,s.message,V.max,V.min),!a))return k(D[A].message),D}if((c||m)&&!j&&(U(S)||u&&Array.isArray(S))){let e=eu(c),t=eu(m),r=!l(e.value)&&S.length>+e.value,s=!l(t.value)&&S.length<+t.value;if((r||s)&&(B(r,e.message,t.message),!a))return k(D[A].message),D}if(v&&!j&&U(S)){let{value:e,message:t}=eu(v);if(ee(e)&&!S.match(e)&&(D[A]={type:V.pattern,message:t,ref:o,...T(V.pattern,t)},!a))return k(t),D}if(b){if(Q(b)){let e=el(await b(S,r),w);if(e&&(D[A]={...e,...T(V.validate,e.message)},!a))return k(e.message),D}else if(n(b)){let e={};for(let t in b){if(!C(e)&&!a)break;let s=el(await b[t](S,r),w,t);s&&(e={...s,...T(t,s.message)},k(s.message),a&&(D[A]=e))}if(!C(e)&&(D[A]={ref:w,...e},!a))return D}}return k(!0),D},eo=(e,t)=>[...e,...O(t)],ed=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function ef(e,t,r){return[...e.slice(0,t),...O(r),...e.slice(t)]}var ec=(e,t,r)=>Array.isArray(e)?(p(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],em=(e,t)=>[...O(t),...O(e)],ey=(e,t)=>p(t)?[]:function(e,t){let r=0,a=[...e];for(let e of t)a.splice(e-r,1),r++;return _(a).length?a:[]}(e,O(t).sort((e,t)=>e-t)),e_=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]};function ep(e,t){let r=Array.isArray(t)?t:v(t)?[t]:b(t),a=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,a=0;for(;a<r;)e=p(e)?a++:e[t[a++]];return e}(e,r),s=r.length-1,i=r[s];return a&&delete a[i],0!==s&&(n(a)&&C(a)||Array.isArray(a)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!p(e[t]))return!1;return!0}(a))&&ep(e,r.slice(0,-1)),e}var eg=(e,t,r)=>(e[t]=r,e);function eh(e){let t=w(),{control:r=t.control,name:s,keyName:i="id",shouldUnregister:l,rules:u}=e,[n,o]=a.useState(r._getFieldArray(s)),d=a.useRef(r._getFieldArray(s).map(I)),f=a.useRef(n),c=a.useRef(s),m=a.useRef(!1);c.current=s,f.current=n,r._names.array.add(s),u&&r.register(s,u),T({next:({values:e,name:t})=>{if(t===c.current||!t){let t=g(e,c.current);Array.isArray(t)&&(o(t),d.current=t.map(I))}},subject:r._subjects.array});let _=a.useCallback(e=>{m.current=!0,r._updateFieldArray(s,e)},[r,s]);return a.useEffect(()=>{if(r._state.action=!1,G(s,r._names)&&r._subjects.state.next({...r._formState}),m.current&&(!H(r._options.mode).isOnSubmit||r._formState.isSubmitted)){if(r._options.resolver)r._executeSchema([s]).then(e=>{let t=g(e.errors,s),a=g(r._formState.errors,s);(a?!t&&a.type||t&&(a.type!==t.type||a.message!==t.message):t&&t.type)&&(t?A(r._formState.errors,s,t):ep(r._formState.errors,s),r._subjects.state.next({errors:r._formState.errors}))});else{let e=g(r._fields,s);e&&e._f&&!(H(r._options.reValidateMode).isOnSubmit&&H(r._options.mode).isOnSubmit)&&en(e,r._names.disabled,r._formValues,r._options.criteriaMode===x.all,r._options.shouldUseNativeValidation,!0).then(e=>!C(e)&&r._subjects.state.next({errors:J(r._formState.errors,e,s)}))}}r._subjects.values.next({name:s,values:{...r._formValues}}),r._names.focus&&z(r._fields,(e,t)=>{if(r._names.focus&&t.startsWith(r._names.focus)&&e.focus)return e.focus(),1}),r._names.focus="",r._updateValid(),m.current=!1},[n,s,r]),a.useEffect(()=>(g(r._formValues,s)||r._updateFieldArray(s),()=>{(r._options.shouldUnregister||l)&&r.unregister(s)}),[s,r,i,l]),{swap:a.useCallback((e,t)=>{let a=r._getFieldArray(s);e_(a,e,t),e_(d.current,e,t),_(a),o(a),r._updateFieldArray(s,a,e_,{argA:e,argB:t},!1)},[_,s,r]),move:a.useCallback((e,t)=>{let a=r._getFieldArray(s);ec(a,e,t),ec(d.current,e,t),_(a),o(a),r._updateFieldArray(s,a,ec,{argA:e,argB:t},!1)},[_,s,r]),prepend:a.useCallback((e,t)=>{let a=O(y(e)),i=em(r._getFieldArray(s),a);r._names.focus=W(s,0,t),d.current=em(d.current,a.map(I)),_(i),o(i),r._updateFieldArray(s,i,em,{argA:ed(e)})},[_,s,r]),append:a.useCallback((e,t)=>{let a=O(y(e)),i=eo(r._getFieldArray(s),a);r._names.focus=W(s,i.length-1,t),d.current=eo(d.current,a.map(I)),_(i),o(i),r._updateFieldArray(s,i,eo,{argA:ed(e)})},[_,s,r]),remove:a.useCallback(e=>{let t=ey(r._getFieldArray(s),e);d.current=ey(d.current,e),_(t),o(t),Array.isArray(g(r._fields,s))||A(r._fields,s,void 0),r._updateFieldArray(s,t,ey,{argA:e})},[_,s,r]),insert:a.useCallback((e,t,a)=>{let i=O(y(t)),l=ef(r._getFieldArray(s),e,i);r._names.focus=W(s,e,a),d.current=ef(d.current,e,i.map(I)),_(l),o(l),r._updateFieldArray(s,l,ef,{argA:e,argB:ed(t)})},[_,s,r]),update:a.useCallback((e,t)=>{let a=y(t),i=eg(r._getFieldArray(s),e,a);d.current=[...i].map((t,r)=>t&&r!==e?d.current[r]:I()),_(i),o([...i]),r._updateFieldArray(s,i,eg,{argA:e,argB:a},!0,!1)},[_,s,r]),replace:a.useCallback(e=>{let t=O(y(e));d.current=t.map(I),_([...t]),o([...t]),r._updateFieldArray(s,[...t],e=>e,{},!0,!1)},[_,s,r]),fields:a.useMemo(()=>n.map((e,t)=>({...e,[i]:d.current[t]||I()})),[n,i])}}var ev=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},eb=e=>l(e)||!u(e);function eA(e,t){if(eb(e)||eb(t))return e===t;if(i(e)&&i(t))return e.getTime()===t.getTime();let r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(let s of r){let r=e[s];if(!a.includes(s))return!1;if("ref"!==s){let e=t[s];if(i(r)&&i(e)||n(r)&&n(e)||Array.isArray(r)&&Array.isArray(e)?!eA(r,e):r!==e)return!1}}return!0}var eF=e=>"select-multiple"===e.type,ex=e=>Z(e)||s(e),eV=e=>X(e)&&e.isConnected,eS=e=>{for(let t in e)if(Q(e[t]))return!0;return!1};function ew(e,t={}){let r=Array.isArray(e);if(n(e)||r)for(let r in e)Array.isArray(e[r])||n(e[r])&&!eS(e[r])?(t[r]=Array.isArray(e[r])?[]:{},ew(e[r],t[r])):l(e[r])||(t[r]=!0);return t}var ek=(e,t)=>(function e(t,r,a){let s=Array.isArray(t);if(n(t)||s)for(let s in t)Array.isArray(t[s])||n(t[s])&&!eS(t[s])?p(r)||eb(a[s])?a[s]=Array.isArray(t[s])?ew(t[s],[]):{...ew(t[s])}:e(t[s],l(r)?{}:r[s],a[s]):a[s]=!eA(t[s],r[s]);return a})(e,t,ew(t)),eD=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:a})=>p(e)?e:t?""===e?NaN:e?+e:e:r&&U(e)?new Date(e):a?a(e):e;function eC(e){let t=e.ref;return K(t)?t.files:Z(t)?ei(e.refs).value:eF(t)?[...t.selectedOptions].map(({value:e})=>e):s(t)?ea(e.refs).value:eD(p(t.value)?e.ref.value:t.value,e)}var eE=(e,t,r,a)=>{let s={};for(let r of e){let e=g(t,r);e&&A(s,r,e._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:a}},eO=e=>p(e)?e:ee(e)?e.source:n(e)?ee(e.value)?e.value.source:e.value:e;let ej="AsyncFunction";var eT=e=>!!e&&!!e.validate&&!!(Q(e.validate)&&e.validate.constructor.name===ej||n(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===ej)),eB=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function eU(e,t,r){let a=g(e,r);if(a||v(r))return{error:a,name:r};let s=r.split(".");for(;s.length;){let a=s.join("."),i=g(t,a),l=g(e,a);if(i&&!Array.isArray(i)&&r!==a)break;if(l&&l.type)return{name:a,error:l};s.pop()}return{name:r}}var eL=(e,t,r,a,s)=>!s.isOnAll&&(!r&&s.isOnTouch?!(t||e):(r?a.isOnBlur:s.isOnBlur)?!e:(r?!a.isOnChange:!s.isOnChange)||e),eM=(e,t)=>!_(g(e,t)).length&&ep(e,t);let eN={mode:x.onSubmit,reValidateMode:x.onChange,shouldFocusError:!0};function eR(e={}){let t=a.useRef(void 0),r=a.useRef(void 0),[u,d]=a.useState({isDirty:!1,isValidating:!1,isLoading:Q(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Q(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...function(e={}){let t,r={...eN,...e},a={submitCount:0,isDirty:!1,isLoading:Q(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},u={},d=(n(r.defaultValues)||n(r.values))&&y(r.defaultValues||r.values)||{},c=r.shouldUnregister?{}:y(d),v={action:!1,mount:!1,watch:!1},b={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},V=0,S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},w={values:ev(),array:ev(),state:ev()},k=H(r.mode),D=H(r.reValidateMode),E=r.criteriaMode===x.all,j=e=>t=>{clearTimeout(V),V=setTimeout(e,t)},T=async e=>{if(!r.disabled&&(S.isValid||e)){let e=r.resolver?C((await P()).errors):await I(u,!0);e!==a.isValid&&w.state.next({isValid:e})}},B=(e,t)=>{!r.disabled&&(S.isValidating||S.validatingFields)&&((e||Array.from(b.mount)).forEach(e=>{e&&(t?A(a.validatingFields,e,t):ep(a.validatingFields,e))}),w.state.next({validatingFields:a.validatingFields,isValidating:!C(a.validatingFields)}))},M=(e,t)=>{A(a.errors,e,t),w.state.next({errors:a.errors})},N=(e,t,r,a)=>{let s=g(u,e);if(s){let i=g(c,e,p(r)?g(d,e):r);p(i)||a&&a.defaultChecked||t?A(c,e,t?i:eC(s._f)):Z(e,i),v.mount&&T()}},R=(e,t,s,i,l)=>{let n=!1,o=!1,f={name:e};if(!r.disabled){let r=!!(g(u,e)&&g(u,e)._f&&g(u,e)._f.disabled);if(!s||i){S.isDirty&&(o=a.isDirty,a.isDirty=f.isDirty=W(),n=o!==f.isDirty);let s=r||eA(g(d,e),t);o=!!(!r&&g(a.dirtyFields,e)),s||r?ep(a.dirtyFields,e):A(a.dirtyFields,e,!0),f.dirtyFields=a.dirtyFields,n=n||S.dirtyFields&&!s!==o}if(s){let t=g(a.touchedFields,e);t||(A(a.touchedFields,e,s),f.touchedFields=a.touchedFields,n=n||S.touchedFields&&t!==s)}n&&l&&w.state.next(f)}return n?f:{}},q=(e,s,i,l)=>{let u=g(a.errors,e),n=S.isValid&&h(s)&&a.isValid!==s;if(r.delayError&&i?(t=j(()=>M(e,i)))(r.delayError):(clearTimeout(V),t=null,i?A(a.errors,e,i):ep(a.errors,e)),(i?!eA(u,i):u)||!C(l)||n){let t={...l,...n&&h(s)?{isValid:s}:{},errors:a.errors,name:e};a={...a,...t},w.state.next(t)}},P=async e=>{B(e,!0);let t=await r.resolver(c,r.context,eE(e||b.mount,u,r.criteriaMode,r.shouldUseNativeValidation));return B(e),t},$=async e=>{let{errors:t}=await P(e);if(e)for(let r of e){let e=g(t,r);e?A(a.errors,r,e):ep(a.errors,r)}else a.errors=t;return t},I=async(e,t,s={valid:!0})=>{for(let i in e){let l=e[i];if(l){let{_f:e,...u}=l;if(e){let u=b.array.has(e.name),n=l._f&&eT(l._f);n&&S.validatingFields&&B([i],!0);let o=await en(l,b.disabled,c,E,r.shouldUseNativeValidation&&!t,u);if(n&&S.validatingFields&&B([i]),o[e.name]&&(s.valid=!1,t))break;t||(g(o,e.name)?u?J(a.errors,o,e.name):A(a.errors,e.name,o[e.name]):ep(a.errors,e.name))}C(u)||await I(u,t,s)}}return s.valid},W=(e,t)=>!r.disabled&&(e&&t&&A(c,e,t),!eA(ei(),d)),Y=(e,t,r)=>L(e,b,{...v.mount?c:p(t)?d:U(e)?{[e]:t}:t},r,t),Z=(e,t,r={})=>{let a=g(u,e),i=t;if(a){let r=a._f;r&&(r.disabled||A(c,e,eD(t,r)),i=X(r.ref)&&l(t)?"":t,eF(r.ref)?[...r.ref.options].forEach(e=>e.selected=i.includes(e.value)):r.refs?s(r.ref)?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find(t=>t===e.value):i===e.value)):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach(e=>e.checked=e.value===i):K(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||w.values.next({name:e,values:{...c}})))}(r.shouldDirty||r.shouldTouch)&&R(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&es(e)},ee=(e,t,r)=>{for(let a in t){let s=t[a],l=`${e}.${a}`,o=g(u,l);(b.array.has(e)||n(s)||o&&!o._f)&&!i(s)?ee(l,s,r):Z(l,s,r)}},et=(e,t,r={})=>{let s=g(u,e),i=b.array.has(e),n=y(t);A(c,e,n),i?(w.array.next({name:e,values:{...c}}),(S.isDirty||S.dirtyFields)&&r.shouldDirty&&w.state.next({name:e,dirtyFields:ek(d,c),isDirty:W(e,n)})):!s||s._f||l(n)?Z(e,n,r):ee(e,n,r),G(e,b)&&w.state.next({...a}),w.values.next({name:v.mount?e:void 0,values:{...c}})},er=async e=>{v.mount=!0;let s=e.target,l=s.name,n=!0,d=g(u,l),f=e=>{n=Number.isNaN(e)||i(e)&&isNaN(e.getTime())||eA(e,g(c,l,e))};if(d){let i,m;let y=s.type?eC(d._f):o(e),_=e.type===F.BLUR||e.type===F.FOCUS_OUT,p=!eB(d._f)&&!r.resolver&&!g(a.errors,l)&&!d._f.deps||eL(_,g(a.touchedFields,l),a.isSubmitted,D,k),h=G(l,b,_);A(c,l,y),_?(d._f.onBlur&&d._f.onBlur(e),t&&t(0)):d._f.onChange&&d._f.onChange(e);let v=R(l,y,_,!1),x=!C(v)||h;if(_||w.values.next({name:l,type:e.type,values:{...c}}),p)return S.isValid&&("onBlur"===r.mode&&_?T():_||T()),x&&w.state.next({name:l,...h?{}:v});if(!_&&h&&w.state.next({...a}),r.resolver){let{errors:e}=await P([l]);if(f(y),n){let t=eU(a.errors,u,l),r=eU(e,u,t.name||l);i=r.error,l=r.name,m=C(e)}}else B([l],!0),i=(await en(d,b.disabled,c,E,r.shouldUseNativeValidation))[l],B([l]),f(y),n&&(i?m=!1:S.isValid&&(m=await I(u,!0)));n&&(d._f.deps&&es(d._f.deps),q(l,m,i,v))}},ea=(e,t)=>{if(g(a.errors,t)&&e.focus)return e.focus(),1},es=async(e,t={})=>{let s,i;let l=O(e);if(r.resolver){let t=await $(p(e)?e:l);s=C(t),i=e?!l.some(e=>g(t,e)):s}else e?((i=(await Promise.all(l.map(async e=>{let t=g(u,e);return await I(t&&t._f?{[e]:t}:t)}))).every(Boolean))||a.isValid)&&T():i=s=await I(u);return w.state.next({...!U(e)||S.isValid&&s!==a.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:a.errors}),t.shouldFocus&&!i&&z(u,ea,e?l:b.mount),i},ei=e=>{let t={...v.mount?c:d};return p(e)?t:U(e)?g(t,e):e.map(e=>g(t,e))},el=(e,t)=>({invalid:!!g((t||a).errors,e),isDirty:!!g((t||a).dirtyFields,e),error:g((t||a).errors,e),isValidating:!!g(a.validatingFields,e),isTouched:!!g((t||a).touchedFields,e)}),eu=(e,t,r)=>{let s=(g(u,e,{_f:{}})._f||{}).ref,{ref:i,message:l,type:n,...o}=g(a.errors,e)||{};A(a.errors,e,{...o,...t,ref:s}),w.state.next({name:e,errors:a.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},eo=(e,t={})=>{for(let s of e?O(e):b.mount)b.mount.delete(s),b.array.delete(s),t.keepValue||(ep(u,s),ep(c,s)),t.keepError||ep(a.errors,s),t.keepDirty||ep(a.dirtyFields,s),t.keepTouched||ep(a.touchedFields,s),t.keepIsValidating||ep(a.validatingFields,s),r.shouldUnregister||t.keepDefaultValue||ep(d,s);w.values.next({values:{...c}}),w.state.next({...a,...t.keepDirty?{isDirty:W()}:{}}),t.keepIsValid||T()},ed=({disabled:e,name:t,field:r,fields:a})=>{(h(e)&&v.mount||e||b.disabled.has(t))&&(e?b.disabled.add(t):b.disabled.delete(t),R(t,eC(r?r._f:g(a,t)._f),!1,!1,!0))},ef=(e,t={})=>{let a=g(u,e),s=h(t.disabled)||h(r.disabled);return A(u,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...t}}),b.mount.add(e),a?ed({field:a,disabled:h(t.disabled)?t.disabled:r.disabled,name:e}):N(e,!0,t.value),{...s?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:eO(t.min),max:eO(t.max),minLength:eO(t.minLength),maxLength:eO(t.maxLength),pattern:eO(t.pattern)}:{},name:e,onChange:er,onBlur:er,ref:s=>{if(s){ef(e,t),a=g(u,e);let r=p(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=ex(r),l=a._f.refs||[];(i?!l.find(e=>e===r):r!==a._f.ref)&&(A(u,e,{_f:{...a._f,...i?{refs:[...l.filter(eV),r,...Array.isArray(g(d,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),N(e,!1,void 0,r))}else(a=g(u,e,{}))._f&&(a._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&!(f(b.array,e)&&v.action)&&b.unMount.add(e)}}},ec=()=>r.shouldFocusError&&z(u,ea,b.mount),em=(e,t)=>async s=>{let i;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let l=y(c);if(b.disabled.size)for(let e of b.disabled)A(l,e,void 0);if(w.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await P();a.errors=e,l=t}else await I(u);if(ep(a.errors,"root"),C(a.errors)){w.state.next({errors:{}});try{await e(l,s)}catch(e){i=e}}else t&&await t({...a.errors},s),ec(),setTimeout(ec);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:C(a.errors)&&!i,submitCount:a.submitCount+1,errors:a.errors}),i)throw i},ey=(e,t={})=>{let s=e?y(e):d,i=y(s),l=C(e),n=l?d:i;if(t.keepDefaultValues||(d=s),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...b.mount,...Object.keys(ek(d,c))])))g(a.dirtyFields,e)?A(n,e,g(c,e)):et(e,g(n,e));else{if(m&&p(e))for(let e of b.mount){let t=g(u,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(X(e)){let t=e.closest("form");if(t){t.reset();break}}}}u={}}c=r.shouldUnregister?t.keepDefaultValues?y(d):{}:y(n),w.array.next({values:{...n}}),w.values.next({values:{...n}})}b={mount:t.keepDirtyValues?b.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},v.mount=!S.isValid||!!t.keepIsValid||!!t.keepDirtyValues,v.watch=!!r.shouldUnregister,w.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:!l&&(t.keepDirty?a.isDirty:!!(t.keepDefaultValues&&!eA(e,d))),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:l?{}:t.keepDirtyValues?t.keepDefaultValues&&c?ek(d,c):a.dirtyFields:t.keepDefaultValues&&e?ek(d,e):t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&a.isSubmitSuccessful,isSubmitting:!1})},e_=(e,t)=>ey(Q(e)?e(c):e,t);return{control:{register:ef,unregister:eo,getFieldState:el,handleSubmit:em,setError:eu,_executeSchema:P,_getWatch:Y,_getDirty:W,_updateValid:T,_removeUnmounted:()=>{for(let e of b.unMount){let t=g(u,e);t&&(t._f.refs?t._f.refs.every(e=>!eV(e)):!eV(t._f.ref))&&eo(e)}b.unMount=new Set},_updateFieldArray:(e,t=[],s,i,l=!0,n=!0)=>{if(i&&s&&!r.disabled){if(v.action=!0,n&&Array.isArray(g(u,e))){let t=s(g(u,e),i.argA,i.argB);l&&A(u,e,t)}if(n&&Array.isArray(g(a.errors,e))){let t=s(g(a.errors,e),i.argA,i.argB);l&&A(a.errors,e,t),eM(a.errors,e)}if(S.touchedFields&&n&&Array.isArray(g(a.touchedFields,e))){let t=s(g(a.touchedFields,e),i.argA,i.argB);l&&A(a.touchedFields,e,t)}S.dirtyFields&&(a.dirtyFields=ek(d,c)),w.state.next({name:e,isDirty:W(e,t),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else A(c,e,t)},_updateDisabledField:ed,_getFieldArray:e=>_(g(v.mount?c:d,e,r.shouldUnregister?g(d,e,[]):[])),_reset:ey,_resetDefaultValues:()=>Q(r.defaultValues)&&r.defaultValues().then(e=>{e_(e,r.resetOptions),w.state.next({isLoading:!1})}),_updateFormState:e=>{a={...a,...e}},_disableForm:e=>{h(e)&&(w.state.next({disabled:e}),z(u,(t,r)=>{let a=g(u,r);a&&(t.disabled=a._f.disabled||e,Array.isArray(a._f.refs)&&a._f.refs.forEach(t=>{t.disabled=a._f.disabled||e}))},0,!1))},_subjects:w,_proxyFormState:S,_setErrors:e=>{a.errors=e,w.state.next({errors:a.errors,isValid:!1})},get _fields(){return u},get _formValues(){return c},get _state(){return v},set _state(value){v=value},get _defaultValues(){return d},get _names(){return b},set _names(value){b=value},get _formState(){return a},set _formState(value){a=value},get _options(){return r},set _options(value){r={...r,...value}}},trigger:es,register:ef,handleSubmit:em,watch:(e,t)=>Q(e)?w.values.subscribe({next:r=>e(Y(void 0,t),r)}):Y(e,t,!0),setValue:et,getValues:ei,reset:e_,resetField:(e,t={})=>{g(u,e)&&(p(t.defaultValue)?et(e,y(g(d,e))):(et(e,t.defaultValue),A(d,e,y(t.defaultValue))),t.keepTouched||ep(a.touchedFields,e),t.keepDirty||(ep(a.dirtyFields,e),a.isDirty=t.defaultValue?W(e,y(g(d,e))):W()),!t.keepError&&(ep(a.errors,e),S.isValid&&T()),w.state.next({...a}))},clearErrors:e=>{e&&O(e).forEach(e=>ep(a.errors,e)),w.state.next({errors:e?a.errors:{}})},unregister:eo,setError:eu,setFocus:(e,t={})=>{let r=g(u,e),a=r&&r._f;if(a){let e=a.refs?a.refs[0]:a.ref;e.focus&&(e.focus(),t.shouldSelect&&Q(e.select)&&e.select())}},getFieldState:el}}(e),formState:u});let c=t.current.control;return c._options=e,T({subject:c._subjects.state,next:e=>{E(e,c._proxyFormState,c._updateFormState,!0)&&d({...c._formState})}}),a.useEffect(()=>c._disableForm(e.disabled),[c,e.disabled]),a.useEffect(()=>{if(c._proxyFormState.isDirty){let e=c._getDirty();e!==u.isDirty&&c._subjects.state.next({isDirty:e})}},[c,u.isDirty]),a.useEffect(()=>{e.values&&!eA(e.values,r.current)?(c._reset(e.values,c._options.resetOptions),r.current=e.values,d(e=>({...e}))):c._resetDefaultValues()},[e.values,c]),a.useEffect(()=>{e.errors&&c._setErrors(e.errors)},[e.errors,c]),a.useEffect(()=>{c._state.mount||(c._updateValid(),c._state.mount=!0),c._state.watch&&(c._state.watch=!1,c._subjects.state.next({...c._formState})),c._removeUnmounted()}),a.useEffect(()=>{e.shouldUnregister&&c._subjects.values.next({values:c._getWatch()})},[e.shouldUnregister,c]),t.current.formState=D(u,c),t.current}}}]);
@@ -1,2 +0,0 @@
1
- /*! For license information please see 359.18a264e7.js.LICENSE.txt */
2
- (self.webpackChunkTimeSeriesChart=self.webpackChunkTimeSeriesChart||[]).push([["359"],{71377:function(t,e,r){"use strict";let n;r.d(e,{ZP:()=>Q});var i=r(54538),o=r(90496),s=r(82267),a=r(46954),u=r(6595),c=r(25399),h=r(80668),f=r(9831),l=r(61714),p=r(97048),d=r(74111),m=r(96858),g=r(81925),v=r(69134),y=r(92438);function w(t,e,r,n,i){return 1===r?Math.min(t+e,i):Math.max(t-e,n)}function x(t,e){return t-e}function b(t,e){let{index:r}=t.reduce((t,r,n)=>{let i=Math.abs(e-r);return null===t||i<t.distance||i===t.distance?{distance:i,index:n}:t},null)??{};return r}function N(t,e){if(void 0!==e.current&&t.changedTouches){for(let r=0;r<t.changedTouches.length;r+=1){let n=t.changedTouches[r];if(n.identifier===e.current)return{x:n.clientX,y:n.clientY}}return!1}return{x:t.clientX,y:t.clientY}}function M({values:t,newValue:e,index:r}){let n=t.slice();return n[r]=e,n.sort(x)}function _({sliderRef:t,activeIndex:e,setActive:r}){let n=(0,h.Z)(t.current);t.current?.contains(n.activeElement)&&Number(n?.activeElement?.getAttribute("data-index"))===e||t.current?.querySelector(`[type="range"][data-index="${e}"]`).focus(),r&&r(e)}function E(t,e){return"number"==typeof t&&"number"==typeof e?t===e:"object"==typeof t&&"object"==typeof e&&function(t,e,r=(t,e)=>t===e){return t.length===e.length&&t.every((t,n)=>r(t,e[n]))}(t,e)}let S={horizontal:{offset:t=>({left:`${t}%`}),leap:t=>({width:`${t}%`})},"horizontal-reverse":{offset:t=>({right:`${t}%`}),leap:t=>({width:`${t}%`})},vertical:{offset:t=>({bottom:`${t}%`}),leap:t=>({height:`${t}%`})}},A=t=>t;function k(){return void 0===n&&(n="undefined"==typeof CSS||"function"!=typeof CSS.supports||CSS.supports("touch-action","none")),n}var z=r(88653),O=r(12709),C=r(82319),T=r(51751),F=r(4005);let I=t=>!t||!(0,z.Z)(t);var j=r(51640),P=r(90433),R=r(44124),D=r(6749);function Z(t){return(0,D.ZP)("MuiSlider",t)}let L=(0,R.Z)("MuiSlider",["root","active","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","disabled","dragging","focusVisible","mark","markActive","marked","markLabel","markLabelActive","rail","sizeSmall","thumb","thumbColorPrimary","thumbColorSecondary","thumbColorError","thumbColorSuccess","thumbColorInfo","thumbColorWarning","track","trackInverted","trackFalse","thumbSizeSmall","valueLabel","valueLabelOpen","valueLabelCircle","valueLabelLabel","vertical"]);var B=r(24246);let q=t=>{let{open:e}=t;return{offset:(0,o.Z)(e&&L.valueLabelOpen),circle:L.valueLabelCircle,label:L.valueLabelLabel}};function U(t){return t}let $=(0,O.ZP)("span",{name:"MuiSlider",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.root,e[`color${(0,j.Z)(r.color)}`],"medium"!==r.size&&e[`size${(0,j.Z)(r.size)}`],r.marked&&e.marked,"vertical"===r.orientation&&e.vertical,"inverted"===r.track&&e.trackInverted,!1===r.track&&e.trackFalse]}})((0,C.Z)(({theme:t})=>({borderRadius:12,boxSizing:"content-box",display:"inline-block",position:"relative",cursor:"pointer",touchAction:"none",WebkitTapHighlightColor:"transparent","@media print":{colorAdjust:"exact"},[`&.${L.disabled}`]:{pointerEvents:"none",cursor:"default",color:(t.vars||t).palette.grey[400]},[`&.${L.dragging}`]:{[`& .${L.thumb}, & .${L.track}`]:{transition:"none"}},variants:[...Object.entries(t.palette).filter((0,P.Z)()).map(([e])=>({props:{color:e},style:{color:(t.vars||t).palette[e].main}})),{props:{orientation:"horizontal"},style:{height:4,width:"100%",padding:"13px 0","@media (pointer: coarse)":{padding:"20px 0"}}},{props:{orientation:"horizontal",size:"small"},style:{height:2}},{props:{orientation:"horizontal",marked:!0},style:{marginBottom:20}},{props:{orientation:"vertical"},style:{height:"100%",width:4,padding:"0 13px","@media (pointer: coarse)":{padding:"0 20px"}}},{props:{orientation:"vertical",size:"small"},style:{width:2}},{props:{orientation:"vertical",marked:!0},style:{marginRight:44}}]}))),W=(0,O.ZP)("span",{name:"MuiSlider",slot:"Rail",overridesResolver:(t,e)=>e.rail})({display:"block",position:"absolute",borderRadius:"inherit",backgroundColor:"currentColor",opacity:.38,variants:[{props:{orientation:"horizontal"},style:{width:"100%",height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{height:"100%",width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:"inverted"},style:{opacity:1}}]}),V=(0,O.ZP)("span",{name:"MuiSlider",slot:"Track",overridesResolver:(t,e)=>e.track})((0,C.Z)(({theme:t})=>({display:"block",position:"absolute",borderRadius:"inherit",border:"1px solid currentColor",backgroundColor:"currentColor",transition:t.transitions.create(["left","width","bottom","height"],{duration:t.transitions.duration.shortest}),variants:[{props:{size:"small"},style:{border:"none"}},{props:{orientation:"horizontal"},style:{height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:!1},style:{display:"none"}},...Object.entries(t.palette).filter((0,P.Z)()).map(([e])=>({props:{color:e,track:"inverted"},style:{...t.vars?{backgroundColor:t.vars.palette.Slider[`${e}Track`],borderColor:t.vars.palette.Slider[`${e}Track`]}:{backgroundColor:(0,a.$n)(t.palette[e].main,.62),borderColor:(0,a.$n)(t.palette[e].main,.62),...t.applyStyles("dark",{backgroundColor:(0,a._j)(t.palette[e].main,.5)}),...t.applyStyles("dark",{borderColor:(0,a._j)(t.palette[e].main,.5)})}}}))]}))),H=(0,O.ZP)("span",{name:"MuiSlider",slot:"Thumb",overridesResolver:(t,e)=>{let{ownerState:r}=t;return[e.thumb,e[`thumbColor${(0,j.Z)(r.color)}`],"medium"!==r.size&&e[`thumbSize${(0,j.Z)(r.size)}`]]}})((0,C.Z)(({theme:t})=>({position:"absolute",width:20,height:20,boxSizing:"border-box",borderRadius:"50%",outline:0,backgroundColor:"currentColor",display:"flex",alignItems:"center",justifyContent:"center",transition:t.transitions.create(["box-shadow","left","bottom"],{duration:t.transitions.duration.shortest}),"&::before":{position:"absolute",content:'""',borderRadius:"inherit",width:"100%",height:"100%",boxShadow:(t.vars||t).shadows[2]},"&::after":{position:"absolute",content:'""',borderRadius:"50%",width:42,height:42,top:"50%",left:"50%",transform:"translate(-50%, -50%)"},[`&.${L.disabled}`]:{"&:hover":{boxShadow:"none"}},variants:[{props:{size:"small"},style:{width:12,height:12,"&::before":{boxShadow:"none"}}},{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-50%, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 50%)"}},...Object.entries(t.palette).filter((0,P.Z)()).map(([e])=>({props:{color:e},style:{[`&:hover, &.${L.focusVisible}`]:{...t.vars?{boxShadow:`0px 0px 0px 8px rgba(${t.vars.palette[e].mainChannel} / 0.16)`}:{boxShadow:`0px 0px 0px 8px ${(0,a.Fq)(t.palette[e].main,.16)}`},"@media (hover: none)":{boxShadow:"none"}},[`&.${L.active}`]:{...t.vars?{boxShadow:`0px 0px 0px 14px rgba(${t.vars.palette[e].mainChannel} / 0.16)`}:{boxShadow:`0px 0px 0px 14px ${(0,a.Fq)(t.palette[e].main,.16)}`}}}}))]}))),Y=(0,O.ZP)(function(t){let{children:e,className:r,value:n}=t,s=q(t);return e?i.cloneElement(e,{className:(0,o.Z)(e.props.className)},(0,B.jsxs)(i.Fragment,{children:[e.props.children,(0,B.jsx)("span",{className:(0,o.Z)(s.offset,r),"aria-hidden":!0,children:(0,B.jsx)("span",{className:s.circle,children:(0,B.jsx)("span",{className:s.label,children:n})})})]})):null},{name:"MuiSlider",slot:"ValueLabel",overridesResolver:(t,e)=>e.valueLabel})((0,C.Z)(({theme:t})=>({zIndex:1,whiteSpace:"nowrap",...t.typography.body2,fontWeight:500,transition:t.transitions.create(["transform"],{duration:t.transitions.duration.shortest}),position:"absolute",backgroundColor:(t.vars||t).palette.grey[600],borderRadius:2,color:(t.vars||t).palette.common.white,display:"flex",alignItems:"center",justifyContent:"center",padding:"0.25rem 0.75rem",variants:[{props:{orientation:"horizontal"},style:{transform:"translateY(-100%) scale(0)",top:"-10px",transformOrigin:"bottom center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, 50%) rotate(45deg)",backgroundColor:"inherit",bottom:0,left:"50%"},[`&.${L.valueLabelOpen}`]:{transform:"translateY(-100%) scale(1)"}}},{props:{orientation:"vertical"},style:{transform:"translateY(-50%) scale(0)",right:"30px",top:"50%",transformOrigin:"right center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, -50%) rotate(45deg)",backgroundColor:"inherit",right:-8,top:"50%"},[`&.${L.valueLabelOpen}`]:{transform:"translateY(-50%) scale(1)"}}},{props:{size:"small"},style:{fontSize:t.typography.pxToRem(12),padding:"0.25rem 0.5rem"}},{props:{orientation:"vertical",size:"small"},style:{right:"20px"}}]}))),J=(0,O.ZP)("span",{name:"MuiSlider",slot:"Mark",shouldForwardProp:t=>(0,F.Z)(t)&&"markActive"!==t,overridesResolver:(t,e)=>{let{markActive:r}=t;return[e.mark,r&&e.markActive]}})((0,C.Z)(({theme:t})=>({position:"absolute",width:2,height:2,borderRadius:1,backgroundColor:"currentColor",variants:[{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-1px, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 1px)"}},{props:{markActive:!0},style:{backgroundColor:(t.vars||t).palette.background.paper,opacity:.8}}]}))),X=(0,O.ZP)("span",{name:"MuiSlider",slot:"MarkLabel",shouldForwardProp:t=>(0,F.Z)(t)&&"markLabelActive"!==t,overridesResolver:(t,e)=>e.markLabel})((0,C.Z)(({theme:t})=>({...t.typography.body2,color:(t.vars||t).palette.text.secondary,position:"absolute",whiteSpace:"nowrap",variants:[{props:{orientation:"horizontal"},style:{top:30,transform:"translateX(-50%)","@media (pointer: coarse)":{top:40}}},{props:{orientation:"vertical"},style:{left:36,transform:"translateY(50%)","@media (pointer: coarse)":{left:44}}},{props:{markLabelActive:!0},style:{color:(t.vars||t).palette.text.primary}}]}))),K=t=>{let{disabled:e,dragging:r,marked:n,orientation:i,track:o,classes:a,color:u,size:c}=t,h={root:["root",e&&"disabled",r&&"dragging",n&&"marked","vertical"===i&&"vertical","inverted"===o&&"trackInverted",!1===o&&"trackFalse",u&&`color${(0,j.Z)(u)}`,c&&`size${(0,j.Z)(c)}`],rail:["rail"],track:["track"],mark:["mark"],markActive:["markActive"],markLabel:["markLabel"],markLabelActive:["markLabelActive"],valueLabel:["valueLabel"],thumb:["thumb",e&&"disabled",c&&`thumbSize${(0,j.Z)(c)}`,u&&`thumbColor${(0,j.Z)(u)}`],active:["active"],disabled:["disabled"],focusVisible:["focusVisible"]};return(0,s.Z)(h,Z,a)},G=({children:t})=>t,Q=i.forwardRef(function(t,e){let r=(0,T.i)({props:t,name:"MuiSlider"}),n=(0,u.V)(),{"aria-label":s,"aria-valuetext":a,"aria-labelledby":O,component:C="span",components:F={},componentsProps:j={},color:P="primary",classes:R,className:D,disableSwap:Z=!1,disabled:L=!1,getAriaLabel:q,getAriaValueText:Q,marks:tt=!1,max:te=100,min:tr=0,name:tn,onChange:ti,onChangeCommitted:to,orientation:ts="horizontal",shiftStep:ta=10,size:tu="medium",step:tc=1,scale:th=U,slotProps:tf,slots:tl,tabIndex:tp,track:td="normal",value:tm,valueLabelDisplay:tg="off",valueLabelFormat:tv=U,...ty}=r,tw={...r,isRtl:n,max:te,min:tr,classes:R,disabled:L,disableSwap:Z,orientation:ts,marks:tt,color:P,size:tu,step:tc,shiftStep:ta,scale:th,track:td,valueLabelDisplay:tg,valueLabelFormat:tv},{axisProps:tx,getRootProps:tb,getHiddenInputProps:tN,getThumbProps:tM,open:t_,active:tE,axis:tS,focusedThumbIndex:tA,range:tk,dragging:tz,marks:tO,values:tC,trackOffset:tT,trackLeap:tF,getThumbStyle:tI}=function(t){let e;let{"aria-labelledby":r,defaultValue:n,disabled:o=!1,disableSwap:s=!1,isRtl:a=!1,marks:u=!1,max:c=100,min:z=0,name:O,onChange:C,onChangeCommitted:T,orientation:F="horizontal",rootRef:I,scale:j=A,step:P=1,shiftStep:R=10,tabIndex:D,value:Z}=t,L=i.useRef(void 0),[B,q]=i.useState(-1),[U,$]=i.useState(-1),[W,V]=i.useState(!1),H=i.useRef(0),Y=i.useRef(null),[J,X]=(0,f.Z)({controlled:Z,default:n??z,name:"Slider"}),K=C&&((t,e,r)=>{let n=t.nativeEvent||t,i=new n.constructor(n.type,n);Object.defineProperty(i,"target",{writable:!0,value:{value:e,name:O}}),Y.current=e,C(i,e,r)}),G=Array.isArray(J),Q=G?J.slice().sort(x):[J];Q=Q.map(t=>null==t?z:(0,l.Z)(t,z,c));let tt=!0===u&&null!==P?[...Array(Math.floor((c-z)/P)+1)].map((t,e)=>({value:z+P*e})):u||[],te=tt.map(t=>t.value),[tr,tn]=i.useState(-1),ti=i.useRef(null),to=(0,p.Z)(I,ti),ts=t=>e=>{let r=Number(e.currentTarget.getAttribute("data-index"));(0,d.Z)(e.target)&&tn(r),$(r),t?.onFocus?.(e)},ta=t=>e=>{(0,d.Z)(e.target)||tn(-1),$(-1),t?.onBlur?.(e)},tu=(t,e)=>{let r=Number(t.currentTarget.getAttribute("data-index")),n=Q[r],i=te.indexOf(n),o=e;if(tt&&null==P){let t=te[te.length-1];o=o>=t?t:o<=te[0]?te[0]:o<n?te[i-1]:te[i+1]}if(o=(0,l.Z)(o,z,c),G){s&&(o=(0,l.Z)(o,Q[r-1]||-1/0,Q[r+1]||1/0));let t=o;o=M({values:Q,newValue:o,index:r});let e=r;s||(e=o.indexOf(t)),_({sliderRef:ti,activeIndex:e})}X(o),tn(r),K&&!E(o,J)&&K(t,o,r),T&&T(t,Y.current??o)},tc=t=>e=>{if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"].includes(e.key)){e.preventDefault();let t=Q[Number(e.currentTarget.getAttribute("data-index"))],r=null;if(null!=P){let n=e.shiftKey?R:P;switch(e.key){case"ArrowUp":r=w(t,n,1,z,c);break;case"ArrowRight":r=w(t,n,a?-1:1,z,c);break;case"ArrowDown":r=w(t,n,-1,z,c);break;case"ArrowLeft":r=w(t,n,a?1:-1,z,c);break;case"PageUp":r=w(t,R,1,z,c);break;case"PageDown":r=w(t,R,-1,z,c);break;case"Home":r=z;break;case"End":r=c}}else if(tt){let n=te[te.length-1],i=te.indexOf(t);[a?"ArrowRight":"ArrowLeft","ArrowDown","PageDown","Home"].includes(e.key)?r=0===i?te[0]:te[i-1]:[a?"ArrowLeft":"ArrowRight","ArrowUp","PageUp","End"].includes(e.key)&&(r=i===te.length-1?n:te[i+1])}null!=r&&tu(e,r)}t?.onKeyDown?.(e)};(0,m.Z)(()=>{o&&ti.current.contains(document.activeElement)&&document.activeElement?.blur()},[o]),o&&-1!==B&&q(-1),o&&-1!==tr&&tn(-1);let th=t=>e=>{t.onChange?.(e),tu(e,e.target.valueAsNumber)},tf=i.useRef(void 0),tl=F;a&&"horizontal"===F&&(tl+="-reverse");let tp=({finger:t,move:e=!1})=>{let r,n;let{current:i}=ti,{width:o,height:a,bottom:u,left:h}=i.getBoundingClientRect();if(r=tl.startsWith("vertical")?(u-t.y)/a:(t.x-h)/o,tl.includes("-reverse")&&(r=1-r),n=(c-z)*r+z,P)n=Number((Math.round((n-z)/P)*P+z).toFixed(function(t){if(1>Math.abs(t)){let e=t.toExponential().split("e-"),r=e[0].split(".")[1];return(r?r.length:0)+parseInt(e[1],10)}let e=t.toString().split(".")[1];return e?e.length:0}(P)));else{let t=b(te,n);n=te[t]}n=(0,l.Z)(n,z,c);let f=0;if(G){f=e?tf.current:b(Q,n),s&&(n=(0,l.Z)(n,Q[f-1]||-1/0,Q[f+1]||1/0));let t=n;n=M({values:Q,newValue:n,index:f}),s&&e||(f=n.indexOf(t),tf.current=f)}return{newValue:n,activeIndex:f}},td=(0,g.Z)(t=>{let e=N(t,L);if(!e)return;if(H.current+=1,"mousemove"===t.type&&0===t.buttons){tm(t);return}let{newValue:r,activeIndex:n}=tp({finger:e,move:!0});_({sliderRef:ti,activeIndex:n,setActive:q}),X(r),!W&&H.current>2&&V(!0),K&&!E(r,J)&&K(t,r,n)}),tm=(0,g.Z)(t=>{let e=N(t,L);if(V(!1),!e)return;let{newValue:r}=tp({finger:e,move:!0});q(-1),"touchend"===t.type&&$(-1),T&&T(t,Y.current??r),L.current=void 0,tv()}),tg=(0,g.Z)(t=>{if(o)return;k()||t.preventDefault();let e=t.changedTouches[0];null!=e&&(L.current=e.identifier);let r=N(t,L);if(!1!==r){let{newValue:e,activeIndex:n}=tp({finger:r});_({sliderRef:ti,activeIndex:n,setActive:q}),X(e),K&&!E(e,J)&&K(t,e,n)}H.current=0;let n=(0,h.Z)(ti.current);n.addEventListener("touchmove",td,{passive:!0}),n.addEventListener("touchend",tm,{passive:!0})}),tv=i.useCallback(()=>{let t=(0,h.Z)(ti.current);t.removeEventListener("mousemove",td),t.removeEventListener("mouseup",tm),t.removeEventListener("touchmove",td),t.removeEventListener("touchend",tm)},[tm,td]);i.useEffect(()=>{let{current:t}=ti;return t.addEventListener("touchstart",tg,{passive:k()}),()=>{t.removeEventListener("touchstart",tg),tv()}},[tv,tg]),i.useEffect(()=>{o&&tv()},[o,tv]);let ty=t=>e=>{if(t.onMouseDown?.(e),o||e.defaultPrevented||0!==e.button)return;e.preventDefault();let r=N(e,L);if(!1!==r){let{newValue:t,activeIndex:n}=tp({finger:r});_({sliderRef:ti,activeIndex:n,setActive:q}),X(t),K&&!E(t,J)&&K(e,t,n)}H.current=0;let n=(0,h.Z)(ti.current);n.addEventListener("mousemove",td,{passive:!0}),n.addEventListener("mouseup",tm)},tw=((G?Q[0]:z)-z)*100/(c-z),tx=(Q[Q.length-1]-z)*100/(c-z)-tw,tb=t=>e=>{t.onMouseOver?.(e),$(Number(e.currentTarget.getAttribute("data-index")))},tN=t=>e=>{t.onMouseLeave?.(e),$(-1)};return"vertical"===F&&(e=a?"vertical-rl":"vertical-lr"),{active:B,axis:tl,axisProps:S,dragging:W,focusedThumbIndex:tr,getHiddenInputProps:(n={})=>{let i=(0,y.Z)(n),s={onChange:th(i||{}),onFocus:ts(i||{}),onBlur:ta(i||{}),onKeyDown:tc(i||{})},u={...i,...s};return{tabIndex:D,"aria-labelledby":r,"aria-orientation":F,"aria-valuemax":j(c),"aria-valuemin":j(z),name:O,type:"range",min:t.min,max:t.max,step:null===t.step&&t.marks?"any":t.step??void 0,disabled:o,...n,...u,style:{...v.Z,direction:a?"rtl":"ltr",width:"100%",height:"100%",writingMode:e}}},getRootProps:(t={})=>{let e=(0,y.Z)(t),r={onMouseDown:ty(e||{})},n={...e,...r};return{...t,ref:to,...n}},getThumbProps:(t={})=>{let e=(0,y.Z)(t),r={onMouseOver:tb(e||{}),onMouseLeave:tN(e||{})};return{...t,...e,...r}},marks:tt,open:U,range:G,rootRef:to,trackLeap:tx,trackOffset:tw,values:Q,getThumbStyle:t=>({pointerEvents:-1!==B&&B!==t?"none":void 0})}}({...tw,rootRef:e});tw.marked=tO.length>0&&tO.some(t=>t.label),tw.dragging=tz,tw.focusedThumbIndex=tA;let tj=K(tw),tP=tl?.root??F.Root??$,tR=tl?.rail??F.Rail??W,tD=tl?.track??F.Track??V,tZ=tl?.thumb??F.Thumb??H,tL=tl?.valueLabel??F.ValueLabel??Y,tB=tl?.mark??F.Mark??J,tq=tl?.markLabel??F.MarkLabel??X,tU=tl?.input??F.Input??"input",t$=tf?.root??j.root,tW=tf?.rail??j.rail,tV=tf?.track??j.track,tH=tf?.thumb??j.thumb,tY=tf?.valueLabel??j.valueLabel,tJ=tf?.mark??j.mark,tX=tf?.markLabel??j.markLabel,tK=tf?.input??j.input,tG=(0,c.Z)({elementType:tP,getSlotProps:tb,externalSlotProps:t$,externalForwardedProps:ty,additionalProps:{...I(tP)&&{as:C}},ownerState:{...tw,...t$?.ownerState},className:[tj.root,D]}),tQ=(0,c.Z)({elementType:tR,externalSlotProps:tW,ownerState:tw,className:tj.rail}),t0=(0,c.Z)({elementType:tD,externalSlotProps:tV,additionalProps:{style:{...tx[tS].offset(tT),...tx[tS].leap(tF)}},ownerState:{...tw,...tV?.ownerState},className:tj.track}),t1=(0,c.Z)({elementType:tZ,getSlotProps:tM,externalSlotProps:tH,ownerState:{...tw,...tH?.ownerState},className:tj.thumb}),t2=(0,c.Z)({elementType:tL,externalSlotProps:tY,ownerState:{...tw,...tY?.ownerState},className:tj.valueLabel}),t5=(0,c.Z)({elementType:tB,externalSlotProps:tJ,ownerState:tw,className:tj.mark}),t4=(0,c.Z)({elementType:tq,externalSlotProps:tX,ownerState:tw,className:tj.markLabel}),t3=(0,c.Z)({elementType:tU,getSlotProps:tN,externalSlotProps:tK,ownerState:tw});return(0,B.jsxs)(tP,{...tG,children:[(0,B.jsx)(tR,{...tQ}),(0,B.jsx)(tD,{...t0}),tO.filter(t=>t.value>=tr&&t.value<=te).map((t,e)=>{let r;let n=(t.value-tr)*100/(te-tr),s=tx[tS].offset(n);return r=!1===td?tC.includes(t.value):"normal"===td&&(tk?t.value>=tC[0]&&t.value<=tC[tC.length-1]:t.value<=tC[0])||"inverted"===td&&(tk?t.value<=tC[0]||t.value>=tC[tC.length-1]:t.value>=tC[0]),(0,B.jsxs)(i.Fragment,{children:[(0,B.jsx)(tB,{"data-index":e,...t5,...!(0,z.Z)(tB)&&{markActive:r},style:{...s,...t5.style},className:(0,o.Z)(t5.className,r&&tj.markActive)}),null!=t.label?(0,B.jsx)(tq,{"aria-hidden":!0,"data-index":e,...t4,...!(0,z.Z)(tq)&&{markLabelActive:r},style:{...s,...t4.style},className:(0,o.Z)(tj.markLabel,t4.className,r&&tj.markLabelActive),children:t.label}):null]},e)}),tC.map((t,e)=>{let r=(t-tr)*100/(te-tr),n=tx[tS].offset(r),i="off"===tg?G:tL;return(0,B.jsx)(i,{...!(0,z.Z)(i)&&{valueLabelFormat:tv,valueLabelDisplay:tg,value:"function"==typeof tv?tv(th(t),e):tv,index:e,open:t_===e||tE===e||"on"===tg,disabled:L},...t2,children:(0,B.jsx)(tZ,{"data-index":e,...t1,className:(0,o.Z)(tj.thumb,t1.className,tE===e&&tj.active,tA===e&&tj.focusVisible),style:{...n,...tI(e),...t1.style},children:(0,B.jsx)(tU,{"data-index":e,"aria-label":q?q(e):s,"aria-valuenow":th(t),"aria-labelledby":O,"aria-valuetext":Q?Q(th(t),e):a,value:tC[e],...t3})})},e)})]})})},14046:function(t,e,r){"use strict";r.d(e,{Dc:()=>i,gO:()=>n});let n={first:{label:"First",description:"First value"},last:{label:"Last",description:"Last value"},"first-number":{label:"First *",description:"First numeric value"},"last-number":{label:"Last *",description:"Last numeric value"},mean:{label:"Avg",description:"Average value excluding nulls"},sum:{label:"Sum",description:"The sum of all values"},min:{label:"Min",description:"Minimum value"},max:{label:"Max",description:"Maximum value"}};function i(t,e){let r=e.reduce((t,e)=>(t[e]=void 0,t),{}),n=0,i=0;return t.forEach((e,o)=>{let s=e[1];0===o&&"first"in r&&(r.first=s),o===t.length-1&&"last"in r&&(r.last=s),"number"==typeof s&&(n+=1,i+=s,"first-number"in r&&void 0===r["first-number"]&&(r["first-number"]=s),"last-number"in r&&(r["last-number"]=s),"min"in r&&("number"!=typeof r.min?r.min=s:r.min=Math.min(r.min,s)),"max"in r&&("number"!=typeof r.max?r.max=s:r.max=Math.max(r.max,s)))}),n>0&&"sum"in r&&(r.sum=i),n>0&&"mean"in r&&(r.mean=i/n),r}},69481:function(t,e,r){"use strict";r.d(e,{m6:()=>rI,C5:()=>rj});var n=r(70252);function i(t){return"number"==typeof t}function o(t){return!!t&&"object"==typeof t&&"function"==typeof t.constructor&&(!0===t.isBigNumber&&"object"==typeof t.constructor.prototype&&!0===t.constructor.prototype.isBigNumber||"function"==typeof t.constructor.isDecimal&&!0===t.constructor.isDecimal(t))}function s(t){return t&&"object"==typeof t&&!0===Object.getPrototypeOf(t).isComplex||!1}function a(t){return t&&"object"==typeof t&&!0===Object.getPrototypeOf(t).isFraction||!1}function u(t){return t&&!0===t.constructor.prototype.isUnit||!1}function c(t){return"string"==typeof t}var h=Array.isArray;function f(t){return t&&!0===t.constructor.prototype.isMatrix||!1}function l(t){return Array.isArray(t)||f(t)}function p(t){return t&&t.isDenseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function d(t){return t&&t.isSparseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function m(t){return t&&!0===t.constructor.prototype.isRange||!1}function g(t){return t&&!0===t.constructor.prototype.isIndex||!1}function v(t){return"boolean"==typeof t}function y(t){return t&&!0===t.constructor.prototype.isResultSet||!1}function w(t){return t&&!0===t.constructor.prototype.isHelp||!1}function x(t){return"function"==typeof t}function b(t){return t instanceof Date}function N(t){return t instanceof RegExp}function M(t){return!!(t&&"object"==typeof t&&t.constructor===Object&&!s(t)&&!a(t))}function _(t){return null===t}function E(t){return void 0===t}function S(t){return t&&!0===t.isAccessorNode&&!0===t.constructor.prototype.isNode||!1}function A(t){return t&&!0===t.isArrayNode&&!0===t.constructor.prototype.isNode||!1}function k(t){return t&&!0===t.isAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function z(t){return t&&!0===t.isBlockNode&&!0===t.constructor.prototype.isNode||!1}function O(t){return t&&!0===t.isConditionalNode&&!0===t.constructor.prototype.isNode||!1}function C(t){return t&&!0===t.isConstantNode&&!0===t.constructor.prototype.isNode||!1}function T(t){return t&&!0===t.isFunctionAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function F(t){return t&&!0===t.isFunctionNode&&!0===t.constructor.prototype.isNode||!1}function I(t){return t&&!0===t.isIndexNode&&!0===t.constructor.prototype.isNode||!1}function j(t){return t&&!0===t.isNode&&!0===t.constructor.prototype.isNode||!1}function P(t){return t&&!0===t.isObjectNode&&!0===t.constructor.prototype.isNode||!1}function R(t){return t&&!0===t.isOperatorNode&&!0===t.constructor.prototype.isNode||!1}function D(t){return t&&!0===t.isParenthesisNode&&!0===t.constructor.prototype.isNode||!1}function Z(t){return t&&!0===t.isRangeNode&&!0===t.constructor.prototype.isNode||!1}function L(t){return t&&!0===t.isSymbolNode&&!0===t.constructor.prototype.isNode||!1}function B(t){return t&&!0===t.constructor.prototype.isChain||!1}function q(t){var e=typeof t;return"object"===e?null===t?"null":Array.isArray(t)?"Array":t instanceof Date?"Date":t instanceof RegExp?"RegExp":o(t)?"BigNumber":s(t)?"Complex":a(t)?"Fraction":f(t)?"Matrix":u(t)?"Unit":g(t)?"Index":m(t)?"Range":y(t)?"ResultSet":j(t)?t.type:B(t)?"Chain":w(t)?"Help":"Object":"function"===e?"Function":e}function U(t){var e=typeof t;if("number"===e||"string"===e||"boolean"===e||null==t)return t;if("function"==typeof t.clone)return t.clone();if(Array.isArray(t))return t.map(function(t){return U(t)});if(t instanceof Date)return new Date(t.valueOf());if(o(t))return t;if(t instanceof RegExp)throw TypeError("Cannot clone "+t);return $(t,U)}function $(t,e){var r={};for(var n in t)H(t,n)&&(r[n]=e(t[n]));return r}function W(t,e){var r,n,i;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;n++)if(!W(t[n],e[n]))return!1;return!0}if("function"==typeof t)return t===e;if(!(t instanceof Object))return t===e;if(Array.isArray(e)||!(e instanceof Object))return!1;for(r in t)if(!(r in e)||!W(t[r],e[r]))return!1;for(r in e)if(!(r in t))return!1;return!0}function V(t,e,r){var n,i=!0;Object.defineProperty(t,e,{get:function(){return i&&(n=r(),i=!1),n},set:function(t){n=t,i=!1},configurable:!0,enumerable:!0})}function H(t,e){return t&&Object.hasOwnProperty.call(t,e)}function Y(t){return Object.keys(t).map(e=>t[e])}var J=r(8317);function X(t,e,r,n){function i(n){var i=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],o=t[i];void 0!==o&&(r[i]=o)}return r}(n,e.map(G));return function(t,e,r){if(!e.filter(t=>{var e;return!((e=t)&&"?"===e[0])}).every(t=>void 0!==r[t])){var n=e.filter(t=>void 0===r[t]);throw Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(n.map(t=>'"'.concat(t,'"')).join(", "),"."))}}(t,e,n),r(i)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function K(t){return"function"==typeof t&&"string"==typeof t.fn&&Array.isArray(t.dependencies)}function G(t){return t&&"?"===t[0]?t.slice(1):t}function Q(t){return"boolean"==typeof t||!!isFinite(t)&&t===Math.round(t)}function tt(t,e,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!Q(r))throw Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!Q(t))throw Error("Value must be an integer");t<0&&(t+=2**r),n="i".concat(r)}var i="";return t<0&&(t=-t,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[e]).concat(t.toString(e)).concat(n)}function te(t,e){if("function"==typeof e)return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var r,n,o="auto";if(e&&(e.notation&&(o=e.notation),i(e)?r=e:i(e.precision)&&(r=e.precision),e.wordSize&&"number"!=typeof(n=e.wordSize)))throw Error('Option "wordSize" must be a number');switch(o){case"fixed":return function(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=tr(t),n="number"==typeof e?ti(r,r.exponent+1+e):r,i=n.coefficients,o=n.exponent+1,s=o+(e||0);return i.length<s&&(i=i.concat(to(s-i.length))),o<0&&(i=to(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}(t,r);case"exponential":return tn(t,r);case"engineering":return function(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=ti(tr(t),e),n=r.exponent,o=r.coefficients,s=n%3==0?n:n<0?n-3-n%3:n-n%3;if(i(e))for(;e>o.length||n-s+1>o.length;)o.push(0);else for(var a=Math.abs(n-s)-(o.length-1),u=0;u<a;u++)o.push(0);for(var c=Math.abs(n-s),h=1;c>0;)h++,c--;var f=o.slice(h).join(""),l=i(e)&&f.length||f.match(/[1-9]/)?"."+f:"",p=o.slice(0,h).join("")+l+"e"+(n>=0?"+":"")+s.toString();return r.sign+p}(t,r);case"bin":return tt(t,2,n);case"oct":return tt(t,8,n);case"hex":return tt(t,16,n);case"auto":return(function(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,o=tr(t),s=e?ti(o,e):o;if(s.exponent<n||s.exponent>=i)return tn(t,e);var a=s.coefficients,u=s.exponent;a.length<e&&(a=a.concat(to(e-a.length))),a=a.concat(to(u-a.length+1+(a.length<e?e-a.length:0))),a=to(-u).concat(a);var c=u>0?u:0;return c<a.length-1&&a.splice(c+1,0,"."),s.sign+a.join("")})(t,r,e&&e).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e});default:throw Error('Unknown notation "'+o+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function tr(t){var e=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(t){return i-=t.length,""}).replace(/0*$/,"").split("").map(function(t){return parseInt(t)});return 0===s.length&&(s.push(0),i++),{sign:r,coefficients:s,exponent:i}}function tn(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=tr(t),n=e?ti(r,e):r,i=n.coefficients,o=n.exponent;i.length<e&&(i=i.concat(to(e-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function ti(t,e){for(var r={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=r.coefficients;e<=0;)n.unshift(0),r.exponent++,e++;if(n.length>e&&n.splice(e,n.length-e)[0]>=5){var i=e-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}return r}function to(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}var ts=Number.EPSILON||2220446049250313e-31;function ta(t,e,r){if(null==r)return t===e;if(t===e)return!0;if(isNaN(t)||isNaN(e))return!1;if(isFinite(t)&&isFinite(e)){var n=Math.abs(t-e);return n<ts||n<=Math.max(Math.abs(t),Math.abs(e))*r}return!1}function tu(t,e,r){var n=new t.constructor(2),i="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!Q(r))throw Error("size must be an integer");if(t.greaterThan(n.pow(r-1).sub(1))||t.lessThan(n.pow(r-1).mul(-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t.isInteger())throw Error("Value must be an integer");t.lessThan(0)&&(t=t.add(n.pow(r))),i="i".concat(r)}switch(e){case 2:return"".concat(t.toBinary()).concat(i);case 8:return"".concat(t.toOctal()).concat(i);case 16:return"".concat(t.toHexadecimal()).concat(i);default:throw Error("Base ".concat(e," not supported "))}}function tc(t,e){return void 0!==e?t.toExponential(e-1):t.toExponential()}function th(t,e){var r=function(t,e){var r;if("number"==typeof t)return te(t,e);if(o(t))return function(t,e){if("function"==typeof e)return e(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var r="auto";if(void 0!==e&&(e.notation&&(r=e.notation),"number"==typeof e?f=e:e.precision&&(f=e.precision),e.wordSize&&"number"!=typeof(l=e.wordSize)))throw Error('Option "wordSize" must be a number');switch(r){case"fixed":return n=t,i=f,n.toFixed(i);case"exponential":return tc(t,f);case"engineering":return o=t,s=f,u=(a=o.e)%3==0?a:a<0?a-3-a%3:a-a%3,-1!==(h=(c=o.mul(Math.pow(10,-u))).toPrecision(s)).indexOf("e")&&(h=c.toString()),h+"e"+(a>=0?"+":"")+u.toString();case"bin":return tu(t,2,l);case"oct":return tu(t,8,l);case"hex":return tu(t,16,l);case"auto":var n,i,o,s,a,u,c,h,f,l,p,d=e&&void 0!==e.lowerExp?e.lowerExp:-3,m=e&&void 0!==e.upperExp?e.upperExp:5;if(t.isZero())return"0";var g=t.toSignificantDigits(f),v=g.e;return(v>=d&&v<m?g.toFixed():tc(t,f)).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(t,e);return(r=t)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d?e&&"decimal"===e.fraction?t.toString():t.s*t.n+"/"+t.d:Array.isArray(t)?function t(e,r){if(!Array.isArray(e))return th(e,r);for(var n="[",i=e.length,o=0;o<i;o++)0!==o&&(n+=", "),n+=t(e[o],r);return n+"]"}(t,e):c(t)?'"'+t+'"':"function"==typeof t?t.syntax?String(t.syntax):"function":t&&"object"==typeof t?"function"==typeof t.format?t.format(e):t&&t.toString(e)!==({}).toString()?t.toString(e):"{"+Object.keys(t).map(r=>'"'+r+'": '+th(t[r],e)).join(", ")+"}":String(t)}(t,e);return e&&"object"==typeof e&&"truncate"in e&&r.length>e.truncate?r.substring(0,e.truncate-3)+"...":r}function tf(t,e,r){if(!(this instanceof tf))throw SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=Error().stack}function tl(t,e,r){if(!(this instanceof tl))throw SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function tp(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function td(t,e){if(0===e.length){if(Array.isArray(t))throw new tf(t.length,0)}else!function t(e,r,n){var i,o=e.length;if(o!==r[n])throw new tf(o,r[n]);if(n<r.length-1){var s=n+1;for(i=0;i<o;i++){if(!Array.isArray(e[i]))throw new tf(r.length-1,r.length,"<");t(e[i],r,s)}}else for(i=0;i<o;i++)if(Array.isArray(e[i]))throw new tf(r.length+1,r.length,">")}(t,e,0)}function tm(t,e){if(!i(t)||!Q(t))throw TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof e&&t>=e)throw new tl(t,e)}function tg(t,e,r){if(!Array.isArray(t)||!Array.isArray(e))throw TypeError("Array expected");if(0===e.length)throw Error("Resizing to scalar is not supported");return e.forEach(function(t){if(!i(t)||!Q(t)||t<0)throw TypeError("Invalid size, must contain positive integers (size: "+th(e)+")")}),function t(e,r,n,i){var o,s,a=e.length,u=r[n],c=Math.min(a,u);if(e.length=u,n<r.length-1){var h=n+1;for(o=0;o<c;o++)Array.isArray(s=e[o])||(s=[s],e[o]=s),t(s,r,h,i);for(o=c;o<u;o++)s=[],e[o]=s,t(s,r,h,i)}else{for(o=0;o<c;o++)for(;Array.isArray(e[o]);)e[o]=e[o][0];for(o=c;o<u;o++)e[o]=i}}(t,e,0,void 0!==r?r:0),t}function tv(t,e){var r=ty(t),n=t.slice(),i=t.indexOf(-1);if(t.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0){if(e%r==0)n[i]=-e/r;else throw Error("Could not replace wildcard, since "+e+" is no multiple of "+-r)}return n}function ty(t){return t.reduce((t,e)=>t*e,1)}function tw(t,e,r,n){var i=n||tp(t);if(r)for(var o=0;o<r;o++)t=[t],i.unshift(1);for(t=function t(e,r,n){var i,o;if(Array.isArray(e)){var s=n+1;for(i=0,o=e.length;i<o;i++)e[i]=t(e[i],r,s)}else for(var a=n;a<r;a++)e=[e];return e}(t,e,0);i.length<e;)i.push(1);return t}function tx(t,e){for(var r,n=0,i=0;i<t.length;i++){var o=t[i],s=Array.isArray(o);if(0===i&&s&&(n=o.length),s&&o.length!==n)return;var a=s?tx(o,e):e(o);if(void 0===r)r=a;else if(r!==a)return"mixed"}return r}function tb(t,e){return -1!==t.indexOf(e)}function tN(t,e,r,n){if(!(this instanceof tN))throw SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=e,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+t+" ("+e+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}tf.prototype=RangeError(),tf.prototype.constructor=RangeError,tf.prototype.name="DimensionError",tf.prototype.isDimensionError=!0,tl.prototype=RangeError(),tl.prototype.constructor=RangeError,tl.prototype.name="IndexError",tl.prototype.isIndexError=!0,tN.prototype=Error(),tN.prototype.constructor=Error,tN.prototype.name="ArgumentsError",tN.prototype.isArgumentsError=!0;var tM={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},t_=["Matrix","Array"],tE=["number","BigNumber","Fraction"];function tS(t,e,r){var n;void 0!==t[e]&&(n=t[e],-1===r.indexOf(n))&&console.warn('Warning: Unknown value "'+t[e]+'" for configuration option "'+e+'". Available options: '+r.map(t=>JSON.stringify(t)).join(", ")+".")}var tA,tk,tz="0123456789abcdef",tO="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",tC="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",tT={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},tF=!0,tI="[DecimalError] ",tj=tI+"Invalid argument: ",tP=tI+"Precision limit exceeded",tR=tI+"crypto unavailable",tD="[object Decimal]",tZ=Math.floor,tL=Math.pow,tB=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,tq=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,tU=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,t$=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,tW=tO.length-1,tV=tC.length-1,tH={toStringTag:tD};function tY(t){var e,r,n,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;e<i;e++)(r=7-(n=t[e]+"").length)&&(o+=t3(r)),o+=n;(r=7-(n=(s=t[e])+"").length)&&(o+=t3(r))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function tJ(t,e,r){if(t!==~~t||t<e||t>r)throw Error(tj+t)}function tX(t,e,r,n){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=7,i=0):(i=Math.ceil((e+1)/7),e%=7),o=tL(10,7-e),a=t[i]%o|0,null==n?e<3?(0==e?a=a/100|0:1==e&&(a=a/10|0),s=r<4&&99999==a||r>3&&49999==a||5e4==a||0==a):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(t[i+1]/o/100|0)==tL(10,e-2)-1||(a==o/2||0==a)&&(t[i+1]/o/100|0)==0:e<4?(0==e?a=a/1e3|0:1==e?a=a/100|0:2==e&&(a=a/10|0),s=(n||r<4)&&9999==a||!n&&r>3&&4999==a):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==tL(10,e-3)-1,s}function tK(t,e,r){for(var n,i,o=[0],s=0,a=t.length;s<a;){for(i=o.length;i--;)o[i]*=e;for(o[0]+=tz.indexOf(t.charAt(s++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}tH.absoluteValue=tH.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),tQ(t)},tH.ceil=function(){return tQ(new this.constructor(this),this.e+1,2)},tH.clampedTo=tH.clamp=function(t,e){var r=this.constructor;if(t=new r(t),e=new r(e),!t.s||!e.s)return new r(NaN);if(t.gt(e))throw Error(tj+e);return 0>this.cmp(t)?t:this.cmp(e)>0?e:new r(this)},tH.comparedTo=tH.cmp=function(t){var e,r,n,i,o=this.d,s=(t=new this.constructor(t)).d,a=this.s,u=t.s;if(!o||!s)return a&&u?a!==u?a:o===s?0:!o^a<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?a:s[0]?-u:0;if(a!==u)return a;if(this.e!==t.e)return this.e>t.e^a<0?1:-1;for(e=0,r=(n=o.length)<(i=s.length)?n:i;e<r;++e)if(o[e]!==s[e])return o[e]>s[e]^a<0?1:-1;return n===i?0:n>i^a<0?1:-1},tH.cosine=tH.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n,i;if(e.isZero())return e;(n=e.d.length)<32?i=(1/ei(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=en(t,1,e.times(i),new t(1));for(var o=r;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=r,e}(n,eo(n,r)),n.precision=t,n.rounding=e,tQ(2==tk||3==tk?r.neg():r,t,e,!0)):new n(1):new n(NaN)},tH.cubeRoot=tH.cbrt=function(){var t,e,r,n,i,o,s,a,u,c,h=this.constructor;if(!this.isFinite()||this.isZero())return new h(this);for(tF=!1,(o=this.s*tL(this.s*this,1/3))&&Math.abs(o)!=1/0?n=new h(o.toString()):(r=tY(this.d),(o=((t=this.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=tL(r,1/3),t=tZ((t+1)/3)-(t%3==(t<0?-1:2)),(n=new h(r=o==1/0?"5e"+t:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+t)).s=this.s),s=(t=h.precision)+3;;)if(n=tG((c=(u=(a=n).times(a).times(a)).plus(this)).plus(this).times(a),c.plus(u),s+2,1),tY(a.d).slice(0,s)===(r=tY(n.d)).slice(0,s)){if("9999"!=(r=r.slice(s-3,s+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(tQ(n,t+1,1),e=!n.times(n).times(n).eq(this));break}if(!i&&(tQ(a,t+1,0),a.times(a).times(a).eq(this))){n=a;break}s+=4,i=1}return tF=!0,tQ(n,t,h.rounding,e)},tH.decimalPlaces=tH.dp=function(){var t,e=this.d,r=NaN;if(e){if(r=((t=e.length-1)-tZ(this.e/7))*7,t=e[t])for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r},tH.dividedBy=tH.div=function(t){return tG(this,new this.constructor(t))},tH.dividedToIntegerBy=tH.divToInt=function(t){var e=this.constructor;return tQ(tG(this,new e(t),0,1,1),e.precision,e.rounding)},tH.equals=tH.eq=function(t){return 0===this.cmp(t)},tH.floor=function(){return tQ(new this.constructor(this),this.e+1,3)},tH.greaterThan=tH.gt=function(t){return this.cmp(t)>0},tH.greaterThanOrEqualTo=tH.gte=function(t){var e=this.cmp(t);return 1==e||0===e},tH.hyperbolicCosine=tH.cosh=function(){var t,e,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?e=(1/ei(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),o=en(s,1,o.times(e),new s(1),!0);for(var u,c=t,h=new s(8);c--;)u=o.times(o),o=a.minus(u.times(h.minus(u.times(h))));return tQ(o,s.precision=r,s.rounding=n,!0)},tH.hyperbolicSine=tH.sinh=function(){var t,e,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,r=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=en(o,2,i,i,!0);else{t=(t=1.4*Math.sqrt(n))>16?16:0|t,i=en(o,2,i=i.times(1/ei(5,t)),i,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=r,tQ(i,e,r,!0)},tH.hyperbolicTangent=tH.tanh=function(){var t,e,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,tG(this.sinh(),this.cosh(),r.precision=t,r.rounding=e)):new r(this.s)},tH.inverseCosine=tH.acos=function(){var t=this,e=t.constructor,r=t.abs().cmp(1),n=e.precision,i=e.rounding;return -1!==r?0===r?t.isNeg()?t5(e,n,i):new e(0):new e(NaN):t.isZero()?t5(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,t.times(2))},tH.inverseHyperbolicCosine=tH.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,tF=!1,r=r.times(r).minus(1).sqrt().plus(r),tF=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)},tH.inverseHyperbolicSine=tH.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,tF=!1,r=r.times(r).plus(1).sqrt().plus(r),tF=!0,n.precision=t,n.rounding=e,r.ln())},tH.inverseHyperbolicTangent=tH.atanh=function(){var t,e,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,Math.max(n=i.sd(),t)<-(2*i.e)-1)?tQ(new o(i),t,e,!0):(o.precision=r=n-i.e,i=tG(i.plus(1),new o(1).minus(i),r+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5)):new o(NaN)},tH.inverseSine=tH.asin=function(){var t,e,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==e)?0===e?((t=t5(o,r+4,n).times(.5)).s=i.s,t):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2))},tH.inverseTangent=tH.atan=function(){var t,e,r,n,i,o,s,a,u,c=this,h=c.constructor,f=h.precision,l=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);if(c.abs().eq(1)&&f+4<=tV)return(s=t5(h,f+4,l).times(.25)).s=c.s,s}else{if(!c.s)return new h(NaN);if(f+4<=tV)return(s=t5(h,f+4,l).times(.5)).s=c.s,s}for(h.precision=a=f+10,h.rounding=1,t=r=Math.min(28,a/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(tF=!1,e=Math.ceil(a/7),n=1,u=c.times(c),s=new h(c),i=c;-1!==t;)if(i=i.times(u),o=s.minus(i.div(n+=2)),i=i.times(u),void 0!==(s=o.plus(i.div(n+=2))).d[e])for(t=e;s.d[t]===o.d[t]&&t--;);return r&&(s=s.times(2<<r-1)),tF=!0,tQ(s,h.precision=f,h.rounding=l,!0)},tH.isFinite=function(){return!!this.d},tH.isInteger=tH.isInt=function(){return!!this.d&&tZ(this.e/7)>this.d.length-2},tH.isNaN=function(){return!this.s},tH.isNegative=tH.isNeg=function(){return this.s<0},tH.isPositive=tH.isPos=function(){return this.s>0},tH.isZero=function(){return!!this.d&&0===this.d[0]},tH.lessThan=tH.lt=function(t){return 0>this.cmp(t)},tH.lessThanOrEqualTo=tH.lte=function(t){return 1>this.cmp(t)},tH.logarithm=tH.log=function(t){var e,r,n,i,o,s,a,u,c=this.constructor,h=c.precision,f=c.rounding;if(null==t)t=new c(10),e=!0;else{if(r=(t=new c(t)).d,t.s<0||!r||!r[0]||t.eq(1))return new c(NaN);e=t.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new c(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(e){if(r.length>1)o=!0;else{for(i=r[0];i%10==0;)i/=10;o=1!==i}}if(tF=!1,tX((u=tG(s=et(this,a=h+5),e?t2(c,a+10):et(t,a),a,1)).d,i=h,f))do if(a+=10,u=tG(s=et(this,a),e?t2(c,a+10):et(t,a),a,1),!o){+tY(u.d).slice(i+1,i+15)+1==1e14&&(u=tQ(u,h+1,0));break}while(tX(u.d,i+=10,f));return tF=!0,tQ(u,h,f)},tH.minus=tH.sub=function(t){var e,r,n,i,o,s,a,u,c,h,f,l,p=this.constructor;if(t=new p(t),!this.d||!t.d)return this.s&&t.s?this.d?t.s=-t.s:t=new p(t.d||this.s!==t.s?this:NaN):t=new p(NaN),t;if(this.s!=t.s)return t.s=-t.s,this.plus(t);if(c=this.d,l=t.d,a=p.precision,u=p.rounding,!c[0]||!l[0]){if(l[0])t.s=-t.s;else{if(!c[0])return new p(3===u?-0:0);t=new p(this)}return tF?tQ(t,a,u):t}if(r=tZ(t.e/7),h=tZ(this.e/7),c=c.slice(),o=h-r){for((f=o<0)?(e=c,o=-o,s=l.length):(e=l,r=h,s=c.length),o>(n=Math.max(Math.ceil(a/7),s)+2)&&(o=n,e.length=1),e.reverse(),n=o;n--;)e.push(0);e.reverse()}else{for((f=(n=c.length)<(s=l.length))&&(s=n),n=0;n<s;n++)if(c[n]!=l[n]){f=c[n]<l[n];break}o=0}for(f&&(e=c,c=l,l=e,t.s=-t.s),s=c.length,n=l.length-s;n>0;--n)c[s++]=0;for(n=l.length;n>o;){if(c[--n]<l[n]){for(i=n;i&&0===c[--i];)c[i]=1e7-1;--c[i],c[n]+=1e7}c[n]-=l[n]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(t.d=c,t.e=t1(c,r),tF?tQ(t,a,u):t):new p(3===u?-0:0)},tH.modulo=tH.mod=function(t){var e,r=this.constructor;return(t=new r(t),this.d&&t.s&&(!t.d||t.d[0]))?t.d&&(!this.d||this.d[0])?(tF=!1,9==r.modulo?(e=tG(this,t.abs(),0,3,1),e.s*=t.s):e=tG(this,t,0,r.modulo,1),e=e.times(t),tF=!0,this.minus(e)):tQ(new r(this),r.precision,r.rounding):new r(NaN)},tH.naturalExponential=tH.exp=function(){return t9(this)},tH.naturalLogarithm=tH.ln=function(){return et(this)},tH.negated=tH.neg=function(){var t=new this.constructor(this);return t.s=-t.s,tQ(t)},tH.plus=tH.add=function(t){var e,r,n,i,o,s,a,u,c,h,f=this.constructor;if(t=new f(t),!this.d||!t.d)return this.s&&t.s?this.d||(t=new f(t.d||this.s===t.s?this:NaN)):t=new f(NaN),t;if(this.s!=t.s)return t.s=-t.s,this.minus(t);if(c=this.d,h=t.d,a=f.precision,u=f.rounding,!c[0]||!h[0])return h[0]||(t=new f(this)),tF?tQ(t,a,u):t;if(o=tZ(this.e/7),n=tZ(t.e/7),c=c.slice(),i=o-n){for(i<0?(r=c,i=-i,s=h.length):(r=h,n=o,s=c.length),i>(s=(o=Math.ceil(a/7))>s?o+1:s+1)&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((s=c.length)-(i=h.length)<0&&(i=s,r=h,h=c,c=r),e=0;i;)e=(c[--i]=c[i]+h[i]+e)/1e7|0,c[i]%=1e7;for(e&&(c.unshift(e),++n),s=c.length;0==c[--s];)c.pop();return t.d=c,t.e=t1(c,n),tF?tQ(t,a,u):t},tH.precision=tH.sd=function(t){var e;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(tj+t);return this.d?(e=t4(this.d),t&&this.e+1>e&&(e=this.e+1)):e=NaN,e},tH.round=function(){var t=this.constructor;return tQ(new t(this),this.e+1,t.rounding)},tH.sine=tH.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:en(t,2,e,e);r=(r=1.4*Math.sqrt(n))>16?16:0|r,e=en(t,2,e=e.times(1/ei(5,r)),e);for(var i,o=new t(5),s=new t(16),a=new t(20);r--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}(n,eo(n,r)),n.precision=t,n.rounding=e,tQ(tk>2?r.neg():r,t,e,!0)):new n(NaN)},tH.squareRoot=tH.sqrt=function(){var t,e,r,n,i,o,s=this.d,a=this.e,u=this.s,c=this.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?this:1/0);for(tF=!1,0==(u=Math.sqrt(+this))||u==1/0?(((e=tY(s)).length+a)%2==0&&(e+="0"),u=Math.sqrt(e),a=tZ((a+1)/2)-(a<0||a%2),n=new c(e=u==1/0?"5e"+a:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+a)):n=new c(u.toString()),r=(a=c.precision)+3;;)if(n=(o=n).plus(tG(this,o,r+2,1)).times(.5),tY(o.d).slice(0,r)===(e=tY(n.d)).slice(0,r)){if("9999"!=(e=e.slice(r-3,r+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(tQ(n,a+1,1),t=!n.times(n).eq(this));break}if(!i&&(tQ(o,a+1,0),o.times(o).eq(this))){n=o;break}r+=4,i=1}return tF=!0,tQ(n,a,c.rounding,t)},tH.tangent=tH.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,(r=r.sin()).s=1,r=tG(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,tQ(2==tk||4==tk?r.neg():r,t,e,!0)):new n(NaN)},tH.times=tH.mul=function(t){var e,r,n,i,o,s,a,u,c,h=this.constructor,f=this.d,l=(t=new h(t)).d;if(t.s*=this.s,!f||!f[0]||!l||!l[0])return new h(t.s&&(!f||f[0]||l)&&(!l||l[0]||f)?f&&l?0*t.s:t.s/0:NaN);for(r=tZ(this.e/7)+tZ(t.e/7),(u=f.length)<(c=l.length)&&(o=f,f=l,l=o,s=u,u=c,c=s),o=[],n=s=u+c;n--;)o.push(0);for(n=c;--n>=0;){for(e=0,i=u+n;i>n;)a=o[i]+l[n]*f[i-n-1]+e,o[i--]=a%1e7|0,e=a/1e7|0;o[i]=(o[i]+e)%1e7|0}for(;!o[--s];)o.pop();return e?++r:o.shift(),t.d=o,t.e=t1(o,r),tF?tQ(t,h.precision,h.rounding):t},tH.toBinary=function(t,e){return es(this,2,t,e)},tH.toDecimalPlaces=tH.toDP=function(t,e){var r=this,n=r.constructor;return(r=new n(r),void 0===t)?r:(tJ(t,0,1e9),void 0===e?e=n.rounding:tJ(e,0,8),tQ(r,t+r.e+1,e))},tH.toExponential=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=t0(n,!0):(tJ(t,0,1e9),void 0===e?e=i.rounding:tJ(e,0,8),r=t0(n=tQ(new i(n),t+1,e),!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r},tH.toFixed=function(t,e){var r,n,i=this.constructor;return void 0===t?r=t0(this):(tJ(t,0,1e9),void 0===e?e=i.rounding:tJ(e,0,8),r=t0(n=tQ(new i(this),t+this.e+1,e),!1,t+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},tH.toFraction=function(t){var e,r,n,i,o,s,a,u,c,h,f,l,p=this.d,d=this.constructor;if(!p)return new d(this);if(c=r=new d(1),n=u=new d(0),s=(o=(e=new d(n)).e=t4(p)-this.e-1)%7,e.d[0]=tL(10,s<0?7+s:s),null==t)t=o>0?e:c;else{if(!(a=new d(t)).isInt()||a.lt(c))throw Error(tj+a);t=a.gt(e)?o>0?e:c:a}for(tF=!1,a=new d(tY(p)),h=d.precision,d.precision=o=14*p.length;f=tG(a,e,0,1,1),1!=(i=r.plus(f.times(n))).cmp(t);)r=n,n=i,i=c,c=u.plus(f.times(i)),u=i,i=e,e=a.minus(f.times(i)),a=i;return i=tG(t.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=this.s,l=1>tG(c,n,o,1).minus(this).abs().cmp(tG(u,r,o,1).minus(this).abs())?[c,n]:[u,r],d.precision=h,tF=!0,l},tH.toHexadecimal=tH.toHex=function(t,e){return es(this,16,t,e)},tH.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),null==t){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),void 0===e?e=n.rounding:tJ(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(tF=!1,r=tG(r,t,0,e,1).times(t),tF=!0,tQ(r)):(t.s=r.s,r=t),r},tH.toNumber=function(){return+this},tH.toOctal=function(t,e){return es(this,8,t,e)},tH.toPower=tH.pow=function(t){var e,r,n,i,o,s,a=this,u=a.constructor,c=+(t=new u(t));if(!a.d||!t.d||!a.d[0]||!t.d[0])return new u(tL(+a,c));if((a=new u(a)).eq(1))return a;if(n=u.precision,o=u.rounding,t.eq(1))return tQ(a,n,o);if((e=tZ(t.e/7))>=t.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=t7(u,a,r,n),t.s<0?new u(1).div(i):tQ(i,n,o);if((s=a.s)<0){if(e<t.d.length-1)return new u(NaN);if((1&t.d[e])==0&&(s=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=s,a}return(e=0!=(r=tL(+a,c))&&isFinite(r)?new u(r+"").e:tZ(c*(Math.log("0."+tY(a.d))/Math.LN10+a.e+1)))>u.maxE+1||e<u.minE-1?new u(e>0?s/0:0):(tF=!1,u.rounding=a.s=1,r=Math.min(12,(e+"").length),(i=t9(t.times(et(a,n+r)),n)).d&&tX((i=tQ(i,n+5,1)).d,n,o)&&(e=n+10,+tY((i=tQ(t9(t.times(et(a,e+r)),e),e+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=tQ(i,n+1,0))),i.s=s,tF=!0,u.rounding=o,tQ(i,n,o))},tH.toPrecision=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=t0(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(tJ(t,1,1e9),void 0===e?e=i.rounding:tJ(e,0,8),r=t0(n=tQ(new i(n),t,e),t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r},tH.toSignificantDigits=tH.toSD=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(tJ(t,1,1e9),void 0===e?e=r.rounding:tJ(e,0,8)),tQ(new r(this),t,e)},tH.toString=function(){var t=this.constructor,e=t0(this,this.e<=t.toExpNeg||this.e>=t.toExpPos);return this.isNeg()&&!this.isZero()?"-"+e:e},tH.truncated=tH.trunc=function(){return tQ(new this.constructor(this),this.e+1,1)},tH.valueOf=tH.toJSON=function(){var t=this.constructor,e=t0(this,this.e<=t.toExpNeg||this.e>=t.toExpPos);return this.isNeg()?"-"+e:e};var tG=function(){function t(t,e,r){var n,i=0,o=t.length;for(t=t.slice();o--;)n=t[o]*e+i,t[o]=n%r|0,i=n/r|0;return i&&t.unshift(i),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=+(t[r]<e[r]),t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;)t.shift()}return function(n,i,o,s,a,u){var c,h,f,l,p,d,m,g,v,y,w,x,b,N,M,_,E,S,A,k,z=n.constructor,O=n.s==i.s?1:-1,C=n.d,T=i.d;if(!C||!C[0]||!T||!T[0])return new z(n.s&&i.s&&(C?!T||C[0]!=T[0]:T)?C&&0==C[0]||!T?0*O:O/0:NaN);for(u?(p=1,h=n.e-i.e):(u=1e7,p=7,h=tZ(n.e/p)-tZ(i.e/p)),A=T.length,E=C.length,y=(v=new z(O)).d=[],f=0;T[f]==(C[f]||0);f++);if(T[f]>(C[f]||0)&&h--,null==o?(N=o=z.precision,s=z.rounding):N=a?o+(n.e-i.e)+1:o,N<0)y.push(1),d=!0;else{if(N=N/p+2|0,f=0,1==A){for(l=0,T=T[0],N++;(f<E||l)&&N--;f++)M=l*u+(C[f]||0),y[f]=M/T|0,l=M%T|0;d=l||f<E}else{for((l=u/(T[0]+1)|0)>1&&(T=t(T,l,u),C=t(C,l,u),A=T.length,E=C.length),_=A,x=(w=C.slice(0,A)).length;x<A;)w[x++]=0;(k=T.slice()).unshift(0),S=T[0],T[1]>=u/2&&++S;do l=0,(c=e(T,w,A,x))<0?(b=w[0],A!=x&&(b=b*u+(w[1]||0)),(l=b/S|0)>1?(l>=u&&(l=u-1),g=(m=t(T,l,u)).length,x=w.length,1==(c=e(m,w,g,x))&&(l--,r(m,A<g?k:T,g,u))):(0==l&&(c=l=1),m=T.slice()),(g=m.length)<x&&m.unshift(0),r(w,m,x,u),-1==c&&(x=w.length,(c=e(T,w,A,x))<1&&(l++,r(w,A<x?k:T,x,u))),x=w.length):0===c&&(l++,w=[0]),y[f++]=l,c&&w[0]?w[x++]=C[_]||0:(w=[C[_]],x=1);while((_++<E||void 0!==w[0])&&N--);d=void 0!==w[0]}y[0]||y.shift()}if(1==p)v.e=h,tA=d;else{for(f=1,l=y[0];l>=10;l/=10)f++;v.e=f+h*p-1,tQ(v,a?o+v.e+1:o,s,d)}return v}}();function tQ(t,e,r,n){var i,o,s,a,u,c,h,f,l,p=t.constructor;t:if(null!=e){if(!(f=t.d))return t;for(i=1,a=f[0];a>=10;a/=10)i++;if((o=e-i)<0)o+=7,s=e,u=(h=f[l=0])/tL(10,i-s-1)%10|0;else if((l=Math.ceil((o+1)/7))>=(a=f.length)){if(n){for(;a++<=l;)f.push(0);h=u=0,i=1,o%=7,s=o-7+1}else break t}else{for(i=1,h=a=f[l];a>=10;a/=10)i++;o%=7,u=(s=o-7+i)<0?0:h/tL(10,i-s-1)%10|0}if(n=n||e<0||void 0!==f[l+1]||(s<0?h:h%tL(10,i-s-1)),c=r<4?(u||n)&&(0==r||r==(t.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(o>0?s>0?h/tL(10,i-s):0:f[l-1])%10&1||r==(t.s<0?8:7)),e<1||!f[0])return f.length=0,c?(e-=t.e+1,f[0]=tL(10,(7-e%7)%7),t.e=-e||0):f[0]=t.e=0,t;if(0==o?(f.length=l,a=1,l--):(f.length=l+1,a=tL(10,7-o),f[l]=s>0?(h/tL(10,i-s)%tL(10,s)|0)*a:0),c)for(;;){if(0==l){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,1e7==f[0]&&(f[0]=1));break}if(f[l]+=a,1e7!=f[l])break;f[l--]=0,a=1}for(o=f.length;0===f[--o];)f.pop()}return tF&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function t0(t,e,r){if(!t.isFinite())return ee(t);var n,i=t.e,o=tY(t.d),s=o.length;return e?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+t3(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+t3(-i-1)+o,r&&(n=r-s)>0&&(o+=t3(n))):i>=s?(o+=t3(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+t3(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(o+="."),o+=t3(n))),o}function t1(t,e){var r=t[0];for(e*=7;r>=10;r/=10)e++;return e}function t2(t,e,r){if(e>tW)throw tF=!0,r&&(t.precision=r),Error(tP);return tQ(new t(tO),e,1,!0)}function t5(t,e,r){if(e>tV)throw Error(tP);return tQ(new t(tC),e,r,!0)}function t4(t){var e=t.length-1,r=7*e+1;if(e=t[e]){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function t3(t){for(var e="";t--;)e+="0";return e}function t7(t,e,r,n){var i,o=new t(1),s=Math.ceil(n/7+4);for(tF=!1;;){if(r%2&&ea((o=o.times(e)).d,s)&&(i=!0),0===(r=tZ(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}ea((e=e.times(e)).d,s)}return tF=!0,o}function t8(t){return 1&t.d[t.d.length-1]}function t6(t,e,r){for(var n,i,o=new t(e[0]),s=0;++s<e.length;){if(!(i=new t(e[s])).s){o=i;break}((n=o.cmp(i))===r||0===n&&o.s===r)&&(o=i)}return o}function t9(t,e){var r,n,i,o,s,a,u,c=0,h=0,f=0,l=t.constructor,p=l.rounding,d=l.precision;if(!t.d||!t.d[0]||t.e>17)return new l(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:0/0);for(null==e?(tF=!1,u=d):u=e,a=new l(.03125);t.e>-2;)t=t.times(a),f+=5;for(u+=n=Math.log(tL(2,f))/Math.LN10*2+5|0,r=o=s=new l(1),l.precision=u;;){if(o=tQ(o.times(t),u,1),r=r.times(++h),tY((a=s.plus(tG(o,r,u,1))).d).slice(0,u)===tY(s.d).slice(0,u)){for(i=f;i--;)s=tQ(s.times(s),u,1);if(null!=e)return l.precision=d,s;if(!(c<3&&tX(s.d,u-n,p,c)))return tQ(s,l.precision=d,p,tF=!0);l.precision=u+=10,r=o=a=new l(1),h=0,c++}s=a}}function et(t,e){var r,n,i,o,s,a,u,c,h,f,l,p=1,d=t,m=d.d,g=d.constructor,v=g.rounding,y=g.precision;if(d.s<0||!m||!m[0]||!d.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=d.s?NaN:m?0:d);if(null==e?(tF=!1,h=y):h=e,g.precision=h+=10,n=(r=tY(m)).charAt(0),!(15e14>Math.abs(o=d.e)))return c=t2(g,h+2,y).times(o+""),d=et(new g(n+"."+r.slice(1)),h-10).plus(c),g.precision=y,null==e?tQ(d,y,v,tF=!0):d;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=tY((d=d.times(t)).d)).charAt(0),p++;for(o=d.e,n>1?(d=new g("0."+r),o++):d=new g(n+"."+r.slice(1)),f=d,u=s=d=tG(d.minus(1),d.plus(1),h,1),l=tQ(d.times(d),h,1),i=3;;){if(s=tQ(s.times(l),h,1),tY((c=u.plus(tG(s,new g(i),h,1))).d).slice(0,h)===tY(u.d).slice(0,h)){if(u=u.times(2),0!==o&&(u=u.plus(t2(g,h+2,y).times(o+""))),u=tG(u,new g(p),h,1),null!=e)return g.precision=y,u;if(!tX(u.d,h-10,v,a))return tQ(u,g.precision=y,v,tF=!0);g.precision=h+=10,c=s=d=tG(f.minus(1),f.plus(1),h,1),l=tQ(d.times(d),h,1),i=a=1}u=c,i+=2}}function ee(t){return String(t.s*t.s/0)}function er(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);n++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(n,i)){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=7;n<i;)t.d.push(+e.slice(n,n+=7));n=7-(e=e.slice(n)).length}else n-=i;for(;n--;)e+="0";t.d.push(+e),tF&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function en(t,e,r,n,i){var o,s,a,u,c=t.precision,h=Math.ceil(c/7);for(tF=!1,u=r.times(r),a=new t(n);;){if(s=tG(a.times(u),new t(e++*e++),c,1),a=i?n.plus(s):n.minus(s),n=tG(s.times(u),new t(e++*e++),c,1),void 0!==(s=a.plus(n)).d[h]){for(o=h;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=n,n=s,s=o}return tF=!0,s.d.length=h+1,s}function ei(t,e){for(var r=t;--e;)r*=t;return r}function eo(t,e){var r,n=e.s<0,i=t5(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return tk=n?4:1,e;if((r=e.divToInt(i)).isZero())tk=n?3:2;else{if((e=e.minus(r.times(i))).lte(o))return tk=t8(r)?n?2:3:n?4:1,e;tk=t8(r)?n?1:4:n?3:2}return e.minus(i).abs()}function es(t,e,r,n){var i,o,s,a,u,c,h,f,l,p=t.constructor,d=void 0!==r;if(d?(tJ(r,1,1e9),void 0===n?n=p.rounding:tJ(n,0,8)):(r=p.precision,n=p.rounding),t.isFinite()){for(s=(h=t0(t)).indexOf("."),d?(i=2,16==e?r=4*r-3:8==e&&(r=3*r-2)):i=e,s>=0&&(h=h.replace(".",""),(l=new p(1)).e=h.length-s,l.d=tK(t0(l),10,i),l.e=l.d.length),o=u=(f=tK(h,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(s<0?o--:((t=new p(t)).d=f,t.e=o,f=(t=tG(t,l,r,n,0,i)).d,o=t.e,c=tA),s=f[r],a=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==s||c)&&(0===n||n===(t.s<0?3:2)):s>a||s===a&&(4===n||c||6===n&&1&f[r-1]||n===(t.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++o,f.unshift(1));for(u=f.length;!f[u-1];--u);for(s=0,h="";s<u;s++)h+=tz.charAt(f[s]);if(d){if(u>1){if(16==e||8==e){for(s=16==e?4:3,--u;u%s;u++)h+="0";for(u=(f=tK(h,i,e)).length;!f[u-1];--u);for(s=1,h="1.";s<u;s++)h+=tz.charAt(f[s])}else h=h.charAt(0)+"."+h.slice(1)}h=h+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)h="0"+h;h="0."+h}else if(++o>u)for(o-=u;o--;)h+="0";else o<u&&(h=h.slice(0,o)+"."+h.slice(o))}else h=d?"0p+0":"0";h=(16==e?"0x":2==e?"0b":8==e?"0o":"")+h}else h=ee(t);return t.s<0?"-"+h:h}function ea(t,e){if(t.length>e)return t.length=e,!0}function eu(t){return new this(t).abs()}function ec(t){return new this(t).acos()}function eh(t){return new this(t).acosh()}function ef(t,e){return new this(t).plus(e)}function el(t){return new this(t).asin()}function ep(t){return new this(t).asinh()}function ed(t){return new this(t).atan()}function em(t){return new this(t).atanh()}function eg(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,o=n+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(r=e.s<0?t5(this,n,i):new this(0)).s=t.s:!t.d||e.isZero()?(r=t5(this,o,1).times(.5)).s=t.s:e.s<0?(this.precision=o,this.rounding=1,r=this.atan(tG(t,e,o,1)),e=t5(this,o,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(tG(t,e,o,1)):(r=t5(this,o,1).times(e.s>0?.25:.75)).s=t.s:r=new this(NaN),r}function ev(t){return new this(t).cbrt()}function ey(t){return tQ(t=new this(t),t.e+1,2)}function ew(t,e,r){return new this(t).clamp(e,r)}function ex(t){if(!t||"object"!=typeof t)throw Error(tI+"Object expected");var e,r,n,i=!0===t.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(r=o[e],i&&(this[r]=tT[r]),void 0!==(n=t[r])){if(tZ(n)===n&&n>=o[e+1]&&n<=o[e+2])this[r]=n;else throw Error(tj+r+": "+n)}if(r="crypto",i&&(this[r]=tT[r]),void 0!==(n=t[r])){if(!0===n||!1===n||0===n||1===n){if(n){if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(tR)}else this[r]=!1}else throw Error(tj+r+": "+n)}return this}function eb(t){return new this(t).cos()}function eN(t){return new this(t).cosh()}function eM(t,e){return new this(t).div(e)}function e_(t){return new this(t).exp()}function eE(t){return tQ(t=new this(t),t.e+1,3)}function eS(){var t,e,r=new this(0);for(t=0,tF=!1;t<arguments.length;)if(e=new this(arguments[t++]),e.d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return tF=!0,new this(1/0);r=e}return tF=!0,r.sqrt()}function eA(t){return t instanceof eY||t&&t.toStringTag===tD||!1}function ek(t){return new this(t).ln()}function ez(t,e){return new this(t).log(e)}function eO(t){return new this(t).log(2)}function eC(t){return new this(t).log(10)}function eT(){return t6(this,arguments,-1)}function eF(){return t6(this,arguments,1)}function eI(t,e){return new this(t).mod(e)}function ej(t,e){return new this(t).mul(e)}function eP(t,e){return new this(t).pow(e)}function eR(t){var e,r,n,i,o=0,s=new this(1),a=[];if(void 0===t?t=this.precision:tJ(t,1,1e9),n=Math.ceil(t/7),this.crypto){if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=e[o])>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);o<n;)(i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((127&e[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(tR)}else for(;o<n;)a[o++]=1e7*Math.random()|0;for(n=a[--o],t%=7,n&&t&&(i=tL(10,7-t),a[o]=(n/i|0)*i);0===a[o];o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;0===a[0];r-=7)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return s.e=r,s.d=a,s}function eD(t){return tQ(t=new this(t),t.e+1,this.rounding)}function eZ(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function eL(t){return new this(t).sin()}function eB(t){return new this(t).sinh()}function eq(t){return new this(t).sqrt()}function eU(t,e){return new this(t).sub(e)}function e$(){var t=0,e=arguments,r=new this(e[0]);for(tF=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return tF=!0,tQ(r,this.precision,this.rounding)}function eW(t){return new this(t).tan()}function eV(t){return new this(t).tanh()}function eH(t){return tQ(t=new this(t),t.e+1,1)}tH[Symbol.for("nodejs.util.inspect.custom")]=tH.toString,tH[Symbol.toStringTag]="Decimal";var eY=tH.constructor=function t(e){var r,n,i;function o(t){var e,r,n;if(!(this instanceof o))return new o(t);if(this.constructor=o,eA(t)){this.s=t.s,tF?!t.d||t.e>o.maxE?(this.e=NaN,this.d=null):t.e<o.minE?(this.e=0,this.d=[0]):(this.e=t.e,this.d=t.d.slice()):(this.e=t.e,this.d=t.d?t.d.slice():t.d);return}if("number"==(n=typeof t)){if(0===t){this.s=1/t<0?-1:1,this.e=0,this.d=[0];return}if(t<0?(t=-t,this.s=-1):this.s=1,t===~~t&&t<1e7){for(e=0,r=t;r>=10;r/=10)e++;tF?e>o.maxE?(this.e=NaN,this.d=null):e<o.minE?(this.e=0,this.d=[0]):(this.e=e,this.d=[t]):(this.e=e,this.d=[t]);return}if(0*t!=0){t||(this.s=NaN),this.e=NaN,this.d=null;return}return er(this,t.toString())}if("string"===n)return 45===(r=t.charCodeAt(0))?(t=t.slice(1),this.s=-1):(43===r&&(t=t.slice(1)),this.s=1),t$.test(t)?er(this,t):function(t,e){var r,n,i,o,s,a,u,c,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),t$.test(e))return er(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(tq.test(e))r=16,e=e.toLowerCase();else if(tB.test(e))r=2;else if(tU.test(e))r=8;else throw Error(tj+e);for((o=e.search(/p/i))>0?(u=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),s=(o=e.indexOf("."))>=0,n=t.constructor,s&&(o=(a=(e=e.replace(".","")).length)-o,i=t7(n,new n(r),o,2*o)),o=h=(c=tK(e,r,1e7)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*t.s):(t.e=t1(c,h),t.d=c,tF=!1,s&&(t=tG(t,i,4*a)),u&&(t=t.times(54>Math.abs(u)?tL(2,u):eY.pow(2,u))),tF=!0,t)}(this,t);if("bigint"===n)return t<0?(t=-t,this.s=-1):this.s=1,er(this,t.toString());throw Error(tj+t)}if(o.prototype=tH,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=ex,o.clone=t,o.isDecimal=eA,o.abs=eu,o.acos=ec,o.acosh=eh,o.add=ef,o.asin=el,o.asinh=ep,o.atan=ed,o.atanh=em,o.atan2=eg,o.cbrt=ev,o.ceil=ey,o.clamp=ew,o.cos=eb,o.cosh=eN,o.div=eM,o.exp=e_,o.floor=eE,o.hypot=eS,o.ln=ek,o.log=ez,o.log10=eC,o.log2=eO,o.max=eT,o.min=eF,o.mod=eI,o.mul=ej,o.pow=eP,o.random=eR,o.round=eD,o.sign=eZ,o.sin=eL,o.sinh=eB,o.sqrt=eq,o.sub=eU,o.sum=e$,o.tan=eW,o.tanh=eV,o.trunc=eH,void 0===e&&(e={}),e&&!0!==e.defaults)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];r<i.length;)e.hasOwnProperty(n=i[r++])||(e[n]=this[n]);return o.config(e),o}(tT);tO=new eY(tO),tC=new eY(tC);var eJ={createBigNumberClass:X("BigNumber",["?on","config"],t=>{var{on:e,config:r}=t,n=eY.clone({precision:r.precision,modulo:eY.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(t){return new n(t.value)},e&&e("config",function(t,e){t.precision!==e.precision&&n.config({precision:t.precision})}),n},{isClass:!0})},eX={createMatrixClass:X("Matrix",[],()=>{function t(){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator")}return t.prototype.type="Matrix",t.prototype.isMatrix=!0,t.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},t.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},t.prototype.create=function(t,e){throw Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(t,e,r){throw Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(t){throw Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(t,e,r){throw Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(t,e){throw Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(t,e){throw Error("Cannot invoke reshape on a Matrix interface")},t.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(t,e){throw Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(t){throw Error("Cannot invoke forEach on a Matrix interface")},t.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},t.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(t){throw Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},t},{isClass:!0})},eK={MatrixDependencies:eX,createDenseMatrixClass:X("DenseMatrix",["Matrix"],t=>{var{Matrix:e}=t;function r(t,e){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");if(e&&!c(e))throw Error("Invalid datatype: "+e);if(f(t))"DenseMatrix"===t.type?(this._data=U(t._data),this._size=U(t._size)):(this._data=t.toArray(),this._size=t.size()),this._datatype=e||t._datatype;else if(t&&h(t.data)&&h(t.size))this._data=t.data,this._size=t.size,td(this._data,this._size),this._datatype=e||t.datatype;else if(h(t))this._data=function t(e){for(var r=0,n=e.length;r<n;r++){var i=e[r];h(i)?e[r]=t(i):i&&!0===i.isMatrix&&(e[r]=t(i.valueOf()))}return e}(t),this._size=tp(this._data),td(this._data,this._size),this._datatype=e;else if(t)throw TypeError("Unsupported type of data ("+q(t)+")");else this._data=[],this._size=[0],this._datatype=e}function n(t,e,r){if(0===e.length){for(var n=t._data;h(n);)n=n[0];return n}return t._size=e.slice(0),t._data=tg(t._data,t._size,r),t}function s(t,e,r){for(var i=t._size.slice(0),o=!1;i.length<e.length;)i.push(0),o=!0;for(var s=0,a=e.length;s<a;s++)e[s]>i[s]&&(i[s]=e[s],o=!0);o&&n(t,i,r)}return r.prototype=new e,r.prototype.createDenseMatrix=function(t,e){return new r(t,e)},r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return tx(this._data,q)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(t,e){return new r(t,e)},r.prototype.subset=function(t,e,n){switch(arguments.length){case 1:return function(t,e){if(!g(e))throw TypeError("Invalid index");if(e.isScalar())return t.get(e.min());var n=e.size();if(n.length!==t._size.length)throw new tf(n.length,t._size.length);for(var i=e.min(),o=e.max(),s=0,a=t._size.length;s<a;s++)tm(i[s],t._size[s]),tm(o[s],t._size[s]);return new r(function t(e,r,n,i){var o=i===n-1,s=r.dimension(i);return o?s.map(function(t){return tm(t,e.length),e[t]}).valueOf():s.map(function(o){return tm(o,e.length),t(e[o],r,n,i+1)}).valueOf()}(t._data,e,n.length,0),t._datatype)}(this,t);case 2:case 3:return function(t,e,r,n){if(!e||!0!==e.isIndex)throw TypeError("Invalid index");var i,o=e.size(),a=e.isScalar();if(f(r)?(i=r.size(),r=r.valueOf()):i=tp(r),a){if(0!==i.length)throw TypeError("Scalar expected");t.set(e.min(),r,n)}else{if(o.length<t._size.length)throw new tf(o.length,t._size.length,"<");if(i.length<o.length){for(var u=0,c=0;1===o[u]&&1===i[u];)u++;for(;1===o[u];)c++,u++;r=tw(r,o.length,c,i)}if(!W(o,i))throw new tf(o,i,">");s(t,e.max().map(function(t){return t+1}),n);var h=o.length;(function t(e,r,n,i,o){var s=o===i-1,a=r.dimension(o);s?a.forEach(function(t,r){tm(t),e[t]=n[r[0]]}):a.forEach(function(s,a){tm(s),t(e[s],r,n[a[0]],i,o+1)})})(t._data,e,r,h,0)}return t}(this,t,e,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(t){if(!h(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new tf(t.length,this._size.length);for(var e=0;e<t.length;e++)tm(t[e],this._size[e]);for(var r=this._data,n=0,i=t.length;n<i;n++){var o=t[n];tm(o,r.length),r=r[o]}return r},r.prototype.set=function(t,e,r){if(!h(t))throw TypeError("Array expected");if(t.length<this._size.length)throw new tf(t.length,this._size.length,"<");s(this,t.map(function(t){return t+1}),r);var n,i,o,a=this._data;for(n=0,i=t.length-1;n<i;n++)tm(o=t[n],a.length),a=a[o];return tm(o=t[t.length-1],a.length),a[o]=e,this},r.prototype.resize=function(t,e,r){if(!l(t))throw TypeError("Array or Matrix expected");var i=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);return n(r?this.clone():this,i,e)},r.prototype.reshape=function(t,e){var r=e?this.clone():this;r._data=function(t,e){var r=function(t){if(!Array.isArray(t))return t;var e=[];return t.forEach(function t(r){Array.isArray(r)?r.forEach(t):e.push(r)}),e}(t),n=r.length;if(!Array.isArray(t)||!Array.isArray(e))throw TypeError("Array expected");if(0===e.length)throw new tf(0,n,"!=");var i=ty(e=tv(e,n));if(n!==i)throw new tf(i,n,"!=");try{return function(t,e){for(var r,n=t,i=e.length-1;i>0;i--){var o=e[i];r=[];for(var s=n.length/o,a=0;a<s;a++)r.push(n.slice(a*o,(a+1)*o));n=r}return n}(r,e)}catch(t){if(t instanceof tf)throw new tf(i,n,"!=");throw t}}(r._data,t);var n=r._size.reduce((t,e)=>t*e);return r._size=tv(t,n),r},r.prototype.clone=function(){return new r({data:U(this._data),size:U(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(t){var e=this,n=function r(n,i){return h(n)?n.map(function(t,e){return r(t,i.concat(e))}):t(n,i,e)}(this._data,[]),i=void 0!==this._datatype?tx(n,q):void 0;return new r(n,i)},r.prototype.forEach=function(t){var e=this;!function r(n,i){h(n)?n.forEach(function(t,e){r(t,i.concat(e))}):t(n,i,e)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){var t=function* t(e,r){if(h(e))for(var n=0;n<e.length;n++)yield*t(e[n],r.concat(n));else yield{value:e,index:r}};yield*t(this._data,[])},r.prototype.rows=function(){var t=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var e of this._data)t.push(new r([e],this._datatype));return t},r.prototype.columns=function(){var t=this,e=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(n){var o=i.map(t=>[t[n]]);e.push(new r(o,t._datatype))},s=0;s<n[1];s++)o(s);return e},r.prototype.toArray=function(){return U(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(t){return th(this._data,t)},r.prototype.toString=function(){return th(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(t){if(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t))throw TypeError("The parameter k must be an integer number")}else t=0;for(var e=t>0?t:0,n=t<0?-t:0,s=Math.min(this._size[0]-n,this._size[1]-e),a=[],u=0;u<s;u++)a[u]=this._data[u+n][u+e];return new r({data:a,size:[s],datatype:this._datatype})},r.diagonal=function(t,e,n,s){if(!h(t))throw TypeError("Array expected, size parameter");if(2!==t.length)throw Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t)||t<1)throw Error("Size values must be positive integers");return t}),n){if(o(n)&&(n=n.toNumber()),!i(n)||!Q(n))throw TypeError("The parameter k must be an integer number")}else n=0;var a,u=n>0?n:0,c=n<0?-n:0,l=t[0],p=t[1],d=Math.min(l-c,p-u);if(h(e)){if(e.length!==d)throw Error("Invalid value array length");a=function(t){return e[t]}}else if(f(e)){var m=e.size();if(1!==m.length||m[0]!==d)throw Error("Invalid matrix length");a=function(t){return e.get([t])}}else a=function(){return e};s||(s=o(a(0))?a(0).mul(0):0);var g=[];if(t.length>0){g=tg(g,t,s);for(var v=0;v<d;v++)g[v+c][v+u]=a(v)}return new r({data:g,size:[l,p]})},r.fromJSON=function(t){return new r(t)},r.prototype.swapRows=function(t,e){if(!i(t)||!Q(t)||!i(e)||!Q(e))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return tm(t,this._size[0]),tm(e,this._size[0]),r._swapRows(t,e,this._data),this},r._swapRows=function(t,e,r){var n=r[t];r[t]=r[e],r[e]=n},r},{isClass:!0})};let eG=Math.cosh||function(t){return 1e-9>Math.abs(t)?1-t:(Math.exp(t)+Math.exp(-t))*.5},eQ=Math.sinh||function(t){return 1e-9>Math.abs(t)?t:(Math.exp(t)-Math.exp(-t))*.5},e0=function(t){let e=Math.PI/4;if(-e>t||t>e)return Math.cos(t)-1;let r=t*t;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},e1=function(t,e){return((t=Math.abs(t))<(e=Math.abs(e))&&([t,e]=[e,t]),t<1e8)?Math.sqrt(t*t+e*e):(e/=t,t*Math.sqrt(1+e*e))},e2=function(){throw SyntaxError("Invalid Param")};function e5(t,e){let r=Math.abs(t),n=Math.abs(e);return 0===t?Math.log(n):0===e?Math.log(r):r<3e3&&n<3e3?.5*Math.log(t*t+e*e):.5*Math.log((t*=.5)*t+(e*=.5)*e)+Math.LN2}let e4={re:0,im:0},e3=function(t,e){if(null==t)e4.re=e4.im=0;else if(void 0!==e)e4.re=t,e4.im=e;else switch(typeof t){case"object":if("im"in t&&"re"in t)e4.re=t.re,e4.im=t.im;else if("abs"in t&&"arg"in t){if(!isFinite(t.abs)&&isFinite(t.arg))return e7.INFINITY;e4.re=t.abs*Math.cos(t.arg),e4.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!isFinite(t.r)&&isFinite(t.phi))return e7.INFINITY;e4.re=t.r*Math.cos(t.phi),e4.im=t.r*Math.sin(t.phi)}else 2===t.length?(e4.re=t[0],e4.im=t[1]):e2();break;case"string":e4.im=e4.re=0;let r=t.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&e2();for(let t=0;t<r.length;t++){let e=r[t];" "===e||" "===e||"\n"===e||("+"===e?n++:"-"===e?i++:("i"===e||"I"===e?(n+i===0&&e2()," "===r[t+1]||isNaN(r[t+1])?e4.im+=parseFloat((i%2?"-":"")+"1"):(e4.im+=parseFloat((i%2?"-":"")+r[t+1]),t++)):((n+i===0||isNaN(e))&&e2(),"i"===r[t+1]||"I"===r[t+1]?(e4.im+=parseFloat((i%2?"-":"")+e),t++):e4.re+=parseFloat((i%2?"-":"")+e)),n=i=0))}n+i>0&&e2();break;case"number":e4.im=0,e4.re=t;break;default:e2()}return isNaN(e4.re)||isNaN(e4.im),e4};function e7(t,e){if(!(this instanceof e7))return new e7(t,e);let r=e3(t,e);this.re=r.re,this.im=r.im}e7.prototype={re:0,im:0,sign:function(){let t=e1(this.re,this.im);return new e7(this.re/t,this.im/t)},add:function(t,e){let r=e3(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?e7.NAN:e7.INFINITY:new e7(this.re+r.re,this.im+r.im)},sub:function(t,e){let r=e3(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?e7.NAN:e7.INFINITY:new e7(this.re-r.re,this.im-r.im)},mul:function(t,e){let r=e3(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,s=0===r.re&&0===r.im;return n&&s||i&&o?e7.NAN:n||i?e7.INFINITY:0===r.im&&0===this.im?new e7(this.re*r.re,0):new e7(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){let r=e3(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,s=0===r.re&&0===r.im;if(o&&s||n&&i)return e7.NAN;if(s||n)return e7.INFINITY;if(o||i)return e7.ZERO;if(0===r.im)return new e7(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let t=r.re/r.im,e=r.re*t+r.im;return new e7((this.re*t+this.im)/e,(this.im*t-this.re)/e)}{let t=r.im/r.re,e=r.im*t+r.re;return new e7((this.re+this.im*t)/e,(this.im-this.re*t)/e)}},pow:function(t,e){let r=e3(t,e),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return e7.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new e7(Math.pow(this.re,r.re),0);if(0===this.re)switch((r.re%4+4)%4){case 0:return new e7(Math.pow(this.im,r.re),0);case 1:return new e7(0,Math.pow(this.im,r.re));case 2:return new e7(-Math.pow(this.im,r.re),0);case 3:return new e7(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return e7.ZERO;let i=Math.atan2(this.im,this.re),o=e5(this.re,this.im),s=Math.exp(r.re*o-r.im*i),a=r.im*o+r.re*i;return new e7(s*Math.cos(a),s*Math.sin(a))},sqrt:function(){let t=this.re,e=this.im;if(0===e)return t>=0?new e7(Math.sqrt(t),0):new e7(0,Math.sqrt(-t));let r=Math.sqrt(.5*(e1(t,e)+Math.abs(t))),n=Math.abs(e)/(2*r);return t>=0?new e7(r,e<0?-n:n):new e7(n,e<0?-r:r)},exp:function(){let t=Math.exp(this.re);return 0===this.im?new e7(t,0):new e7(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t=this.re,e=this.im;return new e7(Math.expm1(t)*Math.cos(e)+e0(e),Math.exp(t)*Math.sin(e))},log:function(){let t=this.re,e=this.im;return 0===e&&t>0?new e7(Math.log(t),0):new e7(e5(t,e),Math.atan2(e,t))},abs:function(){return e1(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,e=this.im;return new e7(Math.sin(t)*eG(e),Math.cos(t)*eQ(e))},cos:function(){let t=this.re,e=this.im;return new e7(Math.cos(t)*eG(e),-Math.sin(t)*eQ(e))},tan:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)+eG(e);return new e7(Math.sin(t)/r,eQ(e)/r)},cot:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)-eG(e);return new e7(-Math.sin(t)/r,eQ(e)/r)},sec:function(){let t=this.re,e=this.im,r=.5*eG(2*e)+.5*Math.cos(2*t);return new e7(Math.cos(t)*eG(e)/r,Math.sin(t)*eQ(e)/r)},csc:function(){let t=this.re,e=this.im,r=.5*eG(2*e)-.5*Math.cos(2*t);return new e7(Math.sin(t)*eG(e)/r,-Math.cos(t)*eQ(e)/r)},asin:function(){let t=this.re,e=this.im,r=new e7(e*e-t*t+1,-2*t*e).sqrt(),n=new e7(r.re-e,r.im+t).log();return new e7(n.im,-n.re)},acos:function(){let t=this.re,e=this.im,r=new e7(e*e-t*t+1,-2*t*e).sqrt(),n=new e7(r.re-e,r.im+t).log();return new e7(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,e=this.im;if(0===t){if(1===e)return new e7(0,1/0);if(-1===e)return new e7(0,-1/0)}let r=t*t+(1-e)*(1-e),n=new e7((1-e*e-t*t)/r,-2*t/r).log();return new e7(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,e=this.im;if(0===e)return new e7(Math.atan2(1,t),0);let r=t*t+e*e;return 0!==r?new e7(t/r,-e/r).atan():new e7(0!==t?t/0:0,0!==e?-e/0:0).atan()},asec:function(){let t=this.re,e=this.im;if(0===t&&0===e)return new e7(0,1/0);let r=t*t+e*e;return 0!==r?new e7(t/r,-e/r).acos():new e7(0!==t?t/0:0,0!==e?-e/0:0).acos()},acsc:function(){let t=this.re,e=this.im;if(0===t&&0===e)return new e7(Math.PI/2,1/0);let r=t*t+e*e;return 0!==r?new e7(t/r,-e/r).asin():new e7(0!==t?t/0:0,0!==e?-e/0:0).asin()},sinh:function(){let t=this.re,e=this.im;return new e7(eQ(t)*Math.cos(e),eG(t)*Math.sin(e))},cosh:function(){let t=this.re,e=this.im;return new e7(eG(t)*Math.cos(e),eQ(t)*Math.sin(e))},tanh:function(){let t=2*this.re,e=2*this.im,r=eG(t)+Math.cos(e);return new e7(eQ(t)/r,Math.sin(e)/r)},coth:function(){let t=2*this.re,e=2*this.im,r=eG(t)-Math.cos(e);return new e7(eQ(t)/r,-Math.sin(e)/r)},csch:function(){let t=this.re,e=this.im,r=Math.cos(2*e)-eG(2*t);return new e7(-2*eQ(t)*Math.cos(e)/r,2*eG(t)*Math.sin(e)/r)},sech:function(){let t=this.re,e=this.im,r=Math.cos(2*e)+eG(2*t);return new e7(2*eG(t)*Math.cos(e)/r,-2*eQ(t)*Math.sin(e)/r)},asinh:function(){let t=this.im;this.im=-this.re,this.re=t;let e=this.asin();return this.re=-this.im,this.im=t,t=e.re,e.re=-e.im,e.im=t,e},acosh:function(){let t=this.acos();if(t.im<=0){let e=t.re;t.re=-t.im,t.im=e}else{let e=t.im;t.im=-t.re,t.re=e}return t},atanh:function(){let t=this.re,e=this.im,r=1-t,n=1+t,i=r*r+e*e,o=0!==i?new e7((n*r-e*e)/i,(e*r+n*e)/i):new e7(-1!==t?t/0:0,0!==e?e/0:0),s=o.re;return o.re=e5(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,t>1&&0===e&&(o.im=-o.im),o},acoth:function(){let t=this.re,e=this.im;if(0===t&&0===e)return new e7(0,Math.PI/2);let r=t*t+e*e;return 0!==r?new e7(t/r,-e/r).atanh():new e7(0!==t?t/0:0,0!==e?-e/0:0).atanh()},acsch:function(){let t=this.re,e=this.im;if(0===e)return new e7(0!==t?Math.log(t+Math.sqrt(t*t+1)):1/0,0);let r=t*t+e*e;return 0!==r?new e7(t/r,-e/r).asinh():new e7(0!==t?t/0:0,0!==e?-e/0:0).asinh()},asech:function(){let t=this.re,e=this.im;if(this.isZero())return e7.INFINITY;let r=t*t+e*e;return 0!==r?new e7(t/r,-e/r).acosh():new e7(0!==t?t/0:0,0!==e?-e/0:0).acosh()},inverse:function(){if(this.isZero())return e7.INFINITY;if(this.isInfinite())return e7.ZERO;let t=this.re,e=this.im,r=t*t+e*e;return new e7(t/r,-e/r)},conjugate:function(){return new e7(this.re,-this.im)},neg:function(){return new e7(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new e7(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new e7(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new e7(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,e){let r=e3(t,e);return Math.abs(r.re-this.re)<=e7.EPSILON&&Math.abs(r.im-this.im)<=e7.EPSILON},clone:function(){return new e7(this.re,this.im)},toString:function(){let t=this.re,e=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(t)<e7.EPSILON&&(t=0),Math.abs(e)<e7.EPSILON&&(e=0),0===e)?r+t:(0!==t?(r+=t,r+=" ",e<0?(e=-e,r+="-"):r+="+",r+=" "):e<0&&(e=-e,r+="-"),1!==e&&(r+=e),r+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},e7.ZERO=new e7(0,0),e7.ONE=new e7(1,0),e7.I=new e7(0,1),e7.PI=new e7(Math.PI,0),e7.E=new e7(Math.E,0),e7.INFINITY=new e7(1/0,1/0),e7.NAN=new e7(NaN,NaN),e7.EPSILON=1e-15;var e8=X("Complex",[],()=>(e7.prototype.type="Complex",e7.prototype.isComplex=!0,e7.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},e7.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},e7.prototype.format=function(t){var e="",r=this.im,n=this.re,o=te(this.re,t),s=te(this.im,t),a=i(t)?t:t?t.precision:null;if(null!==a){var u=Math.pow(10,-a);Math.abs(n/r)<u&&(n=0),Math.abs(r/n)<u&&(r=0)}return 0===r?o:0===n?1===r?"i":-1===r?"-i":s+"i":r<0?-1===r?o+" - i":o+" - "+s.substring(1)+"i":1===r?o+" + i":o+" + "+s+"i"},e7.fromPolar=function(t){switch(arguments.length){case 1:var e=arguments[0];if("object"==typeof e)return e7(e);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(i(r)){if(u(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),i(n))return new e7({r,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},e7.prototype.valueOf=e7.prototype.toString,e7.fromJSON=function(t){return new e7(t)},e7.compare=function(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0},e7),{isClass:!0}),e6={s:1,n:0,d:1};function e9(t,e){if(isNaN(t=parseInt(t,10)))throw rs();return t*e}function rt(t,e){if(0===e)throw ro();var r=Object.create(ri.prototype);r.s=t<0?-1:1;var n=rn(t=t<0?-t:t,e);return r.n=t/n,r.d=e/n,r}function re(t){for(var e={},r=t,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,e[n]=(e[n]||0)+1;i+=1+2*n++}return r!==t?r>1&&(e[r]=(e[r]||0)+1):e[t]=(e[t]||0)+1,e}var rr=function(t,e){var r,n=0,i=1,o=1,s=0,a=0,u=0,c=1,h=1,f=0,l=1,p=1,d=1;if(null==t);else if(void 0!==e){if(o=(n=t)*(i=e),n%1!=0||i%1!=0)throw ra()}else switch(typeof t){case"object":if("d"in t&&"n"in t)n=t.n,i=t.d,"s"in t&&(n*=t.s);else if(0 in t)n=t[0],1 in t&&(i=t[1]);else throw rs();o=n*i;break;case"number":if(t<0&&(o=t,t=-t),t%1==0)n=t;else if(t>0){for(t>=1&&(h=Math.pow(10,Math.floor(1+Math.log(t)/Math.LN10)),t/=h);l<=1e7&&d<=1e7;){if(t===(r=(f+p)/(l+d))){l+d<=1e7?(n=f+p,i=l+d):d>l?(n=p,i=d):(n=f,i=l);break}t>r?(f+=p,l+=d):(p+=f,d+=l),l>1e7?(n=p,i=d):(n=f,i=l)}n*=h}else(isNaN(t)||isNaN(e))&&(i=n=NaN);break;case"string":if(null===(l=t.match(/\d+|./g)))throw rs();if("-"===l[f]?(o=-1,f++):"+"===l[f]&&f++,l.length===f+1?a=e9(l[f++],o):"."===l[f+1]||"."===l[f]?("."!==l[f]&&(s=e9(l[f++],o)),(++f+1===l.length||"("===l[f+1]&&")"===l[f+3]||"'"===l[f+1]&&"'"===l[f+3])&&(a=e9(l[f],o),c=Math.pow(10,l[f].length),f++),("("===l[f]&&")"===l[f+2]||"'"===l[f]&&"'"===l[f+2])&&(u=e9(l[f+1],o),h=Math.pow(10,l[f+1].length)-1,f+=3)):"/"===l[f+1]||":"===l[f+1]?(a=e9(l[f],o),c=e9(l[f+2],1),f+=3):"/"===l[f+3]&&" "===l[f+1]&&(s=e9(l[f],o),a=e9(l[f+2],o),c=e9(l[f+4],1),f+=5),l.length<=f){o=n=u+(i=c*h)*s+h*a;break}default:throw rs()}if(0===i)throw ro();e6.s=o<0?-1:1,e6.n=Math.abs(n),e6.d=Math.abs(i)};function rn(t,e){if(!t)return e;if(!e)return t;for(;;){if(!(t%=e))return e;if(!(e%=t))return t}}function ri(t,e){if(rr(t,e),!(this instanceof ri))return rt(e6.s*e6.n,e6.d);t=rn(e6.d,e6.n),this.s=e6.s,this.n=e6.n/t,this.d=e6.d/t}var ro=function(){return Error("Division by Zero")},rs=function(){return Error("Invalid argument")},ra=function(){return Error("Parameters must be integer")};ri.prototype={s:1,n:0,d:1,abs:function(){return rt(this.n,this.d)},neg:function(){return rt(-this.s*this.n,this.d)},add:function(t,e){return rr(t,e),rt(this.s*this.n*e6.d+e6.s*this.d*e6.n,this.d*e6.d)},sub:function(t,e){return rr(t,e),rt(this.s*this.n*e6.d-e6.s*this.d*e6.n,this.d*e6.d)},mul:function(t,e){return rr(t,e),rt(this.s*e6.s*this.n*e6.n,this.d*e6.d)},div:function(t,e){return rr(t,e),rt(this.s*e6.s*this.n*e6.d,this.d*e6.n)},clone:function(){return rt(this.s*this.n,this.d)},mod:function(t,e){if(isNaN(this.n)||isNaN(this.d))return new ri(NaN);if(void 0===t)return rt(this.s*this.n%this.d,1);if(rr(t,e),0===e6.n&&0===this.d)throw ro();return rt(this.s*(e6.d*this.n)%(e6.n*this.d),e6.d*this.d)},gcd:function(t,e){return rr(t,e),rt(rn(e6.n,this.n)*rn(e6.d,this.d),e6.d*this.d)},lcm:function(t,e){return(rr(t,e),0===e6.n&&0===this.n)?rt(0,1):rt(e6.n*this.n,rn(e6.n,this.n)*rn(e6.d,this.d))},ceil:function(t){return(t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d))?new ri(NaN):rt(Math.ceil(t*this.s*this.n/this.d),t)},floor:function(t){return(t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d))?new ri(NaN):rt(Math.floor(t*this.s*this.n/this.d),t)},round:function(t){return(t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d))?new ri(NaN):rt(Math.round(t*this.s*this.n/this.d),t)},roundTo:function(t,e){return rr(t,e),rt(this.s*Math.round(this.n*e6.d/(this.d*e6.n))*e6.n,e6.d)},inverse:function(){return rt(this.s*this.d,this.n)},pow:function(t,e){if(rr(t,e),1===e6.d)return e6.s<0?rt(Math.pow(this.s*this.d,e6.n),Math.pow(this.n,e6.n)):rt(Math.pow(this.s*this.n,e6.n),Math.pow(this.d,e6.n));if(this.s<0)return null;var r=re(this.n),n=re(this.d),i=1,o=1;for(var s in r)if("1"!==s){if("0"===s){i=0;break}if(r[s]*=e6.n,r[s]%e6.d!=0)return null;r[s]/=e6.d,i*=Math.pow(s,r[s])}for(var s in n)if("1"!==s){if(n[s]*=e6.n,n[s]%e6.d!=0)return null;n[s]/=e6.d,o*=Math.pow(s,n[s])}return e6.s<0?rt(o,i):rt(i,o)},equals:function(t,e){return rr(t,e),this.s*this.n*e6.d==e6.s*e6.n*this.d},compare:function(t,e){rr(t,e);var r=this.s*this.n*e6.d-e6.s*e6.n*this.d;return(0<r)-(r<0)},simplify:function(t){if(isNaN(this.n)||isNaN(this.d))return this;t=t||.001;for(var e=this.abs(),r=e.toContinued(),n=1;n<r.length;n++){for(var i=rt(r[n-1],1),o=n-2;o>=0;o--)i=i.inverse().add(r[o]);if(Math.abs(i.sub(e).valueOf())<t)return i.mul(this.s)}return this},divisible:function(t,e){return rr(t,e),!(!(e6.n*this.d)||this.n*e6.d%(e6.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(t){var e,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(t&&(e=Math.floor(n/i))>0&&(r+=e,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(t){var e,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(t&&(e=Math.floor(n/i))>0&&(r+=e,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var t,e=this.n,r=this.d,n=[];if(isNaN(e)||isNaN(r))return n;do n.push(Math.floor(e/r)),t=e%r,e=r,r=t;while(1!==e);return n},toString:function(t){var e=this.n,r=this.d;if(isNaN(e)||isNaN(r))return"NaN";t=t||15;var n=function(t,e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var r=10%e,n=1;1!==r;n++)if(r=10*r%e,n>2e3)return 0;return n}(0,r),i=function(t,e,r){for(var n=1,i=function(t,e,r){for(var n=1;e>0;t=t*t%r,e>>=1)1&e&&(n=n*t%r);return n}(10,r,e),o=0;o<300;o++){if(n===i)return o;n=10*n%e,i=10*i%e}return 0}(0,r,n),o=this.s<0?"-":"";if(o+=e/r|0,e%=r,(e*=10)&&(o+="."),n){for(var s=i;s--;)o+=e/r|0,e%=r,e*=10;o+="(";for(var s=n;s--;)o+=e/r|0,e%=r,e*=10;o+=")"}else for(var s=t;e&&s--;)o+=e/r|0,e%=r,e*=10;return o}};var ru=X("Fraction",[],()=>(ri.prototype.type="Fraction",ri.prototype.isFraction=!0,ri.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},ri.fromJSON=function(t){return new ri(t)},ri),{isClass:!0}),rc=r(27554);function rh(t,e){return!!t&&"object"==typeof t&&(!!H(rl,e)||!(e in Object.prototype)&&!(e in Function.prototype))}function rf(t){return"object"==typeof t&&t&&t.constructor===Object}var rl={length:!0,name:!0},rp={toString:!0,valueOf:!0,toLocaleString:!0};class rd{constructor(t){this.wrappedObject=t}keys(){return Object.keys(this.wrappedObject)}get(t){return function(t,e){var r,n;if(rf(t)&&rh(t,e))return t[e];if("function"==typeof t[e]&&(r=t,n=e,!(null==r||"function"!=typeof r[n]||H(r,n)&&Object.getPrototypeOf&&n in Object.getPrototypeOf(r))&&(H(rp,n)||!(n in Object.prototype)&&!(n in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}(this.wrappedObject,t)}set(t,e){return!function(t,e,r){if(rf(t)&&rh(t,e))return t[e]=r;throw Error('No access to property "'+e+'"')}(this.wrappedObject,t,e),this}has(t){return t in this.wrappedObject}}function rm(t){return!!t&&(t instanceof Map||t instanceof rd||"function"==typeof t.set&&"function"==typeof t.get&&"function"==typeof t.keys&&"function"==typeof t.has)}var rg=function(){return rg=rc.create,rc};function rv(t){throw Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function ry(t){throw Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function rw(t){throw Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var rx={BigNumberDependencies:eJ,ComplexDependencies:{createComplexClass:e8},DenseMatrixDependencies:eK,FractionDependencies:{createFractionClass:ru},createTyped:X("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(t){var{BigNumber:e,Complex:r,DenseMatrix:n,Fraction:l}=t,q=rg();return q.types=[{name:"number",test:i},{name:"Complex",test:s},{name:"BigNumber",test:o},{name:"Fraction",test:a},{name:"Unit",test:u},{name:"string",test:c},{name:"Chain",test:B},{name:"Array",test:h},{name:"Matrix",test:f},{name:"DenseMatrix",test:p},{name:"SparseMatrix",test:d},{name:"Range",test:m},{name:"Index",test:g},{name:"boolean",test:v},{name:"ResultSet",test:y},{name:"Help",test:w},{name:"function",test:x},{name:"Date",test:b},{name:"RegExp",test:N},{name:"null",test:_},{name:"undefined",test:E},{name:"AccessorNode",test:S},{name:"ArrayNode",test:A},{name:"AssignmentNode",test:k},{name:"BlockNode",test:z},{name:"ConditionalNode",test:O},{name:"ConstantNode",test:C},{name:"FunctionNode",test:F},{name:"FunctionAssignmentNode",test:T},{name:"IndexNode",test:I},{name:"Node",test:j},{name:"ObjectNode",test:P},{name:"OperatorNode",test:R},{name:"ParenthesisNode",test:D},{name:"RangeNode",test:Z},{name:"SymbolNode",test:L},{name:"Map",test:rm},{name:"Object",test:M}],q.conversions=[{from:"number",to:"BigNumber",convert:function(t){if(e||rv(t),t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+t+"). Use function bignumber(x) to convert to BigNumber.");return new e(t)}},{from:"number",to:"Complex",convert:function(t){return r||ry(t),new r(t,0)}},{from:"number",to:"string",convert:function(t){return t+""}},{from:"BigNumber",to:"Complex",convert:function(t){return r||ry(t),new r(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(t){return r||ry(t),new r(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){l||rw(t);var e=new l(t);if(e.valueOf()!==t)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+t+"). Use function fraction(x) to convert to Fraction.");return e}},{from:"string",to:"number",convert:function(t){var e=Number(t);if(isNaN(e))throw Error('Cannot convert "'+t+'" to a number');return e}},{from:"string",to:"BigNumber",convert:function(t){e||rv(t);try{return new e(t)}catch(e){throw Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(t){l||rw(t);try{return new l(t)}catch(e){throw Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){r||ry(t);try{return new r(t)}catch(e){throw Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return e||rv(t),new e(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return l||rw(t),new l(+t)}},{from:"boolean",to:"string",convert:function(t){return String(t)}},{from:"Array",to:"Matrix",convert:function(t){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}],q})},rb="equalScalar",rN=X(rb,["typed","config"],t=>{var{typed:e,config:r}=t;return e(rb,{"boolean, boolean":function(t,e){return t===e},"number, number":function(t,e){return ta(t,e,r.epsilon)},"BigNumber, BigNumber":function(t,e){return t.eq(e)||function(t,e,r){if(null==r)return t.eq(e);if(t.eq(e))return!0;if(t.isNaN()||e.isNaN())return!1;if(t.isFinite()&&e.isFinite()){var n=t.minus(e).abs();if(n.isZero())return!0;var i=t.constructor.max(t.abs(),e.abs());return n.lte(i.times(r))}return!1}(t,e,r.epsilon)},"Fraction, Fraction":function(t,e){return t.equals(e)},"Complex, Complex":function(t,e){var n;return n=r.epsilon,ta(t.re,e.re,n)&&ta(t.im,e.im,n)},"Unit, Unit":function(t,e){if(!t.equalBase(e))throw Error("Cannot compare units with different base");return this(t.value,e.value)}})});X(rb,["typed","config"],t=>{var{typed:e,config:r}=t;return e(rb,{"number, number":function(t,e){return ta(t,e,r.epsilon)}})});var rM={typedDependencies:rx,createEqualScalar:rN},r_=X("SparseMatrix",["typed","equalScalar","Matrix"],t=>{var{typed:e,equalScalar:r,Matrix:n}=t;function s(t,e){if(!(this instanceof s))throw SyntaxError("Constructor must be called with the new operator");if(e&&!c(e))throw Error("Invalid datatype: "+e);if(f(t)){var r,n,i;r=this,n=t,i=e,"SparseMatrix"===n.type?(r._values=n._values?U(n._values):void 0,r._index=U(n._index),r._ptr=U(n._ptr),r._size=U(n._size),r._datatype=i||n._datatype):a(r,n.valueOf(),i||n._datatype)}else if(t&&h(t.index)&&h(t.ptr)&&h(t.size))this._values=t.values,this._index=t.index,this._ptr=t.ptr,this._size=t.size,this._datatype=e||t.datatype;else if(h(t))a(this,t,e);else if(t)throw TypeError("Unsupported type of data ("+q(t)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=e}function a(t,n,i){t._values=[],t._index=[],t._ptr=[],t._datatype=i;var o=n.length,s=0,a=r,u=0;if(c(i)&&(a=e.find(r,[i,i])||r,u=e.convert(0,i)),o>0){var f=0;do{t._ptr.push(t._index.length);for(var l=0;l<o;l++){var p=n[l];if(h(p)){if(0===f&&s<p.length&&(s=p.length),f<p.length){var d=p[f];a(d,u)||(t._values.push(d),t._index.push(l))}}else 0===f&&s<1&&(s=1),a(p,u)||(t._values.push(p),t._index.push(l))}f++}while(f<s)}t._ptr.push(t._index.length),t._size=[o,s]}function u(t,e,r,n){if(r-e==0)return r;for(var i=e;i<r;i++)if(n[i]===t)return i;return e}function p(t,e,r,n,i,o,s){i.splice(t,0,n),o.splice(t,0,e);for(var a=r+1;a<s.length;a++)s[a]++}function d(t,n,i,o){var s,a,u,h=o||0,f=r,l=0;c(t._datatype)&&(f=e.find(r,[t._datatype,t._datatype])||r,l=e.convert(0,t._datatype),h=e.convert(h,t._datatype));var p=!f(h,l),d=t._size[0],m=t._size[1];if(i>m){for(a=m;a<i;a++)if(t._ptr[a]=t._values.length,p)for(s=0;s<d;s++)t._values.push(h),t._index.push(s);t._ptr[i]=t._values.length}else i<m&&(t._ptr.splice(i+1,m-i),t._values.splice(t._ptr[i],t._values.length),t._index.splice(t._ptr[i],t._index.length));if(m=i,n>d){if(p){var g=0;for(a=0;a<m;a++){t._ptr[a]=t._ptr[a]+g,u=t._ptr[a+1]+g;var v=0;for(s=d;s<n;s++,v++)t._values.splice(u+v,0,h),t._index.splice(u+v,0,s),g++}t._ptr[m]=t._values.length}}else if(n<d){var y=0;for(a=0;a<m;a++){t._ptr[a]=t._ptr[a]-y;var w=t._ptr[a],x=t._ptr[a+1]-y;for(u=w;u<x;u++)(s=t._index[u])>n-1&&(t._values.splice(u,1),t._index.splice(u,1),y++)}t._ptr[a]=t._values.length}return t._size[0]=n,t._size[1]=i,t}function m(t,e,r,n,i){var o,s,a=n[0],u=n[1],c=[];for(o=0;o<a;o++)for(s=0,c[o]=[];s<u;s++)c[o][s]=0;for(s=0;s<u;s++)for(var h=r[s],f=r[s+1],l=h;l<f;l++)c[o=e[l]][s]=t?i?U(t[l]):t[l]:1;return c}return s.prototype=new n,s.prototype.createSparseMatrix=function(t,e){return new s(t,e)},s.prototype.type="SparseMatrix",s.prototype.isSparseMatrix=!0,s.prototype.getDataType=function(){return tx(this._values,q)},s.prototype.storage=function(){return"sparse"},s.prototype.datatype=function(){return this._datatype},s.prototype.create=function(t,e){return new s(t,e)},s.prototype.density=function(){var t=this._size[0],e=this._size[1];return 0!==t&&0!==e?this._index.length/(t*e):0},s.prototype.subset=function(t,e,r){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(t,e){if(!g(e))throw TypeError("Invalid index");if(e.isScalar())return t.get(e.min());var r,n,i,o,a=e.size();if(a.length!==t._size.length)throw new tf(a.length,t._size.length);var u=e.min(),c=e.max();for(r=0,n=t._size.length;r<n;r++)tm(u[r],t._size[r]),tm(c[r],t._size[r]);var h=t._values,f=t._index,l=t._ptr,p=e.dimension(0),d=e.dimension(1),m=[],v=[];p.forEach(function(t,e){v[t]=e[0],m[t]=!0});var y=h?[]:void 0,w=[],x=[];return d.forEach(function(t){for(x.push(w.length),i=l[t],o=l[t+1];i<o;i++)!0===m[r=f[i]]&&(w.push(v[r]),y&&y.push(h[i]))}),x.push(w.length),new s({values:y,index:w,ptr:x,size:a,datatype:t._datatype})}(this,t);case 2:case 3:return function(t,e,r,n){if(!e||!0!==e.isIndex)throw TypeError("Invalid index");var i,o=e.size(),s=e.isScalar();if(f(r)?(i=r.size(),r=r.toArray()):i=tp(r),s){if(0!==i.length)throw TypeError("Scalar expected");t.set(e.min(),r,n)}else{if(1!==o.length&&2!==o.length)throw new tf(o.length,t._size.length,"<");if(i.length<o.length){for(var a=0,u=0;1===o[a]&&1===i[a];)a++;for(;1===o[a];)u++,a++;r=tw(r,o.length,u,i)}if(!W(o,i))throw new tf(o,i,">");if(1===o.length)e.dimension(0).forEach(function(e,i){tm(e),t.set([e,0],r[i[0]],n)});else{var c=e.dimension(0),h=e.dimension(1);c.forEach(function(e,i){tm(e),h.forEach(function(o,s){tm(o),t.set([e,o],r[i[0]][s[0]],n)})})}}return t}(this,t,e,r);default:throw SyntaxError("Wrong number of arguments")}},s.prototype.get=function(t){if(!h(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new tf(t.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var e=t[0],r=t[1];tm(e,this._size[0]),tm(r,this._size[1]);var n=u(e,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===e?this._values[n]:0},s.prototype.set=function(t,n,i){if(!h(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new tf(t.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=t[0],s=t[1],a=this._size[0],f=this._size[1],l=r,m=0;c(this._datatype)&&(l=e.find(r,[this._datatype,this._datatype])||r,m=e.convert(0,this._datatype)),(o>a-1||s>f-1)&&(d(this,Math.max(o+1,a),Math.max(s+1,f),i),a=this._size[0],f=this._size[1]),tm(o,a),tm(s,f);var g=u(o,this._ptr[s],this._ptr[s+1],this._index);return g<this._ptr[s+1]&&this._index[g]===o?l(n,m)?function(t,e,r,n,i){r.splice(t,1),n.splice(t,1);for(var o=e+1;o<i.length;o++)i[o]--}(g,s,this._values,this._index,this._ptr):this._values[g]=n:p(g,o,s,n,this._values,this._index,this._ptr),this},s.prototype.resize=function(t,e,r){if(!l(t))throw TypeError("Array or Matrix expected");var n=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(t){if(!i(t)||!Q(t)||t<0)throw TypeError("Invalid size, must contain positive integers (size: "+th(n)+")")}),d(r?this.clone():this,n[0],n[1],e)},s.prototype.reshape=function(t,e){if(!h(t))throw TypeError("Array expected");if(2!==t.length)throw Error("Sparse matrices can only be reshaped in two dimensions");t.forEach(function(e){if(!i(e)||!Q(e)||e<=-2||0===e)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+th(t)+")")});var r=this._size[0]*this._size[1],n=(t=tv(t,r))[0]*t[1];if(r!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var o=e?this.clone():this;if(this._size[0]===t[0]&&this._size[1]===t[1])return o;for(var s=[],a=0;a<o._ptr.length;a++)for(var c=0;c<o._ptr[a+1]-o._ptr[a];c++)s.push(a);for(var f=o._values.slice(),l=o._index.slice(),d=0;d<o._index.length;d++){var m=l[d],g=s[d],v=m*o._size[1]+g;s[d]=v%t[1],l[d]=Math.floor(v/t[1])}o._values.length=0,o._index.length=0,o._ptr.length=t[1]+1,o._size=t.slice();for(var y=0;y<o._ptr.length;y++)o._ptr[y]=0;for(var w=0;w<f.length;w++){var x=l[w],b=s[w],N=f[w];p(u(x,o._ptr[b],o._ptr[b+1],o._index),x,b,N,o._values,o._index,o._ptr)}return o},s.prototype.clone=function(){return new s({values:this._values?U(this._values):void 0,index:U(this._index),ptr:U(this._ptr),size:U(this._size),datatype:this._datatype})},s.prototype.size=function(){return this._size.slice(0)},s.prototype.map=function(t,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var i=this;return function(t,n,i,o,a,u,h){var f=[],l=[],p=[],d=r,m=0;c(t._datatype)&&(d=e.find(r,[t._datatype,t._datatype])||r,m=e.convert(0,t._datatype));for(var g=function(t,e,r){t=u(t,e,r),d(t,m)||(f.push(t),l.push(e))},v=0;v<=a;v++){p.push(f.length);var y=t._ptr[v],w=t._ptr[v+1];if(h)for(var x=y;x<w;x++){var b=t._index[x];b>=0&&b<=i&&g(t._values[x],b-n,v-o)}else{for(var N={},M=y;M<w;M++)N[t._index[M]]=t._values[M];for(var _=n;_<=i;_++)g(_ in N?N[_]:0,_-n,v-o)}}return p.push(f.length),new s({values:f,index:l,ptr:p,size:[i-n+1,a-o+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(e,r,n){return t(e,[r,n],i)},n)},s.prototype.forEach=function(t,e){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var o=this._ptr[i],s=this._ptr[i+1];if(e)for(var a=o;a<s;a++){var u=this._index[a];t(this._values[a],[u,i],this)}else{for(var c={},h=o;h<s;h++)c[this._index[h]]=this._values[h];for(var f=0;f<r;f++)t(f in c?c[f]:0,[f,i],this)}}},s.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var t=this._size[1],e=0;e<t;e++)for(var r=this._ptr[e],n=this._ptr[e+1],i=r;i<n;i++){var o=this._index[i];yield{value:this._values[i],index:[o,e]}}},s.prototype.toArray=function(){return m(this._values,this._index,this._ptr,this._size,!0)},s.prototype.valueOf=function(){return m(this._values,this._index,this._ptr,this._size,!1)},s.prototype.format=function(t){for(var e=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+th(e,t)+" x "+th(r,t)+"] density: "+th(n,t)+"\n",o=0;o<r;o++)for(var s=this._ptr[o],a=this._ptr[o+1],u=s;u<a;u++)i+="\n ("+th(this._index[u],t)+", "+th(o,t)+") ==> "+(this._values?th(this._values[u],t):"X");return i},s.prototype.toString=function(){return th(this.toArray())},s.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},s.prototype.diagonal=function(t){if(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t))throw TypeError("The parameter k must be an integer number")}else t=0;var e=t>0?t:0,r=t<0?-t:0,n=this._size[0],a=this._size[1],u=Math.min(n-r,a-e),c=[],h=[],f=[];f[0]=0;for(var l=e;l<a&&c.length<u;l++)for(var p=this._ptr[l],d=this._ptr[l+1],m=p;m<d;m++){var g=this._index[m];if(g===l-e+r){c.push(this._values[m]),h[c.length-1]=g-r;break}}return f.push(c.length),new s({values:c,index:h,ptr:f,size:[u,1]})},s.fromJSON=function(t){return new s(t)},s.diagonal=function(t,n,a,u,l){if(!h(t))throw TypeError("Array expected, size parameter");if(2!==t.length)throw Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(o(t)&&(t=t.toNumber()),!i(t)||!Q(t)||t<1)throw Error("Size values must be positive integers");return t}),a){if(o(a)&&(a=a.toNumber()),!i(a)||!Q(a))throw TypeError("The parameter k must be an integer number")}else a=0;var p,d=r,m=0;c(l)&&(d=e.find(r,[l,l])||r,m=e.convert(0,l));var g=a>0?a:0,v=a<0?-a:0,y=t[0],w=t[1],x=Math.min(y-v,w-g);if(h(n)){if(n.length!==x)throw Error("Invalid value array length");p=function(t){return n[t]}}else if(f(n)){var b=n.size();if(1!==b.length||b[0]!==x)throw Error("Invalid matrix length");p=function(t){return n.get([t])}}else p=function(){return n};for(var N=[],M=[],_=[],E=0;E<w;E++){_.push(N.length);var S=E-g;if(S>=0&&S<x){var A=p(S);d(A,m)||(M.push(S+v),N.push(A))}}return _.push(N.length),new s({values:N,index:M,ptr:_,size:[y,w]})},s.prototype.swapRows=function(t,e){if(!i(t)||!Q(t)||!i(e)||!Q(e))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return tm(t,this._size[0]),tm(e,this._size[0]),s._swapRows(t,e,this._size[1],this._values,this._index,this._ptr),this},s._forEachRow=function(t,e,r,n,i){for(var o=n[t],s=n[t+1],a=o;a<s;a++)i(r[a],e[a])},s._swapRows=function(t,e,r,n,i,o){for(var s=0;s<r;s++){var a=o[s],c=o[s+1],h=u(t,a,c,i),f=u(e,a,c,i);if(h<c&&f<c&&i[h]===t&&i[f]===e){if(n){var l=n[h];n[h]=n[f],n[f]=l}continue}if(h<c&&i[h]===t&&(f>=c||i[f]!==e)){var p=n?n[h]:void 0;i.splice(f,0,e),n&&n.splice(f,0,p),i.splice(f<=h?h+1:h,1),n&&n.splice(f<=h?h+1:h,1);continue}if(f<c&&i[f]===e&&(h>=c||i[h]!==t)){var d=n?n[f]:void 0;i.splice(h,0,t),n&&n.splice(h,0,d),i.splice(h<=f?f+1:f,1),n&&n.splice(h<=f?f+1:f,1)}}},s},{isClass:!0}),rE="matrix",rS=X(rE,["typed","Matrix","DenseMatrix","SparseMatrix"],t=>{var{typed:e,Matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(rE,{"":function(){return o([])},string:function(t){return o([],t)},"string, string":function(t,e){return o([],t,e)},Array:function(t){return o(t)},Matrix:function(t){return o(t,t.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(t,e,r){if("dense"===e||"default"===e||void 0===e)return new n(t,r);if("sparse"===e)return new i(t,r);throw TypeError("Unknown matrix type "+JSON.stringify(e)+".")}}),rA=X("algorithm01",["typed"],t=>{var{typed:e}=t;return function(t,r,n,i){var o,s,a=t._data,u=t._size,c=t._datatype,h=r._values,f=r._index,l=r._ptr,p=r._size,d=r._datatype;if(u.length!==p.length)throw new tf(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");if(!h)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=u[0],g=u[1],v="string"==typeof c&&c===d?c:void 0,y=v?e.find(n,[v,v]):n,w=[];for(o=0;o<m;o++)w[o]=[];var x=[],b=[];for(s=0;s<g;s++){for(var N=s+1,M=l[s],_=l[s+1],E=M;E<_;E++)x[o=f[E]]=i?y(h[E],a[o][s]):y(a[o][s],h[E]),b[o]=N;for(o=0;o<m;o++)b[o]===N?w[o][s]=x[o]:w[o][s]=a[o][s]}return t.createDenseMatrix({data:w,size:[m,g],datatype:v})}}),rk=X("algorithm04",["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return function(t,n,i){var o,s,a,u,c,h,f=t._values,l=t._index,p=t._ptr,d=t._size,m=t._datatype,g=n._values,v=n._index,y=n._ptr,w=n._size,x=n._datatype;if(d.length!==w.length)throw new tf(d.length,w.length);if(d[0]!==w[0]||d[1]!==w[1])throw RangeError("Dimension mismatch. Matrix A ("+d+") must match Matrix B ("+w+")");var b=d[0],N=d[1],M=r,_=0,E=i;"string"==typeof m&&m===x&&(o=m,M=e.find(r,[o,o]),_=e.convert(0,o),E=e.find(i,[o,o]));var S=f&&g?[]:void 0,A=[],k=[],z=f&&g?[]:void 0,O=f&&g?[]:void 0,C=[],T=[];for(a=0;a<N;a++){k[a]=A.length;var F=a+1;for(c=p[a],h=p[a+1],u=c;u<h;u++)s=l[u],A.push(s),C[s]=F,z&&(z[s]=f[u]);for(c=y[a],h=y[a+1],u=c;u<h;u++)if(C[s=v[u]]===F){if(z){var I=E(z[s],g[u]);M(I,_)?C[s]=null:z[s]=I}}else A.push(s),T[s]=F,O&&(O[s]=g[u]);if(z&&O)for(u=k[a];u<A.length;)C[s=A[u]]===F?(S[u]=z[s],u++):T[s]===F?(S[u]=O[s],u++):A.splice(u,1)}return k[N]=A.length,t.createSparseMatrix({values:S,index:A,ptr:k,size:[b,N],datatype:o})}}),rz=X("algorithm10",["typed","DenseMatrix"],t=>{var{typed:e,DenseMatrix:r}=t;return function(t,n,i,o){var s,a=t._values,u=t._index,c=t._ptr,h=t._size,f=t._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l=h[0],p=h[1],d=i;"string"==typeof f&&(s=f,n=e.convert(n,s),d=e.find(i,[s,s]));for(var m=[],g=[],v=[],y=0;y<p;y++){for(var w=y+1,x=c[y],b=c[y+1],N=x;N<b;N++){var M=u[N];g[M]=a[N],v[M]=w}for(var _=0;_<l;_++)0===y&&(m[_]=[]),v[_]===w?m[_][y]=o?d(n,g[_]):d(g[_],n):m[_][y]=n}return new r({data:m,size:[l,p],datatype:s})}}),rO=X("algorithm13",["typed"],t=>{var{typed:e}=t;return function(t,r,n){var i,o=t._data,s=t._size,a=t._datatype,u=r._data,c=r._size,h=r._datatype,f=[];if(s.length!==c.length)throw new tf(s.length,c.length);for(var l=0;l<s.length;l++){if(s[l]!==c[l])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");f[l]=s[l]}var p=n;"string"==typeof a&&a===h&&(i=a,p=e.find(n,[i,i]));var d=f.length>0?function t(e,r,n,i,o,s){var a=[];if(r===n.length-1)for(var u=0;u<i;u++)a[u]=e(o[u],s[u]);else for(var c=0;c<i;c++)a[c]=t(e,r+1,n,n[r+1],o[c],s[c]);return a}(p,0,f,f[0],o,u):[];return t.createDenseMatrix({data:d,size:f,datatype:i})}}),rC=X("algorithm14",["typed"],t=>{var{typed:e}=t;return function(t,r,n,i){var o,s=t._data,a=t._size,u=t._datatype,c=n;"string"==typeof u&&(o=u,r=e.convert(r,o),c=e.find(n,[o,o]));var h=a.length>0?function t(e,r,n,i,o,s,a){var u=[];if(r===n.length-1)for(var c=0;c<i;c++)u[c]=a?e(s,o[c]):e(o[c],s);else for(var h=0;h<i;h++)u[h]=t(e,r+1,n,n[r+1],o[h],s,a);return u}(c,0,a,a[0],s,r,i):[];return t.createDenseMatrix({data:h,size:U(a),datatype:o})}});function rT(t,e){var r;if(!Q(t)||!Q(e))throw Error("Parameters in function gcd must be integer numbers");for(;0!==e;)r=t%e,t=e,e=r;return t<0?-t:t}rT.signature="number, number";let{gcd:rF}=function t(e,r){var q,W,Q,tt=(0,n.Z)({},tM,r);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var te=(q={isNumber:i,isComplex:s,isBigNumber:o,isFraction:a,isUnit:u,isString:c,isArray:h,isMatrix:f,isCollection:l,isDenseMatrix:p,isSparseMatrix:d,isRange:m,isIndex:g,isBoolean:v,isResultSet:y,isHelp:w,isFunction:x,isDate:b,isRegExp:N,isObject:M,isNull:_,isUndefined:E,isAccessorNode:S,isArrayNode:A,isAssignmentNode:k,isBlockNode:z,isConditionalNode:O,isConstantNode:C,isFunctionAssignmentNode:T,isFunctionNode:F,isIndexNode:I,isNode:j,isObjectNode:P,isOperatorNode:R,isParenthesisNode:D,isRangeNode:Z,isSymbolNode:L,isChain:B},W=new J,q.on=W.on.bind(W),q.off=W.off.bind(W),q.once=W.once.bind(W),q.emit=W.emit.bind(W),q);te.config=function(t,e){function r(r){if(!r)return $(t,U);var n=$(t,U);tS(r,"matrix",t_),tS(r,"number",tE),function t(e,r){if(Array.isArray(r))throw TypeError("Arrays are not supported by deepExtend");for(var n in r)if(H(r,n)&&!(n in Object.prototype)&&!(n in Function.prototype)){if(r[n]&&r[n].constructor===Object)void 0===e[n]&&(e[n]={}),e[n]&&e[n].constructor===Object?t(e[n],r[n]):e[n]=r[n];else if(Array.isArray(r[n]))throw TypeError("Arrays are not supported by deepExtend");else e[n]=r[n]}return e}(t,r);var i=$(t,U);return e("config",i,n,$(r,U)),i}return r.MATRIX_OPTIONS=t_,r.NUMBER_OPTIONS=tE,Object.keys(tM).forEach(e=>{Object.defineProperty(r,e,{get:()=>t[e],enumerable:!0,configurable:!0})}),r}(tt,te.emit),te.expression={transform:{},mathWithTransform:{config:te.config}};var tr={},tn=function(t,e,r,n){function i(t,e){e&&"function"==typeof e.transform?(r.expression.transform[t]=e.transform,H(l,t)||(r.expression.mathWithTransform[t]=e.transform)):(delete r.expression.transform[t],H(l,t)||(r.expression.mathWithTransform[t]=e))}function c(t){return"function"==typeof t&&"object"==typeof t.signatures}function h(t){return void 0!==t&&void 0!==t.meta&&!0===t.meta.isTransformFunction}var l={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,p){var d=arguments.length;if(1!==d&&2!==d)throw new tN("import",d,1,2);p||(p={});var m={};for(var g in!function t(e,r,n){if(Array.isArray(r))r.forEach(r=>t(e,r));else if("object"==typeof r)for(var i in r)H(r,i)&&t(e,r[i],i);else if(K(r)||void 0!==n){var o=K(r)?h(r)?r.fn+".transform":r.fn:n;if(H(e,o)&&e[o]!==r&&!p.silent)throw Error('Cannot import "'+o+'" twice');e[o]=r}else if(!p.silent)throw TypeError("Factory, Object, or Array expected")}(m,e),m)if(H(m,g)){var v,y=m[g];if(K(y))!function(e,i){var o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.fn;if(tb(s,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(s));var a=h(e)?r.expression.transform:r,u=s in r.expression.transform,f=H(a,s)?a[s]:void 0,p=function(){var n={};e.dependencies.map(G).forEach(t=>{if(tb(t,"."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(t));"math"===t?n.math=r:"mathWithTransform"===t?n.mathWithTransform=r.expression.mathWithTransform:"classes"===t?n.classes=r:n[t]=r[t]});var o=e(n);if(o&&"function"==typeof o.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===f||i.override)return o;if(c(f)&&c(o))return t(f,o);if(i.silent)return f;throw Error('Cannot import "'+s+'": already exists')};e.meta&&!1===e.meta.lazy?a[s]=p():V(a,s,p),f&&u?function(t){delete r.expression.transform[t],H(l,t)?delete r.expression.mathWithTransform[t]:r.expression.mathWithTransform[t]=r[t]}(s):!h(e)&&(-1!==(o=e).fn.indexOf(".")||H(l,o.fn)||o.meta&&o.meta.isClass)||V(r.expression.mathWithTransform,s,()=>a[s]),n[s]=e,r.emit("import",s,p)}(y,p);else{if("function"==typeof(v=y)||"number"==typeof v||"string"==typeof v||"boolean"==typeof v||null===v||u(v)||s(v)||o(v)||a(v)||f(v)||Array.isArray(v))!function(e,o,s){var a;if(s.wrap&&"function"==typeof o&&(o=function(t){var e=function(){for(var e=[],n=0,i=arguments.length;n<i;n++){var o=arguments[n];e[n]=o&&o.valueOf()}return t.apply(r,e)};return t.transform&&(e.transform=t.transform),e}(o)),"function"==typeof(a=o)&&"string"==typeof a.signature&&(o=t(e,{[o.signature]:o})),c(r[e])&&c(o)){o=s.override?t(e,o.signatures):t(r[e],o),r[e]=o,delete n[e],i(e,o),r.emit("import",e,function(){return o});return}if(void 0===r[e]||s.override){r[e]=o,delete n[e],i(e,o),r.emit("import",e,function(){return o});return}if(!s.silent)throw Error('Cannot import "'+e+'": already exists')}(g,y,p);else if(!p.silent)throw TypeError("Factory, Object, or Array expected")}}}}(function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return te.typed.apply(te.typed,e)},0,te,tr);return te.import=tn,te.on("config",()=>{Y(tr).forEach(t=>{t&&t.meta&&t.meta.recreateOnConfigChange&&tn(t,{override:!0})})}),te.create=t.bind(null,e),te.factory=X,te.import(Y((function t(e,r){for(var n in e)if(H(e,n)){var i=e[n];"object"==typeof i&&null!==i?t(i,r):r[n]=i}}(e,Q={}),Q))),te.ArgumentsError=tN,te.DimensionError=tf,te.IndexError=tl,te}({gcdDependencies:{BigNumberDependencies:eJ,DenseMatrixDependencies:eK,equalScalarDependencies:rM,matrixDependencies:{DenseMatrixDependencies:eK,MatrixDependencies:eX,SparseMatrixDependencies:{MatrixDependencies:eX,equalScalarDependencies:rM,typedDependencies:rx,createSparseMatrixClass:r_},typedDependencies:rx,createMatrix:rS},typedDependencies:rx,createGcd:X("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:o}=t,s=rA({typed:e}),a=rk({typed:e,equalScalar:n}),u=rz({typed:e,DenseMatrix:o}),c=rO({typed:e}),h=rC({typed:e});return e("gcd",{"number, number":rT,"BigNumber, BigNumber":function(t,e){if(!t.isInt()||!e.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var r=new i(0);!e.isZero();){var n=t.mod(e);t=e,e=n}return t.lt(r)?t.neg():t},"Fraction, Fraction":function(t,e){return t.gcd(e)},"SparseMatrix, SparseMatrix":function(t,e){return a(t,e,this)},"SparseMatrix, DenseMatrix":function(t,e){return s(e,t,this,!0)},"DenseMatrix, SparseMatrix":function(t,e){return s(t,e,this,!1)},"DenseMatrix, DenseMatrix":function(t,e){return c(t,e,this)},"Array, Array":function(t,e){return this(r(t),r(e)).valueOf()},"Array, Matrix":function(t,e){return this(r(t),e)},"Matrix, Array":function(t,e){return this(t,r(e))},"SparseMatrix, number | BigNumber":function(t,e){return u(t,e,this,!1)},"DenseMatrix, number | BigNumber":function(t,e){return h(t,e,this,!1)},"number | BigNumber, SparseMatrix":function(t,e){return u(e,t,this,!0)},"number | BigNumber, DenseMatrix":function(t,e){return h(e,t,this,!0)},"Array, number | BigNumber":function(t,e){return h(r(t),e,this,!1).valueOf()},"number | BigNumber, Array":function(t,e){return h(r(e),t,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(t,e,r){for(var n=this(t,e),i=0;i<r.length;i++)n=this(n,r[i]);return n}})})}});function rI(t,e){let r=e.startMs,n=t.values,i=[];for(let t of n){for(;r<t[0];)i.push([r,null]),r+=e.stepMs;i.push([r,t[1]]),r+=e.stepMs}for(;r<=e.endMs;)i.push([r,null]),r+=e.stepMs;return i}function rj(t){let e,r;let n=[];for(let e of t)if(e&&"timeRange"in e){if(void 0===e||void 0===e.timeRange||void 0===e.stepMs)continue;if(n.push(e.stepMs),void 0===r){r=e.timeRange;continue}e.timeRange.start<r.start&&(r.start=e.timeRange.start),e.timeRange.end>r.end&&(r.end=e.timeRange.end)}else if(e&&"values"in e){for(let t=0;t<e.values.length;t++){let n=e.values[t];if(void 0===n)continue;let[i]=n,o=new Date(i),s=new Date(i);if(void 0===r){r={start:o,end:s};continue}o<r.start&&(r.start=o),s>r.end&&(r.end=s)}if(void 0===r)return;let t=r.start.valueOf(),n=r.end.valueOf(),i=n-t;return{startMs:t,endMs:n,rangeMs:i,stepMs:10}}if(void 0===r)return;if(1===n.length)e=n[0];else{let t=rF(...n);e=t<10?10:t}let i=r.start.valueOf(),o=r.end.valueOf();return{startMs:i,endMs:o,stepMs:e,rangeMs:o-i}}},83915:function(t,e,r){"use strict";r.d(e,{Z:()=>F});var n,i,o,s,a,u,c,h,f,l,p,d,m,g,v,y,w,x,b=function(t,e,r){if(!e.has(t))throw TypeError("attempted to set private field on non-instance");return e.set(t,r),r},N=function(t,e){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return e.get(t)};let M=function(t){var e=0;t+="x";var r=Math.floor(65745979961613.07);for(let n=0;n<t.length;n++)e>r&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(n);return e},_="0123456789abcdef".split(""),E=[-0x80000000,8388608,32768,128],S=[24,16,8,0],A=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2],k=[];class z{constructor(t=!1,e=!1){n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),s.set(this,void 0),a.set(this,void 0),u.set(this,void 0),c.set(this,void 0),h.set(this,void 0),f.set(this,void 0),l.set(this,void 0),p.set(this,void 0),d.set(this,void 0),m.set(this,void 0),g.set(this,void 0),v.set(this,void 0),y.set(this,void 0),w.set(this,0),x.set(this,void 0),this.init(t,e)}init(t,e){e?(k[0]=k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0,b(this,i,k)):b(this,i,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(b(this,u,0xc1059ed8),b(this,c,0x367cd507),b(this,h,0x3070dd17),b(this,f,0xf70e5939),b(this,l,0xffc00b31),b(this,p,0x68581511),b(this,d,0x64f98fa7),b(this,m,0xbefa4fa4)):(b(this,u,0x6a09e667),b(this,c,0xbb67ae85),b(this,h,0x3c6ef372),b(this,f,0xa54ff53a),b(this,l,0x510e527f),b(this,p,0x9b05688c),b(this,d,0x1f83d9ab),b(this,m,0x5be0cd19)),b(this,n,b(this,x,b(this,o,b(this,v,0)))),b(this,s,b(this,g,!1)),b(this,a,!0),b(this,y,t)}update(t){let e;if(N(this,s))return this;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let r=0,a=e.length,u=N(this,i);for(;r<a;){let t;if(N(this,g)&&(b(this,g,!1),u[0]=N(this,n),u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),"string"!=typeof e)for(t=N(this,x);r<a&&t<64;++r)u[t>>2]|=e[r]<<S[3&t++];else for(t=N(this,x);r<a&&t<64;++r){let n=e.charCodeAt(r);n<128?u[t>>2]|=n<<S[3&t++]:(n<2048?u[t>>2]|=(192|n>>6)<<S[3&t++]:(n<55296||n>=57344?u[t>>2]|=(224|n>>12)<<S[3&t++]:(n=65536+((1023&n)<<10|1023&e.charCodeAt(++r)),u[t>>2]|=(240|n>>18)<<S[3&t++],u[t>>2]|=(128|n>>12&63)<<S[3&t++]),u[t>>2]|=(128|n>>6&63)<<S[3&t++]),u[t>>2]|=(128|63&n)<<S[3&t++])}b(this,w,t),b(this,o,N(this,o)+(t-N(this,x))),t>=64?(b(this,n,u[16]),b(this,x,t-64),this.hash(),b(this,g,!0)):b(this,x,t)}return N(this,o)>0xffffffff&&(b(this,v,N(this,v)+(N(this,o)/0x100000000<<0)),b(this,o,N(this,o)%0x100000000)),this}finalize(){if(N(this,s))return;b(this,s,!0);let t=N(this,i),e=N(this,w);t[16]=N(this,n),t[e>>2]|=E[3&e],b(this,n,t[16]),e>=56&&(N(this,g)||this.hash(),t[0]=N(this,n),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=N(this,v)<<3|N(this,o)>>>29,t[15]=N(this,o)<<3,this.hash()}hash(){let t,e,r,n,o,s,g,v,w,x,M=N(this,u),_=N(this,c),E=N(this,h),S=N(this,f),k=N(this,l),z=N(this,p),O=N(this,d),C=N(this,m),T=N(this,i);for(let r=16;r<64;++r)t=((n=T[r-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,e=((n=T[r-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,T[r]=T[r-16]+t+T[r-7]+e<<0;x=_&E;for(let i=0;i<64;i+=4)N(this,a)?(N(this,y)?(g=300032,C=(n=T[0]-0x543c9a5b)-0x8f1a6c7<<0,S=n+0x170e9b5<<0):(g=0x2a01a605,C=(n=T[0]-0xc881298)-0x5ab00ac6<<0,S=n+0x8909ae5<<0),b(this,a,!1)):(t=(M>>>2|M<<30)^(M>>>13|M<<19)^(M>>>22|M<<10),e=(k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7),r=(g=M&_)^M&E^x,n=C+e+(k&z^~k&O)+A[i]+T[i],o=t+r,C=S+n<<0,S=n+o<<0),t=(S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10),e=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),r=(v=S&M)^S&_^g,n=O+e+(C&k^~C&z)+A[i+1]+T[i+1],o=t+r,O=E+n<<0,t=((E=n+o<<0)>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),e=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),r=(w=E&S)^E&M^v,n=z+e+(O&C^~O&k)+A[i+2]+T[i+2],o=t+r,z=_+n<<0,t=((_=n+o<<0)>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10),e=(z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7),r=(x=_&E)^_&S^w,n=k+e+(z&O^~z&C)+A[i+3]+T[i+3],o=t+r,k=M+n<<0,M=n+o<<0;b(this,u,N(this,u)+M<<0),b(this,c,N(this,c)+_<<0),b(this,h,N(this,h)+E<<0),b(this,f,N(this,f)+S<<0),b(this,l,N(this,l)+k<<0),b(this,p,N(this,p)+z<<0),b(this,d,N(this,d)+O<<0),b(this,m,N(this,m)+C<<0)}hex(){this.finalize();let t=N(this,u),e=N(this,c),r=N(this,h),n=N(this,f),i=N(this,l),o=N(this,p),s=N(this,d),a=N(this,m),g=_[t>>28&15]+_[t>>24&15]+_[t>>20&15]+_[t>>16&15]+_[t>>12&15]+_[t>>8&15]+_[t>>4&15]+_[15&t]+_[e>>28&15]+_[e>>24&15]+_[e>>20&15]+_[e>>16&15]+_[e>>12&15]+_[e>>8&15]+_[e>>4&15]+_[15&e]+_[r>>28&15]+_[r>>24&15]+_[r>>20&15]+_[r>>16&15]+_[r>>12&15]+_[r>>8&15]+_[r>>4&15]+_[15&r]+_[n>>28&15]+_[n>>24&15]+_[n>>20&15]+_[n>>16&15]+_[n>>12&15]+_[n>>8&15]+_[n>>4&15]+_[15&n]+_[i>>28&15]+_[i>>24&15]+_[i>>20&15]+_[i>>16&15]+_[i>>12&15]+_[i>>8&15]+_[i>>4&15]+_[15&i]+_[o>>28&15]+_[o>>24&15]+_[o>>20&15]+_[o>>16&15]+_[o>>12&15]+_[o>>8&15]+_[o>>4&15]+_[15&o]+_[s>>28&15]+_[s>>24&15]+_[s>>20&15]+_[s>>16&15]+_[s>>12&15]+_[s>>8&15]+_[s>>4&15]+_[15&s];return N(this,y)||(g+=_[a>>28&15]+_[a>>24&15]+_[a>>20&15]+_[a>>16&15]+_[a>>12&15]+_[a>>8&15]+_[a>>4&15]+_[15&a]),g}toString(){return this.hex()}digest(){this.finalize();let t=N(this,u),e=N(this,c),r=N(this,h),n=N(this,f),i=N(this,l),o=N(this,p),s=N(this,d),a=N(this,m),g=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,s>>24&255,s>>16&255,s>>8&255,255&s];return N(this,y)||g.push(a>>24&255,a>>16&255,a>>8&255,255&a),g}array(){return this.digest()}arrayBuffer(){this.finalize();let t=new ArrayBuffer(N(this,y)?28:32),e=new DataView(t);return e.setUint32(0,N(this,u)),e.setUint32(4,N(this,c)),e.setUint32(8,N(this,h)),e.setUint32(12,N(this,f)),e.setUint32(16,N(this,l)),e.setUint32(20,N(this,p)),e.setUint32(24,N(this,d)),N(this,y)||e.setUint32(28,N(this,m)),t}}function O(t){let e=new z;return e.update(t),parseInt(e.hex().substring(0,8),16)}n=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap,a=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,f=new WeakMap,l=new WeakMap,p=new WeakMap,d=new WeakMap,m=new WeakMap,g=new WeakMap,v=new WeakMap,y=new WeakMap,w=new WeakMap,x=new WeakMap;let C=function(t){var e="#";return t.forEach(function(t){t<16&&(e+=0),e+=t.toString(16)}),e},T=function(t,e,r){var n=r<.5?r*(1+e):r+e-r*e,i=2*r-n;return[(t/=360)+1/3,t,t-1/3].map(function(t){return t<0&&t++,t>1&&t--,Math.round(255*(t=t<1/6?i+(n-i)*6*t:t<.5?n:t<2/3?i+(n-i)*6*(2/3-t):i))})};class F{constructor(t={}){let[e,r]=[t.lightness,t.saturation].map(function(t){return Array.isArray(t=void 0!==t?t:[.35,.5,.65])?t.concat():[t]});this.L=e,this.S=r,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map(function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}}),this.hash=O,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=M)}hsl(t){var e,r,n=this.hash(t);if(this.hueRanges.length){let t=this.hueRanges[n%this.hueRanges.length];e=n/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=n%359;return n=Math.ceil(n/360),r=this.S[n%this.S.length],n=Math.ceil(n/this.S.length),[e,r,this.L[n%this.L.length]]}rgb(t){var e=this.hsl(t);return T.apply(this,e)}hex(t){return C(this.rgb(t))}}},8317:function(t){function e(){}e.prototype={on:function(t,e,r){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var n=this;function i(){n.off(t,i),e.apply(r,arguments)}return i._=e,this.on(t,i,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,e);return this},off:function(t,e){var r=this.e||(this.e={}),n=r[t],i=[];if(n&&e)for(var o=0,s=n.length;o<s;o++)n[o].fn!==e&&n[o].fn._!==e&&i.push(n[o]);return i.length?r[t]=i:delete r[t],this}},t.exports=e,t.exports.TinyEmitter=e},27554:function(t){"use strict";var e;e=function(){function t(){return!0}function e(){return!1}function r(){}return function n(){var i=[{name:"number",test:function(t){return"number"==typeof t}},{name:"string",test:function(t){return"string"==typeof t}},{name:"boolean",test:function(t){return"boolean"==typeof t}},{name:"Function",test:function(t){return"function"==typeof t}},{name:"Array",test:Array.isArray},{name:"Date",test:function(t){return t instanceof Date}},{name:"RegExp",test:function(t){return t instanceof RegExp}},{name:"Object",test:function(t){return"object"==typeof t&&null!==t&&t.constructor===Object}},{name:"null",test:function(t){return null===t}},{name:"undefined",test:function(t){return void 0===t}}],o={name:"any",test:t},s=[],a=[],u={types:i,conversions:a,ignore:s};function c(t){var e=P(u.types,function(e){return e.name===t});if(e)return e;if("any"===t)return o;var r=P(u.types,function(e){return e.name.toLowerCase()===t.toLowerCase()});throw TypeError('Unknown type "'+t+'"'+(r?'. Did you mean "'+r.name+'"?':""))}function h(t){return t===o?999:u.types.indexOf(t)}function f(t){var e=P(u.types,function(e){return e.test(t)});if(e)return e.name;throw TypeError("Value has unknown type. Value: "+t)}function l(t){return t.map(function(t){var e=t.types.map(y);return(t.restParam?"...":"")+e.join("|")}).join(",")}function p(t){var e=I(t);return!!e&&e.restParam}function d(t){return t.types.some(function(t){return null!=t.conversion})}function m(e){if(!e||0===e.types.length)return t;if(1===e.types.length)return c(e.types[0].name).test;if(2===e.types.length){var r=c(e.types[0].name).test,n=c(e.types[1].name).test;return function(t){return r(t)||n(t)}}var i=e.types.map(function(t){return c(t.name).test});return function(t){for(var e=0;e<i.length;e++)if(i[e](t))return!0;return!1}}function g(t,e){return e<t.params.length?t.params[e]:p(t.params)?I(t.params):null}function v(t,e,r){var n=g(t,e);return(n?r?n.types.filter(w):n.types:[]).map(y)}function y(t){return t.name}function w(t){return null===t.conversion||void 0===t.conversion}function x(t,e){var r=function(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return Object.keys(e)}(R(t,function(t){return v(t,e,!1)}));return -1!==r.indexOf("any")?["any"]:r}function b(t,e,r){var n,i,o,s=t||"unnamed",a=r;for(o=0;o<e.length;o++){var u=a.filter(function(t){var r=m(g(t,o));return(o<t.params.length||p(t.params))&&r(e[o])});if(0===u.length){if((i=x(a,o)).length>0){var c=f(e[o]);return(n=TypeError("Unexpected type of argument in function "+s+" (expected: "+i.join(" or ")+", actual: "+c+", index: "+o+")")).data={category:"wrongType",fn:s,index:o,actual:c,expected:i},n}}else a=u}var h=a.map(function(t){return p(t.params)?1/0:t.params.length});if(e.length<Math.min.apply(null,h))return(n=TypeError("Too few arguments in function "+s+" (expected: "+(i=x(a,o)).join(" or ")+", index: "+e.length+")")).data={category:"tooFewArgs",fn:s,index:e.length,expected:i},n;var l=Math.max.apply(null,h);return e.length>l?(n=TypeError("Too many arguments in function "+s+" (expected: "+l+", actual: "+e.length+")")).data={category:"tooManyArgs",fn:s,index:e.length,expectedLength:l}:(n=TypeError('Arguments of type "'+e.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:e.map(f)},n}function N(t){for(var e=999,r=0;r<t.types.length;r++)w(t.types[r])&&(e=Math.min(e,t.types[r].typeIndex));return e}function M(t){for(var e=999,r=0;r<t.types.length;r++)w(t.types[r])||(e=Math.min(e,t.types[r].conversionIndex));return e}function _(t,e){var r,n,i=Math.min(t.params.length,e.params.length);if(0!=(n=t.params.some(d)-e.params.some(d)))return n;for(r=0;r<i;r++)if(0!=(n=d(t.params[r])-d(e.params[r])))return n;for(r=0;r<i;r++)if(0!==(n=function(t,e){var r;return 0!=(r=t.restParam-e.restParam)||0!=(r=d(t)-d(e))||0!=(r=N(t)-N(e))?r:M(t)-M(e)}(t.params[r],e.params[r])))return n;return t.params.length-e.params.length}function E(t){var e,r,n,i,o=[],s=[];switch(t.types.forEach(function(t){t.conversion&&(o.push(c(t.conversion.from).test),s.push(t.conversion.convert))}),s.length){case 0:return function(t){return t};case 1:return e=o[0],n=s[0],function(t){return e(t)?n(t):t};case 2:return e=o[0],r=o[1],n=s[0],i=s[1],function(t){return e(t)?n(t):r(t)?i(t):t};default:return function(t){for(var e=0;e<s.length;e++)if(o[e](t))return s[e](t);return t}}}function S(t,e){return function t(r,n,i){if(!(n<r.length))return[i.map(function(t,e){return{types:t,restParam:e===r.length-1&&p(r)}})];var o,s=r[n],a=e?s.types.filter(w):s.types;if(s.restParam){var u=a.filter(w);o=u.length<a.length?[u,a]:[a]}else o=a.map(function(t){return[t]});return R(o,function(e){return t(r,n+1,i.concat([e]))})}(t,0,[])}function A(t,n){if(0===Object.keys(n).length)throw SyntaxError("No signatures provided");var i,o=[];Object.keys(n).map(function(t){var e,r,i;return e=n[t],r=u.conversions,i=[],(""!==t.trim()&&(i=t.split(",").map(O).map(function(t,e,n){var i,o,s,a,u,f,l,p,d=(i=r,o=u=((a=0===t.indexOf("..."))?t.length>3?t.slice(3):"any":t).split("|").map(O).filter(C).filter(z),s={},i.forEach(function(t){-1!==o.indexOf(t.from)||-1===o.indexOf(t.to)||s[t.from]||(s[t.from]=t)}),f=Object.keys(s).map(function(t){return s[t]}),l=u.map(function(t){var e=c(t);return{name:t,typeIndex:h(e),test:e.test,conversion:null,conversionIndex:-1}}),p=f.map(function(t){var e=c(t.from);return{name:t.from,typeIndex:h(e),test:e.test,conversion:t,conversionIndex:r.indexOf(t)}}),{types:l.concat(p),restParam:a});if(d.restParam&&e!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+t+'": only allowed for the last parameter');return d})),i.some(F))?null:{params:i,fn:e}}).filter(T).forEach(function(t){var e=P(o,function(e){return function(t,e){for(var r=Math.max(t.params.length,e.params.length),n=0;n<r;n++)if(!function(t,e){for(var r,n=0;n<t.length;n++)if(r=t[n],-1!==e.indexOf(r))return!0;return!1}(v(t,n,!0),v(e,n,!0)))return!1;var i=t.params.length,o=e.params.length,s=p(t.params),a=p(e.params);return s?a?i===o:o>=i:a?i>=o:i===o}(e,t)});if(e)throw TypeError('Conflicting signatures "'+l(e.params)+'" and "'+l(t.params)+'".');o.push(t)});var s=R(o,function(t){return(t?S(t.params,!1):[]).map(function(e){return{params:e,fn:t.fn}})}).filter(T);s.sort(_);var a=s[0]&&s[0].params.length<=2&&!p(s[0].params),f=s[1]&&s[1].params.length<=2&&!p(s[1].params),g=s[2]&&s[2].params.length<=2&&!p(s[2].params),y=s[3]&&s[3].params.length<=2&&!p(s[3].params),w=s[4]&&s[4].params.length<=2&&!p(s[4].params),x=s[5]&&s[5].params.length<=2&&!p(s[5].params),b=s.map(function(t){return function(t){var e,r,n;if(p(t)){var i,o=(e=(i=t).slice(0,i.length-1).map(m)).length,s=m(I(t)),a=function(t){for(var e=o;e<t.length;e++)if(!s(t[e]))return!1;return!0};return function(t){for(var r=0;r<e.length;r++)if(!e[r](t[r]))return!1;return a(t)&&t.length>=o+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(r=m(t[0]),function(t){return r(t[0])&&1===t.length}):2===t.length?(r=m(t[0]),n=m(t[1]),function(t){return r(t[0])&&n(t[1])&&2===t.length}):(e=t.map(m),function(t){for(var r=0;r<e.length;r++)if(!e[r](t[r]))return!1;return t.length===e.length})}(t.params)}),N=a?m(s[0].params[0]):e,M=f?m(s[1].params[0]):e,A=g?m(s[2].params[0]):e,k=y?m(s[3].params[0]):e,D=w?m(s[4].params[0]):e,Z=x?m(s[5].params[0]):e,L=a?m(s[0].params[1]):e,B=f?m(s[1].params[1]):e,q=g?m(s[2].params[1]):e,U=y?m(s[3].params[1]):e,$=w?m(s[4].params[1]):e,W=x?m(s[5].params[1]):e,V=s.map(function(t){return function(t,e){var r=e;if(t.some(d)){var n=p(t),i=t.map(E);r=function(){for(var t=[],r=n?arguments.length-1:arguments.length,o=0;o<r;o++)t[o]=i[o](arguments[o]);return n&&(t[r]=arguments[r].map(i[r])),e.apply(this,t)}}var o=r;if(p(t)){var s=t.length-1;o=function(){return r.apply(this,j(arguments,0,s).concat([j(arguments,s)]))}}return o}(t.params,t.fn)}),H=a?V[0]:r,Y=f?V[1]:r,J=g?V[2]:r,X=y?V[3]:r,K=w?V[4]:r,G=x?V[5]:r,Q=a?s[0].params.length:-1,tt=f?s[1].params.length:-1,te=g?s[2].params.length:-1,tr=y?s[3].params.length:-1,tn=w?s[4].params.length:-1,ti=x?s[5].params.length:-1,to=6*!!(a&&f&&g&&y&&w&&x),ts=s.length,ta=function(){for(var e=to;e<ts;e++)if(b[e](arguments))return V[e].apply(this,arguments);return u.onMismatch(t,arguments,s)},tu=function t(e,r){return arguments.length===Q&&N(e)&&L(r)?H.apply(t,arguments):arguments.length===tt&&M(e)&&B(r)?Y.apply(t,arguments):arguments.length===te&&A(e)&&q(r)?J.apply(t,arguments):arguments.length===tr&&k(e)&&U(r)?X.apply(t,arguments):arguments.length===tn&&D(e)&&$(r)?K.apply(t,arguments):arguments.length===ti&&Z(e)&&W(r)?G.apply(t,arguments):ta.apply(t,arguments)};try{Object.defineProperty(tu,"name",{value:t})}catch(t){}return tu.signatures=(i={},s.forEach(function(t){t.params.some(d)||S(t.params,!0).forEach(function(e){i[l(e)]=t.fn})}),i),tu}function k(t,e,r){throw b(t,e,r)}function z(t){return -1===u.ignore.indexOf(t)}function O(t){return t.trim()}function C(t){return!!t}function T(t){return null!==t}function F(t){return 0===t.types.length}function I(t){return t[t.length-1]}function j(t,e,r){return Array.prototype.slice.call(t,e,r)}function P(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return t[r]}function R(t,e){return Array.prototype.concat.apply([],t.map(e))}function D(t){for(var e="",r=0;r<t.length;r++){var n=t[r];if(("object"==typeof n.signatures||"string"==typeof n.signature)&&""!==n.name){if(""===e)e=n.name;else if(e!==n.name){var i=Error("Function names do not match (expected: "+e+", actual: "+n.name+")");throw i.data={actual:n.name,expected:e},i}}}return e}function Z(t){var e,r={};function n(t,n){if(r.hasOwnProperty(t)&&n!==r[t])throw(e=Error('Signature "'+t+'" is defined twice')).data={signature:t},e}for(var i=0;i<t.length;i++){var o=t[i];if("object"==typeof o.signatures)for(var s in o.signatures)o.signatures.hasOwnProperty(s)&&(n(s,o.signatures[s]),r[s]=o.signatures[s]);else if("string"==typeof o.signature)n(o.signature,o),r[o.signature]=o;else throw(e=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},e}return r}return(u=A("typed",{"string, Object":A,Object:function(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(t[r]);return A(D(e),t)},"...Function":function(t){return A(D(t),Z(t))},"string, ...Function":function(t,e){return A(t,Z(e))}})).create=n,u.types=i,u.conversions=a,u.ignore=s,u.onMismatch=k,u.throwMismatchError=k,u.createError=b,u.convert=function(t,e){var r=f(t);if(e===r)return t;for(var n=0;n<u.conversions.length;n++){var i=u.conversions[n];if(i.from===r&&i.to===e)return i.convert(t)}throw Error("Cannot convert from "+r+" to "+e)},u.find=function(t,e){if(!t.signatures)throw TypeError("Function is no typed-function");if("string"==typeof e){r=e.split(",");for(var r,n=0;n<r.length;n++)r[n]=r[n].trim()}else if(Array.isArray(e))r=e;else throw TypeError("String array or a comma separated string expected");var i=r.join(","),o=t.signatures[i];if(o)return o;throw TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+r.join(", ")+"))")},u.addType=function(t,e){if(!t||"string"!=typeof t.name||"function"!=typeof t.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==e){for(var r=0;r<u.types.length;r++)if("Object"===u.types[r].name){u.types.splice(r,0,t);return}}u.types.push(t)},u.addConversion=function(t){if(!t||"string"!=typeof t.from||"string"!=typeof t.to||"function"!=typeof t.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");u.conversions.push(t)},u}()},"function"==typeof define&&define.amd?define([],e):t.exports=e()}}]);