@perses-dev/table-plugin 0.7.1 → 0.8.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.
- package/__mf/js/Table.43fd1088.js +5 -0
- package/__mf/js/async/1101.5d463d7d.js +73 -0
- package/__mf/js/async/1640.c1ed5a05.js +1 -0
- package/__mf/js/async/1964.ad4fb2b0.js +2 -0
- package/__mf/js/async/2292.12f77288.js +2 -0
- package/__mf/js/async/2641.2196128a.js +1 -0
- package/__mf/js/async/2651.4ede9028.js +1 -0
- package/__mf/js/async/2854.fc0ce4ac.js +110 -0
- package/__mf/js/async/3224.5efdac43.js +1 -0
- package/__mf/js/async/3863.5ed15409.js +2 -0
- package/__mf/js/async/3960.ad46df53.js +2 -0
- package/__mf/js/async/3980.17fb5371.js +2 -0
- package/__mf/js/async/4062.39b68a8d.js +1 -0
- package/__mf/js/async/4075.e2a2c230.js +1 -0
- package/__mf/js/async/4238.ea9515aa.js +1 -0
- package/__mf/js/async/4300.fc319dfb.js +38 -0
- package/__mf/js/async/{3598.193e9962.js → 4368.869923ac.js} +1 -1
- package/__mf/js/async/5061.3cf5b514.js +2 -0
- package/__mf/js/async/5214.00911b97.js +1 -0
- package/__mf/js/async/5377.6522c49a.js +1 -0
- package/__mf/js/async/5409.524589b2.js +1 -0
- package/__mf/js/async/5912.d6e87174.js +1 -0
- package/__mf/js/async/5981.91033d82.js +2 -0
- package/__mf/js/async/6284.5f775177.js +1 -0
- package/__mf/js/async/6292.c204d39b.js +1 -0
- package/__mf/js/async/6357.6bf3fdb2.js +1 -0
- package/__mf/js/async/6770.94607b71.js +1 -0
- package/__mf/js/async/694.20d8be37.js +1 -0
- package/__mf/js/async/738.3929068d.js +1 -0
- package/__mf/js/async/7740.4fee7abb.js +1 -0
- package/__mf/js/async/8488.9f177839.js +1 -0
- package/__mf/js/async/8970.089ccaba.js +7 -0
- package/__mf/js/async/9010.aaf984f3.js +1 -0
- package/__mf/js/async/9173.c646dd1e.js +2 -0
- package/__mf/js/async/9509.1c4313e0.js +1 -0
- package/__mf/js/async/__federation_expose_Table.fc2610e1.js +1 -0
- package/__mf/js/async/lib-router.f3ef5227.js +2 -0
- package/__mf/js/main.86c979c4.js +5 -0
- package/mf-manifest.json +56 -156
- package/mf-stats.json +56 -156
- package/package.json +13 -5
- package/__mf/js/6487.e3b37e41.js +0 -5
- package/__mf/js/Table.768b2f2d.js +0 -5
- package/__mf/js/async/1620.ed8d9b3d.js +0 -2
- package/__mf/js/async/1640.ff18956a.js +0 -1
- package/__mf/js/async/1964.979a7101.js +0 -2
- package/__mf/js/async/2651.7c8030f0.js +0 -1
- package/__mf/js/async/3090.f748dadb.js +0 -2
- package/__mf/js/async/3224.fbb884ab.js +0 -1
- package/__mf/js/async/3372.d4622f1a.js +0 -110
- package/__mf/js/async/3960.c992ac30.js +0 -2
- package/__mf/js/async/3980.9246eb0c.js +0 -2
- package/__mf/js/async/4075.4fb81a28.js +0 -1
- package/__mf/js/async/4238.e22a8e1b.js +0 -1
- package/__mf/js/async/4300.4e662fdf.js +0 -38
- package/__mf/js/async/5214.19ee9ad8.js +0 -1
- package/__mf/js/async/5377.0695a823.js +0 -1
- package/__mf/js/async/5503.c5750d0c.js +0 -1
- package/__mf/js/async/5677.c54b356e.js +0 -1
- package/__mf/js/async/5901.2aaa62a6.js +0 -2
- package/__mf/js/async/5912.b68e4631.js +0 -1
- package/__mf/js/async/5981.95116879.js +0 -2
- package/__mf/js/async/6284.0d33a1ae.js +0 -1
- package/__mf/js/async/6292.20be7eae.js +0 -1
- package/__mf/js/async/6357.e10e2a7f.js +0 -1
- package/__mf/js/async/6770.84690346.js +0 -1
- package/__mf/js/async/694.4b146780.js +0 -1
- package/__mf/js/async/7179.516df6f8.js +0 -73
- package/__mf/js/async/738.e2fbbd72.js +0 -1
- package/__mf/js/async/7740.dcade8b6.js +0 -1
- package/__mf/js/async/8488.d5eddfc6.js +0 -1
- package/__mf/js/async/8565.0065c3c7.js +0 -1
- package/__mf/js/async/8970.e4194572.js +0 -7
- package/__mf/js/async/9010.06449312.js +0 -1
- package/__mf/js/async/9173.00408de3.js +0 -2
- package/__mf/js/async/9354.fc319e8b.js +0 -1
- package/__mf/js/async/__federation_expose_Table.12e32a6d.js +0 -1
- package/__mf/js/async/lib-router.d60ae988.js +0 -2
- package/__mf/js/main.bac32847.js +0 -1
- /package/__mf/js/async/{7179.516df6f8.js.LICENSE.txt → 1101.5d463d7d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1964.979a7101.js.LICENSE.txt → 1964.ad4fb2b0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3090.f748dadb.js.LICENSE.txt → 2292.12f77288.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3372.d4622f1a.js.LICENSE.txt → 2854.fc0ce4ac.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1620.ed8d9b3d.js.LICENSE.txt → 3863.5ed15409.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3960.c992ac30.js.LICENSE.txt → 3960.ad46df53.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3980.9246eb0c.js.LICENSE.txt → 3980.17fb5371.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5901.2aaa62a6.js.LICENSE.txt → 5061.3cf5b514.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5981.95116879.js.LICENSE.txt → 5981.91033d82.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8970.e4194572.js.LICENSE.txt → 8970.089ccaba.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9173.00408de3.js.LICENSE.txt → 9173.c646dd1e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.d60ae988.js.LICENSE.txt → lib-router.f3ef5227.js.LICENSE.txt} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 5901.2aaa62a6.js.LICENSE.txt */
|
|
2
|
-
(self.webpackChunkTable=self.webpackChunkTable||[]).push([["5901"],{98989:function(e,t,r){"use strict";let n;r.r(t),r.d(t,{applyMergeSeriesTransform:()=>oL,variableTextSchema:()=>nD,globalRoleBindingSchema:()=>nb,msToPrometheusDuration:()=>U,getMetadataProject:()=>C,useTransformData:()=>oV,rolesEditorSchema:()=>nm,secretSchema:()=>nx,getSuggestedStepMs:()=>W,getCalculation:()=>p,CALCULATIONS_CONFIG:()=>d,isValidLegendPosition:()=>b,isValidLegendSize:()=>w,querySpecSchema:()=>nn,buildVariableSpecSchema:()=>nP,buildDatasourceSpecSchema:()=>r5,transformData:()=>oU,useMemoized:()=>nX,secretsEditorSchema:()=>nM,secretSpecSchema:()=>nw,DEFAULT_REFRESH_INTERVAL:()=>u,roleBindingSpecSchema:()=>ny,intervalToPrometheusDuration:()=>L,pluginSchema:()=>r2,displaySchema:()=>r4,getLegendMode:()=>M,isThroughputUnit:()=>e3,otlpcommonv1:()=>i,projectMetadataSchema:()=>r1,variableListSchema:()=>nj,otlptracev1:()=>s,buildDatasourceDefinitionSchema:()=>ne,isValidTraceId:()=>J,panelSpecSchema:()=>na,getLegendSize:()=>S,buildPanelDefinitionSchema:()=>nu,useEvent:()=>nV,isTimeUnit:()=>e0,parseDurationString:()=>$,FetchError:()=>nW,applyMergeColumnsTransform:()=>o$,isPercentUnit:()=>e1,buildVariableListSpecSchema:()=>nC,datasourceSpecSchema:()=>r9,formatDuration:()=>V,globalVariableSchema:()=>nz,isRelativeTimeRange:()=>R,GLOBAL_SCOPES:()=>F,getVariableProject:()=>e7,isEmptyObject:()=>nJ,buildVariableListSchema:()=>nI,isValidQueryPluginType:()=>A,TRANSFORM_TEXT:()=>H,UNIT_GROUP_CONFIG:()=>eK,roleSchema:()=>nh,resolvePanelRef:()=>n0,variableTextSpecSchema:()=>nF,KINDS:()=>m,applyMergeIndexedColumnsTransform:()=>oB,CalculationsMap:()=>f,getTimeSeriesValues:()=>oP,UNIT_CONFIG:()=>eJ,createRegexFromString:()=>oG,buildPanelEditorSchema:()=>nl,isDecimalUnit:()=>e2,isUnitWithShortValues:()=>e5,userSchema:()=>nO,variableSpecSchema:()=>nR,userSpecSchema:()=>nk,otlpresourcev1:()=>a,PROJECT_SCOPES:()=>I,getCommonTimeScale:()=>oZ,variableDisplaySchema:()=>nA,formatValue:()=>eH,variablesSchema:()=>n$,DEFAULT_DASHBOARD_DURATION:()=>o,legendSizes:()=>v,datasourceSchema:()=>r3,isBytesUnit:()=>e4,durationValidationSchema:()=>nt,getCalculations:()=>h,toAbsoluteTimeRange:()=>Z,getLegendPosition:()=>N,roleSpecSchema:()=>nd,nameSchema:()=>rQ,SAVE_DEFAULTS_DIALOG_TEXT:()=>c,isRegexPattern:()=>oq,buildPanelSpecSchema:()=>ns,isUnitWithDecimalPlaces:()=>e9,isProjectMetadata:()=>T,shouldShortenValues:()=>Y,getResourceExtendedDisplayName:()=>n9,oauthProvidersSchema:()=>nE,permissionSchema:()=>nf,variableListSpecSchema:()=>nT,getPanelKeyFromRef:()=>n1,globalRoleSchema:()=>np,variableDefinitionSchema:()=>nB,DEFAULT_LEGEND:()=>x,globalDatasourceSchema:()=>r7,isDurationString:()=>B,fetchJson:()=>nG,legendModes:()=>y,roleBindingsEditorSchema:()=>n_,panelDisplaySpec:()=>nr,roundStepInterval:()=>G,DURATION_REGEX:()=>z,buildVariableDefinitionSchema:()=>nL,MAX_SIGNIFICANT_DIGITS:()=>e$,getUnitGroupConfig:()=>eQ,legendPositions:()=>g,limitDecimalPlaces:()=>Q,hasDecimalPlaces:()=>X,UserFriendlyError:()=>nK,globalSecretSchema:()=>nN,DEFAULT_ALL_VALUE:()=>e6,panelEditorSchema:()=>nc,fetch:()=>nq,roleBindingSchema:()=>nv,isAbsoluteTimeRange:()=>P,useDeepMemo:()=>nQ,MIN_STEP_INTERVAL_MS:()=>oR,metadataSchema:()=>r0,isTimeSeriesValueTuple:()=>K,datasourcesSchema:()=>r6,createPanelRef:()=>n2,applyValueMapping:()=>oW,getResourceDisplayName:()=>n4,nativeProviderSchema:()=>nS,applyJoinTransform:()=>oz,DEFAULT_CALCULATION:()=>l,isValidLegendMode:()=>_,ACTIONS:()=>j,datasourceDefinitionSchema:()=>r8,subjectSchema:()=>ng,getUnitConfig:()=>eY,linkSchema:()=>ni,variableSchema:()=>nZ,getUnitGroup:()=>eX,panelDefinitionSchema:()=>no});var i={};r.r(i);var a={};r.r(a);var s={};r.r(s),r.d(s,{StatusCodeError:()=>O,StatusCodeOk:()=>k,StatusCodeUnset:()=>E});let o="1h",u="0s",c="You have made changes to the time range or the variables values. Would you like to save these as defaults?",l="last",f={first:function(e){return p(e,"first")},last:function(e){return p(e,"last")},"first-number":function(e){return p(e,"first-number")},"last-number":function(e){return p(e,"last-number")},mean:function(e){return p(e,"mean")},sum:function(e){return p(e,"sum")},min:function(e){return p(e,"min")},max:function(e){return p(e,"max")}},d={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 h(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 p(e,t){return h(e,[t])[t]}let m=["Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"],g=["bottom","right"],y=["list","table"],v=["small","medium"];function b(e){return g.includes(e)}function _(e){return y.includes(e)}function w(e){return v.includes(e)}let x={position:"bottom",mode:"list",size:"medium"};function N(e){return void 0===e?x.position:b(e)?e:x.position}function M(e){return e&&_(e)?e:x.mode}function S(e){return e&&w(e)?e:x.size}let E="STATUS_CODE_UNSET",k="STATUS_CODE_OK",O="STATUS_CODE_ERROR";function A(e){return["TimeSeriesQuery","TraceQuery"].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"],F=["GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","User"];var D=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,D.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 J(e){return/^[0-9a-fA-F]+$/.test(e)}let H={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(av)return ay;av=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 ay={unformat:function(r,n){let i;let 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){let c;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(a_)return ab;a_=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}]`)});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 ab={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={parseFormat:function(e,t={}){var r,n,i,a,s;let o,u,c,l;return"string"!=typeof e?e:(!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=(u=(n=e=(o=(r=e).match(/^{([^}]*)}/))?(t.prefix=o[1],r.slice(o[0].length)):r).match(/{([^}]*)}$/))?(t.postfix=u[1],n.slice(0,-u[0].length)):n,t),(c=e.match(/[1-9]+[0-9]*/))&&(t.totalLength=+c[0]),(l=e.split(".")[0].match(/0+/))&&(t.characteristic=l[0].length),!function(e,t){if(-1!==e.indexOf(".")){let r=e.split(".")[0];t.optionalCharacteristic=-1===r.indexOf("0")}}(e,t),-1!==e.indexOf("a")&&(t.average=!0),-1!==(i=e).indexOf("K")?t.forceAverage="thousand":-1!==i.indexOf("M")?t.forceAverage="million":-1!==i.indexOf("B")?t.forceAverage="billion":-1!==i.indexOf("T")&&(t.forceAverage="trillion"),!function(e,t){let r=e.split(".")[1];if(r){let e=r.match(/0+/);e&&(t.mantissa=e[0].length)}}(e,t),(a=e).match(/\[\.]/)?t.optionalMantissa=!0:a.match(/\./)&&(t.optionalMantissa=!1),!function(e,t){let r=e.split(".")[1];r&&(t.trimMantissa=-1!==r.indexOf("["))}(e,t),-1!==e.indexOf(",")&&(t.thousandSeparated=!0),-1!==e.indexOf(" ")&&(t.spaceSeparated=!0,t.spaceSeparatedCurrency=!0,(t.average||t.forceAverage)&&(t.spaceSeparatedAbbreviation=!0)),(s=e).match(/^\+?\([^)]*\)$/)&&(t.negative="parenthesis"),s.match(/^\+?-/)&&(t.negative="sign"),e.match(/^\+/)&&(t.forceSign=!0),t)}};function ei(){let e;if(ax)return aw;ax=1;let t=ag?am:(ag=1,am={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.parseFormat(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);if(!i[a]){e=n;return}e=a;return}e=r},n.registerLanguage(t),e=t.languageTag,aw=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,M=Z.prototype={constructor:Z,toString:null,valueOf:null},S=new Z(1),E=20,k=4,O=-7,A=21,T=-1e7,C=1e7,j=!1,I=1,F=0,D={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}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),F=r),e.hasOwnProperty(t="FORMAT")){if("object"==typeof(r=e[t]))D=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:F,FORMAT:D,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)},Z.random=(m=0x20000000000000*Math.random()&2097151?function(){return i(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},function(e){var t,r,s,u,c,l=0,d=[],h=new Z(S);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=F,F=0,r=r.replace(".",""),h=(g=new Z(n)).pow(r.length-y),F=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=w(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}}(),w=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,M,S,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)?O&&0==O[0]||!A?0*k:k/0:NaN);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,S=A.length,d=0,k+=2,(p=i(c/(A[0]+1)))>1&&(A=e(A,p,c),O=e(O,p,c),S=A.length,N=O.length),x=S,_=(b=O.slice(0,S)).length;_<S;b[_++]=0);E=[0].concat(E=A.slice()),M=A[0],A[1]>=c/2&&M++;do{if(p=0,(l=t(A,b,S,_))<0){if(w=b[0],S!=_&&(w=w*c+(b[1]||0)),(p=i(w/M))>1)for(p>=c&&(p=c-1),g=(m=e(A,p,c)).length,_=b.length;1==t(m,b,g,_);)p--,r(m,S<g?E:A,g,c),g=m.length,l=1;else 0==p&&(l=p=1),g=(m=A.slice()).length;if(g<_&&(m=[0].concat(m)),r(b,m,_,c),_=b.length,-1==l)for(;1>t(A,b,S,_);)p++,r(b,S<_?E:A,_,c),_=b.length}else 0===l&&(p++,b=[0]);v[d++]=p,b[0]?b[_++]=O[x]||0:(b=[O[x]],_=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)$/,_=/^\s*\+(?=[\w.])|^\s+|\s+$/g,N=function(e,t,r,n){var i,s=r?t:t.replace(_,"");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},M.absoluteValue=M.abs=function(){var e=new Z(this);return e.s<0&&(e.s=1),e},M.comparedTo=function(e,t){return l(this,new Z(e,t))},M.decimalPlaces=M.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},M.dividedBy=M.div=function(e,t){return w(this,new Z(e,t),E,k)},M.dividedToIntegerBy=M.idiv=function(e,t){return w(this,new Z(e,t),0,1)},M.exponentiatedBy=M.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);F&&(u=n(F/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(S);;){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=S.div(p)),t?p.mod(t):u?L(p,F,k,c):p)},M.integerValue=function(e){var t=new Z(this);return null==e?e=k:f(e,0,8),L(t,t.e+1,e)},M.isEqualTo=M.eq=function(e,t){return 0===l(this,new Z(e,t))},M.isFinite=function(){return!!this.c},M.isGreaterThan=M.gt=function(e,t){return l(this,new Z(e,t))>0},M.isGreaterThanOrEqualTo=M.gte=function(e,t){return 1===(t=l(this,new Z(e,t)))||0===t},M.isInteger=function(){return!!this.c&&u(this.e/14)>this.c.length-2},M.isLessThan=M.lt=function(e,t){return 0>l(this,new Z(e,t))},M.isLessThanOrEqualTo=M.lte=function(e,t){return -1===(t=l(this,new Z(e,t)))||0===t},M.isNaN=function(){return!this.s},M.isNegative=function(){return this.s<0},M.isPositive=function(){return this.s>0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.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)},M.modulo=M.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=w(this,e,0,3),e.s=n,r.s*=n):r=w(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)},M.multipliedBy=M.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)},M.negated=function(){var e=new Z(this);return e.s=-e.s||null,e},M.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)},M.precision=M.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},M.shiftedBy=function(e){return f(e,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+e)},M.squareRoot=M.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(w(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)},M.toExponential=function(e,t){return null!=e&&(f(e,0,1e9),e++),z(this,e,t,1)},M.toFixed=function(e,t){return null!=e&&(f(e,0,1e9),e=e+this.e+1),z(this,e,t)},M.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=D;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||"")},M.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(S)))throw Error(a+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+U(l));if(!g)return new Z(this);for(t=new Z(S),d=r=new Z(S),n=f=new Z(S),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=w(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=w(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>w(d,n,s,k).minus(this).abs().comparedTo(w(f,r,s,k).minus(this).abs())?[d,n]:[f,r],C=u,p},M.toNumber=function(){return+U(this)},M.toPrecision=function(e,t){return null!=e&&f(e,1,1e9),z(this,e,t,2)},M.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},M.valueOf=M.toJSON=function(){return U(this)},M._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()}){let a=e._value;if(0===a&&r.hasZeroFormat())return r.getZeroFormat();if(!isFinite(a))return a.toString();let s=Object.assign({},el,i,t),o=s.totalLength,u=o?0:s.characteristic,c=s.optionalCharacteristic,l=s.forceAverage,f=s.lowPrecision,d=!!o||!!l||s.average,h=o?-1:d&&void 0===t.mantissa?0:s.mantissa,p=!o&&(void 0===t.optionalMantissa?-1===h:s.optionalMantissa),m=s.trimMantissa,g=s.thousandSeparated,y=s.spaceSeparated,v=s.negative,b=s.forceSign,_=s.exponential,w=s.roundingFunction,x="";if(d){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:a,forceAverage:l,lowPrecision:f,abbreviations:r.currentAbbreviations(),spaceSeparated:y,roundingFunction:w,totalLength:o});a=e.value,x+=e.abbreviation,o&&(h=e.mantissaPrecision)}if(_){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=(n=+n-(t-1))>=0?`+${n}`:n),{value:i,abbreviation:`e${n}`}}({value:a,characteristicPrecision:u});a=e.value,x=e.abbreviation+x}let N=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()}(a.toString(),a,p,h,m,w);if(N=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}(N=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()}(N,a,c,u),a,g,r,n),(d||_)&&(N+=x),b||a<0){var M,S;M=N,N=0===(S=a)?M:0==+M?M.replace("-",""):S>0?`+${M}`:"sign"===v?M:`(${M.replace("-","")})`}return N}function eb(e,t){if(!e)return t;let r=Object.keys(e);return 1===r.length&&"output"===r[0]?t:e}function e_(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 ew=ei(),ex=er(),eN=et(),eM=(...e)=>(function(e,t={},r){if("string"==typeof t&&(t=en.parseFormat(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;let 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 a=(n=t=eb(t,eo.currentPercentageDefaultFormat())).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-3600*u)/60),l=Math.round(e._value-3600*u-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,eZ),eS=(...e)=>(function(e){return eg(e._value,eh.suffixes,eh.scale).suffix})(...e,eZ),eE=(...e)=>(function(e){return eg(e._value,ep.suffixes,ep.scale).suffix})(...e,eZ),ek=(...e)=>(function(e){return eg(e._value,em.suffixes,em.scale).suffix})(...e,eZ),eO=eb,eA=(e,t)=>{let r,n;return r=new es(e._value),n=t,eZ.isNumbro(t)&&(n=t._value),n=new es(n),e._value=r.plus(n).toNumber(),e},eT=(e,t)=>e_(e,t,eZ),eC=(e,t)=>{let r,n;return r=new es(e._value),n=t,eZ.isNumbro(t)&&(n=t._value),n=new es(n),e._value=r.times(n).toNumber(),e},ej=(e,t)=>{let r,n;return r=new es(e._value),n=t,eZ.isNumbro(t)&&(n=t._value),n=new es(n),e._value=r.dividedBy(n).toNumber(),e},eI=(e,t)=>{let r;return r=t,eZ.isNumbro(t)&&(r=t._value),e._value=r,e},eF=(e,t)=>{let r;return e_(r=eZ(e._value),t,eZ),Math.abs(r._value)},eD=es;class eR{constructor(e){this._value=e}clone(){return eZ(this._value)}format(e={}){return eM(this,e)}formatCurrency(e){return"string"==typeof e&&(e=en.parseFormat(e)),(e=eO(e,ew.currentCurrencyDefaultFormat())).output="currency",eM(this,e)}formatTime(e={}){return e.output="time",eM(this,e)}binaryByteUnits(){return eE(this)}decimalByteUnits(){return ek(this)}byteUnits(){return eS(this)}difference(e){return eF(this,e)}add(e){return eA(this,e)}subtract(e){return eT(this,e)}multiply(e){return eC(this,e)}divide(e){return ej(this,e)}set(e){return eI(this,eP(e))}value(){return this._value}valueOf(){return this._value}}function eP(e){let t=e;return eZ.isNumbro(e)?t=e._value:"string"==typeof e?t=eZ.unformat(e):isNaN(e)&&(t=NaN),t}function eZ(e){return new eR(eP(e))}eZ.version="2.5.0",eZ.isNumbro=function(e){return e instanceof eR},eZ.language=ew.currentLanguage,eZ.registerLanguage=ew.registerLanguage,eZ.setLanguage=ew.setLanguage,eZ.languages=ew.languages,eZ.languageData=ew.languageData,eZ.zeroFormat=ew.setZeroFormat,eZ.defaultFormat=ew.currentDefaults,eZ.setDefaults=ew.setDefaults,eZ.defaultCurrencyFormat=ew.currentCurrencyDefaultFormat,eZ.validate=ex.validate,eZ.loadLanguagesInNode=e=>(function(e,t){e.forEach(e=>{let r;try{r=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.`)}r&&t.registerLanguage(r)})})(e,eZ),eZ.unformat=eN.unformat,eZ.BigNumber=eD;var ez=eZ&&eZ.__esModule&&Object.prototype.hasOwnProperty.call(eZ,"default")?eZ.default:eZ;let e$=3;function eB(e,{shortValues:t,decimalPlaces:r}){if(!Y(t)||1e3>Math.abs(e)){let n={style:"unit",unit:"byte",unitDisplay:"long",useGrouping:!0};return X(r)?(n.minimumFractionDigits=Q(r),n.maximumFractionDigits=Q(r)):Y(t)&&(n.maximumSignificantDigits=e$),Intl.NumberFormat("en-US",n).format(e)}return ez(e).format({output:"byte",base:"decimal",spaceSeparated:!0,mantissa:X(r)?r:2,trimMantissa:!X(r),optionalMantissa:!X(r)})}let eL="Percent",eU="Time";var eV=((af={}).milliseconds="millisecond",af.seconds="second",af.minutes="minute",af.hours="hour",af.days="day",af.weeks="week",af.months="month",af.years="year",af);let eq={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001},eG=["years","months","weeks","days","hours","minutes","seconds","milliseconds"],eW="Throughput",eK={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}},eJ={milliseconds:{group:eU,label:"Milliseconds"},seconds:{group:eU,label:"Seconds"},minutes:{group:eU,label:"Minutes"},hours:{group:eU,label:"Hours"},days:{group:eU,label:"Days"},weeks:{group:eU,label:"Weeks"},months:{group:eU,label:"Months"},years:{group:eU,label:"Years"},percent:{group:eL,label:"Percent (0-100)"},"percent-decimal":{group:eL,label:"Percent (0.0-1.0)"},"%":{disableSelectorOption:!0,group:eL,label:"%"},decimal:{group:"Decimal",label:"Decimal"},bytes:{group:"Bytes",label:"Bytes"},"bits/sec":{group:eW,label:"Bits/sec"},"bytes/sec":{group:eW,label:"Bytes/sec"},"counts/sec":{group:eW,label:"Counts/sec"},"events/sec":{group:eW,label:"Events/sec"},"messages/sec":{group:eW,label:"Messages/sec"},"ops/sec":{group:eW,label:"Ops/sec"},"packets/sec":{group:eW,label:"Packets/sec"},"reads/sec":{group:eW,label:"Reads/sec"},"requests/sec":{group:eW,label:"Requests/sec"},"records/sec":{group:eW,label:"Records/sec"},"rows/sec":{group:eW,label:"Rows/sec"},"writes/sec":{group:eW,label:"Writes/sec"}};function eH(e,t){if(void 0===t)return e.toString();if(e4(t))return eB(e,t);if(e2(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=e$),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(e1(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=e$,"percent"===t&&(e/=100),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(e0(t))return function(e,{unit:t,decimalPlaces:r}){var n;if(0===e)return"0s";let i=function(e,t){let r=e*eq[t],n=eG[0]||"years",i=n,a=r/eq[n];for(i of eG)if((a=r/eq[i])>=1)break;return{value:a,unit:i}}(e,t),a={style:"unit",unit:eV[i.unit],unitDisplay:"months"===(n=i.unit)||"years"===n?"long":"narrow"};return X(r)?(a.minimumFractionDigits=Q(r),a.maximumFractionDigits=Q(r)):a.maximumSignificantDigits=e$,Intl.NumberFormat("en-US",a).format(i.value)}(e,t);if(e3(t))return function(e,{unit:t,shortValues:r,decimalPlaces:n}){if("bytes/sec"===t){let t=1e3>Math.abs(e)?"sec":"s";return eB(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=e$),Intl.NumberFormat("en-US",i).format(e)+" "+t}(e,t);throw Error(`Unknown unit options ${t}`)}function eY(e){return eJ[e.unit]}function eX(e){return eY(e).group}function eQ(e){return eK[eY(e).group]}function e0(e){return"Time"===eX(e)}function e1(e){return"Percent"===eX(e)}function e2(e){return"Decimal"===eX(e)}function e4(e){return"Bytes"===eX(e)}function e9(e){return!!eQ(e).decimalPlaces}function e5(e){return!!eQ(e).shortValues}function e3(e){return"Throughput"===eX(e)}function e7(e){return"project"in e.metadata?e.metadata.project:void 0}let e6="$__all";(ad=aN||(aN={})).assertEqual=e=>e,ad.assertIs=function(e){},ad.assertNever=function(e){throw Error()},ad.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},ad.getValidEnumValues=e=>{let t=ad.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return ad.objectValues(r)},ad.objectValues=e=>ad.objectKeys(e).map(function(t){return e[t]}),ad.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},ad.find=(e,t)=>{for(let r of e)if(t(r))return r},ad.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,ad.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},ad.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(aM||(aM={})).mergeShapes=(e,t)=>({...e,...t});let e8=aN.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),te=e=>{switch(typeof e){case"undefined":return e8.undefined;case"string":return e8.string;case"number":return isNaN(e)?e8.nan:e8.number;case"boolean":return e8.boolean;case"function":return e8.function;case"bigint":return e8.bigint;case"symbol":return e8.symbol;case"object":if(Array.isArray(e))return e8.array;if(null===e)return e8.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return e8.promise;if("undefined"!=typeof Map&&e instanceof Map)return e8.map;if("undefined"!=typeof Set&&e instanceof Set)return e8.set;if("undefined"!=typeof Date&&e instanceof Date)return e8.date;return e8.object;default:return e8.unknown}},tt=aN.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 tr 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 tr))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,aN.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()}}tr.create=e=>new tr(e);let tn=(e,t)=>{let r;switch(e.code){case tt.invalid_type:r=e.received===e8.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case tt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,aN.jsonStringifyReplacer)}`;break;case tt.unrecognized_keys:r=`Unrecognized key(s) in object: ${aN.joinValues(e.keys,", ")}`;break;case tt.invalid_union:r="Invalid input";break;case tt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${aN.joinValues(e.options)}`;break;case tt.invalid_enum_value:r=`Invalid enum value. Expected ${aN.joinValues(e.options)}, received '${e.received}'`;break;case tt.invalid_arguments:r="Invalid function arguments";break;case tt.invalid_return_type:r="Invalid function return type";break;case tt.invalid_date:r="Invalid date";break;case tt.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}"`:aN.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case tt.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 tt.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 tt.custom:r="Invalid input";break;case tt.invalid_intersection_types:r="Intersection results could not be merged";break;case tt.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case tt.not_finite:r="Number must be finite";break;default:r=t.defaultError,aN.assertNever(e)}return{message:r}},ti=tn;function ta(){return ti}let ts=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 to(e,t){let r=ta(),n=ts({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===tn?void 0:tn].filter(e=>!!e)});e.common.issues.push(n)}class tu{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 tc;"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 tu.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 tc;"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 tc=Object.freeze({status:"aborted"}),tl=e=>({status:"dirty",value:e}),tf=e=>({status:"valid",value:e}),td=e=>"aborted"===e.status,th=e=>"dirty"===e.status,tp=e=>"valid"===e.status,tm=e=>"undefined"!=typeof Promise&&e instanceof Promise;function tg(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 ty(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,(ah=aS||(aS={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},ah.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class tv{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 tb=(e,t)=>{if(tp(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 tr(e.common.issues);return this._error=t,this._error}}};function t_(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)&&void 0!==a?a:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(s=null!=o?o:r)&&void 0!==s?s:i.defaultError}},description:i}}class tw{get description(){return this._def.description}_getType(e){return te(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:te(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tu,ctx:{common:e.parent.common,data:e.data,parsedType:te(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(tm(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)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:te(e)},i=this._parseSync({data:e,path:n.path,parent:n});return tb(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:te(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:n});return tp(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(e=>tp(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:te(e)},n=this._parse({data:e,path:r.path,parent:r});return tb(r,await (tm(n)?n:Promise.resolve(n)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{let i=e(t),a=()=>n.addIssue({code:tt.custom,...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 ra({schema:this,typeName:aO.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 rs.create(this,this._def)}nullable(){return ro.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tX.create(this)}promise(){return ri.create(this,this._def)}or(e){return t0.create([this,e],this._def)}and(e){return t4.create(this,e,this._def)}transform(e){return new ra({...t_(this._def),schema:this,typeName:aO.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ru({...t_(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:aO.ZodDefault})}brand(){return new rd({typeName:aO.ZodBranded,type:this,...t_(this._def)})}catch(e){return new rc({...t_(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:aO.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return rh.create(this,e)}readonly(){return rp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let tx=/^c[^\s-]{8,}$/i,tN=/^[0-9a-z]+$/,tM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tS=/^[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,tE=/^[a-z0-9_-]{21}$/i,tk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tO=/^[-+]?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)?)??$/,tA=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tT=/^(?:(?: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])$/,tC=/^(?:(?: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])$/,tj=/^(([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]))$/,tI=/^(([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])$/,tF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tR="((\\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])))",tP=RegExp(`^${tR}$`);function tZ(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 tz(e){let t=`${tR}T${tZ(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class t$ extends tw{_parse(e){var t,r,i,a;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==e8.string){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.string,received:t.parsedType}),tc}let o=new tu;for(let u of this._def.checks)if("min"===u.kind)e.data.length<u.value&&(to(s=this._getOrReturnCtx(e,s),{code:tt.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&&(to(s=this._getOrReturnCtx(e,s),{code:tt.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?to(s,{code:tt.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):r&&to(s,{code:tt.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),o.dirty())}else if("email"===u.kind)tA.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"email",code:tt.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)||(to(s=this._getOrReturnCtx(e,s),{validation:"emoji",code:tt.invalid_string,message:u.message}),o.dirty());else if("uuid"===u.kind)tS.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"uuid",code:tt.invalid_string,message:u.message}),o.dirty());else if("nanoid"===u.kind)tE.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"nanoid",code:tt.invalid_string,message:u.message}),o.dirty());else if("cuid"===u.kind)tx.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"cuid",code:tt.invalid_string,message:u.message}),o.dirty());else if("cuid2"===u.kind)tN.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"cuid2",code:tt.invalid_string,message:u.message}),o.dirty());else if("ulid"===u.kind)tM.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"ulid",code:tt.invalid_string,message:u.message}),o.dirty());else if("url"===u.kind)try{new URL(e.data)}catch(t){to(s=this._getOrReturnCtx(e,s),{validation:"url",code:tt.invalid_string,message:u.message}),o.dirty()}else"regex"===u.kind?(u.regex.lastIndex=0,u.regex.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"regex",code:tt.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)||(to(s=this._getOrReturnCtx(e,s),{code:tt.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)||(to(s=this._getOrReturnCtx(e,s),{code:tt.invalid_string,validation:{startsWith:u.value},message:u.message}),o.dirty()):"endsWith"===u.kind?e.data.endsWith(u.value)||(to(s=this._getOrReturnCtx(e,s),{code:tt.invalid_string,validation:{endsWith:u.value},message:u.message}),o.dirty()):"datetime"===u.kind?tz(u).test(e.data)||(to(s=this._getOrReturnCtx(e,s),{code:tt.invalid_string,validation:"datetime",message:u.message}),o.dirty()):"date"===u.kind?tP.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{code:tt.invalid_string,validation:"date",message:u.message}),o.dirty()):"time"===u.kind?RegExp(`^${tZ(u)}$`).test(e.data)||(to(s=this._getOrReturnCtx(e,s),{code:tt.invalid_string,validation:"time",message:u.message}),o.dirty()):"duration"===u.kind?tO.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"duration",code:tt.invalid_string,message:u.message}),o.dirty()):"ip"===u.kind?(t=e.data,!(("v4"===(r=u.version)||!r)&&tT.test(t)||("v6"===r||!r)&&tj.test(t))&&(to(s=this._getOrReturnCtx(e,s),{validation:"ip",code:tt.invalid_string,message:u.message}),o.dirty())):"jwt"===u.kind?!function(e,t){if(!tk.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)&&(to(s=this._getOrReturnCtx(e,s),{validation:"jwt",code:tt.invalid_string,message:u.message}),o.dirty()):"cidr"===u.kind?(i=e.data,!(("v4"===(a=u.version)||!a)&&tC.test(i)||("v6"===a||!a)&&tI.test(i))&&(to(s=this._getOrReturnCtx(e,s),{validation:"cidr",code:tt.invalid_string,message:u.message}),o.dirty())):"base64"===u.kind?tF.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"base64",code:tt.invalid_string,message:u.message}),o.dirty()):"base64url"===u.kind?tD.test(e.data)||(to(s=this._getOrReturnCtx(e,s),{validation:"base64url",code:tt.invalid_string,message:u.message}),o.dirty()):aN.assertNever(u);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:tt.invalid_string,...aS.errToObj(r)})}_addCheck(e){return new t$({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...aS.errToObj(e)})}url(e){return this._addCheck({kind:"url",...aS.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...aS.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...aS.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...aS.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...aS.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...aS.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...aS.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...aS.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...aS.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...aS.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...aS.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...aS.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)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...aS.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,...aS.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...aS.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...aS.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...aS.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...aS.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...aS.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...aS.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...aS.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...aS.errToObj(t)})}nonempty(e){return this.min(1,aS.errToObj(e))}trim(){return new t$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t$({...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}}t$.create=e=>{var t;return new t$({checks:[],typeName:aO.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...t_(e)})};class tB extends tw{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)!==e8.number){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.number,received:t.parsedType}),tc}let r=new tu;for(let n of this._def.checks)"int"===n.kind?aN.isInteger(e.data)||(to(t=this._getOrReturnCtx(e,t),{code:tt.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(to(t=this._getOrReturnCtx(e,t),{code:tt.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)&&(to(t=this._getOrReturnCtx(e,t),{code:tt.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)&&(to(t=this._getOrReturnCtx(e,t),{code:tt.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(to(t=this._getOrReturnCtx(e,t),{code:tt.not_finite,message:n.message}),r.dirty()):aN.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,aS.toString(t))}gt(e,t){return this.setLimit("min",e,!1,aS.toString(t))}lte(e,t){return this.setLimit("max",e,!0,aS.toString(t))}lt(e,t){return this.setLimit("max",e,!1,aS.toString(t))}setLimit(e,t,r,n){return new tB({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:aS.toString(n)}]})}_addCheck(e){return new tB({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:aS.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:aS.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:aS.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:aS.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:aS.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:aS.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:aS.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:aS.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:aS.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&&aN.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;"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)}}tB.create=e=>new tB({checks:[],typeName:aO.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...t_(e)});class tL extends tw{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)!==e8.bigint)return this._getInvalidInput(e);let r=new tu;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(to(t=this._getOrReturnCtx(e,t),{code:tt.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)&&(to(t=this._getOrReturnCtx(e,t),{code:tt.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(to(t=this._getOrReturnCtx(e,t),{code:tt.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):aN.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.bigint,received:t.parsedType}),tc}gte(e,t){return this.setLimit("min",e,!0,aS.toString(t))}gt(e,t){return this.setLimit("min",e,!1,aS.toString(t))}lte(e,t){return this.setLimit("max",e,!0,aS.toString(t))}lt(e,t){return this.setLimit("max",e,!1,aS.toString(t))}setLimit(e,t,r,n){return new tL({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:aS.toString(n)}]})}_addCheck(e){return new tL({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:aS.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:aS.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:aS.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:aS.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:aS.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}}tL.create=e=>{var t;return new tL({checks:[],typeName:aO.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...t_(e)})};class tU extends tw{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==e8.boolean){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.boolean,received:t.parsedType}),tc}return tf(e.data)}}tU.create=e=>new tU({typeName:aO.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...t_(e)});class tV extends tw{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==e8.date){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.date,received:t.parsedType}),tc}if(isNaN(e.data.getTime()))return to(this._getOrReturnCtx(e),{code:tt.invalid_date}),tc;let r=new tu;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(to(t=this._getOrReturnCtx(e,t),{code:tt.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(to(t=this._getOrReturnCtx(e,t),{code:tt.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):aN.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new tV({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:aS.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:aS.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}}tV.create=e=>new tV({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:aO.ZodDate,...t_(e)});class tq extends tw{_parse(e){if(this._getType(e)!==e8.symbol){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.symbol,received:t.parsedType}),tc}return tf(e.data)}}tq.create=e=>new tq({typeName:aO.ZodSymbol,...t_(e)});class tG extends tw{_parse(e){if(this._getType(e)!==e8.undefined){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.undefined,received:t.parsedType}),tc}return tf(e.data)}}tG.create=e=>new tG({typeName:aO.ZodUndefined,...t_(e)});class tW extends tw{_parse(e){if(this._getType(e)!==e8.null){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.null,received:t.parsedType}),tc}return tf(e.data)}}tW.create=e=>new tW({typeName:aO.ZodNull,...t_(e)});class tK extends tw{constructor(){super(...arguments),this._any=!0}_parse(e){return tf(e.data)}}tK.create=e=>new tK({typeName:aO.ZodAny,...t_(e)});class tJ extends tw{constructor(){super(...arguments),this._unknown=!0}_parse(e){return tf(e.data)}}tJ.create=e=>new tJ({typeName:aO.ZodUnknown,...t_(e)});class tH extends tw{_parse(e){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.never,received:t.parsedType}),tc}}tH.create=e=>new tH({typeName:aO.ZodNever,...t_(e)});class tY extends tw{_parse(e){if(this._getType(e)!==e8.undefined){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.void,received:t.parsedType}),tc}return tf(e.data)}}tY.create=e=>new tY({typeName:aO.ZodVoid,...t_(e)});class tX extends tw{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==e8.array)return to(t,{code:tt.invalid_type,expected:e8.array,received:t.parsedType}),tc;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(to(t,{code:e?tt.too_big:tt.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&&(to(t,{code:tt.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&&(to(t,{code:tt.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 tv(t,e,t.path,r)))).then(e=>tu.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new tv(t,e,t.path,r)));return tu.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new tX({...this._def,minLength:{value:e,message:aS.toString(t)}})}max(e,t){return new tX({...this._def,maxLength:{value:e,message:aS.toString(t)}})}length(e,t){return new tX({...this._def,exactLength:{value:e,message:aS.toString(t)}})}nonempty(e){return this.min(1,e)}}tX.create=(e,t)=>new tX({type:e,minLength:null,maxLength:null,exactLength:null,typeName:aO.ZodArray,...t_(t)});class tQ extends tw{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=aN.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==e8.object){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.object,received:t.parsedType}),tc}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof tH&&"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 tv(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof tH){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&&(to(r,{code:tt.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 tv(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=>tu.mergeObjectSync(t,e)):tu.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return aS.errToObj,new tQ({...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?void 0:i.call(n,t,r).message)&&void 0!==a?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=aS.errToObj(e).message)&&void 0!==s?s:o}:{message:o}}}:{}})}strip(){return new tQ({...this._def,unknownKeys:"strip"})}passthrough(){return new tQ({...this._def,unknownKeys:"passthrough"})}extend(e){return new tQ({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new tQ({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:aO.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new tQ({...this._def,catchall:e})}pick(e){let t={};return aN.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new tQ({...this._def,shape:()=>t})}omit(e){let t={};return aN.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new tQ({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof tQ){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=rs.create(e(i))}return new tQ({...t._def,shape:()=>r})}if(t instanceof tX)return new tX({...t._def,type:e(t.element)});if(t instanceof rs)return rs.create(e(t.unwrap()));if(t instanceof ro)return ro.create(e(t.unwrap()));if(t instanceof t9)return t9.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};return aN.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new tQ({...this._def,shape:()=>t})}required(e){let t={};return aN.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof rs;)e=e._def.innerType;t[r]=e}}),new tQ({...this._def,shape:()=>t})}keyof(){return rt(aN.objectKeys(this.shape))}}tQ.create=(e,t)=>new tQ({shape:()=>e,unknownKeys:"strip",catchall:tH.create(),typeName:aO.ZodObject,...t_(t)}),tQ.strictCreate=(e,t)=>new tQ({shape:()=>e,unknownKeys:"strict",catchall:tH.create(),typeName:aO.ZodObject,...t_(t)}),tQ.lazycreate=(e,t)=>new tQ({shape:e,unknownKeys:"strip",catchall:tH.create(),typeName:aO.ZodObject,...t_(t)});class t0 extends tw{_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 tr(e.ctx.common.issues));return to(t,{code:tt.invalid_union,unionErrors:r}),tc});{let e;let 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 tr(e));return to(t,{code:tt.invalid_union,unionErrors:i}),tc}}get options(){return this._def.options}}t0.create=(e,t)=>new t0({options:e,typeName:aO.ZodUnion,...t_(t)});let t1=e=>{if(e instanceof t8)return t1(e.schema);if(e instanceof ra)return t1(e.innerType());if(e instanceof re)return[e.value];if(e instanceof rr)return e.options;if(e instanceof rn)return aN.objectValues(e.enum);else if(e instanceof ru)return t1(e._def.innerType);else if(e instanceof tG)return[void 0];else if(e instanceof tW)return[null];else if(e instanceof rs)return[void 0,...t1(e.unwrap())];else if(e instanceof ro)return[null,...t1(e.unwrap())];else if(e instanceof rd)return t1(e.unwrap());else if(e instanceof rp)return t1(e.unwrap());else if(e instanceof rc)return t1(e._def.innerType);else return[]};class t2 extends tw{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e8.object)return to(t,{code:tt.invalid_type,expected:e8.object,received:t.parsedType}),tc;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}):(to(t,{code:tt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),tc)}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=t1(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 t2({typeName:aO.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...t_(r)})}}class t4 extends tw{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(td(e)||td(n))return tc;let i=function e(t,r){let n=te(t),i=te(r);if(t===r)return{valid:!0,data:t};if(n===e8.object&&i===e8.object){let n=aN.objectKeys(r),i=aN.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===e8.array&&i===e8.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===e8.date&&i===e8.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?((th(e)||th(n))&&t.dirty(),{status:t.value,value:i.data}):(to(r,{code:tt.invalid_intersection_types}),tc)};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}))}}t4.create=(e,t,r)=>new t4({left:e,right:t,typeName:aO.ZodIntersection,...t_(r)});class t9 extends tw{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e8.array)return to(r,{code:tt.invalid_type,expected:e8.array,received:r.parsedType}),tc;if(r.data.length<this._def.items.length)return to(r,{code:tt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tc;!this._def.rest&&r.data.length>this._def.items.length&&(to(r,{code:tt.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 tv(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>tu.mergeArray(t,e)):tu.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new t9({...this._def,rest:e})}}t9.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new t9({items:e,typeName:aO.ZodTuple,rest:null,...t_(t)})};class t5 extends tw{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!==e8.object)return to(r,{code:tt.invalid_type,expected:e8.object,received:r.parsedType}),tc;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new tv(r,e,r.path,e)),value:a._parse(new tv(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?tu.mergeObjectAsync(t,n):tu.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new t5(t instanceof tw?{keyType:e,valueType:t,typeName:aO.ZodRecord,...t_(r)}:{keyType:t$.create(),valueType:e,typeName:aO.ZodRecord,...t_(t)})}}class t3 extends tw{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!==e8.map)return to(r,{code:tt.invalid_type,expected:e8.map,received:r.parsedType}),tc;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new tv(r,e,r.path,[a,"key"])),value:i._parse(new tv(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 tc;("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 tc;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}t3.create=(e,t,r)=>new t3({valueType:t,keyType:e,typeName:aO.ZodMap,...t_(r)});class t7 extends tw{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e8.set)return to(r,{code:tt.invalid_type,expected:e8.set,received:r.parsedType}),tc;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(to(r,{code:tt.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&&(to(r,{code:tt.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 tc;"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 tv(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new t7({...this._def,minSize:{value:e,message:aS.toString(t)}})}max(e,t){return new t7({...this._def,maxSize:{value:e,message:aS.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}t7.create=(e,t)=>new t7({valueType:e,minSize:null,maxSize:null,typeName:aO.ZodSet,...t_(t)});class t6 extends tw{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e8.function)return to(t,{code:tt.invalid_type,expected:e8.function,received:t.parsedType}),tc;function r(e,r){return ts({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ta(),tn].filter(e=>!!e),issueData:{code:tt.invalid_arguments,argumentsError:r}})}function n(e,r){return ts({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ta(),tn].filter(e=>!!e),issueData:{code:tt.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ri){let e=this;return tf(async function(...t){let s=new tr([]),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 tf(function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new tr([r(t,s.error)]);let o=Reflect.apply(a,this,s.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new tr([n(o,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t6({...this._def,args:t9.create(e).rest(tJ.create())})}returns(e){return new t6({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new t6({args:e||t9.create([]).rest(tJ.create()),returns:t||tJ.create(),typeName:aO.ZodFunction,...t_(r)})}}class t8 extends tw{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})}}t8.create=(e,t)=>new t8({getter:e,typeName:aO.ZodLazy,...t_(t)});class re extends tw{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return to(t,{received:t.data,code:tt.invalid_literal,expected:this._def.value}),tc}return{status:"valid",value:e.data}}get value(){return this._def.value}}function rt(e,t){return new rr({values:e,typeName:aO.ZodEnum,...t_(t)})}re.create=(e,t)=>new re({value:e,typeName:aO.ZodLiteral,...t_(t)});class rr extends tw{constructor(){super(...arguments),aE.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return to(t,{expected:aN.joinValues(r),received:t.parsedType,code:tt.invalid_type}),tc}if(tg(this,aE,"f")||ty(this,aE,new Set(this._def.values),"f"),!tg(this,aE,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return to(t,{received:t.data,code:tt.invalid_enum_value,options:r}),tc}return tf(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 rr.create(e,{...this._def,...t})}exclude(e,t=this._def){return rr.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}aE=new WeakMap,rr.create=rt;class rn extends tw{constructor(){super(...arguments),ak.set(this,void 0)}_parse(e){let t=aN.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==e8.string&&r.parsedType!==e8.number){let e=aN.objectValues(t);return to(r,{expected:aN.joinValues(e),received:r.parsedType,code:tt.invalid_type}),tc}if(tg(this,ak,"f")||ty(this,ak,new Set(aN.getValidEnumValues(this._def.values)),"f"),!tg(this,ak,"f").has(e.data)){let e=aN.objectValues(t);return to(r,{received:r.data,code:tt.invalid_enum_value,options:e}),tc}return tf(e.data)}get enum(){return this._def.values}}ak=new WeakMap,rn.create=(e,t)=>new rn({values:e,typeName:aO.ZodNativeEnum,...t_(t)});class ri extends tw{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==e8.promise&&!1===t.common.async?(to(t,{code:tt.invalid_type,expected:e8.promise,received:t.parsedType}),tc):tf((t.parsedType===e8.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ri.create=(e,t)=>new ri({type:e,typeName:aO.ZodPromise,...t_(t)});class ra extends tw{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===aO.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=>{to(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 tc;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?tc:"dirty"===n.status||"dirty"===t.value?tl(n.value):n});{if("aborted"===t.value)return tc;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?tc:"dirty"===n.status||"dirty"===t.value?tl(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?tc:("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?tc:("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=>tp(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!tp(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}}}aN.assertNever(n)}}ra.create=(e,t,r)=>new ra({schema:e,typeName:aO.ZodEffects,effect:t,...t_(r)}),ra.createWithPreprocess=(e,t,r)=>new ra({schema:t,effect:{type:"preprocess",transform:e},typeName:aO.ZodEffects,...t_(r)});class rs extends tw{_parse(e){return this._getType(e)===e8.undefined?tf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:aO.ZodOptional,...t_(t)});class ro extends tw{_parse(e){return this._getType(e)===e8.null?tf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ro.create=(e,t)=>new ro({innerType:e,typeName:aO.ZodNullable,...t_(t)});class ru extends tw{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===e8.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ru.create=(e,t)=>new ru({innerType:e,typeName:aO.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...t_(t)});class rc extends tw{_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 tm(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new tr(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new tr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}rc.create=(e,t)=>new rc({innerType:e,typeName:aO.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...t_(t)});class rl extends tw{_parse(e){if(this._getType(e)!==e8.nan){let t=this._getOrReturnCtx(e);return to(t,{code:tt.invalid_type,expected:e8.nan,received:t.parsedType}),tc}return{status:"valid",value:e.data}}}rl.create=e=>new rl({typeName:aO.ZodNaN,...t_(e)});let rf=Symbol("zod_brand");class rd extends tw{_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 rh extends tw{_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?tc:"dirty"===e.status?(t.dirty(),tl(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?tc:"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 rh({in:e,out:t,typeName:aO.ZodPipeline})}}class rp extends tw{_parse(e){let t=this._def.innerType._parse(e),r=e=>(tp(e)&&(e.value=Object.freeze(e.value)),e);return tm(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function rm(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function rg(e,t={},r){return e?tK.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=rm(t,n),o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:r)||void 0===s||s;i.addIssue({code:"custom",...e,fatal:o})}});if(!o){let e=rm(t,n),o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:r)||void 0===s||s;i.addIssue({code:"custom",...e,fatal:o})}}):tK.create()}rp.create=(e,t)=>new rp({innerType:e,typeName:aO.ZodReadonly,...t_(t)});let ry={object:tQ.lazycreate};(ap=aO||(aO={})).ZodString="ZodString",ap.ZodNumber="ZodNumber",ap.ZodNaN="ZodNaN",ap.ZodBigInt="ZodBigInt",ap.ZodBoolean="ZodBoolean",ap.ZodDate="ZodDate",ap.ZodSymbol="ZodSymbol",ap.ZodUndefined="ZodUndefined",ap.ZodNull="ZodNull",ap.ZodAny="ZodAny",ap.ZodUnknown="ZodUnknown",ap.ZodNever="ZodNever",ap.ZodVoid="ZodVoid",ap.ZodArray="ZodArray",ap.ZodObject="ZodObject",ap.ZodUnion="ZodUnion",ap.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ap.ZodIntersection="ZodIntersection",ap.ZodTuple="ZodTuple",ap.ZodRecord="ZodRecord",ap.ZodMap="ZodMap",ap.ZodSet="ZodSet",ap.ZodFunction="ZodFunction",ap.ZodLazy="ZodLazy",ap.ZodLiteral="ZodLiteral",ap.ZodEnum="ZodEnum",ap.ZodEffects="ZodEffects",ap.ZodNativeEnum="ZodNativeEnum",ap.ZodOptional="ZodOptional",ap.ZodNullable="ZodNullable",ap.ZodDefault="ZodDefault",ap.ZodCatch="ZodCatch",ap.ZodPromise="ZodPromise",ap.ZodBranded="ZodBranded",ap.ZodPipeline="ZodPipeline",ap.ZodReadonly="ZodReadonly";let rv=t$.create,rb=tB.create,r_=rl.create,rw=tL.create,rx=tU.create,rN=tV.create,rM=tq.create,rS=tG.create,rE=tW.create,rk=tK.create,rO=tJ.create,rA=tH.create,rT=tY.create,rC=tX.create,rj=tQ.create,rI=tQ.strictCreate,rF=t0.create,rD=t2.create,rR=t4.create,rP=t9.create,rZ=t5.create,rz=t3.create,r$=t7.create,rB=t6.create,rL=t8.create,rU=re.create,rV=rr.create,rq=rn.create,rG=ri.create,rW=ra.create,rK=rs.create,rJ=ro.create,rH=ra.createWithPreprocess,rY=rh.create;var rX=Object.freeze({__proto__:null,defaultErrorMap:tn,setErrorMap:function(e){ti=e},getErrorMap:ta,makeIssue:ts,EMPTY_PATH:[],addIssueToContext:to,ParseStatus:tu,INVALID:tc,DIRTY:tl,OK:tf,isAborted:td,isDirty:th,isValid:tp,isAsync:tm,get util(){return aN},get objectUtil(){return aM},ZodParsedType:e8,getParsedType:te,ZodType:tw,datetimeRegex:tz,ZodString:t$,ZodNumber:tB,ZodBigInt:tL,ZodBoolean:tU,ZodDate:tV,ZodSymbol:tq,ZodUndefined:tG,ZodNull:tW,ZodAny:tK,ZodUnknown:tJ,ZodNever:tH,ZodVoid:tY,ZodArray:tX,ZodObject:tQ,ZodUnion:t0,ZodDiscriminatedUnion:t2,ZodIntersection:t4,ZodTuple:t9,ZodRecord:t5,ZodMap:t3,ZodSet:t7,ZodFunction:t6,ZodLazy:t8,ZodLiteral:re,ZodEnum:rr,ZodNativeEnum:rn,ZodPromise:ri,ZodEffects:ra,ZodTransformer:ra,ZodOptional:rs,ZodNullable:ro,ZodDefault:ru,ZodCatch:rc,ZodNaN:rl,BRAND:rf,ZodBranded:rd,ZodPipeline:rh,ZodReadonly:rp,custom:rg,Schema:tw,ZodSchema:tw,late:ry,get ZodFirstPartyTypeKind(){return aO},coerce:{string:e=>t$.create({...e,coerce:!0}),number:e=>tB.create({...e,coerce:!0}),boolean:e=>tU.create({...e,coerce:!0}),bigint:e=>tL.create({...e,coerce:!0}),date:e=>tV.create({...e,coerce:!0})},any:rk,array:rC,bigint:rw,boolean:rx,date:rN,discriminatedUnion:rD,effect:rW,enum:rV,function:rB,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>rg(t=>t instanceof e,t),intersection:rR,lazy:rL,literal:rU,map:rz,nan:r_,nativeEnum:rq,never:rA,null:rE,nullable:rJ,number:rb,object:rj,oboolean:()=>rx().optional(),onumber:()=>rb().optional(),optional:rK,ostring:()=>rv().optional(),pipeline:rY,preprocess:rH,promise:rG,record:rZ,set:r$,strictObject:rI,string:rv,symbol:rM,transformer:rW,tuple:rP,undefined:rS,union:rF,unknown:rO,void:rT,NEVER:tc,ZodIssueCode:tt,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:tr});let rQ=rX.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 _ . -"),r0=rX.object({name:rQ}),r1=r0.extend({project:rQ}),r2=rX.object({kind:rX.string().min(1,"Required"),spec:rX.record(rX.string(),rX.any())}),r4=rX.object({name:rX.string().optional(),description:rX.string().optional()}),r9=rX.object({display:r4.optional(),default:rX.boolean(),plugin:r2});function r5(e){return rX.object({display:r4.optional(),default:rX.boolean(),plugin:e})}let r3=rX.object({kind:rX.literal("Datasource"),metadata:r1,spec:r9}),r7=rX.object({kind:rX.literal("GlobalDatasource"),metadata:r0,spec:r9}),r6=rX.discriminatedUnion("kind",[r3,r7]),r8=rX.object({name:rX.string().min(1),spec:r9});function ne(e){return rX.object({name:rX.string().min(1),spec:r5(e)})}let nt=rX.string().min(1,"Required").regex(z,"Must be a valid duration string"),nr=rX.object({name:rX.string().min(1,{message:"Required"}),description:rX.string().optional()}),nn=rX.object({kind:rX.string().min(1),spec:rX.object({plugin:r2})}),ni=rX.object({name:rX.string().optional(),url:rX.string().min(1),tooltip:rX.string().optional(),renderVariables:rX.boolean().optional(),targetBlank:rX.boolean().optional()}),na=rX.object({display:nr,plugin:r2,queries:rX.array(nn).optional(),links:rX.array(ni).optional()});function ns(e){return rX.object({display:nr,plugin:e,queries:rX.array(nn).optional(),links:rX.array(ni).optional()})}let no=rX.object({kind:rX.literal("Panel"),spec:na});function nu(e){return rX.object({kind:rX.literal("Panel"),spec:ns(e)})}let nc=rX.object({groupId:rX.number(),panelDefinition:no});function nl(e){return rX.object({groupId:rX.number(),panelDefinition:nu(e)})}let nf=rX.object({actions:rX.array(rX.enum(["*","create","read","update","delete"])).nonempty("Must contains at least 1 action"),scopes:rX.array(rX.enum(["*","Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"])).nonempty("Must contains at least 1 scope")}),nd=rX.object({permissions:rX.array(nf)}),nh=rX.object({kind:rX.literal("Role"),metadata:r1,spec:nd}),np=rX.object({kind:rX.literal("GlobalRole"),metadata:r0,spec:nd}),nm=rX.discriminatedUnion("kind",[nh,np]),ng=rX.object({kind:rX.enum(["User"]),name:rQ}),ny=rX.object({role:rQ,subjects:rX.array(ng).nonempty()}),nv=rX.object({kind:rX.literal("RoleBinding"),metadata:r1,spec:ny}),nb=rX.object({kind:rX.literal("GlobalRoleBinding"),metadata:r0,spec:ny}),n_=rX.discriminatedUnion("kind",[nv,nb]),nw=rX.object({basicAuth:rX.object({username:rX.string().min(1),password:rX.string().optional(),passwordFile:rX.string().optional()}).superRefine((e,t)=>{e.password&&e.password.length>0&&e.passwordFile&&e.passwordFile.length>0&&(t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["password"]}),t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["passwordFile"]}))}).optional(),authorization:rX.object({type:rX.string().optional(),credentials:rX.string().optional(),credentialsFile:rX.string().optional()}).superRefine((e,t)=>{e.credentials&&e.credentials.length>0&&e.credentialsFile&&e.credentialsFile.length>0&&(t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentials"]}),t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentialsFile"]}))}).optional(),oauth:rX.object({clientID:rX.string().min(1),clientSecret:rX.string().optional(),clientSecretFile:rX.string().optional(),tokenURL:rX.string().min(1),scopes:rX.array(rX.string().nonempty()).default([]),endpointParams:rX.record(rX.string().nonempty(),rX.array(rX.string())).default({}).optional(),authStyle:rX.union([rX.literal(0),rX.literal(1),rX.literal(2)]).optional()}).superRefine((e,t)=>{e.clientSecret&&e.clientSecret.length>0&&e.clientSecretFile&&e.clientSecretFile.length>0&&(t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecret"]}),t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecretFile"]}))}).optional(),tlsConfig:rX.object({ca:rX.string().optional(),cert:rX.string().optional(),key:rX.string().optional(),caFile:rX.string().optional(),certFile:rX.string().optional(),keyFile:rX.string().optional(),serverName:rX.string().optional(),insecureSkipVerify:rX.boolean()}).superRefine((e,t)=>{e.ca&&e.ca.length>0&&e.caFile&&e.caFile.length>0&&(t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["ca"]}),t.addIssue({code:rX.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:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["cert"]}),t.addIssue({code:rX.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:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["key"]}),t.addIssue({code:rX.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:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["basicAuth"]}),t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["authorization"]}),t.addIssue({code:rX.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["oauth"]}))}),nx=rX.object({kind:rX.literal("Secret"),metadata:r1,spec:nw}),nN=rX.object({kind:rX.literal("GlobalSecret"),metadata:r0,spec:nw}),nM=rX.discriminatedUnion("kind",[nx,nN]),nS=rX.object({password:rX.string().optional()}),nE=rX.object({issuer:rX.string().optional(),email:rX.string().optional(),subject:rX.string().optional()}),nk=rX.object({firstName:rX.string().optional(),lastName:rX.string().optional(),nativeProvider:nS.optional(),oauthProviders:rX.array(nE).optional()}),nO=rX.object({kind:rX.literal("User"),metadata:r0,spec:nk}),nA=rX.object({name:rX.string().optional(),description:rX.string().optional(),hidden:rX.boolean().optional()}),nT=rX.object({name:rX.string().min(1),display:nA.optional(),defaultValue:rX.string().or(rX.array(rX.string())).optional(),allowAllValue:rX.boolean(),allowMultiple:rX.boolean(),customAllValue:rX.string().optional(),capturingRegexp:rX.string().optional(),sort:rX.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:r2});function nC(e){return rX.object({name:rX.string().min(1),display:nA.optional(),defaultValue:rX.string().or(rX.array(rX.string())).optional(),allowAllValue:rX.boolean(),allowMultiple:rX.boolean(),customAllValue:rX.string().optional(),capturingRegexp:rX.string().optional(),sort:rX.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:e})}let nj=rX.object({kind:rX.literal("ListVariable"),spec:nT});function nI(e){return rX.object({kind:rX.literal("ListVariable"),spec:nC(e)})}let nF=rX.object({name:rX.string().min(1),display:nA.optional(),value:rX.string(),constant:rX.boolean().optional()}),nD=rX.object({kind:rX.literal("TextVariable"),spec:nF}),nR=rX.discriminatedUnion("kind",[nD,nj]);function nP(e){return rX.union([nD,nI(e)])}let nZ=rX.object({kind:rX.literal("Variable"),metadata:r1,spec:nR}),nz=rX.object({kind:rX.literal("GlobalVariable"),metadata:r1,spec:nR}),n$=rX.discriminatedUnion("kind",[nZ,nz]),nB=nR;function nL(e){return rX.discriminatedUnion("kind",[rX.object({kind:rX.literal("ListVariable"),spec:nC(e)}),rX.object({kind:rX.literal("TextVariable"),spec:nF})])}var nU=r(54538);function nV(e){let t=(0,nU.useRef)(e);return(0,nU.useLayoutEffect)(()=>{t.current=e}),(0,nU.useCallback)((...e)=>t.current(...e),[])}async function nq(...e){let t=await r.g.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.json();if(e.error)throw new nK(e.error,t.status);if(e.message)throw new nK(e.message,t.status)}let r=await t.text();if(r)throw new nK(r,t.status);throw new nW(t)}return t}async function nG(...e){let t=await nq(...e);return await t.json()}class nW extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,nW.prototype)}}class nK extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,nK.prototype)}}function nJ(e){return 0===Object.getOwnPropertyNames(e).length}var nH=r(56141),nY=r.n(nH);function nX(e,t){let r=(0,nU.useRef)(),n=!0;for(let e=0;e<t.length;e++)if(r.current?.deps[e]!==t[e]){n=!1;break}return(void 0===r.current||!1===n)&&(r.current={value:e(),deps:t}),r.current.value}function nQ(e,t){let r=(0,nU.useRef)();return(void 0===r.current||!1===nY()(t,r.current.deps))&&(r.current={value:e(),deps:t}),r.current.value}function n0(e,t){let r=n1(t),n=e.panels[r];if(void 0===n)throw Error(`Could not resolve panels reference ${t.$ref}`);return n}function n1(e){return e.$ref.substring(14)}function n2(e){return{$ref:`#/spec/panels/${e}`}}function n4(e){return e.spec.spec?.display?.name?e.spec.spec.display.name:e.spec.display?.name?e.spec.display.name:e.metadata.name}function n9(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 n5=r(70252);function n3(e){return"number"==typeof e}function n7(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 n6(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function n8(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function ie(e){return e&&!0===e.constructor.prototype.isUnit||!1}function it(e){return"string"==typeof e}var ir=Array.isArray;function ii(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function ia(e){return Array.isArray(e)||ii(e)}function is(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function io(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function iu(e){return e&&!0===e.constructor.prototype.isRange||!1}function ic(e){return e&&!0===e.constructor.prototype.isIndex||!1}function il(e){return"boolean"==typeof e}function id(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function ih(e){return e&&!0===e.constructor.prototype.isHelp||!1}function ip(e){return"function"==typeof e}function im(e){return e instanceof Date}function ig(e){return e instanceof RegExp}function iy(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!n6(e)&&!n8(e))}function iv(e){return null===e}function ib(e){return void 0===e}function i_(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function iw(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function ix(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function iN(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function iM(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function iS(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function iE(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function ik(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function iO(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function iA(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function iT(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function iC(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ij(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function iI(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function iF(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function iD(e){return e&&!0===e.constructor.prototype.isChain||!1}function iR(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":n7(e)?"BigNumber":n6(e)?"Complex":n8(e)?"Fraction":ii(e)?"Matrix":ie(e)?"Unit":ic(e)?"Index":iu(e)?"Range":id(e)?"ResultSet":iA(e)?e.type:iD(e)?"Chain":ih(e)?"Help":"Object":"function"===t?"Function":t}function iP(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 iP(e)});if(e instanceof Date)return new Date(e.valueOf());if(n7(e))return e;if(e instanceof RegExp)throw TypeError("Cannot clone "+e);return iZ(e,iP)}function iZ(e,t){var r={};for(var n in e)iB(e,n)&&(r[n]=t(e[n]));return r}function iz(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(!iz(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)||!iz(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function i$(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 iB(e,t){return e&&Object.hasOwnProperty.call(e,t)}function iL(e){return Object.keys(e).map(t=>e[t])}var iU=r(8317);function iV(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(iG));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 iq(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function iG(e){return e&&"?"===e[0]?e.slice(1):e}function iW(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function iK(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!iW(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(!iW(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 iJ(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),n3(t)?r=t:n3(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=iH(e),n="number"==typeof t?iX(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,s=a+(t||0);return i.length<s&&(i=i.concat(iQ(s-i.length))),a<0&&(i=iQ(-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 iY(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iX(iH(e),t),n=r.exponent,i=r.coefficients,a=n%3==0?n:n<0?n-3-n%3:n-n%3;if(n3(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=n3(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 iK(e,2,n);case"oct":return iK(e,8,n);case"hex":return iK(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=iH(e),s=t?iX(a,t):a;if(s.exponent<n||s.exponent>=i)return iY(e,t);var o=s.coefficients,u=s.exponent;o.length<t&&(o=o.concat(iQ(t-o.length))),o=o.concat(iQ(u-o.length+1+(o.length<t?t-o.length:0))),o=iQ(-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 iH(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 iY(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iH(e),n=t?iX(r,t):r,i=n.coefficients,a=n.exponent;i.length<t&&(i=i.concat(iQ(t-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function iX(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 iQ(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var i0=Number.EPSILON||2220446049250313e-31;function i1(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<i0||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function i2(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(!iW(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 i4(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function i9(e,t){var r=function(e,t){var r;if("number"==typeof e)return iJ(e,t);if(n7(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 i4(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 i2(e,2,d);case"oct":return i2(e,8,d);case"hex":return i2(e,16,d);case"auto":var n,i,a,s,o,u,c,l,f,d,h,p=t&&void 0!==t.lowerExp?t.lowerExp:-3,m=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var g=e.toSignificantDigits(f),y=g.e;return(y>=p&&y<m?g.toFixed():i4(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);return(r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d?t&&"decimal"===t.fraction?e.toString():e.s*e.n+"/"+e.d:Array.isArray(e)?function e(t,r){if(!Array.isArray(t))return i9(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):it(e)?'"'+e+'"':"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>'"'+r+'": '+i9(e[r],t)).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function i5(e,t,r){if(!(this instanceof i5))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 i3(e,t,r){if(!(this instanceof i3))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 i7(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function i6(e,t){if(0===t.length){if(Array.isArray(e))throw new i5(e.length,0)}else!function e(t,r,n){var i,a=t.length;if(a!==r[n])throw new i5(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 i5(r.length-1,r.length,"<");e(t[i],r,s)}}else for(i=0;i<a;i++)if(Array.isArray(t[i]))throw new i5(r.length+1,r.length,">")}(e,t,0)}function i8(e,t){if(!n3(e)||!iW(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new i3(e,t)}function ae(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(!n3(e)||!iW(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+i9(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 at(e,t){var r=ar(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 ar(e){return e.reduce((e,t)=>e*t,1)}function an(e,t,r,n){var i=n||i7(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 ai(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?ai(a,t):t(a);if(void 0===r)r=o;else if(r!==o)return"mixed"}return r}function aa(e,t){return -1!==e.indexOf(t)}function as(e,t,r,n){if(!(this instanceof as))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}i5.prototype=RangeError(),i5.prototype.constructor=RangeError,i5.prototype.name="DimensionError",i5.prototype.isDimensionError=!0,i3.prototype=RangeError(),i3.prototype.constructor=RangeError,i3.prototype.name="IndexError",i3.prototype.isIndexError=!0,as.prototype=Error(),as.prototype.constructor=Error,as.prototype.name="ArgumentsError",as.prototype.isArgumentsError=!0;var ao={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},au=["Matrix","Array"],ac=["number","BigNumber","Fraction"];function al(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 af,ad,ah,ap,am,ag,ay,av,ab,a_,aw,ax,aN,aM,aS,aE,ak,aO,aA,aT,aC="0123456789abcdef",aj="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",aI="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",aF={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},aD=!0,aR="[DecimalError] ",aP=aR+"Invalid argument: ",aZ=aR+"Precision limit exceeded",az=aR+"crypto unavailable",a$="[object Decimal]",aB=Math.floor,aL=Math.pow,aU=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,aV=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,aq=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,aG=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,aW=aj.length-1,aK=aI.length-1,aJ={toStringTag:a$};function aH(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+=a7(r)),a+=n;(r=7-(n=(s=e[t])+"").length)&&(a+=a7(r))}else if(0===s)return"0";for(;s%10==0;)s/=10;return a+s}function aY(e,t,r){if(e!==~~e||e<t||e>r)throw Error(aP+e)}function aX(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=aL(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)==aL(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)==aL(10,t-3)-1,s}function aQ(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]+=aC.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()}aJ.absoluteValue=aJ.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),a1(e)},aJ.ceil=function(){return a1(new this.constructor(this),this.e+1,2)},aJ.clampedTo=aJ.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(aP+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},aJ.comparedTo=aJ.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},aJ.cosine=aJ.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/ss(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=sa(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,so(n,r)),n.precision=e,n.rounding=t,a1(2==aT||3==aT?r.neg():r,e,t,!0)):new n(1):new n(NaN)},aJ.cubeRoot=aJ.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(aD=!1,(a=this.s*aL(this.s*this,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=aH(this.d),(a=((e=this.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=aL(r,1/3),e=aB((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=a0((c=(u=(o=n).times(o).times(o)).plus(this)).plus(this).times(o),c.plus(u),s+2,1),aH(o.d).slice(0,s)===(r=aH(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))||(a1(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(a1(o,e+1,0),o.times(o).times(o).eq(this))){n=o;break}s+=4,i=1}return aD=!0,a1(n,e,l.rounding,t)},aJ.decimalPlaces=aJ.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-aB(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},aJ.dividedBy=aJ.div=function(e){return a0(this,new this.constructor(e))},aJ.dividedToIntegerBy=aJ.divToInt=function(e){var t=this.constructor;return a1(a0(this,new t(e),0,1,1),t.precision,t.rounding)},aJ.equals=aJ.eq=function(e){return 0===this.cmp(e)},aJ.floor=function(){return a1(new this.constructor(this),this.e+1,3)},aJ.greaterThan=aJ.gt=function(e){return this.cmp(e)>0},aJ.greaterThanOrEqualTo=aJ.gte=function(e){var t=this.cmp(e);return 1==t||0===t},aJ.hyperbolicCosine=aJ.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/ss(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=sa(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 a1(a,s.precision=r,s.rounding=n,!0)},aJ.hyperbolicSine=aJ.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=sa(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=sa(a,2,i=i.times(1/ss(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,a1(i,t,r,!0)},aJ.hyperbolicTangent=aJ.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,a0(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},aJ.inverseCosine=aJ.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()?a5(t,n,i):new t(0):new t(NaN):e.isZero()?a5(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))},aJ.inverseHyperbolicCosine=aJ.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,aD=!1,r=r.times(r).minus(1).sqrt().plus(r),aD=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},aJ.inverseHyperbolicSine=aJ.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,aD=!1,r=r.times(r).plus(1).sqrt().plus(r),aD=!0,n.precision=e,n.rounding=t,r.ln())},aJ.inverseHyperbolicTangent=aJ.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)?a1(new a(i),e,t,!0):(a.precision=r=n-i.e,i=a0(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)},aJ.inverseSine=aJ.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=a5(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))},aJ.inverseTangent=aJ.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);if(c.abs().eq(1)&&f+4<=aK)return(s=a5(l,f+4,d).times(.25)).s=c.s,s}else{if(!c.s)return new l(NaN);if(f+4<=aK)return(s=a5(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(aD=!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)),aD=!0,a1(s,l.precision=f,l.rounding=d,!0)},aJ.isFinite=function(){return!!this.d},aJ.isInteger=aJ.isInt=function(){return!!this.d&&aB(this.e/7)>this.d.length-2},aJ.isNaN=function(){return!this.s},aJ.isNegative=aJ.isNeg=function(){return this.s<0},aJ.isPositive=aJ.isPos=function(){return this.s>0},aJ.isZero=function(){return!!this.d&&0===this.d[0]},aJ.lessThan=aJ.lt=function(e){return 0>this.cmp(e)},aJ.lessThanOrEqualTo=aJ.lte=function(e){return 1>this.cmp(e)},aJ.logarithm=aJ.log=function(e){var t,r,n,i,a,s,o,u,c=this.constructor,l=c.precision,f=c.rounding;if(null==e)e=new c(10),t=!0;else{if(r=(e=new c(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new c(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t){if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}}if(aD=!1,aX((u=a0(s=sr(this,o=l+5),t?a9(c,o+10):sr(e,o),o,1)).d,i=l,f))do if(o+=10,u=a0(s=sr(this,o),t?a9(c,o+10):sr(e,o),o,1),!a){+aH(u.d).slice(i+1,i+15)+1==1e14&&(u=a1(u,l+1,0));break}while(aX(u.d,i+=10,f));return aD=!0,a1(u,l,f)},aJ.minus=aJ.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 aD?a1(e,o,u):e}if(r=aB(e.e/7),l=aB(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=a4(c,r),aD?a1(e,o,u):e):new h(3===u?-0:0)},aJ.modulo=aJ.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])?(aD=!1,9==r.modulo?(t=a0(this,e.abs(),0,3,1),t.s*=e.s):t=a0(this,e,0,r.modulo,1),t=t.times(e),aD=!0,this.minus(t)):a1(new r(this),r.precision,r.rounding):new r(NaN)},aJ.naturalExponential=aJ.exp=function(){return st(this)},aJ.naturalLogarithm=aJ.ln=function(){return sr(this)},aJ.negated=aJ.neg=function(){var e=new this.constructor(this);return e.s=-e.s,a1(e)},aJ.plus=aJ.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)),aD?a1(e,o,u):e;if(a=aB(this.e/7),n=aB(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=a4(c,n),aD?a1(e,o,u):e},aJ.precision=aJ.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(aP+e);return this.d?(t=a3(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},aJ.round=function(){var e=this.constructor;return a1(new e(this),this.e+1,e.rounding)},aJ.sine=aJ.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:sa(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=sa(e,2,t=t.times(1/ss(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,so(n,r)),n.precision=e,n.rounding=t,a1(aT>2?r.neg():r,e,t,!0)):new n(NaN)},aJ.squareRoot=aJ.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(aD=!1,0==(u=Math.sqrt(+this))||u==1/0?(((t=aH(s)).length+o)%2==0&&(t+="0"),u=Math.sqrt(t),o=aB((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(a0(this,a,r+2,1)).times(.5),aH(a.d).slice(0,r)===(t=aH(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))||(a1(n,o+1,1),e=!n.times(n).eq(this));break}if(!i&&(a1(a,o+1,0),a.times(a).eq(this))){n=a;break}r+=4,i=1}return aD=!0,a1(n,o,c.rounding,e)},aJ.tangent=aJ.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=a0(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,a1(2==aT||4==aT?r.neg():r,e,t,!0)):new n(NaN)},aJ.times=aJ.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)?f&&d?0*e.s:e.s/0:NaN);for(r=aB(this.e/7)+aB(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=a4(a,r),aD?a1(e,l.precision,l.rounding):e},aJ.toBinary=function(e,t){return su(this,2,e,t)},aJ.toDecimalPlaces=aJ.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(aY(e,0,1e9),void 0===t?t=n.rounding:aY(t,0,8),a1(r,e+r.e+1,t))},aJ.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=a2(n,!0):(aY(e,0,1e9),void 0===t?t=i.rounding:aY(t,0,8),r=a2(n=a1(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},aJ.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=a2(this):(aY(e,0,1e9),void 0===t?t=i.rounding:aY(t,0,8),r=a2(n=a1(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},aJ.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=a3(h)-this.e-1)%7,t.d[0]=aL(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(aP+o);e=o.gt(t)?a>0?t:c:o}for(aD=!1,o=new p(aH(h)),l=p.precision,p.precision=a=14*h.length;f=a0(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=a0(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>a0(c,n,a,1).minus(this).abs().cmp(a0(u,r,a,1).minus(this).abs())?[c,n]:[u,r],p.precision=l,aD=!0,d},aJ.toHexadecimal=aJ.toHex=function(e,t){return su(this,16,e,t)},aJ.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:aY(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]?(aD=!1,r=a0(r,e,0,t,1).times(e),aD=!0,a1(r)):(e.s=r.s,r=e),r},aJ.toNumber=function(){return+this},aJ.toOctal=function(e,t){return su(this,8,e,t)},aJ.toPower=aJ.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(aL(+o,c));if((o=new u(o)).eq(1))return o;if(n=u.precision,a=u.rounding,e.eq(1))return a1(o,n,a);if((t=aB(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=a6(u,o,r,n),e.s<0?new u(1).div(i):a1(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=aL(+o,c))&&isFinite(r)?new u(r+"").e:aB(c*(Math.log("0."+aH(o.d))/Math.LN10+o.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?s/0:0):(aD=!1,u.rounding=o.s=1,r=Math.min(12,(t+"").length),(i=st(e.times(sr(o,n+r)),n)).d&&aX((i=a1(i,n+5,1)).d,n,a)&&(t=n+10,+aH((i=a1(st(e.times(sr(o,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=a1(i,n+1,0))),i.s=s,aD=!0,u.rounding=a,a1(i,n,a))},aJ.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=a2(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(aY(e,1,1e9),void 0===t?t=i.rounding:aY(t,0,8),r=a2(n=a1(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},aJ.toSignificantDigits=aJ.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(aY(e,1,1e9),void 0===t?t=r.rounding:aY(t,0,8)),a1(new r(this),e,t)},aJ.toString=function(){var e=this.constructor,t=a2(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},aJ.truncated=aJ.trunc=function(){return a1(new this.constructor(this),this.e+1,1)},aJ.valueOf=aJ.toJSON=function(){var e=this.constructor,t=a2(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var a0=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,M,S,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)?C&&0==C[0]||!j?0*T:T/0:NaN);for(u?(h=1,l=n.e-i.e):(u=1e7,h=7,l=aB(n.e/h)-aB(i.e/h)),k=j.length,S=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<S||d)&&x--;f++)N=d*u+(C[f]||0),v[f]=N/j|0,d=N%j|0;p=d||f<S}else{for((d=u/(j[0]+1)|0)>1&&(j=e(j,d,u),C=e(C,d,u),k=j.length,S=C.length),M=k,_=(b=C.slice(0,k)).length;_<k;)b[_++]=0;(O=j.slice()).unshift(0),E=j[0],j[1]>=u/2&&++E;do d=0,(c=t(j,b,k,_))<0?(w=b[0],k!=_&&(w=w*u+(b[1]||0)),(d=w/E|0)>1?(d>=u&&(d=u-1),g=(m=e(j,d,u)).length,_=b.length,1==(c=t(m,b,g,_))&&(d--,r(m,k<g?O:j,g,u))):(0==d&&(c=d=1),m=j.slice()),(g=m.length)<_&&m.unshift(0),r(b,m,_,u),-1==c&&(_=b.length,(c=t(j,b,k,_))<1&&(d++,r(b,k<_?O:j,_,u))),_=b.length):0===c&&(d++,b=[0]),v[f++]=d,c&&b[0]?b[_++]=C[M]||0:(b=[C[M]],_=1);while((M++<S||void 0!==b[0])&&x--);p=void 0!==b[0]}v[0]||v.shift()}if(1==h)y.e=l,aA=p;else{for(f=1,d=v[0];d>=10;d/=10)f++;y.e=f+l*h-1,a1(y,o?a+y.e+1:a,s,p)}return y}}();function a1(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])/aL(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/aL(10,i-s-1)%10|0}if(n=n||t<0||void 0!==f[d+1]||(s<0?l:l%aL(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/aL(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]=aL(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=aL(10,7-a),f[d]=s>0?(l/aL(10,i-s)%aL(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}if(f[d]+=o,1e7!=f[d])break;f[d--]=0,o=1}for(a=f.length;0===f[--a];)f.pop()}return aD&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e<h.minE&&(e.e=0,e.d=[0])),e}function a2(e,t,r){if(!e.isFinite())return sn(e);var n,i=e.e,a=aH(e.d),s=a.length;return t?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+a7(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+a7(-i-1)+a,r&&(n=r-s)>0&&(a+=a7(n))):i>=s?(a+=a7(i+1-s),r&&(n=r-i-1)>0&&(a=a+"."+a7(n))):((n=i+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(a+="."),a+=a7(n))),a}function a4(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function a9(e,t,r){if(t>aW)throw aD=!0,r&&(e.precision=r),Error(aZ);return a1(new e(aj),t,1,!0)}function a5(e,t,r){if(t>aK)throw Error(aZ);return a1(new e(aI),t,r,!0)}function a3(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 a7(e){for(var t="";e--;)t+="0";return t}function a6(e,t,r,n){var i,a=new e(1),s=Math.ceil(n/7+4);for(aD=!1;;){if(r%2&&sc((a=a.times(t)).d,s)&&(i=!0),0===(r=aB(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}sc((t=t.times(t)).d,s)}return aD=!0,a}function a8(e){return 1&e.d[e.d.length-1]}function se(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 st(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]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(null==t?(aD=!1,u=p):u=t,o=new d(.03125);e.e>-2;)e=e.times(o),f+=5;for(u+=n=Math.log(aL(2,f))/Math.LN10*2+5|0,r=a=s=new d(1),d.precision=u;;){if(a=a1(a.times(e),u,1),r=r.times(++l),aH((o=s.plus(a0(a,r,u,1))).d).slice(0,u)===aH(s.d).slice(0,u)){for(i=f;i--;)s=a1(s.times(s),u,1);if(null!=t)return d.precision=p,s;if(!(c<3&&aX(s.d,u-n,h,c)))return a1(s,d.precision=p,h,aD=!0);d.precision=u+=10,r=a=o=new d(1),l=0,c++}s=o}}function sr(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?(aD=!1,l=v):l=t,g.precision=l+=10,n=(r=aH(m)).charAt(0),!(15e14>Math.abs(a=p.e)))return c=a9(g,l+2,v).times(a+""),p=sr(new g(n+"."+r.slice(1)),l-10).plus(c),g.precision=v,null==t?a1(p,v,y,aD=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=aH((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=a0(p.minus(1),p.plus(1),l,1),d=a1(p.times(p),l,1),i=3;;){if(s=a1(s.times(d),l,1),aH((c=u.plus(a0(s,new g(i),l,1))).d).slice(0,l)===aH(u.d).slice(0,l)){if(u=u.times(2),0!==a&&(u=u.plus(a9(g,l+2,v).times(a+""))),u=a0(u,new g(h),l,1),null!=t)return g.precision=v,u;if(!aX(u.d,l-10,y,o))return a1(u,g.precision=v,y,aD=!0);g.precision=l+=10,c=s=p=a0(f.minus(1),f.plus(1),l,1),d=a1(p.times(p),l,1),i=o=1}u=c,i+=2}}function sn(e){return String(e.s*e.s/0)}function si(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),aD&&(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 sa(e,t,r,n,i){var a,s,o,u,c=e.precision,l=Math.ceil(c/7);for(aD=!1,u=r.times(r),o=new e(n);;){if(s=a0(o.times(u),new e(t++*t++),c,1),o=i?n.plus(s):n.minus(s),n=a0(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 aD=!0,s.d.length=l+1,s}function ss(e,t){for(var r=e;--t;)r*=e;return r}function so(e,t){var r,n=t.s<0,i=a5(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return aT=n?4:1,t;if((r=t.divToInt(i)).isZero())aT=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return aT=a8(r)?n?2:3:n?4:1,t;aT=a8(r)?n?1:4:n?3:2}return t.minus(i).abs()}function su(e,t,r,n){var i,a,s,o,u,c,l,f,d,h=e.constructor,p=void 0!==r;if(p?(aY(r,1,1e9),void 0===n?n=h.rounding:aY(n,0,8)):(r=h.precision,n=h.rounding),e.isFinite()){for(s=(l=a2(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=aQ(a2(d),10,i),d.e=d.d.length),a=u=(f=aQ(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=a0(e,d,r,n,0,i)).d,a=e.e,c=aA),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+=aC.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=aQ(l,i,t)).length;!f[u-1];--u);for(s=1,l="1.";s<u;s++)l+=aC.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=sn(e);return e.s<0?"-"+l:l}function sc(e,t){if(e.length>t)return e.length=t,!0}function sl(e){return new this(e).abs()}function sf(e){return new this(e).acos()}function sd(e){return new this(e).acosh()}function sh(e,t){return new this(e).plus(t)}function sp(e){return new this(e).asin()}function sm(e){return new this(e).asinh()}function sg(e){return new this(e).atan()}function sy(e){return new this(e).atanh()}function sv(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?a5(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=a5(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(a0(e,t,a,1)),t=a5(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(a0(e,t,a,1)):(r=a5(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function sb(e){return new this(e).cbrt()}function s_(e){return a1(e=new this(e),e.e+1,2)}function sw(e,t,r){return new this(e).clamp(t,r)}function sx(e){if(!e||"object"!=typeof e)throw Error(aR+"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]=aF[r]),void 0!==(n=e[r])){if(aB(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(aP+r+": "+n)}if(r="crypto",i&&(this[r]=aF[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(az)}else this[r]=!1}else throw Error(aP+r+": "+n)}return this}function sN(e){return new this(e).cos()}function sM(e){return new this(e).cosh()}function sS(e,t){return new this(e).div(t)}function sE(e){return new this(e).exp()}function sk(e){return a1(e=new this(e),e.e+1,3)}function sO(){var e,t,r=new this(0);for(e=0,aD=!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 aD=!0,new this(1/0);r=t}return aD=!0,r.sqrt()}function sA(e){return e instanceof sH||e&&e.toStringTag===a$||!1}function sT(e){return new this(e).ln()}function sC(e,t){return new this(e).log(t)}function sj(e){return new this(e).log(2)}function sI(e){return new this(e).log(10)}function sF(){return se(this,arguments,-1)}function sD(){return se(this,arguments,1)}function sR(e,t){return new this(e).mod(t)}function sP(e,t){return new this(e).mul(t)}function sZ(e,t){return new this(e).pow(t)}function sz(e){var t,r,n,i,a=0,s=new this(1),o=[];if(void 0===e?e=this.precision:aY(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(az)}else for(;a<n;)o[a++]=1e7*Math.random()|0;for(n=o[--a],e%=7,n&&e&&(i=aL(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 s$(e){return a1(e=new this(e),e.e+1,this.rounding)}function sB(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sL(e){return new this(e).sin()}function sU(e){return new this(e).sinh()}function sV(e){return new this(e).sqrt()}function sq(e,t){return new this(e).sub(t)}function sG(){var e=0,t=arguments,r=new this(t[0]);for(aD=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return aD=!0,a1(r,this.precision,this.rounding)}function sW(e){return new this(e).tan()}function sK(e){return new this(e).tanh()}function sJ(e){return a1(e=new this(e),e.e+1,1)}aJ[Symbol.for("nodejs.util.inspect.custom")]=aJ.toString,aJ[Symbol.toStringTag]="Decimal";var sH=aJ.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,sA(e)){this.s=e.s,aD?!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++;aD?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 si(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),aG.test(e)?si(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"),aG.test(t))return si(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(aV.test(t))r=16,t=t.toLowerCase();else if(aU.test(t))r=2;else if(aq.test(t))r=8;else throw Error(aP+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=a6(n,new n(r),a,2*a)),a=l=(c=aQ(t,r,1e7)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=a4(c,l),e.d=c,aD=!1,s&&(e=a0(e,i,4*o)),u&&(e=e.times(54>Math.abs(u)?aL(2,u):sH.pow(2,u))),aD=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,si(this,e.toString());throw Error(aP+e)}if(a.prototype=aJ,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=sx,a.clone=e,a.isDecimal=sA,a.abs=sl,a.acos=sf,a.acosh=sd,a.add=sh,a.asin=sp,a.asinh=sm,a.atan=sg,a.atanh=sy,a.atan2=sv,a.cbrt=sb,a.ceil=s_,a.clamp=sw,a.cos=sN,a.cosh=sM,a.div=sS,a.exp=sE,a.floor=sk,a.hypot=sO,a.ln=sT,a.log=sC,a.log10=sI,a.log2=sj,a.max=sF,a.min=sD,a.mod=sR,a.mul=sP,a.pow=sZ,a.random=sz,a.round=s$,a.sign=sB,a.sin=sL,a.sinh=sU,a.sqrt=sV,a.sub=sq,a.sum=sG,a.tan=sW,a.tanh=sK,a.trunc=sJ,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}(aF);aj=new sH(aj),aI=new sH(aI);var sY={createBigNumberClass:iV("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=sH.clone({precision:r.precision,modulo:sH.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})},sX={createMatrixClass:iV("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})},sQ={MatrixDependencies:sX,createDenseMatrixClass:iV("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&&!it(t))throw Error("Invalid datatype: "+t);if(ii(e))"DenseMatrix"===e.type?(this._data=iP(e._data),this._size=iP(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&ir(e.data)&&ir(e.size))this._data=e.data,this._size=e.size,i6(this._data,this._size),this._datatype=t||e.datatype;else if(ir(e))this._data=function e(t){for(var r=0,n=t.length;r<n;r++){var i=t[r];ir(i)?t[r]=e(i):i&&!0===i.isMatrix&&(t[r]=e(i.valueOf()))}return t}(e),this._size=i7(this._data),i6(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+iR(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;ir(n);)n=n[0];return n}return e._size=t.slice(0),e._data=ae(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 ai(this._data,iR)},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(!ic(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 i5(n.length,e._size.length);for(var i=t.min(),a=t.max(),s=0,o=e._size.length;s<o;s++)i8(i[s],e._size[s]),i8(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 i8(e,t.length),t[e]}).valueOf():s.map(function(a){return i8(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(ii(r)?(a=r.size(),r=r.valueOf()):a=i7(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 i5(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=an(r,s.length,c,a)}if(!iz(s,a))throw new i5(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){i8(e),t[e]=n[r[0]]}):o.forEach(function(s,o){i8(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(!ir(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new i5(e.length,this._size.length);for(var t=0;t<e.length;t++)i8(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var a=e[n];i8(a,r.length),r=r[a]}return r},r.prototype.set=function(e,t,r){if(!ir(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new i5(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++)i8(s=e[n],o.length),o=o[s];return i8(s=e[e.length-1],o.length),o[s]=t,this},r.prototype.resize=function(e,t,r){if(!ia(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 i5(0,n,"!=");var i=ar(t=at(t,n));if(n!==i)throw new i5(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 i5)throw new i5(i,n,"!=");throw e}}(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=at(e,n),r},r.prototype.clone=function(){return new r({data:iP(this._data),size:iP(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 ir(n)?n.map(function(e,t){return r(e,i.concat(t))}):e(n,i,t)}(this._data,[]),i=void 0!==this._datatype?ai(n,iR):void 0;return new r(n,i)},r.prototype.forEach=function(e){var t=this;!function r(n,i){ir(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(ir(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 iP(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return i9(this._data,e)},r.prototype.toString=function(){return i9(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(n7(e)&&(e=e.toNumber()),!n3(e)||!iW(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(!ir(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(n7(e)&&(e=e.toNumber()),!n3(e)||!iW(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(n7(n)&&(n=n.toNumber()),!n3(n)||!iW(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(ir(t)){if(t.length!==l)throw Error("Invalid value array length");a=function(e){return t[e]}}else if(ii(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=n7(a(0))?a(0).mul(0):0);var d=[];if(e.length>0){d=ae(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(!n3(e)||!iW(e)||!n3(t)||!iW(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return i8(e,this._size[0]),i8(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 s0=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},s1=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},s2=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)},s4=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))},s9=function(){throw SyntaxError("Invalid Param")};function s5(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 s3={re:0,im:0},s7=function(e,t){if(null==e)s3.re=s3.im=0;else if(void 0!==t)s3.re=e,s3.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)s3.re=e.re,s3.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return s6.INFINITY;s3.re=e.abs*Math.cos(e.arg),s3.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return s6.INFINITY;s3.re=e.r*Math.cos(e.phi),s3.im=e.r*Math.sin(e.phi)}else 2===e.length?(s3.re=e[0],s3.im=e[1]):s9();break;case"string":s3.im=s3.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&s9();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&&s9()," "===r[e+1]||isNaN(r[e+1])?s3.im+=parseFloat((i%2?"-":"")+"1"):(s3.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&s9(),"i"===r[e+1]||"I"===r[e+1]?(s3.im+=parseFloat((i%2?"-":"")+t),e++):s3.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&s9();break;case"number":s3.im=0,s3.re=e;break;default:s9()}return isNaN(s3.re)||isNaN(s3.im),s3};function s6(e,t){if(!(this instanceof s6))return new s6(e,t);let r=s7(e,t);this.re=r.re,this.im=r.im}s6.prototype={re:0,im:0,sign:function(){let e=s4(this.re,this.im);return new s6(this.re/e,this.im/e)},add:function(e,t){let r=s7(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?s6.NAN:s6.INFINITY:new s6(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=s7(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?s6.NAN:s6.INFINITY:new s6(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=s7(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?s6.NAN:n||i?s6.INFINITY:0===r.im&&0===this.im?new s6(this.re*r.re,0):new s6(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=s7(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 s6.NAN;if(s||n)return s6.INFINITY;if(a||i)return s6.ZERO;if(0===r.im)return new s6(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 s6((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 s6((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=s7(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return s6.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new s6(Math.pow(this.re,r.re),0);if(0===this.re)switch((r.re%4+4)%4){case 0:return new s6(Math.pow(this.im,r.re),0);case 1:return new s6(0,Math.pow(this.im,r.re));case 2:return new s6(-Math.pow(this.im,r.re),0);case 3:return new s6(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return s6.ZERO;let i=Math.atan2(this.im,this.re),a=s5(this.re,this.im),s=Math.exp(r.re*a-r.im*i),o=r.im*a+r.re*i;return new s6(s*Math.cos(o),s*Math.sin(o))},sqrt:function(){let e=this.re,t=this.im;if(0===t)return e>=0?new s6(Math.sqrt(e),0):new s6(0,Math.sqrt(-e));let r=Math.sqrt(.5*(s4(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new s6(r,t<0?-n:n):new s6(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new s6(e,0):new s6(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new s6(Math.expm1(e)*Math.cos(t)+s2(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new s6(Math.log(e),0):new s6(s5(e,t),Math.atan2(t,e))},abs:function(){return s4(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new s6(Math.sin(e)*s0(t),Math.cos(e)*s1(t))},cos:function(){let e=this.re,t=this.im;return new s6(Math.cos(e)*s0(t),-Math.sin(e)*s1(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+s0(t);return new s6(Math.sin(e)/r,s1(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-s0(t);return new s6(-Math.sin(e)/r,s1(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*s0(2*t)+.5*Math.cos(2*e);return new s6(Math.cos(e)*s0(t)/r,Math.sin(e)*s1(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*s0(2*t)-.5*Math.cos(2*e);return new s6(Math.sin(e)*s0(t)/r,-Math.cos(e)*s1(t)/r)},asin:function(){let e=this.re,t=this.im,r=new s6(t*t-e*e+1,-2*e*t).sqrt(),n=new s6(r.re-t,r.im+e).log();return new s6(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new s6(t*t-e*e+1,-2*e*t).sqrt(),n=new s6(r.re-t,r.im+e).log();return new s6(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new s6(0,1/0);if(-1===t)return new s6(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new s6((1-t*t-e*e)/r,-2*e/r).log();return new s6(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new s6(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new s6(e/r,-t/r).atan():new s6(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 s6(0,1/0);let r=e*e+t*t;return 0!==r?new s6(e/r,-t/r).acos():new s6(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 s6(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new s6(e/r,-t/r).asin():new s6(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new s6(s1(e)*Math.cos(t),s0(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new s6(s0(e)*Math.cos(t),s1(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=s0(e)+Math.cos(t);return new s6(s1(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=s0(e)-Math.cos(t);return new s6(s1(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-s0(2*e);return new s6(-2*s1(e)*Math.cos(t)/r,2*s0(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+s0(2*e);return new s6(2*s0(e)*Math.cos(t)/r,-2*s1(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 s6((n*r-t*t)/i,(t*r+n*t)/i):new s6(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=s5(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 s6(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new s6(e/r,-t/r).atanh():new s6(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 s6(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let r=e*e+t*t;return 0!==r?new s6(e/r,-t/r).asinh():new s6(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return s6.INFINITY;let r=e*e+t*t;return 0!==r?new s6(e/r,-t/r).acosh():new s6(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return s6.INFINITY;if(this.isInfinite())return s6.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new s6(e/r,-t/r)},conjugate:function(){return new s6(this.re,-this.im)},neg:function(){return new s6(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new s6(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new s6(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new s6(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=s7(e,t);return Math.abs(r.re-this.re)<=s6.EPSILON&&Math.abs(r.im-this.im)<=s6.EPSILON},clone:function(){return new s6(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<s6.EPSILON&&(e=0),Math.abs(t)<s6.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()}},s6.ZERO=new s6(0,0),s6.ONE=new s6(1,0),s6.I=new s6(0,1),s6.PI=new s6(Math.PI,0),s6.E=new s6(Math.E,0),s6.INFINITY=new s6(1/0,1/0),s6.NAN=new s6(NaN,NaN),s6.EPSILON=1e-15;var s8=iV("Complex",[],()=>(s6.prototype.type="Complex",s6.prototype.isComplex=!0,s6.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},s6.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},s6.prototype.format=function(e){var t="",r=this.im,n=this.re,i=iJ(this.re,e),a=iJ(this.im,e),s=n3(e)?e:e?e.precision:null;if(null!==s){var o=Math.pow(10,-s);Math.abs(n/r)<o&&(n=0),Math.abs(r/n)<o&&(r=0)}return 0===r?i:0===n?1===r?"i":-1===r?"-i":a+"i":r<0?-1===r?i+" - i":i+" - "+a.substring(1)+"i":1===r?i+" + i":i+" + "+a+"i"},s6.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return s6(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(n3(r)){if(ie(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),n3(n))return new s6({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")}},s6.prototype.valueOf=s6.prototype.toString,s6.fromJSON=function(e){return new s6(e)},s6.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},s6),{isClass:!0}),oe={s:1,n:0,d:1};function ot(e,t){if(isNaN(e=parseInt(e,10)))throw ou();return e*t}function or(e,t){if(0===t)throw oo();var r=Object.create(os.prototype);r.s=e<0?-1:1;var n=oa(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function on(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 oi=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 oc()}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 ou();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 ou();if("-"===d[f]?(a=-1,f++):"+"===d[f]&&f++,d.length===f+1?o=ot(d[f++],a):"."===d[f+1]||"."===d[f]?("."!==d[f]&&(s=ot(d[f++],a)),(++f+1===d.length||"("===d[f+1]&&")"===d[f+3]||"'"===d[f+1]&&"'"===d[f+3])&&(o=ot(d[f],a),c=Math.pow(10,d[f].length),f++),("("===d[f]&&")"===d[f+2]||"'"===d[f]&&"'"===d[f+2])&&(u=ot(d[f+1],a),l=Math.pow(10,d[f+1].length)-1,f+=3)):"/"===d[f+1]||":"===d[f+1]?(o=ot(d[f],a),c=ot(d[f+2],1),f+=3):"/"===d[f+3]&&" "===d[f+1]&&(s=ot(d[f],a),o=ot(d[f+2],a),c=ot(d[f+4],1),f+=5),d.length<=f){a=n=u+(i=c*l)*s+l*o;break}default:throw ou()}if(0===i)throw oo();oe.s=a<0?-1:1,oe.n=Math.abs(n),oe.d=Math.abs(i)};function oa(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function os(e,t){if(oi(e,t),!(this instanceof os))return or(oe.s*oe.n,oe.d);e=oa(oe.d,oe.n),this.s=oe.s,this.n=oe.n/e,this.d=oe.d/e}var oo=function(){return Error("Division by Zero")},ou=function(){return Error("Invalid argument")},oc=function(){return Error("Parameters must be integer")};os.prototype={s:1,n:0,d:1,abs:function(){return or(this.n,this.d)},neg:function(){return or(-this.s*this.n,this.d)},add:function(e,t){return oi(e,t),or(this.s*this.n*oe.d+oe.s*this.d*oe.n,this.d*oe.d)},sub:function(e,t){return oi(e,t),or(this.s*this.n*oe.d-oe.s*this.d*oe.n,this.d*oe.d)},mul:function(e,t){return oi(e,t),or(this.s*oe.s*this.n*oe.n,this.d*oe.d)},div:function(e,t){return oi(e,t),or(this.s*oe.s*this.n*oe.d,this.d*oe.n)},clone:function(){return or(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new os(NaN);if(void 0===e)return or(this.s*this.n%this.d,1);if(oi(e,t),0===oe.n&&0===this.d)throw oo();return or(this.s*(oe.d*this.n)%(oe.n*this.d),oe.d*this.d)},gcd:function(e,t){return oi(e,t),or(oa(oe.n,this.n)*oa(oe.d,this.d),oe.d*this.d)},lcm:function(e,t){return(oi(e,t),0===oe.n&&0===this.n)?or(0,1):or(oe.n*this.n,oa(oe.n,this.n)*oa(oe.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new os(NaN):or(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 os(NaN):or(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 os(NaN):or(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return oi(e,t),or(this.s*Math.round(this.n*oe.d/(this.d*oe.n))*oe.n,oe.d)},inverse:function(){return or(this.s*this.d,this.n)},pow:function(e,t){if(oi(e,t),1===oe.d)return oe.s<0?or(Math.pow(this.s*this.d,oe.n),Math.pow(this.n,oe.n)):or(Math.pow(this.s*this.n,oe.n),Math.pow(this.d,oe.n));if(this.s<0)return null;var r=on(this.n),n=on(this.d),i=1,a=1;for(var s in r)if("1"!==s){if("0"===s){i=0;break}if(r[s]*=oe.n,r[s]%oe.d!=0)return null;r[s]/=oe.d,i*=Math.pow(s,r[s])}for(var s in n)if("1"!==s){if(n[s]*=oe.n,n[s]%oe.d!=0)return null;n[s]/=oe.d,a*=Math.pow(s,n[s])}return oe.s<0?or(a,i):or(i,a)},equals:function(e,t){return oi(e,t),this.s*this.n*oe.d==oe.s*oe.n*this.d},compare:function(e,t){oi(e,t);var r=this.s*this.n*oe.d-oe.s*oe.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=or(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 oi(e,t),!(!(oe.n*this.d)||this.n*oe.d%(oe.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 ol=iV("Fraction",[],()=>(os.prototype.type="Fraction",os.prototype.isFraction=!0,os.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},os.fromJSON=function(e){return new os(e)},os),{isClass:!0}),of=r(27554);function od(e,t){return!!e&&"object"==typeof e&&(!!iB(op,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function oh(e){return"object"==typeof e&&e&&e.constructor===Object}var op={length:!0,name:!0},om={toString:!0,valueOf:!0,toLocaleString:!0};class og{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return function(e,t){var r,n;if(oh(e)&&od(e,t))return e[t];if("function"==typeof e[t]&&(r=e,n=t,!(null==r||"function"!=typeof r[n]||iB(r,n)&&Object.getPrototypeOf&&n in Object.getPrototypeOf(r))&&(iB(om,n)||!(n in Object.prototype)&&!(n in Function.prototype))))throw Error('Cannot access method "'+t+'" as a property');throw Error('No access to property "'+t+'"')}(this.wrappedObject,e)}set(e,t){return!function(e,t,r){if(oh(e)&&od(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 oy(e){return!!e&&(e instanceof Map||e instanceof og||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var ov=function(){return ov=of.create,of};function ob(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function o_(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function ow(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var ox={BigNumberDependencies:sY,ComplexDependencies:{createComplexClass:s8},DenseMatrixDependencies:sQ,FractionDependencies:{createFractionClass:ol},createTyped:iV("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=ov();return a.types=[{name:"number",test:n3},{name:"Complex",test:n6},{name:"BigNumber",test:n7},{name:"Fraction",test:n8},{name:"Unit",test:ie},{name:"string",test:it},{name:"Chain",test:iD},{name:"Array",test:ir},{name:"Matrix",test:ii},{name:"DenseMatrix",test:is},{name:"SparseMatrix",test:io},{name:"Range",test:iu},{name:"Index",test:ic},{name:"boolean",test:il},{name:"ResultSet",test:id},{name:"Help",test:ih},{name:"function",test:ip},{name:"Date",test:im},{name:"RegExp",test:ig},{name:"null",test:iv},{name:"undefined",test:ib},{name:"AccessorNode",test:i_},{name:"ArrayNode",test:iw},{name:"AssignmentNode",test:ix},{name:"BlockNode",test:iN},{name:"ConditionalNode",test:iM},{name:"ConstantNode",test:iS},{name:"FunctionNode",test:ik},{name:"FunctionAssignmentNode",test:iE},{name:"IndexNode",test:iO},{name:"Node",test:iA},{name:"ObjectNode",test:iT},{name:"OperatorNode",test:iC},{name:"ParenthesisNode",test:ij},{name:"RangeNode",test:iI},{name:"SymbolNode",test:iF},{name:"Map",test:oy},{name:"Object",test:iy}],a.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||ob(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||o_(e),new r(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return r||o_(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||o_(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||ow(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||ob(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||ow(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||o_(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||ob(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||ow(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})},oN="equalScalar",oM=iV(oN,["typed","config"],e=>{var{typed:t,config:r}=e;return t(oN,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return i1(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,i1(e.re,t.re,n)&&i1(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)}})});iV(oN,["typed","config"],e=>{var{typed:t,config:r}=e;return t(oN,{"number, number":function(e,t){return i1(e,t,r.epsilon)}})});var oS={typedDependencies:ox,createEqualScalar:oM},oE=iV("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&&!it(t))throw Error("Invalid datatype: "+t);if(ii(e)){var r,n,s;r=this,n=e,s=t,"SparseMatrix"===n.type?(r._values=n._values?iP(n._values):void 0,r._index=iP(n._index),r._ptr=iP(n._ptr),r._size=iP(n._size),r._datatype=s||n._datatype):a(r,n.valueOf(),s||n._datatype)}else if(e&&ir(e.index)&&ir(e.ptr)&&ir(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(ir(e))a(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+iR(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(it(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(ir(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;it(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?iP(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 ai(this._values,iR)},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(!ic(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 i5(o.length,e._size.length);var u=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)i8(u[r],e._size[r]),i8(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(ii(r)?(i=r.size(),r=r.toArray()):i=i7(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 i5(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=an(r,a.length,u,i)}if(!iz(a,i))throw new i5(a,i,">");if(1===a.length)t.dimension(0).forEach(function(t,i){i8(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){i8(t),l.forEach(function(a,s){i8(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(!ir(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new i5(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];i8(t,this._size[0]),i8(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(!ir(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new i5(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;it(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]),i8(a,l),i8(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(!ia(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(!n3(e)||!iW(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+i9(n)+")")}),u(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!ir(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(!n3(t)||!iW(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+i9(e)+")")});var r=this._size[0]*this._size[1],n=(e=at(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],_=l[y];o(s(v,i._ptr[b],i._ptr[b+1],i._index),v,b,_,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?iP(this._values):void 0,index:iP(this._index),ptr:iP(this._ptr),size:iP(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;it(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 _=e._index[b];_>=0&&_<=a&&m(e._values[b],_-n,g-s)}else{for(var w={},x=y;x<v;x++)w[e._index[x]]=e._values[x];for(var N=n;N<=a;N++)m(N in w?w[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 ["+i9(t,e)+" x "+i9(r,e)+"] density: "+i9(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 ("+i9(this._index[u],e)+", "+i9(a,e)+") ==> "+(this._values?i9(this._values[u],e):"X");return i},i.prototype.toString=function(){return i9(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(n7(e)&&(e=e.toNumber()),!n3(e)||!iW(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(!ir(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(n7(e)&&(e=e.toNumber()),!n3(e)||!iW(e)||e<1)throw Error("Size values must be positive integers");return e}),a){if(n7(a)&&(a=a.toNumber()),!n3(a)||!iW(a))throw TypeError("The parameter k must be an integer number")}else a=0;var u,c=r,l=0;it(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(ir(n)){if(n.length!==m)throw Error("Invalid value array length");u=function(e){return n[e]}}else if(ii(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=[],_=0;_<p;_++){b.push(y.length);var w=_-f;if(w>=0&&w<m){var x=u(w);c(x,l)||(v.push(w+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(!n3(e)||!iW(e)||!n3(t)||!iW(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return i8(e,this._size[0]),i8(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}),ok="matrix",oO=iV(ok,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(ok,{"":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)+".")}}),oA=iV("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 i5(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],M=d[s+1],S=N;S<M;S++)_[a=f[S]]=i?v(l[S],o[a][s]):v(o[a][s],l[S]),w[a]=x;for(a=0;a<m;a++)w[a]===x?b[a][s]=_[a]:b[a][s]=o[a][s]}return e.createDenseMatrix({data:b,size:[m,g],datatype:y})}}),oT=iV("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,_=n._datatype;if(p.length!==b.length)throw new i5(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 w=p[0],x=p[1],N=r,M=0,S=i;"string"==typeof m&&m===_&&(a=m,N=t.find(r,[a,a]),M=t.convert(0,a),S=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 F=S(A[s],g[u]);N(F,M)?C[s]=null:A[s]=F}}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:[w,x],datatype:a})}}),oC=iV("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,_=c[v],w=c[v+1],x=_;x<w;x++){var N=u[x];g[N]=o[x],y[N]=b}for(var M=0;M<d;M++)0===v&&(m[M]=[]),y[M]===b?m[M][v]=a?p(n,g[M]):p(g[M],n):m[M][v]=n}return new r({data:m,size:[d,h],datatype:s})}}),oj=iV("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 i5(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})}}),oI=iV("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:iP(o),datatype:a})}});function oF(e,t){var r;if(!iW(e)||!iW(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}oF.signature="number, number";let{gcd:oD}=function e(t,r){var n,i,a,s=(0,n5.Z)({},ao,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:n3,isComplex:n6,isBigNumber:n7,isFraction:n8,isUnit:ie,isString:it,isArray:ir,isMatrix:ii,isCollection:ia,isDenseMatrix:is,isSparseMatrix:io,isRange:iu,isIndex:ic,isBoolean:il,isResultSet:id,isHelp:ih,isFunction:ip,isDate:im,isRegExp:ig,isObject:iy,isNull:iv,isUndefined:ib,isAccessorNode:i_,isArrayNode:iw,isAssignmentNode:ix,isBlockNode:iN,isConditionalNode:iM,isConstantNode:iS,isFunctionAssignmentNode:iE,isFunctionNode:ik,isIndexNode:iO,isNode:iA,isObjectNode:iT,isOperatorNode:iC,isParenthesisNode:ij,isRangeNode:iI,isSymbolNode:iF,isChain:iD},i=new iU,n.on=i.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 iZ(e,iP);var n=iZ(e,iP);al(r,"matrix",au),al(r,"number",ac),function e(t,r){if(Array.isArray(r))throw TypeError("Arrays are not supported by deepExtend");for(var n in r)if(iB(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=iZ(e,iP);return t("config",i,n,iZ(r,iP)),i}return r.MATRIX_OPTIONS=au,r.NUMBER_OPTIONS=ac,Object.keys(ao).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,iB(o,e)||(r.expression.mathWithTransform[e]=t.transform)):(delete r.expression.transform[e],iB(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 as("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)iB(r,i)&&e(t,r[i],i);else if(iq(r)||void 0!==n){var a=iq(r)?s(r)?r.fn+".transform":r.fn:n;if(iB(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(iB(l,f)){var d,h=l[f];if(iq(h))!function(t,i){var u,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(aa(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=iB(l,c)?l[c]:void 0,h=function(){var n={};t.dependencies.map(iG).forEach(e=>{if(aa(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():i$(l,c,h),d&&f?function(e){delete r.expression.transform[e],iB(o,e)?delete r.expression.mathWithTransform[e]:r.expression.mathWithTransform[e]=r[e]}(c):!s(t)&&(-1!==(u=t).fn.indexOf(".")||iB(o,u.fn)||u.meta&&u.meta.isClass)||i$(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||ie(d)||n6(d)||n7(d)||n8(d)||ii(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",()=>{iL(u).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&c(e,{override:!0})})}),o.create=e.bind(null,t),o.factory=iV,o.import(iL((function e(t,r){for(var n in t)if(iB(t,n)){var i=t[n];"object"==typeof i&&null!==i?e(i,r):r[n]=i}}(t,a={}),a))),o.ArgumentsError=as,o.DimensionError=i5,o.IndexError=i3,o}({gcdDependencies:{BigNumberDependencies:sY,DenseMatrixDependencies:sQ,equalScalarDependencies:oS,matrixDependencies:{DenseMatrixDependencies:sQ,MatrixDependencies:sX,SparseMatrixDependencies:{MatrixDependencies:sX,equalScalarDependencies:oS,typedDependencies:ox,createSparseMatrixClass:oE},typedDependencies:ox,createMatrix:oO},typedDependencies:ox,createGcd:iV("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a}=e,s=oA({typed:t}),o=oT({typed:t,equalScalar:n}),u=oC({typed:t,DenseMatrix:a}),c=oj({typed:t}),l=oI({typed:t});return t("gcd",{"number, number":oF,"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}})})}}),oR=10;function oP(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 oZ(e){let t,r;let 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:oR}}if(void 0===r)return;if(1===n.length)t=n[0];else{let e=oD(...n);t=e<oR?oR:e}let i=r.start.valueOf(),a=r.end.valueOf();return{startMs:i,endMs:a,stepMs:t,rangeMs:a-i}}function oz(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 o$(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 oB(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 oL(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=oB(t,e);return oz(t,r)}function oU(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=oz(r,e.spec.columns));break;case"MergeIndexedColumns":e.spec.column&&(r=oB(r,e.spec.column));break;case"MergeColumns":e.spec.columns&&e.spec.columns.length>0&&e.spec.name&&(r=o$(r,e.spec.columns,e.spec.name));break;case"MergeSeries":r=oL(r)}return r.map(e=>Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}))}function oV(e,t){return(0,nU.useMemo)(()=>oU(e,t),[e,t])}function oq(e){return!!e?.startsWith("/")}function oG(e){if(!e)throw Error("Input string cannot be empty");if(!oq(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 oW(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=oG(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=F(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)?F(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 _(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 w(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=_(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=_(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 M(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 S(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(M);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),_=s[5]&&s[5].params.length<=2&&!h(s[5].params),w=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(F(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=_?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=_?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(S);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,D(arguments,0,s).concat([D(arguments,s)]))}}return a}(e.params,e.fn)}),W=o?G[0]:r,K=f?G[1]:r,J=g?G[2]:r,H=v?G[3]:r,Y=b?G[4]:r,X=_?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=_?s[5].params.length:-1,ea=6*!!(o&&f&&g&&v&&b&&_),es=s.length,eo=function(){for(var t=ea;t<es;t++)if(w[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)?J.apply(e,arguments):arguments.length===er&&O(t)&&U(r)?H.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 eu.signatures=(i={},s.forEach(function(e){e.params.some(p)||E(e.params,!0).forEach(function(t){i[d(t)]=e.fn})}),i),eu}function O(e,t,r){throw w(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 F(e){return e[e.length-1]}function D(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=w,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){u.types.splice(r,0,e);return}}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()}}]);
|