@perses-dev/heatmap-chart-plugin 0.3.1 → 0.4.0-rc.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/{HeatMapChart.b28604b3.js → HeatMapChart.64173994.js} +5 -5
- package/__mf/js/async/12.4a0642db.js +2 -0
- package/__mf/js/async/{649.03cb72ae.js → 277.34ae0ac5.js} +13 -13
- package/__mf/js/async/{__federation_expose_HeatMapChart.f249c7a0.js → __federation_expose_HeatMapChart.5ef80ecb.js} +1 -1
- package/__mf/js/{main.6e60c65a.js → main.73ddd86d.js} +5 -5
- package/mf-manifest.json +9 -9
- package/mf-stats.json +9 -9
- package/package.json +4 -4
- package/__mf/js/async/179.f1d4d514.js +0 -2
- /package/__mf/js/async/{179.f1d4d514.js.LICENSE.txt → 12.4a0642db.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{649.03cb72ae.js.LICENSE.txt → 277.34ae0ac5.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 12.4a0642db.js.LICENSE.txt */
|
|
2
|
+
(self.chunk_HeatMapChart=self.chunk_HeatMapChart||[]).push([["12"],{8903:function(e,t,r){"use strict";let n;r.r(t),r.d(t,{DEFAULT_CALCULATION:()=>"last",KINDS:()=>f,querySpecSchema:()=>ne,applyMergeIndexedColumnsTransform:()=>oI,hasDecimalPlaces:()=>Y,UserFriendlyError:()=>nU,isValidQueryPluginType:()=>E,isCurrencyUnit:()=>e2,userSpecSchema:()=>nS,GLOBAL_SCOPES:()=>C,secretSchema:()=>nb,isValidLegendSize:()=>y,panelSpecSchema:()=>nr,CALCULATIONS_CONFIG:()=>u,getPanelKeyFromRef:()=>nG,globalRoleSchema:()=>nf,globalVariableSchema:()=>nR,isValidLegendMode:()=>g,roleBindingSchema:()=>nm,DEFAULT_DASHBOARD_DURATION:()=>"1h",isDateUnit:()=>e4,rolesEditorSchema:()=>nd,isUnitWithDecimalPlaces:()=>eQ,otlptracev1:()=>s,roleSchema:()=>nc,panelDefinitionSchema:()=>ni,buildVariableListSchema:()=>nA,datasourceSpecSchema:()=>r1,buildVariableSpecSchema:()=>nj,datasourcesSchema:()=>r5,displaySchema:()=>r0,variableTextSpecSchema:()=>nC,isValidTraceId:()=>K,isPanelGroupItemIdEqual:()=>M,isRelativeTimeRange:()=>F,getCalculations:()=>l,subjectSchema:()=>nh,buildPanelEditorSchema:()=>no,pluginSchema:()=>rQ,buildPanelSpecSchema:()=>nn,oauthProvidersSchema:()=>nN,globalDatasourceSchema:()=>r9,variableDefinitionSchema:()=>nZ,formatValue:()=>eV,otlpresourcev1:()=>a,transformData:()=>oj,getTimeSeriesValues:()=>oO,DEFAULT_LEGEND:()=>v,createPanelRef:()=>nW,variableDisplaySchema:()=>nE,DEFAULT_ALL_VALUE:()=>"$__all",getUnitGroup:()=>eG,getCalculation:()=>c,legendModes:()=>h,nameSchema:()=>rJ,isThroughputUnit:()=>e1,variableListSchema:()=>nT,shouldShortenValues:()=>J,MIN_STEP_INTERVAL_MS:()=>ok,applyJoinTransform:()=>oA,limitDecimalPlaces:()=>X,userSchema:()=>nM,isTemperatureUnit:()=>e9,applyMergeColumnsTransform:()=>oC,roundStepInterval:()=>q,buildDatasourceDefinitionSchema:()=>r7,durationValidationSchema:()=>r6,toAbsoluteTimeRange:()=>P,buildPanelDefinitionSchema:()=>na,roleSpecSchema:()=>nl,isProjectMetadata:()=>k,globalSecretSchema:()=>nw,isUnitWithShortValues:()=>e0,getCommonTimeScale:()=>oT,isBytesUnit:()=>eY,MAX_SIGNIFICANT_DIGITS:()=>3,resolvePanelRef:()=>nq,getUnitGroupConfig:()=>eW,variableTextSchema:()=>nI,isEmptyObject:()=>nV,isTimeSeriesValueTuple:()=>W,datasourceDefinitionSchema:()=>r3,getResourceExtendedDisplayName:()=>nH,fetch:()=>nB,DURATION_REGEX:()=>Z,otlpcommonv1:()=>i,secretSpecSchema:()=>nv,variablesSchema:()=>nP,isBitsUnit:()=>eX,variableSchema:()=>nF,roleBindingsEditorSchema:()=>ny,TRANSFORM_TEXT:()=>H,intervalToPrometheusDuration:()=>$,isPercentUnit:()=>eH,getMetadataProject:()=>O,projectMetadataSchema:()=>rX,isAbsoluteTimeRange:()=>R,datasourceSchema:()=>r4,getLegendSize:()=>_,PROJECT_SCOPES:()=>A,legendPositions:()=>d,globalRoleBindingSchema:()=>ng,DEFAULT_REFRESH_INTERVAL:()=>"0s",buildVariableListSpecSchema:()=>nO,createRegexFromString:()=>oR,secretsEditorSchema:()=>n_,ACTIONS:()=>T,formatDuration:()=>U,legendSizes:()=>p,permissionSchema:()=>nu,applyValueMapping:()=>oP,UNIT_GROUP_CONFIG:()=>eL,nativeProviderSchema:()=>nx,parseDurationString:()=>z,getVariableProject:()=>e5,isValidLegendPosition:()=>m,fetchJson:()=>n$,getLegendMode:()=>w,getSuggestedStepMs:()=>G,variableListSpecSchema:()=>nk,getLegendPosition:()=>b,isDurationString:()=>B,buildVariableDefinitionSchema:()=>nz,applyMergeSeriesTransform:()=>oD,isTimeUnit:()=>eK,roleBindingSpecSchema:()=>np,panelDisplaySpec:()=>r8,buildDatasourceSpecSchema:()=>r2,panelEditorSchema:()=>ns,isDecimalUnit:()=>eJ,getResourceDisplayName:()=>nK,getUnitConfig:()=>eq,FetchError:()=>nL,metadataSchema:()=>rY,UNIT_CONFIG:()=>eU,CalculationsMap:()=>o,linkSchema:()=>nt,msToPrometheusDuration:()=>L,variableSpecSchema:()=>nD,isRegexPattern:()=>oF});var i={};r.r(i);var a={};r.r(a);var s={};r.r(s),r.d(s,{StatusCodeError:()=>S,StatusCodeOk:()=>N,StatusCodeUnset:()=>x});let o={first:function(e){return c(e,"first")},last:function(e){return c(e,"last")},"first-number":function(e){return c(e,"first-number")},"last-number":function(e){return c(e,"last-number")},mean:function(e){return c(e,"mean")},sum:function(e){return c(e,"sum")},min:function(e){return c(e,"min")},max:function(e){return c(e,"max")}},u={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 l(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 c(e,t){return l(e,[t])[t]}let f=["Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"],d=["bottom","right"],h=["list","table"],p=["small","medium"];function m(e){return d.includes(e)}function g(e){return h.includes(e)}function y(e){return p.includes(e)}let v={position:"bottom",mode:"list",size:"medium"};function b(e){return void 0===e?v.position:m(e)?e:v.position}function w(e){return e&&g(e)?e:v.mode}function _(e){return e&&y(e)?e:v.size}let x="STATUS_CODE_UNSET",N="STATUS_CODE_OK",S="STATUS_CODE_ERROR";function M(e,t){return e?.panelGroupId===t?.panelGroupId&&e?.panelGroupItemLayoutId===t?.panelGroupItemLayoutId}function E(e){return["TimeSeriesQuery","TraceQuery","ProfileQuery"].includes(e)}function k(e){return"project"in e}function O(e){return"project"in e?e.project:void 0}let T=["*","create","read","update","delete"],A=["*","Dashboard","Datasource","EphemeralDashboard","Folder","Project","Role","RoleBinding","Secret","Variable"],C=["GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","User"];var I=r(2015),D=r(5130),j=r(8086);function F(e){return void 0!==e.pastDuration}function R(e){return void 0!==e.start&&void 0!==e.end}function P(e){let t=e.end??new Date;return{start:function(e,t,r){var n,i,a,s,o;let{years:u=0,months:l=0,weeks:c=0,days:f=0,hours:d=0,minutes:h=0,seconds:p=0}=t,m=(n=l+12*u,i=void 0,a=(0,j.P)(e,-n,i),s=f+7*c,o=void 0,(0,D.f)(a,-s,o));return(0,I.w)(e,m-1e3*(p+60*(h+60*d)))}(t,z(e.pastDuration)),end:t}}let Z=/^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;function z(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 $(e){return L(e.end.valueOf()-e.start.valueOf())}function L(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 U(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 V=[{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 q(e){for(let{maxMs:t,roundedStepMs:r}of V)if(e<t)return r;return 15e3}function G(e,t){return q(Math.floor((e.end.valueOf()-e.start.valueOf())/t))}function W(e){return 2===e.length}function K(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 J(e){return!1!==e}function Y(e){return"number"==typeof e}function X(e){return e&&(e<0?e=0:e>20&&(e=20)),e}var Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{};function ee(){if(al)return au;al=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 au={unformat:function(r,n){let i,a=en(),s=a.currentDelimiters(),o=a.currentCurrency().symbol,u=a.currentOrdinal(),l=a.getZeroFormat(),c=a.currentAbbreviations();if("string"==typeof r)if(function(e,t){if(!(e.indexOf(":")&&":"!==t.thousands))return!1;let r=e.split(":");if(3!==r.length)return!1;let n=+r[0],i=+r[1],a=+r[2];return!isNaN(n)&&!isNaN(i)&&!isNaN(a)}(r,s)){let e,t,n;t=+(e=r.split(":"))[0],n=+e[1],i=+e[2]+60*n+3600*t}else i=function(r,n,i="",a,s,o,u){if(""!==r)return r===s?0:function r(n,i,a,s,o,u,l){if(!isNaN(+n))return+n;let c="",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 l=e[t];if((c=n.replace(RegExp(`([0-9 ])(${l.key})$`),"$1"))!==n)return r(c,i,a,s,o,u)*l.factor}if((c=n.replace("%",""))!==n)return r(c,i,a,s,o,u)/100;let d=parseFloat(n);if(isNaN(d))return;let h=s(d);if(h&&"."!==h&&(c=n.replace(RegExp(`${t(h)}$`),""))!==n)return r(c,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],l=p[t];if((c=n.replace(t,""))!==n){let e;switch(l){case"thousand":e=1e3;break;case"million":e=1e6;break;case"billion":e=1e9;break;case"trillion":e=1e12}return r(c,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,l,c);else{if("number"!=typeof r)return;i=r}if(void 0!==i)return i}}}function et(){if(af)return ac;af=1;let e=ee(),t=/^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/,r={output:{type:"string",validValues:["currency","percent","byte","time","ordinal","number"]},base:{type:"string",validValues:["decimal","binary","general"],restriction:(e,t)=>"byte"===t.output,message:"`base` must be provided only when the output is `byte`",mandatory:e=>"byte"===e.output},characteristic:{type:"number",restriction:e=>e>=0,message:"value must be positive"},prefix:"string",postfix:"string",forceAverage:{type:"string",validValues:["trillion","billion","million","thousand"]},average:"boolean",lowPrecision:{type:"boolean",restriction:(e,t)=>!0===t.average,message:"`lowPrecision` must be provided only when the option `average` is set"},currencyPosition:{type:"string",validValues:["prefix","infix","postfix"]},currencySymbol:"string",totalLength:{type:"number",restrictions:[{restriction:e=>e>=0,message:"value must be positive"},{restriction:(e,t)=>!t.exponential,message:"`totalLength` is incompatible with `exponential`"}]},mantissa:{type:"number",restriction:e=>e>=0,message:"value must be positive"},optionalMantissa:"boolean",trimMantissa:"boolean",roundingFunction:"function",optionalCharacteristic:"boolean",thousandSeparated:"boolean",spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",spaceSeparatedAbbreviation:"boolean",abbreviations:{type:"object",children:{thousand:"string",million:"string",billion:"string",trillion:"string"}},negative:{type:"string",validValues:["sign","parenthesis"]},forceSign:"boolean",exponential:{type:"boolean"},prefixSymbol:{type:"boolean",restriction:(e,t)=>"percent"===t.output,message:"`prefixSymbol` can be provided only when the output is `percent`"}},n={languageTag:{type:"string",mandatory:!0,restriction:e=>e.match(t),message:"the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)"},delimiters:{type:"object",children:{thousands:"string",decimal:"string",thousandsSize:"number"},mandatory:!0},abbreviations:{type:"object",children:{thousand:{type:"string",mandatory:!0},million:{type:"string",mandatory:!0},billion:{type:"string",mandatory:!0},trillion:{type:"string",mandatory:!0}},mandatory:!0},spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",ordinal:{type:"function",mandatory:!0},bytes:{type:"object",children:{binarySuffixes:"object",decimalSuffixes:"object"}},currency:{type:"object",children:{symbol:"string",position:"string",code:"string"},mandatory:!0},defaults:"format",ordinalFormat:"format",byteFormat:"format",percentageFormat:"format",currencyFormat:"format",timeDefaults:"format",formats:{type:"object",children:{fourDigits:{type:"format",mandatory:!0},fullWithTwoDecimals:{type:"format",mandatory:!0},fullWithTwoDecimalsNoCurrency:{type:"format",mandatory:!0},fullWithNoDecimals:{type:"format",mandatory:!0}}}};function i(t){return void 0!==e.unformat(t)}function a(e,t,n,i=!1){let s=Object.keys(e).map(i=>{if(!t[i])return console.error(`${n} Invalid key: ${i}`),!1;let s=e[i],o=t[i];if("string"==typeof o&&(o={type:o}),"format"===o.type){if(!a(s,r,`[Validate ${i}]`,!0))return!1}else if(typeof s!==o.type)return console.error(`${n} ${i} type mismatched: "${o.type}" expected, "${typeof s}" provided`),!1;if(o.restrictions&&o.restrictions.length){let t=o.restrictions.length;for(let r=0;r<t;r++){let{restriction:t,message:a}=o.restrictions[r];if(!t(s,e))return console.error(`${n} ${i} invalid value: ${a}`),!1}}return o.restriction&&!o.restriction(s,e)?(console.error(`${n} ${i} invalid value: ${o.message}`),!1):o.validValues&&-1===o.validValues.indexOf(s)?(console.error(`${n} ${i} invalid value: must be among ${JSON.stringify(o.validValues)}, "${s}" provided`),!1):(!o.children||!!a(s,o.children,`[Validate ${i}]`))&&!0});return i||s.push(...Object.keys(t).map(r=>{let i=t[r];if("string"==typeof i&&(i={type:i}),i.mandatory){let t=i.mandatory;if("function"==typeof t&&(t=t(e)),t&&void 0===e[r])return console.error(`${n} Missing mandatory key "${r}"`),!1}return!0})),s.reduce((e,t)=>e&&t,!0)}function s(e){return a(e,r,"[Validate format]")}return ac={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 er=function(e,t={}){var r,n,i,a,s,o;let u,l,c,f,d;if("string"!=typeof e)return e;n=e=(u=(r=e).match(/^{([^}]*)}/))?(t.prefix=u[1],r.slice(u[0].length)):r,function(e,t){if(-1!==e.indexOf("$")){t.output="currency";return}if(-1!==e.indexOf("%")){t.output="percent";return}if(-1!==e.indexOf("bd")){t.output="byte",t.base="general";return}if(-1!==e.indexOf("b")){t.output="byte",t.base="binary";return}if(-1!==e.indexOf("d")){t.output="byte",t.base="decimal";return}if(-1!==e.indexOf(":")){t.output="time";return}-1!==e.indexOf("o")&&(t.output="ordinal")}(e=(l=n.match(/{([^}]*)}$/))?(t.postfix=l[1],n.slice(0,-l[0].length)):n,t),(c=e.match(/[1-9]+[0-9]*/))&&(t.totalLength=+c[0]),(f=e.split(".")[0].match(/0+/))&&(t.characteristic=f[0].length),-1!==(i=e).indexOf(".")&&(t.optionalCharacteristic=-1===i.split(".")[0].indexOf("0")),-1!==e.indexOf("a")&&(t.average=!0),-1!==(a=e).indexOf("K")?t.forceAverage="thousand":-1!==a.indexOf("M")?t.forceAverage="million":-1!==a.indexOf("B")?t.forceAverage="billion":-1!==a.indexOf("T")&&(t.forceAverage="trillion");let h=e.split(".")[1];if(h){let e=h.match(/0+/);e&&(t.mantissa=e[0].length)}return(s=e).match(/\[\.]/)?t.optionalMantissa=!0:s.match(/\./)&&(t.optionalMantissa=!1),(d=e.split(".")[1])&&(t.trimMantissa=-1!==d.indexOf("[")),-1!==e.indexOf(",")&&(t.thousandSeparated=!0),-1!==e.indexOf(" ")&&(t.spaceSeparated=!0,t.spaceSeparatedCurrency=!0,(t.average||t.forceAverage)&&(t.spaceSeparatedAbbreviation=!0)),(o=e).match(/^\+?\([^)]*\)$/)&&(t.negative="parenthesis"),o.match(/^\+?-/)&&(t.negative="sign"),e.match(/^\+/)&&(t.forceSign=!0),t};function en(){let e;if(ah)return ad;ah=1;let t=ao?as:(ao=1,as={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=et(),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=er(e),r.validateFormat(e)&&(s=e)},n.getZeroFormat=()=>a,n.setZeroFormat=e=>a="string"==typeof e?e:null,n.hasZeroFormat=()=>null!==a,n.languageData=e=>{if(e){if(i[e])return i[e];throw Error(`Unknown tag "${e}"`)}return o()},n.registerLanguage=(t,n=!1)=>{if(!r.validateLanguage(t))throw Error("Invalid language data");i[t.languageTag]=t,n&&(e=t.languageTag)},n.setLanguage=(r,n=t.languageTag)=>{if(!i[r]){let t=r.split("-")[0],a=Object.keys(i).find(e=>e.split("-")[0]===t);return i[a]?void(e=a):void(e=n)}e=r},n.registerLanguage(t),e=t.languageTag,ad=n}var ei={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 l(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 c(e,t){var r,n,i=e.c,a=t.c,s=e.s,o=t.s,u=e.e,l=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==l,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>l^r?1:-1;for(s=0,o=(u=i.length)<(l=a.length)?u:l;s<o;s++)if(i[s]!=a[s])return i[s]>a[s]^r?1:-1;return u==l?0:u>l^r?1:-1}function f(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(a+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function d(e){var t=e.c.length-1;return u(e.e/14)==t&&e.c[t]%2!=0}function h(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function p(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(t=function e(t){var m,g,y,v,b,w,_,x,N,S=Z.prototype={constructor:Z,toString:null,valueOf:null},M=new Z(1),E=20,k=4,O=-7,T=21,A=-1e7,C=1e7,I=!1,D=1,j=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function Z(e,t){var n,a,o,u,l,c,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<A?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice());return}if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,l=e;l>=10;l/=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,c);p.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(u=h.indexOf("."))>-1&&(h=h.replace(".","")),(l=h.search(/e/i))>0?(u<0&&(u=l),u+=+h.slice(l+1),h=h.substring(0,l)):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),c="number"==typeof e){if(0*e!=0)return N(p,h,c,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=l=0,d=h.length;l<d;l++)if(0>n.indexOf(a=h.charAt(l))){if("."==a){if(l>u){u=d;continue}}else if(!o&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){o=!0,l=-1,u=0;continue}return N(p,String(e),c,t)}c=!1,(u=(h=x(h,t,10,p.s)).indexOf("."))>-1?h=h.replace(".",""):u=h.length}for(l=0;48===h.charCodeAt(l);l++);for(d=h.length;48===h.charCodeAt(--d););if(h=h.slice(l,++d)){if(d-=l,c&&Z.DEBUG&&d>15&&(e>0x1fffffffffffff||e!==i(e)))throw Error(s+p.s*e);if((u=u-l-1)>C)p.c=p.e=null;else if(u<A)p.c=[p.e=0];else{if(p.e=u,p.c=[],l=(u+1)%14,u<0&&(l+=14),l<d){for(l&&p.c.push(+h.slice(0,l)),d-=14;l<d;)p.c.push(+h.slice(l,l+=14));l=14-(h=h.slice(l)).length}else l-=d;for(;l--;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=l(e.c),u=1==n||2==n&&(s<=O||s>=T)?h(u,s):p(u,s,"0");else if(a=(e=L(new Z(e),t,r)).e,o=(u=l(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 B(e,t){for(var r,n,i=1,a=new Z(e[0]);i<e.length;i++)(n=new Z(e[i])).s&&(r=c(a,n))!==t&&(0!==r||a.s!==t)||(a=n);return a}function $(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<A?e.c=[e.e=0]:(e.e=r,e.c=t),e}function L(e,t,r,a){var s,u,l,c,f,d,h,p=e.c;if(p){e:{for(s=1,c=p[0];c>=10;c/=10,s++);if((u=t-s)<0)u+=14,l=t,h=i((f=p[d=0])/o[s-l-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,l=u-14+1}else break e;else{for(s=1,f=c=p[d];c>=10;c/=10,s++);u%=14,h=(l=u-14+s)<0?0:i(f/o[s-l-1]%10)}if(a=a||t<0||null!=p[d+1]||(l<0?f:f%o[s-l-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?l>0?f/o[s-l]: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,c=1,d--):(p.length=d+1,c=o[14-u],p[d]=l>0?i(f/o[s-l]%o[l])*c:0),a)for(;;)if(0==d){for(u=1,l=p[0];l>=10;l/=10,u++);for(l=p[0]+=c,c=1;l>=10;l/=10,c++);u!=c&&(e.e++,1e14==p[0]&&(p[0]=1));break}else{if(p[d]+=c,1e14!=p[d])break;p[d--]=0,c=1}for(u=p.length;0===p[--u];p.pop());}e.e>C?e.c=e.e=null:e.e<A&&(e.c=[e.e=0])}return e}function U(e){var t,r=e.e;return null===r?e.toString():(t=l(e.c),t=r<=O||r>=T?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],T=r[1]):(f(r,-1e9,1e9,t),O=-(T=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),A=r[0],C=r[1];else if(f(r,-1e9,1e9,t),r)A=-(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))I=r;else throw I=!r,Error(a+"crypto unavailable");else I=r;else throw Error(a+t+" not true or false: "+r);if(e.hasOwnProperty(t="MODULO_MODE")&&(f(r=e[t],0,9,t),D=r),e.hasOwnProperty(t="POW_PRECISION")&&(f(r=e[t],0,1e9,t),j=r),e.hasOwnProperty(t="FORMAT"))if("object"==typeof(r=e[t]))F=r;else throw Error(a+t+" not an object: "+r);if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(a+t+" invalid: "+r);P="0123456789"==r.slice(0,10),R=r}}else throw Error(a+"Object expected: "+e);return{DECIMAL_PLACES:E,ROUNDING_MODE:k,EXPONENTIAL_AT:[O,T],RANGE:[A,C],CRYPTO:I,MODULO_MODE:D,POW_PRECISION:j,FORMAT:F,ALPHABET:R}},Z.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!Z.DEBUG)return!0;var t,r,n=e.c,s=e.e,o=e.s;e:if("[object Array]"==({}).toString.call(n)){if((1===o||-1===o)&&s>=-1e9&&s<=1e9&&s===i(s)){if(0===n[0]){if(0===s&&1===n.length)return!0;break e}if((t=(s+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=1e14||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===s&&(null===o||1===o||-1===o))return!0;throw Error(a+"Invalid BigNumber: "+e)},Z.maximum=Z.max=function(){return B(arguments,-1)},Z.minimum=Z.min=function(){return B(arguments,1)},m=0x20000000000000*Math.random()&2097151?function(){return i(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},Z.random=function(e){var t,r,s,u,l,c=0,d=[],h=new Z(M);if(null==e?e=E:f(e,0,1e9),u=n(e/14),I)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));c<u;)(l=131072*t[c]+(t[c+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[c]=r[0],t[c+1]=r[1]):(d.push(l%1e14),c+=2);c=u/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(u*=7);c<u;)(l=(31&t[c])*0x1000000000000+0x10000000000*t[c+1]+0x100000000*t[c+2]+0x1000000*t[c+3]+(t[c+4]<<16)+(t[c+5]<<8)+t[c+6])>=9e15?crypto.randomBytes(7).copy(t,c):(d.push(l%1e14),c+=7);c=u/7}else throw I=!1,Error(a+"crypto unavailable");if(!I)for(;c<u;)(l=m())<9e15&&(d[c++]=l%1e14);for(u=d[--c],e%=14,u&&e&&(l=o[14-e],d[c]=i(u/l)*l);0===d[c];d.pop(),c--);if(c<0)d=[s=0];else{for(s=-1;0===d[0];d.splice(0,1),s-=14);for(c=1,l=d[0];l>=10;l/=10,c++);c<14&&(s-=14-c)}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,c,f,d,h,m,g,y=r.indexOf("."),v=E,b=k;for(y>=0&&(f=j,j=0,r=r.replace(".",""),h=(g=new Z(n)).pow(r.length-y),j=f,g.c=t(p(l(h.c),h.e,"0"),10,i,e),g.e=g.c.length),c=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?--c:(h.c=m,h.e=c,h.s=a,m=(h=_(h,g,v,b,i)).c,d=h.r,c=h.e),y=m[u=c+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||(++c,m=[1].concat(m));for(f=m.length;!m[--f];);for(y=0,r="";y<=f;r+=o.charAt(m[y++]));r=p(r,c,o.charAt(0))}return r}}(),_=function(){function e(e,t,r){var n,i,a,s,o=0,u=e.length,l=t%1e7,c=t/1e7|0;for(e=e.slice();u--;)n=c*(a=e[u]%1e7)+(s=e[u]/1e7|0)*l,o=((i=l*a+n%1e7*1e7+o)/r|0)+(n/1e7|0)+c*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,l){var c,f,d,h,p,m,g,y,v,b,w,_,x,N,S,M,E,k=n.s==a.s?1:-1,O=n.c,T=a.c;if(!O||!O[0]||!T||!T[0])return new Z(!n.s||!a.s||(O?T&&O[0]==T[0]:!T)?NaN:O&&0==O[0]||!T?0*k:k/0);for(v=(y=new Z(k)).c=[],k=s+(f=n.e-a.e)+1,l||(l=1e14,f=u(n.e/14)-u(a.e/14),k=k/14|0),d=0;T[d]==(O[d]||0);d++);if(T[d]>(O[d]||0)&&f--,k<0)v.push(1),h=!0;else{for(N=O.length,M=T.length,d=0,k+=2,(p=i(l/(T[0]+1)))>1&&(T=e(T,p,l),O=e(O,p,l),M=T.length,N=O.length),x=M,w=(b=O.slice(0,M)).length;w<M;b[w++]=0);E=[0].concat(E=T.slice()),S=T[0],T[1]>=l/2&&S++;do{if(p=0,(c=t(T,b,M,w))<0){if(_=b[0],M!=w&&(_=_*l+(b[1]||0)),(p=i(_/S))>1)for(p>=l&&(p=l-1),g=(m=e(T,p,l)).length,w=b.length;1==t(m,b,g,w);)p--,r(m,M<g?E:T,g,l),g=m.length,c=1;else 0==p&&(c=p=1),g=(m=T.slice()).length;if(g<w&&(m=[0].concat(m)),r(b,m,w,l),w=b.length,-1==c)for(;1>t(T,b,M,w);)p++,r(b,M<w?E:T,w,l),w=b.length}else 0===c&&(p++,b=[0]);v[d++]=p,b[0]?b[w++]=O[x]||0:(b=[O[x]],w=1)}while((x++<N||null!=b[0])&&k--);h=null!=b[0],v[0]||v.splice(0,1)}if(1e14==l){for(d=1,k=v[0];k>=10;k/=10,d++);L(y,s+(y.e=d+14*f-1)+1,o,h)}else y.e=f,y.r=+h;return y}}(),g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,v=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g,N=function(e,t,r,n){var i,s=r?t:t.replace(w,"");if(b.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(g,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,s=s.replace(y,"$1").replace(v,"0.$1")),t!=s))return new Z(s,i);if(Z.DEBUG)throw Error(a+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},S.absoluteValue=S.abs=function(){var e=new Z(this);return e.s<0&&(e.s=1),e},S.comparedTo=function(e,t){return c(this,new Z(e,t))},S.decimalPlaces=S.dp=function(e,t){var r,n,i;if(null!=e)return f(e,0,1e9),null==t?t=k:f(t,0,8),L(new Z(this),e+this.e+1,t);if(!(r=this.c))return null;if(n=((i=r.length-1)-u(this.e/14))*14,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},S.dividedBy=S.div=function(e,t){return _(this,new Z(e,t),E,k)},S.dividedToIntegerBy=S.idiv=function(e,t){return _(this,new Z(e,t),0,1)},S.exponentiatedBy=S.pow=function(e,t){var r,s,o,u,l,c,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)),c=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),c?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||c&&m.c[1]>=24e7:m.c[0]<8e13||c&&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);j&&(u=n(j/14+2))}for(c?(r=new Z(.5),f&&(e.s=1),h=d(e)):h=(o=Math.abs(+U(e)))%2,p=new Z(M);;){if(h){if(!(p=p.times(m)).c)break;u?p.c.length>u&&(p.c.length=u):s&&(p=p.mod(t))}if(o){if(0===(o=i(o/2)))break;h=o%2}else if(L(e=e.times(r),e.e+1,1),e.e>14)h=d(e);else{if(0==(o=+U(e)))break;h=o%2}m=m.times(m),u?m.c&&m.c.length>u&&(m.c.length=u):s&&(m=m.mod(t))}return s?p:(f&&(p=M.div(p)),t?p.mod(t):u?L(p,j,k,l):p)},S.integerValue=function(e){var t=new Z(this);return null==e?e=k:f(e,0,8),L(t,t.e+1,e)},S.isEqualTo=S.eq=function(e,t){return 0===c(this,new Z(e,t))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(e,t){return c(this,new Z(e,t))>0},S.isGreaterThanOrEqualTo=S.gte=function(e,t){return 1===(t=c(this,new Z(e,t)))||0===t},S.isInteger=function(){return!!this.c&&u(this.e/14)>this.c.length-2},S.isLessThan=S.lt=function(e,t){return 0>c(this,new Z(e,t))},S.isLessThanOrEqualTo=S.lte=function(e,t){return -1===(t=c(this,new Z(e,t)))||0===t},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(e,t){var r,n,i,a,s=this.s;if(t=(e=new Z(e,t)).s,!s||!t)return new Z(NaN);if(s!=t)return e.s=-t,this.plus(e);var o=this.e/14,l=e.e/14,c=this.c,f=e.c;if(!o||!l){if(!c||!f)return c?(e.s=-t,e):new Z(f?this:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new Z(c[0]?this:3==k?-0:0)}if(o=u(o),l=u(l),c=c.slice(),s=o-l){for((a=s<0)?(s=-s,i=c):(l=o,i=f),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(a=(s=c.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(c[t]!=f[t]){a=c[t]<f[t];break}if(a&&(i=c,c=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=c.length))>0)for(;t--;c[r++]=0);for(t=1e14-1;n>s;){if(c[--n]<f[n]){for(r=n;r&&!c[--r];c[r]=t);--c[r],c[n]+=1e14}c[n]-=f[n]}for(;0==c[0];c.splice(0,1),--l);return c[0]?$(e,c,l):(e.s=3==k?-1:1,e.c=[e.e=0],e)},S.modulo=S.mod=function(e,t){var r,n;return(e=new Z(e,t),this.c&&e.s&&(!e.c||e.c[0]))?e.c&&(!this.c||this.c[0])?(9==D?(n=e.s,e.s=1,r=_(this,e,0,3),e.s=n,r.s*=n):r=_(this,e,0,D),(e=this.minus(r.times(e))).c[0]||1!=D||(e.s=this.s),e):new Z(this):new Z(NaN)},S.multipliedBy=S.times=function(e,t){var r,n,i,a,s,o,l,c,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,(l=g.length)<(d=y.length)&&(m=g,g=y,y=m,i=l,l=d,d=i),i=l+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=l);a>i;)o=p*(c=g[--s]%1e7)+(f=g[s]/1e7|0)*h,r=((c=h*c+o%1e7*1e7+m[a]+r)/1e14|0)+(o/1e7|0)+p*f,m[a--]=c%1e14;m[a]=r}return r?++n:m.splice(0,1),$(e,m,n)},S.negated=function(){var e=new Z(this);return e.s=-e.s||null,e},S.plus=function(e,t){var r,n=this.s;if(t=(e=new Z(e,t)).s,!n||!t)return new Z(NaN);if(n!=t)return e.s=-t,this.minus(e);var i=this.e/14,a=e.e/14,s=this.c,o=e.c;if(!i||!a){if(!s||!o)return new Z(n/0);if(!s[0]||!o[0])return o[0]?e:new Z(s[0]?this:0*n)}if(i=u(i),a=u(a),s=s.slice(),n=i-a){for(n>0?(a=i,r=o):(n=-n,r=s),r.reverse();n--;r.push(0));r.reverse()}for((n=s.length)-(t=o.length)<0&&(r=o,o=s,s=r,t=n),n=0;t;)n=(s[--t]=s[t]+o[t]+n)/1e14|0,s[t]=1e14===s[t]?0:s[t]%1e14;return n&&(s=[n].concat(s),++a),$(e,s,a)},S.precision=S.sd=function(e,t){var r,n,i;if(null!=e&&!!e!==e)return f(e,1,1e9),null==t?t=k:f(t,0,8),L(new Z(this),e,t);if(!(r=this.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&this.e+1>n&&(n=this.e+1),n},S.shiftedBy=function(e){return f(e,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+e)},S.squareRoot=S.sqrt=function(){var e,t,r,n,i,a=this.c,s=this.s,o=this.e,c=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=l(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)+c)<3&&(s=0);;)if(i=r,r=f.times(i.plus(_(this,i,c,1))),l(i.c).slice(0,s)===(t=l(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}c+=4,s+=4,n=1}}return L(r,r.e+E+1,k,e)},S.toExponential=function(e,t){return null!=e&&(f(e,0,1e9),e++),z(this,e,t,1)},S.toFixed=function(e,t){return null!=e&&(f(e,0,1e9),e=e+this.e+1),z(this,e,t)},S.toFormat=function(e,t,r){var n;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=F;else if("object"!=typeof r)throw Error(a+"Argument not an object: "+r);if(n=this.toFixed(e,t),this.c){var i,s=n.split("."),o=+r.groupSize,u=+r.secondaryGroupSize,l=r.groupSeparator||"",c=s[0],f=s[1],d=this.s<0,h=d?c.slice(1):c,p=h.length;if(u&&(i=o,o=u,u=i,p-=i),o>0&&p>0){for(i=p%o||o,c=h.substr(0,i);i<p;i+=o)c+=l+h.substr(i,o);u>0&&(c+=l+h.slice(i)),d&&(c="-"+c)}n=f?c+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):c}return(r.prefix||"")+n+(r.suffix||"")},S.toFraction=function(e){var t,r,n,i,s,u,c,f,d,h,p,m,g=this.c;if(null!=e&&(!(c=new Z(e)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(a+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+U(c));if(!g)return new Z(this);for(t=new Z(M),d=r=new Z(M),n=f=new Z(M),m=l(g),s=t.e=m.length-this.e-1,t.c[0]=o[(u=s%14)<0?14+u:u],e=!e||c.comparedTo(t)>0?s>0?t:d:c,u=C,C=1/0,c=new Z(m),f.c[0]=0;h=_(c,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=c.minus(h.times(i=t)),c=i;return i=_(e.minus(r),n,0,1),f=f.plus(i.times(d)),r=r.plus(i.times(n)),f.s=d.s=this.s,s*=2,p=1>_(d,n,s,k).minus(this).abs().comparedTo(_(f,r,s,k).minus(this).abs())?[d,n]:[f,r],C=u,p},S.toNumber=function(){return+U(this)},S.toPrecision=function(e,t){return null!=e&&f(e,1,1e9),z(this,e,t,2)},S.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=O||i>=T?h(l(r.c),i):p(l(r.c),i,"0"):10===e&&P?t=p(l((r=L(new Z(r),E+i+1,k)).c),r.e,"0"):(f(e,2,R.length,"Base"),t=x(p(l(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},S.valueOf=S.toJSON=function(){return U(this)},S._isBigNumber=!0,null!=t&&Z.set(t),Z}()).default=t.BigNumber=t,ei.exports?ei.exports=t:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=t)})(Q);var ea=ei.exports;let es=en(),eo=et(),eu={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:ec,decimalSuffixes:ef}=es.currentBytes(),ed={scale:1024,suffixes:ef,marker:"bd"},eh={scale:1024,suffixes:ec,marker:"b"},ep={scale:1e3,suffixes:ef,marker:"d"};function em(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 eg(e){let t="";for(let r=0;r<e;r++)t+="0";return t}function ey({instance:e,providedFormat:t,state:r=es,decimalSeparator:n,defaults:i=r.currentDefaults()}){var a,s,o,u,l;let c,f,d,h,p,m,g,y=e._value;if(0===y&&r.hasZeroFormat())return r.getZeroFormat();if(!isFinite(y))return y.toString();let v=Object.assign({},el,i,t),b=v.totalLength,w=b?0:v.characteristic,_=v.optionalCharacteristic,x=v.forceAverage,N=v.lowPrecision,S=!!b||!!x||v.average,M=b?-1:S&&void 0===t.mantissa?0:v.mantissa,E=!b&&(void 0===t.optionalMantissa?-1===M:v.optionalMantissa),k=v.trimMantissa,O=v.thousandSeparated,T=v.spaceSeparated,A=v.negative,C=v.forceSign,I=v.exponential,D=v.roundingFunction,j="";if(S){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),l=-1;if(t&&n[t]&&eu[t]?(o=n[t],e/=eu[t]):u>=eu.trillion||r&&1===s(u/eu.trillion)?(o=n.trillion,e/=eu.trillion):u<eu.trillion&&u>=eu.billion||r&&1===s(u/eu.billion)?(o=n.billion,e/=eu.billion):u<eu.billion&&u>=eu.million||r&&1===s(u/eu.million)?(o=n.million,e/=eu.million):(u<eu.million&&u>=eu.thousand||r&&1===s(u/eu.thousand))&&(o=n.thousand,e/=eu.thousand),o&&(o=(i?" ":"")+o),a){let t=e<0,r=e.toString().split(".")[0];l=Math.max(a-(t?r.length-1:r.length),0)}return{value:e,abbreviation:o,mantissaPrecision:l}}({value:y,forceAverage:x,lowPrecision:N,abbreviations:r.currentAbbreviations(),spaceSeparated:T,roundingFunction:D,totalLength:b});y=e.value,j+=e.abbreviation,b&&(M=e.mantissaPrecision)}if(I){let e=function({value:e,characteristicPrecision:t}){let[r,n]=e.toExponential().split("e"),i=+r;return t&&1<t&&(i*=Math.pow(10,t-1),n-=t-1,n=n>=0?`+${n}`:n),{value:i,abbreviation:`e${n}`}}({value:y,characteristicPrecision:w});y=e.value,j=e.abbreviation+j}let F=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+eg(i-s.length);else{let e=".";e=0>+a?`-0${e}`:`0${e}`;let n=(eg(-i-1)+Math.abs(a)+s).substr(0,t);n.length<t&&(n+=eg(t-n.length)),r=e+n}return+i>0&&t>0&&(r+=`.${eg(t)}`),r}(e,t):new ea(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 l=u.match(/0+$/);return i&&l?`${o}.${u.toString().slice(0,l.index)}`:s.toString()}(y.toString(),y,E,M,k,D);return a=F=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()}(F,y,_,w),s=y,o=n,f=(c=r.currentDelimiters()).thousands,o=o||c.decimal,d=c.thousandsSize||3,p=(h=a.toString()).split(".")[0],m=h.split(".")[1],g=s<0&&0===p.indexOf("-"),O&&(g&&(p=p.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})(p.length,d).forEach((e,t)=>{p=p.slice(0,e+t)+f+p.slice(e+t)}),g&&(p=`-${p}`)),F=h=m?p+o+m:p,(S||I)&&(F+=j),(C||y<0)&&(u=F,F=0===(l=y)?u:0==+u?u.replace("-",""):l>0?`+${u}`:"sign"===A?u:`(${u.replace("-","")})`),F}function ev(e,t){if(!e)return t;let r=Object.keys(e);return 1===r.length&&"output"===r[0]?t:e}function eb(e,t,r){let n=new ea(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new ea(i),e._value=n.minus(i).toNumber(),e}let ew=en(),e_=et(),ex={loadLanguagesInNode:e=>{e.forEach(e=>{let t;try{t=function(e){throw Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(`../languages/${e}`)}catch(t){console.error(`Unable to load "${e}". No matching language file found.`)}t&&eO.registerLanguage(t)})}},eN=ee(),eS={format:(...e)=>(function(e,t={},r){if("string"==typeof t&&(t=er(t)),!eo.validateFormat(t))return"ERROR: invalid format";let n=t.prefix||"",i=t.postfix||"",a=function(e,t,r){var n,i,a;switch(t.output){case"currency":let s,o,u,l,c,f,d,h,p,m;return n=t=ev(t,es.currentCurrencyDefaultFormat()),s=es.currentCurrency(),u=Object.assign({},el,o=Object.assign({},n)),c="",f=!!u.totalLength||!!u.forceAverage||u.average,d=o.currencyPosition||s.position,h=o.currencySymbol||s.symbol,p=void 0!==u.spaceSeparatedCurrency?u.spaceSeparatedCurrency:u.spaceSeparated,void 0===o.lowPrecision&&(o.lowPrecision=!1),p&&(c=" "),"infix"===d&&(l=c+h+c),m=ey({instance:e,providedFormat:o,state:es,decimalSeparator:l}),"prefix"===d&&(m=e._value<0&&"sign"===u.negative?`-${c}${h}${m.slice(1)}`:e._value>0&&u.forceSign?`+${c}${h}${m.slice(1)}`:h+c+m),d&&"postfix"!==d||(m=m+(c=!u.spaceSeparatedAbbreviation&&f?"":c)+h),m;case"percent":let g,y,v;return i=t=ev(t,es.currentPercentageDefaultFormat()),g=i.prefixSymbol,y=ey({instance:r(100*e._value),providedFormat:i,state:es}),v=Object.assign({},el,i),g?`%${v.spaceSeparated?" ":""}${y}`:`${y}${v.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||ef,marker:"bd"},binary:{scale:1024,suffixes:s||ec,marker:"b"},decimal:{scale:1e3,suffixes:o||ef,marker:"d"}}[i],{value:l,suffix:c}=em(e._value,u.suffixes,u.scale),f=ey({instance:n(l),providedFormat:t,state:r,defaults:r.currentByteDefaultFormat()});return`${f}${a.spaceSeparated?" ":""}${c}`}(e,t=ev(t,es.currentByteDefaultFormat()),es,r);case"time":let b,w,_;return t=ev(t,es.currentTimeDefaultFormat()),b=Math.floor(e._value/60/60),w=Math.floor((e._value-60*b*60)/60),_=Math.round(e._value-60*b*60-60*w),`${b}:${w<10?"0":""}${w}:${_<10?"0":""}${_}`;case"ordinal":let x,N,S,M;return a=t=ev(t,es.currentOrdinalDefaultFormat()),x=es.currentOrdinal(),N=Object.assign({},el,a),S=ey({instance:e,providedFormat:a,state:es}),M=x(e._value),`${S}${N.spaceSeparated?" ":""}${M}`;default:return ey({instance:e,providedFormat:t,numbro:r})}}(e,t,r);return(a=n+a)+i})(...e,eO),getByteUnit:(...e)=>(function(e){return em(e._value,ed.suffixes,ed.scale).suffix})(...e,eO),getBinaryByteUnit:(...e)=>(function(e){return em(e._value,eh.suffixes,eh.scale).suffix})(...e,eO),getDecimalByteUnit:(...e)=>(function(e){return em(e._value,ep.suffixes,ep.scale).suffix})(...e,eO),formatOrDefault:ev},eM={add:(e,t)=>{let r,n;return r=new ea(e._value),n=t,eO.isNumbro(t)&&(n=t._value),n=new ea(n),e._value=r.plus(n).toNumber(),e},subtract:(e,t)=>eb(e,t,eO),multiply:(e,t)=>{let r,n;return r=new ea(e._value),n=t,eO.isNumbro(t)&&(n=t._value),n=new ea(n),e._value=r.times(n).toNumber(),e},divide:(e,t)=>{let r,n;return r=new ea(e._value),n=t,eO.isNumbro(t)&&(n=t._value),n=new ea(n),e._value=r.dividedBy(n).toNumber(),e},set:(e,t)=>{let r;return r=t,eO.isNumbro(t)&&(r=t._value),e._value=r,e},difference:(e,t)=>{let r;return eb(r=eO(e._value),t,eO),Math.abs(r._value)},BigNumber:ea};class eE{constructor(e){this._value=e}clone(){return eO(this._value)}format(e={}){return eS.format(this,e)}formatCurrency(e){return"string"==typeof e&&(e=er(e)),(e=eS.formatOrDefault(e,ew.currentCurrencyDefaultFormat())).output="currency",eS.format(this,e)}formatTime(e={}){return e.output="time",eS.format(this,e)}binaryByteUnits(){return eS.getBinaryByteUnit(this)}decimalByteUnits(){return eS.getDecimalByteUnit(this)}byteUnits(){return eS.getByteUnit(this)}difference(e){return eM.difference(this,e)}add(e){return eM.add(this,e)}subtract(e){return eM.subtract(this,e)}multiply(e){return eM.multiply(this,e)}divide(e){return eM.divide(this,e)}set(e){return eM.set(this,ek(e))}value(){return this._value}valueOf(){return this._value}}function ek(e){let t=e;return eO.isNumbro(e)?t=e._value:"string"==typeof e?t=eO.unformat(e):isNaN(e)&&(t=NaN),t}function eO(e){return new eE(ek(e))}eO.version="2.5.0",eO.isNumbro=function(e){return e instanceof eE},eO.language=ew.currentLanguage,eO.registerLanguage=ew.registerLanguage,eO.setLanguage=ew.setLanguage,eO.languages=ew.languages,eO.languageData=ew.languageData,eO.zeroFormat=ew.setZeroFormat,eO.defaultFormat=ew.currentDefaults,eO.setDefaults=ew.setDefaults,eO.defaultCurrencyFormat=ew.currentCurrencyDefaultFormat,eO.validate=e_.validate,eO.loadLanguagesInNode=ex.loadLanguagesInNode,eO.unformat=eN.unformat,eO.BigNumber=eM.BigNumber;var eT=eO&&eO.__esModule&&Object.prototype.hasOwnProperty.call(eO,"default")?eO.default:eO;function eA(e,{unit:t="bytes",shortValues:r,decimalPlaces:n}){let i="decbytes"===t;if(!J(r)||Math.abs(e)<(i?1e3:1024)){let t={style:"unit",unit:"byte",unitDisplay:"long",useGrouping:!0};return Y(n)?(t.minimumFractionDigits=X(n),t.maximumFractionDigits=X(n)):J(r)&&(t.maximumSignificantDigits=3),Intl.NumberFormat("en-US",t).format(e)}return eT(e).format({output:"byte",base:i?"decimal":"binary",spaceSeparated:!0,mantissa:Y(n)?n:2,trimMantissa:!Y(n),optionalMantissa:!Y(n)})}function eC(e,{unit:t="bits",shortValues:r,decimalPlaces:n}){let i="decbits"===t;if(!J(r)||Math.abs(e)<(i?1e3:1024)){let t={style:"decimal",useGrouping:!0};return Y(n)?(t.minimumFractionDigits=X(n),t.maximumFractionDigits=X(n)):J(r)&&(t.maximumSignificantDigits=3),Intl.NumberFormat("en-US",t).format(e)+" bits"}return eT(e).format({output:"byte",base:i?"decimal":"binary",spaceSeparated:!0,mantissa:Y(n)?n:2,trimMantissa:!Y(n),optionalMantissa:!Y(n)}).replace(/KB/g,"Kb").replace(/MB/g,"Mb").replace(/GB/g,"Gb").replace(/TB/g,"Tb").replace(/PB/g,"Pb").replace(/EB/g,"Eb").replace(/KiB/g,"Kib").replace(/MiB/g,"Mib").replace(/GiB/g,"Gib").replace(/TiB/g,"Tib").replace(/PiB/g,"Pib").replace(/EiB/g,"Eib")}let eI="Percent",eD="Temperature",ej="Time";var eF=((ar={}).nanoseconds="nanosecond",ar.microseconds="microsecond",ar.milliseconds="millisecond",ar.seconds="second",ar.minutes="minute",ar.hours="hour",ar.days="day",ar.weeks="week",ar.months="month",ar.years="year",ar);let eR={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001,microseconds:1e-6,nanoseconds:1e-9},eP=["years","months","weeks","days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"],eZ="Throughput";var ez=r(224);let eB="Currency",e$="Date",eL={Time:{label:"Time",decimalPlaces:!0},Percent:{label:"percent",decimalPlaces:!0},Decimal:{label:"Decimal",decimalPlaces:!0,shortValues:!0},Bytes:{label:"Bytes",decimalPlaces:!0,shortValues:!0},Bits:{label:"Bits",decimalPlaces:!0,shortValues:!0},Throughput:{label:"Throughput",decimalPlaces:!0},Currency:{label:"Currency",decimalPlaces:!0},Temperature:{label:eD,decimalPlaces:!0},Date:{label:"Date & Time"}},eU={nanoseconds:{group:ej,label:"Nanoseconds"},microseconds:{group:ej,label:"Microseconds"},milliseconds:{group:ej,label:"Milliseconds"},seconds:{group:ej,label:"Seconds"},minutes:{group:ej,label:"Minutes"},hours:{group:ej,label:"Hours"},days:{group:ej,label:"Days"},weeks:{group:ej,label:"Weeks"},months:{group:ej,label:"Months"},years:{group:ej,label:"Years"},percent:{group:eI,label:"Percent (0-100)"},"percent-decimal":{group:eI,label:"Percent (0.0-1.0)"},"%":{disableSelectorOption:!0,group:eI,label:"%"},decimal:{group:"Decimal",label:"Decimal"},bytes:{group:"Bytes",label:"Bytes (IEC)"},decbytes:{group:"Bytes",label:"Bytes (SI)"},bits:{group:"Bits",label:"Bits (IEC)"},decbits:{group:"Bits",label:"Bits (SI)"},"bits/sec":{group:eZ,label:"Bits/sec (IEC)"},"decbits/sec":{group:eZ,label:"Bits/sec (SI)"},"bytes/sec":{group:eZ,label:"Bytes/sec (IEC)"},"decbytes/sec":{group:eZ,label:"Bytes/sec (SI)"},"counts/sec":{group:eZ,label:"Counts/sec"},"events/sec":{group:eZ,label:"Events/sec"},"messages/sec":{group:eZ,label:"Messages/sec"},"ops/sec":{group:eZ,label:"Ops/sec"},"packets/sec":{group:eZ,label:"Packets/sec"},"reads/sec":{group:eZ,label:"Reads/sec"},"requests/sec":{group:eZ,label:"Requests/sec"},"records/sec":{group:eZ,label:"Records/sec"},"rows/sec":{group:eZ,label:"Rows/sec"},"writes/sec":{group:eZ,label:"Writes/sec"},aud:{group:eB,label:"Australian Dollar (A$)"},cad:{group:eB,label:"Canadian Dollar (CA$)"},chf:{group:eB,label:"Swiss Franc (CHF)"},cny:{group:eB,label:"Renminbi (CN\xa5)"},eur:{group:eB,label:"Euro (€)"},gbp:{group:eB,label:"Pound (\xa3)"},hkd:{group:eB,label:"Hong Kong Dollar (HK$)"},inr:{group:eB,label:"Indian Rupee (₹)"},jpy:{group:eB,label:"Yen (\xa5)"},krw:{group:eB,label:"South Korean Won (₩)"},nok:{group:eB,label:"Norwegian Krone (NOK)"},nzd:{group:eB,label:"New Zealand Dollar (NZ$)"},sek:{group:eB,label:"Swedish Krona (SEK)"},sgd:{group:eB,label:"Singapore Dollar (S$)"},usd:{group:eB,label:"US Dollar ($)"},celsius:{group:eD,label:"Celsius (\xb0C)"},fahrenheit:{group:eD,label:"Fahrenheit (\xb0F)"},"datetime-iso":{group:e$,label:"DateTime (GMT)"},"datetime-us":{group:e$,label:"DateTime (US-East)"},"datetime-local":{group:e$,label:"DateTime (Browser Local)"},"date-iso":{group:e$,label:"Date (GMT)"},"date-us":{group:e$,label:"Date (US-East)"},"date-local":{group:e$,label:"Date (Browser Local)"},"time-local":{group:e$,label:"Time (Browser Local)"},"time-iso":{group:e$,label:"Time (GMT)"},"time-us":{group:e$,label:"Time (US-East)"},"relative-time":{group:e$,label:"Relative Time"},"unix-timestamp":{group:e$,label:"Unix Timestamp (s)"},"unix-timestamp-ms":{group:e$,label:"Unix Timestamp (ms)"}};function eV(e,t){if(!t)return e.toString();if(eY(t))return eA(e,t);if(eX(t))return eC(e,t);if(eJ(t))return function(e,{shortValues:t,decimalPlaces:r}){let n={style:"decimal",useGrouping:!0};return J(t)&&(n.notation="compact"),Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):J(t)&&(n.maximumSignificantDigits=3),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(eH(t))return function(e,{unit:t,decimalPlaces:r}){let n={style:"percent",useGrouping:!0};return Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):n.maximumSignificantDigits=3,"percent"===t&&(e/=100),Intl.NumberFormat("en-US",n).format(e)}(e,t);if(eK(t))return function(e,{unit:t,decimalPlaces:r}){var n;if(0===e)return"0s";let i=function(e,t){let r=e*eR[t],n=eP[0]||"years",i=n,a=r/eR[n];for(i of eP)if((a=r/eR[i])>=1)break;return{value:a,unit:i}}(e,t??"seconds"),a={style:"unit",unit:eF[i.unit],unitDisplay:"months"===(n=i.unit)||"years"===n?"long":"narrow"};return Y(r)?(a.minimumFractionDigits=X(r),a.maximumFractionDigits=X(r)):a.maximumSignificantDigits=3,Intl.NumberFormat("en-US",a).format(i.value)}(e,t);if(e1(t))return function(e,{unit:t,shortValues:r,decimalPlaces:n}){if("bits/sec"===t){let t=1024>Math.abs(e)?"sec":"s";return eC(e,{unit:"bits",shortValues:r,decimalPlaces:n})+"/"+t}if("decbits/sec"===t){let t=1e3>Math.abs(e)?"sec":"s";return eC(e,{unit:"decbits",shortValues:r,decimalPlaces:n})+"/"+t}if("decbytes/sec"===t){let t=1e3>Math.abs(e)?"sec":"s";return eA(e,{unit:"decbytes",shortValues:r,decimalPlaces:n})+"/"+t}if("bytes/sec"===t){let t=1024>Math.abs(e)?"sec":"s";return eA(e,{unit:"bytes",shortValues:r,decimalPlaces:n})+"/"+t}let i={style:"decimal",useGrouping:!0};return J(r)&&(i.notation="compact"),Y(n)?(i.minimumFractionDigits=X(n),i.maximumFractionDigits=X(n)):J(r)&&(i.maximumSignificantDigits=3),Intl.NumberFormat("en-US",i).format(e)+" "+t}(e,t);if(e2(t))return function(e,{unit:t,decimalPlaces:r}){let n={style:"currency",currency:(0,ez.toUpper)(t),currencyDisplay:"symbol"};return Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):n.maximumSignificantDigits=3,Intl.NumberFormat("en-US",n).format(e)}(e,t);if(e4(t))return function(e,t={}){let r=Intl.DateTimeFormat().resolvedOptions().timeZone,{unit:n="datetime-local",locale:i=(()=>{if("undefined"!=typeof navigator){if(navigator.language)return navigator.language;if(navigator.languages&&navigator.languages.length>0){let e=navigator.languages[0];if(e)return e}let e=navigator;if(e.userLanguage)return e.userLanguage;if(e.browserLanguage)return e.browserLanguage;if(e.systemLanguage)return e.systemLanguage}return Intl.DateTimeFormat().resolvedOptions().locale||"en-US"})(),timeZone:a=r,referenceTime:s=Date.now()}=t;if("unix-timestamp"===n)return(e>1e12?Math.floor(e/1e3):e).toString();if("unix-timestamp-ms"===n)return Math.floor(e<1e11?1e3*e:e).toString();let o=function(e){if(e<0)if(Math.abs(e)>1e10)return new Date(e);else return new Date(1e3*e);if(e>=25e10&&e<=26e10){let t=new Date(1e3*e);if(t.getUTCFullYear()>=9999)return t}return new Date(e<1e10?1e3*e:e)}(e);if("relative-time"===n){let e=new Date(s),t=o.getTime()-e.getTime();for(let{unit:e,ms:r}of[{unit:"year",ms:31536e6},{unit:"month",ms:2592e6},{unit:"week",ms:6048e5},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}]){let n=Math.round(t/r);if(Math.abs(n)>=1)return new Intl.RelativeTimeFormat(i,{numeric:"auto"}).format(n,e)}return new Intl.RelativeTimeFormat(i,{numeric:"auto"}).format(0,"second")}let u={timeZone:a};switch(n){case"datetime-iso":return o.toISOString();case"datetime-us":return u.timeZone="America/New_York",u.year="numeric",u.month="2-digit",u.day="2-digit",u.hour="2-digit",u.minute="2-digit",u.second="2-digit",u.hour12=!0,new Intl.DateTimeFormat("en-US",u).format(o);case"datetime-local":u.year="numeric",u.month="2-digit",u.day="2-digit",u.hour="2-digit",u.minute="2-digit",u.second="2-digit",u.hour12=!1;break;case"date-iso":return o.toISOString().split("T")[0];case"date-us":return u.timeZone="America/New_York",u.year="numeric",u.month="2-digit",u.day="2-digit",new Intl.DateTimeFormat("en-US",u).format(o);case"date-local":u.year="numeric",u.month="2-digit",u.day="2-digit";break;case"time-local":u.hour="2-digit",u.minute="2-digit",u.second="2-digit",u.hour12=!1;break;case"time-iso":return o.toISOString().split("T")[1].replace("Z","");case"time-us":return u.timeZone="America/New_York",u.hour="2-digit",u.minute="2-digit",u.second="2-digit",u.hour12=!0,new Intl.DateTimeFormat("en-US",u).format(o);default:throw Error(`Unknown date unit: ${n}`)}return new Intl.DateTimeFormat(i,u).format(o)}(e,t);if(e9(t))return((e,{unit:t,decimalPlaces:r})=>{let n={unit:t,style:"unit"};Y(r)?(n.minimumFractionDigits=X(r),n.maximumFractionDigits=X(r)):n.maximumSignificantDigits=3;let i="celsius"===t?"en-GB":"en-US";return Intl.NumberFormat(i,n).format(e)})(e,t);throw Error(`Unknown unit options ${t}`)}function eq(e){return eU[e.unit??"decimal"]}function eG(e){return eq(e).group??"Decimal"}function eW(e){return eL[eq(e).group??"Decimal"]}function eK(e){return"Time"===eG(e)}function eH(e){return"Percent"===eG(e)}function eJ(e){return"Decimal"===eG(e)}function eY(e){return"Bytes"===eG(e)}function eX(e){return"Bits"===eG(e)}function eQ(e){return!!eW(e).decimalPlaces}function e0(e){return!!eW(e).shortValues}function e1(e){return"Throughput"===eG(e)}function e2(e){return"Currency"===eG(e)}function e4(e){return"Date"===eG(e)}function e9(e){return"Temperature"===eG(e)}function e5(e){return"project"in e.metadata?e.metadata.project:void 0}(an=ap||(ap={})).assertEqual=e=>e,an.assertIs=function(e){},an.assertNever=function(e){throw Error()},an.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},an.getValidEnumValues=e=>{let t=an.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return an.objectValues(r)},an.objectValues=e=>an.objectKeys(e).map(function(t){return e[t]}),an.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},an.find=(e,t)=>{for(let r of e)if(t(r))return r},an.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,an.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},an.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(am||(am={})).mergeShapes=(e,t)=>({...e,...t});let e3=ap.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),e7=e=>{switch(typeof e){case"undefined":return e3.undefined;case"string":return e3.string;case"number":return isNaN(e)?e3.nan:e3.number;case"boolean":return e3.boolean;case"function":return e3.function;case"bigint":return e3.bigint;case"symbol":return e3.symbol;case"object":if(Array.isArray(e))return e3.array;if(null===e)return e3.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return e3.promise;if("undefined"!=typeof Map&&e instanceof Map)return e3.map;if("undefined"!=typeof Set&&e instanceof Set)return e3.set;if("undefined"!=typeof Date&&e instanceof Date)return e3.date;return e3.object;default:return e3.unknown}},e6=ap.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 e8 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]};const 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 e8))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ap.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()}}e8.create=e=>new e8(e);let te=(e,t)=>{let r;switch(e.code){case e6.invalid_type:r=e.received===e3.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case e6.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ap.jsonStringifyReplacer)}`;break;case e6.unrecognized_keys:r=`Unrecognized key(s) in object: ${ap.joinValues(e.keys,", ")}`;break;case e6.invalid_union:r="Invalid input";break;case e6.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ap.joinValues(e.options)}`;break;case e6.invalid_enum_value:r=`Invalid enum value. Expected ${ap.joinValues(e.options)}, received '${e.received}'`;break;case e6.invalid_arguments:r="Invalid function arguments";break;case e6.invalid_return_type:r="Invalid function return type";break;case e6.invalid_date:r="Invalid date";break;case e6.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}"`:ap.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case e6.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 e6.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 e6.custom:r="Invalid input";break;case e6.invalid_intersection_types:r="Intersection results could not be merged";break;case e6.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case e6.not_finite:r="Number must be finite";break;default:r=t.defaultError,ap.assertNever(e)}return{message:r}},tt=te;function tr(){return tt}let tn=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 ti(e,t){let r=tr(),n=tn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===te?void 0:te].filter(e=>!!e)});e.common.issues.push(n)}class ta{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 ts;"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 ta.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 ts;"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 ts=Object.freeze({status:"aborted"}),to=e=>({status:"dirty",value:e}),tu=e=>({status:"valid",value:e}),tl=e=>"aborted"===e.status,tc=e=>"dirty"===e.status,tf=e=>"valid"===e.status,td=e=>"undefined"!=typeof Promise&&e instanceof Promise;function th(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 tp(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,(ai=ag||(ag={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},ai.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class tm{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 tg=(e,t)=>{if(tf(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 e8(e.common.issues);return this._error=t,this._error}}};function ty(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var a,s;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!=(a=null!=o?o:n)?a:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!=(s=null!=o?o:r)?s:i.defaultError}},description:i}}class tv{get description(){return this._def.description}_getType(e){return e7(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:e7(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ta,ctx:{common:e.parent.common,data:e.data,parsedType:e7(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(td(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!=(r=null==t?void 0:t.async)&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e7(e)},i=this._parseSync({data:e,path:n.path,parent:n});return tg(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:e7(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:n});return tf(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null==(r=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(e=>tf(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:e7(e)},n=this._parse({data:e,path:r.path,parent:r});return tg(r,await (td(n)?n:Promise.resolve(n)))}refine(e,t){return this._refinement((r,n)=>{let i=e(r),a=()=>n.addIssue({code:e6.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new rr({schema:this,typeName:ab.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 rn.create(this,this._def)}nullable(){return ri.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tH.create(this)}promise(){return rt.create(this,this._def)}or(e){return tY.create([this,e],this._def)}and(e){return t0.create(this,e,this._def)}transform(e){return new rr({...ty(this._def),schema:this,typeName:ab.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ra({...ty(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:ab.ZodDefault})}brand(){return new rl({typeName:ab.ZodBranded,type:this,...ty(this._def)})}catch(e){return new rs({...ty(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:ab.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return rc.create(this,e)}readonly(){return rf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let tb=/^c[^\s-]{8,}$/i,tw=/^[0-9a-z]+$/,t_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tx=/^[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,tN=/^[a-z0-9_-]{21}$/i,tS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tM=/^[-+]?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)?)??$/,tE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tk=/^(?:(?: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])$/,tO=/^(?:(?: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])$/,tT=/^(([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]))$/,tA=/^(([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])$/,tC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tD="((\\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])))",tj=RegExp(`^${tD}$`);function tF(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 tR(e){let t=`${tD}T${tF(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class tP extends tv{_parse(e){var t,r,i,a;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==e3.string){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.string,received:t.parsedType}),ts}let o=new ta;for(let u of this._def.checks)if("min"===u.kind)e.data.length<u.value&&(ti(s=this._getOrReturnCtx(e,s),{code:e6.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&&(ti(s=this._getOrReturnCtx(e,s),{code:e6.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?ti(s,{code:e6.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):r&&ti(s,{code:e6.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),o.dirty())}else if("email"===u.kind)tE.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"email",code:e6.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)||(ti(s=this._getOrReturnCtx(e,s),{validation:"emoji",code:e6.invalid_string,message:u.message}),o.dirty());else if("uuid"===u.kind)tx.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"uuid",code:e6.invalid_string,message:u.message}),o.dirty());else if("nanoid"===u.kind)tN.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"nanoid",code:e6.invalid_string,message:u.message}),o.dirty());else if("cuid"===u.kind)tb.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"cuid",code:e6.invalid_string,message:u.message}),o.dirty());else if("cuid2"===u.kind)tw.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"cuid2",code:e6.invalid_string,message:u.message}),o.dirty());else if("ulid"===u.kind)t_.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"ulid",code:e6.invalid_string,message:u.message}),o.dirty());else if("url"===u.kind)try{new URL(e.data)}catch(t){ti(s=this._getOrReturnCtx(e,s),{validation:"url",code:e6.invalid_string,message:u.message}),o.dirty()}else"regex"===u.kind?(u.regex.lastIndex=0,u.regex.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"regex",code:e6.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)||(ti(s=this._getOrReturnCtx(e,s),{code:e6.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)||(ti(s=this._getOrReturnCtx(e,s),{code:e6.invalid_string,validation:{startsWith:u.value},message:u.message}),o.dirty()):"endsWith"===u.kind?e.data.endsWith(u.value)||(ti(s=this._getOrReturnCtx(e,s),{code:e6.invalid_string,validation:{endsWith:u.value},message:u.message}),o.dirty()):"datetime"===u.kind?tR(u).test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{code:e6.invalid_string,validation:"datetime",message:u.message}),o.dirty()):"date"===u.kind?tj.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{code:e6.invalid_string,validation:"date",message:u.message}),o.dirty()):"time"===u.kind?RegExp(`^${tF(u)}$`).test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{code:e6.invalid_string,validation:"time",message:u.message}),o.dirty()):"duration"===u.kind?tM.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"duration",code:e6.invalid_string,message:u.message}),o.dirty()):"ip"===u.kind?(t=e.data,!(("v4"===(r=u.version)||!r)&&tk.test(t)||("v6"===r||!r)&&tT.test(t))&&1&&(ti(s=this._getOrReturnCtx(e,s),{validation:"ip",code:e6.invalid_string,message:u.message}),o.dirty())):"jwt"===u.kind?!function(e,t){if(!tS.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)&&(ti(s=this._getOrReturnCtx(e,s),{validation:"jwt",code:e6.invalid_string,message:u.message}),o.dirty()):"cidr"===u.kind?(i=e.data,!(("v4"===(a=u.version)||!a)&&tO.test(i)||("v6"===a||!a)&&tA.test(i))&&1&&(ti(s=this._getOrReturnCtx(e,s),{validation:"cidr",code:e6.invalid_string,message:u.message}),o.dirty())):"base64"===u.kind?tC.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"base64",code:e6.invalid_string,message:u.message}),o.dirty()):"base64url"===u.kind?tI.test(e.data)||(ti(s=this._getOrReturnCtx(e,s),{validation:"base64url",code:e6.invalid_string,message:u.message}),o.dirty()):ap.assertNever(u);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:e6.invalid_string,...ag.errToObj(r)})}_addCheck(e){return new tP({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ag.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ag.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ag.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ag.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ag.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ag.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ag.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ag.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ag.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ag.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ag.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ag.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ag.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(r=null==e?void 0:e.local)&&r,...ag.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,...ag.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ag.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ag.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...ag.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ag.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ag.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ag.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ag.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ag.errToObj(t)})}nonempty(e){return this.min(1,ag.errToObj(e))}trim(){return new tP({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tP({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tP({...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}}tP.create=e=>{var t;return new tP({checks:[],typeName:ab.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...ty(e)})};class tZ extends tv{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)!==e3.number){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.number,received:t.parsedType}),ts}let r=new ta;for(let n of this._def.checks)"int"===n.kind?ap.isInteger(e.data)||(ti(t=this._getOrReturnCtx(e,t),{code:e6.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.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)&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.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)&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(ti(t=this._getOrReturnCtx(e,t),{code:e6.not_finite,message:n.message}),r.dirty()):ap.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ag.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ag.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ag.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ag.toString(t))}setLimit(e,t,r,n){return new tZ({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ag.toString(n)}]})}_addCheck(e){return new tZ({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ag.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ag.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ag.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ag.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ag.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ag.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ag.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ag.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ag.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&&ap.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}tZ.create=e=>new tZ({checks:[],typeName:ab.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...ty(e)});class tz extends tv{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)!==e3.bigint)return this._getInvalidInput(e);let r=new ta;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.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)&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ap.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.bigint,received:t.parsedType}),ts}gte(e,t){return this.setLimit("min",e,!0,ag.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ag.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ag.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ag.toString(t))}setLimit(e,t,r,n){return new tz({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ag.toString(n)}]})}_addCheck(e){return new tz({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ag.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ag.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ag.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ag.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ag.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}}tz.create=e=>{var t;return new tz({checks:[],typeName:ab.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...ty(e)})};class tB extends tv{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==e3.boolean){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.boolean,received:t.parsedType}),ts}return tu(e.data)}}tB.create=e=>new tB({typeName:ab.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...ty(e)});class t$ extends tv{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==e3.date){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.date,received:t.parsedType}),ts}if(isNaN(e.data.getTime()))return ti(this._getOrReturnCtx(e),{code:e6.invalid_date}),ts;let r=new ta;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(ti(t=this._getOrReturnCtx(e,t),{code:e6.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):ap.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t$({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ag.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ag.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}}t$.create=e=>new t$({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ab.ZodDate,...ty(e)});class tL extends tv{_parse(e){if(this._getType(e)!==e3.symbol){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.symbol,received:t.parsedType}),ts}return tu(e.data)}}tL.create=e=>new tL({typeName:ab.ZodSymbol,...ty(e)});class tU extends tv{_parse(e){if(this._getType(e)!==e3.undefined){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.undefined,received:t.parsedType}),ts}return tu(e.data)}}tU.create=e=>new tU({typeName:ab.ZodUndefined,...ty(e)});class tV extends tv{_parse(e){if(this._getType(e)!==e3.null){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.null,received:t.parsedType}),ts}return tu(e.data)}}tV.create=e=>new tV({typeName:ab.ZodNull,...ty(e)});class tq extends tv{constructor(){super(...arguments),this._any=!0}_parse(e){return tu(e.data)}}tq.create=e=>new tq({typeName:ab.ZodAny,...ty(e)});class tG extends tv{constructor(){super(...arguments),this._unknown=!0}_parse(e){return tu(e.data)}}tG.create=e=>new tG({typeName:ab.ZodUnknown,...ty(e)});class tW extends tv{_parse(e){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.never,received:t.parsedType}),ts}}tW.create=e=>new tW({typeName:ab.ZodNever,...ty(e)});class tK extends tv{_parse(e){if(this._getType(e)!==e3.undefined){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.void,received:t.parsedType}),ts}return tu(e.data)}}tK.create=e=>new tK({typeName:ab.ZodVoid,...ty(e)});class tH extends tv{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==e3.array)return ti(t,{code:e6.invalid_type,expected:e3.array,received:t.parsedType}),ts;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(ti(t,{code:e?e6.too_big:e6.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&&(ti(t,{code:e6.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&&(ti(t,{code:e6.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 tm(t,e,t.path,r)))).then(e=>ta.mergeArray(r,e));let i=[...t.data].map((e,r)=>n.type._parseSync(new tm(t,e,t.path,r)));return ta.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new tH({...this._def,minLength:{value:e,message:ag.toString(t)}})}max(e,t){return new tH({...this._def,maxLength:{value:e,message:ag.toString(t)}})}length(e,t){return new tH({...this._def,exactLength:{value:e,message:ag.toString(t)}})}nonempty(e){return this.min(1,e)}}tH.create=(e,t)=>new tH({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ab.ZodArray,...ty(t)});class tJ extends tv{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=ap.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==e3.object){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.object,received:t.parsedType}),ts}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof tW&&"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 tm(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof tW){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&&(ti(r,{code:e6.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 tm(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=>ta.mergeObjectSync(t,e)):ta.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return ag.errToObj,new tJ({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,a,s;let o=null!=(a=null==(i=(n=this._def).errorMap)?void 0:i.call(n,t,r).message)?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!=(s=ag.errToObj(e).message)?s:o}:{message:o}}}:{}})}strip(){return new tJ({...this._def,unknownKeys:"strip"})}passthrough(){return new tJ({...this._def,unknownKeys:"passthrough"})}extend(e){return new tJ({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new tJ({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ab.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new tJ({...this._def,catchall:e})}pick(e){let t={};return ap.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new tJ({...this._def,shape:()=>t})}omit(e){let t={};return ap.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new tJ({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof tJ){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=rn.create(e(i))}return new tJ({...t._def,shape:()=>r})}if(t instanceof tH)return new tH({...t._def,type:e(t.element)});if(t instanceof rn)return rn.create(e(t.unwrap()));if(t instanceof ri)return ri.create(e(t.unwrap()));if(t instanceof t1)return t1.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};return ap.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new tJ({...this._def,shape:()=>t})}required(e){let t={};return ap.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof rn;)e=e._def.innerType;t[r]=e}}),new tJ({...this._def,shape:()=>t})}keyof(){return t6(ap.objectKeys(this.shape))}}tJ.create=(e,t)=>new tJ({shape:()=>e,unknownKeys:"strip",catchall:tW.create(),typeName:ab.ZodObject,...ty(t)}),tJ.strictCreate=(e,t)=>new tJ({shape:()=>e,unknownKeys:"strict",catchall:tW.create(),typeName:ab.ZodObject,...ty(t)}),tJ.lazycreate=(e,t)=>new tJ({shape:e,unknownKeys:"strip",catchall:tW.create(),typeName:ab.ZodObject,...ty(t)});class tY extends tv{_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 e8(e.ctx.common.issues));return ti(t,{code:e6.invalid_union,unionErrors:r}),ts});{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new e8(e));return ti(t,{code:e6.invalid_union,unionErrors:i}),ts}}get options(){return this._def.options}}tY.create=(e,t)=>new tY({options:e,typeName:ab.ZodUnion,...ty(t)});let tX=e=>{if(e instanceof t3)return tX(e.schema);if(e instanceof rr)return tX(e.innerType());if(e instanceof t7)return[e.value];if(e instanceof t8)return e.options;if(e instanceof re)return ap.objectValues(e.enum);else if(e instanceof ra)return tX(e._def.innerType);else if(e instanceof tU)return[void 0];else if(e instanceof tV)return[null];else if(e instanceof rn)return[void 0,...tX(e.unwrap())];else if(e instanceof ri)return[null,...tX(e.unwrap())];else if(e instanceof rl)return tX(e.unwrap());else if(e instanceof rf)return tX(e.unwrap());else if(e instanceof rs)return tX(e._def.innerType);else return[]};class tQ extends tv{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e3.object)return ti(t,{code:e6.invalid_type,expected:e3.object,received:t.parsedType}),ts;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}):(ti(t,{code:e6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ts)}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=tX(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 tQ({typeName:ab.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...ty(r)})}}class t0 extends tv{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(tl(e)||tl(n))return ts;let i=function e(t,r){let n=e7(t),i=e7(r);if(t===r)return{valid:!0,data:t};if(n===e3.object&&i===e3.object){let n=ap.objectKeys(r),i=ap.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===e3.array&&i===e3.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===e3.date&&i===e3.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return i.valid?((tc(e)||tc(n))&&t.dirty(),{status:t.value,value:i.data}):(ti(r,{code:e6.invalid_intersection_types}),ts)};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}))}}t0.create=(e,t,r)=>new t0({left:e,right:t,typeName:ab.ZodIntersection,...ty(r)});class t1 extends tv{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e3.array)return ti(r,{code:e6.invalid_type,expected:e3.array,received:r.parsedType}),ts;if(r.data.length<this._def.items.length)return ti(r,{code:e6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ts;!this._def.rest&&r.data.length>this._def.items.length&&(ti(r,{code:e6.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 tm(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>ta.mergeArray(t,e)):ta.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new t1({...this._def,rest:e})}}t1.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new t1({items:e,typeName:ab.ZodTuple,rest:null,...ty(t)})};class t2 extends tv{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!==e3.object)return ti(r,{code:e6.invalid_type,expected:e3.object,received:r.parsedType}),ts;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new tm(r,e,r.path,e)),value:a._parse(new tm(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?ta.mergeObjectAsync(t,n):ta.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new t2(t instanceof tv?{keyType:e,valueType:t,typeName:ab.ZodRecord,...ty(r)}:{keyType:tP.create(),valueType:e,typeName:ab.ZodRecord,...ty(t)})}}class t4 extends tv{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!==e3.map)return ti(r,{code:e6.invalid_type,expected:e3.map,received:r.parsedType}),ts;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:n._parse(new tm(r,e,r.path,[a,"key"])),value:i._parse(new tm(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 ts;("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 ts;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}t4.create=(e,t,r)=>new t4({valueType:t,keyType:e,typeName:ab.ZodMap,...ty(r)});class t9 extends tv{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==e3.set)return ti(r,{code:e6.invalid_type,expected:e3.set,received:r.parsedType}),ts;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(ti(r,{code:e6.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&&(ti(r,{code:e6.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 ts;"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 tm(r,e,r.path,t)));return r.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new t9({...this._def,minSize:{value:e,message:ag.toString(t)}})}max(e,t){return new t9({...this._def,maxSize:{value:e,message:ag.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}t9.create=(e,t)=>new t9({valueType:e,minSize:null,maxSize:null,typeName:ab.ZodSet,...ty(t)});class t5 extends tv{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==e3.function)return ti(t,{code:e6.invalid_type,expected:e3.function,received:t.parsedType}),ts;function r(e,r){return tn({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tr(),te].filter(e=>!!e),issueData:{code:e6.invalid_arguments,argumentsError:r}})}function n(e,r){return tn({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tr(),te].filter(e=>!!e),issueData:{code:e6.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof rt){let e=this;return tu(async function(...t){let s=new e8([]),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 tu(function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new e8([r(t,s.error)]);let o=Reflect.apply(a,this,s.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new e8([n(o,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t5({...this._def,args:t1.create(e).rest(tG.create())})}returns(e){return new t5({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new t5({args:e||t1.create([]).rest(tG.create()),returns:t||tG.create(),typeName:ab.ZodFunction,...ty(r)})}}class t3 extends tv{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})}}t3.create=(e,t)=>new t3({getter:e,typeName:ab.ZodLazy,...ty(t)});class t7 extends tv{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return ti(t,{received:t.data,code:e6.invalid_literal,expected:this._def.value}),ts}return{status:"valid",value:e.data}}get value(){return this._def.value}}function t6(e,t){return new t8({values:e,typeName:ab.ZodEnum,...ty(t)})}t7.create=(e,t)=>new t7({value:e,typeName:ab.ZodLiteral,...ty(t)});class t8 extends tv{constructor(){super(...arguments),ay.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return ti(t,{expected:ap.joinValues(r),received:t.parsedType,code:e6.invalid_type}),ts}if(th(this,ay,"f")||tp(this,ay,new Set(this._def.values),"f"),!th(this,ay,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return ti(t,{received:t.data,code:e6.invalid_enum_value,options:r}),ts}return tu(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 t8.create(e,{...this._def,...t})}exclude(e,t=this._def){return t8.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ay=new WeakMap,t8.create=t6;class re extends tv{constructor(){super(...arguments),av.set(this,void 0)}_parse(e){let t=ap.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==e3.string&&r.parsedType!==e3.number){let e=ap.objectValues(t);return ti(r,{expected:ap.joinValues(e),received:r.parsedType,code:e6.invalid_type}),ts}if(th(this,av,"f")||tp(this,av,new Set(ap.getValidEnumValues(this._def.values)),"f"),!th(this,av,"f").has(e.data)){let e=ap.objectValues(t);return ti(r,{received:r.data,code:e6.invalid_enum_value,options:e}),ts}return tu(e.data)}get enum(){return this._def.values}}av=new WeakMap,re.create=(e,t)=>new re({values:e,typeName:ab.ZodNativeEnum,...ty(t)});class rt extends tv{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==e3.promise&&!1===t.common.async?(ti(t,{code:e6.invalid_type,expected:e3.promise,received:t.parsedType}),ts):tu((t.parsedType===e3.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}rt.create=(e,t)=>new rt({type:e,typeName:ab.ZodPromise,...ty(t)});class rr extends tv{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ab.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=>{ti(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 ts;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?ts:"dirty"===n.status||"dirty"===t.value?to(n.value):n});{if("aborted"===t.value)return ts;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?ts:"dirty"===n.status||"dirty"===t.value?to(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?ts:("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?ts:("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=>tf(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!tf(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}}ap.assertNever(n)}}rr.create=(e,t,r)=>new rr({schema:e,typeName:ab.ZodEffects,effect:t,...ty(r)}),rr.createWithPreprocess=(e,t,r)=>new rr({schema:t,effect:{type:"preprocess",transform:e},typeName:ab.ZodEffects,...ty(r)});class rn extends tv{_parse(e){return this._getType(e)===e3.undefined?tu(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rn.create=(e,t)=>new rn({innerType:e,typeName:ab.ZodOptional,...ty(t)});class ri extends tv{_parse(e){return this._getType(e)===e3.null?tu(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ri.create=(e,t)=>new ri({innerType:e,typeName:ab.ZodNullable,...ty(t)});class ra extends tv{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===e3.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ra.create=(e,t)=>new ra({innerType:e,typeName:ab.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ty(t)});class rs extends tv{_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 td(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new e8(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new e8(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:ab.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ty(t)});class ro extends tv{_parse(e){if(this._getType(e)!==e3.nan){let t=this._getOrReturnCtx(e);return ti(t,{code:e6.invalid_type,expected:e3.nan,received:t.parsedType}),ts}return{status:"valid",value:e.data}}}ro.create=e=>new ro({typeName:ab.ZodNaN,...ty(e)});let ru=Symbol("zod_brand");class rl extends tv{_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 rc extends tv{_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?ts:"dirty"===e.status?(t.dirty(),to(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?ts:"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 rc({in:e,out:t,typeName:ab.ZodPipeline})}}class rf extends tv{_parse(e){let t=this._def.innerType._parse(e),r=e=>(tf(e)&&(e.value=Object.freeze(e.value)),e);return td(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function rd(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function rh(e,t={},r){return e?tq.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=rd(t,n),o=null==(s=null!=(a=e.fatal)?a:r)||s;i.addIssue({code:"custom",...e,fatal:o})}});if(!o){let e=rd(t,n),o=null==(s=null!=(a=e.fatal)?a:r)||s;i.addIssue({code:"custom",...e,fatal:o})}}):tq.create()}rf.create=(e,t)=>new rf({innerType:e,typeName:ab.ZodReadonly,...ty(t)});let rp={object:tJ.lazycreate};(aa=ab||(ab={})).ZodString="ZodString",aa.ZodNumber="ZodNumber",aa.ZodNaN="ZodNaN",aa.ZodBigInt="ZodBigInt",aa.ZodBoolean="ZodBoolean",aa.ZodDate="ZodDate",aa.ZodSymbol="ZodSymbol",aa.ZodUndefined="ZodUndefined",aa.ZodNull="ZodNull",aa.ZodAny="ZodAny",aa.ZodUnknown="ZodUnknown",aa.ZodNever="ZodNever",aa.ZodVoid="ZodVoid",aa.ZodArray="ZodArray",aa.ZodObject="ZodObject",aa.ZodUnion="ZodUnion",aa.ZodDiscriminatedUnion="ZodDiscriminatedUnion",aa.ZodIntersection="ZodIntersection",aa.ZodTuple="ZodTuple",aa.ZodRecord="ZodRecord",aa.ZodMap="ZodMap",aa.ZodSet="ZodSet",aa.ZodFunction="ZodFunction",aa.ZodLazy="ZodLazy",aa.ZodLiteral="ZodLiteral",aa.ZodEnum="ZodEnum",aa.ZodEffects="ZodEffects",aa.ZodNativeEnum="ZodNativeEnum",aa.ZodOptional="ZodOptional",aa.ZodNullable="ZodNullable",aa.ZodDefault="ZodDefault",aa.ZodCatch="ZodCatch",aa.ZodPromise="ZodPromise",aa.ZodBranded="ZodBranded",aa.ZodPipeline="ZodPipeline",aa.ZodReadonly="ZodReadonly";let rm=tP.create,rg=tZ.create,ry=ro.create,rv=tz.create,rb=tB.create,rw=t$.create,r_=tL.create,rx=tU.create,rN=tV.create,rS=tq.create,rM=tG.create,rE=tW.create,rk=tK.create,rO=tH.create,rT=tJ.create,rA=tJ.strictCreate,rC=tY.create,rI=tQ.create,rD=t0.create,rj=t1.create,rF=t2.create,rR=t4.create,rP=t9.create,rZ=t5.create,rz=t3.create,rB=t7.create,r$=t8.create,rL=re.create,rU=rt.create,rV=rr.create,rq=rn.create,rG=ri.create,rW=rr.createWithPreprocess,rK=rc.create;var rH=Object.freeze({__proto__:null,defaultErrorMap:te,setErrorMap:function(e){tt=e},getErrorMap:tr,makeIssue:tn,EMPTY_PATH:[],addIssueToContext:ti,ParseStatus:ta,INVALID:ts,DIRTY:to,OK:tu,isAborted:tl,isDirty:tc,isValid:tf,isAsync:td,get util(){return ap},get objectUtil(){return am},ZodParsedType:e3,getParsedType:e7,ZodType:tv,datetimeRegex:tR,ZodString:tP,ZodNumber:tZ,ZodBigInt:tz,ZodBoolean:tB,ZodDate:t$,ZodSymbol:tL,ZodUndefined:tU,ZodNull:tV,ZodAny:tq,ZodUnknown:tG,ZodNever:tW,ZodVoid:tK,ZodArray:tH,ZodObject:tJ,ZodUnion:tY,ZodDiscriminatedUnion:tQ,ZodIntersection:t0,ZodTuple:t1,ZodRecord:t2,ZodMap:t4,ZodSet:t9,ZodFunction:t5,ZodLazy:t3,ZodLiteral:t7,ZodEnum:t8,ZodNativeEnum:re,ZodPromise:rt,ZodEffects:rr,ZodTransformer:rr,ZodOptional:rn,ZodNullable:ri,ZodDefault:ra,ZodCatch:rs,ZodNaN:ro,BRAND:ru,ZodBranded:rl,ZodPipeline:rc,ZodReadonly:rf,custom:rh,Schema:tv,ZodSchema:tv,late:rp,get ZodFirstPartyTypeKind(){return ab},coerce:{string:e=>tP.create({...e,coerce:!0}),number:e=>tZ.create({...e,coerce:!0}),boolean:e=>tB.create({...e,coerce:!0}),bigint:e=>tz.create({...e,coerce:!0}),date:e=>t$.create({...e,coerce:!0})},any:rS,array:rO,bigint:rv,boolean:rb,date:rw,discriminatedUnion:rI,effect:rV,enum:r$,function:rZ,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>rh(t=>t instanceof e,t),intersection:rD,lazy:rz,literal:rB,map:rR,nan:ry,nativeEnum:rL,never:rE,null:rN,nullable:rG,number:rg,object:rT,oboolean:()=>rb().optional(),onumber:()=>rg().optional(),optional:rq,ostring:()=>rm().optional(),pipeline:rK,preprocess:rW,promise:rU,record:rF,set:rP,strictObject:rA,string:rm,symbol:r_,transformer:rV,tuple:rj,undefined:rx,union:rC,unknown:rM,void:rk,NEVER:ts,ZodIssueCode:e6,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:e8});let rJ=rH.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 _ . -"),rY=rH.object({name:rJ}),rX=rY.extend({project:rJ}),rQ=rH.object({kind:rH.string().min(1,"Required"),spec:rH.record(rH.string(),rH.any())}),r0=rH.object({name:rH.string().optional(),description:rH.string().optional()}),r1=rH.object({display:r0.optional(),default:rH.boolean(),plugin:rQ});function r2(e){return rH.object({display:r0.optional(),default:rH.boolean(),plugin:e})}let r4=rH.object({kind:rH.literal("Datasource"),metadata:rX,spec:r1}),r9=rH.object({kind:rH.literal("GlobalDatasource"),metadata:rY,spec:r1}),r5=rH.discriminatedUnion("kind",[r4,r9]),r3=rH.object({name:rH.string().min(1),spec:r1});function r7(e){return rH.object({name:rH.string().min(1),spec:r2(e)})}let r6=rH.string().min(1,"Required").regex(Z,"Must be a valid duration string"),r8=rH.object({name:rH.string().min(1,{message:"Required"}),description:rH.string().optional()}),ne=rH.object({kind:rH.string().min(1),spec:rH.object({plugin:rQ})}),nt=rH.object({name:rH.string().optional(),url:rH.string().min(1),tooltip:rH.string().optional(),renderVariables:rH.boolean().optional(),targetBlank:rH.boolean().optional()}),nr=rH.object({display:r8,plugin:rQ,queries:rH.array(ne).optional(),links:rH.array(nt).optional()});function nn(e){return rH.object({display:r8,plugin:e,queries:rH.array(ne).optional(),links:rH.array(nt).optional()})}let ni=rH.object({kind:rH.literal("Panel"),spec:nr});function na(e){return rH.object({kind:rH.literal("Panel"),spec:nn(e)})}let ns=rH.object({groupId:rH.number(),panelDefinition:ni});function no(e){return rH.object({groupId:rH.number(),panelDefinition:na(e)})}let nu=rH.object({actions:rH.array(rH.enum(["*","create","read","update","delete"])).nonempty("Must contains at least 1 action"),scopes:rH.array(rH.enum(["*","Dashboard","Datasource","EphemeralDashboard","Folder","GlobalDatasource","GlobalRole","GlobalRoleBinding","GlobalSecret","GlobalVariable","Project","Role","RoleBinding","Secret","User","Variable"])).nonempty("Must contains at least 1 scope")}),nl=rH.object({permissions:rH.array(nu)}),nc=rH.object({kind:rH.literal("Role"),metadata:rX,spec:nl}),nf=rH.object({kind:rH.literal("GlobalRole"),metadata:rY,spec:nl}),nd=rH.discriminatedUnion("kind",[nc,nf]),nh=rH.object({kind:rH.enum(["User"]),name:rJ}),np=rH.object({role:rJ,subjects:rH.array(nh).nonempty()}),nm=rH.object({kind:rH.literal("RoleBinding"),metadata:rX,spec:np}),ng=rH.object({kind:rH.literal("GlobalRoleBinding"),metadata:rY,spec:np}),ny=rH.discriminatedUnion("kind",[nm,ng]),nv=rH.object({basicAuth:rH.object({username:rH.string().min(1),password:rH.string().optional(),passwordFile:rH.string().optional()}).superRefine((e,t)=>{e.password&&e.password.length>0&&e.passwordFile&&e.passwordFile.length>0&&(t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["password"]}),t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["passwordFile"]}))}).optional(),authorization:rH.object({type:rH.string().optional(),credentials:rH.string().optional(),credentialsFile:rH.string().optional()}).superRefine((e,t)=>{e.credentials&&e.credentials.length>0&&e.credentialsFile&&e.credentialsFile.length>0&&(t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentials"]}),t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["credentialsFile"]}))}).optional(),oauth:rH.object({clientID:rH.string().min(1),clientSecret:rH.string().optional(),clientSecretFile:rH.string().optional(),tokenURL:rH.string().min(1),scopes:rH.array(rH.string().nonempty()).default([]),endpointParams:rH.record(rH.string().nonempty(),rH.array(rH.string())).default({}).optional(),authStyle:rH.union([rH.literal(0),rH.literal(1),rH.literal(2)]).optional()}).superRefine((e,t)=>{e.clientSecret&&e.clientSecret.length>0&&e.clientSecretFile&&e.clientSecretFile.length>0&&(t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecret"]}),t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["clientSecretFile"]}))}).optional(),tlsConfig:rH.object({ca:rH.string().optional(),cert:rH.string().optional(),key:rH.string().optional(),caFile:rH.string().optional(),certFile:rH.string().optional(),keyFile:rH.string().optional(),serverName:rH.string().optional(),insecureSkipVerify:rH.boolean().optional()}).superRefine((e,t)=>{e.ca&&e.ca.length>0&&e.caFile&&e.caFile.length>0&&(t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["ca"]}),t.addIssue({code:rH.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:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["cert"]}),t.addIssue({code:rH.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:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["key"]}),t.addIssue({code:rH.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:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["basicAuth"]}),t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["authorization"]}),t.addIssue({code:rH.ZodIssueCode.custom,message:"Only one of the fields must be defined",path:["oauth"]}))}),nb=rH.object({kind:rH.literal("Secret"),metadata:rX,spec:nv}),nw=rH.object({kind:rH.literal("GlobalSecret"),metadata:rY,spec:nv}),n_=rH.discriminatedUnion("kind",[nb,nw]),nx=rH.object({password:rH.string().optional()}),nN=rH.object({issuer:rH.string().optional(),email:rH.string().optional(),subject:rH.string().optional()}),nS=rH.object({firstName:rH.string().optional(),lastName:rH.string().optional(),nativeProvider:nx.optional(),oauthProviders:rH.array(nN).optional()}),nM=rH.object({kind:rH.literal("User"),metadata:rY,spec:nS}),nE=rH.object({name:rH.string().optional(),description:rH.string().optional(),hidden:rH.boolean().optional()}),nk=rH.object({name:rH.string().min(1),display:nE.optional(),defaultValue:rH.string().or(rH.array(rH.string())).optional(),allowAllValue:rH.boolean(),allowMultiple:rH.boolean(),customAllValue:rH.string().optional(),capturingRegexp:rH.string().optional(),sort:rH.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:rQ});function nO(e){return rH.object({name:rH.string().min(1),display:nE.optional(),defaultValue:rH.string().or(rH.array(rH.string())).optional(),allowAllValue:rH.boolean(),allowMultiple:rH.boolean(),customAllValue:rH.string().optional(),capturingRegexp:rH.string().optional(),sort:rH.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:e})}let nT=rH.object({kind:rH.literal("ListVariable"),spec:nk});function nA(e){return rH.object({kind:rH.literal("ListVariable"),spec:nO(e)})}let nC=rH.object({name:rH.string().min(1),display:nE.optional(),value:rH.string(),constant:rH.boolean().optional()}),nI=rH.object({kind:rH.literal("TextVariable"),spec:nC}),nD=rH.discriminatedUnion("kind",[nI,nT]);function nj(e){return rH.union([nI,nA(e)])}let nF=rH.object({kind:rH.literal("Variable"),metadata:rX,spec:nD}),nR=rH.object({kind:rH.literal("GlobalVariable"),metadata:rX,spec:nD}),nP=rH.discriminatedUnion("kind",[nF,nR]),nZ=nD;function nz(e){return rH.discriminatedUnion("kind",[rH.object({kind:rH.literal("ListVariable"),spec:nO(e)}),rH.object({kind:rH.literal("TextVariable"),spec:nC})])}async function nB(...e){let t=await globalThis.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.clone().json();if(e.error)throw new nU(e.error,t.status);if(e.message)throw new nU(e.message,t.status)}let r=await t.clone().text();if(r)throw new nU(r,t.status);throw new nL(t)}return t}async function n$(...e){let t=await nB(...e);if(!t.ok)throw new nL(t);return await t.json()}class nL extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,nL.prototype)}}class nU extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,nU.prototype)}}function nV(e){return 0===Object.getOwnPropertyNames(e).length}function nq(e,t){let r=nG(t),n=e.panels[r];if(void 0===n)throw Error(`Could not resolve panels reference ${t.$ref}`);return n}function nG(e){return e.$ref.substring(14)}function nW(e){return{$ref:`#/spec/panels/${e}`}}function nK(e){return e.spec.spec?.display?.name?e.spec.spec.display.name:e.spec.display?.name?e.spec.display.name:e.metadata.name}function nH(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 nJ=r(8102);function nY(e){return"number"==typeof e}function nX(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 nQ(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function n0(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function n1(e){return e&&!0===e.constructor.prototype.isUnit||!1}function n2(e){return"string"==typeof e}var n4=Array.isArray;function n9(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function n5(e){return Array.isArray(e)||n9(e)}function n3(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function n7(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function n6(e){return e&&!0===e.constructor.prototype.isRange||!1}function n8(e){return e&&!0===e.constructor.prototype.isIndex||!1}function ie(e){return"boolean"==typeof e}function it(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function ir(e){return e&&!0===e.constructor.prototype.isHelp||!1}function ii(e){return"function"==typeof e}function ia(e){return e instanceof Date}function is(e){return e instanceof RegExp}function io(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!nQ(e)&&!n0(e))}function iu(e){return null===e}function il(e){return void 0===e}function ic(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function id(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function ih(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function ip(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 ig(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function iy(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function iv(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function ib(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function iw(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function i_(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function ix(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function iN(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function iS(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function iM(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function iE(e){return e&&!0===e.constructor.prototype.isChain||!1}function ik(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":nX(e)?"BigNumber":nQ(e)?"Complex":n0(e)?"Fraction":n9(e)?"Matrix":n1(e)?"Unit":n8(e)?"Index":n6(e)?"Range":it(e)?"ResultSet":iw(e)?e.type:iE(e)?"Chain":ir(e)?"Help":"Object":"function"===t?"Function":t}function iO(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 iO(e)});if(e instanceof Date)return new Date(e.valueOf());if(nX(e))return e;if(e instanceof RegExp)throw TypeError("Cannot clone "+e);return iT(e,iO)}function iT(e,t){var r={};for(var n in e)iI(e,n)&&(r[n]=t(e[n]));return r}function iA(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(!iA(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)||!iA(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function iC(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 iI(e,t){return e&&Object.hasOwnProperty.call(e,t)}function iD(e){return Object.keys(e).map(t=>e[t])}var ij=r(3420);function iF(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(iP));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 iR(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function iP(e){return e&&"?"===e[0]?e.slice(1):e}function iZ(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function iz(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!iZ(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(!iZ(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 iB(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),nY(t)?r=t:nY(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=i$(e),n="number"==typeof t?iU(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,s=a+(t||0);return i.length<s&&(i=i.concat(iV(s-i.length))),a<0&&(i=iV(-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 iL(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=iU(i$(e),t),n=r.exponent,i=r.coefficients,a=n%3==0?n:n<0?n-3-n%3:n-n%3;if(nY(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),l=1;u>0;)l++,u--;var c=i.slice(l).join(""),f=nY(t)&&c.length||c.match(/[1-9]/)?"."+c:"",d=i.slice(0,l).join("")+f+"e"+(n>=0?"+":"")+a.toString();return r.sign+d}(e,r);case"bin":return iz(e,2,n);case"oct":return iz(e,8,n);case"hex":return iz(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=i$(e),s=t?iU(a,t):a;if(s.exponent<n||s.exponent>=i)return iL(e,t);var o=s.coefficients,u=s.exponent;o.length<t&&(o=o.concat(iV(t-o.length))),o=o.concat(iV(u-o.length+1+(o.length<t?t-o.length:0))),o=iV(-u).concat(o);var l=u>0?u:0;return l<o.length-1&&o.splice(l+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 i$(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 iL(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=i$(e),n=t?iU(r,t):r,i=n.coefficients,a=n.exponent;i.length<t&&(i=i.concat(iV(t-i.length)));var s=i.shift();return n.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function iU(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 iV(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var iq=Number.EPSILON||2220446049250313e-31;function iG(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<iq||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function iW(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(!iZ(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 iK(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function iH(e,t){var r=function(e,t){var r;if("number"==typeof e)return iB(e,t);if(nX(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 iK(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!==(c=(l=a.mul(Math.pow(10,-u))).toPrecision(s)).indexOf("e")&&(c=l.toString()),c+"e"+(o>=0?"+":"")+u.toString();case"bin":return iW(e,2,d);case"oct":return iW(e,8,d);case"hex":return iW(e,16,d);case"auto":var n,i,a,s,o,u,l,c,f,d,h=t&&void 0!==t.lowerExp?t.lowerExp:-3,p=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var m=e.toSignificantDigits(f),g=m.e;return(g>=h&&g<p?m.toFixed():iK(e,f)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,r){if(!Array.isArray(t))return iH(t,r);for(var n="[",i=t.length,a=0;a<i;a++)0!==a&&(n+=", "),n+=e(t[a],r);return n+"]"}(e,t);if(n2(e))return'"'+e+'"';if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>'"'+r+'": '+iH(e[r],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function iJ(e,t,r){if(!(this instanceof iJ))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 iY(e,t,r){if(!(this instanceof iY))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 iX(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function iQ(e,t){if(0===t.length){if(Array.isArray(e))throw new iJ(e.length,0)}else!function e(t,r,n){var i,a=t.length;if(a!==r[n])throw new iJ(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 iJ(r.length-1,r.length,"<");e(t[i],r,s)}}else for(i=0;i<a;i++)if(Array.isArray(t[i]))throw new iJ(r.length+1,r.length,">")}(e,t,0)}function i0(e,t){if(!nY(e)||!iZ(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new iY(e,t)}function i1(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(!nY(e)||!iZ(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+iH(t)+")")}),function e(t,r,n,i){var a,s,o=t.length,u=r[n],l=Math.min(o,u);if(t.length=u,n<r.length-1){var c=n+1;for(a=0;a<l;a++)Array.isArray(s=t[a])||(s=[s],t[a]=s),e(s,r,c,i);for(a=l;a<u;a++)s=[],t[a]=s,e(s,r,c,i)}else{for(a=0;a<l;a++)for(;Array.isArray(t[a]);)t[a]=t[a][0];for(a=l;a<u;a++)t[a]=i}}(e,t,0,void 0!==r?r:0),e}function i2(e,t){var r=i4(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 i4(e){return e.reduce((e,t)=>e*t,1)}function i9(e,t,r,n){var i=n||iX(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 i5(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?i5(a,t):t(a);if(void 0===r)r=o;else if(r!==o)return"mixed"}return r}function i3(e,t){return -1!==e.indexOf(t)}function i7(e,t,r,n){if(!(this instanceof i7))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}iJ.prototype=RangeError(),iJ.prototype.constructor=RangeError,iJ.prototype.name="DimensionError",iJ.prototype.isDimensionError=!0,iY.prototype=RangeError(),iY.prototype.constructor=RangeError,iY.prototype.name="IndexError",iY.prototype.isIndexError=!0,i7.prototype=Error(),i7.prototype.constructor=Error,i7.prototype.name="ArgumentsError",i7.prototype.isArgumentsError=!0;var i6={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},i8=["Matrix","Array"],ae=["number","BigNumber","Fraction"];function at(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 ar,an,ai,aa,as,ao,au,al,ac,af,ad,ah,ap,am,ag,ay,av,ab,aw,a_,ax="0123456789abcdef",aN="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",aS="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",aM={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},aE=!0,ak="[DecimalError] ",aO=ak+"Invalid argument: ",aT=ak+"Precision limit exceeded",aA=ak+"crypto unavailable",aC="[object Decimal]",aI=Math.floor,aD=Math.pow,aj=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,aF=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,aR=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,aP=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,aZ=aN.length-1,az=aS.length-1,aB={toStringTag:aC};function a$(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+=aX(r)),a+=n;(r=7-(n=(s=e[t])+"").length)&&(a+=aX(r))}else if(0===s)return"0";for(;s%10==0;)s/=10;return a+s}function aL(e,t,r){if(e!==~~e||e<t||e>r)throw Error(aO+e)}function aU(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=aD(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)==aD(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)==aD(10,t-3)-1,s}function aV(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]+=ax.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()}aB.absoluteValue=aB.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),aG(e)},aB.ceil=function(){return aG(new this.constructor(this),this.e+1,2)},aB.clampedTo=aB.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(aO+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},aB.comparedTo=aB.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},aB.cosine=aB.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/a7(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=a3(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,a6(n,r)),n.precision=e,n.rounding=t,aG(2==a_||3==a_?r.neg():r,e,t,!0)):new n(1):new n(NaN)},aB.cubeRoot=aB.cbrt=function(){var e,t,r,n,i,a,s,o,u,l,c=this.constructor;if(!this.isFinite()||this.isZero())return new c(this);for(aE=!1,(a=this.s*aD(this.s*this,1/3))&&Math.abs(a)!=1/0?n=new c(a.toString()):(r=a$(this.d),(a=((e=this.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=aD(r,1/3),e=aI((e+1)/3)-(e%3==(e<0?-1:2)),(n=new c(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),s=(e=c.precision)+3;;)if(n=aq((l=(u=(o=n).times(o).times(o)).plus(this)).plus(this).times(o),l.plus(u),s+2,1),a$(o.d).slice(0,s)===(r=a$(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))||(aG(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(aG(o,e+1,0),o.times(o).times(o).eq(this))){n=o;break}s+=4,i=1}return aE=!0,aG(n,e,c.rounding,t)},aB.decimalPlaces=aB.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-aI(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},aB.dividedBy=aB.div=function(e){return aq(this,new this.constructor(e))},aB.dividedToIntegerBy=aB.divToInt=function(e){var t=this.constructor;return aG(aq(this,new t(e),0,1,1),t.precision,t.rounding)},aB.equals=aB.eq=function(e){return 0===this.cmp(e)},aB.floor=function(){return aG(new this.constructor(this),this.e+1,3)},aB.greaterThan=aB.gt=function(e){return this.cmp(e)>0},aB.greaterThanOrEqualTo=aB.gte=function(e){var t=this.cmp(e);return 1==t||0===t},aB.hyperbolicCosine=aB.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/a7(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=a3(s,1,a.times(t),new s(1),!0);for(var u,l=e,c=new s(8);l--;)u=a.times(a),a=o.minus(u.times(c.minus(u.times(c))));return aG(a,s.precision=r,s.rounding=n,!0)},aB.hyperbolicSine=aB.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=a3(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=a3(a,2,i=i.times(1/a7(5,e)),i,!0);for(var s,o=new a(5),u=new a(16),l=new a(20);e--;)s=i.times(i),i=i.times(o.plus(s.times(u.times(s).plus(l))))}return a.precision=t,a.rounding=r,aG(i,t,r,!0)},aB.hyperbolicTangent=aB.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,aq(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},aB.inverseCosine=aB.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()?aJ(t,n,i):new t(0):new t(NaN):e.isZero()?aJ(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))},aB.inverseHyperbolicCosine=aB.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,aE=!1,r=r.times(r).minus(1).sqrt().plus(r),aE=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},aB.inverseHyperbolicSine=aB.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,aE=!1,r=r.times(r).plus(1).sqrt().plus(r),aE=!0,n.precision=e,n.rounding=t,r.ln())},aB.inverseHyperbolicTangent=aB.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)?aG(new a(i),e,t,!0):(a.precision=r=n-i.e,i=aq(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)},aB.inverseSine=aB.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=aJ(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))},aB.inverseTangent=aB.atan=function(){var e,t,r,n,i,a,s,o,u,l=this,c=l.constructor,f=c.precision,d=c.rounding;if(l.isFinite()){if(l.isZero())return new c(l);else if(l.abs().eq(1)&&f+4<=az)return(s=aJ(c,f+4,d).times(.25)).s=l.s,s}else{if(!l.s)return new c(NaN);if(f+4<=az)return(s=aJ(c,f+4,d).times(.5)).s=l.s,s}for(c.precision=o=f+10,c.rounding=1,e=r=Math.min(28,o/7+2|0);e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(aE=!1,t=Math.ceil(o/7),n=1,u=l.times(l),s=new c(l),i=l;-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)),aE=!0,aG(s,c.precision=f,c.rounding=d,!0)},aB.isFinite=function(){return!!this.d},aB.isInteger=aB.isInt=function(){return!!this.d&&aI(this.e/7)>this.d.length-2},aB.isNaN=function(){return!this.s},aB.isNegative=aB.isNeg=function(){return this.s<0},aB.isPositive=aB.isPos=function(){return this.s>0},aB.isZero=function(){return!!this.d&&0===this.d[0]},aB.lessThan=aB.lt=function(e){return 0>this.cmp(e)},aB.lessThanOrEqualTo=aB.lte=function(e){return 1>this.cmp(e)},aB.logarithm=aB.log=function(e){var t,r,n,i,a,s,o,u=this.constructor,l=u.precision,c=u.rounding;if(null==e)e=new u(10),t=!0;else{if(r=(e=new u(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new u(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(n=r[0];n%10==0;)n/=10;i=1!==n}if(aE=!1,aU((o=aq(a=a4(this,s=l+5),t?aH(u,s+10):a4(e,s),s,1)).d,n=l,c))do if(s+=10,o=aq(a=a4(this,s),t?aH(u,s+10):a4(e,s),s,1),!i){+a$(o.d).slice(n+1,n+15)+1==1e14&&(o=aG(o,l+1,0));break}while(aU(o.d,n+=10,c));return aE=!0,aG(o,l,c)},aB.minus=aB.sub=function(e){var t,r,n,i,a,s,o,u,l,c,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(l=this.d,d=e.d,o=h.precision,u=h.rounding,!l[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!l[0])return new h(3===u?-0:0);e=new h(this)}return aE?aG(e,o,u):e}if(r=aI(e.e/7),c=aI(this.e/7),l=l.slice(),a=c-r){for((f=a<0)?(t=l,a=-a,s=d.length):(t=d,r=c,s=l.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=l.length)<(s=d.length))&&(s=n),n=0;n<s;n++)if(l[n]!=d[n]){f=l[n]<d[n];break}a=0}for(f&&(t=l,l=d,d=t,e.s=-e.s),s=l.length,n=d.length-s;n>0;--n)l[s++]=0;for(n=d.length;n>a;){if(l[--n]<d[n]){for(i=n;i&&0===l[--i];)l[i]=1e7-1;--l[i],l[n]+=1e7}l[n]-=d[n]}for(;0===l[--s];)l.pop();for(;0===l[0];l.shift())--r;return l[0]?(e.d=l,e.e=aK(l,r),aE?aG(e,o,u):e):new h(3===u?-0:0)},aB.modulo=aB.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])?(aE=!1,9==r.modulo?(t=aq(this,e.abs(),0,3,1),t.s*=e.s):t=aq(this,e,0,r.modulo,1),t=t.times(e),aE=!0,this.minus(t)):aG(new r(this),r.precision,r.rounding):new r(NaN)},aB.naturalExponential=aB.exp=function(){return a2(this)},aB.naturalLogarithm=aB.ln=function(){return a4(this)},aB.negated=aB.neg=function(){var e=new this.constructor(this);return e.s=-e.s,aG(e)},aB.plus=aB.add=function(e){var t,r,n,i,a,s,o,u,l,c,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(l=this.d,c=e.d,o=f.precision,u=f.rounding,!l[0]||!c[0])return c[0]||(e=new f(this)),aE?aG(e,o,u):e;if(a=aI(this.e/7),n=aI(e.e/7),l=l.slice(),i=a-n){for(i<0?(r=l,i=-i,s=c.length):(r=c,n=a,s=l.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=l.length)-(i=c.length)<0&&(i=s,r=c,c=l,l=r),t=0;i;)t=(l[--i]=l[i]+c[i]+t)/1e7|0,l[i]%=1e7;for(t&&(l.unshift(t),++n),s=l.length;0==l[--s];)l.pop();return e.d=l,e.e=aK(l,n),aE?aG(e,o,u):e},aB.precision=aB.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(aO+e);return this.d?(t=aY(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},aB.round=function(){var e=this.constructor;return aG(new e(this),this.e+1,e.rounding)},aB.sine=aB.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:a3(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=a3(e,2,t=t.times(1/a7(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,a6(n,r)),n.precision=e,n.rounding=t,aG(a_>2?r.neg():r,e,t,!0)):new n(NaN)},aB.squareRoot=aB.sqrt=function(){var e,t,r,n,i,a,s=this.d,o=this.e,u=this.s,l=this.constructor;if(1!==u||!s||!s[0])return new l(!u||u<0&&(!s||s[0])?NaN:s?this:1/0);for(aE=!1,0==(u=Math.sqrt(+this))||u==1/0?(((t=a$(s)).length+o)%2==0&&(t+="0"),u=Math.sqrt(t),o=aI((o+1)/2)-(o<0||o%2),n=new l(t=u==1/0?"5e"+o:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+o)):n=new l(u.toString()),r=(o=l.precision)+3;;)if(n=(a=n).plus(aq(this,a,r+2,1)).times(.5),a$(a.d).slice(0,r)===(t=a$(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))||(aG(n,o+1,1),e=!n.times(n).eq(this));break}if(!i&&(aG(a,o+1,0),a.times(a).eq(this))){n=a;break}r+=4,i=1}return aE=!0,aG(n,o,l.rounding,e)},aB.tangent=aB.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=aq(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,aG(2==a_||4==a_?r.neg():r,e,t,!0)):new n(NaN)},aB.times=aB.mul=function(e){var t,r,n,i,a,s,o,u,l,c=this.constructor,f=this.d,d=(e=new c(e)).d;if(e.s*=this.s,!f||!f[0]||!d||!d[0])return new c(!e.s||f&&!f[0]&&!d||d&&!d[0]&&!f?NaN:!f||!d?e.s/0:0*e.s);for(r=aI(this.e/7)+aI(e.e/7),(u=f.length)<(l=d.length)&&(a=f,f=d,d=a,s=u,u=l,l=s),a=[],n=s=u+l;n--;)a.push(0);for(n=l;--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=aK(a,r),aE?aG(e,c.precision,c.rounding):e},aB.toBinary=function(e,t){return a8(this,2,e,t)},aB.toDecimalPlaces=aB.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(aL(e,0,1e9),void 0===t?t=n.rounding:aL(t,0,8),aG(r,e+r.e+1,t))},aB.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=aW(n,!0):(aL(e,0,1e9),void 0===t?t=i.rounding:aL(t,0,8),r=aW(n=aG(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},aB.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=aW(this):(aL(e,0,1e9),void 0===t?t=i.rounding:aL(t,0,8),r=aW(n=aG(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},aB.toFraction=function(e){var t,r,n,i,a,s,o,u,l,c,f,d,h=this.d,p=this.constructor;if(!h)return new p(this);if(l=r=new p(1),n=u=new p(0),s=(a=(t=new p(n)).e=aY(h)-this.e-1)%7,t.d[0]=aD(10,s<0?7+s:s),null==e)e=a>0?t:l;else{if(!(o=new p(e)).isInt()||o.lt(l))throw Error(aO+o);e=o.gt(t)?a>0?t:l:o}for(aE=!1,o=new p(a$(h)),c=p.precision,p.precision=a=7*h.length*2;f=aq(o,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=l,l=u.plus(f.times(i)),u=i,i=t,t=o.minus(f.times(i)),o=i;return i=aq(e.minus(r),n,0,1,1),u=u.plus(i.times(l)),r=r.plus(i.times(n)),u.s=l.s=this.s,d=1>aq(l,n,a,1).minus(this).abs().cmp(aq(u,r,a,1).minus(this).abs())?[l,n]:[u,r],p.precision=c,aE=!0,d},aB.toHexadecimal=aB.toHex=function(e,t){return a8(this,16,e,t)},aB.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:aL(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]?(aE=!1,r=aq(r,e,0,t,1).times(e),aE=!0,aG(r)):(e.s=r.s,r=e),r},aB.toNumber=function(){return+this},aB.toOctal=function(e,t){return a8(this,8,e,t)},aB.toPower=aB.pow=function(e){var t,r,n,i,a,s,o=this,u=o.constructor,l=+(e=new u(e));if(!o.d||!e.d||!o.d[0]||!e.d[0])return new u(aD(+o,l));if((o=new u(o)).eq(1))return o;if(n=u.precision,a=u.rounding,e.eq(1))return aG(o,n,a);if((t=aI(e.e/7))>=e.d.length-1&&(r=l<0?-l:l)<=0x1fffffffffffff)return i=aQ(u,o,r,n),e.s<0?new u(1).div(i):aG(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=aD(+o,l))&&isFinite(r)?new u(r+"").e:aI(l*(Math.log("0."+a$(o.d))/Math.LN10+o.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?s/0:0):(aE=!1,u.rounding=o.s=1,r=Math.min(12,(t+"").length),(i=a2(e.times(a4(o,n+r)),n)).d&&aU((i=aG(i,n+5,1)).d,n,a)&&(t=n+10,+a$((i=aG(a2(e.times(a4(o,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=aG(i,n+1,0))),i.s=s,aE=!0,u.rounding=a,aG(i,n,a))},aB.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=aW(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(aL(e,1,1e9),void 0===t?t=i.rounding:aL(t,0,8),r=aW(n=aG(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},aB.toSignificantDigits=aB.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(aL(e,1,1e9),void 0===t?t=r.rounding:aL(t,0,8)),aG(new r(this),e,t)},aB.toString=function(){var e=this.constructor,t=aW(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},aB.truncated=aB.trunc=function(){return aG(new this.constructor(this),this.e+1,1)},aB.valueOf=aB.toJSON=function(){var e=this.constructor,t=aW(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var aq=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 l,c,f,d,h,p,m,g,y,v,b,w,_,x,N,S,M,E,k,O,T=n.constructor,A=n.s==i.s?1:-1,C=n.d,I=i.d;if(!C||!C[0]||!I||!I[0])return new T(!n.s||!i.s||(C?I&&C[0]==I[0]:!I)?NaN:C&&0==C[0]||!I?0*A:A/0);for(u?(h=1,c=n.e-i.e):(u=1e7,h=7,c=aI(n.e/h)-aI(i.e/h)),k=I.length,M=C.length,v=(y=new T(A)).d=[],f=0;I[f]==(C[f]||0);f++);if(I[f]>(C[f]||0)&&c--,null==a?(x=a=T.precision,s=T.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,I=I[0],x++;(f<M||d)&&x--;f++)N=d*u+(C[f]||0),v[f]=N/I|0,d=N%I|0;p=d||f<M}else{for((d=u/(I[0]+1)|0)>1&&(I=e(I,d,u),C=e(C,d,u),k=I.length,M=C.length),S=k,w=(b=C.slice(0,k)).length;w<k;)b[w++]=0;(O=I.slice()).unshift(0),E=I[0],I[1]>=u/2&&++E;do d=0,(l=t(I,b,k,w))<0?(_=b[0],k!=w&&(_=_*u+(b[1]||0)),(d=_/E|0)>1?(d>=u&&(d=u-1),g=(m=e(I,d,u)).length,w=b.length,1==(l=t(m,b,g,w))&&(d--,r(m,k<g?O:I,g,u))):(0==d&&(l=d=1),m=I.slice()),(g=m.length)<w&&m.unshift(0),r(b,m,w,u),-1==l&&(w=b.length,(l=t(I,b,k,w))<1&&(d++,r(b,k<w?O:I,w,u))),w=b.length):0===l&&(d++,b=[0]),v[f++]=d,l&&b[0]?b[w++]=C[S]||0:(b=[C[S]],w=1);while((S++<M||void 0!==b[0])&&x--);p=void 0!==b[0]}v[0]||v.shift()}if(1==h)y.e=c,aw=p;else{for(f=1,d=v[0];d>=10;d/=10)f++;y.e=f+c*h-1,aG(y,o?a+y.e+1:a,s,p)}return y}}();function aG(e,t,r,n){var i,a,s,o,u,l,c,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=(c=f[d=0])/aD(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);c=u=0,i=1,a%=7,s=a-7+1}else break e;else{for(i=1,c=o=f[d];o>=10;o/=10)i++;a%=7,u=(s=a-7+i)<0?0:c/aD(10,i-s-1)%10|0}if(n=n||t<0||void 0!==f[d+1]||(s<0?c:c%aD(10,i-s-1)),l=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?c/aD(10,i-s):0:f[d-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,l?(t-=e.e+1,f[0]=aD(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=aD(10,7-a),f[d]=s>0?(c/aD(10,i-s)%aD(10,s)|0)*o:0),l)for(;;)if(0==d){for(a=1,s=f[0];s>=10;s/=10)a++;for(s=f[0]+=o,o=1;s>=10;s/=10)o++;a!=o&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[d]+=o,1e7!=f[d])break;f[d--]=0,o=1}for(a=f.length;0===f[--a];)f.pop()}return aE&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e<h.minE&&(e.e=0,e.d=[0])),e}function aW(e,t,r){if(!e.isFinite())return a9(e);var n,i=e.e,a=a$(e.d),s=a.length;return t?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+aX(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+aX(-i-1)+a,r&&(n=r-s)>0&&(a+=aX(n))):i>=s?(a+=aX(i+1-s),r&&(n=r-i-1)>0&&(a=a+"."+aX(n))):((n=i+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(i+1===s&&(a+="."),a+=aX(n))),a}function aK(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function aH(e,t,r){if(t>aZ)throw aE=!0,r&&(e.precision=r),Error(aT);return aG(new e(aN),t,1,!0)}function aJ(e,t,r){if(t>az)throw Error(aT);return aG(new e(aS),t,r,!0)}function aY(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 aX(e){for(var t="";e--;)t+="0";return t}function aQ(e,t,r,n){var i,a=new e(1),s=Math.ceil(n/7+4);for(aE=!1;;){if(r%2&&se((a=a.times(t)).d,s)&&(i=!0),0===(r=aI(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}se((t=t.times(t)).d,s)}return aE=!0,a}function a0(e){return 1&e.d[e.d.length-1]}function a1(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 a2(e,t){var r,n,i,a,s,o,u,l=0,c=0,f=0,d=e.constructor,h=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(aE=!1,u=p):u=t,o=new d(.03125);e.e>-2;)e=e.times(o),f+=5;for(u+=n=Math.log(aD(2,f))/Math.LN10*2+5|0,r=a=s=new d(1),d.precision=u;;){if(a=aG(a.times(e),u,1),r=r.times(++c),a$((o=s.plus(aq(a,r,u,1))).d).slice(0,u)===a$(s.d).slice(0,u)){for(i=f;i--;)s=aG(s.times(s),u,1);if(null!=t)return d.precision=p,s;if(!(l<3&&aU(s.d,u-n,h,l)))return aG(s,d.precision=p,h,aE=!0);d.precision=u+=10,r=a=o=new d(1),c=0,l++}s=o}}function a4(e,t){var r,n,i,a,s,o,u,l,c,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?(aE=!1,c=v):c=t,g.precision=c+=10,n=(r=a$(m)).charAt(0),!(15e14>Math.abs(a=p.e)))return l=aH(g,c+2,v).times(a+""),p=a4(new g(n+"."+r.slice(1)),c-10).plus(l),g.precision=v,null==t?aG(p,v,y,aE=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=a$((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=aq(p.minus(1),p.plus(1),c,1),d=aG(p.times(p),c,1),i=3;;){if(s=aG(s.times(d),c,1),a$((l=u.plus(aq(s,new g(i),c,1))).d).slice(0,c)===a$(u.d).slice(0,c)){if(u=u.times(2),0!==a&&(u=u.plus(aH(g,c+2,v).times(a+""))),u=aq(u,new g(h),c,1),null!=t)return g.precision=v,u;if(!aU(u.d,c-10,y,o))return aG(u,g.precision=v,y,aE=!0);g.precision=c+=10,l=s=p=aq(f.minus(1),f.plus(1),c,1),d=aG(p.times(p),c,1),i=o=1}u=l,i+=2}}function a9(e){return String(e.s*e.s/0)}function a5(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),aE&&(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 a3(e,t,r,n,i){var a,s,o,u,l=e.precision,c=Math.ceil(l/7);for(aE=!1,u=r.times(r),o=new e(n);;){if(s=aq(o.times(u),new e(t++*t++),l,1),o=i?n.plus(s):n.minus(s),n=aq(s.times(u),new e(t++*t++),l,1),void 0!==(s=o.plus(n)).d[c]){for(a=c;s.d[a]===o.d[a]&&a--;);if(-1==a)break}a=o,o=n,n=s,s=a}return aE=!0,s.d.length=c+1,s}function a7(e,t){for(var r=e;--t;)r*=e;return r}function a6(e,t){var r,n=t.s<0,i=aJ(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return a_=n?4:1,t;if((r=t.divToInt(i)).isZero())a_=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return a_=a0(r)?n?2:3:n?4:1,t;a_=a0(r)?n?1:4:n?3:2}return t.minus(i).abs()}function a8(e,t,r,n){var i,a,s,o,u,l,c,f,d,h=e.constructor,p=void 0!==r;if(p?(aL(r,1,1e9),void 0===n?n=h.rounding:aL(n,0,8)):(r=h.precision,n=h.rounding),e.isFinite()){for(s=(c=aW(e)).indexOf("."),p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,s>=0&&(c=c.replace(".",""),(d=new h(1)).e=c.length-s,d.d=aV(aW(d),10,i),d.e=d.d.length),a=u=(f=aV(c,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=aq(e,d,r,n,0,i)).d,a=e.e,l=aw),s=f[r],o=i/2,l=l||void 0!==f[r+1],l=n<4?(void 0!==s||l)&&(0===n||n===(e.s<0?3:2)):s>o||s===o&&(4===n||l||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,l)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(s=0,c="";s<u;s++)c+=ax.charAt(f[s]);if(p){if(u>1)if(16==t||8==t){for(s=16==t?4:3,--u;u%s;u++)c+="0";for(u=(f=aV(c,i,t)).length;!f[u-1];--u);for(s=1,c="1.";s<u;s++)c+=ax.charAt(f[s])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>u)for(a-=u;a--;)c+="0";else a<u&&(c=c.slice(0,a)+"."+c.slice(a))}else c=p?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=a9(e);return e.s<0?"-"+c:c}function se(e,t){if(e.length>t)return e.length=t,!0}function st(e){return new this(e).abs()}function sr(e){return new this(e).acos()}function sn(e){return new this(e).acosh()}function si(e,t){return new this(e).plus(t)}function sa(e){return new this(e).asin()}function ss(e){return new this(e).asinh()}function so(e){return new this(e).atan()}function su(e){return new this(e).atanh()}function sl(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?aJ(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=aJ(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(aq(e,t,a,1)),t=aJ(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(aq(e,t,a,1)):(r=aJ(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function sc(e){return new this(e).cbrt()}function sf(e){return aG(e=new this(e),e.e+1,2)}function sd(e,t,r){return new this(e).clamp(t,r)}function sh(e){if(!e||"object"!=typeof e)throw Error(ak+"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]=aM[r]),void 0!==(n=e[r]))if(aI(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(aO+r+": "+n);if(r="crypto",i&&(this[r]=aM[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(aA);else this[r]=!1;else throw Error(aO+r+": "+n);return this}function sp(e){return new this(e).cos()}function sm(e){return new this(e).cosh()}function sg(e,t){return new this(e).div(t)}function sy(e){return new this(e).exp()}function sv(e){return aG(e=new this(e),e.e+1,3)}function sb(){var e,t,r=new this(0);for(e=0,aE=!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 aE=!0,new this(1/0);r=t}return aE=!0,r.sqrt()}function sw(e){return e instanceof s$||e&&e.toStringTag===aC||!1}function s_(e){return new this(e).ln()}function sx(e,t){return new this(e).log(t)}function sN(e){return new this(e).log(2)}function sS(e){return new this(e).log(10)}function sM(){return a1(this,arguments,-1)}function sE(){return a1(this,arguments,1)}function sk(e,t){return new this(e).mod(t)}function sO(e,t){return new this(e).mul(t)}function sT(e,t){return new this(e).pow(t)}function sA(e){var t,r,n,i,a=0,s=new this(1),o=[];if(void 0===e?e=this.precision:aL(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(aA);else for(;a<n;)o[a++]=1e7*Math.random()|0;for(n=o[--a],e%=7,n&&e&&(i=aD(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 sC(e){return aG(e=new this(e),e.e+1,this.rounding)}function sI(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sD(e){return new this(e).sin()}function sj(e){return new this(e).sinh()}function sF(e){return new this(e).sqrt()}function sR(e,t){return new this(e).sub(t)}function sP(){var e=0,t=arguments,r=new this(t[0]);for(aE=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return aE=!0,aG(r,this.precision,this.rounding)}function sZ(e){return new this(e).tan()}function sz(e){return new this(e).tanh()}function sB(e){return aG(e=new this(e),e.e+1,1)}aB[Symbol.for("nodejs.util.inspect.custom")]=aB.toString,aB[Symbol.toStringTag]="Decimal";var s$=aB.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,sw(e)){this.s=e.s,aE?!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++;aE?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 a5(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),aP.test(e)?a5(this,e):function(e,t){var r,n,i,a,s,o,u,l,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),aP.test(t))return a5(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(aF.test(t))r=16,t=t.toLowerCase();else if(aj.test(t))r=2;else if(aR.test(t))r=8;else throw Error(aO+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=aQ(n,new n(r),a,2*a)),a=c=(l=aV(t,r,1e7)).length-1;0===l[a];--a)l.pop();return a<0?new n(0*e.s):(e.e=aK(l,c),e.d=l,aE=!1,s&&(e=aq(e,i,4*o)),u&&(e=e.times(54>Math.abs(u)?aD(2,u):s$.pow(2,u))),aE=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,a5(this,e.toString());throw Error(aO+e)}if(a.prototype=aB,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=sh,a.clone=e,a.isDecimal=sw,a.abs=st,a.acos=sr,a.acosh=sn,a.add=si,a.asin=sa,a.asinh=ss,a.atan=so,a.atanh=su,a.atan2=sl,a.cbrt=sc,a.ceil=sf,a.clamp=sd,a.cos=sp,a.cosh=sm,a.div=sg,a.exp=sy,a.floor=sv,a.hypot=sb,a.ln=s_,a.log=sx,a.log10=sS,a.log2=sN,a.max=sM,a.min=sE,a.mod=sk,a.mul=sO,a.pow=sT,a.random=sA,a.round=sC,a.sign=sI,a.sin=sD,a.sinh=sj,a.sqrt=sF,a.sub=sR,a.sum=sP,a.tan=sZ,a.tanh=sz,a.trunc=sB,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}(aM);aN=new s$(aN),aS=new s$(aS);var sL={createBigNumberClass:iF("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=s$.clone({precision:r.precision,modulo:s$.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})},sU={createMatrixClass:iF("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})},sV={MatrixDependencies:sU,createDenseMatrixClass:iF("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&&!n2(t))throw Error("Invalid datatype: "+t);if(n9(e))"DenseMatrix"===e.type?(this._data=iO(e._data),this._size=iO(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&n4(e.data)&&n4(e.size))this._data=e.data,this._size=e.size,iQ(this._data,this._size),this._datatype=t||e.datatype;else if(n4(e))this._data=function e(t){for(var r=0,n=t.length;r<n;r++){var i=t[r];n4(i)?t[r]=e(i):i&&!0===i.isMatrix&&(t[r]=e(i.valueOf()))}return t}(e),this._size=iX(this._data),iQ(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+ik(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;n4(n);)n=n[0];return n}return e._size=t.slice(0),e._data=i1(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 i5(this._data,ik)},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(!n8(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 iJ(n.length,e._size.length);for(var i=t.min(),a=t.max(),s=0,o=e._size.length;s<o;s++)i0(i[s],e._size[s]),i0(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 i0(e,t.length),t[e]}).valueOf():s.map(function(a){return i0(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(n9(r)?(a=r.size(),r=r.valueOf()):a=iX(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 iJ(s.length,e._size.length,"<");if(a.length<s.length){for(var u=0,l=0;1===s[u]&&1===a[u];)u++;for(;1===s[u];)l++,u++;r=i9(r,s.length,l,a)}if(!iA(s,a))throw new iJ(s,a,">");i(e,t.max().map(function(e){return e+1}),n);var c=s.length;!function e(t,r,n,i,a){var s=a===i-1,o=r.dimension(a);s?o.forEach(function(e,r){i0(e),t[e]=n[r[0]]}):o.forEach(function(s,o){i0(s),e(t[s],r,n[o[0]],i,a+1)})}(e._data,t,r,c,0)}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!n4(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iJ(e.length,this._size.length);for(var t=0;t<e.length;t++)i0(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var a=e[n];i0(a,r.length),r=r[a]}return r},r.prototype.set=function(e,t,r){if(!n4(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new iJ(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++)i0(s=e[n],o.length),o=o[s];return i0(s=e[e.length-1],o.length),o[s]=t,this},r.prototype.resize=function(e,t,r){if(!n5(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 iJ(0,n,"!=");var i=i4(t=i2(t,n));if(n!==i)throw new iJ(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 iJ)throw new iJ(i,n,"!=");throw e}}(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=i2(e,n),r},r.prototype.clone=function(){return new r({data:iO(this._data),size:iO(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 n4(n)?n.map(function(e,t){return r(e,i.concat(t))}):e(n,i,t)}(this._data,[]),i=void 0!==this._datatype?i5(n,ik):void 0;return new r(n,i)},r.prototype.forEach=function(e){var t=this;!function r(n,i){n4(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(n4(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 iO(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return iH(this._data,e)},r.prototype.toString=function(){return iH(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(nX(e)&&(e=e.toNumber()),!nY(e)||!iZ(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(!n4(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(nX(e)&&(e=e.toNumber()),!nY(e)||!iZ(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(nX(n)&&(n=n.toNumber()),!nY(n)||!iZ(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],l=e[1],c=Math.min(u-o,l-s);if(n4(t)){if(t.length!==c)throw Error("Invalid value array length");a=function(e){return t[e]}}else if(n9(t)){var f=t.size();if(1!==f.length||f[0]!==c)throw Error("Invalid matrix length");a=function(e){return t.get([e])}}else a=function(){return t};i||(i=nX(a(0))?a(0).mul(0):0);var d=[];if(e.length>0){d=i1(d,e,i);for(var h=0;h<c;h++)d[h+o][h+s]=a(h)}return new r({data:d,size:[u,l]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!nY(e)||!iZ(e)||!nY(t)||!iZ(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return i0(e,this._size[0]),i0(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 sq=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},sG=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},sW=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)},sK=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))},sH=function(){throw SyntaxError("Invalid Param")};function sJ(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 sY={re:0,im:0},sX=function(e,t){if(null==e)sY.re=sY.im=0;else if(void 0!==t)sY.re=e,sY.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)sY.re=e.re,sY.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return sQ.INFINITY;sY.re=e.abs*Math.cos(e.arg),sY.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return sQ.INFINITY;sY.re=e.r*Math.cos(e.phi),sY.im=e.r*Math.sin(e.phi)}else 2===e.length?(sY.re=e[0],sY.im=e[1]):sH();break;case"string":sY.im=sY.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&sH();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&&sH()," "===r[e+1]||isNaN(r[e+1])?sY.im+=parseFloat((i%2?"-":"")+"1"):(sY.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&sH(),"i"===r[e+1]||"I"===r[e+1]?(sY.im+=parseFloat((i%2?"-":"")+t),e++):sY.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&sH();break;case"number":sY.im=0,sY.re=e;break;default:sH()}return isNaN(sY.re)||isNaN(sY.im),sY};function sQ(e,t){if(!(this instanceof sQ))return new sQ(e,t);let r=sX(e,t);this.re=r.re,this.im=r.im}sQ.prototype={re:0,im:0,sign:function(){let e=sK(this.re,this.im);return new sQ(this.re/e,this.im/e)},add:function(e,t){let r=sX(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?sQ.NAN:sQ.INFINITY:new sQ(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=sX(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?sQ.NAN:sQ.INFINITY:new sQ(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=sX(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?sQ.NAN:n||i?sQ.INFINITY:0===r.im&&0===this.im?new sQ(this.re*r.re,0):new sQ(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=sX(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 sQ.NAN;if(s||n)return sQ.INFINITY;if(a||i)return sQ.ZERO;if(0===r.im)return new sQ(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 sQ((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 sQ((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=sX(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return sQ.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new sQ(Math.pow(this.re,r.re),0);else if(0===this.re)switch((r.re%4+4)%4){case 0:return new sQ(Math.pow(this.im,r.re),0);case 1:return new sQ(0,Math.pow(this.im,r.re));case 2:return new sQ(-Math.pow(this.im,r.re),0);case 3:return new sQ(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return sQ.ZERO;let i=Math.atan2(this.im,this.re),a=sJ(this.re,this.im),s=Math.exp(r.re*a-r.im*i),o=r.im*a+r.re*i;return new sQ(s*Math.cos(o),s*Math.sin(o))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new sQ(Math.sqrt(e),0);else return new sQ(0,Math.sqrt(-e));let r=Math.sqrt(.5*(sK(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new sQ(r,t<0?-n:n):new sQ(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new sQ(e,0):new sQ(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new sQ(Math.expm1(e)*Math.cos(t)+sW(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new sQ(Math.log(e),0):new sQ(sJ(e,t),Math.atan2(t,e))},abs:function(){return sK(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new sQ(Math.sin(e)*sq(t),Math.cos(e)*sG(t))},cos:function(){let e=this.re,t=this.im;return new sQ(Math.cos(e)*sq(t),-Math.sin(e)*sG(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+sq(t);return new sQ(Math.sin(e)/r,sG(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-sq(t);return new sQ(-Math.sin(e)/r,sG(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*sq(2*t)+.5*Math.cos(2*e);return new sQ(Math.cos(e)*sq(t)/r,Math.sin(e)*sG(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*sq(2*t)-.5*Math.cos(2*e);return new sQ(Math.sin(e)*sq(t)/r,-Math.cos(e)*sG(t)/r)},asin:function(){let e=this.re,t=this.im,r=new sQ(t*t-e*e+1,-2*e*t).sqrt(),n=new sQ(r.re-t,r.im+e).log();return new sQ(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new sQ(t*t-e*e+1,-2*e*t).sqrt(),n=new sQ(r.re-t,r.im+e).log();return new sQ(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new sQ(0,1/0);if(-1===t)return new sQ(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new sQ((1-t*t-e*e)/r,-2*e/r).log();return new sQ(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new sQ(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new sQ(e/r,-t/r).atan():new sQ(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 sQ(0,1/0);let r=e*e+t*t;return 0!==r?new sQ(e/r,-t/r).acos():new sQ(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 sQ(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new sQ(e/r,-t/r).asin():new sQ(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new sQ(sG(e)*Math.cos(t),sq(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new sQ(sq(e)*Math.cos(t),sG(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=sq(e)+Math.cos(t);return new sQ(sG(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=sq(e)-Math.cos(t);return new sQ(sG(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-sq(2*e);return new sQ(-2*sG(e)*Math.cos(t)/r,2*sq(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+sq(2*e);return new sQ(2*sq(e)*Math.cos(t)/r,-2*sG(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 sQ((n*r-t*t)/i,(t*r+n*t)/i):new sQ(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=sJ(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 sQ(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new sQ(e/r,-t/r).atanh():new sQ(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 sQ(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let r=e*e+t*t;return 0!==r?new sQ(e/r,-t/r).asinh():new sQ(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return sQ.INFINITY;let r=e*e+t*t;return 0!==r?new sQ(e/r,-t/r).acosh():new sQ(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return sQ.INFINITY;if(this.isInfinite())return sQ.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new sQ(e/r,-t/r)},conjugate:function(){return new sQ(this.re,-this.im)},neg:function(){return new sQ(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new sQ(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new sQ(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new sQ(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=sX(e,t);return Math.abs(r.re-this.re)<=sQ.EPSILON&&Math.abs(r.im-this.im)<=sQ.EPSILON},clone:function(){return new sQ(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<sQ.EPSILON&&(e=0),Math.abs(t)<sQ.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()}},sQ.ZERO=new sQ(0,0),sQ.ONE=new sQ(1,0),sQ.I=new sQ(0,1),sQ.PI=new sQ(Math.PI,0),sQ.E=new sQ(Math.E,0),sQ.INFINITY=new sQ(1/0,1/0),sQ.NAN=new sQ(NaN,NaN),sQ.EPSILON=1e-15;var s0=iF("Complex",[],()=>(sQ.prototype.type="Complex",sQ.prototype.isComplex=!0,sQ.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},sQ.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},sQ.prototype.format=function(e){var t=this.im,r=this.re,n=iB(this.re,e),i=iB(this.im,e),a=nY(e)?e:e?e.precision:null;if(null!==a){var s=Math.pow(10,-a);Math.abs(r/t)<s&&(r=0),Math.abs(t/r)<s&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},sQ.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return sQ(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(nY(r)){if(n1(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),nY(n))return new sQ({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")}},sQ.prototype.valueOf=sQ.prototype.toString,sQ.fromJSON=function(e){return new sQ(e)},sQ.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},sQ),{isClass:!0}),s1={s:1,n:0,d:1};function s2(e,t){if(isNaN(e=parseInt(e,10)))throw s8();return e*t}function s4(e,t){if(0===t)throw s6();var r=Object.create(s7.prototype);r.s=e<0?-1:1;var n=s3(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function s9(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 s5=function(e,t){var r,n=0,i=1,a=1,s=0,o=0,u=0,l=1,c=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 oe()}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 s8();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&&(c=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=c);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*=c}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(null===(d=e.match(/\d+|./g)))throw s8();if("-"===d[f]?(a=-1,f++):"+"===d[f]&&f++,d.length===f+1?o=s2(d[f++],a):"."===d[f+1]||"."===d[f]?("."!==d[f]&&(s=s2(d[f++],a)),(++f+1===d.length||"("===d[f+1]&&")"===d[f+3]||"'"===d[f+1]&&"'"===d[f+3])&&(o=s2(d[f],a),l=Math.pow(10,d[f].length),f++),("("===d[f]&&")"===d[f+2]||"'"===d[f]&&"'"===d[f+2])&&(u=s2(d[f+1],a),c=Math.pow(10,d[f+1].length)-1,f+=3)):"/"===d[f+1]||":"===d[f+1]?(o=s2(d[f],a),l=s2(d[f+2],1),f+=3):"/"===d[f+3]&&" "===d[f+1]&&(s=s2(d[f],a),o=s2(d[f+2],a),l=s2(d[f+4],1),f+=5),d.length<=f){a=n=u+(i=l*c)*s+c*o;break}default:throw s8()}if(0===i)throw s6();s1.s=a<0?-1:1,s1.n=Math.abs(n),s1.d=Math.abs(i)};function s3(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function s7(e,t){if(s5(e,t),!(this instanceof s7))return s4(s1.s*s1.n,s1.d);e=s3(s1.d,s1.n),this.s=s1.s,this.n=s1.n/e,this.d=s1.d/e}var s6=function(){return Error("Division by Zero")},s8=function(){return Error("Invalid argument")},oe=function(){return Error("Parameters must be integer")};s7.prototype={s:1,n:0,d:1,abs:function(){return s4(this.n,this.d)},neg:function(){return s4(-this.s*this.n,this.d)},add:function(e,t){return s5(e,t),s4(this.s*this.n*s1.d+s1.s*this.d*s1.n,this.d*s1.d)},sub:function(e,t){return s5(e,t),s4(this.s*this.n*s1.d-s1.s*this.d*s1.n,this.d*s1.d)},mul:function(e,t){return s5(e,t),s4(this.s*s1.s*this.n*s1.n,this.d*s1.d)},div:function(e,t){return s5(e,t),s4(this.s*s1.s*this.n*s1.d,this.d*s1.n)},clone:function(){return s4(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new s7(NaN);if(void 0===e)return s4(this.s*this.n%this.d,1);if(s5(e,t),0===s1.n&&0===this.d)throw s6();return s4(this.s*(s1.d*this.n)%(s1.n*this.d),s1.d*this.d)},gcd:function(e,t){return s5(e,t),s4(s3(s1.n,this.n)*s3(s1.d,this.d),s1.d*this.d)},lcm:function(e,t){return(s5(e,t),0===s1.n&&0===this.n)?s4(0,1):s4(s1.n*this.n,s3(s1.n,this.n)*s3(s1.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s7(NaN):s4(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 s7(NaN):s4(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 s7(NaN):s4(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return s5(e,t),s4(this.s*Math.round(this.n*s1.d/(this.d*s1.n))*s1.n,s1.d)},inverse:function(){return s4(this.s*this.d,this.n)},pow:function(e,t){if(s5(e,t),1===s1.d)if(s1.s<0)return s4(Math.pow(this.s*this.d,s1.n),Math.pow(this.n,s1.n));else return s4(Math.pow(this.s*this.n,s1.n),Math.pow(this.d,s1.n));if(this.s<0)return null;var r=s9(this.n),n=s9(this.d),i=1,a=1;for(var s in r)if("1"!==s){if("0"===s){i=0;break}if(r[s]*=s1.n,r[s]%s1.d!=0)return null;r[s]/=s1.d,i*=Math.pow(s,r[s])}for(var s in n)if("1"!==s){if(n[s]*=s1.n,n[s]%s1.d!=0)return null;n[s]/=s1.d,a*=Math.pow(s,n[s])}return s1.s<0?s4(a,i):s4(i,a)},equals:function(e,t){return s5(e,t),this.s*this.n*s1.d==s1.s*s1.n*this.d},compare:function(e,t){s5(e,t);var r=this.s*this.n*s1.d-s1.s*s1.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=s4(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 s5(e,t),!(!(s1.n*this.d)||this.n*s1.d%(s1.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 ot=iF("Fraction",[],()=>(s7.prototype.type="Fraction",s7.prototype.isFraction=!0,s7.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},s7.fromJSON=function(e){return new s7(e)},s7),{isClass:!0}),or=r(2915);function on(e,t){return!!e&&"object"==typeof e&&(!!iI(oa,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function oi(e){return"object"==typeof e&&e&&e.constructor===Object}var oa={length:!0,name:!0},os={toString:!0,valueOf:!0,toLocaleString:!0};class oo{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){var t,r,n=this.wrappedObject;if(oi(n)&&on(n,e))return n[e];if("function"==typeof n[e]&&(t=n,r=e,!(null==t||"function"!=typeof t[r]||iI(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(iI(os,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,r){if(oi(e)&&on(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 ou(e){return!!e&&(e instanceof Map||e instanceof oo||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var ol=function(){return ol=or.create,or};function oc(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function of(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function od(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var oh={BigNumberDependencies:sL,ComplexDependencies:{createComplexClass:s0},DenseMatrixDependencies:sV,FractionDependencies:{createFractionClass:ot},createTyped:iF("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=ol();return a.types=[{name:"number",test:nY},{name:"Complex",test:nQ},{name:"BigNumber",test:nX},{name:"Fraction",test:n0},{name:"Unit",test:n1},{name:"string",test:n2},{name:"Chain",test:iE},{name:"Array",test:n4},{name:"Matrix",test:n9},{name:"DenseMatrix",test:n3},{name:"SparseMatrix",test:n7},{name:"Range",test:n6},{name:"Index",test:n8},{name:"boolean",test:ie},{name:"ResultSet",test:it},{name:"Help",test:ir},{name:"function",test:ii},{name:"Date",test:ia},{name:"RegExp",test:is},{name:"null",test:iu},{name:"undefined",test:il},{name:"AccessorNode",test:ic},{name:"ArrayNode",test:id},{name:"AssignmentNode",test:ih},{name:"BlockNode",test:ip},{name:"ConditionalNode",test:im},{name:"ConstantNode",test:ig},{name:"FunctionNode",test:iv},{name:"FunctionAssignmentNode",test:iy},{name:"IndexNode",test:ib},{name:"Node",test:iw},{name:"ObjectNode",test:i_},{name:"OperatorNode",test:ix},{name:"ParenthesisNode",test:iN},{name:"RangeNode",test:iS},{name:"SymbolNode",test:iM},{name:"Map",test:ou},{name:"Object",test:io}],a.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||oc(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||of(e),new r(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return r||of(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||of(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||od(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||oc(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||od(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||of(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||oc(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||od(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})},op="equalScalar",om=iF(op,["typed","config"],e=>{var{typed:t,config:r}=e;return t(op,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return iG(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,iG(e.re,t.re,n)&&iG(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)}})});iF(op,["typed","config"],e=>{var{typed:t,config:r}=e;return t(op,{"number, number":function(e,t){return iG(e,t,r.epsilon)}})});var og={typedDependencies:oh,createEqualScalar:om},oy=iF("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&&!n2(t))throw Error("Invalid datatype: "+t);if(n9(e)){var r,n,s;r=this,n=e,s=t,"SparseMatrix"===n.type?(r._values=n._values?iO(n._values):void 0,r._index=iO(n._index),r._ptr=iO(n._ptr),r._size=iO(n._size),r._datatype=s||n._datatype):a(r,n.valueOf(),s||n._datatype)}else if(e&&n4(e.index)&&n4(e.ptr)&&n4(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(n4(e))a(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+ik(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(n2(i)&&(o=t.find(r,[i,i])||r,u=t.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var c=0;c<a;c++){var f=n[c];if(n4(f)){if(0===l&&s<f.length&&(s=f.length),l<f.length){var d=f[l];o(d,u)||(e._values.push(d),e._index.push(c))}}else 0===l&&s<1&&(s=1),o(f,u)||(e._values.push(f),e._index.push(c))}l++}while(l<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,l=a||0,c=r,f=0;n2(e._datatype)&&(c=t.find(r,[e._datatype,e._datatype])||r,f=t.convert(0,e._datatype),l=t.convert(l,e._datatype));var d=!c(l,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(l),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,l),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 l(e,t,r,n,i){var a,s,o=n[0],u=n[1],l=[];for(a=0;a<o;a++)for(s=0,l[a]=[];s<u;s++)l[a][s]=0;for(s=0;s<u;s++)for(var c=r[s],f=r[s+1],d=c;d<f;d++)l[a=t[d]][s]=e?i?iO(e[d]):e[d]:1;return l}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 i5(this._values,ik)},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(!n8(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 iJ(o.length,e._size.length);var u=t.min(),l=t.max();for(r=0,n=e._size.length;r<n;r++)i0(u[r],e._size[r]),i0(l[r],e._size[r]);var c=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=c?[]: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(c[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(n9(r)?(i=r.size(),r=r.toArray()):i=iX(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 iJ(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=i9(r,a.length,u,i)}if(!iA(a,i))throw new iJ(a,i,">");if(1===a.length)t.dimension(0).forEach(function(t,i){i0(t),e.set([t,0],r[i[0]],n)});else{var l=t.dimension(0),c=t.dimension(1);l.forEach(function(t,i){i0(t),c.forEach(function(a,s){i0(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(!n4(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iJ(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];i0(t,this._size[0]),i0(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(!n4(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new iJ(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var a=e[0],l=e[1],c=this._size[0],f=this._size[1],d=r,h=0;n2(this._datatype)&&(d=t.find(r,[this._datatype,this._datatype])||r,h=t.convert(0,this._datatype)),(a>c-1||l>f-1)&&(u(this,Math.max(a+1,c),Math.max(l+1,f),i),c=this._size[0],f=this._size[1]),i0(a,c),i0(l,f);var p=s(a,this._ptr[l],this._ptr[l+1],this._index);return p<this._ptr[l+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,l,this._values,this._index,this._ptr):this._values[p]=n:o(p,a,l,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!n5(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(!nY(e)||!iZ(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+iH(n)+")")}),u(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!n4(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(!nY(t)||!iZ(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+iH(e)+")")});var r=this._size[0]*this._size[1],n=(e=i2(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 l=0;l<i._ptr[u+1]-i._ptr[u];l++)a.push(u);for(var c=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<c.length;y++){var v=f[y],b=a[y],w=c[y];o(s(v,i._ptr[b],i._ptr[b+1],i._index),v,b,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?iO(this._values):void 0,index:iO(this._index),ptr:iO(this._ptr),size:iO(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,l){var c=[],f=[],d=[],h=r,p=0;n2(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)||(c.push(e),f.push(t))},g=0;g<=o;g++){d.push(c.length);var y=e._ptr[g],v=e._ptr[g+1];if(l)for(var b=y;b<v;b++){var w=e._index[b];w>=0&&w<=a&&m(e._values[b],w-0,g-0)}else{for(var _={},x=y;x<v;x++)_[e._index[x]]=e._values[x];for(var N=0;N<=a;N++)m(N in _?_[N]:0,N-0,g-0)}}return d.push(c.length),new i({values:c,index:f,ptr:d,size:[a-0+1,o-0+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 l={},c=a;c<s;c++)l[this._index[c]]=this._values[c];for(var f=0;f<r;f++)e(f in l?l[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 l(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return l(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 ["+iH(t,e)+" x "+iH(r,e)+"] density: "+iH(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 ("+iH(this._index[u],e)+", "+iH(a,e)+") ==> "+(this._values?iH(this._values[u],e):"X");return i},i.prototype.toString=function(){return iH(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(nX(e)&&(e=e.toNumber()),!nY(e)||!iZ(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=[],l=[];l[0]=0;for(var c=t;c<a&&o.length<s;c++)for(var f=this._ptr[c],d=this._ptr[c+1],h=f;h<d;h++){var p=this._index[h];if(p===c-t+r){o.push(this._values[h]),u[o.length-1]=p-r;break}}return l.push(o.length),new i({values:o,index:u,ptr:l,size:[s,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,a,s,o){if(!n4(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(nX(e)&&(e=e.toNumber()),!nY(e)||!iZ(e)||e<1)throw Error("Size values must be positive integers");return e}),a){if(nX(a)&&(a=a.toNumber()),!nY(a)||!iZ(a))throw TypeError("The parameter k must be an integer number")}else a=0;var u,l=r,c=0;n2(o)&&(l=t.find(r,[o,o])||r,c=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(n4(n)){if(n.length!==m)throw Error("Invalid value array length");u=function(e){return n[e]}}else if(n9(n)){var g=n.size();if(1!==g.length||g[0]!==m)throw Error("Invalid matrix length");u=function(e){return n.get([e])}}else u=function(){return n};for(var y=[],v=[],b=[],w=0;w<p;w++){b.push(y.length);var _=w-f;if(_>=0&&_<m){var x=u(_);l(x,c)||(v.push(_+d),y.push(x))}}return b.push(y.length),new i({values:y,index:v,ptr:b,size:[h,p]})},i.prototype.swapRows=function(e,t){if(!nY(e)||!iZ(e)||!nY(t)||!iZ(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return i0(e,this._size[0]),i0(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],l=a[o+1],c=s(e,u,l,i),f=s(t,u,l,i);if(c<l&&f<l&&i[c]===e&&i[f]===t){if(n){var d=n[c];n[c]=n[f],n[f]=d}continue}if(c<l&&i[c]===e&&(f>=l||i[f]!==t)){var h=n?n[c]:void 0;i.splice(f,0,t),n&&n.splice(f,0,h),i.splice(f<=c?c+1:c,1),n&&n.splice(f<=c?c+1:c,1);continue}if(f<l&&i[f]===t&&(c>=l||i[c]!==e)){var p=n?n[f]:void 0;i.splice(c,0,e),n&&n.splice(c,0,p),i.splice(c<=f?f+1:f,1),n&&n.splice(c<=f?f+1:f,1)}}},i},{isClass:!0}),ov="matrix",ob=iF(ov,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(ov,{"":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)+".")}}),ow=iF("algorithm01",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a,s,o=e._data,u=e._size,l=e._datatype,c=r._values,f=r._index,d=r._ptr,h=r._size,p=r._datatype;if(u.length!==h.length)throw new iJ(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(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=u[0],g=u[1],y="string"==typeof l&&l===p?l:void 0,v=y?t.find(n,[y,y]):n,b=[];for(a=0;a<m;a++)b[a]=[];var w=[],_=[];for(s=0;s<g;s++){for(var x=s+1,N=d[s],S=d[s+1],M=N;M<S;M++)w[a=f[M]]=i?v(c[M],o[a][s]):v(o[a][s],c[M]),_[a]=x;for(a=0;a<m;a++)_[a]===x?b[a][s]=w[a]:b[a][s]=o[a][s]}return e.createDenseMatrix({data:b,size:[m,g],datatype:y})}}),o_=iF("algorithm04",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a,s,o,u,l,c,f=e._values,d=e._index,h=e._ptr,p=e._size,m=e._datatype,g=n._values,y=n._index,v=n._ptr,b=n._size,w=n._datatype;if(p.length!==b.length)throw new iJ(p.length,b.length);if(p[0]!==b[0]||p[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+b+")");var _=p[0],x=p[1],N=r,S=0,M=i;"string"==typeof m&&m===w&&(a=m,N=t.find(r,[a,a]),S=t.convert(0,a),M=t.find(i,[a,a]));var E=f&&g?[]:void 0,k=[],O=[],T=f&&g?[]:void 0,A=f&&g?[]:void 0,C=[],I=[];for(o=0;o<x;o++){O[o]=k.length;var D=o+1;for(l=h[o],c=h[o+1],u=l;u<c;u++)s=d[u],k.push(s),C[s]=D,T&&(T[s]=f[u]);for(l=v[o],c=v[o+1],u=l;u<c;u++)if(C[s=y[u]]===D){if(T){var j=M(T[s],g[u]);N(j,S)?C[s]=null:T[s]=j}}else k.push(s),I[s]=D,A&&(A[s]=g[u]);if(T&&A)for(u=O[o];u<k.length;)C[s=k[u]]===D?(E[u]=T[s],u++):I[s]===D?(E[u]=A[s],u++):k.splice(u,1)}return O[x]=k.length,e.createSparseMatrix({values:E,index:k,ptr:O,size:[_,x],datatype:a})}}),ox=iF("algorithm10",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:r}=e;return function(e,n,i,a){var s,o=e._values,u=e._index,l=e._ptr,c=e._size,f=e._datatype;if(!o)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=c[0],h=c[1],p=i;"string"==typeof f&&(s=f,n=t.convert(n,s),p=t.find(i,[s,s]));for(var m=[],g=[],y=[],v=0;v<h;v++){for(var b=v+1,w=l[v],_=l[v+1],x=w;x<_;x++){var N=u[x];g[N]=o[x],y[N]=b}for(var S=0;S<d;S++)0===v&&(m[S]=[]),y[S]===b?m[S][v]=a?p(n,g[S]):p(g[S],n):m[S][v]=n}return new r({data:m,size:[d,h],datatype:s})}}),oN=iF("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,l=r._size,c=r._datatype,f=[];if(s.length!==l.length)throw new iJ(s.length,l.length);for(var d=0;d<s.length;d++){if(s[d]!==l[d])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+l+")");f[d]=s[d]}var h=n;"string"==typeof o&&o===c&&(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 l=0;l<i;l++)o[l]=e(t,r+1,n,n[r+1],a[l],s[l]);return o}(h,0,f,f[0],a,u):[];return e.createDenseMatrix({data:p,size:f,datatype:i})}}),oS=iF("algorithm14",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a,s=e._data,o=e._size,u=e._datatype,l=n;"string"==typeof u&&(a=u,r=t.convert(r,a),l=t.find(n,[a,a]));var c=o.length>0?function e(t,r,n,i,a,s,o){var u=[];if(r===n.length-1)for(var l=0;l<i;l++)u[l]=o?t(s,a[l]):t(a[l],s);else for(var c=0;c<i;c++)u[c]=e(t,r+1,n,n[r+1],a[c],s,o);return u}(l,0,o,o[0],s,r,i):[];return e.createDenseMatrix({data:c,size:iO(o),datatype:a})}});function oM(e,t){var r;if(!iZ(e)||!iZ(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}oM.signature="number, number";let{gcd:oE}=function e(t,r){var n,i,a,s=(0,nJ.A)({},i6,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:nY,isComplex:nQ,isBigNumber:nX,isFraction:n0,isUnit:n1,isString:n2,isArray:n4,isMatrix:n9,isCollection:n5,isDenseMatrix:n3,isSparseMatrix:n7,isRange:n6,isIndex:n8,isBoolean:ie,isResultSet:it,isHelp:ir,isFunction:ii,isDate:ia,isRegExp:is,isObject:io,isNull:iu,isUndefined:il,isAccessorNode:ic,isArrayNode:id,isAssignmentNode:ih,isBlockNode:ip,isConditionalNode:im,isConstantNode:ig,isFunctionAssignmentNode:iy,isFunctionNode:iv,isIndexNode:ib,isNode:iw,isObjectNode:i_,isOperatorNode:ix,isParenthesisNode:iN,isRangeNode:iS,isSymbolNode:iM,isChain:iE}).on=(i=new ij).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 iT(e,iO);var n=iT(e,iO);at(r,"matrix",i8),at(r,"number",ae),function e(t,r){if(Array.isArray(r))throw TypeError("Arrays are not supported by deepExtend");for(var n in r)if(iI(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=iT(e,iO);return t("config",i,n,iT(r,iO)),i}return r.MATRIX_OPTIONS=i8,r.NUMBER_OPTIONS=ae,Object.keys(i6).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={},l=function(e,t,r,n){function i(e,t){t&&"function"==typeof t.transform?(r.expression.transform[e]=t.transform,iI(o,e)||(r.expression.mathWithTransform[e]=t.transform)):(delete r.expression.transform[e],iI(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 l=arguments.length;if(1!==l&&2!==l)throw new i7("import",l,1,2);u||(u={});var c={};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)iI(r,i)&&e(t,r[i],i);else if(iR(r)||void 0!==n){var a=iR(r)?s(r)?r.fn+".transform":r.fn:n;if(iI(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")}(c,t),c)if(iI(c,f)){var d,h=c[f];if(iR(h))!function(t,i){var u,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(i3(l,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(l));var c=s(t)?r.expression.transform:r,f=l in r.expression.transform,d=iI(c,l)?c[l]:void 0,h=function(){var n={};t.dependencies.map(iP).forEach(e=>{if(i3(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 "'+l+'": already exists')};t.meta&&!1===t.meta.lazy?c[l]=h():iC(c,l,h),d&&f?function(e){delete r.expression.transform[e],iI(o,e)?delete r.expression.mathWithTransform[e]:r.expression.mathWithTransform[e]=r[e]}(l):!s(t)&&(-1!==(u=t).fn.indexOf(".")||iI(o,u.fn)||u.meta&&u.meta.isClass)||iC(r.expression.mathWithTransform,l,()=>c[l]),n[l]=t,r.emit("import",l,h)}(h,u);else{if("function"==typeof(d=h)||"number"==typeof d||"string"==typeof d||"boolean"==typeof d||null===d||n1(d)||nQ(d)||nX(d)||n0(d)||n9(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=l,o.on("config",()=>{iD(u).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&l(e,{override:!0})})}),o.create=e.bind(null,t),o.factory=iF,o.import(iD((function e(t,r){for(var n in t)if(iI(t,n)){var i=t[n];"object"==typeof i&&null!==i?e(i,r):r[n]=i}}(t,a={}),a))),o.ArgumentsError=i7,o.DimensionError=iJ,o.IndexError=iY,o}({gcdDependencies:{BigNumberDependencies:sL,DenseMatrixDependencies:sV,equalScalarDependencies:og,matrixDependencies:{DenseMatrixDependencies:sV,MatrixDependencies:sU,SparseMatrixDependencies:{MatrixDependencies:sU,equalScalarDependencies:og,typedDependencies:oh,createSparseMatrixClass:oy},typedDependencies:oh,createMatrix:ob},typedDependencies:oh,createGcd:iF("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a}=e,s=ow({typed:t}),o=o_({typed:t,equalScalar:n}),u=ox({typed:t,DenseMatrix:a}),l=oN({typed:t}),c=oS({typed:t});return t("gcd",{"number, number":oM,"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 l(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 c(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return u(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return c(r(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return c(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}})})}}),ok=10;function oO(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 oT(e){let t,r,n=[];for(let t of e)if(t&&"timeRange"in t){if(void 0===t||void 0===t.timeRange||void 0===t.stepMs)continue;if(n.push(t.stepMs),void 0===r){r=t.timeRange;continue}t.timeRange.start<r.start&&(r.start=t.timeRange.start),t.timeRange.end>r.end&&(r.end=t.timeRange.end)}else if(t&&"values"in t){for(let e=0;e<t.values.length;e++){let n=t.values[e];if(void 0===n)continue;let[i]=n,a=new Date(i),s=new Date(i);if(void 0===r){r={start:a,end:s};continue}a<r.start&&(r.start=a),s>r.end&&(r.end=s)}if(void 0===r)return;let e=r.start.valueOf(),n=r.end.valueOf(),i=n-e;return{startMs:e,endMs:n,rangeMs:i,stepMs:ok}}if(void 0===r)return;if(1===n.length)t=n[0];else{let e=oE(...n);t=e<ok?ok:e}let i=r.start.valueOf(),a=r.end.valueOf();return{startMs:i,endMs:a,stepMs:t,rangeMs:a-i}}function oA(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 oC(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 oI(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 oD(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=oI(t,e);return oA(t,r)}function oj(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=oA(r,e.spec.columns));break;case"MergeIndexedColumns":e.spec.column&&(r=oI(r,e.spec.column));break;case"MergeColumns":e.spec.columns&&e.spec.columns.length>0&&e.spec.name&&(r=oC(r,e.spec.columns,e.spec.name));break;case"MergeSeries":r=oD(r)}return r.map(e=>Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}))}function oF(e){return!!e?.startsWith("/")}function oR(e){if(!e)throw Error("Input string cannot be empty");if(!oF(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 oP(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=oR(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}},3420: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},2915: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 l(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 c(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=j(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 l(t.types[0].name).test;if(2===t.types.length){var r=l(t.types[0].name).test,n=l(t.types[1].name).test;return function(e){return r(e)||n(e)}}var i=t.types.map(function(e){return l(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)?j(e.params):null}function y(e,t,r){var n=g(e,t);return(n?r?n.types.filter(b):n.types:[]).map(v)}function v(e){return e.name}function b(e){return null===e.conversion||void 0===e.conversion}function w(e,t){var r=function(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return Object.keys(t)}(P(e,function(e){return y(e,t,!1)}));return -1!==r.indexOf("any")?["any"]:r}function _(e,t,r){var n,i,a,s=e||"unnamed",o=r;for(a=0;a<t.length;a++){var u=o.filter(function(e){var r=m(g(e,a));return(a<e.params.length||h(e.params))&&r(t[a])});if(0===u.length){if((i=w(o,a)).length>0){var l=f(t[a]);return(n=TypeError("Unexpected type of argument in function "+s+" (expected: "+i.join(" or ")+", actual: "+l+", index: "+a+")")).data={category:"wrongType",fn:s,index:a,actual:l,expected:i},n}}else o=u}var c=o.map(function(e){return h(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,c))return(n=TypeError("Too few arguments in function "+s+" (expected: "+(i=w(o,a)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:s,index:t.length,expected:i},n;var d=Math.max.apply(null,c);return t.length>d?(n=TypeError("Too many arguments in function "+s+" (expected: "+d+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:s,index:t.length,expectedLength:d}:(n=TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:t.map(f)},n}function x(e){for(var t=999,r=0;r<e.types.length;r++)b(e.types[r])&&(t=Math.min(t,e.types[r].typeIndex));return t}function N(e){for(var t=999,r=0;r<e.types.length;r++)b(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function S(e,t){var r,n,i=Math.min(e.params.length,t.params.length);if(0!=(n=e.params.some(p)-t.params.some(p)))return n;for(r=0;r<i;r++)if(0!=(n=p(e.params[r])-p(t.params[r])))return n;for(r=0;r<i;r++)if(0!==(n=function(e,t){var r;return 0!=(r=e.restParam-t.restParam)||0!=(r=p(e)-p(t))||0!=(r=x(e)-x(t))?r:N(e)-N(t)}(e.params[r],t.params[r])))return n;return e.params.length-t.params.length}function M(e){var t,r,n,i,a=[],s=[];switch(e.types.forEach(function(e){e.conversion&&(a.push(l(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(A).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(A).filter(C).filter(T),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=l(e);return{name:e,typeIndex:c(t),test:t.test,conversion:null,conversionIndex:-1}}),h=f.map(function(e){var t=l(e.from);return{name:e.from,typeIndex:c(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(D))?null:{params:i,fn:t}}).filter(I).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(I);s.sort(S);var o=s[0]&&s[0].params.length<=2&&!h(s[0].params),f=s[1]&&s[1].params.length<=2&&!h(s[1].params),g=s[2]&&s[2].params.length<=2&&!h(s[2].params),v=s[3]&&s[3].params.length<=2&&!h(s[3].params),b=s[4]&&s[4].params.length<=2&&!h(s[4].params),w=s[5]&&s[5].params.length<=2&&!h(s[5].params),_=s.map(function(e){return function(e){var t,r,n;if(h(e)){var i,a=(t=(i=e).slice(0,i.length-1).map(m)).length,s=m(j(e)),o=function(e){for(var t=a;t<e.length;t++)if(!s(e[t]))return!1;return!0};return function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return o(e)&&e.length>=a+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=m(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=m(e[0]),n=m(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(m),function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(e.params)}),x=o?m(s[0].params[0]):t,N=f?m(s[1].params[0]):t,k=g?m(s[2].params[0]):t,O=v?m(s[3].params[0]):t,Z=b?m(s[4].params[0]):t,z=w?m(s[5].params[0]):t,B=o?m(s[0].params[1]):t,$=f?m(s[1].params[1]):t,L=g?m(s[2].params[1]):t,U=v?m(s[3].params[1]):t,V=b?m(s[4].params[1]):t,q=w?m(s[5].params[1]):t,G=s.map(function(e){return function(e,t){var r=t;if(e.some(p)){var n=h(e),i=e.map(M);r=function(){for(var e=[],r=n?arguments.length-1:arguments.length,a=0;a<r;a++)e[a]=i[a](arguments[a]);return n&&(e[r]=arguments[r].map(i[r])),t.apply(this,e)}}var a=r;if(h(e)){var s=e.length-1;a=function(){return r.apply(this,F(arguments,0,s).concat([F(arguments,s)]))}}return a}(e.params,e.fn)}),W=o?G[0]:r,K=f?G[1]:r,H=g?G[2]:r,J=v?G[3]:r,Y=b?G[4]:r,X=w?G[5]:r,Q=o?s[0].params.length:-1,ee=f?s[1].params.length:-1,et=g?s[2].params.length:-1,er=v?s[3].params.length:-1,en=b?s[4].params.length:-1,ei=w?s[5].params.length:-1,ea=6*!!(o&&f&&g&&v&&b&&w),es=s.length,eo=function(){for(var t=ea;t<es;t++)if(_[t](arguments))return G[t].apply(this,arguments);return u.onMismatch(e,arguments,s)},eu=function e(t,r){return arguments.length===Q&&x(t)&&B(r)?W.apply(e,arguments):arguments.length===ee&&N(t)&&$(r)?K.apply(e,arguments):arguments.length===et&&k(t)&&L(r)?H.apply(e,arguments):arguments.length===er&&O(t)&&U(r)?J.apply(e,arguments):arguments.length===en&&Z(t)&&V(r)?Y.apply(e,arguments):arguments.length===ei&&z(t)&&q(r)?X.apply(e,arguments):eo.apply(e,arguments)};try{Object.defineProperty(eu,"name",{value:e})}catch(e){}return i={},s.forEach(function(e){e.params.some(p)||E(e.params,!0).forEach(function(t){i[d(t)]=e.fn})}),eu.signatures=i,eu}function O(e,t,r){throw _(e,t,r)}function T(e){return -1===u.ignore.indexOf(e)}function A(e){return e.trim()}function C(e){return!!e}function I(e){return null!==e}function D(e){return 0===e.types.length}function j(e){return e[e.length-1]}function F(e,t,r){return Array.prototype.slice.call(e,t,r)}function R(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}function P(e,t){return Array.prototype.concat.apply([],e.map(t))}function Z(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(("object"==typeof n.signatures||"string"==typeof n.signature)&&""!==n.name){if(""===t)t=n.name;else if(t!==n.name){var i=Error("Function names do not match (expected: "+t+", actual: "+n.name+")");throw i.data={actual:n.name,expected:t},i}}}return t}function z(e){var t,r={};function n(e,n){if(r.hasOwnProperty(e)&&n!==r[e])throw(t=Error('Signature "'+e+'" is defined twice')).data={signature:e},t}for(var i=0;i<e.length;i++){var a=e[i];if("object"==typeof a.signatures)for(var s in a.signatures)a.signatures.hasOwnProperty(s)&&(n(s,a.signatures[s]),r[s]=a.signatures[s]);else if("string"==typeof a.signature)n(a.signature,a),r[a.signature]=a;else throw(t=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},t}return r}return(u=k("typed",{"string, Object":k,Object:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return k(Z(t),e)},"...Function":function(e){return k(Z(e),z(e))},"string, ...Function":function(e,t){return k(e,z(t))}})).create=n,u.types=i,u.conversions=o,u.ignore=s,u.onMismatch=O,u.throwMismatchError=O,u.createError=_,u.convert=function(e,t){var r=f(e);if(t===r)return e;for(var n=0;n<u.conversions.length;n++){var i=u.conversions[n];if(i.from===r&&i.to===t)return i.convert(e)}throw Error("Cannot convert from "+r+" to "+t)},u.find=function(e,t){if(!e.signatures)throw TypeError("Function is no typed-function");if("string"==typeof t){r=t.split(",");for(var r,n=0;n<r.length;n++)r[n]=r[n].trim()}else if(Array.isArray(t))r=t;else throw TypeError("String array or a comma separated string expected");var i=r.join(","),a=e.signatures[i];if(a)return a;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+r.join(", ")+"))")},u.addType=function(e,t){if(!e||"string"!=typeof e.name||"function"!=typeof e.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==t){for(var r=0;r<u.types.length;r++)if("Object"===u.types[r].name)return void u.types.splice(r,0,e)}u.types.push(e)},u.addConversion=function(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");u.conversions.push(e)},u}()},"function"==typeof define&&define.amd?define([],t):e.exports=t()}}]);
|