@perses-dev/table-plugin 0.10.0 → 0.11.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/__mf/js/Table.048c2e60.js +6 -0
  2. package/__mf/js/async/1117.87be49e9.js +2 -0
  3. package/__mf/js/async/1432.4dcbe7e3.js +1 -0
  4. package/__mf/js/async/1490.08a726d9.js +22 -0
  5. package/__mf/js/async/1616.7a74f4ef.js +1 -0
  6. package/__mf/js/async/2043.fdebf89c.js +2 -0
  7. package/__mf/js/async/2473.2c502914.js +1 -0
  8. package/__mf/js/async/3827.1b39b042.js +38 -0
  9. package/__mf/js/async/3919.1085fa1d.js +7 -0
  10. package/__mf/js/async/392.c2307fe5.js +2 -0
  11. package/__mf/js/async/{1964.ad4fb2b0.js → 4121.8e97ef88.js} +2 -2
  12. package/__mf/js/async/4761.08da9107.js +1 -0
  13. package/__mf/js/async/{2651.4ede9028.js → 5002.3189d214.js} +1 -1
  14. package/__mf/js/async/{1640.c1ed5a05.js → 5019.5318688a.js} +1 -1
  15. package/__mf/js/async/5071.91e1c002.js +1 -0
  16. package/__mf/js/async/5501.bdb9a707.js +1 -0
  17. package/__mf/js/async/{5214.00911b97.js → 5587.f5f2b0cc.js} +1 -1
  18. package/__mf/js/async/6274.14683c28.js +2 -0
  19. package/__mf/js/async/6283.e044c368.js +2 -0
  20. package/__mf/js/async/6753.032ce611.js +1 -0
  21. package/__mf/js/async/7142.5d923107.js +1 -0
  22. package/__mf/js/async/7177.356298ae.js +1 -0
  23. package/__mf/js/async/7192.66c9e3a5.js +1 -0
  24. package/__mf/js/async/7417.86d0bc09.js +1 -0
  25. package/__mf/js/async/7968.a66bfadb.js +1 -0
  26. package/__mf/js/async/7978.a19f5a4f.js +1 -0
  27. package/__mf/js/async/8356.8ae40b6a.js +1 -0
  28. package/__mf/js/async/8470.1b8b20ff.js +2 -0
  29. package/__mf/js/async/868.9f710584.js +110 -0
  30. package/__mf/js/async/8728.546704f2.js +1 -0
  31. package/__mf/js/async/873.a7310675.js +1 -0
  32. package/__mf/js/async/9235.eee50e10.js +1 -0
  33. package/__mf/js/async/941.333875f4.js +2 -0
  34. package/__mf/js/async/9588.7b021071.js +1 -0
  35. package/__mf/js/async/__federation_expose_Table.d6cfbcd9.js +1 -0
  36. package/__mf/js/async/lib-router.8fd59130.js +2 -0
  37. package/__mf/js/main.10849b01.js +6 -0
  38. package/lib/bootstrap.js +1 -1
  39. package/lib/bootstrap.js.map +1 -1
  40. package/lib/cjs/components/ConditionalPanel.js +3 -3
  41. package/lib/cjs/components/TablePanel.js +33 -14
  42. package/lib/cjs/index-federation.js +12 -12
  43. package/lib/cjs/models/table-model.js +6 -6
  44. package/lib/cjs/test/mock-query-results.js +7 -7
  45. package/lib/components/ColumnsEditor/ColumnEditor.js +1 -1
  46. package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -1
  47. package/lib/components/ColumnsEditor/ColumnEditorContainer.js +1 -1
  48. package/lib/components/ColumnsEditor/ColumnEditorContainer.js.map +1 -1
  49. package/lib/components/ColumnsEditor/ColumnsEditor.js +1 -1
  50. package/lib/components/ColumnsEditor/ColumnsEditor.js.map +1 -1
  51. package/lib/components/TablePanel.d.ts.map +1 -1
  52. package/lib/components/TablePanel.js +31 -12
  53. package/lib/components/TablePanel.js.map +1 -1
  54. package/lib/components/TableSettingsEditor.js +1 -1
  55. package/lib/components/TableSettingsEditor.js.map +1 -1
  56. package/lib/components/TableTransformsEditor.js +1 -1
  57. package/lib/components/TableTransformsEditor.js.map +1 -1
  58. package/mf-manifest.json +44 -44
  59. package/mf-stats.json +44 -44
  60. package/package.json +5 -5
  61. package/__mf/js/Table.02a0172e.js +0 -5
  62. package/__mf/js/async/1143.68727fe6.js +0 -1
  63. package/__mf/js/async/2178.23b43aaf.js +0 -1
  64. package/__mf/js/async/2292.12f77288.js +0 -2
  65. package/__mf/js/async/2472.d6b3b5c6.js +0 -22
  66. package/__mf/js/async/2849.0d68beb5.js +0 -2
  67. package/__mf/js/async/2854.fc0ce4ac.js +0 -110
  68. package/__mf/js/async/3224.5efdac43.js +0 -1
  69. package/__mf/js/async/3863.5ed15409.js +0 -2
  70. package/__mf/js/async/3960.ad46df53.js +0 -2
  71. package/__mf/js/async/3980.17fb5371.js +0 -2
  72. package/__mf/js/async/4075.98f26cf8.js +0 -1
  73. package/__mf/js/async/4238.8989501f.js +0 -1
  74. package/__mf/js/async/4483.b6379137.js +0 -1
  75. package/__mf/js/async/5409.524589b2.js +0 -1
  76. package/__mf/js/async/5981.91033d82.js +0 -2
  77. package/__mf/js/async/6284.5f775177.js +0 -1
  78. package/__mf/js/async/6292.c204d39b.js +0 -1
  79. package/__mf/js/async/6377.1f2ba730.js +0 -38
  80. package/__mf/js/async/6770.94607b71.js +0 -1
  81. package/__mf/js/async/694.20d8be37.js +0 -1
  82. package/__mf/js/async/738.3929068d.js +0 -1
  83. package/__mf/js/async/7740.4fee7abb.js +0 -1
  84. package/__mf/js/async/8488.9f177839.js +0 -1
  85. package/__mf/js/async/8599.4f1f88c0.js +0 -1
  86. package/__mf/js/async/9010.aaf984f3.js +0 -1
  87. package/__mf/js/async/9173.c646dd1e.js +0 -2
  88. package/__mf/js/async/9509.1c4313e0.js +0 -1
  89. package/__mf/js/async/9667.211c6bdb.js +0 -1
  90. package/__mf/js/async/9830.a2983642.js +0 -7
  91. package/__mf/js/async/__federation_expose_Table.0dbf0d6d.js +0 -1
  92. package/__mf/js/async/lib-router.f3ef5227.js +0 -2
  93. package/__mf/js/main.f7b12b00.js +0 -5
  94. /package/__mf/css/async/{2341.d3010b86.css → 3061.d3010b86.css} +0 -0
  95. /package/__mf/css/async/{5263.d3010b86.css → 5442.d3010b86.css} +0 -0
  96. /package/__mf/css/async/{6759.d3010b86.css → 7823.d3010b86.css} +0 -0
  97. /package/__mf/js/async/{2849.0d68beb5.js.LICENSE.txt → 1117.87be49e9.js.LICENSE.txt} +0 -0
  98. /package/__mf/js/async/{2472.d6b3b5c6.js.LICENSE.txt → 1490.08a726d9.js.LICENSE.txt} +0 -0
  99. /package/__mf/js/async/{2292.12f77288.js.LICENSE.txt → 2043.fdebf89c.js.LICENSE.txt} +0 -0
  100. /package/__mf/js/async/{9830.a2983642.js.LICENSE.txt → 3919.1085fa1d.js.LICENSE.txt} +0 -0
  101. /package/__mf/js/async/{5981.91033d82.js.LICENSE.txt → 392.c2307fe5.js.LICENSE.txt} +0 -0
  102. /package/__mf/js/async/{1964.ad4fb2b0.js.LICENSE.txt → 4121.8e97ef88.js.LICENSE.txt} +0 -0
  103. /package/__mf/js/async/{3960.ad46df53.js.LICENSE.txt → 6274.14683c28.js.LICENSE.txt} +0 -0
  104. /package/__mf/js/async/{3980.17fb5371.js.LICENSE.txt → 6283.e044c368.js.LICENSE.txt} +0 -0
  105. /package/__mf/js/async/{9173.c646dd1e.js.LICENSE.txt → 8470.1b8b20ff.js.LICENSE.txt} +0 -0
  106. /package/__mf/js/async/{2854.fc0ce4ac.js.LICENSE.txt → 868.9f710584.js.LICENSE.txt} +0 -0
  107. /package/__mf/js/async/{3863.5ed15409.js.LICENSE.txt → 941.333875f4.js.LICENSE.txt} +0 -0
  108. /package/__mf/js/async/{lib-router.f3ef5227.js.LICENSE.txt → lib-router.8fd59130.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- /*! For license information please see 2849.0d68beb5.js.LICENSE.txt */
2
- (self.chunk_Table=self.chunk_Table||[]).push([["2849"],{67260:function(e,t,r){"use strict";let n;r.r(t),r.d(t,{DEFAULT_CALCULATION:()=>c,KINDS:()=>p,legendModes:()=>g,msToPrometheusDuration:()=>U,isBytesUnit:()=>eJ,panelSpecSchema:()=>r8,oauthProvidersSchema:()=>nw,globalSecretSchema:()=>ny,MAX_SIGNIFICANT_DIGITS:()=>eC,buildPanelSpecSchema:()=>ne,isUnitWithDecimalPlaces:()=>eY,roleBindingSpecSchema:()=>nf,shouldShortenValues:()=>Y,formatValue:()=>eU,variableListSchema:()=>nE,subjectSchema:()=>nl,variableDisplaySchema:()=>nN,buildVariableSpecSchema:()=>nC,buildVariableListSchema:()=>nk,getCalculations:()=>d,pluginSchema:()=>rJ,createRegexFromString:()=>oI,buildPanelDefinitionSchema:()=>nr,getUnitGroupConfig:()=>eG,applyMergeSeriesTransform:()=>oT,MIN_STEP_INTERVAL_MS:()=>oS,isDecimalUnit:()=>eH,fetchJson:()=>nZ,isCurrencyUnit:()=>e0,isRegexPattern:()=>oj,linkSchema:()=>r6,nativeProviderSchema:()=>nb,userSpecSchema:()=>n_,DURATION_REGEX:()=>z,getTimeSeriesValues:()=>oM,roundStepInterval:()=>G,secretSchema:()=>ng,variablesSchema:()=>nD,buildVariableDefinitionSchema:()=>nR,datasourceDefinitionSchema:()=>r4,isValidLegendPosition:()=>v,variableSchema:()=>nj,otlptracev1:()=>s,datasourceSpecSchema:()=>rX,FetchError:()=>nz,projectMetadataSchema:()=>rH,UNIT_CONFIG:()=>eL,UserFriendlyError:()=>n$,isDurationString:()=>B,secretsEditorSchema:()=>nv,isValidLegendSize:()=>w,variableDefinitionSchema:()=>nF,buildDatasourceSpecSchema:()=>rQ,isProjectMetadata:()=>T,formatDuration:()=>V,legendPositions:()=>m,secretSpecSchema:()=>nm,isPercentUnit:()=>eK,limitDecimalPlaces:()=>Q,getSuggestedStepMs:()=>W,legendSizes:()=>y,panelDefinitionSchema:()=>nt,buildPanelEditorSchema:()=>ni,getResourceDisplayName:()=>nq,isTimeSeriesValueTuple:()=>K,isValidTraceId:()=>H,roleBindingSchema:()=>nd,roleSpecSchema:()=>ns,rolesEditorSchema:()=>nc,isUnitWithShortValues:()=>eX,CalculationsMap:()=>l,parseDurationString:()=>$,getCommonTimeScale:()=>oE,otlpresourcev1:()=>a,toAbsoluteTimeRange:()=>Z,isAbsoluteTimeRange:()=>P,UNIT_GROUP_CONFIG:()=>eB,getUnitConfig:()=>eV,applyValueMapping:()=>oD,durationValidationSchema:()=>r5,globalRoleSchema:()=>nu,metadataSchema:()=>rK,getLegendSize:()=>S,globalVariableSchema:()=>nI,fetch:()=>nP,querySpecSchema:()=>r7,isRelativeTimeRange:()=>R,getVariableProject:()=>e1,nameSchema:()=>rW,roleSchema:()=>no,resolvePanelRef:()=>nL,createPanelRef:()=>nV,otlpcommonv1:()=>i,getPanelKeyFromRef:()=>nU,getMetadataProject:()=>C,roleBindingsEditorSchema:()=>np,getUnitGroup:()=>eq,userSchema:()=>nx,GLOBAL_SCOPES:()=>D,DEFAULT_LEGEND:()=>_,datasourceSchema:()=>r0,buildDatasourceDefinitionSchema:()=>r9,ACTIONS:()=>j,hasDecimalPlaces:()=>X,displaySchema:()=>rY,variableSpecSchema:()=>nT,intervalToPrometheusDuration:()=>L,PROJECT_SCOPES:()=>I,isEmptyObject:()=>nB,applyMergeColumnsTransform:()=>oO,transformData:()=>oC,CALCULATIONS_CONFIG:()=>f,buildVariableListSpecSchema:()=>nM,applyJoinTransform:()=>ok,isThroughputUnit:()=>eQ,getLegendPosition:()=>x,DEFAULT_REFRESH_INTERVAL:()=>u,getCalculation:()=>h,panelEditorSchema:()=>nn,isPanelGroupItemIdEqual:()=>O,variableTextSpecSchema:()=>nO,DEFAULT_DASHBOARD_DURATION:()=>o,panelDisplaySpec:()=>r3,permissionSchema:()=>na,DEFAULT_ALL_VALUE:()=>e2,variableTextSchema:()=>nA,TRANSFORM_TEXT:()=>J,getLegendMode:()=>N,isValidQueryPluginType:()=>A,datasourcesSchema:()=>r2,getResourceExtendedDisplayName:()=>nG,isTimeUnit:()=>eW,applyMergeIndexedColumnsTransform:()=>oA,globalDatasourceSchema:()=>r1,globalRoleBindingSchema:()=>nh,isValidLegendMode:()=>b,variableListSpecSchema:()=>nS});var i={};r.r(i);var a={};r.r(a);var s={};r.r(s),r.d(s,{StatusCodeError:()=>k,StatusCodeOk:()=>E,StatusCodeUnset:()=>M});let o="1h",u="0s",c="last",l={first:function(e){return h(e,"first")},last:function(e){return h(e,"last")},"first-number":function(e){return h(e,"first-number")},"last-number":function(e){return h(e,"last-number")},mean:function(e){return h(e,"mean")},sum:function(e){return h(e,"sum")},min:function(e){return h(e,"min")},max:function(e){return h(e,"max")}},f={first:{label:"First",description:"First value"},last:{label:"Last",description:"Last value"},"first-number":{label:"First *",description:"First numeric value"},"last-number":{label:"Last *",description:"Last numeric value"},mean:{label:"Avg",description:"Average value excluding nulls"},sum:{label:"Sum",description:"The sum of all values"},min:{label:"Min",description:"Minimum value"},max:{label:"Max",description:"Maximum value"}};function d(e,t){let r=t.reduce((e,t)=>(e[t]=void 0,e),{}),n=0,i=0;return e.forEach((t,a)=>{let s=t[1];0===a&&"first"in r&&(r.first=s),a===e.length-1&&"last"in r&&(r.last=s),"number"==typeof s&&(n+=1,i+=s,"first-number"in r&&void 0===r["first-number"]&&(r["first-number"]=s),"last-number"in r&&(r["last-number"]=s),"min"in r&&("number"!=typeof r.min?r.min=s:r.min=Math.min(r.min,s)),"max"in r&&("number"!=typeof r.max?r.max=s:r.max=Math.max(r.max,s)))}),n>0&&"sum"in r&&(r.sum=i),n>0&&"mean"in r&&(r.mean=i/n),r}function h(e,t){return d(e,[t])[t]}let p=["Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"],m=["bottom","right"],g=["list","table"],y=["small","medium"];function v(e){return m.includes(e)}function b(e){return g.includes(e)}function w(e){return y.includes(e)}let _={position:"bottom",mode:"list",size:"medium"};function x(e){return void 0===e?_.position:v(e)?e:_.position}function N(e){return e&&b(e)?e:_.mode}function S(e){return e&&w(e)?e:_.size}let M="STATUS_CODE_UNSET",E="STATUS_CODE_OK",k="STATUS_CODE_ERROR";function O(e,t){return e?.panelGroupId===t?.panelGroupId&&e?.panelGroupItemLayoutId===t?.panelGroupItemLayoutId}function A(e){return["TimeSeriesQuery","TraceQuery","ProfileQuery"].includes(e)}function T(e){return"project"in e}function C(e){return"project"in e?e.project:void 0}let j=["*","create","read","update","delete"],I=["*","Dashboard","Datasource","EphemeralDashboard","Folder","Project","Role","RoleBinding","Secret","Variable"],D=["GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","User"];var F=r(20461);function R(e){return void 0!==e.pastDuration}function P(e){return void 0!==e.start&&void 0!==e.end}function Z(e){let t=e.end??new Date;return{start:(0,F.sub)(t,$(e.pastDuration)),end:t}}let z=/^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;function $(e){let t=z.exec(e);if(null===t)throw Error(`Invalid duration string '${e}'`);return{years:parseInt(t[1]??"0"),months:0,weeks:parseInt(t[2]??"0"),days:parseInt(t[3]??"0"),hours:parseInt(t[4]??"0"),minutes:parseInt(t[5]??"0"),seconds:parseInt(t[6]??"0")+parseInt(t[7]??"0")/1e3}}function B(e){return""!==e&&z.test(e)}function L(e){return U(e.end.valueOf()-e.start.valueOf())}function U(e){let t=Math.trunc(e/31536e6);t>0&&(e-=31536e6*t);let r=Math.trunc(e/6048e5);r>0&&(e-=6048e5*r);let n=Math.trunc(e/864e5);n>0&&(e-=864e5*n);let i=Math.trunc(e/36e5);i>0&&(e-=36e5*i);let a=Math.trunc(e/6e4);return a>0&&(e-=6e4*a),{years:t,months:0,weeks:r,days:n,hours:i,minutes:a,seconds:e/1e3}}function V(e){let t=[];if(e.years&&t.push(`${e.years}y`),e.weeks&&t.push(`${e.weeks}w`),e.days&&t.push(`${e.days}d`),e.hours&&t.push(`${e.hours}h`),e.minutes&&t.push(`${e.minutes}m`),e.seconds){let r=Math.trunc(e.seconds);r&&t.push(`${r}s`);let n=Math.round((e.seconds-r)*1e3);n&&t.push(`${n}ms`)}return t.join("")}let q=[{maxMs:15,roundedStepMs:10,display:"0.01s"},{maxMs:35,roundedStepMs:20,display:"0.02s"},{maxMs:75,roundedStepMs:50,display:"0.05s"},{maxMs:150,roundedStepMs:100,display:"0.1s"},{maxMs:350,roundedStepMs:200,display:"0.2s"},{maxMs:750,roundedStepMs:500,display:"0.5s"},{maxMs:1500,roundedStepMs:1e3,display:"1s"},{maxMs:3500,roundedStepMs:2e3,display:"2s"},{maxMs:7500,roundedStepMs:5e3,display:"5s"},{maxMs:12500,roundedStepMs:1e4,display:"10s"},{maxMs:17500,roundedStepMs:15e3,display:"15s"},{maxMs:25e3,roundedStepMs:2e4,display:"20s"},{maxMs:45e3,roundedStepMs:3e4,display:"30s"},{maxMs:9e4,roundedStepMs:6e4,display:"1m"},{maxMs:21e4,roundedStepMs:12e4,display:"2m"},{maxMs:45e4,roundedStepMs:3e5,display:"5m"},{maxMs:75e4,roundedStepMs:6e5,display:"10m"},{maxMs:75e4,roundedStepMs:9e5,display:"15m"},{maxMs:15e5,roundedStepMs:12e5,display:"20m"},{maxMs:27e5,roundedStepMs:18e5,display:"30m"},{maxMs:54e5,roundedStepMs:36e5,display:"1h"},{maxMs:9e6,roundedStepMs:72e5,display:"2h"},{maxMs:162e5,roundedStepMs:108e5,display:"3h"},{maxMs:324e5,roundedStepMs:216e5,display:"6h"},{maxMs:864e5,roundedStepMs:432e5,display:"12h"},{maxMs:6048e5,roundedStepMs:864e5,display:"1d"},{maxMs:18144e5,roundedStepMs:6048e5,display:"1w"},{maxMs:36288e5,roundedStepMs:2592e6,display:"30d"},{maxMs:63072e6,roundedStepMs:31536e6,display:"1y"}];function G(e){for(let{maxMs:t,roundedStepMs:r}of q)if(e<t)return r;return 15e3}function W(e,t){return G(Math.floor((e.end.valueOf()-e.start.valueOf())/t))}function K(e){return 2===e.length}function H(e){return/^[0-9a-fA-F]+$/.test(e)}let J={JoinByColumnValue:"Join by column value",MergeColumns:"Merge columns",MergeIndexedColumns:"Merge indexed columns",MergeSeries:"Merge series"};function Y(e){return!1!==e}function X(e){return"number"==typeof e}function Q(e){return e&&(e<0?e=0:e>20&&(e=20)),e}var ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{};function et(){if(as)return aa;as=1;let e=[{key:"ZiB",factor:11805916207174113e5},{key:"ZB",factor:1e21},{key:"YiB",factor:12089258196146292e8},{key:"YB",factor:1e24},{key:"TiB",factor:0x10000000000},{key:"TB",factor:1e12},{key:"PiB",factor:0x4000000000000},{key:"PB",factor:1e15},{key:"MiB",factor:1048576},{key:"MB",factor:1e6},{key:"KiB",factor:1024},{key:"KB",factor:1e3},{key:"GiB",factor:0x40000000},{key:"GB",factor:1e9},{key:"EiB",factor:0x1000000000000000},{key:"EB",factor:1e18},{key:"B",factor:1}];function t(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}return aa={unformat:function(r,n){let i,a=ei(),s=a.currentDelimiters(),o=a.currentCurrency().symbol,u=a.currentOrdinal(),c=a.getZeroFormat(),l=a.currentAbbreviations();if("string"==typeof r)if(function(e,t){if(!(e.indexOf(":")&&":"!==t.thousands))return!1;let r=e.split(":");if(3!==r.length)return!1;let n=+r[0],i=+r[1],a=+r[2];return!isNaN(n)&&!isNaN(i)&&!isNaN(a)}(r,s)){let e,t,n;t=+(e=r.split(":"))[0],n=+e[1],i=+e[2]+60*n+3600*t}else i=function(r,n,i="",a,s,o,u){if(""!==r)return r===s?0:function r(n,i,a,s,o,u,c){if(!isNaN(+n))return+n;let l="",f=n.replace(/(^[^(]*)\((.*)\)([^)]*$)/,"$1$2$3");if(f!==n)return -1*r(f,i,a,s,o,u);for(let t=0;t<e.length;t++){let c=e[t];if((l=n.replace(RegExp(`([0-9 ])(${c.key})$`),"$1"))!==n)return r(l,i,a,s,o,u)*c.factor}if((l=n.replace("%",""))!==n)return r(l,i,a,s,o,u)/100;let d=parseFloat(n);if(isNaN(d))return;let h=s(d);if(h&&"."!==h&&(l=n.replace(RegExp(`${t(h)}$`),""))!==n)return r(l,i,a,s,o,u);let p={};Object.keys(u).forEach(e=>{p[u[e]]=e});let m=Object.keys(p).sort().reverse(),g=m.length;for(let e=0;e<g;e++){let t=m[e],c=p[t];if((l=n.replace(t,""))!==n){let e;switch(c){case"thousand":e=1e3;break;case"million":e=1e6;break;case"billion":e=1e9;break;case"trillion":e=1e12}return r(l,i,a,s,o,u)*e}}}(r.replace(i,"").replace(RegExp(`([0-9])${t(n.thousands)}([0-9])`,"g"),"$1$2").replace(n.decimal,"."),n,i,a,s,o)}(r,s,o,u,c,l);else{if("number"!=typeof r)return;i=r}if(void 0!==i)return i}}}function er(){if(au)return ao;au=1;let e=et(),t=/^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/,r={output:{type:"string",validValues:["currency","percent","byte","time","ordinal","number"]},base:{type:"string",validValues:["decimal","binary","general"],restriction:(e,t)=>"byte"===t.output,message:"`base` must be provided only when the output is `byte`",mandatory:e=>"byte"===e.output},characteristic:{type:"number",restriction:e=>e>=0,message:"value must be positive"},prefix:"string",postfix:"string",forceAverage:{type:"string",validValues:["trillion","billion","million","thousand"]},average:"boolean",lowPrecision:{type:"boolean",restriction:(e,t)=>!0===t.average,message:"`lowPrecision` must be provided only when the option `average` is set"},currencyPosition:{type:"string",validValues:["prefix","infix","postfix"]},currencySymbol:"string",totalLength:{type:"number",restrictions:[{restriction:e=>e>=0,message:"value must be positive"},{restriction:(e,t)=>!t.exponential,message:"`totalLength` is incompatible with `exponential`"}]},mantissa:{type:"number",restriction:e=>e>=0,message:"value must be positive"},optionalMantissa:"boolean",trimMantissa:"boolean",roundingFunction:"function",optionalCharacteristic:"boolean",thousandSeparated:"boolean",spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",spaceSeparatedAbbreviation:"boolean",abbreviations:{type:"object",children:{thousand:"string",million:"string",billion:"string",trillion:"string"}},negative:{type:"string",validValues:["sign","parenthesis"]},forceSign:"boolean",exponential:{type:"boolean"},prefixSymbol:{type:"boolean",restriction:(e,t)=>"percent"===t.output,message:"`prefixSymbol` can be provided only when the output is `percent`"}},n={languageTag:{type:"string",mandatory:!0,restriction:e=>e.match(t),message:"the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)"},delimiters:{type:"object",children:{thousands:"string",decimal:"string",thousandsSize:"number"},mandatory:!0},abbreviations:{type:"object",children:{thousand:{type:"string",mandatory:!0},million:{type:"string",mandatory:!0},billion:{type:"string",mandatory:!0},trillion:{type:"string",mandatory:!0}},mandatory:!0},spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",ordinal:{type:"function",mandatory:!0},bytes:{type:"object",children:{binarySuffixes:"object",decimalSuffixes:"object"}},currency:{type:"object",children:{symbol:"string",position:"string",code:"string"},mandatory:!0},defaults:"format",ordinalFormat:"format",byteFormat:"format",percentageFormat:"format",currencyFormat:"format",timeDefaults:"format",formats:{type:"object",children:{fourDigits:{type:"format",mandatory:!0},fullWithTwoDecimals:{type:"format",mandatory:!0},fullWithTwoDecimalsNoCurrency:{type:"format",mandatory:!0},fullWithNoDecimals:{type:"format",mandatory:!0}}}};function i(t){return void 0!==e.unformat(t)}function a(e,t,n,i=!1){let s=Object.keys(e).map(i=>{if(!t[i])return console.error(`${n} Invalid key: ${i}`),!1;let s=e[i],o=t[i];if("string"==typeof o&&(o={type:o}),"format"===o.type){if(!a(s,r,`[Validate ${i}]`,!0))return!1}else if(typeof s!==o.type)return console.error(`${n} ${i} type mismatched: "${o.type}" expected, "${typeof s}" provided`),!1;if(o.restrictions&&o.restrictions.length){let t=o.restrictions.length;for(let r=0;r<t;r++){let{restriction:t,message:a}=o.restrictions[r];if(!t(s,e))return console.error(`${n} ${i} invalid value: ${a}`),!1}}return o.restriction&&!o.restriction(s,e)?(console.error(`${n} ${i} invalid value: ${o.message}`),!1):o.validValues&&-1===o.validValues.indexOf(s)?(console.error(`${n} ${i} invalid value: must be among ${JSON.stringify(o.validValues)}, "${s}" provided`),!1):(!o.children||!!a(s,o.children,`[Validate ${i}]`))&&!0});return i||s.push(...Object.keys(t).map(r=>{let i=t[r];if("string"==typeof i&&(i={type:i}),i.mandatory){let t=i.mandatory;if("function"==typeof t&&(t=t(e)),t&&void 0===e[r])return console.error(`${n} Missing mandatory key "${r}"`),!1}return!0})),s.reduce((e,t)=>e&&t,!0)}function s(e){return a(e,r,"[Validate format]")}return ao={validate:function(e,t){let r=i(e),n=s(t);return r&&n},validateFormat:s,validateInput:i,validateLanguage:function(e){return a(e,n,"[Validate language]")}}}var en=function(e,t={}){var r,n,i,a,s,o;let u,c,l,f;if("string"!=typeof e)return e;n=e=(u=(r=e).match(/^{([^}]*)}/))?(t.prefix=u[1],r.slice(u[0].length)):r,function(e,t){if(-1!==e.indexOf("$")){t.output="currency";return}if(-1!==e.indexOf("%")){t.output="percent";return}if(-1!==e.indexOf("bd")){t.output="byte",t.base="general";return}if(-1!==e.indexOf("b")){t.output="byte",t.base="binary";return}if(-1!==e.indexOf("d")){t.output="byte",t.base="decimal";return}if(-1!==e.indexOf(":")){t.output="time";return}-1!==e.indexOf("o")&&(t.output="ordinal")}(e=(c=n.match(/{([^}]*)}$/))?(t.postfix=c[1],n.slice(0,-c[0].length)):n,t),(l=e.match(/[1-9]+[0-9]*/))&&(t.totalLength=+l[0]),(f=e.split(".")[0].match(/0+/))&&(t.characteristic=f[0].length),-1!==(i=e).indexOf(".")&&(t.optionalCharacteristic=-1===i.split(".")[0].indexOf("0")),-1!==e.indexOf("a")&&(t.average=!0),-1!==(a=e).indexOf("K")?t.forceAverage="thousand":-1!==a.indexOf("M")?t.forceAverage="million":-1!==a.indexOf("B")?t.forceAverage="billion":-1!==a.indexOf("T")&&(t.forceAverage="trillion");let d=e.split(".")[1];if(d){let e=d.match(/0+/);e&&(t.mantissa=e[0].length)}(s=e).match(/\[\.]/)?t.optionalMantissa=!0:s.match(/\./)&&(t.optionalMantissa=!1);let h=e.split(".")[1];return h&&(t.trimMantissa=-1!==h.indexOf("[")),-1!==e.indexOf(",")&&(t.thousandSeparated=!0),-1!==e.indexOf(" ")&&(t.spaceSeparated=!0,t.spaceSeparatedCurrency=!0,(t.average||t.forceAverage)&&(t.spaceSeparatedAbbreviation=!0)),(o=e).match(/^\+?\([^)]*\)$/)&&(t.negative="parenthesis"),o.match(/^\+?-/)&&(t.negative="sign"),e.match(/^\+/)&&(t.forceSign=!0),t};function ei(){let e;if(al)return ac;al=1;let t=ai?an:(ai=1,an={languageTag:"en-US",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},spaceSeparated:!1,ordinal:function(e){let t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},bytes:{binarySuffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],decimalSuffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},currency:{symbol:"$",position:"prefix",code:"USD"},currencyFormat:{thousandSeparated:!0,totalLength:4,spaceSeparated:!0,spaceSeparatedCurrency:!0},formats:{fourDigits:{totalLength:4,spaceSeparated:!0},fullWithTwoDecimals:{output:"currency",thousandSeparated:!0,mantissa:2},fullWithTwoDecimalsNoCurrency:{thousandSeparated:!0,mantissa:2},fullWithNoDecimals:{output:"currency",thousandSeparated:!0,mantissa:0}}}),r=er(),n={},i={},a=null,s={};function o(){return i[e]}return n.languages=()=>Object.assign({},i),n.currentLanguage=()=>e,n.currentBytes=()=>o().bytes||{},n.currentCurrency=()=>o().currency,n.currentAbbreviations=()=>o().abbreviations,n.currentDelimiters=()=>o().delimiters,n.currentOrdinal=()=>o().ordinal,n.currentDefaults=()=>Object.assign({},o().defaults,s),n.currentOrdinalDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().ordinalFormat),n.currentByteDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().byteFormat),n.currentPercentageDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().percentageFormat),n.currentCurrencyDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().currencyFormat),n.currentTimeDefaultFormat=()=>Object.assign({},n.currentDefaults(),o().timeFormat),n.setDefaults=e=>{e=en(e),r.validateFormat(e)&&(s=e)},n.getZeroFormat=()=>a,n.setZeroFormat=e=>a="string"==typeof e?e:null,n.hasZeroFormat=()=>null!==a,n.languageData=e=>{if(e){if(i[e])return i[e];throw Error(`Unknown tag "${e}"`)}return o()},n.registerLanguage=(t,n=!1)=>{if(!r.validateLanguage(t))throw Error("Invalid language data");i[t.languageTag]=t,n&&(e=t.languageTag)},n.setLanguage=(r,n=t.languageTag)=>{if(!i[r]){let t=r.split("-")[0],a=Object.keys(i).find(e=>e.split("-")[0]===t);return i[a]?void(e=a):void(e=n)}e=r},n.registerLanguage(t),e=t.languageTag,ac=n}var ea={exports:{}};(function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,a="[BigNumber Error] ",s=a+"Number primitive has more than 15 significant digits: ",o=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13];function u(e){var t=0|e;return e>0||e===t?t:t-1}function c(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function l(e,t){var r,n,i=e.c,a=t.c,s=e.s,o=t.s,u=e.e,c=t.e;if(!s||!o)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-o:s;if(s!=o)return s;if(r=s<0,n=u==c,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=0,o=(u=i.length)<(c=a.length)?u:c;s<o;s++)if(i[s]!=a[s])return i[s]>a[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function f(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(a+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function d(e){var t=e.c.length-1;return u(e.e/14)==t&&e.c[t]%2!=0}function h(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function p(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(t=function e(t){var m,g,y,v,b,w,_,x,N,S=Z.prototype={constructor:Z,toString:null,valueOf:null},M=new Z(1),E=20,k=4,O=-7,A=21,T=-1e7,C=1e7,j=!1,I=1,D=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function Z(e,t){var n,a,o,u,c,l,d,h,p=this;if(!(p instanceof Z))return new Z(e,t);if(null==t){if(e&&!0===e._isBigNumber){p.s=e.s,!e.c||e.e>C?p.c=p.e=null:e.e<T?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice());return}if((l="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,c=e;c>=10;c/=10,u++);u>C?p.c=p.e=null:(p.e=u,p.c=[e]);return}h=String(e)}else{if(!r.test(h=String(e)))return N(p,h,l);p.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(u=h.indexOf("."))>-1&&(h=h.replace(".","")),(c=h.search(/e/i))>0?(u<0&&(u=c),u+=+h.slice(c+1),h=h.substring(0,c)):u<0&&(u=h.length)}else{if(f(t,2,R.length,"Base"),10==t&&P)return L(p=new Z(e),E+p.e+1,k);if(h=String(e),l="number"==typeof e){if(0*e!=0)return N(p,h,l,t);if(p.s=1/e<0?(h=h.slice(1),-1):1,Z.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(s+e)}else p.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(n=R.slice(0,t),u=c=0,d=h.length;c<d;c++)if(0>n.indexOf(a=h.charAt(c))){if("."==a){if(c>u){u=d;continue}}else if(!o&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){o=!0,c=-1,u=0;continue}return N(p,String(e),l,t)}l=!1,(u=(h=x(h,t,10,p.s)).indexOf("."))>-1?h=h.replace(".",""):u=h.length}for(c=0;48===h.charCodeAt(c);c++);for(d=h.length;48===h.charCodeAt(--d););if(h=h.slice(c,++d)){if(d-=c,l&&Z.DEBUG&&d>15&&(e>0x1fffffffffffff||e!==i(e)))throw Error(s+p.s*e);if((u=u-c-1)>C)p.c=p.e=null;else if(u<T)p.c=[p.e=0];else{if(p.e=u,p.c=[],c=(u+1)%14,u<0&&(c+=14),c<d){for(c&&p.c.push(+h.slice(0,c)),d-=14;c<d;)p.c.push(+h.slice(c,c+=14));c=14-(h=h.slice(c)).length}else c-=d;for(;c--;h+="0");p.c.push(+h)}}else p.c=[p.e=0]}function z(e,t,r,n){var i,a,s,o,u;if(null==r?r=k:f(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=c(e.c),u=1==n||2==n&&(s<=O||s>=A)?h(u,s):p(u,s,"0");else if(a=(e=L(new Z(e),t,r)).e,o=(u=c(e.c)).length,1==n||2==n&&(t<=a||a<=O)){for(;o<t;u+="0",o++);u=h(u,a)}else if(t-=s,u=p(u,a,"0"),a+1>o){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-o)>0)for(a+1==o&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function $(e,t){for(var r,n,i=1,a=new Z(e[0]);i<e.length;i++)(n=new Z(e[i])).s&&(r=l(a,n))!==t&&(0!==r||a.s!==t)||(a=n);return a}function B(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+14*r-1)>C?e.c=e.e=null:r<T?e.c=[e.e=0]:(e.e=r,e.c=t),e}function L(e,t,r,a){var s,u,c,l,f,d,h,p=e.c;if(p){e:{for(s=1,l=p[0];l>=10;l/=10,s++);if((u=t-s)<0)u+=14,c=t,h=i((f=p[d=0])/o[s-c-1]%10);else if((d=n((u+1)/14))>=p.length)if(a){for(;p.length<=d;p.push(0));f=h=0,s=1,u%=14,c=u-14+1}else break e;else{for(s=1,f=l=p[d];l>=10;l/=10,s++);u%=14,h=(c=u-14+s)<0?0:i(f/o[s-c-1]%10)}if(a=a||t<0||null!=p[d+1]||(c<0?f:f%o[s-c-1]),a=r<4?(h||a)&&(0==r||r==(e.s<0?3:2)):h>5||5==h&&(4==r||a||6==r&&(u>0?c>0?f/o[s-c]:0:p[d-1])%10&1||r==(e.s<0?8:7)),t<1||!p[0])return p.length=0,a?(t-=e.e+1,p[0]=o[(14-t%14)%14],e.e=-t||0):p[0]=e.e=0,e;if(0==u?(p.length=d,l=1,d--):(p.length=d+1,l=o[14-u],p[d]=c>0?i(f/o[s-c]%o[c])*l:0),a)for(;;)if(0==d){for(u=1,c=p[0];c>=10;c/=10,u++);for(c=p[0]+=l,l=1;c>=10;c/=10,l++);u!=l&&(e.e++,1e14==p[0]&&(p[0]=1));break}else{if(p[d]+=l,1e14!=p[d])break;p[d--]=0,l=1}for(u=p.length;0===p[--u];p.pop());}e.e>C?e.c=e.e=null:e.e<T&&(e.c=[e.e=0])}return e}function U(e){var t,r=e.e;return null===r?e.toString():(t=c(e.c),t=r<=O||r>=A?h(t,r):p(t,r,"0"),e.s<0?"-"+t:t)}return Z.clone=e,Z.ROUND_UP=0,Z.ROUND_DOWN=1,Z.ROUND_CEIL=2,Z.ROUND_FLOOR=3,Z.ROUND_HALF_UP=4,Z.ROUND_HALF_DOWN=5,Z.ROUND_HALF_EVEN=6,Z.ROUND_HALF_CEIL=7,Z.ROUND_HALF_FLOOR=8,Z.EUCLID=9,Z.config=Z.set=function(e){var t,r;if(null!=e)if("object"==typeof e){if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(f(r=e[t],0,1e9,t),E=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(f(r=e[t],0,8,t),k=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(f(r[0],-1e9,0,t),f(r[1],0,1e9,t),O=r[0],A=r[1]):(f(r,-1e9,1e9,t),O=-(A=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)f(r[0],-1e9,-1,t),f(r[1],1,1e9,t),T=r[0],C=r[1];else if(f(r,-1e9,1e9,t),r)T=-(C=r<0?-r:r);else throw Error(a+t+" cannot be zero: "+r);if(e.hasOwnProperty(t="CRYPTO"))if(!!(r=e[t])===r)if(r)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))j=r;else throw j=!r,Error(a+"crypto unavailable");else j=r;else throw Error(a+t+" not true or false: "+r);if(e.hasOwnProperty(t="MODULO_MODE")&&(f(r=e[t],0,9,t),I=r),e.hasOwnProperty(t="POW_PRECISION")&&(f(r=e[t],0,1e9,t),D=r),e.hasOwnProperty(t="FORMAT"))if("object"==typeof(r=e[t]))F=r;else throw Error(a+t+" not an object: "+r);if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(a+t+" invalid: "+r);P="0123456789"==r.slice(0,10),R=r}}else throw Error(a+"Object expected: "+e);return{DECIMAL_PLACES:E,ROUNDING_MODE:k,EXPONENTIAL_AT:[O,A],RANGE:[T,C],CRYPTO:j,MODULO_MODE:I,POW_PRECISION:D,FORMAT:F,ALPHABET:R}},Z.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!Z.DEBUG)return!0;var t,r,n=e.c,s=e.e,o=e.s;e:if("[object Array]"==({}).toString.call(n)){if((1===o||-1===o)&&s>=-1e9&&s<=1e9&&s===i(s)){if(0===n[0]){if(0===s&&1===n.length)return!0;break e}if((t=(s+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=1e14||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===s&&(null===o||1===o||-1===o))return!0;throw Error(a+"Invalid BigNumber: "+e)},Z.maximum=Z.max=function(){return $(arguments,-1)},Z.minimum=Z.min=function(){return $(arguments,1)},m=0x20000000000000*Math.random()&2097151?function(){return i(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},Z.random=function(e){var t,r,s,u,c,l=0,d=[],h=new Z(M);if(null==e?e=E:f(e,0,1e9),u=n(e/14),j)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));l<u;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(d.push(c%1e14),l+=2);l=u/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(u*=7);l<u;)(c=(31&t[l])*0x1000000000000+0x10000000000*t[l+1]+0x100000000*t[l+2]+0x1000000*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(d.push(c%1e14),l+=7);l=u/7}else throw j=!1,Error(a+"crypto unavailable");if(!j)for(;l<u;)(c=m())<9e15&&(d[l++]=c%1e14);for(u=d[--l],e%=14,u&&e&&(c=o[14-e],d[l]=i(u/c)*c);0===d[l];d.pop(),l--);if(l<0)d=[s=0];else{for(s=-1;0===d[0];d.splice(0,1),s-=14);for(l=1,c=d[0];c>=10;c/=10,l++);l<14&&(s-=14-l)}return h.e=s,h.c=d,h},Z.sum=function(){for(var e=1,t=arguments,r=new Z(t[0]);e<t.length;)r=r.plus(t[e++]);return r},x=function(){var e="0123456789";function t(e,t,r,n){for(var i,a,s=[0],o=0,u=e.length;o<u;){for(a=s.length;a--;s[a]*=t);for(s[0]+=n.indexOf(e.charAt(o++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(r,n,i,a,s){var o,u,l,f,d,h,m,g,y=r.indexOf("."),v=E,b=k;for(y>=0&&(f=D,D=0,r=r.replace(".",""),h=(g=new Z(n)).pow(r.length-y),D=f,g.c=t(p(c(h.c),h.e,"0"),10,i,e),g.e=g.c.length),l=f=(m=t(r,n,i,s?(o=R,e):(o=e,R))).length;0==m[--f];m.pop());if(!m[0])return o.charAt(0);if(y<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=_(h,g,v,b,i)).c,d=h.r,l=h.e),y=m[u=l+v+1],f=i/2,d=d||u<0||null!=m[u+1],d=b<4?(null!=y||d)&&(0==b||b==(h.s<0?3:2)):y>f||y==f&&(4==b||d||6==b&&1&m[u-1]||b==(h.s<0?8:7)),u<1||!m[0])r=d?p(o.charAt(1),-v,o.charAt(0)):o.charAt(0);else{if(m.length=u,d)for(--i;++m[--u]>i;)m[u]=0,u||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(y=0,r="";y<=f;r+=o.charAt(m[y++]));r=p(r,l,o.charAt(0))}return r}}(),_=function(){function e(e,t,r){var n,i,a,s,o=0,u=e.length,c=t%1e7,l=t/1e7|0;for(e=e.slice();u--;)n=l*(a=e[u]%1e7)+(s=e[u]/1e7|0)*c,o=((i=c*a+n%1e7*1e7+o)/r|0)+(n/1e7|0)+l*s,e[u]=i%r;return o&&(e=[o].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,a,s,o,c){var l,f,d,h,p,m,g,y,v,b,w,_,x,N,S,M,E,k=n.s==a.s?1:-1,O=n.c,A=a.c;if(!O||!O[0]||!A||!A[0])return new Z(!n.s||!a.s||(O?A&&O[0]==A[0]:!A)?NaN:O&&0==O[0]||!A?0*k:k/0);for(v=(y=new Z(k)).c=[],k=s+(f=n.e-a.e)+1,c||(c=1e14,f=u(n.e/14)-u(a.e/14),k=k/14|0),d=0;A[d]==(O[d]||0);d++);if(A[d]>(O[d]||0)&&f--,k<0)v.push(1),h=!0;else{for(N=O.length,M=A.length,d=0,k+=2,(p=i(c/(A[0]+1)))>1&&(A=e(A,p,c),O=e(O,p,c),M=A.length,N=O.length),x=M,w=(b=O.slice(0,M)).length;w<M;b[w++]=0);E=[0].concat(E=A.slice()),S=A[0],A[1]>=c/2&&S++;do{if(p=0,(l=t(A,b,M,w))<0){if(_=b[0],M!=w&&(_=_*c+(b[1]||0)),(p=i(_/S))>1)for(p>=c&&(p=c-1),g=(m=e(A,p,c)).length,w=b.length;1==t(m,b,g,w);)p--,r(m,M<g?E:A,g,c),g=m.length,l=1;else 0==p&&(l=p=1),g=(m=A.slice()).length;if(g<w&&(m=[0].concat(m)),r(b,m,w,c),w=b.length,-1==l)for(;1>t(A,b,M,w);)p++,r(b,M<w?E:A,w,c),w=b.length}else 0===l&&(p++,b=[0]);v[d++]=p,b[0]?b[w++]=O[x]||0:(b=[O[x]],w=1)}while((x++<N||null!=b[0])&&k--);h=null!=b[0],v[0]||v.splice(0,1)}if(1e14==c){for(d=1,k=v[0];k>=10;k/=10,d++);L(y,s+(y.e=d+14*f-1)+1,o,h)}else y.e=f,y.r=+h;return y}}(),g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,v=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g,N=function(e,t,r,n){var i,s=r?t:t.replace(w,"");if(b.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(g,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,s=s.replace(y,"$1").replace(v,"0.$1")),t!=s))return new Z(s,i);if(Z.DEBUG)throw Error(a+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},S.absoluteValue=S.abs=function(){var e=new Z(this);return e.s<0&&(e.s=1),e},S.comparedTo=function(e,t){return l(this,new Z(e,t))},S.decimalPlaces=S.dp=function(e,t){var r,n,i;if(null!=e)return f(e,0,1e9),null==t?t=k:f(t,0,8),L(new Z(this),e+this.e+1,t);if(!(r=this.c))return null;if(n=((i=r.length-1)-u(this.e/14))*14,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},S.dividedBy=S.div=function(e,t){return _(this,new Z(e,t),E,k)},S.dividedToIntegerBy=S.idiv=function(e,t){return _(this,new Z(e,t),0,1)},S.exponentiatedBy=S.pow=function(e,t){var r,s,o,u,c,l,f,h,p,m=this;if((e=new Z(e)).c&&!e.isInteger())throw Error(a+"Exponent not an integer: "+U(e));if(null!=t&&(t=new Z(t)),l=e.e>14,!m.c||!m.c[0]||1==m.c[0]&&!m.e&&1==m.c.length||!e.c||!e.c[0])return p=new Z(Math.pow(+U(m),l?e.s*(2-d(e)):+U(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new Z(NaN);(s=!f&&m.isInteger()&&t.isInteger())&&(m=m.mod(t))}else{if(e.e>9&&(m.e>0||m.e<-1||(0==m.e?m.c[0]>1||l&&m.c[1]>=24e7:m.c[0]<8e13||l&&m.c[0]<=9999975e7)))return u=m.s<0&&d(e)?-0:0,m.e>-1&&(u=1/u),new Z(f?1/u:u);D&&(u=n(D/14+2))}for(l?(r=new Z(.5),f&&(e.s=1),h=d(e)):h=(o=Math.abs(+U(e)))%2,p=new Z(M);;){if(h){if(!(p=p.times(m)).c)break;u?p.c.length>u&&(p.c.length=u):s&&(p=p.mod(t))}if(o){if(0===(o=i(o/2)))break;h=o%2}else if(L(e=e.times(r),e.e+1,1),e.e>14)h=d(e);else{if(0==(o=+U(e)))break;h=o%2}m=m.times(m),u?m.c&&m.c.length>u&&(m.c.length=u):s&&(m=m.mod(t))}return s?p:(f&&(p=M.div(p)),t?p.mod(t):u?L(p,D,k,c):p)},S.integerValue=function(e){var t=new Z(this);return null==e?e=k:f(e,0,8),L(t,t.e+1,e)},S.isEqualTo=S.eq=function(e,t){return 0===l(this,new Z(e,t))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(e,t){return l(this,new Z(e,t))>0},S.isGreaterThanOrEqualTo=S.gte=function(e,t){return 1===(t=l(this,new Z(e,t)))||0===t},S.isInteger=function(){return!!this.c&&u(this.e/14)>this.c.length-2},S.isLessThan=S.lt=function(e,t){return 0>l(this,new Z(e,t))},S.isLessThanOrEqualTo=S.lte=function(e,t){return -1===(t=l(this,new Z(e,t)))||0===t},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(e,t){var r,n,i,a,s=this.s;if(t=(e=new Z(e,t)).s,!s||!t)return new Z(NaN);if(s!=t)return e.s=-t,this.plus(e);var o=this.e/14,c=e.e/14,l=this.c,f=e.c;if(!o||!c){if(!l||!f)return l?(e.s=-t,e):new Z(f?this:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new Z(l[0]?this:3==k?-0:0)}if(o=u(o),c=u(c),l=l.slice(),s=o-c){for((a=s<0)?(s=-s,i=l):(c=o,i=f),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(a=(s=l.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(l[t]!=f[t]){a=l[t]<f[t];break}if(a&&(i=l,l=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=1e14-1;n>s;){if(l[--n]<f[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=1e14}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?B(e,l,c):(e.s=3==k?-1:1,e.c=[e.e=0],e)},S.modulo=S.mod=function(e,t){var r,n;return(e=new Z(e,t),this.c&&e.s&&(!e.c||e.c[0]))?e.c&&(!this.c||this.c[0])?(9==I?(n=e.s,e.s=1,r=_(this,e,0,3),e.s=n,r.s*=n):r=_(this,e,0,I),(e=this.minus(r.times(e))).c[0]||1!=I||(e.s=this.s),e):new Z(this):new Z(NaN)},S.multipliedBy=S.times=function(e,t){var r,n,i,a,s,o,c,l,f,d,h,p,m,g=this.c,y=(e=new Z(e,t)).c;if(!g||!y||!g[0]||!y[0])return this.s&&e.s&&(!g||g[0]||y)&&(!y||y[0]||g)?(e.s*=this.s,g&&y?(e.c=[0],e.e=0):e.c=e.e=null):e.c=e.e=e.s=null,e;for(n=u(this.e/14)+u(e.e/14),e.s*=this.s,(c=g.length)<(d=y.length)&&(m=g,g=y,y=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(i=d;--i>=0;){for(r=0,h=y[i]%1e7,p=y[i]/1e7|0,a=i+(s=c);a>i;)o=p*(l=g[--s]%1e7)+(f=g[s]/1e7|0)*h,r=((l=h*l+o%1e7*1e7+m[a]+r)/1e14|0)+(o/1e7|0)+p*f,m[a--]=l%1e14;m[a]=r}return r?++n:m.splice(0,1),B(e,m,n)},S.negated=function(){var e=new Z(this);return e.s=-e.s||null,e},S.plus=function(e,t){var r,n=this.s;if(t=(e=new Z(e,t)).s,!n||!t)return new Z(NaN);if(n!=t)return e.s=-t,this.minus(e);var i=this.e/14,a=e.e/14,s=this.c,o=e.c;if(!i||!a){if(!s||!o)return new Z(n/0);if(!s[0]||!o[0])return o[0]?e:new Z(s[0]?this:0*n)}if(i=u(i),a=u(a),s=s.slice(),n=i-a){for(n>0?(a=i,r=o):(n=-n,r=s),r.reverse();n--;r.push(0));r.reverse()}for((n=s.length)-(t=o.length)<0&&(r=o,o=s,s=r,t=n),n=0;t;)n=(s[--t]=s[t]+o[t]+n)/1e14|0,s[t]=1e14===s[t]?0:s[t]%1e14;return n&&(s=[n].concat(s),++a),B(e,s,a)},S.precision=S.sd=function(e,t){var r,n,i;if(null!=e&&!!e!==e)return f(e,1,1e9),null==t?t=k:f(t,0,8),L(new Z(this),e,t);if(!(r=this.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&this.e+1>n&&(n=this.e+1),n},S.shiftedBy=function(e){return f(e,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+e)},S.squareRoot=S.sqrt=function(){var e,t,r,n,i,a=this.c,s=this.s,o=this.e,l=E+4,f=new Z("0.5");if(1!==s||!a||!a[0])return new Z(!s||s<0&&(!a||a[0])?NaN:a?this:1/0);if(0==(s=Math.sqrt(+U(this)))||s==1/0?(((t=c(a)).length+o)%2==0&&(t+="0"),s=Math.sqrt(+t),o=u((o+1)/2)-(o<0||o%2),r=new Z(t=s==1/0?"5e"+o:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+o)):r=new Z(s+""),r.c[0]){for((s=(o=r.e)+l)<3&&(s=0);;)if(i=r,r=f.times(i.plus(_(this,i,l,1))),c(i.c).slice(0,s)===(t=c(r.c)).slice(0,s)){if(r.e<o&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(L(r,r.e+E+2,1),e=!r.times(r).eq(this));break}if(!n&&(L(i,i.e+E+2,0),i.times(i).eq(this))){r=i;break}l+=4,s+=4,n=1}}return L(r,r.e+E+1,k,e)},S.toExponential=function(e,t){return null!=e&&(f(e,0,1e9),e++),z(this,e,t,1)},S.toFixed=function(e,t){return null!=e&&(f(e,0,1e9),e=e+this.e+1),z(this,e,t)},S.toFormat=function(e,t,r){var n;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=F;else if("object"!=typeof r)throw Error(a+"Argument not an object: "+r);if(n=this.toFixed(e,t),this.c){var i,s=n.split("."),o=+r.groupSize,u=+r.secondaryGroupSize,c=r.groupSeparator||"",l=s[0],f=s[1],d=this.s<0,h=d?l.slice(1):l,p=h.length;if(u&&(i=o,o=u,u=i,p-=i),o>0&&p>0){for(i=p%o||o,l=h.substr(0,i);i<p;i+=o)l+=c+h.substr(i,o);u>0&&(l+=c+h.slice(i)),d&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},S.toFraction=function(e){var t,r,n,i,s,u,l,f,d,h,p,m,g=this.c;if(null!=e&&(!(l=new Z(e)).isInteger()&&(l.c||1!==l.s)||l.lt(M)))throw Error(a+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+U(l));if(!g)return new Z(this);for(t=new Z(M),d=r=new Z(M),n=f=new Z(M),m=c(g),s=t.e=m.length-this.e-1,t.c[0]=o[(u=s%14)<0?14+u:u],e=!e||l.comparedTo(t)>0?s>0?t:d:l,u=C,C=1/0,l=new Z(m),f.c[0]=0;h=_(l,t,0,1),1!=(i=r.plus(h.times(n))).comparedTo(e);)r=n,n=i,d=f.plus(h.times(i=d)),f=i,t=l.minus(h.times(i=t)),l=i;return i=_(e.minus(r),n,0,1),f=f.plus(i.times(d)),r=r.plus(i.times(n)),f.s=d.s=this.s,s*=2,p=1>_(d,n,s,k).minus(this).abs().comparedTo(_(f,r,s,k).minus(this).abs())?[d,n]:[f,r],C=u,p},S.toNumber=function(){return+U(this)},S.toPrecision=function(e,t){return null!=e&&f(e,1,1e9),z(this,e,t,2)},S.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=O||i>=A?h(c(r.c),i):p(c(r.c),i,"0"):10===e&&P?t=p(c((r=L(new Z(r),E+i+1,k)).c),r.e,"0"):(f(e,2,R.length,"Base"),t=x(p(c(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},S.valueOf=S.toJSON=function(){return U(this)},S._isBigNumber=!0,null!=t&&Z.set(t),Z}()).default=t.BigNumber=t,ea.exports?ea.exports=t:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=t)})(ee);var es=ea.exports;let eo=ei(),eu=er(),ec={trillion:1e12,billion:1e9,million:1e6,thousand:1e3},el={totalLength:0,characteristic:0,forceAverage:!1,average:!1,mantissa:-1,optionalMantissa:!0,thousandSeparated:!1,spaceSeparated:!1,negative:"sign",forceSign:!1,roundingFunction:Math.round,spaceSeparatedAbbreviation:!1},{binarySuffixes:ef,decimalSuffixes:ed}=eo.currentBytes(),eh={scale:1024,suffixes:ed,marker:"bd"},ep={scale:1024,suffixes:ef,marker:"b"},em={scale:1e3,suffixes:ed,marker:"d"};function eg(e,t,r){let n=t[0],i=Math.abs(e);if(i>=r){for(let a=1;a<t.length;++a){let s=Math.pow(r,a),o=Math.pow(r,a+1);if(i>=s&&i<o){n=t[a],e/=s;break}}n===t[0]&&(e/=Math.pow(r,t.length-1),n=t[t.length-1])}return{value:e,suffix:n}}function ey(e){let t="";for(let r=0;r<e;r++)t+="0";return t}function ev({instance:e,providedFormat:t,state:r=eo,decimalSeparator:n,defaults:i=r.currentDefaults()}){var a,s;let o=e._value;if(0===o&&r.hasZeroFormat())return r.getZeroFormat();if(!isFinite(o))return o.toString();let u=Object.assign({},el,i,t),c=u.totalLength,l=c?0:u.characteristic,f=u.optionalCharacteristic,d=u.forceAverage,h=u.lowPrecision,p=!!c||!!d||u.average,m=c?-1:p&&void 0===t.mantissa?0:u.mantissa,g=!c&&(void 0===t.optionalMantissa?-1===m:u.optionalMantissa),y=u.trimMantissa,v=u.thousandSeparated,b=u.spaceSeparated,w=u.negative,_=u.forceSign,x=u.exponential,N=u.roundingFunction,S="";if(p){let e=function({value:e,forceAverage:t,lowPrecision:r=!0,abbreviations:n,spaceSeparated:i=!1,totalLength:a=0,roundingFunction:s=Math.round}){let o="",u=Math.abs(e),c=-1;if(t&&n[t]&&ec[t]?(o=n[t],e/=ec[t]):u>=ec.trillion||r&&1===s(u/ec.trillion)?(o=n.trillion,e/=ec.trillion):u<ec.trillion&&u>=ec.billion||r&&1===s(u/ec.billion)?(o=n.billion,e/=ec.billion):u<ec.billion&&u>=ec.million||r&&1===s(u/ec.million)?(o=n.million,e/=ec.million):(u<ec.million&&u>=ec.thousand||r&&1===s(u/ec.thousand))&&(o=n.thousand,e/=ec.thousand),o&&(o=(i?" ":"")+o),a){let t=e<0,r=e.toString().split(".")[0];c=Math.max(a-(t?r.length-1:r.length),0)}return{value:e,abbreviation:o,mantissaPrecision:c}}({value:o,forceAverage:d,lowPrecision:h,abbreviations:r.currentAbbreviations(),spaceSeparated:b,roundingFunction:N,totalLength:c});o=e.value,S+=e.abbreviation,c&&(m=e.mantissaPrecision)}if(x){let e=function({value:e,characteristicPrecision:t}){let[r,n]=e.toExponential().split("e"),i=+r;return t&&1<t&&(i*=Math.pow(10,t-1),n-=t-1,n=n>=0?`+${n}`:n),{value:i,abbreviation:`e${n}`}}({value:o,characteristicPrecision:l});o=e.value,S=e.abbreviation+S}let M=function(e,t,r,n,i,a){if(-1===n)return e;let s=function(e,t,r=Math.round){return -1!==e.toString().indexOf("e")?function(e,t){let r=e.toString(),[n,i]=r.split("e"),[a,s=""]=n.split(".");if(+i>0)r=a+s+ey(i-s.length);else{let e=".";e=0>+a?`-0${e}`:`0${e}`;let n=(ey(-i-1)+Math.abs(a)+s).substr(0,t);n.length<t&&(n+=ey(t-n.length)),r=e+n}return+i>0&&t>0&&(r+=`.${ey(t)}`),r}(e,t):new es(r(+`${e}e+${t}`)/Math.pow(10,t)).toFixed(t)}(t,n,a),[o,u=""]=s.toString().split(".");if(u.match(/^0+$/)&&(r||i))return o;let c=u.match(/0+$/);return i&&c?`${o}.${u.toString().slice(0,c.index)}`:s.toString()}(o.toString(),o,g,m,y,N);return M=function(e,t,r,n,i){let a=n.currentDelimiters(),s=a.thousands;i=i||a.decimal;let o=a.thousandsSize||3,u=e.toString(),c=u.split(".")[0],l=u.split(".")[1],f=t<0&&0===c.indexOf("-");return r&&(f&&(c=c.slice(1)),(function(e,t){let r=[],n=0;for(let i=e;i>0;i--)n===t&&(r.unshift(i),n=0),n++;return r})(c.length,o).forEach((e,t)=>{c=c.slice(0,e+t)+s+c.slice(e+t)}),f&&(c=`-${c}`)),u=l?c+i+l:c}(M=function(e,t,r,n){let i=e,[a,s]=i.toString().split(".");if(a.match(/^-?0$/)&&r)return s?`${a.replace("0","")}.${s}`:a.replace("0","");let o=t<0&&0===a.indexOf("-");if(o&&(a=a.slice(1),i=i.slice(1)),a.length<n){let e=n-a.length;for(let t=0;t<e;t++)i=`0${i}`}return o&&(i=`-${i}`),i.toString()}(M,o,f,l),o,v,r,n),(p||x)&&(M+=S),(_||o<0)&&(a=M,M=0===(s=o)?a:0==+a?a.replace("-",""):s>0?`+${a}`:"sign"===w?a:`(${a.replace("-","")})`),M}function eb(e,t){if(!e)return t;let r=Object.keys(e);return 1===r.length&&"output"===r[0]?t:e}function ew(e,t,r){let n=new es(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new es(i),e._value=n.minus(i).toNumber(),e}let e_=ei(),ex=er(),eN={loadLanguagesInNode:e=>{e.forEach(e=>{let t;try{t=function(e){throw Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(`../languages/${e}`)}catch(t){console.error(`Unable to load "${e}". No matching language file found.`)}t&&eA.registerLanguage(t)})}},eS=et(),eM={format:(...e)=>(function(e,t={},r){if("string"==typeof t&&(t=en(t)),!eu.validateFormat(t))return"ERROR: invalid format";let n=t.prefix||"",i=t.postfix||"",a=function(e,t,r){var n,i;switch(t.output){case"currency":return function(e,t,r){let n,i=r.currentCurrency(),a=Object.assign({},t),s=Object.assign({},el,a),o="",u=!!s.totalLength||!!s.forceAverage||s.average,c=a.currencyPosition||i.position,l=a.currencySymbol||i.symbol,f=void 0!==s.spaceSeparatedCurrency?s.spaceSeparatedCurrency:s.spaceSeparated;void 0===a.lowPrecision&&(a.lowPrecision=!1),f&&(o=" "),"infix"===c&&(n=o+l+o);let d=ev({instance:e,providedFormat:a,state:r,decimalSeparator:n});return"prefix"===c&&(d=e._value<0&&"sign"===s.negative?`-${o}${l}${d.slice(1)}`:e._value>0&&s.forceSign?`+${o}${l}${d.slice(1)}`:l+o+d),c&&"postfix"!==c||(d=d+(o=!s.spaceSeparatedAbbreviation&&u?"":o)+l),d}(e,t=eb(t,eo.currentCurrencyDefaultFormat()),eo);case"percent":let a,s,o;return n=t=eb(t,eo.currentPercentageDefaultFormat()),a=n.prefixSymbol,s=ev({instance:r(100*e._value),providedFormat:n,state:eo}),o=Object.assign({},el,n),a?`%${o.spaceSeparated?" ":""}${s}`:`${s}${o.spaceSeparated?" ":""}%`;case"byte":return function(e,t,r,n){let i=t.base||"binary",a=Object.assign({},el,t),{binarySuffixes:s,decimalSuffixes:o}=r.currentBytes(),u={general:{scale:1024,suffixes:o||ed,marker:"bd"},binary:{scale:1024,suffixes:s||ef,marker:"b"},decimal:{scale:1e3,suffixes:o||ed,marker:"d"}}[i],{value:c,suffix:l}=eg(e._value,u.suffixes,u.scale),f=ev({instance:n(c),providedFormat:t,state:r,defaults:r.currentByteDefaultFormat()});return`${f}${a.spaceSeparated?" ":""}${l}`}(e,t=eb(t,eo.currentByteDefaultFormat()),eo,r);case"time":let u,c,l;return t=eb(t,eo.currentTimeDefaultFormat()),u=Math.floor(e._value/60/60),c=Math.floor((e._value-60*u*60)/60),l=Math.round(e._value-60*u*60-60*c),`${u}:${c<10?"0":""}${c}:${l<10?"0":""}${l}`;case"ordinal":let f,d,h,p;return i=t=eb(t,eo.currentOrdinalDefaultFormat()),f=eo.currentOrdinal(),d=Object.assign({},el,i),h=ev({instance:e,providedFormat:i,state:eo}),p=f(e._value),`${h}${d.spaceSeparated?" ":""}${p}`;default:return ev({instance:e,providedFormat:t,numbro:r})}}(e,t,r);return(a=n+a)+i})(...e,eA),getByteUnit:(...e)=>(function(e){return eg(e._value,eh.suffixes,eh.scale).suffix})(...e,eA),getBinaryByteUnit:(...e)=>(function(e){return eg(e._value,ep.suffixes,ep.scale).suffix})(...e,eA),getDecimalByteUnit:(...e)=>(function(e){return eg(e._value,em.suffixes,em.scale).suffix})(...e,eA),formatOrDefault:eb},eE={add:(e,t)=>{let r,n;return r=new es(e._value),n=t,eA.isNumbro(t)&&(n=t._value),n=new es(n),e._value=r.plus(n).toNumber(),e},subtract:(e,t)=>ew(e,t,eA),multiply:(e,t)=>{let r,n;return r=new es(e._value),n=t,eA.isNumbro(t)&&(n=t._value),n=new es(n),e._value=r.times(n).toNumber(),e},divide:(e,t)=>{let r,n;return r=new es(e._value),n=t,eA.isNumbro(t)&&(n=t._value),n=new es(n),e._value=r.dividedBy(n).toNumber(),e},set:(e,t)=>{let r;return r=t,eA.isNumbro(t)&&(r=t._value),e._value=r,e},difference:(e,t)=>{let r;return ew(r=eA(e._value),t,eA),Math.abs(r._value)},BigNumber:es};class ek{constructor(e){this._value=e}clone(){return eA(this._value)}format(e={}){return eM.format(this,e)}formatCurrency(e){return"string"==typeof e&&(e=en(e)),(e=eM.formatOrDefault(e,e_.currentCurrencyDefaultFormat())).output="currency",eM.format(this,e)}formatTime(e={}){return e.output="time",eM.format(this,e)}binaryByteUnits(){return eM.getBinaryByteUnit(this)}decimalByteUnits(){return eM.getDecimalByteUnit(this)}byteUnits(){return eM.getByteUnit(this)}difference(e){return eE.difference(this,e)}add(e){return eE.add(this,e)}subtract(e){return eE.subtract(this,e)}multiply(e){return eE.multiply(this,e)}divide(e){return eE.divide(this,e)}set(e){return eE.set(this,eO(e))}value(){return this._value}valueOf(){return this._value}}function eO(e){let t=e;return eA.isNumbro(e)?t=e._value:"string"==typeof e?t=eA.unformat(e):isNaN(e)&&(t=NaN),t}function eA(e){return new ek(eO(e))}eA.version="2.5.0",eA.isNumbro=function(e){return e instanceof ek},eA.language=e_.currentLanguage,eA.registerLanguage=e_.registerLanguage,eA.setLanguage=e_.setLanguage,eA.languages=e_.languages,eA.languageData=e_.languageData,eA.zeroFormat=e_.setZeroFormat,eA.defaultFormat=e_.currentDefaults,eA.setDefaults=e_.setDefaults,eA.defaultCurrencyFormat=e_.currentCurrencyDefaultFormat,eA.validate=ex.validate,eA.loadLanguagesInNode=eN.loadLanguagesInNode,eA.unformat=eS.unformat,eA.BigNumber=eE.BigNumber;var eT=eA&&eA.__esModule&&Object.prototype.hasOwnProperty.call(eA,"default")?eA.default:eA;let eC=3;function ej(e,{unit:t="bytes",shortValues:r,decimalPlaces:n}){let i="decbytes"===t;if(!Y(r)||Math.abs(e)<(i?1e3:1024)){let t={style:"unit",unit:"byte",unitDisplay:"long",useGrouping:!0};return X(n)?(t.minimumFractionDigits=Q(n),t.maximumFractionDigits=Q(n)):Y(r)&&(t.maximumSignificantDigits=eC),Intl.NumberFormat("en-US",t).format(e)}return eT(e).format({output:"byte",base:i?"decimal":"binary",spaceSeparated:!0,mantissa:X(n)?n:2,trimMantissa:!X(n),optionalMantissa:!X(n)})}let eI="Percent",eD="Time";var eF=((i8={}).milliseconds="millisecond",i8.seconds="second",i8.minutes="minute",i8.hours="hour",i8.days="day",i8.weeks="week",i8.months="month",i8.years="year",i8);let eR={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001},eP=["years","months","weeks","days","hours","minutes","seconds","milliseconds"],eZ="Throughput";var ez=r(93098);let e$="Currency",eB={Time:{label:"Time",decimalPlaces:!0},Percent:{label:"percent",decimalPlaces:!0},Decimal:{label:"Decimal",decimalPlaces:!0,shortValues:!0},Bytes:{label:"Bytes",decimalPlaces:!0,shortValues:!0},Throughput:{label:"Throughput",decimalPlaces:!0},Currency:{label:"Currency",decimalPlaces:!0}},eL={milliseconds:{group:eD,label:"Milliseconds"},seconds:{group:eD,label:"Seconds"},minutes:{group:eD,label:"Minutes"},hours:{group:eD,label:"Hours"},days:{group:eD,label:"Days"},weeks:{group:eD,label:"Weeks"},months:{group:eD,label:"Months"},years:{group:eD,label:"Years"},percent:{group:eI,label:"Percent (0-100)"},"percent-decimal":{group:eI,label:"Percent (0.0-1.0)"},"%":{disableSelectorOption:!0,group:eI,label:"%"},decimal:{group:"Decimal",label:"Decimal"},bytes:{group:"Bytes",label:"Bytes (IEC)"},decbytes:{group:"Bytes",label:"Bytes (SI)"},"bits/sec":{group:eZ,label:"Bits/sec"},"bytes/sec":{group:eZ,label:"Bytes/sec (IEC)"},"decbytes/sec":{group:eZ,label:"Bytes/sec (SI)"},"counts/sec":{group:eZ,label:"Counts/sec"},"events/sec":{group:eZ,label:"Events/sec"},"messages/sec":{group:eZ,label:"Messages/sec"},"ops/sec":{group:eZ,label:"Ops/sec"},"packets/sec":{group:eZ,label:"Packets/sec"},"reads/sec":{group:eZ,label:"Reads/sec"},"requests/sec":{group:eZ,label:"Requests/sec"},"records/sec":{group:eZ,label:"Records/sec"},"rows/sec":{group:eZ,label:"Rows/sec"},"writes/sec":{group:eZ,label:"Writes/sec"},aud:{group:e$,label:"Australian Dollar (A$)"},cad:{group:e$,label:"Canadian Dollar (CA$)"},chf:{group:e$,label:"Swiss Franc (CHF)"},cny:{group:e$,label:"Renminbi (CN\xa5)"},eur:{group:e$,label:"Euro (€)"},gbp:{group:e$,label:"Pound (\xa3)"},hkd:{group:e$,label:"Hong Kong Dollar (HK$)"},inr:{group:e$,label:"Indian Rupee (₹)"},jpy:{group:e$,label:"Yen (\xa5)"},krw:{group:e$,label:"South Korean Won (₩)"},nok:{group:e$,label:"Norwegian Krone (NOK)"},nzd:{group:e$,label:"New Zealand Dollar (NZ$)"},sek:{group:e$,label:"Swedish Krona (SEK)"},sgd:{group:e$,label:"Singapore Dollar (S$)"},usd:{group:e$,label:"US Dollar ($)"}};function eU(e,t){if(void 0===t)return e.toString();if(eJ(t))return ej(e,t);if(eH(t))return function(e,{shortValues:t,decimalPlaces:r}){let n={style:"decimal",useGrouping:!0};return Y(t)&&(n.notation="compact"),X(r)?(n.minimumFractionDigits=Q(r),n.maximumFractionDigits=Q(r)):Y(t)&&(n.maximumSignificantDigits=eC),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(eK(t))return function(e,{unit:t,decimalPlaces:r}){let n={style:"percent",useGrouping:!0};return X(r)?(n.minimumFractionDigits=Q(r),n.maximumFractionDigits=Q(r)):n.maximumSignificantDigits=eC,"percent"===t&&(e/=100),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(eW(t))return function(e,{unit:t,decimalPlaces:r}){var n;if(0===e)return"0s";let i=function(e,t){let r=e*eR[t],n=eP[0]||"years",i=n,a=r/eR[n];for(i of eP)if((a=r/eR[i])>=1)break;return{value:a,unit:i}}(e,t??"seconds"),a={style:"unit",unit:eF[i.unit],unitDisplay:"months"===(n=i.unit)||"years"===n?"long":"narrow"};return X(r)?(a.minimumFractionDigits=Q(r),a.maximumFractionDigits=Q(r)):a.maximumSignificantDigits=eC,Intl.NumberFormat("en-US",a).format(i.value)}(e,t);if(eQ(t))return function(e,{unit:t,shortValues:r,decimalPlaces:n}){if("decbytes/sec"===t){let t=1e3>Math.abs(e)?"sec":"s";return ej(e,{unit:"decbytes",shortValues:r,decimalPlaces:n})+"/"+t}if("bytes/sec"===t){let t=1024>Math.abs(e)?"sec":"s";return ej(e,{unit:"bytes",shortValues:r,decimalPlaces:n})+"/"+t}let i={style:"decimal",useGrouping:!0};return Y(r)&&(i.notation="compact"),X(n)?(i.minimumFractionDigits=Q(n),i.maximumFractionDigits=Q(n)):Y(r)&&(i.maximumSignificantDigits=eC),Intl.NumberFormat("en-US",i).format(e)+" "+t}(e,t);if(e0(t))return function(e,{unit:t,decimalPlaces:r}){let n={style:"currency",currency:(0,ez.toUpper)(t),currencyDisplay:"symbol"};return X(r)?(n.minimumFractionDigits=Q(r),n.maximumFractionDigits=Q(r)):n.maximumSignificantDigits=eC,Intl.NumberFormat("en-US",n).format(e)}(e,t);throw Error(`Unknown unit options ${t}`)}function eV(e){return eL[e.unit??"decimal"]}function eq(e){return eV(e).group??"Decimal"}function eG(e){return eB[eV(e).group??"Decimal"]}function eW(e){return"Time"===eq(e)}function eK(e){return"Percent"===eq(e)}function eH(e){return"Decimal"===eq(e)}function eJ(e){return"Bytes"===eq(e)}function eY(e){return!!eG(e).decimalPlaces}function eX(e){return!!eG(e).shortValues}function eQ(e){return"Throughput"===eq(e)}function e0(e){return"Currency"===eq(e)}function e1(e){return"project"in e.metadata?e.metadata.project:void 0}let e2="$__all";(ae=af||(af={})).assertEqual=e=>e,ae.assertIs=function(e){},ae.assertNever=function(e){throw Error()},ae.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},ae.getValidEnumValues=e=>{let t=ae.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return ae.objectValues(r)},ae.objectValues=e=>ae.objectKeys(e).map(function(t){return e[t]}),ae.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},ae.find=(e,t)=>{for(let r of e)if(t(r))return r},ae.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,ae.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},ae.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ad||(ad={})).mergeShapes=(e,t)=>({...e,...t});let e4=af.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),e9=e=>{switch(typeof e){case"undefined":return e4.undefined;case"string":return e4.string;case"number":return isNaN(e)?e4.nan:e4.number;case"boolean":return e4.boolean;case"function":return e4.function;case"bigint":return e4.bigint;case"symbol":return e4.symbol;case"object":if(Array.isArray(e))return e4.array;if(null===e)return e4.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return e4.promise;if("undefined"!=typeof Map&&e instanceof Map)return e4.map;if("undefined"!=typeof Set&&e instanceof Set)return e4.set;if("undefined"!=typeof Date&&e instanceof Date)return e4.date;return e4.object;default:return e4.unknown}},e5=af.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class e3 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof e3))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,af.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}e3.create=e=>new e3(e);let e7=(e,t)=>{let r;switch(e.code){case e5.invalid_type:r=e.received===e4.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case e5.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,af.jsonStringifyReplacer)}`;break;case e5.unrecognized_keys:r=`Unrecognized key(s) in object: ${af.joinValues(e.keys,", ")}`;break;case e5.invalid_union:r="Invalid input";break;case e5.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${af.joinValues(e.options)}`;break;case e5.invalid_enum_value:r=`Invalid enum value. Expected ${af.joinValues(e.options)}, received '${e.received}'`;break;case e5.invalid_arguments:r="Invalid function arguments";break;case e5.invalid_return_type:r="Invalid function return type";break;case e5.invalid_date:r="Invalid date";break;case e5.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:af.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case e5.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case e5.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case e5.custom:r="Invalid input";break;case e5.invalid_intersection_types:r="Intersection results could not be merged";break;case e5.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case e5.not_finite:r="Number must be finite";break;default:r=t.defaultError,af.assertNever(e)}return{message:r}},e6=e7;function e8(){return e6}let te=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],s={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="";for(let e of n.filter(e=>!!e).slice().reverse())o=e(s,{data:t,defaultError:o}).message;return{...i,path:a,message:o}};function tt(e,t){let r=e8(),n=te({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===e7?void 0:e7].filter(e=>!!e)});e.common.issues.push(n)}class tr{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return tn;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return tr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return tn;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let tn=Object.freeze({status:"aborted"}),ti=e=>({status:"dirty",value:e}),ta=e=>({status:"valid",value:e}),ts=e=>"aborted"===e.status,to=e=>"dirty"===e.status,tu=e=>"valid"===e.status,tc=e=>"undefined"!=typeof Promise&&e instanceof Promise;function tl(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function tf(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError,(at=ah||(ah={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},at.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class td{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let th=(e,t)=>{if(tu(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new e3(e.common.issues);return this._error=t,this._error}}};function tp(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var a,s;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!=(a=null!=o?o:n)?a:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!=(s=null!=o?o:r)?s:i.defaultError}},description:i}}class tm{get description(){return this._def.description}_getType(e){return e9(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:e9(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tr,ctx:{common:e.parent.common,data:e.data,parsedType:e9(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(tc(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!=(r=null==t?void 0:t.async)&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e9(e)},i=this._parseSync({data:e,path:n.path,parent:n});return th(n,i)}"~validate"(e){var t,r;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e9(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:n});return tu(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null==(r=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(e=>tu(e)?{value:e.value}:{issues:n.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e9(e)},n=this._parse({data:e,path:r.path,parent:r});return th(r,await (tc(n)?n:Promise.resolve(n)))}refine(e,t){return this._refinement((r,n)=>{let i=e(r),a=()=>n.addIssue({code:e5.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new t8({schema:this,typeName:ag.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return re.create(this,this._def)}nullable(){return rt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tG.create(this)}promise(){return t6.create(this,this._def)}or(e){return tK.create([this,e],this._def)}and(e){return tY.create(this,e,this._def)}transform(e){return new t8({...tp(this._def),schema:this,typeName:ag.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new rr({...tp(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:ag.ZodDefault})}brand(){return new rs({typeName:ag.ZodBranded,type:this,...tp(this._def)})}catch(e){return new rn({...tp(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:ag.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ro.create(this,e)}readonly(){return ru.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let tg=/^c[^\s-]{8,}$/i,ty=/^[0-9a-z]+$/,tv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tw=/^[a-z0-9_-]{21}$/i,t_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tx=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,tE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tA=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tC=RegExp(`^${tT}$`);function tj(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function tI(e){let t=`${tT}T${tj(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class tD extends tm{_parse(e){var t,r,i,a;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==e4.string){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.string,received:t.parsedType}),tn}let o=new tr;for(let u of this._def.checks)if("min"===u.kind)e.data.length<u.value&&(tt(s=this._getOrReturnCtx(e,s),{code:e5.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),o.dirty());else if("max"===u.kind)e.data.length>u.value&&(tt(s=this._getOrReturnCtx(e,s),{code:e5.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),o.dirty());else if("length"===u.kind){let t=e.data.length>u.value,r=e.data.length<u.value;(t||r)&&(s=this._getOrReturnCtx(e,s),t?tt(s,{code:e5.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):r&&tt(s,{code:e5.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),o.dirty())}else if("email"===u.kind)tN.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"email",code:e5.invalid_string,message:u.message}),o.dirty());else if("emoji"===u.kind)n||(n=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),n.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"emoji",code:e5.invalid_string,message:u.message}),o.dirty());else if("uuid"===u.kind)tb.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"uuid",code:e5.invalid_string,message:u.message}),o.dirty());else if("nanoid"===u.kind)tw.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"nanoid",code:e5.invalid_string,message:u.message}),o.dirty());else if("cuid"===u.kind)tg.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"cuid",code:e5.invalid_string,message:u.message}),o.dirty());else if("cuid2"===u.kind)ty.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"cuid2",code:e5.invalid_string,message:u.message}),o.dirty());else if("ulid"===u.kind)tv.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"ulid",code:e5.invalid_string,message:u.message}),o.dirty());else if("url"===u.kind)try{new URL(e.data)}catch(t){tt(s=this._getOrReturnCtx(e,s),{validation:"url",code:e5.invalid_string,message:u.message}),o.dirty()}else"regex"===u.kind?(u.regex.lastIndex=0,u.regex.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"regex",code:e5.invalid_string,message:u.message}),o.dirty())):"trim"===u.kind?e.data=e.data.trim():"includes"===u.kind?e.data.includes(u.value,u.position)||(tt(s=this._getOrReturnCtx(e,s),{code:e5.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),o.dirty()):"toLowerCase"===u.kind?e.data=e.data.toLowerCase():"toUpperCase"===u.kind?e.data=e.data.toUpperCase():"startsWith"===u.kind?e.data.startsWith(u.value)||(tt(s=this._getOrReturnCtx(e,s),{code:e5.invalid_string,validation:{startsWith:u.value},message:u.message}),o.dirty()):"endsWith"===u.kind?e.data.endsWith(u.value)||(tt(s=this._getOrReturnCtx(e,s),{code:e5.invalid_string,validation:{endsWith:u.value},message:u.message}),o.dirty()):"datetime"===u.kind?tI(u).test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{code:e5.invalid_string,validation:"datetime",message:u.message}),o.dirty()):"date"===u.kind?tC.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{code:e5.invalid_string,validation:"date",message:u.message}),o.dirty()):"time"===u.kind?RegExp(`^${tj(u)}$`).test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{code:e5.invalid_string,validation:"time",message:u.message}),o.dirty()):"duration"===u.kind?tx.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"duration",code:e5.invalid_string,message:u.message}),o.dirty()):"ip"===u.kind?(t=e.data,!(("v4"===(r=u.version)||!r)&&tS.test(t)||("v6"===r||!r)&&tE.test(t))&&1&&(tt(s=this._getOrReturnCtx(e,s),{validation:"ip",code:e5.invalid_string,message:u.message}),o.dirty())):"jwt"===u.kind?!function(e,t){if(!t_.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||!i.typ||!i.alg||t&&i.alg!==t)return!1;return!0}catch(e){return!1}}(e.data,u.alg)&&(tt(s=this._getOrReturnCtx(e,s),{validation:"jwt",code:e5.invalid_string,message:u.message}),o.dirty()):"cidr"===u.kind?(i=e.data,!(("v4"===(a=u.version)||!a)&&tM.test(i)||("v6"===a||!a)&&tk.test(i))&&1&&(tt(s=this._getOrReturnCtx(e,s),{validation:"cidr",code:e5.invalid_string,message:u.message}),o.dirty())):"base64"===u.kind?tO.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"base64",code:e5.invalid_string,message:u.message}),o.dirty()):"base64url"===u.kind?tA.test(e.data)||(tt(s=this._getOrReturnCtx(e,s),{validation:"base64url",code:e5.invalid_string,message:u.message}),o.dirty()):af.assertNever(u);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:e5.invalid_string,...ah.errToObj(r)})}_addCheck(e){return new tD({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ah.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ah.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ah.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ah.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ah.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ah.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ah.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ah.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ah.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ah.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ah.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ah.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ah.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(r=null==e?void 0:e.local)&&r,...ah.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...ah.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ah.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ah.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...ah.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ah.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ah.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ah.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ah.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ah.errToObj(t)})}nonempty(e){return this.min(1,ah.errToObj(e))}trim(){return new tD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tD({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}tD.create=e=>{var t;return new tD({checks:[],typeName:ag.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...tp(e)})};class tF extends tm{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==e4.number){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.number,received:t.parsedType}),tn}let r=new tr;for(let n of this._def.checks)"int"===n.kind?af.isInteger(e.data)||(tt(t=this._getOrReturnCtx(e,t),{code:e5.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,n.value)&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(tt(t=this._getOrReturnCtx(e,t),{code:e5.not_finite,message:n.message}),r.dirty()):af.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ah.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ah.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ah.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ah.toString(t))}setLimit(e,t,r,n){return new tF({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ah.toString(n)}]})}_addCheck(e){return new tF({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ah.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ah.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ah.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ah.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ah.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ah.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ah.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ah.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ah.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&af.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}tF.create=e=>new tF({checks:[],typeName:ag.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...tp(e)});class tR extends tm{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==e4.bigint)return this._getInvalidInput(e);let r=new tr;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):af.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.bigint,received:t.parsedType}),tn}gte(e,t){return this.setLimit("min",e,!0,ah.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ah.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ah.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ah.toString(t))}setLimit(e,t,r,n){return new tR({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ah.toString(n)}]})}_addCheck(e){return new tR({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ah.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ah.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ah.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ah.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ah.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}tR.create=e=>{var t;return new tR({checks:[],typeName:ag.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...tp(e)})};class tP extends tm{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==e4.boolean){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.boolean,received:t.parsedType}),tn}return ta(e.data)}}tP.create=e=>new tP({typeName:ag.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...tp(e)});class tZ extends tm{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==e4.date){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.date,received:t.parsedType}),tn}if(isNaN(e.data.getTime()))return tt(this._getOrReturnCtx(e),{code:e5.invalid_date}),tn;let r=new tr;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(tt(t=this._getOrReturnCtx(e,t),{code:e5.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):af.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new tZ({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ah.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ah.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}tZ.create=e=>new tZ({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ag.ZodDate,...tp(e)});class tz extends tm{_parse(e){if(this._getType(e)!==e4.symbol){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.symbol,received:t.parsedType}),tn}return ta(e.data)}}tz.create=e=>new tz({typeName:ag.ZodSymbol,...tp(e)});class t$ extends tm{_parse(e){if(this._getType(e)!==e4.undefined){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.undefined,received:t.parsedType}),tn}return ta(e.data)}}t$.create=e=>new t$({typeName:ag.ZodUndefined,...tp(e)});class tB extends tm{_parse(e){if(this._getType(e)!==e4.null){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.null,received:t.parsedType}),tn}return ta(e.data)}}tB.create=e=>new tB({typeName:ag.ZodNull,...tp(e)});class tL extends tm{constructor(){super(...arguments),this._any=!0}_parse(e){return ta(e.data)}}tL.create=e=>new tL({typeName:ag.ZodAny,...tp(e)});class tU extends tm{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ta(e.data)}}tU.create=e=>new tU({typeName:ag.ZodUnknown,...tp(e)});class tV extends tm{_parse(e){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.never,received:t.parsedType}),tn}}tV.create=e=>new tV({typeName:ag.ZodNever,...tp(e)});class tq extends tm{_parse(e){if(this._getType(e)!==e4.undefined){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.void,received:t.parsedType}),tn}return ta(e.data)}}tq.create=e=>new tq({typeName:ag.ZodVoid,...tp(e)});class tG extends tm{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==e4.array)return tt(t,{code:e5.invalid_type,expected:e4.array,received:t.parsedType}),tn;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(tt(t,{code:e?e5.too_big:e5.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(tt(t,{code:e5.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(tt(t,{code:e5.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new td(t,e,t.path,r)))).then(e=>tr.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new td(t,e,t.path,r)));return tr.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new tG({...this._def,minLength:{value:e,message:ah.toString(t)}})}max(e,t){return new tG({...this._def,maxLength:{value:e,message:ah.toString(t)}})}length(e,t){return new tG({...this._def,exactLength:{value:e,message:ah.toString(t)}})}nonempty(e){return this.min(1,e)}}tG.create=(e,t)=>new tG({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ag.ZodArray,...tp(t)});class tW extends tm{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=af.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==e4.object){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.object,received:t.parsedType}),tn}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof tV&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let s=[];for(let e of i){let t=n[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new td(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof tV){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(tt(r,{code:e5.unrecognized_keys,keys:a}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new td(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>tr.mergeObjectSync(t,e)):tr.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return ah.errToObj,new tW({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,a,s;let o=null!=(a=null==(i=(n=this._def).errorMap)?void 0:i.call(n,t,r).message)?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!=(s=ah.errToObj(e).message)?s:o}:{message:o}}}:{}})}strip(){return new tW({...this._def,unknownKeys:"strip"})}passthrough(){return new tW({...this._def,unknownKeys:"passthrough"})}extend(e){return new tW({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new tW({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ag.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new tW({...this._def,catchall:e})}pick(e){let t={};return af.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new tW({...this._def,shape:()=>t})}omit(e){let t={};return af.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new tW({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof tW){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=re.create(e(i))}return new tW({...t._def,shape:()=>r})}if(t instanceof tG)return new tG({...t._def,type:e(t.element)});if(t instanceof re)return re.create(e(t.unwrap()));if(t instanceof rt)return rt.create(e(t.unwrap()));if(t instanceof tX)return tX.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};return af.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new tW({...this._def,shape:()=>t})}required(e){let t={};return af.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof re;)e=e._def.innerType;t[r]=e}}),new tW({...this._def,shape:()=>t})}keyof(){return t5(af.objectKeys(this.shape))}}tW.create=(e,t)=>new tW({shape:()=>e,unknownKeys:"strip",catchall:tV.create(),typeName:ag.ZodObject,...tp(t)}),tW.strictCreate=(e,t)=>new tW({shape:()=>e,unknownKeys:"strict",catchall:tV.create(),typeName:ag.ZodObject,...tp(t)}),tW.lazycreate=(e,t)=>new tW({shape:e,unknownKeys:"strip",catchall:tV.create(),typeName:ag.ZodObject,...tp(t)});class tK extends tm{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new e3(e.ctx.common.issues));return tt(t,{code:e5.invalid_union,unionErrors:r}),tn});{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new e3(e));return tt(t,{code:e5.invalid_union,unionErrors:i}),tn}}get options(){return this._def.options}}tK.create=(e,t)=>new tK({options:e,typeName:ag.ZodUnion,...tp(t)});let tH=e=>{if(e instanceof t4)return tH(e.schema);if(e instanceof t8)return tH(e.innerType());if(e instanceof t9)return[e.value];if(e instanceof t3)return e.options;if(e instanceof t7)return af.objectValues(e.enum);else if(e instanceof rr)return tH(e._def.innerType);else if(e instanceof t$)return[void 0];else if(e instanceof tB)return[null];else if(e instanceof re)return[void 0,...tH(e.unwrap())];else if(e instanceof rt)return[null,...tH(e.unwrap())];else if(e instanceof rs)return tH(e.unwrap());else if(e instanceof ru)return tH(e.unwrap());else if(e instanceof rn)return tH(e._def.innerType);else return[]};class tJ extends tm{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e4.object)return tt(t,{code:e5.invalid_type,expected:e4.object,received:t.parsedType}),tn;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(tt(t,{code:e5.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),tn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=tH(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new tJ({typeName:ag.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...tp(r)})}}class tY extends tm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(ts(e)||ts(n))return tn;let i=function e(t,r){let n=e9(t),i=e9(r);if(t===r)return{valid:!0,data:t};if(n===e4.object&&i===e4.object){let n=af.objectKeys(r),i=af.objectKeys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};a[n]=i.data}return{valid:!0,data:a}}if(n===e4.array&&i===e4.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}if(n===e4.date&&i===e4.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?((to(e)||to(n))&&t.dirty(),{status:t.value,value:i.data}):(tt(r,{code:e5.invalid_intersection_types}),tn)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}tY.create=(e,t,r)=>new tY({left:e,right:t,typeName:ag.ZodIntersection,...tp(r)});class tX extends tm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e4.array)return tt(r,{code:e5.invalid_type,expected:e4.array,received:r.parsedType}),tn;if(r.data.length<this._def.items.length)return tt(r,{code:e5.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tn;!this._def.rest&&r.data.length>this._def.items.length&&(tt(r,{code:e5.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new td(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>tr.mergeArray(t,e)):tr.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new tX({...this._def,rest:e})}}tX.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new tX({items:e,typeName:ag.ZodTuple,rest:null,...tp(t)})};class tQ extends tm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e4.object)return tt(r,{code:e5.invalid_type,expected:e4.object,received:r.parsedType}),tn;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new td(r,e,r.path,e)),value:a._parse(new td(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?tr.mergeObjectAsync(t,n):tr.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new tQ(t instanceof tm?{keyType:e,valueType:t,typeName:ag.ZodRecord,...tp(r)}:{keyType:tD.create(),valueType:e,typeName:ag.ZodRecord,...tp(t)})}}class t0 extends tm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e4.map)return tt(r,{code:e5.invalid_type,expected:e4.map,received:r.parsedType}),tn;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new td(r,e,r.path,[a,"key"])),value:i._parse(new td(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return tn;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return tn;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}t0.create=(e,t,r)=>new t0({valueType:t,keyType:e,typeName:ag.ZodMap,...tp(r)});class t1 extends tm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e4.set)return tt(r,{code:e5.invalid_type,expected:e4.set,received:r.parsedType}),tn;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(tt(r,{code:e5.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(tt(r,{code:e5.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return tn;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map((e,t)=>i._parse(new td(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new t1({...this._def,minSize:{value:e,message:ah.toString(t)}})}max(e,t){return new t1({...this._def,maxSize:{value:e,message:ah.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}t1.create=(e,t)=>new t1({valueType:e,minSize:null,maxSize:null,typeName:ag.ZodSet,...tp(t)});class t2 extends tm{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e4.function)return tt(t,{code:e5.invalid_type,expected:e4.function,received:t.parsedType}),tn;function r(e,r){return te({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e8(),e7].filter(e=>!!e),issueData:{code:e5.invalid_arguments,argumentsError:r}})}function n(e,r){return te({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e8(),e7].filter(e=>!!e),issueData:{code:e5.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof t6){let e=this;return ta(async function(...t){let s=new e3([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw s.addIssue(r(t,e)),s}),u=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(u,i).catch(e=>{throw s.addIssue(n(u,e)),s})})}{let e=this;return ta(function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new e3([r(t,s.error)]);let o=Reflect.apply(a,this,s.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new e3([n(o,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t2({...this._def,args:tX.create(e).rest(tU.create())})}returns(e){return new t2({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new t2({args:e||tX.create([]).rest(tU.create()),returns:t||tU.create(),typeName:ag.ZodFunction,...tp(r)})}}class t4 extends tm{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}t4.create=(e,t)=>new t4({getter:e,typeName:ag.ZodLazy,...tp(t)});class t9 extends tm{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return tt(t,{received:t.data,code:e5.invalid_literal,expected:this._def.value}),tn}return{status:"valid",value:e.data}}get value(){return this._def.value}}function t5(e,t){return new t3({values:e,typeName:ag.ZodEnum,...tp(t)})}t9.create=(e,t)=>new t9({value:e,typeName:ag.ZodLiteral,...tp(t)});class t3 extends tm{constructor(){super(...arguments),ap.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return tt(t,{expected:af.joinValues(r),received:t.parsedType,code:e5.invalid_type}),tn}if(tl(this,ap,"f")||tf(this,ap,new Set(this._def.values),"f"),!tl(this,ap,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return tt(t,{received:t.data,code:e5.invalid_enum_value,options:r}),tn}return ta(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return t3.create(e,{...this._def,...t})}exclude(e,t=this._def){return t3.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ap=new WeakMap,t3.create=t5;class t7 extends tm{constructor(){super(...arguments),am.set(this,void 0)}_parse(e){let t=af.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==e4.string&&r.parsedType!==e4.number){let e=af.objectValues(t);return tt(r,{expected:af.joinValues(e),received:r.parsedType,code:e5.invalid_type}),tn}if(tl(this,am,"f")||tf(this,am,new Set(af.getValidEnumValues(this._def.values)),"f"),!tl(this,am,"f").has(e.data)){let e=af.objectValues(t);return tt(r,{received:r.data,code:e5.invalid_enum_value,options:e}),tn}return ta(e.data)}get enum(){return this._def.values}}am=new WeakMap,t7.create=(e,t)=>new t7({values:e,typeName:ag.ZodNativeEnum,...tp(t)});class t6 extends tm{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==e4.promise&&!1===t.common.async?(tt(t,{code:e5.invalid_type,expected:e4.promise,received:t.parsedType}),tn):ta((t.parsedType===e4.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}t6.create=(e,t)=>new t6({type:e,typeName:ag.ZodPromise,...tp(t)});class t8 extends tm{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ag.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{tt(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return tn;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?tn:"dirty"===n.status||"dirty"===t.value?ti(n.value):n});{if("aborted"===t.value)return tn;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?tn:"dirty"===n.status||"dirty"===t.value?ti(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?tn:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?tn:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>tu(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!tu(e))return e;let a=n.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}af.assertNever(n)}}t8.create=(e,t,r)=>new t8({schema:e,typeName:ag.ZodEffects,effect:t,...tp(r)}),t8.createWithPreprocess=(e,t,r)=>new t8({schema:t,effect:{type:"preprocess",transform:e},typeName:ag.ZodEffects,...tp(r)});class re extends tm{_parse(e){return this._getType(e)===e4.undefined?ta(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(e,t)=>new re({innerType:e,typeName:ag.ZodOptional,...tp(t)});class rt extends tm{_parse(e){return this._getType(e)===e4.null?ta(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rt.create=(e,t)=>new rt({innerType:e,typeName:ag.ZodNullable,...tp(t)});class rr extends tm{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===e4.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}rr.create=(e,t)=>new rr({innerType:e,typeName:ag.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...tp(t)});class rn extends tm{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return tc(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new e3(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new e3(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}rn.create=(e,t)=>new rn({innerType:e,typeName:ag.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...tp(t)});class ri extends tm{_parse(e){if(this._getType(e)!==e4.nan){let t=this._getOrReturnCtx(e);return tt(t,{code:e5.invalid_type,expected:e4.nan,received:t.parsedType}),tn}return{status:"valid",value:e.data}}}ri.create=e=>new ri({typeName:ag.ZodNaN,...tp(e)});let ra=Symbol("zod_brand");class rs extends tm{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ro extends tm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?tn:"dirty"===e.status?(t.dirty(),ti(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?tn:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ro({in:e,out:t,typeName:ag.ZodPipeline})}}class ru extends tm{_parse(e){let t=this._def.innerType._parse(e),r=e=>(tu(e)&&(e.value=Object.freeze(e.value)),e);return tc(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function rc(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function rl(e,t={},r){return e?tL.create().superRefine((n,i)=>{var a,s;let o=e(n);if(o instanceof Promise)return o.then(e=>{var a,s;if(!e){let e=rc(t,n),o=null==(s=null!=(a=e.fatal)?a:r)||s;i.addIssue({code:"custom",...e,fatal:o})}});if(!o){let e=rc(t,n),o=null==(s=null!=(a=e.fatal)?a:r)||s;i.addIssue({code:"custom",...e,fatal:o})}}):tL.create()}ru.create=(e,t)=>new ru({innerType:e,typeName:ag.ZodReadonly,...tp(t)});let rf={object:tW.lazycreate};(ar=ag||(ag={})).ZodString="ZodString",ar.ZodNumber="ZodNumber",ar.ZodNaN="ZodNaN",ar.ZodBigInt="ZodBigInt",ar.ZodBoolean="ZodBoolean",ar.ZodDate="ZodDate",ar.ZodSymbol="ZodSymbol",ar.ZodUndefined="ZodUndefined",ar.ZodNull="ZodNull",ar.ZodAny="ZodAny",ar.ZodUnknown="ZodUnknown",ar.ZodNever="ZodNever",ar.ZodVoid="ZodVoid",ar.ZodArray="ZodArray",ar.ZodObject="ZodObject",ar.ZodUnion="ZodUnion",ar.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ar.ZodIntersection="ZodIntersection",ar.ZodTuple="ZodTuple",ar.ZodRecord="ZodRecord",ar.ZodMap="ZodMap",ar.ZodSet="ZodSet",ar.ZodFunction="ZodFunction",ar.ZodLazy="ZodLazy",ar.ZodLiteral="ZodLiteral",ar.ZodEnum="ZodEnum",ar.ZodEffects="ZodEffects",ar.ZodNativeEnum="ZodNativeEnum",ar.ZodOptional="ZodOptional",ar.ZodNullable="ZodNullable",ar.ZodDefault="ZodDefault",ar.ZodCatch="ZodCatch",ar.ZodPromise="ZodPromise",ar.ZodBranded="ZodBranded",ar.ZodPipeline="ZodPipeline",ar.ZodReadonly="ZodReadonly";let rd=tD.create,rh=tF.create,rp=ri.create,rm=tR.create,rg=tP.create,ry=tZ.create,rv=tz.create,rb=t$.create,rw=tB.create,r_=tL.create,rx=tU.create,rN=tV.create,rS=tq.create,rM=tG.create,rE=tW.create,rk=tW.strictCreate,rO=tK.create,rA=tJ.create,rT=tY.create,rC=tX.create,rj=tQ.create,rI=t0.create,rD=t1.create,rF=t2.create,rR=t4.create,rP=t9.create,rZ=t3.create,rz=t7.create,r$=t6.create,rB=t8.create,rL=re.create,rU=rt.create,rV=t8.createWithPreprocess,rq=ro.create;var rG=Object.freeze({__proto__:null,defaultErrorMap:e7,setErrorMap:function(e){e6=e},getErrorMap:e8,makeIssue:te,EMPTY_PATH:[],addIssueToContext:tt,ParseStatus:tr,INVALID:tn,DIRTY:ti,OK:ta,isAborted:ts,isDirty:to,isValid:tu,isAsync:tc,get util(){return af},get objectUtil(){return ad},ZodParsedType:e4,getParsedType:e9,ZodType:tm,datetimeRegex:tI,ZodString:tD,ZodNumber:tF,ZodBigInt:tR,ZodBoolean:tP,ZodDate:tZ,ZodSymbol:tz,ZodUndefined:t$,ZodNull:tB,ZodAny:tL,ZodUnknown:tU,ZodNever:tV,ZodVoid:tq,ZodArray:tG,ZodObject:tW,ZodUnion:tK,ZodDiscriminatedUnion:tJ,ZodIntersection:tY,ZodTuple:tX,ZodRecord:tQ,ZodMap:t0,ZodSet:t1,ZodFunction:t2,ZodLazy:t4,ZodLiteral:t9,ZodEnum:t3,ZodNativeEnum:t7,ZodPromise:t6,ZodEffects:t8,ZodTransformer:t8,ZodOptional:re,ZodNullable:rt,ZodDefault:rr,ZodCatch:rn,ZodNaN:ri,BRAND:ra,ZodBranded:rs,ZodPipeline:ro,ZodReadonly:ru,custom:rl,Schema:tm,ZodSchema:tm,late:rf,get ZodFirstPartyTypeKind(){return ag},coerce:{string:e=>tD.create({...e,coerce:!0}),number:e=>tF.create({...e,coerce:!0}),boolean:e=>tP.create({...e,coerce:!0}),bigint:e=>tR.create({...e,coerce:!0}),date:e=>tZ.create({...e,coerce:!0})},any:r_,array:rM,bigint:rm,boolean:rg,date:ry,discriminatedUnion:rA,effect:rB,enum:rZ,function:rF,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>rl(t=>t instanceof e,t),intersection:rT,lazy:rR,literal:rP,map:rI,nan:rp,nativeEnum:rz,never:rN,null:rw,nullable:rU,number:rh,object:rE,oboolean:()=>rg().optional(),onumber:()=>rh().optional(),optional:rL,ostring:()=>rd().optional(),pipeline:rq,preprocess:rV,promise:r$,record:rj,set:rD,strictObject:rk,string:rd,symbol:rv,transformer:rB,tuple:rC,undefined:rb,union:rO,unknown:rx,void:rS,NEVER:tn,ZodIssueCode:e5,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:e3});let rW=rG.string().min(1,"Required").max(75,"Must be 75 or fewer characters long").regex(/^[a-zA-Z0-9_.-]+$/,"Must only contains alphanumerical characters and special characters _ . -"),rK=rG.object({name:rW}),rH=rK.extend({project:rW}),rJ=rG.object({kind:rG.string().min(1,"Required"),spec:rG.record(rG.string(),rG.any())}),rY=rG.object({name:rG.string().optional(),description:rG.string().optional()}),rX=rG.object({display:rY.optional(),default:rG.boolean(),plugin:rJ});function rQ(e){return rG.object({display:rY.optional(),default:rG.boolean(),plugin:e})}let r0=rG.object({kind:rG.literal("Datasource"),metadata:rH,spec:rX}),r1=rG.object({kind:rG.literal("GlobalDatasource"),metadata:rK,spec:rX}),r2=rG.discriminatedUnion("kind",[r0,r1]),r4=rG.object({name:rG.string().min(1),spec:rX});function r9(e){return rG.object({name:rG.string().min(1),spec:rQ(e)})}let r5=rG.string().min(1,"Required").regex(z,"Must be a valid duration string"),r3=rG.object({name:rG.string().min(1,{message:"Required"}),description:rG.string().optional()}),r7=rG.object({kind:rG.string().min(1),spec:rG.object({plugin:rJ})}),r6=rG.object({name:rG.string().optional(),url:rG.string().min(1),tooltip:rG.string().optional(),renderVariables:rG.boolean().optional(),targetBlank:rG.boolean().optional()}),r8=rG.object({display:r3,plugin:rJ,queries:rG.array(r7).optional(),links:rG.array(r6).optional()});function ne(e){return rG.object({display:r3,plugin:e,queries:rG.array(r7).optional(),links:rG.array(r6).optional()})}let nt=rG.object({kind:rG.literal("Panel"),spec:r8});function nr(e){return rG.object({kind:rG.literal("Panel"),spec:ne(e)})}let nn=rG.object({groupId:rG.number(),panelDefinition:nt});function ni(e){return rG.object({groupId:rG.number(),panelDefinition:nr(e)})}let na=rG.object({actions:rG.array(rG.enum(["*","create","read","update","delete"])).nonempty("Must contains at least 1 action"),scopes:rG.array(rG.enum(["*","Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"])).nonempty("Must contains at least 1 scope")}),ns=rG.object({permissions:rG.array(na)}),no=rG.object({kind:rG.literal("Role"),metadata:rH,spec:ns}),nu=rG.object({kind:rG.literal("GlobalRole"),metadata:rK,spec:ns}),nc=rG.discriminatedUnion("kind",[no,nu]),nl=rG.object({kind:rG.enum(["User"]),name:rW}),nf=rG.object({role:rW,subjects:rG.array(nl).nonempty()}),nd=rG.object({kind:rG.literal("RoleBinding"),metadata:rH,spec:nf}),nh=rG.object({kind:rG.literal("GlobalRoleBinding"),metadata:rK,spec:nf}),np=rG.discriminatedUnion("kind",[nd,nh]),nm=rG.object({basicAuth:rG.object({username:rG.string().min(1),password:rG.string().optional(),passwordFile:rG.string().optional()}).superRefine((e,t)=>{e.password&&e.password.length>0&&e.passwordFile&&e.passwordFile.length>0&&(t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["password"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["passwordFile"]}))}).optional(),authorization:rG.object({type:rG.string().optional(),credentials:rG.string().optional(),credentialsFile:rG.string().optional()}).superRefine((e,t)=>{e.credentials&&e.credentials.length>0&&e.credentialsFile&&e.credentialsFile.length>0&&(t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentials"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentialsFile"]}))}).optional(),oauth:rG.object({clientID:rG.string().min(1),clientSecret:rG.string().optional(),clientSecretFile:rG.string().optional(),tokenURL:rG.string().min(1),scopes:rG.array(rG.string().nonempty()).default([]),endpointParams:rG.record(rG.string().nonempty(),rG.array(rG.string())).default({}).optional(),authStyle:rG.union([rG.literal(0),rG.literal(1),rG.literal(2)]).optional()}).superRefine((e,t)=>{e.clientSecret&&e.clientSecret.length>0&&e.clientSecretFile&&e.clientSecretFile.length>0&&(t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecret"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecretFile"]}))}).optional(),tlsConfig:rG.object({ca:rG.string().optional(),cert:rG.string().optional(),key:rG.string().optional(),caFile:rG.string().optional(),certFile:rG.string().optional(),keyFile:rG.string().optional(),serverName:rG.string().optional(),insecureSkipVerify:rG.boolean().optional()}).superRefine((e,t)=>{e.ca&&e.ca.length>0&&e.caFile&&e.caFile.length>0&&(t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["ca"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["caFile"]})),e.cert&&e.cert.length>0&&e.certFile&&e.certFile.length>0&&(t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["cert"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["certFile"]})),e.key&&e.key.length>0&&e.keyFile&&e.keyFile.length>0&&(t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["key"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["keyFile"]}))}).optional()}).superRefine((e,t)=>{e.basicAuth&&e.authorization&&e.oauth&&(t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["basicAuth"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["authorization"]}),t.addIssue({code:rG.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["oauth"]}))}),ng=rG.object({kind:rG.literal("Secret"),metadata:rH,spec:nm}),ny=rG.object({kind:rG.literal("GlobalSecret"),metadata:rK,spec:nm}),nv=rG.discriminatedUnion("kind",[ng,ny]),nb=rG.object({password:rG.string().optional()}),nw=rG.object({issuer:rG.string().optional(),email:rG.string().optional(),subject:rG.string().optional()}),n_=rG.object({firstName:rG.string().optional(),lastName:rG.string().optional(),nativeProvider:nb.optional(),oauthProviders:rG.array(nw).optional()}),nx=rG.object({kind:rG.literal("User"),metadata:rK,spec:n_}),nN=rG.object({name:rG.string().optional(),description:rG.string().optional(),hidden:rG.boolean().optional()}),nS=rG.object({name:rG.string().min(1),display:nN.optional(),defaultValue:rG.string().or(rG.array(rG.string())).optional(),allowAllValue:rG.boolean(),allowMultiple:rG.boolean(),customAllValue:rG.string().optional(),capturingRegexp:rG.string().optional(),sort:rG.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:rJ});function nM(e){return rG.object({name:rG.string().min(1),display:nN.optional(),defaultValue:rG.string().or(rG.array(rG.string())).optional(),allowAllValue:rG.boolean(),allowMultiple:rG.boolean(),customAllValue:rG.string().optional(),capturingRegexp:rG.string().optional(),sort:rG.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:e})}let nE=rG.object({kind:rG.literal("ListVariable"),spec:nS});function nk(e){return rG.object({kind:rG.literal("ListVariable"),spec:nM(e)})}let nO=rG.object({name:rG.string().min(1),display:nN.optional(),value:rG.string(),constant:rG.boolean().optional()}),nA=rG.object({kind:rG.literal("TextVariable"),spec:nO}),nT=rG.discriminatedUnion("kind",[nA,nE]);function nC(e){return rG.union([nA,nk(e)])}let nj=rG.object({kind:rG.literal("Variable"),metadata:rH,spec:nT}),nI=rG.object({kind:rG.literal("GlobalVariable"),metadata:rH,spec:nT}),nD=rG.discriminatedUnion("kind",[nj,nI]),nF=nT;function nR(e){return rG.discriminatedUnion("kind",[rG.object({kind:rG.literal("ListVariable"),spec:nM(e)}),rG.object({kind:rG.literal("TextVariable"),spec:nO})])}async function nP(...e){let t=await globalThis.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.clone().json();if(e.error)throw new n$(e.error,t.status);if(e.message)throw new n$(e.message,t.status)}let r=await t.clone().text();if(r)throw new n$(r,t.status);throw new nz(t)}return t}async function nZ(...e){let t=await nP(...e);if(!t.ok)throw new nz(t);return await t.json()}class nz extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,nz.prototype)}}class n$ extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,n$.prototype)}}function nB(e){return 0===Object.getOwnPropertyNames(e).length}function nL(e,t){let r=nU(t),n=e.panels[r];if(void 0===n)throw Error(`Could not resolve panels reference ${t.$ref}`);return n}function nU(e){return e.$ref.substring(14)}function nV(e){return{$ref:`#/spec/panels/${e}`}}function nq(e){return e.spec.spec?.display?.name?e.spec.spec.display.name:e.spec.display?.name?e.spec.display.name:e.metadata.name}function nG(e){return e.spec.spec?.display?.name?`${e.spec.spec.display.name} (ID: ${e.metadata.name})`:e.spec.display?.name?`${e.spec.display.name} (ID: ${e.metadata.name})`:e.metadata.name}var nW=r(70252);function nK(e){return"number"==typeof e}function nH(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function nJ(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function nY(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function nX(e){return e&&!0===e.constructor.prototype.isUnit||!1}function nQ(e){return"string"==typeof e}var n0=Array.isArray;function n1(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function n2(e){return Array.isArray(e)||n1(e)}function n4(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function n9(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function n5(e){return e&&!0===e.constructor.prototype.isRange||!1}function n3(e){return e&&!0===e.constructor.prototype.isIndex||!1}function n7(e){return"boolean"==typeof e}function n6(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function n8(e){return e&&!0===e.constructor.prototype.isHelp||!1}function ie(e){return"function"==typeof e}function it(e){return e instanceof Date}function ir(e){return e instanceof RegExp}function ii(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!nJ(e)&&!nY(e))}function ia(e){return null===e}function is(e){return void 0===e}function io(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function iu(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function ic(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function il(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function id(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function ih(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function ip(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function im(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function ig(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function iy(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function iv(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function ib(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function iw(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function i_(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function ix(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function iN(e){return e&&!0===e.constructor.prototype.isChain||!1}function iS(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":nH(e)?"BigNumber":nJ(e)?"Complex":nY(e)?"Fraction":n1(e)?"Matrix":nX(e)?"Unit":n3(e)?"Index":n5(e)?"Range":n6(e)?"ResultSet":iy(e)?e.type:iN(e)?"Chain":n8(e)?"Help":"Object":"function"===t?"Function":t}function iM(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return iM(e)});if(e instanceof Date)return new Date(e.valueOf());if(nH(e))return e;if(e instanceof RegExp)throw TypeError("Cannot clone "+e);return iE(e,iM)}function iE(e,t){var r={};for(var n in e)iA(e,n)&&(r[n]=t(e[n]));return r}function ik(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!ik(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!ik(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function iO(e,t,r){var n,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(n=r(),i=!1),n},set:function(e){n=e,i=!1},configurable:!0,enumerable:!0})}function iA(e,t){return e&&Object.hasOwnProperty.call(e,t)}function iT(e){return Object.keys(e).map(t=>e[t])}var iC=r(8317);function ij(e,t,r,n){function i(n){var i=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],a=e[i];void 0!==a&&(r[i]=a)}return r}(n,t.map(iD));return function(e,t,r){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==r[e])){var n=t.filter(e=>void 0===r[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function iI(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function iD(e){return e&&"?"===e[0]?e.slice(1):e}function iF(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function iR(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!iF(r))throw Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!iF(e))throw Error("Value must be an integer");e<0&&(e+=2**r),n="i".concat(r)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(n)}function iP(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var r,n,i="auto";if(t&&(t.notation&&(i=t.notation),nK(t)?r=t:nK(t.precision)&&(r=t.precision),t.wordSize)&&"number"!=typeof(n=t.wordSize))throw Error('Option "wordSize" must be a number');switch(i){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iZ(e),n="number"==typeof t?i$(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,s=a+(t||0);return i.length<s&&(i=i.concat(iB(s-i.length))),a<0&&(i=iB(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}(e,r);case"exponential":return iz(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=i$(iZ(e),t),n=r.exponent,i=r.coefficients,a=n%3==0?n:n<0?n-3-n%3:n-n%3;if(nK(t))for(;t>i.length||n-a+1>i.length;)i.push(0);else for(var s=Math.abs(n-a)-(i.length-1),o=0;o<s;o++)i.push(0);for(var u=Math.abs(n-a),c=1;u>0;)c++,u--;var l=i.slice(c).join(""),f=nK(t)&&l.length||l.match(/[1-9]/)?"."+l:"",d=i.slice(0,c).join("")+f+"e"+(n>=0?"+":"")+a.toString();return r.sign+d}(e,r);case"bin":return iR(e,2,n);case"oct":return iR(e,8,n);case"hex":return iR(e,16,n);case"auto":return(function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,a=iZ(e),s=t?i$(a,t):a;if(s.exponent<n||s.exponent>=i)return iz(e,t);var o=s.coefficients,u=s.exponent;o.length<t&&(o=o.concat(iB(t-o.length))),o=o.concat(iB(u-o.length+1+(o.length<t?t-o.length:0))),o=iB(-u).concat(o);var c=u>0?u:0;return c<o.length-1&&o.splice(c+1,0,"."),s.sign+o.join("")})(e,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function iZ(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===s.length&&(s.push(0),i++),{sign:r,coefficients:s,exponent:i}}function iz(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iZ(e),n=t?i$(r,t):r,i=n.coefficients,a=n.exponent;i.length<t&&(i=i.concat(iB(t-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function i$(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}return r}function iB(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var iL=Number.EPSILON||2220446049250313e-31;function iU(e,t,r){if(null==r)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<iL||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function iV(e,t,r){var n=new e.constructor(2),i="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!iF(r))throw Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function iq(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function iG(e,t){var r=function(e,t){var r;if("number"==typeof e)return iP(e,t);if(nH(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r="auto";if(void 0!==t&&(t.notation&&(r=t.notation),"number"==typeof t?f=t:t.precision&&(f=t.precision),t.wordSize)&&"number"!=typeof(d=t.wordSize))throw Error('Option "wordSize" must be a number');switch(r){case"fixed":return n=e,i=f,n.toFixed(i);case"exponential":return iq(e,f);case"engineering":return a=e,s=f,u=(o=a.e)%3==0?o:o<0?o-3-o%3:o-o%3,-1!==(l=(c=a.mul(Math.pow(10,-u))).toPrecision(s)).indexOf("e")&&(l=c.toString()),l+"e"+(o>=0?"+":"")+u.toString();case"bin":return iV(e,2,d);case"oct":return iV(e,8,d);case"hex":return iV(e,16,d);case"auto":var n,i,a,s,o,u,c,l,f,d,h=t&&void 0!==t.lowerExp?t.lowerExp:-3,p=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var m=e.toSignificantDigits(f),g=m.e;return(g>=h&&g<p?m.toFixed():iq(e,f)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,r){if(!Array.isArray(t))return iG(t,r);for(var n="[",i=t.length,a=0;a<i;a++)0!==a&&(n+=", "),n+=e(t[a],r);return n+"]"}(e,t);if(nQ(e))return'"'+e+'"';if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>'"'+r+'": '+iG(e[r],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function iW(e,t,r){if(!(this instanceof iW))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function iK(e,t,r){if(!(this instanceof iK))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function iH(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function iJ(e,t){if(0===t.length){if(Array.isArray(e))throw new iW(e.length,0)}else!function e(t,r,n){var i,a=t.length;if(a!==r[n])throw new iW(a,r[n]);if(n<r.length-1){var s=n+1;for(i=0;i<a;i++){if(!Array.isArray(t[i]))throw new iW(r.length-1,r.length,"<");e(t[i],r,s)}}else for(i=0;i<a;i++)if(Array.isArray(t[i]))throw new iW(r.length+1,r.length,">")}(e,t,0)}function iY(e,t){if(!nK(e)||!iF(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new iK(e,t)}function iX(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!nK(e)||!iF(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+iG(t)+")")}),function e(t,r,n,i){var a,s,o=t.length,u=r[n],c=Math.min(o,u);if(t.length=u,n<r.length-1){var l=n+1;for(a=0;a<c;a++)Array.isArray(s=t[a])||(s=[s],t[a]=s),e(s,r,l,i);for(a=c;a<u;a++)s=[],t[a]=s,e(s,r,l,i)}else{for(a=0;a<c;a++)for(;Array.isArray(t[a]);)t[a]=t[a][0];for(a=c;a<u;a++)t[a]=i}}(e,t,0,void 0!==r?r:0),e}function iQ(e,t){var r=i0(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(t%r==0)n[i]=-t/r;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function i0(e){return e.reduce((e,t)=>e*t,1)}function i1(e,t,r,n){var i=n||iH(e);if(r)for(var a=0;a<r;a++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,a;if(Array.isArray(t)){var s=n+1;for(i=0,a=t.length;i<a;i++)t[i]=e(t[i],r,s)}else for(var o=n;o<r;o++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function i2(e,t){for(var r,n=0,i=0;i<e.length;i++){var a=e[i],s=Array.isArray(a);if(0===i&&s&&(n=a.length),s&&a.length!==n)return;var o=s?i2(a,t):t(a);if(void 0===r)r=o;else if(r!==o)return"mixed"}return r}function i4(e,t){return -1!==e.indexOf(t)}function i9(e,t,r,n){if(!(this instanceof i9))throw SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}iW.prototype=RangeError(),iW.prototype.constructor=RangeError,iW.prototype.name="DimensionError",iW.prototype.isDimensionError=!0,iK.prototype=RangeError(),iK.prototype.constructor=RangeError,iK.prototype.name="IndexError",iK.prototype.isIndexError=!0,i9.prototype=Error(),i9.prototype.constructor=Error,i9.prototype.name="ArgumentsError",i9.prototype.isArgumentsError=!0;var i5={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},i3=["Matrix","Array"],i7=["number","BigNumber","Fraction"];function i6(e,t,r){var n;void 0!==e[t]&&(n=e[t],-1===r.indexOf(n))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map(e=>JSON.stringify(e)).join(", ")+".")}var i8,ae,at,ar,an,ai,aa,as,ao,au,ac,al,af,ad,ah,ap,am,ag,ay,av,ab="0123456789abcdef",aw="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",a_="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ax={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},aN=!0,aS="[DecimalError] ",aM=aS+"Invalid argument: ",aE=aS+"Precision limit exceeded",ak=aS+"crypto unavailable",aO="[object Decimal]",aA=Math.floor,aT=Math.pow,aC=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,aj=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,aI=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,aD=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,aF=aw.length-1,aR=a_.length-1,aP={toStringTag:aO};function aZ(e){var t,r,n,i=e.length-1,a="",s=e[0];if(i>0){for(a+=s,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(a+=aH(r)),a+=n;(r=7-(n=(s=e[t])+"").length)&&(a+=aH(r))}else if(0===s)return"0";for(;s%10==0;)s/=10;return a+s}function az(e,t,r){if(e!==~~e||e<t||e>r)throw Error(aM+e)}function a$(e,t,r,n){var i,a,s,o;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),a=aT(10,7-t),o=e[i]%a|0,null==n?t<3?(0==t?o=o/100|0:1==t&&(o=o/10|0),s=r<4&&99999==o||r>3&&49999==o||5e4==o||0==o):s=(r<4&&o+1==a||r>3&&o+1==a/2)&&(e[i+1]/a/100|0)==aT(10,t-2)-1||(o==a/2||0==o)&&(e[i+1]/a/100|0)==0:t<4?(0==t?o=o/1e3|0:1==t?o=o/100|0:2==t&&(o=o/10|0),s=(n||r<4)&&9999==o||!n&&r>3&&4999==o):s=((n||r<4)&&o+1==a||!n&&r>3&&o+1==a/2)&&(e[i+1]/a/1e3|0)==aT(10,t-3)-1,s}function aB(e,t,r){for(var n,i,a=[0],s=0,o=e.length;s<o;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=ab.indexOf(e.charAt(s++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}aP.absoluteValue=aP.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),aU(e)},aP.ceil=function(){return aU(new this.constructor(this),this.e+1,2)},aP.clampedTo=aP.clamp=function(e,t){var r=this.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(aM+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},aP.comparedTo=aP.cmp=function(e){var t,r,n,i,a=this.d,s=(e=new this.constructor(e)).d,o=this.s,u=e.s;if(!a||!s)return o&&u?o!==u?o:a===s?0:!a^o<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?o:s[0]?-u:0;if(o!==u)return o;if(this.e!==e.e)return this.e>e.e^o<0?1:-1;for(t=0,r=(n=a.length)<(i=s.length)?n:i;t<r;++t)if(a[t]!==s[t])return a[t]>s[t]^o<0?1:-1;return n===i?0:n>i^o<0?1:-1},aP.cosine=aP.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/a9(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=a4(e,1,t.times(i),new e(1));for(var a=r;a--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}(n,a5(n,r)),n.precision=e,n.rounding=t,aU(2==av||3==av?r.neg():r,e,t,!0)):new n(1):new n(NaN)},aP.cubeRoot=aP.cbrt=function(){var e,t,r,n,i,a,s,o,u,c,l=this.constructor;if(!this.isFinite()||this.isZero())return new l(this);for(aN=!1,(a=this.s*aT(this.s*this,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=aZ(this.d),(a=((e=this.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=aT(r,1/3),e=aA((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),s=(e=l.precision)+3;;)if(n=aL((c=(u=(o=n).times(o).times(o)).plus(this)).plus(this).times(o),c.plus(u),s+2,1),aZ(o.d).slice(0,s)===(r=aZ(n.d)).slice(0,s)){if("9999"!=(r=r.slice(s-3,s+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(aU(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(aU(o,e+1,0),o.times(o).times(o).eq(this))){n=o;break}s+=4,i=1}return aN=!0,aU(n,e,l.rounding,t)},aP.decimalPlaces=aP.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-aA(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},aP.dividedBy=aP.div=function(e){return aL(this,new this.constructor(e))},aP.dividedToIntegerBy=aP.divToInt=function(e){var t=this.constructor;return aU(aL(this,new t(e),0,1,1),t.precision,t.rounding)},aP.equals=aP.eq=function(e){return 0===this.cmp(e)},aP.floor=function(){return aU(new this.constructor(this),this.e+1,3)},aP.greaterThan=aP.gt=function(e){return this.cmp(e)>0},aP.greaterThanOrEqualTo=aP.gte=function(e){var t=this.cmp(e);return 1==t||0===t},aP.hyperbolicCosine=aP.cosh=function(){var e,t,r,n,i,a=this,s=a.constructor,o=new s(1);if(!a.isFinite())return new s(a.s?1/0:NaN);if(a.isZero())return o;r=s.precision,n=s.rounding,s.precision=r+Math.max(a.e,a.sd())+4,s.rounding=1,(i=a.d.length)<32?t=(1/a9(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=a4(s,1,a.times(t),new s(1),!0);for(var u,c=e,l=new s(8);c--;)u=a.times(a),a=o.minus(u.times(l.minus(u.times(l))));return aU(a,s.precision=r,s.rounding=n,!0)},aP.hyperbolicSine=aP.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=a4(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=a4(a,2,i=i.times(1/a9(5,e)),i,!0);for(var s,o=new a(5),u=new a(16),c=new a(20);e--;)s=i.times(i),i=i.times(o.plus(s.times(u.times(s).plus(c))))}return a.precision=t,a.rounding=r,aU(i,t,r,!0)},aP.hyperbolicTangent=aP.tanh=function(){var e,t,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,aL(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},aP.inverseCosine=aP.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return -1!==r?0===r?e.isNeg()?aW(t,n,i):new t(0):new t(NaN):e.isZero()?aW(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},aP.inverseHyperbolicCosine=aP.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,aN=!1,r=r.times(r).minus(1).sqrt().plus(r),aN=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},aP.inverseHyperbolicSine=aP.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,aN=!1,r=r.times(r).plus(1).sqrt().plus(r),aN=!0,n.precision=e,n.rounding=t,r.ln())},aP.inverseHyperbolicTangent=aP.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?aU(new a(i),e,t,!0):(a.precision=r=n-i.e,i=aL(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5)):new a(NaN)},aP.inverseSine=aP.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t)?0===t?((e=aW(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2))},aP.inverseTangent=aP.atan=function(){var e,t,r,n,i,a,s,o,u,c=this,l=c.constructor,f=l.precision,d=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);else if(c.abs().eq(1)&&f+4<=aR)return(s=aW(l,f+4,d).times(.25)).s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=aR)return(s=aW(l,f+4,d).times(.5)).s=c.s,s}for(l.precision=o=f+10,l.rounding=1,e=r=Math.min(28,o/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(aN=!1,t=Math.ceil(o/7),n=1,u=c.times(c),s=new l(c),i=c;-1!==e;)if(i=i.times(u),a=s.minus(i.div(n+=2)),i=i.times(u),void 0!==(s=a.plus(i.div(n+=2))).d[t])for(e=t;s.d[e]===a.d[e]&&e--;);return r&&(s=s.times(2<<r-1)),aN=!0,aU(s,l.precision=f,l.rounding=d,!0)},aP.isFinite=function(){return!!this.d},aP.isInteger=aP.isInt=function(){return!!this.d&&aA(this.e/7)>this.d.length-2},aP.isNaN=function(){return!this.s},aP.isNegative=aP.isNeg=function(){return this.s<0},aP.isPositive=aP.isPos=function(){return this.s>0},aP.isZero=function(){return!!this.d&&0===this.d[0]},aP.lessThan=aP.lt=function(e){return 0>this.cmp(e)},aP.lessThanOrEqualTo=aP.lte=function(e){return 1>this.cmp(e)},aP.logarithm=aP.log=function(e){var t,r,n,i,a,s,o,u=this.constructor,c=u.precision,l=u.rounding;if(null==e)e=new u(10),t=!0;else{if(r=(e=new u(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new u(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(n=r[0];n%10==0;)n/=10;i=1!==n}if(aN=!1,a$((o=aL(a=a0(this,s=c+5),t?aG(u,s+10):a0(e,s),s,1)).d,n=c,l))do if(s+=10,o=aL(a=a0(this,s),t?aG(u,s+10):a0(e,s),s,1),!i){+aZ(o.d).slice(n+1,n+15)+1==1e14&&(o=aU(o,c+1,0));break}while(a$(o.d,n+=10,l));return aN=!0,aU(o,c,l)},aP.minus=aP.sub=function(e){var t,r,n,i,a,s,o,u,c,l,f,d,h=this.constructor;if(e=new h(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new h(e.d||this.s!==e.s?this:NaN):e=new h(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(c=this.d,d=e.d,o=h.precision,u=h.rounding,!c[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(this)}return aN?aU(e,o,u):e}if(r=aA(e.e/7),l=aA(this.e/7),c=c.slice(),a=l-r){for((f=a<0)?(t=c,a=-a,s=d.length):(t=d,r=l,s=c.length),a>(n=Math.max(Math.ceil(o/7),s)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(s=d.length))&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){f=c[n]<d[n];break}a=0}for(f&&(t=c,c=d,d=t,e.s=-e.s),s=c.length,n=d.length-s;n>0;--n)c[s++]=0;for(n=d.length;n>a;){if(c[--n]<d[n]){for(i=n;i&&0===c[--i];)c[i]=1e7-1;--c[i],c[n]+=1e7}c[n]-=d[n]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=aq(c,r),aN?aU(e,o,u):e):new h(3===u?-0:0)},aP.modulo=aP.mod=function(e){var t,r=this.constructor;return(e=new r(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(aN=!1,9==r.modulo?(t=aL(this,e.abs(),0,3,1),t.s*=e.s):t=aL(this,e,0,r.modulo,1),t=t.times(e),aN=!0,this.minus(t)):aU(new r(this),r.precision,r.rounding):new r(NaN)},aP.naturalExponential=aP.exp=function(){return aQ(this)},aP.naturalLogarithm=aP.ln=function(){return a0(this)},aP.negated=aP.neg=function(){var e=new this.constructor(this);return e.s=-e.s,aU(e)},aP.plus=aP.add=function(e){var t,r,n,i,a,s,o,u,c,l,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new f(e.d||this.s===e.s?this:NaN)):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(c=this.d,l=e.d,o=f.precision,u=f.rounding,!c[0]||!l[0])return l[0]||(e=new f(this)),aN?aU(e,o,u):e;if(a=aA(this.e/7),n=aA(e.e/7),c=c.slice(),i=a-n){for(i<0?(r=c,i=-i,s=l.length):(r=l,n=a,s=c.length),i>(s=(a=Math.ceil(o/7))>s?a+1:s+1)&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((s=c.length)-(i=l.length)<0&&(i=s,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/1e7|0,c[i]%=1e7;for(t&&(c.unshift(t),++n),s=c.length;0==c[--s];)c.pop();return e.d=c,e.e=aq(c,n),aN?aU(e,o,u):e},aP.precision=aP.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(aM+e);return this.d?(t=aK(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},aP.round=function(){var e=this.constructor;return aU(new e(this),this.e+1,e.rounding)},aP.sine=aP.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:a4(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=a4(e,2,t=t.times(1/a9(5,r)),t);for(var i,a=new e(5),s=new e(16),o=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(s.times(i).minus(o))));return t}(n,a5(n,r)),n.precision=e,n.rounding=t,aU(av>2?r.neg():r,e,t,!0)):new n(NaN)},aP.squareRoot=aP.sqrt=function(){var e,t,r,n,i,a,s=this.d,o=this.e,u=this.s,c=this.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?this:1/0);for(aN=!1,0==(u=Math.sqrt(+this))||u==1/0?(((t=aZ(s)).length+o)%2==0&&(t+="0"),u=Math.sqrt(t),o=aA((o+1)/2)-(o<0||o%2),n=new c(t=u==1/0?"5e"+o:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+o)):n=new c(u.toString()),r=(o=c.precision)+3;;)if(n=(a=n).plus(aL(this,a,r+2,1)).times(.5),aZ(a.d).slice(0,r)===(t=aZ(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(aU(n,o+1,1),e=!n.times(n).eq(this));break}if(!i&&(aU(a,o+1,0),a.times(a).eq(this))){n=a;break}r+=4,i=1}return aN=!0,aU(n,o,c.rounding,e)},aP.tangent=aP.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=aL(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,aU(2==av||4==av?r.neg():r,e,t,!0)):new n(NaN)},aP.times=aP.mul=function(e){var t,r,n,i,a,s,o,u,c,l=this.constructor,f=this.d,d=(e=new l(e)).d;if(e.s*=this.s,!f||!f[0]||!d||!d[0])return new l(!e.s||f&&!f[0]&&!d||d&&!d[0]&&!f?NaN:!f||!d?e.s/0:0*e.s);for(r=aA(this.e/7)+aA(e.e/7),(u=f.length)<(c=d.length)&&(a=f,f=d,d=a,s=u,u=c,c=s),a=[],n=s=u+c;n--;)a.push(0);for(n=c;--n>=0;){for(t=0,i=u+n;i>n;)o=a[i]+d[n]*f[i-n-1]+t,a[i--]=o%1e7|0,t=o/1e7|0;a[i]=(a[i]+t)%1e7|0}for(;!a[--s];)a.pop();return t?++r:a.shift(),e.d=a,e.e=aq(a,r),aN?aU(e,l.precision,l.rounding):e},aP.toBinary=function(e,t){return a3(this,2,e,t)},aP.toDecimalPlaces=aP.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(az(e,0,1e9),void 0===t?t=n.rounding:az(t,0,8),aU(r,e+r.e+1,t))},aP.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=aV(n,!0):(az(e,0,1e9),void 0===t?t=i.rounding:az(t,0,8),r=aV(n=aU(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},aP.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=aV(this):(az(e,0,1e9),void 0===t?t=i.rounding:az(t,0,8),r=aV(n=aU(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},aP.toFraction=function(e){var t,r,n,i,a,s,o,u,c,l,f,d,h=this.d,p=this.constructor;if(!h)return new p(this);if(c=r=new p(1),n=u=new p(0),s=(a=(t=new p(n)).e=aK(h)-this.e-1)%7,t.d[0]=aT(10,s<0?7+s:s),null==e)e=a>0?t:c;else{if(!(o=new p(e)).isInt()||o.lt(c))throw Error(aM+o);e=o.gt(t)?a>0?t:c:o}for(aN=!1,o=new p(aZ(h)),l=p.precision,p.precision=a=7*h.length*2;f=aL(o,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=o.minus(f.times(i)),o=i;return i=aL(e.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=this.s,d=1>aL(c,n,a,1).minus(this).abs().cmp(aL(u,r,a,1).minus(this).abs())?[c,n]:[u,r],p.precision=l,aN=!0,d},aP.toHexadecimal=aP.toHex=function(e,t){return a3(this,16,e,t)},aP.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:az(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(aN=!1,r=aL(r,e,0,t,1).times(e),aN=!0,aU(r)):(e.s=r.s,r=e),r},aP.toNumber=function(){return+this},aP.toOctal=function(e,t){return a3(this,8,e,t)},aP.toPower=aP.pow=function(e){var t,r,n,i,a,s,o=this,u=o.constructor,c=+(e=new u(e));if(!o.d||!e.d||!o.d[0]||!e.d[0])return new u(aT(+o,c));if((o=new u(o)).eq(1))return o;if(n=u.precision,a=u.rounding,e.eq(1))return aU(o,n,a);if((t=aA(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=aJ(u,o,r,n),e.s<0?new u(1).div(i):aU(i,n,a);if((s=o.s)<0){if(t<e.d.length-1)return new u(NaN);if((1&e.d[t])==0&&(s=1),0==o.e&&1==o.d[0]&&1==o.d.length)return o.s=s,o}return(t=0!=(r=aT(+o,c))&&isFinite(r)?new u(r+"").e:aA(c*(Math.log("0."+aZ(o.d))/Math.LN10+o.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?s/0:0):(aN=!1,u.rounding=o.s=1,r=Math.min(12,(t+"").length),(i=aQ(e.times(a0(o,n+r)),n)).d&&a$((i=aU(i,n+5,1)).d,n,a)&&(t=n+10,+aZ((i=aU(aQ(e.times(a0(o,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=aU(i,n+1,0))),i.s=s,aN=!0,u.rounding=a,aU(i,n,a))},aP.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=aV(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(az(e,1,1e9),void 0===t?t=i.rounding:az(t,0,8),r=aV(n=aU(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},aP.toSignificantDigits=aP.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(az(e,1,1e9),void 0===t?t=r.rounding:az(t,0,8)),aU(new r(this),e,t)},aP.toString=function(){var e=this.constructor,t=aV(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},aP.truncated=aP.trunc=function(){return aU(new this.constructor(this),this.e+1,1)},aP.valueOf=aP.toJSON=function(){var e=this.constructor,t=aV(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var aL=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,s,o,u){var c,l,f,d,h,p,m,g,y,v,b,w,_,x,N,S,M,E,k,O,A=n.constructor,T=n.s==i.s?1:-1,C=n.d,j=i.d;if(!C||!C[0]||!j||!j[0])return new A(!n.s||!i.s||(C?j&&C[0]==j[0]:!j)?NaN:C&&0==C[0]||!j?0*T:T/0);for(u?(h=1,l=n.e-i.e):(u=1e7,h=7,l=aA(n.e/h)-aA(i.e/h)),k=j.length,M=C.length,v=(y=new A(T)).d=[],f=0;j[f]==(C[f]||0);f++);if(j[f]>(C[f]||0)&&l--,null==a?(x=a=A.precision,s=A.rounding):x=o?a+(n.e-i.e)+1:a,x<0)v.push(1),p=!0;else{if(x=x/h+2|0,f=0,1==k){for(d=0,j=j[0],x++;(f<M||d)&&x--;f++)N=d*u+(C[f]||0),v[f]=N/j|0,d=N%j|0;p=d||f<M}else{for((d=u/(j[0]+1)|0)>1&&(j=e(j,d,u),C=e(C,d,u),k=j.length,M=C.length),S=k,w=(b=C.slice(0,k)).length;w<k;)b[w++]=0;(O=j.slice()).unshift(0),E=j[0],j[1]>=u/2&&++E;do d=0,(c=t(j,b,k,w))<0?(_=b[0],k!=w&&(_=_*u+(b[1]||0)),(d=_/E|0)>1?(d>=u&&(d=u-1),g=(m=e(j,d,u)).length,w=b.length,1==(c=t(m,b,g,w))&&(d--,r(m,k<g?O:j,g,u))):(0==d&&(c=d=1),m=j.slice()),(g=m.length)<w&&m.unshift(0),r(b,m,w,u),-1==c&&(w=b.length,(c=t(j,b,k,w))<1&&(d++,r(b,k<w?O:j,w,u))),w=b.length):0===c&&(d++,b=[0]),v[f++]=d,c&&b[0]?b[w++]=C[S]||0:(b=[C[S]],w=1);while((S++<M||void 0!==b[0])&&x--);p=void 0!==b[0]}v[0]||v.shift()}if(1==h)y.e=l,ay=p;else{for(f=1,d=v[0];d>=10;d/=10)f++;y.e=f+l*h-1,aU(y,o?a+y.e+1:a,s,p)}return y}}();function aU(e,t,r,n){var i,a,s,o,u,c,l,f,d,h=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,o=f[0];o>=10;o/=10)i++;if((a=t-i)<0)a+=7,s=t,u=(l=f[d=0])/aT(10,i-s-1)%10|0;else if((d=Math.ceil((a+1)/7))>=(o=f.length))if(n){for(;o++<=d;)f.push(0);l=u=0,i=1,a%=7,s=a-7+1}else break e;else{for(i=1,l=o=f[d];o>=10;o/=10)i++;a%=7,u=(s=a-7+i)<0?0:l/aT(10,i-s-1)%10|0}if(n=n||t<0||void 0!==f[d+1]||(s<0?l:l%aT(10,i-s-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(a>0?s>0?l/aT(10,i-s):0:f[d-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=aT(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==a?(f.length=d,o=1,d--):(f.length=d+1,o=aT(10,7-a),f[d]=s>0?(l/aT(10,i-s)%aT(10,s)|0)*o:0),c)for(;;)if(0==d){for(a=1,s=f[0];s>=10;s/=10)a++;for(s=f[0]+=o,o=1;s>=10;s/=10)o++;a!=o&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[d]+=o,1e7!=f[d])break;f[d--]=0,o=1}for(a=f.length;0===f[--a];)f.pop()}return aN&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e<h.minE&&(e.e=0,e.d=[0])),e}function aV(e,t,r){if(!e.isFinite())return a1(e);var n,i=e.e,a=aZ(e.d),s=a.length;return t?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+aH(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+aH(-i-1)+a,r&&(n=r-s)>0&&(a+=aH(n))):i>=s?(a+=aH(i+1-s),r&&(n=r-i-1)>0&&(a=a+"."+aH(n))):((n=i+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(a+="."),a+=aH(n))),a}function aq(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function aG(e,t,r){if(t>aF)throw aN=!0,r&&(e.precision=r),Error(aE);return aU(new e(aw),t,1,!0)}function aW(e,t,r){if(t>aR)throw Error(aE);return aU(new e(a_),t,r,!0)}function aK(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function aH(e){for(var t="";e--;)t+="0";return t}function aJ(e,t,r,n){var i,a=new e(1),s=Math.ceil(n/7+4);for(aN=!1;;){if(r%2&&a7((a=a.times(t)).d,s)&&(i=!0),0===(r=aA(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}a7((t=t.times(t)).d,s)}return aN=!0,a}function aY(e){return 1&e.d[e.d.length-1]}function aX(e,t,r){for(var n,i,a=new e(t[0]),s=0;++s<t.length;){if(!(i=new e(t[s])).s){a=i;break}((n=a.cmp(i))===r||0===n&&a.s===r)&&(a=i)}return a}function aQ(e,t){var r,n,i,a,s,o,u,c=0,l=0,f=0,d=e.constructor,h=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(aN=!1,u=p):u=t,o=new d(.03125);e.e>-2;)e=e.times(o),f+=5;for(u+=n=Math.log(aT(2,f))/Math.LN10*2+5|0,r=a=s=new d(1),d.precision=u;;){if(a=aU(a.times(e),u,1),r=r.times(++l),aZ((o=s.plus(aL(a,r,u,1))).d).slice(0,u)===aZ(s.d).slice(0,u)){for(i=f;i--;)s=aU(s.times(s),u,1);if(null!=t)return d.precision=p,s;if(!(c<3&&a$(s.d,u-n,h,c)))return aU(s,d.precision=p,h,aN=!0);d.precision=u+=10,r=a=o=new d(1),l=0,c++}s=o}}function a0(e,t){var r,n,i,a,s,o,u,c,l,f,d,h=1,p=e,m=p.d,g=p.constructor,y=g.rounding,v=g.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(aN=!1,l=v):l=t,g.precision=l+=10,n=(r=aZ(m)).charAt(0),!(15e14>Math.abs(a=p.e)))return c=aG(g,l+2,v).times(a+""),p=a0(new g(n+"."+r.slice(1)),l-10).plus(c),g.precision=v,null==t?aU(p,v,y,aN=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=aZ((p=p.times(e)).d)).charAt(0),h++;for(a=p.e,n>1?(p=new g("0."+r),a++):p=new g(n+"."+r.slice(1)),f=p,u=s=p=aL(p.minus(1),p.plus(1),l,1),d=aU(p.times(p),l,1),i=3;;){if(s=aU(s.times(d),l,1),aZ((c=u.plus(aL(s,new g(i),l,1))).d).slice(0,l)===aZ(u.d).slice(0,l)){if(u=u.times(2),0!==a&&(u=u.plus(aG(g,l+2,v).times(a+""))),u=aL(u,new g(h),l,1),null!=t)return g.precision=v,u;if(!a$(u.d,l-10,y,o))return aU(u,g.precision=v,y,aN=!0);g.precision=l+=10,c=s=p=aL(f.minus(1),f.plus(1),l,1),d=aU(p.times(p),l,1),i=o=1}u=c,i+=2}}function a1(e){return String(e.s*e.s/0)}function a2(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),aN&&(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 a4(e,t,r,n,i){var a,s,o,u,c=e.precision,l=Math.ceil(c/7);for(aN=!1,u=r.times(r),o=new e(n);;){if(s=aL(o.times(u),new e(t++*t++),c,1),o=i?n.plus(s):n.minus(s),n=aL(s.times(u),new e(t++*t++),c,1),void 0!==(s=o.plus(n)).d[l]){for(a=l;s.d[a]===o.d[a]&&a--;);if(-1==a)break}a=o,o=n,n=s,s=a}return aN=!0,s.d.length=l+1,s}function a9(e,t){for(var r=e;--t;)r*=e;return r}function a5(e,t){var r,n=t.s<0,i=aW(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return av=n?4:1,t;if((r=t.divToInt(i)).isZero())av=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return av=aY(r)?n?2:3:n?4:1,t;av=aY(r)?n?1:4:n?3:2}return t.minus(i).abs()}function a3(e,t,r,n){var i,a,s,o,u,c,l,f,d,h=e.constructor,p=void 0!==r;if(p?(az(r,1,1e9),void 0===n?n=h.rounding:az(n,0,8)):(r=h.precision,n=h.rounding),e.isFinite()){for(s=(l=aV(e)).indexOf("."),p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,s>=0&&(l=l.replace(".",""),(d=new h(1)).e=l.length-s,d.d=aB(aV(d),10,i),d.e=d.d.length),a=u=(f=aB(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(s<0?a--:((e=new h(e)).d=f,e.e=a,f=(e=aL(e,d,r,n,0,i)).d,a=e.e,c=ay),s=f[r],o=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==s||c)&&(0===n||n===(e.s<0?3:2)):s>o||s===o&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(s=0,l="";s<u;s++)l+=ab.charAt(f[s]);if(p){if(u>1)if(16==t||8==t){for(s=16==t?4:3,--u;u%s;u++)l+="0";for(u=(f=aB(l,i,t)).length;!f[u-1];--u);for(s=1,l="1.";s<u;s++)l+=ab.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)l="0"+l;l="0."+l}else if(++a>u)for(a-=u;a--;)l+="0";else a<u&&(l=l.slice(0,a)+"."+l.slice(a))}else l=p?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=a1(e);return e.s<0?"-"+l:l}function a7(e,t){if(e.length>t)return e.length=t,!0}function a6(e){return new this(e).abs()}function a8(e){return new this(e).acos()}function se(e){return new this(e).acosh()}function st(e,t){return new this(e).plus(t)}function sr(e){return new this(e).asin()}function sn(e){return new this(e).asinh()}function si(e){return new this(e).atan()}function sa(e){return new this(e).atanh()}function ss(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?aW(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=aW(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(aL(e,t,a,1)),t=aW(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(aL(e,t,a,1)):(r=aW(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function so(e){return new this(e).cbrt()}function su(e){return aU(e=new this(e),e.e+1,2)}function sc(e,t,r){return new this(e).clamp(t,r)}function sl(e){if(!e||"object"!=typeof e)throw Error(aS+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<a.length;t+=3)if(r=a[t],i&&(this[r]=ax[r]),void 0!==(n=e[r]))if(aA(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(aM+r+": "+n);if(r="crypto",i&&(this[r]=ax[r]),void 0!==(n=e[r]))if(!0===n||!1===n||0===n||1===n)if(n)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(ak);else this[r]=!1;else throw Error(aM+r+": "+n);return this}function sf(e){return new this(e).cos()}function sd(e){return new this(e).cosh()}function sh(e,t){return new this(e).div(t)}function sp(e){return new this(e).exp()}function sm(e){return aU(e=new this(e),e.e+1,3)}function sg(){var e,t,r=new this(0);for(e=0,aN=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return aN=!0,new this(1/0);r=t}return aN=!0,r.sqrt()}function sy(e){return e instanceof sZ||e&&e.toStringTag===aO||!1}function sv(e){return new this(e).ln()}function sb(e,t){return new this(e).log(t)}function sw(e){return new this(e).log(2)}function s_(e){return new this(e).log(10)}function sx(){return aX(this,arguments,-1)}function sN(){return aX(this,arguments,1)}function sS(e,t){return new this(e).mod(t)}function sM(e,t){return new this(e).mul(t)}function sE(e,t){return new this(e).pow(t)}function sk(e){var t,r,n,i,a=0,s=new this(1),o=[];if(void 0===e?e=this.precision:az(e,1,1e9),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=t[a])>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:o[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);a<n;)(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,a):(o.push(i%1e7),a+=4);a=n/4}else throw Error(ak);else for(;a<n;)o[a++]=1e7*Math.random()|0;for(n=o[--a],e%=7,n&&e&&(i=aT(10,7-e),o[a]=(n/i|0)*i);0===o[a];a--)o.pop();if(a<0)r=0,o=[0];else{for(r=-1;0===o[0];r-=7)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return s.e=r,s.d=o,s}function sO(e){return aU(e=new this(e),e.e+1,this.rounding)}function sA(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sT(e){return new this(e).sin()}function sC(e){return new this(e).sinh()}function sj(e){return new this(e).sqrt()}function sI(e,t){return new this(e).sub(t)}function sD(){var e=0,t=arguments,r=new this(t[0]);for(aN=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return aN=!0,aU(r,this.precision,this.rounding)}function sF(e){return new this(e).tan()}function sR(e){return new this(e).tanh()}function sP(e){return aU(e=new this(e),e.e+1,1)}aP[Symbol.for("nodejs.util.inspect.custom")]=aP.toString,aP[Symbol.toStringTag]="Decimal";var sZ=aP.constructor=function e(t){var r,n,i;function a(e){var t,r,n;if(!(this instanceof a))return new a(e);if(this.constructor=a,sy(e)){this.s=e.s,aN?!e.d||e.e>a.maxE?(this.e=NaN,this.d=null):e.e<a.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(n=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;aN?t>a.maxE?(this.e=NaN,this.d=null):t<a.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return a2(this,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===r&&(e=e.slice(1)),this.s=1),aD.test(e)?a2(this,e):function(e,t){var r,n,i,a,s,o,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),aD.test(t))return a2(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(aj.test(t))r=16,t=t.toLowerCase();else if(aC.test(t))r=2;else if(aI.test(t))r=8;else throw Error(aM+t);for((a=t.search(/p/i))>0?(u=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),s=(a=t.indexOf("."))>=0,n=e.constructor,s&&(a=(o=(t=t.replace(".","")).length)-a,i=aJ(n,new n(r),a,2*a)),a=l=(c=aB(t,r,1e7)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=aq(c,l),e.d=c,aN=!1,s&&(e=aL(e,i,4*o)),u&&(e=e.times(54>Math.abs(u)?aT(2,u):sZ.pow(2,u))),aN=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,a2(this,e.toString());throw Error(aM+e)}if(a.prototype=aP,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=sl,a.clone=e,a.isDecimal=sy,a.abs=a6,a.acos=a8,a.acosh=se,a.add=st,a.asin=sr,a.asinh=sn,a.atan=si,a.atanh=sa,a.atan2=ss,a.cbrt=so,a.ceil=su,a.clamp=sc,a.cos=sf,a.cosh=sd,a.div=sh,a.exp=sp,a.floor=sm,a.hypot=sg,a.ln=sv,a.log=sb,a.log10=s_,a.log2=sw,a.max=sx,a.min=sN,a.mod=sS,a.mul=sM,a.pow=sE,a.random=sk,a.round=sO,a.sign=sA,a.sin=sT,a.sinh=sC,a.sqrt=sj,a.sub=sI,a.sum=sD,a.tan=sF,a.tanh=sR,a.trunc=sP,void 0===t&&(t={}),t&&!0!==t.defaults)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return a.config(t),a}(ax);aw=new sZ(aw),a_=new sZ(a_);var sz={createBigNumberClass:ij("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=sZ.clone({precision:r.precision,modulo:sZ.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0})},s$={createMatrixClass:ij("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0})},sB={MatrixDependencies:s$,createDenseMatrixClass:ij("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");if(t&&!nQ(t))throw Error("Invalid datatype: "+t);if(n1(e))"DenseMatrix"===e.type?(this._data=iM(e._data),this._size=iM(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&n0(e.data)&&n0(e.size))this._data=e.data,this._size=e.size,iJ(this._data,this._size),this._datatype=t||e.datatype;else if(n0(e))this._data=function e(t){for(var r=0,n=t.length;r<n;r++){var i=t[r];n0(i)?t[r]=e(i):i&&!0===i.isMatrix&&(t[r]=e(i.valueOf()))}return t}(e),this._size=iH(this._data),iJ(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+iS(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;n0(n);)n=n[0];return n}return e._size=t.slice(0),e._data=iX(e._data,e._size,r),e}function i(e,t,r){for(var i=e._size.slice(0),a=!1;i.length<t.length;)i.push(0),a=!0;for(var s=0,o=t.length;s<o;s++)t[s]>i[s]&&(i[s]=t[s],a=!0);a&&n(e,i,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return i2(this._data,iS)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return function(e,t){if(!n3(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new iW(n.length,e._size.length);for(var i=t.min(),a=t.max(),s=0,o=e._size.length;s<o;s++)iY(i[s],e._size[s]),iY(a[s],e._size[s]);return new r(function e(t,r,n,i){var a=i===n-1,s=r.dimension(i);return a?s.map(function(e){return iY(e,t.length),t[e]}).valueOf():s.map(function(a){return iY(a,t.length),e(t[a],r,n,i+1)}).valueOf()}(e._data,t,n.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var a,s=t.size(),o=t.isScalar();if(n1(r)?(a=r.size(),r=r.valueOf()):a=iH(r),o){if(0!==a.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(s.length<e._size.length)throw new iW(s.length,e._size.length,"<");if(a.length<s.length){for(var u=0,c=0;1===s[u]&&1===a[u];)u++;for(;1===s[u];)c++,u++;r=i1(r,s.length,c,a)}if(!ik(s,a))throw new iW(s,a,">");i(e,t.max().map(function(e){return e+1}),n);var l=s.length;!function e(t,r,n,i,a){var s=a===i-1,o=r.dimension(a);s?o.forEach(function(e,r){iY(e),t[e]=n[r[0]]}):o.forEach(function(s,o){iY(s),e(t[s],r,n[o[0]],i,a+1)})}(e._data,t,r,l,0)}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!n0(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iW(e.length,this._size.length);for(var t=0;t<e.length;t++)iY(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var a=e[n];iY(a,r.length),r=r[a]}return r},r.prototype.set=function(e,t,r){if(!n0(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new iW(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),r);var n,a,s,o=this._data;for(n=0,a=e.length-1;n<a;n++)iY(s=e[n],o.length),o=o[s];return iY(s=e[e.length-1],o.length),o[s]=t,this},r.prototype.resize=function(e,t,r){if(!n2(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return n(r?this.clone():this,i,t)},r.prototype.reshape=function(e,t){var r=t?this.clone():this;r._data=function(e,t){var r=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new iW(0,n,"!=");var i=i0(t=iQ(t,n));if(n!==i)throw new iW(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var a=t[i];r=[];for(var s=n.length/a,o=0;o<s;o++)r.push(n.slice(o*a,(o+1)*a));n=r}return n}(r,t)}catch(e){if(e instanceof iW)throw new iW(i,n,"!=");throw e}}(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=iQ(e,n),r},r.prototype.clone=function(){return new r({data:iM(this._data),size:iM(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=function r(n,i){return n0(n)?n.map(function(e,t){return r(e,i.concat(t))}):e(n,i,t)}(this._data,[]),i=void 0!==this._datatype?i2(n,iS):void 0;return new r(n,i)},r.prototype.forEach=function(e){var t=this;!function r(n,i){n0(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){var e=function* e(t,r){if(n0(t))for(var n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,a=function(n){var a=i.map(e=>[e[n]]);t.push(new r(a,e._datatype))},s=0;s<n[1];s++)a(s);return t},r.prototype.toArray=function(){return iM(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return iG(this._data,e)},r.prototype.toString=function(){return iG(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(nH(e)&&(e=e.toNumber()),!nK(e)||!iF(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=Math.min(this._size[0]-n,this._size[1]-t),a=[],s=0;s<i;s++)a[s]=this._data[s+n][s+t];return new r({data:a,size:[i],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!n0(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(nH(e)&&(e=e.toNumber()),!nK(e)||!iF(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(nH(n)&&(n=n.toNumber()),!nK(n)||!iF(n))throw TypeError("The parameter k must be an integer number")}else n=0;var a,s=n>0?n:0,o=n<0?-n:0,u=e[0],c=e[1],l=Math.min(u-o,c-s);if(n0(t)){if(t.length!==l)throw Error("Invalid value array length");a=function(e){return t[e]}}else if(n1(t)){var f=t.size();if(1!==f.length||f[0]!==l)throw Error("Invalid matrix length");a=function(e){return t.get([e])}}else a=function(){return t};i||(i=nH(a(0))?a(0).mul(0):0);var d=[];if(e.length>0){d=iX(d,e,i);for(var h=0;h<l;h++)d[h+o][h+s]=a(h)}return new r({data:d,size:[u,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!nK(e)||!iF(e)||!nK(t)||!iF(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return iY(e,this._size[0]),iY(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},r},{isClass:!0})};let sL=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},sU=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},sV=function(e){let t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;let r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},sq=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},sG=function(){throw SyntaxError("Invalid Param")};function sW(e,t){let r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let sK={re:0,im:0},sH=function(e,t){if(null==e)sK.re=sK.im=0;else if(void 0!==t)sK.re=e,sK.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)sK.re=e.re,sK.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return sJ.INFINITY;sK.re=e.abs*Math.cos(e.arg),sK.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return sJ.INFINITY;sK.re=e.r*Math.cos(e.phi),sK.im=e.r*Math.sin(e.phi)}else 2===e.length?(sK.re=e[0],sK.im=e[1]):sG();break;case"string":sK.im=sK.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&sG();for(let e=0;e<r.length;e++){let t=r[e];" "===t||" "===t||"\n"===t||("+"===t?n++:"-"===t?i++:("i"===t||"I"===t?(n+i===0&&sG()," "===r[e+1]||isNaN(r[e+1])?sK.im+=parseFloat((i%2?"-":"")+"1"):(sK.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&sG(),"i"===r[e+1]||"I"===r[e+1]?(sK.im+=parseFloat((i%2?"-":"")+t),e++):sK.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&sG();break;case"number":sK.im=0,sK.re=e;break;default:sG()}return isNaN(sK.re)||isNaN(sK.im),sK};function sJ(e,t){if(!(this instanceof sJ))return new sJ(e,t);let r=sH(e,t);this.re=r.re,this.im=r.im}sJ.prototype={re:0,im:0,sign:function(){let e=sq(this.re,this.im);return new sJ(this.re/e,this.im/e)},add:function(e,t){let r=sH(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?sJ.NAN:sJ.INFINITY:new sJ(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=sH(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?sJ.NAN:sJ.INFINITY:new sJ(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=sH(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=0===this.re&&0===this.im,s=0===r.re&&0===r.im;return n&&s||i&&a?sJ.NAN:n||i?sJ.INFINITY:0===r.im&&0===this.im?new sJ(this.re*r.re,0):new sJ(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=sH(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=0===this.re&&0===this.im,s=0===r.re&&0===r.im;if(a&&s||n&&i)return sJ.NAN;if(s||n)return sJ.INFINITY;if(a||i)return sJ.ZERO;if(0===r.im)return new sJ(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let e=r.re/r.im,t=r.re*e+r.im;return new sJ((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=r.im/r.re,t=r.im*e+r.re;return new sJ((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=sH(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return sJ.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new sJ(Math.pow(this.re,r.re),0);else if(0===this.re)switch((r.re%4+4)%4){case 0:return new sJ(Math.pow(this.im,r.re),0);case 1:return new sJ(0,Math.pow(this.im,r.re));case 2:return new sJ(-Math.pow(this.im,r.re),0);case 3:return new sJ(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return sJ.ZERO;let i=Math.atan2(this.im,this.re),a=sW(this.re,this.im),s=Math.exp(r.re*a-r.im*i),o=r.im*a+r.re*i;return new sJ(s*Math.cos(o),s*Math.sin(o))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new sJ(Math.sqrt(e),0);else return new sJ(0,Math.sqrt(-e));let r=Math.sqrt(.5*(sq(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new sJ(r,t<0?-n:n):new sJ(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new sJ(e,0):new sJ(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new sJ(Math.expm1(e)*Math.cos(t)+sV(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new sJ(Math.log(e),0):new sJ(sW(e,t),Math.atan2(t,e))},abs:function(){return sq(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new sJ(Math.sin(e)*sL(t),Math.cos(e)*sU(t))},cos:function(){let e=this.re,t=this.im;return new sJ(Math.cos(e)*sL(t),-Math.sin(e)*sU(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+sL(t);return new sJ(Math.sin(e)/r,sU(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-sL(t);return new sJ(-Math.sin(e)/r,sU(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*sL(2*t)+.5*Math.cos(2*e);return new sJ(Math.cos(e)*sL(t)/r,Math.sin(e)*sU(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*sL(2*t)-.5*Math.cos(2*e);return new sJ(Math.sin(e)*sL(t)/r,-Math.cos(e)*sU(t)/r)},asin:function(){let e=this.re,t=this.im,r=new sJ(t*t-e*e+1,-2*e*t).sqrt(),n=new sJ(r.re-t,r.im+e).log();return new sJ(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new sJ(t*t-e*e+1,-2*e*t).sqrt(),n=new sJ(r.re-t,r.im+e).log();return new sJ(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new sJ(0,1/0);if(-1===t)return new sJ(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new sJ((1-t*t-e*e)/r,-2*e/r).log();return new sJ(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new sJ(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new sJ(e/r,-t/r).atan():new sJ(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new sJ(0,1/0);let r=e*e+t*t;return 0!==r?new sJ(e/r,-t/r).acos():new sJ(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new sJ(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new sJ(e/r,-t/r).asin():new sJ(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new sJ(sU(e)*Math.cos(t),sL(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new sJ(sL(e)*Math.cos(t),sU(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=sL(e)+Math.cos(t);return new sJ(sU(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=sL(e)-Math.cos(t);return new sJ(sU(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-sL(2*e);return new sJ(-2*sU(e)*Math.cos(t)/r,2*sL(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+sL(2*e);return new sJ(2*sL(e)*Math.cos(t)/r,-2*sU(e)*Math.sin(t)/r)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;let t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){let e=this.acos();if(e.im<=0){let t=e.re;e.re=-e.im,e.im=t}else{let t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){let e=this.re,t=this.im,r=1-e,n=1+e,i=r*r+t*t,a=0!==i?new sJ((n*r-t*t)/i,(t*r+n*t)/i):new sJ(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=sW(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,e>1&&0===t&&(a.im=-a.im),a},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new sJ(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new sJ(e/r,-t/r).atanh():new sJ(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t)return new sJ(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let r=e*e+t*t;return 0!==r?new sJ(e/r,-t/r).asinh():new sJ(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return sJ.INFINITY;let r=e*e+t*t;return 0!==r?new sJ(e/r,-t/r).acosh():new sJ(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return sJ.INFINITY;if(this.isInfinite())return sJ.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new sJ(e/r,-t/r)},conjugate:function(){return new sJ(this.re,-this.im)},neg:function(){return new sJ(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new sJ(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new sJ(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new sJ(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=sH(e,t);return Math.abs(r.re-this.re)<=sJ.EPSILON&&Math.abs(r.im-this.im)<=sJ.EPSILON},clone:function(){return new sJ(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<sJ.EPSILON&&(e=0),Math.abs(t)<sJ.EPSILON&&(t=0),0===t)?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},sJ.ZERO=new sJ(0,0),sJ.ONE=new sJ(1,0),sJ.I=new sJ(0,1),sJ.PI=new sJ(Math.PI,0),sJ.E=new sJ(Math.E,0),sJ.INFINITY=new sJ(1/0,1/0),sJ.NAN=new sJ(NaN,NaN),sJ.EPSILON=1e-15;var sY=ij("Complex",[],()=>(sJ.prototype.type="Complex",sJ.prototype.isComplex=!0,sJ.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},sJ.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},sJ.prototype.format=function(e){var t=this.im,r=this.re,n=iP(this.re,e),i=iP(this.im,e),a=nK(e)?e:e?e.precision:null;if(null!==a){var s=Math.pow(10,-a);Math.abs(r/t)<s&&(r=0),Math.abs(t/r)<s&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},sJ.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return sJ(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(nK(r)){if(nX(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),nK(n))return new sJ({r,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},sJ.prototype.valueOf=sJ.prototype.toString,sJ.fromJSON=function(e){return new sJ(e)},sJ.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},sJ),{isClass:!0}),sX={s:1,n:0,d:1};function sQ(e,t){if(isNaN(e=parseInt(e,10)))throw s3();return e*t}function s0(e,t){if(0===t)throw s5();var r=Object.create(s9.prototype);r.s=e<0?-1:1;var n=s4(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function s1(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var s2=function(e,t){var r,n=0,i=1,a=1,s=0,o=0,u=0,c=1,l=1,f=0,d=1,h=1,p=1;if(null==e);else if(void 0!==t){if(a=(n=e)*(i=t),n%1!=0||i%1!=0)throw s7()}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,i=e.d,"s"in e&&(n*=e.s);else if(0 in e)n=e[0],1 in e&&(i=e[1]);else throw s3();a=n*i;break;case"number":if(e<0&&(a=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(l=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=l);d<=1e7&&p<=1e7;){if(e===(r=(f+h)/(d+p))){d+p<=1e7?(n=f+h,i=d+p):p>d?(n=h,i=p):(n=f,i=d);break}e>r?(f+=h,d+=p):(h+=f,p+=d),d>1e7?(n=h,i=p):(n=f,i=d)}n*=l}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(null===(d=e.match(/\d+|./g)))throw s3();if("-"===d[f]?(a=-1,f++):"+"===d[f]&&f++,d.length===f+1?o=sQ(d[f++],a):"."===d[f+1]||"."===d[f]?("."!==d[f]&&(s=sQ(d[f++],a)),(++f+1===d.length||"("===d[f+1]&&")"===d[f+3]||"'"===d[f+1]&&"'"===d[f+3])&&(o=sQ(d[f],a),c=Math.pow(10,d[f].length),f++),("("===d[f]&&")"===d[f+2]||"'"===d[f]&&"'"===d[f+2])&&(u=sQ(d[f+1],a),l=Math.pow(10,d[f+1].length)-1,f+=3)):"/"===d[f+1]||":"===d[f+1]?(o=sQ(d[f],a),c=sQ(d[f+2],1),f+=3):"/"===d[f+3]&&" "===d[f+1]&&(s=sQ(d[f],a),o=sQ(d[f+2],a),c=sQ(d[f+4],1),f+=5),d.length<=f){a=n=u+(i=c*l)*s+l*o;break}default:throw s3()}if(0===i)throw s5();sX.s=a<0?-1:1,sX.n=Math.abs(n),sX.d=Math.abs(i)};function s4(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function s9(e,t){if(s2(e,t),!(this instanceof s9))return s0(sX.s*sX.n,sX.d);e=s4(sX.d,sX.n),this.s=sX.s,this.n=sX.n/e,this.d=sX.d/e}var s5=function(){return Error("Division by Zero")},s3=function(){return Error("Invalid argument")},s7=function(){return Error("Parameters must be integer")};s9.prototype={s:1,n:0,d:1,abs:function(){return s0(this.n,this.d)},neg:function(){return s0(-this.s*this.n,this.d)},add:function(e,t){return s2(e,t),s0(this.s*this.n*sX.d+sX.s*this.d*sX.n,this.d*sX.d)},sub:function(e,t){return s2(e,t),s0(this.s*this.n*sX.d-sX.s*this.d*sX.n,this.d*sX.d)},mul:function(e,t){return s2(e,t),s0(this.s*sX.s*this.n*sX.n,this.d*sX.d)},div:function(e,t){return s2(e,t),s0(this.s*sX.s*this.n*sX.d,this.d*sX.n)},clone:function(){return s0(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new s9(NaN);if(void 0===e)return s0(this.s*this.n%this.d,1);if(s2(e,t),0===sX.n&&0===this.d)throw s5();return s0(this.s*(sX.d*this.n)%(sX.n*this.d),sX.d*this.d)},gcd:function(e,t){return s2(e,t),s0(s4(sX.n,this.n)*s4(sX.d,this.d),sX.d*this.d)},lcm:function(e,t){return(s2(e,t),0===sX.n&&0===this.n)?s0(0,1):s0(sX.n*this.n,s4(sX.n,this.n)*s4(sX.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s9(NaN):s0(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s9(NaN):s0(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s9(NaN):s0(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return s2(e,t),s0(this.s*Math.round(this.n*sX.d/(this.d*sX.n))*sX.n,sX.d)},inverse:function(){return s0(this.s*this.d,this.n)},pow:function(e,t){if(s2(e,t),1===sX.d)if(sX.s<0)return s0(Math.pow(this.s*this.d,sX.n),Math.pow(this.n,sX.n));else return s0(Math.pow(this.s*this.n,sX.n),Math.pow(this.d,sX.n));if(this.s<0)return null;var r=s1(this.n),n=s1(this.d),i=1,a=1;for(var s in r)if("1"!==s){if("0"===s){i=0;break}if(r[s]*=sX.n,r[s]%sX.d!=0)return null;r[s]/=sX.d,i*=Math.pow(s,r[s])}for(var s in n)if("1"!==s){if(n[s]*=sX.n,n[s]%sX.d!=0)return null;n[s]/=sX.d,a*=Math.pow(s,n[s])}return sX.s<0?s0(a,i):s0(i,a)},equals:function(e,t){return s2(e,t),this.s*this.n*sX.d==sX.s*sX.n*this.d},compare:function(e,t){s2(e,t);var r=this.s*this.n*sX.d-sX.s*sX.n*this.d;return(0<r)-(r<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),n=1;n<r.length;n++){for(var i=s0(r[n-1],1),a=n-2;a>=0;a--)i=i.inverse().add(r[a]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return s2(e,t),!(!(sX.n*this.d)||this.n*sX.d%(sX.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>2e3)return 0;return n}(0,r),i=function(e,t,r){for(var n=1,i=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0}(0,r,n),a=this.s<0?"-":"";if(a+=t/r|0,t%=r,(t*=10)&&(a+="."),n){for(var s=i;s--;)a+=t/r|0,t%=r,t*=10;a+="(";for(var s=n;s--;)a+=t/r|0,t%=r,t*=10;a+=")"}else for(var s=e;t&&s--;)a+=t/r|0,t%=r,t*=10;return a}};var s6=ij("Fraction",[],()=>(s9.prototype.type="Fraction",s9.prototype.isFraction=!0,s9.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},s9.fromJSON=function(e){return new s9(e)},s9),{isClass:!0}),s8=r(27554);function oe(e,t){return!!e&&"object"==typeof e&&(!!iA(or,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function ot(e){return"object"==typeof e&&e&&e.constructor===Object}var or={length:!0,name:!0},on={toString:!0,valueOf:!0,toLocaleString:!0};class oi{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){var t,r,n=this.wrappedObject;if(ot(n)&&oe(n,e))return n[e];if("function"==typeof n[e]&&(t=n,r=e,!(null==t||"function"!=typeof t[r]||iA(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(iA(on,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,r){if(ot(e)&&oe(e,t))return e[t]=r;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}}function oa(e){return!!e&&(e instanceof Map||e instanceof oi||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var os=function(){return os=s8.create,s8};function oo(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function ou(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function oc(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var ol={BigNumberDependencies:sz,ComplexDependencies:{createComplexClass:sY},DenseMatrixDependencies:sB,FractionDependencies:{createFractionClass:s6},createTyped:ij("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=os();return a.types=[{name:"number",test:nK},{name:"Complex",test:nJ},{name:"BigNumber",test:nH},{name:"Fraction",test:nY},{name:"Unit",test:nX},{name:"string",test:nQ},{name:"Chain",test:iN},{name:"Array",test:n0},{name:"Matrix",test:n1},{name:"DenseMatrix",test:n4},{name:"SparseMatrix",test:n9},{name:"Range",test:n5},{name:"Index",test:n3},{name:"boolean",test:n7},{name:"ResultSet",test:n6},{name:"Help",test:n8},{name:"function",test:ie},{name:"Date",test:it},{name:"RegExp",test:ir},{name:"null",test:ia},{name:"undefined",test:is},{name:"AccessorNode",test:io},{name:"ArrayNode",test:iu},{name:"AssignmentNode",test:ic},{name:"BlockNode",test:il},{name:"ConditionalNode",test:id},{name:"ConstantNode",test:ih},{name:"FunctionNode",test:im},{name:"FunctionAssignmentNode",test:ip},{name:"IndexNode",test:ig},{name:"Node",test:iy},{name:"ObjectNode",test:iv},{name:"OperatorNode",test:ib},{name:"ParenthesisNode",test:iw},{name:"RangeNode",test:i_},{name:"SymbolNode",test:ix},{name:"Map",test:oa},{name:"Object",test:ii}],a.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||oo(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||ou(e),new r(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return r||ou(e),new r(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||ou(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||oc(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||oo(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||oc(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||ou(e);try{return new r(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||oo(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||oc(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],a})},of="equalScalar",od=ij(of,["typed","config"],e=>{var{typed:t,config:r}=e;return t(of,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return iU(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var n;return n=r.epsilon,iU(e.re,t.re,n)&&iU(e.im,t.im,n)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw Error("Cannot compare units with different base");return this(e.value,t.value)}})});ij(of,["typed","config"],e=>{var{typed:t,config:r}=e;return t(of,{"number, number":function(e,t){return iU(e,t,r.epsilon)}})});var oh={typedDependencies:ol,createEqualScalar:od},op=ij("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!nQ(t))throw Error("Invalid datatype: "+t);if(n1(e)){var r,n,s;r=this,n=e,s=t,"SparseMatrix"===n.type?(r._values=n._values?iM(n._values):void 0,r._index=iM(n._index),r._ptr=iM(n._ptr),r._size=iM(n._size),r._datatype=s||n._datatype):a(r,n.valueOf(),s||n._datatype)}else if(e&&n0(e.index)&&n0(e.ptr)&&n0(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(n0(e))a(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+iS(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function a(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,s=0,o=r,u=0;if(nQ(i)&&(o=t.find(r,[i,i])||r,u=t.convert(0,i)),a>0){var c=0;do{e._ptr.push(e._index.length);for(var l=0;l<a;l++){var f=n[l];if(n0(f)){if(0===c&&s<f.length&&(s=f.length),c<f.length){var d=f[c];o(d,u)||(e._values.push(d),e._index.push(l))}}else 0===c&&s<1&&(s=1),o(f,u)||(e._values.push(f),e._index.push(l))}c++}while(c<s)}e._ptr.push(e._index.length),e._size=[a,s]}function s(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function o(e,t,r,n,i,a,s){i.splice(e,0,n),a.splice(e,0,t);for(var o=r+1;o<s.length;o++)s[o]++}function u(e,n,i,a){var s,o,u,c=a||0,l=r,f=0;nQ(e._datatype)&&(l=t.find(r,[e._datatype,e._datatype])||r,f=t.convert(0,e._datatype),c=t.convert(c,e._datatype));var d=!l(c,f),h=e._size[0],p=e._size[1];if(i>p){for(o=p;o<i;o++)if(e._ptr[o]=e._values.length,d)for(s=0;s<h;s++)e._values.push(c),e._index.push(s);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,n>h){if(d){var m=0;for(o=0;o<p;o++){e._ptr[o]=e._ptr[o]+m,u=e._ptr[o+1]+m;var g=0;for(s=h;s<n;s++,g++)e._values.splice(u+g,0,c),e._index.splice(u+g,0,s),m++}e._ptr[p]=e._values.length}}else if(n<h){var y=0;for(o=0;o<p;o++){e._ptr[o]=e._ptr[o]-y;var v=e._ptr[o],b=e._ptr[o+1]-y;for(u=v;u<b;u++)(s=e._index[u])>n-1&&(e._values.splice(u,1),e._index.splice(u,1),y++)}e._ptr[o]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){var a,s,o=n[0],u=n[1],c=[];for(a=0;a<o;a++)for(s=0,c[a]=[];s<u;s++)c[a][s]=0;for(s=0;s<u;s++)for(var l=r[s],f=r[s+1],d=l;d<f;d++)c[a=t[d]][s]=e?i?iM(e[d]):e[d]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return i2(this._values,iS)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!n3(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,a,s,o=t.size();if(o.length!==e._size.length)throw new iW(o.length,e._size.length);var u=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)iY(u[r],e._size[r]),iY(c[r],e._size[r]);var l=e._values,f=e._index,d=e._ptr,h=t.dimension(0),p=t.dimension(1),m=[],g=[];h.forEach(function(e,t){g[e]=t[0],m[e]=!0});var y=l?[]:void 0,v=[],b=[];return p.forEach(function(e){for(b.push(v.length),a=d[e],s=d[e+1];a<s;a++)!0===m[r=f[a]]&&(v.push(g[r]),y&&y.push(l[a]))}),b.push(v.length),new i({values:y,index:v,ptr:b,size:o,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,a=t.size(),s=t.isScalar();if(n1(r)?(i=r.size(),r=r.toArray()):i=iH(r),s){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==a.length&&2!==a.length)throw new iW(a.length,e._size.length,"<");if(i.length<a.length){for(var o=0,u=0;1===a[o]&&1===i[o];)o++;for(;1===a[o];)u++,o++;r=i1(r,a.length,u,i)}if(!ik(a,i))throw new iW(a,i,">");if(1===a.length)t.dimension(0).forEach(function(t,i){iY(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){iY(t),l.forEach(function(a,s){iY(a),e.set([t,a],r[i[0]][s[0]],n)})})}}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!n0(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iW(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];iY(t,this._size[0]),iY(r,this._size[1]);var n=s(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!n0(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iW(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var a=e[0],c=e[1],l=this._size[0],f=this._size[1],d=r,h=0;nQ(this._datatype)&&(d=t.find(r,[this._datatype,this._datatype])||r,h=t.convert(0,this._datatype)),(a>l-1||c>f-1)&&(u(this,Math.max(a+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),iY(a,l),iY(c,f);var p=s(a,this._ptr[c],this._ptr[c+1],this._index);return p<this._ptr[c+1]&&this._index[p]===a?d(n,h)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var a=t+1;a<i.length;a++)i[a]--}(p,c,this._values,this._index,this._ptr):this._values[p]=n:o(p,a,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!n2(e))throw TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(e){if(!nK(e)||!iF(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+iG(n)+")")}),u(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!n0(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!nK(t)||!iF(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+iG(e)+")")});var r=this._size[0]*this._size[1],n=(e=iQ(e,r))[0]*e[1];if(r!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var a=[],u=0;u<i._ptr.length;u++)for(var c=0;c<i._ptr[u+1]-i._ptr[u];c++)a.push(u);for(var l=i._values.slice(),f=i._index.slice(),d=0;d<i._index.length;d++){var h=f[d],p=a[d],m=h*i._size[1]+p;a[d]=m%e[1],f[d]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var g=0;g<i._ptr.length;g++)i._ptr[g]=0;for(var y=0;y<l.length;y++){var v=f[y],b=a[y],w=l[y];o(s(v,i._ptr[b],i._ptr[b+1],i._index),v,b,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?iM(this._values):void 0,index:iM(this._index),ptr:iM(this._ptr),size:iM(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var a=this;return function(e,n,a,s,o,u,c){var l=[],f=[],d=[],h=r,p=0;nQ(e._datatype)&&(h=t.find(r,[e._datatype,e._datatype])||r,p=t.convert(0,e._datatype));for(var m=function(e,t,r){e=u(e,t,r),h(e,p)||(l.push(e),f.push(t))},g=0;g<=o;g++){d.push(l.length);var y=e._ptr[g],v=e._ptr[g+1];if(c)for(var b=y;b<v;b++){var w=e._index[b];w>=0&&w<=a&&m(e._values[b],w-n,g-s)}else{for(var _={},x=y;x<v;x++)_[e._index[x]]=e._values[x];for(var N=n;N<=a;N++)m(N in _?_[N]:0,N-n,g-s)}}return d.push(l.length),new i({values:l,index:f,ptr:d,size:[a-n+1,o-s+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(t,r,n){return e(t,[r,n],a)},n)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var a=this._ptr[i],s=this._ptr[i+1];if(t)for(var o=a;o<s;o++){var u=this._index[o];e(this._values[o],[u,i],this)}else{for(var c={},l=a;l<s;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var r=this._ptr[t],n=this._ptr[t+1],i=r;i<n;i++){var a=this._index[i];yield{value:this._values[i],index:[a,t]}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+iG(t,e)+" x "+iG(r,e)+"] density: "+iG(n,e)+"\n",a=0;a<r;a++)for(var s=this._ptr[a],o=this._ptr[a+1],u=s;u<o;u++)i+="\n ("+iG(this._index[u],e)+", "+iG(a,e)+") ==> "+(this._values?iG(this._values[u],e):"X");return i},i.prototype.toString=function(){return iG(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(nH(e)&&(e=e.toNumber()),!nK(e)||!iF(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],a=this._size[1],s=Math.min(n-r,a-t),o=[],u=[],c=[];c[0]=0;for(var l=t;l<a&&o.length<s;l++)for(var f=this._ptr[l],d=this._ptr[l+1],h=f;h<d;h++){var p=this._index[h];if(p===l-t+r){o.push(this._values[h]),u[o.length-1]=p-r;break}}return c.push(o.length),new i({values:o,index:u,ptr:c,size:[s,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,a,s,o){if(!n0(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(nH(e)&&(e=e.toNumber()),!nK(e)||!iF(e)||e<1)throw Error("Size values must be positive integers");return e}),a){if(nH(a)&&(a=a.toNumber()),!nK(a)||!iF(a))throw TypeError("The parameter k must be an integer number")}else a=0;var u,c=r,l=0;nQ(o)&&(c=t.find(r,[o,o])||r,l=t.convert(0,o));var f=a>0?a:0,d=a<0?-a:0,h=e[0],p=e[1],m=Math.min(h-d,p-f);if(n0(n)){if(n.length!==m)throw Error("Invalid value array length");u=function(e){return n[e]}}else if(n1(n)){var g=n.size();if(1!==g.length||g[0]!==m)throw Error("Invalid matrix length");u=function(e){return n.get([e])}}else u=function(){return n};for(var y=[],v=[],b=[],w=0;w<p;w++){b.push(y.length);var _=w-f;if(_>=0&&_<m){var x=u(_);c(x,l)||(v.push(_+d),y.push(x))}}return b.push(y.length),new i({values:y,index:v,ptr:b,size:[h,p]})},i.prototype.swapRows=function(e,t){if(!nK(e)||!iF(e)||!nK(t)||!iF(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return iY(e,this._size[0]),iY(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){for(var a=n[e],s=n[e+1],o=a;o<s;o++)i(r[o],t[o])},i._swapRows=function(e,t,r,n,i,a){for(var o=0;o<r;o++){var u=a[o],c=a[o+1],l=s(e,u,c,i),f=s(t,u,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===t){if(n){var d=n[l];n[l]=n[f],n[f]=d}continue}if(l<c&&i[l]===e&&(f>=c||i[f]!==t)){var h=n?n[l]:void 0;i.splice(f,0,t),n&&n.splice(f,0,h),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1);continue}if(f<c&&i[f]===t&&(l>=c||i[l]!==e)){var p=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,p),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i},{isClass:!0}),om="matrix",og=ij(om,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(om,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,t){return a([],e,t)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}}),oy=ij("algorithm01",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a,s,o=e._data,u=e._size,c=e._datatype,l=r._values,f=r._index,d=r._ptr,h=r._size,p=r._datatype;if(u.length!==h.length)throw new iW(u.length,h.length);if(u[0]!==h[0]||u[1]!==h[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+h+")");if(!l)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=u[0],g=u[1],y="string"==typeof c&&c===p?c:void 0,v=y?t.find(n,[y,y]):n,b=[];for(a=0;a<m;a++)b[a]=[];var w=[],_=[];for(s=0;s<g;s++){for(var x=s+1,N=d[s],S=d[s+1],M=N;M<S;M++)w[a=f[M]]=i?v(l[M],o[a][s]):v(o[a][s],l[M]),_[a]=x;for(a=0;a<m;a++)_[a]===x?b[a][s]=w[a]:b[a][s]=o[a][s]}return e.createDenseMatrix({data:b,size:[m,g],datatype:y})}}),ov=ij("algorithm04",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a,s,o,u,c,l,f=e._values,d=e._index,h=e._ptr,p=e._size,m=e._datatype,g=n._values,y=n._index,v=n._ptr,b=n._size,w=n._datatype;if(p.length!==b.length)throw new iW(p.length,b.length);if(p[0]!==b[0]||p[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+b+")");var _=p[0],x=p[1],N=r,S=0,M=i;"string"==typeof m&&m===w&&(a=m,N=t.find(r,[a,a]),S=t.convert(0,a),M=t.find(i,[a,a]));var E=f&&g?[]:void 0,k=[],O=[],A=f&&g?[]:void 0,T=f&&g?[]:void 0,C=[],j=[];for(o=0;o<x;o++){O[o]=k.length;var I=o+1;for(c=h[o],l=h[o+1],u=c;u<l;u++)s=d[u],k.push(s),C[s]=I,A&&(A[s]=f[u]);for(c=v[o],l=v[o+1],u=c;u<l;u++)if(C[s=y[u]]===I){if(A){var D=M(A[s],g[u]);N(D,S)?C[s]=null:A[s]=D}}else k.push(s),j[s]=I,T&&(T[s]=g[u]);if(A&&T)for(u=O[o];u<k.length;)C[s=k[u]]===I?(E[u]=A[s],u++):j[s]===I?(E[u]=T[s],u++):k.splice(u,1)}return O[x]=k.length,e.createSparseMatrix({values:E,index:k,ptr:O,size:[_,x],datatype:a})}}),ob=ij("algorithm10",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:r}=e;return function(e,n,i,a){var s,o=e._values,u=e._index,c=e._ptr,l=e._size,f=e._datatype;if(!o)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=l[0],h=l[1],p=i;"string"==typeof f&&(s=f,n=t.convert(n,s),p=t.find(i,[s,s]));for(var m=[],g=[],y=[],v=0;v<h;v++){for(var b=v+1,w=c[v],_=c[v+1],x=w;x<_;x++){var N=u[x];g[N]=o[x],y[N]=b}for(var S=0;S<d;S++)0===v&&(m[S]=[]),y[S]===b?m[S][v]=a?p(n,g[S]):p(g[S],n):m[S][v]=n}return new r({data:m,size:[d,h],datatype:s})}}),ow=ij("algorithm13",["typed"],e=>{var{typed:t}=e;return function(e,r,n){var i,a=e._data,s=e._size,o=e._datatype,u=r._data,c=r._size,l=r._datatype,f=[];if(s.length!==c.length)throw new iW(s.length,c.length);for(var d=0;d<s.length;d++){if(s[d]!==c[d])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");f[d]=s[d]}var h=n;"string"==typeof o&&o===l&&(i=o,h=t.find(n,[i,i]));var p=f.length>0?function e(t,r,n,i,a,s){var o=[];if(r===n.length-1)for(var u=0;u<i;u++)o[u]=t(a[u],s[u]);else for(var c=0;c<i;c++)o[c]=e(t,r+1,n,n[r+1],a[c],s[c]);return o}(h,0,f,f[0],a,u):[];return e.createDenseMatrix({data:p,size:f,datatype:i})}}),o_=ij("algorithm14",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a,s=e._data,o=e._size,u=e._datatype,c=n;"string"==typeof u&&(a=u,r=t.convert(r,a),c=t.find(n,[a,a]));var l=o.length>0?function e(t,r,n,i,a,s,o){var u=[];if(r===n.length-1)for(var c=0;c<i;c++)u[c]=o?t(s,a[c]):t(a[c],s);else for(var l=0;l<i;l++)u[l]=e(t,r+1,n,n[r+1],a[l],s,o);return u}(c,0,o,o[0],s,r,i):[];return e.createDenseMatrix({data:l,size:iM(o),datatype:a})}});function ox(e,t){var r;if(!iF(e)||!iF(t))throw Error("Parameters in function gcd must be integer numbers");for(;0!==t;)r=e%t,e=t,t=r;return e<0?-e:e}ox.signature="number, number";let{gcd:oN}=function e(t,r){var n,i,a,s=(0,nW.Z)({},i5,r);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var o=((n={isNumber:nK,isComplex:nJ,isBigNumber:nH,isFraction:nY,isUnit:nX,isString:nQ,isArray:n0,isMatrix:n1,isCollection:n2,isDenseMatrix:n4,isSparseMatrix:n9,isRange:n5,isIndex:n3,isBoolean:n7,isResultSet:n6,isHelp:n8,isFunction:ie,isDate:it,isRegExp:ir,isObject:ii,isNull:ia,isUndefined:is,isAccessorNode:io,isArrayNode:iu,isAssignmentNode:ic,isBlockNode:il,isConditionalNode:id,isConstantNode:ih,isFunctionAssignmentNode:ip,isFunctionNode:im,isIndexNode:ig,isNode:iy,isObjectNode:iv,isOperatorNode:ib,isParenthesisNode:iw,isRangeNode:i_,isSymbolNode:ix,isChain:iN}).on=(i=new iC).on.bind(i),n.off=i.off.bind(i),n.once=i.once.bind(i),n.emit=i.emit.bind(i),n);o.config=function(e,t){function r(r){if(!r)return iE(e,iM);var n=iE(e,iM);i6(r,"matrix",i3),i6(r,"number",i7),function e(t,r){if(Array.isArray(r))throw TypeError("Arrays are not supported by deepExtend");for(var n in r)if(iA(r,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(r[n]&&r[n].constructor===Object)void 0===t[n]&&(t[n]={}),t[n]&&t[n].constructor===Object?e(t[n],r[n]):t[n]=r[n];else if(Array.isArray(r[n]))throw TypeError("Arrays are not supported by deepExtend");else t[n]=r[n];return t}(e,r);var i=iE(e,iM);return t("config",i,n,iE(r,iM)),i}return r.MATRIX_OPTIONS=i3,r.NUMBER_OPTIONS=i7,Object.keys(i5).forEach(t=>{Object.defineProperty(r,t,{get:()=>e[t],enumerable:!0,configurable:!0})}),r}(s,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};var u={},c=function(e,t,r,n){function i(e,t){t&&"function"==typeof t.transform?(r.expression.transform[e]=t.transform,iA(o,e)||(r.expression.mathWithTransform[e]=t.transform)):(delete r.expression.transform[e],iA(o,e)||(r.expression.mathWithTransform[e]=t))}function a(e){return"function"==typeof e&&"object"==typeof e.signatures}function s(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction}var o={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(t,u){var c=arguments.length;if(1!==c&&2!==c)throw new i9("import",c,1,2);u||(u={});var l={};for(var f in!function e(t,r,n){if(Array.isArray(r))r.forEach(r=>e(t,r));else if("object"==typeof r)for(var i in r)iA(r,i)&&e(t,r[i],i);else if(iI(r)||void 0!==n){var a=iI(r)?s(r)?r.fn+".transform":r.fn:n;if(iA(t,a)&&t[a]!==r&&!u.silent)throw Error('Cannot import "'+a+'" twice');t[a]=r}else if(!u.silent)throw TypeError("Factory, Object, or Array expected")}(l,t),l)if(iA(l,f)){var d,h=l[f];if(iI(h))!function(t,i){var u,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(i4(c,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(c));var l=s(t)?r.expression.transform:r,f=c in r.expression.transform,d=iA(l,c)?l[c]:void 0,h=function(){var n={};t.dependencies.map(iD).forEach(e=>{if(i4(e,"."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=r:"mathWithTransform"===e?n.mathWithTransform=r.expression.mathWithTransform:"classes"===e?n.classes=r:n[e]=r[e]});var s=t(n);if(s&&"function"==typeof s.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===d||i.override)return s;if(a(d)&&a(s))return e(d,s);if(i.silent)return d;throw Error('Cannot import "'+c+'": already exists')};t.meta&&!1===t.meta.lazy?l[c]=h():iO(l,c,h),d&&f?function(e){delete r.expression.transform[e],iA(o,e)?delete r.expression.mathWithTransform[e]:r.expression.mathWithTransform[e]=r[e]}(c):!s(t)&&(-1!==(u=t).fn.indexOf(".")||iA(o,u.fn)||u.meta&&u.meta.isClass)||iO(r.expression.mathWithTransform,c,()=>l[c]),n[c]=t,r.emit("import",c,h)}(h,u);else{if("function"==typeof(d=h)||"number"==typeof d||"string"==typeof d||"boolean"==typeof d||null===d||nX(d)||nJ(d)||nH(d)||nY(d)||n1(d)||Array.isArray(d))!function(t,s,o){var u;if(o.wrap&&"function"==typeof s&&(s=function(e){var t=function(){for(var t=[],n=0,i=arguments.length;n<i;n++){var a=arguments[n];t[n]=a&&a.valueOf()}return e.apply(r,t)};return e.transform&&(t.transform=e.transform),t}(s)),"function"==typeof(u=s)&&"string"==typeof u.signature&&(s=e(t,{[s.signature]:s})),a(r[t])&&a(s)){s=o.override?e(t,s.signatures):e(r[t],s),r[t]=s,delete n[t],i(t,s),r.emit("import",t,function(){return s});return}if(void 0===r[t]||o.override){r[t]=s,delete n[t],i(t,s),r.emit("import",t,function(){return s});return}if(!o.silent)throw Error('Cannot import "'+t+'": already exists')}(f,h,u);else if(!u.silent)throw TypeError("Factory, Object, or Array expected")}}}}(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.typed.apply(o.typed,t)},0,o,u);return o.import=c,o.on("config",()=>{iT(u).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&c(e,{override:!0})})}),o.create=e.bind(null,t),o.factory=ij,o.import(iT((function e(t,r){for(var n in t)if(iA(t,n)){var i=t[n];"object"==typeof i&&null!==i?e(i,r):r[n]=i}}(t,a={}),a))),o.ArgumentsError=i9,o.DimensionError=iW,o.IndexError=iK,o}({gcdDependencies:{BigNumberDependencies:sz,DenseMatrixDependencies:sB,equalScalarDependencies:oh,matrixDependencies:{DenseMatrixDependencies:sB,MatrixDependencies:s$,SparseMatrixDependencies:{MatrixDependencies:s$,equalScalarDependencies:oh,typedDependencies:ol,createSparseMatrixClass:op},typedDependencies:ol,createMatrix:og},typedDependencies:ol,createGcd:ij("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a}=e,s=oy({typed:t}),o=ov({typed:t,equalScalar:n}),u=ob({typed:t,DenseMatrix:a}),c=ow({typed:t}),l=o_({typed:t});return t("gcd",{"number, number":ox,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var r=new i(0);!t.isZero();){var n=e.mod(t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return u(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return l(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return l(r(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return l(r(t),e,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=this(e,t),i=0;i<r.length;i++)n=this(n,r[i]);return n}})})}}),oS=10;function oM(e,t){let r=t.startMs,n=e.values,i=[];for(let e of n){for(;r<e[0];)i.push([r,null]),r+=t.stepMs;i.push([r,e[1]]),r+=t.stepMs}for(;r<=t.endMs;)i.push([r,null]),r+=t.stepMs;return i}function oE(e){let t,r,n=[];for(let t of e)if(t&&"timeRange"in t){if(void 0===t||void 0===t.timeRange||void 0===t.stepMs)continue;if(n.push(t.stepMs),void 0===r){r=t.timeRange;continue}t.timeRange.start<r.start&&(r.start=t.timeRange.start),t.timeRange.end>r.end&&(r.end=t.timeRange.end)}else if(t&&"values"in t){for(let e=0;e<t.values.length;e++){let n=t.values[e];if(void 0===n)continue;let[i]=n,a=new Date(i),s=new Date(i);if(void 0===r){r={start:a,end:s};continue}a<r.start&&(r.start=a),s>r.end&&(r.end=s)}if(void 0===r)return;let e=r.start.valueOf(),n=r.end.valueOf(),i=n-e;return{startMs:e,endMs:n,rangeMs:i,stepMs:oS}}if(void 0===r)return;if(1===n.length)t=n[0];else{let e=oN(...n);t=e<oS?oS:e}let i=r.start.valueOf(),a=r.end.valueOf();return{startMs:i,endMs:a,stepMs:t,rangeMs:a-i}}function ok(e,t){if(0===t.length)return e;let r={};for(let n of e){let e=Object.keys(n).filter(e=>t.includes(e)).map(e=>n[e]).join("|"),i=r[e];i?r[e]={...i,...n}:r[e]={...n}}return Object.values(r)}function oO(e,t,r){let n=[];for(let i of e){let e=Object.keys(i).filter(e=>t.includes(e)),a={};for(let t of e)a[t]=i[t],delete i[t];for(let t of e)n.push({...i,[r]:a[t]});0===e.length&&n.push(i)}return n}function oA(e,t){let r=[];for(let n of e){let e=Object.keys(n).filter(e=>RegExp("^(("+t+" #\\d+)|("+t+"))$").test(e)),i={};for(let t of e)i[t]=n[t],delete n[t];for(let a of e)r.push({...n,[t]:i[a]});0===e.length&&r.push(n)}return r}function oT(e){let t=[...e],r=Array.from(new Set(e.flatMap(Object.keys).map(e=>e.replace(/ #\d+/,"")).filter(e=>"value"!==e)));for(let e of r)t=oA(t,e);return ok(t,r)}function oC(e,t){let r=e;for(let e of t??[])if(!e.spec.disabled)switch(e.kind){case"JoinByColumnValue":e.spec.columns&&e.spec.columns.length>0&&(r=ok(r,e.spec.columns));break;case"MergeIndexedColumns":e.spec.column&&(r=oA(r,e.spec.column));break;case"MergeColumns":e.spec.columns&&e.spec.columns.length>0&&e.spec.name&&(r=oO(r,e.spec.columns,e.spec.name));break;case"MergeSeries":r=oT(r)}return r.map(e=>Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}))}function oj(e){return!!e?.startsWith("/")}function oI(e){if(!e)throw Error("Input string cannot be empty");if(!oj(e))return RegExp(`^${e}$`);let t=e.match(/^\/(.+)\/([gimy]*)$/);if(!t)throw Error(`Invalid regular expression format: ${e}`);let[,r="",n=""]=t;try{return new RegExp(r,n)}catch(e){throw Error(`Failed to create RegExp ${e}`)}}function oD(e,t=[]){if(!t.length)return{value:e};let r={value:e};return t.forEach(t=>{switch(t.kind){case"Value":{let n=t.spec;String(n.value)===String(e)&&(r.value=n.result.value||r.value,r.color=n.result.color);break}case"Range":{let n=t.spec;if(void 0===n.from&&void 0===n.to)break;let i=void 0!==n.from?n.from:-1/0,a=void 0!==n.to?n.to:1/0;e>=i&&e<=a&&(r.value=n.result.value||r.value,r.color=n.result.color);break}case"Regex":{let n=t.spec,i=e.toString();if(!n.pattern)break;let a=oI(n.pattern);i.match(a)&&null!==n.result.value&&(r.value=i.replace(a,n.result.value.toString()||"")||r.value,r.color=n.result.color);break}case"Misc":{let n=t.spec;(function(e,t){switch(e){case"empty":return""===t;case"null":return null==t;case"NaN":return Number.isNaN(t);case"true":return!0===t;case"false":return!1===t;default:return!1}})(n.value,e)&&(r.value=n.result.value||r.value,r.color=n.result.color)}}}),r}},8317:function(e){function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var a=0,s=n.length;a<s;a++)n[a].fn!==t&&n[a].fn._!==t&&i.push(n[a]);return i.length?r[e]=i:delete r[e],this}},e.exports=t,e.exports.TinyEmitter=t},27554:function(e){"use strict";var t;t=function(){function e(){return!0}function t(){return!1}function r(){}return function n(){var i=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:function(e){return"object"==typeof e&&null!==e&&e.constructor===Object}},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],a={name:"any",test:e},s=[],o=[],u={types:i,conversions:o,ignore:s};function c(e){var t=R(u.types,function(t){return t.name===e});if(t)return t;if("any"===e)return a;var r=R(u.types,function(t){return t.name.toLowerCase()===e.toLowerCase()});throw TypeError('Unknown type "'+e+'"'+(r?'. Did you mean "'+r.name+'"?':""))}function l(e){return e===a?999:u.types.indexOf(e)}function f(e){var t=R(u.types,function(t){return t.test(e)});if(t)return t.name;throw TypeError("Value has unknown type. Value: "+e)}function d(e){return e.map(function(e){var t=e.types.map(v);return(e.restParam?"...":"")+t.join("|")}).join(",")}function h(e){var t=D(e);return!!t&&t.restParam}function p(e){return e.types.some(function(e){return null!=e.conversion})}function m(t){if(!t||0===t.types.length)return e;if(1===t.types.length)return c(t.types[0].name).test;if(2===t.types.length){var r=c(t.types[0].name).test,n=c(t.types[1].name).test;return function(e){return r(e)||n(e)}}var i=t.types.map(function(e){return c(e.name).test});return function(e){for(var t=0;t<i.length;t++)if(i[t](e))return!0;return!1}}function g(e,t){return t<e.params.length?e.params[t]:h(e.params)?D(e.params):null}function y(e,t,r){var n=g(e,t);return(n?r?n.types.filter(b):n.types:[]).map(v)}function v(e){return e.name}function b(e){return null===e.conversion||void 0===e.conversion}function w(e,t){var r=function(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return Object.keys(t)}(P(e,function(e){return y(e,t,!1)}));return -1!==r.indexOf("any")?["any"]:r}function _(e,t,r){var n,i,a,s=e||"unnamed",o=r;for(a=0;a<t.length;a++){var u=o.filter(function(e){var r=m(g(e,a));return(a<e.params.length||h(e.params))&&r(t[a])});if(0===u.length){if((i=w(o,a)).length>0){var c=f(t[a]);return(n=TypeError("Unexpected type of argument in function "+s+" (expected: "+i.join(" or ")+", actual: "+c+", index: "+a+")")).data={category:"wrongType",fn:s,index:a,actual:c,expected:i},n}}else o=u}var l=o.map(function(e){return h(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,l))return(n=TypeError("Too few arguments in function "+s+" (expected: "+(i=w(o,a)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:s,index:t.length,expected:i},n;var d=Math.max.apply(null,l);return t.length>d?(n=TypeError("Too many arguments in function "+s+" (expected: "+d+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:s,index:t.length,expectedLength:d}:(n=TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:t.map(f)},n}function x(e){for(var t=999,r=0;r<e.types.length;r++)b(e.types[r])&&(t=Math.min(t,e.types[r].typeIndex));return t}function N(e){for(var t=999,r=0;r<e.types.length;r++)b(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function S(e,t){var r,n,i=Math.min(e.params.length,t.params.length);if(0!=(n=e.params.some(p)-t.params.some(p)))return n;for(r=0;r<i;r++)if(0!=(n=p(e.params[r])-p(t.params[r])))return n;for(r=0;r<i;r++)if(0!==(n=function(e,t){var r;return 0!=(r=e.restParam-t.restParam)||0!=(r=p(e)-p(t))||0!=(r=x(e)-x(t))?r:N(e)-N(t)}(e.params[r],t.params[r])))return n;return e.params.length-t.params.length}function M(e){var t,r,n,i,a=[],s=[];switch(e.types.forEach(function(e){e.conversion&&(a.push(c(e.conversion.from).test),s.push(e.conversion.convert))}),s.length){case 0:return function(e){return e};case 1:return t=a[0],n=s[0],function(e){return t(e)?n(e):e};case 2:return t=a[0],r=a[1],n=s[0],i=s[1],function(e){return t(e)?n(e):r(e)?i(e):e};default:return function(e){for(var t=0;t<s.length;t++)if(a[t](e))return s[t](e);return e}}}function E(e,t){return function e(r,n,i){if(!(n<r.length))return[i.map(function(e,t){return{types:e,restParam:t===r.length-1&&h(r)}})];var a,s=r[n],o=t?s.types.filter(b):s.types;if(s.restParam){var u=o.filter(b);a=u.length<o.length?[u,o]:[o]}else a=o.map(function(e){return[e]});return P(a,function(t){return e(r,n+1,i.concat([t]))})}(e,0,[])}function k(e,n){if(0===Object.keys(n).length)throw SyntaxError("No signatures provided");var i,a=[];Object.keys(n).map(function(e){var t,r,i;return t=n[e],r=u.conversions,i=[],(""!==e.trim()&&(i=e.split(",").map(T).map(function(e,t,n){var i,a,s,o,u,f,d,h,p=(i=r,a=u=((o=0===e.indexOf("..."))?e.length>3?e.slice(3):"any":e).split("|").map(T).filter(C).filter(A),s={},i.forEach(function(e){-1!==a.indexOf(e.from)||-1===a.indexOf(e.to)||s[e.from]||(s[e.from]=e)}),f=Object.keys(s).map(function(e){return s[e]}),d=u.map(function(e){var t=c(e);return{name:e,typeIndex:l(t),test:t.test,conversion:null,conversionIndex:-1}}),h=f.map(function(e){var t=c(e.from);return{name:e.from,typeIndex:l(t),test:t.test,conversion:e,conversionIndex:r.indexOf(e)}}),{types:d.concat(h),restParam:o});if(p.restParam&&t!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+e+'": only allowed for the last parameter');return p})),i.some(I))?null:{params:i,fn:t}}).filter(j).forEach(function(e){var t=R(a,function(t){return function(e,t){for(var r=Math.max(e.params.length,t.params.length),n=0;n<r;n++)if(!function(e,t){for(var r,n=0;n<e.length;n++)if(r=e[n],-1!==t.indexOf(r))return!0;return!1}(y(e,n,!0),y(t,n,!0)))return!1;var i=e.params.length,a=t.params.length,s=h(e.params),o=h(t.params);return s?o?i===a:a>=i:o?i>=a:i===a}(t,e)});if(t)throw TypeError('Conflicting signatures "'+d(t.params)+'" and "'+d(e.params)+'".');a.push(e)});var s=P(a,function(e){return(e?E(e.params,!1):[]).map(function(t){return{params:t,fn:e.fn}})}).filter(j);s.sort(S);var o=s[0]&&s[0].params.length<=2&&!h(s[0].params),f=s[1]&&s[1].params.length<=2&&!h(s[1].params),g=s[2]&&s[2].params.length<=2&&!h(s[2].params),v=s[3]&&s[3].params.length<=2&&!h(s[3].params),b=s[4]&&s[4].params.length<=2&&!h(s[4].params),w=s[5]&&s[5].params.length<=2&&!h(s[5].params),_=s.map(function(e){return function(e){var t,r,n;if(h(e)){var i,a=(t=(i=e).slice(0,i.length-1).map(m)).length,s=m(D(e)),o=function(e){for(var t=a;t<e.length;t++)if(!s(e[t]))return!1;return!0};return function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return o(e)&&e.length>=a+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=m(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=m(e[0]),n=m(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(m),function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(e.params)}),x=o?m(s[0].params[0]):t,N=f?m(s[1].params[0]):t,k=g?m(s[2].params[0]):t,O=v?m(s[3].params[0]):t,Z=b?m(s[4].params[0]):t,z=w?m(s[5].params[0]):t,$=o?m(s[0].params[1]):t,B=f?m(s[1].params[1]):t,L=g?m(s[2].params[1]):t,U=v?m(s[3].params[1]):t,V=b?m(s[4].params[1]):t,q=w?m(s[5].params[1]):t,G=s.map(function(e){return function(e,t){var r=t;if(e.some(p)){var n=h(e),i=e.map(M);r=function(){for(var e=[],r=n?arguments.length-1:arguments.length,a=0;a<r;a++)e[a]=i[a](arguments[a]);return n&&(e[r]=arguments[r].map(i[r])),t.apply(this,e)}}var a=r;if(h(e)){var s=e.length-1;a=function(){return r.apply(this,F(arguments,0,s).concat([F(arguments,s)]))}}return a}(e.params,e.fn)}),W=o?G[0]:r,K=f?G[1]:r,H=g?G[2]:r,J=v?G[3]:r,Y=b?G[4]:r,X=w?G[5]:r,Q=o?s[0].params.length:-1,ee=f?s[1].params.length:-1,et=g?s[2].params.length:-1,er=v?s[3].params.length:-1,en=b?s[4].params.length:-1,ei=w?s[5].params.length:-1,ea=6*!!(o&&f&&g&&v&&b&&w),es=s.length,eo=function(){for(var t=ea;t<es;t++)if(_[t](arguments))return G[t].apply(this,arguments);return u.onMismatch(e,arguments,s)},eu=function e(t,r){return arguments.length===Q&&x(t)&&$(r)?W.apply(e,arguments):arguments.length===ee&&N(t)&&B(r)?K.apply(e,arguments):arguments.length===et&&k(t)&&L(r)?H.apply(e,arguments):arguments.length===er&&O(t)&&U(r)?J.apply(e,arguments):arguments.length===en&&Z(t)&&V(r)?Y.apply(e,arguments):arguments.length===ei&&z(t)&&q(r)?X.apply(e,arguments):eo.apply(e,arguments)};try{Object.defineProperty(eu,"name",{value:e})}catch(e){}return i={},s.forEach(function(e){e.params.some(p)||E(e.params,!0).forEach(function(t){i[d(t)]=e.fn})}),eu.signatures=i,eu}function O(e,t,r){throw _(e,t,r)}function A(e){return -1===u.ignore.indexOf(e)}function T(e){return e.trim()}function C(e){return!!e}function j(e){return null!==e}function I(e){return 0===e.types.length}function D(e){return e[e.length-1]}function F(e,t,r){return Array.prototype.slice.call(e,t,r)}function R(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}function P(e,t){return Array.prototype.concat.apply([],e.map(t))}function Z(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(("object"==typeof n.signatures||"string"==typeof n.signature)&&""!==n.name){if(""===t)t=n.name;else if(t!==n.name){var i=Error("Function names do not match (expected: "+t+", actual: "+n.name+")");throw i.data={actual:n.name,expected:t},i}}}return t}function z(e){var t,r={};function n(e,n){if(r.hasOwnProperty(e)&&n!==r[e])throw(t=Error('Signature "'+e+'" is defined twice')).data={signature:e},t}for(var i=0;i<e.length;i++){var a=e[i];if("object"==typeof a.signatures)for(var s in a.signatures)a.signatures.hasOwnProperty(s)&&(n(s,a.signatures[s]),r[s]=a.signatures[s]);else if("string"==typeof a.signature)n(a.signature,a),r[a.signature]=a;else throw(t=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},t}return r}return(u=k("typed",{"string, Object":k,Object:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return k(Z(t),e)},"...Function":function(e){return k(Z(e),z(e))},"string, ...Function":function(e,t){return k(e,z(t))}})).create=n,u.types=i,u.conversions=o,u.ignore=s,u.onMismatch=O,u.throwMismatchError=O,u.createError=_,u.convert=function(e,t){var r=f(e);if(t===r)return e;for(var n=0;n<u.conversions.length;n++){var i=u.conversions[n];if(i.from===r&&i.to===t)return i.convert(e)}throw Error("Cannot convert from "+r+" to "+t)},u.find=function(e,t){if(!e.signatures)throw TypeError("Function is no typed-function");if("string"==typeof t){r=t.split(",");for(var r,n=0;n<r.length;n++)r[n]=r[n].trim()}else if(Array.isArray(t))r=t;else throw TypeError("String array or a comma separated string expected");var i=r.join(","),a=e.signatures[i];if(a)return a;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+r.join(", ")+"))")},u.addType=function(e,t){if(!e||"string"!=typeof e.name||"function"!=typeof e.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==t){for(var r=0;r<u.types.length;r++)if("Object"===u.types[r].name)return void u.types.splice(r,0,e)}u.types.push(e)},u.addConversion=function(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");u.conversions.push(e)},u}()},"function"==typeof define&&define.amd?define([],t):e.exports=t()}}]);