st-comp 0.0.69 → 0.0.71

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 (90) hide show
  1. package/lib/ChartLayout.cjs.js +1 -0
  2. package/lib/ChartLayout.es.js +71 -0
  3. package/lib/Dialog.cjs.js +1 -0
  4. package/lib/Dialog.es.js +89 -0
  5. package/lib/HeatMap.cjs.js +1 -0
  6. package/lib/HeatMap.es.js +117 -0
  7. package/lib/Kline.cjs.js +1 -0
  8. package/lib/Kline.es.js +2631 -0
  9. package/lib/KlineNew.cjs.js +1 -0
  10. package/lib/KlineNew.es.js +614 -0
  11. package/lib/LinearLegend.cjs.js +1 -0
  12. package/lib/LinearLegend.es.js +62 -0
  13. package/lib/Map.cjs.js +1 -0
  14. package/lib/{bundle.js → Map.es.js} +43 -41504
  15. package/lib/Pagination.cjs.js +1 -0
  16. package/lib/Pagination.es.js +624 -0
  17. package/lib/Pie.cjs.js +2 -0
  18. package/lib/Pie.es.js +159 -0
  19. package/lib/Table.cjs.js +20 -0
  20. package/lib/Table.es.js +4006 -0
  21. package/lib/TreeMap.cjs.js +2 -0
  22. package/lib/TreeMap.es.js +162 -0
  23. package/lib/VarietySearch.cjs.js +12 -0
  24. package/lib/VarietySearch.es.js +3335 -0
  25. package/lib/VirtualTable.cjs.js +13 -0
  26. package/lib/VirtualTable.es.js +2679 -0
  27. package/lib/_commonjsHelpers-10dfc225.js +8 -0
  28. package/lib/_commonjsHelpers-87b0abe8.cjs +1 -0
  29. package/lib/_plugin-vue_export-helper-dad06003.js +9 -0
  30. package/lib/_plugin-vue_export-helper-f246444f.cjs +1 -0
  31. package/lib/base-4865d432.cjs +9 -0
  32. package/lib/base-a240bf62.js +762 -0
  33. package/lib/bundle.cjs.js +1 -0
  34. package/lib/bundle.es.js +46 -0
  35. package/lib/bundle.umd-4967d574.js +16091 -0
  36. package/lib/bundle.umd-c5698c50.cjs +71 -0
  37. package/lib/castArray-3341cbb4.cjs +1 -0
  38. package/lib/castArray-a723a736.js +10 -0
  39. package/lib/config-provider-3db4dac6.js +148 -0
  40. package/lib/config-provider-cf4edc1e.cjs +1 -0
  41. package/lib/el-button-c24606d0.cjs +1 -0
  42. package/lib/el-button-fa6a5742.js +231 -0
  43. package/lib/el-empty-282e5e93.js +204 -0
  44. package/lib/el-empty-608948d9.cjs +1 -0
  45. package/lib/el-icon-7718f55e.cjs +1 -0
  46. package/lib/el-icon-d9ef9ccc.js +592 -0
  47. package/lib/el-overlay-7fceb816.cjs +5 -0
  48. package/lib/el-overlay-9b7bdd18.js +678 -0
  49. package/lib/el-scrollbar-7dc53299.js +248 -0
  50. package/lib/el-scrollbar-bc381e35.cjs +1 -0
  51. package/lib/el-select-85ed2643.js +1894 -0
  52. package/lib/el-select-a50741c1.cjs +9 -0
  53. package/lib/el-tag-308f715a.js +2416 -0
  54. package/lib/el-tag-87fd3960.cjs +1 -0
  55. package/lib/el-tooltip-0ea8fbf8.cjs +1 -0
  56. package/lib/el-tooltip-4ed993c7.js +1 -0
  57. package/lib/focus-trap-2a734f35.cjs +3 -0
  58. package/lib/focus-trap-6922b96b.js +376 -0
  59. package/lib/index-1508a06b.js +556 -0
  60. package/lib/index-48a9f60d.cjs +1 -0
  61. package/lib/index-657047bb.js +513 -0
  62. package/lib/index-eea0bcb3.cjs +1 -0
  63. package/lib/index.esm-8d9a2abe.js +2432 -0
  64. package/lib/index.esm-94a95a2a.cjs +3 -0
  65. package/lib/raf-5e5c53db.cjs +1 -0
  66. package/lib/raf-fc8a56cf.js +6 -0
  67. package/lib/scroll-bb8039ba.cjs +1 -0
  68. package/lib/scroll-cfdae01b.js +35 -0
  69. package/lib/style.css +1 -1
  70. package/lib/typescript-7ae59c4c.js +4 -0
  71. package/lib/typescript-b63f8e83.cjs +1 -0
  72. package/lib/vnode-a9714179.js +14 -0
  73. package/lib/vnode-abafec9e.cjs +1 -0
  74. package/lib/zh-cn-92978806.js +134 -0
  75. package/lib/zh-cn-d4df7172.cjs +1 -0
  76. package/package.json +3 -3
  77. package/packages/ChartLayout/index.ts +5 -5
  78. package/packages/Dialog/index.ts +5 -5
  79. package/packages/HeatMap/index.ts +5 -5
  80. package/packages/Kline/componentsNew/KlineUtils/index.vue +2 -3
  81. package/packages/LinearLegend/index.ts +5 -5
  82. package/packages/Map/index.ts +5 -5
  83. package/packages/Pagination/index.ts +5 -5
  84. package/packages/Pie/index.ts +5 -5
  85. package/packages/Table/index.ts +5 -5
  86. package/packages/TreeMap/index.ts +5 -5
  87. package/packages/VarietySearch/index.ts +5 -5
  88. package/packages/VirtualTable/index.ts +5 -5
  89. package/vitePlugins/createExportFile.ts +5 -5
  90. package/lib/bundle.umd.cjs +0 -139
@@ -0,0 +1,71 @@
1
+ "use strict";const Po=require("./_commonjsHelpers-87b0abe8.cjs");var Uo={exports:{}};(function(S6,Fd){(function(ct,Da){Da(Fd)})(Po.commonjsGlobal,function(ct){var Da=Object.defineProperty,Cd=(e,r,n)=>r in e?Da(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,Zt=(e,r,n)=>(Cd(e,typeof r!="symbol"?r+"":r,n),n);const Bd=(e,r,n=null)=>{localStorage.setItem(`expires-${e}`,JSON.stringify({value:r,expires:n}))},Od=e=>{const r=localStorage.getItem(`expires-${e}`);if(!r)return null;const{value:n,expires:t}=JSON.parse(r);return t===null||new Date().getTime()<t?n:(localStorage.removeItem(`expires-${e}`),null)},Td=e=>{localStorage.removeItem(`expires-${e}`)},xr=(e,r)=>{let n=e.length;return r<=1||r>n?new Array(n).fill(null):[...new Array(r-1).fill(null),...e.slice(0,n-r+1)]},li=e=>{const r=e.reduce((t,i)=>t+i,0)/e.length,n=e.map(t=>Math.pow(t-r,2)).reduce((t,i)=>t+i,0)/e.length;return Math.sqrt(n)},ci=(e,r)=>[...new Array(r).fill(null),...e.slice(0,e.length-r)],_d=e=>{const r=e.reduce((n,t)=>n+t,0)/e.length;return e.reduce((n,t)=>n+Math.abs(t-r),0)/e.length},Lo=(e,r,n)=>{const t=[(e[0]*n+e[0]*(r-n))/r];for(let i=1;i<e.length;i++)t[i]=(e[i]*n+t[i-1]*(r-n))/r;return t},Id=(e,r)=>{const n=Number(e.substr(1).split("天")[0]),t=e.split(" ")[1],i=Number(r.substr(1).split("天")[0]),a=r.split(" ")[1],o=new Date().getFullYear(),f=new Date(`${o} ${t}`),c=new Date(`${o} ${a}`);let u=0,s=0;return[["20:00:00","24:00:00"],["00:00:00","03:00:00"],["03:00:00","20:00:00"]].forEach((l,p)=>{f>=new Date(`${o} ${l[0]}`)&&f<=new Date(`${o} ${l[1]}`)&&(u=p),c>=new Date(`${o} ${l[0]}`)&&c<=new Date(`${o} ${l[1]}`)&&(s=p)}),n>i?!0:n<i?!1:u===s?f>=c:u>=s},Aa=(e,r,n)=>{const t=new Array(e.length).fill(null);t[e.length-1]=n[r.length-1];let i=e.length-2,a=r.length-2;for(;i>=0&&a>=0;)(e[i].startsWith("第")&&!Id(e[i],r[a])||new Date(e[i])<new Date(r[a]))&&(a+=-1),t[i]=n[a],i+=-1;return t},Ea=(e,r,n)=>{const t=new Array(e.length).fill(null);t[e.length-1]=n[r.length-1];let i=e.length-2,a=r.length-1;for(;i>=0&&a>=0;)!e[i].startsWith("第")&&new Date(`${e[i].split(" ")[0]} 00:00:00`)>=new Date(`${r[a].split(" ")[0]} 00:00:00`)||e[i].startsWith("第")&&Number(e[i].split("天")[0].split("第")[1])>=Number(r[a].split("天")[0].split("第")[1])||(a+=-1),t[i]=n[a-1],i+=-1;return t},Ee={DKX:(e,r)=>{const{open:n,close:t,high:i,low:a}=r,o=n.map((c,u)=>(t[u]*3+i[u]+a[u]+c)/6),{output:f}=e.WMA({inReal:o,timePeriod:20});return xr(f,20)},MADKX:(e,r)=>{const{open:n,close:t,high:i,low:a}=r,o=n.map((u,s)=>(t[s]*3+i[s]+a[s]+u)/6),f=e.WMA({inReal:o,timePeriod:20}),{output:c}=e.SMA({inReal:f.output,timePeriod:10});return xr(c,29)},EMA:(e,r,n)=>{const{close:t}=r,{output:i}=e.EMA({inReal:t,timePeriod:n});return xr(i,n)},HHV:(e,r,n)=>{const{high:t}=r,{output:i}=e.MAX({inReal:t,timePeriod:n});return xr(i,n)},LLV:(e,r,n)=>{const{high:t}=r,{output:i}=e.MIN({inReal:t,timePeriod:n});return xr(i,n)},MA:(e,r,n)=>{const{close:t}=r,{output:i}=e.SMA({inReal:t,timePeriod:n});return xr(i,n)},BBI:(e,r)=>{const n=Ee.MA(e,r,3),t=Ee.MA(e,r,6),i=Ee.MA(e,r,12),a=Ee.MA(e,r,24);return n.map((o,f)=>(o+t[f]+i[f]+a[f])/4)},BBIBOLL:(e,r)=>{const n=Ee.MA(e,r,3),t=Ee.MA(e,r,6),i=Ee.MA(e,r,12),a=Ee.MA(e,r,24);return n.map((o,f)=>(o+t[f]+i[f]+a[f])/4)},DWN:(e,r)=>{const n=Ee.BBIBOLL(e,r);return n.map((t,i)=>t-6*li(n.slice(i-10,i+1)))},UPR:(e,r)=>{const n=Ee.BBIBOLL(e,r);return n.map((t,i)=>t+6*li(n.slice(i-10,i+1)))},MID:(e,r)=>Ee.MA(e,r,20),UPPER:(e,r)=>{const n=Ee.MID(e,r);return n.map((t,i)=>t+2*li(n.slice(i-19,i+1)))},LOWER:(e,r)=>{const n=Ee.MID(e,r);return n.map((t,i)=>t-2*li(n.slice(i-19,i+1)))},TQA_H:(e,r)=>{const{high:n}=r,{output:t}=e.MAX({inReal:n,timePeriod:20});return ci(xr(t,20),1)},TQA_L:(e,r)=>{const{low:n}=r,{output:t}=e.MIN({inReal:n,timePeriod:10});return ci(xr(t,10),1)},DKX_D:(e,r,n)=>{const{open:t,close:i,high:a,low:o}=n,f=t.map((u,s)=>(i[s]*3+a[s]+o[s]+u)/6),{output:c}=e.WMA({inReal:f,timePeriod:20});return Ea(r.time,n.time,xr(c,20))},MADKX_D:(e,r,n)=>{const{open:t,close:i,high:a,low:o}=n,f=t.map((s,l)=>(i[l]*3+a[l]+o[l]+s)/6),c=e.WMA({inReal:f,timePeriod:20}),{output:u}=e.SMA({inReal:c.output,timePeriod:10});return Ea(r.time,n.time,xr(u,29))},EMA_D:(e,r,n,t)=>Ea(r.time,n.time,Ee.EMA(e,n,t)),DKX_H:(e,r,n)=>{const{open:t,close:i,high:a,low:o}=n,f=t.map((u,s)=>(i[s]*3+a[s]+o[s]+u)/6),{output:c}=e.WMA({inReal:f,timePeriod:20});return Aa(r.time,n.time,xr(c,20))},MADKX_H:(e,r,n)=>{const{open:t,close:i,high:a,low:o}=n,f=t.map((s,l)=>(i[l]*3+a[l]+o[l]+s)/6),c=e.WMA({inReal:f,timePeriod:20}),{output:u}=e.SMA({inReal:c.output,timePeriod:10});return Aa(r.time,n.time,xr(u,29))},EMA_H:(e,r,n,t)=>Aa(r.time,n.time,Ee.EMA(e,n,t)),MAVOL:(e,r,n)=>{const{originData:t}=r,{output:i}=e.SMA({inReal:t.map(a=>a[5]),timePeriod:n});return xr(i,n)},MACCL:(e,r)=>{const{originData:n}=r,{output:t}=e.SMA({inReal:n.map(i=>i[7]),timePeriod:10});return xr(t,10)},MAAMO:(e,r,n)=>{const{originData:t}=r,{output:i}=e.MA({inReal:t.map(a=>a[6]),timePeriod:n});return xr(i,n)},DIF:(e,r)=>{const n=Ee.EMA(e,r,12),t=Ee.EMA(e,r,26);return n.map((i,a)=>{const o=i||0,f=t[a]||0;return o-f})},DEA:(e,r)=>{const n=Ee.DIF(e,r),{output:t}=e.EMA({inReal:n,timePeriod:9});return xr(t,9)},MACD:(e,r)=>{const n=Ee.DIF(e,r),t=Ee.DEA(e,r);return n.map((i,a)=>{const o=i||0,f=t[a]||0;return(o-f)*2})},MTR:(e,r)=>{const{close:n,high:t,low:i}=r,a=ci(n,1);return t.map((o,f)=>{const c=o,u=i[f],s=a[f];return Math.max(Math.max(c-u,Math.abs(s-c)),Math.abs(s-u))})},ATR:(e,r)=>{const n=Ee.MTR(e,r),{output:t}=e.MA({inReal:n,timePeriod:14});return xr(t,14)},CCI:(e,r)=>{const{close:n,high:t,low:i}=r,a=t.map((c,u)=>(c+i[u]+n[u])/3),{output:o}=e.MA({inReal:a,timePeriod:14}),f=xr(o,14);return a.map((c,u)=>{if(u<12)return 0;const s=_d(a.slice(u-13,u+1));return(c-f[u])*1e3/(15*s)})},RSI:(e,r,n)=>{const{close:t}=r,i=ci(t,1),a=i.map((u,s)=>Math.max(t[s]-u,0)),o=i.map((u,s)=>Math.abs(t[s]-u)),f=Lo(a,n,1),c=Lo(o,n,1);return f.map((u,s)=>c[s]?u/c[s]*100:null)}},zd={DKX:{color:"#FFFFFF",calculationFn:(e,r)=>Ee.DKX(e,r)},MADKX:{color:"#FFFF00",calculationFn:(e,r)=>Ee.MADKX(e,r)},EMA30:{color:"#FF0000",calculationFn:(e,r)=>Ee.EMA(e,r,30)},EMA60:{color:"#00FF00",calculationFn:(e,r)=>Ee.EMA(e,r,60)},EMA120:{color:"#E4007F",calculationFn:(e,r)=>Ee.EMA(e,r,120)},EMA240:{color:"#999999",calculationFn:(e,r)=>Ee.EMA(e,r,240)},EMA360:{color:"#CFCFC4",calculationFn:(e,r)=>Ee.EMA(e,r,360)},EMA720:{color:"#00FFFF",calculationFn:(e,r)=>Ee.EMA(e,r,720)},DKX_D:{color:"#FFFFFF",width:2,calculationFn:(e,r,n)=>Ee.DKX_D(e,r,n)},EMA60_D:{color:"#00FF00",width:2,calculationFn:(e,r,n)=>Ee.EMA_D(e,r,n,60)},EMA120_D:{color:"#FF0000",width:2,calculationFn:(e,r,n)=>Ee.EMA_D(e,r,n,120)},EMA240_D:{color:"#0000FF",width:2,calculationFn:(e,r,n)=>Ee.EMA_D(e,r,n,240)},MADKX_D:{color:"#FFFF00",width:2,calculationFn:(e,r,n)=>Ee.MADKX_D(e,r,n)},DKX_H:{color:"#FFFFFF",width:2,calculationFn:(e,r,n)=>Ee.DKX_H(e,r,n)},EMA60_H:{color:"#00FF00",width:2,calculationFn:(e,r,n)=>Ee.EMA_H(e,r,n,60)},EMA120_H:{color:"#FF0000",width:2,calculationFn:(e,r,n)=>Ee.EMA_H(e,r,n,120)},EMA240_H:{color:"#0000FF",width:2,calculationFn:(e,r,n)=>Ee.EMA_H(e,r,n,240)},MADKX_H:{color:"#FFFF00",width:2,calculationFn:(e,r,n)=>Ee.MADKX_H(e,r,n)},BBI:{color:"rgba(238, 238, 238, 0.5)",calculationFn:(e,r)=>Ee.BBI(e,r)},BBIBOLL:{color:"rgba(238, 238, 238, 0.5)",calculationFn:(e,r)=>Ee.BBIBOLL(e,r)},DWN:{color:"#FF00FF",calculationFn:(e,r)=>Ee.DWN(e,r)},UPR:{color:"#FFFF00",calculationFn:(e,r)=>Ee.UPR(e,r)},LOWER:{color:"#FF00FF",calculationFn:(e,r)=>Ee.LOWER(e,r)},MID:{color:"#FFFFFF",calculationFn:(e,r)=>Ee.MID(e,r)},UPPER:{color:"#FFFF00",calculationFn:(e,r)=>Ee.UPPER(e,r)},MA5:{color:"#FFFFFF",calculationFn:(e,r)=>Ee.MA(e,r,5)},MA10:{color:"#FFFF00",calculationFn:(e,r)=>Ee.MA(e,r,10)},MA20:{color:"#FF00FF",calculationFn:(e,r)=>Ee.MA(e,r,20)},MA60:{color:"#00FF00",calculationFn:(e,r)=>Ee.MA(e,r,60)},HHV30:{color:"#FFFFFF",calculationFn:(e,r)=>Ee.HHV(e,r,30)},LLV30:{color:"#FFFFFF",calculationFn:(e,r)=>Ee.LLV(e,r,30)},TQA_H:{color:"#FFFFFF",calculationFn:(e,r)=>Ee.TQA_H(e,r)},TQA_L:{color:"#FFFF00",calculationFn:(e,r)=>Ee.TQA_L(e,r)}},Ho={main:[{key:"BBI",config:["BBI"]},{key:"BBIBOLL",config:["BBIBOLL","DWN","UPR"]},{key:"BOLL",config:["LOWER","MID","UPPER"]},{key:"DKX",config:["DKX","MADKX"]},{key:"DKX_EMA",config:["DKX","EMA60","EMA120","EMA240","MADKX"]},{key:"DKX_EMA_720",config:["DKX","EMA30","EMA60","EMA120","EMA240","MADKX","EMA720"]},{key:"DKX_EMA_D",showFreq:["1m","5m","15m","60m"],mergeFreq:"1d",config:["DKX","MADKX","EMA60","DKX_D","EMA60_D","EMA120_D","EMA240_D","MADKX_D"]},{key:"DKX_EMA_H",showFreq:["1m","5m","15m"],mergeFreq:"60m",config:["DKX","MADKX","EMA60","DKX_H","EMA60_H","EMA120_H","EMA240_H","MADKX_H"]},{key:"DKX_MA",config:["DKX","HHV30","LLV30","MA60","MADKX"]},{key:"EMA_BIG",config:["EMA30","EMA60","EMA120","EMA240","EMA360","EMA720"]},{key:"MA",config:["MA5","MA10","MA20","MA60"]},{key:"TQA",config:["TQA_H","TQA_L"]}],sub:[{key:"AMOUNT",series:"bar",source:"origin",dataIndex:6,color:"kline",config:[{key:"AMO",color:"#FF0000",source:"origin",series:"base",dataIndex:6},{key:"MAAMO1",color:"#7DBABA",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.MAAMO(e,r,5)},{key:"MAAMO2",color:"#D2C38C",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.MAAMO(e,r,10)}]},{key:"ATR",series:"none",config:[{key:"ATR",color:"#7DBABA",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.ATR(e,r)},{key:"MTR",color:"#D2C38C",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.MTR(e,r)}]},{key:"CCI",series:"none",config:[{key:"CCI",color:"#524c75",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.CCI(e,r)}]},{key:"VOL",series:"bar",source:"origin",dataIndex:5,color:"kline",rightYAxisRange:"cover",config:[{key:"MAVOL1",color:"#7DBABA",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.MAVOL(e,r,5)},{key:"MAVOL2",color:"#D2C38C",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.MAVOL(e,r,10)},{key:"VOLUME",color:"#FF0000",source:"origin",series:"base",dataIndex:5},{key:"CCL",color:"#FFFFFF",source:"origin",series:"line",dataIndex:7,yAxis:"right"}]},{key:"CCL",series:"none",leftYAxisRange:"cover",config:[{key:"CCL",color:"#524c75",source:"origin",series:"line",dataIndex:7},{key:"MACCL",color:"#524c75",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.MACCL(e,r)}]},{key:"MACD",series:"bar",source:"calculation",dataIndex:"MACD",color:"value",leftYAxisRange:"cover",config:[{key:"DEA",color:"#bc8eab",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.DEA(e,r)},{key:"DIF",color:"#524c75",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.DIF(e,r)},{key:"MACD",color:"#FF0000",source:"calculation",series:"bar",calculationFn:(e,r)=>Ee.MACD(e,r)}]},{key:"RSI",series:"none",leftYAxisRange:"cover",config:[{key:"RSI1",color:"#bc8eab",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.RSI(e,r,6)},{key:"RS2",color:"#524c75",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.RSI(e,r,12)},{key:"RS3",color:"#a5a0c4",source:"calculation",series:"line",calculationFn:(e,r)=>Ee.RSI(e,r,24)}]}]},Rd=Ho.main.map(({key:e,showFreq:r,mergeFreq:n,config:t})=>({label:e,value:e,showFreq:r,mergeFreq:n,config:t.map(i=>({key:i,...zd[i]}))})),qd=Ho.sub.map(({key:e,series:r,dataIndex:n,source:t,color:i,leftYAxisRange:a,rightYAxisRange:o,config:f})=>({label:e,value:e,series:r,source:t,dataIndex:n,color:i,leftYAxisRange:a,rightYAxisRange:o,config:f}));function dr(){return dr=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},dr.apply(this,arguments)}var $o={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function ke(e){return typeof e=="number"}function je(e){return!e||typeof e!="object"||typeof e.constructor!="function"?!1:e.isBigNumber===!0&&typeof e.constructor.prototype=="object"&&e.constructor.prototype.isBigNumber===!0||typeof e.constructor.isDecimal=="function"&&e.constructor.isDecimal(e)===!0}function yt(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isComplex===!0||!1}function Ln(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isFraction===!0||!1}function Jr(e){return e&&e.constructor.prototype.isUnit===!0||!1}function Sr(e){return typeof e=="string"}var Xe=Array.isArray;function Be(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function Wr(e){return Array.isArray(e)||Be(e)}function fi(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function Jt(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function Ma(e){return e&&e.constructor.prototype.isRange===!0||!1}function pi(e){return e&&e.constructor.prototype.isIndex===!0||!1}function kd(e){return typeof e=="boolean"}function jd(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function Zo(e){return e&&e.constructor.prototype.isHelp===!0||!1}function Pd(e){return typeof e=="function"}function Ud(e){return e instanceof Date}function Ld(e){return e instanceof RegExp}function Hn(e){return!!(e&&typeof e=="object"&&e.constructor===Object&&!yt(e)&&!Ln(e))}function Hd(e){return e===null}function $d(e){return e===void 0}function Wt(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function Yr(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function Zd(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function Jd(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function Wd(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function Ve(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function Sa(e){return Ve(e)||mr(e)&&e.args.length===1&&Ve(e.args[0])&&"-+~".includes(e.op)}function $n(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function Bt(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function ln(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function tr(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function mi(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function mr(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function xt(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function Yd(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function Gd(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function br(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function Jo(e){return e&&e.constructor.prototype.isChain===!0||!1}function nr(e){var r=typeof e;return r==="object"?e===null?"null":je(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function Ie(e){var r=typeof e;if(r==="number"||r==="string"||r==="boolean"||e===null||e===void 0)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(n){return Ie(n)});if(e instanceof Date)return new Date(e.valueOf());if(je(e))return e;if(Hn(e))return Vd(e,Ie);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function Vd(e,r){var n={};for(var t in e)Me(e,t)&&(n[t]=r(e[t]));return n}function Wo(e,r){for(var n in r)Me(r,n)&&(e[n]=r[n]);return e}function Yt(e,r){var n,t,i;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(t=0,i=e.length;t<i;t++)if(!Yt(e[t],r[t]))return!1;return!0}else{if(typeof e=="function")return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(n in e)if(!(n in r)||!Yt(e[n],r[n]))return!1;for(n in r)if(!(n in e))return!1;return!0}else return e===r}}function Kd(e,r,n){var t=!0,i;Object.defineProperty(e,r,{get:function(){return t&&(i=n(),t=!1),i},set:function(a){i=a,t=!1},configurable:!0,enumerable:!0})}function Me(e,r){return e&&Object.hasOwnProperty.call(e,r)}function Qd(e,r){for(var n={},t=0;t<r.length;t++){var i=r[t],a=e[i];a!==void 0&&(n[i]=a)}return n}var Xd=["Matrix","Array"],e0=["number","BigNumber","Fraction"],de=function(e){if(e)throw new Error(`The global config is readonly.
2
+ Please create a mathjs instance if you want to change the default configuration.
3
+ Example:
4
+
5
+ import { create, all } from 'mathjs';
6
+ const mathjs = create(all);
7
+ mathjs.config({ number: 'BigNumber' });
8
+ `);return Object.freeze($o)};dr(de,$o,{MATRIX_OPTIONS:Xd,NUMBER_OPTIONS:e0});function Yo(){return!0}function Gr(){return!1}function cn(){}const Go="Argument is not a typed-function.";function Vo(){function e(k){return typeof k=="object"&&k!==null&&k.constructor===Object}const r=[{name:"number",test:function(k){return typeof k=="number"}},{name:"string",test:function(k){return typeof k=="string"}},{name:"boolean",test:function(k){return typeof k=="boolean"}},{name:"Function",test:function(k){return typeof k=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(k){return k instanceof Date}},{name:"RegExp",test:function(k){return k instanceof RegExp}},{name:"Object",test:e},{name:"null",test:function(k){return k===null}},{name:"undefined",test:function(k){return k===void 0}}],n={name:"any",test:Yo,isAny:!0};let t,i,a=0,o={createCount:0};function f(k){const U=t.get(k);if(U)return U;let G='Unknown type "'+k+'"';const re=k.toLowerCase();let le;for(le of i)if(le.toLowerCase()===re){G+='. Did you mean "'+le+'" ?';break}throw new TypeError(G)}function c(k){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any";const G=U?f(U).index:i.length,re=[];for(let me=0;me<k.length;++me){if(!k[me]||typeof k[me].name!="string"||typeof k[me].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");const xe=k[me].name;if(t.has(xe))throw new TypeError('Duplicate type name "'+xe+'"');re.push(xe),t.set(xe,{name:xe,test:k[me].test,isAny:k[me].isAny,index:G+me,conversionsTo:[]})}const le=i.slice(G);i=i.slice(0,G).concat(re).concat(le);for(let me=G+re.length;me<i.length;++me)t.get(i[me]).index=me}function u(){t=new Map,i=[],a=0,c([n],!1)}u(),c(r);function s(){let k;for(k of i)t.get(k).conversionsTo=[];a=0}function l(k){const U=i.filter(G=>{const re=t.get(G);return!re.isAny&&re.test(k)});return U.length?U:["any"]}function p(k){return k&&typeof k=="function"&&"_typedFunctionData"in k}function m(k,U,G){if(!p(k))throw new TypeError(Go);const re=G&&G.exact,le=Array.isArray(U)?U.join(","):U,me=x(le),xe=w(me);if(!re||xe in k.signatures){const We=k._typedFunctionData.signatureMap.get(xe);if(We)return We}const he=me.length;let De;if(re){De=[];let We;for(We in k.signatures)De.push(k._typedFunctionData.signatureMap.get(We))}else De=k._typedFunctionData.signatures;for(let We=0;We<he;++We){const Ye=me[We],Fe=[];let cr;for(cr of De){const F=E(cr.params,We);if(!(!F||Ye.restParam&&!F.restParam)){if(!F.hasAny){const W=h(F);if(Ye.types.some(ae=>!W.has(ae.name)))continue}Fe.push(cr)}}if(De=Fe,De.length===0)break}let Ne;for(Ne of De)if(Ne.params.length<=he)return Ne;throw new TypeError("Signature not found (signature: "+(k.name||"unnamed")+"("+w(me,", ")+"))")}function d(k,U,G){return m(k,U,G).implementation}function g(k,U){const G=f(U);if(G.test(k))return k;const re=G.conversionsTo;if(re.length===0)throw new Error("There are no conversions to "+U+" defined.");for(let le=0;le<re.length;le++)if(f(re[le].from).test(k))return re[le].convert(k);throw new Error("Cannot convert "+k+" to "+U)}function w(k){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return k.map(G=>G.name).join(U)}function v(k){const U=k.indexOf("...")===0,G=(U?k.length>3?k.slice(3):"any":k).split("|").map(me=>f(me.trim()));let re=!1,le=U?"...":"";return{types:G.map(function(me){return re=me.isAny||re,le+=me.name+"|",{name:me.name,typeIndex:me.index,test:me.test,isAny:me.isAny,conversion:null,conversionIndex:-1}}),name:le.slice(0,-1),hasAny:re,hasConversion:!1,restParam:U}}function b(k){const U=k.types.map(xe=>xe.name),G=C(U);let re=k.hasAny,le=k.name;const me=G.map(function(xe){const he=f(xe.from);return re=he.isAny||re,le+="|"+xe.from,{name:xe.from,typeIndex:he.index,test:he.test,isAny:he.isAny,conversion:xe,conversionIndex:xe.index}});return{types:k.types.concat(me),name:le,hasAny:re,hasConversion:me.length>0,restParam:k.restParam}}function h(k){return k.typeSet||(k.typeSet=new Set,k.types.forEach(U=>k.typeSet.add(U.name))),k.typeSet}function x(k){const U=[];if(typeof k!="string")throw new TypeError("Signatures must be strings");const G=k.trim();if(G==="")return U;const re=G.split(",");for(let le=0;le<re.length;++le){const me=v(re[le].trim());if(me.restParam&&le!==re.length-1)throw new SyntaxError('Unexpected rest parameter "'+re[le]+'": only allowed for the last parameter');if(me.types.length===0)return null;U.push(me)}return U}function y(k){const U=X(k);return U?U.restParam:!1}function N(k){if(!k||k.types.length===0)return Yo;if(k.types.length===1)return f(k.types[0].name).test;if(k.types.length===2){const U=f(k.types[0].name).test,G=f(k.types[1].name).test;return function(re){return U(re)||G(re)}}else{const U=k.types.map(function(G){return f(G.name).test});return function(G){for(let re=0;re<U.length;re++)if(U[re](G))return!0;return!1}}}function A(k){let U,G,re;if(y(k)){U=ue(k).map(N);const le=U.length,me=N(X(k)),xe=function(he){for(let De=le;De<he.length;De++)if(!me(he[De]))return!1;return!0};return function(he){for(let De=0;De<U.length;De++)if(!U[De](he[De]))return!1;return xe(he)&&he.length>=le+1}}else return k.length===0?function(le){return le.length===0}:k.length===1?(G=N(k[0]),function(le){return G(le[0])&&le.length===1}):k.length===2?(G=N(k[0]),re=N(k[1]),function(le){return G(le[0])&&re(le[1])&&le.length===2}):(U=k.map(N),function(le){for(let me=0;me<U.length;me++)if(!U[me](le[me]))return!1;return le.length===U.length})}function E(k,U){return U<k.length?k[U]:y(k)?X(k):null}function D(k,U){const G=E(k,U);return G?h(G):new Set}function M(k){return k.conversion===null||k.conversion===void 0}function S(k,U){const G=new Set;return k.forEach(re=>{const le=D(re.params,U);let me;for(me of le)G.add(me)}),G.has("any")?["any"]:Array.from(G)}function B(k,U,G){let re,le;const me=k||"unnamed";let xe=G,he;for(he=0;he<U.length;he++){const Ye=[];if(xe.forEach(Fe=>{const cr=E(Fe.params,he),F=N(cr);(he<Fe.params.length||y(Fe.params))&&F(U[he])&&Ye.push(Fe)}),Ye.length===0){if(le=S(xe,he),le.length>0){const Fe=l(U[he]);return re=new TypeError("Unexpected type of argument in function "+me+" (expected: "+le.join(" or ")+", actual: "+Fe.join(" | ")+", index: "+he+")"),re.data={category:"wrongType",fn:me,index:he,actual:Fe,expected:le},re}}else xe=Ye}const De=xe.map(function(Ye){return y(Ye.params)?1/0:Ye.params.length});if(U.length<Math.min.apply(null,De))return le=S(xe,he),re=new TypeError("Too few arguments in function "+me+" (expected: "+le.join(" or ")+", index: "+U.length+")"),re.data={category:"tooFewArgs",fn:me,index:U.length,expected:le},re;const Ne=Math.max.apply(null,De);if(U.length>Ne)return re=new TypeError("Too many arguments in function "+me+" (expected: "+Ne+", actual: "+U.length+")"),re.data={category:"tooManyArgs",fn:me,index:U.length,expectedLength:Ne},re;const We=[];for(let Ye=0;Ye<U.length;++Ye)We.push(l(U[Ye]).join("|"));return re=new TypeError('Arguments of type "'+We.join(", ")+'" do not match any of the defined signatures of function '+me+"."),re.data={category:"mismatch",actual:We},re}function I(k){let U=i.length+1;for(let G=0;G<k.types.length;G++)M(k.types[G])&&(U=Math.min(U,k.types[G].typeIndex));return U}function j(k){let U=a+1;for(let G=0;G<k.types.length;G++)M(k.types[G])||(U=Math.min(U,k.types[G].conversionIndex));return U}function _(k,U){if(k.hasAny){if(!U.hasAny)return 1}else if(U.hasAny)return-1;if(k.restParam){if(!U.restParam)return 1}else if(U.restParam)return-1;if(k.hasConversion){if(!U.hasConversion)return 1}else if(U.hasConversion)return-1;const G=I(k)-I(U);if(G<0)return-1;if(G>0)return 1;const re=j(k)-j(U);return re<0?-1:re>0?1:0}function O(k,U){const G=k.params,re=U.params,le=X(G),me=X(re),xe=y(G),he=y(re);if(xe&&le.hasAny){if(!he||!me.hasAny)return 1}else if(he&&me.hasAny)return-1;let De=0,Ne=0,We;for(We of G)We.hasAny&&++De,We.hasConversion&&++Ne;let Ye=0,Fe=0;for(We of re)We.hasAny&&++Ye,We.hasConversion&&++Fe;if(De!==Ye)return De-Ye;if(xe&&le.hasConversion){if(!he||!me.hasConversion)return 1}else if(he&&me.hasConversion)return-1;if(Ne!==Fe)return Ne-Fe;if(xe){if(!he)return 1}else if(he)return-1;const cr=(G.length-re.length)*(xe?-1:1);if(cr!==0)return cr;const F=[];let W=0;for(let we=0;we<G.length;++we){const _e=_(G[we],re[we]);F.push(_e),W+=_e}if(W!==0)return W;let ae;for(ae of F)if(ae!==0)return ae;return 0}function C(k){if(k.length===0)return[];const U=k.map(f);k.length>1&&U.sort((le,me)=>le.index-me.index);let G=U[0].conversionsTo;if(k.length===1)return G;G=G.concat([]);const re=new Set(k);for(let le=1;le<U.length;++le){let me;for(me of U[le].conversionsTo)re.has(me.from)||(G.push(me),re.add(me.from))}return G}function z(k,U){let G=U;if(k.some(le=>le.hasConversion)){const le=y(k),me=k.map(T);G=function(){const xe=[],he=le?arguments.length-1:arguments.length;for(let De=0;De<he;De++)xe[De]=me[De](arguments[De]);return le&&(xe[he]=arguments[he].map(me[he])),U.apply(this,xe)}}let re=G;if(y(k)){const le=k.length-1;re=function(){return G.apply(this,ie(arguments,0,le).concat([ie(arguments,le)]))}}return re}function T(k){let U,G,re,le;const me=[],xe=[];switch(k.types.forEach(function(he){he.conversion&&(me.push(f(he.conversion.from).test),xe.push(he.conversion.convert))}),xe.length){case 0:return function(he){return he};case 1:return U=me[0],re=xe[0],function(he){return U(he)?re(he):he};case 2:return U=me[0],G=me[1],re=xe[0],le=xe[1],function(he){return U(he)?re(he):G(he)?le(he):he};default:return function(he){for(let De=0;De<xe.length;De++)if(me[De](he))return xe[De](he);return he}}}function Y(k){function U(G,re,le){if(re<G.length){const me=G[re];let xe=[];if(me.restParam){const he=me.types.filter(M);he.length<me.types.length&&xe.push({types:he,name:"..."+he.map(De=>De.name).join("|"),hasAny:he.some(De=>De.isAny),hasConversion:!1,restParam:!0}),xe.push(me)}else xe=me.types.map(function(he){return{types:[he],name:he.name,hasAny:he.isAny,hasConversion:he.conversion,restParam:!1}});return ce(xe,function(he){return U(G,re+1,le.concat([he]))})}else return[le]}return U(k,0,[])}function te(k,U){const G=Math.max(k.length,U.length);for(let he=0;he<G;he++){const De=D(k,he),Ne=D(U,he);let We=!1,Ye;for(Ye of Ne)if(De.has(Ye)){We=!0;break}if(!We)return!1}const re=k.length,le=U.length,me=y(k),xe=y(U);return me?xe?re===le:le>=re:xe?re>=le:re===le}function $(k){return k.map(U=>V(U)?P(U.referToSelf.callback):Z(U)?Ae(U.referTo.references,U.referTo.callback):U)}function q(k,U,G){const re=[];let le;for(le of k){let me=G[le];if(typeof me!="number")throw new TypeError('No definition for referenced signature "'+le+'"');if(me=U[me],typeof me!="function")return!1;re.push(me)}return re}function ne(k,U,G){const re=$(k),le=new Array(re.length).fill(!1);let me=!0;for(;me;){me=!1;let xe=!0;for(let he=0;he<re.length;++he){if(le[he])continue;const De=re[he];if(V(De))re[he]=De.referToSelf.callback(G),re[he].referToSelf=De.referToSelf,le[he]=!0,xe=!1;else if(Z(De)){const Ne=q(De.referTo.references,re,U);Ne?(re[he]=De.referTo.callback.apply(this,Ne),re[he].referTo=De.referTo,le[he]=!0,xe=!1):me=!0}}if(xe&&me)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return re}function se(k){const U=/\bthis(\(|\.signatures\b)/;Object.keys(k).forEach(G=>{const re=k[G];if(U.test(re.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Q(k,U){if(o.createCount++,Object.keys(U).length===0)throw new SyntaxError("No signatures provided");o.warnAgainstDeprecatedThis&&se(U);const G=[],re=[],le={},me=[];let xe;for(xe in U){if(!Object.prototype.hasOwnProperty.call(U,xe))continue;const rr=x(xe);if(!rr)continue;G.forEach(function(ui){if(te(ui,rr))throw new TypeError('Conflicting signatures "'+w(ui)+'" and "'+w(rr)+'".')}),G.push(rr);const Ct=re.length;re.push(U[xe]);const A6=rr.map(b);let Na;for(Na of Y(A6)){const ui=w(Na);me.push({params:Na,name:ui,fn:Ct}),Na.every(E6=>!E6.hasConversion)&&(le[ui]=Ct)}}me.sort(O);const he=ne(re,le,si);let De;for(De in le)Object.prototype.hasOwnProperty.call(le,De)&&(le[De]=he[le[De]]);const Ne=[],We=new Map;for(De of me)We.has(De.name)||(De.fn=he[De.fn],Ne.push(De),We.set(De.name,De));const Ye=Ne[0]&&Ne[0].params.length<=2&&!y(Ne[0].params),Fe=Ne[1]&&Ne[1].params.length<=2&&!y(Ne[1].params),cr=Ne[2]&&Ne[2].params.length<=2&&!y(Ne[2].params),F=Ne[3]&&Ne[3].params.length<=2&&!y(Ne[3].params),W=Ne[4]&&Ne[4].params.length<=2&&!y(Ne[4].params),ae=Ne[5]&&Ne[5].params.length<=2&&!y(Ne[5].params),we=Ye&&Fe&&cr&&F&&W&&ae;for(let rr=0;rr<Ne.length;++rr)Ne[rr].test=A(Ne[rr].params);const _e=Ye?N(Ne[0].params[0]):Gr,Ue=Fe?N(Ne[1].params[0]):Gr,Zr=cr?N(Ne[2].params[0]):Gr,jo=F?N(Ne[3].params[0]):Gr,XT=W?N(Ne[4].params[0]):Gr,e6=ae?N(Ne[5].params[0]):Gr,r6=Ye?N(Ne[0].params[1]):Gr,t6=Fe?N(Ne[1].params[1]):Gr,n6=cr?N(Ne[2].params[1]):Gr,i6=F?N(Ne[3].params[1]):Gr,a6=W?N(Ne[4].params[1]):Gr,o6=ae?N(Ne[5].params[1]):Gr;for(let rr=0;rr<Ne.length;++rr)Ne[rr].implementation=z(Ne[rr].params,Ne[rr].fn);const s6=Ye?Ne[0].implementation:cn,u6=Fe?Ne[1].implementation:cn,l6=cr?Ne[2].implementation:cn,c6=F?Ne[3].implementation:cn,f6=W?Ne[4].implementation:cn,p6=ae?Ne[5].implementation:cn,m6=Ye?Ne[0].params.length:-1,d6=Fe?Ne[1].params.length:-1,h6=cr?Ne[2].params.length:-1,g6=F?Ne[3].params.length:-1,v6=W?Ne[4].params.length:-1,y6=ae?Ne[5].params.length:-1,x6=we?6:0,b6=Ne.length,w6=Ne.map(rr=>rr.test),N6=Ne.map(rr=>rr.implementation),D6=function(){for(let rr=x6;rr<b6;rr++)if(w6[rr](arguments))return N6[rr].apply(this,arguments);return o.onMismatch(k,arguments,Ne)};function si(rr,Ct){return arguments.length===m6&&_e(rr)&&r6(Ct)?s6.apply(this,arguments):arguments.length===d6&&Ue(rr)&&t6(Ct)?u6.apply(this,arguments):arguments.length===h6&&Zr(rr)&&n6(Ct)?l6.apply(this,arguments):arguments.length===g6&&jo(rr)&&i6(Ct)?c6.apply(this,arguments):arguments.length===v6&&XT(rr)&&a6(Ct)?f6.apply(this,arguments):arguments.length===y6&&e6(rr)&&o6(Ct)?p6.apply(this,arguments):D6.apply(this,arguments)}try{Object.defineProperty(si,"name",{value:k})}catch{}return si.signatures=le,si._typedFunctionData={signatures:Ne,signatureMap:We},si}function ee(k,U,G){throw B(k,U,G)}function ue(k){return ie(k,0,k.length-1)}function X(k){return k[k.length-1]}function ie(k,U,G){return Array.prototype.slice.call(k,U,G)}function oe(k,U){for(let G=0;G<k.length;G++)if(U(k[G]))return k[G]}function ce(k,U){return Array.prototype.concat.apply([],k.map(U))}function ye(){const k=ue(arguments).map(G=>w(x(G))),U=X(arguments);if(typeof U!="function")throw new TypeError("Callback function expected as last argument");return Ae(k,U)}function Ae(k,U){return{referTo:{references:k,callback:U}}}function P(k){if(typeof k!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:k}}}function Z(k){return k&&typeof k.referTo=="object"&&Array.isArray(k.referTo.references)&&typeof k.referTo.callback=="function"}function V(k){return k&&typeof k.referToSelf=="object"&&typeof k.referToSelf.callback=="function"}function H(k,U){if(!k)return U;if(U&&U!==k){const G=new Error("Function names do not match (expected: "+k+", actual: "+U+")");throw G.data={actual:U,expected:k},G}return k}function J(k){let U;for(const G in k)Object.prototype.hasOwnProperty.call(k,G)&&(p(k[G])||typeof k[G].signature=="string")&&(U=H(U,k[G].name));return U}function K(k,U){let G;for(G in U)if(Object.prototype.hasOwnProperty.call(U,G)){if(G in k&&U[G]!==k[G]){const re=new Error('Signature "'+G+'" is defined twice');throw re.data={signature:G,sourceFunction:U[G],destFunction:k[G]},re}k[G]=U[G]}}const fe=o;o=function(k){const U=typeof k=="string",G=U?1:0;let re=U?k:"";const le={};for(let me=G;me<arguments.length;++me){const xe=arguments[me];let he={},De;if(typeof xe=="function"?(De=xe.name,typeof xe.signature=="string"?he[xe.signature]=xe:p(xe)&&(he=xe.signatures)):e(xe)&&(he=xe,U||(De=J(xe))),Object.keys(he).length===0){const Ne=new TypeError("Argument to 'typed' at index "+me+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw Ne.data={index:me,argument:xe},Ne}U||(re=H(re,De)),K(le,he)}return Q(re||"",le)},o.create=Vo,o.createCount=fe.createCount,o.onMismatch=ee,o.throwMismatchError=ee,o.createError=B,o.clear=u,o.clearConversions=s,o.addTypes=c,o._findType=f,o.referTo=ye,o.referToSelf=P,o.convert=g,o.findSignature=m,o.find=d,o.isTypedFunction=p,o.warnAgainstDeprecatedThis=!0,o.addType=function(k,U){let G="any";U!==!1&&t.has("Object")&&(G="Object"),o.addTypes([k],G)};function pe(k){if(!k||typeof k.from!="string"||typeof k.to!="string"||typeof k.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(k.to===k.from)throw new SyntaxError('Illegal to define conversion from "'+k.from+'" to itself.')}return o.addConversion=function(k){pe(k);const U=f(k.to);if(U.conversionsTo.every(function(G){return G.from!==k.from}))U.conversionsTo.push({from:k.from,convert:k.convert,index:a++});else throw new Error('There is already a conversion from "'+k.from+'" to "'+U.name+'"')},o.addConversions=function(k){k.forEach(o.addConversion)},o.removeConversion=function(k){pe(k);const U=f(k.to),G=oe(U.conversionsTo,le=>le.from===k.from);if(!G)throw new Error("Attempt to remove nonexistent conversion from "+k.from+" to "+k.to);if(G.convert!==k.convert)throw new Error("Conversion to remove does not match existing conversion");const re=U.conversionsTo.indexOf(G);U.conversionsTo.splice(re,1)},o.resolve=function(k,U){if(!p(k))throw new TypeError(Go);const G=k._typedFunctionData.signatures;for(let re=0;re<G.length;++re)if(G[re].test(U))return G[re];return null},o}const fn=Vo();function Se(e){return typeof e=="boolean"?!0:isFinite(e)?e===Math.round(e):!1}var Ot=Math.sign||function(e){return e>0?1:e<0?-1:0},r0=Math.log2||function(e){return Math.log(e)/Math.LN2},t0=Math.log10||function(e){return Math.log(e)/Math.LN10},n0=Math.log1p||function(e){return Math.log(e+1)},i0=Math.cbrt||function(e){if(e===0)return e;var r=e<0,n;return r&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,r?-n:n},a0=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Fa(e,r,n){var t={2:"0b",8:"0o",16:"0x"},i=t[r],a="";if(n){if(n<1)throw new Error("size must be in greater than 0");if(!Se(n))throw new Error("size must be an integer");if(e>2**(n-1)-1||e<-(2**(n-1)))throw new Error("Value must be in range [-2^".concat(n-1,", 2^").concat(n-1,"-1]"));if(!Se(e))throw new Error("Value must be an integer");e<0&&(e=e+2**n),a="i".concat(n)}var o="";return e<0&&(e=-e,o="-"),"".concat(o).concat(i).concat(e.toString(r)).concat(a)}function Gt(e,r){if(typeof r=="function")return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:n,precision:t,wordSize:i}=Ko(r);switch(n){case"fixed":return Qo(e,t);case"exponential":return Xo(e,t);case"engineering":return o0(e,t);case"bin":return Fa(e,2,i);case"oct":return Fa(e,8,i);case"hex":return Fa(e,16,i);case"auto":return s0(e,t,r).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ko(e){var r="auto",n,t;if(e!==void 0)if(ke(e))n=e;else if(je(e))n=e.toNumber();else if(Hn(e))e.precision!==void 0&&(n=es(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(t=es(e.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(r=e.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:r,precision:n,wordSize:t}}function di(e){var r=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw new SyntaxError("Invalid number "+e);var n=r[1],t=r[2],i=parseFloat(r[4]||"0"),a=t.indexOf(".");i+=a!==-1?a-1:t.length-1;var o=t.replace(".","").replace(/^0*/,function(f){return i-=f.length,""}).replace(/0*$/,"").split("").map(function(f){return parseInt(f)});return o.length===0&&(o.push(0),i++),{sign:n,coefficients:o,exponent:i}}function o0(e,r){if(isNaN(e)||!isFinite(e))return String(e);var n=di(e),t=hi(n,r),i=t.exponent,a=t.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(ke(r))for(;r>a.length||i-o+1>a.length;)a.push(0);else for(var f=Math.abs(i-o)-(a.length-1),c=0;c<f;c++)a.push(0);for(var u=Math.abs(i-o),s=1;u>0;)s++,u--;var l=a.slice(s).join(""),p=ke(r)&&l.length||l.match(/[1-9]/)?"."+l:"",m=a.slice(0,s).join("")+p+"e"+(i>=0?"+":"")+o.toString();return t.sign+m}function Qo(e,r){if(isNaN(e)||!isFinite(e))return String(e);var n=di(e),t=typeof r=="number"?hi(n,n.exponent+1+r):n,i=t.coefficients,a=t.exponent+1,o=a+(r||0);return i.length<o&&(i=i.concat(pn(o-i.length))),a<0&&(i=pn(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),t.sign+i.join("")}function Xo(e,r){if(isNaN(e)||!isFinite(e))return String(e);var n=di(e),t=r?hi(n,r):n,i=t.coefficients,a=t.exponent;i.length<r&&(i=i.concat(pn(r-i.length)));var o=i.shift();return t.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function s0(e,r,n){if(isNaN(e)||!isFinite(e))return String(e);var t=rs(n==null?void 0:n.lowerExp,-3),i=rs(n==null?void 0:n.upperExp,5),a=di(e),o=r?hi(a,r):a;if(o.exponent<t||o.exponent>=i)return Xo(e,r);var f=o.coefficients,c=o.exponent;f.length<r&&(f=f.concat(pn(r-f.length))),f=f.concat(pn(c-f.length+1+(f.length<r?r-f.length:0))),f=pn(-c).concat(f);var u=c>0?c:0;return u<f.length-1&&f.splice(u+1,0,"."),o.sign+f.join("")}function hi(e,r){for(var n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},t=n.coefficients;r<=0;)t.unshift(0),n.exponent++,r++;if(t.length>r){var i=t.splice(r,t.length-r);if(i[0]>=5){var a=r-1;for(t[a]++;t[a]===10;)t.pop(),a===0&&(t.unshift(0),n.exponent++,a++),a--,t[a]++}}return n}function pn(e){for(var r=[],n=0;n<e;n++)r.push(0);return r}function u0(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var l0=Number.EPSILON||2220446049250313e-31;function Lr(e,r,n){if(n==null)return e===r;if(e===r)return!0;if(isNaN(e)||isNaN(r))return!1;if(isFinite(e)&&isFinite(r)){var t=Math.abs(e-r);return t<=l0?!0:t<=Math.max(Math.abs(e),Math.abs(r))*n}return!1}var c0=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},f0=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},p0=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},m0=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},d0=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},h0=Math.tanh||function(e){var r=Math.exp(2*e);return(r-1)/(r+1)};function g0(e,r){var n=e>0?!0:e<0?!1:1/e===1/0,t=r>0?!0:r<0?!1:1/r===1/0;return n^t?-e:e}function es(e,r){if(ke(e))return e;if(je(e))return e.toNumber();r()}function rs(e,r){return ke(e)?e:je(e)?e.toNumber():r}function Ca(e,r,n){var t=e.constructor,i=new t(2),a="";if(n){if(n<1)throw new Error("size must be in greater than 0");if(!Se(n))throw new Error("size must be an integer");if(e.greaterThan(i.pow(n-1).sub(1))||e.lessThan(i.pow(n-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(n-1,", 2^").concat(n-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(i.pow(n))),a="i".concat(n)}switch(r){case 2:return"".concat(e.toBinary()).concat(a);case 8:return"".concat(e.toOctal()).concat(a);case 16:return"".concat(e.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(r," not supported "))}}function v0(e,r){if(typeof r=="function")return r(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var{notation:n,precision:t,wordSize:i}=Ko(r);switch(n){case"fixed":return x0(e,t);case"exponential":return ts(e,t);case"engineering":return y0(e,t);case"bin":return Ca(e,2,i);case"oct":return Ca(e,8,i);case"hex":return Ca(e,16,i);case"auto":{var a=ns(r==null?void 0:r.lowerExp,-3),o=ns(r==null?void 0:r.upperExp,5);if(e.isZero())return"0";var f,c=e.toSignificantDigits(t),u=c.e;return u>=a&&u<o?f=c.toFixed():f=ts(e,t),f.replace(/((\.\d*?)(0+))($|e)/,function(){var s=arguments[2],l=arguments[4];return s!=="."?s+l:l})}default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function y0(e,r){var n=e.e,t=n%3===0?n:n<0?n-3-n%3:n-n%3,i=e.mul(Math.pow(10,-t)),a=i.toPrecision(r);if(a.indexOf("e")!==-1){var o=e.constructor;a=new o(a).toFixed()}return a+"e"+(n>=0?"+":"")+t.toString()}function ts(e,r){return r!==void 0?e.toExponential(r-1):e.toExponential()}function x0(e,r){return e.toFixed(r)}function ns(e,r){return ke(e)?e:je(e)?e.toNumber():r}function b0(e,r){var n=e.length-r.length,t=e.length;return e.substring(n,t)===r}function Le(e,r){var n=w0(e,r);return r&&typeof r=="object"&&"truncate"in r&&n.length>r.truncate?n.substring(0,r.truncate-3)+"...":n}function w0(e,r){if(typeof e=="number")return Gt(e,r);if(je(e))return v0(e,r);if(N0(e))return!r||r.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return as(e,r);if(Sr(e))return mn(e);if(typeof e=="function")return e.syntax?String(e.syntax):"function";if(e&&typeof e=="object"){if(typeof e.format=="function")return e.format(r);if(e&&e.toString(r)!=={}.toString())return e.toString(r);var n=Object.keys(e).map(t=>mn(t)+": "+Le(e[t],r));return"{"+n.join(", ")+"}"}return String(e)}function mn(e){for(var r=String(e),n="",t=0;t<r.length;){var i=r.charAt(t);n+=i in is?is[i]:i,t++}return'"'+n+'"'}var is={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Vr(e){var r=String(e);return r=r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r}function as(e,r){if(Array.isArray(e)){for(var n="[",t=e.length,i=0;i<t;i++)i!==0&&(n+=", "),n+=as(e[i],r);return n+="]",n}else return Le(e,r)}function N0(e){return e&&typeof e=="object"&&typeof e.s=="number"&&typeof e.n=="number"&&typeof e.d=="number"||!1}function Ba(e,r){if(!Sr(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+nr(e)+", index: 0)");if(!Sr(r))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+nr(r)+", index: 1)");return e===r?0:e>r?1:-1}function He(e,r,n){if(!(this instanceof He))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=r,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=new Error().stack}He.prototype=new RangeError,He.prototype.constructor=RangeError,He.prototype.name="DimensionError",He.prototype.isDimensionError=!0;function et(e,r,n){if(!(this instanceof et))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=n),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}et.prototype=new RangeError,et.prototype.constructor=RangeError,et.prototype.name="IndexError",et.prototype.isIndexError=!0;function qe(e){for(var r=[];Array.isArray(e);)r.push(e.length),e=e[0];return r}function os(e,r,n){var t,i=e.length;if(i!==r[n])throw new He(i,r[n]);if(n<r.length-1){var a=n+1;for(t=0;t<i;t++){var o=e[t];if(!Array.isArray(o))throw new He(r.length-1,r.length,"<");os(e[t],r,a)}}else for(t=0;t<i;t++)if(Array.isArray(e[t]))throw new He(r.length+1,r.length,">")}function ss(e,r){var n=r.length===0;if(n){if(Array.isArray(e))throw new He(e.length,0)}else os(e,r,0)}function gi(e,r){var n=e.isMatrix?e._size:qe(e),t=r._sourceSize;t.forEach((i,a)=>{if(i!==null&&i!==n[a])throw new He(i,n[a])})}function ir(e,r){if(e!==void 0){if(!ke(e)||!Se(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof r=="number"&&e>=r)throw new et(e,r)}}function dn(e){for(var r=0;r<e._dimensions.length;++r){var n=e._dimensions[r];if(n._data&&Xe(n._data)){if(n._size[0]===0)return!0}else if(n.isRange){if(n.start===n.end)return!0}else if(Sr(n)&&n.length===0)return!0}return!1}function hn(e,r,n){if(!Array.isArray(r))throw new TypeError("Array expected");if(r.length===0)throw new Error("Resizing to scalar is not supported");r.forEach(function(i){if(!ke(i)||!Se(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Le(r)+")")}),(ke(e)||je(e))&&(e=[e]);var t=n!==void 0?n:0;return Oa(e,r,0,t),e}function Oa(e,r,n,t){var i,a,o=e.length,f=r[n],c=Math.min(o,f);if(e.length=f,n<r.length-1){var u=n+1;for(i=0;i<c;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),Oa(a,r,u,t);for(i=c;i<f;i++)a=[],e[i]=a,Oa(a,r,u,t)}else{for(i=0;i<c;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=c;i<f;i++)e[i]=t}}function Ta(e,r){var n=Ke(e),t=n.length;if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(r.length===0)throw new He(0,t,"!=");r=_a(r,t);var i=us(r);if(t!==i)throw new He(i,t,"!=");try{return D0(n,r)}catch(a){throw a instanceof He?new He(i,t,"!="):a}}function _a(e,r){var n=us(e),t=e.slice(),i=-1,a=e.indexOf(i),o=e.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var f=a>=0,c=r%n===0;if(f)if(c)t[a]=-r/n;else throw new Error("Could not replace wildcard, since "+r+" is no multiple of "+-n);return t}function us(e){return e.reduce((r,n)=>r*n,1)}function D0(e,r){for(var n=e,t,i=r.length-1;i>0;i--){var a=r[i];t=[];for(var o=n.length/a,f=0;f<o;f++)t.push(n.slice(f*a,(f+1)*a));n=t}return n}function vi(e,r){for(var n=r||qe(e);Array.isArray(e)&&e.length===1;)e=e[0],n.shift();for(var t=n.length;n[t-1]===1;)t--;return t<n.length&&(e=ls(e,t,0),n.length=t),e}function ls(e,r,n){var t,i;if(n<r){var a=n+1;for(t=0,i=e.length;t<i;t++)e[t]=ls(e[t],r,a)}else for(;Array.isArray(e);)e=e[0];return e}function cs(e,r,n,t){var i=t||qe(e);if(n)for(var a=0;a<n;a++)e=[e],i.unshift(1);for(e=fs(e,r,0);i.length<r;)i.push(1);return e}function fs(e,r,n){var t,i;if(Array.isArray(e)){var a=n+1;for(t=0,i=e.length;t<i;t++)e[t]=fs(e[t],r,a)}else for(var o=n;o<r;o++)e=[e];return e}function Ke(e){if(!Array.isArray(e))return e;var r=[];return e.forEach(function n(t){Array.isArray(t)?t.forEach(n):r.push(t)}),r}function bt(e,r){return Array.prototype.map.call(e,r)}function yi(e,r){Array.prototype.forEach.call(e,r)}function ps(e,r){if(qe(e).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,r)}function xi(e,r){if(qe(e).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,n=>r.test(n))}function ms(e,r){return Array.prototype.join.call(e,r)}function gn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;var r=[],n=0;r[0]={value:e[0],identifier:0};for(var t=1;t<e.length;t++)e[t]===e[t-1]?n++:n=0,r.push({value:e[t],identifier:n});return r}function bi(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;for(var r=[],n=0;n<e.length;n++)r.push(e[n].value);return r}function Zn(e,r){for(var n,t=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(i===0&&o&&(t=a.length),o&&a.length!==t)return;var f=o?Zn(a,r):r(a);if(n===void 0)n=f;else if(n!==f)return"mixed"}return n}function ds(e,r,n,t){if(t<n){if(e.length!==r.length)throw new He(e.length,r.length);for(var i=[],a=0;a<e.length;a++)i[a]=ds(e[a],r[a],n,t+1);return i}else return e.concat(r)}function hs(){var e=Array.prototype.slice.call(arguments,0,-1),r=Array.prototype.slice.call(arguments,-1);if(e.length===1)return e[0];if(e.length>1)return e.slice(1).reduce(function(n,t){return ds(n,t,r,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function A0(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var t=r.map(p=>p.length),i=Math.max(...t),a=new Array(i).fill(null),o=0;o<r.length;o++)for(var f=r[o],c=t[o],u=0;u<c;u++){var s=i-c+u;f[u]>a[s]&&(a[s]=f[u])}for(var l=0;l<r.length;l++)wi(r[l],a);return a}function wi(e,r){for(var n=r.length,t=e.length,i=0;i<t;i++){var a=n-t+i;if(e[i]<r[a]&&e[i]>1||e[i]>r[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(t," with size ").concat(e[i]," to size ").concat(r[a]))}}function gs(e,r){var n=qe(e);if(Yt(n,r))return e;wi(n,r);var t=A0(n,r),i=t.length,a=[...Array(i-n.length).fill(1),...n],o=M0(e);n.length<i&&(o=Ta(o,a),n=qe(o));for(var f=0;f<i;f++)n[f]<t[f]&&(o=E0(o,t[f],f),n=qe(o));return o}function E0(e,r,n){return hs(...Array(r).fill(e),n)}function M0(e){return dr([],e)}function R(e,r,n,t){function i(a){var o=Qd(a,r.map(C0));return S0(e,r,a),n(o)}return i.isFactory=!0,i.fn=e,i.dependencies=r.slice().sort(),t&&(i.meta=t),i}function S0(e,r,n){var t=r.filter(a=>!F0(a)).every(a=>n[a]!==void 0);if(!t){var i=r.filter(a=>n[a]===void 0);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function F0(e){return e&&e[0]==="?"}function C0(e){return e&&e[0]==="?"?e.slice(1):e}function Tr(e,r){if(ys(e)&&vs(e,r))return e[r];throw typeof e[r]=="function"&&Ia(e,r)?new Error('Cannot access method "'+r+'" as a property'):new Error('No access to property "'+r+'"')}function vn(e,r,n){if(ys(e)&&vs(e,r))return e[r]=n,n;throw new Error('No access to property "'+r+'"')}function B0(e,r){return r in e}function vs(e,r){return!e||typeof e!="object"?!1:Me(T0,r)?!0:!(r in Object.prototype||r in Function.prototype)}function O0(e,r){if(!Ia(e,r))throw new Error('No access to method "'+r+'"');return e[r]}function Ia(e,r){return e==null||typeof e[r]!="function"||Me(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e)?!1:Me(_0,r)?!0:!(r in Object.prototype||r in Function.prototype)}function ys(e){return typeof e=="object"&&e&&e.constructor===Object}var T0={length:!0,name:!0},_0={toString:!0,valueOf:!0,toLocaleString:!0};class za{constructor(r){this.wrappedObject=r}keys(){return Object.keys(this.wrappedObject)}get(r){return Tr(this.wrappedObject,r)}set(r,n){return vn(this.wrappedObject,r,n),this}has(r){return B0(this.wrappedObject,r)}}function yn(){return new Map}function xn(e){if(!e)return yn();if(Ra(e))return e;if(Hn(e))return new za(e);throw new Error("createMap can create maps from objects or Maps")}function I0(e){if(e instanceof za)return e.wrappedObject;var r={};for(var n of e.keys()){var t=e.get(n);vn(r,n,t)}return r}function Ra(e){return e?e instanceof Map||e instanceof za||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}function xs(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];for(var i of n)if(i){if(Ra(i))for(var a of i.keys())e.set(a,i.get(a));else if(Hn(i))for(var o of Object.keys(i))e.set(o,i[o])}return e}var bs=function(){return bs=fn.create,fn},z0=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],R0=R("typed",z0,function(e){var{BigNumber:r,Complex:n,DenseMatrix:t,Fraction:i}=e,a=bs();return a.clear(),a.addTypes([{name:"number",test:ke},{name:"Complex",test:yt},{name:"BigNumber",test:je},{name:"Fraction",test:Ln},{name:"Unit",test:Jr},{name:"identifier",test:o=>Sr&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(o)},{name:"string",test:Sr},{name:"Chain",test:Jo},{name:"Array",test:Xe},{name:"Matrix",test:Be},{name:"DenseMatrix",test:fi},{name:"SparseMatrix",test:Jt},{name:"Range",test:Ma},{name:"Index",test:pi},{name:"boolean",test:kd},{name:"ResultSet",test:jd},{name:"Help",test:Zo},{name:"function",test:Pd},{name:"Date",test:Ud},{name:"RegExp",test:Ld},{name:"null",test:Hd},{name:"undefined",test:$d},{name:"AccessorNode",test:Wt},{name:"ArrayNode",test:Yr},{name:"AssignmentNode",test:Zd},{name:"BlockNode",test:Jd},{name:"ConditionalNode",test:Wd},{name:"ConstantNode",test:Ve},{name:"FunctionNode",test:Bt},{name:"FunctionAssignmentNode",test:$n},{name:"IndexNode",test:ln},{name:"Node",test:tr},{name:"ObjectNode",test:mi},{name:"OperatorNode",test:mr},{name:"ParenthesisNode",test:xt},{name:"RangeNode",test:Yd},{name:"RelationalNode",test:Gd},{name:"SymbolNode",test:br},{name:"Map",test:Ra},{name:"Object",test:Hn}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(o){if(r||qa(o),u0(o)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+o+"). Use function bignumber(x) to convert to BigNumber.");return new r(o)}},{from:"number",to:"Complex",convert:function(o){return n||Ni(o),new n(o,0)}},{from:"BigNumber",to:"Complex",convert:function(o){return n||Ni(o),new n(o.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(o){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(o){return n||Ni(o),new n(o.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(o){i||ka(o);var f=new i(o);if(f.valueOf()!==o)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+o+"). Use function fraction(x) to convert to Fraction.");return f}},{from:"string",to:"number",convert:function(o){var f=Number(o);if(isNaN(f))throw new Error('Cannot convert "'+o+'" to a number');return f}},{from:"string",to:"BigNumber",convert:function(o){r||qa(o);try{return new r(o)}catch{throw new Error('Cannot convert "'+o+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(o){i||ka(o);try{return new i(o)}catch{throw new Error('Cannot convert "'+o+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(o){n||Ni(o);try{return new n(o)}catch{throw new Error('Cannot convert "'+o+'" to Complex')}}},{from:"boolean",to:"number",convert:function(o){return+o}},{from:"boolean",to:"BigNumber",convert:function(o){return r||qa(o),new r(+o)}},{from:"boolean",to:"Fraction",convert:function(o){return i||ka(o),new i(+o)}},{from:"boolean",to:"string",convert:function(o){return String(o)}},{from:"Array",to:"Matrix",convert:function(o){return t||q0(),new t(o)}},{from:"Matrix",to:"Array",convert:function(o){return o.valueOf()}}]),a.onMismatch=(o,f,c)=>{var u=a.createError(o,f,c);if(["wrongType","mismatch"].includes(u.data.category)&&f.length===1&&Wr(f[0])&&c.some(l=>!l.params.includes(","))){var s=new TypeError("Function '".concat(o,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(o,")'."));throw s.data=u.data,s}throw u},a.onMismatch=(o,f,c)=>{var u=a.createError(o,f,c);if(["wrongType","mismatch"].includes(u.data.category)&&f.length===1&&Wr(f[0])&&c.some(l=>!l.params.includes(","))){var s=new TypeError("Function '".concat(o,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(o,")'."));throw s.data=u.data,s}throw u},a});function qa(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function Ni(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function q0(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function ka(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var k0="ResultSet",j0=[],P0=R(k0,j0,()=>{function e(r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(r){return new e(r.entries)},e},{isClass:!0});/*!
9
+ * decimal.js v10.4.3
10
+ * An arbitrary-precision Decimal type for JavaScript.
11
+ * https://github.com/MikeMcl/decimal.js
12
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
13
+ * MIT Licence
14
+ */var bn=9e15,Tt=1e9,ja="0123456789abcdef",Di="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ai="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Pa={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-bn,maxE:bn,crypto:!1},ws,wt,ze=!0,Ei="[DecimalError] ",_t=Ei+"Invalid argument: ",Ns=Ei+"Precision limit exceeded",Ds=Ei+"crypto unavailable",As="[object Decimal]",Fr=Math.floor,hr=Math.pow,U0=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,L0=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,H0=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Es=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,rt=1e7,Oe=7,$0=9007199254740991,Z0=Di.length-1,Ua=Ai.length-1,ge={toStringTag:As};ge.absoluteValue=ge.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ce(e)},ge.ceil=function(){return Ce(new this.constructor(this),this.e+1,2)},ge.clampedTo=ge.clamp=function(e,r){var n,t=this,i=t.constructor;if(e=new i(e),r=new i(r),!e.s||!r.s)return new i(NaN);if(e.gt(r))throw Error(_t+r);return n=t.cmp(e),n<0?e:t.cmp(r)>0?r:new i(t)},ge.comparedTo=ge.cmp=function(e){var r,n,t,i,a=this,o=a.d,f=(e=new a.constructor(e)).d,c=a.s,u=e.s;if(!o||!f)return!c||!u?NaN:c!==u?c:o===f?0:!o^c<0?1:-1;if(!o[0]||!f[0])return o[0]?c:f[0]?-u:0;if(c!==u)return c;if(a.e!==e.e)return a.e>e.e^c<0?1:-1;for(t=o.length,i=f.length,r=0,n=t<i?t:i;r<n;++r)if(o[r]!==f[r])return o[r]>f[r]^c<0?1:-1;return t===i?0:t>i^c<0?1:-1},ge.cosine=ge.cos=function(){var e,r,n=this,t=n.constructor;return n.d?n.d[0]?(e=t.precision,r=t.rounding,t.precision=e+Math.max(n.e,n.sd())+Oe,t.rounding=1,n=J0(t,Os(t,n)),t.precision=e,t.rounding=r,Ce(wt==2||wt==3?n.neg():n,e,r,!0)):new t(1):new t(NaN)},ge.cubeRoot=ge.cbrt=function(){var e,r,n,t,i,a,o,f,c,u,s=this,l=s.constructor;if(!s.isFinite()||s.isZero())return new l(s);for(ze=!1,a=s.s*hr(s.s*s,1/3),!a||Math.abs(a)==1/0?(n=Nr(s.d),e=s.e,(a=(e-n.length+1)%3)&&(n+=a==1||a==-2?"0":"00"),a=hr(n,1/3),e=Fr((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?n="5e"+e:(n=a.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),t=new l(n),t.s=s.s):t=new l(a.toString()),o=(e=l.precision)+3;;)if(f=t,c=f.times(f).times(f),u=c.plus(s),t=ur(u.plus(s).times(f),u.plus(c),o+2,1),Nr(f.d).slice(0,o)===(n=Nr(t.d)).slice(0,o))if(n=n.slice(o-3,o+1),n=="9999"||!i&&n=="4999"){if(!i&&(Ce(f,e+1,0),f.times(f).times(f).eq(s))){t=f;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(Ce(t,e+1,1),r=!t.times(t).times(t).eq(s));break}return ze=!0,Ce(t,e,l.rounding,r)},ge.decimalPlaces=ge.dp=function(){var e,r=this.d,n=NaN;if(r){if(e=r.length-1,n=(e-Fr(this.e/Oe))*Oe,e=r[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},ge.dividedBy=ge.div=function(e){return ur(this,new this.constructor(e))},ge.dividedToIntegerBy=ge.divToInt=function(e){var r=this,n=r.constructor;return Ce(ur(r,new n(e),0,1,1),n.precision,n.rounding)},ge.equals=ge.eq=function(e){return this.cmp(e)===0},ge.floor=function(){return Ce(new this.constructor(this),this.e+1,3)},ge.greaterThan=ge.gt=function(e){return this.cmp(e)>0},ge.greaterThanOrEqualTo=ge.gte=function(e){var r=this.cmp(e);return r==1||r===0},ge.hyperbolicCosine=ge.cosh=function(){var e,r,n,t,i,a=this,o=a.constructor,f=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return f;n=o.precision,t=o.rounding,o.precision=n+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),r=(1/Ci(4,e)).toString()):(e=16,r="2.3283064365386962890625e-10"),a=wn(o,1,a.times(r),new o(1),!0);for(var c,u=e,s=new o(8);u--;)c=a.times(a),a=f.minus(c.times(s.minus(c.times(s))));return Ce(a,o.precision=n,o.rounding=t,!0)},ge.hyperbolicSine=ge.sinh=function(){var e,r,n,t,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(r=a.precision,n=a.rounding,a.precision=r+Math.max(i.e,i.sd())+4,a.rounding=1,t=i.d.length,t<3)i=wn(a,2,i,i,!0);else{e=1.4*Math.sqrt(t),e=e>16?16:e|0,i=i.times(1/Ci(5,e)),i=wn(a,2,i,i,!0);for(var o,f=new a(5),c=new a(16),u=new a(20);e--;)o=i.times(i),i=i.times(f.plus(o.times(c.times(o).plus(u))))}return a.precision=r,a.rounding=n,Ce(i,r,n,!0)},ge.hyperbolicTangent=ge.tanh=function(){var e,r,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(e=t.precision,r=t.rounding,t.precision=e+7,t.rounding=1,ur(n.sinh(),n.cosh(),t.precision=e,t.rounding=r)):new t(n.s)},ge.inverseCosine=ge.acos=function(){var e,r=this,n=r.constructor,t=r.abs().cmp(1),i=n.precision,a=n.rounding;return t!==-1?t===0?r.isNeg()?tt(n,i,a):new n(0):new n(NaN):r.isZero()?tt(n,i+4,a).times(.5):(n.precision=i+6,n.rounding=1,r=r.asin(),e=tt(n,i+4,a).times(.5),n.precision=i,n.rounding=a,e.minus(r))},ge.inverseHyperbolicCosine=ge.acosh=function(){var e,r,n=this,t=n.constructor;return n.lte(1)?new t(n.eq(1)?0:NaN):n.isFinite()?(e=t.precision,r=t.rounding,t.precision=e+Math.max(Math.abs(n.e),n.sd())+4,t.rounding=1,ze=!1,n=n.times(n).minus(1).sqrt().plus(n),ze=!0,t.precision=e,t.rounding=r,n.ln()):new t(n)},ge.inverseHyperbolicSine=ge.asinh=function(){var e,r,n=this,t=n.constructor;return!n.isFinite()||n.isZero()?new t(n):(e=t.precision,r=t.rounding,t.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,t.rounding=1,ze=!1,n=n.times(n).plus(1).sqrt().plus(n),ze=!0,t.precision=e,t.rounding=r,n.ln())},ge.inverseHyperbolicTangent=ge.atanh=function(){var e,r,n,t,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,r=a.rounding,t=i.sd(),Math.max(t,e)<2*-i.e-1?Ce(new a(i),e,r,!0):(a.precision=n=t-i.e,i=ur(i.plus(1),new a(1).minus(i),n+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=r,i.times(.5))):new a(NaN)},ge.inverseSine=ge.asin=function(){var e,r,n,t,i=this,a=i.constructor;return i.isZero()?new a(i):(r=i.abs().cmp(1),n=a.precision,t=a.rounding,r!==-1?r===0?(e=tt(a,n+4,t).times(.5),e.s=i.s,e):new a(NaN):(a.precision=n+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=n,a.rounding=t,i.times(2)))},ge.inverseTangent=ge.atan=function(){var e,r,n,t,i,a,o,f,c,u=this,s=u.constructor,l=s.precision,p=s.rounding;if(u.isFinite()){if(u.isZero())return new s(u);if(u.abs().eq(1)&&l+4<=Ua)return o=tt(s,l+4,p).times(.25),o.s=u.s,o}else{if(!u.s)return new s(NaN);if(l+4<=Ua)return o=tt(s,l+4,p).times(.5),o.s=u.s,o}for(s.precision=f=l+10,s.rounding=1,n=Math.min(28,f/Oe+2|0),e=n;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ze=!1,r=Math.ceil(f/Oe),t=1,c=u.times(u),o=new s(u),i=u;e!==-1;)if(i=i.times(c),a=o.minus(i.div(t+=2)),i=i.times(c),o=a.plus(i.div(t+=2)),o.d[r]!==void 0)for(e=r;o.d[e]===a.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),ze=!0,Ce(o,s.precision=l,s.rounding=p,!0)},ge.isFinite=function(){return!!this.d},ge.isInteger=ge.isInt=function(){return!!this.d&&Fr(this.e/Oe)>this.d.length-2},ge.isNaN=function(){return!this.s},ge.isNegative=ge.isNeg=function(){return this.s<0},ge.isPositive=ge.isPos=function(){return this.s>0},ge.isZero=function(){return!!this.d&&this.d[0]===0},ge.lessThan=ge.lt=function(e){return this.cmp(e)<0},ge.lessThanOrEqualTo=ge.lte=function(e){return this.cmp(e)<1},ge.logarithm=ge.log=function(e){var r,n,t,i,a,o,f,c,u=this,s=u.constructor,l=s.precision,p=s.rounding,m=5;if(e==null)e=new s(10),r=!0;else{if(e=new s(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new s(NaN);r=e.eq(10)}if(n=u.d,u.s<0||!n||!n[0]||u.eq(1))return new s(n&&!n[0]?-1/0:u.s!=1?NaN:n?0:1/0);if(r)if(n.length>1)a=!0;else{for(i=n[0];i%10===0;)i/=10;a=i!==1}if(ze=!1,f=l+m,o=zt(u,f),t=r?Fi(s,f+10):zt(e,f),c=ur(o,t,f,1),Jn(c.d,i=l,p))do if(f+=10,o=zt(u,f),t=r?Fi(s,f+10):zt(e,f),c=ur(o,t,f,1),!a){+Nr(c.d).slice(i+1,i+15)+1==1e14&&(c=Ce(c,l+1,0));break}while(Jn(c.d,i+=10,p));return ze=!0,Ce(c,l,p)},ge.minus=ge.sub=function(e){var r,n,t,i,a,o,f,c,u,s,l,p,m=this,d=m.constructor;if(e=new d(e),!m.d||!e.d)return!m.s||!e.s?e=new d(NaN):m.d?e.s=-e.s:e=new d(e.d||m.s!==e.s?m:NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(u=m.d,p=e.d,f=d.precision,c=d.rounding,!u[0]||!p[0]){if(p[0])e.s=-e.s;else if(u[0])e=new d(m);else return new d(c===3?-0:0);return ze?Ce(e,f,c):e}if(n=Fr(e.e/Oe),s=Fr(m.e/Oe),u=u.slice(),a=s-n,a){for(l=a<0,l?(r=u,a=-a,o=p.length):(r=p,n=s,o=u.length),t=Math.max(Math.ceil(f/Oe),o)+2,a>t&&(a=t,r.length=1),r.reverse(),t=a;t--;)r.push(0);r.reverse()}else{for(t=u.length,o=p.length,l=t<o,l&&(o=t),t=0;t<o;t++)if(u[t]!=p[t]){l=u[t]<p[t];break}a=0}for(l&&(r=u,u=p,p=r,e.s=-e.s),o=u.length,t=p.length-o;t>0;--t)u[o++]=0;for(t=p.length;t>a;){if(u[--t]<p[t]){for(i=t;i&&u[--i]===0;)u[i]=rt-1;--u[i],u[t]+=rt}u[t]-=p[t]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=Si(u,n),ze?Ce(e,f,c):e):new d(c===3?-0:0)},ge.modulo=ge.mod=function(e){var r,n=this,t=n.constructor;return e=new t(e),!n.d||!e.s||e.d&&!e.d[0]?new t(NaN):!e.d||n.d&&!n.d[0]?Ce(new t(n),t.precision,t.rounding):(ze=!1,t.modulo==9?(r=ur(n,e.abs(),0,3,1),r.s*=e.s):r=ur(n,e,0,t.modulo,1),r=r.times(e),ze=!0,n.minus(r))},ge.naturalExponential=ge.exp=function(){return La(this)},ge.naturalLogarithm=ge.ln=function(){return zt(this)},ge.negated=ge.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Ce(e)},ge.plus=ge.add=function(e){var r,n,t,i,a,o,f,c,u,s,l=this,p=l.constructor;if(e=new p(e),!l.d||!e.d)return!l.s||!e.s?e=new p(NaN):l.d||(e=new p(e.d||l.s===e.s?l:NaN)),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(u=l.d,s=e.d,f=p.precision,c=p.rounding,!u[0]||!s[0])return s[0]||(e=new p(l)),ze?Ce(e,f,c):e;if(a=Fr(l.e/Oe),t=Fr(e.e/Oe),u=u.slice(),i=a-t,i){for(i<0?(n=u,i=-i,o=s.length):(n=s,t=a,o=u.length),a=Math.ceil(f/Oe),o=a>o?a+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=u.length,i=s.length,o-i<0&&(i=o,n=s,s=u,u=n),r=0;i;)r=(u[--i]=u[i]+s[i]+r)/rt|0,u[i]%=rt;for(r&&(u.unshift(r),++t),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Si(u,t),ze?Ce(e,f,c):e},ge.precision=ge.sd=function(e){var r,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(_t+e);return n.d?(r=Ms(n.d),e&&n.e+1>r&&(r=n.e+1)):r=NaN,r},ge.round=function(){var e=this,r=e.constructor;return Ce(new r(e),e.e+1,r.rounding)},ge.sine=ge.sin=function(){var e,r,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(e=t.precision,r=t.rounding,t.precision=e+Math.max(n.e,n.sd())+Oe,t.rounding=1,n=Y0(t,Os(t,n)),t.precision=e,t.rounding=r,Ce(wt>2?n.neg():n,e,r,!0)):new t(NaN)},ge.squareRoot=ge.sqrt=function(){var e,r,n,t,i,a,o=this,f=o.d,c=o.e,u=o.s,s=o.constructor;if(u!==1||!f||!f[0])return new s(!u||u<0&&(!f||f[0])?NaN:f?o:1/0);for(ze=!1,u=Math.sqrt(+o),u==0||u==1/0?(r=Nr(f),(r.length+c)%2==0&&(r+="0"),u=Math.sqrt(r),c=Fr((c+1)/2)-(c<0||c%2),u==1/0?r="5e"+c:(r=u.toExponential(),r=r.slice(0,r.indexOf("e")+1)+c),t=new s(r)):t=new s(u.toString()),n=(c=s.precision)+3;;)if(a=t,t=a.plus(ur(o,a,n+2,1)).times(.5),Nr(a.d).slice(0,n)===(r=Nr(t.d)).slice(0,n))if(r=r.slice(n-3,n+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ce(a,c+1,0),a.times(a).eq(o))){t=a;break}n+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Ce(t,c+1,1),e=!t.times(t).eq(o));break}return ze=!0,Ce(t,c,s.rounding,e)},ge.tangent=ge.tan=function(){var e,r,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(e=t.precision,r=t.rounding,t.precision=e+10,t.rounding=1,n=n.sin(),n.s=1,n=ur(n,new t(1).minus(n.times(n)).sqrt(),e+10,0),t.precision=e,t.rounding=r,Ce(wt==2||wt==4?n.neg():n,e,r,!0)):new t(NaN)},ge.times=ge.mul=function(e){var r,n,t,i,a,o,f,c,u,s=this,l=s.constructor,p=s.d,m=(e=new l(e)).d;if(e.s*=s.s,!p||!p[0]||!m||!m[0])return new l(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?e.s/0:e.s*0);for(n=Fr(s.e/Oe)+Fr(e.e/Oe),c=p.length,u=m.length,c<u&&(a=p,p=m,m=a,o=c,c=u,u=o),a=[],o=c+u,t=o;t--;)a.push(0);for(t=u;--t>=0;){for(r=0,i=c+t;i>t;)f=a[i]+m[t]*p[i-t-1]+r,a[i--]=f%rt|0,r=f/rt|0;a[i]=(a[i]+r)%rt|0}for(;!a[--o];)a.pop();return r?++n:a.shift(),e.d=a,e.e=Si(a,n),ze?Ce(e,l.precision,l.rounding):e},ge.toBinary=function(e,r){return $a(this,2,e,r)},ge.toDecimalPlaces=ge.toDP=function(e,r){var n=this,t=n.constructor;return n=new t(n),e===void 0?n:(Pr(e,0,Tt),r===void 0?r=t.rounding:Pr(r,0,8),Ce(n,e+n.e+1,r))},ge.toExponential=function(e,r){var n,t=this,i=t.constructor;return e===void 0?n=ft(t,!0):(Pr(e,0,Tt),r===void 0?r=i.rounding:Pr(r,0,8),t=Ce(new i(t),e+1,r),n=ft(t,!0,e+1)),t.isNeg()&&!t.isZero()?"-"+n:n},ge.toFixed=function(e,r){var n,t,i=this,a=i.constructor;return e===void 0?n=ft(i):(Pr(e,0,Tt),r===void 0?r=a.rounding:Pr(r,0,8),t=Ce(new a(i),e+i.e+1,r),n=ft(t,!1,e+t.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},ge.toFraction=function(e){var r,n,t,i,a,o,f,c,u,s,l,p,m=this,d=m.d,g=m.constructor;if(!d)return new g(m);if(u=n=new g(1),t=c=new g(0),r=new g(t),a=r.e=Ms(d)-m.e-1,o=a%Oe,r.d[0]=hr(10,o<0?Oe+o:o),e==null)e=a>0?r:u;else{if(f=new g(e),!f.isInt()||f.lt(u))throw Error(_t+f);e=f.gt(r)?a>0?r:u:f}for(ze=!1,f=new g(Nr(d)),s=g.precision,g.precision=a=d.length*Oe*2;l=ur(f,r,0,1,1),i=n.plus(l.times(t)),i.cmp(e)!=1;)n=t,t=i,i=u,u=c.plus(l.times(i)),c=i,i=r,r=f.minus(l.times(i)),f=i;return i=ur(e.minus(n),t,0,1,1),c=c.plus(i.times(u)),n=n.plus(i.times(t)),c.s=u.s=m.s,p=ur(u,t,a,1).minus(m).abs().cmp(ur(c,n,a,1).minus(m).abs())<1?[u,t]:[c,n],g.precision=s,ze=!0,p},ge.toHexadecimal=ge.toHex=function(e,r){return $a(this,16,e,r)},ge.toNearest=function(e,r){var n=this,t=n.constructor;if(n=new t(n),e==null){if(!n.d)return n;e=new t(1),r=t.rounding}else{if(e=new t(e),r===void 0?r=t.rounding:Pr(r,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(ze=!1,n=ur(n,e,0,r,1).times(e),ze=!0,Ce(n)):(e.s=n.s,n=e),n},ge.toNumber=function(){return+this},ge.toOctal=function(e,r){return $a(this,8,e,r)},ge.toPower=ge.pow=function(e){var r,n,t,i,a,o,f=this,c=f.constructor,u=+(e=new c(e));if(!f.d||!e.d||!f.d[0]||!e.d[0])return new c(hr(+f,u));if(f=new c(f),f.eq(1))return f;if(t=c.precision,a=c.rounding,e.eq(1))return Ce(f,t,a);if(r=Fr(e.e/Oe),r>=e.d.length-1&&(n=u<0?-u:u)<=$0)return i=Ss(c,f,n,t),e.s<0?new c(1).div(i):Ce(i,t,a);if(o=f.s,o<0){if(r<e.d.length-1)return new c(NaN);if(e.d[r]&1||(o=1),f.e==0&&f.d[0]==1&&f.d.length==1)return f.s=o,f}return n=hr(+f,u),r=n==0||!isFinite(n)?Fr(u*(Math.log("0."+Nr(f.d))/Math.LN10+f.e+1)):new c(n+"").e,r>c.maxE+1||r<c.minE-1?new c(r>0?o/0:0):(ze=!1,c.rounding=f.s=1,n=Math.min(12,(r+"").length),i=La(e.times(zt(f,t+n)),t),i.d&&(i=Ce(i,t+5,1),Jn(i.d,t,a)&&(r=t+10,i=Ce(La(e.times(zt(f,r+n)),r),r+5,1),+Nr(i.d).slice(t+1,t+15)+1==1e14&&(i=Ce(i,t+1,0)))),i.s=o,ze=!0,c.rounding=a,Ce(i,t,a))},ge.toPrecision=function(e,r){var n,t=this,i=t.constructor;return e===void 0?n=ft(t,t.e<=i.toExpNeg||t.e>=i.toExpPos):(Pr(e,1,Tt),r===void 0?r=i.rounding:Pr(r,0,8),t=Ce(new i(t),e,r),n=ft(t,e<=t.e||t.e<=i.toExpNeg,e)),t.isNeg()&&!t.isZero()?"-"+n:n},ge.toSignificantDigits=ge.toSD=function(e,r){var n=this,t=n.constructor;return e===void 0?(e=t.precision,r=t.rounding):(Pr(e,1,Tt),r===void 0?r=t.rounding:Pr(r,0,8)),Ce(new t(n),e,r)},ge.toString=function(){var e=this,r=e.constructor,n=ft(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},ge.truncated=ge.trunc=function(){return Ce(new this.constructor(this),this.e+1,1)},ge.valueOf=ge.toJSON=function(){var e=this,r=e.constructor,n=ft(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()?"-"+n:n};function Nr(e){var r,n,t,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,r=1;r<i;r++)t=e[r]+"",n=Oe-t.length,n&&(a+=It(n)),a+=t;o=e[r],t=o+"",n=Oe-t.length,n&&(a+=It(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function Pr(e,r,n){if(e!==~~e||e<r||e>n)throw Error(_t+e)}function Jn(e,r,n,t){var i,a,o,f;for(a=e[0];a>=10;a/=10)--r;return--r<0?(r+=Oe,i=0):(i=Math.ceil((r+1)/Oe),r%=Oe),a=hr(10,Oe-r),f=e[i]%a|0,t==null?r<3?(r==0?f=f/100|0:r==1&&(f=f/10|0),o=n<4&&f==99999||n>3&&f==49999||f==5e4||f==0):o=(n<4&&f+1==a||n>3&&f+1==a/2)&&(e[i+1]/a/100|0)==hr(10,r-2)-1||(f==a/2||f==0)&&(e[i+1]/a/100|0)==0:r<4?(r==0?f=f/1e3|0:r==1?f=f/100|0:r==2&&(f=f/10|0),o=(t||n<4)&&f==9999||!t&&n>3&&f==4999):o=((t||n<4)&&f+1==a||!t&&n>3&&f+1==a/2)&&(e[i+1]/a/1e3|0)==hr(10,r-3)-1,o}function Mi(e,r,n){for(var t,i=[0],a,o=0,f=e.length;o<f;){for(a=i.length;a--;)i[a]*=r;for(i[0]+=ja.indexOf(e.charAt(o++)),t=0;t<i.length;t++)i[t]>n-1&&(i[t+1]===void 0&&(i[t+1]=0),i[t+1]+=i[t]/n|0,i[t]%=n)}return i.reverse()}function J0(e,r){var n,t,i;if(r.isZero())return r;t=r.d.length,t<32?(n=Math.ceil(t/3),i=(1/Ci(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,r=wn(e,1,r.times(i),new e(1));for(var a=n;a--;){var o=r.times(r);r=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,r}var ur=function(){function e(t,i,a){var o,f=0,c=t.length;for(t=t.slice();c--;)o=t[c]*i+f,t[c]=o%a|0,f=o/a|0;return f&&t.unshift(f),t}function r(t,i,a,o){var f,c;if(a!=o)c=a>o?1:-1;else for(f=c=0;f<a;f++)if(t[f]!=i[f]){c=t[f]>i[f]?1:-1;break}return c}function n(t,i,a,o){for(var f=0;a--;)t[a]-=f,f=t[a]<i[a]?1:0,t[a]=f*o+t[a]-i[a];for(;!t[0]&&t.length>1;)t.shift()}return function(t,i,a,o,f,c){var u,s,l,p,m,d,g,w,v,b,h,x,y,N,A,E,D,M,S,B,I=t.constructor,j=t.s==i.s?1:-1,_=t.d,O=i.d;if(!_||!_[0]||!O||!O[0])return new I(!t.s||!i.s||(_?O&&_[0]==O[0]:!O)?NaN:_&&_[0]==0||!O?j*0:j/0);for(c?(m=1,s=t.e-i.e):(c=rt,m=Oe,s=Fr(t.e/m)-Fr(i.e/m)),S=O.length,D=_.length,v=new I(j),b=v.d=[],l=0;O[l]==(_[l]||0);l++);if(O[l]>(_[l]||0)&&s--,a==null?(N=a=I.precision,o=I.rounding):f?N=a+(t.e-i.e)+1:N=a,N<0)b.push(1),d=!0;else{if(N=N/m+2|0,l=0,S==1){for(p=0,O=O[0],N++;(l<D||p)&&N--;l++)A=p*c+(_[l]||0),b[l]=A/O|0,p=A%O|0;d=p||l<D}else{for(p=c/(O[0]+1)|0,p>1&&(O=e(O,p,c),_=e(_,p,c),S=O.length,D=_.length),E=S,h=_.slice(0,S),x=h.length;x<S;)h[x++]=0;B=O.slice(),B.unshift(0),M=O[0],O[1]>=c/2&&++M;do p=0,u=r(O,h,S,x),u<0?(y=h[0],S!=x&&(y=y*c+(h[1]||0)),p=y/M|0,p>1?(p>=c&&(p=c-1),g=e(O,p,c),w=g.length,x=h.length,u=r(g,h,w,x),u==1&&(p--,n(g,S<w?B:O,w,c))):(p==0&&(u=p=1),g=O.slice()),w=g.length,w<x&&g.unshift(0),n(h,g,x,c),u==-1&&(x=h.length,u=r(O,h,S,x),u<1&&(p++,n(h,S<x?B:O,x,c))),x=h.length):u===0&&(p++,h=[0]),b[l++]=p,u&&h[0]?h[x++]=_[E]||0:(h=[_[E]],x=1);while((E++<D||h[0]!==void 0)&&N--);d=h[0]!==void 0}b[0]||b.shift()}if(m==1)v.e=s,ws=d;else{for(l=1,p=b[0];p>=10;p/=10)l++;v.e=l+s*m-1,Ce(v,f?a+v.e+1:a,o,d)}return v}}();function Ce(e,r,n,t){var i,a,o,f,c,u,s,l,p,m=e.constructor;e:if(r!=null){if(l=e.d,!l)return e;for(i=1,f=l[0];f>=10;f/=10)i++;if(a=r-i,a<0)a+=Oe,o=r,s=l[p=0],c=s/hr(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/Oe),f=l.length,p>=f)if(t){for(;f++<=p;)l.push(0);s=c=0,i=1,a%=Oe,o=a-Oe+1}else break e;else{for(s=f=l[p],i=1;f>=10;f/=10)i++;a%=Oe,o=a-Oe+i,c=o<0?0:s/hr(10,i-o-1)%10|0}if(t=t||r<0||l[p+1]!==void 0||(o<0?s:s%hr(10,i-o-1)),u=n<4?(c||t)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||t||n==6&&(a>0?o>0?s/hr(10,i-o):0:l[p-1])%10&1||n==(e.s<0?8:7)),r<1||!l[0])return l.length=0,u?(r-=e.e+1,l[0]=hr(10,(Oe-r%Oe)%Oe),e.e=-r||0):l[0]=e.e=0,e;if(a==0?(l.length=p,f=1,p--):(l.length=p+1,f=hr(10,Oe-a),l[p]=o>0?(s/hr(10,i-o)%hr(10,o)|0)*f:0),u)for(;;)if(p==0){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=f,f=1;o>=10;o/=10)f++;a!=f&&(e.e++,l[0]==rt&&(l[0]=1));break}else{if(l[p]+=f,l[p]!=rt)break;l[p--]=0,f=1}for(a=l.length;l[--a]===0;)l.pop()}return ze&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function ft(e,r,n){if(!e.isFinite())return Bs(e);var t,i=e.e,a=Nr(e.d),o=a.length;return r?(n&&(t=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+It(t):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+It(-i-1)+a,n&&(t=n-o)>0&&(a+=It(t))):i>=o?(a+=It(i+1-o),n&&(t=n-i-1)>0&&(a=a+"."+It(t))):((t=i+1)<o&&(a=a.slice(0,t)+"."+a.slice(t)),n&&(t=n-o)>0&&(i+1===o&&(a+="."),a+=It(t))),a}function Si(e,r){var n=e[0];for(r*=Oe;n>=10;n/=10)r++;return r}function Fi(e,r,n){if(r>Z0)throw ze=!0,n&&(e.precision=n),Error(Ns);return Ce(new e(Di),r,1,!0)}function tt(e,r,n){if(r>Ua)throw Error(Ns);return Ce(new e(Ai),r,n,!0)}function Ms(e){var r=e.length-1,n=r*Oe+1;if(r=e[r],r){for(;r%10==0;r/=10)n--;for(r=e[0];r>=10;r/=10)n++}return n}function It(e){for(var r="";e--;)r+="0";return r}function Ss(e,r,n,t){var i,a=new e(1),o=Math.ceil(t/Oe+4);for(ze=!1;;){if(n%2&&(a=a.times(r),Ts(a.d,o)&&(i=!0)),n=Fr(n/2),n===0){n=a.d.length-1,i&&a.d[n]===0&&++a.d[n];break}r=r.times(r),Ts(r.d,o)}return ze=!0,a}function Fs(e){return e.d[e.d.length-1]&1}function Cs(e,r,n){for(var t,i=new e(r[0]),a=0;++a<r.length;)if(t=new e(r[a]),t.s)i[n](t)&&(i=t);else{i=t;break}return i}function La(e,r){var n,t,i,a,o,f,c,u=0,s=0,l=0,p=e.constructor,m=p.rounding,d=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(r==null?(ze=!1,c=d):c=r,f=new p(.03125);e.e>-2;)e=e.times(f),l+=5;for(t=Math.log(hr(2,l))/Math.LN10*2+5|0,c+=t,n=a=o=new p(1),p.precision=c;;){if(a=Ce(a.times(e),c,1),n=n.times(++s),f=o.plus(ur(a,n,c,1)),Nr(f.d).slice(0,c)===Nr(o.d).slice(0,c)){for(i=l;i--;)o=Ce(o.times(o),c,1);if(r==null)if(u<3&&Jn(o.d,c-t,m,u))p.precision=c+=10,n=a=f=new p(1),s=0,u++;else return Ce(o,p.precision=d,m,ze=!0);else return p.precision=d,o}o=f}}function zt(e,r){var n,t,i,a,o,f,c,u,s,l,p,m=1,d=10,g=e,w=g.d,v=g.constructor,b=v.rounding,h=v.precision;if(g.s<0||!w||!w[0]||!g.e&&w[0]==1&&w.length==1)return new v(w&&!w[0]?-1/0:g.s!=1?NaN:w?0:g);if(r==null?(ze=!1,s=h):s=r,v.precision=s+=d,n=Nr(w),t=n.charAt(0),Math.abs(a=g.e)<15e14){for(;t<7&&t!=1||t==1&&n.charAt(1)>3;)g=g.times(e),n=Nr(g.d),t=n.charAt(0),m++;a=g.e,t>1?(g=new v("0."+n),a++):g=new v(t+"."+n.slice(1))}else return u=Fi(v,s+2,h).times(a+""),g=zt(new v(t+"."+n.slice(1)),s-d).plus(u),v.precision=h,r==null?Ce(g,h,b,ze=!0):g;for(l=g,c=o=g=ur(g.minus(1),g.plus(1),s,1),p=Ce(g.times(g),s,1),i=3;;){if(o=Ce(o.times(p),s,1),u=c.plus(ur(o,new v(i),s,1)),Nr(u.d).slice(0,s)===Nr(c.d).slice(0,s))if(c=c.times(2),a!==0&&(c=c.plus(Fi(v,s+2,h).times(a+""))),c=ur(c,new v(m),s,1),r==null)if(Jn(c.d,s-d,b,f))v.precision=s+=d,u=o=g=ur(l.minus(1),l.plus(1),s,1),p=Ce(g.times(g),s,1),i=f=1;else return Ce(c,v.precision=h,b,ze=!0);else return v.precision=h,c;c=u,i+=2}}function Bs(e){return String(e.s*e.s/0)}function Ha(e,r){var n,t,i;for((n=r.indexOf("."))>-1&&(r=r.replace(".","")),(t=r.search(/e/i))>0?(n<0&&(n=t),n+=+r.slice(t+1),r=r.substring(0,t)):n<0&&(n=r.length),t=0;r.charCodeAt(t)===48;t++);for(i=r.length;r.charCodeAt(i-1)===48;--i);if(r=r.slice(t,i),r){if(i-=t,e.e=n=n-t-1,e.d=[],t=(n+1)%Oe,n<0&&(t+=Oe),t<i){for(t&&e.d.push(+r.slice(0,t)),i-=Oe;t<i;)e.d.push(+r.slice(t,t+=Oe));r=r.slice(t),t=Oe-r.length}else t-=i;for(;t--;)r+="0";e.d.push(+r),ze&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function W0(e,r){var n,t,i,a,o,f,c,u,s;if(r.indexOf("_")>-1){if(r=r.replace(/(\d)_(?=\d)/g,"$1"),Es.test(r))return Ha(e,r)}else if(r==="Infinity"||r==="NaN")return+r||(e.s=NaN),e.e=NaN,e.d=null,e;if(L0.test(r))n=16,r=r.toLowerCase();else if(U0.test(r))n=2;else if(H0.test(r))n=8;else throw Error(_t+r);for(a=r.search(/p/i),a>0?(c=+r.slice(a+1),r=r.substring(2,a)):r=r.slice(2),a=r.indexOf("."),o=a>=0,t=e.constructor,o&&(r=r.replace(".",""),f=r.length,a=f-a,i=Ss(t,new t(n),a,a*2)),u=Mi(r,n,rt),s=u.length-1,a=s;u[a]===0;--a)u.pop();return a<0?new t(e.s*0):(e.e=Si(u,s),e.d=u,ze=!1,o&&(e=ur(e,i,f*4)),c&&(e=e.times(Math.abs(c)<54?hr(2,c):Rt.pow(2,c))),ze=!0,e)}function Y0(e,r){var n,t=r.d.length;if(t<3)return r.isZero()?r:wn(e,2,r,r);n=1.4*Math.sqrt(t),n=n>16?16:n|0,r=r.times(1/Ci(5,n)),r=wn(e,2,r,r);for(var i,a=new e(5),o=new e(16),f=new e(20);n--;)i=r.times(r),r=r.times(a.plus(i.times(o.times(i).minus(f))));return r}function wn(e,r,n,t,i){var a,o,f,c,u=e.precision,s=Math.ceil(u/Oe);for(ze=!1,c=n.times(n),f=new e(t);;){if(o=ur(f.times(c),new e(r++*r++),u,1),f=i?t.plus(o):t.minus(o),t=ur(o.times(c),new e(r++*r++),u,1),o=f.plus(t),o.d[s]!==void 0){for(a=s;o.d[a]===f.d[a]&&a--;);if(a==-1)break}a=f,f=t,t=o,o=a}return ze=!0,o.d.length=s+1,o}function Ci(e,r){for(var n=e;--r;)n*=e;return n}function Os(e,r){var n,t=r.s<0,i=tt(e,e.precision,1),a=i.times(.5);if(r=r.abs(),r.lte(a))return wt=t?4:1,r;if(n=r.divToInt(i),n.isZero())wt=t?3:2;else{if(r=r.minus(n.times(i)),r.lte(a))return wt=Fs(n)?t?2:3:t?4:1,r;wt=Fs(n)?t?1:4:t?3:2}return r.minus(i).abs()}function $a(e,r,n,t){var i,a,o,f,c,u,s,l,p,m=e.constructor,d=n!==void 0;if(d?(Pr(n,1,Tt),t===void 0?t=m.rounding:Pr(t,0,8)):(n=m.precision,t=m.rounding),!e.isFinite())s=Bs(e);else{for(s=ft(e),o=s.indexOf("."),d?(i=2,r==16?n=n*4-3:r==8&&(n=n*3-2)):i=r,o>=0&&(s=s.replace(".",""),p=new m(1),p.e=s.length-o,p.d=Mi(ft(p),10,i),p.e=p.d.length),l=Mi(s,10,i),a=c=l.length;l[--c]==0;)l.pop();if(!l[0])s=d?"0p+0":"0";else{if(o<0?a--:(e=new m(e),e.d=l,e.e=a,e=ur(e,p,n,t,0,i),l=e.d,a=e.e,u=ws),o=l[n],f=i/2,u=u||l[n+1]!==void 0,u=t<4?(o!==void 0||u)&&(t===0||t===(e.s<0?3:2)):o>f||o===f&&(t===4||u||t===6&&l[n-1]&1||t===(e.s<0?8:7)),l.length=n,u)for(;++l[--n]>i-1;)l[n]=0,n||(++a,l.unshift(1));for(c=l.length;!l[c-1];--c);for(o=0,s="";o<c;o++)s+=ja.charAt(l[o]);if(d){if(c>1)if(r==16||r==8){for(o=r==16?4:3,--c;c%o;c++)s+="0";for(l=Mi(s,i,r),c=l.length;!l[c-1];--c);for(o=1,s="1.";o<c;o++)s+=ja.charAt(l[o])}else s=s.charAt(0)+"."+s.slice(1);s=s+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)s="0"+s;s="0."+s}else if(++a>c)for(a-=c;a--;)s+="0";else a<c&&(s=s.slice(0,a)+"."+s.slice(a))}s=(r==16?"0x":r==2?"0b":r==8?"0o":"")+s}return e.s<0?"-"+s:s}function Ts(e,r){if(e.length>r)return e.length=r,!0}function G0(e){return new this(e).abs()}function V0(e){return new this(e).acos()}function K0(e){return new this(e).acosh()}function Q0(e,r){return new this(e).plus(r)}function X0(e){return new this(e).asin()}function eh(e){return new this(e).asinh()}function rh(e){return new this(e).atan()}function th(e){return new this(e).atanh()}function nh(e,r){e=new this(e),r=new this(r);var n,t=this.precision,i=this.rounding,a=t+4;return!e.s||!r.s?n=new this(NaN):!e.d&&!r.d?(n=tt(this,a,1).times(r.s>0?.25:.75),n.s=e.s):!r.d||e.isZero()?(n=r.s<0?tt(this,t,i):new this(0),n.s=e.s):!e.d||r.isZero()?(n=tt(this,a,1).times(.5),n.s=e.s):r.s<0?(this.precision=a,this.rounding=1,n=this.atan(ur(e,r,a,1)),r=tt(this,a,1),this.precision=t,this.rounding=i,n=e.s<0?n.minus(r):n.plus(r)):n=this.atan(ur(e,r,a,1)),n}function ih(e){return new this(e).cbrt()}function ah(e){return Ce(e=new this(e),e.e+1,2)}function oh(e,r,n){return new this(e).clamp(r,n)}function sh(e){if(!e||typeof e!="object")throw Error(Ei+"Object expected");var r,n,t,i=e.defaults===!0,a=["precision",1,Tt,"rounding",0,8,"toExpNeg",-bn,0,"toExpPos",0,bn,"maxE",0,bn,"minE",-bn,0,"modulo",0,9];for(r=0;r<a.length;r+=3)if(n=a[r],i&&(this[n]=Pa[n]),(t=e[n])!==void 0)if(Fr(t)===t&&t>=a[r+1]&&t<=a[r+2])this[n]=t;else throw Error(_t+n+": "+t);if(n="crypto",i&&(this[n]=Pa[n]),(t=e[n])!==void 0)if(t===!0||t===!1||t===0||t===1)if(t)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Ds);else this[n]=!1;else throw Error(_t+n+": "+t);return this}function uh(e){return new this(e).cos()}function lh(e){return new this(e).cosh()}function _s(e){var r,n,t;function i(a){var o,f,c,u=this;if(!(u instanceof i))return new i(a);if(u.constructor=i,Is(a)){u.s=a.s,ze?!a.d||a.e>i.maxE?(u.e=NaN,u.d=null):a.e<i.minE?(u.e=0,u.d=[0]):(u.e=a.e,u.d=a.d.slice()):(u.e=a.e,u.d=a.d?a.d.slice():a.d);return}if(c=typeof a,c==="number"){if(a===0){u.s=1/a<0?-1:1,u.e=0,u.d=[0];return}if(a<0?(a=-a,u.s=-1):u.s=1,a===~~a&&a<1e7){for(o=0,f=a;f>=10;f/=10)o++;ze?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[a]):(u.e=o,u.d=[a]);return}else if(a*0!==0){a||(u.s=NaN),u.e=NaN,u.d=null;return}return Ha(u,a.toString())}else if(c!=="string")throw Error(_t+a);return(f=a.charCodeAt(0))===45?(a=a.slice(1),u.s=-1):(f===43&&(a=a.slice(1)),u.s=1),Es.test(a)?Ha(u,a):W0(u,a)}if(i.prototype=ge,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=sh,i.clone=_s,i.isDecimal=Is,i.abs=G0,i.acos=V0,i.acosh=K0,i.add=Q0,i.asin=X0,i.asinh=eh,i.atan=rh,i.atanh=th,i.atan2=nh,i.cbrt=ih,i.ceil=ah,i.clamp=oh,i.cos=uh,i.cosh=lh,i.div=ch,i.exp=fh,i.floor=ph,i.hypot=mh,i.ln=dh,i.log=hh,i.log10=vh,i.log2=gh,i.max=yh,i.min=xh,i.mod=bh,i.mul=wh,i.pow=Nh,i.random=Dh,i.round=Ah,i.sign=Eh,i.sin=Mh,i.sinh=Sh,i.sqrt=Fh,i.sub=Ch,i.sum=Bh,i.tan=Oh,i.tanh=Th,i.trunc=_h,e===void 0&&(e={}),e&&e.defaults!==!0)for(t=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<t.length;)e.hasOwnProperty(n=t[r++])||(e[n]=this[n]);return i.config(e),i}function ch(e,r){return new this(e).div(r)}function fh(e){return new this(e).exp()}function ph(e){return Ce(e=new this(e),e.e+1,3)}function mh(){var e,r,n=new this(0);for(ze=!1,e=0;e<arguments.length;)if(r=new this(arguments[e++]),r.d)n.d&&(n=n.plus(r.times(r)));else{if(r.s)return ze=!0,new this(1/0);n=r}return ze=!0,n.sqrt()}function Is(e){return e instanceof Rt||e&&e.toStringTag===As||!1}function dh(e){return new this(e).ln()}function hh(e,r){return new this(e).log(r)}function gh(e){return new this(e).log(2)}function vh(e){return new this(e).log(10)}function yh(){return Cs(this,arguments,"lt")}function xh(){return Cs(this,arguments,"gt")}function bh(e,r){return new this(e).mod(r)}function wh(e,r){return new this(e).mul(r)}function Nh(e,r){return new this(e).pow(r)}function Dh(e){var r,n,t,i,a=0,o=new this(1),f=[];if(e===void 0?e=this.precision:Pr(e,1,Tt),t=Math.ceil(e/Oe),this.crypto)if(crypto.getRandomValues)for(r=crypto.getRandomValues(new Uint32Array(t));a<t;)i=r[a],i>=429e7?r[a]=crypto.getRandomValues(new Uint32Array(1))[0]:f[a++]=i%1e7;else if(crypto.randomBytes){for(r=crypto.randomBytes(t*=4);a<t;)i=r[a]+(r[a+1]<<8)+(r[a+2]<<16)+((r[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(r,a):(f.push(i%1e7),a+=4);a=t/4}else throw Error(Ds);else for(;a<t;)f[a++]=Math.random()*1e7|0;for(t=f[--a],e%=Oe,t&&e&&(i=hr(10,Oe-e),f[a]=(t/i|0)*i);f[a]===0;a--)f.pop();if(a<0)n=0,f=[0];else{for(n=-1;f[0]===0;n-=Oe)f.shift();for(t=1,i=f[0];i>=10;i/=10)t++;t<Oe&&(n-=Oe-t)}return o.e=n,o.d=f,o}function Ah(e){return Ce(e=new this(e),e.e+1,this.rounding)}function Eh(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Mh(e){return new this(e).sin()}function Sh(e){return new this(e).sinh()}function Fh(e){return new this(e).sqrt()}function Ch(e,r){return new this(e).sub(r)}function Bh(){var e=0,r=arguments,n=new this(r[e]);for(ze=!1;n.s&&++e<r.length;)n=n.plus(r[e]);return ze=!0,Ce(n,this.precision,this.rounding)}function Oh(e){return new this(e).tan()}function Th(e){return new this(e).tanh()}function _h(e){return Ce(e=new this(e),e.e+1,1)}ge[Symbol.for("nodejs.util.inspect.custom")]=ge.toString,ge[Symbol.toStringTag]="Decimal";var Rt=ge.constructor=_s(Pa);Di=new Rt(Di),Ai=new Rt(Ai);var Ih="BigNumber",zh=["?on","config"],Rh=R(Ih,zh,e=>{var{on:r,config:n}=e,t=Rt.clone({precision:n.precision,modulo:Rt.EUCLID});return t.prototype=Object.create(t.prototype),t.prototype.type="BigNumber",t.prototype.isBigNumber=!0,t.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},t.fromJSON=function(i){return new t(i.value)},r&&r("config",function(i,a){i.precision!==a.precision&&t.config({precision:i.precision})}),t},{isClass:!0}),Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Po.commonjsGlobal<"u"?Po.commonjsGlobal:typeof self<"u"?self:{};function Wn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function qh(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var n=function t(){return this instanceof t?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}),n}var zs={exports:{}};/**
15
+ * @license Complex.js v2.1.1 12/05/2020
16
+ *
17
+ * Copyright (c) 2020, Robert Eisele (robert@xarg.org)
18
+ * Dual licensed under the MIT or GPL Version 2 licenses.
19
+ **/(function(e,r){(function(n){var t=Math.cosh||function(l){return Math.abs(l)<1e-9?1-l:(Math.exp(l)+Math.exp(-l))*.5},i=Math.sinh||function(l){return Math.abs(l)<1e-9?l:(Math.exp(l)-Math.exp(-l))*.5},a=function(l){var p=Math.PI/4;if(-p>l||l>p)return Math.cos(l)-1;var m=l*l;return m*(m*(m*(m*(m*(m*(m*(m/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},o=function(l,p){var m=Math.abs(l),d=Math.abs(p);return m<3e3&&d<3e3?Math.sqrt(m*m+d*d):(m<d?(m=d,d=l/p):d=p/l,m*Math.sqrt(1+d*d))},f=function(){throw SyntaxError("Invalid Param")};function c(l,p){var m=Math.abs(l),d=Math.abs(p);return l===0?Math.log(d):p===0?Math.log(m):m<3e3&&d<3e3?Math.log(l*l+p*p)*.5:(l=l/2,p=p/2,.5*Math.log(l*l+p*p)+Math.LN2)}var u=function(l,p){var m={re:0,im:0};if(l==null)m.re=m.im=0;else if(p!==void 0)m.re=l,m.im=p;else switch(typeof l){case"object":if("im"in l&&"re"in l)m.re=l.re,m.im=l.im;else if("abs"in l&&"arg"in l){if(!Number.isFinite(l.abs)&&Number.isFinite(l.arg))return s.INFINITY;m.re=l.abs*Math.cos(l.arg),m.im=l.abs*Math.sin(l.arg)}else if("r"in l&&"phi"in l){if(!Number.isFinite(l.r)&&Number.isFinite(l.phi))return s.INFINITY;m.re=l.r*Math.cos(l.phi),m.im=l.r*Math.sin(l.phi)}else l.length===2?(m.re=l[0],m.im=l[1]):f();break;case"string":m.im=m.re=0;var d=l.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),g=1,w=0;d===null&&f();for(var v=0;v<d.length;v++){var b=d[v];b===" "||b===" "||b===`
20
+ `||(b==="+"?g++:b==="-"?w++:b==="i"||b==="I"?(g+w===0&&f(),d[v+1]!==" "&&!isNaN(d[v+1])?(m.im+=parseFloat((w%2?"-":"")+d[v+1]),v++):m.im+=parseFloat((w%2?"-":"")+"1"),g=w=0):((g+w===0||isNaN(b))&&f(),d[v+1]==="i"||d[v+1]==="I"?(m.im+=parseFloat((w%2?"-":"")+b),v++):m.re+=parseFloat((w%2?"-":"")+b),g=w=0))}g+w>0&&f();break;case"number":m.im=0,m.re=l;break;default:f()}return isNaN(m.re)||isNaN(m.im),m};function s(l,p){if(!(this instanceof s))return new s(l,p);var m=u(l,p);this.re=m.re,this.im=m.im}s.prototype={re:0,im:0,sign:function(){var l=this.abs();return new s(this.re/l,this.im/l)},add:function(l,p){var m=new s(l,p);return this.isInfinite()&&m.isInfinite()?s.NAN:this.isInfinite()||m.isInfinite()?s.INFINITY:new s(this.re+m.re,this.im+m.im)},sub:function(l,p){var m=new s(l,p);return this.isInfinite()&&m.isInfinite()?s.NAN:this.isInfinite()||m.isInfinite()?s.INFINITY:new s(this.re-m.re,this.im-m.im)},mul:function(l,p){var m=new s(l,p);return this.isInfinite()&&m.isZero()||this.isZero()&&m.isInfinite()?s.NAN:this.isInfinite()||m.isInfinite()?s.INFINITY:m.im===0&&this.im===0?new s(this.re*m.re,0):new s(this.re*m.re-this.im*m.im,this.re*m.im+this.im*m.re)},div:function(l,p){var m=new s(l,p);if(this.isZero()&&m.isZero()||this.isInfinite()&&m.isInfinite())return s.NAN;if(this.isInfinite()||m.isZero())return s.INFINITY;if(this.isZero()||m.isInfinite())return s.ZERO;l=this.re,p=this.im;var d=m.re,g=m.im,w,v;return g===0?new s(l/d,p/d):Math.abs(d)<Math.abs(g)?(v=d/g,w=d*v+g,new s((l*v+p)/w,(p*v-l)/w)):(v=g/d,w=g*v+d,new s((l+p*v)/w,(p-l*v)/w))},pow:function(l,p){var m=new s(l,p);if(l=this.re,p=this.im,m.isZero())return s.ONE;if(m.im===0){if(p===0&&l>0)return new s(Math.pow(l,m.re),0);if(l===0)switch((m.re%4+4)%4){case 0:return new s(Math.pow(p,m.re),0);case 1:return new s(0,Math.pow(p,m.re));case 2:return new s(-Math.pow(p,m.re),0);case 3:return new s(0,-Math.pow(p,m.re))}}if(l===0&&p===0&&m.re>0&&m.im>=0)return s.ZERO;var d=Math.atan2(p,l),g=c(l,p);return l=Math.exp(m.re*g-m.im*d),p=m.im*g+m.re*d,new s(l*Math.cos(p),l*Math.sin(p))},sqrt:function(){var l=this.re,p=this.im,m=this.abs(),d,g;if(l>=0){if(p===0)return new s(Math.sqrt(l),0);d=.5*Math.sqrt(2*(m+l))}else d=Math.abs(p)/Math.sqrt(2*(m-l));return l<=0?g=.5*Math.sqrt(2*(m-l)):g=Math.abs(p)/Math.sqrt(2*(m+l)),new s(d,p<0?-g:g)},exp:function(){var l=Math.exp(this.re);return this.im,new s(l*Math.cos(this.im),l*Math.sin(this.im))},expm1:function(){var l=this.re,p=this.im;return new s(Math.expm1(l)*Math.cos(p)+a(p),Math.exp(l)*Math.sin(p))},log:function(){var l=this.re,p=this.im;return new s(c(l,p),Math.atan2(p,l))},abs:function(){return o(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var l=this.re,p=this.im;return new s(Math.sin(l)*t(p),Math.cos(l)*i(p))},cos:function(){var l=this.re,p=this.im;return new s(Math.cos(l)*t(p),-Math.sin(l)*i(p))},tan:function(){var l=2*this.re,p=2*this.im,m=Math.cos(l)+t(p);return new s(Math.sin(l)/m,i(p)/m)},cot:function(){var l=2*this.re,p=2*this.im,m=Math.cos(l)-t(p);return new s(-Math.sin(l)/m,i(p)/m)},sec:function(){var l=this.re,p=this.im,m=.5*t(2*p)+.5*Math.cos(2*l);return new s(Math.cos(l)*t(p)/m,Math.sin(l)*i(p)/m)},csc:function(){var l=this.re,p=this.im,m=.5*t(2*p)-.5*Math.cos(2*l);return new s(Math.sin(l)*t(p)/m,-Math.cos(l)*i(p)/m)},asin:function(){var l=this.re,p=this.im,m=new s(p*p-l*l+1,-2*l*p).sqrt(),d=new s(m.re-p,m.im+l).log();return new s(d.im,-d.re)},acos:function(){var l=this.re,p=this.im,m=new s(p*p-l*l+1,-2*l*p).sqrt(),d=new s(m.re-p,m.im+l).log();return new s(Math.PI/2-d.im,d.re)},atan:function(){var l=this.re,p=this.im;if(l===0){if(p===1)return new s(0,1/0);if(p===-1)return new s(0,-1/0)}var m=l*l+(1-p)*(1-p),d=new s((1-p*p-l*l)/m,-2*l/m).log();return new s(-.5*d.im,.5*d.re)},acot:function(){var l=this.re,p=this.im;if(p===0)return new s(Math.atan2(1,l),0);var m=l*l+p*p;return m!==0?new s(l/m,-p/m).atan():new s(l!==0?l/0:0,p!==0?-p/0:0).atan()},asec:function(){var l=this.re,p=this.im;if(l===0&&p===0)return new s(0,1/0);var m=l*l+p*p;return m!==0?new s(l/m,-p/m).acos():new s(l!==0?l/0:0,p!==0?-p/0:0).acos()},acsc:function(){var l=this.re,p=this.im;if(l===0&&p===0)return new s(Math.PI/2,1/0);var m=l*l+p*p;return m!==0?new s(l/m,-p/m).asin():new s(l!==0?l/0:0,p!==0?-p/0:0).asin()},sinh:function(){var l=this.re,p=this.im;return new s(i(l)*Math.cos(p),t(l)*Math.sin(p))},cosh:function(){var l=this.re,p=this.im;return new s(t(l)*Math.cos(p),i(l)*Math.sin(p))},tanh:function(){var l=2*this.re,p=2*this.im,m=t(l)+Math.cos(p);return new s(i(l)/m,Math.sin(p)/m)},coth:function(){var l=2*this.re,p=2*this.im,m=t(l)-Math.cos(p);return new s(i(l)/m,-Math.sin(p)/m)},csch:function(){var l=this.re,p=this.im,m=Math.cos(2*p)-t(2*l);return new s(-2*i(l)*Math.cos(p)/m,2*t(l)*Math.sin(p)/m)},sech:function(){var l=this.re,p=this.im,m=Math.cos(2*p)+t(2*l);return new s(2*t(l)*Math.cos(p)/m,-2*i(l)*Math.sin(p)/m)},asinh:function(){var l=this.im;this.im=-this.re,this.re=l;var p=this.asin();return this.re=-this.im,this.im=l,l=p.re,p.re=-p.im,p.im=l,p},acosh:function(){var l=this.acos();if(l.im<=0){var p=l.re;l.re=-l.im,l.im=p}else{var p=l.im;l.im=-l.re,l.re=p}return l},atanh:function(){var l=this.re,p=this.im,m=l>1&&p===0,d=1-l,g=1+l,w=d*d+p*p,v=w!==0?new s((g*d-p*p)/w,(p*d+g*p)/w):new s(l!==-1?l/0:0,p!==0?p/0:0),b=v.re;return v.re=c(v.re,v.im)/2,v.im=Math.atan2(v.im,b)/2,m&&(v.im=-v.im),v},acoth:function(){var l=this.re,p=this.im;if(l===0&&p===0)return new s(0,Math.PI/2);var m=l*l+p*p;return m!==0?new s(l/m,-p/m).atanh():new s(l!==0?l/0:0,p!==0?-p/0:0).atanh()},acsch:function(){var l=this.re,p=this.im;if(p===0)return new s(l!==0?Math.log(l+Math.sqrt(l*l+1)):1/0,0);var m=l*l+p*p;return m!==0?new s(l/m,-p/m).asinh():new s(l!==0?l/0:0,p!==0?-p/0:0).asinh()},asech:function(){var l=this.re,p=this.im;if(this.isZero())return s.INFINITY;var m=l*l+p*p;return m!==0?new s(l/m,-p/m).acosh():new s(l!==0?l/0:0,p!==0?-p/0:0).acosh()},inverse:function(){if(this.isZero())return s.INFINITY;if(this.isInfinite())return s.ZERO;var l=this.re,p=this.im,m=l*l+p*p;return new s(l/m,-p/m)},conjugate:function(){return new s(this.re,-this.im)},neg:function(){return new s(-this.re,-this.im)},ceil:function(l){return l=Math.pow(10,l||0),new s(Math.ceil(this.re*l)/l,Math.ceil(this.im*l)/l)},floor:function(l){return l=Math.pow(10,l||0),new s(Math.floor(this.re*l)/l,Math.floor(this.im*l)/l)},round:function(l){return l=Math.pow(10,l||0),new s(Math.round(this.re*l)/l,Math.round(this.im*l)/l)},equals:function(l,p){var m=new s(l,p);return Math.abs(m.re-this.re)<=s.EPSILON&&Math.abs(m.im-this.im)<=s.EPSILON},clone:function(){return new s(this.re,this.im)},toString:function(){var l=this.re,p=this.im,m="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(l)<s.EPSILON&&(l=0),Math.abs(p)<s.EPSILON&&(p=0),p===0?m+l:(l!==0?(m+=l,m+=" ",p<0?(p=-p,m+="-"):m+="+",m+=" "):p<0&&(p=-p,m+="-"),p!==1&&(m+=p),m+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},s.ZERO=new s(0,0),s.ONE=new s(1,0),s.I=new s(0,1),s.PI=new s(Math.PI,0),s.E=new s(Math.E,0),s.INFINITY=new s(1/0,1/0),s.NAN=new s(NaN,NaN),s.EPSILON=1e-15,Object.defineProperty(s,"__esModule",{value:!0}),s.default=s,s.Complex=s,e.exports=s})()})(zs);var kh=zs.exports;const Dr=Wn(kh);var jh="Complex",Ph=[],Uh=R(jh,Ph,()=>(Object.defineProperty(Dr,"name",{value:"Complex"}),Dr.prototype.constructor=Dr,Dr.prototype.type="Complex",Dr.prototype.isComplex=!0,Dr.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Dr.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Dr.prototype.format=function(e){var r="",n=this.im,t=this.re,i=Gt(this.re,e),a=Gt(this.im,e),o=ke(e)?e:e?e.precision:null;if(o!==null){var f=Math.pow(10,-o);Math.abs(t/n)<f&&(t=0),Math.abs(n/t)<f&&(n=0)}return n===0?r=i:t===0?n===1?r="i":n===-1?r="-i":r=a+"i":n<0?n===-1?r=i+" - i":r=i+" - "+a.substring(1)+"i":n===1?r=i+" + i":r=i+" + "+a+"i",r},Dr.fromPolar=function(e){switch(arguments.length){case 1:{var r=arguments[0];if(typeof r=="object")return Dr(r);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var n=arguments[0],t=arguments[1];if(ke(n)){if(Jr(t)&&t.hasBase("ANGLE")&&(t=t.toNumber("rad")),ke(t))return new Dr({r:n,phi:t});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Dr.prototype.valueOf=Dr.prototype.toString,Dr.fromJSON=function(e){return new Dr(e)},Dr.compare=function(e,r){return e.re>r.re?1:e.re<r.re?-1:e.im>r.im?1:e.im<r.im?-1:0},Dr),{isClass:!0}),Rs={exports:{}};/**
21
+ * @license Fraction.js v4.3.0 20/08/2023
22
+ * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
23
+ *
24
+ * Copyright (c) 2023, Robert Eisele (robert@raw.org)
25
+ * Dual licensed under the MIT or GPL Version 2 licenses.
26
+ **/(function(e,r){(function(n){var t=2e3,i={s:1,n:0,d:1};function a(v,b){if(isNaN(v=parseInt(v,10)))throw g();return v*b}function o(v,b){if(b===0)throw d();var h=Object.create(m.prototype);h.s=v<0?-1:1,v=v<0?-v:v;var x=p(v,b);return h.n=v/x,h.d=b/x,h}function f(v){for(var b={},h=v,x=2,y=4;y<=h;){for(;h%x===0;)h/=x,b[x]=(b[x]||0)+1;y+=1+2*x++}return h!==v?h>1&&(b[h]=(b[h]||0)+1):b[v]=(b[v]||0)+1,b}var c=function(v,b){var h=0,x=1,y=1,N=0,A=0,E=0,D=1,M=1,S=0,B=1,I=1,j=1,_=1e7,O;if(v!=null)if(b!==void 0){if(h=v,x=b,y=h*x,h%1!==0||x%1!==0)throw w()}else switch(typeof v){case"object":{if("d"in v&&"n"in v)h=v.n,x=v.d,"s"in v&&(h*=v.s);else if(0 in v)h=v[0],1 in v&&(x=v[1]);else throw g();y=h*x;break}case"number":{if(v<0&&(y=v,v=-v),v%1===0)h=v;else if(v>0){for(v>=1&&(M=Math.pow(10,Math.floor(1+Math.log(v)/Math.LN10)),v/=M);B<=_&&j<=_;)if(O=(S+I)/(B+j),v===O){B+j<=_?(h=S+I,x=B+j):j>B?(h=I,x=j):(h=S,x=B);break}else v>O?(S+=I,B+=j):(I+=S,j+=B),B>_?(h=I,x=j):(h=S,x=B);h*=M}else(isNaN(v)||isNaN(b))&&(x=h=NaN);break}case"string":{if(B=v.match(/\d+|./g),B===null)throw g();if(B[S]==="-"?(y=-1,S++):B[S]==="+"&&S++,B.length===S+1?A=a(B[S++],y):B[S+1]==="."||B[S]==="."?(B[S]!=="."&&(N=a(B[S++],y)),S++,(S+1===B.length||B[S+1]==="("&&B[S+3]===")"||B[S+1]==="'"&&B[S+3]==="'")&&(A=a(B[S],y),D=Math.pow(10,B[S].length),S++),(B[S]==="("&&B[S+2]===")"||B[S]==="'"&&B[S+2]==="'")&&(E=a(B[S+1],y),M=Math.pow(10,B[S+1].length)-1,S+=3)):B[S+1]==="/"||B[S+1]===":"?(A=a(B[S],y),D=a(B[S+2],1),S+=3):B[S+3]==="/"&&B[S+1]===" "&&(N=a(B[S],y),A=a(B[S+2],y),D=a(B[S+4],1),S+=5),B.length<=S){x=D*M,y=h=E+x*N+M*A;break}}default:throw g()}if(x===0)throw d();i.s=y<0?-1:1,i.n=Math.abs(h),i.d=Math.abs(x)};function u(v,b,h){for(var x=1;b>0;v=v*v%h,b>>=1)b&1&&(x=x*v%h);return x}function s(v,b){for(;b%2===0;b/=2);for(;b%5===0;b/=5);if(b===1)return 0;for(var h=10%b,x=1;h!==1;x++)if(h=h*10%b,x>t)return 0;return x}function l(v,b,h){for(var x=1,y=u(10,h,b),N=0;N<300;N++){if(x===y)return N;x=x*10%b,y=y*10%b}return 0}function p(v,b){if(!v)return b;if(!b)return v;for(;;){if(v%=b,!v)return b;if(b%=v,!b)return v}}function m(v,b){if(c(v,b),this instanceof m)v=p(i.d,i.n),this.s=i.s,this.n=i.n/v,this.d=i.d/v;else return o(i.s*i.n,i.d)}var d=function(){return new Error("Division by Zero")},g=function(){return new Error("Invalid argument")},w=function(){return new Error("Parameters must be integer")};m.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(v,b){return c(v,b),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(v,b){return c(v,b),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(v,b){return c(v,b),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(v,b){return c(v,b),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(v,b){if(isNaN(this.n)||isNaN(this.d))return new m(NaN);if(v===void 0)return o(this.s*this.n%this.d,1);if(c(v,b),i.n===0&&this.d===0)throw d();return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(v,b){return c(v,b),o(p(i.n,this.n)*p(i.d,this.d),i.d*this.d)},lcm:function(v,b){return c(v,b),i.n===0&&this.n===0?o(0,1):o(i.n*this.n,p(i.n,this.n)*p(i.d,this.d))},ceil:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):o(Math.ceil(v*this.s*this.n/this.d),v)},floor:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):o(Math.floor(v*this.s*this.n/this.d),v)},round:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):o(Math.round(v*this.s*this.n/this.d),v)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(v,b){if(c(v,b),i.d===1)return i.s<0?o(Math.pow(this.s*this.d,i.n),Math.pow(this.n,i.n)):o(Math.pow(this.s*this.n,i.n),Math.pow(this.d,i.n));if(this.s<0)return null;var h=f(this.n),x=f(this.d),y=1,N=1;for(var A in h)if(A!=="1"){if(A==="0"){y=0;break}if(h[A]*=i.n,h[A]%i.d===0)h[A]/=i.d;else return null;y*=Math.pow(A,h[A])}for(var A in x)if(A!=="1"){if(x[A]*=i.n,x[A]%i.d===0)x[A]/=i.d;else return null;N*=Math.pow(A,x[A])}return i.s<0?o(N,y):o(y,N)},equals:function(v,b){return c(v,b),this.s*this.n*i.d===i.s*i.n*this.d},compare:function(v,b){c(v,b);var h=this.s*this.n*i.d-i.s*i.n*this.d;return(0<h)-(h<0)},simplify:function(v){if(isNaN(this.n)||isNaN(this.d))return this;v=v||.001;for(var b=this.abs(),h=b.toContinued(),x=1;x<h.length;x++){for(var y=o(h[x-1],1),N=x-2;N>=0;N--)y=y.inverse().add(h[N]);if(Math.abs(y.sub(b).valueOf())<v)return y.mul(this.s)}return this},divisible:function(v,b){return c(v,b),!(!(i.n*this.d)||this.n*i.d%(i.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(v){var b,h="",x=this.n,y=this.d;return this.s<0&&(h+="-"),y===1?h+=x:(v&&(b=Math.floor(x/y))>0&&(h+=b,h+=" ",x%=y),h+=x,h+="/",h+=y),h},toLatex:function(v){var b,h="",x=this.n,y=this.d;return this.s<0&&(h+="-"),y===1?h+=x:(v&&(b=Math.floor(x/y))>0&&(h+=b,x%=y),h+="\\frac{",h+=x,h+="}{",h+=y,h+="}"),h},toContinued:function(){var v,b=this.n,h=this.d,x=[];if(isNaN(b)||isNaN(h))return x;do x.push(Math.floor(b/h)),v=b%h,b=h,h=v;while(b!==1);return x},toString:function(v){var b=this.n,h=this.d;if(isNaN(b)||isNaN(h))return"NaN";v=v||15;var x=s(b,h),y=l(b,h,x),N=this.s<0?"-":"";if(N+=b/h|0,b%=h,b*=10,b&&(N+="."),x){for(var A=y;A--;)N+=b/h|0,b%=h,b*=10;N+="(";for(var A=x;A--;)N+=b/h|0,b%=h,b*=10;N+=")"}else for(var A=v;b&&A--;)N+=b/h|0,b%=h,b*=10;return N}},Object.defineProperty(m,"__esModule",{value:!0}),m.default=m,m.Fraction=m,e.exports=m})()})(Rs);var Lh=Rs.exports;const Nt=Wn(Lh);var Hh="Fraction",$h=[],Zh=R(Hh,$h,()=>(Object.defineProperty(Nt,"name",{value:"Fraction"}),Nt.prototype.constructor=Nt,Nt.prototype.type="Fraction",Nt.prototype.isFraction=!0,Nt.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Nt.fromJSON=function(e){return new Nt(e)},Nt),{isClass:!0}),Jh="Range",Wh=[],Yh=R(Jh,Wh,()=>{function e(r,n,t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var i=r!=null,a=n!=null,o=t!=null;if(i){if(je(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter start must be a number")}if(a){if(je(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter end must be a number")}if(o){if(je(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(r):0,this.end=a?parseFloat(n):0,this.step=o?parseFloat(t):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(r){if(typeof r!="string")return null;var n=r.split(":"),t=n.map(function(a){return parseFloat(a)}),i=t.some(function(a){return isNaN(a)});if(i)return null;switch(t.length){case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[2],t[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var r=0,n=this.start,t=this.step,i=this.end,a=i-n;return Ot(t)===Ot(a)?r=Math.ceil(a/t):a===0&&(r=0),isNaN(r)&&(r=0),[r]},e.prototype.min=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start:this.start+(r-1)*this.step},e.prototype.max=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start+(r-1)*this.step:this.start},e.prototype.forEach=function(r){var n=this.start,t=this.step,i=this.end,a=0;if(t>0)for(;n<i;)r(n,[a],this),n+=t,a++;else if(t<0)for(;n>i;)r(n,[a],this),n+=t,a++},e.prototype.map=function(r){var n=[];return this.forEach(function(t,i,a){n[i[0]]=r(t,i,a)}),n},e.prototype.toArray=function(){var r=[];return this.forEach(function(n,t){r[t[0]]=n}),r},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(r){var n=Gt(this.start,r);return this.step!==1&&(n+=":"+Gt(this.step,r)),n+=":"+Gt(this.end,r),n},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(r){return new e(r.start,r.end,r.step)},e},{isClass:!0}),Gh="Matrix",Vh=[],Kh=R(Gh,Vh,()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(r,n){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(r,n,t){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(r){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(r,n,t){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(r,n){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(r,n){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(r,n){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(r){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(r){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function Qh(e){var r=0,n=1,t=Object.create(null),i=Object.create(null),a=0,o=function(f){var c=i[f];if(c&&(delete t[c],delete i[f],--r,n===c)){if(!r){a=0,n=1;return}for(;!Object.prototype.hasOwnProperty.call(t,++n););}};return e=Math.abs(e),{hit:function(f){var c=i[f],u=++a;if(t[u]=f,i[f]=u,!c)return++r,r<=e?void 0:(f=t[n],o(f),f);if(delete t[c],n===c)for(;!Object.prototype.hasOwnProperty.call(t,++n););},delete:o,clear:function(){r=a=0,n=1,t=Object.create(null),i=Object.create(null)}}}function Yn(e){var{hasher:r,limit:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n=n??Number.POSITIVE_INFINITY,r=r??JSON.stringify,function t(){typeof t.cache!="object"&&(t.cache={values:new Map,lru:Qh(n||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=r(i);if(t.cache.values.has(o))return t.cache.lru.hit(o),t.cache.values.get(o);var f=e.apply(e,i);return t.cache.values.set(o,f),t.cache.values.delete(t.cache.lru.hit(o)),f}}function qs(e){return Object.keys(e.signatures||{}).reduce(function(r,n){var t=(n.match(/,/g)||[]).length+1;return Math.max(r,t)},-1)}var Xh="DenseMatrix",eg=["Matrix"],rg=R(Xh,eg,e=>{var{Matrix:r}=e;function n(s,l){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(l&&!Sr(l))throw new Error("Invalid datatype: "+l);if(Be(s))s.type==="DenseMatrix"?(this._data=Ie(s._data),this._size=Ie(s._size),this._datatype=l||s._datatype):(this._data=s.toArray(),this._size=s.size(),this._datatype=l||s._datatype);else if(s&&Xe(s.data)&&Xe(s.size))this._data=s.data,this._size=s.size,ss(this._data,this._size),this._datatype=l||s.datatype;else if(Xe(s))this._data=u(s),this._size=qe(this._data),ss(this._data,this._size),this._datatype=l;else{if(s)throw new TypeError("Unsupported type of data ("+nr(s)+")");this._data=[],this._size=[0],this._datatype=l}}n.prototype=new r,n.prototype.createDenseMatrix=function(s,l){return new n(s,l)},Object.defineProperty(n,"name",{value:"DenseMatrix"}),n.prototype.constructor=n,n.prototype.type="DenseMatrix",n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Zn(this._data,nr)},n.prototype.storage=function(){return"dense"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(s,l){return new n(s,l)},n.prototype.subset=function(s,l,p){switch(arguments.length){case 1:return t(this,s);case 2:case 3:return a(this,s,l,p);default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.get=function(s){if(!Xe(s))throw new TypeError("Array expected");if(s.length!==this._size.length)throw new He(s.length,this._size.length);for(var l=0;l<s.length;l++)ir(s[l],this._size[l]);for(var p=this._data,m=0,d=s.length;m<d;m++){var g=s[m];ir(g,p.length),p=p[g]}return p},n.prototype.set=function(s,l,p){if(!Xe(s))throw new TypeError("Array expected");if(s.length<this._size.length)throw new He(s.length,this._size.length,"<");var m,d,g,w=s.map(function(b){return b+1});c(this,w,p);var v=this._data;for(m=0,d=s.length-1;m<d;m++)g=s[m],ir(g,v.length),v=v[g];return g=s[s.length-1],ir(g,v.length),v[g]=l,this};function t(s,l){if(!pi(l))throw new TypeError("Invalid index");var p=l.isScalar();if(p)return s.get(l.min());var m=l.size();if(m.length!==s._size.length)throw new He(m.length,s._size.length);for(var d=l.min(),g=l.max(),w=0,v=s._size.length;w<v;w++)ir(d[w],s._size[w]),ir(g[w],s._size[w]);return new n(i(s._data,l,m.length,0),s._datatype)}function i(s,l,p,m){var d=m===p-1,g=l.dimension(m);return d?g.map(function(w){return ir(w,s.length),s[w]}).valueOf():g.map(function(w){ir(w,s.length);var v=s[w];return i(v,l,p,m+1)}).valueOf()}function a(s,l,p,m){if(!l||l.isIndex!==!0)throw new TypeError("Invalid index");var d=l.size(),g=l.isScalar(),w;if(Be(p)?(w=p.size(),p=p.valueOf()):w=qe(p),g){if(w.length!==0)throw new TypeError("Scalar expected");s.set(l.min(),p,m)}else{if(!Yt(w,d))try{w.length===0?p=gs([p],d):p=gs(p,d),w=qe(p)}catch{}if(d.length<s._size.length)throw new He(d.length,s._size.length,"<");if(w.length<d.length){for(var v=0,b=0;d[v]===1&&w[v]===1;)v++;for(;d[v]===1;)b++,v++;p=cs(p,d.length,b,w)}if(!Yt(d,w))throw new He(d,w,">");var h=l.max().map(function(N){return N+1});c(s,h,m);var x=d.length,y=0;o(s._data,l,p,x,y)}return s}function o(s,l,p,m,d){var g=d===m-1,w=l.dimension(d);g?w.forEach(function(v,b){ir(v),s[v]=p[b[0]]}):w.forEach(function(v,b){ir(v),o(s[v],l,p[b[0]],m,d+1)})}n.prototype.resize=function(s,l,p){if(!Wr(s))throw new TypeError("Array or Matrix expected");var m=s.valueOf().map(g=>Array.isArray(g)&&g.length===1?g[0]:g),d=p?this.clone():this;return f(d,m,l)};function f(s,l,p){if(l.length===0){for(var m=s._data;Xe(m);)m=m[0];return m}return s._size=l.slice(0),s._data=hn(s._data,s._size,p),s}n.prototype.reshape=function(s,l){var p=l?this.clone():this;p._data=Ta(p._data,s);var m=p._size.reduce((d,g)=>d*g);return p._size=_a(s,m),p};function c(s,l,p){for(var m=s._size.slice(0),d=!1;m.length<l.length;)m.push(0),d=!0;for(var g=0,w=l.length;g<w;g++)l[g]>m[g]&&(m[g]=l[g],d=!0);d&&f(s,m,p)}n.prototype.clone=function(){var s=new n({data:Ie(this._data),size:Ie(this._size),datatype:this._datatype});return s},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(s){var l=this,p=qs(s),m=function w(v,b){return Xe(v)?v.map(function(h,x){return w(h,b.concat(x))}):p===1?s(v):p===2?s(v,b):s(v,b,l)},d=m(this._data,[]),g=this._datatype!==void 0?Zn(d,nr):void 0;return new n(d,g)},n.prototype.forEach=function(s){var l=this,p=function m(d,g){Xe(d)?d.forEach(function(w,v){m(w,g.concat(v))}):s(d,g,l)};p(this._data,[])},n.prototype[Symbol.iterator]=function*(){var s=function*l(p,m){if(Xe(p))for(var d=0;d<p.length;d++)yield*l(p[d],m.concat(d));else yield{value:p,index:m}};yield*s(this._data,[])},n.prototype.rows=function(){var s=[],l=this.size();if(l.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var m of p)s.push(new n([m],this._datatype));return s},n.prototype.columns=function(){var s=this,l=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var m=this._data,d=function(w){var v=m.map(b=>[b[w]]);l.push(new n(v,s._datatype))},g=0;g<p[1];g++)d(g);return l},n.prototype.toArray=function(){return Ie(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(s){return Le(this._data,s)},n.prototype.toString=function(){return Le(this._data)},n.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(s){if(s){if(je(s)&&(s=s.toNumber()),!ke(s)||!Se(s))throw new TypeError("The parameter k must be an integer number")}else s=0;for(var l=s>0?s:0,p=s<0?-s:0,m=this._size[0],d=this._size[1],g=Math.min(m-p,d-l),w=[],v=0;v<g;v++)w[v]=this._data[v+p][v+l];return new n({data:w,size:[g],datatype:this._datatype})},n.diagonal=function(s,l,p,m){if(!Xe(s))throw new TypeError("Array expected, size parameter");if(s.length!==2)throw new Error("Only two dimensions matrix are supported");if(s=s.map(function(A){if(je(A)&&(A=A.toNumber()),!ke(A)||!Se(A)||A<1)throw new Error("Size values must be positive integers");return A}),p){if(je(p)&&(p=p.toNumber()),!ke(p)||!Se(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var d=p>0?p:0,g=p<0?-p:0,w=s[0],v=s[1],b=Math.min(w-g,v-d),h;if(Xe(l)){if(l.length!==b)throw new Error("Invalid value array length");h=function(A){return l[A]}}else if(Be(l)){var x=l.size();if(x.length!==1||x[0]!==b)throw new Error("Invalid matrix length");h=function(A){return l.get([A])}}else h=function(){return l};m||(m=je(h(0))?h(0).mul(0):0);var y=[];if(s.length>0){y=hn(y,s,m);for(var N=0;N<b;N++)y[N+g][N+d]=h(N)}return new n({data:y,size:[w,v]})},n.fromJSON=function(s){return new n(s)},n.prototype.swapRows=function(s,l){if(!ke(s)||!Se(s)||!ke(l)||!Se(l))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return ir(s,this._size[0]),ir(l,this._size[0]),n._swapRows(s,l,this._data),this},n._swapRows=function(s,l,p){var m=p[s];p[s]=p[l],p[l]=m};function u(s){return Be(s)?u(s.valueOf()):Xe(s)?s.map(u):s}return n},{isClass:!0}),ks="clone",tg=["typed"],ng=R(ks,tg,e=>{var{typed:r}=e;return r(ks,{any:Ie})});function js(e){var r=e.length,n=e[0].length,t,i,a=[];for(i=0;i<n;i++){var o=[];for(t=0;t<r;t++)o.push(e[t][i]);a.push(o)}return a}function Nn(e){for(var r=0;r<e.length;r++)if(Wr(e[r]))return!0;return!1}function Dt(e,r){Be(e)&&(e=e.valueOf());for(var n=0,t=e.length;n<t;n++){var i=e[n];Array.isArray(i)?Dt(i,r):r(i)}}function $e(e,r,n){return e&&typeof e.map=="function"?e.map(function(t){return $e(t,r)}):r(e)}function Bi(e,r,n){var t=Array.isArray(e)?qe(e):e.size();if(r<0||r>=t.length)throw new et(r,t.length);return Be(e)?e.create(Oi(e.valueOf(),r,n)):Oi(e,r,n)}function Oi(e,r,n){var t,i,a,o;if(r<=0)if(Array.isArray(e[0])){for(o=js(e),i=[],t=0;t<o.length;t++)i[t]=Oi(o[t],r-1,n);return i}else{for(a=e[0],t=1;t<e.length;t++)a=n(a,e[t]);return a}else{for(i=[],t=0;t<e.length;t++)i[t]=Oi(e[t],r-1,n);return i}}function Ps(e,r,n,t,i,a,o,f,c,u,s){var l=e._values,p=e._index,m=e._ptr,d,g,w,v;if(t)for(g=m[r],w=m[r+1],d=g;d<w;d++)v=p[d],n[v]!==a?(n[v]=a,o.push(v),u?(t[v]=c?f(l[d],s):f(s,l[d]),i[v]=a):t[v]=l[d]):(t[v]=c?f(l[d],t[v]):f(t[v],l[d]),i[v]=a);else for(g=m[r],w=m[r+1],d=g;d<w;d++)v=p[d],n[v]!==a?(n[v]=a,o.push(v)):i[v]=a}var Us="isInteger",ig=["typed"],ag=R(Us,ig,e=>{var{typed:r}=e;return r(Us,{number:Se,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),nt="number",Dn="number, number";function Ls(e){return Math.abs(e)}Ls.signature=nt;function Hs(e,r){return e+r}Hs.signature=Dn;function $s(e,r){return e-r}$s.signature=Dn;function Zs(e,r){return e*r}Zs.signature=Dn;function Js(e){return-e}Js.signature=nt;function Ws(e){return e}Ws.signature=nt;function Gn(e){return i0(e)}Gn.signature=nt;function Ys(e){return e*e*e}Ys.signature=nt;function Gs(e){return Math.exp(e)}Gs.signature=nt;function Vs(e){return a0(e)}Vs.signature=nt;function Ks(e,r){if(!Se(e)||!Se(r))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||r===0)return 0;for(var n,t=e*r;r!==0;)n=r,r=e%n,e=n;return Math.abs(t/e)}Ks.signature=Dn;function og(e,r){return r?Math.log(e)/Math.log(r):Math.log(e)}function Qs(e){return t0(e)}Qs.signature=nt;function Xs(e){return r0(e)}Xs.signature=nt;function eu(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,n=r<0;if(n&&(r=-r),r===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(r)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return n?1/0:0;if(!isFinite(e))return n?0:e;var t=Math.pow(Math.abs(e),1/r);return t=e<0?-t:t,n?1/t:t}function Za(e){return Ot(e)}Za.signature=nt;function ru(e){return e*e}ru.signature=nt;function tu(e,r){var n,t,i,a=0,o=1,f=1,c=0;if(!Se(e)||!Se(r))throw new Error("Parameters in function xgcd must be integer numbers");for(;r;)t=Math.floor(e/r),i=e-t*r,n=a,a=o-t*a,o=n,n=f,f=c-t*f,c=n,e=r,r=i;var u;return e<0?u=[-e,-o,-c]:u=[e,e?o:0,c],u}tu.signature=Dn;function nu(e,r){return e*e<1&&r===1/0||e*e>1&&r===-1/0?0:Math.pow(e,r)}nu.signature=Dn;function iu(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Se(r)||r<0||r>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Qo(e,r))}var sg="number",An="number, number";function au(e,r){if(!Se(e)||!Se(r))throw new Error("Integers expected in function bitAnd");return e&r}au.signature=An;function ou(e){if(!Se(e))throw new Error("Integer expected in function bitNot");return~e}ou.signature=sg;function su(e,r){if(!Se(e)||!Se(r))throw new Error("Integers expected in function bitOr");return e|r}su.signature=An;function uu(e,r){if(!Se(e)||!Se(r))throw new Error("Integers expected in function bitXor");return e^r}uu.signature=An;function lu(e,r){if(!Se(e)||!Se(r))throw new Error("Integers expected in function leftShift");return e<<r}lu.signature=An;function cu(e,r){if(!Se(e)||!Se(r))throw new Error("Integers expected in function rightArithShift");return e>>r}cu.signature=An;function fu(e,r){if(!Se(e)||!Se(r))throw new Error("Integers expected in function rightLogShift");return e>>>r}fu.signature=An;function At(e,r){if(r<e)return 1;if(r===e)return r;var n=r+e>>1;return At(e,n)*At(n+1,r)}function pu(e,r){if(!Se(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!Se(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(r>e)throw new TypeError("k must be less than or equal to n");for(var n=e-r,t=1,i=r<n?n+1:r+1,a=2,o=r<n?r:n,f=i;f<=e;++f)for(t*=f;a<=o&&t%a===0;)t/=a,++a;return a<=o&&(t/=At(a,o)),t}pu.signature="number, number";var ug=Math.PI,lg=2*Math.PI,cg=Math.E,fg=1.618033988749895,pg="number",Ja="number, number";function mu(e){return!e}mu.signature=pg;function du(e,r){return!!(e||r)}du.signature=Ja;function hu(e,r){return!!e!=!!r}hu.signature=Ja;function gu(e,r){return!!(e&&r)}gu.signature=Ja;function Ti(e){var r;if(Se(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:At(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Ti(1-e));if(e>=171.35)return 1/0;if(e>85){var n=e*e,t=n*e,i=t*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*n)-139/(51840*t)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,r=En[0];for(var o=1;o<En.length;++o)r+=En[o]/(e+o);var f=e+vu+.5;return Math.sqrt(2*Math.PI)*Math.pow(f,e+.5)*Math.exp(-f)*r}Ti.signature="number";var vu=4.7421875,En=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],yu=.9189385332046728,mg=5,dg=7,xu=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function _i(e){if(e<0)return NaN;if(e===0)return 1/0;if(!isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-_i(1-e);e=e-1;for(var r=e+mg+.5,n=xu[0],t=dg-1;t>=1;t--)n+=xu[t]/(e+t);return yu+(e+.5)*Math.log(r)-r+Math.log(n)}_i.signature="number";var Cr="number";function bu(e){return c0(e)}bu.signature=Cr;function wu(e){return Math.atan(1/e)}wu.signature=Cr;function Nu(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}Nu.signature=Cr;function Du(e){return Math.asin(1/e)}Du.signature=Cr;function Au(e){var r=1/e;return Math.log(r+Math.sqrt(r*r+1))}Au.signature=Cr;function Eu(e){return Math.acos(1/e)}Eu.signature=Cr;function Mu(e){var r=1/e,n=Math.sqrt(r*r-1);return Math.log(n+r)}Mu.signature=Cr;function Su(e){return f0(e)}Su.signature=Cr;function Fu(e){return p0(e)}Fu.signature=Cr;function Cu(e){return 1/Math.tan(e)}Cu.signature=Cr;function Bu(e){var r=Math.exp(2*e);return(r+1)/(r-1)}Bu.signature=Cr;function Ou(e){return 1/Math.sin(e)}Ou.signature=Cr;function Tu(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Ot(e)}Tu.signature=Cr;function _u(e){return 1/Math.cos(e)}_u.signature=Cr;function Iu(e){return 2/(Math.exp(e)+Math.exp(-e))}Iu.signature=Cr;function zu(e){return d0(e)}zu.signature=Cr;var Ii="number";function Ru(e){return e<0}Ru.signature=Ii;function qu(e){return e>0}qu.signature=Ii;function ku(e){return e===0}ku.signature=Ii;function ju(e){return Number.isNaN(e)}ju.signature=Ii;var Pu="isNegative",hg=["typed"],gg=R(Pu,hg,e=>{var{typed:r}=e;return r(Pu,{number:Ru,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:r.referToSelf(n=>t=>r.find(n,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),Uu="isNumeric",vg=["typed"],yg=R(Uu,vg,e=>{var{typed:r}=e;return r(Uu,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),Lu="hasNumericValue",xg=["typed","isNumeric"],bg=R(Lu,xg,e=>{var{typed:r,isNumeric:n}=e;return r(Lu,{boolean:()=>!0,string:function(t){return t.trim().length>0&&!isNaN(Number(t))},any:function(t){return n(t)}})}),Hu="isPositive",wg=["typed"],Ng=R(Hu,wg,e=>{var{typed:r}=e;return r(Hu,{number:qu,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:r.referToSelf(n=>t=>r.find(n,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),$u="isZero",Dg=["typed"],Ag=R($u,Dg,e=>{var{typed:r}=e;return r($u,{number:ku,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:r.referToSelf(n=>t=>r.find(n,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),Zu="isNaN",Eg=["typed"],Mg=R(Zu,Eg,e=>{var{typed:r}=e;return r(Zu,{number:ju,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return $e(n,Number.isNaN)}})}),Ju="typeOf",Sg=["typed"],Fg=R(Ju,Sg,e=>{var{typed:r}=e;return r(Ju,{any:nr})});function pt(e,r,n){if(n==null)return e.eq(r);if(e.eq(r))return!0;if(e.isNaN()||r.isNaN())return!1;if(e.isFinite()&&r.isFinite()){var t=e.minus(r).abs();if(t.isZero())return!0;var i=e.constructor.max(e.abs(),r.abs());return t.lte(i.times(n))}return!1}function Cg(e,r,n){return Lr(e.re,r.re,n)&&Lr(e.im,r.im,n)}var Mn=R("compareUnits",["typed"],e=>{var{typed:r}=e;return{"Unit, Unit":r.referToSelf(n=>(t,i)=>{if(!t.equalBase(i))throw new Error("Cannot compare units with different base");return r.find(n,[t.valueType(),i.valueType()])(t.value,i.value)})}}),zi="equalScalar",Bg=["typed","config"],Og=R(zi,Bg,e=>{var{typed:r,config:n}=e,t=Mn({typed:r});return r(zi,{"boolean, boolean":function(i,a){return i===a},"number, number":function(i,a){return Lr(i,a,n.epsilon)},"BigNumber, BigNumber":function(i,a){return i.eq(a)||pt(i,a,n.epsilon)},"Fraction, Fraction":function(i,a){return i.equals(a)},"Complex, Complex":function(i,a){return Cg(i,a,n.epsilon)}},t)});R(zi,["typed","config"],e=>{var{typed:r,config:n}=e;return r(zi,{"number, number":function(t,i){return Lr(t,i,n.epsilon)}})});var Tg="SparseMatrix",_g=["typed","equalScalar","Matrix"],Ig=R(Tg,_g,e=>{var{typed:r,equalScalar:n,Matrix:t}=e;function i(g,w){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(w&&!Sr(w))throw new Error("Invalid datatype: "+w);if(Be(g))a(this,g,w);else if(g&&Xe(g.index)&&Xe(g.ptr)&&Xe(g.size))this._values=g.values,this._index=g.index,this._ptr=g.ptr,this._size=g.size,this._datatype=w||g.datatype;else if(Xe(g))o(this,g,w);else{if(g)throw new TypeError("Unsupported type of data ("+nr(g)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=w}}function a(g,w,v){w.type==="SparseMatrix"?(g._values=w._values?Ie(w._values):void 0,g._index=Ie(w._index),g._ptr=Ie(w._ptr),g._size=Ie(w._size),g._datatype=v||w._datatype):o(g,w.valueOf(),v||w._datatype)}function o(g,w,v){g._values=[],g._index=[],g._ptr=[],g._datatype=v;var b=w.length,h=0,x=n,y=0;if(Sr(v)&&(x=r.find(n,[v,v])||n,y=r.convert(0,v)),b>0){var N=0;do{g._ptr.push(g._index.length);for(var A=0;A<b;A++){var E=w[A];if(Xe(E)){if(N===0&&h<E.length&&(h=E.length),N<E.length){var D=E[N];x(D,y)||(g._values.push(D),g._index.push(A))}}else N===0&&h<1&&(h=1),x(E,y)||(g._values.push(E),g._index.push(A))}N++}while(N<h)}g._ptr.push(g._index.length),g._size=[b,h]}i.prototype=new t,i.prototype.createSparseMatrix=function(g,w){return new i(g,w)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Zn(this._values,nr)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(g,w){return new i(g,w)},i.prototype.density=function(){var g=this._size[0],w=this._size[1];return g!==0&&w!==0?this._index.length/(g*w):0},i.prototype.subset=function(g,w,v){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return f(this,g);case 2:case 3:return c(this,g,w,v);default:throw new SyntaxError("Wrong number of arguments")}};function f(g,w){if(!pi(w))throw new TypeError("Invalid index");var v=w.isScalar();if(v)return g.get(w.min());var b=w.size();if(b.length!==g._size.length)throw new He(b.length,g._size.length);var h,x,y,N,A=w.min(),E=w.max();for(h=0,x=g._size.length;h<x;h++)ir(A[h],g._size[h]),ir(E[h],g._size[h]);var D=g._values,M=g._index,S=g._ptr,B=w.dimension(0),I=w.dimension(1),j=[],_=[];B.forEach(function(T,Y){_[T]=Y[0],j[T]=!0});var O=D?[]:void 0,C=[],z=[];return I.forEach(function(T){for(z.push(C.length),y=S[T],N=S[T+1];y<N;y++)h=M[y],j[h]===!0&&(C.push(_[h]),O&&O.push(D[y]))}),z.push(C.length),new i({values:O,index:C,ptr:z,size:b,datatype:g._datatype})}function c(g,w,v,b){if(!w||w.isIndex!==!0)throw new TypeError("Invalid index");var h=w.size(),x=w.isScalar(),y;if(Be(v)?(y=v.size(),v=v.toArray()):y=qe(v),x){if(y.length!==0)throw new TypeError("Scalar expected");g.set(w.min(),v,b)}else{if(h.length!==1&&h.length!==2)throw new He(h.length,g._size.length,"<");if(y.length<h.length){for(var N=0,A=0;h[N]===1&&y[N]===1;)N++;for(;h[N]===1;)A++,N++;v=cs(v,h.length,A,y)}if(!Yt(h,y))throw new He(h,y,">");if(h.length===1){var E=w.dimension(0);E.forEach(function(S,B){ir(S),g.set([S,0],v[B[0]],b)})}else{var D=w.dimension(0),M=w.dimension(1);D.forEach(function(S,B){ir(S),M.forEach(function(I,j){ir(I),g.set([S,I],v[B[0]][j[0]],b)})})}}return g}i.prototype.get=function(g){if(!Xe(g))throw new TypeError("Array expected");if(g.length!==this._size.length)throw new He(g.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var w=g[0],v=g[1];ir(w,this._size[0]),ir(v,this._size[1]);var b=u(w,this._ptr[v],this._ptr[v+1],this._index);return b<this._ptr[v+1]&&this._index[b]===w?this._values[b]:0},i.prototype.set=function(g,w,v){if(!Xe(g))throw new TypeError("Array expected");if(g.length!==this._size.length)throw new He(g.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var b=g[0],h=g[1],x=this._size[0],y=this._size[1],N=n,A=0;Sr(this._datatype)&&(N=r.find(n,[this._datatype,this._datatype])||n,A=r.convert(0,this._datatype)),(b>x-1||h>y-1)&&(p(this,Math.max(b+1,x),Math.max(h+1,y),v),x=this._size[0],y=this._size[1]),ir(b,x),ir(h,y);var E=u(b,this._ptr[h],this._ptr[h+1],this._index);return E<this._ptr[h+1]&&this._index[E]===b?N(w,A)?s(E,h,this._values,this._index,this._ptr):this._values[E]=w:N(w,A)||l(E,b,h,w,this._values,this._index,this._ptr),this};function u(g,w,v,b){if(v-w===0)return v;for(var h=w;h<v;h++)if(b[h]===g)return h;return w}function s(g,w,v,b,h){v.splice(g,1),b.splice(g,1);for(var x=w+1;x<h.length;x++)h[x]--}function l(g,w,v,b,h,x,y){h.splice(g,0,b),x.splice(g,0,w);for(var N=v+1;N<y.length;N++)y[N]++}i.prototype.resize=function(g,w,v){if(!Wr(g))throw new TypeError("Array or Matrix expected");var b=g.valueOf().map(x=>Array.isArray(x)&&x.length===1?x[0]:x);if(b.length!==2)throw new Error("Only two dimensions matrix are supported");b.forEach(function(x){if(!ke(x)||!Se(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Le(b)+")")});var h=v?this.clone():this;return p(h,b[0],b[1],w)};function p(g,w,v,b){var h=b||0,x=n,y=0;Sr(g._datatype)&&(x=r.find(n,[g._datatype,g._datatype])||n,y=r.convert(0,g._datatype),h=r.convert(h,g._datatype));var N=!x(h,y),A=g._size[0],E=g._size[1],D,M,S;if(v>E){for(M=E;M<v;M++)if(g._ptr[M]=g._values.length,N)for(D=0;D<A;D++)g._values.push(h),g._index.push(D);g._ptr[v]=g._values.length}else v<E&&(g._ptr.splice(v+1,E-v),g._values.splice(g._ptr[v],g._values.length),g._index.splice(g._ptr[v],g._index.length));if(E=v,w>A){if(N){var B=0;for(M=0;M<E;M++){g._ptr[M]=g._ptr[M]+B,S=g._ptr[M+1]+B;var I=0;for(D=A;D<w;D++,I++)g._values.splice(S+I,0,h),g._index.splice(S+I,0,D),B++}g._ptr[E]=g._values.length}}else if(w<A){var j=0;for(M=0;M<E;M++){g._ptr[M]=g._ptr[M]-j;var _=g._ptr[M],O=g._ptr[M+1]-j;for(S=_;S<O;S++)D=g._index[S],D>w-1&&(g._values.splice(S,1),g._index.splice(S,1),j++)}g._ptr[M]=g._values.length}return g._size[0]=w,g._size[1]=v,g}i.prototype.reshape=function(g,w){if(!Xe(g))throw new TypeError("Array expected");if(g.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");g.forEach(function(T){if(!ke(T)||!Se(T)||T<=-2||T===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Le(g)+")")});var v=this._size[0]*this._size[1];g=_a(g,v);var b=g[0]*g[1];if(v!==b)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var h=w?this.clone():this;if(this._size[0]===g[0]&&this._size[1]===g[1])return h;for(var x=[],y=0;y<h._ptr.length;y++)for(var N=0;N<h._ptr[y+1]-h._ptr[y];N++)x.push(y);for(var A=h._values.slice(),E=h._index.slice(),D=0;D<h._index.length;D++){var M=E[D],S=x[D],B=M*h._size[1]+S;x[D]=B%g[1],E[D]=Math.floor(B/g[1])}h._values.length=0,h._index.length=0,h._ptr.length=g[1]+1,h._size=g.slice();for(var I=0;I<h._ptr.length;I++)h._ptr[I]=0;for(var j=0;j<A.length;j++){var _=E[j],O=x[j],C=A[j],z=u(_,h._ptr[O],h._ptr[O+1],h._index);l(z,_,O,C,h._values,h._index,h._ptr)}return h},i.prototype.clone=function(){var g=new i({values:this._values?Ie(this._values):void 0,index:Ie(this._index),ptr:Ie(this._ptr),size:Ie(this._size),datatype:this._datatype});return g},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(g,w){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var v=this,b=this._size[0],h=this._size[1],x=qs(g),y=function(N,A,E){return x===1?g(N):x===2?g(N,[A,E]):g(N,[A,E],v)};return m(this,0,b-1,0,h-1,y,w)};function m(g,w,v,b,h,x,y){var N=[],A=[],E=[],D=n,M=0;Sr(g._datatype)&&(D=r.find(n,[g._datatype,g._datatype])||n,M=r.convert(0,g._datatype));for(var S=function($,q,ne){$=x($,q,ne),D($,M)||(N.push($),A.push(q))},B=b;B<=h;B++){E.push(N.length);var I=g._ptr[B],j=g._ptr[B+1];if(y)for(var _=I;_<j;_++){var O=g._index[_];O>=w&&O<=v&&S(g._values[_],O-w,B-b)}else{for(var C={},z=I;z<j;z++){var T=g._index[z];C[T]=g._values[z]}for(var Y=w;Y<=v;Y++){var te=Y in C?C[Y]:0;S(te,Y-w,B-b)}}}return E.push(N.length),new i({values:N,index:A,ptr:E,size:[v-w+1,h-b+1]})}i.prototype.forEach=function(g,w){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var v=this,b=this._size[0],h=this._size[1],x=0;x<h;x++){var y=this._ptr[x],N=this._ptr[x+1];if(w)for(var A=y;A<N;A++){var E=this._index[A];g(this._values[A],[E,x],v)}else{for(var D={},M=y;M<N;M++){var S=this._index[M];D[S]=this._values[M]}for(var B=0;B<b;B++){var I=B in D?D[B]:0;g(I,[B,x],v)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var g=this._size[1],w=0;w<g;w++)for(var v=this._ptr[w],b=this._ptr[w+1],h=v;h<b;h++){var x=this._index[h];yield{value:this._values[h],index:[x,w]}}},i.prototype.toArray=function(){return d(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return d(this._values,this._index,this._ptr,this._size,!1)};function d(g,w,v,b,h){var x=b[0],y=b[1],N=[],A,E;for(A=0;A<x;A++)for(N[A]=[],E=0;E<y;E++)N[A][E]=0;for(E=0;E<y;E++)for(var D=v[E],M=v[E+1],S=D;S<M;S++)A=w[S],N[A][E]=g?h?Ie(g[S]):g[S]:1;return N}return i.prototype.format=function(g){for(var w=this._size[0],v=this._size[1],b=this.density(),h="Sparse Matrix ["+Le(w,g)+" x "+Le(v,g)+"] density: "+Le(b,g)+`
27
+ `,x=0;x<v;x++)for(var y=this._ptr[x],N=this._ptr[x+1],A=y;A<N;A++){var E=this._index[A];h+=`
28
+ (`+Le(E,g)+", "+Le(x,g)+") ==> "+(this._values?Le(this._values[A],g):"X")}return h},i.prototype.toString=function(){return Le(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(g){if(g){if(je(g)&&(g=g.toNumber()),!ke(g)||!Se(g))throw new TypeError("The parameter k must be an integer number")}else g=0;var w=g>0?g:0,v=g<0?-g:0,b=this._size[0],h=this._size[1],x=Math.min(b-v,h-w),y=[],N=[],A=[];A[0]=0;for(var E=w;E<h&&y.length<x;E++)for(var D=this._ptr[E],M=this._ptr[E+1],S=D;S<M;S++){var B=this._index[S];if(B===E-w+v){y.push(this._values[S]),N[y.length-1]=B-v;break}}return A.push(y.length),new i({values:y,index:N,ptr:A,size:[x,1]})},i.fromJSON=function(g){return new i(g)},i.diagonal=function(g,w,v,b,h){if(!Xe(g))throw new TypeError("Array expected, size parameter");if(g.length!==2)throw new Error("Only two dimensions matrix are supported");if(g=g.map(function(T){if(je(T)&&(T=T.toNumber()),!ke(T)||!Se(T)||T<1)throw new Error("Size values must be positive integers");return T}),v){if(je(v)&&(v=v.toNumber()),!ke(v)||!Se(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var x=n,y=0;Sr(h)&&(x=r.find(n,[h,h])||n,y=r.convert(0,h));var N=v>0?v:0,A=v<0?-v:0,E=g[0],D=g[1],M=Math.min(E-A,D-N),S;if(Xe(w)){if(w.length!==M)throw new Error("Invalid value array length");S=function(T){return w[T]}}else if(Be(w)){var B=w.size();if(B.length!==1||B[0]!==M)throw new Error("Invalid matrix length");S=function(T){return w.get([T])}}else S=function(){return w};for(var I=[],j=[],_=[],O=0;O<D;O++){_.push(I.length);var C=O-N;if(C>=0&&C<M){var z=S(C);x(z,y)||(j.push(C+A),I.push(z))}}return _.push(I.length),new i({values:I,index:j,ptr:_,size:[E,D]})},i.prototype.swapRows=function(g,w){if(!ke(g)||!Se(g)||!ke(w)||!Se(w))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return ir(g,this._size[0]),ir(w,this._size[0]),i._swapRows(g,w,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(g,w,v,b,h){for(var x=b[g],y=b[g+1],N=x;N<y;N++)h(v[N],w[N])},i._swapRows=function(g,w,v,b,h,x){for(var y=0;y<v;y++){var N=x[y],A=x[y+1],E=u(g,N,A,h),D=u(w,N,A,h);if(E<A&&D<A&&h[E]===g&&h[D]===w){if(b){var M=b[E];b[E]=b[D],b[D]=M}continue}if(E<A&&h[E]===g&&(D>=A||h[D]!==w)){var S=b?b[E]:void 0;h.splice(D,0,w),b&&b.splice(D,0,S),h.splice(D<=E?E+1:E,1),b&&b.splice(D<=E?E+1:E,1);continue}if(D<A&&h[D]===w&&(E>=A||h[E]!==g)){var B=b?b[D]:void 0;h.splice(E,0,g),b&&b.splice(E,0,B),h.splice(E<=D?D+1:D,1),b&&b.splice(E<=D?D+1:D,1)}}},i},{isClass:!0}),zg="number",Rg=["typed"];function qg(e){var r=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(r){var n={"0b":2,"0o":8,"0x":16}[r[1]],t=r[2],i=r[3];return{input:e,radix:n,integerPart:t,fractionalPart:i}}else return null}function kg(e){for(var r=parseInt(e.integerPart,e.radix),n=0,t=0;t<e.fractionalPart.length;t++){var i=parseInt(e.fractionalPart[t],e.radix);n+=i/Math.pow(e.radix,t+1)}var a=r+n;if(isNaN(a))throw new SyntaxError('String "'+e.input+'" is not a valid number');return a}var jg=R(zg,Rg,e=>{var{typed:r}=e,n=r("number",{"":function(){return 0},number:function(t){return t},string:function(t){if(t==="NaN")return NaN;var i=qg(t);if(i)return kg(i);var a=0,o=t.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);o&&(a=Number(o[2]),t=o[1]);var f=Number(t);if(isNaN(f))throw new SyntaxError('String "'+t+'" is not a valid number');if(o){if(f>2**a-1)throw new SyntaxError('String "'.concat(t,'" is out of range'));f>=2**(a-1)&&(f=f-2**a)}return f},BigNumber:function(t){return t.toNumber()},Fraction:function(t){return t.valueOf()},Unit:r.referToSelf(t=>i=>{var a=i.clone();return a.value=t(i.value),a}),null:function(t){return 0},"Unit, string | Unit":function(t,i){return t.toNumber(i)},"Array | Matrix":r.referToSelf(t=>i=>$e(i,t))});return n.fromJSON=function(t){return parseFloat(t.value)},n}),Wu="string",Pg=["typed"],Ug=R(Wu,Pg,e=>{var{typed:r}=e;return r(Wu,{"":function(){return""},number:Gt,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":r.referToSelf(n=>t=>$e(t,n)),any:function(n){return String(n)}})}),Yu="boolean",Lg=["typed"],Hg=R(Yu,Lg,e=>{var{typed:r}=e;return r(Yu,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var t=n.toLowerCase();if(t==="true")return!0;if(t==="false")return!1;var i=Number(n);if(n!==""&&!isNaN(i))return!!i;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),$g="bignumber",Zg=["typed","BigNumber"],Jg=R($g,Zg,e=>{var{typed:r,BigNumber:n}=e;return r("bignumber",{"":function(){return new n(0)},number:function(t){return new n(t+"")},string:function(t){var i=t.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(i){var a=i[2],o=n(i[1]),f=new n(2).pow(Number(a));if(o.gt(f.sub(1)))throw new SyntaxError('String "'.concat(t,'" is out of range'));var c=new n(2).pow(Number(a)-1);return o.gte(c)?o.sub(f):o}return new n(t)},BigNumber:function(t){return t},Unit:r.referToSelf(t=>i=>{var a=i.clone();return a.value=t(i.value),a}),Fraction:function(t){return new n(t.n).div(t.d).times(t.s)},null:function(t){return new n(0)},"Array | Matrix":r.referToSelf(t=>i=>$e(i,t))})}),Wg="complex",Yg=["typed","Complex"],Gg=R(Wg,Yg,e=>{var{typed:r,Complex:n}=e;return r("complex",{"":function(){return n.ZERO},number:function(t){return new n(t,0)},"number, number":function(t,i){return new n(t,i)},"BigNumber, BigNumber":function(t,i){return new n(t.toNumber(),i.toNumber())},Fraction:function(t){return new n(t.valueOf(),0)},Complex:function(t){return t.clone()},string:function(t){return n(t)},null:function(t){return n(0)},Object:function(t){if("re"in t&&"im"in t)return new n(t.re,t.im);if("r"in t&&"phi"in t||"abs"in t&&"arg"in t)return new n(t);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf(t=>i=>$e(i,t))})}),Vg="fraction",Kg=["typed","Fraction"],Qg=R(Vg,Kg,e=>{var{typed:r,Fraction:n}=e;return r("fraction",{number:function(t){if(!isFinite(t)||isNaN(t))throw new Error(t+" cannot be represented as a fraction");return new n(t)},string:function(t){return new n(t)},"number, number":function(t,i){return new n(t,i)},null:function(t){return new n(0)},BigNumber:function(t){return new n(t.toString())},Fraction:function(t){return t},Unit:r.referToSelf(t=>i=>{var a=i.clone();return a.value=t(i.value),a}),Object:function(t){return new n(t)},"Array | Matrix":r.referToSelf(t=>i=>$e(i,t))})}),Gu="matrix",Xg=["typed","Matrix","DenseMatrix","SparseMatrix"],e1=R(Gu,Xg,e=>{var{typed:r,Matrix:n,DenseMatrix:t,SparseMatrix:i}=e;return r(Gu,{"":function(){return a([])},string:function(o){return a([],o)},"string, string":function(o,f){return a([],o,f)},Array:function(o){return a(o)},Matrix:function(o){return a(o,o.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,f,c){if(f==="dense"||f==="default"||f===void 0)return new t(o,c);if(f==="sparse")return new i(o,c);throw new TypeError("Unknown matrix type "+JSON.stringify(f)+".")}}),Vu="matrixFromFunction",r1=["typed","matrix","isZero"],t1=R(Vu,r1,e=>{var{typed:r,matrix:n,isZero:t}=e;return r(Vu,{"Array | Matrix, function, string, string":function(a,o,f,c){return i(a,o,f,c)},"Array | Matrix, function, string":function(a,o,f){return i(a,o,f)},"Matrix, function":function(a,o){return i(a,o,"dense")},"Array, function":function(a,o){return i(a,o,"dense").toArray()},"Array | Matrix, string, function":function(a,o,f){return i(a,f,o)},"Array | Matrix, string, string, function":function(a,o,f,c){return i(a,c,o,f)}});function i(a,o,f,c){var u;return c!==void 0?u=n(f,c):u=n(f),u.resize(a),u.forEach(function(s,l){var p=o(l);t(p)||u.set(l,p)}),u}}),Ku="matrixFromRows",n1=["typed","matrix","flatten","size"],i1=R(Ku,n1,e=>{var{typed:r,matrix:n,flatten:t,size:i}=e;return r(Ku,{"...Array":function(f){return a(f)},"...Matrix":function(f){return n(a(f.map(c=>c.toArray())))}});function a(f){if(f.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var c=o(f[0]),u=[];for(var s of f){var l=o(s);if(l!==c)throw new TypeError("The vectors had different length: "+(c|0)+" ≠ "+(l|0));u.push(t(s))}return u}function o(f){var c=i(f);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),Qu="matrixFromColumns",a1=["typed","matrix","flatten","size"],o1=R(Qu,a1,e=>{var{typed:r,matrix:n,flatten:t,size:i}=e;return r(Qu,{"...Array":function(f){return a(f)},"...Matrix":function(f){return n(a(f.map(c=>c.toArray())))}});function a(f){if(f.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var c=o(f[0]),u=[],s=0;s<c;s++)u[s]=[];for(var l of f){var p=o(l);if(p!==c)throw new TypeError("The vectors had different length: "+(c|0)+" ≠ "+(p|0));for(var m=t(l),d=0;d<c;d++)u[d].push(m[d])}return u}function o(f){var c=i(f);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),Xu="splitUnit",s1=["typed"],u1=R(Xu,s1,e=>{var{typed:r}=e;return r(Xu,{"Unit, Array":function(n,t){return n.splitUnit(t)}})}),el="unaryMinus",l1=["typed"],c1=R(el,l1,e=>{var{typed:r}=e;return r(el,{number:Js,"Complex | BigNumber | Fraction":n=>n.neg(),Unit:r.referToSelf(n=>t=>{var i=t.clone();return i.value=r.find(n,i.valueType())(t.value),i}),"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),rl="unaryPlus",f1=["typed","config","BigNumber"],p1=R(rl,f1,e=>{var{typed:r,config:n,BigNumber:t}=e;return r(rl,{number:Ws,Complex:function(i){return i},BigNumber:function(i){return i},Fraction:function(i){return i},Unit:function(i){return i.clone()},"Array | Matrix":r.referToSelf(i=>a=>$e(a,i)),"boolean | string":function(i){return n.number==="BigNumber"?new t(+i):+i}})}),tl="abs",m1=["typed"],d1=R(tl,m1,e=>{var{typed:r}=e;return r(tl,{number:Ls,"Complex | BigNumber | Fraction | Unit":n=>n.abs(),"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),nl="apply",h1=["typed","isInteger"],Wa=R(nl,h1,e=>{var{typed:r,isInteger:n}=e;return r(nl,{"Array | Matrix, number | BigNumber, function":function(t,i,a){if(!n(i))throw new TypeError("Integer number expected for dimension");var o=Array.isArray(t)?qe(t):t.size();if(i<0||i>=o.length)throw new et(i,o.length);return Be(t)?t.create(Ri(t.valueOf(),i,a)):Ri(t,i,a)}})});function Ri(e,r,n){var t,i,a;if(r<=0)if(Array.isArray(e[0])){for(a=g1(e),i=[],t=0;t<a.length;t++)i[t]=Ri(a[t],r-1,n);return i}else return n(e);else{for(i=[],t=0;t<e.length;t++)i[t]=Ri(e[t],r-1,n);return i}}function g1(e){var r=e.length,n=e[0].length,t,i,a=[];for(i=0;i<n;i++){var o=[];for(t=0;t<r;t++)o.push(e[t][i]);a.push(o)}return a}var il="addScalar",v1=["typed"],y1=R(il,v1,e=>{var{typed:r}=e;return r(il,{"number, number":Hs,"Complex, Complex":function(n,t){return n.add(t)},"BigNumber, BigNumber":function(n,t){return n.plus(t)},"Fraction, Fraction":function(n,t){return n.add(t)},"Unit, Unit":r.referToSelf(n=>(t,i)=>{if(t.value===null||t.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(i))throw new Error("Units do not match");var a=t.clone();return a.value=r.find(n,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})}),al="subtractScalar",x1=["typed"],b1=R(al,x1,e=>{var{typed:r}=e;return r(al,{"number, number":$s,"Complex, Complex":function(n,t){return n.sub(t)},"BigNumber, BigNumber":function(n,t){return n.minus(t)},"Fraction, Fraction":function(n,t){return n.sub(t)},"Unit, Unit":r.referToSelf(n=>(t,i)=>{if(t.value===null||t.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(i))throw new Error("Units do not match");var a=t.clone();return a.value=r.find(n,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})}),ol="cbrt",w1=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],N1=R(ol,w1,e=>{var{config:r,typed:n,isNegative:t,unaryMinus:i,matrix:a,Complex:o,BigNumber:f,Fraction:c}=e;return n(ol,{number:Gn,Complex:u,"Complex, boolean":u,BigNumber:function(l){return l.cbrt()},Unit:s});function u(l,p){var m=l.arg()/3,d=l.abs(),g=new o(Gn(d),0).mul(new o(0,m).exp());if(p){var w=[g,new o(Gn(d),0).mul(new o(0,m+Math.PI*2/3).exp()),new o(Gn(d),0).mul(new o(0,m-Math.PI*2/3).exp())];return r.matrix==="Array"?w:a(w)}else return g}function s(l){if(l.value&&yt(l.value)){var p=l.clone();return p.value=1,p=p.pow(1/3),p.value=u(l.value),p}else{var m=t(l.value);m&&(l.value=i(l.value));var d;je(l.value)?d=new f(1).div(3):Ln(l.value)?d=new c(1,3):d=1/3;var g=l.pow(d);return m&&(g.value=i(g.value)),g}}}),D1="matAlgo11xS0s",A1=["typed","equalScalar"],Ar=R(D1,A1,e=>{var{typed:r,equalScalar:n}=e;return function(t,i,a,o){var f=t._values,c=t._index,u=t._ptr,s=t._size,l=t._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=s[0],m=s[1],d,g=n,w=0,v=a;typeof l=="string"&&(d=l,g=r.find(n,[d,d]),w=r.convert(0,d),i=r.convert(i,d),v=r.find(a,[d,d]));for(var b=[],h=[],x=[],y=0;y<m;y++){x[y]=h.length;for(var N=u[y],A=u[y+1],E=N;E<A;E++){var D=c[E],M=o?v(i,f[E]):v(f[E],i);g(M,w)||(h.push(D),b.push(M))}}return x[m]=h.length,t.createSparseMatrix({values:b,index:h,ptr:x,size:[p,m],datatype:d})}}),E1="matAlgo12xSfs",M1=["typed","DenseMatrix"],gr=R(E1,M1,e=>{var{typed:r,DenseMatrix:n}=e;return function(t,i,a,o){var f=t._values,c=t._index,u=t._ptr,s=t._size,l=t._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=s[0],m=s[1],d,g=a;typeof l=="string"&&(d=l,i=r.convert(i,d),g=r.find(a,[d,d]));for(var w=[],v=[],b=[],h=0;h<m;h++){for(var x=h+1,y=u[h],N=u[h+1],A=y;A<N;A++){var E=c[A];v[E]=f[A],b[E]=x}for(var D=0;D<p;D++)h===0&&(w[D]=[]),b[D]===x?w[D][h]=o?g(i,v[D]):g(v[D],i):w[D][h]=o?g(i,0):g(0,i)}return new n({data:w,size:[p,m],datatype:d})}}),S1="matAlgo14xDs",F1=["typed"],it=R(S1,F1,e=>{var{typed:r}=e;return function(t,i,a,o){var f=t._data,c=t._size,u=t._datatype,s,l=a;typeof u=="string"&&(s=u,i=r.convert(i,s),l=r.find(a,[s,s]));var p=c.length>0?n(l,0,c,c[0],f,i,o):[];return t.createDenseMatrix({data:p,size:Ie(c),datatype:s})};function n(t,i,a,o,f,c,u){var s=[];if(i===a.length-1)for(var l=0;l<o;l++)s[l]=u?t(c,f[l]):t(f[l],c);else for(var p=0;p<o;p++)s[p]=n(t,i+1,a,a[i+1],f[p],c,u);return s}}),Ya="ceil",C1=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],B1=R(Ya,["typed","config","round"],e=>{var{typed:r,config:n,round:t}=e;return r(Ya,{number:function(i){return Lr(i,t(i),n.epsilon)?t(i):Math.ceil(i)},"number, number":function(i,a){if(Lr(i,t(i,a),n.epsilon))return t(i,a);var[o,f]="".concat(i,"e").split("e"),c=Math.ceil(Number("".concat(o,"e").concat(Number(f)+a)));return[o,f]="".concat(c,"e").split("e"),Number("".concat(o,"e").concat(Number(f)-a))}})}),O1=R(Ya,C1,e=>{var{typed:r,config:n,round:t,matrix:i,equalScalar:a,zeros:o,DenseMatrix:f}=e,c=Ar({typed:r,equalScalar:a}),u=gr({typed:r,DenseMatrix:f}),s=it({typed:r}),l=B1({typed:r,config:n,round:t});return r("ceil",{number:l.signatures.number,"number,number":l.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,m){return p.ceil(m)},"Complex, BigNumber":function(p,m){return p.ceil(m.toNumber())},BigNumber:function(p){return pt(p,t(p),n.epsilon)?t(p):p.ceil()},"BigNumber, BigNumber":function(p,m){return pt(p,t(p,m),n.epsilon)?t(p,m):p.toDecimalPlaces(m.toNumber(),Rt.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,m){return p.ceil(m)},"Fraction, BigNumber":function(p,m){return p.ceil(m.toNumber())},"Array | Matrix":r.referToSelf(p=>m=>$e(m,p)),"Array, number | BigNumber":r.referToSelf(p=>(m,d)=>$e(m,g=>p(g,d))),"SparseMatrix, number | BigNumber":r.referToSelf(p=>(m,d)=>c(m,d,p,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(p=>(m,d)=>s(m,d,p,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(p=>(m,d)=>s(i(d),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(p=>(m,d)=>a(m,0)?o(d.size(),d.storage()):d.storage()==="dense"?s(d,m,p,!0):u(d,m,p,!0))})}),sl="cube",T1=["typed"],_1=R(sl,T1,e=>{var{typed:r}=e;return r(sl,{number:Ys,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})}),ul="exp",I1=["typed"],z1=R(ul,I1,e=>{var{typed:r}=e;return r(ul,{number:Gs,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})}),ll="expm1",R1=["typed","Complex"],q1=R(ll,R1,e=>{var{typed:r,Complex:n}=e;return r(ll,{number:Vs,Complex:function(t){var i=Math.exp(t.re);return new n(i*Math.cos(t.im)-1,i*Math.sin(t.im))},BigNumber:function(t){return t.exp().minus(1)}})}),Ga="fix",k1=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],j1=R(Ga,["typed","ceil","floor"],e=>{var{typed:r,ceil:n,floor:t}=e;return r(Ga,{number:function(i){return i>0?t(i):n(i)},"number, number":function(i,a){return i>0?t(i,a):n(i,a)}})}),P1=R(Ga,k1,e=>{var{typed:r,Complex:n,matrix:t,ceil:i,floor:a,equalScalar:o,zeros:f,DenseMatrix:c}=e,u=gr({typed:r,DenseMatrix:c}),s=it({typed:r}),l=j1({typed:r,ceil:i,floor:a});return r("fix",{number:l.signatures.number,"number, number | BigNumber":l.signatures["number,number"],Complex:function(p){return new n(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,m){return new n(p.re>0?a(p.re,m):i(p.re,m),p.im>0?a(p.im,m):i(p.im,m))},"Complex, BigNumber":function(p,m){var d=m.toNumber();return new n(p.re>0?a(p.re,d):i(p.re,d),p.im>0?a(p.im,d):i(p.im,d))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,m){return p.isNegative()?i(p,m):a(p,m)},Fraction:function(p){return p.s<0?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,m){return p.s<0?i(p,m):a(p,m)},"Array | Matrix":r.referToSelf(p=>m=>$e(m,p)),"Array | Matrix, number | BigNumber":r.referToSelf(p=>(m,d)=>$e(m,g=>p(g,d))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(p=>(m,d)=>s(t(d),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(p=>(m,d)=>o(m,0)?f(d.size(),d.storage()):d.storage()==="dense"?s(d,m,p,!0):u(d,m,p,!0))})}),Va="floor",U1=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],L1=R(Va,["typed","config","round"],e=>{var{typed:r,config:n,round:t}=e;return r(Va,{number:function(i){return Lr(i,t(i),n.epsilon)?t(i):Math.floor(i)},"number, number":function(i,a){if(Lr(i,t(i,a),n.epsilon))return t(i,a);var[o,f]="".concat(i,"e").split("e"),c=Math.floor(Number("".concat(o,"e").concat(Number(f)+a)));return[o,f]="".concat(c,"e").split("e"),Number("".concat(o,"e").concat(Number(f)-a))}})}),cl=R(Va,U1,e=>{var{typed:r,config:n,round:t,matrix:i,equalScalar:a,zeros:o,DenseMatrix:f}=e,c=Ar({typed:r,equalScalar:a}),u=gr({typed:r,DenseMatrix:f}),s=it({typed:r}),l=L1({typed:r,config:n,round:t});return r("floor",{number:l.signatures.number,"number,number":l.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,m){return p.floor(m)},"Complex, BigNumber":function(p,m){return p.floor(m.toNumber())},BigNumber:function(p){return pt(p,t(p),n.epsilon)?t(p):p.floor()},"BigNumber, BigNumber":function(p,m){return pt(p,t(p,m),n.epsilon)?t(p,m):p.toDecimalPlaces(m.toNumber(),Rt.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,m){return p.floor(m)},"Fraction, BigNumber":function(p,m){return p.floor(m.toNumber())},"Array | Matrix":r.referToSelf(p=>m=>$e(m,p)),"Array, number | BigNumber":r.referToSelf(p=>(m,d)=>$e(m,g=>p(g,d))),"SparseMatrix, number | BigNumber":r.referToSelf(p=>(m,d)=>c(m,d,p,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(p=>(m,d)=>s(m,d,p,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(p=>(m,d)=>s(i(d),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(p=>(m,d)=>a(m,0)?o(d.size(),d.storage()):d.storage()==="dense"?s(d,m,p,!0):u(d,m,p,!0))})}),H1="matAlgo02xDS0",$1=["typed","equalScalar"],at=R(H1,$1,e=>{var{typed:r,equalScalar:n}=e;return function(t,i,a,o){var f=t._data,c=t._size,u=t._datatype,s=i._values,l=i._index,p=i._ptr,m=i._size,d=i._datatype;if(c.length!==m.length)throw new He(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=c[0],w=c[1],v,b=n,h=0,x=a;typeof u=="string"&&u===d&&(v=u,b=r.find(n,[v,v]),h=r.convert(0,v),x=r.find(a,[v,v]));for(var y=[],N=[],A=[],E=0;E<w;E++){A[E]=N.length;for(var D=p[E],M=p[E+1],S=D;S<M;S++){var B=l[S],I=o?x(s[S],f[B][E]):x(f[B][E],s[S]);b(I,h)||(N.push(B),y.push(I))}}return A[w]=N.length,i.createSparseMatrix({values:y,index:N,ptr:A,size:[g,w],datatype:v})}}),Z1="matAlgo03xDSf",J1=["typed"],_r=R(Z1,J1,e=>{var{typed:r}=e;return function(n,t,i,a){var o=n._data,f=n._size,c=n._datatype,u=t._values,s=t._index,l=t._ptr,p=t._size,m=t._datatype;if(f.length!==p.length)throw new He(f.length,p.length);if(f[0]!==p[0]||f[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+p+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=f[0],g=f[1],w,v=0,b=i;typeof c=="string"&&c===m&&(w=c,v=r.convert(0,w),b=r.find(i,[w,w]));for(var h=[],x=0;x<d;x++)h[x]=[];for(var y=[],N=[],A=0;A<g;A++){for(var E=A+1,D=l[A],M=l[A+1],S=D;S<M;S++){var B=s[S];y[B]=a?b(u[S],o[B][A]):b(o[B][A],u[S]),N[B]=E}for(var I=0;I<d;I++)N[I]===E?h[I][A]=y[I]:h[I][A]=a?b(v,o[I][A]):b(o[I][A],v)}return n.createDenseMatrix({data:h,size:[d,g],datatype:w})}}),W1="matAlgo05xSfSf",Y1=["typed","equalScalar"],qi=R(W1,Y1,e=>{var{typed:r,equalScalar:n}=e;return function(t,i,a){var o=t._values,f=t._index,c=t._ptr,u=t._size,s=t._datatype,l=i._values,p=i._index,m=i._ptr,d=i._size,g=i._datatype;if(u.length!==d.length)throw new He(u.length,d.length);if(u[0]!==d[0]||u[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+d+")");var w=u[0],v=u[1],b,h=n,x=0,y=a;typeof s=="string"&&s===g&&(b=s,h=r.find(n,[b,b]),x=r.convert(0,b),y=r.find(a,[b,b]));var N=o&&l?[]:void 0,A=[],E=[],D=N?[]:void 0,M=N?[]:void 0,S=[],B=[],I,j,_,O;for(j=0;j<v;j++){E[j]=A.length;var C=j+1;for(_=c[j],O=c[j+1];_<O;_++)I=f[_],A.push(I),S[I]=C,D&&(D[I]=o[_]);for(_=m[j],O=m[j+1];_<O;_++)I=p[_],S[I]!==C&&A.push(I),B[I]=C,M&&(M[I]=l[_]);if(N)for(_=E[j];_<A.length;){I=A[_];var z=S[I],T=B[I];if(z===C||T===C){var Y=z===C?D[I]:x,te=T===C?M[I]:x,$=y(Y,te);h($,x)?A.splice(_,1):(N.push($),_++)}}}return E[v]=A.length,t.createSparseMatrix({values:N,index:A,ptr:E,size:[w,v],datatype:b})}}),G1="matAlgo13xDD",V1=["typed"],K1=R(G1,V1,e=>{var{typed:r}=e;return function(t,i,a){var o=t._data,f=t._size,c=t._datatype,u=i._data,s=i._size,l=i._datatype,p=[];if(f.length!==s.length)throw new He(f.length,s.length);for(var m=0;m<f.length;m++){if(f[m]!==s[m])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+s+")");p[m]=f[m]}var d,g=a;typeof c=="string"&&c===l&&(d=c,g=r.find(a,[d,d]));var w=p.length>0?n(g,0,p,p[0],o,u):[];return t.createDenseMatrix({data:w,size:p,datatype:d})};function n(t,i,a,o,f,c){var u=[];if(i===a.length-1)for(var s=0;s<o;s++)u[s]=t(f[s],c[s]);else for(var l=0;l<o;l++)u[l]=n(t,i+1,a,a[i+1],f[l],c[l]);return u}}),Q1="broadcast",X1=["concat"],ev=R(Q1,X1,e=>{var{concat:r}=e;return function(i,a){var o=Math.max(i._size.length,a._size.length);if(i._size.length===a._size.length&&i._size.every((d,g)=>d===a._size[g]))return[i,a];for(var f=n(i._size,o,0),c=n(a._size,o,0),u=[],s=0;s<o;s++)u[s]=Math.max(f[s],c[s]);wi(f,u),wi(c,u);var l=i.clone(),p=a.clone();l._size.length<o?l.reshape(n(l._size,o,1)):p._size.length<o&&p.reshape(n(p._size,o,1));for(var m=0;m<o;m++)l._size[m]<u[m]&&(l=t(l,u[m],m)),p._size[m]<u[m]&&(p=t(p,u[m],m));return[l,p]};function n(i,a,o){return[...Array(a-i.length).fill(o),...i]}function t(i,a,o){return r(...Array(a).fill(i),o)}}),rv="matrixAlgorithmSuite",tv=["typed","matrix","concat"],sr=R(rv,tv,e=>{var{typed:r,matrix:n,concat:t}=e,i=K1({typed:r}),a=it({typed:r}),o=ev({concat:t});return function(f){var c=f.elop,u=f.SD||f.DS,s;c?(s={"DenseMatrix, DenseMatrix":(d,g)=>i(...o(d,g),c),"Array, Array":(d,g)=>i(...o(n(d),n(g)),c).valueOf(),"Array, DenseMatrix":(d,g)=>i(...o(n(d),g),c),"DenseMatrix, Array":(d,g)=>i(...o(d,n(g)),c)},f.SS&&(s["SparseMatrix, SparseMatrix"]=(d,g)=>f.SS(...o(d,g),c,!1)),f.DS&&(s["DenseMatrix, SparseMatrix"]=(d,g)=>f.DS(...o(d,g),c,!1),s["Array, SparseMatrix"]=(d,g)=>f.DS(...o(n(d),g),c,!1)),u&&(s["SparseMatrix, DenseMatrix"]=(d,g)=>u(...o(g,d),c,!0),s["SparseMatrix, Array"]=(d,g)=>u(...o(n(g),d),c,!0))):(s={"DenseMatrix, DenseMatrix":r.referToSelf(d=>(g,w)=>i(...o(g,w),d)),"Array, Array":r.referToSelf(d=>(g,w)=>i(...o(n(g),n(w)),d).valueOf()),"Array, DenseMatrix":r.referToSelf(d=>(g,w)=>i(...o(n(g),w),d)),"DenseMatrix, Array":r.referToSelf(d=>(g,w)=>i(...o(g,n(w)),d))},f.SS&&(s["SparseMatrix, SparseMatrix"]=r.referToSelf(d=>(g,w)=>f.SS(...o(g,w),d,!1))),f.DS&&(s["DenseMatrix, SparseMatrix"]=r.referToSelf(d=>(g,w)=>f.DS(...o(g,w),d,!1)),s["Array, SparseMatrix"]=r.referToSelf(d=>(g,w)=>f.DS(...o(n(g),w),d,!1))),u&&(s["SparseMatrix, DenseMatrix"]=r.referToSelf(d=>(g,w)=>u(...o(w,g),d,!0)),s["SparseMatrix, Array"]=r.referToSelf(d=>(g,w)=>u(...o(n(w),g),d,!0))));var l=f.scalar||"any",p=f.Ds||f.Ss;p&&(c?(s["DenseMatrix,"+l]=(d,g)=>a(d,g,c,!1),s[l+", DenseMatrix"]=(d,g)=>a(g,d,c,!0),s["Array,"+l]=(d,g)=>a(n(d),g,c,!1).valueOf(),s[l+", Array"]=(d,g)=>a(n(g),d,c,!0).valueOf()):(s["DenseMatrix,"+l]=r.referToSelf(d=>(g,w)=>a(g,w,d,!1)),s[l+", DenseMatrix"]=r.referToSelf(d=>(g,w)=>a(w,g,d,!0)),s["Array,"+l]=r.referToSelf(d=>(g,w)=>a(n(g),w,d,!1).valueOf()),s[l+", Array"]=r.referToSelf(d=>(g,w)=>a(n(w),g,d,!0).valueOf())));var m=f.sS!==void 0?f.sS:f.Ss;return c?(f.Ss&&(s["SparseMatrix,"+l]=(d,g)=>f.Ss(d,g,c,!1)),m&&(s[l+", SparseMatrix"]=(d,g)=>m(g,d,c,!0))):(f.Ss&&(s["SparseMatrix,"+l]=r.referToSelf(d=>(g,w)=>f.Ss(g,w,d,!1))),m&&(s[l+", SparseMatrix"]=r.referToSelf(d=>(g,w)=>m(w,g,d,!0)))),c&&c.signatures&&Wo(s,c.signatures),s}}),fl="mod",nv=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],pl=R(fl,nv,e=>{var{typed:r,config:n,round:t,matrix:i,equalScalar:a,zeros:o,DenseMatrix:f,concat:c}=e,u=cl({typed:r,config:n,round:t,matrix:i,equalScalar:a,zeros:o,DenseMatrix:f}),s=at({typed:r,equalScalar:a}),l=_r({typed:r}),p=qi({typed:r,equalScalar:a}),m=Ar({typed:r,equalScalar:a}),d=gr({typed:r,DenseMatrix:f}),g=sr({typed:r,matrix:i,concat:c});return r(fl,{"number, number":w,"BigNumber, BigNumber":function(v,b){return b.isZero()?v:v.sub(b.mul(u(v.div(b))))},"Fraction, Fraction":function(v,b){return b.equals(0)?v:v.sub(b.mul(u(v.div(b))))}},g({SS:p,DS:l,SD:s,Ss:m,sS:d}));function w(v,b){return b===0?v:v-b*u(v/b)}}),iv="matAlgo01xDSid",av=["typed"],qt=R(iv,av,e=>{var{typed:r}=e;return function(n,t,i,a){var o=n._data,f=n._size,c=n._datatype,u=t._values,s=t._index,l=t._ptr,p=t._size,m=t._datatype;if(f.length!==p.length)throw new He(f.length,p.length);if(f[0]!==p[0]||f[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+p+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=f[0],g=f[1],w=typeof c=="string"&&c===m?c:void 0,v=w?r.find(i,[w,w]):i,b,h,x=[];for(b=0;b<d;b++)x[b]=[];var y=[],N=[];for(h=0;h<g;h++){for(var A=h+1,E=l[h],D=l[h+1],M=E;M<D;M++)b=s[M],y[b]=a?v(u[M],o[b][h]):v(o[b][h],u[M]),N[b]=A;for(b=0;b<d;b++)N[b]===A?x[b][h]=y[b]:x[b][h]=o[b][h]}return n.createDenseMatrix({data:x,size:[d,g],datatype:w})}}),ov="matAlgo04xSidSid",sv=["typed","equalScalar"],Ka=R(ov,sv,e=>{var{typed:r,equalScalar:n}=e;return function(t,i,a){var o=t._values,f=t._index,c=t._ptr,u=t._size,s=t._datatype,l=i._values,p=i._index,m=i._ptr,d=i._size,g=i._datatype;if(u.length!==d.length)throw new He(u.length,d.length);if(u[0]!==d[0]||u[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+d+")");var w=u[0],v=u[1],b,h=n,x=0,y=a;typeof s=="string"&&s===g&&(b=s,h=r.find(n,[b,b]),x=r.convert(0,b),y=r.find(a,[b,b]));var N=o&&l?[]:void 0,A=[],E=[],D=o&&l?[]:void 0,M=o&&l?[]:void 0,S=[],B=[],I,j,_,O,C;for(j=0;j<v;j++){E[j]=A.length;var z=j+1;for(O=c[j],C=c[j+1],_=O;_<C;_++)I=f[_],A.push(I),S[I]=z,D&&(D[I]=o[_]);for(O=m[j],C=m[j+1],_=O;_<C;_++)if(I=p[_],S[I]===z){if(D){var T=y(D[I],l[_]);h(T,x)?S[I]=null:D[I]=T}}else A.push(I),B[I]=z,M&&(M[I]=l[_]);if(D&&M)for(_=E[j];_<A.length;)I=A[_],S[I]===z?(N[_]=D[I],_++):B[I]===z?(N[_]=M[I],_++):A.splice(_,1)}return E[v]=A.length,t.createSparseMatrix({values:N,index:A,ptr:E,size:[w,v],datatype:b})}}),uv="matAlgo10xSids",lv=["typed","DenseMatrix"],Kt=R(uv,lv,e=>{var{typed:r,DenseMatrix:n}=e;return function(t,i,a,o){var f=t._values,c=t._index,u=t._ptr,s=t._size,l=t._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=s[0],m=s[1],d,g=a;typeof l=="string"&&(d=l,i=r.convert(i,d),g=r.find(a,[d,d]));for(var w=[],v=[],b=[],h=0;h<m;h++){for(var x=h+1,y=u[h],N=u[h+1],A=y;A<N;A++){var E=c[A];v[E]=f[A],b[E]=x}for(var D=0;D<p;D++)h===0&&(w[D]=[]),b[D]===x?w[D][h]=o?g(i,v[D]):g(v[D],i):w[D][h]=i}return new n({data:w,size:[p,m],datatype:d})}});function Qt(e,r,n,t){if(!(this instanceof Qt))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=r,this.min=n,this.max=t,this.message="Wrong number of arguments in function "+e+" ("+r+" provided, "+n+(t!=null?"-"+t:"")+" expected)",this.stack=new Error().stack}Qt.prototype=new Error,Qt.prototype.constructor=Error,Qt.prototype.name="ArgumentsError",Qt.prototype.isArgumentsError=!0;var ml="gcd",cv=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],Qa="number | BigNumber | Fraction | Matrix | Array",fv="".concat(Qa,", ").concat(Qa,", ...").concat(Qa);function dl(e){return!e.some(r=>Array.isArray(r))}var pv=R(ml,cv,e=>{var{typed:r,matrix:n,config:t,round:i,equalScalar:a,zeros:o,BigNumber:f,DenseMatrix:c,concat:u}=e,s=pl({typed:r,config:t,round:i,matrix:n,equalScalar:a,zeros:o,DenseMatrix:c,concat:u}),l=qt({typed:r}),p=Ka({typed:r,equalScalar:a}),m=Kt({typed:r,DenseMatrix:c}),d=sr({typed:r,matrix:n,concat:u});return r(ml,{"number, number":g,"BigNumber, BigNumber":w,"Fraction, Fraction":(v,b)=>v.gcd(b)},d({SS:p,DS:l,Ss:m}),{[fv]:r.referToSelf(v=>(b,h,x)=>{for(var y=v(b,h),N=0;N<x.length;N++)y=v(y,x[N]);return y}),Array:r.referToSelf(v=>b=>{if(b.length===1&&Array.isArray(b[0])&&dl(b[0]))return v(...b[0]);if(dl(b))return v(...b);throw new Qt("gcd() supports only 1d matrices!")}),Matrix:r.referToSelf(v=>b=>v(b.toArray()))});function g(v,b){if(!Se(v)||!Se(b))throw new Error("Parameters in function gcd must be integer numbers");for(var h;b!==0;)h=s(v,b),v=b,b=h;return v<0?-v:v}function w(v,b){if(!v.isInt()||!b.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var h=new f(0);!b.isZero();){var x=s(v,b);v=b,b=x}return v.lt(h)?v.neg():v}}),mv="matAlgo06xS0S0",dv=["typed","equalScalar"],ki=R(mv,dv,e=>{var{typed:r,equalScalar:n}=e;return function(t,i,a){var o=t._values,f=t._size,c=t._datatype,u=i._values,s=i._size,l=i._datatype;if(f.length!==s.length)throw new He(f.length,s.length);if(f[0]!==s[0]||f[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+s+")");var p=f[0],m=f[1],d,g=n,w=0,v=a;typeof c=="string"&&c===l&&(d=c,g=r.find(n,[d,d]),w=r.convert(0,d),v=r.find(a,[d,d]));for(var b=o&&u?[]:void 0,h=[],x=[],y=b?[]:void 0,N=[],A=[],E=0;E<m;E++){x[E]=h.length;var D=E+1;if(Ps(t,E,N,y,A,D,h,v),Ps(i,E,N,y,A,D,h,v),y)for(var M=x[E];M<h.length;){var S=h[M];if(A[S]===D){var B=y[S];g(B,w)?h.splice(M,1):(b.push(B),M++)}else h.splice(M,1)}else for(var I=x[E];I<h.length;){var j=h[I];A[j]!==D?h.splice(I,1):I++}}return x[m]=h.length,t.createSparseMatrix({values:b,index:h,ptr:x,size:[p,m],datatype:d})}}),hl="lcm",hv=["typed","matrix","equalScalar","concat"],gv=R(hl,hv,e=>{var{typed:r,matrix:n,equalScalar:t,concat:i}=e,a=at({typed:r,equalScalar:t}),o=ki({typed:r,equalScalar:t}),f=Ar({typed:r,equalScalar:t}),c=sr({typed:r,matrix:n,concat:i}),u="number | BigNumber | Fraction | Matrix | Array",s={};return s["".concat(u,", ").concat(u,", ...").concat(u)]=r.referToSelf(p=>(m,d,g)=>{for(var w=p(m,d),v=0;v<g.length;v++)w=p(w,g[v]);return w}),r(hl,{"number, number":Ks,"BigNumber, BigNumber":l,"Fraction, Fraction":(p,m)=>p.lcm(m)},c({SS:o,DS:a,Ss:f}),s);function l(p,m){if(!p.isInt()||!m.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(p.isZero())return p;if(m.isZero())return m;for(var d=p.times(m);!m.isZero();){var g=m;m=p.mod(g),p=g}return d.div(p).abs()}}),gl="log10",vv=["typed","config","Complex"],yv=R(gl,vv,e=>{var{typed:r,config:n,Complex:t}=e;return r(gl,{number:function(i){return i>=0||n.predictable?Qs(i):new t(i,0).log().div(Math.LN10)},Complex:function(i){return new t(i).log().div(Math.LN10)},BigNumber:function(i){return!i.isNegative()||n.predictable?i.log():new t(i.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":r.referToSelf(i=>a=>$e(a,i))})}),vl="log2",xv=["typed","config","Complex"],bv=R(vl,xv,e=>{var{typed:r,config:n,Complex:t}=e;return r(vl,{number:function(a){return a>=0||n.predictable?Xs(a):i(new t(a,0))},Complex:i,BigNumber:function(a){return!a.isNegative()||n.predictable?a.log(2):i(new t(a.toNumber(),0))},"Array | Matrix":r.referToSelf(a=>o=>$e(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new t(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}}),wv="multiplyScalar",Nv=["typed"],Dv=R(wv,Nv,e=>{var{typed:r}=e;return r("multiplyScalar",{"number, number":Zs,"Complex, Complex":function(n,t){return n.mul(t)},"BigNumber, BigNumber":function(n,t){return n.times(t)},"Fraction, Fraction":function(n,t){return n.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(n,t)=>t.multiply(n),"Unit, number | Fraction | BigNumber | Complex | Unit":(n,t)=>n.multiply(t)})}),yl="multiply",Av=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Ev=R(yl,Av,e=>{var{typed:r,matrix:n,addScalar:t,multiplyScalar:i,equalScalar:a,dot:o}=e,f=Ar({typed:r,equalScalar:a}),c=it({typed:r});function u(y,N){switch(y.length){case 1:switch(N.length){case 1:if(y[0]!==N[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(y[0]!==N[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+y[0]+") must match Matrix rows ("+N[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+N.length+" dimensions)")}break;case 2:switch(N.length){case 1:if(y[1]!==N[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+y[1]+") must match Vector length ("+N[0]+")");break;case 2:if(y[1]!==N[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+y[1]+") must match Matrix B rows ("+N[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+N.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+y.length+" dimensions)")}}function s(y,N,A){if(A===0)throw new Error("Cannot multiply two empty vectors");return o(y,N)}function l(y,N){if(N.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(y,N)}function p(y,N){var A=y._data,E=y._size,D=y._datatype,M=N._data,S=N._size,B=N._datatype,I=E[0],j=S[1],_,O=t,C=i;D&&B&&D===B&&typeof D=="string"&&(_=D,O=r.find(t,[_,_]),C=r.find(i,[_,_]));for(var z=[],T=0;T<j;T++){for(var Y=C(A[0],M[0][T]),te=1;te<I;te++)Y=O(Y,C(A[te],M[te][T]));z[T]=Y}return y.createDenseMatrix({data:z,size:[j],datatype:_})}var m=r("_multiplyMatrixVector",{"DenseMatrix, any":g,"SparseMatrix, any":b}),d=r("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":w,"DenseMatrix, SparseMatrix":v,"SparseMatrix, DenseMatrix":h,"SparseMatrix, SparseMatrix":x});function g(y,N){var A=y._data,E=y._size,D=y._datatype,M=N._data,S=N._datatype,B=E[0],I=E[1],j,_=t,O=i;D&&S&&D===S&&typeof D=="string"&&(j=D,_=r.find(t,[j,j]),O=r.find(i,[j,j]));for(var C=[],z=0;z<B;z++){for(var T=A[z],Y=O(T[0],M[0]),te=1;te<I;te++)Y=_(Y,O(T[te],M[te]));C[z]=Y}return y.createDenseMatrix({data:C,size:[B],datatype:j})}function w(y,N){var A=y._data,E=y._size,D=y._datatype,M=N._data,S=N._size,B=N._datatype,I=E[0],j=E[1],_=S[1],O,C=t,z=i;D&&B&&D===B&&typeof D=="string"&&(O=D,C=r.find(t,[O,O]),z=r.find(i,[O,O]));for(var T=[],Y=0;Y<I;Y++){var te=A[Y];T[Y]=[];for(var $=0;$<_;$++){for(var q=z(te[0],M[0][$]),ne=1;ne<j;ne++)q=C(q,z(te[ne],M[ne][$]));T[Y][$]=q}}return y.createDenseMatrix({data:T,size:[I,_],datatype:O})}function v(y,N){var A=y._data,E=y._size,D=y._datatype,M=N._values,S=N._index,B=N._ptr,I=N._size,j=N._datatype;if(!M)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var _=E[0],O=I[1],C,z=t,T=i,Y=a,te=0;D&&j&&D===j&&typeof D=="string"&&(C=D,z=r.find(t,[C,C]),T=r.find(i,[C,C]),Y=r.find(a,[C,C]),te=r.convert(0,C));for(var $=[],q=[],ne=[],se=N.createSparseMatrix({values:$,index:q,ptr:ne,size:[_,O],datatype:C}),Q=0;Q<O;Q++){ne[Q]=q.length;var ee=B[Q],ue=B[Q+1];if(ue>ee)for(var X=0,ie=0;ie<_;ie++){for(var oe=ie+1,ce=void 0,ye=ee;ye<ue;ye++){var Ae=S[ye];X!==oe?(ce=T(A[ie][Ae],M[ye]),X=oe):ce=z(ce,T(A[ie][Ae],M[ye]))}X===oe&&!Y(ce,te)&&(q.push(ie),$.push(ce))}}return ne[O]=q.length,se}function b(y,N){var A=y._values,E=y._index,D=y._ptr,M=y._datatype;if(!A)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var S=N._data,B=N._datatype,I=y._size[0],j=N._size[0],_=[],O=[],C=[],z,T=t,Y=i,te=a,$=0;M&&B&&M===B&&typeof M=="string"&&(z=M,T=r.find(t,[z,z]),Y=r.find(i,[z,z]),te=r.find(a,[z,z]),$=r.convert(0,z));var q=[],ne=[];C[0]=0;for(var se=0;se<j;se++){var Q=S[se];if(!te(Q,$))for(var ee=D[se],ue=D[se+1],X=ee;X<ue;X++){var ie=E[X];ne[ie]?q[ie]=T(q[ie],Y(Q,A[X])):(ne[ie]=!0,O.push(ie),q[ie]=Y(Q,A[X]))}}for(var oe=O.length,ce=0;ce<oe;ce++){var ye=O[ce];_[ce]=q[ye]}return C[1]=O.length,y.createSparseMatrix({values:_,index:O,ptr:C,size:[I,1],datatype:z})}function h(y,N){var A=y._values,E=y._index,D=y._ptr,M=y._datatype;if(!A)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var S=N._data,B=N._datatype,I=y._size[0],j=N._size[0],_=N._size[1],O,C=t,z=i,T=a,Y=0;M&&B&&M===B&&typeof M=="string"&&(O=M,C=r.find(t,[O,O]),z=r.find(i,[O,O]),T=r.find(a,[O,O]),Y=r.convert(0,O));for(var te=[],$=[],q=[],ne=y.createSparseMatrix({values:te,index:$,ptr:q,size:[I,_],datatype:O}),se=[],Q=[],ee=0;ee<_;ee++){q[ee]=$.length;for(var ue=ee+1,X=0;X<j;X++){var ie=S[X][ee];if(!T(ie,Y))for(var oe=D[X],ce=D[X+1],ye=oe;ye<ce;ye++){var Ae=E[ye];Q[Ae]!==ue?(Q[Ae]=ue,$.push(Ae),se[Ae]=z(ie,A[ye])):se[Ae]=C(se[Ae],z(ie,A[ye]))}}for(var P=q[ee],Z=$.length,V=P;V<Z;V++){var H=$[V];te[V]=se[H]}}return q[_]=$.length,ne}function x(y,N){var A=y._values,E=y._index,D=y._ptr,M=y._datatype,S=N._values,B=N._index,I=N._ptr,j=N._datatype,_=y._size[0],O=N._size[1],C=A&&S,z,T=t,Y=i;M&&j&&M===j&&typeof M=="string"&&(z=M,T=r.find(t,[z,z]),Y=r.find(i,[z,z]));for(var te=C?[]:void 0,$=[],q=[],ne=y.createSparseMatrix({values:te,index:$,ptr:q,size:[_,O],datatype:z}),se=C?[]:void 0,Q=[],ee,ue,X,ie,oe,ce,ye,Ae,P=0;P<O;P++){q[P]=$.length;var Z=P+1;for(oe=I[P],ce=I[P+1],ie=oe;ie<ce;ie++)if(Ae=B[ie],C)for(ue=D[Ae],X=D[Ae+1],ee=ue;ee<X;ee++)ye=E[ee],Q[ye]!==Z?(Q[ye]=Z,$.push(ye),se[ye]=Y(S[ie],A[ee])):se[ye]=T(se[ye],Y(S[ie],A[ee]));else for(ue=D[Ae],X=D[Ae+1],ee=ue;ee<X;ee++)ye=E[ee],Q[ye]!==Z&&(Q[ye]=Z,$.push(ye));if(C)for(var V=q[P],H=$.length,J=V;J<H;J++){var K=$[J];te[J]=se[K]}}return q[O]=$.length,ne}return r(yl,i,{"Array, Array":r.referTo("Matrix, Matrix",y=>(N,A)=>{u(qe(N),qe(A));var E=y(n(N),n(A));return Be(E)?E.valueOf():E}),"Matrix, Matrix":function(y,N){var A=y.size(),E=N.size();return u(A,E),A.length===1?E.length===1?s(y,N,A[0]):l(y,N):E.length===1?m(y,N):d(y,N)},"Matrix, Array":r.referTo("Matrix,Matrix",y=>(N,A)=>y(N,n(A))),"Array, Matrix":r.referToSelf(y=>(N,A)=>y(n(N,A.storage()),A)),"SparseMatrix, any":function(y,N){return f(y,N,i,!1)},"DenseMatrix, any":function(y,N){return c(y,N,i,!1)},"any, SparseMatrix":function(y,N){return f(N,y,i,!0)},"any, DenseMatrix":function(y,N){return c(N,y,i,!0)},"Array, any":function(y,N){return c(n(y),N,i,!1).valueOf()},"any, Array":function(y,N){return c(n(N),y,i,!0).valueOf()},"any, any":i,"any, any, ...any":r.referToSelf(y=>(N,A,E)=>{for(var D=y(N,A),M=0;M<E.length;M++)D=y(D,E[M]);return D})})}),xl="nthRoot",Mv=["typed","matrix","equalScalar","BigNumber","concat"],Sv=R(xl,Mv,e=>{var{typed:r,matrix:n,equalScalar:t,BigNumber:i,concat:a}=e,o=qt({typed:r}),f=at({typed:r,equalScalar:t}),c=ki({typed:r,equalScalar:t}),u=Ar({typed:r,equalScalar:t}),s=sr({typed:r,matrix:n,concat:a});function l(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(xl,{number:eu,"number, number":eu,BigNumber:m=>p(m,new i(2)),"BigNumber, BigNumber":p,Complex:l,"Complex, number":l,Array:r.referTo("DenseMatrix,number",m=>d=>m(n(d),2).valueOf()),DenseMatrix:r.referTo("DenseMatrix,number",m=>d=>m(d,2)),SparseMatrix:r.referTo("SparseMatrix,number",m=>d=>m(d,2)),"SparseMatrix, SparseMatrix":r.referToSelf(m=>(d,g)=>{if(g.density()===1)return c(d,g,m);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":r.referToSelf(m=>(d,g)=>{if(g.density()===1)return o(d,g,m,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",m=>(d,g)=>m(n(d),g)),"number | BigNumber, SparseMatrix":r.referToSelf(m=>(d,g)=>{if(g.density()===1)return u(g,d,m,!0);throw new Error("Root must be non-zero")})},s({scalar:"number | BigNumber",SD:f,Ss:u,sS:!1}));function p(m,d){var g=i.precision,w=i.clone({precision:g+2}),v=new i(0),b=new w(1),h=d.isNegative();if(h&&(d=d.neg()),d.isZero())throw new Error("Root must be non-zero");if(m.isNegative()&&!d.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(m.isZero())return h?new w(1/0):0;if(!m.isFinite())return h?v:m;var x=m.abs().pow(b.div(d));return x=m.isNeg()?x.neg():x,new i((h?b.div(x):x).toPrecision(g))}}),bl="sign",Fv=["typed","BigNumber","Fraction","complex"],Cv=R(bl,Fv,e=>{var{typed:r,BigNumber:n,complex:t,Fraction:i}=e;return r(bl,{number:Za,Complex:function(a){return a.im===0?t(Za(a.re)):a.sign()},BigNumber:function(a){return new n(a.cmp(0))},Fraction:function(a){return new i(a.s,1)},"Array | Matrix":r.referToSelf(a=>o=>$e(o,a)),Unit:r.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return r.find(a,o.valueType())(o.value)})})}),Bv="sqrt",Ov=["config","typed","Complex"],Tv=R(Bv,Ov,e=>{var{config:r,typed:n,Complex:t}=e;return n("sqrt",{number:i,Complex:function(a){return a.sqrt()},BigNumber:function(a){return!a.isNegative()||r.predictable?a.sqrt():i(a.toNumber())},Unit:function(a){return a.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||r.predictable?Math.sqrt(a):new t(a,0).sqrt()}}),wl="square",_v=["typed"],Iv=R(wl,_v,e=>{var{typed:r}=e;return r(wl,{number:ru,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})}),Nl="subtract",zv=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],Rv=R(Nl,zv,e=>{var{typed:r,matrix:n,equalScalar:t,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:f}=e,c=qt({typed:r}),u=_r({typed:r}),s=qi({typed:r,equalScalar:t}),l=Kt({typed:r,DenseMatrix:o}),p=gr({typed:r,DenseMatrix:o}),m=sr({typed:r,matrix:n,concat:f});return r(Nl,{"any, any":i},m({elop:i,SS:s,DS:c,SD:u,Ss:p,sS:l}))}),Dl="xgcd",qv=["typed","config","matrix","BigNumber"],kv=R(Dl,qv,e=>{var{typed:r,config:n,matrix:t,BigNumber:i}=e;return r(Dl,{"number, number":function(o,f){var c=tu(o,f);return n.matrix==="Array"?c:t(c)},"BigNumber, BigNumber":a});function a(o,f){var c,u,s,l=new i(0),p=new i(1),m=l,d=p,g=p,w=l;if(!o.isInt()||!f.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!f.isZero();)u=o.div(f).floor(),s=o.mod(f),c=m,m=d.minus(u.times(m)),d=c,c=g,g=w.minus(u.times(g)),w=c,o=f,f=s;var v;return o.lt(l)?v=[o.neg(),d.neg(),w.neg()]:v=[o,o.isZero()?0:d,w],n.matrix==="Array"?v:t(v)}}),Al="invmod",jv=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Pv=R(Al,jv,e=>{var{typed:r,config:n,BigNumber:t,xgcd:i,equal:a,smaller:o,mod:f,add:c,isInteger:u}=e;return r(Al,{"number, number":s,"BigNumber, BigNumber":s});function s(l,p){if(!u(l)||!u(p))throw new Error("Parameters in function invmod must be integer numbers");if(l=f(l,p),a(p,0))throw new Error("Divisor must be non zero");var m=i(l,p);m=m.valueOf();var[d,g]=m;return a(d,t(1))?(g=f(g,p),o(g,t(0))&&(g=c(g,p)),g):NaN}}),Uv="matAlgo09xS0Sf",Lv=["typed","equalScalar"],El=R(Uv,Lv,e=>{var{typed:r,equalScalar:n}=e;return function(t,i,a){var o=t._values,f=t._index,c=t._ptr,u=t._size,s=t._datatype,l=i._values,p=i._index,m=i._ptr,d=i._size,g=i._datatype;if(u.length!==d.length)throw new He(u.length,d.length);if(u[0]!==d[0]||u[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+d+")");var w=u[0],v=u[1],b,h=n,x=0,y=a;typeof s=="string"&&s===g&&(b=s,h=r.find(n,[b,b]),x=r.convert(0,b),y=r.find(a,[b,b]));var N=o&&l?[]:void 0,A=[],E=[],D=N?[]:void 0,M=[],S,B,I,j,_;for(B=0;B<v;B++){E[B]=A.length;var O=B+1;if(D)for(j=m[B],_=m[B+1],I=j;I<_;I++)S=p[I],M[S]=O,D[S]=l[I];for(j=c[B],_=c[B+1],I=j;I<_;I++)if(S=f[I],D){var C=M[S]===O?D[S]:x,z=y(o[I],C);h(z,x)||(A.push(S),N.push(z))}else A.push(S)}return E[v]=A.length,t.createSparseMatrix({values:N,index:A,ptr:E,size:[w,v],datatype:b})}}),Ml="dotMultiply",Hv=["typed","matrix","equalScalar","multiplyScalar","concat"],$v=R(Ml,Hv,e=>{var{typed:r,matrix:n,equalScalar:t,multiplyScalar:i,concat:a}=e,o=at({typed:r,equalScalar:t}),f=El({typed:r,equalScalar:t}),c=Ar({typed:r,equalScalar:t}),u=sr({typed:r,matrix:n,concat:a});return r(Ml,u({elop:i,SS:f,DS:o,Ss:c}))});function Zv(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitAnd");var n=e.constructor;if(e.isNaN()||r.isNaN())return new n(NaN);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()===r.isNegative()?e:new n(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new n(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new n(0):e}return Xa(e,r,function(t,i){return t&i})}function Vn(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var r=e.constructor,n=r.precision;r.config({precision:1e9});var t=e.plus(new r(1));return t.s=-t.s||null,r.config({precision:n}),t}function Jv(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitOr");var n=e.constructor;if(e.isNaN()||r.isNaN())return new n(NaN);var t=new n(-1);return e.isZero()||r.eq(t)||e.eq(r)?r:r.isZero()||e.eq(t)?e:!e.isFinite()||!r.isFinite()?!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?t:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e:Xa(e,r,function(i,a){return i|a})}function Xa(e,r,n){var t=e.constructor,i,a,o=+(e.s<0),f=+(r.s<0);if(o){i=ji(Vn(e));for(var c=0;c<i.length;++c)i[c]^=1}else i=ji(e);if(f){a=ji(Vn(r));for(var u=0;u<a.length;++u)a[u]^=1}else a=ji(r);var s,l,p;i.length<=a.length?(s=i,l=a,p=o):(s=a,l=i,p=f);var m=s.length,d=l.length,g=n(o,f)^1,w=new t(g^1),v=new t(1),b=new t(2),h=t.precision;for(t.config({precision:1e9});m>0;)n(s[--m],l[--d])===g&&(w=w.plus(v)),v=v.times(b);for(;d>0;)n(p,l[--d])===g&&(w=w.plus(v)),v=v.times(b);return t.config({precision:h}),g===0&&(w.s=-w.s),w}function ji(e){for(var r=e.d,n=r[0]+"",t=1;t<r.length;++t){for(var i=r[t]+"",a=7-i.length;a--;)i="0"+i;n+=i}for(var o=n.length;n.charAt(o)==="0";)o--;var f=e.e,c=n.slice(0,o+1||1),u=c.length;if(f>0)if(++f>u)for(f-=u;f--;)c+="0";else f<u&&(c=c.slice(0,f)+"."+c.slice(f));for(var s=[0],l=0;l<c.length;){for(var p=s.length;p--;)s[p]*=10;s[0]+=parseInt(c.charAt(l++));for(var m=0;m<s.length;++m)s[m]>1&&((s[m+1]===null||s[m+1]===void 0)&&(s[m+1]=0),s[m+1]+=s[m]>>1,s[m]&=1)}return s.reverse()}function Wv(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitXor");var n=e.constructor;if(e.isNaN()||r.isNaN())return new n(NaN);if(e.isZero())return r;if(r.isZero())return e;if(e.eq(r))return new n(0);var t=new n(-1);return e.eq(t)?Vn(r):r.eq(t)?Vn(e):!e.isFinite()||!r.isFinite()?!e.isFinite()&&!r.isFinite()?t:new n(e.isNegative()===r.isNegative()?1/0:-1/0):Xa(e,r,function(i,a){return i^a})}function Yv(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function leftShift");var n=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new n(NaN):e.isZero()||r.isZero()?e:!e.isFinite()&&!r.isFinite()?new n(NaN):r.lt(55)?e.times(Math.pow(2,r.toNumber())+""):e.times(new n(2).pow(r))}function Gv(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function rightArithShift");var n=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new n(NaN):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new n(2).pow(r)).floor():e.isNegative()?new n(-1):e.isFinite()?new n(0):new n(NaN)}var Sl="bitAnd",Vv=["typed","matrix","equalScalar","concat"],Fl=R(Sl,Vv,e=>{var{typed:r,matrix:n,equalScalar:t,concat:i}=e,a=at({typed:r,equalScalar:t}),o=ki({typed:r,equalScalar:t}),f=Ar({typed:r,equalScalar:t}),c=sr({typed:r,matrix:n,concat:i});return r(Sl,{"number, number":au,"BigNumber, BigNumber":Zv},c({SS:o,DS:a,Ss:f}))}),Cl="bitNot",Kv=["typed"],Qv=R(Cl,Kv,e=>{var{typed:r}=e;return r(Cl,{number:ou,BigNumber:Vn,"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),Bl="bitOr",Xv=["typed","matrix","equalScalar","DenseMatrix","concat"],Ol=R(Bl,Xv,e=>{var{typed:r,matrix:n,equalScalar:t,DenseMatrix:i,concat:a}=e,o=qt({typed:r}),f=Ka({typed:r,equalScalar:t}),c=Kt({typed:r,DenseMatrix:i}),u=sr({typed:r,matrix:n,concat:a});return r(Bl,{"number, number":su,"BigNumber, BigNumber":Jv},u({SS:f,DS:o,Ss:c}))}),ey="matAlgo07xSSf",ry=["typed","DenseMatrix"],mt=R(ey,ry,e=>{var{typed:r,DenseMatrix:n}=e;return function(i,a,o){var f=i._size,c=i._datatype,u=a._size,s=a._datatype;if(f.length!==u.length)throw new He(f.length,u.length);if(f[0]!==u[0]||f[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+u+")");var l=f[0],p=f[1],m,d=0,g=o;typeof c=="string"&&c===s&&(m=c,d=r.convert(0,m),g=r.find(o,[m,m]));var w,v,b=[];for(w=0;w<l;w++)b[w]=[];var h=[],x=[],y=[],N=[];for(v=0;v<p;v++){var A=v+1;for(t(i,v,y,h,A),t(a,v,N,x,A),w=0;w<l;w++){var E=y[w]===A?h[w]:d,D=N[w]===A?x[w]:d;b[w][v]=g(E,D)}}return new n({data:b,size:[l,p],datatype:m})};function t(i,a,o,f,c){for(var u=i._values,s=i._index,l=i._ptr,p=l[a],m=l[a+1];p<m;p++){var d=s[p];o[d]=c,f[d]=u[p]}}}),Tl="bitXor",ty=["typed","matrix","DenseMatrix","concat"],ny=R(Tl,ty,e=>{var{typed:r,matrix:n,DenseMatrix:t,concat:i}=e,a=_r({typed:r}),o=mt({typed:r,DenseMatrix:t}),f=gr({typed:r,DenseMatrix:t}),c=sr({typed:r,matrix:n,concat:i});return r(Tl,{"number, number":uu,"BigNumber, BigNumber":Wv},c({SS:o,DS:a,Ss:f}))}),_l="arg",iy=["typed"],ay=R(_l,iy,e=>{var{typed:r}=e;return r(_l,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),Il="conj",oy=["typed"],sy=R(Il,oy,e=>{var{typed:r}=e;return r(Il,{"number | BigNumber | Fraction":n=>n,Complex:n=>n.conjugate(),"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),zl="im",uy=["typed"],ly=R(zl,uy,e=>{var{typed:r}=e;return r(zl,{number:()=>0,"BigNumber | Fraction":n=>n.mul(0),Complex:n=>n.im,"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),Rl="re",cy=["typed"],fy=R(Rl,cy,e=>{var{typed:r}=e;return r(Rl,{"number | BigNumber | Fraction":n=>n,Complex:n=>n.re,"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),ql="not",py=["typed"],my=R(ql,py,e=>{var{typed:r}=e;return r(ql,{"null | undefined":()=>!0,number:mu,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:r.referToSelf(n=>t=>r.find(n,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),kl="or",dy=["typed","matrix","equalScalar","DenseMatrix","concat"],jl=R(kl,dy,e=>{var{typed:r,matrix:n,equalScalar:t,DenseMatrix:i,concat:a}=e,o=_r({typed:r}),f=qi({typed:r,equalScalar:t}),c=gr({typed:r,DenseMatrix:i}),u=sr({typed:r,matrix:n,concat:a});return r(kl,{"number, number":du,"Complex, Complex":function(s,l){return s.re!==0||s.im!==0||l.re!==0||l.im!==0},"BigNumber, BigNumber":function(s,l){return!s.isZero()&&!s.isNaN()||!l.isZero()&&!l.isNaN()},"Unit, Unit":r.referToSelf(s=>(l,p)=>s(l.value||0,p.value||0))},u({SS:f,DS:o,Ss:c}))}),Pl="xor",hy=["typed","matrix","DenseMatrix","concat"],gy=R(Pl,hy,e=>{var{typed:r,matrix:n,DenseMatrix:t,concat:i}=e,a=_r({typed:r}),o=mt({typed:r,DenseMatrix:t}),f=gr({typed:r,DenseMatrix:t}),c=sr({typed:r,matrix:n,concat:i});return r(Pl,{"number, number":hu,"Complex, Complex":function(u,s){return(u.re!==0||u.im!==0)!=(s.re!==0||s.im!==0)},"BigNumber, BigNumber":function(u,s){return(!u.isZero()&&!u.isNaN())!=(!s.isZero()&&!s.isNaN())},"Unit, Unit":r.referToSelf(u=>(s,l)=>u(s.value||0,l.value||0))},c({SS:o,DS:a,Ss:f}))}),Ul="concat",vy=["typed","matrix","isInteger"],Ll=R(Ul,vy,e=>{var{typed:r,matrix:n,isInteger:t}=e;return r(Ul,{"...Array | Matrix | number | BigNumber":function(i){var a,o=i.length,f=-1,c,u=!1,s=[];for(a=0;a<o;a++){var l=i[a];if(Be(l)&&(u=!0),ke(l)||je(l)){if(a!==o-1)throw new Error("Dimension must be specified as last argument");if(c=f,f=l.valueOf(),!t(f))throw new TypeError("Integer number expected for dimension");if(f<0||a>0&&f>c)throw new et(f,c+1)}else{var p=Ie(l).valueOf(),m=qe(p);if(s[a]=p,c=f,f=m.length-1,a>0&&f!==c)throw new He(c+1,f+1)}}if(s.length===0)throw new SyntaxError("At least one matrix expected");for(var d=s.shift();s.length;)d=hs(d,s.shift(),f);return u?n(d):d},"...string":function(i){return i.join("")}})}),Hl="column",yy=["typed","Index","matrix","range"],$l=R(Hl,yy,e=>{var{typed:r,Index:n,matrix:t,range:i}=e;return r(Hl,{"Matrix, number":a,"Array, number":function(o,f){return a(t(Ie(o)),f).valueOf()}});function a(o,f){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");ir(f,o.size()[1]);var c=i(0,o.size()[0]),u=new n(c,f),s=o.subset(u);return Be(s)?s:t([[s]])}}),Zl="count",xy=["typed","size","prod"],by=R(Zl,xy,e=>{var{typed:r,size:n,prod:t}=e;return r(Zl,{string:function(i){return i.length},"Matrix | Array":function(i){return t(n(i))}})}),Jl="cross",wy=["typed","matrix","subtract","multiply"],Ny=R(Jl,wy,e=>{var{typed:r,matrix:n,subtract:t,multiply:i}=e;return r(Jl,{"Matrix, Matrix":function(o,f){return n(a(o.toArray(),f.toArray()))},"Matrix, Array":function(o,f){return n(a(o.toArray(),f))},"Array, Matrix":function(o,f){return n(a(o,f.toArray()))},"Array, Array":a});function a(o,f){var c=Math.max(qe(o).length,qe(f).length);o=vi(o),f=vi(f);var u=qe(o),s=qe(f);if(u.length!==1||s.length!==1||u[0]!==3||s[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+s.join(", ")+"])");var l=[t(i(o[1],f[2]),i(o[2],f[1])),t(i(o[2],f[0]),i(o[0],f[2])),t(i(o[0],f[1]),i(o[1],f[0]))];return c>1?[l]:l}}),Wl="diag",Dy=["typed","matrix","DenseMatrix","SparseMatrix"],Ay=R(Wl,Dy,e=>{var{typed:r,matrix:n,DenseMatrix:t,SparseMatrix:i}=e;return r(Wl,{Array:function(c){return a(c,0,qe(c),null)},"Array, number":function(c,u){return a(c,u,qe(c),null)},"Array, BigNumber":function(c,u){return a(c,u.toNumber(),qe(c),null)},"Array, string":function(c,u){return a(c,0,qe(c),u)},"Array, number, string":function(c,u,s){return a(c,u,qe(c),s)},"Array, BigNumber, string":function(c,u,s){return a(c,u.toNumber(),qe(c),s)},Matrix:function(c){return a(c,0,c.size(),c.storage())},"Matrix, number":function(c,u){return a(c,u,c.size(),c.storage())},"Matrix, BigNumber":function(c,u){return a(c,u.toNumber(),c.size(),c.storage())},"Matrix, string":function(c,u){return a(c,0,c.size(),u)},"Matrix, number, string":function(c,u,s){return a(c,u,c.size(),s)},"Matrix, BigNumber, string":function(c,u,s){return a(c,u.toNumber(),c.size(),s)}});function a(c,u,s,l){if(!Se(u))throw new TypeError("Second parameter in function diag must be an integer");var p=u>0?u:0,m=u<0?-u:0;switch(s.length){case 1:return o(c,u,l,s[0],m,p);case 2:return f(c,u,l,s,m,p)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(c,u,s,l,p,m){var d=[l+p,l+m];if(s&&s!=="sparse"&&s!=="dense")throw new TypeError("Unknown matrix type ".concat(s,'"'));var g=s==="sparse"?i.diagonal(d,c,u):t.diagonal(d,c,u);return s!==null?g:g.valueOf()}function f(c,u,s,l,p,m){if(Be(c)){var d=c.diagonal(u);return s!==null?s!==d.storage()?n(d,s):d:d.valueOf()}for(var g=Math.min(l[0]-p,l[1]-m),w=[],v=0;v<g;v++)w[v]=c[v+p][v+m];return s!==null?n(w):w}});function Sn(e,r,n,t,i){if(fn.isTypedFunction(e)){var a=[r,n,t],o=fn.resolve(e,a);if(o)return l(o.implementation,a);var f=[r,n],c=fn.resolve(e,f);if(c)return l(c.implementation,f);var u=[r],s=fn.resolve(e,u);return s?l(s.implementation,u):l(e,a)}else return e(r,n,t);function l(p,m){try{return p.apply(p,m)}catch(w){var d;if(w instanceof TypeError&&((d=w.data)===null||d===void 0?void 0:d.category)==="wrongType"){var g=[];throw g.push("value: ".concat(nr(r))),m.length>=2&&g.push("index: ".concat(nr(n))),m.length>=3&&g.push("array: ".concat(nr(t))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(e.name,"(").concat(g.join(", "),") at index ").concat(JSON.stringify(n)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(w.message))}}}var Ey="filter",My=["typed"],Sy=R(Ey,My,e=>{var{typed:r}=e;return r("filter",{"Array, function":Yl,"Matrix, function":function(n,t){return n.create(Yl(n.toArray(),t))},"Array, RegExp":xi,"Matrix, RegExp":function(n,t){return n.create(xi(n.toArray(),t))}})});function Yl(e,r){return ps(e,function(n,t,i){return Sn(r,n,[t],i,"filter")})}var Gl="flatten",Fy=["typed","matrix"],Cy=R(Gl,Fy,e=>{var{typed:r,matrix:n}=e;return r(Gl,{Array:function(t){return Ke(t)},Matrix:function(t){var i=Ke(t.toArray());return n(i)}})}),Vl="forEach",By=["typed"],Oy=R(Vl,By,e=>{var{typed:r}=e;return r(Vl,{"Array, function":Ty,"Matrix, function":function(n,t){n.forEach(t)}})});function Ty(e,r){var n=function t(i,a){if(Array.isArray(i))yi(i,function(o,f){t(o,a.concat(f))});else return Sn(r,i,a,e,"forEach")};n(e,[])}var Kl="getMatrixDataType",_y=["typed"],Iy=R(Kl,_y,e=>{var{typed:r}=e;return r(Kl,{Array:function(n){return Zn(n,nr)},Matrix:function(n){return n.getDataType()}})}),Ql="identity",zy=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Ry=R(Ql,zy,e=>{var{typed:r,config:n,matrix:t,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return r(Ql,{"":function(){return n.matrix==="Matrix"?t([]):[]},string:function(u){return t(u)},"number | BigNumber":function(u){return c(u,u,n.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(u,s){return c(u,u,s)},"number | BigNumber, number | BigNumber":function(u,s){return c(u,s,n.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(u,s,l){return c(u,s,l)},Array:function(u){return f(u)},"Array, string":function(u,s){return f(u,s)},Matrix:function(u){return f(u.valueOf(),u.storage())},"Matrix, string":function(u,s){return f(u.valueOf(),s)}});function f(u,s){switch(u.length){case 0:return s?t(s):[];case 1:return c(u[0],u[0],s);case 2:return c(u[0],u[1],s);default:throw new Error("Vector containing two values expected")}}function c(u,s,l){var p=je(u)||je(s)?i:null;if(je(u)&&(u=u.toNumber()),je(s)&&(s=s.toNumber()),!Se(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!Se(s)||s<1)throw new Error("Parameters in function identity must be positive integers");var m=p?new i(1):1,d=p?new p(0):0,g=[u,s];if(l){if(l==="sparse")return o.diagonal(g,m,0,d);if(l==="dense")return a.diagonal(g,m,0,d);throw new TypeError('Unknown matrix type "'.concat(l,'"'))}for(var w=hn([],g,d),v=u<s?u:s,b=0;b<v;b++)w[b][b]=m;return w}}),Xl="kron",qy=["typed","matrix","multiplyScalar"],ky=R(Xl,qy,e=>{var{typed:r,matrix:n,multiplyScalar:t}=e;return r(Xl,{"Matrix, Matrix":function(a,o){return n(i(a.toArray(),o.toArray()))},"Matrix, Array":function(a,o){return n(i(a.toArray(),o))},"Array, Matrix":function(a,o){return n(i(a,o.toArray()))},"Array, Array":i});function i(a,o){if(qe(a).length===1&&(a=[a]),qe(o).length===1&&(o=[o]),qe(a).length>2||qe(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var f=[],c=[];return a.map(function(u){return o.map(function(s){return c=[],f.push(c),u.map(function(l){return s.map(function(p){return c.push(t(l,p))})})})})&&f}}),ec="map",jy=["typed"],Py=R(ec,jy,e=>{var{typed:r}=e;return r(ec,{"Array, function":Uy,"Matrix, function":function(n,t){return n.map(t)}})});function Uy(e,r){var n=function t(i,a){return Array.isArray(i)?i.map(function(o,f){return t(o,a.concat(f))}):Sn(r,i,a,e,"map")};return n(e,[])}var rc="diff",Ly=["typed","matrix","subtract","number"],tc=R(rc,Ly,e=>{var{typed:r,matrix:n,subtract:t,number:i}=e;return r(rc,{"Array | Matrix":function(u){return Be(u)?n(o(u.toArray())):o(u)},"Array | Matrix, number":function(u,s){if(!Se(s))throw new RangeError("Dimension must be a whole number");return Be(u)?n(a(u.toArray(),s)):a(u,s)},"Array, BigNumber":r.referTo("Array,number",u=>(s,l)=>u(s,i(l))),"Matrix, BigNumber":r.referTo("Matrix,number",u=>(s,l)=>u(s,i(l)))});function a(u,s){if(Be(u)&&(u=u.toArray()),!Array.isArray(u))throw RangeError("Array/Matrix does not have that many dimensions");if(s>0){var l=[];return u.forEach(p=>{l.push(a(p,s-1))}),l}else{if(s===0)return o(u);throw RangeError("Cannot have negative dimension")}}function o(u){for(var s=[],l=u.length,p=1;p<l;p++)s.push(f(u[p-1],u[p]));return s}function f(u,s){Be(u)&&(u=u.toArray()),Be(s)&&(s=s.toArray());var l=Array.isArray(u),p=Array.isArray(s);if(l&&p)return c(u,s);if(!l&&!p)return t(s,u);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function c(u,s){if(u.length!==s.length)throw RangeError("Not all sub-arrays have the same length");for(var l=[],p=u.length,m=0;m<p;m++)l.push(f(u[m],s[m]));return l}}),Hy="ones",$y=["typed","config","matrix","BigNumber"],Zy=R(Hy,$y,e=>{var{typed:r,config:n,matrix:t,BigNumber:i}=e;return r("ones",{"":function(){return n.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(c){var u=c[c.length-1];if(typeof u=="string"){var s=c.pop();return a(c,s)}else return n.matrix==="Array"?a(c):a(c,"default")},Array:a,Matrix:function(c){var u=c.storage();return a(c.valueOf(),u)},"Array | Matrix, string":function(c,u){return a(c.valueOf(),u)}});function a(c,u){var s=o(c),l=s?new i(1):1;if(f(c),u){var p=t(u);return c.length>0?p.resize(c,l):p}else{var m=[];return c.length>0?hn(m,c,l):m}}function o(c){var u=!1;return c.forEach(function(s,l,p){je(s)&&(u=!0,p[l]=s.toNumber())}),u}function f(c){c.forEach(function(u){if(typeof u!="number"||!Se(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function eo(){throw new Error('No "bignumber" implementation available')}function nc(){throw new Error('No "fraction" implementation available')}function ic(){throw new Error('No "matrix" implementation available')}var ac="range",Jy=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],oc=R(ac,Jy,e=>{var{typed:r,config:n,matrix:t,bignumber:i,smaller:a,smallerEq:o,larger:f,largerEq:c,add:u,isPositive:s}=e;return r(ac,{string:p,"string, boolean":p,"number, number":function(g,w){return l(m(g,w,1,!1))},"number, number, number":function(g,w,v){return l(m(g,w,v,!1))},"number, number, boolean":function(g,w,v){return l(m(g,w,1,v))},"number, number, number, boolean":function(g,w,v,b){return l(m(g,w,v,b))},"BigNumber, BigNumber":function(g,w){var v=g.constructor;return l(m(g,w,new v(1),!1))},"BigNumber, BigNumber, BigNumber":function(g,w,v){return l(m(g,w,v,!1))},"BigNumber, BigNumber, boolean":function(g,w,v){var b=g.constructor;return l(m(g,w,new b(1),v))},"BigNumber, BigNumber, BigNumber, boolean":function(g,w,v,b){return l(m(g,w,v,b))},"Unit, Unit, Unit":function(g,w,v){return l(m(g,w,v,!1))},"Unit, Unit, Unit, boolean":function(g,w,v,b){return l(m(g,w,v,b))}});function l(g){return n.matrix==="Matrix"?t?t(g):ic():g}function p(g,w){var v=d(g);if(!v)throw new SyntaxError('String "'+g+'" is no valid range');return n.number==="BigNumber"?(i===void 0&&eo(),l(m(i(v.start),i(v.end),i(v.step)))):l(m(v.start,v.end,v.step,w))}function m(g,w,v,b){for(var h=[],x=s(v)?b?o:a:b?c:f,y=g;x(y,w);)h.push(y),y=u(y,v);return h}function d(g){var w=g.split(":"),v=w.map(function(h){return Number(h)}),b=v.some(function(h){return isNaN(h)});if(b)return null;switch(v.length){case 2:return{start:v[0],end:v[1],step:1};case 3:return{start:v[0],end:v[2],step:v[1]};default:return null}}}),sc="reshape",Wy=["typed","isInteger","matrix"],Yy=R(sc,Wy,e=>{var{typed:r,isInteger:n}=e;return r(sc,{"Matrix, Array":function(t,i){return t.reshape(i,!0)},"Array, Array":function(t,i){return i.forEach(function(a){if(!n(a))throw new TypeError("Invalid size for dimension: "+a)}),Ta(t,i)}})}),Gy="resize",Vy=["config","matrix"],Ky=R(Gy,Vy,e=>{var{config:r,matrix:n}=e;return function(i,a,o){if(arguments.length!==2&&arguments.length!==3)throw new Qt("resize",arguments.length,2,3);if(Be(a)&&(a=a.valueOf()),je(a[0])&&(a=a.map(function(u){return je(u)?u.toNumber():u})),Be(i))return i.resize(a,o,!0);if(typeof i=="string")return t(i,a,o);var f=Array.isArray(i)?!1:r.matrix!=="Array";if(a.length===0){for(;Array.isArray(i);)i=i[0];return Ie(i)}else{Array.isArray(i)||(i=[i]),i=Ie(i);var c=hn(i,a,o);return f?n(c):c}};function t(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new He(a.length,1);var f=a[0];if(typeof f!="number"||!Se(f))throw new TypeError("Invalid size, must contain positive integers (size: "+Le(a)+")");if(i.length>f)return i.substring(0,f);if(i.length<f){for(var c=i,u=0,s=f-i.length;u<s;u++)c+=o;return c}else return i}}),uc="rotate",Qy=["typed","multiply","rotationMatrix"],Xy=R(uc,Qy,e=>{var{typed:r,multiply:n,rotationMatrix:t}=e;return r(uc,{"Array , number | BigNumber | Complex | Unit":function(a,o){i(a,2);var f=n(t(o),a);return f.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(a,o){return i(a,2),n(t(o),a)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(a,o,f){i(a,3);var c=n(t(o,f),a);return c},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(a,o,f){return i(a,3),n(t(o,f),a)}});function i(a,o){var f=Array.isArray(a)?qe(a):a.size();if(f.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(f.length===2&&f[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(f[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}}),lc="rotationMatrix",ex=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],rx=R(lc,ex,e=>{var{typed:r,config:n,multiplyScalar:t,addScalar:i,unaryMinus:a,norm:o,BigNumber:f,matrix:c,DenseMatrix:u,SparseMatrix:s,cos:l,sin:p}=e;return r(lc,{"":function(){return n.matrix==="Matrix"?c([]):[]},string:function(b){return c(b)},"number | BigNumber | Complex | Unit":function(b){return m(b,n.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(b,h){return m(b,h)},"number | BigNumber | Complex | Unit, Array":function(b,h){var x=c(h);return d(x),v(b,x,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(b,h){d(h);var x=h.storage()||(n.matrix==="Matrix"?"dense":void 0);return v(b,h,x)},"number | BigNumber | Complex | Unit, Array, string":function(b,h,x){var y=c(h);return d(y),v(b,y,x)},"number | BigNumber | Complex | Unit, Matrix, string":function(b,h,x){return d(h),v(b,h,x)}});function m(b,h){var x=je(b),y=x?new f(-1):-1,N=l(b),A=p(b),E=[[N,t(y,A)],[A,N]];return w(E,h)}function d(b){var h=b.size();if(h.length<1||h[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function g(b){return b.reduce((h,x)=>t(h,x))}function w(b,h){if(h){if(h==="sparse")return new s(b);if(h==="dense")return new u(b);throw new TypeError('Unknown matrix type "'.concat(h,'"'))}return b}function v(b,h,x){var y=o(h);if(y===0)throw new RangeError("Rotation around zero vector");var N=je(b)?f:null,A=N?new N(1):1,E=N?new N(-1):-1,D=N?new N(h.get([0])/y):h.get([0])/y,M=N?new N(h.get([1])/y):h.get([1])/y,S=N?new N(h.get([2])/y):h.get([2])/y,B=l(b),I=i(A,a(B)),j=p(b),_=i(B,g([D,D,I])),O=i(g([D,M,I]),g([E,S,j])),C=i(g([D,S,I]),g([M,j])),z=i(g([D,M,I]),g([S,j])),T=i(B,g([M,M,I])),Y=i(g([M,S,I]),g([E,D,j])),te=i(g([D,S,I]),g([E,M,j])),$=i(g([M,S,I]),g([D,j])),q=i(B,g([S,S,I])),ne=[[_,O,C],[z,T,Y],[te,$,q]];return w(ne,x)}}),cc="row",tx=["typed","Index","matrix","range"],fc=R(cc,tx,e=>{var{typed:r,Index:n,matrix:t,range:i}=e;return r(cc,{"Matrix, number":a,"Array, number":function(o,f){return a(t(Ie(o)),f).valueOf()}});function a(o,f){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");ir(f,o.size()[0]);var c=i(0,o.size()[1]),u=new n(f,c),s=o.subset(u);return Be(s)?s:t([[s]])}}),pc="size",nx=["typed","config","?matrix"],ix=R(pc,nx,e=>{var{typed:r,config:n,matrix:t}=e;return r(pc,{Matrix:function(i){return i.create(i.size())},Array:qe,string:function(i){return n.matrix==="Array"?[i.length]:t([i.length])},"number | Complex | BigNumber | Unit | boolean | null":function(i){return n.matrix==="Array"?[]:t?t([]):ic()}})}),mc="squeeze",ax=["typed","matrix"],ox=R(mc,ax,e=>{var{typed:r,matrix:n}=e;return r(mc,{Array:function(t){return vi(Ie(t))},Matrix:function(t){var i=vi(t.toArray());return Array.isArray(i)?n(i):i},any:function(t){return Ie(t)}})}),dc="subset",sx=["typed","matrix","zeros","add"],hc=R(dc,sx,e=>{var{typed:r,matrix:n,zeros:t,add:i}=e;return r(dc,{"Matrix, Index":function(o,f){return dn(f)?n():(gi(o,f),o.subset(f))},"Array, Index":r.referTo("Matrix, Index",function(o){return function(f,c){var u=o(n(f),c);return c.isScalar()?u:u.valueOf()}}),"Object, Index":lx,"string, Index":ux,"Matrix, Index, any, any":function(o,f,c,u){return dn(f)?o:(gi(o,f),o.clone().subset(f,a(c,f),u))},"Array, Index, any, any":r.referTo("Matrix, Index, any, any",function(o){return function(f,c,u,s){var l=o(n(f),c,u,s);return l.isMatrix?l.valueOf():l}}),"Array, Index, any":r.referTo("Matrix, Index, any, any",function(o){return function(f,c,u){return o(n(f),c,u,void 0).valueOf()}}),"Matrix, Index, any":r.referTo("Matrix, Index, any, any",function(o){return function(f,c,u){return o(f,c,u,void 0)}}),"string, Index, string":gc,"string, Index, string, string":gc,"Object, Index, any":cx});function a(o,f){if(typeof o=="string")throw new Error("can't boradcast a string");if(f._isScalar)return o;var c=f.size();if(c.every(u=>u>0))try{return i(o,t(c))}catch{return o}else return o}});function ux(e,r){if(!pi(r))throw new TypeError("Index expected");if(dn(r))return"";if(gi(Array.from(e),r),r.size().length!==1)throw new He(r.size().length,1);var n=e.length;ir(r.min()[0],n),ir(r.max()[0],n);var t=r.dimension(0),i="";return t.forEach(function(a){i+=e.charAt(a)}),i}function gc(e,r,n,t){if(!r||r.isIndex!==!0)throw new TypeError("Index expected");if(dn(r))return e;if(gi(Array.from(e),r),r.size().length!==1)throw new He(r.size().length,1);if(t!==void 0){if(typeof t!="string"||t.length!==1)throw new TypeError("Single character expected as defaultValue")}else t=" ";var i=r.dimension(0),a=i.size()[0];if(a!==n.length)throw new He(i.size()[0],n.length);var o=e.length;ir(r.min()[0]),ir(r.max()[0]);for(var f=[],c=0;c<o;c++)f[c]=e.charAt(c);if(i.forEach(function(l,p){f[l]=n.charAt(p[0])}),f.length>o)for(var u=o-1,s=f.length;u<s;u++)f[u]||(f[u]=t);return f.join("")}function lx(e,r){if(!dn(r)){if(r.size().length!==1)throw new He(r.size(),1);var n=r.dimension(0);if(typeof n!="string")throw new TypeError("String expected as index to retrieve an object property");return Tr(e,n)}}function cx(e,r,n){if(dn(r))return e;if(r.size().length!==1)throw new He(r.size(),1);var t=r.dimension(0);if(typeof t!="string")throw new TypeError("String expected as index to retrieve an object property");var i=Ie(e);return vn(i,t,n),i}var vc="transpose",fx=["typed","matrix"],px=R(vc,fx,e=>{var{typed:r,matrix:n}=e;return r(vc,{Array:o=>t(n(o)).valueOf(),Matrix:t,any:Ie});function t(o){var f=o.size(),c;switch(f.length){case 1:c=o.clone();break;case 2:{var u=f[0],s=f[1];if(s===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Le(f)+")");switch(o.storage()){case"dense":c=i(o,u,s);break;case"sparse":c=a(o,u,s);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Le(f)+")")}return c}function i(o,f,c){for(var u=o._data,s=[],l,p=0;p<c;p++){l=s[p]=[];for(var m=0;m<f;m++)l[m]=Ie(u[m][p])}return o.createDenseMatrix({data:s,size:[c,f],datatype:o._datatype})}function a(o,f,c){for(var u=o._values,s=o._index,l=o._ptr,p=u?[]:void 0,m=[],d=[],g=[],w=0;w<f;w++)g[w]=0;var v,b,h;for(v=0,b=s.length;v<b;v++)g[s[v]]++;for(var x=0,y=0;y<f;y++)d.push(x),x+=g[y],g[y]=d[y];for(d.push(x),h=0;h<c;h++)for(var N=l[h],A=l[h+1],E=N;E<A;E++){var D=g[s[E]]++;m[D]=h,u&&(p[D]=Ie(u[E]))}return o.createSparseMatrix({values:p,index:m,ptr:d,size:[c,f],datatype:o._datatype})}}),yc="ctranspose",mx=["typed","transpose","conj"],dx=R(yc,mx,e=>{var{typed:r,transpose:n,conj:t}=e;return r(yc,{any:function(i){return t(n(i))}})}),xc="zeros",hx=["typed","config","matrix","BigNumber"],gx=R(xc,hx,e=>{var{typed:r,config:n,matrix:t,BigNumber:i}=e;return r(xc,{"":function(){return n.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(c){var u=c[c.length-1];if(typeof u=="string"){var s=c.pop();return a(c,s)}else return n.matrix==="Array"?a(c):a(c,"default")},Array:a,Matrix:function(c){var u=c.storage();return a(c.valueOf(),u)},"Array | Matrix, string":function(c,u){return a(c.valueOf(),u)}});function a(c,u){var s=o(c),l=s?new i(0):0;if(f(c),u){var p=t(u);return c.length>0?p.resize(c,l):p}else{var m=[];return c.length>0?hn(m,c,l):m}}function o(c){var u=!1;return c.forEach(function(s,l,p){je(s)&&(u=!0,p[l]=s.toNumber())}),u}function f(c){c.forEach(function(u){if(typeof u!="number"||!Se(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}}),bc="fft",vx=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],yx=R(bc,vx,e=>{var{typed:r,matrix:n,addScalar:t,multiplyScalar:i,divideScalar:a,exp:o,tau:f,i:c,dotDivide:u,conj:s,pow:l,ceil:p,log2:m}=e;return r(bc,{Array:d,Matrix:function(b){return b.create(d(b.toArray()))}});function d(b){var h=qe(b);return h.length===1?v(b,h[0]):g(b.map(x=>d(x,h.slice(1))),0)}function g(b,h){var x=qe(b);if(h!==0)return new Array(x[0]).fill(0).map((N,A)=>g(b[A],h-1));if(x.length===1)return v(b);function y(N){var A=qe(N);return new Array(A[1]).fill(0).map((E,D)=>new Array(A[0]).fill(0).map((M,S)=>N[S][D]))}return y(g(y(b),1))}function w(b){for(var h=b.length,x=o(a(i(-1,i(c,f)),h)),y=[],N=1-h;N<h;N++)y.push(l(x,a(l(N,2),2)));for(var A=l(2,p(m(h+h-1))),E=[...new Array(h).fill(0).map((O,C)=>i(b[C],y[h-1+C])),...new Array(A-h).fill(0)],D=[...new Array(h+h-1).fill(0).map((O,C)=>a(1,y[C])),...new Array(A-(h+h-1)).fill(0)],M=v(E),S=v(D),B=new Array(A).fill(0).map((O,C)=>i(M[C],S[C])),I=u(s(d(s(B))),A),j=[],_=h-1;_<h+h-1;_++)j.push(i(I[_],y[_]));return j}function v(b){var h=b.length;if(h===1)return[b[0]];if(h%2===0){for(var x=[...v(b.filter((E,D)=>D%2===0)),...v(b.filter((E,D)=>D%2===1))],y=0;y<h/2;y++){var N=x[y],A=i(x[y+h/2],o(i(i(f,c),a(-y,h))));x[y]=t(N,A),x[y+h/2]=t(N,i(-1,A))}return x}else return w(b)}}),wc="ifft",xx=["typed","fft","dotDivide","conj"],bx=R(wc,xx,e=>{var{typed:r,fft:n,dotDivide:t,conj:i}=e;return r(wc,{"Array | Matrix":function(a){var o=Be(a)?a.size():qe(a);return t(i(n(i(a))),o.reduce((f,c)=>f*c,1))}})});function Kn(e){"@babel/helpers - typeof";return Kn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Kn(e)}function wx(e,r){if(Kn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var t=n.call(e,r||"default");if(Kn(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Nx(e){var r=wx(e,"string");return Kn(r)=="symbol"?r:String(r)}function vr(e,r,n){return r=Nx(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Nc(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,t)}return n}function Dx(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Nc(Object(n),!0).forEach(function(t){vr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ax="solveODE",Ex=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],Mx=R(Ax,Ex,e=>{var{typed:r,add:n,subtract:t,multiply:i,divide:a,max:o,map:f,abs:c,isPositive:u,isNegative:s,larger:l,smaller:p,matrix:m,bignumber:d,unaryMinus:g}=e;function w(E){return function(D,M,S,B){var I=!(M.length===2&&(M.every(N)||M.every(Jr)));if(I)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var j=M[0],_=M[1],O=l(_,j),C=B.firstStep;if(C!==void 0&&!u(C))throw new Error('"firstStep" must be positive');var z=B.maxStep;if(z!==void 0&&!u(z))throw new Error('"maxStep" must be positive');var T=B.minStep;if(T&&s(T))throw new Error('"minStep" must be positive or zero');var Y=[j,_,C,T,z].filter(k=>k!==void 0);if(!(Y.every(N)||Y.every(Jr)))throw new Error('Inconsistent type of "t" dependant variables');for(var te=1,$=B.tol?B.tol:1e-4,q=B.minDelta?B.minDelta:.2,ne=B.maxDelta?B.maxDelta:5,se=B.maxIter?B.maxIter:1e4,Q=[j,_,...S,z,T].some(je),[ee,ue,X,ie]=Q?[d(E.a),d(E.c),d(E.b),d(E.bp)]:[E.a,E.c,E.b,E.bp],oe=C?O?C:g(C):a(t(_,j),te),ce=[j],ye=[S],Ae=t(X,ie),P=0,Z=0,V=x(O),H=y(O);V(ce[P],_);){var J=[];oe=H(ce[P],_,oe),J.push(D(ce[P],ye[P]));for(var K=1;K<ue.length;++K)J.push(D(n(ce[P],i(ue[K],oe)),n(ye[P],i(oe,ee[K],J))));var fe=o(c(f(i(Ae,J),k=>Jr(k)?k.value:k)));fe<$&&$/fe>1/4&&(ce.push(n(ce[P],oe)),ye.push(n(ye[P],i(oe,X,J))),P++);var pe=.84*($/fe)**(1/5);if(p(pe,q)?pe=q:l(pe,ne)&&(pe=ne),pe=Q?d(pe):pe,oe=i(oe,pe),z&&l(c(oe),z)?oe=O?z:g(z):T&&p(c(oe),T)&&(oe=O?T:g(T)),Z++,Z>se)throw new Error("Maximum number of iterations reached, try changing options")}return{t:ce,y:ye}}}function v(E,D,M,S){var B=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],I=[null,1/2,3/4,1],j=[2/9,1/3,4/9,0],_=[7/24,1/4,1/3,1/8],O={a:B,c:I,b:j,bp:_};return w(O)(E,D,M,S)}function b(E,D,M,S){var B=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],I=[null,1/5,3/10,4/5,8/9,1,1],j=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],_=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],O={a:B,c:I,b:j,bp:_};return w(O)(E,D,M,S)}function h(E,D,M,S){var B=S.method?S.method:"RK45",I={RK23:v,RK45:b};if(B.toUpperCase()in I){var j=Dx({},S);return delete j.method,I[B.toUpperCase()](E,D,M,j)}else{var _=Object.keys(I).map(C=>'"'.concat(C,'"')),O="".concat(_.slice(0,-1).join(", ")," and ").concat(_.slice(-1));throw new Error('Unavailable method "'.concat(B,'". Available methods are ').concat(O))}}function x(E){return E?p:l}function y(E){var D=E?l:p;return function(M,S,B){var I=n(M,B);return D(I,S)?t(S,M):B}}function N(E){return je(E)||ke(E)}function A(E,D,M,S){var B=h(E,D.toArray(),M.toArray(),S);return{t:m(B.t),y:m(B.y)}}return r("solveODE",{"function, Array, Array, Object":h,"function, Matrix, Matrix, Object":A,"function, Array, Array":(E,D,M)=>h(E,D,M,{}),"function, Matrix, Matrix":(E,D,M)=>A(E,D,M,{}),"function, Array, number | BigNumber | Unit":(E,D,M)=>{var S=h(E,D,[M],{});return{t:S.t,y:S.y.map(B=>B[0])}},"function, Matrix, number | BigNumber | Unit":(E,D,M)=>{var S=h(E,D.toArray(),[M],{});return{t:m(S.t),y:m(S.y.map(B=>B[0]))}},"function, Array, number | BigNumber | Unit, Object":(E,D,M,S)=>{var B=h(E,D,[M],S);return{t:B.t,y:B.y.map(I=>I[0])}},"function, Matrix, number | BigNumber | Unit, Object":(E,D,M,S)=>{var B=h(E,D.toArray(),[M],S);return{t:m(B.t),y:m(B.y.map(I=>I[0]))}}})}),Sx="erf",Fx=["typed"],Cx=R(Sx,Fx,e=>{var{typed:r}=e;return r("name",{number:function(a){var o=Math.abs(a);return o>=Tx?Ot(a):o<=Bx?Ot(a)*n(o):o<=4?Ot(a)*(1-t(o)):Ot(a)*(1-i(o))},"Array | Matrix":r.referToSelf(a=>o=>$e(o,a))});function n(a){var o=a*a,f=Et[0][4]*o,c=o,u;for(u=0;u<3;u+=1)f=(f+Et[0][u])*o,c=(c+Fn[0][u])*o;return a*(f+Et[0][3])/(c+Fn[0][3])}function t(a){var o=Et[1][8]*a,f=a,c;for(c=0;c<7;c+=1)o=(o+Et[1][c])*a,f=(f+Fn[1][c])*a;var u=(o+Et[1][7])/(f+Fn[1][7]),s=parseInt(a*16)/16,l=(a-s)*(a+s);return Math.exp(-s*s)*Math.exp(-l)*u}function i(a){var o=1/(a*a),f=Et[2][5]*o,c=o,u;for(u=0;u<4;u+=1)f=(f+Et[2][u])*o,c=(c+Fn[2][u])*o;var s=o*(f+Et[2][4])/(c+Fn[2][4]);s=(Ox-s)/a,o=parseInt(a*16)/16;var l=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-l)*s}}),Bx=.46875,Ox=.5641895835477563,Et=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Fn=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],Tx=Math.pow(2,53),Dc="zeta",_x=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],Ix=R(Dc,_x,e=>{var{typed:r,config:n,multiply:t,pow:i,divide:a,factorial:o,equal:f,smallerEq:c,isNegative:u,gamma:s,sin:l,subtract:p,add:m,Complex:d,BigNumber:g,pi:w}=e;return r(Dc,{number:N=>v(N,A=>A,()=>20),BigNumber:N=>v(N,A=>new g(A),()=>Math.abs(Math.log10(n.epsilon))),Complex:b});function v(N,A,E){return f(N,0)?A(-.5):f(N,1)?A(NaN):isFinite(N)?h(N,A,E,D=>D):u(N)?A(NaN):A(1)}function b(N){return N.re===0&&N.im===0?new d(-.5):N.re===1?new d(NaN,NaN):N.re===1/0&&N.im===0?new d(1):N.im===1/0||N.re===-1/0?new d(NaN,NaN):h(N,A=>A,A=>Math.round(1.3*15+.9*Math.abs(A.im)),A=>A.re)}function h(N,A,E,D){var M=E(N);if(D(N)>-(M-1)/2)return y(N,A(M),A);var S=t(i(2,N),i(A(w),p(N,1)));return S=t(S,l(t(a(A(w),2),N))),S=t(S,s(p(1,N))),t(S,h(p(1,N),A,E,D))}function x(N,A){for(var E=N,D=N;c(D,A);D=m(D,1)){var M=a(t(o(m(A,p(D,1))),i(4,D)),t(o(p(A,D)),o(t(2,D))));E=m(E,M)}return t(A,E)}function y(N,A,E){for(var D=a(1,t(x(E(0),A),p(1,i(2,p(1,N))))),M=E(0),S=E(1);c(S,A);S=m(S,1))M=m(M,a(t((-1)**(S-1),x(S,A)),i(S,N)));return t(D,M)}}),Ac="mode",zx=["typed","isNaN","isNumeric"],Rx=R(Ac,zx,e=>{var{typed:r,isNaN:n,isNumeric:t}=e;return r(Ac,{"Array | Matrix":i,"...":function(a){return i(a)}});function i(a){a=Ke(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var f={},c=[],u=0,s=0;s<a.length;s++){var l=a[s];if(t(l)&&n(l))throw new Error("Cannot calculate mode of an array containing NaN values");l in f||(f[l]=0),f[l]++,f[l]===u?c.push(l):f[l]>u&&(u=f[l],c=[l])}return c}});function Ir(e,r,n){var t;return String(e).indexOf("Unexpected type")!==-1?(t=arguments.length>2?" (type: "+nr(n)+", value: "+JSON.stringify(n)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+r+", unexpected type of argument"+t)):String(e).indexOf("complex numbers")!==-1?(t=arguments.length>2?" (type: "+nr(n)+", value: "+JSON.stringify(n)+")":"",new TypeError("Cannot calculate "+r+", no ordering relation is defined for complex numbers"+t)):e}var Ec="prod",qx=["typed","config","multiplyScalar","numeric"],kx=R(Ec,qx,e=>{var{typed:r,config:n,multiplyScalar:t,numeric:i}=e;return r(Ec,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(o,f){throw new Error("prod(A, dim) is not yet supported")},"...":function(o){return a(o)}});function a(o){var f;if(Dt(o,function(c){try{f=f===void 0?c:t(f,c)}catch(u){throw Ir(u,"prod",c)}}),typeof f=="string"&&(f=i(f,n.number)),f===void 0)throw new Error("Cannot calculate prod of an empty array");return f}}),Mc="format",jx=["typed"],Px=R(Mc,jx,e=>{var{typed:r}=e;return r(Mc,{any:Le,"any, Object | function | number | BigNumber":Le})}),Sc="bin",Ux=["typed","format"],Lx=R(Sc,Ux,e=>{var{typed:r,format:n}=e;return r(Sc,{"number | BigNumber":function(t){return n(t,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(t,i){return n(t,{notation:"bin",wordSize:i})}})}),Fc="oct",Hx=["typed","format"],$x=R(Fc,Hx,e=>{var{typed:r,format:n}=e;return r(Fc,{"number | BigNumber":function(t){return n(t,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(t,i){return n(t,{notation:"oct",wordSize:i})}})}),Cc="hex",Zx=["typed","format"],Jx=R(Cc,Zx,e=>{var{typed:r,format:n}=e;return r(Cc,{"number | BigNumber":function(t){return n(t,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(t,i){return n(t,{notation:"hex",wordSize:i})}})}),Bc=/\$([\w.]+)/g,Oc="print",Wx=["typed"],Tc=R(Oc,Wx,e=>{var{typed:r}=e;return r(Oc,{"string, Object | Array":_c,"string, Object | Array, number | Object":_c})});function _c(e,r,n){return e.replace(Bc,function(t,i){var a=i.split("."),o=r[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var f=a.shift();o=f?o[f]:o+"."}return o!==void 0?Sr(o)?o:Le(o,n):t})}var Ic="to",Yx=["typed","matrix","concat"],Gx=R(Ic,Yx,e=>{var{typed:r,matrix:n,concat:t}=e,i=sr({typed:r,matrix:n,concat:t});return r(Ic,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))}),zc="isPrime",Vx=["typed"],Kx=R(zc,Vx,e=>{var{typed:r}=e;return r(zc,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var t=5;t*t<=n;t+=6)if(n%t===0||n%(t+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var t=n.toNumber(),i=5;i*i<=t;i+=6)if(t%i===0||t%(i+2)===0)return!1;return!0}function a(v,b,h){for(var x=1;!b.eq(0);)b.mod(2).eq(0)?(b=b.div(2),v=v.mul(v).mod(h)):(b=b.sub(1),x=v.mul(x).mod(h));return x}var o=n.constructor.clone({precision:n.toFixed(0).length*2});n=new o(n);for(var f=0,c=n.sub(1);c.mod(2).eq(0);)c=c.div(2),f+=1;var u=null;if(n.lt("3317044064679887385961981"))u=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(v=>v<n);else{var s=Math.min(n.toNumber()-2,Math.floor(2*Math.pow(n.toFixed(0).length*Math.log(10),2)));u=[];for(var l=2;l<=s;l+=1)u.push(s)}for(var p=0;p<u.length;p+=1){var m=u[p],d=a(n.sub(n).add(m),c,n);if(!d.eq(1)){for(var g=0,w=d;!w.eq(n.sub(1));g+=1,w=w.mul(w).mod(n))if(g===f-1)return!1}}return!0},"Array | Matrix":r.referToSelf(n=>t=>$e(t,n))})}),Qx="numeric",Xx=["number","?bignumber","?fraction"],eb=R(Qx,Xx,e=>{var{number:r,bignumber:n,fraction:t}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>r(o),BigNumber:n?o=>n(o):eo,Fraction:t?o=>t(o):nc};return function(o){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",c=arguments.length>2?arguments[2]:void 0;if(c!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var u=nr(o);if(!(u in i))throw new TypeError("Cannot convert "+o+' of type "'+u+'"; valid input types are '+Object.keys(i).join(", "));if(!(f in a))throw new TypeError("Cannot convert "+o+' to type "'+f+'"; valid output types are '+Object.keys(a).join(", "));return f===u?o:a[f](o)}}),Rc="divideScalar",rb=["typed","numeric"],tb=R(Rc,rb,e=>{var{typed:r,numeric:n}=e;return r(Rc,{"number, number":function(t,i){return t/i},"Complex, Complex":function(t,i){return t.div(i)},"BigNumber, BigNumber":function(t,i){return t.div(i)},"Fraction, Fraction":function(t,i){return t.div(i)},"Unit, number | Complex | Fraction | BigNumber | Unit":(t,i)=>t.divide(i),"number | Fraction | Complex | BigNumber, Unit":(t,i)=>i.divideInto(t)})}),qc="pow",nb=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],ib=R(qc,nb,e=>{var{typed:r,config:n,identity:t,multiply:i,matrix:a,inv:o,number:f,fraction:c,Complex:u}=e;return r(qc,{"number, number":s,"Complex, Complex":function(m,d){return m.pow(d)},"BigNumber, BigNumber":function(m,d){return d.isInteger()||m>=0||n.predictable?m.pow(d):new u(m.toNumber(),0).pow(d.toNumber(),0)},"Fraction, Fraction":function(m,d){var g=m.pow(d);if(g!=null)return g;if(n.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return s(m.valueOf(),d.valueOf())},"Array, number":l,"Array, BigNumber":function(m,d){return l(m,d.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(m,d){return p(m,d.toNumber())},"Unit, number | BigNumber":function(m,d){return m.pow(d)}});function s(m,d){if(n.predictable&&!Se(d)&&m<0)try{var g=c(d),w=f(g);if((d===w||Math.abs((d-w)/d)<1e-14)&&g.d%2===1)return(g.n%2===0?1:-1)*Math.pow(-m,d)}catch{}return n.predictable&&(m<-1&&d===1/0||m>-1&&m<0&&d===-1/0)?NaN:Se(d)||m>=0||n.predictable?nu(m,d):m*m<1&&d===1/0||m*m>1&&d===-1/0?0:new u(m,0).pow(d,0)}function l(m,d){if(!Se(d))throw new TypeError("For A^b, b must be an integer (value is "+d+")");var g=qe(m);if(g.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+g.length+" dimensions)");if(g[0]!==g[1])throw new Error("For A^b, A must be square (size is "+g[0]+"x"+g[1]+")");if(d<0)try{return l(o(m),-d)}catch(b){throw b.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+d+")"):b}for(var w=t(g[0]).valueOf(),v=m;d>=1;)(d&1)===1&&(w=i(v,w)),d>>=1,v=i(v,v);return w}function p(m,d){return a(l(m.valueOf(),d))}}),Cn="Number of decimals in function round must be an integer",kc="round",ab=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],ob=R(kc,ab,e=>{var{typed:r,matrix:n,equalScalar:t,zeros:i,BigNumber:a,DenseMatrix:o}=e,f=Ar({typed:r,equalScalar:t}),c=gr({typed:r,DenseMatrix:o}),u=it({typed:r});return r(kc,{number:iu,"number, number":iu,"number, BigNumber":function(s,l){if(!l.isInteger())throw new TypeError(Cn);return new a(s).toDecimalPlaces(l.toNumber())},Complex:function(s){return s.round()},"Complex, number":function(s,l){if(l%1)throw new TypeError(Cn);return s.round(l)},"Complex, BigNumber":function(s,l){if(!l.isInteger())throw new TypeError(Cn);var p=l.toNumber();return s.round(p)},BigNumber:function(s){return s.toDecimalPlaces(0)},"BigNumber, BigNumber":function(s,l){if(!l.isInteger())throw new TypeError(Cn);return s.toDecimalPlaces(l.toNumber())},Fraction:function(s){return s.round()},"Fraction, number":function(s,l){if(l%1)throw new TypeError(Cn);return s.round(l)},"Fraction, BigNumber":function(s,l){if(!l.isInteger())throw new TypeError(Cn);return s.round(l.toNumber())},"Unit, number, Unit":r.referToSelf(s=>function(l,p,m){var d=l.toNumeric(m);return m.multiply(s(d,p))}),"Unit, BigNumber, Unit":r.referToSelf(s=>(l,p,m)=>s(l,p.toNumber(),m)),"Unit, Unit":r.referToSelf(s=>(l,p)=>s(l,0,p)),"Array | Matrix, number, Unit":r.referToSelf(s=>(l,p,m)=>$e(l,d=>s(d,p,m))),"Array | Matrix, BigNumber, Unit":r.referToSelf(s=>(l,p,m)=>s(l,p.toNumber(),m)),"Array | Matrix, Unit":r.referToSelf(s=>(l,p)=>s(l,0,p)),"Array | Matrix":r.referToSelf(s=>l=>$e(l,s)),"SparseMatrix, number | BigNumber":r.referToSelf(s=>(l,p)=>f(l,p,s,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(s=>(l,p)=>u(l,p,s,!1)),"Array, number | BigNumber":r.referToSelf(s=>(l,p)=>u(n(l),p,s,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf(s=>(l,p)=>t(l,0)?i(p.size(),p.storage()):c(p,l,s,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf(s=>(l,p)=>t(l,0)?i(p.size(),p.storage()):u(p,l,s,!0)),"number | Complex | BigNumber | Fraction, Array":r.referToSelf(s=>(l,p)=>u(n(p),l,s,!0).valueOf())})}),jc="log",sb=["config","typed","divideScalar","Complex"],ub=R(jc,sb,e=>{var{typed:r,config:n,divideScalar:t,Complex:i}=e;return r(jc,{number:function(a){return a>=0||n.predictable?og(a):new i(a,0).log()},Complex:function(a){return a.log()},BigNumber:function(a){return!a.isNegative()||n.predictable?a.ln():new i(a.toNumber(),0).log()},"any, any":r.referToSelf(a=>(o,f)=>t(a(o),a(f)))})}),Pc="log1p",lb=["typed","config","divideScalar","log","Complex"],cb=R(Pc,lb,e=>{var{typed:r,config:n,divideScalar:t,log:i,Complex:a}=e;return r(Pc,{number:function(f){return f>=-1||n.predictable?n0(f):o(new a(f,0))},Complex:o,BigNumber:function(f){var c=f.plus(1);return!c.isNegative()||n.predictable?c.ln():o(new a(f.toNumber(),0))},"Array | Matrix":r.referToSelf(f=>c=>$e(c,f)),"any, any":r.referToSelf(f=>(c,u)=>t(f(c),i(u)))});function o(f){var c=f.re+1;return new a(Math.log(Math.sqrt(c*c+f.im*f.im)),Math.atan2(f.im,c))}}),Uc="nthRoots",fb=["config","typed","divideScalar","Complex"],pb=R(Uc,fb,e=>{var{typed:r,config:n,divideScalar:t,Complex:i}=e,a=[function(f){return new i(f,0)},function(f){return new i(0,f)},function(f){return new i(-f,0)},function(f){return new i(0,-f)}];function o(f,c){if(c<0)throw new Error("Root must be greater than zero");if(c===0)throw new Error("Root must be non-zero");if(c%1!==0)throw new Error("Root must be an integer");if(f===0||f.abs()===0)return[new i(0,0)];var u=typeof f=="number",s;(u||f.re===0||f.im===0)&&(u?s=2*+(f<0):f.im===0?s=2*+(f.re<0):s=2*+(f.im<0)+1);for(var l=f.arg(),p=f.abs(),m=[],d=Math.pow(p,1/c),g=0;g<c;g++){var w=(s+4*g)/c;if(w===Math.round(w)){m.push(a[w%4](d));continue}m.push(new i({r:d,phi:(l+2*Math.PI*g)/c}))}return m}return r(Uc,{Complex:function(f){return o(f,2)},"Complex, number":o})}),Lc="dotPow",mb=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],db=R(Lc,mb,e=>{var{typed:r,equalScalar:n,matrix:t,pow:i,DenseMatrix:a,concat:o}=e,f=_r({typed:r}),c=mt({typed:r,DenseMatrix:a}),u=Ar({typed:r,equalScalar:n}),s=gr({typed:r,DenseMatrix:a}),l=sr({typed:r,matrix:t,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&!m.includes("Matrix")&&!m.includes("Array")&&(p[m]=i.signatures[m]);var d=r(p);return r(Lc,l({elop:d,SS:c,DS:f,Ss:u,sS:s}))}),Hc="dotDivide",hb=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],gb=R(Hc,hb,e=>{var{typed:r,matrix:n,equalScalar:t,divideScalar:i,DenseMatrix:a,concat:o}=e,f=at({typed:r,equalScalar:t}),c=_r({typed:r}),u=mt({typed:r,DenseMatrix:a}),s=Ar({typed:r,equalScalar:t}),l=gr({typed:r,DenseMatrix:a}),p=sr({typed:r,matrix:n,concat:o});return r(Hc,p({elop:i,SS:u,DS:c,SD:f,Ss:s,sS:l}))});function Qn(e){var{DenseMatrix:r}=e;return function(n,t,i){var a=n.size();if(a.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Le(a)+")");var o=a[0],f=a[1];if(o!==f)throw new RangeError("Matrix must be square (size: "+Le(a)+")");var c=[];if(Be(t)){var u=t.size(),s=t._data;if(u.length===1){if(u[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var l=0;l<o;l++)c[l]=[s[l]];return new r({data:c,size:[o,1],datatype:t._datatype})}if(u.length===2){if(u[0]!==o||u[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(fi(t)){if(i){c=[];for(var p=0;p<o;p++)c[p]=[s[p][0]];return new r({data:c,size:[o,1],datatype:t._datatype})}return t}if(Jt(t)){for(var m=0;m<o;m++)c[m]=[0];for(var d=t._values,g=t._index,w=t._ptr,v=w[1],b=w[0];b<v;b++){var h=g[b];c[h][0]=d[b]}return new r({data:c,size:[o,1],datatype:t._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(Xe(t)){var x=qe(t);if(x.length===1){if(x[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var y=0;y<o;y++)c[y]=[t[y]];return new r({data:c,size:[o,1]})}if(x.length===2){if(x[0]!==o||x[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var N=0;N<o;N++)c[N]=[t[N][0]];return new r({data:c,size:[o,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var $c="lsolve",vb=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],yb=R($c,vb,e=>{var{typed:r,matrix:n,divideScalar:t,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:f}=e,c=Qn({DenseMatrix:f});return r($c,{"SparseMatrix, Array | Matrix":function(l,p){return s(l,p)},"DenseMatrix, Array | Matrix":function(l,p){return u(l,p)},"Array, Array | Matrix":function(l,p){var m=n(l),d=u(m,p);return d.valueOf()}});function u(l,p){p=c(l,p,!0);for(var m=p._data,d=l._size[0],g=l._size[1],w=[],v=l._data,b=0;b<g;b++){var h=m[b][0]||0,x=void 0;if(o(h,0))x=0;else{var y=v[b][b];if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");x=t(h,y);for(var N=b+1;N<d;N++)m[N]=[a(m[N][0]||0,i(x,v[N][b]))]}w[b]=[x]}return new f({data:w,size:[d,1]})}function s(l,p){p=c(l,p,!0);for(var m=p._data,d=l._size[0],g=l._size[1],w=l._values,v=l._index,b=l._ptr,h=[],x=0;x<g;x++){var y=m[x][0]||0;if(o(y,0))h[x]=[0];else{for(var N=0,A=[],E=[],D=b[x],M=b[x+1],S=D;S<M;S++){var B=v[S];B===x?N=w[S]:B>x&&(A.push(w[S]),E.push(B))}if(o(N,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var I=t(y,N),j=0,_=E.length;j<_;j++){var O=E[j];m[O]=[a(m[O][0]||0,i(I,A[j]))]}h[x]=[I]}}return new f({data:h,size:[d,1]})}}),Zc="usolve",xb=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],bb=R(Zc,xb,e=>{var{typed:r,matrix:n,divideScalar:t,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:f}=e,c=Qn({DenseMatrix:f});return r(Zc,{"SparseMatrix, Array | Matrix":function(l,p){return s(l,p)},"DenseMatrix, Array | Matrix":function(l,p){return u(l,p)},"Array, Array | Matrix":function(l,p){var m=n(l),d=u(m,p);return d.valueOf()}});function u(l,p){p=c(l,p,!0);for(var m=p._data,d=l._size[0],g=l._size[1],w=[],v=l._data,b=g-1;b>=0;b--){var h=m[b][0]||0,x=void 0;if(o(h,0))x=0;else{var y=v[b][b];if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");x=t(h,y);for(var N=b-1;N>=0;N--)m[N]=[a(m[N][0]||0,i(x,v[N][b]))]}w[b]=[x]}return new f({data:w,size:[d,1]})}function s(l,p){p=c(l,p,!0);for(var m=p._data,d=l._size[0],g=l._size[1],w=l._values,v=l._index,b=l._ptr,h=[],x=g-1;x>=0;x--){var y=m[x][0]||0;if(o(y,0))h[x]=[0];else{for(var N=0,A=[],E=[],D=b[x],M=b[x+1],S=M-1;S>=D;S--){var B=v[S];B===x?N=w[S]:B<x&&(A.push(w[S]),E.push(B))}if(o(N,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var I=t(y,N),j=0,_=E.length;j<_;j++){var O=E[j];m[O]=[a(m[O][0],i(I,A[j]))]}h[x]=[I]}}return new f({data:h,size:[d,1]})}}),Jc="lsolveAll",wb=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],Nb=R(Jc,wb,e=>{var{typed:r,matrix:n,divideScalar:t,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:f}=e,c=Qn({DenseMatrix:f});return r(Jc,{"SparseMatrix, Array | Matrix":function(l,p){return s(l,p)},"DenseMatrix, Array | Matrix":function(l,p){return u(l,p)},"Array, Array | Matrix":function(l,p){var m=n(l),d=u(m,p);return d.map(g=>g.valueOf())}});function u(l,p){for(var m=[c(l,p,!0)._data.map(E=>E[0])],d=l._data,g=l._size[0],w=l._size[1],v=0;v<w;v++)for(var b=m.length,h=0;h<b;h++){var x=m[h];if(o(d[v][v],0))if(o(x[v],0)){if(h===0){var y=[...x];y[v]=1;for(var N=v+1;N<w;N++)y[N]=a(y[N],d[N][v]);m.push(y)}}else{if(h===0)return[];m.splice(h,1),h-=1,b-=1}else{x[v]=t(x[v],d[v][v]);for(var A=v+1;A<w;A++)x[A]=a(x[A],i(x[v],d[A][v]))}}return m.map(E=>new f({data:E.map(D=>[D]),size:[g,1]}))}function s(l,p){for(var m=[c(l,p,!0)._data.map(te=>te[0])],d=l._size[0],g=l._size[1],w=l._values,v=l._index,b=l._ptr,h=0;h<g;h++)for(var x=m.length,y=0;y<x;y++){for(var N=m[y],A=[],E=[],D=b[h],M=b[h+1],S=0,B=D;B<M;B++){var I=v[B];I===h?S=w[B]:I>h&&(A.push(w[B]),E.push(I))}if(o(S,0))if(o(N[h],0)){if(y===0){var j=[...N];j[h]=1;for(var _=0,O=E.length;_<O;_++){var C=E[_];j[C]=a(j[C],A[_])}m.push(j)}}else{if(y===0)return[];m.splice(y,1),y-=1,x-=1}else{N[h]=t(N[h],S);for(var z=0,T=E.length;z<T;z++){var Y=E[z];N[Y]=a(N[Y],i(N[h],A[z]))}}}return m.map(te=>new f({data:te.map($=>[$]),size:[d,1]}))}}),Wc="usolveAll",Db=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],Ab=R(Wc,Db,e=>{var{typed:r,matrix:n,divideScalar:t,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:f}=e,c=Qn({DenseMatrix:f});return r(Wc,{"SparseMatrix, Array | Matrix":function(l,p){return s(l,p)},"DenseMatrix, Array | Matrix":function(l,p){return u(l,p)},"Array, Array | Matrix":function(l,p){var m=n(l),d=u(m,p);return d.map(g=>g.valueOf())}});function u(l,p){for(var m=[c(l,p,!0)._data.map(E=>E[0])],d=l._data,g=l._size[0],w=l._size[1],v=w-1;v>=0;v--)for(var b=m.length,h=0;h<b;h++){var x=m[h];if(o(d[v][v],0))if(o(x[v],0)){if(h===0){var y=[...x];y[v]=1;for(var N=v-1;N>=0;N--)y[N]=a(y[N],d[N][v]);m.push(y)}}else{if(h===0)return[];m.splice(h,1),h-=1,b-=1}else{x[v]=t(x[v],d[v][v]);for(var A=v-1;A>=0;A--)x[A]=a(x[A],i(x[v],d[A][v]))}}return m.map(E=>new f({data:E.map(D=>[D]),size:[g,1]}))}function s(l,p){for(var m=[c(l,p,!0)._data.map(te=>te[0])],d=l._size[0],g=l._size[1],w=l._values,v=l._index,b=l._ptr,h=g-1;h>=0;h--)for(var x=m.length,y=0;y<x;y++){for(var N=m[y],A=[],E=[],D=b[h],M=b[h+1],S=0,B=M-1;B>=D;B--){var I=v[B];I===h?S=w[B]:I<h&&(A.push(w[B]),E.push(I))}if(o(S,0))if(o(N[h],0)){if(y===0){var j=[...N];j[h]=1;for(var _=0,O=E.length;_<O;_++){var C=E[_];j[C]=a(j[C],A[_])}m.push(j)}}else{if(y===0)return[];m.splice(y,1),y-=1,x-=1}else{N[h]=t(N[h],S);for(var z=0,T=E.length;z<T;z++){var Y=E[z];N[Y]=a(N[Y],i(N[h],A[z]))}}}return m.map(te=>new f({data:te.map($=>[$]),size:[d,1]}))}}),Eb="matAlgo08xS0Sid",Mb=["typed","equalScalar"],ro=R(Eb,Mb,e=>{var{typed:r,equalScalar:n}=e;return function(t,i,a){var o=t._values,f=t._index,c=t._ptr,u=t._size,s=t._datatype,l=i._values,p=i._index,m=i._ptr,d=i._size,g=i._datatype;if(u.length!==d.length)throw new He(u.length,d.length);if(u[0]!==d[0]||u[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+d+")");if(!o||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var w=u[0],v=u[1],b,h=n,x=0,y=a;typeof s=="string"&&s===g&&(b=s,h=r.find(n,[b,b]),x=r.convert(0,b),y=r.find(a,[b,b]));for(var N=[],A=[],E=[],D=[],M=[],S,B,I,j,_=0;_<v;_++){E[_]=A.length;var O=_+1;for(B=c[_],I=c[_+1],S=B;S<I;S++)j=f[S],M[j]=O,D[j]=o[S],A.push(j);for(B=m[_],I=m[_+1],S=B;S<I;S++)j=p[S],M[j]===O&&(D[j]=y(D[j],l[S]));for(S=E[_];S<A.length;){j=A[S];var C=D[j];h(C,x)?A.splice(S,1):(N.push(C),S++)}}return E[v]=A.length,t.createSparseMatrix({values:N,index:A,ptr:E,size:[w,v],datatype:b})}}),to=R("useMatrixForArrayScalar",["typed","matrix"],e=>{var{typed:r,matrix:n}=e;return{"Array, number":r.referTo("DenseMatrix, number",t=>(i,a)=>t(n(i),a).valueOf()),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",t=>(i,a)=>t(n(i),a).valueOf()),"number, Array":r.referTo("number, DenseMatrix",t=>(i,a)=>t(i,n(a)).valueOf()),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",t=>(i,a)=>t(i,n(a)).valueOf())}}),Yc="leftShift",Sb=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Fb=R(Yc,Sb,e=>{var{typed:r,matrix:n,equalScalar:t,zeros:i,DenseMatrix:a,concat:o}=e,f=qt({typed:r}),c=at({typed:r,equalScalar:t}),u=ro({typed:r,equalScalar:t}),s=Kt({typed:r,DenseMatrix:a}),l=Ar({typed:r,equalScalar:t}),p=it({typed:r}),m=sr({typed:r,matrix:n,concat:o}),d=to({typed:r,matrix:n});return r(Yc,{"number, number":lu,"BigNumber, BigNumber":Yv,"SparseMatrix, number | BigNumber":r.referToSelf(g=>(w,v)=>t(v,0)?w.clone():l(w,v,g,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(g=>(w,v)=>t(v,0)?w.clone():p(w,v,g,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(g=>(w,v)=>t(w,0)?i(v.size(),v.storage()):s(v,w,g,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(g=>(w,v)=>t(w,0)?i(v.size(),v.storage()):p(v,w,g,!0))},d,m({SS:u,DS:f,SD:c}))}),Gc="rightArithShift",Cb=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Bb=R(Gc,Cb,e=>{var{typed:r,matrix:n,equalScalar:t,zeros:i,DenseMatrix:a,concat:o}=e,f=qt({typed:r}),c=at({typed:r,equalScalar:t}),u=ro({typed:r,equalScalar:t}),s=Kt({typed:r,DenseMatrix:a}),l=Ar({typed:r,equalScalar:t}),p=it({typed:r}),m=sr({typed:r,matrix:n,concat:o}),d=to({typed:r,matrix:n});return r(Gc,{"number, number":cu,"BigNumber, BigNumber":Gv,"SparseMatrix, number | BigNumber":r.referToSelf(g=>(w,v)=>t(v,0)?w.clone():l(w,v,g,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(g=>(w,v)=>t(v,0)?w.clone():p(w,v,g,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(g=>(w,v)=>t(w,0)?i(v.size(),v.storage()):s(v,w,g,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(g=>(w,v)=>t(w,0)?i(v.size(),v.storage()):p(v,w,g,!0))},d,m({SS:u,DS:f,SD:c}))}),Vc="rightLogShift",Ob=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Tb=R(Vc,Ob,e=>{var{typed:r,matrix:n,equalScalar:t,zeros:i,DenseMatrix:a,concat:o}=e,f=qt({typed:r}),c=at({typed:r,equalScalar:t}),u=ro({typed:r,equalScalar:t}),s=Kt({typed:r,DenseMatrix:a}),l=Ar({typed:r,equalScalar:t}),p=it({typed:r}),m=sr({typed:r,matrix:n,concat:o}),d=to({typed:r,matrix:n});return r(Vc,{"number, number":fu,"SparseMatrix, number | BigNumber":r.referToSelf(g=>(w,v)=>t(v,0)?w.clone():l(w,v,g,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(g=>(w,v)=>t(v,0)?w.clone():p(w,v,g,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(g=>(w,v)=>t(w,0)?i(v.size(),v.storage()):s(v,w,g,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(g=>(w,v)=>t(w,0)?i(v.size(),v.storage()):p(v,w,g,!0))},d,m({SS:u,DS:f,SD:c}))}),Kc="and",_b=["typed","matrix","equalScalar","zeros","not","concat"],Qc=R(Kc,_b,e=>{var{typed:r,matrix:n,equalScalar:t,zeros:i,not:a,concat:o}=e,f=at({typed:r,equalScalar:t}),c=ki({typed:r,equalScalar:t}),u=Ar({typed:r,equalScalar:t}),s=it({typed:r}),l=sr({typed:r,matrix:n,concat:o});return r(Kc,{"number, number":gu,"Complex, Complex":function(p,m){return(p.re!==0||p.im!==0)&&(m.re!==0||m.im!==0)},"BigNumber, BigNumber":function(p,m){return!p.isZero()&&!m.isZero()&&!p.isNaN()&&!m.isNaN()},"Unit, Unit":r.referToSelf(p=>(m,d)=>p(m.value||0,d.value||0)),"SparseMatrix, any":r.referToSelf(p=>(m,d)=>a(d)?i(m.size(),m.storage()):u(m,d,p,!1)),"DenseMatrix, any":r.referToSelf(p=>(m,d)=>a(d)?i(m.size(),m.storage()):s(m,d,p,!1)),"any, SparseMatrix":r.referToSelf(p=>(m,d)=>a(m)?i(m.size(),m.storage()):u(d,m,p,!0)),"any, DenseMatrix":r.referToSelf(p=>(m,d)=>a(m)?i(m.size(),m.storage()):s(d,m,p,!0)),"Array, any":r.referToSelf(p=>(m,d)=>p(n(m),d).valueOf()),"any, Array":r.referToSelf(p=>(m,d)=>p(m,n(d)).valueOf())},l({SS:c,DS:f}))}),Pi="compare",Ib=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],zb=R(Pi,Ib,e=>{var{typed:r,config:n,equalScalar:t,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:f,concat:c}=e,u=_r({typed:r}),s=qi({typed:r,equalScalar:t}),l=gr({typed:r,DenseMatrix:f}),p=sr({typed:r,matrix:i,concat:c}),m=Mn({typed:r});return r(Pi,Rb({typed:r,config:n}),{"boolean, boolean":function(d,g){return d===g?0:d>g?1:-1},"BigNumber, BigNumber":function(d,g){return pt(d,g,n.epsilon)?new a(0):new a(d.cmp(g))},"Fraction, Fraction":function(d,g){return new o(d.compare(g))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:s,DS:u,Ss:l}))}),Rb=R(Pi,["typed","config"],e=>{var{typed:r,config:n}=e;return r(Pi,{"number, number":function(t,i){return Lr(t,i,n.epsilon)?0:t>i?1:-1}})}),qb=function e(r,n){var t=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,f=/^0/,c=function(h){return e.insensitive&&(""+h).toLowerCase()||""+h},u=c(r).replace(i,"")||"",s=c(n).replace(i,"")||"",l=u.replace(t,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=s.replace(t,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(u.match(o),16)||l.length!==1&&u.match(a)&&Date.parse(u),d=parseInt(s.match(o),16)||m&&s.match(a)&&Date.parse(s)||null,g,w;if(d){if(m<d)return-1;if(m>d)return 1}for(var v=0,b=Math.max(l.length,p.length);v<b;v++){if(g=!(l[v]||"").match(f)&&parseFloat(l[v])||l[v]||0,w=!(p[v]||"").match(f)&&parseFloat(p[v])||p[v]||0,isNaN(g)!==isNaN(w))return isNaN(g)?1:-1;if(typeof g!=typeof w&&(g+="",w+=""),g<w)return-1;if(g>w)return 1}return 0};const Bn=Wn(qb);var Xc="compareNatural",kb=["typed","compare"],jb=R(Xc,kb,e=>{var{typed:r,compare:n}=e,t=n.signatures["boolean,boolean"];return r(Xc,{"any, any":i});function i(c,u){var s=nr(c),l=nr(u),p;if((s==="number"||s==="BigNumber"||s==="Fraction")&&(l==="number"||l==="BigNumber"||l==="Fraction"))return p=n(c,u),p.toString()!=="0"?p>0?1:-1:Bn(s,l);var m=["Array","DenseMatrix","SparseMatrix"];if(m.includes(s)||m.includes(l))return p=a(i,c,u),p!==0?p:Bn(s,l);if(s!==l)return Bn(s,l);if(s==="Complex")return Pb(c,u);if(s==="Unit")return c.equalBase(u)?i(c.value,u.value):o(i,c.formatUnits(),u.formatUnits());if(s==="boolean")return t(c,u);if(s==="string")return Bn(c,u);if(s==="Object")return f(i,c,u);if(s==="null"||s==="undefined")return 0;throw new TypeError('Unsupported type of value "'+s+'"')}function a(c,u,s){return Jt(u)&&Jt(s)?o(c,u.toJSON().values,s.toJSON().values):Jt(u)?a(c,u.toArray(),s):Jt(s)?a(c,u,s.toArray()):fi(u)?a(c,u.toJSON().data,s):fi(s)?a(c,u,s.toJSON().data):Array.isArray(u)?Array.isArray(s)?o(c,u,s):a(c,u,[s]):a(c,[u],s)}function o(c,u,s){for(var l=0,p=Math.min(u.length,s.length);l<p;l++){var m=c(u[l],s[l]);if(m!==0)return m}return u.length>s.length?1:u.length<s.length?-1:0}function f(c,u,s){var l=Object.keys(u),p=Object.keys(s);l.sort(Bn),p.sort(Bn);var m=o(c,l,p);if(m!==0)return m;for(var d=0;d<l.length;d++){var g=c(u[l[d]],s[p[d]]);if(g!==0)return g}return 0}});function Pb(e,r){return e.re>r.re?1:e.re<r.re?-1:e.im>r.im?1:e.im<r.im?-1:0}var ef="compareText",Ub=["typed","matrix","concat"];Ba.signature="any, any";var Lb=R(ef,Ub,e=>{var{typed:r,matrix:n,concat:t}=e,i=sr({typed:r,matrix:n,concat:t});return r(ef,Ba,i({elop:Ba,Ds:!0}))}),Ui="equal",Hb=["typed","matrix","equalScalar","DenseMatrix","concat"],$b=R(Ui,Hb,e=>{var{typed:r,matrix:n,equalScalar:t,DenseMatrix:i,concat:a}=e,o=_r({typed:r}),f=mt({typed:r,DenseMatrix:i}),c=gr({typed:r,DenseMatrix:i}),u=sr({typed:r,matrix:n,concat:a});return r(Ui,Zb({typed:r,equalScalar:t}),u({elop:t,SS:f,DS:o,Ss:c}))}),Zb=R(Ui,["typed","equalScalar"],e=>{var{typed:r,equalScalar:n}=e;return r(Ui,{"any, any":function(t,i){return t===null?i===null:i===null?t===null:t===void 0?i===void 0:i===void 0?t===void 0:n(t,i)}})}),rf="equalText",Jb=["typed","compareText","isZero"],Wb=R(rf,Jb,e=>{var{typed:r,compareText:n,isZero:t}=e;return r(rf,{"any, any":function(i,a){return t(n(i,a))}})}),Li="smaller",Yb=["typed","config","matrix","DenseMatrix","concat"],Gb=R(Li,Yb,e=>{var{typed:r,config:n,matrix:t,DenseMatrix:i,concat:a}=e,o=_r({typed:r}),f=mt({typed:r,DenseMatrix:i}),c=gr({typed:r,DenseMatrix:i}),u=sr({typed:r,matrix:t,concat:a}),s=Mn({typed:r});return r(Li,Vb({typed:r,config:n}),{"boolean, boolean":(l,p)=>l<p,"BigNumber, BigNumber":function(l,p){return l.lt(p)&&!pt(l,p,n.epsilon)},"Fraction, Fraction":(l,p)=>l.compare(p)===-1,"Complex, Complex":function(l,p){throw new TypeError("No ordering relation is defined for complex numbers")}},s,u({SS:f,DS:o,Ss:c}))}),Vb=R(Li,["typed","config"],e=>{var{typed:r,config:n}=e;return r(Li,{"number, number":function(t,i){return t<i&&!Lr(t,i,n.epsilon)}})}),Hi="smallerEq",Kb=["typed","config","matrix","DenseMatrix","concat"],Qb=R(Hi,Kb,e=>{var{typed:r,config:n,matrix:t,DenseMatrix:i,concat:a}=e,o=_r({typed:r}),f=mt({typed:r,DenseMatrix:i}),c=gr({typed:r,DenseMatrix:i}),u=sr({typed:r,matrix:t,concat:a}),s=Mn({typed:r});return r(Hi,Xb({typed:r,config:n}),{"boolean, boolean":(l,p)=>l<=p,"BigNumber, BigNumber":function(l,p){return l.lte(p)||pt(l,p,n.epsilon)},"Fraction, Fraction":(l,p)=>l.compare(p)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},s,u({SS:f,DS:o,Ss:c}))}),Xb=R(Hi,["typed","config"],e=>{var{typed:r,config:n}=e;return r(Hi,{"number, number":function(t,i){return t<=i||Lr(t,i,n.epsilon)}})}),$i="larger",ew=["typed","config","matrix","DenseMatrix","concat"],rw=R($i,ew,e=>{var{typed:r,config:n,matrix:t,DenseMatrix:i,concat:a}=e,o=_r({typed:r}),f=mt({typed:r,DenseMatrix:i}),c=gr({typed:r,DenseMatrix:i}),u=sr({typed:r,matrix:t,concat:a}),s=Mn({typed:r});return r($i,tw({typed:r,config:n}),{"boolean, boolean":(l,p)=>l>p,"BigNumber, BigNumber":function(l,p){return l.gt(p)&&!pt(l,p,n.epsilon)},"Fraction, Fraction":(l,p)=>l.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},s,u({SS:f,DS:o,Ss:c}))}),tw=R($i,["typed","config"],e=>{var{typed:r,config:n}=e;return r($i,{"number, number":function(t,i){return t>i&&!Lr(t,i,n.epsilon)}})}),Zi="largerEq",nw=["typed","config","matrix","DenseMatrix","concat"],iw=R(Zi,nw,e=>{var{typed:r,config:n,matrix:t,DenseMatrix:i,concat:a}=e,o=_r({typed:r}),f=mt({typed:r,DenseMatrix:i}),c=gr({typed:r,DenseMatrix:i}),u=sr({typed:r,matrix:t,concat:a}),s=Mn({typed:r});return r(Zi,aw({typed:r,config:n}),{"boolean, boolean":(l,p)=>l>=p,"BigNumber, BigNumber":function(l,p){return l.gte(p)||pt(l,p,n.epsilon)},"Fraction, Fraction":(l,p)=>l.compare(p)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},s,u({SS:f,DS:o,Ss:c}))}),aw=R(Zi,["typed","config"],e=>{var{typed:r,config:n}=e;return r(Zi,{"number, number":function(t,i){return t>=i||Lr(t,i,n.epsilon)}})}),tf="deepEqual",ow=["typed","equal"],sw=R(tf,ow,e=>{var{typed:r,equal:n}=e;return r(tf,{"any, any":function(i,a){return t(i.valueOf(),a.valueOf())}});function t(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var f=0;f<o;f++)if(!t(i[f],a[f]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:n(i,a)}}),Ji="unequal",uw=["typed","config","equalScalar","matrix","DenseMatrix","concat"],lw=R(Ji,uw,e=>{var{typed:r,config:n,equalScalar:t,matrix:i,DenseMatrix:a,concat:o}=e,f=_r({typed:r}),c=mt({typed:r,DenseMatrix:a}),u=gr({typed:r,DenseMatrix:a}),s=sr({typed:r,matrix:i,concat:o});return r(Ji,cw({typed:r,equalScalar:t}),s({elop:l,SS:c,DS:f,Ss:u}));function l(p,m){return!t(p,m)}}),cw=R(Ji,["typed","equalScalar"],e=>{var{typed:r,equalScalar:n}=e;return r(Ji,{"any, any":function(t,i){return t===null?i!==null:i===null?t!==null:t===void 0?i!==void 0:i===void 0?t!==void 0:!n(t,i)}})}),nf="partitionSelect",fw=["typed","isNumeric","isNaN","compare"],pw=R(nf,fw,e=>{var{typed:r,isNumeric:n,isNaN:t,compare:i}=e,a=i,o=(u,s)=>-i(u,s);return r(nf,{"Array | Matrix, number":function(u,s){return f(u,s,a)},"Array | Matrix, number, string":function(u,s,l){if(l==="asc")return f(u,s,a);if(l==="desc")return f(u,s,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":f});function f(u,s,l){if(!Se(s)||s<0)throw new Error("k must be a non-negative integer");if(Be(u)){var p=u.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return c(u.valueOf(),s,l)}if(Array.isArray(u))return c(u,s,l)}function c(u,s,l){if(s>=u.length)throw new Error("k out of bounds");for(var p=0;p<u.length;p++)if(n(u[p])&&t(u[p]))return u[p];for(var m=0,d=u.length-1;m<d;){for(var g=m,w=d,v=u[Math.floor(Math.random()*(d-m+1))+m];g<w;)if(l(u[g],v)>=0){var b=u[w];u[w]=u[g],u[g]=b,--w}else++g;l(u[g],v)>0&&--g,s<=g?d=g:m=g+1}return u[s]}}),af="sort",mw=["typed","matrix","compare","compareNatural"],dw=R(af,mw,e=>{var{typed:r,matrix:n,compare:t,compareNatural:i}=e,a=t,o=(s,l)=>-t(s,l);return r(af,{Array:function(s){return c(s),s.sort(a)},Matrix:function(s){return u(s),n(s.toArray().sort(a),s.storage())},"Array, function":function(s,l){return c(s),s.sort(l)},"Matrix, function":function(s,l){return u(s),n(s.toArray().sort(l),s.storage())},"Array, string":function(s,l){return c(s),s.sort(f(l))},"Matrix, string":function(s,l){return u(s),n(s.toArray().sort(f(l)),s.storage())}});function f(s){if(s==="asc")return a;if(s==="desc")return o;if(s==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function c(s){if(qe(s).length!==1)throw new Error("One dimensional array expected")}function u(s){if(s.size().length!==1)throw new Error("One dimensional matrix expected")}}),of="max",hw=["typed","config","numeric","larger"],sf=R(of,hw,e=>{var{typed:r,config:n,numeric:t,larger:i}=e;return r(of,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(f,c){return Bi(f,c.valueOf(),a)},"...":function(f){if(Nn(f))throw new TypeError("Scalar values expected in function max");return o(f)}});function a(f,c){try{return i(f,c)?f:c}catch(u){throw Ir(u,"max",c)}}function o(f){var c;if(Dt(f,function(u){try{isNaN(u)&&typeof u=="number"?c=NaN:(c===void 0||i(u,c))&&(c=u)}catch(s){throw Ir(s,"max",u)}}),c===void 0)throw new Error("Cannot calculate max of an empty array");return typeof c=="string"&&(c=t(c,n.number)),c}}),uf="min",gw=["typed","config","numeric","smaller"],lf=R(uf,gw,e=>{var{typed:r,config:n,numeric:t,smaller:i}=e;return r(uf,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(f,c){return Bi(f,c.valueOf(),a)},"...":function(f){if(Nn(f))throw new TypeError("Scalar values expected in function min");return o(f)}});function a(f,c){try{return i(f,c)?f:c}catch(u){throw Ir(u,"min",c)}}function o(f){var c;if(Dt(f,function(u){try{isNaN(u)&&typeof u=="number"?c=NaN:(c===void 0||i(u,c))&&(c=u)}catch(s){throw Ir(s,"min",u)}}),c===void 0)throw new Error("Cannot calculate min of an empty array");return typeof c=="string"&&(c=t(c,n.number)),c}}),vw="ImmutableDenseMatrix",yw=["smaller","DenseMatrix"],xw=R(vw,yw,e=>{var{smaller:r,DenseMatrix:n}=e;function t(i,a){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!Sr(a))throw new Error("Invalid datatype: "+a);if(Be(i)||Xe(i)){var o=new n(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&Xe(i.data)&&Xe(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+nr(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return t.prototype=new n,t.prototype.type="ImmutableDenseMatrix",t.prototype.isImmutableDenseMatrix=!0,t.prototype.subset=function(i){switch(arguments.length){case 1:{var a=n.prototype.subset.call(this,i);return Be(a)?new t({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},t.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},t.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},t.prototype.clone=function(){return new t({data:Ie(this._data),size:Ie(this._size),datatype:this._datatype})},t.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.fromJSON=function(i){return new t(i)},t.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},t.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||r(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},t.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||r(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},t},{isClass:!0}),bw="Index",ww=["ImmutableDenseMatrix","getMatrixDataType"],Nw=R(bw,ww,e=>{var{ImmutableDenseMatrix:r,getMatrixDataType:n}=e;function t(a){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,f=arguments.length;o<f;o++){var c=arguments[o],u=Xe(c),s=Be(c),l=null;if(Ma(c))this._dimensions.push(c),this._isScalar=!1;else if(u||s){var p=void 0;n(c)==="boolean"?(u&&(p=i(cf(c).valueOf())),s&&(p=i(cf(c._data).valueOf())),l=c.valueOf().length):p=i(c.valueOf()),this._dimensions.push(p);var m=p.size();(m.length!==1||m[0]!==1||l!==null)&&(this._isScalar=!1)}else if(typeof c=="number")this._dimensions.push(i([c]));else if(typeof c=="string")this._dimensions.push(c);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(l)}}t.prototype.type="Index",t.prototype.isIndex=!0;function i(a){for(var o=0,f=a.length;o<f;o++)if(typeof a[o]!="number"||!Se(a[o]))throw new TypeError("Index parameters must be positive integer numbers");return new r(a)}return t.prototype.clone=function(){var a=new t;return a._dimensions=Ie(this._dimensions),a._isScalar=this._isScalar,a._sourceSize=this._sourceSize,a},t.create=function(a){var o=new t;return t.apply(o,a),o},t.prototype.size=function(){for(var a=[],o=0,f=this._dimensions.length;o<f;o++){var c=this._dimensions[o];a[o]=typeof c=="string"?1:c.size()[0]}return a},t.prototype.max=function(){for(var a=[],o=0,f=this._dimensions.length;o<f;o++){var c=this._dimensions[o];a[o]=typeof c=="string"?c:c.max()}return a},t.prototype.min=function(){for(var a=[],o=0,f=this._dimensions.length;o<f;o++){var c=this._dimensions[o];a[o]=typeof c=="string"?c:c.min()}return a},t.prototype.forEach=function(a){for(var o=0,f=this._dimensions.length;o<f;o++)a(this._dimensions[o],o,this)},t.prototype.dimension=function(a){return this._dimensions[a]||null},t.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},t.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},t.prototype.isScalar=function(){return this._isScalar},t.prototype.toArray=function(){for(var a=[],o=0,f=this._dimensions.length;o<f;o++){var c=this._dimensions[o];a.push(typeof c=="string"?c:c.toArray())}return a},t.prototype.valueOf=t.prototype.toArray,t.prototype.toString=function(){for(var a=[],o=0,f=this._dimensions.length;o<f;o++){var c=this._dimensions[o];typeof c=="string"?a.push(JSON.stringify(c)):a.push(c.toString())}return"["+a.join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},t.fromJSON=function(a){return t.create(a.dimensions)},t},{isClass:!0});function cf(e){var r=[];return e.forEach((n,t)=>{n&&r.push(t)}),r}var Dw="FibonacciHeap",Aw=["smaller","larger"],Ew=R(Dw,Aw,e=>{var{smaller:r,larger:n}=e,t=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(s,l){var p={key:s,value:l,degree:0};if(this._minimum){var m=this._minimum;p.left=m,p.right=m.right,m.right=p,p.right.left=p,r(s,m.key)&&(this._minimum=p)}else p.left=p,p.right=p,this._minimum=p;return this._size++,p},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var s=this._minimum;if(s===null)return s;for(var l=this._minimum,p=s.degree,m=s.child;p>0;){var d=m.right;m.left.right=m.right,m.right.left=m.left,m.left=l,m.right=l.right,l.right=m,m.right.left=m,m.parent=null,m=d,p--}return s.left.right=s.right,s.right.left=s.left,s===s.right?l=null:(l=s.right,l=u(l,this._size)),this._size--,this._minimum=l,s},i.prototype.remove=function(s){this._minimum=a(this._minimum,s,-1),this.extractMinimum()};function a(s,l,p){l.key=p;var m=l.parent;return m&&r(l.key,m.key)&&(o(s,l,m),f(s,m)),r(l.key,s.key)&&(s=l),s}function o(s,l,p){l.left.right=l.right,l.right.left=l.left,p.degree--,p.child===l&&(p.child=l.right),p.degree===0&&(p.child=null),l.left=s,l.right=s.right,s.right=l,l.right.left=l,l.parent=null,l.mark=!1}function f(s,l){var p=l.parent;p&&(l.mark?(o(s,l,p),f(p)):l.mark=!0)}var c=function(s,l){s.left.right=s.right,s.right.left=s.left,s.parent=l,l.child?(s.left=l.child,s.right=l.child.right,l.child.right=s,s.right.left=s):(l.child=s,s.right=s,s.left=s),l.degree++,s.mark=!1};function u(s,l){var p=Math.floor(Math.log(l)*t)+1,m=new Array(p),d=0,g=s;if(g)for(d++,g=g.right;g!==s;)d++,g=g.right;for(var w;d>0;){for(var v=g.degree,b=g.right;w=m[v],!!w;){if(n(g.key,w.key)){var h=w;w=g,g=h}c(w,g),m[v]=null,v++}m[v]=g,g=b,d--}s=null;for(var x=0;x<p;x++)w=m[x],w&&(s?(w.left.right=w.right,w.right.left=w.left,w.left=s,w.right=s.right,s.right=w,w.right.left=w,r(w.key,s.key)&&(s=w)):s=w);return s}return i},{isClass:!0}),Mw="Spa",Sw=["addScalar","equalScalar","FibonacciHeap"],Fw=R(Mw,Sw,e=>{var{addScalar:r,equalScalar:n,FibonacciHeap:t}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new t}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var f=this._heap.insert(a,o);this._values[a]=f}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var f=this._values[a];f?f.value=r(f.value,o):(f=this._heap.insert(a,o),this._values[a]=f)},i.prototype.forEach=function(a,o,f){var c=this._heap,u=this._values,s=[],l=c.extractMinimum();for(l&&s.push(l);l&&l.key<=o;)l.key>=a&&(n(l.value,0)||f(l.key,l.value,this)),l=c.extractMinimum(),l&&s.push(l);for(var p=0;p<s.length;p++){var m=s[p];l=c.insert(m.key,m.value),u[l.key]=l}},i.prototype.swap=function(a,o){var f=this._values[a],c=this._values[o];if(!f&&c)f=this._heap.insert(a,c.value),this._heap.remove(c),this._values[a]=f,this._values[o]=void 0;else if(f&&!c)c=this._heap.insert(o,f.value),this._heap.remove(f),this._values[o]=c,this._values[a]=void 0;else if(f&&c){var u=f.value;f.value=c.value,c.value=u}},i},{isClass:!0}),Cw=Yn(function(e){return new e(1).exp()},{hasher:Wi}),Bw=Yn(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:Wi}),no=Yn(function(e){return e.acos(-1)},{hasher:Wi}),Ow=Yn(function(e){return no(e).times(2)},{hasher:Wi});function Wi(e){return e[0].precision}function ff(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,t)}return n}function io(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?ff(Object(n),!0).forEach(function(t){vr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ff(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Tw="Unit",_w=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],Iw=R(Tw,_w,e=>{var{on:r,config:n,addScalar:t,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:f,abs:c,fix:u,round:s,equal:l,isNumeric:p,format:m,number:d,Complex:g,BigNumber:w,Fraction:v}=e,b=d;function h(P,Z){if(!(this instanceof h))throw new Error("Constructor must be called with the new operator");if(!(P==null||p(P)||yt(P)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,Z===void 0)this.units=[],this.dimensions=z.map(H=>0);else if(typeof Z=="string"){var V=h.parse(Z);this.units=V.units,this.dimensions=V.dimensions}else if(Jr(Z)&&Z.value===null)this.fixPrefix=Z.fixPrefix,this.skipAutomaticSimplification=Z.skipAutomaticSimplification,this.dimensions=Z.dimensions.slice(0),this.units=Z.units.map(H=>dr({},H));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(P)}Object.defineProperty(h,"name",{value:"Unit"}),h.prototype.constructor=h,h.prototype.type="Unit",h.prototype.isUnit=!0;var x,y,N;function A(){for(;N===" "||N===" ";)M()}function E(P){return P>="0"&&P<="9"||P==="."}function D(P){return P>="0"&&P<="9"}function M(){y++,N=x.charAt(y)}function S(P){y=P,N=x.charAt(y)}function B(){var P="",Z=y;if(N==="+"?M():N==="-"&&(P+=N,M()),!E(N))return S(Z),null;if(N==="."){if(P+=N,M(),!D(N))return S(Z),null}else{for(;D(N);)P+=N,M();N==="."&&(P+=N,M())}for(;D(N);)P+=N,M();if(N==="E"||N==="e"){var V="",H=y;if(V+=N,M(),(N==="+"||N==="-")&&(V+=N,M()),!D(N))return S(H),P;for(P=P+V;D(N);)P+=N,M()}return P}function I(){for(var P="";D(N)||h.isValidAlpha(N);)P+=N,M();var Z=P.charAt(0);return h.isValidAlpha(Z)?P:null}function j(P){return N===P?(M(),P):null}h.parse=function(P,Z){if(Z=Z||{},x=P,y=-1,N="",typeof x!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var V=new h;V.units=[];var H=1,J=!1;M(),A();var K=B(),fe=null;if(K){if(n.number==="BigNumber")fe=new w(K);else if(n.number==="Fraction")try{fe=new v(K)}catch{fe=parseFloat(K)}else fe=parseFloat(K);A(),j("*")?(H=1,J=!0):j("/")&&(H=-1,J=!0)}for(var pe=[],k=1;;){for(A();N==="(";)pe.push(H),k*=H,H=1,M(),A();var U=void 0;if(N){var G=N;if(U=I(),U===null)throw new SyntaxError('Unexpected "'+G+'" in "'+x+'" at index '+y.toString())}else break;var re=_(U);if(re===null)throw new SyntaxError('Unit "'+U+'" not found.');var le=H*k;if(A(),j("^")){A();var me=B();if(me===null)throw new SyntaxError('In "'+P+'", "^" must be followed by a floating-point number');le*=me}V.units.push({unit:re.unit,prefix:re.prefix,power:le});for(var xe=0;xe<z.length;xe++)V.dimensions[xe]+=(re.unit.dimensions[xe]||0)*le;for(A();N===")";){if(pe.length===0)throw new SyntaxError('Unmatched ")" in "'+x+'" at index '+y.toString());k/=pe.pop(),M(),A()}if(J=!1,j("*")?(H=1,J=!0):j("/")?(H=-1,J=!0):H=1,re.unit.base){var he=re.unit.base.key;Q.auto[he]={unit:re.unit,prefix:re.prefix}}}if(A(),N)throw new SyntaxError('Could not parse: "'+P+'"');if(J)throw new SyntaxError('Trailing characters: "'+P+'"');if(pe.length!==0)throw new SyntaxError('Unmatched "(" in "'+x+'"');if(V.units.length===0&&!Z.allowNoUnits)throw new SyntaxError('"'+P+'" contains no units');return V.value=fe!==void 0?V._normalize(fe):null,V},h.prototype.clone=function(){var P=new h;P.fixPrefix=this.fixPrefix,P.skipAutomaticSimplification=this.skipAutomaticSimplification,P.value=Ie(this.value),P.dimensions=this.dimensions.slice(0),P.units=[];for(var Z=0;Z<this.units.length;Z++){P.units[Z]={};for(var V in this.units[Z])Me(this.units[Z],V)&&(P.units[Z][V]=this.units[Z][V])}return P},h.prototype.valueType=function(){return nr(this.value)},h.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},h.prototype._normalize=function(P){if(P==null||this.units.length===0)return P;for(var Z=P,V=h._getNumberConverter(nr(P)),H=0;H<this.units.length;H++){var J=V(this.units[H].unit.value),K=V(this.units[H].prefix.value),fe=V(this.units[H].power);Z=a(Z,f(a(J,K),fe))}return Z},h.prototype._denormalize=function(P,Z){if(P==null||this.units.length===0)return P;for(var V=P,H=h._getNumberConverter(nr(P)),J=0;J<this.units.length;J++){var K=H(this.units[J].unit.value),fe=H(this.units[J].prefix.value),pe=H(this.units[J].power);V=o(V,f(a(K,fe),pe))}return V};var _=Yn(P=>{if(Me(q,P)){var Z=q[P],V=Z.prefixes[""];return{unit:Z,prefix:V}}for(var H in q)if(Me(q,H)&&b0(P,H)){var J=q[H],K=P.length-H.length,fe=P.substring(0,K),pe=Me(J.prefixes,fe)?J.prefixes[fe]:void 0;if(pe!==void 0)return{unit:J,prefix:pe}}return null},{hasher:P=>P[0],limit:100});h.isValuelessUnit=function(P){return _(P)!==null},h.prototype.hasBase=function(P){if(typeof P=="string"&&(P=T[P]),!P)return!1;for(var Z=0;Z<z.length;Z++)if(Math.abs((this.dimensions[Z]||0)-(P.dimensions[Z]||0))>1e-12)return!1;return!0},h.prototype.equalBase=function(P){for(var Z=0;Z<z.length;Z++)if(Math.abs((this.dimensions[Z]||0)-(P.dimensions[Z]||0))>1e-12)return!1;return!0},h.prototype.equals=function(P){return this.equalBase(P)&&l(this.value,P.value)},h.prototype.multiply=function(P){for(var Z=this.clone(),V=Jr(P)?P:new h(P),H=0;H<z.length;H++)Z.dimensions[H]=(this.dimensions[H]||0)+(V.dimensions[H]||0);for(var J=0;J<V.units.length;J++){var K=io({},V.units[J]);Z.units.push(K)}if(this.value!==null||V.value!==null){var fe=this.value===null?this._normalize(1):this.value,pe=V.value===null?V._normalize(1):V.value;Z.value=a(fe,pe)}else Z.value=null;return Jr(P)&&(Z.skipAutomaticSimplification=!1),O(Z)},h.prototype.divideInto=function(P){return new h(P).divide(this)},h.prototype.divide=function(P){for(var Z=this.clone(),V=Jr(P)?P:new h(P),H=0;H<z.length;H++)Z.dimensions[H]=(this.dimensions[H]||0)-(V.dimensions[H]||0);for(var J=0;J<V.units.length;J++){var K=io(io({},V.units[J]),{},{power:-V.units[J].power});Z.units.push(K)}if(this.value!==null||V.value!==null){var fe=this.value===null?this._normalize(1):this.value,pe=V.value===null?V._normalize(1):V.value;Z.value=o(fe,pe)}else Z.value=null;return Jr(P)&&(Z.skipAutomaticSimplification=!1),O(Z)},h.prototype.pow=function(P){for(var Z=this.clone(),V=0;V<z.length;V++)Z.dimensions[V]=(this.dimensions[V]||0)*P;for(var H=0;H<Z.units.length;H++)Z.units[H].power*=P;return Z.value!==null?Z.value=f(Z.value,P):Z.value=null,Z.skipAutomaticSimplification=!1,O(Z)};function O(P){return P.equalBase(T.NONE)&&P.value!==null&&!n.predictable?P.value:P}h.prototype.abs=function(){var P=this.clone();if(P.value!==null)if(P._isDerived()||P.units.length===0||P.units[0].unit.offset===0)P.value=c(P.value);else{var Z=P._numberConverter(),V=Z(P.units[0].unit.value),H=Z(P.units[0].unit.offset),J=a(V,H);P.value=i(c(t(P.value,J)),J)}for(var K in P.units)(P.units[K].unit.name==="VA"||P.units[K].unit.name==="VAR")&&(P.units[K].unit=q.W);return P},h.prototype.to=function(P){var Z=this.value===null?this._normalize(1):this.value,V;if(typeof P=="string")V=h.parse(P);else if(Jr(P))V=P.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(V))throw new Error("Units do not match ('".concat(V.toString(),"' != '").concat(this.toString(),"')"));if(V.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units.length===0||V.units.length===0||this.units[0].unit.offset===V.units[0].unit.offset)V.value=Ie(Z);else{var H=h._getNumberConverter(nr(Z)),J=this.units[0].unit.value,K=this.units[0].unit.offset,fe=a(J,K),pe=V.units[0].unit.value,k=V.units[0].unit.offset,U=a(pe,k);V.value=t(Z,H(i(fe,U)))}return V.fixPrefix=!0,V.skipAutomaticSimplification=!0,V},h.prototype.toNumber=function(P){return b(this.toNumeric(P))},h.prototype.toNumeric=function(P){var Z;return P?Z=this.to(P):Z=this.clone(),Z._isDerived()||Z.units.length===0?Z._denormalize(Z.value):Z._denormalize(Z.value,Z.units[0].prefix.value)},h.prototype.toString=function(){return this.format()},h.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},h.fromJSON=function(P){var Z=new h(P.value,P.unit);return Z.fixPrefix=P.fixPrefix||!1,Z},h.prototype.valueOf=h.prototype.toString,h.prototype.simplify=function(){var P=this.clone(),Z=[],V;for(var H in ee)if(Me(ee,H)&&P.hasBase(T[H])){V=H;break}if(V==="NONE")P.units=[];else{var J;if(V&&Me(ee,V)&&(J=ee[V]),J)P.units=[{unit:J.unit,prefix:J.prefix,power:1}];else{for(var K=!1,fe=0;fe<z.length;fe++){var pe=z[fe];Math.abs(P.dimensions[fe]||0)>1e-12&&(Me(ee,pe)?Z.push({unit:ee[pe].unit,prefix:ee[pe].prefix,power:P.dimensions[fe]||0}):K=!0)}Z.length<P.units.length&&!K&&(P.units=Z)}}return P},h.prototype.toSI=function(){for(var P=this.clone(),Z=[],V=0;V<z.length;V++){var H=z[V];if(Math.abs(P.dimensions[V]||0)>1e-12)if(Me(Q.si,H))Z.push({unit:Q.si[H].unit,prefix:Q.si[H].prefix,power:P.dimensions[V]||0});else throw new Error("Cannot express custom unit "+H+" in SI units")}return P.units=Z,P.fixPrefix=!0,P.skipAutomaticSimplification=!0,this.value!==null?(P.value=null,this.to(P)):P},h.prototype.formatUnits=function(){for(var P="",Z="",V=0,H=0,J=0;J<this.units.length;J++)this.units[J].power>0?(V++,P+=" "+this.units[J].prefix.name+this.units[J].unit.name,Math.abs(this.units[J].power-1)>1e-15&&(P+="^"+this.units[J].power)):this.units[J].power<0&&H++;if(H>0)for(var K=0;K<this.units.length;K++)this.units[K].power<0&&(V>0?(Z+=" "+this.units[K].prefix.name+this.units[K].unit.name,Math.abs(this.units[K].power+1)>1e-15&&(Z+="^"+-this.units[K].power)):(Z+=" "+this.units[K].prefix.name+this.units[K].unit.name,Z+="^"+this.units[K].power));P=P.substr(1),Z=Z.substr(1),V>1&&H>0&&(P="("+P+")"),H>1&&V>0&&(Z="("+Z+")");var fe=P;return V>0&&H>0&&(fe+=" / "),fe+=Z,fe},h.prototype.format=function(P){var Z=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),V=!1;typeof Z.value<"u"&&Z.value!==null&&yt(Z.value)&&(V=Math.abs(Z.value.re)<1e-14);for(var H in Z.units)Me(Z.units,H)&&Z.units[H].unit&&(Z.units[H].unit.name==="VA"&&V?Z.units[H].unit=q.VAR:Z.units[H].unit.name==="VAR"&&!V&&(Z.units[H].unit=q.VA));Z.units.length===1&&!Z.fixPrefix&&Math.abs(Z.units[0].power-Math.round(Z.units[0].power))<1e-14&&(Z.units[0].prefix=Z._bestPrefix());var J=Z._denormalize(Z.value),K=Z.value!==null?m(J,P||{}):"",fe=Z.formatUnits();return Z.value&&yt(Z.value)&&(K="("+K+")"),fe.length>0&&K.length>0&&(K+=" "),K+=fe,K},h.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var P=this.value!==null?c(this.value):0,Z=c(this.units[0].unit.value),V=this.units[0].prefix;if(P===0)return V;var H=this.units[0].power,J=Math.log(P/Math.pow(V.value*Z,H))/Math.LN10-1.2;if(J>-2.200001&&J<1.800001)return V;J=Math.abs(J);var K=this.units[0].unit.prefixes;for(var fe in K)if(Me(K,fe)){var pe=K[fe];if(pe.scientific){var k=Math.abs(Math.log(P/Math.pow(pe.value*Z,H))/Math.LN10-1.2);(k<J||k===J&&pe.name.length<V.name.length)&&(V=pe,J=k)}}return V},h.prototype.splitUnit=function(P){for(var Z=this.clone(),V=[],H=0;H<P.length&&(Z=Z.to(P[H]),H!==P.length-1);H++){var J=Z.toNumeric(),K=s(J),fe=void 0,pe=l(K,J);pe?fe=K:fe=u(Z.toNumeric());var k=new h(fe,P[H].toString());V.push(k),Z=i(Z,k)}for(var U=0,G=0;G<V.length;G++)U=t(U,V[G].value);return l(U,this.value)&&(Z.value=0),V.push(Z),V};var C={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};C.SHORTLONG=dr({},C.SHORT,C.LONG),C.BINARY_SHORT=dr({},C.BINARY_SHORT_SI,C.BINARY_SHORT_IEC),C.BINARY_LONG=dr({},C.BINARY_LONG_SI,C.BINARY_LONG_IEC);var z=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],T={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var Y in T)Me(T,Y)&&(T[Y].key=Y);var te={},$={name:"",base:te,value:1,offset:0,dimensions:z.map(P=>0)},q={meter:{name:"meter",base:T.LENGTH,prefixes:C.LONG,value:1,offset:0},inch:{name:"inch",base:T.LENGTH,prefixes:C.NONE,value:.0254,offset:0},foot:{name:"foot",base:T.LENGTH,prefixes:C.NONE,value:.3048,offset:0},yard:{name:"yard",base:T.LENGTH,prefixes:C.NONE,value:.9144,offset:0},mile:{name:"mile",base:T.LENGTH,prefixes:C.NONE,value:1609.344,offset:0},link:{name:"link",base:T.LENGTH,prefixes:C.NONE,value:.201168,offset:0},rod:{name:"rod",base:T.LENGTH,prefixes:C.NONE,value:5.0292,offset:0},chain:{name:"chain",base:T.LENGTH,prefixes:C.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:T.LENGTH,prefixes:C.NONE,value:1e-10,offset:0},m:{name:"m",base:T.LENGTH,prefixes:C.SHORT,value:1,offset:0},in:{name:"in",base:T.LENGTH,prefixes:C.NONE,value:.0254,offset:0},ft:{name:"ft",base:T.LENGTH,prefixes:C.NONE,value:.3048,offset:0},yd:{name:"yd",base:T.LENGTH,prefixes:C.NONE,value:.9144,offset:0},mi:{name:"mi",base:T.LENGTH,prefixes:C.NONE,value:1609.344,offset:0},li:{name:"li",base:T.LENGTH,prefixes:C.NONE,value:.201168,offset:0},rd:{name:"rd",base:T.LENGTH,prefixes:C.NONE,value:5.02921,offset:0},ch:{name:"ch",base:T.LENGTH,prefixes:C.NONE,value:20.1168,offset:0},mil:{name:"mil",base:T.LENGTH,prefixes:C.NONE,value:254e-7,offset:0},m2:{name:"m2",base:T.SURFACE,prefixes:C.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:T.SURFACE,prefixes:C.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:T.SURFACE,prefixes:C.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:T.SURFACE,prefixes:C.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:T.SURFACE,prefixes:C.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:T.SURFACE,prefixes:C.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:T.SURFACE,prefixes:C.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:T.SURFACE,prefixes:C.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:T.SURFACE,prefixes:C.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:T.SURFACE,prefixes:C.NONE,value:1e4,offset:0},m3:{name:"m3",base:T.VOLUME,prefixes:C.CUBIC,value:1,offset:0},L:{name:"L",base:T.VOLUME,prefixes:C.SHORT,value:.001,offset:0},l:{name:"l",base:T.VOLUME,prefixes:C.SHORT,value:.001,offset:0},litre:{name:"litre",base:T.VOLUME,prefixes:C.LONG,value:.001,offset:0},cuin:{name:"cuin",base:T.VOLUME,prefixes:C.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:T.VOLUME,prefixes:C.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:T.VOLUME,prefixes:C.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:T.VOLUME,prefixes:C.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:T.VOLUME,prefixes:C.NONE,value:15e-6,offset:0},drop:{name:"drop",base:T.VOLUME,prefixes:C.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:T.VOLUME,prefixes:C.NONE,value:5e-8,offset:0},minim:{name:"minim",base:T.VOLUME,prefixes:C.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:T.VOLUME,prefixes:C.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:T.VOLUME,prefixes:C.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:T.VOLUME,prefixes:C.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:T.VOLUME,prefixes:C.NONE,value:1e-6,offset:0},cup:{name:"cup",base:T.VOLUME,prefixes:C.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:T.VOLUME,prefixes:C.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:T.VOLUME,prefixes:C.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:T.VOLUME,prefixes:C.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:T.VOLUME,prefixes:C.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:T.VOLUME,prefixes:C.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:T.VOLUME,prefixes:C.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:T.VOLUME,prefixes:C.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:T.VOLUME,prefixes:C.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:T.VOLUME,prefixes:C.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:T.VOLUME,prefixes:C.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:T.VOLUME,prefixes:C.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:T.VOLUME,prefixes:C.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:T.VOLUME,prefixes:C.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:T.VOLUME,prefixes:C.NONE,value:.1173478,offset:0},obl:{name:"obl",base:T.VOLUME,prefixes:C.NONE,value:.1589873,offset:0},g:{name:"g",base:T.MASS,prefixes:C.SHORT,value:.001,offset:0},gram:{name:"gram",base:T.MASS,prefixes:C.LONG,value:.001,offset:0},ton:{name:"ton",base:T.MASS,prefixes:C.SHORT,value:907.18474,offset:0},t:{name:"t",base:T.MASS,prefixes:C.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:T.MASS,prefixes:C.LONG,value:1e3,offset:0},grain:{name:"grain",base:T.MASS,prefixes:C.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:T.MASS,prefixes:C.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:T.MASS,prefixes:C.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:T.MASS,prefixes:C.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:T.MASS,prefixes:C.NONE,value:45.359237,offset:0},stick:{name:"stick",base:T.MASS,prefixes:C.NONE,value:.115,offset:0},stone:{name:"stone",base:T.MASS,prefixes:C.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:T.MASS,prefixes:C.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:T.MASS,prefixes:C.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:T.MASS,prefixes:C.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:T.MASS,prefixes:C.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:T.MASS,prefixes:C.NONE,value:45.359237,offset:0},s:{name:"s",base:T.TIME,prefixes:C.SHORT,value:1,offset:0},min:{name:"min",base:T.TIME,prefixes:C.NONE,value:60,offset:0},h:{name:"h",base:T.TIME,prefixes:C.NONE,value:3600,offset:0},second:{name:"second",base:T.TIME,prefixes:C.LONG,value:1,offset:0},sec:{name:"sec",base:T.TIME,prefixes:C.LONG,value:1,offset:0},minute:{name:"minute",base:T.TIME,prefixes:C.NONE,value:60,offset:0},hour:{name:"hour",base:T.TIME,prefixes:C.NONE,value:3600,offset:0},day:{name:"day",base:T.TIME,prefixes:C.NONE,value:86400,offset:0},week:{name:"week",base:T.TIME,prefixes:C.NONE,value:7*86400,offset:0},month:{name:"month",base:T.TIME,prefixes:C.NONE,value:2629800,offset:0},year:{name:"year",base:T.TIME,prefixes:C.NONE,value:31557600,offset:0},decade:{name:"decade",base:T.TIME,prefixes:C.NONE,value:315576e3,offset:0},century:{name:"century",base:T.TIME,prefixes:C.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:T.TIME,prefixes:C.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:T.FREQUENCY,prefixes:C.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:T.FREQUENCY,prefixes:C.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:T.ANGLE,prefixes:C.SHORT,value:1,offset:0},radian:{name:"radian",base:T.ANGLE,prefixes:C.LONG,value:1,offset:0},deg:{name:"deg",base:T.ANGLE,prefixes:C.SHORT,value:null,offset:0},degree:{name:"degree",base:T.ANGLE,prefixes:C.LONG,value:null,offset:0},grad:{name:"grad",base:T.ANGLE,prefixes:C.SHORT,value:null,offset:0},gradian:{name:"gradian",base:T.ANGLE,prefixes:C.LONG,value:null,offset:0},cycle:{name:"cycle",base:T.ANGLE,prefixes:C.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:T.ANGLE,prefixes:C.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:T.ANGLE,prefixes:C.NONE,value:null,offset:0},A:{name:"A",base:T.CURRENT,prefixes:C.SHORT,value:1,offset:0},ampere:{name:"ampere",base:T.CURRENT,prefixes:C.LONG,value:1,offset:0},K:{name:"K",base:T.TEMPERATURE,prefixes:C.SHORT,value:1,offset:0},degC:{name:"degC",base:T.TEMPERATURE,prefixes:C.SHORT,value:1,offset:273.15},degF:{name:"degF",base:T.TEMPERATURE,prefixes:C.SHORT,value:new v(5,9),offset:459.67},degR:{name:"degR",base:T.TEMPERATURE,prefixes:C.SHORT,value:new v(5,9),offset:0},kelvin:{name:"kelvin",base:T.TEMPERATURE,prefixes:C.LONG,value:1,offset:0},celsius:{name:"celsius",base:T.TEMPERATURE,prefixes:C.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:T.TEMPERATURE,prefixes:C.LONG,value:new v(5,9),offset:459.67},rankine:{name:"rankine",base:T.TEMPERATURE,prefixes:C.LONG,value:new v(5,9),offset:0},mol:{name:"mol",base:T.AMOUNT_OF_SUBSTANCE,prefixes:C.SHORT,value:1,offset:0},mole:{name:"mole",base:T.AMOUNT_OF_SUBSTANCE,prefixes:C.LONG,value:1,offset:0},cd:{name:"cd",base:T.LUMINOUS_INTENSITY,prefixes:C.SHORT,value:1,offset:0},candela:{name:"candela",base:T.LUMINOUS_INTENSITY,prefixes:C.LONG,value:1,offset:0},N:{name:"N",base:T.FORCE,prefixes:C.SHORT,value:1,offset:0},newton:{name:"newton",base:T.FORCE,prefixes:C.LONG,value:1,offset:0},dyn:{name:"dyn",base:T.FORCE,prefixes:C.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:T.FORCE,prefixes:C.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:T.FORCE,prefixes:C.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:T.FORCE,prefixes:C.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:T.FORCE,prefixes:C.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:T.FORCE,prefixes:C.NONE,value:9.80665,offset:0},J:{name:"J",base:T.ENERGY,prefixes:C.SHORT,value:1,offset:0},joule:{name:"joule",base:T.ENERGY,prefixes:C.LONG,value:1,offset:0},erg:{name:"erg",base:T.ENERGY,prefixes:C.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:T.ENERGY,prefixes:C.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:T.ENERGY,prefixes:C.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:T.ENERGY,prefixes:C.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:T.ENERGY,prefixes:C.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:T.POWER,prefixes:C.SHORT,value:1,offset:0},watt:{name:"watt",base:T.POWER,prefixes:C.LONG,value:1,offset:0},hp:{name:"hp",base:T.POWER,prefixes:C.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:T.POWER,prefixes:C.SHORT,value:g.I,offset:0},VA:{name:"VA",base:T.POWER,prefixes:C.SHORT,value:1,offset:0},Pa:{name:"Pa",base:T.PRESSURE,prefixes:C.SHORT,value:1,offset:0},psi:{name:"psi",base:T.PRESSURE,prefixes:C.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:T.PRESSURE,prefixes:C.NONE,value:101325,offset:0},bar:{name:"bar",base:T.PRESSURE,prefixes:C.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:T.PRESSURE,prefixes:C.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:T.PRESSURE,prefixes:C.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:T.PRESSURE,prefixes:C.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:T.PRESSURE,prefixes:C.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:T.ELECTRIC_CHARGE,prefixes:C.LONG,value:1,offset:0},C:{name:"C",base:T.ELECTRIC_CHARGE,prefixes:C.SHORT,value:1,offset:0},farad:{name:"farad",base:T.ELECTRIC_CAPACITANCE,prefixes:C.LONG,value:1,offset:0},F:{name:"F",base:T.ELECTRIC_CAPACITANCE,prefixes:C.SHORT,value:1,offset:0},volt:{name:"volt",base:T.ELECTRIC_POTENTIAL,prefixes:C.LONG,value:1,offset:0},V:{name:"V",base:T.ELECTRIC_POTENTIAL,prefixes:C.SHORT,value:1,offset:0},ohm:{name:"ohm",base:T.ELECTRIC_RESISTANCE,prefixes:C.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:T.ELECTRIC_INDUCTANCE,prefixes:C.LONG,value:1,offset:0},H:{name:"H",base:T.ELECTRIC_INDUCTANCE,prefixes:C.SHORT,value:1,offset:0},siemens:{name:"siemens",base:T.ELECTRIC_CONDUCTANCE,prefixes:C.LONG,value:1,offset:0},S:{name:"S",base:T.ELECTRIC_CONDUCTANCE,prefixes:C.SHORT,value:1,offset:0},weber:{name:"weber",base:T.MAGNETIC_FLUX,prefixes:C.LONG,value:1,offset:0},Wb:{name:"Wb",base:T.MAGNETIC_FLUX,prefixes:C.SHORT,value:1,offset:0},tesla:{name:"tesla",base:T.MAGNETIC_FLUX_DENSITY,prefixes:C.LONG,value:1,offset:0},T:{name:"T",base:T.MAGNETIC_FLUX_DENSITY,prefixes:C.SHORT,value:1,offset:0},b:{name:"b",base:T.BIT,prefixes:C.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:T.BIT,prefixes:C.BINARY_LONG,value:1,offset:0},B:{name:"B",base:T.BIT,prefixes:C.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:T.BIT,prefixes:C.BINARY_LONG,value:8,offset:0}},ne={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function se(P){if(P.number==="BigNumber"){var Z=no(w);q.rad.value=new w(1),q.deg.value=Z.div(180),q.grad.value=Z.div(200),q.cycle.value=Z.times(2),q.arcsec.value=Z.div(648e3),q.arcmin.value=Z.div(10800)}else q.rad.value=1,q.deg.value=Math.PI/180,q.grad.value=Math.PI/200,q.cycle.value=Math.PI*2,q.arcsec.value=Math.PI/648e3,q.arcmin.value=Math.PI/10800;q.radian.value=q.rad.value,q.degree.value=q.deg.value,q.gradian.value=q.grad.value}se(n),r&&r("config",function(P,Z){P.number!==Z.number&&se(P)});var Q={si:{NONE:{unit:$,prefix:C.NONE[""]},LENGTH:{unit:q.m,prefix:C.SHORT[""]},MASS:{unit:q.g,prefix:C.SHORT.k},TIME:{unit:q.s,prefix:C.SHORT[""]},CURRENT:{unit:q.A,prefix:C.SHORT[""]},TEMPERATURE:{unit:q.K,prefix:C.SHORT[""]},LUMINOUS_INTENSITY:{unit:q.cd,prefix:C.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:q.mol,prefix:C.SHORT[""]},ANGLE:{unit:q.rad,prefix:C.SHORT[""]},BIT:{unit:q.bits,prefix:C.SHORT[""]},FORCE:{unit:q.N,prefix:C.SHORT[""]},ENERGY:{unit:q.J,prefix:C.SHORT[""]},POWER:{unit:q.W,prefix:C.SHORT[""]},PRESSURE:{unit:q.Pa,prefix:C.SHORT[""]},ELECTRIC_CHARGE:{unit:q.C,prefix:C.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:q.F,prefix:C.SHORT[""]},ELECTRIC_POTENTIAL:{unit:q.V,prefix:C.SHORT[""]},ELECTRIC_RESISTANCE:{unit:q.ohm,prefix:C.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:q.H,prefix:C.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:q.S,prefix:C.SHORT[""]},MAGNETIC_FLUX:{unit:q.Wb,prefix:C.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:q.T,prefix:C.SHORT[""]},FREQUENCY:{unit:q.Hz,prefix:C.SHORT[""]}}};Q.cgs=JSON.parse(JSON.stringify(Q.si)),Q.cgs.LENGTH={unit:q.m,prefix:C.SHORT.c},Q.cgs.MASS={unit:q.g,prefix:C.SHORT[""]},Q.cgs.FORCE={unit:q.dyn,prefix:C.SHORT[""]},Q.cgs.ENERGY={unit:q.erg,prefix:C.NONE[""]},Q.us=JSON.parse(JSON.stringify(Q.si)),Q.us.LENGTH={unit:q.ft,prefix:C.NONE[""]},Q.us.MASS={unit:q.lbm,prefix:C.NONE[""]},Q.us.TEMPERATURE={unit:q.degF,prefix:C.NONE[""]},Q.us.FORCE={unit:q.lbf,prefix:C.NONE[""]},Q.us.ENERGY={unit:q.BTU,prefix:C.BTU[""]},Q.us.POWER={unit:q.hp,prefix:C.NONE[""]},Q.us.PRESSURE={unit:q.psi,prefix:C.NONE[""]},Q.auto=JSON.parse(JSON.stringify(Q.si));var ee=Q.auto;h.setUnitSystem=function(P){if(Me(Q,P))ee=Q[P];else throw new Error("Unit system "+P+" does not exist. Choices are: "+Object.keys(Q).join(", "))},h.getUnitSystem=function(){for(var P in Q)if(Me(Q,P)&&Q[P]===ee)return P},h.typeConverters={BigNumber:function(P){return P!=null&&P.isFraction?new w(P.n).div(P.d).times(P.s):new w(P+"")},Fraction:function(P){return new v(P)},Complex:function(P){return P},number:function(P){return P!=null&&P.isFraction?d(P):P}},h.prototype._numberConverter=function(){var P=h.typeConverters[this.valueType()];if(P)return P;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},h._getNumberConverter=function(P){if(!h.typeConverters[P])throw new TypeError('Unsupported type "'+P+'"');return h.typeConverters[P]};for(var ue in q)if(Me(q,ue)){var X=q[ue];X.dimensions=X.base.dimensions}for(var ie in ne)if(Me(ne,ie)){var oe=q[ne[ie]],ce={};for(var ye in oe)Me(oe,ye)&&(ce[ye]=oe[ye]);ce.name=ie,q[ie]=ce}h.isValidAlpha=function(P){return/^[a-zA-Z]$/.test(P)};function Ae(P){for(var Z=0;Z<P.length;Z++){if(N=P.charAt(Z),Z===0&&!h.isValidAlpha(N))throw new Error('Invalid unit name (must begin with alpha character): "'+P+'"');if(Z>0&&!(h.isValidAlpha(N)||D(N)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+P+'"')}}return h.createUnit=function(P,Z){if(typeof P!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(Z&&Z.override){for(var V in P)if(Me(P,V)&&h.deleteUnit(V),P[V].aliases)for(var H=0;H<P[V].aliases.length;H++)h.deleteUnit(P[V].aliases[H])}var J;for(var K in P)Me(P,K)&&(J=h.createUnitSingle(K,P[K]));return J},h.createUnitSingle=function(P,Z){if((typeof Z>"u"||Z===null)&&(Z={}),typeof P!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Me(q,P))throw new Error('Cannot create unit "'+P+'": a unit with that name already exists');Ae(P);var V=null,H=[],J=0,K,fe,pe;if(Z&&Z.type==="Unit")V=Z.clone();else if(typeof Z=="string")Z!==""&&(K=Z);else if(typeof Z=="object")K=Z.definition,fe=Z.prefixes,J=Z.offset,pe=Z.baseName,Z.aliases&&(H=Z.aliases.valueOf());else throw new TypeError('Cannot create unit "'+P+'" from "'+Z.toString()+'": expecting "string" or "Unit" or "Object"');if(H){for(var k=0;k<H.length;k++)if(Me(q,H[k]))throw new Error('Cannot create alias "'+H[k]+'": a unit with that name already exists')}if(K&&typeof K=="string"&&!V)try{V=h.parse(K,{allowNoUnits:!0})}catch(F){throw F.message='Could not create unit "'+P+'" from "'+K+'": '+F.message,F}else K&&K.type==="Unit"&&(V=K.clone());H=H||[],J=J||0,fe&&fe.toUpperCase?fe=C[fe.toUpperCase()]||C.NONE:fe=C.NONE;var U={};if(V){U={name:P,value:V.value,dimensions:V.dimensions.slice(0),prefixes:fe,offset:J};var G=!1;for(var re in T)if(Me(T,re)){for(var le=!0,me=0;me<z.length;me++)if(Math.abs((U.dimensions[me]||0)-(T[re].dimensions[me]||0))>1e-12){le=!1;break}if(le){G=!0,U.base=T[re];break}}if(!G){pe=pe||P+"_STUFF";var xe={dimensions:V.dimensions.slice(0)};xe.key=pe,T[pe]=xe,ee[pe]={unit:U,prefix:C.NONE[""]},U.base=T[pe]}}else{if(pe=pe||P+"_STUFF",z.indexOf(pe)>=0)throw new Error('Cannot create new base unit "'+P+'": a base unit with that name already exists (and cannot be overridden)');z.push(pe);for(var he in T)Me(T,he)&&(T[he].dimensions[z.length-1]=0);for(var De={dimensions:[]},Ne=0;Ne<z.length;Ne++)De.dimensions[Ne]=0;De.dimensions[z.length-1]=1,De.key=pe,T[pe]=De,U={name:P,value:1,dimensions:T[pe].dimensions.slice(0),prefixes:fe,offset:J,base:T[pe]},ee[pe]={unit:U,prefix:C.NONE[""]}}h.UNITS[P]=U;for(var We=0;We<H.length;We++){var Ye=H[We],Fe={};for(var cr in U)Me(U,cr)&&(Fe[cr]=U[cr]);Fe.name=Ye,h.UNITS[Ye]=Fe}return delete _.cache,new h(null,P)},h.deleteUnit=function(P){delete h.UNITS[P]},h.PREFIXES=C,h.BASE_DIMENSIONS=z,h.BASE_UNITS=T,h.UNIT_SYSTEMS=Q,h.UNITS=q,h},{isClass:!0}),pf="unit",zw=["typed","Unit"],Rw=R(pf,zw,e=>{var{typed:r,Unit:n}=e;return r(pf,{Unit:function(t){return t.clone()},string:function(t){return n.isValuelessUnit(t)?new n(null,t):n.parse(t,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(t,i){return new n(t,i)},"number | BigNumber | Fraction":function(t){return new n(t)},"Array | Matrix":r.referToSelf(t=>i=>$e(i,t))})}),mf="sparse",qw=["typed","SparseMatrix"],kw=R(mf,qw,e=>{var{typed:r,SparseMatrix:n}=e;return r(mf,{"":function(){return new n([])},string:function(t){return new n([],t)},"Array | Matrix":function(t){return new n(t)},"Array | Matrix, string":function(t,i){return new n(t,i)}})}),df="createUnit",jw=["typed","Unit"],Pw=R(df,jw,e=>{var{typed:r,Unit:n}=e;return r(df,{"Object, Object":function(t,i){return n.createUnit(t,i)},Object:function(t){return n.createUnit(t,{})},"string, Unit | string | Object, Object":function(t,i,a){var o={};return o[t]=i,n.createUnit(o,a)},"string, Unit | string | Object":function(t,i){var a={};return a[t]=i,n.createUnit(a,{})},string:function(t){var i={};return i[t]={},n.createUnit(i,{})}})}),hf="acos",Uw=["typed","config","Complex"],Lw=R(hf,Uw,e=>{var{typed:r,config:n,Complex:t}=e;return r(hf,{number:function(i){return i>=-1&&i<=1||n.predictable?Math.acos(i):new t(i,0).acos()},Complex:function(i){return i.acos()},BigNumber:function(i){return i.acos()}})}),gf="acosh",Hw=["typed","config","Complex"],$w=R(gf,Hw,e=>{var{typed:r,config:n,Complex:t}=e;return r(gf,{number:function(i){return i>=1||n.predictable?bu(i):i<=-1?new t(Math.log(Math.sqrt(i*i-1)-i),Math.PI):new t(i,0).acosh()},Complex:function(i){return i.acosh()},BigNumber:function(i){return i.acosh()}})}),vf="acot",Zw=["typed","BigNumber"],Jw=R(vf,Zw,e=>{var{typed:r,BigNumber:n}=e;return r(vf,{number:wu,Complex:function(t){return t.acot()},BigNumber:function(t){return new n(1).div(t).atan()}})}),yf="acoth",Ww=["typed","config","Complex","BigNumber"],Yw=R(yf,Ww,e=>{var{typed:r,config:n,Complex:t,BigNumber:i}=e;return r(yf,{number:function(a){return a>=1||a<=-1||n.predictable?Nu(a):new t(a,0).acoth()},Complex:function(a){return a.acoth()},BigNumber:function(a){return new i(1).div(a).atanh()}})}),xf="acsc",Gw=["typed","config","Complex","BigNumber"],Vw=R(xf,Gw,e=>{var{typed:r,config:n,Complex:t,BigNumber:i}=e;return r(xf,{number:function(a){return a<=-1||a>=1||n.predictable?Du(a):new t(a,0).acsc()},Complex:function(a){return a.acsc()},BigNumber:function(a){return new i(1).div(a).asin()}})}),bf="acsch",Kw=["typed","BigNumber"],Qw=R(bf,Kw,e=>{var{typed:r,BigNumber:n}=e;return r(bf,{number:Au,Complex:function(t){return t.acsch()},BigNumber:function(t){return new n(1).div(t).asinh()}})}),wf="asec",Xw=["typed","config","Complex","BigNumber"],e2=R(wf,Xw,e=>{var{typed:r,config:n,Complex:t,BigNumber:i}=e;return r(wf,{number:function(a){return a<=-1||a>=1||n.predictable?Eu(a):new t(a,0).asec()},Complex:function(a){return a.asec()},BigNumber:function(a){return new i(1).div(a).acos()}})}),Nf="asech",r2=["typed","config","Complex","BigNumber"],t2=R(Nf,r2,e=>{var{typed:r,config:n,Complex:t,BigNumber:i}=e;return r(Nf,{number:function(a){if(a<=1&&a>=-1||n.predictable){var o=1/a;if(o>0||n.predictable)return Mu(a);var f=Math.sqrt(o*o-1);return new t(Math.log(f-o),Math.PI)}return new t(a,0).asech()},Complex:function(a){return a.asech()},BigNumber:function(a){return new i(1).div(a).acosh()}})}),Df="asin",n2=["typed","config","Complex"],i2=R(Df,n2,e=>{var{typed:r,config:n,Complex:t}=e;return r(Df,{number:function(i){return i>=-1&&i<=1||n.predictable?Math.asin(i):new t(i,0).asin()},Complex:function(i){return i.asin()},BigNumber:function(i){return i.asin()}})}),a2="asinh",o2=["typed"],s2=R(a2,o2,e=>{var{typed:r}=e;return r("asinh",{number:Su,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})}),u2="atan",l2=["typed"],c2=R(u2,l2,e=>{var{typed:r}=e;return r("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})}),Af="atan2",f2=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],p2=R(Af,f2,e=>{var{typed:r,matrix:n,equalScalar:t,BigNumber:i,DenseMatrix:a,concat:o}=e,f=at({typed:r,equalScalar:t}),c=_r({typed:r}),u=El({typed:r,equalScalar:t}),s=Ar({typed:r,equalScalar:t}),l=gr({typed:r,DenseMatrix:a}),p=sr({typed:r,matrix:n,concat:o});return r(Af,{"number, number":Math.atan2,"BigNumber, BigNumber":(m,d)=>i.atan2(m,d)},p({scalar:"number | BigNumber",SS:u,DS:c,SD:f,Ss:s,sS:l}))}),Ef="atanh",m2=["typed","config","Complex"],d2=R(Ef,m2,e=>{var{typed:r,config:n,Complex:t}=e;return r(Ef,{number:function(i){return i<=1&&i>=-1||n.predictable?Fu(i):new t(i,0).atanh()},Complex:function(i){return i.atanh()},BigNumber:function(i){return i.atanh()}})}),On=R("trigUnit",["typed"],e=>{var{typed:r}=e;return{Unit:r.referToSelf(n=>t=>{if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return r.find(n,t.valueType())(t.value)})}}),Mf="cos",h2=["typed"],g2=R(Mf,h2,e=>{var{typed:r}=e,n=On({typed:r});return r(Mf,{number:Math.cos,"Complex | BigNumber":t=>t.cos()},n)}),Sf="cosh",v2=["typed"],y2=R(Sf,v2,e=>{var{typed:r}=e;return r(Sf,{number:m0,"Complex | BigNumber":n=>n.cosh()})}),Ff="cot",x2=["typed","BigNumber"],b2=R(Ff,x2,e=>{var{typed:r,BigNumber:n}=e,t=On({typed:r});return r(Ff,{number:Cu,Complex:i=>i.cot(),BigNumber:i=>new n(1).div(i.tan())},t)}),Cf="coth",w2=["typed","BigNumber"],N2=R(Cf,w2,e=>{var{typed:r,BigNumber:n}=e;return r(Cf,{number:Bu,Complex:t=>t.coth(),BigNumber:t=>new n(1).div(t.tanh())})}),Bf="csc",D2=["typed","BigNumber"],A2=R(Bf,D2,e=>{var{typed:r,BigNumber:n}=e,t=On({typed:r});return r(Bf,{number:Ou,Complex:i=>i.csc(),BigNumber:i=>new n(1).div(i.sin())},t)}),Of="csch",E2=["typed","BigNumber"],M2=R(Of,E2,e=>{var{typed:r,BigNumber:n}=e;return r(Of,{number:Tu,Complex:t=>t.csch(),BigNumber:t=>new n(1).div(t.sinh())})}),Tf="sec",S2=["typed","BigNumber"],F2=R(Tf,S2,e=>{var{typed:r,BigNumber:n}=e,t=On({typed:r});return r(Tf,{number:_u,Complex:i=>i.sec(),BigNumber:i=>new n(1).div(i.cos())},t)}),_f="sech",C2=["typed","BigNumber"],B2=R(_f,C2,e=>{var{typed:r,BigNumber:n}=e;return r(_f,{number:Iu,Complex:t=>t.sech(),BigNumber:t=>new n(1).div(t.cosh())})}),If="sin",O2=["typed"],T2=R(If,O2,e=>{var{typed:r}=e,n=On({typed:r});return r(If,{number:Math.sin,"Complex | BigNumber":t=>t.sin()},n)}),zf="sinh",_2=["typed"],I2=R(zf,_2,e=>{var{typed:r}=e;return r(zf,{number:zu,"Complex | BigNumber":n=>n.sinh()})}),Rf="tan",z2=["typed"],R2=R(Rf,z2,e=>{var{typed:r}=e,n=On({typed:r});return r(Rf,{number:Math.tan,"Complex | BigNumber":t=>t.tan()},n)}),q2="tanh",k2=["typed"],j2=R(q2,k2,e=>{var{typed:r}=e;return r("tanh",{number:h0,"Complex | BigNumber":n=>n.tanh()})}),qf="setCartesian",P2=["typed","size","subset","compareNatural","Index","DenseMatrix"],U2=R(qf,P2,e=>{var{typed:r,size:n,subset:t,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(qf,{"Array | Matrix, Array | Matrix":function(f,c){var u=[];if(t(n(f),new a(0))!==0&&t(n(c),new a(0))!==0){var s=Ke(Array.isArray(f)?f:f.toArray()).sort(i),l=Ke(Array.isArray(c)?c:c.toArray()).sort(i);u=[];for(var p=0;p<s.length;p++)for(var m=0;m<l.length;m++)u.push([s[p],l[m]])}return Array.isArray(f)&&Array.isArray(c)?u:new o(u)}})}),kf="setDifference",L2=["typed","size","subset","compareNatural","Index","DenseMatrix"],H2=R(kf,L2,e=>{var{typed:r,size:n,subset:t,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(kf,{"Array | Matrix, Array | Matrix":function(f,c){var u;if(t(n(f),new a(0))===0)u=[];else{if(t(n(c),new a(0))===0)return Ke(f.toArray());var s=gn(Ke(Array.isArray(f)?f:f.toArray()).sort(i)),l=gn(Ke(Array.isArray(c)?c:c.toArray()).sort(i));u=[];for(var p,m=0;m<s.length;m++){p=!1;for(var d=0;d<l.length;d++)if(i(s[m].value,l[d].value)===0&&s[m].identifier===l[d].identifier){p=!0;break}p||u.push(s[m])}}return Array.isArray(f)&&Array.isArray(c)?bi(u):new o(bi(u))}})}),jf="setDistinct",$2=["typed","size","subset","compareNatural","Index","DenseMatrix"],Z2=R(jf,$2,e=>{var{typed:r,size:n,subset:t,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(jf,{"Array | Matrix":function(f){var c;if(t(n(f),new a(0))===0)c=[];else{var u=Ke(Array.isArray(f)?f:f.toArray()).sort(i);c=[],c.push(u[0]);for(var s=1;s<u.length;s++)i(u[s],u[s-1])!==0&&c.push(u[s])}return Array.isArray(f)?c:new o(c)}})}),Pf="setIntersect",J2=["typed","size","subset","compareNatural","Index","DenseMatrix"],W2=R(Pf,J2,e=>{var{typed:r,size:n,subset:t,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Pf,{"Array | Matrix, Array | Matrix":function(f,c){var u;if(t(n(f),new a(0))===0||t(n(c),new a(0))===0)u=[];else{var s=gn(Ke(Array.isArray(f)?f:f.toArray()).sort(i)),l=gn(Ke(Array.isArray(c)?c:c.toArray()).sort(i));u=[];for(var p=0;p<s.length;p++)for(var m=0;m<l.length;m++)if(i(s[p].value,l[m].value)===0&&s[p].identifier===l[m].identifier){u.push(s[p]);break}}return Array.isArray(f)&&Array.isArray(c)?bi(u):new o(bi(u))}})}),Uf="setIsSubset",Y2=["typed","size","subset","compareNatural","Index"],G2=R(Uf,Y2,e=>{var{typed:r,size:n,subset:t,compareNatural:i,Index:a}=e;return r(Uf,{"Array | Matrix, Array | Matrix":function(o,f){if(t(n(o),new a(0))===0)return!0;if(t(n(f),new a(0))===0)return!1;for(var c=gn(Ke(Array.isArray(o)?o:o.toArray()).sort(i)),u=gn(Ke(Array.isArray(f)?f:f.toArray()).sort(i)),s,l=0;l<c.length;l++){s=!1;for(var p=0;p<u.length;p++)if(i(c[l].value,u[p].value)===0&&c[l].identifier===u[p].identifier){s=!0;break}if(s===!1)return!1}return!0}})}),Lf="setMultiplicity",V2=["typed","size","subset","compareNatural","Index"],K2=R(Lf,V2,e=>{var{typed:r,size:n,subset:t,compareNatural:i,Index:a}=e;return r(Lf,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(o,f){if(t(n(f),new a(0))===0)return 0;for(var c=Ke(Array.isArray(f)?f:f.toArray()),u=0,s=0;s<c.length;s++)i(c[s],o)===0&&u++;return u}})}),Hf="setPowerset",Q2=["typed","size","subset","compareNatural","Index"],X2=R(Hf,Q2,e=>{var{typed:r,size:n,subset:t,compareNatural:i,Index:a}=e;return r(Hf,{"Array | Matrix":function(c){if(t(n(c),new a(0))===0)return[];for(var u=Ke(Array.isArray(c)?c:c.toArray()).sort(i),s=[],l=0;l.toString(2).length<=u.length;)s.push(o(u,l.toString(2).split("").reverse())),l++;return f(s)}});function o(c,u){for(var s=[],l=0;l<u.length;l++)u[l]==="1"&&s.push(c[l]);return s}function f(c){for(var u=[],s=c.length-1;s>0;s--)for(var l=0;l<s;l++)c[l].length>c[l+1].length&&(u=c[l],c[l]=c[l+1],c[l+1]=u);return c}}),$f="setSize",eN=["typed","compareNatural"],rN=R($f,eN,e=>{var{typed:r,compareNatural:n}=e;return r($f,{"Array | Matrix":function(t){return Array.isArray(t)?Ke(t).length:Ke(t.toArray()).length},"Array | Matrix, boolean":function(t,i){if(i===!1||t.length===0)return Array.isArray(t)?Ke(t).length:Ke(t.toArray()).length;for(var a=Ke(Array.isArray(t)?t:t.toArray()).sort(n),o=1,f=1;f<a.length;f++)n(a[f],a[f-1])!==0&&o++;return o}})}),Zf="setSymDifference",tN=["typed","size","concat","subset","setDifference","Index"],nN=R(Zf,tN,e=>{var{typed:r,size:n,concat:t,subset:i,setDifference:a,Index:o}=e;return r(Zf,{"Array | Matrix, Array | Matrix":function(f,c){if(i(n(f),new o(0))===0)return Ke(c);if(i(n(c),new o(0))===0)return Ke(f);var u=Ke(f),s=Ke(c);return t(a(u,s),a(s,u))}})}),Jf="setUnion",iN=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],aN=R(Jf,iN,e=>{var{typed:r,size:n,concat:t,subset:i,setIntersect:a,setSymDifference:o,Index:f}=e;return r(Jf,{"Array | Matrix, Array | Matrix":function(c,u){if(i(n(c),new f(0))===0)return Ke(u);if(i(n(u),new f(0))===0)return Ke(c);var s=Ke(c),l=Ke(u);return t(o(s,l),a(s,l))}})}),Wf="add",oN=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],sN=R(Wf,oN,e=>{var{typed:r,matrix:n,addScalar:t,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:f}=e,c=qt({typed:r}),u=Ka({typed:r,equalScalar:i}),s=Kt({typed:r,DenseMatrix:a}),l=sr({typed:r,matrix:n,concat:f});return r(Wf,{"any, any":t,"any, any, ...any":r.referToSelf(p=>(m,d,g)=>{for(var w=p(m,d),v=0;v<g.length;v++)w=p(w,g[v]);return w})},l({elop:t,DS:c,SS:u,Ss:s}))}),Yf="hypot",uN=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],lN=R(Yf,uN,e=>{var{typed:r,abs:n,addScalar:t,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:f,isPositive:c}=e;return r(Yf,{"... number | BigNumber":u,Array:u,Matrix:s=>u(Ke(s.toArray()))});function u(s){for(var l=0,p=0,m=0;m<s.length;m++){if(yt(s[m]))throw new TypeError("Unexpected type of argument to hypot");var d=n(s[m]);f(p,d)?(l=a(l,a(i(p,d),i(p,d))),l=t(l,1),p=d):l=t(l,c(d)?a(i(d,p),i(d,p)):d)}return a(p,o(l))}}),Gf="norm",cN=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],fN=R(Gf,cN,e=>{var{typed:r,abs:n,add:t,pow:i,conj:a,sqrt:o,multiply:f,equalScalar:c,larger:u,smaller:s,matrix:l,ctranspose:p,eigs:m}=e;return r(Gf,{number:Math.abs,Complex:function(A){return A.abs()},BigNumber:function(A){return A.abs()},boolean:function(A){return Math.abs(A)},Array:function(A){return N(l(A),2)},Matrix:function(A){return N(A,2)},"Array, number | BigNumber | string":function(A,E){return N(l(A),E)},"Matrix, number | BigNumber | string":function(A,E){return N(A,E)}});function d(A){var E=0;return A.forEach(function(D){var M=n(D);u(M,E)&&(E=M)},!0),E}function g(A){var E;return A.forEach(function(D){var M=n(D);(!E||s(M,E))&&(E=M)},!0),E||0}function w(A,E){if(E===Number.POSITIVE_INFINITY||E==="inf")return d(A);if(E===Number.NEGATIVE_INFINITY||E==="-inf")return g(A);if(E==="fro")return N(A,2);if(typeof E=="number"&&!isNaN(E)){if(!c(E,0)){var D=0;return A.forEach(function(M){D=t(i(n(M),E),D)},!0),i(D,1/E)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function v(A){var E=0;return A.forEach(function(D,M){E=t(E,f(D,a(D)))}),n(o(E))}function b(A){var E=[],D=0;return A.forEach(function(M,S){var B=S[1],I=t(E[B]||0,n(M));u(I,D)&&(D=I),E[B]=I},!0),D}function h(A){var E=A.size();if(E[0]!==E[1])throw new RangeError("Invalid matrix dimensions");var D=p(A),M=f(D,A),S=m(M).values.toArray(),B=S[S.length-1];return n(o(B))}function x(A){var E=[],D=0;return A.forEach(function(M,S){var B=S[0],I=t(E[B]||0,n(M));u(I,D)&&(D=I),E[B]=I},!0),D}function y(A,E){if(E===1)return b(A);if(E===Number.POSITIVE_INFINITY||E==="inf")return x(A);if(E==="fro")return v(A);if(E===2)return h(A);throw new Error("Unsupported parameter value "+E)}function N(A,E){var D=A.size();if(D.length===1)return w(A,E);if(D.length===2){if(D[0]&&D[1])return y(A,E);throw new RangeError("Invalid matrix dimensions")}}}),Vf="dot",pN=["typed","addScalar","multiplyScalar","conj","size"],mN=R(Vf,pN,e=>{var{typed:r,addScalar:n,multiplyScalar:t,conj:i,size:a}=e;return r(Vf,{"Array | DenseMatrix, Array | DenseMatrix":f,"SparseMatrix, SparseMatrix":c});function o(s,l){var p=u(s),m=u(l),d,g;if(p.length===1)d=p[0];else if(p.length===2&&p[1]===1)d=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(m.length===1)g=m[0];else if(m.length===2&&m[1]===1)g=m[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+m.join(", ")+")");if(d!==g)throw new RangeError("Vectors must have equal length ("+d+" != "+g+")");if(d===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return d}function f(s,l){var p=o(s,l),m=Be(s)?s._data:s,d=Be(s)?s._datatype:void 0,g=Be(l)?l._data:l,w=Be(l)?l._datatype:void 0,v=u(s).length===2,b=u(l).length===2,h=n,x=t;if(d&&w&&d===w&&typeof d=="string"){var y=d;h=r.find(n,[y,y]),x=r.find(t,[y,y])}if(!v&&!b){for(var N=x(i(m[0]),g[0]),A=1;A<p;A++)N=h(N,x(i(m[A]),g[A]));return N}if(!v&&b){for(var E=x(i(m[0]),g[0][0]),D=1;D<p;D++)E=h(E,x(i(m[D]),g[D][0]));return E}if(v&&!b){for(var M=x(i(m[0][0]),g[0]),S=1;S<p;S++)M=h(M,x(i(m[S][0]),g[S]));return M}if(v&&b){for(var B=x(i(m[0][0]),g[0][0]),I=1;I<p;I++)B=h(B,x(i(m[I][0]),g[I][0]));return B}}function c(s,l){o(s,l);for(var p=s._index,m=s._values,d=l._index,g=l._values,w=0,v=n,b=t,h=0,x=0;h<p.length&&x<d.length;){var y=p[h],N=d[x];if(y<N){h++;continue}if(y>N){x++;continue}y===N&&(w=v(w,b(m[h],g[x])),h++,x++)}return w}function u(s){return Be(s)?s.size():a(s)}}),dN="trace",hN=["typed","matrix","add"],gN=R(dN,hN,e=>{var{typed:r,matrix:n,add:t}=e;return r("trace",{Array:function(o){return i(n(o))},SparseMatrix:a,DenseMatrix:i,any:Ie});function i(o){var f=o._size,c=o._data;switch(f.length){case 1:if(f[0]===1)return Ie(c[0]);throw new RangeError("Matrix must be square (size: "+Le(f)+")");case 2:{var u=f[0],s=f[1];if(u===s){for(var l=0,p=0;p<u;p++)l=t(l,c[p][p]);return l}else throw new RangeError("Matrix must be square (size: "+Le(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Le(f)+")")}}function a(o){var f=o._values,c=o._index,u=o._ptr,s=o._size,l=s[0],p=s[1];if(l===p){var m=0;if(f.length>0)for(var d=0;d<p;d++)for(var g=u[d],w=u[d+1],v=g;v<w;v++){var b=c[v];if(b===d){m=t(m,f[v]);break}if(b>d)break}return m}throw new RangeError("Matrix must be square (size: "+Le(s)+")")}}),Kf="index",vN=["typed","Index"],yN=R(Kf,vN,e=>{var{typed:r,Index:n}=e;return r(Kf,{"...number | string | BigNumber | Range | Array | Matrix":function(t){var i=t.map(function(o){return je(o)?o.toNumber():Xe(o)||Be(o)?o.map(function(f){return je(f)?f.toNumber():f}):o}),a=new n;return n.apply(a,i),a}})}),Qf=new Set(["end"]),xN="Node",bN=["mathWithTransform"],wN=R(xN,bN,e=>{var{mathWithTransform:r}=e;function n(i){for(var a of[...Qf])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class t{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(r,{}),o={},f=null;function c(u){var s=xn(u);return n(s),a(s,o,f)}return{evaluate:c}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!tr(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(f,c){f.forEach(function(u,s,l){c(u,s,l),o(u,c)})}o(this,a)}transform(a){function o(f,c,u){var s=a(f,c,u);return s!==f?s:f.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(f,c,u){a(f,c,u)&&o.push(f)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&Yt(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toString(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toHTML(a)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return t},{isClass:!0,isNode:!0});function zr(e){return e&&e.isIndexError?new et(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function Xf(e){var{subset:r}=e;return function(n,t){try{if(Array.isArray(n))return r(n,t);if(n&&typeof n.subset=="function")return n.subset(t);if(typeof n=="string")return r(n,t);if(typeof n=="object"){if(!t.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Tr(n,t.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(i){throw zr(i)}}}var Yi="AccessorNode",NN=["subset","Node"],DN=R(Yi,NN,e=>{var{subset:r,Node:n}=e,t=Xf({subset:r});function i(o){return!(Wt(o)||Yr(o)||Ve(o)||Bt(o)||mi(o)||xt(o)||br(o))}class a extends n{constructor(f,c){if(super(),!tr(f))throw new TypeError('Node expected for parameter "object"');if(!ln(c))throw new TypeError('IndexNode expected for parameter "index"');this.object=f,this.index=c}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Yi}get isAccessorNode(){return!0}_compile(f,c){var u=this.object._compile(f,c),s=this.index._compile(f,c);if(this.index.isObjectProperty()){var l=this.index.getObjectProperty();return function(p,m,d){return Tr(u(p,m,d),l)}}else return function(p,m,d){var g=u(p,m,d),w=s(p,m,g);return t(g,w)}}forEach(f){f(this.object,"object",this),f(this.index,"index",this)}map(f){return new a(this._ifNode(f(this.object,"object",this)),this._ifNode(f(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(f){var c=this.object.toString(f);return i(this.object)&&(c="("+c+")"),c+this.index.toString(f)}_toHTML(f){var c=this.object.toHTML(f);return i(this.object)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+this.index.toHTML(f)}_toTex(f){var c=this.object.toTex(f);return i(this.object)&&(c="\\left(' + object + '\\right)"),c+this.index.toTex(f)}toJSON(){return{mathjs:Yi,object:this.object,index:this.index}}static fromJSON(f){return new a(f.object,f.index)}}return vr(a,"name",Yi),a},{isClass:!0,isNode:!0}),Gi="ArrayNode",AN=["Node"],EN=R(Gi,AN,e=>{var{Node:r}=e;class n extends r{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(tr))throw new TypeError("Array containing Nodes expected")}get type(){return Gi}get isArrayNode(){return!0}_compile(i,a){var o=bt(this.items,function(u){return u._compile(i,a)}),f=i.config.matrix!=="Array";if(f){var c=i.matrix;return function(u,s,l){return c(bt(o,function(p){return p(u,s,l)}))}}else return function(u,s,l){return bt(o,function(p){return p(u,s,l)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new n(a)}clone(){return new n(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:Gi,items:this.items}}static fromJSON(i){return new n(i.items)}_toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,f){var c=o.some(Yr)&&!o.every(Yr),u=f||c,s=u?"&":"\\\\",l=o.map(function(p){return p.items?a(p.items,!f):p.toTex(i)}).join(s);return c||!u||u&&!f?"\\begin{bmatrix}"+l+"\\end{bmatrix}":l}return a(this.items,!1)}}return vr(n,"name",Gi),n},{isClass:!0,isNode:!0});function MN(e){var{subset:r,matrix:n}=e;return function(t,i,a){try{if(Array.isArray(t)){var o=n(t).subset(i,a).valueOf();return o.forEach((f,c)=>{t[c]=f}),t}else{if(t&&typeof t.subset=="function")return t.subset(i,a);if(typeof t=="string")return r(t,i,a);if(typeof t=="object"){if(!i.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return vn(t,i.getObjectProperty(),a),t}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(f){throw zr(f)}}}var ot=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function Vi(e,r){if(!r||r!=="auto")return e;for(var n=e;xt(n);)n=n.content;return n}function ar(e,r,n,t){var i=e;r!=="keep"&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,f=0;f<ot.length;f++)if(a in ot[f]){o=f;break}if(a==="OperatorNode:multiply"&&i.implicit&&n!=="show"){var c=Vi(i.args[0],r);!(Ve(c)&&t&&t.getIdentifier()==="OperatorNode:divide"&&Sa(Vi(t.args[0],r)))&&!(c.getIdentifier()==="OperatorNode:divide"&&Sa(Vi(c.args[0],r))&&Ve(Vi(c.args[1])))&&(o+=1)}return o}function Xn(e,r){var n=e;r!=="keep"&&(n=e.getContent());var t=n.getIdentifier(),i=ar(n,r);if(i===null)return null;var a=ot[i][t];if(Me(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+t+"' has the invalid associativity '"+a.associativity+"'.")}return null}function ao(e,r,n){var t=n!=="keep"?e.getContent():e,i=n!=="keep"?e.getContent():r,a=t.getIdentifier(),o=i.getIdentifier(),f=ar(t,n);if(f===null)return null;var c=ot[f][a];if(Me(c,"associativeWith")&&c.associativeWith instanceof Array){for(var u=0;u<c.associativeWith.length;u++)if(c.associativeWith[u]===o)return!0;return!1}return null}function SN(e){var r="OperatorNode:"+e;for(var n of ot)if(r in n)return n[r].op;return null}var Ki="AssignmentNode",FN=["subset","?matrix","Node"],CN=R(Ki,FN,e=>{var{subset:r,matrix:n,Node:t}=e,i=Xf({subset:r}),a=MN({subset:r,matrix:n});function o(c,u,s){u||(u="keep");var l=ar(c,u,s),p=ar(c.value,u,s);return u==="all"||p!==null&&p<=l}class f extends t{constructor(u,s,l){if(super(),this.object=u,this.index=l?s:null,this.value=l||s,!br(u)&&!Wt(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(br(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!ln(this.index))throw new TypeError('IndexNode expected as "index"');if(!tr(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Ki}get isAssignmentNode(){return!0}_compile(u,s){var l=this.object._compile(u,s),p=this.index?this.index._compile(u,s):null,m=this.value._compile(u,s),d=this.object.name;if(this.index)if(this.index.isObjectProperty()){var g=this.index.getObjectProperty();return function(h,x,y){var N=l(h,x,y),A=m(h,x,y);return vn(N,g,A),A}}else{if(br(this.object))return function(h,x,y){var N=l(h,x,y),A=m(h,x,y),E=p(h,x,N);return h.set(d,a(N,E,A)),A};var w=this.object.object._compile(u,s);if(this.object.index.isObjectProperty()){var v=this.object.index.getObjectProperty();return function(h,x,y){var N=w(h,x,y),A=Tr(N,v),E=p(h,x,A),D=m(h,x,y);return vn(N,v,a(A,E,D)),D}}else{var b=this.object.index._compile(u,s);return function(h,x,y){var N=w(h,x,y),A=b(h,x,N),E=i(N,A),D=p(h,x,E),M=m(h,x,y);return a(N,A,a(E,D,M)),M}}}else{if(!br(this.object))throw new TypeError("SymbolNode expected as object");return function(h,x,y){var N=m(h,x,y);return h.set(d,N),N}}}forEach(u){u(this.object,"object",this),this.index&&u(this.index,"index",this),u(this.value,"value",this)}map(u){var s=this._ifNode(u(this.object,"object",this)),l=this.index?this._ifNode(u(this.index,"index",this)):null,p=this._ifNode(u(this.value,"value",this));return new f(s,l,p)}clone(){return new f(this.object,this.index,this.value)}_toString(u){var s=this.object.toString(u),l=this.index?this.index.toString(u):"",p=this.value.toString(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(p="("+p+")"),s+l+" = "+p}toJSON(){return{mathjs:Ki,object:this.object,index:this.index,value:this.value}}static fromJSON(u){return new f(u.object,u.index,u.value)}_toHTML(u){var s=this.object.toHTML(u),l=this.index?this.index.toHTML(u):"",p=this.value.toHTML(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(p='<span class="math-paranthesis math-round-parenthesis">(</span>'+p+'<span class="math-paranthesis math-round-parenthesis">)</span>'),s+l+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+p}_toTex(u){var s=this.object.toTex(u),l=this.index?this.index.toTex(u):"",p=this.value.toTex(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(p="\\left(".concat(p,"\\right)")),s+l+"="+p}}return vr(f,"name",Ki),f},{isClass:!0,isNode:!0}),Qi="BlockNode",BN=["ResultSet","Node"],ON=R(Qi,BN,e=>{var{ResultSet:r,Node:n}=e;class t extends n{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var f=o&&o.node,c=o&&o.visible!==void 0?o.visible:!0;if(!tr(f))throw new TypeError('Property "node" must be a Node');if(typeof c!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:f,visible:c}})}get type(){return Qi}get isBlockNode(){return!0}_compile(a,o){var f=bt(this.blocks,function(c){return{evaluate:c.node._compile(a,o),visible:c.visible}});return function(c,u,s){var l=[];return yi(f,function(p){var m=p.evaluate(c,u,s);p.visible&&l.push(m)}),new r(l)}}forEach(a){for(var o=0;o<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],f=0;f<this.blocks.length;f++){var c=this.blocks[f],u=this._ifNode(a(c.node,"blocks["+f+"].node",this));o[f]={node:u,visible:c.visible}}return new t(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new t(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
29
+ `)}toJSON(){return{mathjs:Qi,blocks:this.blocks}}static fromJSON(a){return new t(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
30
+ `)}}return vr(t,"name",Qi),t},{isClass:!0,isNode:!0}),Xi="ConditionalNode",TN=["Node"],_N=R(Xi,TN,e=>{var{Node:r}=e;function n(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(je(i))return!i.isZero();if(yt(i))return!!(i.re||i.im);if(Jr(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+nr(i)+'"')}class t extends r{constructor(a,o,f){if(super(),!tr(a))throw new TypeError("Parameter condition must be a Node");if(!tr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!tr(f))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=f}get type(){return Xi}get isConditionalNode(){return!0}_compile(a,o){var f=this.condition._compile(a,o),c=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(s,l,p){return n(f(s,l,p))?c(s,l,p):u(s,l,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new t(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new t(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",f=ar(this,o,a&&a.implicit),c=this.condition.toString(a),u=ar(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=f)&&(c="("+c+")");var s=this.trueExpr.toString(a),l=ar(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||l!==null&&l<=f)&&(s="("+s+")");var p=this.falseExpr.toString(a),m=ar(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=f)&&(p="("+p+")"),c+" ? "+s+" : "+p}toJSON(){return{mathjs:Xi,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new t(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",f=ar(this,o,a&&a.implicit),c=this.condition.toHTML(a),u=ar(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=f)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.trueExpr.toHTML(a),l=ar(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||l!==null&&l<=f)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>');var p=this.falseExpr.toHTML(a),m=ar(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=f)&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+'<span class="math-operator math-conditional-operator">?</span>'+s+'<span class="math-operator math-conditional-operator">:</span>'+p}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return vr(t,"name",Xi),t},{isClass:!0,isNode:!0}),oo=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},IN={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},zN={"–":"\\--","—":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},RN=function(e,r){return oo({},e,r)},qN=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.preserveFormatting,t=n===void 0?!1:n,i=r.escapeMapFn,a=i===void 0?RN:i,o=String(e),f="",c=a(oo({},IN),t?oo({},zN):{}),u=Object.keys(c),s=function(){var l=!1;u.forEach(function(p,m){l||o.length>=p.length&&o.slice(0,p.length)===p&&(f+=c[u[m]],o=o.slice(p.length,o.length),l=!0)}),l||(f+=o.slice(0,1),o=o.slice(1,o.length))};o;)s();return f};const kN=Wn(qN);var so={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},Qe={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},ep={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Qe.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Qe.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Qe.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Qe.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Qe.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Qe.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Qe.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Qe.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Qe.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Qe.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Qe.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Qe.bitAnd,"${args[1]}\\right)")},bitNot:{1:Qe.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Qe.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Qe.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Qe.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Qe.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Qe.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Qe.and,"${args[1]}\\right)")},not:{1:Qe.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Qe.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Qe.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Qe.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Qe.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Qe.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Qe.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Qe.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Qe.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Qe.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Qe.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Qe.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Qe.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Qe.to,"${args[1]}\\right)")},numeric:function(e,r){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(so.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},jN="\\mathrm{${name}}\\left(${args}\\right)",rp={deg:"^\\circ"};function uo(e){return kN(e,{preserveFormatting:!0})}function tp(e,r){return r=typeof r>"u"?!1:r,r?Me(rp,e)?rp[e]:"\\mathrm{"+uo(e)+"}":Me(so,e)?so[e]:uo(e)}var ea="ConstantNode",PN=["Node"],UN=R(ea,PN,e=>{var{Node:r}=e;class n extends r{constructor(i){super(),this.value=i}get type(){return ea}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new n(this.value)}_toString(i){return Le(this.value,i)}_toHTML(i){var a=this._toString(i);switch(nr(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:ea,value:this.value}}static fromJSON(i){return new n(i.value)}_toTex(i){var a=this._toString(i);switch(nr(this.value)){case"string":return"\\mathtt{"+uo(a)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var o=a.toLowerCase().indexOf("e");if(o!==-1)return a.substring(0,o)+"\\cdot10^{"+a.substring(o+1)+"}"}return a;case"Fraction":return this.value.toLatex();default:return a}}}return vr(n,"name",ea),n},{isClass:!0,isNode:!0}),ra="FunctionAssignmentNode",LN=["typed","Node"],HN=R(ra,LN,e=>{var{typed:r,Node:n}=e;function t(a,o,f){var c=ar(a,o,f),u=ar(a.expr,o,f);return o==="all"||u!==null&&u<=c}class i extends n{constructor(o,f,c){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(f))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!tr(c))throw new TypeError('Node expected for parameter "expr"');if(Qf.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var u=new Set;for(var s of f){var l=typeof s=="string"?s:s.name;if(u.has(l))throw new Error('Duplicate parameter name "'.concat(l,'"'));u.add(l)}this.name=o,this.params=f.map(function(p){return p&&p.name||p}),this.types=f.map(function(p){return p&&p.type||"any"}),this.expr=c}get type(){return ra}get isFunctionAssignmentNode(){return!0}_compile(o,f){var c=Object.create(f);yi(this.params,function(d){c[d]=!0});var u=this.expr._compile(o,c),s=this.name,l=this.params,p=ms(this.types,","),m=s+"("+ms(this.params,", ")+")";return function(d,g,w){var v={};v[p]=function(){for(var h=Object.create(g),x=0;x<l.length;x++)h[l[x]]=arguments[x];return u(d,h,w)};var b=r(s,v);return b.syntax=m,d.set(s,b),b}}forEach(o){o(this.expr,"expr",this)}map(o){var f=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),f)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var f=o&&o.parenthesis?o.parenthesis:"keep",c=this.expr.toString(o);return t(this,f,o&&o.implicit)&&(c="("+c+")"),this.name+"("+this.params.join(", ")+") = "+c}toJSON(){var o=this.types;return{mathjs:ra,name:this.name,params:this.params.map(function(f,c){return{name:f,type:o[c]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var f=o&&o.parenthesis?o.parenthesis:"keep",c=[],u=0;u<this.params.length;u++)c.push('<span class="math-symbol math-parameter">'+Vr(this.params[u])+"</span>");var s=this.expr.toHTML(o);return t(this,f,o&&o.implicit)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Vr(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+s}_toTex(o){var f=o&&o.parenthesis?o.parenthesis:"keep",c=this.expr.toTex(o);return t(this,f,o&&o.implicit)&&(c="\\left(".concat(c,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(tp).join(",")+"\\right)="+c}}return vr(i,"name",ra),i},{isClass:!0,isNode:!0}),ta="IndexNode",$N=["Node","size"],ZN=R(ta,$N,e=>{var{Node:r,size:n}=e;class t extends r{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(tr))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return ta}get isIndexNode(){return!0}_compile(a,o){var f=bt(this.dimensions,function(u,s){var l=u.filter(d=>d.isSymbolNode&&d.name==="end").length>0;if(l){var p=Object.create(o);p.end=!0;var m=u._compile(a,p);return function(d,g,w){if(!Be(w)&&!Xe(w)&&!Sr(w))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+nr(w));var v=n(w).valueOf(),b=Object.create(g);return b.end=v[s],m(d,b,w)}}else return u._compile(a,o)}),c=Tr(a,"index");return function(u,s,l){var p=bt(f,function(m){return m(u,s,l)});return c(...p)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],f=0;f<this.dimensions.length;f++)o[f]=this._ifNode(a(this.dimensions[f],"dimensions["+f+"]",this));return new t(o,this.dotNotation)}clone(){return new t(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&Ve(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(a){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:ta,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new t(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],f=0;f<this.dimensions.length;f++)o[f]=this.dimensions[f].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Vr(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(f){return f.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return vr(t,"name",ta),t},{isClass:!0,isNode:!0}),na="ObjectNode",JN=["Node"],WN=R(na,JN,e=>{var{Node:r}=e;class n extends r{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return tr(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return na}get isObjectNode(){return!0}_compile(i,a){var o={};for(var f in this.properties)if(Me(this.properties,f)){var c=mn(f),u=JSON.parse(c),s=Tr(this.properties,f);o[u]=s._compile(i,a)}return function(l,p,m){var d={};for(var g in o)Me(o,g)&&(d[g]=o[g](l,p,m));return d}}forEach(i){for(var a in this.properties)Me(this.properties,a)&&i(this.properties[a],"properties["+mn(a)+"]",this)}map(i){var a={};for(var o in this.properties)Me(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+mn(o)+"]",this)));return new n(a)}clone(){var i={};for(var a in this.properties)Me(this.properties,a)&&(i[a]=this.properties[a]);return new n(i)}_toString(i){var a=[];for(var o in this.properties)Me(this.properties,o)&&a.push(mn(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:na,properties:this.properties}}static fromJSON(i){return new n(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)Me(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Vr(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)Me(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var f="\\left\\{\\begin{array}{ll}"+a.join(`
31
+ `)+"\\end{array}\\right\\}";return f}}return vr(n,"name",na),n},{isClass:!0,isNode:!0}),ia="OperatorNode",YN=["Node"],GN=R(ia,YN,e=>{var{Node:r}=e;function n(a,o){var f=a;if(o==="auto")for(;xt(f);)f=f.content;return Ve(f)?!0:mr(f)?n(f.args[0],o):!1}function t(a,o,f,c,u){var s=ar(a,o,f),l=Xn(a,o);if(o==="all"||c.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return c.map(function(M){switch(M.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var p;switch(c.length){case 0:p=[];break;case 1:{var m=ar(c[0],o,f,a);if(u&&m!==null){var d,g;if(o==="keep"?(d=c[0].getIdentifier(),g=a.getIdentifier()):(d=c[0].getContent().getIdentifier(),g=a.getContent().getIdentifier()),ot[s][g].latexLeftParens===!1){p=[!1];break}if(ot[m][d].latexParens===!1){p=[!1];break}}if(m===null){p=[!1];break}if(m<=s){p=[!0];break}p=[!1]}break;case 2:{var w,v=ar(c[0],o,f,a),b=ao(a,c[0],o);v===null?w=!1:v===s&&l==="right"&&!b||v<s?w=!0:w=!1;var h,x=ar(c[1],o,f,a),y=ao(a,c[1],o);if(x===null?h=!1:x===s&&l==="left"&&!y||x<s?h=!0:h=!1,u){var N,A,E;o==="keep"?(N=a.getIdentifier(),A=a.args[0].getIdentifier(),E=a.args[1].getIdentifier()):(N=a.getContent().getIdentifier(),A=a.args[0].getContent().getIdentifier(),E=a.args[1].getContent().getIdentifier()),v!==null&&(ot[s][N].latexLeftParens===!1&&(w=!1),ot[v][A].latexParens===!1&&(w=!1)),x!==null&&(ot[s][N].latexRightParens===!1&&(h=!1),ot[x][E].latexParens===!1&&(h=!1))}p=[w,h]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(p=c.map(function(M){var S=ar(M,o,f,a),B=ao(a,M,o),I=Xn(M,o);return S===null?!1:s===S&&l===I&&!B?!0:S<s}));break}if(c.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&f==="hide")for(var D=1;D<p.length;++D)n(c[D],o)&&!p[D-1]&&(o!=="keep"||!xt(c[D-1]))&&(p[D]=!0);return p}class i extends r{constructor(o,f,c,u,s){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof f!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(c)||!c.every(tr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=s===!0,this.op=o,this.fn=f,this.args=c||[]}get type(){return ia}get isOperatorNode(){return!0}_compile(o,f){if(typeof this.fn!="string"||!Ia(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var c=Tr(o,this.fn),u=bt(this.args,function(d){return d._compile(o,f)});if(typeof c=="function"&&c.rawArgs===!0){var s=this.args;return function(d,g,w){return c(s,o,d)}}else if(u.length===1){var l=u[0];return function(d,g,w){return c(l(d,g,w))}}else if(u.length===2){var p=u[0],m=u[1];return function(d,g,w){return c(p(d,g,w),m(d,g,w))}}else return function(d,g,w){return c.apply(null,bt(u,function(v){return v(d,g,w)}))}}forEach(o){for(var f=0;f<this.args.length;f++)o(this.args[f],"args["+f+"]",this)}map(o){for(var f=[],c=0;c<this.args.length;c++)f[c]=this._ifNode(o(this.args[c],"args["+c+"]",this));return new i(this.op,this.fn,f,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var f=o&&o.parenthesis?o.parenthesis:"keep",c=o&&o.implicit?o.implicit:"hide",u=this.args,s=t(this,f,c,u,!1);if(u.length===1){var l=Xn(this,f),p=u[0].toString(o);s[0]&&(p="("+p+")");var m=/[a-zA-Z]+/.test(this.op);return l==="right"?this.op+(m?" ":"")+p:l==="left"?p+(m?" ":"")+this.op:p+this.op}else if(u.length===2){var d=u[0].toString(o),g=u[1].toString(o);return s[0]&&(d="("+d+")"),s[1]&&(g="("+g+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?d+" "+g:d+" "+this.op+" "+g}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var w=u.map(function(v,b){return v=v.toString(o),s[b]&&(v="("+v+")"),v});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?w.join(" "):w.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:ia,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}_toHTML(o){var f=o&&o.parenthesis?o.parenthesis:"keep",c=o&&o.implicit?o.implicit:"hide",u=this.args,s=t(this,f,c,u,!1);if(u.length===1){var l=Xn(this,f),p=u[0].toHTML(o);return s[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Vr(this.op)+"</span>"+p:p+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Vr(this.op)+"</span>"}else if(u.length===2){var m=u[0].toHTML(o),d=u[1].toHTML(o);return s[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s[1]&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?m+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+d:m+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Vr(this.op)+"</span>"+d}else{var g=u.map(function(w,v){return w=w.toHTML(o),s[v]&&(w='<span class="math-parenthesis math-round-parenthesis">(</span>'+w+'<span class="math-parenthesis math-round-parenthesis">)</span>'),w});return u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?g.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):g.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Vr(this.op)+"</span>"):'<span class="math-function">'+Vr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+g.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var f=o&&o.parenthesis?o.parenthesis:"keep",c=o&&o.implicit?o.implicit:"hide",u=this.args,s=t(this,f,c,u,!0),l=Qe[this.fn];if(l=typeof l>"u"?this.op:l,u.length===1){var p=Xn(this,f),m=u[0].toTex(o);return s[0]&&(m="\\left(".concat(m,"\\right)")),p==="right"?l+m:m+l}else if(u.length===2){var d=u[0],g=d.toTex(o);s[0]&&(g="\\left(".concat(g,"\\right)"));var w=u[1],v=w.toTex(o);s[1]&&(v="\\left(".concat(v,"\\right)"));var b;switch(f==="keep"?b=d.getIdentifier():b=d.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return l+"{"+g+"}{"+v+"}";case"OperatorNode:pow":switch(g="{"+g+"}",v="{"+v+"}",b){case"ConditionalNode":case"OperatorNode:divide":g="\\left(".concat(g,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&c==="hide")return g+"~"+v}return g+l+v}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var h=u.map(function(x,y){return x=x.toTex(o),s[y]&&(x="\\left(".concat(x,"\\right)")),x});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&c==="hide"?h.join("~"):h.join(l)}else return"\\mathrm{"+this.fn+"}\\left("+u.map(function(x){return x.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return vr(i,"name",ia),i},{isClass:!0,isNode:!0}),aa="ParenthesisNode",VN=["Node"],KN=R(aa,VN,e=>{var{Node:r}=e;class n extends r{constructor(i){if(super(),!tr(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return aa}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new n(a)}clone(){return new n(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:aa,content:this.content}}static fromJSON(i){return new n(i.content)}_toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return vr(n,"name",aa),n},{isClass:!0,isNode:!0}),oa="RangeNode",QN=["Node"],XN=R(oa,QN,e=>{var{Node:r}=e;function n(i,a,o){var f=ar(i,a,o),c={},u=ar(i.start,a,o);if(c.start=u!==null&&u<=f||a==="all",i.step){var s=ar(i.step,a,o);c.step=s!==null&&s<=f||a==="all"}var l=ar(i.end,a,o);return c.end=l!==null&&l<=f||a==="all",c}class t extends r{constructor(a,o,f){if(super(),!tr(a))throw new TypeError("Node expected");if(!tr(o))throw new TypeError("Node expected");if(f&&!tr(f))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=f||null}get type(){return oa}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return br(o)&&o.name==="end"});return a.length>0}_compile(a,o){var f=a.range,c=this.start._compile(a,o),u=this.end._compile(a,o);if(this.step){var s=this.step._compile(a,o);return function(l,p,m){return f(c(l,p,m),u(l,p,m),s(l,p,m))}}else return function(l,p,m){return f(c(l,p,m),u(l,p,m))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new t(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new t(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",f=n(this,o,a&&a.implicit),c,u=this.start.toString(a);if(f.start&&(u="("+u+")"),c=u,this.step){var s=this.step.toString(a);f.step&&(s="("+s+")"),c+=":"+s}var l=this.end.toString(a);return f.end&&(l="("+l+")"),c+=":"+l,c}toJSON(){return{mathjs:oa,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new t(a.start,a.end,a.step)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",f=n(this,o,a&&a.implicit),c,u=this.start.toHTML(a);if(f.start&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c=u,this.step){var s=this.step.toHTML(a);f.step&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+='<span class="math-operator math-range-operator">:</span>'+s}var l=this.end.toHTML(a);return f.end&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+='<span class="math-operator math-range-operator">:</span>'+l,c}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",f=n(this,o,a&&a.implicit),c=this.start.toTex(a);if(f.start&&(c="\\left(".concat(c,"\\right)")),this.step){var u=this.step.toTex(a);f.step&&(u="\\left(".concat(u,"\\right)")),c+=":"+u}var s=this.end.toTex(a);return f.end&&(s="\\left(".concat(s,"\\right)")),c+=":"+s,c}}return vr(t,"name",oa),t},{isClass:!0,isNode:!0}),sa="RelationalNode",eD=["Node"],rD=R(sa,eD,e=>{var{Node:r}=e,n={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class t extends r{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return sa}get isRelationalNode(){return!0}_compile(a,o){var f=this,c=this.params.map(u=>u._compile(a,o));return function(u,s,l){for(var p,m=c[0](u,s,l),d=0;d<f.conditionals.length;d++){p=m,m=c[d+1](u,s,l);var g=Tr(a,f.conditionals[d]);if(!g(p,m))return!1}return!0}}forEach(a){this.params.forEach((o,f)=>a(o,"params["+f+"]",this),this)}map(a){return new t(this.conditionals.slice(),this.params.map((o,f)=>this._ifNode(a(o,"params["+f+"]",this)),this))}clone(){return new t(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",f=ar(this,o,a&&a.implicit),c=this.params.map(function(l,p){var m=ar(l,o,a&&a.implicit);return o==="all"||m!==null&&m<=f?"("+l.toString(a)+")":l.toString(a)}),u=c[0],s=0;s<this.conditionals.length;s++)u+=" "+n[this.conditionals[s]],u+=" "+c[s+1];return u}toJSON(){return{mathjs:sa,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new t(a.conditionals,a.params)}_toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",f=ar(this,o,a&&a.implicit),c=this.params.map(function(l,p){var m=ar(l,o,a&&a.implicit);return o==="all"||m!==null&&m<=f?'<span class="math-parenthesis math-round-parenthesis">(</span>'+l.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':l.toHTML(a)}),u=c[0],s=0;s<this.conditionals.length;s++)u+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Vr(n[this.conditionals[s]])+"</span>"+c[s+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",f=ar(this,o,a&&a.implicit),c=this.params.map(function(l,p){var m=ar(l,o,a&&a.implicit);return o==="all"||m!==null&&m<=f?"\\left("+l.toTex(a)+"\right)":l.toTex(a)}),u=c[0],s=0;s<this.conditionals.length;s++)u+=Qe[this.conditionals[s]]+c[s+1];return u}}return vr(t,"name",sa),t},{isClass:!0,isNode:!0}),tD="SymbolNode",nD=["math","?Unit","Node"],iD=R(tD,nD,e=>{var{math:r,Unit:n,Node:t}=e;function i(o){return n?n.isValuelessUnit(o):!1}class a extends t{constructor(f){if(super(),typeof f!="string")throw new TypeError('String expected for parameter "name"');this.name=f}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(f,c){var u=this.name;if(c[u]===!0)return function(l,p,m){return Tr(p,u)};if(u in f)return function(l,p,m){return l.has(u)?l.get(u):Tr(f,u)};var s=i(u);return function(l,p,m){return l.has(u)?l.get(u):s?new n(null,u):a.onUndefinedSymbol(u)}}forEach(f){}map(f){return this.clone()}static onUndefinedSymbol(f){throw new Error("Undefined symbol "+f)}clone(){return new a(this.name)}_toString(f){return this.name}_toHTML(f){var c=Vr(this.name);return c==="true"||c==="false"?'<span class="math-symbol math-boolean">'+c+"</span>":c==="i"?'<span class="math-symbol math-imaginary-symbol">'+c+"</span>":c==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+c+"</span>":c==="NaN"?'<span class="math-symbol math-nan-symbol">'+c+"</span>":c==="null"?'<span class="math-symbol math-null-symbol">'+c+"</span>":c==="undefined"?'<span class="math-symbol math-undefined-symbol">'+c+"</span>":'<span class="math-symbol">'+c+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(f){return new a(f.name)}_toTex(f){var c=!1;typeof r[this.name]>"u"&&i(this.name)&&(c=!0);var u=tp(this.name,c);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});function ei(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return typeof e.createSubScope=="function"?xs(e.createSubScope(),...n):xs(yn(),e,...n)}var ua="FunctionNode",aD=["math","Node","SymbolNode"],oD=R(ua,aD,e=>{var r,{math:n,Node:t,SymbolNode:i}=e,a=c=>Le(c,{truncate:78});function o(c,u,s){for(var l="",p=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,d;(d=p.exec(c))!==null;)if(l+=c.substring(m,d.index),m=d.index,d[0]==="$$")l+="$",m++;else{m+=d[0].length;var g=u[d[1]];if(!g)throw new ReferenceError("Template: Property "+d[1]+" does not exist.");if(d[2]===void 0)switch(typeof g){case"string":l+=g;break;case"object":if(tr(g))l+=g.toTex(s);else if(Array.isArray(g))l+=g.map(function(w,v){if(tr(w))return w.toTex(s);throw new TypeError("Template: "+d[1]+"["+v+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+d[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+d[1]+" has to be a Node, String or array of Nodes")}else if(tr(g[d[2]]&&g[d[2]]))l+=g[d[2]].toTex(s);else throw new TypeError("Template: "+d[1]+"["+d[2]+"] is not a Node.")}return l+=c.slice(m),l}class f extends t{constructor(u,s){if(super(),typeof u=="string"&&(u=new i(u)),!tr(u))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(s)||!s.every(tr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=u,this.args=s||[]}get name(){return this.fn.name||""}get type(){return ua}get isFunctionNode(){return!0}_compile(u,s){var l=this.args.map(E=>E._compile(u,s));if(br(this.fn)){var p=this.fn.name;if(s[p]){var m=this.args;return function(E,D,M){var S=Tr(D,p);if(typeof S!="function")throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(S)));if(S.rawArgs)return S(m,u,ei(E,D));var B=l.map(I=>I(E,D,M));return S.apply(S,B)}}else{var d=p in u?Tr(u,p):void 0,g=typeof d=="function"&&d.rawArgs===!0,w=E=>{var D;if(E.has(p))D=E.get(p);else if(p in u)D=Tr(u,p);else return f.onUndefinedFunction(p);if(typeof D=="function")return D;throw new TypeError("'".concat(p,`' is not a function; its value is:
32
+ `).concat(a(D)))};if(g){var v=this.args;return function(E,D,M){var S=w(E);return S(v,u,ei(E,D))}}else switch(l.length){case 0:return function(E,D,M){var S=w(E);return S()};case 1:return function(E,D,M){var S=w(E),B=l[0];return S(B(E,D,M))};case 2:return function(E,D,M){var S=w(E),B=l[0],I=l[1];return S(B(E,D,M),I(E,D,M))};default:return function(E,D,M){var S=w(E),B=l.map(I=>I(E,D,M));return S(...B)}}}}else if(Wt(this.fn)&&ln(this.fn.index)&&this.fn.index.isObjectProperty()){var b=this.fn.object._compile(u,s),h=this.fn.index.getObjectProperty(),x=this.args;return function(E,D,M){var S=b(E,D,M),B=O0(S,h);if(B!=null&&B.rawArgs)return B(x,u,ei(E,D));var I=l.map(j=>j(E,D,M));return B.apply(S,I)}}else{var y=this.fn.toString(),N=this.fn._compile(u,s),A=this.args;return function(E,D,M){var S=N(E,D,M);if(typeof S!="function")throw new TypeError("Expression '".concat(y,"' did not evaluate to a function; value is:")+`
33
+ `.concat(a(S)));if(S.rawArgs)return S(A,u,ei(E,D));var B=l.map(I=>I(E,D,M));return S.apply(S,B)}}}forEach(u){u(this.fn,"fn",this);for(var s=0;s<this.args.length;s++)u(this.args[s],"args["+s+"]",this)}map(u){for(var s=this._ifNode(u(this.fn,"fn",this)),l=[],p=0;p<this.args.length;p++)l[p]=this._ifNode(u(this.args[p],"args["+p+"]",this));return new f(s,l)}clone(){return new f(this.fn,this.args.slice(0))}toString(u){var s,l=this.fn.toString(u);return u&&typeof u.handler=="object"&&Me(u.handler,l)&&(s=u.handler[l](this,u)),typeof s<"u"?s:super.toString(u)}_toString(u){var s=this.args.map(function(p){return p.toString(u)}),l=$n(this.fn)?"("+this.fn.toString(u)+")":this.fn.toString(u);return l+"("+s.join(", ")+")"}toJSON(){return{mathjs:ua,fn:this.fn,args:this.args}}_toHTML(u){var s=this.args.map(function(l){return l.toHTML(u)});return'<span class="math-function">'+Vr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+s.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(u){var s;return u&&typeof u.handler=="object"&&Me(u.handler,this.name)&&(s=u.handler[this.name](this,u)),typeof s<"u"?s:super.toTex(u)}_toTex(u){var s=this.args.map(function(m){return m.toTex(u)}),l;ep[this.name]&&(l=ep[this.name]),n[this.name]&&(typeof n[this.name].toTex=="function"||typeof n[this.name].toTex=="object"||typeof n[this.name].toTex=="string")&&(l=n[this.name].toTex);var p;switch(typeof l){case"function":p=l(this,u);break;case"string":p=o(l,this,u);break;case"object":switch(typeof l[s.length]){case"function":p=l[s.length](this,u);break;case"string":p=o(l[s.length],this,u);break}}return typeof p<"u"?p:o(jN,this,u)}getIdentifier(){return this.type+":"+this.name}}return r=f,vr(f,"name",ua),vr(f,"onUndefinedFunction",function(c){throw new Error("Undefined function "+c)}),vr(f,"fromJSON",function(c){return new r(c.fn,c.args)}),f},{isClass:!0,isNode:!0}),np="parse",sD=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],uD=R(np,sD,e=>{var{typed:r,numeric:n,config:t,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:f,ConditionalNode:c,ConstantNode:u,FunctionAssignmentNode:s,FunctionNode:l,IndexNode:p,ObjectNode:m,OperatorNode:d,ParenthesisNode:g,RangeNode:w,RelationalNode:v,SymbolNode:b}=e,h=r(np,{string:function(F){return te(F,{})},"Array | Matrix":function(F){return x(F,{})},"string, Object":function(F,W){var ae=W.nodes!==void 0?W.nodes:{};return te(F,ae)},"Array | Matrix, Object":x});function x(F){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=W.nodes!==void 0?W.nodes:{};return $e(F,function(we){if(typeof we!="string")throw new TypeError("String expected");return te(we,ae)})}var y={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},N={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},A={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},E={true:!0,false:!1,null:null,undefined:void 0},D=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
34
+ `,r:"\r",t:" "};function S(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:y.NULL,nestingLevel:0,conditionalLevel:null}}function B(F,W){return F.expression.substr(F.index,W)}function I(F){return B(F,1)}function j(F){F.index++}function _(F){return F.expression.charAt(F.index-1)}function O(F){return F.expression.charAt(F.index+1)}function C(F){for(F.tokenType=y.NULL,F.token="",F.comment="";;){if(I(F)==="#")for(;I(F)!==`
35
+ `&&I(F)!=="";)F.comment+=I(F),j(F);if(h.isWhitespace(I(F),F.nestingLevel))j(F);else break}if(I(F)===""){F.tokenType=y.DELIMITER;return}if(I(F)===`
36
+ `&&!F.nestingLevel){F.tokenType=y.DELIMITER,F.token=I(F),j(F);return}var W=I(F),ae=B(F,2),we=B(F,3);if(we.length===3&&N[we]){F.tokenType=y.DELIMITER,F.token=we,j(F),j(F),j(F);return}if(ae.length===2&&N[ae]){F.tokenType=y.DELIMITER,F.token=ae,j(F),j(F);return}if(N[W]){F.tokenType=y.DELIMITER,F.token=W,j(F);return}if(h.isDigitDot(W)){F.tokenType=y.NUMBER;var _e=B(F,2);if(_e==="0b"||_e==="0o"||_e==="0x"){for(F.token+=I(F),j(F),F.token+=I(F),j(F);h.isHexDigit(I(F));)F.token+=I(F),j(F);if(I(F)===".")for(F.token+=".",j(F);h.isHexDigit(I(F));)F.token+=I(F),j(F);else if(I(F)==="i")for(F.token+="i",j(F);h.isDigit(I(F));)F.token+=I(F),j(F);return}if(I(F)==="."){if(F.token+=I(F),j(F),!h.isDigit(I(F))){F.tokenType=y.DELIMITER;return}}else{for(;h.isDigit(I(F));)F.token+=I(F),j(F);h.isDecimalMark(I(F),O(F))&&(F.token+=I(F),j(F))}for(;h.isDigit(I(F));)F.token+=I(F),j(F);if(I(F)==="E"||I(F)==="e"){if(h.isDigit(O(F))||O(F)==="-"||O(F)==="+"){if(F.token+=I(F),j(F),(I(F)==="+"||I(F)==="-")&&(F.token+=I(F),j(F)),!h.isDigit(I(F)))throw Fe(F,'Digit expected, got "'+I(F)+'"');for(;h.isDigit(I(F));)F.token+=I(F),j(F);if(h.isDecimalMark(I(F),O(F)))throw Fe(F,'Digit expected, got "'+I(F)+'"')}else if(O(F)===".")throw j(F),Fe(F,'Digit expected, got "'+I(F)+'"')}return}if(h.isAlpha(I(F),_(F),O(F))){for(;h.isAlpha(I(F),_(F),O(F))||h.isDigit(I(F));)F.token+=I(F),j(F);Me(A,F.token)?F.tokenType=y.DELIMITER:F.tokenType=y.SYMBOL;return}for(F.tokenType=y.UNKNOWN;I(F)!=="";)F.token+=I(F),j(F);throw Fe(F,'Syntax error in part "'+F.token+'"')}function z(F){do C(F);while(F.token===`
37
+ `)}function T(F){F.nestingLevel++}function Y(F){F.nestingLevel--}h.isAlpha=function(F,W,ae){return h.isValidLatinOrGreek(F)||h.isValidMathSymbol(F,ae)||h.isValidMathSymbol(W,F)},h.isValidLatinOrGreek=function(F){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(F)},h.isValidMathSymbol=function(F,W){return/^[\uD835]$/.test(F)&&/^[\uDC00-\uDFFF]$/.test(W)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(W)},h.isWhitespace=function(F,W){return F===" "||F===" "||F===`
38
+ `&&W>0},h.isDecimalMark=function(F,W){return F==="."&&W!=="/"&&W!=="*"&&W!=="^"},h.isDigitDot=function(F){return F>="0"&&F<="9"||F==="."},h.isDigit=function(F){return F>="0"&&F<="9"},h.isHexDigit=function(F){return F>="0"&&F<="9"||F>="a"&&F<="f"||F>="A"&&F<="F"};function te(F,W){var ae=S();dr(ae,{expression:F,extraNodes:W}),C(ae);var we=$(ae);if(ae.token!=="")throw ae.tokenType===y.DELIMITER?cr(ae,"Unexpected operator "+ae.token):Fe(ae,'Unexpected part "'+ae.token+'"');return we}function $(F){var W,ae=[],we;for(F.token!==""&&F.token!==`
39
+ `&&F.token!==";"&&(W=q(F),F.comment&&(W.comment=F.comment));F.token===`
40
+ `||F.token===";";)ae.length===0&&W&&(we=F.token!==";",ae.push({node:W,visible:we})),C(F),F.token!==`
41
+ `&&F.token!==";"&&F.token!==""&&(W=q(F),F.comment&&(W.comment=F.comment),we=F.token!==";",ae.push({node:W,visible:we}));return ae.length>0?new f(ae):(W||(W=new u(void 0),F.comment&&(W.comment=F.comment)),W)}function q(F){var W,ae,we,_e,Ue=ne(F);if(F.token==="="){if(br(Ue))return W=Ue.name,z(F),we=q(F),new o(new b(W),we);if(Wt(Ue))return z(F),we=q(F),new o(Ue.object,Ue.index,we);if(Bt(Ue)&&br(Ue.fn)&&(_e=!0,ae=[],W=Ue.name,Ue.args.forEach(function(Zr,jo){br(Zr)?ae[jo]=Zr.name:_e=!1}),_e))return z(F),we=q(F),new s(W,ae,we);throw Fe(F,"Invalid left hand side of assignment operator =")}return Ue}function ne(F){for(var W=se(F);F.token==="?";){var ae=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,z(F);var we=W,_e=q(F);if(F.token!==":")throw Fe(F,"False part of conditional expression expected");F.conditionalLevel=null,z(F);var Ue=q(F);W=new c(we,_e,Ue),F.conditionalLevel=ae}return W}function se(F){for(var W=Q(F);F.token==="or";)z(F),W=new d("or","or",[W,Q(F)]);return W}function Q(F){for(var W=ee(F);F.token==="xor";)z(F),W=new d("xor","xor",[W,ee(F)]);return W}function ee(F){for(var W=ue(F);F.token==="and";)z(F),W=new d("and","and",[W,ue(F)]);return W}function ue(F){for(var W=X(F);F.token==="|";)z(F),W=new d("|","bitOr",[W,X(F)]);return W}function X(F){for(var W=ie(F);F.token==="^|";)z(F),W=new d("^|","bitXor",[W,ie(F)]);return W}function ie(F){for(var W=oe(F);F.token==="&";)z(F),W=new d("&","bitAnd",[W,oe(F)]);return W}function oe(F){for(var W=[ce(F)],ae=[],we={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Me(we,F.token);){var _e={name:F.token,fn:we[F.token]};ae.push(_e),z(F),W.push(ce(F))}return W.length===1?W[0]:W.length===2?new d(ae[0].name,ae[0].fn,W):new v(ae.map(Ue=>Ue.fn),W)}function ce(F){var W,ae,we,_e;W=ye(F);for(var Ue={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Me(Ue,F.token);)ae=F.token,we=Ue[ae],z(F),_e=[W,ye(F)],W=new d(ae,we,_e);return W}function ye(F){var W,ae,we,_e;W=Ae(F);for(var Ue={to:"to",in:"to"};Me(Ue,F.token);)ae=F.token,we=Ue[ae],z(F),ae==="in"&&F.token===""?W=new d("*","multiply",[W,new b("in")],!0):(_e=[W,Ae(F)],W=new d(ae,we,_e));return W}function Ae(F){var W,ae=[];if(F.token===":"?W=new u(1):W=P(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(ae.push(W);F.token===":"&&ae.length<3;)z(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?ae.push(new b("end")):ae.push(P(F));ae.length===3?W=new w(ae[0],ae[2],ae[1]):W=new w(ae[0],ae[1])}return W}function P(F){var W,ae,we,_e;W=Z(F);for(var Ue={"+":"add","-":"subtract"};Me(Ue,F.token);){ae=F.token,we=Ue[ae],z(F);var Zr=Z(F);Zr.isPercentage?_e=[W,new d("*","multiply",[W,Zr])]:_e=[W,Zr],W=new d(ae,we,_e)}return W}function Z(F){var W,ae,we,_e;W=V(F),ae=W;for(var Ue={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Me(Ue,F.token);)we=F.token,_e=Ue[we],z(F),ae=V(F),W=new d(we,_e,[W,ae]);return W}function V(F){var W,ae;for(W=H(F),ae=W;F.tokenType===y.SYMBOL||F.token==="in"&&Ve(W)||F.tokenType===y.NUMBER&&!Ve(ae)&&(!mr(ae)||ae.op==="!")||F.token==="(";)ae=H(F),W=new d("*","multiply",[W,ae],!0);return W}function H(F){for(var W=J(F),ae=W,we=[];F.token==="/"&&Sa(ae);)if(we.push(dr({},F)),z(F),F.tokenType===y.NUMBER)if(we.push(dr({},F)),z(F),F.tokenType===y.SYMBOL||F.token==="(")dr(F,we.pop()),we.pop(),ae=J(F),W=new d("/","divide",[W,ae]);else{we.pop(),dr(F,we.pop());break}else{dr(F,we.pop());break}return W}function J(F){var W,ae,we,_e;W=K(F);for(var Ue={"%":"mod",mod:"mod"};Me(Ue,F.token);)ae=F.token,we=Ue[ae],z(F),ae==="%"&&F.tokenType===y.DELIMITER&&F.token!=="("?W=new d("/","divide",[W,new u(100)],!1,!0):(_e=[W,K(F)],W=new d(ae,we,_e));return W}function K(F){var W,ae,we,_e={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Me(_e,F.token)?(we=_e[F.token],W=F.token,z(F),ae=[K(F)],new d(W,we,ae)):fe(F)}function fe(F){var W,ae,we,_e;return W=pe(F),(F.token==="^"||F.token===".^")&&(ae=F.token,we=ae==="^"?"pow":"dotPow",z(F),_e=[W,K(F)],W=new d(ae,we,_e)),W}function pe(F){var W,ae,we,_e;W=k(F);for(var Ue={"!":"factorial","'":"ctranspose"};Me(Ue,F.token);)ae=F.token,we=Ue[ae],C(F),_e=[W],W=new d(ae,we,_e),W=G(F,W);return W}function k(F){var W=[];if(F.tokenType===y.SYMBOL&&Me(F.extraNodes,F.token)){var ae=F.extraNodes[F.token];if(C(F),F.token==="("){if(W=[],T(F),C(F),F.token!==")")for(W.push(q(F));F.token===",";)C(F),W.push(q(F));if(F.token!==")")throw Fe(F,"Parenthesis ) expected");Y(F),C(F)}return new ae(W)}return U(F)}function U(F){var W,ae;return F.tokenType===y.SYMBOL||F.tokenType===y.DELIMITER&&F.token in A?(ae=F.token,C(F),Me(E,ae)?W=new u(E[ae]):D.indexOf(ae)!==-1?W=new u(n(ae,"number")):W=new b(ae),W=G(F,W),W):re(F)}function G(F,W,ae){for(var we;(F.token==="("||F.token==="["||F.token===".")&&(!ae||ae.indexOf(F.token)!==-1);)if(we=[],F.token==="(")if(br(W)||Wt(W)){if(T(F),C(F),F.token!==")")for(we.push(q(F));F.token===",";)C(F),we.push(q(F));if(F.token!==")")throw Fe(F,"Parenthesis ) expected");Y(F),C(F),W=new l(W,we)}else return W;else if(F.token==="["){if(T(F),C(F),F.token!=="]")for(we.push(q(F));F.token===",";)C(F),we.push(q(F));if(F.token!=="]")throw Fe(F,"Parenthesis ] expected");Y(F),C(F),W=new i(W,new p(we))}else{C(F);var _e=F.tokenType===y.SYMBOL||F.tokenType===y.DELIMITER&&F.token in A;if(!_e)throw Fe(F,"Property name expected after dot");we.push(new u(F.token)),C(F);var Ue=!0;W=new i(W,new p(we,Ue))}return W}function re(F){var W,ae;return F.token==='"'||F.token==="'"?(ae=le(F,F.token),W=new u(ae),W=G(F,W),W):me(F)}function le(F,W){for(var ae="";I(F)!==""&&I(F)!==W;)if(I(F)==="\\"){j(F);var we=I(F),_e=M[we];if(_e!==void 0)ae+=_e,F.index+=1;else if(we==="u"){var Ue=F.expression.slice(F.index+1,F.index+5);if(/^[0-9A-Fa-f]{4}$/.test(Ue))ae+=String.fromCharCode(parseInt(Ue,16)),F.index+=5;else throw Fe(F,"Invalid unicode character \\u".concat(Ue))}else throw Fe(F,"Bad escape character \\".concat(we))}else ae+=I(F),j(F);if(C(F),F.token!==W)throw Fe(F,"End of string ".concat(W," expected"));return C(F),ae}function me(F){var W,ae,we,_e;if(F.token==="["){if(T(F),C(F),F.token!=="]"){var Ue=xe(F);if(F.token===";"){for(we=1,ae=[Ue];F.token===";";)C(F),ae[we]=xe(F),we++;if(F.token!=="]")throw Fe(F,"End of matrix ] expected");Y(F),C(F),_e=ae[0].items.length;for(var Zr=1;Zr<we;Zr++)if(ae[Zr].items.length!==_e)throw cr(F,"Column dimensions mismatch ("+ae[Zr].items.length+" !== "+_e+")");W=new a(ae)}else{if(F.token!=="]")throw Fe(F,"End of matrix ] expected");Y(F),C(F),W=Ue}}else Y(F),C(F),W=new a([]);return G(F,W)}return he(F)}function xe(F){for(var W=[q(F)],ae=1;F.token===",";)C(F),W[ae]=q(F),ae++;return new a(W)}function he(F){if(F.token==="{"){T(F);var W,ae={};do if(C(F),F.token!=="}"){if(F.token==='"'||F.token==="'")W=le(F,F.token);else if(F.tokenType===y.SYMBOL||F.tokenType===y.DELIMITER&&F.token in A)W=F.token,C(F);else throw Fe(F,"Symbol or string expected as object key");if(F.token!==":")throw Fe(F,"Colon : expected after object key");C(F),ae[W]=q(F)}while(F.token===",");if(F.token!=="}")throw Fe(F,"Comma , or bracket } expected after object value");Y(F),C(F);var we=new m(ae);return we=G(F,we),we}return De(F)}function De(F){var W;return F.tokenType===y.NUMBER?(W=F.token,C(F),new u(n(W,t.number))):Ne(F)}function Ne(F){var W;if(F.token==="("){if(T(F),C(F),W=q(F),F.token!==")")throw Fe(F,"Parenthesis ) expected");return Y(F),C(F),W=new g(W),W=G(F,W),W}return We(F)}function We(F){throw F.token===""?Fe(F,"Unexpected end of expression"):Fe(F,"Value expected")}function Ye(F){return F.index-F.token.length+1}function Fe(F,W){var ae=Ye(F),we=new SyntaxError(W+" (char "+ae+")");return we.char=ae,we}function cr(F,W){var ae=Ye(F),we=new SyntaxError(W+" (char "+ae+")");return we.char=ae,we}return r.addConversion({from:"string",to:"Node",convert:h}),h}),ip="compile",lD=["typed","parse"],cD=R(ip,lD,e=>{var{typed:r,parse:n}=e;return r(ip,{string:function(t){return n(t).compile()},"Array | Matrix":function(t){return $e(t,function(i){return n(i).compile()})}})}),ap="evaluate",fD=["typed","parse"],pD=R(ap,fD,e=>{var{typed:r,parse:n}=e;return r(ap,{string:function(t){var i=yn();return n(t).compile().evaluate(i)},"string, Map | Object":function(t,i){return n(t).compile().evaluate(i)},"Array | Matrix":function(t){var i=yn();return $e(t,function(a){return n(a).compile().evaluate(i)})},"Array | Matrix, Map | Object":function(t,i){return $e(t,function(a){return n(a).compile().evaluate(i)})}})}),mD="Parser",dD=["evaluate"],hD=R(mD,dD,e=>{var{evaluate:r}=e;function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:yn(),writable:!1})}return n.prototype.type="Parser",n.prototype.isParser=!0,n.prototype.evaluate=function(t){return r(t,this.scope)},n.prototype.get=function(t){if(this.scope.has(t))return this.scope.get(t)},n.prototype.getAll=function(){return I0(this.scope)},n.prototype.getAllAsMap=function(){return this.scope},n.prototype.set=function(t,i){return this.scope.set(t,i),i},n.prototype.remove=function(t){this.scope.delete(t)},n.prototype.clear=function(){this.scope.clear()},n},{isClass:!0}),op="parser",gD=["typed","Parser"],vD=R(op,gD,e=>{var{typed:r,Parser:n}=e;return r(op,{"":function(){return new n}})}),sp="lup",yD=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],xD=R(sp,yD,e=>{var{typed:r,matrix:n,abs:t,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:f,larger:c,equalScalar:u,unaryMinus:s,DenseMatrix:l,SparseMatrix:p,Spa:m}=e;return r(sp,{DenseMatrix:function(w){return d(w)},SparseMatrix:function(w){return g(w)},Array:function(w){var v=n(w),b=d(v);return{L:b.L.valueOf(),U:b.U.valueOf(),p:b.p}}});function d(w){var v=w._size[0],b=w._size[1],h=Math.min(v,b),x=Ie(w._data),y=[],N=[v,h],A=[],E=[h,b],D,M,S,B=[];for(D=0;D<v;D++)B[D]=D;for(M=0;M<b;M++){if(M>0)for(D=0;D<v;D++){var I=Math.min(D,M),j=0;for(S=0;S<I;S++)j=i(j,o(x[D][S],x[S][M]));x[D][M]=f(x[D][M],j)}var _=M,O=0,C=0;for(D=M;D<v;D++){var z=x[D][M],T=t(z);c(T,O)&&(_=D,O=T,C=z)}if(M!==_&&(B[M]=[B[_],B[_]=B[M]][0],l._swapRows(M,_,x)),M<v)for(D=M+1;D<v;D++){var Y=x[D][M];u(Y,0)||(x[D][M]=a(x[D][M],C))}}for(M=0;M<b;M++)for(D=0;D<v;D++){if(M===0&&(D<b&&(A[D]=[]),y[D]=[]),D<M){D<b&&(A[D][M]=x[D][M]),M<v&&(y[D][M]=0);continue}if(D===M){D<b&&(A[D][M]=x[D][M]),M<v&&(y[D][M]=1);continue}D<b&&(A[D][M]=0),M<v&&(y[D][M]=x[D][M])}var te=new l({data:y,size:N}),$=new l({data:A,size:E}),q=[];for(D=0,h=B.length;D<h;D++)q[B[D]]=D;return{L:te,U:$,p:q,toString:function(){return"L: "+this.L.toString()+`
42
+ U: `+this.U.toString()+`
43
+ P: `+this.p}}}function g(w){var v=w._size[0],b=w._size[1],h=Math.min(v,b),x=w._values,y=w._index,N=w._ptr,A=[],E=[],D=[],M=[v,h],S=[],B=[],I=[],j=[h,b],_,O,C,z=[],T=[];for(_=0;_<v;_++)z[_]=_,T[_]=_;var Y=function($,q){var ne=T[$],se=T[q];z[ne]=q,z[se]=$,T[$]=se,T[q]=ne},te=function(){var $=new m;O<v&&(D.push(A.length),A.push(1),E.push(O)),I.push(S.length);var q=N[O],ne=N[O+1];for(C=q;C<ne;C++)_=y[C],$.set(z[_],x[C]);O>0&&$.forEach(0,O-1,function(ue,X){p._forEachRow(ue,A,E,D,function(ie,oe){ie>ue&&$.accumulate(ie,s(o(oe,X)))})});var se=O,Q=$.get(O),ee=t(Q);$.forEach(O+1,v-1,function(ue,X){var ie=t(X);c(ie,ee)&&(se=ue,ee=ie,Q=X)}),O!==se&&(p._swapRows(O,se,M[1],A,E,D),p._swapRows(O,se,j[1],S,B,I),$.swap(O,se),Y(O,se)),$.forEach(0,v-1,function(ue,X){ue<=O?(S.push(X),B.push(ue)):(X=a(X,Q),u(X,0)||(A.push(X),E.push(ue)))})};for(O=0;O<b;O++)te();return I.push(S.length),D.push(A.length),{L:new p({values:A,index:E,ptr:D,size:M}),U:new p({values:S,index:B,ptr:I,size:j}),p:z,toString:function(){return"L: "+this.L.toString()+`
44
+ U: `+this.U.toString()+`
45
+ P: `+this.p}}}}),up="qr",bD=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],wD=R(up,bD,e=>{var{typed:r,matrix:n,zeros:t,identity:i,isZero:a,equal:o,sign:f,sqrt:c,conj:u,unaryMinus:s,addScalar:l,divideScalar:p,multiplyScalar:m,subtractScalar:d,complex:g}=e;return dr(r(up,{DenseMatrix:function(h){return v(h)},SparseMatrix:function(h){return b()},Array:function(h){var x=n(h),y=v(x);return{Q:y.Q.valueOf(),R:y.R.valueOf()}}}),{_denseQRimpl:w});function w(h){var x=h._size[0],y=h._size[1],N=i([x],"dense"),A=N._data,E=h.clone(),D=E._data,M,S,B,I=t([x],"");for(B=0;B<Math.min(y,x);++B){var j=D[B][B],_=s(o(j,0)?1:f(j)),O=u(_),C=0;for(M=B;M<x;M++)C=l(C,m(D[M][B],u(D[M][B])));var z=m(_,c(C));if(!a(z)){var T=d(j,z);for(I[B]=1,M=B+1;M<x;M++)I[M]=p(D[M][B],T);var Y=s(u(p(T,z))),te=void 0;for(S=B;S<y;S++){for(te=0,M=B;M<x;M++)te=l(te,m(u(I[M]),D[M][S]));for(te=m(te,Y),M=B;M<x;M++)D[M][S]=m(d(D[M][S],m(I[M],te)),O)}for(M=0;M<x;M++){for(te=0,S=B;S<x;S++)te=l(te,m(A[M][S],I[S]));for(te=m(te,Y),S=B;S<x;++S)A[M][S]=p(d(A[M][S],m(te,u(I[S]))),O)}}}return{Q:N,R:E,toString:function(){return"Q: "+this.Q.toString()+`
46
+ R: `+this.R.toString()}}}function v(h){var x=w(h),y=x.R._data;if(h._data.length>0)for(var N=y[0][0].type==="Complex"?g(0):0,A=0;A<y.length;++A)for(var E=0;E<A&&E<(y[0]||[]).length;++E)y[A][E]=N;return x}function b(h){throw new Error("qr not implemented for sparse matrices yet")}});function ND(e,r,n,t){for(var i=e._values,a=e._index,o=e._ptr,f=e._size,c=e._datatype,u=f[0],s=f[1],l=t&&e._values?[]:null,p=[],m=[],d=0,g=0;g<s;g++){m[g]=d;for(var w=n?n[g]:g,v=o[w],b=o[w+1],h=v;h<b;h++){var x=r?r[a[h]]:a[h];p[d]=x,l&&(l[d]=i[h]),d++}}return m[s]=d,e.createSparseMatrix({values:l,index:p,ptr:m,size:[u,s],datatype:c})}function lp(e,r,n,t,i,a,o){var f=0;for(n[o]=e;f>=0;){var c=n[o+f],u=n[t+c];u===-1?(f--,a[r++]=c):(n[t+c]=n[i+u],++f,n[o+f]=u)}return r}function DD(e,r){if(!e)return null;var n=0,t,i=[],a=[],o=0,f=r,c=2*r;for(t=0;t<r;t++)a[o+t]=-1;for(t=r-1;t>=0;t--)e[t]!==-1&&(a[f+t]=a[o+e[t]],a[o+e[t]]=t);for(t=0;t<r;t++)e[t]===-1&&(n=lp(t,n,a,o,f,i,c));return i}function AD(e,r){if(!e)return null;var n=e._index,t=e._ptr,i=e._size,a=i[0],o=i[1],f=[],c=[],u=0,s=o,l,p;if(r)for(l=0;l<a;l++)c[s+l]=-1;for(var m=0;m<o;m++){f[m]=-1,c[u+m]=-1;for(var d=t[m],g=t[m+1],w=d;w<g;w++){var v=n[w];for(l=r?c[s+v]:v;l!==-1&&l<m;l=p)p=c[u+l],c[u+l]=m,p===-1&&(f[l]=m);r&&(c[s+v]=m)}}return f}function ED(e,r,n){for(var t=e._values,i=e._index,a=e._ptr,o=e._size,f=o[1],c=0,u=0;u<f;u++){var s=a[u];for(a[u]=c;s<a[u+1];s++)r(i[s],u,t?t[s]:1,n)&&(i[c]=i[s],t&&(t[c]=t[s]),c++)}return a[f]=c,i.splice(c,i.length-c),t&&t.splice(c,t.length-c),c}function kt(e){return-e-2}var MD="csAmd",SD=["add","multiply","transpose"],FD=R(MD,SD,e=>{var{add:r,multiply:n,transpose:t}=e;return function(u,s){if(!s||u<=0||u>3)return null;var l=s._size,p=l[0],m=l[1],d=0,g=Math.max(16,10*Math.sqrt(m));g=Math.min(m-2,g);var w=i(u,s,p,m,g);ED(w,c,null);for(var v=w._index,b=w._ptr,h=b[m],x=[],y=[],N=0,A=m+1,E=2*(m+1),D=3*(m+1),M=4*(m+1),S=5*(m+1),B=6*(m+1),I=7*(m+1),j=x,_=a(m,b,y,N,D,j,E,I,A,B,M,S),O=o(m,b,y,S,M,B,g,A,D,j,E),C=0,z,T,Y,te,$,q,ne,se,Q,ee,ue,X,ie,oe,ce,ye;O<m;){for(Y=-1;C<m&&(Y=y[D+C])===-1;C++);y[E+Y]!==-1&&(j[y[E+Y]]=-1),y[D+C]=y[E+Y];var Ae=y[M+Y],P=y[A+Y];O+=P;var Z=0;y[A+Y]=-P;var V=b[Y],H=Ae===0?V:h,J=H;for(te=1;te<=Ae+1;te++){for(te>Ae?(q=Y,ne=V,se=y[N+Y]-Ae):(q=v[V++],ne=b[q],se=y[N+q]),$=1;$<=se;$++)z=v[ne++],!((Q=y[A+z])<=0)&&(Z+=Q,y[A+z]=-Q,v[J++]=z,y[E+z]!==-1&&(j[y[E+z]]=j[z]),j[z]!==-1?y[E+j[z]]=y[E+z]:y[D+y[S+z]]=y[E+z]);q!==Y&&(b[q]=kt(Y),y[B+q]=0)}for(Ae!==0&&(h=J),y[S+Y]=Z,b[Y]=H,y[N+Y]=J-H,y[M+Y]=-2,_=f(_,d,y,B,m),ee=H;ee<J;ee++)if(z=v[ee],!((ue=y[M+z])<=0)){Q=-y[A+z];var K=_-Q;for(V=b[z],X=b[z]+ue-1;V<=X;V++)q=v[V],y[B+q]>=_?y[B+q]-=Q:y[B+q]!==0&&(y[B+q]=y[S+q]+K)}for(ee=H;ee<J;ee++){for(z=v[ee],X=b[z],ie=X+y[M+z]-1,oe=X,ce=0,ye=0,V=X;V<=ie;V++)if(q=v[V],y[B+q]!==0){var fe=y[B+q]-_;fe>0?(ye+=fe,v[oe++]=q,ce+=q):(b[q]=kt(Y),y[B+q]=0)}y[M+z]=oe-X+1;var pe=oe,k=X+y[N+z];for(V=ie+1;V<k;V++){T=v[V];var U=y[A+T];U<=0||(ye+=U,v[oe++]=T,ce+=T)}ye===0?(b[z]=kt(Y),Q=-y[A+z],Z-=Q,P+=Q,O+=Q,y[A+z]=0,y[M+z]=-1):(y[S+z]=Math.min(y[S+z],ye),v[oe]=v[pe],v[pe]=v[X],v[X]=Y,y[N+z]=oe-X+1,ce=(ce<0?-ce:ce)%m,y[E+z]=y[I+ce],y[I+ce]=z,j[z]=ce)}for(y[S+Y]=Z,d=Math.max(d,Z),_=f(_+d,d,y,B,m),ee=H;ee<J;ee++)if(z=v[ee],!(y[A+z]>=0))for(ce=j[z],z=y[I+ce],y[I+ce]=-1;z!==-1&&y[E+z]!==-1;z=y[E+z],_++){for(se=y[N+z],ue=y[M+z],V=b[z]+1;V<=b[z]+se-1;V++)y[B+v[V]]=_;var G=z;for(T=y[E+z];T!==-1;){var re=y[N+T]===se&&y[M+T]===ue;for(V=b[T]+1;re&&V<=b[T]+se-1;V++)y[B+v[V]]!==_&&(re=0);re?(b[T]=kt(z),y[A+z]+=y[A+T],y[A+T]=0,y[M+T]=-1,T=y[E+T],y[E+G]=T):(G=T,T=y[E+T])}}for(V=H,ee=H;ee<J;ee++)z=v[ee],!((Q=-y[A+z])<=0)&&(y[A+z]=Q,ye=y[S+z]+Z-Q,ye=Math.min(ye,m-O-Q),y[D+ye]!==-1&&(j[y[D+ye]]=z),y[E+z]=y[D+ye],j[z]=-1,y[D+ye]=z,C=Math.min(C,ye),y[S+z]=ye,v[V++]=z);y[A+Y]=P,(y[N+Y]=V-H)===0&&(b[Y]=-1,y[B+Y]=0),Ae!==0&&(h=V)}for(z=0;z<m;z++)b[z]=kt(b[z]);for(T=0;T<=m;T++)y[D+T]=-1;for(T=m;T>=0;T--)y[A+T]>0||(y[E+T]=y[D+b[T]],y[D+b[T]]=T);for(q=m;q>=0;q--)y[A+q]<=0||b[q]!==-1&&(y[E+q]=y[D+b[q]],y[D+b[q]]=q);for(Y=0,z=0;z<=m;z++)b[z]===-1&&(Y=lp(z,Y,y,D,E,x,B));return x.splice(x.length-1,1),x};function i(u,s,l,p,m){var d=t(s);if(u===1&&p===l)return r(s,d);if(u===2){for(var g=d._index,w=d._ptr,v=0,b=0;b<l;b++){var h=w[b];if(w[b]=v,!(w[b+1]-h>m))for(var x=w[b+1];h<x;h++)g[v++]=g[h]}return w[l]=v,s=t(d),n(d,s)}return n(d,s)}function a(u,s,l,p,m,d,g,w,v,b,h,x){for(var y=0;y<u;y++)l[p+y]=s[y+1]-s[y];l[p+u]=0;for(var N=0;N<=u;N++)l[m+N]=-1,d[N]=-1,l[g+N]=-1,l[w+N]=-1,l[v+N]=1,l[b+N]=1,l[h+N]=0,l[x+N]=l[p+N];var A=f(0,0,l,b,u);return l[h+u]=-2,s[u]=-1,l[b+u]=0,A}function o(u,s,l,p,m,d,g,w,v,b,h){for(var x=0,y=0;y<u;y++){var N=l[p+y];if(N===0)l[m+y]=-2,x++,s[y]=-1,l[d+y]=0;else if(N>g)l[w+y]=0,l[m+y]=-1,x++,s[y]=kt(u),l[w+u]++;else{var A=l[v+N];A!==-1&&(b[A]=y),l[h+y]=l[v+N],l[v+N]=y}}return x}function f(u,s,l,p,m){if(u<2||u+s<0){for(var d=0;d<m;d++)l[p+d]!==0&&(l[p+d]=1);u=2}return u}function c(u,s){return u!==s}});function CD(e,r,n,t,i,a,o){var f,c,u=0,s;if(e<=r||n[t+r]<=n[i+e])return-1;n[i+e]=n[t+r];var l=n[a+e];if(n[a+e]=r,l===-1)u=1,s=e;else{for(u=2,s=l;s!==n[o+s];s=n[o+s]);for(f=l;f!==s;f=c)c=n[o+f],n[o+f]=s}return{jleaf:u,q:s}}var BD="csCounts",OD=["transpose"],TD=R(BD,OD,e=>{var{transpose:r}=e;return function(n,t,i,a){if(!n||!t||!i)return null;var o=n._size,f=o[0],c=o[1],u,s,l,p,m,d,g,w=4*c+(a?c+f+1:0),v=[],b=0,h=c,x=2*c,y=3*c,N=4*c,A=5*c+1;for(l=0;l<w;l++)v[l]=-1;var E=[],D=r(n),M=D._index,S=D._ptr;for(l=0;l<c;l++)for(s=i[l],E[s]=v[y+s]===-1?1:0;s!==-1&&v[y+s]===-1;s=t[s])v[y+s]=l;if(a){for(l=0;l<c;l++)v[i[l]]=l;for(u=0;u<f;u++){for(l=c,d=S[u],g=S[u+1],m=d;m<g;m++)l=Math.min(l,v[M[m]]);v[A+u]=v[N+l],v[N+l]=u}}for(u=0;u<c;u++)v[b+u]=u;for(l=0;l<c;l++){for(s=i[l],t[s]!==-1&&E[t[s]]--,p=a?v[N+l]:s;p!==-1;p=a?v[A+p]:-1)for(m=S[p];m<S[p+1];m++){u=M[m];var B=CD(u,s,v,y,h,x,b);B.jleaf>=1&&E[s]++,B.jleaf===2&&E[B.q]--}t[s]!==-1&&(v[b+s]=t[s])}for(s=0;s<c;s++)t[s]!==-1&&(E[t[s]]+=E[s]);return E}}),_D="csSqr",ID=["add","multiply","transpose"],zD=R(_D,ID,e=>{var{add:r,multiply:n,transpose:t}=e,i=FD({add:r,multiply:n,transpose:t}),a=TD({transpose:t});return function(f,c,u){var s=c._ptr,l=c._size,p=l[1],m,d={};if(d.q=i(f,c),f&&!d.q)return null;if(u){var g=f?ND(c,null,d.q,0):c;d.parent=AD(g,1);var w=DD(d.parent,p);if(d.cp=a(g,d.parent,w,1),g&&d.parent&&d.cp&&o(g,d))for(d.unz=0,m=0;m<p;m++)d.unz+=d.cp[m]}else d.unz=4*s[p]+p,d.lnz=d.unz;return d};function o(f,c){var u=f._ptr,s=f._index,l=f._size,p=l[0],m=l[1];c.pinv=[],c.leftmost=[];var d=c.parent,g=c.pinv,w=c.leftmost,v=[],b=0,h=p,x=p+m,y=p+2*m,N,A,E,D,M;for(A=0;A<m;A++)v[h+A]=-1,v[x+A]=-1,v[y+A]=0;for(N=0;N<p;N++)w[N]=-1;for(A=m-1;A>=0;A--)for(D=u[A],M=u[A+1],E=D;E<M;E++)w[s[E]]=A;for(N=p-1;N>=0;N--)g[N]=-1,A=w[N],A!==-1&&(v[y+A]++===0&&(v[x+A]=N),v[b+N]=v[h+A],v[h+A]=N);for(c.lnz=0,c.m2=p,A=0;A<m;A++)if(N=v[h+A],c.lnz++,N<0&&(N=c.m2++),g[N]=A,!(--y[A]<=0)){c.lnz+=v[y+A];var S=d[A];S!==-1&&(v[y+S]===0&&(v[x+S]=v[x+A]),v[b+v[x+A]]=v[h+S],v[h+S]=v[b+N],v[y+S]+=v[y+A])}for(N=0;N<p;N++)g[N]<0&&(g[N]=A++);return!0}});function lo(e,r){return e[r]<0}function cp(e,r){e[r]=kt(e[r])}function fp(e){return e<0?kt(e):e}function RD(e,r,n,t,i){var a=r._index,o=r._ptr,f=r._size,c=f[1],u,s,l,p=0;for(t[0]=e;p>=0;){e=t[p];var m=i?i[e]:e;lo(o,e)||(cp(o,e),t[c+p]=m<0?0:fp(o[m]));var d=1;for(s=t[c+p],l=m<0?0:fp(o[m+1]);s<l;s++)if(u=a[s],!lo(o,u)){t[c+p]=s,t[++p]=u,d=0;break}d&&(p--,t[--n]=e)}return n}function qD(e,r,n,t,i){var a=e._ptr,o=e._size,f=r._index,c=r._ptr,u=o[1],s,l,p,m=u;for(l=c[n],p=c[n+1],s=l;s<p;s++){var d=f[s];lo(a,d)||(m=RD(d,e,m,t,i))}for(s=m;s<u;s++)cp(a,t[s]);return m}var kD="csSpsolve",jD=["divideScalar","multiply","subtract"],PD=R(kD,jD,e=>{var{divideScalar:r,multiply:n,subtract:t}=e;return function(i,a,o,f,c,u,s){var l=i._values,p=i._index,m=i._ptr,d=i._size,g=d[1],w=a._values,v=a._index,b=a._ptr,h,x,y,N,A=qD(i,a,o,f,u);for(h=A;h<g;h++)c[f[h]]=0;for(x=b[o],y=b[o+1],h=x;h<y;h++)c[v[h]]=w[h];for(var E=A;E<g;E++){var D=f[E],M=u?u[D]:D;if(!(M<0))for(x=m[M],y=m[M+1],c[D]=r(c[D],l[s?x:y-1]),h=s?x+1:x,N=s?y:y-1;h<N;h++){var S=p[h];c[S]=t(c[S],n(l[h],c[D]))}}return A}}),UD="csLu",LD=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],HD=R(UD,LD,e=>{var{abs:r,divideScalar:n,multiply:t,subtract:i,larger:a,largerEq:o,SparseMatrix:f}=e,c=PD({divideScalar:n,multiply:t,subtract:i});return function(u,s,l){if(!u)return null;var p=u._size,m=p[1],d,g=100,w=100;s&&(d=s.q,g=s.lnz||g,w=s.unz||w);var v=[],b=[],h=[],x=new f({values:v,index:b,ptr:h,size:[m,m]}),y=[],N=[],A=[],E=new f({values:y,index:N,ptr:A,size:[m,m]}),D=[],M,S,B=[],I=[];for(M=0;M<m;M++)B[M]=0,D[M]=-1,h[M+1]=0;g=0,w=0;for(var j=0;j<m;j++){h[j]=g,A[j]=w;var _=d?d[j]:j,O=c(x,u,_,I,B,D,1),C=-1,z=-1;for(S=O;S<m;S++)if(M=I[S],D[M]<0){var T=r(B[M]);a(T,z)&&(z=T,C=M)}else N[w]=D[M],y[w++]=B[M];if(C===-1||z<=0)return null;D[_]<0&&o(r(B[_]),t(z,l))&&(C=_);var Y=B[C];for(N[w]=j,y[w++]=Y,D[C]=j,b[g]=C,v[g++]=1,S=O;S<m;S++)M=I[S],D[M]<0&&(b[g]=M,v[g++]=n(B[M],Y)),B[M]=0}for(h[m]=g,A[m]=w,S=0;S<g;S++)b[S]=D[b[S]];return v.splice(g,v.length-g),b.splice(g,b.length-g),y.splice(w,y.length-w),N.splice(w,N.length-w),{L:x,U:E,pinv:D}}}),pp="slu",$D=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],ZD=R(pp,$D,e=>{var{typed:r,abs:n,add:t,multiply:i,transpose:a,divideScalar:o,subtract:f,larger:c,largerEq:u,SparseMatrix:s}=e,l=zD({add:t,multiply:i,transpose:a}),p=HD({abs:n,divideScalar:o,multiply:i,subtract:f,larger:c,largerEq:u,SparseMatrix:s});return r(pp,{"SparseMatrix, number, number":function(m,d,g){if(!Se(d)||d<0||d>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(g<0||g>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var w=l(d,m,!1),v=p(m,w,g);return{L:v.L,U:v.U,p:v.pinv,q:w.q,toString:function(){return"L: "+this.L.toString()+`
47
+ U: `+this.U.toString()+`
48
+ p: `+this.p.toString()+(this.q?`
49
+ q: `+this.q.toString():"")+`
50
+ `}}}})});function mp(e,r){var n,t=r.length,i=[];if(e)for(n=0;n<t;n++)i[e[n]]=r[n];else for(n=0;n<t;n++)i[n]=r[n];return i}var dp="lusolve",JD=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],WD=R(dp,JD,e=>{var{typed:r,matrix:n,lup:t,slu:i,usolve:a,lsolve:o,DenseMatrix:f}=e,c=Qn({DenseMatrix:f});return r(dp,{"Array, Array | Matrix":function(l,p){l=n(l);var m=t(l),d=s(m.L,m.U,m.p,null,p);return d.valueOf()},"DenseMatrix, Array | Matrix":function(l,p){var m=t(l);return s(m.L,m.U,m.p,null,p)},"SparseMatrix, Array | Matrix":function(l,p){var m=t(l);return s(m.L,m.U,m.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(l,p,m,d){var g=i(l,m,d);return s(g.L,g.U,g.p,g.q,p)},"Object, Array | Matrix":function(l,p){return s(l.L,l.U,l.p,l.q,p)}});function u(l){if(Be(l))return l;if(Xe(l))return n(l);throw new TypeError("Invalid Matrix LU decomposition")}function s(l,p,m,d,g){l=u(l),p=u(p),m&&(g=c(l,g,!0),g._data=mp(m,g._data));var w=o(l,g),v=a(p,w);return d&&(v._data=mp(d,v._data)),v}}),hp="polynomialRoot",YD=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],GD=R(hp,YD,e=>{var{typed:r,isZero:n,equalScalar:t,add:i,subtract:a,multiply:o,divide:f,sqrt:c,unaryMinus:u,cbrt:s,typeOf:l,im:p,re:m}=e;return r(hp,{"number|Complex, ...number|Complex":(d,g)=>{for(var w=[d,...g];w.length>0&&n(w[w.length-1]);)w.pop();if(w.length<2)throw new RangeError("Polynomial [".concat(d,", ").concat(g,"] must have a non-zero non-constant coefficient"));switch(w.length){case 2:return[u(f(w[0],w[1]))];case 3:{var[v,b,h]=w,x=o(2,h),y=o(b,b),N=o(4,h,v);if(t(y,N))return[f(u(b),x)];var A=c(a(y,N));return[f(a(A,b),x),f(a(u(A),b),x)]}case 4:{var[E,D,M,S]=w,B=u(o(3,S)),I=o(M,M),j=o(3,S,D),_=i(o(2,M,M,M),o(27,S,S,E)),O=o(9,S,M,D);if(t(I,j)&&t(_,O))return[f(M,B)];var C=a(I,j),z=a(_,O),T=i(o(18,S,M,D,E),o(M,M,D,D)),Y=i(o(4,M,M,M,E),o(4,S,D,D,D),o(27,S,S,E,E));if(t(T,Y))return[f(a(o(4,S,M,D),i(o(9,S,S,E),o(M,M,M))),o(S,C)),f(a(o(9,S,E),o(M,D)),o(2,C))];var te;t(I,j)?te=z:te=f(i(z,c(a(o(z,z),o(4,C,C,C)))),2);var $=!0,q=s(te,$).toArray().map(ne=>f(i(M,ne,f(C,ne)),B));return q.map(ne=>l(ne)==="Complex"&&t(m(ne),m(ne)+p(ne))?m(ne):ne)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(w))}}})}),VD="Help",KD=["evaluate"],QD=R(VD,KD,e=>{var{evaluate:r}=e;function n(t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!t)throw new Error('Argument "doc" missing');this.doc=t}return n.prototype.type="Help",n.prototype.isHelp=!0,n.prototype.toString=function(){var t=this.doc||{},i=`
51
+ `;if(t.name&&(i+="Name: "+t.name+`
52
+
53
+ `),t.category&&(i+="Category: "+t.category+`
54
+
55
+ `),t.description&&(i+=`Description:
56
+ `+t.description+`
57
+
58
+ `),t.syntax&&(i+=`Syntax:
59
+ `+t.syntax.join(`
60
+ `)+`
61
+
62
+ `),t.examples){i+=`Examples:
63
+ `;for(var a=!1,o=r("config()"),f={config:l=>(a=!0,r("config(newConfig)",{newConfig:l}))},c=0;c<t.examples.length;c++){var u=t.examples[c];i+=" "+u+`
64
+ `;var s=void 0;try{s=r(u,f)}catch(l){s=l}s!==void 0&&!Zo(s)&&(i+=" "+Le(s,{precision:14})+`
65
+ `)}i+=`
66
+ `,a&&r("config(originalConfig)",{originalConfig:o})}return t.mayThrow&&t.mayThrow.length&&(i+="Throws: "+t.mayThrow.join(", ")+`
67
+
68
+ `),t.seealso&&t.seealso.length&&(i+="See also: "+t.seealso.join(", ")+`
69
+ `),i},n.prototype.toJSON=function(){var t=Ie(this.doc);return t.mathjs="Help",t},n.fromJSON=function(t){var i={};return Object.keys(t).filter(a=>a!=="mathjs").forEach(a=>{i[a]=t[a]}),new n(i)},n.prototype.valueOf=n.prototype.toString,n},{isClass:!0}),XD="Chain",eA=["?on","math","typed"],rA=R(XD,eA,e=>{var{on:r,math:n,typed:t}=e;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Jo(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Le(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,s){typeof s=="function"&&(i.prototype[u]=f(s))}function o(u,s){Kd(i.prototype,u,function(){var l=s();if(typeof l=="function")return f(l)})}function f(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var s=[this.value],l=0;l<arguments.length;l++)s[l+1]=arguments[l];if(t.isTypedFunction(u)){var p=t.resolve(u,s);if(p.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(p.implementation.apply(u,s))}return new i(u.apply(u,s))}}i.createProxy=function(u,s){if(typeof u=="string")a(u,s);else{var l=function(m){Me(u,m)&&c[m]===void 0&&o(m,()=>u[m])};for(var p in u)l(p)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(n),r&&r("import",function(u,s,l){l||o(u,s)}),i},{isClass:!0}),gp={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},tA={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},nA={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},iA={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},aA={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},oA={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},sA={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},uA={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},lA={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},cA={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},fA={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},vp={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},pA={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},mA={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},dA={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},hA={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},gA={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},vA={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},yA={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},xA={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},bA={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},wA={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},NA={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},DA={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},AA={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},EA={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},MA={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},SA={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},FA={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},CA={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]},BA={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]},OA={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]},TA={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},_A={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},IA={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},zA={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},RA={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},qA={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},kA={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},jA={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},PA={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},UA={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},LA={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},HA={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},$A={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},ZA={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},JA={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},WA={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},YA={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},GA={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},VA={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},KA={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},QA={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},XA={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},eE={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},rE={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},tE={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},nE={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},iE={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},aE={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},oE={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},sE={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},uE={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},lE={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},cE={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},fE={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]},pE={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},mE={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},dE={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},hE={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},gE={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},vE={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},yE={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},xE={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},bE={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},wE={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},NE={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},DE={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},AE={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},EE={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]},ME={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]},SE={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},FE={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},CE={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},BE={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},OE={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},TE={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]},_E={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},IE={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]},zE={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},RE={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},qE={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]},kE={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]},jE={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},PE={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]},UE={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]},LE={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]},HE={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]},$E={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]},ZE={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},JE={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]},WE={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},YE={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},GE={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},VE={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]},KE={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},QE={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]},XE={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]},eM={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]},rM={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]},tM={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]},nM={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]},iM={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]},aM={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},oM={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]},sM={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]},uM={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},lM={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},cM={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},fM={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},pM={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},mM={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},dM={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},hM={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]},gM={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},vM={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},yM={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},xM={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},bM={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore–Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},wM={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},NM={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},DM={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},AM={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},EM={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},MM={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},SM={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},FM={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},CM={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},BM={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},OM={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},TM={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},_M={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},IM={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},zM={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},RM={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},qM={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},kM={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},jM={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},PM={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},UM={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},LM={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},HM={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},$M={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},ZM={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},JM={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},WM={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},YM={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},GM={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},VM={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},KM={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},QM={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},XM={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},eS={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},rS={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},tS={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},nS={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},iS={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},aS={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},oS={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},sS={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},uS={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},lS={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},cS={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},fS={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},pS={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},mS={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},dS={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},hS={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},gS={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},vS={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},yS={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},xS={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},bS={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},wS={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},NS={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},DS={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},AS={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},ES={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},MS={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},SS={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},FS={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},CS={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},BS={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},OS={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},TS={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber.
70
+
71
+ In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},_S={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},IS={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},zS={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},RS={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]},qS={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},kS={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},jS={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},PS={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},US={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},LS={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},HS={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},$S={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},ZS={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},JS={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},WS={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},YS={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},GS={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},VS={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},KS={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},QS={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},XS={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},e3={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},r3={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},t3={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]},n3={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},i3={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},a3={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},o3={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},s3={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},u3={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},l3={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},c3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},f3={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},p3={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},m3={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},d3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},h3={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},g3={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},v3={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},y3={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},x3={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},b3={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},w3={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},N3={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]},D3={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},A3={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},E3={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},M3={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},S3={bignumber:vA,boolean:yA,complex:xA,createUnit:bA,fraction:wA,index:NA,matrix:DA,number:AA,sparse:EA,splitUnit:MA,string:SA,unit:FA,e:gp,E:gp,false:tA,i:nA,Infinity:iA,LN2:oA,LN10:aA,LOG2E:uA,LOG10E:sA,NaN:lA,null:cA,pi:vp,PI:vp,phi:fA,SQRT1_2:pA,SQRT2:mA,tau:dA,true:hA,version:gA,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:TA,lsolve:IA,lsolveAll:zA,lup:RA,lusolve:qA,leafCount:_A,polynomialRoot:kA,resolve:UA,simplify:LA,simplifyConstant:HA,simplifyCore:$A,symbolicEqual:JA,rationalize:PA,slu:ZA,usolve:WA,usolveAll:YA,qr:jA,abs:GA,add:VA,cbrt:KA,ceil:QA,cube:XA,divide:eE,dotDivide:rE,dotMultiply:tE,dotPow:nE,exp:iE,expm:aE,expm1:oE,fix:sE,floor:uE,gcd:lE,hypot:cE,lcm:pE,log:mE,log2:gE,log1p:hE,log10:dE,mod:vE,multiply:yE,norm:xE,nthRoot:bE,nthRoots:wE,pow:NE,round:DE,sign:AE,sqrt:EE,sqrtm:ME,square:BE,subtract:OE,unaryMinus:TE,unaryPlus:_E,xgcd:IE,invmod:fE,bitAnd:zE,bitNot:RE,bitOr:qE,bitXor:kE,leftShift:jE,rightArithShift:PE,rightLogShift:UE,bellNumbers:LE,catalan:HE,composition:$E,stirlingS2:ZE,config:CA,import:BA,typed:OA,arg:JE,conj:WE,re:GE,im:YE,evaluate:VE,help:KE,distance:QE,intersect:XE,and:eM,not:rM,or:tM,xor:nM,concat:aM,count:oM,cross:sM,column:iM,ctranspose:uM,det:lM,diag:cM,diff:fM,dot:pM,getMatrixDataType:vM,identity:yM,filter:dM,flatten:hM,forEach:gM,inv:xM,pinv:bM,eigs:mM,kron:wM,matrixFromFunction:AM,matrixFromRows:EM,matrixFromColumns:DM,map:NM,ones:MM,partitionSelect:SM,range:FM,resize:BM,reshape:CM,rotate:OM,rotationMatrix:TM,row:_M,size:IM,sort:zM,squeeze:RM,subset:qM,trace:kM,transpose:jM,zeros:PM,fft:UM,ifft:LM,sylvester:SE,schur:FE,lyap:CE,solveODE:M3,combinations:HM,combinationsWithRep:$M,factorial:ZM,gamma:JM,kldivergence:YM,lgamma:WM,multinomial:GM,permutations:VM,pickRandom:KM,random:QM,randomInt:XM,compare:eS,compareNatural:rS,compareText:tS,deepEqual:nS,equal:iS,equalText:aS,larger:oS,largerEq:sS,smaller:uS,smallerEq:lS,unequal:cS,setCartesian:fS,setDifference:pS,setDistinct:mS,setIntersect:dS,setIsSubset:hS,setMultiplicity:gS,setPowerset:vS,setSize:yS,setSymDifference:xS,setUnion:bS,zpk2tf:wS,freqz:NS,erf:DS,zeta:AS,cumsum:IS,mad:ES,max:MS,mean:SS,median:FS,min:CS,mode:BS,prod:OS,quantileSeq:TS,std:_S,sum:zS,variance:RS,corr:qS,acos:kS,acosh:jS,acot:PS,acoth:US,acsc:LS,acsch:HS,asec:$S,asech:ZS,asin:JS,asinh:WS,atan:YS,atanh:VS,atan2:GS,cos:KS,cosh:QS,cot:XS,coth:e3,csc:r3,csch:t3,sec:n3,sech:i3,sin:a3,sinh:o3,tan:s3,tanh:u3,to:l3,clone:f3,format:p3,bin:c3,oct:D3,hex:d3,isNaN:g3,isInteger:h3,isNegative:v3,isNumeric:y3,hasNumericValue:m3,isPositive:x3,isPrime:b3,isZero:w3,print:A3,typeOf:E3,numeric:N3},yp="help",F3=["typed","mathWithTransform","Help"],C3=R(yp,F3,e=>{var{typed:r,mathWithTransform:n,Help:t}=e;return r(yp,{any:function(i){var a,o=i;if(typeof i!="string"){for(a in n)if(Me(n,a)&&i===n[a]){o=a;break}}var f=Tr(S3,o);if(!f){var c=typeof o=="function"?o.name:o;throw new Error('No documentation found on "'+c+'"')}return new t(f)}})}),xp="chain",B3=["typed","Chain"],O3=R(xp,B3,e=>{var{typed:r,Chain:n}=e;return r(xp,{"":function(){return new n},any:function(t){return new n(t)}})}),bp="det",T3=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],_3=R(bp,T3,e=>{var{typed:r,matrix:n,subtractScalar:t,multiply:i,divideScalar:a,isZero:o,unaryMinus:f}=e;return r(bp,{any:function(u){return Ie(u)},"Array | Matrix":function(u){var s;switch(Be(u)?s=u.size():Array.isArray(u)?(u=n(u),s=u.size()):s=[],s.length){case 0:return Ie(u);case 1:if(s[0]===1)return Ie(u.valueOf()[0]);if(s[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Le(s)+")");case 2:{var l=s[0],p=s[1];if(l===p)return c(u.clone().valueOf(),l);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+Le(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Le(s)+")")}}});function c(u,s,l){if(s===1)return Ie(u[0][0]);if(s===2)return t(i(u[0][0],u[1][1]),i(u[1][0],u[0][1]));for(var p=!1,m=new Array(s).fill(0).map((A,E)=>E),d=0;d<s;d++){var g=m[d];if(o(u[g][d])){var w=void 0;for(w=d+1;w<s;w++)if(!o(u[m[w]][d])){g=m[w],m[w]=m[d],m[d]=g,p=!p;break}if(w===s)return u[g][d]}for(var v=u[g][d],b=d===0?1:u[m[d-1]][d-1],h=d+1;h<s;h++)for(var x=m[h],y=d+1;y<s;y++)u[x][y]=a(t(i(u[x][y],v),i(u[x][d],u[g][y])),b)}var N=u[m[s-1]][s-1];return p?f(N):N}}),wp="inv",I3=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],z3=R(wp,I3,e=>{var{typed:r,matrix:n,divideScalar:t,addScalar:i,multiply:a,unaryMinus:o,det:f,identity:c,abs:u}=e;return r(wp,{"Array | Matrix":function(l){var p=Be(l)?l.size():qe(l);switch(p.length){case 1:if(p[0]===1)return Be(l)?n([t(1,l.valueOf()[0])]):[t(1,l[0])];throw new RangeError("Matrix must be square (size: "+Le(p)+")");case 2:{var m=p[0],d=p[1];if(m===d)return Be(l)?n(s(l.valueOf(),m,d),l.storage()):s(l,m,d);throw new RangeError("Matrix must be square (size: "+Le(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Le(p)+")")}},any:function(l){return t(1,l)}});function s(l,p,m){var d,g,w,v,b;if(p===1){if(v=l[0][0],v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[t(1,v)]]}else if(p===2){var h=f(l);if(h===0)throw Error("Cannot calculate inverse, determinant is zero");return[[t(l[1][1],h),t(o(l[0][1]),h)],[t(o(l[1][0]),h),t(l[0][0],h)]]}else{var x=l.concat();for(d=0;d<p;d++)x[d]=x[d].concat();for(var y=c(p).valueOf(),N=0;N<m;N++){var A=u(x[N][N]),E=N;for(d=N+1;d<p;)u(x[d][N])>A&&(A=u(x[d][N]),E=d),d++;if(A===0)throw Error("Cannot calculate inverse, determinant is zero");d=E,d!==N&&(b=x[N],x[N]=x[d],x[d]=b,b=y[N],y[N]=y[d],y[d]=b);var D=x[N],M=y[N];for(d=0;d<p;d++){var S=x[d],B=y[d];if(d!==N){if(S[N]!==0){for(w=t(o(S[N]),D[N]),g=N;g<m;g++)S[g]=i(S[g],a(w,D[g]));for(g=0;g<m;g++)B[g]=i(B[g],a(w,M[g]))}}else{for(w=D[N],g=N;g<m;g++)S[g]=t(S[g],w);for(g=0;g<m;g++)B[g]=t(B[g],w)}}}return y}}}),Np="pinv",R3=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],q3=R(Np,R3,e=>{var{typed:r,matrix:n,inv:t,deepEqual:i,equal:a,dotDivide:o,dot:f,ctranspose:c,divideScalar:u,multiply:s,add:l,Complex:p}=e;return r(Np,{"Array | Matrix":function(b){var h=Be(b)?b.size():qe(b);switch(h.length){case 1:return v(b)?c(b):h[0]===1?t(b):o(c(b),f(b,b));case 2:{if(v(b))return c(b);var x=h[0],y=h[1];if(x===y)try{return t(b)}catch(N){if(!(N instanceof Error&&N.message.match(/Cannot calculate inverse, determinant is zero/)))throw N}return Be(b)?n(m(b.valueOf(),x,y),b.storage()):m(b,x,y)}default:throw new RangeError("Matrix must be two dimensional (size: "+Le(h)+")")}},any:function(b){return a(b,0)?Ie(b):u(1,b)}});function m(b,h,x){var{C:y,F:N}=g(b,h,x),A=s(t(s(c(y),y)),c(y)),E=s(c(N),t(s(N,c(N))));return s(E,A)}function d(b,h,x){for(var y=Ie(b),N=0,A=0;A<h;A++){if(x<=N)return y;for(var E=A;w(y[E][N]);)if(E++,h===E&&(E=A,N++,x===N))return y;[y[E],y[A]]=[y[A],y[E]];for(var D=y[A][N],M=0;M<x;M++)y[A][M]=o(y[A][M],D);for(var S=0;S<h;S++)if(S!==A){D=y[S][N];for(var B=0;B<x;B++)y[S][B]=l(y[S][B],s(-1,s(D,y[A][B])))}N++}return y}function g(b,h,x){var y=d(b,h,x),N=b.map((E,D)=>E.filter((M,S)=>S<h&&!w(f(y[S],y[S])))),A=y.filter((E,D)=>!w(f(y[D],y[D])));return{C:N,F:A}}function w(b){return a(l(b,p(1,1)),l(0,p(1,1)))}function v(b){return i(l(b,p(1,1)),l(s(b,0),p(1,1)))}});function k3(e){var{addScalar:r,subtract:n,flatten:t,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:f,abs:c,bignumber:u,diag:s,size:l,reshape:p,inv:m,qr:d,usolve:g,usolveAll:w,equal:v,complex:b,larger:h,smaller:x,matrixFromColumns:y,dot:N}=e;function A($,q,ne,se){var Q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ee=E($,q,ne,se,Q);D($,q,ne,se,Q,ee);var{values:ue,C:X}=M($,q,ne,se,Q);if(Q){var ie=S($,q,X,ee,ue,ne,se);return{values:ue,eigenvectors:ie}}return{values:ue}}function E($,q,ne,se,Q){var ee=se==="BigNumber",ue=se==="Complex",X=ee?u(0):0,ie=ee?u(1):ue?b(1):1,oe=ee?u(1):1,ce=ee?u(10):2,ye=a(ce,ce),Ae;Q&&(Ae=Array(q).fill(ie));for(var P=!1;!P;){P=!0;for(var Z=0;Z<q;Z++){for(var V=X,H=X,J=0;J<q;J++)Z!==J&&(V=r(V,c($[J][Z])),H=r(H,c($[Z][J])));if(!v(V,0)&&!v(H,0)){for(var K=oe,fe=V,pe=o(H,ce),k=a(H,ce);x(fe,pe);)fe=a(fe,ye),K=a(K,ce);for(;h(fe,k);)fe=o(fe,ye),K=o(K,ce);var U=x(o(r(fe,H),K),a(r(V,H),.95));if(U){P=!1;for(var G=o(1,K),re=0;re<q;re++)Z!==re&&($[Z][re]=a($[Z][re],G),$[re][Z]=a($[re][Z],K));Q&&(Ae[Z]=a(Ae[Z],G))}}}}return Q?s(Ae):null}function D($,q,ne,se,Q,ee){var ue=se==="BigNumber",X=se==="Complex",ie=ue?u(0):X?b(0):0;ue&&(ne=u(ne));for(var oe=0;oe<q-2;oe++){for(var ce=0,ye=ie,Ae=oe+1;Ae<q;Ae++){var P=$[Ae][oe];x(c(ye),c(P))&&(ye=P,ce=Ae)}if(!x(c(ye),ne)){if(ce!==oe+1){var Z=$[ce];$[ce]=$[oe+1],$[oe+1]=Z;for(var V=0;V<q;V++){var H=$[V][ce];$[V][ce]=$[V][oe+1],$[V][oe+1]=H}if(Q){var J=ee[ce];ee[ce]=ee[oe+1],ee[oe+1]=J}}for(var K=oe+2;K<q;K++){var fe=o($[K][oe],ye);if(fe!==0){for(var pe=0;pe<q;pe++)$[K][pe]=n($[K][pe],a(fe,$[oe+1][pe]));for(var k=0;k<q;k++)$[k][oe+1]=r($[k][oe+1],a(fe,$[k][K]));if(Q)for(var U=0;U<q;U++)ee[K][U]=n(ee[K][U],a(fe,ee[oe+1][U]))}}}}return ee}function M($,q,ne,se,Q){var ee=se==="BigNumber",ue=se==="Complex",X=ee?u(1):ue?b(1):1;ee&&(ne=u(ne));for(var ie=Ie($),oe=[],ce=q,ye=[],Ae=Q?s(Array(q).fill(X)):void 0,P=Q?s(Array(ce).fill(X)):void 0,Z=0;Z<=100;){Z+=1;for(var V=ie[ce-1][ce-1],H=0;H<ce;H++)ie[H][H]=n(ie[H][H],V);var{Q:J,R:K}=d(ie);ie=i(K,J);for(var fe=0;fe<ce;fe++)ie[fe][fe]=r(ie[fe][fe],V);if(Q&&(P=i(P,J)),ce===1||x(c(ie[ce-1][ce-2]),ne)){Z=0,oe.push(ie[ce-1][ce-1]),Q&&(ye.unshift([[1]]),j(P,q),Ae=i(Ae,P),ce>1&&(P=s(Array(ce-1).fill(X)))),ce-=1,ie.pop();for(var pe=0;pe<ce;pe++)ie[pe].pop()}else if(ce===2||x(c(ie[ce-2][ce-3]),ne)){Z=0;var k=B(ie[ce-2][ce-2],ie[ce-2][ce-1],ie[ce-1][ce-2],ie[ce-1][ce-1]);oe.push(...k),Q&&(ye.unshift(I(ie[ce-2][ce-2],ie[ce-2][ce-1],ie[ce-1][ce-2],ie[ce-1][ce-1],k[0],k[1],ne,se)),j(P,q),Ae=i(Ae,P),ce>2&&(P=s(Array(ce-2).fill(X)))),ce-=2,ie.pop(),ie.pop();for(var U=0;U<ce;U++)ie[U].pop(),ie[U].pop()}if(ce===0)break}if(oe.sort((le,me)=>+n(c(le),c(me))),Z>100){var G=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+oe.join(", "));throw G.values=oe,G.vectors=[],G}var re=Q?i(Ae,_(ye,q)):void 0;return{values:oe,C:re}}function S($,q,ne,se,Q,ee,ue){var X=m(ne),ie=i(X,$,ne),oe=ue==="BigNumber",ce=ue==="Complex",ye=oe?u(0):ce?b(0):0,Ae=oe?u(1):ce?b(1):1,P=[],Z=[];for(var V of Q){var H=O(P,V,v);H===-1?(P.push(V),Z.push(1)):Z[H]+=1}for(var J=[],K=P.length,fe=Array(q).fill(ye),pe=s(Array(q).fill(Ae)),k=function(){var G=P[U],re=n(ie,i(G,pe)),le=w(re,fe);for(le.shift();le.length<Z[U];){var me=C(re,q,le,ee,ue);if(me===null)break;le.push(me)}var xe=i(m(se),ne);le=le.map(he=>i(xe,he)),J.push(...le.map(he=>({value:G,vector:t(he)})))},U=0;U<K;U++)k();return J}function B($,q,ne,se){var Q=r($,se),ee=n(a($,se),a(q,ne)),ue=a(Q,.5),X=a(f(n(a(Q,Q),a(4,ee))),.5);return[r(ue,X),n(ue,X)]}function I($,q,ne,se,Q,ee,ue,X){var ie=X==="BigNumber",oe=X==="Complex",ce=ie?u(0):oe?b(0):0,ye=ie?u(1):oe?b(1):1;if(x(c(ne),ue))return[[ye,ce],[ce,ye]];if(h(c(n(Q,ee)),ue))return[[n(Q,se),n(ee,se)],[ne,ne]];var Ae=n($,Q),P=n(se,Q);return x(c(q),ue)&&x(c(P),ue)?[[Ae,ye],[ne,ce]]:[[q,ce],[P,ye]]}function j($,q){for(var ne=0;ne<$.length;ne++)$[ne].push(...Array(q-$[ne].length).fill(0));for(var se=$.length;se<q;se++)$.push(Array(q).fill(0)),$[se][se]=1;return $}function _($,q){for(var ne=[],se=0;se<q;se++)ne[se]=Array(q).fill(0);var Q=0;for(var ee of $){for(var ue=ee.length,X=0;X<ue;X++)for(var ie=0;ie<ue;ie++)ne[Q+X][Q+ie]=ee[X][ie];Q+=ue}return ne}function O($,q,ne){for(var se=0;se<$.length;se++)if(ne($[se],q))return se;return-1}function C($,q,ne,se,Q){for(var ee=Q==="BigNumber"?u(1e3):1e3,ue,X=0;X<5;++X){ue=z(q,ne,Q);try{ue=g($,ue)}catch{continue}if(h(Y(ue),ee))break}if(X>=5)return null;for(X=0;;){var ie=g($,ue);if(x(Y(T(ue,[ie])),se))break;if(++X>=10)return null;ue=te(ie)}return ue}function z($,q,ne){var se=ne==="BigNumber",Q=ne==="Complex",ee=Array($).fill(0).map(ue=>2*Math.random()-1);return se&&(ee=ee.map(ue=>u(ue))),Q&&(ee=ee.map(ue=>b(ue))),ee=T(ee,q),te(ee,ne)}function T($,q){var ne=l($);for(var se of q)se=p(se,ne),$=n($,i(o(N(se,$),N(se,se)),se));return $}function Y($){return c(f(N($,$)))}function te($,q){var ne=q==="BigNumber",se=q==="Complex",Q=ne?u(1):se?b(1):1;return i(o(Q,Y($)),$)}return A}function j3(e){var{config:r,addScalar:n,subtract:t,abs:i,atan:a,cos:o,sin:f,multiplyScalar:c,inv:u,bignumber:s,multiply:l,add:p}=e;function m(D,M){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,B=arguments.length>3?arguments[3]:void 0,I=arguments.length>4?arguments[4]:void 0;if(B==="number")return d(D,S,I);if(B==="BigNumber")return g(D,S,I);throw TypeError("Unsupported data type: "+B)}function d(D,M,S){var B=D.length,I=Math.abs(M/B),j,_;if(S){_=new Array(B);for(var O=0;O<B;O++)_[O]=Array(B).fill(0),_[O][O]=1}for(var C=N(D);Math.abs(C[1])>=Math.abs(I);){var z=C[0][0],T=C[0][1];j=w(D[z][z],D[T][T],D[z][T]),D=y(D,j,z,T),S&&(_=b(_,j,z,T)),C=N(D)}for(var Y=Array(B).fill(0),te=0;te<B;te++)Y[te]=D[te][te];return E(Ie(Y),_,S)}function g(D,M,S){var B=D.length,I=i(M/B),j,_;if(S){_=new Array(B);for(var O=0;O<B;O++)_[O]=Array(B).fill(0),_[O][O]=1}for(var C=A(D);i(C[1])>=i(I);){var z=C[0][0],T=C[0][1];j=v(D[z][z],D[T][T],D[z][T]),D=x(D,j,z,T),S&&(_=h(_,j,z,T)),C=A(D)}for(var Y=Array(B).fill(0),te=0;te<B;te++)Y[te]=D[te][te];return E(Ie(Y),_,S)}function w(D,M,S){var B=M-D;return Math.abs(B)<=r.epsilon?Math.PI/4:.5*Math.atan(2*S/(M-D))}function v(D,M,S){var B=t(M,D);return i(B)<=r.epsilon?s(-1).acos().div(4):c(.5,a(l(2,S,u(B))))}function b(D,M,S,B){for(var I=D.length,j=Math.cos(M),_=Math.sin(M),O=Array(I).fill(0),C=Array(I).fill(0),z=0;z<I;z++)O[z]=j*D[z][S]-_*D[z][B],C[z]=_*D[z][S]+j*D[z][B];for(var T=0;T<I;T++)D[T][S]=O[T],D[T][B]=C[T];return D}function h(D,M,S,B){for(var I=D.length,j=o(M),_=f(M),O=Array(I).fill(s(0)),C=Array(I).fill(s(0)),z=0;z<I;z++)O[z]=t(c(j,D[z][S]),c(_,D[z][B])),C[z]=n(c(_,D[z][S]),c(j,D[z][B]));for(var T=0;T<I;T++)D[T][S]=O[T],D[T][B]=C[T];return D}function x(D,M,S,B){for(var I=D.length,j=s(o(M)),_=s(f(M)),O=c(j,j),C=c(_,_),z=Array(I).fill(s(0)),T=Array(I).fill(s(0)),Y=l(s(2),j,_,D[S][B]),te=n(t(c(O,D[S][S]),Y),c(C,D[B][B])),$=p(c(C,D[S][S]),Y,c(O,D[B][B])),q=0;q<I;q++)z[q]=t(c(j,D[S][q]),c(_,D[B][q])),T[q]=n(c(_,D[S][q]),c(j,D[B][q]));D[S][S]=te,D[B][B]=$,D[S][B]=s(0),D[B][S]=s(0);for(var ne=0;ne<I;ne++)ne!==S&&ne!==B&&(D[S][ne]=z[ne],D[ne][S]=z[ne],D[B][ne]=T[ne],D[ne][B]=T[ne]);return D}function y(D,M,S,B){for(var I=D.length,j=Math.cos(M),_=Math.sin(M),O=j*j,C=_*_,z=Array(I).fill(0),T=Array(I).fill(0),Y=O*D[S][S]-2*j*_*D[S][B]+C*D[B][B],te=C*D[S][S]+2*j*_*D[S][B]+O*D[B][B],$=0;$<I;$++)z[$]=j*D[S][$]-_*D[B][$],T[$]=_*D[S][$]+j*D[B][$];D[S][S]=Y,D[B][B]=te,D[S][B]=0,D[B][S]=0;for(var q=0;q<I;q++)q!==S&&q!==B&&(D[S][q]=z[q],D[q][S]=z[q],D[B][q]=T[q],D[q][B]=T[q]);return D}function N(D){for(var M=D.length,S=0,B=[0,1],I=0;I<M;I++)for(var j=I+1;j<M;j++)Math.abs(S)<Math.abs(D[I][j])&&(S=Math.abs(D[I][j]),B=[I,j]);return[B,S]}function A(D){for(var M=D.length,S=0,B=[0,1],I=0;I<M;I++)for(var j=I+1;j<M;j++)i(S)<i(D[I][j])&&(S=i(D[I][j]),B=[I,j]);return[B,S]}function E(D,M,S){var B=D.length,I=Array(B),j;if(S){j=Array(B);for(var _=0;_<B;_++)j[_]=Array(B)}for(var O=0;O<B;O++){for(var C=0,z=D[0],T=0;T<D.length;T++)i(D[T])<i(z)&&(C=T,z=D[C]);if(I[O]=D.splice(C,1)[0],S)for(var Y=0;Y<B;Y++)j[O][Y]=M[Y][C],M[Y].splice(C,1)}if(!S)return{values:I};var te=j.map(($,q)=>({value:I[q],vector:$}));return{values:I,eigenvectors:te}}return m}var P3="eigs",U3=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],L3=R(P3,U3,e=>{var{config:r,typed:n,matrix:t,addScalar:i,subtract:a,equal:o,abs:f,atan:c,cos:u,sin:s,multiplyScalar:l,divideScalar:p,inv:m,bignumber:d,multiply:g,add:w,larger:v,column:b,flatten:h,number:x,complex:y,sqrt:N,diag:A,size:E,reshape:D,qr:M,usolve:S,usolveAll:B,im:I,re:j,smaller:_,matrixFromColumns:O,dot:C}=e,z=j3({config:r,addScalar:i,subtract:a,column:b,flatten:h,equal:o,abs:f,atan:c,cos:u,sin:s,multiplyScalar:l,inv:m,bignumber:d,complex:y,multiply:g,add:w}),T=k3({config:r,addScalar:i,subtract:a,multiply:g,multiplyScalar:l,flatten:h,divideScalar:p,sqrt:N,abs:f,bignumber:d,diag:A,size:E,reshape:D,qr:M,inv:m,usolve:S,usolveAll:B,equal:o,complex:y,larger:v,smaller:_,matrixFromColumns:O,dot:C});return n("eigs",{Array:function(Q){return Y(t(Q))},"Array, number|BigNumber":function(Q,ee){return Y(t(Q),{precision:ee})},"Array, Object"(Q,ee){return Y(t(Q),ee)},Matrix:function(Q){return Y(Q,{matricize:!0})},"Matrix, number|BigNumber":function(Q,ee){return Y(Q,{precision:ee,matricize:!0})},"Matrix, Object":function(Q,ee){var ue={matricize:!0};return dr(ue,ee),Y(Q,ue)}});function Y(Q){var ee,ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},X="eigenvectors"in ue?ue.eigenvectors:!0,ie=(ee=ue.precision)!==null&&ee!==void 0?ee:r.epsilon,oe=te(Q,ie,X);return ue.matricize&&(oe.values=t(oe.values),X&&(oe.eigenvectors=oe.eigenvectors.map(ce=>{var{value:ye,vector:Ae}=ce;return{value:ye,vector:t(Ae)}}))),X&&Object.defineProperty(oe,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),oe}function te(Q,ee,ue){var X=Q.toArray(),ie=Q.size();if(ie.length!==2||ie[0]!==ie[1])throw new RangeError("Matrix must be square (size: ".concat(Le(ie),")"));var oe=ie[0];if(q(X,oe,ee)&&(ne(X,oe),$(X,oe,ee))){var ce=se(Q,X,oe);return z(X,oe,ee,ce,ue)}var ye=se(Q,X,oe);return T(X,oe,ee,ye,ue)}function $(Q,ee,ue){for(var X=0;X<ee;X++)for(var ie=X;ie<ee;ie++)if(v(d(f(a(Q[X][ie],Q[ie][X]))),ue))return!1;return!0}function q(Q,ee,ue){for(var X=0;X<ee;X++)for(var ie=0;ie<ee;ie++)if(v(d(f(I(Q[X][ie]))),ue))return!1;return!0}function ne(Q,ee){for(var ue=0;ue<ee;ue++)for(var X=0;X<ee;X++)Q[ue][X]=j(Q[ue][X])}function se(Q,ee,ue){var X=Q.datatype();if(X==="number"||X==="BigNumber"||X==="Complex")return X;for(var ie=!1,oe=!1,ce=!1,ye=0;ye<ue;ye++)for(var Ae=0;Ae<ue;Ae++){var P=ee[ye][Ae];if(ke(P)||Ln(P))ie=!0;else if(je(P))oe=!0;else if(yt(P))ce=!0;else throw TypeError("Unsupported type in Matrix: "+nr(P))}if(oe&&ce&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),ce){for(var Z=0;Z<ue;Z++)for(var V=0;V<ue;V++)ee[Z][V]=y(ee[Z][V]);return"Complex"}if(oe){for(var H=0;H<ue;H++)for(var J=0;J<ue;J++)ee[H][J]=d(ee[H][J]);return"BigNumber"}if(ie){for(var K=0;K<ue;K++)for(var fe=0;fe<ue;fe++)ee[K][fe]=x(ee[K][fe]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),Dp="expm",H3=["typed","abs","add","identity","inv","multiply"],$3=R(Dp,H3,e=>{var{typed:r,abs:n,add:t,identity:i,inv:a,multiply:o}=e;return r(Dp,{Matrix:function(s){var l=s.size();if(l.length!==2||l[0]!==l[1])throw new RangeError("Matrix must be square (size: "+Le(l)+")");for(var p=l[0],m=1e-15,d=f(s),g=c(d,m),w=g.q,v=g.j,b=o(s,Math.pow(2,-v)),h=i(p),x=i(p),y=1,N=b,A=-1,E=1;E<=w;E++)E>1&&(N=o(N,b),A=-A),y=y*(w-E+1)/((2*w-E+1)*E),h=t(h,o(y,N)),x=t(x,o(y*A,N));for(var D=o(a(x),h),M=0;M<v;M++)D=o(D,D);return Jt(s)?s.createSparseMatrix(D):D}});function f(s){for(var l=s.size()[0],p=0,m=0;m<l;m++){for(var d=0,g=0;g<l;g++)d+=n(s.get([m,g]));p=Math.max(d,p)}return p}function c(s,l){for(var p=30,m=0;m<p;m++)for(var d=0;d<=m;d++){var g=m-d;if(u(s,d,g)<l)return{q:d,j:g}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function u(s,l,p){for(var m=1,d=2;d<=l;d++)m*=d;for(var g=m,w=l+1;w<=2*l;w++)g*=w;var v=g*(2*l+1);return 8*Math.pow(s/Math.pow(2,p),2*l)*m*m/(g*v)}}),Ap="sqrtm",Z3=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],J3=R(Ap,Z3,e=>{var{typed:r,abs:n,add:t,multiply:i,map:a,sqrt:o,subtract:f,inv:c,size:u,max:s,identity:l}=e,p=1e3,m=1e-6;function d(g){var w,v=0,b=g,h=l(u(g));do{var x=b;if(b=i(.5,t(x,c(h))),h=i(.5,t(h,c(x))),w=s(n(f(b,x))),w>m&&++v>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(w>m);return b}return r(Ap,{"Array | Matrix":function(g){var w=Be(g)?g.size():qe(g);switch(w.length){case 1:if(w[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+Le(w)+")");case 2:{var v=w[0],b=w[1];if(v===b)return d(g);throw new RangeError("Matrix must be square (size: "+Le(w)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Le(w)+")")}}})}),Ep="sylvester",W3=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Y3=R(Ep,W3,e=>{var{typed:r,schur:n,matrixFromColumns:t,matrix:i,multiply:a,range:o,concat:f,transpose:c,index:u,subset:s,add:l,subtract:p,identity:m,lusolve:d,abs:g}=e;return r(Ep,{"Matrix, Matrix, Matrix":w,"Array, Matrix, Matrix":function(v,b,h){return w(i(v),b,h)},"Array, Array, Matrix":function(v,b,h){return w(i(v),i(b),h)},"Array, Matrix, Array":function(v,b,h){return w(i(v),b,i(h))},"Matrix, Array, Matrix":function(v,b,h){return w(v,i(b),h)},"Matrix, Array, Array":function(v,b,h){return w(v,i(b),i(h))},"Matrix, Matrix, Array":function(v,b,h){return w(v,b,i(h))},"Array, Array, Array":function(v,b,h){return w(i(v),i(b),i(h)).toArray()}});function w(v,b,h){for(var x=b.size()[0],y=v.size()[0],N=n(v),A=N.T,E=N.U,D=n(a(-1,b)),M=D.T,S=D.U,B=a(a(c(E),h),S),I=o(0,y),j=[],_=(ce,ye)=>f(ce,ye,1),O=(ce,ye)=>f(ce,ye,0),C=0;C<x;C++)if(C<x-1&&g(s(M,u(C+1,C)))>1e-5){for(var z=O(s(B,u(I,C)),s(B,u(I,C+1))),T=0;T<C;T++)z=l(z,O(a(j[T],s(M,u(T,C))),a(j[T],s(M,u(T,C+1)))));var Y=a(m(y),a(-1,s(M,u(C,C)))),te=a(m(y),a(-1,s(M,u(C+1,C)))),$=a(m(y),a(-1,s(M,u(C,C+1)))),q=a(m(y),a(-1,s(M,u(C+1,C+1)))),ne=O(_(l(A,Y),te),_($,l(A,q))),se=d(ne,z);j[C]=se.subset(u(o(0,y),0)),j[C+1]=se.subset(u(o(y,2*y),0)),C++}else{for(var Q=s(B,u(I,C)),ee=0;ee<C;ee++)Q=l(Q,a(j[ee],s(M,u(ee,C))));var ue=s(M,u(C,C)),X=p(A,a(ue,m(y)));j[C]=d(X,Q)}var ie=i(t(...j)),oe=a(E,a(ie,c(S)));return oe}}),Mp="schur",G3=["typed","matrix","identity","multiply","qr","norm","subtract"],V3=R(Mp,G3,e=>{var{typed:r,matrix:n,identity:t,multiply:i,qr:a,norm:o,subtract:f}=e;return r(Mp,{Array:function(u){var s=c(n(u));return{U:s.U.valueOf(),T:s.T.valueOf()}},Matrix:function(u){return c(u)}});function c(u){var s=u.size()[0],l=u,p=t(s),m=0,d;do{d=l;var g=a(l),w=g.Q,v=g.R;if(l=i(v,w),p=i(p,w),m++>100)break}while(o(f(l,d))>1e-4);return{U:p,T:l}}}),Sp="lyap",K3=["typed","matrix","sylvester","multiply","transpose"],Q3=R(Sp,K3,e=>{var{typed:r,matrix:n,sylvester:t,multiply:i,transpose:a}=e;return r(Sp,{"Matrix, Matrix":function(o,f){return t(o,a(o),i(-1,f))},"Array, Matrix":function(o,f){return t(n(o),a(n(o)),i(-1,f))},"Matrix, Array":function(o,f){return t(o,a(n(o)),n(i(-1,f)))},"Array, Array":function(o,f){return t(n(o),a(n(o)),n(i(-1,f))).toArray()}})}),X3="divide",eF=["typed","matrix","multiply","equalScalar","divideScalar","inv"],rF=R(X3,eF,e=>{var{typed:r,matrix:n,multiply:t,equalScalar:i,divideScalar:a,inv:o}=e,f=Ar({typed:r,equalScalar:i}),c=it({typed:r});return r("divide",Wo({"Array | Matrix, Array | Matrix":function(u,s){return t(u,o(s))},"DenseMatrix, any":function(u,s){return c(u,s,a,!1)},"SparseMatrix, any":function(u,s){return f(u,s,a,!1)},"Array, any":function(u,s){return c(n(u),s,a,!1).valueOf()},"any, Array | Matrix":function(u,s){return t(u,o(s))}},a.signatures))}),Fp="distance",tF=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],nF=R(Fp,tF,e=>{var{typed:r,addScalar:n,subtractScalar:t,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:f,abs:c}=e;return r(Fp,{"Array, Array, Array":function(x,y,N){if(x.length===2&&y.length===2&&N.length===2){if(!s(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(y))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!s(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(y,N))throw new TypeError("LinePoint1 should not be same with LinePoint2");var A=t(N[1],y[1]),E=t(y[0],N[0]),D=t(i(N[0],y[1]),i(y[0],N[1]));return w(x[0],x[1],A,E,D)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(x,y,N){if(Object.keys(x).length===2&&Object.keys(y).length===2&&Object.keys(N).length===2){if(!s(x))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(y))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!s(N))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(d(y),d(N)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in x&&"pointY"in x&&"lineOnePtX"in y&&"lineOnePtY"in y&&"lineTwoPtX"in N&&"lineTwoPtY"in N){var A=t(N.lineTwoPtY,y.lineOnePtY),E=t(y.lineOnePtX,N.lineTwoPtX),D=t(i(N.lineTwoPtX,y.lineOnePtY),i(y.lineOnePtX,N.lineTwoPtY));return w(x.pointX,x.pointY,A,E,D)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(x,y){if(x.length===2&&y.length===3){if(!s(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(y))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return w(x[0],x[1],y[0],y[1],y[2])}else if(x.length===3&&y.length===6){if(!l(x))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(y))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return v(x[0],x[1],x[2],y[0],y[1],y[2],y[3],y[4],y[5])}else if(x.length===y.length&&x.length>0){if(!p(x))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(y))throw new TypeError("All values of an array should be numbers or BigNumbers");return b(x,y)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(x,y){if(Object.keys(x).length===2&&Object.keys(y).length===3){if(!s(x))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(y))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in x&&"pointY"in x&&"xCoeffLine"in y&&"yCoeffLine"in y&&"constant"in y)return w(x.pointX,x.pointY,y.xCoeffLine,y.yCoeffLine,y.constant);throw new TypeError("Key names do not match")}else if(Object.keys(x).length===3&&Object.keys(y).length===6){if(!l(x))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(y))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in x&&"pointY"in x&&"x0"in y&&"y0"in y&&"z0"in y&&"a"in y&&"b"in y&&"c"in y)return v(x.pointX,x.pointY,x.pointZ,y.x0,y.y0,y.z0,y.a,y.b,y.c);throw new TypeError("Key names do not match")}else if(Object.keys(x).length===2&&Object.keys(y).length===2){if(!s(x))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!s(y))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in x&&"pointOneY"in x&&"pointTwoX"in y&&"pointTwoY"in y)return b([x.pointOneX,x.pointOneY],[y.pointTwoX,y.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(x).length===3&&Object.keys(y).length===3){if(!l(x))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!l(y))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in x&&"pointOneY"in x&&"pointOneZ"in x&&"pointTwoX"in y&&"pointTwoY"in y&&"pointTwoZ"in y)return b([x.pointOneX,x.pointOneY,x.pointOneZ],[y.pointTwoX,y.pointTwoY,y.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(x){if(!g(x))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return h(x)}});function u(x){return typeof x=="number"||je(x)}function s(x){return x.constructor!==Array&&(x=d(x)),u(x[0])&&u(x[1])}function l(x){return x.constructor!==Array&&(x=d(x)),u(x[0])&&u(x[1])&&u(x[2])}function p(x){return Array.isArray(x)||(x=d(x)),x.every(u)}function m(x){return x.constructor!==Array&&(x=d(x)),u(x[0])&&u(x[1])&&u(x[2])&&u(x[3])&&u(x[4])&&u(x[5])}function d(x){for(var y=Object.keys(x),N=[],A=0;A<y.length;A++)N.push(x[y[A]]);return N}function g(x){if(x[0].length===2&&u(x[0][0])&&u(x[0][1])){if(x.some(y=>y.length!==2||!u(y[0])||!u(y[1])))return!1}else if(x[0].length===3&&u(x[0][0])&&u(x[0][1])&&u(x[0][2])){if(x.some(y=>y.length!==3||!u(y[0])||!u(y[1])||!u(y[2])))return!1}else return!1;return!0}function w(x,y,N,A,E){var D=c(n(n(i(N,x),i(A,y)),E)),M=f(n(i(N,N),i(A,A)));return a(D,M)}function v(x,y,N,A,E,D,M,S,B){var I=[t(i(t(E,y),B),i(t(D,N),S)),t(i(t(D,N),M),i(t(A,x),B)),t(i(t(A,x),S),i(t(E,y),M))];I=f(n(n(i(I[0],I[0]),i(I[1],I[1])),i(I[2],I[2])));var j=f(n(n(i(M,M),i(S,S)),i(B,B)));return a(I,j)}function b(x,y){for(var N=x.length,A=0,E=0,D=0;D<N;D++)E=t(x[D],y[D]),A=n(i(E,E),A);return f(A)}function h(x){for(var y=[],N=[],A=[],E=0;E<x.length-1;E++)for(var D=E+1;D<x.length;D++)x[0].length===2?(N=[x[E][0],x[E][1]],A=[x[D][0],x[D][1]]):x[0].length===3&&(N=[x[E][0],x[E][1],x[E][2]],A=[x[D][0],x[D][1],x[D][2]]),y.push(b(N,A));return y}}),iF="intersect",aF=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],oF=R(iF,aF,e=>{var{typed:r,config:n,abs:t,add:i,addScalar:a,matrix:o,multiply:f,multiplyScalar:c,divideScalar:u,subtract:s,smaller:l,equalScalar:p,flatten:m,isZero:d,isNumeric:g}=e;return r("intersect",{"Array, Array, Array":w,"Array, Array, Array, Array":v,"Matrix, Matrix, Matrix":function(M,S,B){var I=w(M.valueOf(),S.valueOf(),B.valueOf());return I===null?null:o(I)},"Matrix, Matrix, Matrix, Matrix":function(M,S,B,I){var j=v(M.valueOf(),S.valueOf(),B.valueOf(),I.valueOf());return j===null?null:o(j)}});function w(M,S,B){if(M=b(M),S=b(S),B=b(B),!x(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!y(B))throw new TypeError("Array with 4 numbers expected as third argument");return D(M[0],M[1],M[2],S[0],S[1],S[2],B[0],B[1],B[2],B[3])}function v(M,S,B,I){if(M=b(M),S=b(S),B=b(B),I=b(I),M.length===2){if(!h(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!h(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!h(B))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!h(I))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return N(M,S,B,I)}else if(M.length===3){if(!x(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!x(I))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return E(M[0],M[1],M[2],S[0],S[1],S[2],B[0],B[1],B[2],I[0],I[1],I[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function b(M){return M.length===1?M[0]:M.length>1&&Array.isArray(M[0])&&M.every(S=>Array.isArray(S)&&S.length===1)?m(M):M}function h(M){return M.length===2&&g(M[0])&&g(M[1])}function x(M){return M.length===3&&g(M[0])&&g(M[1])&&g(M[2])}function y(M){return M.length===4&&g(M[0])&&g(M[1])&&g(M[2])&&g(M[3])}function N(M,S,B,I){var j=M,_=B,O=s(j,S),C=s(_,I),z=s(c(O[0],C[1]),c(C[0],O[1]));if(d(z)||l(t(z),n.epsilon))return null;var T=c(C[0],j[1]),Y=c(C[1],j[0]),te=c(C[0],_[1]),$=c(C[1],_[0]),q=u(a(s(s(T,Y),te),$),z);return i(f(O,q),j)}function A(M,S,B,I,j,_,O,C,z,T,Y,te){var $=c(s(M,S),s(B,I)),q=c(s(j,_),s(O,C)),ne=c(s(z,T),s(Y,te));return a(a($,q),ne)}function E(M,S,B,I,j,_,O,C,z,T,Y,te){var $=A(M,O,T,O,S,C,Y,C,B,z,te,z),q=A(T,O,I,M,Y,C,j,S,te,z,_,B),ne=A(M,O,I,M,S,C,j,S,B,z,_,B),se=A(T,O,T,O,Y,C,Y,C,te,z,te,z),Q=A(I,M,I,M,j,S,j,S,_,B,_,B),ee=s(c($,q),c(ne,se)),ue=s(c(Q,se),c(q,q));if(d(ue))return null;var X=u(ee,ue),ie=u(a($,c(X,q)),se),oe=a(M,c(X,s(I,M))),ce=a(S,c(X,s(j,S))),ye=a(B,c(X,s(_,B))),Ae=a(O,c(ie,s(T,O))),P=a(C,c(ie,s(Y,C))),Z=a(z,c(ie,s(te,z)));return p(oe,Ae)&&p(ce,P)&&p(ye,Z)?[oe,ce,ye]:null}function D(M,S,B,I,j,_,O,C,z,T){var Y=c(M,O),te=c(I,O),$=c(S,C),q=c(j,C),ne=c(B,z),se=c(_,z),Q=s(s(s(T,Y),$),ne),ee=s(s(s(a(a(te,q),se),Y),$),ne),ue=u(Q,ee),X=a(M,c(ue,s(I,M))),ie=a(S,c(ue,s(j,S))),oe=a(B,c(ue,s(_,B)));return[X,ie,oe]}}),Cp="sum",sF=["typed","config","add","numeric"],Bp=R(Cp,sF,e=>{var{typed:r,config:n,add:t,numeric:i}=e;return r(Cp,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(f){if(Nn(f))throw new TypeError("Scalar values expected in function sum");return a(f)}});function a(f){var c;return Dt(f,function(u){try{c=c===void 0?u:t(c,u)}catch(s){throw Ir(s,"sum",u)}}),c===void 0&&(c=i(0,n.number)),typeof c=="string"&&(c=i(c,n.number)),c}function o(f,c){try{var u=Bi(f,c,t);return u}catch(s){throw Ir(s,"sum")}}}),la="cumsum",uF=["typed","add","unaryPlus"],Op=R(la,uF,e=>{var{typed:r,add:n,unaryPlus:t}=e;return r(la,{Array:i,Matrix:function(c){return c.create(i(c.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(c,u){return c.create(o(c.valueOf(),u))},"...":function(c){if(Nn(c))throw new TypeError("All values expected to be scalar in function cumsum");return i(c)}});function i(c){try{return a(c)}catch(u){throw Ir(u,la)}}function a(c){if(c.length===0)return[];for(var u=[t(c[0])],s=1;s<c.length;++s)u.push(n(u[s-1],c[s]));return u}function o(c,u){var s=qe(c);if(u<0||u>=s.length)throw new et(u,s.length);try{return f(c,u)}catch(l){throw Ir(l,la)}}function f(c,u){var s,l,p;if(u<=0){var m=c[0][0];if(Array.isArray(m)){for(p=js(c),l=[],s=0;s<p.length;s++)l[s]=f(p[s],u-1);return l}else return a(c)}else{for(l=[],s=0;s<c.length;s++)l[s]=f(c[s],u-1);return l}}}),Tp="mean",lF=["typed","add","divide"],_p=R(Tp,lF,e=>{var{typed:r,add:n,divide:t}=e;return r(Tp,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(o){if(Nn(o))throw new TypeError("Scalar values expected in function mean");return a(o)}});function i(o,f){try{var c=Bi(o,f,n),u=Array.isArray(o)?qe(o):o.size();return t(c,u[f])}catch(s){throw Ir(s,"mean")}}function a(o){var f,c=0;if(Dt(o,function(u){try{f=f===void 0?u:n(f,u),c++}catch(s){throw Ir(s,"mean",u)}}),c===0)throw new Error("Cannot calculate the mean of an empty array");return t(f,c)}}),Ip="median",cF=["typed","add","divide","compare","partitionSelect"],fF=R(Ip,cF,e=>{var{typed:r,add:n,divide:t,compare:i,partitionSelect:a}=e;function o(u){try{u=Ke(u.valueOf());var s=u.length;if(s===0)throw new Error("Cannot calculate median of an empty array");if(s%2===0){for(var l=s/2-1,p=a(u,l+1),m=u[l],d=0;d<l;++d)i(u[d],m)>0&&(m=u[d]);return c(m,p)}else{var g=a(u,(s-1)/2);return f(g)}}catch(w){throw Ir(w,"median")}}var f=r({"number | BigNumber | Complex | Unit":function(u){return u}}),c=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(u,s){return t(n(u,s),2)}});return r(Ip,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){throw new Error("median(A, dim) is not yet supported")},"...":function(u){if(Nn(u))throw new TypeError("Scalar values expected in function median");return o(u)}})}),zp="mad",pF=["typed","abs","map","median","subtract"],mF=R(zp,pF,e=>{var{typed:r,abs:n,map:t,median:i,subtract:a}=e;return r(zp,{"Array | Matrix":o,"...":function(f){return o(f)}});function o(f){if(f=Ke(f.valueOf()),f.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var c=i(f);return i(t(f,function(u){return n(a(u,c))}))}catch(u){throw u instanceof TypeError&&u.message.indexOf("median")!==-1?new TypeError(u.message.replace("median","mad")):Ir(u,"mad")}}}),co="unbiased",Rp="variance",dF=["typed","add","subtract","multiply","divide","apply","isNaN"],qp=R(Rp,dF,e=>{var{typed:r,add:n,subtract:t,multiply:i,divide:a,apply:o,isNaN:f}=e;return r(Rp,{"Array | Matrix":function(s){return c(s,co)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(s,l){return u(s,l,co)},"Array | Matrix, number | BigNumber, string":u,"...":function(s){return c(s,co)}});function c(s,l){var p,m=0;if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Dt(s,function(w){try{p=p===void 0?w:n(p,w),m++}catch(v){throw Ir(v,"variance",w)}}),m===0)throw new Error("Cannot calculate variance of an empty array");var d=a(p,m);if(p=void 0,Dt(s,function(w){var v=t(w,d);p=p===void 0?i(v,v):n(p,i(v,v))}),f(p))return p;switch(l){case"uncorrected":return a(p,m);case"biased":return a(p,m+1);case"unbiased":{var g=je(p)?p.mul(0):0;return m===1?g:a(p,m-1)}default:throw new Error('Unknown normalization "'+l+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(s,l,p){try{if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(s,l,m=>c(m,p))}catch(m){throw Ir(m,"variance")}}}),kp="quantileSeq",hF=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],jp=R(kp,hF,e=>{var{typed:r,bignumber:n,add:t,subtract:i,divide:a,multiply:o,partitionSelect:f,compare:c,isInteger:u,smaller:s,smallerEq:l,larger:p}=e,m=Wa({typed:r,isInteger:u});return r(kp,{"Array | Matrix, number | BigNumber":(b,h)=>g(b,h,!1),"Array | Matrix, number | BigNumber, number":(b,h,x)=>d(b,h,!1,x,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(b,h,x,y)=>d(b,h,x,y,g),"Array | Matrix, Array | Matrix":(b,h)=>w(b,h,!1),"Array | Matrix, Array | Matrix, number":(b,h,x)=>d(b,h,!1,x,w),"Array | Matrix, Array | Matrix, boolean":w,"Array | Matrix, Array | Matrix, boolean, number":(b,h,x,y)=>d(b,h,x,y,w)});function d(b,h,x,y,N){return m(b,y,A=>N(A,h,x))}function g(b,h,x){var y,N=b.valueOf();if(s(h,0))throw new Error("N/prob must be non-negative");if(l(h,1))return ke(h)?v(N,h,x):n(v(N,h,x));if(p(h,1)){if(!u(h))throw new Error("N must be a positive integer");if(p(h,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var A=t(h,1);y=[];for(var E=0;s(E,h);E++){var D=a(E+1,A);y.push(v(N,D,x))}return ke(h)?y:n(y)}}function w(b,h,x){for(var y=b.valueOf(),N=h.valueOf(),A=[],E=0;E<N.length;++E)A.push(v(y,N[E],x));return A}function v(b,h,x){var y=Ke(b),N=y.length;if(N===0)throw new Error("Cannot calculate quantile of an empty sequence");var A=ke(h)?h*(N-1):h.times(N-1),E=ke(h)?Math.floor(A):A.floor().toNumber(),D=ke(h)?A%1:A.minus(E);if(u(A))return x?y[A]:f(y,ke(h)?A:A.valueOf());var M,S;if(x)M=y[E],S=y[E+1];else{S=f(y,E+1),M=y[E];for(var B=0;B<E;++B)c(y[B],M)>0&&(M=y[B])}return t(o(M,i(1,D)),o(S,D))}}),Pp="std",gF=["typed","map","sqrt","variance"],Up=R(Pp,gF,e=>{var{typed:r,map:n,sqrt:t,variance:i}=e;return r(Pp,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(o){return a(o)}});function a(o,f){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var c=i.apply(null,arguments);return Wr(c)?n(c,t):t(c)}catch(u){throw u instanceof TypeError&&u.message.indexOf(" variance")!==-1?new TypeError(u.message.replace(" variance"," std")):u}}}),Lp="corr",vF=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],yF=R(Lp,vF,e=>{var{typed:r,matrix:n,sqrt:t,sum:i,add:a,subtract:o,multiply:f,pow:c,divide:u}=e;return r(Lp,{"Array, Array":function(p,m){return s(p,m)},"Matrix, Matrix":function(p,m){var d=s(p.toArray(),m.toArray());return Array.isArray(d)?n(d):d}});function s(p,m){var d=[];if(Array.isArray(p[0])&&Array.isArray(m[0])){if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var g=0;g<p.length;g++){if(p[g].length!==m[g].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");d.push(l(p[g],m[g]))}return d}else{if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return l(p,m)}}function l(p,m){var d=p.length,g=i(p),w=i(m),v=p.reduce((N,A,E)=>a(N,f(A,m[E])),0),b=i(p.map(N=>c(N,2))),h=i(m.map(N=>c(N,2))),x=o(f(d,v),f(g,w)),y=t(f(o(f(d,b),c(g,2)),o(f(d,h),c(w,2))));return u(x,y)}}),Hp="combinations",xF=["typed"],bF=R(Hp,xF,e=>{var{typed:r}=e;return r(Hp,{"number, number":pu,"BigNumber, BigNumber":function(n,t){var i=n.constructor,a,o,f=n.minus(t),c=new i(1);if(!$p(n)||!$p(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(n))throw new TypeError("k must be less than n in function combinations");if(a=c,t.lt(f))for(o=c;o.lte(f);o=o.plus(c))a=a.times(t.plus(o)).dividedBy(o);else for(o=c;o.lte(t);o=o.plus(c))a=a.times(f.plus(o)).dividedBy(o);return a}})});function $p(e){return e.isInteger()&&e.gte(0)}var Zp="combinationsWithRep",wF=["typed"],NF=R(Zp,wF,e=>{var{typed:r}=e;return r(Zp,{"number, number":function(n,t){if(!Se(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Se(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(t<n-1){var i=At(n,n+t-1);return i/At(1,t)}var a=At(t+1,n+t-1);return a/At(1,n-1)},"BigNumber, BigNumber":function(n,t){var i=n.constructor,a,o,f=new i(1),c=n.minus(f);if(!Jp(n)||!Jp(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(f))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(a=f,t.lt(c))for(o=f;o.lte(c);o=o.plus(f))a=a.times(t.plus(o)).dividedBy(o);else for(o=f;o.lte(t);o=o.plus(f))a=a.times(c.plus(o)).dividedBy(o);return a}})});function Jp(e){return e.isInteger()&&e.gte(0)}var Wp="gamma",DF=["typed","config","multiplyScalar","pow","BigNumber","Complex"],AF=R(Wp,DF,e=>{var{typed:r,config:n,multiplyScalar:t,pow:i,BigNumber:a,Complex:o}=e;function f(u){if(u.im===0)return Ti(u.re);if(u.re<.5){var s=new o(1-u.re,-u.im),l=new o(Math.PI*u.re,Math.PI*u.im);return new o(Math.PI).div(l.sin()).div(f(s))}u=new o(u.re-1,u.im);for(var p=new o(En[0],0),m=1;m<En.length;++m){var d=new o(En[m],0);p=p.add(d.div(u.add(m)))}var g=new o(u.re+vu+.5,u.im),w=Math.sqrt(2*Math.PI),v=g.pow(u.add(.5)),b=g.neg().exp();return p.mul(w).mul(v).mul(b)}return r(Wp,{number:Ti,Complex:f,BigNumber:function(u){if(u.isInteger())return u.isNegative()||u.isZero()?new a(1/0):c(u.minus(1));if(!u.isFinite())return new a(u.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function c(u){if(u<8)return new a([1,1,2,6,24,120,720,5040][u]);var s=n.precision+(Math.log(u.toNumber())|0),l=a.clone({precision:s});if(u%2===1)return u.times(c(new a(u-1)));for(var p=u,m=new l(u),d=u.toNumber();p>2;)p-=2,d+=p,m=m.times(d);return new a(m.toPrecision(a.precision))}}),Yp="lgamma",EF=["Complex","typed"],MF=R(Yp,EF,e=>{var{Complex:r,typed:n}=e,t=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return n(Yp,{number:_i,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(u){var s=6.283185307179586,l=1.1447298858494002,p=.1;if(u.isNaN())return new r(NaN,NaN);if(u.im===0)return new r(_i(u.re),0);if(u.re>=t||Math.abs(u.im)>=i)return f(u);if(u.re<=p){var m=g0(s,u.im)*Math.floor(.5*u.re+.25),d=u.mul(Math.PI).sin().log(),g=o(new r(1-u.re,-u.im));return new r(l,m).sub(d).sub(g)}else return u.im>=0?c(u):c(u.conjugate()).conjugate()}function f(u){for(var s=u.sub(.5).mul(u.log()).sub(u).add(yu),l=new r(1,0).div(u),p=l.div(u),m=a[0],d=a[1],g=2*p.re,w=p.re*p.re+p.im*p.im,v=2;v<8;v++){var b=d;d=-w*m+a[v],m=g*m+b}var h=l.mul(p.mul(m).add(d));return s.add(h)}function c(u){var s=0,l=0,p=u;for(u=u.add(1);u.re<=t;){p=p.mul(u);var m=p.im<0?1:0;m!==0&&l===0&&s++,l=m,u=u.add(1)}return f(u).sub(p.log()).sub(new r(0,s*2*Math.PI*1))}}),Gp="factorial",SF=["typed","gamma"],FF=R(Gp,SF,e=>{var{typed:r,gamma:n}=e;return r(Gp,{number:function(t){if(t<0)throw new Error("Value must be non-negative");return n(t+1)},BigNumber:function(t){if(t.isNegative())throw new Error("Value must be non-negative");return n(t.plus(1))},"Array | Matrix":r.referToSelf(t=>i=>$e(i,t))})}),Vp="kldivergence",CF=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],BF=R(Vp,CF,e=>{var{typed:r,matrix:n,divide:t,sum:i,multiply:a,map:o,dotDivide:f,log:c,isNumeric:u}=e;return r(Vp,{"Array, Array":function(l,p){return s(n(l),n(p))},"Matrix, Array":function(l,p){return s(l,n(p))},"Array, Matrix":function(l,p){return s(n(l),p)},"Matrix, Matrix":function(l,p){return s(l,p)}});function s(l,p){var m=p.size().length,d=l.size().length;if(m>1)throw new Error("first object must be one dimensional");if(d>1)throw new Error("second object must be one dimensional");if(m!==d)throw new Error("Length of two vectors must be equal");var g=i(l);if(g===0)throw new Error("Sum of elements in first object must be non zero");var w=i(p);if(w===0)throw new Error("Sum of elements in second object must be non zero");var v=t(l,i(l)),b=t(p,i(p)),h=i(a(v,o(f(v,b),x=>c(x))));return u(h)?h:Number.NaN}}),Kp="multinomial",OF=["typed","add","divide","multiply","factorial","isInteger","isPositive"],TF=R(Kp,OF,e=>{var{typed:r,add:n,divide:t,multiply:i,factorial:a,isInteger:o,isPositive:f}=e;return r(Kp,{"Array | Matrix":function(c){var u=0,s=1;return Dt(c,function(l){if(!o(l)||!f(l))throw new TypeError("Positive integer value expected in function multinomial");u=n(u,l),s=i(s,a(l))}),t(a(u),s)}})}),Qp="permutations",_F=["typed","factorial"],IF=R(Qp,_F,e=>{var{typed:r,factorial:n}=e;return r(Qp,{"number | BigNumber":n,"number, number":function(t,i){if(!Se(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(!Se(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(i>t)throw new TypeError("second argument k must be less than or equal to first argument n");return At(t-i+1,t)},"BigNumber, BigNumber":function(t,i){var a,o;if(!Xp(t)||!Xp(i))throw new TypeError("Positive integer value expected in function permutations");if(i.gt(t))throw new TypeError("second argument k must be less than or equal to first argument n");var f=t.mul(0).add(1);for(a=f,o=t.minus(i).plus(1);o.lte(t);o=o.plus(1))a=a.times(o);return a}})});function Xp(e){return e.isInteger()&&e.gte(0)}var em={exports:{}};(function(e){(function(r,n,t){function i(c){var u=this,s=f();u.next=function(){var l=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=l-(u.c=l|0)},u.c=1,u.s0=s(" "),u.s1=s(" "),u.s2=s(" "),u.s0-=s(c),u.s0<0&&(u.s0+=1),u.s1-=s(c),u.s1<0&&(u.s1+=1),u.s2-=s(c),u.s2<0&&(u.s2+=1),s=null}function a(c,u){return u.c=c.c,u.s0=c.s0,u.s1=c.s1,u.s2=c.s2,u}function o(c,u){var s=new i(c),l=u&&u.state,p=s.next;return p.int32=function(){return s.next()*4294967296|0},p.double=function(){return p()+(p()*2097152|0)*11102230246251565e-32},p.quick=p,l&&(typeof l=="object"&&a(l,s),p.state=function(){return a(s,{})}),p}function f(){var c=4022871197,u=function(s){s=String(s);for(var l=0;l<s.length;l++){c+=s.charCodeAt(l);var p=.02519603282416938*c;c=p>>>0,p-=c,p*=c,c=p>>>0,p-=c,c+=p*4294967296}return(c>>>0)*23283064365386963e-26};return u}n&&n.exports?n.exports=o:t&&t.amd?t(function(){return o}):this.alea=o})(Vt,e,!1)})(em);var zF=em.exports,rm={exports:{}};(function(e){(function(r,n,t){function i(f){var c=this,u="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var l=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^l^l>>>8},f===(f|0)?c.x=f:u+=f;for(var s=0;s<u.length+64;s++)c.x^=u.charCodeAt(s)|0,c.next()}function a(f,c){return c.x=f.x,c.y=f.y,c.z=f.z,c.w=f.w,c}function o(f,c){var u=new i(f),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,d=(p+m)/(1<<21);while(d===0);return d},l.int32=u.next,l.quick=l,s&&(typeof s=="object"&&a(s,u),l.state=function(){return a(u,{})}),l}n&&n.exports?n.exports=o:t&&t.amd?t(function(){return o}):this.xor128=o})(Vt,e,!1)})(rm);var RF=rm.exports,tm={exports:{}};(function(e){(function(r,n,t){function i(f){var c=this,u="";c.next=function(){var l=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(l^l<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,f===(f|0)?c.x=f:u+=f;for(var s=0;s<u.length+64;s++)c.x^=u.charCodeAt(s)|0,s==u.length&&(c.d=c.x<<10^c.x>>>4),c.next()}function a(f,c){return c.x=f.x,c.y=f.y,c.z=f.z,c.w=f.w,c.v=f.v,c.d=f.d,c}function o(f,c){var u=new i(f),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,d=(p+m)/(1<<21);while(d===0);return d},l.int32=u.next,l.quick=l,s&&(typeof s=="object"&&a(s,u),l.state=function(){return a(u,{})}),l}n&&n.exports?n.exports=o:t&&t.amd?t(function(){return o}):this.xorwow=o})(Vt,e,!1)})(tm);var qF=tm.exports,nm={exports:{}};(function(e){(function(r,n,t){function i(f){var c=this;c.next=function(){var s=c.x,l=c.i,p,m;return p=s[l],p^=p>>>7,m=p^p<<24,p=s[l+1&7],m^=p^p>>>10,p=s[l+3&7],m^=p^p>>>3,p=s[l+4&7],m^=p^p<<7,p=s[l+7&7],p=p^p<<13,m^=p^p<<9,s[l]=m,c.i=l+1&7,m};function u(s,l){var p,m=[];if(l===(l|0))m[0]=l;else for(l=""+l,p=0;p<l.length;++p)m[p&7]=m[p&7]<<15^l.charCodeAt(p)+m[p+1&7]<<13;for(;m.length<8;)m.push(0);for(p=0;p<8&&m[p]===0;++p);for(p==8?m[7]=-1:m[p],s.x=m,s.i=0,p=256;p>0;--p)s.next()}u(c,f)}function a(f,c){return c.x=f.x.slice(),c.i=f.i,c}function o(f,c){f==null&&(f=+new Date);var u=new i(f),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,d=(p+m)/(1<<21);while(d===0);return d},l.int32=u.next,l.quick=l,s&&(s.x&&a(s,u),l.state=function(){return a(u,{})}),l}n&&n.exports?n.exports=o:t&&t.amd?t(function(){return o}):this.xorshift7=o})(Vt,e,!1)})(nm);var kF=nm.exports,im={exports:{}};(function(e){(function(r,n,t){function i(f){var c=this;c.next=function(){var s=c.w,l=c.X,p=c.i,m,d;return c.w=s=s+1640531527|0,d=l[p+34&127],m=l[p=p+1&127],d^=d<<13,m^=m<<17,d^=d>>>15,m^=m>>>12,d=l[p]=d^m,c.i=p,d+(s^s>>>16)|0};function u(s,l){var p,m,d,g,w,v=[],b=128;for(l===(l|0)?(m=l,l=null):(l=l+"\0",m=0,b=Math.max(b,l.length)),d=0,g=-32;g<b;++g)l&&(m^=l.charCodeAt((g+32)%l.length)),g===0&&(w=m),m^=m<<10,m^=m>>>15,m^=m<<4,m^=m>>>13,g>=0&&(w=w+1640531527|0,p=v[g&127]^=m+w,d=p==0?d+1:0);for(d>=128&&(v[(l&&l.length||0)&127]=-1),d=127,g=4*128;g>0;--g)m=v[d+34&127],p=v[d=d+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,v[d]=m^p;s.w=w,s.X=v,s.i=d}u(c,f)}function a(f,c){return c.i=f.i,c.w=f.w,c.X=f.X.slice(),c}function o(f,c){f==null&&(f=+new Date);var u=new i(f),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,d=(p+m)/(1<<21);while(d===0);return d},l.int32=u.next,l.quick=l,s&&(s.X&&a(s,u),l.state=function(){return a(u,{})}),l}n&&n.exports?n.exports=o:t&&t.amd?t(function(){return o}):this.xor4096=o})(Vt,e,!1)})(im);var jF=im.exports,am={exports:{}};(function(e){(function(r,n,t){function i(f){var c=this,u="";c.next=function(){var l=c.b,p=c.c,m=c.d,d=c.a;return l=l<<25^l>>>7^p,p=p-m|0,m=m<<24^m>>>8^d,d=d-l|0,c.b=l=l<<20^l>>>12^p,c.c=p=p-m|0,c.d=m<<16^p>>>16^d,c.a=d-l|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,f===Math.floor(f)?(c.a=f/4294967296|0,c.b=f|0):u+=f;for(var s=0;s<u.length+20;s++)c.b^=u.charCodeAt(s)|0,c.next()}function a(f,c){return c.a=f.a,c.b=f.b,c.c=f.c,c.d=f.d,c}function o(f,c){var u=new i(f),s=c&&c.state,l=function(){return(u.next()>>>0)/4294967296};return l.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,d=(p+m)/(1<<21);while(d===0);return d},l.int32=u.next,l.quick=l,s&&(typeof s=="object"&&a(s,u),l.state=function(){return a(u,{})}),l}n&&n.exports?n.exports=o:t&&t.amd?t(function(){return o}):this.tychei=o})(Vt,e,!1)})(am);var PF=am.exports,om={exports:{}};const UF=qh(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));(function(e){(function(r,n,t){var i=256,a=6,o=52,f="random",c=t.pow(i,a),u=t.pow(2,o),s=u*2,l=i-1,p;function m(x,y,N){var A=[];y=y==!0?{entropy:!0}:y||{};var E=v(w(y.entropy?[x,h(n)]:x??b(),3),A),D=new d(A),M=function(){for(var S=D.g(a),B=c,I=0;S<u;)S=(S+I)*i,B*=i,I=D.g(1);for(;S>=s;)S/=2,B/=2,I>>>=1;return(S+I)/B};return M.int32=function(){return D.g(4)|0},M.quick=function(){return D.g(4)/4294967296},M.double=M,v(h(D.S),n),(y.pass||N||function(S,B,I,j){return j&&(j.S&&g(j,D),S.state=function(){return g(D,{})}),I?(t[f]=S,B):S})(M,E,"global"in y?y.global:this==t,y.state)}function d(x){var y,N=x.length,A=this,E=0,D=A.i=A.j=0,M=A.S=[];for(N||(x=[N++]);E<i;)M[E]=E++;for(E=0;E<i;E++)M[E]=M[D=l&D+x[E%N]+(y=M[E])],M[D]=y;(A.g=function(S){for(var B,I=0,j=A.i,_=A.j,O=A.S;S--;)B=O[j=l&j+1],I=I*i+O[l&(O[j]=O[_=l&_+B])+(O[_]=B)];return A.i=j,A.j=_,I})(i)}function g(x,y){return y.i=x.i,y.j=x.j,y.S=x.S.slice(),y}function w(x,y){var N=[],A=typeof x,E;if(y&&A=="object")for(E in x)try{N.push(w(x[E],y-1))}catch{}return N.length?N:A=="string"?x:x+"\0"}function v(x,y){for(var N=x+"",A,E=0;E<N.length;)y[l&E]=l&(A^=y[l&E]*19)+N.charCodeAt(E++);return h(y)}function b(){try{var x;return p&&(x=p.randomBytes)?x=x(i):(x=new Uint8Array(i),(r.crypto||r.msCrypto).getRandomValues(x)),h(x)}catch{var y=r.navigator,N=y&&y.plugins;return[+new Date,r,N,r.screen,h(n)]}}function h(x){return String.fromCharCode.apply(0,x)}if(v(t.random(),n),e.exports){e.exports=m;try{p=UF}catch{}}else t["seed"+f]=m})(typeof self<"u"?self:Vt,[],Math)})(om);var LF=om.exports,HF=zF,$F=RF,ZF=qF,JF=kF,WF=jF,YF=PF,Xt=LF;Xt.alea=HF,Xt.xor128=$F,Xt.xorwow=ZF,Xt.xorshift7=JF,Xt.xor4096=WF,Xt.tychei=YF;var GF=Xt;const sm=Wn(GF);var VF=sm(Date.now());function Tn(e){var r;function n(i){r=i===null?VF:sm(String(i))}n(e);function t(){return r()}return t}var um="pickRandom",KF=["typed","config","?on"],QF=R(um,KF,e=>{var{typed:r,config:n,on:t}=e,i=Tn(n.randomSeed);return t&&t("config",function(o,f){o.randomSeed!==f.randomSeed&&(i=Tn(o.randomSeed))}),r(um,{"Array | Matrix":function(o){return a(o,{})},"Array | Matrix, Object":function(o,f){return a(o,f)},"Array | Matrix, number":function(o,f){return a(o,{number:f})},"Array | Matrix, Array | Matrix":function(o,f){return a(o,{weights:f})},"Array | Matrix, Array | Matrix, number":function(o,f,c){return a(o,{number:c,weights:f})},"Array | Matrix, number, Array | Matrix":function(o,f,c){return a(o,{number:f,weights:c})}});function a(o,f){var{number:c,weights:u,elementWise:s=!0}=f,l=typeof c>"u";l&&(c=1);var p=Be(o)?o.create:Be(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),s===!0&&(o=Ke(o),u=Ke(u));var m=0;if(typeof u<"u"){if(u.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var d=0,g=u.length;d<g;d++){if(!ke(u[d])||u[d]<0)throw new Error("Weights must be an array of positive numbers");m+=u[d]}}for(var w=o.length,v=[],b;v.length<c;){if(typeof u>"u")b=o[Math.floor(i()*w)];else for(var h=i()*m,x=0,y=o.length;x<y;x++)if(h-=u[x],h<0){b=o[x];break}v.push(b)}return l?v[0]:p?p(v):v}});function fo(e,r){var n=[];if(e=e.slice(0),e.length>1)for(var t=0,i=e.shift();t<i;t++)n.push(fo(e,r));else for(var a=0,o=e.shift();a<o;a++)n.push(r());return n}var lm="random",XF=["typed","config","?on"],eC=R(lm,XF,e=>{var{typed:r,config:n,on:t}=e,i=Tn(n.randomSeed);return t&&t("config",function(f,c){f.randomSeed!==c.randomSeed&&(i=Tn(f.randomSeed))}),r(lm,{"":()=>o(0,1),number:f=>o(0,f),"number, number":(f,c)=>o(f,c),"Array | Matrix":f=>a(f,0,1),"Array | Matrix, number":(f,c)=>a(f,0,c),"Array | Matrix, number, number":(f,c,u)=>a(f,c,u)});function a(f,c,u){var s=fo(f.valueOf(),()=>o(c,u));return Be(f)?f.create(s):s}function o(f,c){return f+i()*(c-f)}}),cm="randomInt",rC=["typed","config","?on"],tC=R(cm,rC,e=>{var{typed:r,config:n,on:t}=e,i=Tn(n.randomSeed);return t&&t("config",function(f,c){f.randomSeed!==c.randomSeed&&(i=Tn(f.randomSeed))}),r(cm,{"":()=>o(0,1),number:f=>o(0,f),"number, number":(f,c)=>o(f,c),"Array | Matrix":f=>a(f,0,1),"Array | Matrix, number":(f,c)=>a(f,0,c),"Array | Matrix, number, number":(f,c,u)=>a(f,c,u)});function a(f,c,u){var s=fo(f.valueOf(),()=>o(c,u));return Be(f)?f.create(s):s}function o(f,c){return Math.floor(f+i()*(c-f))}}),fm="stirlingS2",nC=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],iC=R(fm,nC,e=>{var{typed:r,addScalar:n,subtractScalar:t,multiplyScalar:i,divideScalar:a,pow:o,factorial:f,combinations:c,isNegative:u,isInteger:s,number:l,bignumber:p,larger:m}=e,d=[],g=[];return r(fm,{"number | BigNumber, number | BigNumber":function(w,v){if(!s(w)||u(w)||!s(v)||u(v))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(v,w))throw new TypeError("k must be less than or equal to n in function stirlingS2");var b=!(ke(w)&&ke(v)),h=b?g:d,x=b?p:l,y=l(w),N=l(v);if(h[y]&&h[y].length>N)return h[y][N];for(var A=0;A<=y;++A)if(h[A]||(h[A]=[x(A===0?1:0)]),A!==0)for(var E=h[A],D=h[A-1],M=E.length;M<=A&&M<=N;++M)M===A?E[M]=1:E[M]=n(i(x(M),D[M]),D[M-1]);return h[y][N]}})}),pm="bellNumbers",aC=["typed","addScalar","isNegative","isInteger","stirlingS2"],oC=R(pm,aC,e=>{var{typed:r,addScalar:n,isNegative:t,isInteger:i,stirlingS2:a}=e;return r(pm,{"number | BigNumber":function(o){if(!i(o)||t(o))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var f=0,c=0;c<=o;c++)f=n(f,a(o,c));return f}})}),mm="catalan",sC=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],uC=R(mm,sC,e=>{var{typed:r,addScalar:n,divideScalar:t,multiplyScalar:i,combinations:a,isNegative:o,isInteger:f}=e;return r(mm,{"number | BigNumber":function(c){if(!f(c)||o(c))throw new TypeError("Non-negative integer value expected in function catalan");return t(a(i(c,2),c),n(c,1))}})}),dm="composition",lC=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],cC=R(dm,lC,e=>{var{typed:r,addScalar:n,combinations:t,isPositive:i,isNegative:a,isInteger:o,larger:f}=e;return r(dm,{"number | BigNumber, number | BigNumber":function(c,u){if(!o(c)||!i(c)||!o(u)||!i(u))throw new TypeError("Positive integer value expected in function composition");if(f(u,c))throw new TypeError("k must be less than or equal to n in function composition");return t(n(c,-1),n(u,-1))}})}),hm="leafCount",fC=["parse","typed"],pC=R(hm,fC,e=>{var{parse:r,typed:n}=e;function t(i){var a=0;return i.forEach(o=>{a+=t(o)}),a||1}return n(hm,{Node:function(i){return t(i)}})});function gm(e){return Ve(e)||mr(e)&&e.isUnary()&&Ve(e.args[0])}function ca(e){return!!(Ve(e)||(Bt(e)||mr(e))&&e.args.every(ca)||xt(e)&&ca(e.content))}function vm(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,t)}return n}function po(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?vm(Object(n),!0).forEach(function(t){vr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var mC="simplifyUtil",dC=["FunctionNode","OperatorNode","SymbolNode"],mo=R(mC,dC,e=>{var{FunctionNode:r,OperatorNode:n,SymbolNode:t}=e,i=!0,a=!1,o="defaultF",f={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},c={divide:{total:a},log:{total:a}},u={subtract:{total:a},abs:{trivial:i},log:{total:i}};function s(h,x){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f,N=o;if(typeof h=="string"?N=h:mr(h)?N=h.fn.toString():Bt(h)?N=h.name:xt(h)&&(N="paren"),Me(y,N)){var A=y[N];if(Me(A,x))return A[x];if(Me(f,N))return f[N][x]}if(Me(y,o)){var E=y[o];return Me(E,x)?E[x]:f[o][x]}if(Me(f,N)){var D=f[N];if(Me(D,x))return D[x]}return f[o][x]}function l(h){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;return s(h,"commutative",x)}function p(h){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;return s(h,"associative",x)}function m(h,x){var y=po({},h);for(var N in x)Me(h,N)?y[N]=po(po({},x[N]),h[N]):y[N]=x[N];return y}function d(h,x){if(!h.args||h.args.length===0)return h;h.args=g(h,x);for(var y=0;y<h.args.length;y++)d(h.args[y],x)}function g(h,x){var y,N=[],A=function E(D){for(var M=0;M<D.args.length;M++){var S=D.args[M];mr(S)&&y===S.op?E(S):N.push(S)}};return p(h,x)?(y=h.op,A(h),N):h.args}function w(h,x){if(!(!h.args||h.args.length===0)){for(var y=b(h),N=h.args.length,A=0;A<N;A++)w(h.args[A],x);if(N>2&&p(h,x)){for(var E=h.args.pop();h.args.length>0;)E=y([h.args.pop(),E]);h.args=E.args}}}function v(h,x){if(!(!h.args||h.args.length===0)){for(var y=b(h),N=h.args.length,A=0;A<N;A++)v(h.args[A],x);if(N>2&&p(h,x)){for(var E=h.args.shift();h.args.length>0;)E=y([E,h.args.shift()]);h.args=E.args}}}function b(h){return mr(h)?function(x){try{return new n(h.op,h.fn,x,h.implicit)}catch(y){return console.error(y),[]}}:function(x){return new r(new t(h.name),x)}}return{createMakeNodeFunction:b,hasProperty:s,isCommutative:l,isAssociative:p,mergeContext:m,flatten:d,allChildren:g,unflattenr:w,unflattenl:v,defaultContext:f,realContext:c,positiveContext:u}}),hC="simplify",gC=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],vC=R(hC,gC,e=>{var{config:r,typed:n,parse:t,add:i,subtract:a,multiply:o,divide:f,pow:c,isZero:u,equal:s,resolve:l,simplifyConstant:p,simplifyCore:m,fraction:d,bignumber:g,mathWithTransform:w,matrix:v,AccessorNode:b,ArrayNode:h,ConstantNode:x,FunctionNode:y,IndexNode:N,ObjectNode:A,OperatorNode:E,ParenthesisNode:D,SymbolNode:M}=e,{hasProperty:S,isCommutative:B,isAssociative:I,mergeContext:j,flatten:_,unflattenr:O,unflattenl:C,createMakeNodeFunction:z,defaultContext:T,realContext:Y,positiveContext:te}=mo({FunctionNode:y,OperatorNode:E,SymbolNode:M});n.addConversion({from:"Object",to:"Map",convert:xn});var $=n("simplify",{Node:X,"Node, Map":(H,J)=>X(H,!1,J),"Node, Map, Object":(H,J,K)=>X(H,!1,J,K),"Node, Array":X,"Node, Array, Map":X,"Node, Array, Map, Object":X});n.removeConversion({from:"Object",to:"Map",convert:xn}),$.defaultContext=T,$.realContext=Y,$.positiveContext=te;function q(H){return H.transform(function(J,K,fe){return xt(J)?q(J.content):J})}var ne={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};$.rules=[m,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},p,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function se(H,J){var K={};if(H.s){var fe=H.s.split("->");if(fe.length===2)K.l=fe[0],K.r=fe[1];else throw SyntaxError("Could not parse rule: "+H.s)}else K.l=H.l,K.r=H.r;K.l=q(t(K.l)),K.r=q(t(K.r));for(var pe of["imposeContext","repeat","assuming"])pe in H&&(K[pe]=H[pe]);if(H.evaluate&&(K.evaluate=t(H.evaluate)),I(K.l,J)){var k=!B(K.l,J),U;k&&(U=ue());var G=z(K.l),re=ue();K.expanded={},K.expanded.l=G([K.l,re]),_(K.expanded.l,J),O(K.expanded.l,J),K.expanded.r=G([K.r,re]),k&&(K.expandedNC1={},K.expandedNC1.l=G([U,K.l]),K.expandedNC1.r=G([U,K.r]),K.expandedNC2={},K.expandedNC2.l=G([U,K.expanded.l]),K.expandedNC2.r=G([U,K.expanded.r]))}return K}function Q(H,J){for(var K=[],fe=0;fe<H.length;fe++){var pe=H[fe],k=void 0,U=typeof pe;switch(U){case"string":pe={s:pe};case"object":k=se(pe,J);break;case"function":k=pe;break;default:throw TypeError("Unsupported type of rule: "+U)}K.push(k)}return K}var ee=0;function ue(){return new M("_p"+ee++)}function X(H,J){var K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yn(),fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},pe=fe.consoleDebug;J=Q(J||$.rules,fe.context);var k=l(H,K);k=q(k);for(var U={},G=k.toString({parenthesis:"all"});!U[G];){U[G]=!0,ee=0;var re=G;pe&&console.log("Working on: ",G);for(var le=0;le<J.length;le++){var me="";if(typeof J[le]=="function"?(k=J[le](k,fe),pe&&(me=J[le].name)):(_(k,fe.context),k=oe(k,J[le],fe.context),pe&&(me="".concat(J[le].l.toString()," -> ").concat(J[le].r.toString()))),pe){var xe=k.toString({parenthesis:"all"});xe!==re&&(console.log("Applying",me,"produced",xe),re=xe)}C(k,fe.context)}G=k.toString({parenthesis:"all"})}return k}function ie(H,J,K){var fe=H;if(H)for(var pe=0;pe<H.length;++pe){var k=oe(H[pe],J,K);k!==H[pe]&&(fe===H&&(fe=H.slice()),fe[pe]=k)}return fe}function oe(H,J,K){if(J.assuming){for(var fe in J.assuming)for(var pe in J.assuming[fe])if(S(fe,pe,K)!==J.assuming[fe][pe])return H}var k=j(J.imposeContext,K),U=H;if(U instanceof E||U instanceof y){var G=ie(U.args,J,K);G!==U.args&&(U=U.clone(),U.args=G)}else if(U instanceof D){if(U.content){var re=oe(U.content,J,K);re!==U.content&&(U=new D(re))}}else if(U instanceof h){var le=ie(U.items,J,K);le!==U.items&&(U=new h(le))}else if(U instanceof b){var me=U.object;U.object&&(me=oe(U.object,J,K));var xe=U.index;U.index&&(xe=oe(U.index,J,K)),(me!==U.object||xe!==U.index)&&(U=new b(me,xe))}else if(U instanceof N){var he=ie(U.dimensions,J,K);he!==U.dimensions&&(U=new N(he))}else if(U instanceof A){var De=!1,Ne={};for(var We in U.properties)Ne[We]=oe(U.properties[We],J,K),Ne[We]!==U.properties[We]&&(De=!0);De&&(U=new A(Ne))}var Ye=J.r,Fe=Z(J.l,U,k)[0];if(!Fe&&J.expanded&&(Ye=J.expanded.r,Fe=Z(J.expanded.l,U,k)[0]),!Fe&&J.expandedNC1&&(Ye=J.expandedNC1.r,Fe=Z(J.expandedNC1.l,U,k)[0],Fe||(Ye=J.expandedNC2.r,Fe=Z(J.expandedNC2.l,U,k)[0])),Fe){var cr=U.implicit;U=Ye.clone(),cr&&"implicit"in Ye&&(U.implicit=!0),U=U.transform(function(F){return F.isSymbolNode&&Me(Fe.placeholders,F.name)?Fe.placeholders[F.name].clone():F})}return J.repeat&&U!==H&&(U=oe(U,J,K)),U}function ce(H,J){var K=[],fe,pe,k=z(H);if(B(H,J))for(var U=0;U<H.args.length;U++)pe=H.args.slice(0),pe.splice(U,1),fe=pe.length===1?pe[0]:k(pe),K.push(k([H.args[U],fe]));else for(var G=1;G<H.args.length;G++){var re=H.args[0];G>1&&(re=k(H.args.slice(0,G))),pe=H.args.slice(G),fe=pe.length===1?pe[0]:k(pe),K.push(k([re,fe]))}return K}function ye(H,J){var K={placeholders:{}};if(!H.placeholders&&!J.placeholders)return K;if(H.placeholders){if(!J.placeholders)return H}else return J;for(var fe in H.placeholders)if(Me(H.placeholders,fe)&&(K.placeholders[fe]=H.placeholders[fe],Me(J.placeholders,fe)&&!V(H.placeholders[fe],J.placeholders[fe])))return null;for(var pe in J.placeholders)Me(J.placeholders,pe)&&(K.placeholders[pe]=J.placeholders[pe]);return K}function Ae(H,J){var K=[];if(H.length===0||J.length===0)return K;for(var fe,pe=0;pe<H.length;pe++)for(var k=0;k<J.length;k++)fe=ye(H[pe],J[k]),fe&&K.push(fe);return K}function P(H){if(H.length===0)return H;for(var J=H.reduce(Ae),K=[],fe={},pe=0;pe<J.length;pe++){var k=JSON.stringify(J[pe]);fe[k]||(fe[k]=!0,K.push(J[pe]))}return K}function Z(H,J,K,fe){var pe=[{placeholders:{}}];if(H instanceof E&&J instanceof E||H instanceof y&&J instanceof y){if(H instanceof E){if(H.op!==J.op||H.fn!==J.fn)return[]}else if(H instanceof y&&H.name!==J.name)return[];if(J.args.length===1&&H.args.length===1||!I(J,K)&&J.args.length===H.args.length||fe){for(var k=[],U=0;U<H.args.length;U++){var G=Z(H.args[U],J.args[U],K);if(G.length===0)break;k.push(G)}if(k.length!==H.args.length){if(!B(J,K)||H.args.length===1)return[];if(H.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var re=Z(H.args[0],J.args[1],K);if(re.length===0)return[];var le=Z(H.args[1],J.args[0],K);if(le.length===0)return[];k=[re,le]}pe=P(k)}else if(J.args.length>=2&&H.args.length===2){for(var me=ce(J,K),xe=[],he=0;he<me.length;he++){var De=Z(H,me[he],K,!0);xe=xe.concat(De)}return xe}else{if(H.args.length>2)throw Error("Unexpected non-binary associative function: "+H.toString());return[]}}else if(H instanceof M){if(H.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(ne[H.name]){if(H.name!==J.name)return[]}else switch(H.name[1]>="a"&&H.name[1]<="z"?H.name.substring(0,2):H.name[0]){case"n":case"_p":pe[0].placeholders[H.name]=J;break;case"c":case"cl":if(Ve(J))pe[0].placeholders[H.name]=J;else return[];break;case"v":if(!Ve(J))pe[0].placeholders[H.name]=J;else return[];break;case"vl":if(br(J))pe[0].placeholders[H.name]=J;else return[];break;case"cd":if(gm(J))pe[0].placeholders[H.name]=J;else return[];break;case"vd":if(!gm(J))pe[0].placeholders[H.name]=J;else return[];break;case"ce":if(ca(J))pe[0].placeholders[H.name]=J;else return[];break;case"ve":if(!ca(J))pe[0].placeholders[H.name]=J;else return[];break;default:throw new Error("Invalid symbol in rule: "+H.name)}}else if(H instanceof x){if(!s(H.value,J.value))return[]}else return[];return pe}function V(H,J){if(H instanceof x&&J instanceof x){if(!s(H.value,J.value))return!1}else if(H instanceof M&&J instanceof M){if(H.name!==J.name)return!1}else if(H instanceof E&&J instanceof E||H instanceof y&&J instanceof y){if(H instanceof E){if(H.op!==J.op||H.fn!==J.fn)return!1}else if(H instanceof y&&H.name!==J.name)return!1;if(H.args.length!==J.args.length)return!1;for(var K=0;K<H.args.length;K++)if(!V(H.args[K],J.args[K]))return!1}else return!1;return!0}return $}),yC="simplifyConstant",xC=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],bC=R(yC,xC,e=>{var{typed:r,config:n,mathWithTransform:t,matrix:i,fraction:a,bignumber:o,AccessorNode:f,ArrayNode:c,ConstantNode:u,FunctionNode:s,IndexNode:l,ObjectNode:p,OperatorNode:m,SymbolNode:d}=e,{isCommutative:g,isAssociative:w,allChildren:v,createMakeNodeFunction:b}=mo({FunctionNode:s,OperatorNode:m,SymbolNode:d}),h=r("simplifyConstant",{Node:_=>A(j(_,{})),"Node, Object":function(_,O){return A(j(_,O))}});function x(_){return Ln(_)?_.valueOf():_ instanceof Array?_.map(x):Be(_)?i(x(_.valueOf())):_}function y(_,O,C){try{return t[_].apply(null,O)}catch{return O=O.map(x),D(t[_].apply(null,O),C)}}var N=r({Fraction:S,number:function(_){return _<0?M(new u(-_)):new u(_)},BigNumber:function(_){return _<0?M(new u(-_)):new u(_)},Complex:function(_){throw new Error("Cannot convert Complex number to Node")},string:function(_){return new u(_)},Matrix:function(_){return new c(_.valueOf().map(O=>N(O)))}});function A(_){return tr(_)?_:N(_)}function E(_,O){var C=O&&O.exactFractions!==!1;if(C&&isFinite(_)&&a){var z=a(_),T=O&&typeof O.fractionsLimit=="number"?O.fractionsLimit:1/0;if(z.valueOf()===_&&z.n<T&&z.d<T)return z}return _}var D=r({"string, Object":function(_,O){if(n.number==="BigNumber")return o===void 0&&eo(),o(_);if(n.number==="Fraction")return a===void 0&&nc(),a(_);var C=parseFloat(_);return E(C,O)},"Fraction, Object":function(_,O){return _},"BigNumber, Object":function(_,O){return _},"number, Object":function(_,O){return E(_,O)},"Complex, Object":function(_,O){return _.im!==0?_:E(_.re,O)},"Matrix, Object":function(_,O){return i(E(_.valueOf()))},"Array, Object":function(_,O){return _.map(E)}});function M(_){return new m("-","unaryMinus",[_])}function S(_){var O,C=_.s*_.n;return C<0?O=new m("-","unaryMinus",[new u(-C)]):O=new u(C),_.d===1?O:new m("/","divide",[O,new u(_.d)])}function B(_,O,C){if(!ln(O))return new f(A(_),A(O));if(Yr(_)||Be(_)){for(var z=Array.from(O.dimensions);z.length>0;)if(Ve(z[0])&&typeof z[0].value!="string"){var T=D(z.shift().value,C);Yr(_)?_=_.items[T-1]:(_=_.valueOf()[T-1],_ instanceof Array&&(_=i(_)))}else if(z.length>1&&Ve(z[1])&&typeof z[1].value!="string"){var Y=D(z[1].value,C),te=[],$=Yr(_)?_.items:_.valueOf();for(var q of $)if(Yr(q))te.push(q.items[Y-1]);else if(Be(_))te.push(q[Y-1]);else break;if(te.length===$.length)Yr(_)?_=new c(te):_=i(te),z.splice(1,1);else break}else break;return z.length===O.dimensions.length?new f(A(_),O):z.length>0?(O=new l(z),new f(A(_),O)):_}if(mi(_)&&O.dimensions.length===1&&Ve(O.dimensions[0])){var ne=O.dimensions[0].value;return ne in _.properties?_.properties[ne]:new u}return new f(A(_),O)}function I(_,O,C,z){var T=O.shift(),Y=O.reduce((te,$)=>{if(!tr($)){var q=te.pop();if(tr(q))return[q,$];try{return te.push(y(_,[q,$],z)),te}catch{te.push(q)}}te.push(A(te.pop()));var ne=te.length===1?te[0]:C(te);return[C([ne,A($)])]},[T]);return Y.length===1?Y[0]:C([Y[0],N(Y[1])])}function j(_,O){switch(_.type){case"SymbolNode":return _;case"ConstantNode":switch(typeof _.value){case"number":return D(_.value,O);case"string":return _.value;default:if(!isNaN(_.value))return D(_.value,O)}return _;case"FunctionNode":if(t[_.name]&&t[_.name].rawArgs)return _;{var C=["add","multiply"];if(C.indexOf(_.name)===-1){var z=_.args.map(oe=>j(oe,O));if(!z.some(tr))try{return y(_.name,z,O)}catch{}if(_.name==="size"&&z.length===1&&Yr(z[0])){for(var T=[],Y=z[0];Yr(Y);)T.push(Y.items.length),Y=Y.items[0];return i(T)}return new s(_.name,z.map(A))}}case"OperatorNode":{var te=_.fn.toString(),$,q,ne=b(_);if(mr(_)&&_.isUnary())$=[j(_.args[0],O)],tr($[0])?q=ne($):q=y(te,$,O);else if(w(_,O.context))if($=v(_,O.context),$=$.map(oe=>j(oe,O)),g(te,O.context)){for(var se=[],Q=[],ee=0;ee<$.length;ee++)tr($[ee])?Q.push($[ee]):se.push($[ee]);se.length>1?(q=I(te,se,ne,O),Q.unshift(q),q=I(te,Q,ne,O)):q=I(te,$,ne,O)}else q=I(te,$,ne,O);else $=_.args.map(oe=>j(oe,O)),q=I(te,$,ne,O);return q}case"ParenthesisNode":return j(_.content,O);case"AccessorNode":return B(j(_.object,O),j(_.index,O),O);case"ArrayNode":{var ue=_.items.map(oe=>j(oe,O));return ue.some(tr)?new c(ue.map(A)):i(ue)}case"IndexNode":return new l(_.dimensions.map(oe=>h(oe,O)));case"ObjectNode":{var X={};for(var ie in _.properties)X[ie]=h(_.properties[ie],O);return new p(X)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(_.type))}}return h}),ym="simplifyCore",wC=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],NC=R(ym,wC,e=>{var{typed:r,parse:n,equal:t,isZero:i,add:a,subtract:o,multiply:f,divide:c,pow:u,AccessorNode:s,ArrayNode:l,ConstantNode:p,FunctionNode:m,IndexNode:d,ObjectNode:g,OperatorNode:w,ParenthesisNode:v,SymbolNode:b}=e,h=new p(0),x=new p(1),y=new p(!0),N=new p(!1);function A(S){return mr(S)&&["and","not","or"].includes(S.op)}var{hasProperty:E,isCommutative:D}=mo({FunctionNode:m,OperatorNode:w,SymbolNode:b});function M(S){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=B?B.context:void 0;if(E(S,"trivial",I)){if(Bt(S)&&S.args.length===1)return M(S.args[0],B);var j=!1,_=0;if(S.forEach(Q=>{++_,_===1&&(j=M(Q,B))}),_===1)return j}var O=S;if(Bt(O)){var C=SN(O.name);if(C){if(O.args.length>2&&E(O,"associative",I))for(;O.args.length>2;){var z=O.args.pop(),T=O.args.pop();O.args.push(new w(C,O.name,[z,T]))}O=new w(C,O.name,O.args)}else return new m(M(O.fn),O.args.map(Q=>M(Q,B)))}if(mr(O)&&O.isUnary()){var Y=M(O.args[0],B);if(O.op==="~"&&mr(Y)&&Y.isUnary()&&Y.op==="~"||O.op==="not"&&mr(Y)&&Y.isUnary()&&Y.op==="not"&&A(Y.args[0]))return Y.args[0];var te=!0;if(O.op==="-"&&mr(Y)&&(Y.isBinary()&&Y.fn==="subtract"&&(O=new w("-","subtract",[Y.args[1],Y.args[0]]),te=!1),Y.isUnary()&&Y.op==="-"))return Y.args[0];if(te)return new w(O.op,O.fn,[Y])}if(mr(O)&&O.isBinary()){var $=M(O.args[0],B),q=M(O.args[1],B);if(O.op==="+"){if(Ve($)&&i($.value))return q;if(Ve(q)&&i(q.value))return $;mr(q)&&q.isUnary()&&q.op==="-"&&(q=q.args[0],O=new w("-","subtract",[$,q]))}if(O.op==="-")return mr(q)&&q.isUnary()&&q.op==="-"?M(new w("+","add",[$,q.args[0]]),B):Ve($)&&i($.value)?M(new w("-","unaryMinus",[q])):Ve(q)&&i(q.value)?$:new w(O.op,O.fn,[$,q]);if(O.op==="*"){if(Ve($)){if(i($.value))return h;if(t($.value,1))return q}if(Ve(q)){if(i(q.value))return h;if(t(q.value,1))return $;if(D(O,I))return new w(O.op,O.fn,[q,$],O.implicit)}return new w(O.op,O.fn,[$,q],O.implicit)}if(O.op==="/")return Ve($)&&i($.value)?h:Ve(q)&&t(q.value,1)?$:new w(O.op,O.fn,[$,q]);if(O.op==="^"&&Ve(q)){if(i(q.value))return x;if(t(q.value,1))return $}if(O.op==="and"){if(Ve($))if($.value){if(A(q))return q}else return N;if(Ve(q))if(q.value){if(A($))return $}else return N}if(O.op==="or"){if(Ve($)){if($.value)return y;if(A(q))return q}if(Ve(q)){if(q.value)return y;if(A($))return $}}return new w(O.op,O.fn,[$,q])}if(mr(O))return new w(O.op,O.fn,O.args.map(Q=>M(Q,B)));if(Yr(O))return new l(O.items.map(Q=>M(Q,B)));if(Wt(O))return new s(M(O.object,B),M(O.index,B));if(ln(O))return new d(O.dimensions.map(Q=>M(Q,B)));if(mi(O)){var ne={};for(var se in O.properties)ne[se]=M(O.properties[se],B);return new g(ne)}return O}return r(ym,{Node:M,"Node,Object":M})}),DC="resolve",AC=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],EC=R(DC,AC,e=>{var{typed:r,parse:n,ConstantNode:t,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function f(c,u){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!u)return c;if(br(c)){if(s.has(c.name)){var l=Array.from(s).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(l,"}"))}var p=u.get(c.name);if(tr(p)){var m=new Set(s);return m.add(c.name),f(p,u,m)}else return typeof p=="number"?n(String(p)):p!==void 0?new t(p):c}else if(mr(c)){var d=c.args.map(function(w){return f(w,u,s)});return new a(c.op,c.fn,d,c.implicit)}else{if(xt(c))return new o(f(c.content,u,s));if(Bt(c)){var g=c.args.map(function(w){return f(w,u,s)});return new i(c.name,g)}}return c.map(w=>f(w,u,s))}return r("resolve",{Node:f,"Node, Map | null | undefined":f,"Node, Object":(c,u)=>f(c,xn(u)),"Array | Matrix":r.referToSelf(c=>u=>u.map(s=>c(s))),"Array | Matrix, null | undefined":r.referToSelf(c=>u=>u.map(s=>c(s))),"Array, Object":r.referTo("Array,Map",c=>(u,s)=>c(u,xn(s))),"Matrix, Object":r.referTo("Matrix,Map",c=>(u,s)=>c(u,xn(s))),"Array | Matrix, Map":r.referToSelf(c=>(u,s)=>u.map(l=>c(l,s)))})}),xm="symbolicEqual",MC=["parse","simplify","typed","OperatorNode"],SC=R(xm,MC,e=>{var{parse:r,simplify:n,typed:t,OperatorNode:i}=e;function a(o,f){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=new i("-","subtract",[o,f]),s=n(u,{},c);return Ve(s)&&!s.value}return t(xm,{"Node, Node":a,"Node, Node, Object":a})}),bm="derivative",FC=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],CC=R(bm,FC,e=>{var{typed:r,config:n,parse:t,simplify:i,equal:a,isZero:o,numeric:f,ConstantNode:c,FunctionNode:u,OperatorNode:s,ParenthesisNode:l,SymbolNode:p}=e;function m(h,x){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},N={};w(N,h,x.name);var A=v(h,N);return y.simplify?i(A):A}r.addConversion({from:"identifier",to:"SymbolNode",convert:t});var d=r(bm,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});r.removeConversion({from:"identifier",to:"SymbolNode",convert:t}),d._simplify=!0,d.toTex=function(h){return g.apply(null,h.args)};var g=r("_derivTex",{"Node, SymbolNode":function(h,x){return Ve(h)&&nr(h.value)==="string"?g(t(h.value).toString(),x.toString(),1):g(h.toTex(),x.toString(),1)},"Node, ConstantNode":function(h,x){if(nr(x.value)==="string")return g(h,t(x.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(h,x,y){return g(h.toString(),x.name,y.value)},"string, string, number":function(h,x,y){var N;return y===1?N="{d\\over d"+x+"}":N="{d^{"+y+"}\\over d"+x+"^{"+y+"}}",N+"\\left[".concat(h,"\\right]")}}),w=r("constTag",{"Object, ConstantNode, string":function(h,x){return h[x]=!0,!0},"Object, SymbolNode, string":function(h,x,y){return x.name!==y?(h[x]=!0,!0):!1},"Object, ParenthesisNode, string":function(h,x,y){return w(h,x.content,y)},"Object, FunctionAssignmentNode, string":function(h,x,y){return x.params.indexOf(y)===-1?(h[x]=!0,!0):w(h,x.expr,y)},"Object, FunctionNode | OperatorNode, string":function(h,x,y){if(x.args.length>0){for(var N=w(h,x.args[0],y),A=1;A<x.args.length;++A)N=w(h,x.args[A],y)&&N;if(N)return h[x]=!0,!0}return!1}}),v=r("_derivative",{"ConstantNode, Object":function(h){return b(0)},"SymbolNode, Object":function(h,x){return x[h]!==void 0?b(0):b(1)},"ParenthesisNode, Object":function(h,x){return new l(v(h.content,x))},"FunctionAssignmentNode, Object":function(h,x){return x[h]!==void 0?b(0):v(h.expr,x)},"FunctionNode, Object":function(h,x){if(x[h]!==void 0)return b(0);var y=h.args[0],N,A=!1,E=!1,D;switch(h.name){case"cbrt":A=!0,D=new s("*","multiply",[b(3),new s("^","pow",[y,new s("/","divide",[b(2),b(3)])])]);break;case"sqrt":case"nthRoot":if(h.args.length===1)A=!0,D=new s("*","multiply",[b(2),new u("sqrt",[y])]);else if(h.args.length===2)return N=new s("/","divide",[b(1),h.args[1]]),x[N]=x[h.args[1]],v(new s("^","pow",[y,N]),x);break;case"log10":N=b(10);case"log":if(!N&&h.args.length===1)D=y.clone(),A=!0;else if(h.args.length===1&&N||h.args.length===2&&x[h.args[1]]!==void 0)D=new s("*","multiply",[y.clone(),new u("log",[N||h.args[1]])]),A=!0;else if(h.args.length===2)return v(new s("/","divide",[new u("log",[y]),new u("log",[h.args[1]])]),x);break;case"pow":if(h.args.length===2)return x[N]=x[h.args[1]],v(new s("^","pow",[y,h.args[1]]),x);break;case"exp":D=new u("exp",[y.clone()]);break;case"sin":D=new u("cos",[y.clone()]);break;case"cos":D=new s("-","unaryMinus",[new u("sin",[y.clone()])]);break;case"tan":D=new s("^","pow",[new u("sec",[y.clone()]),b(2)]);break;case"sec":D=new s("*","multiply",[h,new u("tan",[y.clone()])]);break;case"csc":E=!0,D=new s("*","multiply",[h,new u("cot",[y.clone()])]);break;case"cot":E=!0,D=new s("^","pow",[new u("csc",[y.clone()]),b(2)]);break;case"asin":A=!0,D=new u("sqrt",[new s("-","subtract",[b(1),new s("^","pow",[y.clone(),b(2)])])]);break;case"acos":A=!0,E=!0,D=new u("sqrt",[new s("-","subtract",[b(1),new s("^","pow",[y.clone(),b(2)])])]);break;case"atan":A=!0,D=new s("+","add",[new s("^","pow",[y.clone(),b(2)]),b(1)]);break;case"asec":A=!0,D=new s("*","multiply",[new u("abs",[y.clone()]),new u("sqrt",[new s("-","subtract",[new s("^","pow",[y.clone(),b(2)]),b(1)])])]);break;case"acsc":A=!0,E=!0,D=new s("*","multiply",[new u("abs",[y.clone()]),new u("sqrt",[new s("-","subtract",[new s("^","pow",[y.clone(),b(2)]),b(1)])])]);break;case"acot":A=!0,E=!0,D=new s("+","add",[new s("^","pow",[y.clone(),b(2)]),b(1)]);break;case"sinh":D=new u("cosh",[y.clone()]);break;case"cosh":D=new u("sinh",[y.clone()]);break;case"tanh":D=new s("^","pow",[new u("sech",[y.clone()]),b(2)]);break;case"sech":E=!0,D=new s("*","multiply",[h,new u("tanh",[y.clone()])]);break;case"csch":E=!0,D=new s("*","multiply",[h,new u("coth",[y.clone()])]);break;case"coth":E=!0,D=new s("^","pow",[new u("csch",[y.clone()]),b(2)]);break;case"asinh":A=!0,D=new u("sqrt",[new s("+","add",[new s("^","pow",[y.clone(),b(2)]),b(1)])]);break;case"acosh":A=!0,D=new u("sqrt",[new s("-","subtract",[new s("^","pow",[y.clone(),b(2)]),b(1)])]);break;case"atanh":A=!0,D=new s("-","subtract",[b(1),new s("^","pow",[y.clone(),b(2)])]);break;case"asech":A=!0,E=!0,D=new s("*","multiply",[y.clone(),new u("sqrt",[new s("-","subtract",[b(1),new s("^","pow",[y.clone(),b(2)])])])]);break;case"acsch":A=!0,E=!0,D=new s("*","multiply",[new u("abs",[y.clone()]),new u("sqrt",[new s("+","add",[new s("^","pow",[y.clone(),b(2)]),b(1)])])]);break;case"acoth":A=!0,E=!0,D=new s("-","subtract",[b(1),new s("^","pow",[y.clone(),b(2)])]);break;case"abs":D=new s("/","divide",[new u(new p("abs"),[y.clone()]),y.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+h.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var M,S;A?(M="/",S="divide"):(M="*",S="multiply");var B=v(y,x);return E&&(B=new s("-","unaryMinus",[B])),new s(M,S,[B,D])},"OperatorNode, Object":function(h,x){if(x[h]!==void 0)return b(0);if(h.op==="+")return new s(h.op,h.fn,h.args.map(function(j){return v(j,x)}));if(h.op==="-"){if(h.isUnary())return new s(h.op,h.fn,[v(h.args[0],x)]);if(h.isBinary())return new s(h.op,h.fn,[v(h.args[0],x),v(h.args[1],x)])}if(h.op==="*"){var y=h.args.filter(function(j){return x[j]!==void 0});if(y.length>0){var N=h.args.filter(function(j){return x[j]===void 0}),A=N.length===1?N[0]:new s("*","multiply",N),E=y.concat(v(A,x));return new s("*","multiply",E)}return new s("+","add",h.args.map(function(j){return new s("*","multiply",h.args.map(function(_){return _===j?v(_,x):_.clone()}))}))}if(h.op==="/"&&h.isBinary()){var D=h.args[0],M=h.args[1];return x[M]!==void 0?new s("/","divide",[v(D,x),M]):x[D]!==void 0?new s("*","multiply",[new s("-","unaryMinus",[D]),new s("/","divide",[v(M,x),new s("^","pow",[M.clone(),b(2)])])]):new s("/","divide",[new s("-","subtract",[new s("*","multiply",[v(D,x),M.clone()]),new s("*","multiply",[D.clone(),v(M,x)])]),new s("^","pow",[M.clone(),b(2)])])}if(h.op==="^"&&h.isBinary()){var S=h.args[0],B=h.args[1];if(x[S]!==void 0)return Ve(S)&&(o(S.value)||a(S.value,1))?b(0):new s("*","multiply",[h,new s("*","multiply",[new u("log",[S.clone()]),v(B.clone(),x)])]);if(x[B]!==void 0){if(Ve(B)){if(o(B.value))return b(0);if(a(B.value,1))return v(S,x)}var I=new s("^","pow",[S.clone(),new s("-","subtract",[B,b(1)])]);return new s("*","multiply",[B.clone(),new s("*","multiply",[v(S,x),I])])}return new s("*","multiply",[new s("^","pow",[S.clone(),B.clone()]),new s("+","add",[new s("*","multiply",[v(S,x),new s("/","divide",[B.clone(),S.clone()])]),new s("*","multiply",[v(B,x),new u("log",[S.clone()])])])])}throw new Error('Cannot process operator "'+h.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function b(h,x){return new c(f(h,x||n.number))}return d}),wm="rationalize",BC=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],OC=R(wm,BC,e=>{var{config:r,typed:n,equal:t,isZero:i,add:a,subtract:o,multiply:f,divide:c,pow:u,parse:s,simplifyConstant:l,simplifyCore:p,simplify:m,fraction:d,bignumber:g,mathWithTransform:w,matrix:v,AccessorNode:b,ArrayNode:h,ConstantNode:x,FunctionNode:y,IndexNode:N,ObjectNode:A,OperatorNode:E,SymbolNode:D,ParenthesisNode:M}=e;function S(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,T=I(),Y=B(O,C,!0,T.firstRules),te=Y.variables.length,$={exactFractions:!1},q={exactFractions:!0};if(O=Y.expression,te>=1){O=j(O);var ne,se,Q=!0,ee=!1;O=m(O,T.firstRules,{},$);for(var ue;se=Q?T.distrDivRules:T.sucDivRules,O=m(O,se,{},q),Q=!Q,ue=O.toString(),ue!==ne;)ee=!0,ne=ue;ee&&(O=m(O,T.firstRulesAgain,{},$)),O=m(O,T.finalRules,{},$)}var X=[],ie={};return O.type==="OperatorNode"&&O.isBinary()&&O.op==="/"?(te===1&&(O.args[0]=_(O.args[0],X),O.args[1]=_(O.args[1])),z&&(ie.numerator=O.args[0],ie.denominator=O.args[1])):(te===1&&(O=_(O,X)),z&&(ie.numerator=O,ie.denominator=null)),z?(ie.coefficients=X,ie.variables=Y.variables,ie.expression=O,ie):O}return n(wm,{Node:S,"Node, boolean":(O,C)=>S(O,{},C),"Node, Object":S,"Node, Object, boolean":S});function B(O,C,z,T){var Y=[],te=m(O,T,C,{exactFractions:!1});z=!!z;var $="+-*"+(z?"/":"");ne(te);var q={};return q.expression=te,q.variables=Y,q;function ne(se){var Q=se.type;if(Q==="FunctionNode")throw new Error("There is an unsolved function call");if(Q==="OperatorNode")if(se.op==="^"){if(se.args[1].type!=="ConstantNode"||!Se(parseFloat(se.args[1].value)))throw new Error("There is a non-integer exponent");ne(se.args[0])}else{if($.indexOf(se.op)===-1)throw new Error("Operator "+se.op+" invalid in polynomial expression");for(var ee=0;ee<se.args.length;ee++)ne(se.args[ee])}else if(Q==="SymbolNode"){var ue=se.name,X=Y.indexOf(ue);X===-1&&Y.push(ue)}else if(Q==="ParenthesisNode")ne(se.content);else if(Q!=="ConstantNode")throw new Error("type "+Q+" is not allowed in polynomial expression")}}function I(){var O=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},l,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],C=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],z=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],T=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],Y={};return Y.firstRules=O.concat(C,T),Y.distrDivRules=z,Y.sucDivRules=T,Y.firstRulesAgain=O.concat(C),Y.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},l,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],Y}function j(O,C,z){var T=O.type,Y=arguments.length>1;if(T==="OperatorNode"&&O.isBinary()){var te=!1,$;if(O.op==="^"&&(O.args[0].type==="ParenthesisNode"||O.args[0].type==="OperatorNode")&&O.args[1].type==="ConstantNode"&&($=parseFloat(O.args[1].value),te=$>=2&&Se($)),te){if($>2){var q=O.args[0],ne=new E("^","pow",[O.args[0].cloneDeep(),new x($-1)]);O=new E("*","multiply",[q,ne])}else O=new E("*","multiply",[O.args[0],O.args[0].cloneDeep()]);Y&&(z==="content"?C.content=O:C.args[z]=O)}}if(T==="ParenthesisNode")j(O.content,O,"content");else if(T!=="ConstantNode"&&T!=="SymbolNode")for(var se=0;se<O.args.length;se++)j(O.args[se],O,se);if(!Y)return O}function _(O,C){C===void 0&&(C=[]),C[0]=0;var z={};z.cte=1,z.oper="+",z.fire="";var T=0,Y="";ue(O,null,z),T=C.length-1;for(var te=!0,$,q=T;q>=0;q--)if(C[q]!==0){var ne=new x(te?C[q]:Math.abs(C[q])),se=C[q]<0?"-":"+";if(q>0){var Q=new D(Y);if(q>1){var ee=new x(q);Q=new E("^","pow",[Q,ee])}C[q]===-1&&te?ne=new E("-","unaryMinus",[Q]):Math.abs(C[q])===1?ne=Q:ne=new E("*","multiply",[ne,Q])}te?$=ne:se==="+"?$=new E("+","add",[$,ne]):$=new E("-","subtract",[$,ne]),te=!1}if(te)return new x(0);return $;function ue(X,ie,oe){var ce=X.type;if(ce==="FunctionNode")throw new Error("There is an unsolved function call");if(ce==="OperatorNode"){if("+-*^".indexOf(X.op)===-1)throw new Error("Operator "+X.op+" invalid");if(ie!==null){if((X.fn==="unaryMinus"||X.fn==="pow")&&ie.fn!=="add"&&ie.fn!=="subtract"&&ie.fn!=="multiply")throw new Error("Invalid "+X.op+" placing");if((X.fn==="subtract"||X.fn==="add"||X.fn==="multiply")&&ie.fn!=="add"&&ie.fn!=="subtract")throw new Error("Invalid "+X.op+" placing");if((X.fn==="subtract"||X.fn==="add"||X.fn==="unaryMinus")&&oe.noFil!==0)throw new Error("Invalid "+X.op+" placing")}(X.op==="^"||X.op==="*")&&(oe.fire=X.op);for(var ye=0;ye<X.args.length;ye++)X.fn==="unaryMinus"&&(oe.oper="-"),(X.op==="+"||X.fn==="subtract")&&(oe.fire="",oe.cte=1,oe.oper=ye===0?"+":X.op),oe.noFil=ye,ue(X.args[ye],X,oe)}else if(ce==="SymbolNode"){if(X.name!==Y&&Y!=="")throw new Error("There is more than one variable");if(Y=X.name,ie===null){C[1]=1;return}if(ie.op==="^"&&oe.noFil!==0)throw new Error("In power the variable should be the first parameter");if(ie.op==="*"&&oe.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(oe.fire===""||oe.fire==="*")&&(T<1&&(C[1]=0),C[1]+=oe.cte*(oe.oper==="+"?1:-1),T=Math.max(1,T))}else if(ce==="ConstantNode"){var Ae=parseFloat(X.value);if(ie===null){C[0]=Ae;return}if(ie.op==="^"){if(oe.noFil!==1)throw new Error("Constant cannot be powered");if(!Se(Ae)||Ae<=0)throw new Error("Non-integer exponent is not allowed");for(var P=T+1;P<Ae;P++)C[P]=0;Ae>T&&(C[Ae]=0),C[Ae]+=oe.cte*(oe.oper==="+"?1:-1),T=Math.max(Ae,T);return}oe.cte=Ae,oe.fire===""&&(C[0]+=oe.cte*(oe.oper==="+"?1:-1))}else throw new Error("Type "+ce+" is not allowed")}}}),Nm="zpk2tf",TC=["typed","add","multiply","Complex","number"],_C=R(Nm,TC,e=>{var{typed:r,add:n,multiply:t,Complex:i,number:a}=e;return r(Nm,{"Array,Array,number":function(c,u,s){return o(c,u,s)},"Array,Array":function(c,u){return o(c,u,1)},"Matrix,Matrix,number":function(c,u,s){return o(c.valueOf(),u.valueOf(),s)},"Matrix,Matrix":function(c,u){return o(c.valueOf(),u.valueOf(),1)}});function o(c,u,s){c.some(b=>b.type==="BigNumber")&&(c=c.map(b=>a(b))),u.some(b=>b.type==="BigNumber")&&(u=u.map(b=>a(b)));for(var l=[i(1,0)],p=[i(1,0)],m=0;m<c.length;m++){var d=c[m];typeof d=="number"&&(d=i(d,0)),l=f(l,[i(1,0),i(-d.re,-d.im)])}for(var g=0;g<u.length;g++){var w=u[g];typeof w=="number"&&(w=i(w,0)),p=f(p,[i(1,0),i(-w.re,-w.im)])}for(var v=0;v<l.length;v++)l[v]=t(l[v],s);return[l,p]}function f(c,u){for(var s=[],l=0;l<c.length+u.length-1;l++){s[l]=i(0,0);for(var p=0;p<c.length;p++)l-p>=0&&l-p<u.length&&(s[l]=n(s[l],t(c[p],u[l-p])))}return s}}),Dm="freqz",IC=["typed","add","multiply","Complex","divide","matrix"],zC=R(Dm,IC,e=>{var{typed:r,add:n,multiply:t,Complex:i,divide:a,matrix:o}=e;return r(Dm,{"Array, Array":function(u,s){var l=c(512);return f(u,s,l)},"Array, Array, Array":function(u,s,l){return f(u,s,l)},"Array, Array, number":function(u,s,l){if(l<0)throw new Error("w must be a positive number");var p=c(l);return f(u,s,p)},"Matrix, Matrix":function(u,s){var l=c(512),{w:p,h:m}=f(u.valueOf(),s.valueOf(),l);return{w:o(p),h:o(m)}},"Matrix, Matrix, Matrix":function(u,s,l){var{h:p}=f(u.valueOf(),s.valueOf(),l.valueOf());return{h:o(p),w:o(l)}},"Matrix, Matrix, number":function(u,s,l){if(l<0)throw new Error("w must be a positive number");var p=c(l),{h:m}=f(u.valueOf(),s.valueOf(),p);return{h:o(m),w:o(p)}}});function f(u,s,l){for(var p=[],m=[],d=0;d<l.length;d++){for(var g=i(0,0),w=i(0,0),v=0;v<u.length;v++)g=n(g,t(u[v],i(Math.cos(-v*l[d]),Math.sin(-v*l[d]))));for(var b=0;b<s.length;b++)w=n(w,t(s[b],i(Math.cos(-b*l[d]),Math.sin(-b*l[d]))));p.push(g),m.push(w)}for(var h=[],x=0;x<p.length;x++)h.push(a(p[x],m[x]));return{h,w:l}}function c(u){for(var s=[],l=0;l<u;l++)s.push(l/u*Math.PI);return s}}),RC="reviver",qC=["classes"],kC=R(RC,qC,e=>{var{classes:r}=e;return function(n,t){var i=r[t&&t.mathjs];return i&&typeof i.fromJSON=="function"?i.fromJSON(t):t}}),jC="replacer",PC=[],UC=R(jC,PC,()=>function(e,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:r}),LC="12.3.1",HC=R("true",[],()=>!0),$C=R("false",[],()=>!1),ZC=R("null",[],()=>null),JC=Hr("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n(1/0):1/0}),WC=Hr("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n(NaN):NaN}),YC=Hr("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?no(n):ug}),GC=Hr("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?Ow(n):lg}),VC=Hr("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?Cw(n):cg}),KC=Hr("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?Bw(n):fg}),QC=Hr("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n(2).ln():Math.LN2}),XC=Hr("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n(10).ln():Math.LN10}),e4=Hr("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n(1).div(new n(2).ln()):Math.LOG2E}),r4=Hr("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n(1).div(new n(10).ln()):Math.LOG10E}),t4=Hr("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n("0.5").sqrt():Math.SQRT1_2}),n4=Hr("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:n}=e;return r.number==="BigNumber"?new n(2).sqrt():Math.SQRT2}),i4=Hr("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),a4=R("version",[],()=>LC);function Hr(e,r,n){return R(e,r,n,{recreateOnConfigChange:!0})}var o4=Re("speedOfLight","299792458","m s^-1"),s4=Re("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),u4=Re("planckConstant","6.62607015e-34","J s"),l4=Re("reducedPlanckConstant","1.0545718176461565e-34","J s"),c4=Re("magneticConstant","1.25663706212e-6","N A^-2"),f4=Re("electricConstant","8.8541878128e-12","F m^-1"),p4=Re("vacuumImpedance","376.730313667","ohm"),m4=Re("coulomb","8.987551792261171e9","N m^2 C^-2"),d4=Re("elementaryCharge","1.602176634e-19","C"),h4=Re("bohrMagneton","9.2740100783e-24","J T^-1"),g4=Re("conductanceQuantum","7.748091729863649e-5","S"),v4=Re("inverseConductanceQuantum","12906.403729652257","ohm"),y4=Re("magneticFluxQuantum","2.0678338484619295e-15","Wb"),x4=Re("nuclearMagneton","5.0507837461e-27","J T^-1"),b4=Re("klitzing","25812.807459304513","ohm"),w4=Re("bohrRadius","5.29177210903e-11","m"),N4=Re("classicalElectronRadius","2.8179403262e-15","m"),D4=Re("electronMass","9.1093837015e-31","kg"),A4=Re("fermiCoupling","1.1663787e-5","GeV^-2"),E4=fa("fineStructure",.0072973525693),M4=Re("hartreeEnergy","4.3597447222071e-18","J"),S4=Re("protonMass","1.67262192369e-27","kg"),F4=Re("deuteronMass","3.3435830926e-27","kg"),C4=Re("neutronMass","1.6749271613e-27","kg"),B4=Re("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),O4=Re("rydberg","10973731.568160","m^-1"),T4=Re("thomsonCrossSection","6.6524587321e-29","m^2"),_4=fa("weakMixingAngle",.2229),I4=fa("efimovFactor",22.7),z4=Re("atomicMass","1.66053906660e-27","kg"),R4=Re("avogadro","6.02214076e23","mol^-1"),q4=Re("boltzmann","1.380649e-23","J K^-1"),k4=Re("faraday","96485.33212331001","C mol^-1"),j4=Re("firstRadiation","3.7417718521927573e-16","W m^2"),P4=Re("loschmidt","2.686780111798444e25","m^-3"),U4=Re("gasConstant","8.31446261815324","J K^-1 mol^-1"),L4=Re("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),H4=Re("molarVolume","0.022413969545014137","m^3 mol^-1"),$4=fa("sackurTetrode",-1.16487052358),Z4=Re("secondRadiation","0.014387768775039337","m K"),J4=Re("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),W4=Re("wienDisplacement","2.897771955e-3","m K"),Y4=Re("molarMass","0.99999999965e-3","kg mol^-1"),G4=Re("molarMassC12","11.9999999958e-3","kg mol^-1"),V4=Re("gravity","9.80665","m s^-2"),K4=Re("planckLength","1.616255e-35","m"),Q4=Re("planckMass","2.176435e-8","kg"),X4=Re("planckTime","5.391245e-44","s"),e5=Re("planckCharge","1.87554603778e-18","C"),r5=Re("planckTemperature","1.416785e+32","K");function Re(e,r,n){var t=["config","Unit","BigNumber"];return R(e,t,i=>{var{config:a,Unit:o,BigNumber:f}=i,c=a.number==="BigNumber"?new f(r):parseFloat(r),u=new o(c,n);return u.fixPrefix=!0,u})}function fa(e,r){var n=["config","BigNumber"];return R(e,n,t=>{var{config:i,BigNumber:a}=t;return i.number==="BigNumber"?new a(r):r})}var t5="apply",n5=["typed","isInteger"],i5=R(t5,n5,e=>{var{typed:r,isInteger:n}=e,t=Wa({typed:r,isInteger:n});return r("apply",{"...any":function(i){var a=i[1];ke(a)?i[1]=a-1:je(a)&&(i[1]=a.minus(1));try{return t.apply(null,i)}catch(o){throw zr(o)}}})},{isTransformFunction:!0}),a5="column",o5=["typed","Index","matrix","range"],s5=R(a5,o5,e=>{var{typed:r,Index:n,matrix:t,range:i}=e,a=$l({typed:r,Index:n,matrix:t,range:i});return r("column",{"...any":function(o){var f=o.length-1,c=o[f];ke(c)&&(o[f]=c-1);try{return a.apply(null,o)}catch(u){throw zr(u)}}})},{isTransformFunction:!0});function ho(e,r,n){var t=e.filter(function(f){return br(f)&&!(f.name in r)&&!n.has(f.name)})[0];if(!t)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=t.name,a=ei(n),o=e.compile();return function(f){return a.set(i,f),o.evaluate(a)}}var u5="filter",l5=["typed"],c5=R(u5,l5,e=>{var{typed:r}=e;function n(i,a,o){var f,c;return i[0]&&(f=i[0].compile().evaluate(o)),i[1]&&(br(i[1])||$n(i[1])?c=i[1].compile().evaluate(o):c=ho(i[1],a,o)),t(f,c)}n.rawArgs=!0;var t=r("filter",{"Array, function":Am,"Matrix, function":function(i,a){return i.create(Am(i.toArray(),a))},"Array, RegExp":xi,"Matrix, RegExp":function(i,a){return i.create(xi(i.toArray(),a))}});return n},{isTransformFunction:!0});function Am(e,r){return ps(e,function(n,t,i){return Sn(r,n,[t+1],i,"filter")})}var f5="forEach",p5=["typed"],m5=R(f5,p5,e=>{var{typed:r}=e;function n(i,a,o){var f,c;return i[0]&&(f=i[0].compile().evaluate(o)),i[1]&&(br(i[1])||$n(i[1])?c=i[1].compile().evaluate(o):c=ho(i[1],a,o)),t(f,c)}n.rawArgs=!0;var t=r("forEach",{"Array | Matrix, function":function(i,a){var o=function f(c,u){if(Array.isArray(c))yi(c,function(s,l){f(s,u.concat(l+1))});else return Sn(a,c,u,i,"forEach")};o(i.valueOf(),[])}});return n},{isTransformFunction:!0}),d5="index",h5=["Index","getMatrixDataType"],g5=R(d5,h5,e=>{var{Index:r,getMatrixDataType:n}=e;return function(){for(var t=[],i=0,a=arguments.length;i<a;i++){var o=arguments[i];if(Ma(o))o.start--,o.end-=o.step>0?0:2;else if(o&&o.isSet===!0)o=o.map(function(c){return c-1});else if(Xe(o)||Be(o))n(o)!=="boolean"&&(o=o.map(function(c){return c-1}));else if(ke(o))o--;else if(je(o))o=o.toNumber()-1;else if(typeof o!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");t[i]=o}var f=new r;return r.apply(f,t),f}},{isTransformFunction:!0}),v5="map",y5=["typed"],x5=R(v5,y5,e=>{var{typed:r}=e;function n(i,a,o){var f,c;return i[0]&&(f=i[0].compile().evaluate(o)),i[1]&&(br(i[1])||$n(i[1])?c=i[1].compile().evaluate(o):c=ho(i[1],a,o)),t(f,c)}n.rawArgs=!0;var t=r("map",{"Array, function":function(i,a){return Em(i,a,i)},"Matrix, function":function(i,a){return i.create(Em(i.valueOf(),a,i))}});return n},{isTransformFunction:!0});function Em(e,r,n){function t(i,a){return Array.isArray(i)?bt(i,function(o,f){return t(o,a.concat(f+1))}):Sn(r,i,a,n,"map")}return t(e,[])}function jt(e){if(e.length===2&&Wr(e[0])){e=e.slice();var r=e[1];ke(r)?e[1]=r-1:je(r)&&(e[1]=r.minus(1))}return e}var b5="max",w5=["typed","config","numeric","larger"],N5=R(b5,w5,e=>{var{typed:r,config:n,numeric:t,larger:i}=e,a=sf({typed:r,config:n,numeric:t,larger:i});return r("max",{"...any":function(o){o=jt(o);try{return a.apply(null,o)}catch(f){throw zr(f)}}})},{isTransformFunction:!0}),D5="mean",A5=["typed","add","divide"],E5=R(D5,A5,e=>{var{typed:r,add:n,divide:t}=e,i=_p({typed:r,add:n,divide:t});return r("mean",{"...any":function(a){a=jt(a);try{return i.apply(null,a)}catch(o){throw zr(o)}}})},{isTransformFunction:!0}),M5="min",S5=["typed","config","numeric","smaller"],F5=R(M5,S5,e=>{var{typed:r,config:n,numeric:t,smaller:i}=e,a=lf({typed:r,config:n,numeric:t,smaller:i});return r("min",{"...any":function(o){o=jt(o);try{return a.apply(null,o)}catch(f){throw zr(f)}}})},{isTransformFunction:!0}),C5="range",B5=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],O5=R(C5,B5,e=>{var{typed:r,config:n,matrix:t,bignumber:i,smaller:a,smallerEq:o,larger:f,largerEq:c,add:u,isPositive:s}=e,l=oc({typed:r,config:n,matrix:t,bignumber:i,smaller:a,smallerEq:o,larger:f,largerEq:c,add:u,isPositive:s});return r("range",{"...any":function(p){var m=p.length-1,d=p[m];return typeof d!="boolean"&&p.push(!0),l.apply(null,p)}})},{isTransformFunction:!0}),T5="row",_5=["typed","Index","matrix","range"],I5=R(T5,_5,e=>{var{typed:r,Index:n,matrix:t,range:i}=e,a=fc({typed:r,Index:n,matrix:t,range:i});return r("row",{"...any":function(o){var f=o.length-1,c=o[f];ke(c)&&(o[f]=c-1);try{return a.apply(null,o)}catch(u){throw zr(u)}}})},{isTransformFunction:!0}),z5="subset",R5=["typed","matrix","zeros","add"],q5=R(z5,R5,e=>{var{typed:r,matrix:n,zeros:t,add:i}=e,a=hc({typed:r,matrix:n,zeros:t,add:i});return r("subset",{"...any":function(o){try{return a.apply(null,o)}catch(f){throw zr(f)}}})},{isTransformFunction:!0}),k5="concat",j5=["typed","matrix","isInteger"],P5=R(k5,j5,e=>{var{typed:r,matrix:n,isInteger:t}=e,i=Ll({typed:r,matrix:n,isInteger:t});return r("concat",{"...any":function(a){var o=a.length-1,f=a[o];ke(f)?a[o]=f-1:je(f)&&(a[o]=f.minus(1));try{return i.apply(null,a)}catch(c){throw zr(c)}}})},{isTransformFunction:!0}),Mm="diff",U5=["typed","matrix","subtract","number","bignumber"],L5=R(Mm,U5,e=>{var{typed:r,matrix:n,subtract:t,number:i,bignumber:a}=e,o=tc({typed:r,matrix:n,subtract:t,number:i,bignumber:a});return r(Mm,{"...any":function(f){f=jt(f);try{return o.apply(null,f)}catch(c){throw zr(c)}}})},{isTransformFunction:!0}),H5="std",$5=["typed","map","sqrt","variance"],Z5=R(H5,$5,e=>{var{typed:r,map:n,sqrt:t,variance:i}=e,a=Up({typed:r,map:n,sqrt:t,variance:i});return r("std",{"...any":function(o){o=jt(o);try{return a.apply(null,o)}catch(f){throw zr(f)}}})},{isTransformFunction:!0}),Sm="sum",J5=["typed","config","add","numeric"],W5=R(Sm,J5,e=>{var{typed:r,config:n,add:t,numeric:i}=e,a=Bp({typed:r,config:n,add:t,numeric:i});return r(Sm,{"...any":function(o){o=jt(o);try{return a.apply(null,o)}catch(f){throw zr(f)}}})},{isTransformFunction:!0}),Y5="quantileSeq",G5=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],V5=R(Y5,G5,e=>{var{typed:r,bignumber:n,add:t,subtract:i,divide:a,multiply:o,partitionSelect:f,compare:c,isInteger:u,smaller:s,smallerEq:l,larger:p}=e,m=jp({typed:r,bignumber:n,add:t,subtract:i,divide:a,multiply:o,partitionSelect:f,compare:c,isInteger:u,smaller:s,smallerEq:l,larger:p});return r("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(g,w,v)=>m(g,w,d(v)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(g,w,v,b)=>m(g,w,v,d(b)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(g,w,v)=>m(g,w,d(v)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(g,w,v,b)=>m(g,w,v,d(b))});function d(g){return jt([[],g])[1]}},{isTransformFunction:!0}),Fm="cumsum",K5=["typed","add","unaryPlus"],Q5=R(Fm,K5,e=>{var{typed:r,add:n,unaryPlus:t}=e,i=Op({typed:r,add:n,unaryPlus:t});return r(Fm,{"...any":function(a){if(a.length===2&&Wr(a[0])){var o=a[1];ke(o)?a[1]=o-1:je(o)&&(a[1]=o.minus(1))}try{return i.apply(null,a)}catch(f){throw zr(f)}}})},{isTransformFunction:!0}),Cm="variance",X5=["typed","add","subtract","multiply","divide","apply","isNaN"],eB=R(Cm,X5,e=>{var{typed:r,add:n,subtract:t,multiply:i,divide:a,apply:o,isNaN:f}=e,c=qp({typed:r,add:n,subtract:t,multiply:i,divide:a,apply:o,isNaN:f});return r(Cm,{"...any":function(u){u=jt(u);try{return c.apply(null,u)}catch(s){throw zr(s)}}})},{isTransformFunction:!0}),Bm="print",rB=["typed","matrix","zeros","add"],tB=R(Bm,rB,e=>{var{typed:r,matrix:n,zeros:t,add:i}=e,a=Tc({typed:r,matrix:n,zeros:t,add:i});return r(Bm,{"string, Object | Array":function(f,c){return a(o(f),c)},"string, Object | Array, number | Object":function(f,c,u){return a(o(f),c,u)}});function o(f){return f.replace(Bc,c=>{var u=c.slice(1).split("."),s=u.map(function(l){return!isNaN(l)&&l.length>0?parseInt(l)-1:l});return"$"+s.join(".")})}},{isTransformFunction:!0}),nB="and",iB=["typed","matrix","zeros","add","equalScalar","not","concat"],aB=R(nB,iB,e=>{var{typed:r,matrix:n,equalScalar:t,zeros:i,not:a,concat:o}=e,f=Qc({typed:r,matrix:n,equalScalar:t,zeros:i,not:a,concat:o});function c(u,s,l){var p=u[0].compile().evaluate(l);if(!Wr(p)&&!f(p,!0))return!1;var m=u[1].compile().evaluate(l);return f(p,m)}return c.rawArgs=!0,c},{isTransformFunction:!0}),oB="or",sB=["typed","matrix","equalScalar","DenseMatrix","concat"],uB=R(oB,sB,e=>{var{typed:r,matrix:n,equalScalar:t,DenseMatrix:i,concat:a}=e,o=jl({typed:r,matrix:n,equalScalar:t,DenseMatrix:i,concat:a});function f(c,u,s){var l=c[0].compile().evaluate(s);if(!Wr(l)&&o(l,!1))return!0;var p=c[1].compile().evaluate(s);return o(l,p)}return f.rawArgs=!0,f},{isTransformFunction:!0}),lB="bitAnd",cB=["typed","matrix","zeros","add","equalScalar","not","concat"],fB=R(lB,cB,e=>{var{typed:r,matrix:n,equalScalar:t,zeros:i,not:a,concat:o}=e,f=Fl({typed:r,matrix:n,equalScalar:t,zeros:i,not:a,concat:o});function c(u,s,l){var p=u[0].compile().evaluate(l);if(!Wr(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var m=u[1].compile().evaluate(l);return f(p,m)}return c.rawArgs=!0,c},{isTransformFunction:!0}),pB="bitOr",mB=["typed","matrix","equalScalar","DenseMatrix","concat"],dB=R(pB,mB,e=>{var{typed:r,matrix:n,equalScalar:t,DenseMatrix:i,concat:a}=e,o=Ol({typed:r,matrix:n,equalScalar:t,DenseMatrix:i,concat:a});function f(c,u,s){var l=c[0].compile().evaluate(s);if(!Wr(l)){if(isNaN(l))return NaN;if(l===-1)return-1;if(l===!0)return 1}var p=c[1].compile().evaluate(s);return o(l,p)}return f.rawArgs=!0,f},{isTransformFunction:!0}),be=Rh({config:de}),or=Uh({}),Om=VC({BigNumber:be,config:de}),hB=$C({}),gB=E4({BigNumber:be,config:de}),en=Zh({}),Tm=i4({Complex:or}),vB=JC({BigNumber:be,config:de}),yB=XC({BigNumber:be,config:de}),xB=r4({BigNumber:be,config:de}),pa=Kh({}),bB=WC({BigNumber:be,config:de}),wB=ZC({}),NB=KC({BigNumber:be,config:de}),DB=Yh({}),_m=P0({}),AB=t4({BigNumber:be,config:de}),EB=$4({BigNumber:be,config:de}),Im=GC({BigNumber:be,config:de}),MB=HC({}),SB=a4({}),Pe=rg({Matrix:pa}),FB=I4({BigNumber:be,config:de}),CB=QC({BigNumber:be,config:de}),go=YC({BigNumber:be,config:de}),BB=UC({}),OB=n4({BigNumber:be,config:de}),L=R0({BigNumber:be,Complex:or,DenseMatrix:Pe,Fraction:en}),vo=p1({BigNumber:be,config:de,typed:L}),TB=_4({BigNumber:be,config:de}),Rr=d1({typed:L}),_B=Lw({Complex:or,config:de,typed:L}),IB=Jw({BigNumber:be,typed:L}),zB=Vw({BigNumber:be,Complex:or,config:de,typed:L}),yr=y1({typed:L}),RB=ay({typed:L}),qB=t2({BigNumber:be,Complex:or,config:de,typed:L}),kB=s2({typed:L}),zm=c2({typed:L}),jB=d2({Complex:or,config:de,typed:L}),qr=Jg({BigNumber:be,typed:L}),PB=Qv({typed:L}),UB=Hg({typed:L}),LB=ng({typed:L}),ma=bF({typed:L}),da=Gg({Complex:or,typed:L}),rn=sy({typed:L}),yo=g2({typed:L}),HB=b2({BigNumber:be,typed:L}),$B=A2({BigNumber:be,typed:L}),ZB=_1({typed:L}),Ze=Og({config:de,typed:L}),JB=Cx({typed:L}),Rm=z1({typed:L}),WB=q1({Complex:or,typed:L}),YB=Sy({typed:L}),GB=Oy({typed:L}),ri=Px({typed:L}),xo=Iy({typed:L}),VB=Jx({format:ri,typed:L}),bo=ly({typed:L}),Ur=ag({typed:L}),Pt=gg({typed:L}),tn=Ng({typed:L}),st=Ag({typed:L}),KB=e4({BigNumber:be,config:de}),QB=MF({Complex:or,typed:L}),XB=yv({Complex:or,config:de,typed:L}),qm=bv({Complex:or,config:de,typed:L}),nn=Py({typed:L}),fr=Dv({typed:L}),ha=my({typed:L}),Mt=jg({typed:L}),e8=$x({format:ri,typed:L}),r8=QF({config:de,typed:L}),t8=Tc({typed:L}),n8=eC({config:de,typed:L}),wo=fy({typed:L}),i8=F2({BigNumber:be,typed:L}),km=Cv({BigNumber:be,Fraction:en,complex:da,typed:L}),ga=T2({typed:L}),St=Ig({Matrix:pa,equalScalar:Ze,typed:L}),a8=u1({typed:L}),o8=Iv({typed:L}),s8=Ug({typed:L}),Kr=b1({typed:L}),u8=R2({typed:L}),jm=Fg({typed:L}),l8=$w({Complex:or,config:de,typed:L}),c8=Qw({BigNumber:be,typed:L}),No=Wa({isInteger:Ur,typed:L}),f8=e2({BigNumber:be,Complex:or,config:de,typed:L}),p8=Lx({format:ri,typed:L}),m8=NF({typed:L}),d8=y2({typed:L}),h8=M2({BigNumber:be,typed:L}),ti=Mg({typed:L}),g8=Kx({typed:L}),v8=tC({config:de,typed:L}),y8=B2({BigNumber:be,typed:L}),x8=I2({typed:L}),b8=kw({SparseMatrix:St,typed:L}),ut=Tv({Complex:or,config:de,typed:L}),w8=j2({typed:L}),dt=c1({typed:L}),N8=Yw({BigNumber:be,Complex:or,config:de,typed:L}),D8=N2({BigNumber:be,typed:L}),_n=Qg({Fraction:en,typed:L}),an=yg({typed:L}),ve=e1({DenseMatrix:Pe,Matrix:pa,SparseMatrix:St,typed:L}),A8=t1({isZero:st,matrix:ve,typed:L}),E8=Rx({isNaN:ti,isNumeric:an,typed:L}),lt=eb({bignumber:qr,fraction:_n,number:Mt}),Pm=kx({config:de,multiplyScalar:fr,numeric:lt,typed:L}),Um=Yy({isInteger:Ur,matrix:ve,typed:L}),Er=ix({matrix:ve,config:de,typed:L}),M8=ox({matrix:ve,typed:L}),ni=px({matrix:ve,typed:L}),Lm=kv({BigNumber:be,config:de,matrix:ve,typed:L}),Mr=gx({BigNumber:be,config:de,matrix:ve,typed:L}),S8=i2({Complex:or,config:de,typed:L}),Hm=N1({BigNumber:be,Complex:or,Fraction:en,config:de,isNegative:Pt,matrix:ve,typed:L,unaryMinus:dt}),Ge=Ll({isInteger:Ur,matrix:ve,typed:L}),F8=by({prod:Pm,size:Er,typed:L}),Do=dx({conj:rn,transpose:ni,typed:L}),$m=Ay({DenseMatrix:Pe,SparseMatrix:St,matrix:ve,typed:L}),lr=tb({numeric:lt,typed:L}),ii=gb({DenseMatrix:Pe,concat:Ge,divideScalar:lr,equalScalar:Ze,matrix:ve,typed:L}),Qr=$b({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),ai=Cy({matrix:ve,typed:L}),C8=bg({isNumeric:an,typed:L}),Ut=Ry({BigNumber:be,DenseMatrix:Pe,SparseMatrix:St,config:de,matrix:ve,typed:L}),B8=ky({matrix:ve,multiplyScalar:fr,typed:L}),va=iw({DenseMatrix:Pe,concat:Ge,config:de,matrix:ve,typed:L}),O8=Fb({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L,zeros:Mr}),Zm=yb({DenseMatrix:Pe,divideScalar:lr,equalScalar:Ze,matrix:ve,multiplyScalar:fr,subtractScalar:Kr,typed:L}),Ao=o1({flatten:ai,matrix:ve,size:Er,typed:L}),T8=Sv({BigNumber:be,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),_8=Zy({BigNumber:be,config:de,matrix:ve,typed:L}),Eo=wD({addScalar:yr,complex:da,conj:rn,divideScalar:lr,equal:Qr,identity:Ut,isZero:st,matrix:ve,multiplyScalar:fr,sign:km,sqrt:ut,subtractScalar:Kr,typed:L,unaryMinus:dt,zeros:Mr}),I8=Ky({config:de,matrix:ve}),z8=Bb({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L,zeros:Mr}),ht=ob({BigNumber:be,DenseMatrix:Pe,equalScalar:Ze,matrix:ve,typed:L,zeros:Mr}),kr=Gb({DenseMatrix:Pe,concat:Ge,config:de,matrix:ve,typed:L}),pr=Rv({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,subtractScalar:Kr,typed:L,unaryMinus:dt}),R8=Gx({concat:Ge,matrix:ve,typed:L}),q8=lw({DenseMatrix:Pe,concat:Ge,config:de,equalScalar:Ze,matrix:ve,typed:L}),Mo=bb({DenseMatrix:Pe,divideScalar:lr,equalScalar:Ze,matrix:ve,multiplyScalar:fr,subtractScalar:Kr,typed:L}),k8=gy({DenseMatrix:Pe,concat:Ge,matrix:ve,typed:L}),Je=sN({DenseMatrix:Pe,SparseMatrix:St,addScalar:yr,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),j8=p2({BigNumber:be,DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),P8=Fl({concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),U8=Ol({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),L8=ny({DenseMatrix:Pe,concat:Ge,matrix:ve,typed:L}),H8=uC({addScalar:yr,combinations:ma,divideScalar:lr,isInteger:Ur,isNegative:Pt,multiplyScalar:fr,typed:L}),on=zb({BigNumber:be,DenseMatrix:Pe,Fraction:en,concat:Ge,config:de,equalScalar:Ze,matrix:ve,typed:L}),Jm=Lb({concat:Ge,matrix:ve,typed:L}),$8=Op({add:Je,typed:L,unaryPlus:vo}),So=sw({equal:Qr,typed:L}),Z8=tc({matrix:ve,number:Mt,subtract:pr,typed:L}),J8=nF({abs:Rr,addScalar:yr,deepEqual:So,divideScalar:lr,multiplyScalar:fr,sqrt:ut,subtractScalar:Kr,typed:L}),ya=mN({addScalar:yr,conj:rn,multiplyScalar:fr,size:Er,typed:L}),W8=Wb({compareText:Jm,isZero:st,typed:L}),Wm=cl({DenseMatrix:Pe,config:de,equalScalar:Ze,matrix:ve,round:ht,typed:L,zeros:Mr}),Y8=pv({BigNumber:be,DenseMatrix:Pe,concat:Ge,config:de,equalScalar:Ze,matrix:ve,round:ht,typed:L,zeros:Mr}),G8=lN({abs:Rr,addScalar:yr,divideScalar:lr,isPositive:tn,multiplyScalar:fr,smaller:kr,sqrt:ut,typed:L}),Ym=xw({DenseMatrix:Pe,smaller:kr}),Br=Nw({ImmutableDenseMatrix:Ym,getMatrixDataType:xo}),jr=rw({DenseMatrix:Pe,concat:Ge,config:de,matrix:ve,typed:L}),Fo=ub({Complex:or,config:de,divideScalar:lr,typed:L}),V8=Nb({DenseMatrix:Pe,divideScalar:lr,equalScalar:Ze,matrix:ve,multiplyScalar:fr,subtractScalar:Kr,typed:L}),K8=i1({flatten:ai,matrix:ve,size:Er,typed:L}),Q8=lf({config:de,numeric:lt,smaller:kr,typed:L}),Gm=pl({DenseMatrix:Pe,concat:Ge,config:de,equalScalar:Ze,matrix:ve,round:ht,typed:L,zeros:Mr}),er=Ev({addScalar:yr,dot:ya,equalScalar:Ze,matrix:ve,multiplyScalar:fr,typed:L}),X8=pb({Complex:or,config:de,divideScalar:lr,typed:L}),eO=jl({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),xa=pw({compare:on,isNaN:ti,isNumeric:an,typed:L}),rO=Tb({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L,zeros:Mr}),Vm=ZD({SparseMatrix:St,abs:Rr,add:Je,divideScalar:lr,larger:jr,largerEq:va,multiply:er,subtract:pr,transpose:ni,typed:L}),$r=hc({add:Je,matrix:ve,typed:L,zeros:Mr}),Co=Bp({add:Je,config:de,numeric:lt,typed:L}),tO=gN({add:Je,matrix:ve,typed:L}),Km=Ab({DenseMatrix:Pe,divideScalar:lr,equalScalar:Ze,matrix:ve,multiplyScalar:fr,subtractScalar:Kr,typed:L}),nO=_C({Complex:or,add:Je,multiply:er,number:Mt,typed:L}),Bo=O1({DenseMatrix:Pe,config:de,equalScalar:Ze,matrix:ve,round:ht,typed:L,zeros:Mr}),gt=jb({compare:on,typed:L}),iO=cC({addScalar:yr,combinations:ma,isInteger:Ur,isNegative:Pt,isPositive:tn,larger:jr,typed:L}),aO=Ny({matrix:ve,multiply:er,subtract:pr,typed:L}),Qm=_3({divideScalar:lr,isZero:st,matrix:ve,multiply:er,subtractScalar:Kr,typed:L,unaryMinus:dt}),oO=$v({concat:Ge,equalScalar:Ze,matrix:ve,multiplyScalar:fr,typed:L}),Xm=Ew({larger:jr,smaller:kr}),ed=P1({Complex:or,DenseMatrix:Pe,ceil:Bo,equalScalar:Ze,floor:Wm,matrix:ve,typed:L,zeros:Mr}),rd=yN({Index:Br,typed:L}),sO=oF({abs:Rr,add:Je,addScalar:yr,config:de,divideScalar:lr,equalScalar:Ze,flatten:ai,isNumeric:an,isZero:st,matrix:ve,multiply:er,multiplyScalar:fr,smaller:kr,subtract:pr,typed:L}),uO=Pv({BigNumber:be,add:Je,config:de,equal:Qr,isInteger:Ur,mod:Gm,smaller:kr,typed:L,xgcd:Lm}),lO=gv({concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),cO=cb({Complex:or,config:de,divideScalar:lr,log:Fo,typed:L}),Oo=sf({config:de,larger:jr,numeric:lt,typed:L}),fO=U2({DenseMatrix:Pe,Index:Br,compareNatural:gt,size:Er,subset:$r,typed:L}),pO=Z2({DenseMatrix:Pe,Index:Br,compareNatural:gt,size:Er,subset:$r,typed:L}),mO=G2({Index:Br,compareNatural:gt,size:Er,subset:$r,typed:L}),dO=X2({Index:Br,compareNatural:gt,size:Er,subset:$r,typed:L}),In=Qb({DenseMatrix:Pe,concat:Ge,config:de,matrix:ve,typed:L}),hO=dw({compare:on,compareNatural:gt,matrix:ve,typed:L}),gO=Qc({concat:Ge,equalScalar:Ze,matrix:ve,not:ha,typed:L,zeros:Mr}),zn=oc({bignumber:qr,matrix:ve,add:Je,config:de,isPositive:tn,larger:jr,largerEq:va,smaller:kr,smallerEq:In,typed:L}),vO=fc({Index:Br,matrix:ve,range:zn,typed:L}),td=H2({DenseMatrix:Pe,Index:Br,compareNatural:gt,size:Er,subset:$r,typed:L}),yO=K2({Index:Br,compareNatural:gt,size:Er,subset:$r,typed:L}),nd=nN({Index:Br,concat:Ge,setDifference:td,size:Er,subset:$r,typed:L}),id=Fw({FibonacciHeap:Xm,addScalar:yr,equalScalar:Ze}),ad=$l({Index:Br,matrix:ve,range:zn,typed:L}),sn=z3({abs:Rr,addScalar:yr,det:Qm,divideScalar:lr,identity:Ut,matrix:ve,multiply:er,typed:L,unaryMinus:dt}),od=xD({DenseMatrix:Pe,Spa:id,SparseMatrix:St,abs:Rr,addScalar:yr,divideScalar:lr,equalScalar:Ze,larger:jr,matrix:ve,multiplyScalar:fr,subtractScalar:Kr,typed:L,unaryMinus:dt}),xO=q3({Complex:or,add:Je,ctranspose:Do,deepEqual:So,divideScalar:lr,dot:ya,dotDivide:ii,equal:Qr,inv:sn,matrix:ve,multiply:er,typed:L}),Xr=ib({Complex:or,config:de,fraction:_n,identity:Ut,inv:sn,matrix:ve,multiply:er,number:Mt,typed:L}),sd=W2({DenseMatrix:Pe,Index:Br,compareNatural:gt,size:Er,subset:$r,typed:L}),bO=aN({Index:Br,concat:Ge,setIntersect:sd,setSymDifference:nd,size:Er,subset:$r,typed:L}),wO=J3({abs:Rr,add:Je,identity:Ut,inv:sn,map:nn,max:Oo,multiply:er,size:Er,sqrt:ut,subtract:pr,typed:L}),Te=Iw({BigNumber:be,Complex:or,Fraction:en,abs:Rr,addScalar:yr,config:de,divideScalar:lr,equal:Qr,fix:ed,format:ri,isNumeric:an,multiplyScalar:fr,number:Mt,pow:Xr,round:ht,subtractScalar:Kr}),NO=p4({BigNumber:be,Unit:Te,config:de}),DO=W4({BigNumber:be,Unit:Te,config:de}),AO=z4({BigNumber:be,Unit:Te,config:de}),EO=h4({BigNumber:be,Unit:Te,config:de}),MO=q4({BigNumber:be,Unit:Te,config:de}),SO=g4({BigNumber:be,Unit:Te,config:de}),FO=m4({BigNumber:be,Unit:Te,config:de}),CO=F4({BigNumber:be,Unit:Te,config:de}),BO=db({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,pow:Xr,typed:L}),OO=f4({BigNumber:be,Unit:Te,config:de}),TO=d4({BigNumber:be,Unit:Te,config:de}),_O=$3({abs:Rr,add:Je,identity:Ut,inv:sn,multiply:er,typed:L}),IO=k4({BigNumber:be,Unit:Te,config:de}),ud=yx({addScalar:yr,ceil:Bo,conj:rn,divideScalar:lr,dotDivide:ii,exp:Rm,i:Tm,log2:qm,matrix:ve,multiplyScalar:fr,pow:Xr,tau:Im,typed:L}),To=AF({BigNumber:be,Complex:or,config:de,multiplyScalar:fr,pow:Xr,typed:L}),zO=s4({BigNumber:be,Unit:Te,config:de}),RO=M4({BigNumber:be,Unit:Te,config:de}),qO=bx({conj:rn,dotDivide:ii,fft:ud,typed:L}),kO=b4({BigNumber:be,Unit:Te,config:de}),jO=P4({BigNumber:be,Unit:Te,config:de}),PO=c4({BigNumber:be,Unit:Te,config:de}),UO=Y4({BigNumber:be,Unit:Te,config:de}),LO=L4({BigNumber:be,Unit:Te,config:de}),HO=C4({BigNumber:be,Unit:Te,config:de}),$O=x4({BigNumber:be,Unit:Te,config:de}),ZO=e5({BigNumber:be,Unit:Te,config:de}),JO=K4({BigNumber:be,Unit:Te,config:de}),WO=r5({BigNumber:be,Unit:Te,config:de}),YO=S4({BigNumber:be,Unit:Te,config:de}),GO=B4({BigNumber:be,Unit:Te,config:de}),VO=l4({BigNumber:be,Unit:Te,config:de}),KO=O4({BigNumber:be,Unit:Te,config:de}),QO=Z4({BigNumber:be,Unit:Te,config:de}),XO=o4({BigNumber:be,Unit:Te,config:de}),eT=J4({BigNumber:be,Unit:Te,config:de}),rT=T4({BigNumber:be,Unit:Te,config:de}),tT=R4({BigNumber:be,Unit:Te,config:de}),nT=w4({BigNumber:be,Unit:Te,config:de}),iT=Pw({Unit:Te,typed:L}),wr=rF({divideScalar:lr,equalScalar:Ze,inv:sn,matrix:ve,multiply:er,typed:L}),aT=D4({BigNumber:be,Unit:Te,config:de}),oi=FF({gamma:To,typed:L}),oT=j4({BigNumber:be,Unit:Te,config:de}),sT=V4({BigNumber:be,Unit:Te,config:de}),uT=v4({BigNumber:be,Unit:Te,config:de}),ld=WD({DenseMatrix:Pe,lsolve:Zm,lup:od,matrix:ve,slu:Vm,typed:L,usolve:Mo}),lT=y4({BigNumber:be,Unit:Te,config:de}),cT=G4({BigNumber:be,Unit:Te,config:de}),fT=TF({add:Je,divide:wr,factorial:oi,isInteger:Ur,isPositive:tn,multiply:er,typed:L}),pT=IF({factorial:oi,typed:L}),mT=Q4({BigNumber:be,Unit:Te,config:de}),dT=GD({add:Je,cbrt:Hm,divide:wr,equalScalar:Ze,im:bo,isZero:st,multiply:er,re:wo,sqrt:ut,subtract:pr,typeOf:jm,typed:L,unaryMinus:dt}),hT=rN({compareNatural:gt,typed:L}),gT=Mx({abs:Rr,add:Je,bignumber:qr,divide:wr,isNegative:Pt,isPositive:tn,larger:jr,map:nn,matrix:ve,max:Oo,multiply:er,smaller:kr,subtract:pr,typed:L,unaryMinus:dt}),cd=iC({bignumber:qr,addScalar:yr,combinations:ma,divideScalar:lr,factorial:oi,isInteger:Ur,isNegative:Pt,larger:jr,multiplyScalar:fr,number:Mt,pow:Xr,subtractScalar:Kr,typed:L}),vT=Rw({Unit:Te,typed:L}),yT=oC({addScalar:yr,isInteger:Ur,isNegative:Pt,stirlingS2:cd,typed:L}),fd=L3({abs:Rr,add:Je,addScalar:yr,atan:zm,bignumber:qr,column:ad,complex:da,config:de,cos:yo,diag:$m,divideScalar:lr,dot:ya,equal:Qr,flatten:ai,im:bo,inv:sn,larger:jr,matrix:ve,matrixFromColumns:Ao,multiply:er,multiplyScalar:fr,number:Mt,qr:Eo,re:wo,reshape:Um,sin:ga,size:Er,smaller:kr,sqrt:ut,subtract:pr,typed:L,usolve:Mo,usolveAll:Km}),xT=A4({BigNumber:be,Unit:Te,config:de}),bT=U4({BigNumber:be,Unit:Te,config:de}),wT=BF({divide:wr,dotDivide:ii,isNumeric:an,log:Fo,map:nn,matrix:ve,multiply:er,sum:Co,typed:L}),pd=_p({add:Je,divide:wr,typed:L}),NT=H4({BigNumber:be,Unit:Te,config:de}),DT=u4({BigNumber:be,Unit:Te,config:de}),AT=jp({bignumber:qr,add:Je,compare:on,divide:wr,isInteger:Ur,larger:jr,multiply:er,partitionSelect:xa,smaller:kr,smallerEq:In,subtract:pr,typed:L}),_o=qp({add:Je,apply:No,divide:wr,isNaN:ti,multiply:er,subtract:pr,typed:L}),ET=N4({BigNumber:be,Unit:Te,config:de}),md=fF({add:Je,compare:on,divide:wr,partitionSelect:xa,typed:L}),MT=yF({add:Je,divide:wr,matrix:ve,mean:pd,multiply:er,pow:Xr,sqrt:ut,subtract:pr,sum:Co,typed:L}),ST=zC({Complex:or,add:Je,divide:wr,matrix:ve,multiply:er,typed:L}),FT=mF({abs:Rr,map:nn,median:md,subtract:pr,typed:L}),CT=Up({map:nn,sqrt:ut,typed:L,variance:_o}),BT=Ix({BigNumber:be,Complex:or,add:Je,config:de,divide:wr,equal:Qr,factorial:oi,gamma:To,isNegative:Pt,multiply:er,pi:go,pow:Xr,sin:ga,smallerEq:In,subtract:pr,typed:L}),Io=fN({abs:Rr,add:Je,conj:rn,ctranspose:Do,eigs:fd,equalScalar:Ze,larger:jr,matrix:ve,multiply:er,pow:Xr,smaller:kr,sqrt:ut,typed:L}),dd=rx({BigNumber:be,DenseMatrix:Pe,SparseMatrix:St,addScalar:yr,config:de,cos:yo,matrix:ve,multiplyScalar:fr,norm:Io,sin:ga,typed:L,unaryMinus:dt}),OT=X4({BigNumber:be,Unit:Te,config:de}),hd=V3({identity:Ut,matrix:ve,multiply:er,norm:Io,qr:Eo,subtract:pr,typed:L}),TT=Xy({multiply:er,rotationMatrix:dd,typed:L}),gd=Y3({abs:Rr,add:Je,concat:Ge,identity:Ut,index:rd,lusolve:ld,matrix:ve,matrixFromColumns:Ao,multiply:er,range:zn,schur:hd,subset:$r,subtract:pr,transpose:ni,typed:L}),_T=Q3({matrix:ve,multiply:er,sylvester:gd,transpose:ni,typed:L}),Rn={},qn={},vd={},Or=wN({mathWithTransform:qn}),kn=WN({Node:Or}),Ft=GN({Node:Or}),un=KN({Node:Or}),yd=rD({Node:Or}),jn=EN({Node:Or}),xd=ON({Node:Or,ResultSet:_m}),bd=_N({Node:Or}),Lt=UN({Node:Or}),wd=XN({Node:Or}),IT=kC({classes:vd}),zo=rA({math:Rn,typed:L}),Nd=HN({Node:Or,typed:L}),Dd=O3({Chain:zo,typed:L}),Pn=ZN({Node:Or,size:Er}),Un=DN({Node:Or,subset:$r}),Ad=CN({matrix:ve,Node:Or,subset:$r}),Ht=iD({Unit:Te,Node:Or,math:Rn}),$t=oD({Node:Or,SymbolNode:Ht,math:Rn}),vt=uD({AccessorNode:Un,ArrayNode:jn,AssignmentNode:Ad,BlockNode:xd,ConditionalNode:bd,ConstantNode:Lt,FunctionAssignmentNode:Nd,FunctionNode:$t,IndexNode:Pn,ObjectNode:kn,OperatorNode:Ft,ParenthesisNode:un,RangeNode:wd,RelationalNode:yd,SymbolNode:Ht,config:de,numeric:lt,typed:L}),Ed=EC({ConstantNode:Lt,FunctionNode:$t,OperatorNode:Ft,ParenthesisNode:un,parse:vt,typed:L}),Ro=bC({bignumber:qr,fraction:_n,AccessorNode:Un,ArrayNode:jn,ConstantNode:Lt,FunctionNode:$t,IndexNode:Pn,ObjectNode:kn,OperatorNode:Ft,SymbolNode:Ht,config:de,mathWithTransform:qn,matrix:ve,typed:L}),zT=cD({parse:vt,typed:L}),qo=NC({AccessorNode:Un,ArrayNode:jn,ConstantNode:Lt,FunctionNode:$t,IndexNode:Pn,ObjectNode:kn,OperatorNode:Ft,ParenthesisNode:un,SymbolNode:Ht,add:Je,divide:wr,equal:Qr,isZero:st,multiply:er,parse:vt,pow:Xr,subtract:pr,typed:L}),ko=pD({parse:vt,typed:L}),Md=QD({evaluate:ko}),Sd=hD({evaluate:ko}),ba=vC({bignumber:qr,fraction:_n,AccessorNode:Un,ArrayNode:jn,ConstantNode:Lt,FunctionNode:$t,IndexNode:Pn,ObjectNode:kn,OperatorNode:Ft,ParenthesisNode:un,SymbolNode:Ht,add:Je,config:de,divide:wr,equal:Qr,isZero:st,mathWithTransform:qn,matrix:ve,multiply:er,parse:vt,pow:Xr,resolve:Ed,simplifyConstant:Ro,simplifyCore:qo,subtract:pr,typed:L}),RT=SC({OperatorNode:Ft,parse:vt,simplify:ba,typed:L}),qT=pC({parse:vt,typed:L}),kT=vD({Parser:Sd,typed:L}),jT=OC({bignumber:qr,fraction:_n,AccessorNode:Un,ArrayNode:jn,ConstantNode:Lt,FunctionNode:$t,IndexNode:Pn,ObjectNode:kn,OperatorNode:Ft,ParenthesisNode:un,SymbolNode:Ht,add:Je,config:de,divide:wr,equal:Qr,isZero:st,mathWithTransform:qn,matrix:ve,multiply:er,parse:vt,pow:Xr,simplify:ba,simplifyConstant:Ro,simplifyCore:qo,subtract:pr,typed:L}),PT=CC({ConstantNode:Lt,FunctionNode:$t,OperatorNode:Ft,ParenthesisNode:un,SymbolNode:Ht,config:de,equal:Qr,isZero:st,numeric:lt,parse:vt,simplify:ba,typed:L}),UT=C3({Help:Md,mathWithTransform:qn,typed:L});dr(Rn,{e:Om,false:hB,fineStructure:gB,i:Tm,Infinity:vB,LN10:yB,LOG10E:xB,NaN:bB,null:wB,phi:NB,SQRT1_2:AB,sackurTetrode:EB,tau:Im,true:MB,E:Om,version:SB,efimovFactor:FB,LN2:CB,pi:go,replacer:BB,reviver:IT,SQRT2:OB,typed:L,unaryPlus:vo,PI:go,weakMixingAngle:TB,abs:Rr,acos:_B,acot:IB,acsc:zB,addScalar:yr,arg:RB,asech:qB,asinh:kB,atan:zm,atanh:jB,bignumber:qr,bitNot:PB,boolean:UB,clone:LB,combinations:ma,complex:da,conj:rn,cos:yo,cot:HB,csc:$B,cube:ZB,equalScalar:Ze,erf:JB,exp:Rm,expm1:WB,filter:YB,forEach:GB,format:ri,getMatrixDataType:xo,hex:VB,im:bo,isInteger:Ur,isNegative:Pt,isPositive:tn,isZero:st,LOG2E:KB,lgamma:QB,log10:XB,log2:qm,map:nn,multiplyScalar:fr,not:ha,number:Mt,oct:e8,pickRandom:r8,print:t8,random:n8,re:wo,sec:i8,sign:km,sin:ga,splitUnit:a8,square:o8,string:s8,subtractScalar:Kr,tan:u8,typeOf:jm,acosh:l8,acsch:c8,apply:No,asec:f8,bin:p8,chain:Dd,combinationsWithRep:m8,cosh:d8,csch:h8,isNaN:ti,isPrime:g8,randomInt:v8,sech:y8,sinh:x8,sparse:b8,sqrt:ut,tanh:w8,unaryMinus:dt,acoth:N8,coth:D8,fraction:_n,isNumeric:an,matrix:ve,matrixFromFunction:A8,mode:E8,numeric:lt,prod:Pm,reshape:Um,size:Er,squeeze:M8,transpose:ni,xgcd:Lm,zeros:Mr,asin:S8,cbrt:Hm,concat:Ge,count:F8,ctranspose:Do,diag:$m,divideScalar:lr,dotDivide:ii,equal:Qr,flatten:ai,hasNumericValue:C8,identity:Ut,kron:B8,largerEq:va,leftShift:O8,lsolve:Zm,matrixFromColumns:Ao,nthRoot:T8,ones:_8,qr:Eo,resize:I8,rightArithShift:z8,round:ht,smaller:kr,subtract:pr,to:R8,unequal:q8,usolve:Mo,xor:k8,add:Je,atan2:j8,bitAnd:P8,bitOr:U8,bitXor:L8,catalan:H8,compare:on,compareText:Jm,cumsum:$8,deepEqual:So,diff:Z8,distance:J8,dot:ya,equalText:W8,floor:Wm,gcd:Y8,hypot:G8,larger:jr,log:Fo,lsolveAll:V8,matrixFromRows:K8,min:Q8,mod:Gm,multiply:er,nthRoots:X8,or:eO,partitionSelect:xa,rightLogShift:rO,slu:Vm,subset:$r,sum:Co,trace:tO,usolveAll:Km,zpk2tf:nO,ceil:Bo,compareNatural:gt,composition:iO,cross:aO,det:Qm,dotMultiply:oO,fix:ed,index:rd,intersect:sO,invmod:uO,lcm:lO,log1p:cO,max:Oo,setCartesian:fO,setDistinct:pO,setIsSubset:mO,setPowerset:dO,smallerEq:In,sort:hO,and:gO,range:zn,row:vO,setDifference:td,setMultiplicity:yO,setSymDifference:nd,column:ad,inv:sn,lup:od,pinv:xO,pow:Xr,setIntersect:sd,setUnion:bO,sqrtm:wO,vacuumImpedance:NO,wienDisplacement:DO,atomicMass:AO,bohrMagneton:EO,boltzmann:MO,conductanceQuantum:SO,coulomb:FO,deuteronMass:CO,dotPow:BO,electricConstant:OO,elementaryCharge:TO,expm:_O,faraday:IO,fft:ud,gamma:To,gravitationConstant:zO,hartreeEnergy:RO,ifft:qO,klitzing:kO,loschmidt:jO,magneticConstant:PO,molarMass:UO,molarPlanckConstant:LO,neutronMass:HO,nuclearMagneton:$O,planckCharge:ZO,planckLength:JO,planckTemperature:WO,protonMass:YO,quantumOfCirculation:GO,reducedPlanckConstant:VO,rydberg:KO,secondRadiation:QO,speedOfLight:XO,stefanBoltzmann:eT,thomsonCrossSection:rT,avogadro:tT,bohrRadius:nT,createUnit:iT,divide:wr,electronMass:aT,factorial:oi,firstRadiation:oT,gravity:sT,inverseConductanceQuantum:uT,lusolve:ld,magneticFluxQuantum:lT,molarMassC12:cT,multinomial:fT,parse:vt,permutations:pT,planckMass:mT,polynomialRoot:dT,resolve:Ed,setSize:hT,simplifyConstant:Ro,solveODE:gT,stirlingS2:cd,unit:vT,bellNumbers:yT,compile:zT,eigs:fd,fermiCoupling:xT,gasConstant:bT,kldivergence:wT,mean:pd,molarVolume:NT,planckConstant:DT,quantileSeq:AT,simplifyCore:qo,variance:_o,classicalElectronRadius:ET,evaluate:ko,median:md,simplify:ba,symbolicEqual:RT,corr:MT,freqz:ST,leafCount:qT,mad:FT,parser:kT,rationalize:jT,std:CT,zeta:BT,derivative:PT,norm:Io,rotationMatrix:dd,help:UT,planckTime:OT,schur:hd,rotate:TT,sylvester:gd,lyap:_T,config:de}),dr(qn,Rn,{filter:c5({typed:L}),forEach:m5({typed:L}),map:x5({typed:L}),apply:i5({isInteger:Ur,typed:L}),or:uB({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),and:aB({add:Je,concat:Ge,equalScalar:Ze,matrix:ve,not:ha,typed:L,zeros:Mr}),concat:P5({isInteger:Ur,matrix:ve,typed:L}),max:N5({config:de,larger:jr,numeric:lt,typed:L}),print:tB({add:Je,matrix:ve,typed:L,zeros:Mr}),bitAnd:fB({add:Je,concat:Ge,equalScalar:Ze,matrix:ve,not:ha,typed:L,zeros:Mr}),diff:L5({bignumber:qr,matrix:ve,number:Mt,subtract:pr,typed:L}),min:F5({config:de,numeric:lt,smaller:kr,typed:L}),subset:q5({add:Je,matrix:ve,typed:L,zeros:Mr}),bitOr:dB({DenseMatrix:Pe,concat:Ge,equalScalar:Ze,matrix:ve,typed:L}),cumsum:Q5({add:Je,typed:L,unaryPlus:vo}),index:g5({Index:Br,getMatrixDataType:xo}),sum:W5({add:Je,config:de,numeric:lt,typed:L}),range:O5({bignumber:qr,matrix:ve,add:Je,config:de,isPositive:tn,larger:jr,largerEq:va,smaller:kr,smallerEq:In,typed:L}),row:I5({Index:Br,matrix:ve,range:zn,typed:L}),column:s5({Index:Br,matrix:ve,range:zn,typed:L}),mean:E5({add:Je,divide:wr,typed:L}),quantileSeq:V5({add:Je,bignumber:qr,compare:on,divide:wr,isInteger:Ur,larger:jr,multiply:er,partitionSelect:xa,smaller:kr,smallerEq:In,subtract:pr,typed:L}),variance:eB({add:Je,apply:No,divide:wr,isNaN:ti,multiply:er,subtract:pr,typed:L}),std:Z5({map:nn,sqrt:ut,typed:L,variance:_o})}),dr(vd,{BigNumber:be,Complex:or,Fraction:en,Matrix:pa,Node:Or,ObjectNode:kn,OperatorNode:Ft,ParenthesisNode:un,Range:DB,RelationalNode:yd,ResultSet:_m,ArrayNode:jn,BlockNode:xd,ConditionalNode:bd,ConstantNode:Lt,DenseMatrix:Pe,RangeNode:wd,Chain:zo,FunctionAssignmentNode:Nd,SparseMatrix:St,IndexNode:Pn,ImmutableDenseMatrix:Ym,Index:Br,AccessorNode:Un,AssignmentNode:Ad,FibonacciHeap:Xm,Spa:id,Unit:Te,SymbolNode:Ht,FunctionNode:$t,Help:Md,Parser:Sd}),zo.createProxy(Rn);const wa=(e,r)=>{let n=Dd(qr(r[0]));for(let t=1;t<r.length;t++){let i=Number(r[t]);i.toString()==="NaN"&&(i=0),n=n[e](qr(i))}return parseFloat(n.done())},LT={round:(e,r=2)=>{let n=Number(e);return n.toString()==="NaN"&&(n=0),ht(n,r)},add:function(...e){return wa("add",e)},subtract:function(...e){return wa("subtract",e)},multiply:function(...e){return wa("multiply",e)},divide:function(...e){return wa("divide",e)},formatValue:(e,r=2)=>{let n=Number(e);return n.toString()==="NaN"&&(n=0),n>=1e8?`${ht(n/1e8,r)}亿`:n>=1e4?`${ht(n/1e4,r)}万`:ht(n,r)}};class HT{constructor(r={}){Zt(this,"option",{reconnectTime:5e3,heartCheck:!0,heartTime:1e4,heartSendMsg:"check",heartCheckMsg:"success",needJsonParse:!0}),Zt(this,"heartTimer"),Zt(this,"isHeartCheck",!0),Zt(this,"url",""),Zt(this,"socketIns"),Zt(this,"onEvent",{}),Zt(this,"isReconnect",!1),this.option={...this.option,...r}}connect(r){return this.url=r,this.socketIns=new WebSocket(r),this.addEventListener(),this.startHeartCheck(),this.socketIns}reconnect(){if(this.isReconnect===!0)return;this.isReconnect=!0;const r=setTimeout(()=>{this.stopHeartCheck(),this.socketIns=new WebSocket(this.url),this.addEventListener(),this.startHeartCheck(),typeof this.onEvent.reconnect=="function"&&this.onEvent.reconnect(),this.isReconnect=!1,clearTimeout(r)},this.option.reconnectTime)}on(r,n){this.onEvent[r]=n}send(r){this.socketIns.send(r)}close(){this.stopHeartCheck(),this.socketIns.close()}addEventListener(){const{heartCheckMsg:r,needJsonParse:n}=this.option;this.socketIns.onopen=t=>{typeof this.onEvent.open=="function"&&this.onEvent.open(t)},this.socketIns.onclose=t=>{t.code===1006?this.reconnect():typeof this.onEvent.close=="function"&&this.onEvent.close(t)},this.socketIns.onerror=t=>{typeof this.onEvent.error=="function"&&this.onEvent.error(t),this.reconnect()},this.socketIns.onmessage=t=>{if(t.data===r){this.isHeartCheck=!0;return}try{typeof this.onEvent.message=="function"&&this.onEvent.message(n?JSON.parse(t.data):t.data)}catch(i){console.error("websocket相应数据格式异常",i)}}}startHeartCheck(){const{heartTime:r,heartSendMsg:n}=this.option;this.heartTimer=setInterval(()=>{if(this.isHeartCheck===!1){this.reconnect(),clearInterval(this.heartTimer);return}this.isHeartCheck=!1,this.send(n)},r)}stopHeartCheck(){clearInterval(this.heartTimer)}}const $T={init:e=>new HT(e)},ZT=Bd,JT=Od,WT=Td,YT=Rd,GT=qd,VT=LT,KT=$T,QT={};ct.default=QT,ct.getStorage=JT,ct.mainIndicatorList=YT,ct.removeStorage=WT,ct.setStorage=ZT,ct.stMath=VT,ct.stWebsocket=KT,ct.subIndicatorList=GT,Object.defineProperties(ct,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})})(Uo,Uo.exports);var M6=Uo.exports;exports.bundle_umdExports=M6;