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

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